@eternalheart/vue-file-preview 1.6.13 → 1.7.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.
Files changed (125) hide show
  1. package/README.md +2 -0
  2. package/README.zh-CN.md +2 -0
  3. package/lib/FilePreviewContent.vue.d.ts +17 -6
  4. package/lib/FilePreviewEmbed.vue.d.ts +14 -6
  5. package/lib/FilePreviewModal.vue.d.ts +14 -6
  6. package/lib/chunks/{EmptyState.vue_vue_type_script_setup_true_lang-C7qk6wj0.mjs → EmptyState.vue_vue_type_script_setup_true_lang--ZOobbGi.mjs} +1 -1
  7. package/lib/chunks/{avifLoader-CAUzjn-d-C0KRpetN.mjs → avifLoader-CAUzjn-d-CnJpGYJ2.mjs} +1 -1
  8. package/lib/chunks/{heicLoader-D_9PukkA-Czof_5FJ.mjs → heicLoader-D_9PukkA-g_dLrWLP.mjs} +1 -1
  9. package/lib/chunks/index-6XZXYqbp.mjs +125 -0
  10. package/lib/chunks/{index-B21EAyWz.mjs → index-BPSzwMOC.mjs} +51 -51
  11. package/lib/chunks/index-BYQ9S7Mk.mjs +104 -0
  12. package/lib/chunks/{index-8Vpbg2kS.mjs → index-Bf94DwQu.mjs} +105 -104
  13. package/lib/chunks/index-BfOWoMpY.mjs +359 -0
  14. package/lib/chunks/index-Bg8poMIm.mjs +117 -0
  15. package/lib/chunks/index-BzwJ0VWu.mjs +108 -0
  16. package/lib/chunks/index-C41YET0_.mjs +51 -0
  17. package/lib/chunks/{index-BvBqDq3O.mjs → index-C4hIk6pa.mjs} +2023 -2023
  18. package/lib/chunks/{index-BASg1cr4.mjs → index-C8lyQPe3.mjs} +1018 -1018
  19. package/lib/chunks/{index-C9mAajbD.mjs → index-CWPdNhoe.mjs} +200 -200
  20. package/lib/chunks/{index-BuqPb5mP.mjs → index-CrVQPnFj.mjs} +112 -112
  21. package/lib/chunks/{index-D30L8tm9.mjs → index-D5IF9F-D.mjs} +57 -57
  22. package/lib/chunks/{index-DN4Ui0Gh.mjs → index-DFeKS8tR.mjs} +120 -120
  23. package/lib/chunks/index-DM8Dfl-m.mjs +52 -0
  24. package/lib/chunks/index-DZe0BxAB.mjs +90 -0
  25. package/lib/chunks/{index-BlrFFeqc.mjs → index-GFcSJEwj.mjs} +75 -75
  26. package/lib/chunks/{index-Dkro_8Fy.mjs → index-LPGxJDnT.mjs} +32 -32
  27. package/lib/chunks/index-aKiIuKKx.mjs +157 -0
  28. package/lib/chunks/{index-DZZN3kYi.mjs → index-c-pYJEmH.mjs} +1589 -1394
  29. package/lib/chunks/{index-CxKZKUJj.mjs → index-z9RqL2wI.mjs} +1651 -1651
  30. package/lib/chunks/index-zLQlyNR2.mjs +383 -0
  31. package/lib/chunks/{jp2Loader-Dig19xyo-CKUaGhPl.mjs → jp2Loader-Dig19xyo-fCO1knZ0.mjs} +1 -1
  32. package/lib/chunks/{psdLoader-C0tKUXXl-CYWoQis5.mjs → psdLoader-C0tKUXXl-DihMskai.mjs} +1 -1
  33. package/lib/chunks/{rawLoader-C-tPeFAB-C35zC8nZ.mjs → rawLoader-C-tPeFAB-BSfDPl-z.mjs} +5 -5
  34. package/lib/chunks/{tiffLoader-BlhByX8w-BOxg_Du5.mjs → tiffLoader-BlhByX8w-JY5DaTre.mjs} +1 -1
  35. package/lib/chunks/{useShikiHighlight-BPmcxA-h.mjs → useShikiHighlight-C-ztcJBE.mjs} +1 -1
  36. package/lib/composables/useAudioPlayer.d.ts +1 -1
  37. package/lib/composables/usePreviewEvents.d.ts +27 -0
  38. package/lib/composables/useRequest.d.ts +16 -4
  39. package/lib/composables/useThemeMode.d.ts +1 -1
  40. package/lib/composables/useTranslator.d.ts +2 -2
  41. package/lib/core/events.d.ts +52 -0
  42. package/lib/core/i18n/index.d.ts +29 -0
  43. package/lib/core/i18n/messages/en-US.d.ts +5 -0
  44. package/lib/core/i18n/messages/index.d.ts +9 -0
  45. package/lib/core/i18n/messages/zh-CN.d.ts +5 -0
  46. package/lib/core/i18n/types.d.ts +23 -0
  47. package/lib/core/index.d.ts +34 -0
  48. package/lib/core/loaders/avifLoader.d.ts +22 -0
  49. package/lib/core/loaders/heicLoader.d.ts +21 -0
  50. package/lib/core/loaders/jp2Loader.d.ts +16 -0
  51. package/lib/core/loaders/jp2Worker.d.ts +1 -0
  52. package/lib/core/loaders/psdLoader.d.ts +14 -0
  53. package/lib/core/loaders/rawLoader.d.ts +14 -0
  54. package/lib/core/loaders/registry.d.ts +32 -0
  55. package/lib/core/loaders/tiffLoader.d.ts +28 -0
  56. package/lib/core/loaders/types.d.ts +56 -0
  57. package/lib/core/types.d.ts +89 -0
  58. package/lib/core/utils/csvParser.d.ts +31 -0
  59. package/lib/core/utils/emptyState.d.ts +28 -0
  60. package/lib/core/utils/excelDataConverter.d.ts +61 -0
  61. package/lib/core/utils/fileNormalizer.d.ts +21 -0
  62. package/lib/core/utils/fileType.d.ts +21 -0
  63. package/lib/core/utils/legacy-office/doc.d.ts +25 -0
  64. package/lib/core/utils/legacy-office/index.d.ts +8 -0
  65. package/lib/core/utils/legacy-office/ole.d.ts +8 -0
  66. package/lib/core/utils/legacy-office/ppt.d.ts +79 -0
  67. package/lib/core/utils/legacy-office/xls.d.ts +28 -0
  68. package/lib/core/utils/mimeTypes.d.ts +29 -0
  69. package/lib/core/utils/ooxml/docx.d.ts +17 -0
  70. package/lib/core/utils/ooxml/index.d.ts +4 -0
  71. package/lib/core/utils/ooxml/pptx.d.ts +7 -0
  72. package/lib/core/utils/ooxml/xml.d.ts +15 -0
  73. package/lib/core/utils/ooxml/zip.d.ts +3 -0
  74. package/lib/core/utils/pdfWorker.d.ts +61 -0
  75. package/lib/core/utils/previewMode.d.ts +7 -0
  76. package/lib/core/utils/request.d.ts +49 -0
  77. package/lib/core/utils/subtitleParser.d.ts +44 -0
  78. package/lib/core/utils/textDecoder.d.ts +30 -0
  79. package/lib/core/utils/uint8ArrayPolyfill.d.ts +18 -0
  80. package/lib/core/utils/zipReader.d.ts +51 -0
  81. package/lib/core/workers/imageDecoder.worker.d.ts +31 -0
  82. package/lib/core/workers/workerClient.d.ts +14 -0
  83. package/lib/i18n/localeKey.d.ts +1 -1
  84. package/lib/index.cjs +60 -60
  85. package/lib/index.css +1 -1
  86. package/lib/index.d.ts +11 -9
  87. package/lib/index.mjs +15 -12
  88. package/lib/renderers/Audio/index.vue.d.ts +1 -1
  89. package/lib/renderers/Cad/index.vue.d.ts +1 -1
  90. package/lib/renderers/Cad/toolbar.d.ts +2 -2
  91. package/lib/renderers/Csv/index.vue.d.ts +1 -1
  92. package/lib/renderers/Doc/index.vue.d.ts +1 -1
  93. package/lib/renderers/Docx/index.vue.d.ts +1 -1
  94. package/lib/renderers/Epub/index.vue.d.ts +1 -1
  95. package/lib/renderers/Font/index.vue.d.ts +1 -1
  96. package/lib/renderers/Image/index.vue.d.ts +2 -2
  97. package/lib/renderers/Json/index.vue.d.ts +2 -2
  98. package/lib/renderers/Markdown/index.vue.d.ts +1 -1
  99. package/lib/renderers/Mobi/index.vue.d.ts +1 -1
  100. package/lib/renderers/Msg/index.vue.d.ts +1 -1
  101. package/lib/renderers/Pdf/index.vue.d.ts +1 -1
  102. package/lib/renderers/Ppt/index.vue.d.ts +1 -1
  103. package/lib/renderers/Pptx/index.vue.d.ts +2 -2
  104. package/lib/renderers/Subtitle/index.vue.d.ts +1 -1
  105. package/lib/renderers/Text/index.vue.d.ts +2 -2
  106. package/lib/renderers/Unsupported/index.vue.d.ts +1 -1
  107. package/lib/renderers/Video/index.vue.d.ts +1 -1
  108. package/lib/renderers/Xlsx/index.vue.d.ts +2 -2
  109. package/lib/renderers/Xml/index.vue.d.ts +1 -1
  110. package/lib/renderers/Zip/TreeItem.vue.d.ts +1 -1
  111. package/lib/renderers/Zip/index.vue.d.ts +1 -1
  112. package/lib/renderers/base.types.d.ts +1 -1
  113. package/lib/renderers/registry.d.ts +1 -1
  114. package/lib/types.d.ts +3 -3
  115. package/package.json +2 -2
  116. package/lib/chunks/index--612Smof.mjs +0 -383
  117. package/lib/chunks/index-BB0i4QqI.mjs +0 -117
  118. package/lib/chunks/index-BVdrGK3Q.mjs +0 -356
  119. package/lib/chunks/index-Bp9CuvMZ.mjs +0 -157
  120. package/lib/chunks/index-Bxpf9v5j.mjs +0 -104
  121. package/lib/chunks/index-CDg6vIbT.mjs +0 -51
  122. package/lib/chunks/index-CWE-hKSs.mjs +0 -90
  123. package/lib/chunks/index-CY3xzGgt.mjs +0 -108
  124. package/lib/chunks/index-VdzIFJJW.mjs +0 -118
  125. package/lib/chunks/index-aoXgVLBb.mjs +0 -52
