@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
package/dist/index.js CHANGED
@@ -1,14 +1,14 @@
1
+ import { C as outlineItemAfter, E as OUTLINE_READ_LIMITS, S as deletedAttachmentOf, T as outlineItemWithChildren, _ as assertChoiceDefault, a as objectNumbersReferencedBy, b as isNoOpWrite, c as defaultEntryOfDraft, d as formFieldAfter, f as formFieldOfDraft, g as widgetAfterPatch, h as fitWidgetToFamily, i as objectNumbersNamedBy, l as fieldAfterReset, m as widgetsAfterDisplay, n as isUndoChange, o as resolveChangeResources, p as topRowOf, r as itemWrote, s as formEffectOps, t as isSkippedItem, u as fieldAfterValue, v as fieldValueWriteOf, w as outlineItemOfDraft, x as valueEntriesEqual, y as isAtDefault } from "./Change-tMR34hTU.js";
2
+ import { $ as pdfAppearanceTurnOf, A as createPdfTextLayout, At as pageTransform, B as mapActionNode, C as resolveAnnotationPatch, Ct as isRotatedGeometryRun, D as pageGeometryOf, Dt as pdfPointOf, E as createTextLayout, Et as pageQuadOf, F as pdfAnnotationOf, Ft as renderSize, G as mapLinkTarget, H as mapAnnotationActions, I as pdfAnnotationPatchOf, It as PRINT_PAPER, J as pageDestinationOf, K as mapPageActions, L as pageMeasureOf, Lt as printScale, M as pageAnnotationOf, Mt as renderMatrix, N as pageAnnotationPatchOf, Nt as renderTargetArea, O as pageSearchSliceOf, Ot as pdfQuadOf, P as pdfAnnotationDraftOf, Pt as renderTransform, R as pageViewportsOf, Rt as actionTreeOf, S as resolveAnnotationDraft, St as glyphLooseQuad, T as shapeForRect, Tt as pagePointOf, U as mapDocumentActions, V as mapActionTree, W as mapFieldActions, X as ANNOTATION_DEFAULTS, Y as pdfDestinationOf, Z as annotationDefaultsOf, _ as pagePointUnturned, _t as outlineItemRefsEqual, a as squareMetres, at as bundleCodec, b as pageTurnOfDrawn, c as foldText, ct as manifestBytesOf, d as appearanceTurnOf, dt as assertAnnotationResources, et as ATTACHMENT_LIMITS, f as applyAnnotationPatch, ft as hasAnnotationResources, g as pagePointTurned, gt as resolveBinarySource, h as pageGlyphLooseQuad, ht as sniffBinaryMetadata, i as areaUnitLabel, it as assertAnnotationBundleManifest, j as pageAnnotationDraftOf, jt as renderAreaTransform, k as pageTextSegmentOf, kt as pdfRectOf, l as toOriginalRange, lt as ANNOTATION_RESOURCE_ROLE_NAMES, m as pageGlyphLooseBounds, mt as withFileFromResource, n as measureFromRatio, nt as AnnotationTransfer, o as squareOf, ot as DEFAULT_BUNDLE_LIMITS, p as drawnPointsOf, pt as resolveAnnotationResources, r as METRES, rt as assertAnnotationBundle, s as SEARCH_FOLD_VERSION, st as assertWithinLimit, t as measureFromKnownLength, tt as toAttachmentRef, u as annotationOfDraft, ut as annotationResourceBuffers, v as pagePointsBounds, vt as toOutlineItemRef, w as resolveRectCommand, wt as pageBoxOf, x as pageTurnOfUpright, xt as glyphLooseBounds, y as pageQuadBounds, z as pdfMeasureOf } from "./calibrate-nQFgCuki.js";
1
3
  import { a as deletedFieldOf, c as formExportRowsOf, d as decodeSubmitFormFlags, f as fieldScriptOf, g as writesScripts, h as widgetActionsOf, i as formValuesImportFacts, l as WIDGET_ACTION_EVENTS, m as needsScriptRight, n as WIDGET_FLAG_NAMES, o as formResetFacts, p as isFieldScript, r as formImportFacts, s as fieldMatches, t as fieldValueOf, u as actionWriteOf } from "./value-Dhc8eYcx.js";
2
4
  import { B as deletedWith, C as measurementPoint, Ct as pdfRectToOriginSize, D as validAreaBoundary, E as scaleOf, Et as quarterTurnOf, F as buildCommentThreads, I as isStateAnnotation, K as bundlePageMapping, L as standardStateModelOf, M as appearanceChangeOf, N as appearanceImpactOf, O as DRAWN_RECT_KINDS, P as semanticEqual, Q as ANNOTATION_FIELD_SPACES, R as buildThreads, S as measurementReadout, St as pdfRectSize, T as polygonArea, Tt as pdfRectWidth, X as resourceIdOf, Z as compareIsoDateTime, _ as assertPdfFloat, _t as pdfQuadBounds, at as sameColor, b as isDimension, bt as pdfRectHeight, c as assertRichTextAgreement, ct as richTextPlainText, d as faceForFreeTextFont, dt as pdfPointsBounds, et as ANNOTATION_FIELD_NAMES, f as familyKey, ft as pdfTurnOfDrawn, g as touchesCaption, gt as normalizePdfRect, h as resolveMeasurementDraft, ht as normalizePdfQuad, i as assertDeclaredFields, it as rgbOf, j as UNBAKED_KINDS, lt as pdfPointTurned, m as isStandardFontName, mt as isSamePdfRect, ot as DEFAULT_RICH_TEXT_BODY, p as freeTextFontForFace, pt as pdfTurnOfUpright, rt as colorOf, st as richTextParagraphsFromPlainText, tt as ANNOTATION_RESOURCE_ROLES, u as STANDARD_FACES, ut as pdfPointUnturned, v as assertWritableMeasure, vt as pdfQuarterTurnBox, w as pathLength, wt as pdfRectTurnedBounds, x as isReadout, xt as pdfRectIntersection, y as deriveMeasurementLabel, yt as pdfRectFromOriginSize, z as classifyRelation } from "./resolveAnnotationDraft-CUpf0SMh.js";
3
5
  import { _ as serializeError, a as formWidget, c as STANDARD_FONTS, d as pageRefsEqual, f as toPageRef, g as deserializeError, h as EngineError, i as encodeFieldRefKey, l as decodePageKey, m as annotationKey, n as validNumberFormat, o as toFieldRef, p as isValidPageObjectNumber, r as decodeFieldRefKey, s as NO_ANNOTATION_FLAGS, t as formatMeasurement, u as encodePageKey, y as EngineErrorCode } from "./format-Dgg428Kb.js";
4
- import { $ as pdfAppearanceTurnOf, A as createPdfTextLayout, At as renderTargetArea, B as mapActionNode, C as resolveAnnotationPatch, Ct as pageQuadOf, D as pageGeometryOf, Dt as pageTransform, E as createTextLayout, Et as pdfRectOf, F as pdfAnnotationOf, G as mapLinkTarget, H as mapAnnotationActions, I as pdfAnnotationPatchOf, J as pageDestinationOf, K as mapPageActions, L as pageMeasureOf, M as pageAnnotationOf, Mt as renderSize, N as pageAnnotationPatchOf, O as pageSearchSliceOf, Ot as renderAreaTransform, P as pdfAnnotationDraftOf, R as pageViewportsOf, S as resolveAnnotationDraft, St as pagePointOf, T as shapeForRect, Tt as pdfQuadOf, U as mapDocumentActions, V as mapActionTree, W as mapFieldActions, X as ANNOTATION_DEFAULTS, Y as pdfDestinationOf, Z as annotationDefaultsOf, _ as pagePointUnturned, a as squareMetres, at as DEFAULT_BUNDLE_LIMITS, b as pageTurnOfDrawn, bt as isRotatedGeometryRun, c as foldText, ct as ANNOTATION_RESOURCE_ROLE_NAMES, d as appearanceTurnOf, dt as hasAnnotationResources, et as toAttachmentRef, f as applyAnnotationPatch, ft as resolveAnnotationResources, g as pagePointTurned, h as pageGlyphLooseQuad, ht as resolveBinarySource, i as areaUnitLabel, it as bundleCodec, j as pageAnnotationDraftOf, jt as renderTransform, k as pageTextSegmentOf, kt as renderMatrix, l as toOriginalRange, lt as annotationResourceBuffers, m as pageGlyphLooseBounds, mt as sniffBinaryMetadata, n as measureFromRatio, nt as assertAnnotationBundle, o as squareOf, ot as assertWithinLimit, p as drawnPointsOf, pt as withFileFromResource, r as METRES, rt as assertAnnotationBundleManifest, s as SEARCH_FOLD_VERSION, st as manifestBytesOf, t as measureFromKnownLength, tt as AnnotationTransfer, u as annotationOfDraft, ut as assertAnnotationResources, v as pagePointsBounds, vt as glyphLooseBounds, w as resolveRectCommand, wt as pdfPointOf, x as pageTurnOfUpright, xt as pageBoxOf, y as pageQuadBounds, yt as glyphLooseQuad, z as pdfMeasureOf } from "./calibrate-7T3fnP8-.js";
5
- import { $ as pageListOf, A as sameEffectiveValue, B as refsOf, C as searchQueryOf, D as restrictionsFor, E as USAGE_INCOMPLETE, F as worstVerdict, G as pageFormFieldOf, H as placedWidgetOf, I as changedKeys, J as pdfFormFieldDraftOf, K as pageFormSnapshotOf, L as dictEntries, M as combine, N as conclude, O as evaluateStep, P as primaryFinding, Q as pageLayoutOf, R as parsePdfValue, S as matchPageText, T as EdgeResolver, U as draftWritesScripts, V as stableStringify, W as pageFieldActionsOf, X as pageAppearancesOf, Y as pdfWidgetPlacementOf, Z as pdfRenderTargetOf, _ as opIdOf, _t as DEFAULT_MEDIA_BOX, a as annotationWriteCapability, at as concatAnnotationLists, b as SEARCH_SNIPPET_CONTEXT, c as authorizeAnnotationUpdate, ct as normalizeAttachmentFileSource, d as authorizeFieldWrite, dt as generateUuidV7, et as pageSpaceBoxesOf, f as authorizeUnprotected, ft as DEFAULT_PDF_SAVE_MODE, g as isKeptRefusal, gt as resolvePageLayers, h as changeFingerprint, ht as imageSourceOfBytes, i as annotationWriteCapabilities, it as deletedAnnotationsOf, j as assessmentOf, k as restrictionsOf, l as authorizeCapability, lt as familyOfSubtype, m as decodePdfBits, mt as createPageImageHandle, n as allowsFieldWrite, nt as annotationPatchBetween, o as authorizeAnnotationCreate, ot as closeExportSelection, p as PDF_BITS, pt as checkImageQuality, q as pageWidgetOf, r as allowsSomeFieldWrite, rt as mergeAnnotationPatch, s as authorizeAnnotationDelete, st as annotationImportFacts, t as allowsCapability, tt as visibleBoxesOf, u as authorizeFieldGroup, ut as generateUuid, v as canonicalSearchQuery, vt as pageBoxesOf, w as DEFAULT_EDGE_RESOLVER_BUDGET, x as buildSnippet, y as searchContentEpoch, yt as pageRotationOf, z as pdfValueEquals } from "./authority-B3BklsB4.js";
6
- import { A as MissingIdentity, C as lockCovers, D as decodeAnnotKey, E as protectedCapabilities, O as encodeAnnotKey, S as levelFromPermission, T as minLevel, _ as deriveProtection, a as checkFieldAction, b as isProtectableCapability, c as expandRawScope, d as filterMatches, f as parseScope, g as SIGNATURE_POLICY_VERSION, h as PROTECTABLE_CAPABILITIES, i as checkCollab, j as PermissionDenied, k as InvalidScope, l as expandedCapabilities, n as checkAnyFieldAction, o as checkSetGroup, p as validateScopeArray, r as checkCapability, s as collabTargetOf, t as checkAnyCapability, u as fieldRightsOf, v as describeProtection, w as lockNameCovers, x as levelAllows, y as fieldLockFor } from "./resolver-CzxmD9Ck.js";
7
- import { _ as OBJECT_NUMBER_CEILING, a as reorderedList, b as objectNumbersIn, c as validateSearchQuery, d as matchLiteral, f as wordAt, g as assertFormBundleManifest, h as assertFormBundle, i as reorderPart, l as validateSearchRegex, m as FormTransfer, n as anchorOf, o as SEARCH_REGEX_MAX_LENGTH, p as wordBefore, r as positionIndex, s as matchRegex, t as viewportForPoint, u as foldOptionsFor, v as OBJECT_NUMBER_ISSUE_LIMIT, x as parseObjectNumberRanges, y as formatObjectNumberRanges } from "./viewport-BJW13EGZ.js";
6
+ import { $ as pageWidgetOf, A as restrictionsOf, B as pdfValueEquals, C as matchPageText, Ct as imageSourceOfBytes, D as USAGE_INCOMPLETE, Dt as pageBoxesOf, E as EdgeResolver, Et as DEFAULT_MEDIA_BOX, F as primaryFinding, G as mapOutlineItem, H as stableStringify, I as worstVerdict, J as pdfOutlineDraftOf, K as pageOutlineItemOf, L as changedKeys, M as assessmentOf, N as combine, O as restrictionsFor, Ot as pageRotationOf, P as conclude, Q as pageFormSnapshotOf, R as dictEntries, S as buildSnippet, St as createPageImageHandle, T as DEFAULT_EDGE_RESOLVER_BUDGET, Tt as resolvePageLayers, U as placedWidgetOf, V as refsOf, W as draftWritesScripts, X as pageFieldActionsOf, Y as pdfOutlinePatchOf, Z as pageFormFieldOf, _ as isKeptRefusal, _t as generateUuidV7, a as annotationWriteCapability, at as pageListOf, b as searchContentEpoch, bt as checkImageQuality, c as authorizeAnnotationUpdate, ct as annotationPatchBetween, d as authorizeFieldWrite, dt as concatAnnotationLists, et as pdfFormFieldDraftOf, f as authorizeUnprotected, ft as closeExportSelection, g as changeFingerprint, gt as generateUuid, h as deletedOutlineItemsOf, ht as familyOfSubtype, i as annotationWriteCapabilities, it as pageLayoutOf, j as sameEffectiveValue, k as evaluateStep, l as authorizeCapability, lt as mergeAnnotationPatch, m as decodePdfBits, mt as normalizeAttachmentFileSource, n as allowsFieldWrite, nt as pageAppearancesOf, o as authorizeAnnotationCreate, ot as pageSpaceBoxesOf, p as PDF_BITS, pt as annotationImportFacts, q as pageOutlineOf, r as allowsSomeFieldWrite, rt as pdfRenderTargetOf, s as authorizeAnnotationDelete, st as visibleBoxesOf, t as allowsCapability, tt as pdfWidgetPlacementOf, u as authorizeFieldGroup, ut as deletedAnnotationsOf, v as opIdOf, vt as DEFAULT_PDF_SAVE_MODE, w as searchQueryOf, wt as printDpiOf, x as SEARCH_SNIPPET_CONTEXT, xt as checkRenderUsage, y as canonicalSearchQuery, yt as resolvePageExtract, z as parsePdfValue } from "./authority-PuxpGFhJ.js";
7
+ import { A as MissingIdentity, C as lockCovers, D as decodeAnnotKey, E as protectedCapabilities, O as encodeAnnotKey, S as levelFromPermission, T as minLevel, _ as deriveProtection, a as checkFieldAction, b as isProtectableCapability, c as expandRawScope, d as filterMatches, f as parseScope, g as SIGNATURE_POLICY_VERSION, h as PROTECTABLE_CAPABILITIES, i as checkCollab, j as PermissionDenied, k as InvalidScope, l as expandedCapabilities, n as checkAnyFieldAction, o as checkSetGroup, p as validateScopeArray, r as checkCapability, s as collabTargetOf, t as checkAnyCapability, u as fieldRightsOf, v as describeProtection, w as lockNameCovers, x as levelAllows, y as fieldLockFor } from "./resolver-BBggAxQc.js";
8
+ import { _ as OBJECT_NUMBER_CEILING, a as reorderedList, b as objectNumbersIn, c as validateSearchQuery, d as matchLiteral, f as wordAt, g as assertFormBundleManifest, h as assertFormBundle, i as reorderPart, l as validateSearchRegex, m as FormTransfer, n as anchorOf, o as SEARCH_REGEX_MAX_LENGTH, p as wordBefore, r as positionIndex, s as matchRegex, t as viewportForPoint, u as foldOptionsFor, v as OBJECT_NUMBER_ISSUE_LIMIT, x as parseObjectNumberRanges, y as formatObjectNumberRanges } from "./viewport-DQR5LyX3.js";
8
9
  import { a as sliceText, d as shownAppearances, i as charRangeForTextOffsets, l as ANNOTATION_APPEARANCE_MODES, n as charBoundaryAtTextOffset, r as charMapViolation, t as boundaryTextOffset, u as appearanceModesOf } from "./charmap-Cprti1ta.js";
9
10
  import { a as subtypeFromCode, i as PdfAnnotationSubtypeCode, n as PDF_CODE_TO_SUBTYPE, r as PDF_SUBTYPE_TO_CODE, t as ANNOTATION_SUBTYPES } from "./subtype-CG4WpIRj.js";
10
11
  import { n as pageRefsIn, t as mapPageRefs } from "./pageRefs-DkbuxSCV.js";
11
- import { S as deletedAttachmentOf, _ as assertChoiceDefault, a as objectNumbersReferencedBy, b as isNoOpWrite, c as defaultEntryOfDraft, d as formFieldAfter, f as formFieldOfDraft, g as widgetAfterPatch, h as fitWidgetToFamily, i as objectNumbersNamedBy, l as fieldAfterReset, m as widgetsAfterDisplay, n as isUndoChange, o as resolveChangeResources, p as topRowOf, r as itemWrote, s as formEffectOps, t as isSkippedItem, u as fieldAfterValue, v as fieldValueWriteOf, x as valueEntriesEqual, y as isAtDefault } from "./Change-CKoxfTNY.js";
12
12
  import { t as PAGE_INSERT_BLANK_MAX_COUNT } from "./PageInsertBlankInput-DhVYVJ_S.js";
