@eternalheart/vue-file-preview 1.6.5 → 1.6.7

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 (34) hide show
  1. package/README.md +9 -3
  2. package/README.zh-CN.md +9 -3
  3. package/lib/FilePreviewContent.vue.d.ts +6 -0
  4. package/lib/FilePreviewEmbed.vue.d.ts +6 -0
  5. package/lib/FilePreviewModal.vue.d.ts +6 -0
  6. package/lib/chunks/{index-CaChuF62.mjs → index--sqXkUEP.mjs} +18 -19
  7. package/lib/chunks/{index-e0CU-cuJ.mjs → index-06Ivpw6V.mjs} +1 -1
  8. package/lib/chunks/{index-Dq541Zfu.mjs → index-B3jcS1UB.mjs} +1 -1
  9. package/lib/chunks/index-B6UNmyiS.mjs +329 -0
  10. package/lib/chunks/{index-yvSDwlVY.mjs → index-BWNmKHd0.mjs} +2 -2
  11. package/lib/chunks/{index-DR87l2gD.mjs → index-BflKoE04.mjs} +1 -1
  12. package/lib/chunks/{index-Do_q3F1Q.mjs → index-BgTW_P3u.mjs} +1 -1
  13. package/lib/chunks/{index-COciDyvJ.mjs → index-BmsJxBJa.mjs} +2 -2
  14. package/lib/chunks/index-CBN0qoP1.mjs +270 -0
  15. package/lib/chunks/{index-5bftazEI.mjs → index-CK43N0Ho.mjs} +1 -1
  16. package/lib/chunks/{index-C4x3R4P6.mjs → index-CR3QkKJt.mjs} +1 -1
  17. package/lib/chunks/{index-CDdmBvY6.mjs → index-CSY197_j.mjs} +1 -1
  18. package/lib/chunks/{index-DjgGNQ_1.mjs → index-CXAEvuVP.mjs} +1 -1
  19. package/lib/chunks/{index-DLHCSwf3.mjs → index-Cr7raBmi.mjs} +1 -1
  20. package/lib/chunks/{index-Bjh8pgvO.mjs → index-Cv0lIWeI.mjs} +1 -1
  21. package/lib/chunks/{index-Bso3kiuo.mjs → index-CyIp8Xfg.mjs} +1 -1
  22. package/lib/chunks/{index-CVQmCNmf.mjs → index-D_XKzCZJ.mjs} +15 -15
  23. package/lib/chunks/{index-DwHqKJVc.mjs → index-DdbaVSB8.mjs} +768 -746
  24. package/lib/chunks/{index-CH0gyinl.mjs → index-DlIRXpmw.mjs} +1 -1
  25. package/lib/chunks/{index-DA_KAGO4.mjs → index-DoqCnKkl.mjs} +2 -2
  26. package/lib/chunks/{index-BFZyrk0b.mjs → index-Xta2zHnj.mjs} +1 -1
  27. package/lib/chunks/{index-BujnNIdi.mjs → index-sPfLaVRe.mjs} +1 -1
  28. package/lib/chunks/{useShikiHighlight-CMxdbY5k.mjs → useShikiHighlight-J62fUszo.mjs} +1 -1
  29. package/lib/index.cjs +50 -61
  30. package/lib/index.css +1 -1
  31. package/lib/index.mjs +1 -1
  32. package/package.json +1 -1
  33. package/lib/chunks/index-CmUWVGTa.mjs +0 -466
  34. package/lib/chunks/index-DezBKYfu.mjs +0 -264
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as K, ref as u, computed as z, onMounted as ne, onBeforeUnmount as q, watch as j, openBlock as a, createElementBlock as c, Fragment as I, createElementVNode as i, normalizeClass as D, toDisplayString as $, withDirectives as V, renderSlot as W, vShow as H, normalizeStyle as F, resolveComponent as le, createVNode as B, unref as C, createBlock as R, resolveDynamicComponent as O, renderList as G, createCommentVNode as A, defineAsyncComponent as oe, withCtx as P, Teleport as se } from "vue";
2
- import { _ as X, V as ae, R as ie, u as re, b as fe, f as Z, h as ve, I as de, K as pe, w as ue } from "./index-DwHqKJVc.mjs";
2
+ import { _ as X, V as ae, R as ie, u as re, b as fe, f as Z, h as ve, I as de, K as pe, w as ue } from "./index-DdbaVSB8.mjs";
3
3
  import { FileImage as ce, FileText as me, FileCode as he, File as we, ChevronRight as be, FolderOpen as ge, Folder as ye } from "lucide-vue-next";