@@ -1,13 +1,13 @@
1
- import { defineComponent as be, ref as c, watch as ce, onMounted as ue, onBeforeUnmount as ve, openBlock as S, createElementBlock as D, createBlock as Se, createCommentVNode as W, createElementVNode as u, toDisplayString as de, unref as B, normalizeStyle as U, createVNode as me, h as N } from "vue";
2
- import { u as Ne, c as Re, k as he, _ as ze } from "./index-DZZN3kYi.mjs";
3
- import { List as Ae, ChevronLeft as Le, ChevronRight as Fe, Minimize2 as Pe, Maximize2 as He, X as $e } from "lucide-vue-next";
1
+ import { defineComponent as ge, ref as u, watch as ce, onMounted as ve, onBeforeUnmount as de, openBlock as N, createElementBlock as D, createBlock as Ne, createCommentVNode as W, createElementVNode as c, toDisplayString as me, unref as B, normalizeStyle as U, createVNode as be, h as R } from "vue";
2
+ import { u as Re, a as ze, b as Ae, J as he, e as Le } from "./index-c-pYJEmH.mjs";
3
+ import { List as Pe, ChevronLeft as Fe, ChevronRight as He, Minimize2 as $e, Maximize2 as De, X as We } from "lucide-vue-next";
4
4
  import "foliate-js/view.js";
