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

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
@@ -24,40 +24,45 @@ import { AnnotationLayer } from "@embedpdf/plugin-annotation/vue";
24
24
  import { RedactionLayer } from "@embedpdf/plugin-redaction/vue";
25
25
  import { RenderLayer } from "@embedpdf/plugin-render/vue";
26
26
  import { usePdfiumEngine } from "@embedpdf/engines/vue";
27
- const ve$1 = { position: "relative", height: "100%", width: "100%" }, be$1 = { highlight: { offsetY: 0 }, underline: { offsetY: 2.5 }, squiggly: { offsetY: 0 }, strikeout: { offsetY: 0 } }, Pe$1 = { highlight: PdfAnnotationSubtype.HIGHLIGHT, underline: PdfAnnotationSubtype.UNDERLINE, squiggly: PdfAnnotationSubtype.SQUIGGLY, strikeout: PdfAnnotationSubtype.STRIKEOUT };
28
- function we$1(e14, t2) {
27
+ const ve$1 = { position: "relative", height: "100%", width: "100%" }, be$1 = { userSelect: "none", WebkitUserSelect: "none" };
28
+ function Pe$1() {
29
+ var _a2;
30
+ "undefined" != typeof window && ((_a2 = window.getSelection()) == null ? void 0 : _a2.removeAllRanges());
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) {
29
34
  return 0 === t2 ? e14 : e14.map((e15) => ({ origin: { x: e15.origin.x, y: e15.origin.y + t2 }, size: { ...e15.size } }));
30
35
  }
31
- function ye(e14) {
36
+ function Ie(e14) {
32
37
  let t2 = 1 / 0, a3 = 1 / 0, s9 = -1 / 0, i2 = -1 / 0;
33
38
  for (const o of e14) t2 = Math.min(t2, o.origin.x), a3 = Math.min(a3, o.origin.y), s9 = Math.max(s9, o.origin.x + o.size.width), i2 = Math.max(i2, o.origin.y + o.size.height);
34
39
  return { origin: { x: t2, y: a3 }, size: { width: s9 - t2, height: i2 - a3 } };
35
40
  }
36
- function Ce(e14, t2, a3, s9, i2) {
41
+ function Me(e14, t2, a3, s9, i2) {
37
42
  const o = a3.forDocument(e14), r2 = s9.forDocument(e14);
38
43
  if (!o || !r2) return false;
39
44
  const n2 = "highlight" === t2 ? "highlight" : "underline" === t2 ? "underline" : "squiggly" === t2 ? "squiggly" : "strikeout", l = a3.getTool(n2);
40
45
  if (!l) return false;
41
46
  const h2 = l.defaults, d2 = (function(e15, t3) {
42
- return { ...be$1[e15], ...null == t3 ? void 0 : t3[e15] };
47
+ return { ...we$1[e15], ...null == t3 ? void 0 : t3[e15] };
43
48
  })(t2, i2), c = r2.getFormattedSelection();
44
49
  if (0 === c.length) return false;
45
50
  o.setLocked({ type: LockModeType.Exclude, categories: ["markup", "shape"] });
46
51
  for (const u of c) {
47
- const e15 = uuidV4(), a4 = d2.color ?? h2.color ?? h2.strokeColor, s10 = d2.opacity ?? h2.opacity, i3 = d2.thickness ?? h2.strokeWidth, r3 = d2.offsetY ?? 0, n3 = "underline" === t2 || "squiggly" === t2 || "strikeout" === t2 ? we$1(u.segmentRects, r3) : u.segmentRects, l2 = "underline" === t2 || "squiggly" === t2 || "strikeout" === t2 ? ye(n3) : u.rect;
48
- o.createAnnotation(u.pageIndex, { id: e15, created: /* @__PURE__ */ new Date(), flags: ["print"], type: Pe$1[t2], ..."highlight" === t2 ? { blendMode: PdfBlendMode.Multiply } : {}, strokeColor: a4, opacity: s10, ...null != i3 ? { strokeWidth: i3 } : {}, pageIndex: u.pageIndex, rect: l2, segmentRects: n3 });
52
+ const e15 = uuidV4(), a4 = d2.color ?? h2.color ?? h2.strokeColor, s10 = d2.opacity ?? h2.opacity, i3 = d2.thickness ?? h2.strokeWidth, r3 = d2.offsetY ?? 0, n3 = "underline" === t2 || "squiggly" === t2 || "strikeout" === t2 ? 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 });
49
54
  }
50
55
  return r2.clear(), true;
51
56
  }
52
- function Ie(e14, t2) {
57
+ function Se(e14, t2) {
53
58
  const a3 = e14;
54
59
  return false === e14 ? { ...t2, enabled: false } : true === e14 || void 0 === e14 ? { ...t2, enabled: t2.enabled ?? true } : { ...t2, ...a3, enabled: false !== (null == a3 ? void 0 : a3.enabled) };
55
60
  }
56
- function Me(e14) {
57
- const t2 = Ie(null == e14 ? void 0 : e14.markup, { enabled: true }), a3 = Ie(null == e14 ? void 0 : e14.bookmarks, { enabled: true }), s9 = Ie(null == e14 ? void 0 : e14.notes, { enabled: true });
58
- return { markup: t2, bookmarks: a3, notes: s9, zoom: Ie(null == e14 ? void 0 : e14.zoom, { enabled: true, min: 0.5, max: 3, initial: 1 }), selectionToolbar: Ie(void 0 === (null == e14 ? void 0 : e14.selectionToolbar) ? false !== t2.enabled || false !== s9.enabled : e14.selectionToolbar, { enabled: true }) };
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 }) };
59
64
  }