13
- import { i as pdfPermissions, n as collab, r as materializePdfPermissions, t as caps } from "./builders-CNj0POeY.js";
14
- export { ANNOTATION_APPEARANCE_MODES, ANNOTATION_DEFAULTS, ANNOTATION_FIELD_NAMES, ANNOTATION_FIELD_SPACES, ANNOTATION_RESOURCE_ROLES, ANNOTATION_RESOURCE_ROLE_NAMES, ANNOTATION_SUBTYPES, AnnotationTransfer, DEFAULT_BUNDLE_LIMITS, DEFAULT_EDGE_RESOLVER_BUDGET, DEFAULT_MEDIA_BOX, DEFAULT_PDF_SAVE_MODE, DEFAULT_RICH_TEXT_BODY, DRAWN_RECT_KINDS, EdgeResolver, EngineError, EngineErrorCode, FormTransfer, InvalidScope, METRES, MissingIdentity, NO_ANNOTATION_FLAGS, OBJECT_NUMBER_CEILING, OBJECT_NUMBER_ISSUE_LIMIT, PAGE_INSERT_BLANK_MAX_COUNT, PDF_BITS, PDF_CODE_TO_SUBTYPE, PDF_SUBTYPE_TO_CODE, PROTECTABLE_CAPABILITIES, PdfAnnotationSubtypeCode, PermissionDenied, SEARCH_FOLD_VERSION, SEARCH_REGEX_MAX_LENGTH, SEARCH_SNIPPET_CONTEXT, SIGNATURE_POLICY_VERSION, STANDARD_FACES, STANDARD_FONTS, UNBAKED_KINDS, USAGE_INCOMPLETE, WIDGET_ACTION_EVENTS, WIDGET_FLAG_NAMES, actionWriteOf, allowsCapability, allowsFieldWrite, allowsSomeFieldWrite, anchorOf, annotationDefaultsOf, annotationImportFacts, annotationKey, annotationOfDraft, annotationPatchBetween, annotationResourceBuffers, annotationWriteCapabilities, annotationWriteCapability, appearanceChangeOf, appearanceImpactOf, appearanceModesOf, appearanceTurnOf, applyAnnotationPatch, areaUnitLabel, assertAnnotationBundle, assertAnnotationBundleManifest, assertAnnotationResources, assertChoiceDefault, assertDeclaredFields, assertFormBundle, assertFormBundleManifest, assertPdfFloat, assertRichTextAgreement, assertWithinLimit, assertWritableMeasure, assessmentOf, authorizeAnnotationCreate, authorizeAnnotationDelete, authorizeAnnotationUpdate, authorizeCapability, authorizeFieldGroup, authorizeFieldWrite, authorizeUnprotected, boundaryTextOffset, buildCommentThreads, buildSnippet, buildThreads, bundleCodec, bundlePageMapping, canonicalSearchQuery, caps, changeFingerprint, changedKeys, charBoundaryAtTextOffset, charMapViolation, charRangeForTextOffsets, checkAnyCapability, checkAnyFieldAction, checkCapability, checkCollab, checkFieldAction, checkImageQuality, checkSetGroup, classifyRelation, closeExportSelection, collab, collabTargetOf, colorOf, combine, compareIsoDateTime, concatAnnotationLists, conclude, createPageImageHandle, createPdfTextLayout, createTextLayout, decodeAnnotKey, decodeFieldRefKey, decodePageKey, decodePdfBits, decodeSubmitFormFlags, defaultEntryOfDraft, deletedAnnotationsOf, deletedAttachmentOf, deletedFieldOf, deletedWith, deriveMeasurementLabel, deriveProtection, describeProtection, deserializeError, dictEntries, draftWritesScripts, drawnPointsOf, encodeAnnotKey, encodeFieldRefKey, encodePageKey, evaluateStep, expandRawScope, expandedCapabilities, faceForFreeTextFont, familyKey, familyOfSubtype, fieldAfterReset, fieldAfterValue, fieldLockFor, fieldMatches, fieldRightsOf, fieldScriptOf, fieldValueOf, fieldValueWriteOf, filterMatches, fitWidgetToFamily, foldOptionsFor, foldText, formEffectOps, formExportRowsOf, formFieldAfter, formFieldOfDraft, formImportFacts, formResetFacts, formValuesImportFacts, formWidget, formatMeasurement, formatObjectNumberRanges, freeTextFontForFace, generateUuid, generateUuidV7, glyphLooseBounds, glyphLooseQuad, hasAnnotationResources, imageSourceOfBytes, isAtDefault, isDimension, isFieldScript, isKeptRefusal, isNoOpWrite, isProtectableCapability, isReadout, isRotatedGeometryRun, isSamePdfRect, isSkippedItem, isStandardFontName, isStateAnnotation, isUndoChange, isValidPageObjectNumber, itemWrote, levelAllows, levelFromPermission, lockCovers, lockNameCovers, manifestBytesOf, mapActionNode, mapActionTree, mapAnnotationActions, mapDocumentActions, mapFieldActions, mapLinkTarget, mapPageActions, mapPageRefs, matchLiteral, matchPageText, matchRegex, materializePdfPermissions, measureFromKnownLength, measureFromRatio, measurementPoint, measurementReadout, mergeAnnotationPatch, minLevel, needsScriptRight, normalizeAttachmentFileSource, normalizePdfQuad, normalizePdfRect, objectNumbersIn, objectNumbersNamedBy, objectNumbersReferencedBy, opIdOf, pageAnnotationDraftOf, pageAnnotationOf, pageAnnotationPatchOf, pageAppearancesOf, pageBoxOf, pageBoxesOf, pageDestinationOf, pageFieldActionsOf, pageFormFieldOf, pageFormSnapshotOf, pageGeometryOf, pageGlyphLooseBounds, pageGlyphLooseQuad, pageLayoutOf, pageListOf, pageMeasureOf, pagePointOf, pagePointTurned, pagePointUnturned, pagePointsBounds, pageQuadBounds, pageQuadOf, pageRefsEqual, pageRefsIn, pageRotationOf, pageSearchSliceOf, pageSpaceBoxesOf, pageTextSegmentOf, pageTransform, pageTurnOfDrawn, pageTurnOfUpright, pageViewportsOf, pageWidgetOf, parseObjectNumberRanges, parsePdfValue, parseScope, pathLength, pdfAnnotationDraftOf, pdfAnnotationOf, pdfAnnotationPatchOf, pdfAppearanceTurnOf, pdfDestinationOf, pdfFormFieldDraftOf, pdfMeasureOf, pdfPermissions, pdfPointOf, pdfPointTurned, pdfPointUnturned, pdfPointsBounds, pdfQuadBounds, pdfQuadOf, pdfQuarterTurnBox, pdfRectFromOriginSize, pdfRectHeight, pdfRectIntersection, pdfRectOf, pdfRectSize, pdfRectToOriginSize, pdfRectTurnedBounds, pdfRectWidth, pdfRenderTargetOf, pdfTurnOfDrawn, pdfTurnOfUpright, pdfValueEquals, pdfWidgetPlacementOf, placedWidgetOf, polygonArea, positionIndex, primaryFinding, protectedCapabilities, quarterTurnOf, refsOf, renderAreaTransform, renderMatrix, renderSize, renderTargetArea, renderTransform, reorderPart, reorderedList, resolveAnnotationDraft, resolveAnnotationPatch, resolveAnnotationResources, resolveBinarySource, resolveChangeResources, resolveMeasurementDraft, resolvePageLayers, resolveRectCommand, resourceIdOf, restrictionsFor, restrictionsOf, rgbOf, richTextParagraphsFromPlainText, richTextPlainText, sameColor, sameEffectiveValue, scaleOf, searchContentEpoch, searchQueryOf, semanticEqual, serializeError, shapeForRect, shownAppearances, sliceText, sniffBinaryMetadata, squareMetres, squareOf, stableStringify, standardStateModelOf, subtypeFromCode, toAttachmentRef, toFieldRef, toOriginalRange, toPageRef, topRowOf, touchesCaption, validAreaBoundary, validNumberFormat, validateScopeArray, validateSearchQuery, validateSearchRegex, valueEntriesEqual, viewportForPoint, visibleBoxesOf, widgetActionsOf, widgetAfterPatch, widgetsAfterDisplay, withFileFromResource, wordAt, wordBefore, worstVerdict, writesScripts };
13
+ import { i as pdfPermissions, n as collab, r as materializePdfPermissions, t as caps } from "./builders-DV62HA3I.js";
14
+ export { ANNOTATION_APPEARANCE_MODES, ANNOTATION_DEFAULTS, ANNOTATION_FIELD_NAMES, ANNOTATION_FIELD_SPACES, ANNOTATION_RESOURCE_ROLES, ANNOTATION_RESOURCE_ROLE_NAMES, ANNOTATION_SUBTYPES, ATTACHMENT_LIMITS, AnnotationTransfer, DEFAULT_BUNDLE_LIMITS, DEFAULT_EDGE_RESOLVER_BUDGET, DEFAULT_MEDIA_BOX, DEFAULT_PDF_SAVE_MODE, DEFAULT_RICH_TEXT_BODY, DRAWN_RECT_KINDS, EdgeResolver, EngineError, EngineErrorCode, FormTransfer, InvalidScope, METRES, MissingIdentity, NO_ANNOTATION_FLAGS, OBJECT_NUMBER_CEILING, OBJECT_NUMBER_ISSUE_LIMIT, OUTLINE_READ_LIMITS, PAGE_INSERT_BLANK_MAX_COUNT, PDF_BITS, PDF_CODE_TO_SUBTYPE, PDF_SUBTYPE_TO_CODE, PRINT_PAPER, PROTECTABLE_CAPABILITIES, PdfAnnotationSubtypeCode, PermissionDenied, SEARCH_FOLD_VERSION, SEARCH_REGEX_MAX_LENGTH, SEARCH_SNIPPET_CONTEXT, SIGNATURE_POLICY_VERSION, STANDARD_FACES, STANDARD_FONTS, UNBAKED_KINDS, USAGE_INCOMPLETE, WIDGET_ACTION_EVENTS, WIDGET_FLAG_NAMES, actionTreeOf, actionWriteOf, allowsCapability, allowsFieldWrite, allowsSomeFieldWrite, anchorOf, annotationDefaultsOf, annotationImportFacts, annotationKey, annotationOfDraft, annotationPatchBetween, annotationResourceBuffers, annotationWriteCapabilities, annotationWriteCapability, appearanceChangeOf, appearanceImpactOf, appearanceModesOf, appearanceTurnOf, applyAnnotationPatch, areaUnitLabel, assertAnnotationBundle, assertAnnotationBundleManifest, assertAnnotationResources, assertChoiceDefault, assertDeclaredFields, assertFormBundle, assertFormBundleManifest, assertPdfFloat, assertRichTextAgreement, assertWithinLimit, assertWritableMeasure, assessmentOf, authorizeAnnotationCreate, authorizeAnnotationDelete, authorizeAnnotationUpdate, authorizeCapability, authorizeFieldGroup, authorizeFieldWrite, authorizeUnprotected, boundaryTextOffset, buildCommentThreads, buildSnippet, buildThreads, bundleCodec, bundlePageMapping, canonicalSearchQuery, caps, changeFingerprint, changedKeys, charBoundaryAtTextOffset, charMapViolation, charRangeForTextOffsets, checkAnyCapability, checkAnyFieldAction, checkCapability, checkCollab, checkFieldAction, checkImageQuality, checkRenderUsage, checkSetGroup, classifyRelation, closeExportSelection, collab, collabTargetOf, colorOf, combine, compareIsoDateTime, concatAnnotationLists, conclude, createPageImageHandle, createPdfTextLayout, createTextLayout, decodeAnnotKey, decodeFieldRefKey, decodePageKey, decodePdfBits, decodeSubmitFormFlags, defaultEntryOfDraft, deletedAnnotationsOf, deletedAttachmentOf, deletedFieldOf, deletedOutlineItemsOf, deletedWith, deriveMeasurementLabel, deriveProtection, describeProtection, deserializeError, dictEntries, draftWritesScripts, drawnPointsOf, encodeAnnotKey, encodeFieldRefKey, encodePageKey, evaluateStep, expandRawScope, expandedCapabilities, faceForFreeTextFont, familyKey, familyOfSubtype, fieldAfterReset, fieldAfterValue, fieldLockFor, fieldMatches, fieldRightsOf, fieldScriptOf, fieldValueOf, fieldValueWriteOf, filterMatches, fitWidgetToFamily, foldOptionsFor, foldText, formEffectOps, formExportRowsOf, formFieldAfter, formFieldOfDraft, formImportFacts, formResetFacts, formValuesImportFacts, formWidget, formatMeasurement, formatObjectNumberRanges, freeTextFontForFace, generateUuid, generateUuidV7, glyphLooseBounds, glyphLooseQuad, hasAnnotationResources, imageSourceOfBytes, isAtDefault, isDimension, isFieldScript, isKeptRefusal, isNoOpWrite, isProtectableCapability, isReadout, isRotatedGeometryRun, isSamePdfRect, isSkippedItem, isStandardFontName, isStateAnnotation, isUndoChange, isValidPageObjectNumber, itemWrote, levelAllows, levelFromPermission, lockCovers, lockNameCovers, manifestBytesOf, mapActionNode, mapActionTree, mapAnnotationActions, mapDocumentActions, mapFieldActions, mapLinkTarget, mapOutlineItem, mapPageActions, mapPageRefs, matchLiteral, matchPageText, matchRegex, materializePdfPermissions, measureFromKnownLength, measureFromRatio, measurementPoint, measurementReadout, mergeAnnotationPatch, minLevel, needsScriptRight, normalizeAttachmentFileSource, normalizePdfQuad, normalizePdfRect, objectNumbersIn, objectNumbersNamedBy, objectNumbersReferencedBy, opIdOf, outlineItemAfter, outlineItemOfDraft, outlineItemRefsEqual, outlineItemWithChildren, pageAnnotationDraftOf, pageAnnotationOf, pageAnnotationPatchOf, pageAppearancesOf, pageBoxOf, pageBoxesOf, pageDestinationOf, pageFieldActionsOf, pageFormFieldOf, pageFormSnapshotOf, pageGeometryOf, pageGlyphLooseBounds, pageGlyphLooseQuad, pageLayoutOf, pageListOf, pageMeasureOf, pageOutlineItemOf, pageOutlineOf, pagePointOf, pagePointTurned, pagePointUnturned, pagePointsBounds, pageQuadBounds, pageQuadOf, pageRefsEqual, pageRefsIn, pageRotationOf, pageSearchSliceOf, pageSpaceBoxesOf, pageTextSegmentOf, pageTransform, pageTurnOfDrawn, pageTurnOfUpright, pageViewportsOf, pageWidgetOf, parseObjectNumberRanges, parsePdfValue, parseScope, pathLength, pdfAnnotationDraftOf, pdfAnnotationOf, pdfAnnotationPatchOf, pdfAppearanceTurnOf, pdfDestinationOf, pdfFormFieldDraftOf, pdfMeasureOf, pdfOutlineDraftOf, pdfOutlinePatchOf, pdfPermissions, pdfPointOf, pdfPointTurned, pdfPointUnturned, pdfPointsBounds, pdfQuadBounds, pdfQuadOf, pdfQuarterTurnBox, pdfRectFromOriginSize, pdfRectHeight, pdfRectIntersection, pdfRectOf, pdfRectSize, pdfRectToOriginSize, pdfRectTurnedBounds, pdfRectWidth, pdfRenderTargetOf, pdfTurnOfDrawn, pdfTurnOfUpright, pdfValueEquals, pdfWidgetPlacementOf, placedWidgetOf, polygonArea, positionIndex, primaryFinding, printDpiOf, printScale, protectedCapabilities, quarterTurnOf, refsOf, renderAreaTransform, renderMatrix, renderSize, renderTargetArea, renderTransform, reorderPart, reorderedList, resolveAnnotationDraft, resolveAnnotationPatch, resolveAnnotationResources, resolveBinarySource, resolveChangeResources, resolveMeasurementDraft, resolvePageExtract, resolvePageLayers, resolveRectCommand, resourceIdOf, restrictionsFor, restrictionsOf, rgbOf, richTextParagraphsFromPlainText, richTextPlainText, sameColor, sameEffectiveValue, scaleOf, searchContentEpoch, searchQueryOf, semanticEqual, serializeError, shapeForRect, shownAppearances, sliceText, sniffBinaryMetadata, squareMetres, squareOf, stableStringify, standardStateModelOf, subtypeFromCode, toAttachmentRef, toFieldRef, toOriginalRange, toOutlineItemRef, toPageRef, topRowOf, touchesCaption, validAreaBoundary, validNumberFormat, validateScopeArray, validateSearchQuery, validateSearchRegex, valueEntriesEqual, viewportForPoint, visibleBoxesOf, widgetActionsOf, widgetAfterPatch, widgetsAfterDisplay, withFileFromResource, wordAt, wordBefore, worstVerdict, writesScripts };
package/dist/public.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_calibrate = require("./calibrate-DJbi1wuK.cjs");
2
3
  const require_resolveAnnotationDraft = require("./resolveAnnotationDraft-7Ke4nV7F.cjs");
3
4
  const require_format = require("./format-Bp3QFSH1.cjs");
4
- const require_calibrate = require("./calibrate-DJBXnhLE.cjs");
5
- const require_viewport = require("./viewport-DlL5Bxbg.cjs");
5
+ const require_viewport = require("./viewport-CHG9qQUb.cjs");
6
6
  const require_charmap = require("./charmap-aYlefQP9.cjs");
7
- const require_builders = require("./builders-Cgdp_YCn.cjs");
7
+ const require_builders = require("./builders-DgTAj_tP.cjs");
8
8
  const require_LocalDocumentHandle = require("./LocalDocumentHandle-D02FMm-Z.cjs");
9
- const require_DocumentRenderService = require("./DocumentRenderService-BfFdFSwI.cjs");
9
+ const require_DocumentRenderService = require("./DocumentRenderService-9IjSQEIU.cjs");
10
10
  exports.ANNOTATION_DEFAULTS = require_calibrate.ANNOTATION_DEFAULTS;
11
11
  exports.AbortError = require_calibrate.AbortError;
12
12
  exports.AbortablePromise = require_viewport.AbortablePromise;
@@ -34,6 +34,7 @@ exports.isRotatedGeometryRun = require_calibrate.isRotatedGeometryRun;
34
34
  exports.measureFromKnownLength = require_calibrate.measureFromKnownLength;
35
35
  exports.measureFromRatio = require_calibrate.measureFromRatio;
36
36
  exports.measurementReadout = require_resolveAnnotationDraft.measurementReadout;
37
+ exports.outlineItemRefsEqual = require_calibrate.outlineItemRefsEqual;
37
38
  exports.pageBoxOf = require_calibrate.pageBoxOf;
38
39
  exports.pageDestinationOf = require_calibrate.pageDestinationOf;
39
40
  exports.pagePointOf = require_calibrate.pagePointOf;
@@ -52,6 +53,7 @@ exports.shownAppearances = require_charmap.shownAppearances;
52
53
  exports.snapFullPageViewport = require_DocumentRenderService.snapFullPageViewport;
53
54
  exports.toAttachmentRef = require_calibrate.toAttachmentRef;
54
55
  exports.toFieldRef = require_format.toFieldRef;
56
+ exports.toOutlineItemRef = require_calibrate.toOutlineItemRef;
55
57
  exports.toPageRef = require_format.toPageRef;
56
58
  exports.validateSearchQuery = require_viewport.validateSearchQuery;
57
59
  exports.viewportForPoint = require_viewport.viewportForPoint;
