@eternalheart/vue-file-preview 1.7.0 → 1.7.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.
Files changed (46) hide show
  1. package/README.md +2 -0
  2. package/README.zh-CN.md +2 -0
  3. package/lib/FilePreviewContent.vue.d.ts +9 -1
  4. package/lib/FilePreviewEmbed.vue.d.ts +6 -1
  5. package/lib/FilePreviewModal.vue.d.ts +6 -1
  6. package/lib/chunks/{EmptyState.vue_vue_type_script_setup_true_lang--ZOobbGi.mjs → EmptyState.vue_vue_type_script_setup_true_lang-Dna6LmVT.mjs} +1 -1
  7. package/lib/chunks/{avifLoader-CAUzjn-d-CnJpGYJ2.mjs → avifLoader-CAUzjn-d-dPsP28D5.mjs} +1 -1
  8. package/lib/chunks/{heicLoader-D_9PukkA-g_dLrWLP.mjs → heicLoader-D_9PukkA-T-k1DSgY.mjs} +1 -1
  9. package/lib/chunks/{index-c-pYJEmH.mjs → index-B5hprvcF.mjs} +1747 -1709
  10. package/lib/chunks/index-BN__EwfT.mjs +333 -0
  11. package/lib/chunks/{index-z9RqL2wI.mjs → index-BPutNVAf.mjs} +453 -453
  12. package/lib/chunks/{index-BfOWoMpY.mjs → index-B_Spz6Wn.mjs} +77 -77
  13. package/lib/chunks/{index-D5IF9F-D.mjs → index-BjHEHkZ8.mjs} +22 -22
  14. package/lib/chunks/{index-LPGxJDnT.mjs → index-BlZ6RmeR.mjs} +18 -18
  15. package/lib/chunks/{index-CrVQPnFj.mjs → index-C95y29OL.mjs} +18 -18
  16. package/lib/chunks/{index-DFeKS8tR.mjs → index-CegPYMyO.mjs} +22 -22
  17. package/lib/chunks/{index-C4hIk6pa.mjs → index-CqOGKCyE.mjs} +2 -2
  18. package/lib/chunks/{index-6XZXYqbp.mjs → index-Cv3Sg87O.mjs} +29 -32
  19. package/lib/chunks/{index-zLQlyNR2.mjs → index-DHba2Axz.mjs} +62 -62
  20. package/lib/chunks/{index-CWPdNhoe.mjs → index-DInI3RTN.mjs} +60 -60
  21. package/lib/chunks/{index-C8lyQPe3.mjs → index-DXzvgRuo.mjs} +3 -3
  22. package/lib/chunks/{index-BPSzwMOC.mjs → index-DcvlMm9Q.mjs} +46 -46
  23. package/lib/chunks/index-Dnyl1HQk.mjs +51 -0
  24. package/lib/chunks/{index-aKiIuKKx.mjs → index-JjVQZbDt.mjs} +50 -50
  25. package/lib/chunks/{index-DZe0BxAB.mjs → index-QPk2c2Tl.mjs} +20 -20
  26. package/lib/chunks/{index-DM8Dfl-m.mjs → index-TZv0MqBH.mjs} +15 -15
  27. package/lib/chunks/{index-BzwJ0VWu.mjs → index-cRhwUlQN.mjs} +33 -33
  28. package/lib/chunks/{index-BYQ9S7Mk.mjs → index-dOxDeWYi.mjs} +30 -30
  29. package/lib/chunks/{index-Bg8poMIm.mjs → index-eNZr1h6f.mjs} +29 -29
  30. package/lib/chunks/{index-Bf94DwQu.mjs → index-oJF-hur2.mjs} +24 -24
  31. package/lib/chunks/{jp2Loader-Dig19xyo-fCO1knZ0.mjs → jp2Loader-Dig19xyo-hrIg_KJ3.mjs} +1 -1
  32. package/lib/chunks/{psdLoader-C0tKUXXl-DihMskai.mjs → psdLoader-C0tKUXXl-B2cJ4s7t.mjs} +1 -1
  33. package/lib/chunks/{rawLoader-C-tPeFAB-BSfDPl-z.mjs → rawLoader-C-tPeFAB-BNV-Wmzr.mjs} +1 -1
  34. package/lib/chunks/{tiffLoader-BlhByX8w-JY5DaTre.mjs → tiffLoader-BlhByX8w-BzSrLE9Y.mjs} +1 -1
  35. package/lib/chunks/{useShikiHighlight-C-ztcJBE.mjs → useShikiHighlight-CpL0RAQg.mjs} +1 -1
  36. package/lib/composables/usePreviewEvents.d.ts +2 -2
  37. package/lib/composables/useRequest.d.ts +8 -2
  38. package/lib/core/events.d.ts +18 -1
  39. package/lib/core/index.d.ts +1 -1
  40. package/lib/index.cjs +54 -54
  41. package/lib/index.css +1 -1
  42. package/lib/index.d.ts +1 -1
  43. package/lib/index.mjs +5 -5
  44. package/package.json +1 -1
  45. package/lib/chunks/index-C41YET0_.mjs +0 -51
  46. package/lib/chunks/index-GFcSJEwj.mjs +0 -330
