@embedpdf-editor/chapter-snippet 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/embedpdf-chapter.js +633 -606
- package/dist/embedpdf-chapter.js.map +1 -1
- package/package.json +6 -6
package/dist/embedpdf-chapter.js
CHANGED
|
@@ -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 (
|
|
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 (
|
|
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
|
-
|
|
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
|
|
@@ -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 =
|
|
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
|
|
32328
|
-
item:
|
|
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(
|
|
32336
|
-
return
|
|
32337
|
-
"data-global-page-index":
|
|
32338
|
-
"data-chapter-id":
|
|
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
|
-
...
|
|
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 加载失败(",
|
|
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":
|
|
32357
|
+
"data-chapter-id": e.chapterId,
|
|
32357
32358
|
style: {
|
|
32358
|
-
...
|
|
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":
|
|
32368
|
-
"data-chapter-id":
|
|
32369
|
-
style:
|
|
32370
|
-
children: (null == i ? void 0 : i(
|
|
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-
|
|
32384
|
-
"data-
|
|
32385
|
-
"data-
|
|
32386
|
-
|
|
32387
|
-
|
|
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
|
|
32391
|
-
renderPage:
|
|
32392
|
-
renderPlaceholder:
|
|
32393
|
-
className:
|
|
32394
|
-
style:
|
|
32395
|
-
...
|
|
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:
|
|
32404
|
+
provides: u
|
|
32399
32405
|
} = useCapability(ot$1.id),
|
|
32400
32406
|
{
|
|
32401
|
-
provides:
|
|
32407
|
+
provides: p
|
|
32402
32408
|
} = useCapability(DocumentManagerPlugin.id),
|
|
32403
32409
|
{
|
|
32404
|
-
provides:
|
|
32410
|
+
provides: g
|
|
32405
32411
|
} = useCapability(st$1.id),
|
|
32406
|
-
|
|
32407
|
-
[
|
|
32412
|
+
f = A(null),
|
|
32413
|
+
[m, v] = d$1(null);
|
|
32408
32414
|
y(() => {
|
|
32409
|
-
if (!
|
|
32415
|
+
if (!u) return;
|
|
32410
32416
|
let t = false;
|
|
32411
32417
|
const e = () => {
|
|
32412
|
-
t ||
|
|
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 =>
|
|
32419
|
-
i =
|
|
32420
|
-
r = null ==
|
|
32421
|
-
o = null ==
|
|
32422
|
-
n = null ==
|
|
32423
|
-
return s(
|
|
32424
|
-
t = true, cancelAnimationFrame(a), i(), null == r || r(), null == o || o(), null == n || n(),
|
|
32425
|
-
};
|
|
32426
|
-
}, [
|
|
32427
|
-
const
|
|
32428
|
-
|
|
32429
|
-
return u$1(
|
|
32430
|
-
|
|
32431
|
-
|
|
32432
|
-
|
|
32433
|
-
|
|
32434
|
-
|
|
32435
|
-
|
|
32436
|
-
|
|
32437
|
-
|
|
32438
|
-
|
|
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:
|
|
32445
|
-
height:
|
|
32446
|
-
|
|
32448
|
+
width: "100%",
|
|
32449
|
+
height: "100%",
|
|
32450
|
+
userSelect: "none",
|
|
32451
|
+
WebkitUserSelect: "none",
|
|
32452
|
+
...(d ?? {})
|
|
32447
32453
|
},
|
|
32448
|
-
|
|
32449
|
-
|
|
32450
|
-
|
|
32451
|
-
|
|
32452
|
-
|
|
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
|
|
32457
|
-
chapterId:
|
|
32458
|
-
localPageIndex:
|
|
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:
|
|
32465
|
-
pageIndex:
|
|
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
|
|
32492
|
+
const pt = {
|
|
32475
32493
|
kind: "first-wins"
|
|
32476
32494
|
};
|
|
32477
|
-
function
|
|
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
|
|
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
|
|
32531
|
-
const a = function (t, e =
|
|
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,
|
|
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
|
|
32581
|
+
return new ft$1(r);
|
|
32564
32582
|
}
|
|
32565
|
-
const
|
|
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 =
|
|
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 ??
|
|
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 =
|
|
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
|
-
|
|
32792
|
-
let
|
|
32793
|
-
const
|
|
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
|
|
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
|
|
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
|
|
32850
|
-
const a = function (t, e =
|
|
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,
|
|
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
|
|
32900
|
+
return new It$1(r);
|
|
32883
32901
|
}
|
|
32884
|
-
const
|
|
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 =
|
|
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 ??
|
|
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 =
|
|
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
|
-
|
|
33111
|
-
let
|
|
33112
|
-
function
|
|
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
|
|
33140
|
+
const xt$1 = class xt extends BasePlugin {
|
|
33123
33141
|
constructor(t, e) {
|
|
33124
|
-
super(t, e), this.layoutChange$ = createBehaviorEmitter(void 0,
|
|
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
|
-
|
|
33382
|
-
let
|
|
33383
|
-
const
|
|
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(
|
|
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:
|
|
33464
|
+
endAnchor: Tt$1(t.rectsPdfCoord),
|
|
33447
33465
|
selectedText: t.selectedText,
|
|
33448
33466
|
content: t.content
|
|
33449
33467
|
};
|
|
@@ -33534,17 +33552,17 @@ const xt$1 = class t extends BasePlugin {
|
|
|
33534
33552
|
});
|
|
33535
33553
|
}
|
|
33536
33554
|
};
|
|
33537
|
-
|
|
33538
|
-
let
|
|
33539
|
-
function
|
|
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 $
|
|
33547
|
-
chapterId:
|
|
33564
|
+
function Dt$1({
|
|
33565
|
+
chapterId: e,
|
|
33548
33566
|
localPageIndex: s,
|
|
33549
33567
|
pdfPageWidth: o,
|
|
33550
33568
|
pdfPageHeight: n,
|
|
@@ -33566,7 +33584,7 @@ function $t$1({
|
|
|
33566
33584
|
isLoading: true,
|
|
33567
33585
|
ready: new Promise(() => {})
|
|
33568
33586
|
};
|
|
33569
|
-
const e = t.getPlugin(
|
|
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(
|
|
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,
|
|
@@ -33600,9 +33618,9 @@ function $t$1({
|
|
|
33600
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 ===
|
|
33621
|
+
b(t.filter(t => t.chapterId === e && t.localPageIndex === s));
|
|
33604
33622
|
});
|
|
33605
|
-
}, [m,
|
|
33623
|
+
}, [m, e, s]), y(() => {
|
|
33606
33624
|
if (!I) return;
|
|
33607
33625
|
const t = t => {
|
|
33608
33626
|
var e;
|
|
@@ -33624,9 +33642,9 @@ function $t$1({
|
|
|
33624
33642
|
zIndex: 25,
|
|
33625
33643
|
...g
|
|
33626
33644
|
},
|
|
33627
|
-
children: v.map(
|
|
33628
|
-
const s = P ===
|
|
33629
|
-
i = I ===
|
|
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:
|
|
33654
|
-
lineRects:
|
|
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
|
-
}(
|
|
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: [
|
|
33697
|
+
children: [e.rectsPdfCoord.map((t, s) => /* @__PURE__ */u$1("div", {
|
|
33680
33698
|
style: {
|
|
33681
33699
|
position: "absolute",
|
|
33682
|
-
left:
|
|
33683
|
-
top:
|
|
33684
|
-
width:
|
|
33685
|
-
height:
|
|
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(
|
|
33692
|
-
}, `${
|
|
33693
|
-
"data-note-marker-zone":
|
|
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(
|
|
33721
|
+
onMouseEnter: () => w(e.noteId),
|
|
33704
33722
|
onMouseLeave: () => {
|
|
33705
|
-
I !==
|
|
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 ===
|
|
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:
|
|
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 ===
|
|
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:
|
|
33790
|
+
note: e,
|
|
33773
33791
|
onEdit: () => {
|
|
33774
|
-
C(null), w(null), null == f || f.requestEdit(
|
|
33792
|
+
C(null), w(null), null == f || f.requestEdit(e.noteId);
|
|
33775
33793
|
},
|
|
33776
33794
|
onDelete: () => {
|
|
33777
|
-
C(null), w(null), m.deleteNote(
|
|
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:
|
|
33816
|
+
style: zt$1,
|
|
33799
33817
|
onClick: t => {
|
|
33800
|
-
t.stopPropagation(), C(null), w(null), null == f || f.requestEdit(
|
|
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
|
-
...
|
|
33824
|
+
...zt$1,
|
|
33807
33825
|
color: "#dc2626"
|
|
33808
33826
|
},
|
|
33809
33827
|
onClick: t => {
|
|
33810
|
-
t.stopPropagation(), C(null), w(null), m.deleteNote(
|
|
33828
|
+
t.stopPropagation(), C(null), w(null), m.deleteNote(e.noteId);
|
|
33811
33829
|
},
|
|
33812
33830
|
children: "删除"
|
|
33813
33831
|
})]
|
|
33814
33832
|
}))]
|
|
33815
33833
|
})]
|
|
33816
|
-
},
|
|
33834
|
+
}, e.noteId);
|
|
33817
33835
|
})
|
|
33818
33836
|
});
|
|
33819
33837
|
}
|
|
33820
|
-
const
|
|
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
|
|
33850
|
+
const Gt$1 = {
|
|
33833
33851
|
kind: "first-wins"
|
|
33834
33852
|
};
|
|
33835
|
-
function
|
|
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 zt$1(t, e, a) {
|
|
|
33851
33869
|
return a.resolve(t, e);
|
|
33852
33870
|
}
|
|
33853
33871
|
}
|
|
33854
|
-
let
|
|
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
|
|
33889
|
-
const a = function (t, e =
|
|
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 = Dt$1) {
|
|
|
33896
33914
|
}
|
|
33897
33915
|
}
|
|
33898
33916
|
const s = /* @__PURE__ */new Map();
|
|
33899
|
-
for (const [i, r] of a) s.set(i,
|
|
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 = Dt$1) {
|
|
|
33918
33936
|
localPageIndex: l
|
|
33919
33937
|
});
|
|
33920
33938
|
}
|
|
33921
|
-
return new
|
|
33939
|
+
return new At$1(r);
|
|
33922
33940
|
}
|
|
33923
|
-
const
|
|
33941
|
+
const Vt = class t extends BasePlugin {
|
|
33924
33942
|
constructor(t, e) {
|
|
33925
|
-
super(t, e), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy =
|
|
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 ??
|
|
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 =
|
|
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
|
-
|
|
34150
|
-
let
|
|
34151
|
-
const
|
|
34167
|
+
Vt.id = "chapter-manager";
|
|
34168
|
+
let Et = Vt;
|
|
34169
|
+
const Rt = {
|
|
34152
34170
|
kind: "first-wins"
|
|
34153
34171
|
};
|
|
34154
|
-
function
|
|
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
|
|
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
|
|
34208
|
-
const a = function (t, e =
|
|
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,
|
|
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
|
|
34258
|
+
return new Ut(r);
|
|
34241
34259
|
}
|
|
34242
|
-
const
|
|
34260
|
+
const qt = class t extends BasePlugin {
|
|
34243
34261
|
constructor(t, e) {
|
|
34244
|
-
super(t, e), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy =
|
|
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 ??
|
|
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 =
|
|
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
|
-
|
|
34469
|
-
let
|
|
34470
|
-
function
|
|
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
|
|
34498
|
+
const Bt$1 = class Bt extends BasePlugin {
|
|
34481
34499
|
constructor(t, e) {
|
|
34482
|
-
super(t, e), this.layoutChange$ = createBehaviorEmitter(void 0,
|
|
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
|
-
|
|
34740
|
-
let
|
|
34741
|
-
function
|
|
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
|
|
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
|
|
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 ??
|
|
34763
|
-
n = e.markerAnchor ??
|
|
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 (
|
|
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
|
|
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
|
|
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(
|
|
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 (
|
|
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,13 +34898,13 @@ 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
|
|
34901
|
+
await Kt(a, s, i);
|
|
34884
34902
|
}
|
|
34885
34903
|
};
|
|
34886
|
-
|
|
34887
|
-
let
|
|
34888
|
-
function
|
|
34889
|
-
chapterId:
|
|
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,
|
|
@@ -34899,17 +34917,17 @@ function Qt({
|
|
|
34899
34917
|
}) {
|
|
34900
34918
|
const {
|
|
34901
34919
|
provides: m
|
|
34902
|
-
} = useCapability(
|
|
34920
|
+
} = useCapability(Jt.id),
|
|
34903
34921
|
[v, b] = d$1([]),
|
|
34904
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 ===
|
|
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,
|
|
34930
|
+
}, [m, e, o]), y(() => {
|
|
34913
34931
|
if (!P) return;
|
|
34914
34932
|
const t = t => {
|
|
34915
34933
|
var e;
|
|
@@ -34928,12 +34946,12 @@ function Qt({
|
|
|
34928
34946
|
pointerEvents: "none",
|
|
34929
34947
|
...f
|
|
34930
34948
|
},
|
|
34931
|
-
children: v.map(
|
|
34949
|
+
children: v.map(e => {
|
|
34932
34950
|
var s;
|
|
34933
|
-
const i = (null == (s =
|
|
34934
|
-
r =
|
|
34935
|
-
x:
|
|
34936
|
-
y:
|
|
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,
|
|
@@ -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:
|
|
34984
|
-
"aria-label": `bookmark ${
|
|
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 ===
|
|
35018
|
+
t.stopPropagation(), w(t => t === e.id ? null : e.id), null == u || u(e);
|
|
35001
35019
|
},
|
|
35002
35020
|
children: p.renderIcon({
|
|
35003
|
-
bookmark:
|
|
35021
|
+
bookmark: e
|
|
35004
35022
|
})
|
|
35005
35023
|
}) : /* @__PURE__ */u$1("button", {
|
|
35006
35024
|
type: "button",
|
|
35007
|
-
title:
|
|
35025
|
+
title: e.label,
|
|
35008
35026
|
onClick: t => {
|
|
35009
|
-
t.stopPropagation(), w(t => t ===
|
|
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 ${
|
|
35048
|
+
"aria-label": `bookmark ${e.label}`,
|
|
35031
35049
|
children: "🔖"
|
|
35032
|
-
}), P ===
|
|
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(
|
|
35080
|
+
m.requestRemoveBookmark(e.id).then(t => {
|
|
35063
35081
|
t && w(null);
|
|
35064
35082
|
});
|
|
35065
35083
|
},
|
|
35066
35084
|
children: "删除书签"
|
|
35067
35085
|
})
|
|
35068
35086
|
})]
|
|
35069
|
-
},
|
|
35087
|
+
}, e.id);
|
|
35070
35088
|
})
|
|
35071
35089
|
});
|
|
35072
35090
|
}
|
|
35073
|
-
function
|
|
35091
|
+
function ee(t) {
|
|
35074
35092
|
return t.chapterId;
|
|
35075
35093
|
}
|
|
35076
|
-
function
|
|
35094
|
+
function ae(t, e) {
|
|
35077
35095
|
t.wait(e, () => {});
|
|
35078
35096
|
}
|
|
35079
|
-
function
|
|
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
|
|
35090
|
-
|
|
35091
|
-
|
|
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
|
|
35135
|
+
const le$1 = {
|
|
35106
35136
|
kind: "first-wins"
|
|
35107
35137
|
};
|
|
35108
|
-
function
|
|
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
|
|
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
|
|
35162
|
-
const a = function (t, e =
|
|
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,
|
|
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
|
|
35224
|
+
return new ce$1(r);
|
|
35195
35225
|
}
|
|
35196
|
-
const
|
|
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 =
|
|
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 ??
|
|
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 =
|
|
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
|
-
|
|
35423
|
-
let
|
|
35424
|
-
const
|
|
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
|
|
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
|
|
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
|
|
35481
|
-
const a = function (t, e =
|
|
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,
|
|
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
|
|
35543
|
+
return new ve$1(r);
|
|
35514
35544
|
}
|
|
35515
|
-
const
|
|
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 =
|
|
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 ??
|
|
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 =
|
|
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
|
-
|
|
35742
|
-
let
|
|
35743
|
-
function
|
|
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
|
|
35783
|
+
const Ce = class extends BasePlugin {
|
|
35754
35784
|
constructor(t, e) {
|
|
35755
|
-
super(t, e), this.layoutChange$ = createBehaviorEmitter(void 0,
|
|
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
|
-
|
|
36013
|
-
let
|
|
36014
|
-
const
|
|
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(
|
|
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:
|
|
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
|
-
|
|
36169
|
-
let
|
|
36170
|
-
function
|
|
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
|
|
36178
|
-
manifest:
|
|
36179
|
-
create: t => new
|
|
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
|
-
|
|
36184
|
-
|
|
36185
|
-
id:
|
|
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
|
|
36223
|
+
const Te = {
|
|
36194
36224
|
kind: "first-wins"
|
|
36195
36225
|
};
|
|
36196
|
-
function
|
|
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
|
|
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
|
|
36250
|
-
const a = function (t, e =
|
|
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,
|
|
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
|
|
36312
|
+
return new ze(r);
|
|
36283
36313
|
}
|
|
36284
|
-
const
|
|
36314
|
+
const Oe = class t extends BasePlugin {
|
|
36285
36315
|
constructor(t, e) {
|
|
36286
|
-
super(t, e), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy =
|
|
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 ??
|
|
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 =
|
|
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
|
-
|
|
36511
|
-
let
|
|
36512
|
-
const
|
|
36540
|
+
Oe.id = "chapter-manager";
|
|
36541
|
+
let Ae = Oe;
|
|
36542
|
+
const Ne = {
|
|
36513
36543
|
kind: "first-wins"
|
|
36514
36544
|
};
|
|
36515
|
-
function
|
|
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 ze(t, e, a) {
|
|
|
36531
36561
|
return a.resolve(t, e);
|
|
36532
36562
|
}
|
|
36533
36563
|
}
|
|
36534
|
-
class
|
|
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
|
|
36569
|
-
const a = function (t, e =
|
|
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 = De) {
|
|
|
36576
36606
|
}
|
|
36577
36607
|
}
|
|
36578
36608
|
const s = /* @__PURE__ */new Map();
|
|
36579
|
-
for (const [i, r] of a) s.set(i,
|
|
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 = De) {
|
|
|
36598
36628
|
localPageIndex: l
|
|
36599
36629
|
});
|
|
36600
36630
|
}
|
|
36601
|
-
return new
|
|
36631
|
+
return new Ee(r);
|
|
36602
36632
|
}
|
|
36603
|
-
const
|
|
36633
|
+
const Fe = class t extends BasePlugin {
|
|
36604
36634
|
constructor(t, e) {
|
|
36605
|
-
super(t, e), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy =
|
|
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 ??
|
|
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 =
|
|
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
|
-
|
|
36830
|
-
let
|
|
36831
|
-
function
|
|
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
|
|
36871
|
+
const qe = class extends BasePlugin {
|
|
36842
36872
|
constructor(t, e) {
|
|
36843
|
-
super(t, e), this.layoutChange$ = createBehaviorEmitter(void 0,
|
|
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
|
-
|
|
37101
|
-
let
|
|
37102
|
-
function
|
|
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
|
|
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
|
|
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
|
|
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 ??
|
|
37142
|
-
n = e.markerAnchor ??
|
|
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 (
|
|
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
|
|
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:
|
|
37189
|
+
rectPdfCoord: He(i),
|
|
37160
37190
|
rectsPdfCoord: i,
|
|
37161
|
-
markerAnchor:
|
|
37191
|
+
markerAnchor: Be(i)
|
|
37162
37192
|
};
|
|
37163
37193
|
}
|
|
37164
|
-
async function
|
|
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
|
|
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(
|
|
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 (
|
|
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,32 +37302,32 @@ 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
|
|
37305
|
+
await Xe(a, s, i);
|
|
37276
37306
|
}
|
|
37277
37307
|
};
|
|
37278
|
-
|
|
37279
|
-
let
|
|
37280
|
-
const
|
|
37281
|
-
manifest:
|
|
37282
|
-
create: t => new
|
|
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
|
|
37287
|
-
item:
|
|
37288
|
-
pdfPageWidth:
|
|
37316
|
+
function ta({
|
|
37317
|
+
item: t,
|
|
37318
|
+
pdfPageWidth: e,
|
|
37289
37319
|
pdfPageHeight: o,
|
|
37290
37320
|
cssPageWidth: l,
|
|
37291
37321
|
cssPageHeight: d,
|
|
37292
37322
|
hoverUi: c
|
|
37293
37323
|
}) {
|
|
37294
|
-
const u =
|
|
37324
|
+
const u = ee(t),
|
|
37295
37325
|
{
|
|
37296
37326
|
provides: p
|
|
37297
37327
|
} = useCapability(SelectionPlugin.id),
|
|
37298
37328
|
{
|
|
37299
37329
|
provides: g
|
|
37300
|
-
} = useCapability(
|
|
37330
|
+
} = useCapability(Qe.id),
|
|
37301
37331
|
f = A(null),
|
|
37302
37332
|
[w, I] = d$1(null),
|
|
37303
37333
|
[C, y$1] = d$1(null),
|
|
@@ -37305,17 +37335,17 @@ function Ye({
|
|
|
37305
37335
|
x = c?.iconSize ?? 16;
|
|
37306
37336
|
y(() => {
|
|
37307
37337
|
if (!p) return;
|
|
37308
|
-
const
|
|
37338
|
+
const e = p.forDocument(u),
|
|
37309
37339
|
a = () => {
|
|
37310
|
-
const a =
|
|
37340
|
+
const a = e.getState().geometry[t.localPageIndex];
|
|
37311
37341
|
a && I(a);
|
|
37312
37342
|
},
|
|
37313
|
-
s =
|
|
37343
|
+
s = e.onSelectionChange(a);
|
|
37314
37344
|
let i = false;
|
|
37315
37345
|
const r = () => {
|
|
37316
37346
|
if (!i) {
|
|
37317
37347
|
try {
|
|
37318
|
-
if (a(),
|
|
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,
|
|
37356
|
+
}, [p, u, t.localPageIndex]);
|
|
37327
37357
|
const k = M ?? C;
|
|
37328
37358
|
y(() => {
|
|
37329
|
-
if (!w || !
|
|
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
|
|
37336
|
-
if (!
|
|
37337
|
-
const s =
|
|
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 /
|
|
37381
|
+
x: (t.clientX - s.left) / (l / e),
|
|
37352
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,
|
|
37358
|
-
const L = k?.length ?
|
|
37359
|
-
globalPageIndex:
|
|
37360
|
-
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 =>
|
|
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,8 +37399,8 @@ function Ye({
|
|
|
37369
37399
|
anchor: L
|
|
37370
37400
|
}), y$1(null), S(null));
|
|
37371
37401
|
}, [g, L, $]);
|
|
37372
|
-
if (!g || !
|
|
37373
|
-
const D = l /
|
|
37402
|
+
if (!g || !e || !o) return null;
|
|
37403
|
+
const D = l / e,
|
|
37374
37404
|
z = d / o,
|
|
37375
37405
|
G = k?.[k.length - 1],
|
|
37376
37406
|
O = G ? Math.min((G.origin.x + G.size.width) * D + 6, Math.max(0, l - x - 2)) : 0,
|
|
@@ -37448,12 +37478,7 @@ function Ye({
|
|
|
37448
37478
|
})
|
|
37449
37479
|
});
|
|
37450
37480
|
}
|
|
37451
|
-
const
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
-
...
|
|
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 ?
|
|
37531
|
-
h = "underline" === e || "squiggly" === e || "strikeout" === e ?
|
|
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:
|
|
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
|
|
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
|
|
37567
|
-
const e =
|
|
37591
|
+
function na(t) {
|
|
37592
|
+
const e = oa(null == t ? void 0 : t.markup, {
|
|
37568
37593
|
enabled: true
|
|
37569
37594
|
}),
|
|
37570
|
-
a =
|
|
37595
|
+
a = oa(null == t ? void 0 : t.bookmarks, {
|
|
37571
37596
|
enabled: true
|
|
37572
37597
|
}),
|
|
37573
|
-
s =
|
|
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:
|
|
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:
|
|
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
|
|
37616
|
+
const ha = [{
|
|
37592
37617
|
id: "highlight",
|
|
37593
37618
|
label: "高亮背景",
|
|
37594
|
-
icon: /* @__PURE__ */u$1(
|
|
37619
|
+
icon: /* @__PURE__ */u$1(ua, {})
|
|
37595
37620
|
}, {
|
|
37596
37621
|
id: "underline",
|
|
37597
37622
|
label: "下划线",
|
|
37598
|
-
icon: /* @__PURE__ */u$1(
|
|
37623
|
+
icon: /* @__PURE__ */u$1(pa, {})
|
|
37599
37624
|
}, {
|
|
37600
37625
|
id: "squiggly",
|
|
37601
37626
|
label: "波浪线",
|
|
37602
|
-
icon: /* @__PURE__ */u$1(
|
|
37627
|
+
icon: /* @__PURE__ */u$1(ga, {})
|
|
37603
37628
|
}, {
|
|
37604
37629
|
id: "strikeout",
|
|
37605
37630
|
label: "删除线",
|
|
37606
|
-
icon: /* @__PURE__ */u$1(
|
|
37631
|
+
icon: /* @__PURE__ */u$1(fa, {})
|
|
37607
37632
|
}, {
|
|
37608
37633
|
id: "note",
|
|
37609
37634
|
label: "添加笔记",
|
|
37610
|
-
icon: /* @__PURE__ */u$1(
|
|
37635
|
+
icon: /* @__PURE__ */u$1(ma, {})
|
|
37611
37636
|
}];
|
|
37612
|
-
function
|
|
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 =
|
|
37621
|
-
d =
|
|
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(
|
|
37644
|
-
label:
|
|
37645
|
-
onClick: () => r(
|
|
37646
|
-
children:
|
|
37647
|
-
},
|
|
37648
|
-
label:
|
|
37649
|
-
onClick: () => r(
|
|
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:
|
|
37680
|
+
children: t.label.slice(0, 2)
|
|
37656
37681
|
})
|
|
37657
|
-
},
|
|
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(
|
|
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
|
|
37677
|
-
label:
|
|
37678
|
-
onClick:
|
|
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:
|
|
37686
|
-
"aria-label":
|
|
37687
|
-
onClick:
|
|
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
|
|
37711
|
-
behind:
|
|
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: [
|
|
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
|
|
37758
|
+
function ua() {
|
|
37734
37759
|
|
|
37735
|
-
return u$1(
|
|
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
|
|
37771
|
+
function pa() {
|
|
37747
37772
|
|
|
37748
|
-
return u$1(
|
|
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
|
|
37782
|
+
function ga() {
|
|
37758
37783
|
|
|
37759
|
-
return u$1(
|
|
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
|
|
37794
|
+
function fa() {
|
|
37770
37795
|
|
|
37771
|
-
return u$1(
|
|
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
|
|
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
|
|
37831
|
+
const va = {
|
|
37807
37832
|
highlight: "highlight",
|
|
37808
37833
|
underline: "underline",
|
|
37809
37834
|
squiggly: "squiggly",
|
|
37810
37835
|
strikeout: "strikeout"
|
|
37811
37836
|
};
|
|
37812
|
-
function
|
|
37813
|
-
const s =
|
|
37814
|
-
i = false !==
|
|
37815
|
-
r = false !==
|
|
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(
|
|
37851
|
+
} = useCapability(Se.id);
|
|
37827
37852
|
return T$2(() => o => {
|
|
37828
|
-
const h =
|
|
37853
|
+
const h = ee(o.item);
|
|
37829
37854
|
return c => /* @__PURE__ */u$1("div", {
|
|
37830
37855
|
...c.menuWrapperProps,
|
|
37831
|
-
children: /* @__PURE__ */u$1(
|
|
37856
|
+
children: /* @__PURE__ */u$1(la, {
|
|
37832
37857
|
placementAbove: !!c.placement?.suggestTop,
|
|
37833
37858
|
anchorHeight: c.rect.size.height,
|
|
37834
|
-
onAction:
|
|
37835
|
-
if ("highlight" !==
|
|
37836
|
-
if ("note" ===
|
|
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
|
|
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
|
-
|
|
37875
|
+
e?.onExtraAction?.(a, o);
|
|
37851
37876
|
} else {
|
|
37852
37877
|
if (!n || !l || !i) return;
|
|
37853
|
-
|
|
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,
|
|
37885
|
+
}, [l, t?.markup?.styles, e?.onExtraAction, i, d, r, n, s?.extraActions, s?.hiddenBuiltinActions]);
|
|
37861
37886
|
}
|
|
37862
|
-
const
|
|
37863
|
-
|
|
37864
|
-
id:
|
|
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
|
|
37904
|
+
const Ia = {
|
|
37880
37905
|
kind: "first-wins"
|
|
37881
37906
|
};
|
|
37882
|
-
function
|
|
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
|
|
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
|
|
37936
|
-
const a = function (t, e =
|
|
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,
|
|
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
|
|
37993
|
+
return new ya(r);
|
|
37969
37994
|
}
|
|
37970
|
-
const
|
|
37995
|
+
const Sa = class t extends BasePlugin {
|
|
37971
37996
|
constructor(t, e) {
|
|
37972
|
-
super(t, e), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy =
|
|
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 ??
|
|
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 =
|
|
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
|
-
|
|
38197
|
-
let
|
|
38198
|
-
const
|
|
38199
|
-
manifest:
|
|
38200
|
-
create: t => new
|
|
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
|
|
38229
|
+
function La(t, e = .5, a = 3) {
|
|
38205
38230
|
return Math.min(a, Math.max(e, t));
|
|
38206
38231
|
}
|
|
38207
|
-
function
|
|
38232
|
+
function $a(t, e) {
|
|
38208
38233
|
const {
|
|
38209
38234
|
registry: a
|
|
38210
38235
|
} = useRegistry(),
|
|
@@ -38213,7 +38238,7 @@ function Sa(t, e) {
|
|
|
38213
38238
|
} = useCapability(DocumentManagerPlugin.id),
|
|
38214
38239
|
{
|
|
38215
38240
|
provides: d
|
|
38216
|
-
} = useCapability(
|
|
38241
|
+
} = useCapability(xa.id),
|
|
38217
38242
|
c = false !== e?.enabled,
|
|
38218
38243
|
u = e?.min ?? .5,
|
|
38219
38244
|
p = e?.max ?? 3,
|
|
@@ -38221,11 +38246,11 @@ function Sa(t, e) {
|
|
|
38221
38246
|
[f, m] = d$1(() => e?.initial ?? 1),
|
|
38222
38247
|
v = A(f),
|
|
38223
38248
|
b = q$2(e => {
|
|
38224
|
-
const s =
|
|
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 =
|
|
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);
|
|
@@ -38258,10 +38283,10 @@ function Sa(t, e) {
|
|
|
38258
38283
|
maxZoom: p
|
|
38259
38284
|
};
|
|
38260
38285
|
}
|
|
38261
|
-
function
|
|
38286
|
+
function Ta(t, e, a) {
|
|
38262
38287
|
return Math.min(a, Math.max(e, t));
|
|
38263
38288
|
}
|
|
38264
|
-
function
|
|
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 =
|
|
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(
|
|
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
|
|
38361
|
+
const za = {
|
|
38337
38362
|
chapters: []
|
|
38338
38363
|
};
|
|
38339
|
-
function
|
|
38364
|
+
function Ga(t) {
|
|
38340
38365
|
const e = A(null),
|
|
38341
38366
|
{
|
|
38342
38367
|
provides: a
|
|
38343
|
-
} = useCapability(
|
|
38344
|
-
i = T$2(() => a?.getManifest() ??
|
|
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
|
-
} =
|
|
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
|
|
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
|
|
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
|
-
} =
|
|
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(
|
|
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(
|
|
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(
|
|
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 =
|
|
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(
|
|
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 :
|
|
38444
|
-
children: [/* @__PURE__ */u$1(
|
|
38445
|
-
renderPage:
|
|
38446
|
-
item:
|
|
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
|
|
38462
|
-
item:
|
|
38463
|
-
hoverUi:
|
|
38486
|
+
function Aa({
|
|
38487
|
+
item: t,
|
|
38488
|
+
hoverUi: e
|
|
38464
38489
|
}) {
|
|
38465
|
-
const s =
|
|
38490
|
+
const s = ee(t),
|
|
38466
38491
|
i = useDocumentState(s),
|
|
38467
|
-
r = i?.document?.pages[
|
|
38468
|
-
return r ? /* @__PURE__ */u$1(
|
|
38469
|
-
item:
|
|
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:
|
|
38473
|
-
cssPageHeight:
|
|
38474
|
-
hoverUi:
|
|
38497
|
+
cssPageWidth: t.width,
|
|
38498
|
+
cssPageHeight: t.height,
|
|
38499
|
+
hoverUi: e
|
|
38475
38500
|
}) : null;
|
|
38476
38501
|
}
|
|
38477
|
-
function
|
|
38478
|
-
item:
|
|
38502
|
+
function Na({
|
|
38503
|
+
item: e,
|
|
38479
38504
|
showNoteMarkers: s,
|
|
38480
38505
|
showBookmarkMarkers: i,
|
|
38481
38506
|
noteMarkerUi: n,
|
|
@@ -38487,7 +38512,7 @@ function za({
|
|
|
38487
38512
|
redactionSelectionMenu: b,
|
|
38488
38513
|
showRedactionLayer: w = false
|
|
38489
38514
|
}) {
|
|
38490
|
-
const M =
|
|
38515
|
+
const M = ee(e);
|
|
38491
38516
|
!function (t) {
|
|
38492
38517
|
const {
|
|
38493
38518
|
provides: e
|
|
@@ -38499,14 +38524,14 @@ function za({
|
|
|
38499
38524
|
const {
|
|
38500
38525
|
provides: S
|
|
38501
38526
|
} = useCapability(DocumentManagerPlugin.id),
|
|
38502
|
-
x = S?.getDocument(M)?.pages[
|
|
38503
|
-
k = function (
|
|
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 =
|
|
38532
|
+
i = ee(t);
|
|
38508
38533
|
return T$2(() => {
|
|
38509
|
-
if (
|
|
38534
|
+
if (e) return r => {
|
|
38510
38535
|
const o = {
|
|
38511
38536
|
position: "absolute",
|
|
38512
38537
|
pointerEvents: "auto",
|
|
@@ -38522,11 +38547,11 @@ function za({
|
|
|
38522
38547
|
type: "button",
|
|
38523
38548
|
onClick: () => {
|
|
38524
38549
|
if (!s) return;
|
|
38525
|
-
const
|
|
38526
|
-
|
|
38550
|
+
const a = s.getHighlightRectsForPage(t.localPageIndex, i);
|
|
38551
|
+
ae(s.getSelectedText(i), s => {
|
|
38527
38552
|
const i = s.join("\n"),
|
|
38528
|
-
r =
|
|
38529
|
-
|
|
38553
|
+
r = se$1(t, a, i);
|
|
38554
|
+
e(r);
|
|
38530
38555
|
});
|
|
38531
38556
|
},
|
|
38532
38557
|
style: {
|
|
@@ -38543,10 +38568,10 @@ function za({
|
|
|
38543
38568
|
})
|
|
38544
38569
|
});
|
|
38545
38570
|
};
|
|
38546
|
-
}, [
|
|
38547
|
-
}(
|
|
38571
|
+
}, [e, i, t, s]);
|
|
38572
|
+
}(e, c),
|
|
38548
38573
|
L = void 0 !== m ? m({
|
|
38549
|
-
item:
|
|
38574
|
+
item: e,
|
|
38550
38575
|
defaultMenu: k,
|
|
38551
38576
|
createNote: c
|
|
38552
38577
|
}) : k;
|
|
@@ -38554,50 +38579,52 @@ function za({
|
|
|
38554
38579
|
documentId: M,
|
|
38555
38580
|
children: /* @__PURE__ */u$1(Rotate, {
|
|
38556
38581
|
documentId: M,
|
|
38557
|
-
pageIndex:
|
|
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:
|
|
38564
|
-
|
|
38588
|
+
pageIndex: e.localPageIndex,
|
|
38589
|
+
style: re$1,
|
|
38590
|
+
onPointerDown: oe$1,
|
|
38591
|
+
children: [/* @__PURE__ */u$1(ut, {
|
|
38565
38592
|
chapterId: M,
|
|
38566
|
-
localPageIndex:
|
|
38593
|
+
localPageIndex: e.localPageIndex
|
|
38567
38594
|
}), /* @__PURE__ */u$1(SelectionLayer, {
|
|
38568
38595
|
documentId: M,
|
|
38569
|
-
pageIndex:
|
|
38596
|
+
pageIndex: e.localPageIndex,
|
|
38570
38597
|
selectionMenu: L
|
|
38571
38598
|
}), w && /* @__PURE__ */u$1(RedactionLayer, {
|
|
38572
38599
|
documentId: M,
|
|
38573
|
-
pageIndex:
|
|
38600
|
+
pageIndex: e.localPageIndex,
|
|
38574
38601
|
selectionMenu: b
|
|
38575
38602
|
}), /* @__PURE__ */u$1(AnnotationLayer, {
|
|
38576
38603
|
documentId: M,
|
|
38577
|
-
pageIndex:
|
|
38604
|
+
pageIndex: e.localPageIndex,
|
|
38578
38605
|
selectionMenu: v
|
|
38579
|
-
}), i && x && /* @__PURE__ */u$1(
|
|
38606
|
+
}), i && x && /* @__PURE__ */u$1(te, {
|
|
38580
38607
|
chapterId: M,
|
|
38581
|
-
localPageIndex:
|
|
38608
|
+
localPageIndex: e.localPageIndex,
|
|
38582
38609
|
pdfPageWidth: x.size.width,
|
|
38583
38610
|
pdfPageHeight: x.size.height,
|
|
38584
|
-
cssPageWidth:
|
|
38585
|
-
cssPageHeight:
|
|
38611
|
+
cssPageWidth: e.width,
|
|
38612
|
+
cssPageHeight: e.height,
|
|
38586
38613
|
ui: l
|
|
38587
|
-
}), d?.(
|
|
38614
|
+
}), d?.(e), s && x && /* @__PURE__ */u$1(Dt$1, {
|
|
38588
38615
|
chapterId: M,
|
|
38589
|
-
localPageIndex:
|
|
38616
|
+
localPageIndex: e.localPageIndex,
|
|
38590
38617
|
pdfPageWidth: x.size.width,
|
|
38591
38618
|
pdfPageHeight: x.size.height,
|
|
38592
|
-
cssPageWidth:
|
|
38593
|
-
cssPageHeight:
|
|
38619
|
+
cssPageWidth: e.width,
|
|
38620
|
+
cssPageHeight: e.height,
|
|
38594
38621
|
ui: n
|
|
38595
38622
|
})]
|
|
38596
38623
|
})
|
|
38597
38624
|
})
|
|
38598
38625
|
});
|
|
38599
38626
|
}
|
|
38600
|
-
class
|
|
38627
|
+
class Ea {
|
|
38601
38628
|
constructor(t) {
|
|
38602
38629
|
this.cb = t;
|
|
38603
38630
|
}
|
|
@@ -38605,9 +38632,9 @@ class Oa {
|
|
|
38605
38632
|
return this.cb(t, e);
|
|
38606
38633
|
}
|
|
38607
38634
|
}
|
|
38608
|
-
const
|
|
38609
|
-
|
|
38610
|
-
id:
|
|
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 Fa = "chapter-scroll",
|
|
|
38620
38647
|
pageGap: 20
|
|
38621
38648
|
}
|
|
38622
38649
|
};
|
|
38623
|
-
const
|
|
38650
|
+
const Ba = {
|
|
38624
38651
|
kind: "first-wins"
|
|
38625
38652
|
};
|
|
38626
|
-
function
|
|
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 qa(t, e, a) {
|
|
|
38642
38669
|
return a.resolve(t, e);
|
|
38643
38670
|
}
|
|
38644
38671
|
}
|
|
38645
|
-
class
|
|
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 Wa {
|
|
|
38676
38703
|
return a ? this._pages.indexOf(a) : -1;
|
|
38677
38704
|
}
|
|
38678
38705
|
}
|
|
38679
|
-
function
|
|
38680
|
-
const a = function (t, e =
|
|
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 Ha(t, e = _a) {
|
|
|
38687
38714
|
}
|
|
38688
38715
|
}
|
|
38689
38716
|
const s = /* @__PURE__ */new Map();
|
|
38690
|
-
for (const [i, r] of a) s.set(i,
|
|
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 Ha(t, e = _a) {
|
|
|
38709
38736
|
localPageIndex: l
|
|
38710
38737
|
});
|
|
38711
38738
|
}
|
|
38712
|
-
return new
|
|
38739
|
+
return new Za(r);
|
|
38713
38740
|
}
|
|
38714
|
-
const
|
|
38741
|
+
const Xa = class t extends BasePlugin {
|
|
38715
38742
|
constructor(t, e) {
|
|
38716
|
-
super(t, e), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy =
|
|
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 ??
|
|
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 Ba = 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 =
|
|
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 Ba = class t extends BasePlugin {
|
|
|
38937
38964
|
}));
|
|
38938
38965
|
}
|
|
38939
38966
|
};
|
|
38940
|
-
|
|
38941
|
-
let
|
|
38942
|
-
function
|
|
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 Za(t, e) {
|
|
|
38949
38976
|
}
|
|
38950
38977
|
return true;
|
|
38951
38978
|
}
|
|
38952
|
-
const
|
|
38979
|
+
const Ja = class extends BasePlugin {
|
|
38953
38980
|
constructor(t, e) {
|
|
38954
|
-
super(t, e), this.layoutChange$ = createBehaviorEmitter(void 0,
|
|
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 Ya = class extends BasePlugin {
|
|
|
39208
39235
|
a && this.scrollToIndex(a.globalPageIndex, e);
|
|
39209
39236
|
}
|
|
39210
39237
|
};
|
|
39211
|
-
|
|
39212
|
-
let
|
|
39213
|
-
const
|
|
39214
|
-
manifest:
|
|
39215
|
-
create: t => new
|
|
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
|
-
|
|
39246
|
+
as = {
|
|
39220
39247
|
"annotation-toolbar": {
|
|
39221
39248
|
id: "annotation-toolbar",
|
|
39222
39249
|
position: {
|
|
@@ -39713,7 +39740,7 @@ const Ka = {
|
|
|
39713
39740
|
}]
|
|
39714
39741
|
}
|
|
39715
39742
|
};
|
|
39716
|
-
class
|
|
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(
|
|
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 =
|
|
39778
|
+
a.items = is(a.items, s, e.position);
|
|
39752
39779
|
}
|
|
39753
39780
|
return t;
|
|
39754
39781
|
}
|
|
39755
39782
|
}
|
|
39756
|
-
function
|
|
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 ts(t, e, a) {
|
|
|
39771
39798
|
} : t);
|
|
39772
39799
|
}(t, e);
|
|
39773
39800
|
}
|
|
39774
|
-
const
|
|
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
|
|
39808
|
+
function os() {
|
|
39782
39809
|
return {
|
|
39783
39810
|
"mode:view": {
|
|
39784
39811
|
id: "mode:view",
|
|
@@ -39895,7 +39922,7 @@ function as() {
|
|
|
39895
39922
|
}
|
|
39896
39923
|
};
|
|
39897
39924
|
}
|
|
39898
|
-
function
|
|
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 ss(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
|
|
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 =
|
|
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 ss(t) {
|
|
|
39966
39993
|
enabledModes: a
|
|
39967
39994
|
}),
|
|
39968
39995
|
o = {
|
|
39969
|
-
...(s ?
|
|
39970
|
-
...(s ?
|
|
39996
|
+
...(s ? os() : {}),
|
|
39997
|
+
...(s ? hs(r.list()) : {}),
|
|
39971
39998
|
...(t.commands ?? {})
|
|
39972
39999
|
},
|
|
39973
40000
|
n = [createPluginRegistration(DocumentManagerPluginPackage, {
|
|
39974
40001
|
initialDocuments: []
|
|
39975
|
-
}), createPluginRegistration(
|
|
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(
|
|
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 ss(t) {
|
|
|
39995
40022
|
})] : []), ...(s ? [createPluginRegistration(I18nPluginPackage), createPluginRegistration(UIPluginPackage, {
|
|
39996
40023
|
schema: i
|
|
39997
40024
|
})] : [])];
|
|
39998
|
-
return t.notes && n.push(createPluginRegistration(
|
|
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(
|
|
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 ss(t) {
|
|
|
40008
40035
|
operationRegistry: r
|
|
40009
40036
|
};
|
|
40010
40037
|
}
|
|
40011
|
-
function
|
|
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 is(t) {
|
|
|
40027
40054
|
});
|
|
40028
40055
|
return e;
|
|
40029
40056
|
}
|
|
40030
|
-
const
|
|
40031
|
-
|
|
40032
|
-
function
|
|
40033
|
-
return
|
|
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:
|
|
40065
|
+
features: na(t.features)
|
|
40039
40066
|
});
|
|
40040
40067
|
}
|
|
40041
|
-
const
|
|
40068
|
+
const us = {
|
|
40042
40069
|
overlapStrategy: {
|
|
40043
40070
|
kind: "first-wins"
|
|
40044
40071
|
},
|
|
40045
|
-
passwordProvider: new
|
|
40072
|
+
passwordProvider: new Ea(async () => null),
|
|
40046
40073
|
prefetchChapters: 1,
|
|
40047
40074
|
loadDefaultStampLibrary: false,
|
|
40048
40075
|
unloadTimeoutMs: 12e4,
|
|
@@ -40050,7 +40077,7 @@ const hs = {
|
|
|
40050
40077
|
enabledModes: []
|
|
40051
40078
|
}
|
|
40052
40079
|
};
|
|
40053
|
-
function
|
|
40080
|
+
function ps(t) {
|
|
40054
40081
|
return function (t) {
|
|
40055
40082
|
return "callbacks" in t.notes;
|
|
40056
40083
|
}(t) ? {
|
|
@@ -40060,40 +40087,40 @@ function ls(t) {
|
|
|
40060
40087
|
bookmarks: t.bookmarks.callbacks
|
|
40061
40088
|
} : t;
|
|
40062
40089
|
}
|
|
40063
|
-
function
|
|
40090
|
+
function gs(t) {
|
|
40064
40091
|
return {
|
|
40065
|
-
...
|
|
40092
|
+
...us,
|
|
40066
40093
|
manifest: t.manifest,
|
|
40067
40094
|
chapterPdfLoader: t.chapterPdfLoader,
|
|
40068
|
-
overlapStrategy: t.overlapStrategy ??
|
|
40095
|
+
overlapStrategy: t.overlapStrategy ?? us.overlapStrategy,
|
|
40069
40096
|
notes: {
|
|
40070
40097
|
callbacks: t.notes
|
|
40071
40098
|
},
|
|
40072
40099
|
bookmarks: {
|
|
40073
40100
|
callbacks: t.bookmarks
|
|
40074
40101
|
},
|
|
40075
|
-
features:
|
|
40102
|
+
features: na(t.features)
|
|
40076
40103
|
};
|
|
40077
40104
|
}
|
|
40078
|
-
function
|
|
40079
|
-
const e =
|
|
40105
|
+
function fs(t) {
|
|
40106
|
+
const e = gs(ps(t)),
|
|
40080
40107
|
{
|
|
40081
40108
|
plugins: a
|
|
40082
|
-
} =
|
|
40109
|
+
} = cs(e);
|
|
40083
40110
|
return {
|
|
40084
40111
|
plugins: a,
|
|
40085
40112
|
features: e.features,
|
|
40086
40113
|
editorOptions: e
|
|
40087
40114
|
};
|
|
40088
40115
|
}
|
|
40089
|
-
function
|
|
40116
|
+
function ms(t) {
|
|
40090
40117
|
const {
|
|
40091
40118
|
features: e,
|
|
40092
40119
|
...a
|
|
40093
|
-
} =
|
|
40120
|
+
} = gs(ps(t));
|
|
40094
40121
|
return a;
|
|
40095
40122
|
}
|
|
40096
|
-
const
|
|
40123
|
+
const vs = {
|
|
40097
40124
|
display: "flex",
|
|
40098
40125
|
height: "100%",
|
|
40099
40126
|
minHeight: "120px",
|
|
@@ -40102,8 +40129,8 @@ const ps = {
|
|
|
40102
40129
|
fontSize: "14px",
|
|
40103
40130
|
color: "#64748b"
|
|
40104
40131
|
};
|
|
40105
|
-
function
|
|
40106
|
-
chapterId:
|
|
40132
|
+
function bs({
|
|
40133
|
+
chapterId: e,
|
|
40107
40134
|
chapterManager: s,
|
|
40108
40135
|
loadTimeoutMs: o,
|
|
40109
40136
|
onLoadTimeout: n,
|
|
@@ -40112,49 +40139,49 @@ function gs({
|
|
|
40112
40139
|
}) {
|
|
40113
40140
|
const {
|
|
40114
40141
|
provides: c
|
|
40115
|
-
} = useCapability(
|
|
40142
|
+
} = useCapability(xa.id),
|
|
40116
40143
|
u = s ?? c,
|
|
40117
40144
|
[p, g] = d$1(false),
|
|
40118
40145
|
[f, m] = d$1(null);
|
|
40119
40146
|
return y(() => {
|
|
40120
|
-
if (!u || !
|
|
40147
|
+
if (!u || !e) return;
|
|
40121
40148
|
let t = false,
|
|
40122
|
-
|
|
40149
|
+
a = null;
|
|
40123
40150
|
const s = () => {
|
|
40124
|
-
|
|
40151
|
+
a && (clearTimeout(a), a = null);
|
|
40125
40152
|
},
|
|
40126
40153
|
i = t => "loaded" === t ? (s(), g(true), m(null), true) : "error" === t && (s(), m("首章 PDF 加载失败,请确认 public 下存在对应 PDF 文件"), true);
|
|
40127
|
-
if (i(u.getChapterStatus(
|
|
40128
|
-
o && o > 0 && (
|
|
40154
|
+
if (i(u.getChapterStatus(e))) return;
|
|
40155
|
+
o && o > 0 && (a = setTimeout(() => {
|
|
40129
40156
|
if (t) return;
|
|
40130
|
-
const
|
|
40131
|
-
|
|
40157
|
+
const a = n?.(e);
|
|
40158
|
+
a || m(`首章 PDF 加载超时:${e}`);
|
|
40132
40159
|
}, o));
|
|
40133
|
-
const r = u.onChapterStatusChange(
|
|
40134
|
-
t ||
|
|
40160
|
+
const r = u.onChapterStatusChange(a => {
|
|
40161
|
+
t || a.chapterId !== e || i(a.status);
|
|
40135
40162
|
});
|
|
40136
|
-
return u.ensureChapterLoaded(
|
|
40163
|
+
return u.ensureChapterLoaded(e).then(e => {
|
|
40137
40164
|
t || i(e);
|
|
40138
40165
|
}), () => {
|
|
40139
40166
|
t = true, s(), r();
|
|
40140
40167
|
};
|
|
40141
|
-
}, [u,
|
|
40142
|
-
style:
|
|
40168
|
+
}, [u, e, o, n]), f ? /* @__PURE__ */u$1("div", {
|
|
40169
|
+
style: vs,
|
|
40143
40170
|
children: f
|
|
40144
|
-
}) : u ? p ? /* @__PURE__ */u$1(
|
|
40171
|
+
}) : u ? p ? /* @__PURE__ */u$1(Oa, {
|
|
40145
40172
|
...d,
|
|
40146
40173
|
children: l
|
|
40147
40174
|
}) : /* @__PURE__ */u$1("div", {
|
|
40148
|
-
style:
|
|
40149
|
-
children: ["正在加载 ",
|
|
40175
|
+
style: vs,
|
|
40176
|
+
children: ["正在加载 ", e, ".pdf…"]
|
|
40150
40177
|
}) : /* @__PURE__ */u$1("div", {
|
|
40151
|
-
style:
|
|
40178
|
+
style: vs,
|
|
40152
40179
|
children: "正在初始化章节管理器…"
|
|
40153
40180
|
});
|
|
40154
40181
|
}
|
|
40155
|
-
function
|
|
40156
|
-
engine:
|
|
40157
|
-
options:
|
|
40182
|
+
function Ps({
|
|
40183
|
+
engine: t,
|
|
40184
|
+
options: e,
|
|
40158
40185
|
editorOptions: s,
|
|
40159
40186
|
features: r,
|
|
40160
40187
|
className: n,
|
|
@@ -40172,12 +40199,12 @@ function fs({
|
|
|
40172
40199
|
plugins: b,
|
|
40173
40200
|
features: P
|
|
40174
40201
|
} = T$2(() => function (t) {
|
|
40175
|
-
if (t.options) return
|
|
40202
|
+
if (t.options) return fs(t.options);
|
|
40176
40203
|
if (!t.editorOptions) throw new Error("ChapterPdfViewer: 请传入 `options`(推荐),或同时传入 `editorOptions` 与 `features`");
|
|
40177
|
-
const e =
|
|
40204
|
+
const e = na(t.features),
|
|
40178
40205
|
{
|
|
40179
40206
|
plugins: a
|
|
40180
|
-
} =
|
|
40207
|
+
} = cs({
|
|
40181
40208
|
...t.editorOptions,
|
|
40182
40209
|
features: e
|
|
40183
40210
|
});
|
|
@@ -40190,25 +40217,25 @@ function fs({
|
|
|
40190
40217
|
}
|
|
40191
40218
|
};
|
|
40192
40219
|
}({
|
|
40193
|
-
options:
|
|
40220
|
+
options: e,
|
|
40194
40221
|
editorOptions: s,
|
|
40195
40222
|
features: r
|
|
40196
|
-
}), [s, r,
|
|
40223
|
+
}), [s, r, e]),
|
|
40197
40224
|
[w, I] = d$1(null);
|
|
40198
40225
|
return u$1("div", {
|
|
40199
40226
|
className: n,
|
|
40200
|
-
style: n ? void 0 :
|
|
40227
|
+
style: n ? void 0 : ie$1,
|
|
40201
40228
|
children: /* @__PURE__ */u$1(EmbedPDF, {
|
|
40202
|
-
engine:
|
|
40229
|
+
engine: t,
|
|
40203
40230
|
plugins: b,
|
|
40204
40231
|
onInitialized: async t => {
|
|
40205
40232
|
I(t), p?.(t);
|
|
40206
40233
|
},
|
|
40207
40234
|
children: ({
|
|
40208
|
-
pluginsReady:
|
|
40235
|
+
pluginsReady: t
|
|
40209
40236
|
}) => {
|
|
40210
|
-
if (!
|
|
40211
|
-
const
|
|
40237
|
+
if (!t) return null;
|
|
40238
|
+
const e = {
|
|
40212
40239
|
className: h,
|
|
40213
40240
|
features: P,
|
|
40214
40241
|
buildSelectionMenu: l,
|
|
@@ -40216,15 +40243,15 @@ function fs({
|
|
|
40216
40243
|
renderPageOverlay: u,
|
|
40217
40244
|
children: v
|
|
40218
40245
|
},
|
|
40219
|
-
s = w?.getPlugin(
|
|
40220
|
-
return g ? /* @__PURE__ */u$1(
|
|
40246
|
+
s = w?.getPlugin(xa.id)?.provides() ?? null;
|
|
40247
|
+
return g ? /* @__PURE__ */u$1(bs, {
|
|
40221
40248
|
chapterId: g,
|
|
40222
40249
|
chapterManager: s,
|
|
40223
40250
|
loadTimeoutMs: f,
|
|
40224
40251
|
onLoadTimeout: m,
|
|
40225
|
-
...
|
|
40226
|
-
}) : /* @__PURE__ */u$1(
|
|
40227
|
-
...
|
|
40252
|
+
...e
|
|
40253
|
+
}) : /* @__PURE__ */u$1(Oa, {
|
|
40254
|
+
...e
|
|
40228
40255
|
});
|
|
40229
40256
|
}
|
|
40230
40257
|
})
|
|
@@ -40311,7 +40338,7 @@ function getBookmarkCallbacks(input) {
|
|
|
40311
40338
|
* 将宿主传入的 options/editorInput 转为 editor-engine 选项,并把笔记/书签回调桥接为 CustomEvent。
|
|
40312
40339
|
*/
|
|
40313
40340
|
function buildEditorOptionsWithEvents(input, eventHost) {
|
|
40314
|
-
var base =
|
|
40341
|
+
var base = ms(input);
|
|
40315
40342
|
var sourceNoteCallbacks = getNoteCallbacks(input);
|
|
40316
40343
|
var sourceBookmarkCallbacks = getBookmarkCallbacks(input);
|
|
40317
40344
|
var noteCallbacks = _objectSpread2(_objectSpread2({}, sourceNoteCallbacks), {}, {
|
|
@@ -40398,7 +40425,7 @@ function ChapterApp(_ref) {
|
|
|
40398
40425
|
isLoading = _usePdfiumEngine.isLoading,
|
|
40399
40426
|
error = _usePdfiumEngine.error;
|
|
40400
40427
|
var features = T$2(function () {
|
|
40401
|
-
return _objectSpread2(_objectSpread2(_objectSpread2({},
|
|
40428
|
+
return _objectSpread2(_objectSpread2(_objectSpread2({}, ls), editorInput && 'features' in editorInput ? normalizeChapterViewerConfig(editorInput.features) : undefined), config.features);
|
|
40402
40429
|
}, [config.features, editorInput]);
|
|
40403
40430
|
var editorOptions = T$2(function () {
|
|
40404
40431
|
return editorInput ? buildEditorOptionsWithEvents(editorInput, eventHost) : null;
|
|
@@ -40457,7 +40484,7 @@ function ChapterApp(_ref) {
|
|
|
40457
40484
|
height: '100%',
|
|
40458
40485
|
minHeight: 0
|
|
40459
40486
|
},
|
|
40460
|
-
children: u$1(
|
|
40487
|
+
children: u$1(Ps, {
|
|
40461
40488
|
engine: engine,
|
|
40462
40489
|
editorOptions: editorOptions,
|
|
40463
40490
|
features: features,
|
|
@@ -44334,10 +44361,10 @@ var chapterSnippetRuntime = {
|
|
|
44334
44361
|
version: version,
|
|
44335
44362
|
EmbedPdfChapterContainer: EmbedPdfChapterContainer,
|
|
44336
44363
|
CHAPTER_SNIPPET_EVENTS: CHAPTER_SNIPPET_EVENTS,
|
|
44337
|
-
createChapterViewerEditorOptions:
|
|
44338
|
-
DEFAULT_CHAPTER_VIEWER_FEATURES:
|
|
44339
|
-
applySelectionMarkup:
|
|
44340
|
-
buildParagraphBookmarkAnchor:
|
|
44364
|
+
createChapterViewerEditorOptions: ms,
|
|
44365
|
+
DEFAULT_CHAPTER_VIEWER_FEATURES: ls,
|
|
44366
|
+
applySelectionMarkup: ra,
|
|
44367
|
+
buildParagraphBookmarkAnchor: Ye
|
|
44341
44368
|
};
|
|
44342
44369
|
if (typeof globalThis !== 'undefined') {
|
|
44343
44370
|
globalThis.__CHAPTER_SNIPPET__ = chapterSnippetRuntime;
|
|
@@ -60796,5 +60823,5 @@ var directEngine = /*#__PURE__*/Object.freeze({
|
|
|
60796
60823
|
createPdfiumEngine: createPdfiumEngine
|
|
60797
60824
|
});
|
|
60798
60825
|
|
|
60799
|
-
export { se as CHAPTER_ANNOTATIONS_ARCHIVE_VERSION, CHAPTER_SNIPPET_EVENTS, c as CallbackPasswordProvider, ChapterManagerPlugin,
|
|
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 };
|
|
60800
60827
|
//# sourceMappingURL=embedpdf-chapter.js.map
|