@embedpdf/engine-core 3.0.0-next.13 → 3.0.0-next.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AnnotationList-CkijRHet.d.cts +27163 -0
- package/dist/AnnotationList-CkijRHet.d.ts +27163 -0
- package/dist/Change-CKoxfTNY.js +889 -0
- package/dist/Change-CKoxfTNY.js.map +1 -0
- package/dist/Change-CjImsrN0.cjs +1020 -0
- package/dist/Change-CjImsrN0.cjs.map +1 -0
- package/dist/DocumentRenderService-BfFdFSwI.cjs +120 -0
- package/dist/DocumentRenderService-BfFdFSwI.cjs.map +1 -0
- package/dist/DocumentRenderService-DV3J9lMz.js +85 -0
- package/dist/DocumentRenderService-DV3J9lMz.js.map +1 -0
- package/dist/{DocumentSecurityService-_JRjqvoI.d.ts → DocumentSecurityService-CU1M6Q7m.d.ts} +100 -112
- package/dist/{DocumentSecurityService-ClTZc0zO.d.cts → DocumentSecurityService-e6vp2de8.d.cts} +100 -112
- package/dist/LocalDocumentHandle-D02FMm-Z.cjs +53 -0
- package/dist/LocalDocumentHandle-D02FMm-Z.cjs.map +1 -0
- package/dist/LocalDocumentHandle-DAPdaOt_.js +30 -0
- package/dist/LocalDocumentHandle-DAPdaOt_.js.map +1 -0
- package/dist/LocalEngine-DFoBm4B3.d.cts +1565 -0
- package/dist/LocalEngine-DPriFujS.d.ts +1565 -0
- package/dist/PageInsertBlankInput-CXHAM7l6.cjs +17 -0
- package/dist/PageInsertBlankInput-CXHAM7l6.cjs.map +1 -0
- package/dist/PageInsertBlankInput-DhVYVJ_S.js +12 -0
- package/dist/PageInsertBlankInput-DhVYVJ_S.js.map +1 -0
- package/dist/authority-B3BklsB4.js +2239 -0
- package/dist/authority-B3BklsB4.js.map +1 -0
- package/dist/authority-DLMNR7ff.cjs +2676 -0
- package/dist/authority-DLMNR7ff.cjs.map +1 -0
- package/dist/builders-CNj0POeY.js +161 -0
- package/dist/builders-CNj0POeY.js.map +1 -0
- package/dist/builders-Cgdp_YCn.cjs +184 -0
- package/dist/builders-Cgdp_YCn.cjs.map +1 -0
- package/dist/calibrate-7T3fnP8-.js +2404 -0
- package/dist/calibrate-7T3fnP8-.js.map +1 -0
- package/dist/calibrate-DJBXnhLE.cjs +2919 -0
- package/dist/calibrate-DJBXnhLE.cjs.map +1 -0
- package/dist/charmap-Cprti1ta.js +239 -0
- package/dist/charmap-Cprti1ta.js.map +1 -0
- package/dist/charmap-aYlefQP9.cjs +304 -0
- package/dist/charmap-aYlefQP9.cjs.map +1 -0
- package/dist/conformance.cjs +16753 -5247
- package/dist/conformance.cjs.map +1 -1
- package/dist/conformance.d.cts +928 -165
- package/dist/conformance.d.ts +928 -165
- package/dist/conformance.js +16731 -5268
- package/dist/conformance.js.map +1 -1
- package/dist/format-Bp3QFSH1.cjs +574 -0
- package/dist/format-Bp3QFSH1.cjs.map +1 -0
- package/dist/format-Dgg428Kb.js +461 -0
- package/dist/format-Dgg428Kb.js.map +1 -0
- package/dist/index.cjs +330 -103
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +14 -5
- package/dist/pageRefs-B3ur7Ckm.cjs +51 -0
- package/dist/pageRefs-B3ur7Ckm.cjs.map +1 -0
- package/dist/pageRefs-DkbuxSCV.js +40 -0
- package/dist/pageRefs-DkbuxSCV.js.map +1 -0
- package/dist/public.cjs +57 -0
- package/dist/public.d.cts +5 -0
- package/dist/public.d.ts +5 -0
- package/dist/public.js +9 -0
- package/dist/resolveAnnotationDraft-7Ke4nV7F.cjs +3646 -0
- package/dist/resolveAnnotationDraft-7Ke4nV7F.cjs.map +1 -0
- package/dist/resolveAnnotationDraft-CUpf0SMh.js +3167 -0
- package/dist/resolveAnnotationDraft-CUpf0SMh.js.map +1 -0
- package/dist/{resolver-inAVzsWt.js → resolver-CzxmD9Ck.js} +294 -144
- package/dist/resolver-CzxmD9Ck.js.map +1 -0
- package/dist/{resolver-CYVNV4hn.cjs → resolver-D2OCtE8F.cjs} +347 -143
- package/dist/resolver-D2OCtE8F.cjs.map +1 -0
- package/dist/runtime-Cl0v56mm.d.ts +2032 -0
- package/dist/runtime-p1WDzDo4.d.cts +2032 -0
- package/dist/runtime.cjs +733 -284
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.d.cts +5 -1348
- package/dist/runtime.d.ts +5 -1348
- package/dist/runtime.js +396 -179
- package/dist/runtime.js.map +1 -1
- package/dist/schema-C-gU4vj7.cjs +3034 -0
- package/dist/schema-C-gU4vj7.cjs.map +1 -0
- package/dist/schema-DzlUNk38.js +2081 -0
- package/dist/schema-DzlUNk38.js.map +1 -0
- package/dist/schemas-Berf1swF.cjs +2481 -0
- package/dist/schemas-Berf1swF.cjs.map +1 -0
- package/dist/schemas-D6xOGjqg.js +1654 -0
- package/dist/schemas-D6xOGjqg.js.map +1 -0
- package/dist/subtype-CG4WpIRj.js +129 -0
- package/dist/subtype-CG4WpIRj.js.map +1 -0
- package/dist/subtype-aDt5TFmK.cjs +158 -0
- package/dist/subtype-aDt5TFmK.cjs.map +1 -0
- package/dist/validation.cjs +578 -0
- package/dist/validation.cjs.map +1 -0
- package/dist/validation.d.cts +174 -0
- package/dist/validation.d.ts +174 -0
- package/dist/validation.js +571 -0
- package/dist/validation.js.map +1 -0
- package/dist/value-BFS1R8ek.cjs +435 -0
- package/dist/value-BFS1R8ek.cjs.map +1 -0
- package/dist/value-Dhc8eYcx.js +340 -0
- package/dist/value-Dhc8eYcx.js.map +1 -0
- package/dist/viewport-BJW13EGZ.js +540 -0
- package/dist/viewport-BJW13EGZ.js.map +1 -0
- package/dist/viewport-DlL5Bxbg.cjs +671 -0
- package/dist/viewport-DlL5Bxbg.cjs.map +1 -0
- package/dist/wire.cjs +1056 -379
- package/dist/wire.cjs.map +1 -1
- package/dist/wire.d.cts +15069 -725
- package/dist/wire.d.ts +15069 -725
- package/dist/wire.js +825 -239
- package/dist/wire.js.map +1 -1
- package/package.json +10 -1
- package/dist/AbortError-Cq2igpZ6.cjs +0 -38
- package/dist/AbortError-Cq2igpZ6.cjs.map +0 -1
- package/dist/AbortError-DHqPBnYc.js +0 -27
- package/dist/AbortError-DHqPBnYc.js.map +0 -1
- package/dist/AnnotationListSnapshot-D3mFut1e.d.cts +0 -6871
- package/dist/AnnotationListSnapshot-D3mFut1e.d.ts +0 -6871
- package/dist/Engine-Bx0NOfmd.d.cts +0 -1264
- package/dist/Engine-DxtpCYcP.d.ts +0 -1264
- package/dist/PageInsertBlankInput-CqXBmFhN.cjs +0 -449
- package/dist/PageInsertBlankInput-CqXBmFhN.cjs.map +0 -1
- package/dist/PageInsertBlankInput-cHq9-i-z.js +0 -378
- package/dist/PageInsertBlankInput-cHq9-i-z.js.map +0 -1
- package/dist/builders-Bqm8yTpi.cjs +0 -3564
- package/dist/builders-Bqm8yTpi.cjs.map +0 -1
- package/dist/builders-Dqo2X-dt.js +0 -3121
- package/dist/builders-Dqo2X-dt.js.map +0 -1
- package/dist/fold-2V29cxCV.cjs +0 -447
- package/dist/fold-2V29cxCV.cjs.map +0 -1
- package/dist/fold-CdEJTBTn.js +0 -334
- package/dist/fold-CdEJTBTn.js.map +0 -1
- package/dist/resolver-CYVNV4hn.cjs.map +0 -1
- package/dist/resolver-inAVzsWt.js.map +0 -1
- package/dist/schemas-BLARNCgx.js +0 -3113
- package/dist/schemas-BLARNCgx.js.map +0 -1
- package/dist/schemas-DIqFMmrC.cjs +0 -4468
- package/dist/schemas-DIqFMmrC.cjs.map +0 -1
package/dist/runtime.js
CHANGED
|
@@ -1,128 +1,318 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { a as
|
|
4
|
-
import { S as
|
|
5
|
-
import { n as
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
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
|
+
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
|
+
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, v as _defineProperty, 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, _t as isAbortError, 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, gt as AbortError, 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 { S as AbortablePromise, _ 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";
|
|
8
|
+
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
|
+
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
|
+
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
|
+
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
|
+
import { n as isLocalPage, r as LOCAL_ENGINE_BRAND, t as isLocalDocument } from "./LocalDocumentHandle-DAPdaOt_.js";
|
|
15
|
+
import { a as snapTileScale, i as snapFullPageViewport, n as appearanceLatticeScale, o as isLocalEngine, r as snapAppearanceScale, t as CONTINUOUS_RENDER_POLICY } from "./DocumentRenderService-DV3J9lMz.js";
|
|
16
|
+
//#region src/events/DocumentEventStream.ts
|
|
9
17
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
|
|
14
|
-
|
|
18
|
+
* `on(type, listener)` built on a stream's `subscribe`, so both engines
|
|
19
|
+
* filter the same way and a type listener counts as a subscriber (the cloud
|
|
20
|
+
* opens its live stream for the first one).
|
|
21
|
+
*/
|
|
22
|
+
function subscribeToType(subscribe, type, listener) {
|
|
23
|
+
return subscribe((event) => {
|
|
24
|
+
if (event.type === type) listener(event);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/events/EventHub.ts
|
|
29
|
+
/**
|
|
30
|
+
* The in-process implementation of `DocumentEventStream`, shared by both
|
|
31
|
+
* engine shells (one hub per open `DocumentHandle`). The engine that
|
|
32
|
+
* performs a mutation publishes here at confirmation time; the cloud
|
|
33
|
+
* engine's remote channel will also publish here for other sessions'
|
|
34
|
+
* mutations — listeners never learn which transport delivered an event.
|
|
15
35
|
*
|
|
16
|
-
*
|
|
17
|
-
* -
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* cooperatively (release a queue slot, abort fetch, post a worker
|
|
24
|
-
* abort, etc.). Anything the executor does after that — including
|
|
25
|
-
* a late resolve(value), a late reject(error), or a rejected inner
|
|
26
|
-
* Promise inside AbortablePromise.run — is dropped silently.
|
|
27
|
-
* - abort() after settlement is a no-op.
|
|
36
|
+
* Delivery contract:
|
|
37
|
+
* - synchronous fan-out in subscription order;
|
|
38
|
+
* - error isolation: a throwing listener is re-thrown on a microtask
|
|
39
|
+
* (so it surfaces to the host's unhandled-error reporting) without
|
|
40
|
+
* blocking other listeners or failing the mutation path;
|
|
41
|
+
* - `lastServerId` tracks the highest remote cursor seen, for the
|
|
42
|
+
* remote channel's reconnect/backfill.
|
|
28
43
|
*/
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
constructor(executor) {
|
|
34
|
-
const ctrl = new AbortController();
|
|
35
|
-
const progressCbs = /* @__PURE__ */ new Set();
|
|
36
|
-
const state = { settled: false };
|
|
37
|
-
let capturedReject;
|
|
38
|
-
super((resolve, reject) => {
|
|
39
|
-
capturedReject = reject;
|
|
40
|
-
const wrappedResolve = (value) => {
|
|
41
|
-
if (state.settled) return;
|
|
42
|
-
state.settled = true;
|
|
43
|
-
resolve(value);
|
|
44
|
-
};
|
|
45
|
-
const wrappedReject = (reason) => {
|
|
46
|
-
if (state.settled) return;
|
|
47
|
-
state.settled = true;
|
|
48
|
-
reject(reason);
|
|
49
|
-
};
|
|
50
|
-
const progress = (p) => {
|
|
51
|
-
if (state.settled) return;
|
|
52
|
-
for (const cb of progressCbs) try {
|
|
53
|
-
cb(p);
|
|
54
|
-
} catch {}
|
|
55
|
-
};
|
|
56
|
-
executor(wrappedResolve, wrappedReject, progress, ctrl.signal);
|
|
44
|
+
var EventHub = class {
|
|
45
|
+
constructor(onListenerError = (err) => {
|
|
46
|
+
queueMicrotask(() => {
|
|
47
|
+
throw err;
|
|
57
48
|
});
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
_defineProperty(this, "
|
|
61
|
-
_defineProperty(this, "
|
|
62
|
-
_defineProperty(this, "_internalReject", void 0);
|
|
63
|
-
this._ctrl = ctrl;
|
|
64
|
-
this.signal = ctrl.signal;
|
|
65
|
-
this._progressCbs = progressCbs;
|
|
66
|
-
this._state = state;
|
|
67
|
-
this._internalReject = capturedReject;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Abort the underlying operation.
|
|
71
|
-
*
|
|
72
|
-
* - If the promise has already settled, this is a no-op.
|
|
73
|
-
* - Otherwise the public promise rejects synchronously with an
|
|
74
|
-
* AbortError (wrapping the supplied reason if it is not already an
|
|
75
|
-
* AbortError) and the AbortSignal fires for any cooperative
|
|
76
|
-
* cancellation the executor wired up.
|
|
77
|
-
*/
|
|
78
|
-
abort(reason) {
|
|
79
|
-
if (this._state.settled) return;
|
|
80
|
-
if (this._ctrl.signal.aborted) return;
|
|
81
|
-
const err = reason instanceof AbortError ? reason : new AbortError(reason);
|
|
82
|
-
this._state.settled = true;
|
|
83
|
-
this._ctrl.abort(err);
|
|
84
|
-
this._internalReject(err);
|
|
49
|
+
}) {
|
|
50
|
+
this.onListenerError = onListenerError;
|
|
51
|
+
_defineProperty(this, "listeners", /* @__PURE__ */ new Set());
|
|
52
|
+
_defineProperty(this, "serverId", null);
|
|
85
53
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
*/
|
|
89
|
-
onProgress(cb) {
|
|
90
|
-
this._progressCbs.add(cb);
|
|
54
|
+
subscribe(listener) {
|
|
55
|
+
this.listeners.add(listener);
|
|
91
56
|
return () => {
|
|
92
|
-
this.
|
|
57
|
+
this.listeners.delete(listener);
|
|
93
58
|
};
|
|
94
59
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
60
|
+
on(type, listener) {
|
|
61
|
+
return subscribeToType((all) => this.subscribe(all), type, listener);
|
|
62
|
+
}
|
|
63
|
+
publish(event) {
|
|
64
|
+
if ("origin" in event) {
|
|
65
|
+
const { serverId } = event.origin;
|
|
66
|
+
if (serverId !== null) this.serverId = this.serverId === null ? serverId : Math.max(this.serverId, serverId);
|
|
67
|
+
}
|
|
68
|
+
for (const listener of [...this.listeners]) try {
|
|
69
|
+
listener(event);
|
|
70
|
+
} catch (err) {
|
|
71
|
+
this.onListenerError(err);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
lastServerId() {
|
|
75
|
+
return this.serverId;
|
|
76
|
+
}
|
|
77
|
+
/** Drop every listener (handle close). Idempotent. */
|
|
78
|
+
clear() {
|
|
79
|
+
this.listeners.clear();
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Stamps provenance onto events a mutation path produces. One per open
|
|
84
|
+
* handle: the engine shell constructs it with the instance's `sessionId`
|
|
85
|
+
* (and, on cloud, the authenticated `sub` when known) and hands it to the
|
|
86
|
+
* mutation services — they publish results, never build origins.
|
|
87
|
+
*/
|
|
88
|
+
var SessionEventPublisher = class {
|
|
89
|
+
constructor(hub, sessionId, sub = null) {
|
|
90
|
+
this.hub = hub;
|
|
91
|
+
this.sessionId = sessionId;
|
|
92
|
+
this.sub = sub;
|
|
100
93
|
}
|
|
101
94
|
/**
|
|
102
|
-
*
|
|
95
|
+
* Publish what one write of this session just committed: one
|
|
96
|
+
* event per fact, in order, all carrying the write's `opId` as
|
|
97
|
+
* `origin.tx`.
|
|
103
98
|
*/
|
|
104
|
-
|
|
105
|
-
|
|
99
|
+
publishWrite(opId, ...events) {
|
|
100
|
+
this.publishChange(opId, events);
|
|
106
101
|
}
|
|
107
102
|
/**
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
* cooperate with the abort.
|
|
111
|
-
*
|
|
112
|
-
* If abort() fires while the inner async function is still running, the
|
|
113
|
-
* public promise rejects with AbortError immediately. The inner async
|
|
114
|
-
* function's eventual settlement (resolve or reject) is funneled through
|
|
115
|
-
* the wrapped settlers and silently dropped — including a late rejection
|
|
116
|
-
* from the underlying work, which prevents an UnhandledRejection because
|
|
117
|
-
* the .then(resolve, reject) below "handles" it via the no-op.
|
|
103
|
+
* Publish what one change committed: its events as {@link publishWrite}
|
|
104
|
+
* does, and for an undo, the `opId` of the change it undid.
|
|
118
105
|
*/
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
106
|
+
publishChange(opId, events, undoOf) {
|
|
107
|
+
const ts = Date.now();
|
|
108
|
+
events.forEach((event, index) => {
|
|
109
|
+
this.hub.publish({
|
|
110
|
+
...event,
|
|
111
|
+
origin: {
|
|
112
|
+
kind: "local",
|
|
113
|
+
sessionId: this.sessionId,
|
|
114
|
+
sub: this.sub,
|
|
115
|
+
ts,
|
|
116
|
+
serverId: null,
|
|
117
|
+
tx: {
|
|
118
|
+
id: opId,
|
|
119
|
+
index,
|
|
120
|
+
count: events.length
|
|
121
|
+
},
|
|
122
|
+
...undoOf !== void 0 ? { undoOf } : {}
|
|
123
|
+
}
|
|
124
|
+
});
|
|
122
125
|
});
|
|
123
126
|
}
|
|
124
127
|
};
|
|
125
128
|
//#endregion
|
|
129
|
+
//#region src/events/changeEvents.ts
|
|
130
|
+
/**
|
|
131
|
+
* The events a change publishes: each op's events as its single verb
|
|
132
|
+
* publishes them, in op order. An op an undo left alone entirely publishes
|
|
133
|
+
* nothing. The publisher stamps them all with the change's `opId`.
|
|
134
|
+
*/
|
|
135
|
+
function changeEvents(result) {
|
|
136
|
+
return result.items.flatMap(itemEvents);
|
|
137
|
+
}
|
|
138
|
+
function itemEvents(item) {
|
|
139
|
+
if (isSkippedItem(item)) return [];
|
|
140
|
+
switch (item.type) {
|
|
141
|
+
case "annotations.create": {
|
|
142
|
+
const { type: _type, ...result } = item;
|
|
143
|
+
return [{
|
|
144
|
+
type: "annotations.created",
|
|
145
|
+
...result
|
|
146
|
+
}];
|
|
147
|
+
}
|
|
148
|
+
case "annotations.update": {
|
|
149
|
+
const { type: _type, skipped: _skipped, ...result } = item;
|
|
150
|
+
return [{
|
|
151
|
+
type: "annotations.updated",
|
|
152
|
+
...result
|
|
153
|
+
}];
|
|
154
|
+
}
|
|
155
|
+
case "annotations.delete": {
|
|
156
|
+
const { type: _type, ...result } = item;
|
|
157
|
+
return [{
|
|
158
|
+
type: "annotations.deleted",
|
|
159
|
+
deleted: deletedAnnotationsOf(result),
|
|
160
|
+
...result
|
|
161
|
+
}];
|
|
162
|
+
}
|
|
163
|
+
case "annotations.reorder": {
|
|
164
|
+
const { type: _type, ...result } = item;
|
|
165
|
+
return [{
|
|
166
|
+
type: "annotations.reordered",
|
|
167
|
+
...result
|
|
168
|
+
}];
|
|
169
|
+
}
|
|
170
|
+
case "annotations.restore": {
|
|
171
|
+
const { type: _type, ...result } = item;
|
|
172
|
+
return [{
|
|
173
|
+
type: "annotations.restored",
|
|
174
|
+
...result
|
|
175
|
+
}];
|
|
176
|
+
}
|
|
177
|
+
case "annotations.import": {
|
|
178
|
+
const { type: _type, ...result } = item;
|
|
179
|
+
return annotationImportFacts(result).map((fact) => ({
|
|
180
|
+
type: "annotations.created",
|
|
181
|
+
...fact
|
|
182
|
+
}));
|
|
183
|
+
}
|
|
184
|
+
case "forms.import": {
|
|
185
|
+
const { type: _type, ...result } = item;
|
|
186
|
+
return formImportFacts(result).map((fact) => ({
|
|
187
|
+
type: "forms.created",
|
|
188
|
+
...fact
|
|
189
|
+
}));
|
|
190
|
+
}
|
|
191
|
+
case "forms.importValues": {
|
|
192
|
+
const { type: _type, ...result } = item;
|
|
193
|
+
return formValuesImportFacts(result).map((fact) => ({
|
|
194
|
+
type: "forms.valueSet",
|
|
195
|
+
...fact
|
|
196
|
+
}));
|
|
197
|
+
}
|
|
198
|
+
case "forms.setValue": {
|
|
199
|
+
const { type: _type, ...result } = item;
|
|
200
|
+
return [{
|
|
201
|
+
type: "forms.valueSet",
|
|
202
|
+
...result
|
|
203
|
+
}];
|
|
204
|
+
}
|
|
205
|
+
case "forms.reset": {
|
|
206
|
+
const { type: _type, skipped: _skipped, ...result } = item;
|
|
207
|
+
return formResetFacts(result).map((fact) => ({
|
|
208
|
+
type: "forms.valueSet",
|
|
209
|
+
...fact
|
|
210
|
+
}));
|
|
211
|
+
}
|
|
212
|
+
case "forms.setDisplay":
|
|
213
|
+
case "forms.setAppearanceText":
|
|
214
|
+
case "forms.setSignatureAppearance": {
|
|
215
|
+
const { type: _type, ...result } = item;
|
|
216
|
+
return [{
|
|
217
|
+
type: "forms.updated",
|
|
218
|
+
...result
|
|
219
|
+
}];
|
|
220
|
+
}
|
|
221
|
+
case "forms.update": {
|
|
222
|
+
const { type: _type, skipped: _skipped, ...result } = item;
|
|
223
|
+
return [{
|
|
224
|
+
type: "forms.updated",
|
|
225
|
+
...result
|
|
226
|
+
}];
|
|
227
|
+
}
|
|
228
|
+
case "forms.create": {
|
|
229
|
+
const { type: _type, ...result } = item;
|
|
230
|
+
return [{
|
|
231
|
+
type: "forms.created",
|
|
232
|
+
...result
|
|
233
|
+
}];
|
|
234
|
+
}
|
|
235
|
+
case "forms.delete": {
|
|
236
|
+
const { type: _type, ...result } = item;
|
|
237
|
+
return [{
|
|
238
|
+
type: "forms.deleted",
|
|
239
|
+
deleted: deletedFieldOf(result),
|
|
240
|
+
...result
|
|
241
|
+
}];
|
|
242
|
+
}
|
|
243
|
+
case "forms.restore": {
|
|
244
|
+
const { type: _type, ...result } = item;
|
|
245
|
+
return [{
|
|
246
|
+
type: "forms.restored",
|
|
247
|
+
...result
|
|
248
|
+
}];
|
|
249
|
+
}
|
|
250
|
+
case "forms.addWidget": {
|
|
251
|
+
const { type: _type, ...result } = item;
|
|
252
|
+
return [{
|
|
253
|
+
type: "forms.widgetAdded",
|
|
254
|
+
...result
|
|
255
|
+
}];
|
|
256
|
+
}
|
|
257
|
+
case "forms.removeWidget": {
|
|
258
|
+
const { type: _type, ...result } = item;
|
|
259
|
+
return [{
|
|
260
|
+
type: "forms.widgetRemoved",
|
|
261
|
+
...result
|
|
262
|
+
}];
|
|
263
|
+
}
|
|
264
|
+
case "forms.deleteWidget": {
|
|
265
|
+
const { type: _type, ...result } = item;
|
|
266
|
+
return [{
|
|
267
|
+
type: "forms.widgetDeleted",
|
|
268
|
+
...result
|
|
269
|
+
}];
|
|
270
|
+
}
|
|
271
|
+
case "forms.restoreWidget": {
|
|
272
|
+
const { type: _type, ...result } = item;
|
|
273
|
+
return [{
|
|
274
|
+
type: "forms.widgetRestored",
|
|
275
|
+
...result
|
|
276
|
+
}];
|
|
277
|
+
}
|
|
278
|
+
case "forms.reorderWidgets": {
|
|
279
|
+
const { type: _type, ...result } = item;
|
|
280
|
+
return [{
|
|
281
|
+
type: "forms.widgetsReordered",
|
|
282
|
+
...result
|
|
283
|
+
}];
|
|
284
|
+
}
|
|
285
|
+
case "forms.reorderCalculations": {
|
|
286
|
+
const { type: _type, ...result } = item;
|
|
287
|
+
return [{
|
|
288
|
+
type: "forms.calculationsReordered",
|
|
289
|
+
...result
|
|
290
|
+
}];
|
|
291
|
+
}
|
|
292
|
+
case "forms.updateWidget": {
|
|
293
|
+
const { type: _type, skipped: _skipped, ...result } = item;
|
|
294
|
+
return [{
|
|
295
|
+
type: "forms.widgetUpdated",
|
|
296
|
+
...result
|
|
297
|
+
}];
|
|
298
|
+
}
|
|
299
|
+
case "metadata.update": {
|
|
300
|
+
const { type: _type, skipped: _skipped, ...result } = item;
|
|
301
|
+
return [{
|
|
302
|
+
type: "metadata.updated",
|
|
303
|
+
...result
|
|
304
|
+
}];
|
|
305
|
+
}
|
|
306
|
+
case "metadata.updateCustom": {
|
|
307
|
+
const { type: _type, skipped: _skipped, ...result } = item;
|
|
308
|
+
return [{
|
|
309
|
+
type: "metadata.customUpdated",
|
|
310
|
+
...result
|
|
311
|
+
}];
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
//#endregion
|
|
126
316
|
//#region src/engine/document-security-state.ts
|
|
127
317
|
function securityStateFromHead(head) {
|
|
128
318
|
return {
|
|
@@ -168,20 +358,20 @@ function permissionInfoWithAdvisory(info, pdfBits) {
|
|
|
168
358
|
}
|
|
169
359
|
/**
|
|
170
360
|
* Translate a {@link PdfBits} view into the capability-shaped
|
|
171
|
-
* {@link PdfPermissionAdvisory}
|
|
172
|
-
*
|
|
173
|
-
* expansion — `doc.print.high` requires bit 12 AND bit 3, etc.
|
|
361
|
+
* {@link PdfPermissionAdvisory}: what `pdf.permissions` grants on a file
|
|
362
|
+
* with these bits.
|
|
174
363
|
*/
|
|
175
364
|
function advisoryFromPdfBits(b) {
|
|
365
|
+
const granted = new Set(materializePdfPermissions(b));
|
|
176
366
|
return {
|
|
177
|
-
canPrint:
|
|
178
|
-
canPrintHigh:
|
|
179
|
-
canCopy:
|
|
180
|
-
canAnnotate:
|
|
181
|
-
canFillForms:
|
|
182
|
-
canModifyForms:
|
|
183
|
-
canModifyPages:
|
|
184
|
-
canAssemble:
|
|
367
|
+
canPrint: granted.has("doc.print"),
|
|
368
|
+
canPrintHigh: granted.has("doc.print.high"),
|
|
369
|
+
canCopy: granted.has("doc.text.copy"),
|
|
370
|
+
canAnnotate: granted.has("doc.annotate.modify"),
|
|
371
|
+
canFillForms: granted.has("doc.forms.fill"),
|
|
372
|
+
canModifyForms: granted.has("doc.forms.modify"),
|
|
373
|
+
canModifyPages: granted.has("doc.pages.modify"),
|
|
374
|
+
canAssemble: granted.has("doc.pages.assemble")
|
|
185
375
|
};
|
|
186
376
|
}
|
|
187
377
|
function securityStateFromProbe(info, opts = {}) {
|
|
@@ -211,68 +401,95 @@ function securityStateFromProbe(info, opts = {}) {
|
|
|
211
401
|
};
|
|
212
402
|
}
|
|
213
403
|
//#endregion
|
|
214
|
-
//#region src/
|
|
215
|
-
const
|
|
404
|
+
//#region src/scheduling/place.ts
|
|
405
|
+
const PLACE_ORDER = {
|
|
406
|
+
elsewhere: 0,
|
|
407
|
+
near: 1,
|
|
408
|
+
visible: 2
|
|
409
|
+
};
|
|
410
|
+
/** More device pixels than any screen shows, so pixels never outweigh the rest of a rank. */
|
|
411
|
+
const PIXEL_SPAN = 2 ** 40;
|
|
412
|
+
const ELSEWHERE = {
|
|
413
|
+
place: "elsewhere",
|
|
414
|
+
pixels: 0
|
|
415
|
+
};
|
|
416
|
+
const ON_SCREEN = {
|
|
417
|
+
place: "visible",
|
|
418
|
+
pixels: 0
|
|
419
|
+
};
|
|
420
|
+
/** Whether `a` is the better place: on screen before near before elsewhere, then more pixels. */
|
|
421
|
+
function placedBefore(a, b) {
|
|
422
|
+
const order = PLACE_ORDER[a.place] - PLACE_ORDER[b.place];
|
|
423
|
+
return order !== 0 ? order > 0 : a.pixels > b.pixels;
|
|
424
|
+
}
|
|
216
425
|
/**
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
* - `continuous` → identity (local/cloud plugin code stays byte-identical).
|
|
222
|
-
* - `lattice` → returns a `width`-kind viewport at the smallest ladder
|
|
223
|
-
* width ≥ the requested detail (snap UP: always crisp, CSS downscales
|
|
224
|
-
* for free), capped at the largest width — detail beyond the cap is the
|
|
225
|
-
* tile pyramid's job, by design.
|
|
226
|
-
* - `scale`-kind requests convert through the page's width in PDF user
|
|
227
|
-
* units — pass `opts.pageWidth` (the caller has it from the layout);
|
|
228
|
-
* omitting it for a scale viewport under a lattice policy is a
|
|
229
|
-
* programmer error and throws `InvalidArg`.
|
|
426
|
+
* A job's place in one view: its page's role there, except that a part of a
|
|
427
|
+
* visible page that's off screen (a tile of the ring around what shows) is
|
|
428
|
+
* `near`.
|
|
230
429
|
*/
|
|
231
|
-
function
|
|
232
|
-
if (
|
|
233
|
-
if (
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
}
|
|
430
|
+
function placeIn(entry, job) {
|
|
431
|
+
if (!entry) return ELSEWHERE;
|
|
432
|
+
if (entry.role === "near") return {
|
|
433
|
+
place: "near",
|
|
434
|
+
pixels: 0
|
|
435
|
+
};
|
|
436
|
+
if (job.region && entry.visible && !overlaps(job.region, entry.visible)) return {
|
|
437
|
+
place: "near",
|
|
438
|
+
pixels: 0
|
|
439
|
+
};
|
|
242
440
|
return {
|
|
243
|
-
|
|
244
|
-
|
|
441
|
+
place: "visible",
|
|
442
|
+
pixels: entry.pixels
|
|
245
443
|
};
|
|
246
444
|
}
|
|
247
445
|
/**
|
|
248
|
-
*
|
|
249
|
-
*
|
|
250
|
-
*
|
|
251
|
-
*
|
|
252
|
-
*
|
|
253
|
-
|
|
446
|
+
* A job's place among a document's views: in the view it serves, or, when it
|
|
447
|
+
* serves none (or one that said nothing), the best place its page has in any
|
|
448
|
+
* view. A job about the whole document serves what's shown, so it counts as
|
|
449
|
+
* on screen. While no view says anything, every job is on screen alike, and
|
|
450
|
+
* jobs run in the order they were asked.
|
|
451
|
+
*/
|
|
452
|
+
function placeFor(job, views) {
|
|
453
|
+
if (views.size === 0 || !job.page) return ON_SCREEN;
|
|
454
|
+
const objectNumber = job.page.objectNumber;
|
|
455
|
+
const served = job.view === void 0 ? void 0 : views.get(job.view);
|
|
456
|
+
if (served) return placeIn(served.get(objectNumber), job);
|
|
457
|
+
let best = ELSEWHERE;
|
|
458
|
+
for (const pages of views.values()) {
|
|
459
|
+
const placed = placeIn(pages.get(objectNumber), job);
|
|
460
|
+
if (placedBefore(placed, best)) best = placed;
|
|
461
|
+
}
|
|
462
|
+
return best;
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* How soon a job runs among those that may run: higher first. It compares, in
|
|
466
|
+
* turn:
|
|
467
|
+
* 1. background last: a `low` call is about nothing the views show;
|
|
468
|
+
* 2. where its page is: on screen, then just off it, then elsewhere;
|
|
469
|
+
* 3. its priority: `high` (the picture of the page itself) before `auto`;
|
|
470
|
+
* 4. a whole page before a part of one: a tile is only of use once its page
|
|
471
|
+
* is there;
|
|
472
|
+
* 5. the device pixels its page shows.
|
|
473
|
+
* Equal ranks run in the order they were asked, so a caller sequences its own work.
|
|
254
474
|
*/
|
|
255
|
-
function
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
475
|
+
function rank(job, placed) {
|
|
476
|
+
let level = job.priority === "low" ? 0 : 1;
|
|
477
|
+
level = level * 3 + PLACE_ORDER[placed.place];
|
|
478
|
+
level = level * 2 + (job.priority === "high" ? 1 : 0);
|
|
479
|
+
level = level * 2 + (job.region ? 0 : 1);
|
|
480
|
+
return level * PIXEL_SPAN + Math.min(PIXEL_SPAN - 1, Math.round(placed.pixels));
|
|
260
481
|
}
|
|
261
482
|
/**
|
|
262
|
-
*
|
|
263
|
-
*
|
|
264
|
-
*
|
|
265
|
-
*
|
|
266
|
-
* the tiling client uses its own default pyramid then — see
|
|
267
|
-
* plugin-render). Snap UP, cap at the largest scale: per-tile cost is
|
|
268
|
-
* constant by construction (`tileSize²` pixels regardless of level), so
|
|
269
|
-
* the cap bounds artifact COUNT, not memory.
|
|
483
|
+
* Whether rank `a` beats rank `b` on more than pixels (any of the first four
|
|
484
|
+
* steps of {@link rank}). A running job gives way only to a job that clearly
|
|
485
|
+
* outranks it, so two pages on screen never stop each other's work, and jobs
|
|
486
|
+
* don't flip back and forth while the camera moves.
|
|
270
487
|
*/
|
|
271
|
-
function
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
return
|
|
488
|
+
function clearlyOutranks(a, b) {
|
|
489
|
+
return Math.floor(a / PIXEL_SPAN) > Math.floor(b / PIXEL_SPAN);
|
|
490
|
+
}
|
|
491
|
+
function overlaps(a, b) {
|
|
492
|
+
return a.x < b.x + b.width && b.x < a.x + a.width && a.y < b.y + b.height && b.y < a.y + a.height;
|
|
276
493
|
}
|
|
277
494
|
//#endregion
|
|
278
495
|
//#region src/engine/passwordPrompt.ts
|
|
@@ -280,7 +497,7 @@ function snapTileScale(policy, scale) {
|
|
|
280
497
|
* Derive the high-level password prompt from the raw security state.
|
|
281
498
|
*
|
|
282
499
|
* The function is pure and total — every `DocumentSecurityState`
|
|
283
|
-
* maps to exactly one `PasswordPrompt`. Use this as the
|
|
500
|
+
* maps to exactly one `PasswordPrompt`. Use this as the single source
|
|
284
501
|
* of truth wherever the SDK exposes a "do you need a password?" flag:
|
|
285
502
|
* both `LocalDocumentSecurityService` and `CloudDocumentSecurityService`
|
|
286
503
|
* call it, so the contract can never drift.
|
|
@@ -310,15 +527,17 @@ function snapTileScale(policy, scale) {
|
|
|
310
527
|
*
|
|
311
528
|
* 6. fallthrough → { state: 'none' } open and nothing more available
|
|
312
529
|
*/
|
|
313
|
-
function passwordPromptFromState(state) {
|
|
530
|
+
function passwordPromptFromState(state, incorrect = false) {
|
|
314
531
|
if (state.encryption.state === "none") return { state: "none" };
|
|
315
532
|
if (!state.permissions.known) return {
|
|
316
533
|
state: "required",
|
|
317
|
-
hint: null
|
|
534
|
+
hint: null,
|
|
535
|
+
incorrect
|
|
318
536
|
};
|
|
319
537
|
if (state.encryption.requiresPassword && state.permissions.openedAs === "none") return {
|
|
320
538
|
state: "required",
|
|
321
|
-
hint: "user"
|
|
539
|
+
hint: "user",
|
|
540
|
+
incorrect
|
|
322
541
|
};
|
|
323
542
|
if (state.permissions.openedAs === "owner") return { state: "none" };
|
|
324
543
|
if (state.permissions.canUpgradeToOwner) return {
|
|
@@ -340,10 +559,8 @@ const EMPTY_TRANSFER = Object.freeze([]);
|
|
|
340
559
|
*
|
|
341
560
|
* The `transfer` argument is optional; omitting it (or passing `[]`)
|
|
342
561
|
* is the explicit, type-checked way to say "I declare this message
|
|
343
|
-
* carries no transferables."
|
|
344
|
-
*
|
|
345
|
-
* the declaration is at construction time, in the producer's own
|
|
346
|
-
* code, where the knowledge actually lives.
|
|
562
|
+
* carries no transferables." The declaration is made at construction
|
|
563
|
+
* time, in the producer's own code, where the knowledge actually lives.
|
|
347
564
|
*
|
|
348
565
|
* wirePack({ kind: 'metadata.read', jobId, docId })
|
|
349
566
|
* wirePack({ kind: 'open.fatMem', jobId, docId, bytes }, [bytes])
|
|
@@ -356,6 +573,6 @@ function wirePack(payload, transfer = EMPTY_TRANSFER) {
|
|
|
356
573
|
};
|
|
357
574
|
}
|
|
358
575
|
//#endregion
|
|
359
|
-
export { ANNOTATION_SUBTYPES, AbortError, AbortablePromise, CONTINUOUS_RENDER_POLICY, DEFAULT_EDGE_RESOLVER_BUDGET, DEFAULT_PDF_SAVE_MODE, EMPTY_TRANSFER, EdgeResolver, EngineError, EngineErrorCode, InvalidScope, MissingIdentity, NO_ANNOTATION_FLAGS, PAGE_INSERT_BLANK_MAX_COUNT, PDF_BITS, PDF_CODE_TO_SUBTYPE, PDF_SUBTYPE_TO_CODE, PdfAnnotationSubtypeCode, PermissionDenied, SEARCH_FOLD_VERSION, SEARCH_REGEX_MAX_LENGTH, SEARCH_SNIPPET_CONTEXT, SIGNATURE_POLICY_VERSION,
|
|
576
|
+
export { ANNOTATION_APPEARANCE_MODES, ANNOTATION_DEFAULTS, ANNOTATION_FIELD_NAMES, ANNOTATION_FIELD_SPACES, ANNOTATION_RESOURCE_ROLES, ANNOTATION_RESOURCE_ROLE_NAMES, ANNOTATION_SUBTYPES, AbortError, AbortablePromise, AnnotationTransfer, CONTINUOUS_RENDER_POLICY, DEFAULT_BUNDLE_LIMITS, DEFAULT_EDGE_RESOLVER_BUDGET, DEFAULT_MEDIA_BOX, DEFAULT_PDF_SAVE_MODE, DEFAULT_RICH_TEXT_BODY, DRAWN_RECT_KINDS, EMPTY_TRANSFER, EdgeResolver, EngineError, EngineErrorCode, EventHub, FormTransfer, InvalidScope, LOCAL_ENGINE_BRAND, 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, SessionEventPublisher, UNBAKED_KINDS, USAGE_INCOMPLETE, WIDGET_ACTION_EVENTS, WIDGET_FLAG_NAMES, actionWriteOf, advisoryFromPdfBits, allowsCapability, allowsFieldWrite, allowsSomeFieldWrite, anchorOf, annotationDefaultsOf, annotationImportFacts, annotationKey, annotationOfDraft, annotationPatchBetween, annotationResourceBuffers, annotationWriteCapabilities, annotationWriteCapability, appearanceChangeOf, appearanceImpactOf, appearanceLatticeScale, 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, changeEvents, changeFingerprint, changedKeys, charBoundaryAtTextOffset, charMapViolation, charRangeForTextOffsets, checkAnyCapability, checkAnyFieldAction, checkCapability, checkCollab, checkFieldAction, checkImageQuality, checkSetGroup, classifyRelation, clearlyOutranks, 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, isAbortError, isAtDefault, isDimension, isFieldScript, isKeptRefusal, isLocalDocument, isLocalEngine, isLocalPage, 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, passwordPromptFromState, 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, permissionInfoFromProbe, permissionInfoWithAdvisory, placeFor, placeIn, placedBefore, placedWidgetOf, polygonArea, positionIndex, primaryFinding, protectedCapabilities, quarterTurnOf, rank, 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, securityStateFromHead, securityStateFromProbe, semanticEqual, serializeError, shapeForRect, shownAppearances, sliceText, snapAppearanceScale, snapFullPageViewport, snapTileScale, sniffBinaryMetadata, squareMetres, squareOf, stableStringify, standardStateModelOf, subscribeToType, subtypeFromCode, toAttachmentRef, toFieldRef, toOriginalRange, toPageRef, topRowOf, touchesCaption, validAreaBoundary, validNumberFormat, validateScopeArray, validateSearchQuery, validateSearchRegex, valueEntriesEqual, viewportForPoint, visibleBoxesOf, widgetActionsOf, widgetAfterPatch, widgetsAfterDisplay, wirePack, withFileFromResource, wordAt, wordBefore, worstVerdict, writesScripts };
|
|
360
577
|
|
|
361
578
|
//# sourceMappingURL=runtime.js.map
|