@@ -1,7 +1,7 @@
1
- import { defineComponent as O, ref as d, computed as C, onMounted as re, onBeforeUnmount as Y, watch as j, openBlock as v, createElementBlock as u, normalizeStyle as W, Fragment as B, createElementVNode as i, normalizeClass as U, toDisplayString as T, unref as g, withDirectives as V, renderSlot as N, vShow as Z, resolveComponent as ve, createVNode as K, createBlock as D, resolveDynamicComponent as q, renderList as Q, createCommentVNode as ee, defineAsyncComponent as fe, withCtx as G, Teleport as de } from "vue";
2
- import { u as te, e as ne, S as pe, X as ue, a as ce, b as me, r as J, J as he, w as ge, x as we, z as xe, H as be } from "./index-c-pYJEmH.mjs";
1
+ import { defineComponent as O, ref as d, computed as C, onMounted as re, onBeforeUnmount as Y, watch as P, openBlock as v, createElementBlock as u, normalizeStyle as W, Fragment as B, createElementVNode as i, normalizeClass as U, toDisplayString as T, unref as g, withDirectives as V, renderSlot as N, vShow as Z, resolveComponent as ve, createVNode as j, createBlock as D, resolveDynamicComponent as q, renderList as Q, createCommentVNode as ee, defineAsyncComponent as fe, withCtx as G, Teleport as de } from "vue";
2
+ import { u as te, d as ne, j as pe, A as ue, a as ce, b as me, W as X, J as he, k as ge, l as we, H as be, m as xe } from "./index-B5hprvcF.mjs";
3
3
  import { FileImage as ye, FileText as ke, FileCode as Le, File as ze, ChevronRight as Se, FolderOpen as Te, Folder as _e } from "lucide-vue-next";
4
- import { _ as A } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
4
+ import { _ as J } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
5
5
  import { T as $e } from "./base.types-DaftHyg7.mjs";
6
6
  const Re = { class: "vfp-flex vfp-flex-shrink-0 vfp-border-b vfp-border-line-weak vfp-bg-surface-toolbar" }, Ce = { class: "vfp-flex-1 vfp-min-h-0 vfp-min-w-0 vfp-w-full vfp-overflow-hidden" }, Ee = { class: "vfp-flex-1 vfp-min-h-0 vfp-min-w-0 vfp-w-full vfp-overflow-hidden" }, Me = { class: "vfp-flex-1 vfp-min-w-0 vfp-min-h-0 vfp-overflow-hidden" }, We = /* @__PURE__ */ O({
7
7
  name: "ResizableSplit",
@@ -26,46 +26,46 @@ const Re = { class: "vfp-flex vfp-flex-shrink-0 vfp-border-b vfp-border-line-wea
26
26
  }
27
27
  return n.initialLeftWidth;
28
28
  })()
29
- ), L = d(!1), z = d(!1), _ = d(!0), x = d("left");
29
+ ), z = d(!1), y = d(!1), _ = d(!0), b = d("left");
30
30
  let o = null, t = null;
31
- const y = () => {
32
- o && (z.value = o.matches);
33
- }, b = C(
34
- () => z.value && _.value ? { width: `${f.value}px` } : void 0
35
- ), a = C(() => z.value && _.value), S = (l) => {
31
+ const k = () => {
32
+ o && (y.value = o.matches);
33
+ }, x = C(
34
+ () => y.value && _.value ? { width: `${f.value}px` } : void 0
35
+ ), a = C(() => y.value && _.value), S = (l) => {
36
36
  if (!w.value) return;
37
- const c = w.value.getBoundingClientRect(), F = l.clientX - c.left, P = c.width - n.minRightWidth - 6, X = Math.min(n.maxLeftWidth, P);
37
+ const c = w.value.getBoundingClientRect(), F = l.clientX - c.left, K = c.width - n.minRightWidth - 6, A = Math.min(n.maxLeftWidth, K);
38
38
  f.value = Math.max(
39
39
  n.minLeftWidth,
40
- Math.min(X, F)
40
+ Math.min(A, F)
41
41
  );
42
42
  }, $ = () => {
43
- if (L.value && (L.value = !1, window.removeEventListener("mousemove", S), window.removeEventListener("mouseup", $), document.body.style.cursor = "", document.body.style.userSelect = "", n.storageKey))
43
+ if (z.value && (z.value = !1, window.removeEventListener("mousemove", S), window.removeEventListener("mouseup", $), document.body.style.cursor = "", document.body.style.userSelect = "", n.storageKey))
44
44
  try {
45
45
  window.localStorage.setItem(n.storageKey, String(f.value));
46
46
  } catch {
47
47
  }
48
48
  }, R = (l) => {
49
- l.preventDefault(), L.value = !0, window.addEventListener("mousemove", S), window.addEventListener("mouseup", $), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none";
49
+ l.preventDefault(), z.value = !0, window.addEventListener("mousemove", S), window.addEventListener("mouseup", $), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none";
50
50
  };
51
51
  re(() => {
52
52
  if (typeof window < "u") {
53
- o = window.matchMedia(n.desktopMedia), y(), o.addEventListener("change", y);
53
+ o = window.matchMedia(n.desktopMedia), k(), o.addEventListener("change", k);
54
54
  const l = () => {
55
55
  w.value && (_.value = w.value.getBoundingClientRect().width >= n.minLeftWidth + n.minRightWidth + 6);
56
56
  };
57
57
  l(), t = typeof ResizeObserver < "u" ? new ResizeObserver(l) : null, t == null || t.observe(w.value);
58
58
  }
59
59
  }), Y(() => {
60
- o && o.removeEventListener("change", y), t == null || t.disconnect(), t = null, window.removeEventListener("mousemove", S), window.removeEventListener("mouseup", $), L.value && (document.body.style.cursor = "", document.body.style.userSelect = "");
61
- }), j(
60
+ o && o.removeEventListener("change", k), t == null || t.disconnect(), t = null, window.removeEventListener("mousemove", S), window.removeEventListener("mouseup", $), z.value && (document.body.style.cursor = "", document.body.style.userSelect = "");
61
+ }), P(
62
62
  () => n.initialLeftWidth,
63
63
  (l) => {
64
64
  n.storageKey || (f.value = l);
65
65
  }
66
66
  );
