@prose-reader/archive-reader 1.349.0 → 1.350.0

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.
@@ -410,7 +410,7 @@ var B = "com.apple.ibooks.display-options.xml", pe = (e) => e.childrenNamed("opt
410
410
  }, je = (e, t) => {
411
411
  let n = C(e, t);
412
412
  if (n !== void 0) return f(n.encodingFormat ?? "") || o(n.basename);
413
- }, W = async (e, { opf: t, readingOrder: n } = {}) => {
413
+ }, Me = async (e, { opf: t, readingOrder: n } = {}) => {
414
414
  let r = t ?? await z(e).catch(() => void 0);
415
415
  if (r !== void 0 && r.opf.coverHref !== void 0) {
416
416
  let t = we(r.opf.coverHref, r.basePath);
@@ -426,10 +426,10 @@ var B = "com.apple.ibooks.display-options.xml", pe = (e) => e.childrenNamed("opt
426
426
  mediaType: i.mediaType,
427
427
  confidence: "assumed"
428
428
  });
429
- }, Me = (e) => {
429
+ }, Ne = (e) => {
430
430
  let t = e.descendantWithPath("head")?.childrenNamed("meta").find((e) => e.attr.name === "viewport");
431
431
  return !!(t && t.attr.name === "viewport");
432
- }, Ne = async (e, n) => {
432
+ }, Pe = async (e, n) => {
433
433
  if (n.length === 0) return !1;
434
434
  for (let r of n) {
435
435
  if (!d({
@@ -439,37 +439,37 @@ var B = "com.apple.ibooks.display-options.xml", pe = (e) => e.childrenNamed("opt
439
439
  let n = C(e, r.uri);
440
440
  if (!n || !x(n)) return !1;
441
441
  try {
442
- if (!Me(new h(await D(n)))) return !1;
442
+ if (!Ne(new h(await D(n)))) return !1;
443
443
  } catch (e) {
444
444
  return t.error(`layout scan: unable to inspect ${r.uri}`, e), !1;
445
445
  }
446
446
  }
447
447
  return !0;
448
- }, Pe = B.toLowerCase();
449
- async function Fe(e) {
450
- let t = e.records.find((e) => x(e) && e.basename.toLowerCase() === Pe);
448
+ }, Fe = B.toLowerCase();
449
+ async function Ie(e) {
450
+ let t = e.records.find((e) => x(e) && e.basename.toLowerCase() === Fe);
451
451
  if (t) return me(await D(t));
452
452
  }
453
453
  //#endregion
454
454
  //#region src/metadata/comicInfo/getArchiveHasComicInfo.ts
455
- var Ie = V.toLowerCase(), Le = (e) => e.records.find((e) => x(e) && e.basename.toLowerCase() === Ie), Re = [
455
+ var Le = V.toLowerCase(), Re = (e) => e.records.find((e) => x(e) && e.basename.toLowerCase() === Le), ze = [
456
456
  "Unknown",
457
457
  "No",
458
458
  "Yes",
459
459
  "YesAndRightToLeft"
460
- ], ze = (e) => {
461
- for (let t of Re) if (t === e) return !0;
460
+ ], Be = (e) => {
461
+ for (let t of ze) if (t === e) return !0;
462
462
  return !1;
463
463
  };
464
464
  //#endregion
465
465
  //#region src/metadata/comicInfo/readArchiveComicInfo.ts
466
- async function Be(e) {
467
- let t = Le(e);
466
+ async function Ve(e) {
467
+ let t = Re(e);
468
468
  if (t) return ye(await D(t));
469
469
  }
470
470
  //#endregion
471
471
  //#region src/metadata/kobo/readArchiveKobo.ts
472
- async function Ve(e) {
472
+ async function He(e) {
473
473
  let n = e.records.filter((e) => x(e) && e.uri.endsWith("com.kobobooks.display-options.xml"));
474
474
  if (n.length === 0) return;
475
475
  let r;
@@ -489,11 +489,11 @@ async function Ve(e) {
489
489
  }
490
490
  //#endregion
491
491
  //#region src/metadata/opf/getSpineItemFilesFromArchive.ts
492
- var He = async ({ archive: e, archiveOpf: t }) => {
492
+ var Ue = async ({ archive: e, archiveOpf: t }) => {
493
493
  if (!t) return [];
494
494
  let { opf: n, basePath: r } = t, { spineRows: i } = n;
495
495
  return e.records.filter((e) => i.find((t) => r ? `${r}/${t.href}` === e.uri : `${t.href}` === e.uri));
496
- }, Ue = (e) => e.toLowerCase().endsWith(".opf"), We = (e) => e.records.some((e) => !e.dir && (Ue(e.basename) || Ue(e.uri))), Ge = (e) => {
496
+ }, We = (e) => e.toLowerCase().endsWith(".opf"), Ge = (e) => e.records.some((e) => !e.dir && (We(e.basename) || We(e.uri))), Ke = (e) => {
497
497
  let t = e.displayOptions?.platform?.options, n = t?.find((e) => e.name === "fixed-layout")?.value.trim().toLowerCase(), r = n === "true" || n !== "false" && void 0, i = H({
498
498
  fixedLayout: r,
499
499
  options: t !== void 0 && t.length > 0 ? t.map(({ name: e, value: t }) => H({
@@ -505,46 +505,46 @@ var He = async ({ archive: e, archiveOpf: t }) => {
505
505
  renditionLayout: r === !0 ? "pre-paginated" : void 0,
506
506
  apple: Object.keys(i).length > 0 ? i : void 0
507
507
  });
508
- }, Ke = (e) => {
508
+ }, qe = (e) => {
509
509
  switch (e.Manga) {
510
510
  case "YesAndRightToLeft": return "rtl";
511
511
  case "Yes":
512
512
  case "No": return "ltr";
513
513
  default: return;
514
514
  }
515
- }, G = (e) => {
515
+ }, W = (e) => {
516
516
  if (e === void 0) return;
517
517
  let t = e.trim();
518
518
  return t.length > 0 ? t : void 0;
519
- }, K = (e) => e === void 0 ? [] : e.split(",").map((e) => e.trim()).filter((e) => e.length > 0), q = (e) => {
520
- let t = G(e);
519
+ }, G = (e) => e === void 0 ? [] : e.split(",").map((e) => e.trim()).filter((e) => e.length > 0), K = (e) => {
520
+ let t = W(e);
521
521
  if (t === void 0 || !/^\d+$/.test(t)) return;
522
522
  let n = Number.parseInt(t, 10);
523
523
  return Number.isFinite(n) ? n : void 0;
524
- }, J = (e) => {
525
- let t = G(e);
524
+ }, q = (e) => {
525
+ let t = W(e);
526
526
  if (t === void 0 || !/^\d+(\.\d+)?$/.test(t)) return;
527
527
  let n = Number.parseFloat(t);
528
528
  return Number.isFinite(n) ? n : void 0;
529
- }, qe = (e) => {
530
- let t = G(e)?.toLowerCase();
529
+ }, Je = (e) => {
530
+ let t = W(e)?.toLowerCase();
531
531
  if (t === "yes") return !0;
532
532
  if (t === "no") return !1;
533
- }, Je = (e) => {
533
+ }, Ye = (e) => {
534
534
  switch (e.Manga) {
535
535
  case "Yes":
536
536
  case "YesAndRightToLeft": return !0;
537
537
  case "No": return !1;
538
538
  default: return;
539
539
  }
540
- }, Ye = (e) => {
541
- let t = q(e.Year), n = q(e.Month), r = q(e.Day);
540
+ }, Xe = (e) => {
541
+ let t = K(e.Year), n = K(e.Month), r = K(e.Day);
542
542
  if (!(t === void 0 && n === void 0 && r === void 0)) return {
543
543
  ...t === void 0 ? {} : { year: t },
544
544
  ...n === void 0 ? {} : { month: n },
545
545
  ...r === void 0 ? {} : { day: r }
546
546
  };
547
- }, Xe = [
547
+ }, Ze = [
548
548
  ["Writer", "author"],
549
549
  ["Penciller", "penciler"],
550
550
  ["Inker", "inker"],
@@ -553,9 +553,9 @@ var He = async ({ archive: e, archiveOpf: t }) => {
553
553
  ["CoverArtist", "coverArtist"],
554
554
  ["Editor", "editor"],
555
555
  ["Translator", "translator"]
556
- ], Ze = (e) => {
556
+ ], Qe = (e) => {
557
557
  let t = /* @__PURE__ */ new Map();
558
- for (let [n, r] of Xe) for (let i of K(e[n])) {
558
+ for (let [n, r] of Ze) for (let i of G(e[n])) {
559
559
  let e = t.get(i);
560
560
  e ? e.roles.includes(r) || e.roles.push(r) : t.set(i, {
561
561
  name: i,
@@ -563,105 +563,108 @@ var He = async ({ archive: e, archiveOpf: t }) => {
563
563
  });
564
564
  }
565
565
  return [...t.values()];
566
- }, Qe = (e) => {
566
+ }, $e = (e) => {
567
567
  let t = H({
568
- name: G(e.Series),
569
- position: J(e.Number),
570
- total: q(e.Count)
568
+ name: W(e.Series),
569
+ position: q(e.Number),
570
+ total: K(e.Count)
571
571
  });
572
572
  return Object.keys(t).length > 0 ? t : void 0;
573
- }, $e = (e) => {
574
- let t = G(e.AlternateSeries);
573
+ }, et = (e) => {
574
+ let t = W(e.AlternateSeries);
575
575
  if (t !== void 0) return H({
576
576
  name: t,
577
- position: J(e.AlternateNumber),
578
- total: q(e.AlternateCount)
577
+ position: q(e.AlternateNumber),
578
+ total: K(e.AlternateCount)
579
579
  });
580
- }, et = (e) => {
581
- let t = K(e.StoryArc);
580
+ }, tt = (e) => {
581
+ let t = G(e.StoryArc);
582
582
  if (t.length === 0) return [];
583
- let n = K(e.StoryArcNumber);
583
+ let n = G(e.StoryArcNumber);
584
584
  return t.map((e, t) => H({
585
585
  name: e,
586
- position: J(n[t])
586
+ position: q(n[t])
587
587
  }));
588
- }, Y = (e) => e.length > 0 ? e : void 0, tt = (e) => (e.Web ?? "").split(/\s+/).filter((e) => e.length > 0), nt = (e) => {
588
+ }, J = (e) => e.length > 0 ? e : void 0, nt = (e) => (e.Web ?? "").split(/\s+/).filter((e) => e.length > 0), rt = (e) => {
589
589
  try {
590
590
  let t = new URL(e);
591
591
  return (t.protocol === "http:" || t.protocol === "https:") && t.hostname.length > 0;
592
592
  } catch {
593
593
  return !1;
594
594
  }
595
- }, rt = (e) => e.filter((e, t, n) => nt(e) && n.indexOf(e) === t).map((e) => ({
595
+ }, it = (e) => e.filter((e, t, n) => rt(e) && n.indexOf(e) === t).map((e) => ({
596
596
  value: e,
597
597
  scheme: "URL"
598
- })), it = (e, t) => {
598
+ })), at = (e, t) => {
599
599
  let n = H({
600
- manga: Je(e),
601
- blackAndWhite: qe(e.BlackAndWhite),
602
- volume: q(e.Volume),
603
- format: G(e.Format),
604
- ageRating: G(e.AgeRating),
605
- communityRating: J(e.CommunityRating),
606
- notes: G(e.Notes),
607
- review: G(e.Review),
608
- web: Y(t),
609
- scanInformation: G(e.ScanInformation),
610
- mainCharacterOrTeam: G(e.MainCharacterOrTeam),
611
- characters: Y(K(e.Characters)),
612
- teams: Y(K(e.Teams)),
613
- locations: Y(K(e.Locations)),
614
- storyArcs: Y(et(e)),
615
- alternateSeries: $e(e)
600
+ manga: Ye(e),
601
+ blackAndWhite: Je(e.BlackAndWhite),
602
+ volume: K(e.Volume),
603
+ format: W(e.Format),
604
+ ageRating: W(e.AgeRating),
605
+ notes: W(e.Notes),
606
+ review: W(e.Review),
607
+ web: J(t),
608
+ scanInformation: W(e.ScanInformation),
609
+ mainCharacterOrTeam: W(e.MainCharacterOrTeam),
610
+ characters: J(G(e.Characters)),
611
+ teams: J(G(e.Teams)),
612
+ locations: J(G(e.Locations)),
613
+ storyArcs: J(tt(e)),
614
+ alternateSeries: et(e)
616
615
  });
617
616
  return Object.keys(n).length > 0 ? n : void 0;
618
- }, at = (e) => {
619
- let t = Qe(e), n = Y(K(e.SeriesGroup).map((e) => ({ name: e })));
617
+ }, ot = (e) => {
618
+ let t = q(e.CommunityRating);
619
+ return t !== void 0 && t <= 5 ? { value: t } : void 0;
620
+ }, st = (e) => {
621
+ let t = $e(e), n = J(G(e.SeriesGroup).map((e) => ({ name: e })));
620
622
  if (!(t === void 0 && n === void 0)) return H({
621
623
  series: t === void 0 ? void 0 : [t],
622
624
  collection: n
623
625
  });
624
- }, ot = (e) => {
625
- let t = e.GTIN, n = G(t), r = tt(e), i = [...n === void 0 ? [] : [{
626
+ }, ct = (e) => {
627
+ let t = e.GTIN, n = W(t), r = nt(e), i = [...n === void 0 ? [] : [{
626
628
  value: n,
627
629
  scheme: "GTIN"
628
- }], ...rt(r)], a = G(e.LanguageISO), o = [...K(e.Genre), ...K(e.Tags)], s = H({
629
- date: Ye(e),
630
- publisher: G(e.Publisher),
631
- imprint: G(e.Imprint)
632
- }), c = G(e.Title);
630
+ }], ...it(r)], a = W(e.LanguageISO), o = [...G(e.Genre), ...G(e.Tags)], s = H({
631
+ date: Xe(e),
632
+ publisher: W(e.Publisher),
633
+ imprint: W(e.Imprint)
634
+ }), c = W(e.Title);
633
635
  return H({
634
636
  titles: c === void 0 ? void 0 : [{ value: c }],
635
- description: G(e.Summary),
637
+ description: W(e.Summary),
636
638
  publication: s.date !== void 0 || s.publisher !== void 0 || s.imprint !== void 0 ? { edition: s } : void 0,
637
639
  languages: a === void 0 ? void 0 : [a],
638
- subjects: Y(o),
639
- contributors: Y(Ze(e)),
640
- readingDirection: Ke(e),
641
- numberOfPages: q(e.PageCount),
642
- identifiers: Y(i),
643
- belongsTo: at(e),
644
- comicInfo: it(e, r)
640
+ subjects: J(o),
641
+ contributors: J(Qe(e)),
642
+ readingDirection: qe(e),
643
+ numberOfPages: K(e.PageCount),
644
+ aggregateRating: ot(e),
645
+ identifiers: J(i),
646
+ belongsTo: st(e),
647
+ comicInfo: at(e, r)
645
648
  });
646
- }, st = (e) => H({
649
+ }, lt = (e) => H({
647
650
  renditionLayout: e.renditionLayout,
648
651
  kobo: e.renditionLayout === void 0 ? void 0 : { fixedLayout: e.renditionLayout === "pre-paginated" }
649
- }), ct = /* @__PURE__ */ new Set([
652
+ }), ut = /* @__PURE__ */ new Set([
650
653
  8,
651
654
  12,
652
655
  13,
653
656
  14
654
- ]), lt = (e) => {
657
+ ]), dt = (e) => {
655
658
  if (e == null) return;
656
659
  let t = String(e).replace(/\D/g, "");
657
- if (!(t.length === 0 || !ct.has(t.length))) return t;
658
- }, ut = /(?:97[89])?\d{9}[\dXx]/, dt = (e) => {
660
+ if (!(t.length === 0 || !ut.has(t.length))) return t;
661
+ }, ft = /(?:97[89])?\d{9}[\dXx]/, pt = (e) => {
659
662
  if (e == null) return;
660
663
  let t = String(e).trim().replace(/^urn:isbn:/i, "").replace(/^isbn[:\s-]*/i, ""), n = t.replace(/[^0-9Xx]/g, "");
661
664
  if (n.length === 10 || n.length === 13) return n.toUpperCase();
662
- let r = t.match(ut);
665
+ let r = t.match(ft);
663
666
  if (r) return r[0].toUpperCase();
664
- }, ft = (e) => {
667
+ }, mt = (e) => {
665
668
  if (e === void 0) return;
666
669
  let t = e.trim().match(/^(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?/);
667
670
  if (t === null) return;
@@ -671,15 +674,15 @@ var He = async ({ archive: e, archiveOpf: t }) => {
671
674
  ...r === void 0 ? {} : { month: Number.parseInt(r, 10) },
672
675
  ...i === void 0 ? {} : { day: Number.parseInt(i, 10) }
673
676
  };
674
- }, pt = (e) => {
677
+ }, ht = (e) => {
675
678
  let t = e.trim();
676
679
  if (/^https?:\/\//i.test(t)) try {
677
680
  let e = new URL(t);
678
681
  if ((e.protocol === "http:" || e.protocol === "https:") && e.hostname.length > 0) return "URL";
679
682
  } catch {}
680
- let n = dt(t);
681
- return n !== void 0 && (n.length === 10 || /^97[89]/.test(n)) ? "ISBN" : lt(t) === void 0 ? "Unknown" : "GTIN";
682
- }, mt = (e) => {
683
+ let n = pt(t);
684
+ return n !== void 0 && (n.length === 10 || /^97[89]/.test(n)) ? "ISBN" : dt(t) === void 0 ? "Unknown" : "GTIN";
685
+ }, gt = (e) => {
683
686
  switch (e.trim().toLowerCase()) {
684
687
  case "isbn": return "ISBN";
685
688
  case "gtin": return "GTIN";
@@ -691,7 +694,7 @@ var He = async ({ archive: e, archiveOpf: t }) => {
691
694
  case "unknown": return "Unknown";
692
695
  default: return e.trim();
693
696
  }
694
- }, ht = {
697
+ }, _t = {
695
698
  art: "artist",
696
699
  aut: "author",
697
700
  clr: "colorist",
@@ -700,14 +703,14 @@ var He = async ({ archive: e, archiveOpf: t }) => {
700
703
  ill: "illustrator",
701
704
  nrt: "narrator",
702
705
  trl: "translator"
703
- }, gt = (e) => e.map((e) => {
704
- let t = e.roles.map((e) => ht[e.trim().toLowerCase()] ?? e);
706
+ }, vt = (e) => e.map((e) => {
707
+ let t = e.roles.map((e) => _t[e.trim().toLowerCase()] ?? e);
705
708
  return H({
706
709
  name: e.name,
707
710
  roles: t.length > 0 ? t : [e.source === "creator" ? "author" : "contributor"],
708
711
  sortAs: e.fileAs
709
712
  });
710
- }), X = (e, t) => e.refines !== void 0 && e.refines.replace(/^#/, "") === t, _t = {
713
+ }), Y = (e, t) => e.refines !== void 0 && e.refines.replace(/^#/, "") === t, yt = {
711
714
  "02": "ISBN",
712
715
  "03": "GTIN",
713
716
  "04": "UPC",
@@ -723,49 +726,49 @@ var He = async ({ archive: e, archiveOpf: t }) => {
723
726
  26: "DOI",
724
727
  34: "GTIN",
725
728
  35: "ARK"
726
- }, vt = (e) => {
729
+ }, bt = (e) => {
727
730
  let t = e?.value?.trim();
728
- if (!(t === void 0 || t.length === 0)) return e?.scheme?.trim().toLowerCase() === "onix:codelist5" ? _t[t] ?? t : t;
729
- }, yt = (e, t) => {
731
+ if (!(t === void 0 || t.length === 0)) return e?.scheme?.trim().toLowerCase() === "onix:codelist5" ? yt[t] ?? t : t;
732
+ }, xt = (e, t) => {
730
733
  let n = e.id;
731
- if (n !== void 0) return vt(t.find((e) => e.property === "identifier-type" && X(e, n) && e.value !== void 0));
732
- }, bt = (e) => {
734
+ if (n !== void 0) return bt(t.find((e) => e.property === "identifier-type" && Y(e, n) && e.value !== void 0));
735
+ }, St = (e) => {
733
736
  let t = e?.trim();
734
737
  if (t === void 0 || !/^\d+(\.\d+)?$/.test(t)) return;
735
738
  let n = Number.parseFloat(t);
736
739
  return Number.isFinite(n) ? n : void 0;
737
- }, xt = (e) => {
740
+ }, Ct = (e) => {
738
741
  let t = e?.trim();
739
742
  if (t === void 0 || !/^\d+$/.test(t)) return;
740
743
  let n = Number.parseInt(t, 10);
741
744
  return Number.isFinite(n) ? n : void 0;
742
- }, Z = (e) => {
745
+ }, X = (e) => {
743
746
  let t = e?.trim();
744
747
  return t !== void 0 && t.length > 0 ? t : void 0;
745
- }, Q = (e, t, n) => t === void 0 ? void 0 : e.find((e) => X(e, t) && e.property === n && e.value !== void 0)?.value, St = (e, t) => e.map((e) => H({
748
+ }, Z = (e, t, n) => t === void 0 ? void 0 : e.find((e) => Y(e, t) && e.property === n && e.value !== void 0)?.value, wt = (e, t) => e.map((e) => H({
746
749
  value: e.value,
747
- type: Z(Q(t, e.id, "title-type"))?.toLowerCase(),
748
- displaySeq: xt(Q(t, e.id, "display-seq")),
749
- sortAs: Z(Q(t, e.id, "file-as"))
750
- })), Ct = (e, t) => {
750
+ type: X(Z(t, e.id, "title-type"))?.toLowerCase(),
751
+ displaySeq: Ct(Z(t, e.id, "display-seq")),
752
+ sortAs: X(Z(t, e.id, "file-as"))
753
+ })), Tt = (e, t) => {
751
754
  if (t === void 0) return;
752
755
  let n = e.flatMap((n) => {
753
- if (!X(n, t) || n.property !== "dcterms:identifier") return [];
754
- let r = Z(n.value);
756
+ if (!Y(n, t) || n.property !== "dcterms:identifier") return [];
757
+ let r = X(n.value);
755
758
  return r === void 0 ? [] : [{
756
759
  value: r,
757
- scheme: mt(vt(e.find((e) => n.id !== void 0 && X(e, n.id) && e.property === "identifier-type")) ?? pt(r))
760
+ scheme: gt(bt(e.find((e) => n.id !== void 0 && Y(e, n.id) && e.property === "identifier-type")) ?? ht(r))
758
761
  }];
759
762
  });
760
763
  return n.length > 0 ? n : void 0;
761
- }, wt = (e) => {
764
+ }, Et = (e) => {
762
765
  let t = [], n = [];
763
766
  for (let r of e) {
764
767
  if (r.property !== "belongs-to-collection" || r.value === void 0) continue;
765
- let i = r.id, a = (t) => Q(e, i, t), o = a("collection-type")?.trim().toLowerCase(), s = H({
768
+ let i = r.id, a = (t) => Z(e, i, t), o = a("collection-type")?.trim().toLowerCase(), s = H({
766
769
  name: r.value,
767
- identifiers: Ct(e, i),
768
- position: bt(a("group-position"))
770
+ identifiers: Tt(e, i),
771
+ position: St(a("group-position"))
769
772
  });
770
773
  o === "series" ? t.push(s) : n.push(s);
771
774
  }
@@ -773,25 +776,25 @@ var He = async ({ archive: e, archiveOpf: t }) => {
773
776
  let n = e.find((e) => e.name?.toLowerCase() === "calibre:series" && e.content !== void 0)?.content;
774
777
  n !== void 0 && t.push(H({
775
778
  name: n,
776
- position: bt(e.find((e) => e.name?.toLowerCase() === "calibre:series_index")?.content)
779
+ position: St(e.find((e) => e.name?.toLowerCase() === "calibre:series_index")?.content)
777
780
  }));
778
781
  }
779
782
  return {
780
783
  series: t,
781
784
  collection: n
782
785
  };
783
- }, Tt = (e) => {
786
+ }, Dt = (e) => {
784
787
  let t = e?.trim();
785
788
  if (t === "scrolled-continuous" || t === "scrolled-doc" || t === "paginated" || t === "auto") return t;
786
- }, Et = (e) => {
789
+ }, Ot = (e) => {
787
790
  let t = e?.trim();
788
791
  if (t === "none" || t === "landscape" || t === "portrait" || t === "both" || t === "auto") return t;
789
- }, Dt = (e) => {
790
- let { titles: t, contributors: n, publisher: r, description: i, rights: a, languages: o, subjects: s, date: c, renditionLayoutMeta: l, renditionFlowMeta: u, renditionSpreadMeta: d, pageProgressionDirection: f, identifiers: p, metas: m, kind: h, creators: g, manifestItems: _, spineRows: v, spineTocIdref: y, coverHref: b, guide: x, ...S } = e, C = f?.trim().toLowerCase(), w = C === "ltr" || C === "rtl" ? C : void 0, T = l?.trim().toLowerCase(), E = T === "reflowable" || T === "pre-paginated" ? T : void 0, D = gt(n), O = St(t, m), { series: k, collection: A } = wt(m), j = k.length > 0 || A.length > 0 ? H({
792
+ }, kt = (e) => {
793
+ let { titles: t, contributors: n, publisher: r, description: i, rights: a, languages: o, subjects: s, date: c, renditionLayoutMeta: l, renditionFlowMeta: u, renditionSpreadMeta: d, pageProgressionDirection: f, identifiers: p, metas: m, kind: h, creators: g, manifestItems: _, spineRows: v, spineTocIdref: y, coverHref: b, guide: x, ...S } = e, C = f?.trim().toLowerCase(), w = C === "ltr" || C === "rtl" ? C : void 0, T = l?.trim().toLowerCase(), E = T === "reflowable" || T === "pre-paginated" ? T : void 0, D = vt(n), O = wt(t, m), { series: k, collection: A } = Et(m), j = k.length > 0 || A.length > 0 ? H({
791
794
  series: k.length > 0 ? k : void 0,
792
795
  collection: A.length > 0 ? A : void 0
793
796
  }) : void 0, M = H({
794
- date: ft(c),
797
+ date: mt(c),
795
798
  publisher: r
796
799
  });
797
800
  return H({
@@ -804,18 +807,18 @@ var He = async ({ archive: e, archiveOpf: t }) => {
804
807
  contributors: D.length > 0 ? D : void 0,
805
808
  readingDirection: w,
806
809
  renditionLayout: E,
807
- renditionFlow: Tt(u),
808
- renditionSpread: Et(d),
810
+ renditionFlow: Dt(u),
811
+ renditionSpread: Ot(d),
809
812
  identifiers: p.length > 0 ? p.map((e) => H({
810
813
  value: e.value,
811
- scheme: mt(e.scheme ?? yt(e, m) ?? pt(e.value)),
814
+ scheme: gt(e.scheme ?? xt(e, m) ?? ht(e.value)),
812
815
  unique: e.unique
813
816
  })) : void 0,
814
817
  belongsTo: j,
815
818
  properties: m.length > 0 ? [...m] : void 0
816
819
  });
817
- }, Ot = (e) => e.kind === "comicInfo" ? ot(e) : e.kind === "kobo" ? st(e) : e.kind === "apple" ? Ge(e) : Dt(e), kt = (e) => {
818
- let t = e.opf === void 0 ? void 0 : Dt(e.opf), n = e.comicInfo === void 0 ? void 0 : ot(e.comicInfo), r = e.apple === void 0 ? void 0 : Ge(e.apple), i = e.kobo === void 0 ? void 0 : st(e.kobo), a = [...t?.identifiers ?? [], ...n?.identifiers ?? []], o = H({
820
+ }, At = (e) => e.kind === "comicInfo" ? ct(e) : e.kind === "kobo" ? lt(e) : e.kind === "apple" ? Ke(e) : kt(e), jt = (e) => {
821
+ let t = e.opf === void 0 ? void 0 : kt(e.opf), n = e.comicInfo === void 0 ? void 0 : ct(e.comicInfo), r = e.apple === void 0 ? void 0 : Ke(e.apple), i = e.kobo === void 0 ? void 0 : lt(e.kobo), a = [...t?.identifiers ?? [], ...n?.identifiers ?? []], o = H({
819
822
  date: t?.publication?.edition?.date ?? n?.publication?.edition?.date,
820
823
  publisher: t?.publication?.edition?.publisher ?? n?.publication?.edition?.publisher,
821
824
  imprint: t?.publication?.edition?.imprint ?? n?.publication?.edition?.imprint
@@ -833,6 +836,7 @@ var He = async ({ archive: e, archiveOpf: t }) => {
833
836
  renditionFlow: t?.renditionFlow,
834
837
  renditionSpread: t?.renditionSpread,
835
838
  numberOfPages: n?.numberOfPages,
839
+ aggregateRating: n?.aggregateRating,
836
840
  identifiers: a.length > 0 ? a : void 0,
837
841
  belongsTo: t?.belongsTo ?? n?.belongsTo,
838
842
  properties: t?.properties,
@@ -840,7 +844,7 @@ var He = async ({ archive: e, archiveOpf: t }) => {
840
844
  apple: r?.apple,
841
845
  kobo: i?.kobo
842
846
  });
843
- }, At = (e) => {
847
+ }, Mt = (e) => {
844
848
  let t = [...e.records].sort((e, t) => p(e.uri, t.uri)), n = (e, t, r, i, a) => {
845
849
  let o = e.find((e) => e.title === t), [s, ...c] = r;
846
850
  return o ? s ? [...e.filter((e) => e !== o), {
@@ -869,71 +873,71 @@ var He = async ({ archive: e, archiveOpf: t }) => {
869
873
  let a = encodeURI(t.uri).replace(/#/g, "%23").replace(/\?/g, "%3F").replace(/\/$/, ""), o = t.uri.replace(/\/$/, "");
870
874
  return n(e, r, i, a, o);
871
875
  }, []);
872
- }, jt = (e) => e ? e.children.map((e) => e instanceof _ ? e.text : e instanceof g ? jt(e) : "").join("").trim() : "", Mt = (e) => k(e.properties).includes("nav"), Nt = (e, { basePath: t }) => {
876
+ }, Nt = (e) => e ? e.children.map((e) => e instanceof _ ? e.text : e instanceof g ? Nt(e) : "").join("").trim() : "", Pt = (e) => k(e.properties).includes("nav"), Q = (e, { basePath: t }) => {
873
877
  let n = {
874
878
  contents: [],
875
879
  path: "",
876
880
  containerHref: "",
877
881
  title: ""
878
882
  }, r = e.childNamed("span") || e.childNamed("a");
879
- n.title = (r?.attr.title || r?.val.trim() || jt(r)) ?? "";
883
+ n.title = (r?.attr.title || r?.val.trim() || Nt(r)) ?? "";
880
884
  let i = r?.name;
881
885
  i !== "a" && (r = e.descendantWithPath(`${i}.a`), r && (i = r.name.toLowerCase())), i === "a" && r?.attr.href && (n.path = m(t, r.attr.href), n.containerHref = n.path);
882
886
  let a = e.childNamed("ol");
883
887
  if (a) {
884
888
  let e = a.childrenNamed("li");
885
- e && e.length > 0 && (n.contents = e.map((e) => Nt(e, { basePath: t })));
889
+ e && e.length > 0 && (n.contents = e.map((e) => Q(e, { basePath: t })));
886
890
  }
887
891
  return n;
888
- }, Pt = (e, { basePath: t }) => {
892
+ }, Ft = (e, { basePath: t }) => {
889
893
  let n = [], r;
890
894
  return e.descendantWithPath("body.nav.ol") ? r = e.descendantWithPath("body.nav.ol")?.children : e.descendantWithPath("body.section.nav.ol") && (r = e.descendantWithPath("body.section.nav.ol")?.children), r && r.length > 0 && r.filter((e) => e instanceof g && e.name === "li").forEach((e) => {
891
- n.push(Nt(e, { basePath: t }));
895
+ n.push(Q(e, { basePath: t }));
892
896
  }), n;
893
- }, Ft = async (e, t) => {
894
- let n = e.manifestItems.find(Mt);
897
+ }, It = async (e, t) => {
898
+ let n = e.manifestItems.find(Pt);
895
899
  if (n?.href) {
896
900
  let e = t.records.find((e) => e.uri.endsWith(n.href));
897
- if (e && !e.dir) return Pt(new h(await D(e)), { basePath: c(e.uri) });
901
+ if (e && !e.dir) return Ft(new h(await D(e)), { basePath: c(e.uri) });
898
902
  }
899
- }, It = (e, { basePath: t, prefix: n }) => {
903
+ }, Lt = (e, { basePath: t, prefix: n }) => {
900
904
  let r = m(t, e?.childNamed(`${n}content`)?.attr.src || ""), i = {
901
905
  title: e?.descendantWithPath(`${n}navLabel.${n}text`)?.val || "",
902
906
  path: r,
903
907
  containerHref: r,
904
908
  contents: []
905
909
  }, a = e.childrenNamed(`${n}navPoint`);
906
- return a && a.length > 0 && (i.contents = a.map((e) => It(e, {
910
+ return a && a.length > 0 && (i.contents = a.map((e) => Lt(e, {
907
911
  basePath: t,
908
912
  prefix: n
909
913
  }))), i;
910
- }, Lt = (e, { basePath: t }) => {
914
+ }, Rt = (e, { basePath: t }) => {
911
915
  let n = [], r = e.name, i = "";
912
916
  return r.indexOf(":") !== -1 && (i = `${r.split(":")[0]}:`), e.childNamed(`${i}navMap`)?.childrenNamed(`${i}navPoint`).forEach((e) => {
913
- n.push(It(e, {
917
+ n.push(Lt(e, {
914
918
  basePath: t,
915
919
  prefix: i
916
920
  }));
917
921
  }), n;
918
- }, Rt = async ({ opf: e, opfBasePath: t, archive: n }) => {
922
+ }, zt = async ({ opf: e, opfBasePath: t, archive: n }) => {
919
923
  let r = e.spineTocIdref;
920
924
  if (r) {
921
925
  let i = e.manifestItems.find((e) => e.id === r);
922
926
  if (i) {
923
927
  let e = `${t}${t === "" ? "" : "/"}${i.href}`, r = n.records.find((t) => t.uri.endsWith(e));
924
- if (r && !r.dir) return Lt(new h(await D(r)), { basePath: c(r.uri) });
928
+ if (r && !r.dir) return Rt(new h(await D(r)), { basePath: c(r.uri) });
925
929
  }
926
930
  }
927
- }, zt = async (e, { opf: t } = {}) => {
931
+ }, Bt = async (e, { opf: t } = {}) => {
928
932
  let n = t ?? await z(e);
929
- if (n) return await Ft(n.opf, e) || await Rt({
933
+ if (n) return await It(n.opf, e) || await zt({
930
934
  opf: n.opf,
931
935
  opfBasePath: n.basePath,
932
936
  archive: e
933
937
  }) || [];
934
- let r = At(e);
938
+ let r = Mt(e);
935
939
  return r.length === 0 ? void 0 : r;
936
- }, Bt = [
940
+ }, Vt = [
937
941
  "metadata",
938
942
  "readingOrder",
939
943
  "toc"
@@ -949,39 +953,39 @@ var He = async ({ archive: e, archiveOpf: t }) => {
949
953
  failed: !0
950
954
  };
951
955
  }
952
- }, Vt = (e) => {
956
+ }, Ht = (e) => {
953
957
  let t = (e) => e?.startsWith("audio/") === !0 || e?.startsWith("video/") === !0, n = e.filter((e) => e.renditionLayout === "pre-paginated" && !t(e.mediaType)).length;
954
958
  return n > 0 ? n : void 0;
955
- }, Ht = ({ archive: e, opf: t, comicInfo: n, apple: r, kobo: i }) => {
959
+ }, Ut = ({ archive: e, opf: t, comicInfo: n, apple: r, kobo: i }) => {
956
960
  let a = [];
957
- return t !== void 0 && t.value === void 0 && (t.failed || We(e)) && a.push("opf"), n?.failed && a.push("comicInfo"), r?.failed && a.push("apple"), i?.failed && a.push("kobo"), a;
958
- }, Ut = 3, Wt = async (e, t = {}) => {
959
- let n = new Set(t.include ?? Bt), r = n.has("metadata"), i = n.has("sources"), a = n.has("readingOrder"), o = n.has("toc"), s = t.layoutScan === !0 && (r || a), c = r || i || a || o ? await $(() => z(e), "opf") : void 0, l = c?.value, u = r || i || s, d = u ? await $(() => Be(e), "comicInfo") : void 0, f = d?.value, p = u ? await $(() => Fe(e), "apple") : void 0, m = p?.value, h = u ? await $(() => Ve(e), "kobo") : void 0, g = h?.value, _ = r || s ? kt({
961
+ return t !== void 0 && t.value === void 0 && (t.failed || Ge(e)) && a.push("opf"), n?.failed && a.push("comicInfo"), r?.failed && a.push("apple"), i?.failed && a.push("kobo"), a;
962
+ }, Wt = 3, Gt = async (e, t = {}) => {
963
+ let n = new Set(t.include ?? Vt), r = n.has("metadata"), i = n.has("sources"), a = n.has("readingOrder"), o = n.has("toc"), s = t.layoutScan === !0 && (r || a), c = r || i || a || o ? await $(() => z(e), "opf") : void 0, l = c?.value, u = r || i || s, d = u ? await $(() => Ve(e), "comicInfo") : void 0, f = d?.value, p = u ? await $(() => Ie(e), "apple") : void 0, m = p?.value, h = u ? await $(() => He(e), "kobo") : void 0, g = h?.value, _ = r || s ? jt({
960
964
  opf: l?.opf,
961
965
  comicInfo: f,
962
966
  apple: m,
963
967
  kobo: g
964
968
  }) : void 0, v = a || s ? await U(e, { opf: l }) : void 0;
965
- if (s && _ !== void 0 && v !== void 0 && _.renditionLayout === "reflowable" && v.every((e) => e.renditionLayout === "reflowable") && await Ne(e, v) && (_ = {
969
+ if (s && _ !== void 0 && v !== void 0 && _.renditionLayout === "reflowable" && v.every((e) => e.renditionLayout === "reflowable") && await Pe(e, v) && (_ = {
966
970
  ..._,
967
971
  renditionLayout: "pre-paginated"
968
972
  }, v = v.map((e) => ({
969
973
  ...e,
970
974
  renditionLayout: "pre-paginated"
971
975
  }))), r && _ !== void 0) {
972
- let t = v ?? await U(e, { opf: l }), n = await W(e, {
976
+ let t = v ?? await U(e, { opf: l }), n = await Me(e, {
973
977
  opf: l,
974
978
  readingOrder: t
975
- }), r = _.numberOfPages ?? Vt(t);
979
+ }), r = _.numberOfPages ?? Ht(t);
976
980
  _ = H({
977
981
  ..._,
978
982
  cover: n,
979
983
  numberOfPages: r
980
984
  });
981
985
  }
982
- let y = o ? (await $(() => zt(e, { opf: l }), "toc")).value : void 0, b = {
983
- version: Ut,
984
- unreadableSources: Ht({
986
+ let y = o ? (await $(() => Bt(e, { opf: l }), "toc")).value : void 0, b = {
987
+ version: Wt,
988
+ unreadableSources: Ut({
985
989
  archive: e,
986
990
  opf: c,
987
991
  comicInfo: d,
@@ -995,8 +999,8 @@ var He = async ({ archive: e, archiveOpf: t }) => {
995
999
  apple: m,
996
1000
  kobo: g
997
1001
  })), b;
998
- }, Gt = (e) => e?.titles?.[0]?.value;
1002
+ }, Kt = (e) => e?.titles?.[0]?.value;
999
1003
  //#endregion
1000
- export { B as APPLE_IBOOKS_DISPLAY_OPTIONS_FILENAME, V as COMIC_INFO_FILENAME, he as COMIC_INFO_KNOWN_FIELDS, Re as COMIC_INFO_MANGA_VALUES, be as KOBO_DISPLAY_OPTIONS_FILENAME, i as arrayBufferFileAccessors, r as blobFileAccessors, e as createArchive, v as createArchiveFromArrayBufferList, n as createArchiveFromEntries, y as createArchiveFromText, b as createArchiveFromUrls, C as getArchiveFileRecordByUri, Le as getArchiveHasComicInfo, E as getArchiveImageRecords, O as getArchiveOpfInfo, He as getSpineItemFilesFromArchive, We as isArchiveEpub, ze as isComicInfoManga, S as isDirectoryRecord, x as isFileRecord, T as isImageRecord, Gt as mainTitle, lt as normalizeGtin, dt as normalizeIsbn, me as parseAppleDisplayOptionsXml, ye as parseComicInfo, Se as parseKoboXml, fe as parseOpf, ft as parseW3cDtfDate, Fe as readArchiveApple, Be as readArchiveComicInfo, Ve as readArchiveKobo, z as readArchiveOpf, D as readRecordAsText, Ne as readingOrderDocumentsAllHaveViewport, Wt as resolveArchive, W as resolveArchiveCover, Ot as resolveArchiveMetadata, U as resolveArchiveReadingOrder, zt as resolveArchiveToc, kt as resolveMetadata, k as tokenizeXmlSpaceSeparatedList };
1004
+ export { B as APPLE_IBOOKS_DISPLAY_OPTIONS_FILENAME, V as COMIC_INFO_FILENAME, he as COMIC_INFO_KNOWN_FIELDS, ze as COMIC_INFO_MANGA_VALUES, be as KOBO_DISPLAY_OPTIONS_FILENAME, i as arrayBufferFileAccessors, r as blobFileAccessors, e as createArchive, v as createArchiveFromArrayBufferList, n as createArchiveFromEntries, y as createArchiveFromText, b as createArchiveFromUrls, C as getArchiveFileRecordByUri, Re as getArchiveHasComicInfo, E as getArchiveImageRecords, O as getArchiveOpfInfo, Ue as getSpineItemFilesFromArchive, Ge as isArchiveEpub, Be as isComicInfoManga, S as isDirectoryRecord, x as isFileRecord, T as isImageRecord, Kt as mainTitle, dt as normalizeGtin, pt as normalizeIsbn, me as parseAppleDisplayOptionsXml, ye as parseComicInfo, Se as parseKoboXml, fe as parseOpf, mt as parseW3cDtfDate, Ie as readArchiveApple, Ve as readArchiveComicInfo, He as readArchiveKobo, z as readArchiveOpf, D as readRecordAsText, Pe as readingOrderDocumentsAllHaveViewport, Gt as resolveArchive, Me as resolveArchiveCover, At as resolveArchiveMetadata, U as resolveArchiveReadingOrder, Bt as resolveArchiveToc, jt as resolveMetadata, k as tokenizeXmlSpaceSeparatedList };
1001
1005
 
1002
1006
  //# sourceMappingURL=index.js.map