@embedpdf-editor/chapter-snippet 0.3.0 → 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.
@@ -297,26 +297,26 @@ function _unsupportedIterableToArray(r, a) {
297
297
  }
298
298
 
299
299
  var n$1,
300
- l$2,
300
+ l$1,
301
301
  u$2,
302
- i$1,
302
+ i$2,
303
303
  o$1,
304
304
  r$3,
305
305
  e$2,
306
306
  f$2,
307
- c$1,
307
+ c$2,
308
308
  s$2,
309
309
  a$2,
310
- h$1,
311
- p$1 = {},
310
+ h$2,
311
+ p$2 = {},
312
312
  v$1 = [],
313
313
  y$1 = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,
314
- d$1 = Array.isArray;
314
+ d$2 = Array.isArray;
315
315
  function w$1(n, l) {
316
316
  for (var u in l) n[u] = l[u];
317
317
  return n;
318
318
  }
319
- function g$1(n) {
319
+ function g$2(n) {
320
320
  n && n.parentNode && n.parentNode.removeChild(n);
321
321
  }
322
322
  function _$1(l, u, t) {
@@ -344,7 +344,7 @@ function m$1(n, t, i, o, r) {
344
344
  __i: -1,
345
345
  __u: 0
346
346
  };
347
- return null == r && null != l$2.vnode && l$2.vnode(e), e;
347
+ return null == r && null != l$1.vnode && l$1.vnode(e), e;
348
348
  }
349
349
  function k$2(n) {
350
350
  return n.children;
@@ -368,10 +368,10 @@ function C$1(n) {
368
368
  }
369
369
  }
370
370
  function M(n) {
371
- (!n.__d && (n.__d = true) && i$1.push(n) && !$$2.__r++ || o$1 != l$2.debounceRendering) && ((o$1 = l$2.debounceRendering) || r$3)($$2);
371
+ (!n.__d && (n.__d = true) && i$2.push(n) && !$$2.__r++ || o$1 != l$1.debounceRendering) && ((o$1 = l$1.debounceRendering) || r$3)($$2);
372
372
  }
373
373
  function $$2() {
374
- for (var n, u, t, o, r, f, c, s = 1; i$1.length;) i$1.length > s && i$1.sort(e$2), n = i$1.shift(), s = i$1.length, n.__d && (t = void 0, o = void 0, r = (o = (u = n).__v).__e, f = [], c = [], u.__P && ((t = w$1({}, o)).__v = o.__v + 1, l$2.vnode && l$2.vnode(t), O$1(u.__P, t, o, u.__n, u.__P.namespaceURI, 32 & o.__u ? [r] : null, f, null == r ? S(o) : r, !!(32 & o.__u), c), t.__v = o.__v, t.__.__k[t.__i] = t, N$2(f, t, c), o.__e = o.__ = null, t.__e != r && C$1(t)));
374
+ for (var n, u, t, o, r, f, c, s = 1; i$2.length;) i$2.length > s && i$2.sort(e$2), n = i$2.shift(), s = i$2.length, n.__d && (t = void 0, o = void 0, r = (o = (u = n).__v).__e, f = [], c = [], u.__P && ((t = w$1({}, o)).__v = o.__v + 1, l$1.vnode && l$1.vnode(t), O$1(u.__P, t, o, u.__n, u.__P.namespaceURI, 32 & o.__u ? [r] : null, f, null == r ? S(o) : r, !!(32 & o.__u), c), t.__v = o.__v, t.__.__k[t.__i] = t, N$2(f, t, c), o.__e = o.__ = null, t.__e != r && C$1(t)));
375
375
  $$2.__r = 0;
376
376
  }
377
377
  function I(n, l, u, t, i, o, r, e, f, c, s) {
@@ -384,7 +384,7 @@ function I(n, l, u, t, i, o, r, e, f, c, s) {
384
384
  _,
385
385
  m = t && t.__k || v$1,
386
386
  b = l.length;
387
- for (f = P$1(u, l, m, f, b), a = 0; a < b; a++) null != (y = u.__k[a]) && (h = -1 == y.__i ? p$1 : m[y.__i] || p$1, y.__i = a, g = O$1(n, y, h, i, o, r, e, f, c, s), d = y.__e, y.ref && h.ref != y.ref && (h.ref && B$2(h.ref, null, y), s.push(y.ref, y.__c || d, y)), null == w && null != d && (w = d), (_ = !!(4 & y.__u)) || h.__k === y.__k ? f = A$1(y, f, n, _) : "function" == typeof y.type && void 0 !== g ? f = g : d && (f = d.nextSibling), y.__u &= -7);
387
+ for (f = P$1(u, l, m, f, b), a = 0; a < b; a++) null != (y = u.__k[a]) && (h = -1 == y.__i ? p$2 : m[y.__i] || p$2, y.__i = a, g = O$1(n, y, h, i, o, r, e, f, c, s), d = y.__e, y.ref && h.ref != y.ref && (h.ref && B$2(h.ref, null, y), s.push(y.ref, y.__c || d, y)), null == w && null != d && (w = d), (_ = !!(4 & y.__u)) || h.__k === y.__k ? f = A$1(y, f, n, _) : "function" == typeof y.type && void 0 !== g ? f = g : d && (f = d.nextSibling), y.__u &= -7);
388
388
  return u.__e = w, f;
389
389
  }
390
390
  function P$1(n, l, u, t, i) {
@@ -396,7 +396,7 @@ function P$1(n, l, u, t, i) {
396
396
  s = u.length,
397
397
  a = s,
398
398
  h = 0;
399
- for (n.__k = new Array(i), o = 0; o < i; o++) null != (r = l[o]) && "boolean" != typeof r && "function" != typeof r ? ("string" == typeof r || "number" == typeof r || "bigint" == typeof r || r.constructor == String ? r = n.__k[o] = m$1(null, r, null, null, null) : d$1(r) ? r = n.__k[o] = m$1(k$2, {
399
+ for (n.__k = new Array(i), o = 0; o < i; o++) null != (r = l[o]) && "boolean" != typeof r && "function" != typeof r ? ("string" == typeof r || "number" == typeof r || "bigint" == typeof r || r.constructor == String ? r = n.__k[o] = m$1(null, r, null, null, null) : d$2(r) ? r = n.__k[o] = m$1(k$2, {
400
400
  children: r
401
401
  }, null, null, null) : void 0 === r.constructor && r.__b > 0 ? r = n.__k[o] = m$1(r.type, r.props, r.key, r.ref ? r.ref : null, r.__v) : n.__k[o] = r, f = o + h, r.__ = n, r.__b = n.__b + 1, e = null, -1 != (c = r.__i = L$1(r, u, f, a)) && (a--, (e = u[c]) && (e.__u |= 2)), null == e || null == e.__v ? (-1 == c && (i > s ? h-- : i < s && h++), "function" != typeof r.type && (r.__u |= 4)) : c != f && (c == f - 1 ? h-- : c == f + 1 ? h++ : (c > f ? h-- : h++, r.__u |= 4))) : n.__k[o] = null;
402
402
  if (a) for (o = 0; o < s; o++) null != (e = u[o]) && 0 == (2 & e.__u) && (e.__e == t && (t = S(e)), D$2(e, e));
@@ -415,7 +415,7 @@ function A$1(n, l, u, t) {
415
415
  return l;
416
416
  }
417
417
  function H$1(n, l) {
418
- return l = l || [], null == n || "boolean" == typeof n || (d$1(n) ? n.some(function (n) {
418
+ return l = l || [], null == n || "boolean" == typeof n || (d$2(n) ? n.some(function (n) {
419
419
  H$1(n, l);
420
420
  }) : l.push(n)), l;
421
421
  }
@@ -441,7 +441,7 @@ function j$2(n, l, u, t, i) {
441
441
  if ("string" == typeof t && (n.style.cssText = t = ""), t) for (l in t) u && l in u || T$3(n.style, l, "");
442
442
  if (u) for (l in u) t && u[l] == t[l] || T$3(n.style, l, u[l]);
443
443
  }
444
- } else if ("o" == l[0] && "n" == l[1]) o = l != (l = l.replace(f$2, "$1")), r = l.toLowerCase(), l = r in n || "onFocusOut" == l || "onFocusIn" == l ? r.slice(2) : l.slice(2), n.l || (n.l = {}), n.l[l + o] = u, u ? t ? u.u = t.u : (u.u = c$1, n.addEventListener(l, o ? a$2 : s$2, o)) : n.removeEventListener(l, o ? a$2 : s$2, o);else {
444
+ } else if ("o" == l[0] && "n" == l[1]) o = l != (l = l.replace(f$2, "$1")), r = l.toLowerCase(), l = r in n || "onFocusOut" == l || "onFocusIn" == l ? r.slice(2) : l.slice(2), n.l || (n.l = {}), n.l[l + o] = u, u ? t ? u.u = t.u : (u.u = c$2, n.addEventListener(l, o ? a$2 : s$2, o)) : n.removeEventListener(l, o ? a$2 : s$2, o);else {
445
445
  if ("http://www.w3.org/2000/svg" == i) l = l.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");else if ("width" != l && "height" != l && "href" != l && "list" != l && "form" != l && "tabIndex" != l && "download" != l && "rowSpan" != l && "colSpan" != l && "role" != l && "popover" != l && l in n) try {
446
446
  n[l] = null == u ? "" : u;
447
447
  break n;
@@ -453,8 +453,8 @@ function F$2(n) {
453
453
  return function (u) {
454
454
  if (this.l) {
455
455
  var t = this.l[u.type + n];
456
- if (null == u.t) u.t = c$1++;else if (u.t < t.u) return;
457
- return t(l$2.event ? l$2.event(u) : u);
456
+ if (null == u.t) u.t = c$2++;else if (u.t < t.u) return;
457
+ return t(l$1.event ? l$1.event(u) : u);
458
458
  }
459
459
  };
460
460
  }
@@ -478,7 +478,7 @@ function O$1(n, u, t, i, o, r, e, f, c, s) {
478
478
  T,
479
479
  j = u.type;
480
480
  if (void 0 !== u.constructor) return null;
481
- 128 & t.__u && (c = !!(32 & t.__u), r = [f = u.__e = t.__e]), (a = l$2.__b) && a(u);
481
+ 128 & t.__u && (c = !!(32 & t.__u), r = [f = u.__e = t.__e]), (a = l$1.__b) && a(u);
482
482
  n: if ("function" == typeof j) try {
483
483
  if (b = u.props, S = "prototype" in j && j.prototype.render, C = (a = j.contextType) && i[a.__c], M = a ? C ? C.props.value : a.__ : i, t.__c ? m = (h = u.__c = t.__c).__ = h.__E : (S ? u.__c = h = new j(b, M) : (u.__c = h = new x$1(b, M), h.constructor = j, h.render = E$2), C && C.sub(h), h.state || (h.state = {}), h.__n = i, p = h.__d = !0, h.__h = [], h._sb = []), S && null == h.__s && (h.__s = h.state), S && null != j.getDerivedStateFromProps && (h.__s == h.state && (h.__s = w$1({}, h.__s)), w$1(h.__s, j.getDerivedStateFromProps(b, h.__s))), v = h.props, y = h.state, h.__v = u, p) S && null == j.getDerivedStateFromProps && null != h.componentWillMount && h.componentWillMount(), S && null != h.componentDidMount && h.__h.push(h.componentDidMount);else {
484
484
  if (S && null == j.getDerivedStateFromProps && b !== v && null != h.componentWillReceiveProps && h.componentWillReceiveProps(b, M), u.__v == t.__v || !h.__e && null != h.shouldComponentUpdate && !1 === h.shouldComponentUpdate(b, h.__s, M)) {
@@ -492,44 +492,44 @@ function O$1(n, u, t, i, o, r, e, f, c, s) {
492
492
  h.componentDidUpdate(v, y, _);
493
493
  });
494
494
  }
495
- if (h.context = M, h.props = b, h.__P = n, h.__e = !1, P = l$2.__r, A = 0, S) {
495
+ if (h.context = M, h.props = b, h.__P = n, h.__e = !1, P = l$1.__r, A = 0, S) {
496
496
  for (h.state = h.__s, h.__d = !1, P && P(u), a = h.render(h.props, h.state, h.context), H = 0; H < h._sb.length; H++) h.__h.push(h._sb[H]);
497
497
  h._sb = [];
498
498
  } else do {
499
499
  h.__d = !1, P && P(u), a = h.render(h.props, h.state, h.context), h.state = h.__s;
500
500
  } while (h.__d && ++A < 25);
501
- h.state = h.__s, null != h.getChildContext && (i = w$1(w$1({}, i), h.getChildContext())), S && !p && null != h.getSnapshotBeforeUpdate && (_ = h.getSnapshotBeforeUpdate(v, y)), L = a, null != a && a.type === k$2 && null == a.key && (L = V$2(a.props.children)), f = I(n, d$1(L) ? L : [L], u, t, i, o, r, e, f, c, s), h.base = u.__e, u.__u &= -161, h.__h.length && e.push(h), m && (h.__E = h.__ = null);
501
+ h.state = h.__s, null != h.getChildContext && (i = w$1(w$1({}, i), h.getChildContext())), S && !p && null != h.getSnapshotBeforeUpdate && (_ = h.getSnapshotBeforeUpdate(v, y)), L = a, null != a && a.type === k$2 && null == a.key && (L = V$2(a.props.children)), f = I(n, d$2(L) ? L : [L], u, t, i, o, r, e, f, c, s), h.base = u.__e, u.__u &= -161, h.__h.length && e.push(h), m && (h.__E = h.__ = null);
502
502
  } catch (n) {
503
503
  if (u.__v = null, c || null != r) {
504
504
  if (n.then) {
505
505
  for (u.__u |= c ? 160 : 128; f && 8 == f.nodeType && f.nextSibling;) f = f.nextSibling;
506
506
  r[r.indexOf(f)] = null, u.__e = f;
507
507
  } else {
508
- for (T = r.length; T--;) g$1(r[T]);
508
+ for (T = r.length; T--;) g$2(r[T]);
509
509
  z$1(u);
510
510
  }
511
511
  } else u.__e = t.__e, u.__k = t.__k, n.then || z$1(u);
512
- l$2.__e(n, u, t);
512
+ l$1.__e(n, u, t);
513
513
  } else null == r && u.__v == t.__v ? (u.__k = t.__k, u.__e = t.__e) : f = u.__e = q$3(t.__e, u, t, i, o, r, e, c, s);
514
- return (a = l$2.diffed) && a(u), 128 & u.__u ? void 0 : f;
514
+ return (a = l$1.diffed) && a(u), 128 & u.__u ? void 0 : f;
515
515
  }
516
516
  function z$1(n) {
517
517
  n && n.__c && (n.__c.__e = true), n && n.__k && n.__k.forEach(z$1);
518
518
  }
519
519
  function N$2(n, u, t) {
520
520
  for (var i = 0; i < t.length; i++) B$2(t[i], t[++i], t[++i]);
521
- l$2.__c && l$2.__c(u, n), n.some(function (u) {
521
+ l$1.__c && l$1.__c(u, n), n.some(function (u) {
522
522
  try {
523
523
  n = u.__h, u.__h = [], n.some(function (n) {
524
524
  n.call(u);
525
525
  });
526
526
  } catch (n) {
527
- l$2.__e(n, u.__v);
527
+ l$1.__e(n, u.__v);
528
528
  }
529
529
  });
530
530
  }
531
531
  function V$2(n) {
532
- return "object" != typeof n || null == n || n.__b && n.__b > 0 ? n : d$1(n) ? n.map(V$2) : w$1({}, n);
532
+ return "object" != typeof n || null == n || n.__b && n.__b > 0 ? n : d$2(n) ? n.map(V$2) : w$1({}, n);
533
533
  }
534
534
  function q$3(u, t, i, o, r, e, f, c, s) {
535
535
  var a,
@@ -539,7 +539,7 @@ function q$3(u, t, i, o, r, e, f, c, s) {
539
539
  w,
540
540
  _,
541
541
  m,
542
- b = i.props || p$1,
542
+ b = i.props || p$2,
543
543
  k = t.props,
544
544
  x = t.type;
545
545
  if ("svg" == x ? r = "http://www.w3.org/2000/svg" : "math" == x ? r = "http://www.w3.org/1998/Math/MathML" : r || (r = "http://www.w3.org/1999/xhtml"), null != e) for (a = 0; a < e.length; a++) if ((w = e[a]) && "setAttribute" in w == !!x && (x ? w.localName == x : 3 == w.nodeType)) {
@@ -548,7 +548,7 @@ function q$3(u, t, i, o, r, e, f, c, s) {
548
548
  }
549
549
  if (null == u) {
550
550
  if (null == x) return document.createTextNode(k);
551
- u = document.createElementNS(r, x, k.is && k), c && (l$2.__m && l$2.__m(t, e), c = false), e = null;
551
+ u = document.createElementNS(r, x, k.is && k), c && (l$1.__m && l$1.__m(t, e), c = false), e = null;
552
552
  }
553
553
  if (null == x) b === k || c && u.data == k || (u.data = k);else {
554
554
  if (e = e && n$1.call(u.childNodes), !c && null != e) for (b = {}, a = 0; a < u.attributes.length; a++) b[(w = u.attributes[a]).name] = w.value;
@@ -557,7 +557,7 @@ function q$3(u, t, i, o, r, e, f, c, s) {
557
557
  j$2(u, a, null, w, r);
558
558
  }
559
559
  for (a in k) w = k[a], "children" == a ? y = w : "dangerouslySetInnerHTML" == a ? h = w : "value" == a ? _ = w : "checked" == a ? m = w : c && "function" != typeof w || b[a] === w || j$2(u, a, w, b[a], r);
560
- if (h) c || v && (h.__html == v.__html || h.__html == u.innerHTML) || (u.innerHTML = h.__html), t.__k = [];else if (v && (u.innerHTML = ""), I("template" == t.type ? u.content : u, d$1(y) ? y : [y], t, i, o, "foreignObject" == x ? "http://www.w3.org/1999/xhtml" : r, e, f, e ? e[0] : i.__k && S(i, 0), c, s), null != e) for (a = e.length; a--;) g$1(e[a]);
560
+ if (h) c || v && (h.__html == v.__html || h.__html == u.innerHTML) || (u.innerHTML = h.__html), t.__k = [];else if (v && (u.innerHTML = ""), I("template" == t.type ? u.content : u, d$2(y) ? y : [y], t, i, o, "foreignObject" == x ? "http://www.w3.org/1999/xhtml" : r, e, f, e ? e[0] : i.__k && S(i, 0), c, s), null != e) for (a = e.length; a--;) g$2(e[a]);
561
561
  c || (a = "value", "progress" == x && null == _ ? u.removeAttribute("value") : null != _ && (_ !== u[a] || "progress" == x && !_ || "option" == x && _ != b[a]) && j$2(u, a, _, b[a], r), a = "checked", null != m && m != u[a] && j$2(u, a, m, b[a], r));
562
562
  }
563
563
  return u;
@@ -569,28 +569,28 @@ function B$2(n, u, t) {
569
569
  i && n.__u(), i && null == u || (n.__u = n(u));
570
570
  } else n.current = u;
571
571
  } catch (n) {
572
- l$2.__e(n, t);
572
+ l$1.__e(n, t);
573
573
  }
574
574
  }
575
575
  function D$2(n, u, t) {
576
576
  var i, o;
577
- if (l$2.unmount && l$2.unmount(n), (i = n.ref) && (i.current && i.current != n.__e || B$2(i, null, u)), null != (i = n.__c)) {
577
+ if (l$1.unmount && l$1.unmount(n), (i = n.ref) && (i.current && i.current != n.__e || B$2(i, null, u)), null != (i = n.__c)) {
578
578
  if (i.componentWillUnmount) try {
579
579
  i.componentWillUnmount();
580
580
  } catch (n) {
581
- l$2.__e(n, u);
581
+ l$1.__e(n, u);
582
582
  }
583
583
  i.base = i.__P = null;
584
584
  }
585
585
  if (i = n.__k) for (o = 0; o < i.length; o++) i[o] && D$2(i[o], u, t || "function" != typeof n.type);
586
- t || g$1(n.__e), n.__c = n.__ = n.__e = void 0;
586
+ t || g$2(n.__e), n.__c = n.__ = n.__e = void 0;
587
587
  }
588
588
  function E$2(n, l, u) {
589
589
  return this.constructor(n, u);
590
590
  }
591
591
  function G$1(u, t, i) {
592
592
  var o, r, e, f;
593
- t == document && (t = document.documentElement), l$2.__ && l$2.__(u, t), r = (o = "function" == "undefined") ? null : t.__k, e = [], f = [], O$1(t, u = (t).__k = _$1(k$2, null, [u]), r || p$1, p$1, t.namespaceURI, r ? null : t.firstChild ? n$1.call(t.childNodes) : null, e, r ? r.__e : t.firstChild, o, f), N$2(e, u, f);
593
+ t == document && (t = document.documentElement), l$1.__ && l$1.__(u, t), r = (o = "function" == "undefined") ? null : t.__k, e = [], f = [], O$1(t, u = (t).__k = _$1(k$2, null, [u]), r || p$2, p$2, t.namespaceURI, r ? null : t.firstChild ? n$1.call(t.childNodes) : null, e, r ? r.__e : t.firstChild, o, f), N$2(e, u, f);
594
594
  }
595
595
  function Q$3(n) {
596
596
  function l(n) {
@@ -611,11 +611,11 @@ function Q$3(n) {
611
611
  };
612
612
  }), n.children;
613
613
  }
614
- return l.__c = "__cC" + h$1++, l.__ = n, l.Provider = l.__l = (l.Consumer = function (n, l) {
614
+ return l.__c = "__cC" + h$2++, l.__ = n, l.Provider = l.__l = (l.Consumer = function (n, l) {
615
615
  return n.children(l);
616
616
  }).contextType = l, l;
617
617
  }
618
- n$1 = v$1.slice, l$2 = {
618
+ n$1 = v$1.slice, l$1 = {
619
619
  __e: function (n, l, u, t) {
620
620
  for (var i, o, r; l = l.__;) if ((i = l.__c) && !i.__) try {
621
621
  if ((o = i.constructor) && null != o.getDerivedStateFromError && (i.setState(o.getDerivedStateFromError(n)), r = i.__d), null != i.componentDidCatch && (i.componentDidCatch(n, t || {}), r = i.__d), r) return i.__E = i;
@@ -629,9 +629,9 @@ n$1 = v$1.slice, l$2 = {
629
629
  u = null != this.__s && this.__s != this.state ? this.__s : this.__s = w$1({}, this.state), "function" == typeof n && (n = n(w$1({}, u), this.props)), n && w$1(u, n), null != n && this.__v && (l && this._sb.push(l), M(this));
630
630
  }, x$1.prototype.forceUpdate = function (n) {
631
631
  this.__v && (this.__e = true, n && this.__h.push(n), M(this));
632
- }, x$1.prototype.render = k$2, i$1 = [], r$3 = "function" == typeof Promise ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, e$2 = function (n, l) {
632
+ }, x$1.prototype.render = k$2, i$2 = [], r$3 = "function" == typeof Promise ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, e$2 = function (n, l) {
633
633
  return n.__v.__b - l.__v.__b;
634
- }, $$2.__r = 0, f$2 = /(PointerCapture)$|Capture$/i, c$1 = 0, s$2 = F$2(false), a$2 = F$2(true), h$1 = 0;
634
+ }, $$2.__r = 0, f$2 = /(PointerCapture)$|Capture$/i, c$2 = 0, s$2 = F$2(false), a$2 = F$2(true), h$2 = 0;
635
635
 
636
636
  var f$1 = 0;
637
637
  function u$1(e, t, n, o, i, u) {
@@ -658,35 +658,35 @@ function u$1(e, t, n, o, i, u) {
658
658
  __self: u
659
659
  };
660
660
  if ("function" == typeof e && (a = e.defaultProps)) for (c in a) void 0 === p[c] && (p[c] = a[c]);
661
- return l$2.vnode && l$2.vnode(l), l;
661
+ return l$1.vnode && l$1.vnode(l), l;
662
662
  }
663
663
 
664
- var t$1,
664
+ var t$2,
665
665
  r$2,
666
666
  u,
667
- i,
667
+ i$1,
668
668
  o = 0,
669
669
  f = [],
670
- c = l$2,
671
- e$1 = c.__b,
672
- a$1 = c.__r,
673
- v = c.diffed,
674
- l$1 = c.__c,
675
- m = c.unmount,
676
- s$1 = c.__;
677
- function p(n, t) {
678
- c.__h && c.__h(r$2, n, o || t), o = 0;
670
+ c$1 = l$1,
671
+ e$1 = c$1.__b,
672
+ a$1 = c$1.__r,
673
+ v = c$1.diffed,
674
+ l = c$1.__c,
675
+ m = c$1.unmount,
676
+ s$1 = c$1.__;
677
+ function p$1(n, t) {
678
+ c$1.__h && c$1.__h(r$2, n, o || t), o = 0;
679
679
  var u = r$2.__H || (r$2.__H = {
680
680
  __: [],
681
681
  __h: []
682
682
  });
683
683
  return n >= u.__.length && u.__.push({}), u.__[n];
684
684
  }
685
- function d(n) {
686
- return o = 1, h(D$1, n);
685
+ function d$1(n) {
686
+ return o = 1, h$1(D$1, n);
687
687
  }
688
- function h(n, u, i) {
689
- var o = p(t$1++, 2);
688
+ function h$1(n, u, i) {
689
+ var o = p$1(t$2++, 2);
690
690
  if (o.t = n, !o.__c && (o.__ = [i ? i(u) : D$1(void 0, u), function (n) {
691
691
  var t = o.__N ? o.__N[0] : o.__[0],
692
692
  r = o.t(t, n);
@@ -722,8 +722,8 @@ function h(n, u, i) {
722
722
  return o.__N || o.__;
723
723
  }
724
724
  function y(n, u) {
725
- var i = p(t$1++, 3);
726
- !c.__s && C(i.__H, u) && (i.__ = n, i.u = u, r$2.__H.__h.push(i));
725
+ var i = p$1(t$2++, 3);
726
+ !c$1.__s && C(i.__H, u) && (i.__ = n, i.u = u, r$2.__H.__h.push(i));
727
727
  }
728
728
  function A(n) {
729
729
  return o = 5, T$2(function () {
@@ -733,7 +733,7 @@ function A(n) {
733
733
  }, []);
734
734
  }
735
735
  function T$2(n, r) {
736
- var u = p(t$1++, 7);
736
+ var u = p$1(t$2++, 7);
737
737
  return C(u.__H, r) && (u.__ = n(), u.__H = r, u.__h = n), u.__;
738
738
  }
739
739
  function q$2(n, t) {
@@ -743,33 +743,33 @@ function q$2(n, t) {
743
743
  }
744
744
  function x(n) {
745
745
  var u = r$2.context[n.__c],
746
- i = p(t$1++, 9);
746
+ i = p$1(t$2++, 9);
747
747
  return i.c = n, u ? (null == i.__ && (i.__ = true, u.sub(r$2)), u.props.value) : n.__;
748
748
  }
749
749
  function j$1() {
750
750
  for (var n; n = f.shift();) if (n.__P && n.__H) try {
751
751
  n.__H.__h.forEach(z), n.__H.__h.forEach(B$1), n.__H.__h = [];
752
752
  } catch (t) {
753
- n.__H.__h = [], c.__e(t, n.__v);
753
+ n.__H.__h = [], c$1.__e(t, n.__v);
754
754
  }
755
755
  }
756
- c.__b = function (n) {
756
+ c$1.__b = function (n) {
757
757
  r$2 = null, e$1 && e$1(n);
758
- }, c.__ = function (n, t) {
758
+ }, c$1.__ = function (n, t) {
759
759
  n && t.__k && t.__k.__m && (n.__m = t.__k.__m), s$1 && s$1(n, t);
760
- }, c.__r = function (n) {
761
- a$1 && a$1(n), t$1 = 0;
760
+ }, c$1.__r = function (n) {
761
+ a$1 && a$1(n), t$2 = 0;
762
762
  var i = (r$2 = n.__c).__H;
763
763
  i && (u === r$2 ? (i.__h = [], r$2.__h = [], i.__.forEach(function (n) {
764
764
  n.__N && (n.__ = n.__N), n.u = n.__N = void 0;
765
- })) : (i.__h.forEach(z), i.__h.forEach(B$1), i.__h = [], t$1 = 0)), u = r$2;
766
- }, c.diffed = function (n) {
765
+ })) : (i.__h.forEach(z), i.__h.forEach(B$1), i.__h = [], t$2 = 0)), u = r$2;
766
+ }, c$1.diffed = function (n) {
767
767
  v && v(n);
768
768
  var t = n.__c;
769
- t && t.__H && (t.__H.__h.length && (1 !== f.push(t) && i === c.requestAnimationFrame || ((i = c.requestAnimationFrame) || w)(j$1)), t.__H.__.forEach(function (n) {
769
+ t && t.__H && (t.__H.__h.length && (1 !== f.push(t) && i$1 === c$1.requestAnimationFrame || ((i$1 = c$1.requestAnimationFrame) || w)(j$1)), t.__H.__.forEach(function (n) {
770
770
  n.u && (n.__H = n.u), n.u = void 0;
771
771
  })), u = r$2 = null;
772
- }, c.__c = function (n, t) {
772
+ }, c$1.__c = function (n, t) {
773
773
  t.some(function (n) {
774
774
  try {
775
775
  n.__h.forEach(z), n.__h = n.__h.filter(function (n) {
@@ -778,10 +778,10 @@ c.__b = function (n) {
778
778
  } catch (r) {
779
779
  t.some(function (n) {
780
780
  n.__h && (n.__h = []);
781
- }), t = [], c.__e(r, n.__v);
781
+ }), t = [], c$1.__e(r, n.__v);
782
782
  }
783
- }), l$1 && l$1(n, t);
784
- }, c.unmount = function (n) {
783
+ }), l && l(n, t);
784
+ }, c$1.unmount = function (n) {
785
785
  m && m(n);
786
786
  var t,
787
787
  r = n.__c;
@@ -791,7 +791,7 @@ c.__b = function (n) {
791
791
  } catch (n) {
792
792
  t = n;
793
793
  }
794
- }), r.__H = void 0, t && c.__e(t, r.__v));
794
+ }), r.__H = void 0, t && c$1.__e(t, r.__v));
795
795
  };
796
796
  var k$1 = "function" == typeof requestAnimationFrame;
797
797
  function w(n) {
@@ -2452,9 +2452,9 @@ function usePdfiumEngine(config) {
2452
2452
  encoderPoolSize,
2453
2453
  fontFallback
2454
2454
  } = config ?? {};
2455
- const [engine, setEngine] = d(null);
2456
- const [loading, setLoading] = d(true);
2457
- const [error, setError] = d(null);
2455
+ const [engine, setEngine] = d$1(null);
2456
+ const [loading, setLoading] = d$1(true);
2457
+ const [error, setError] = d$1(null);
2458
2458
  const engineRef = A(null);
2459
2459
  y(() => {
2460
2460
  let cancelled = false;
@@ -5930,10 +5930,10 @@ function EmbedPDF({
5930
5930
  children,
5931
5931
  autoMountDomElements = true
5932
5932
  }) {
5933
- const [registry, setRegistry] = d(null);
5934
- const [coreState, setCoreState] = d(null);
5935
- const [isInitializing, setIsInitializing] = d(true);
5936
- const [pluginsReady, setPluginsReady] = d(false);
5933
+ const [registry, setRegistry] = d$1(null);
5934
+ const [coreState, setCoreState] = d$1(null);
5935
+ const [isInitializing, setIsInitializing] = d$1(true);
5936
+ const [pluginsReady, setPluginsReady] = d$1(false);
5937
5937
  const initRef = A(onInitialized);
5938
5938
  y(() => {
5939
5939
  initRef.current = onInitialized;
@@ -7080,7 +7080,7 @@ function useIsPageExclusive(documentId) {
7080
7080
  const {
7081
7081
  provides: cap
7082
7082
  } = useInteractionManagerCapability();
7083
- const [isPageExclusive, setIsPageExclusive] = d(() => {
7083
+ const [isPageExclusive, setIsPageExclusive] = d$1(() => {
7084
7084
  if (!cap) return false;
7085
7085
  const scope = cap.forDocument(documentId);
7086
7086
  const m = scope.getActiveInteractionMode();
@@ -8295,24 +8295,20 @@ function expandToLineBoundary(geo, charIndex) {
8295
8295
  const anchorBottom = anchorRun.rect.y + anchorRun.rect.height;
8296
8296
  let from = anchorRun.charStart;
8297
8297
  let to = anchorRun.charStart + anchorRun.glyphs.length - 1;
8298
- const anchorLeft = anchorRun.rect.x;
8299
- const anchorRight = anchorRun.rect.x + anchorRun.rect.width;
8300
- const runOnSameLineColumn = run => {
8301
- if (isZeroSizeRun(run)) return false;
8302
- if (!runsOverlapVertically(run.rect.y, run.rect.y + run.rect.height, anchorTop, anchorBottom)) {
8303
- return false;
8304
- }
8305
- const runRight = run.rect.x + run.rect.width;
8306
- return run.rect.x < anchorRight && anchorLeft < runRight;
8307
- };
8308
8298
  for (let r = resolved.runIdx - 1; r >= 0; r--) {
8309
8299
  const run = geo.runs[r];
8310
- if (!runOnSameLineColumn(run)) break;
8300
+ if (isZeroSizeRun(run)) continue;
8301
+ if (!runsOverlapVertically(run.rect.y, run.rect.y + run.rect.height, anchorTop, anchorBottom)) {
8302
+ break;
8303
+ }
8311
8304
  from = run.charStart;
8312
8305
  }
8313
8306
  for (let r = resolved.runIdx + 1; r < geo.runs.length; r++) {
8314
8307
  const run = geo.runs[r];
8315
- if (!runOnSameLineColumn(run)) break;
8308
+ if (isZeroSizeRun(run)) continue;
8309
+ if (!runsOverlapVertically(run.rect.y, run.rect.y + run.rect.height, anchorTop, anchorBottom)) {
8310
+ break;
8311
+ }
8316
8312
  to = run.charStart + run.glyphs.length - 1;
8317
8313
  }
8318
8314
  return {
@@ -9137,10 +9133,7 @@ const _SelectionPlugin = class _SelectionPlugin extends BasePlugin {
9137
9133
  updateSelection(documentId, page, index, modeId) {
9138
9134
  if (!this.selecting.get(documentId) || !this.anchor.get(documentId)) return;
9139
9135
  const a = this.anchor.get(documentId);
9140
- if (page !== a.page) {
9141
- return;
9142
- }
9143
- const forward = index >= a.index;
9136
+ const forward = page > a.page || page === a.page && index >= a.index;
9144
9137
  const start = forward ? a : {
9145
9138
  page,
9146
9139
  index
@@ -10744,9 +10737,9 @@ function TextSelection({
10744
10737
  } = useSelectionPlugin();
10745
10738
  const documentState = useDocumentState(documentId);
10746
10739
  const page = (_b = (_a = documentState == null ? void 0 : documentState.document) == null ? void 0 : _a.pages) == null ? void 0 : _b[pageIndex];
10747
- const [rects, setRects] = d([]);
10748
- const [boundingRect, setBoundingRect] = d(null);
10749
- const [placement, setPlacement] = d(null);
10740
+ const [rects, setRects] = d$1([]);
10741
+ const [boundingRect, setBoundingRect] = d$1(null);
10742
+ const [placement, setPlacement] = d$1(null);
10750
10743
  y(() => {
10751
10744
  if (!selPlugin || !documentId) return;
10752
10745
  return selPlugin.registerSelectionOnPage({
@@ -10840,7 +10833,7 @@ const MarqueeSelection = ({
10840
10833
  plugin: selPlugin
10841
10834
  } = useSelectionPlugin();
10842
10835
  const documentState = useDocumentState(documentId);
10843
- const [rect, setRect] = d(null);
10836
+ const [rect, setRect] = d$1(null);
10844
10837
  const resolvedBorderColor = borderColor ?? stroke ?? "rgba(0,122,204,0.8)";
10845
10838
  const resolvedBackground = background ?? fill ?? "rgba(0,122,204,0.15)";
10846
10839
  const actualScale = T$2(() => {
@@ -18578,7 +18571,7 @@ const AnnotationPluginPackage = {
18578
18571
  initialState: (_, config) => initialState$8(config)
18579
18572
  };
18580
18573
 
18581
- function g(n, t) {
18574
+ function g$1(n, t) {
18582
18575
  for (var e in t) n[e] = t[e];
18583
18576
  return n;
18584
18577
  }
@@ -18593,20 +18586,20 @@ function N$1(n, t) {
18593
18586
  (N$1.prototype = new x$1()).isPureReactComponent = true, N$1.prototype.shouldComponentUpdate = function (n, t) {
18594
18587
  return E$1(this.props, n) || E$1(this.state, t);
18595
18588
  };
18596
- var T$1 = l$2.__b;
18597
- l$2.__b = function (n) {
18589
+ var T$1 = l$1.__b;
18590
+ l$1.__b = function (n) {
18598
18591
  n.type && n.type.__f && n.ref && (n.props.ref = n.ref, n.ref = null), T$1 && T$1(n);
18599
18592
  };
18600
- var U$1 = l$2.__e;
18601
- l$2.__e = function (n, t, e, r) {
18593
+ var U$1 = l$1.__e;
18594
+ l$1.__e = function (n, t, e, r) {
18602
18595
  if (n.then) for (var u, o = t; o = o.__;) if ((u = o.__c) && u.__c) return null == t.__e && (t.__e = e.__e, t.__k = e.__k), u.__c(n, t);
18603
18596
  U$1(n, t, e, r);
18604
18597
  };
18605
- var F$1 = l$2.unmount;
18598
+ var F$1 = l$1.unmount;
18606
18599
  function V$1(n, t, e) {
18607
18600
  return n && (n.__c && n.__c.__H && (n.__c.__H.__.forEach(function (n) {
18608
18601
  "function" == typeof n.__c && n.__c();
18609
- }), n.__c.__H = null), null != (n = g({}, n)).__c && (n.__c.__P === e && (n.__c.__P = t), n.__c.__e = true, n.__c = null), n.__k = n.__k && n.__k.map(function (n) {
18602
+ }), n.__c.__H = null), null != (n = g$1({}, n)).__c && (n.__c.__P === e && (n.__c.__P = t), n.__c.__e = true, n.__c = null), n.__k = n.__k && n.__k.map(function (n) {
18610
18603
  return V$1(n, t, e);
18611
18604
  })), n;
18612
18605
  }
@@ -18626,7 +18619,7 @@ function j(n) {
18626
18619
  function B() {
18627
18620
  this.i = null, this.l = null;
18628
18621
  }
18629
- l$2.unmount = function (n) {
18622
+ l$1.unmount = function (n) {
18630
18623
  var t = n.__c;
18631
18624
  t && (t.__z = true), t && t.__R && t.__R(), t && 32 & n.__u && (n.type = null), F$1 && F$1(n);
18632
18625
  }, (P.prototype = new x$1()).__c = function (n, t) {
@@ -18764,7 +18757,7 @@ x$1.prototype.isReactComponent = {}, ["componentWillMount", "componentWillReceiv
18764
18757
  }
18765
18758
  });
18766
18759
  });
18767
- var en = l$2.event;
18760
+ var en = l$1.event;
18768
18761
  function rn() {}
18769
18762
  function un() {
18770
18763
  return this.cancelBubble;
@@ -18772,7 +18765,7 @@ function un() {
18772
18765
  function on() {
18773
18766
  return this.defaultPrevented;
18774
18767
  }
18775
- l$2.event = function (n) {
18768
+ l$1.event = function (n) {
18776
18769
  return en && (n = en(n)), n.persist = rn, n.isPropagationStopped = un, n.isDefaultPrevented = on, n.nativeEvent = n;
18777
18770
  };
18778
18771
  var cn = {
@@ -18782,8 +18775,8 @@ var cn = {
18782
18775
  return this.class;
18783
18776
  }
18784
18777
  },
18785
- fn = l$2.vnode;
18786
- l$2.vnode = function (n) {
18778
+ fn = l$1.vnode;
18779
+ l$1.vnode = function (n) {
18787
18780
  "string" == typeof n.type && function (n) {
18788
18781
  var t = n.props,
18789
18782
  e = n.type,
@@ -18803,12 +18796,12 @@ l$2.vnode = function (n) {
18803
18796
  })), t.class && !t.className ? (u.class = t.class, Object.defineProperty(u, "className", cn)) : (t.className && !t.class || t.class && t.className) && (u.class = u.className = t.className), n.props = u;
18804
18797
  }(n), n.$$typeof = q$1, fn && fn(n);
18805
18798
  };
18806
- var an = l$2.__r;
18807
- l$2.__r = function (n) {
18799
+ var an = l$1.__r;
18800
+ l$1.__r = function (n) {
18808
18801
  an && an(n), n.__c;
18809
18802
  };
18810
- var sn = l$2.diffed;
18811
- l$2.diffed = function (n) {
18803
+ var sn = l$1.diffed;
18804
+ l$1.diffed = function (n) {
18812
18805
  sn && sn(n);
18813
18806
  var t = n.props,
18814
18807
  e = n.__e;
@@ -18821,7 +18814,7 @@ const RenderersContext = Q$3([]);
18821
18814
  function AnnotationRendererProvider({
18822
18815
  children
18823
18816
  }) {
18824
- const [renderers, setRenderers] = d([]);
18817
+ const [renderers, setRenderers] = d$1([]);
18825
18818
  const register = q$2(entries => {
18826
18819
  setRenderers(prev => {
18827
18820
  const ids = new Set(entries.map(e => e.id));
@@ -18907,7 +18900,7 @@ function AppearanceImage({
18907
18900
  appearance,
18908
18901
  style
18909
18902
  }) {
18910
- const [imageUrl, setImageUrl] = d(null);
18903
+ const [imageUrl, setImageUrl] = d$1(null);
18911
18904
  const urlRef = A(null);
18912
18905
  y(() => {
18913
18906
  const url = URL.createObjectURL(appearance.data);
@@ -18980,11 +18973,11 @@ function AnnotationContainer({
18980
18973
  ...props
18981
18974
  }) {
18982
18975
  var _a, _b, _c;
18983
- const [preview, setPreview] = d(trackedAnnotation.object);
18984
- const [liveRotation, setLiveRotation] = d(null);
18985
- const [cursorScreen, setCursorScreen] = d(null);
18986
- const [isHandleHovered, setIsHandleHovered] = d(false);
18987
- const [gestureActive, setGestureActive] = d(false);
18976
+ const [preview, setPreview] = d$1(trackedAnnotation.object);
18977
+ const [liveRotation, setLiveRotation] = d$1(null);
18978
+ const [cursorScreen, setCursorScreen] = d$1(null);
18979
+ const [isHandleHovered, setIsHandleHovered] = d$1(false);
18980
+ const [gestureActive, setGestureActive] = d$1(false);
18988
18981
  const {
18989
18982
  provides: annotationCapability
18990
18983
  } = useAnnotationCapability();
@@ -19587,9 +19580,9 @@ function GroupSelectionBox({
19587
19580
  const gestureBaseRef = A(null);
19588
19581
  const isDraggingRef = A(false);
19589
19582
  const isResizingRef = A(false);
19590
- const [liveRotation, setLiveRotation] = d(null);
19591
- const [cursorScreen, setCursorScreen] = d(null);
19592
- const [isHandleHovered, setIsHandleHovered] = d(false);
19583
+ const [liveRotation, setLiveRotation] = d$1(null);
19584
+ const [cursorScreen, setCursorScreen] = d$1(null);
19585
+ const [isHandleHovered, setIsHandleHovered] = d$1(false);
19593
19586
  const effectiveIsDraggable = canModifyAnnotations && isDraggable;
19594
19587
  const effectiveIsResizable = canModifyAnnotations && isResizable;
19595
19588
  const effectiveIsRotatable = canModifyAnnotations && isRotatable;
@@ -19597,7 +19590,7 @@ function GroupSelectionBox({
19597
19590
  const rects = selectedAnnotations.map(ta => ta.object.rect);
19598
19591
  return boundingRectOrEmpty(rects);
19599
19592
  }, [selectedAnnotations]);
19600
- const [previewGroupBox, setPreviewGroupBox] = d(groupBox);
19593
+ const [previewGroupBox, setPreviewGroupBox] = d$1(groupBox);
19601
19594
  y(() => {
19602
19595
  if (!isDraggingRef.current && !isResizingRef.current) {
19603
19596
  setPreviewGroupBox(groupBox);
@@ -21140,7 +21133,7 @@ function RenderAnnotation({
21140
21133
  const {
21141
21134
  provides: annotationProvides
21142
21135
  } = useAnnotationCapability();
21143
- const [imageUrl, setImageUrl] = d(null);
21136
+ const [imageUrl, setImageUrl] = d$1(null);
21144
21137
  const urlRef = A(null);
21145
21138
  const {
21146
21139
  width,
@@ -22125,17 +22118,17 @@ function Annotations(annotationsProps) {
22125
22118
  const {
22126
22119
  provides: selectionProvides
22127
22120
  } = useSelectionCapability();
22128
- const [annotations, setAnnotations] = d([]);
22121
+ const [annotations, setAnnotations] = d$1([]);
22129
22122
  const {
22130
22123
  register
22131
22124
  } = usePointerHandlers({
22132
22125
  documentId,
22133
22126
  pageIndex
22134
22127
  });
22135
- const [allSelectedIds, setAllSelectedIds] = d([]);
22136
- const [editingId, setEditingId] = d(null);
22137
- const [appearanceMap, setAppearanceMap] = d({});
22138
- const [, setLockedMode] = d({
22128
+ const [allSelectedIds, setAllSelectedIds] = d$1([]);
22129
+ const [editingId, setEditingId] = d$1(null);
22130
+ const [appearanceMap, setAppearanceMap] = d$1({});
22131
+ const [, setLockedMode] = d$1({
22139
22132
  type: LockModeType.None
22140
22133
  });
22141
22134
  const prevScaleRef = A(scale);
@@ -22379,9 +22372,9 @@ function TextMarkup({
22379
22372
  const {
22380
22373
  provides: annotationProvides
22381
22374
  } = useAnnotationCapability();
22382
- const [rects, setRects] = d([]);
22383
- const [boundingRect, setBoundingRect] = d(null);
22384
- const [activeTool, setActiveTool] = d(null);
22375
+ const [rects, setRects] = d$1([]);
22376
+ const [boundingRect, setBoundingRect] = d$1(null);
22377
+ const [activeTool, setActiveTool] = d$1(null);
22385
22378
  y(() => {
22386
22379
  if (!selectionProvides) return;
22387
22380
  return selectionProvides.forDocument(documentId).onSelectionChange(() => {
@@ -22518,7 +22511,7 @@ function AnnotationPaintLayer({
22518
22511
  const {
22519
22512
  plugin: annotationPlugin
22520
22513
  } = useAnnotationPlugin();
22521
- const [previews, setPreviews] = d(/* @__PURE__ */new Map());
22514
+ const [previews, setPreviews] = d$1(/* @__PURE__ */new Map());
22522
22515
  const fileInputRef = A(null);
22523
22516
  const services = T$2(() => ({
22524
22517
  requestFile: ({
@@ -24191,7 +24184,7 @@ function RedactHighlight({
24191
24184
  onClick,
24192
24185
  style
24193
24186
  }) {
24194
- const [isHovered, setIsHovered] = d(false);
24187
+ const [isHovered, setIsHovered] = d$1(false);
24195
24188
  const {
24196
24189
  object
24197
24190
  } = annotation;
@@ -24265,7 +24258,7 @@ function RedactArea({
24265
24258
  onClick,
24266
24259
  style
24267
24260
  }) {
24268
- const [isHovered, setIsHovered] = d(false);
24261
+ const [isHovered, setIsHovered] = d$1(false);
24269
24262
  const {
24270
24263
  object
24271
24264
  } = annotation;
@@ -24390,7 +24383,7 @@ const MarqueeRedact = ({
24390
24383
  plugin: redactionPlugin
24391
24384
  } = useRedactionPlugin();
24392
24385
  const documentState = useDocumentState(documentId);
24393
- const [rect, setRect] = d(null);
24386
+ const [rect, setRect] = d$1(null);
24394
24387
  const scale = scaleOverride ?? (documentState == null ? void 0 : documentState.scale) ?? 1;
24395
24388
  const strokeColor = stroke ?? (redactionPlugin == null ? void 0 : redactionPlugin.getPreviewStrokeColor()) ?? "red";
24396
24389
  y(() => {
@@ -24455,8 +24448,8 @@ function SelectionRedact({
24455
24448
  const {
24456
24449
  plugin: redactionPlugin
24457
24450
  } = useRedactionPlugin();
24458
- const [rects, setRects] = d([]);
24459
- const [boundingRect, setBoundingRect] = d(null);
24451
+ const [rects, setRects] = d$1([]);
24452
+ const [boundingRect, setBoundingRect] = d$1(null);
24460
24453
  const strokeColor = (redactionPlugin == null ? void 0 : redactionPlugin.getPreviewStrokeColor()) ?? "red";
24461
24454
  y(() => {
24462
24455
  if (!redactionPlugin) return;
@@ -24494,8 +24487,8 @@ function PendingRedactions({
24494
24487
  const {
24495
24488
  provides: redaction
24496
24489
  } = useRedactionCapability();
24497
- const [items, setItems] = d([]);
24498
- const [selectedId, setSelectedId] = d(null);
24490
+ const [items, setItems] = d$1([]);
24491
+ const [selectedId, setSelectedId] = d$1(null);
24499
24492
  y(() => {
24500
24493
  if (!redaction) return;
24501
24494
  const scoped = redaction.forDocument(documentId);
@@ -25319,7 +25312,7 @@ function RenderLayer({
25319
25312
  provides: renderProvides
25320
25313
  } = useRenderCapability();
25321
25314
  const documentState = useDocumentState(documentId);
25322
- const [imageUrl, setImageUrl] = d(null);
25315
+ const [imageUrl, setImageUrl] = d$1(null);
25323
25316
  const urlRef = A(null);
25324
25317
  const refreshVersion = T$2(() => {
25325
25318
  if (!documentState) return 0;
@@ -32314,7 +32307,15 @@ const rt$1 = class rt extends BasePlugin {
32314
32307
  };
32315
32308
  rt$1.id = "chapter-scroll";
32316
32309
  let ot$1 = rt$1;
32317
- const nt$1 = (t, e) => ({
32310
+ const nt$1 = {
32311
+ userSelect: "none",
32312
+ WebkitUserSelect: "none"
32313
+ };
32314
+ function ht$1() {
32315
+ var t;
32316
+ "undefined" != typeof window && (null == (t = window.getSelection()) || t.removeAllRanges());
32317
+ }
32318
+ const lt$1 = (t, e) => ({
32318
32319
  position: "absolute",
32319
32320
  top: `${t.offsetTop}px`,
32320
32321
  left: "50%",
@@ -32324,20 +32325,20 @@ const nt$1 = (t, e) => ({
32324
32325
  backgroundColor: e,
32325
32326
  boxShadow: "0 1px 4px rgba(0,0,0,0.08)"
32326
32327
  });
32327
- function ht$1({
32328
- item: a,
32328
+ function dt$1({
32329
+ item: e,
32329
32330
  renderPage: s,
32330
32331
  renderPlaceholder: i
32331
32332
  }) {
32332
32333
  const {
32333
32334
  provides: r
32334
32335
  } = useCapability(st$1.id),
32335
- o = (null == r ? void 0 : r.getChapterStatus(a.chapterId)) ?? "idle";
32336
- return a.isPlaceholder ? "error" === o ? /* @__PURE__ */u$1("div", {
32337
- "data-global-page-index": a.globalPageIndex,
32338
- "data-chapter-id": a.chapterId,
32336
+ o = (null == r ? void 0 : r.getChapterStatus(e.chapterId)) ?? "idle";
32337
+ return e.isPlaceholder ? "error" === o ? /* @__PURE__ */u$1("div", {
32338
+ "data-global-page-index": e.globalPageIndex,
32339
+ "data-chapter-id": e.chapterId,
32339
32340
  style: {
32340
- ...nt$1(a, "#fef2f2"),
32341
+ ...lt$1(e, "#fef2f2"),
32341
32342
  display: "flex",
32342
32343
  alignItems: "center",
32343
32344
  justifyContent: "center",
@@ -32346,16 +32347,16 @@ function ht$1({
32346
32347
  color: "#b91c1c",
32347
32348
  textAlign: "center"
32348
32349
  },
32349
- children: ["章节 PDF 加载失败(", a.chapterId, ")", /* @__PURE__ */u$1("br", {}), /* @__PURE__ */u$1("span", {
32350
+ children: ["章节 PDF 加载失败(", e.chapterId, ")", /* @__PURE__ */u$1("br", {}), /* @__PURE__ */u$1("span", {
32350
32351
  style: {
32351
32352
  color: "#94a3b8"
32352
32353
  },
32353
32354
  children: "请确认 public 下存在对应 .pdf"
32354
32355
  })]
32355
32356
  }) : /* @__PURE__ */u$1("div", "password-required" === o ? {
32356
- "data-chapter-id": a.chapterId,
32357
+ "data-chapter-id": e.chapterId,
32357
32358
  style: {
32358
- ...nt$1(a, "#fffbeb"),
32359
+ ...lt$1(e, "#fffbeb"),
32359
32360
  display: "flex",
32360
32361
  alignItems: "center",
32361
32362
  justifyContent: "center",
@@ -32364,10 +32365,10 @@ function ht$1({
32364
32365
  },
32365
32366
  children: "需要 PDF 密码"
32366
32367
  } : {
32367
- "data-global-page-index": a.globalPageIndex,
32368
- "data-chapter-id": a.chapterId,
32369
- style: nt$1(a, "#f3f4f6"),
32370
- children: (null == i ? void 0 : i(a)) ?? /* @__PURE__ */u$1("div", {
32368
+ "data-global-page-index": e.globalPageIndex,
32369
+ "data-chapter-id": e.chapterId,
32370
+ style: lt$1(e, "#f3f4f6"),
32371
+ children: (null == i ? void 0 : i(e)) ?? /* @__PURE__ */u$1("div", {
32371
32372
  style: {
32372
32373
  display: "flex",
32373
32374
  width: "100%",
@@ -32380,89 +32381,106 @@ function ht$1({
32380
32381
  children: "Loading chapter…"
32381
32382
  })
32382
32383
  }) : /* @__PURE__ */u$1("div", {
32383
- "data-global-page-index": a.globalPageIndex,
32384
- "data-chapter-id": a.chapterId,
32385
- "data-local-page-index": a.localPageIndex,
32386
- style: nt$1(a, "#fff"),
32387
- children: s(a)
32384
+ "data-chapter-page-slot": "",
32385
+ "data-global-page-index": e.globalPageIndex,
32386
+ "data-chapter-id": e.chapterId,
32387
+ "data-local-page-index": e.localPageIndex,
32388
+ style: {
32389
+ ...lt$1(e, "#fff"),
32390
+ ...nt$1
32391
+ },
32392
+ onPointerDown: ht$1,
32393
+ children: s(e)
32388
32394
  });
32389
32395
  }
32390
- function lt$1({
32391
- renderPage: e,
32392
- renderPlaceholder: a,
32393
- className: o,
32394
- style: n,
32395
- ...l
32396
+ function ct$1({
32397
+ renderPage: o,
32398
+ renderPlaceholder: n,
32399
+ className: l,
32400
+ style: d,
32401
+ ...c
32396
32402
  }) {
32397
32403
  const {
32398
- provides: d$1
32404
+ provides: u
32399
32405
  } = useCapability(ot$1.id),
32400
32406
  {
32401
- provides: c
32407
+ provides: p
32402
32408
  } = useCapability(DocumentManagerPlugin.id),
32403
32409
  {
32404
- provides: u
32410
+ provides: g
32405
32411
  } = useCapability(st$1.id),
32406
- p = A(null),
32407
- [g, f] = d(null);
32412
+ f = A(null),
32413
+ [m, v] = d$1(null);
32408
32414
  y(() => {
32409
- if (!d$1) return;
32415
+ if (!u) return;
32410
32416
  let t = false;
32411
32417
  const e = () => {
32412
- t || d$1.registerViewport(p.current);
32418
+ t || u.registerViewport(f.current);
32413
32419
  };
32414
32420
  e();
32415
32421
  const a = requestAnimationFrame(() => {
32416
32422
  requestAnimationFrame(e);
32417
32423
  }),
32418
- s = t => f(t),
32419
- i = d$1.onLayoutChange(s),
32420
- r = null == c ? void 0 : c.onDocumentOpened(() => s(d$1.getLayout())),
32421
- o = null == c ? void 0 : c.onDocumentClosed(() => s(d$1.getLayout())),
32422
- n = null == u ? void 0 : u.onChapterStatusChange(() => s(d$1.getLayout()));
32423
- return s(d$1.getLayout()), () => {
32424
- t = true, cancelAnimationFrame(a), i(), null == r || r(), null == o || o(), null == n || n(), d$1.registerViewport(null);
32425
- };
32426
- }, [d$1, c, u]);
32427
- const m = (null == g ? void 0 : g.totalHeight) ?? 0,
32428
- v = (null == g ? void 0 : g.totalWidth) ?? 0;
32429
- return u$1("div", {
32430
- ...l,
32431
- ref: p,
32432
- "data-chapter-scroll-viewport": "",
32433
- className: o,
32434
- style: {
32435
- overflow: "auto",
32436
- position: "relative",
32437
- width: "100%",
32438
- height: "100%",
32439
- ...(n ?? {})
32440
- },
32441
- children: /* @__PURE__ */u$1("div", {
32424
+ s = t => v(t),
32425
+ i = u.onLayoutChange(s),
32426
+ r = null == p ? void 0 : p.onDocumentOpened(() => s(u.getLayout())),
32427
+ o = null == p ? void 0 : p.onDocumentClosed(() => s(u.getLayout())),
32428
+ n = null == g ? void 0 : g.onChapterStatusChange(() => s(u.getLayout()));
32429
+ return s(u.getLayout()), () => {
32430
+ t = true, cancelAnimationFrame(a), i(), null == r || r(), null == o || o(), null == n || n(), u.registerViewport(null);
32431
+ };
32432
+ }, [u, p, g]);
32433
+ const b = (null == m ? void 0 : m.totalHeight) ?? 0,
32434
+ P = (null == m ? void 0 : m.totalWidth) ?? 0;
32435
+ return u$1(k$2, {
32436
+ children: [/* @__PURE__ */u$1("style", {
32437
+ dangerouslySetInnerHTML: {
32438
+ __html: "\n[data-chapter-scroll-viewport] [data-chapter-page-slot],\n[data-chapter-scroll-viewport] [data-chapter-page-slot] * {\n -webkit-user-select: none !important;\n user-select: none !important;\n}\n[data-chapter-scroll-viewport] [data-chapter-page-slot]::selection,\n[data-chapter-scroll-viewport] [data-chapter-page-slot] *::selection {\n background: transparent;\n}\n"
32439
+ }
32440
+ }), /* @__PURE__ */u$1("div", {
32441
+ ...c,
32442
+ ref: f,
32443
+ "data-chapter-scroll-viewport": "",
32444
+ className: l,
32442
32445
  style: {
32446
+ overflow: "auto",
32443
32447
  position: "relative",
32444
- width: `${v}px`,
32445
- height: `${m}px`,
32446
- margin: "0 auto"
32448
+ width: "100%",
32449
+ height: "100%",
32450
+ userSelect: "none",
32451
+ WebkitUserSelect: "none",
32452
+ ...(d ?? {})
32447
32453
  },
32448
- children: null == g ? void 0 : g.items.map(s => /* @__PURE__ */u$1(ht$1, {
32449
- item: s,
32450
- renderPage: e,
32451
- renderPlaceholder: a
32452
- }, s.globalPageIndex))
32453
- })
32454
+ onPointerDown: () => {
32455
+ var t;
32456
+ "undefined" != typeof window && (null == (t = window.getSelection()) || t.removeAllRanges());
32457
+ },
32458
+ children: /* @__PURE__ */u$1("div", {
32459
+ style: {
32460
+ position: "relative",
32461
+ width: `${P}px`,
32462
+ height: `${b}px`,
32463
+ margin: "0 auto"
32464
+ },
32465
+ children: null == m ? void 0 : m.items.map(t => /* @__PURE__ */u$1(dt$1, {
32466
+ item: t,
32467
+ renderPage: o,
32468
+ renderPlaceholder: n
32469
+ }, t.globalPageIndex))
32470
+ })
32471
+ })]
32454
32472
  });
32455
32473
  }
32456
- function dt$1({
32457
- chapterId: e,
32458
- localPageIndex: a,
32474
+ function ut({
32475
+ chapterId: t,
32476
+ localPageIndex: e,
32459
32477
  scale: s,
32460
32478
  dpr: i,
32461
32479
  className: r
32462
32480
  }) {
32463
32481
  return u$1(RenderLayer, {
32464
- documentId: e,
32465
- pageIndex: a,
32482
+ documentId: t,
32483
+ pageIndex: e,
32466
32484
  scale: s,
32467
32485
  dpr: i,
32468
32486
  className: r,
@@ -32471,10 +32489,10 @@ function dt$1({
32471
32489
  }
32472
32490
  });
32473
32491
  }
32474
- const ct$1 = {
32492
+ const pt = {
32475
32493
  kind: "first-wins"
32476
32494
  };
32477
- function ut(t, e, a) {
32495
+ function gt(t, e, a) {
32478
32496
  if (1 === e.length) return e[0].chapterId;
32479
32497
  switch (a.kind) {
32480
32498
  case "first-wins":
@@ -32493,7 +32511,7 @@ function ut(t, e, a) {
32493
32511
  return a.resolve(t, e);
32494
32512
  }
32495
32513
  }
32496
- let pt = class {
32514
+ let ft$1 = class ft {
32497
32515
  constructor(t) {
32498
32516
  this._pages = t, this._byChapter = /* @__PURE__ */new Map(), this._byGlobalNumber = /* @__PURE__ */new Map();
32499
32517
  for (const e of t) {
@@ -32527,8 +32545,8 @@ let pt = class {
32527
32545
  return a ? this._pages.indexOf(a) : -1;
32528
32546
  }
32529
32547
  };
32530
- function gt(t, e = ct$1) {
32531
- const a = function (t, e = ct$1) {
32548
+ function mt$1(t, e = pt) {
32549
+ const a = function (t, e = pt) {
32532
32550
  const a = /* @__PURE__ */new Map();
32533
32551
  for (const i of t.chapters) {
32534
32552
  const [t, e] = i.globalPageRange;
@@ -32538,7 +32556,7 @@ function gt(t, e = ct$1) {
32538
32556
  }
32539
32557
  }
32540
32558
  const s = /* @__PURE__ */new Map();
32541
- for (const [i, r] of a) s.set(i, ut(i, r, e));
32559
+ for (const [i, r] of a) s.set(i, gt(i, r, e));
32542
32560
  return s;
32543
32561
  }(t, e),
32544
32562
  s = /* @__PURE__ */new Map();
@@ -32560,14 +32578,14 @@ function gt(t, e = ct$1) {
32560
32578
  localPageIndex: l
32561
32579
  });
32562
32580
  }
32563
- return new pt(r);
32581
+ return new ft$1(r);
32564
32582
  }
32565
- const ft$1 = class t extends BasePlugin {
32583
+ const vt$1 = class t extends BasePlugin {
32566
32584
  constructor(t, e) {
32567
- super(t, e), 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);
32585
+ super(t, e), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = pt, 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);
32568
32586
  }
32569
32587
  async initialize(t) {
32570
- if (this.config = t, this.passwordProvider = t.passwordProvider, this.overlapStrategy = t.overlapStrategy ?? ct$1, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened(t => {
32588
+ if (this.config = t, this.passwordProvider = t.passwordProvider, this.overlapStrategy = t.overlapStrategy ?? pt, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened(t => {
32571
32589
  this.isOwnedChapter(t.id) && (this.passwordAttempts.delete(t.id), this.updateStatus(t.id, "loaded"));
32572
32590
  }), this.documentManager.provides().onDocumentClosed(t => {
32573
32591
  this.isOwnedChapter(t) && this.updateStatus(t, "closed");
@@ -32615,7 +32633,7 @@ const ft$1 = class t extends BasePlugin {
32615
32633
  i = new Set(e.chapters.map(t => t.chapterId));
32616
32634
  for (const t of s) i.has(t) || (this.closeChapter(t), this.chapterStatus.delete(t));
32617
32635
  for (const t of e.chapters) this.chapterStatus.has(t.chapterId) || this.chapterStatus.set(t.chapterId, "idle");
32618
- this.manifest = e, this.virtualPageMap = gt(e, this.overlapStrategy), this.manifestChange$.emit({
32636
+ this.manifest = e, this.virtualPageMap = mt$1(e, this.overlapStrategy), this.manifestChange$.emit({
32619
32637
  manifest: e,
32620
32638
  map: this.virtualPageMap
32621
32639
  }), this.eagerPrefetchFromManifest();
@@ -32788,12 +32806,12 @@ const ft$1 = class t extends BasePlugin {
32788
32806
  }));
32789
32807
  }
32790
32808
  };
32791
- ft$1.id = "chapter-manager";
32792
- let mt$1 = ft$1;
32793
- const vt$1 = {
32809
+ vt$1.id = "chapter-manager";
32810
+ let bt$1 = vt$1;
32811
+ const Pt$1 = {
32794
32812
  kind: "first-wins"
32795
32813
  };
32796
- function bt$1(t, e, a) {
32814
+ function wt$1(t, e, a) {
32797
32815
  if (1 === e.length) return e[0].chapterId;
32798
32816
  switch (a.kind) {
32799
32817
  case "first-wins":
@@ -32812,7 +32830,7 @@ function bt$1(t, e, a) {
32812
32830
  return a.resolve(t, e);
32813
32831
  }
32814
32832
  }
32815
- let Pt$1 = class Pt {
32833
+ let It$1 = class It {
32816
32834
  constructor(t) {
32817
32835
  this._pages = t, this._byChapter = /* @__PURE__ */new Map(), this._byGlobalNumber = /* @__PURE__ */new Map();
32818
32836
  for (const e of t) {
@@ -32846,8 +32864,8 @@ let Pt$1 = class Pt {
32846
32864
  return a ? this._pages.indexOf(a) : -1;
32847
32865
  }
32848
32866
  };
32849
- function wt$1(t, e = vt$1) {
32850
- const a = function (t, e = vt$1) {
32867
+ function Ct$1(t, e = Pt$1) {
32868
+ const a = function (t, e = Pt$1) {
32851
32869
  const a = /* @__PURE__ */new Map();
32852
32870
  for (const i of t.chapters) {
32853
32871
  const [t, e] = i.globalPageRange;
@@ -32857,7 +32875,7 @@ function wt$1(t, e = vt$1) {
32857
32875
  }
32858
32876
  }
32859
32877
  const s = /* @__PURE__ */new Map();
32860
- for (const [i, r] of a) s.set(i, bt$1(i, r, e));
32878
+ for (const [i, r] of a) s.set(i, wt$1(i, r, e));
32861
32879
  return s;
32862
32880
  }(t, e),
32863
32881
  s = /* @__PURE__ */new Map();
@@ -32879,14 +32897,14 @@ function wt$1(t, e = vt$1) {
32879
32897
  localPageIndex: l
32880
32898
  });
32881
32899
  }
32882
- return new Pt$1(r);
32900
+ return new It$1(r);
32883
32901
  }
32884
- const It$1 = class t extends BasePlugin {
32902
+ const yt$1 = class t extends BasePlugin {
32885
32903
  constructor(t, e) {
32886
- super(t, e), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = vt$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);
32904
+ super(t, e), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = Pt$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);
32887
32905
  }
32888
32906
  async initialize(t) {
32889
- if (this.config = t, this.passwordProvider = t.passwordProvider, this.overlapStrategy = t.overlapStrategy ?? vt$1, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened(t => {
32907
+ if (this.config = t, this.passwordProvider = t.passwordProvider, this.overlapStrategy = t.overlapStrategy ?? Pt$1, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened(t => {
32890
32908
  this.isOwnedChapter(t.id) && (this.passwordAttempts.delete(t.id), this.updateStatus(t.id, "loaded"));
32891
32909
  }), this.documentManager.provides().onDocumentClosed(t => {
32892
32910
  this.isOwnedChapter(t) && this.updateStatus(t, "closed");
@@ -32934,7 +32952,7 @@ const It$1 = class t extends BasePlugin {
32934
32952
  i = new Set(e.chapters.map(t => t.chapterId));
32935
32953
  for (const t of s) i.has(t) || (this.closeChapter(t), this.chapterStatus.delete(t));
32936
32954
  for (const t of e.chapters) this.chapterStatus.has(t.chapterId) || this.chapterStatus.set(t.chapterId, "idle");
32937
- this.manifest = e, this.virtualPageMap = wt$1(e, this.overlapStrategy), this.manifestChange$.emit({
32955
+ this.manifest = e, this.virtualPageMap = Ct$1(e, this.overlapStrategy), this.manifestChange$.emit({
32938
32956
  manifest: e,
32939
32957
  map: this.virtualPageMap
32940
32958
  }), this.eagerPrefetchFromManifest();
@@ -33107,9 +33125,9 @@ const It$1 = class t extends BasePlugin {
33107
33125
  }));
33108
33126
  }
33109
33127
  };
33110
- It$1.id = "chapter-manager";
33111
- let Ct$1 = It$1;
33112
- function yt$1(t, e) {
33128
+ yt$1.id = "chapter-manager";
33129
+ let Mt$1 = yt$1;
33130
+ function St$1(t, e) {
33113
33131
  if (t === e) return true;
33114
33132
  if (t.totalHeight !== e.totalHeight || t.totalWidth !== e.totalWidth || t.pageGap !== e.pageGap || t.items.length !== e.items.length) return false;
33115
33133
  for (let a = 0; a < t.items.length; a++) {
@@ -33119,9 +33137,9 @@ function yt$1(t, e) {
33119
33137
  }
33120
33138
  return true;
33121
33139
  }
33122
- const Mt$1 = class Mt extends BasePlugin {
33140
+ const xt$1 = class xt extends BasePlugin {
33123
33141
  constructor(t, e) {
33124
- super(t, e), this.layoutChange$ = createBehaviorEmitter(void 0, yt$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(Ct$1.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
33142
+ super(t, e), this.layoutChange$ = createBehaviorEmitter(void 0, St$1), this.visibleChange$ = createBehaviorEmitter(), this.virtualPageMap = null, this.pageSizes = /* @__PURE__ */new Map(), this.offsets = [], this.totalHeight = 0, this.totalWidth = 0, this.viewportEl = null, this.viewportObservers = null, this.currentVisible = [], this.currentGlobalPageIndex = 0, this.chapterManagerUnsubs = [], this.chapterManager = this.registry.getPlugin(Mt$1.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
33125
33143
  }
33126
33144
  async initialize(t) {
33127
33145
  this.config = {
@@ -33378,11 +33396,11 @@ const Mt$1 = class Mt extends BasePlugin {
33378
33396
  a && this.scrollToIndex(a.globalPageIndex, e);
33379
33397
  }
33380
33398
  };
33381
- Mt$1.id = "chapter-scroll";
33382
- let St$1 = Mt$1;
33383
- const xt$1 = class t extends BasePlugin {
33399
+ xt$1.id = "chapter-scroll";
33400
+ let kt$1 = xt$1;
33401
+ const Lt$1 = class t extends BasePlugin {
33384
33402
  constructor(t, e) {
33385
- super(t, e), this.notesChange$ = createBehaviorEmitter([]), this.noteActivated$ = createEmitter(), this.notes = /* @__PURE__ */new Map(), this.chapterScroll = this.registry.getPlugin(St$1.id), this.chapterManager = this.registry.getPlugin(mt$1.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
33403
+ super(t, e), this.notesChange$ = createBehaviorEmitter([]), this.noteActivated$ = createEmitter(), this.notes = /* @__PURE__ */new Map(), this.chapterScroll = this.registry.getPlugin(kt$1.id), this.chapterManager = this.registry.getPlugin(bt$1.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
33386
33404
  }
33387
33405
  async initialize(e) {
33388
33406
  if (this.config = e, e.callbacks.loadNotes) try {
@@ -33443,7 +33461,7 @@ const xt$1 = class t extends BasePlugin {
33443
33461
  globalPageNumber: t.globalPageNumber,
33444
33462
  globalPageIndex: t.globalPageIndex,
33445
33463
  rectsPdfCoord: t.rectsPdfCoord,
33446
- endAnchor: Lt$1(t.rectsPdfCoord),
33464
+ endAnchor: Tt$1(t.rectsPdfCoord),
33447
33465
  selectedText: t.selectedText,
33448
33466
  content: t.content
33449
33467
  };
@@ -33534,22 +33552,22 @@ const xt$1 = class t extends BasePlugin {
33534
33552
  });
33535
33553
  }
33536
33554
  };
33537
- xt$1.id = "note";
33538
- let kt$1 = xt$1;
33539
- function Lt$1(t) {
33555
+ Lt$1.id = "note";
33556
+ let $t$1 = Lt$1;
33557
+ function Tt$1(t) {
33540
33558
  const e = t[t.length - 1];
33541
33559
  return {
33542
33560
  x: e.origin.x + e.size.width,
33543
33561
  y: e.origin.y + e.size.height
33544
33562
  };
33545
33563
  }
33546
- function $t$1({
33547
- chapterId: a,
33564
+ function Dt$1({
33565
+ chapterId: e,
33548
33566
  localPageIndex: s,
33549
33567
  pdfPageWidth: o,
33550
33568
  pdfPageHeight: n,
33551
33569
  cssPageWidth: h,
33552
- cssPageHeight: d$1,
33570
+ cssPageHeight: d,
33553
33571
  color: c = "#f59e0b",
33554
33572
  ui: u,
33555
33573
  className: p,
@@ -33566,7 +33584,7 @@ function $t$1({
33566
33584
  isLoading: true,
33567
33585
  ready: new Promise(() => {})
33568
33586
  };
33569
- const e = t.getPlugin(kt$1.id);
33587
+ const e = t.getPlugin($t$1.id);
33570
33588
  return {
33571
33589
  plugin: e,
33572
33590
  isLoading: false,
@@ -33584,7 +33602,7 @@ function $t$1({
33584
33602
  isLoading: true,
33585
33603
  ready: new Promise(() => {})
33586
33604
  };
33587
- const e = t.getPlugin(kt$1.id);
33605
+ const e = t.getPlugin($t$1.id);
33588
33606
  return (null == e ? void 0 : e.provides) ? {
33589
33607
  provides: e.provides(),
33590
33608
  isLoading: false,
@@ -33595,14 +33613,14 @@ function $t$1({
33595
33613
  ready: Promise.resolve()
33596
33614
  };
33597
33615
  })(),
33598
- [v, b] = d([]),
33599
- [P, w] = d(null),
33600
- [I, C] = d(null);
33616
+ [v, b] = d$1([]),
33617
+ [P, w] = d$1(null),
33618
+ [I, C] = d$1(null);
33601
33619
  if (y(() => {
33602
33620
  if (m) return m.onNotesChange(t => {
33603
- b(t.filter(t => t.chapterId === a && t.localPageIndex === s));
33621
+ b(t.filter(t => t.chapterId === e && t.localPageIndex === s));
33604
33622
  });
33605
- }, [m, a, s]), y(() => {
33623
+ }, [m, e, s]), y(() => {
33606
33624
  if (!I) return;
33607
33625
  const t = t => {
33608
33626
  var e;
@@ -33612,7 +33630,7 @@ function $t$1({
33612
33630
  return document.addEventListener("mousedown", t), () => document.removeEventListener("mousedown", t);
33613
33631
  }, [I]), !m || 0 === v.length || !o || !n) return null;
33614
33632
  const y$1 = h / o,
33615
- M = d$1 / n,
33633
+ M = d / n,
33616
33634
  S = (null == u ? void 0 : u.iconSize) ?? 16,
33617
33635
  x = (null == u ? void 0 : u.highlightColor) ?? "rgba(245, 158, 11, 0.08)";
33618
33636
  return u$1("div", {
@@ -33624,9 +33642,9 @@ function $t$1({
33624
33642
  zIndex: 25,
33625
33643
  ...g
33626
33644
  },
33627
- children: v.map(a => {
33628
- const s = P === a.noteId,
33629
- i = I === a.noteId,
33645
+ children: v.map(e => {
33646
+ const s = P === e.noteId,
33647
+ i = I === e.noteId,
33630
33648
  r = s || i,
33631
33649
  {
33632
33650
  left: o,
@@ -33650,8 +33668,8 @@ function $t$1({
33650
33668
  top: d
33651
33669
  };
33652
33670
  }({
33653
- markerPdf: a.endAnchor,
33654
- lineRects: a.rectsPdfCoord,
33671
+ markerPdf: e.endAnchor,
33672
+ lineRects: e.rectsPdfCoord,
33655
33673
  sx: y$1,
33656
33674
  sy: M,
33657
33675
  cssPageWidth: h,
@@ -33669,28 +33687,28 @@ function $t$1({
33669
33687
  width: r - s,
33670
33688
  height: o - i
33671
33689
  };
33672
- }(a.rectsPdfCoord, y$1, M),
33690
+ }(e.rectsPdfCoord, y$1, M),
33673
33691
  d = i ? 72 : 0,
33674
33692
  p = Math.max(0, Math.min(l.left, o) - 8),
33675
33693
  g = Math.max(0, Math.min(l.top, n) - 8),
33676
33694
  v = Math.min(h, Math.max(l.left + l.width, o + S) + 8) - p,
33677
33695
  b = Math.max(l.top + l.height, n + S + 6 + d) + 8 - g;
33678
33696
  return u$1("div", {
33679
- children: [a.rectsPdfCoord.map((e, s) => /* @__PURE__ */u$1("div", {
33697
+ children: [e.rectsPdfCoord.map((t, s) => /* @__PURE__ */u$1("div", {
33680
33698
  style: {
33681
33699
  position: "absolute",
33682
- left: e.origin.x * y$1 + "px",
33683
- top: e.origin.y * M + "px",
33684
- width: e.size.width * y$1 + "px",
33685
- height: e.size.height * M + "px",
33700
+ left: t.origin.x * y$1 + "px",
33701
+ top: t.origin.y * M + "px",
33702
+ width: t.size.width * y$1 + "px",
33703
+ height: t.size.height * M + "px",
33686
33704
  background: x,
33687
33705
  borderRadius: "2px",
33688
33706
  pointerEvents: "auto",
33689
33707
  cursor: "default"
33690
33708
  },
33691
- onMouseEnter: () => w(a.noteId)
33692
- }, `${a.noteId}-bg-${s}`)), r && /* @__PURE__ */u$1("div", {
33693
- "data-note-marker-zone": a.noteId,
33709
+ onMouseEnter: () => w(e.noteId)
33710
+ }, `${e.noteId}-bg-${s}`)), r && /* @__PURE__ */u$1("div", {
33711
+ "data-note-marker-zone": e.noteId,
33694
33712
  style: {
33695
33713
  position: "absolute",
33696
33714
  left: `${p}px`,
@@ -33700,9 +33718,9 @@ function $t$1({
33700
33718
  pointerEvents: "auto",
33701
33719
  zIndex: 26
33702
33720
  },
33703
- onMouseEnter: () => w(a.noteId),
33721
+ onMouseEnter: () => w(e.noteId),
33704
33722
  onMouseLeave: () => {
33705
- I !== a.noteId && w(null);
33723
+ I !== e.noteId && w(null);
33706
33724
  },
33707
33725
  children: [(null == u ? void 0 : u.renderIcon) ? /* @__PURE__ */u$1("div", {
33708
33726
  role: "button",
@@ -33711,7 +33729,7 @@ function $t$1({
33711
33729
  "aria-label": "笔记",
33712
33730
  onMouseDown: t => t.stopPropagation(),
33713
33731
  onClick: t => {
33714
- t.stopPropagation(), C(t => t === a.noteId ? null : a.noteId);
33732
+ t.stopPropagation(), C(t => t === e.noteId ? null : e.noteId);
33715
33733
  },
33716
33734
  style: {
33717
33735
  position: "absolute",
@@ -33728,14 +33746,14 @@ function $t$1({
33728
33746
  padding: 0
33729
33747
  },
33730
33748
  children: u.renderIcon({
33731
- note: a
33749
+ note: e
33732
33750
  })
33733
33751
  }) : /* @__PURE__ */u$1("button", {
33734
33752
  type: "button",
33735
33753
  title: "笔记",
33736
33754
  onMouseDown: t => t.stopPropagation(),
33737
33755
  onClick: t => {
33738
- t.stopPropagation(), C(t => t === a.noteId ? null : a.noteId);
33756
+ t.stopPropagation(), C(t => t === e.noteId ? null : e.noteId);
33739
33757
  },
33740
33758
  style: {
33741
33759
  position: "absolute",
@@ -33769,12 +33787,12 @@ function $t$1({
33769
33787
  },
33770
33788
  onMouseDown: t => t.stopPropagation(),
33771
33789
  children: u.renderMenuActions({
33772
- note: a,
33790
+ note: e,
33773
33791
  onEdit: () => {
33774
- C(null), w(null), null == f || f.requestEdit(a.noteId);
33792
+ C(null), w(null), null == f || f.requestEdit(e.noteId);
33775
33793
  },
33776
33794
  onDelete: () => {
33777
- C(null), w(null), m.deleteNote(a.noteId);
33795
+ C(null), w(null), m.deleteNote(e.noteId);
33778
33796
  }
33779
33797
  })
33780
33798
  }) : /* @__PURE__ */u$1("div", {
@@ -33795,29 +33813,29 @@ function $t$1({
33795
33813
  onMouseDown: t => t.stopPropagation(),
33796
33814
  children: [/* @__PURE__ */u$1("button", {
33797
33815
  type: "button",
33798
- style: Tt$1,
33816
+ style: zt$1,
33799
33817
  onClick: t => {
33800
- t.stopPropagation(), C(null), w(null), null == f || f.requestEdit(a.noteId);
33818
+ t.stopPropagation(), C(null), w(null), null == f || f.requestEdit(e.noteId);
33801
33819
  },
33802
33820
  children: "编辑"
33803
33821
  }), /* @__PURE__ */u$1("button", {
33804
33822
  type: "button",
33805
33823
  style: {
33806
- ...Tt$1,
33824
+ ...zt$1,
33807
33825
  color: "#dc2626"
33808
33826
  },
33809
33827
  onClick: t => {
33810
- t.stopPropagation(), C(null), w(null), m.deleteNote(a.noteId);
33828
+ t.stopPropagation(), C(null), w(null), m.deleteNote(e.noteId);
33811
33829
  },
33812
33830
  children: "删除"
33813
33831
  })]
33814
33832
  }))]
33815
33833
  })]
33816
- }, a.noteId);
33834
+ }, e.noteId);
33817
33835
  })
33818
33836
  });
33819
33837
  }
33820
- const Tt$1 = {
33838
+ const zt$1 = {
33821
33839
  display: "block",
33822
33840
  width: "100%",
33823
33841
  padding: "6px 10px",
@@ -33829,10 +33847,10 @@ const Tt$1 = {
33829
33847
  cursor: "pointer",
33830
33848
  textAlign: "left"
33831
33849
  };
33832
- const zt$1 = {
33850
+ const Gt$1 = {
33833
33851
  kind: "first-wins"
33834
33852
  };
33835
- function Dt$1(t, e, a) {
33853
+ function Ot$1(t, e, a) {
33836
33854
  if (1 === e.length) return e[0].chapterId;
33837
33855
  switch (a.kind) {
33838
33856
  case "first-wins":
@@ -33851,7 +33869,7 @@ function Dt$1(t, e, a) {
33851
33869
  return a.resolve(t, e);
33852
33870
  }
33853
33871
  }
33854
- let Gt$1 = class Gt {
33872
+ let At$1 = class At {
33855
33873
  constructor(t) {
33856
33874
  this._pages = t, this._byChapter = /* @__PURE__ */new Map(), this._byGlobalNumber = /* @__PURE__ */new Map();
33857
33875
  for (const e of t) {
@@ -33885,8 +33903,8 @@ let Gt$1 = class Gt {
33885
33903
  return a ? this._pages.indexOf(a) : -1;
33886
33904
  }
33887
33905
  };
33888
- function Ot$1(t, e = zt$1) {
33889
- const a = function (t, e = zt$1) {
33906
+ function Nt(t, e = Gt$1) {
33907
+ const a = function (t, e = Gt$1) {
33890
33908
  const a = /* @__PURE__ */new Map();
33891
33909
  for (const i of t.chapters) {
33892
33910
  const [t, e] = i.globalPageRange;
@@ -33896,7 +33914,7 @@ function Ot$1(t, e = zt$1) {
33896
33914
  }
33897
33915
  }
33898
33916
  const s = /* @__PURE__ */new Map();
33899
- for (const [i, r] of a) s.set(i, Dt$1(i, r, e));
33917
+ for (const [i, r] of a) s.set(i, Ot$1(i, r, e));
33900
33918
  return s;
33901
33919
  }(t, e),
33902
33920
  s = /* @__PURE__ */new Map();
@@ -33918,14 +33936,14 @@ function Ot$1(t, e = zt$1) {
33918
33936
  localPageIndex: l
33919
33937
  });
33920
33938
  }
33921
- return new Gt$1(r);
33939
+ return new At$1(r);
33922
33940
  }
33923
- const At$1 = class t extends BasePlugin {
33941
+ const Vt = class t extends BasePlugin {
33924
33942
  constructor(t, e) {
33925
- super(t, e), 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);
33943
+ super(t, e), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = Gt$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);
33926
33944
  }
33927
33945
  async initialize(t) {
33928
- if (this.config = t, this.passwordProvider = t.passwordProvider, this.overlapStrategy = t.overlapStrategy ?? zt$1, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened(t => {
33946
+ if (this.config = t, this.passwordProvider = t.passwordProvider, this.overlapStrategy = t.overlapStrategy ?? Gt$1, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened(t => {
33929
33947
  this.isOwnedChapter(t.id) && (this.passwordAttempts.delete(t.id), this.updateStatus(t.id, "loaded"));
33930
33948
  }), this.documentManager.provides().onDocumentClosed(t => {
33931
33949
  this.isOwnedChapter(t) && this.updateStatus(t, "closed");
@@ -33973,7 +33991,7 @@ const At$1 = class t extends BasePlugin {
33973
33991
  i = new Set(e.chapters.map(t => t.chapterId));
33974
33992
  for (const t of s) i.has(t) || (this.closeChapter(t), this.chapterStatus.delete(t));
33975
33993
  for (const t of e.chapters) this.chapterStatus.has(t.chapterId) || this.chapterStatus.set(t.chapterId, "idle");
33976
- this.manifest = e, this.virtualPageMap = Ot$1(e, this.overlapStrategy), this.manifestChange$.emit({
33994
+ this.manifest = e, this.virtualPageMap = Nt(e, this.overlapStrategy), this.manifestChange$.emit({
33977
33995
  manifest: e,
33978
33996
  map: this.virtualPageMap
33979
33997
  }), this.eagerPrefetchFromManifest();
@@ -34146,12 +34164,12 @@ const At$1 = class t extends BasePlugin {
34146
34164
  }));
34147
34165
  }
34148
34166
  };
34149
- At$1.id = "chapter-manager";
34150
- let Nt = At$1;
34151
- const Vt = {
34167
+ Vt.id = "chapter-manager";
34168
+ let Et = Vt;
34169
+ const Rt = {
34152
34170
  kind: "first-wins"
34153
34171
  };
34154
- function Et(t, e, a) {
34172
+ function Ft(t, e, a) {
34155
34173
  if (1 === e.length) return e[0].chapterId;
34156
34174
  switch (a.kind) {
34157
34175
  case "first-wins":
@@ -34170,7 +34188,7 @@ function Et(t, e, a) {
34170
34188
  return a.resolve(t, e);
34171
34189
  }
34172
34190
  }
34173
- let Rt = class {
34191
+ let Ut = class {
34174
34192
  constructor(t) {
34175
34193
  this._pages = t, this._byChapter = /* @__PURE__ */new Map(), this._byGlobalNumber = /* @__PURE__ */new Map();
34176
34194
  for (const e of t) {
@@ -34204,8 +34222,8 @@ let Rt = class {
34204
34222
  return a ? this._pages.indexOf(a) : -1;
34205
34223
  }
34206
34224
  };
34207
- function Ft(t, e = Vt) {
34208
- const a = function (t, e = Vt) {
34225
+ function _t(t, e = Rt) {
34226
+ const a = function (t, e = Rt) {
34209
34227
  const a = /* @__PURE__ */new Map();
34210
34228
  for (const i of t.chapters) {
34211
34229
  const [t, e] = i.globalPageRange;
@@ -34215,7 +34233,7 @@ function Ft(t, e = Vt) {
34215
34233
  }
34216
34234
  }
34217
34235
  const s = /* @__PURE__ */new Map();
34218
- for (const [i, r] of a) s.set(i, Et(i, r, e));
34236
+ for (const [i, r] of a) s.set(i, Ft(i, r, e));
34219
34237
  return s;
34220
34238
  }(t, e),
34221
34239
  s = /* @__PURE__ */new Map();
@@ -34237,14 +34255,14 @@ function Ft(t, e = Vt) {
34237
34255
  localPageIndex: l
34238
34256
  });
34239
34257
  }
34240
- return new Rt(r);
34258
+ return new Ut(r);
34241
34259
  }
34242
- const Ut = class t extends BasePlugin {
34260
+ const qt = class t extends BasePlugin {
34243
34261
  constructor(t, e) {
34244
- super(t, e), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = Vt, 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);
34262
+ super(t, e), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = Rt, 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);
34245
34263
  }
34246
34264
  async initialize(t) {
34247
- if (this.config = t, this.passwordProvider = t.passwordProvider, this.overlapStrategy = t.overlapStrategy ?? Vt, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened(t => {
34265
+ if (this.config = t, this.passwordProvider = t.passwordProvider, this.overlapStrategy = t.overlapStrategy ?? Rt, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened(t => {
34248
34266
  this.isOwnedChapter(t.id) && (this.passwordAttempts.delete(t.id), this.updateStatus(t.id, "loaded"));
34249
34267
  }), this.documentManager.provides().onDocumentClosed(t => {
34250
34268
  this.isOwnedChapter(t) && this.updateStatus(t, "closed");
@@ -34292,7 +34310,7 @@ const Ut = class t extends BasePlugin {
34292
34310
  i = new Set(e.chapters.map(t => t.chapterId));
34293
34311
  for (const t of s) i.has(t) || (this.closeChapter(t), this.chapterStatus.delete(t));
34294
34312
  for (const t of e.chapters) this.chapterStatus.has(t.chapterId) || this.chapterStatus.set(t.chapterId, "idle");
34295
- this.manifest = e, this.virtualPageMap = Ft(e, this.overlapStrategy), this.manifestChange$.emit({
34313
+ this.manifest = e, this.virtualPageMap = _t(e, this.overlapStrategy), this.manifestChange$.emit({
34296
34314
  manifest: e,
34297
34315
  map: this.virtualPageMap
34298
34316
  }), this.eagerPrefetchFromManifest();
@@ -34465,9 +34483,9 @@ const Ut = class t extends BasePlugin {
34465
34483
  }));
34466
34484
  }
34467
34485
  };
34468
- Ut.id = "chapter-manager";
34469
- let _t = Ut;
34470
- function qt(t, e) {
34486
+ qt.id = "chapter-manager";
34487
+ let Wt = qt;
34488
+ function Ht$1(t, e) {
34471
34489
  if (t === e) return true;
34472
34490
  if (t.totalHeight !== e.totalHeight || t.totalWidth !== e.totalWidth || t.pageGap !== e.pageGap || t.items.length !== e.items.length) return false;
34473
34491
  for (let a = 0; a < t.items.length; a++) {
@@ -34477,9 +34495,9 @@ function qt(t, e) {
34477
34495
  }
34478
34496
  return true;
34479
34497
  }
34480
- const Wt = class extends BasePlugin {
34498
+ const Bt$1 = class Bt extends BasePlugin {
34481
34499
  constructor(t, e) {
34482
- super(t, e), this.layoutChange$ = createBehaviorEmitter(void 0, qt), 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(_t.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
34500
+ super(t, e), this.layoutChange$ = createBehaviorEmitter(void 0, Ht$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(Wt.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
34483
34501
  }
34484
34502
  async initialize(t) {
34485
34503
  this.config = {
@@ -34736,16 +34754,16 @@ const Wt = class extends BasePlugin {
34736
34754
  a && this.scrollToIndex(a.globalPageIndex, e);
34737
34755
  }
34738
34756
  };
34739
- Wt.id = "chapter-scroll";
34740
- let Ht$1 = Wt;
34741
- function Bt$1(t) {
34757
+ Bt$1.id = "chapter-scroll";
34758
+ let jt = Bt$1;
34759
+ function Zt(t) {
34742
34760
  const e = t[t.length - 1];
34743
34761
  return {
34744
34762
  x: e.origin.x + e.size.width,
34745
34763
  y: e.origin.y + e.size.height
34746
34764
  };
34747
34765
  }
34748
- function jt(t, e) {
34766
+ function Yt(t, e) {
34749
34767
  const a = t.origin.y,
34750
34768
  s = t.origin.y + t.size.height,
34751
34769
  i = e.origin.y,
@@ -34754,22 +34772,22 @@ function jt(t, e) {
34754
34772
  if (o <= 0) return 0;
34755
34773
  return Math.max(0, Math.min(s, r) - Math.max(a, i)) / o;
34756
34774
  }
34757
- function Zt(t, e) {
34775
+ function Xt(t, e) {
34758
34776
  var a, s;
34759
34777
  if (t.chapterId !== e.chapterId || t.localPageIndex !== e.localPageIndex) return false;
34760
34778
  const i = (null == (a = t.rectsPdfCoord) ? void 0 : a.length) ? t.rectsPdfCoord : [t.rectPdfCoord],
34761
34779
  r = (null == (s = e.rectsPdfCoord) ? void 0 : s.length) ? e.rectsPdfCoord : [e.rectPdfCoord],
34762
- o = t.markerAnchor ?? Bt$1(i),
34763
- n = e.markerAnchor ?? Bt$1(r);
34780
+ o = t.markerAnchor ?? Zt(i),
34781
+ n = e.markerAnchor ?? Zt(r);
34764
34782
  if (Math.hypot(o.x - n.x, o.y - n.y) <= 6) return true;
34765
34783
  for (const h of i) for (const t of r) {
34766
- if (jt(h, t) < .5) continue;
34784
+ if (Yt(h, t) < .5) continue;
34767
34785
  const e = Math.max(h.origin.x, t.origin.x);
34768
34786
  if (Math.min(h.origin.x + h.size.width, t.origin.x + t.size.width) - e > .25 * Math.min(h.size.width, t.size.width)) return true;
34769
34787
  }
34770
34788
  return false;
34771
34789
  }
34772
- async function Yt(t, e, a) {
34790
+ async function Kt(t, e, a) {
34773
34791
  t.scrollToGlobalPageIndex(e), await function (t, e, a = 2500) {
34774
34792
  const s = t.getLayout().items.find(t => t.globalPageIndex === e && !t.isPlaceholder);
34775
34793
  return s ? Promise.resolve(s) : new Promise(s => {
@@ -34785,9 +34803,9 @@ async function Yt(t, e, a) {
34785
34803
  marginTop: 80
34786
34804
  });
34787
34805
  }
34788
- const Xt = class t extends BasePlugin {
34806
+ const Qt = class t extends BasePlugin {
34789
34807
  constructor(t, e) {
34790
- super(t, e), this.change$ = createBehaviorEmitter([]), this.entries = /* @__PURE__ */new Map(), this.chapterScroll = this.registry.getPlugin(Ht$1.id), this.chapterManager = this.registry.getPlugin(Nt.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
34808
+ super(t, e), this.change$ = createBehaviorEmitter([]), this.entries = /* @__PURE__ */new Map(), this.chapterScroll = this.registry.getPlugin(jt.id), this.chapterManager = this.registry.getPlugin(Et.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
34791
34809
  }
34792
34810
  async initialize(e) {
34793
34811
  var a;
@@ -34814,7 +34832,7 @@ const Xt = class t extends BasePlugin {
34814
34832
  };
34815
34833
  }
34816
34834
  addBookmark(t) {
34817
- for (const s of this.entries.values()) if (Zt(s.anchor, t.anchor)) return s;
34835
+ for (const s of this.entries.values()) if (Xt(s.anchor, t.anchor)) return s;
34818
34836
  const e = t.id ?? `bm-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
34819
34837
  a = {
34820
34838
  id: e,
@@ -34880,17 +34898,17 @@ const Xt = class t extends BasePlugin {
34880
34898
  const e = t.rectPdfCoord;
34881
34899
  return e.origin.y + e.size.height;
34882
34900
  }(e.anchor);
34883
- await Yt(a, s, i);
34901
+ await Kt(a, s, i);
34884
34902
  }
34885
34903
  };
34886
- Xt.id = "paragraph-bookmark";
34887
- let Kt = Xt;
34888
- function Qt({
34889
- chapterId: a,
34904
+ Qt.id = "paragraph-bookmark";
34905
+ let Jt = Qt;
34906
+ function te({
34907
+ chapterId: e,
34890
34908
  localPageIndex: o,
34891
34909
  pdfPageWidth: n,
34892
34910
  pdfPageHeight: l,
34893
- cssPageWidth: d$1,
34911
+ cssPageWidth: d,
34894
34912
  cssPageHeight: c,
34895
34913
  onBookmarkClick: u,
34896
34914
  ui: p,
@@ -34899,17 +34917,17 @@ function Qt({
34899
34917
  }) {
34900
34918
  const {
34901
34919
  provides: m
34902
- } = useCapability(Kt.id),
34903
- [v, b] = d([]),
34904
- [P, w] = d(null),
34920
+ } = useCapability(Jt.id),
34921
+ [v, b] = d$1([]),
34922
+ [P, w] = d$1(null),
34905
34923
  I = A(null);
34906
34924
  if (y(() => {
34907
34925
  if (!m) return;
34908
34926
  const t = () => {
34909
- b(m.listBookmarks().filter(t => t.anchor.chapterId === a && t.anchor.localPageIndex === o));
34927
+ b(m.listBookmarks().filter(t => t.anchor.chapterId === e && t.anchor.localPageIndex === o));
34910
34928
  };
34911
34929
  return t(), m.onBookmarksChange(t);
34912
- }, [m, a, o]), y(() => {
34930
+ }, [m, e, o]), y(() => {
34913
34931
  if (!P) return;
34914
34932
  const t = t => {
34915
34933
  var e;
@@ -34917,7 +34935,7 @@ function Qt({
34917
34935
  };
34918
34936
  return document.addEventListener("mousedown", t), () => document.removeEventListener("mousedown", t);
34919
34937
  }, [P]), !m || 0 === v.length || !n || !l) return null;
34920
- const C = d$1 / n,
34938
+ const C = d / n,
34921
34939
  y$1 = c / l,
34922
34940
  M = (null == p ? void 0 : p.iconSize) ?? 16;
34923
34941
  return u$1("div", {
@@ -34928,12 +34946,12 @@ function Qt({
34928
34946
  pointerEvents: "none",
34929
34947
  ...f
34930
34948
  },
34931
- children: v.map(a => {
34949
+ children: v.map(e => {
34932
34950
  var s;
34933
- const i = (null == (s = a.anchor.rectsPdfCoord) ? void 0 : s.length) ? a.anchor.rectsPdfCoord : [a.anchor.rectPdfCoord],
34934
- r = a.anchor.markerAnchor ?? {
34935
- x: a.anchor.rectPdfCoord.origin.x + a.anchor.rectPdfCoord.size.width,
34936
- y: a.anchor.rectPdfCoord.origin.y + a.anchor.rectPdfCoord.size.height
34951
+ const i = (null == (s = e.anchor.rectsPdfCoord) ? void 0 : s.length) ? e.anchor.rectsPdfCoord : [e.anchor.rectPdfCoord],
34952
+ r = e.anchor.markerAnchor ?? {
34953
+ x: e.anchor.rectPdfCoord.origin.x + e.anchor.rectPdfCoord.size.width,
34954
+ y: e.anchor.rectPdfCoord.origin.y + e.anchor.rectPdfCoord.size.height
34937
34955
  },
34938
34956
  {
34939
34957
  left: o,
@@ -34961,7 +34979,7 @@ function Qt({
34961
34979
  lineRects: i,
34962
34980
  sx: C,
34963
34981
  sy: y$1,
34964
- cssPageWidth: d$1,
34982
+ cssPageWidth: d,
34965
34983
  iconSize: M
34966
34984
  }),
34967
34985
  h = Math.max(0, o - 6),
@@ -34980,8 +34998,8 @@ function Qt({
34980
34998
  children: [(null == p ? void 0 : p.renderIcon) ? /* @__PURE__ */u$1("div", {
34981
34999
  role: "button",
34982
35000
  tabIndex: 0,
34983
- title: a.label,
34984
- "aria-label": `bookmark ${a.label}`,
35001
+ title: e.label,
35002
+ "aria-label": `bookmark ${e.label}`,
34985
35003
  style: {
34986
35004
  position: "absolute",
34987
35005
  left: "6px",
@@ -34997,16 +35015,16 @@ function Qt({
34997
35015
  padding: 0
34998
35016
  },
34999
35017
  onClick: t => {
35000
- t.stopPropagation(), w(t => t === a.id ? null : a.id), null == u || u(a);
35018
+ t.stopPropagation(), w(t => t === e.id ? null : e.id), null == u || u(e);
35001
35019
  },
35002
35020
  children: p.renderIcon({
35003
- bookmark: a
35021
+ bookmark: e
35004
35022
  })
35005
35023
  }) : /* @__PURE__ */u$1("button", {
35006
35024
  type: "button",
35007
- title: a.label,
35025
+ title: e.label,
35008
35026
  onClick: t => {
35009
- t.stopPropagation(), w(t => t === a.id ? null : a.id), null == u || u(a);
35027
+ t.stopPropagation(), w(t => t === e.id ? null : e.id), null == u || u(e);
35010
35028
  },
35011
35029
  style: {
35012
35030
  position: "absolute",
@@ -35027,9 +35045,9 @@ function Qt({
35027
35045
  fontSize: "11px",
35028
35046
  lineHeight: 1
35029
35047
  },
35030
- "aria-label": `bookmark ${a.label}`,
35048
+ "aria-label": `bookmark ${e.label}`,
35031
35049
  children: "🔖"
35032
- }), P === a.id && /* @__PURE__ */u$1("div", {
35050
+ }), P === e.id && /* @__PURE__ */u$1("div", {
35033
35051
  ref: I,
35034
35052
  style: {
35035
35053
  position: "absolute",
@@ -35059,24 +35077,24 @@ function Qt({
35059
35077
  textAlign: "left"
35060
35078
  },
35061
35079
  onClick: () => {
35062
- m.requestRemoveBookmark(a.id).then(t => {
35080
+ m.requestRemoveBookmark(e.id).then(t => {
35063
35081
  t && w(null);
35064
35082
  });
35065
35083
  },
35066
35084
  children: "删除书签"
35067
35085
  })
35068
35086
  })]
35069
- }, a.id);
35087
+ }, e.id);
35070
35088
  })
35071
35089
  });
35072
35090
  }
35073
- function Jt(t) {
35091
+ function ee(t) {
35074
35092
  return t.chapterId;
35075
35093
  }
35076
- function te(t, e) {
35094
+ function ae(t, e) {
35077
35095
  t.wait(e, () => {});
35078
35096
  }
35079
- function ee(t, e, a) {
35097
+ function se$1(t, e, a) {
35080
35098
  return {
35081
35099
  chapterId: t.chapterId,
35082
35100
  localPageIndex: t.localPageIndex,
@@ -35086,9 +35104,21 @@ function ee(t, e, a) {
35086
35104
  selectedText: a
35087
35105
  };
35088
35106
  }
35089
- const ae = "note",
35090
- se$1 = {
35091
- id: ae,
35107
+ const ie$1 = {
35108
+ position: "relative",
35109
+ height: "100%",
35110
+ width: "100%"
35111
+ },
35112
+ re$1 = {
35113
+ userSelect: "none",
35114
+ WebkitUserSelect: "none"
35115
+ };
35116
+ function oe$1() {
35117
+ "undefined" != typeof window && window.getSelection()?.removeAllRanges();
35118
+ }
35119
+ const ne$1 = "note",
35120
+ he$1 = {
35121
+ id: ne$1,
35092
35122
  name: "Note Plugin",
35093
35123
  version: "0.1.0",
35094
35124
  provides: ["note"],
@@ -35102,10 +35132,10 @@ const ae = "note",
35102
35132
  markerSize: 18
35103
35133
  }
35104
35134
  };
35105
- const ie$1 = {
35135
+ const le$1 = {
35106
35136
  kind: "first-wins"
35107
35137
  };
35108
- function re$1(t, e, a) {
35138
+ function de$1(t, e, a) {
35109
35139
  if (1 === e.length) return e[0].chapterId;
35110
35140
  switch (a.kind) {
35111
35141
  case "first-wins":
@@ -35124,7 +35154,7 @@ function re$1(t, e, a) {
35124
35154
  return a.resolve(t, e);
35125
35155
  }
35126
35156
  }
35127
- let oe$1 = class oe {
35157
+ let ce$1 = class ce {
35128
35158
  constructor(t) {
35129
35159
  this._pages = t, this._byChapter = /* @__PURE__ */new Map(), this._byGlobalNumber = /* @__PURE__ */new Map();
35130
35160
  for (const e of t) {
@@ -35158,8 +35188,8 @@ let oe$1 = class oe {
35158
35188
  return a ? this._pages.indexOf(a) : -1;
35159
35189
  }
35160
35190
  };
35161
- function ne$1(t, e = ie$1) {
35162
- const a = function (t, e = ie$1) {
35191
+ function ue$1(t, e = le$1) {
35192
+ const a = function (t, e = le$1) {
35163
35193
  const a = /* @__PURE__ */new Map();
35164
35194
  for (const i of t.chapters) {
35165
35195
  const [t, e] = i.globalPageRange;
@@ -35169,7 +35199,7 @@ function ne$1(t, e = ie$1) {
35169
35199
  }
35170
35200
  }
35171
35201
  const s = /* @__PURE__ */new Map();
35172
- for (const [i, r] of a) s.set(i, re$1(i, r, e));
35202
+ for (const [i, r] of a) s.set(i, de$1(i, r, e));
35173
35203
  return s;
35174
35204
  }(t, e),
35175
35205
  s = /* @__PURE__ */new Map();
@@ -35191,14 +35221,14 @@ function ne$1(t, e = ie$1) {
35191
35221
  localPageIndex: l
35192
35222
  });
35193
35223
  }
35194
- return new oe$1(r);
35224
+ return new ce$1(r);
35195
35225
  }
35196
- const he$1 = class t extends BasePlugin {
35226
+ const pe$1 = class t extends BasePlugin {
35197
35227
  constructor(t, e) {
35198
- super(t, e), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = ie$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);
35228
+ super(t, e), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = le$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);
35199
35229
  }
35200
35230
  async initialize(t) {
35201
- if (this.config = t, this.passwordProvider = t.passwordProvider, this.overlapStrategy = t.overlapStrategy ?? ie$1, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened(t => {
35231
+ if (this.config = t, this.passwordProvider = t.passwordProvider, this.overlapStrategy = t.overlapStrategy ?? le$1, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened(t => {
35202
35232
  this.isOwnedChapter(t.id) && (this.passwordAttempts.delete(t.id), this.updateStatus(t.id, "loaded"));
35203
35233
  }), this.documentManager.provides().onDocumentClosed(t => {
35204
35234
  this.isOwnedChapter(t) && this.updateStatus(t, "closed");
@@ -35246,7 +35276,7 @@ const he$1 = class t extends BasePlugin {
35246
35276
  i = new Set(e.chapters.map(t => t.chapterId));
35247
35277
  for (const t of s) i.has(t) || (this.closeChapter(t), this.chapterStatus.delete(t));
35248
35278
  for (const t of e.chapters) this.chapterStatus.has(t.chapterId) || this.chapterStatus.set(t.chapterId, "idle");
35249
- this.manifest = e, this.virtualPageMap = ne$1(e, this.overlapStrategy), this.manifestChange$.emit({
35279
+ this.manifest = e, this.virtualPageMap = ue$1(e, this.overlapStrategy), this.manifestChange$.emit({
35250
35280
  manifest: e,
35251
35281
  map: this.virtualPageMap
35252
35282
  }), this.eagerPrefetchFromManifest();
@@ -35419,12 +35449,12 @@ const he$1 = class t extends BasePlugin {
35419
35449
  }));
35420
35450
  }
35421
35451
  };
35422
- he$1.id = "chapter-manager";
35423
- let le$1 = he$1;
35424
- const de$1 = {
35452
+ pe$1.id = "chapter-manager";
35453
+ let ge$1 = pe$1;
35454
+ const fe$1 = {
35425
35455
  kind: "first-wins"
35426
35456
  };
35427
- function ce$1(t, e, a) {
35457
+ function me$1(t, e, a) {
35428
35458
  if (1 === e.length) return e[0].chapterId;
35429
35459
  switch (a.kind) {
35430
35460
  case "first-wins":
@@ -35443,7 +35473,7 @@ function ce$1(t, e, a) {
35443
35473
  return a.resolve(t, e);
35444
35474
  }
35445
35475
  }
35446
- let ue$1 = class ue {
35476
+ let ve$1 = class ve {
35447
35477
  constructor(t) {
35448
35478
  this._pages = t, this._byChapter = /* @__PURE__ */new Map(), this._byGlobalNumber = /* @__PURE__ */new Map();
35449
35479
  for (const e of t) {
@@ -35477,8 +35507,8 @@ let ue$1 = class ue {
35477
35507
  return a ? this._pages.indexOf(a) : -1;
35478
35508
  }
35479
35509
  };
35480
- function pe$1(t, e = de$1) {
35481
- const a = function (t, e = de$1) {
35510
+ function be$1(t, e = fe$1) {
35511
+ const a = function (t, e = fe$1) {
35482
35512
  const a = /* @__PURE__ */new Map();
35483
35513
  for (const i of t.chapters) {
35484
35514
  const [t, e] = i.globalPageRange;
@@ -35488,7 +35518,7 @@ function pe$1(t, e = de$1) {
35488
35518
  }
35489
35519
  }
35490
35520
  const s = /* @__PURE__ */new Map();
35491
- for (const [i, r] of a) s.set(i, ce$1(i, r, e));
35521
+ for (const [i, r] of a) s.set(i, me$1(i, r, e));
35492
35522
  return s;
35493
35523
  }(t, e),
35494
35524
  s = /* @__PURE__ */new Map();
@@ -35510,14 +35540,14 @@ function pe$1(t, e = de$1) {
35510
35540
  localPageIndex: l
35511
35541
  });
35512
35542
  }
35513
- return new ue$1(r);
35543
+ return new ve$1(r);
35514
35544
  }
35515
- const ge$1 = class t extends BasePlugin {
35545
+ const Pe$1 = class t extends BasePlugin {
35516
35546
  constructor(t, e) {
35517
- super(t, e), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = de$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);
35547
+ super(t, e), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = fe$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);
35518
35548
  }
35519
35549
  async initialize(t) {
35520
- if (this.config = t, this.passwordProvider = t.passwordProvider, this.overlapStrategy = t.overlapStrategy ?? de$1, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened(t => {
35550
+ if (this.config = t, this.passwordProvider = t.passwordProvider, this.overlapStrategy = t.overlapStrategy ?? fe$1, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened(t => {
35521
35551
  this.isOwnedChapter(t.id) && (this.passwordAttempts.delete(t.id), this.updateStatus(t.id, "loaded"));
35522
35552
  }), this.documentManager.provides().onDocumentClosed(t => {
35523
35553
  this.isOwnedChapter(t) && this.updateStatus(t, "closed");
@@ -35565,7 +35595,7 @@ const ge$1 = class t extends BasePlugin {
35565
35595
  i = new Set(e.chapters.map(t => t.chapterId));
35566
35596
  for (const t of s) i.has(t) || (this.closeChapter(t), this.chapterStatus.delete(t));
35567
35597
  for (const t of e.chapters) this.chapterStatus.has(t.chapterId) || this.chapterStatus.set(t.chapterId, "idle");
35568
- this.manifest = e, this.virtualPageMap = pe$1(e, this.overlapStrategy), this.manifestChange$.emit({
35598
+ this.manifest = e, this.virtualPageMap = be$1(e, this.overlapStrategy), this.manifestChange$.emit({
35569
35599
  manifest: e,
35570
35600
  map: this.virtualPageMap
35571
35601
  }), this.eagerPrefetchFromManifest();
@@ -35738,9 +35768,9 @@ const ge$1 = class t extends BasePlugin {
35738
35768
  }));
35739
35769
  }
35740
35770
  };
35741
- ge$1.id = "chapter-manager";
35742
- let fe$1 = ge$1;
35743
- function me$1(t, e) {
35771
+ Pe$1.id = "chapter-manager";
35772
+ let we$1 = Pe$1;
35773
+ function Ie(t, e) {
35744
35774
  if (t === e) return true;
35745
35775
  if (t.totalHeight !== e.totalHeight || t.totalWidth !== e.totalWidth || t.pageGap !== e.pageGap || t.items.length !== e.items.length) return false;
35746
35776
  for (let a = 0; a < t.items.length; a++) {
@@ -35750,9 +35780,9 @@ function me$1(t, e) {
35750
35780
  }
35751
35781
  return true;
35752
35782
  }
35753
- const ve$1 = class ve extends BasePlugin {
35783
+ const Ce = class extends BasePlugin {
35754
35784
  constructor(t, e) {
35755
- super(t, e), this.layoutChange$ = createBehaviorEmitter(void 0, me$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(fe$1.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
35785
+ super(t, e), this.layoutChange$ = createBehaviorEmitter(void 0, Ie), 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(we$1.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
35756
35786
  }
35757
35787
  async initialize(t) {
35758
35788
  this.config = {
@@ -36009,11 +36039,11 @@ const ve$1 = class ve extends BasePlugin {
36009
36039
  a && this.scrollToIndex(a.globalPageIndex, e);
36010
36040
  }
36011
36041
  };
36012
- ve$1.id = "chapter-scroll";
36013
- let be$1 = ve$1;
36014
- const Pe$1 = class t extends BasePlugin {
36042
+ Ce.id = "chapter-scroll";
36043
+ let ye = Ce;
36044
+ const Me = class t extends BasePlugin {
36015
36045
  constructor(t, e) {
36016
- super(t, e), this.notesChange$ = createBehaviorEmitter([]), this.noteActivated$ = createEmitter(), this.notes = /* @__PURE__ */new Map(), this.chapterScroll = this.registry.getPlugin(be$1.id), this.chapterManager = this.registry.getPlugin(le$1.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
36046
+ super(t, e), this.notesChange$ = createBehaviorEmitter([]), this.noteActivated$ = createEmitter(), this.notes = /* @__PURE__ */new Map(), this.chapterScroll = this.registry.getPlugin(ye.id), this.chapterManager = this.registry.getPlugin(ge$1.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
36017
36047
  }
36018
36048
  async initialize(e) {
36019
36049
  if (this.config = e, e.callbacks.loadNotes) try {
@@ -36074,7 +36104,7 @@ const Pe$1 = class t extends BasePlugin {
36074
36104
  globalPageNumber: t.globalPageNumber,
36075
36105
  globalPageIndex: t.globalPageIndex,
36076
36106
  rectsPdfCoord: t.rectsPdfCoord,
36077
- endAnchor: Ie(t.rectsPdfCoord),
36107
+ endAnchor: xe(t.rectsPdfCoord),
36078
36108
  selectedText: t.selectedText,
36079
36109
  content: t.content
36080
36110
  };
@@ -36165,24 +36195,24 @@ const Pe$1 = class t extends BasePlugin {
36165
36195
  });
36166
36196
  }
36167
36197
  };
36168
- Pe$1.id = "note";
36169
- let we$1 = Pe$1;
36170
- function Ie(t) {
36198
+ Me.id = "note";
36199
+ let Se = Me;
36200
+ function xe(t) {
36171
36201
  const e = t[t.length - 1];
36172
36202
  return {
36173
36203
  x: e.origin.x + e.size.width,
36174
36204
  y: e.origin.y + e.size.height
36175
36205
  };
36176
36206
  }
36177
- const Ce = {
36178
- manifest: se$1,
36179
- create: t => new we$1(ae, t),
36207
+ const ke = {
36208
+ manifest: he$1,
36209
+ create: t => new Se(ne$1, t),
36180
36210
  reducer: t => t,
36181
36211
  initialState: {}
36182
36212
  },
36183
- ye = "paragraph-bookmark",
36184
- Me = {
36185
- id: ye,
36213
+ Le = "paragraph-bookmark",
36214
+ $e = {
36215
+ id: Le,
36186
36216
  name: "Paragraph Bookmark Plugin",
36187
36217
  version: "0.1.0",
36188
36218
  provides: ["paragraph-bookmark"],
@@ -36190,10 +36220,10 @@ const Ce = {
36190
36220
  optional: [],
36191
36221
  defaultConfig: {}
36192
36222
  };
36193
- const Se = {
36223
+ const Te = {
36194
36224
  kind: "first-wins"
36195
36225
  };
36196
- function xe(t, e, a) {
36226
+ function De(t, e, a) {
36197
36227
  if (1 === e.length) return e[0].chapterId;
36198
36228
  switch (a.kind) {
36199
36229
  case "first-wins":
@@ -36212,7 +36242,7 @@ function xe(t, e, a) {
36212
36242
  return a.resolve(t, e);
36213
36243
  }
36214
36244
  }
36215
- let ke = class {
36245
+ let ze = class {
36216
36246
  constructor(t) {
36217
36247
  this._pages = t, this._byChapter = /* @__PURE__ */new Map(), this._byGlobalNumber = /* @__PURE__ */new Map();
36218
36248
  for (const e of t) {
@@ -36246,8 +36276,8 @@ let ke = class {
36246
36276
  return a ? this._pages.indexOf(a) : -1;
36247
36277
  }
36248
36278
  };
36249
- function Le(t, e = Se) {
36250
- const a = function (t, e = Se) {
36279
+ function Ge(t, e = Te) {
36280
+ const a = function (t, e = Te) {
36251
36281
  const a = /* @__PURE__ */new Map();
36252
36282
  for (const i of t.chapters) {
36253
36283
  const [t, e] = i.globalPageRange;
@@ -36257,7 +36287,7 @@ function Le(t, e = Se) {
36257
36287
  }
36258
36288
  }
36259
36289
  const s = /* @__PURE__ */new Map();
36260
- for (const [i, r] of a) s.set(i, xe(i, r, e));
36290
+ for (const [i, r] of a) s.set(i, De(i, r, e));
36261
36291
  return s;
36262
36292
  }(t, e),
36263
36293
  s = /* @__PURE__ */new Map();
@@ -36279,14 +36309,14 @@ function Le(t, e = Se) {
36279
36309
  localPageIndex: l
36280
36310
  });
36281
36311
  }
36282
- return new ke(r);
36312
+ return new ze(r);
36283
36313
  }
36284
- const $e = class t extends BasePlugin {
36314
+ const Oe = class t extends BasePlugin {
36285
36315
  constructor(t, e) {
36286
- super(t, e), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = Se, 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);
36316
+ super(t, e), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = Te, 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);
36287
36317
  }
36288
36318
  async initialize(t) {
36289
- if (this.config = t, this.passwordProvider = t.passwordProvider, this.overlapStrategy = t.overlapStrategy ?? Se, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened(t => {
36319
+ if (this.config = t, this.passwordProvider = t.passwordProvider, this.overlapStrategy = t.overlapStrategy ?? Te, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened(t => {
36290
36320
  this.isOwnedChapter(t.id) && (this.passwordAttempts.delete(t.id), this.updateStatus(t.id, "loaded"));
36291
36321
  }), this.documentManager.provides().onDocumentClosed(t => {
36292
36322
  this.isOwnedChapter(t) && this.updateStatus(t, "closed");
@@ -36334,7 +36364,7 @@ const $e = class t extends BasePlugin {
36334
36364
  i = new Set(e.chapters.map(t => t.chapterId));
36335
36365
  for (const t of s) i.has(t) || (this.closeChapter(t), this.chapterStatus.delete(t));
36336
36366
  for (const t of e.chapters) this.chapterStatus.has(t.chapterId) || this.chapterStatus.set(t.chapterId, "idle");
36337
- this.manifest = e, this.virtualPageMap = Le(e, this.overlapStrategy), this.manifestChange$.emit({
36367
+ this.manifest = e, this.virtualPageMap = Ge(e, this.overlapStrategy), this.manifestChange$.emit({
36338
36368
  manifest: e,
36339
36369
  map: this.virtualPageMap
36340
36370
  }), this.eagerPrefetchFromManifest();
@@ -36507,12 +36537,12 @@ const $e = class t extends BasePlugin {
36507
36537
  }));
36508
36538
  }
36509
36539
  };
36510
- $e.id = "chapter-manager";
36511
- let Te = $e;
36512
- const ze = {
36540
+ Oe.id = "chapter-manager";
36541
+ let Ae = Oe;
36542
+ const Ne = {
36513
36543
  kind: "first-wins"
36514
36544
  };
36515
- function De(t, e, a) {
36545
+ function Ve(t, e, a) {
36516
36546
  if (1 === e.length) return e[0].chapterId;
36517
36547
  switch (a.kind) {
36518
36548
  case "first-wins":
@@ -36531,7 +36561,7 @@ function De(t, e, a) {
36531
36561
  return a.resolve(t, e);
36532
36562
  }
36533
36563
  }
36534
- class Ge {
36564
+ class Ee {
36535
36565
  constructor(t) {
36536
36566
  this._pages = t, this._byChapter = /* @__PURE__ */new Map(), this._byGlobalNumber = /* @__PURE__ */new Map();
36537
36567
  for (const e of t) {
@@ -36565,8 +36595,8 @@ class Ge {
36565
36595
  return a ? this._pages.indexOf(a) : -1;
36566
36596
  }
36567
36597
  }
36568
- function Oe(t, e = ze) {
36569
- const a = function (t, e = ze) {
36598
+ function Re(t, e = Ne) {
36599
+ const a = function (t, e = Ne) {
36570
36600
  const a = /* @__PURE__ */new Map();
36571
36601
  for (const i of t.chapters) {
36572
36602
  const [t, e] = i.globalPageRange;
@@ -36576,7 +36606,7 @@ function Oe(t, e = ze) {
36576
36606
  }
36577
36607
  }
36578
36608
  const s = /* @__PURE__ */new Map();
36579
- for (const [i, r] of a) s.set(i, De(i, r, e));
36609
+ for (const [i, r] of a) s.set(i, Ve(i, r, e));
36580
36610
  return s;
36581
36611
  }(t, e),
36582
36612
  s = /* @__PURE__ */new Map();
@@ -36598,14 +36628,14 @@ function Oe(t, e = ze) {
36598
36628
  localPageIndex: l
36599
36629
  });
36600
36630
  }
36601
- return new Ge(r);
36631
+ return new Ee(r);
36602
36632
  }
36603
- const Ae = class t extends BasePlugin {
36633
+ const Fe = class t extends BasePlugin {
36604
36634
  constructor(t, e) {
36605
- super(t, e), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = ze, 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);
36635
+ super(t, e), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = Ne, 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);
36606
36636
  }
36607
36637
  async initialize(t) {
36608
- if (this.config = t, this.passwordProvider = t.passwordProvider, this.overlapStrategy = t.overlapStrategy ?? ze, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened(t => {
36638
+ if (this.config = t, this.passwordProvider = t.passwordProvider, this.overlapStrategy = t.overlapStrategy ?? Ne, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened(t => {
36609
36639
  this.isOwnedChapter(t.id) && (this.passwordAttempts.delete(t.id), this.updateStatus(t.id, "loaded"));
36610
36640
  }), this.documentManager.provides().onDocumentClosed(t => {
36611
36641
  this.isOwnedChapter(t) && this.updateStatus(t, "closed");
@@ -36653,7 +36683,7 @@ const Ae = class t extends BasePlugin {
36653
36683
  i = new Set(e.chapters.map(t => t.chapterId));
36654
36684
  for (const t of s) i.has(t) || (this.closeChapter(t), this.chapterStatus.delete(t));
36655
36685
  for (const t of e.chapters) this.chapterStatus.has(t.chapterId) || this.chapterStatus.set(t.chapterId, "idle");
36656
- this.manifest = e, this.virtualPageMap = Oe(e, this.overlapStrategy), this.manifestChange$.emit({
36686
+ this.manifest = e, this.virtualPageMap = Re(e, this.overlapStrategy), this.manifestChange$.emit({
36657
36687
  manifest: e,
36658
36688
  map: this.virtualPageMap
36659
36689
  }), this.eagerPrefetchFromManifest();
@@ -36826,9 +36856,9 @@ const Ae = class t extends BasePlugin {
36826
36856
  }));
36827
36857
  }
36828
36858
  };
36829
- Ae.id = "chapter-manager";
36830
- let Ne = Ae;
36831
- function Ve(t, e) {
36859
+ Fe.id = "chapter-manager";
36860
+ let Ue = Fe;
36861
+ function _e(t, e) {
36832
36862
  if (t === e) return true;
36833
36863
  if (t.totalHeight !== e.totalHeight || t.totalWidth !== e.totalWidth || t.pageGap !== e.pageGap || t.items.length !== e.items.length) return false;
36834
36864
  for (let a = 0; a < t.items.length; a++) {
@@ -36838,9 +36868,9 @@ function Ve(t, e) {
36838
36868
  }
36839
36869
  return true;
36840
36870
  }
36841
- const Ee = class extends BasePlugin {
36871
+ const qe = class extends BasePlugin {
36842
36872
  constructor(t, e) {
36843
- super(t, e), this.layoutChange$ = createBehaviorEmitter(void 0, Ve), 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(Ne.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
36873
+ super(t, e), this.layoutChange$ = createBehaviorEmitter(void 0, _e), 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(Ue.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
36844
36874
  }
36845
36875
  async initialize(t) {
36846
36876
  this.config = {
@@ -37097,9 +37127,9 @@ const Ee = class extends BasePlugin {
37097
37127
  a && this.scrollToIndex(a.globalPageIndex, e);
37098
37128
  }
37099
37129
  };
37100
- Ee.id = "chapter-scroll";
37101
- let Re = Ee;
37102
- function Fe(t) {
37130
+ qe.id = "chapter-scroll";
37131
+ let We = qe;
37132
+ function He(t) {
37103
37133
  if (0 === t.length) throw new Error("unionRects: empty rects");
37104
37134
  let e = 1 / 0,
37105
37135
  a = 1 / 0,
@@ -37117,14 +37147,14 @@ function Fe(t) {
37117
37147
  }
37118
37148
  };
37119
37149
  }
37120
- function Ue(t) {
37150
+ function Be(t) {
37121
37151
  const e = t[t.length - 1];
37122
37152
  return {
37123
37153
  x: e.origin.x + e.size.width,
37124
37154
  y: e.origin.y + e.size.height
37125
37155
  };
37126
37156
  }
37127
- function _e(t, e) {
37157
+ function je(t, e) {
37128
37158
  const a = t.origin.y,
37129
37159
  s = t.origin.y + t.size.height,
37130
37160
  i = e.origin.y,
@@ -37133,22 +37163,22 @@ function _e(t, e) {
37133
37163
  if (o <= 0) return 0;
37134
37164
  return Math.max(0, Math.min(s, r) - Math.max(a, i)) / o;
37135
37165
  }
37136
- function qe(t, e) {
37166
+ function Ze(t, e) {
37137
37167
  var a, s;
37138
37168
  if (t.chapterId !== e.chapterId || t.localPageIndex !== e.localPageIndex) return false;
37139
37169
  const i = (null == (a = t.rectsPdfCoord) ? void 0 : a.length) ? t.rectsPdfCoord : [t.rectPdfCoord],
37140
37170
  r = (null == (s = e.rectsPdfCoord) ? void 0 : s.length) ? e.rectsPdfCoord : [e.rectPdfCoord],
37141
- o = t.markerAnchor ?? Ue(i),
37142
- n = e.markerAnchor ?? Ue(r);
37171
+ o = t.markerAnchor ?? Be(i),
37172
+ n = e.markerAnchor ?? Be(r);
37143
37173
  if (Math.hypot(o.x - n.x, o.y - n.y) <= 6) return true;
37144
37174
  for (const h of i) for (const t of r) {
37145
- if (_e(h, t) < .5) continue;
37175
+ if (je(h, t) < .5) continue;
37146
37176
  const e = Math.max(h.origin.x, t.origin.x);
37147
37177
  if (Math.min(h.origin.x + h.size.width, t.origin.x + t.size.width) - e > .25 * Math.min(h.size.width, t.size.width)) return true;
37148
37178
  }
37149
37179
  return false;
37150
37180
  }
37151
- function We(t, e, a, s) {
37181
+ function Ye(t, e, a, s) {
37152
37182
  const i = a.length > 0 ? a : [];
37153
37183
  if (0 === i.length) throw new Error("buildParagraphBookmarkAnchor: no rects");
37154
37184
  return {
@@ -37156,12 +37186,12 @@ function We(t, e, a, s) {
37156
37186
  localPageIndex: e,
37157
37187
  globalPageIndex: null == s ? void 0 : s.globalPageIndex,
37158
37188
  globalPageNumber: null == s ? void 0 : s.globalPageNumber,
37159
- rectPdfCoord: Fe(i),
37189
+ rectPdfCoord: He(i),
37160
37190
  rectsPdfCoord: i,
37161
- markerAnchor: Ue(i)
37191
+ markerAnchor: Be(i)
37162
37192
  };
37163
37193
  }
37164
- async function He(t, e, a) {
37194
+ async function Xe(t, e, a) {
37165
37195
  t.scrollToGlobalPageIndex(e), await function (t, e, a = 2500) {
37166
37196
  const s = t.getLayout().items.find(t => t.globalPageIndex === e && !t.isPlaceholder);
37167
37197
  return s ? Promise.resolve(s) : new Promise(s => {
@@ -37177,9 +37207,9 @@ async function He(t, e, a) {
37177
37207
  marginTop: 80
37178
37208
  });
37179
37209
  }
37180
- const Be = class t extends BasePlugin {
37210
+ const Ke = class t extends BasePlugin {
37181
37211
  constructor(t, e) {
37182
- super(t, e), this.change$ = createBehaviorEmitter([]), this.entries = /* @__PURE__ */new Map(), this.chapterScroll = this.registry.getPlugin(Re.id), this.chapterManager = this.registry.getPlugin(Te.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
37212
+ super(t, e), this.change$ = createBehaviorEmitter([]), this.entries = /* @__PURE__ */new Map(), this.chapterScroll = this.registry.getPlugin(We.id), this.chapterManager = this.registry.getPlugin(Ae.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
37183
37213
  }
37184
37214
  async initialize(e) {
37185
37215
  var a;
@@ -37206,7 +37236,7 @@ const Be = class t extends BasePlugin {
37206
37236
  };
37207
37237
  }
37208
37238
  addBookmark(t) {
37209
- for (const s of this.entries.values()) if (qe(s.anchor, t.anchor)) return s;
37239
+ for (const s of this.entries.values()) if (Ze(s.anchor, t.anchor)) return s;
37210
37240
  const e = t.id ?? `bm-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
37211
37241
  a = {
37212
37242
  id: e,
@@ -37272,50 +37302,50 @@ const Be = class t extends BasePlugin {
37272
37302
  const e = t.rectPdfCoord;
37273
37303
  return e.origin.y + e.size.height;
37274
37304
  }(e.anchor);
37275
- await He(a, s, i);
37305
+ await Xe(a, s, i);
37276
37306
  }
37277
37307
  };
37278
- Be.id = "paragraph-bookmark";
37279
- let je = Be;
37280
- const Ze = {
37281
- manifest: Me,
37282
- create: t => new je(ye, t),
37308
+ Ke.id = "paragraph-bookmark";
37309
+ let Qe = Ke;
37310
+ const Je = {
37311
+ manifest: $e,
37312
+ create: t => new Qe(Le, t),
37283
37313
  reducer: t => t,
37284
37314
  initialState: {}
37285
37315
  };
37286
- function Ye({
37287
- item: e,
37288
- pdfPageWidth: a,
37316
+ function ta({
37317
+ item: t,
37318
+ pdfPageWidth: e,
37289
37319
  pdfPageHeight: o,
37290
37320
  cssPageWidth: l,
37291
- cssPageHeight: d$1,
37321
+ cssPageHeight: d,
37292
37322
  hoverUi: c
37293
37323
  }) {
37294
- const u = Jt(e),
37324
+ const u = ee(t),
37295
37325
  {
37296
37326
  provides: p
37297
37327
  } = useCapability(SelectionPlugin.id),
37298
37328
  {
37299
37329
  provides: g
37300
- } = useCapability(je.id),
37330
+ } = useCapability(Qe.id),
37301
37331
  f = A(null),
37302
- [w, I] = d(null),
37303
- [C, y$1] = d(null),
37304
- [M, S] = d(null),
37332
+ [w, I] = d$1(null),
37333
+ [C, y$1] = d$1(null),
37334
+ [M, S] = d$1(null),
37305
37335
  x = c?.iconSize ?? 16;
37306
37336
  y(() => {
37307
37337
  if (!p) return;
37308
- const t = p.forDocument(u),
37338
+ const e = p.forDocument(u),
37309
37339
  a = () => {
37310
- const a = t.getState().geometry[e.localPageIndex];
37340
+ const a = e.getState().geometry[t.localPageIndex];
37311
37341
  a && I(a);
37312
37342
  },
37313
- s = t.onSelectionChange(a);
37343
+ s = e.onSelectionChange(a);
37314
37344
  let i = false;
37315
37345
  const r = () => {
37316
37346
  if (!i) {
37317
37347
  try {
37318
- if (a(), t.getState().geometry[e.localPageIndex]) return;
37348
+ if (a(), e.getState().geometry[t.localPageIndex]) return;
37319
37349
  } catch {}
37320
37350
  requestAnimationFrame(r);
37321
37351
  }
@@ -37323,18 +37353,18 @@ function Ye({
37323
37353
  return r(), () => {
37324
37354
  i = true, s();
37325
37355
  };
37326
- }, [p, u, e.localPageIndex]);
37356
+ }, [p, u, t.localPageIndex]);
37327
37357
  const k = M ?? C;
37328
37358
  y(() => {
37329
- if (!w || !a) return;
37359
+ if (!w || !e) return;
37330
37360
  const t = t => {
37331
37361
  if (M) return;
37332
37362
  if (p) try {
37333
37363
  if (p.forDocument(u).getState().selecting) return void y$1(null);
37334
37364
  } catch {}
37335
- const e = f.current;
37336
- if (!e) return;
37337
- const s = e.getBoundingClientRect();
37365
+ const a = f.current;
37366
+ if (!a) return;
37367
+ const s = a.getBoundingClientRect();
37338
37368
  if (t.clientX < s.left || t.clientX > s.right || t.clientY < s.top || t.clientY > s.bottom) return void y$1(null);
37339
37369
  const i = function (t, e) {
37340
37370
  const a = glyphAt(t, e);
@@ -37348,18 +37378,18 @@ function Ye({
37348
37378
  charTo: s.to
37349
37379
  };
37350
37380
  }(w, {
37351
- x: (t.clientX - s.left) / (l / a),
37352
- y: (t.clientY - s.top) / (d$1 / o)
37381
+ x: (t.clientX - s.left) / (l / e),
37382
+ y: (t.clientY - s.top) / (d / o)
37353
37383
  });
37354
37384
  y$1(i?.lineRects ?? null);
37355
37385
  };
37356
37386
  return document.addEventListener("mousemove", t), () => document.removeEventListener("mousemove", t);
37357
- }, [w, a, o, l, d$1, p, u, M]);
37358
- const L = k?.length ? We(e.chapterId, e.localPageIndex, k, {
37359
- globalPageIndex: e.globalPageIndex,
37360
- globalPageNumber: e.globalPageNumber
37387
+ }, [w, e, o, l, d, p, u, M]);
37388
+ const L = k?.length ? Ye(t.chapterId, t.localPageIndex, k, {
37389
+ globalPageIndex: t.globalPageIndex,
37390
+ globalPageNumber: t.globalPageNumber
37361
37391
  }) : null,
37362
- $ = L && g?.listBookmarks().some(t => qe(t.anchor, L)),
37392
+ $ = L && g?.listBookmarks().some(t => Ze(t.anchor, L)),
37363
37393
  T = q$2(() => {
37364
37394
  g && L && !$ && (g.addBookmark({
37365
37395
  label: `书签 ${ /* @__PURE__ */new Date().toLocaleTimeString("zh-CN", {
@@ -37369,14 +37399,14 @@ function Ye({
37369
37399
  anchor: L
37370
37400
  }), y$1(null), S(null));
37371
37401
  }, [g, L, $]);
37372
- if (!g || !a || !o) return null;
37373
- const z = l / a,
37374
- D = d$1 / o,
37402
+ if (!g || !e || !o) return null;
37403
+ const D = l / e,
37404
+ z = d / o,
37375
37405
  G = k?.[k.length - 1],
37376
- O = G ? Math.min((G.origin.x + G.size.width) * z + 6, Math.max(0, l - x - 2)) : 0,
37377
- A$1 = G ? G.origin.y * D + (G.size.height * D - x) / 2 : 0,
37378
- N = G ? Math.max(0, (G.origin.x + G.size.width) * z - 4) : 0,
37379
- V = G ? Math.max(0, G.origin.y * D - 4) : 0;
37406
+ O = G ? Math.min((G.origin.x + G.size.width) * D + 6, Math.max(0, l - x - 2)) : 0,
37407
+ A$1 = G ? G.origin.y * z + (G.size.height * z - x) / 2 : 0,
37408
+ N = G ? Math.max(0, (G.origin.x + G.size.width) * D - 4) : 0,
37409
+ V = G ? Math.max(0, G.origin.y * z - 4) : 0;
37380
37410
  return u$1("div", {
37381
37411
  ref: f,
37382
37412
  style: {
@@ -37391,7 +37421,7 @@ function Ye({
37391
37421
  left: `${N}px`,
37392
37422
  top: `${V}px`,
37393
37423
  width: `${x + 20}px`,
37394
- height: `${G.size.height * D + x + 12}px`,
37424
+ height: `${G.size.height * z + x + 12}px`,
37395
37425
  pointerEvents: "auto"
37396
37426
  },
37397
37427
  onMouseEnter: () => S(k),
@@ -37448,12 +37478,7 @@ function Ye({
37448
37478
  })
37449
37479
  });
37450
37480
  }
37451
- const Xe = {
37452
- position: "relative",
37453
- height: "100%",
37454
- width: "100%"
37455
- },
37456
- Ke = {
37481
+ const ea = {
37457
37482
  highlight: {
37458
37483
  offsetY: 0
37459
37484
  },
@@ -37467,13 +37492,13 @@ const Xe = {
37467
37492
  offsetY: 0
37468
37493
  }
37469
37494
  },
37470
- Qe = {
37495
+ aa = {
37471
37496
  highlight: PdfAnnotationSubtype.HIGHLIGHT,
37472
37497
  underline: PdfAnnotationSubtype.UNDERLINE,
37473
37498
  squiggly: PdfAnnotationSubtype.SQUIGGLY,
37474
37499
  strikeout: PdfAnnotationSubtype.STRIKEOUT
37475
37500
  };
37476
- function Je(t, e) {
37501
+ function sa(t, e) {
37477
37502
  return 0 === e ? t : t.map(t => ({
37478
37503
  origin: {
37479
37504
  x: t.origin.x,
@@ -37484,7 +37509,7 @@ function Je(t, e) {
37484
37509
  }
37485
37510
  }));
37486
37511
  }
37487
- function ta(t) {
37512
+ function ia(t) {
37488
37513
  let e = 1 / 0,
37489
37514
  a = 1 / 0,
37490
37515
  s = -1 / 0,
@@ -37501,7 +37526,7 @@ function ta(t) {
37501
37526
  }
37502
37527
  };
37503
37528
  }
37504
- function ea(t, e, a, s, i) {
37529
+ function ra(t, e, a, s, i) {
37505
37530
  const r = a.forDocument(t),
37506
37531
  o = s.forDocument(t);
37507
37532
  if (!r || !o) return false;
@@ -37511,7 +37536,7 @@ function ea(t, e, a, s, i) {
37511
37536
  const l = h.defaults,
37512
37537
  d = function (t, e) {
37513
37538
  return {
37514
- ...Ke[t],
37539
+ ...ea[t],
37515
37540
  ...(null == e ? void 0 : e[t])
37516
37541
  };
37517
37542
  }(e, i),
@@ -37527,13 +37552,13 @@ function ea(t, e, a, s, i) {
37527
37552
  s = d.opacity ?? l.opacity,
37528
37553
  i = d.thickness ?? l.strokeWidth,
37529
37554
  o = d.offsetY ?? 0,
37530
- n = "underline" === e || "squiggly" === e || "strikeout" === e ? Je(u.segmentRects, o) : u.segmentRects,
37531
- h = "underline" === e || "squiggly" === e || "strikeout" === e ? ta(n) : u.rect;
37555
+ n = "underline" === e || "squiggly" === e || "strikeout" === e ? sa(u.segmentRects, o) : u.segmentRects,
37556
+ h = "underline" === e || "squiggly" === e || "strikeout" === e ? ia(n) : u.rect;
37532
37557
  r.createAnnotation(u.pageIndex, {
37533
37558
  id: t,
37534
37559
  created: /* @__PURE__ */new Date(),
37535
37560
  flags: ["print"],
37536
- type: Qe[e],
37561
+ type: aa[e],
37537
37562
  ...("highlight" === e ? {
37538
37563
  blendMode: PdfBlendMode.Multiply
37539
37564
  } : {}),
@@ -37549,7 +37574,7 @@ function ea(t, e, a, s, i) {
37549
37574
  }
37550
37575
  return o.clear(), true;
37551
37576
  }
37552
- function aa(t, e) {
37577
+ function oa(t, e) {
37553
37578
  const a = t;
37554
37579
  return false === t ? {
37555
37580
  ...e,
@@ -37563,53 +37588,53 @@ function aa(t, e) {
37563
37588
  enabled: false !== (null == a ? void 0 : a.enabled)
37564
37589
  };
37565
37590
  }
37566
- function sa(t) {
37567
- const e = aa(null == t ? void 0 : t.markup, {
37591
+ function na(t) {
37592
+ const e = oa(null == t ? void 0 : t.markup, {
37568
37593
  enabled: true
37569
37594
  }),
37570
- a = aa(null == t ? void 0 : t.bookmarks, {
37595
+ a = oa(null == t ? void 0 : t.bookmarks, {
37571
37596
  enabled: true
37572
37597
  }),
37573
- s = aa(null == t ? void 0 : t.notes, {
37598
+ s = oa(null == t ? void 0 : t.notes, {
37574
37599
  enabled: true
37575
37600
  });
37576
37601
  return {
37577
37602
  markup: e,
37578
37603
  bookmarks: a,
37579
37604
  notes: s,
37580
- zoom: aa(null == t ? void 0 : t.zoom, {
37605
+ zoom: oa(null == t ? void 0 : t.zoom, {
37581
37606
  enabled: true,
37582
37607
  min: .5,
37583
37608
  max: 3,
37584
37609
  initial: 1
37585
37610
  }),
37586
- selectionToolbar: aa(void 0 === (null == t ? void 0 : t.selectionToolbar) ? false !== e.enabled || false !== s.enabled : t.selectionToolbar, {
37611
+ selectionToolbar: oa(void 0 === (null == t ? void 0 : t.selectionToolbar) ? false !== e.enabled || false !== s.enabled : t.selectionToolbar, {
37587
37612
  enabled: true
37588
37613
  })
37589
37614
  };
37590
37615
  }
37591
- const ia = [{
37616
+ const ha = [{
37592
37617
  id: "highlight",
37593
37618
  label: "高亮背景",
37594
- icon: /* @__PURE__ */u$1(ha, {})
37619
+ icon: /* @__PURE__ */u$1(ua, {})
37595
37620
  }, {
37596
37621
  id: "underline",
37597
37622
  label: "下划线",
37598
- icon: /* @__PURE__ */u$1(la, {})
37623
+ icon: /* @__PURE__ */u$1(pa, {})
37599
37624
  }, {
37600
37625
  id: "squiggly",
37601
37626
  label: "波浪线",
37602
- icon: /* @__PURE__ */u$1(da, {})
37627
+ icon: /* @__PURE__ */u$1(ga, {})
37603
37628
  }, {
37604
37629
  id: "strikeout",
37605
37630
  label: "删除线",
37606
- icon: /* @__PURE__ */u$1(ca, {})
37631
+ icon: /* @__PURE__ */u$1(fa, {})
37607
37632
  }, {
37608
37633
  id: "note",
37609
37634
  label: "添加笔记",
37610
- icon: /* @__PURE__ */u$1(ua, {})
37635
+ icon: /* @__PURE__ */u$1(ma, {})
37611
37636
  }];
37612
- function ra({
37637
+ function la({
37613
37638
  placementAbove: s,
37614
37639
  anchorHeight: i,
37615
37640
  onAction: r,
@@ -37617,8 +37642,8 @@ function ra({
37617
37642
  extraActions: n = []
37618
37643
  }) {
37619
37644
  const h = new Set(o),
37620
- l = ia.filter(t => "note" !== t.id && !h.has(t.id)),
37621
- d = ia.find(t => "note" === t.id),
37645
+ l = ha.filter(t => "note" !== t.id && !h.has(t.id)),
37646
+ d = ha.find(t => "note" === t.id),
37622
37647
  c = d && !h.has("note"),
37623
37648
  u = [...n].sort((t, e) => (t.order ?? 0) - (e.order ?? 0));
37624
37649
  return u$1("div", {
@@ -37640,21 +37665,21 @@ function ra({
37640
37665
  },
37641
37666
  role: "toolbar",
37642
37667
  "aria-label": "选区工具",
37643
- children: [l.map(e => /* @__PURE__ */u$1(oa, {
37644
- label: e.label,
37645
- onClick: () => r(e.id),
37646
- children: e.icon
37647
- }, e.id)), u.map(e => /* @__PURE__ */u$1(oa, {
37648
- label: e.label,
37649
- onClick: () => r(e.id),
37668
+ children: [l.map(t => /* @__PURE__ */u$1(da, {
37669
+ label: t.label,
37670
+ onClick: () => r(t.id),
37671
+ children: t.icon
37672
+ }, t.id)), u.map(t => /* @__PURE__ */u$1(da, {
37673
+ label: t.label,
37674
+ onClick: () => r(t.id),
37650
37675
  children: /* @__PURE__ */u$1("span", {
37651
37676
  style: {
37652
37677
  fontSize: 11,
37653
37678
  fontWeight: 600
37654
37679
  },
37655
- children: e.label.slice(0, 2)
37680
+ children: t.label.slice(0, 2)
37656
37681
  })
37657
- }, e.id)), c && /* @__PURE__ */u$1(k$2, {
37682
+ }, t.id)), c && /* @__PURE__ */u$1(k$2, {
37658
37683
  children: [/* @__PURE__ */u$1("span", {
37659
37684
  style: {
37660
37685
  width: 1,
@@ -37664,7 +37689,7 @@ function ra({
37664
37689
  flexShrink: 0
37665
37690
  },
37666
37691
  "aria-hidden": true
37667
- }), /* @__PURE__ */u$1(oa, {
37692
+ }), /* @__PURE__ */u$1(da, {
37668
37693
  label: d.label,
37669
37694
  onClick: () => r("note"),
37670
37695
  accent: true,
@@ -37673,18 +37698,18 @@ function ra({
37673
37698
  })]
37674
37699
  });
37675
37700
  }
37676
- function oa({
37677
- label: e,
37678
- onClick: a,
37701
+ function da({
37702
+ label: t,
37703
+ onClick: e,
37679
37704
  accent: s,
37680
37705
  children: i
37681
37706
  }) {
37682
37707
 
37683
37708
  return u$1("button", {
37684
37709
  type: "button",
37685
- title: e,
37686
- "aria-label": e,
37687
- onClick: a,
37710
+ title: t,
37711
+ "aria-label": t,
37712
+ onClick: e,
37688
37713
  style: {
37689
37714
  display: "flex",
37690
37715
  alignItems: "center",
@@ -37707,8 +37732,8 @@ function oa({
37707
37732
  children: i
37708
37733
  });
37709
37734
  }
37710
- function na({
37711
- behind: a,
37735
+ function ca({
37736
+ behind: e,
37712
37737
  mark: s
37713
37738
  }) {
37714
37739
 
@@ -37718,7 +37743,7 @@ function na({
37718
37743
  viewBox: "0 0 28 28",
37719
37744
  fill: "none",
37720
37745
  "aria-hidden": true,
37721
- children: [a, /* @__PURE__ */u$1("text", {
37746
+ children: [e, /* @__PURE__ */u$1("text", {
37722
37747
  x: "14",
37723
37748
  y: "19",
37724
37749
  textAnchor: "middle",
@@ -37730,9 +37755,9 @@ function na({
37730
37755
  }), s]
37731
37756
  });
37732
37757
  }
37733
- function ha() {
37758
+ function ua() {
37734
37759
 
37735
- return u$1(na, {
37760
+ return u$1(ca, {
37736
37761
  behind: /* @__PURE__ */u$1("rect", {
37737
37762
  x: "5",
37738
37763
  y: "4",
@@ -37743,9 +37768,9 @@ function ha() {
37743
37768
  })
37744
37769
  });
37745
37770
  }
37746
- function la() {
37771
+ function pa() {
37747
37772
 
37748
- return u$1(na, {
37773
+ return u$1(ca, {
37749
37774
  mark: /* @__PURE__ */u$1("path", {
37750
37775
  d: "M6 22h16",
37751
37776
  stroke: "#dc2626",
@@ -37754,9 +37779,9 @@ function la() {
37754
37779
  })
37755
37780
  });
37756
37781
  }
37757
- function da() {
37782
+ function ga() {
37758
37783
 
37759
- return u$1(na, {
37784
+ return u$1(ca, {
37760
37785
  mark: /* @__PURE__ */u$1("path", {
37761
37786
  d: "M6 22c2-2 3-2 5 0s3 2 5 0 3-2 5 0",
37762
37787
  stroke: "#dc2626",
@@ -37766,9 +37791,9 @@ function da() {
37766
37791
  })
37767
37792
  });
37768
37793
  }
37769
- function ca() {
37794
+ function fa() {
37770
37795
 
37771
- return u$1(na, {
37796
+ return u$1(ca, {
37772
37797
  mark: /* @__PURE__ */u$1("path", {
37773
37798
  d: "M5 14h18",
37774
37799
  stroke: "#dc2626",
@@ -37777,7 +37802,7 @@ function ca() {
37777
37802
  })
37778
37803
  });
37779
37804
  }
37780
- function ua() {
37805
+ function ma() {
37781
37806
 
37782
37807
  return u$1("svg", {
37783
37808
  width: "20",
@@ -37803,16 +37828,16 @@ function ua() {
37803
37828
  })]
37804
37829
  });
37805
37830
  }
37806
- const pa = {
37831
+ const va = {
37807
37832
  highlight: "highlight",
37808
37833
  underline: "underline",
37809
37834
  squiggly: "squiggly",
37810
37835
  strikeout: "strikeout"
37811
37836
  };
37812
- function ga(e, a) {
37813
- const s = e?.selectionToolbar,
37814
- i = false !== e?.markup?.enabled,
37815
- r = false !== e?.notes?.enabled;
37837
+ function ba(t, e) {
37838
+ const s = t?.selectionToolbar,
37839
+ i = false !== t?.markup?.enabled,
37840
+ r = false !== t?.notes?.enabled;
37816
37841
  if (false === s?.enabled) return;
37817
37842
  if (!i && !r && !s?.extraActions?.length) return;
37818
37843
  const {
@@ -37823,20 +37848,20 @@ function ga(e, a) {
37823
37848
  } = useCapability(AnnotationPlugin.id),
37824
37849
  {
37825
37850
  provides: d
37826
- } = useCapability(we$1.id);
37851
+ } = useCapability(Se.id);
37827
37852
  return T$2(() => o => {
37828
- const h = Jt(o.item);
37853
+ const h = ee(o.item);
37829
37854
  return c => /* @__PURE__ */u$1("div", {
37830
37855
  ...c.menuWrapperProps,
37831
- children: /* @__PURE__ */u$1(ra, {
37856
+ children: /* @__PURE__ */u$1(la, {
37832
37857
  placementAbove: !!c.placement?.suggestTop,
37833
37858
  anchorHeight: c.rect.size.height,
37834
- onAction: t => {
37835
- if ("highlight" !== t && "underline" !== t && "squiggly" !== t && "strikeout" !== t) {
37836
- if ("note" === t) {
37859
+ onAction: a => {
37860
+ if ("highlight" !== a && "underline" !== a && "squiggly" !== a && "strikeout" !== a) {
37861
+ if ("note" === a) {
37837
37862
  if (!n || !d || !r) return;
37838
37863
  const t = n.getHighlightRectsForPage(o.item.localPageIndex, h);
37839
- return void te(n.getSelectedText(h), e => {
37864
+ return void ae(n.getSelectedText(h), e => {
37840
37865
  d.requestCreateFromSelection({
37841
37866
  chapterId: o.item.chapterId,
37842
37867
  localPageIndex: o.item.localPageIndex,
@@ -37847,21 +37872,21 @@ function ga(e, a) {
37847
37872
  });
37848
37873
  });
37849
37874
  }
37850
- a?.onExtraAction?.(t, o);
37875
+ e?.onExtraAction?.(a, o);
37851
37876
  } else {
37852
37877
  if (!n || !l || !i) return;
37853
- ea(h, pa[t], l, n, e?.markup?.styles);
37878
+ ra(h, va[a], l, n, t?.markup?.styles);
37854
37879
  }
37855
37880
  },
37856
37881
  hiddenBuiltinActions: s?.hiddenBuiltinActions,
37857
37882
  extraActions: s?.extraActions
37858
37883
  })
37859
37884
  });
37860
- }, [l, e?.markup?.styles, a?.onExtraAction, i, d, r, n, s?.extraActions, s?.hiddenBuiltinActions]);
37885
+ }, [l, t?.markup?.styles, e?.onExtraAction, i, d, r, n, s?.extraActions, s?.hiddenBuiltinActions]);
37861
37886
  }
37862
- const fa = "chapter-manager",
37863
- ma = {
37864
- id: fa,
37887
+ const Pa = "chapter-manager",
37888
+ wa = {
37889
+ id: Pa,
37865
37890
  name: "Chapter Manager Plugin",
37866
37891
  version: "0.1.0",
37867
37892
  provides: ["chapter-manager"],
@@ -37876,10 +37901,10 @@ const fa = "chapter-manager",
37876
37901
  autoActivateOnLoad: true
37877
37902
  }
37878
37903
  };
37879
- const va = {
37904
+ const Ia = {
37880
37905
  kind: "first-wins"
37881
37906
  };
37882
- function ba(t, e, a) {
37907
+ function Ca(t, e, a) {
37883
37908
  if (1 === e.length) return e[0].chapterId;
37884
37909
  switch (a.kind) {
37885
37910
  case "first-wins":
@@ -37898,7 +37923,7 @@ function ba(t, e, a) {
37898
37923
  return a.resolve(t, e);
37899
37924
  }
37900
37925
  }
37901
- let Pa = class {
37926
+ let ya = class {
37902
37927
  constructor(t) {
37903
37928
  this._pages = t, this._byChapter = /* @__PURE__ */new Map(), this._byGlobalNumber = /* @__PURE__ */new Map();
37904
37929
  for (const e of t) {
@@ -37932,8 +37957,8 @@ let Pa = class {
37932
37957
  return a ? this._pages.indexOf(a) : -1;
37933
37958
  }
37934
37959
  };
37935
- function wa(t, e = va) {
37936
- const a = function (t, e = va) {
37960
+ function Ma(t, e = Ia) {
37961
+ const a = function (t, e = Ia) {
37937
37962
  const a = /* @__PURE__ */new Map();
37938
37963
  for (const i of t.chapters) {
37939
37964
  const [t, e] = i.globalPageRange;
@@ -37943,7 +37968,7 @@ function wa(t, e = va) {
37943
37968
  }
37944
37969
  }
37945
37970
  const s = /* @__PURE__ */new Map();
37946
- for (const [i, r] of a) s.set(i, ba(i, r, e));
37971
+ for (const [i, r] of a) s.set(i, Ca(i, r, e));
37947
37972
  return s;
37948
37973
  }(t, e),
37949
37974
  s = /* @__PURE__ */new Map();
@@ -37965,14 +37990,14 @@ function wa(t, e = va) {
37965
37990
  localPageIndex: l
37966
37991
  });
37967
37992
  }
37968
- return new Pa(r);
37993
+ return new ya(r);
37969
37994
  }
37970
- const Ia = class t extends BasePlugin {
37995
+ const Sa = class t extends BasePlugin {
37971
37996
  constructor(t, e) {
37972
- super(t, e), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = va, this.chapterStatus = /* @__PURE__ */new Map(), this.chapterLastUsed = /* @__PURE__ */new Map(), this.passwordAttempts = /* @__PURE__ */new Map(), this.pendingLoadPromises = /* @__PURE__ */new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
37997
+ super(t, e), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = Ia, 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);
37973
37998
  }
37974
37999
  async initialize(t) {
37975
- if (this.config = t, this.passwordProvider = t.passwordProvider, this.overlapStrategy = t.overlapStrategy ?? va, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened(t => {
38000
+ if (this.config = t, this.passwordProvider = t.passwordProvider, this.overlapStrategy = t.overlapStrategy ?? Ia, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened(t => {
37976
38001
  this.isOwnedChapter(t.id) && (this.passwordAttempts.delete(t.id), this.updateStatus(t.id, "loaded"));
37977
38002
  }), this.documentManager.provides().onDocumentClosed(t => {
37978
38003
  this.isOwnedChapter(t) && this.updateStatus(t, "closed");
@@ -38020,7 +38045,7 @@ const Ia = class t extends BasePlugin {
38020
38045
  i = new Set(e.chapters.map(t => t.chapterId));
38021
38046
  for (const t of s) i.has(t) || (this.closeChapter(t), this.chapterStatus.delete(t));
38022
38047
  for (const t of e.chapters) this.chapterStatus.has(t.chapterId) || this.chapterStatus.set(t.chapterId, "idle");
38023
- this.manifest = e, this.virtualPageMap = wa(e, this.overlapStrategy), this.manifestChange$.emit({
38048
+ this.manifest = e, this.virtualPageMap = Ma(e, this.overlapStrategy), this.manifestChange$.emit({
38024
38049
  manifest: e,
38025
38050
  map: this.virtualPageMap
38026
38051
  }), this.eagerPrefetchFromManifest();
@@ -38193,18 +38218,18 @@ const Ia = class t extends BasePlugin {
38193
38218
  }));
38194
38219
  }
38195
38220
  };
38196
- Ia.id = "chapter-manager";
38197
- let Ca = Ia;
38198
- const ya = {
38199
- manifest: ma,
38200
- create: t => new Ca(fa, t),
38221
+ Sa.id = "chapter-manager";
38222
+ let xa = Sa;
38223
+ const ka = {
38224
+ manifest: wa,
38225
+ create: t => new xa(Pa, t),
38201
38226
  reducer: t => t,
38202
38227
  initialState: {}
38203
38228
  };
38204
- function Ma(t, e = .5, a = 3) {
38229
+ function La(t, e = .5, a = 3) {
38205
38230
  return Math.min(a, Math.max(e, t));
38206
38231
  }
38207
- function Sa(t, e) {
38232
+ function $a(t, e) {
38208
38233
  const {
38209
38234
  registry: a
38210
38235
  } = useRegistry(),
@@ -38212,20 +38237,20 @@ function Sa(t, e) {
38212
38237
  provides: o
38213
38238
  } = useCapability(DocumentManagerPlugin.id),
38214
38239
  {
38215
- provides: d$1
38216
- } = useCapability(Ca.id),
38240
+ provides: d
38241
+ } = useCapability(xa.id),
38217
38242
  c = false !== e?.enabled,
38218
38243
  u = e?.min ?? .5,
38219
38244
  p = e?.max ?? 3,
38220
38245
  g = e?.pageWidth,
38221
- [f, m] = d(() => e?.initial ?? 1),
38246
+ [f, m] = d$1(() => e?.initial ?? 1),
38222
38247
  v = A(f),
38223
38248
  b = q$2(e => {
38224
- const s = Ma(e, u, p);
38249
+ const s = La(e, u, p);
38225
38250
  v.current = s, m(s), function (t, e, a, s = .5, i = 3) {
38226
38251
  const r = t?.getStore();
38227
38252
  if (!r) return;
38228
- const o = Ma(a, s, i);
38253
+ const o = La(a, s, i);
38229
38254
  r.dispatchToCore(setDefaultScale(o));
38230
38255
  for (const n of e.chapters) r.getState().core.documents[n.chapterId] && r.dispatchToCore(setScale(o, n.chapterId));
38231
38256
  }(a, t, s, u, p);
@@ -38241,16 +38266,16 @@ function Sa(t, e) {
38241
38266
  return y(() => {
38242
38267
  a && (g || b(e?.initial ?? 1));
38243
38268
  }, [b, g, a, e?.initial]), y(() => {
38244
- if (!d$1) return;
38269
+ if (!d) return;
38245
38270
  const e = t => {
38246
38271
  g ? P(t) : b(v.current);
38247
38272
  },
38248
- a = d$1.onChapterStatusChange(t => {
38273
+ a = d.onChapterStatusChange(t => {
38249
38274
  "loaded" === t.status && e(t.chapterId);
38250
38275
  });
38251
- for (const s of t.chapters) "loaded" === d$1.getChapterStatus(s.chapterId) && e(s.chapterId);
38276
+ for (const s of t.chapters) "loaded" === d.getChapterStatus(s.chapterId) && e(s.chapterId);
38252
38277
  return a;
38253
- }, [P, b, d$1, t.chapters, g]), {
38278
+ }, [P, b, d, t.chapters, g]), {
38254
38279
  scale: f,
38255
38280
  setScale: b,
38256
38281
  zoomEnabled: c,
@@ -38258,10 +38283,10 @@ function Sa(t, e) {
38258
38283
  maxZoom: p
38259
38284
  };
38260
38285
  }
38261
- function xa(t, e, a) {
38286
+ function Ta(t, e, a) {
38262
38287
  return Math.min(a, Math.max(e, t));
38263
38288
  }
38264
- function ka(t, e) {
38289
+ function Da(t, e) {
38265
38290
  if (!t || false === e.enabled) return () => {};
38266
38291
  let a = null,
38267
38292
  s = null,
@@ -38281,7 +38306,7 @@ function ka(t, e) {
38281
38306
  h = 1,
38282
38307
  l = 1;
38283
38308
  const d = t => {
38284
- (t.ctrlKey || t.metaKey) && (t.preventDefault(), null === n ? (l = e(), h = 1) : clearTimeout(n), h *= 1 - .01 * t.deltaY, h = xa(h, .1, 10), a(xa(l * h, s, i)), n = setTimeout(() => {
38309
+ (t.ctrlKey || t.metaKey) && (t.preventDefault(), null === n ? (l = e(), h = 1) : clearTimeout(n), h *= 1 - .01 * t.deltaY, h = Ta(h, .1, 10), a(Ta(l * h, s, i)), n = setTimeout(() => {
38285
38310
  n = null;
38286
38311
  }, 120));
38287
38312
  },
@@ -38303,7 +38328,7 @@ function ka(t, e) {
38303
38328
  t.preventDefault();
38304
38329
  const [e, n] = [...c.values()],
38305
38330
  h = Math.hypot(n.x - e.x, n.y - e.y);
38306
- a(xa(o * (h / r), s, i));
38331
+ a(Ta(o * (h / r), s, i));
38307
38332
  }
38308
38333
  },
38309
38334
  g = t => {
@@ -38333,22 +38358,22 @@ function ka(t, e) {
38333
38358
  i && cancelAnimationFrame(i), s?.disconnect(), a?.();
38334
38359
  };
38335
38360
  }
38336
- const La = {
38361
+ const za = {
38337
38362
  chapters: []
38338
38363
  };
38339
- function $a(t) {
38364
+ function Ga(t) {
38340
38365
  const e = A(null),
38341
38366
  {
38342
38367
  provides: a
38343
- } = useCapability(Ca.id),
38344
- i = T$2(() => a?.getManifest() ?? La, [a]),
38368
+ } = useCapability(xa.id),
38369
+ i = T$2(() => a?.getManifest() ?? za, [a]),
38345
38370
  {
38346
38371
  scale: n,
38347
38372
  setScale: l,
38348
38373
  zoomEnabled: d,
38349
38374
  minZoom: c,
38350
38375
  maxZoom: u
38351
- } = Sa(i, t?.zoom);
38376
+ } = $a(i, t?.zoom);
38352
38377
  return function (t, e) {
38353
38378
  const {
38354
38379
  enabled: a,
@@ -38358,7 +38383,7 @@ function $a(t) {
38358
38383
  maxZoom: n
38359
38384
  } = e;
38360
38385
  y(() => {
38361
- if (a) return ka(t.current, {
38386
+ if (a) return Da(t.current, {
38362
38387
  enabled: true,
38363
38388
  getScale: s,
38364
38389
  setScale: i,
@@ -38379,7 +38404,7 @@ function $a(t) {
38379
38404
  zoomEnabled: d
38380
38405
  };
38381
38406
  }
38382
- function Ta({
38407
+ function Oa({
38383
38408
  className: s,
38384
38409
  buildSelectionMenu: i,
38385
38410
  annotationSelectionMenu: r,
@@ -38394,13 +38419,13 @@ function Ta({
38394
38419
  }) {
38395
38420
  const {
38396
38421
  hostRef: m
38397
- } = $a(p),
38422
+ } = Ga(p),
38398
38423
  v = function () {
38399
38424
  const {
38400
38425
  registry: t
38401
38426
  } = useRegistry();
38402
38427
  return T$2(() => {
38403
- const e = t?.getPlugin(we$1.id)?.provides?.();
38428
+ const e = t?.getPlugin(Se.id)?.provides?.();
38404
38429
  return e ? t => e.createNoteFromSelection(t) : null;
38405
38430
  }, [t]);
38406
38431
  }(),
@@ -38408,18 +38433,18 @@ function Ta({
38408
38433
  const {
38409
38434
  registry: t
38410
38435
  } = useRegistry();
38411
- return !!t?.getPlugin(we$1.id);
38436
+ return !!t?.getPlugin(Se.id);
38412
38437
  }(),
38413
38438
  P = function () {
38414
38439
  const {
38415
38440
  registry: t
38416
38441
  } = useRegistry();
38417
- return !!t?.getPlugin(je.id);
38442
+ return !!t?.getPlugin(Qe.id);
38418
38443
  }(),
38419
38444
  w = h && b && false !== p?.notes?.enabled,
38420
38445
  I = d && P && false !== p?.bookmarks?.enabled,
38421
38446
  C = P && false !== p?.bookmarks?.enabled,
38422
- y = ga(p, {
38447
+ y = ba(p, {
38423
38448
  onExtraAction: g
38424
38449
  }),
38425
38450
  M = T$2(() => {
@@ -38432,7 +38457,7 @@ function Ta({
38432
38457
  };
38433
38458
  }, [i, y]),
38434
38459
  S = T$2(() => u || C ? s => /* @__PURE__ */u$1(k$2, {
38435
- children: [C && /* @__PURE__ */u$1(za, {
38460
+ children: [C && /* @__PURE__ */u$1(Aa, {
38436
38461
  item: s,
38437
38462
  hoverUi: p?.bookmarks?.hover
38438
38463
  }), u?.(s)]
@@ -38440,10 +38465,10 @@ function Ta({
38440
38465
  return u$1("div", {
38441
38466
  ref: m,
38442
38467
  className: s,
38443
- style: s ? void 0 : Xe,
38444
- children: [/* @__PURE__ */u$1(lt$1, {
38445
- renderPage: e => /* @__PURE__ */u$1(Da, {
38446
- item: e,
38468
+ style: s ? void 0 : ie$1,
38469
+ children: [/* @__PURE__ */u$1(ct$1, {
38470
+ renderPage: t => /* @__PURE__ */u$1(Na, {
38471
+ item: t,
38447
38472
  showNoteMarkers: w,
38448
38473
  showBookmarkMarkers: I,
38449
38474
  noteMarkerUi: p?.notes?.marker,
@@ -38458,24 +38483,24 @@ function Ta({
38458
38483
  }), f]
38459
38484
  });
38460
38485
  }
38461
- function za({
38462
- item: e,
38463
- hoverUi: a
38486
+ function Aa({
38487
+ item: t,
38488
+ hoverUi: e
38464
38489
  }) {
38465
- const s = Jt(e),
38490
+ const s = ee(t),
38466
38491
  i = useDocumentState(s),
38467
- r = i?.document?.pages[e.localPageIndex] ?? null;
38468
- return r ? /* @__PURE__ */u$1(Ye, {
38469
- item: e,
38492
+ r = i?.document?.pages[t.localPageIndex] ?? null;
38493
+ return r ? /* @__PURE__ */u$1(ta, {
38494
+ item: t,
38470
38495
  pdfPageWidth: r.size.width,
38471
38496
  pdfPageHeight: r.size.height,
38472
- cssPageWidth: e.width,
38473
- cssPageHeight: e.height,
38474
- hoverUi: a
38497
+ cssPageWidth: t.width,
38498
+ cssPageHeight: t.height,
38499
+ hoverUi: e
38475
38500
  }) : null;
38476
38501
  }
38477
- function Da({
38478
- item: a,
38502
+ function Na({
38503
+ item: e,
38479
38504
  showNoteMarkers: s,
38480
38505
  showBookmarkMarkers: i,
38481
38506
  noteMarkerUi: n,
@@ -38487,7 +38512,7 @@ function Da({
38487
38512
  redactionSelectionMenu: b,
38488
38513
  showRedactionLayer: w = false
38489
38514
  }) {
38490
- const M = Jt(a);
38515
+ const M = ee(e);
38491
38516
  !function (t) {
38492
38517
  const {
38493
38518
  provides: e
@@ -38499,14 +38524,14 @@ function Da({
38499
38524
  const {
38500
38525
  provides: S
38501
38526
  } = useCapability(DocumentManagerPlugin.id),
38502
- x = S?.getDocument(M)?.pages[a.localPageIndex] ?? null,
38503
- k = function (e, a) {
38527
+ x = S?.getDocument(M)?.pages[e.localPageIndex] ?? null,
38528
+ k = function (t, e) {
38504
38529
  const {
38505
38530
  provides: s
38506
38531
  } = useCapability(SelectionPlugin.id),
38507
- i = Jt(e);
38532
+ i = ee(t);
38508
38533
  return T$2(() => {
38509
- if (a) return r => {
38534
+ if (e) return r => {
38510
38535
  const o = {
38511
38536
  position: "absolute",
38512
38537
  pointerEvents: "auto",
@@ -38522,11 +38547,11 @@ function Da({
38522
38547
  type: "button",
38523
38548
  onClick: () => {
38524
38549
  if (!s) return;
38525
- const t = s.getHighlightRectsForPage(e.localPageIndex, i);
38526
- te(s.getSelectedText(i), s => {
38550
+ const a = s.getHighlightRectsForPage(t.localPageIndex, i);
38551
+ ae(s.getSelectedText(i), s => {
38527
38552
  const i = s.join("\n"),
38528
- r = ee(e, t, i);
38529
- a(r);
38553
+ r = se$1(t, a, i);
38554
+ e(r);
38530
38555
  });
38531
38556
  },
38532
38557
  style: {
@@ -38543,10 +38568,10 @@ function Da({
38543
38568
  })
38544
38569
  });
38545
38570
  };
38546
- }, [a, i, e, s]);
38547
- }(a, c),
38571
+ }, [e, i, t, s]);
38572
+ }(e, c),
38548
38573
  L = void 0 !== m ? m({
38549
- item: a,
38574
+ item: e,
38550
38575
  defaultMenu: k,
38551
38576
  createNote: c
38552
38577
  }) : k;
@@ -38554,50 +38579,52 @@ function Da({
38554
38579
  documentId: M,
38555
38580
  children: /* @__PURE__ */u$1(Rotate, {
38556
38581
  documentId: M,
38557
- pageIndex: a.localPageIndex,
38582
+ pageIndex: e.localPageIndex,
38558
38583
  style: {
38559
38584
  backgroundColor: "#fff"
38560
38585
  },
38561
38586
  children: /* @__PURE__ */u$1(PagePointerProvider, {
38562
38587
  documentId: M,
38563
- pageIndex: a.localPageIndex,
38564
- children: [/* @__PURE__ */u$1(dt$1, {
38588
+ pageIndex: e.localPageIndex,
38589
+ style: re$1,
38590
+ onPointerDown: oe$1,
38591
+ children: [/* @__PURE__ */u$1(ut, {
38565
38592
  chapterId: M,
38566
- localPageIndex: a.localPageIndex
38593
+ localPageIndex: e.localPageIndex
38567
38594
  }), /* @__PURE__ */u$1(SelectionLayer, {
38568
38595
  documentId: M,
38569
- pageIndex: a.localPageIndex,
38596
+ pageIndex: e.localPageIndex,
38570
38597
  selectionMenu: L
38571
38598
  }), w && /* @__PURE__ */u$1(RedactionLayer, {
38572
38599
  documentId: M,
38573
- pageIndex: a.localPageIndex,
38600
+ pageIndex: e.localPageIndex,
38574
38601
  selectionMenu: b
38575
38602
  }), /* @__PURE__ */u$1(AnnotationLayer, {
38576
38603
  documentId: M,
38577
- pageIndex: a.localPageIndex,
38604
+ pageIndex: e.localPageIndex,
38578
38605
  selectionMenu: v
38579
- }), i && x && /* @__PURE__ */u$1(Qt, {
38606
+ }), i && x && /* @__PURE__ */u$1(te, {
38580
38607
  chapterId: M,
38581
- localPageIndex: a.localPageIndex,
38608
+ localPageIndex: e.localPageIndex,
38582
38609
  pdfPageWidth: x.size.width,
38583
38610
  pdfPageHeight: x.size.height,
38584
- cssPageWidth: a.width,
38585
- cssPageHeight: a.height,
38611
+ cssPageWidth: e.width,
38612
+ cssPageHeight: e.height,
38586
38613
  ui: l
38587
- }), d?.(a), s && x && /* @__PURE__ */u$1($t$1, {
38614
+ }), d?.(e), s && x && /* @__PURE__ */u$1(Dt$1, {
38588
38615
  chapterId: M,
38589
- localPageIndex: a.localPageIndex,
38616
+ localPageIndex: e.localPageIndex,
38590
38617
  pdfPageWidth: x.size.width,
38591
38618
  pdfPageHeight: x.size.height,
38592
- cssPageWidth: a.width,
38593
- cssPageHeight: a.height,
38619
+ cssPageWidth: e.width,
38620
+ cssPageHeight: e.height,
38594
38621
  ui: n
38595
38622
  })]
38596
38623
  })
38597
38624
  })
38598
38625
  });
38599
38626
  }
38600
- class Ga {
38627
+ class Ea {
38601
38628
  constructor(t) {
38602
38629
  this.cb = t;
38603
38630
  }
@@ -38605,9 +38632,9 @@ class Ga {
38605
38632
  return this.cb(t, e);
38606
38633
  }
38607
38634
  }
38608
- const Oa = "chapter-scroll",
38609
- Aa = {
38610
- id: Oa,
38635
+ const Wa = "chapter-scroll",
38636
+ Ha = {
38637
+ id: Wa,
38611
38638
  name: "Chapter Scroll Plugin",
38612
38639
  version: "0.1.0",
38613
38640
  provides: ["chapter-scroll"],
@@ -38620,10 +38647,10 @@ const Oa = "chapter-scroll",
38620
38647
  pageGap: 20
38621
38648
  }
38622
38649
  };
38623
- const Na = {
38650
+ const Ba = {
38624
38651
  kind: "first-wins"
38625
38652
  };
38626
- function Va(t, e, a) {
38653
+ function ja(t, e, a) {
38627
38654
  if (1 === e.length) return e[0].chapterId;
38628
38655
  switch (a.kind) {
38629
38656
  case "first-wins":
@@ -38642,7 +38669,7 @@ function Va(t, e, a) {
38642
38669
  return a.resolve(t, e);
38643
38670
  }
38644
38671
  }
38645
- class Ea {
38672
+ class Za {
38646
38673
  constructor(t) {
38647
38674
  this._pages = t, this._byChapter = /* @__PURE__ */new Map(), this._byGlobalNumber = /* @__PURE__ */new Map();
38648
38675
  for (const e of t) {
@@ -38676,8 +38703,8 @@ class Ea {
38676
38703
  return a ? this._pages.indexOf(a) : -1;
38677
38704
  }
38678
38705
  }
38679
- function Ra(t, e = Na) {
38680
- const a = function (t, e = Na) {
38706
+ function Ya(t, e = Ba) {
38707
+ const a = function (t, e = Ba) {
38681
38708
  const a = /* @__PURE__ */new Map();
38682
38709
  for (const i of t.chapters) {
38683
38710
  const [t, e] = i.globalPageRange;
@@ -38687,7 +38714,7 @@ function Ra(t, e = Na) {
38687
38714
  }
38688
38715
  }
38689
38716
  const s = /* @__PURE__ */new Map();
38690
- for (const [i, r] of a) s.set(i, Va(i, r, e));
38717
+ for (const [i, r] of a) s.set(i, ja(i, r, e));
38691
38718
  return s;
38692
38719
  }(t, e),
38693
38720
  s = /* @__PURE__ */new Map();
@@ -38709,14 +38736,14 @@ function Ra(t, e = Na) {
38709
38736
  localPageIndex: l
38710
38737
  });
38711
38738
  }
38712
- return new Ea(r);
38739
+ return new Za(r);
38713
38740
  }
38714
- const Fa = class t extends BasePlugin {
38741
+ const Xa = class t extends BasePlugin {
38715
38742
  constructor(t, e) {
38716
- super(t, e), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = Na, this.chapterStatus = /* @__PURE__ */new Map(), this.chapterLastUsed = /* @__PURE__ */new Map(), this.passwordAttempts = /* @__PURE__ */new Map(), this.pendingLoadPromises = /* @__PURE__ */new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
38743
+ super(t, e), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = Ba, 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);
38717
38744
  }
38718
38745
  async initialize(t) {
38719
- if (this.config = t, this.passwordProvider = t.passwordProvider, this.overlapStrategy = t.overlapStrategy ?? Na, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened(t => {
38746
+ if (this.config = t, this.passwordProvider = t.passwordProvider, this.overlapStrategy = t.overlapStrategy ?? Ba, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened(t => {
38720
38747
  this.isOwnedChapter(t.id) && (this.passwordAttempts.delete(t.id), this.updateStatus(t.id, "loaded"));
38721
38748
  }), this.documentManager.provides().onDocumentClosed(t => {
38722
38749
  this.isOwnedChapter(t) && this.updateStatus(t, "closed");
@@ -38764,7 +38791,7 @@ const Fa = class t extends BasePlugin {
38764
38791
  i = new Set(e.chapters.map(t => t.chapterId));
38765
38792
  for (const t of s) i.has(t) || (this.closeChapter(t), this.chapterStatus.delete(t));
38766
38793
  for (const t of e.chapters) this.chapterStatus.has(t.chapterId) || this.chapterStatus.set(t.chapterId, "idle");
38767
- this.manifest = e, this.virtualPageMap = Ra(e, this.overlapStrategy), this.manifestChange$.emit({
38794
+ this.manifest = e, this.virtualPageMap = Ya(e, this.overlapStrategy), this.manifestChange$.emit({
38768
38795
  manifest: e,
38769
38796
  map: this.virtualPageMap
38770
38797
  }), this.eagerPrefetchFromManifest();
@@ -38937,9 +38964,9 @@ const Fa = class t extends BasePlugin {
38937
38964
  }));
38938
38965
  }
38939
38966
  };
38940
- Fa.id = "chapter-manager";
38941
- let Ua = Fa;
38942
- function _a(t, e) {
38967
+ Xa.id = "chapter-manager";
38968
+ let Ka = Xa;
38969
+ function Qa(t, e) {
38943
38970
  if (t === e) return true;
38944
38971
  if (t.totalHeight !== e.totalHeight || t.totalWidth !== e.totalWidth || t.pageGap !== e.pageGap || t.items.length !== e.items.length) return false;
38945
38972
  for (let a = 0; a < t.items.length; a++) {
@@ -38949,9 +38976,9 @@ function _a(t, e) {
38949
38976
  }
38950
38977
  return true;
38951
38978
  }
38952
- const qa = class extends BasePlugin {
38979
+ const Ja = class extends BasePlugin {
38953
38980
  constructor(t, e) {
38954
- super(t, e), this.layoutChange$ = createBehaviorEmitter(void 0, _a), 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(Ua.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
38981
+ super(t, e), this.layoutChange$ = createBehaviorEmitter(void 0, Qa), 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(Ka.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
38955
38982
  }
38956
38983
  async initialize(t) {
38957
38984
  this.config = {
@@ -39208,15 +39235,15 @@ const qa = class extends BasePlugin {
39208
39235
  a && this.scrollToIndex(a.globalPageIndex, e);
39209
39236
  }
39210
39237
  };
39211
- qa.id = "chapter-scroll";
39212
- let Wa = qa;
39213
- const Ha = {
39214
- manifest: Aa,
39215
- create: t => new Wa(Oa, t),
39238
+ Ja.id = "chapter-scroll";
39239
+ let ts = Ja;
39240
+ const es = {
39241
+ manifest: Ha,
39242
+ create: t => new ts(Wa, t),
39216
39243
  reducer: t => t,
39217
39244
  initialState: {}
39218
39245
  },
39219
- Ba = {
39246
+ as = {
39220
39247
  "annotation-toolbar": {
39221
39248
  id: "annotation-toolbar",
39222
39249
  position: {
@@ -39713,7 +39740,7 @@ const Ha = {
39713
39740
  }]
39714
39741
  }
39715
39742
  };
39716
- class ja {
39743
+ class ss {
39717
39744
  constructor() {
39718
39745
  this.specs = [];
39719
39746
  }
@@ -39728,7 +39755,7 @@ class ja {
39728
39755
  return this.specs;
39729
39756
  }
39730
39757
  buildToolbars() {
39731
- const t = structuredClone(Ba);
39758
+ const t = structuredClone(as);
39732
39759
  for (const e of this.specs) {
39733
39760
  const a = t[e.toolbarSlot];
39734
39761
  if (!a) continue;
@@ -39748,12 +39775,12 @@ class ja {
39748
39775
  } : {}),
39749
39776
  categories: e.categories ?? []
39750
39777
  };
39751
- a.items = Za(a.items, s, e.position);
39778
+ a.items = is(a.items, s, e.position);
39752
39779
  }
39753
39780
  return t;
39754
39781
  }
39755
39782
  }
39756
- function Za(t, e, a) {
39783
+ function is(t, e, a) {
39757
39784
  return (null == a ? void 0 : a.after) || (null == a ? void 0 : a.before) ? function (t, e, a) {
39758
39785
  const s = t => {
39759
39786
  const i = [];
@@ -39771,14 +39798,14 @@ function Za(t, e, a) {
39771
39798
  } : t);
39772
39799
  }(t, e);
39773
39800
  }
39774
- const Ya = {
39801
+ const rs = {
39775
39802
  annotate: "annotation-toolbar",
39776
39803
  shapes: "shapes-toolbar",
39777
39804
  insert: "insert-toolbar",
39778
39805
  form: "form-toolbar",
39779
39806
  redact: "redaction-toolbar"
39780
39807
  };
39781
- function Xa() {
39808
+ function os() {
39782
39809
  return {
39783
39810
  "mode:view": {
39784
39811
  id: "mode:view",
@@ -39895,7 +39922,7 @@ function Xa() {
39895
39922
  }
39896
39923
  };
39897
39924
  }
39898
- function Ka(t) {
39925
+ function ns(t) {
39899
39926
  const e = t.toolbar ?? {},
39900
39927
  a = e.enabledModes ?? ["view", "annotate", "shapes", "insert", "form", "redact"],
39901
39928
  s = a.length > 0,
@@ -39905,13 +39932,13 @@ function Ka(t) {
39905
39932
  } = function (t = {}) {
39906
39933
  var e, a, s, i, r, o;
39907
39934
  const n = new Set(t.enabledModes ?? ["view", "annotate", "shapes", "insert", "form", "redact"]),
39908
- h = new ja();
39935
+ h = new ss();
39909
39936
  (null == (e = t.customOperations) ? void 0 : e.length) && h.registerAll(t.customOperations);
39910
39937
  const l = h.buildToolbars(),
39911
39938
  d = {};
39912
39939
  for (const u of n) {
39913
39940
  if ("view" === u) continue;
39914
- const t = Ya[u];
39941
+ const t = rs[u];
39915
39942
  l[t] && (d[t] = l[t]);
39916
39943
  }
39917
39944
  const c = function (t) {
@@ -39966,20 +39993,20 @@ function Ka(t) {
39966
39993
  enabledModes: a
39967
39994
  }),
39968
39995
  o = {
39969
- ...(s ? Xa() : {}),
39970
- ...(s ? Qa(r.list()) : {}),
39996
+ ...(s ? os() : {}),
39997
+ ...(s ? hs(r.list()) : {}),
39971
39998
  ...(t.commands ?? {})
39972
39999
  },
39973
40000
  n = [createPluginRegistration(DocumentManagerPluginPackage, {
39974
40001
  initialDocuments: []
39975
- }), createPluginRegistration(ya, {
40002
+ }), createPluginRegistration(ka, {
39976
40003
  manifest: t.manifest,
39977
40004
  overlapStrategy: t.overlapStrategy,
39978
40005
  passwordProvider: t.passwordProvider,
39979
40006
  chapterPdfLoader: t.chapterPdfLoader,
39980
40007
  prefetchChapters: t.prefetchChapters,
39981
40008
  unloadTimeoutMs: t.unloadTimeoutMs
39982
- }), createPluginRegistration(Ha, {
40009
+ }), createPluginRegistration(es, {
39983
40010
  placeholderPageHeight: t.placeholderPageHeight,
39984
40011
  placeholderPageWidth: t.placeholderPageWidth
39985
40012
  }), createPluginRegistration(InteractionManagerPluginPackage), createPluginRegistration(RenderPluginPackage), createPluginRegistration(RotatePluginPackage), createPluginRegistration(SelectionPluginPackage, {
@@ -39995,10 +40022,10 @@ function Ka(t) {
39995
40022
  })] : []), ...(s ? [createPluginRegistration(I18nPluginPackage), createPluginRegistration(UIPluginPackage, {
39996
40023
  schema: i
39997
40024
  })] : [])];
39998
- return t.notes && n.push(createPluginRegistration(Ce, {
40025
+ return t.notes && n.push(createPluginRegistration(ke, {
39999
40026
  callbacks: t.notes.callbacks,
40000
40027
  ui: t.features?.notes?.marker
40001
- })), t.bookmarks && n.push(createPluginRegistration(Ze, {
40028
+ })), t.bookmarks && n.push(createPluginRegistration(Je, {
40002
40029
  callbacks: t.bookmarks.callbacks,
40003
40030
  ui: t.features?.bookmarks?.marker,
40004
40031
  hover: t.features?.bookmarks?.hover
@@ -40008,7 +40035,7 @@ function Ka(t) {
40008
40035
  operationRegistry: r
40009
40036
  };
40010
40037
  }
40011
- function Qa(t) {
40038
+ function hs(t) {
40012
40039
  const e = {};
40013
40040
  for (const a of t) a.handler && (e[a.commandId] = {
40014
40041
  id: a.commandId,
@@ -40027,22 +40054,22 @@ function Qa(t) {
40027
40054
  });
40028
40055
  return e;
40029
40056
  }
40030
- const Ja = sa(),
40031
- ts = {};
40032
- function es(t) {
40033
- return Ka({
40057
+ const ls = na(),
40058
+ ds = {};
40059
+ function cs(t) {
40060
+ return ns({
40034
40061
  ...t,
40035
40062
  toolbar: t.toolbar ?? {
40036
40063
  enabledModes: []
40037
40064
  },
40038
- features: sa(t.features)
40065
+ features: na(t.features)
40039
40066
  });
40040
40067
  }
40041
- const as = {
40068
+ const us = {
40042
40069
  overlapStrategy: {
40043
40070
  kind: "first-wins"
40044
40071
  },
40045
- passwordProvider: new Ga(async () => null),
40072
+ passwordProvider: new Ea(async () => null),
40046
40073
  prefetchChapters: 1,
40047
40074
  loadDefaultStampLibrary: false,
40048
40075
  unloadTimeoutMs: 12e4,
@@ -40050,7 +40077,7 @@ const as = {
40050
40077
  enabledModes: []
40051
40078
  }
40052
40079
  };
40053
- function ss(t) {
40080
+ function ps(t) {
40054
40081
  return function (t) {
40055
40082
  return "callbacks" in t.notes;
40056
40083
  }(t) ? {
@@ -40060,39 +40087,40 @@ function ss(t) {
40060
40087
  bookmarks: t.bookmarks.callbacks
40061
40088
  } : t;
40062
40089
  }
40063
- function is(t) {
40090
+ function gs(t) {
40064
40091
  return {
40092
+ ...us,
40065
40093
  manifest: t.manifest,
40066
40094
  chapterPdfLoader: t.chapterPdfLoader,
40067
- ...as,
40095
+ overlapStrategy: t.overlapStrategy ?? us.overlapStrategy,
40068
40096
  notes: {
40069
40097
  callbacks: t.notes
40070
40098
  },
40071
40099
  bookmarks: {
40072
40100
  callbacks: t.bookmarks
40073
40101
  },
40074
- features: sa(t.features)
40102
+ features: na(t.features)
40075
40103
  };
40076
40104
  }
40077
- function rs(t) {
40078
- const e = is(ss(t)),
40105
+ function fs(t) {
40106
+ const e = gs(ps(t)),
40079
40107
  {
40080
40108
  plugins: a
40081
- } = es(e);
40109
+ } = cs(e);
40082
40110
  return {
40083
40111
  plugins: a,
40084
40112
  features: e.features,
40085
40113
  editorOptions: e
40086
40114
  };
40087
40115
  }
40088
- function os(t) {
40116
+ function ms(t) {
40089
40117
  const {
40090
40118
  features: e,
40091
40119
  ...a
40092
- } = is(ss(t));
40120
+ } = gs(ps(t));
40093
40121
  return a;
40094
40122
  }
40095
- const ns = {
40123
+ const vs = {
40096
40124
  display: "flex",
40097
40125
  height: "100%",
40098
40126
  minHeight: "120px",
@@ -40101,65 +40129,65 @@ const ns = {
40101
40129
  fontSize: "14px",
40102
40130
  color: "#64748b"
40103
40131
  };
40104
- function hs({
40105
- chapterId: a,
40132
+ function bs({
40133
+ chapterId: e,
40106
40134
  chapterManager: s,
40107
40135
  loadTimeoutMs: o,
40108
40136
  onLoadTimeout: n,
40109
40137
  children: l,
40110
- ...d$1
40138
+ ...d
40111
40139
  }) {
40112
40140
  const {
40113
40141
  provides: c
40114
- } = useCapability(Ca.id),
40142
+ } = useCapability(xa.id),
40115
40143
  u = s ?? c,
40116
- [p, g] = d(false),
40117
- [f, m] = d(null);
40144
+ [p, g] = d$1(false),
40145
+ [f, m] = d$1(null);
40118
40146
  return y(() => {
40119
- if (!u || !a) return;
40147
+ if (!u || !e) return;
40120
40148
  let t = false,
40121
- e = null;
40149
+ a = null;
40122
40150
  const s = () => {
40123
- e && (clearTimeout(e), e = null);
40151
+ a && (clearTimeout(a), a = null);
40124
40152
  },
40125
40153
  i = t => "loaded" === t ? (s(), g(true), m(null), true) : "error" === t && (s(), m("首章 PDF 加载失败,请确认 public 下存在对应 PDF 文件"), true);
40126
- if (i(u.getChapterStatus(a))) return;
40127
- o && o > 0 && (e = setTimeout(() => {
40154
+ if (i(u.getChapterStatus(e))) return;
40155
+ o && o > 0 && (a = setTimeout(() => {
40128
40156
  if (t) return;
40129
- const e = n?.(a);
40130
- e || m(`首章 PDF 加载超时:${a}`);
40157
+ const a = n?.(e);
40158
+ a || m(`首章 PDF 加载超时:${e}`);
40131
40159
  }, o));
40132
- const r = u.onChapterStatusChange(e => {
40133
- t || e.chapterId !== a || i(e.status);
40160
+ const r = u.onChapterStatusChange(a => {
40161
+ t || a.chapterId !== e || i(a.status);
40134
40162
  });
40135
- return u.ensureChapterLoaded(a).then(e => {
40163
+ return u.ensureChapterLoaded(e).then(e => {
40136
40164
  t || i(e);
40137
40165
  }), () => {
40138
40166
  t = true, s(), r();
40139
40167
  };
40140
- }, [u, a, o, n]), f ? /* @__PURE__ */u$1("div", {
40141
- style: ns,
40168
+ }, [u, e, o, n]), f ? /* @__PURE__ */u$1("div", {
40169
+ style: vs,
40142
40170
  children: f
40143
- }) : u ? p ? /* @__PURE__ */u$1(Ta, {
40144
- ...d$1,
40171
+ }) : u ? p ? /* @__PURE__ */u$1(Oa, {
40172
+ ...d,
40145
40173
  children: l
40146
40174
  }) : /* @__PURE__ */u$1("div", {
40147
- style: ns,
40148
- children: ["正在加载 ", a, ".pdf…"]
40175
+ style: vs,
40176
+ children: ["正在加载 ", e, ".pdf…"]
40149
40177
  }) : /* @__PURE__ */u$1("div", {
40150
- style: ns,
40178
+ style: vs,
40151
40179
  children: "正在初始化章节管理器…"
40152
40180
  });
40153
40181
  }
40154
- function ls({
40155
- engine: e,
40156
- options: a,
40182
+ function Ps({
40183
+ engine: t,
40184
+ options: e,
40157
40185
  editorOptions: s,
40158
40186
  features: r,
40159
40187
  className: n,
40160
40188
  viewportClassName: h,
40161
40189
  buildSelectionMenu: l,
40162
- onExtraSelectionAction: d$1,
40190
+ onExtraSelectionAction: d,
40163
40191
  renderPageOverlay: u,
40164
40192
  onRegistryReady: p,
40165
40193
  firstChapterGateId: g,
@@ -40171,12 +40199,12 @@ function ls({
40171
40199
  plugins: b,
40172
40200
  features: P
40173
40201
  } = T$2(() => function (t) {
40174
- if (t.options) return rs(t.options);
40202
+ if (t.options) return fs(t.options);
40175
40203
  if (!t.editorOptions) throw new Error("ChapterPdfViewer: 请传入 `options`(推荐),或同时传入 `editorOptions` 与 `features`");
40176
- const e = sa(t.features),
40204
+ const e = na(t.features),
40177
40205
  {
40178
40206
  plugins: a
40179
- } = es({
40207
+ } = cs({
40180
40208
  ...t.editorOptions,
40181
40209
  features: e
40182
40210
  });
@@ -40189,47 +40217,100 @@ function ls({
40189
40217
  }
40190
40218
  };
40191
40219
  }({
40192
- options: a,
40220
+ options: e,
40193
40221
  editorOptions: s,
40194
40222
  features: r
40195
- }), [s, r, a]),
40196
- [w, I] = d(null);
40223
+ }), [s, r, e]),
40224
+ [w, I] = d$1(null);
40197
40225
  return u$1("div", {
40198
40226
  className: n,
40199
- style: n ? void 0 : Xe,
40227
+ style: n ? void 0 : ie$1,
40200
40228
  children: /* @__PURE__ */u$1(EmbedPDF, {
40201
- engine: e,
40229
+ engine: t,
40202
40230
  plugins: b,
40203
40231
  onInitialized: async t => {
40204
40232
  I(t), p?.(t);
40205
40233
  },
40206
40234
  children: ({
40207
- pluginsReady: e
40235
+ pluginsReady: t
40208
40236
  }) => {
40209
- if (!e) return null;
40210
- const a = {
40237
+ if (!t) return null;
40238
+ const e = {
40211
40239
  className: h,
40212
40240
  features: P,
40213
40241
  buildSelectionMenu: l,
40214
- onExtraSelectionAction: d$1,
40242
+ onExtraSelectionAction: d,
40215
40243
  renderPageOverlay: u,
40216
40244
  children: v
40217
40245
  },
40218
- s = w?.getPlugin(Ca.id)?.provides() ?? null;
40219
- return g ? /* @__PURE__ */u$1(hs, {
40246
+ s = w?.getPlugin(xa.id)?.provides() ?? null;
40247
+ return g ? /* @__PURE__ */u$1(bs, {
40220
40248
  chapterId: g,
40221
40249
  chapterManager: s,
40222
40250
  loadTimeoutMs: f,
40223
40251
  onLoadTimeout: m,
40224
- ...a
40225
- }) : /* @__PURE__ */u$1(Ta, {
40226
- ...a
40252
+ ...e
40253
+ }) : /* @__PURE__ */u$1(Oa, {
40254
+ ...e
40227
40255
  });
40228
40256
  }
40229
40257
  })
40230
40258
  });
40231
40259
  }
40232
40260
 
40261
+ ({
40262
+ highlight: PdfAnnotationSubtype.HIGHLIGHT,
40263
+ underline: PdfAnnotationSubtype.UNDERLINE,
40264
+ squiggly: PdfAnnotationSubtype.SQUIGGLY,
40265
+ strikeout: PdfAnnotationSubtype.STRIKEOUT
40266
+ });
40267
+ function featureOn(value, defaults) {
40268
+ const partial = value;
40269
+ if (value === false) return {
40270
+ ...defaults,
40271
+ enabled: false
40272
+ };
40273
+ if (value === true || value === void 0) {
40274
+ return {
40275
+ ...defaults,
40276
+ enabled: defaults.enabled ?? true
40277
+ };
40278
+ }
40279
+ return {
40280
+ ...defaults,
40281
+ ...partial,
40282
+ enabled: (partial == null ? void 0 : partial.enabled) !== false
40283
+ };
40284
+ }
40285
+ function normalizeChapterViewerConfig(config) {
40286
+ const markup = featureOn(config == null ? void 0 : config.markup, {
40287
+ enabled: true
40288
+ });
40289
+ const bookmarks = featureOn(config == null ? void 0 : config.bookmarks, {
40290
+ enabled: true
40291
+ });
40292
+ const notes = featureOn(config == null ? void 0 : config.notes, {
40293
+ enabled: true
40294
+ });
40295
+ const zoom = featureOn(config == null ? void 0 : config.zoom, {
40296
+ enabled: true,
40297
+ min: 0.5,
40298
+ max: 3,
40299
+ initial: 1
40300
+ });
40301
+ const selectionToolbarDefault = (config == null ? void 0 : config.selectionToolbar) === void 0 ? markup.enabled !== false || notes.enabled !== false : config.selectionToolbar;
40302
+ const selectionToolbar = featureOn(selectionToolbarDefault, {
40303
+ enabled: true
40304
+ });
40305
+ return {
40306
+ markup,
40307
+ bookmarks,
40308
+ notes,
40309
+ zoom,
40310
+ selectionToolbar
40311
+ };
40312
+ }
40313
+
40233
40314
  var CHAPTER_SNIPPET_EVENTS = {
40234
40315
  noteRequestCreate: 'chapter-note-request-create',
40235
40316
  noteRequestEdit: 'chapter-note-request-edit',
@@ -40244,39 +40325,50 @@ function dispatch(host, name, detail) {
40244
40325
  composed: true
40245
40326
  }));
40246
40327
  }
40328
+ function isLegacyEditorInput(input) {
40329
+ return 'callbacks' in input.notes;
40330
+ }
40331
+ function getNoteCallbacks(input) {
40332
+ return isLegacyEditorInput(input) ? input.notes.callbacks : input.notes;
40333
+ }
40334
+ function getBookmarkCallbacks(input) {
40335
+ return isLegacyEditorInput(input) ? input.bookmarks.callbacks : input.bookmarks;
40336
+ }
40247
40337
  /**
40248
- * 将宿主传入的 editorInput 转为 editor-engine 选项,并把笔记/书签回调桥接为 CustomEvent。
40338
+ * 将宿主传入的 options/editorInput 转为 editor-engine 选项,并把笔记/书签回调桥接为 CustomEvent。
40249
40339
  */
40250
40340
  function buildEditorOptionsWithEvents(input, eventHost) {
40251
- var base = os(input);
40252
- var noteCallbacks = _objectSpread2(_objectSpread2({}, input.notes.callbacks), {}, {
40341
+ var base = ms(input);
40342
+ var sourceNoteCallbacks = getNoteCallbacks(input);
40343
+ var sourceBookmarkCallbacks = getBookmarkCallbacks(input);
40344
+ var noteCallbacks = _objectSpread2(_objectSpread2({}, sourceNoteCallbacks), {}, {
40253
40345
  onRequestCreateNote: function onRequestCreateNote(payload) {
40254
- var _input$notes$callback, _input$notes$callback2;
40346
+ var _sourceNoteCallbacks$;
40255
40347
  dispatch(eventHost, CHAPTER_SNIPPET_EVENTS.noteRequestCreate, payload);
40256
- void ((_input$notes$callback = (_input$notes$callback2 = input.notes.callbacks).onRequestCreateNote) === null || _input$notes$callback === void 0 ? void 0 : _input$notes$callback.call(_input$notes$callback2, payload));
40348
+ void ((_sourceNoteCallbacks$ = sourceNoteCallbacks.onRequestCreateNote) === null || _sourceNoteCallbacks$ === void 0 ? void 0 : _sourceNoteCallbacks$.call(sourceNoteCallbacks, payload));
40257
40349
  },
40258
40350
  onRequestEditNote: function onRequestEditNote(noteId, anchor) {
40259
- var _input$notes$callback3, _input$notes$callback4;
40351
+ var _sourceNoteCallbacks$2;
40260
40352
  dispatch(eventHost, CHAPTER_SNIPPET_EVENTS.noteRequestEdit, {
40261
40353
  noteId: noteId,
40262
40354
  anchor: anchor
40263
40355
  });
40264
- (_input$notes$callback3 = (_input$notes$callback4 = input.notes.callbacks).onRequestEditNote) === null || _input$notes$callback3 === void 0 || _input$notes$callback3.call(_input$notes$callback4, noteId, anchor);
40356
+ (_sourceNoteCallbacks$2 = sourceNoteCallbacks.onRequestEditNote) === null || _sourceNoteCallbacks$2 === void 0 || _sourceNoteCallbacks$2.call(sourceNoteCallbacks, noteId, anchor);
40265
40357
  },
40266
- onDeleteNote: input.notes.callbacks.onDeleteNote,
40267
- onUpdateNote: input.notes.callbacks.onUpdateNote,
40268
- loadNotes: input.notes.callbacks.loadNotes
40358
+ onDeleteNote: sourceNoteCallbacks.onDeleteNote,
40359
+ onUpdateNote: sourceNoteCallbacks.onUpdateNote,
40360
+ loadNotes: sourceNoteCallbacks.loadNotes
40269
40361
  });
40270
- var bookmarkCallbacks = _objectSpread2(_objectSpread2({}, input.bookmarks.callbacks), {}, {
40362
+ var bookmarkCallbacks = _objectSpread2(_objectSpread2({}, sourceBookmarkCallbacks), {}, {
40271
40363
  onRequestRemove: function () {
40272
40364
  var _onRequestRemove = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(bookmark) {
40273
- var _input$bookmarks$call, _input$bookmarks$call2;
40365
+ var _sourceBookmarkCallba;
40274
40366
  var result;
40275
40367
  return _regenerator().w(function (_context) {
40276
40368
  while (1) switch (_context.n) {
40277
40369
  case 0:
40278
40370
  _context.n = 1;
40279
- return (_input$bookmarks$call = (_input$bookmarks$call2 = input.bookmarks.callbacks).onRequestRemove) === null || _input$bookmarks$call === void 0 ? void 0 : _input$bookmarks$call.call(_input$bookmarks$call2, bookmark);
40371
+ return (_sourceBookmarkCallba = sourceBookmarkCallbacks.onRequestRemove) === null || _sourceBookmarkCallba === void 0 ? void 0 : _sourceBookmarkCallba.call(sourceBookmarkCallbacks, bookmark);
40280
40372
  case 1:
40281
40373
  result = _context.v;
40282
40374
  return _context.a(2, result !== null && result !== void 0 ? result : false);
@@ -40288,9 +40380,9 @@ function buildEditorOptionsWithEvents(input, eventHost) {
40288
40380
  }
40289
40381
  return onRequestRemove;
40290
40382
  }(),
40291
- onRemoveSuccess: input.bookmarks.callbacks.onRemoveSuccess,
40292
- load: input.bookmarks.callbacks.load,
40293
- persist: input.bookmarks.callbacks.persist
40383
+ onRemoveSuccess: sourceBookmarkCallbacks.onRemoveSuccess,
40384
+ load: sourceBookmarkCallbacks.load,
40385
+ persist: sourceBookmarkCallbacks.persist
40294
40386
  });
40295
40387
  return _objectSpread2(_objectSpread2({}, base), {}, {
40296
40388
  notes: {
@@ -40309,7 +40401,7 @@ function dispatchViewerReady(host, registry) {
40309
40401
 
40310
40402
  var DEFAULT_SNIPPET_WASM_URL = new URL('./pdfium.wasm', import.meta.url).href;
40311
40403
  function ChapterApp(_ref) {
40312
- var _config$wasmUrl, _config$worker, _config$fallbackToDir, _config$workerOpenTim, _config$editorInput$m;
40404
+ var _config$wasmUrl, _config$worker, _config$fallbackToDir, _config$workerOpenTim, _config$options, _editorInput$manifest;
40313
40405
  var config = _ref.config,
40314
40406
  eventHost = _ref.eventHost,
40315
40407
  onRegistryReady = _ref.onRegistryReady;
@@ -40317,7 +40409,8 @@ function ChapterApp(_ref) {
40317
40409
  var requestedWorker = (_config$worker = config.worker) !== null && _config$worker !== void 0 ? _config$worker : true;
40318
40410
  var fallbackToDirectEngine = (_config$fallbackToDir = config.fallbackToDirectEngine) !== null && _config$fallbackToDir !== void 0 ? _config$fallbackToDir : true;
40319
40411
  var workerOpenTimeoutMs = (_config$workerOpenTim = config.workerOpenTimeoutMs) !== null && _config$workerOpenTim !== void 0 ? _config$workerOpenTim : 8000;
40320
- var _useState = d(requestedWorker),
40412
+ var editorInput = (_config$options = config.options) !== null && _config$options !== void 0 ? _config$options : config.editorInput;
40413
+ var _useState = d$1(requestedWorker),
40321
40414
  _useState2 = _slicedToArray(_useState, 2),
40322
40415
  effectiveWorker = _useState2[0],
40323
40416
  setEffectiveWorker = _useState2[1];
@@ -40332,12 +40425,12 @@ function ChapterApp(_ref) {
40332
40425
  isLoading = _usePdfiumEngine.isLoading,
40333
40426
  error = _usePdfiumEngine.error;
40334
40427
  var features = T$2(function () {
40335
- return _objectSpread2(_objectSpread2({}, Ja), config.features);
40336
- }, [config.features]);
40428
+ return _objectSpread2(_objectSpread2(_objectSpread2({}, ls), editorInput && 'features' in editorInput ? normalizeChapterViewerConfig(editorInput.features) : undefined), config.features);
40429
+ }, [config.features, editorInput]);
40337
40430
  var editorOptions = T$2(function () {
40338
- return buildEditorOptionsWithEvents(config.editorInput, eventHost);
40339
- }, [config.editorInput, eventHost]);
40340
- var firstChapterId = (_config$editorInput$m = config.editorInput.manifest.chapters[0]) === null || _config$editorInput$m === void 0 ? void 0 : _config$editorInput$m.chapterId;
40431
+ return editorInput ? buildEditorOptionsWithEvents(editorInput, eventHost) : null;
40432
+ }, [editorInput, eventHost]);
40433
+ var firstChapterId = editorInput === null || editorInput === void 0 || (_editorInput$manifest = editorInput.manifest.chapters[0]) === null || _editorInput$manifest === void 0 ? void 0 : _editorInput$manifest.chapterId;
40341
40434
  var firstChapterLoadTimeoutMs = effectiveWorker && fallbackToDirectEngine ? workerOpenTimeoutMs : 0;
40342
40435
  var handleFirstChapterLoadTimeout = q$2(function () {
40343
40436
  if (!effectiveWorker || !fallbackToDirectEngine) return false;
@@ -40371,13 +40464,27 @@ function ChapterApp(_ref) {
40371
40464
  children: "\u6B63\u5728\u52A0\u8F7D PDFium\u2026"
40372
40465
  });
40373
40466
  }
40467
+ if (!editorInput || !editorOptions) {
40468
+ return u$1("div", {
40469
+ style: {
40470
+ display: 'flex',
40471
+ height: '100%',
40472
+ alignItems: 'center',
40473
+ justifyContent: 'center',
40474
+ padding: '16px',
40475
+ fontSize: '14px',
40476
+ color: '#64748b'
40477
+ },
40478
+ children: "\u7F3A\u5C11\u7AE0\u8282\u9605\u8BFB\u5668\u914D\u7F6E\uFF1A\u8BF7\u4F20\u5165 options\u3002"
40479
+ });
40480
+ }
40374
40481
  return u$1("div", {
40375
40482
  style: {
40376
40483
  width: '100%',
40377
40484
  height: '100%',
40378
40485
  minHeight: 0
40379
40486
  },
40380
- children: u$1(ls, {
40487
+ children: u$1(Ps, {
40381
40488
  engine: engine,
40382
40489
  editorOptions: editorOptions,
40383
40490
  features: features,
@@ -40495,60 +40602,10 @@ var EmbedPdfChapterContainer = /*#__PURE__*/function (_BaseElement) {
40495
40602
  }]);
40496
40603
  }(BaseElement);
40497
40604
 
40498
- ({
40499
- highlight: PdfAnnotationSubtype.HIGHLIGHT,
40500
- underline: PdfAnnotationSubtype.UNDERLINE,
40501
- squiggly: PdfAnnotationSubtype.SQUIGGLY,
40502
- strikeout: PdfAnnotationSubtype.STRIKEOUT
40503
- });
40504
- function featureOn(value, defaults) {
40505
- const partial = value;
40506
- if (value === false) return {
40507
- ...defaults,
40508
- enabled: false
40509
- };
40510
- if (value === true || value === void 0) {
40511
- return {
40512
- ...defaults,
40513
- enabled: defaults.enabled ?? true
40514
- };
40515
- }
40516
- return {
40517
- ...defaults,
40518
- ...partial,
40519
- enabled: (partial == null ? void 0 : partial.enabled) !== false
40520
- };
40521
- }
40522
- function normalizeChapterViewerConfig(config) {
40523
- const markup = featureOn(config == null ? void 0 : config.markup, {
40524
- enabled: true
40525
- });
40526
- const bookmarks = featureOn(config == null ? void 0 : config.bookmarks, {
40527
- enabled: true
40528
- });
40529
- const notes = featureOn(config == null ? void 0 : config.notes, {
40530
- enabled: true
40531
- });
40532
- const zoom = featureOn(config == null ? void 0 : config.zoom, {
40533
- enabled: true,
40534
- min: 0.5,
40535
- max: 3,
40536
- initial: 1
40537
- });
40538
- const selectionToolbarDefault = (config == null ? void 0 : config.selectionToolbar) === void 0 ? markup.enabled !== false || notes.enabled !== false : config.selectionToolbar;
40539
- const selectionToolbar = featureOn(selectionToolbarDefault, {
40540
- enabled: true
40541
- });
40542
- return {
40543
- markup,
40544
- bookmarks,
40545
- notes,
40546
- zoom,
40547
- selectionToolbar
40548
- };
40549
- }
40550
-
40551
- class l {
40605
+ const t$1 = {
40606
+ kind: "first-wins"
40607
+ };
40608
+ class c {
40552
40609
  constructor(e) {
40553
40610
  this.cb = e;
40554
40611
  }
@@ -40556,54 +40613,100 @@ class l {
40556
40613
  return this.cb(e, t);
40557
40614
  }
40558
40615
  }
40616
+ function i(e) {
40617
+ return "last" === e ? {
40618
+ kind: "last-wins"
40619
+ } : {
40620
+ kind: "first-wins"
40621
+ };
40622
+ }
40623
+ function h(e) {
40624
+ const t = e.endPage - e.startPage + 1;
40625
+ return {
40626
+ chapterId: e.chapterId,
40627
+ title: e.title,
40628
+ globalPageRange: [e.startPage, e.endPage],
40629
+ localPageRange: [0, t - 1],
40630
+ ...(e.source ? {
40631
+ source: e.source
40632
+ } : {}),
40633
+ ...(e.encrypted ? {
40634
+ encrypted: e.encrypted
40635
+ } : {})
40636
+ };
40637
+ }
40638
+ function p(e) {
40639
+ const t = [],
40640
+ n = e => {
40641
+ for (const r of e) t.push(h(r)), r.children?.length && n(r.children);
40642
+ };
40643
+ return n(e), t;
40644
+ }
40645
+ function g(e) {
40646
+ return e.map(e => ({
40647
+ id: e.chapterId,
40648
+ title: e.title,
40649
+ startPage: e.startPage,
40650
+ endPage: e.endPage,
40651
+ children: e.children?.length ? g(e.children) : void 0
40652
+ }));
40653
+ }
40654
+ function d(e) {
40655
+ return {
40656
+ tree: g(e),
40657
+ manifest: {
40658
+ chapters: p(e)
40659
+ }
40660
+ };
40661
+ }
40559
40662
 
40560
40663
  function e(e2) {
40561
40664
  const t2 = [],
40562
- s2 = /* @__PURE__ */new Set();
40563
- for (const a2 of e2.chapters) {
40564
- s2.has(a2.chapterId) && t2.push(`Duplicate chapterId: ${a2.chapterId}`), s2.add(a2.chapterId);
40565
- const [e3, n2] = a2.globalPageRange,
40566
- [r2, o] = a2.localPageRange;
40567
- if (e3 > n2 && t2.push(`${a2.chapterId}: invalid globalPageRange [${e3},${n2}]`), r2 > o && t2.push(`${a2.chapterId}: invalid localPageRange [${r2},${o}]`), n2 - e3 !== o - r2 && t2.push(`${a2.chapterId}: page-count mismatch (global ${n2 - e3 + 1} vs local ${o - r2 + 1})`), a2.ownedGlobalPages) for (const s3 of a2.ownedGlobalPages) (s3 < e3 || s3 > n2) && t2.push(`${a2.chapterId}: ownedGlobalPages contains ${s3} outside range`);
40665
+ n2 = /* @__PURE__ */new Set();
40666
+ for (const r2 of e2.chapters) {
40667
+ n2.has(r2.chapterId) && t2.push(`Duplicate chapterId: ${r2.chapterId}`), n2.add(r2.chapterId);
40668
+ const [e3, s2] = r2.globalPageRange,
40669
+ [a2, o] = r2.localPageRange;
40670
+ if (e3 > s2 && t2.push(`${r2.chapterId}: invalid globalPageRange [${e3},${s2}]`), a2 > o && t2.push(`${r2.chapterId}: invalid localPageRange [${a2},${o}]`), s2 - e3 !== o - a2 && t2.push(`${r2.chapterId}: page-count mismatch (global ${s2 - e3 + 1} vs local ${o - a2 + 1})`), r2.ownedGlobalPages) for (const n3 of r2.ownedGlobalPages) (n3 < e3 || n3 > s2) && t2.push(`${r2.chapterId}: ownedGlobalPages contains ${n3} outside range`);
40568
40671
  }
40569
40672
  return t2;
40570
40673
  }
40571
40674
  const t = {
40572
40675
  kind: "first-wins"
40573
40676
  };
40574
- function s(e2, s2 = t) {
40575
- const n2 = /* @__PURE__ */new Map();
40677
+ function n(e2, n2 = t) {
40678
+ const s2 = /* @__PURE__ */new Map();
40576
40679
  for (const t2 of e2.chapters) {
40577
- const [e3, s3] = t2.globalPageRange;
40578
- for (let a2 = e3; a2 <= s3; a2++) {
40579
- const e4 = n2.get(a2);
40580
- e4 ? e4.push(t2) : n2.set(a2, [t2]);
40680
+ const [e3, n3] = t2.globalPageRange;
40681
+ for (let r2 = e3; r2 <= n3; r2++) {
40682
+ const e4 = s2.get(r2);
40683
+ e4 ? e4.push(t2) : s2.set(r2, [t2]);
40581
40684
  }
40582
40685
  }
40583
- const r2 = /* @__PURE__ */new Map();
40584
- for (const [t2, o] of n2) r2.set(t2, a(t2, o, s2));
40585
- return r2;
40686
+ const a2 = /* @__PURE__ */new Map();
40687
+ for (const [t2, o] of s2) a2.set(t2, r(t2, o, n2));
40688
+ return a2;
40586
40689
  }
40587
- function a(e2, t2, s2) {
40690
+ function r(e2, t2, n2) {
40588
40691
  if (1 === t2.length) return t2[0].chapterId;
40589
- switch (s2.kind) {
40692
+ switch (n2.kind) {
40590
40693
  case "first-wins":
40591
40694
  return t2[0].chapterId;
40592
40695
  case "last-wins":
40593
40696
  return t2[t2.length - 1].chapterId;
40594
40697
  case "explicit":
40595
40698
  {
40596
- const s3 = t2.find(t3 => {
40699
+ const n3 = t2.find(t3 => {
40597
40700
  var _a;
40598
40701
  return (_a = t3.ownedGlobalPages) == null ? void 0 : _a.includes(e2);
40599
40702
  });
40600
- return s3 ? s3.chapterId : t2[0].chapterId;
40703
+ return n3 ? n3.chapterId : t2[0].chapterId;
40601
40704
  }
40602
40705
  case "custom":
40603
- return s2.resolve(e2, t2);
40706
+ return n2.resolve(e2, t2);
40604
40707
  }
40605
40708
  }
40606
- class n {
40709
+ class s {
40607
40710
  constructor(e2) {
40608
40711
  this._pages = e2, this._byChapter = /* @__PURE__ */new Map(), this._byGlobalNumber = /* @__PURE__ */new Map();
40609
40712
  for (const t2 of e2) {
@@ -40625,8 +40728,8 @@ class n {
40625
40728
  return this._byGlobalNumber.get(e2) ?? null;
40626
40729
  }
40627
40730
  toGlobal(e2, t2) {
40628
- const s2 = this._byChapter.get(e2);
40629
- return s2 ? s2.find(e3 => e3.localPageIndex === t2) ?? null : null;
40731
+ const n2 = this._byChapter.get(e2);
40732
+ return n2 ? n2.find(e3 => e3.localPageIndex === t2) ?? null : null;
40630
40733
  }
40631
40734
  pagesOfChapter(e2) {
40632
40735
  return this._byChapter.get(e2) ?? [];
@@ -40637,28 +40740,28 @@ class n {
40637
40740
  return t2 ? this._pages.indexOf(t2) : -1;
40638
40741
  }
40639
40742
  }
40640
- function r(e2, a2 = t) {
40641
- const r2 = s(e2, a2),
40743
+ function a(e2, r2 = t) {
40744
+ const a2 = n(e2, r2),
40642
40745
  o = /* @__PURE__ */new Map();
40643
40746
  for (const t2 of e2.chapters) o.set(t2.chapterId, t2);
40644
- const l = Array.from(r2.keys()).sort((e3, t2) => e3 - t2),
40645
- c = [];
40646
- let h = 0;
40647
- for (const t2 of l) {
40648
- const e3 = r2.get(t2),
40649
- s2 = o.get(e3);
40650
- if (!s2) continue;
40651
- const [a3] = s2.globalPageRange,
40652
- [n2] = s2.localPageRange,
40653
- l2 = n2 + (t2 - a3);
40654
- c.push({
40655
- globalPageIndex: h++,
40747
+ const c = Array.from(a2.keys()).sort((e3, t2) => e3 - t2),
40748
+ l = [];
40749
+ let i = 0;
40750
+ for (const t2 of c) {
40751
+ const e3 = a2.get(t2),
40752
+ n2 = o.get(e3);
40753
+ if (!n2) continue;
40754
+ const [r3] = n2.globalPageRange,
40755
+ [s2] = n2.localPageRange,
40756
+ c2 = s2 + (t2 - r3);
40757
+ l.push({
40758
+ globalPageIndex: i++,
40656
40759
  globalPageNumber: t2,
40657
40760
  chapterId: e3,
40658
- localPageIndex: l2
40761
+ localPageIndex: c2
40659
40762
  });
40660
40763
  }
40661
- return new n(c);
40764
+ return new s(l);
40662
40765
  }
40663
40766
  const _ChapterManagerPlugin = class _ChapterManagerPlugin extends BasePlugin {
40664
40767
  constructor(id, registry) {
@@ -40740,7 +40843,7 @@ const _ChapterManagerPlugin = class _ChapterManagerPlugin extends BasePlugin {
40740
40843
  }
40741
40844
  }
40742
40845
  this.manifest = manifest2;
40743
- this.virtualPageMap = r(manifest2, this.overlapStrategy);
40846
+ this.virtualPageMap = a(manifest2, this.overlapStrategy);
40744
40847
  this.manifestChange$.emit({
40745
40848
  manifest: manifest2,
40746
40849
  map: this.virtualPageMap
@@ -44258,10 +44361,10 @@ var chapterSnippetRuntime = {
44258
44361
  version: version,
44259
44362
  EmbedPdfChapterContainer: EmbedPdfChapterContainer,
44260
44363
  CHAPTER_SNIPPET_EVENTS: CHAPTER_SNIPPET_EVENTS,
44261
- createChapterViewerEditorOptions: os,
44262
- DEFAULT_CHAPTER_VIEWER_FEATURES: Ja,
44263
- applySelectionMarkup: ea,
44264
- buildParagraphBookmarkAnchor: We
44364
+ createChapterViewerEditorOptions: ms,
44365
+ DEFAULT_CHAPTER_VIEWER_FEATURES: ls,
44366
+ applySelectionMarkup: ra,
44367
+ buildParagraphBookmarkAnchor: Ye
44265
44368
  };
44266
44369
  if (typeof globalThis !== 'undefined') {
44267
44370
  globalThis.__CHAPTER_SNIPPET__ = chapterSnippetRuntime;
@@ -60720,5 +60823,5 @@ var directEngine = /*#__PURE__*/Object.freeze({
60720
60823
  createPdfiumEngine: createPdfiumEngine
60721
60824
  });
60722
60825
 
60723
- export { se as CHAPTER_ANNOTATIONS_ARCHIVE_VERSION, CHAPTER_SNIPPET_EVENTS, l as CallbackPasswordProvider, ChapterManagerPlugin, ts as DEFAULT_CHAPTER_VIEWER_CONFIG, Ja as DEFAULT_CHAPTER_VIEWER_FEATURES, EmbedPdfChapterContainer, ea as applySelectionMarkup, We as buildParagraphBookmarkAnchor, ge as chapterAnnotationsArchiveToJson, me as chapterAnnotationsSnapshotToJson, rs as createChapterViewerBundle, os as createChapterViewerEditorOptions, ChapterEmbedPDF as default, Pe as downloadChapterAnnotationsArchive, we as downloadChapterAnnotationsSnapshot, be as downloadJsonFile, ce as exportAllChapterAnnotations, le as exportChapterAnnotations, ue as importChapterAnnotations, pe as importChapterAnnotationsArchive, normalizeChapterViewerConfig, fe as parseChapterAnnotationsArchiveJson, ve as parseChapterAnnotationsSnapshotJson, version };
60826
+ export { se as CHAPTER_ANNOTATIONS_ARCHIVE_VERSION, CHAPTER_SNIPPET_EVENTS, c as CallbackPasswordProvider, ChapterManagerPlugin, ds as DEFAULT_CHAPTER_VIEWER_CONFIG, ls as DEFAULT_CHAPTER_VIEWER_FEATURES, EmbedPdfChapterContainer, ra as applySelectionMarkup, d as buildChapterViewerCatalog, Ye as buildParagraphBookmarkAnchor, ge as chapterAnnotationsArchiveToJson, me as chapterAnnotationsSnapshotToJson, h as chapterDescriptorFromTreeNode, fs as createChapterViewerBundle, ms as createChapterViewerEditorOptions, ChapterEmbedPDF as default, t$1 as defaultOverlapStrategy, Pe as downloadChapterAnnotationsArchive, we as downloadChapterAnnotationsSnapshot, be as downloadJsonFile, ce as exportAllChapterAnnotations, le as exportChapterAnnotations, p as flattenChapterTree, ue as importChapterAnnotations, pe as importChapterAnnotationsArchive, normalizeChapterViewerConfig, i as overlapStrategyForSamePageOwner, fe as parseChapterAnnotationsArchiveJson, ve as parseChapterAnnotationsSnapshotJson, g as toChapterTreeNodes, version };
60724
60827
  //# sourceMappingURL=embedpdf-chapter.js.map