package/dist/public.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { $f as DownloadOptions, $i as ChangeItem, $m as OpenInputLayerBytes, Ap as charRangeForTextOffsets, Bg as pdfQuadOf, Bl as AnnotationImportResult, Bo as SearchQuery, C_ as DocCapability, Cp as isRotatedGeometryRun, Cr as validateSearchQuery, Dn as measurementReadout, E_ as Identity, Fn as MeasurementFormatOptions, Ga as applyAnnotationPatch, Gl as FormFieldCreateOptions, Go as PdfTextSegment, Gu as AttachmentRef, Hd as AnnotationSubtype, Hl as AnnotationCreateOptions, Ho as SearchSlice, Ig as pageBoxOf, In as measureFromKnownLength, Jg as PdfRect, Jl as WriteOptions, Jp as PageRaster, Ka as drawnPointsOf, Kg as PdfPoint, Kl as FormWidgetAddOptions, Ko as TextLayout, Lg as pagePointOf, Ln as measureFromRatio, Mp as PageTextRange, Nl as AnnotationTransfer, Np as TextRange, P_ as AbortablePromise, Pn as MeasureFromRatioOptions, Qd as OBJECT_NUMBER_CEILING, Qm as OpenInputBytes, Qp as PageRenderImage, Rg as pageQuadOf, Rn as AreaUnit, Ro as SearchLimit, Sc as buildCommentThreads, Tc as annotationKey, Ua as annotationOfDraft, Ul as AnnotationUpdateOptions, Um as PageLayout, Uo as SearchSnippet, Up as PageImageOptions, Vg as pdfRectOf, Vm as PageListSnapshot, Vo as SearchRequest, Vp as PageImageHandle, Wa as appearanceTurnOf, Wc as FormValuesImportResult, Wl as FlattenWriteOptions, Wu as AttachmentList, Xl as FlattenOptions, Xm as OpenInput, Yg as PdfRotation, Zg as FormFieldRef, Zi as Change, Zm as OpenInputById, _a as PagePosition, _d as PdfNumberFormat, _g as FormFieldDTO, _l as FormTransfer, ah as OpenOptions, ao as DraftAttribution, au as AnnotationUpdateResult, bs as AnnotationDraft, ch as collab, cv as PageDestination, dm as PageTransformOptions, ea as ChangeItemType, ef as ObjectNumberPool, eh as OpenInputLayerFile, em as PageRenderOptions, ep as PdfSaveMode, fm as PixelBox, ga as ListPosition, gd as PdfMeasurement, gp as PageGeometryRun, gs as AnnotationDefaults, hd as PdfMeasure, hm as pageTransform, hs as ANNOTATION_DEFAULTS, ih as OpenInputToken, io as shapeForRect, iu as AnnotationReorderResult, l_ as EngineError, lm as PageRenderMatrix, lv as PdfDestination, m_ as EngineErrorCode, ma as AnnotationPosition, mm as PixelQuad, mp as shownAppearances, ms as pdfDestinationOf, mv as toPageRef, n as AnnotationListOptions, n_ as toFieldRef, na as ChangeResult, nf as ObjectNumbersLost, nm as PageRenderRaster, no as resolveAnnotationPatch, nu as AnnotationCreateResult, o_ as AnnotationRef, oa as SkippedChangeItem, oh as TokenSource, oo as DraftContext, pm as PixelPoint, ps as pageDestinationOf, pv as pageRefsEqual, qg as PdfQuad, ql as PageInsertBlankOptions, qu as toAttachmentRef, rh as OpenInputShare, ru as AnnotationDeleteResult, sh as caps, t as AnnotationList, ta as ChangeOp, tf as ObjectNumberRange, to as resolveAnnotationDraft, um as PageRenderTransform, uv as PageRef, va as anchorOf, vl as FormBundle, vn as viewportForPoint, vs as Annotation, vu as AnnotationBundle, wp as PageTextSnapshot, xa as reorderedList, xs as AnnotationPatch, yc as CommentThread, yn as formatMeasurement, zc as FormImportResult, zg as pdfPointOf, zn as LengthUnit, zo as SearchMatch, zp as ImageSource, zu as Attachment } from "./AnnotationList-CkijRHet.cjs";
2
- import { A as PageHandle, B as CustomMetadataService, D as DocumentEventOf, J as snapFullPageViewport, L as LocalPageAnnotationsService, M as PageTextService, N as LocalPageRenderService, O as DocumentEventType, P as PageRenderService, R as PageAnnotationsService, S as WorkingSetPage, T as DocumentEvent, Z as DocumentPagesService, _ as Engine, a as LocalPageHandle, b as CallFacts, i as isLocalDocument, k as EventOrigin, n as isLocalEngine, o as isLocalPage, r as LocalDocumentHandle, t as LocalEngine, tt as DocumentAnnotationsService, v as EngineFactory, x as CallPriority, y as DocumentHandle, z as MetadataService } from "./LocalEngine-DFoBm4B3.cjs";
3
- import { c as DocumentSecurityService, d as DocumentUnlockResult, i as DocumentAccessInfo, l as DocumentSecurityState, u as DocumentUnlockInput } from "./DocumentSecurityService-e6vp2de8.cjs";
4
- import { Mn as isAbortError, jn as AbortError } from "./runtime-p1WDzDo4.cjs";
5
- export { ANNOTATION_DEFAULTS, AbortError, AbortablePromise, type Annotation, type AnnotationBundle, type AnnotationCreateOptions, type AnnotationCreateResult, type AnnotationDefaults, type AnnotationDeleteResult, type AnnotationDraft, type AnnotationImportResult, type AnnotationList, type AnnotationListOptions, type AnnotationPatch, type AnnotationPosition, type AnnotationRef, type AnnotationReorderResult, type AnnotationSubtype, AnnotationTransfer, type AnnotationUpdateOptions, type AnnotationUpdateResult, type AreaUnit, type Attachment, type AttachmentList, type AttachmentRef, type CallFacts, type CallPriority, type Change, type ChangeItem, type ChangeItemType, type ChangeOp, type ChangeResult, type CommentThread, type CustomMetadataService, type DocCapability, type DocumentAccessInfo, type DocumentAnnotationsService, type DocumentEvent, type DocumentEventOf, type DocumentEventType, type DocumentHandle, type DocumentPagesService, type DocumentSecurityService, type DocumentSecurityState, type DocumentUnlockInput, type DocumentUnlockResult, type DownloadOptions, type DraftAttribution, type DraftContext, type Engine, EngineError, EngineErrorCode, type EngineFactory, type EventOrigin, type FlattenOptions, type FlattenWriteOptions, type FormBundle, type FormFieldCreateOptions, type FormFieldDTO, type FormFieldRef, type FormImportResult, FormTransfer, type FormValuesImportResult, type FormWidgetAddOptions, type Identity, type ImageSource, type LengthUnit, type ListPosition, type LocalDocumentHandle, type LocalEngine, type LocalPageAnnotationsService, type LocalPageHandle, type LocalPageRenderService, type MeasureFromRatioOptions, type MeasurementFormatOptions, type MetadataService, OBJECT_NUMBER_CEILING, type ObjectNumberPool, type ObjectNumberRange, type ObjectNumbersLost, type OpenInput, type OpenInputById, type OpenInputBytes, type OpenInputLayerBytes, type OpenInputLayerFile, type OpenInputShare, type OpenInputToken, type OpenOptions, type PageAnnotationsService, type PageDestination, type PageGeometryRun, type PageHandle, type PageImageHandle, type PageImageOptions, type PageInsertBlankOptions, type PageLayout, type PageListSnapshot, type PagePosition, type PageRaster, type PageRef, type PageRenderImage, type PageRenderMatrix, type PageRenderOptions, type PageRenderRaster, type PageRenderService, type PageRenderTransform, type PageTextRange, type PageTextService, type PageTextSnapshot, type PageTransformOptions, type PdfDestination, type PdfMeasure, type PdfMeasurement, type PdfNumberFormat, type PdfPoint, type PdfQuad, type PdfRect, type PdfRotation, type PdfSaveMode, type PdfTextSegment, type PixelBox, type PixelPoint, type PixelQuad, type SearchLimit, type SearchMatch, type SearchQuery, type SearchRequest, type SearchSlice, type SearchSnippet, type SkippedChangeItem, type TextLayout, type TextRange, type TokenSource, type WorkingSetPage, type WriteOptions, anchorOf, annotationKey, annotationOfDraft, appearanceTurnOf, applyAnnotationPatch, buildCommentThreads, caps, charRangeForTextOffsets, collab, drawnPointsOf, formatMeasurement, isAbortError, isLocalDocument, isLocalEngine, isLocalPage, isRotatedGeometryRun, measureFromKnownLength, measureFromRatio, measurementReadout, pageBoxOf, pageDestinationOf, pagePointOf, pageQuadOf, pageRefsEqual, pageTransform, pdfDestinationOf, pdfPointOf, pdfQuadOf, pdfRectOf, reorderedList, resolveAnnotationDraft, resolveAnnotationPatch, shapeForRect, shownAppearances, snapFullPageViewport, toAttachmentRef, toFieldRef, toPageRef, validateSearchQuery, viewportForPoint };
1
+ import { $a as annotationOfDraft, $l as AnnotationImportResult, $o as SearchLimit, $u as AttachmentRef, Ah as OutlineItemRef, Al as FormTransfer, As as ANNOTATION_DEFAULTS, Bh as OpenInputLayerBytes, Bm as PixelQuad, C_ as pageBoxOf, Ca as AnnotationPosition, Cd as PdfMeasure, D_ as pdfQuadOf, Da as PagePosition, Dh as OutlineItem, Dn as measurementReadout, E_ as pdfPointOf, Ea as OutlinePosition, F_ as PdfRect, Fm as PageRenderMatrix, Fn as MeasurementFormatOptions, Fs as AnnotationDraft, Gh as OpenInputToken, Gi as Change, Gp as PageTextRange, I_ as PdfRotation, Im as PageRenderTransform, In as measureFromKnownLength, Ip as isRotatedGeometryRun, Is as AnnotationPatch, Jh as caps, Ji as ChangeItemType, Kh as OpenOptions, Kl as AnnotationTransfer, Kp as TextRange, Lc as annotationKey, Lh as OpenInput, Lm as PageTransformOptions, Ln as measureFromRatio, Lp as PageTextSnapshot, Mh as toOutlineItemRef, N_ as PdfPoint, Ns as Annotation, O_ as pdfRectOf, Oa as anchorOf, Oh as OutlineItemDraft, Os as pageDestinationOf, P_ as PdfQuad, Pc as buildCommentThreads, Pn as MeasureFromRatioOptions, Qc as FormImportResult, Qu as AttachmentList, R_ as FormFieldRef, Rh as OpenInputById, Rm as PixelBox, Rn as AreaUnit, Sm as PrintDpi, Sp as shownAppearances, T_ as pageQuadOf, Ta as ListPosition, Td as PdfNumberFormat, Th as DocumentOutline, Tu as AnnotationBundle, U_ as toFieldRef, Up as charRangeForTextOffsets, Vh as OpenInputLayerFile, Vm as pageTransform, Wh as OpenInputShare, X_ as EngineError, Xd as AnnotationSubtype, Xi as ChangeResult, Xv as PdfDestination, Yh as collab, Yi as ChangeOp, Yv as PageDestination, Zv as PageRef, _a as OutlineMutationMeta, _r as validateSearchQuery, au as FormWidgetAddOptions, ba as OutlineUpdateResult, cf as ObjectNumberPool, cp as PdfSaveMode, do as resolveAnnotationDraft, du as AnnotationReorderResult, ea as SkippedChangeItem, em as ImageSource, eo as appearanceTurnOf, es as SearchMatch, ey as pageRefsEqual, fo as resolveAnnotationPatch, fu as AnnotationUpdateResult, ga as OutlineMoveResult, gm as PageRenderOptions, go as DraftContext, ha as OutlineDeleteResult, hh as PageLayout, ho as DraftAttribution, i_ as FormFieldDTO, im as PageImageOptions, is as SearchSnippet, iu as FormFieldCreateOptions, ja as reorderedList, jc as CommentThread, jh as outlineItemRefsEqual, jl as FormBundle, js as AnnotationDefaults, kh as OutlineItemPatch, km as FlattenOptions, kp as PageGeometryRun, ks as pdfDestinationOf, lf as ObjectNumberRange, lu as AnnotationCreateResult, ma as OutlineCreateResult, mm as PageRenderImage, mo as shapeForRect, n as AnnotationListOptions, nm as PageImageHandle, no as drawnPointsOf, ns as SearchRequest, nu as AnnotationUpdateOptions, of as OBJECT_NUMBER_CEILING, os as PdfTextSegment, ou as PageInsertBlankOptions, ph as PageListSnapshot, pv as Identity, q_ as AnnotationRef, qh as TokenSource, qi as ChangeItem, qu as Attachment, rl as FormValuesImportResult, rs as SearchSlice, ru as FlattenWriteOptions, sp as DownloadOptions, ss as TextLayout, su as WriteOptions, t as AnnotationList, td as toAttachmentRef, to as applyAnnotationPatch, ts as SearchQuery, tu as AnnotationCreateOptions, tv as EngineErrorCode, ty as toPageRef, uf as ObjectNumbersLost, um as PageRaster, uu as AnnotationDeleteResult, uv as DocCapability, va as OutlineOrder, vm as PageRenderRaster, vn as viewportForPoint, w_ as pagePointOf, wd as PdfMeasurement, xv as AbortablePromise, ya as OutlineRestoreResult, yn as formatMeasurement, zh as OpenInputBytes, zm as PixelPoint, zn as LengthUnit } from "./AnnotationList-DcyhF2kU.cjs";
2
+ import { $ as OutlineCreateOptions, A as PageHandle, B as CustomMetadataService, D as DocumentEventOf, J as snapFullPageViewport, L as LocalPageAnnotationsService, M as PageTextService, N as LocalPageRenderService, O as DocumentEventType, P as PageRenderService, Q as DocumentOutlineService, R as PageAnnotationsService, S as WorkingSetPage, T as DocumentEvent, Z as DocumentPagesService, _ as Engine, a as LocalPageHandle, b as CallFacts, i as isLocalDocument, k as EventOrigin, n as isLocalEngine, o as isLocalPage, r as LocalDocumentHandle, rt as DocumentAnnotationsService, t as LocalEngine, v as EngineFactory, x as CallPriority, y as DocumentHandle, z as MetadataService } from "./LocalEngine-IA9zh3Jh.cjs";
3
+ import { c as DocumentSecurityService, d as DocumentUnlockResult, i as DocumentAccessInfo, l as DocumentSecurityState, u as DocumentUnlockInput } from "./DocumentSecurityService-D2zA4NKi.cjs";
4
+ import { An as AbortError, jn as isAbortError } from "./runtime-CWEuiwbk.cjs";
5
+ export { ANNOTATION_DEFAULTS, AbortError, AbortablePromise, type Annotation, type AnnotationBundle, type AnnotationCreateOptions, type AnnotationCreateResult, type AnnotationDefaults, type AnnotationDeleteResult, type AnnotationDraft, type AnnotationImportResult, type AnnotationList, type AnnotationListOptions, type AnnotationPatch, type AnnotationPosition, type AnnotationRef, type AnnotationReorderResult, type AnnotationSubtype, AnnotationTransfer, type AnnotationUpdateOptions, type AnnotationUpdateResult, type AreaUnit, type Attachment, type AttachmentList, type AttachmentRef, type CallFacts, type CallPriority, type Change, type ChangeItem, type ChangeItemType, type ChangeOp, type ChangeResult, type CommentThread, type CustomMetadataService, type DocCapability, type DocumentAccessInfo, type DocumentAnnotationsService, type DocumentEvent, type DocumentEventOf, type DocumentEventType, type DocumentHandle, type DocumentOutline, type DocumentOutlineService, type DocumentPagesService, type DocumentSecurityService, type DocumentSecurityState, type DocumentUnlockInput, type DocumentUnlockResult, type DownloadOptions, type DraftAttribution, type DraftContext, type Engine, EngineError, EngineErrorCode, type EngineFactory, type EventOrigin, type FlattenOptions, type FlattenWriteOptions, type FormBundle, type FormFieldCreateOptions, type FormFieldDTO, type FormFieldRef, type FormImportResult, FormTransfer, type FormValuesImportResult, type FormWidgetAddOptions, type Identity, type ImageSource, type LengthUnit, type ListPosition, type LocalDocumentHandle, type LocalEngine, type LocalPageAnnotationsService, type LocalPageHandle, type LocalPageRenderService, type MeasureFromRatioOptions, type MeasurementFormatOptions, type MetadataService, OBJECT_NUMBER_CEILING, type ObjectNumberPool, type ObjectNumberRange, type ObjectNumbersLost, type OpenInput, type OpenInputById, type OpenInputBytes, type OpenInputLayerBytes, type OpenInputLayerFile, type OpenInputShare, type OpenInputToken, type OpenOptions, type OutlineCreateOptions, type OutlineCreateResult, type OutlineDeleteResult, type OutlineItem, type OutlineItemDraft, type OutlineItemPatch, type OutlineItemRef, type OutlineMoveResult, type OutlineMutationMeta, type OutlineOrder, type OutlinePosition, type OutlineRestoreResult, type OutlineUpdateResult, type PageAnnotationsService, type PageDestination, type PageGeometryRun, type PageHandle, type PageImageHandle, type PageImageOptions, type PageInsertBlankOptions, type PageLayout, type PageListSnapshot, type PagePosition, type PageRaster, type PageRef, type PageRenderImage, type PageRenderMatrix, type PageRenderOptions, type PageRenderRaster, type PageRenderService, type PageRenderTransform, type PageTextRange, type PageTextService, type PageTextSnapshot, type PageTransformOptions, type PdfDestination, type PdfMeasure, type PdfMeasurement, type PdfNumberFormat, type PdfPoint, type PdfQuad, type PdfRect, type PdfRotation, type PdfSaveMode, type PdfTextSegment, type PixelBox, type PixelPoint, type PixelQuad, type PrintDpi, type SearchLimit, type SearchMatch, type SearchQuery, type SearchRequest, type SearchSlice, type SearchSnippet, type SkippedChangeItem, type TextLayout, type TextRange, type TokenSource, type WorkingSetPage, type WriteOptions, anchorOf, annotationKey, annotationOfDraft, appearanceTurnOf, applyAnnotationPatch, buildCommentThreads, caps, charRangeForTextOffsets, collab, drawnPointsOf, formatMeasurement, isAbortError, isLocalDocument, isLocalEngine, isLocalPage, isRotatedGeometryRun, measureFromKnownLength, measureFromRatio, measurementReadout, outlineItemRefsEqual, pageBoxOf, pageDestinationOf, pagePointOf, pageQuadOf, pageRefsEqual, pageTransform, pdfDestinationOf, pdfPointOf, pdfQuadOf, pdfRectOf, reorderedList, resolveAnnotationDraft, resolveAnnotationPatch, shapeForRect, shownAppearances, snapFullPageViewport, toAttachmentRef, toFieldRef, toOutlineItemRef, toPageRef, validateSearchQuery, viewportForPoint };
package/dist/public.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { $f as DownloadOptions, $i as ChangeItem, $m as OpenInputLayerBytes, Ap as charRangeForTextOffsets, Bg as pdfQuadOf, Bl as AnnotationImportResult, Bo as SearchQuery, C_ as DocCapability, Cp as isRotatedGeometryRun, Cr as validateSearchQuery, Dn as measurementReadout, E_ as Identity, Fn as MeasurementFormatOptions, Ga as applyAnnotationPatch, Gl as FormFieldCreateOptions, Go as PdfTextSegment, Gu as AttachmentRef, Hd as AnnotationSubtype, Hl as AnnotationCreateOptions, Ho as SearchSlice, Ig as pageBoxOf, In as measureFromKnownLength, Jg as PdfRect, Jl as WriteOptions, Jp as PageRaster, Ka as drawnPointsOf, Kg as PdfPoint, Kl as FormWidgetAddOptions, Ko as TextLayout, Lg as pagePointOf, Ln as measureFromRatio, Mp as PageTextRange, Nl as AnnotationTransfer, Np as TextRange, P_ as AbortablePromise, Pn as MeasureFromRatioOptions, Qd as OBJECT_NUMBER_CEILING, Qm as OpenInputBytes, Qp as PageRenderImage, Rg as pageQuadOf, Rn as AreaUnit, Ro as SearchLimit, Sc as buildCommentThreads, Tc as annotationKey, Ua as annotationOfDraft, Ul as AnnotationUpdateOptions, Um as PageLayout, Uo as SearchSnippet, Up as PageImageOptions, Vg as pdfRectOf, Vm as PageListSnapshot, Vo as SearchRequest, Vp as PageImageHandle, Wa as appearanceTurnOf, Wc as FormValuesImportResult, Wl as FlattenWriteOptions, Wu as AttachmentList, Xl as FlattenOptions, Xm as OpenInput, Yg as PdfRotation, Zg as FormFieldRef, Zi as Change, Zm as OpenInputById, _a as PagePosition, _d as PdfNumberFormat, _g as FormFieldDTO, _l as FormTransfer, ah as OpenOptions, ao as DraftAttribution, au as AnnotationUpdateResult, bs as AnnotationDraft, ch as collab, cv as PageDestination, dm as PageTransformOptions, ea as ChangeItemType, ef as ObjectNumberPool, eh as OpenInputLayerFile, em as PageRenderOptions, ep as PdfSaveMode, fm as PixelBox, ga as ListPosition, gd as PdfMeasurement, gp as PageGeometryRun, gs as AnnotationDefaults, hd as PdfMeasure, hm as pageTransform, hs as ANNOTATION_DEFAULTS, ih as OpenInputToken, io as shapeForRect, iu as AnnotationReorderResult, l_ as EngineError, lm as PageRenderMatrix, lv as PdfDestination, m_ as EngineErrorCode, ma as AnnotationPosition, mm as PixelQuad, mp as shownAppearances, ms as pdfDestinationOf, mv as toPageRef, n as AnnotationListOptions, n_ as toFieldRef, na as ChangeResult, nf as ObjectNumbersLost, nm as PageRenderRaster, no as resolveAnnotationPatch, nu as AnnotationCreateResult, o_ as AnnotationRef, oa as SkippedChangeItem, oh as TokenSource, oo as DraftContext, pm as PixelPoint, ps as pageDestinationOf, pv as pageRefsEqual, qg as PdfQuad, ql as PageInsertBlankOptions, qu as toAttachmentRef, rh as OpenInputShare, ru as AnnotationDeleteResult, sh as caps, t as AnnotationList, ta as ChangeOp, tf as ObjectNumberRange, to as resolveAnnotationDraft, um as PageRenderTransform, uv as PageRef, va as anchorOf, vl as FormBundle, vn as viewportForPoint, vs as Annotation, vu as AnnotationBundle, wp as PageTextSnapshot, xa as reorderedList, xs as AnnotationPatch, yc as CommentThread, yn as formatMeasurement, zc as FormImportResult, zg as pdfPointOf, zn as LengthUnit, zo as SearchMatch, zp as ImageSource, zu as Attachment } from "./AnnotationList-CkijRHet.js";
2
- import { A as PageHandle, B as CustomMetadataService, D as DocumentEventOf, J as snapFullPageViewport, L as LocalPageAnnotationsService, M as PageTextService, N as LocalPageRenderService, O as DocumentEventType, P as PageRenderService, R as PageAnnotationsService, S as WorkingSetPage, T as DocumentEvent, Z as DocumentPagesService, _ as Engine, a as LocalPageHandle, b as CallFacts, i as isLocalDocument, k as EventOrigin, n as isLocalEngine, o as isLocalPage, r as LocalDocumentHandle, t as LocalEngine, tt as DocumentAnnotationsService, v as EngineFactory, x as CallPriority, y as DocumentHandle, z as MetadataService } from "./LocalEngine-DPriFujS.js";
3
- import { c as DocumentSecurityService, d as DocumentUnlockResult, i as DocumentAccessInfo, l as DocumentSecurityState, u as DocumentUnlockInput } from "./DocumentSecurityService-CU1M6Q7m.js";
4
- import { Mn as isAbortError, jn as AbortError } from "./runtime-Cl0v56mm.js";
5
- export { ANNOTATION_DEFAULTS, AbortError, AbortablePromise, type Annotation, type AnnotationBundle, type AnnotationCreateOptions, type AnnotationCreateResult, type AnnotationDefaults, type AnnotationDeleteResult, type AnnotationDraft, type AnnotationImportResult, type AnnotationList, type AnnotationListOptions, type AnnotationPatch, type AnnotationPosition, type AnnotationRef, type AnnotationReorderResult, type AnnotationSubtype, AnnotationTransfer, type AnnotationUpdateOptions, type AnnotationUpdateResult, type AreaUnit, type Attachment, type AttachmentList, type AttachmentRef, type CallFacts, type CallPriority, type Change, type ChangeItem, type ChangeItemType, type ChangeOp, type ChangeResult, type CommentThread, type CustomMetadataService, type DocCapability, type DocumentAccessInfo, type DocumentAnnotationsService, type DocumentEvent, type DocumentEventOf, type DocumentEventType, type DocumentHandle, type DocumentPagesService, type DocumentSecurityService, type DocumentSecurityState, type DocumentUnlockInput, type DocumentUnlockResult, type DownloadOptions, type DraftAttribution, type DraftContext, type Engine, EngineError, EngineErrorCode, type EngineFactory, type EventOrigin, type FlattenOptions, type FlattenWriteOptions, type FormBundle, type FormFieldCreateOptions, type FormFieldDTO, type FormFieldRef, type FormImportResult, FormTransfer, type FormValuesImportResult, type FormWidgetAddOptions, type Identity, type ImageSource, type LengthUnit, type ListPosition, type LocalDocumentHandle, type LocalEngine, type LocalPageAnnotationsService, type LocalPageHandle, type LocalPageRenderService, type MeasureFromRatioOptions, type MeasurementFormatOptions, type MetadataService, OBJECT_NUMBER_CEILING, type ObjectNumberPool, type ObjectNumberRange, type ObjectNumbersLost, type OpenInput, type OpenInputById, type OpenInputBytes, type OpenInputLayerBytes, type OpenInputLayerFile, type OpenInputShare, type OpenInputToken, type OpenOptions, type PageAnnotationsService, type PageDestination, type PageGeometryRun, type PageHandle, type PageImageHandle, type PageImageOptions, type PageInsertBlankOptions, type PageLayout, type PageListSnapshot, type PagePosition, type PageRaster, type PageRef, type PageRenderImage, type PageRenderMatrix, type PageRenderOptions, type PageRenderRaster, type PageRenderService, type PageRenderTransform, type PageTextRange, type PageTextService, type PageTextSnapshot, type PageTransformOptions, type PdfDestination, type PdfMeasure, type PdfMeasurement, type PdfNumberFormat, type PdfPoint, type PdfQuad, type PdfRect, type PdfRotation, type PdfSaveMode, type PdfTextSegment, type PixelBox, type PixelPoint, type PixelQuad, type SearchLimit, type SearchMatch, type SearchQuery, type SearchRequest, type SearchSlice, type SearchSnippet, type SkippedChangeItem, type TextLayout, type TextRange, type TokenSource, type WorkingSetPage, type WriteOptions, anchorOf, annotationKey, annotationOfDraft, appearanceTurnOf, applyAnnotationPatch, buildCommentThreads, caps, charRangeForTextOffsets, collab, drawnPointsOf, formatMeasurement, isAbortError, isLocalDocument, isLocalEngine, isLocalPage, isRotatedGeometryRun, measureFromKnownLength, measureFromRatio, measurementReadout, pageBoxOf, pageDestinationOf, pagePointOf, pageQuadOf, pageRefsEqual, pageTransform, pdfDestinationOf, pdfPointOf, pdfQuadOf, pdfRectOf, reorderedList, resolveAnnotationDraft, resolveAnnotationPatch, shapeForRect, shownAppearances, snapFullPageViewport, toAttachmentRef, toFieldRef, toPageRef, validateSearchQuery, viewportForPoint };
1
+ import { $a as annotationOfDraft, $l as AnnotationImportResult, $o as SearchLimit, $u as AttachmentRef, Ah as OutlineItemRef, Al as FormTransfer, As as ANNOTATION_DEFAULTS, Bh as OpenInputLayerBytes, Bm as PixelQuad, C_ as pageBoxOf, Ca as AnnotationPosition, Cd as PdfMeasure, D_ as pdfQuadOf, Da as PagePosition, Dh as OutlineItem, Dn as measurementReadout, E_ as pdfPointOf, Ea as OutlinePosition, F_ as PdfRect, Fm as PageRenderMatrix, Fn as MeasurementFormatOptions, Fs as AnnotationDraft, Gh as OpenInputToken, Gi as Change, Gp as PageTextRange, I_ as PdfRotation, Im as PageRenderTransform, In as measureFromKnownLength, Ip as isRotatedGeometryRun, Is as AnnotationPatch, Jh as caps, Ji as ChangeItemType, Kh as OpenOptions, Kl as AnnotationTransfer, Kp as TextRange, Lc as annotationKey, Lh as OpenInput, Lm as PageTransformOptions, Ln as measureFromRatio, Lp as PageTextSnapshot, Mh as toOutlineItemRef, N_ as PdfPoint, Ns as Annotation, O_ as pdfRectOf, Oa as anchorOf, Oh as OutlineItemDraft, Os as pageDestinationOf, P_ as PdfQuad, Pc as buildCommentThreads, Pn as MeasureFromRatioOptions, Qc as FormImportResult, Qu as AttachmentList, R_ as FormFieldRef, Rh as OpenInputById, Rm as PixelBox, Rn as AreaUnit, Sm as PrintDpi, Sp as shownAppearances, T_ as pageQuadOf, Ta as ListPosition, Td as PdfNumberFormat, Th as DocumentOutline, Tu as AnnotationBundle, U_ as toFieldRef, Up as charRangeForTextOffsets, Vh as OpenInputLayerFile, Vm as pageTransform, Wh as OpenInputShare, X_ as EngineError, Xd as AnnotationSubtype, Xi as ChangeResult, Xv as PdfDestination, Yh as collab, Yi as ChangeOp, Yv as PageDestination, Zv as PageRef, _a as OutlineMutationMeta, _r as validateSearchQuery, au as FormWidgetAddOptions, ba as OutlineUpdateResult, cf as ObjectNumberPool, cp as PdfSaveMode, do as resolveAnnotationDraft, du as AnnotationReorderResult, ea as SkippedChangeItem, em as ImageSource, eo as appearanceTurnOf, es as SearchMatch, ey as pageRefsEqual, fo as resolveAnnotationPatch, fu as AnnotationUpdateResult, ga as OutlineMoveResult, gm as PageRenderOptions, go as DraftContext, ha as OutlineDeleteResult, hh as PageLayout, ho as DraftAttribution, i_ as FormFieldDTO, im as PageImageOptions, is as SearchSnippet, iu as FormFieldCreateOptions, ja as reorderedList, jc as CommentThread, jh as outlineItemRefsEqual, jl as FormBundle, js as AnnotationDefaults, kh as OutlineItemPatch, km as FlattenOptions, kp as PageGeometryRun, ks as pdfDestinationOf, lf as ObjectNumberRange, lu as AnnotationCreateResult, ma as OutlineCreateResult, mm as PageRenderImage, mo as shapeForRect, n as AnnotationListOptions, nm as PageImageHandle, no as drawnPointsOf, ns as SearchRequest, nu as AnnotationUpdateOptions, of as OBJECT_NUMBER_CEILING, os as PdfTextSegment, ou as PageInsertBlankOptions, ph as PageListSnapshot, pv as Identity, q_ as AnnotationRef, qh as TokenSource, qi as ChangeItem, qu as Attachment, rl as FormValuesImportResult, rs as SearchSlice, ru as FlattenWriteOptions, sp as DownloadOptions, ss as TextLayout, su as WriteOptions, t as AnnotationList, td as toAttachmentRef, to as applyAnnotationPatch, ts as SearchQuery, tu as AnnotationCreateOptions, tv as EngineErrorCode, ty as toPageRef, uf as ObjectNumbersLost, um as PageRaster, uu as AnnotationDeleteResult, uv as DocCapability, va as OutlineOrder, vm as PageRenderRaster, vn as viewportForPoint, w_ as pagePointOf, wd as PdfMeasurement, xv as AbortablePromise, ya as OutlineRestoreResult, yn as formatMeasurement, zh as OpenInputBytes, zm as PixelPoint, zn as LengthUnit } from "./AnnotationList-DcyhF2kU.js";
2
+ import { $ as OutlineCreateOptions, A as PageHandle, B as CustomMetadataService, D as DocumentEventOf, J as snapFullPageViewport, L as LocalPageAnnotationsService, M as PageTextService, N as LocalPageRenderService, O as DocumentEventType, P as PageRenderService, Q as DocumentOutlineService, R as PageAnnotationsService, S as WorkingSetPage, T as DocumentEvent, Z as DocumentPagesService, _ as Engine, a as LocalPageHandle, b as CallFacts, i as isLocalDocument, k as EventOrigin, n as isLocalEngine, o as isLocalPage, r as LocalDocumentHandle, rt as DocumentAnnotationsService, t as LocalEngine, v as EngineFactory, x as CallPriority, y as DocumentHandle, z as MetadataService } from "./LocalEngine-DBt2-GWF.js";
3
+ import { c as DocumentSecurityService, d as DocumentUnlockResult, i as DocumentAccessInfo, l as DocumentSecurityState, u as DocumentUnlockInput } from "./DocumentSecurityService-YJV9df8P.js";
4
+ import { An as AbortError, jn as isAbortError } from "./runtime-BaDKjxiu.js";
5
+ export { ANNOTATION_DEFAULTS, AbortError, AbortablePromise, type Annotation, type AnnotationBundle, type AnnotationCreateOptions, type AnnotationCreateResult, type AnnotationDefaults, type AnnotationDeleteResult, type AnnotationDraft, type AnnotationImportResult, type AnnotationList, type AnnotationListOptions, type AnnotationPatch, type AnnotationPosition, type AnnotationRef, type AnnotationReorderResult, type AnnotationSubtype, AnnotationTransfer, type AnnotationUpdateOptions, type AnnotationUpdateResult, type AreaUnit, type Attachment, type AttachmentList, type AttachmentRef, type CallFacts, type CallPriority, type Change, type ChangeItem, type ChangeItemType, type ChangeOp, type ChangeResult, type CommentThread, type CustomMetadataService, type DocCapability, type DocumentAccessInfo, type DocumentAnnotationsService, type DocumentEvent, type DocumentEventOf, type DocumentEventType, type DocumentHandle, type DocumentOutline, type DocumentOutlineService, type DocumentPagesService, type DocumentSecurityService, type DocumentSecurityState, type DocumentUnlockInput, type DocumentUnlockResult, type DownloadOptions, type DraftAttribution, type DraftContext, type Engine, EngineError, EngineErrorCode, type EngineFactory, type EventOrigin, type FlattenOptions, type FlattenWriteOptions, type FormBundle, type FormFieldCreateOptions, type FormFieldDTO, type FormFieldRef, type FormImportResult, FormTransfer, type FormValuesImportResult, type FormWidgetAddOptions, type Identity, type ImageSource, type LengthUnit, type ListPosition, type LocalDocumentHandle, type LocalEngine, type LocalPageAnnotationsService, type LocalPageHandle, type LocalPageRenderService, type MeasureFromRatioOptions, type MeasurementFormatOptions, type MetadataService, OBJECT_NUMBER_CEILING, type ObjectNumberPool, type ObjectNumberRange, type ObjectNumbersLost, type OpenInput, type OpenInputById, type OpenInputBytes, type OpenInputLayerBytes, type OpenInputLayerFile, type OpenInputShare, type OpenInputToken, type OpenOptions, type OutlineCreateOptions, type OutlineCreateResult, type OutlineDeleteResult, type OutlineItem, type OutlineItemDraft, type OutlineItemPatch, type OutlineItemRef, type OutlineMoveResult, type OutlineMutationMeta, type OutlineOrder, type OutlinePosition, type OutlineRestoreResult, type OutlineUpdateResult, type PageAnnotationsService, type PageDestination, type PageGeometryRun, type PageHandle, type PageImageHandle, type PageImageOptions, type PageInsertBlankOptions, type PageLayout, type PageListSnapshot, type PagePosition, type PageRaster, type PageRef, type PageRenderImage, type PageRenderMatrix, type PageRenderOptions, type PageRenderRaster, type PageRenderService, type PageRenderTransform, type PageTextRange, type PageTextService, type PageTextSnapshot, type PageTransformOptions, type PdfDestination, type PdfMeasure, type PdfMeasurement, type PdfNumberFormat, type PdfPoint, type PdfQuad, type PdfRect, type PdfRotation, type PdfSaveMode, type PdfTextSegment, type PixelBox, type PixelPoint, type PixelQuad, type PrintDpi, type SearchLimit, type SearchMatch, type SearchQuery, type SearchRequest, type SearchSlice, type SearchSnippet, type SkippedChangeItem, type TextLayout, type TextRange, type TokenSource, type WorkingSetPage, type WriteOptions, anchorOf, annotationKey, annotationOfDraft, appearanceTurnOf, applyAnnotationPatch, buildCommentThreads, caps, charRangeForTextOffsets, collab, drawnPointsOf, formatMeasurement, isAbortError, isLocalDocument, isLocalEngine, isLocalPage, isRotatedGeometryRun, measureFromKnownLength, measureFromRatio, measurementReadout, outlineItemRefsEqual, pageBoxOf, pageDestinationOf, pagePointOf, pageQuadOf, pageRefsEqual, pageTransform, pdfDestinationOf, pdfPointOf, pdfQuadOf, pdfRectOf, reorderedList, resolveAnnotationDraft, resolveAnnotationPatch, shapeForRect, shownAppearances, snapFullPageViewport, toAttachmentRef, toFieldRef, toOutlineItemRef, toPageRef, validateSearchQuery, viewportForPoint };
package/dist/public.js CHANGED
@@ -1,9 +1,9 @@
1
+ import { At as pageTransform, C as resolveAnnotationPatch, Ct as isRotatedGeometryRun, Dt as pdfPointOf, Et as pageQuadOf, J as pageDestinationOf, Ot as pdfQuadOf, S as resolveAnnotationDraft, T as shapeForRect, Tt as pagePointOf, X as ANNOTATION_DEFAULTS, Y as pdfDestinationOf, _t as outlineItemRefsEqual, bt as isAbortError, d as appearanceTurnOf, f as applyAnnotationPatch, kt as pdfRectOf, n as measureFromRatio, nt as AnnotationTransfer, p as drawnPointsOf, t as measureFromKnownLength, tt as toAttachmentRef, u as annotationOfDraft, vt as toOutlineItemRef, wt as pageBoxOf, yt as AbortError } from "./calibrate-nQFgCuki.js";
1
2
  import { F as buildCommentThreads, S as measurementReadout } from "./resolveAnnotationDraft-CUpf0SMh.js";
