@feedmepos/mf-report 5.33.3-beta.0 → 5.34.0-beta.1

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/dist/{App-GzjtZ_d7.js → App-DyrakazI.js} +98 -97
  2. package/dist/{DateRangeSelect-CfV_WX9B.js → DateRangeSelect-D5SGi6ca.js} +67 -67
  3. package/dist/{Default.vue_vue_type_script_setup_true_lang-Y9S0SZ7o.js → Default.vue_vue_type_script_setup_true_lang-DsTRZa_6.js} +3 -3
  4. package/dist/DigestListView-BnkDRa7x.js +876 -0
  5. package/dist/{DigestReaderView-C1aKtovl.js → DigestReaderView-ByISB4qT.js} +63 -63
  6. package/dist/{DynamicWidget.vue_vue_type_script_setup_true_lang-CH2pf4XK.js → DynamicWidget.vue_vue_type_script_setup_true_lang-BKNNtuyG.js} +733 -733
  7. package/dist/{GlobalFilterSelect.vue_vue_type_script_setup_true_lang-DJ-LIqFg.js → GlobalFilterSelect.vue_vue_type_script_setup_true_lang-DHrnVaog.js} +526 -526
  8. package/dist/{InsightView-O5pzXY-g.js → InsightView-CUBTqwTI.js} +88 -88
  9. package/dist/{Integration-DHtuuAEx.js → Integration-WDbqUebw.js} +30 -30
  10. package/dist/{Integrations-xK1WbyH5.js → Integrations-C5_nERZt.js} +10 -10
  11. package/dist/{Layout-QoN7zexW.js → Layout-BqzoK8Mg.js} +3 -3
  12. package/dist/{LocationSelect.vue_vue_type_script_setup_true_lang-DEeDj0JI.js → LocationSelect.vue_vue_type_script_setup_true_lang-kvdk_gEw.js} +306 -306
  13. package/dist/{MenuTab.vue_vue_type_script_setup_true_lang-tmHI7t6B.js → MenuTab.vue_vue_type_script_setup_true_lang-B8uHS4bV.js} +6 -6
  14. package/dist/{NavigationTab.vue_vue_type_script_setup_true_lang-DNrIAtGk.js → NavigationTab.vue_vue_type_script_setup_true_lang-CpexikuB.js} +12784 -11760
  15. package/dist/{OverviewView-CcqkLuon.js → OverviewView-mOEI9DAV.js} +7 -7
  16. package/dist/{Report-CcGTeCCn.js → Report-DmbTzjbj.js} +12 -12
  17. package/dist/{ReportCanvasView-C7CJq01e.js → ReportCanvasView-BqZ38Tsk.js} +426 -426
  18. package/dist/{ReportEditor-Vu592FeV.js → ReportEditor-8oAVfFdY.js} +32 -32
  19. package/dist/{ReportView-D-J7pmp5.js → ReportView-B6nE3qwV.js} +13 -13
  20. package/dist/{ReportViewRoute-TSaFpVVj.js → ReportViewRoute-DqXbM93B.js} +5 -5
  21. package/dist/SelectComponent.vue_vue_type_script_setup_true_lang-Cxx-TQz9.js +137 -0
  22. package/dist/{Setting-tUrQLnqy.js → Setting-C01x-O-V.js} +6 -6
  23. package/dist/{Template-DRdVU80G.js → Template-VyBWHUXE.js} +80 -80
  24. package/dist/{TileEditor-CIR7d_cP.js → TileEditor-DICyBR1o.js} +1566 -1566
  25. package/dist/{TilePageStack.vue_vue_type_script_setup_true_lang-BtHZMHPR.js → TilePageStack.vue_vue_type_script_setup_true_lang-Dyaao76o.js} +82 -82
  26. package/dist/{TransitionFade-7EvXhuHo.js → TransitionFade-kXCDPEMQ.js} +170 -170
  27. package/dist/{XeroRedirect-CuTrP62C.js → XeroRedirect-D4sHbZe7.js} +3 -3
  28. package/dist/_plugin-vue_export-helper-Bx7s49ra.js +2828 -0
  29. package/dist/{app-1dD87x1L.js → app-BQDKX7NB.js} +5688 -13890
  30. package/dist/app.js +1 -1
  31. package/dist/assets/{formatChartData.worker-DvK7K5ca.js → formatChartData.worker-Cpgnh20a.js} +62 -62
  32. package/dist/assets/{processTableData.worker-C3l4iUXL.js → processTableData.worker-B7I6PElJ.js} +64 -64
  33. package/dist/{chart-BywXiz4O.js → chart-DU0N9V2o.js} +7 -4
  34. package/dist/currency-8SmajsvB.js +12 -0
  35. package/dist/index-BQ8NJuCA.js +24722 -0
  36. package/dist/{report-B547gOvv.js → report-CcXsPATD.js} +23 -23
  37. package/dist/style.css +1 -1
  38. package/dist/{useDigestFont-CVDCu0Is.js → useDigestFont-CjZZOIRM.js} +80 -80
  39. package/dist/{useReportCanvasPanel-DLt-AkFQ.js → useReportCanvasPanel-dWlB_xvo.js} +975 -976
  40. package/dist/{useRestaurantPermission-BtRjWi-p.js → useRestaurantPermission-D3G7ET0Z.js} +2 -2
  41. package/package.json +11 -11
  42. package/dist/DigestListView-DJQikkEC.js +0 -876
  43. package/dist/SelectComponent.vue_vue_type_script_setup_true_lang-DW7Dk7iQ.js +0 -137
  44. package/dist/_plugin-vue_export-helper-C6QDExPN.js +0 -2718
  45. package/dist/currency-BXCfWg4A.js +0 -12
  46. package/dist/index-B_yQyaGT.js +0 -25511