4
4
  import { _ as xe } from "./RendererError.vue_vue_type_script_setup_true_lang-BNoENOWX.mjs";
5
5
  import { T as ke } from "./base.types-DaftHyg7.mjs";
@@ -194,7 +194,7 @@ const Le = { class: "vfp-flex vfp-flex-shrink-0 vfp-border-b vfp-border-line-wea
194
194
  },
195
195
  setup(s, { expose: M }) {
196
196
  const l = oe(
197
- () => import("./index-DwHqKJVc.mjs").then((e) => e.x)
197
+ () => import("./index-DdbaVSB8.mjs").then((e) => e.x)
198
198
  ), v = s, g = new ke(), { t: h } = re(), T = fe(), b = u(null), d = u(null), y = u(!0), r = u(null), t = u(/* @__PURE__ */ new Set([""])), f = u(null), x = u(!1), p = u(null), n = u(null), w = u(null), S = () => {
199
199
  var e;
200
200
  (e = f.value) != null && e.blobUrl && URL.revokeObjectURL(f.value.blobUrl);
@@ -0,0 +1,270 @@
1
+ import { defineComponent as ie, ref as S, onMounted as ne, onUnmounted as se, watch as ae, openBlock as H, createElementBlock as W, createElementVNode as B, toDisplayString as U, createCommentVNode as Z, unref as le } from "vue";
2
+ import * as o from "three";
3
+ import { OrbitControls as fe } from "three/examples/jsm/controls/OrbitControls";
4
+ import { DXFLoader as ce } from "three-dxf-loader";
5
+ import { STLLoader as ue } from "three/examples/jsm/loaders/STLLoader";
6
+ import { OBJLoader as de } from "three/examples/jsm/loaders/OBJLoader";
7
+ import { GLTFLoader as pe } from "three/examples/jsm/loaders/GLTFLoader";
8
+ import { u as me, b as ve } from "./index-DdbaVSB8.mjs";
9
+ import { T as ge } from "./base.types-DaftHyg7.mjs";
10
+ import { RotateCcw as we, Box as he, Grid3x3 as be, Axis3d as ye } from "lucide-vue-next";
11
+ function Me(c) {
12
+ return [
13
+ {
14
+ items: [
15
+ {
16
+ type: "button",
17
+ icon: we,
18
+ tooltip: c.t("toolbar.reset"),
19
+ action: () => {
20
+ var p;
21
+ return (p = c.cadRef) == null ? void 0 : p.resetView();
22
+ }
23
+ }
24
+ ]
25
+ },
26
+ {
27
+ items: [
28
+ {
29
+ type: "button",
30
+ icon: he,
31
+ tooltip: c.wireframe ? c.t("cad.solid") : c.t("cad.wireframe"),
32
+ active: c.wireframe,
33
+ action: () => {
34
+ var p;
35
+ return (p = c.cadRef) == null ? void 0 : p.toggleWireframe();
36
+ }
37
+ },
38
+ {
39
+ type: "button",
40
+ icon: be,
41
+ tooltip: c.t("cad.grid"),
42
+ active: c.showGrid,
43
+ action: () => {
44
+ var p;
45
+ return (p = c.cadRef) == null ? void 0 : p.toggleGrid();
46
+ }
47
+ },
48
+ {
49
+ type: "button",
50
+ icon: ye,
51
+ tooltip: c.t("cad.axes"),
52
+ active: c.showAxes,
53
+ action: () => {
54
+ var p;
55
+ return (p = c.cadRef) == null ? void 0 : p.toggleAxes();
56
+ }
57
+ }
58
+ ]
59
+ }
60
+ ];
61
+ }
62
+ const xe = {
63
+ key: 0,
64
+ class: "vfp-absolute vfp-inset-0 vfp-flex vfp-items-center vfp-justify-center vfp-bg-surface-3 vfp-z-10"
65
+ }, Le = { class: "vfp-text-center" }, Ee = { class: "vfp-text-fg-primary" }, _e = {
66
+ key: 1,
67
+ class: "vfp-absolute vfp-inset-0 vfp-flex vfp-items-center vfp-justify-center vfp-bg-surface-3 vfp-z-10"
68
+ }, Ae = { class: "vfp-text-center" }, ze = { class: "vfp-mt-4 vfp-text-fg-secondary" }, Ve = /* @__PURE__ */ ie({
69
+ __name: "index",
70
+ props: {
71
+ url: {},
72
+ file: {},
73
+ fileName: {}
74
+ },
75
+ setup(c, { expose: p }) {
76
+ const x = c, { t: R } = me(), q = ve(), y = S(null), _ = S(!0), A = S(null), F = S(!1), G = S(!0), P = S(!0);
77
+ let r = null, a = null, s = null, l = null, M = null, u = null, d = null, V = null, z = null, v = !1;
78
+ const T = new ge(), J = (e, t, i) => {
79
+ var m, g, w;
80
+ return i != null && i.name ? ((m = i.name.split(".").pop()) == null ? void 0 : m.toLowerCase()) || "" : t ? ((g = t.split(".").pop()) == null ? void 0 : g.toLowerCase()) || "" : ((w = e.split(".").pop()) == null ? void 0 : w.toLowerCase().split("?")[0]) || "";
81
+ }, X = () => {
82
+ if (!l || !a || !M) return;
83
+ const e = new o.Box3().setFromObject(M), t = e.getCenter(new o.Vector3()), i = e.getSize(new o.Vector3()), m = Math.max(i.x, i.y, i.z), g = a.fov * (Math.PI / 180);
84
+ let w = Math.abs(m / 2 / Math.tan(g / 2));
85
+ w *= 1.5, a.position.set(t.x + w, t.y + w, t.z + w), a.lookAt(t), l.target.copy(t), l.update();
86
+ }, K = () => {
87
+ F.value = !F.value, M && M.traverse((e) => {
88
+ if (e instanceof o.Mesh) {
89
+ const t = e.material;
90
+ t && (Array.isArray(t) ? t.forEach((i) => {
91
+ i.wireframe = F.value;
92
+ }) : t.wireframe = F.value);
93
+ }
94
+ }), T.notify();
95
+ }, Q = () => {
96
+ G.value = !G.value, u && (u.visible = G.value), T.notify();
97
+ }, Y = () => {
98
+ P.value = !P.value, d && (d.visible = P.value), T.notify();
99
+ }, $ = (e) => {
100
+ if (!r) return;
101
+ const t = Number.isFinite(e) && e > 0 ? e : 1, i = t * 0.5, m = t * 2;
102
+ u && (u.geometry.dispose(), u.material.dispose(), r.remove(u)), d && (d.geometry.dispose(), d.material.dispose(), r.remove(d)), u = new o.GridHelper(m, 20, 4473924, 2236962), u.visible = G.value, r.add(u), d = new o.AxesHelper(i), d.visible = P.value, r.add(d);
103
+ };
104
+ p({
105
+ getToolbarGroups: () => Me({
106
+ cadRef: { resetView: X, toggleWireframe: K, toggleGrid: Q, toggleAxes: Y },
107
+ wireframe: F.value,
108
+ showGrid: G.value,
109
+ showAxes: P.value,
110
+ t: R.value
111
+ }),
112
+ onToolbarChange: (e) => T.subscribe(e)
113
+ });
114
+ const ee = (e) => {
115
+ e.traverse((t) => {
116
+ t.geometry && t.geometry.dispose(), t.material && (Array.isArray(t.material) ? t.material.forEach((i) => {
117
+ D(i);
118
+ }) : D(t.material));
119
+ });
120
+ }, D = (e) => {
121
+ e.map && e.map.dispose(), e.lightMap && e.lightMap.dispose(), e.bumpMap && e.bumpMap.dispose(), e.normalMap && e.normalMap.dispose(), e.specularMap && e.specularMap.dispose(), e.envMap && e.envMap.dispose(), e.dispose();
122
+ }, N = () => {
123
+ if (!y.value) return;
124
+ v = !1, z = new AbortController();
125
+ const e = y.value, t = e.clientWidth, i = e.clientHeight;
126
+ r = new o.Scene(), r.background = new o.Color(1710618), a = new o.PerspectiveCamera(45, t / i, 0.1, 1e4), a.position.set(100, 100, 100), s = new o.WebGLRenderer({ antialias: !0 }), s.setSize(t, i), s.setPixelRatio(window.devicePixelRatio), e.appendChild(s.domElement), l = new fe(a, s.domElement), l.enableDamping = !0, l.dampingFactor = 0.05;
127
+ const m = new o.AmbientLight(16777215, 0.6);
128
+ r.add(m);
129
+ const g = new o.DirectionalLight(16777215, 0.8);
130
+ g.position.set(1, 1, 1), r.add(g);
131
+ const w = new o.DirectionalLight(16777215, 0.4);
132
+ w.position.set(-1, -1, -1), r.add(w), te();
133
+ const n = () => {
134
+ v || (V = requestAnimationFrame(n), l == null || l.update(), r && a && s && s.render(r, a));
135
+ };
136
+ n(), window.addEventListener("resize", O);
137
+ }, te = () => {
138
+ if (!r || !a || !l || v) return;
139
+ const e = J(x.url, x.fileName, x.file);
140
+ let t;
141
+ const i = new o.LoadingManager();
142
+ if (e === "dxf")
143
+ t = new ce();
144
+ else if (e === "stl")
145
+ t = new ue(i);
146
+ else if (e === "obj")
147
+ t = new de(i);
148
+ else if (e === "gltf" || e === "glb")
149
+ t = new pe(i);
150
+ else {
151
+ A.value = R.value("cad.parse_failed"), _.value = !1;
152
+ return;
153
+ }
154
+ const m = (n, h) => {
155
+ if (v) return;
156
+ if (!n) {
157
+ A.value = R.value("cad.parse_failed"), _.value = !1;
158
+ return;
159
+ }
160
+ let b;
161
+ if (h === "stl") {
162
+ const k = n, re = new o.MeshPhongMaterial({
163
+ color: 8947848,
164
+ flatShading: !0,
165
+ side: o.DoubleSide
166
+ });
167
+ b = new o.Mesh(k, re);
168
+ } else h === "gltf" || h === "glb" ? b = n.scene : (b = n, b.traverse((k) => {
169
+ k instanceof o.Mesh && !k.material && (k.material = new o.MeshPhongMaterial({
170
+ color: 8947848,
171
+ side: o.DoubleSide
172
+ }));
173
+ }));
174
+ r.add(b), M = b;
175
+ const L = new o.Box3().setFromObject(b), f = L.getCenter(new o.Vector3()), E = L.getSize(new o.Vector3()), C = Math.max(E.x, E.y, E.z);
176
+ $(C);
177
+ const oe = a.fov * (Math.PI / 180);
178
+ let j = Math.abs(C / 2 / Math.tan(oe / 2));
179
+ j *= 1.5, a.position.set(f.x + j, f.y + j, f.z + j), a.lookAt(f), l.target.copy(f), l.update(), _.value = !1, T.notify();
180
+ }, g = (n) => {
181
+ v || n.name !== "AbortError" && (A.value = R.value("cad.load_failed"), _.value = !1);
182
+ };
183
+ (x.file ? x.file.arrayBuffer() : q.value(x.url, { signal: z == null ? void 0 : z.signal }).then((n) => {
184
+ if (!v) {
185
+ if (!n.ok) throw new Error("Failed to fetch file");
186
+ return n.arrayBuffer();
187
+ }
188
+ })).then((n) => {
189
+ if (!(v || !n)) {
190
+ if (e === "stl") {
191
+ const h = t.parse(n);
192
+ m(h, e);
193
+ } else if (e === "obj") {
194
+ const b = new TextDecoder("utf-8").decode(n), L = t.parse(b);
195
+ m(L, e);
196
+ } else if (e === "gltf" || e === "glb")
197
+ t.parse(
198
+ n,
199
+ "",
200
+ (h) => {
201
+ v || m(h, e);
202
+ },
203
+ (h) => g(h)
204
+ );
205
+ else if (e === "dxf") {
206
+ const b = new TextDecoder("utf-8").decode(n), L = o.BufferGeometry.prototype.setFromPoints;
207
+ o.BufferGeometry.prototype.setFromPoints = function(f) {
208
+ const E = (f || []).filter(
209
+ (C) => C && C.x !== void 0 && C.y !== void 0
210
+ );
211
+ return L.call(this, E);
212
+ };
213
+ try {
214
+ t.loadString(
215
+ b,
216
+ (f) => {
217
+ if (!v) {
218
+ const E = (f == null ? void 0 : f.entity) || f;
219
+ m(E, e);
220
+ }
221
+ },
222
+ (f) => {
223
+ g(f);
224
+ }
225
+ );
226
+ } catch (f) {
227
+ g(f);
228
+ } finally {
229
+ o.BufferGeometry.prototype.setFromPoints = L;
230
+ }
231
+ }
232
+ }
233
+ }).catch((n) => {
234
+ v || g(n);
235
+ });
236
+ }, O = () => {
237
+ if (!y.value || !a || !s || v) return;
238
+ const e = y.value.clientWidth, t = y.value.clientHeight;
239
+ a.aspect = e / t, a.updateProjectionMatrix(), s.setSize(e, t);
240
+ }, I = () => {
241
+ v = !0, z && z.abort(), V !== null && (cancelAnimationFrame(V), V = null), window.removeEventListener("resize", O), M && (ee(M), r == null || r.remove(M), M = null), u && (u.geometry.dispose(), u.material.dispose(), r == null || r.remove(u), u = null), d && (d.geometry.dispose(), d.material.dispose(), r == null || r.remove(d), d = null), l == null || l.dispose(), s == null || s.dispose(), y.value && (s != null && s.domElement) && y.value.contains(s.domElement) && y.value.removeChild(s.domElement), r = null, a = null, s = null, l = null;
242
+ };
243
+ return ne(() => {
244
+ N();
245
+ }), se(() => {
246
+ I();
247
+ }), ae(() => x.url, () => {
248
+ I(), _.value = !0, A.value = null, y.value && N();
249
+ }), (e, t) => (H(), W("div", {
250
+ ref_key: "containerRef",
251
+ ref: y,
252
+ class: "vfp-relative vfp-w-full vfp-h-full vfp-bg-media-bg"
253
+ }, [
254
+ A.value ? (H(), W("div", xe, [
255
+ B("div", Le, [
256
+ B("p", Ee, U(A.value), 1)
257
+ ])
258
+ ])) : Z("", !0),
259
+ _.value ? (H(), W("div", _e, [
260
+ B("div", Ae, [
261
+ t[0] || (t[0] = B("div", { class: "vfp-inline-block vfp-w-8 vfp-h-8 vfp-border-4 vfp-border-spinner-track vfp-border-t-spinner-head vfp-rounded-full vfp-animate-spin" }, null, -1)),
262
+ B("p", ze, U(le(R)("cad.loading")), 1)
263
+ ])
264
+ ])) : Z("", !0)
265
+ ], 512));
266
+ }
267
+ });
268
+ export {
269
+ Ve as default
270
+ };
@@ -1,7 +1,7 @@
1
1
  import { defineComponent as E, ref as p, onMounted as D, watch as M, onBeforeUnmount as z, openBlock as v, createElementBlock as h, createElementVNode as m, toDisplayString as B, unref as _, createCommentVNode as w, createBlock as S, normalizeStyle as C } from "vue";
2
2
  import W from "exceljs";
3
3
  import { S as H } from "./index-CyBXARuf.mjs";
4
- import { u as R, b as G, C as L, s as F, y as N, g as O } from "./index-DwHqKJVc.mjs";
4
+ import { u as R, b as G, C as L, s as F, y as N, g as O } from "./index-DdbaVSB8.mjs";
5
5
  import { _ as V } from "./RendererError.vue_vue_type_script_setup_true_lang-BNoENOWX.mjs";
6
6
  const $ = { class: "vfp-relative vfp-flex vfp-flex-col vfp-items-center vfp-w-full vfp-h-full" }, j = {
7
7
  key: 0,
@@ -1,7 +1,7 @@
1
1
  import { defineComponent as me, ref as p, watch as ue, onMounted as ce, onBeforeUnmount as ve, openBlock as S, createElementBlock as B, createBlock as Me, createCommentVNode as D, createElementVNode as h, normalizeStyle as W, toDisplayString as Ce, unref as K, createVNode as de, h as N } from "vue";
2
2
  import { List as Se, ChevronLeft as Ne, ChevronRight as Re, Minimize2 as ze, Maximize2 as Ae, X as Le } from "lucide-vue-next";
3
3
  import "foliate-js/view.js";
4
- import { u as Fe, b as Pe, _ as $e } from "./index-DwHqKJVc.mjs";
4
+ import { u as Fe, b as Pe, _ as $e } from "./index-DdbaVSB8.mjs";
5
5
  import { _ as He } from "./RendererError.vue_vue_type_script_setup_true_lang-BNoENOWX.mjs";
6
6
  import { T as Be } from "./base.types-DaftHyg7.mjs";
7
7
  const De = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-center vfp-bg-surface-1 vfp-overflow-hidden" }, We = {
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as d, ref as U, watch as h, openBlock as $, createElementBlock as q, createElementVNode as x, createBlock as K, createVNode as C, unref as ee, h as g, inject as ne, computed as H } from "vue";
2
- import { u as le, b as te, e as ie, L as ue, G as fe, c as oe } from "./index-DwHqKJVc.mjs";
2
+ import { u as le, b as te, e as ie, L as ue, G as fe, c as oe } from "./index-DdbaVSB8.mjs";
3
3
  import { _ as se } from "./RendererError.vue_vue_type_script_setup_true_lang-BNoENOWX.mjs";
4
4
  import { ChevronDown as ce, ChevronRight as pe } from "lucide-vue-next";
5
5
  function ke(e, f = !1) {
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as m, ref as a, watch as _, openBlock as n, createElementBlock as c, createElementVNode as l, createBlock as h } from "vue";
2
- import { u as w, b as y, T as x } from "./index-DwHqKJVc.mjs";
2
+ import { u as w, b as y, T as x } from "./index-DdbaVSB8.mjs";
3
3
  import { _ as g } from "./RendererError.vue_vue_type_script_setup_true_lang-BNoENOWX.mjs";
4
4
  const b = {
5
5
  key: 0,
@@ -1,6 +1,6 @@
1
1
  import { defineComponent as k, ref as p, onMounted as D, watch as z, onBeforeUnmount as M, openBlock as v, createElementBlock as h, createElementVNode as m, toDisplayString as S, unref as C, createCommentVNode as w, createBlock as N, normalizeStyle as B } from "vue";
2
2
  import { S as H } from "./index-CyBXARuf.mjs";
3
- import { u as O, b as R, e as W, d as G, O as V, l as E } from "./index-DwHqKJVc.mjs";
3
+ import { u as O, b as R, e as W, d as G, O as V, l as E } from "./index-DdbaVSB8.mjs";
4
4
  import { _ as F } from "./RendererError.vue_vue_type_script_setup_true_lang-BNoENOWX.mjs";
5
5
  const L = { class: "vfp-relative vfp-flex vfp-flex-col vfp-items-center vfp-w-full vfp-h-full" }, j = {
6
6
  key: 0,
@@ -1,6 +1,6 @@
1
1
  import { defineComponent as L, ref as a, watch as _, nextTick as M, computed as y, openBlock as s, createElementBlock as c, createElementVNode as f, createBlock as $, normalizeStyle as p, Fragment as N, renderList as j } from "vue";
2
2
  import I from "mammoth";
3
- import { u as F, b as X, X as C, j as R, B as q } from "./index-DwHqKJVc.mjs";
3
+ import { u as F, b as X, X as C, j as R, B as q } from "./index-DdbaVSB8.mjs";
4
4
  import { _ as z } from "./RendererError.vue_vue_type_script_setup_true_lang-BNoENOWX.mjs";
5
5
  const O = {
6
6
  key: 0,
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as m, ref as a, watch as _, openBlock as s, createElementBlock as f, createElementVNode as p, createBlock as h } from "vue";
2
- import { u as w, b as y, S as g } from "./index-DwHqKJVc.mjs";
2
+ import { u as w, b as y, S as g } from "./index-DdbaVSB8.mjs";
3
3
  import { _ as b } from "./RendererError.vue_vue_type_script_setup_true_lang-BNoENOWX.mjs";
4
4
  const k = {
5
5
  key: 0,
@@ -3,7 +3,7 @@ import N from "markdown-it";
3
3
  import Y from "@traptitech/markdown-it-katex";
4
4
  import { codeToHtml as E } from "shiki";
5
5
  import { Code as F, Eye as W } from "lucide-vue-next";
6
- import { u as z, b as J, c as Q, e as U, _ as X } from "./index-DwHqKJVc.mjs";
6
+ import { u as z, b as J, c as Q, e as U, _ as X } from "./index-DdbaVSB8.mjs";
7
7
  import { _ as Z } from "./RendererError.vue_vue_type_script_setup_true_lang-BNoENOWX.mjs";
8
8
  import { T as ee } from "./base.types-DaftHyg7.mjs";
9
9
  const te = {
@@ -19,14 +19,14 @@ const te = {
19
19
  }, ne = ["innerHTML"], le = {
20
20
  key: 3,
21
21
  class: "vfp-w-full vfp-h-full vfp-overflow-auto vfp-py-6 vfp-px-4"
22
- }, se = ["innerHTML"], B = '<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>', L = '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>', ae = '<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6 9 17l-5-5"/></svg>', ce = '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6 9 17l-5-5"/></svg>', ie = /* @__PURE__ */ P({
22
+ }, ae = ["innerHTML"], B = '<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>', L = '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>', se = '<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6 9 17l-5-5"/></svg>', ce = '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6 9 17l-5-5"/></svg>', ie = /* @__PURE__ */ P({
23
23
  __name: "index",
24
24
  props: {
25
25
  url: {}
26
26
  },
27
27
  setup(q, { expose: V }) {
28
- const _ = q, x = new ee(), { t: i } = z(), j = J(), G = Q(), y = D(() => G.value === "light" ? "github-light" : "github-dark"), a = c("preview"), b = c(""), v = c(""), f = c(""), p = c(!0), h = c(null), m = c(null);
29
- k([a, p], () => {
28
+ const _ = q, x = new ee(), { t: i } = z(), j = J(), G = Q(), y = D(() => G.value === "light" ? "github-light" : "github-dark"), s = c("preview"), b = c(""), v = c(""), f = c(""), p = c(!0), h = c(null), m = c(null);
29
+ k([s, p], () => {
30
30
  x.notify();
31
31
  }), V({
32
32
  getToolbarGroups: () => {
@@ -35,12 +35,12 @@ const te = {
35
35
  items: [
36
36
  {
37
37
  type: "button",
38
- icon: a.value === "preview" ? F : W,
39
- tooltip: a.value === "preview" ? i.value("toolbar.source") : i.value("toolbar.preview"),
38
+ icon: s.value === "preview" ? F : W,
39
+ tooltip: s.value === "preview" ? i.value("toolbar.source") : i.value("toolbar.preview"),
40
40
  action: () => {
41
- a.value = a.value === "preview" ? "source" : "preview";
41
+ s.value = s.value === "preview" ? "source" : "preview";
42
42
  },
43
- active: a.value === "source"
43
+ active: s.value === "source"
44
44
  }
45
45
  ]
46
46
  }), e;
@@ -96,7 +96,7 @@ const te = {
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 ? ae : ce, t.title = i.value("markdown.copied"), setTimeout(() => {
99
+ t.innerHTML = r ? se : ce, t.title = i.value("markdown.copied"), setTimeout(() => {
100
100
  t.innerHTML = r ? B : L, t.title = i.value("markdown.copy_code");
101
101
  }, 2e3);
102
102
  }), t;
@@ -105,9 +105,9 @@ const te = {
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", s = ((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 E(s, { lang: w, theme: y.value }), M = document.createElement("div");
110
+ const g = await E(a, { lang: w, theme: y.value }), M = document.createElement("div");
111
111
  M.innerHTML = g;
112
112
  const S = M.firstElementChild;
113
113
  S && o.replaceWith(S);
@@ -118,7 +118,7 @@ const te = {
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"), s = o.querySelector("pre"), g = ((n = s == null ? void 0 : s.querySelector("code")) == null ? void 0 : n.textContent) ?? (s == null ? void 0 : s.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(T(g, !0)) : o.appendChild(T(g, !1));
123
123
  }
124
124
  };
@@ -131,7 +131,7 @@ const te = {
131
131
  ])])) : h.value ? (d(), O(Z, {
132
132
  key: 1,
133
133
  message: h.value
134
- }, null, 8, ["message"])) : a.value === "source" ? (d(), u("div", oe, [
134
+ }, null, 8, ["message"])) : s.value === "source" ? (d(), u("div", oe, [
135
135
  f.value ? (d(), u("div", {
136
136
  key: 1,
137
137
  class: "shiki-wrapper",
@@ -143,10 +143,10 @@ const te = {
143
143
  ref: m,
144
144
  class: "markdown-body",
145
145
  innerHTML: v.value
146
- }, null, 8, se)
146
+ }, null, 8, ae)
147
147
  ]));
148
148
  }
149
- }), ke = /* @__PURE__ */ X(ie, [["__scopeId", "data-v-e65958df"]]);
149
+ }), ke = /* @__PURE__ */ X(ie, [["__scopeId", "data-v-ccd85c2a"]]);
150
150
  export {
151
151
  ke as default
152
152
  };