@embedpdf/engine-core 3.0.0-next.14 → 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-Ca6EK3-3.d.ts → DocumentSecurityService-CU1M6Q7m.d.ts} +100 -112
- package/dist/{DocumentSecurityService-CIx1MT0T.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/{viewport-BWeNHZmb.cjs → authority-DLMNR7ff.cjs} +820 -1647
- 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 +16466 -5247
- package/dist/conformance.cjs.map +1 -1
- package/dist/conformance.d.cts +924 -165
- package/dist/conformance.d.ts +924 -165
- package/dist/conformance.js +16429 -5252
- 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 +323 -116
- 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 +726 -297
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.d.cts +5 -1372
- package/dist/runtime.d.ts +5 -1372
- 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 +1051 -397
- package/dist/wire.cjs.map +1 -1
- package/dist/wire.d.cts +12403 -790
- package/dist/wire.d.ts +12403 -790
- package/dist/wire.js +821 -242
- package/dist/wire.js.map +1 -1
- package/package.json +10 -1
- package/dist/AbortError-DwuHPK_I.js +0 -27
- package/dist/AbortError-DwuHPK_I.js.map +0 -1
- package/dist/AbortError-P0RU0Mgg.cjs +0 -38
- package/dist/AbortError-P0RU0Mgg.cjs.map +0 -1
- package/dist/AnnotationListSnapshot-D9R5n2Kf.d.cts +0 -7101
- package/dist/AnnotationListSnapshot-D9R5n2Kf.d.ts +0 -7101
- package/dist/Engine-EWWHhEIi.d.ts +0 -1277
- package/dist/Engine-FNaAEjfb.d.cts +0 -1277
- package/dist/derive-BbsDk_Kz.cjs +0 -880
- package/dist/derive-BbsDk_Kz.cjs.map +0 -1
- package/dist/derive-DAFJolWu.js +0 -647
- package/dist/derive-DAFJolWu.js.map +0 -1
- package/dist/format-Bbphf4zR.js +0 -435
- package/dist/format-Bbphf4zR.js.map +0 -1
- package/dist/format-D_epWlob.cjs +0 -518
- package/dist/format-D_epWlob.cjs.map +0 -1
- package/dist/resolver-CYVNV4hn.cjs.map +0 -1
- package/dist/resolver-inAVzsWt.js.map +0 -1
- package/dist/schemas-CFQGvWiu.js +0 -3243
- package/dist/schemas-CFQGvWiu.js.map +0 -1
- package/dist/schemas-D0g6tKa9.cjs +0 -4694
- package/dist/schemas-D0g6tKa9.cjs.map +0 -1
- package/dist/viewport-BWeNHZmb.cjs.map +0 -1
- package/dist/viewport-CvMcadfQ.js +0 -3072
- package/dist/viewport-CvMcadfQ.js.map +0 -1
|
@@ -0,0 +1,461 @@
|
|
|
1
|
+
//#region src/errors/EngineErrorCode.ts
|
|
2
|
+
const EngineErrorCode = {
|
|
3
|
+
Unknown: "Unknown",
|
|
4
|
+
InvalidArg: "InvalidArg",
|
|
5
|
+
DocNotOpen: "DocNotOpen",
|
|
6
|
+
DocOpenFailed: "DocOpenFailed",
|
|
7
|
+
DocPasswordRequired: "DocPasswordRequired",
|
|
8
|
+
DocPasswordIncorrect: "DocPasswordIncorrect",
|
|
9
|
+
/**
|
|
10
|
+
* A share-token exchange (`open({ kind: 'share' })`) needs the grant's
|
|
11
|
+
* passphrase: none was supplied, or the supplied one was rejected —
|
|
12
|
+
* indistinguishable by design, mirroring the server. Prompt and retry
|
|
13
|
+
* with `sharePassword`. Distinct from `DocPasswordRequired`, which is
|
|
14
|
+
* about the PDF's own encryption password.
|
|
15
|
+
*/
|
|
16
|
+
SharePasswordRequired: "SharePasswordRequired",
|
|
17
|
+
Aborted: "Aborted",
|
|
18
|
+
Network: "Network",
|
|
19
|
+
Unauthenticated: "Unauthenticated",
|
|
20
|
+
Forbidden: "Forbidden",
|
|
21
|
+
NotFound: "NotFound",
|
|
22
|
+
WireFormat: "WireFormat",
|
|
23
|
+
RuntimeUnavailable: "RuntimeUnavailable",
|
|
24
|
+
/**
|
|
25
|
+
* A layer write lost its optimistic-concurrency check: the layer's
|
|
26
|
+
* durable version advanced (another writer — typically another server
|
|
27
|
+
* replica — committed) between the operation's prepare and its commit,
|
|
28
|
+
* and the server exhausted its rebase-and-retry budget. Retryable: the
|
|
29
|
+
* operation was not applied; re-issue it against the new state.
|
|
30
|
+
*/
|
|
31
|
+
LayerVersionConflict: "LayerVersionConflict",
|
|
32
|
+
/**
|
|
33
|
+
* The requested operation is typed but not yet wired in this engine
|
|
34
|
+
* version. The wire shape stays valid; clients can detect this with
|
|
35
|
+
* `EngineError.is(err, EngineErrorCode.NotImplemented)` and degrade
|
|
36
|
+
* gracefully.
|
|
37
|
+
*/
|
|
38
|
+
NotImplemented: "NotImplemented",
|
|
39
|
+
/**
|
|
40
|
+
* The PDF was loadable enough for PDFium to parse, but violates a
|
|
41
|
+
* structural invariant the engine relies on. Surfaced for the rare
|
|
42
|
+
* spec-violating PDF that ships a direct (non-indirect) page
|
|
43
|
+
* dictionary in the /Pages tree — see `EPDFPage_GetObjectNumber`
|
|
44
|
+
* returning `0`. PDFium creation paths (`FPDFPage_New`,
|
|
45
|
+
* `EPDFPage_CreateAnnot`) always produce indirect objects, so this
|
|
46
|
+
* error code is intentionally not used for engine-produced state;
|
|
47
|
+
* it specifically signals "this input file is broken in a way we
|
|
48
|
+
* cannot work around without compromising stable identity".
|
|
49
|
+
*
|
|
50
|
+
* Distinct from `DocOpenFailed` (PDFium refused to load the bytes
|
|
51
|
+
* at all) and `NotFound` (a well-formed page/annotation/etc. simply
|
|
52
|
+
* doesn't exist).
|
|
53
|
+
*/
|
|
54
|
+
MalformedPdf: "MalformedPdf",
|
|
55
|
+
/**
|
|
56
|
+
* A signing candidate is parked on this session: every mutation is
|
|
57
|
+
* refused until `signatures.complete` or `signatures.cancel`.
|
|
58
|
+
*/
|
|
59
|
+
SigningPending: "SigningPending",
|
|
60
|
+
/** The candidate's TTL elapsed; prepare again. */
|
|
61
|
+
SigningExpired: "SigningExpired",
|
|
62
|
+
/**
|
|
63
|
+
* `complete` presented a version the candidate was not built on (the
|
|
64
|
+
* document or the layer moved since `prepare`). The CMS cannot be
|
|
65
|
+
* reused: it signs a digest of bytes that will never be the head.
|
|
66
|
+
* Prepare again on the current version.
|
|
67
|
+
*/
|
|
68
|
+
SigningVersionMismatch: "SigningVersionMismatch",
|
|
69
|
+
/**
|
|
70
|
+
* The engine refused to author the signature: the field is signed,
|
|
71
|
+
* read-only, or locked by an earlier signature; a certification is
|
|
72
|
+
* requested after a signature exists; the seed value requires what the
|
|
73
|
+
* engine does not implement; the request is inconsistent. The message
|
|
74
|
+
* names the reason.
|
|
75
|
+
*/
|
|
76
|
+
SignatureRefused: "SignatureRefused",
|
|
77
|
+
/**
|
|
78
|
+
* A signature already in the document forbids this change (a
|
|
79
|
+
* certification's permission, or a FieldMDP or `/Lock`; the approval
|
|
80
|
+
* baseline is judged, never refused). The message names the signature and
|
|
81
|
+
* the restriction. The
|
|
82
|
+
* engine option `signedDocumentPolicy: 'permit'` disables the guard.
|
|
83
|
+
*/
|
|
84
|
+
ProtectedDocument: "ProtectedDocument",
|
|
85
|
+
/**
|
|
86
|
+
* The layer is built on a base version that is no longer the
|
|
87
|
+
* document's head (another signing completed); it can be read and
|
|
88
|
+
* edited but not signed from.
|
|
89
|
+
*/
|
|
90
|
+
StaleBase: "StaleBase",
|
|
91
|
+
/**
|
|
92
|
+
* A payload passed one of its limits: an annotation bundle's bytes,
|
|
93
|
+
* counts or image pixels. Nothing was read past the limit and nothing was
|
|
94
|
+
* written. `details` has the `limit`, its `max` and the `value` found.
|
|
95
|
+
*/
|
|
96
|
+
PayloadTooLarge: "PayloadTooLarge",
|
|
97
|
+
/**
|
|
98
|
+
* A create named an object number it can't use. `details.objectNumber`
|
|
99
|
+
* is the number; `details.reason` is `'not-held'` when the caller's
|
|
100
|
+
* session doesn't hold it (never reserved, already spent, or lost to
|
|
101
|
+
* another session) and `'taken'` when an object is already at it. Nothing
|
|
102
|
+
* was written.
|
|
103
|
+
*/
|
|
104
|
+
ObjectNumberUnavailable: "ObjectNumberUnavailable",
|
|
105
|
+
/**
|
|
106
|
+
* The document would pass the highest object number a file should have
|
|
107
|
+
* (`OBJECT_NUMBER_CEILING`): no more numbers are handed out, and a write
|
|
108
|
+
* that needs more is refused. `details.lastObjectNumber` is the document's
|
|
109
|
+
* last number. A compacted copy of the document starts afresh.
|
|
110
|
+
*/
|
|
111
|
+
LayerFull: "LayerFull",
|
|
112
|
+
/**
|
|
113
|
+
* An op's `expect` didn't match what the document holds: the change was
|
|
114
|
+
* refused whole. `details.opIndex` names the op and `details.fields` the
|
|
115
|
+
* fields that differ.
|
|
116
|
+
*/
|
|
117
|
+
ChangeConflict: "ChangeConflict",
|
|
118
|
+
/**
|
|
119
|
+
* `{ undoOf }` named a change that can no longer be undone.
|
|
120
|
+
* `details.reason` says why: `'final-change'` (a redaction apply, flatten,
|
|
121
|
+
* signing or form repair came after it), `'base-changed'` (a new version
|
|
122
|
+
* was published since) or `'expired'` (past retention).
|
|
123
|
+
*/
|
|
124
|
+
UndoUnavailable: "UndoUnavailable",
|
|
125
|
+
/**
|
|
126
|
+
* An `opId` that already has an answer came again with a different
|
|
127
|
+
* payload. Nothing ran; a retry must send the same change.
|
|
128
|
+
*/
|
|
129
|
+
IdempotencyKeyReused: "IdempotencyKeyReused"
|
|
130
|
+
};
|
|
131
|
+
//#endregion
|
|
132
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
|
|
133
|
+
function _typeof(o) {
|
|
134
|
+
"@babel/helpers - typeof";
|
|
135
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
136
|
+
return typeof o;
|
|
137
|
+
} : function(o) {
|
|
138
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
139
|
+
}, _typeof(o);
|
|
140
|
+
}
|
|
141
|
+
//#endregion
|
|
142
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
|
|
143
|
+
function toPrimitive(t, r) {
|
|
144
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
145
|
+
var e = t[Symbol.toPrimitive];
|
|
146
|
+
if (void 0 !== e) {
|
|
147
|
+
var i = e.call(t, r || "default");
|
|
148
|
+
if ("object" != _typeof(i)) return i;
|
|
149
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
150
|
+
}
|
|
151
|
+
return ("string" === r ? String : Number)(t);
|
|
152
|
+
}
|
|
153
|
+
//#endregion
|
|
154
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
|
|
155
|
+
function toPropertyKey(t) {
|
|
156
|
+
var i = toPrimitive(t, "string");
|
|
157
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
158
|
+
}
|
|
159
|
+
//#endregion
|
|
160
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
|
|
161
|
+
function _defineProperty(e, r, t) {
|
|
162
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
163
|
+
value: t,
|
|
164
|
+
enumerable: !0,
|
|
165
|
+
configurable: !0,
|
|
166
|
+
writable: !0
|
|
167
|
+
}) : e[r] = t, e;
|
|
168
|
+
}
|
|
169
|
+
//#endregion
|
|
170
|
+
//#region src/errors/EngineError.ts
|
|
171
|
+
/**
|
|
172
|
+
* Single error class shared across engine implementations. Has a stable
|
|
173
|
+
* machine-readable `code` (see EngineErrorCode) so callers can match without
|
|
174
|
+
* sniffing message strings. Every failure the engine reports is one: the
|
|
175
|
+
* named subclasses (`PermissionDenied`, `InvalidScope`, `MissingIdentity`,
|
|
176
|
+
* `AbortError`) only preset the code and keep their name for stack traces.
|
|
177
|
+
*/
|
|
178
|
+
var EngineError = class EngineError extends Error {
|
|
179
|
+
constructor(code, message, opts = {}) {
|
|
180
|
+
super(message ?? code, opts.cause === void 0 ? void 0 : { cause: opts.cause });
|
|
181
|
+
_defineProperty(this, "name", "EngineError");
|
|
182
|
+
_defineProperty(this, "code", void 0);
|
|
183
|
+
_defineProperty(this, "details", void 0);
|
|
184
|
+
this.code = code;
|
|
185
|
+
this.details = opts.details;
|
|
186
|
+
}
|
|
187
|
+
static is(value, code) {
|
|
188
|
+
if (!(value instanceof EngineError) && value?.name !== "EngineError") return false;
|
|
189
|
+
if (code === void 0) return true;
|
|
190
|
+
return value.code === code;
|
|
191
|
+
}
|
|
192
|
+
toJSON() {
|
|
193
|
+
return {
|
|
194
|
+
name: "EngineError",
|
|
195
|
+
code: this.code,
|
|
196
|
+
message: this.message,
|
|
197
|
+
details: this.details
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
function serializeError(err) {
|
|
202
|
+
if (EngineError.is(err)) return err.toJSON();
|
|
203
|
+
if (err instanceof Error) return {
|
|
204
|
+
name: "EngineError",
|
|
205
|
+
code: err.name === "AbortError" ? EngineErrorCode.Aborted : EngineErrorCode.Unknown,
|
|
206
|
+
message: err.message
|
|
207
|
+
};
|
|
208
|
+
return {
|
|
209
|
+
name: "EngineError",
|
|
210
|
+
code: EngineErrorCode.Unknown,
|
|
211
|
+
message: String(err ?? "unknown error")
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
function deserializeError(payload) {
|
|
215
|
+
return new EngineError(payload.code, payload.message, { details: payload.details });
|
|
216
|
+
}
|
|
217
|
+
//#endregion
|
|
218
|
+
//#region src/identity/annotationKey.ts
|
|
219
|
+
/**
|
|
220
|
+
* The string key for an annotation address — for maps, sets and React keys.
|
|
221
|
+
* A ref is an object, and JavaScript keys objects by identity, so two refs
|
|
222
|
+
* that name the same annotation need one canonical value form; this is it.
|
|
223
|
+
* The ref stays the thing you pass to the engine; this is only how you index.
|
|
224
|
+
*
|
|
225
|
+
* The page appears exactly where it carries information:
|
|
226
|
+
*
|
|
227
|
+
* objectNumber → `obj:42` an indirect object number is unique
|
|
228
|
+
* across the whole document
|
|
229
|
+
* baseIndex → `base:<page>:<i>` a position in one page's /Annots
|
|
230
|
+
*
|
|
231
|
+
* This agrees with the wire: `obj:42` is the route's `:annotKey`
|
|
232
|
+
* (`encodeAnnotKey`), and a `base` key is the route's `:pageKey` +
|
|
233
|
+
* `:annotKey` folded into one string, because a client-side map has no path
|
|
234
|
+
* segment to keep the page in.
|
|
235
|
+
*/
|
|
236
|
+
function annotationKey(ref) {
|
|
237
|
+
switch (ref.kind) {
|
|
238
|
+
case "objectNumber": return `obj:${ref.objectNumber}`;
|
|
239
|
+
case "baseIndex": return `base:${ref.page.objectNumber}:${ref.baseIndex}`;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
//#endregion
|
|
243
|
+
//#region src/identity/PageObjectNumber.ts
|
|
244
|
+
/**
|
|
245
|
+
* Type guard for the rare malformed-PDF case where a page is a direct
|
|
246
|
+
* object. The engine treats `0` as malformed and throws `EngineError(NotFound)`
|
|
247
|
+
* before any page-level operation.
|
|
248
|
+
*/
|
|
249
|
+
function isValidPageObjectNumber(value) {
|
|
250
|
+
return typeof value === "number" && Number.isInteger(value) && value > 0;
|
|
251
|
+
}
|
|
252
|
+
//#endregion
|
|
253
|
+
//#region src/identity/PageRef.ts
|
|
254
|
+
/** Build the address for a page from its object number. */
|
|
255
|
+
function toPageRef(pageObjectNumber) {
|
|
256
|
+
return {
|
|
257
|
+
kind: "objectNumber",
|
|
258
|
+
objectNumber: pageObjectNumber
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
/** Structural equality for two page addresses. */
|
|
262
|
+
function pageRefsEqual(a, b) {
|
|
263
|
+
return a.kind === b.kind && a.objectNumber === b.objectNumber;
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* URL-safe encoding of a `PageRef`, used by the cloud HTTP surface as the
|
|
267
|
+
* `:pageKey` route parameter. Mirrors `encodeAnnotKey` (`obj:42` /
|
|
268
|
+
* `base:2`) and `encodeFieldRefKey` (`obj:12` / `fqn:…`), so every identity
|
|
269
|
+
* reads the same on the wire:
|
|
270
|
+
*
|
|
271
|
+
* `{ kind: 'objectNumber', objectNumber: 3 }` -> `'obj:3'`
|
|
272
|
+
*
|
|
273
|
+
* The caller is responsible for `encodeURIComponent`-ing the result before
|
|
274
|
+
* splicing it into a URL path; the `wirePaths` builders already do that.
|
|
275
|
+
*/
|
|
276
|
+
function encodePageKey(ref) {
|
|
277
|
+
if (!isValidPageObjectNumber(ref.objectNumber)) throw new RangeError(`encodePageKey: objectNumber must be a positive integer, got ${ref.objectNumber}`);
|
|
278
|
+
return `obj:${ref.objectNumber}`;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Inverse of `encodePageKey`. Returns `null` for malformed input so the
|
|
282
|
+
* server can answer 400 InvalidArg with a useful message instead of
|
|
283
|
+
* throwing. The input is the already-`decodeURIComponent`-ed segment from
|
|
284
|
+
* the route path.
|
|
285
|
+
*/
|
|
286
|
+
function decodePageKey(key) {
|
|
287
|
+
if (!key.startsWith("obj:")) return null;
|
|
288
|
+
const rest = key.slice(4);
|
|
289
|
+
const n = Number.parseInt(rest, 10);
|
|
290
|
+
if (!Number.isInteger(n) || n <= 0 || String(n) !== rest) return null;
|
|
291
|
+
return {
|
|
292
|
+
kind: "objectNumber",
|
|
293
|
+
objectNumber: n
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
//#endregion
|
|
297
|
+
//#region src/annotation/primitives.ts
|
|
298
|
+
/**
|
|
299
|
+
* The 14 standard PDF fonts a free-text annotation's `/DA` can name. We use
|
|
300
|
+
* kebab-case so the wire format is stable across language ports; the engine
|
|
301
|
+
* maps these onto PDFium's `FPDF_STANDARD_FONT` integer codes at write time.
|
|
302
|
+
*/
|
|
303
|
+
const STANDARD_FONTS = [
|
|
304
|
+
"courier",
|
|
305
|
+
"courier-bold",
|
|
306
|
+
"courier-bold-oblique",
|
|
307
|
+
"courier-oblique",
|
|
308
|
+
"helvetica",
|
|
309
|
+
"helvetica-bold",
|
|
310
|
+
"helvetica-bold-oblique",
|
|
311
|
+
"helvetica-oblique",
|
|
312
|
+
"times-roman",
|
|
313
|
+
"times-bold",
|
|
314
|
+
"times-bold-italic",
|
|
315
|
+
"times-italic",
|
|
316
|
+
"symbol",
|
|
317
|
+
"zapf-dingbats"
|
|
318
|
+
];
|
|
319
|
+
const NO_ANNOTATION_FLAGS = {
|
|
320
|
+
invisible: false,
|
|
321
|
+
hidden: false,
|
|
322
|
+
print: false,
|
|
323
|
+
noZoom: false,
|
|
324
|
+
noRotate: false,
|
|
325
|
+
noView: false,
|
|
326
|
+
readOnly: false,
|
|
327
|
+
locked: false,
|
|
328
|
+
toggleNoView: false,
|
|
329
|
+
lockedContents: false
|
|
330
|
+
};
|
|
331
|
+
//#endregion
|
|
332
|
+
//#region src/identity/FormFieldRef.ts
|
|
333
|
+
/** A ref to a field by its full name (`'billing.name'`), for a name you already know. */
|
|
334
|
+
function toFieldRef(name) {
|
|
335
|
+
return {
|
|
336
|
+
kind: "fqn",
|
|
337
|
+
name
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* URL-safe encoding of a `FormFieldRef`, used by the cloud HTTP surface as
|
|
342
|
+
* the `:fieldKey` route parameter. Decoded by the server back into a
|
|
343
|
+
* `FormFieldRef` via `decodeFieldRefKey`. Mirrors the annotation plane's
|
|
344
|
+
* `encodeAnnotKey` (`obj:42` / `base:2`) so the two member-key syntaxes
|
|
345
|
+
* read the same on the wire:
|
|
346
|
+
*
|
|
347
|
+
* `{ kind: 'objectNumber', objectNumber: 12 }` -> `'obj:12'`
|
|
348
|
+
* `{ kind: 'fqn', name: 'billing.name' }` -> `'fqn:billing.name'`
|
|
349
|
+
*
|
|
350
|
+
* The caller is responsible for `encodeURIComponent`-ing the result before
|
|
351
|
+
* splicing it into a URL path; the `wirePaths.layerFormField*` builders
|
|
352
|
+
* already do that. FQNs are opaque strings and may contain anything; the
|
|
353
|
+
* `fqn:` prefix keeps them unambiguous from numeric ids.
|
|
354
|
+
*/
|
|
355
|
+
function encodeFieldRefKey(ref) {
|
|
356
|
+
if (ref.kind === "objectNumber") {
|
|
357
|
+
if (!Number.isInteger(ref.objectNumber) || ref.objectNumber <= 0) throw new RangeError(`encodeFieldRefKey: objectNumber must be a positive integer, got ${ref.objectNumber}`);
|
|
358
|
+
return `obj:${ref.objectNumber}`;
|
|
359
|
+
}
|
|
360
|
+
return `fqn:${ref.name}`;
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Inverse of `encodeFieldRefKey`. Returns `null` for malformed input so the
|
|
364
|
+
* server can answer 400 InvalidArg with a useful message instead of
|
|
365
|
+
* throwing. The input is the already-`decodeURIComponent`-ed segment from
|
|
366
|
+
* the route path. Empty FQNs are rejected: `fqn:` with no suffix is not a
|
|
367
|
+
* valid identity.
|
|
368
|
+
*/
|
|
369
|
+
function decodeFieldRefKey(key) {
|
|
370
|
+
if (key.startsWith("obj:")) {
|
|
371
|
+
const rest = key.slice(4);
|
|
372
|
+
const n = Number.parseInt(rest, 10);
|
|
373
|
+
if (!Number.isInteger(n) || n <= 0 || String(n) !== rest) return null;
|
|
374
|
+
return {
|
|
375
|
+
kind: "objectNumber",
|
|
376
|
+
objectNumber: n
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
if (key.startsWith("fqn:")) {
|
|
380
|
+
const name = key.slice(4);
|
|
381
|
+
if (name.length === 0) return null;
|
|
382
|
+
return {
|
|
383
|
+
kind: "fqn",
|
|
384
|
+
name
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
return null;
|
|
388
|
+
}
|
|
389
|
+
/** The one place a widget record is built: computes `ref` from the raw facts. */
|
|
390
|
+
function formWidget(objectNumber, page) {
|
|
391
|
+
return {
|
|
392
|
+
ref: objectNumber > 0 && page ? {
|
|
393
|
+
kind: "objectNumber",
|
|
394
|
+
page,
|
|
395
|
+
objectNumber
|
|
396
|
+
} : null,
|
|
397
|
+
objectNumber,
|
|
398
|
+
page
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
//#endregion
|
|
402
|
+
//#region src/measure/format.ts
|
|
403
|
+
const group = (value, separator) => value.replace(/\B(?=(\d{3})+(?!\d))/g, () => separator);
|
|
404
|
+
const gcd = (a, b) => b ? gcd(b, a % b) : a;
|
|
405
|
+
function validNumberFormat(nf) {
|
|
406
|
+
const c = Math.fround(nf.conversion ?? NaN);
|
|
407
|
+
if (!Number.isFinite(c) || c <= 0) return false;
|
|
408
|
+
const d = nf.precision ?? (nf.fraction === "fraction" ? 16 : 100);
|
|
409
|
+
if (!Number.isInteger(d) || d < 1 || d > 2147483647) return false;
|
|
410
|
+
if ((nf.fraction ?? "decimal") === "decimal" && !Number.isInteger(Math.log10(d))) return false;
|
|
411
|
+
return true;
|
|
412
|
+
}
|
|
413
|
+
function last(value, nf) {
|
|
414
|
+
const mode = nf.fraction ?? "decimal";
|
|
415
|
+
const sep = nf.thousands ?? ",";
|
|
416
|
+
if (mode === "round") return group(String(Math.round(value)), sep);
|
|
417
|
+
if (mode === "truncate") return group(String(Math.trunc(value)), sep);
|
|
418
|
+
if (mode === "fraction") {
|
|
419
|
+
const denominator = nf.precision ?? 16;
|
|
420
|
+
let whole = Math.floor(value);
|
|
421
|
+
let numerator = Math.round((value - whole) * denominator);
|
|
422
|
+
if (numerator === denominator) {
|
|
423
|
+
whole++;
|
|
424
|
+
numerator = 0;
|
|
425
|
+
}
|
|
426
|
+
if (!numerator) return group(String(whole), sep);
|
|
427
|
+
const divisor = nf.fixed ? 1 : gcd(numerator, denominator);
|
|
428
|
+
return `${whole ? `${group(String(whole), sep)} ` : ""}${numerator / divisor}/${denominator / divisor}`;
|
|
429
|
+
}
|
|
430
|
+
const digits = Math.log10(nf.precision ?? 100);
|
|
431
|
+
const [integer, decimal = ""] = value.toFixed(digits).split(".");
|
|
432
|
+
return group(integer, sep) + (decimal ? (nf.decimal || ".") + decimal : "");
|
|
433
|
+
}
|
|
434
|
+
/** ISO 32000-2 §12.9.2 cascade. PDF float conversions are normalized before use.
|
|
435
|
+
* Unit text and explicit spacing are preserved, including trailing unit spaces. */
|
|
436
|
+
function formatMeasurement(value, formats) {
|
|
437
|
+
if (!Number.isFinite(value) || !formats.length || !formats.every(validNumberFormat)) throw new EngineError(EngineErrorCode.InvalidArg, "Measurement requires a finite value and valid number formats");
|
|
438
|
+
let remainder = Math.abs(value);
|
|
439
|
+
const parts = [];
|
|
440
|
+
for (const [index, nf] of formats.entries()) {
|
|
441
|
+
remainder *= Math.fround(nf.conversion);
|
|
442
|
+
if (!Number.isFinite(remainder)) throw new EngineError(EngineErrorCode.InvalidArg, "Measurement overflow");
|
|
443
|
+
const whole = Math.floor(remainder);
|
|
444
|
+
const fraction = remainder - whole;
|
|
445
|
+
const final = index === formats.length - 1;
|
|
446
|
+
const terminal = final || fraction === 0;
|
|
447
|
+
const number = final ? last(remainder, nf) : group(String(whole), nf.thousands ?? ",");
|
|
448
|
+
const prefix = nf.labelPosition === "prefix";
|
|
449
|
+
const ps = nf.prefixSpacing ?? (prefix && index === 0 ? "" : " ");
|
|
450
|
+
const ss = nf.suffixSpacing ?? (!prefix && terminal ? "" : " ");
|
|
451
|
+
const label = ps + nf.unit + ss;
|
|
452
|
+
parts.push(prefix ? label + number : number + label);
|
|
453
|
+
if (terminal) break;
|
|
454
|
+
remainder = fraction;
|
|
455
|
+
}
|
|
456
|
+
return (value < 0 ? "-" : "") + parts.join("");
|
|
457
|
+
}
|
|
458
|
+
//#endregion
|
|
459
|
+
export { serializeError as _, formWidget as a, STANDARD_FONTS as c, pageRefsEqual as d, toPageRef as f, deserializeError as g, EngineError as h, encodeFieldRefKey as i, decodePageKey as l, annotationKey as m, validNumberFormat as n, toFieldRef as o, isValidPageObjectNumber as p, decodeFieldRefKey as r, NO_ANNOTATION_FLAGS as s, formatMeasurement as t, encodePageKey as u, _defineProperty as v, EngineErrorCode as y };
|
|
460
|
+
|
|
461
|
+
//# sourceMappingURL=format-Dgg428Kb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-Dgg428Kb.js","names":[],"sources":["../src/errors/EngineErrorCode.ts","../src/errors/EngineError.ts","../src/identity/annotationKey.ts","../src/identity/PageObjectNumber.ts","../src/identity/PageRef.ts","../src/annotation/primitives.ts","../src/identity/FormFieldRef.ts","../src/measure/format.ts"],"sourcesContent":["export const EngineErrorCode = {\n Unknown: 'Unknown',\n InvalidArg: 'InvalidArg',\n DocNotOpen: 'DocNotOpen',\n DocOpenFailed: 'DocOpenFailed',\n DocPasswordRequired: 'DocPasswordRequired',\n DocPasswordIncorrect: 'DocPasswordIncorrect',\n /**\n * A share-token exchange (`open({ kind: 'share' })`) needs the grant's\n * passphrase: none was supplied, or the supplied one was rejected —\n * indistinguishable by design, mirroring the server. Prompt and retry\n * with `sharePassword`. Distinct from `DocPasswordRequired`, which is\n * about the PDF's own encryption password.\n */\n SharePasswordRequired: 'SharePasswordRequired',\n Aborted: 'Aborted',\n Network: 'Network',\n Unauthenticated: 'Unauthenticated',\n Forbidden: 'Forbidden',\n NotFound: 'NotFound',\n WireFormat: 'WireFormat',\n RuntimeUnavailable: 'RuntimeUnavailable',\n /**\n * A layer write lost its optimistic-concurrency check: the layer's\n * durable version advanced (another writer — typically another server\n * replica — committed) between the operation's prepare and its commit,\n * and the server exhausted its rebase-and-retry budget. Retryable: the\n * operation was not applied; re-issue it against the new state.\n */\n LayerVersionConflict: 'LayerVersionConflict',\n /**\n * The requested operation is typed but not yet wired in this engine\n * version. The wire shape stays valid; clients can detect this with\n * `EngineError.is(err, EngineErrorCode.NotImplemented)` and degrade\n * gracefully.\n */\n NotImplemented: 'NotImplemented',\n /**\n * The PDF was loadable enough for PDFium to parse, but violates a\n * structural invariant the engine relies on. Surfaced for the rare\n * spec-violating PDF that ships a direct (non-indirect) page\n * dictionary in the /Pages tree — see `EPDFPage_GetObjectNumber`\n * returning `0`. PDFium creation paths (`FPDFPage_New`,\n * `EPDFPage_CreateAnnot`) always produce indirect objects, so this\n * error code is intentionally not used for engine-produced state;\n * it specifically signals \"this input file is broken in a way we\n * cannot work around without compromising stable identity\".\n *\n * Distinct from `DocOpenFailed` (PDFium refused to load the bytes\n * at all) and `NotFound` (a well-formed page/annotation/etc. simply\n * doesn't exist).\n */\n MalformedPdf: 'MalformedPdf',\n /**\n * A signing candidate is parked on this session: every mutation is\n * refused until `signatures.complete` or `signatures.cancel`.\n */\n SigningPending: 'SigningPending',\n /** The candidate's TTL elapsed; prepare again. */\n SigningExpired: 'SigningExpired',\n /**\n * `complete` presented a version the candidate was not built on (the\n * document or the layer moved since `prepare`). The CMS cannot be\n * reused: it signs a digest of bytes that will never be the head.\n * Prepare again on the current version.\n */\n SigningVersionMismatch: 'SigningVersionMismatch',\n /**\n * The engine refused to author the signature: the field is signed,\n * read-only, or locked by an earlier signature; a certification is\n * requested after a signature exists; the seed value requires what the\n * engine does not implement; the request is inconsistent. The message\n * names the reason.\n */\n SignatureRefused: 'SignatureRefused',\n /**\n * A signature already in the document forbids this change (a\n * certification's permission, or a FieldMDP or `/Lock`; the approval\n * baseline is judged, never refused). The message names the signature and\n * the restriction. The\n * engine option `signedDocumentPolicy: 'permit'` disables the guard.\n */\n ProtectedDocument: 'ProtectedDocument',\n /**\n * The layer is built on a base version that is no longer the\n * document's head (another signing completed); it can be read and\n * edited but not signed from.\n */\n StaleBase: 'StaleBase',\n /**\n * A payload passed one of its limits: an annotation bundle's bytes,\n * counts or image pixels. Nothing was read past the limit and nothing was\n * written. `details` has the `limit`, its `max` and the `value` found.\n */\n PayloadTooLarge: 'PayloadTooLarge',\n /**\n * A create named an object number it can't use. `details.objectNumber`\n * is the number; `details.reason` is `'not-held'` when the caller's\n * session doesn't hold it (never reserved, already spent, or lost to\n * another session) and `'taken'` when an object is already at it. Nothing\n * was written.\n */\n ObjectNumberUnavailable: 'ObjectNumberUnavailable',\n /**\n * The document would pass the highest object number a file should have\n * (`OBJECT_NUMBER_CEILING`): no more numbers are handed out, and a write\n * that needs more is refused. `details.lastObjectNumber` is the document's\n * last number. A compacted copy of the document starts afresh.\n */\n LayerFull: 'LayerFull',\n /**\n * An op's `expect` didn't match what the document holds: the change was\n * refused whole. `details.opIndex` names the op and `details.fields` the\n * fields that differ.\n */\n ChangeConflict: 'ChangeConflict',\n /**\n * `{ undoOf }` named a change that can no longer be undone.\n * `details.reason` says why: `'final-change'` (a redaction apply, flatten,\n * signing or form repair came after it), `'base-changed'` (a new version\n * was published since) or `'expired'` (past retention).\n */\n UndoUnavailable: 'UndoUnavailable',\n /**\n * An `opId` that already has an answer came again with a different\n * payload. Nothing ran; a retry must send the same change.\n */\n IdempotencyKeyReused: 'IdempotencyKeyReused',\n} as const;\n\nexport type EngineErrorCode = (typeof EngineErrorCode)[keyof typeof EngineErrorCode];\n","import { EngineErrorCode } from './EngineErrorCode';\n\nexport interface EngineErrorOptions {\n cause?: unknown;\n details?: Record<string, unknown>;\n}\n\n/**\n * Single error class shared across engine implementations. Has a stable\n * machine-readable `code` (see EngineErrorCode) so callers can match without\n * sniffing message strings. Every failure the engine reports is one: the\n * named subclasses (`PermissionDenied`, `InvalidScope`, `MissingIdentity`,\n * `AbortError`) only preset the code and keep their name for stack traces.\n */\nexport class EngineError extends Error {\n override readonly name: string = 'EngineError';\n readonly code: EngineErrorCode;\n readonly details?: Record<string, unknown>;\n\n constructor(code: EngineErrorCode, message?: string, opts: EngineErrorOptions = {}) {\n super(message ?? code, opts.cause === undefined ? undefined : { cause: opts.cause });\n this.code = code;\n this.details = opts.details;\n }\n\n static is(value: unknown, code?: EngineErrorCode): value is EngineError {\n if (\n !(value instanceof EngineError) &&\n (value as { name?: string } | null)?.name !== 'EngineError'\n ) {\n return false;\n }\n if (code === undefined) return true;\n return (value as EngineError).code === code;\n }\n\n toJSON(): {\n name: 'EngineError';\n code: EngineErrorCode;\n message: string;\n details?: Record<string, unknown>;\n } {\n return {\n name: 'EngineError',\n code: this.code,\n message: this.message,\n details: this.details,\n };\n }\n}\n\nexport interface SerializedEngineError {\n name: 'EngineError';\n code: EngineErrorCode;\n message: string;\n details?: Record<string, unknown>;\n}\n\nexport function serializeError(err: unknown): SerializedEngineError {\n if (EngineError.is(err)) {\n return err.toJSON();\n }\n if (err instanceof Error) {\n const code: EngineErrorCode =\n err.name === 'AbortError' ? EngineErrorCode.Aborted : EngineErrorCode.Unknown;\n return { name: 'EngineError', code, message: err.message };\n }\n return {\n name: 'EngineError',\n code: EngineErrorCode.Unknown,\n message: String(err ?? 'unknown error'),\n };\n}\n\nexport function deserializeError(payload: SerializedEngineError): EngineError {\n return new EngineError(payload.code, payload.message, { details: payload.details });\n}\n","import type { AnnotationRef } from './AnnotationRef';\n\n/**\n * The string key for an annotation address — for maps, sets and React keys.\n * A ref is an object, and JavaScript keys objects by identity, so two refs\n * that name the same annotation need one canonical value form; this is it.\n * The ref stays the thing you pass to the engine; this is only how you index.\n *\n * The page appears exactly where it carries information:\n *\n * objectNumber → `obj:42` an indirect object number is unique\n * across the whole document\n * baseIndex → `base:<page>:<i>` a position in one page's /Annots\n *\n * This agrees with the wire: `obj:42` is the route's `:annotKey`\n * (`encodeAnnotKey`), and a `base` key is the route's `:pageKey` +\n * `:annotKey` folded into one string, because a client-side map has no path\n * segment to keep the page in.\n */\nexport function annotationKey(ref: AnnotationRef): string {\n switch (ref.kind) {\n case 'objectNumber':\n return `obj:${ref.objectNumber}`;\n case 'baseIndex':\n return `base:${ref.page.objectNumber}:${ref.baseIndex}`;\n }\n}\n","/**\n * PDF indirect object number for a page.\n *\n * Resolved via the PDFium runtime helper `EPDFPage_GetObjectNumber(pagePtr)`.\n * Always > 0 for well-formed PDFs, and the primary addressing key. The\n * page index is kept on `PageHandle` as display\n * metadata only, because it can shift when pages are inserted, deleted, or\n * reordered while a session is open.\n */\nexport type PageObjectNumber = number;\n\n/**\n * Type guard for the rare malformed-PDF case where a page is a direct\n * object. The engine treats `0` as malformed and throws `EngineError(NotFound)`\n * before any page-level operation.\n */\nexport function isValidPageObjectNumber(value: unknown): value is PageObjectNumber {\n return typeof value === 'number' && Number.isInteger(value) && value > 0;\n}\n","import type { PageObjectNumber } from './PageObjectNumber';\nimport { isValidPageObjectNumber } from './PageObjectNumber';\n\n/**\n * How callers address a page — the page-plane sibling of `AnnotationRef`\n * and `FormFieldRef`.\n *\n * `objectNumber` is the indirect object number of the page dictionary.\n * ISO 32000-1 §7.7.3.3 requires every `/Kids` entry to be an indirect\n * reference, the layer runtime never renumbers (frozen base + incremental\n * deltas), and a deleted page's number is retired, never recycled — so it\n * is the durable identity for the lifetime of a document. It is what every\n * `PageLayout.ref` and `PageHandle.ref` carries.\n *\n * It is deliberately the only kind. Pages are durable by construction (see\n * `PagesMutator`): a display index is never an identity, a page without an\n * object number is refused at open (`MalformedPdf`), and a `/Names /Pages`\n * key is a registry entry the layout already maps to a number, not a second\n * identity the engine would ever return. The discriminated shape keeps the\n * address consistent with the other refs and leaves room for an additive\n * kind should a real one ever appear.\n *\n * Records that mention a page (an annotation ref, event payloads, per-page\n * results, destinations, search matches) carry the same `page: PageRef`;\n * `toPageRef()` builds one from a page number you already hold.\n */\nexport type PageRef = { kind: 'objectNumber'; objectNumber: PageObjectNumber };\n\n/** Build the address for a page from its object number. */\nexport function toPageRef(pageObjectNumber: PageObjectNumber): PageRef {\n return { kind: 'objectNumber', objectNumber: pageObjectNumber };\n}\n\n/** Structural equality for two page addresses. */\nexport function pageRefsEqual(a: PageRef, b: PageRef): boolean {\n return a.kind === b.kind && a.objectNumber === b.objectNumber;\n}\n\n/**\n * URL-safe encoding of a `PageRef`, used by the cloud HTTP surface as the\n * `:pageKey` route parameter. Mirrors `encodeAnnotKey` (`obj:42` /\n * `base:2`) and `encodeFieldRefKey` (`obj:12` / `fqn:…`), so every identity\n * reads the same on the wire:\n *\n * `{ kind: 'objectNumber', objectNumber: 3 }` -> `'obj:3'`\n *\n * The caller is responsible for `encodeURIComponent`-ing the result before\n * splicing it into a URL path; the `wirePaths` builders already do that.\n */\nexport function encodePageKey(ref: PageRef): string {\n if (!isValidPageObjectNumber(ref.objectNumber)) {\n throw new RangeError(\n `encodePageKey: objectNumber must be a positive integer, got ${ref.objectNumber}`,\n );\n }\n return `obj:${ref.objectNumber}`;\n}\n\n/**\n * Inverse of `encodePageKey`. Returns `null` for malformed input so the\n * server can answer 400 InvalidArg with a useful message instead of\n * throwing. The input is the already-`decodeURIComponent`-ed segment from\n * the route path.\n */\nexport function decodePageKey(key: string): PageRef | null {\n if (!key.startsWith('obj:')) return null;\n const rest = key.slice('obj:'.length);\n const n = Number.parseInt(rest, 10);\n if (!Number.isInteger(n) || n <= 0 || String(n) !== rest) return null;\n return { kind: 'objectNumber', objectNumber: n };\n}\n","/**\n * Wire-stable annotation primitives that are not pure geometry.\n *\n * Geometry primitives (points, rects, sizes, quads, rotation) now live in\n * `../geometry` as the canonical `Pdf*` vocabulary. The aliases below are\n * transitional re-exports kept only so existing consumers keep compiling\n * during the geometry consolidation; new code should import `Pdf*` directly\n * from `../geometry`.\n *\n * These do not depend on PDFium or any browser/Node surface; they are\n * the lingua franca between local engine, cloud engine, and server.\n */\n\nimport type { PdfPoint, PdfRect, PdfRotation, PdfSize } from '../geometry/primitives';\n\n/** @deprecated Use `PdfPoint` from `../geometry`. */\nexport type Point = PdfPoint;\n/** @deprecated Use `PdfRect` from `../geometry`. */\nexport type Rect = PdfRect;\n/** @deprecated Use `PdfSize` from `../geometry`. */\nexport type Size = PdfSize;\n/** @deprecated Use `PdfRotation` from `../geometry`. */\nexport type Rotation = PdfRotation;\n\n/**\n * An sRGB color as `'#rrggbb'`: lowercase when the engine gives one, either\n * case when it takes one. A gray or CMYK color in the file reads as its sRGB\n * equivalent, and sent back unchanged it stays as the file has it.\n *\n * A color carries no alpha: transparency is the separate `opacity` field\n * (`/CA`), so there is one source of truth for it.\n */\nexport type Color = string;\n\n/**\n * /LE entries (line endings). Maps PDFium FPDFAnnot_GetLineEndings codes\n * onto the spec names. We use kebab-case so the wire format is stable\n * across language ports.\n */\nexport type LineEnding =\n | 'none'\n | 'square'\n | 'circle'\n | 'diamond'\n | 'open-arrow'\n | 'closed-arrow'\n | 'butt'\n | 'r-open-arrow'\n | 'r-closed-arrow'\n | 'slash';\n\n/**\n * The `/LE` pair carried by line and polyline annotations: the ending\n * drawn at the start point and the ending drawn at the end point.\n */\nexport interface LineEndings {\n start: LineEnding;\n end: LineEnding;\n}\n\n/**\n * The 14 standard PDF fonts a free-text annotation's `/DA` can name. We use\n * kebab-case so the wire format is stable across language ports; the engine\n * maps these onto PDFium's `FPDF_STANDARD_FONT` integer codes at write time.\n */\nexport const STANDARD_FONTS = [\n 'courier',\n 'courier-bold',\n 'courier-bold-oblique',\n 'courier-oblique',\n 'helvetica',\n 'helvetica-bold',\n 'helvetica-bold-oblique',\n 'helvetica-oblique',\n 'times-roman',\n 'times-bold',\n 'times-bold-italic',\n 'times-italic',\n 'symbol',\n 'zapf-dingbats',\n] as const;\n\nexport type StandardFont = (typeof STANDARD_FONTS)[number];\n\n/**\n * Font selector for a free-text annotation: either one of the 14 PDF\n * {@link StandardFont} names, or the `key` of a font registered through\n * `engine.fonts` (local/WASM engine only).\n *\n * The `(string & {})` arm keeps the standard-font literals auto-completing\n * while still accepting any registered key. Because the standard names are\n * matched first at write time, those 14 names are reserved: don't register a\n * custom font under a key like `'helvetica'`.\n */\nexport type FreeTextFont = StandardFont | (string & {});\n\n/**\n * Horizontal text alignment (`/Q`) for free-text annotations. Maps onto the\n * ISO 32000 §12.7.3.3 quadding codes 0/1/2 at write time.\n */\nexport type TextAlignment = 'left' | 'center' | 'right';\n\n/**\n * Free-text `/IT` intent. `free-text` is a plain text box; `free-text-callout`\n * adds a `/CL` leader line pointing at the called-out region;\n * `free-text-typewriter` is a typewriter box another app made, read and kept\n * but not created.\n */\nexport type FreeTextIntent = 'free-text' | 'free-text-callout' | 'free-text-typewriter';\n\n/** Where a free text's lines sit in its box, top to bottom. */\nexport type VerticalAlignment = 'top' | 'middle' | 'bottom';\n\n/** Caret `/IT` intent used by an Acrobat-compatible replace-text edit. */\nexport type CaretIntent = 'replace';\n\n/** Strikeout `/IT` intent used by the subordinate part of a replace-text edit. */\nexport type StrikeoutIntent = 'strikeout-text-edit';\n\n/** Ink `/IT` intent used by an Acrobat-compatible freehand highlighter. */\nexport type InkIntent = 'ink-highlight';\n\n/**\n * Effective blend mode of an annotation's normal appearance stream (`/AP /N`).\n * Values use CSS-compatible kebab-case so the wire vocabulary is portable; the\n * engine maps them onto PDFium's `FPDF_BLENDMODE` integer codes.\n */\nexport type BlendMode =\n | 'normal'\n | 'multiply'\n | 'screen'\n | 'overlay'\n | 'darken'\n | 'lighten'\n | 'color-dodge'\n | 'color-burn'\n | 'hard-light'\n | 'soft-light'\n | 'difference'\n | 'exclusion'\n | 'hue'\n | 'saturation'\n | 'color'\n | 'luminosity';\n\n/**\n * Border/line style for shape annotations — the `/BS /S` (border style)\n * subset PDFium can author. Maps onto the ISO 32000 §8.4.3.3 border style\n * names. Cloudy borders are a separate concern (`/BE` border effect),\n * surfaced as `cloudyIntensity` on the shape DTO, not as a border style.\n *\n * kebab-/lower-case so the wire format is stable across language ports;\n * the engine maps these onto PDFium's integer codes at write time.\n */\nexport type AnnotationBorderStyle = 'solid' | 'dashed' | 'beveled' | 'inset';\n\n/**\n * A form widget's border (`/BS /S`): the four annotation styles, and\n * `underline`, a line along the bottom only, which only a widget draws.\n */\nexport type WidgetBorderStyle = AnnotationBorderStyle | 'underline';\n\n/**\n * A symbol a checkbox or radio button shows while it's on (`/MK /CA`, a\n * ZapfDingbats character). Without one, a checkbox shows a check and a radio\n * button a circle.\n */\nexport type WidgetCheckStyle = 'check' | 'cross' | 'star' | 'circle' | 'square' | 'diamond';\n\n/** The border styles an annotation other than a widget draws: `beveled` and `inset` are read, not written. */\nexport type DrawnBorderStyle = Extract<AnnotationBorderStyle, 'solid' | 'dashed'>;\n\n/**\n * The `/RT` (reply type) relationship an annotation declares toward the\n * annotation its `/IRT` points at (ISO 32000 §12.5.6.2). Wire-stable\n * kebab/lower-case strings; the engine maps these onto PDFium's\n * `FPDF_ANNOT_REPLY_TYPE` integer codes at read/write time.\n *\n * 'reply' -> `/R` a comment-thread reply (the ISO default when\n * `/IRT` is present but `/RT` is absent).\n * 'group' -> `/Group` a subordinate part of one logical annotation\n * group (e.g. the StrikeOut of a replace-text pair,\n * grouped under its Caret).\n */\nexport type AnnotationReplyType = 'reply' | 'group';\n\n/** The two ISO 32000 §12.5.6.3 standard state models (Table 174). */\nexport type KnownAnnotationStateModel = 'review' | 'marked';\n\n/**\n * The `/StateModel` of an annotation-state text annotation —\n * ISO 32000 §12.5.6.3. The standard models are `'review'` and `'marked'`, but the\n * PDF stores the entry as a free text string and Acrobat supports\n * registering custom state models, so the type stays open. The\n * `(string & {})` arm keeps the standard literals auto-completing while\n * accepting any custom model (the {@link FreeTextFont} pattern).\n *\n * Known values are wire-stable lowercase; the engine maps them onto the\n * capitalized PDF spellings (`Review`, `Marked`) at read/write time.\n * Unknown values round-trip verbatim in both directions.\n */\nexport type AnnotationStateModel = KnownAnnotationStateModel | (string & {});\n\n/** The ISO 32000 §12.5.6.3 standard states (Table 174). */\nexport type KnownAnnotationState =\n | 'accepted'\n | 'rejected'\n | 'cancelled'\n | 'completed'\n | 'none'\n | 'marked'\n | 'unmarked';\n\n/**\n * The `/State` an annotation-state text annotation sets —\n * ISO 32000 §12.5.6.3. `'accepted' | 'rejected' | 'cancelled' | 'completed' |\n * 'none'` belong to the `'review'` model; `'marked' | 'unmarked'` to the\n * `'marked'` model. Open for the same reason as\n * {@link AnnotationStateModel}: custom models bring custom states.\n *\n * States are per user and live on separate text annotations replying\n * (`/IRT`) to their target — never on the target itself. The `/T` of the\n * state annotation names who set it; later changes by the same user\n * chain as replies to their previous state annotation, latest wins.\n */\nexport type AnnotationState = KnownAnnotationState | (string & {});\n\n/**\n * Bitset wrapper for the `/F` (Annotation Flags) PDF entry. We expose each\n * bit as its own boolean so callers don't have to know the bit positions.\n */\nexport interface AnnotationFlags {\n invisible: boolean;\n hidden: boolean;\n print: boolean;\n noZoom: boolean;\n noRotate: boolean;\n noView: boolean;\n readOnly: boolean;\n locked: boolean;\n toggleNoView: boolean;\n lockedContents: boolean;\n}\n\nexport const NO_ANNOTATION_FLAGS: AnnotationFlags = {\n invisible: false,\n hidden: false,\n print: false,\n noZoom: false,\n noRotate: false,\n noView: false,\n readOnly: false,\n locked: false,\n toggleNoView: false,\n lockedContents: false,\n};\n","import type { PageRef } from './PageRef';\nimport type { AnnotationRef } from './AnnotationRef';\n\n/**\n * How callers address a logical form field.\n *\n * - `objectNumber` — the indirect object number of the field dictionary.\n * ISO 32000 guarantees every real AcroForm field dictionary is an\n * indirect object, and the layer runtime never renumbers (frozen base +\n * incremental deltas), so this is the durable identity for the lifetime\n * of a document. Preferred for all engine calls.\n * - `fqn` — the fully qualified field name (\"billing.name\"). The portable,\n * semantic identity used by interchange formats (FDF/XFDF) and analytics;\n * survives document rewrites but is only as unique as the producer made\n * it. The engine resolves it against the reconciled field tree.\n */\nexport type FormFieldRef =\n | { kind: 'objectNumber'; objectNumber: number }\n | { kind: 'fqn'; name: string };\n\n/** A ref to a field by its full name (`'billing.name'`), for a name you already know. */\nexport function toFieldRef(name: string): FormFieldRef {\n return { kind: 'fqn', name };\n}\n\n/**\n * URL-safe encoding of a `FormFieldRef`, used by the cloud HTTP surface as\n * the `:fieldKey` route parameter. Decoded by the server back into a\n * `FormFieldRef` via `decodeFieldRefKey`. Mirrors the annotation plane's\n * `encodeAnnotKey` (`obj:42` / `base:2`) so the two member-key syntaxes\n * read the same on the wire:\n *\n * `{ kind: 'objectNumber', objectNumber: 12 }` -> `'obj:12'`\n * `{ kind: 'fqn', name: 'billing.name' }` -> `'fqn:billing.name'`\n *\n * The caller is responsible for `encodeURIComponent`-ing the result before\n * splicing it into a URL path; the `wirePaths.layerFormField*` builders\n * already do that. FQNs are opaque strings and may contain anything; the\n * `fqn:` prefix keeps them unambiguous from numeric ids.\n */\nexport function encodeFieldRefKey(ref: FormFieldRef): string {\n if (ref.kind === 'objectNumber') {\n if (!Number.isInteger(ref.objectNumber) || ref.objectNumber <= 0) {\n throw new RangeError(\n `encodeFieldRefKey: objectNumber must be a positive integer, got ${ref.objectNumber}`,\n );\n }\n return `obj:${ref.objectNumber}`;\n }\n return `fqn:${ref.name}`;\n}\n\n/**\n * Inverse of `encodeFieldRefKey`. Returns `null` for malformed input so the\n * server can answer 400 InvalidArg with a useful message instead of\n * throwing. The input is the already-`decodeURIComponent`-ed segment from\n * the route path. Empty FQNs are rejected: `fqn:` with no suffix is not a\n * valid identity.\n */\nexport function decodeFieldRefKey(key: string): FormFieldRef | null {\n if (key.startsWith('obj:')) {\n const rest = key.slice('obj:'.length);\n const n = Number.parseInt(rest, 10);\n if (!Number.isInteger(n) || n <= 0 || String(n) !== rest) return null;\n return { kind: 'objectNumber', objectNumber: n };\n }\n if (key.startsWith('fqn:')) {\n const name = key.slice('fqn:'.length);\n if (name.length === 0) return null;\n return { kind: 'fqn', name };\n }\n return null;\n}\n\n/**\n * A widget annotation of a field, as the field tree sees it. The forms reader\n * learns widgets from the field's `/Kids`, not from a page's `/Annots`, so it\n * must be able to report widgets the annotation subsystem cannot reach.\n *\n * `ref` is the widget as an annotation address, computed once by the engine:\n * present exactly when the widget is an indirect object (`objectNumber > 0`)\n * placed on a page (`page !== null`). In a conforming PDF every widget has\n * one. `objectNumber` stays beside it because a widget can be an object on no\n * page: it has a number but no annotation address, and the field still owns\n * it (signature checks join changed objects to fields by these numbers).\n */\nexport interface FormWidget {\n /** The widget as an annotation address, or null when it cannot be addressed as one. */\n ref: AnnotationRef | null;\n /**\n * The widget annotation's object number, whether or not it is on a page.\n * `0` when the widget is stored as a direct object (spec-violating; it\n * cannot be addressed).\n */\n objectNumber: number;\n /**\n * The page whose /Annots array references the widget; `null` when the\n * widget is not reachable from any page (\"unplaced\").\n */\n page: PageRef | null;\n}\n\n/** The one place a widget record is built: computes `ref` from the raw facts. */\nexport function formWidget(objectNumber: number, page: PageRef | null): FormWidget {\n return {\n ref: objectNumber > 0 && page ? { kind: 'objectNumber', page, objectNumber } : null,\n objectNumber,\n page,\n };\n}\n","import type { PdfNumberFormat } from '../dto/Measure';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\n\nconst group = (value: string, separator: string): string =>\n value.replace(/\\B(?=(\\d{3})+(?!\\d))/g, () => separator);\nconst gcd = (a: number, b: number): number => (b ? gcd(b, a % b) : a);\n\nexport function validNumberFormat(nf: PdfNumberFormat): boolean {\n const c = Math.fround(nf.conversion ?? NaN);\n if (!Number.isFinite(c) || c <= 0) return false;\n const d = nf.precision ?? (nf.fraction === 'fraction' ? 16 : 100);\n if (!Number.isInteger(d) || d < 1 || d > 2147483647) return false;\n if ((nf.fraction ?? 'decimal') === 'decimal' && !Number.isInteger(Math.log10(d))) return false;\n return true;\n}\n\nfunction last(value: number, nf: PdfNumberFormat): string {\n const mode = nf.fraction ?? 'decimal';\n const sep = nf.thousands ?? ',';\n if (mode === 'round') return group(String(Math.round(value)), sep);\n if (mode === 'truncate') return group(String(Math.trunc(value)), sep);\n if (mode === 'fraction') {\n const denominator = nf.precision ?? 16;\n let whole = Math.floor(value);\n let numerator = Math.round((value - whole) * denominator);\n if (numerator === denominator) {\n whole++;\n numerator = 0;\n }\n if (!numerator) return group(String(whole), sep);\n const divisor = nf.fixed ? 1 : gcd(numerator, denominator);\n return `${whole ? `${group(String(whole), sep)} ` : ''}${numerator / divisor}/${denominator / divisor}`;\n }\n // Every digit /RD asks for, /FD or not, as Acrobat shows it (\"1.50 m\"):\n // ISO 32000-2 would let a reader drop the trailing zeros without /FD.\n const digits = Math.log10(nf.precision ?? 100);\n const [integer, decimal = ''] = value.toFixed(digits).split('.');\n return group(integer, sep) + (decimal ? (nf.decimal || '.') + decimal : '');\n}\n\n/** ISO 32000-2 §12.9.2 cascade. PDF float conversions are normalized before use.\n * Unit text and explicit spacing are preserved, including trailing unit spaces. */\nexport function formatMeasurement(value: number, formats: readonly PdfNumberFormat[]): string {\n if (!Number.isFinite(value) || !formats.length || !formats.every(validNumberFormat)) {\n throw new EngineError(\n EngineErrorCode.InvalidArg,\n 'Measurement requires a finite value and valid number formats',\n );\n }\n let remainder = Math.abs(value);\n const parts: string[] = [];\n for (const [index, nf] of formats.entries()) {\n remainder *= Math.fround(nf.conversion!);\n if (!Number.isFinite(remainder))\n throw new EngineError(EngineErrorCode.InvalidArg, 'Measurement overflow');\n const whole = Math.floor(remainder);\n const fraction = remainder - whole;\n const final = index === formats.length - 1;\n const terminal = final || fraction === 0;\n // A cascade that stops early on a whole unit shows it whole (\"2 ft\").\n const number = final ? last(remainder, nf) : group(String(whole), nf.thousands ?? ',');\n // Omit only the implicit outer padding, never trim the unit or explicit separators.\n const prefix = nf.labelPosition === 'prefix';\n const ps = nf.prefixSpacing ?? (prefix && index === 0 ? '' : ' ');\n const ss = nf.suffixSpacing ?? (!prefix && terminal ? '' : ' ');\n const label = ps + nf.unit + ss;\n parts.push(prefix ? label + number : number + label);\n if (terminal) break;\n remainder = fraction;\n }\n return (value < 0 ? '-' : '') + parts.join('');\n}\n"],"mappings":";AAAA,MAAa,kBAAkB;CAC7B,SAAS;CACT,YAAY;CACZ,YAAY;CACZ,eAAe;CACf,qBAAqB;CACrB,sBAAsB;;;;;;;;CAQtB,uBAAuB;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