@embedpdf/engine-core 3.0.0-next.15 → 3.0.0-next.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AnnotationList-CkijRHet.d.cts → AnnotationList-DcyhF2kU.d.cts} +1836 -1308
- package/dist/{AnnotationList-CkijRHet.d.ts → AnnotationList-DcyhF2kU.d.ts} +1836 -1308
- package/dist/{Change-CjImsrN0.cjs → Change-Ct-dB8D5.cjs} +115 -2
- package/dist/Change-Ct-dB8D5.cjs.map +1 -0
- package/dist/{Change-CKoxfTNY.js → Change-tMR34hTU.js} +92 -3
- package/dist/Change-tMR34hTU.js.map +1 -0
- package/dist/{DocumentRenderService-BfFdFSwI.cjs → DocumentRenderService-9IjSQEIU.cjs} +2 -1
- package/dist/{DocumentRenderService-BfFdFSwI.cjs.map → DocumentRenderService-9IjSQEIU.cjs.map} +1 -1
- package/dist/{DocumentRenderService-DV3J9lMz.js → DocumentRenderService-DFrZ9wfW.js} +2 -1
- package/dist/{DocumentRenderService-DV3J9lMz.js.map → DocumentRenderService-DFrZ9wfW.js.map} +1 -1
- package/dist/{DocumentSecurityService-e6vp2de8.d.cts → DocumentSecurityService-D2zA4NKi.d.cts} +2 -2
- package/dist/{DocumentSecurityService-CU1M6Q7m.d.ts → DocumentSecurityService-YJV9df8P.d.ts} +2 -2
- package/dist/{LocalEngine-DFoBm4B3.d.cts → LocalEngine-DBt2-GWF.d.ts} +102 -18
- package/dist/{LocalEngine-DPriFujS.d.ts → LocalEngine-IA9zh3Jh.d.cts} +102 -18
- package/dist/{authority-DLMNR7ff.cjs → authority-BFp6XM04.cjs} +373 -52
- package/dist/authority-BFp6XM04.cjs.map +1 -0
- package/dist/{authority-B3BklsB4.js → authority-PuxpGFhJ.js} +320 -53
- package/dist/authority-PuxpGFhJ.js.map +1 -0
- package/dist/{builders-CNj0POeY.js → builders-DV62HA3I.js} +6 -2
- package/dist/builders-DV62HA3I.js.map +1 -0
- package/dist/{builders-Cgdp_YCn.cjs → builders-DgTAj_tP.cjs} +6 -2
- package/dist/builders-DgTAj_tP.cjs.map +1 -0
- package/dist/{calibrate-DJBXnhLE.cjs → calibrate-DJbi1wuK.cjs} +118 -25
- package/dist/calibrate-DJbi1wuK.cjs.map +1 -0
- package/dist/{calibrate-7T3fnP8-.js → calibrate-nQFgCuki.js} +83 -26
- package/dist/calibrate-nQFgCuki.js.map +1 -0
- package/dist/charmap-Cprti1ta.js.map +1 -1
- package/dist/charmap-aYlefQP9.cjs.map +1 -1
- package/dist/conformance.cjs +1744 -75
- package/dist/conformance.cjs.map +1 -1
- package/dist/conformance.d.cts +105 -10
- package/dist/conformance.d.ts +105 -10
- package/dist/conformance.js +1738 -76
- package/dist/conformance.js.map +1 -1
- package/dist/index.cjs +25 -6
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +7 -7
- package/dist/public.cjs +6 -4
- package/dist/public.d.cts +5 -5
- package/dist/public.d.ts +5 -5
- package/dist/public.js +5 -5
- package/dist/{resolver-CzxmD9Ck.js → resolver-BBggAxQc.js} +6 -3
- package/dist/resolver-BBggAxQc.js.map +1 -0
- package/dist/{resolver-D2OCtE8F.cjs → resolver-BWSWSF6R.cjs} +6 -3
- package/dist/resolver-BWSWSF6R.cjs.map +1 -0
- package/dist/{runtime-Cl0v56mm.d.ts → runtime-BaDKjxiu.d.ts} +67 -140
- package/dist/{runtime-p1WDzDo4.d.cts → runtime-CWEuiwbk.d.cts} +67 -140
- package/dist/runtime.cjs +267 -7
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.d.cts +5 -5
- package/dist/runtime.d.ts +5 -5
- package/dist/runtime.js +246 -8
- package/dist/runtime.js.map +1 -1
- package/dist/{schema-DzlUNk38.js → schema-6S2VmlAj.js} +8 -2
- package/dist/schema-6S2VmlAj.js.map +1 -0
- package/dist/{schema-C-gU4vj7.cjs → schema-miH6tWQC.cjs} +13 -1
- package/dist/schema-miH6tWQC.cjs.map +1 -0
- package/dist/{schemas-D6xOGjqg.js → schemas-BE2QGOit.js} +256 -59
- package/dist/schemas-BE2QGOit.js.map +1 -0
- package/dist/{schemas-Berf1swF.cjs → schemas-DljJR9ut.cjs} +397 -80
- package/dist/schemas-DljJR9ut.cjs.map +1 -0
- package/dist/validation.cjs +1 -1
- package/dist/validation.d.cts +1 -1
- package/dist/validation.d.ts +1 -1
- package/dist/validation.js +1 -1
- package/dist/{viewport-DlL5Bxbg.cjs → viewport-CHG9qQUb.cjs} +2 -2
- package/dist/{viewport-DlL5Bxbg.cjs.map → viewport-CHG9qQUb.cjs.map} +1 -1
- package/dist/{viewport-BJW13EGZ.js → viewport-DQR5LyX3.js} +2 -2
- package/dist/{viewport-BJW13EGZ.js.map → viewport-DQR5LyX3.js.map} +1 -1
- package/dist/wire.cjs +225 -57
- package/dist/wire.cjs.map +1 -1
- package/dist/wire.d.cts +3548 -1151
- package/dist/wire.d.ts +3548 -1151
- package/dist/wire.js +198 -53
- package/dist/wire.js.map +1 -1
- package/package.json +1 -1
- package/dist/Change-CKoxfTNY.js.map +0 -1
- package/dist/Change-CjImsrN0.cjs.map +0 -1
- package/dist/authority-B3BklsB4.js.map +0 -1
- package/dist/authority-DLMNR7ff.cjs.map +0 -1
- package/dist/builders-CNj0POeY.js.map +0 -1
- package/dist/builders-Cgdp_YCn.cjs.map +0 -1
- package/dist/calibrate-7T3fnP8-.js.map +0 -1
- package/dist/calibrate-DJBXnhLE.cjs.map +0 -1
- package/dist/resolver-CzxmD9Ck.js.map +0 -1
- package/dist/resolver-D2OCtE8F.cjs.map +0 -1
- package/dist/schema-C-gU4vj7.cjs.map +0 -1
- package/dist/schema-DzlUNk38.js.map +0 -1
- package/dist/schemas-Berf1swF.cjs.map +0 -1
- package/dist/schemas-D6xOGjqg.js.map +0 -1
package/dist/runtime.cjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_Change = require("./Change-Ct-dB8D5.cjs");
|
|
3
|
+
const require_calibrate = require("./calibrate-DJbi1wuK.cjs");
|
|
2
4
|
const require_value = require("./value-BFS1R8ek.cjs");
|
|
3
5
|
const require_resolveAnnotationDraft = require("./resolveAnnotationDraft-7Ke4nV7F.cjs");
|
|
4
6
|
const require_format = require("./format-Bp3QFSH1.cjs");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const require_viewport = require("./viewport-DlL5Bxbg.cjs");
|
|
7
|
+
const require_authority = require("./authority-BFp6XM04.cjs");
|
|
8
|
+
const require_resolver = require("./resolver-BWSWSF6R.cjs");
|
|
9
|
+
const require_viewport = require("./viewport-CHG9qQUb.cjs");
|
|
9
10
|
const require_charmap = require("./charmap-aYlefQP9.cjs");
|
|
10
11
|
const require_subtype = require("./subtype-aDt5TFmK.cjs");
|
|
11
12
|
const require_pageRefs = require("./pageRefs-B3ur7Ckm.cjs");
|
|
12
|
-
const require_Change = require("./Change-CjImsrN0.cjs");
|
|
13
13
|
const require_PageInsertBlankInput = require("./PageInsertBlankInput-CXHAM7l6.cjs");
|
|
14
|
-
const require_builders = require("./builders-
|
|
14
|
+
const require_builders = require("./builders-DgTAj_tP.cjs");
|
|
15
15
|
const require_LocalDocumentHandle = require("./LocalDocumentHandle-D02FMm-Z.cjs");
|
|
16
|
-
const require_DocumentRenderService = require("./DocumentRenderService-
|
|
16
|
+
const require_DocumentRenderService = require("./DocumentRenderService-9IjSQEIU.cjs");
|
|
17
17
|
//#region src/events/DocumentEventStream.ts
|
|
18
18
|
/**
|
|
19
19
|
* `on(type, listener)` built on a stream's `subscribe`, so both engines
|
|
@@ -311,6 +311,100 @@ function itemEvents(item) {
|
|
|
311
311
|
...result
|
|
312
312
|
}];
|
|
313
313
|
}
|
|
314
|
+
case "outline.create": {
|
|
315
|
+
const { type: _type, ...result } = item;
|
|
316
|
+
return [{
|
|
317
|
+
type: "outline.created",
|
|
318
|
+
...result
|
|
319
|
+
}];
|
|
320
|
+
}
|
|
321
|
+
case "outline.update": {
|
|
322
|
+
const { type: _type, skipped: _skipped, ...result } = item;
|
|
323
|
+
return [{
|
|
324
|
+
type: "outline.updated",
|
|
325
|
+
...result
|
|
326
|
+
}];
|
|
327
|
+
}
|
|
328
|
+
case "outline.move": {
|
|
329
|
+
const { type: _type, ...result } = item;
|
|
330
|
+
return [{
|
|
331
|
+
type: "outline.moved",
|
|
332
|
+
...result
|
|
333
|
+
}];
|
|
334
|
+
}
|
|
335
|
+
case "outline.delete": {
|
|
336
|
+
const { type: _type, ...result } = item;
|
|
337
|
+
return [{
|
|
338
|
+
type: "outline.deleted",
|
|
339
|
+
deleted: require_authority.deletedOutlineItemsOf(result),
|
|
340
|
+
...result
|
|
341
|
+
}];
|
|
342
|
+
}
|
|
343
|
+
case "outline.restore": {
|
|
344
|
+
const { type: _type, ...result } = item;
|
|
345
|
+
return [{
|
|
346
|
+
type: "outline.restored",
|
|
347
|
+
...result
|
|
348
|
+
}];
|
|
349
|
+
}
|
|
350
|
+
case "pages.rotate": {
|
|
351
|
+
const { type: _type, ...result } = item;
|
|
352
|
+
return [{
|
|
353
|
+
type: "pages.rotated",
|
|
354
|
+
...result
|
|
355
|
+
}];
|
|
356
|
+
}
|
|
357
|
+
case "pages.reorder": {
|
|
358
|
+
const { type: _type, ...result } = item;
|
|
359
|
+
return [{
|
|
360
|
+
type: "pages.reordered",
|
|
361
|
+
...result
|
|
362
|
+
}];
|
|
363
|
+
}
|
|
364
|
+
case "pages.delete": {
|
|
365
|
+
const { type: _type, ...result } = item;
|
|
366
|
+
return [{
|
|
367
|
+
type: "pages.deleted",
|
|
368
|
+
...result
|
|
369
|
+
}];
|
|
370
|
+
}
|
|
371
|
+
case "pages.insertBlank":
|
|
372
|
+
case "pages.insert": {
|
|
373
|
+
const { type: _type, ...result } = item;
|
|
374
|
+
return [{
|
|
375
|
+
type: "pages.inserted",
|
|
376
|
+
...result
|
|
377
|
+
}];
|
|
378
|
+
}
|
|
379
|
+
case "pages.restore": {
|
|
380
|
+
const { type: _type, ...result } = item;
|
|
381
|
+
return [{
|
|
382
|
+
type: "pages.restored",
|
|
383
|
+
...result
|
|
384
|
+
}];
|
|
385
|
+
}
|
|
386
|
+
case "attachments.create": {
|
|
387
|
+
const { type: _type, ...result } = item;
|
|
388
|
+
return [{
|
|
389
|
+
type: "attachments.created",
|
|
390
|
+
...result
|
|
391
|
+
}];
|
|
392
|
+
}
|
|
393
|
+
case "attachments.delete": {
|
|
394
|
+
const { type: _type, ...result } = item;
|
|
395
|
+
return [{
|
|
396
|
+
type: "attachments.deleted",
|
|
397
|
+
deleted: require_Change.deletedAttachmentOf(result),
|
|
398
|
+
...result
|
|
399
|
+
}];
|
|
400
|
+
}
|
|
401
|
+
case "attachments.restore": {
|
|
402
|
+
const { type: _type, ...result } = item;
|
|
403
|
+
return [{
|
|
404
|
+
type: "attachments.restored",
|
|
405
|
+
...result
|
|
406
|
+
}];
|
|
407
|
+
}
|
|
314
408
|
}
|
|
315
409
|
}
|
|
316
410
|
//#endregion
|
|
@@ -548,6 +642,150 @@ function passwordPromptFromState(state, incorrect = false) {
|
|
|
548
642
|
return { state: "none" };
|
|
549
643
|
}
|
|
550
644
|
//#endregion
|
|
645
|
+
//#region src/engine/attachmentVerbs.ts
|
|
646
|
+
/**
|
|
647
|
+
* `doc.attachments` on any engine: the reads `rest` holds (`list`,
|
|
648
|
+
* `download`), and each write as a one-op change through `apply`, so a verb
|
|
649
|
+
* has its op's checks, events and undo (its `opId` undoes it) and answers as
|
|
650
|
+
* its single verb did.
|
|
651
|
+
*/
|
|
652
|
+
function attachmentVerbs(rest, apply) {
|
|
653
|
+
const one = (op, type, options, answer) => require_viewport.AbortablePromise.run(async (signal) => {
|
|
654
|
+
const item = (await apply({ ops: [await op()] }, options?.opId === void 0 ? {} : { opId: options.opId }).abortWith(signal)).items[0];
|
|
655
|
+
if (!item || item.type !== type) throw new require_format.EngineError(require_format.EngineErrorCode.Unknown, `${type} wrote nothing`);
|
|
656
|
+
return answer(item);
|
|
657
|
+
});
|
|
658
|
+
return {
|
|
659
|
+
list: () => rest.list(),
|
|
660
|
+
download: (ref) => rest.download(ref),
|
|
661
|
+
create: (file, options) => one(async () => {
|
|
662
|
+
const { wireFile, resource } = await require_authority.normalizeAttachmentFileSource(file, "file");
|
|
663
|
+
const { resources: _resources, ...metadata } = wireFile;
|
|
664
|
+
return {
|
|
665
|
+
type: "attachments.create",
|
|
666
|
+
file: metadata,
|
|
667
|
+
resources: { file: new Uint8Array(resource.bytes) }
|
|
668
|
+
};
|
|
669
|
+
}, "attachments.create", options, (item) => ({
|
|
670
|
+
attachment: item.attachment,
|
|
671
|
+
meta: item.meta
|
|
672
|
+
})),
|
|
673
|
+
delete: (ref, options) => one(async () => ({
|
|
674
|
+
type: "attachments.delete",
|
|
675
|
+
ref
|
|
676
|
+
}), "attachments.delete", options, (item) => ({ meta: item.meta }))
|
|
677
|
+
};
|
|
678
|
+
}
|
|
679
|
+
//#endregion
|
|
680
|
+
//#region src/engine/outlineVerbs.ts
|
|
681
|
+
/**
|
|
682
|
+
* `doc.outline` on any engine: its read, and each verb as a one-op change
|
|
683
|
+
* through `apply`, so a verb has its op's checks, events and undo (its
|
|
684
|
+
* `opId` undoes it) and answers with the op's item.
|
|
685
|
+
*/
|
|
686
|
+
function outlineVerbs(get, apply) {
|
|
687
|
+
const one = (op, options) => require_viewport.AbortablePromise.run(async (signal) => {
|
|
688
|
+
const result = await apply({ ops: [op] }, options?.opId === void 0 ? {} : { opId: options.opId }).abortWith(signal);
|
|
689
|
+
const type = op.type;
|
|
690
|
+
const item = result.items[0];
|
|
691
|
+
if (!item || item.type !== type) throw new require_format.EngineError(require_format.EngineErrorCode.Unknown, `${type} wrote nothing`);
|
|
692
|
+
const { type: _type, skipped: _skipped, ...answer } = item;
|
|
693
|
+
return answer;
|
|
694
|
+
});
|
|
695
|
+
return {
|
|
696
|
+
get,
|
|
697
|
+
create: (data, options) => one({
|
|
698
|
+
type: "outline.create",
|
|
699
|
+
parent: options?.parent ?? null,
|
|
700
|
+
data,
|
|
701
|
+
...options?.position === void 0 ? {} : { position: options.position },
|
|
702
|
+
...options?.objectNumber === void 0 ? {} : { objectNumber: options.objectNumber }
|
|
703
|
+
}, options),
|
|
704
|
+
update: (ref, patch, options) => one({
|
|
705
|
+
type: "outline.update",
|
|
706
|
+
ref,
|
|
707
|
+
patch
|
|
708
|
+
}, options),
|
|
709
|
+
move: (refs, parent, position, options) => one({
|
|
710
|
+
type: "outline.move",
|
|
711
|
+
refs,
|
|
712
|
+
parent,
|
|
713
|
+
position
|
|
714
|
+
}, options),
|
|
715
|
+
delete: (ref, options) => one({
|
|
716
|
+
type: "outline.delete",
|
|
717
|
+
ref
|
|
718
|
+
}, options)
|
|
719
|
+
};
|
|
720
|
+
}
|
|
721
|
+
//#endregion
|
|
722
|
+
//#region src/engine/pageVerbs.ts
|
|
723
|
+
/**
|
|
724
|
+
* `doc.pages` on any engine: what `rest` holds (the reads, extract, flatten
|
|
725
|
+
* and the page names), and each structure verb as a one-op change through
|
|
726
|
+
* `apply`, so a verb has its op's checks, events and undo (its `opId` undoes
|
|
727
|
+
* it) and answers as its single verb did.
|
|
728
|
+
*/
|
|
729
|
+
function pageVerbs(rest, apply) {
|
|
730
|
+
const one = (op, options, answer) => require_viewport.AbortablePromise.run(async (signal) => {
|
|
731
|
+
const result = await apply({ ops: [op] }, options?.opId === void 0 ? {} : { opId: options.opId }).abortWith(signal);
|
|
732
|
+
const type = op.type;
|
|
733
|
+
const item = result.items[0];
|
|
734
|
+
if (!item || item.type !== type) throw new require_format.EngineError(require_format.EngineErrorCode.Unknown, `${type} wrote nothing`);
|
|
735
|
+
return answer(item);
|
|
736
|
+
});
|
|
737
|
+
return {
|
|
738
|
+
list: () => rest.list(),
|
|
739
|
+
setName: (input, options) => rest.setName(input, options),
|
|
740
|
+
removeName: (input, options) => rest.removeName(input, options),
|
|
741
|
+
flatten: (pages, options) => rest.flatten(pages, options),
|
|
742
|
+
extract: (pages, options) => rest.extract(pages, options),
|
|
743
|
+
reorder: (pages, position, options) => one({
|
|
744
|
+
type: "pages.reorder",
|
|
745
|
+
pages,
|
|
746
|
+
position
|
|
747
|
+
}, options, (item) => ({
|
|
748
|
+
pages: item.pages,
|
|
749
|
+
layout: item.layout,
|
|
750
|
+
meta: item.meta
|
|
751
|
+
})),
|
|
752
|
+
rotate: (pages, rotation, options) => one({
|
|
753
|
+
type: "pages.rotate",
|
|
754
|
+
pages,
|
|
755
|
+
rotation
|
|
756
|
+
}, options, (item) => ({
|
|
757
|
+
layout: item.layout,
|
|
758
|
+
meta: item.meta
|
|
759
|
+
})),
|
|
760
|
+
delete: (pages, options) => one({
|
|
761
|
+
type: "pages.delete",
|
|
762
|
+
pages
|
|
763
|
+
}, options, (item) => ({
|
|
764
|
+
layout: item.layout,
|
|
765
|
+
meta: item.meta
|
|
766
|
+
})),
|
|
767
|
+
insert: (bytes, position, options) => one({
|
|
768
|
+
type: "pages.insert",
|
|
769
|
+
source: bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes),
|
|
770
|
+
...position === void 0 ? {} : { position }
|
|
771
|
+
}, options, (item) => ({
|
|
772
|
+
insertedPages: item.insertedPages,
|
|
773
|
+
layout: item.layout,
|
|
774
|
+
meta: item.meta
|
|
775
|
+
})),
|
|
776
|
+
insertBlank: (spec, position, options) => one({
|
|
777
|
+
type: "pages.insertBlank",
|
|
778
|
+
spec,
|
|
779
|
+
...position === void 0 ? {} : { position },
|
|
780
|
+
...options?.objectNumbers === void 0 ? {} : { objectNumbers: options.objectNumbers }
|
|
781
|
+
}, options, (item) => ({
|
|
782
|
+
insertedPages: item.insertedPages,
|
|
783
|
+
layout: item.layout,
|
|
784
|
+
meta: item.meta
|
|
785
|
+
}))
|
|
786
|
+
};
|
|
787
|
+
}
|
|
788
|
+
//#endregion
|
|
551
789
|
//#region src/wire/WirePack.ts
|
|
552
790
|
/**
|
|
553
791
|
* Singleton empty transfer list. Frozen so accidental in-place
|
|
@@ -581,6 +819,7 @@ exports.ANNOTATION_FIELD_SPACES = require_resolveAnnotationDraft.ANNOTATION_FIEL
|
|
|
581
819
|
exports.ANNOTATION_RESOURCE_ROLES = require_resolveAnnotationDraft.ANNOTATION_RESOURCE_ROLES;
|
|
582
820
|
exports.ANNOTATION_RESOURCE_ROLE_NAMES = require_calibrate.ANNOTATION_RESOURCE_ROLE_NAMES;
|
|
583
821
|
exports.ANNOTATION_SUBTYPES = require_subtype.ANNOTATION_SUBTYPES;
|
|
822
|
+
exports.ATTACHMENT_LIMITS = require_calibrate.ATTACHMENT_LIMITS;
|
|
584
823
|
exports.AbortError = require_calibrate.AbortError;
|
|
585
824
|
exports.AbortablePromise = require_viewport.AbortablePromise;
|
|
586
825
|
exports.AnnotationTransfer = require_calibrate.AnnotationTransfer;
|
|
@@ -604,10 +843,12 @@ exports.MissingIdentity = require_resolver.MissingIdentity;
|
|
|
604
843
|
exports.NO_ANNOTATION_FLAGS = require_format.NO_ANNOTATION_FLAGS;
|
|
605
844
|
exports.OBJECT_NUMBER_CEILING = require_viewport.OBJECT_NUMBER_CEILING;
|
|
606
845
|
exports.OBJECT_NUMBER_ISSUE_LIMIT = require_viewport.OBJECT_NUMBER_ISSUE_LIMIT;
|
|
846
|
+
exports.OUTLINE_READ_LIMITS = require_Change.OUTLINE_READ_LIMITS;
|
|
607
847
|
exports.PAGE_INSERT_BLANK_MAX_COUNT = require_PageInsertBlankInput.PAGE_INSERT_BLANK_MAX_COUNT;
|
|
608
848
|
exports.PDF_BITS = require_authority.PDF_BITS;
|
|
609
849
|
exports.PDF_CODE_TO_SUBTYPE = require_subtype.PDF_CODE_TO_SUBTYPE;
|
|
610
850
|
exports.PDF_SUBTYPE_TO_CODE = require_subtype.PDF_SUBTYPE_TO_CODE;
|
|
851
|
+
exports.PRINT_PAPER = require_calibrate.PRINT_PAPER;
|
|
611
852
|
exports.PROTECTABLE_CAPABILITIES = require_resolver.PROTECTABLE_CAPABILITIES;
|
|
612
853
|
exports.PdfAnnotationSubtypeCode = require_subtype.PdfAnnotationSubtypeCode;
|
|
613
854
|
exports.PermissionDenied = require_resolver.PermissionDenied;
|
|
@@ -622,6 +863,7 @@ exports.UNBAKED_KINDS = require_resolveAnnotationDraft.UNBAKED_KINDS;
|
|
|
622
863
|
exports.USAGE_INCOMPLETE = require_authority.USAGE_INCOMPLETE;
|
|
623
864
|
exports.WIDGET_ACTION_EVENTS = require_value.WIDGET_ACTION_EVENTS;
|
|
624
865
|
exports.WIDGET_FLAG_NAMES = require_value.WIDGET_FLAG_NAMES;
|
|
866
|
+
exports.actionTreeOf = require_calibrate.actionTreeOf;
|
|
625
867
|
exports.actionWriteOf = require_value.actionWriteOf;
|
|
626
868
|
exports.advisoryFromPdfBits = advisoryFromPdfBits;
|
|
627
869
|
exports.allowsCapability = require_authority.allowsCapability;
|
|
@@ -655,6 +897,7 @@ exports.assertRichTextAgreement = require_resolveAnnotationDraft.assertRichTextA
|
|
|
655
897
|
exports.assertWithinLimit = require_calibrate.assertWithinLimit;
|
|
656
898
|
exports.assertWritableMeasure = require_resolveAnnotationDraft.assertWritableMeasure;
|
|
657
899
|
exports.assessmentOf = require_authority.assessmentOf;
|
|
900
|
+
exports.attachmentVerbs = attachmentVerbs;
|
|
658
901
|
exports.authorizeAnnotationCreate = require_authority.authorizeAnnotationCreate;
|
|
659
902
|
exports.authorizeAnnotationDelete = require_authority.authorizeAnnotationDelete;
|
|
660
903
|
exports.authorizeAnnotationUpdate = require_authority.authorizeAnnotationUpdate;
|
|
@@ -682,6 +925,7 @@ exports.checkCapability = require_resolver.checkCapability;
|
|
|
682
925
|
exports.checkCollab = require_resolver.checkCollab;
|
|
683
926
|
exports.checkFieldAction = require_resolver.checkFieldAction;
|
|
684
927
|
exports.checkImageQuality = require_authority.checkImageQuality;
|
|
928
|
+
exports.checkRenderUsage = require_authority.checkRenderUsage;
|
|
685
929
|
exports.checkSetGroup = require_resolver.checkSetGroup;
|
|
686
930
|
exports.classifyRelation = require_resolveAnnotationDraft.classifyRelation;
|
|
687
931
|
exports.clearlyOutranks = clearlyOutranks;
|
|
@@ -705,6 +949,7 @@ exports.defaultEntryOfDraft = require_Change.defaultEntryOfDraft;
|
|
|
705
949
|
exports.deletedAnnotationsOf = require_authority.deletedAnnotationsOf;
|
|
706
950
|
exports.deletedAttachmentOf = require_Change.deletedAttachmentOf;
|
|
707
951
|
exports.deletedFieldOf = require_value.deletedFieldOf;
|
|
952
|
+
exports.deletedOutlineItemsOf = require_authority.deletedOutlineItemsOf;
|
|
708
953
|
exports.deletedWith = require_resolveAnnotationDraft.deletedWith;
|
|
709
954
|
exports.deriveMeasurementLabel = require_resolveAnnotationDraft.deriveMeasurementLabel;
|
|
710
955
|
exports.deriveProtection = require_resolver.deriveProtection;
|
|
@@ -781,6 +1026,7 @@ exports.mapAnnotationActions = require_calibrate.mapAnnotationActions;
|
|
|
781
1026
|
exports.mapDocumentActions = require_calibrate.mapDocumentActions;
|
|
782
1027
|
exports.mapFieldActions = require_calibrate.mapFieldActions;
|
|
783
1028
|
exports.mapLinkTarget = require_calibrate.mapLinkTarget;
|
|
1029
|
+
exports.mapOutlineItem = require_authority.mapOutlineItem;
|
|
784
1030
|
exports.mapPageActions = require_calibrate.mapPageActions;
|
|
785
1031
|
exports.mapPageRefs = require_pageRefs.mapPageRefs;
|
|
786
1032
|
exports.matchLiteral = require_viewport.matchLiteral;
|
|
@@ -801,6 +1047,11 @@ exports.objectNumbersIn = require_viewport.objectNumbersIn;
|
|
|
801
1047
|
exports.objectNumbersNamedBy = require_Change.objectNumbersNamedBy;
|
|
802
1048
|
exports.objectNumbersReferencedBy = require_Change.objectNumbersReferencedBy;
|
|
803
1049
|
exports.opIdOf = require_authority.opIdOf;
|
|
1050
|
+
exports.outlineItemAfter = require_Change.outlineItemAfter;
|
|
1051
|
+
exports.outlineItemOfDraft = require_Change.outlineItemOfDraft;
|
|
1052
|
+
exports.outlineItemRefsEqual = require_calibrate.outlineItemRefsEqual;
|
|
1053
|
+
exports.outlineItemWithChildren = require_Change.outlineItemWithChildren;
|
|
1054
|
+
exports.outlineVerbs = outlineVerbs;
|
|
804
1055
|
exports.pageAnnotationDraftOf = require_calibrate.pageAnnotationDraftOf;
|
|
805
1056
|
exports.pageAnnotationOf = require_calibrate.pageAnnotationOf;
|
|
806
1057
|
exports.pageAnnotationPatchOf = require_calibrate.pageAnnotationPatchOf;
|
|
@@ -817,6 +1068,8 @@ exports.pageGlyphLooseQuad = require_calibrate.pageGlyphLooseQuad;
|
|
|
817
1068
|
exports.pageLayoutOf = require_authority.pageLayoutOf;
|
|
818
1069
|
exports.pageListOf = require_authority.pageListOf;
|
|
819
1070
|
exports.pageMeasureOf = require_calibrate.pageMeasureOf;
|
|
1071
|
+
exports.pageOutlineItemOf = require_authority.pageOutlineItemOf;
|
|
1072
|
+
exports.pageOutlineOf = require_authority.pageOutlineOf;
|
|
820
1073
|
exports.pagePointOf = require_calibrate.pagePointOf;
|
|
821
1074
|
exports.pagePointTurned = require_calibrate.pagePointTurned;
|
|
822
1075
|
exports.pagePointUnturned = require_calibrate.pagePointUnturned;
|
|
@@ -832,6 +1085,7 @@ exports.pageTextSegmentOf = require_calibrate.pageTextSegmentOf;
|
|
|
832
1085
|
exports.pageTransform = require_calibrate.pageTransform;
|
|
833
1086
|
exports.pageTurnOfDrawn = require_calibrate.pageTurnOfDrawn;
|
|
834
1087
|
exports.pageTurnOfUpright = require_calibrate.pageTurnOfUpright;
|
|
1088
|
+
exports.pageVerbs = pageVerbs;
|
|
835
1089
|
exports.pageViewportsOf = require_calibrate.pageViewportsOf;
|
|
836
1090
|
exports.pageWidgetOf = require_authority.pageWidgetOf;
|
|
837
1091
|
exports.parseObjectNumberRanges = require_viewport.parseObjectNumberRanges;
|
|
@@ -846,6 +1100,8 @@ exports.pdfAppearanceTurnOf = require_calibrate.pdfAppearanceTurnOf;
|
|
|
846
1100
|
exports.pdfDestinationOf = require_calibrate.pdfDestinationOf;
|
|
847
1101
|
exports.pdfFormFieldDraftOf = require_authority.pdfFormFieldDraftOf;
|
|
848
1102
|
exports.pdfMeasureOf = require_calibrate.pdfMeasureOf;
|
|
1103
|
+
exports.pdfOutlineDraftOf = require_authority.pdfOutlineDraftOf;
|
|
1104
|
+
exports.pdfOutlinePatchOf = require_authority.pdfOutlinePatchOf;
|
|
849
1105
|
exports.pdfPermissions = require_builders.pdfPermissions;
|
|
850
1106
|
exports.pdfPointOf = require_calibrate.pdfPointOf;
|
|
851
1107
|
exports.pdfPointTurned = require_resolveAnnotationDraft.pdfPointTurned;
|
|
@@ -876,6 +1132,8 @@ exports.placedWidgetOf = require_authority.placedWidgetOf;
|
|
|
876
1132
|
exports.polygonArea = require_resolveAnnotationDraft.polygonArea;
|
|
877
1133
|
exports.positionIndex = require_viewport.positionIndex;
|
|
878
1134
|
exports.primaryFinding = require_authority.primaryFinding;
|
|
1135
|
+
exports.printDpiOf = require_authority.printDpiOf;
|
|
1136
|
+
exports.printScale = require_calibrate.printScale;
|
|
879
1137
|
exports.protectedCapabilities = require_resolver.protectedCapabilities;
|
|
880
1138
|
exports.quarterTurnOf = require_resolveAnnotationDraft.quarterTurnOf;
|
|
881
1139
|
exports.rank = rank;
|
|
@@ -893,6 +1151,7 @@ exports.resolveAnnotationResources = require_calibrate.resolveAnnotationResource
|
|
|
893
1151
|
exports.resolveBinarySource = require_calibrate.resolveBinarySource;
|
|
894
1152
|
exports.resolveChangeResources = require_Change.resolveChangeResources;
|
|
895
1153
|
exports.resolveMeasurementDraft = require_resolveAnnotationDraft.resolveMeasurementDraft;
|
|
1154
|
+
exports.resolvePageExtract = require_authority.resolvePageExtract;
|
|
896
1155
|
exports.resolvePageLayers = require_authority.resolvePageLayers;
|
|
897
1156
|
exports.resolveRectCommand = require_calibrate.resolveRectCommand;
|
|
898
1157
|
exports.resourceIdOf = require_resolveAnnotationDraft.resourceIdOf;
|
|
@@ -926,6 +1185,7 @@ exports.subtypeFromCode = require_subtype.subtypeFromCode;
|
|
|
926
1185
|
exports.toAttachmentRef = require_calibrate.toAttachmentRef;
|
|
927
1186
|
exports.toFieldRef = require_format.toFieldRef;
|
|
928
1187
|
exports.toOriginalRange = require_calibrate.toOriginalRange;
|
|
1188
|
+
exports.toOutlineItemRef = require_calibrate.toOutlineItemRef;
|
|
929
1189
|
exports.toPageRef = require_format.toPageRef;
|
|
930
1190
|
exports.topRowOf = require_Change.topRowOf;
|
|
931
1191
|
exports.touchesCaption = require_resolveAnnotationDraft.touchesCaption;
|
package/dist/runtime.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.cjs","names":["isSkippedItem","deletedAnnotationsOf","annotationImportFacts","formImportFacts","formValuesImportFacts","formResetFacts","deletedFieldOf","materializePdfPermissions"],"sources":["../src/events/DocumentEventStream.ts","../src/events/EventHub.ts","../src/events/changeEvents.ts","../src/engine/document-security-state.ts","../src/scheduling/place.ts","../src/engine/passwordPrompt.ts","../src/wire/WirePack.ts"],"sourcesContent":["import type { DocumentEvent, DocumentEventOf, DocumentEventType } from './DocumentEvent';\n\n/**\n * The subscription surface on `DocumentHandle.events`: every event with\n * `subscribe`, one type with `on`. No replay-from-id: plugins build their\n * own filter wrappers (per-page, …) on top.\n *\n * Delivery is synchronous fan-out with error isolation: a throwing\n * listener never blocks other listeners, and never fails the mutation\n * whose confirmation produced the event.\n */\nexport interface DocumentEventStream {\n /** Subscribe to every event for this document. Returns the unsubscriber. */\n subscribe(listener: (event: DocumentEvent) => void): () => void;\n /** Subscribe to one type of event, typed by it. Returns the unsubscriber. */\n on<T extends DocumentEventType>(\n type: T,\n listener: (event: DocumentEventOf<T>) => void,\n ): () => void;\n /**\n * Highest `origin.serverId` observed so far — the reconnect/backfill\n * cursor for the remote channel. `null` until a remote-identified event\n * has been seen (always `null` on purely-local engines).\n */\n lastServerId(): number | null;\n}\n\n/**\n * `on(type, listener)` built on a stream's `subscribe`, so both engines\n * filter the same way and a type listener counts as a subscriber (the cloud\n * opens its live stream for the first one).\n */\nexport function subscribeToType<T extends DocumentEventType>(\n subscribe: DocumentEventStream['subscribe'],\n type: T,\n listener: (event: DocumentEventOf<T>) => void,\n): () => void {\n return subscribe((event) => {\n if (event.type === type) listener(event as DocumentEventOf<T>);\n });\n}\n","import type {\n DocumentEvent,\n DocumentEventInit,\n DocumentEventOf,\n DocumentEventType,\n} from './DocumentEvent';\nimport { subscribeToType, type DocumentEventStream } from './DocumentEventStream';\n\n/**\n * The in-process implementation of `DocumentEventStream`, shared by both\n * engine shells (one hub per open `DocumentHandle`). The engine that\n * performs a mutation publishes here at confirmation time; the cloud\n * engine's remote channel will also publish here for other sessions'\n * mutations — listeners never learn which transport delivered an event.\n *\n * Delivery contract:\n * - synchronous fan-out in subscription order;\n * - error isolation: a throwing listener is re-thrown on a microtask\n * (so it surfaces to the host's unhandled-error reporting) without\n * blocking other listeners or failing the mutation path;\n * - `lastServerId` tracks the highest remote cursor seen, for the\n * remote channel's reconnect/backfill.\n */\nexport class EventHub implements DocumentEventStream {\n private readonly listeners = new Set<(event: DocumentEvent) => void>();\n private serverId: number | null = null;\n\n constructor(\n /** Where a throwing listener's error goes. Defaults to an async\n * rethrow so it reaches the host's unhandled-error reporting. */\n private readonly onListenerError: (err: unknown) => void = (err) => {\n queueMicrotask(() => {\n throw err;\n });\n },\n ) {}\n\n subscribe(listener: (event: DocumentEvent) => void): () => void {\n this.listeners.add(listener);\n return () => {\n this.listeners.delete(listener);\n };\n }\n\n on<T extends DocumentEventType>(\n type: T,\n listener: (event: DocumentEventOf<T>) => void,\n ): () => void {\n return subscribeToType((all) => this.subscribe(all), type, listener);\n }\n\n publish(event: DocumentEvent): void {\n // Transport notices (`stream.desynced`) carry no origin; only mutation\n // events advance the server cursor.\n if ('origin' in event) {\n const { serverId } = event.origin;\n if (serverId !== null) {\n this.serverId = this.serverId === null ? serverId : Math.max(this.serverId, serverId);\n }\n }\n // Snapshot so a listener that (un)subscribes mid-fan-out cannot skew\n // delivery for this event.\n for (const listener of [...this.listeners]) {\n try {\n listener(event);\n } catch (err) {\n this.onListenerError(err);\n }\n }\n }\n\n lastServerId(): number | null {\n return this.serverId;\n }\n\n /** Drop every listener (handle close). Idempotent. */\n clear(): void {\n this.listeners.clear();\n }\n}\n\n/**\n * Stamps provenance onto events a mutation path produces. One per open\n * handle: the engine shell constructs it with the instance's `sessionId`\n * (and, on cloud, the authenticated `sub` when known) and hands it to the\n * mutation services — they publish results, never build origins.\n */\nexport class SessionEventPublisher {\n constructor(\n private readonly hub: EventHub,\n private readonly sessionId: string,\n private readonly sub: string | null = null,\n ) {}\n\n /**\n * Publish what one write of this session just committed: one\n * event per fact, in order, all carrying the write's `opId` as\n * `origin.tx`.\n */\n publishWrite(opId: string, ...events: DocumentEventInit[]): void {\n this.publishChange(opId, events);\n }\n\n /**\n * Publish what one change committed: its events as {@link publishWrite}\n * does, and for an undo, the `opId` of the change it undid.\n */\n publishChange(opId: string, events: readonly DocumentEventInit[], undoOf?: string): void {\n const ts = Date.now();\n events.forEach((event, index) => {\n this.hub.publish({\n ...event,\n origin: {\n kind: 'local',\n sessionId: this.sessionId,\n sub: this.sub,\n ts,\n serverId: null,\n tx: { id: opId, index, count: events.length },\n ...(undoOf !== undefined ? { undoOf } : {}),\n },\n } as DocumentEvent);\n });\n }\n}\n","import type { DocumentEventInit } from './DocumentEvent';\nimport { deletedAnnotationsOf } from '../mutation/AnnotationMutationResults';\nimport { isSkippedItem, type ChangeItem, type ChangeResult } from '../mutation/Change';\nimport { deletedFieldOf, formResetFacts } from '../mutation/FormMutationResults';\nimport { annotationImportFacts } from '../transfer/annotationImport';\nimport { formImportFacts, formValuesImportFacts } from '../transfer/formImport';\n\n/**\n * The events a change publishes: each op's events as its single verb\n * publishes them, in op order. An op an undo left alone entirely publishes\n * nothing. The publisher stamps them all with the change's `opId`.\n */\nexport function changeEvents(result: ChangeResult): DocumentEventInit[] {\n return result.items.flatMap(itemEvents);\n}\n\nfunction itemEvents(item: ChangeItem): DocumentEventInit[] {\n if (isSkippedItem(item)) return [];\n switch (item.type) {\n case 'annotations.create': {\n const { type: _type, ...result } = item;\n return [{ type: 'annotations.created', ...result }];\n }\n case 'annotations.update': {\n const { type: _type, skipped: _skipped, ...result } = item;\n return [{ type: 'annotations.updated', ...result }];\n }\n case 'annotations.delete': {\n const { type: _type, ...result } = item;\n return [{ type: 'annotations.deleted', deleted: deletedAnnotationsOf(result), ...result }];\n }\n case 'annotations.reorder': {\n const { type: _type, ...result } = item;\n return [{ type: 'annotations.reordered', ...result }];\n }\n case 'annotations.restore': {\n const { type: _type, ...result } = item;\n return [{ type: 'annotations.restored', ...result }];\n }\n case 'annotations.import': {\n const { type: _type, ...result } = item;\n return annotationImportFacts(result).map((fact) => ({\n type: 'annotations.created' as const,\n ...fact,\n }));\n }\n case 'forms.import': {\n const { type: _type, ...result } = item;\n return formImportFacts(result).map((fact) => ({ type: 'forms.created' as const, ...fact }));\n }\n case 'forms.importValues': {\n const { type: _type, ...result } = item;\n return formValuesImportFacts(result).map((fact) => ({\n type: 'forms.valueSet' as const,\n ...fact,\n }));\n }\n case 'forms.setValue': {\n const { type: _type, ...result } = item;\n return [{ type: 'forms.valueSet', ...result }];\n }\n case 'forms.reset': {\n const { type: _type, skipped: _skipped, ...result } = item;\n return formResetFacts(result).map((fact) => ({ type: 'forms.valueSet' as const, ...fact }));\n }\n case 'forms.setDisplay':\n case 'forms.setAppearanceText':\n case 'forms.setSignatureAppearance': {\n const { type: _type, ...result } = item;\n return [{ type: 'forms.updated', ...result }];\n }\n case 'forms.update': {\n const { type: _type, skipped: _skipped, ...result } = item;\n return [{ type: 'forms.updated', ...result }];\n }\n case 'forms.create': {\n const { type: _type, ...result } = item;\n return [{ type: 'forms.created', ...result }];\n }\n case 'forms.delete': {\n const { type: _type, ...result } = item;\n return [{ type: 'forms.deleted', deleted: deletedFieldOf(result), ...result }];\n }\n case 'forms.restore': {\n const { type: _type, ...result } = item;\n return [{ type: 'forms.restored', ...result }];\n }\n case 'forms.addWidget': {\n const { type: _type, ...result } = item;\n return [{ type: 'forms.widgetAdded', ...result }];\n }\n case 'forms.removeWidget': {\n const { type: _type, ...result } = item;\n return [{ type: 'forms.widgetRemoved', ...result }];\n }\n case 'forms.deleteWidget': {\n const { type: _type, ...result } = item;\n return [{ type: 'forms.widgetDeleted', ...result }];\n }\n case 'forms.restoreWidget': {\n const { type: _type, ...result } = item;\n return [{ type: 'forms.widgetRestored', ...result }];\n }\n case 'forms.reorderWidgets': {\n const { type: _type, ...result } = item;\n return [{ type: 'forms.widgetsReordered', ...result }];\n }\n case 'forms.reorderCalculations': {\n const { type: _type, ...result } = item;\n return [{ type: 'forms.calculationsReordered', ...result }];\n }\n case 'forms.updateWidget': {\n const { type: _type, skipped: _skipped, ...result } = item;\n return [{ type: 'forms.widgetUpdated', ...result }];\n }\n case 'metadata.update': {\n const { type: _type, skipped: _skipped, ...result } = item;\n return [{ type: 'metadata.updated', ...result }];\n }\n case 'metadata.updateCustom': {\n const { type: _type, skipped: _skipped, ...result } = item;\n return [{ type: 'metadata.customUpdated', ...result }];\n }\n }\n}\n","import type {\n DocumentAccessReason,\n DocumentSecurityState,\n PdfPermissionAdvisory,\n PdfPermissionInfo,\n} from './DocumentSecurityService';\nimport { materializePdfPermissions, type PdfBits } from '../auth/scope';\nimport type { DocumentSecurityProbeInfo } from '../wire/worker-protocol';\n\nexport interface DocumentHeadLike {\n encryption: {\n state: DocumentSecurityState['encryption']['state'];\n requiresPassword: boolean | null;\n };\n permissions: DocumentSecurityState['permissions'];\n access: DocumentSecurityState['access'];\n}\n\nexport function securityStateFromHead(head: DocumentHeadLike): DocumentSecurityState {\n return {\n encryption: {\n state: head.encryption.state,\n requiresPassword: head.encryption.requiresPassword,\n },\n permissions: { ...head.permissions },\n access: {\n required: head.access.required,\n reasons: [...head.access.reasons],\n ...(head.access.endpoint ? { endpoint: head.access.endpoint } : {}),\n },\n };\n}\n\nexport function permissionInfoFromProbe(info: DocumentSecurityProbeInfo): PdfPermissionInfo | null {\n if (info.pdfPermissionsBits === null) return null;\n return {\n known: true,\n bits: info.pdfPermissionsBits,\n allAllowed: info.pdfPermissionsAllAllowed,\n openedAs: info.pdfOpenedAs,\n securityHandlerRevision: info.securityHandlerRevision,\n };\n}\n\n/**\n * Same as {@link permissionInfoFromProbe} but additionally populates\n * `flags` (typed PdfBits view) and `advisory` (capability-shaped\n * booleans for UI badges). Used by routes that have a decoded `PdfBits`\n * in hand — notably `/access`, which always does.\n *\n * Returns `null` for the same reason as the base function — when the\n * PDF hasn't been probed yet so bits are unknown.\n */\nexport function permissionInfoWithAdvisory(\n info: DocumentSecurityProbeInfo,\n pdfBits: PdfBits,\n): PdfPermissionInfo | null {\n const base = permissionInfoFromProbe(info);\n if (!base) return null;\n return {\n ...base,\n flags: pdfBits,\n advisory: advisoryFromPdfBits(pdfBits),\n };\n}\n\n/**\n * Translate a {@link PdfBits} view into the capability-shaped\n * {@link PdfPermissionAdvisory}: what `pdf.permissions` grants on a file\n * with these bits.\n */\nexport function advisoryFromPdfBits(b: PdfBits): PdfPermissionAdvisory {\n const granted = new Set(materializePdfPermissions(b));\n return {\n canPrint: granted.has('doc.print'),\n canPrintHigh: granted.has('doc.print.high'),\n canCopy: granted.has('doc.text.copy'),\n canAnnotate: granted.has('doc.annotate.modify'),\n canFillForms: granted.has('doc.forms.fill'),\n canModifyForms: granted.has('doc.forms.modify'),\n canModifyPages: granted.has('doc.pages.modify'),\n canAssemble: granted.has('doc.pages.assemble'),\n };\n}\n\nexport function securityStateFromProbe(\n info: DocumentSecurityProbeInfo,\n opts: { accessEndpoint?: string; cdnRequired?: boolean } = {},\n): DocumentSecurityState {\n const permission = permissionInfoFromProbe(info);\n const reasons: DocumentAccessReason[] = [];\n if (info.encryptionRequiresPassword === true && !permission) reasons.push('password');\n if (opts.cdnRequired) reasons.push('cdn');\n if (info.encryptionState === 'unknown') reasons.push('permissions-unknown');\n\n return {\n encryption: {\n state: info.encryptionState,\n requiresPassword: info.encryptionRequiresPassword,\n },\n permissions: {\n known: permission?.known ?? false,\n bits: permission?.bits ?? null,\n allAllowed: permission?.allAllowed ?? null,\n openedAs: permission?.openedAs ?? null,\n securityHandlerRevision: permission?.securityHandlerRevision ?? null,\n canUpgradeToOwner: info.encryptionState === 'encrypted' && info.pdfOpenedAs !== 'owner',\n },\n access: {\n required: reasons.length > 0,\n reasons,\n ...(reasons.length > 0 && opts.accessEndpoint ? { endpoint: opts.accessEndpoint } : {}),\n },\n };\n}\n","/**\n * Where a job is on screen, and how soon it runs: the pure half of the\n * engine's scheduling. The views say what they show (`WorkingSetPage`); a\n * job's place follows from its page, the part of the page it's about, and the\n * view it serves. Nothing here names a request kind or a plugin.\n */\nimport type { CallPriority, WorkingSetPage } from './facts';\nimport type { PageBox } from '../geometry/pageSpace';\nimport type { PageRef } from '../identity/PageRef';\n\n/** Where a job's page is: on screen, placed just off it, or in no view. */\nexport type Place = 'visible' | 'near' | 'elsewhere';\n\n/** A job's place, and the device pixels of its page on screen there. */\nexport interface Placed {\n readonly place: Place;\n readonly pixels: number;\n}\n\n/** What a job is about, for its place: its page, the part of it, and the view it serves. */\nexport interface JobTarget {\n /** Absent: the job is about the whole document. */\n readonly page?: PageRef;\n /** The part of the page, in page space (a tile). Absent: the whole page. */\n readonly region?: PageBox;\n readonly view?: string;\n}\n\n/** One document's working sets: per view, the pages it shows by object number. */\nexport type ViewSets = ReadonlyMap<string, ReadonlyMap<number, WorkingSetPage>>;\n\nconst PLACE_ORDER: Record<Place, number> = { elsewhere: 0, near: 1, visible: 2 };\n\n/** More device pixels than any screen shows, so pixels never outweigh the rest of a rank. */\nconst PIXEL_SPAN = 2 ** 40;\n\n/** What {@link rank} needs to know about a job besides its place. */\nexport interface RankedJob {\n readonly priority: CallPriority;\n /** Present for a job about part of a page (a tile). */\n readonly region?: PageBox;\n}\n\nconst ELSEWHERE: Placed = { place: 'elsewhere', pixels: 0 };\nconst ON_SCREEN: Placed = { place: 'visible', pixels: 0 };\n\n/** Whether `a` is the better place: on screen before near before elsewhere, then more pixels. */\nexport function placedBefore(a: Placed, b: Placed): boolean {\n const order = PLACE_ORDER[a.place] - PLACE_ORDER[b.place];\n return order !== 0 ? order > 0 : a.pixels > b.pixels;\n}\n\n/**\n * A job's place in one view: its page's role there, except that a part of a\n * visible page that's off screen (a tile of the ring around what shows) is\n * `near`.\n */\nexport function placeIn(entry: WorkingSetPage | undefined, job: JobTarget): Placed {\n if (!entry) return ELSEWHERE;\n if (entry.role === 'near') return { place: 'near', pixels: 0 };\n if (job.region && entry.visible && !overlaps(job.region, entry.visible)) {\n return { place: 'near', pixels: 0 };\n }\n return { place: 'visible', pixels: entry.pixels };\n}\n\n/**\n * A job's place among a document's views: in the view it serves, or, when it\n * serves none (or one that said nothing), the best place its page has in any\n * view. A job about the whole document serves what's shown, so it counts as\n * on screen. While no view says anything, every job is on screen alike, and\n * jobs run in the order they were asked.\n */\nexport function placeFor(job: JobTarget, views: ViewSets): Placed {\n if (views.size === 0 || !job.page) return ON_SCREEN;\n const objectNumber = job.page.objectNumber;\n const served = job.view === undefined ? undefined : views.get(job.view);\n if (served) return placeIn(served.get(objectNumber), job);\n let best = ELSEWHERE;\n for (const pages of views.values()) {\n const placed = placeIn(pages.get(objectNumber), job);\n if (placedBefore(placed, best)) best = placed;\n }\n return best;\n}\n\n/**\n * How soon a job runs among those that may run: higher first. It compares, in\n * turn:\n * 1. background last: a `low` call is about nothing the views show;\n * 2. where its page is: on screen, then just off it, then elsewhere;\n * 3. its priority: `high` (the picture of the page itself) before `auto`;\n * 4. a whole page before a part of one: a tile is only of use once its page\n * is there;\n * 5. the device pixels its page shows.\n * Equal ranks run in the order they were asked, so a caller sequences its own work.\n */\nexport function rank(job: RankedJob, placed: Placed): number {\n let level = job.priority === 'low' ? 0 : 1;\n level = level * 3 + PLACE_ORDER[placed.place];\n level = level * 2 + (job.priority === 'high' ? 1 : 0);\n level = level * 2 + (job.region ? 0 : 1);\n return level * PIXEL_SPAN + Math.min(PIXEL_SPAN - 1, Math.round(placed.pixels));\n}\n\n/**\n * Whether rank `a` beats rank `b` on more than pixels (any of the first four\n * steps of {@link rank}). A running job gives way only to a job that clearly\n * outranks it, so two pages on screen never stop each other's work, and jobs\n * don't flip back and forth while the camera moves.\n */\nexport function clearlyOutranks(a: number, b: number): boolean {\n return Math.floor(a / PIXEL_SPAN) > Math.floor(b / PIXEL_SPAN);\n}\n\nfunction overlaps(a: PageBox, b: PageBox): boolean {\n 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;\n}\n","/**\n * Unified \"should I ask the user for a password?\" shape.\n *\n * A PDF has two distinct password moments:\n * 1. **Required** — the document is encrypted and we couldn't read\n * anything anonymously. The dev must gather a password and call\n * `unlock()` before any other operation succeeds.\n * 2. **Optional** — the document is open and readable, but more\n * permissions become available with the owner password. The dev\n * may surface an \"unlock for full access\" affordance.\n *\n * Plus the trivial third state: **none** — nothing to do.\n *\n * The discriminated union encodes the invariants:\n * - `required` and `optional` cannot both be true (a doc you can't\n * read can't be \"upgraded\" — you have to read first).\n * - `hint` is only present when meaningful (no hint in the `none` arm,\n * mandatory `owner` hint in `optional` since that's the only thing\n * an upgrade asks for).\n *\n * Computed identically on local + cloud via\n * {@link passwordPromptFromState} so the dev's UI gating code is\n * engine-agnostic.\n */\nimport type { DocumentSecurityState } from './DocumentSecurityService';\n\nexport type PasswordPrompt =\n | { readonly state: 'none' }\n | {\n readonly state: 'required';\n readonly hint: 'user' | 'owner' | null;\n /**\n * The last password tried (at `open()` or `unlock()`) was wrong, so a\n * prompt can say so. A wrong password opens the document locked, as no\n * password does: one path for \"this file needs a password\".\n */\n readonly incorrect: boolean;\n }\n | { readonly state: 'optional'; readonly hint: 'owner' };\n\n/**\n * Derive the high-level password prompt from the raw security state.\n *\n * The function is pure and total — every `DocumentSecurityState`\n * maps to exactly one `PasswordPrompt`. Use this as the single source\n * of truth wherever the SDK exposes a \"do you need a password?\" flag:\n * both `LocalDocumentSecurityService` and `CloudDocumentSecurityService`\n * call it, so the contract can never drift.\n *\n * Mapping rules (top to bottom; first match wins):\n *\n * 1. encryption.state === 'none'\n * → { state: 'none' } the document isn't encrypted\n *\n * 2. !permissions.known\n * → { state: 'required', hint: null } we haven't probed yet; can't\n * tell user-vs-owner; show\n * generic prompt\n *\n * 3. requiresPassword && openedAs === 'none'\n * → { state: 'required', hint: 'user' } encrypted, anonymous open\n * failed → user pwd needed\n *\n * 4. openedAs === 'owner'\n * → { state: 'none' } already at the top — nothing more\n * to unlock\n *\n * 5. permissions.canUpgradeToOwner === true\n * → { state: 'optional', hint: 'owner' } open as user (or as none\n * for owner-pwd-only docs)\n * but more is available\n *\n * 6. fallthrough → { state: 'none' } open and nothing more available\n */\nexport function passwordPromptFromState(\n state: DocumentSecurityState,\n incorrect = false,\n): PasswordPrompt {\n if (state.encryption.state === 'none') {\n return { state: 'none' };\n }\n\n if (!state.permissions.known) {\n return { state: 'required', hint: null, incorrect };\n }\n\n if (state.encryption.requiresPassword && state.permissions.openedAs === 'none') {\n return { state: 'required', hint: 'user', incorrect };\n }\n\n if (state.permissions.openedAs === 'owner') {\n return { state: 'none' };\n }\n\n if (state.permissions.canUpgradeToOwner) {\n return { state: 'optional', hint: 'owner' };\n }\n\n return { state: 'none' };\n}\n","/**\n * Wire-level packaging for messages crossing a Web Worker / Node\n * `worker_thread` boundary.\n *\n * `WirePack<P>` is the typed pair every producer hands to a transport:\n * the structured payload (validated against the wire schema) and an\n * explicit, ordered list of `Transferable` objects that the producer\n * intends to move (zero-copy) to the receiver.\n *\n * Why this is a first-class type and not a transport-side argument:\n *\n * - **Producer is the only one who knows.** Whether a particular\n * `ArrayBuffer` should be moved (zero-copy, sender's reference\n * detached) or copied (structured-cloned, both sides retain\n * access) is a semantic decision belonging to the code that\n * produced the buffer. Inferring it later — by walking the\n * payload looking for `ArrayBuffer` instances and assuming they\n * should all be transferred — detaches buffers the producer\n * meant to keep.\n *\n * - **Type-checked at the boundary.** A handler returning\n * `WirePack<RenderResult>` cannot forget to declare its\n * transfer list; the producer literally writes\n * `wirePack({ ..., pixels }, [pixels.buffer])` in a single\n * return statement. Forgetting yields a structurally identical\n * copy (slow but correct), never a silent leak.\n *\n * - **Symmetric across the boundary.** Same `WirePack<P>` on the\n * request path (main → worker) and the response path (worker →\n * main). Inline transports treat `transfer` as a no-op since\n * there's no thread boundary to cross.\n *\n * - **Schema-orthogonal.** Zod schemas validate `payload` and\n * nothing else. `transfer` is not data; it's a memory-ownership\n * manifest, and the design keeps those concerns separate.\n *\n * The receiver of a `postMessage(payload, { transfer })` call gets\n * the payload back **with the listed buffers already moved into it**\n * — there's no second argument on the receiving end. So `WirePack`\n * only ever travels the producer-to-transport leg of the trip; the\n * consumer side just sees the unwrapped `payload`.\n */\nexport interface WirePack<P> {\n readonly payload: P;\n readonly transfer: readonly Transferable[];\n}\n\n/**\n * Singleton empty transfer list. Frozen so accidental in-place\n * mutation throws in strict mode rather than silently mutating the\n * default for future calls.\n */\nexport const EMPTY_TRANSFER: readonly Transferable[] = Object.freeze([]);\n\n/**\n * Producer-side helper: pair a typed payload with its transfer list.\n *\n * The `transfer` argument is optional; omitting it (or passing `[]`)\n * is the explicit, type-checked way to say \"I declare this message\n * carries no transferables.\" The declaration is made at construction\n * time, in the producer's own code, where the knowledge actually lives.\n *\n * wirePack({ kind: 'metadata.read', jobId, docId })\n * wirePack({ kind: 'open.fatMem', jobId, docId, bytes }, [bytes])\n * wirePack({ tag: 'page.render', pixels }, [pixels.buffer])\n */\nexport function wirePack<P>(\n payload: P,\n transfer: readonly Transferable[] = EMPTY_TRANSFER,\n): WirePack<P> {\n return { payload, transfer };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAgCA,SAAgB,gBACd,WACA,MACA,UACY;CACZ,OAAO,WAAW,UAAU;EAC1B,IAAI,MAAM,SAAS,MAAM,SAAS,KAA2B;CAC/D,CAAC;AACH;;;;;;;;;;;;;;;;;;ACjBA,IAAa,WAAb,MAAqD;CAInD,YAGE,mBAA4D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MAAM,YAAY,mBACpB,OAAO;EAAE,OAAO;EAAY,MAAM;CAAQ;CAG5C,OAAO,EAAE,OAAO,OAAO;AACzB;;;;;;;;AC/CA,MAAa,iBAA0C,OAAO,OAAO,CAAC,CAAC;;;;;;;;;;;;;AAcvE,SAAgB,SACd,SACA,WAAoC,gBACvB;CACb,OAAO;EAAE;EAAS;CAAS;AAC7B"}
|
|
1
|
+
{"version":3,"file":"runtime.cjs","names":["isSkippedItem","deletedAnnotationsOf","annotationImportFacts","formImportFacts","formValuesImportFacts","formResetFacts","deletedFieldOf","deletedOutlineItemsOf","deletedAttachmentOf","materializePdfPermissions","AbortablePromise","EngineError","EngineErrorCode","normalizeAttachmentFileSource","AbortablePromise","EngineError","EngineErrorCode","AbortablePromise","EngineError","EngineErrorCode"],"sources":["../src/events/DocumentEventStream.ts","../src/events/EventHub.ts","../src/events/changeEvents.ts","../src/engine/document-security-state.ts","../src/scheduling/place.ts","../src/engine/passwordPrompt.ts","../src/engine/attachmentVerbs.ts","../src/engine/outlineVerbs.ts","../src/engine/pageVerbs.ts","../src/wire/WirePack.ts"],"sourcesContent":["import type { DocumentEvent, DocumentEventOf, DocumentEventType } from './DocumentEvent';\n\n/**\n * The subscription surface on `DocumentHandle.events`: every event with\n * `subscribe`, one type with `on`. No replay-from-id: plugins build their\n * own filter wrappers (per-page, …) on top.\n *\n * Delivery is synchronous fan-out with error isolation: a throwing\n * listener never blocks other listeners, and never fails the mutation\n * whose confirmation produced the event.\n */\nexport interface DocumentEventStream {\n /** Subscribe to every event for this document. Returns the unsubscriber. */\n subscribe(listener: (event: DocumentEvent) => void): () => void;\n /** Subscribe to one type of event, typed by it. Returns the unsubscriber. */\n on<T extends DocumentEventType>(\n type: T,\n listener: (event: DocumentEventOf<T>) => void,\n ): () => void;\n /**\n * Highest `origin.serverId` observed so far — the reconnect/backfill\n * cursor for the remote channel. `null` until a remote-identified event\n * has been seen (always `null` on purely-local engines).\n */\n lastServerId(): number | null;\n}\n\n/**\n * `on(type, listener)` built on a stream's `subscribe`, so both engines\n * filter the same way and a type listener counts as a subscriber (the cloud\n * opens its live stream for the first one).\n */\nexport function subscribeToType<T extends DocumentEventType>(\n subscribe: DocumentEventStream['subscribe'],\n type: T,\n listener: (event: DocumentEventOf<T>) => void,\n): () => void {\n return subscribe((event) => {\n if (event.type === type) listener(event as DocumentEventOf<T>);\n });\n}\n","import type {\n DocumentEvent,\n DocumentEventInit,\n DocumentEventOf,\n DocumentEventType,\n} from './DocumentEvent';\nimport { subscribeToType, type DocumentEventStream } from './DocumentEventStream';\n\n/**\n * The in-process implementation of `DocumentEventStream`, shared by both\n * engine shells (one hub per open `DocumentHandle`). The engine that\n * performs a mutation publishes here at confirmation time; the cloud\n * engine's remote channel will also publish here for other sessions'\n * mutations — listeners never learn which transport delivered an event.\n *\n * Delivery contract:\n * - synchronous fan-out in subscription order;\n * - error isolation: a throwing listener is re-thrown on a microtask\n * (so it surfaces to the host's unhandled-error reporting) without\n * blocking other listeners or failing the mutation path;\n * - `lastServerId` tracks the highest remote cursor seen, for the\n * remote channel's reconnect/backfill.\n */\nexport class EventHub implements DocumentEventStream {\n private readonly listeners = new Set<(event: DocumentEvent) => void>();\n private serverId: number | null = null;\n\n constructor(\n /** Where a throwing listener's error goes. Defaults to an async\n * rethrow so it reaches the host's unhandled-error reporting. */\n private readonly onListenerError: (err: unknown) => void = (err) => {\n queueMicrotask(() => {\n throw err;\n });\n },\n ) {}\n\n subscribe(listener: (event: DocumentEvent) => void): () => void {\n this.listeners.add(listener);\n return () => {\n this.listeners.delete(listener);\n };\n }\n\n on<T extends DocumentEventType>(\n type: T,\n listener: (event: DocumentEventOf<T>) => void,\n ): () => void {\n return subscribeToType((all) => this.subscribe(all), type, listener);\n }\n\n publish(event: DocumentEvent): void {\n // Transport notices (`stream.desynced`) carry no origin; only mutation\n // events advance the server cursor.\n if ('origin' in event) {\n const { serverId } = event.origin;\n if (serverId !== null) {\n this.serverId = this.serverId === null ? serverId : Math.max(this.serverId, serverId);\n }\n }\n // Snapshot so a listener that (un)subscribes mid-fan-out cannot skew\n // delivery for this event.\n for (const listener of [...this.listeners]) {\n try {\n listener(event);\n } catch (err) {\n this.onListenerError(err);\n }\n }\n }\n\n lastServerId(): number | null {\n return this.serverId;\n }\n\n /** Drop every listener (handle close). Idempotent. */\n clear(): void {\n this.listeners.clear();\n }\n}\n\n/**\n * Stamps provenance onto events a mutation path produces. One per open\n * handle: the engine shell constructs it with the instance's `sessionId`\n * (and, on cloud, the authenticated `sub` when known) and hands it to the\n * mutation services — they publish results, never build origins.\n */\nexport class SessionEventPublisher {\n constructor(\n private readonly hub: EventHub,\n private readonly sessionId: string,\n private readonly sub: string | null = null,\n ) {}\n\n /**\n * Publish what one write of this session just committed: one\n * event per fact, in order, all carrying the write's `opId` as\n * `origin.tx`.\n */\n publishWrite(opId: string, ...events: DocumentEventInit[]): void {\n this.publishChange(opId, events);\n }\n\n /**\n * Publish what one change committed: its events as {@link publishWrite}\n * does, and for an undo, the `opId` of the change it undid.\n */\n publishChange(opId: string, events: readonly DocumentEventInit[], undoOf?: string): void {\n const ts = Date.now();\n events.forEach((event, index) => {\n this.hub.publish({\n ...event,\n origin: {\n kind: 'local',\n sessionId: this.sessionId,\n sub: this.sub,\n ts,\n serverId: null,\n tx: { id: opId, index, count: events.length },\n ...(undoOf !== undefined ? { undoOf } : {}),\n },\n } as DocumentEvent);\n });\n }\n}\n","import type { DocumentEventInit } from './DocumentEvent';\nimport { deletedAnnotationsOf } from '../mutation/AnnotationMutationResults';\nimport { deletedAttachmentOf } from '../mutation/AttachmentMutationResults';\nimport { isSkippedItem, type ChangeItem, type ChangeResult } from '../mutation/Change';\nimport { deletedFieldOf, formResetFacts } from '../mutation/FormMutationResults';\nimport { deletedOutlineItemsOf } from '../mutation/OutlineMutationResults';\nimport { annotationImportFacts } from '../transfer/annotationImport';\nimport { formImportFacts, formValuesImportFacts } from '../transfer/formImport';\n\n/**\n * The events a change publishes: each op's events as its single verb\n * publishes them, in op order. An op an undo left alone entirely publishes\n * nothing. The publisher stamps them all with the change's `opId`.\n */\nexport function changeEvents(result: ChangeResult): DocumentEventInit[] {\n return result.items.flatMap(itemEvents);\n}\n\nfunction itemEvents(item: ChangeItem): DocumentEventInit[] {\n if (isSkippedItem(item)) return [];\n switch (item.type) {\n case 'annotations.create': {\n const { type: _type, ...result } = item;\n return [{ type: 'annotations.created', ...result }];\n }\n case 'annotations.update': {\n const { type: _type, skipped: _skipped, ...result } = item;\n return [{ type: 'annotations.updated', ...result }];\n }\n case 'annotations.delete': {\n const { type: _type, ...result } = item;\n return [{ type: 'annotations.deleted', deleted: deletedAnnotationsOf(result), ...result }];\n }\n case 'annotations.reorder': {\n const { type: _type, ...result } = item;\n return [{ type: 'annotations.reordered', ...result }];\n }\n case 'annotations.restore': {\n const { type: _type, ...result } = item;\n return [{ type: 'annotations.restored', ...result }];\n }\n case 'annotations.import': {\n const { type: _type, ...result } = item;\n return annotationImportFacts(result).map((fact) => ({\n type: 'annotations.created' as const,\n ...fact,\n }));\n }\n case 'forms.import': {\n const { type: _type, ...result } = item;\n return formImportFacts(result).map((fact) => ({ type: 'forms.created' as const, ...fact }));\n }\n case 'forms.importValues': {\n const { type: _type, ...result } = item;\n return formValuesImportFacts(result).map((fact) => ({\n type: 'forms.valueSet' as const,\n ...fact,\n }));\n }\n case 'forms.setValue': {\n const { type: _type, ...result } = item;\n return [{ type: 'forms.valueSet', ...result }];\n }\n case 'forms.reset': {\n const { type: _type, skipped: _skipped, ...result } = item;\n return formResetFacts(result).map((fact) => ({ type: 'forms.valueSet' as const, ...fact }));\n }\n case 'forms.setDisplay':\n case 'forms.setAppearanceText':\n case 'forms.setSignatureAppearance': {\n const { type: _type, ...result } = item;\n return [{ type: 'forms.updated', ...result }];\n }\n case 'forms.update': {\n const { type: _type, skipped: _skipped, ...result } = item;\n return [{ type: 'forms.updated', ...result }];\n }\n case 'forms.create': {\n const { type: _type, ...result } = item;\n return [{ type: 'forms.created', ...result }];\n }\n case 'forms.delete': {\n const { type: _type, ...result } = item;\n return [{ type: 'forms.deleted', deleted: deletedFieldOf(result), ...result }];\n }\n case 'forms.restore': {\n const { type: _type, ...result } = item;\n return [{ type: 'forms.restored', ...result }];\n }\n case 'forms.addWidget': {\n const { type: _type, ...result } = item;\n return [{ type: 'forms.widgetAdded', ...result }];\n }\n case 'forms.removeWidget': {\n const { type: _type, ...result } = item;\n return [{ type: 'forms.widgetRemoved', ...result }];\n }\n case 'forms.deleteWidget': {\n const { type: _type, ...result } = item;\n return [{ type: 'forms.widgetDeleted', ...result }];\n }\n case 'forms.restoreWidget': {\n const { type: _type, ...result } = item;\n return [{ type: 'forms.widgetRestored', ...result }];\n }\n case 'forms.reorderWidgets': {\n const { type: _type, ...result } = item;\n return [{ type: 'forms.widgetsReordered', ...result }];\n }\n case 'forms.reorderCalculations': {\n const { type: _type, ...result } = item;\n return [{ type: 'forms.calculationsReordered', ...result }];\n }\n case 'forms.updateWidget': {\n const { type: _type, skipped: _skipped, ...result } = item;\n return [{ type: 'forms.widgetUpdated', ...result }];\n }\n case 'metadata.update': {\n const { type: _type, skipped: _skipped, ...result } = item;\n return [{ type: 'metadata.updated', ...result }];\n }\n case 'metadata.updateCustom': {\n const { type: _type, skipped: _skipped, ...result } = item;\n return [{ type: 'metadata.customUpdated', ...result }];\n }\n case 'outline.create': {\n const { type: _type, ...result } = item;\n return [{ type: 'outline.created', ...result }];\n }\n case 'outline.update': {\n const { type: _type, skipped: _skipped, ...result } = item;\n return [{ type: 'outline.updated', ...result }];\n }\n case 'outline.move': {\n const { type: _type, ...result } = item;\n return [{ type: 'outline.moved', ...result }];\n }\n case 'outline.delete': {\n const { type: _type, ...result } = item;\n return [{ type: 'outline.deleted', deleted: deletedOutlineItemsOf(result), ...result }];\n }\n case 'outline.restore': {\n const { type: _type, ...result } = item;\n return [{ type: 'outline.restored', ...result }];\n }\n case 'pages.rotate': {\n const { type: _type, ...result } = item;\n return [{ type: 'pages.rotated', ...result }];\n }\n case 'pages.reorder': {\n const { type: _type, ...result } = item;\n return [{ type: 'pages.reordered', ...result }];\n }\n case 'pages.delete': {\n const { type: _type, ...result } = item;\n return [{ type: 'pages.deleted', ...result }];\n }\n case 'pages.insertBlank':\n case 'pages.insert': {\n const { type: _type, ...result } = item;\n return [{ type: 'pages.inserted', ...result }];\n }\n case 'pages.restore': {\n const { type: _type, ...result } = item;\n return [{ type: 'pages.restored', ...result }];\n }\n case 'attachments.create': {\n const { type: _type, ...result } = item;\n return [{ type: 'attachments.created', ...result }];\n }\n case 'attachments.delete': {\n const { type: _type, ...result } = item;\n return [{ type: 'attachments.deleted', deleted: deletedAttachmentOf(result), ...result }];\n }\n case 'attachments.restore': {\n const { type: _type, ...result } = item;\n return [{ type: 'attachments.restored', ...result }];\n }\n }\n}\n","import type {\n DocumentAccessReason,\n DocumentSecurityState,\n PdfPermissionAdvisory,\n PdfPermissionInfo,\n} from './DocumentSecurityService';\nimport { materializePdfPermissions, type PdfBits } from '../auth/scope';\nimport type { DocumentSecurityProbeInfo } from '../wire/worker-protocol';\n\nexport interface DocumentHeadLike {\n encryption: {\n state: DocumentSecurityState['encryption']['state'];\n requiresPassword: boolean | null;\n };\n permissions: DocumentSecurityState['permissions'];\n access: DocumentSecurityState['access'];\n}\n\nexport function securityStateFromHead(head: DocumentHeadLike): DocumentSecurityState {\n return {\n encryption: {\n state: head.encryption.state,\n requiresPassword: head.encryption.requiresPassword,\n },\n permissions: { ...head.permissions },\n access: {\n required: head.access.required,\n reasons: [...head.access.reasons],\n ...(head.access.endpoint ? { endpoint: head.access.endpoint } : {}),\n },\n };\n}\n\nexport function permissionInfoFromProbe(info: DocumentSecurityProbeInfo): PdfPermissionInfo | null {\n if (info.pdfPermissionsBits === null) return null;\n return {\n known: true,\n bits: info.pdfPermissionsBits,\n allAllowed: info.pdfPermissionsAllAllowed,\n openedAs: info.pdfOpenedAs,\n securityHandlerRevision: info.securityHandlerRevision,\n };\n}\n\n/**\n * Same as {@link permissionInfoFromProbe} but additionally populates\n * `flags` (typed PdfBits view) and `advisory` (capability-shaped\n * booleans for UI badges). Used by routes that have a decoded `PdfBits`\n * in hand — notably `/access`, which always does.\n *\n * Returns `null` for the same reason as the base function — when the\n * PDF hasn't been probed yet so bits are unknown.\n */\nexport function permissionInfoWithAdvisory(\n info: DocumentSecurityProbeInfo,\n pdfBits: PdfBits,\n): PdfPermissionInfo | null {\n const base = permissionInfoFromProbe(info);\n if (!base) return null;\n return {\n ...base,\n flags: pdfBits,\n advisory: advisoryFromPdfBits(pdfBits),\n };\n}\n\n/**\n * Translate a {@link PdfBits} view into the capability-shaped\n * {@link PdfPermissionAdvisory}: what `pdf.permissions` grants on a file\n * with these bits.\n */\nexport function advisoryFromPdfBits(b: PdfBits): PdfPermissionAdvisory {\n const granted = new Set(materializePdfPermissions(b));\n return {\n canPrint: granted.has('doc.print'),\n canPrintHigh: granted.has('doc.print.high'),\n canCopy: granted.has('doc.text.copy'),\n canAnnotate: granted.has('doc.annotate.modify'),\n canFillForms: granted.has('doc.forms.fill'),\n canModifyForms: granted.has('doc.forms.modify'),\n canModifyPages: granted.has('doc.pages.modify'),\n canAssemble: granted.has('doc.pages.assemble'),\n };\n}\n\nexport function securityStateFromProbe(\n info: DocumentSecurityProbeInfo,\n opts: { accessEndpoint?: string; cdnRequired?: boolean } = {},\n): DocumentSecurityState {\n const permission = permissionInfoFromProbe(info);\n const reasons: DocumentAccessReason[] = [];\n if (info.encryptionRequiresPassword === true && !permission) reasons.push('password');\n if (opts.cdnRequired) reasons.push('cdn');\n if (info.encryptionState === 'unknown') reasons.push('permissions-unknown');\n\n return {\n encryption: {\n state: info.encryptionState,\n requiresPassword: info.encryptionRequiresPassword,\n },\n permissions: {\n known: permission?.known ?? false,\n bits: permission?.bits ?? null,\n allAllowed: permission?.allAllowed ?? null,\n openedAs: permission?.openedAs ?? null,\n securityHandlerRevision: permission?.securityHandlerRevision ?? null,\n canUpgradeToOwner: info.encryptionState === 'encrypted' && info.pdfOpenedAs !== 'owner',\n },\n access: {\n required: reasons.length > 0,\n reasons,\n ...(reasons.length > 0 && opts.accessEndpoint ? { endpoint: opts.accessEndpoint } : {}),\n },\n };\n}\n","/**\n * Where a job is on screen, and how soon it runs: the pure half of the\n * engine's scheduling. The views say what they show (`WorkingSetPage`); a\n * job's place follows from its page, the part of the page it's about, and the\n * view it serves. Nothing here names a request kind or a plugin.\n */\nimport type { CallPriority, WorkingSetPage } from './facts';\nimport type { PageBox } from '../geometry/pageSpace';\nimport type { PageRef } from '../identity/PageRef';\n\n/** Where a job's page is: on screen, placed just off it, or in no view. */\nexport type Place = 'visible' | 'near' | 'elsewhere';\n\n/** A job's place, and the device pixels of its page on screen there. */\nexport interface Placed {\n readonly place: Place;\n readonly pixels: number;\n}\n\n/** What a job is about, for its place: its page, the part of it, and the view it serves. */\nexport interface JobTarget {\n /** Absent: the job is about the whole document. */\n readonly page?: PageRef;\n /** The part of the page, in page space (a tile). Absent: the whole page. */\n readonly region?: PageBox;\n readonly view?: string;\n}\n\n/** One document's working sets: per view, the pages it shows by object number. */\nexport type ViewSets = ReadonlyMap<string, ReadonlyMap<number, WorkingSetPage>>;\n\nconst PLACE_ORDER: Record<Place, number> = { elsewhere: 0, near: 1, visible: 2 };\n\n/** More device pixels than any screen shows, so pixels never outweigh the rest of a rank. */\nconst PIXEL_SPAN = 2 ** 40;\n\n/** What {@link rank} needs to know about a job besides its place. */\nexport interface RankedJob {\n readonly priority: CallPriority;\n /** Present for a job about part of a page (a tile). */\n readonly region?: PageBox;\n}\n\nconst ELSEWHERE: Placed = { place: 'elsewhere', pixels: 0 };\nconst ON_SCREEN: Placed = { place: 'visible', pixels: 0 };\n\n/** Whether `a` is the better place: on screen before near before elsewhere, then more pixels. */\nexport function placedBefore(a: Placed, b: Placed): boolean {\n const order = PLACE_ORDER[a.place] - PLACE_ORDER[b.place];\n return order !== 0 ? order > 0 : a.pixels > b.pixels;\n}\n\n/**\n * A job's place in one view: its page's role there, except that a part of a\n * visible page that's off screen (a tile of the ring around what shows) is\n * `near`.\n */\nexport function placeIn(entry: WorkingSetPage | undefined, job: JobTarget): Placed {\n if (!entry) return ELSEWHERE;\n if (entry.role === 'near') return { place: 'near', pixels: 0 };\n if (job.region && entry.visible && !overlaps(job.region, entry.visible)) {\n return { place: 'near', pixels: 0 };\n }\n return { place: 'visible', pixels: entry.pixels };\n}\n\n/**\n * A job's place among a document's views: in the view it serves, or, when it\n * serves none (or one that said nothing), the best place its page has in any\n * view. A job about the whole document serves what's shown, so it counts as\n * on screen. While no view says anything, every job is on screen alike, and\n * jobs run in the order they were asked.\n */\nexport function placeFor(job: JobTarget, views: ViewSets): Placed {\n if (views.size === 0 || !job.page) return ON_SCREEN;\n const objectNumber = job.page.objectNumber;\n const served = job.view === undefined ? undefined : views.get(job.view);\n if (served) return placeIn(served.get(objectNumber), job);\n let best = ELSEWHERE;\n for (const pages of views.values()) {\n const placed = placeIn(pages.get(objectNumber), job);\n if (placedBefore(placed, best)) best = placed;\n }\n return best;\n}\n\n/**\n * How soon a job runs among those that may run: higher first. It compares, in\n * turn:\n * 1. background last: a `low` call is about nothing the views show;\n * 2. where its page is: on screen, then just off it, then elsewhere;\n * 3. its priority: `high` (the picture of the page itself) before `auto`;\n * 4. a whole page before a part of one: a tile is only of use once its page\n * is there;\n * 5. the device pixels its page shows.\n * Equal ranks run in the order they were asked, so a caller sequences its own work.\n */\nexport function rank(job: RankedJob, placed: Placed): number {\n let level = job.priority === 'low' ? 0 : 1;\n level = level * 3 + PLACE_ORDER[placed.place];\n level = level * 2 + (job.priority === 'high' ? 1 : 0);\n level = level * 2 + (job.region ? 0 : 1);\n return level * PIXEL_SPAN + Math.min(PIXEL_SPAN - 1, Math.round(placed.pixels));\n}\n\n/**\n * Whether rank `a` beats rank `b` on more than pixels (any of the first four\n * steps of {@link rank}). A running job gives way only to a job that clearly\n * outranks it, so two pages on screen never stop each other's work, and jobs\n * don't flip back and forth while the camera moves.\n */\nexport function clearlyOutranks(a: number, b: number): boolean {\n return Math.floor(a / PIXEL_SPAN) > Math.floor(b / PIXEL_SPAN);\n}\n\nfunction overlaps(a: PageBox, b: PageBox): boolean {\n 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;\n}\n","/**\n * Unified \"should I ask the user for a password?\" shape.\n *\n * A PDF has two distinct password moments:\n * 1. **Required** — the document is encrypted and we couldn't read\n * anything anonymously. The dev must gather a password and call\n * `unlock()` before any other operation succeeds.\n * 2. **Optional** — the document is open and readable, but more\n * permissions become available with the owner password. The dev\n * may surface an \"unlock for full access\" affordance.\n *\n * Plus the trivial third state: **none** — nothing to do.\n *\n * The discriminated union encodes the invariants:\n * - `required` and `optional` cannot both be true (a doc you can't\n * read can't be \"upgraded\" — you have to read first).\n * - `hint` is only present when meaningful (no hint in the `none` arm,\n * mandatory `owner` hint in `optional` since that's the only thing\n * an upgrade asks for).\n *\n * Computed identically on local + cloud via\n * {@link passwordPromptFromState} so the dev's UI gating code is\n * engine-agnostic.\n */\nimport type { DocumentSecurityState } from './DocumentSecurityService';\n\nexport type PasswordPrompt =\n | { readonly state: 'none' }\n | {\n readonly state: 'required';\n readonly hint: 'user' | 'owner' | null;\n /**\n * The last password tried (at `open()` or `unlock()`) was wrong, so a\n * prompt can say so. A wrong password opens the document locked, as no\n * password does: one path for \"this file needs a password\".\n */\n readonly incorrect: boolean;\n }\n | { readonly state: 'optional'; readonly hint: 'owner' };\n\n/**\n * Derive the high-level password prompt from the raw security state.\n *\n * The function is pure and total — every `DocumentSecurityState`\n * maps to exactly one `PasswordPrompt`. Use this as the single source\n * of truth wherever the SDK exposes a \"do you need a password?\" flag:\n * both `LocalDocumentSecurityService` and `CloudDocumentSecurityService`\n * call it, so the contract can never drift.\n *\n * Mapping rules (top to bottom; first match wins):\n *\n * 1. encryption.state === 'none'\n * → { state: 'none' } the document isn't encrypted\n *\n * 2. !permissions.known\n * → { state: 'required', hint: null } we haven't probed yet; can't\n * tell user-vs-owner; show\n * generic prompt\n *\n * 3. requiresPassword && openedAs === 'none'\n * → { state: 'required', hint: 'user' } encrypted, anonymous open\n * failed → user pwd needed\n *\n * 4. openedAs === 'owner'\n * → { state: 'none' } already at the top — nothing more\n * to unlock\n *\n * 5. permissions.canUpgradeToOwner === true\n * → { state: 'optional', hint: 'owner' } open as user (or as none\n * for owner-pwd-only docs)\n * but more is available\n *\n * 6. fallthrough → { state: 'none' } open and nothing more available\n */\nexport function passwordPromptFromState(\n state: DocumentSecurityState,\n incorrect = false,\n): PasswordPrompt {\n if (state.encryption.state === 'none') {\n return { state: 'none' };\n }\n\n if (!state.permissions.known) {\n return { state: 'required', hint: null, incorrect };\n }\n\n if (state.encryption.requiresPassword && state.permissions.openedAs === 'none') {\n return { state: 'required', hint: 'user', incorrect };\n }\n\n if (state.permissions.openedAs === 'owner') {\n return { state: 'none' };\n }\n\n if (state.permissions.canUpgradeToOwner) {\n return { state: 'optional', hint: 'owner' };\n }\n\n return { state: 'none' };\n}\n","import type { DocumentAttachmentsService } from './DocumentAttachmentsService';\nimport { normalizeAttachmentFileSource } from '../dto/normalizeAttachmentFileSource';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport type { Change, ChangeItem, ChangeOp, ChangeResult } from '../mutation/Change';\nimport type { WriteOptions } from '../mutation/WriteOptions';\nimport { AbortablePromise } from '../promise/AbortablePromise';\n\n/** The verbs of `doc.attachments` that change the document: each one op of a change. */\nexport type AttachmentWriteVerb = 'create' | 'delete';\n\n/** The ops the write verbs make. */\ntype AttachmentOpType = Extract<ChangeOp['type'], `attachments.${string}`>;\n\n/**\n * `doc.attachments` on any engine: the reads `rest` holds (`list`,\n * `download`), and each write as a one-op change through `apply`, so a verb\n * has its op's checks, events and undo (its `opId` undoes it) and answers as\n * its single verb did.\n */\nexport function attachmentVerbs(\n rest: Omit<DocumentAttachmentsService, AttachmentWriteVerb>,\n apply: (change: Change, options?: WriteOptions) => AbortablePromise<ChangeResult>,\n): DocumentAttachmentsService {\n const one = <T extends AttachmentOpType, Answer>(\n op: () => Promise<Extract<ChangeOp, { type: T }>>,\n type: T,\n options: WriteOptions | undefined,\n answer: (item: Extract<ChangeItem, { type: T }>) => Answer,\n ): AbortablePromise<Answer> =>\n AbortablePromise.run(async (signal) => {\n const result = await apply(\n { ops: [await op()] },\n options?.opId === undefined ? {} : { opId: options.opId },\n ).abortWith(signal);\n const item = result.items[0];\n // A fresh op is never skipped: only an undo leaves one alone.\n if (!item || item.type !== type) {\n throw new EngineError(EngineErrorCode.Unknown, `${type} wrote nothing`);\n }\n return answer(item as Extract<ChangeItem, { type: T }>);\n });\n\n return {\n list: () => rest.list(),\n download: (ref) => rest.download(ref),\n create: (file, options) =>\n one(\n async () => {\n // A `File` brings its own name and type; a file needs a name.\n const { wireFile, resource } = await normalizeAttachmentFileSource(file, 'file');\n const { resources: _resources, ...metadata } = wireFile;\n return {\n type: 'attachments.create',\n file: metadata,\n resources: { file: new Uint8Array(resource.bytes) },\n };\n },\n 'attachments.create',\n options,\n (item) => ({ attachment: item.attachment, meta: item.meta }),\n ),\n delete: (ref, options) =>\n one(\n async () => ({ type: 'attachments.delete', ref }),\n 'attachments.delete',\n options,\n (item) => ({ meta: item.meta }),\n ),\n };\n}\n","import type { DocumentOutlineService } from './DocumentOutlineService';\nimport type { DocumentOutline } from '../dto/DocumentOutline';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport type { Change, ChangeOp, ChangeResult } from '../mutation/Change';\nimport type {\n OutlineCreateResult,\n OutlineDeleteResult,\n OutlineMoveResult,\n OutlineUpdateResult,\n} from '../mutation/OutlineMutationResults';\nimport type { WriteOptions } from '../mutation/WriteOptions';\nimport { AbortablePromise } from '../promise/AbortablePromise';\n\n/** What each verb answers: its op's item without the item's own fields. */\ninterface Answers {\n 'outline.create': OutlineCreateResult;\n 'outline.update': OutlineUpdateResult;\n 'outline.move': OutlineMoveResult;\n 'outline.delete': OutlineDeleteResult;\n}\n\n/**\n * `doc.outline` on any engine: its read, and each verb as a one-op change\n * through `apply`, so a verb has its op's checks, events and undo (its\n * `opId` undoes it) and answers with the op's item.\n */\nexport function outlineVerbs(\n get: () => AbortablePromise<DocumentOutline>,\n apply: (change: Change, options?: WriteOptions) => AbortablePromise<ChangeResult>,\n): DocumentOutlineService {\n const one = <T extends keyof Answers>(\n op: Extract<ChangeOp, { type: T }>,\n options: WriteOptions | undefined,\n ): AbortablePromise<Answers[T]> =>\n AbortablePromise.run(async (signal) => {\n const result = await apply(\n { ops: [op] },\n options?.opId === undefined ? {} : { opId: options.opId },\n ).abortWith(signal);\n const type = (op as ChangeOp).type;\n const item = result.items[0];\n if (!item || item.type !== type) {\n throw new EngineError(EngineErrorCode.Unknown, `${type} wrote nothing`);\n }\n // A fresh op is never skipped: `skipped` rides only an undo's item.\n const {\n type: _type,\n skipped: _skipped,\n ...answer\n } = item as unknown as {\n type: T;\n skipped?: unknown;\n };\n return answer as unknown as Answers[T];\n });\n return {\n get,\n create: (data, options) =>\n one(\n {\n type: 'outline.create',\n parent: options?.parent ?? null,\n data,\n ...(options?.position === undefined ? {} : { position: options.position }),\n ...(options?.objectNumber === undefined ? {} : { objectNumber: options.objectNumber }),\n },\n options,\n ),\n update: (ref, patch, options) => one({ type: 'outline.update', ref, patch }, options),\n move: (refs, parent, position, options) =>\n one({ type: 'outline.move', refs, parent, position }, options),\n delete: (ref, options) => one({ type: 'outline.delete', ref }, options),\n };\n}\n","import type { DocumentPagesService } from './DocumentPagesService';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport type { Change, ChangeItem, ChangeOp, ChangeResult } from '../mutation/Change';\nimport type { WriteOptions } from '../mutation/WriteOptions';\nimport { AbortablePromise } from '../promise/AbortablePromise';\n\n/** The verbs of `doc.pages` that change the page structure: each one op of a change. */\nexport type PageStructureVerb = 'reorder' | 'rotate' | 'delete' | 'insert' | 'insertBlank';\n\n/** The ops the structure verbs make. */\ntype PageOpType = Extract<ChangeOp['type'], `pages.${string}`>;\n\n/**\n * `doc.pages` on any engine: what `rest` holds (the reads, extract, flatten\n * and the page names), and each structure verb as a one-op change through\n * `apply`, so a verb has its op's checks, events and undo (its `opId` undoes\n * it) and answers as its single verb did.\n */\nexport function pageVerbs(\n rest: Omit<DocumentPagesService, PageStructureVerb>,\n apply: (change: Change, options?: WriteOptions) => AbortablePromise<ChangeResult>,\n): DocumentPagesService {\n const one = <T extends PageOpType, Answer>(\n op: Extract<ChangeOp, { type: T }>,\n options: WriteOptions | undefined,\n answer: (item: Extract<ChangeItem, { type: T }>) => Answer,\n ): AbortablePromise<Answer> =>\n AbortablePromise.run(async (signal) => {\n const result = await apply(\n { ops: [op] },\n options?.opId === undefined ? {} : { opId: options.opId },\n ).abortWith(signal);\n const type = (op as ChangeOp).type;\n const item = result.items[0];\n // A fresh op is never skipped: only an undo leaves one alone.\n if (!item || item.type !== type) {\n throw new EngineError(EngineErrorCode.Unknown, `${type} wrote nothing`);\n }\n return answer(item as Extract<ChangeItem, { type: T }>);\n });\n\n return {\n list: () => rest.list(),\n setName: (input, options) => rest.setName(input, options),\n removeName: (input, options) => rest.removeName(input, options),\n flatten: (pages, options) => rest.flatten(pages, options),\n extract: (pages, options) => rest.extract(pages, options),\n reorder: (pages, position, options) =>\n one({ type: 'pages.reorder', pages, position }, options, (item) => ({\n pages: item.pages,\n layout: item.layout,\n meta: item.meta,\n })),\n rotate: (pages, rotation, options) =>\n one({ type: 'pages.rotate', pages, rotation }, options, (item) => ({\n layout: item.layout,\n meta: item.meta,\n })),\n delete: (pages, options) =>\n one({ type: 'pages.delete', pages }, options, (item) => ({\n layout: item.layout,\n meta: item.meta,\n })),\n insert: (bytes, position, options) =>\n one(\n {\n type: 'pages.insert',\n source: bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes),\n ...(position === undefined ? {} : { position }),\n },\n options,\n (item) => ({ insertedPages: item.insertedPages, layout: item.layout, meta: item.meta }),\n ),\n insertBlank: (spec, position, options) =>\n one(\n {\n type: 'pages.insertBlank',\n spec,\n ...(position === undefined ? {} : { position }),\n ...(options?.objectNumbers === undefined ? {} : { objectNumbers: options.objectNumbers }),\n },\n options,\n (item) => ({ insertedPages: item.insertedPages, layout: item.layout, meta: item.meta }),\n ),\n };\n}\n","/**\n * Wire-level packaging for messages crossing a Web Worker / Node\n * `worker_thread` boundary.\n *\n * `WirePack<P>` is the typed pair every producer hands to a transport:\n * the structured payload (validated against the wire schema) and an\n * explicit, ordered list of `Transferable` objects that the producer\n * intends to move (zero-copy) to the receiver.\n *\n * Why this is a first-class type and not a transport-side argument:\n *\n * - **Producer is the only one who knows.** Whether a particular\n * `ArrayBuffer` should be moved (zero-copy, sender's reference\n * detached) or copied (structured-cloned, both sides retain\n * access) is a semantic decision belonging to the code that\n * produced the buffer. Inferring it later — by walking the\n * payload looking for `ArrayBuffer` instances and assuming they\n * should all be transferred — detaches buffers the producer\n * meant to keep.\n *\n * - **Type-checked at the boundary.** A handler returning\n * `WirePack<RenderResult>` cannot forget to declare its\n * transfer list; the producer literally writes\n * `wirePack({ ..., pixels }, [pixels.buffer])` in a single\n * return statement. Forgetting yields a structurally identical\n * copy (slow but correct), never a silent leak.\n *\n * - **Symmetric across the boundary.** Same `WirePack<P>` on the\n * request path (main → worker) and the response path (worker →\n * main). Inline transports treat `transfer` as a no-op since\n * there's no thread boundary to cross.\n *\n * - **Schema-orthogonal.** Zod schemas validate `payload` and\n * nothing else. `transfer` is not data; it's a memory-ownership\n * manifest, and the design keeps those concerns separate.\n *\n * The receiver of a `postMessage(payload, { transfer })` call gets\n * the payload back **with the listed buffers already moved into it**\n * — there's no second argument on the receiving end. So `WirePack`\n * only ever travels the producer-to-transport leg of the trip; the\n * consumer side just sees the unwrapped `payload`.\n */\nexport interface WirePack<P> {\n readonly payload: P;\n readonly transfer: readonly Transferable[];\n}\n\n/**\n * Singleton empty transfer list. Frozen so accidental in-place\n * mutation throws in strict mode rather than silently mutating the\n * default for future calls.\n */\nexport const EMPTY_TRANSFER: readonly Transferable[] = Object.freeze([]);\n\n/**\n * Producer-side helper: pair a typed payload with its transfer list.\n *\n * The `transfer` argument is optional; omitting it (or passing `[]`)\n * is the explicit, type-checked way to say \"I declare this message\n * carries no transferables.\" The declaration is made at construction\n * time, in the producer's own code, where the knowledge actually lives.\n *\n * wirePack({ kind: 'metadata.read', jobId, docId })\n * wirePack({ kind: 'open.fatMem', jobId, docId, bytes }, [bytes])\n * wirePack({ tag: 'page.render', pixels }, [pixels.buffer])\n */\nexport function wirePack<P>(\n payload: P,\n transfer: readonly Transferable[] = EMPTY_TRANSFER,\n): WirePack<P> {\n return { payload, transfer };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAgCA,SAAgB,gBACd,WACA,MACA,UACY;CACZ,OAAO,WAAW,UAAU;EAC1B,IAAI,MAAM,SAAS,MAAM,SAAS,KAA2B;CAC/D,CAAC;AACH;;;;;;;;;;;;;;;;;;ACjBA,IAAa,WAAb,MAAqD;CAInD,YAGE,mBAA4D,QAAQ;EAClE,qBAAqB;GACnB,MAAM;EACR,CAAC;CACH,GACA;EALiB,KAAA,kBAAA;EANF,eAAA,gBAAA,MAAA,6BAAY,IAAI,IAAoC,CAAA;EAC7D,eAAA,gBAAA,MAAA,YAA0B,IAAA;CAU/B;CAEH,UAAU,UAAsD;EAC9D,KAAK,UAAU,IAAI,QAAQ;EAC3B,aAAa;GACX,KAAK,UAAU,OAAO,QAAQ;EAChC;CACF;CAEA,GACE,MACA,UACY;EACZ,OAAO,iBAAiB,QAAQ,KAAK,UAAU,GAAG,GAAG,MAAM,QAAQ;CACrE;CAEA,QAAQ,OAA4B;EAGlC,IAAI,YAAY,OAAO;GACrB,MAAM,EAAE,aAAa,MAAM;GAC3B,IAAI,aAAa,MACf,KAAK,WAAW,KAAK,aAAa,OAAO,WAAW,KAAK,IAAI,KAAK,UAAU,QAAQ;EAExF;EAGA,KAAK,MAAM,YAAY,CAAC,GAAG,KAAK,S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