60
- class xe {
65
+ class Le {
61
66
  constructor(e14) {
62
67
  this.cb = e14;
63
68
  }
@@ -65,9 +70,9 @@ class xe {
65
70
  return this.cb(e14, t2);
66
71
  }
67
72
  }
68
- const De = "chapter-manager", Oe = { id: De, name: "Chapter Manager Plugin", version: "0.1.0", provides: ["chapter-manager"], requires: ["document-manager"], optional: [], defaultConfig: { manifest: { chapters: [] }, prefetchChapters: 1, unloadTimeoutMs: 6e4, autoActivateOnLoad: true } };
69
- const Ge = { kind: "first-wins" };
70
- function Ne(e14, t2, a3) {
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) {
71
76
  if (1 === t2.length) return t2[0].chapterId;
72
77
  switch (a3.kind) {
73
78
  case "first-wins":
@@ -85,7 +90,7 @@ function Ne(e14, t2, a3) {
85
90
  return a3.resolve(e14, t2);
86
91
  }
87
92
  }
88
- let Ae = class {
93
+ let _e = class {
89
94
  constructor(e14) {
90
95
  this._pages = e14, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
91
96
  for (const t2 of e14) {
@@ -119,8 +124,8 @@ let Ae = class {
119
124
  return a3 ? this._pages.indexOf(a3) : -1;
120
125
  }
121
126
  };
122
- function Ve(e14, t2 = Ge) {
123
- const a3 = (function(e15, t3 = Ge) {
127
+ function Ee(e14, t2 = Ae) {
128
+ const a3 = (function(e15, t3 = Ae) {
124
129
  const a4 = /* @__PURE__ */ new Map();
125
130
  for (const i3 of e15.chapters) {
126
131
  const [e16, t4] = i3.globalPageRange;
@@ -130,7 +135,7 @@ function Ve(e14, t2 = Ge) {
130
135
  }
131
136
  }
132
137
  const s10 = /* @__PURE__ */ new Map();
133
- for (const [i3, o2] of a4) s10.set(i3, Ne(i3, o2, t3));
138
+ for (const [i3, o2] of a4) s10.set(i3, Ve(i3, o2, t3));
134
139
  return s10;
135
140
  })(e14, t2), s9 = /* @__PURE__ */ new Map();
136
141
  for (const n2 of e14.chapters) s9.set(n2.chapterId, n2);
@@ -142,14 +147,14 @@ function Ve(e14, t2 = Ge) {
142
147
  const [i3] = t3.globalPageRange, [l] = t3.localPageRange, h2 = l + (n2 - i3);
143
148
  o.push({ globalPageIndex: r2++, globalPageNumber: n2, chapterId: e15, localPageIndex: h2 });
144
149
  }
145
- return new Ae(o);
150
+ return new _e(o);
146
151
  }
147
- const _e = class e extends BasePlugin {
152
+ const Re = class e extends BasePlugin {
148
153
  constructor(e14, t2) {
149
- super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = Ge, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
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);
150
155
  }
151
156
  async initialize(e14) {
152
- if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? Ge, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
157
+ if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? Ae, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
153
158
  this.isOwnedChapter(e15.id) && (this.passwordAttempts.delete(e15.id), this.updateStatus(e15.id, "loaded"));
154
159
  }), this.documentManager.provides().onDocumentClosed((e15) => {
155
160
  this.isOwnedChapter(e15) && this.updateStatus(e15, "closed");
@@ -184,7 +189,7 @@ const _e = class e extends BasePlugin {
184
189
  const s9 = new Set(this.chapterStatus.keys()), i2 = new Set(t2.chapters.map((e14) => e14.chapterId));
185
190
  for (const e14 of s9) i2.has(e14) || (this.closeChapter(e14), this.chapterStatus.delete(e14));
186
191
  for (const e14 of t2.chapters) this.chapterStatus.has(e14.chapterId) || this.chapterStatus.set(e14.chapterId, "idle");
187
- this.manifest = t2, this.virtualPageMap = Ve(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
192
+ this.manifest = t2, this.virtualPageMap = Ee(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
188
193
  }
189
194
  eagerPrefetchFromManifest() {
190
195
  const e14 = this.config.prefetchChapters ?? 0;
@@ -322,11 +327,11 @@ const _e = class e extends BasePlugin {
322
327
  this.chapterStatus.get(e14) !== t2 && (this.chapterStatus.set(e14, t2), this.statusChange$.emit({ chapterId: e14, status: t2, ..."error" === t2 && a3 ? { error: { message: a3 } } : {} }));
323
328
  }
324
329
  };
325
- _e.id = "chapter-manager";
326
- let Ee = _e;
327
- const Re = { manifest: Oe, create: (e14) => new Ee(De, e14), reducer: (e14) => e14, initialState: {} }, Fe = "chapter-scroll", Ue = { id: Fe, name: "Chapter Scroll Plugin", version: "0.1.0", provides: ["chapter-scroll"], requires: ["chapter-manager"], optional: [], defaultConfig: { placeholderPageHeight: 1200, placeholderPageWidth: 900, bufferSize: 2, pageGap: 20 } };
328
- const qe = { kind: "first-wins" };
329
- function We(e14, t2, a3) {
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) {
330
335
  if (1 === t2.length) return t2[0].chapterId;
331
336
  switch (a3.kind) {
332
337
  case "first-wins":
@@ -344,7 +349,7 @@ function We(e14, t2, a3) {
344
349
  return a3.resolve(e14, t2);
345
350
  }
346
351
  }
347
- let He = class {
352
+ let je = class {
348
353
  constructor(e14) {
349
354
  this._pages = e14, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
350
355
  for (const t2 of e14) {
@@ -378,8 +383,8 @@ let He = class {
378
383
  return a3 ? this._pages.indexOf(a3) : -1;
379
384
  }
380
385
  };
381
- function Be(e14, t2 = qe) {
382
- const a3 = (function(e15, t3 = qe) {
386
+ function Ze(e14, t2 = He) {
387
+ const a3 = (function(e15, t3 = He) {
383
388
  const a4 = /* @__PURE__ */ new Map();
384
389
  for (const i3 of e15.chapters) {
385
390
  const [e16, t4] = i3.globalPageRange;
@@ -389,7 +394,7 @@ function Be(e14, t2 = qe) {
389
394
  }
390
395
  }
391
396
  const s10 = /* @__PURE__ */ new Map();
392
- for (const [i3, o2] of a4) s10.set(i3, We(i3, o2, t3));
397
+ for (const [i3, o2] of a4) s10.set(i3, Be(i3, o2, t3));
393
398
  return s10;
394
399
  })(e14, t2), s9 = /* @__PURE__ */ new Map();
395
400
  for (const n2 of e14.chapters) s9.set(n2.chapterId, n2);
@@ -401,14 +406,14 @@ function Be(e14, t2 = qe) {
401
406
  const [i3] = t3.globalPageRange, [l] = t3.localPageRange, h2 = l + (n2 - i3);
402
407
  o.push({ globalPageIndex: r2++, globalPageNumber: n2, chapterId: e15, localPageIndex: h2 });
403
408
  }
404
- return new He(o);
409
+ return new je(o);
405
410
  }
406
- const je = class e2 extends BasePlugin {
411
+ const Ye = class e2 extends BasePlugin {
407
412
  constructor(e14, t2) {
408
- super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = qe, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
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);
409
414
  }
410
415
  async initialize(e14) {
411
- if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? qe, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
416
+ if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? He, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
412
417
  this.isOwnedChapter(e15.id) && (this.passwordAttempts.delete(e15.id), this.updateStatus(e15.id, "loaded"));
413
418
  }), this.documentManager.provides().onDocumentClosed((e15) => {
414
419
  this.isOwnedChapter(e15) && this.updateStatus(e15, "closed");
@@ -443,7 +448,7 @@ const je = class e2 extends BasePlugin {
443
448
  const s9 = new Set(this.chapterStatus.keys()), i2 = new Set(t2.chapters.map((e14) => e14.chapterId));
444
449
  for (const e14 of s9) i2.has(e14) || (this.closeChapter(e14), this.chapterStatus.delete(e14));
445
450
  for (const e14 of t2.chapters) this.chapterStatus.has(e14.chapterId) || this.chapterStatus.set(e14.chapterId, "idle");
446
- this.manifest = t2, this.virtualPageMap = Be(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
451
+ this.manifest = t2, this.virtualPageMap = Ze(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
447
452
  }
448
453
  eagerPrefetchFromManifest() {
449
454
  const e14 = this.config.prefetchChapters ?? 0;
@@ -581,9 +586,9 @@ const je = class e2 extends BasePlugin {
581
586
  this.chapterStatus.get(e14) !== t2 && (this.chapterStatus.set(e14, t2), this.statusChange$.emit({ chapterId: e14, status: t2, ..."error" === t2 && a3 ? { error: { message: a3 } } : {} }));
582
587
  }
583
588
  };
584
- je.id = "chapter-manager";
585
- let Ze = je;
586
- function Ye(e14, t2) {
589
+ Ye.id = "chapter-manager";
590
+ let Ke = Ye;
591
+ function Xe(e14, t2) {
587
592
  if (e14 === t2) return true;
588
593
  if (e14.totalHeight !== t2.totalHeight || e14.totalWidth !== t2.totalWidth || e14.pageGap !== t2.pageGap || e14.items.length !== t2.items.length) return false;
589
594
  for (let a3 = 0; a3 < e14.items.length; a3++) {
@@ -592,9 +597,9 @@ function Ye(e14, t2) {
592
597
  }
593
598
  return true;
594
599
  }
595
- const Ke = class extends BasePlugin {
600
+ const Qe = class extends BasePlugin {
596
601
  constructor(e14, t2) {
597
- super(e14, t2), this.layoutChange$ = createBehaviorEmitter(void 0, Ye), this.visibleChange$ = createBehaviorEmitter(), this.virtualPageMap = null, this.pageSizes = /* @__PURE__ */ new Map(), this.offsets = [], this.totalHeight = 0, this.totalWidth = 0, this.viewportEl = null, this.viewportObservers = null, this.currentVisible = [], this.currentGlobalPageIndex = 0, this.chapterManagerUnsubs = [], this.chapterManager = this.registry.getPlugin(Ze.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
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);
598
603
  }
599
604
  async initialize(e14) {
600
605
  this.config = { placeholderPageHeight: e14.placeholderPageHeight ?? 1200, placeholderPageWidth: e14.placeholderPageWidth ?? 900, bufferSize: e14.bufferSize ?? 2, pageGap: e14.pageGap ?? 20 }, this.virtualPageMap = this.chapterManager.provides().getVirtualPageMap(), this.rebuildOffsets(), this.chapterManagerUnsubs.push(this.chapterManager.provides().onManifestChange(({ map: e15 }) => {
@@ -771,12 +776,12 @@ const Ke = class extends BasePlugin {
771
776
  a3 && this.scrollToIndex(a3.globalPageIndex, t2);
772
777
  }
773
778
  };
774
- Ke.id = "chapter-scroll";
775
- let Xe = Ke;
776
- const Qe = { manifest: Ue, create: (e14) => new Xe(Fe, e14), reducer: (e14) => e14, initialState: {} }, Je = "note", et$1 = { id: Je, name: "Note Plugin", version: "0.1.0", provides: ["note"], requires: ["selection", "chapter-scroll", "chapter-manager"], optional: [], defaultConfig: { callbacks: { onCreateNote: async () => null, onActivateNote: () => {
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: () => {
777
782
  } }, markerSize: 18 } };
778
- const tt$1 = { kind: "first-wins" };
779
- function at$1(e14, t2, a3) {
783
+ const st$1 = { kind: "first-wins" };
784
+ function it$1(e14, t2, a3) {
780
785
  if (1 === t2.length) return t2[0].chapterId;
781
786
  switch (a3.kind) {
782
787
  case "first-wins":
@@ -794,7 +799,7 @@ function at$1(e14, t2, a3) {
794
799
  return a3.resolve(e14, t2);
795
800
  }
796
801
  }
797
- let st$1 = class st {
802
+ let ot$1 = class ot {
798
803
  constructor(e14) {
799
804
  this._pages = e14, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
800
805
  for (const t2 of e14) {
@@ -828,8 +833,8 @@ let st$1 = class st {
828
833
  return a3 ? this._pages.indexOf(a3) : -1;
829
834
  }
830
835
  };
831
- function it$1(e14, t2 = tt$1) {
832
- const a3 = (function(e15, t3 = tt$1) {
836
+ function rt$1(e14, t2 = st$1) {
837
+ const a3 = (function(e15, t3 = st$1) {
833
838
  const a4 = /* @__PURE__ */ new Map();
834
839
  for (const i3 of e15.chapters) {
835
840
  const [e16, t4] = i3.globalPageRange;
@@ -839,7 +844,7 @@ function it$1(e14, t2 = tt$1) {
839
844
  }
840
845
  }
841
846
  const s10 = /* @__PURE__ */ new Map();
842
- for (const [i3, o2] of a4) s10.set(i3, at$1(i3, o2, t3));
847
+ for (const [i3, o2] of a4) s10.set(i3, it$1(i3, o2, t3));
843
848
  return s10;
844
849
  })(e14, t2), s9 = /* @__PURE__ */ new Map();
845
850
  for (const n2 of e14.chapters) s9.set(n2.chapterId, n2);
@@ -851,14 +856,14 @@ function it$1(e14, t2 = tt$1) {
851
856
  const [i3] = t3.globalPageRange, [l] = t3.localPageRange, h2 = l + (n2 - i3);
852
857
  o.push({ globalPageIndex: r2++, globalPageNumber: n2, chapterId: e15, localPageIndex: h2 });
853
858
  }
854
- return new st$1(o);
859
+ return new ot$1(o);
855
860
  }
856
- const ot$1 = class e3 extends BasePlugin {
861
+ const nt$1 = class e3 extends BasePlugin {
857
862
  constructor(e14, t2) {
858
- super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = tt$1, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
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);
859
864
  }
860
865
  async initialize(e14) {
861
- if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? tt$1, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
866
+ if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? st$1, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
862
867
  this.isOwnedChapter(e15.id) && (this.passwordAttempts.delete(e15.id), this.updateStatus(e15.id, "loaded"));
863
868
  }), this.documentManager.provides().onDocumentClosed((e15) => {
864
869
  this.isOwnedChapter(e15) && this.updateStatus(e15, "closed");
@@ -893,7 +898,7 @@ const ot$1 = class e3 extends BasePlugin {
893
898
  const s9 = new Set(this.chapterStatus.keys()), i2 = new Set(t2.chapters.map((e14) => e14.chapterId));
894
899
  for (const e14 of s9) i2.has(e14) || (this.closeChapter(e14), this.chapterStatus.delete(e14));
895
900
  for (const e14 of t2.chapters) this.chapterStatus.has(e14.chapterId) || this.chapterStatus.set(e14.chapterId, "idle");
896
- this.manifest = t2, this.virtualPageMap = it$1(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
901
+ this.manifest = t2, this.virtualPageMap = rt$1(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
897
902
  }
898
903
  eagerPrefetchFromManifest() {
899
904
  const e14 = this.config.prefetchChapters ?? 0;
@@ -1031,10 +1036,10 @@ const ot$1 = class e3 extends BasePlugin {
1031
1036
  this.chapterStatus.get(e14) !== t2 && (this.chapterStatus.set(e14, t2), this.statusChange$.emit({ chapterId: e14, status: t2, ..."error" === t2 && a3 ? { error: { message: a3 } } : {} }));
1032
1037
  }
1033
1038
  };
1034
- ot$1.id = "chapter-manager";
1035
- let rt$1 = ot$1;
1036
- const nt$1 = { kind: "first-wins" };
1037
- function lt$1(e14, t2, a3) {
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) {
1038
1043
  if (1 === t2.length) return t2[0].chapterId;
1039
1044
  switch (a3.kind) {
1040
1045
  case "first-wins":
@@ -1052,7 +1057,7 @@ function lt$1(e14, t2, a3) {
1052
1057
  return a3.resolve(e14, t2);
1053
1058
  }
1054
1059
  }
1055
- let ht$1 = class ht {
1060
+ let ct$1 = class ct {
1056
1061
  constructor(e14) {
1057
1062
  this._pages = e14, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
1058
1063
  for (const t2 of e14) {
@@ -1086,8 +1091,8 @@ let ht$1 = class ht {
1086
1091
  return a3 ? this._pages.indexOf(a3) : -1;
1087
1092
  }
1088
1093
  };
1089
- function dt$1(e14, t2 = nt$1) {
1090
- const a3 = (function(e15, t3 = nt$1) {
1094
+ function ut(e14, t2 = ht$1) {
1095
+ const a3 = (function(e15, t3 = ht$1) {
1091
1096
  const a4 = /* @__PURE__ */ new Map();
1092
1097
  for (const i3 of e15.chapters) {
1093
1098
  const [e16, t4] = i3.globalPageRange;
@@ -1097,7 +1102,7 @@ function dt$1(e14, t2 = nt$1) {
1097
1102
  }
1098
1103
  }
1099
1104
  const s10 = /* @__PURE__ */ new Map();
1100
- for (const [i3, o2] of a4) s10.set(i3, lt$1(i3, o2, t3));
1105
+ for (const [i3, o2] of a4) s10.set(i3, dt$1(i3, o2, t3));
1101
1106
  return s10;
1102
1107
  })(e14, t2), s9 = /* @__PURE__ */ new Map();
1103
1108
  for (const n2 of e14.chapters) s9.set(n2.chapterId, n2);
@@ -1109,14 +1114,14 @@ function dt$1(e14, t2 = nt$1) {
1109
1114
  const [i3] = t3.globalPageRange, [l] = t3.localPageRange, h2 = l + (n2 - i3);
1110
1115
  o.push({ globalPageIndex: r2++, globalPageNumber: n2, chapterId: e15, localPageIndex: h2 });
1111
1116
  }
1112
- return new ht$1(o);
1117
+ return new ct$1(o);
1113
1118
  }
1114
- const ct$1 = class e4 extends BasePlugin {
1119
+ const pt = class e4 extends BasePlugin {
1115
1120
  constructor(e14, t2) {
1116
- super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = nt$1, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
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);
1117
1122
  }
1118
1123
  async initialize(e14) {
1119
- if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? nt$1, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
1124
+ if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? ht$1, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
1120
1125
  this.isOwnedChapter(e15.id) && (this.passwordAttempts.delete(e15.id), this.updateStatus(e15.id, "loaded"));
1121
1126
  }), this.documentManager.provides().onDocumentClosed((e15) => {
1122
1127
  this.isOwnedChapter(e15) && this.updateStatus(e15, "closed");
@@ -1151,7 +1156,7 @@ const ct$1 = class e4 extends BasePlugin {
1151
1156
  const s9 = new Set(this.chapterStatus.keys()), i2 = new Set(t2.chapters.map((e14) => e14.chapterId));
1152
1157
  for (const e14 of s9) i2.has(e14) || (this.closeChapter(e14), this.chapterStatus.delete(e14));
1153
1158
  for (const e14 of t2.chapters) this.chapterStatus.has(e14.chapterId) || this.chapterStatus.set(e14.chapterId, "idle");
1154
- this.manifest = t2, this.virtualPageMap = dt$1(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
1159
+ this.manifest = t2, this.virtualPageMap = ut(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
1155
1160
  }
1156
1161
  eagerPrefetchFromManifest() {
1157
1162
  const e14 = this.config.prefetchChapters ?? 0;
@@ -1289,9 +1294,9 @@ const ct$1 = class e4 extends BasePlugin {
1289
1294
  this.chapterStatus.get(e14) !== t2 && (this.chapterStatus.set(e14, t2), this.statusChange$.emit({ chapterId: e14, status: t2, ..."error" === t2 && a3 ? { error: { message: a3 } } : {} }));
1290
1295
  }
1291
1296
  };
1292
- ct$1.id = "chapter-manager";
1293
- let ut = ct$1;
1294
- function pt(e14, t2) {
1297
+ pt.id = "chapter-manager";
1298
+ let gt = pt;
1299
+ function ft$1(e14, t2) {
1295
1300
  if (e14 === t2) return true;
1296
1301
  if (e14.totalHeight !== t2.totalHeight || e14.totalWidth !== t2.totalWidth || e14.pageGap !== t2.pageGap || e14.items.length !== t2.items.length) return false;
1297
1302
  for (let a3 = 0; a3 < e14.items.length; a3++) {
@@ -1300,9 +1305,9 @@ function pt(e14, t2) {
1300
1305
  }
1301
1306
  return true;
1302
1307
  }
1303
- const gt = class extends BasePlugin {
1308
+ const mt$1 = class mt extends BasePlugin {
1304
1309
  constructor(e14, t2) {
1305
- super(e14, t2), this.layoutChange$ = createBehaviorEmitter(void 0, pt), this.visibleChange$ = createBehaviorEmitter(), this.virtualPageMap = null, this.pageSizes = /* @__PURE__ */ new Map(), this.offsets = [], this.totalHeight = 0, this.totalWidth = 0, this.viewportEl = null, this.viewportObservers = null, this.currentVisible = [], this.currentGlobalPageIndex = 0, this.chapterManagerUnsubs = [], this.chapterManager = this.registry.getPlugin(ut.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
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);
1306
1311
  }
1307
1312
  async initialize(e14) {
1308
1313
  this.config = { placeholderPageHeight: e14.placeholderPageHeight ?? 1200, placeholderPageWidth: e14.placeholderPageWidth ?? 900, bufferSize: e14.bufferSize ?? 2, pageGap: e14.pageGap ?? 20 }, this.virtualPageMap = this.chapterManager.provides().getVirtualPageMap(), this.rebuildOffsets(), this.chapterManagerUnsubs.push(this.chapterManager.provides().onManifestChange(({ map: e15 }) => {
@@ -1479,11 +1484,11 @@ const gt = class extends BasePlugin {
1479
1484
  a3 && this.scrollToIndex(a3.globalPageIndex, t2);
1480
1485
  }
1481
1486
  };
1482
- gt.id = "chapter-scroll";
1483
- let ft$1 = gt;
1484
- const mt$1 = class e5 extends BasePlugin {
1487
+ mt$1.id = "chapter-scroll";
1488
+ let vt$1 = mt$1;
1489
+ const bt$1 = class e5 extends BasePlugin {
1485
1490
  constructor(e14, t2) {
1486
- super(e14, t2), this.notesChange$ = createBehaviorEmitter([]), this.noteActivated$ = createEmitter(), this.notes = /* @__PURE__ */ new Map(), this.chapterScroll = this.registry.getPlugin(ft$1.id), this.chapterManager = this.registry.getPlugin(rt$1.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
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);
1487
1492
  }
1488
1493
  async initialize(t2) {
1489
1494
  if (this.config = t2, t2.callbacks.loadNotes) try {
@@ -1521,7 +1526,7 @@ const mt$1 = class e5 extends BasePlugin {
1521
1526
  this.notesChange$.emit(this.listAll());
1522
1527
  }
1523
1528
  buildDraft(e14) {
1524
- return { chapterId: e14.chapterId, localPageIndex: e14.localPageIndex, globalPageNumber: e14.globalPageNumber, globalPageIndex: e14.globalPageIndex, rectsPdfCoord: e14.rectsPdfCoord, endAnchor: bt$1(e14.rectsPdfCoord), selectedText: e14.selectedText, content: e14.content };
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 };
1525
1530
  }
1526
1531
  async requestCreateFromSelection(e14) {
1527
1532
  if (0 === e14.rectsPdfCoord.length) return null;
@@ -1588,15 +1593,15 @@ const mt$1 = class e5 extends BasePlugin {
1588
1593
  });
1589
1594
  }
1590
1595
  };
1591
- mt$1.id = "note";
1592
- let vt$1 = mt$1;
1593
- function bt$1(e14) {
1596
+ bt$1.id = "note";
1597
+ let Pt$1 = bt$1;
1598
+ function wt$1(e14) {
1594
1599
  const t2 = e14[e14.length - 1];
1595
1600
  return { x: t2.origin.x + t2.size.width, y: t2.origin.y + t2.size.height };
1596
1601
  }
1597
- const Pt$1 = { manifest: et$1, create: (e14) => new vt$1(Je, e14), reducer: (e14) => e14, initialState: {} }, wt$1 = "paragraph-bookmark", yt$1 = { id: wt$1, name: "Paragraph Bookmark Plugin", version: "0.1.0", provides: ["paragraph-bookmark"], requires: ["chapter-scroll", "chapter-manager"], optional: [], defaultConfig: {} };
1598
- const Ct$1 = { kind: "first-wins" };
1599
- function It$1(e14, t2, a3) {
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) {
1600
1605
  if (1 === t2.length) return t2[0].chapterId;
1601
1606
  switch (a3.kind) {
1602
1607
  case "first-wins":
@@ -1614,7 +1619,7 @@ function It$1(e14, t2, a3) {
1614
1619
  return a3.resolve(e14, t2);
1615
1620
  }
1616
1621
  }
1617
- let Mt$1 = class Mt {
1622
+ let xt$1 = class xt {
1618
1623
  constructor(e14) {
1619
1624
  this._pages = e14, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
1620
1625
  for (const t2 of e14) {
@@ -1648,8 +1653,8 @@ let Mt$1 = class Mt {
1648
1653
  return a3 ? this._pages.indexOf(a3) : -1;
1649
1654
  }
1650
1655
  };
1651
- function St$1(e14, t2 = Ct$1) {
1652
- const a3 = (function(e15, t3 = Ct$1) {
1656
+ function kt$1(e14, t2 = Mt$1) {
1657
+ const a3 = (function(e15, t3 = Mt$1) {
1653
1658
  const a4 = /* @__PURE__ */ new Map();
1654
1659
  for (const i3 of e15.chapters) {
1655
1660
  const [e16, t4] = i3.globalPageRange;
@@ -1659,7 +1664,7 @@ function St$1(e14, t2 = Ct$1) {
1659
1664
  }
1660
1665
  }
1661
1666
  const s10 = /* @__PURE__ */ new Map();
1662
- for (const [i3, o2] of a4) s10.set(i3, It$1(i3, o2, t3));
1667
+ for (const [i3, o2] of a4) s10.set(i3, St$1(i3, o2, t3));
1663
1668
  return s10;
1664
1669
  })(e14, t2), s9 = /* @__PURE__ */ new Map();
1665
1670
  for (const n2 of e14.chapters) s9.set(n2.chapterId, n2);
@@ -1671,14 +1676,14 @@ function St$1(e14, t2 = Ct$1) {
1671
1676
  const [i3] = t3.globalPageRange, [l] = t3.localPageRange, h2 = l + (n2 - i3);
1672
1677
  o.push({ globalPageIndex: r2++, globalPageNumber: n2, chapterId: e15, localPageIndex: h2 });
1673
1678
  }
1674
- return new Mt$1(o);
1679
+ return new xt$1(o);
1675
1680
  }
1676
- const xt$1 = class e6 extends BasePlugin {
1681
+ const Lt$1 = class e6 extends BasePlugin {
1677
1682
  constructor(e14, t2) {
1678
- super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = Ct$1, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
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);
1679
1684
  }
1680
1685
  async initialize(e14) {
1681
- if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? Ct$1, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
1686
+ if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? Mt$1, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
1682
1687
  this.isOwnedChapter(e15.id) && (this.passwordAttempts.delete(e15.id), this.updateStatus(e15.id, "loaded"));
1683
1688
  }), this.documentManager.provides().onDocumentClosed((e15) => {
1684
1689
  this.isOwnedChapter(e15) && this.updateStatus(e15, "closed");
@@ -1713,7 +1718,7 @@ const xt$1 = class e6 extends BasePlugin {
1713
1718
  const s9 = new Set(this.chapterStatus.keys()), i2 = new Set(t2.chapters.map((e14) => e14.chapterId));
1714
1719
  for (const e14 of s9) i2.has(e14) || (this.closeChapter(e14), this.chapterStatus.delete(e14));
1715
1720
  for (const e14 of t2.chapters) this.chapterStatus.has(e14.chapterId) || this.chapterStatus.set(e14.chapterId, "idle");
1716
- this.manifest = t2, this.virtualPageMap = St$1(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
1721
+ this.manifest = t2, this.virtualPageMap = kt$1(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
1717
1722
  }
1718
1723
  eagerPrefetchFromManifest() {
1719
1724
  const e14 = this.config.prefetchChapters ?? 0;
@@ -1851,10 +1856,10 @@ const xt$1 = class e6 extends BasePlugin {
1851
1856
  this.chapterStatus.get(e14) !== t2 && (this.chapterStatus.set(e14, t2), this.statusChange$.emit({ chapterId: e14, status: t2, ..."error" === t2 && a3 ? { error: { message: a3 } } : {} }));
1852
1857
  }
1853
1858
  };
1854
- xt$1.id = "chapter-manager";
1855
- let kt$1 = xt$1;
1856
- const Lt$1 = { kind: "first-wins" };
1857
- function $t$1(e14, t2, a3) {
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) {
1858
1863
  if (1 === t2.length) return t2[0].chapterId;
1859
1864
  switch (a3.kind) {
1860
1865
  case "first-wins":
@@ -1872,7 +1877,7 @@ function $t$1(e14, t2, a3) {
1872
1877
  return a3.resolve(e14, t2);
1873
1878
  }
1874
1879
  }
1875
- let zt$1 = class zt {
1880
+ let Dt$1 = class Dt {
1876
1881
  constructor(e14) {
1877
1882
  this._pages = e14, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
1878
1883
  for (const t2 of e14) {
@@ -1906,8 +1911,8 @@ let zt$1 = class zt {
1906
1911
  return a3 ? this._pages.indexOf(a3) : -1;
1907
1912
  }
1908
1913
  };
1909
- function Tt$1(e14, t2 = Lt$1) {
1910
- const a3 = (function(e15, t3 = Lt$1) {
1914
+ function Ot$1(e14, t2 = zt$1) {
1915
+ const a3 = (function(e15, t3 = zt$1) {
1911
1916
  const a4 = /* @__PURE__ */ new Map();
1912
1917
  for (const i3 of e15.chapters) {
1913
1918
  const [e16, t4] = i3.globalPageRange;
@@ -1917,7 +1922,7 @@ function Tt$1(e14, t2 = Lt$1) {
1917
1922
  }
1918
1923
  }
1919
1924
  const s10 = /* @__PURE__ */ new Map();
1920
- for (const [i3, o2] of a4) s10.set(i3, $t$1(i3, o2, t3));
1925
+ for (const [i3, o2] of a4) s10.set(i3, Tt$1(i3, o2, t3));
1921
1926
  return s10;
1922
1927
  })(e14, t2), s9 = /* @__PURE__ */ new Map();
1923
1928
  for (const n2 of e14.chapters) s9.set(n2.chapterId, n2);
@@ -1929,14 +1934,14 @@ function Tt$1(e14, t2 = Lt$1) {
1929
1934
  const [i3] = t3.globalPageRange, [l] = t3.localPageRange, h2 = l + (n2 - i3);
1930
1935
  o.push({ globalPageIndex: r2++, globalPageNumber: n2, chapterId: e15, localPageIndex: h2 });
1931
1936
  }
1932
- return new zt$1(o);
1937
+ return new Dt$1(o);
1933
1938
  }
1934
- const Dt$1 = class e7 extends BasePlugin {
1939
+ const Gt$1 = class e7 extends BasePlugin {
1935
1940
  constructor(e14, t2) {
1936
- super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = Lt$1, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
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);
1937
1942
  }
1938
1943
  async initialize(e14) {
1939
- if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? Lt$1, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
1944
+ if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? zt$1, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
1940
1945
  this.isOwnedChapter(e15.id) && (this.passwordAttempts.delete(e15.id), this.updateStatus(e15.id, "loaded"));
1941
1946
  }), this.documentManager.provides().onDocumentClosed((e15) => {
1942
1947
  this.isOwnedChapter(e15) && this.updateStatus(e15, "closed");
@@ -1971,7 +1976,7 @@ const Dt$1 = class e7 extends BasePlugin {
1971
1976
  const s9 = new Set(this.chapterStatus.keys()), i2 = new Set(t2.chapters.map((e14) => e14.chapterId));
1972
1977
  for (const e14 of s9) i2.has(e14) || (this.closeChapter(e14), this.chapterStatus.delete(e14));
1973
1978
  for (const e14 of t2.chapters) this.chapterStatus.has(e14.chapterId) || this.chapterStatus.set(e14.chapterId, "idle");
1974
- this.manifest = t2, this.virtualPageMap = Tt$1(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
1979
+ this.manifest = t2, this.virtualPageMap = Ot$1(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
1975
1980
  }
1976
1981
  eagerPrefetchFromManifest() {
1977
1982
  const e14 = this.config.prefetchChapters ?? 0;
@@ -2109,9 +2114,9 @@ const Dt$1 = class e7 extends BasePlugin {
2109
2114
  this.chapterStatus.get(e14) !== t2 && (this.chapterStatus.set(e14, t2), this.statusChange$.emit({ chapterId: e14, status: t2, ..."error" === t2 && a3 ? { error: { message: a3 } } : {} }));
2110
2115
  }
2111
2116
  };
2112
- Dt$1.id = "chapter-manager";
2113
- let Ot$1 = Dt$1;
2114
- function Gt$1(e14, t2) {
2117
+ Gt$1.id = "chapter-manager";
2118
+ let Nt = Gt$1;
2119
+ function At$1(e14, t2) {
2115
2120
  if (e14 === t2) return true;
2116
2121
  if (e14.totalHeight !== t2.totalHeight || e14.totalWidth !== t2.totalWidth || e14.pageGap !== t2.pageGap || e14.items.length !== t2.items.length) return false;
2117
2122
  for (let a3 = 0; a3 < e14.items.length; a3++) {
@@ -2120,9 +2125,9 @@ function Gt$1(e14, t2) {
2120
2125
  }
2121
2126
  return true;
2122
2127
  }
2123
- const Nt = class extends BasePlugin {
2128
+ const Vt = class extends BasePlugin {
2124
2129
  constructor(e14, t2) {
2125
- super(e14, t2), this.layoutChange$ = createBehaviorEmitter(void 0, Gt$1), this.visibleChange$ = createBehaviorEmitter(), this.virtualPageMap = null, this.pageSizes = /* @__PURE__ */ new Map(), this.offsets = [], this.totalHeight = 0, this.totalWidth = 0, this.viewportEl = null, this.viewportObservers = null, this.currentVisible = [], this.currentGlobalPageIndex = 0, this.chapterManagerUnsubs = [], this.chapterManager = this.registry.getPlugin(Ot$1.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
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);
2126
2131
  }
2127
2132
  async initialize(e14) {
2128
2133
  this.config = { placeholderPageHeight: e14.placeholderPageHeight ?? 1200, placeholderPageWidth: e14.placeholderPageWidth ?? 900, bufferSize: e14.bufferSize ?? 2, pageGap: e14.pageGap ?? 20 }, this.virtualPageMap = this.chapterManager.provides().getVirtualPageMap(), this.rebuildOffsets(), this.chapterManagerUnsubs.push(this.chapterManager.provides().onManifestChange(({ map: e15 }) => {
@@ -2299,41 +2304,41 @@ const Nt = class extends BasePlugin {
2299
2304
  a3 && this.scrollToIndex(a3.globalPageIndex, t2);
2300
2305
  }
2301
2306
  };
2302
- Nt.id = "chapter-scroll";
2303
- let At$1 = Nt;
2304
- function Vt(e14) {
2307
+ Vt.id = "chapter-scroll";
2308
+ let _t = Vt;
2309
+ function Et(e14) {
2305
2310
  if (0 === e14.length) throw new Error("unionRects: empty rects");
2306
2311
  let t2 = 1 / 0, a3 = 1 / 0, s9 = -1 / 0, i2 = -1 / 0;
2307
2312
  for (const o of e14) t2 = Math.min(t2, o.origin.x), a3 = Math.min(a3, o.origin.y), s9 = Math.max(s9, o.origin.x + o.size.width), i2 = Math.max(i2, o.origin.y + o.size.height);
2308
2313
  return { origin: { x: t2, y: a3 }, size: { width: s9 - t2, height: i2 - a3 } };
2309
2314
  }
2310
- function _t(e14) {
2315
+ function Rt(e14) {
2311
2316
  const t2 = e14[e14.length - 1];
2312
2317
  return { x: t2.origin.x + t2.size.width, y: t2.origin.y + t2.size.height };
2313
2318
  }
2314
- function Et(e14, t2) {
2319
+ function Ft(e14, t2) {
2315
2320
  const a3 = e14.origin.y, s9 = e14.origin.y + e14.size.height, i2 = t2.origin.y, o = t2.origin.y + t2.size.height, r2 = Math.max(s9, o) - Math.min(a3, i2);
2316
2321
  if (r2 <= 0) return 0;
2317
2322
  return Math.max(0, Math.min(s9, o) - Math.max(a3, i2)) / r2;
2318
2323
  }
2319
- function Rt(e14, t2) {
2324
+ function Ut(e14, t2) {
2320
2325
  var a3, s9;
2321
2326
  if (e14.chapterId !== t2.chapterId || e14.localPageIndex !== t2.localPageIndex) return false;
2322
- const i2 = (null == (a3 = e14.rectsPdfCoord) ? void 0 : a3.length) ? e14.rectsPdfCoord : [e14.rectPdfCoord], o = (null == (s9 = t2.rectsPdfCoord) ? void 0 : s9.length) ? t2.rectsPdfCoord : [t2.rectPdfCoord], r2 = e14.markerAnchor ?? _t(i2), n2 = t2.markerAnchor ?? _t(o);
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);
2323
2328
  if (Math.hypot(r2.x - n2.x, r2.y - n2.y) <= 6) return true;
2324
2329
  for (const l of i2) for (const e15 of o) {
2325
- if (Et(l, e15) < 0.5) continue;
2330
+ if (Ft(l, e15) < 0.5) continue;
2326
2331
  const t3 = Math.max(l.origin.x, e15.origin.x);
2327
2332
  if (Math.min(l.origin.x + l.size.width, e15.origin.x + e15.size.width) - t3 > 0.25 * Math.min(l.size.width, e15.size.width)) return true;
2328
2333
  }
2329
2334
  return false;
2330
2335
  }
2331
- function Ft(e14, t2, a3, s9) {
2336
+ function qt(e14, t2, a3, s9) {
2332
2337
  const i2 = a3.length > 0 ? a3 : [];
2333
2338
  if (0 === i2.length) throw new Error("buildParagraphBookmarkAnchor: no rects");
2334
- return { chapterId: e14, localPageIndex: t2, globalPageIndex: null == s9 ? void 0 : s9.globalPageIndex, globalPageNumber: null == s9 ? void 0 : s9.globalPageNumber, rectPdfCoord: Vt(i2), rectsPdfCoord: i2, markerAnchor: _t(i2) };
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) };
2335
2340
  }
2336
- async function Ut(e14, t2, a3) {
2341
+ async function Wt(e14, t2, a3) {
2337
2342
  e14.scrollToGlobalPageIndex(t2), await (function(e15, t3, a4 = 2500) {
2338
2343
  const s9 = e15.getLayout().items.find((e16) => e16.globalPageIndex === t3 && !e16.isPlaceholder);
2339
2344
  return s9 ? Promise.resolve(s9) : new Promise((s10) => {
@@ -2346,9 +2351,9 @@ async function Ut(e14, t2, a3) {
2346
2351
  });
2347
2352
  })(e14, t2), e14.scrollToGlobalPdfPoint(t2, a3, { marginTop: 80 });
2348
2353
  }
2349
- const qt = class e8 extends BasePlugin {
2354
+ const Ht$1 = class e8 extends BasePlugin {
2350
2355
  constructor(e14, t2) {
2351
- super(e14, t2), this.change$ = createBehaviorEmitter([]), this.entries = /* @__PURE__ */ new Map(), this.chapterScroll = this.registry.getPlugin(At$1.id), this.chapterManager = this.registry.getPlugin(kt$1.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
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);
2352
2357
  }
2353
2358
  async initialize(t2) {
2354
2359
  var a3;
@@ -2364,7 +2369,7 @@ const qt = class e8 extends BasePlugin {
2364
2369
  return { addBookmark: (e14) => this.addBookmark(e14), removeBookmark: (e14) => this.removeBookmark(e14), updateBookmark: (e14, t2) => this.updateBookmark(e14, t2), listBookmarks: () => this.list(), getBookmark: (e14) => this.entries.get(e14) ?? null, scrollToBookmark: (e14) => this.scrollToBookmark(e14), requestRemoveBookmark: (e14) => this.requestRemoveBookmark(e14), listBookmarksForChapter: (e14) => this.listBookmarksForChapter(e14), replaceBookmarksForChapter: (e14, t2) => this.replaceBookmarksForChapter(e14, t2), onBookmarksChange: this.change$.on };
2365
2370
  }
2366
2371
  addBookmark(e14) {
2367
- for (const s9 of this.entries.values()) if (Rt(s9.anchor, e14.anchor)) return s9;
2372
+ for (const s9 of this.entries.values()) if (Ut(s9.anchor, e14.anchor)) return s9;
2368
2373
  const t2 = e14.id ?? `bm-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`, a3 = { id: t2, label: e14.label, anchor: e14.anchor, metadata: e14.metadata, createdAt: Date.now() };
2369
2374
  return this.entries.set(t2, a3), this.notifyAndPersist(), a3;
2370
2375
  }
@@ -2420,13 +2425,13 @@ const qt = class e8 extends BasePlugin {
2420
2425
  const t3 = e15.rectPdfCoord;
2421
2426
  return t3.origin.y + t3.size.height;
2422
2427
  })(t2.anchor);
2423
- await Ut(a3, s9, i2);
2428
+ await Wt(a3, s9, i2);
2424
2429
  }
2425
2430
  };
2426
- qt.id = "paragraph-bookmark";
2427
- let Wt = qt;
2428
- const Ht$1 = { manifest: yt$1, create: (e14) => new Wt(wt$1, e14), reducer: (e14) => e14, initialState: {} }, Bt$1 = { "annotation-toolbar": { id: "annotation-toolbar", position: { placement: "top", slot: "secondary", order: 0 }, responsive: { breakpoints: { sm: { maxWidth: 640, hide: ["add-text", "add-ink", "add-ink-highlighter", "add-insert-text", "add-replace-text", "add-comment", "add-callout"], show: ["overflow-annotation-tools"] }, md: { minWidth: 640, hide: ["overflow-annotation-tools"], show: ["add-text", "add-ink", "add-ink-highlighter", "add-insert-text", "add-replace-text", "add-comment", "add-callout"] } } }, permanent: false, categories: ["annotation"], items: [{ type: "spacer", id: "spacer-3", flex: true }, { type: "group", id: "annotation-tools", alignment: "start", gap: 2, items: [{ type: "command-button", id: "add-highlight", commandId: "annotation:add-highlight", variant: "icon", categories: ["annotation", "annotation-markup", "annotation-highlight"] }, { type: "command-button", id: "add-strikeout", commandId: "annotation:add-strikeout", variant: "icon", categories: ["annotation", "annotation-markup", "annotation-strikeout"] }, { type: "command-button", id: "add-underline", commandId: "annotation:add-underline", variant: "icon", categories: ["annotation", "annotation-markup", "annotation-underline"] }, { type: "command-button", id: "add-squiggly", commandId: "annotation:add-squiggly", variant: "icon", categories: ["annotation", "annotation-markup", "annotation-squiggly"] }, { type: "command-button", id: "add-ink", commandId: "annotation:add-ink", variant: "icon", categories: ["annotation", "annotation-ink"] }, { type: "command-button", id: "add-ink-highlighter", commandId: "annotation:add-ink-highlighter", variant: "icon", categories: ["annotation", "annotation-ink"] }, { type: "command-button", id: "add-text", commandId: "annotation:add-text", variant: "icon", categories: ["annotation", "annotation-text"] }, { type: "command-button", id: "add-insert-text", commandId: "annotation:add-insert-text", variant: "icon", categories: ["annotation", "annotation-markup", "annotation-insert-text"] }, { type: "command-button", id: "add-replace-text", commandId: "annotation:add-replace-text", variant: "icon", categories: ["annotation", "annotation-markup", "annotation-replace-text"] }, { type: "command-button", id: "add-comment", commandId: "annotation:add-comment", variant: "icon", categories: ["annotation", "annotation-comment-tool"] }, { type: "command-button", id: "add-callout", commandId: "annotation:add-callout", variant: "icon", categories: ["annotation", "annotation-text"] }, { type: "command-button", id: "overflow-annotation-tools", commandId: "annotation:overflow-tools", variant: "icon", categories: ["annotation", "annotation-overflow"] }, { type: "divider", id: "annotation-tools-divider-1", orientation: "vertical" }, { type: "command-button", id: "toggle-annotation-style", commandId: "panel:toggle-annotation-style", variant: "icon", categories: ["panel", "panel-annotation-style"] }, { type: "divider", id: "annotation-tools-divider-2", orientation: "vertical", visibilityDependsOn: { itemIds: ["toggle-annotation-style"] } }, { type: "command-button", id: "undo-button", commandId: "history:undo", variant: "icon", categories: ["history", "history-undo"] }, { type: "command-button", id: "redo-button", commandId: "history:redo", variant: "icon", categories: ["history", "history-redo"] }] }, { type: "spacer", id: "spacer-4", flex: true }] }, "shapes-toolbar": { id: "shapes-toolbar", position: { placement: "top", slot: "secondary", order: 0 }, responsive: { breakpoints: { sm: { maxWidth: 640, hide: ["add-polygon", "add-polyline"], show: ["overflow-shapes-tools"] }, md: { minWidth: 640, hide: ["overflow-shapes-tools"], show: ["add-polygon", "add-polyline"] } } }, permanent: false, categories: ["annotation", "annotation-shape"], items: [{ type: "spacer", id: "spacer-5", flex: true }, { type: "group", id: "shapes-tools", alignment: "start", gap: 2, items: [{ type: "command-button", id: "add-rectangle", commandId: "annotation:add-rectangle", variant: "icon", categories: ["annotation", "annotation-shape", "annotation-rectangle"] }, { type: "command-button", id: "add-circle", commandId: "annotation:add-circle", variant: "icon", categories: ["annotation", "annotation-shape", "annotation-circle"] }, { type: "command-button", id: "add-line", commandId: "annotation:add-line", variant: "icon", categories: ["annotation", "annotation-shape", "annotation-line"] }, { type: "command-button", id: "add-arrow", commandId: "annotation:add-arrow", variant: "icon", categories: ["annotation", "annotation-shape", "annotation-arrow"] }, { type: "command-button", id: "add-polygon", commandId: "annotation:add-polygon", variant: "icon", categories: ["annotation", "annotation-shape", "annotation-polygon"] }, { type: "command-button", id: "add-polyline", commandId: "annotation:add-polyline", variant: "icon", categories: ["annotation", "annotation-shape", "annotation-polyline"] }, { type: "command-button", id: "overflow-shapes-tools", commandId: "annotation:overflow-shapes", variant: "icon", categories: ["annotation", "annotation-shape", "annotation-overflow"] }, { type: "divider", id: "shapes-tools-divider-1", orientation: "vertical" }, { type: "command-button", id: "toggle-annotation-style", commandId: "panel:toggle-annotation-style", variant: "icon", categories: ["panel", "panel-annotation-style"] }, { type: "divider", id: "shapes-tools-divider-2", orientation: "vertical", visibilityDependsOn: { itemIds: ["toggle-annotation-style"] } }, { type: "command-button", id: "undo-button", commandId: "history:undo", variant: "icon", categories: ["history", "history-undo"] }, { type: "command-button", id: "redo-button", commandId: "history:redo", variant: "icon", categories: ["history", "history-redo"] }] }, { type: "spacer", id: "spacer-6", flex: true }] }, "form-toolbar": { id: "form-toolbar", position: { placement: "top", slot: "secondary", order: 0 }, responsive: { breakpoints: { sm: { maxWidth: 640, hide: ["add-form-select", "add-form-listbox"], show: ["overflow-forms-tools"] }, md: { minWidth: 640, hide: ["overflow-forms-tools"], show: ["add-form-select", "add-form-listbox"] } } }, permanent: false, categories: ["form"], items: [{ type: "spacer", id: "spacer-form-1", flex: true }, { type: "group", id: "form-tools", alignment: "start", gap: 2, items: [{ type: "command-button", id: "add-form-textfield", commandId: "form:add-textfield", variant: "icon", categories: ["form", "form-textfield"] }, { type: "command-button", id: "add-form-checkbox", commandId: "form:add-checkbox", variant: "icon", categories: ["form", "form-checkbox"] }, { type: "command-button", id: "add-form-radio", commandId: "form:add-radio", variant: "icon", categories: ["form", "form-radio"] }, { type: "command-button", id: "add-form-select", commandId: "form:add-select", variant: "icon", categories: ["form", "form-select"] }, { type: "command-button", id: "add-form-listbox", commandId: "form:add-listbox", variant: "icon", categories: ["form", "form-listbox"] }, { type: "command-button", id: "overflow-forms-tools", commandId: "form:overflow-tools", variant: "icon", categories: ["form", "form-overflow"] }, { type: "divider", id: "form-tools-divider-1", orientation: "vertical" }, { type: "command-button", id: "toggle-annotation-style", commandId: "panel:toggle-annotation-style", variant: "icon", categories: ["panel", "panel-annotation-style"] }, { type: "command-button", id: "toggle-form-fill-mode", commandId: "form:toggle-fill-mode", variant: "icon", categories: ["form", "form-fill-mode"] }, { type: "divider", id: "form-tools-divider-2", orientation: "vertical" }, { type: "command-button", id: "undo-button", commandId: "history:undo", variant: "icon", categories: ["history", "history-undo"] }, { type: "command-button", id: "redo-button", commandId: "history:redo", variant: "icon", categories: ["history", "history-redo"] }] }, { type: "spacer", id: "spacer-form-2", flex: true }] }, "insert-toolbar": { id: "insert-toolbar", position: { placement: "top", slot: "secondary", order: 0 }, permanent: false, categories: ["insert"], items: [{ type: "spacer", id: "spacer-insert-1", flex: true }, { type: "group", id: "insert-tools", alignment: "start", gap: 2, items: [{ type: "command-button", id: "add-rubber-stamp", commandId: "insert:add-rubber-stamp", variant: "icon", categories: ["insert", "insert-rubber-stamp"] }, { type: "command-button", id: "add-signature", commandId: "insert:add-signature", variant: "icon", categories: ["insert", "insert-signature"] }, { type: "command-button", id: "add-image", commandId: "insert:add-image", variant: "icon", categories: ["insert", "insert-image"] }, { type: "divider", id: "insert-tools-divider-1", orientation: "vertical" }, { type: "command-button", id: "toggle-annotation-style", commandId: "panel:toggle-annotation-style", variant: "icon", categories: ["panel", "panel-annotation-style"] }, { type: "divider", id: "insert-tools-divider-2", orientation: "vertical", visibilityDependsOn: { itemIds: ["toggle-annotation-style"] } }, { type: "command-button", id: "undo-button", commandId: "history:undo", variant: "icon", categories: ["history", "history-undo"] }, { type: "command-button", id: "redo-button", commandId: "history:redo", variant: "icon", categories: ["history", "history-redo"] }] }, { type: "spacer", id: "spacer-insert-2", flex: true }] }, "redaction-toolbar": { id: "redaction-toolbar", position: { placement: "top", slot: "secondary", order: 0 }, permanent: false, categories: ["redaction"], items: [{ type: "spacer", id: "spacer-7", flex: true }, { type: "group", id: "redaction-tools", alignment: "start", gap: 2, items: [{ type: "command-button", id: "redact", commandId: "redaction:redact", variant: "icon", categories: ["redaction", "redaction-combined"] }, { type: "divider", id: "redaction-tools-divider-1", orientation: "vertical" }, { type: "command-button", id: "toggle-redaction-panel", commandId: "panel:toggle-redaction", variant: "icon", categories: ["panel", "panel-redaction"] }, { type: "command-button", id: "toggle-annotation-style", commandId: "panel:toggle-annotation-style", variant: "icon", categories: ["panel", "panel-annotation-style"] }, { type: "divider", id: "redaction-tools-divider-2", orientation: "vertical", visibilityDependsOn: { itemIds: ["toggle-annotation-style"] } }, { type: "command-button", id: "undo-button", commandId: "history:undo", variant: "icon", categories: ["history", "history-undo"] }, { type: "command-button", id: "redo-button", commandId: "history:redo", variant: "icon", categories: ["history", "history-redo"] }] }, { type: "spacer", id: "spacer-8", flex: true }] } };
2429
- class jt {
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 {
2430
2435
  constructor() {
2431
2436
  this.specs = [];
2432
2437
  }
@@ -2441,17 +2446,17 @@ class jt {
2441
2446
  return this.specs;
2442
2447
  }
2443
2448
  buildToolbars() {
2444
- const e14 = structuredClone(Bt$1);
2449
+ const e14 = structuredClone(Zt);
2445
2450
  for (const t2 of this.specs) {
2446
2451
  const a3 = e14[t2.toolbarSlot];
2447
2452
  if (!a3) continue;
2448
2453
  const s9 = { type: "command-button", id: t2.id, commandId: t2.commandId, variant: "icon", ...t2.icon ? { icon: t2.icon } : {}, ...t2.i18nKey ? { labelKey: t2.i18nKey } : {}, ...t2.label ? { label: t2.label } : {}, categories: t2.categories ?? [] };
2449
- a3.items = Zt(a3.items, s9, t2.position);
2454
+ a3.items = Kt(a3.items, s9, t2.position);
2450
2455
  }
2451
2456
  return e14;
2452
2457
  }
2453
2458
  }
2454
- function Zt(e14, t2, a3) {
2459
+ function Kt(e14, t2, a3) {
2455
2460
  return (null == a3 ? void 0 : a3.after) || (null == a3 ? void 0 : a3.before) ? (function(e15, t3, a4) {
2456
2461
  const s9 = (e16) => {
2457
2462
  const i2 = [];
@@ -2463,8 +2468,8 @@ function Zt(e14, t2, a3) {
2463
2468
  return e15.map((e16) => "group" === e16.type ? { ...e16, items: [...e16.items, t3] } : e16);
2464
2469
  })(e14, t2);
2465
2470
  }
2466
- const Yt = { annotate: "annotation-toolbar", shapes: "shapes-toolbar", insert: "insert-toolbar", form: "form-toolbar", redact: "redaction-toolbar" };
2467
- function Kt() {
2471
+ const Xt = { annotate: "annotation-toolbar", shapes: "shapes-toolbar", insert: "insert-toolbar", form: "form-toolbar", redact: "redaction-toolbar" };
2472
+ function Qt() {
2468
2473
  return { "mode:view": { id: "mode:view", label: "View", categories: ["mode", "mode-view"], action: ({ registry: e14, documentId: t2 }) => {
2469
2474
  var _a2, _b, _c, _d;
2470
2475
  const a3 = (_a2 = e14.getPlugin("ui")) == null ? void 0 : _a2.provides(), s9 = (_b = e14.getPlugin("interaction-manager")) == null ? void 0 : _b.provides();
@@ -2491,16 +2496,16 @@ function Kt() {
2491
2496
  a3 && (a3.setActiveToolbar("top", "secondary", "redaction-toolbar", t2), (_b = e14.getPlugin(ANNOTATION_PLUGIN_ID)) == null ? void 0 : _b.provides().forDocument(t2).setLocked({ type: LockModeType.Include, categories: ["form"] }));
2492
2497
  }, active: ({ state: e14, documentId: t2 }) => isToolbarOpen(e14.plugins, t2, "top", "secondary", "redaction-toolbar") } };
2493
2498
  }
2494
- function Xt(e14) {
2499
+ function Jt(e14) {
2495
2500
  var _a2, _b, _c, _d, _e2, _f;
2496
2501
  const t2 = e14.toolbar ?? {}, a3 = t2.enabledModes ?? ["view", "annotate", "shapes", "insert", "form", "redact"], s9 = a3.length > 0, { schema: i2, operationRegistry: o } = (function(e15 = {}) {
2497
2502
  var t3, a4, s10, i3, o2, r3;
2498
- const n3 = new Set(e15.enabledModes ?? ["view", "annotate", "shapes", "insert", "form", "redact"]), l = new jt();
2503
+ const n3 = new Set(e15.enabledModes ?? ["view", "annotate", "shapes", "insert", "form", "redact"]), l = new Yt();
2499
2504
  (null == (t3 = e15.customOperations) ? void 0 : t3.length) && l.registerAll(e15.customOperations);
2500
2505
  const h2 = l.buildToolbars(), d2 = {};
2501
2506
  for (const u of n3) {
2502
2507
  if ("view" === u) continue;
2503
- const e16 = Yt[u];
2508
+ const e16 = Xt[u];
2504
2509
  h2[e16] && (d2[e16] = h2[e16]);
2505
2510
  }
2506
2511
  const c = (function(e16) {
@@ -2509,10 +2514,10 @@ function Xt(e14) {
2509
2514
  return { id: "chapter-editor-main-toolbar", position: { placement: "top", slot: "main", order: 0 }, permanent: true, items: [{ type: "spacer", id: "main-spacer-left", flex: true }, { type: "group", id: "mode-group", alignment: "start", gap: 2, items: [...e16.has("view") ? [t4("view", "View", "mode:view")] : [], ...e16.has("annotate") ? [t4("annotate", "Annotate", "mode:annotate")] : [], ...e16.has("shapes") ? [t4("shapes", "Shapes", "mode:shapes")] : [], ...e16.has("insert") ? [t4("insert", "Insert", "mode:insert")] : [], ...e16.has("form") ? [t4("form", "Form", "mode:form")] : [], ...e16.has("redact") ? [t4("redact", "Redact", "mode:redact")] : []] }, { type: "spacer", id: "main-spacer-right", flex: true }] };
2510
2515
  })(n3);
2511
2516
  return c && (d2["chapter-editor-main-toolbar"] = c), (null == (a4 = e15.extend) ? void 0 : a4.toolbars) && Object.assign(d2, e15.extend.toolbars), { schema: { id: "chapter-pdf-editor-ui", version: "1.0.0", toolbars: d2, menus: (null == (s10 = e15.extend) ? void 0 : s10.menus) ?? {}, sidebars: (null == (i3 = e15.extend) ? void 0 : i3.sidebars) ?? {}, modals: (null == (o2 = e15.extend) ? void 0 : o2.modals) ?? {}, selectionMenus: (null == (r3 = e15.extend) ? void 0 : r3.selectionMenus) ?? {} }, operationRegistry: l };
2512
- })({ ...t2, enabledModes: a3 }), r2 = { ...s9 ? Kt() : {}, ...s9 ? Qt(o.list()) : {}, ...e14.commands ?? {} }, n2 = [createPluginRegistration(DocumentManagerPluginPackage, { initialDocuments: [] }), createPluginRegistration(Re, { manifest: e14.manifest, overlapStrategy: e14.overlapStrategy, passwordProvider: e14.passwordProvider, chapterPdfLoader: e14.chapterPdfLoader, prefetchChapters: e14.prefetchChapters, unloadTimeoutMs: e14.unloadTimeoutMs }), createPluginRegistration(Qe, { placeholderPageHeight: e14.placeholderPageHeight, placeholderPageWidth: e14.placeholderPageWidth }), createPluginRegistration(InteractionManagerPluginPackage), createPluginRegistration(RenderPluginPackage), createPluginRegistration(RotatePluginPackage), createPluginRegistration(SelectionPluginPackage, { marquee: { enabled: false }, toleranceFactor: 1.2, minSelectionDragDistance: 4 }), createPluginRegistration(HistoryPluginPackage), createPluginRegistration(AnnotationPluginPackage), createPluginRegistration(RedactionPluginPackage), createPluginRegistration(FormPluginPackage), createPluginRegistration(StampPluginPackage, false === e14.loadDefaultStampLibrary ? { manifests: [] } : void 0), createPluginRegistration(SignaturePluginPackage), ...Object.keys(r2).length > 0 ? [createPluginRegistration(CommandsPluginPackage, { commands: r2 })] : [], ...s9 ? [createPluginRegistration(I18nPluginPackage), createPluginRegistration(UIPluginPackage, { schema: i2 })] : []];
2513
- return e14.notes && n2.push(createPluginRegistration(Pt$1, { callbacks: e14.notes.callbacks, ui: (_b = (_a2 = e14.features) == null ? void 0 : _a2.notes) == null ? void 0 : _b.marker })), e14.bookmarks && n2.push(createPluginRegistration(Ht$1, { callbacks: e14.bookmarks.callbacks, ui: (_d = (_c = e14.features) == null ? void 0 : _c.bookmarks) == null ? void 0 : _d.marker, hover: (_f = (_e2 = e14.features) == null ? void 0 : _e2.bookmarks) == null ? void 0 : _f.hover })), { plugins: n2, uiSchema: i2, operationRegistry: o };
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 };
2514
2519
  }
2515
- function Qt(e14) {
2520
+ function ea(e14) {
2516
2521
  const t2 = {};
2517
2522
  for (const a3 of e14) a3.handler && (t2[a3.commandId] = { id: a3.commandId, labelKey: a3.i18nKey, label: a3.label, icon: a3.icon, categories: a3.categories, action: ({ documentId: e15 }) => {
2518
2523
  var _a2;
@@ -2520,33 +2525,33 @@ function Qt(e14) {
2520
2525
  } });
2521
2526
  return t2;
2522
2527
  }
2523
- const Jt = Me(), ea = {};
2524
- function ta(e14) {
2525
- return Xt({ ...e14, toolbar: e14.toolbar ?? { enabledModes: [] }, features: Me(e14.features) });
2526
- }
2527
- const aa = { overlapStrategy: { kind: "first-wins" }, passwordProvider: new xe(async () => null), prefetchChapters: 1, loadDefaultStampLibrary: false, unloadTimeoutMs: 12e4, toolbar: { enabledModes: [] } };
2528
+ const ta = xe(), aa = {};
2528
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: [] } };
2533
+ function oa(e14) {
2529
2534
  return (function(e15) {
2530
2535
  return "callbacks" in e15.notes;
2531
2536
  })(e14) ? { manifest: e14.manifest, chapterPdfLoader: e14.chapterPdfLoader, notes: e14.notes.callbacks, bookmarks: e14.bookmarks.callbacks } : e14;
2532
2537
  }
2533
- function ia(e14) {
2534
- return { ...aa, manifest: e14.manifest, chapterPdfLoader: e14.chapterPdfLoader, overlapStrategy: e14.overlapStrategy ?? aa.overlapStrategy, notes: { callbacks: e14.notes }, bookmarks: { callbacks: e14.bookmarks }, features: Me(e14.features) };
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) };
2535
2540
  }
2536
- function oa(e14) {
2537
- const t2 = ia(sa(e14)), { plugins: a3 } = ta(t2);
2541
+ function na(e14) {
2542
+ const t2 = ra(oa(e14)), { plugins: a3 } = sa(t2);
2538
2543
  return { plugins: a3, features: t2.features, editorOptions: t2 };
2539
2544
  }
2540
- function ra(e14) {
2541
- const { features: t2, ...a3 } = ia(sa(e14));
2545
+ function la(e14) {
2546
+ const { features: t2, ...a3 } = ra(oa(e14));
2542
2547
  return a3;
2543
2548
  }
2544
- function na(e14, t2 = 0.5, a3 = 3) {
2549
+ function ha(e14, t2 = 0.5, a3 = 3) {
2545
2550
  return Math.min(a3, Math.max(t2, e14));
2546
2551
  }
2547
- function la(i2, o) {
2552
+ function da(i2, o) {
2548
2553
  var _a2;
2549
- const r2 = isRef(i2) ? i2 : computed(() => i2), { registry: n2 } = useRegistry(), { provides: l } = useCapability(DocumentManagerPlugin.id), { provides: h2 } = useCapability(Ee.id), d2 = ref(((_a2 = o.value) == null ? void 0 : _a2.initial) ?? 1), c = ref(d2.value), u = () => {
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 = () => {
2550
2555
  var _a3;
2551
2556
  return ((_a3 = o.value) == null ? void 0 : _a3.min) ?? 0.5;
2552
2557
  }, p2 = () => {
@@ -2557,11 +2562,11 @@ function la(i2, o) {
2557
2562
  return (_a3 = o.value) == null ? void 0 : _a3.pageWidth;
2558
2563
  };
2559
2564
  function f(e14) {
2560
- const t2 = na(e14, u(), p2());
2565
+ const t2 = ha(e14, u(), p2());
2561
2566
  c.value = t2, d2.value = t2, (function(e15, t3, a3, s9 = 0.5, i3 = 3) {
2562
2567
  const o2 = e15 == null ? void 0 : e15.getStore();
2563
2568
  if (!o2) return;
2564
- const r3 = na(a3, s9, i3);
2569
+ const r3 = ha(a3, s9, i3);
2565
2570
  o2.dispatchToCore(setDefaultScale(r3));
2566
2571
  for (const n3 of t3.chapters) o2.getState().core.documents[n3.chapterId] && o2.dispatchToCore(setScale(r3, n3.chapterId));
2567
2572
  })(n2.value, r2.value, t2, u(), p2());
@@ -2603,10 +2608,10 @@ function la(i2, o) {
2603
2608
  return false !== ((_a3 = o.value) == null ? void 0 : _a3.enabled);
2604
2609
  }, minZoom: u, maxZoom: p2 };
2605
2610
  }
2606
- function ha(e14, t2, a3) {
2611
+ function ca(e14, t2, a3) {
2607
2612
  return Math.min(a3, Math.max(t2, e14));
2608
2613
  }
2609
- function da(e14, t2) {
2614
+ function ua(e14, t2) {
2610
2615
  if (!e14 || false === t2.enabled) return () => {
2611
2616
  };
2612
2617
  let a3 = null, s9 = null, i2 = 0;
@@ -2615,7 +2620,7 @@ function da(e14, t2) {
2615
2620
  return !!s10 && (a3 == null ? void 0 : a3(), a3 = (function({ container: e15, getScale: t3, setScale: a4, minZoom: s11 = 0.5, maxZoom: i3 = 3 }) {
2616
2621
  let o2 = 0, r2 = 1, n2 = null, l = 1, h2 = 1;
2617
2622
  const d2 = (e16) => {
2618
- (e16.ctrlKey || e16.metaKey) && (e16.preventDefault(), null === n2 ? (h2 = t3(), l = 1) : clearTimeout(n2), l *= 1 - 0.01 * e16.deltaY, l = ha(l, 0.1, 10), a4(ha(h2 * l, s11, i3)), n2 = setTimeout(() => {
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(() => {
2619
2624
  n2 = null;
2620
2625
  }, 120));
2621
2626
  }, c = /* @__PURE__ */ new Map(), u = (e16) => {
@@ -2627,7 +2632,7 @@ function da(e14, t2) {
2627
2632
  if (c.has(e16.pointerId) && (c.set(e16.pointerId, { x: e16.clientX, y: e16.clientY }), 2 === c.size && o2 > 0)) {
2628
2633
  e16.preventDefault();
2629
2634
  const [t4, n3] = [...c.values()], l2 = Math.hypot(n3.x - t4.x, n3.y - t4.y);
2630
- a4(ha(r2 * (l2 / o2), s11, i3));
2635
+ a4(ca(r2 * (l2 / o2), s11, i3));
2631
2636
  }
2632
2637
  }, g2 = (e16) => {
2633
2638
  c.delete(e16.pointerId), c.size < 2 && (o2 = 0);
@@ -2643,26 +2648,26 @@ function da(e14, t2) {
2643
2648
  i2 && cancelAnimationFrame(i2), s9 == null ? void 0 : s9.disconnect(), a3 == null ? void 0 : a3();
2644
2649
  };
2645
2650
  }
2646
- const ca = { chapters: [] };
2647
- function ua(e14) {
2648
- const o = ref(null), { provides: r2 } = useCapability(Ee.id), n2 = computed(() => {
2651
+ const pa = { chapters: [] };
2652
+ function ga(e14) {
2653
+ const o = ref(null), { provides: r2 } = useCapability(Fe.id), n2 = computed(() => {
2649
2654
  var _a2;
2650
- return ((_a2 = r2.value) == null ? void 0 : _a2.getManifest()) ?? ca;
2655
+ return ((_a2 = r2.value) == null ? void 0 : _a2.getManifest()) ?? pa;
2651
2656
  }), l = computed(() => {
2652
2657
  var _a2;
2653
2658
  return (_a2 = e14.value) == null ? void 0 : _a2.zoom;
2654
- }), { scale: h2, setScale: d2, zoomEnabled: c, minZoom: u, maxZoom: p2 } = la(n2, l);
2659
+ }), { scale: h2, setScale: d2, zoomEnabled: c, minZoom: u, maxZoom: p2 } = da(n2, l);
2655
2660
  return (function(e15, t2) {
2656
2661
  let a3 = null;
2657
2662
  watch([e15, t2], () => {
2658
2663
  a3 == null ? void 0 : a3();
2659
2664
  const s9 = t2.value;
2660
- a3 = da(e15.value ?? null, { enabled: s9.enabled, getScale: s9.getScale, setScale: s9.setScale, minZoom: s9.minZoom, maxZoom: s9.maxZoom });
2665
+ a3 = ua(e15.value ?? null, { enabled: s9.enabled, getScale: s9.getScale, setScale: s9.setScale, minZoom: s9.minZoom, maxZoom: s9.maxZoom });
2661
2666
  }, { deep: true, flush: "post" }), onBeforeUnmount(() => a3 == null ? void 0 : a3());
2662
2667
  })(o, computed(() => ({ enabled: c(), getScale: () => h2.value, setScale: d2, minZoom: u(), maxZoom: p2() }))), { hostRef: o, scale: h2, setScale: d2, zoomEnabled: c };
2663
2668
  }
2664
- const pa = { kind: "first-wins" };
2665
- function ga(e14, t2, a3) {
2669
+ const fa = { kind: "first-wins" };
2670
+ function ma(e14, t2, a3) {
2666
2671
  if (1 === t2.length) return t2[0].chapterId;
2667
2672
  switch (a3.kind) {
2668
2673
  case "first-wins":
@@ -2680,7 +2685,7 @@ function ga(e14, t2, a3) {
2680
2685
  return a3.resolve(e14, t2);
2681
2686
  }
2682
2687
  }
2683
- class fa {
2688
+ class va {
2684
2689
  constructor(e14) {
2685
2690
  this._pages = e14, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
2686
2691
  for (const t2 of e14) {
@@ -2714,8 +2719,8 @@ class fa {
2714
2719
  return a3 ? this._pages.indexOf(a3) : -1;
2715
2720
  }
2716
2721
  }
2717
- function ma(e14, t2 = pa) {
2718
- const a3 = (function(e15, t3 = pa) {
2722
+ function ba(e14, t2 = fa) {
2723
+ const a3 = (function(e15, t3 = fa) {
2719
2724
  const a4 = /* @__PURE__ */ new Map();
2720
2725
  for (const i3 of e15.chapters) {
2721
2726
  const [e16, t4] = i3.globalPageRange;
@@ -2725,7 +2730,7 @@ function ma(e14, t2 = pa) {
2725
2730
  }
2726
2731
  }
2727
2732
  const s10 = /* @__PURE__ */ new Map();
2728
- for (const [i3, o2] of a4) s10.set(i3, ga(i3, o2, t3));
2733
+ for (const [i3, o2] of a4) s10.set(i3, ma(i3, o2, t3));
2729
2734
  return s10;
2730
2735
  })(e14, t2), s9 = /* @__PURE__ */ new Map();
2731
2736
  for (const n2 of e14.chapters) s9.set(n2.chapterId, n2);
@@ -2737,14 +2742,14 @@ function ma(e14, t2 = pa) {
2737
2742
  const [i3] = t3.globalPageRange, [l] = t3.localPageRange, h2 = l + (n2 - i3);
2738
2743
  o.push({ globalPageIndex: r2++, globalPageNumber: n2, chapterId: e15, localPageIndex: h2 });
2739
2744
  }
2740
- return new fa(o);
2745
+ return new va(o);
2741
2746
  }
2742
- const va = class e9 extends BasePlugin {
2747
+ const Pa = class e9 extends BasePlugin {
2743
2748
  constructor(e14, t2) {
2744
- super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = pa, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
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);
2745
2750
  }
2746
2751
  async initialize(e14) {
2747
- if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? pa, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
2752
+ if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? fa, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
2748
2753
  this.isOwnedChapter(e15.id) && (this.passwordAttempts.delete(e15.id), this.updateStatus(e15.id, "loaded"));
2749
2754
  }), this.documentManager.provides().onDocumentClosed((e15) => {
2750
2755
  this.isOwnedChapter(e15) && this.updateStatus(e15, "closed");
@@ -2779,7 +2784,7 @@ const va = class e9 extends BasePlugin {
2779
2784
  const s9 = new Set(this.chapterStatus.keys()), i2 = new Set(t2.chapters.map((e14) => e14.chapterId));
2780
2785
  for (const e14 of s9) i2.has(e14) || (this.closeChapter(e14), this.chapterStatus.delete(e14));
2781
2786
  for (const e14 of t2.chapters) this.chapterStatus.has(e14.chapterId) || this.chapterStatus.set(e14.chapterId, "idle");
2782
- this.manifest = t2, this.virtualPageMap = ma(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
2787
+ this.manifest = t2, this.virtualPageMap = ba(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
2783
2788
  }
2784
2789
  eagerPrefetchFromManifest() {
2785
2790
  const e14 = this.config.prefetchChapters ?? 0;
@@ -2917,9 +2922,9 @@ const va = class e9 extends BasePlugin {
2917
2922
  this.chapterStatus.get(e14) !== t2 && (this.chapterStatus.set(e14, t2), this.statusChange$.emit({ chapterId: e14, status: t2, ..."error" === t2 && a3 ? { error: { message: a3 } } : {} }));
2918
2923
  }
2919
2924
  };
2920
- va.id = "chapter-manager";
2921
- let ba = va;
2922
- function Pa(e14, t2) {
2925
+ Pa.id = "chapter-manager";
2926
+ let wa = Pa;
2927
+ function ya(e14, t2) {
2923
2928
  if (e14 === t2) return true;
2924
2929
  if (e14.totalHeight !== t2.totalHeight || e14.totalWidth !== t2.totalWidth || e14.pageGap !== t2.pageGap || e14.items.length !== t2.items.length) return false;
2925
2930
  for (let a3 = 0; a3 < e14.items.length; a3++) {
@@ -2928,9 +2933,9 @@ function Pa(e14, t2) {
2928
2933
  }
2929
2934
  return true;
2930
2935
  }
2931
- const wa = class extends BasePlugin {
2936
+ const Ca = class extends BasePlugin {
2932
2937
  constructor(e14, t2) {
2933
- super(e14, t2), this.layoutChange$ = createBehaviorEmitter(void 0, Pa), this.visibleChange$ = createBehaviorEmitter(), this.virtualPageMap = null, this.pageSizes = /* @__PURE__ */ new Map(), this.offsets = [], this.totalHeight = 0, this.totalWidth = 0, this.viewportEl = null, this.viewportObservers = null, this.currentVisible = [], this.currentGlobalPageIndex = 0, this.chapterManagerUnsubs = [], this.chapterManager = this.registry.getPlugin(ba.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
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);
2934
2939
  }
2935
2940
  async initialize(e14) {
2936
2941
  this.config = { placeholderPageHeight: e14.placeholderPageHeight ?? 1200, placeholderPageWidth: e14.placeholderPageWidth ?? 900, bufferSize: e14.bufferSize ?? 2, pageGap: e14.pageGap ?? 20 }, this.virtualPageMap = this.chapterManager.provides().getVirtualPageMap(), this.rebuildOffsets(), this.chapterManagerUnsubs.push(this.chapterManager.provides().onManifestChange(({ map: e15 }) => {
@@ -3107,14 +3112,14 @@ const wa = class extends BasePlugin {
3107
3112
  a3 && this.scrollToIndex(a3.globalPageIndex, t2);
3108
3113
  }
3109
3114
  };
3110
- wa.id = "chapter-scroll";
3111
- let ya = wa;
3112
- const Ca = ["data-global-page-index", "data-chapter-id", "data-local-page-index"], Ia = /* @__PURE__ */ ((e14, t2) => {
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) => {
3113
3118
  const a3 = e14.__vccOpts || e14;
3114
3119
  for (const [s9, i2] of t2) a3[s9] = i2;
3115
3120
  return a3;
3116
3121
  })(/* @__PURE__ */ defineComponent({ __name: "ChapterScroller", props: { class: {}, style: {} }, setup(e14) {
3117
- const { provides: t2 } = useCapability(ya.id), o = ref(null), f = ref(null);
3122
+ const { provides: t2 } = useCapability(Ia.id), o = ref(null), f = ref(null);
3118
3123
  let m = null;
3119
3124
  const v = () => {
3120
3125
  null == m || m(), m = null, t2.value && (t2.value.registerViewport(o.value), m = t2.value.onLayoutChange((e15) => {
@@ -3126,11 +3131,11 @@ const Ca = ["data-global-page-index", "data-chapter-id", "data-local-page-index"
3126
3131
  null == m || m(), null == (e15 = t2.value) || e15.registerViewport(null);
3127
3132
  }), watch(t2, v), (e15, t3) => {
3128
3133
  var a3, s9, i2;
3129
- return openBlock(), createElementBlock("div", { ref_key: "containerRef", ref: o, "data-chapter-scroll-viewport": "", class: normalizeClass(e15.$props.class), style: normalizeStyle({ overflow: "auto", position: "relative", width: "100%", height: "100%", ...e15.$props.style }) }, [createElementVNode("div", { style: normalizeStyle({ position: "relative", width: `${(null == (a3 = f.value) ? void 0 : a3.totalWidth) ?? 0}px`, height: `${(null == (s9 = f.value) ? void 0 : s9.totalHeight) ?? 0}px`, margin: "0 auto" }) }, [(openBlock(true), createElementBlock(Fragment, null, renderList((null == (i2 = f.value) ? void 0 : i2.items) ?? [], (a4) => (openBlock(), createElementBlock("div", { key: a4.globalPageIndex, "data-global-page-index": a4.globalPageIndex, "data-chapter-id": a4.chapterId, "data-local-page-index": a4.localPageIndex, style: normalizeStyle({ position: "absolute", top: `${a4.offsetTop}px`, left: "50%", transform: "translateX(-50%)", width: `${a4.width}px`, height: `${a4.height}px`, backgroundColor: a4.isPlaceholder ? "#f3f4f6" : "#fff", boxShadow: "0 1px 4px rgba(0,0,0,0.08)" }) }, [a4.isPlaceholder ? renderSlot(e15.$slots, "placeholder", { key: 0, item: a4 }, () => [t3[0] || (t3[0] = createElementVNode("div", { class: "chapter-scroll-placeholder" }, "Loading chapter…", -1))], true) : renderSlot(e15.$slots, "page", { key: 1, item: a4 }, void 0, true)], 12, Ca))), 128))], 4)], 6);
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);
3130
3135
  };
3131
- } }), [["__scopeId", "data-v-8a737137"]]), Ma = /* @__PURE__ */ defineComponent({ __name: "ChapterRenderLayer", props: { chapterId: {}, localPageIndex: {}, scale: {}, dpr: {}, class: {} }, setup: (e14) => (t2, a3) => (openBlock(), createBlock(unref(RenderLayer), { "document-id": e14.chapterId, "page-index": e14.localPageIndex, scale: e14.scale, dpr: e14.dpr, class: normalizeClass(e14.class), style: { pointerEvents: "none" } }, null, 8, ["document-id", "page-index", "scale", "dpr", "class"])) });
3132
- const Sa = { kind: "first-wins" };
3133
- function xa(e14, t2, a3) {
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) {
3134
3139
  if (1 === t2.length) return t2[0].chapterId;
3135
3140
  switch (a3.kind) {
3136
3141
  case "first-wins":
@@ -3148,7 +3153,7 @@ function xa(e14, t2, a3) {
3148
3153
  return a3.resolve(e14, t2);
3149
3154
  }
3150
3155
  }
3151
- let ka = class {
3156
+ let $a = class {
3152
3157
  constructor(e14) {
3153
3158
  this._pages = e14, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
3154
3159
  for (const t2 of e14) {
@@ -3182,8 +3187,8 @@ let ka = class {
3182
3187
  return a3 ? this._pages.indexOf(a3) : -1;
3183
3188
  }
3184
3189
  };
3185
- function La(e14, t2 = Sa) {
3186
- const a3 = (function(e15, t3 = Sa) {
3190
+ function za(e14, t2 = ka) {
3191
+ const a3 = (function(e15, t3 = ka) {
3187
3192
  const a4 = /* @__PURE__ */ new Map();
3188
3193
  for (const i3 of e15.chapters) {
3189
3194
  const [e16, t4] = i3.globalPageRange;
@@ -3193,7 +3198,7 @@ function La(e14, t2 = Sa) {
3193
3198
  }
3194
3199
  }
3195
3200
  const s10 = /* @__PURE__ */ new Map();
3196
- for (const [i3, o2] of a4) s10.set(i3, xa(i3, o2, t3));
3201
+ for (const [i3, o2] of a4) s10.set(i3, La(i3, o2, t3));
3197
3202
  return s10;
3198
3203
  })(e14, t2), s9 = /* @__PURE__ */ new Map();
3199
3204
  for (const n2 of e14.chapters) s9.set(n2.chapterId, n2);
@@ -3205,14 +3210,14 @@ function La(e14, t2 = Sa) {
3205
3210
  const [i3] = t3.globalPageRange, [l] = t3.localPageRange, h2 = l + (n2 - i3);
3206
3211
  o.push({ globalPageIndex: r2++, globalPageNumber: n2, chapterId: e15, localPageIndex: h2 });
3207
3212
  }
3208
- return new ka(o);
3213
+ return new $a(o);
3209
3214
  }
3210
- const $a = class e10 extends BasePlugin {
3215
+ const Ta = class e10 extends BasePlugin {
3211
3216
  constructor(e14, t2) {
3212
- super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = Sa, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
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);
3213
3218
  }
3214
3219
  async initialize(e14) {
3215
- if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? Sa, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
3220
+ if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? ka, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
3216
3221
  this.isOwnedChapter(e15.id) && (this.passwordAttempts.delete(e15.id), this.updateStatus(e15.id, "loaded"));
3217
3222
  }), this.documentManager.provides().onDocumentClosed((e15) => {
3218
3223
  this.isOwnedChapter(e15) && this.updateStatus(e15, "closed");
@@ -3247,7 +3252,7 @@ const $a = class e10 extends BasePlugin {
3247
3252
  const s9 = new Set(this.chapterStatus.keys()), i2 = new Set(t2.chapters.map((e14) => e14.chapterId));
3248
3253
  for (const e14 of s9) i2.has(e14) || (this.closeChapter(e14), this.chapterStatus.delete(e14));
3249
3254
  for (const e14 of t2.chapters) this.chapterStatus.has(e14.chapterId) || this.chapterStatus.set(e14.chapterId, "idle");
3250
- this.manifest = t2, this.virtualPageMap = La(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
3255
+ this.manifest = t2, this.virtualPageMap = za(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
3251
3256
  }
3252
3257
  eagerPrefetchFromManifest() {
3253
3258
  const e14 = this.config.prefetchChapters ?? 0;
@@ -3385,10 +3390,10 @@ const $a = class e10 extends BasePlugin {
3385
3390
  this.chapterStatus.get(e14) !== t2 && (this.chapterStatus.set(e14, t2), this.statusChange$.emit({ chapterId: e14, status: t2, ..."error" === t2 && a3 ? { error: { message: a3 } } : {} }));
3386
3391
  }
3387
3392
  };
3388
- $a.id = "chapter-manager";
3389
- let za = $a;
3390
- const Ta = { kind: "first-wins" };
3391
- function Da(e14, t2, a3) {
3393
+ Ta.id = "chapter-manager";
3394
+ let Da = Ta;
3395
+ const Oa = { kind: "first-wins" };
3396
+ function Ga(e14, t2, a3) {
3392
3397
  if (1 === t2.length) return t2[0].chapterId;
3393
3398
  switch (a3.kind) {
3394
3399
  case "first-wins":
@@ -3406,7 +3411,7 @@ function Da(e14, t2, a3) {
3406
3411
  return a3.resolve(e14, t2);
3407
3412
  }
3408
3413
  }
3409
- class Oa {
3414
+ class Na {
3410
3415
  constructor(e14) {
3411
3416
  this._pages = e14, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
3412
3417
  for (const t2 of e14) {
@@ -3440,8 +3445,8 @@ class Oa {
3440
3445
  return a3 ? this._pages.indexOf(a3) : -1;
3441
3446
  }
3442
3447
  }
3443
- function Ga(e14, t2 = Ta) {
3444
- const a3 = (function(e15, t3 = Ta) {
3448
+ function Aa(e14, t2 = Oa) {
3449
+ const a3 = (function(e15, t3 = Oa) {
3445
3450
  const a4 = /* @__PURE__ */ new Map();
3446
3451
  for (const i3 of e15.chapters) {
3447
3452
  const [e16, t4] = i3.globalPageRange;
@@ -3451,7 +3456,7 @@ function Ga(e14, t2 = Ta) {
3451
3456
  }
3452
3457
  }
3453
3458
  const s10 = /* @__PURE__ */ new Map();
3454
- for (const [i3, o2] of a4) s10.set(i3, Da(i3, o2, t3));
3459
+ for (const [i3, o2] of a4) s10.set(i3, Ga(i3, o2, t3));
3455
3460
  return s10;
3456
3461
  })(e14, t2), s9 = /* @__PURE__ */ new Map();
3457
3462
  for (const n2 of e14.chapters) s9.set(n2.chapterId, n2);
@@ -3463,14 +3468,14 @@ function Ga(e14, t2 = Ta) {
3463
3468
  const [i3] = t3.globalPageRange, [l] = t3.localPageRange, h2 = l + (n2 - i3);
3464
3469
  o.push({ globalPageIndex: r2++, globalPageNumber: n2, chapterId: e15, localPageIndex: h2 });
3465
3470
  }
3466
- return new Oa(o);
3471
+ return new Na(o);
3467
3472
  }
3468
- const Na = class e11 extends BasePlugin {
3473
+ const Va = class e11 extends BasePlugin {
3469
3474
  constructor(e14, t2) {
3470
- super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = Ta, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
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);
3471
3476
  }
3472
3477
  async initialize(e14) {
3473
- if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? Ta, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
3478
+ if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? Oa, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
3474
3479
  this.isOwnedChapter(e15.id) && (this.passwordAttempts.delete(e15.id), this.updateStatus(e15.id, "loaded"));
3475
3480
  }), this.documentManager.provides().onDocumentClosed((e15) => {
3476
3481
  this.isOwnedChapter(e15) && this.updateStatus(e15, "closed");
@@ -3505,7 +3510,7 @@ const Na = class e11 extends BasePlugin {
3505
3510
  const s9 = new Set(this.chapterStatus.keys()), i2 = new Set(t2.chapters.map((e14) => e14.chapterId));
3506
3511
  for (const e14 of s9) i2.has(e14) || (this.closeChapter(e14), this.chapterStatus.delete(e14));
3507
3512
  for (const e14 of t2.chapters) this.chapterStatus.has(e14.chapterId) || this.chapterStatus.set(e14.chapterId, "idle");
3508
- this.manifest = t2, this.virtualPageMap = Ga(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
3513
+ this.manifest = t2, this.virtualPageMap = Aa(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
3509
3514
  }
3510
3515
  eagerPrefetchFromManifest() {
3511
3516
  const e14 = this.config.prefetchChapters ?? 0;
@@ -3643,9 +3648,9 @@ const Na = class e11 extends BasePlugin {
3643
3648
  this.chapterStatus.get(e14) !== t2 && (this.chapterStatus.set(e14, t2), this.statusChange$.emit({ chapterId: e14, status: t2, ..."error" === t2 && a3 ? { error: { message: a3 } } : {} }));
3644
3649
  }
3645
3650
  };
3646
- Na.id = "chapter-manager";
3647
- let Aa = Na;
3648
- function Va(e14, t2) {
3651
+ Va.id = "chapter-manager";
3652
+ let _a = Va;
3653
+ function Ea(e14, t2) {
3649
3654
  if (e14 === t2) return true;
3650
3655
  if (e14.totalHeight !== t2.totalHeight || e14.totalWidth !== t2.totalWidth || e14.pageGap !== t2.pageGap || e14.items.length !== t2.items.length) return false;
3651
3656
  for (let a3 = 0; a3 < e14.items.length; a3++) {
@@ -3654,9 +3659,9 @@ function Va(e14, t2) {
3654
3659
  }
3655
3660
  return true;
3656
3661
  }
3657
- const _a = class extends BasePlugin {
3662
+ const Ra = class extends BasePlugin {
3658
3663
  constructor(e14, t2) {
3659
- super(e14, t2), this.layoutChange$ = createBehaviorEmitter(void 0, Va), this.visibleChange$ = createBehaviorEmitter(), this.virtualPageMap = null, this.pageSizes = /* @__PURE__ */ new Map(), this.offsets = [], this.totalHeight = 0, this.totalWidth = 0, this.viewportEl = null, this.viewportObservers = null, this.currentVisible = [], this.currentGlobalPageIndex = 0, this.chapterManagerUnsubs = [], this.chapterManager = this.registry.getPlugin(Aa.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
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);
3660
3665
  }
3661
3666
  async initialize(e14) {
3662
3667
  this.config = { placeholderPageHeight: e14.placeholderPageHeight ?? 1200, placeholderPageWidth: e14.placeholderPageWidth ?? 900, bufferSize: e14.bufferSize ?? 2, pageGap: e14.pageGap ?? 20 }, this.virtualPageMap = this.chapterManager.provides().getVirtualPageMap(), this.rebuildOffsets(), this.chapterManagerUnsubs.push(this.chapterManager.provides().onManifestChange(({ map: e15 }) => {
@@ -3833,11 +3838,11 @@ const _a = class extends BasePlugin {
3833
3838
  a3 && this.scrollToIndex(a3.globalPageIndex, t2);
3834
3839
  }
3835
3840
  };
3836
- _a.id = "chapter-scroll";
3837
- let Ea = _a;
3838
- const Ra = class e12 extends BasePlugin {
3841
+ Ra.id = "chapter-scroll";
3842
+ let Fa = Ra;
3843
+ const Ua = class e12 extends BasePlugin {
3839
3844
  constructor(e14, t2) {
3840
- super(e14, t2), this.notesChange$ = createBehaviorEmitter([]), this.noteActivated$ = createEmitter(), this.notes = /* @__PURE__ */ new Map(), this.chapterScroll = this.registry.getPlugin(Ea.id), this.chapterManager = this.registry.getPlugin(za.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
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);
3841
3846
  }
3842
3847
  async initialize(t2) {
3843
3848
  if (this.config = t2, t2.callbacks.loadNotes) try {
@@ -3875,7 +3880,7 @@ const Ra = class e12 extends BasePlugin {
3875
3880
  this.notesChange$.emit(this.listAll());
3876
3881
  }
3877
3882
  buildDraft(e14) {
3878
- return { chapterId: e14.chapterId, localPageIndex: e14.localPageIndex, globalPageNumber: e14.globalPageNumber, globalPageIndex: e14.globalPageIndex, rectsPdfCoord: e14.rectsPdfCoord, endAnchor: Ua(e14.rectsPdfCoord), selectedText: e14.selectedText, content: e14.content };
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 };
3879
3884
  }
3880
3885
  async requestCreateFromSelection(e14) {
3881
3886
  if (0 === e14.rectsPdfCoord.length) return null;
@@ -3942,21 +3947,21 @@ const Ra = class e12 extends BasePlugin {
3942
3947
  });
3943
3948
  }
3944
3949
  };
3945
- Ra.id = "note";
3946
- let Fa = Ra;
3947
- function Ua(e14) {
3950
+ Ua.id = "note";
3951
+ let qa = Ua;
3952
+ function Wa(e14) {
3948
3953
  const t2 = e14[e14.length - 1];
3949
3954
  return { x: t2.origin.x + t2.size.width, y: t2.origin.y + t2.size.height };
3950
3955
  }
3951
- function qa(e14) {
3956
+ function Ha(e14) {
3952
3957
  const { markerPdf: t2, lineRects: a3, sx: s9, sy: i2, cssPageWidth: o, iconSize: r2, gapPx: n2 = 6 } = e14, l = (a3 == null ? void 0 : a3.length) ? a3[a3.length - 1] : void 0;
3953
3958
  let h2, d2;
3954
3959
  l ? (h2 = (l.origin.x + l.size.width) * s9 + n2, d2 = l.origin.y * i2 + (l.size.height * i2 - r2) / 2) : (h2 = t2.x * s9 - r2 / 2, d2 = t2.y * i2 - r2 - n2);
3955
3960
  const c = Math.max(0, o - r2 - 2);
3956
3961
  return h2 > c && (h2 = c), d2 < 0 && (d2 = 0), { left: h2, top: d2 };
3957
3962
  }
3958
- const Wa = { key: 0, style: { position: "absolute", inset: "0", pointerEvents: "none", zIndex: 25 } }, Ha = ["onMouseenter"], Ba = ["data-note-marker-zone", "onMouseenter", "onMouseleave"], ja = ["onClick"], Za = ["onClick"], Ya = ["onClick"], Ka = /* @__PURE__ */ defineComponent({ __name: "NoteMarkerLayer", props: { chapterId: {}, localPageIndex: {}, pdfPageWidth: {}, pdfPageHeight: {}, cssPageWidth: {}, cssPageHeight: {}, ui: {} }, setup(e14) {
3959
- const o = e14, { provides: r2 } = useCapability(Fa.id), d2 = ref([]), g2 = ref(null), f = ref(null);
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);
3960
3965
  watch(r2, (e15) => {
3961
3966
  if (e15) return e15.onNotesChange((e16) => {
3962
3967
  d2.value = e16.filter((e17) => e17.chapterId === o.chapterId && e17.localPageIndex === o.localPageIndex);
@@ -3980,25 +3985,25 @@ const Wa = { key: 0, style: { position: "absolute", inset: "0", pointerEvents: "
3980
3985
  return ((_a2 = o.ui) == null ? void 0 : _a2.highlightColor) ?? "rgba(245, 158, 11, 0.08)";
3981
3986
  });
3982
3987
  function C(e15) {
3983
- const t2 = o.cssPageWidth / o.pdfPageWidth, a3 = o.cssPageHeight / o.pdfPageHeight, s9 = w.value, { left: i2, top: r3 } = qa({ markerPdf: e15.endAnchor, lineRects: e15.rectsPdfCoord, sx: t2, sy: a3, cssPageWidth: o.cssPageWidth, iconSize: s9 }), n2 = (function(e16, t3, a4) {
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) {
3984
3989
  let s10 = 1 / 0, i3 = 1 / 0, o2 = -1 / 0, r4 = -1 / 0;
3985
3990
  for (const n3 of e16) s10 = Math.min(s10, n3.origin.x * t3), i3 = Math.min(i3, n3.origin.y * a4), o2 = Math.max(o2, (n3.origin.x + n3.size.width) * t3), r4 = Math.max(r4, (n3.origin.y + n3.size.height) * a4);
3986
3991
  return { left: s10, top: i3, width: o2 - s10, height: r4 - i3 };
3987
3992
  })(e15.rectsPdfCoord, t2, a3), l = f.value === e15.noteId ? 72 : 0, h2 = Math.max(0, Math.min(n2.left, i2) - 8), d3 = Math.max(0, Math.min(n2.top, r3) - 8);
3988
3993
  return { zoneLeft: h2, zoneTop: d3, zoneW: Math.min(o.cssPageWidth, Math.max(n2.left + n2.width, i2 + s9) + 8) - h2, zoneH: Math.max(n2.top + n2.height, r3 + s9 + 6 + l) + 8 - d3, iconLeft: i2, iconTop: r3, sx: t2, sy: a3 };
3989
3994
  }
3990
- return (t2, a3) => unref(r2) && d2.value.length && e14.pdfPageWidth && e14.pdfPageHeight ? (openBlock(), createElementBlock("div", Wa, [(openBlock(true), createElementBlock(Fragment, null, renderList(d2.value, (e15) => (openBlock(), createElementBlock(Fragment, { key: e15.noteId }, [(openBlock(true), createElementBlock(Fragment, null, renderList(e15.rectsPdfCoord, (t3, a4) => (openBlock(), createElementBlock("div", { key: `${e15.noteId}-bg-${a4}`, style: normalizeStyle({ position: "absolute", left: t3.origin.x * C(e15).sx + "px", top: t3.origin.y * C(e15).sy + "px", width: t3.size.width * C(e15).sx + "px", height: t3.size.height * C(e15).sy + "px", background: y.value, borderRadius: "2px", pointerEvents: "auto" }), onMouseenter: (t4) => g2.value = e15.noteId }, null, 44, Ha))), 128)), g2.value === e15.noteId || f.value === e15.noteId ? (openBlock(), createElementBlock("div", { key: 0, "data-note-marker-zone": e15.noteId, style: normalizeStyle({ position: "absolute", left: `${C(e15).zoneLeft}px`, top: `${C(e15).zoneTop}px`, width: `${C(e15).zoneW}px`, height: `${C(e15).zoneH}px`, pointerEvents: "auto", zIndex: 26 }), onMouseenter: (t3) => g2.value = e15.noteId, onMouseleave: (t3) => f.value !== e15.noteId && (g2.value = null) }, [createElementVNode("button", { type: "button", title: "笔记", style: normalizeStyle({ position: "absolute", left: C(e15).iconLeft - C(e15).zoneLeft + "px", top: C(e15).iconTop - C(e15).zoneTop + "px", width: `${w.value}px`, height: `${w.value}px`, border: "none", borderRadius: "50%", background: "#f59e0b", color: "#fff", cursor: "pointer", fontSize: "11px", padding: 0 }), onMousedown: a3[0] || (a3[0] = withModifiers(() => {
3991
- }, ["stop"])), onClick: withModifiers((t3) => f.value = f.value === e15.noteId ? null : e15.noteId, ["stop"]) }, " 💬 ", 44, ja), f.value === e15.noteId ? (openBlock(), createElementBlock("div", { key: 0, style: normalizeStyle({ position: "absolute", left: C(e15).iconLeft - C(e15).zoneLeft + "px", top: `${C(e15).iconTop - C(e15).zoneTop + w.value + 4}px`, minWidth: "120px", padding: "6px", borderRadius: "8px", background: "#fff", border: "1px solid #e5e7eb", boxShadow: "0 4px 12px rgba(0,0,0,0.12)", zIndex: 30 }), onMousedown: a3[1] || (a3[1] = withModifiers(() => {
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(() => {
3992
3997
  }, ["stop"])) }, [createElementVNode("button", { type: "button", style: { display: "block", width: "100%", padding: "6px 8px", "font-size": "12px", border: "none", "border-radius": "4px", background: "transparent", color: "#334155", cursor: "pointer", "text-align": "left" }, onClick: (t3) => (function(e16) {
3993
3998
  var _a2;
3994
3999
  (_a2 = r2.value) == null ? void 0 : _a2.requestEditNote(e16.noteId, e16);
3995
- })(e15) }, " 编辑 ", 8, Za), createElementVNode("button", { type: "button", style: { display: "block", width: "100%", padding: "6px 8px", "font-size": "12px", border: "none", "border-radius": "4px", background: "transparent", color: "#dc2626", cursor: "pointer", "text-align": "left" }, onClick: (t3) => {
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) => {
3996
4001
  var _a2;
3997
4002
  return a4 = e15.noteId, (_a2 = r2.value) == null ? void 0 : _a2.requestDeleteNote(a4), void (f.value = null);
3998
4003
  var a4;
3999
- } }, " 删除 ", 8, Ya)], 36)) : createCommentVNode("", true)], 44, Ba)) : createCommentVNode("", true)], 64))), 128))])) : createCommentVNode("", true);
4000
- } }), Xa = { key: 0, style: { position: "absolute", inset: "0", pointerEvents: "none" } }, Qa = ["title", "onClick"], Ja = ["onClick"], es = /* @__PURE__ */ defineComponent({ __name: "BookmarkMarkerLayer", props: { chapterId: {}, localPageIndex: {}, pdfPageWidth: {}, pdfPageHeight: {}, cssPageWidth: {}, cssPageHeight: {}, ui: {} }, setup(e14) {
4001
- const o = e14, { provides: r2 } = useCapability(Wt.id), d2 = ref([]), g2 = ref(null), f = ref(null);
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);
4002
4007
  function P() {
4003
4008
  const e15 = r2.value;
4004
4009
  e15 && (d2.value = e15.listBookmarks().filter((e16) => e16.anchor.chapterId === o.chapterId && e16.anchor.localPageIndex === o.localPageIndex));
@@ -4023,27 +4028,27 @@ const Wa = { key: 0, style: { position: "absolute", inset: "0", pointerEvents: "
4023
4028
  const { left: t2, top: a3 } = (function(e16) {
4024
4029
  var _a2;
4025
4030
  const t3 = o.cssPageWidth / o.pdfPageWidth, a4 = o.cssPageHeight / o.pdfPageHeight, s9 = ((_a2 = e16.anchor.rectsPdfCoord) == null ? void 0 : _a2.length) ? e16.anchor.rectsPdfCoord : [e16.anchor.rectPdfCoord];
4026
- return qa({ markerPdf: e16.anchor.markerAnchor ?? { x: e16.anchor.rectPdfCoord.origin.x + e16.anchor.rectPdfCoord.size.width, y: e16.anchor.rectPdfCoord.origin.y + e16.anchor.rectPdfCoord.size.height }, lineRects: s9, sx: t3, sy: a4, cssPageWidth: o.cssPageWidth, iconSize: y.value });
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 });
4027
4032
  })(e15);
4028
4033
  return { position: "absolute", left: `${Math.max(0, t2 - 6)}px`, top: `${Math.max(0, a3 - 6)}px`, width: `${y.value + 12}px`, height: `${y.value + 12}px`, pointerEvents: "auto", zIndex: 20 };
4029
4034
  }
4030
- return (t2, a3) => unref(r2) && d2.value.length && e14.pdfPageWidth && e14.pdfPageHeight ? (openBlock(), createElementBlock("div", Xa, [(openBlock(true), createElementBlock(Fragment, null, renderList(d2.value, (e15) => (openBlock(), createElementBlock("div", { key: e15.id, style: normalizeStyle(C(e15)), onMousedown: a3[1] || (a3[1] = withModifiers(() => {
4031
- }, ["stop"])) }, [createElementVNode("button", { type: "button", title: e15.label, style: normalizeStyle({ position: "absolute", left: "6px", top: "6px", width: `${y.value}px`, height: `${y.value}px`, border: "none", borderRadius: "4px", background: "#3b82f6", color: "#fff", cursor: "pointer", boxShadow: "0 2px 6px rgba(37, 99, 235, 0.35)", fontSize: "11px", padding: 0 }), onClick: withModifiers((t3) => g2.value = g2.value === e15.id ? null : e15.id, ["stop"]) }, " 🔖 ", 12, Qa), g2.value === e15.id ? (openBlock(), createElementBlock("div", { key: 0, ref_for: true, ref_key: "deleteMenuRef", ref: f, style: { position: "absolute", left: "6px", top: "-36px", zIndex: 30, pointerEvents: "auto", minWidth: "88px", padding: "4px", borderRadius: "6px", background: "#fff", border: "1px solid #e5e7eb", boxShadow: "0 4px 12px rgba(0,0,0,0.12)" }, onClick: a3[0] || (a3[0] = withModifiers(() => {
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(() => {
4032
4037
  }, ["stop"])) }, [createElementVNode("button", { type: "button", style: { width: "100%", padding: "6px 8px", "font-size": "12px", border: "none", "border-radius": "4px", background: "transparent", color: "#dc2626", cursor: "pointer", "text-align": "left" }, onClick: (t3) => (async function(e16) {
4033
4038
  const t4 = r2.value;
4034
4039
  if (!t4) return;
4035
4040
  await t4.requestRemoveBookmark(e16) && (g2.value = null);
4036
- })(e15.id) }, " 删除书签 ", 8, Ja)], 512)) : createCommentVNode("", true)], 36))), 128))])) : createCommentVNode("", true);
4041
+ })(e15.id) }, " 删除书签 ", 8, ts)], 512)) : createCommentVNode("", true)], 36))), 128))])) : createCommentVNode("", true);
4037
4042
  } });
4038
- function ts(e14) {
4043
+ function ss(e14) {
4039
4044
  return e14.chapterId;
4040
4045
  }
4041
- function as(e14, t2) {
4046
+ function is(e14, t2) {
4042
4047
  e14.wait(t2, () => {
4043
4048
  });
4044
4049
  }
4045
- const ss = /* @__PURE__ */ defineComponent({ __name: "ChapterPageSurface", props: { item: {}, features: {}, showNoteMarkers: { type: Boolean }, showBookmarkMarkers: { type: Boolean }, showRedactionLayer: { type: Boolean }, noteMarkerUi: {}, bookmarkMarkerUi: {}, buildSelectionMenu: { type: Function }, createNote: {}, annotationSelectionMenu: {}, redactionSelectionMenu: {}, renderPageOverlay: { type: Function } }, setup(e14) {
4046
- const a3 = e14, i2 = computed(() => ts(a3.item));
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));
4047
4052
  !(function(e15) {
4048
4053
  const { provides: t2 } = useCapability(DocumentManagerPlugin.id);
4049
4054
  watch([t2, e15], ([e16, t3]) => {
@@ -4054,7 +4059,7 @@ const ss = /* @__PURE__ */ defineComponent({ __name: "ChapterPageSurface", props
4054
4059
  var _a2, _b;
4055
4060
  return (_b = (_a2 = o.value) == null ? void 0 : _a2.getDocument(i2.value)) == null ? void 0 : _b.pages[a3.item.localPageIndex];
4056
4061
  });
4057
- function h2(e15, t2) {
4062
+ function d2(e15, t2) {
4058
4063
  const s9 = a3.createNote.value;
4059
4064
  if (s9) return (a4) => {
4060
4065
  var _a2;
@@ -4062,7 +4067,7 @@ const ss = /* @__PURE__ */ defineComponent({ __name: "ChapterPageSurface", props
4062
4067
  return h$1("div", a4.menuWrapperProps, [h$1("div", { style: i3 }, h$1("button", { type: "button", style: { padding: "6px 10px", fontSize: "12px", border: "1px solid #e2e8f0", borderRadius: "6px", background: "#fff", cursor: "pointer" }, onClick: () => {
4063
4068
  if (!r2.value) return;
4064
4069
  const a5 = r2.value.getHighlightRectsForPage(e15.localPageIndex, t2);
4065
- as(r2.value.getSelectedText(t2), (t3) => {
4070
+ is(r2.value.getSelectedText(t2), (t3) => {
4066
4071
  s9((function(e16, t4, a6) {
4067
4072
  return { chapterId: e16.chapterId, localPageIndex: e16.localPageIndex, globalPageIndex: e16.globalPageIndex, globalPageNumber: e16.globalPageNumber, rectsPdfCoord: t4, selectedText: a6 };
4068
4073
  })(e15, a5, t3.join("\n")));
@@ -4070,21 +4075,21 @@ const ss = /* @__PURE__ */ defineComponent({ __name: "ChapterPageSurface", props
4070
4075
  } }, "添加附注"))]);
4071
4076
  };
4072
4077
  }
4073
- const d2 = computed(() => {
4074
- const e15 = a3.buildSelectionMenu, t2 = { item: a3.item, defaultMenu: h2(a3.item, i2.value), createNote: a3.createNote.value };
4078
+ const c = computed(() => {
4079
+ const e15 = a3.buildSelectionMenu, t2 = { item: a3.item, defaultMenu: d2(a3.item, i2.value), createNote: a3.createNote.value };
4075
4080
  if (e15) {
4076
4081
  const a4 = e15(t2);
4077
4082
  if (a4) return a4;
4078
4083
  }
4079
4084
  return t2.defaultMenu;
4080
- }), c = computed(() => {
4085
+ }), u = computed(() => {
4081
4086
  var _a2;
4082
4087
  return (_a2 = a3.renderPageOverlay) == null ? void 0 : _a2.call(a3, a3.item);
4083
4088
  });
4084
- return (t2, a4) => e14.item.isPlaceholder ? createCommentVNode("", true) : (openBlock(), createBlock(unref(GlobalPointerProvider), { key: 0, "document-id": i2.value }, { default: withCtx(() => [createVNode(unref(Rotate), { "document-id": i2.value, "page-index": e14.item.localPageIndex, style: { backgroundColor: "#fff" } }, { default: withCtx(() => [createVNode(unref(PagePointerProvider), { "document-id": i2.value, "page-index": e14.item.localPageIndex }, { default: withCtx(() => [createVNode(unref(Ma), { "chapter-id": i2.value, "local-page-index": e14.item.localPageIndex }, null, 8, ["chapter-id", "local-page-index"]), createVNode(unref(SelectionLayer), { "document-id": i2.value, "page-index": e14.item.localPageIndex, "selection-menu": d2.value }, null, 8, ["document-id", "page-index", "selection-menu"]), e14.showRedactionLayer ? (openBlock(), createBlock(unref(RedactionLayer), { key: 0, "document-id": i2.value, "page-index": e14.item.localPageIndex, "selection-menu": e14.redactionSelectionMenu }, null, 8, ["document-id", "page-index", "selection-menu"])) : createCommentVNode("", true), createVNode(unref(AnnotationLayer), { "document-id": i2.value, "page-index": e14.item.localPageIndex, "selection-menu": e14.annotationSelectionMenu }, null, 8, ["document-id", "page-index", "selection-menu"]), e14.showBookmarkMarkers && l.value ? (openBlock(), createBlock(es, { key: 1, "chapter-id": i2.value, "local-page-index": e14.item.localPageIndex, "pdf-page-width": l.value.size.width, "pdf-page-height": l.value.size.height, "css-page-width": e14.item.width, "css-page-height": e14.item.height, ui: e14.bookmarkMarkerUi }, null, 8, ["chapter-id", "local-page-index", "pdf-page-width", "pdf-page-height", "css-page-width", "css-page-height", "ui"])) : createCommentVNode("", true), c.value ? (openBlock(), createBlock(resolveDynamicComponent(c.value), { key: 2 })) : createCommentVNode("", true), e14.showNoteMarkers && l.value ? (openBlock(), createBlock(Ka, { key: 3, "chapter-id": i2.value, "local-page-index": e14.item.localPageIndex, "pdf-page-width": l.value.size.width, "pdf-page-height": l.value.size.height, "css-page-width": e14.item.width, "css-page-height": e14.item.height, ui: e14.noteMarkerUi }, null, 8, ["chapter-id", "local-page-index", "pdf-page-width", "pdf-page-height", "css-page-width", "css-page-height", "ui"])) : createCommentVNode("", true), renderSlot(t2.$slots, "default")]), _: 3 }, 8, ["document-id", "page-index"])]), _: 3 }, 8, ["document-id", "page-index"])]), _: 3 }, 8, ["document-id"]));
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"]));
4085
4090
  } });
4086
- const is = /* @__PURE__ */ defineComponent({ __name: "HoverBookmarkLayer", props: { item: {}, pdfPageWidth: {}, pdfPageHeight: {}, cssPageWidth: {}, cssPageHeight: {}, hoverUi: {} }, setup(e14) {
4087
- const o = e14, r2 = computed(() => ts(o.item)), { provides: d2 } = useCapability(SelectionPlugin.id), { provides: u } = useCapability(Wt.id), p2 = ref(null), g2 = ref(null), f = ref(null), P = ref(null), w = computed(() => {
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(() => {
4088
4093
  var _a2;
4089
4094
  return ((_a2 = o.hoverUi) == null ? void 0 : _a2.iconSize) ?? 16;
4090
4095
  }), y = computed(() => P.value ?? f.value);
@@ -4141,10 +4146,10 @@ const is = /* @__PURE__ */ defineComponent({ __name: "HoverBookmarkLayer", props
4141
4146
  });
4142
4147
  const k2 = computed(() => {
4143
4148
  const e15 = y.value;
4144
- return (e15 == null ? void 0 : e15.length) ? Ft(o.item.chapterId, o.item.localPageIndex, e15, { globalPageIndex: o.item.globalPageIndex, globalPageNumber: o.item.globalPageNumber }) : null;
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;
4145
4150
  }), L2 = computed(() => {
4146
4151
  const e15 = k2.value, t2 = u.value;
4147
- return !(!e15 || !t2) && t2.listBookmarks().some((t3) => Rt(t3.anchor, e15));
4152
+ return !(!e15 || !t2) && t2.listBookmarks().some((t3) => Ut(t3.anchor, e15));
4148
4153
  });
4149
4154
  function $2() {
4150
4155
  const e15 = u.value, t2 = k2.value;
@@ -4160,33 +4165,33 @@ const is = /* @__PURE__ */ defineComponent({ __name: "HoverBookmarkLayer", props
4160
4165
  var _a2;
4161
4166
  return unref(u) && e14.pdfPageWidth && e14.pdfPageHeight ? (openBlock(), createElementBlock("div", { key: 0, ref_key: "rootRef", ref: p2, style: { position: "absolute", inset: "0", zIndex: 14, pointerEvents: "none" } }, [z.value && y.value && !L2.value ? (openBlock(), createElementBlock("div", { key: 0, style: normalizeStyle({ position: "absolute", left: `${z.value.zoneLeft}px`, top: `${z.value.zoneTop}px`, width: `${z.value.size + 20}px`, height: `${(((_a2 = y.value[y.value.length - 1]) == null ? void 0 : _a2.size.height) ?? 0) * (e14.cssPageHeight / e14.pdfPageHeight) + z.value.size + 12}px`, pointerEvents: "auto" }), onMouseenter: a3[0] || (a3[0] = (e15) => P.value = y.value), onMouseleave: a3[1] || (a3[1] = (e15) => P.value = null) }, [createElementVNode("button", { type: "button", title: "添加书签", style: normalizeStyle({ position: "absolute", left: z.value.iconLeft - z.value.zoneLeft + "px", top: z.value.iconTop - z.value.zoneTop + "px", width: `${z.value.size}px`, height: `${z.value.size}px`, cursor: "pointer", display: "flex", alignItems: "center", justifyContent: "center", background: "#3b82f6", color: "#fff", border: "none", borderRadius: "4px", boxShadow: "0 2px 8px rgba(37, 99, 235, 0.45)", fontSize: "12px", padding: 0 }), onClick: withModifiers($2, ["stop"]) }, " 🔖 ", 4)], 36)) : createCommentVNode("", true)], 512)) : createCommentVNode("", true);
4162
4167
  };
4163
- } }), os = { key: 0, width: "24", height: "24", viewBox: "0 0 28 28", fill: "none", "aria-hidden": "" }, rs = { key: 0, x: "5", y: "4", width: "18", height: "20", rx: "3", fill: "#fde047" }, ns = { key: 1, d: "M6 22h16", stroke: "#dc2626", "stroke-width": "2.2", "stroke-linecap": "round" }, ls = { key: 2, d: "M6 22c2-2 3-2 5 0s3 2 5 0 3-2 5 0", stroke: "#dc2626", "stroke-width": "2", "stroke-linecap": "round", fill: "none" }, hs = { key: 3, d: "M5 14h18", stroke: "#dc2626", "stroke-width": "2.2", "stroke-linecap": "round" }, ds = { key: 1, width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "" }, cs = /* @__PURE__ */ defineComponent({ __name: "SelectionToolbarIcons", props: { kind: {} }, setup: (e14) => (t2, a3) => "note" !== e14.kind ? (openBlock(), createElementBlock("svg", os, ["highlight" === e14.kind ? (openBlock(), createElementBlock("rect", rs)) : createCommentVNode("", true), a3[0] || (a3[0] = createElementVNode("text", { x: "14", y: "19", "text-anchor": "middle", "font-size": "15", "font-weight": "700", "font-family": "system-ui, -apple-system, sans-serif", fill: "#0f172a" }, " A ", -1)), "underline" === e14.kind ? (openBlock(), createElementBlock("path", ns)) : "squiggly" === e14.kind ? (openBlock(), createElementBlock("path", ls)) : "strikeout" === e14.kind ? (openBlock(), createElementBlock("path", hs)) : createCommentVNode("", true)])) : (openBlock(), createElementBlock("svg", ds, [...a3[1] || (a3[1] = [createElementVNode("path", { d: "M8 3h8l4 4v14H8V3z", fill: "#fef3c7", stroke: "#d97706", "stroke-width": "1.2", "stroke-linejoin": "round" }, null, -1), createElementVNode("path", { d: "M16 3v4h4", stroke: "#d97706", "stroke-width": "1.2" }, null, -1), createElementVNode("path", { d: "M10 12h6M10 16h4", stroke: "#92400e", "stroke-width": "1.2", "stroke-linecap": "round" }, null, -1)])])) }), us = ["title", "aria-label", "onMouseenter", "onClick"], ps = ["title", "onMouseenter", "onClick"], gs = { style: { "font-size": "11px", "font-weight": "600" } }, fs = /* @__PURE__ */ defineComponent({ __name: "SelectionToolbarCard", props: { placementAbove: { type: Boolean }, anchorHeight: {}, hiddenBuiltinActions: {}, extraActions: {} }, emits: ["action"], setup(e14, { emit: s9 }) {
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 }) {
4164
4169
  const i2 = e14, o = s9, r2 = [{ id: "highlight", label: "高亮背景" }, { id: "underline", label: "下划线" }, { id: "squiggly", label: "波浪线" }, { id: "strikeout", label: "删除线" }, { id: "note", label: "添加笔记" }], d2 = computed(() => new Set(i2.hiddenBuiltinActions ?? [])), g2 = computed(() => r2.filter((e15) => "note" !== e15.id && !d2.value.has(e15.id))), f = computed(() => !d2.value.has("note")), m = computed(() => [...i2.extraActions ?? []].sort((e15, t2) => (e15.order ?? 0) - (t2.order ?? 0))), v = ref(null), P = computed(() => ({ position: "absolute", pointerEvents: "auto", left: "50%", transform: "translateX(-50%)", top: i2.placementAbove ? void 0 : `${i2.anchorHeight + 10}px`, bottom: i2.placementAbove ? `${i2.anchorHeight + 10}px` : void 0, display: "flex", alignItems: "center", gap: "2px", padding: "4px 6px", borderRadius: "12px", background: "rgba(255, 255, 255, 0.96)", border: "1px solid rgba(15, 23, 42, 0.06)", boxShadow: "0 2px 8px rgba(15, 23, 42, 0.08), 0 12px 32px rgba(15, 23, 42, 0.1)", backdropFilter: "blur(10px)", WebkitBackdropFilter: "blur(10px)" }));
4165
4170
  function y(e15, t2 = false) {
4166
4171
  return { display: "flex", alignItems: "center", justifyContent: "center", width: "32px", height: "32px", padding: 0, margin: 0, border: "none", borderRadius: "8px", background: v.value === e15 ? t2 ? "#fffbeb" : "#f1f5f9" : "transparent", color: t2 ? "#b45309" : "#334155", cursor: "pointer", flexShrink: 0, WebkitAppearance: "none", appearance: "none" };
4167
4172
  }
4168
4173
  const C = { width: "1px", height: "20px", margin: "0 4px", background: "rgba(15, 23, 42, 0.1)", flexShrink: 0 };
4169
- return (e15, t2) => (openBlock(), createElementBlock("div", { role: "toolbar", "aria-label": "选区工具", style: normalizeStyle(P.value) }, [(openBlock(true), createElementBlock(Fragment, null, renderList(g2.value, (e16) => (openBlock(), createElementBlock("button", { key: e16.id, type: "button", title: e16.label, "aria-label": e16.label, style: normalizeStyle(y(e16.id)), onMouseenter: (t3) => v.value = e16.id, onMouseleave: t2[0] || (t2[0] = (e17) => v.value = null), onClick: (t3) => o("action", e16.id) }, [createVNode(cs, { kind: e16.id }, null, 8, ["kind"])], 44, us))), 128)), (openBlock(true), createElementBlock(Fragment, null, renderList(m.value, (e16) => (openBlock(), createElementBlock("button", { key: e16.id, type: "button", title: e16.label, style: normalizeStyle(y(e16.id)), onMouseenter: (t3) => v.value = e16.id, onMouseleave: t2[1] || (t2[1] = (e17) => v.value = null), onClick: (t3) => o("action", e16.id) }, [createElementVNode("span", gs, toDisplayString(e16.label.slice(0, 2)), 1)], 44, ps))), 128)), f.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("span", { style: C, "aria-hidden": "" }), createElementVNode("button", { type: "button", title: "添加笔记", "aria-label": "添加笔记", style: normalizeStyle(y("note", true)), onMouseenter: t2[2] || (t2[2] = (e16) => v.value = "note"), onMouseleave: t2[3] || (t2[3] = (e16) => v.value = null), onClick: t2[4] || (t2[4] = (e16) => o("action", "note")) }, [createVNode(cs, { kind: "note" })], 36)], 64)) : createCommentVNode("", true)], 4));
4170
- } }), ms = { highlight: "highlight", underline: "underline", squiggly: "squiggly", strikeout: "strikeout" };
4171
- const vs = /* @__PURE__ */ defineComponent({ __name: "PdfChapterViewport", props: { className: {}, features: {}, buildSelectionMenu: {}, annotationSelectionMenu: {}, redactionSelectionMenu: {}, showNoteMarkers: { type: Boolean, default: true }, showBookmarkMarkers: { type: Boolean, default: true }, showRedactionLayer: { type: Boolean, default: false }, renderPageOverlay: {}, onExtraSelectionAction: {} }, setup(e14) {
4172
- const a3 = e14, s9 = computed(() => a3.features), { hostRef: i2 } = ua(s9), o = (function() {
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() {
4173
4178
  const { registry: e15 } = useRegistry();
4174
4179
  return computed(() => {
4175
4180
  var _a2, _b, _c;
4176
- const t2 = (_c = (_b = (_a2 = e15.value) == null ? void 0 : _a2.getPlugin(vt$1.id)) == null ? void 0 : _b.provides) == null ? void 0 : _c.call(_b);
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);
4177
4182
  return t2 ? (e16) => t2.createNoteFromSelection(e16) : null;
4178
4183
  });
4179
4184
  })(), r2 = (function() {
4180
4185
  const { registry: e15 } = useRegistry();
4181
4186
  return computed(() => {
4182
4187
  var _a2;
4183
- return !!((_a2 = e15.value) == null ? void 0 : _a2.getPlugin(vt$1.id));
4188
+ return !!((_a2 = e15.value) == null ? void 0 : _a2.getPlugin(Pt$1.id));
4184
4189
  });
4185
4190
  })(), c = (function() {
4186
4191
  const { registry: e15 } = useRegistry();
4187
4192
  return computed(() => {
4188
4193
  var _a2;
4189
- return !!((_a2 = e15.value) == null ? void 0 : _a2.getPlugin(Wt.id));
4194
+ return !!((_a2 = e15.value) == null ? void 0 : _a2.getPlugin(Bt$1.id));
4190
4195
  });
4191
4196
  })(), u = computed(() => {
4192
4197
  var _a2, _b;
@@ -4207,20 +4212,20 @@ const vs = /* @__PURE__ */ defineComponent({ __name: "PdfChapterViewport", props
4207
4212
  }), o2 = computed(() => {
4208
4213
  var _a2, _b;
4209
4214
  return false !== ((_b = (_a2 = e15()) == null ? void 0 : _a2.notes) == null ? void 0 : _b.enabled);
4210
- }), { provides: r3 } = useCapability(SelectionPlugin.id), { provides: n2 } = useCapability(AnnotationPlugin.id), { provides: l } = useCapability(vt$1.id);
4215
+ }), { provides: r3 } = useCapability(SelectionPlugin.id), { provides: n2 } = useCapability(AnnotationPlugin.id), { provides: l } = useCapability(Pt$1.id);
4211
4216
  return computed(() => {
4212
4217
  var _a2, _b, _c;
4213
4218
  if (false !== ((_a2 = s10.value) == null ? void 0 : _a2.enabled) && (i3.value || o2.value || ((_c = (_b = s10.value) == null ? void 0 : _b.extraActions) == null ? void 0 : _c.length))) return (t2) => {
4214
- const h2 = ts(t2.item);
4219
+ const h2 = ss(t2.item);
4215
4220
  return (d2) => {
4216
4221
  var _a3, _b2, _c2;
4217
- return h$1("div", d2.menuWrapperProps, h$1(fs, { placementAbove: !!((_a3 = d2.placement) == null ? void 0 : _a3.suggestTop), anchorHeight: d2.rect.size.height, hiddenBuiltinActions: (_b2 = s10.value) == null ? void 0 : _b2.hiddenBuiltinActions, extraActions: (_c2 = s10.value) == null ? void 0 : _c2.extraActions, onAction: (s11) => {
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) => {
4218
4223
  var _a4, _b3, _c3;
4219
4224
  if ("highlight" !== s11 && "underline" !== s11 && "squiggly" !== s11 && "strikeout" !== s11) {
4220
4225
  if ("note" === s11) {
4221
4226
  if (!r3.value || !l.value || !o2.value) return;
4222
4227
  const e16 = r3.value.getHighlightRectsForPage(t2.item.localPageIndex, h2);
4223
- return void as(r3.value.getSelectedText(h2), (a5) => {
4228
+ return void is(r3.value.getSelectedText(h2), (a5) => {
4224
4229
  var _a5;
4225
4230
  (_a5 = l.value) == null ? void 0 : _a5.requestCreateFromSelection({ chapterId: t2.item.chapterId, localPageIndex: t2.item.localPageIndex, globalPageIndex: t2.item.globalPageIndex, globalPageNumber: t2.item.globalPageNumber, rectsPdfCoord: e16, selectedText: a5.join("\n") });
4226
4231
  });
@@ -4228,7 +4233,7 @@ const vs = /* @__PURE__ */ defineComponent({ __name: "PdfChapterViewport", props
4228
4233
  (_a4 = a4 == null ? void 0 : a4.onExtraAction) == null ? void 0 : _a4.call(a4, s11, t2);
4229
4234
  } else {
4230
4235
  if (!r3.value || !n2.value || !i3.value) return;
4231
- Ce(h2, ms[s11], n2.value, r3.value, (_c3 = (_b3 = e15()) == null ? void 0 : _b3.markup) == null ? void 0 : _c3.styles);
4236
+ Me(h2, bs[s11], n2.value, r3.value, (_c3 = (_b3 = e15()) == null ? void 0 : _b3.markup) == null ? void 0 : _c3.styles);
4232
4237
  }
4233
4238
  } }));
4234
4239
  };
@@ -4246,35 +4251,35 @@ const vs = /* @__PURE__ */ defineComponent({ __name: "PdfChapterViewport", props
4246
4251
  if (f.value) {
4247
4252
  const s11 = (function(e16) {
4248
4253
  var _a3, _b, _c, _d;
4249
- const t3 = ts(e16), s12 = (_b = (_a3 = y.value) == null ? void 0 : _a3.getDocument(t3)) == null ? void 0 : _b.pages[e16.localPageIndex];
4250
- return e16.isPlaceholder || !s12 ? null : h$1(is, { item: e16, pdfPageWidth: s12.size.width, pdfPageHeight: s12.size.height, cssPageWidth: e16.width, cssPageHeight: e16.height, hoverUi: (_d = (_c = a3.features) == null ? void 0 : _c.bookmarks) == null ? void 0 : _d.hover });
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 });
4251
4256
  })(e15);
4252
4257
  s11 && t2.push(s11);
4253
4258
  }
4254
4259
  const s10 = (_a2 = a3.renderPageOverlay) == null ? void 0 : _a2.call(a3, e15);
4255
4260
  if (s10 && t2.push(s10), t2.length) return h$1("div", t2);
4256
4261
  }
4257
- return (t2, a4) => (openBlock(), createElementBlock("div", { ref_key: "hostRef", ref: i2, class: normalizeClass(e14.className), style: normalizeStyle(e14.className ? void 0 : unref(ve$1)) }, [createVNode(unref(Ia), { class: normalizeClass(e14.className) }, { page: withCtx(({ item: t3 }) => {
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 }) => {
4258
4263
  var _a2, _b, _c, _d;
4259
- return [createVNode(ss, { item: t3, features: e14.features, "show-note-markers": u.value, "show-bookmark-markers": p2.value, "show-redaction-layer": e14.showRedactionLayer, "note-marker-ui": (_b = (_a2 = e14.features) == null ? void 0 : _a2.notes) == null ? void 0 : _b.marker, "bookmark-marker-ui": (_d = (_c = e14.features) == null ? void 0 : _c.bookmarks) == null ? void 0 : _d.marker, "build-selection-menu": b.value, "create-note": unref(o), "annotation-selection-menu": e14.annotationSelectionMenu, "redaction-selection-menu": e14.redactionSelectionMenu, "render-page-overlay": I }, null, 8, ["item", "features", "show-note-markers", "show-bookmark-markers", "show-redaction-layer", "note-marker-ui", "bookmark-marker-ui", "build-selection-menu", "create-note", "annotation-selection-menu", "redaction-selection-menu"])];
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"])];
4260
4265
  }), _: 1 }, 8, ["class"]), renderSlot(t2.$slots, "default")], 6));
4261
- } }), bs = { key: 0, style: { display: "flex", flexDirection: "column", height: "100%", minHeight: 0, width: "100%" } }, Ps = /* @__PURE__ */ defineComponent({ __name: "ChapterPdfViewer", props: { engine: {}, options: {}, editorOptions: {}, features: {}, className: {}, viewportClassName: {}, onExtraSelectionAction: { type: Function } }, setup(e14) {
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) {
4262
4267
  const a3 = e14, s9 = computed(() => (function(e15) {
4263
- if (e15.options) return oa(e15.options);
4268
+ if (e15.options) return na(e15.options);
4264
4269
  if (!e15.editorOptions) throw new Error("ChapterPdfViewer: 请传入 `options`(推荐),或同时传入 `editorOptions` 与 `features`");
4265
- const t2 = Me(e15.features), { plugins: a4 } = ta({ ...e15.editorOptions, features: t2 });
4270
+ const t2 = xe(e15.features), { plugins: a4 } = sa({ ...e15.editorOptions, features: t2 });
4266
4271
  return { plugins: a4, features: t2, editorOptions: { ...e15.editorOptions, features: t2 } };
4267
4272
  })({ engine: a3.engine, options: a3.options, editorOptions: a3.editorOptions, features: a3.features }));
4268
- return (t2, a4) => (openBlock(), createElementBlock("div", { class: normalizeClass(e14.className), style: normalizeStyle(e14.className ? void 0 : unref(ve$1)) }, [createVNode(unref(EmbedPDF), { engine: e14.engine, plugins: s9.value.plugins }, { default: withCtx(({ pluginsReady: a5 }) => [a5 ? (openBlock(), createElementBlock("div", bs, [renderSlot(t2.$slots, "prepend"), createVNode(vs, { class: normalizeClass(e14.viewportClassName), style: { flex: 1, minHeight: 0 }, features: s9.value.features, "on-extra-selection-action": e14.onExtraSelectionAction }, null, 8, ["class", "features", "on-extra-selection-action"]), renderSlot(t2.$slots, "default")])) : createCommentVNode("", true)]), _: 3 }, 8, ["engine", "plugins"])], 6));
4269
- } }), ws = { class: "chapter-tree-row" }, ys = ["aria-expanded"], Cs = { key: 1, class: "chapter-tree-toggle-spacer", "aria-hidden": "" }, Is = { class: "chapter-tree-label" }, Ms = { class: "chapter-tree-meta" }, Ss = { key: 0 }, xs = (e14, t2) => {
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) => {
4270
4275
  const a3 = e14.__vccOpts || e14;
4271
4276
  for (const [s9, i2] of t2) a3[s9] = i2;
4272
4277
  return a3;
4273
- }, ks = /* @__PURE__ */ xs(/* @__PURE__ */ defineComponent({ __name: "ChapterTreeItem", props: { node: {}, depth: {}, activeChapterId: {}, chapterStatus: {} }, emits: ["select"], setup(e14) {
4278
+ }, $s = /* @__PURE__ */ Ls(/* @__PURE__ */ defineComponent({ __name: "ChapterTreeItem", props: { node: {}, depth: {}, activeChapterId: {}, chapterStatus: {} }, emits: ["select"], setup(e14) {
4274
4279
  const s9 = { idle: "未加载", loading: "加载中", loaded: "已加载", closed: "已卸载", error: "失败", "password-required": "需密码" }, i2 = e14, o = computed(() => i2.node.children ?? []), r2 = computed(() => o.value.length > 0), h2 = ref(i2.depth < 1), u = computed(() => i2.activeChapterId === i2.node.id), p2 = computed(() => i2.chapterStatus[i2.node.id] ?? "idle"), g2 = computed(() => !r2.value);
4275
- return (t2, a3) => (openBlock(), createElementBlock("li", null, [createElementVNode("div", ws, [r2.value ? (openBlock(), createElementBlock("button", { key: 0, type: "button", class: "chapter-tree-toggle", "aria-expanded": h2.value, onClick: a3[0] || (a3[0] = (e15) => h2.value = !h2.value) }, toDisplayString(h2.value ? "▼" : "▶"), 9, ys)) : (openBlock(), createElementBlock("span", Cs)), createElementVNode("button", { type: "button", class: normalizeClass(["chapter-tree-btn", { "chapter-tree-btn-active": u.value }]), onClick: a3[1] || (a3[1] = (a4) => t2.$emit("select", e14.node.id)) }, [createElementVNode("div", Is, toDisplayString(e14.node.title), 1), createElementVNode("div", Ms, [createElementVNode("span", null, " 第 " + toDisplayString(e14.node.startPage) + toDisplayString(e14.node.endPage !== e14.node.startPage ? `–${e14.node.endPage}` : "") + " 页 ", 1), g2.value ? (openBlock(), createElementBlock("span", Ss, toDisplayString(s9[p2.value]), 1)) : createCommentVNode("", true)])], 2)]), r2.value && h2.value ? (openBlock(), createBlock(Ls, { key: 0, nodes: o.value, depth: e14.depth + 1, "active-chapter-id": e14.activeChapterId, "chapter-status": e14.chapterStatus, onSelect: a3[2] || (a3[2] = (e15) => t2.$emit("select", e15)) }, null, 8, ["nodes", "depth", "active-chapter-id", "chapter-status"])) : createCommentVNode("", true)]));
4276
- } }), [["__scopeId", "data-v-315bbf7a"]]), Ls = /* @__PURE__ */ xs(/* @__PURE__ */ defineComponent({ __name: "ChapterTreeList", props: { nodes: {}, depth: {}, activeChapterId: {}, chapterStatus: {} }, emits: ["select"], setup: (e14) => (t2, a3) => (openBlock(), createElementBlock("ul", { class: "chapter-tree-list", style: normalizeStyle({ marginLeft: e14.depth > 0 ? "12px" : "0" }) }, [(openBlock(true), createElementBlock(Fragment, null, renderList(e14.nodes, (s9) => (openBlock(), createBlock(ks, { key: s9.id, node: s9, depth: e14.depth, "active-chapter-id": e14.activeChapterId, "chapter-status": e14.chapterStatus, onSelect: a3[0] || (a3[0] = (e15) => t2.$emit("select", e15)) }, null, 8, ["node", "depth", "active-chapter-id", "chapter-status"]))), 128))], 4)) }), [["__scopeId", "data-v-eb742e4f"]]), $s = { class: "chapter-tree" }, zs = { class: "chapter-tree-nav", "aria-label": "章节目录" }, Ts = /* @__PURE__ */ xs(/* @__PURE__ */ defineComponent({ __name: "ChapterTreePanel", props: { tree: {}, activeChapterId: {} }, emits: ["active-chapter-change"], setup(e14, { emit: t2 }) {
4277
- const o = e14, r2 = t2, { provides: h2 } = useCapability(Xe.id), { provides: d2 } = useCapability(Ee.id), u = ref({});
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({});
4278
4283
  function p2() {
4279
4284
  if (!d2.value) return;
4280
4285
  const e15 = {}, t3 = (a3) => {
@@ -4291,7 +4296,7 @@ const vs = /* @__PURE__ */ defineComponent({ __name: "PdfChapterViewport", props
4291
4296
  }
4292
4297
  return watch(d2, (e15) => {
4293
4298
  g2 == null ? void 0 : g2(), g2 = e15 ? e15.onChapterStatusChange(p2) : null;
4294
- }, { immediate: true }), onBeforeUnmount(() => g2 == null ? void 0 : g2()), (t3, a3) => (openBlock(), createElementBlock("aside", $s, [a3[0] || (a3[0] = createElementVNode("h2", { class: "chapter-tree-title" }, "章节目录", -1)), createElementVNode("nav", zs, [createVNode(Ls, { nodes: e14.tree, depth: 0, "active-chapter-id": e14.activeChapterId, "chapter-status": u.value, onSelect: f }, null, 8, ["nodes", "active-chapter-id", "chapter-status"])])]));
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"])])]));
4295
4300
  } }), [["__scopeId", "data-v-d7a0838d"]]);
4296
4301
  const _sfc_main = /* @__PURE__ */ defineComponent({
4297
4302
  __name: "ChapterPdfViewer",
@@ -4305,7 +4310,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4305
4310
  },
4306
4311
  setup(__props) {
4307
4312
  return (_ctx, _cache) => {
4308
- return openBlock(), createBlock(unref(Ps), normalizeProps(guardReactiveProps(_ctx.$props)), createSlots({
4313
+ return openBlock(), createBlock(unref(ys), normalizeProps(guardReactiveProps(_ctx.$props)), createSlots({
4309
4314
  default: withCtx(() => [
4310
4315
  renderSlot(_ctx.$slots, "default")
4311
4316
  ]),
@@ -4511,8 +4516,8 @@ const _ChapterManagerPlugin = class _ChapterManagerPlugin2 extends BasePlugin {
4511
4516
  for (let i2 = 0; i2 < count; i2++) {
4512
4517
  const chapterId = this.manifest.chapters[i2].chapterId;
4513
4518
  this.chapterLastUsed.set(chapterId, now);
4514
- const st3 = this.chapterStatus.get(chapterId) ?? "idle";
4515
- if (st3 === "idle" || st3 === "closed" || st3 === "error") {
4519
+ const st2 = this.chapterStatus.get(chapterId) ?? "idle";
4520
+ if (st2 === "idle" || st2 === "closed" || st2 === "error") {
4516
4521
  void this.ensureChapterLoaded(chapterId);
4517
4522
  }
4518
4523
  }
@@ -4547,8 +4552,8 @@ const _ChapterManagerPlugin = class _ChapterManagerPlugin2 extends BasePlugin {
4547
4552
  for (const i2 of neededIdx) needed.add(orderedIds[i2]);
4548
4553
  for (const cid of needed) {
4549
4554
  this.chapterLastUsed.set(cid, now);
4550
- const st3 = this.chapterStatus.get(cid) ?? "idle";
4551
- if (st3 === "idle" || st3 === "closed" || st3 === "error") {
4555
+ const st2 = this.chapterStatus.get(cid) ?? "idle";
4556
+ if (st2 === "idle" || st2 === "closed" || st2 === "error") {
4552
4557
  void this.ensureChapterLoaded(cid);
4553
4558
  }
4554
4559
  }
@@ -4566,8 +4571,8 @@ const _ChapterManagerPlugin = class _ChapterManagerPlugin2 extends BasePlugin {
4566
4571
  const timeout = this.config.unloadTimeoutMs ?? 6e4;
4567
4572
  if (timeout <= 0) return;
4568
4573
  const now = Date.now();
4569
- for (const [cid, st3] of this.chapterStatus) {
4570
- if (st3 !== "loaded") continue;
4574
+ for (const [cid, st2] of this.chapterStatus) {
4575
+ if (st2 !== "loaded") continue;
4571
4576
  const last = this.chapterLastUsed.get(cid) ?? 0;
4572
4577
  if (now - last > timeout) {
4573
4578
  this.closeChapter(cid);
@@ -4656,9 +4661,9 @@ const _ChapterManagerPlugin = class _ChapterManagerPlugin2 extends BasePlugin {
4656
4661
  /** 阻塞等待该章节状态进入 loaded / error / password-required / closed */
4657
4662
  waitForTerminalStatus(chapterId) {
4658
4663
  return new Promise((resolve) => {
4659
- const check = (st3) => {
4660
- if (st3 === "loaded" || st3 === "error" || st3 === "password-required" || st3 === "closed") {
4661
- resolve(st3);
4664
+ const check = (st2) => {
4665
+ if (st2 === "loaded" || st2 === "error" || st2 === "password-required" || st2 === "closed") {
4666
+ resolve(st2);
4662
4667
  return true;
4663
4668
  }
4664
4669
  return false;
@@ -5751,7 +5756,7 @@ let at = class {
5751
5756
  return a3 ? this._pages.indexOf(a3) : -1;
5752
5757
  }
5753
5758
  };
5754
- function st2(t2, e14 = tt) {
5759
+ function st(t2, e14 = tt) {
5755
5760
  const a3 = (function(t3, e15 = tt) {
5756
5761
  const a4 = /* @__PURE__ */ new Map();
5757
5762
  for (const o2 of t3.chapters) {
@@ -5776,7 +5781,7 @@ function st2(t2, e14 = tt) {
5776
5781
  }
5777
5782
  return new at(r2);
5778
5783
  }
5779
- const ot = class s5 extends BasePlugin {
5784
+ const ot2 = class s5 extends BasePlugin {
5780
5785
  constructor(t2, s9) {
5781
5786
  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);
5782
5787
  }
@@ -5816,7 +5821,7 @@ const ot = class s5 extends BasePlugin {
5816
5821
  const a3 = new Set(this.chapterStatus.keys()), o = new Set(t2.chapters.map((t3) => t3.chapterId));
5817
5822
  for (const s9 of a3) o.has(s9) || (this.closeChapter(s9), this.chapterStatus.delete(s9));
5818
5823
  for (const s9 of t2.chapters) this.chapterStatus.has(s9.chapterId) || this.chapterStatus.set(s9.chapterId, "idle");
5819
- this.manifest = t2, this.virtualPageMap = st2(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
5824
+ this.manifest = t2, this.virtualPageMap = st(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
5820
5825
  }
5821
5826
  eagerPrefetchFromManifest() {
5822
5827
  const t2 = this.config.prefetchChapters ?? 0;
@@ -5954,8 +5959,8 @@ const ot = class s5 extends BasePlugin {
5954
5959
  this.chapterStatus.get(t2) !== e14 && (this.chapterStatus.set(t2, e14), this.statusChange$.emit({ chapterId: t2, status: e14, ..."error" === e14 && a3 ? { error: { message: a3 } } : {} }));
5955
5960
  }
5956
5961
  };
5957
- ot.id = "chapter-manager";
5958
- let rt = ot;
5962
+ ot2.id = "chapter-manager";
5963
+ let rt = ot2;
5959
5964
  function it(t2, e14) {
5960
5965
  if (t2 === e14) return true;
5961
5966
  if (t2.totalHeight !== e14.totalHeight || t2.totalWidth !== e14.totalWidth || t2.pageGap !== e14.pageGap || t2.items.length !== e14.items.length) return false;
@@ -6145,10 +6150,10 @@ const nt = class extends BasePlugin {
6145
6150
  }
6146
6151
  };
6147
6152
  nt.id = "chapter-scroll";
6148
- let ht2 = nt;
6153
+ let ht = nt;
6149
6154
  const dt = class s6 extends BasePlugin {
6150
6155
  constructor(t2, s9) {
6151
- super(t2, s9), this.notesChange$ = createBehaviorEmitter([]), this.noteActivated$ = createEmitter(), this.notes = /* @__PURE__ */ new Map(), this.chapterScroll = this.registry.getPlugin(ht2.id), this.chapterManager = this.registry.getPlugin(Z.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
6156
+ super(t2, s9), this.notesChange$ = createBehaviorEmitter([]), this.noteActivated$ = createEmitter(), this.notes = /* @__PURE__ */ new Map(), this.chapterScroll = this.registry.getPlugin(ht.id), this.chapterManager = this.registry.getPlugin(Z.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
6152
6157
  }
6153
6158
  async initialize(t2) {
6154
6159
  if (this.config = t2, t2.callbacks.loadNotes) try {
@@ -6186,7 +6191,7 @@ const dt = class s6 extends BasePlugin {
6186
6191
  this.notesChange$.emit(this.listAll());
6187
6192
  }
6188
6193
  buildDraft(t2) {
6189
- 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 };
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 };
6190
6195
  }
6191
6196
  async requestCreateFromSelection(t2) {
6192
6197
  if (0 === t2.rectsPdfCoord.length) return null;
@@ -6255,12 +6260,12 @@ const dt = class s6 extends BasePlugin {
6255
6260
  };
6256
6261
  dt.id = "note";
6257
6262
  let lt = dt;
6258
- function ct(t2) {
6263
+ function ct2(t2) {
6259
6264
  const e14 = t2[t2.length - 1];
6260
6265
  return { x: e14.origin.x + e14.size.width, y: e14.origin.y + e14.size.height };
6261
6266
  }
6262
6267
  const ft = { kind: "first-wins" };
6263
- function mt(t2, e14, a3) {
6268
+ function mt2(t2, e14, a3) {
6264
6269
  if (1 === e14.length) return e14[0].chapterId;
6265
6270
  switch (a3.kind) {
6266
6271
  case "first-wins":
@@ -6323,7 +6328,7 @@ function bt(t2, e14 = ft) {
6323
6328
  }
6324
6329
  }
6325
6330
  const s10 = /* @__PURE__ */ new Map();
6326
- for (const [o2, r3] of a4) s10.set(o2, mt(o2, r3, e15));
6331
+ for (const [o2, r3] of a4) s10.set(o2, mt2(o2, r3, e15));
6327
6332
  return s10;
6328
6333
  })(t2, e14), s9 = /* @__PURE__ */ new Map();
6329
6334
  for (const n2 of t2.chapters) s9.set(n2.chapterId, n2);
@@ -6570,7 +6575,7 @@ class Ct {
6570
6575
  return a3 ? this._pages.indexOf(a3) : -1;
6571
6576
  }
6572
6577
  }
6573
- function Mt2(t2, e14 = yt) {
6578
+ function Mt(t2, e14 = yt) {
6574
6579
  const a3 = (function(t3, e15 = yt) {
6575
6580
  const a4 = /* @__PURE__ */ new Map();
6576
6581
  for (const o2 of t3.chapters) {
@@ -6635,7 +6640,7 @@ const St = class s8 extends BasePlugin {
6635
6640
  const a3 = new Set(this.chapterStatus.keys()), o = new Set(t2.chapters.map((t3) => t3.chapterId));
6636
6641
  for (const s9 of a3) o.has(s9) || (this.closeChapter(s9), this.chapterStatus.delete(s9));
6637
6642
  for (const s9 of t2.chapters) this.chapterStatus.has(s9.chapterId) || this.chapterStatus.set(s9.chapterId, "idle");
6638
- this.manifest = t2, this.virtualPageMap = Mt2(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
6643
+ this.manifest = t2, this.virtualPageMap = Mt(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
6639
6644
  }
6640
6645
  eagerPrefetchFromManifest() {
6641
6646
  const t2 = this.config.prefetchChapters ?? 0;
@@ -6774,7 +6779,7 @@ const St = class s8 extends BasePlugin {
6774
6779
  }
6775
6780
  };
6776
6781
  St.id = "chapter-manager";
6777
- let xt = St;
6782
+ let xt2 = St;
6778
6783
  function kt(t2, e14) {
6779
6784
  if (t2 === e14) return true;
6780
6785
  if (t2.totalHeight !== e14.totalHeight || t2.totalWidth !== e14.totalWidth || t2.pageGap !== e14.pageGap || t2.items.length !== e14.items.length) return false;
@@ -6786,7 +6791,7 @@ function kt(t2, e14) {
6786
6791
  }
6787
6792
  const Lt = class extends BasePlugin {
6788
6793
  constructor(t2, a3) {
6789
- 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);
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);
6790
6795
  }
6791
6796
  async initialize(t2) {
6792
6797
  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 }) => {
@@ -6969,7 +6974,7 @@ function Tt(t2) {
6969
6974
  const e14 = t2[t2.length - 1];
6970
6975
  return { x: e14.origin.x + e14.size.width, y: e14.origin.y + e14.size.height };
6971
6976
  }
6972
- function Dt(t2, e14) {
6977
+ function Dt2(t2, e14) {
6973
6978
  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);
6974
6979
  if (i2 <= 0) return 0;
6975
6980
  return Math.max(0, Math.min(s9, r2) - Math.max(a3, o)) / i2;
@@ -6980,7 +6985,7 @@ function Ot(t2, e14) {
6980
6985
  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);
6981
6986
  if (Math.hypot(i2.x - n2.x, i2.y - n2.y) <= 6) return true;
6982
6987
  for (const h2 of o) for (const t3 of r2) {
6983
- if (Dt(h2, t3) < 0.5) continue;
6988
+ if (Dt2(h2, t3) < 0.5) continue;
6984
6989
  const e15 = Math.max(h2.origin.x, t3.origin.x);
6985
6990
  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;
6986
6991
  }
@@ -6999,7 +7004,7 @@ async function Gt(t2, e14, a3) {
6999
7004
  });
7000
7005
  })(t2, e14), t2.scrollToGlobalPdfPoint(e14, a3, { marginTop: 80 });
7001
7006
  }
7002
- const zt2 = class a2 extends BasePlugin {
7007
+ const zt = class a2 extends BasePlugin {
7003
7008
  constructor(t2, a3) {
7004
7009
  super(t2, a3), this.change$ = createBehaviorEmitter([]), this.entries = /* @__PURE__ */ new Map(), this.chapterScroll = this.registry.getPlugin($t.id), this.chapterManager = this.registry.getPlugin(wt.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
7005
7010
  }
@@ -7076,8 +7081,8 @@ const zt2 = class a2 extends BasePlugin {
7076
7081
  await Gt(a3, s9, o);
7077
7082
  }
7078
7083
  };
7079
- zt2.id = "paragraph-bookmark";
7080
- let At = zt2;
7084
+ zt.id = "paragraph-bookmark";
7085
+ let At = zt;
7081
7086
  function Bt(t2, e14) {
7082
7087
  const a3 = t2;
7083
7088
  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) };
@@ -7232,24 +7237,24 @@ function d(e14) {
7232
7237
  }
7233
7238
  export {
7234
7239
  se as CHAPTER_ANNOTATIONS_ARCHIVE_VERSION,
7235
- xe as CallbackPasswordProvider,
7240
+ Le as CallbackPasswordProvider,
7236
7241
  ChapterManagerPlugin,
7237
7242
  _sfc_main as ChapterPdfViewer,
7238
- Ts as ChapterTreePanel,
7239
- ea as DEFAULT_CHAPTER_VIEWER_CONFIG,
7240
- Jt as DEFAULT_CHAPTER_VIEWER_FEATURES,
7243
+ Os as ChapterTreePanel,
7244
+ aa as DEFAULT_CHAPTER_VIEWER_CONFIG,
7245
+ ta as DEFAULT_CHAPTER_VIEWER_FEATURES,
7241
7246
  EmbedPDF2 as EmbedPDF,
7242
- vs as PdfChapterViewport,
7243
- Ce as applySelectionMarkup,
7247
+ Ps as PdfChapterViewport,
7248
+ Me as applySelectionMarkup,
7244
7249
  d as buildChapterViewerCatalog,
7245
- Ft as buildParagraphBookmarkAnchor,
7250
+ qt as buildParagraphBookmarkAnchor,
7246
7251
  ge as chapterAnnotationsArchiveToJson,
7247
7252
  me as chapterAnnotationsSnapshotToJson,
7248
7253
  h as chapterDescriptorFromTreeNode,
7249
- oa as createChapterViewerBundle,
7250
- ta as createChapterViewerEditor,
7251
- ra as createChapterViewerEditorOptions,
7252
- Xt as createPdfChapterEditor,
7254
+ na as createChapterViewerBundle,
7255
+ sa as createChapterViewerEditor,
7256
+ la as createChapterViewerEditorOptions,
7257
+ Jt as createPdfChapterEditor,
7253
7258
  t as defaultOverlapStrategy,
7254
7259
  Pe as downloadChapterAnnotationsArchive,
7255
7260
  we as downloadChapterAnnotationsSnapshot,