2
3
  import { d as pageRefsEqual, f as toPageRef, h as EngineError, m as annotationKey, o as toFieldRef, t as formatMeasurement, y as EngineErrorCode } from "./format-Dgg428Kb.js";
3
- import { C as resolveAnnotationPatch, Ct as pageQuadOf, Dt as pageTransform, Et as pdfRectOf, J as pageDestinationOf, S as resolveAnnotationDraft, St as pagePointOf, T as shapeForRect, Tt as pdfQuadOf, X as ANNOTATION_DEFAULTS, Y as pdfDestinationOf, _t as isAbortError, bt as isRotatedGeometryRun, d as appearanceTurnOf, et as toAttachmentRef, f as applyAnnotationPatch, gt as AbortError, n as measureFromRatio, p as drawnPointsOf, t as measureFromKnownLength, tt as AnnotationTransfer, u as annotationOfDraft, wt as pdfPointOf, xt as pageBoxOf } from "./calibrate-7T3fnP8-.js";
4
- import { S as AbortablePromise, _ as OBJECT_NUMBER_CEILING, a as reorderedList, c as validateSearchQuery, m as FormTransfer, n as anchorOf, t as viewportForPoint } from "./viewport-BJW13EGZ.js";
4
+ import { S as AbortablePromise, _ as OBJECT_NUMBER_CEILING, a as reorderedList, c as validateSearchQuery, m as FormTransfer, n as anchorOf, t as viewportForPoint } from "./viewport-DQR5LyX3.js";
5
5
  import { d as shownAppearances, i as charRangeForTextOffsets } from "./charmap-Cprti1ta.js";
6
- import { n as collab, t as caps } from "./builders-CNj0POeY.js";
6
+ import { n as collab, t as caps } from "./builders-DV62HA3I.js";
7
7
  import { n as isLocalPage, t as isLocalDocument } from "./LocalDocumentHandle-DAPdaOt_.js";
8
- import { i as snapFullPageViewport, o as isLocalEngine } from "./DocumentRenderService-DV3J9lMz.js";
9
- export { ANNOTATION_DEFAULTS, AbortError, AbortablePromise, AnnotationTransfer, EngineError, EngineErrorCode, FormTransfer, OBJECT_NUMBER_CEILING, anchorOf, annotationKey, annotationOfDraft, appearanceTurnOf, applyAnnotationPatch, buildCommentThreads, caps, charRangeForTextOffsets, collab, drawnPointsOf, formatMeasurement, isAbortError, isLocalDocument, isLocalEngine, isLocalPage, isRotatedGeometryRun, measureFromKnownLength, measureFromRatio, measurementReadout, pageBoxOf, pageDestinationOf, pagePointOf, pageQuadOf, pageRefsEqual, pageTransform, pdfDestinationOf, pdfPointOf, pdfQuadOf, pdfRectOf, reorderedList, resolveAnnotationDraft, resolveAnnotationPatch, shapeForRect, shownAppearances, snapFullPageViewport, toAttachmentRef, toFieldRef, toPageRef, validateSearchQuery, viewportForPoint };
8
+ import { i as snapFullPageViewport, o as isLocalEngine } from "./DocumentRenderService-DFrZ9wfW.js";
9
+ export { ANNOTATION_DEFAULTS, AbortError, AbortablePromise, AnnotationTransfer, EngineError, EngineErrorCode, FormTransfer, OBJECT_NUMBER_CEILING, anchorOf, annotationKey, annotationOfDraft, appearanceTurnOf, applyAnnotationPatch, buildCommentThreads, caps, charRangeForTextOffsets, collab, drawnPointsOf, formatMeasurement, isAbortError, isLocalDocument, isLocalEngine, isLocalPage, isRotatedGeometryRun, measureFromKnownLength, measureFromRatio, measurementReadout, outlineItemRefsEqual, pageBoxOf, pageDestinationOf, pagePointOf, pageQuadOf, pageRefsEqual, pageTransform, pdfDestinationOf, pdfPointOf, pdfQuadOf, pdfRectOf, reorderedList, resolveAnnotationDraft, resolveAnnotationPatch, shapeForRect, shownAppearances, snapFullPageViewport, toAttachmentRef, toFieldRef, toOutlineItemRef, toPageRef, validateSearchQuery, viewportForPoint };
@@ -1,5 +1,5 @@
1
1
  import { h as EngineError, v as _defineProperty, y as EngineErrorCode } from "./format-Dgg428Kb.js";
