@embedpdf-editor/vue3-chapter-viewer 0.3.1 → 0.3.3

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/index.js CHANGED
@@ -20,44 +20,50 @@ import { UIPluginPackage, isToolbarOpen } from "@embedpdf/plugin-ui";
20
20
  import { GlobalPointerProvider, PagePointerProvider } from "@embedpdf/plugin-interaction-manager/vue";
21
21
  import { Rotate } from "@embedpdf/plugin-rotate/vue";
22
22
  import { SelectionLayer } from "@embedpdf/plugin-selection/vue";
23
- import { AnnotationLayer } from "@embedpdf/plugin-annotation/vue";
23
+ import { AnnotationLayer, useAnnotationCapability } from "@embedpdf/plugin-annotation/vue";
24
24
  import { RedactionLayer } from "@embedpdf/plugin-redaction/vue";
25
25
  import { RenderLayer } from "@embedpdf/plugin-render/vue";
26
26
  import { usePdfiumEngine } from "@embedpdf/engines/vue";
27
- const ve$1 = { position: "relative", height: "100%", width: "100%" }, be$1 = { highlight: { offsetY: 0 }, underline: { offsetY: 2.5 }, squiggly: { offsetY: 0 }, strikeout: { offsetY: 0 } }, Pe$1 = { highlight: PdfAnnotationSubtype.HIGHLIGHT, underline: PdfAnnotationSubtype.UNDERLINE, squiggly: PdfAnnotationSubtype.SQUIGGLY, strikeout: PdfAnnotationSubtype.STRIKEOUT };
28
- function we$1(e14, t2) {
27
+ const be$1 = { position: "relative", height: "100%", width: "100%" }, Pe$1 = { userSelect: "none", WebkitUserSelect: "none" };
28
+ function we$1() {
29
+ var _a2;
30
+ "undefined" != typeof window && ((_a2 = window.getSelection()) == null ? void 0 : _a2.removeAllRanges());
31
+ }
32
+ const ye = { highlight: { offsetY: 0 }, underline: { offsetY: 2.5 }, squiggly: { offsetY: 4 }, strikeout: { offsetY: 0 } }, Ce = { highlight: PdfAnnotationSubtype.HIGHLIGHT, underline: PdfAnnotationSubtype.UNDERLINE, squiggly: PdfAnnotationSubtype.SQUIGGLY, strikeout: PdfAnnotationSubtype.STRIKEOUT };
33
+ function Ie(e14, t2) {
29
34
  return 0 === t2 ? e14 : e14.map((e15) => ({ origin: { x: e15.origin.x, y: e15.origin.y + t2 }, size: { ...e15.size } }));
30
35
  }
31
- function ye(e14) {
36
+ function Me(e14) {
32
37
  let t2 = 1 / 0, a3 = 1 / 0, s9 = -1 / 0, i2 = -1 / 0;
33
38
  for (const o of e14) t2 = Math.min(t2, o.origin.x), a3 = Math.min(a3, o.origin.y), s9 = Math.max(s9, o.origin.x + o.size.width), i2 = Math.max(i2, o.origin.y + o.size.height);
34
39
  return { origin: { x: t2, y: a3 }, size: { width: s9 - t2, height: i2 - a3 } };
35
40
  }
36
- function Ce(e14, t2, a3, s9, i2) {
41
+ function Se(e14, t2, a3, s9, i2) {
37
42
  const o = a3.forDocument(e14), r2 = s9.forDocument(e14);
38
43
  if (!o || !r2) return false;
39
44
  const n2 = "highlight" === t2 ? "highlight" : "underline" === t2 ? "underline" : "squiggly" === t2 ? "squiggly" : "strikeout", l = a3.getTool(n2);
40
45
  if (!l) return false;
41
46
  const h2 = l.defaults, d2 = (function(e15, t3) {
42
- return { ...be$1[e15], ...null == t3 ? void 0 : t3[e15] };
47
+ return { ...ye[e15], ...null == t3 ? void 0 : t3[e15] };
43
48
  })(t2, i2), c = r2.getFormattedSelection();
44
49
  if (0 === c.length) return false;
45
50
  o.setLocked({ type: LockModeType.Exclude, categories: ["markup", "shape"] });
46
51
  for (const u of c) {
47
- const e15 = uuidV4(), a4 = d2.color ?? h2.color ?? h2.strokeColor, s10 = d2.opacity ?? h2.opacity, i3 = d2.thickness ?? h2.strokeWidth, r3 = d2.offsetY ?? 0, n3 = "underline" === t2 || "squiggly" === t2 || "strikeout" === t2 ? we$1(u.segmentRects, r3) : u.segmentRects, l2 = "underline" === t2 || "squiggly" === t2 || "strikeout" === t2 ? ye(n3) : u.rect;
48
- o.createAnnotation(u.pageIndex, { id: e15, created: /* @__PURE__ */ new Date(), flags: ["print"], type: Pe$1[t2], ..."highlight" === t2 ? { blendMode: PdfBlendMode.Multiply } : {}, strokeColor: a4, opacity: s10, ...null != i3 ? { strokeWidth: i3 } : {}, pageIndex: u.pageIndex, rect: l2, segmentRects: n3 });
52
+ const e15 = uuidV4(), a4 = d2.color ?? h2.color ?? h2.strokeColor, s10 = d2.opacity ?? h2.opacity, i3 = d2.thickness ?? h2.strokeWidth, r3 = d2.offsetY ?? 0, n3 = "underline" === t2 || "squiggly" === t2 || "strikeout" === t2 ? Ie(u.segmentRects, r3) : u.segmentRects, l2 = "underline" === t2 || "squiggly" === t2 || "strikeout" === t2 ? Me(n3) : u.rect;
53
+ o.createAnnotation(u.pageIndex, { id: e15, created: /* @__PURE__ */ new Date(), flags: ["print"], type: Ce[t2], ..."highlight" === t2 ? { blendMode: PdfBlendMode.Multiply } : {}, strokeColor: a4, opacity: s10, ...null != i3 ? { strokeWidth: i3 } : {}, pageIndex: u.pageIndex, rect: l2, segmentRects: n3 });
49
54
  }
50
55
  return r2.clear(), true;
51
56
  }
52
- function Ie(e14, t2) {
57
+ const xe = /* @__PURE__ */ new Set([PdfAnnotationSubtype.HIGHLIGHT, PdfAnnotationSubtype.UNDERLINE, PdfAnnotationSubtype.SQUIGGLY, PdfAnnotationSubtype.STRIKEOUT]);
58
+ function ke(e14, t2) {
53
59
  const a3 = e14;
54
60
  return false === e14 ? { ...t2, enabled: false } : true === e14 || void 0 === e14 ? { ...t2, enabled: t2.enabled ?? true } : { ...t2, ...a3, enabled: false !== (null == a3 ? void 0 : a3.enabled) };
55
61
  }
56
- function Me(e14) {
57
- const t2 = Ie(null == e14 ? void 0 : e14.markup, { enabled: true }), a3 = Ie(null == e14 ? void 0 : e14.bookmarks, { enabled: true }), s9 = Ie(null == e14 ? void 0 : e14.notes, { enabled: true });
58
- return { markup: t2, bookmarks: a3, notes: s9, zoom: Ie(null == e14 ? void 0 : e14.zoom, { enabled: true, min: 0.5, max: 3, initial: 1 }), selectionToolbar: Ie(void 0 === (null == e14 ? void 0 : e14.selectionToolbar) ? false !== t2.enabled || false !== s9.enabled : e14.selectionToolbar, { enabled: true }) };
62
+ function Le(e14) {
63
+ const t2 = ke(null == e14 ? void 0 : e14.markup, { enabled: true }), a3 = ke(null == e14 ? void 0 : e14.bookmarks, { enabled: true }), s9 = ke(null == e14 ? void 0 : e14.notes, { enabled: true });
64
+ return { markup: t2, bookmarks: a3, notes: s9, zoom: ke(null == e14 ? void 0 : e14.zoom, { enabled: true, min: 0.5, max: 3, initial: 1 }), selectionToolbar: ke(void 0 === (null == e14 ? void 0 : e14.selectionToolbar) ? false !== t2.enabled || false !== s9.enabled : e14.selectionToolbar, { enabled: true }) };
59
65
  }
60
- class xe {
66
+ class ze {
61
67
  constructor(e14) {
62
68
  this.cb = e14;
63
69
  }
@@ -65,9 +71,9 @@ class xe {
65
71
  return this.cb(e14, t2);
66
72
  }
67
73
  }
68
- const De = "chapter-manager", Oe = { id: De, name: "Chapter Manager Plugin", version: "0.1.0", provides: ["chapter-manager"], requires: ["document-manager"], optional: [], defaultConfig: { manifest: { chapters: [] }, prefetchChapters: 1, unloadTimeoutMs: 6e4, autoActivateOnLoad: true } };
69
- const Ge = { kind: "first-wins" };
70
- function Ne(e14, t2, a3) {
74
+ const Ae = "chapter-manager", Ve = { id: Ae, name: "Chapter Manager Plugin", version: "0.1.0", provides: ["chapter-manager"], requires: ["document-manager"], optional: [], defaultConfig: { manifest: { chapters: [] }, prefetchChapters: 1, unloadTimeoutMs: 6e4, autoActivateOnLoad: true } };
75
+ const Ee = { kind: "first-wins" };
76
+ function _e(e14, t2, a3) {
71
77
  if (1 === t2.length) return t2[0].chapterId;
72
78
  switch (a3.kind) {
73
79
  case "first-wins":
@@ -85,7 +91,7 @@ function Ne(e14, t2, a3) {
85
91
  return a3.resolve(e14, t2);
86
92
  }
87
93
  }
88
- let Ae = class {
94
+ let Re = class {
89
95
  constructor(e14) {
90
96
  this._pages = e14, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
91
97
  for (const t2 of e14) {
@@ -119,8 +125,8 @@ let Ae = class {
119
125
  return a3 ? this._pages.indexOf(a3) : -1;
120
126
  }
121
127
  };
122
- function Ve(e14, t2 = Ge) {
123
- const a3 = (function(e15, t3 = Ge) {
128
+ function Fe(e14, t2 = Ee) {
129
+ const a3 = (function(e15, t3 = Ee) {
124
130
  const a4 = /* @__PURE__ */ new Map();
125
131
  for (const i3 of e15.chapters) {
126
132
  const [e16, t4] = i3.globalPageRange;
@@ -130,7 +136,7 @@ function Ve(e14, t2 = Ge) {
130
136
  }
131
137
  }
132
138
  const s10 = /* @__PURE__ */ new Map();
133
- for (const [i3, o2] of a4) s10.set(i3, Ne(i3, o2, t3));
139
+ for (const [i3, o2] of a4) s10.set(i3, _e(i3, o2, t3));
134
140
  return s10;
135
141
  })(e14, t2), s9 = /* @__PURE__ */ new Map();
136
142
  for (const n2 of e14.chapters) s9.set(n2.chapterId, n2);
@@ -142,14 +148,14 @@ function Ve(e14, t2 = Ge) {
142
148
  const [i3] = t3.globalPageRange, [l] = t3.localPageRange, h2 = l + (n2 - i3);
143
149
  o.push({ globalPageIndex: r2++, globalPageNumber: n2, chapterId: e15, localPageIndex: h2 });
144
150
  }
145
- return new Ae(o);
151
+ return new Re(o);
146
152
  }
147
- const _e = class e extends BasePlugin {
153
+ const Ue = class e extends BasePlugin {
148
154
  constructor(e14, t2) {
149
- super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = Ge, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
155
+ super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = Ee, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
150
156
  }
151
157
  async initialize(e14) {
152
- if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? Ge, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
158
+ if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? Ee, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
153
159
  this.isOwnedChapter(e15.id) && (this.passwordAttempts.delete(e15.id), this.updateStatus(e15.id, "loaded"));
154
160
  }), this.documentManager.provides().onDocumentClosed((e15) => {
155
161
  this.isOwnedChapter(e15) && this.updateStatus(e15, "closed");
@@ -184,7 +190,7 @@ const _e = class e extends BasePlugin {
184
190
  const s9 = new Set(this.chapterStatus.keys()), i2 = new Set(t2.chapters.map((e14) => e14.chapterId));
185
191
  for (const e14 of s9) i2.has(e14) || (this.closeChapter(e14), this.chapterStatus.delete(e14));
186
192
  for (const e14 of t2.chapters) this.chapterStatus.has(e14.chapterId) || this.chapterStatus.set(e14.chapterId, "idle");
187
- this.manifest = t2, this.virtualPageMap = Ve(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
193
+ this.manifest = t2, this.virtualPageMap = Fe(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
188
194
  }
189
195
  eagerPrefetchFromManifest() {
190
196
  const e14 = this.config.prefetchChapters ?? 0;
@@ -322,11 +328,11 @@ const _e = class e extends BasePlugin {
322
328
  this.chapterStatus.get(e14) !== t2 && (this.chapterStatus.set(e14, t2), this.statusChange$.emit({ chapterId: e14, status: t2, ..."error" === t2 && a3 ? { error: { message: a3 } } : {} }));
323
329
  }
324
330
  };
325
- _e.id = "chapter-manager";
326
- let Ee = _e;
327
- const Re = { manifest: Oe, create: (e14) => new Ee(De, e14), reducer: (e14) => e14, initialState: {} }, Fe = "chapter-scroll", Ue = { id: Fe, name: "Chapter Scroll Plugin", version: "0.1.0", provides: ["chapter-scroll"], requires: ["chapter-manager"], optional: [], defaultConfig: { placeholderPageHeight: 1200, placeholderPageWidth: 900, bufferSize: 2, pageGap: 20 } };
328
- const qe = { kind: "first-wins" };
329
- function We(e14, t2, a3) {
331
+ Ue.id = "chapter-manager";
332
+ let qe = Ue;
333
+ const We = { manifest: Ve, create: (e14) => new qe(Ae, e14), reducer: (e14) => e14, initialState: {} }, He = "chapter-scroll", Be = { id: He, name: "Chapter Scroll Plugin", version: "0.1.0", provides: ["chapter-scroll"], requires: ["chapter-manager"], optional: [], defaultConfig: { placeholderPageHeight: 1200, placeholderPageWidth: 900, bufferSize: 2, pageGap: 20 } };
334
+ const je = { kind: "first-wins" };
335
+ function Ze(e14, t2, a3) {
330
336
  if (1 === t2.length) return t2[0].chapterId;
331
337
  switch (a3.kind) {
332
338
  case "first-wins":
@@ -344,7 +350,7 @@ function We(e14, t2, a3) {
344
350
  return a3.resolve(e14, t2);
345
351
  }
346
352
  }
347
- let He = class {
353
+ let Ye = class {
348
354
  constructor(e14) {
349
355
  this._pages = e14, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
350
356
  for (const t2 of e14) {
@@ -378,8 +384,8 @@ let He = class {
378
384
  return a3 ? this._pages.indexOf(a3) : -1;
379
385
  }
380
386
  };
381
- function Be(e14, t2 = qe) {
382
- const a3 = (function(e15, t3 = qe) {
387
+ function Ke(e14, t2 = je) {
388
+ const a3 = (function(e15, t3 = je) {
383
389
  const a4 = /* @__PURE__ */ new Map();
384
390
  for (const i3 of e15.chapters) {
385
391
  const [e16, t4] = i3.globalPageRange;
@@ -389,7 +395,7 @@ function Be(e14, t2 = qe) {
389
395
  }
390
396
  }
391
397
  const s10 = /* @__PURE__ */ new Map();
392
- for (const [i3, o2] of a4) s10.set(i3, We(i3, o2, t3));
398
+ for (const [i3, o2] of a4) s10.set(i3, Ze(i3, o2, t3));
393
399
  return s10;
394
400
  })(e14, t2), s9 = /* @__PURE__ */ new Map();
395
401
  for (const n2 of e14.chapters) s9.set(n2.chapterId, n2);
@@ -401,14 +407,14 @@ function Be(e14, t2 = qe) {
401
407
  const [i3] = t3.globalPageRange, [l] = t3.localPageRange, h2 = l + (n2 - i3);
402
408
  o.push({ globalPageIndex: r2++, globalPageNumber: n2, chapterId: e15, localPageIndex: h2 });
403
409
  }
404
- return new He(o);
410
+ return new Ye(o);
405
411
  }
406
- const je = class e2 extends BasePlugin {
412
+ const Xe = class e2 extends BasePlugin {
407
413
  constructor(e14, t2) {
408
- super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = qe, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
414
+ super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = je, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
409
415
  }
410
416
  async initialize(e14) {
411
- if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? qe, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
417
+ if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? je, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
412
418
  this.isOwnedChapter(e15.id) && (this.passwordAttempts.delete(e15.id), this.updateStatus(e15.id, "loaded"));
413
419
  }), this.documentManager.provides().onDocumentClosed((e15) => {
414
420
  this.isOwnedChapter(e15) && this.updateStatus(e15, "closed");
@@ -443,7 +449,7 @@ const je = class e2 extends BasePlugin {
443
449
  const s9 = new Set(this.chapterStatus.keys()), i2 = new Set(t2.chapters.map((e14) => e14.chapterId));
444
450
  for (const e14 of s9) i2.has(e14) || (this.closeChapter(e14), this.chapterStatus.delete(e14));
445
451
  for (const e14 of t2.chapters) this.chapterStatus.has(e14.chapterId) || this.chapterStatus.set(e14.chapterId, "idle");
446
- this.manifest = t2, this.virtualPageMap = Be(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
452
+ this.manifest = t2, this.virtualPageMap = Ke(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
447
453
  }
448
454
  eagerPrefetchFromManifest() {
449
455
  const e14 = this.config.prefetchChapters ?? 0;
@@ -581,9 +587,9 @@ const je = class e2 extends BasePlugin {
581
587
  this.chapterStatus.get(e14) !== t2 && (this.chapterStatus.set(e14, t2), this.statusChange$.emit({ chapterId: e14, status: t2, ..."error" === t2 && a3 ? { error: { message: a3 } } : {} }));
582
588
  }
583
589
  };
584
- je.id = "chapter-manager";
585
- let Ze = je;
586
- function Ye(e14, t2) {
590
+ Xe.id = "chapter-manager";
591
+ let Qe = Xe;
592
+ function Je(e14, t2) {
587
593
  if (e14 === t2) return true;
588
594
  if (e14.totalHeight !== t2.totalHeight || e14.totalWidth !== t2.totalWidth || e14.pageGap !== t2.pageGap || e14.items.length !== t2.items.length) return false;
589
595
  for (let a3 = 0; a3 < e14.items.length; a3++) {
@@ -592,9 +598,9 @@ function Ye(e14, t2) {
592
598
  }
593
599
  return true;
594
600
  }
595
- const Ke = class extends BasePlugin {
601
+ const et$1 = class et extends BasePlugin {
596
602
  constructor(e14, t2) {
597
- super(e14, t2), this.layoutChange$ = createBehaviorEmitter(void 0, Ye), this.visibleChange$ = createBehaviorEmitter(), this.virtualPageMap = null, this.pageSizes = /* @__PURE__ */ new Map(), this.offsets = [], this.totalHeight = 0, this.totalWidth = 0, this.viewportEl = null, this.viewportObservers = null, this.currentVisible = [], this.currentGlobalPageIndex = 0, this.chapterManagerUnsubs = [], this.chapterManager = this.registry.getPlugin(Ze.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
603
+ super(e14, t2), this.layoutChange$ = createBehaviorEmitter(void 0, Je), this.visibleChange$ = createBehaviorEmitter(), this.virtualPageMap = null, this.pageSizes = /* @__PURE__ */ new Map(), this.offsets = [], this.totalHeight = 0, this.totalWidth = 0, this.viewportEl = null, this.viewportObservers = null, this.currentVisible = [], this.currentGlobalPageIndex = 0, this.chapterManagerUnsubs = [], this.chapterManager = this.registry.getPlugin(Qe.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
598
604
  }
599
605
  async initialize(e14) {
600
606
  this.config = { placeholderPageHeight: e14.placeholderPageHeight ?? 1200, placeholderPageWidth: e14.placeholderPageWidth ?? 900, bufferSize: e14.bufferSize ?? 2, pageGap: e14.pageGap ?? 20 }, this.virtualPageMap = this.chapterManager.provides().getVirtualPageMap(), this.rebuildOffsets(), this.chapterManagerUnsubs.push(this.chapterManager.provides().onManifestChange(({ map: e15 }) => {
@@ -771,12 +777,12 @@ const Ke = class extends BasePlugin {
771
777
  a3 && this.scrollToIndex(a3.globalPageIndex, t2);
772
778
  }
773
779
  };
774
- Ke.id = "chapter-scroll";
775
- let Xe = Ke;
776
- const Qe = { manifest: Ue, create: (e14) => new Xe(Fe, e14), reducer: (e14) => e14, initialState: {} }, Je = "note", et$1 = { id: Je, name: "Note Plugin", version: "0.1.0", provides: ["note"], requires: ["selection", "chapter-scroll", "chapter-manager"], optional: [], defaultConfig: { callbacks: { onCreateNote: async () => null, onActivateNote: () => {
780
+ et$1.id = "chapter-scroll";
781
+ let tt$1 = et$1;
782
+ const at$1 = { manifest: Be, create: (e14) => new tt$1(He, e14), reducer: (e14) => e14, initialState: {} }, st$1 = "note", it$1 = { id: st$1, name: "Note Plugin", version: "0.1.0", provides: ["note"], requires: ["selection", "chapter-scroll", "chapter-manager"], optional: [], defaultConfig: { callbacks: { onCreateNote: async () => null, onActivateNote: () => {
777
783
  } }, markerSize: 18 } };
778
- const tt$1 = { kind: "first-wins" };
779
- function at$1(e14, t2, a3) {
784
+ const ot$1 = { kind: "first-wins" };
785
+ function rt$1(e14, t2, a3) {
780
786
  if (1 === t2.length) return t2[0].chapterId;
781
787
  switch (a3.kind) {
782
788
  case "first-wins":
@@ -794,7 +800,7 @@ function at$1(e14, t2, a3) {
794
800
  return a3.resolve(e14, t2);
795
801
  }
796
802
  }
797
- let st$1 = class st {
803
+ let nt$1 = class nt {
798
804
  constructor(e14) {
799
805
  this._pages = e14, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
800
806
  for (const t2 of e14) {
@@ -828,8 +834,8 @@ let st$1 = class st {
828
834
  return a3 ? this._pages.indexOf(a3) : -1;
829
835
  }
830
836
  };
831
- function it$1(e14, t2 = tt$1) {
832
- const a3 = (function(e15, t3 = tt$1) {
837
+ function lt$1(e14, t2 = ot$1) {
838
+ const a3 = (function(e15, t3 = ot$1) {
833
839
  const a4 = /* @__PURE__ */ new Map();
834
840
  for (const i3 of e15.chapters) {
835
841
  const [e16, t4] = i3.globalPageRange;
@@ -839,7 +845,7 @@ function it$1(e14, t2 = tt$1) {
839
845
  }
840
846
  }
841
847
  const s10 = /* @__PURE__ */ new Map();
842
- for (const [i3, o2] of a4) s10.set(i3, at$1(i3, o2, t3));
848
+ for (const [i3, o2] of a4) s10.set(i3, rt$1(i3, o2, t3));
843
849
  return s10;
844
850
  })(e14, t2), s9 = /* @__PURE__ */ new Map();
845
851
  for (const n2 of e14.chapters) s9.set(n2.chapterId, n2);
@@ -851,14 +857,14 @@ function it$1(e14, t2 = tt$1) {
851
857
  const [i3] = t3.globalPageRange, [l] = t3.localPageRange, h2 = l + (n2 - i3);
852
858
  o.push({ globalPageIndex: r2++, globalPageNumber: n2, chapterId: e15, localPageIndex: h2 });
853
859
  }
854
- return new st$1(o);
860
+ return new nt$1(o);
855
861
  }
856
- const ot$1 = class e3 extends BasePlugin {
862
+ const ht$1 = class e3 extends BasePlugin {
857
863
  constructor(e14, t2) {
858
- super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = tt$1, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
864
+ super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = ot$1, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
859
865
  }
860
866
  async initialize(e14) {
861
- if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? tt$1, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
867
+ if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? ot$1, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
862
868
  this.isOwnedChapter(e15.id) && (this.passwordAttempts.delete(e15.id), this.updateStatus(e15.id, "loaded"));
863
869
  }), this.documentManager.provides().onDocumentClosed((e15) => {
864
870
  this.isOwnedChapter(e15) && this.updateStatus(e15, "closed");
@@ -893,7 +899,7 @@ const ot$1 = class e3 extends BasePlugin {
893
899
  const s9 = new Set(this.chapterStatus.keys()), i2 = new Set(t2.chapters.map((e14) => e14.chapterId));
894
900
  for (const e14 of s9) i2.has(e14) || (this.closeChapter(e14), this.chapterStatus.delete(e14));
895
901
  for (const e14 of t2.chapters) this.chapterStatus.has(e14.chapterId) || this.chapterStatus.set(e14.chapterId, "idle");
896
- this.manifest = t2, this.virtualPageMap = it$1(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
902
+ this.manifest = t2, this.virtualPageMap = lt$1(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
897
903
  }
898
904
  eagerPrefetchFromManifest() {
899
905
  const e14 = this.config.prefetchChapters ?? 0;
@@ -1031,10 +1037,10 @@ const ot$1 = class e3 extends BasePlugin {
1031
1037
  this.chapterStatus.get(e14) !== t2 && (this.chapterStatus.set(e14, t2), this.statusChange$.emit({ chapterId: e14, status: t2, ..."error" === t2 && a3 ? { error: { message: a3 } } : {} }));
1032
1038
  }
1033
1039
  };
1034
- ot$1.id = "chapter-manager";
1035
- let rt$1 = ot$1;
1036
- const nt$1 = { kind: "first-wins" };
1037
- function lt$1(e14, t2, a3) {
1040
+ ht$1.id = "chapter-manager";
1041
+ let dt$1 = ht$1;
1042
+ const ct$1 = { kind: "first-wins" };
1043
+ function ut(e14, t2, a3) {
1038
1044
  if (1 === t2.length) return t2[0].chapterId;
1039
1045
  switch (a3.kind) {
1040
1046
  case "first-wins":
@@ -1052,7 +1058,7 @@ function lt$1(e14, t2, a3) {
1052
1058
  return a3.resolve(e14, t2);
1053
1059
  }
1054
1060
  }
1055
- let ht$1 = class ht {
1061
+ let pt = class {
1056
1062
  constructor(e14) {
1057
1063
  this._pages = e14, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
1058
1064
  for (const t2 of e14) {
@@ -1086,8 +1092,8 @@ let ht$1 = class ht {
1086
1092
  return a3 ? this._pages.indexOf(a3) : -1;
1087
1093
  }
1088
1094
  };
1089
- function dt$1(e14, t2 = nt$1) {
1090
- const a3 = (function(e15, t3 = nt$1) {
1095
+ function gt(e14, t2 = ct$1) {
1096
+ const a3 = (function(e15, t3 = ct$1) {
1091
1097
  const a4 = /* @__PURE__ */ new Map();
1092
1098
  for (const i3 of e15.chapters) {
1093
1099
  const [e16, t4] = i3.globalPageRange;
@@ -1097,7 +1103,7 @@ function dt$1(e14, t2 = nt$1) {
1097
1103
  }
1098
1104
  }
1099
1105
  const s10 = /* @__PURE__ */ new Map();
1100
- for (const [i3, o2] of a4) s10.set(i3, lt$1(i3, o2, t3));
1106
+ for (const [i3, o2] of a4) s10.set(i3, ut(i3, o2, t3));
1101
1107
  return s10;
1102
1108
  })(e14, t2), s9 = /* @__PURE__ */ new Map();
1103
1109
  for (const n2 of e14.chapters) s9.set(n2.chapterId, n2);
@@ -1109,14 +1115,14 @@ function dt$1(e14, t2 = nt$1) {
1109
1115
  const [i3] = t3.globalPageRange, [l] = t3.localPageRange, h2 = l + (n2 - i3);
1110
1116
  o.push({ globalPageIndex: r2++, globalPageNumber: n2, chapterId: e15, localPageIndex: h2 });
1111
1117
  }
1112
- return new ht$1(o);
1118
+ return new pt(o);
1113
1119
  }
1114
- const ct$1 = class e4 extends BasePlugin {
1120
+ const ft$1 = class e4 extends BasePlugin {
1115
1121
  constructor(e14, t2) {
1116
- super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = nt$1, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
1122
+ super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = ct$1, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
1117
1123
  }
1118
1124
  async initialize(e14) {
1119
- if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? nt$1, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
1125
+ if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? ct$1, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
1120
1126
  this.isOwnedChapter(e15.id) && (this.passwordAttempts.delete(e15.id), this.updateStatus(e15.id, "loaded"));
1121
1127
  }), this.documentManager.provides().onDocumentClosed((e15) => {
1122
1128
  this.isOwnedChapter(e15) && this.updateStatus(e15, "closed");
@@ -1151,7 +1157,7 @@ const ct$1 = class e4 extends BasePlugin {
1151
1157
  const s9 = new Set(this.chapterStatus.keys()), i2 = new Set(t2.chapters.map((e14) => e14.chapterId));
1152
1158
  for (const e14 of s9) i2.has(e14) || (this.closeChapter(e14), this.chapterStatus.delete(e14));
1153
1159
  for (const e14 of t2.chapters) this.chapterStatus.has(e14.chapterId) || this.chapterStatus.set(e14.chapterId, "idle");
1154
- this.manifest = t2, this.virtualPageMap = dt$1(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
1160
+ this.manifest = t2, this.virtualPageMap = gt(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
1155
1161
  }
1156
1162
  eagerPrefetchFromManifest() {
1157
1163
  const e14 = this.config.prefetchChapters ?? 0;
@@ -1289,9 +1295,9 @@ const ct$1 = class e4 extends BasePlugin {
1289
1295
  this.chapterStatus.get(e14) !== t2 && (this.chapterStatus.set(e14, t2), this.statusChange$.emit({ chapterId: e14, status: t2, ..."error" === t2 && a3 ? { error: { message: a3 } } : {} }));
1290
1296
  }
1291
1297
  };
1292
- ct$1.id = "chapter-manager";
1293
- let ut = ct$1;
1294
- function pt(e14, t2) {
1298
+ ft$1.id = "chapter-manager";
1299
+ let mt$1 = ft$1;
1300
+ function vt$1(e14, t2) {
1295
1301
  if (e14 === t2) return true;
1296
1302
  if (e14.totalHeight !== t2.totalHeight || e14.totalWidth !== t2.totalWidth || e14.pageGap !== t2.pageGap || e14.items.length !== t2.items.length) return false;
1297
1303
  for (let a3 = 0; a3 < e14.items.length; a3++) {
@@ -1300,9 +1306,9 @@ function pt(e14, t2) {
1300
1306
  }
1301
1307
  return true;
1302
1308
  }
1303
- const gt = class extends BasePlugin {
1309
+ const bt$1 = class bt extends BasePlugin {
1304
1310
  constructor(e14, t2) {
1305
- super(e14, t2), this.layoutChange$ = createBehaviorEmitter(void 0, pt), this.visibleChange$ = createBehaviorEmitter(), this.virtualPageMap = null, this.pageSizes = /* @__PURE__ */ new Map(), this.offsets = [], this.totalHeight = 0, this.totalWidth = 0, this.viewportEl = null, this.viewportObservers = null, this.currentVisible = [], this.currentGlobalPageIndex = 0, this.chapterManagerUnsubs = [], this.chapterManager = this.registry.getPlugin(ut.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
1311
+ super(e14, t2), this.layoutChange$ = createBehaviorEmitter(void 0, vt$1), this.visibleChange$ = createBehaviorEmitter(), this.virtualPageMap = null, this.pageSizes = /* @__PURE__ */ new Map(), this.offsets = [], this.totalHeight = 0, this.totalWidth = 0, this.viewportEl = null, this.viewportObservers = null, this.currentVisible = [], this.currentGlobalPageIndex = 0, this.chapterManagerUnsubs = [], this.chapterManager = this.registry.getPlugin(mt$1.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
1306
1312
  }
1307
1313
  async initialize(e14) {
1308
1314
  this.config = { placeholderPageHeight: e14.placeholderPageHeight ?? 1200, placeholderPageWidth: e14.placeholderPageWidth ?? 900, bufferSize: e14.bufferSize ?? 2, pageGap: e14.pageGap ?? 20 }, this.virtualPageMap = this.chapterManager.provides().getVirtualPageMap(), this.rebuildOffsets(), this.chapterManagerUnsubs.push(this.chapterManager.provides().onManifestChange(({ map: e15 }) => {
@@ -1479,11 +1485,11 @@ const gt = class extends BasePlugin {
1479
1485
  a3 && this.scrollToIndex(a3.globalPageIndex, t2);
1480
1486
  }
1481
1487
  };
1482
- gt.id = "chapter-scroll";
1483
- let ft$1 = gt;
1484
- const mt$1 = class e5 extends BasePlugin {
1488
+ bt$1.id = "chapter-scroll";
1489
+ let Pt$1 = bt$1;
1490
+ const wt$1 = class e5 extends BasePlugin {
1485
1491
  constructor(e14, t2) {
1486
- super(e14, t2), this.notesChange$ = createBehaviorEmitter([]), this.noteActivated$ = createEmitter(), this.notes = /* @__PURE__ */ new Map(), this.chapterScroll = this.registry.getPlugin(ft$1.id), this.chapterManager = this.registry.getPlugin(rt$1.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
1492
+ super(e14, t2), this.notesChange$ = createBehaviorEmitter([]), this.noteActivated$ = createEmitter(), this.notes = /* @__PURE__ */ new Map(), this.chapterScroll = this.registry.getPlugin(Pt$1.id), this.chapterManager = this.registry.getPlugin(dt$1.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
1487
1493
  }
1488
1494
  async initialize(t2) {
1489
1495
  if (this.config = t2, t2.callbacks.loadNotes) try {
@@ -1521,7 +1527,7 @@ const mt$1 = class e5 extends BasePlugin {
1521
1527
  this.notesChange$.emit(this.listAll());
1522
1528
  }
1523
1529
  buildDraft(e14) {
1524
- return { chapterId: e14.chapterId, localPageIndex: e14.localPageIndex, globalPageNumber: e14.globalPageNumber, globalPageIndex: e14.globalPageIndex, rectsPdfCoord: e14.rectsPdfCoord, endAnchor: bt$1(e14.rectsPdfCoord), selectedText: e14.selectedText, content: e14.content };
1530
+ return { chapterId: e14.chapterId, localPageIndex: e14.localPageIndex, globalPageNumber: e14.globalPageNumber, globalPageIndex: e14.globalPageIndex, rectsPdfCoord: e14.rectsPdfCoord, endAnchor: Ct$1(e14.rectsPdfCoord), selectedText: e14.selectedText, content: e14.content };
1525
1531
  }
1526
1532
  async requestCreateFromSelection(e14) {
1527
1533
  if (0 === e14.rectsPdfCoord.length) return null;
@@ -1588,15 +1594,15 @@ const mt$1 = class e5 extends BasePlugin {
1588
1594
  });
1589
1595
  }
1590
1596
  };
1591
- mt$1.id = "note";
1592
- let vt$1 = mt$1;
1593
- function bt$1(e14) {
1597
+ wt$1.id = "note";
1598
+ let yt$1 = wt$1;
1599
+ function Ct$1(e14) {
1594
1600
  const t2 = e14[e14.length - 1];
1595
1601
  return { x: t2.origin.x + t2.size.width, y: t2.origin.y + t2.size.height };
1596
1602
  }
1597
- const Pt$1 = { manifest: et$1, create: (e14) => new vt$1(Je, e14), reducer: (e14) => e14, initialState: {} }, wt$1 = "paragraph-bookmark", yt$1 = { id: wt$1, name: "Paragraph Bookmark Plugin", version: "0.1.0", provides: ["paragraph-bookmark"], requires: ["chapter-scroll", "chapter-manager"], optional: [], defaultConfig: {} };
1598
- const Ct$1 = { kind: "first-wins" };
1599
- function It$1(e14, t2, a3) {
1603
+ const It$1 = { manifest: it$1, create: (e14) => new yt$1(st$1, e14), reducer: (e14) => e14, initialState: {} }, Mt$1 = "paragraph-bookmark", St$1 = { id: Mt$1, name: "Paragraph Bookmark Plugin", version: "0.1.0", provides: ["paragraph-bookmark"], requires: ["chapter-scroll", "chapter-manager"], optional: [], defaultConfig: {} };
1604
+ const xt$1 = { kind: "first-wins" };
1605
+ function kt$1(e14, t2, a3) {
1600
1606
  if (1 === t2.length) return t2[0].chapterId;
1601
1607
  switch (a3.kind) {
1602
1608
  case "first-wins":
@@ -1614,7 +1620,7 @@ function It$1(e14, t2, a3) {
1614
1620
  return a3.resolve(e14, t2);
1615
1621
  }
1616
1622
  }
1617
- let Mt$1 = class Mt {
1623
+ let Lt$1 = class Lt {
1618
1624
  constructor(e14) {
1619
1625
  this._pages = e14, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
1620
1626
  for (const t2 of e14) {
@@ -1648,8 +1654,8 @@ let Mt$1 = class Mt {
1648
1654
  return a3 ? this._pages.indexOf(a3) : -1;
1649
1655
  }
1650
1656
  };
1651
- function St$1(e14, t2 = Ct$1) {
1652
- const a3 = (function(e15, t3 = Ct$1) {
1657
+ function $t$1(e14, t2 = xt$1) {
1658
+ const a3 = (function(e15, t3 = xt$1) {
1653
1659
  const a4 = /* @__PURE__ */ new Map();
1654
1660
  for (const i3 of e15.chapters) {
1655
1661
  const [e16, t4] = i3.globalPageRange;
@@ -1659,7 +1665,7 @@ function St$1(e14, t2 = Ct$1) {
1659
1665
  }
1660
1666
  }
1661
1667
  const s10 = /* @__PURE__ */ new Map();
1662
- for (const [i3, o2] of a4) s10.set(i3, It$1(i3, o2, t3));
1668
+ for (const [i3, o2] of a4) s10.set(i3, kt$1(i3, o2, t3));
1663
1669
  return s10;
1664
1670
  })(e14, t2), s9 = /* @__PURE__ */ new Map();
1665
1671
  for (const n2 of e14.chapters) s9.set(n2.chapterId, n2);
@@ -1671,14 +1677,14 @@ function St$1(e14, t2 = Ct$1) {
1671
1677
  const [i3] = t3.globalPageRange, [l] = t3.localPageRange, h2 = l + (n2 - i3);
1672
1678
  o.push({ globalPageIndex: r2++, globalPageNumber: n2, chapterId: e15, localPageIndex: h2 });
1673
1679
  }
1674
- return new Mt$1(o);
1680
+ return new Lt$1(o);
1675
1681
  }
1676
- const xt$1 = class e6 extends BasePlugin {
1682
+ const zt$1 = class e6 extends BasePlugin {
1677
1683
  constructor(e14, t2) {
1678
- super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = Ct$1, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
1684
+ super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = xt$1, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
1679
1685
  }
1680
1686
  async initialize(e14) {
1681
- if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? Ct$1, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
1687
+ if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? xt$1, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
1682
1688
  this.isOwnedChapter(e15.id) && (this.passwordAttempts.delete(e15.id), this.updateStatus(e15.id, "loaded"));
1683
1689
  }), this.documentManager.provides().onDocumentClosed((e15) => {
1684
1690
  this.isOwnedChapter(e15) && this.updateStatus(e15, "closed");
@@ -1713,7 +1719,7 @@ const xt$1 = class e6 extends BasePlugin {
1713
1719
  const s9 = new Set(this.chapterStatus.keys()), i2 = new Set(t2.chapters.map((e14) => e14.chapterId));
1714
1720
  for (const e14 of s9) i2.has(e14) || (this.closeChapter(e14), this.chapterStatus.delete(e14));
1715
1721
  for (const e14 of t2.chapters) this.chapterStatus.has(e14.chapterId) || this.chapterStatus.set(e14.chapterId, "idle");
1716
- this.manifest = t2, this.virtualPageMap = St$1(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
1722
+ this.manifest = t2, this.virtualPageMap = $t$1(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
1717
1723
  }
1718
1724
  eagerPrefetchFromManifest() {
1719
1725
  const e14 = this.config.prefetchChapters ?? 0;
@@ -1851,10 +1857,10 @@ const xt$1 = class e6 extends BasePlugin {
1851
1857
  this.chapterStatus.get(e14) !== t2 && (this.chapterStatus.set(e14, t2), this.statusChange$.emit({ chapterId: e14, status: t2, ..."error" === t2 && a3 ? { error: { message: a3 } } : {} }));
1852
1858
  }
1853
1859
  };
1854
- xt$1.id = "chapter-manager";
1855
- let kt$1 = xt$1;
1856
- const Lt$1 = { kind: "first-wins" };
1857
- function $t$1(e14, t2, a3) {
1860
+ zt$1.id = "chapter-manager";
1861
+ let Tt$1 = zt$1;
1862
+ const Dt$1 = { kind: "first-wins" };
1863
+ function Ot$1(e14, t2, a3) {
1858
1864
  if (1 === t2.length) return t2[0].chapterId;
1859
1865
  switch (a3.kind) {
1860
1866
  case "first-wins":
@@ -1872,7 +1878,7 @@ function $t$1(e14, t2, a3) {
1872
1878
  return a3.resolve(e14, t2);
1873
1879
  }
1874
1880
  }
1875
- let zt$1 = class zt {
1881
+ let Gt$1 = class Gt {
1876
1882
  constructor(e14) {
1877
1883
  this._pages = e14, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
1878
1884
  for (const t2 of e14) {
@@ -1906,8 +1912,8 @@ let zt$1 = class zt {
1906
1912
  return a3 ? this._pages.indexOf(a3) : -1;
1907
1913
  }
1908
1914
  };
1909
- function Tt$1(e14, t2 = Lt$1) {
1910
- const a3 = (function(e15, t3 = Lt$1) {
1915
+ function Nt(e14, t2 = Dt$1) {
1916
+ const a3 = (function(e15, t3 = Dt$1) {
1911
1917
  const a4 = /* @__PURE__ */ new Map();
1912
1918
  for (const i3 of e15.chapters) {
1913
1919
  const [e16, t4] = i3.globalPageRange;
@@ -1917,7 +1923,7 @@ function Tt$1(e14, t2 = Lt$1) {
1917
1923
  }
1918
1924
  }
1919
1925
  const s10 = /* @__PURE__ */ new Map();
1920
- for (const [i3, o2] of a4) s10.set(i3, $t$1(i3, o2, t3));
1926
+ for (const [i3, o2] of a4) s10.set(i3, Ot$1(i3, o2, t3));
1921
1927
  return s10;
1922
1928
  })(e14, t2), s9 = /* @__PURE__ */ new Map();
1923
1929
  for (const n2 of e14.chapters) s9.set(n2.chapterId, n2);
@@ -1929,14 +1935,14 @@ function Tt$1(e14, t2 = Lt$1) {
1929
1935
  const [i3] = t3.globalPageRange, [l] = t3.localPageRange, h2 = l + (n2 - i3);
1930
1936
  o.push({ globalPageIndex: r2++, globalPageNumber: n2, chapterId: e15, localPageIndex: h2 });
1931
1937
  }
1932
- return new zt$1(o);
1938
+ return new Gt$1(o);
1933
1939
  }
1934
- const Dt$1 = class e7 extends BasePlugin {
1940
+ const At$1 = class e7 extends BasePlugin {
1935
1941
  constructor(e14, t2) {
1936
- super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = Lt$1, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
1942
+ super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = Dt$1, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
1937
1943
  }
1938
1944
  async initialize(e14) {
1939
- if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? Lt$1, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
1945
+ if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? Dt$1, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
1940
1946
  this.isOwnedChapter(e15.id) && (this.passwordAttempts.delete(e15.id), this.updateStatus(e15.id, "loaded"));
1941
1947
  }), this.documentManager.provides().onDocumentClosed((e15) => {
1942
1948
  this.isOwnedChapter(e15) && this.updateStatus(e15, "closed");
@@ -1971,7 +1977,7 @@ const Dt$1 = class e7 extends BasePlugin {
1971
1977
  const s9 = new Set(this.chapterStatus.keys()), i2 = new Set(t2.chapters.map((e14) => e14.chapterId));
1972
1978
  for (const e14 of s9) i2.has(e14) || (this.closeChapter(e14), this.chapterStatus.delete(e14));
1973
1979
  for (const e14 of t2.chapters) this.chapterStatus.has(e14.chapterId) || this.chapterStatus.set(e14.chapterId, "idle");
1974
- this.manifest = t2, this.virtualPageMap = Tt$1(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
1980
+ this.manifest = t2, this.virtualPageMap = Nt(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
1975
1981
  }
1976
1982
  eagerPrefetchFromManifest() {
1977
1983
  const e14 = this.config.prefetchChapters ?? 0;
@@ -2109,9 +2115,9 @@ const Dt$1 = class e7 extends BasePlugin {
2109
2115
  this.chapterStatus.get(e14) !== t2 && (this.chapterStatus.set(e14, t2), this.statusChange$.emit({ chapterId: e14, status: t2, ..."error" === t2 && a3 ? { error: { message: a3 } } : {} }));
2110
2116
  }
2111
2117
  };
2112
- Dt$1.id = "chapter-manager";
2113
- let Ot$1 = Dt$1;
2114
- function Gt$1(e14, t2) {
2118
+ At$1.id = "chapter-manager";
2119
+ let Vt = At$1;
2120
+ function Et(e14, t2) {
2115
2121
  if (e14 === t2) return true;
2116
2122
  if (e14.totalHeight !== t2.totalHeight || e14.totalWidth !== t2.totalWidth || e14.pageGap !== t2.pageGap || e14.items.length !== t2.items.length) return false;
2117
2123
  for (let a3 = 0; a3 < e14.items.length; a3++) {
@@ -2120,9 +2126,9 @@ function Gt$1(e14, t2) {
2120
2126
  }
2121
2127
  return true;
2122
2128
  }
2123
- const Nt = class extends BasePlugin {
2129
+ const _t = class extends BasePlugin {
2124
2130
  constructor(e14, t2) {
2125
- super(e14, t2), this.layoutChange$ = createBehaviorEmitter(void 0, Gt$1), this.visibleChange$ = createBehaviorEmitter(), this.virtualPageMap = null, this.pageSizes = /* @__PURE__ */ new Map(), this.offsets = [], this.totalHeight = 0, this.totalWidth = 0, this.viewportEl = null, this.viewportObservers = null, this.currentVisible = [], this.currentGlobalPageIndex = 0, this.chapterManagerUnsubs = [], this.chapterManager = this.registry.getPlugin(Ot$1.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
2131
+ super(e14, t2), this.layoutChange$ = createBehaviorEmitter(void 0, Et), this.visibleChange$ = createBehaviorEmitter(), this.virtualPageMap = null, this.pageSizes = /* @__PURE__ */ new Map(), this.offsets = [], this.totalHeight = 0, this.totalWidth = 0, this.viewportEl = null, this.viewportObservers = null, this.currentVisible = [], this.currentGlobalPageIndex = 0, this.chapterManagerUnsubs = [], this.chapterManager = this.registry.getPlugin(Vt.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
2126
2132
  }
2127
2133
  async initialize(e14) {
2128
2134
  this.config = { placeholderPageHeight: e14.placeholderPageHeight ?? 1200, placeholderPageWidth: e14.placeholderPageWidth ?? 900, bufferSize: e14.bufferSize ?? 2, pageGap: e14.pageGap ?? 20 }, this.virtualPageMap = this.chapterManager.provides().getVirtualPageMap(), this.rebuildOffsets(), this.chapterManagerUnsubs.push(this.chapterManager.provides().onManifestChange(({ map: e15 }) => {
@@ -2299,41 +2305,41 @@ const Nt = class extends BasePlugin {
2299
2305
  a3 && this.scrollToIndex(a3.globalPageIndex, t2);
2300
2306
  }
2301
2307
  };
2302
- Nt.id = "chapter-scroll";
2303
- let At$1 = Nt;
2304
- function Vt(e14) {
2308
+ _t.id = "chapter-scroll";
2309
+ let Rt = _t;
2310
+ function Ft(e14) {
2305
2311
  if (0 === e14.length) throw new Error("unionRects: empty rects");
2306
2312
  let t2 = 1 / 0, a3 = 1 / 0, s9 = -1 / 0, i2 = -1 / 0;
2307
2313
  for (const o of e14) t2 = Math.min(t2, o.origin.x), a3 = Math.min(a3, o.origin.y), s9 = Math.max(s9, o.origin.x + o.size.width), i2 = Math.max(i2, o.origin.y + o.size.height);
2308
2314
  return { origin: { x: t2, y: a3 }, size: { width: s9 - t2, height: i2 - a3 } };
2309
2315
  }
2310
- function _t(e14) {
2316
+ function Ut(e14) {
2311
2317
  const t2 = e14[e14.length - 1];
2312
2318
  return { x: t2.origin.x + t2.size.width, y: t2.origin.y + t2.size.height };
2313
2319
  }
2314
- function Et(e14, t2) {
2320
+ function qt(e14, t2) {
2315
2321
  const a3 = e14.origin.y, s9 = e14.origin.y + e14.size.height, i2 = t2.origin.y, o = t2.origin.y + t2.size.height, r2 = Math.max(s9, o) - Math.min(a3, i2);
2316
2322
  if (r2 <= 0) return 0;
2317
2323
  return Math.max(0, Math.min(s9, o) - Math.max(a3, i2)) / r2;
2318
2324
  }
2319
- function Rt(e14, t2) {
2325
+ function Wt(e14, t2) {
2320
2326
  var a3, s9;
2321
2327
  if (e14.chapterId !== t2.chapterId || e14.localPageIndex !== t2.localPageIndex) return false;
2322
- const i2 = (null == (a3 = e14.rectsPdfCoord) ? void 0 : a3.length) ? e14.rectsPdfCoord : [e14.rectPdfCoord], o = (null == (s9 = t2.rectsPdfCoord) ? void 0 : s9.length) ? t2.rectsPdfCoord : [t2.rectPdfCoord], r2 = e14.markerAnchor ?? _t(i2), n2 = t2.markerAnchor ?? _t(o);
2328
+ const i2 = (null == (a3 = e14.rectsPdfCoord) ? void 0 : a3.length) ? e14.rectsPdfCoord : [e14.rectPdfCoord], o = (null == (s9 = t2.rectsPdfCoord) ? void 0 : s9.length) ? t2.rectsPdfCoord : [t2.rectPdfCoord], r2 = e14.markerAnchor ?? Ut(i2), n2 = t2.markerAnchor ?? Ut(o);
2323
2329
  if (Math.hypot(r2.x - n2.x, r2.y - n2.y) <= 6) return true;
2324
2330
  for (const l of i2) for (const e15 of o) {
2325
- if (Et(l, e15) < 0.5) continue;
2331
+ if (qt(l, e15) < 0.5) continue;
2326
2332
  const t3 = Math.max(l.origin.x, e15.origin.x);
2327
2333
  if (Math.min(l.origin.x + l.size.width, e15.origin.x + e15.size.width) - t3 > 0.25 * Math.min(l.size.width, e15.size.width)) return true;
2328
2334
  }
2329
2335
  return false;
2330
2336
  }
2331
- function Ft(e14, t2, a3, s9) {
2337
+ function Ht$1(e14, t2, a3, s9) {
2332
2338
  const i2 = a3.length > 0 ? a3 : [];
2333
2339
  if (0 === i2.length) throw new Error("buildParagraphBookmarkAnchor: no rects");
2334
- return { chapterId: e14, localPageIndex: t2, globalPageIndex: null == s9 ? void 0 : s9.globalPageIndex, globalPageNumber: null == s9 ? void 0 : s9.globalPageNumber, rectPdfCoord: Vt(i2), rectsPdfCoord: i2, markerAnchor: _t(i2) };
2340
+ return { chapterId: e14, localPageIndex: t2, globalPageIndex: null == s9 ? void 0 : s9.globalPageIndex, globalPageNumber: null == s9 ? void 0 : s9.globalPageNumber, rectPdfCoord: Ft(i2), rectsPdfCoord: i2, markerAnchor: Ut(i2) };
2335
2341
  }
2336
- async function Ut(e14, t2, a3) {
2342
+ async function Bt$1(e14, t2, a3) {
2337
2343
  e14.scrollToGlobalPageIndex(t2), await (function(e15, t3, a4 = 2500) {
2338
2344
  const s9 = e15.getLayout().items.find((e16) => e16.globalPageIndex === t3 && !e16.isPlaceholder);
2339
2345
  return s9 ? Promise.resolve(s9) : new Promise((s10) => {
@@ -2346,9 +2352,9 @@ async function Ut(e14, t2, a3) {
2346
2352
  });
2347
2353
  })(e14, t2), e14.scrollToGlobalPdfPoint(t2, a3, { marginTop: 80 });
2348
2354
  }
2349
- const qt = class e8 extends BasePlugin {
2355
+ const jt = class e8 extends BasePlugin {
2350
2356
  constructor(e14, t2) {
2351
- super(e14, t2), this.change$ = createBehaviorEmitter([]), this.entries = /* @__PURE__ */ new Map(), this.chapterScroll = this.registry.getPlugin(At$1.id), this.chapterManager = this.registry.getPlugin(kt$1.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
2357
+ super(e14, t2), this.change$ = createBehaviorEmitter([]), this.entries = /* @__PURE__ */ new Map(), this.chapterScroll = this.registry.getPlugin(Rt.id), this.chapterManager = this.registry.getPlugin(Tt$1.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
2352
2358
  }
2353
2359
  async initialize(t2) {
2354
2360
  var a3;
@@ -2364,7 +2370,7 @@ const qt = class e8 extends BasePlugin {
2364
2370
  return { addBookmark: (e14) => this.addBookmark(e14), removeBookmark: (e14) => this.removeBookmark(e14), updateBookmark: (e14, t2) => this.updateBookmark(e14, t2), listBookmarks: () => this.list(), getBookmark: (e14) => this.entries.get(e14) ?? null, scrollToBookmark: (e14) => this.scrollToBookmark(e14), requestRemoveBookmark: (e14) => this.requestRemoveBookmark(e14), listBookmarksForChapter: (e14) => this.listBookmarksForChapter(e14), replaceBookmarksForChapter: (e14, t2) => this.replaceBookmarksForChapter(e14, t2), onBookmarksChange: this.change$.on };
2365
2371
  }
2366
2372
  addBookmark(e14) {
2367
- for (const s9 of this.entries.values()) if (Rt(s9.anchor, e14.anchor)) return s9;
2373
+ for (const s9 of this.entries.values()) if (Wt(s9.anchor, e14.anchor)) return s9;
2368
2374
  const t2 = e14.id ?? `bm-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`, a3 = { id: t2, label: e14.label, anchor: e14.anchor, metadata: e14.metadata, createdAt: Date.now() };
2369
2375
  return this.entries.set(t2, a3), this.notifyAndPersist(), a3;
2370
2376
  }
@@ -2420,13 +2426,13 @@ const qt = class e8 extends BasePlugin {
2420
2426
  const t3 = e15.rectPdfCoord;
2421
2427
  return t3.origin.y + t3.size.height;
2422
2428
  })(t2.anchor);
2423
- await Ut(a3, s9, i2);
2429
+ await Bt$1(a3, s9, i2);
2424
2430
  }
2425
2431
  };
2426
- qt.id = "paragraph-bookmark";
2427
- let Wt = qt;
2428
- const Ht$1 = { manifest: yt$1, create: (e14) => new Wt(wt$1, e14), reducer: (e14) => e14, initialState: {} }, Bt$1 = { "annotation-toolbar": { id: "annotation-toolbar", position: { placement: "top", slot: "secondary", order: 0 }, responsive: { breakpoints: { sm: { maxWidth: 640, hide: ["add-text", "add-ink", "add-ink-highlighter", "add-insert-text", "add-replace-text", "add-comment", "add-callout"], show: ["overflow-annotation-tools"] }, md: { minWidth: 640, hide: ["overflow-annotation-tools"], show: ["add-text", "add-ink", "add-ink-highlighter", "add-insert-text", "add-replace-text", "add-comment", "add-callout"] } } }, permanent: false, categories: ["annotation"], items: [{ type: "spacer", id: "spacer-3", flex: true }, { type: "group", id: "annotation-tools", alignment: "start", gap: 2, items: [{ type: "command-button", id: "add-highlight", commandId: "annotation:add-highlight", variant: "icon", categories: ["annotation", "annotation-markup", "annotation-highlight"] }, { type: "command-button", id: "add-strikeout", commandId: "annotation:add-strikeout", variant: "icon", categories: ["annotation", "annotation-markup", "annotation-strikeout"] }, { type: "command-button", id: "add-underline", commandId: "annotation:add-underline", variant: "icon", categories: ["annotation", "annotation-markup", "annotation-underline"] }, { type: "command-button", id: "add-squiggly", commandId: "annotation:add-squiggly", variant: "icon", categories: ["annotation", "annotation-markup", "annotation-squiggly"] }, { type: "command-button", id: "add-ink", commandId: "annotation:add-ink", variant: "icon", categories: ["annotation", "annotation-ink"] }, { type: "command-button", id: "add-ink-highlighter", commandId: "annotation:add-ink-highlighter", variant: "icon", categories: ["annotation", "annotation-ink"] }, { type: "command-button", id: "add-text", commandId: "annotation:add-text", variant: "icon", categories: ["annotation", "annotation-text"] }, { type: "command-button", id: "add-insert-text", commandId: "annotation:add-insert-text", variant: "icon", categories: ["annotation", "annotation-markup", "annotation-insert-text"] }, { type: "command-button", id: "add-replace-text", commandId: "annotation:add-replace-text", variant: "icon", categories: ["annotation", "annotation-markup", "annotation-replace-text"] }, { type: "command-button", id: "add-comment", commandId: "annotation:add-comment", variant: "icon", categories: ["annotation", "annotation-comment-tool"] }, { type: "command-button", id: "add-callout", commandId: "annotation:add-callout", variant: "icon", categories: ["annotation", "annotation-text"] }, { type: "command-button", id: "overflow-annotation-tools", commandId: "annotation:overflow-tools", variant: "icon", categories: ["annotation", "annotation-overflow"] }, { type: "divider", id: "annotation-tools-divider-1", orientation: "vertical" }, { type: "command-button", id: "toggle-annotation-style", commandId: "panel:toggle-annotation-style", variant: "icon", categories: ["panel", "panel-annotation-style"] }, { type: "divider", id: "annotation-tools-divider-2", orientation: "vertical", visibilityDependsOn: { itemIds: ["toggle-annotation-style"] } }, { type: "command-button", id: "undo-button", commandId: "history:undo", variant: "icon", categories: ["history", "history-undo"] }, { type: "command-button", id: "redo-button", commandId: "history:redo", variant: "icon", categories: ["history", "history-redo"] }] }, { type: "spacer", id: "spacer-4", flex: true }] }, "shapes-toolbar": { id: "shapes-toolbar", position: { placement: "top", slot: "secondary", order: 0 }, responsive: { breakpoints: { sm: { maxWidth: 640, hide: ["add-polygon", "add-polyline"], show: ["overflow-shapes-tools"] }, md: { minWidth: 640, hide: ["overflow-shapes-tools"], show: ["add-polygon", "add-polyline"] } } }, permanent: false, categories: ["annotation", "annotation-shape"], items: [{ type: "spacer", id: "spacer-5", flex: true }, { type: "group", id: "shapes-tools", alignment: "start", gap: 2, items: [{ type: "command-button", id: "add-rectangle", commandId: "annotation:add-rectangle", variant: "icon", categories: ["annotation", "annotation-shape", "annotation-rectangle"] }, { type: "command-button", id: "add-circle", commandId: "annotation:add-circle", variant: "icon", categories: ["annotation", "annotation-shape", "annotation-circle"] }, { type: "command-button", id: "add-line", commandId: "annotation:add-line", variant: "icon", categories: ["annotation", "annotation-shape", "annotation-line"] }, { type: "command-button", id: "add-arrow", commandId: "annotation:add-arrow", variant: "icon", categories: ["annotation", "annotation-shape", "annotation-arrow"] }, { type: "command-button", id: "add-polygon", commandId: "annotation:add-polygon", variant: "icon", categories: ["annotation", "annotation-shape", "annotation-polygon"] }, { type: "command-button", id: "add-polyline", commandId: "annotation:add-polyline", variant: "icon", categories: ["annotation", "annotation-shape", "annotation-polyline"] }, { type: "command-button", id: "overflow-shapes-tools", commandId: "annotation:overflow-shapes", variant: "icon", categories: ["annotation", "annotation-shape", "annotation-overflow"] }, { type: "divider", id: "shapes-tools-divider-1", orientation: "vertical" }, { type: "command-button", id: "toggle-annotation-style", commandId: "panel:toggle-annotation-style", variant: "icon", categories: ["panel", "panel-annotation-style"] }, { type: "divider", id: "shapes-tools-divider-2", orientation: "vertical", visibilityDependsOn: { itemIds: ["toggle-annotation-style"] } }, { type: "command-button", id: "undo-button", commandId: "history:undo", variant: "icon", categories: ["history", "history-undo"] }, { type: "command-button", id: "redo-button", commandId: "history:redo", variant: "icon", categories: ["history", "history-redo"] }] }, { type: "spacer", id: "spacer-6", flex: true }] }, "form-toolbar": { id: "form-toolbar", position: { placement: "top", slot: "secondary", order: 0 }, responsive: { breakpoints: { sm: { maxWidth: 640, hide: ["add-form-select", "add-form-listbox"], show: ["overflow-forms-tools"] }, md: { minWidth: 640, hide: ["overflow-forms-tools"], show: ["add-form-select", "add-form-listbox"] } } }, permanent: false, categories: ["form"], items: [{ type: "spacer", id: "spacer-form-1", flex: true }, { type: "group", id: "form-tools", alignment: "start", gap: 2, items: [{ type: "command-button", id: "add-form-textfield", commandId: "form:add-textfield", variant: "icon", categories: ["form", "form-textfield"] }, { type: "command-button", id: "add-form-checkbox", commandId: "form:add-checkbox", variant: "icon", categories: ["form", "form-checkbox"] }, { type: "command-button", id: "add-form-radio", commandId: "form:add-radio", variant: "icon", categories: ["form", "form-radio"] }, { type: "command-button", id: "add-form-select", commandId: "form:add-select", variant: "icon", categories: ["form", "form-select"] }, { type: "command-button", id: "add-form-listbox", commandId: "form:add-listbox", variant: "icon", categories: ["form", "form-listbox"] }, { type: "command-button", id: "overflow-forms-tools", commandId: "form:overflow-tools", variant: "icon", categories: ["form", "form-overflow"] }, { type: "divider", id: "form-tools-divider-1", orientation: "vertical" }, { type: "command-button", id: "toggle-annotation-style", commandId: "panel:toggle-annotation-style", variant: "icon", categories: ["panel", "panel-annotation-style"] }, { type: "command-button", id: "toggle-form-fill-mode", commandId: "form:toggle-fill-mode", variant: "icon", categories: ["form", "form-fill-mode"] }, { type: "divider", id: "form-tools-divider-2", orientation: "vertical" }, { type: "command-button", id: "undo-button", commandId: "history:undo", variant: "icon", categories: ["history", "history-undo"] }, { type: "command-button", id: "redo-button", commandId: "history:redo", variant: "icon", categories: ["history", "history-redo"] }] }, { type: "spacer", id: "spacer-form-2", flex: true }] }, "insert-toolbar": { id: "insert-toolbar", position: { placement: "top", slot: "secondary", order: 0 }, permanent: false, categories: ["insert"], items: [{ type: "spacer", id: "spacer-insert-1", flex: true }, { type: "group", id: "insert-tools", alignment: "start", gap: 2, items: [{ type: "command-button", id: "add-rubber-stamp", commandId: "insert:add-rubber-stamp", variant: "icon", categories: ["insert", "insert-rubber-stamp"] }, { type: "command-button", id: "add-signature", commandId: "insert:add-signature", variant: "icon", categories: ["insert", "insert-signature"] }, { type: "command-button", id: "add-image", commandId: "insert:add-image", variant: "icon", categories: ["insert", "insert-image"] }, { type: "divider", id: "insert-tools-divider-1", orientation: "vertical" }, { type: "command-button", id: "toggle-annotation-style", commandId: "panel:toggle-annotation-style", variant: "icon", categories: ["panel", "panel-annotation-style"] }, { type: "divider", id: "insert-tools-divider-2", orientation: "vertical", visibilityDependsOn: { itemIds: ["toggle-annotation-style"] } }, { type: "command-button", id: "undo-button", commandId: "history:undo", variant: "icon", categories: ["history", "history-undo"] }, { type: "command-button", id: "redo-button", commandId: "history:redo", variant: "icon", categories: ["history", "history-redo"] }] }, { type: "spacer", id: "spacer-insert-2", flex: true }] }, "redaction-toolbar": { id: "redaction-toolbar", position: { placement: "top", slot: "secondary", order: 0 }, permanent: false, categories: ["redaction"], items: [{ type: "spacer", id: "spacer-7", flex: true }, { type: "group", id: "redaction-tools", alignment: "start", gap: 2, items: [{ type: "command-button", id: "redact", commandId: "redaction:redact", variant: "icon", categories: ["redaction", "redaction-combined"] }, { type: "divider", id: "redaction-tools-divider-1", orientation: "vertical" }, { type: "command-button", id: "toggle-redaction-panel", commandId: "panel:toggle-redaction", variant: "icon", categories: ["panel", "panel-redaction"] }, { type: "command-button", id: "toggle-annotation-style", commandId: "panel:toggle-annotation-style", variant: "icon", categories: ["panel", "panel-annotation-style"] }, { type: "divider", id: "redaction-tools-divider-2", orientation: "vertical", visibilityDependsOn: { itemIds: ["toggle-annotation-style"] } }, { type: "command-button", id: "undo-button", commandId: "history:undo", variant: "icon", categories: ["history", "history-undo"] }, { type: "command-button", id: "redo-button", commandId: "history:redo", variant: "icon", categories: ["history", "history-redo"] }] }, { type: "spacer", id: "spacer-8", flex: true }] } };
2429
- class jt {
2432
+ jt.id = "paragraph-bookmark";
2433
+ let Zt = jt;
2434
+ const Yt = { manifest: St$1, create: (e14) => new Zt(Mt$1, e14), reducer: (e14) => e14, initialState: {} }, Kt = { "annotation-toolbar": { id: "annotation-toolbar", position: { placement: "top", slot: "secondary", order: 0 }, responsive: { breakpoints: { sm: { maxWidth: 640, hide: ["add-text", "add-ink", "add-ink-highlighter", "add-insert-text", "add-replace-text", "add-comment", "add-callout"], show: ["overflow-annotation-tools"] }, md: { minWidth: 640, hide: ["overflow-annotation-tools"], show: ["add-text", "add-ink", "add-ink-highlighter", "add-insert-text", "add-replace-text", "add-comment", "add-callout"] } } }, permanent: false, categories: ["annotation"], items: [{ type: "spacer", id: "spacer-3", flex: true }, { type: "group", id: "annotation-tools", alignment: "start", gap: 2, items: [{ type: "command-button", id: "add-highlight", commandId: "annotation:add-highlight", variant: "icon", categories: ["annotation", "annotation-markup", "annotation-highlight"] }, { type: "command-button", id: "add-strikeout", commandId: "annotation:add-strikeout", variant: "icon", categories: ["annotation", "annotation-markup", "annotation-strikeout"] }, { type: "command-button", id: "add-underline", commandId: "annotation:add-underline", variant: "icon", categories: ["annotation", "annotation-markup", "annotation-underline"] }, { type: "command-button", id: "add-squiggly", commandId: "annotation:add-squiggly", variant: "icon", categories: ["annotation", "annotation-markup", "annotation-squiggly"] }, { type: "command-button", id: "add-ink", commandId: "annotation:add-ink", variant: "icon", categories: ["annotation", "annotation-ink"] }, { type: "command-button", id: "add-ink-highlighter", commandId: "annotation:add-ink-highlighter", variant: "icon", categories: ["annotation", "annotation-ink"] }, { type: "command-button", id: "add-text", commandId: "annotation:add-text", variant: "icon", categories: ["annotation", "annotation-text"] }, { type: "command-button", id: "add-insert-text", commandId: "annotation:add-insert-text", variant: "icon", categories: ["annotation", "annotation-markup", "annotation-insert-text"] }, { type: "command-button", id: "add-replace-text", commandId: "annotation:add-replace-text", variant: "icon", categories: ["annotation", "annotation-markup", "annotation-replace-text"] }, { type: "command-button", id: "add-comment", commandId: "annotation:add-comment", variant: "icon", categories: ["annotation", "annotation-comment-tool"] }, { type: "command-button", id: "add-callout", commandId: "annotation:add-callout", variant: "icon", categories: ["annotation", "annotation-text"] }, { type: "command-button", id: "overflow-annotation-tools", commandId: "annotation:overflow-tools", variant: "icon", categories: ["annotation", "annotation-overflow"] }, { type: "divider", id: "annotation-tools-divider-1", orientation: "vertical" }, { type: "command-button", id: "toggle-annotation-style", commandId: "panel:toggle-annotation-style", variant: "icon", categories: ["panel", "panel-annotation-style"] }, { type: "divider", id: "annotation-tools-divider-2", orientation: "vertical", visibilityDependsOn: { itemIds: ["toggle-annotation-style"] } }, { type: "command-button", id: "undo-button", commandId: "history:undo", variant: "icon", categories: ["history", "history-undo"] }, { type: "command-button", id: "redo-button", commandId: "history:redo", variant: "icon", categories: ["history", "history-redo"] }] }, { type: "spacer", id: "spacer-4", flex: true }] }, "shapes-toolbar": { id: "shapes-toolbar", position: { placement: "top", slot: "secondary", order: 0 }, responsive: { breakpoints: { sm: { maxWidth: 640, hide: ["add-polygon", "add-polyline"], show: ["overflow-shapes-tools"] }, md: { minWidth: 640, hide: ["overflow-shapes-tools"], show: ["add-polygon", "add-polyline"] } } }, permanent: false, categories: ["annotation", "annotation-shape"], items: [{ type: "spacer", id: "spacer-5", flex: true }, { type: "group", id: "shapes-tools", alignment: "start", gap: 2, items: [{ type: "command-button", id: "add-rectangle", commandId: "annotation:add-rectangle", variant: "icon", categories: ["annotation", "annotation-shape", "annotation-rectangle"] }, { type: "command-button", id: "add-circle", commandId: "annotation:add-circle", variant: "icon", categories: ["annotation", "annotation-shape", "annotation-circle"] }, { type: "command-button", id: "add-line", commandId: "annotation:add-line", variant: "icon", categories: ["annotation", "annotation-shape", "annotation-line"] }, { type: "command-button", id: "add-arrow", commandId: "annotation:add-arrow", variant: "icon", categories: ["annotation", "annotation-shape", "annotation-arrow"] }, { type: "command-button", id: "add-polygon", commandId: "annotation:add-polygon", variant: "icon", categories: ["annotation", "annotation-shape", "annotation-polygon"] }, { type: "command-button", id: "add-polyline", commandId: "annotation:add-polyline", variant: "icon", categories: ["annotation", "annotation-shape", "annotation-polyline"] }, { type: "command-button", id: "overflow-shapes-tools", commandId: "annotation:overflow-shapes", variant: "icon", categories: ["annotation", "annotation-shape", "annotation-overflow"] }, { type: "divider", id: "shapes-tools-divider-1", orientation: "vertical" }, { type: "command-button", id: "toggle-annotation-style", commandId: "panel:toggle-annotation-style", variant: "icon", categories: ["panel", "panel-annotation-style"] }, { type: "divider", id: "shapes-tools-divider-2", orientation: "vertical", visibilityDependsOn: { itemIds: ["toggle-annotation-style"] } }, { type: "command-button", id: "undo-button", commandId: "history:undo", variant: "icon", categories: ["history", "history-undo"] }, { type: "command-button", id: "redo-button", commandId: "history:redo", variant: "icon", categories: ["history", "history-redo"] }] }, { type: "spacer", id: "spacer-6", flex: true }] }, "form-toolbar": { id: "form-toolbar", position: { placement: "top", slot: "secondary", order: 0 }, responsive: { breakpoints: { sm: { maxWidth: 640, hide: ["add-form-select", "add-form-listbox"], show: ["overflow-forms-tools"] }, md: { minWidth: 640, hide: ["overflow-forms-tools"], show: ["add-form-select", "add-form-listbox"] } } }, permanent: false, categories: ["form"], items: [{ type: "spacer", id: "spacer-form-1", flex: true }, { type: "group", id: "form-tools", alignment: "start", gap: 2, items: [{ type: "command-button", id: "add-form-textfield", commandId: "form:add-textfield", variant: "icon", categories: ["form", "form-textfield"] }, { type: "command-button", id: "add-form-checkbox", commandId: "form:add-checkbox", variant: "icon", categories: ["form", "form-checkbox"] }, { type: "command-button", id: "add-form-radio", commandId: "form:add-radio", variant: "icon", categories: ["form", "form-radio"] }, { type: "command-button", id: "add-form-select", commandId: "form:add-select", variant: "icon", categories: ["form", "form-select"] }, { type: "command-button", id: "add-form-listbox", commandId: "form:add-listbox", variant: "icon", categories: ["form", "form-listbox"] }, { type: "command-button", id: "overflow-forms-tools", commandId: "form:overflow-tools", variant: "icon", categories: ["form", "form-overflow"] }, { type: "divider", id: "form-tools-divider-1", orientation: "vertical" }, { type: "command-button", id: "toggle-annotation-style", commandId: "panel:toggle-annotation-style", variant: "icon", categories: ["panel", "panel-annotation-style"] }, { type: "command-button", id: "toggle-form-fill-mode", commandId: "form:toggle-fill-mode", variant: "icon", categories: ["form", "form-fill-mode"] }, { type: "divider", id: "form-tools-divider-2", orientation: "vertical" }, { type: "command-button", id: "undo-button", commandId: "history:undo", variant: "icon", categories: ["history", "history-undo"] }, { type: "command-button", id: "redo-button", commandId: "history:redo", variant: "icon", categories: ["history", "history-redo"] }] }, { type: "spacer", id: "spacer-form-2", flex: true }] }, "insert-toolbar": { id: "insert-toolbar", position: { placement: "top", slot: "secondary", order: 0 }, permanent: false, categories: ["insert"], items: [{ type: "spacer", id: "spacer-insert-1", flex: true }, { type: "group", id: "insert-tools", alignment: "start", gap: 2, items: [{ type: "command-button", id: "add-rubber-stamp", commandId: "insert:add-rubber-stamp", variant: "icon", categories: ["insert", "insert-rubber-stamp"] }, { type: "command-button", id: "add-signature", commandId: "insert:add-signature", variant: "icon", categories: ["insert", "insert-signature"] }, { type: "command-button", id: "add-image", commandId: "insert:add-image", variant: "icon", categories: ["insert", "insert-image"] }, { type: "divider", id: "insert-tools-divider-1", orientation: "vertical" }, { type: "command-button", id: "toggle-annotation-style", commandId: "panel:toggle-annotation-style", variant: "icon", categories: ["panel", "panel-annotation-style"] }, { type: "divider", id: "insert-tools-divider-2", orientation: "vertical", visibilityDependsOn: { itemIds: ["toggle-annotation-style"] } }, { type: "command-button", id: "undo-button", commandId: "history:undo", variant: "icon", categories: ["history", "history-undo"] }, { type: "command-button", id: "redo-button", commandId: "history:redo", variant: "icon", categories: ["history", "history-redo"] }] }, { type: "spacer", id: "spacer-insert-2", flex: true }] }, "redaction-toolbar": { id: "redaction-toolbar", position: { placement: "top", slot: "secondary", order: 0 }, permanent: false, categories: ["redaction"], items: [{ type: "spacer", id: "spacer-7", flex: true }, { type: "group", id: "redaction-tools", alignment: "start", gap: 2, items: [{ type: "command-button", id: "redact", commandId: "redaction:redact", variant: "icon", categories: ["redaction", "redaction-combined"] }, { type: "divider", id: "redaction-tools-divider-1", orientation: "vertical" }, { type: "command-button", id: "toggle-redaction-panel", commandId: "panel:toggle-redaction", variant: "icon", categories: ["panel", "panel-redaction"] }, { type: "command-button", id: "toggle-annotation-style", commandId: "panel:toggle-annotation-style", variant: "icon", categories: ["panel", "panel-annotation-style"] }, { type: "divider", id: "redaction-tools-divider-2", orientation: "vertical", visibilityDependsOn: { itemIds: ["toggle-annotation-style"] } }, { type: "command-button", id: "undo-button", commandId: "history:undo", variant: "icon", categories: ["history", "history-undo"] }, { type: "command-button", id: "redo-button", commandId: "history:redo", variant: "icon", categories: ["history", "history-redo"] }] }, { type: "spacer", id: "spacer-8", flex: true }] } };
2435
+ class Xt {
2430
2436
  constructor() {
2431
2437
  this.specs = [];
2432
2438
  }
@@ -2441,17 +2447,17 @@ class jt {
2441
2447
  return this.specs;
2442
2448
  }
2443
2449
  buildToolbars() {
2444
- const e14 = structuredClone(Bt$1);
2450
+ const e14 = structuredClone(Kt);
2445
2451
  for (const t2 of this.specs) {
2446
2452
  const a3 = e14[t2.toolbarSlot];
2447
2453
  if (!a3) continue;
2448
2454
  const s9 = { type: "command-button", id: t2.id, commandId: t2.commandId, variant: "icon", ...t2.icon ? { icon: t2.icon } : {}, ...t2.i18nKey ? { labelKey: t2.i18nKey } : {}, ...t2.label ? { label: t2.label } : {}, categories: t2.categories ?? [] };
2449
- a3.items = Zt(a3.items, s9, t2.position);
2455
+ a3.items = Qt(a3.items, s9, t2.position);
2450
2456
  }
2451
2457
  return e14;
2452
2458
  }
2453
2459
  }
2454
- function Zt(e14, t2, a3) {
2460
+ function Qt(e14, t2, a3) {
2455
2461
  return (null == a3 ? void 0 : a3.after) || (null == a3 ? void 0 : a3.before) ? (function(e15, t3, a4) {
2456
2462
  const s9 = (e16) => {
2457
2463
  const i2 = [];
@@ -2463,8 +2469,8 @@ function Zt(e14, t2, a3) {
2463
2469
  return e15.map((e16) => "group" === e16.type ? { ...e16, items: [...e16.items, t3] } : e16);
2464
2470
  })(e14, t2);
2465
2471
  }
2466
- const Yt = { annotate: "annotation-toolbar", shapes: "shapes-toolbar", insert: "insert-toolbar", form: "form-toolbar", redact: "redaction-toolbar" };
2467
- function Kt() {
2472
+ const Jt = { annotate: "annotation-toolbar", shapes: "shapes-toolbar", insert: "insert-toolbar", form: "form-toolbar", redact: "redaction-toolbar" };
2473
+ function ea() {
2468
2474
  return { "mode:view": { id: "mode:view", label: "View", categories: ["mode", "mode-view"], action: ({ registry: e14, documentId: t2 }) => {
2469
2475
  var _a2, _b, _c, _d;
2470
2476
  const a3 = (_a2 = e14.getPlugin("ui")) == null ? void 0 : _a2.provides(), s9 = (_b = e14.getPlugin("interaction-manager")) == null ? void 0 : _b.provides();
@@ -2491,16 +2497,16 @@ function Kt() {
2491
2497
  a3 && (a3.setActiveToolbar("top", "secondary", "redaction-toolbar", t2), (_b = e14.getPlugin(ANNOTATION_PLUGIN_ID)) == null ? void 0 : _b.provides().forDocument(t2).setLocked({ type: LockModeType.Include, categories: ["form"] }));
2492
2498
  }, active: ({ state: e14, documentId: t2 }) => isToolbarOpen(e14.plugins, t2, "top", "secondary", "redaction-toolbar") } };
2493
2499
  }
2494
- function Xt(e14) {
2500
+ function ta(e14) {
2495
2501
  var _a2, _b, _c, _d, _e2, _f;
2496
2502
  const t2 = e14.toolbar ?? {}, a3 = t2.enabledModes ?? ["view", "annotate", "shapes", "insert", "form", "redact"], s9 = a3.length > 0, { schema: i2, operationRegistry: o } = (function(e15 = {}) {
2497
2503
  var t3, a4, s10, i3, o2, r3;
2498
- const n3 = new Set(e15.enabledModes ?? ["view", "annotate", "shapes", "insert", "form", "redact"]), l = new jt();
2504
+ const n3 = new Set(e15.enabledModes ?? ["view", "annotate", "shapes", "insert", "form", "redact"]), l = new Xt();
2499
2505
  (null == (t3 = e15.customOperations) ? void 0 : t3.length) && l.registerAll(e15.customOperations);
2500
2506
  const h2 = l.buildToolbars(), d2 = {};
2501
2507
  for (const u of n3) {
2502
2508
  if ("view" === u) continue;
2503
- const e16 = Yt[u];
2509
+ const e16 = Jt[u];
2504
2510
  h2[e16] && (d2[e16] = h2[e16]);
2505
2511
  }
2506
2512
  const c = (function(e16) {
@@ -2509,10 +2515,10 @@ function Xt(e14) {
2509
2515
  return { id: "chapter-editor-main-toolbar", position: { placement: "top", slot: "main", order: 0 }, permanent: true, items: [{ type: "spacer", id: "main-spacer-left", flex: true }, { type: "group", id: "mode-group", alignment: "start", gap: 2, items: [...e16.has("view") ? [t4("view", "View", "mode:view")] : [], ...e16.has("annotate") ? [t4("annotate", "Annotate", "mode:annotate")] : [], ...e16.has("shapes") ? [t4("shapes", "Shapes", "mode:shapes")] : [], ...e16.has("insert") ? [t4("insert", "Insert", "mode:insert")] : [], ...e16.has("form") ? [t4("form", "Form", "mode:form")] : [], ...e16.has("redact") ? [t4("redact", "Redact", "mode:redact")] : []] }, { type: "spacer", id: "main-spacer-right", flex: true }] };
2510
2516
  })(n3);
2511
2517
  return c && (d2["chapter-editor-main-toolbar"] = c), (null == (a4 = e15.extend) ? void 0 : a4.toolbars) && Object.assign(d2, e15.extend.toolbars), { schema: { id: "chapter-pdf-editor-ui", version: "1.0.0", toolbars: d2, menus: (null == (s10 = e15.extend) ? void 0 : s10.menus) ?? {}, sidebars: (null == (i3 = e15.extend) ? void 0 : i3.sidebars) ?? {}, modals: (null == (o2 = e15.extend) ? void 0 : o2.modals) ?? {}, selectionMenus: (null == (r3 = e15.extend) ? void 0 : r3.selectionMenus) ?? {} }, operationRegistry: l };
2512
- })({ ...t2, enabledModes: a3 }), r2 = { ...s9 ? Kt() : {}, ...s9 ? Qt(o.list()) : {}, ...e14.commands ?? {} }, n2 = [createPluginRegistration(DocumentManagerPluginPackage, { initialDocuments: [] }), createPluginRegistration(Re, { manifest: e14.manifest, overlapStrategy: e14.overlapStrategy, passwordProvider: e14.passwordProvider, chapterPdfLoader: e14.chapterPdfLoader, prefetchChapters: e14.prefetchChapters, unloadTimeoutMs: e14.unloadTimeoutMs }), createPluginRegistration(Qe, { placeholderPageHeight: e14.placeholderPageHeight, placeholderPageWidth: e14.placeholderPageWidth }), createPluginRegistration(InteractionManagerPluginPackage), createPluginRegistration(RenderPluginPackage), createPluginRegistration(RotatePluginPackage), createPluginRegistration(SelectionPluginPackage, { marquee: { enabled: false }, toleranceFactor: 1.2, minSelectionDragDistance: 4 }), createPluginRegistration(HistoryPluginPackage), createPluginRegistration(AnnotationPluginPackage), createPluginRegistration(RedactionPluginPackage), createPluginRegistration(FormPluginPackage), createPluginRegistration(StampPluginPackage, false === e14.loadDefaultStampLibrary ? { manifests: [] } : void 0), createPluginRegistration(SignaturePluginPackage), ...Object.keys(r2).length > 0 ? [createPluginRegistration(CommandsPluginPackage, { commands: r2 })] : [], ...s9 ? [createPluginRegistration(I18nPluginPackage), createPluginRegistration(UIPluginPackage, { schema: i2 })] : []];
2513
- return e14.notes && n2.push(createPluginRegistration(Pt$1, { callbacks: e14.notes.callbacks, ui: (_b = (_a2 = e14.features) == null ? void 0 : _a2.notes) == null ? void 0 : _b.marker })), e14.bookmarks && n2.push(createPluginRegistration(Ht$1, { callbacks: e14.bookmarks.callbacks, ui: (_d = (_c = e14.features) == null ? void 0 : _c.bookmarks) == null ? void 0 : _d.marker, hover: (_f = (_e2 = e14.features) == null ? void 0 : _e2.bookmarks) == null ? void 0 : _f.hover })), { plugins: n2, uiSchema: i2, operationRegistry: o };
2518
+ })({ ...t2, enabledModes: a3 }), r2 = { ...s9 ? ea() : {}, ...s9 ? aa(o.list()) : {}, ...e14.commands ?? {} }, n2 = [createPluginRegistration(DocumentManagerPluginPackage, { initialDocuments: [] }), createPluginRegistration(We, { manifest: e14.manifest, overlapStrategy: e14.overlapStrategy, passwordProvider: e14.passwordProvider, chapterPdfLoader: e14.chapterPdfLoader, prefetchChapters: e14.prefetchChapters, unloadTimeoutMs: e14.unloadTimeoutMs }), createPluginRegistration(at$1, { placeholderPageHeight: e14.placeholderPageHeight, placeholderPageWidth: e14.placeholderPageWidth }), createPluginRegistration(InteractionManagerPluginPackage), createPluginRegistration(RenderPluginPackage), createPluginRegistration(RotatePluginPackage), createPluginRegistration(SelectionPluginPackage, { marquee: { enabled: false }, toleranceFactor: 1.2, minSelectionDragDistance: 4 }), createPluginRegistration(HistoryPluginPackage), createPluginRegistration(AnnotationPluginPackage), createPluginRegistration(RedactionPluginPackage), createPluginRegistration(FormPluginPackage), createPluginRegistration(StampPluginPackage, false === e14.loadDefaultStampLibrary ? { manifests: [] } : void 0), createPluginRegistration(SignaturePluginPackage), ...Object.keys(r2).length > 0 ? [createPluginRegistration(CommandsPluginPackage, { commands: r2 })] : [], ...s9 ? [createPluginRegistration(I18nPluginPackage), createPluginRegistration(UIPluginPackage, { schema: i2 })] : []];
2519
+ return e14.notes && n2.push(createPluginRegistration(It$1, { callbacks: e14.notes.callbacks, ui: (_b = (_a2 = e14.features) == null ? void 0 : _a2.notes) == null ? void 0 : _b.marker })), e14.bookmarks && n2.push(createPluginRegistration(Yt, { callbacks: e14.bookmarks.callbacks, ui: (_d = (_c = e14.features) == null ? void 0 : _c.bookmarks) == null ? void 0 : _d.marker, hover: (_f = (_e2 = e14.features) == null ? void 0 : _e2.bookmarks) == null ? void 0 : _f.hover })), { plugins: n2, uiSchema: i2, operationRegistry: o };
2514
2520
  }
2515
- function Qt(e14) {
2521
+ function aa(e14) {
2516
2522
  const t2 = {};
2517
2523
  for (const a3 of e14) a3.handler && (t2[a3.commandId] = { id: a3.commandId, labelKey: a3.i18nKey, label: a3.label, icon: a3.icon, categories: a3.categories, action: ({ documentId: e15 }) => {
2518
2524
  var _a2;
@@ -2520,33 +2526,33 @@ function Qt(e14) {
2520
2526
  } });
2521
2527
  return t2;
2522
2528
  }
2523
- const Jt = Me(), ea = {};
2524
- function ta(e14) {
2525
- return Xt({ ...e14, toolbar: e14.toolbar ?? { enabledModes: [] }, features: Me(e14.features) });
2529
+ const sa = Le(), ia = {};
2530
+ function oa(e14) {
2531
+ return ta({ ...e14, toolbar: e14.toolbar ?? { enabledModes: [] }, features: Le(e14.features) });
2526
2532
  }
2527
- const aa = { overlapStrategy: { kind: "first-wins" }, passwordProvider: new xe(async () => null), prefetchChapters: 1, loadDefaultStampLibrary: false, unloadTimeoutMs: 12e4, toolbar: { enabledModes: [] } };
2528
- function sa(e14) {
2533
+ const ra = { overlapStrategy: { kind: "first-wins" }, passwordProvider: new ze(async () => null), prefetchChapters: 1, loadDefaultStampLibrary: false, unloadTimeoutMs: 12e4, toolbar: { enabledModes: [] } };
2534
+ function na(e14) {
2529
2535
  return (function(e15) {
2530
2536
  return "callbacks" in e15.notes;
2531
2537
  })(e14) ? { manifest: e14.manifest, chapterPdfLoader: e14.chapterPdfLoader, notes: e14.notes.callbacks, bookmarks: e14.bookmarks.callbacks } : e14;
2532
2538
  }
2533
- function ia(e14) {
2534
- return { ...aa, manifest: e14.manifest, chapterPdfLoader: e14.chapterPdfLoader, overlapStrategy: e14.overlapStrategy ?? aa.overlapStrategy, notes: { callbacks: e14.notes }, bookmarks: { callbacks: e14.bookmarks }, features: Me(e14.features) };
2539
+ function la(e14) {
2540
+ return { ...ra, manifest: e14.manifest, chapterPdfLoader: e14.chapterPdfLoader, overlapStrategy: e14.overlapStrategy ?? ra.overlapStrategy, notes: { callbacks: e14.notes }, bookmarks: { callbacks: e14.bookmarks }, features: Le(e14.features) };
2535
2541
  }
2536
- function oa(e14) {
2537
- const t2 = ia(sa(e14)), { plugins: a3 } = ta(t2);
2542
+ function ha(e14) {
2543
+ const t2 = la(na(e14)), { plugins: a3 } = oa(t2);
2538
2544
  return { plugins: a3, features: t2.features, editorOptions: t2 };
2539
2545
  }
2540
- function ra(e14) {
2541
- const { features: t2, ...a3 } = ia(sa(e14));
2546
+ function da(e14) {
2547
+ const { features: t2, ...a3 } = la(na(e14));
2542
2548
  return a3;
2543
2549
  }
2544
- function na(e14, t2 = 0.5, a3 = 3) {
2550
+ function ca(e14, t2 = 0.5, a3 = 3) {
2545
2551
  return Math.min(a3, Math.max(t2, e14));
2546
2552
  }
2547
- function la(i2, o) {
2553
+ function ua(i2, o) {
2548
2554
  var _a2;
2549
- const r2 = isRef(i2) ? i2 : computed(() => i2), { registry: n2 } = useRegistry(), { provides: l } = useCapability(DocumentManagerPlugin.id), { provides: h2 } = useCapability(Ee.id), d2 = ref(((_a2 = o.value) == null ? void 0 : _a2.initial) ?? 1), c = ref(d2.value), u = () => {
2555
+ const r2 = isRef(i2) ? i2 : computed(() => i2), { registry: n2 } = useRegistry(), { provides: l } = useCapability(DocumentManagerPlugin.id), { provides: h2 } = useCapability(qe.id), d2 = ref(((_a2 = o.value) == null ? void 0 : _a2.initial) ?? 1), c = ref(d2.value), u = () => {
2550
2556
  var _a3;
2551
2557
  return ((_a3 = o.value) == null ? void 0 : _a3.min) ?? 0.5;
2552
2558
  }, p2 = () => {
@@ -2557,11 +2563,11 @@ function la(i2, o) {
2557
2563
  return (_a3 = o.value) == null ? void 0 : _a3.pageWidth;
2558
2564
  };
2559
2565
  function f(e14) {
2560
- const t2 = na(e14, u(), p2());
2566
+ const t2 = ca(e14, u(), p2());
2561
2567
  c.value = t2, d2.value = t2, (function(e15, t3, a3, s9 = 0.5, i3 = 3) {
2562
2568
  const o2 = e15 == null ? void 0 : e15.getStore();
2563
2569
  if (!o2) return;
2564
- const r3 = na(a3, s9, i3);
2570
+ const r3 = ca(a3, s9, i3);
2565
2571
  o2.dispatchToCore(setDefaultScale(r3));
2566
2572
  for (const n3 of t3.chapters) o2.getState().core.documents[n3.chapterId] && o2.dispatchToCore(setScale(r3, n3.chapterId));
2567
2573
  })(n2.value, r2.value, t2, u(), p2());
@@ -2603,10 +2609,10 @@ function la(i2, o) {
2603
2609
  return false !== ((_a3 = o.value) == null ? void 0 : _a3.enabled);
2604
2610
  }, minZoom: u, maxZoom: p2 };
2605
2611
  }
2606
- function ha(e14, t2, a3) {
2612
+ function pa(e14, t2, a3) {
2607
2613
  return Math.min(a3, Math.max(t2, e14));
2608
2614
  }
2609
- function da(e14, t2) {
2615
+ function ga(e14, t2) {
2610
2616
  if (!e14 || false === t2.enabled) return () => {
2611
2617
  };
2612
2618
  let a3 = null, s9 = null, i2 = 0;
@@ -2615,7 +2621,7 @@ function da(e14, t2) {
2615
2621
  return !!s10 && (a3 == null ? void 0 : a3(), a3 = (function({ container: e15, getScale: t3, setScale: a4, minZoom: s11 = 0.5, maxZoom: i3 = 3 }) {
2616
2622
  let o2 = 0, r2 = 1, n2 = null, l = 1, h2 = 1;
2617
2623
  const d2 = (e16) => {
2618
- (e16.ctrlKey || e16.metaKey) && (e16.preventDefault(), null === n2 ? (h2 = t3(), l = 1) : clearTimeout(n2), l *= 1 - 0.01 * e16.deltaY, l = ha(l, 0.1, 10), a4(ha(h2 * l, s11, i3)), n2 = setTimeout(() => {
2624
+ (e16.ctrlKey || e16.metaKey) && (e16.preventDefault(), null === n2 ? (h2 = t3(), l = 1) : clearTimeout(n2), l *= 1 - 0.01 * e16.deltaY, l = pa(l, 0.1, 10), a4(pa(h2 * l, s11, i3)), n2 = setTimeout(() => {
2619
2625
  n2 = null;
2620
2626
  }, 120));
2621
2627
  }, c = /* @__PURE__ */ new Map(), u = (e16) => {
@@ -2627,7 +2633,7 @@ function da(e14, t2) {
2627
2633
  if (c.has(e16.pointerId) && (c.set(e16.pointerId, { x: e16.clientX, y: e16.clientY }), 2 === c.size && o2 > 0)) {
2628
2634
  e16.preventDefault();
2629
2635
  const [t4, n3] = [...c.values()], l2 = Math.hypot(n3.x - t4.x, n3.y - t4.y);
2630
- a4(ha(r2 * (l2 / o2), s11, i3));
2636
+ a4(pa(r2 * (l2 / o2), s11, i3));
2631
2637
  }
2632
2638
  }, g2 = (e16) => {
2633
2639
  c.delete(e16.pointerId), c.size < 2 && (o2 = 0);
@@ -2643,26 +2649,26 @@ function da(e14, t2) {
2643
2649
  i2 && cancelAnimationFrame(i2), s9 == null ? void 0 : s9.disconnect(), a3 == null ? void 0 : a3();
2644
2650
  };
2645
2651
  }
2646
- const ca = { chapters: [] };
2647
- function ua(e14) {
2648
- const o = ref(null), { provides: r2 } = useCapability(Ee.id), n2 = computed(() => {
2652
+ const fa = { chapters: [] };
2653
+ function ma(e14) {
2654
+ const o = ref(null), { provides: r2 } = useCapability(qe.id), n2 = computed(() => {
2649
2655
  var _a2;
2650
- return ((_a2 = r2.value) == null ? void 0 : _a2.getManifest()) ?? ca;
2656
+ return ((_a2 = r2.value) == null ? void 0 : _a2.getManifest()) ?? fa;
2651
2657
  }), l = computed(() => {
2652
2658
  var _a2;
2653
2659
  return (_a2 = e14.value) == null ? void 0 : _a2.zoom;
2654
- }), { scale: h2, setScale: d2, zoomEnabled: c, minZoom: u, maxZoom: p2 } = la(n2, l);
2660
+ }), { scale: h2, setScale: d2, zoomEnabled: c, minZoom: u, maxZoom: p2 } = ua(n2, l);
2655
2661
  return (function(e15, t2) {
2656
2662
  let a3 = null;
2657
2663
  watch([e15, t2], () => {
2658
2664
  a3 == null ? void 0 : a3();
2659
2665
  const s9 = t2.value;
2660
- a3 = da(e15.value ?? null, { enabled: s9.enabled, getScale: s9.getScale, setScale: s9.setScale, minZoom: s9.minZoom, maxZoom: s9.maxZoom });
2666
+ a3 = ga(e15.value ?? null, { enabled: s9.enabled, getScale: s9.getScale, setScale: s9.setScale, minZoom: s9.minZoom, maxZoom: s9.maxZoom });
2661
2667
  }, { deep: true, flush: "post" }), onBeforeUnmount(() => a3 == null ? void 0 : a3());
2662
2668
  })(o, computed(() => ({ enabled: c(), getScale: () => h2.value, setScale: d2, minZoom: u(), maxZoom: p2() }))), { hostRef: o, scale: h2, setScale: d2, zoomEnabled: c };
2663
2669
  }
2664
- const pa = { kind: "first-wins" };
2665
- function ga(e14, t2, a3) {
2670
+ const va = { kind: "first-wins" };
2671
+ function ba(e14, t2, a3) {
2666
2672
  if (1 === t2.length) return t2[0].chapterId;
2667
2673
  switch (a3.kind) {
2668
2674
  case "first-wins":
@@ -2680,7 +2686,7 @@ function ga(e14, t2, a3) {
2680
2686
  return a3.resolve(e14, t2);
2681
2687
  }
2682
2688
  }
2683
- class fa {
2689
+ class Pa {
2684
2690
  constructor(e14) {
2685
2691
  this._pages = e14, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
2686
2692
  for (const t2 of e14) {
@@ -2714,8 +2720,8 @@ class fa {
2714
2720
  return a3 ? this._pages.indexOf(a3) : -1;
2715
2721
  }
2716
2722
  }
2717
- function ma(e14, t2 = pa) {
2718
- const a3 = (function(e15, t3 = pa) {
2723
+ function wa(e14, t2 = va) {
2724
+ const a3 = (function(e15, t3 = va) {
2719
2725
  const a4 = /* @__PURE__ */ new Map();
2720
2726
  for (const i3 of e15.chapters) {
2721
2727
  const [e16, t4] = i3.globalPageRange;
@@ -2725,7 +2731,7 @@ function ma(e14, t2 = pa) {
2725
2731
  }
2726
2732
  }
2727
2733
  const s10 = /* @__PURE__ */ new Map();
2728
- for (const [i3, o2] of a4) s10.set(i3, ga(i3, o2, t3));
2734
+ for (const [i3, o2] of a4) s10.set(i3, ba(i3, o2, t3));
2729
2735
  return s10;
2730
2736
  })(e14, t2), s9 = /* @__PURE__ */ new Map();
2731
2737
  for (const n2 of e14.chapters) s9.set(n2.chapterId, n2);
@@ -2737,14 +2743,14 @@ function ma(e14, t2 = pa) {
2737
2743
  const [i3] = t3.globalPageRange, [l] = t3.localPageRange, h2 = l + (n2 - i3);
2738
2744
  o.push({ globalPageIndex: r2++, globalPageNumber: n2, chapterId: e15, localPageIndex: h2 });
2739
2745
  }
2740
- return new fa(o);
2746
+ return new Pa(o);
2741
2747
  }
2742
- const va = class e9 extends BasePlugin {
2748
+ const ya = class e9 extends BasePlugin {
2743
2749
  constructor(e14, t2) {
2744
- super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = pa, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
2750
+ super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = va, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
2745
2751
  }
2746
2752
  async initialize(e14) {
2747
- if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? pa, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
2753
+ if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? va, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
2748
2754
  this.isOwnedChapter(e15.id) && (this.passwordAttempts.delete(e15.id), this.updateStatus(e15.id, "loaded"));
2749
2755
  }), this.documentManager.provides().onDocumentClosed((e15) => {
2750
2756
  this.isOwnedChapter(e15) && this.updateStatus(e15, "closed");
@@ -2779,7 +2785,7 @@ const va = class e9 extends BasePlugin {
2779
2785
  const s9 = new Set(this.chapterStatus.keys()), i2 = new Set(t2.chapters.map((e14) => e14.chapterId));
2780
2786
  for (const e14 of s9) i2.has(e14) || (this.closeChapter(e14), this.chapterStatus.delete(e14));
2781
2787
  for (const e14 of t2.chapters) this.chapterStatus.has(e14.chapterId) || this.chapterStatus.set(e14.chapterId, "idle");
2782
- this.manifest = t2, this.virtualPageMap = ma(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
2788
+ this.manifest = t2, this.virtualPageMap = wa(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
2783
2789
  }
2784
2790
  eagerPrefetchFromManifest() {
2785
2791
  const e14 = this.config.prefetchChapters ?? 0;
@@ -2917,9 +2923,9 @@ const va = class e9 extends BasePlugin {
2917
2923
  this.chapterStatus.get(e14) !== t2 && (this.chapterStatus.set(e14, t2), this.statusChange$.emit({ chapterId: e14, status: t2, ..."error" === t2 && a3 ? { error: { message: a3 } } : {} }));
2918
2924
  }
2919
2925
  };
2920
- va.id = "chapter-manager";
2921
- let ba = va;
2922
- function Pa(e14, t2) {
2926
+ ya.id = "chapter-manager";
2927
+ let Ca = ya;
2928
+ function Ia(e14, t2) {
2923
2929
  if (e14 === t2) return true;
2924
2930
  if (e14.totalHeight !== t2.totalHeight || e14.totalWidth !== t2.totalWidth || e14.pageGap !== t2.pageGap || e14.items.length !== t2.items.length) return false;
2925
2931
  for (let a3 = 0; a3 < e14.items.length; a3++) {
@@ -2928,9 +2934,9 @@ function Pa(e14, t2) {
2928
2934
  }
2929
2935
  return true;
2930
2936
  }
2931
- const wa = class extends BasePlugin {
2937
+ const Ma = class extends BasePlugin {
2932
2938
  constructor(e14, t2) {
2933
- super(e14, t2), this.layoutChange$ = createBehaviorEmitter(void 0, Pa), this.visibleChange$ = createBehaviorEmitter(), this.virtualPageMap = null, this.pageSizes = /* @__PURE__ */ new Map(), this.offsets = [], this.totalHeight = 0, this.totalWidth = 0, this.viewportEl = null, this.viewportObservers = null, this.currentVisible = [], this.currentGlobalPageIndex = 0, this.chapterManagerUnsubs = [], this.chapterManager = this.registry.getPlugin(ba.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
2939
+ super(e14, t2), this.layoutChange$ = createBehaviorEmitter(void 0, Ia), this.visibleChange$ = createBehaviorEmitter(), this.virtualPageMap = null, this.pageSizes = /* @__PURE__ */ new Map(), this.offsets = [], this.totalHeight = 0, this.totalWidth = 0, this.viewportEl = null, this.viewportObservers = null, this.currentVisible = [], this.currentGlobalPageIndex = 0, this.chapterManagerUnsubs = [], this.chapterManager = this.registry.getPlugin(Ca.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
2934
2940
  }
2935
2941
  async initialize(e14) {
2936
2942
  this.config = { placeholderPageHeight: e14.placeholderPageHeight ?? 1200, placeholderPageWidth: e14.placeholderPageWidth ?? 900, bufferSize: e14.bufferSize ?? 2, pageGap: e14.pageGap ?? 20 }, this.virtualPageMap = this.chapterManager.provides().getVirtualPageMap(), this.rebuildOffsets(), this.chapterManagerUnsubs.push(this.chapterManager.provides().onManifestChange(({ map: e15 }) => {
@@ -3107,14 +3113,14 @@ const wa = class extends BasePlugin {
3107
3113
  a3 && this.scrollToIndex(a3.globalPageIndex, t2);
3108
3114
  }
3109
3115
  };
3110
- wa.id = "chapter-scroll";
3111
- let ya = wa;
3112
- const Ca = ["data-global-page-index", "data-chapter-id", "data-local-page-index"], Ia = /* @__PURE__ */ ((e14, t2) => {
3116
+ Ma.id = "chapter-scroll";
3117
+ let Sa = Ma;
3118
+ const xa = ["data-global-page-index", "data-chapter-id", "data-local-page-index"], ka = /* @__PURE__ */ ((e14, t2) => {
3113
3119
  const a3 = e14.__vccOpts || e14;
3114
3120
  for (const [s9, i2] of t2) a3[s9] = i2;
3115
3121
  return a3;
3116
3122
  })(/* @__PURE__ */ defineComponent({ __name: "ChapterScroller", props: { class: {}, style: {} }, setup(e14) {
3117
- const { provides: t2 } = useCapability(ya.id), o = ref(null), f = ref(null);
3123
+ const { provides: t2 } = useCapability(Sa.id), o = ref(null), f = ref(null);
3118
3124
  let m = null;
3119
3125
  const v = () => {
3120
3126
  null == m || m(), m = null, t2.value && (t2.value.registerViewport(o.value), m = t2.value.onLayoutChange((e15) => {
@@ -3126,11 +3132,11 @@ const Ca = ["data-global-page-index", "data-chapter-id", "data-local-page-index"
3126
3132
  null == m || m(), null == (e15 = t2.value) || e15.registerViewport(null);
3127
3133
  }), watch(t2, v), (e15, t3) => {
3128
3134
  var a3, s9, i2;
3129
- return openBlock(), createElementBlock("div", { ref_key: "containerRef", ref: o, "data-chapter-scroll-viewport": "", class: normalizeClass(e15.$props.class), style: normalizeStyle({ overflow: "auto", position: "relative", width: "100%", height: "100%", ...e15.$props.style }) }, [createElementVNode("div", { style: normalizeStyle({ position: "relative", width: `${(null == (a3 = f.value) ? void 0 : a3.totalWidth) ?? 0}px`, height: `${(null == (s9 = f.value) ? void 0 : s9.totalHeight) ?? 0}px`, margin: "0 auto" }) }, [(openBlock(true), createElementBlock(Fragment, null, renderList((null == (i2 = f.value) ? void 0 : i2.items) ?? [], (a4) => (openBlock(), createElementBlock("div", { key: a4.globalPageIndex, "data-global-page-index": a4.globalPageIndex, "data-chapter-id": a4.chapterId, "data-local-page-index": a4.localPageIndex, style: normalizeStyle({ position: "absolute", top: `${a4.offsetTop}px`, left: "50%", transform: "translateX(-50%)", width: `${a4.width}px`, height: `${a4.height}px`, backgroundColor: a4.isPlaceholder ? "#f3f4f6" : "#fff", boxShadow: "0 1px 4px rgba(0,0,0,0.08)" }) }, [a4.isPlaceholder ? renderSlot(e15.$slots, "placeholder", { key: 0, item: a4 }, () => [t3[0] || (t3[0] = createElementVNode("div", { class: "chapter-scroll-placeholder" }, "Loading chapter…", -1))], true) : renderSlot(e15.$slots, "page", { key: 1, item: a4 }, void 0, true)], 12, Ca))), 128))], 4)], 6);
3135
+ return openBlock(), createElementBlock("div", { ref_key: "containerRef", ref: o, "data-chapter-scroll-viewport": "", class: normalizeClass(e15.$props.class), style: normalizeStyle({ overflow: "auto", position: "relative", width: "100%", height: "100%", ...e15.$props.style }) }, [createElementVNode("div", { style: normalizeStyle({ position: "relative", width: `${(null == (a3 = f.value) ? void 0 : a3.totalWidth) ?? 0}px`, height: `${(null == (s9 = f.value) ? void 0 : s9.totalHeight) ?? 0}px`, margin: "0 auto" }) }, [(openBlock(true), createElementBlock(Fragment, null, renderList((null == (i2 = f.value) ? void 0 : i2.items) ?? [], (a4) => (openBlock(), createElementBlock("div", { key: a4.globalPageIndex, "data-global-page-index": a4.globalPageIndex, "data-chapter-id": a4.chapterId, "data-local-page-index": a4.localPageIndex, style: normalizeStyle({ position: "absolute", top: `${a4.offsetTop}px`, left: "50%", transform: "translateX(-50%)", width: `${a4.width}px`, height: `${a4.height}px`, backgroundColor: a4.isPlaceholder ? "#f3f4f6" : "#fff", boxShadow: "0 1px 4px rgba(0,0,0,0.08)" }) }, [a4.isPlaceholder ? renderSlot(e15.$slots, "placeholder", { key: 0, item: a4 }, () => [t3[0] || (t3[0] = createElementVNode("div", { class: "chapter-scroll-placeholder" }, "Loading chapter…", -1))], true) : renderSlot(e15.$slots, "page", { key: 1, item: a4 }, void 0, true)], 12, xa))), 128))], 4)], 6);
3130
3136
  };
3131
- } }), [["__scopeId", "data-v-8a737137"]]), Ma = /* @__PURE__ */ defineComponent({ __name: "ChapterRenderLayer", props: { chapterId: {}, localPageIndex: {}, scale: {}, dpr: {}, class: {} }, setup: (e14) => (t2, a3) => (openBlock(), createBlock(unref(RenderLayer), { "document-id": e14.chapterId, "page-index": e14.localPageIndex, scale: e14.scale, dpr: e14.dpr, class: normalizeClass(e14.class), style: { pointerEvents: "none" } }, null, 8, ["document-id", "page-index", "scale", "dpr", "class"])) });
3132
- const Sa = { kind: "first-wins" };
3133
- function xa(e14, t2, a3) {
3137
+ } }), [["__scopeId", "data-v-8a737137"]]), La = /* @__PURE__ */ defineComponent({ __name: "ChapterRenderLayer", props: { chapterId: {}, localPageIndex: {}, scale: {}, dpr: {}, class: {} }, setup: (e14) => (t2, a3) => (openBlock(), createBlock(unref(RenderLayer), { "document-id": e14.chapterId, "page-index": e14.localPageIndex, scale: e14.scale, dpr: e14.dpr, class: normalizeClass(e14.class), style: { pointerEvents: "none" } }, null, 8, ["document-id", "page-index", "scale", "dpr", "class"])) });
3138
+ const $a = { kind: "first-wins" };
3139
+ function za(e14, t2, a3) {
3134
3140
  if (1 === t2.length) return t2[0].chapterId;
3135
3141
  switch (a3.kind) {
3136
3142
  case "first-wins":
@@ -3148,7 +3154,7 @@ function xa(e14, t2, a3) {
3148
3154
  return a3.resolve(e14, t2);
3149
3155
  }
3150
3156
  }
3151
- let ka = class {
3157
+ let Ta = class {
3152
3158
  constructor(e14) {
3153
3159
  this._pages = e14, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
3154
3160
  for (const t2 of e14) {
@@ -3182,8 +3188,8 @@ let ka = class {
3182
3188
  return a3 ? this._pages.indexOf(a3) : -1;
3183
3189
  }
3184
3190
  };
3185
- function La(e14, t2 = Sa) {
3186
- const a3 = (function(e15, t3 = Sa) {
3191
+ function Da(e14, t2 = $a) {
3192
+ const a3 = (function(e15, t3 = $a) {
3187
3193
  const a4 = /* @__PURE__ */ new Map();
3188
3194
  for (const i3 of e15.chapters) {
3189
3195
  const [e16, t4] = i3.globalPageRange;
@@ -3193,7 +3199,7 @@ function La(e14, t2 = Sa) {
3193
3199
  }
3194
3200
  }
3195
3201
  const s10 = /* @__PURE__ */ new Map();
3196
- for (const [i3, o2] of a4) s10.set(i3, xa(i3, o2, t3));
3202
+ for (const [i3, o2] of a4) s10.set(i3, za(i3, o2, t3));
3197
3203
  return s10;
3198
3204
  })(e14, t2), s9 = /* @__PURE__ */ new Map();
3199
3205
  for (const n2 of e14.chapters) s9.set(n2.chapterId, n2);
@@ -3205,14 +3211,14 @@ function La(e14, t2 = Sa) {
3205
3211
  const [i3] = t3.globalPageRange, [l] = t3.localPageRange, h2 = l + (n2 - i3);
3206
3212
  o.push({ globalPageIndex: r2++, globalPageNumber: n2, chapterId: e15, localPageIndex: h2 });
3207
3213
  }
3208
- return new ka(o);
3214
+ return new Ta(o);
3209
3215
  }
3210
- const $a = class e10 extends BasePlugin {
3216
+ const Oa = class e10 extends BasePlugin {
3211
3217
  constructor(e14, t2) {
3212
- super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = Sa, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
3218
+ super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = $a, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
3213
3219
  }
3214
3220
  async initialize(e14) {
3215
- if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? Sa, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
3221
+ if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? $a, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
3216
3222
  this.isOwnedChapter(e15.id) && (this.passwordAttempts.delete(e15.id), this.updateStatus(e15.id, "loaded"));
3217
3223
  }), this.documentManager.provides().onDocumentClosed((e15) => {
3218
3224
  this.isOwnedChapter(e15) && this.updateStatus(e15, "closed");
@@ -3247,7 +3253,7 @@ const $a = class e10 extends BasePlugin {
3247
3253
  const s9 = new Set(this.chapterStatus.keys()), i2 = new Set(t2.chapters.map((e14) => e14.chapterId));
3248
3254
  for (const e14 of s9) i2.has(e14) || (this.closeChapter(e14), this.chapterStatus.delete(e14));
3249
3255
  for (const e14 of t2.chapters) this.chapterStatus.has(e14.chapterId) || this.chapterStatus.set(e14.chapterId, "idle");
3250
- this.manifest = t2, this.virtualPageMap = La(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
3256
+ this.manifest = t2, this.virtualPageMap = Da(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
3251
3257
  }
3252
3258
  eagerPrefetchFromManifest() {
3253
3259
  const e14 = this.config.prefetchChapters ?? 0;
@@ -3385,10 +3391,10 @@ const $a = class e10 extends BasePlugin {
3385
3391
  this.chapterStatus.get(e14) !== t2 && (this.chapterStatus.set(e14, t2), this.statusChange$.emit({ chapterId: e14, status: t2, ..."error" === t2 && a3 ? { error: { message: a3 } } : {} }));
3386
3392
  }
3387
3393
  };
3388
- $a.id = "chapter-manager";
3389
- let za = $a;
3390
- const Ta = { kind: "first-wins" };
3391
- function Da(e14, t2, a3) {
3394
+ Oa.id = "chapter-manager";
3395
+ let Ga = Oa;
3396
+ const Na = { kind: "first-wins" };
3397
+ function Aa(e14, t2, a3) {
3392
3398
  if (1 === t2.length) return t2[0].chapterId;
3393
3399
  switch (a3.kind) {
3394
3400
  case "first-wins":
@@ -3406,7 +3412,7 @@ function Da(e14, t2, a3) {
3406
3412
  return a3.resolve(e14, t2);
3407
3413
  }
3408
3414
  }
3409
- class Oa {
3415
+ class Va {
3410
3416
  constructor(e14) {
3411
3417
  this._pages = e14, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
3412
3418
  for (const t2 of e14) {
@@ -3440,8 +3446,8 @@ class Oa {
3440
3446
  return a3 ? this._pages.indexOf(a3) : -1;
3441
3447
  }
3442
3448
  }
3443
- function Ga(e14, t2 = Ta) {
3444
- const a3 = (function(e15, t3 = Ta) {
3449
+ function Ea(e14, t2 = Na) {
3450
+ const a3 = (function(e15, t3 = Na) {
3445
3451
  const a4 = /* @__PURE__ */ new Map();
3446
3452
  for (const i3 of e15.chapters) {
3447
3453
  const [e16, t4] = i3.globalPageRange;
@@ -3451,7 +3457,7 @@ function Ga(e14, t2 = Ta) {
3451
3457
  }
3452
3458
  }
3453
3459
  const s10 = /* @__PURE__ */ new Map();
3454
- for (const [i3, o2] of a4) s10.set(i3, Da(i3, o2, t3));
3460
+ for (const [i3, o2] of a4) s10.set(i3, Aa(i3, o2, t3));
3455
3461
  return s10;
3456
3462
  })(e14, t2), s9 = /* @__PURE__ */ new Map();
3457
3463
  for (const n2 of e14.chapters) s9.set(n2.chapterId, n2);
@@ -3463,14 +3469,14 @@ function Ga(e14, t2 = Ta) {
3463
3469
  const [i3] = t3.globalPageRange, [l] = t3.localPageRange, h2 = l + (n2 - i3);
3464
3470
  o.push({ globalPageIndex: r2++, globalPageNumber: n2, chapterId: e15, localPageIndex: h2 });
3465
3471
  }
3466
- return new Oa(o);
3472
+ return new Va(o);
3467
3473
  }
3468
- const Na = class e11 extends BasePlugin {
3474
+ const _a = class e11 extends BasePlugin {
3469
3475
  constructor(e14, t2) {
3470
- super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = Ta, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
3476
+ super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = Na, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
3471
3477
  }
3472
3478
  async initialize(e14) {
3473
- if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? Ta, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
3479
+ if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? Na, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
3474
3480
  this.isOwnedChapter(e15.id) && (this.passwordAttempts.delete(e15.id), this.updateStatus(e15.id, "loaded"));
3475
3481
  }), this.documentManager.provides().onDocumentClosed((e15) => {
3476
3482
  this.isOwnedChapter(e15) && this.updateStatus(e15, "closed");
@@ -3505,7 +3511,7 @@ const Na = class e11 extends BasePlugin {
3505
3511
  const s9 = new Set(this.chapterStatus.keys()), i2 = new Set(t2.chapters.map((e14) => e14.chapterId));
3506
3512
  for (const e14 of s9) i2.has(e14) || (this.closeChapter(e14), this.chapterStatus.delete(e14));
3507
3513
  for (const e14 of t2.chapters) this.chapterStatus.has(e14.chapterId) || this.chapterStatus.set(e14.chapterId, "idle");
3508
- this.manifest = t2, this.virtualPageMap = Ga(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
3514
+ this.manifest = t2, this.virtualPageMap = Ea(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
3509
3515
  }
3510
3516
  eagerPrefetchFromManifest() {
3511
3517
  const e14 = this.config.prefetchChapters ?? 0;
@@ -3643,9 +3649,9 @@ const Na = class e11 extends BasePlugin {
3643
3649
  this.chapterStatus.get(e14) !== t2 && (this.chapterStatus.set(e14, t2), this.statusChange$.emit({ chapterId: e14, status: t2, ..."error" === t2 && a3 ? { error: { message: a3 } } : {} }));
3644
3650
  }
3645
3651
  };
3646
- Na.id = "chapter-manager";
3647
- let Aa = Na;
3648
- function Va(e14, t2) {
3652
+ _a.id = "chapter-manager";
3653
+ let Ra = _a;
3654
+ function Fa(e14, t2) {
3649
3655
  if (e14 === t2) return true;
3650
3656
  if (e14.totalHeight !== t2.totalHeight || e14.totalWidth !== t2.totalWidth || e14.pageGap !== t2.pageGap || e14.items.length !== t2.items.length) return false;
3651
3657
  for (let a3 = 0; a3 < e14.items.length; a3++) {
@@ -3654,9 +3660,9 @@ function Va(e14, t2) {
3654
3660
  }
3655
3661
  return true;
3656
3662
  }
3657
- const _a = class extends BasePlugin {
3663
+ const Ua = class extends BasePlugin {
3658
3664
  constructor(e14, t2) {
3659
- super(e14, t2), this.layoutChange$ = createBehaviorEmitter(void 0, Va), this.visibleChange$ = createBehaviorEmitter(), this.virtualPageMap = null, this.pageSizes = /* @__PURE__ */ new Map(), this.offsets = [], this.totalHeight = 0, this.totalWidth = 0, this.viewportEl = null, this.viewportObservers = null, this.currentVisible = [], this.currentGlobalPageIndex = 0, this.chapterManagerUnsubs = [], this.chapterManager = this.registry.getPlugin(Aa.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
3665
+ super(e14, t2), this.layoutChange$ = createBehaviorEmitter(void 0, Fa), this.visibleChange$ = createBehaviorEmitter(), this.virtualPageMap = null, this.pageSizes = /* @__PURE__ */ new Map(), this.offsets = [], this.totalHeight = 0, this.totalWidth = 0, this.viewportEl = null, this.viewportObservers = null, this.currentVisible = [], this.currentGlobalPageIndex = 0, this.chapterManagerUnsubs = [], this.chapterManager = this.registry.getPlugin(Ra.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
3660
3666
  }
3661
3667
  async initialize(e14) {
3662
3668
  this.config = { placeholderPageHeight: e14.placeholderPageHeight ?? 1200, placeholderPageWidth: e14.placeholderPageWidth ?? 900, bufferSize: e14.bufferSize ?? 2, pageGap: e14.pageGap ?? 20 }, this.virtualPageMap = this.chapterManager.provides().getVirtualPageMap(), this.rebuildOffsets(), this.chapterManagerUnsubs.push(this.chapterManager.provides().onManifestChange(({ map: e15 }) => {
@@ -3833,11 +3839,11 @@ const _a = class extends BasePlugin {
3833
3839
  a3 && this.scrollToIndex(a3.globalPageIndex, t2);
3834
3840
  }
3835
3841
  };
3836
- _a.id = "chapter-scroll";
3837
- let Ea = _a;
3838
- const Ra = class e12 extends BasePlugin {
3842
+ Ua.id = "chapter-scroll";
3843
+ let qa = Ua;
3844
+ const Wa = class e12 extends BasePlugin {
3839
3845
  constructor(e14, t2) {
3840
- super(e14, t2), this.notesChange$ = createBehaviorEmitter([]), this.noteActivated$ = createEmitter(), this.notes = /* @__PURE__ */ new Map(), this.chapterScroll = this.registry.getPlugin(Ea.id), this.chapterManager = this.registry.getPlugin(za.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
3846
+ super(e14, t2), this.notesChange$ = createBehaviorEmitter([]), this.noteActivated$ = createEmitter(), this.notes = /* @__PURE__ */ new Map(), this.chapterScroll = this.registry.getPlugin(qa.id), this.chapterManager = this.registry.getPlugin(Ga.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
3841
3847
  }
3842
3848
  async initialize(t2) {
3843
3849
  if (this.config = t2, t2.callbacks.loadNotes) try {
@@ -3875,7 +3881,7 @@ const Ra = class e12 extends BasePlugin {
3875
3881
  this.notesChange$.emit(this.listAll());
3876
3882
  }
3877
3883
  buildDraft(e14) {
3878
- return { chapterId: e14.chapterId, localPageIndex: e14.localPageIndex, globalPageNumber: e14.globalPageNumber, globalPageIndex: e14.globalPageIndex, rectsPdfCoord: e14.rectsPdfCoord, endAnchor: Ua(e14.rectsPdfCoord), selectedText: e14.selectedText, content: e14.content };
3884
+ return { chapterId: e14.chapterId, localPageIndex: e14.localPageIndex, globalPageNumber: e14.globalPageNumber, globalPageIndex: e14.globalPageIndex, rectsPdfCoord: e14.rectsPdfCoord, endAnchor: Ba(e14.rectsPdfCoord), selectedText: e14.selectedText, content: e14.content };
3879
3885
  }
3880
3886
  async requestCreateFromSelection(e14) {
3881
3887
  if (0 === e14.rectsPdfCoord.length) return null;
@@ -3942,21 +3948,21 @@ const Ra = class e12 extends BasePlugin {
3942
3948
  });
3943
3949
  }
3944
3950
  };
3945
- Ra.id = "note";
3946
- let Fa = Ra;
3947
- function Ua(e14) {
3951
+ Wa.id = "note";
3952
+ let Ha = Wa;
3953
+ function Ba(e14) {
3948
3954
  const t2 = e14[e14.length - 1];
3949
3955
  return { x: t2.origin.x + t2.size.width, y: t2.origin.y + t2.size.height };
3950
3956
  }
3951
- function qa(e14) {
3957
+ function ja(e14) {
3952
3958
  const { markerPdf: t2, lineRects: a3, sx: s9, sy: i2, cssPageWidth: o, iconSize: r2, gapPx: n2 = 6 } = e14, l = (a3 == null ? void 0 : a3.length) ? a3[a3.length - 1] : void 0;
3953
3959
  let h2, d2;
3954
3960
  l ? (h2 = (l.origin.x + l.size.width) * s9 + n2, d2 = l.origin.y * i2 + (l.size.height * i2 - r2) / 2) : (h2 = t2.x * s9 - r2 / 2, d2 = t2.y * i2 - r2 - n2);
3955
3961
  const c = Math.max(0, o - r2 - 2);
3956
3962
  return h2 > c && (h2 = c), d2 < 0 && (d2 = 0), { left: h2, top: d2 };
3957
3963
  }
3958
- const Wa = { key: 0, style: { position: "absolute", inset: "0", pointerEvents: "none", zIndex: 25 } }, Ha = ["onMouseenter"], Ba = ["data-note-marker-zone", "onMouseenter", "onMouseleave"], ja = ["onClick"], Za = ["onClick"], Ya = ["onClick"], Ka = /* @__PURE__ */ defineComponent({ __name: "NoteMarkerLayer", props: { chapterId: {}, localPageIndex: {}, pdfPageWidth: {}, pdfPageHeight: {}, cssPageWidth: {}, cssPageHeight: {}, ui: {} }, setup(e14) {
3959
- const o = e14, { provides: r2 } = useCapability(Fa.id), d2 = ref([]), g2 = ref(null), f = ref(null);
3964
+ const Za = { key: 0, style: { position: "absolute", inset: "0", pointerEvents: "none", zIndex: 25 } }, Ya = ["onMouseenter"], Ka = ["data-note-marker-zone", "onMouseenter", "onMouseleave"], Xa = ["onClick"], Qa = ["onClick"], Ja = ["onClick"], es = /* @__PURE__ */ defineComponent({ __name: "NoteMarkerLayer", props: { chapterId: {}, localPageIndex: {}, pdfPageWidth: {}, pdfPageHeight: {}, cssPageWidth: {}, cssPageHeight: {}, ui: {} }, setup(e14) {
3965
+ const o = e14, { provides: r2 } = useCapability(Ha.id), d2 = ref([]), g2 = ref(null), f = ref(null);
3960
3966
  watch(r2, (e15) => {
3961
3967
  if (e15) return e15.onNotesChange((e16) => {
3962
3968
  d2.value = e16.filter((e17) => e17.chapterId === o.chapterId && e17.localPageIndex === o.localPageIndex);
@@ -3980,25 +3986,25 @@ const Wa = { key: 0, style: { position: "absolute", inset: "0", pointerEvents: "
3980
3986
  return ((_a2 = o.ui) == null ? void 0 : _a2.highlightColor) ?? "rgba(245, 158, 11, 0.08)";
3981
3987
  });
3982
3988
  function C(e15) {
3983
- const t2 = o.cssPageWidth / o.pdfPageWidth, a3 = o.cssPageHeight / o.pdfPageHeight, s9 = w.value, { left: i2, top: r3 } = qa({ markerPdf: e15.endAnchor, lineRects: e15.rectsPdfCoord, sx: t2, sy: a3, cssPageWidth: o.cssPageWidth, iconSize: s9 }), n2 = (function(e16, t3, a4) {
3989
+ const t2 = o.cssPageWidth / o.pdfPageWidth, a3 = o.cssPageHeight / o.pdfPageHeight, s9 = w.value, { left: i2, top: r3 } = ja({ markerPdf: e15.endAnchor, lineRects: e15.rectsPdfCoord, sx: t2, sy: a3, cssPageWidth: o.cssPageWidth, iconSize: s9 }), n2 = (function(e16, t3, a4) {
3984
3990
  let s10 = 1 / 0, i3 = 1 / 0, o2 = -1 / 0, r4 = -1 / 0;
3985
3991
  for (const n3 of e16) s10 = Math.min(s10, n3.origin.x * t3), i3 = Math.min(i3, n3.origin.y * a4), o2 = Math.max(o2, (n3.origin.x + n3.size.width) * t3), r4 = Math.max(r4, (n3.origin.y + n3.size.height) * a4);
3986
3992
  return { left: s10, top: i3, width: o2 - s10, height: r4 - i3 };
3987
3993
  })(e15.rectsPdfCoord, t2, a3), l = f.value === e15.noteId ? 72 : 0, h2 = Math.max(0, Math.min(n2.left, i2) - 8), d3 = Math.max(0, Math.min(n2.top, r3) - 8);
3988
3994
  return { zoneLeft: h2, zoneTop: d3, zoneW: Math.min(o.cssPageWidth, Math.max(n2.left + n2.width, i2 + s9) + 8) - h2, zoneH: Math.max(n2.top + n2.height, r3 + s9 + 6 + l) + 8 - d3, iconLeft: i2, iconTop: r3, sx: t2, sy: a3 };
3989
3995
  }
3990
- return (t2, a3) => unref(r2) && d2.value.length && e14.pdfPageWidth && e14.pdfPageHeight ? (openBlock(), createElementBlock("div", Wa, [(openBlock(true), createElementBlock(Fragment, null, renderList(d2.value, (e15) => (openBlock(), createElementBlock(Fragment, { key: e15.noteId }, [(openBlock(true), createElementBlock(Fragment, null, renderList(e15.rectsPdfCoord, (t3, a4) => (openBlock(), createElementBlock("div", { key: `${e15.noteId}-bg-${a4}`, style: normalizeStyle({ position: "absolute", left: t3.origin.x * C(e15).sx + "px", top: t3.origin.y * C(e15).sy + "px", width: t3.size.width * C(e15).sx + "px", height: t3.size.height * C(e15).sy + "px", background: y.value, borderRadius: "2px", pointerEvents: "auto" }), onMouseenter: (t4) => g2.value = e15.noteId }, null, 44, Ha))), 128)), g2.value === e15.noteId || f.value === e15.noteId ? (openBlock(), createElementBlock("div", { key: 0, "data-note-marker-zone": e15.noteId, style: normalizeStyle({ position: "absolute", left: `${C(e15).zoneLeft}px`, top: `${C(e15).zoneTop}px`, width: `${C(e15).zoneW}px`, height: `${C(e15).zoneH}px`, pointerEvents: "auto", zIndex: 26 }), onMouseenter: (t3) => g2.value = e15.noteId, onMouseleave: (t3) => f.value !== e15.noteId && (g2.value = null) }, [createElementVNode("button", { type: "button", title: "笔记", style: normalizeStyle({ position: "absolute", left: C(e15).iconLeft - C(e15).zoneLeft + "px", top: C(e15).iconTop - C(e15).zoneTop + "px", width: `${w.value}px`, height: `${w.value}px`, border: "none", borderRadius: "50%", background: "#f59e0b", color: "#fff", cursor: "pointer", fontSize: "11px", padding: 0 }), onMousedown: a3[0] || (a3[0] = withModifiers(() => {
3991
- }, ["stop"])), onClick: withModifiers((t3) => f.value = f.value === e15.noteId ? null : e15.noteId, ["stop"]) }, " 💬 ", 44, ja), f.value === e15.noteId ? (openBlock(), createElementBlock("div", { key: 0, style: normalizeStyle({ position: "absolute", left: C(e15).iconLeft - C(e15).zoneLeft + "px", top: `${C(e15).iconTop - C(e15).zoneTop + w.value + 4}px`, minWidth: "120px", padding: "6px", borderRadius: "8px", background: "#fff", border: "1px solid #e5e7eb", boxShadow: "0 4px 12px rgba(0,0,0,0.12)", zIndex: 30 }), onMousedown: a3[1] || (a3[1] = withModifiers(() => {
3996
+ return (t2, a3) => unref(r2) && d2.value.length && e14.pdfPageWidth && e14.pdfPageHeight ? (openBlock(), createElementBlock("div", Za, [(openBlock(true), createElementBlock(Fragment, null, renderList(d2.value, (e15) => (openBlock(), createElementBlock(Fragment, { key: e15.noteId }, [(openBlock(true), createElementBlock(Fragment, null, renderList(e15.rectsPdfCoord, (t3, a4) => (openBlock(), createElementBlock("div", { key: `${e15.noteId}-bg-${a4}`, style: normalizeStyle({ position: "absolute", left: t3.origin.x * C(e15).sx + "px", top: t3.origin.y * C(e15).sy + "px", width: t3.size.width * C(e15).sx + "px", height: t3.size.height * C(e15).sy + "px", background: y.value, borderRadius: "2px", pointerEvents: "auto" }), onMouseenter: (t4) => g2.value = e15.noteId }, null, 44, Ya))), 128)), g2.value === e15.noteId || f.value === e15.noteId ? (openBlock(), createElementBlock("div", { key: 0, "data-note-marker-zone": e15.noteId, style: normalizeStyle({ position: "absolute", left: `${C(e15).zoneLeft}px`, top: `${C(e15).zoneTop}px`, width: `${C(e15).zoneW}px`, height: `${C(e15).zoneH}px`, pointerEvents: "auto", zIndex: 26 }), onMouseenter: (t3) => g2.value = e15.noteId, onMouseleave: (t3) => f.value !== e15.noteId && (g2.value = null) }, [createElementVNode("button", { type: "button", title: "笔记", style: normalizeStyle({ position: "absolute", left: C(e15).iconLeft - C(e15).zoneLeft + "px", top: C(e15).iconTop - C(e15).zoneTop + "px", width: `${w.value}px`, height: `${w.value}px`, border: "none", borderRadius: "50%", background: "#f59e0b", color: "#fff", cursor: "pointer", fontSize: "11px", padding: 0 }), onMousedown: a3[0] || (a3[0] = withModifiers(() => {
3997
+ }, ["stop"])), onClick: withModifiers((t3) => f.value = f.value === e15.noteId ? null : e15.noteId, ["stop"]) }, " 💬 ", 44, Xa), f.value === e15.noteId ? (openBlock(), createElementBlock("div", { key: 0, style: normalizeStyle({ position: "absolute", left: C(e15).iconLeft - C(e15).zoneLeft + "px", top: `${C(e15).iconTop - C(e15).zoneTop + w.value + 4}px`, minWidth: "120px", padding: "6px", borderRadius: "8px", background: "#fff", border: "1px solid #e5e7eb", boxShadow: "0 4px 12px rgba(0,0,0,0.12)", zIndex: 30 }), onMousedown: a3[1] || (a3[1] = withModifiers(() => {
3992
3998
  }, ["stop"])) }, [createElementVNode("button", { type: "button", style: { display: "block", width: "100%", padding: "6px 8px", "font-size": "12px", border: "none", "border-radius": "4px", background: "transparent", color: "#334155", cursor: "pointer", "text-align": "left" }, onClick: (t3) => (function(e16) {
3993
3999
  var _a2;
3994
4000
  (_a2 = r2.value) == null ? void 0 : _a2.requestEditNote(e16.noteId, e16);
3995
- })(e15) }, " 编辑 ", 8, Za), createElementVNode("button", { type: "button", style: { display: "block", width: "100%", padding: "6px 8px", "font-size": "12px", border: "none", "border-radius": "4px", background: "transparent", color: "#dc2626", cursor: "pointer", "text-align": "left" }, onClick: (t3) => {
4001
+ })(e15) }, " 编辑 ", 8, Qa), createElementVNode("button", { type: "button", style: { display: "block", width: "100%", padding: "6px 8px", "font-size": "12px", border: "none", "border-radius": "4px", background: "transparent", color: "#dc2626", cursor: "pointer", "text-align": "left" }, onClick: (t3) => {
3996
4002
  var _a2;
3997
4003
  return a4 = e15.noteId, (_a2 = r2.value) == null ? void 0 : _a2.requestDeleteNote(a4), void (f.value = null);
3998
4004
  var a4;
3999
- } }, " 删除 ", 8, Ya)], 36)) : createCommentVNode("", true)], 44, Ba)) : createCommentVNode("", true)], 64))), 128))])) : createCommentVNode("", true);
4000
- } }), Xa = { key: 0, style: { position: "absolute", inset: "0", pointerEvents: "none" } }, Qa = ["title", "onClick"], Ja = ["onClick"], es = /* @__PURE__ */ defineComponent({ __name: "BookmarkMarkerLayer", props: { chapterId: {}, localPageIndex: {}, pdfPageWidth: {}, pdfPageHeight: {}, cssPageWidth: {}, cssPageHeight: {}, ui: {} }, setup(e14) {
4001
- const o = e14, { provides: r2 } = useCapability(Wt.id), d2 = ref([]), g2 = ref(null), f = ref(null);
4005
+ } }, " 删除 ", 8, Ja)], 36)) : createCommentVNode("", true)], 44, Ka)) : createCommentVNode("", true)], 64))), 128))])) : createCommentVNode("", true);
4006
+ } }), ts = { key: 0, style: { position: "absolute", inset: "0", pointerEvents: "none" } }, as = ["title", "onClick"], ss = ["onClick"], is = /* @__PURE__ */ defineComponent({ __name: "BookmarkMarkerLayer", props: { chapterId: {}, localPageIndex: {}, pdfPageWidth: {}, pdfPageHeight: {}, cssPageWidth: {}, cssPageHeight: {}, ui: {} }, setup(e14) {
4007
+ const o = e14, { provides: r2 } = useCapability(Zt.id), d2 = ref([]), g2 = ref(null), f = ref(null);
4002
4008
  function P() {
4003
4009
  const e15 = r2.value;
4004
4010
  e15 && (d2.value = e15.listBookmarks().filter((e16) => e16.anchor.chapterId === o.chapterId && e16.anchor.localPageIndex === o.localPageIndex));
@@ -4023,27 +4029,46 @@ const Wa = { key: 0, style: { position: "absolute", inset: "0", pointerEvents: "
4023
4029
  const { left: t2, top: a3 } = (function(e16) {
4024
4030
  var _a2;
4025
4031
  const t3 = o.cssPageWidth / o.pdfPageWidth, a4 = o.cssPageHeight / o.pdfPageHeight, s9 = ((_a2 = e16.anchor.rectsPdfCoord) == null ? void 0 : _a2.length) ? e16.anchor.rectsPdfCoord : [e16.anchor.rectPdfCoord];
4026
- return qa({ markerPdf: e16.anchor.markerAnchor ?? { x: e16.anchor.rectPdfCoord.origin.x + e16.anchor.rectPdfCoord.size.width, y: e16.anchor.rectPdfCoord.origin.y + e16.anchor.rectPdfCoord.size.height }, lineRects: s9, sx: t3, sy: a4, cssPageWidth: o.cssPageWidth, iconSize: y.value });
4032
+ return ja({ markerPdf: e16.anchor.markerAnchor ?? { x: e16.anchor.rectPdfCoord.origin.x + e16.anchor.rectPdfCoord.size.width, y: e16.anchor.rectPdfCoord.origin.y + e16.anchor.rectPdfCoord.size.height }, lineRects: s9, sx: t3, sy: a4, cssPageWidth: o.cssPageWidth, iconSize: y.value });
4027
4033
  })(e15);
4028
4034
  return { position: "absolute", left: `${Math.max(0, t2 - 6)}px`, top: `${Math.max(0, a3 - 6)}px`, width: `${y.value + 12}px`, height: `${y.value + 12}px`, pointerEvents: "auto", zIndex: 20 };
4029
4035
  }
4030
- return (t2, a3) => unref(r2) && d2.value.length && e14.pdfPageWidth && e14.pdfPageHeight ? (openBlock(), createElementBlock("div", Xa, [(openBlock(true), createElementBlock(Fragment, null, renderList(d2.value, (e15) => (openBlock(), createElementBlock("div", { key: e15.id, style: normalizeStyle(C(e15)), onMousedown: a3[1] || (a3[1] = withModifiers(() => {
4031
- }, ["stop"])) }, [createElementVNode("button", { type: "button", title: e15.label, style: normalizeStyle({ position: "absolute", left: "6px", top: "6px", width: `${y.value}px`, height: `${y.value}px`, border: "none", borderRadius: "4px", background: "#3b82f6", color: "#fff", cursor: "pointer", boxShadow: "0 2px 6px rgba(37, 99, 235, 0.35)", fontSize: "11px", padding: 0 }), onClick: withModifiers((t3) => g2.value = g2.value === e15.id ? null : e15.id, ["stop"]) }, " 🔖 ", 12, Qa), g2.value === e15.id ? (openBlock(), createElementBlock("div", { key: 0, ref_for: true, ref_key: "deleteMenuRef", ref: f, style: { position: "absolute", left: "6px", top: "-36px", zIndex: 30, pointerEvents: "auto", minWidth: "88px", padding: "4px", borderRadius: "6px", background: "#fff", border: "1px solid #e5e7eb", boxShadow: "0 4px 12px rgba(0,0,0,0.12)" }, onClick: a3[0] || (a3[0] = withModifiers(() => {
4036
+ return (t2, a3) => unref(r2) && d2.value.length && e14.pdfPageWidth && e14.pdfPageHeight ? (openBlock(), createElementBlock("div", ts, [(openBlock(true), createElementBlock(Fragment, null, renderList(d2.value, (e15) => (openBlock(), createElementBlock("div", { key: e15.id, style: normalizeStyle(C(e15)), onMousedown: a3[1] || (a3[1] = withModifiers(() => {
4037
+ }, ["stop"])) }, [createElementVNode("button", { type: "button", title: e15.label, style: normalizeStyle({ position: "absolute", left: "6px", top: "6px", width: `${y.value}px`, height: `${y.value}px`, border: "none", borderRadius: "4px", background: "#3b82f6", color: "#fff", cursor: "pointer", boxShadow: "0 2px 6px rgba(37, 99, 235, 0.35)", fontSize: "11px", padding: 0 }), onClick: withModifiers((t3) => g2.value = g2.value === e15.id ? null : e15.id, ["stop"]) }, " 🔖 ", 12, as), g2.value === e15.id ? (openBlock(), createElementBlock("div", { key: 0, ref_for: true, ref_key: "deleteMenuRef", ref: f, style: { position: "absolute", left: "6px", top: "-36px", zIndex: 30, pointerEvents: "auto", minWidth: "88px", padding: "4px", borderRadius: "6px", background: "#fff", border: "1px solid #e5e7eb", boxShadow: "0 4px 12px rgba(0,0,0,0.12)" }, onClick: a3[0] || (a3[0] = withModifiers(() => {
4032
4038
  }, ["stop"])) }, [createElementVNode("button", { type: "button", style: { width: "100%", padding: "6px 8px", "font-size": "12px", border: "none", "border-radius": "4px", background: "transparent", color: "#dc2626", cursor: "pointer", "text-align": "left" }, onClick: (t3) => (async function(e16) {
4033
4039
  const t4 = r2.value;
4034
4040
  if (!t4) return;
4035
4041
  await t4.requestRemoveBookmark(e16) && (g2.value = null);
4036
- })(e15.id) }, " 删除书签 ", 8, Ja)], 512)) : createCommentVNode("", true)], 36))), 128))])) : createCommentVNode("", true);
4042
+ })(e15.id) }, " 删除书签 ", 8, ss)], 512)) : createCommentVNode("", true)], 36))), 128))])) : createCommentVNode("", true);
4037
4043
  } });
4038
- function ts(e14) {
4044
+ function os(e14) {
4039
4045
  return e14.chapterId;
4040
4046
  }
4041
- function as(e14, t2) {
4047
+ function rs(e14, t2) {
4042
4048
  e14.wait(t2, () => {
4043
4049
  });
4044
4050
  }
4045
- const ss = /* @__PURE__ */ defineComponent({ __name: "ChapterPageSurface", props: { item: {}, features: {}, showNoteMarkers: { type: Boolean }, showBookmarkMarkers: { type: Boolean }, showRedactionLayer: { type: Boolean }, noteMarkerUi: {}, bookmarkMarkerUi: {}, buildSelectionMenu: { type: Function }, createNote: {}, annotationSelectionMenu: {}, redactionSelectionMenu: {}, renderPageOverlay: { type: Function } }, setup(e14) {
4046
- const a3 = e14, i2 = computed(() => ts(a3.item));
4051
+ const ns = { display: "flex", alignItems: "center", justifyContent: "center", padding: "4px 8px", borderRadius: "8px", background: "#ffffff", border: "1px solid rgba(15, 23, 42, 0.08)", boxShadow: "0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 10px 24px -4px rgba(15, 23, 42, 0.12)" }, ls = { padding: "6px 12px", fontSize: "12px", fontWeight: "500", border: "none", borderRadius: "6px", background: "transparent", color: "#dc2626", cursor: "pointer" };
4052
+ function hs(e14, a3) {
4053
+ var _a2, _b;
4054
+ const { provides: s9 } = useAnnotationCapability(), i2 = (_a2 = a3 == null ? void 0 : a3.markup) == null ? void 0 : _a2.annotationMenu, o = false !== ((_b = a3 == null ? void 0 : a3.markup) == null ? void 0 : _b.enabled), r2 = false !== (i2 == null ? void 0 : i2.enabled);
4055
+ return computed(() => {
4056
+ const t2 = "string" == typeof e14 ? e14 : e14.value;
4057
+ if (o && r2 && s9.value) return (e15) => {
4058
+ const { context: a4, rect: o2, placement: r3, menuWrapperProps: n2, selected: l } = e15;
4059
+ if (!l || "annotation" !== a4.type) return h$1("span", n2);
4060
+ if (a4.structurallyLocked) return h$1("span", n2);
4061
+ if (h2 = a4.annotation.object.type, !xe.has(h2)) return h$1("span", n2);
4062
+ var h2;
4063
+ const d2 = s9.value.forDocument(t2), { pageIndex: c, id: u } = a4.annotation.object, p2 = () => {
4064
+ d2 == null ? void 0 : d2.deleteAnnotation(c, u);
4065
+ }, g2 = { position: "absolute", pointerEvents: "auto", left: "50%", transform: "translateX(-50%)", top: (r3 == null ? void 0 : r3.suggestTop) ? void 0 : `${o2.size.height + 8}px`, bottom: (r3 == null ? void 0 : r3.suggestTop) ? `${o2.size.height + 8}px` : void 0 }, f = (i2 == null ? void 0 : i2.renderMenu) ? i2.renderMenu({ pageIndex: c, annotationId: u, onDelete: p2 }) : h$1("button", { type: "button", style: ls, onClick: p2 }, "删除");
4066
+ return h$1("div", n2, [h$1("div", { style: g2 }, [h$1("div", { style: ns, role: "toolbar", "aria-label": "划线标注" }, [f])])]);
4067
+ };
4068
+ });
4069
+ }
4070
+ const ds = /* @__PURE__ */ defineComponent({ __name: "ChapterPageSurface", props: { item: {}, features: {}, showNoteMarkers: { type: Boolean }, showBookmarkMarkers: { type: Boolean }, showRedactionLayer: { type: Boolean }, noteMarkerUi: {}, bookmarkMarkerUi: {}, buildSelectionMenu: { type: Function }, createNote: {}, annotationSelectionMenu: {}, redactionSelectionMenu: {}, renderPageOverlay: { type: Function } }, setup(e14) {
4071
+ const a3 = e14, i2 = computed(() => os(a3.item));
4047
4072
  !(function(e15) {
4048
4073
  const { provides: t2 } = useCapability(DocumentManagerPlugin.id);
4049
4074
  watch([t2, e15], ([e16, t3]) => {
@@ -4054,7 +4079,7 @@ const ss = /* @__PURE__ */ defineComponent({ __name: "ChapterPageSurface", props
4054
4079
  var _a2, _b;
4055
4080
  return (_b = (_a2 = o.value) == null ? void 0 : _a2.getDocument(i2.value)) == null ? void 0 : _b.pages[a3.item.localPageIndex];
4056
4081
  });
4057
- function h2(e15, t2) {
4082
+ function d2(e15, t2) {
4058
4083
  const s9 = a3.createNote.value;
4059
4084
  if (s9) return (a4) => {
4060
4085
  var _a2;
@@ -4062,7 +4087,7 @@ const ss = /* @__PURE__ */ defineComponent({ __name: "ChapterPageSurface", props
4062
4087
  return h$1("div", a4.menuWrapperProps, [h$1("div", { style: i3 }, h$1("button", { type: "button", style: { padding: "6px 10px", fontSize: "12px", border: "1px solid #e2e8f0", borderRadius: "6px", background: "#fff", cursor: "pointer" }, onClick: () => {
4063
4088
  if (!r2.value) return;
4064
4089
  const a5 = r2.value.getHighlightRectsForPage(e15.localPageIndex, t2);
4065
- as(r2.value.getSelectedText(t2), (t3) => {
4090
+ rs(r2.value.getSelectedText(t2), (t3) => {
4066
4091
  s9((function(e16, t4, a6) {
4067
4092
  return { chapterId: e16.chapterId, localPageIndex: e16.localPageIndex, globalPageIndex: e16.globalPageIndex, globalPageNumber: e16.globalPageNumber, rectsPdfCoord: t4, selectedText: a6 };
4068
4093
  })(e15, a5, t3.join("\n")));
@@ -4070,21 +4095,29 @@ const ss = /* @__PURE__ */ defineComponent({ __name: "ChapterPageSurface", props
4070
4095
  } }, "添加附注"))]);
4071
4096
  };
4072
4097
  }
4073
- const d2 = computed(() => {
4074
- const e15 = a3.buildSelectionMenu, t2 = { item: a3.item, defaultMenu: h2(a3.item, i2.value), createNote: a3.createNote.value };
4098
+ const c = computed(() => {
4099
+ const e15 = a3.buildSelectionMenu, t2 = { item: a3.item, defaultMenu: d2(a3.item, i2.value), createNote: a3.createNote.value };
4075
4100
  if (e15) {
4076
4101
  const a4 = e15(t2);
4077
4102
  if (a4) return a4;
4078
4103
  }
4079
4104
  return t2.defaultMenu;
4080
- }), c = computed(() => {
4105
+ }), u = hs(i2, a3.features), p2 = computed(() => (function(e15, t2) {
4106
+ if (e15 || t2) return (a4) => {
4107
+ if (e15) {
4108
+ const t3 = e15(a4);
4109
+ if (null != t3) return t3;
4110
+ }
4111
+ return (t2 == null ? void 0 : t2(a4)) ?? null;
4112
+ };
4113
+ })(a3.annotationSelectionMenu, u.value)), v = computed(() => {
4081
4114
  var _a2;
4082
4115
  return (_a2 = a3.renderPageOverlay) == null ? void 0 : _a2.call(a3, a3.item);
4083
4116
  });
4084
- return (t2, a4) => e14.item.isPlaceholder ? createCommentVNode("", true) : (openBlock(), createBlock(unref(GlobalPointerProvider), { key: 0, "document-id": i2.value }, { default: withCtx(() => [createVNode(unref(Rotate), { "document-id": i2.value, "page-index": e14.item.localPageIndex, style: { backgroundColor: "#fff" } }, { default: withCtx(() => [createVNode(unref(PagePointerProvider), { "document-id": i2.value, "page-index": e14.item.localPageIndex }, { default: withCtx(() => [createVNode(unref(Ma), { "chapter-id": i2.value, "local-page-index": e14.item.localPageIndex }, null, 8, ["chapter-id", "local-page-index"]), createVNode(unref(SelectionLayer), { "document-id": i2.value, "page-index": e14.item.localPageIndex, "selection-menu": d2.value }, null, 8, ["document-id", "page-index", "selection-menu"]), e14.showRedactionLayer ? (openBlock(), createBlock(unref(RedactionLayer), { key: 0, "document-id": i2.value, "page-index": e14.item.localPageIndex, "selection-menu": e14.redactionSelectionMenu }, null, 8, ["document-id", "page-index", "selection-menu"])) : createCommentVNode("", true), createVNode(unref(AnnotationLayer), { "document-id": i2.value, "page-index": e14.item.localPageIndex, "selection-menu": e14.annotationSelectionMenu }, null, 8, ["document-id", "page-index", "selection-menu"]), e14.showBookmarkMarkers && l.value ? (openBlock(), createBlock(es, { key: 1, "chapter-id": i2.value, "local-page-index": e14.item.localPageIndex, "pdf-page-width": l.value.size.width, "pdf-page-height": l.value.size.height, "css-page-width": e14.item.width, "css-page-height": e14.item.height, ui: e14.bookmarkMarkerUi }, null, 8, ["chapter-id", "local-page-index", "pdf-page-width", "pdf-page-height", "css-page-width", "css-page-height", "ui"])) : createCommentVNode("", true), c.value ? (openBlock(), createBlock(resolveDynamicComponent(c.value), { key: 2 })) : createCommentVNode("", true), e14.showNoteMarkers && l.value ? (openBlock(), createBlock(Ka, { key: 3, "chapter-id": i2.value, "local-page-index": e14.item.localPageIndex, "pdf-page-width": l.value.size.width, "pdf-page-height": l.value.size.height, "css-page-width": e14.item.width, "css-page-height": e14.item.height, ui: e14.noteMarkerUi }, null, 8, ["chapter-id", "local-page-index", "pdf-page-width", "pdf-page-height", "css-page-width", "css-page-height", "ui"])) : createCommentVNode("", true), renderSlot(t2.$slots, "default")]), _: 3 }, 8, ["document-id", "page-index"])]), _: 3 }, 8, ["document-id", "page-index"])]), _: 3 }, 8, ["document-id"]));
4117
+ return (t2, a4) => e14.item.isPlaceholder ? createCommentVNode("", true) : (openBlock(), createBlock(unref(GlobalPointerProvider), { key: 0, "document-id": i2.value }, { default: withCtx(() => [createVNode(unref(Rotate), { "document-id": i2.value, "page-index": e14.item.localPageIndex, style: { backgroundColor: "#fff" } }, { default: withCtx(() => [createVNode(unref(PagePointerProvider), { "document-id": i2.value, "page-index": e14.item.localPageIndex, style: normalizeStyle(unref(Pe$1)), onPointerdown: unref(we$1) }, { default: withCtx(() => [createVNode(unref(La), { "chapter-id": i2.value, "local-page-index": e14.item.localPageIndex }, null, 8, ["chapter-id", "local-page-index"]), createVNode(unref(SelectionLayer), { "document-id": i2.value, "page-index": e14.item.localPageIndex, "selection-menu": c.value }, null, 8, ["document-id", "page-index", "selection-menu"]), e14.showRedactionLayer ? (openBlock(), createBlock(unref(RedactionLayer), { key: 0, "document-id": i2.value, "page-index": e14.item.localPageIndex, "selection-menu": e14.redactionSelectionMenu }, null, 8, ["document-id", "page-index", "selection-menu"])) : createCommentVNode("", true), createVNode(unref(AnnotationLayer), { "document-id": i2.value, "page-index": e14.item.localPageIndex, "selection-menu": p2.value }, null, 8, ["document-id", "page-index", "selection-menu"]), e14.showBookmarkMarkers && l.value ? (openBlock(), createBlock(is, { key: 1, "chapter-id": i2.value, "local-page-index": e14.item.localPageIndex, "pdf-page-width": l.value.size.width, "pdf-page-height": l.value.size.height, "css-page-width": e14.item.width, "css-page-height": e14.item.height, ui: e14.bookmarkMarkerUi }, null, 8, ["chapter-id", "local-page-index", "pdf-page-width", "pdf-page-height", "css-page-width", "css-page-height", "ui"])) : createCommentVNode("", true), v.value ? (openBlock(), createBlock(resolveDynamicComponent(v.value), { key: 2 })) : createCommentVNode("", true), e14.showNoteMarkers && l.value ? (openBlock(), createBlock(es, { key: 3, "chapter-id": i2.value, "local-page-index": e14.item.localPageIndex, "pdf-page-width": l.value.size.width, "pdf-page-height": l.value.size.height, "css-page-width": e14.item.width, "css-page-height": e14.item.height, ui: e14.noteMarkerUi }, null, 8, ["chapter-id", "local-page-index", "pdf-page-width", "pdf-page-height", "css-page-width", "css-page-height", "ui"])) : createCommentVNode("", true), renderSlot(t2.$slots, "default")]), _: 3 }, 8, ["document-id", "page-index", "style", "onPointerdown"])]), _: 3 }, 8, ["document-id", "page-index"])]), _: 3 }, 8, ["document-id"]));
4085
4118
  } });
4086
- const is = /* @__PURE__ */ defineComponent({ __name: "HoverBookmarkLayer", props: { item: {}, pdfPageWidth: {}, pdfPageHeight: {}, cssPageWidth: {}, cssPageHeight: {}, hoverUi: {} }, setup(e14) {
4087
- const o = e14, r2 = computed(() => ts(o.item)), { provides: d2 } = useCapability(SelectionPlugin.id), { provides: u } = useCapability(Wt.id), p2 = ref(null), g2 = ref(null), f = ref(null), P = ref(null), w = computed(() => {
4119
+ const cs = /* @__PURE__ */ defineComponent({ __name: "HoverBookmarkLayer", props: { item: {}, pdfPageWidth: {}, pdfPageHeight: {}, cssPageWidth: {}, cssPageHeight: {}, hoverUi: {} }, setup(e14) {
4120
+ const o = e14, r2 = computed(() => os(o.item)), { provides: d2 } = useCapability(SelectionPlugin.id), { provides: u } = useCapability(Zt.id), p2 = ref(null), g2 = ref(null), f = ref(null), P = ref(null), w = computed(() => {
4088
4121
  var _a2;
4089
4122
  return ((_a2 = o.hoverUi) == null ? void 0 : _a2.iconSize) ?? 16;
4090
4123
  }), y = computed(() => P.value ?? f.value);
@@ -4141,10 +4174,10 @@ const is = /* @__PURE__ */ defineComponent({ __name: "HoverBookmarkLayer", props
4141
4174
  });
4142
4175
  const k2 = computed(() => {
4143
4176
  const e15 = y.value;
4144
- return (e15 == null ? void 0 : e15.length) ? Ft(o.item.chapterId, o.item.localPageIndex, e15, { globalPageIndex: o.item.globalPageIndex, globalPageNumber: o.item.globalPageNumber }) : null;
4177
+ return (e15 == null ? void 0 : e15.length) ? Ht$1(o.item.chapterId, o.item.localPageIndex, e15, { globalPageIndex: o.item.globalPageIndex, globalPageNumber: o.item.globalPageNumber }) : null;
4145
4178
  }), L2 = computed(() => {
4146
4179
  const e15 = k2.value, t2 = u.value;
4147
- return !(!e15 || !t2) && t2.listBookmarks().some((t3) => Rt(t3.anchor, e15));
4180
+ return !(!e15 || !t2) && t2.listBookmarks().some((t3) => Wt(t3.anchor, e15));
4148
4181
  });
4149
4182
  function $2() {
4150
4183
  const e15 = u.value, t2 = k2.value;
@@ -4160,33 +4193,33 @@ const is = /* @__PURE__ */ defineComponent({ __name: "HoverBookmarkLayer", props
4160
4193
  var _a2;
4161
4194
  return unref(u) && e14.pdfPageWidth && e14.pdfPageHeight ? (openBlock(), createElementBlock("div", { key: 0, ref_key: "rootRef", ref: p2, style: { position: "absolute", inset: "0", zIndex: 14, pointerEvents: "none" } }, [z.value && y.value && !L2.value ? (openBlock(), createElementBlock("div", { key: 0, style: normalizeStyle({ position: "absolute", left: `${z.value.zoneLeft}px`, top: `${z.value.zoneTop}px`, width: `${z.value.size + 20}px`, height: `${(((_a2 = y.value[y.value.length - 1]) == null ? void 0 : _a2.size.height) ?? 0) * (e14.cssPageHeight / e14.pdfPageHeight) + z.value.size + 12}px`, pointerEvents: "auto" }), onMouseenter: a3[0] || (a3[0] = (e15) => P.value = y.value), onMouseleave: a3[1] || (a3[1] = (e15) => P.value = null) }, [createElementVNode("button", { type: "button", title: "添加书签", style: normalizeStyle({ position: "absolute", left: z.value.iconLeft - z.value.zoneLeft + "px", top: z.value.iconTop - z.value.zoneTop + "px", width: `${z.value.size}px`, height: `${z.value.size}px`, cursor: "pointer", display: "flex", alignItems: "center", justifyContent: "center", background: "#3b82f6", color: "#fff", border: "none", borderRadius: "4px", boxShadow: "0 2px 8px rgba(37, 99, 235, 0.45)", fontSize: "12px", padding: 0 }), onClick: withModifiers($2, ["stop"]) }, " 🔖 ", 4)], 36)) : createCommentVNode("", true)], 512)) : createCommentVNode("", true);
4162
4195
  };
4163
- } }), os = { key: 0, width: "24", height: "24", viewBox: "0 0 28 28", fill: "none", "aria-hidden": "" }, rs = { key: 0, x: "5", y: "4", width: "18", height: "20", rx: "3", fill: "#fde047" }, ns = { key: 1, d: "M6 22h16", stroke: "#dc2626", "stroke-width": "2.2", "stroke-linecap": "round" }, ls = { key: 2, d: "M6 22c2-2 3-2 5 0s3 2 5 0 3-2 5 0", stroke: "#dc2626", "stroke-width": "2", "stroke-linecap": "round", fill: "none" }, hs = { key: 3, d: "M5 14h18", stroke: "#dc2626", "stroke-width": "2.2", "stroke-linecap": "round" }, ds = { key: 1, width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "" }, cs = /* @__PURE__ */ defineComponent({ __name: "SelectionToolbarIcons", props: { kind: {} }, setup: (e14) => (t2, a3) => "note" !== e14.kind ? (openBlock(), createElementBlock("svg", os, ["highlight" === e14.kind ? (openBlock(), createElementBlock("rect", rs)) : createCommentVNode("", true), a3[0] || (a3[0] = createElementVNode("text", { x: "14", y: "19", "text-anchor": "middle", "font-size": "15", "font-weight": "700", "font-family": "system-ui, -apple-system, sans-serif", fill: "#0f172a" }, " A ", -1)), "underline" === e14.kind ? (openBlock(), createElementBlock("path", ns)) : "squiggly" === e14.kind ? (openBlock(), createElementBlock("path", ls)) : "strikeout" === e14.kind ? (openBlock(), createElementBlock("path", hs)) : createCommentVNode("", true)])) : (openBlock(), createElementBlock("svg", ds, [...a3[1] || (a3[1] = [createElementVNode("path", { d: "M8 3h8l4 4v14H8V3z", fill: "#fef3c7", stroke: "#d97706", "stroke-width": "1.2", "stroke-linejoin": "round" }, null, -1), createElementVNode("path", { d: "M16 3v4h4", stroke: "#d97706", "stroke-width": "1.2" }, null, -1), createElementVNode("path", { d: "M10 12h6M10 16h4", stroke: "#92400e", "stroke-width": "1.2", "stroke-linecap": "round" }, null, -1)])])) }), us = ["title", "aria-label", "onMouseenter", "onClick"], ps = ["title", "onMouseenter", "onClick"], gs = { style: { "font-size": "11px", "font-weight": "600" } }, fs = /* @__PURE__ */ defineComponent({ __name: "SelectionToolbarCard", props: { placementAbove: { type: Boolean }, anchorHeight: {}, hiddenBuiltinActions: {}, extraActions: {} }, emits: ["action"], setup(e14, { emit: s9 }) {
4196
+ } }), us = { key: 0, width: "24", height: "24", viewBox: "0 0 28 28", fill: "none", "aria-hidden": "" }, ps = { key: 0, x: "5", y: "4", width: "18", height: "20", rx: "3", fill: "#fde047" }, gs = { key: 1, d: "M6 22h16", stroke: "#dc2626", "stroke-width": "2.2", "stroke-linecap": "round" }, fs = { key: 2, d: "M6 22c2-2 3-2 5 0s3 2 5 0 3-2 5 0", stroke: "#dc2626", "stroke-width": "2", "stroke-linecap": "round", fill: "none" }, ms = { key: 3, d: "M5 14h18", stroke: "#dc2626", "stroke-width": "2.2", "stroke-linecap": "round" }, vs = { key: 1, width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "" }, bs = /* @__PURE__ */ defineComponent({ __name: "SelectionToolbarIcons", props: { kind: {} }, setup: (e14) => (t2, a3) => "note" !== e14.kind ? (openBlock(), createElementBlock("svg", us, ["highlight" === e14.kind ? (openBlock(), createElementBlock("rect", ps)) : createCommentVNode("", true), a3[0] || (a3[0] = createElementVNode("text", { x: "14", y: "19", "text-anchor": "middle", "font-size": "15", "font-weight": "700", "font-family": "system-ui, -apple-system, sans-serif", fill: "#0f172a" }, " A ", -1)), "underline" === e14.kind ? (openBlock(), createElementBlock("path", gs)) : "squiggly" === e14.kind ? (openBlock(), createElementBlock("path", fs)) : "strikeout" === e14.kind ? (openBlock(), createElementBlock("path", ms)) : createCommentVNode("", true)])) : (openBlock(), createElementBlock("svg", vs, [...a3[1] || (a3[1] = [createElementVNode("path", { d: "M8 3h8l4 4v14H8V3z", fill: "#fef3c7", stroke: "#d97706", "stroke-width": "1.2", "stroke-linejoin": "round" }, null, -1), createElementVNode("path", { d: "M16 3v4h4", stroke: "#d97706", "stroke-width": "1.2" }, null, -1), createElementVNode("path", { d: "M10 12h6M10 16h4", stroke: "#92400e", "stroke-width": "1.2", "stroke-linecap": "round" }, null, -1)])])) }), Ps = ["title", "aria-label", "onMouseenter", "onClick"], ws = ["title", "onMouseenter", "onClick"], ys = { style: { "font-size": "11px", "font-weight": "600" } }, Cs = /* @__PURE__ */ defineComponent({ __name: "SelectionToolbarCard", props: { placementAbove: { type: Boolean }, anchorHeight: {}, hiddenBuiltinActions: {}, extraActions: {} }, emits: ["action"], setup(e14, { emit: s9 }) {
4164
4197
  const i2 = e14, o = s9, r2 = [{ id: "highlight", label: "高亮背景" }, { id: "underline", label: "下划线" }, { id: "squiggly", label: "波浪线" }, { id: "strikeout", label: "删除线" }, { id: "note", label: "添加笔记" }], d2 = computed(() => new Set(i2.hiddenBuiltinActions ?? [])), g2 = computed(() => r2.filter((e15) => "note" !== e15.id && !d2.value.has(e15.id))), f = computed(() => !d2.value.has("note")), m = computed(() => [...i2.extraActions ?? []].sort((e15, t2) => (e15.order ?? 0) - (t2.order ?? 0))), v = ref(null), P = computed(() => ({ position: "absolute", pointerEvents: "auto", left: "50%", transform: "translateX(-50%)", top: i2.placementAbove ? void 0 : `${i2.anchorHeight + 10}px`, bottom: i2.placementAbove ? `${i2.anchorHeight + 10}px` : void 0, display: "flex", alignItems: "center", gap: "2px", padding: "4px 6px", borderRadius: "12px", background: "rgba(255, 255, 255, 0.96)", border: "1px solid rgba(15, 23, 42, 0.06)", boxShadow: "0 2px 8px rgba(15, 23, 42, 0.08), 0 12px 32px rgba(15, 23, 42, 0.1)", backdropFilter: "blur(10px)", WebkitBackdropFilter: "blur(10px)" }));
4165
- function y(e15, t2 = false) {
4198
+ function w(e15, t2 = false) {
4166
4199
  return { display: "flex", alignItems: "center", justifyContent: "center", width: "32px", height: "32px", padding: 0, margin: 0, border: "none", borderRadius: "8px", background: v.value === e15 ? t2 ? "#fffbeb" : "#f1f5f9" : "transparent", color: t2 ? "#b45309" : "#334155", cursor: "pointer", flexShrink: 0, WebkitAppearance: "none", appearance: "none" };
4167
4200
  }
4168
4201
  const C = { width: "1px", height: "20px", margin: "0 4px", background: "rgba(15, 23, 42, 0.1)", flexShrink: 0 };
4169
- return (e15, t2) => (openBlock(), createElementBlock("div", { role: "toolbar", "aria-label": "选区工具", style: normalizeStyle(P.value) }, [(openBlock(true), createElementBlock(Fragment, null, renderList(g2.value, (e16) => (openBlock(), createElementBlock("button", { key: e16.id, type: "button", title: e16.label, "aria-label": e16.label, style: normalizeStyle(y(e16.id)), onMouseenter: (t3) => v.value = e16.id, onMouseleave: t2[0] || (t2[0] = (e17) => v.value = null), onClick: (t3) => o("action", e16.id) }, [createVNode(cs, { kind: e16.id }, null, 8, ["kind"])], 44, us))), 128)), (openBlock(true), createElementBlock(Fragment, null, renderList(m.value, (e16) => (openBlock(), createElementBlock("button", { key: e16.id, type: "button", title: e16.label, style: normalizeStyle(y(e16.id)), onMouseenter: (t3) => v.value = e16.id, onMouseleave: t2[1] || (t2[1] = (e17) => v.value = null), onClick: (t3) => o("action", e16.id) }, [createElementVNode("span", gs, toDisplayString(e16.label.slice(0, 2)), 1)], 44, ps))), 128)), f.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("span", { style: C, "aria-hidden": "" }), createElementVNode("button", { type: "button", title: "添加笔记", "aria-label": "添加笔记", style: normalizeStyle(y("note", true)), onMouseenter: t2[2] || (t2[2] = (e16) => v.value = "note"), onMouseleave: t2[3] || (t2[3] = (e16) => v.value = null), onClick: t2[4] || (t2[4] = (e16) => o("action", "note")) }, [createVNode(cs, { kind: "note" })], 36)], 64)) : createCommentVNode("", true)], 4));
4170
- } }), ms = { highlight: "highlight", underline: "underline", squiggly: "squiggly", strikeout: "strikeout" };
4171
- const vs = /* @__PURE__ */ defineComponent({ __name: "PdfChapterViewport", props: { className: {}, features: {}, buildSelectionMenu: {}, annotationSelectionMenu: {}, redactionSelectionMenu: {}, showNoteMarkers: { type: Boolean, default: true }, showBookmarkMarkers: { type: Boolean, default: true }, showRedactionLayer: { type: Boolean, default: false }, renderPageOverlay: {}, onExtraSelectionAction: {} }, setup(e14) {
4172
- const a3 = e14, s9 = computed(() => a3.features), { hostRef: i2 } = ua(s9), o = (function() {
4202
+ return (e15, t2) => (openBlock(), createElementBlock("div", { role: "toolbar", "aria-label": "选区工具", style: normalizeStyle(P.value) }, [(openBlock(true), createElementBlock(Fragment, null, renderList(g2.value, (e16) => (openBlock(), createElementBlock("button", { key: e16.id, type: "button", title: e16.label, "aria-label": e16.label, style: normalizeStyle(w(e16.id)), onMouseenter: (t3) => v.value = e16.id, onMouseleave: t2[0] || (t2[0] = (e17) => v.value = null), onClick: (t3) => o("action", e16.id) }, [createVNode(bs, { kind: e16.id }, null, 8, ["kind"])], 44, Ps))), 128)), (openBlock(true), createElementBlock(Fragment, null, renderList(m.value, (e16) => (openBlock(), createElementBlock("button", { key: e16.id, type: "button", title: e16.label, style: normalizeStyle(w(e16.id)), onMouseenter: (t3) => v.value = e16.id, onMouseleave: t2[1] || (t2[1] = (e17) => v.value = null), onClick: (t3) => o("action", e16.id) }, [createElementVNode("span", ys, toDisplayString(e16.label.slice(0, 2)), 1)], 44, ws))), 128)), f.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("span", { style: C, "aria-hidden": "" }), createElementVNode("button", { type: "button", title: "添加笔记", "aria-label": "添加笔记", style: normalizeStyle(w("note", true)), onMouseenter: t2[2] || (t2[2] = (e16) => v.value = "note"), onMouseleave: t2[3] || (t2[3] = (e16) => v.value = null), onClick: t2[4] || (t2[4] = (e16) => o("action", "note")) }, [createVNode(bs, { kind: "note" })], 36)], 64)) : createCommentVNode("", true)], 4));
4203
+ } }), Is = { highlight: "highlight", underline: "underline", squiggly: "squiggly", strikeout: "strikeout" };
4204
+ const Ms = /* @__PURE__ */ defineComponent({ __name: "PdfChapterViewport", props: { className: {}, features: {}, buildSelectionMenu: {}, annotationSelectionMenu: {}, redactionSelectionMenu: {}, showNoteMarkers: { type: Boolean, default: true }, showBookmarkMarkers: { type: Boolean, default: true }, showRedactionLayer: { type: Boolean, default: false }, renderPageOverlay: {}, onExtraSelectionAction: {} }, setup(e14) {
4205
+ const a3 = e14, s9 = computed(() => a3.features), { hostRef: i2 } = ma(s9), o = (function() {
4173
4206
  const { registry: e15 } = useRegistry();
4174
4207
  return computed(() => {
4175
4208
  var _a2, _b, _c;
4176
- const t2 = (_c = (_b = (_a2 = e15.value) == null ? void 0 : _a2.getPlugin(vt$1.id)) == null ? void 0 : _b.provides) == null ? void 0 : _c.call(_b);
4209
+ const t2 = (_c = (_b = (_a2 = e15.value) == null ? void 0 : _a2.getPlugin(yt$1.id)) == null ? void 0 : _b.provides) == null ? void 0 : _c.call(_b);
4177
4210
  return t2 ? (e16) => t2.createNoteFromSelection(e16) : null;
4178
4211
  });
4179
4212
  })(), r2 = (function() {
4180
4213
  const { registry: e15 } = useRegistry();
4181
4214
  return computed(() => {
4182
4215
  var _a2;
4183
- return !!((_a2 = e15.value) == null ? void 0 : _a2.getPlugin(vt$1.id));
4216
+ return !!((_a2 = e15.value) == null ? void 0 : _a2.getPlugin(yt$1.id));
4184
4217
  });
4185
4218
  })(), c = (function() {
4186
4219
  const { registry: e15 } = useRegistry();
4187
4220
  return computed(() => {
4188
4221
  var _a2;
4189
- return !!((_a2 = e15.value) == null ? void 0 : _a2.getPlugin(Wt.id));
4222
+ return !!((_a2 = e15.value) == null ? void 0 : _a2.getPlugin(Zt.id));
4190
4223
  });
4191
4224
  })(), u = computed(() => {
4192
4225
  var _a2, _b;
@@ -4207,20 +4240,20 @@ const vs = /* @__PURE__ */ defineComponent({ __name: "PdfChapterViewport", props
4207
4240
  }), o2 = computed(() => {
4208
4241
  var _a2, _b;
4209
4242
  return false !== ((_b = (_a2 = e15()) == null ? void 0 : _a2.notes) == null ? void 0 : _b.enabled);
4210
- }), { provides: r3 } = useCapability(SelectionPlugin.id), { provides: n2 } = useCapability(AnnotationPlugin.id), { provides: l } = useCapability(vt$1.id);
4243
+ }), { provides: r3 } = useCapability(SelectionPlugin.id), { provides: n2 } = useCapability(AnnotationPlugin.id), { provides: l } = useCapability(yt$1.id);
4211
4244
  return computed(() => {
4212
4245
  var _a2, _b, _c;
4213
4246
  if (false !== ((_a2 = s10.value) == null ? void 0 : _a2.enabled) && (i3.value || o2.value || ((_c = (_b = s10.value) == null ? void 0 : _b.extraActions) == null ? void 0 : _c.length))) return (t2) => {
4214
- const h2 = ts(t2.item);
4247
+ const h2 = os(t2.item);
4215
4248
  return (d2) => {
4216
4249
  var _a3, _b2, _c2;
4217
- return h$1("div", d2.menuWrapperProps, h$1(fs, { placementAbove: !!((_a3 = d2.placement) == null ? void 0 : _a3.suggestTop), anchorHeight: d2.rect.size.height, hiddenBuiltinActions: (_b2 = s10.value) == null ? void 0 : _b2.hiddenBuiltinActions, extraActions: (_c2 = s10.value) == null ? void 0 : _c2.extraActions, onAction: (s11) => {
4250
+ return h$1("div", d2.menuWrapperProps, h$1(Cs, { placementAbove: !!((_a3 = d2.placement) == null ? void 0 : _a3.suggestTop), anchorHeight: d2.rect.size.height, hiddenBuiltinActions: (_b2 = s10.value) == null ? void 0 : _b2.hiddenBuiltinActions, extraActions: (_c2 = s10.value) == null ? void 0 : _c2.extraActions, onAction: (s11) => {
4218
4251
  var _a4, _b3, _c3;
4219
4252
  if ("highlight" !== s11 && "underline" !== s11 && "squiggly" !== s11 && "strikeout" !== s11) {
4220
4253
  if ("note" === s11) {
4221
4254
  if (!r3.value || !l.value || !o2.value) return;
4222
4255
  const e16 = r3.value.getHighlightRectsForPage(t2.item.localPageIndex, h2);
4223
- return void as(r3.value.getSelectedText(h2), (a5) => {
4256
+ return void rs(r3.value.getSelectedText(h2), (a5) => {
4224
4257
  var _a5;
4225
4258
  (_a5 = l.value) == null ? void 0 : _a5.requestCreateFromSelection({ chapterId: t2.item.chapterId, localPageIndex: t2.item.localPageIndex, globalPageIndex: t2.item.globalPageIndex, globalPageNumber: t2.item.globalPageNumber, rectsPdfCoord: e16, selectedText: a5.join("\n") });
4226
4259
  });
@@ -4228,7 +4261,7 @@ const vs = /* @__PURE__ */ defineComponent({ __name: "PdfChapterViewport", props
4228
4261
  (_a4 = a4 == null ? void 0 : a4.onExtraAction) == null ? void 0 : _a4.call(a4, s11, t2);
4229
4262
  } else {
4230
4263
  if (!r3.value || !n2.value || !i3.value) return;
4231
- Ce(h2, ms[s11], n2.value, r3.value, (_c3 = (_b3 = e15()) == null ? void 0 : _b3.markup) == null ? void 0 : _c3.styles);
4264
+ Se(h2, Is[s11], n2.value, r3.value, (_c3 = (_b3 = e15()) == null ? void 0 : _b3.markup) == null ? void 0 : _c3.styles);
4232
4265
  }
4233
4266
  } }));
4234
4267
  };
@@ -4239,42 +4272,42 @@ const vs = /* @__PURE__ */ defineComponent({ __name: "PdfChapterViewport", props
4239
4272
  const t2 = v.value ? v.value(e15) : e15.defaultMenu;
4240
4273
  return a3.buildSelectionMenu ? a3.buildSelectionMenu({ ...e15, defaultMenu: t2 }) : t2;
4241
4274
  };
4242
- }), { provides: y } = useCapability(DocumentManagerPlugin.id);
4275
+ }), { provides: C } = useCapability(DocumentManagerPlugin.id);
4243
4276
  function I(e15) {
4244
4277
  var _a2;
4245
4278
  const t2 = [];
4246
4279
  if (f.value) {
4247
4280
  const s11 = (function(e16) {
4248
4281
  var _a3, _b, _c, _d;
4249
- const t3 = ts(e16), s12 = (_b = (_a3 = y.value) == null ? void 0 : _a3.getDocument(t3)) == null ? void 0 : _b.pages[e16.localPageIndex];
4250
- return e16.isPlaceholder || !s12 ? null : h$1(is, { item: e16, pdfPageWidth: s12.size.width, pdfPageHeight: s12.size.height, cssPageWidth: e16.width, cssPageHeight: e16.height, hoverUi: (_d = (_c = a3.features) == null ? void 0 : _c.bookmarks) == null ? void 0 : _d.hover });
4282
+ const t3 = os(e16), s12 = (_b = (_a3 = C.value) == null ? void 0 : _a3.getDocument(t3)) == null ? void 0 : _b.pages[e16.localPageIndex];
4283
+ return e16.isPlaceholder || !s12 ? null : h$1(cs, { item: e16, pdfPageWidth: s12.size.width, pdfPageHeight: s12.size.height, cssPageWidth: e16.width, cssPageHeight: e16.height, hoverUi: (_d = (_c = a3.features) == null ? void 0 : _c.bookmarks) == null ? void 0 : _d.hover });
4251
4284
  })(e15);
4252
4285
  s11 && t2.push(s11);
4253
4286
  }
4254
4287
  const s10 = (_a2 = a3.renderPageOverlay) == null ? void 0 : _a2.call(a3, e15);
4255
4288
  if (s10 && t2.push(s10), t2.length) return h$1("div", t2);
4256
4289
  }
4257
- return (t2, a4) => (openBlock(), createElementBlock("div", { ref_key: "hostRef", ref: i2, class: normalizeClass(e14.className), style: normalizeStyle(e14.className ? void 0 : unref(ve$1)) }, [createVNode(unref(Ia), { class: normalizeClass(e14.className) }, { page: withCtx(({ item: t3 }) => {
4290
+ return (t2, a4) => (openBlock(), createElementBlock("div", { ref_key: "hostRef", ref: i2, class: normalizeClass(e14.className), style: normalizeStyle(e14.className ? void 0 : unref(be$1)) }, [createVNode(unref(ka), { class: normalizeClass(e14.className) }, { page: withCtx(({ item: t3 }) => {
4258
4291
  var _a2, _b, _c, _d;
4259
- return [createVNode(ss, { item: t3, features: e14.features, "show-note-markers": u.value, "show-bookmark-markers": p2.value, "show-redaction-layer": e14.showRedactionLayer, "note-marker-ui": (_b = (_a2 = e14.features) == null ? void 0 : _a2.notes) == null ? void 0 : _b.marker, "bookmark-marker-ui": (_d = (_c = e14.features) == null ? void 0 : _c.bookmarks) == null ? void 0 : _d.marker, "build-selection-menu": b.value, "create-note": unref(o), "annotation-selection-menu": e14.annotationSelectionMenu, "redaction-selection-menu": e14.redactionSelectionMenu, "render-page-overlay": I }, null, 8, ["item", "features", "show-note-markers", "show-bookmark-markers", "show-redaction-layer", "note-marker-ui", "bookmark-marker-ui", "build-selection-menu", "create-note", "annotation-selection-menu", "redaction-selection-menu"])];
4292
+ return [createVNode(ds, { item: t3, features: e14.features, "show-note-markers": u.value, "show-bookmark-markers": p2.value, "show-redaction-layer": e14.showRedactionLayer, "note-marker-ui": (_b = (_a2 = e14.features) == null ? void 0 : _a2.notes) == null ? void 0 : _b.marker, "bookmark-marker-ui": (_d = (_c = e14.features) == null ? void 0 : _c.bookmarks) == null ? void 0 : _d.marker, "build-selection-menu": b.value, "create-note": unref(o), "annotation-selection-menu": e14.annotationSelectionMenu, "redaction-selection-menu": e14.redactionSelectionMenu, "render-page-overlay": I }, null, 8, ["item", "features", "show-note-markers", "show-bookmark-markers", "show-redaction-layer", "note-marker-ui", "bookmark-marker-ui", "build-selection-menu", "create-note", "annotation-selection-menu", "redaction-selection-menu"])];
4260
4293
  }), _: 1 }, 8, ["class"]), renderSlot(t2.$slots, "default")], 6));
4261
- } }), bs = { key: 0, style: { display: "flex", flexDirection: "column", height: "100%", minHeight: 0, width: "100%" } }, Ps = /* @__PURE__ */ defineComponent({ __name: "ChapterPdfViewer", props: { engine: {}, options: {}, editorOptions: {}, features: {}, className: {}, viewportClassName: {}, onExtraSelectionAction: { type: Function } }, setup(e14) {
4294
+ } }), Ss = { key: 0, style: { display: "flex", flexDirection: "column", height: "100%", minHeight: 0, width: "100%" } }, xs = /* @__PURE__ */ defineComponent({ __name: "ChapterPdfViewer", props: { engine: {}, options: {}, editorOptions: {}, features: {}, className: {}, viewportClassName: {}, onExtraSelectionAction: { type: Function } }, setup(e14) {
4262
4295
  const a3 = e14, s9 = computed(() => (function(e15) {
4263
- if (e15.options) return oa(e15.options);
4296
+ if (e15.options) return ha(e15.options);
4264
4297
  if (!e15.editorOptions) throw new Error("ChapterPdfViewer: 请传入 `options`(推荐),或同时传入 `editorOptions` 与 `features`");
4265
- const t2 = Me(e15.features), { plugins: a4 } = ta({ ...e15.editorOptions, features: t2 });
4298
+ const t2 = Le(e15.features), { plugins: a4 } = oa({ ...e15.editorOptions, features: t2 });
4266
4299
  return { plugins: a4, features: t2, editorOptions: { ...e15.editorOptions, features: t2 } };
4267
4300
  })({ engine: a3.engine, options: a3.options, editorOptions: a3.editorOptions, features: a3.features }));
4268
- return (t2, a4) => (openBlock(), createElementBlock("div", { class: normalizeClass(e14.className), style: normalizeStyle(e14.className ? void 0 : unref(ve$1)) }, [createVNode(unref(EmbedPDF), { engine: e14.engine, plugins: s9.value.plugins }, { default: withCtx(({ pluginsReady: a5 }) => [a5 ? (openBlock(), createElementBlock("div", bs, [renderSlot(t2.$slots, "prepend"), createVNode(vs, { class: normalizeClass(e14.viewportClassName), style: { flex: 1, minHeight: 0 }, features: s9.value.features, "on-extra-selection-action": e14.onExtraSelectionAction }, null, 8, ["class", "features", "on-extra-selection-action"]), renderSlot(t2.$slots, "default")])) : createCommentVNode("", true)]), _: 3 }, 8, ["engine", "plugins"])], 6));
4269
- } }), ws = { class: "chapter-tree-row" }, ys = ["aria-expanded"], Cs = { key: 1, class: "chapter-tree-toggle-spacer", "aria-hidden": "" }, Is = { class: "chapter-tree-label" }, Ms = { class: "chapter-tree-meta" }, Ss = { key: 0 }, xs = (e14, t2) => {
4301
+ return (t2, a4) => (openBlock(), createElementBlock("div", { class: normalizeClass(e14.className), style: normalizeStyle(e14.className ? void 0 : unref(be$1)) }, [createVNode(unref(EmbedPDF), { engine: e14.engine, plugins: s9.value.plugins }, { default: withCtx(({ pluginsReady: a5 }) => [a5 ? (openBlock(), createElementBlock("div", Ss, [renderSlot(t2.$slots, "prepend"), createVNode(Ms, { class: normalizeClass(e14.viewportClassName), style: { flex: 1, minHeight: 0 }, features: s9.value.features, "on-extra-selection-action": e14.onExtraSelectionAction }, null, 8, ["class", "features", "on-extra-selection-action"]), renderSlot(t2.$slots, "default")])) : createCommentVNode("", true)]), _: 3 }, 8, ["engine", "plugins"])], 6));
4302
+ } }), ks = { class: "chapter-tree-row" }, Ls = ["aria-expanded"], $s = { key: 1, class: "chapter-tree-toggle-spacer", "aria-hidden": "" }, zs = { class: "chapter-tree-label" }, Ts = { class: "chapter-tree-meta" }, Ds = { key: 0 }, Os = (e14, t2) => {
4270
4303
  const a3 = e14.__vccOpts || e14;
4271
4304
  for (const [s9, i2] of t2) a3[s9] = i2;
4272
4305
  return a3;
4273
- }, ks = /* @__PURE__ */ xs(/* @__PURE__ */ defineComponent({ __name: "ChapterTreeItem", props: { node: {}, depth: {}, activeChapterId: {}, chapterStatus: {} }, emits: ["select"], setup(e14) {
4306
+ }, Gs = /* @__PURE__ */ Os(/* @__PURE__ */ defineComponent({ __name: "ChapterTreeItem", props: { node: {}, depth: {}, activeChapterId: {}, chapterStatus: {} }, emits: ["select"], setup(e14) {
4274
4307
  const s9 = { idle: "未加载", loading: "加载中", loaded: "已加载", closed: "已卸载", error: "失败", "password-required": "需密码" }, i2 = e14, o = computed(() => i2.node.children ?? []), r2 = computed(() => o.value.length > 0), h2 = ref(i2.depth < 1), u = computed(() => i2.activeChapterId === i2.node.id), p2 = computed(() => i2.chapterStatus[i2.node.id] ?? "idle"), g2 = computed(() => !r2.value);
4275
- return (t2, a3) => (openBlock(), createElementBlock("li", null, [createElementVNode("div", ws, [r2.value ? (openBlock(), createElementBlock("button", { key: 0, type: "button", class: "chapter-tree-toggle", "aria-expanded": h2.value, onClick: a3[0] || (a3[0] = (e15) => h2.value = !h2.value) }, toDisplayString(h2.value ? "▼" : "▶"), 9, ys)) : (openBlock(), createElementBlock("span", Cs)), createElementVNode("button", { type: "button", class: normalizeClass(["chapter-tree-btn", { "chapter-tree-btn-active": u.value }]), onClick: a3[1] || (a3[1] = (a4) => t2.$emit("select", e14.node.id)) }, [createElementVNode("div", Is, toDisplayString(e14.node.title), 1), createElementVNode("div", Ms, [createElementVNode("span", null, " 第 " + toDisplayString(e14.node.startPage) + toDisplayString(e14.node.endPage !== e14.node.startPage ? `–${e14.node.endPage}` : "") + " 页 ", 1), g2.value ? (openBlock(), createElementBlock("span", Ss, toDisplayString(s9[p2.value]), 1)) : createCommentVNode("", true)])], 2)]), r2.value && h2.value ? (openBlock(), createBlock(Ls, { key: 0, nodes: o.value, depth: e14.depth + 1, "active-chapter-id": e14.activeChapterId, "chapter-status": e14.chapterStatus, onSelect: a3[2] || (a3[2] = (e15) => t2.$emit("select", e15)) }, null, 8, ["nodes", "depth", "active-chapter-id", "chapter-status"])) : createCommentVNode("", true)]));
4276
- } }), [["__scopeId", "data-v-315bbf7a"]]), Ls = /* @__PURE__ */ xs(/* @__PURE__ */ defineComponent({ __name: "ChapterTreeList", props: { nodes: {}, depth: {}, activeChapterId: {}, chapterStatus: {} }, emits: ["select"], setup: (e14) => (t2, a3) => (openBlock(), createElementBlock("ul", { class: "chapter-tree-list", style: normalizeStyle({ marginLeft: e14.depth > 0 ? "12px" : "0" }) }, [(openBlock(true), createElementBlock(Fragment, null, renderList(e14.nodes, (s9) => (openBlock(), createBlock(ks, { key: s9.id, node: s9, depth: e14.depth, "active-chapter-id": e14.activeChapterId, "chapter-status": e14.chapterStatus, onSelect: a3[0] || (a3[0] = (e15) => t2.$emit("select", e15)) }, null, 8, ["node", "depth", "active-chapter-id", "chapter-status"]))), 128))], 4)) }), [["__scopeId", "data-v-eb742e4f"]]), $s = { class: "chapter-tree" }, zs = { class: "chapter-tree-nav", "aria-label": "章节目录" }, Ts = /* @__PURE__ */ xs(/* @__PURE__ */ defineComponent({ __name: "ChapterTreePanel", props: { tree: {}, activeChapterId: {} }, emits: ["active-chapter-change"], setup(e14, { emit: t2 }) {
4277
- const o = e14, r2 = t2, { provides: h2 } = useCapability(Xe.id), { provides: d2 } = useCapability(Ee.id), u = ref({});
4308
+ return (t2, a3) => (openBlock(), createElementBlock("li", null, [createElementVNode("div", ks, [r2.value ? (openBlock(), createElementBlock("button", { key: 0, type: "button", class: "chapter-tree-toggle", "aria-expanded": h2.value, onClick: a3[0] || (a3[0] = (e15) => h2.value = !h2.value) }, toDisplayString(h2.value ? "▼" : "▶"), 9, Ls)) : (openBlock(), createElementBlock("span", $s)), createElementVNode("button", { type: "button", class: normalizeClass(["chapter-tree-btn", { "chapter-tree-btn-active": u.value }]), onClick: a3[1] || (a3[1] = (a4) => t2.$emit("select", e14.node.id)) }, [createElementVNode("div", zs, toDisplayString(e14.node.title), 1), createElementVNode("div", Ts, [createElementVNode("span", null, " 第 " + toDisplayString(e14.node.startPage) + toDisplayString(e14.node.endPage !== e14.node.startPage ? `–${e14.node.endPage}` : "") + " 页 ", 1), g2.value ? (openBlock(), createElementBlock("span", Ds, toDisplayString(s9[p2.value]), 1)) : createCommentVNode("", true)])], 2)]), r2.value && h2.value ? (openBlock(), createBlock(Ns, { key: 0, nodes: o.value, depth: e14.depth + 1, "active-chapter-id": e14.activeChapterId, "chapter-status": e14.chapterStatus, onSelect: a3[2] || (a3[2] = (e15) => t2.$emit("select", e15)) }, null, 8, ["nodes", "depth", "active-chapter-id", "chapter-status"])) : createCommentVNode("", true)]));
4309
+ } }), [["__scopeId", "data-v-315bbf7a"]]), Ns = /* @__PURE__ */ Os(/* @__PURE__ */ defineComponent({ __name: "ChapterTreeList", props: { nodes: {}, depth: {}, activeChapterId: {}, chapterStatus: {} }, emits: ["select"], setup: (e14) => (t2, a3) => (openBlock(), createElementBlock("ul", { class: "chapter-tree-list", style: normalizeStyle({ marginLeft: e14.depth > 0 ? "12px" : "0" }) }, [(openBlock(true), createElementBlock(Fragment, null, renderList(e14.nodes, (s9) => (openBlock(), createBlock(Gs, { key: s9.id, node: s9, depth: e14.depth, "active-chapter-id": e14.activeChapterId, "chapter-status": e14.chapterStatus, onSelect: a3[0] || (a3[0] = (e15) => t2.$emit("select", e15)) }, null, 8, ["node", "depth", "active-chapter-id", "chapter-status"]))), 128))], 4)) }), [["__scopeId", "data-v-eb742e4f"]]), As = { class: "chapter-tree" }, Vs = { class: "chapter-tree-nav", "aria-label": "章节目录" }, Es = /* @__PURE__ */ Os(/* @__PURE__ */ defineComponent({ __name: "ChapterTreePanel", props: { tree: {}, activeChapterId: {} }, emits: ["active-chapter-change"], setup(e14, { emit: t2 }) {
4310
+ const o = e14, r2 = t2, { provides: h2 } = useCapability(tt$1.id), { provides: d2 } = useCapability(qe.id), u = ref({});
4278
4311
  function p2() {
4279
4312
  if (!d2.value) return;
4280
4313
  const e15 = {}, t3 = (a3) => {
@@ -4291,7 +4324,7 @@ const vs = /* @__PURE__ */ defineComponent({ __name: "PdfChapterViewport", props
4291
4324
  }
4292
4325
  return watch(d2, (e15) => {
4293
4326
  g2 == null ? void 0 : g2(), g2 = e15 ? e15.onChapterStatusChange(p2) : null;
4294
- }, { immediate: true }), onBeforeUnmount(() => g2 == null ? void 0 : g2()), (t3, a3) => (openBlock(), createElementBlock("aside", $s, [a3[0] || (a3[0] = createElementVNode("h2", { class: "chapter-tree-title" }, "章节目录", -1)), createElementVNode("nav", zs, [createVNode(Ls, { nodes: e14.tree, depth: 0, "active-chapter-id": e14.activeChapterId, "chapter-status": u.value, onSelect: f }, null, 8, ["nodes", "active-chapter-id", "chapter-status"])])]));
4327
+ }, { immediate: true }), onBeforeUnmount(() => g2 == null ? void 0 : g2()), (t3, a3) => (openBlock(), createElementBlock("aside", As, [a3[0] || (a3[0] = createElementVNode("h2", { class: "chapter-tree-title" }, "章节目录", -1)), createElementVNode("nav", Vs, [createVNode(Ns, { nodes: e14.tree, depth: 0, "active-chapter-id": e14.activeChapterId, "chapter-status": u.value, onSelect: f }, null, 8, ["nodes", "active-chapter-id", "chapter-status"])])]));
4295
4328
  } }), [["__scopeId", "data-v-d7a0838d"]]);
4296
4329
  const _sfc_main = /* @__PURE__ */ defineComponent({
4297
4330
  __name: "ChapterPdfViewer",
@@ -4305,7 +4338,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4305
4338
  },
4306
4339
  setup(__props) {
4307
4340
  return (_ctx, _cache) => {
4308
- return openBlock(), createBlock(unref(Ps), normalizeProps(guardReactiveProps(_ctx.$props)), createSlots({
4341
+ return openBlock(), createBlock(unref(xs), normalizeProps(guardReactiveProps(_ctx.$props)), createSlots({
4309
4342
  default: withCtx(() => [
4310
4343
  renderSlot(_ctx.$slots, "default")
4311
4344
  ]),
@@ -4511,8 +4544,8 @@ const _ChapterManagerPlugin = class _ChapterManagerPlugin2 extends BasePlugin {
4511
4544
  for (let i2 = 0; i2 < count; i2++) {
4512
4545
  const chapterId = this.manifest.chapters[i2].chapterId;
4513
4546
  this.chapterLastUsed.set(chapterId, now);
4514
- const st3 = this.chapterStatus.get(chapterId) ?? "idle";
4515
- if (st3 === "idle" || st3 === "closed" || st3 === "error") {
4547
+ const st2 = this.chapterStatus.get(chapterId) ?? "idle";
4548
+ if (st2 === "idle" || st2 === "closed" || st2 === "error") {
4516
4549
  void this.ensureChapterLoaded(chapterId);
4517
4550
  }
4518
4551
  }
@@ -4547,8 +4580,8 @@ const _ChapterManagerPlugin = class _ChapterManagerPlugin2 extends BasePlugin {
4547
4580
  for (const i2 of neededIdx) needed.add(orderedIds[i2]);
4548
4581
  for (const cid of needed) {
4549
4582
  this.chapterLastUsed.set(cid, now);
4550
- const st3 = this.chapterStatus.get(cid) ?? "idle";
4551
- if (st3 === "idle" || st3 === "closed" || st3 === "error") {
4583
+ const st2 = this.chapterStatus.get(cid) ?? "idle";
4584
+ if (st2 === "idle" || st2 === "closed" || st2 === "error") {
4552
4585
  void this.ensureChapterLoaded(cid);
4553
4586
  }
4554
4587
  }
@@ -4566,8 +4599,8 @@ const _ChapterManagerPlugin = class _ChapterManagerPlugin2 extends BasePlugin {
4566
4599
  const timeout = this.config.unloadTimeoutMs ?? 6e4;
4567
4600
  if (timeout <= 0) return;
4568
4601
  const now = Date.now();
4569
- for (const [cid, st3] of this.chapterStatus) {
4570
- if (st3 !== "loaded") continue;
4602
+ for (const [cid, st2] of this.chapterStatus) {
4603
+ if (st2 !== "loaded") continue;
4571
4604
  const last = this.chapterLastUsed.get(cid) ?? 0;
4572
4605
  if (now - last > timeout) {
4573
4606
  this.closeChapter(cid);
@@ -4656,9 +4689,9 @@ const _ChapterManagerPlugin = class _ChapterManagerPlugin2 extends BasePlugin {
4656
4689
  /** 阻塞等待该章节状态进入 loaded / error / password-required / closed */
4657
4690
  waitForTerminalStatus(chapterId) {
4658
4691
  return new Promise((resolve) => {
4659
- const check = (st3) => {
4660
- if (st3 === "loaded" || st3 === "error" || st3 === "password-required" || st3 === "closed") {
4661
- resolve(st3);
4692
+ const check = (st2) => {
4693
+ if (st2 === "loaded" || st2 === "error" || st2 === "password-required" || st2 === "closed") {
4694
+ resolve(st2);
4662
4695
  return true;
4663
4696
  }
4664
4697
  return false;
@@ -5012,7 +5045,7 @@ function V(t2, e14, a3) {
5012
5045
  return a3.resolve(t2, e14);
5013
5046
  }
5014
5047
  }
5015
- class F {
5048
+ class E {
5016
5049
  constructor(t2) {
5017
5050
  this._pages = t2, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
5018
5051
  for (const e14 of t2) {
@@ -5046,7 +5079,7 @@ class F {
5046
5079
  return a3 ? this._pages.indexOf(a3) : -1;
5047
5080
  }
5048
5081
  }
5049
- function E(t2, e14 = N) {
5082
+ function U(t2, e14 = N) {
5050
5083
  const a3 = (function(t3, e15 = N) {
5051
5084
  const a4 = /* @__PURE__ */ new Map();
5052
5085
  for (const o2 of t3.chapters) {
@@ -5069,9 +5102,9 @@ function E(t2, e14 = N) {
5069
5102
  const [o2] = e15.globalPageRange, [h2] = e15.localPageRange, d2 = h2 + (n2 - o2);
5070
5103
  r2.push({ globalPageIndex: i2++, globalPageNumber: n2, chapterId: t3, localPageIndex: d2 });
5071
5104
  }
5072
- return new F(r2);
5105
+ return new E(r2);
5073
5106
  }
5074
- const U = class s3 extends BasePlugin {
5107
+ const F = class s3 extends BasePlugin {
5075
5108
  constructor(t2, s9) {
5076
5109
  super(t2, s9), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = N, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
5077
5110
  }
@@ -5111,7 +5144,7 @@ const U = class s3 extends BasePlugin {
5111
5144
  const a3 = new Set(this.chapterStatus.keys()), o = new Set(t2.chapters.map((t3) => t3.chapterId));
5112
5145
  for (const s9 of a3) o.has(s9) || (this.closeChapter(s9), this.chapterStatus.delete(s9));
5113
5146
  for (const s9 of t2.chapters) this.chapterStatus.has(s9.chapterId) || this.chapterStatus.set(s9.chapterId, "idle");
5114
- this.manifest = t2, this.virtualPageMap = E(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
5147
+ this.manifest = t2, this.virtualPageMap = U(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
5115
5148
  }
5116
5149
  eagerPrefetchFromManifest() {
5117
5150
  const t2 = this.config.prefetchChapters ?? 0;
@@ -5249,8 +5282,8 @@ const U = class s3 extends BasePlugin {
5249
5282
  this.chapterStatus.get(t2) !== e14 && (this.chapterStatus.set(t2, e14), this.statusChange$.emit({ chapterId: t2, status: e14, ..."error" === e14 && a3 ? { error: { message: a3 } } : {} }));
5250
5283
  }
5251
5284
  };
5252
- U.id = "chapter-manager";
5253
- let R = U;
5285
+ F.id = "chapter-manager";
5286
+ let R = F;
5254
5287
  function _(t2, e14) {
5255
5288
  if (t2 === e14) return true;
5256
5289
  if (t2.totalHeight !== e14.totalHeight || t2.totalWidth !== e14.totalWidth || t2.pageGap !== e14.pageGap || t2.items.length !== e14.items.length) return false;
@@ -5440,8 +5473,8 @@ const q = class extends BasePlugin {
5440
5473
  }
5441
5474
  };
5442
5475
  q.id = "chapter-scroll";
5443
- const J = { kind: "first-wins" };
5444
- function K(t2, e14, a3) {
5476
+ const K = { kind: "first-wins" };
5477
+ function J(t2, e14, a3) {
5445
5478
  if (1 === e14.length) return e14[0].chapterId;
5446
5479
  switch (a3.kind) {
5447
5480
  case "first-wins":
@@ -5493,8 +5526,8 @@ let Q = class {
5493
5526
  return a3 ? this._pages.indexOf(a3) : -1;
5494
5527
  }
5495
5528
  };
5496
- function Y(t2, e14 = J) {
5497
- const a3 = (function(t3, e15 = J) {
5529
+ function Y(t2, e14 = K) {
5530
+ const a3 = (function(t3, e15 = K) {
5498
5531
  const a4 = /* @__PURE__ */ new Map();
5499
5532
  for (const o2 of t3.chapters) {
5500
5533
  const [t4, e16] = o2.globalPageRange;
@@ -5504,7 +5537,7 @@ function Y(t2, e14 = J) {
5504
5537
  }
5505
5538
  }
5506
5539
  const s10 = /* @__PURE__ */ new Map();
5507
- for (const [o2, r3] of a4) s10.set(o2, K(o2, r3, e15));
5540
+ for (const [o2, r3] of a4) s10.set(o2, J(o2, r3, e15));
5508
5541
  return s10;
5509
5542
  })(t2, e14), s9 = /* @__PURE__ */ new Map();
5510
5543
  for (const n2 of t2.chapters) s9.set(n2.chapterId, n2);
@@ -5520,10 +5553,10 @@ function Y(t2, e14 = J) {
5520
5553
  }
5521
5554
  const X = class s4 extends BasePlugin {
5522
5555
  constructor(t2, s9) {
5523
- super(t2, s9), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = J, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
5556
+ super(t2, s9), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = K, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
5524
5557
  }
5525
5558
  async initialize(t2) {
5526
- if (this.config = t2, this.passwordProvider = t2.passwordProvider, this.overlapStrategy = t2.overlapStrategy ?? J, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((t3) => {
5559
+ if (this.config = t2, this.passwordProvider = t2.passwordProvider, this.overlapStrategy = t2.overlapStrategy ?? K, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((t3) => {
5527
5560
  this.isOwnedChapter(t3.id) && (this.passwordAttempts.delete(t3.id), this.updateStatus(t3.id, "loaded"));
5528
5561
  }), this.documentManager.provides().onDocumentClosed((t3) => {
5529
5562
  this.isOwnedChapter(t3) && this.updateStatus(t3, "closed");
@@ -5699,7 +5732,7 @@ const X = class s4 extends BasePlugin {
5699
5732
  X.id = "chapter-manager";
5700
5733
  let Z = X;
5701
5734
  const tt = { kind: "first-wins" };
5702
- function et(t2, e14, a3) {
5735
+ function et2(t2, e14, a3) {
5703
5736
  if (1 === e14.length) return e14[0].chapterId;
5704
5737
  switch (a3.kind) {
5705
5738
  case "first-wins":
@@ -5751,7 +5784,7 @@ let at = class {
5751
5784
  return a3 ? this._pages.indexOf(a3) : -1;
5752
5785
  }
5753
5786
  };
5754
- function st2(t2, e14 = tt) {
5787
+ function st(t2, e14 = tt) {
5755
5788
  const a3 = (function(t3, e15 = tt) {
5756
5789
  const a4 = /* @__PURE__ */ new Map();
5757
5790
  for (const o2 of t3.chapters) {
@@ -5762,7 +5795,7 @@ function st2(t2, e14 = tt) {
5762
5795
  }
5763
5796
  }
5764
5797
  const s10 = /* @__PURE__ */ new Map();
5765
- for (const [o2, r3] of a4) s10.set(o2, et(o2, r3, e15));
5798
+ for (const [o2, r3] of a4) s10.set(o2, et2(o2, r3, e15));
5766
5799
  return s10;
5767
5800
  })(t2, e14), s9 = /* @__PURE__ */ new Map();
5768
5801
  for (const n2 of t2.chapters) s9.set(n2.chapterId, n2);
@@ -5816,7 +5849,7 @@ const ot = class s5 extends BasePlugin {
5816
5849
  const a3 = new Set(this.chapterStatus.keys()), o = new Set(t2.chapters.map((t3) => t3.chapterId));
5817
5850
  for (const s9 of a3) o.has(s9) || (this.closeChapter(s9), this.chapterStatus.delete(s9));
5818
5851
  for (const s9 of t2.chapters) this.chapterStatus.has(s9.chapterId) || this.chapterStatus.set(s9.chapterId, "idle");
5819
- this.manifest = t2, this.virtualPageMap = st2(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
5852
+ this.manifest = t2, this.virtualPageMap = st(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
5820
5853
  }
5821
5854
  eagerPrefetchFromManifest() {
5822
5855
  const t2 = this.config.prefetchChapters ?? 0;
@@ -5965,7 +5998,7 @@ function it(t2, e14) {
5965
5998
  }
5966
5999
  return true;
5967
6000
  }
5968
- const nt = class extends BasePlugin {
6001
+ const nt2 = class extends BasePlugin {
5969
6002
  constructor(t2, a3) {
5970
6003
  super(t2, a3), this.layoutChange$ = createBehaviorEmitter(void 0, it), this.visibleChange$ = createBehaviorEmitter(), this.virtualPageMap = null, this.pageSizes = /* @__PURE__ */ new Map(), this.offsets = [], this.totalHeight = 0, this.totalWidth = 0, this.viewportEl = null, this.viewportObservers = null, this.currentVisible = [], this.currentGlobalPageIndex = 0, this.chapterManagerUnsubs = [], this.chapterManager = this.registry.getPlugin(rt.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
5971
6004
  }
@@ -6144,11 +6177,11 @@ const nt = class extends BasePlugin {
6144
6177
  a3 && this.scrollToIndex(a3.globalPageIndex, e14);
6145
6178
  }
6146
6179
  };
6147
- nt.id = "chapter-scroll";
6148
- let ht2 = nt;
6180
+ nt2.id = "chapter-scroll";
6181
+ let ht = nt2;
6149
6182
  const dt = class s6 extends BasePlugin {
6150
6183
  constructor(t2, s9) {
6151
- super(t2, s9), this.notesChange$ = createBehaviorEmitter([]), this.noteActivated$ = createEmitter(), this.notes = /* @__PURE__ */ new Map(), this.chapterScroll = this.registry.getPlugin(ht2.id), this.chapterManager = this.registry.getPlugin(Z.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
6184
+ super(t2, s9), this.notesChange$ = createBehaviorEmitter([]), this.noteActivated$ = createEmitter(), this.notes = /* @__PURE__ */ new Map(), this.chapterScroll = this.registry.getPlugin(ht.id), this.chapterManager = this.registry.getPlugin(Z.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
6152
6185
  }
6153
6186
  async initialize(t2) {
6154
6187
  if (this.config = t2, t2.callbacks.loadNotes) try {
@@ -6312,7 +6345,7 @@ let vt = class {
6312
6345
  return a3 ? this._pages.indexOf(a3) : -1;
6313
6346
  }
6314
6347
  };
6315
- function bt(t2, e14 = ft) {
6348
+ function bt2(t2, e14 = ft) {
6316
6349
  const a3 = (function(t3, e15 = ft) {
6317
6350
  const a4 = /* @__PURE__ */ new Map();
6318
6351
  for (const o2 of t3.chapters) {
@@ -6377,7 +6410,7 @@ const Pt = class s7 extends BasePlugin {
6377
6410
  const a3 = new Set(this.chapterStatus.keys()), o = new Set(t2.chapters.map((t3) => t3.chapterId));
6378
6411
  for (const s9 of a3) o.has(s9) || (this.closeChapter(s9), this.chapterStatus.delete(s9));
6379
6412
  for (const s9 of t2.chapters) this.chapterStatus.has(s9.chapterId) || this.chapterStatus.set(s9.chapterId, "idle");
6380
- this.manifest = t2, this.virtualPageMap = bt(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
6413
+ this.manifest = t2, this.virtualPageMap = bt2(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
6381
6414
  }
6382
6415
  eagerPrefetchFromManifest() {
6383
6416
  const t2 = this.config.prefetchChapters ?? 0;
@@ -6570,7 +6603,7 @@ class Ct {
6570
6603
  return a3 ? this._pages.indexOf(a3) : -1;
6571
6604
  }
6572
6605
  }
6573
- function Mt2(t2, e14 = yt) {
6606
+ function Mt(t2, e14 = yt) {
6574
6607
  const a3 = (function(t3, e15 = yt) {
6575
6608
  const a4 = /* @__PURE__ */ new Map();
6576
6609
  for (const o2 of t3.chapters) {
@@ -6635,7 +6668,7 @@ const St = class s8 extends BasePlugin {
6635
6668
  const a3 = new Set(this.chapterStatus.keys()), o = new Set(t2.chapters.map((t3) => t3.chapterId));
6636
6669
  for (const s9 of a3) o.has(s9) || (this.closeChapter(s9), this.chapterStatus.delete(s9));
6637
6670
  for (const s9 of t2.chapters) this.chapterStatus.has(s9.chapterId) || this.chapterStatus.set(s9.chapterId, "idle");
6638
- this.manifest = t2, this.virtualPageMap = Mt2(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
6671
+ this.manifest = t2, this.virtualPageMap = Mt(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
6639
6672
  }
6640
6673
  eagerPrefetchFromManifest() {
6641
6674
  const t2 = this.config.prefetchChapters ?? 0;
@@ -6784,7 +6817,7 @@ function kt(t2, e14) {
6784
6817
  }
6785
6818
  return true;
6786
6819
  }
6787
- const Lt = class extends BasePlugin {
6820
+ const Lt2 = class extends BasePlugin {
6788
6821
  constructor(t2, a3) {
6789
6822
  super(t2, a3), this.layoutChange$ = createBehaviorEmitter(void 0, kt), this.visibleChange$ = createBehaviorEmitter(), this.virtualPageMap = null, this.pageSizes = /* @__PURE__ */ new Map(), this.offsets = [], this.totalHeight = 0, this.totalWidth = 0, this.viewportEl = null, this.viewportObservers = null, this.currentVisible = [], this.currentGlobalPageIndex = 0, this.chapterManagerUnsubs = [], this.chapterManager = this.registry.getPlugin(xt.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
6790
6823
  }
@@ -6963,8 +6996,8 @@ const Lt = class extends BasePlugin {
6963
6996
  a3 && this.scrollToIndex(a3.globalPageIndex, e14);
6964
6997
  }
6965
6998
  };
6966
- Lt.id = "chapter-scroll";
6967
- let $t = Lt;
6999
+ Lt2.id = "chapter-scroll";
7000
+ let $t = Lt2;
6968
7001
  function Tt(t2) {
6969
7002
  const e14 = t2[t2.length - 1];
6970
7003
  return { x: e14.origin.x + e14.size.width, y: e14.origin.y + e14.size.height };
@@ -6986,7 +7019,7 @@ function Ot(t2, e14) {
6986
7019
  }
6987
7020
  return false;
6988
7021
  }
6989
- async function Gt(t2, e14, a3) {
7022
+ async function Gt2(t2, e14, a3) {
6990
7023
  t2.scrollToGlobalPageIndex(e14), await (function(t3, e15, a4 = 2500) {
6991
7024
  const s9 = t3.getLayout().items.find((t4) => t4.globalPageIndex === e15 && !t4.isPlaceholder);
6992
7025
  return s9 ? Promise.resolve(s9) : new Promise((s10) => {
@@ -6999,7 +7032,7 @@ async function Gt(t2, e14, a3) {
6999
7032
  });
7000
7033
  })(t2, e14), t2.scrollToGlobalPdfPoint(e14, a3, { marginTop: 80 });
7001
7034
  }
7002
- const zt2 = class a2 extends BasePlugin {
7035
+ const zt = class a2 extends BasePlugin {
7003
7036
  constructor(t2, a3) {
7004
7037
  super(t2, a3), this.change$ = createBehaviorEmitter([]), this.entries = /* @__PURE__ */ new Map(), this.chapterScroll = this.registry.getPlugin($t.id), this.chapterManager = this.registry.getPlugin(wt.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
7005
7038
  }
@@ -7073,21 +7106,21 @@ const zt2 = class a2 extends BasePlugin {
7073
7106
  const e15 = t3.rectPdfCoord;
7074
7107
  return e15.origin.y + e15.size.height;
7075
7108
  })(e14.anchor);
7076
- await Gt(a3, s9, o);
7109
+ await Gt2(a3, s9, o);
7077
7110
  }
7078
7111
  };
7079
- zt2.id = "paragraph-bookmark";
7080
- let At = zt2;
7081
- function Bt(t2, e14) {
7112
+ zt.id = "paragraph-bookmark";
7113
+ let At = zt;
7114
+ function Ht(t2, e14) {
7082
7115
  const a3 = t2;
7083
7116
  return false === t2 ? { ...e14, enabled: false } : true === t2 || void 0 === t2 ? { ...e14, enabled: e14.enabled ?? true } : { ...e14, ...a3, enabled: false !== (null == a3 ? void 0 : a3.enabled) };
7084
7117
  }
7085
- function Ht(t2) {
7086
- const e14 = Bt(void 0, { enabled: true }), a3 = Bt(void 0, { enabled: true }), s9 = Bt(void 0, { enabled: true });
7087
- return { markup: e14, bookmarks: a3, notes: s9, zoom: Bt(void 0, { enabled: true, min: 0.5, max: 3, initial: 1 }), selectionToolbar: Bt(false !== e14.enabled || false !== s9.enabled, { enabled: true }) };
7118
+ function Bt(t2) {
7119
+ const e14 = Ht(void 0, { enabled: true }), a3 = Ht(void 0, { enabled: true }), s9 = Ht(void 0, { enabled: true });
7120
+ return { markup: e14, bookmarks: a3, notes: s9, zoom: Ht(void 0, { enabled: true, min: 0.5, max: 3, initial: 1 }), selectionToolbar: Ht(false !== e14.enabled || false !== s9.enabled, { enabled: true }) };
7088
7121
  }
7089
- PdfAnnotationSubtype.HIGHLIGHT, PdfAnnotationSubtype.UNDERLINE, PdfAnnotationSubtype.SQUIGGLY, PdfAnnotationSubtype.STRIKEOUT;
7090
- Ht();
7122
+ PdfAnnotationSubtype.HIGHLIGHT, PdfAnnotationSubtype.UNDERLINE, PdfAnnotationSubtype.SQUIGGLY, PdfAnnotationSubtype.STRIKEOUT, PdfAnnotationSubtype.HIGHLIGHT, PdfAnnotationSubtype.UNDERLINE, PdfAnnotationSubtype.SQUIGGLY, PdfAnnotationSubtype.STRIKEOUT;
7123
+ Bt();
7091
7124
  const se = 1;
7092
7125
  function oe(t2) {
7093
7126
  const e14 = new Uint8Array(t2);
@@ -7232,24 +7265,24 @@ function d(e14) {
7232
7265
  }
7233
7266
  export {
7234
7267
  se as CHAPTER_ANNOTATIONS_ARCHIVE_VERSION,
7235
- xe as CallbackPasswordProvider,
7268
+ ze as CallbackPasswordProvider,
7236
7269
  ChapterManagerPlugin,
7237
7270
  _sfc_main as ChapterPdfViewer,
7238
- Ts as ChapterTreePanel,
7239
- ea as DEFAULT_CHAPTER_VIEWER_CONFIG,
7240
- Jt as DEFAULT_CHAPTER_VIEWER_FEATURES,
7271
+ Es as ChapterTreePanel,
7272
+ ia as DEFAULT_CHAPTER_VIEWER_CONFIG,
7273
+ sa as DEFAULT_CHAPTER_VIEWER_FEATURES,
7241
7274
  EmbedPDF2 as EmbedPDF,
7242
- vs as PdfChapterViewport,
7243
- Ce as applySelectionMarkup,
7275
+ Ms as PdfChapterViewport,
7276
+ Se as applySelectionMarkup,
7244
7277
  d as buildChapterViewerCatalog,
7245
- Ft as buildParagraphBookmarkAnchor,
7278
+ Ht$1 as buildParagraphBookmarkAnchor,
7246
7279
  ge as chapterAnnotationsArchiveToJson,
7247
7280
  me as chapterAnnotationsSnapshotToJson,
7248
7281
  h as chapterDescriptorFromTreeNode,
7249
- oa as createChapterViewerBundle,
7250
- ta as createChapterViewerEditor,
7251
- ra as createChapterViewerEditorOptions,
7252
- Xt as createPdfChapterEditor,
7282
+ ha as createChapterViewerBundle,
7283
+ oa as createChapterViewerEditor,
7284
+ da as createChapterViewerEditorOptions,
7285
+ ta as createPdfChapterEditor,
7253
7286
  t as defaultOverlapStrategy,
7254
7287
  Pe as downloadChapterAnnotationsArchive,
7255
7288
  we as downloadChapterAnnotationsSnapshot,