@agile-team/mach-report 2.2.0 → 2.3.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.
@@ -1,1643 +0,0 @@
1
- import { computed as C, unref as x, ref as O, onScopeDispose as Ye, watch as _, shallowRef as Me, defineComponent as Xe, nextTick as Ot, openBlock as E, createElementBlock as $, createElementVNode as T, toDisplayString as k, Fragment as Ee, createCommentVNode as H, normalizeClass as le, renderList as Se, createTextVNode as Ze, withKeys as lt, inject as De, provide as ft, useCssVars as Bt, watchEffect as it, onMounted as Wt, onUnmounted as It, normalizeStyle as oe, createBlock as Lt, createVNode as At, renderSlot as zt } from "vue";
2
- import { renderPlanToImages as Ht, renderPage as pt, validateRenderPlan as qt, ReportSourceError as Nt, renderPlanToCanvas as jt } from "@agile-team/mach-report";
3
- import { c as mt } from "./page-window-index-CIuT4BAv.js";
4
- import { b as Je, c as Ut, d as Vt, a as Kt } from "./plugin-CAcNe0FT.js";
5
- function vt(e) {
6
- return e == null ? [] : Array.isArray(e) ? e.map(String).filter((t) => t !== "") : String(e).split(",").map((t) => t.trim()).filter((t) => t !== "");
7
- }
8
- function sr(e) {
9
- return vt(e).join(",");
10
- }
11
- class Ve extends Error {
12
- constructor(t) {
13
- super(t), this.name = "PlanLoadError";
14
- }
15
- }
16
- function lr(e = {}) {
17
- const { baseUrl: t = "", headers: o, credentials: a, timeoutMs: n = 3e4 } = e, r = t.replace(/\/+$/, "");
18
- return async ({ url: s, method: d, params: p, signal: m }) => {
19
- let c = `${r}${s}`;
20
- if (p && Object.keys(p).length > 0) {
21
- const g = c.indexOf("#"), S = g >= 0 ? c.slice(g) : "", P = g >= 0 ? c.slice(0, g) : c, F = P.indexOf("?"), q = F >= 0 ? P.slice(0, F) : P, D = new URLSearchParams(F >= 0 ? P.slice(F + 1) : "");
22
- for (const [N, j] of Object.entries(p)) D.set(N, j);
23
- c = `${q}?${D}${S}`;
24
- }
25
- const u = (g, S) => {
26
- const P = new Ve(g);
27
- return Object.defineProperty(P, "cause", { value: S, configurable: !0, writable: !0 }), P;
28
- };
29
- if (m?.aborted)
30
- throw u(`请求已取消: ${s}`, m.reason);
31
- const v = new AbortController();
32
- let h;
33
- const W = () => {
34
- v.signal.aborted || (h = "external", v.abort(m?.reason));
35
- };
36
- m?.addEventListener("abort", W, { once: !0 });
37
- const I = setTimeout(() => {
38
- v.signal.aborted || (h = "timeout", v.abort());
39
- }, n);
40
- try {
41
- const g = await fetch(c, {
42
- method: d.toUpperCase(),
43
- headers: { Accept: "application/json", ...o },
44
- credentials: a,
45
- signal: v.signal
46
- });
47
- if (!g.ok)
48
- throw new Ve(`HTTP ${g.status} ${s}`);
49
- return await g.json();
50
- } catch (g) {
51
- throw h === "timeout" ? u(`请求超时(${n}ms): ${s}`, g) : h === "external" ? u(`请求已取消: ${s}`, g) : g instanceof Ve ? g : u(`请求失败(${s}): ${g instanceof Error ? g.message : String(g)}`, g);
52
- } finally {
53
- clearTimeout(I), m?.removeEventListener("abort", W);
54
- }
55
- };
56
- }
57
- function Zt(e, t, o = {}) {
58
- const a = o.pxPerMm ?? 3.7795275590551185, n = C(() => Math.max(0, x(o.gapPx) ?? 18)), r = O(0), s = O(800), d = C(() => {
59
- const g = e.value?.pages ?? [];
60
- return mt(g.map((S) => S.pageHeightMm * a), n.value);
61
- }), p = C(() => {
62
- let g = 0;
63
- for (const S of e.value?.pages ?? []) g = Math.max(g, S.pageWidthMm * a);
64
- return { w: g, h: d.value.totalHeightPx };
65
- }), m = C(() => d.value.window(
66
- s.value / t.value,
67
- r.value / t.value,
68
- x(o.overscan) ?? 1
69
- )), c = C(() => {
70
- const g = e.value;
71
- if (!g) return [];
72
- const { start: S, end: P } = m.value;
73
- return g.pages.slice(S, P + 1).map((F, q) => ({ page: F, index: S + q }));
74
- });
75
- let u = 0, v = !1;
76
- function h(g) {
77
- g && (r.value = g.scrollTop, s.value = g.clientHeight || 800);
78
- }
79
- function W(g, S) {
80
- return (P) => {
81
- u || v || (u = requestAnimationFrame(() => {
82
- if (u = 0, v || (h(P), S.value <= 0)) return;
83
- const F = Math.max(0, P.scrollTop + 32) / t.value;
84
- g.value = Math.min(S.value, d.value.pageAt(F) + 1);
85
- }));
86
- };
87
- }
88
- function I() {
89
- v = !0, u && cancelAnimationFrame(u), u = 0;
90
- }
91
- return Ye(I), {
92
- contentSize: p,
93
- windowRange: m,
94
- visiblePages: c,
95
- makeScrollHandler: W,
96
- refreshViewport: h,
97
- pageOffsetPx: (g) => d.value.offsetAt(g),
98
- destroy: I
99
- };
100
- }
101
- function Jt(e) {
102
- const t = O(1), o = O("fit");
103
- function a() {
104
- requestAnimationFrame(() => {
105
- const r = e();
106
- !r || !r.viewport || (t.value = Math.min(
107
- 1,
108
- Math.max(0.3, (r.viewport.clientWidth - 48) / Math.max(1, r.pageWidthPx))
109
- ));
110
- });
111
- }
112
- function n(r) {
113
- r === "fit" ? (o.value = "fit", a()) : (o.value = "raw", t.value = r / 100);
114
- }
115
- return { zoom: t, zoomMode: o, applyFitZoom: a, setZoom: n };
116
- }
117
- const Oe = 8;
118
- function Be() {
119
- return new Promise((e) => setTimeout(e, 0));
120
- }
121
- function Te(e) {
122
- return `p${Math.round(e.pageWidthMm)}x${Math.round(e.pageHeightMm)}`;
123
- }
124
- function Qe(e) {
125
- const t = /* @__PURE__ */ new Map();
126
- return e.pages.forEach((n) => {
127
- t.has(Te(n)) || t.set(Te(n), n);
128
- }), `<!doctype html><html><head><meta charset="utf-8"><style>${`.mr-page{margin:0 auto;page-break-after:always;}
129
- .mr-page tr{break-inside:avoid;page-break-inside:avoid;}
130
- .mr-comp{break-inside:avoid;page-break-inside:avoid;}
131
- ${[...t.values()].map(
132
- (n) => `@page ${Te(n)}{size:${Math.round(n.pageWidthMm)}mm ${Math.round(n.pageHeightMm)}mm;margin:0;}`
133
- ).join(`
134
- `)}
135
- body{margin:0;background:#fff;}`}</style></head><body>`;
136
- }
137
- function _e(e) {
138
- const t = pt(e, 96, {}, document);
139
- return t.style.page = Te(e), t.outerHTML;
140
- }
141
- function ht(e) {
142
- return { head: Qe(e), pageChunks: e.pages.map(_e) };
143
- }
144
- async function ir(e, t = {}) {
145
- const o = {
146
- schemaVersion: "mach-report-batch-print",
147
- pages: e.flatMap((s) => s.pages)
148
- };
149
- if (o.pages.length === 0) return;
150
- const a = Qe(o), n = document.createElement("iframe");
151
- n.style.cssText = "position:fixed;right:0;bottom:0;width:0;height:0;border:0;visibility:hidden;", document.body.appendChild(n);
152
- let r = !1;
153
- try {
154
- const s = n.contentDocument;
155
- s.open(), s.write(a);
156
- for (let d = 0; d < o.pages.length; d++)
157
- s.write(_e(o.pages[d])), d % Oe === Oe - 1 && (t.onProgress?.(d + 1, o.pages.length), await Be());
158
- s.write("</body></html>"), s.close(), await Be(), t.onProgress?.(o.pages.length, o.pages.length), r = !0, n.contentWindow?.focus(), n.contentWindow?.print();
159
- } catch (s) {
160
- t.onError?.(s instanceof Error ? `批量打印失败: ${s.message}` : "批量打印失败");
161
- } finally {
162
- r ? setTimeout(() => n.remove(), 6e4) : n.remove();
163
- }
164
- }
165
- function Gt(e) {
166
- const { head: t, pageChunks: o } = ht(e);
167
- return {
168
- html: `${`<!doctype html><html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head><meta charset="utf-8"><!--[if gte mso 9]><xml><w:WordDocument><w:View>Print</w:View><w:Zoom>100</w:Zoom></w:WordDocument></xml><![endif]-->${t.replace(/^<!doctype html><html><head>/, "")}`}${o.join("")}</body></html>`,
169
- filename: "mach-report.doc"
170
- };
171
- }
172
- function Yt(e, t) {
173
- let o = null, a = !1, n = !1, r = 0;
174
- const s = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map();
175
- let p = null, m = null, c = null, u = null, v = null;
176
- function h(l, f) {
177
- return !n && e.value === l && r === f;
178
- }
179
- function W() {
180
- if (n) return;
181
- const l = [...s.values()].reverse().find((f) => h(f.plan, f.epoch))?.format ?? null;
182
- l !== p && (p = l, t.onBusy?.(l));
183
- }
184
- function I(l, f, w) {
185
- const M = {};
186
- return s.set(M, { plan: l, epoch: f, format: w }), W(), M;
187
- }
188
- function g(l) {
189
- s.delete(l), W();
190
- }
191
- function S() {
192
- for (const [l, f] of d)
193
- h(f.plan, f.epoch) || (l.close(), d.delete(l));
194
- }
195
- const P = _(e, () => {
196
- r++, W(), S();
197
- }, { flush: "sync" });
198
- function F() {
199
- o?.remove(), o = null;
200
- }
201
- function q() {
202
- n = !0, r++, P(), F(), S(), s.clear(), t.onPrinting?.(!1);
203
- }
204
- function D(l, f) {
205
- const w = URL.createObjectURL(l);
206
- setTimeout(() => URL.revokeObjectURL(w), 1e4);
207
- const M = document.createElement("a");
208
- M.href = w, M.download = f, M.click();
209
- }
210
- async function N() {
211
- if (a) return;
212
- const l = e.value;
213
- if (n || !l || l.pages.length === 0) return;
214
- const f = r;
215
- a = !0, t.onPrinting?.(!0), F();
216
- const w = Qe(l);
217
- o = document.createElement("iframe"), o.style.cssText = "position:fixed;right:0;bottom:0;width:0;height:0;border:0;visibility:hidden;", document.body.appendChild(o);
218
- const M = o;
219
- try {
220
- const R = M.contentDocument;
221
- R.open(), R.write(w);
222
- for (let V = 0; V < l.pages.length; V++)
223
- if (R.write(_e(l.pages[V])), V % Oe === Oe - 1 && await Be(), M !== o) return;
224
- if (R.write("</body></html>"), R.close(), await Be(), !h(l, f) || M !== o) return;
225
- M.contentWindow?.focus(), M.contentWindow?.print();
226
- } catch {
227
- M === o && F(), h(l, f) && t.onError("调用打印失败,请改用导出 PDF", "print");
228
- } finally {
229
- a = !1, n || t.onPrinting?.(!1);
230
- }
231
- }
232
- function j(l, f) {
233
- if (m?.plan === l && m.epoch === f) return m.promise;
234
- const w = Promise.resolve().then(() => {
235
- if (!h(l, f)) throw new Error("报表已切换或卸载");
236
- return t.getPdfExporter()(l, (M) => {
237
- h(l, f) && t.onWarning?.(M);
238
- });
239
- }).finally(() => {
240
- m?.promise === w && (m = null);
241
- });
242
- return m = { plan: l, epoch: f, promise: w }, w;
243
- }
244
- async function B() {
245
- const l = e.value;
246
- if (n || !l || l.pages.length === 0) return;
247
- const f = r;
248
- if (c?.plan === l && c.epoch === f) return c.promise;
249
- const w = I(l, f, "PDF"), M = (async () => {
250
- try {
251
- const R = await j(l, f);
252
- if (!h(l, f)) return;
253
- D(new Blob([R], { type: "application/pdf" }), "mach-report.pdf");
254
- } catch (R) {
255
- h(l, f) && t.onError(R instanceof Error ? `PDF 导出失败: ${R.message}` : "PDF 导出失败", "pdf");
256
- } finally {
257
- g(w), c?.token === w && (c = null);
258
- }
259
- })();
260
- return c = { plan: l, epoch: f, promise: M, token: w }, M;
261
- }
262
- async function J() {
263
- const l = e.value;
264
- if (n || !l || l.pages.length === 0) return;
265
- const f = r;
266
- if (u?.plan === l && u.epoch === f) return u.promise;
267
- const w = { ...t.getXlsxOptions?.() }, M = I(l, f, "Excel"), R = (async () => {
268
- try {
269
- const { renderPlanToXlsx: V } = await import("@agile-team/mach-report/xlsx");
270
- if (!h(l, f)) return;
271
- const { buffer: G, warnings: X } = await V(l, w);
272
- if (!h(l, f) || (X.length > 0 && t.onWarning?.(`Excel 导出有 ${X.length} 条提示:${X.slice(0, 2).join(";")}`), !h(l, f))) return;
273
- D(new Blob([G], {
274
- type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
275
- }), "mach-report.xlsx");
276
- } catch (V) {
277
- h(l, f) && t.onError(V instanceof Error ? `Excel 导出失败: ${V.message}` : "Excel 导出失败", "export");
278
- } finally {
279
- g(M), u?.token === M && (u = null);
280
- }
281
- })();
282
- return u = { plan: l, epoch: f, promise: R, token: M }, R;
283
- }
284
- async function U() {
285
- const l = e.value;
286
- if (n || !l || l.pages.length === 0) return;
287
- const f = r;
288
- if (v?.plan === l && v.epoch === f) return v.promise;
289
- const w = I(l, f, "图片"), M = (async () => {
290
- try {
291
- const { blobs: R } = await Ht(l, {
292
- dpr: Math.min(2, typeof devicePixelRatio == "number" ? devicePixelRatio : 1)
293
- });
294
- if (!h(l, f)) return;
295
- R.forEach((V, G) => {
296
- D(V, R.length > 1 ? `mach-report-page-${G + 1}.png` : "mach-report.png");
297
- });
298
- } catch (R) {
299
- h(l, f) && t.onError(
300
- R instanceof Error ? `图片导出失败: ${R.message}` : "图片导出失败",
301
- "export"
302
- );
303
- } finally {
304
- g(w), v?.token === w && (v = null);
305
- }
306
- })();
307
- return v = { plan: l, epoch: f, promise: M, token: w }, M;
308
- }
309
- function fe() {
310
- const l = e.value;
311
- if (!(n || !l || l.pages.length === 0))
312
- try {
313
- const { html: f, filename: w } = Gt(l);
314
- D(new Blob([f], { type: "application/msword;charset=utf-8" }), w);
315
- } catch (f) {
316
- t.onError(
317
- f instanceof Error ? `Word 导出失败: ${f.message}` : "Word 导出失败",
318
- "export"
319
- );
320
- }
321
- }
322
- async function L(l) {
323
- const f = e.value;
324
- if (!(n || !f || f.pages.length === 0)) {
325
- if (l === "pdf") {
326
- await B();
327
- return;
328
- }
329
- if (l === "xlsx" || l === "excel") {
330
- await J();
331
- return;
332
- }
333
- if (l === "png" || l === "image") {
334
- await U();
335
- return;
336
- }
337
- if (l === "word" || l === "doc") {
338
- fe();
339
- return;
340
- }
341
- if (l !== "html") {
342
- t.onError(`不支持的导出格式:${l}`, "export");
343
- return;
344
- }
345
- try {
346
- const { head: w, pageChunks: M } = ht(f), R = `${w}${M.join("")}</body></html>`;
347
- D(new Blob([R], { type: "text/html;charset=utf-8" }), "mach-report.html");
348
- } catch (w) {
349
- t.onError(w instanceof Error ? `HTML 导出失败: ${w.message}` : "HTML 导出失败", "export");
350
- }
351
- }
352
- }
353
- function Z() {
354
- const l = e.value;
355
- if (n || !l || l.pages.length === 0) return;
356
- const f = r, w = window.open("", "_blank");
357
- if (!w) {
358
- t.onError("浏览器拦截了弹窗,请允许弹窗后重试", "pdf");
359
- return;
360
- }
361
- d.set(w, { plan: l, epoch: f });
362
- const M = I(l, f, "PDF");
363
- j(l, f).then((R) => {
364
- if (!h(l, f) || w.closed) {
365
- d.delete(w) && w.close();
366
- return;
367
- }
368
- const V = URL.createObjectURL(new Blob([R], { type: "application/pdf" }));
369
- setTimeout(() => URL.revokeObjectURL(V), 6e4);
370
- const G = w.document;
371
- G.title = "PDF 预览", G.documentElement.style.height = "100%", G.body.style.cssText = "margin:0;height:100%;";
372
- const X = G.createElement("iframe");
373
- X.title = "PDF 预览", X.style.cssText = "display:block;width:100%;height:100%;border:0;", X.src = V, G.body.replaceChildren(X), d.delete(w);
374
- }).catch((R) => {
375
- w.close(), d.delete(w), h(l, f) && t.onError(R instanceof Error ? `PDF 预览失败: ${R.message}` : "PDF 预览失败", "pdf");
376
- }).finally(() => g(M));
377
- }
378
- return {
379
- print: N,
380
- exportAs: L,
381
- exportImages: U,
382
- exportWord: fe,
383
- openPdfWindow: Z,
384
- releasePrintFrame: F,
385
- dispose: q
386
- };
387
- }
388
- const gt = "mrp-hit";
389
- function Xt(e) {
390
- e.querySelectorAll(`mark.${gt}`).forEach((o) => {
391
- const a = o.parentNode;
392
- if (a) {
393
- for (; o.firstChild; ) a.insertBefore(o.firstChild, o);
394
- o.remove(), a.normalize();
395
- }
396
- });
397
- }
398
- function Qt(e, t) {
399
- const o = t.trim();
400
- if (!o) return 0;
401
- const a = o.toLowerCase(), n = document.createTreeWalker(e, NodeFilter.SHOW_TEXT, {
402
- acceptNode(d) {
403
- const p = d.parentElement;
404
- return !p || p.closest("mark") || /^(SCRIPT|STYLE)$/.test(p.tagName) ? NodeFilter.FILTER_REJECT : (d.nodeValue ?? "").toLowerCase().includes(a) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT;
405
- }
406
- }), r = [];
407
- for (let d = n.nextNode(); d; d = n.nextNode()) r.push(d);
408
- let s = 0;
409
- for (const d of r) {
410
- const p = d.nodeValue ?? "", m = p.toLowerCase(), c = d.parentElement;
411
- if (!c) continue;
412
- const u = document.createDocumentFragment();
413
- let v = 0, h = m.indexOf(a);
414
- for (; h >= 0; ) {
415
- h > v && u.appendChild(document.createTextNode(p.slice(v, h)));
416
- const W = document.createElement("mark");
417
- W.className = gt, W.textContent = p.slice(h, h + o.length), u.appendChild(W), s++, v = h + o.length, h = m.indexOf(a, v);
418
- }
419
- v < p.length && u.appendChild(document.createTextNode(p.slice(v))), c.replaceChild(u, d);
420
- }
421
- return s;
422
- }
423
- function _t(e, t) {
424
- const o = e.toLowerCase();
425
- let a = 0;
426
- for (let n = o.indexOf(t); n >= 0; n = o.indexOf(t, n + t.length)) a++;
427
- return a;
428
- }
429
- function* en(e) {
430
- const t = [...e].reverse();
431
- for (; t.length > 0; ) {
432
- const o = t.pop();
433
- if (o.grid) {
434
- for (const a of o.grid.cells ?? [])
435
- for (const n of a ?? [])
436
- if (yield n?.text ?? "", n?.children)
437
- for (let r = n.children.length - 1; r >= 0; r--) t.push(n.children[r]);
438
- } else if (o.kind === "text")
439
- if (o.richParagraphs?.length)
440
- for (const a of o.richParagraphs)
441
- for (const n of a.segments ?? [])
442
- yield (n.kind === "field" ? n.field : n.text) ?? "";
443
- else o.lines?.length ? yield* o.lines : yield o.text ?? "";
444
- yield "";
445
- }
446
- }
447
- function* tn(e) {
448
- for (let t = 0; t < e.pages.length; t++) {
449
- for (const o of en(e.pages[t].components)) yield { text: o, pageIndex: t };
450
- yield { text: "", pageIndex: t };
451
- }
452
- }
453
- function nn(e) {
454
- const { plan: t, gotoPage: o, highlight: a, clearHighlights: n } = e, r = O(!1), s = O(""), d = O(0), p = O(0), m = O(!1);
455
- let c = [], u = null, v = null, h = 0;
456
- function W() {
457
- h++, u && clearTimeout(u), v && clearTimeout(v), u = v = null, m.value = !1;
458
- }
459
- function I(F) {
460
- s.value = F, d.value = 0, p.value = 0, c = [], m.value = !1;
461
- const q = F.trim().toLowerCase(), D = t.value;
462
- if (!q || !D) return;
463
- m.value = !0;
464
- const N = h, j = tn(D), B = [];
465
- let J = 0;
466
- function U() {
467
- if (v = null, N !== h || D !== t.value) return;
468
- const fe = performance.now();
469
- let L = 0;
470
- for (; L < 500 && performance.now() - fe < 4; ) {
471
- const Z = j.next();
472
- if (Z.done) {
473
- c = B, p.value = J, m.value = !1, c[0] && o(c[0].pageIndex + 1);
474
- return;
475
- }
476
- const l = _t(Z.value.text, q);
477
- if (l > 0) {
478
- J += l;
479
- const f = B[B.length - 1];
480
- f?.pageIndex === Z.value.pageIndex ? f.cumulative = J : B.push({ pageIndex: Z.value.pageIndex, cumulative: J });
481
- }
482
- L++;
483
- }
484
- v = setTimeout(U, 0);
485
- }
486
- U();
487
- }
488
- function g(F) {
489
- if (W(), s.value = F, d.value = p.value = 0, c = [], !F.trim()) {
490
- I("");
491
- return;
492
- }
493
- m.value = !0, u = setTimeout(() => {
494
- u = null, I(F);
495
- }, Math.max(0, x(e.debounceMs) ?? 200));
496
- }
497
- function S(F) {
498
- const q = p.value;
499
- if (q === 0 || m.value) return;
500
- d.value = (d.value + F + q) % q;
501
- let D = 0, N = c.length - 1;
502
- for (; D < N; ) {
503
- const j = D + N >>> 1;
504
- c[j].cumulative <= d.value ? D = j + 1 : N = j;
505
- }
506
- o(c[D].pageIndex + 1);
507
- }
508
- function P() {
509
- W(), s.value = "", d.value = p.value = 0, c = [];
510
- }
511
- return _(t, P, { flush: "sync" }), Ye(P), {
512
- visible: r,
513
- query: s,
514
- matchIndex: d,
515
- matchCount: p,
516
- searching: m,
517
- toggle: () => {
518
- r.value = !r.value;
519
- },
520
- onInput: g,
521
- onNav: S,
522
- apply: (F) => {
523
- s.value.trim() && a(F, s.value.trim());
524
- },
525
- clear: (F) => {
526
- n(F);
527
- },
528
- reset: P
529
- };
530
- }
531
- function rn(e, t) {
532
- const o = C(() => {
533
- if (e.value) return !0;
534
- if (typeof location > "u") return !1;
535
- try {
536
- return new URLSearchParams(location.search).get("mrp-debug") === "1";
537
- } catch {
538
- return !1;
539
- }
540
- }), a = C(() => !o.value || !t.plan.value ? 0 : Math.round(JSON.stringify(t.plan.value).length / 1024)), n = C(() => !o.value || !t.plan.value ? null : {
541
- pages: t.pageCount.value,
542
- window: `${t.windowRange.value.start}-${t.windowRange.value.end}`,
543
- zoom: `${Math.round(t.zoom.value * 100)}%`,
544
- loadMs: `${t.loadMs.value}ms`,
545
- planKB: a.value
546
- });
547
- return { enabled: o, debugStats: n };
548
- }
549
- function on(e, t) {
550
- const { thumbsRoot: o, visible: a, renderThumbCanvas: n } = t, r = O(0), s = O(800), d = C(() => (e.value?.pages ?? []).map(
551
- (P) => Math.round(P.pageHeightMm / P.pageWidthMm * 116)
552
- )), p = C(() => mt(d.value.map((P) => P + 20), 8)), m = C(() => p.value.window(s.value, r.value, 1)), c = C(() => {
553
- if (!a.value) return [];
554
- const { start: P, end: F } = m.value;
555
- return d.value.slice(P, F + 1).map((q, D) => ({ index: P + D, height: q }));
556
- });
557
- let u = 0, v = 0, h = !1;
558
- function W() {
559
- const P = o.value;
560
- P && (r.value = P.scrollTop, s.value = P.clientHeight || 800);
561
- }
562
- function I() {
563
- h || v || (v = requestAnimationFrame(() => {
564
- v = 0, W();
565
- }));
566
- }
567
- function g() {
568
- if (c.value, u && cancelAnimationFrame(u), u = 0, h || !a.value || !e.value || !o.value) return;
569
- W();
570
- const P = c.value, F = e.value, q = o.value;
571
- let D = 0;
572
- function N() {
573
- if (u = 0, !(h || !a.value || e.value !== F || o.value !== q)) {
574
- for (let j = 0; D < P.length && j < 2; j++, D++) {
575
- const B = P[D].index, J = q.querySelector(`[data-thumb="${B + 1}"]`);
576
- if (!J || J.childElementCount > 0) continue;
577
- const U = n(B);
578
- U && (U.style.width = "100%", U.style.height = "100%", U.style.display = "block", J.appendChild(U));
579
- }
580
- D < P.length && (u = requestAnimationFrame(N));
581
- }
582
- }
583
- u = requestAnimationFrame(N);
584
- }
585
- function S() {
586
- h = !0, u && cancelAnimationFrame(u), v && cancelAnimationFrame(v), u = v = 0;
587
- }
588
- return Ye(S), { schedule: g, destroy: S, onScroll: I, windowRange: m, visibleThumbs: c };
589
- }
590
- function an() {
591
- const e = Me(0);
592
- return {
593
- loadMs: e,
594
- start() {
595
- return typeof performance < "u" ? performance.now() : 0;
596
- },
597
- end(t) {
598
- e.value = t ? Math.round(performance.now() - t) : 0;
599
- }
600
- };
601
- }
602
- const sn = { class: "mrp-toolbar" }, ln = { class: "mrp-title" }, un = ["disabled"], cn = { class: "mrp-pageinfo" }, dn = ["disabled"], fn = {
603
- key: 1,
604
- class: "mrp-search"
605
- }, pn = ["placeholder", "value"], mn = {
606
- key: 0,
607
- class: "mrp-search-count",
608
- role: "status"
609
- }, vn = ["disabled"], hn = ["disabled"], gn = /* @__PURE__ */ Xe({
610
- __name: "ReportToolbar",
611
- props: {
612
- pageCount: {},
613
- currentPage: {},
614
- zoomMode: {},
615
- zoom: {},
616
- showExport: { type: Boolean },
617
- showPrint: { type: Boolean },
618
- showPdfWindow: { type: Boolean },
619
- messages: {},
620
- search: {},
621
- thumbsVisible: { type: Boolean }
622
- },
623
- emits: ["goto", "zoom", "export", "print", "pdf-window", "search-input", "search-nav", "search-toggle", "thumbs-toggle"],
624
- setup(e) {
625
- const t = e, o = O(null);
626
- _(
627
- () => t.search.visible,
628
- (n) => {
629
- n && Ot(() => o.value?.focus());
630
- }
631
- );
632
- function a(n, r, s) {
633
- return n.replace("{cur}", String(r)).replace("{total}", String(s));
634
- }
635
- return (n, r) => (E(), $("div", sn, [
636
- T("span", ln, k(e.messages.title), 1),
637
- e.pageCount > 0 ? (E(), $(Ee, { key: 0 }, [
638
- T("button", {
639
- class: "mrp-nav",
640
- type: "button",
641
- disabled: e.currentPage <= 1,
642
- onClick: r[0] || (r[0] = (s) => n.$emit("goto", e.currentPage - 1))
643
- }, k(e.messages.prevPage), 9, un),
644
- T("span", cn, k(a(e.messages.pageInfo, e.currentPage, e.pageCount)), 1),
645
- T("button", {
646
- class: "mrp-nav",
647
- type: "button",
648
- disabled: e.currentPage >= e.pageCount,
649
- onClick: r[1] || (r[1] = (s) => n.$emit("goto", e.currentPage + 1))
650
- }, k(e.messages.nextPage), 9, dn)
651
- ], 64)) : H("", !0),
652
- r[17] || (r[17] = T("span", { class: "mrp-spacer" }, null, -1)),
653
- e.search.visible ? (E(), $("div", fn, [
654
- T("input", {
655
- ref_key: "searchInputRef",
656
- ref: o,
657
- class: "mrp-search-input",
658
- type: "text",
659
- placeholder: e.messages.searchPlaceholder,
660
- value: e.search.query,
661
- onInput: r[2] || (r[2] = (s) => n.$emit("search-input", s.target.value))
662
- }, null, 40, pn),
663
- e.search.query ? (E(), $("span", mn, k(e.search.searching ? e.messages.searching ?? "搜索中…" : a(e.messages.matchInfo, e.search.matchCount > 0 ? e.search.matchIndex + 1 : 0, e.search.matchCount)), 1)) : H("", !0),
664
- T("button", {
665
- class: "mrp-nav",
666
- type: "button",
667
- disabled: e.search.matchCount === 0,
668
- onClick: r[3] || (r[3] = (s) => n.$emit("search-nav", -1))
669
- }, k(e.messages.prevMatch), 9, vn),
670
- T("button", {
671
- class: "mrp-nav",
672
- type: "button",
673
- disabled: e.search.matchCount === 0,
674
- onClick: r[4] || (r[4] = (s) => n.$emit("search-nav", 1))
675
- }, k(e.messages.nextMatch), 9, hn)
676
- ])) : H("", !0),
677
- T("button", {
678
- class: le(["mrp-nav", { "mrp-active": e.search.visible }]),
679
- type: "button",
680
- title: "Ctrl+F",
681
- onClick: r[5] || (r[5] = (s) => n.$emit("search-toggle"))
682
- }, " 🔍 ", 2),
683
- T("button", {
684
- class: le(["mrp-nav", { "mrp-active": e.thumbsVisible }]),
685
- type: "button",
686
- onClick: r[6] || (r[6] = (s) => n.$emit("thumbs-toggle"))
687
- }, " ▦ " + k(e.messages.thumbnails), 3),
688
- T("button", {
689
- class: le(["mrp-nav", { "mrp-active": e.zoomMode === "fit" }]),
690
- type: "button",
691
- onClick: r[7] || (r[7] = (s) => n.$emit("zoom", "fit"))
692
- }, k(e.messages.fitWidth), 3),
693
- T("button", {
694
- class: le(["mrp-nav", { "mrp-active": e.zoomMode === "raw" && Math.round(e.zoom * 100) === 100 }]),
695
- type: "button",
696
- onClick: r[8] || (r[8] = (s) => n.$emit("zoom", 100))
697
- }, " 100% ", 2),
698
- T("button", {
699
- class: le(["mrp-nav", { "mrp-active": e.zoomMode === "raw" && Math.round(e.zoom * 100) === 150 }]),
700
- type: "button",
701
- onClick: r[9] || (r[9] = (s) => n.$emit("zoom", 150))
702
- }, " 150% ", 2),
703
- e.showExport ? (E(), $("button", {
704
- key: 2,
705
- class: "mrp-nav",
706
- type: "button",
707
- onClick: r[10] || (r[10] = (s) => n.$emit("export", "html"))
708
- }, k(e.messages.exportHtml), 1)) : H("", !0),
709
- e.showExport ? (E(), $("button", {
710
- key: 3,
711
- class: "mrp-nav",
712
- type: "button",
713
- onClick: r[11] || (r[11] = (s) => n.$emit("export", "pdf"))
714
- }, k(e.messages.exportPdf), 1)) : H("", !0),
715
- e.showExport ? (E(), $("button", {
716
- key: 4,
717
- class: "mrp-nav",
718
- type: "button",
719
- onClick: r[12] || (r[12] = (s) => n.$emit("export", "xlsx"))
720
- }, k(e.messages.exportExcel), 1)) : H("", !0),
721
- e.showExport ? (E(), $("button", {
722
- key: 5,
723
- class: "mrp-nav",
724
- type: "button",
725
- onClick: r[13] || (r[13] = (s) => n.$emit("export", "png"))
726
- }, k(e.messages.exportImage), 1)) : H("", !0),
727
- e.showExport ? (E(), $("button", {
728
- key: 6,
729
- class: "mrp-nav",
730
- type: "button",
731
- onClick: r[14] || (r[14] = (s) => n.$emit("export", "word"))
732
- }, k(e.messages.exportWord), 1)) : H("", !0),
733
- e.showPrint ? (E(), $("button", {
734
- key: 7,
735
- class: "mrp-nav",
736
- type: "button",
737
- onClick: r[15] || (r[15] = (s) => n.$emit("print"))
738
- }, k(e.messages.print), 1)) : H("", !0),
739
- e.showPdfWindow ? (E(), $("button", {
740
- key: 8,
741
- class: "mrp-nav",
742
- type: "button",
743
- onClick: r[16] || (r[16] = (s) => n.$emit("pdf-window"))
744
- }, k(e.messages.pdfWindow), 1)) : H("", !0)
745
- ]));
746
- }
747
- }), et = (e, t) => {
748
- const o = e.__vccOpts || e;
749
- for (const [a, n] of t)
750
- o[a] = n;
751
- return o;
752
- }, bn = /* @__PURE__ */ et(gn, [["__scopeId", "data-v-601f8fa8"]]), wn = { class: "mrp-params" }, yn = { class: "mrp-params-title" }, xn = { class: "mrp-params-grid" }, Pn = { class: "mrp-param-label" }, En = {
753
- key: 0,
754
- class: "mrp-param-star"
755
- }, $n = ["value", "onChange"], kn = {
756
- value: "",
757
- disabled: "",
758
- hidden: ""
759
- }, Cn = ["value"], Fn = ["type", "placeholder", "value", "onInput"], Mn = { class: "mrp-params-actions" }, Tn = /* @__PURE__ */ Xe({
760
- __name: "ReportParamPanel",
761
- props: {
762
- defs: {},
763
- modelValue: {},
764
- messages: {},
765
- attempted: { type: Boolean }
766
- },
767
- emits: ["update:modelValue", "query", "reset"],
768
- setup(e, { emit: t }) {
769
- const o = e, a = t, n = O({ ...o.modelValue });
770
- _(
771
- () => o.modelValue,
772
- (p) => {
773
- n.value = { ...p };
774
- }
775
- );
776
- const r = C(
777
- () => o.defs.map((p) => ({
778
- def: p,
779
- label: p.label ?? p.field,
780
- value: n.value[p.field] ?? ""
781
- }))
782
- );
783
- function s(p, m) {
784
- n.value = { ...n.value, [p]: m }, a("update:modelValue", { ...n.value });
785
- }
786
- function d(p) {
787
- const m = o.defs.find((c) => c.field === p);
788
- return o.attempted && m?.required === !0 && !(n.value[p] ?? "").trim();
789
- }
790
- return (p, m) => (E(), $("div", wn, [
791
- T("span", yn, k(e.messages.paramsTitle), 1),
792
- T("div", xn, [
793
- (E(!0), $(Ee, null, Se(r.value, (c) => (E(), $("label", {
794
- key: c.def.field,
795
- class: le(["mrp-param", { "mrp-param-missing": d(c.def.field) }])
796
- }, [
797
- T("span", Pn, [
798
- Ze(k(c.label), 1),
799
- c.def.required ? (E(), $("i", En, "*")) : H("", !0)
800
- ]),
801
- (c.def.type ?? "text") === "select" ? (E(), $("select", {
802
- key: 0,
803
- class: "mrp-param-input",
804
- value: c.value,
805
- onChange: (u) => s(c.def.field, u.target.value),
806
- onKeydown: m[0] || (m[0] = lt((u) => p.$emit("query"), ["enter"]))
807
- }, [
808
- T("option", kn, k(c.def.placeholder ?? `请选择${c.label}`), 1),
809
- (E(!0), $(Ee, null, Se(c.def.options ?? [], (u) => (E(), $("option", {
810
- key: u.value,
811
- value: u.value
812
- }, k(u.label), 9, Cn))), 128))
813
- ], 40, $n)) : (E(), $("input", {
814
- key: 1,
815
- class: "mrp-param-input",
816
- type: c.def.type === "number" ? "number" : c.def.type === "date" ? "date" : "text",
817
- placeholder: c.def.placeholder ?? `请输入${c.label}`,
818
- value: c.value,
819
- onInput: (u) => s(c.def.field, u.target.value),
820
- onKeydown: m[1] || (m[1] = lt((u) => p.$emit("query"), ["enter"]))
821
- }, null, 40, Fn))
822
- ], 2))), 128))
823
- ]),
824
- T("div", Mn, [
825
- T("button", {
826
- class: "mrp-nav mrp-param-query",
827
- type: "button",
828
- onClick: m[2] || (m[2] = (c) => p.$emit("query"))
829
- }, k(e.messages.query), 1),
830
- T("button", {
831
- class: "mrp-nav",
832
- type: "button",
833
- onClick: m[3] || (m[3] = (c) => p.$emit("reset"))
834
- }, k(e.messages.reset), 1)
835
- ])
836
- ]));
837
- }
838
- }), Rn = /* @__PURE__ */ et(Tn, [["__scopeId", "data-v-aafce92d"]]), Sn = {
839
- title: "报表预览",
840
- prevPage: "‹ 上一页",
841
- nextPage: "下一页 ›",
842
- pageInfo: "{cur} / {total}",
843
- fitWidth: "适宽",
844
- exportHtml: "导出 HTML",
845
- exportPdf: "导出 PDF",
846
- exportExcel: "导出 Excel",
847
- exportImage: "导出图片",
848
- exportWord: "导出 Word",
849
- exporting: "正在生成 {format}…",
850
- print: "打印",
851
- pdfWindow: "PDF 窗口",
852
- loading: "报表渲染中…",
853
- empty: "暂无预览数据",
854
- errorPrefix: "",
855
- retry: "重试",
856
- pdfFontUnavailable: "PDF 字体尚未就绪,请联系管理员检查字体配置;预览及其它导出仍可使用。",
857
- searchPlaceholder: "搜索报表内容",
858
- matchInfo: "{cur}/{total}",
859
- prevMatch: "‹",
860
- nextMatch: "›",
861
- thumbnails: "缩略图",
862
- paramsTitle: "查询条件",
863
- query: "查 询",
864
- reset: "重 置",
865
- paramRequired: "请填写{label}",
866
- searching: "搜索中…"
867
- }, Dn = {
868
- shellBg: "#525659",
869
- shellFg: "#e8e8e8",
870
- toolbarBg: "#323639",
871
- toolbarBorder: "#22252a",
872
- toolbarFg: "#e8e8e8",
873
- btnFg: "#cfcfcf",
874
- btnBorder: "#4a4d52",
875
- btnHoverBg: "#414549",
876
- btnHoverFg: "#ffffff",
877
- btnActiveBg: "#2d5fb8"
878
- };
879
- function On(e = {}) {
880
- return { ...e, defaults: e.defaults ?? {}, presets: e.presets ?? {} };
881
- }
882
- function ur(e) {
883
- return e;
884
- }
885
- const de = {
886
- showExport: !0,
887
- showPrint: !0,
888
- showPdfWindow: !0,
889
- showParams: !0,
890
- gapPx: 18,
891
- pdfFontUrl: "/simhei.ttf",
892
- logger: console
893
- }, cr = { warn: () => {
894
- }, info: () => {
895
- } };
896
- function Re(e, t) {
897
- return {
898
- ...e,
899
- ...t,
900
- theme: { ...e?.theme, ...t?.theme },
901
- messages: { ...e?.messages, ...t?.messages },
902
- preview: { ...e?.preview, ...t?.preview },
903
- xlsx: { ...e?.xlsx, ...t?.xlsx }
904
- };
905
- }
906
- function Bn(e, t) {
907
- const o = t ? e?.presets?.[t] : e?.defaultPreset ? e?.presets?.[e.defaultPreset] : void 0, a = Re(e?.defaults, o);
908
- return {
909
- showExport: a.showExport ?? de.showExport,
910
- showPrint: a.showPrint ?? de.showPrint,
911
- showPdfWindow: a.showPdfWindow ?? de.showPdfWindow,
912
- showParams: a.showParams ?? de.showParams,
913
- gapPx: a.gapPx ?? de.gapPx,
914
- pdfFontUrl: a.pdfFontUrl ?? de.pdfFontUrl,
915
- theme: { ...Dn, ...a.theme },
916
- messages: { ...Sn, ...a.messages },
917
- logger: a.logger ?? de.logger,
918
- preview: {
919
- overscanPages: ut(a.preview?.overscanPages, 1, 10, !0),
920
- searchDebounceMs: ut(a.preview?.searchDebounceMs, 200, 2e3)
921
- },
922
- xlsx: { ...a.xlsx }
923
- };
924
- }
925
- function ut(e, t, o, a = !1) {
926
- if (e == null || !Number.isFinite(e)) return t;
927
- const n = Math.max(0, Math.min(o, e));
928
- return a ? Math.floor(n) : n;
929
- }
930
- function Wn(e) {
931
- const t = {};
932
- return e.shellBg != null && (t["--mrp-shell-bg"] = e.shellBg), e.shellFg != null && (t["--mrp-shell-fg"] = e.shellFg), e.toolbarBg != null && (t["--mrp-toolbar-bg"] = e.toolbarBg), e.toolbarBorder != null && (t["--mrp-toolbar-border"] = e.toolbarBorder), e.toolbarFg != null && (t["--mrp-toolbar-fg"] = e.toolbarFg), e.btnFg != null && (t["--mrp-btn-fg"] = e.btnFg), e.btnBorder != null && (t["--mrp-btn-border"] = e.btnBorder), e.btnHoverBg != null && (t["--mrp-btn-hover-bg"] = e.btnHoverBg), e.btnHoverFg != null && (t["--mrp-btn-hover-fg"] = e.btnHoverFg), e.btnActiveBg != null && (t["--mrp-btn-active-bg"] = e.btnActiveBg), t;
933
- }
934
- function dr(e) {
935
- const t = De(Je, null), o = C(() => {
936
- const a = t?.value ?? null, n = "defaults" in e || "presets" in e || "defaultPreset" in e ? On(e) : { defaults: e, presets: {} };
937
- if (!a) return n;
938
- const r = { ...a.presets, ...n.presets };
939
- for (const s of Object.keys(r))
940
- r[s] = Re(
941
- Re(a.presets[s], n.defaults),
942
- n.presets[s]
943
- );
944
- return {
945
- defaults: Re(a.defaults, n.defaults),
946
- presets: r,
947
- defaultPreset: n.defaultPreset ?? a.defaultPreset
948
- };
949
- });
950
- ft(Je, o);
951
- }
952
- function In() {
953
- return De(Je, C(() => null));
954
- }
955
- const ct = /* @__PURE__ */ new Map(), he = /* @__PURE__ */ new Map(), Ln = 15e3;
956
- function Ge(e, t) {
957
- return Object.assign(new Error(e), { cause: t });
958
- }
959
- function Pe(e, t) {
960
- return `PDF 字体 ${JSON.stringify(e)}:${t}。请部署支持报表文字的字体文件,并将 pdfFontUrl 配置为可访问的字体 URL;西文报表可设为空串`;
961
- }
962
- function We(e) {
963
- if (e?.reason instanceof Error && e.reason.name === "AbortError") return e.reason;
964
- const t = Ge("PDF 字体检查已取消", e?.reason);
965
- return t.name = "AbortError", t;
966
- }
967
- async function An(e, t) {
968
- let o = !1;
969
- const a = setTimeout(() => {
970
- o = !0, t.abort();
971
- }, Ln);
972
- try {
973
- const n = await fetch(e, { method: "HEAD", signal: t.signal });
974
- if (t.signal.aborted) throw We(t.signal);
975
- if (n.status === 405 || n.status === 501 || n.type === "opaque")
976
- return {
977
- status: "unverified",
978
- fontUrl: e,
979
- message: `PDF 字体 ${JSON.stringify(e)} 无法通过 HEAD 检查验证;仍可尝试导出,届时会加载并校验字体`
980
- };
981
- if (!n.ok) {
982
- const s = new Error(`字体请求返回 HTTP ${n.status}`);
983
- return { status: "error", fontUrl: e, message: Pe(e, s.message), cause: s };
984
- }
985
- const r = n.headers.get("content-type") ?? "";
986
- if (/text\/html|application\/xhtml\+xml/i.test(r)) {
987
- const s = new Error("字体 URL 返回 HTML 页面(可能是 SPA 路由回退),不是字体文件");
988
- return { status: "error", fontUrl: e, message: Pe(e, s.message), cause: s };
989
- }
990
- if (/^text\//i.test(r) || /(?:\/|\+)json(?:\s*;|$)/i.test(r)) {
991
- const s = new Error(`字体 URL 返回 ${r} 文本响应,不是字体文件`);
992
- return { status: "error", fontUrl: e, message: Pe(e, s.message), cause: s };
993
- }
994
- return {
995
- status: "available",
996
- fontUrl: e,
997
- message: "PDF 字体资源可达;文字覆盖范围将在实际导出时校验"
998
- };
999
- } catch (n) {
1000
- if (t.signal.aborted && !o) throw We(t.signal);
1001
- return {
1002
- status: "error",
1003
- fontUrl: e,
1004
- message: Pe(e, o ? "字体检查超时,请检查网络或字体服务" : "字体检查失败,请检查网络、字体服务或跨域访问配置"),
1005
- cause: n
1006
- };
1007
- } finally {
1008
- clearTimeout(a);
1009
- }
1010
- }
1011
- function zn(e, t) {
1012
- if (t?.aborted) return Promise.reject(We(t));
1013
- if (!e)
1014
- return Promise.resolve({ status: "disabled", fontUrl: e, message: "已停用自定义 PDF 字体;内置字体用于西文,其他文字会在导出时校验" });
1015
- const o = ct.get(e);
1016
- if (o) return Promise.resolve(o);
1017
- let a = he.get(e);
1018
- if (!a) {
1019
- const r = new AbortController();
1020
- a = { controller: r, promise: An(e, r), subscribers: 0 };
1021
- const s = a;
1022
- he.set(e, s), s.promise = s.promise.then((d) => (!r.signal.aborted && d.status === "available" && ct.set(e, d), d)).finally(() => {
1023
- he.get(e) === s && he.delete(e);
1024
- });
1025
- }
1026
- const n = a;
1027
- return n.subscribers++, new Promise((r, s) => {
1028
- let d = !1;
1029
- const p = () => d ? !1 : (d = !0, n.subscribers--, t?.removeEventListener("abort", m), !0), m = () => {
1030
- p() && (n.subscribers === 0 && (he.get(e) === n && he.delete(e), n.controller.abort()), s(We(t)));
1031
- };
1032
- t?.addEventListener("abort", m, { once: !0 }), n.promise.then(
1033
- (c) => {
1034
- p() && r(c);
1035
- },
1036
- (c) => {
1037
- p() && s(c);
1038
- }
1039
- ), t?.aborted && m();
1040
- });
1041
- }
1042
- function Hn(e = { fontUrl: "/simhei.ttf" }) {
1043
- let t = null;
1044
- const o = async (a, n) => {
1045
- t || (t = await import("@agile-team/mach-report/pdf"));
1046
- let r = null;
1047
- if (e.fontUrl)
1048
- try {
1049
- if (r = await t.loadFontWithCache(e.fontUrl, { strict: !0 }), !r?.byteLength) throw new Error("字体文件为空或加载失败");
1050
- } catch (u) {
1051
- const v = u instanceof Error ? u.message : String(u);
1052
- throw Ge(Pe(e.fontUrl, v), u);
1053
- }
1054
- let s;
1055
- try {
1056
- s = await t.renderPlanToPdf(a, r ? { customFontBytes: r } : {});
1057
- } catch (u) {
1058
- if (!r) throw u;
1059
- const v = u instanceof Error ? u.message : String(u);
1060
- throw Ge(`PDF 生成失败:${v}。当前字体 URL 为 ${JSON.stringify(e.fontUrl)};请确认该文件是有效字体,或重新配置 pdfFontUrl`, u);
1061
- }
1062
- const { bytes: d, unsupportedTextCount: p, pageErrors: m, fidelityWarnings: c } = s;
1063
- if (p > 0)
1064
- throw new Error(`PDF 中有 ${p} 行文字无法编码;请部署支持所用文字的字体并配置 pdfFontUrl`);
1065
- if (m.length > 0)
1066
- throw new Error(`PDF 有 ${m.length} 页渲染失败:${m[0]}`);
1067
- return c.length > 0 && n?.(`PDF 有 ${c.length} 处版式降级:${c.slice(0, 2).join(";")}`), d;
1068
- };
1069
- return o.checkFont = (a) => zn(e.fontUrl, a), o;
1070
- }
1071
- class ge extends Error {
1072
- constructor(t, o, a) {
1073
- super(o), this.name = "MachReportError", this.code = t, this.cause = a;
1074
- }
1075
- }
1076
- function qn(e) {
1077
- return e instanceof ge ? { code: e.code, cause: e.cause } : { code: "render", cause: e };
1078
- }
1079
- const Nn = {
1080
- key: 2,
1081
- class: "mrp-export-notice mrp-export-warning",
1082
- role: "status"
1083
- }, jn = { class: "mrp-main" }, Un = {
1084
- key: 0,
1085
- class: "mrp-state"
1086
- }, Vn = {
1087
- key: 1,
1088
- class: "mrp-state mrp-error"
1089
- }, Kn = {
1090
- key: 2,
1091
- class: "mrp-state"
1092
- }, Zn = ["data-page"], Jn = ["onClick"], Gn = ["data-thumb"], Yn = { class: "mrp-thumb-no" }, Xn = { class: "mrp-overlay" }, Qn = {
1093
- key: 3,
1094
- class: "mrp-debug",
1095
- "aria-hidden": "true"
1096
- }, Ke = 96 / 25.4, dt = "mach-report:ui", _n = /* @__PURE__ */ Xe({
1097
- __name: "ReportPreview",
1098
- props: {
1099
- reportId: {
1100
- type: [String, Array],
1101
- default: null
1102
- },
1103
- params: {
1104
- type: Object,
1105
- default: () => ({})
1106
- },
1107
- height: { type: String, default: "100vh" },
1108
- autoLoad: { type: Boolean, default: !0 },
1109
- /** 以下显隐/间距不传时走配置中心(preset > defaults > 内置缺省) */
1110
- showExport: { type: Boolean, default: void 0 },
1111
- showPrint: { type: Boolean, default: void 0 },
1112
- showPdfWindow: { type: Boolean, default: void 0 },
1113
- /** 页间距(px);不传走配置中心 */
1114
- gapPx: { type: Number, default: void 0 },
1115
- /** 工具栏/状态文案覆写(不传走配置中心 messages) */
1116
- messages: { type: Object, default: void 0 },
1117
- /** 启用的 preset 名(不传用配置中心 defaultPreset) */
1118
- preset: { type: String, default: void 0 },
1119
- /** 调试面板(也可用 URL ?mrp-debug=1 开启) */
1120
- debug: { type: Boolean, default: !1 },
1121
- /** 参数定义(优先级:prop > 模板 params;有定义且未关闭时显示查询面板) */
1122
- paramDefs: {
1123
- type: Array,
1124
- default: void 0
1125
- },
1126
- /** 参数面板显隐(不传走配置中心,缺省 true;有参数定义才渲染) */
1127
- showParams: { type: Boolean, default: void 0 },
1128
- fetcher: {
1129
- type: Function,
1130
- default: null
1131
- }
1132
- },
1133
- emits: ["loaded", "error", "warning"],
1134
- setup(e, { expose: t, emit: o }) {
1135
- Bt((i) => ({
1136
- v4c81cc3e: F.value + "px"
1137
- }));
1138
- const a = e, n = o, r = Me(null), s = O(!1), d = O(""), p = Me(null), m = O(null), c = O(!1), u = Me(Object.freeze({ status: "unchecked", fontUrl: "" })), v = O(null), h = O(1), W = O(null), I = O(null), g = O(null), S = O(!1), P = an(), F = C(() => Math.max(0, M.value)), q = De(Ut, null), D = De(Vt, null), N = C(() => vt(a.reportId)), j = C(() => a.fetcher ?? q), B = C(() => r.value?.pages.length ?? 0), J = C(() => Object.freeze({
1139
- loading: s.value,
1140
- hasPlan: B.value > 0,
1141
- pageCount: B.value,
1142
- currentPage: h.value,
1143
- exporting: m.value,
1144
- printing: c.value,
1145
- canExport: !s.value && B.value > 0 && m.value === null,
1146
- canPrint: !s.value && B.value > 0 && !c.value,
1147
- error: p.value,
1148
- pdfFont: u.value
1149
- }));
1150
- function U(i, b, y) {
1151
- p.value = Object.freeze({ message: i, code: b, cause: y }), n("error", i, { code: b, cause: y });
1152
- }
1153
- const fe = In(), L = C(() => Bn(fe.value, a.preset)), Z = C(() => ({
1154
- ...L.value.messages,
1155
- ...a.messages
1156
- })), l = C(() => a.showExport ?? L.value.showExport), f = C(() => a.showPrint ?? L.value.showPrint), w = C(() => a.showPdfWindow ?? L.value.showPdfWindow), M = C(() => a.gapPx ?? L.value.gapPx), R = C(() => a.showParams ?? L.value.showParams);
1157
- let V = null, G = null;
1158
- function X() {
1159
- if (D) return D;
1160
- const i = L.value.pdfFontUrl;
1161
- return (!G || V !== i) && (V = i, G = Hn({ fontUrl: i })), G;
1162
- }
1163
- let $e = 0, be = null, we = !1;
1164
- function Ie() {
1165
- $e++, be?.abort(), be = null;
1166
- }
1167
- async function ke() {
1168
- if (we) throw new ge("config", "报表预览已卸载");
1169
- Ie();
1170
- const i = $e, b = new AbortController();
1171
- be = b;
1172
- const y = L.value.pdfFontUrl;
1173
- u.value = Object.freeze({ status: "checking", fontUrl: y });
1174
- try {
1175
- const A = X(), te = A.checkFont ? await A.checkFont(b.signal) : { status: "unverified", fontUrl: "", message: "自定义 PDF 导出器未提供字体预检查;字体由宿主确认" };
1176
- return !we && i === $e && !b.signal.aborted && (u.value = Object.freeze({ ...te })), te;
1177
- } catch (A) {
1178
- if (b.signal.aborted) throw A;
1179
- const te = {
1180
- status: "error",
1181
- fontUrl: y,
1182
- message: A instanceof Error ? A.message : "PDF 字体检查失败",
1183
- cause: A
1184
- };
1185
- return !we && i === $e && (u.value = Object.freeze(te)), te;
1186
- } finally {
1187
- be === b && (be = null);
1188
- }
1189
- }
1190
- function bt() {
1191
- ke().catch(() => {
1192
- });
1193
- }
1194
- _(
1195
- [r, () => L.value.pdfFontUrl, l, w],
1196
- () => {
1197
- const i = u.value.fontUrl === L.value.pdfFontUrl;
1198
- Ie(), (!i || u.value.status === "checking") && (u.value = Object.freeze({ status: "unchecked", fontUrl: L.value.pdfFontUrl })), !we && B.value > 0 && (l.value || w.value) && ke().catch(() => {
1199
- });
1200
- },
1201
- { immediate: !0 }
1202
- );
1203
- const ae = C(
1204
- () => a.paramDefs ?? j.value?.getParamDefs?.(N.value) ?? []
1205
- ), ie = O({}), Le = O(!1);
1206
- function ye(i) {
1207
- const b = {};
1208
- for (const y of i)
1209
- b[y.field] = a.params[y.field] ?? y.defaultValue ?? "";
1210
- ie.value = b, Le.value = !1;
1211
- }
1212
- ye(ae.value), _(ae, (i) => ye(i)), _(N, () => ye(ae.value)), _(() => JSON.stringify(a.params), () => ye(ae.value));
1213
- const wt = C(() => {
1214
- const i = { ...a.params };
1215
- for (const [b, y] of Object.entries(ie.value))
1216
- y === "" ? delete i[b] : i[b] = y;
1217
- return i;
1218
- });
1219
- function yt() {
1220
- return ae.value.filter(
1221
- (i) => i.required === !0 && !(ie.value[i.field] ?? "").trim()
1222
- );
1223
- }
1224
- function xt() {
1225
- Le.value = !0;
1226
- const i = yt();
1227
- if (i.length > 0) {
1228
- const b = i[0].label ?? i[0].field, y = Z.value.paramRequired.replace("{label}", b);
1229
- d.value = y, U(y, "param");
1230
- return;
1231
- }
1232
- ue();
1233
- }
1234
- function Pt() {
1235
- ye(ae.value);
1236
- }
1237
- const Et = C(() => ({
1238
- height: a.height,
1239
- ...Wn(L.value.theme)
1240
- })), { zoom: Y, zoomMode: pe, applyFitZoom: tt, setZoom: Ae } = Jt(() => ({
1241
- viewport: I.value,
1242
- pageWidthPx: (r.value?.pages[0]?.pageWidthMm ?? 210) * Ke
1243
- })), nt = Zt(r, Y, {
1244
- pxPerMm: Ke,
1245
- gapPx: M,
1246
- overscan: C(() => L.value.preview.overscanPages)
1247
- }), { contentSize: ze, windowRange: xe, visiblePages: rt, makeScrollHandler: $t, refreshViewport: He } = nt, kt = $t(h, B);
1248
- function qe(i) {
1249
- pe.value = "raw", Y.value = Math.min(3, Math.max(0.3, i));
1250
- }
1251
- function Ce() {
1252
- Ct(), r.value = null, h.value = 1, K.reset();
1253
- }
1254
- let se = 0, ne = null;
1255
- async function ue() {
1256
- const i = ++se;
1257
- ne?.abort(), ne = null;
1258
- const b = j.value;
1259
- if (s.value = !1, p.value = null, N.value.length === 0) {
1260
- d.value = "缺少报表 ID", Ce(), U(d.value, "param");
1261
- return;
1262
- }
1263
- if (!b) {
1264
- d.value = "未提供渲染数据源 fetcher", Ce(), U(d.value, "config");
1265
- return;
1266
- }
1267
- s.value = !0, d.value = "", v.value = null, Ce();
1268
- const y = P.start(), A = new AbortController();
1269
- ne = A;
1270
- const te = /* @__PURE__ */ new Set();
1271
- function ve(z) {
1272
- i !== se || A.signal.aborted || te.has(z) || (te.add(z), L.value.logger.warn("[mach-report] 报表告警:", z), n("warning", z));
1273
- }
1274
- try {
1275
- const z = await b({
1276
- reportIds: N.value,
1277
- params: { ...wt.value },
1278
- signal: A.signal,
1279
- onWarning: ve
1280
- });
1281
- if (i !== se) return;
1282
- const Q = qt(z);
1283
- if (!Q.ok) {
1284
- const ce = Q.errors.slice(0, 3).map((st) => `${st.path}: ${st.message}`).join("; ");
1285
- throw new ge(
1286
- "validate",
1287
- `渲染计划校验失败(${Q.errors.length} 处): ${ce}`
1288
- );
1289
- }
1290
- if (Q.warnings.forEach((ce) => ve(`${ce.path}: ${ce.message}`)), i !== se || A.signal.aborted) return;
1291
- r.value = z, h.value = 1, P.end(y), I.value && (I.value.scrollTop = 0), pe.value === "fit" && tt(), n("loaded", z.pages.length);
1292
- } catch (z) {
1293
- if (i !== se) return;
1294
- const Q = z instanceof ge ? z : z instanceof Nt ? new ge(z.code, z.message, z.cause) : new ge(
1295
- "fetch",
1296
- z instanceof Error ? z.message : "预览加载失败",
1297
- z
1298
- );
1299
- d.value = Q.message;
1300
- const ce = qn(Q);
1301
- U(Q.message, ce.code, ce.cause);
1302
- } finally {
1303
- i === se && (s.value = !1), ne === A && (ne = null);
1304
- }
1305
- }
1306
- function re(i) {
1307
- if (B.value <= 0) return;
1308
- const b = Math.max(1, Math.min(B.value, i));
1309
- h.value = b;
1310
- const y = I.value;
1311
- y && (y.scrollTop = nt.pageOffsetPx(b - 1) * Y.value, He(y));
1312
- }
1313
- const Fe = Yt(r, {
1314
- getPdfExporter: X,
1315
- getXlsxOptions: () => L.value.xlsx,
1316
- onError: (i, b) => {
1317
- v.value = { kind: "error", message: i }, U(i, b ?? "print");
1318
- },
1319
- onWarning: (i) => {
1320
- v.value = { kind: "warning", message: i }, n("warning", i);
1321
- },
1322
- onBusy: (i) => {
1323
- m.value = i, i ? v.value = {
1324
- kind: "progress",
1325
- message: Z.value.exporting.replace("{format}", i)
1326
- } : v.value?.kind === "progress" && (v.value = null);
1327
- },
1328
- onPrinting: (i) => {
1329
- c.value = i;
1330
- }
1331
- }), { releasePrintFrame: Ct, dispose: Ft } = Fe;
1332
- async function Ne() {
1333
- p.value = null, await Fe.print();
1334
- }
1335
- async function je(i) {
1336
- p.value = null, await Fe.exportAs(i);
1337
- }
1338
- function Ue() {
1339
- p.value = null, Fe.openPdfWindow();
1340
- }
1341
- async function ot(i, b = {}) {
1342
- ie.value = { ...ie.value, ...i }, b.reload !== !1 && await ue();
1343
- }
1344
- ft(Kt, {
1345
- reload: ue,
1346
- print: Ne,
1347
- exportAs: je,
1348
- openPdfWindow: Ue,
1349
- gotoPage: re,
1350
- setParams: ot,
1351
- checkPdfFont: ke,
1352
- get state() {
1353
- return J.value;
1354
- }
1355
- });
1356
- const K = nn({
1357
- plan: r,
1358
- gotoPage: re,
1359
- debounceMs: C(() => L.value.preview.searchDebounceMs),
1360
- highlight: Qt,
1361
- clearHighlights: Xt
1362
- });
1363
- function Mt(i) {
1364
- i.ctrlKey && (i.preventDefault(), qe(Y.value * (i.deltaY < 0 ? 1.1 : 1 / 1.1)));
1365
- }
1366
- function Tt(i) {
1367
- if ((i.ctrlKey || i.metaKey) && i.key.toLowerCase() === "f") {
1368
- i.preventDefault(), K.visible.value || K.toggle();
1369
- return;
1370
- }
1371
- switch (i.key) {
1372
- case "PageDown":
1373
- i.preventDefault(), re(h.value + 1);
1374
- break;
1375
- case "PageUp":
1376
- i.preventDefault(), re(h.value - 1);
1377
- break;
1378
- case "Home":
1379
- i.preventDefault(), re(1);
1380
- break;
1381
- case "End":
1382
- i.preventDefault(), re(B.value);
1383
- break;
1384
- case "+":
1385
- case "=":
1386
- i.preventDefault(), qe(Y.value * 1.1);
1387
- break;
1388
- case "-":
1389
- i.preventDefault(), qe(Y.value / 1.1);
1390
- break;
1391
- }
1392
- }
1393
- function Rt() {
1394
- try {
1395
- localStorage.setItem(
1396
- dt,
1397
- JSON.stringify({ zoomMode: pe.value === "fit" ? "fit" : Math.round(Y.value * 100) })
1398
- );
1399
- } catch {
1400
- }
1401
- }
1402
- _([pe, Y], Rt), it(() => {
1403
- const i = r.value;
1404
- if (!i) return;
1405
- rt.value;
1406
- const b = W.value;
1407
- if (!b) return;
1408
- b.querySelectorAll(".mrp-page-holder").forEach((A) => {
1409
- const te = Number(A.dataset.page ?? 0) - 1, ve = i.pages[te];
1410
- if (!ve || A.childElementCount > 0) {
1411
- if (A.firstElementChild) {
1412
- const Q = A.firstElementChild;
1413
- K.clear(Q), K.apply(Q);
1414
- }
1415
- return;
1416
- }
1417
- A.style.width = `${ve.pageWidthMm * Ke}px`;
1418
- const z = pt(ve, 96, {}, document);
1419
- K.apply(z), A.appendChild(z);
1420
- });
1421
- }, { flush: "post" }), _(() => K.query.value, (i) => {
1422
- i || W.value?.querySelectorAll(".mrp-page-holder").forEach((b) => {
1423
- K.clear(b);
1424
- });
1425
- });
1426
- const ee = on(r, {
1427
- thumbsRoot: g,
1428
- visible: S,
1429
- renderThumbCanvas: (i) => {
1430
- try {
1431
- const { canvases: b } = jt(r.value, { start: i, end: i, dpr: 0.2 });
1432
- return b[0] ?? null;
1433
- } catch {
1434
- return null;
1435
- }
1436
- }
1437
- });
1438
- it(() => {
1439
- ee.schedule();
1440
- }, { flush: "post" });
1441
- const St = C(() => a.debug), { debugStats: me } = rn(St, {
1442
- plan: r,
1443
- pageCount: B,
1444
- windowRange: xe,
1445
- zoom: Y,
1446
- loadMs: P.loadMs
1447
- });
1448
- function at() {
1449
- He(I.value), ee.schedule(), pe.value === "fit" && tt();
1450
- }
1451
- function Dt() {
1452
- try {
1453
- const i = JSON.parse(localStorage.getItem(dt) ?? "{}");
1454
- i.zoomMode === "fit" ? Ae("fit") : typeof i.zoomMode == "number" && Ae(i.zoomMode);
1455
- } catch {
1456
- }
1457
- }
1458
- return Wt(() => {
1459
- window.addEventListener("resize", at), He(I.value), Dt(), a.autoLoad && ue();
1460
- }), It(() => {
1461
- we = !0, Ie(), se++, ne?.abort(), ne = null, window.removeEventListener("resize", at), ee.destroy(), K.reset(), Ft();
1462
- }), _(
1463
- () => [JSON.stringify(N.value), JSON.stringify(a.params), j.value],
1464
- () => {
1465
- if (a.autoLoad) {
1466
- ue();
1467
- return;
1468
- }
1469
- se++, ne?.abort(), ne = null, s.value = !1, d.value = "", p.value = null, v.value = null, Ce();
1470
- }
1471
- ), t({ reload: ue, print: Ne, exportAs: je, openPdfWindow: Ue, gotoPage: re, setParams: ot, checkPdfFont: ke, state: J }), (i, b) => (E(), $("div", {
1472
- class: "mach-report-preview",
1473
- style: oe(Et.value)
1474
- }, [
1475
- R.value && ae.value.length > 0 ? (E(), Lt(Rn, {
1476
- key: 0,
1477
- defs: ae.value,
1478
- modelValue: ie.value,
1479
- "onUpdate:modelValue": b[0] || (b[0] = (y) => ie.value = y),
1480
- messages: Z.value,
1481
- attempted: Le.value,
1482
- onQuery: xt,
1483
- onReset: Pt
1484
- }, null, 8, ["defs", "modelValue", "messages", "attempted"])) : H("", !0),
1485
- At(bn, {
1486
- "page-count": B.value,
1487
- "current-page": h.value,
1488
- "zoom-mode": x(pe),
1489
- zoom: x(Y),
1490
- "show-export": l.value,
1491
- "show-print": f.value,
1492
- "show-pdf-window": w.value,
1493
- messages: Z.value,
1494
- search: { visible: x(K).visible.value, query: x(K).query.value, matchIndex: x(K).matchIndex.value, matchCount: x(K).matchCount.value, searching: x(K).searching.value },
1495
- "thumbs-visible": S.value,
1496
- onGoto: re,
1497
- onZoom: x(Ae),
1498
- onExport: b[1] || (b[1] = (y) => je(y)),
1499
- onPrint: Ne,
1500
- onPdfWindow: Ue,
1501
- onSearchInput: x(K).onInput,
1502
- onSearchNav: x(K).onNav,
1503
- onSearchToggle: x(K).toggle,
1504
- onThumbsToggle: b[2] || (b[2] = (y) => S.value = !S.value)
1505
- }, null, 8, ["page-count", "current-page", "zoom-mode", "zoom", "show-export", "show-print", "show-pdf-window", "messages", "search", "thumbs-visible", "onZoom", "onSearchInput", "onSearchNav", "onSearchToggle"]),
1506
- v.value ? (E(), $("div", {
1507
- key: 1,
1508
- class: le(["mrp-export-notice", `mrp-export-${v.value.kind}`]),
1509
- role: "alert"
1510
- }, k(v.value.message), 3)) : H("", !0),
1511
- u.value.status === "error" && (l.value || w.value) ? (E(), $("div", Nn, [
1512
- Ze(k(Z.value.pdfFontUnavailable) + " ", 1),
1513
- T("button", {
1514
- type: "button",
1515
- onClick: bt
1516
- }, k(Z.value.retry), 1)
1517
- ])) : H("", !0),
1518
- T("div", jn, [
1519
- T("div", {
1520
- ref_key: "viewportRef",
1521
- ref: I,
1522
- class: "mrp-body",
1523
- tabindex: "0",
1524
- onWheel: Mt,
1525
- onKeydown: Tt,
1526
- onScrollPassive: b[3] || (b[3] = (y) => x(kt)(y.target))
1527
- }, [
1528
- s.value ? (E(), $("div", Un, k(Z.value.loading), 1)) : d.value ? (E(), $("div", Vn, [
1529
- Ze(k(d.value) + " ", 1),
1530
- T("button", {
1531
- class: "mrp-retry",
1532
- type: "button",
1533
- onClick: ue
1534
- }, k(Z.value.retry), 1)
1535
- ])) : !r.value || B.value === 0 ? (E(), $("div", Kn, k(Z.value.empty), 1)) : (E(), $("div", {
1536
- key: 3,
1537
- class: "mrp-scale",
1538
- style: oe({ width: `${x(ze).w * x(Y)}px`, height: `${x(ze).h * x(Y)}px` })
1539
- }, [
1540
- T("div", {
1541
- ref_key: "containerRef",
1542
- ref: W,
1543
- class: "mrp-scale-inner",
1544
- style: oe({ transform: `scale(${x(Y)})`, transformOrigin: "top left", width: `${x(ze).w}px` })
1545
- }, [
1546
- x(xe).padTopPx > 0 ? (E(), $("div", {
1547
- key: 0,
1548
- class: "mrp-spacer-top",
1549
- style: oe({ height: `${x(xe).padTopPx}px` }),
1550
- "aria-hidden": "true"
1551
- }, null, 4)) : H("", !0),
1552
- (E(!0), $(Ee, null, Se(x(rt), (y) => (E(), $("div", {
1553
- key: y.index,
1554
- class: "mrp-page-holder",
1555
- "data-page": y.index + 1
1556
- }, null, 8, Zn))), 128)),
1557
- x(xe).padBottomPx > 0 ? (E(), $("div", {
1558
- key: 1,
1559
- class: "mrp-spacer-bottom",
1560
- style: oe({ height: `${x(xe).padBottomPx}px` }),
1561
- "aria-hidden": "true"
1562
- }, null, 4)) : H("", !0)
1563
- ], 4)
1564
- ], 4))
1565
- ], 544),
1566
- S.value && B.value > 0 ? (E(), $("aside", {
1567
- key: 0,
1568
- ref_key: "thumbsRef",
1569
- ref: g,
1570
- class: "mrp-thumbs",
1571
- onScrollPassive: b[4] || (b[4] = //@ts-ignore
1572
- (...y) => x(ee).onScroll && x(ee).onScroll(...y))
1573
- }, [
1574
- x(ee).windowRange.value.padTopPx > 0 ? (E(), $("div", {
1575
- key: 0,
1576
- class: "mrp-thumb-spacer",
1577
- style: oe({ height: `${x(ee).windowRange.value.padTopPx}px` }),
1578
- "aria-hidden": "true"
1579
- }, null, 4)) : H("", !0),
1580
- (E(!0), $(Ee, null, Se(x(ee).visibleThumbs.value, (y) => (E(), $("div", {
1581
- key: y.index,
1582
- class: le(["mrp-thumb", { "mrp-thumb-active": y.index + 1 === h.value }]),
1583
- style: oe({ height: `${y.height + 20}px` }),
1584
- onClick: (A) => re(y.index + 1)
1585
- }, [
1586
- T("div", {
1587
- class: "mrp-thumb-box",
1588
- "data-thumb": y.index + 1,
1589
- style: oe({ height: `${y.height}px` })
1590
- }, null, 12, Gn),
1591
- T("span", Yn, k(y.index + 1), 1)
1592
- ], 14, Jn))), 128)),
1593
- x(ee).windowRange.value.padBottomPx > 0 ? (E(), $("div", {
1594
- key: 1,
1595
- class: "mrp-thumb-spacer",
1596
- style: oe({ height: `${x(ee).windowRange.value.padBottomPx}px` }),
1597
- "aria-hidden": "true"
1598
- }, null, 4)) : H("", !0)
1599
- ], 544)) : H("", !0)
1600
- ]),
1601
- T("div", Xn, [
1602
- zt(i.$slots, "default", {}, void 0, !0)
1603
- ]),
1604
- x(me) ? (E(), $("div", Qn, [
1605
- b[5] || (b[5] = T("div", null, "mach-report debug", -1)),
1606
- T("div", null, "pages: " + k(x(me).pages) + " | window: [" + k(x(me).window) + "]", 1),
1607
- T("div", null, "zoom: " + k(x(me).zoom) + " | load: " + k(x(me).loadMs), 1),
1608
- T("div", null, "plan: " + k(x(me).planKB) + "KB", 1)
1609
- ])) : H("", !0)
1610
- ], 4));
1611
- }
1612
- }), er = /* @__PURE__ */ et(_n, [["__scopeId", "data-v-294f34ce"]]), fr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1613
- __proto__: null,
1614
- default: er
1615
- }, Symbol.toStringTag, { value: "Module" }));
1616
- export {
1617
- Sn as D,
1618
- ge as M,
1619
- Ve as P,
1620
- Rn as R,
1621
- cr as S,
1622
- Dn as a,
1623
- er as b,
1624
- bn as c,
1625
- ht as d,
1626
- Gt as e,
1627
- Hn as f,
1628
- lr as g,
1629
- On as h,
1630
- ur as i,
1631
- sr as j,
1632
- dr as k,
1633
- qn as l,
1634
- Zt as m,
1635
- vt as n,
1636
- Yt as o,
1637
- ir as p,
1638
- Jt as q,
1639
- Bn as r,
1640
- fr as s,
1641
- Wn as t,
1642
- In as u
1643
- };