2
- import { r as materializePdfPermissions } from "./builders-CNj0POeY.js";
2
+ import { r as materializePdfPermissions } from "./builders-DV62HA3I.js";
3
3
  //#region src/auth/scope/errors.ts
4
4
  /**
5
5
  * Thrown by {@link parseScope} / {@link validateScopeArray} when a scope
@@ -225,6 +225,7 @@ const PROTECTABLE_CAPABILITIES = [
225
225
  "doc.pages.assemble",
226
226
  "doc.redact",
227
227
  "doc.attachments.modify",
228
+ "doc.outline.modify",
228
229
  "doc.forms.modify",
229
230
  "doc.forms.script",
230
231
  "doc.annotate.modify",
@@ -244,7 +245,7 @@ function isProtectableCapability(capability) {
244
245
  * Only what was declared is refused: a refusal is a promise a signer made,
245
246
  * never a guess about a validator. A certification (or a lock with /P)
246
247
  * declares what may follow, and everything outside that — page edits,
247
- * redaction, field authoring, attachments, and below P=3 annotations, below
248
+ * redaction, field authoring, attachments, the outline, and below P=3 annotations, below
248
249
  * P=2 form fill — is refused. A plain approval signature declares nothing:
249
250
  * the same edits stay possible and are then judged, the verdict saying the
250
251
  * signature no longer holds, exactly as Acrobat does. The one exception is a
@@ -260,6 +261,7 @@ function protectedCapabilities(protection) {
260
261
  out.add("doc.pages.assemble");
261
262
  out.add("doc.redact");
262
263
  out.add("doc.attachments.modify");
264
+ out.add("doc.outline.modify");
263
265
  out.add("doc.forms.modify");
264
266
  out.add("doc.forms.script");
265
267
  if (!levelAllows(protection.enforced, "annotate")) {
@@ -312,6 +314,7 @@ const KNOWN_CAPABILITIES = /* @__PURE__ */ new Set([
312
314
  "doc.annotate.import",
313
315
  "doc.metadata.modify",
314
316
  "doc.attachments.modify",
317
+ "doc.outline.modify",
315
318
  "doc.redact",
316
319
  "doc.sign",
317
320
  "doc.sign.certify"
@@ -657,4 +660,4 @@ function addPdfPermissions(out, b) {
657
660
  //#endregion
658
661
  export { MissingIdentity as A, lockCovers as C, decodeAnnotKey as D, protectedCapabilities as E, encodeAnnotKey as O, levelFromPermission as S, minLevel as T, deriveProtection as _, checkFieldAction as a, isProtectableCapability as b, expandRawScope as c, filterMatches as d, parseScope as f, SIGNATURE_POLICY_VERSION as g, PROTECTABLE_CAPABILITIES as h, checkCollab as i, PermissionDenied as j, InvalidScope as k, expandedCapabilities as l, APPROVAL_BASELINE as m, checkAnyFieldAction as n, checkSetGroup as o, validateScopeArray as p, checkCapability as r, collabTargetOf as s, checkAnyCapability as t, fieldRightsOf as u, describeProtection as v, lockNameCovers as w, levelAllows as x, fieldLockFor as y };
659
662
 
660
- //# sourceMappingURL=resolver-CzxmD9Ck.js.map
663
+ //# sourceMappingURL=resolver-BBggAxQc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolver-BBggAxQc.js","names":[],"sources":["../src/auth/scope/errors.ts","../src/identity/AnnotationRef.ts","../src/signature/protection.ts","../src/auth/scope/parser.ts","../src/auth/scope/resolver.ts"],"sourcesContent":["import { EngineError } from '../../errors/EngineError';\nimport { EngineErrorCode } from '../../errors/EngineErrorCode';\nimport type { AnnotationRef } from '../../identity/AnnotationRef';\n\n/**\n * Thrown by {@link parseScope} / {@link validateScopeArray} when a scope\n * string does not match any known grammar (capability, collab, virtual,\n * or wildcard). An `EngineError` with code `InvalidArg`.\n *\n * Carries the offending scope verbatim so route/JWT-layer error\n * handlers can echo it to the customer.\n */\nexport class InvalidScope extends EngineError {\n override readonly name: string = 'InvalidScope';\n\n constructor(\n public readonly scope: string,\n reason: string,\n ) {\n super(EngineErrorCode.InvalidArg, `invalid scope \"${scope}\": ${reason}`, {\n details: { scope, reason },\n });\n }\n}\n\n/**\n * Thrown by route guards and engine-local enforcement when a capability\n * or collab action is denied for the current request/handle. An\n * `EngineError` with code `Forbidden`, on both engines.\n *\n * `required` (also `details.required`) names what the caller needed (e.g.\n * \"doc.render\" or \"annotations:update\"). When any of several would have\n * done, `anyOf` (also `details.anyOf`) lists them and `required` is the\n * first. `context` is an optional label such as \"engine-local\" or a route.\n */\nexport class PermissionDenied extends EngineError {\n override readonly name: string = 'PermissionDenied';\n\n constructor(\n public readonly required: string,\n public readonly context?: string,\n public readonly anyOf?: readonly string[],\n /** The annotations it was refused for, when one write covers several (a thread's delete). */\n public readonly refs?: readonly AnnotationRef[],\n ) {\n super(\n EngineErrorCode.Forbidden,\n `permission denied${context ? ` (${context})` : ''}: ${anyOf ? `one of ${anyOf.join(', ')}` : required}${refs ? ` for ${refs.length} annotation${refs.length === 1 ? '' : 's'}` : ''}`,\n {\n details: {\n required,\n ...(context === undefined ? {} : { context }),\n ...(anyOf === undefined ? {} : { anyOf: [...anyOf] }),\n ...(refs === undefined ? {} : { refs: [...refs] }),\n },\n },\n );\n }\n}\n\n/**\n * Thrown at engine-local open time when the supplied scope includes\n * collab filters (`:self`, `:group=...`) but the identity claims needed\n * to resolve them are missing. Fails loudly at open so the configuration\n * mistake is visible immediately instead of producing silent denies at\n * every annotation mutation. An `EngineError` with code `InvalidArg`.\n */\nexport class MissingIdentity extends EngineError {\n override readonly name: string = 'MissingIdentity';\n\n constructor(public readonly scope: string) {\n super(\n EngineErrorCode.InvalidArg,\n `scope \"${scope}\" requires an identity (userId and/or groups)`,\n {\n details: { scope },\n },\n );\n }\n}\n","import type { PageRef } from './PageRef';\n\n/**\n * How callers address an annotation, and how the engine names one. Every\n * annotation has one name for life:\n *\n * - `objectNumber`: an annotation born as a PDF object, in the uploaded\n * file or written later. Object numbers are never reused.\n * - `baseIndex`: an annotation born inline in the uploaded file (a\n * dictionary in the page's `/Annots`, with no object number of its own).\n * Its name is its position in that page's `/Annots` in the uploaded\n * file, which never changes. It keeps this name after a write gives it\n * an object number.\n *\n * An annotation's `/NM` is data, not a name: files can carry the same one\n * twice. A ref that names no annotation on its page fails with `NotFound`.\n */\nexport type AnnotationRef =\n | {\n kind: 'objectNumber';\n page: PageRef;\n objectNumber: number;\n }\n | {\n kind: 'baseIndex';\n page: PageRef;\n baseIndex: number;\n };\n\n/**\n * URL-safe encoding of a ref without its page, used by the cloud HTTP\n * surface as the `:annotKey` route parameter beside `:pageKey`\n * (`encodePageKey`). Decoded by `decodeAnnotKey`.\n *\n * `{ kind: 'objectNumber', objectNumber: 42 }` -> `'obj:42'`\n * `{ kind: 'baseIndex', baseIndex: 2 }` -> `'base:2'`\n */\nexport function encodeAnnotKey(ref: AnnotationRef): string {\n if (ref.kind === 'objectNumber') {\n if (!Number.isInteger(ref.objectNumber) || ref.objectNumber <= 0) {\n throw new RangeError(\n `encodeAnnotKey: objectNumber must be a positive integer, got ${ref.objectNumber}`,\n );\n }\n return `obj:${ref.objectNumber}`;\n }\n if (!Number.isInteger(ref.baseIndex) || ref.baseIndex < 0) {\n throw new RangeError(\n `encodeAnnotKey: baseIndex must be a non-negative integer, got ${ref.baseIndex}`,\n );\n }\n return `base:${ref.baseIndex}`;\n}\n\n/**\n * Inverse of `encodeAnnotKey`, on the page the route names. Returns `null`\n * for malformed input so the server can answer 400 InvalidArg with a useful\n * message instead of throwing. The input is the already-`decodeURIComponent`-ed\n * segment from the route path.\n */\nexport function decodeAnnotKey(page: PageRef, key: string): AnnotationRef | null {\n const number = (prefix: string, min: number): number | null => {\n if (!key.startsWith(prefix)) return null;\n const rest = key.slice(prefix.length);\n const n = Number.parseInt(rest, 10);\n return Number.isInteger(n) && n >= min && String(n) === rest ? n : null;\n };\n const objectNumber = number('obj:', 1);\n if (objectNumber !== null) return { kind: 'objectNumber', page, objectNumber };\n const baseIndex = number('base:', 0);\n if (baseIndex !== null) return { kind: 'baseIndex', page, baseIndex };\n return null;\n}\n","import type { Coordinates } from '../pageSpace/coordinates';\nimport type { DocCapability } from '../auth/scope/types';\nimport type {\n DocMdpPermission,\n DocumentFieldLock,\n DocumentProtection,\n FieldLockSpec,\n ModificationLevel,\n SignatureDTO,\n} from './types';\n\n/**\n * Bumped whenever the derivation below (or a judgement rule) changes meaning.\n * Rides every protection and every analysis, and keys the cloud's immutable\n * analysis URLs. The current policy is calibrated on the 91 Acrobat\n * observations in `packages/engine/main/test/fixtures/signature-compat`:\n * each signature is judged on the net state of the document against the\n * revision it sealed; an object written again with the sealed value is not\n * a modification; an approval signature permits commenting; field\n * properties are judged per level; a lock binds only the signature that\n * declares it; a changed shared resource must be allowed by every use.\n */\nexport const SIGNATURE_POLICY_VERSION = 4;\n\n/**\n * How a validator reads an approval signature. ISO 32000 defines permitted\n * changes only for certification signatures; Acrobat reads an approval\n * signature as \"Form Fill-in, Signing and Commenting are allowed\" (its own\n * permission text under every such signature) and keeps it valid through a\n * Square annotation added, deleted or recoloured afterwards (fixtures\n * `signature-compat/v3/88`, `/90` and `/91`: \"Annotations Created/Deleted/\n * Modified\", signature valid). pyHanko judges stricter (fill only); Acrobat\n * is the validator recipients use, so the baseline is `annotate`.\n */\nexport const APPROVAL_BASELINE: ModificationLevel = 'annotate';\n\nconst LEVEL_RANK: Record<ModificationLevel, number> = { none: 0, lta: 1, fill: 2, annotate: 3 };\n\n/** DocMDP `/P` → the modification level it permits. */\nexport function levelFromPermission(permission: DocMdpPermission): ModificationLevel {\n return permission === 1 ? 'lta' : permission === 2 ? 'fill' : 'annotate';\n}\n\nexport function minLevel(a: ModificationLevel, b: ModificationLevel): ModificationLevel {\n return LEVEL_RANK[a] <= LEVEL_RANK[b] ? a : b;\n}\n\n/** Whether `level` (null = unsigned, everything allowed) permits changes of kind `needed`. */\nexport function levelAllows(level: ModificationLevel | null, needed: ModificationLevel): boolean {\n return level === null || LEVEL_RANK[level] >= LEVEL_RANK[needed];\n}\n\n/** Hierarchical name match: `group` covers `group.total`. */\nexport function lockNameCovers(lockedName: string, fieldName: string): boolean {\n return fieldName === lockedName || fieldName.startsWith(`${lockedName}.`);\n}\n\nexport function lockCovers(spec: FieldLockSpec, fieldName: string): boolean {\n switch (spec.action) {\n case 'all':\n return true;\n case 'include':\n return spec.fields.some((name) => lockNameCovers(name, fieldName));\n case 'exclude':\n return !spec.fields.some((name) => lockNameCovers(name, fieldName));\n }\n}\n\n/**\n * Derive what the signatures already in a document mean for what comes\n * after. Pure and versioned (`SIGNATURE_POLICY_VERSION`); the same function\n * runs in the browser worker, on the native server, and in the conformance\n * suite.\n *\n * enforced = min(certification P, every signed field's /Lock /P), or null\n * when nothing was declared. What the engine refuses.\n * judged = enforced, or the approval baseline when signatures exist\n * without a declaration, or null when nothing is signed. What\n * the revision analysis judges later changes against. A\n * declaration governs the judgement too: a P=3 certifier really\n * did allow annotations.\n * fieldLocks = every signed signature's FieldMDP and the /Lock of every\n * signed field. Unsigned fields' /Lock entries describe a\n * future signature and lock nothing yet.\n */\nexport function deriveProtection(signatures: ReadonlyArray<SignatureDTO>): DocumentProtection {\n let signed = false;\n let enforced: ModificationLevel | null = null;\n let certification: DocumentProtection['certification'] = null;\n const fieldLocks: DocumentFieldLock[] = [];\n\n for (const sig of signatures) {\n if (!sig.signed) continue;\n signed = true;\n if (sig.catalogCertification && sig.docMdp !== null && certification === null) {\n certification = { signatureIndex: sig.index, permission: sig.docMdp };\n enforced = minLevel(enforced ?? 'annotate', levelFromPermission(sig.docMdp));\n }\n if (sig.fieldMdp) {\n fieldLocks.push({ signatureIndex: sig.index, source: 'fieldmdp', spec: sig.fieldMdp });\n }\n if (sig.lock) {\n fieldLocks.push({ signatureIndex: sig.index, source: 'lock', spec: sig.lock });\n if (sig.lock.permission !== undefined) {\n enforced = minLevel(enforced ?? 'annotate', levelFromPermission(sig.lock.permission));\n }\n }\n }\n\n const judged = signed ? (enforced ?? APPROVAL_BASELINE) : null;\n return { enforced, judged, certification, fieldLocks, policyVersion: SIGNATURE_POLICY_VERSION };\n}\n\n/** The lock that freezes `fieldName`, if any. */\nexport function fieldLockFor(\n protection: DocumentProtection,\n fieldName: string,\n): DocumentFieldLock | null {\n for (const lock of protection.fieldLocks) {\n if (lockCovers(lock.spec, fieldName)) return lock;\n }\n return null;\n}\n\n/**\n * Every capability a protection can remove: the most it ever takes away.\n * A check of any other capability never needs the document's protection.\n */\nexport const PROTECTABLE_CAPABILITIES = [\n 'doc.download.flattened',\n 'doc.pages.modify',\n 'doc.pages.assemble',\n 'doc.redact',\n 'doc.attachments.modify',\n 'doc.outline.modify',\n 'doc.forms.modify',\n 'doc.forms.script',\n 'doc.annotate.modify',\n 'doc.annotate.import',\n 'doc.forms.fill',\n 'doc.forms.import',\n] as const satisfies readonly DocCapability[];\n\nexport type ProtectableCapability = (typeof PROTECTABLE_CAPABILITIES)[number];\n\nconst PROTECTABLE: ReadonlySet<DocCapability> = new Set(PROTECTABLE_CAPABILITIES);\n\n/** Whether a protection can ever remove `capability`. */\nexport function isProtectableCapability(\n capability: DocCapability,\n): capability is ProtectableCapability {\n return PROTECTABLE.has(capability);\n}\n\n/**\n * The capabilities a protection removes from every caller, admin scope\n * included — document-derived authority, exactly like encryption bits.\n *\n * Only what was declared is refused: a refusal is a promise a signer made,\n * never a guess about a validator. A certification (or a lock with /P)\n * declares what may follow, and everything outside that — page edits,\n * redaction, field authoring, attachments, the outline, and below P=3 annotations, below\n * P=2 form fill — is refused. A plain approval signature declares nothing:\n * the same edits stay possible and are then judged, the verdict saying the\n * signature no longer holds, exactly as Acrobat does. The one exception is a\n * rewrite: it does not invalidate signatures, it erases them, so any signed\n * document refuses it. Per-field locks are enforced by the form mutator.\n */\nexport function protectedCapabilities(protection: DocumentProtection | null): Set<DocCapability> {\n const out = new Set<DocCapability>();\n if (!protection || protection.judged === null) return out;\n out.add('doc.download.flattened');\n if (protection.enforced === null) return out; // nothing declared: judged, not refused\n out.add('doc.pages.modify');\n out.add('doc.pages.assemble');\n out.add('doc.redact');\n out.add('doc.attachments.modify');\n out.add('doc.outline.modify');\n out.add('doc.forms.modify');\n out.add('doc.forms.script');\n if (!levelAllows(protection.enforced, 'annotate')) {\n out.add('doc.annotate.modify');\n out.add('doc.annotate.import');\n }\n if (!levelAllows(protection.enforced, 'fill')) {\n out.add('doc.forms.fill');\n out.add('doc.forms.import');\n }\n return out;\n}\n\n/** Why `protection` refuses `capability`: the message of a `ProtectedDocument` refusal. */\nexport function describeProtection(\n capability: DocCapability,\n protection: DocumentProtection,\n): string {\n const cause = protection.certification\n ? `certification signature ${protection.certification.signatureIndex} (permission ${protection.certification.permission})`\n : `an existing signature (declared level '${protection.enforced ?? 'none declared'}')`;\n return `the document is signed: ${cause} forbids '${capability}'`;\n}\n","import { InvalidScope } from './errors';\nimport type { CollabAction, CollabFilter, DocCapability, FieldAction, ParsedScope } from './types';\n\n/**\n * Closed set of recognized capability strings. Membership is the\n * authoritative source of truth — adding a new capability requires\n * extending the `DocCapability` union and adding it here. The parser\n * rejects anything outside this set.\n *\n * Removed legacy names (e.g., `doc.read`, `doc.edit-pages`, `doc.save`)\n * are deliberately absent so any JWT carrying them fails at verify\n * time with a clear error.\n */\nconst KNOWN_CAPABILITIES: ReadonlySet<DocCapability> = new Set([\n 'doc.open',\n 'doc.render',\n 'doc.text.select',\n 'doc.text.copy',\n 'doc.text.search',\n 'doc.content.copy',\n 'doc.download',\n 'doc.download.flattened',\n 'doc.print',\n 'doc.print.high',\n 'doc.pages.modify',\n 'doc.pages.assemble',\n 'doc.forms.read',\n 'doc.forms.fill',\n 'doc.forms.modify',\n 'doc.forms.import',\n 'doc.forms.script',\n 'doc.forms.submit',\n 'doc.annotate.read',\n 'doc.annotate.modify',\n 'doc.annotate.import',\n 'doc.metadata.modify',\n 'doc.attachments.modify',\n 'doc.outline.modify',\n 'doc.redact',\n 'doc.sign',\n 'doc.sign.certify',\n]);\n\n/**\n * Parse a single scope string into a structured `ParsedScope`.\n *\n * Recognised shapes:\n * - `\"*\"` → wildcard\n * - `\"pdf.permissions\"` → virtual (expands at resolve time)\n * - `\"a.b.c...\"` (dotted) → capability\n * - `\"entity:action:filter\"` (colons) → collab\n *\n * Throws {@link InvalidScope} for any string that fails to match one of\n * those shapes, or whose capability/entity/action/filter is not in the\n * closed enum.\n */\nexport function parseScope(raw: string): ParsedScope {\n if (raw === '*') return { kind: 'wildcard' };\n if (raw === 'pdf.permissions') return { kind: 'virtual', name: 'pdf.permissions' };\n if (raw.includes(':')) return parseCollab(raw);\n return parseCapability(raw);\n}\n\n/**\n * Validate every entry in a scope array by attempting to parse it.\n * Throws on the first invalid string. Discards the parse output —\n * callers re-parse at resolution time to keep the array as the\n * authoritative payload.\n */\nexport function validateScopeArray(raw: ReadonlyArray<string>): void {\n for (const s of raw) parseScope(s);\n}\n\nfunction parseCollab(raw: string): ParsedScope {\n // Split on the first two colons only. Filter values may contain\n // colons (UUIDs with `urn:uuid:...`, subject ids like `auth0|user:1`).\n const idx1 = raw.indexOf(':');\n const idx2 = raw.indexOf(':', idx1 + 1);\n if (idx1 === -1 || idx2 === -1) {\n throw new InvalidScope(raw, 'collab scope requires entity:action:filter');\n }\n const entity = raw.slice(0, idx1);\n const action = raw.slice(idx1 + 1, idx2);\n const filterStr = raw.slice(idx2 + 1);\n\n if (entity === 'fields') return parseFieldScope(raw, action, filterStr);\n if (entity !== 'annotations') {\n throw new InvalidScope(raw, `unknown collab entity: ${entity}`);\n }\n if (\n action !== 'create' &&\n action !== 'update' &&\n action !== 'delete' &&\n action !== 'set-group' &&\n action !== '*'\n ) {\n throw new InvalidScope(raw, `unknown collab action: ${action}`);\n }\n const filter = parseFilter(filterStr, raw);\n\n // `set-group` is a group-assignment authority, not a per-record collab\n // filter. The only meaningful filter values are `all` (assign to any\n // group) and `group=X` (assign to group X). `:self` and `:createdBy=Y`\n // can't be sensibly applied to \"what group is this annotation in\", so\n // we reject them at parse time rather than silently always-denying.\n if (action === 'set-group' && (filter.kind === 'self' || filter.kind === 'createdBy')) {\n throw new InvalidScope(\n raw,\n `set-group only supports :all or :group=<id> filters (got :${filter.kind})`,\n );\n }\n\n return {\n kind: 'collab',\n entity,\n action: action as CollabAction | '*',\n filter,\n };\n}\n\n/**\n * `fields:<fill|sign|set-group|*>:<all|group=NAME>`. A field's group is who\n * fills it, and a field records no creator, so `self` and `createdBy=` are\n * refused.\n */\nfunction parseFieldScope(raw: string, action: string, filterStr: string): ParsedScope {\n if (action !== 'fill' && action !== 'sign' && action !== 'set-group' && action !== '*') {\n throw new InvalidScope(raw, `unknown fields action: ${action}`);\n }\n const filter = parseFilter(filterStr, raw);\n if (filter.kind !== 'all' && filter.kind !== 'group') {\n throw new InvalidScope(\n raw,\n `fields only support :all or :group=<id> filters (got :${filter.kind})`,\n );\n }\n return { kind: 'collab', entity: 'fields', action: action as FieldAction | '*', filter };\n}\n\nfunction parseFilter(s: string, raw: string): CollabFilter {\n if (s === 'all') return { kind: 'all' };\n if (s === 'self') return { kind: 'self' };\n if (s.startsWith('createdBy=')) {\n const v = s.slice('createdBy='.length);\n if (!v) throw new InvalidScope(raw, 'createdBy= requires a value');\n return { kind: 'createdBy', userId: v };\n }\n if (s.startsWith('group=')) {\n const v = s.slice('group='.length);\n if (!v) throw new InvalidScope(raw, 'group= requires a value');\n return { kind: 'group', groupId: v };\n }\n throw new InvalidScope(raw, `unknown filter: ${s}`);\n}\n\n// Capability shape: lowercase dotted segments, e.g. \"doc.text.copy\".\n// Validates shape first, then membership in the closed set.\nconst CAPABILITY_SHAPE = /^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)+$/;\n\nfunction parseCapability(raw: string): ParsedScope {\n if (!CAPABILITY_SHAPE.test(raw)) {\n throw new InvalidScope(raw, 'invalid capability name shape');\n }\n if (!KNOWN_CAPABILITIES.has(raw as DocCapability)) {\n throw new InvalidScope(raw, `unknown capability: ${raw}`);\n }\n return { kind: 'capability', name: raw as DocCapability };\n}\n","import { materializePdfPermissions } from './builders';\nimport { parseScope } from './parser';\nimport type {\n CollabAction,\n CollabEntity,\n CollabFilter,\n DocCapability,\n Identity,\n ParsedScope,\n PdfBits,\n} from './types';\nimport { protectedCapabilities } from '../../signature/protection';\nimport type { DocumentProtection } from '../../signature/types';\n\n/**\n * Resolved collab subject — the per-record identity bits that collab\n * filters are tested against. Sourced from the target record's stored\n * `/EMBD_Metadata/UserID` and `/GroupID` at mutation time.\n */\nexport interface CollabTarget {\n userId?: string;\n groupId?: string;\n}\n\n/** The collab target of a record read with nullable owner fields (an annotation). */\nexport function collabTargetOf(owner: {\n userId?: string | null;\n groupId?: string | null;\n}): CollabTarget {\n return {\n ...(owner.userId ? { userId: owner.userId } : {}),\n ...(owner.groupId ? { groupId: owner.groupId } : {}),\n };\n}\n\n/**\n * True iff the given capability is granted by the scope array plus the\n * PDF bits visible via `pdf.permissions` expansion.\n *\n * Wildcard `*` short-circuits to true. Anything not explicitly granted\n * (or expanded from `pdf.permissions`) is denied.\n */\nexport function checkCapability(\n capability: DocCapability,\n rawScope: ReadonlyArray<string>,\n pdfBits: PdfBits,\n protection: DocumentProtection | null = null,\n): boolean {\n // Document-derived authority comes first: what the signatures in the\n // file forbid, no scope grants — the wildcard included.\n if (protectedCapabilities(protection).has(capability)) return false;\n const parsed = rawScope.map(parseScope);\n if (parsed.some((s) => s.kind === 'wildcard')) return true;\n return expandedCapabilities(parsed, pdfBits, protection).has(capability);\n}\n\n/**\n * True iff the scope grants at least one of `capabilities`. Convenience\n * for routes like `/text` (`doc.text.copy` or `doc.text.search`) and\n * `/geometry` (`doc.text.select` or `doc.text.search`).\n */\nexport function checkAnyCapability(\n capabilities: ReadonlyArray<DocCapability>,\n rawScope: ReadonlyArray<string>,\n pdfBits: PdfBits,\n protection: DocumentProtection | null = null,\n): boolean {\n return capabilities.some((c) => checkCapability(c, rawScope, pdfBits, protection));\n}\n\n/**\n * True iff the scope grants the collab action against the target record.\n *\n * Narrowing model. For each action independently:\n * 1. wildcard `*` → allow (global escape hatch)\n * 2. if any collab scope applies to this action → narrow: only those\n * collab filters decide. If none match the target, deny — even if\n * `doc.annotate.modify` is also present. This is what makes\n * `[modify, update:self]` correctly mean \"edit own only\" rather\n * than \"edit anyone via modify-bypass.\"\n * 3. otherwise, if `doc.annotate.modify` is present → allow. This is\n * the broad PDF-bit-derived default for create/update/delete when\n * no per-action collab filter has been written.\n * 4. otherwise → deny.\n *\n * For create: `target` should be built by the caller from JWT identity\n * (`{ userId: caller.userId, groupId: caller.groupId }`). `:self` and\n * `:all` then trivially pass; `:group=X` is the meaningful filter (only\n * matches when the caller's default group is X).\n *\n * For update / delete: `target` is the existing row's owner.\n */\nexport function checkCollab(\n action: CollabAction,\n target: CollabTarget,\n rawScope: ReadonlyArray<string>,\n identity: Identity,\n pdfBits: PdfBits,\n): boolean {\n const parsed = rawScope.map(parseScope);\n if (parsed.some((s) => s.kind === 'wildcard')) return true;\n\n const applicableCollab = parsed.filter(\n (s): s is Extract<ParsedScope, { entity: 'annotations' }> =>\n s.kind === 'collab' &&\n s.entity === 'annotations' &&\n (s.action === action || s.action === '*'),\n );\n\n if (applicableCollab.length > 0) {\n // Narrow: presence of any applicable collab scope shadows\n // `modify`-as-default for this action.\n return applicableCollab.some((s) => filterMatches(s.filter, target, identity));\n }\n\n // No collab scope for this action — fall back to the broad default.\n return expandedCapabilities(parsed, pdfBits).has('doc.annotate.modify');\n}\n\n/**\n * Compute the full set of granted capabilities after expanding\n * `pdf.permissions` and applying implication rules.\n *\n * Implications applied:\n * - `doc.annotate.modify` implies `doc.annotate.read` (you can't\n * sensibly modify what you can't see).\n * - `doc.forms.modify` implies `doc.forms.fill` and `doc.forms.read`.\n * - `doc.forms.fill` implies `doc.forms.read`.\n * - any annotation collab scope implies `doc.annotate.read`, because\n * mutation routes need to see the target row to evaluate the\n * collab filter against its current owner.\n * - any field collab scope implies `doc.forms.read`: filling in or\n * signing a field means seeing the form. Groups limit writes, never\n * reads.\n *\n * Does not short-circuit on wildcard — callers do that themselves\n * before calling this. Returning the expanded set is useful for the\n * `/access` response's `effectiveScope` and for advisory UI surfacing.\n */\nexport function expandedCapabilities(\n parsed: ReadonlyArray<ParsedScope>,\n pdfBits: PdfBits,\n protection: DocumentProtection | null = null,\n): Set<DocCapability> {\n const out = new Set<DocCapability>();\n let hasAnnotationCollab = false;\n let hasFieldCollab = false;\n\n for (const s of parsed) {\n if (s.kind === 'capability') {\n out.add(s.name);\n } else if (s.kind === 'virtual' && s.name === 'pdf.permissions') {\n addPdfPermissions(out, pdfBits);\n } else if (s.kind === 'collab' && s.entity === 'annotations') {\n hasAnnotationCollab = true;\n } else if (s.kind === 'collab' && s.entity === 'fields') {\n hasFieldCollab = true;\n }\n }\n\n // Implications (apply after the explicit additions above)\n if (out.has('doc.annotate.modify')) out.add('doc.annotate.read');\n if (out.has('doc.forms.modify')) {\n out.add('doc.forms.fill');\n out.add('doc.forms.read');\n }\n if (out.has('doc.forms.fill')) out.add('doc.forms.read');\n if (hasAnnotationCollab) out.add('doc.annotate.read');\n if (hasFieldCollab) out.add('doc.forms.read');\n\n // Subtraction last: a signed document's own restrictions win over any\n // grant or implication.\n for (const removed of protectedCapabilities(protection)) out.delete(removed);\n\n return out;\n}\n\n/**\n * Convenience wrapper: takes the raw scope array, parses each entry,\n * returns the expanded capability set. Exposed for the `/access`\n * endpoint and for the SDK helper that surfaces `effectiveScope`.\n */\nexport function expandRawScope(\n rawScope: ReadonlyArray<string>,\n pdfBits: PdfBits,\n protection: DocumentProtection | null = null,\n): Set<DocCapability> {\n return expandedCapabilities(rawScope.map(parseScope), pdfBits, protection);\n}\n\n/**\n * Authority to put a record of `entity` in a specific group: an annotation,\n * or a form field.\n *\n * Set-group is decoupled from the write capabilities (`doc.annotate.modify`,\n * `doc.forms.modify`). The reasoning: those describe row access — what kind\n * of write you can do to which existing rows — and map to PDF permission\n * bits. Set-group is a cloud-only *assignment authority*: which destination\n * group can you put a record into? There is no PDF-bit counterpart, so it\n * doesn't inherit from them.\n *\n * Resolution order:\n * 1. newGroupId === callerDefaultGroupId → true (no real reassignment\n * is happening; the record gets the caller's default group)\n * 2. wildcard `*` → true (global escape hatch)\n * 3. `<entity>:set-group:all` → true\n * 4. `<entity>:set-group:group=<newGroupId>` → true\n * 5. `<entity>:*:all` or `<entity>:*:group=<newGroupId>` → true\n * (action wildcard includes set-group)\n * 6. otherwise → false\n *\n * A user with `set-group:group=legal` can put records in the legal group\n * whatever their own group is — that's the whole point.\n */\nexport function checkSetGroup(\n entity: CollabEntity,\n newGroupId: string,\n callerDefaultGroupId: string | undefined,\n rawScope: ReadonlyArray<string>,\n): boolean {\n // No authority needed when the caller is assigning their default group.\n if (newGroupId === callerDefaultGroupId) return true;\n\n const parsed = rawScope.map(parseScope);\n if (parsed.some((s) => s.kind === 'wildcard')) return true;\n\n for (const s of parsed) {\n if (s.kind !== 'collab') continue;\n if (s.entity !== entity) continue;\n if (s.action !== 'set-group' && s.action !== '*') continue;\n if (s.filter.kind === 'all') return true;\n if (s.filter.kind === 'group' && s.filter.groupId === newGroupId) return true;\n // :self and :createdBy are rejected at parse time for set-group, so\n // they never appear here. The action-wildcard path could carry those\n // filters legitimately for other actions — silently skip those, they\n // can't satisfy a set-group check.\n }\n return false;\n}\n\n/**\n * True iff the scope lets the caller `action` (fill in, or sign) a form\n * field in `groupId` (`null` for a field in no group).\n *\n * Narrowing, per action, as for annotations:\n * 1. wildcard `*` → allow;\n * 2. if any `fields:<action>` scope exists (or `fields:*`) → only those\n * decide: the field must match one of their filters, even when the\n * broad capability is also present. A field in no group then matches\n * only `:all`;\n * 3. otherwise the broad capability decides, for every field:\n * `doc.forms.fill` to fill, `doc.sign` to sign.\n *\n * Nothing here narrows form design (`doc.forms.modify`).\n */\nexport function checkFieldAction(\n action: 'fill' | 'sign',\n groupId: string | null,\n rawScope: ReadonlyArray<string>,\n pdfBits: PdfBits,\n protection: DocumentProtection | null = null,\n): boolean {\n const broad: DocCapability = action === 'fill' ? 'doc.forms.fill' : 'doc.sign';\n if (protectedCapabilities(protection).has(broad)) return false;\n const parsed = rawScope.map(parseScope);\n if (parsed.some((s) => s.kind === 'wildcard')) return true;\n\n const applicable = parsed.filter(\n (s) =>\n s.kind === 'collab' && s.entity === 'fields' && (s.action === action || s.action === '*'),\n ) as Extract<ParsedScope, { entity: 'fields' }>[];\n if (applicable.length > 0) {\n return applicable.some(\n (s) => s.filter.kind === 'all' || (groupId !== null && s.filter.groupId === groupId),\n );\n }\n return expandedCapabilities(parsed, pdfBits, protection).has(broad);\n}\n\n/**\n * The form fields a session may act on, by group: every field (`all`), or\n * only the fields of `groups` (none when the list is empty). A field in no\n * group counts only under `all`.\n */\nexport type FieldGroupRight =\n | { readonly all: true }\n | { readonly all: false; readonly groups: readonly string[] };\n\n/** What a session may do with form fields, per action, as group lists a viewer can show. */\nexport interface FieldRights {\n /** The fields it may fill in. */\n readonly fill: FieldGroupRight;\n /** The fields it may sign. */\n readonly sign: FieldGroupRight;\n /** The groups it may put a field in: its own default group always among them. */\n readonly setGroup: FieldGroupRight;\n}\n\n/**\n * {@link checkFieldAction} and {@link checkSetGroup} as lists: for each\n * action, every field or the groups the scope names, so a designer can\n * offer exactly the groups a field may go in, and a filler see whose fields\n * are theirs. The same rules, read the other way round.\n */\nexport function fieldRightsOf(\n rawScope: ReadonlyArray<string>,\n pdfBits: PdfBits,\n protection: DocumentProtection | null,\n callerDefaultGroupId: string | undefined,\n): FieldRights {\n const parsed = rawScope.map(parseScope);\n const wildcard = parsed.some((s) => s.kind === 'wildcard');\n const fieldScopes = (action: 'fill' | 'sign' | 'set-group') =>\n parsed.filter(\n (s) =>\n s.kind === 'collab' && s.entity === 'fields' && (s.action === action || s.action === '*'),\n ) as Extract<ParsedScope, { entity: 'fields' }>[];\n const fromScopes = (\n scopes: Extract<ParsedScope, { entity: 'fields' }>[],\n extra: readonly string[] = [],\n ): FieldGroupRight => {\n if (scopes.some((s) => s.filter.kind === 'all')) return { all: true };\n const groups = scopes.flatMap((s) => (s.filter.kind === 'group' ? [s.filter.groupId] : []));\n return { all: false, groups: [...new Set([...groups, ...extra])] };\n };\n const NONE: FieldGroupRight = { all: false, groups: [] };\n\n const writing = (action: 'fill' | 'sign'): FieldGroupRight => {\n const broad: DocCapability = action === 'fill' ? 'doc.forms.fill' : 'doc.sign';\n if (protectedCapabilities(protection).has(broad)) return NONE;\n if (wildcard) return { all: true };\n const scopes = fieldScopes(action);\n if (scopes.length > 0) return fromScopes(scopes);\n return expandedCapabilities(parsed, pdfBits, protection).has(broad) ? { all: true } : NONE;\n };\n\n const own = callerDefaultGroupId !== undefined ? [callerDefaultGroupId] : [];\n return {\n fill: writing('fill'),\n sign: writing('sign'),\n setGroup: wildcard ? { all: true } : fromScopes(fieldScopes('set-group'), own),\n };\n}\n\n/**\n * Whether the scope lets the caller `action` some form field: the broad\n * capability, or any `fields:<action>` scope. What a form verb checks\n * before its fields are known; each field is checked in the write.\n */\nexport function checkAnyFieldAction(\n action: 'fill' | 'sign',\n rawScope: ReadonlyArray<string>,\n pdfBits: PdfBits,\n protection: DocumentProtection | null = null,\n): boolean {\n const broad: DocCapability = action === 'fill' ? 'doc.forms.fill' : 'doc.sign';\n if (protectedCapabilities(protection).has(broad)) return false;\n const parsed = rawScope.map(parseScope);\n if (parsed.some((s) => s.kind === 'wildcard')) return true;\n if (\n parsed.some(\n (s) =>\n s.kind === 'collab' && s.entity === 'fields' && (s.action === action || s.action === '*'),\n )\n ) {\n return true;\n }\n return expandedCapabilities(parsed, pdfBits, protection).has(broad);\n}\n\n/**\n * Test a single collab filter against a target record. Every filter but\n * `self` compares one fact on the record with the value the scope names:\n *\n * all → always matches\n * self → matches if identity.userId === target.userId\n * createdBy=<X> → matches if target.userId === X\n * group=<X> → matches if target.groupId === X\n */\nexport function filterMatches(filter: CollabFilter, target: CollabTarget, id: Identity): boolean {\n switch (filter.kind) {\n case 'all':\n return true;\n case 'self':\n return !!id.userId && target.userId === id.userId;\n case 'createdBy':\n return target.userId === filter.userId;\n case 'group':\n return target.groupId === filter.groupId;\n }\n}\n\n/**\n * Translate `pdf.permissions` (virtual scope) into the concrete\n * capabilities it represents under the current PDF bit configuration:\n * {@link materializePdfPermissions}, the one reading of the bits.\n */\nfunction addPdfPermissions(out: Set<DocCapability>, b: PdfBits): void {\n for (const capability of materializePdfPermissions(b)) out.add(capability);\n}\n"],"mappings":";;;;;;;;;;;AAYA,IAAa,eAAb,cAAkC,YAAY;CAG5C,YACE,OACA,QACA;EACA,MAAM,gBAAgB,YAAY,kBAAkB,MAAM,KAAK,UAAU,EACvE,SAAS;GAAE;GAAO;EAAO,EAC3B,CAAC;EALe,KAAA,QAAA;EAHA,gBAAA,MAAA,QAAe,cAAA;CASjC;AACF;;;;;;;;;;;AAYA,IAAa,mBAAb,cAAsC,YAAY;CAGhD,YACE,UACA,SACA,OAEA,MACA;EACA,MACE,gBAAgB,WAChB,oBAAoB,UAAU,KAAK,QAAQ,KAAK,GAAG,IAAI,QAAQ,UAAU,MAAM,KAAK,IAAI,MAAM,WAAW,OAAO,QAAQ,KAAK,OAAO,aAAa,KAAK,WAAW,IAA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,KAAK;AACpE;;;;;;;;;;AAWA,SAAgB,cAAc,QAAsB,QAAsB,IAAuB;CAC/F,QAAQ,OAAO,MAAf;EACE,KAAK,OACH,OAAO;EACT,KAAK,QACH,OAAO,CAAC,CAAC,GAAG,UAAU,OAAO,WAAW,GAAG;EAC7C,KAAK,aACH,OAAO,OAAO,WAAW,OAAO;EAClC,KAAK,SACH,OAAO,OAAO,YAAY,OAAO;CACrC;AACF;;;;;;AAOA,SAAS,kBAAkB,KAAyB,GAAkB;CACpE,KAAK,MAAM,cAAc,0BAA0B,CAAC,GAAG,IAAI,IAAI,UAAU;AAC3E"}
@@ -1,5 +1,5 @@
1
1
  const require_format = require("./format-Bp3QFSH1.cjs");
2
- const require_builders = require("./builders-Cgdp_YCn.cjs");
2
+ const require_builders = require("./builders-DgTAj_tP.cjs");
3
3
  //#region src/auth/scope/errors.ts
4
4
  /**
5
5
  * Thrown by {@link parseScope} / {@link validateScopeArray} when a scope
@@ -225,6 +225,7 @@ const PROTECTABLE_CAPABILITIES = [
225
225
  "doc.pages.assemble",
226
226
  "doc.redact",
227
227
  "doc.attachments.modify",
228
+ "doc.outline.modify",
228
229
  "doc.forms.modify",
229
230
  "doc.forms.script",
230
231
  "doc.annotate.modify",
@@ -244,7 +245,7 @@ function isProtectableCapability(capability) {
244
245
  * Only what was declared is refused: a refusal is a promise a signer made,
245
246
  * never a guess about a validator. A certification (or a lock with /P)
246
247
  * declares what may follow, and everything outside that — page edits,
247
- * redaction, field authoring, attachments, and below P=3 annotations, below
248
+ * redaction, field authoring, attachments, the outline, and below P=3 annotations, below
248
249
  * P=2 form fill — is refused. A plain approval signature declares nothing:
249
250
  * the same edits stay possible and are then judged, the verdict saying the
250
251
  * signature no longer holds, exactly as Acrobat does. The one exception is a
@@ -260,6 +261,7 @@ function protectedCapabilities(protection) {
260
261
  out.add("doc.pages.assemble");
261
262
  out.add("doc.redact");
262
263
  out.add("doc.attachments.modify");
264
+ out.add("doc.outline.modify");
263
265
  out.add("doc.forms.modify");
264
266
  out.add("doc.forms.script");
265
267
  if (!levelAllows(protection.enforced, "annotate")) {
@@ -312,6 +314,7 @@ const KNOWN_CAPABILITIES = /* @__PURE__ */ new Set([
312
314
  "doc.annotate.import",
313
315
  "doc.metadata.modify",
314
316
  "doc.attachments.modify",
317
+ "doc.outline.modify",
315
318
  "doc.redact",
316
319
  "doc.sign",
317
320
  "doc.sign.certify"
@@ -842,4 +845,4 @@ Object.defineProperty(exports, "validateScopeArray", {
842
845
  }
843
846
  });
844
847
 
845
- //# sourceMappingURL=resolver-D2OCtE8F.cjs.map
848
+ //# sourceMappingURL=resolver-BWSWSF6R.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolver-BWSWSF6R.cjs","names":["EngineError","EngineErrorCode","materializePdfPermissions"],"sources":["../src/auth/scope/errors.ts","../src/identity/AnnotationRef.ts","../src/signature/protection.ts","../src/auth/scope/parser.ts","../src/auth/scope/resolver.ts"],"sourcesContent":["import { EngineError } from '../../errors/EngineError';\nimport { EngineErrorCode } from '../../errors/EngineErrorCode';\nimport type { AnnotationRef } from '../../identity/AnnotationRef';\n\n/**\n * Thrown by {@link parseScope} / {@link validateScopeArray} when a scope\n * string does not match any known grammar (capability, collab, virtual,\n * or wildcard). An `EngineError` with code `InvalidArg`.\n *\n * Carries the offending scope verbatim so route/JWT-layer error\n * handlers can echo it to the customer.\n */\nexport class InvalidScope extends EngineError {\n override readonly name: string = 'InvalidScope';\n\n constructor(\n public readonly scope: string,\n reason: string,\n ) {\n super(EngineErrorCode.InvalidArg, `invalid scope \"${scope}\": ${reason}`, {\n details: { scope, reason },\n });\n }\n}\n\n/**\n * Thrown by route guards and engine-local enforcement when a capability\n * or collab action is denied for the current request/handle. An\n * `EngineError` with code `Forbidden`, on both engines.\n *\n * `required` (also `details.required`) names what the caller needed (e.g.\n * \"doc.render\" or \"annotations:update\"). When any of several would have\n * done, `anyOf` (also `details.anyOf`) lists them and `required` is the\n * first. `context` is an optional label such as \"engine-local\" or a route.\n */\nexport class PermissionDenied extends EngineError {\n override readonly name: string = 'PermissionDenied';\n\n constructor(\n public readonly required: string,\n public readonly context?: string,\n public readonly anyOf?: readonly string[],\n /** The annotations it was refused for, when one write covers several (a thread's delete). */\n public readonly refs?: readonly AnnotationRef[],\n ) {\n super(\n EngineErrorCode.Forbidden,\n `permission denied${context ? ` (${context})` : ''}: ${anyOf ? `one of ${anyOf.join(', ')}` : required}${refs ? ` for ${refs.length} annotation${refs.length === 1 ? '' : 's'}` : ''}`,\n {\n details: {\n required,\n ...(context === undefined ? {} : { context }),\n ...(anyOf === undefined ? {} : { anyOf: [...anyOf] }),\n ...(refs === undefined ? {} : { refs: [...refs] }),\n },\n },\n );\n }\n}\n\n/**\n * Thrown at engine-local open time when the supplied scope includes\n * collab filters (`:self`, `:group=...`) but the identity claims needed\n * to resolve them are missing. Fails loudly at open so the configuration\n * mistake is visible immediately instead of producing silent denies at\n * every annotation mutation. An `EngineError` with code `InvalidArg`.\n */\nexport class MissingIdentity extends EngineError {\n override readonly name: string = 'MissingIdentity';\n\n constructor(public readonly scope: string) {\n super(\n EngineErrorCode.InvalidArg,\n `scope \"${scope}\" requires an identity (userId and/or groups)`,\n {\n details: { scope },\n },\n );\n }\n}\n","import type { PageRef } from './PageRef';\n\n/**\n * How callers address an annotation, and how the engine names one. Every\n * annotation has one name for life:\n *\n * - `objectNumber`: an annotation born as a PDF object, in the uploaded\n * file or written later. Object numbers are never reused.\n * - `baseIndex`: an annotation born inline in the uploaded file (a\n * dictionary in the page's `/Annots`, with no object number of its own).\n * Its name is its position in that page's `/Annots` in the uploaded\n * file, which never changes. It keeps this name after a write gives it\n * an object number.\n *\n * An annotation's `/NM` is data, not a name: files can carry the same one\n * twice. A ref that names no annotation on its page fails with `NotFound`.\n */\nexport type AnnotationRef =\n | {\n kind: 'objectNumber';\n page: PageRef;\n objectNumber: number;\n }\n | {\n kind: 'baseIndex';\n page: PageRef;\n baseIndex: number;\n };\n\n/**\n * URL-safe encoding of a ref without its page, used by the cloud HTTP\n * surface as the `:annotKey` route parameter beside `:pageKey`\n * (`encodePageKey`). Decoded by `decodeAnnotKey`.\n *\n * `{ kind: 'objectNumber', objectNumber: 42 }` -> `'obj:42'`\n * `{ kind: 'baseIndex', baseIndex: 2 }` -> `'base:2'`\n */\nexport function encodeAnnotKey(ref: AnnotationRef): string {\n if (ref.kind === 'objectNumber') {\n if (!Number.isInteger(ref.objectNumber) || ref.objectNumber <= 0) {\n throw new RangeError(\n `encodeAnnotKey: objectNumber must be a positive integer, got ${ref.objectNumber}`,\n );\n }\n return `obj:${ref.objectNumber}`;\n }\n if (!Number.isInteger(ref.baseIndex) || ref.baseIndex < 0) {\n throw new RangeError(\n `encodeAnnotKey: baseIndex must be a non-negative integer, got ${ref.baseIndex}`,\n );\n }\n return `base:${ref.baseIndex}`;\n}\n\n/**\n * Inverse of `encodeAnnotKey`, on the page the route names. Returns `null`\n * for malformed input so the server can answer 400 InvalidArg with a useful\n * message instead of throwing. The input is the already-`decodeURIComponent`-ed\n * segment from the route path.\n */\nexport function decodeAnnotKey(page: PageRef, key: string): AnnotationRef | null {\n const number = (prefix: string, min: number): number | null => {\n if (!key.startsWith(prefix)) return null;\n const rest = key.slice(prefix.length);\n const n = Number.parseInt(rest, 10);\n return Number.isInteger(n) && n >= min && String(n) === rest ? n : null;\n };\n const objectNumber = number('obj:', 1);\n if (objectNumber !== null) return { kind: 'objectNumber', page, objectNumber };\n const baseIndex = number('base:', 0);\n if (baseIndex !== null) return { kind: 'baseIndex', page, baseIndex };\n return null;\n}\n","import type { Coordinates } from '../pageSpace/coordinates';\nimport type { DocCapability } from '../auth/scope/types';\nimport type {\n DocMdpPermission,\n DocumentFieldLock,\n DocumentProtection,\n FieldLockSpec,\n ModificationLevel,\n SignatureDTO,\n} from './types';\n\n/**\n * Bumped whenever the derivation below (or a judgement rule) changes meaning.\n * Rides every protection and every analysis, and keys the cloud's immutable\n * analysis URLs. The current policy is calibrated on the 91 Acrobat\n * observations in `packages/engine/main/test/fixtures/signature-compat`:\n * each signature is judged on the net state of the document against the\n * revision it sealed; an object written again with the sealed value is not\n * a modification; an approval signature permits commenting; field\n * properties are judged per level; a lock binds only the signature that\n * declares it; a changed shared resource must be allowed by every use.\n */\nexport const SIGNATURE_POLICY_VERSION = 4;\n\n/**\n * How a validator reads an approval signature. ISO 32000 defines permitted\n * changes only for certification signatures; Acrobat reads an approval\n * signature as \"Form Fill-in, Signing and Commenting are allowed\" (its own\n * permission text under every such signature) and keeps it valid through a\n * Square annotation added, deleted or recoloured afterwards (fixtures\n * `signature-compat/v3/88`, `/90` and `/91`: \"Annotations Created/Deleted/\n * Modified\", signature valid). pyHanko judges stricter (fill only); Acrobat\n * is the validator recipients use, so the baseline is `annotate`.\n */\nexport const APPROVAL_BASELINE: ModificationLevel = 'annotate';\n\nconst LEVEL_RANK: Record<ModificationLevel, number> = { none: 0, lta: 1, fill: 2, annotate: 3 };\n\n/** DocMDP `/P` → the modification level it permits. */\nexport function levelFromPermission(permission: DocMdpPermission): ModificationLevel {\n return permission === 1 ? 'lta' : permission === 2 ? 'fill' : 'annotate';\n}\n\nexport function minLevel(a: ModificationLevel, b: ModificationLevel): ModificationLevel {\n return LEVEL_RANK[a] <= LEVEL_RANK[b] ? a : b;\n}\n\n/** Whether `level` (null = unsigned, everything allowed) permits changes of kind `needed`. */\nexport function levelAllows(level: ModificationLevel | null, needed: ModificationLevel): boolean {\n return level === null || LEVEL_RANK[level] >= LEVEL_RANK[needed];\n}\n\n/** Hierarchical name match: `group` covers `group.total`. */\nexport function lockNameCovers(lockedName: string, fieldName: string): boolean {\n return fieldName === lockedName || fieldName.startsWith(`${lockedName}.`);\n}\n\nexport function lockCovers(spec: FieldLockSpec, fieldName: string): boolean {\n switch (spec.action) {\n case 'all':\n return true;\n case 'include':\n return spec.fields.some((name) => lockNameCovers(name, fieldName));\n case 'exclude':\n return !spec.fields.some((name) => lockNameCovers(name, fieldName));\n }\n}\n\n/**\n * Derive what the signatures already in a document mean for what comes\n * after. Pure and versioned (`SIGNATURE_POLICY_VERSION`); the same function\n * runs in the browser worker, on the native server, and in the conformance\n * suite.\n *\n * enforced = min(certification P, every signed field's /Lock /P), or null\n * when nothing was declared. What the engine refuses.\n * judged = enforced, or the approval baseline when signatures exist\n * without a declaration, or null when nothing is signed. What\n * the revision analysis judges later changes against. A\n * declaration governs the judgement too: a P=3 certifier really\n * did allow annotations.\n * fieldLocks = every signed signature's FieldMDP and the /Lock of every\n * signed field. Unsigned fields' /Lock entries describe a\n * future signature and lock nothing yet.\n */\nexport function deriveProtection(signatures: ReadonlyArray<SignatureDTO>): DocumentProtection {\n let signed = false;\n let enforced: ModificationLevel | null = null;\n let certification: DocumentProtection['certification'] = null;\n const fieldLocks: DocumentFieldLock[] = [];\n\n for (const sig of signatures) {\n if (!sig.signed) continue;\n signed = true;\n if (sig.catalogCertification && sig.docMdp !== null && certification === null) {\n certification = { signatureIndex: sig.index, permission: sig.docMdp };\n enforced = minLevel(enforced ?? 'annotate', levelFromPermission(sig.docMdp));\n }\n if (sig.fieldMdp) {\n fieldLocks.push({ signatureIndex: sig.index, source: 'fieldmdp', spec: sig.fieldMdp });\n }\n if (sig.lock) {\n fieldLocks.push({ signatureIndex: sig.index, source: 'lock', spec: sig.lock });\n if (sig.lock.permission !== undefined) {\n enforced = minLevel(enforced ?? 'annotate', levelFromPermission(sig.lock.permission));\n }\n }\n }\n\n const judged = signed ? (enforced ?? APPROVAL_BASELINE) : null;\n return { enforced, judged, certification, fieldLocks, policyVersion: SIGNATURE_POLICY_VERSION };\n}\n\n/** The lock that freezes `fieldName`, if any. */\nexport function fieldLockFor(\n protection: DocumentProtection,\n fieldName: string,\n): DocumentFieldLock | null {\n for (const lock of protection.fieldLocks) {\n if (lockCovers(lock.spec, fieldName)) return lock;\n }\n return null;\n}\n\n/**\n * Every capability a protection can remove: the most it ever takes away.\n * A check of any other capability never needs the document's protection.\n */\nexport const PROTECTABLE_CAPABILITIES = [\n 'doc.download.flattened',\n 'doc.pages.modify',\n 'doc.pages.assemble',\n 'doc.redact',\n 'doc.attachments.modify',\n 'doc.outline.modify',\n 'doc.forms.modify',\n 'doc.forms.script',\n 'doc.annotate.modify',\n 'doc.annotate.import',\n 'doc.forms.fill',\n 'doc.forms.import',\n] as const satisfies readonly DocCapability[];\n\nexport type ProtectableCapability = (typeof PROTECTABLE_CAPABILITIES)[number];\n\nconst PROTECTABLE: ReadonlySet<DocCapability> = new Set(PROTECTABLE_CAPABILITIES);\n\n/** Whether a protection can ever remove `capability`. */\nexport function isProtectableCapability(\n capability: DocCapability,\n): capability is ProtectableCapability {\n return PROTECTABLE.has(capability);\n}\n\n/**\n * The capabilities a protection removes from every caller, admin scope\n * included — document-derived authority, exactly like encryption bits.\n *\n * Only what was declared is refused: a refusal is a promise a signer made,\n * never a guess about a validator. A certification (or a lock with /P)\n * declares what may follow, and everything outside that — page edits,\n * redaction, field authoring, attachments, the outline, and below P=3 annotations, below\n * P=2 form fill — is refused. A plain approval signature declares nothing:\n * the same edits stay possible and are then judged, the verdict saying the\n * signature no longer holds, exactly as Acrobat does. The one exception is a\n * rewrite: it does not invalidate signatures, it erases them, so any signed\n * document refuses it. Per-field locks are enforced by the form mutator.\n */\nexport function protectedCapabilities(protection: DocumentProtection | null): Set<DocCapability> {\n const out = new Set<DocCapability>();\n if (!protection || protection.judged === null) return out;\n out.add('doc.download.flattened');\n if (protection.enforced === null) return out; // nothing declared: judged, not refused\n out.add('doc.pages.modify');\n out.add('doc.pages.assemble');\n out.add('doc.redact');\n out.add('doc.attachments.modify');\n out.add('doc.outline.modify');\n out.add('doc.forms.modify');\n out.add('doc.forms.script');\n if (!levelAllows(protection.enforced, 'annotate')) {\n out.add('doc.annotate.modify');\n out.add('doc.annotate.import');\n }\n if (!levelAllows(protection.enforced, 'fill')) {\n out.add('doc.forms.fill');\n out.add('doc.forms.import');\n }\n return out;\n}\n\n/** Why `protection` refuses `capability`: the message of a `ProtectedDocument` refusal. */\nexport function describeProtection(\n capability: DocCapability,\n protection: DocumentProtection,\n): string {\n const cause = protection.certification\n ? `certification signature ${protection.certification.signatureIndex} (permission ${protection.certification.permission})`\n : `an existing signature (declared level '${protection.enforced ?? 'none declared'}')`;\n return `the document is signed: ${cause} forbids '${capability}'`;\n}\n","import { InvalidScope } from './errors';\nimport type { CollabAction, CollabFilter, DocCapability, FieldAction, ParsedScope } from './types';\n\n/**\n * Closed set of recognized capability strings. Membership is the\n * authoritative source of truth — adding a new capability requires\n * extending the `DocCapability` union and adding it here. The parser\n * rejects anything outside this set.\n *\n * Removed legacy names (e.g., `doc.read`, `doc.edit-pages`, `doc.save`)\n * are deliberately absent so any JWT carrying them fails at verify\n * time with a clear error.\n */\nconst KNOWN_CAPABILITIES: ReadonlySet<DocCapability> = new Set([\n 'doc.open',\n 'doc.render',\n 'doc.text.select',\n 'doc.text.copy',\n 'doc.text.search',\n 'doc.content.copy',\n 'doc.download',\n 'doc.download.flattened',\n 'doc.print',\n 'doc.print.high',\n 'doc.pages.modify',\n 'doc.pages.assemble',\n 'doc.forms.read',\n 'doc.forms.fill',\n 'doc.forms.modify',\n 'doc.forms.import',\n 'doc.forms.script',\n 'doc.forms.submit',\n 'doc.annotate.read',\n 'doc.annotate.modify',\n 'doc.annotate.import',\n 'doc.metadata.modify',\n 'doc.attachments.modify',\n 'doc.outline.modify',\n 'doc.redact',\n 'doc.sign',\n 'doc.sign.certify',\n]);\n\n/**\n * Parse a single scope string into a structured `ParsedScope`.\n *\n * Recognised shapes:\n * - `\"*\"` → wildcard\n * - `\"pdf.permissions\"` → virtual (expands at resolve time)\n * - `\"a.b.c...\"` (dotted) → capability\n * - `\"entity:action:filter\"` (colons) → collab\n *\n * Throws {@link InvalidScope} for any string that fails to match one of\n * those shapes, or whose capability/entity/action/filter is not in the\n * closed enum.\n */\nexport function parseScope(raw: string): ParsedScope {\n if (raw === '*') return { kind: 'wildcard' };\n if (raw === 'pdf.permissions') return { kind: 'virtual', name: 'pdf.permissions' };\n if (raw.includes(':')) return parseCollab(raw);\n return parseCapability(raw);\n}\n\n/**\n * Validate every entry in a scope array by attempting to parse it.\n * Throws on the first invalid string. Discards the parse output —\n * callers re-parse at resolution time to keep the array as the\n * authoritative payload.\n */\nexport function validateScopeArray(raw: ReadonlyArray<string>): void {\n for (const s of raw) parseScope(s);\n}\n\nfunction parseCollab(raw: string): ParsedScope {\n // Split on the first two colons only. Filter values may contain\n // colons (UUIDs with `urn:uuid:...`, subject ids like `auth0|user:1`).\n const idx1 = raw.indexOf(':');\n const idx2 = raw.indexOf(':', idx1 + 1);\n if (idx1 === -1 || idx2 === -1) {\n throw new InvalidScope(raw, 'collab scope requires entity:action:filter');\n }\n const entity = raw.slice(0, idx1);\n const action = raw.slice(idx1 + 1, idx2);\n const filterStr = raw.slice(idx2 + 1);\n\n if (entity === 'fields') return parseFieldScope(raw, action, filterStr);\n if (entity !== 'annotations') {\n throw new InvalidScope(raw, `unknown collab entity: ${entity}`);\n }\n if (\n action !== 'create' &&\n action !== 'update' &&\n action !== 'delete' &&\n action !== 'set-group' &&\n action !== '*'\n ) {\n throw new InvalidScope(raw, `unknown collab action: ${action}`);\n }\n const filter = parseFilter(filterStr, raw);\n\n // `set-group` is a group-assignment authority, not a per-record collab\n // filter. The only meaningful filter values are `all` (assign to any\n // group) and `group=X` (assign to group X). `:self` and `:createdBy=Y`\n // can't be sensibly applied to \"what group is this annotation in\", so\n // we reject them at parse time rather than silently always-denying.\n if (action === 'set-group' && (filter.kind === 'self' || filter.kind === 'createdBy')) {\n throw new InvalidScope(\n raw,\n `set-group only supports :all or :group=<id> filters (got :${filter.kind})`,\n );\n }\n\n return {\n kind: 'collab',\n entity,\n action: action as CollabAction | '*',\n filter,\n };\n}\n\n/**\n * `fields:<fill|sign|set-group|*>:<all|group=NAME>`. A field's group is who\n * fills it, and a field records no creator, so `self` and `createdBy=` are\n * refused.\n */\nfunction parseFieldScope(raw: string, action: string, filterStr: string): ParsedScope {\n if (action !== 'fill' && action !== 'sign' && action !== 'set-group' && action !== '*') {\n throw new InvalidScope(raw, `unknown fields action: ${action}`);\n }\n const filter = parseFilter(filterStr, raw);\n if (filter.kind !== 'all' && filter.kind !== 'group') {\n throw new InvalidScope(\n raw,\n `fields only support :all or :group=<id> filters (got :${filter.kind})`,\n );\n }\n return { kind: 'collab', entity: 'fields', action: action as FieldAction | '*', filter };\n}\n\nfunction parseFilter(s: string, raw: string): CollabFilter {\n if (s === 'all') return { kind: 'all' };\n if (s === 'self') return { kind: 'self' };\n if (s.startsWith('createdBy=')) {\n const v = s.slice('createdBy='.length);\n if (!v) throw new InvalidScope(raw, 'createdBy= requires a value');\n return { kind: 'createdBy', userId: v };\n }\n if (s.startsWith('group=')) {\n const v = s.slice('group='.length);\n if (!v) throw new InvalidScope(raw, 'group= requires a value');\n return { kind: 'group', groupId: v };\n }\n throw new InvalidScope(raw, `unknown filter: ${s}`);\n}\n\n// Capability shape: lowercase dotted segments, e.g. \"doc.text.copy\".\n// Validates shape first, then membership in the closed set.\nconst CAPABILITY_SHAPE = /^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)+$/;\n\nfunction parseCapability(raw: string): ParsedScope {\n if (!CAPABILITY_SHAPE.test(raw)) {\n throw new InvalidScope(raw, 'invalid capability name shape');\n }\n if (!KNOWN_CAPABILITIES.has(raw as DocCapability)) {\n throw new InvalidScope(raw, `unknown capability: ${raw}`);\n }\n return { kind: 'capability', name: raw as DocCapability };\n}\n","import { materializePdfPermissions } from './builders';\nimport { parseScope } from './parser';\nimport type {\n CollabAction,\n CollabEntity,\n CollabFilter,\n DocCapability,\n Identity,\n ParsedScope,\n PdfBits,\n} from './types';\nimport { protectedCapabilities } from '../../signature/protection';\nimport type { DocumentProtection } from '../../signature/types';\n\n/**\n * Resolved collab subject — the per-record identity bits that collab\n * filters are tested against. Sourced from the target record's stored\n * `/EMBD_Metadata/UserID` and `/GroupID` at mutation time.\n */\nexport interface CollabTarget {\n userId?: string;\n groupId?: string;\n}\n\n/** The collab target of a record read with nullable owner fields (an annotation). */\nexport function collabTargetOf(owner: {\n userId?: string | null;\n groupId?: string | null;\n}): CollabTarget {\n return {\n ...(owner.userId ? { userId: owner.userId } : {}),\n ...(owner.groupId ? { groupId: owner.groupId } : {}),\n };\n}\n\n/**\n * True iff the given capability is granted by the scope array plus the\n * PDF bits visible via `pdf.permissions` expansion.\n *\n * Wildcard `*` short-circuits to true. Anything not explicitly granted\n * (or expanded from `pdf.permissions`) is denied.\n */\nexport function checkCapability(\n capability: DocCapability,\n rawScope: ReadonlyArray<string>,\n pdfBits: PdfBits,\n protection: DocumentProtection | null = null,\n): boolean {\n // Document-derived authority comes first: what the signatures in the\n // file forbid, no scope grants — the wildcard included.\n if (protectedCapabilities(protection).has(capability)) return false;\n const parsed = rawScope.map(parseScope);\n if (parsed.some((s) => s.kind === 'wildcard')) return true;\n return expandedCapabilities(parsed, pdfBits, protection).has(capability);\n}\n\n/**\n * True iff the scope grants at least one of `capabilities`. Convenience\n * for routes like `/text` (`doc.text.copy` or `doc.text.search`) and\n * `/geometry` (`doc.text.select` or `doc.text.search`).\n */\nexport function checkAnyCapability(\n capabilities: ReadonlyArray<DocCapability>,\n rawScope: ReadonlyArray<string>,\n pdfBits: PdfBits,\n protection: DocumentProtection | null = null,\n): boolean {\n return capabilities.some((c) => checkCapability(c, rawScope, pdfBits, protection));\n}\n\n/**\n * True iff the scope grants the collab action against the target record.\n *\n * Narrowing model. For each action independently:\n * 1. wildcard `*` → allow (global escape hatch)\n * 2. if any collab scope applies to this action → narrow: only those\n * collab filters decide. If none match the target, deny — even if\n * `doc.annotate.modify` is also present. This is what makes\n * `[modify, update:self]` correctly mean \"edit own only\" rather\n * than \"edit anyone via modify-bypass.\"\n * 3. otherwise, if `doc.annotate.modify` is present → allow. This is\n * the broad PDF-bit-derived default for create/update/delete when\n * no per-action collab filter has been written.\n * 4. otherwise → deny.\n *\n * For create: `target` should be built by the caller from JWT identity\n * (`{ userId: caller.userId, groupId: caller.groupId }`). `:self` and\n * `:all` then trivially pass; `:group=X` is the meaningful filter (only\n * matches when the caller's default group is X).\n *\n * For update / delete: `target` is the existing row's owner.\n */\nexport function checkCollab(\n action: CollabAction,\n target: CollabTarget,\n rawScope: ReadonlyArray<string>,\n identity: Identity,\n pdfBits: PdfBits,\n): boolean {\n const parsed = rawScope.map(parseScope);\n if (parsed.some((s) => s.kind === 'wildcard')) return true;\n\n const applicableCollab = parsed.filter(\n (s): s is Extract<ParsedScope, { entity: 'annotations' }> =>\n s.kind === 'collab' &&\n s.entity === 'annotations' &&\n (s.action === action || s.action === '*'),\n );\n\n if (applicableCollab.length > 0) {\n // Narrow: presence of any applicable collab scope shadows\n // `modify`-as-default for this action.\n return applicableCollab.some((s) => filterMatches(s.filter, target, identity));\n }\n\n // No collab scope for this action — fall back to the broad default.\n return expandedCapabilities(parsed, pdfBits).has('doc.annotate.modify');\n}\n\n/**\n * Compute the full set of granted capabilities after expanding\n * `pdf.permissions` and applying implication rules.\n *\n * Implications applied:\n * - `doc.annotate.modify` implies `doc.annotate.read` (you can't\n * sensibly modify what you can't see).\n * - `doc.forms.modify` implies `doc.forms.fill` and `doc.forms.read`.\n * - `doc.forms.fill` implies `doc.forms.read`.\n * - any annotation collab scope implies `doc.annotate.read`, because\n * mutation routes need to see the target row to evaluate the\n * collab filter against its current owner.\n * - any field collab scope implies `doc.forms.read`: filling in or\n * signing a field means seeing the form. Groups limit writes, never\n * reads.\n *\n * Does not short-circuit on wildcard — callers do that themselves\n * before calling this. Returning the expanded set is useful for the\n * `/access` response's `effectiveScope` and for advisory UI surfacing.\n */\nexport function expandedCapabilities(\n parsed: ReadonlyArray<ParsedScope>,\n pdfBits: PdfBits,\n protection: DocumentProtection | null = null,\n): Set<DocCapability> {\n const out = new Set<DocCapability>();\n let hasAnnotationCollab = false;\n let hasFieldCollab = false;\n\n for (const s of parsed) {\n if (s.kind === 'capability') {\n out.add(s.name);\n } else if (s.kind === 'virtual' && s.name === 'pdf.permissions') {\n addPdfPermissions(out, pdfBits);\n } else if (s.kind === 'collab' && s.entity === 'annotations') {\n hasAnnotationCollab = true;\n } else if (s.kind === 'collab' && s.entity === 'fields') {\n hasFieldCollab = true;\n }\n }\n\n // Implications (apply after the explicit additions above)\n if (out.has('doc.annotate.modify')) out.add('doc.annotate.read');\n if (out.has('doc.forms.modify')) {\n out.add('doc.forms.fill');\n out.add('doc.forms.read');\n }\n if (out.has('doc.forms.fill')) out.add('doc.forms.read');\n if (hasAnnotationCollab) out.add('doc.annotate.read');\n if (hasFieldCollab) out.add('doc.forms.read');\n\n // Subtraction last: a signed document's own restrictions win over any\n // grant or implication.\n for (const removed of protectedCapabilities(protection)) out.delete(removed);\n\n return out;\n}\n\n/**\n * Convenience wrapper: takes the raw scope array, parses each entry,\n * returns the expanded capability set. Exposed for the `/access`\n * endpoint and for the SDK helper that surfaces `effectiveScope`.\n */\nexport function expandRawScope(\n rawScope: ReadonlyArray<string>,\n pdfBits: PdfBits,\n protection: DocumentProtection | null = null,\n): Set<DocCapability> {\n return expandedCapabilities(rawScope.map(parseScope), pdfBits, protection);\n}\n\n/**\n * Authority to put a record of `entity` in a specific group: an annotation,\n * or a form field.\n *\n * Set-group is decoupled from the write capabilities (`doc.annotate.modify`,\n * `doc.forms.modify`). The reasoning: those describe row access — what kind\n * of write you can do to which existing rows — and map to PDF permission\n * bits. Set-group is a cloud-only *assignment authority*: which destination\n * group can you put a record into? There is no PDF-bit counterpart, so it\n * doesn't inherit from them.\n *\n * Resolution order:\n * 1. newGroupId === callerDefaultGroupId → true (no real reassignment\n * is happening; the record gets the caller's default group)\n * 2. wildcard `*` → true (global escape hatch)\n * 3. `<entity>:set-group:all` → true\n * 4. `<entity>:set-group:group=<newGroupId>` → true\n * 5. `<entity>:*:all` or `<entity>:*:group=<newGroupId>` → true\n * (action wildcard includes set-group)\n * 6. otherwise → false\n *\n * A user with `set-group:group=legal` can put records in the legal group\n * whatever their own group is — that's the whole point.\n */\nexport function checkSetGroup(\n entity: CollabEntity,\n newGroupId: string,\n callerDefaultGroupId: string | undefined,\n rawScope: ReadonlyArray<string>,\n): boolean {\n // No authority needed when the caller is assigning their default group.\n if (newGroupId === callerDefaultGroupId) return true;\n\n const parsed = rawScope.map(parseScope);\n if (parsed.some((s) => s.kind === 'wildcard')) return true;\n\n for (const s of parsed) {\n if (s.kind !== 'collab') continue;\n if (s.entity !== entity) continue;\n if (s.action !== 'set-group' && s.action !== '*') continue;\n if (s.filter.kind === 'all') return true;\n if (s.filter.kind === 'group' && s.filter.groupId === newGroupId) return true;\n // :self and :createdBy are rejected at parse time for set-group, so\n // they never appear here. The action-wildcard path could carry those\n // filters legitimately for other actions — silently skip those, they\n // can't satisfy a set-group check.\n }\n return false;\n}\n\n/**\n * True iff the scope lets the caller `action` (fill in, or sign) a form\n * field in `groupId` (`null` for a field in no group).\n *\n * Narrowing, per action, as for annotations:\n * 1. wildcard `*` → allow;\n * 2. if any `fields:<action>` scope exists (or `fields:*`) → only those\n * decide: the field must match one of their filters, even when the\n * broad capability is also present. A field in no group then matches\n * only `:all`;\n * 3. otherwise the broad capability decides, for every field:\n * `doc.forms.fill` to fill, `doc.sign` to sign.\n *\n * Nothing here narrows form design (`doc.forms.modify`).\n */\nexport function checkFieldAction(\n action: 'fill' | 'sign',\n groupId: string | null,\n rawScope: ReadonlyArray<string>,\n pdfBits: PdfBits,\n protection: DocumentProtection | null = null,\n): boolean {\n const broad: DocCapability = action === 'fill' ? 'doc.forms.fill' : 'doc.sign';\n if (protectedCapabilities(protection).has(broad)) return false;\n const parsed = rawScope.map(parseScope);\n if (parsed.some((s) => s.kind === 'wildcard')) return true;\n\n const applicable = parsed.filter(\n (s) =>\n s.kind === 'collab' && s.entity === 'fields' && (s.action === action || s.action === '*'),\n ) as Extract<ParsedScope, { entity: 'fields' }>[];\n if (applicable.length > 0) {\n return applicable.some(\n (s) => s.filter.kind === 'all' || (groupId !== null && s.filter.groupId === groupId),\n );\n }\n return expandedCapabilities(parsed, pdfBits, protection).has(broad);\n}\n\n/**\n * The form fields a session may act on, by group: every field (`all`), or\n * only the fields of `groups` (none when the list is empty). A field in no\n * group counts only under `all`.\n */\nexport type FieldGroupRight =\n | { readonly all: true }\n | { readonly all: false; readonly groups: readonly string[] };\n\n/** What a session may do with form fields, per action, as group lists a viewer can show. */\nexport interface FieldRights {\n /** The fields it may fill in. */\n readonly fill: FieldGroupRight;\n /** The fields it may sign. */\n readonly sign: FieldGroupRight;\n /** The groups it may put a field in: its own default group always among them. */\n readonly setGroup: FieldGroupRight;\n}\n\n/**\n * {@link checkFieldAction} and {@link checkSetGroup} as lists: for each\n * action, every field or the groups the scope names, so a designer can\n * offer exactly the groups a field may go in, and a filler see whose fields\n * are theirs. The same rules, read the other way round.\n */\nexport function fieldRightsOf(\n rawScope: ReadonlyArray<string>,\n pdfBits: PdfBits,\n protection: DocumentProtection | null,\n callerDefaultGroupId: string | undefined,\n): FieldRights {\n const parsed = rawScope.map(parseScope);\n const wildcard = parsed.some((s) => s.kind === 'wildcard');\n const fieldScopes = (action: 'fill' | 'sign' | 'set-group') =>\n parsed.filter(\n (s) =>\n s.kind === 'collab' && s.entity === 'fields' && (s.action === action || s.action === '*'),\n ) as Extract<ParsedScope, { entity: 'fields' }>[];\n const fromScopes = (\n scopes: Extract<ParsedScope, { entity: 'fields' }>[],\n extra: readonly string[] = [],\n ): FieldGroupRight => {\n if (scopes.some((s) => s.filter.kind === 'all')) return { all: true };\n const groups = scopes.flatMap((s) => (s.filter.kind === 'group' ? [s.filter.groupId] : []));\n return { all: false, groups: [...new Set([...groups, ...extra])] };\n };\n const NONE: FieldGroupRight = { all: false, groups: [] };\n\n const writing = (action: 'fill' | 'sign'): FieldGroupRight => {\n const broad: DocCapability = action === 'fill' ? 'doc.forms.fill' : 'doc.sign';\n if (protectedCapabilities(protection).has(broad)) return NONE;\n if (wildcard) return { all: true };\n const scopes = fieldScopes(action);\n if (scopes.length > 0) return fromScopes(scopes);\n return expandedCapabilities(parsed, pdfBits, protection).has(broad) ? { all: true } : NONE;\n };\n\n const own = callerDefaultGroupId !== undefined ? [callerDefaultGroupId] : [];\n return {\n fill: writing('fill'),\n sign: writing('sign'),\n setGroup: wildcard ? { all: true } : fromScopes(fieldScopes('set-group'), own),\n };\n}\n\n/**\n * Whether the scope lets the caller `action` some form field: the broad\n * capability, or any `fields:<action>` scope. What a form verb checks\n * before its fields are known; each field is checked in the write.\n */\nexport function checkAnyFieldAction(\n action: 'fill' | 'sign',\n rawScope: ReadonlyArray<string>,\n pdfBits: PdfBits,\n protection: DocumentProtection | null = null,\n): boolean {\n const broad: DocCapability = action === 'fill' ? 'doc.forms.fill' : 'doc.sign';\n if (protectedCapabilities(protection).has(broad)) return false;\n const parsed = rawScope.map(parseScope);\n if (parsed.some((s) => s.kind === 'wildcard')) return true;\n if (\n parsed.some(\n (s) =>\n s.kind === 'collab' && s.entity === 'fields' && (s.action === action || s.action === '*'),\n )\n ) {\n return true;\n }\n return expandedCapabilities(parsed, pdfBits, protection).has(broad);\n}\n\n/**\n * Test a single collab filter against a target record. Every filter but\n * `self` compares one fact on the record with the value the scope names:\n *\n * all → always matches\n * self → matches if identity.userId === target.userId\n * createdBy=<X> → matches if target.userId === X\n * group=<X> → matches if target.groupId === X\n */\nexport function filterMatches(filter: CollabFilter, target: CollabTarget, id: Identity): boolean {\n switch (filter.kind) {\n case 'all':\n return true;\n case 'self':\n return !!id.userId && target.userId === id.userId;\n case 'createdBy':\n return target.userId === filter.userId;\n case 'group':\n return target.groupId === filter.groupId;\n }\n}\n\n/**\n * Translate `pdf.permissions` (virtual scope) into the concrete\n * capabilities it represents under the current PDF bit configuration:\n * {@link materializePdfPermissions}, the one reading of the bits.\n */\nfunction addPdfPermissions(out: Set<DocCapability>, b: PdfBits): void {\n for (const capability of materializePdfPermissions(b)) out.add(capability);\n}\n"],"mappings":";;;;;;;;;;;AAYA,IAAa,eAAb,cAAkCA,eAAAA,YAAY;CAG5C,YACE,OACA,QACA;EACA,MAAMC,eAAAA,gBAAgB,YAAY,kBAAkB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