@feedmepos/mf-report 5.31.3 → 5.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/{App-CAzuIycx.js → App-DmCGLjX7.js} +99 -99
  2. package/dist/{DateRangeSelect-kBTiWzl8.js → DateRangeSelect-ByNkTDjz.js} +18 -18
  3. package/dist/{Default.vue_vue_type_script_setup_true_lang-QJJFd-aD.js → Default.vue_vue_type_script_setup_true_lang-B0KI2grl.js} +1 -1
  4. package/dist/DigestListView-De9tIPMS.js +637 -0
  5. package/dist/DigestReaderView-DO_nmqE8.js +507 -0
  6. package/dist/{DynamicWidget.vue_vue_type_script_setup_true_lang-dhMaJAWF.js → DynamicWidget.vue_vue_type_script_setup_true_lang-BCrF_c93.js} +173 -173
  7. package/dist/{GlobalFilterSelect.vue_vue_type_script_setup_true_lang-Odt_cfjt.js → GlobalFilterSelect.vue_vue_type_script_setup_true_lang-CqSpNI7C.js} +154 -154
  8. package/dist/{InsightView-CoyqETUU.js → InsightView-C-CwTtk_.js} +16 -16
  9. package/dist/{Integration-nK20FSKv.js → Integration-BRNvT1Bi.js} +3 -3
  10. package/dist/{Integrations-B2zhjy-7.js → Integrations-apd0BYi4.js} +2 -2
  11. package/dist/{Layout-Dl7UP2Mh.js → Layout-CAcG75jm.js} +1 -1
  12. package/dist/{LocationSelect.vue_vue_type_script_setup_true_lang-DroCP4X4.js → LocationSelect.vue_vue_type_script_setup_true_lang-D77iP1So.js} +2 -2
  13. package/dist/{MenuTab.vue_vue_type_script_setup_true_lang-Es9KEHbl.js → MenuTab.vue_vue_type_script_setup_true_lang-0FI-8jfq.js} +9 -9
  14. package/dist/{NavigationTab.vue_vue_type_script_setup_true_lang-BohRRfew.js → NavigationTab.vue_vue_type_script_setup_true_lang-caeBZJMd.js} +6 -6
  15. package/dist/{OverviewView-_5c2H2MT.js → OverviewView-DT4wH9BY.js} +5 -5
  16. package/dist/{Report-2w23PAp1.js → Report-DC5SaVnn.js} +30 -30
  17. package/dist/ReportCanvasView-DKSSW9vS.js +966 -0
  18. package/dist/{ReportEditor-Bd6WesQn.js → ReportEditor-pv17FE6d.js} +7 -7
  19. package/dist/{ReportView-DlYt2nTi.js → ReportView-hu8o7gHa.js} +6 -6
  20. package/dist/{ReportViewRoute-37OLAHAq.js → ReportViewRoute-Dv72tGDa.js} +2 -2
  21. package/dist/{Setting-PmW3vgf2.js → Setting-B98DTITn.js} +3 -3
  22. package/dist/{Template-DkTDUZL3.js → Template-CaVg_yFH.js} +18 -18
  23. package/dist/{TileEditor-B_X1Z1IF.js → TileEditor-HXcsJvnS.js} +6 -6
  24. package/dist/{TilePageStack.vue_vue_type_script_setup_true_lang-Dj9ImYdH.js → TilePageStack.vue_vue_type_script_setup_true_lang-B9kTXx-f.js} +2 -2
  25. package/dist/{TransitionFade-k7vzRKon.js → TransitionFade-CIv_c2SU.js} +5 -5
  26. package/dist/{app-DOyssexi.js → app-DvNjldW6.js} +3354 -2967
  27. package/dist/app.js +4 -4
  28. package/dist/assets/{formatChartData.worker-R9EGYsk6.js → formatChartData.worker-BprlZnJs.js} +80 -58
  29. package/dist/assets/{processTableData.worker-CxpDa0tB.js → processTableData.worker-D5GSFMnH.js} +83 -61
  30. package/dist/{currency-Dzf-h7uE.js → currency-DkfeAufo.js} +1 -1
  31. package/dist/{index-uhMfapU4.js → index-BfS1DQsO.js} +1279 -1244
  32. package/dist/{report-D1hOlAxl.js → report-BYoPJJLO.js} +18 -18
  33. package/dist/report-canvas-libs/components-1.js +1126 -71
  34. package/dist/report-canvas-libs/geo-outlines-1.js +1 -1
  35. package/dist/style.css +1 -1
  36. package/dist/useDigestFont-qj5lGRy-.js +205 -0
  37. package/dist/{ReportCanvasView-C0WPmew5.js → useReportCanvasPanel-BJTLOzd9.js} +2933 -3477
  38. package/dist/{useRestaurantPermission-DdscVgP6.js → useRestaurantPermission-Cy0Wr066.js} +1 -1
  39. package/package.json +1 -1