5
- import { _ as De } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
6
- import { T as We } from "./base.types-DaftHyg7.mjs";
7
- const Be = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-center vfp-bg-surface-1 vfp-overflow-hidden" }, Ue = {
5
+ import { _ as Be } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
6
+ import { T as Ue } from "./base.types-DaftHyg7.mjs";
7
+ const je = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-center vfp-bg-surface-1 vfp-overflow-hidden" }, qe = {
8
8
  key: 1,
9
9
  class: "vfp-absolute vfp-inset-0 vfp-renderer-loading vfp-z-10"
10
- }, je = { class: "vfp-renderer-loading-content" }, qe = { class: "vfp-renderer-loading-text" }, Ge = { class: "vfp-flex vfp-items-center vfp-justify-between vfp-px-4 vfp-py-3 vfp-border-b vfp-border-line-weak vfp-flex-shrink-0" }, Ve = { class: "vfp-text-fg-primary vfp-font-medium vfp-text-sm" }, Xe = { class: "vfp-flex-1 vfp-overflow-y-auto vfp-py-4 vfp-px-1" }, ge = be({
10
+ }, Ge = { class: "vfp-renderer-loading-content" }, Ve = { class: "vfp-renderer-loading-text" }, Xe = { class: "vfp-flex vfp-items-center vfp-justify-between vfp-px-4 vfp-py-3 vfp-border-b vfp-border-line-weak vfp-flex-shrink-0" }, Oe = { class: "vfp-text-fg-primary vfp-font-medium vfp-text-sm" }, Je = { class: "vfp-flex-1 vfp-overflow-y-auto vfp-py-4 vfp-px-1" }, xe = ge({
11
11
  name: "MobiTocList",
12
12
  props: {
13
13
  items: { type: Array, required: !0 },
@@ -16,14 +16,14 @@ const Be = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-cen
16
16
  },
17
17
  emits: ["select"],
18
18
  render() {
19
- return N(
19
+ return R(
20
20
  "ul",
21
21
  { style: { listStyle: "none", padding: 0, margin: this.depth > 0 ? "0 0 0 16px" : 0 } },
22
22
  this.items.map(
23
23
  (l, j) => {
24
- var R, q, G;
25
- return N("li", { key: `${l.href ?? l.label}-${j}` }, [
26
- l.href ? N(
24
+ var z, q, G;
25
+ return R("li", { key: `${l.href ?? l.label}-${j}` }, [
26
+ l.href ? R(
27
27
  "button",
28
28
  {
29
29
  onClick: () => this.$emit("select", l.href),
@@ -34,13 +34,13 @@ const Be = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-cen
34
34
  title: l.label,
35
35
  style: "background: none; border: none; cursor: pointer"
36
36
  },
37
- (R = l.label) == null ? void 0 : R.trim()
38
- ) : N(
37
+ (z = l.label) == null ? void 0 : z.trim()
38
+ ) : R(
39
39
  "div",
40
40
  { class: "vfp-w-full vfp-py-2 vfp-px-3 vfp-text-sm vfp-text-fg-tertiary vfp-truncate" },
41
41
  (q = l.label) == null ? void 0 : q.trim()
42
42
  ),
43
- (G = l.subitems) != null && G.length ? N(ge, {
43
+ (G = l.subitems) != null && G.length ? R(xe, {
44
44
  items: l.subitems,
45
45
  activeHref: this.activeHref,
46
46
  depth: this.depth + 1,
@@ -51,13 +51,13 @@ const Be = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-cen
51
51
  )
52
52
  );
53
53
  }
54
- }), Oe = { name: "MobiRenderer" }, Je = /* @__PURE__ */ be({
55
- ...Oe,
54
+ }), Ke = { name: "MobiRenderer" }, Qe = /* @__PURE__ */ ge({
55
+ ...Ke,
56
56
  props: {
57
57
  url: {}
58
58
  },
59
59
  setup(l, { expose: j }) {
60
- const R = `
60
+ const z = `
61
61
  @namespace epub "http://www.idpf.org/2007/ops";
62
62
  :root {
63
63
  --theme-bg-color: #ffffff;
@@ -101,28 +101,28 @@ const Be = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-cen
101
101
  } finally {
102
102
  a !== void 0 && window.clearTimeout(a);
103
103
  }
104
- }, z = l, Y = new We(), { t: s } = Ne(), xe = Re(), X = c(null);
104
+ }, k = l, Y = new Ue(), { t: f } = Re(), ye = ze(), Z = Ae(), X = u(null);
105
105
  let e = null, O = 1;
106
- const b = c(1), k = c(1), g = c(!0), x = c(null), y = c([]), n = c(!1), T = c(""), v = c(!1);
107
- ce([b, k, v, n, g, () => y.value.length], () => {
106
+ const h = u(1), T = u(1), g = u(!0), x = u(null), y = u([]), n = u(!1), E = u(""), v = u(!1);
107
+ ce([h, T, v, n, g, () => y.value.length], () => {
108
108
  Y.notify();
109
109
  });
110
110
  const A = (o, t) => {
111
111
  Number.isFinite(t) && t > 0 && (O = t);
112
112
  const a = Number.isFinite(o) ? o : 0;
113
- b.value = Math.max(1, a + 1), k.value = O;
114
- }, ye = () => {
113
+ h.value = Math.max(1, a + 1), T.value = O;
114
+ }, _e = () => {
115
115
  e == null || e.prev().catch(() => {
116
116
  });
117
- }, _e = () => {
117
+ }, we = () => {
118
118
  e == null || e.next().catch(() => {
119
119
  });
120
- }, we = () => {
121
- n.value = !n.value;
122
120
  }, ke = () => {
121
+ n.value = !n.value;
122
+ }, Te = () => {
123
123
  v.value = !v.value, e != null && e.renderer && e.renderer.setAttribute("max-inline-size", v.value ? "9999" : "720");
124
- }, Te = (o) => {
125
- T.value = o, n.value = !1, e == null || e.goTo(o).catch(() => {
124
+ }, Ee = (o) => {
125
+ E.value = o, n.value = !1, e == null || e.goTo(o).catch(() => {
126
126
  });
127
127
  };
128
128
  j({
@@ -131,9 +131,9 @@ const Be = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-cen
131
131
  items: [
132
132
  {
133
133
  type: "button",
134
- icon: Ae,
135
- tooltip: s.value("toolbar.toc"),
136
- action: we,
134
+ icon: Pe,
135
+ tooltip: f.value("toolbar.toc"),
136
+ action: ke,
137
137
  disabled: y.value.length === 0,
138
138
  active: n.value
139
139
  }
@@ -143,22 +143,22 @@ const Be = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-cen
143
143
  items: [
144
144
  {
145
145
  type: "button",
146
- icon: Le,
147
- tooltip: s.value("toolbar.prev_page"),
148
- action: ye,
149
- disabled: b.value <= 1
146
+ icon: Fe,
147
+ tooltip: f.value("toolbar.prev_page"),
148
+ action: _e,
149
+ disabled: h.value <= 1
150
150
  },
151
151
  {
152
152
  type: "text",
153
- content: `${b.value} / ${k.value}`,
153
+ content: `${h.value} / ${T.value}`,
154
154
  minWidth: "4rem"
155
155
  },
156
156
  {
157
157
  type: "button",
158
- icon: Fe,
159
- tooltip: s.value("toolbar.next_page"),
160
- action: _e,
161
- disabled: b.value >= k.value
158
+ icon: He,
159
+ tooltip: f.value("toolbar.next_page"),
160
+ action: we,
161
+ disabled: h.value >= T.value
162
162
  }
163
163
  ]
164
164
  },
@@ -166,9 +166,9 @@ const Be = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-cen
166
166
  items: [
167
167
  {
168
168
  type: "button",
169
- icon: v.value ? Pe : He,
170
- tooltip: v.value ? s.value("toolbar.normal_width") : s.value("toolbar.full_width"),
171
- action: ke,
169
+ icon: v.value ? $e : De,
170
+ tooltip: v.value ? f.value("toolbar.normal_width") : f.value("toolbar.full_width"),
171
+ action: Te,
172
172
  active: v.value
173
173
  }
174
174
  ]
@@ -176,53 +176,54 @@ const Be = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-cen
176
176
  ],
177
177
  onToolbarChange: (o) => Y.subscribe(o)
178
178
  });
179
- const Z = (o) => {
179
+ const I = (o) => {
180
180
  var t;
181
181
  (t = o.filename) != null && t.includes("paginator") && o.preventDefault();
182
182
  };
183
- ue(() => window.addEventListener("error", Z)), ve(() => window.removeEventListener("error", Z));
184
- const I = async () => {
183
+ ve(() => window.addEventListener("error", I)), de(() => window.removeEventListener("error", I));
184
+ const ee = async () => {
185
185
  var d, J, L;
186
+ Z.begin(k.url);
186
187
  const o = X.value;
187
188
  if (!o) return;
188
- g.value = !0, x.value = null, y.value = [], n.value = !1, T.value = "", O = 1, b.value = 1, k.value = 1, o.replaceChildren(), e = null;
189
+ g.value = !0, x.value = null, y.value = [], n.value = !1, E.value = "", O = 1, h.value = 1, T.value = 1, o.replaceChildren(), e = null;
189
190
  let t = !1;
190
191
  const a = /* @__PURE__ */ new Map();
191
192
  try {
192
- const f = document.createElement("foliate-view");
193
- o.appendChild(f), e = f, f.addEventListener("relocate", (te) => {
194
- var ae, re, le, ne, ie, se, fe;
195
- const i = te.detail;
193
+ const s = document.createElement("foliate-view");
194
+ o.appendChild(s), e = s, s.addEventListener("relocate", (oe) => {
195
+ var re, le, ne, ie, se, fe, pe;
196
+ const i = oe.detail;
196
197
  if (!i) return;
197
- const oe = ((ae = e == null ? void 0 : e.book) == null ? void 0 : ae.sections.length) ?? 0, r = e == null ? void 0 : e.renderer, F = ((le = (re = r == null ? void 0 : r.getContents) == null ? void 0 : re.call(r)[0]) == null ? void 0 : le.index) ?? -1;
198
- if (r && typeof r.page == "number" && Number.isFinite(r.page) && typeof r.pages == "number" && Number.isFinite(r.pages) && r.pages > 2 && F >= 0) {
198
+ const ae = ((re = e == null ? void 0 : e.book) == null ? void 0 : re.sections.length) ?? 0, r = e == null ? void 0 : e.renderer, P = ((ne = (le = r == null ? void 0 : r.getContents) == null ? void 0 : le.call(r)[0]) == null ? void 0 : ne.index) ?? -1;
199
+ if (r && typeof r.page == "number" && Number.isFinite(r.page) && typeof r.pages == "number" && Number.isFinite(r.pages) && r.pages > 2 && P >= 0) {
199
200
  t = !0;
200
- const h = r.pages - 2;
201
- a.set(F, h);
201
+ const b = r.pages - 2;
202
+ a.set(P, b);
202
203
  let _ = 0;
203
- for (let w = 0; w < F; w++)
204
+ for (let w = 0; w < P; w++)
204
205
  _ += a.get(w) ?? 0;
205
- const C = _ + Math.min(h, Math.max(1, r.page)), E = (i.fraction ?? 0) >= 0.999;
206
+ const C = _ + Math.min(b, Math.max(1, r.page)), M = (i.fraction ?? 0) >= 0.999;
206
207
  let H;
207
- if (oe === 1)
208
- H = h;
209
- else if (E)
208
+ if (ae === 1)
209
+ H = b;
210
+ else if (M)
210
211
  H = C;
211
212
  else {
212
- const w = ((ne = e == null ? void 0 : e.book) == null ? void 0 : ne.sections) ?? [], pe = ((ie = w[F]) == null ? void 0 : ie.size) ?? 0, Ee = pe > 0 ? h / pe : 0;
213
+ const w = ((ie = e == null ? void 0 : e.book) == null ? void 0 : ie.sections) ?? [], ue = ((se = w[P]) == null ? void 0 : se.size) ?? 0, Me = ue > 0 ? b / ue : 0;
213
214
  let Q = 0;
214
- for (let M = 0; M < oe; M++)
215
- if (a.has(M))
216
- Q += a.get(M);
215
+ for (let S = 0; S < ae; S++)
216
+ if (a.has(S))
217
+ Q += a.get(S);
217
218
  else {
218
- const Me = ((se = w[M]) == null ? void 0 : se.size) ?? 0;
219
- Q += Math.max(1, Math.round(Me * Ee));
219
+ const Se = ((fe = w[S]) == null ? void 0 : fe.size) ?? 0;
220
+ Q += Math.max(1, Math.round(Se * Me));
220
221
  }
221
222
  H = Math.max(C, Q);
222
223
  }
223
224
  A(C - 1, H);
224
225
  const $ = i.tocItem;
225
- $ != null && $.href && (T.value = $.href);
226
+ $ != null && $.href && (E.value = $.href);
226
227
  return;
227
228
  }
228
229
  const m = i.location;
@@ -231,33 +232,33 @@ const Be = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-cen
231
232
  const _ = (i.fraction ?? 0) >= 0.999 ? m.current + 1 : m.total;
232
233
  A(m.current, _);
233
234
  } else {
234
- const h = ((fe = e == null ? void 0 : e.book) == null ? void 0 : fe.sections) ?? [], _ = i.index ?? 0, C = i.fraction ?? 0, E = Math.max(h.length, 1);
235
- A(Math.round((_ + C) / E * E), E);
235
+ const b = ((pe = e == null ? void 0 : e.book) == null ? void 0 : pe.sections) ?? [], _ = i.index ?? 0, C = i.fraction ?? 0, M = Math.max(b.length, 1);
236
+ A(Math.round((_ + C) / M * M), M);
236
237
  }
237
- const P = i.tocItem;
238
- P != null && P.href && (T.value = P.href);
238
+ const F = i.tocItem;
239
+ F != null && F.href && (E.value = F.href);
239
240
  });
240
- const K = await xe.value(z.url);
241
+ const K = await ye.value(k.url);
241
242
  if (!K.ok) throw new he("request.failed", { status: K.status });
242
243
  const Ce = await K.blob();
243
- let ee = "book.mobi";
244
+ let te = "book.mobi";
244
245
  try {
245
- const i = new URL(z.url, window.location.href).pathname.split("/").pop();
246
- i && (ee = decodeURIComponent(i));
246
+ const i = new URL(k.url, window.location.href).pathname.split("/").pop();
247
+ i && (te = decodeURIComponent(i));
247
248
  } catch {
248
249
  }
249
- await f.open(new File([Ce], ee));
250
- const p = f.renderer;
251
- p && (p.setAttribute("animated", ""), p.setAttribute("max-inline-size", "720"), p.setAttribute("margin", "48"), p.setAttribute("gap", "5%"), await V(p), (d = p.setStyles) == null || d.call(p, R)), y.value = ((J = f.book) == null ? void 0 : J.toc) ?? [], g.value = !1, t || A(0, ((L = f.book) == null ? void 0 : L.sections.length) ?? 1);
252
- } catch (f) {
253
- console.error(s.value("mobi.load_failed") + ":", f), x.value = s.value("mobi.load_failed"), g.value = !1;
250
+ await s.open(new File([Ce], te));
251
+ const p = s.renderer;
252
+ p && (p.setAttribute("animated", ""), p.setAttribute("max-inline-size", "720"), p.setAttribute("margin", "48"), p.setAttribute("gap", "5%"), await V(p), (d = p.setStyles) == null || d.call(p, z)), y.value = ((J = s.book) == null ? void 0 : J.toc) ?? [], g.value = !1, t || A(0, ((L = s.book) == null ? void 0 : L.sections.length) ?? 1);
253
+ } catch (s) {
254
+ console.error(f.value("mobi.load_failed") + ":", s), x.value = f.value("mobi.load_failed"), g.value = !1, Z.error(s);
254
255
  }
255
256
  };
256
- return ue(() => {
257
- z.url && I();
258
- }), ce(() => z.url, (o, t) => {
259
- o && o !== t && I();
260
- }), ve(() => {
257
+ return ve(() => {
258
+ k.url && ee();
259
+ }), ce(() => k.url, (o, t) => {
260
+ o && o !== t && ee();
261
+ }), de(() => {
261
262
  var o, t, a, d;
262
263
  try {
263
264
  (o = e == null ? void 0 : e.close) == null || o.call(e);
@@ -268,51 +269,51 @@ const Be = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-cen
268
269
  } catch {
269
270
  }
270
271
  e = null, (d = X.value) == null || d.replaceChildren();
271
- }), (o, t) => (S(), D("div", Be, [
272
- x.value ? (S(), Se(De, {
272
+ }), (o, t) => (N(), D("div", je, [
273
+ x.value ? (N(), Ne(Be, {
273
274
  key: 0,
274
275
  message: x.value,
275
276
  class: "vfp-absolute vfp-inset-0"
276
277
  }, null, 8, ["message"])) : W("", !0),
277
- g.value && !x.value ? (S(), D("div", Ue, [
278
- u("div", je, [
279
- t[2] || (t[2] = u("div", { class: "vfp-renderer-spinner" }, null, -1)),
280
- u("span", qe, de(B(s)("common.loading")), 1)
278
+ g.value && !x.value ? (N(), D("div", qe, [
279
+ c("div", Ge, [
280
+ t[2] || (t[2] = c("div", { class: "vfp-renderer-spinner" }, null, -1)),
281
+ c("span", Ve, me(B(f)("common.loading")), 1)
281
282
  ])
282
283
  ])) : W("", !0),
283
- y.value.length > 0 ? (S(), D("div", {
284
+ y.value.length > 0 ? (N(), D("div", {
284
285
  key: 2,
285
286
  class: "vfp-absolute vfp-inset-0 vfp-z-20 vfp-flex vfp-transition-opacity vfp-duration-300",
286
287
  style: U({ opacity: n.value ? 1 : 0, pointerEvents: n.value ? "auto" : "none" })
287
288
  }, [
288
- u("div", {
289
+ c("div", {
289
290
  class: "vfp-w-72 vfp-max-w-[80%] vfp-h-full vfp-bg-surface-overlay vfp-backdrop-blur-xl vfp-border-r vfp-border-line-weak vfp-flex vfp-flex-col vfp-shadow-2xl vfp-transition-transform vfp-duration-300",
290
291
  style: U({ transform: n.value ? "translateX(0)" : "translateX(-100%)" })
291
292
  }, [
292
- u("div", Ge, [
293
- u("span", Ve, de(B(s)("toolbar.toc")), 1),
294
- u("button", {
293
+ c("div", Xe, [
294
+ c("span", Oe, me(B(f)("toolbar.toc")), 1),
295
+ c("button", {
295
296
  class: "toc-close-btn",
296
297
  onClick: t[0] || (t[0] = (a) => n.value = !1)
297
298
  }, [
298
- me(B($e), { class: "vfp-w-4 vfp-h-4" })
299
+ be(B(We), { class: "vfp-w-4 vfp-h-4" })
299
300
  ])
300
301
  ]),
301
- u("div", Xe, [
302
- me(B(ge), {
302
+ c("div", Je, [
303
+ be(B(xe), {
303
304
  items: y.value,
304
- "active-href": T.value,
305
- onSelect: Te
305
+ "active-href": E.value,
306
+ onSelect: Ee
306
307
  }, null, 8, ["items", "active-href"])
307
308
  ])
308
309
  ], 4),
309
- u("div", {
310
+ c("div", {
310
311
  class: "vfp-flex-1 vfp-transition-opacity vfp-duration-300",
311
312
  style: U({ background: n.value ? "rgba(0,0,0,0.3)" : "transparent" }),
312
313
  onClick: t[1] || (t[1] = (a) => n.value = !1)
313
314
  }, null, 4)
314
315
  ], 4)) : W("", !0),
315
- x.value ? W("", !0) : (S(), D("div", {
316
+ x.value ? W("", !0) : (N(), D("div", {
316
317
  key: 3,
317
318
  ref_key: "hostRef",
318
319
  ref: X,
@@ -327,7 +328,7 @@ const Be = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-cen
327
328
  }, null, 4))
328
329
  ]));
329
330
  }
330
- }), ot = /* @__PURE__ */ ze(Je, [["__scopeId", "data-v-b68e7c2a"]]);
331
+ }), rt = /* @__PURE__ */ Le(Qe, [["__scopeId", "data-v-e2b96a42"]]);
331
332
  export {
332
- ot as default
333
+ rt as default
333
334
  };