@@ -1,876 +0,0 @@
1
- import { defineComponent as $t, ref as z, watch as Ft, onBeforeUnmount as Jt, computed as E, useId as Qt, createElementBlock as k, openBlock as v, normalizeClass as X, createElementVNode as D, createCommentVNode as I, renderSlot as te, createTextVNode as ee, toDisplayString as O, unref as T, Fragment as C, renderList as N, resolveComponent as pt, createBlock as dt, withCtx as ft, createVNode as U, createSlots as se, onMounted as ae, onUnmounted as ne } from "vue";
2
- import { storeToRefs as oe } from "pinia";
3
- import { useI18n as St } from "@feedmepos/mf-common";
4
- import { useBreakpoints as Yt } from "@feedmepos/ui-library";
5
- import { _ as re } from "./Default.vue_vue_type_script_setup_true_lang-Y9S0SZ7o.js";
6
- import { _ as jt } from "./SelectComponent.vue_vue_type_script_setup_true_lang-DW7Dk7iQ.js";
7
- import { useRoute as le } from "vue-router";
8
- import { c as ie, d as Kt, u as ce, a as ue, n as de, _ as he, D as pe } from "./useDigestFont-CVDCu0Is.js";
9
- import { l as fe } from "./report-canvas-libs-CNx4fuqd.js";
10
- import { _ as bt } from "./_plugin-vue_export-helper-C6QDExPN.js";
11
- import { j as me, f as ge, A as ve, k as Ct, l as ye, m as Me } from "./app-1dD87x1L.js";
12
- const W = () => ({ rects: [], circles: [], paths: [] }), Q = (a) => a.x1 - a.x0, tt = (a) => a.y1 - a.y0, S = (a) => a.toFixed(1), xt = [0.14, 0.32, 0.54, 0.78, 1], _t = (a) => xt[Math.min(xt.length - 1, Math.floor(Math.max(0, Math.min(1, a)) * xt.length))];
13
- function Zt(a) {
14
- const t = Math.min(0, ...a), n = Math.max(0, ...a);
15
- if (t >= 0) return (r) => ({ tone: "accent", opacity: _t(n ? r / n : 0) });
16
- const o = Math.max(-t, n);
17
- return (r) => r < 0 ? { tone: "below", opacity: _t(-r / o) } : { tone: "accent", opacity: _t(r / o) };
18
- }
19
- function ke(a, t) {
20
- var d;
21
- const n = a.cells ?? [], o = n.length, r = ((d = n[0]) == null ? void 0 : d.length) ?? 0, u = W();
22
- if (!o || !r) return u;
23
- const i = 1.5, m = (Q(t) - i * (r - 1)) / r, g = (tt(t) - i * (o - 1)) / o, c = Zt(n.flat().filter((h) => h !== null));
24
- return n.forEach(
25
- (h, p) => h.forEach((f, B) => {
26
- const y = { x: t.x0 + B * (m + i), y: t.y0 + p * (g + i), width: Math.max(m, 0.5), height: Math.max(g, 0.5) };
27
- u.rects.push(f === null ? { ...y, tone: "ground", opacity: 1 } : { ...y, ...c(f) });
28
- })
29
- ), u;
30
- }
31
- function wt(a, t, n, o, r, u) {
32
- if (u - r >= Math.PI * 2 - 1e-6) return `${wt(a, t, n, o, r, r + Math.PI)} ${wt(a, t, n, o, r + Math.PI, u)}`;
33
- const i = (g, c) => `${S(a + g * Math.sin(c))},${S(t - g * Math.cos(c))}`, m = u - r > Math.PI ? 1 : 0;
34
- return `M${i(n, r)} A${S(n)},${S(n)} 0 ${m} 1 ${i(n, u)} L${i(o, u)} A${S(o)},${S(o)} 0 ${m} 0 ${i(o, r)} Z`;
35
- }
36
- const Ot = [1, 0.72, 0.5, 0.34, 0.22, 0.14];
37
- function xe(a, t) {
38
- var c;
39
- const n = (((c = a.series[0]) == null ? void 0 : c.values) ?? []).map((d) => Math.max(d ?? 0, 0)), o = n.reduce((d, h) => d + h, 0), r = W();
40
- if (!o) return r;
41
- const u = Math.min(Q(t), tt(t)) / 2, i = (t.x0 + t.x1) / 2, m = (t.y0 + t.y1) / 2;
42
- let g = 0;
43
- return n.forEach((d, h) => {
44
- const p = d / o * Math.PI * 2;
45
- p > 0 && r.paths.push({ d: wt(i, m, u, u * 0.58, g, g + p), tone: "accent", opacity: Ot[Math.min(h, Ot.length - 1)] }), g += p;
46
- }), r;
47
- }
48
- function _e(a, t) {
49
- var g;
50
- const n = (((g = a.series[0]) == null ? void 0 : g.values) ?? []).map((c) => Math.max(c ?? 0, 0)), o = Math.max(...n, 0), r = W();
51
- if (!o) return r;
52
- const u = 2, i = (tt(t) - u * (n.length - 1)) / n.length, m = (t.x0 + t.x1) / 2;
53
- return n.forEach((c, d) => {
54
- const h = Math.max(c / o * Q(t), 1.5);
55
- r.rects.push({ x: m - h / 2, y: t.y0 + d * (i + u), width: h, height: i, tone: "accent", opacity: 1 - d / Math.max(n.length - 1, 1) * 0.45 });
56
- }), r;
57
- }
58
- function we(a, t) {
59
- const n = a.x.length, o = W(), r = Math.max(0, ...a.series.flatMap((d) => d.values.map((h) => h ?? 0)));
60
- if (n < 3 || !r) return o;
61
- const u = Math.min(Q(t), tt(t)) / 2, i = (t.x0 + t.x1) / 2, m = (t.y0 + t.y1) / 2, g = (d, h) => {
62
- const p = d / n * Math.PI * 2;
63
- return `${S(i + u * h * Math.sin(p))},${S(m - u * h * Math.cos(p))}`;
64
- }, c = (d) => `M${d.map((h, p) => g(p, h)).join(" L")} Z`;
65
- o.paths.push({ d: c(Array(n).fill(1)), tone: "ground", opacity: 1 });
66
- for (let d = 0; d < n; d++) o.paths.push({ d: `M${S(i)},${S(m)} L${g(d, 1)}`, tone: "soft", opacity: 0.6, line: "solid" });
67
- return a.series.forEach((d, h) => {
68
- const p = c(d.values.map((f) => Math.max(f ?? 0, 0) / r));
69
- h === 0 && o.paths.push({ d: p, tone: "accent", opacity: 0.28 }), o.paths.push({ d: p, tone: h === 0 ? "accent" : "soft", opacity: 1, line: h === 0 ? "solid" : "dashed" });
70
- }), o;
71
- }
72
- function Rt(a, t, n) {
73
- const o = Math.min(...a), r = Math.max(...a), u = (r - o) * 0.08;
74
- return r === o ? () => (t + n) / 2 : (i) => t + (i - (o - u)) / (r - o + u * 2) * (n - t);
75
- }
76
- function $e(a, t) {
77
- const n = a.dots ?? [], o = W();
78
- if (!n.length) return o;
79
- const r = n.map((c) => c.x), u = n.map((c) => c.y), i = Rt(r, t.x0, t.x1), m = Rt(u, t.y1, t.y0);
80
- Math.min(...r) < 0 && Math.max(...r) > 0 && o.paths.push({ d: `M${S(i(0))},${S(t.y0)} L${S(i(0))},${S(t.y1)}`, tone: "soft", opacity: 1, line: "solid" }), Math.min(...u) < 0 && Math.max(...u) > 0 && o.paths.push({ d: `M${S(t.x0)},${S(m(0))} L${S(t.x1)},${S(m(0))}`, tone: "soft", opacity: 1, line: "solid" });
81
- const g = Math.max(0, ...n.map((c) => c.size ?? 0));
82
- return n.forEach((c) => {
83
- const d = g && c.size !== void 0 ? 2 + 5 * Math.sqrt(Math.max(c.size, 0) / g) : 3;
84
- o.circles.push({ cx: i(c.x), cy: m(c.y), r: d, tone: "accent", opacity: 0.75 });
85
- }), o;
86
- }
87
- function Se(a, t) {
88
- const n = a.links ?? [], o = W();
89
- if (!n.length) return o;
90
- const r = [...new Set(n.flatMap((y) => [y.from, y.to]))], u = new Map(r.map((y) => [y, 0]));
91
- for (let y = 0; y < r.length; y++) n.forEach((x) => u.set(x.to, Math.max(u.get(x.to), u.get(x.from) + 1)));
92
- const i = (y) => n.filter((x) => x.to === y).reduce((x, b) => x + b.value, 0), m = (y) => n.filter((x) => x.from === y).reduce((x, b) => x + b.value, 0), g = new Map(r.map((y) => [y, Math.max(i(y), m(y))])), c = Math.max(...u.values()) + 1, d = (y) => r.filter((x) => u.get(x) === y), h = 3, p = Math.min(...Array.from({ length: c }, (y, x) => {
93
- const b = d(x);
94
- return (tt(t) - h * (b.length - 1)) / b.reduce((j, R) => j + g.get(R), 0);
95
- })), f = 6, B = /* @__PURE__ */ new Map();
96
- for (let y = 0; y < c; y++) {
97
- let x = t.y0;
98
- d(y).forEach((b) => {
99
- const j = c > 1 ? t.x0 + y / (c - 1) * (Q(t) - f) : (t.x0 + t.x1 - f) / 2;
100
- B.set(b, { x: j, y: x, out: x, in: x }), o.rects.push({ x: j, y: x, width: f, height: Math.max(g.get(b) * p, 1), tone: "accent", opacity: 1 }), x += g.get(b) * p + h;
101
- });
102
- }
103
- return n.forEach((y) => {
104
- const x = B.get(y.from), b = B.get(y.to), j = y.value * p, R = x.x + f, $ = b.x, Y = (R + $) / 2;
105
- o.paths.push({
106
- d: `M${S(R)},${S(x.out)} C${S(Y)},${S(x.out)} ${S(Y)},${S(b.in)} ${S($)},${S(b.in)} L${S($)},${S(b.in + j)} C${S(Y)},${S(b.in + j)} ${S(Y)},${S(x.out + j)} ${S(R)},${S(x.out + j)} Z`,
107
- tone: "soft",
108
- opacity: 0.85
109
- }), x.out += j, b.in += j;
110
- }), o;
111
- }
112
- function be(a) {
113
- const { scale: t, translate: n } = a.topology.transform, o = a.topology.arcs.map((i) => {
114
- let m = 0, g = 0;
115
- return i.map(([c, d]) => (m += c, g += d, [m * t[0] + n[0], g * t[1] + n[1]]));
116
- }), r = (i) => i.flatMap((m, g) => {
117
- const c = m < 0 ? [...o[~m]].reverse() : o[m];
118
- return g ? c.slice(1) : c;
119
- }), u = a.topology.objects.regions.geometries.map((i) => {
120
- const g = (i.type === "Polygon" ? [i.arcs] : i.type === "MultiPolygon" ? i.arcs : []).flatMap((f) => f.map(r)), c = g.flat(), d = c.map((f) => f[0]), h = c.map((f) => f[1]), p = i.properties ?? {};
121
- return {
122
- names: [p.name ?? "", ...String(p.aliases ?? "").split("|")].filter(Boolean),
123
- rings: g,
124
- box: [Math.min(...d), Math.min(...h), Math.max(...d), Math.max(...h)]
125
- };
126
- });
127
- return { id: a.id, country: a.country, level: a.level, bbox: a.bbox, features: u };
128
- }
129
- function Ee(a) {
130
- const t = /FM\.geoOutlines = (\{[\s\S]*\})\s*\}\)\(\)\s*$/.exec(a);
131
- return t ? JSON.parse(t[1]).layers.map(be) : [];
132
- }
133
- let Tt;
134
- function Le() {
135
- return Tt ?? (Tt = fe(["geo-outlines@1"]).then((a) => Ee(a["geo-outlines@1"] ?? ""))), Tt;
136
- }
137
- function J(a) {
138
- return String(a || "").toLowerCase().replace(/\b(w\.?\s?p\.?|wilayah persekutuan|federal territory( of)?|changwat|province( of)?|state( of)?|negeri)\b/g, " ").replace(/[^\p{L}\p{N}]+/gu, "");
139
- }
140
- const qt = (a, t, n) => t >= a[0] && t <= a[2] && n >= a[1] && n <= a[3];
141
- function Be(a, t) {
142
- let n;
143
- return a.forEach((o) => {
144
- const r = /* @__PURE__ */ new Map();
145
- o.features.forEach((i) => i.names.forEach((m) => J(m) && !r.has(J(m)) && r.set(J(m), i)));
146
- const u = t.filter((i) => r.has(J(i))).length;
147
- u && (!n || u > n.matched) && (n = { layer: o, byKey: r, matched: u });
148
- }), n;
149
- }
150
- function Ve(a, t) {
151
- var h;
152
- const n = (p) => t.filter((f) => qt(p.bbox, f.lon, f.lat)).length, o = (p) => (p.bbox[2] - p.bbox[0]) * (p.bbox[3] - p.bbox[1]), r = (h = a.filter((p) => n(p) > 0).sort((p, f) => n(f) - n(p) || o(p) - o(f))[0]) == null ? void 0 : h.country;
153
- if (!r) return;
154
- const u = a.filter((p) => p.country === r), i = t.map((p) => p.lat), m = t.map((p) => p.lon), g = Math.max(Math.max(...i) - Math.min(...i), Math.max(...m) - Math.min(...m)), c = u.find((p) => p.level === "districts" && t.every((f) => qt(p.bbox, f.lon, f.lat))), d = u.find((p) => p.level === "states");
155
- return g <= 1.5 && c || d || c || u[0];
156
- }
157
- function At(a, t) {
158
- const n = (d) => Math.log(Math.tan(Math.PI / 4 + Math.max(-85, Math.min(85, d)) * Math.PI / 360)), o = a[0] * Math.PI / 180, r = a[2] * Math.PI / 180, u = n(a[1]), i = n(a[3]), m = Math.min(Q(t) / (r - o || 1e-9), tt(t) / (i - u || 1e-9)), g = t.x0 + (Q(t) - (r - o) * m) / 2, c = t.y0 + (tt(t) - (i - u) * m) / 2;
159
- return (d, h) => [g + (d * Math.PI / 180 - o) * m, c + (i - n(h)) * m];
160
- }
161
- function Nt(a, t, n) {
162
- const o = Math.max(t * Math.max(a[2] - a[0], a[3] - a[1]), n);
163
- return [a[0] - o, a[1] - o, a[2] + o, a[3] + o];
164
- }
165
- const zt = (a, t) => a[0] <= t[2] && a[2] >= t[0] && a[1] <= t[3] && a[3] >= t[1];
166
- function De(a, t, n) {
167
- var p;
168
- const o = W(), r = (f, B) => f.rings.map((y) => `M${y.map(([x, b]) => B(x, b).map(S).join(",")).join(" L")} Z`).join(" ");
169
- if ((p = a.regions) != null && p.length) {
170
- const f = Be(n, a.regions.map(($) => $.name));
171
- if (!f) return o;
172
- const B = a.regions.filter(($) => f.byKey.has(J($.name))), y = B.map(($) => f.byKey.get(J($.name)).box), x = Nt([Math.min(...y.map(($) => $[0])), Math.min(...y.map(($) => $[1])), Math.max(...y.map(($) => $[2])), Math.max(...y.map(($) => $[3]))], 0.08, 0.02), b = At(x, t), j = Zt(B.map(($) => $.value)), R = new Map(B.map(($) => [f.byKey.get(J($.name)), $.value]));
173
- return f.layer.features.filter(($) => zt($.box, x)).forEach(($) => o.paths.push({ d: r($, b), ...R.has($) ? j(R.get($)) : { tone: "land", opacity: 1 } })), o;
174
- }
175
- const u = a.places ?? [], i = u.length ? Ve(n, u) : void 0;
176
- if (!i) return o;
177
- const m = u.map((f) => f.lat), g = u.map((f) => f.lon), c = Nt([Math.min(...g), Math.min(...m), Math.max(...g), Math.max(...m)], 0.15, 0.05), d = At(c, t);
178
- i.features.filter((f) => zt(f.box, c)).forEach((f) => o.paths.push({ d: r(f, d), tone: "land", opacity: 1 }));
179
- const h = Math.max(0, ...u.map((f) => Math.abs(f.value ?? 0)));
180
- return u.forEach((f) => {
181
- const [B, y] = d(f.lon, f.lat), x = h && f.value !== void 0 ? 2.5 + 5.5 * Math.sqrt(Math.abs(f.value) / h) : 3.5;
182
- o.circles.push({ cx: B, cy: y, r: x, tone: (f.value ?? 0) < 0 ? "below" : "accent", opacity: 0.85 });
183
- }), o;
184
- }
185
- function Pe(a, t, n = []) {
186
- return a.kind === "heatmap" ? ke(a, t) : a.kind === "donut" ? xe(a, t) : a.kind === "funnel" ? _e(a, t) : a.kind === "radar" ? we(a, t) : a.kind === "scatter" ? $e(a, t) : a.kind === "flow" ? Se(a, t) : a.kind === "map" ? De(a, t, n) : W();
187
- }
188
- const Ie = { class: "flex items-center justify-between gap-8" }, Fe = { class: "digest-kind" }, je = ["viewBox", "height", "aria-label"], Ce = ["x2", "y1", "y2"], Oe = ["d"], Re = ["d"], Te = ["d"], qe = ["x", "y", "width", "height"], Ae = ["x", "y"], Ne = ["x", "y", "width", "height"], ze = ["width", "height"], He = ["clip-path", "data-kind"], Xe = ["d", "opacity"], Ye = ["x", "y", "width", "height", "opacity"], Ke = ["cx", "cy", "r", "opacity"], Ze = ["x1", "x2", "y1", "y2"], We = ["cx", "cy"], Ge = ["x", "y", "text-anchor"], Ue = ["x"], Je = ["x", "y"], Qe = {
189
- key: 1,
190
- class: "flex items-start gap-8",
191
- "data-testid": "digest-cover-quote"
192
- }, ts = { class: "digest-quote" }, es = ["title"], ut = 28, Z = 12, ss = 12, as = /* @__PURE__ */ $t({
193
- __name: "DigestCover",
194
- props: {
195
- cover: {},
196
- quote: {},
197
- dark: { type: Boolean },
198
- hero: { type: Boolean }
199
- },
200
- setup(a) {
201
- const t = a, { t: n, locale: o } = St(), r = z(), u = z(0);
202
- let i;
203
- Ft(r, (e) => {
204
- i == null || i.disconnect(), !(!e || typeof ResizeObserver > "u") && (i = new ResizeObserver(([l]) => {
205
- const { width: s, height: w } = l.contentRect;
206
- s && (u.value = w / s);
207
- }), i.observe(e));
208
- }), Jt(() => i == null ? void 0 : i.disconnect());
209
- const m = E(() => t.hero ? 520 : 340), g = E(() => {
210
- var e;
211
- return ["line", "bar", "waterfall"].includes(((e = t.cover) == null ? void 0 : e.kind) ?? "");
212
- }), c = E(
213
- () => t.hero && g.value ? 26 + (ct.value.some((e) => e.lines.length > 1) ? 12 : 0) : 6
214
- ), d = E(
215
- () => u.value ? Math.max(ut + c.value + 40, Math.round(m.value * u.value)) : t.hero ? 168 : 110
216
- ), h = E(() => {
217
- const e = t.cover;
218
- return e ? [e.title, e.takeaway].filter(Boolean).join(" · ") : n("reportV5.digest.card.leadStory");
219
- }), p = E(
220
- () => {
221
- var e, l;
222
- return [(e = t.cover) == null ? void 0 : e.title, ...(((l = t.cover) == null ? void 0 : l.marks) ?? []).map((s) => s.label)].filter(Boolean).join(" · ");
223
- }
224
- ), f = E(
225
- () => {
226
- var e;
227
- return (((e = t.cover) == null ? void 0 : e.series) ?? []).flatMap((l) => l.values).filter((l) => l !== null);
228
- }
229
- ), B = E(() => {
230
- var w;
231
- const e = t.cover;
232
- if ((e == null ? void 0 : e.kind) !== "waterfall") return [];
233
- const l = ((w = e.series[0]) == null ? void 0 : w.values) ?? [];
234
- let s = 0;
235
- return l.map((M, V) => {
236
- const L = M ?? 0, P = V === 0 || V === l.length - 1, F = P ? 0 : s;
237
- return s = P ? L : s + L, { from: F, to: s, change: L, total: P };
238
- });
239
- }), y = E(
240
- () => B.value.flatMap((e) => e.total ? [e.to] : [e.from, e.to])
241
- ), x = E(() => {
242
- const e = y.value;
243
- if (!e.length) return 0;
244
- const l = Math.min(...e), s = Math.max(...e);
245
- return !(l > 0) || l === s || (s - l) * 4 >= s ? 0 : l - (s - l);
246
- }), b = E(() => {
247
- var P, F;
248
- const e = d.value - ut - c.value, l = (q, st) => (at) => ut + e - (at - q) / (st - q || 1) * e;
249
- if (((P = t.cover) == null ? void 0 : P.kind) === "waterfall") {
250
- const q = y.value;
251
- return q.length ? l(Math.min(x.value, ...q), Math.max(...q)) : l(0, 1);
252
- }
253
- const s = f.value;
254
- if (!s.length) return (q) => d.value - c.value;
255
- const w = ((F = t.cover) == null ? void 0 : F.kind) === "bar", M = w ? Math.min(0, ...s) : Math.min(...s), V = Math.max(...s), L = V - M || Math.abs(V) || 1;
256
- return w ? l(M, V) : l(M - L * 0.15, V + L * 0.05);
257
- }), j = E(() => {
258
- var e;
259
- return ((e = t.cover) == null ? void 0 : e.x.length) ?? 0;
260
- }), R = E(() => j.value > 1 ? (m.value - Z * 2) / (j.value - 1) : 0), $ = (e) => j.value > 1 ? Z + e * R.value : m.value / 2;
261
- function Y(e) {
262
- let l = "M";
263
- return e.map((s, w) => {
264
- if (s === null)
265
- return l = "M", "";
266
- const M = `${l}${$(w).toFixed(1)},${b.value(s).toFixed(1)}`;
267
- return l = "L", M;
268
- }).join(" ");
269
- }
270
- const ot = E(
271
- () => {
272
- var e;
273
- return ((e = t.cover) == null ? void 0 : e.kind) === "line" ? t.cover.series.map((l) => Y(l.values)) : [];
274
- }
275
- ), rt = E(() => {
276
- var s, w;
277
- const e = ((s = t.cover) == null ? void 0 : s.kind) === "line" ? (w = t.cover.series[0]) == null ? void 0 : w.values : void 0;
278
- if (!e || e.some((M) => M === null) || e.length < 2) return "";
279
- const l = (d.value - c.value).toFixed(1);
280
- return `${Y(e)} L${$(e.length - 1).toFixed(1)},${l} L${$(0).toFixed(1)},${l} Z`;
281
- }), A = E(() => (m.value - Z * 2) / Math.max(j.value, 1)), lt = E(() => {
282
- var e;
283
- return Math.min(((e = t.cover) == null ? void 0 : e.series.length) ?? 0, 2);
284
- }), et = E(() => A.value * 0.72 / Math.max(lt.value, 1)), mt = (e, l) => Z + e * A.value + A.value * 0.14 + l * et.value, _ = E(() => {
285
- const e = t.cover;
286
- if ((e == null ? void 0 : e.kind) !== "bar") return [];
287
- const l = b.value(0), s = e.marks ?? [];
288
- return e.series.slice(0, lt.value).flatMap(
289
- (w, M) => w.values.map((V, L) => {
290
- const P = V === null ? l : b.value(V), F = s.some((q) => q.at === L && q.series === M);
291
- return {
292
- key: `${M}-${L}`,
293
- x: mt(L, M),
294
- y: Math.min(P, l),
295
- width: Math.max(et.value - 1.5, 1.5),
296
- height: Math.max(Math.abs(l - P), V === null ? 0 : 1.5),
297
- faint: M > 0,
298
- marked: F,
299
- // a noted bar stands out against the bars it is compared with
300
- muted: s.length > 0 && !F && M === 0
301
- };
302
- })
303
- );
304
- });
305
- function K(e, l) {
306
- var L;
307
- const s = (L = t.cover) == null ? void 0 : L.format, w = Math.abs(s === "ratio" ? e * 100 : e), M = new Intl.NumberFormat(o.value, {
308
- maximumFractionDigits: w >= 100 ? 0 : 1
309
- }).format(w), V = s === "ratio" || s === "percent" ? "%" : "";
310
- return `${l ? "" : e < 0 ? "−" : "+"}${M}${V}`;
311
- }
312
- const it = E(() => {
313
- const e = x.value, l = A.value * 0.6, s = B.value.map((M, V) => {
314
- const L = b.value(M.total ? e : M.from), P = b.value(M.to), F = Z + V * A.value + (A.value - l) / 2;
315
- return {
316
- key: V,
317
- x: F,
318
- y: Math.min(L, P),
319
- width: l,
320
- height: Math.max(Math.abs(L - P), 1.5),
321
- total: M.total,
322
- figure: K(M.change, M.total),
323
- figureX: F + l / 2
324
- };
325
- }), w = t.hero && s.every((M) => M.figure.length * 6.5 <= A.value);
326
- return s.map((M) => ({ ...M, figure: w ? M.figure : "" }));
327
- }), gt = (e) => e.length * (t.hero ? 7.5 : 7), vt = E(() => {
328
- const e = t.cover;
329
- if ((e == null ? void 0 : e.kind) !== "line" && (e == null ? void 0 : e.kind) !== "bar") return [];
330
- const l = e.kind === "line", s = [], w = (e.marks ?? []).flatMap((M, V) => {
331
- var It;
332
- const L = (It = e.series[M.series]) == null ? void 0 : It.values[M.at];
333
- if (L == null || !l && M.series >= lt.value) return [];
334
- const P = l ? $(M.at) : mt(M.at, M.series) + et.value / 2, F = b.value(L), q = P > m.value * 0.8 ? "end" : P < m.value * 0.2 ? "start" : "middle", st = gt(M.label), at = q === "end" ? P - st : q === "start" ? P : P - st / 2, yt = !l && L < 0, nt = l ? Math.max(F - 12, 16) : yt ? F + 14 : F - 6, Bt = yt ? 14 : -14, Gt = (Mt) => Mt >= 12 && Mt <= d.value - c.value && !s.some((kt) => at < kt.x1 && at + st > kt.x0 && Math.abs(Mt - kt.y) < 14), Vt = [nt, nt + Bt, nt + Bt * 2], Dt = b.value(0) + (yt ? -6 : 14), H = (l ? t.hero ? [...Vt, F + 22, F + 36] : [nt] : [...t.hero ? Vt : [nt], Dt]).find(Gt);
335
- H !== void 0 && s.push({ x0: at, x1: at + st, y: H });
336
- const Pt = l ? 6 : 2, Ut = H === void 0 || H === nt || !l && H === Dt ? void 0 : H < F ? [F - Pt, H + 3] : [F + Pt, H - 11];
337
- return [
338
- {
339
- key: V,
340
- x: P,
341
- y: F,
342
- anchor: q,
343
- dot: l,
344
- labelY: H ?? 0,
345
- label: H === void 0 ? "" : M.label,
346
- leader: Ut
347
- }
348
- ];
349
- });
350
- return t.hero || w.every((M) => M.label) ? w : w.map((M) => ({ ...M, label: "", leader: void 0 }));
351
- });
352
- function G(e, l, s) {
353
- const w = (V) => V.length * 6.5 <= l;
354
- if (w(e)) return [e];
355
- if (!s) return;
356
- const M = e.split(" ");
357
- for (let V = M.length - 1; V > 0; V--) {
358
- const L = [M.slice(0, V).join(" "), M.slice(V).join(" ")];
359
- if (L.every(w)) return L;
360
- }
361
- }
362
- const ct = E(() => {
363
- const e = t.cover;
364
- if (!t.hero || !e || !g.value) return [];
365
- const l = e.kind !== "line", s = Math.ceil(e.x.length / ss), w = e.x.length - 1, M = (l ? A.value : R.value) * s, V = e.x.map((L, P) => ({
366
- x: l ? Z + P * A.value + A.value / 2 : $(P),
367
- lines: G(ie(e, P, o.value), M, l),
368
- marked: (e.marks ?? []).some((F) => F.at === P)
369
- })).filter((L, P) => (w - P) % s === 0);
370
- return V.every((L) => L.lines) ? V.map((L) => ({ ...L, lines: L.lines })) : [];
371
- }), Et = z([]);
372
- Ft(
373
- () => {
374
- var e;
375
- return (e = t.cover) == null ? void 0 : e.kind;
376
- },
377
- (e) => {
378
- e === "map" && Le().then((l) => Et.value = l);
379
- },
380
- { immediate: !0 }
381
- );
382
- const ht = E(
383
- () => t.cover && !g.value ? Pe(t.cover, { x0: Z, y0: 6, x1: m.value - Z, y1: d.value - c.value }, Et.value) : void 0
384
- ), Lt = `digest-cover-${Qt()}`, Wt = E(() => {
385
- if (!t.hero || !g.value) return [];
386
- const e = d.value - c.value;
387
- return [e, (e + ut) / 2, ut];
388
- });
389
- return (e, l) => (v(), k("div", {
390
- class: X(["digest-vis", { dark: e.dark, hero: e.hero }])
391
- }, [
392
- D("div", Ie, [
393
- D("span", Fe, [
394
- l[0] || (l[0] = D("svg", {
395
- width: "13",
396
- height: "13",
397
- viewBox: "0 0 24 24",
398
- fill: "none",
399
- stroke: "currentColor",
400
- "stroke-width": "2.4",
401
- "stroke-linecap": "round",
402
- "stroke-linejoin": "round",
403
- "aria-hidden": "true"
404
- }, [
405
- D("path", { d: "M4 17l5-5 4 4 7-7" }),
406
- D("path", { d: "M15 9h5v5" })
407
- ], -1)),
408
- ee(" " + O(T(n)("reportV5.digest.card.weekly")), 1)
409
- ]),
410
- te(e.$slots, "badge", {}, void 0, !0)
411
- ]),
412
- e.cover ? (v(), k("svg", {
413
- key: 0,
414
- ref_key: "chart",
415
- ref: r,
416
- "data-testid": "digest-cover",
417
- class: "digest-chart",
418
- viewBox: `0 0 ${m.value} ${d.value}`,
419
- width: "100%",
420
- height: e.hero ? 200 : 110,
421
- role: "img",
422
- "aria-label": p.value
423
- }, [
424
- (v(!0), k(C, null, N(Wt.value, (s) => (v(), k("line", {
425
- key: `grid-${s}`,
426
- x1: "0",
427
- x2: m.value,
428
- y1: s,
429
- y2: s,
430
- class: "grid"
431
- }, null, 8, Ce))), 128)),
432
- e.cover.kind === "line" ? (v(), k(C, { key: 0 }, [
433
- rt.value ? (v(), k("path", {
434
- key: 0,
435
- d: rt.value,
436
- class: "area"
437
- }, null, 8, Oe)) : I("", !0),
438
- (v(!0), k(C, null, N(ot.value.slice(1), (s, w) => (v(), k("path", {
439
- key: `base-${w}`,
440
- d: s,
441
- class: "baseline"
442
- }, null, 8, Re))), 128)),
443
- ot.value[0] ? (v(), k("path", {
444
- key: 1,
445
- d: ot.value[0],
446
- class: "line"
447
- }, null, 8, Te)) : I("", !0)
448
- ], 64)) : e.cover.kind === "waterfall" ? (v(!0), k(C, { key: 1 }, N(it.value, (s) => (v(), k(C, {
449
- key: s.key
450
- }, [
451
- D("rect", {
452
- x: s.x,
453
- y: s.y,
454
- width: s.width,
455
- height: s.height,
456
- rx: "2",
457
- class: X(["bar", s.total ? "total" : "step"])
458
- }, null, 10, qe),
459
- s.figure ? (v(), k("text", {
460
- key: 0,
461
- "data-testid": "digest-cover-figure",
462
- x: s.figureX,
463
- y: s.y - 5,
464
- "text-anchor": "middle",
465
- class: "figure"
466
- }, O(s.figure), 9, Ae)) : I("", !0)
467
- ], 64))), 128)) : e.cover.kind === "bar" ? (v(!0), k(C, { key: 2 }, N(_.value, (s) => (v(), k("rect", {
468
- key: s.key,
469
- x: s.x,
470
- y: s.y,
471
- width: s.width,
472
- height: s.height,
473
- rx: "2",
474
- class: X(["bar", { faint: s.faint, marked: s.marked, muted: s.muted }])
475
- }, null, 10, Ne))), 128)) : ht.value ? (v(), k(C, { key: 3 }, [
476
- D("clipPath", { id: Lt }, [
477
- D("rect", {
478
- x: "0",
479
- y: "0",
480
- width: m.value,
481
- height: d.value
482
- }, null, 8, ze)
483
- ]),
484
- D("g", {
485
- "clip-path": `url(#${Lt})`,
486
- "data-testid": "digest-cover-shapes",
487
- "data-kind": e.cover.kind
488
- }, [
489
- (v(!0), k(C, null, N(ht.value.paths, (s, w) => (v(), k("path", {
490
- key: `path-${w}`,
491
- d: s.d,
492
- opacity: s.opacity,
493
- class: X(["shape", s.tone, s.line ? `stroke ${s.line}` : "fill"])
494
- }, null, 10, Xe))), 128)),
495
- (v(!0), k(C, null, N(ht.value.rects, (s, w) => (v(), k("rect", {
496
- key: `rect-${w}`,
497
- x: s.x,
498
- y: s.y,
499
- width: s.width,
500
- height: s.height,
501
- opacity: s.opacity,
502
- rx: "1.5",
503
- class: X(["shape", "fill", s.tone])
504
- }, null, 10, Ye))), 128)),
505
- (v(!0), k(C, null, N(ht.value.circles, (s, w) => (v(), k("circle", {
506
- key: `circle-${w}`,
507
- cx: s.cx,
508
- cy: s.cy,
509
- r: s.r,
510
- opacity: s.opacity,
511
- class: X(["shape", "fill", "dot-mark", s.tone])
512
- }, null, 10, Ke))), 128))
513
- ], 8, He)
514
- ], 64)) : I("", !0),
515
- (v(!0), k(C, null, N(vt.value, (s) => (v(), k(C, {
516
- key: s.key
517
- }, [
518
- s.leader ? (v(), k("line", {
519
- key: 0,
520
- x1: s.x,
521
- x2: s.x,
522
- y1: s.leader[0],
523
- y2: s.leader[1],
524
- class: "leader"
525
- }, null, 8, Ze)) : I("", !0),
526
- s.dot ? (v(), k("circle", {
527
- key: 1,
528
- cx: s.x,
529
- cy: s.y,
530
- r: "5",
531
- class: "dot"
532
- }, null, 8, We)) : I("", !0),
533
- s.label ? (v(), k("text", {
534
- key: 2,
535
- "data-testid": "digest-cover-mark",
536
- x: s.x,
537
- y: s.labelY,
538
- "text-anchor": s.anchor,
539
- class: "mark"
540
- }, O(s.label), 9, Ge)) : I("", !0)
541
- ], 64))), 128)),
542
- (v(!0), k(C, null, N(ct.value, (s) => (v(), k("text", {
543
- key: s.x,
544
- x: s.x,
545
- "text-anchor": "middle",
546
- class: X(["tick", { marked: s.marked }])
547
- }, [
548
- (v(!0), k(C, null, N(s.lines, (w, M) => (v(), k("tspan", {
549
- key: M,
550
- x: s.x,
551
- y: d.value - 6 - (s.lines.length - 1 - M) * 12
552
- }, O(w), 9, Je))), 128))
553
- ], 10, Ue))), 128))
554
- ], 8, je)) : I("", !0),
555
- !e.cover && e.quote ? (v(), k("div", Qe, [
556
- l[1] || (l[1] = D("span", {
557
- class: "digest-quote-mark",
558
- "aria-hidden": "true"
559
- }, "“", -1)),
560
- D("p", ts, O(e.quote), 1)
561
- ])) : I("", !0),
562
- D("p", {
563
- class: "digest-take",
564
- title: h.value
565
- }, O(h.value), 9, es)
566
- ], 2));
567
- }
568
- }), ns = /* @__PURE__ */ bt(as, [["__scopeId", "data-v-7453d8bb"]]), os = {
569
- class: "digest-new",
570
- "data-testid": "digest-unread"
571
- }, rs = { class: "digest-card-body" }, ls = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, is = {
572
- class: "digest-headline",
573
- "data-testid": "digest-card-headline"
574
- }, cs = {
575
- key: 0,
576
- class: "digest-lead"
577
- }, us = {
578
- key: 1,
579
- class: "flex flex-col gap-8"
580
- }, ds = { class: "digest-story-number" }, hs = { class: "digest-card-foot" }, ps = {
581
- key: 0,
582
- class: "digest-read"
583
- }, fs = {
584
- key: 1,
585
- class: "digest-go",
586
- "aria-hidden": "true"
587
- }, ms = 3, gs = /* @__PURE__ */ $t({
588
- __name: "DigestListCard",
589
- props: {
590
- card: {},
591
- hero: { type: Boolean }
592
- },
593
- setup(a) {
594
- const t = a, { t: n, locale: o } = St(), { breakpoints: r } = Yt(), u = le(), i = E(() => t.hero && (r.value.lg || r.value.md)), m = E(
595
- () => Kt(t.card.weekStart, t.card.weekEnd, o.value)
596
- ), g = E(
597
- () => [
598
- t.card.stories.length ? n(
599
- "reportV5.digest.card.stories",
600
- { count: t.card.stories.length },
601
- t.card.stories.length
602
- ) : "",
603
- t.card.charts ? n("reportV5.digest.card.charts", { count: t.card.charts }, t.card.charts) : ""
604
- ].filter(Boolean).join(" · ")
605
- ), c = E(() => t.card.stories[0] ?? t.card.headline), d = E(() => ({
606
- name: "digestReader",
607
- params: { weekStart: t.card.weekStart },
608
- query: u.query
609
- }));
610
- return (h, p) => {
611
- const f = pt("RouterLink");
612
- return v(), dt(f, {
613
- to: d.value,
614
- class: X(["digest-card", { hero: h.hero }]),
615
- "data-testid": h.hero ? "digest-hero" : "digest-list-card",
616
- "data-week": h.card.weekStart
617
- }, {
618
- default: ft(() => [
619
- U(ns, {
620
- class: "digest-card-vis",
621
- cover: h.card.cover,
622
- quote: c.value,
623
- dark: h.hero || !h.card.read,
624
- hero: i.value
625
- }, se({ _: 2 }, [
626
- h.card.read ? void 0 : {
627
- name: "badge",
628
- fn: ft(() => [
629
- D("span", os, O(T(n)("reportV5.digest.card.new")), 1)
630
- ]),
631
- key: "0"
632
- }
633
- ]), 1032, ["cover", "quote", "dark", "hero"]),
634
- D("div", rs, [
635
- D("span", ls, O(m.value), 1),
636
- D("p", is, O(h.card.headline), 1),
637
- h.hero ? (v(), k(C, { key: 0 }, [
638
- h.card.lead ? (v(), k("p", cs, O(h.card.lead), 1)) : I("", !0),
639
- h.card.stories.length ? (v(), k("ol", us, [
640
- (v(!0), k(C, null, N(h.card.stories.slice(0, ms), (B, y) => (v(), k("li", {
641
- key: y,
642
- class: "digest-story"
643
- }, [
644
- D("span", ds, O(y + 1), 1),
645
- D("span", null, O(B), 1)
646
- ]))), 128))
647
- ])) : I("", !0)
648
- ], 64)) : I("", !0),
649
- D("div", hs, [
650
- h.hero ? (v(), k("span", ps, O(T(n)("reportV5.digest.card.read")), 1)) : I("", !0),
651
- D("span", {
652
- class: X(["fm-typo-en-body-md-400 text-fm-color-typo-secondary", { "ml-auto": h.hero }])
653
- }, O(g.value), 3),
654
- h.hero ? I("", !0) : (v(), k("span", fs, p[0] || (p[0] = [
655
- D("svg", {
656
- width: "16",
657
- height: "16",
658
- viewBox: "0 0 24 24",
659
- fill: "none",
660
- stroke: "currentColor",
661
- "stroke-width": "2.2",
662
- "stroke-linecap": "round",
663
- "stroke-linejoin": "round"
664
- }, [
665
- D("path", { d: "M5 12h14" }),
666
- D("path", { d: "M13 6l6 6-6 6" })
667
- ], -1)
668
- ])))
669
- ])
670
- ])
671
- ]),
672
- _: 1
673
- }, 8, ["to", "class", "data-testid", "data-week"]);
674
- };
675
- }
676
- }), Ht = /* @__PURE__ */ bt(gs, [["__scopeId", "data-v-3933c9b3"]]), vs = {
677
- key: 0,
678
- class: "flex flex-wrap items-center justify-end gap-8"
679
- }, ys = {
680
- class: "min-h-0 flex-1 overflow-y-auto pb-32",
681
- "data-testid": "digest-list"
682
- }, Ms = {
683
- key: 0,
684
- class: "fm-typo-en-body-sm-400 px-24 py-16 text-fm-color-typo-error",
685
- "data-testid": "digest-error"
686
- }, ks = {
687
- key: 1,
688
- class: "flex justify-center py-[80px]",
689
- "data-testid": "digest-loading"
690
- }, xs = {
691
- key: 0,
692
- class: "mx-24 mt-24 flex flex-col gap-12",
693
- "aria-labelledby": "digest-new-heading"
694
- }, _s = {
695
- id: "digest-new-heading",
696
- class: "fm-typo-en-title-sm-600"
697
- }, ws = {
698
- key: 1,
699
- class: "mx-24 mt-[40px] flex flex-col gap-12",
700
- "aria-labelledby": "digest-earlier-heading"
701
- }, $s = {
702
- id: "digest-earlier-heading",
703
- class: "fm-typo-en-title-sm-600"
704
- }, Ss = { class: "digest-grid" }, bs = {
705
- key: 2,
706
- class: "mt-24 flex justify-center"
707
- }, Xt = 5e3, Es = /* @__PURE__ */ $t({
708
- __name: "DigestListView",
709
- setup(a) {
710
- const { t: n, locale: o } = St(), { breakpoints: r } = Yt(), { isFeedmeAdmin: u } = me(), i = ge(), { subscription: m } = oe(i);
711
- ce();
712
- const g = z([]), c = z(), d = z(!0), h = z(!1), p = z(""), f = z(!1), B = z(), y = z("");
713
- let x;
714
- const b = (_) => _ instanceof Error ? _.message : String(_), j = (_) => _ instanceof ve && _.status === 403, R = E(() => g.value[0]), $ = E(() => g.value.slice(1)), Y = E(
715
- () => {
716
- var _;
717
- return (_ = m.value) != null && _.scheduled ? ue(de(/* @__PURE__ */ new Date()), o.value) : "";
718
- }
719
- ), ot = E(
720
- () => {
721
- var _, K;
722
- return ((_ = B.value) == null ? void 0 : _.status) === "requested" || ((K = B.value) == null ? void 0 : K.status) === "running";
723
- }
724
- ), rt = E(() => {
725
- const _ = B.value;
726
- if (!_) return "";
727
- const K = new Date(Date.parse(`${_.weekStart}T00:00:00Z`) + 6 * 864e5).toISOString().slice(0, 10), it = {
728
- week: Kt(_.weekStart, K, o.value),
729
- failure: (_.failure ?? "").split(`
730
- `)[0].slice(0, 160)
731
- };
732
- return n(`reportV5.digest.build.${_.status}`, it);
733
- });
734
- async function A() {
735
- d.value = !0, p.value = "";
736
- try {
737
- const _ = await Ct();
738
- g.value = _.digests, c.value = _.next;
739
- } catch (_) {
740
- j(_) ? f.value = !0 : p.value = b(_);
741
- } finally {
742
- d.value = !1;
743
- }
744
- }
745
- async function lt() {
746
- if (c.value) {
747
- h.value = !0;
748
- try {
749
- const _ = await Ct(c.value);
750
- g.value = [...g.value, ..._.digests], c.value = _.next;
751
- } catch (_) {
752
- p.value = b(_);
753
- } finally {
754
- h.value = !1;
755
- }
756
- }
757
- }
758
- ae(async () => {
759
- await Promise.all([
760
- A(),
761
- i.loadSubscription().catch((_) => {
762
- j(_) && (f.value = !0);
763
- })
764
- ]);
765
- });
766
- async function et() {
767
- const _ = B.value;
768
- if (_) {
769
- try {
770
- B.value = await Me(_.id);
771
- } catch (K) {
772
- y.value = b(K);
773
- return;
774
- }
775
- if (ot.value) {
776
- x = setTimeout(et, Xt);
777
- return;
778
- }
779
- B.value.status === "saved" && await A();
780
- }
781
- }
782
- async function mt() {
783
- y.value = "";
784
- try {
785
- B.value = (await ye()).run, x = setTimeout(et, Xt);
786
- } catch (_) {
787
- y.value = b(_);
788
- }
789
- }
790
- return ne(() => {
791
- x && clearTimeout(x);
792
- }), (_, K) => {
793
- const it = pt("FmButton"), gt = pt("FmPageHead"), vt = pt("FmCircularProgress");
794
- return v(), dt(re, null, {
795
- default: ft(() => [
796
- U(gt, {
797
- title: T(n)("reportV5.digest.title"),
798
- description: T(r).lg || T(r).md ? T(n)("reportV5.digest.subtitle") : "",
799
- class: "shrink-0"
800
- }, {
801
- append: ft(() => {
802
- var G, ct;
803
- return [
804
- f.value ? I("", !0) : (v(), k("div", vs, [
805
- rt.value || y.value ? (v(), k("span", {
806
- key: 0,
807
- class: X([
808
- "fm-typo-en-body-sm-400 max-w-[360px]",
809
- y.value || ((G = B.value) == null ? void 0 : G.status) === "failed" || ((ct = B.value) == null ? void 0 : ct.status) === "rejected" ? "text-fm-color-typo-error" : "text-fm-color-typo-secondary"
810
- ]),
811
- "data-testid": "digest-build-status"
812
- }, O(y.value || rt.value), 3)) : I("", !0),
813
- (T(u), I("", !0)),
814
- U(he)
815
- ]))
816
- ];
817
- }),
818
- _: 1
819
- }, 8, ["title", "description"]),
820
- D("div", ys, [
821
- f.value ? (v(), dt(jt, {
822
- key: 0,
823
- "data-testid": "digest-refused",
824
- title: T(n)("reportV5.digest.refusedTitle"),
825
- "sub-title": T(n)("reportV5.digest.refusedBody")
826
- }, null, 8, ["title", "sub-title"])) : (v(), k(C, { key: 1 }, [
827
- U(pe, {
828
- class: "mx-24",
829
- "next-digest": Y.value
830
- }, null, 8, ["next-digest"]),
831
- p.value ? (v(), k("p", Ms, O(p.value), 1)) : I("", !0),
832
- d.value && !g.value.length ? (v(), k("div", ks, [
833
- U(vt, { size: "xl" })
834
- ])) : I("", !0),
835
- !d.value && !p.value && !g.value.length ? (v(), dt(jt, {
836
- key: 2,
837
- title: T(n)("reportV5.digest.emptyTitle"),
838
- "sub-title": T(n)("reportV5.digest.emptyBody")
839
- }, null, 8, ["title", "sub-title"])) : g.value.length ? (v(), k(C, { key: 3 }, [
840
- R.value ? (v(), k("section", xs, [
841
- D("h2", _s, O(T(n)(R.value.read ? "reportV5.digest.latest" : "reportV5.digest.newForYou")), 1),
842
- U(Ht, {
843
- card: R.value,
844
- hero: ""
845
- }, null, 8, ["card"])
846
- ])) : I("", !0),
847
- $.value.length ? (v(), k("section", ws, [
848
- D("h2", $s, O(T(n)("reportV5.digest.earlier")), 1),
849
- D("div", Ss, [
850
- (v(!0), k(C, null, N($.value, (G) => (v(), dt(Ht, {
851
- key: G.weekStart,
852
- card: G
853
- }, null, 8, ["card"]))), 128))
854
- ])
855
- ])) : I("", !0),
856
- c.value ? (v(), k("div", bs, [
857
- U(it, {
858
- "data-testid": "digest-show-more",
859
- variant: "secondary",
860
- label: T(n)("reportV5.digest.showMore"),
861
- disabled: h.value,
862
- onClick: lt
863
- }, null, 8, ["label", "disabled"])
864
- ])) : I("", !0)
865
- ], 64)) : I("", !0)
866
- ], 64))
867
- ])
868
- ]),
869
- _: 1
870
- });
871
- };
872
- }
873
- }), qs = /* @__PURE__ */ bt(Es, [["__scopeId", "data-v-c6c1bc71"]]);
874
- export {
875
- qs as default
876
- };