@@ -0,0 +1,637 @@
1
+ import { defineComponent as ve, ref as C, watch as Le, onBeforeUnmount as Ce, computed as u, createElementBlock as r, openBlock as o, normalizeClass as H, createElementVNode as v, createCommentVNode as m, renderSlot as Re, createTextVNode as Te, toDisplayString as y, unref as x, Fragment as w, renderList as q, resolveComponent as he, createBlock as oe, withCtx as le, createVNode as Z, createSlots as Ee, onMounted as je, onUnmounted as qe } from "vue";
2
+ import { storeToRefs as Ie } from "pinia";
3
+ import { useI18n as fe } from "@feedmepos/mf-common";
4
+ import { useBreakpoints as Se } from "@feedmepos/ui-library";
5
+ import { _ as Oe } from "./Default.vue_vue_type_script_setup_true_lang-B0KI2grl.js";
6
+ import { _ as we } from "./SelectComponent.vue_vue_type_script_setup_true_lang-DW7Dk7iQ.js";
7
+ import { useRoute as Ne } from "vue-router";
8
+ import { c as Pe, d as Be, u as Ae, a as He, n as Xe, _ as ze, D as Ye } from "./useDigestFont-qj5lGRy-.js";
9
+ import { _ as ge } from "./_plugin-vue_export-helper-C6QDExPN.js";
10
+ import { g as Ue, f as We, A as Ze, k as be, r as Ge, l as Ke } from "./app-DvNjldW6.js";
11
+ const Je = { class: "flex items-center justify-between gap-8" }, Qe = { class: "digest-kind" }, et = ["viewBox", "height", "aria-label"], tt = ["x2", "y1", "y2"], st = ["d"], at = ["d"], ot = ["d"], nt = ["x", "y", "width", "height"], rt = ["x", "y"], lt = ["x", "y", "width", "height"], it = ["x1", "x2", "y1", "y2"], ut = ["cx", "cy"], dt = ["x", "y", "text-anchor"], ct = ["x"], ht = ["x", "y"], vt = {
12
+ key: 1,
13
+ class: "flex items-start gap-8",
14
+ "data-testid": "digest-cover-quote"
15
+ }, ft = { class: "digest-quote" }, gt = ["title"], ae = 28, W = 12, mt = 12, pt = /* @__PURE__ */ ve({
16
+ __name: "DigestCover",
17
+ props: {
18
+ cover: {},
19
+ quote: {},
20
+ dark: { type: Boolean },
21
+ hero: { type: Boolean }
22
+ },
23
+ setup(ne) {
24
+ const n = ne, { t: p, locale: N } = fe(), I = C(), P = C(0);
25
+ let M;
26
+ Le(I, (e) => {
27
+ M == null || M.disconnect(), !(!e || typeof ResizeObserver > "u") && (M = new ResizeObserver(([s]) => {
28
+ const { width: t, height: i } = s.contentRect;
29
+ t && (P.value = i / t);
30
+ }), M.observe(e));
31
+ }), Ce(() => M == null ? void 0 : M.disconnect());
32
+ const B = u(() => n.hero ? 520 : 340), _ = u(
33
+ () => n.hero ? 26 + (se.value.some((e) => e.lines.length > 1) ? 12 : 0) : 6
34
+ ), k = u(
35
+ () => P.value ? Math.max(ae + _.value + 40, Math.round(B.value * P.value)) : n.hero ? 168 : 110
36
+ ), O = u(() => {
37
+ const e = n.cover;
38
+ return e ? [e.title, e.takeaway].filter(Boolean).join(" · ") : p("reportV5.digest.card.leadStory");
39
+ }), f = u(
40
+ () => {
41
+ var e, s;
42
+ return [(e = n.cover) == null ? void 0 : e.title, ...(((s = n.cover) == null ? void 0 : s.marks) ?? []).map((t) => t.label)].filter(Boolean).join(" · ");
43
+ }
44
+ ), F = u(
45
+ () => {
46
+ var e;
47
+ return (((e = n.cover) == null ? void 0 : e.series) ?? []).flatMap((s) => s.values).filter((s) => s !== null);
48
+ }
49
+ ), R = u(() => {
50
+ var i;
51
+ const e = n.cover;
52
+ if ((e == null ? void 0 : e.kind) !== "waterfall") return [];
53
+ const s = ((i = e.series[0]) == null ? void 0 : i.values) ?? [];
54
+ let t = 0;
55
+ return s.map((a, c) => {
56
+ const d = a ?? 0, h = c === 0 || c === s.length - 1, g = h ? 0 : t;
57
+ return t = h ? d : t + d, { from: g, to: t, change: d, total: h };
58
+ });
59
+ }), b = u(
60
+ () => R.value.flatMap((e) => e.total ? [e.to] : [e.from, e.to])
61
+ ), V = u(() => {
62
+ const e = b.value;
63
+ if (!e.length) return 0;
64
+ const s = Math.min(...e), t = Math.max(...e);
65
+ return !(s > 0) || s === t || (t - s) * 4 >= t ? 0 : s - (t - s);
66
+ }), D = u(() => {
67
+ var h, g;
68
+ const e = k.value - ae - _.value, s = ($, z) => (Y) => ae + e - (Y - $) / (z - $ || 1) * e;
69
+ if (((h = n.cover) == null ? void 0 : h.kind) === "waterfall") {
70
+ const $ = b.value;
71
+ return $.length ? s(Math.min(V.value, ...$), Math.max(...$)) : s(0, 1);
72
+ }
73
+ const t = F.value;
74
+ if (!t.length) return ($) => k.value - _.value;
75
+ const i = ((g = n.cover) == null ? void 0 : g.kind) === "bar", a = i ? Math.min(0, ...t) : Math.min(...t), c = Math.max(...t), d = c - a || Math.abs(c) || 1;
76
+ return i ? s(a, c) : s(a - d * 0.15, c + d * 0.05);
77
+ }), T = u(() => {
78
+ var e;
79
+ return ((e = n.cover) == null ? void 0 : e.x.length) ?? 0;
80
+ }), G = u(() => T.value > 1 ? (B.value - W * 2) / (T.value - 1) : 0), E = (e) => T.value > 1 ? W + e * G.value : B.value / 2;
81
+ function K(e) {
82
+ let s = "M";
83
+ return e.map((t, i) => {
84
+ if (t === null)
85
+ return s = "M", "";
86
+ const a = `${s}${E(i).toFixed(1)},${D.value(t).toFixed(1)}`;
87
+ return s = "L", a;
88
+ }).join(" ");
89
+ }
90
+ const J = u(
91
+ () => {
92
+ var e;
93
+ return ((e = n.cover) == null ? void 0 : e.kind) === "line" ? n.cover.series.map((s) => K(s.values)) : [];
94
+ }
95
+ ), re = u(() => {
96
+ var t, i;
97
+ const e = ((t = n.cover) == null ? void 0 : t.kind) === "line" ? (i = n.cover.series[0]) == null ? void 0 : i.values : void 0;
98
+ if (!e || e.some((a) => a === null) || e.length < 2) return "";
99
+ const s = (k.value - _.value).toFixed(1);
100
+ return `${K(e)} L${E(e.length - 1).toFixed(1)},${s} L${E(0).toFixed(1)},${s} Z`;
101
+ }), S = u(() => (B.value - W * 2) / Math.max(T.value, 1)), X = u(() => {
102
+ var e;
103
+ return Math.min(((e = n.cover) == null ? void 0 : e.series.length) ?? 0, 2);
104
+ }), Q = u(() => S.value * 0.72 / Math.max(X.value, 1)), ee = (e, s) => W + e * S.value + S.value * 0.14 + s * Q.value, me = u(() => {
105
+ const e = n.cover;
106
+ if ((e == null ? void 0 : e.kind) !== "bar") return [];
107
+ const s = D.value(0), t = e.marks ?? [];
108
+ return e.series.slice(0, X.value).flatMap(
109
+ (i, a) => i.values.map((c, d) => {
110
+ const h = c === null ? s : D.value(c), g = t.some(($) => $.at === d && $.series === a);
111
+ return {
112
+ key: `${a}-${d}`,
113
+ x: ee(d, a),
114
+ y: Math.min(h, s),
115
+ width: Math.max(Q.value - 1.5, 1.5),
116
+ height: Math.max(Math.abs(s - h), c === null ? 0 : 1.5),
117
+ faint: a > 0,
118
+ marked: g,
119
+ // a noted bar stands out against the bars it is compared with
120
+ muted: t.length > 0 && !g && a === 0
121
+ };
122
+ })
123
+ );
124
+ });
125
+ function l(e, s) {
126
+ var d;
127
+ const t = (d = n.cover) == null ? void 0 : d.format, i = Math.abs(t === "ratio" ? e * 100 : e), a = new Intl.NumberFormat(N.value, {
128
+ maximumFractionDigits: i >= 100 ? 0 : 1
129
+ }).format(i), c = t === "ratio" || t === "percent" ? "%" : "";
130
+ return `${s ? "" : e < 0 ? "−" : "+"}${a}${c}`;
131
+ }
132
+ const j = u(() => {
133
+ const e = V.value, s = S.value * 0.6, t = R.value.map((a, c) => {
134
+ const d = D.value(a.total ? e : a.from), h = D.value(a.to), g = W + c * S.value + (S.value - s) / 2;
135
+ return {
136
+ key: c,
137
+ x: g,
138
+ y: Math.min(d, h),
139
+ width: s,
140
+ height: Math.max(Math.abs(d - h), 1.5),
141
+ total: a.total,
142
+ figure: l(a.change, a.total),
143
+ figureX: g + s / 2
144
+ };
145
+ }), i = n.hero && t.every((a) => a.figure.length * 6.5 <= S.value);
146
+ return t.map((a) => ({ ...a, figure: i ? a.figure : "" }));
147
+ }), te = (e) => e.length * (n.hero ? 7.5 : 7), ie = u(() => {
148
+ const e = n.cover;
149
+ if ((e == null ? void 0 : e.kind) !== "line" && (e == null ? void 0 : e.kind) !== "bar") return [];
150
+ const s = e.kind === "line", t = [], i = (e.marks ?? []).flatMap((a, c) => {
151
+ var xe;
152
+ const d = (xe = e.series[a.series]) == null ? void 0 : xe.values[a.at];
153
+ if (d == null || !s && a.series >= X.value) return [];
154
+ const h = s ? E(a.at) : ee(a.at, a.series) + Q.value / 2, g = D.value(d), $ = h > B.value * 0.8 ? "end" : h < B.value * 0.2 ? "start" : "middle", z = te(a.label), Y = $ === "end" ? h - z : $ === "start" ? h : h - z / 2, ue = !s && d < 0, U = s ? Math.max(g - 12, 16) : ue ? g + 14 : g - 6, pe = ue ? 14 : -14, De = (de) => de >= 12 && de <= k.value - _.value && !t.some((ce) => Y < ce.x1 && Y + z > ce.x0 && Math.abs(de - ce.y) < 14), ye = [U, U + pe, U + pe * 2], _e = D.value(0) + (ue ? -6 : 14), L = (s ? n.hero ? [...ye, g + 22, g + 36] : [U] : [...n.hero ? ye : [U], _e]).find(De);
155
+ L !== void 0 && t.push({ x0: Y, x1: Y + z, y: L });
156
+ const ke = s ? 6 : 2, Fe = L === void 0 || L === U || !s && L === _e ? void 0 : L < g ? [g - ke, L + 3] : [g + ke, L - 11];
157
+ return [
158
+ {
159
+ key: c,
160
+ x: h,
161
+ y: g,
162
+ anchor: $,
163
+ dot: s,
164
+ labelY: L ?? 0,
165
+ label: L === void 0 ? "" : a.label,
166
+ leader: Fe
167
+ }
168
+ ];
169
+ });
170
+ return n.hero || i.every((a) => a.label) ? i : i.map((a) => ({ ...a, label: "", leader: void 0 }));
171
+ });
172
+ function A(e, s, t) {
173
+ const i = (c) => c.length * 6.5 <= s;
174
+ if (i(e)) return [e];
175
+ if (!t) return;
176
+ const a = e.split(" ");
177
+ for (let c = a.length - 1; c > 0; c--) {
178
+ const d = [a.slice(0, c).join(" "), a.slice(c).join(" ")];
179
+ if (d.every(i)) return d;
180
+ }
181
+ }
182
+ const se = u(() => {
183
+ const e = n.cover;
184
+ if (!n.hero || !e) return [];
185
+ const s = e.kind !== "line", t = Math.ceil(e.x.length / mt), i = e.x.length - 1, a = (s ? S.value : G.value) * t, c = e.x.map((d, h) => ({
186
+ x: s ? W + h * S.value + S.value / 2 : E(h),
187
+ lines: A(Pe(e, h, N.value), a, s),
188
+ marked: (e.marks ?? []).some((g) => g.at === h)
189
+ })).filter((d, h) => (i - h) % t === 0);
190
+ return c.every((d) => d.lines) ? c.map((d) => ({ ...d, lines: d.lines })) : [];
191
+ }), Ve = u(() => {
192
+ if (!n.hero) return [];
193
+ const e = k.value - _.value;
194
+ return [e, (e + ae) / 2, ae];
195
+ });
196
+ return (e, s) => (o(), r("div", {
197
+ class: H(["digest-vis", { dark: e.dark, hero: e.hero }])
198
+ }, [
199
+ v("div", Je, [
200
+ v("span", Qe, [
201
+ s[0] || (s[0] = v("svg", {
202
+ width: "13",
203
+ height: "13",
204
+ viewBox: "0 0 24 24",
205
+ fill: "none",
206
+ stroke: "currentColor",
207
+ "stroke-width": "2.4",
208
+ "stroke-linecap": "round",
209
+ "stroke-linejoin": "round",
210
+ "aria-hidden": "true"
211
+ }, [
212
+ v("path", { d: "M4 17l5-5 4 4 7-7" }),
213
+ v("path", { d: "M15 9h5v5" })
214
+ ], -1)),
215
+ Te(" " + y(x(p)("reportV5.digest.card.weekly")), 1)
216
+ ]),
217
+ Re(e.$slots, "badge", {}, void 0, !0)
218
+ ]),
219
+ e.cover ? (o(), r("svg", {
220
+ key: 0,
221
+ ref_key: "chart",
222
+ ref: I,
223
+ "data-testid": "digest-cover",
224
+ class: "digest-chart",
225
+ viewBox: `0 0 ${B.value} ${k.value}`,
226
+ width: "100%",
227
+ height: e.hero ? 200 : 110,
228
+ role: "img",
229
+ "aria-label": f.value
230
+ }, [
231
+ (o(!0), r(w, null, q(Ve.value, (t) => (o(), r("line", {
232
+ key: `grid-${t}`,
233
+ x1: "0",
234
+ x2: B.value,
235
+ y1: t,
236
+ y2: t,
237
+ class: "grid"
238
+ }, null, 8, tt))), 128)),
239
+ e.cover.kind === "line" ? (o(), r(w, { key: 0 }, [
240
+ re.value ? (o(), r("path", {
241
+ key: 0,
242
+ d: re.value,
243
+ class: "area"
244
+ }, null, 8, st)) : m("", !0),
245
+ (o(!0), r(w, null, q(J.value.slice(1), (t, i) => (o(), r("path", {
246
+ key: `base-${i}`,
247
+ d: t,
248
+ class: "baseline"
249
+ }, null, 8, at))), 128)),
250
+ J.value[0] ? (o(), r("path", {
251
+ key: 1,
252
+ d: J.value[0],
253
+ class: "line"
254
+ }, null, 8, ot)) : m("", !0)
255
+ ], 64)) : e.cover.kind === "waterfall" ? (o(!0), r(w, { key: 1 }, q(j.value, (t) => (o(), r(w, {
256
+ key: t.key
257
+ }, [
258
+ v("rect", {
259
+ x: t.x,
260
+ y: t.y,
261
+ width: t.width,
262
+ height: t.height,
263
+ rx: "2",
264
+ class: H(["bar", t.total ? "total" : "step"])
265
+ }, null, 10, nt),
266
+ t.figure ? (o(), r("text", {
267
+ key: 0,
268
+ "data-testid": "digest-cover-figure",
269
+ x: t.figureX,
270
+ y: t.y - 5,
271
+ "text-anchor": "middle",
272
+ class: "figure"
273
+ }, y(t.figure), 9, rt)) : m("", !0)
274
+ ], 64))), 128)) : (o(!0), r(w, { key: 2 }, q(me.value, (t) => (o(), r("rect", {
275
+ key: t.key,
276
+ x: t.x,
277
+ y: t.y,
278
+ width: t.width,
279
+ height: t.height,
280
+ rx: "2",
281
+ class: H(["bar", { faint: t.faint, marked: t.marked, muted: t.muted }])
282
+ }, null, 10, lt))), 128)),
283
+ (o(!0), r(w, null, q(ie.value, (t) => (o(), r(w, {
284
+ key: t.key
285
+ }, [
286
+ t.leader ? (o(), r("line", {
287
+ key: 0,
288
+ x1: t.x,
289
+ x2: t.x,
290
+ y1: t.leader[0],
291
+ y2: t.leader[1],
292
+ class: "leader"
293
+ }, null, 8, it)) : m("", !0),
294
+ t.dot ? (o(), r("circle", {
295
+ key: 1,
296
+ cx: t.x,
297
+ cy: t.y,
298
+ r: "5",
299
+ class: "dot"
300
+ }, null, 8, ut)) : m("", !0),
301
+ t.label ? (o(), r("text", {
302
+ key: 2,
303
+ "data-testid": "digest-cover-mark",
304
+ x: t.x,
305
+ y: t.labelY,
306
+ "text-anchor": t.anchor,
307
+ class: "mark"
308
+ }, y(t.label), 9, dt)) : m("", !0)
309
+ ], 64))), 128)),
310
+ (o(!0), r(w, null, q(se.value, (t) => (o(), r("text", {
311
+ key: t.x,
312
+ x: t.x,
313
+ "text-anchor": "middle",
314
+ class: H(["tick", { marked: t.marked }])
315
+ }, [
316
+ (o(!0), r(w, null, q(t.lines, (i, a) => (o(), r("tspan", {
317
+ key: a,
318
+ x: t.x,
319
+ y: k.value - 6 - (t.lines.length - 1 - a) * 12
320
+ }, y(i), 9, ht))), 128))
321
+ ], 10, ct))), 128))
322
+ ], 8, et)) : m("", !0),
323
+ !e.cover && e.quote ? (o(), r("div", vt, [
324
+ s[1] || (s[1] = v("span", {
325
+ class: "digest-quote-mark",
326
+ "aria-hidden": "true"
327
+ }, "“", -1)),
328
+ v("p", ft, y(e.quote), 1)
329
+ ])) : m("", !0),
330
+ v("p", {
331
+ class: "digest-take",
332
+ title: O.value
333
+ }, y(O.value), 9, gt)
334
+ ], 2));
335
+ }
336
+ }), yt = /* @__PURE__ */ ge(pt, [["__scopeId", "data-v-fe5a40c9"]]), _t = {
337
+ class: "digest-new",
338
+ "data-testid": "digest-unread"
339
+ }, kt = { class: "digest-card-body" }, xt = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, wt = {
340
+ class: "digest-headline",
341
+ "data-testid": "digest-card-headline"
342
+ }, bt = {
343
+ key: 0,
344
+ class: "digest-lead"
345
+ }, $t = {
346
+ key: 1,
347
+ class: "flex flex-col gap-8"
348
+ }, Mt = { class: "digest-story-number" }, St = { class: "digest-card-foot" }, Bt = {
349
+ key: 0,
350
+ class: "digest-read"
351
+ }, Vt = {
352
+ key: 1,
353
+ class: "digest-go",
354
+ "aria-hidden": "true"
355
+ }, Dt = 3, Ft = /* @__PURE__ */ ve({
356
+ __name: "DigestListCard",
357
+ props: {
358
+ card: {},
359
+ hero: { type: Boolean }
360
+ },
361
+ setup(ne) {
362
+ const n = ne, { t: p, locale: N } = fe(), { breakpoints: I } = Se(), P = Ne(), M = u(() => n.hero && (I.value.lg || I.value.md)), B = u(
363
+ () => Be(n.card.weekStart, n.card.weekEnd, N.value)
364
+ ), _ = u(
365
+ () => [
366
+ n.card.stories.length ? p(
367
+ "reportV5.digest.card.stories",
368
+ { count: n.card.stories.length },
369
+ n.card.stories.length
370
+ ) : "",
371
+ n.card.charts ? p("reportV5.digest.card.charts", { count: n.card.charts }, n.card.charts) : ""
372
+ ].filter(Boolean).join(" · ")
373
+ ), k = u(() => n.card.stories[0] ?? n.card.headline), O = u(() => ({
374
+ name: "digestReader",
375
+ params: { weekStart: n.card.weekStart },
376
+ query: P.query
377
+ }));
378
+ return (f, F) => {
379
+ const R = he("RouterLink");
380
+ return o(), oe(R, {
381
+ to: O.value,
382
+ class: H(["digest-card", { hero: f.hero }]),
383
+ "data-testid": f.hero ? "digest-hero" : "digest-list-card",
384
+ "data-week": f.card.weekStart
385
+ }, {
386
+ default: le(() => [
387
+ Z(yt, {
388
+ class: "digest-card-vis",
389
+ cover: f.card.cover,
390
+ quote: k.value,
391
+ dark: f.hero || !f.card.read,
392
+ hero: M.value
393
+ }, Ee({ _: 2 }, [
394
+ f.card.read ? void 0 : {
395
+ name: "badge",
396
+ fn: le(() => [
397
+ v("span", _t, y(x(p)("reportV5.digest.card.new")), 1)
398
+ ]),
399
+ key: "0"
400
+ }
401
+ ]), 1032, ["cover", "quote", "dark", "hero"]),
402
+ v("div", kt, [
403
+ v("span", xt, y(B.value), 1),
404
+ v("p", wt, y(f.card.headline), 1),
405
+ f.hero ? (o(), r(w, { key: 0 }, [
406
+ f.card.lead ? (o(), r("p", bt, y(f.card.lead), 1)) : m("", !0),
407
+ f.card.stories.length ? (o(), r("ol", $t, [
408
+ (o(!0), r(w, null, q(f.card.stories.slice(0, Dt), (b, V) => (o(), r("li", {
409
+ key: V,
410
+ class: "digest-story"
411
+ }, [
412
+ v("span", Mt, y(V + 1), 1),
413
+ v("span", null, y(b), 1)
414
+ ]))), 128))
415
+ ])) : m("", !0)
416
+ ], 64)) : m("", !0),
417
+ v("div", St, [
418
+ f.hero ? (o(), r("span", Bt, y(x(p)("reportV5.digest.card.read")), 1)) : m("", !0),
419
+ v("span", {
420
+ class: H(["fm-typo-en-body-md-400 text-fm-color-typo-secondary", { "ml-auto": f.hero }])
421
+ }, y(_.value), 3),
422
+ f.hero ? m("", !0) : (o(), r("span", Vt, F[0] || (F[0] = [
423
+ v("svg", {
424
+ width: "16",
425
+ height: "16",
426
+ viewBox: "0 0 24 24",
427
+ fill: "none",
428
+ stroke: "currentColor",
429
+ "stroke-width": "2.2",
430
+ "stroke-linecap": "round",
431
+ "stroke-linejoin": "round"
432
+ }, [
433
+ v("path", { d: "M5 12h14" }),
434
+ v("path", { d: "M13 6l6 6-6 6" })
435
+ ], -1)
436
+ ])))
437
+ ])
438
+ ])
439
+ ]),
440
+ _: 1
441
+ }, 8, ["to", "class", "data-testid", "data-week"]);
442
+ };
443
+ }
444
+ }), $e = /* @__PURE__ */ ge(Ft, [["__scopeId", "data-v-3933c9b3"]]), Lt = {
445
+ key: 0,
446
+ class: "flex flex-wrap items-center justify-end gap-8"
447
+ }, Ct = {
448
+ class: "min-h-0 flex-1 overflow-y-auto pb-32",
449
+ "data-testid": "digest-list"
450
+ }, Rt = {
451
+ key: 0,
452
+ class: "fm-typo-en-body-sm-400 px-24 py-16 text-fm-color-typo-error",
453
+ "data-testid": "digest-error"
454
+ }, Tt = {
455
+ key: 0,
456
+ class: "mx-24 mt-24 flex flex-col gap-12",
457
+ "aria-labelledby": "digest-new-heading"
458
+ }, Et = {
459
+ id: "digest-new-heading",
460
+ class: "fm-typo-en-title-sm-600"
461
+ }, jt = {
462
+ key: 1,
463
+ class: "mx-24 mt-[40px] flex flex-col gap-12",
464
+ "aria-labelledby": "digest-earlier-heading"
465
+ }, qt = {
466
+ id: "digest-earlier-heading",
467
+ class: "fm-typo-en-title-sm-600"
468
+ }, It = { class: "digest-grid" }, Ot = {
469
+ key: 2,
470
+ class: "mt-24 flex justify-center"
471
+ }, Me = 5e3, Nt = /* @__PURE__ */ ve({
472
+ __name: "DigestListView",
473
+ setup(ne) {
474
+ const { t: p, locale: N } = fe(), { breakpoints: I } = Se(), { isFeedmeAdmin: P } = Ue(), M = We(), { subscription: B } = Ie(M);
475
+ Ae();
476
+ const _ = C([]), k = C(), O = C(!0), f = C(!1), F = C(""), R = C(!1), b = C(), V = C("");
477
+ let D;
478
+ const T = (l) => l instanceof Error ? l.message : String(l), G = (l) => l instanceof Ze && l.status === 403, E = u(() => _.value[0]), K = u(() => _.value.slice(1)), J = u(
479
+ () => {
480
+ var l;
481
+ return (l = B.value) != null && l.scheduled ? He(Xe(/* @__PURE__ */ new Date()), N.value) : "";
482
+ }
483
+ ), re = u(
484
+ () => {
485
+ var l, j;
486
+ return ((l = b.value) == null ? void 0 : l.status) === "requested" || ((j = b.value) == null ? void 0 : j.status) === "running";
487
+ }
488
+ ), S = u(() => {
489
+ const l = b.value;
490
+ if (!l) return "";
491
+ const j = new Date(Date.parse(`${l.weekStart}T00:00:00Z`) + 6 * 864e5).toISOString().slice(0, 10), te = {
492
+ week: Be(l.weekStart, j, N.value),
493
+ failure: (l.failure ?? "").split(`
494
+ `)[0].slice(0, 160)
495
+ };
496
+ return p(`reportV5.digest.build.${l.status}`, te);
497
+ });
498
+ async function X() {
499
+ O.value = !0, F.value = "";
500
+ try {
501
+ const l = await be();
502
+ _.value = l.digests, k.value = l.next;
503
+ } catch (l) {
504
+ G(l) ? R.value = !0 : F.value = T(l);
505
+ } finally {
506
+ O.value = !1;
507
+ }
508
+ }
509
+ async function Q() {
510
+ if (k.value) {
511
+ f.value = !0;
512
+ try {
513
+ const l = await be(k.value);
514
+ _.value = [..._.value, ...l.digests], k.value = l.next;
515
+ } catch (l) {
516
+ F.value = T(l);
517
+ } finally {
518
+ f.value = !1;
519
+ }
520
+ }
521
+ }
522
+ je(async () => {
523
+ await Promise.all([
524
+ X(),
525
+ M.loadSubscription().catch((l) => {
526
+ G(l) && (R.value = !0);
527
+ })
528
+ ]);
529
+ });
530
+ async function ee() {
531
+ const l = b.value;
532
+ if (l) {
533
+ try {
534
+ b.value = await Ke(l.id);
535
+ } catch (j) {
536
+ V.value = T(j);
537
+ return;
538
+ }
539
+ if (re.value) {
540
+ D = setTimeout(ee, Me);
541
+ return;
542
+ }
543
+ b.value.status === "saved" && await X();
544
+ }
545
+ }
546
+ async function me() {
547
+ V.value = "";
548
+ try {
549
+ b.value = (await Ge()).run, D = setTimeout(ee, Me);
550
+ } catch (l) {
551
+ V.value = T(l);
552
+ }
553
+ }
554
+ return qe(() => {
555
+ D && clearTimeout(D);
556
+ }), (l, j) => {
557
+ const te = he("FmButton"), ie = he("FmPageHead");
558
+ return o(), oe(Oe, null, {
559
+ default: le(() => [
560
+ Z(ie, {
561
+ title: x(p)("reportV5.digest.title"),
562
+ description: x(I).lg || x(I).md ? x(p)("reportV5.digest.subtitle") : "",
563
+ class: "shrink-0"
564
+ }, {
565
+ append: le(() => {
566
+ var A, se;
567
+ return [
568
+ R.value ? m("", !0) : (o(), r("div", Lt, [
569
+ S.value || V.value ? (o(), r("span", {
570
+ key: 0,
571
+ class: H([
572
+ "fm-typo-en-body-sm-400 max-w-[360px]",
573
+ V.value || ((A = b.value) == null ? void 0 : A.status) === "failed" || ((se = b.value) == null ? void 0 : se.status) === "rejected" ? "text-fm-color-typo-error" : "text-fm-color-typo-secondary"
574
+ ]),
575
+ "data-testid": "digest-build-status"
576
+ }, y(V.value || S.value), 3)) : m("", !0),
577
+ (x(P), m("", !0)),
578
+ Z(ze)
579
+ ]))
580
+ ];
581
+ }),
582
+ _: 1
583
+ }, 8, ["title", "description"]),
584
+ v("div", Ct, [
585
+ R.value ? (o(), oe(we, {
586
+ key: 0,
587
+ "data-testid": "digest-refused",
588
+ title: x(p)("reportV5.digest.refusedTitle"),
589
+ "sub-title": x(p)("reportV5.digest.refusedBody")
590
+ }, null, 8, ["title", "sub-title"])) : (o(), r(w, { key: 1 }, [
591
+ Z(Ye, {
592
+ class: "mx-24",
593
+ "next-digest": J.value
594
+ }, null, 8, ["next-digest"]),
595
+ F.value ? (o(), r("p", Rt, y(F.value), 1)) : m("", !0),
596
+ !O.value && !F.value && !_.value.length ? (o(), oe(we, {
597
+ key: 1,
598
+ title: x(p)("reportV5.digest.emptyTitle"),
599
+ "sub-title": x(p)("reportV5.digest.emptyBody")
600
+ }, null, 8, ["title", "sub-title"])) : _.value.length ? (o(), r(w, { key: 2 }, [
601
+ E.value ? (o(), r("section", Tt, [
602
+ v("h2", Et, y(x(p)(E.value.read ? "reportV5.digest.latest" : "reportV5.digest.newForYou")), 1),
603
+ Z($e, {
604
+ card: E.value,
605
+ hero: ""
606
+ }, null, 8, ["card"])
607
+ ])) : m("", !0),
608
+ K.value.length ? (o(), r("section", jt, [
609
+ v("h2", qt, y(x(p)("reportV5.digest.earlier")), 1),
610
+ v("div", It, [
611
+ (o(!0), r(w, null, q(K.value, (A) => (o(), oe($e, {
612
+ key: A.weekStart,
613
+ card: A
614
+ }, null, 8, ["card"]))), 128))
615
+ ])
616
+ ])) : m("", !0),
617
+ k.value ? (o(), r("div", Ot, [
618
+ Z(te, {
619
+ "data-testid": "digest-show-more",
620
+ variant: "secondary",
621
+ label: x(p)("reportV5.digest.showMore"),
622
+ disabled: f.value,
623
+ onClick: Q
624
+ }, null, 8, ["label", "disabled"])
625
+ ])) : m("", !0)
626
+ ], 64)) : m("", !0)
627
+ ], 64))
628
+ ])
629
+ ]),
630
+ _: 1
631
+ });
632
+ };
633
+ }
634
+ }), Jt = /* @__PURE__ */ ge(Nt, [["__scopeId", "data-v-f81c3f4a"]]);
635
+ export {
636
+ Jt as default
637
+ };