67
67
  const E = (l) => {
68
- x.value = l;
68
+ b.value = l;
69
69
  };
70
70
  return I({ switchTab: E }), (l, c) => (v(), u("div", {
71
71
  ref_key: "containerRef",
@@ -77,36 +77,36 @@ const Re = { class: "vfp-flex vfp-flex-shrink-0 vfp-border-b vfp-border-line-wea
77
77
  i("div", Re, [
78
78
  i("button", {
79
79
  type: "button",
80
- class: U(["vfp-flex-1 vfp-py-2.5 vfp-text-sm vfp-transition-colors", x.value === "left" ? "vfp-text-fg-primary vfp-border-b-2 vfp-border-fg-primary -vfp-mb-px" : "vfp-text-fg-secondary"]),
80
+ class: U(["vfp-flex-1 vfp-py-2.5 vfp-text-sm vfp-transition-colors", b.value === "left" ? "vfp-text-fg-primary vfp-border-b-2 vfp-border-fg-primary -vfp-mb-px" : "vfp-text-fg-secondary"]),
81
81
  onClick: c[0] || (c[0] = (F) => E("left"))
82
82
  }, T(r.leftTabLabel ?? g(p)("zip.file_tree")), 3),
83
83
  i("button", {
84
84
  type: "button",
85
- class: U(["vfp-flex-1 vfp-py-2.5 vfp-text-sm vfp-transition-colors", x.value === "right" ? "vfp-text-fg-primary vfp-border-b-2 vfp-border-fg-primary -vfp-mb-px" : "vfp-text-fg-secondary"]),
85
+ class: U(["vfp-flex-1 vfp-py-2.5 vfp-text-sm vfp-transition-colors", b.value === "right" ? "vfp-text-fg-primary vfp-border-b-2 vfp-border-fg-primary -vfp-mb-px" : "vfp-text-fg-secondary"]),
86
86
  onClick: c[1] || (c[1] = (F) => E("right"))
87
87
  }, T(r.rightTabLabel ?? g(p)("toolbar.preview")), 3)
88
88
  ]),
89
89
  V(i("div", Ce, [
90
90
  N(l.$slots, "left", {}, void 0, !0)
91
91
  ], 512), [
92
- [Z, x.value === "left"]
92
+ [Z, b.value === "left"]
93
93
  ]),
94
94
  V(i("div", Ee, [
95
95
  N(l.$slots, "right", {}, void 0, !0)
96
96
  ], 512), [
97
- [Z, x.value === "right"]
97
+ [Z, b.value === "right"]
98
98
  ])
99
99
  ], 64)) : (v(), u(B, { key: 1 }, [
100
100
  i("div", {
101
101
  class: "vfp-min-h-0 vfp-min-w-0 vfp-flex-shrink-0 vfp-w-full vfp-max-h-60 md:vfp-h-full md:vfp-max-h-none",
102
- style: W(b.value)
102
+ style: W(x.value)
103
103
  }, [
104
104
  N(l.$slots, "left", {}, void 0, !0)
105
105
  ], 4),
106
106
  i("div", {
107
107
  role: "separator",
108
108
  "aria-orientation": "vertical",
109
- class: U(["split-divider vfp-hidden md:vfp-block vfp-relative vfp-w-1.5 vfp-flex-shrink-0 vfp-cursor-col-resize vfp-transition-colors", L.value ? "dragging" : ""]),
109
+ class: U(["split-divider vfp-hidden md:vfp-block vfp-relative vfp-w-1.5 vfp-flex-shrink-0 vfp-cursor-col-resize vfp-transition-colors", z.value ? "dragging" : ""]),
110
110
  style: W(a.value ? void 0 : { display: "none" }),
111
111
  onMousedown: R
112
112
  }, [...c[2] || (c[2] = [
@@ -128,33 +128,33 @@ const Re = { class: "vfp-flex vfp-flex-shrink-0 vfp-border-b vfp-border-line-wea
128
128
  },
129
129
  emits: ["toggle", "select", "hover", "leave"],
130
130
  setup(r, { emit: I }) {
131
- const n = r, p = I, w = C(() => ({ paddingLeft: `${n.depth * 14 + 10}px` })), f = C(() => n.expanded.has(n.node.path)), L = C(() => n.selectedPath === n.node.path), z = C(() => {
131
+ const n = r, p = I, w = C(() => ({ paddingLeft: `${n.depth * 14 + 10}px` })), f = C(() => n.expanded.has(n.node.path)), z = C(() => n.selectedPath === n.node.path), y = C(() => {
132
132
  const o = pe({ name: n.node.name, type: "" });
133
133
  return o === "image" ? ye : o === "text" || o === "markdown" || o === "json" || o === "csv" || o === "xml" || o === "subtitle" ? n.node.name.endsWith(".md") || n.node.name.endsWith(".markdown") ? ke : Le : ze;
134
134
  }), _ = (o) => {
135
135
  const t = o.currentTarget.getBoundingClientRect();
136
136
  p("hover", n.node.name || "/", t);
137
- }, x = () => p("leave");
137
+ }, b = () => p("leave");
138
138
  return (o, t) => {
139
- const y = ve("ZipTreeItem");
139
+ const k = ve("ZipTreeItem");
140
140
  return r.node.isDir ? (v(), u("div", Ie, [
141
141
  i("button", {
142
142
  type: "button",
143
143
  class: "tree-row dir-row",
144
144
  style: W(w.value),
145
- onClick: t[0] || (t[0] = (b) => p("toggle", r.node.path)),
145
+ onClick: t[0] || (t[0] = (x) => p("toggle", r.node.path)),
146
146
  onMouseenter: _,
147
- onMouseleave: x
147
+ onMouseleave: b
148
148
  }, [
149
- K(g(Se), {
149
+ j(g(Se), {
150
150
  class: U(["vfp-w-3.5 vfp-h-3.5 vfp-flex-shrink-0 vfp-transition-transform", { "vfp-rotate-90": f.value }])
151
151
  }, null, 8, ["class"]),
152
152
  (v(), D(q(f.value ? g(Te) : g(_e)), { class: "vfp-w-4 vfp-h-4 vfp-flex-shrink-0 vfp-text-amber-300/80" })),
153
153
  i("span", Fe, T(r.node.name || "/"), 1)
154
154
  ], 36),
155
- f.value && r.node.children ? (v(!0), u(B, { key: 0 }, Q(r.node.children, (b) => (v(), D(y, {
156
- key: b.path,
157
- node: b,
155
+ f.value && r.node.children ? (v(!0), u(B, { key: 0 }, Q(r.node.children, (x) => (v(), D(k, {
156
+ key: x.path,
157
+ node: x,
158
158
  depth: r.depth + 1,
159
159
  "selected-path": r.selectedPath,
160
160
  expanded: r.expanded,
@@ -166,29 +166,29 @@ const Re = { class: "vfp-flex vfp-flex-shrink-0 vfp-border-b vfp-border-line-wea
166
166
  ])) : (v(), u("button", {
167
167
  key: 1,
168
168
  type: "button",
169
- class: U(["tree-row file-row", { selected: L.value }]),
169
+ class: U(["tree-row file-row", { selected: z.value }]),
170
170
  style: W(w.value),
171
- onClick: t[5] || (t[5] = (b) => p("select", r.node)),
171
+ onClick: t[5] || (t[5] = (x) => p("select", r.node)),
172
172
  onMouseenter: _,
173
- onMouseleave: x
173
+ onMouseleave: b
174
174
  }, [
175
175
  t[6] || (t[6] = i("span", { class: "vfp-w-3.5 vfp-h-3.5 vfp-flex-shrink-0" }, null, -1)),
176
- (v(), D(q(z.value), { class: "vfp-w-4 vfp-h-4 vfp-flex-shrink-0 vfp-text-fg-tertiary" })),
176
+ (v(), D(q(y.value), { class: "vfp-w-4 vfp-h-4 vfp-flex-shrink-0 vfp-text-fg-tertiary" })),
177
177
  i("span", Ue, T(r.node.name), 1),
178
178
  i("span", Be, T(g(ue)(r.node.size)), 1)
179
179
  ], 38));
180
180
  };
181
181
  }
182
- }), Ke = /* @__PURE__ */ ne(Ne, [["__scopeId", "data-v-124c382d"]]), Pe = {
182
+ }), je = /* @__PURE__ */ ne(Ne, [["__scopeId", "data-v-124c382d"]]), Ke = {
183
183
  key: 0,
184
184
  class: "vfp-renderer-loading"
185
- }, je = { class: "vfp-renderer-loading-content" }, Oe = { class: "vfp-renderer-loading-text" }, Xe = { class: "vfp-w-full vfp-h-full vfp-overflow-auto" }, Ve = { class: "vfp-w-full vfp-h-full vfp-flex vfp-flex-col" }, Ze = {
185
+ }, Pe = { class: "vfp-renderer-loading-content" }, Oe = { class: "vfp-renderer-loading-text" }, Ae = { class: "vfp-w-full vfp-h-full vfp-overflow-auto" }, Ve = { class: "vfp-w-full vfp-h-full vfp-flex vfp-flex-col" }, Ze = {
186
186
  key: 0,
187
187
  class: "vfp-renderer-loading vfp-flex-1"
188
- }, qe = { class: "vfp-renderer-loading-content" }, Ge = { class: "vfp-renderer-loading-text" }, Je = {
188
+ }, qe = { class: "vfp-renderer-loading-content" }, Ge = { class: "vfp-renderer-loading-text" }, Xe = {
189
189
  key: 1,
190
190
  class: "vfp-flex-1"
191
- }, Ae = {
191
+ }, Je = {
192
192
  key: 2,
193
193
  class: "vfp-flex-1 vfp-flex vfp-items-center vfp-justify-center vfp-text-fg-muted vfp-text-sm vfp-p-6"
194
194
  }, Ye = {
@@ -202,79 +202,79 @@ const Re = { class: "vfp-flex vfp-flex-shrink-0 vfp-border-b vfp-border-line-wea
202
202
  },
203
203
  setup(r, { expose: I }) {
204
204
  const n = fe(
205
- () => import("./index-c-pYJEmH.mjs").then((e) => e.a2)
206
- ), p = r, w = new $e(), { t: f } = te(), L = ce(), z = me(), _ = (e) => {
207
- z.error(e.error, e.stage);
208
- }, x = d(null), o = d(null), t = d(!0), y = d(null), b = d(/* @__PURE__ */ new Set([""])), a = d(null), S = d(!1), $ = d(null), R = d(null), E = d(null), l = d(null), c = () => {
205
+ () => import("./index-B5hprvcF.mjs").then((e) => e.a2)
206
+ ), p = r, w = new $e(), { t: f } = te(), z = ce(), y = me(), _ = (e) => {
207
+ y.error(e.error, e.stage);
208
+ }, b = d(null), o = d(null), t = d(!0), k = d(null), x = d(/* @__PURE__ */ new Set([""])), a = d(null), S = d(!1), $ = d(null), R = d(null), E = d(null), l = d(null), c = () => {
209
209
  var e;
210
210
  (e = a.value) != null && e.blobUrl && URL.revokeObjectURL(a.value.blobUrl);
211
211
  }, F = async () => {
212
- z.begin(p.url), c(), a.value = null, t.value = !0, y.value = null;
212
+ y.begin(p.url), c(), a.value = null, t.value = !0, k.value = null;
213
213
  try {
214
- const e = await L.value(p.url);
214
+ const e = await z.value(p.url);
215
215
  if (!e.ok) throw new he("common.load_failed");
216
- const s = await e.arrayBuffer(), m = await ge(s), k = we(m), h = xe(k);
217
- x.value = m, o.value = h;
216
+ const s = await e.arrayBuffer(), m = await ge(s), L = we(m), h = be(L);
217
+ b.value = m, o.value = h;
218
218
  const M = /* @__PURE__ */ new Set([""]);
219
219
  if (h.children)
220
220
  for (const H of h.children) H.isDir && M.add(H.path);
221
- b.value = M;
221
+ x.value = M, y.ready();
222
222
  } catch (e) {
223
- console.error(e), y.value = f.value("zip.load_failed"), z.error(e);
223
+ console.error(e), k.value = f.value("zip.load_failed"), y.error(e);
224
224
  } finally {
225
225
  t.value = !1;
226
226
  }
227
227
  };
228
- j(() => p.url, (e) => {
228
+ P(() => p.url, (e) => {
229
229
  e && F();
230
230
  }, { immediate: !0 }), Y(() => {
231
231
  c();
232
232
  });
233
- const P = C(() => {
233
+ const K = C(() => {
234
234
  if (!o.value) return null;
235
235
  let e = 0, s = 0, m = 0;
236
- const k = (h) => {
236
+ const L = (h) => {
237
237
  var M;
238
- h.isDir ? (h.path && s++, (M = h.children) == null || M.forEach(k)) : (e++, m += h.size);
238
+ h.isDir ? (h.path && s++, (M = h.children) == null || M.forEach(L)) : (e++, m += h.size);
239
239
  };
240
- return k(o.value), { files: e, dirs: s, size: m };
240
+ return L(o.value), { files: e, dirs: s, size: m };
241
241
  });
242
- j(P, () => w.notify()), I({
242
+ P(K, () => w.notify()), I({
243
243
  getToolbarGroups: () => [],
244
244
  onToolbarChange: (e) => w.subscribe(e)
245
245
  });
246
246
  const le = (e) => {
247
- const s = new Set(b.value);
248
- s.has(e) ? s.delete(e) : s.add(e), b.value = s;
247
+ const s = new Set(x.value);
248
+ s.has(e) ? s.delete(e) : s.add(e), x.value = s;
249
249
  }, oe = (e, s) => {
250
250
  const m = typeof window < "u" ? window.innerWidth - 328 : s.right + 8;
251
251
  R.value = { text: e, x: Math.max(8, Math.min(s.right + 8, m)), y: s.top + s.height / 2 };
252
252
  }, ae = () => {
253
253
  R.value = null;
254
254
  }, se = async (e) => {
255
- var s, m, k;
256
- if (!(!x.value || e.isDir || ((s = a.value) == null ? void 0 : s.path) === e.path || l.value === e.path)) {
255
+ var s, m, L;
256
+ if (!(!b.value || e.isDir || ((s = a.value) == null ? void 0 : s.path) === e.path || l.value === e.path)) {
257
257
  l.value = e.path, c(), a.value = null, S.value = !0, $.value = null;
258
258
  try {
259
- const h = J(e.name), M = await be(x.value, e.path, h !== "application/octet-stream" ? h : void 0), H = URL.createObjectURL(M);
259
+ const h = X(e.name), M = await xe(b.value, e.path, h !== "application/octet-stream" ? h : void 0), H = URL.createObjectURL(M);
260
260
  a.value = { path: e.path, name: e.name, size: e.size, blobUrl: H }, (m = E.value) == null || m.switchTab("right");
261
261
  } catch (h) {
262
- console.error(h), $.value = f.value("zip.entry_read_failed"), (k = E.value) == null || k.switchTab("right");
262
+ console.error(h), $.value = f.value("zip.entry_read_failed"), (L = E.value) == null || L.switchTab("right");
263
263
  } finally {
264
264
  S.value = !1, l.value === e.path && (l.value = null);
265
265
  }
266
266
  }
267
- }, ie = C(() => a.value ? [{ name: a.value.name, url: a.value.blobUrl, type: J(a.value.name) }] : []);
268
- return (e, s) => t.value ? (v(), u("div", Pe, [
269
- i("div", je, [
267
+ }, ie = C(() => a.value ? [{ name: a.value.name, url: a.value.blobUrl, type: X(a.value.name) }] : []);
268
+ return (e, s) => t.value ? (v(), u("div", Ke, [
269
+ i("div", Pe, [
270
270
  s[0] || (s[0] = i("div", { class: "vfp-renderer-spinner" }, null, -1)),
271
271
  i("span", Oe, T(g(f)("common.loading")), 1)
272
272
  ])
273
- ])) : y.value || !o.value ? (v(), D(A, {
273
+ ])) : k.value || !o.value ? (v(), D(J, {
274
274
  key: 1,
275
- message: y.value || g(f)("zip.parse_failed")
275
+ message: k.value || g(f)("zip.parse_failed")
276
276
  }, null, 8, ["message"])) : (v(), u(B, { key: 2 }, [
277
- K(De, {
277
+ j(De, {
278
278
  ref_key: "splitRef",
279
279
  ref: E,
280
280
  "initial-left-width": 280,
@@ -286,15 +286,15 @@ const Re = { class: "vfp-flex vfp-flex-shrink-0 vfp-border-b vfp-border-line-wea
286
286
  "right-tab-label": g(f)("toolbar.preview")
287
287
  }, {
288
288
  left: G(() => [
289
- i("div", Xe, [
289
+ i("div", Ae, [
290
290
  (v(!0), u(B, null, Q(o.value.children || [], (m) => {
291
- var k;
292
- return v(), D(Ke, {
291
+ var L;
292
+ return v(), D(je, {
293
293
  key: m.path,
294
294
  node: m,
295
295
  depth: 0,
296
- "selected-path": ((k = a.value) == null ? void 0 : k.path) ?? null,
297
- expanded: b.value,
296
+ "selected-path": ((L = a.value) == null ? void 0 : L.path) ?? null,
297
+ expanded: x.value,
298
298
  onToggle: le,
299
299
  onSelect: se,
300
300
  onHover: oe,
@@ -310,17 +310,17 @@ const Re = { class: "vfp-flex vfp-flex-shrink-0 vfp-border-b vfp-border-line-wea
310
310
  s[1] || (s[1] = i("div", { class: "vfp-renderer-spinner" }, null, -1)),
311
311
  i("span", Ge, T(g(f)("common.loading")), 1)
312
312
  ])
313
- ])) : $.value ? (v(), u("div", Je, [
314
- K(A, { message: $.value }, null, 8, ["message"])
313
+ ])) : $.value ? (v(), u("div", Xe, [
314
+ j(J, { message: $.value }, null, 8, ["message"])
315
315
  ])) : a.value ? (v(), u("div", Ye, [
316
- K(g(n), {
316
+ j(g(n), {
317
317
  mode: "embed",
318
318
  files: ie.value,
319
319
  "current-index": 0,
320
320
  "zip-nesting-depth": r.nestingDepth + 1,
321
321
  onError: _
322
322
  }, null, 8, ["files", "zip-nesting-depth"])
323
- ])) : (v(), u("div", Ae, T(g(f)("zip.select_file")), 1))
323
+ ])) : (v(), u("div", Je, T(g(f)("zip.select_file")), 1))
324
324
  ])
325
325
  ]),
326
326
  _: 1
@@ -3,13 +3,13 @@ import F from "markdown-it";
3
3
  import W from "@traptitech/markdown-it-katex";
4
4
  import { codeToHtml as L } from "shiki";
5
5
  import { Code as z, Eye as J } from "lucide-vue-next";
6
- import { u as Q, a as U, b as X, g as Z, h as ee, e as te } from "./index-c-pYJEmH.mjs";
6
+ import { u as Q, a as U, b as X, e as Z, f as ee, d as te } from "./index-B5hprvcF.mjs";
7
7
  import { _ as oe } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
8
8
  import { T as re } from "./base.types-DaftHyg7.mjs";
9
9
  const ne = {
10
10
  key: 0,
11
11
  class: "vfp-renderer-loading"
12
- }, se = { class: "vfp-renderer-loading-content" }, le = { class: "vfp-renderer-loading-text" }, ae = {
12
+ }, se = { class: "vfp-renderer-loading-content" }, ae = { class: "vfp-renderer-loading-text" }, le = {
13
13
  key: 2,
14
14
  class: "vfp-w-full vfp-h-full vfp-overflow-auto",
15
15
  style: { background: "var(--fp-code-bg)" }
@@ -25,9 +25,9 @@ const ne = {
25
25
  url: {}
26
26
  },
27
27
  setup(G, { expose: $ }) {
28
- const _ = G, C = new re(), { t: a } = Q(), j = U(), T = X(), A = Z(), b = O(() => A.value === "light" ? "github-light" : "github-dark"), c = i("preview"), x = i(""), v = i(""), h = i(""), u = i(!0), f = i(null), m = i(null);
28
+ const _ = G, T = new re(), { t: l } = Q(), j = U(), b = X(), A = Z(), x = O(() => A.value === "light" ? "github-light" : "github-dark"), c = i("preview"), C = i(""), v = i(""), h = i(""), u = i(!0), f = i(null), m = i(null);
29
29
  k([c, u], () => {
30
- C.notify();
30
+ T.notify();
31
31
  }), $({
32
32
  getToolbarGroups: () => {
33
33
  const e = [];
@@ -36,7 +36,7 @@ const ne = {
36
36
  {
37
37
  type: "button",
38
38
  icon: c.value === "preview" ? z : J,
39
- tooltip: c.value === "preview" ? a.value("toolbar.source") : a.value("toolbar.preview"),
39
+ tooltip: c.value === "preview" ? l.value("toolbar.source") : l.value("toolbar.preview"),
40
40
  action: () => {
41
41
  c.value = c.value === "preview" ? "source" : "preview";
42
42
  },
@@ -45,7 +45,7 @@ const ne = {
45
45
  ]
46
46
  }), e;
47
47
  },
48
- onToolbarChange: (e) => C.subscribe(e)
48
+ onToolbarChange: (e) => T.subscribe(e)
49
49
  });
50
50
  const s = new F({
51
51
  html: !0,
@@ -74,21 +74,21 @@ const ne = {
74
74
  const I = s.renderer.rules.table_close || ((e, r, t, n, o) => o.renderToken(e, r, t));
75
75
  s.renderer.rules.table_close = (e, r, t, n, o) => I(e, r, t, n, o) + "</div>";
76
76
  const M = async () => {
77
- T.begin(_.url), u.value = !0, f.value = null;
77
+ b.begin(_.url), u.value = !0, f.value = null;
78
78
  try {
79
79
  const e = await ee(_.url, { fetcher: j.value });
80
- x.value = e, v.value = s.render(e), u.value = !1;
80
+ C.value = e, v.value = s.render(e), u.value = !1, b.ready();
81
81
  try {
82
- h.value = await L(e, { lang: "markdown", theme: b.value });
82
+ h.value = await L(e, { lang: "markdown", theme: x.value });
83
83
  } catch {
84
84
  h.value = "";
85
85
  }
86
86
  } catch (e) {
87
- console.error(e), f.value = a.value("markdown.load_failed"), u.value = !1, T.error(e);
87
+ console.error(e), f.value = l.value("markdown.load_failed"), u.value = !1, b.error(e);
88
88
  }
89
89
  }, S = (e, r) => {
90
90
  const t = document.createElement("button");
91
- return t.type = "button", t.className = r ? "code-copy-btn" : "code-copy-btn code-copy-float", t.title = a.value("markdown.copy_code"), t.innerHTML = r ? q : V, t.addEventListener("click", async (n) => {
91
+ return t.type = "button", t.className = r ? "code-copy-btn" : "code-copy-btn code-copy-float", t.title = l.value("markdown.copy_code"), t.innerHTML = r ? q : V, t.addEventListener("click", async (n) => {
92
92
  n.stopPropagation();
93
93
  try {
94
94
  await navigator.clipboard.writeText(e);
@@ -96,8 +96,8 @@ const ne = {
96
96
  const o = document.createElement("textarea");
97
97
  o.value = e, document.body.appendChild(o), o.select(), document.execCommand("copy"), document.body.removeChild(o);
98
98
  }
99
- t.innerHTML = r ? pe : ve, t.title = a.value("markdown.copied"), setTimeout(() => {
100
- t.innerHTML = r ? q : V, t.title = a.value("markdown.copy_code");
99
+ t.innerHTML = r ? pe : ve, t.title = l.value("markdown.copied"), setTimeout(() => {
100
+ t.innerHTML = r ? q : V, t.title = l.value("markdown.copy_code");
101
101
  }, 2e3);
102
102
  }), t;
103
103
  }, D = async () => {
@@ -105,9 +105,9 @@ const ne = {
105
105
  if (!m.value) return;
106
106
  const e = m.value.querySelectorAll('pre[data-shiki-pending="1"]');
107
107
  for (const o of e) {
108
- const w = o.getAttribute("data-lang") || "text", l = ((t = o.querySelector("code")) == null ? void 0 : t.textContent) || "";
108
+ const w = o.getAttribute("data-lang") || "text", a = ((t = o.querySelector("code")) == null ? void 0 : t.textContent) || "";
109
109
  try {
110
- const g = await L(l, { lang: w, theme: b.value }), H = document.createElement("div");
110
+ const g = await L(a, { lang: w, theme: x.value }), H = document.createElement("div");
111
111
  H.innerHTML = g;
112
112
  const E = H.firstElementChild;
113
113
  E && o.replaceWith(E);
@@ -118,28 +118,28 @@ const ne = {
118
118
  const r = m.value.querySelectorAll(".code-block-wrapper");
119
119
  for (const o of r) {
120
120
  if (o.querySelector(".code-copy-btn")) continue;
121
- const w = o.querySelector(".code-block-header"), l = o.querySelector("pre"), g = ((n = l == null ? void 0 : l.querySelector("code")) == null ? void 0 : n.textContent) ?? (l == null ? void 0 : l.textContent) ?? "";
121
+ const w = o.querySelector(".code-block-header"), a = o.querySelector("pre"), g = ((n = a == null ? void 0 : a.querySelector("code")) == null ? void 0 : n.textContent) ?? (a == null ? void 0 : a.textContent) ?? "";
122
122
  w ? w.appendChild(S(g, !0)) : o.appendChild(S(g, !1));
123
123
  }
124
124
  };
125
125
  return k(() => _.url, M, { immediate: !0 }), k(v, async () => {
126
126
  v.value && (await R(), D());
127
- }), k(b, () => {
128
- x.value && M();
127
+ }), k(x, () => {
128
+ C.value && M();
129
129
  }), (e, r) => u.value ? (d(), p("div", ne, [
130
130
  y("div", se, [
131
131
  r[0] || (r[0] = y("div", { class: "vfp-renderer-spinner" }, null, -1)),
132
- y("span", le, B(N(a)("common.loading")), 1)
132
+ y("span", ae, B(N(l)("common.loading")), 1)
133
133
  ])
134
134
  ])) : f.value ? (d(), Y(oe, {
135
135
  key: 1,
136
136
  message: f.value
137
- }, null, 8, ["message"])) : c.value === "source" ? (d(), p("div", ae, [
137
+ }, null, 8, ["message"])) : c.value === "source" ? (d(), p("div", le, [
138
138
  h.value ? (d(), p("div", {
139
139
  key: 1,
140
140
  class: "shiki-wrapper",
141
141
  innerHTML: h.value
142
- }, null, 8, ie)) : (d(), p("pre", ce, B(x.value), 1))
142
+ }, null, 8, ie)) : (d(), p("pre", ce, B(C.value), 1))
143
143
  ])) : (d(), p("div", de, [
144
144
  y("div", {
145
145
  ref_key: "containerRef",
@@ -149,7 +149,7 @@ const ne = {
149
149
  }, null, 8, ue)
150
150
  ]));
151
151
  }
152
- }), Ce = /* @__PURE__ */ te(he, [["__scopeId", "data-v-51689691"]]);
152
+ }), Ce = /* @__PURE__ */ te(he, [["__scopeId", "data-v-67620d24"]]);
153
153
  export {
154
154
  Ce as default
155
155
  };
@@ -1,11 +1,11 @@
1
- import { defineComponent as h, ref as c, onMounted as w, watch as x, onBeforeUnmount as E, openBlock as f, createBlock as C, createElementBlock as _, createElementVNode as a, toDisplayString as j, unref as D, createCommentVNode as P } from "vue";
2
- import B from "video.js";
3
- import { u as N, b as R, j as y } from "./index-c-pYJEmH.mjs";
4
- import { _ as S } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
5
- const U = {
1
+ import { defineComponent as h, ref as c, onMounted as w, watch as x, onBeforeUnmount as E, openBlock as f, createBlock as C, createElementBlock as _, createElementVNode as a, toDisplayString as B, unref as D, createCommentVNode as P } from "vue";
2
+ import N from "video.js";
3
+ import { u as R, b as S, B as y } from "./index-B5hprvcF.mjs";
4
+ import { _ as U } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
5
+ const V = {
6
6
  key: 1,
7
7
  class: "vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"
8
- }, V = { class: "vfp-w-full vfp-h-full vfp-relative" }, q = {
8
+ }, j = { class: "vfp-w-full vfp-h-full vfp-relative" }, q = {
9
9
  key: 0,
10
10
  class: "vfp-absolute vfp-inset-0 vfp-renderer-loading vfp-bg-surface-3 vfp-backdrop-blur-sm vfp-z-10"
11
11
  }, L = { class: "vfp-renderer-loading-content" }, G = { class: "vfp-renderer-loading-text" }, X = /* @__PURE__ */ h({
@@ -16,20 +16,20 @@ const U = {
16
16
  mimeType: {}
17
17
  },
18
18
  setup(g, { expose: k }) {
19
- const o = g, { t } = N(), d = R(), T = /* @__PURE__ */ new Set(["avi", "wmv", "flv"]), i = c(null), u = c(!0), p = c(null);
19
+ const o = g, { t } = R(), u = S(), T = /* @__PURE__ */ new Set(["avi", "wmv", "flv"]), i = c(null), d = c(!0), p = c(null);
20
20
  let e = null;
21
21
  const b = (s, r) => {
22
22
  var n;
23
23
  return ((n = (r || s).split(".").pop()) == null ? void 0 : n.toLowerCase().split("?")[0]) || "";
24
24
  };
25
25
  return w(() => {
26
- if (d.begin(o.url), !p.value || e) return;
26
+ if (u.begin(o.url), !p.value || e) return;
27
27
  const s = b(o.url, o.fileName);
28
28
  if (T.has(s)) {
29
29
  i.value = {
30
30
  title: t.value("video.unsupported_title"),
31
31
  detail: t.value("video.unsupported_detail", { format: s.toUpperCase() })
32
- }, u.value = !1;
32
+ }, d.value = !1;
33
33
  return;
34
34
  }
35
35
  const r = document.createElement("video-js");
@@ -39,7 +39,7 @@ const U = {
39
39
  v === "video/quicktime" ? n = [
40
40
  { src: o.url, type: "video/quicktime" },
41
41
  { src: o.url, type: "video/mp4" }
42
- ] : n = [{ src: o.url, type: v }], e = B(r, {
42
+ ] : n = [{ src: o.url, type: v }], e = N(r, {
43
43
  controls: !0,
44
44
  fill: !0,
45
45
  preload: "auto",
@@ -69,7 +69,7 @@ const U = {
69
69
  });
70
70
  const m = e.el().querySelector("video");
71
71
  m && (m.style.objectFit = "contain"), e.on("loadeddata", () => {
72
- u.value = !1;
72
+ d.value = !1, u.ready();
73
73
  }), e.on("error", () => {
74
74
  const l = e == null ? void 0 : e.error();
75
75
  console.warn("[VideoRenderer] Video playback error:", (l == null ? void 0 : l.message) || "Unknown error"), (l == null ? void 0 : l.code) === 4 ? i.value = {
@@ -80,27 +80,27 @@ const U = {
80
80
  } : i.value = {
81
81
  title: t.value("video.load_failed"),
82
82
  detail: (l == null ? void 0 : l.message) || t.value("common.unknown_error")
83
- }, u.value = !1, d.error(l ?? new Error("video load failed"), (l == null ? void 0 : l.code) === 2 ? "request" : "parse");
83
+ }, d.value = !1, u.error(l ?? new Error("video load failed"), (l == null ? void 0 : l.code) === 2 ? "request" : "parse");
84
84
  });
85
85
  }), x(
86
86
  [() => o.url, () => o.mimeType],
87
87
  () => {
88
- d.begin(o.url), e && !e.isDisposed() && e.src({ src: o.url, type: y(o.url, o.mimeType) });
88
+ u.begin(o.url), e && !e.isDisposed() && e.src({ src: o.url, type: y(o.url, o.mimeType) });
89
89
  }
90
90
  ), E(() => {
91
91
  e && !e.isDisposed() && (e.dispose(), e = null);
92
92
  }), k({
93
93
  getToolbarGroups: () => []
94
- }), (s, r) => i.value ? (f(), C(S, {
94
+ }), (s, r) => i.value ? (f(), C(U, {
95
95
  key: 0,
96
96
  message: i.value.title,
97
97
  detail: i.value.detail
98
- }, null, 8, ["message", "detail"])) : (f(), _("div", U, [
99
- a("div", V, [
100
- u.value ? (f(), _("div", q, [
98
+ }, null, 8, ["message", "detail"])) : (f(), _("div", V, [
99
+ a("div", j, [
100
+ d.value ? (f(), _("div", q, [
101
101
  a("div", L, [
102
102
  r[0] || (r[0] = a("div", { class: "vfp-renderer-spinner" }, null, -1)),
103
- a("p", G, j(D(t)("video.loading")), 1)
103
+ a("p", G, B(D(t)("video.loading")), 1)
104
104
  ])
105
105
  ])) : P("", !0),
106
106
  a("div", {