@embedpdf-editor/vue3-chapter-viewer 0.3.2 → 0.3.4

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,49 +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 = { userSelect: "none", WebkitUserSelect: "none" };
28
- function Pe$1() {
27
+ const be$1 = { position: "relative", height: "100%", width: "100%" }, Pe$1 = { userSelect: "none", WebkitUserSelect: "none" };
28
+ function we$1() {
29
29
  var _a2;
30
30
  "undefined" != typeof window && ((_a2 = window.getSelection()) == null ? void 0 : _a2.removeAllRanges());
31
31
  }
32
- const we$1 = { highlight: { offsetY: 0 }, underline: { offsetY: 2.5 }, squiggly: { offsetY: 0 }, strikeout: { offsetY: 0 } }, ye = { highlight: PdfAnnotationSubtype.HIGHLIGHT, underline: PdfAnnotationSubtype.UNDERLINE, squiggly: PdfAnnotationSubtype.SQUIGGLY, strikeout: PdfAnnotationSubtype.STRIKEOUT };
33
- function Ce(e14, t2) {
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) {
34
34
  return 0 === t2 ? e14 : e14.map((e15) => ({ origin: { x: e15.origin.x, y: e15.origin.y + t2 }, size: { ...e15.size } }));
35
35
  }
36
- function Ie(e14) {
36
+ function Me(e14) {
37
37
  let t2 = 1 / 0, a3 = 1 / 0, s9 = -1 / 0, i2 = -1 / 0;
38
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);
39
39
  return { origin: { x: t2, y: a3 }, size: { width: s9 - t2, height: i2 - a3 } };
40
40
  }
41
- function Me(e14, t2, a3, s9, i2) {
41
+ function Se(e14, t2, a3, s9, i2) {
42
42
  const o = a3.forDocument(e14), r2 = s9.forDocument(e14);
43
43
  if (!o || !r2) return false;
44
44
  const n2 = "highlight" === t2 ? "highlight" : "underline" === t2 ? "underline" : "squiggly" === t2 ? "squiggly" : "strikeout", l = a3.getTool(n2);
45
45
  if (!l) return false;
46
46
  const h2 = l.defaults, d2 = (function(e15, t3) {
47
- return { ...we$1[e15], ...null == t3 ? void 0 : t3[e15] };
47
+ return { ...ye[e15], ...null == t3 ? void 0 : t3[e15] };
48
48
  })(t2, i2), c = r2.getFormattedSelection();
49
49
  if (0 === c.length) return false;
50
50
  o.setLocked({ type: LockModeType.Exclude, categories: ["markup", "shape"] });
51
51
  for (const u of c) {
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 ? Ce(u.segmentRects, r3) : u.segmentRects, l2 = "underline" === t2 || "squiggly" === t2 || "strikeout" === t2 ? Ie(n3) : u.rect;
53
- o.createAnnotation(u.pageIndex, { id: e15, created: /* @__PURE__ */ new Date(), flags: ["print"], type: ye[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 });
54
54
  }
55
55
  return r2.clear(), true;
56
56
  }
57
- function Se(e14, t2) {
57
+ const xe = /* @__PURE__ */ new Set([PdfAnnotationSubtype.HIGHLIGHT, PdfAnnotationSubtype.UNDERLINE, PdfAnnotationSubtype.SQUIGGLY, PdfAnnotationSubtype.STRIKEOUT]);
58
+ function ke(e14, t2) {
58
59
  const a3 = e14;
59
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) };
60
61
  }
61
- function xe(e14) {
62
- const t2 = Se(null == e14 ? void 0 : e14.markup, { enabled: true }), a3 = Se(null == e14 ? void 0 : e14.bookmarks, { enabled: true }), s9 = Se(null == e14 ? void 0 : e14.notes, { enabled: true });
63
- return { markup: t2, bookmarks: a3, notes: s9, zoom: Se(null == e14 ? void 0 : e14.zoom, { enabled: true, min: 0.5, max: 3, initial: 1 }), selectionToolbar: Se(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 }) };
64
65
  }
65
- class Le {
66
+ class ze {
66
67
  constructor(e14) {
67
68
  this.cb = e14;
68
69
  }
@@ -70,9 +71,9 @@ class Le {
70
71
  return this.cb(e14, t2);
71
72
  }
72
73
  }
73
- const Ge = "chapter-manager", Ne = { id: Ge, name: "Chapter Manager Plugin", version: "0.1.0", provides: ["chapter-manager"], requires: ["document-manager"], optional: [], defaultConfig: { manifest: { chapters: [] }, prefetchChapters: 1, unloadTimeoutMs: 6e4, autoActivateOnLoad: true } };
74
- const Ae = { kind: "first-wins" };
75
- function Ve(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) {
76
77
  if (1 === t2.length) return t2[0].chapterId;
77
78
  switch (a3.kind) {
78
79
  case "first-wins":
@@ -90,7 +91,7 @@ function Ve(e14, t2, a3) {
90
91
  return a3.resolve(e14, t2);
91
92
  }
92
93
  }
93
- let _e = class {
94
+ let Re = class {
94
95
  constructor(e14) {
95
96
  this._pages = e14, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
96
97
  for (const t2 of e14) {
@@ -124,8 +125,8 @@ let _e = class {
124
125
  return a3 ? this._pages.indexOf(a3) : -1;
125
126
  }
126
127
  };
127
- function Ee(e14, t2 = Ae) {
128
- const a3 = (function(e15, t3 = Ae) {
128
+ function Fe(e14, t2 = Ee) {
129
+ const a3 = (function(e15, t3 = Ee) {
129
130
  const a4 = /* @__PURE__ */ new Map();
130
131
  for (const i3 of e15.chapters) {
131
132
  const [e16, t4] = i3.globalPageRange;
@@ -135,7 +136,7 @@ function Ee(e14, t2 = Ae) {
135
136
  }
136
137
  }
137
138
  const s10 = /* @__PURE__ */ new Map();
138
- for (const [i3, o2] of a4) s10.set(i3, Ve(i3, o2, t3));
139
+ for (const [i3, o2] of a4) s10.set(i3, _e(i3, o2, t3));
139
140
  return s10;
140
141
  })(e14, t2), s9 = /* @__PURE__ */ new Map();
141
142
  for (const n2 of e14.chapters) s9.set(n2.chapterId, n2);
@@ -147,14 +148,14 @@ function Ee(e14, t2 = Ae) {
147
148
  const [i3] = t3.globalPageRange, [l] = t3.localPageRange, h2 = l + (n2 - i3);
148
149
  o.push({ globalPageIndex: r2++, globalPageNumber: n2, chapterId: e15, localPageIndex: h2 });
149
150
  }
150
- return new _e(o);
151
+ return new Re(o);
151
152
  }
152
- const Re = class e extends BasePlugin {
153
+ const Ue = class e extends BasePlugin {
153
154
  constructor(e14, t2) {
154
- super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = Ae, 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);
155
156
  }
156
157
  async initialize(e14) {
157
- if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? Ae, 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) => {
158
159
  this.isOwnedChapter(e15.id) && (this.passwordAttempts.delete(e15.id), this.updateStatus(e15.id, "loaded"));
159
160
  }), this.documentManager.provides().onDocumentClosed((e15) => {
160
161
  this.isOwnedChapter(e15) && this.updateStatus(e15, "closed");
@@ -189,7 +190,7 @@ const Re = class e extends BasePlugin {
189
190
  const s9 = new Set(this.chapterStatus.keys()), i2 = new Set(t2.chapters.map((e14) => e14.chapterId));
190
191
  for (const e14 of s9) i2.has(e14) || (this.closeChapter(e14), this.chapterStatus.delete(e14));
191
192
  for (const e14 of t2.chapters) this.chapterStatus.has(e14.chapterId) || this.chapterStatus.set(e14.chapterId, "idle");
192
- this.manifest = t2, this.virtualPageMap = Ee(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();
193
194
  }
194
195
  eagerPrefetchFromManifest() {
195
196
  const e14 = this.config.prefetchChapters ?? 0;
@@ -327,11 +328,11 @@ const Re = class e extends BasePlugin {
327
328
  this.chapterStatus.get(e14) !== t2 && (this.chapterStatus.set(e14, t2), this.statusChange$.emit({ chapterId: e14, status: t2, ..."error" === t2 && a3 ? { error: { message: a3 } } : {} }));
328
329
  }
329
330
  };
330
- Re.id = "chapter-manager";
331
- let Fe = Re;
332
- const Ue = { manifest: Ne, create: (e14) => new Fe(Ge, e14), reducer: (e14) => e14, initialState: {} }, qe = "chapter-scroll", We = { id: qe, name: "Chapter Scroll Plugin", version: "0.1.0", provides: ["chapter-scroll"], requires: ["chapter-manager"], optional: [], defaultConfig: { placeholderPageHeight: 1200, placeholderPageWidth: 900, bufferSize: 2, pageGap: 20 } };
333
- const He = { kind: "first-wins" };
334
- function Be(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) {
335
336
  if (1 === t2.length) return t2[0].chapterId;
336
337
  switch (a3.kind) {
337
338
  case "first-wins":
@@ -349,7 +350,7 @@ function Be(e14, t2, a3) {
349
350
  return a3.resolve(e14, t2);
350
351
  }
351
352
  }
352
- let je = class {
353
+ let Ye = class {
353
354
  constructor(e14) {
354
355
  this._pages = e14, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
355
356
  for (const t2 of e14) {
@@ -383,8 +384,8 @@ let je = class {
383
384
  return a3 ? this._pages.indexOf(a3) : -1;
384
385
  }
385
386
  };
386
- function Ze(e14, t2 = He) {
387
- const a3 = (function(e15, t3 = He) {
387
+ function Ke(e14, t2 = je) {
388
+ const a3 = (function(e15, t3 = je) {
388
389
  const a4 = /* @__PURE__ */ new Map();
389
390
  for (const i3 of e15.chapters) {
390
391
  const [e16, t4] = i3.globalPageRange;
@@ -394,7 +395,7 @@ function Ze(e14, t2 = He) {
394
395
  }
395
396
  }
396
397
  const s10 = /* @__PURE__ */ new Map();
397
- for (const [i3, o2] of a4) s10.set(i3, Be(i3, o2, t3));
398
+ for (const [i3, o2] of a4) s10.set(i3, Ze(i3, o2, t3));
398
399
  return s10;
399
400
  })(e14, t2), s9 = /* @__PURE__ */ new Map();
400
401
  for (const n2 of e14.chapters) s9.set(n2.chapterId, n2);
@@ -406,14 +407,14 @@ function Ze(e14, t2 = He) {
406
407
  const [i3] = t3.globalPageRange, [l] = t3.localPageRange, h2 = l + (n2 - i3);
407
408
  o.push({ globalPageIndex: r2++, globalPageNumber: n2, chapterId: e15, localPageIndex: h2 });
408
409
  }
409
- return new je(o);
410
+ return new Ye(o);
410
411
  }
411
- const Ye = class e2 extends BasePlugin {
412
+ const Xe = class e2 extends BasePlugin {
412
413
  constructor(e14, t2) {
413
- super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = He, 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);
414
415
  }
415
416
  async initialize(e14) {
416
- if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? He, 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) => {
417
418
  this.isOwnedChapter(e15.id) && (this.passwordAttempts.delete(e15.id), this.updateStatus(e15.id, "loaded"));
418
419
  }), this.documentManager.provides().onDocumentClosed((e15) => {
419
420
  this.isOwnedChapter(e15) && this.updateStatus(e15, "closed");
@@ -448,7 +449,7 @@ const Ye = class e2 extends BasePlugin {
448
449
  const s9 = new Set(this.chapterStatus.keys()), i2 = new Set(t2.chapters.map((e14) => e14.chapterId));
449
450
  for (const e14 of s9) i2.has(e14) || (this.closeChapter(e14), this.chapterStatus.delete(e14));
450
451
  for (const e14 of t2.chapters) this.chapterStatus.has(e14.chapterId) || this.chapterStatus.set(e14.chapterId, "idle");
451
- this.manifest = t2, this.virtualPageMap = Ze(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();
452
453
  }
453
454
  eagerPrefetchFromManifest() {
454
455
  const e14 = this.config.prefetchChapters ?? 0;
@@ -586,9 +587,9 @@ const Ye = class e2 extends BasePlugin {
586
587
  this.chapterStatus.get(e14) !== t2 && (this.chapterStatus.set(e14, t2), this.statusChange$.emit({ chapterId: e14, status: t2, ..."error" === t2 && a3 ? { error: { message: a3 } } : {} }));
587
588
  }
588
589
  };
589
- Ye.id = "chapter-manager";
590
- let Ke = Ye;
591
- function Xe(e14, t2) {
590
+ Xe.id = "chapter-manager";
591
+ let Qe = Xe;
592
+ function Je(e14, t2) {
592
593
  if (e14 === t2) return true;
593
594
  if (e14.totalHeight !== t2.totalHeight || e14.totalWidth !== t2.totalWidth || e14.pageGap !== t2.pageGap || e14.items.length !== t2.items.length) return false;
594
595
  for (let a3 = 0; a3 < e14.items.length; a3++) {
@@ -597,9 +598,9 @@ function Xe(e14, t2) {
597
598
  }
598
599
  return true;
599
600
  }
600
- const Qe = class extends BasePlugin {
601
+ const et$1 = class et extends BasePlugin {
601
602
  constructor(e14, t2) {
602
- super(e14, t2), this.layoutChange$ = createBehaviorEmitter(void 0, Xe), 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(Ke.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);
603
604
  }
604
605
  async initialize(e14) {
605
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 }) => {
@@ -776,12 +777,12 @@ const Qe = class extends BasePlugin {
776
777
  a3 && this.scrollToIndex(a3.globalPageIndex, t2);
777
778
  }
778
779
  };
779
- Qe.id = "chapter-scroll";
780
- let Je = Qe;
781
- const et$1 = { manifest: We, create: (e14) => new Je(qe, e14), reducer: (e14) => e14, initialState: {} }, tt$1 = "note", at$1 = { id: tt$1, 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: () => {
782
783
  } }, markerSize: 18 } };
783
- const st$1 = { kind: "first-wins" };
784
- function it$1(e14, t2, a3) {
784
+ const ot$1 = { kind: "first-wins" };
785
+ function rt$1(e14, t2, a3) {
785
786
  if (1 === t2.length) return t2[0].chapterId;
786
787
  switch (a3.kind) {
787
788
  case "first-wins":
@@ -799,7 +800,7 @@ function it$1(e14, t2, a3) {
799
800
  return a3.resolve(e14, t2);
800
801
  }
801
802
  }
802
- let ot$1 = class ot {
803
+ let nt$1 = class nt {
803
804
  constructor(e14) {
804
805
  this._pages = e14, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
805
806
  for (const t2 of e14) {
@@ -833,8 +834,8 @@ let ot$1 = class ot {
833
834
  return a3 ? this._pages.indexOf(a3) : -1;
834
835
  }
835
836
  };
836
- function rt$1(e14, t2 = st$1) {
837
- const a3 = (function(e15, t3 = st$1) {
837
+ function lt$1(e14, t2 = ot$1) {
838
+ const a3 = (function(e15, t3 = ot$1) {
838
839
  const a4 = /* @__PURE__ */ new Map();
839
840
  for (const i3 of e15.chapters) {
840
841
  const [e16, t4] = i3.globalPageRange;
@@ -844,7 +845,7 @@ function rt$1(e14, t2 = st$1) {
844
845
  }
845
846
  }
846
847
  const s10 = /* @__PURE__ */ new Map();
847
- for (const [i3, o2] of a4) s10.set(i3, it$1(i3, o2, t3));
848
+ for (const [i3, o2] of a4) s10.set(i3, rt$1(i3, o2, t3));
848
849
  return s10;
849
850
  })(e14, t2), s9 = /* @__PURE__ */ new Map();
850
851
  for (const n2 of e14.chapters) s9.set(n2.chapterId, n2);
@@ -856,14 +857,14 @@ function rt$1(e14, t2 = st$1) {
856
857
  const [i3] = t3.globalPageRange, [l] = t3.localPageRange, h2 = l + (n2 - i3);
857
858
  o.push({ globalPageIndex: r2++, globalPageNumber: n2, chapterId: e15, localPageIndex: h2 });
858
859
  }
859
- return new ot$1(o);
860
+ return new nt$1(o);
860
861
  }
861
- const nt$1 = class e3 extends BasePlugin {
862
+ const ht$1 = class e3 extends BasePlugin {
862
863
  constructor(e14, t2) {
863
- super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = st$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);
864
865
  }
865
866
  async initialize(e14) {
866
- if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? st$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) => {
867
868
  this.isOwnedChapter(e15.id) && (this.passwordAttempts.delete(e15.id), this.updateStatus(e15.id, "loaded"));
868
869
  }), this.documentManager.provides().onDocumentClosed((e15) => {
869
870
  this.isOwnedChapter(e15) && this.updateStatus(e15, "closed");
@@ -898,7 +899,7 @@ const nt$1 = class e3 extends BasePlugin {
898
899
  const s9 = new Set(this.chapterStatus.keys()), i2 = new Set(t2.chapters.map((e14) => e14.chapterId));
899
900
  for (const e14 of s9) i2.has(e14) || (this.closeChapter(e14), this.chapterStatus.delete(e14));
900
901
  for (const e14 of t2.chapters) this.chapterStatus.has(e14.chapterId) || this.chapterStatus.set(e14.chapterId, "idle");
901
- this.manifest = t2, this.virtualPageMap = rt$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();
902
903
  }
903
904
  eagerPrefetchFromManifest() {
904
905
  const e14 = this.config.prefetchChapters ?? 0;
@@ -1036,10 +1037,10 @@ const nt$1 = class e3 extends BasePlugin {
1036
1037
  this.chapterStatus.get(e14) !== t2 && (this.chapterStatus.set(e14, t2), this.statusChange$.emit({ chapterId: e14, status: t2, ..."error" === t2 && a3 ? { error: { message: a3 } } : {} }));
1037
1038
  }
1038
1039
  };
1039
- nt$1.id = "chapter-manager";
1040
- let lt$1 = nt$1;
1041
- const ht$1 = { kind: "first-wins" };
1042
- function dt$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) {
1043
1044
  if (1 === t2.length) return t2[0].chapterId;
1044
1045
  switch (a3.kind) {
1045
1046
  case "first-wins":
@@ -1057,7 +1058,7 @@ function dt$1(e14, t2, a3) {
1057
1058
  return a3.resolve(e14, t2);
1058
1059
  }
1059
1060
  }
1060
- let ct$1 = class ct {
1061
+ let pt = class {
1061
1062
  constructor(e14) {
1062
1063
  this._pages = e14, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
1063
1064
  for (const t2 of e14) {
@@ -1091,8 +1092,8 @@ let ct$1 = class ct {
1091
1092
  return a3 ? this._pages.indexOf(a3) : -1;
1092
1093
  }
1093
1094
  };
1094
- function ut(e14, t2 = ht$1) {
1095
- const a3 = (function(e15, t3 = ht$1) {
1095
+ function gt(e14, t2 = ct$1) {
1096
+ const a3 = (function(e15, t3 = ct$1) {
1096
1097
  const a4 = /* @__PURE__ */ new Map();
1097
1098
  for (const i3 of e15.chapters) {
1098
1099
  const [e16, t4] = i3.globalPageRange;
@@ -1102,7 +1103,7 @@ function ut(e14, t2 = ht$1) {
1102
1103
  }
1103
1104
  }
1104
1105
  const s10 = /* @__PURE__ */ new Map();
1105
- for (const [i3, o2] of a4) s10.set(i3, dt$1(i3, o2, t3));
1106
+ for (const [i3, o2] of a4) s10.set(i3, ut(i3, o2, t3));
1106
1107
  return s10;
1107
1108
  })(e14, t2), s9 = /* @__PURE__ */ new Map();
1108
1109
  for (const n2 of e14.chapters) s9.set(n2.chapterId, n2);
@@ -1114,14 +1115,14 @@ function ut(e14, t2 = ht$1) {
1114
1115
  const [i3] = t3.globalPageRange, [l] = t3.localPageRange, h2 = l + (n2 - i3);
1115
1116
  o.push({ globalPageIndex: r2++, globalPageNumber: n2, chapterId: e15, localPageIndex: h2 });
1116
1117
  }
1117
- return new ct$1(o);
1118
+ return new pt(o);
1118
1119
  }
1119
- const pt = class e4 extends BasePlugin {
1120
+ const ft$1 = class e4 extends BasePlugin {
1120
1121
  constructor(e14, t2) {
1121
- super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = ht$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);
1122
1123
  }
1123
1124
  async initialize(e14) {
1124
- if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? ht$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) => {
1125
1126
  this.isOwnedChapter(e15.id) && (this.passwordAttempts.delete(e15.id), this.updateStatus(e15.id, "loaded"));
1126
1127
  }), this.documentManager.provides().onDocumentClosed((e15) => {
1127
1128
  this.isOwnedChapter(e15) && this.updateStatus(e15, "closed");
@@ -1156,7 +1157,7 @@ const pt = class e4 extends BasePlugin {
1156
1157
  const s9 = new Set(this.chapterStatus.keys()), i2 = new Set(t2.chapters.map((e14) => e14.chapterId));
1157
1158
  for (const e14 of s9) i2.has(e14) || (this.closeChapter(e14), this.chapterStatus.delete(e14));
1158
1159
  for (const e14 of t2.chapters) this.chapterStatus.has(e14.chapterId) || this.chapterStatus.set(e14.chapterId, "idle");
1159
- this.manifest = t2, this.virtualPageMap = ut(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();
1160
1161
  }
1161
1162
  eagerPrefetchFromManifest() {
1162
1163
  const e14 = this.config.prefetchChapters ?? 0;
@@ -1294,9 +1295,9 @@ const pt = class e4 extends BasePlugin {
1294
1295
  this.chapterStatus.get(e14) !== t2 && (this.chapterStatus.set(e14, t2), this.statusChange$.emit({ chapterId: e14, status: t2, ..."error" === t2 && a3 ? { error: { message: a3 } } : {} }));
1295
1296
  }
1296
1297
  };
1297
- pt.id = "chapter-manager";
1298
- let gt = pt;
1299
- function ft$1(e14, t2) {
1298
+ ft$1.id = "chapter-manager";
1299
+ let mt$1 = ft$1;
1300
+ function vt$1(e14, t2) {
1300
1301
  if (e14 === t2) return true;
1301
1302
  if (e14.totalHeight !== t2.totalHeight || e14.totalWidth !== t2.totalWidth || e14.pageGap !== t2.pageGap || e14.items.length !== t2.items.length) return false;
1302
1303
  for (let a3 = 0; a3 < e14.items.length; a3++) {
@@ -1305,9 +1306,9 @@ function ft$1(e14, t2) {
1305
1306
  }
1306
1307
  return true;
1307
1308
  }
1308
- const mt$1 = class mt extends BasePlugin {
1309
+ const bt$1 = class bt extends BasePlugin {
1309
1310
  constructor(e14, t2) {
1310
- super(e14, t2), this.layoutChange$ = createBehaviorEmitter(void 0, ft$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(gt.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);
1311
1312
  }
1312
1313
  async initialize(e14) {
1313
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 }) => {
@@ -1484,11 +1485,11 @@ const mt$1 = class mt extends BasePlugin {
1484
1485
  a3 && this.scrollToIndex(a3.globalPageIndex, t2);
1485
1486
  }
1486
1487
  };
1487
- mt$1.id = "chapter-scroll";
1488
- let vt$1 = mt$1;
1489
- const bt$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 {
1490
1491
  constructor(e14, t2) {
1491
- super(e14, t2), this.notesChange$ = createBehaviorEmitter([]), this.noteActivated$ = createEmitter(), this.notes = /* @__PURE__ */ new Map(), this.chapterScroll = this.registry.getPlugin(vt$1.id), this.chapterManager = this.registry.getPlugin(lt$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);
1492
1493
  }
1493
1494
  async initialize(t2) {
1494
1495
  if (this.config = t2, t2.callbacks.loadNotes) try {
@@ -1526,7 +1527,7 @@ const bt$1 = class e5 extends BasePlugin {
1526
1527
  this.notesChange$.emit(this.listAll());
1527
1528
  }
1528
1529
  buildDraft(e14) {
1529
- return { chapterId: e14.chapterId, localPageIndex: e14.localPageIndex, globalPageNumber: e14.globalPageNumber, globalPageIndex: e14.globalPageIndex, rectsPdfCoord: e14.rectsPdfCoord, endAnchor: wt$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 };
1530
1531
  }
1531
1532
  async requestCreateFromSelection(e14) {
1532
1533
  if (0 === e14.rectsPdfCoord.length) return null;
@@ -1593,15 +1594,15 @@ const bt$1 = class e5 extends BasePlugin {
1593
1594
  });
1594
1595
  }
1595
1596
  };
1596
- bt$1.id = "note";
1597
- let Pt$1 = bt$1;
1598
- function wt$1(e14) {
1597
+ wt$1.id = "note";
1598
+ let yt$1 = wt$1;
1599
+ function Ct$1(e14) {
1599
1600
  const t2 = e14[e14.length - 1];
1600
1601
  return { x: t2.origin.x + t2.size.width, y: t2.origin.y + t2.size.height };
1601
1602
  }
1602
- const yt$1 = { manifest: at$1, create: (e14) => new Pt$1(tt$1, e14), reducer: (e14) => e14, initialState: {} }, Ct$1 = "paragraph-bookmark", It$1 = { id: Ct$1, name: "Paragraph Bookmark Plugin", version: "0.1.0", provides: ["paragraph-bookmark"], requires: ["chapter-scroll", "chapter-manager"], optional: [], defaultConfig: {} };
1603
- const Mt$1 = { kind: "first-wins" };
1604
- function St$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) {
1605
1606
  if (1 === t2.length) return t2[0].chapterId;
1606
1607
  switch (a3.kind) {
1607
1608
  case "first-wins":
@@ -1619,7 +1620,7 @@ function St$1(e14, t2, a3) {
1619
1620
  return a3.resolve(e14, t2);
1620
1621
  }
1621
1622
  }
1622
- let xt$1 = class xt {
1623
+ let Lt$1 = class Lt {
1623
1624
  constructor(e14) {
1624
1625
  this._pages = e14, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
1625
1626
  for (const t2 of e14) {
@@ -1653,8 +1654,8 @@ let xt$1 = class xt {
1653
1654
  return a3 ? this._pages.indexOf(a3) : -1;
1654
1655
  }
1655
1656
  };
1656
- function kt$1(e14, t2 = Mt$1) {
1657
- const a3 = (function(e15, t3 = Mt$1) {
1657
+ function $t$1(e14, t2 = xt$1) {
1658
+ const a3 = (function(e15, t3 = xt$1) {
1658
1659
  const a4 = /* @__PURE__ */ new Map();
1659
1660
  for (const i3 of e15.chapters) {
1660
1661
  const [e16, t4] = i3.globalPageRange;
@@ -1664,7 +1665,7 @@ function kt$1(e14, t2 = Mt$1) {
1664
1665
  }
1665
1666
  }
1666
1667
  const s10 = /* @__PURE__ */ new Map();
1667
- for (const [i3, o2] of a4) s10.set(i3, St$1(i3, o2, t3));
1668
+ for (const [i3, o2] of a4) s10.set(i3, kt$1(i3, o2, t3));
1668
1669
  return s10;
1669
1670
  })(e14, t2), s9 = /* @__PURE__ */ new Map();
1670
1671
  for (const n2 of e14.chapters) s9.set(n2.chapterId, n2);
@@ -1676,14 +1677,14 @@ function kt$1(e14, t2 = Mt$1) {
1676
1677
  const [i3] = t3.globalPageRange, [l] = t3.localPageRange, h2 = l + (n2 - i3);
1677
1678
  o.push({ globalPageIndex: r2++, globalPageNumber: n2, chapterId: e15, localPageIndex: h2 });
1678
1679
  }
1679
- return new xt$1(o);
1680
+ return new Lt$1(o);
1680
1681
  }
1681
- const Lt$1 = class e6 extends BasePlugin {
1682
+ const zt$1 = class e6 extends BasePlugin {
1682
1683
  constructor(e14, t2) {
1683
- super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = Mt$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);
1684
1685
  }
1685
1686
  async initialize(e14) {
1686
- if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? Mt$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) => {
1687
1688
  this.isOwnedChapter(e15.id) && (this.passwordAttempts.delete(e15.id), this.updateStatus(e15.id, "loaded"));
1688
1689
  }), this.documentManager.provides().onDocumentClosed((e15) => {
1689
1690
  this.isOwnedChapter(e15) && this.updateStatus(e15, "closed");
@@ -1718,7 +1719,7 @@ const Lt$1 = class e6 extends BasePlugin {
1718
1719
  const s9 = new Set(this.chapterStatus.keys()), i2 = new Set(t2.chapters.map((e14) => e14.chapterId));
1719
1720
  for (const e14 of s9) i2.has(e14) || (this.closeChapter(e14), this.chapterStatus.delete(e14));
1720
1721
  for (const e14 of t2.chapters) this.chapterStatus.has(e14.chapterId) || this.chapterStatus.set(e14.chapterId, "idle");
1721
- this.manifest = t2, this.virtualPageMap = kt$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();
1722
1723
  }
1723
1724
  eagerPrefetchFromManifest() {
1724
1725
  const e14 = this.config.prefetchChapters ?? 0;
@@ -1856,10 +1857,10 @@ const Lt$1 = class e6 extends BasePlugin {
1856
1857
  this.chapterStatus.get(e14) !== t2 && (this.chapterStatus.set(e14, t2), this.statusChange$.emit({ chapterId: e14, status: t2, ..."error" === t2 && a3 ? { error: { message: a3 } } : {} }));
1857
1858
  }
1858
1859
  };
1859
- Lt$1.id = "chapter-manager";
1860
- let $t$1 = Lt$1;
1861
- const zt$1 = { kind: "first-wins" };
1862
- function Tt$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) {
1863
1864
  if (1 === t2.length) return t2[0].chapterId;
1864
1865
  switch (a3.kind) {
1865
1866
  case "first-wins":
@@ -1877,7 +1878,7 @@ function Tt$1(e14, t2, a3) {
1877
1878
  return a3.resolve(e14, t2);
1878
1879
  }
1879
1880
  }
1880
- let Dt$1 = class Dt {
1881
+ let Gt$1 = class Gt {
1881
1882
  constructor(e14) {
1882
1883
  this._pages = e14, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
1883
1884
  for (const t2 of e14) {
@@ -1911,8 +1912,8 @@ let Dt$1 = class Dt {
1911
1912
  return a3 ? this._pages.indexOf(a3) : -1;
1912
1913
  }
1913
1914
  };
1914
- function Ot$1(e14, t2 = zt$1) {
1915
- const a3 = (function(e15, t3 = zt$1) {
1915
+ function Nt(e14, t2 = Dt$1) {
1916
+ const a3 = (function(e15, t3 = Dt$1) {
1916
1917
  const a4 = /* @__PURE__ */ new Map();
1917
1918
  for (const i3 of e15.chapters) {
1918
1919
  const [e16, t4] = i3.globalPageRange;
@@ -1922,7 +1923,7 @@ function Ot$1(e14, t2 = zt$1) {
1922
1923
  }
1923
1924
  }
1924
1925
  const s10 = /* @__PURE__ */ new Map();
1925
- for (const [i3, o2] of a4) s10.set(i3, Tt$1(i3, o2, t3));
1926
+ for (const [i3, o2] of a4) s10.set(i3, Ot$1(i3, o2, t3));
1926
1927
  return s10;
1927
1928
  })(e14, t2), s9 = /* @__PURE__ */ new Map();
1928
1929
  for (const n2 of e14.chapters) s9.set(n2.chapterId, n2);
@@ -1934,14 +1935,14 @@ function Ot$1(e14, t2 = zt$1) {
1934
1935
  const [i3] = t3.globalPageRange, [l] = t3.localPageRange, h2 = l + (n2 - i3);
1935
1936
  o.push({ globalPageIndex: r2++, globalPageNumber: n2, chapterId: e15, localPageIndex: h2 });
1936
1937
  }
1937
- return new Dt$1(o);
1938
+ return new Gt$1(o);
1938
1939
  }
1939
- const Gt$1 = class e7 extends BasePlugin {
1940
+ const At$1 = class e7 extends BasePlugin {
1940
1941
  constructor(e14, t2) {
1941
- super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = zt$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);
1942
1943
  }
1943
1944
  async initialize(e14) {
1944
- if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? zt$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) => {
1945
1946
  this.isOwnedChapter(e15.id) && (this.passwordAttempts.delete(e15.id), this.updateStatus(e15.id, "loaded"));
1946
1947
  }), this.documentManager.provides().onDocumentClosed((e15) => {
1947
1948
  this.isOwnedChapter(e15) && this.updateStatus(e15, "closed");
@@ -1976,7 +1977,7 @@ const Gt$1 = class e7 extends BasePlugin {
1976
1977
  const s9 = new Set(this.chapterStatus.keys()), i2 = new Set(t2.chapters.map((e14) => e14.chapterId));
1977
1978
  for (const e14 of s9) i2.has(e14) || (this.closeChapter(e14), this.chapterStatus.delete(e14));
1978
1979
  for (const e14 of t2.chapters) this.chapterStatus.has(e14.chapterId) || this.chapterStatus.set(e14.chapterId, "idle");
1979
- this.manifest = t2, this.virtualPageMap = Ot$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();
1980
1981
  }
1981
1982
  eagerPrefetchFromManifest() {
1982
1983
  const e14 = this.config.prefetchChapters ?? 0;
@@ -2114,9 +2115,9 @@ const Gt$1 = class e7 extends BasePlugin {
2114
2115
  this.chapterStatus.get(e14) !== t2 && (this.chapterStatus.set(e14, t2), this.statusChange$.emit({ chapterId: e14, status: t2, ..."error" === t2 && a3 ? { error: { message: a3 } } : {} }));
2115
2116
  }
2116
2117
  };
2117
- Gt$1.id = "chapter-manager";
2118
- let Nt = Gt$1;
2119
- function At$1(e14, t2) {
2118
+ At$1.id = "chapter-manager";
2119
+ let Vt = At$1;
2120
+ function Et(e14, t2) {
2120
2121
  if (e14 === t2) return true;
2121
2122
  if (e14.totalHeight !== t2.totalHeight || e14.totalWidth !== t2.totalWidth || e14.pageGap !== t2.pageGap || e14.items.length !== t2.items.length) return false;
2122
2123
  for (let a3 = 0; a3 < e14.items.length; a3++) {
@@ -2125,9 +2126,9 @@ function At$1(e14, t2) {
2125
2126
  }
2126
2127
  return true;
2127
2128
  }
2128
- const Vt = class extends BasePlugin {
2129
+ const _t = class extends BasePlugin {
2129
2130
  constructor(e14, t2) {
2130
- super(e14, t2), this.layoutChange$ = createBehaviorEmitter(void 0, At$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(Nt.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);
2131
2132
  }
2132
2133
  async initialize(e14) {
2133
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 }) => {
@@ -2304,41 +2305,41 @@ const Vt = class extends BasePlugin {
2304
2305
  a3 && this.scrollToIndex(a3.globalPageIndex, t2);
2305
2306
  }
2306
2307
  };
2307
- Vt.id = "chapter-scroll";
2308
- let _t = Vt;
2309
- function Et(e14) {
2308
+ _t.id = "chapter-scroll";
2309
+ let Rt = _t;
2310
+ function Ft(e14) {
2310
2311
  if (0 === e14.length) throw new Error("unionRects: empty rects");
2311
2312
  let t2 = 1 / 0, a3 = 1 / 0, s9 = -1 / 0, i2 = -1 / 0;
2312
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);
2313
2314
  return { origin: { x: t2, y: a3 }, size: { width: s9 - t2, height: i2 - a3 } };
2314
2315
  }
2315
- function Rt(e14) {
2316
+ function Ut(e14) {
2316
2317
  const t2 = e14[e14.length - 1];
2317
2318
  return { x: t2.origin.x + t2.size.width, y: t2.origin.y + t2.size.height };
2318
2319
  }
2319
- function Ft(e14, t2) {
2320
+ function qt(e14, t2) {
2320
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);
2321
2322
  if (r2 <= 0) return 0;
2322
2323
  return Math.max(0, Math.min(s9, o) - Math.max(a3, i2)) / r2;
2323
2324
  }
2324
- function Ut(e14, t2) {
2325
+ function Wt(e14, t2) {
2325
2326
  var a3, s9;
2326
2327
  if (e14.chapterId !== t2.chapterId || e14.localPageIndex !== t2.localPageIndex) return false;
2327
- 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 ?? Rt(i2), n2 = t2.markerAnchor ?? Rt(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);
2328
2329
  if (Math.hypot(r2.x - n2.x, r2.y - n2.y) <= 6) return true;
2329
2330
  for (const l of i2) for (const e15 of o) {
2330
- if (Ft(l, e15) < 0.5) continue;
2331
+ if (qt(l, e15) < 0.5) continue;
2331
2332
  const t3 = Math.max(l.origin.x, e15.origin.x);
2332
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;
2333
2334
  }
2334
2335
  return false;
2335
2336
  }
2336
- function qt(e14, t2, a3, s9) {
2337
+ function Ht$1(e14, t2, a3, s9) {
2337
2338
  const i2 = a3.length > 0 ? a3 : [];
2338
2339
  if (0 === i2.length) throw new Error("buildParagraphBookmarkAnchor: no rects");
2339
- return { chapterId: e14, localPageIndex: t2, globalPageIndex: null == s9 ? void 0 : s9.globalPageIndex, globalPageNumber: null == s9 ? void 0 : s9.globalPageNumber, rectPdfCoord: Et(i2), rectsPdfCoord: i2, markerAnchor: Rt(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) };
2340
2341
  }
2341
- async function Wt(e14, t2, a3) {
2342
+ async function Bt$1(e14, t2, a3) {
2342
2343
  e14.scrollToGlobalPageIndex(t2), await (function(e15, t3, a4 = 2500) {
2343
2344
  const s9 = e15.getLayout().items.find((e16) => e16.globalPageIndex === t3 && !e16.isPlaceholder);
2344
2345
  return s9 ? Promise.resolve(s9) : new Promise((s10) => {
@@ -2351,9 +2352,9 @@ async function Wt(e14, t2, a3) {
2351
2352
  });
2352
2353
  })(e14, t2), e14.scrollToGlobalPdfPoint(t2, a3, { marginTop: 80 });
2353
2354
  }
2354
- const Ht$1 = class e8 extends BasePlugin {
2355
+ const jt = class e8 extends BasePlugin {
2355
2356
  constructor(e14, t2) {
2356
- super(e14, t2), this.change$ = createBehaviorEmitter([]), this.entries = /* @__PURE__ */ new Map(), this.chapterScroll = this.registry.getPlugin(_t.id), this.chapterManager = this.registry.getPlugin($t$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);
2357
2358
  }
2358
2359
  async initialize(t2) {
2359
2360
  var a3;
@@ -2369,7 +2370,7 @@ const Ht$1 = class e8 extends BasePlugin {
2369
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 };
2370
2371
  }
2371
2372
  addBookmark(e14) {
2372
- for (const s9 of this.entries.values()) if (Ut(s9.anchor, e14.anchor)) return s9;
2373
+ for (const s9 of this.entries.values()) if (Wt(s9.anchor, e14.anchor)) return s9;
2373
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() };
2374
2375
  return this.entries.set(t2, a3), this.notifyAndPersist(), a3;
2375
2376
  }
@@ -2425,13 +2426,13 @@ const Ht$1 = class e8 extends BasePlugin {
2425
2426
  const t3 = e15.rectPdfCoord;
2426
2427
  return t3.origin.y + t3.size.height;
2427
2428
  })(t2.anchor);
2428
- await Wt(a3, s9, i2);
2429
+ await Bt$1(a3, s9, i2);
2429
2430
  }
2430
2431
  };
2431
- Ht$1.id = "paragraph-bookmark";
2432
- let Bt$1 = Ht$1;
2433
- const jt = { manifest: It$1, create: (e14) => new Bt$1(Ct$1, e14), reducer: (e14) => e14, initialState: {} }, Zt = { "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 }] } };
2434
- class Yt {
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 {
2435
2436
  constructor() {
2436
2437
  this.specs = [];
2437
2438
  }
@@ -2446,17 +2447,17 @@ class Yt {
2446
2447
  return this.specs;
2447
2448
  }
2448
2449
  buildToolbars() {
2449
- const e14 = structuredClone(Zt);
2450
+ const e14 = structuredClone(Kt);
2450
2451
  for (const t2 of this.specs) {
2451
2452
  const a3 = e14[t2.toolbarSlot];
2452
2453
  if (!a3) continue;
2453
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 ?? [] };
2454
- a3.items = Kt(a3.items, s9, t2.position);
2455
+ a3.items = Qt(a3.items, s9, t2.position);
2455
2456
  }
2456
2457
  return e14;
2457
2458
  }
2458
2459
  }
2459
- function Kt(e14, t2, a3) {
2460
+ function Qt(e14, t2, a3) {
2460
2461
  return (null == a3 ? void 0 : a3.after) || (null == a3 ? void 0 : a3.before) ? (function(e15, t3, a4) {
2461
2462
  const s9 = (e16) => {
2462
2463
  const i2 = [];
@@ -2468,8 +2469,8 @@ function Kt(e14, t2, a3) {
2468
2469
  return e15.map((e16) => "group" === e16.type ? { ...e16, items: [...e16.items, t3] } : e16);
2469
2470
  })(e14, t2);
2470
2471
  }
2471
- const Xt = { annotate: "annotation-toolbar", shapes: "shapes-toolbar", insert: "insert-toolbar", form: "form-toolbar", redact: "redaction-toolbar" };
2472
- function Qt() {
2472
+ const Jt = { annotate: "annotation-toolbar", shapes: "shapes-toolbar", insert: "insert-toolbar", form: "form-toolbar", redact: "redaction-toolbar" };
2473
+ function ea() {
2473
2474
  return { "mode:view": { id: "mode:view", label: "View", categories: ["mode", "mode-view"], action: ({ registry: e14, documentId: t2 }) => {
2474
2475
  var _a2, _b, _c, _d;
2475
2476
  const a3 = (_a2 = e14.getPlugin("ui")) == null ? void 0 : _a2.provides(), s9 = (_b = e14.getPlugin("interaction-manager")) == null ? void 0 : _b.provides();
@@ -2496,16 +2497,16 @@ function Qt() {
2496
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"] }));
2497
2498
  }, active: ({ state: e14, documentId: t2 }) => isToolbarOpen(e14.plugins, t2, "top", "secondary", "redaction-toolbar") } };
2498
2499
  }
2499
- function Jt(e14) {
2500
+ function ta(e14) {
2500
2501
  var _a2, _b, _c, _d, _e2, _f;
2501
2502
  const t2 = e14.toolbar ?? {}, a3 = t2.enabledModes ?? ["view", "annotate", "shapes", "insert", "form", "redact"], s9 = a3.length > 0, { schema: i2, operationRegistry: o } = (function(e15 = {}) {
2502
2503
  var t3, a4, s10, i3, o2, r3;
2503
- const n3 = new Set(e15.enabledModes ?? ["view", "annotate", "shapes", "insert", "form", "redact"]), l = new Yt();
2504
+ const n3 = new Set(e15.enabledModes ?? ["view", "annotate", "shapes", "insert", "form", "redact"]), l = new Xt();
2504
2505
  (null == (t3 = e15.customOperations) ? void 0 : t3.length) && l.registerAll(e15.customOperations);
2505
2506
  const h2 = l.buildToolbars(), d2 = {};
2506
2507
  for (const u of n3) {
2507
2508
  if ("view" === u) continue;
2508
- const e16 = Xt[u];
2509
+ const e16 = Jt[u];
2509
2510
  h2[e16] && (d2[e16] = h2[e16]);
2510
2511
  }
2511
2512
  const c = (function(e16) {
@@ -2514,10 +2515,10 @@ function Jt(e14) {
2514
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 }] };
2515
2516
  })(n3);
2516
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 };
2517
- })({ ...t2, enabledModes: a3 }), r2 = { ...s9 ? Qt() : {}, ...s9 ? ea(o.list()) : {}, ...e14.commands ?? {} }, n2 = [createPluginRegistration(DocumentManagerPluginPackage, { initialDocuments: [] }), createPluginRegistration(Ue, { manifest: e14.manifest, overlapStrategy: e14.overlapStrategy, passwordProvider: e14.passwordProvider, chapterPdfLoader: e14.chapterPdfLoader, prefetchChapters: e14.prefetchChapters, unloadTimeoutMs: e14.unloadTimeoutMs }), createPluginRegistration(et$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 })] : []];
2518
- return e14.notes && n2.push(createPluginRegistration(yt$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(jt, { 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 };
2519
2520
  }
2520
- function ea(e14) {
2521
+ function aa(e14) {
2521
2522
  const t2 = {};
2522
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 }) => {
2523
2524
  var _a2;
@@ -2525,33 +2526,33 @@ function ea(e14) {
2525
2526
  } });
2526
2527
  return t2;
2527
2528
  }
2528
- const ta = xe(), aa = {};
2529
- function sa(e14) {
2530
- return Jt({ ...e14, toolbar: e14.toolbar ?? { enabledModes: [] }, features: xe(e14.features) });
2531
- }
2532
- const ia = { overlapStrategy: { kind: "first-wins" }, passwordProvider: new Le(async () => null), prefetchChapters: 1, loadDefaultStampLibrary: false, unloadTimeoutMs: 12e4, toolbar: { enabledModes: [] } };
2529
+ const sa = Le(), ia = {};
2533
2530
  function oa(e14) {
2531
+ return ta({ ...e14, toolbar: e14.toolbar ?? { enabledModes: [] }, features: Le(e14.features) });
2532
+ }
2533
+ const ra = { overlapStrategy: { kind: "first-wins" }, passwordProvider: new ze(async () => null), prefetchChapters: 1, loadDefaultStampLibrary: false, unloadTimeoutMs: 12e4, toolbar: { enabledModes: [] } };
2534
+ function na(e14) {
2534
2535
  return (function(e15) {
2535
2536
  return "callbacks" in e15.notes;
2536
2537
  })(e14) ? { manifest: e14.manifest, chapterPdfLoader: e14.chapterPdfLoader, notes: e14.notes.callbacks, bookmarks: e14.bookmarks.callbacks } : e14;
2537
2538
  }
2538
- function ra(e14) {
2539
- return { ...ia, manifest: e14.manifest, chapterPdfLoader: e14.chapterPdfLoader, overlapStrategy: e14.overlapStrategy ?? ia.overlapStrategy, notes: { callbacks: e14.notes }, bookmarks: { callbacks: e14.bookmarks }, features: xe(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) };
2540
2541
  }
2541
- function na(e14) {
2542
- const t2 = ra(oa(e14)), { plugins: a3 } = sa(t2);
2542
+ function ha(e14) {
2543
+ const t2 = la(na(e14)), { plugins: a3 } = oa(t2);
2543
2544
  return { plugins: a3, features: t2.features, editorOptions: t2 };
2544
2545
  }
2545
- function la(e14) {
2546
- const { features: t2, ...a3 } = ra(oa(e14));
2546
+ function da(e14) {
2547
+ const { features: t2, ...a3 } = la(na(e14));
2547
2548
  return a3;
2548
2549
  }
2549
- function ha(e14, t2 = 0.5, a3 = 3) {
2550
+ function ca(e14, t2 = 0.5, a3 = 3) {
2550
2551
  return Math.min(a3, Math.max(t2, e14));
2551
2552
  }
2552
- function da(i2, o) {
2553
+ function ua(i2, o) {
2553
2554
  var _a2;
2554
- const r2 = isRef(i2) ? i2 : computed(() => i2), { registry: n2 } = useRegistry(), { provides: l } = useCapability(DocumentManagerPlugin.id), { provides: h2 } = useCapability(Fe.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 = () => {
2555
2556
  var _a3;
2556
2557
  return ((_a3 = o.value) == null ? void 0 : _a3.min) ?? 0.5;
2557
2558
  }, p2 = () => {
@@ -2562,11 +2563,11 @@ function da(i2, o) {
2562
2563
  return (_a3 = o.value) == null ? void 0 : _a3.pageWidth;
2563
2564
  };
2564
2565
  function f(e14) {
2565
- const t2 = ha(e14, u(), p2());
2566
+ const t2 = ca(e14, u(), p2());
2566
2567
  c.value = t2, d2.value = t2, (function(e15, t3, a3, s9 = 0.5, i3 = 3) {
2567
2568
  const o2 = e15 == null ? void 0 : e15.getStore();
2568
2569
  if (!o2) return;
2569
- const r3 = ha(a3, s9, i3);
2570
+ const r3 = ca(a3, s9, i3);
2570
2571
  o2.dispatchToCore(setDefaultScale(r3));
2571
2572
  for (const n3 of t3.chapters) o2.getState().core.documents[n3.chapterId] && o2.dispatchToCore(setScale(r3, n3.chapterId));
2572
2573
  })(n2.value, r2.value, t2, u(), p2());
@@ -2608,10 +2609,10 @@ function da(i2, o) {
2608
2609
  return false !== ((_a3 = o.value) == null ? void 0 : _a3.enabled);
2609
2610
  }, minZoom: u, maxZoom: p2 };
2610
2611
  }
2611
- function ca(e14, t2, a3) {
2612
+ function pa(e14, t2, a3) {
2612
2613
  return Math.min(a3, Math.max(t2, e14));
2613
2614
  }
2614
- function ua(e14, t2) {
2615
+ function ga(e14, t2) {
2615
2616
  if (!e14 || false === t2.enabled) return () => {
2616
2617
  };
2617
2618
  let a3 = null, s9 = null, i2 = 0;
@@ -2620,7 +2621,7 @@ function ua(e14, t2) {
2620
2621
  return !!s10 && (a3 == null ? void 0 : a3(), a3 = (function({ container: e15, getScale: t3, setScale: a4, minZoom: s11 = 0.5, maxZoom: i3 = 3 }) {
2621
2622
  let o2 = 0, r2 = 1, n2 = null, l = 1, h2 = 1;
2622
2623
  const d2 = (e16) => {
2623
- (e16.ctrlKey || e16.metaKey) && (e16.preventDefault(), null === n2 ? (h2 = t3(), l = 1) : clearTimeout(n2), l *= 1 - 0.01 * e16.deltaY, l = ca(l, 0.1, 10), a4(ca(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(() => {
2624
2625
  n2 = null;
2625
2626
  }, 120));
2626
2627
  }, c = /* @__PURE__ */ new Map(), u = (e16) => {
@@ -2632,7 +2633,7 @@ function ua(e14, t2) {
2632
2633
  if (c.has(e16.pointerId) && (c.set(e16.pointerId, { x: e16.clientX, y: e16.clientY }), 2 === c.size && o2 > 0)) {
2633
2634
  e16.preventDefault();
2634
2635
  const [t4, n3] = [...c.values()], l2 = Math.hypot(n3.x - t4.x, n3.y - t4.y);
2635
- a4(ca(r2 * (l2 / o2), s11, i3));
2636
+ a4(pa(r2 * (l2 / o2), s11, i3));
2636
2637
  }
2637
2638
  }, g2 = (e16) => {
2638
2639
  c.delete(e16.pointerId), c.size < 2 && (o2 = 0);
@@ -2648,26 +2649,26 @@ function ua(e14, t2) {
2648
2649
  i2 && cancelAnimationFrame(i2), s9 == null ? void 0 : s9.disconnect(), a3 == null ? void 0 : a3();
2649
2650
  };
2650
2651
  }
2651
- const pa = { chapters: [] };
2652
- function ga(e14) {
2653
- const o = ref(null), { provides: r2 } = useCapability(Fe.id), n2 = computed(() => {
2652
+ const fa = { chapters: [] };
2653
+ function ma(e14) {
2654
+ const o = ref(null), { provides: r2 } = useCapability(qe.id), n2 = computed(() => {
2654
2655
  var _a2;
2655
- return ((_a2 = r2.value) == null ? void 0 : _a2.getManifest()) ?? pa;
2656
+ return ((_a2 = r2.value) == null ? void 0 : _a2.getManifest()) ?? fa;
2656
2657
  }), l = computed(() => {
2657
2658
  var _a2;
2658
2659
  return (_a2 = e14.value) == null ? void 0 : _a2.zoom;
2659
- }), { scale: h2, setScale: d2, zoomEnabled: c, minZoom: u, maxZoom: p2 } = da(n2, l);
2660
+ }), { scale: h2, setScale: d2, zoomEnabled: c, minZoom: u, maxZoom: p2 } = ua(n2, l);
2660
2661
  return (function(e15, t2) {
2661
2662
  let a3 = null;
2662
2663
  watch([e15, t2], () => {
2663
2664
  a3 == null ? void 0 : a3();
2664
2665
  const s9 = t2.value;
2665
- a3 = ua(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 });
2666
2667
  }, { deep: true, flush: "post" }), onBeforeUnmount(() => a3 == null ? void 0 : a3());
2667
2668
  })(o, computed(() => ({ enabled: c(), getScale: () => h2.value, setScale: d2, minZoom: u(), maxZoom: p2() }))), { hostRef: o, scale: h2, setScale: d2, zoomEnabled: c };
2668
2669
  }
2669
- const fa = { kind: "first-wins" };
2670
- function ma(e14, t2, a3) {
2670
+ const va = { kind: "first-wins" };
2671
+ function ba(e14, t2, a3) {
2671
2672
  if (1 === t2.length) return t2[0].chapterId;
2672
2673
  switch (a3.kind) {
2673
2674
  case "first-wins":
@@ -2685,7 +2686,7 @@ function ma(e14, t2, a3) {
2685
2686
  return a3.resolve(e14, t2);
2686
2687
  }
2687
2688
  }
2688
- class va {
2689
+ class Pa {
2689
2690
  constructor(e14) {
2690
2691
  this._pages = e14, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
2691
2692
  for (const t2 of e14) {
@@ -2719,8 +2720,8 @@ class va {
2719
2720
  return a3 ? this._pages.indexOf(a3) : -1;
2720
2721
  }
2721
2722
  }
2722
- function ba(e14, t2 = fa) {
2723
- const a3 = (function(e15, t3 = fa) {
2723
+ function wa(e14, t2 = va) {
2724
+ const a3 = (function(e15, t3 = va) {
2724
2725
  const a4 = /* @__PURE__ */ new Map();
2725
2726
  for (const i3 of e15.chapters) {
2726
2727
  const [e16, t4] = i3.globalPageRange;
@@ -2730,7 +2731,7 @@ function ba(e14, t2 = fa) {
2730
2731
  }
2731
2732
  }
2732
2733
  const s10 = /* @__PURE__ */ new Map();
2733
- for (const [i3, o2] of a4) s10.set(i3, ma(i3, o2, t3));
2734
+ for (const [i3, o2] of a4) s10.set(i3, ba(i3, o2, t3));
2734
2735
  return s10;
2735
2736
  })(e14, t2), s9 = /* @__PURE__ */ new Map();
2736
2737
  for (const n2 of e14.chapters) s9.set(n2.chapterId, n2);
@@ -2742,14 +2743,14 @@ function ba(e14, t2 = fa) {
2742
2743
  const [i3] = t3.globalPageRange, [l] = t3.localPageRange, h2 = l + (n2 - i3);
2743
2744
  o.push({ globalPageIndex: r2++, globalPageNumber: n2, chapterId: e15, localPageIndex: h2 });
2744
2745
  }
2745
- return new va(o);
2746
+ return new Pa(o);
2746
2747
  }
2747
- const Pa = class e9 extends BasePlugin {
2748
+ const ya = class e9 extends BasePlugin {
2748
2749
  constructor(e14, t2) {
2749
- super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = fa, 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);
2750
2751
  }
2751
2752
  async initialize(e14) {
2752
- if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? fa, 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) => {
2753
2754
  this.isOwnedChapter(e15.id) && (this.passwordAttempts.delete(e15.id), this.updateStatus(e15.id, "loaded"));
2754
2755
  }), this.documentManager.provides().onDocumentClosed((e15) => {
2755
2756
  this.isOwnedChapter(e15) && this.updateStatus(e15, "closed");
@@ -2784,7 +2785,7 @@ const Pa = class e9 extends BasePlugin {
2784
2785
  const s9 = new Set(this.chapterStatus.keys()), i2 = new Set(t2.chapters.map((e14) => e14.chapterId));
2785
2786
  for (const e14 of s9) i2.has(e14) || (this.closeChapter(e14), this.chapterStatus.delete(e14));
2786
2787
  for (const e14 of t2.chapters) this.chapterStatus.has(e14.chapterId) || this.chapterStatus.set(e14.chapterId, "idle");
2787
- this.manifest = t2, this.virtualPageMap = ba(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();
2788
2789
  }
2789
2790
  eagerPrefetchFromManifest() {
2790
2791
  const e14 = this.config.prefetchChapters ?? 0;
@@ -2922,9 +2923,9 @@ const Pa = class e9 extends BasePlugin {
2922
2923
  this.chapterStatus.get(e14) !== t2 && (this.chapterStatus.set(e14, t2), this.statusChange$.emit({ chapterId: e14, status: t2, ..."error" === t2 && a3 ? { error: { message: a3 } } : {} }));
2923
2924
  }
2924
2925
  };
2925
- Pa.id = "chapter-manager";
2926
- let wa = Pa;
2927
- function ya(e14, t2) {
2926
+ ya.id = "chapter-manager";
2927
+ let Ca = ya;
2928
+ function Ia(e14, t2) {
2928
2929
  if (e14 === t2) return true;
2929
2930
  if (e14.totalHeight !== t2.totalHeight || e14.totalWidth !== t2.totalWidth || e14.pageGap !== t2.pageGap || e14.items.length !== t2.items.length) return false;
2930
2931
  for (let a3 = 0; a3 < e14.items.length; a3++) {
@@ -2933,9 +2934,9 @@ function ya(e14, t2) {
2933
2934
  }
2934
2935
  return true;
2935
2936
  }
2936
- const Ca = class extends BasePlugin {
2937
+ const Ma = class extends BasePlugin {
2937
2938
  constructor(e14, t2) {
2938
- super(e14, t2), this.layoutChange$ = createBehaviorEmitter(void 0, ya), 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(wa.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);
2939
2940
  }
2940
2941
  async initialize(e14) {
2941
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 }) => {
@@ -3112,14 +3113,14 @@ const Ca = class extends BasePlugin {
3112
3113
  a3 && this.scrollToIndex(a3.globalPageIndex, t2);
3113
3114
  }
3114
3115
  };
3115
- Ca.id = "chapter-scroll";
3116
- let Ia = Ca;
3117
- const Ma = ["data-global-page-index", "data-chapter-id", "data-local-page-index"], Sa = /* @__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) => {
3118
3119
  const a3 = e14.__vccOpts || e14;
3119
3120
  for (const [s9, i2] of t2) a3[s9] = i2;
3120
3121
  return a3;
3121
3122
  })(/* @__PURE__ */ defineComponent({ __name: "ChapterScroller", props: { class: {}, style: {} }, setup(e14) {
3122
- const { provides: t2 } = useCapability(Ia.id), o = ref(null), f = ref(null);
3123
+ const { provides: t2 } = useCapability(Sa.id), o = ref(null), f = ref(null);
3123
3124
  let m = null;
3124
3125
  const v = () => {
3125
3126
  null == m || m(), m = null, t2.value && (t2.value.registerViewport(o.value), m = t2.value.onLayoutChange((e15) => {
@@ -3131,11 +3132,11 @@ const Ma = ["data-global-page-index", "data-chapter-id", "data-local-page-index"
3131
3132
  null == m || m(), null == (e15 = t2.value) || e15.registerViewport(null);
3132
3133
  }), watch(t2, v), (e15, t3) => {
3133
3134
  var a3, s9, i2;
3134
- 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, Ma))), 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);
3135
3136
  };
3136
- } }), [["__scopeId", "data-v-8a737137"]]), xa = /* @__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"])) });
3137
- const ka = { kind: "first-wins" };
3138
- function La(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) {
3139
3140
  if (1 === t2.length) return t2[0].chapterId;
3140
3141
  switch (a3.kind) {
3141
3142
  case "first-wins":
@@ -3153,7 +3154,7 @@ function La(e14, t2, a3) {
3153
3154
  return a3.resolve(e14, t2);
3154
3155
  }
3155
3156
  }
3156
- let $a = class {
3157
+ let Ta = class {
3157
3158
  constructor(e14) {
3158
3159
  this._pages = e14, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
3159
3160
  for (const t2 of e14) {
@@ -3187,8 +3188,8 @@ let $a = class {
3187
3188
  return a3 ? this._pages.indexOf(a3) : -1;
3188
3189
  }
3189
3190
  };
3190
- function za(e14, t2 = ka) {
3191
- const a3 = (function(e15, t3 = ka) {
3191
+ function Da(e14, t2 = $a) {
3192
+ const a3 = (function(e15, t3 = $a) {
3192
3193
  const a4 = /* @__PURE__ */ new Map();
3193
3194
  for (const i3 of e15.chapters) {
3194
3195
  const [e16, t4] = i3.globalPageRange;
@@ -3198,7 +3199,7 @@ function za(e14, t2 = ka) {
3198
3199
  }
3199
3200
  }
3200
3201
  const s10 = /* @__PURE__ */ new Map();
3201
- for (const [i3, o2] of a4) s10.set(i3, La(i3, o2, t3));
3202
+ for (const [i3, o2] of a4) s10.set(i3, za(i3, o2, t3));
3202
3203
  return s10;
3203
3204
  })(e14, t2), s9 = /* @__PURE__ */ new Map();
3204
3205
  for (const n2 of e14.chapters) s9.set(n2.chapterId, n2);
@@ -3210,14 +3211,14 @@ function za(e14, t2 = ka) {
3210
3211
  const [i3] = t3.globalPageRange, [l] = t3.localPageRange, h2 = l + (n2 - i3);
3211
3212
  o.push({ globalPageIndex: r2++, globalPageNumber: n2, chapterId: e15, localPageIndex: h2 });
3212
3213
  }
3213
- return new $a(o);
3214
+ return new Ta(o);
3214
3215
  }
3215
- const Ta = class e10 extends BasePlugin {
3216
+ const Oa = class e10 extends BasePlugin {
3216
3217
  constructor(e14, t2) {
3217
- super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = ka, 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);
3218
3219
  }
3219
3220
  async initialize(e14) {
3220
- if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? ka, 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) => {
3221
3222
  this.isOwnedChapter(e15.id) && (this.passwordAttempts.delete(e15.id), this.updateStatus(e15.id, "loaded"));
3222
3223
  }), this.documentManager.provides().onDocumentClosed((e15) => {
3223
3224
  this.isOwnedChapter(e15) && this.updateStatus(e15, "closed");
@@ -3252,7 +3253,7 @@ const Ta = class e10 extends BasePlugin {
3252
3253
  const s9 = new Set(this.chapterStatus.keys()), i2 = new Set(t2.chapters.map((e14) => e14.chapterId));
3253
3254
  for (const e14 of s9) i2.has(e14) || (this.closeChapter(e14), this.chapterStatus.delete(e14));
3254
3255
  for (const e14 of t2.chapters) this.chapterStatus.has(e14.chapterId) || this.chapterStatus.set(e14.chapterId, "idle");
3255
- this.manifest = t2, this.virtualPageMap = za(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();
3256
3257
  }
3257
3258
  eagerPrefetchFromManifest() {
3258
3259
  const e14 = this.config.prefetchChapters ?? 0;
@@ -3390,10 +3391,10 @@ const Ta = class e10 extends BasePlugin {
3390
3391
  this.chapterStatus.get(e14) !== t2 && (this.chapterStatus.set(e14, t2), this.statusChange$.emit({ chapterId: e14, status: t2, ..."error" === t2 && a3 ? { error: { message: a3 } } : {} }));
3391
3392
  }
3392
3393
  };
3393
- Ta.id = "chapter-manager";
3394
- let Da = Ta;
3395
- const Oa = { kind: "first-wins" };
3396
- function Ga(e14, t2, a3) {
3394
+ Oa.id = "chapter-manager";
3395
+ let Ga = Oa;
3396
+ const Na = { kind: "first-wins" };
3397
+ function Aa(e14, t2, a3) {
3397
3398
  if (1 === t2.length) return t2[0].chapterId;
3398
3399
  switch (a3.kind) {
3399
3400
  case "first-wins":
@@ -3411,7 +3412,7 @@ function Ga(e14, t2, a3) {
3411
3412
  return a3.resolve(e14, t2);
3412
3413
  }
3413
3414
  }
3414
- class Na {
3415
+ class Va {
3415
3416
  constructor(e14) {
3416
3417
  this._pages = e14, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
3417
3418
  for (const t2 of e14) {
@@ -3445,8 +3446,8 @@ class Na {
3445
3446
  return a3 ? this._pages.indexOf(a3) : -1;
3446
3447
  }
3447
3448
  }
3448
- function Aa(e14, t2 = Oa) {
3449
- const a3 = (function(e15, t3 = Oa) {
3449
+ function Ea(e14, t2 = Na) {
3450
+ const a3 = (function(e15, t3 = Na) {
3450
3451
  const a4 = /* @__PURE__ */ new Map();
3451
3452
  for (const i3 of e15.chapters) {
3452
3453
  const [e16, t4] = i3.globalPageRange;
@@ -3456,7 +3457,7 @@ function Aa(e14, t2 = Oa) {
3456
3457
  }
3457
3458
  }
3458
3459
  const s10 = /* @__PURE__ */ new Map();
3459
- for (const [i3, o2] of a4) s10.set(i3, Ga(i3, o2, t3));
3460
+ for (const [i3, o2] of a4) s10.set(i3, Aa(i3, o2, t3));
3460
3461
  return s10;
3461
3462
  })(e14, t2), s9 = /* @__PURE__ */ new Map();
3462
3463
  for (const n2 of e14.chapters) s9.set(n2.chapterId, n2);
@@ -3468,14 +3469,14 @@ function Aa(e14, t2 = Oa) {
3468
3469
  const [i3] = t3.globalPageRange, [l] = t3.localPageRange, h2 = l + (n2 - i3);
3469
3470
  o.push({ globalPageIndex: r2++, globalPageNumber: n2, chapterId: e15, localPageIndex: h2 });
3470
3471
  }
3471
- return new Na(o);
3472
+ return new Va(o);
3472
3473
  }
3473
- const Va = class e11 extends BasePlugin {
3474
+ const _a = class e11 extends BasePlugin {
3474
3475
  constructor(e14, t2) {
3475
- super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = Oa, 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);
3476
3477
  }
3477
3478
  async initialize(e14) {
3478
- if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? Oa, 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) => {
3479
3480
  this.isOwnedChapter(e15.id) && (this.passwordAttempts.delete(e15.id), this.updateStatus(e15.id, "loaded"));
3480
3481
  }), this.documentManager.provides().onDocumentClosed((e15) => {
3481
3482
  this.isOwnedChapter(e15) && this.updateStatus(e15, "closed");
@@ -3510,7 +3511,7 @@ const Va = class e11 extends BasePlugin {
3510
3511
  const s9 = new Set(this.chapterStatus.keys()), i2 = new Set(t2.chapters.map((e14) => e14.chapterId));
3511
3512
  for (const e14 of s9) i2.has(e14) || (this.closeChapter(e14), this.chapterStatus.delete(e14));
3512
3513
  for (const e14 of t2.chapters) this.chapterStatus.has(e14.chapterId) || this.chapterStatus.set(e14.chapterId, "idle");
3513
- this.manifest = t2, this.virtualPageMap = Aa(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();
3514
3515
  }
3515
3516
  eagerPrefetchFromManifest() {
3516
3517
  const e14 = this.config.prefetchChapters ?? 0;
@@ -3648,9 +3649,9 @@ const Va = class e11 extends BasePlugin {
3648
3649
  this.chapterStatus.get(e14) !== t2 && (this.chapterStatus.set(e14, t2), this.statusChange$.emit({ chapterId: e14, status: t2, ..."error" === t2 && a3 ? { error: { message: a3 } } : {} }));
3649
3650
  }
3650
3651
  };
3651
- Va.id = "chapter-manager";
3652
- let _a = Va;
3653
- function Ea(e14, t2) {
3652
+ _a.id = "chapter-manager";
3653
+ let Ra = _a;
3654
+ function Fa(e14, t2) {
3654
3655
  if (e14 === t2) return true;
3655
3656
  if (e14.totalHeight !== t2.totalHeight || e14.totalWidth !== t2.totalWidth || e14.pageGap !== t2.pageGap || e14.items.length !== t2.items.length) return false;
3656
3657
  for (let a3 = 0; a3 < e14.items.length; a3++) {
@@ -3659,9 +3660,9 @@ function Ea(e14, t2) {
3659
3660
  }
3660
3661
  return true;
3661
3662
  }
3662
- const Ra = class extends BasePlugin {
3663
+ const Ua = class extends BasePlugin {
3663
3664
  constructor(e14, t2) {
3664
- super(e14, t2), this.layoutChange$ = createBehaviorEmitter(void 0, Ea), 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(_a.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);
3665
3666
  }
3666
3667
  async initialize(e14) {
3667
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 }) => {
@@ -3838,11 +3839,11 @@ const Ra = class extends BasePlugin {
3838
3839
  a3 && this.scrollToIndex(a3.globalPageIndex, t2);
3839
3840
  }
3840
3841
  };
3841
- Ra.id = "chapter-scroll";
3842
- let Fa = Ra;
3843
- const Ua = class e12 extends BasePlugin {
3842
+ Ua.id = "chapter-scroll";
3843
+ let qa = Ua;
3844
+ const Wa = class e12 extends BasePlugin {
3844
3845
  constructor(e14, t2) {
3845
- super(e14, t2), this.notesChange$ = createBehaviorEmitter([]), this.noteActivated$ = createEmitter(), this.notes = /* @__PURE__ */ new Map(), this.chapterScroll = this.registry.getPlugin(Fa.id), this.chapterManager = this.registry.getPlugin(Da.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);
3846
3847
  }
3847
3848
  async initialize(t2) {
3848
3849
  if (this.config = t2, t2.callbacks.loadNotes) try {
@@ -3880,7 +3881,7 @@ const Ua = class e12 extends BasePlugin {
3880
3881
  this.notesChange$.emit(this.listAll());
3881
3882
  }
3882
3883
  buildDraft(e14) {
3883
- return { chapterId: e14.chapterId, localPageIndex: e14.localPageIndex, globalPageNumber: e14.globalPageNumber, globalPageIndex: e14.globalPageIndex, rectsPdfCoord: e14.rectsPdfCoord, endAnchor: Wa(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 };
3884
3885
  }
3885
3886
  async requestCreateFromSelection(e14) {
3886
3887
  if (0 === e14.rectsPdfCoord.length) return null;
@@ -3947,21 +3948,21 @@ const Ua = class e12 extends BasePlugin {
3947
3948
  });
3948
3949
  }
3949
3950
  };
3950
- Ua.id = "note";
3951
- let qa = Ua;
3952
- function Wa(e14) {
3951
+ Wa.id = "note";
3952
+ let Ha = Wa;
3953
+ function Ba(e14) {
3953
3954
  const t2 = e14[e14.length - 1];
3954
3955
  return { x: t2.origin.x + t2.size.width, y: t2.origin.y + t2.size.height };
3955
3956
  }
3956
- function Ha(e14) {
3957
+ function ja(e14) {
3957
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;
3958
3959
  let h2, d2;
3959
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);
3960
3961
  const c = Math.max(0, o - r2 - 2);
3961
3962
  return h2 > c && (h2 = c), d2 < 0 && (d2 = 0), { left: h2, top: d2 };
3962
3963
  }
3963
- const Ba = { key: 0, style: { position: "absolute", inset: "0", pointerEvents: "none", zIndex: 25 } }, ja = ["onMouseenter"], Za = ["data-note-marker-zone", "onMouseenter", "onMouseleave"], Ya = ["onClick"], Ka = ["onClick"], Xa = ["onClick"], Qa = /* @__PURE__ */ defineComponent({ __name: "NoteMarkerLayer", props: { chapterId: {}, localPageIndex: {}, pdfPageWidth: {}, pdfPageHeight: {}, cssPageWidth: {}, cssPageHeight: {}, ui: {} }, setup(e14) {
3964
- const o = e14, { provides: r2 } = useCapability(qa.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);
3965
3966
  watch(r2, (e15) => {
3966
3967
  if (e15) return e15.onNotesChange((e16) => {
3967
3968
  d2.value = e16.filter((e17) => e17.chapterId === o.chapterId && e17.localPageIndex === o.localPageIndex);
@@ -3985,25 +3986,25 @@ const Ba = { key: 0, style: { position: "absolute", inset: "0", pointerEvents: "
3985
3986
  return ((_a2 = o.ui) == null ? void 0 : _a2.highlightColor) ?? "rgba(245, 158, 11, 0.08)";
3986
3987
  });
3987
3988
  function C(e15) {
3988
- const t2 = o.cssPageWidth / o.pdfPageWidth, a3 = o.cssPageHeight / o.pdfPageHeight, s9 = w.value, { left: i2, top: r3 } = Ha({ 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) {
3989
3990
  let s10 = 1 / 0, i3 = 1 / 0, o2 = -1 / 0, r4 = -1 / 0;
3990
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);
3991
3992
  return { left: s10, top: i3, width: o2 - s10, height: r4 - i3 };
3992
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);
3993
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 };
3994
3995
  }
3995
- return (t2, a3) => unref(r2) && d2.value.length && e14.pdfPageWidth && e14.pdfPageHeight ? (openBlock(), createElementBlock("div", Ba, [(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, ja))), 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(() => {
3996
- }, ["stop"])), onClick: withModifiers((t3) => f.value = f.value === e15.noteId ? null : e15.noteId, ["stop"]) }, " 💬 ", 44, Ya), 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(() => {
3997
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) {
3998
3999
  var _a2;
3999
4000
  (_a2 = r2.value) == null ? void 0 : _a2.requestEditNote(e16.noteId, e16);
4000
- })(e15) }, " 编辑 ", 8, Ka), 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) => {
4001
4002
  var _a2;
4002
4003
  return a4 = e15.noteId, (_a2 = r2.value) == null ? void 0 : _a2.requestDeleteNote(a4), void (f.value = null);
4003
4004
  var a4;
4004
- } }, " 删除 ", 8, Xa)], 36)) : createCommentVNode("", true)], 44, Za)) : createCommentVNode("", true)], 64))), 128))])) : createCommentVNode("", true);
4005
- } }), Ja = { key: 0, style: { position: "absolute", inset: "0", pointerEvents: "none" } }, es = ["title", "onClick"], ts = ["onClick"], as = /* @__PURE__ */ defineComponent({ __name: "BookmarkMarkerLayer", props: { chapterId: {}, localPageIndex: {}, pdfPageWidth: {}, pdfPageHeight: {}, cssPageWidth: {}, cssPageHeight: {}, ui: {} }, setup(e14) {
4006
- const o = e14, { provides: r2 } = useCapability(Bt$1.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);
4007
4008
  function P() {
4008
4009
  const e15 = r2.value;
4009
4010
  e15 && (d2.value = e15.listBookmarks().filter((e16) => e16.anchor.chapterId === o.chapterId && e16.anchor.localPageIndex === o.localPageIndex));
@@ -4028,27 +4029,46 @@ const Ba = { key: 0, style: { position: "absolute", inset: "0", pointerEvents: "
4028
4029
  const { left: t2, top: a3 } = (function(e16) {
4029
4030
  var _a2;
4030
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];
4031
- return Ha({ 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 });
4032
4033
  })(e15);
4033
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 };
4034
4035
  }
4035
- return (t2, a3) => unref(r2) && d2.value.length && e14.pdfPageWidth && e14.pdfPageHeight ? (openBlock(), createElementBlock("div", Ja, [(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(() => {
4036
- }, ["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, es), 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(() => {
4037
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) {
4038
4039
  const t4 = r2.value;
4039
4040
  if (!t4) return;
4040
4041
  await t4.requestRemoveBookmark(e16) && (g2.value = null);
4041
- })(e15.id) }, " 删除书签 ", 8, ts)], 512)) : createCommentVNode("", true)], 36))), 128))])) : createCommentVNode("", true);
4042
+ })(e15.id) }, " 删除书签 ", 8, ss)], 512)) : createCommentVNode("", true)], 36))), 128))])) : createCommentVNode("", true);
4042
4043
  } });
4043
- function ss(e14) {
4044
+ function os(e14) {
4044
4045
  return e14.chapterId;
4045
4046
  }
4046
- function is(e14, t2) {
4047
+ function rs(e14, t2) {
4047
4048
  e14.wait(t2, () => {
4048
4049
  });
4049
4050
  }
4050
- const os = /* @__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) {
4051
- const a3 = e14, i2 = computed(() => ss(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));
4052
4072
  !(function(e15) {
4053
4073
  const { provides: t2 } = useCapability(DocumentManagerPlugin.id);
4054
4074
  watch([t2, e15], ([e16, t3]) => {
@@ -4067,7 +4087,7 @@ const os = /* @__PURE__ */ defineComponent({ __name: "ChapterPageSurface", props
4067
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: () => {
4068
4088
  if (!r2.value) return;
4069
4089
  const a5 = r2.value.getHighlightRectsForPage(e15.localPageIndex, t2);
4070
- is(r2.value.getSelectedText(t2), (t3) => {
4090
+ rs(r2.value.getSelectedText(t2), (t3) => {
4071
4091
  s9((function(e16, t4, a6) {
4072
4092
  return { chapterId: e16.chapterId, localPageIndex: e16.localPageIndex, globalPageIndex: e16.globalPageIndex, globalPageNumber: e16.globalPageNumber, rectsPdfCoord: t4, selectedText: a6 };
4073
4093
  })(e15, a5, t3.join("\n")));
@@ -4082,14 +4102,22 @@ const os = /* @__PURE__ */ defineComponent({ __name: "ChapterPageSurface", props
4082
4102
  if (a4) return a4;
4083
4103
  }
4084
4104
  return t2.defaultMenu;
4085
- }), u = 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(() => {
4086
4114
  var _a2;
4087
4115
  return (_a2 = a3.renderPageOverlay) == null ? void 0 : _a2.call(a3, a3.item);
4088
4116
  });
4089
- 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(be$1)), onPointerdown: unref(Pe$1) }, { default: withCtx(() => [createVNode(unref(xa), { "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": e14.annotationSelectionMenu }, null, 8, ["document-id", "page-index", "selection-menu"]), e14.showBookmarkMarkers && l.value ? (openBlock(), createBlock(as, { 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), u.value ? (openBlock(), createBlock(resolveDynamicComponent(u.value), { key: 2 })) : createCommentVNode("", true), e14.showNoteMarkers && l.value ? (openBlock(), createBlock(Qa, { 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"]));
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"]));
4090
4118
  } });
4091
- const rs = /* @__PURE__ */ defineComponent({ __name: "HoverBookmarkLayer", props: { item: {}, pdfPageWidth: {}, pdfPageHeight: {}, cssPageWidth: {}, cssPageHeight: {}, hoverUi: {} }, setup(e14) {
4092
- const o = e14, r2 = computed(() => ss(o.item)), { provides: d2 } = useCapability(SelectionPlugin.id), { provides: u } = useCapability(Bt$1.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(() => {
4093
4121
  var _a2;
4094
4122
  return ((_a2 = o.hoverUi) == null ? void 0 : _a2.iconSize) ?? 16;
4095
4123
  }), y = computed(() => P.value ?? f.value);
@@ -4146,10 +4174,10 @@ const rs = /* @__PURE__ */ defineComponent({ __name: "HoverBookmarkLayer", props
4146
4174
  });
4147
4175
  const k2 = computed(() => {
4148
4176
  const e15 = y.value;
4149
- return (e15 == null ? void 0 : e15.length) ? qt(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;
4150
4178
  }), L2 = computed(() => {
4151
4179
  const e15 = k2.value, t2 = u.value;
4152
- return !(!e15 || !t2) && t2.listBookmarks().some((t3) => Ut(t3.anchor, e15));
4180
+ return !(!e15 || !t2) && t2.listBookmarks().some((t3) => Wt(t3.anchor, e15));
4153
4181
  });
4154
4182
  function $2() {
4155
4183
  const e15 = u.value, t2 = k2.value;
@@ -4165,33 +4193,33 @@ const rs = /* @__PURE__ */ defineComponent({ __name: "HoverBookmarkLayer", props
4165
4193
  var _a2;
4166
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);
4167
4195
  };
4168
- } }), ns = { key: 0, width: "24", height: "24", viewBox: "0 0 28 28", fill: "none", "aria-hidden": "" }, ls = { key: 0, x: "5", y: "4", width: "18", height: "20", rx: "3", fill: "#fde047" }, hs = { key: 1, d: "M6 22h16", stroke: "#dc2626", "stroke-width": "2.2", "stroke-linecap": "round" }, ds = { 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" }, cs = { key: 3, d: "M5 14h18", stroke: "#dc2626", "stroke-width": "2.2", "stroke-linecap": "round" }, us = { key: 1, width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "" }, ps = /* @__PURE__ */ defineComponent({ __name: "SelectionToolbarIcons", props: { kind: {} }, setup: (e14) => (t2, a3) => "note" !== e14.kind ? (openBlock(), createElementBlock("svg", ns, ["highlight" === e14.kind ? (openBlock(), createElementBlock("rect", ls)) : 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", hs)) : "squiggly" === e14.kind ? (openBlock(), createElementBlock("path", ds)) : "strikeout" === e14.kind ? (openBlock(), createElementBlock("path", cs)) : createCommentVNode("", true)])) : (openBlock(), createElementBlock("svg", us, [...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)])])) }), gs = ["title", "aria-label", "onMouseenter", "onClick"], fs = ["title", "onMouseenter", "onClick"], ms = { style: { "font-size": "11px", "font-weight": "600" } }, vs = /* @__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 }) {
4169
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)" }));
4170
- function y(e15, t2 = false) {
4198
+ function w(e15, t2 = false) {
4171
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" };
4172
4200
  }
4173
4201
  const C = { width: "1px", height: "20px", margin: "0 4px", background: "rgba(15, 23, 42, 0.1)", flexShrink: 0 };
4174
- 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(ps, { kind: e16.id }, null, 8, ["kind"])], 44, gs))), 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", ms, toDisplayString(e16.label.slice(0, 2)), 1)], 44, fs))), 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(ps, { kind: "note" })], 36)], 64)) : createCommentVNode("", true)], 4));
4175
- } }), bs = { highlight: "highlight", underline: "underline", squiggly: "squiggly", strikeout: "strikeout" };
4176
- const Ps = /* @__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) {
4177
- const a3 = e14, s9 = computed(() => a3.features), { hostRef: i2 } = ga(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() {
4178
4206
  const { registry: e15 } = useRegistry();
4179
4207
  return computed(() => {
4180
4208
  var _a2, _b, _c;
4181
- const t2 = (_c = (_b = (_a2 = e15.value) == null ? void 0 : _a2.getPlugin(Pt$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);
4182
4210
  return t2 ? (e16) => t2.createNoteFromSelection(e16) : null;
4183
4211
  });
4184
4212
  })(), r2 = (function() {
4185
4213
  const { registry: e15 } = useRegistry();
4186
4214
  return computed(() => {
4187
4215
  var _a2;
4188
- return !!((_a2 = e15.value) == null ? void 0 : _a2.getPlugin(Pt$1.id));
4216
+ return !!((_a2 = e15.value) == null ? void 0 : _a2.getPlugin(yt$1.id));
4189
4217
  });
4190
4218
  })(), c = (function() {
4191
4219
  const { registry: e15 } = useRegistry();
4192
4220
  return computed(() => {
4193
4221
  var _a2;
4194
- return !!((_a2 = e15.value) == null ? void 0 : _a2.getPlugin(Bt$1.id));
4222
+ return !!((_a2 = e15.value) == null ? void 0 : _a2.getPlugin(Zt.id));
4195
4223
  });
4196
4224
  })(), u = computed(() => {
4197
4225
  var _a2, _b;
@@ -4212,20 +4240,20 @@ const Ps = /* @__PURE__ */ defineComponent({ __name: "PdfChapterViewport", props
4212
4240
  }), o2 = computed(() => {
4213
4241
  var _a2, _b;
4214
4242
  return false !== ((_b = (_a2 = e15()) == null ? void 0 : _a2.notes) == null ? void 0 : _b.enabled);
4215
- }), { provides: r3 } = useCapability(SelectionPlugin.id), { provides: n2 } = useCapability(AnnotationPlugin.id), { provides: l } = useCapability(Pt$1.id);
4243
+ }), { provides: r3 } = useCapability(SelectionPlugin.id), { provides: n2 } = useCapability(AnnotationPlugin.id), { provides: l } = useCapability(yt$1.id);
4216
4244
  return computed(() => {
4217
4245
  var _a2, _b, _c;
4218
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) => {
4219
- const h2 = ss(t2.item);
4247
+ const h2 = os(t2.item);
4220
4248
  return (d2) => {
4221
4249
  var _a3, _b2, _c2;
4222
- return h$1("div", d2.menuWrapperProps, h$1(vs, { 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) => {
4223
4251
  var _a4, _b3, _c3;
4224
4252
  if ("highlight" !== s11 && "underline" !== s11 && "squiggly" !== s11 && "strikeout" !== s11) {
4225
4253
  if ("note" === s11) {
4226
4254
  if (!r3.value || !l.value || !o2.value) return;
4227
4255
  const e16 = r3.value.getHighlightRectsForPage(t2.item.localPageIndex, h2);
4228
- return void is(r3.value.getSelectedText(h2), (a5) => {
4256
+ return void rs(r3.value.getSelectedText(h2), (a5) => {
4229
4257
  var _a5;
4230
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") });
4231
4259
  });
@@ -4233,7 +4261,7 @@ const Ps = /* @__PURE__ */ defineComponent({ __name: "PdfChapterViewport", props
4233
4261
  (_a4 = a4 == null ? void 0 : a4.onExtraAction) == null ? void 0 : _a4.call(a4, s11, t2);
4234
4262
  } else {
4235
4263
  if (!r3.value || !n2.value || !i3.value) return;
4236
- Me(h2, bs[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);
4237
4265
  }
4238
4266
  } }));
4239
4267
  };
@@ -4244,42 +4272,42 @@ const Ps = /* @__PURE__ */ defineComponent({ __name: "PdfChapterViewport", props
4244
4272
  const t2 = v.value ? v.value(e15) : e15.defaultMenu;
4245
4273
  return a3.buildSelectionMenu ? a3.buildSelectionMenu({ ...e15, defaultMenu: t2 }) : t2;
4246
4274
  };
4247
- }), { provides: y } = useCapability(DocumentManagerPlugin.id);
4275
+ }), { provides: C } = useCapability(DocumentManagerPlugin.id);
4248
4276
  function I(e15) {
4249
4277
  var _a2;
4250
4278
  const t2 = [];
4251
4279
  if (f.value) {
4252
4280
  const s11 = (function(e16) {
4253
4281
  var _a3, _b, _c, _d;
4254
- const t3 = ss(e16), s12 = (_b = (_a3 = y.value) == null ? void 0 : _a3.getDocument(t3)) == null ? void 0 : _b.pages[e16.localPageIndex];
4255
- return e16.isPlaceholder || !s12 ? null : h$1(rs, { 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 });
4256
4284
  })(e15);
4257
4285
  s11 && t2.push(s11);
4258
4286
  }
4259
4287
  const s10 = (_a2 = a3.renderPageOverlay) == null ? void 0 : _a2.call(a3, e15);
4260
4288
  if (s10 && t2.push(s10), t2.length) return h$1("div", t2);
4261
4289
  }
4262
- 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(Sa), { 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 }) => {
4263
4291
  var _a2, _b, _c, _d;
4264
- return [createVNode(os, { 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"])];
4265
4293
  }), _: 1 }, 8, ["class"]), renderSlot(t2.$slots, "default")], 6));
4266
- } }), ws = { key: 0, style: { display: "flex", flexDirection: "column", height: "100%", minHeight: 0, width: "100%" } }, ys = /* @__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) {
4267
4295
  const a3 = e14, s9 = computed(() => (function(e15) {
4268
- if (e15.options) return na(e15.options);
4296
+ if (e15.options) return ha(e15.options);
4269
4297
  if (!e15.editorOptions) throw new Error("ChapterPdfViewer: 请传入 `options`(推荐),或同时传入 `editorOptions` 与 `features`");
4270
- const t2 = xe(e15.features), { plugins: a4 } = sa({ ...e15.editorOptions, features: t2 });
4298
+ const t2 = Le(e15.features), { plugins: a4 } = oa({ ...e15.editorOptions, features: t2 });
4271
4299
  return { plugins: a4, features: t2, editorOptions: { ...e15.editorOptions, features: t2 } };
4272
4300
  })({ engine: a3.engine, options: a3.options, editorOptions: a3.editorOptions, features: a3.features }));
4273
- 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", ws, [renderSlot(t2.$slots, "prepend"), createVNode(Ps, { 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));
4274
- } }), Cs = { class: "chapter-tree-row" }, Is = ["aria-expanded"], Ms = { key: 1, class: "chapter-tree-toggle-spacer", "aria-hidden": "" }, Ss = { class: "chapter-tree-label" }, xs = { class: "chapter-tree-meta" }, ks = { key: 0 }, Ls = (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) => {
4275
4303
  const a3 = e14.__vccOpts || e14;
4276
4304
  for (const [s9, i2] of t2) a3[s9] = i2;
4277
4305
  return a3;
4278
- }, $s = /* @__PURE__ */ Ls(/* @__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) {
4279
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);
4280
- return (t2, a3) => (openBlock(), createElementBlock("li", null, [createElementVNode("div", Cs, [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, Is)) : (openBlock(), createElementBlock("span", Ms)), 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", Ss, toDisplayString(e14.node.title), 1), createElementVNode("div", xs, [createElementVNode("span", null, " 第 " + toDisplayString(e14.node.startPage) + toDisplayString(e14.node.endPage !== e14.node.startPage ? `–${e14.node.endPage}` : "") + " 页 ", 1), g2.value ? (openBlock(), createElementBlock("span", ks, toDisplayString(s9[p2.value]), 1)) : createCommentVNode("", true)])], 2)]), r2.value && h2.value ? (openBlock(), createBlock(zs, { 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)]));
4281
- } }), [["__scopeId", "data-v-315bbf7a"]]), zs = /* @__PURE__ */ Ls(/* @__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($s, { 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"]]), Ts = { class: "chapter-tree" }, Ds = { class: "chapter-tree-nav", "aria-label": "章节目录" }, Os = /* @__PURE__ */ Ls(/* @__PURE__ */ defineComponent({ __name: "ChapterTreePanel", props: { tree: {}, activeChapterId: {} }, emits: ["active-chapter-change"], setup(e14, { emit: t2 }) {
4282
- const o = e14, r2 = t2, { provides: h2 } = useCapability(Je.id), { provides: d2 } = useCapability(Fe.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({});
4283
4311
  function p2() {
4284
4312
  if (!d2.value) return;
4285
4313
  const e15 = {}, t3 = (a3) => {
@@ -4296,7 +4324,7 @@ const Ps = /* @__PURE__ */ defineComponent({ __name: "PdfChapterViewport", props
4296
4324
  }
4297
4325
  return watch(d2, (e15) => {
4298
4326
  g2 == null ? void 0 : g2(), g2 = e15 ? e15.onChapterStatusChange(p2) : null;
4299
- }, { immediate: true }), onBeforeUnmount(() => g2 == null ? void 0 : g2()), (t3, a3) => (openBlock(), createElementBlock("aside", Ts, [a3[0] || (a3[0] = createElementVNode("h2", { class: "chapter-tree-title" }, "章节目录", -1)), createElementVNode("nav", Ds, [createVNode(zs, { 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"])])]));
4300
4328
  } }), [["__scopeId", "data-v-d7a0838d"]]);
4301
4329
  const _sfc_main = /* @__PURE__ */ defineComponent({
4302
4330
  __name: "ChapterPdfViewer",
@@ -4310,7 +4338,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4310
4338
  },
4311
4339
  setup(__props) {
4312
4340
  return (_ctx, _cache) => {
4313
- return openBlock(), createBlock(unref(ys), normalizeProps(guardReactiveProps(_ctx.$props)), createSlots({
4341
+ return openBlock(), createBlock(unref(xs), normalizeProps(guardReactiveProps(_ctx.$props)), createSlots({
4314
4342
  default: withCtx(() => [
4315
4343
  renderSlot(_ctx.$slots, "default")
4316
4344
  ]),
@@ -5017,7 +5045,7 @@ function V(t2, e14, a3) {
5017
5045
  return a3.resolve(t2, e14);
5018
5046
  }
5019
5047
  }
5020
- class F {
5048
+ class E {
5021
5049
  constructor(t2) {
5022
5050
  this._pages = t2, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
5023
5051
  for (const e14 of t2) {
@@ -5051,7 +5079,7 @@ class F {
5051
5079
  return a3 ? this._pages.indexOf(a3) : -1;
5052
5080
  }
5053
5081
  }
5054
- function E(t2, e14 = N) {
5082
+ function U(t2, e14 = N) {
5055
5083
  const a3 = (function(t3, e15 = N) {
5056
5084
  const a4 = /* @__PURE__ */ new Map();
5057
5085
  for (const o2 of t3.chapters) {
@@ -5074,9 +5102,9 @@ function E(t2, e14 = N) {
5074
5102
  const [o2] = e15.globalPageRange, [h2] = e15.localPageRange, d2 = h2 + (n2 - o2);
5075
5103
  r2.push({ globalPageIndex: i2++, globalPageNumber: n2, chapterId: t3, localPageIndex: d2 });
5076
5104
  }
5077
- return new F(r2);
5105
+ return new E(r2);
5078
5106
  }
5079
- const U = class s3 extends BasePlugin {
5107
+ const F = class s3 extends BasePlugin {
5080
5108
  constructor(t2, s9) {
5081
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);
5082
5110
  }
@@ -5116,7 +5144,7 @@ const U = class s3 extends BasePlugin {
5116
5144
  const a3 = new Set(this.chapterStatus.keys()), o = new Set(t2.chapters.map((t3) => t3.chapterId));
5117
5145
  for (const s9 of a3) o.has(s9) || (this.closeChapter(s9), this.chapterStatus.delete(s9));
5118
5146
  for (const s9 of t2.chapters) this.chapterStatus.has(s9.chapterId) || this.chapterStatus.set(s9.chapterId, "idle");
5119
- 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();
5120
5148
  }
5121
5149
  eagerPrefetchFromManifest() {
5122
5150
  const t2 = this.config.prefetchChapters ?? 0;
@@ -5254,8 +5282,8 @@ const U = class s3 extends BasePlugin {
5254
5282
  this.chapterStatus.get(t2) !== e14 && (this.chapterStatus.set(t2, e14), this.statusChange$.emit({ chapterId: t2, status: e14, ..."error" === e14 && a3 ? { error: { message: a3 } } : {} }));
5255
5283
  }
5256
5284
  };
5257
- U.id = "chapter-manager";
5258
- let R = U;
5285
+ F.id = "chapter-manager";
5286
+ let R = F;
5259
5287
  function _(t2, e14) {
5260
5288
  if (t2 === e14) return true;
5261
5289
  if (t2.totalHeight !== e14.totalHeight || t2.totalWidth !== e14.totalWidth || t2.pageGap !== e14.pageGap || t2.items.length !== e14.items.length) return false;
@@ -5445,8 +5473,8 @@ const q = class extends BasePlugin {
5445
5473
  }
5446
5474
  };
5447
5475
  q.id = "chapter-scroll";
5448
- const J = { kind: "first-wins" };
5449
- function K(t2, e14, a3) {
5476
+ const K = { kind: "first-wins" };
5477
+ function J(t2, e14, a3) {
5450
5478
  if (1 === e14.length) return e14[0].chapterId;
5451
5479
  switch (a3.kind) {
5452
5480
  case "first-wins":
@@ -5498,8 +5526,8 @@ let Q = class {
5498
5526
  return a3 ? this._pages.indexOf(a3) : -1;
5499
5527
  }
5500
5528
  };
5501
- function Y(t2, e14 = J) {
5502
- const a3 = (function(t3, e15 = J) {
5529
+ function Y(t2, e14 = K) {
5530
+ const a3 = (function(t3, e15 = K) {
5503
5531
  const a4 = /* @__PURE__ */ new Map();
5504
5532
  for (const o2 of t3.chapters) {
5505
5533
  const [t4, e16] = o2.globalPageRange;
@@ -5509,7 +5537,7 @@ function Y(t2, e14 = J) {
5509
5537
  }
5510
5538
  }
5511
5539
  const s10 = /* @__PURE__ */ new Map();
5512
- 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));
5513
5541
  return s10;
5514
5542
  })(t2, e14), s9 = /* @__PURE__ */ new Map();
5515
5543
  for (const n2 of t2.chapters) s9.set(n2.chapterId, n2);
@@ -5525,10 +5553,10 @@ function Y(t2, e14 = J) {
5525
5553
  }
5526
5554
  const X = class s4 extends BasePlugin {
5527
5555
  constructor(t2, s9) {
5528
- 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);
5529
5557
  }
5530
5558
  async initialize(t2) {
5531
- 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) => {
5532
5560
  this.isOwnedChapter(t3.id) && (this.passwordAttempts.delete(t3.id), this.updateStatus(t3.id, "loaded"));
5533
5561
  }), this.documentManager.provides().onDocumentClosed((t3) => {
5534
5562
  this.isOwnedChapter(t3) && this.updateStatus(t3, "closed");
@@ -5704,7 +5732,7 @@ const X = class s4 extends BasePlugin {
5704
5732
  X.id = "chapter-manager";
5705
5733
  let Z = X;
5706
5734
  const tt = { kind: "first-wins" };
5707
- function et(t2, e14, a3) {
5735
+ function et2(t2, e14, a3) {
5708
5736
  if (1 === e14.length) return e14[0].chapterId;
5709
5737
  switch (a3.kind) {
5710
5738
  case "first-wins":
@@ -5767,7 +5795,7 @@ function st(t2, e14 = tt) {
5767
5795
  }
5768
5796
  }
5769
5797
  const s10 = /* @__PURE__ */ new Map();
5770
- 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));
5771
5799
  return s10;
5772
5800
  })(t2, e14), s9 = /* @__PURE__ */ new Map();
5773
5801
  for (const n2 of t2.chapters) s9.set(n2.chapterId, n2);
@@ -5781,7 +5809,7 @@ function st(t2, e14 = tt) {
5781
5809
  }
5782
5810
  return new at(r2);
5783
5811
  }
5784
- const ot2 = class s5 extends BasePlugin {
5812
+ const ot = class s5 extends BasePlugin {
5785
5813
  constructor(t2, s9) {
5786
5814
  super(t2, s9), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = tt, 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);
5787
5815
  }
@@ -5959,8 +5987,8 @@ const ot2 = class s5 extends BasePlugin {
5959
5987
  this.chapterStatus.get(t2) !== e14 && (this.chapterStatus.set(t2, e14), this.statusChange$.emit({ chapterId: t2, status: e14, ..."error" === e14 && a3 ? { error: { message: a3 } } : {} }));
5960
5988
  }
5961
5989
  };
5962
- ot2.id = "chapter-manager";
5963
- let rt = ot2;
5990
+ ot.id = "chapter-manager";
5991
+ let rt = ot;
5964
5992
  function it(t2, e14) {
5965
5993
  if (t2 === e14) return true;
5966
5994
  if (t2.totalHeight !== e14.totalHeight || t2.totalWidth !== e14.totalWidth || t2.pageGap !== e14.pageGap || t2.items.length !== e14.items.length) return false;
@@ -5970,7 +5998,7 @@ function it(t2, e14) {
5970
5998
  }
5971
5999
  return true;
5972
6000
  }
5973
- const nt = class extends BasePlugin {
6001
+ const nt2 = class extends BasePlugin {
5974
6002
  constructor(t2, a3) {
5975
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);
5976
6004
  }
@@ -6149,8 +6177,8 @@ const nt = class extends BasePlugin {
6149
6177
  a3 && this.scrollToIndex(a3.globalPageIndex, e14);
6150
6178
  }
6151
6179
  };
6152
- nt.id = "chapter-scroll";
6153
- let ht = nt;
6180
+ nt2.id = "chapter-scroll";
6181
+ let ht = nt2;
6154
6182
  const dt = class s6 extends BasePlugin {
6155
6183
  constructor(t2, s9) {
6156
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);
@@ -6191,7 +6219,7 @@ const dt = class s6 extends BasePlugin {
6191
6219
  this.notesChange$.emit(this.listAll());
6192
6220
  }
6193
6221
  buildDraft(t2) {
6194
- return { chapterId: t2.chapterId, localPageIndex: t2.localPageIndex, globalPageNumber: t2.globalPageNumber, globalPageIndex: t2.globalPageIndex, rectsPdfCoord: t2.rectsPdfCoord, endAnchor: ct2(t2.rectsPdfCoord), selectedText: t2.selectedText, content: t2.content };
6222
+ return { chapterId: t2.chapterId, localPageIndex: t2.localPageIndex, globalPageNumber: t2.globalPageNumber, globalPageIndex: t2.globalPageIndex, rectsPdfCoord: t2.rectsPdfCoord, endAnchor: ct(t2.rectsPdfCoord), selectedText: t2.selectedText, content: t2.content };
6195
6223
  }
6196
6224
  async requestCreateFromSelection(t2) {
6197
6225
  if (0 === t2.rectsPdfCoord.length) return null;
@@ -6260,12 +6288,12 @@ const dt = class s6 extends BasePlugin {
6260
6288
  };
6261
6289
  dt.id = "note";
6262
6290
  let lt = dt;
6263
- function ct2(t2) {
6291
+ function ct(t2) {
6264
6292
  const e14 = t2[t2.length - 1];
6265
6293
  return { x: e14.origin.x + e14.size.width, y: e14.origin.y + e14.size.height };
6266
6294
  }
6267
6295
  const ft = { kind: "first-wins" };
6268
- function mt2(t2, e14, a3) {
6296
+ function mt(t2, e14, a3) {
6269
6297
  if (1 === e14.length) return e14[0].chapterId;
6270
6298
  switch (a3.kind) {
6271
6299
  case "first-wins":
@@ -6317,7 +6345,7 @@ let vt = class {
6317
6345
  return a3 ? this._pages.indexOf(a3) : -1;
6318
6346
  }
6319
6347
  };
6320
- function bt(t2, e14 = ft) {
6348
+ function bt2(t2, e14 = ft) {
6321
6349
  const a3 = (function(t3, e15 = ft) {
6322
6350
  const a4 = /* @__PURE__ */ new Map();
6323
6351
  for (const o2 of t3.chapters) {
@@ -6328,7 +6356,7 @@ function bt(t2, e14 = ft) {
6328
6356
  }
6329
6357
  }
6330
6358
  const s10 = /* @__PURE__ */ new Map();
6331
- for (const [o2, r3] of a4) s10.set(o2, mt2(o2, r3, e15));
6359
+ for (const [o2, r3] of a4) s10.set(o2, mt(o2, r3, e15));
6332
6360
  return s10;
6333
6361
  })(t2, e14), s9 = /* @__PURE__ */ new Map();
6334
6362
  for (const n2 of t2.chapters) s9.set(n2.chapterId, n2);
@@ -6382,7 +6410,7 @@ const Pt = class s7 extends BasePlugin {
6382
6410
  const a3 = new Set(this.chapterStatus.keys()), o = new Set(t2.chapters.map((t3) => t3.chapterId));
6383
6411
  for (const s9 of a3) o.has(s9) || (this.closeChapter(s9), this.chapterStatus.delete(s9));
6384
6412
  for (const s9 of t2.chapters) this.chapterStatus.has(s9.chapterId) || this.chapterStatus.set(s9.chapterId, "idle");
6385
- 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();
6386
6414
  }
6387
6415
  eagerPrefetchFromManifest() {
6388
6416
  const t2 = this.config.prefetchChapters ?? 0;
@@ -6779,7 +6807,7 @@ const St = class s8 extends BasePlugin {
6779
6807
  }
6780
6808
  };
6781
6809
  St.id = "chapter-manager";
6782
- let xt2 = St;
6810
+ let xt = St;
6783
6811
  function kt(t2, e14) {
6784
6812
  if (t2 === e14) return true;
6785
6813
  if (t2.totalHeight !== e14.totalHeight || t2.totalWidth !== e14.totalWidth || t2.pageGap !== e14.pageGap || t2.items.length !== e14.items.length) return false;
@@ -6789,9 +6817,9 @@ function kt(t2, e14) {
6789
6817
  }
6790
6818
  return true;
6791
6819
  }
6792
- const Lt = class extends BasePlugin {
6820
+ const Lt2 = class extends BasePlugin {
6793
6821
  constructor(t2, a3) {
6794
- 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(xt2.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
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);
6795
6823
  }
6796
6824
  async initialize(t2) {
6797
6825
  this.config = { placeholderPageHeight: t2.placeholderPageHeight ?? 1200, placeholderPageWidth: t2.placeholderPageWidth ?? 900, bufferSize: t2.bufferSize ?? 2, pageGap: t2.pageGap ?? 20 }, this.virtualPageMap = this.chapterManager.provides().getVirtualPageMap(), this.rebuildOffsets(), this.chapterManagerUnsubs.push(this.chapterManager.provides().onManifestChange(({ map: t3 }) => {
@@ -6968,13 +6996,13 @@ const Lt = class extends BasePlugin {
6968
6996
  a3 && this.scrollToIndex(a3.globalPageIndex, e14);
6969
6997
  }
6970
6998
  };
6971
- Lt.id = "chapter-scroll";
6972
- let $t = Lt;
6999
+ Lt2.id = "chapter-scroll";
7000
+ let $t = Lt2;
6973
7001
  function Tt(t2) {
6974
7002
  const e14 = t2[t2.length - 1];
6975
7003
  return { x: e14.origin.x + e14.size.width, y: e14.origin.y + e14.size.height };
6976
7004
  }
6977
- function Dt2(t2, e14) {
7005
+ function Dt(t2, e14) {
6978
7006
  const a3 = t2.origin.y, s9 = t2.origin.y + t2.size.height, o = e14.origin.y, r2 = e14.origin.y + e14.size.height, i2 = Math.max(s9, r2) - Math.min(a3, o);
6979
7007
  if (i2 <= 0) return 0;
6980
7008
  return Math.max(0, Math.min(s9, r2) - Math.max(a3, o)) / i2;
@@ -6985,13 +7013,13 @@ function Ot(t2, e14) {
6985
7013
  const o = (null == (a3 = t2.rectsPdfCoord) ? void 0 : a3.length) ? t2.rectsPdfCoord : [t2.rectPdfCoord], r2 = (null == (s9 = e14.rectsPdfCoord) ? void 0 : s9.length) ? e14.rectsPdfCoord : [e14.rectPdfCoord], i2 = t2.markerAnchor ?? Tt(o), n2 = e14.markerAnchor ?? Tt(r2);
6986
7014
  if (Math.hypot(i2.x - n2.x, i2.y - n2.y) <= 6) return true;
6987
7015
  for (const h2 of o) for (const t3 of r2) {
6988
- if (Dt2(h2, t3) < 0.5) continue;
7016
+ if (Dt(h2, t3) < 0.5) continue;
6989
7017
  const e15 = Math.max(h2.origin.x, t3.origin.x);
6990
7018
  if (Math.min(h2.origin.x + h2.size.width, t3.origin.x + t3.size.width) - e15 > 0.25 * Math.min(h2.size.width, t3.size.width)) return true;
6991
7019
  }
6992
7020
  return false;
6993
7021
  }
6994
- async function Gt(t2, e14, a3) {
7022
+ async function Gt2(t2, e14, a3) {
6995
7023
  t2.scrollToGlobalPageIndex(e14), await (function(t3, e15, a4 = 2500) {
6996
7024
  const s9 = t3.getLayout().items.find((t4) => t4.globalPageIndex === e15 && !t4.isPlaceholder);
6997
7025
  return s9 ? Promise.resolve(s9) : new Promise((s10) => {
@@ -7078,21 +7106,21 @@ const zt = class a2 extends BasePlugin {
7078
7106
  const e15 = t3.rectPdfCoord;
7079
7107
  return e15.origin.y + e15.size.height;
7080
7108
  })(e14.anchor);
7081
- await Gt(a3, s9, o);
7109
+ await Gt2(a3, s9, o);
7082
7110
  }
7083
7111
  };
7084
7112
  zt.id = "paragraph-bookmark";
7085
7113
  let At = zt;
7086
- function Bt(t2, e14) {
7114
+ function Ht(t2, e14) {
7087
7115
  const a3 = t2;
7088
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) };
7089
7117
  }
7090
- function Ht(t2) {
7091
- const e14 = Bt(void 0, { enabled: true }), a3 = Bt(void 0, { enabled: true }), s9 = Bt(void 0, { enabled: true });
7092
- 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 }) };
7093
7121
  }
7094
- PdfAnnotationSubtype.HIGHLIGHT, PdfAnnotationSubtype.UNDERLINE, PdfAnnotationSubtype.SQUIGGLY, PdfAnnotationSubtype.STRIKEOUT;
7095
- Ht();
7122
+ PdfAnnotationSubtype.HIGHLIGHT, PdfAnnotationSubtype.UNDERLINE, PdfAnnotationSubtype.SQUIGGLY, PdfAnnotationSubtype.STRIKEOUT, PdfAnnotationSubtype.HIGHLIGHT, PdfAnnotationSubtype.UNDERLINE, PdfAnnotationSubtype.SQUIGGLY, PdfAnnotationSubtype.STRIKEOUT;
7123
+ Bt();
7096
7124
  const se = 1;
7097
7125
  function oe(t2) {
7098
7126
  const e14 = new Uint8Array(t2);
@@ -7237,24 +7265,24 @@ function d(e14) {
7237
7265
  }
7238
7266
  export {
7239
7267
  se as CHAPTER_ANNOTATIONS_ARCHIVE_VERSION,
7240
- Le as CallbackPasswordProvider,
7268
+ ze as CallbackPasswordProvider,
7241
7269
  ChapterManagerPlugin,
7242
7270
  _sfc_main as ChapterPdfViewer,
7243
- Os as ChapterTreePanel,
7244
- aa as DEFAULT_CHAPTER_VIEWER_CONFIG,
7245
- ta as DEFAULT_CHAPTER_VIEWER_FEATURES,
7271
+ Es as ChapterTreePanel,
7272
+ ia as DEFAULT_CHAPTER_VIEWER_CONFIG,
7273
+ sa as DEFAULT_CHAPTER_VIEWER_FEATURES,
7246
7274
  EmbedPDF2 as EmbedPDF,
7247
- Ps as PdfChapterViewport,
7248
- Me as applySelectionMarkup,
7275
+ Ms as PdfChapterViewport,
7276
+ Se as applySelectionMarkup,
7249
7277
  d as buildChapterViewerCatalog,
7250
- qt as buildParagraphBookmarkAnchor,
7278
+ Ht$1 as buildParagraphBookmarkAnchor,
7251
7279
  ge as chapterAnnotationsArchiveToJson,
7252
7280
  me as chapterAnnotationsSnapshotToJson,
7253
7281
  h as chapterDescriptorFromTreeNode,
7254
- na as createChapterViewerBundle,
7255
- sa as createChapterViewerEditor,
7256
- la as createChapterViewerEditorOptions,
7257
- Jt as createPdfChapterEditor,
7282
+ ha as createChapterViewerBundle,
7283
+ oa as createChapterViewerEditor,
7284
+ da as createChapterViewerEditorOptions,
7285
+ ta as createPdfChapterEditor,
7258
7286
  t as defaultOverlapStrategy,
7259
7287
  Pe as downloadChapterAnnotationsArchive,
7260
7288
  we as downloadChapterAnnotationsSnapshot,