@feedmepos/mf-report 5.34.2 → 5.35.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-D-YQ3yMW.js → App-Dv36-JBr.js} +4 -4
  2. package/dist/{DateRangeSelect-OTyc3v5_.js → DateRangeSelect-CSuWTBDR.js} +1 -1
  3. package/dist/{Default.vue_vue_type_script_setup_true_lang-CxIN_bfu.js → Default.vue_vue_type_script_setup_true_lang-BFuav3fL.js} +1 -1
  4. package/dist/{DigestListView-DCpIQY1v.js → DigestListView-lWXR-Yqe.js} +3 -3
  5. package/dist/DigestReaderView-cKRrj4qw.js +489 -0
  6. package/dist/{DynamicWidget.vue_vue_type_script_setup_true_lang-iRcCryhy.js → DynamicWidget.vue_vue_type_script_setup_true_lang-D0OTyDep.js} +173 -173
  7. package/dist/{GlobalFilterSelect.vue_vue_type_script_setup_true_lang-VTI9bq-3.js → GlobalFilterSelect.vue_vue_type_script_setup_true_lang-lFm4G3pA.js} +175 -175
  8. package/dist/{InsightView-WQ3IXr2b.js → InsightView-BO2y0s6E.js} +5 -5
  9. package/dist/{Integration-Bx6Xt8rm.js → Integration-DZR0sg3Y.js} +3 -3
  10. package/dist/{Integrations-BSsJGc4e.js → Integrations-C8IJSs8_.js} +2 -2
  11. package/dist/{Layout-CmTYhuDW.js → Layout-DKE_UPyV.js} +1 -1
  12. package/dist/{LocationSelect.vue_vue_type_script_setup_true_lang-SjaEdhpI.js → LocationSelect.vue_vue_type_script_setup_true_lang-pKBQdsry.js} +1553 -1547
  13. package/dist/{MenuTab.vue_vue_type_script_setup_true_lang-CtJRTkuw.js → MenuTab.vue_vue_type_script_setup_true_lang-DsTCV4je.js} +5 -5
  14. package/dist/{NavigationTab.vue_vue_type_script_setup_true_lang-DERX_GCc.js → NavigationTab.vue_vue_type_script_setup_true_lang-uFKb4Unh.js} +5 -5
  15. package/dist/{OverviewView-BXuqus0r.js → OverviewView--6juk8Ny.js} +5 -5
  16. package/dist/{Report-Cj7xHOMI.js → Report-B7tYzV-u.js} +3 -3
  17. package/dist/ReportCanvasView-DJZItxK4.js +1066 -0
  18. package/dist/{ReportEditor-v3CRHflb.js → ReportEditor-lP1wy7eF.js} +7 -7
  19. package/dist/{ReportView-IbQC8Qf1.js → ReportView-BFdf3j2m.js} +6 -6
  20. package/dist/{ReportViewRoute-NwvXWZDf.js → ReportViewRoute-D5tZcb3A.js} +2 -2
  21. package/dist/{Setting-GyFSTgFs.js → Setting-CdOGOX1H.js} +94 -94
  22. package/dist/{Template-DLVGn41O.js → Template-CcNz2aVR.js} +3 -3
  23. package/dist/{TileEditor-DT4ayXKN.js → TileEditor-D8QsUytE.js} +6 -6
  24. package/dist/{TilePageStack.vue_vue_type_script_setup_true_lang-Bh0NcO-n.js → TilePageStack.vue_vue_type_script_setup_true_lang-D2Tz0EW3.js} +2 -2
  25. package/dist/{TransitionFade-DIDahT3W.js → TransitionFade-qKsTOksI.js} +5 -5
  26. package/dist/{app-X-tKojve.js → app-D9WJwZyu.js} +19 -19
  27. package/dist/app.js +1 -1
  28. package/dist/assets/{formatChartData.worker-Cpgnh20a.js → formatChartData.worker-Bt8turfo.js} +22 -22
  29. package/dist/assets/{processTableData.worker-B7I6PElJ.js → processTableData.worker-MGb36f8J.js} +22 -22
  30. package/dist/{currency-Cebf4JT_.js → currency-Dx3wVA1Q.js} +1 -1
  31. package/dist/{index-Brvkpnxl.js → index-c2QQydke.js} +503 -473
  32. package/dist/{report-CoK9Yl1E.js → report-tffVXl4d.js} +1 -1
  33. package/dist/style.css +1 -1
  34. package/dist/{useDigestFont-DUUhWR6u.js → useDigestFont-DfORxCFz.js} +1 -1
  35. package/dist/{useReportCanvasPanel-B8qruqY0.js → useReportCanvasPicks-D1IdA31H.js} +1353 -1264
  36. package/dist/{useRestaurantPermission-BTBg_goI.js → useRestaurantPermission-CrqMkVed.js} +1 -1
  37. package/package.json +2 -2
  38. package/dist/DigestReaderView-W6sW8h9Q.js +0 -526
  39. package/dist/ReportCanvasView-CGt4ayU2.js +0 -1035
@@ -0,0 +1,1066 @@
1
+ import { defineComponent as pt, ref as c, computed as S, watch as Ce, onMounted as ft, onBeforeUnmount as Ke, resolveComponent as ne, openBlock as n, createElementBlock as d, createElementVNode as r, createVNode as F, toDisplayString as u, createCommentVNode as g, Fragment as qe, renderList as Me, normalizeClass as je, createBlock as te, nextTick as He, unref as a, withCtx as me, isRef as dt, withDirectives as pa, vShow as fa, withKeys as ya, withModifiers as ba, toRaw as vt } from "vue";
2
+ import { useRoute as ha, useRouter as ga } from "vue-router";
3
+ import { u as yt, _ as bt } from "./_plugin-vue_export-helper-Bx7s49ra.js";
4
+ import { storeToRefs as Ne } from "pinia";
5
+ import { useSnackbar as wa } from "@feedmepos/ui-library";
6
+ import { h as ka, r as _a, i as xa, j as Ca, c as Sa, u as Ra, d as Aa, b as Va, a as $a, R as Ea, f as Fa, g as xe, p as Da, k as Ia, l as Ta, m as mt, n as Pa } from "./useReportCanvasPicks-D1IdA31H.js";
7
+ import { _ as Ba } from "./LocationSelect.vue_vue_type_script_setup_true_lang-pKBQdsry.js";
8
+ import { D as La } from "./DateRangeSelect-CSuWTBDR.js";
9
+ import { a as ht, j as Oa } from "./app-D9WJwZyu.js";
10
+ import { u as za } from "./report-tffVXl4d.js";
11
+ import { u as Ua } from "./global-loader-BuxFfehu.js";
12
+ import { r as qa } from "./i18n-DbyciK4x.js";
13
+ const Ma = ["aria-label"], ja = { class: "flex h-64 shrink-0 items-center gap-12 border-b border-fm-color-border-secondary px-[20px]" }, Ha = { class: "fm-typo-en-body-md-600 grow" }, Na = ["aria-label", "disabled"], Ka = { class: "min-h-0 grow overflow-y-auto px-[20px] py-[20px]" }, Wa = { class: "fm-typo-en-body-md-400 mb-[20px] text-fm-color-typo-secondary" }, Za = { class: "mb-24 rounded-[12px] border border-fm-color-border-secondary p-16" }, Ga = { class: "mb-8 flex items-center gap-8" }, Qa = { class: "fm-typo-en-body-md-600 grow" }, Ja = { class: "fm-typo-en-body-sm-600 rounded-md bg-fm-color-neutral-gray-100 px-8 py-4" }, Xa = {
14
+ key: 0,
15
+ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
16
+ }, Ya = ["aria-label"], eo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, to = {
17
+ key: 1,
18
+ role: "alert",
19
+ class: "rounded-[12px] border border-fm-color-border-secondary p-[20px]"
20
+ }, ao = { class: "fm-typo-en-body-md-600 mb-8" }, oo = { class: "fm-typo-en-body-md-400 mb-16 text-fm-color-typo-secondary" }, ro = {
21
+ key: 2,
22
+ class: "flex flex-col items-center rounded-[12px] bg-fm-color-neutral-gray-50 px-16 py-32 text-center"
23
+ }, no = { class: "fm-typo-en-body-md-600 mb-8" }, so = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, lo = { class: "fm-typo-en-body-sm-600 mb-12 text-fm-color-typo-secondary" }, io = { class: "ml-4 border-l border-fm-color-border-secondary pl-16" }, uo = ["aria-expanded", "aria-controls", "aria-current", "disabled", "onClick"], co = { class: "mb-4 flex items-center gap-8" }, vo = ["datetime", "title"], mo = {
24
+ key: 0,
25
+ "data-testid": "canvas-version-current",
26
+ class: "fm-typo-en-body-sm-600 rounded-md bg-fm-color-neutral-gray-100 px-8 py-4 text-fm-color-typo-secondary"
27
+ }, po = {
28
+ key: 0,
29
+ class: "fm-typo-en-body-md-600 block break-words text-fm-color-typo-secondary"
30
+ }, fo = { class: "fm-typo-en-body-md-400 line-clamp-3 block break-words" }, yo = {
31
+ "data-testid": "canvas-version-author",
32
+ class: "mt-8 flex items-center gap-8 text-fm-color-typo-secondary"
33
+ }, bo = { class: "fm-typo-en-body-sm-400 line-clamp-1 break-words" }, ho = { class: "shrink-0 border-t border-fm-color-border-secondary p-[20px]" }, go = { class: "fm-typo-en-body-sm-400 mb-4 text-fm-color-typo-secondary" }, wo = { class: "fm-typo-en-body-md-400 mb-16 max-h-[120px] overflow-y-auto whitespace-pre-wrap break-words" }, ko = {
34
+ key: 0,
35
+ role: "alert",
36
+ class: "fm-typo-en-body-md-400 mb-12 text-fm-color-typo-error"
37
+ }, _o = {
38
+ key: 1,
39
+ class: "fm-typo-en-body-md-400 mb-12 text-fm-color-typo-secondary"
40
+ }, xo = {
41
+ key: 2,
42
+ class: "flex items-center justify-end gap-8"
43
+ }, Co = ["disabled"], So = {
44
+ key: 1,
45
+ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
46
+ }, Ro = { class: "fm-typo-en-body-sm-400 mt-12 text-fm-color-typo-secondary" }, Ao = /* @__PURE__ */ pt({
47
+ __name: "ReportCanvasHistory",
48
+ props: {
49
+ reportId: {},
50
+ publishedAt: {},
51
+ timezone: {},
52
+ hasDraft: { type: Boolean },
53
+ busy: { type: Boolean }
54
+ },
55
+ emits: ["close", "restored", "restoring"],
56
+ setup(V, { emit: se }) {
57
+ const M = V, K = se, { t: i, locale: x } = yt(), s = (o, y = {}) => i(`reportV5.reportCanvas.history.${o}`, y), E = c([]), D = c(!0), G = c(!1), ae = c(!1), v = c(!1), l = c(!1), I = c(), le = c(), oe = c(), j = c(), L = S(() => E.value.find((o) => o.id === I.value)), w = S(() => M.hasDraft || M.busy || v.value);
58
+ let H = !0, Q = null;
59
+ function ie(o, y) {
60
+ const $ = new Date(o);
61
+ return Number.isFinite($.getTime()) ? new Intl.DateTimeFormat(x.value, { ...y, timeZone: M.timezone }).format(
62
+ $
63
+ ) : s("unknownDate");
64
+ }
65
+ const ue = (o) => ie(o, { dateStyle: "medium", timeStyle: "short" }), p = (o) => ie(o, { hour: "numeric", minute: "2-digit", second: "2-digit" }), h = (o) => ie(o, { year: "numeric", month: "2-digit", day: "2-digit" });
66
+ function R(o) {
67
+ return h(o) === h((/* @__PURE__ */ new Date()).toISOString()) ? s("today") : ie(o, { month: "long", day: "numeric", year: "numeric" });
68
+ }
69
+ const T = S(() => {
70
+ const o = [];
71
+ for (const y of [...E.value].sort(($, X) => Date.parse(X.at) - Date.parse($.at))) {
72
+ const $ = h(y.at), X = o.find((fe) => fe.key === $);
73
+ X ? X.versions.push(y) : o.push({ key: $, label: R(y.at), versions: [y] });
74
+ }
75
+ return o;
76
+ }), O = (o) => {
77
+ var y;
78
+ return o.id === ((y = E.value[0]) == null ? void 0 : y.id);
79
+ }, J = (o) => o.prompt.trim() || s("noPrompt"), W = (o) => o.restoredFrom ? s("restoredFrom", { at: ue(o.restoredFrom) }) : "", de = (o) => [W(o), J(o)].filter(Boolean).join(" "), Se = (o) => {
80
+ var y, $;
81
+ return ((y = o.author) == null ? void 0 : y.name) || (($ = o.author) == null ? void 0 : $.email) || s("unknownUser");
82
+ };
83
+ async function be() {
84
+ D.value = !0, G.value = !1;
85
+ try {
86
+ const o = await ka(M.reportId);
87
+ H && (E.value = o);
88
+ } catch {
89
+ H && (G.value = !0);
90
+ } finally {
91
+ H && (D.value = !1);
92
+ }
93
+ }
94
+ function z(o) {
95
+ v.value || O(o) || (I.value = I.value === o.id ? void 0 : o.id, l.value = !1, ae.value = !1);
96
+ }
97
+ async function Re() {
98
+ var o;
99
+ !L.value || w.value || (l.value = !0, await He(), (o = oe.value) == null || o.focus());
100
+ }
101
+ async function k() {
102
+ var o;
103
+ l.value = !1, ae.value = !1, await He(), (o = j.value) == null || o.focus();
104
+ }
105
+ async function pe() {
106
+ if (!(!L.value || w.value || !l.value)) {
107
+ v.value = !0, K("restoring", !0), ae.value = !1;
108
+ try {
109
+ const o = await _a(M.reportId, L.value.id);
110
+ H && K("restored", o);
111
+ } catch {
112
+ H && (ae.value = !0);
113
+ } finally {
114
+ v.value = !1, K("restoring", !1);
115
+ }
116
+ }
117
+ }
118
+ function he(o) {
119
+ o.key === "Escape" && (o.stopPropagation(), !v.value && (l.value ? k() : K("close")));
120
+ }
121
+ return Ce(w, (o) => {
122
+ o && !v.value && (l.value = !1);
123
+ }), ft(() => {
124
+ var o;
125
+ Q = document.activeElement, (o = le.value) == null || o.focus(), be();
126
+ }), Ke(() => {
127
+ H = !1, Q == null || Q.focus();
128
+ }), (o, y) => {
129
+ const $ = ne("FmIcon"), X = ne("FmButton"), fe = ne("FmAvatar");
130
+ return n(), d("aside", {
131
+ "data-testid": "canvas-versions",
132
+ class: "flex h-full min-h-0 flex-col border-l border-fm-color-border-secondary bg-fm-color-neutral-white text-fm-color-typo-primary",
133
+ "aria-label": s("title"),
134
+ onKeydown: he
135
+ }, [
136
+ r("header", ja, [
137
+ F($, {
138
+ name: "history",
139
+ size: "md",
140
+ class: "text-fm-color-typo-secondary"
141
+ }),
142
+ r("h2", Ha, u(s("title")), 1),
143
+ r("button", {
144
+ ref_key: "closeButton",
145
+ ref: le,
146
+ "data-testid": "canvas-versions-close",
147
+ class: "history-button flex h-[36px] w-[36px] items-center justify-center rounded-md text-fm-color-typo-secondary",
148
+ "aria-label": s("close"),
149
+ disabled: v.value,
150
+ onClick: y[0] || (y[0] = (Y) => K("close"))
151
+ }, [
152
+ F($, {
153
+ name: "close",
154
+ size: "md"
155
+ })
156
+ ], 8, Na)
157
+ ]),
158
+ r("div", Ka, [
159
+ r("p", Wa, u(s("intro")), 1),
160
+ r("div", Za, [
161
+ r("div", Ga, [
162
+ y[1] || (y[1] = r("span", {
163
+ class: "h-8 w-8 rounded-full bg-fm-color-primary",
164
+ "aria-hidden": "true"
165
+ }, null, -1)),
166
+ r("span", Qa, u(s("current")), 1),
167
+ r("span", Ja, u(s("published")), 1)
168
+ ]),
169
+ V.publishedAt ? (n(), d("p", Xa, u(ue(V.publishedAt)), 1)) : g("", !0)
170
+ ]),
171
+ D.value ? (n(), d("div", {
172
+ key: 0,
173
+ role: "status",
174
+ class: "space-y-16",
175
+ "aria-label": s("loading")
176
+ }, [
177
+ r("p", eo, u(s("loading")), 1),
178
+ (n(), d(qe, null, Me(3, (Y) => r("div", {
179
+ key: Y,
180
+ class: "rounded-lg border border-fm-color-border-secondary p-16",
181
+ "aria-hidden": "true"
182
+ }, [...y[2] || (y[2] = [
183
+ r("div", { class: "mb-12 h-12 w-1/3 rounded bg-fm-color-neutral-gray-100" }, null, -1),
184
+ r("div", { class: "h-12 w-3/4 rounded bg-fm-color-neutral-gray-100" }, null, -1)
185
+ ])])), 64))
186
+ ], 8, Ya)) : G.value ? (n(), d("div", to, [
187
+ r("p", ao, u(s("loadFailed")), 1),
188
+ r("p", oo, u(s("loadFailedHint")), 1),
189
+ F(X, {
190
+ variant: "secondary",
191
+ label: s("retry"),
192
+ onClick: be
193
+ }, null, 8, ["label"])
194
+ ])) : E.value.length ? g("", !0) : (n(), d("div", ro, [
195
+ F($, {
196
+ name: "history",
197
+ size: "lg",
198
+ class: "mb-12 text-fm-color-typo-secondary"
199
+ }),
200
+ r("p", no, u(s("empty")), 1),
201
+ r("p", so, u(s("emptyHint")), 1)
202
+ ])),
203
+ (n(!0), d(qe, null, Me(D.value || G.value ? [] : T.value, (Y) => (n(), d("section", {
204
+ key: Y.key,
205
+ class: "mb-[20px]"
206
+ }, [
207
+ r("h3", lo, u(Y.label), 1),
208
+ r("ul", io, [
209
+ (n(!0), d(qe, null, Me(Y.versions, (f) => {
210
+ var Ae, ge, Ve;
211
+ return n(), d("li", {
212
+ key: f.id,
213
+ "data-testid": "canvas-version-row",
214
+ class: "relative mb-8"
215
+ }, [
216
+ y[3] || (y[3] = r("span", {
217
+ class: "history-dot absolute top-[20px] h-8 w-8 rounded-full border border-fm-color-border-secondary bg-fm-color-neutral-white",
218
+ "aria-hidden": "true"
219
+ }, null, -1)),
220
+ r("button", {
221
+ class: je([
222
+ "history-button w-full rounded-lg border p-12 text-left",
223
+ I.value === f.id ? "border-fm-color-primary bg-fm-color-primary-50" : "border-transparent"
224
+ ]),
225
+ "aria-expanded": I.value === f.id,
226
+ "aria-controls": I.value === f.id ? "canvas-version-details" : void 0,
227
+ "aria-current": O(f) ? "true" : void 0,
228
+ disabled: v.value || O(f),
229
+ onClick: (Ie) => z(f)
230
+ }, [
231
+ r("span", co, [
232
+ r("time", {
233
+ datetime: f.at,
234
+ title: ue(f.at),
235
+ class: "fm-typo-en-body-sm-400 grow text-fm-color-typo-secondary"
236
+ }, u(p(f.at)), 9, vo),
237
+ O(f) ? (n(), d("span", mo, u(s("currentBadge")), 1)) : I.value === f.id ? (n(), te($, {
238
+ key: 1,
239
+ name: "check",
240
+ size: "sm",
241
+ class: "text-fm-color-primary"
242
+ })) : g("", !0)
243
+ ]),
244
+ W(f) ? (n(), d("span", po, u(W(f)), 1)) : g("", !0),
245
+ r("span", fo, u(J(f)), 1),
246
+ r("span", yo, [
247
+ F(fe, {
248
+ size: "sm",
249
+ name: ((Ae = f.author) == null ? void 0 : Ae.name) || ((ge = f.author) == null ? void 0 : ge.email) || "?",
250
+ src: (Ve = f.author) == null ? void 0 : Ve.photoUrl
251
+ }, null, 8, ["name", "src"]),
252
+ r("span", bo, u(Se(f)), 1)
253
+ ])
254
+ ], 10, uo)
255
+ ]);
256
+ }), 128))
257
+ ])
258
+ ]))), 128))
259
+ ]),
260
+ r("footer", ho, [
261
+ L.value ? (n(), d("div", {
262
+ key: 0,
263
+ id: "canvas-version-details",
264
+ ref_key: "details",
265
+ ref: j,
266
+ tabindex: "-1",
267
+ class: "history-details"
268
+ }, [
269
+ r("p", go, u(s("savedBy", { user: Se(L.value), at: ue(L.value.at) })), 1),
270
+ r("p", wo, u(l.value ? s("confirmHint") : de(L.value)), 1),
271
+ ae.value ? (n(), d("p", ko, u(s("restoreFailed")), 1)) : g("", !0),
272
+ V.hasDraft || V.busy ? (n(), d("p", _o, u(s(V.hasDraft ? "draftHint" : "busyHint")), 1)) : g("", !0),
273
+ l.value ? (n(), d("div", xo, [
274
+ r("button", {
275
+ ref_key: "cancelButton",
276
+ ref: oe,
277
+ class: "history-button fm-typo-en-body-md-600 rounded-lg px-16 py-12",
278
+ disabled: v.value,
279
+ onClick: k
280
+ }, u(s("cancel")), 9, Co),
281
+ F(X, {
282
+ "data-testid": "canvas-version-confirm",
283
+ variant: "primary",
284
+ label: s(v.value ? "restoring" : "confirm"),
285
+ disabled: w.value,
286
+ onClick: pe
287
+ }, null, 8, ["label", "disabled"])
288
+ ])) : (n(), te(X, {
289
+ key: 3,
290
+ "data-testid": "canvas-version-restore",
291
+ class: "w-full",
292
+ variant: "primary",
293
+ "prepend-icon": "restore",
294
+ label: s("restore"),
295
+ disabled: w.value,
296
+ onClick: Re
297
+ }, null, 8, ["label", "disabled"]))
298
+ ], 512)) : (n(), d("p", So, u(s("selectHint")), 1)),
299
+ r("p", Ro, u(s("timezone", { timezone: V.timezone })), 1)
300
+ ])
301
+ ], 40, Ma);
302
+ };
303
+ }
304
+ }), Vo = /* @__PURE__ */ bt(Ao, [["__scopeId", "data-v-7df5ac71"]]), $o = 2e3, Eo = 10 * 6e4;
305
+ function Fo(V, se, M, K) {
306
+ const { timezone: i } = Ne(ht()), x = c(null), s = c(null), E = c(!1), D = c(""), G = [];
307
+ function ae(p) {
308
+ G.push(p);
309
+ }
310
+ let v;
311
+ function l() {
312
+ v !== void 0 && (window.clearInterval(v), v = void 0);
313
+ }
314
+ function I() {
315
+ var p;
316
+ v !== void 0 || se.value || ((p = x.value) == null ? void 0 : p.status) === "running" && (v = window.setInterval(() => void le(), $o));
317
+ }
318
+ async function le() {
319
+ var p;
320
+ if (se.value) {
321
+ l();
322
+ return;
323
+ }
324
+ try {
325
+ const { run: h } = await Ca(V, K == null ? void 0 : K.value);
326
+ h && oe(h), ((p = x.value) == null ? void 0 : p.status) !== "running" ? l() : x.value.updatedAt && Date.now() - new Date(x.value.updatedAt).getTime() > Eo && (E.value = !0, l());
327
+ } catch {
328
+ }
329
+ }
330
+ function oe(p, h) {
331
+ h !== void 0 && (s.value = h);
332
+ const R = p.sections.some((T) => {
333
+ var J;
334
+ const O = (J = x.value) == null ? void 0 : J.sections.find((W) => W.id === T.id);
335
+ return T.status === "ok" && (O == null ? void 0 : O.status) !== "ok";
336
+ });
337
+ x.value = p, E.value = !1, R && G.forEach((T) => T()), I();
338
+ }
339
+ function j(p) {
340
+ var R;
341
+ if (p.name !== "build_run") return;
342
+ const h = p.data;
343
+ Array.isArray(h.sections) && oe(
344
+ {
345
+ runId: h.runId ? String(h.runId) : void 0,
346
+ status: h.status ?? "running",
347
+ sections: h.sections,
348
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
349
+ },
350
+ // first snapshot of this turn claims the anchor; later ones keep it
351
+ (R = x.value) != null && R.runId && x.value.runId === h.runId ? void 0 : (M == null ? void 0 : M.value) ?? null
352
+ );
353
+ }
354
+ function L() {
355
+ l(), x.value = null, s.value = null, E.value = !1, D.value = "";
356
+ }
357
+ function w(p, h = []) {
358
+ p && p.status !== "ok" && oe(p, Q(p, h));
359
+ }
360
+ function H(p) {
361
+ s.value || !x.value || (s.value = Q(x.value, p));
362
+ }
363
+ function Q(p, h) {
364
+ if (!p.runId) return null;
365
+ const R = h.find(
366
+ (T) => T.role === "assistant" && T.parts.some(
367
+ (O) => {
368
+ var J;
369
+ return O.type === "data-build_run" && ((J = O.data) == null ? void 0 : J.runId) === p.runId;
370
+ }
371
+ )
372
+ );
373
+ return (R == null ? void 0 : R.id) ?? null;
374
+ }
375
+ async function ie(p) {
376
+ var h;
377
+ if (!(!((h = x.value) != null && h.runId) || x.value.status === "running")) {
378
+ D.value = "";
379
+ try {
380
+ const { run: R } = await xa(
381
+ V,
382
+ x.value.runId,
383
+ p,
384
+ a(i.value)
385
+ );
386
+ oe(R);
387
+ } catch (R) {
388
+ D.value = R instanceof Error ? R.message : String(R);
389
+ }
390
+ }
391
+ }
392
+ async function ue() {
393
+ E.value = !1, await le();
394
+ }
395
+ return Ke(l), {
396
+ run: x,
397
+ anchorId: s,
398
+ stale: E,
399
+ retryError: D,
400
+ seed: w,
401
+ reanchor: H,
402
+ clear: L,
403
+ noteEvent: j,
404
+ retry: ie,
405
+ refresh: ue,
406
+ onLanded: ae
407
+ };
408
+ }
409
+ const Do = "page_filters", Io = { class: "flex min-w-0 grow flex-col" }, To = { class: "fm-typo-en-title-md-600 block min-w-0 max-w-full overflow-hidden text-ellipsis whitespace-nowrap" }, Po = { class: "relative shrink-0" }, Bo = {
410
+ key: 0,
411
+ class: "flex items-center gap-8 border-b border-fm-color-border-secondary px-16 py-8"
412
+ }, Lo = {
413
+ key: 0,
414
+ class: "flex min-w-0 grow items-start overflow-x-auto scrollbar-hide"
415
+ }, Oo = {
416
+ key: 1,
417
+ class: "grow"
418
+ }, zo = {
419
+ key: 2,
420
+ class: "flex shrink-0 items-center gap-4"
421
+ }, Uo = ["aria-pressed", "aria-label", "disabled"], qo = {
422
+ width: "20",
423
+ height: "20",
424
+ viewBox: "0 0 20 20",
425
+ fill: "none",
426
+ "aria-hidden": "true"
427
+ }, Mo = ["fill"], jo = {
428
+ key: 1,
429
+ "data-testid": "canvas-comment-bar",
430
+ class: "flex items-center gap-8 border-b border-fm-color-border-secondary px-16 py-8"
431
+ }, Ho = {
432
+ key: 0,
433
+ "data-testid": "canvas-comment-hint",
434
+ class: "fm-typo-en-body-sm-400 min-w-0 grow truncate text-fm-color-typo-secondary"
435
+ }, No = {
436
+ key: 2,
437
+ "data-testid": "canvas-draft-bar",
438
+ class: "flex items-center gap-12 border-b border-fm-color-border-secondary bg-fm-color-system-info-100 px-16 py-8"
439
+ }, Ko = { class: "fm-typo-en-body-sm-500 text-fm-color-typo-primary" }, Wo = { class: "fm-typo-en-body-sm-400 grow text-fm-color-typo-secondary" }, Zo = {
440
+ key: 0,
441
+ class: "fm-typo-en-body-sm-400 text-fm-color-typo-error"
442
+ }, Go = {
443
+ key: 3,
444
+ role: "status",
445
+ class: "fm-typo-en-body-sm-400 flex items-center gap-8 border-b border-fm-color-border-secondary px-16 py-8"
446
+ }, Qo = { class: "grow" }, Jo = ["aria-label"], Xo = {
447
+ key: 4,
448
+ class: "fm-typo-en-body-sm-400 border-b border-fm-color-border-secondary bg-fm-color-system-warning-100 px-16 py-8"
449
+ }, Yo = {
450
+ key: 5,
451
+ class: "fm-typo-en-body-sm-400 p-16 text-fm-color-typo-error"
452
+ }, er = ["srcdoc", "title"], tr = ["role", "aria-modal", "aria-label"], ar = { class: "fm-typo-en-title-sm-600" }, or = ["onKeydown"], rr = /* @__PURE__ */ pt({
453
+ __name: "ReportCanvasView",
454
+ props: {
455
+ reportId: {},
456
+ viewOnly: { type: Boolean }
457
+ },
458
+ setup(V) {
459
+ var it;
460
+ const se = V, M = ha(), K = ga(), { t: i, te: x } = yt(), s = za(), { currentReport: E } = Ne(s), D = S(() => {
461
+ var e;
462
+ return qa(i, x, (e = E.value) == null ? void 0 : e.name, "other");
463
+ }), G = wa(), { promptLoader: ae } = Ua(), v = se.reportId || String(M.query.reportId ?? ""), l = c(), I = c(""), le = S(() => {
464
+ var e;
465
+ return ((e = l.value) == null ? void 0 : e.state) === "draft";
466
+ }), oe = S(() => {
467
+ var e, t;
468
+ return ((t = (e = l.value) == null ? void 0 : e.unpublishedTurnIds) == null ? void 0 : t.length) ?? 0;
469
+ }), j = c(!1), L = c(""), w = c(!1), H = c(!1), Q = c(!1);
470
+ function ie() {
471
+ w.value = !0, k.value = !1;
472
+ }
473
+ function ue() {
474
+ Q.value || (w.value ? w.value = !1 : z.value = !1);
475
+ }
476
+ async function p(e) {
477
+ await De(() => Promise.resolve(e)), w.value = !1, H.value = !0;
478
+ }
479
+ const { isAdmin: h, canUpdate: R } = Oa(), T = S(() => !se.viewOnly && h.value), O = S(
480
+ () => {
481
+ var e;
482
+ return !se.viewOnly && !!((e = E.value) != null && e.editable) && R(E.value);
483
+ }
484
+ ), J = S(
485
+ () => O.value ? [{ label: i("report.common.rename"), value: "rename", isPrimary: !1 }] : []
486
+ ), W = c(!1), de = c("");
487
+ function Se() {
488
+ de.value = D.value, W.value = !0;
489
+ }
490
+ async function be() {
491
+ const e = E.value, t = de.value.trim();
492
+ if (!(!e || !t) && (W.value = !1, t !== D.value))
493
+ try {
494
+ await ae(() => s.createOrUpdateReport({ ...e, name: t })), G.open({ message: i("report.messages.saveSuccess"), type: "success" });
495
+ } catch {
496
+ G.open({
497
+ message: i("report.messages.failedToAction", { action: i("report.common.rename") }),
498
+ type: "error"
499
+ });
500
+ }
501
+ }
502
+ const z = c(!1), Re = c(), k = c(!1), pe = c(!1), he = c(!1), o = S(() => k.value && !he.value);
503
+ Ce([k, z], ([e, t]) => {
504
+ (!e || !t) && (he.value = !1);
505
+ });
506
+ const y = c({});
507
+ function $(e, t) {
508
+ var m;
509
+ return String(
510
+ ((m = e.config) == null ? void 0 : m.title) || y.value[e.id] || i("reportV5.reportAi.chat.widgetNumber", { number: t + 1 })
511
+ );
512
+ }
513
+ function X(e) {
514
+ var A;
515
+ const t = ((A = l.value) == null ? void 0 : A.sections) ?? [], m = t.findIndex((C) => C.id === e.sectionId), q = t[m];
516
+ if (!(!q || q.version !== e.version))
517
+ return { ...e, label: e.label || $(q, m) };
518
+ }
519
+ const {
520
+ homePicks: fe,
521
+ threadPicks: Y,
522
+ picks: f,
523
+ targets: Ae,
524
+ outlines: ge,
525
+ chips: Ve,
526
+ stale: Ie,
527
+ toggle: gt,
528
+ addArea: wt,
529
+ widen: kt
530
+ } = Sa(pe, { sections: () => {
531
+ var e;
532
+ return ((e = l.value) == null ? void 0 : e.sections) ?? [];
533
+ }, named: X });
534
+ function $e() {
535
+ f.value = [], k.value = !1;
536
+ }
537
+ function We(e) {
538
+ e.key === "Escape" && k.value && $e();
539
+ }
540
+ function _t(e, t = []) {
541
+ !k.value || Z.value || gt(e, t) && (z.value = !0);
542
+ }
543
+ function xt(e) {
544
+ !k.value || Z.value || wt(e) && (z.value = !0);
545
+ }
546
+ const Ct = ((it = window.matchMedia) == null ? void 0 : it.call(window, "(pointer: coarse)").matches) ?? !1;
547
+ function St() {
548
+ if (k.value) return $e();
549
+ k.value = !0, z.value = !0;
550
+ }
551
+ function Rt() {
552
+ he.value = !0, z.value = !0;
553
+ }
554
+ const At = S(() => f.value.length ? i("reportV5.reportAi.chat.picked", { count: f.value.length }) : i(Ct ? "reportV5.reportAi.chat.pickingTouch" : "reportV5.reportAi.chat.picking"));
555
+ function Vt(e) {
556
+ return e.map((t) => ({
557
+ ...t,
558
+ viewParams: structuredClone(vt(_.params.value)),
559
+ viewIntent: structuredClone(vt(_.intent.value))
560
+ }));
561
+ }
562
+ const P = c(""), Ze = c(""), Ge = c("");
563
+ function Qe(e) {
564
+ return N.stashDraft(
565
+ P.value,
566
+ Y.value.flatMap((t) => t.targets)
567
+ ), U.clear(), e().then(() => {
568
+ const t = N.recallDraft();
569
+ P.value = t.text, Y.value = xe(t.targets), k.value = !1;
570
+ });
571
+ }
572
+ async function $t(e) {
573
+ if (rt.value) return;
574
+ const t = e ? [...fe.value] : [];
575
+ let m = !1;
576
+ await Qe(async () => {
577
+ m = await N.startChat();
578
+ }), m && e && (pe.value = !1, Y.value = t, fe.value = [], P.value = e, await Ee());
579
+ }
580
+ const Et = (e) => Qe(async () => {
581
+ const t = await N.select(e);
582
+ U.seed(t, we.value);
583
+ });
584
+ async function Ee() {
585
+ const e = P.value.trim();
586
+ if (!(!e || Ie.value || Z.value)) {
587
+ if (Ge.value = e, P.value = "", await Xt(e, Vt(Ae.value)), at.value) {
588
+ P.value || (P.value = Ge.value);
589
+ return;
590
+ }
591
+ $e();
592
+ }
593
+ }
594
+ function Ft(e) {
595
+ const t = N.takeUnsent(e);
596
+ if (t)
597
+ return P.value = t.text, f.value = xe(t.targets), Ee();
598
+ }
599
+ function Dt(e) {
600
+ Z.value || (P.value = i("reportV5.reportAi.build.askBuilderPrompt", { title: e }), f.value = []);
601
+ }
602
+ async function It() {
603
+ const e = await N.stop();
604
+ !e || P.value.trim() || (P.value = e.text, f.value = xe(e.targets));
605
+ }
606
+ function Tt(e) {
607
+ const t = N.requestOf(e);
608
+ t && (P.value = t.text, f.value = xe(t.targets));
609
+ }
610
+ function Pt(e) {
611
+ const t = N.requestOf(e);
612
+ if (t)
613
+ return P.value = t.text, f.value = xe(t.targets), Ee();
614
+ }
615
+ const _ = Ra(v), N = Aa(v), {
616
+ messages: we,
617
+ sessionId: Je,
618
+ title: Bt,
619
+ chats: Lt,
620
+ chatsCursor: Xe,
621
+ chatsLoading: Ot,
622
+ chatsError: zt,
623
+ switching: Ye,
624
+ earlier: Ut,
625
+ loadingEarlier: qt,
626
+ streaming: et,
627
+ turnId: tt,
628
+ step: Mt,
629
+ error: at,
630
+ interrupted: jt,
631
+ stoppable: Ht,
632
+ stopping: Nt,
633
+ unsent: Kt,
634
+ slow: Wt,
635
+ startedAt: Zt,
636
+ awaiting: Gt,
637
+ noReplyId: Qt,
638
+ load: Jt,
639
+ send: Xt,
640
+ onLifecycle: Yt,
641
+ onSettled: ea,
642
+ onResumed: ta
643
+ } = N, Z = S(() => et.value || Gt.value), { dateRange: Te, selectedLocationIds: Pe, locations: ot, timezone: aa } = Ne(ht()), U = Fo(v, et, tt, Je), rt = S(
644
+ () => {
645
+ var e;
646
+ return Z.value || Ye.value || ((e = U.run.value) == null ? void 0 : e.status) === "running";
647
+ }
648
+ ), nt = S(
649
+ () => {
650
+ var e;
651
+ return ((e = l.value) == null ? void 0 : e.sections.filter((t) => t.id !== Do)) ?? [];
652
+ }
653
+ ), st = S(() => nt.value.length === 0), lt = S({
654
+ get: () => T.value && z.value || w.value,
655
+ set: (e) => {
656
+ z.value = e, e || (w.value = !1);
657
+ }
658
+ }), { root: oa, drawer: ra, docked: Fe, modal: Be } = Va(lt, o), na = S(
659
+ () => {
660
+ var e;
661
+ return ((e = l.value) == null ? void 0 : e.sections.some((t) => t.status === "pending")) ?? !1;
662
+ }
663
+ ), sa = S(() => Z.value ? Mt.value ?? "working" : na.value ? "loading" : "updating"), ee = $a(Re, {
664
+ onSelectSection: _t,
665
+ onSelectArea: xt,
666
+ onCancelSelection: $e,
667
+ onSetParams: (e, t) => {
668
+ _.setParams(e, t);
669
+ },
670
+ onSectionRendered: (e, t, m) => {
671
+ m && (y.value = { ...y.value, [e]: m }), Le(e, t, "ok");
672
+ },
673
+ onSectionError: (e, t, m) => {
674
+ console.warn("[report-canvas] section failed", { reportId: v, sectionId: e, message: m }), Le(e, t, "error", m);
675
+ },
676
+ onSectionLayout: (e, t, m) => {
677
+ var A;
678
+ const q = (A = l.value) == null ? void 0 : A.sections.find((C) => C.id === e);
679
+ (q == null ? void 0 : q.status) === "ok" && Le(e, t, "ok", void 0, m);
680
+ }
681
+ });
682
+ _.onResult((e) => ee.pushRows(e)), _.onParamsChanged(() => ee.pushParams(_.paramState())), _.bindStore(), Ce([k, ge, ee.ready, Z], () => {
683
+ ee.setCommentMode(k.value && !Z.value, ge.value, !0);
684
+ });
685
+ async function Le(e, t, m, q, A) {
686
+ var ve, _e;
687
+ const C = (ve = l.value) == null ? void 0 : ve.sections.find((ye) => ye.id === e);
688
+ if (!C || t !== C.version) return;
689
+ const ce = m === "error" ? q ?? "the section failed to render" : void 0, re = A ?? C.warnings ?? [];
690
+ if (!(C.status === m && C.error === ce && (C.warnings ?? []).join(`
691
+ `) === re.join(`
692
+ `))) {
693
+ C.status = m, C.error = ce, C.warnings = re.length ? re : void 0;
694
+ try {
695
+ await Pa(
696
+ v,
697
+ e,
698
+ { version: t, status: m, error: ce, warnings: re },
699
+ (_e = l.value) == null ? void 0 : _e.state
700
+ );
701
+ } catch (ye) {
702
+ console.warn("[report-canvas] ack failed", { reportId: v, sectionId: e, err: ye });
703
+ }
704
+ }
705
+ }
706
+ async function De(e) {
707
+ if (!j.value) {
708
+ j.value = !0, L.value = "";
709
+ try {
710
+ const t = await e();
711
+ l.value = t, _.load(t), await ee.init(t.sections, _.paramState(), _.env());
712
+ } catch (t) {
713
+ L.value = t instanceof Error ? t.message : String(t);
714
+ } finally {
715
+ j.value = !1;
716
+ }
717
+ }
718
+ }
719
+ const la = () => De(() => Da(v)), ia = () => De(() => Ia(v)), ua = (e) => De(() => Ta(v, e));
720
+ async function ca() {
721
+ try {
722
+ I.value = "";
723
+ const e = await mt(v);
724
+ l.value = e, _.load(e), T.value && st.value && Fe.value && (z.value = !0), await He(), await ee.init(e.sections, _.paramState(), _.env());
725
+ } catch (e) {
726
+ I.value = e instanceof Error ? e.message : String(e);
727
+ }
728
+ }
729
+ const Oe = /* @__PURE__ */ new Set();
730
+ let ke = null, ze = !1;
731
+ function Ue() {
732
+ return ke ? (ze = !0, ke) : (ke = (async () => {
733
+ do {
734
+ ze = !1;
735
+ try {
736
+ await da();
737
+ } catch (e) {
738
+ console.warn("[report-canvas] refresh failed", { reportId: v, err: e });
739
+ }
740
+ } while (ze);
741
+ })().finally(() => {
742
+ ke = null;
743
+ }), ke);
744
+ }
745
+ async function da() {
746
+ var ce, re;
747
+ const e = (((ce = l.value) == null ? void 0 : ce.sections) ?? []).map((B) => B.id), t = new Map(
748
+ (((re = l.value) == null ? void 0 : re.sections) ?? []).map((B) => [B.id, B.version])
749
+ ), m = await mt(v);
750
+ l.value = m;
751
+ const q = [...Oe];
752
+ Oe.clear(), _.applyCanvas(m, q) && ee.pushParams(_.paramState());
753
+ const A = m.sections.map((B) => B.id);
754
+ if (A.length !== e.length || A.some((B, ve) => B !== e[ve])) {
755
+ await ee.init(m.sections, _.paramState(), _.env());
756
+ return;
757
+ }
758
+ const C = m.sections.filter(
759
+ (B) => t.get(B.id) !== B.version
760
+ );
761
+ C.length && await ee.swapSections(C);
762
+ }
763
+ const va = ["param_written", "sql_written", "section_written", "deleted", "reordered", "restored"];
764
+ Yt((e) => {
765
+ e.name === "sql_written" && typeof e.data.queryId == "string" && Oe.add(e.data.queryId), va.includes(e.name) && Ue(), U.noteEvent(e);
766
+ }), ea(() => void Ue()), ta((e) => U.seed(e, we.value)), Ce(we, (e) => U.reanchor(e)), U.onLanded(() => void Ue()), Ce([ot, aa], () => {
767
+ l.value && ee.pushEnv(_.env());
768
+ });
769
+ const ma = S(
770
+ () => Object.values(_.results.value).some((e) => e.truncated)
771
+ );
772
+ return ft(async () => {
773
+ window.addEventListener("keydown", We), await ca(), T.value && U.seed(await Jt(), we.value);
774
+ }), Ke(() => window.removeEventListener("keydown", We)), (e, t) => {
775
+ var B, ve, _e, ye, ut, ct;
776
+ const m = ne("FmTooltip"), q = ne("FmPageHead"), A = ne("FmButton"), C = ne("FmIcon"), ce = ne("FmTextField"), re = ne("FmDialog");
777
+ return n(), d("div", {
778
+ ref_key: "root",
779
+ ref: oa,
780
+ class: "relative flex h-full min-h-0 w-full"
781
+ }, [
782
+ r("div", Io, [
783
+ V.viewOnly ? g("", !0) : (n(), te(q, {
784
+ key: 0,
785
+ class: "remove-line-clamping shrink-0",
786
+ title: D.value,
787
+ "back-button": !0,
788
+ actions: J.value,
789
+ "onClick:back": t[0] || (t[0] = (b) => a(K).push({ name: "reports", query: a(M).query })),
790
+ "onClick:action": t[1] || (t[1] = (b) => b === "rename" && Se())
791
+ }, {
792
+ title: me(() => [
793
+ F(m, {
794
+ content: D.value,
795
+ placement: "bottom",
796
+ "z-index": 2e3,
797
+ class: "flex min-w-0 max-w-full justify-start"
798
+ }, {
799
+ default: me(() => [
800
+ r("p", To, u(D.value), 1)
801
+ ]),
802
+ _: 1
803
+ }, 8, ["content"])
804
+ ]),
805
+ _: 1
806
+ }, 8, ["title", "actions"])),
807
+ r("div", Po, [
808
+ !V.viewOnly || ((B = l.value) == null ? void 0 : B.hostFilters) !== !1 ? (n(), d("div", Bo, [
809
+ ((ve = l.value) == null ? void 0 : ve.hostFilters) !== !1 ? (n(), d("div", Lo, [
810
+ F(Ba, {
811
+ modelValue: a(Pe),
812
+ "onUpdate:modelValue": t[3] || (t[3] = (b) => dt(Pe) ? Pe.value = b : null),
813
+ options: a(ot)
814
+ }, {
815
+ default: me(() => [
816
+ F(La, {
817
+ "date-range": a(Te),
818
+ "onUpdate:dateRange": t[2] || (t[2] = (b) => dt(Te) ? Te.value = b : null)
819
+ }, null, 8, ["date-range"])
820
+ ]),
821
+ _: 1
822
+ }, 8, ["modelValue", "options"])
823
+ ])) : (n(), d("div", Oo)),
824
+ nt.value.length && !V.viewOnly ? (n(), d("div", zo, [
825
+ (_e = l.value) != null && _e.canEdit && ((ye = l.value) != null && ye.publishedAt) ? (n(), te(A, {
826
+ key: 0,
827
+ "data-testid": "canvas-versions-open",
828
+ variant: "tertiary",
829
+ "prepend-icon": "history",
830
+ label: a(i)("reportV5.reportCanvas.draft.history"),
831
+ "aria-expanded": w.value,
832
+ onClick: ie
833
+ }, null, 8, ["label", "aria-expanded"])) : g("", !0),
834
+ T.value ? (n(), te(m, {
835
+ key: 1,
836
+ placement: "bottom",
837
+ content: a(i)(
838
+ k.value ? "reportV5.reportAi.chat.cancelSelection" : "reportV5.reportAi.chat.commentWidget"
839
+ )
840
+ }, {
841
+ default: me(() => [
842
+ r("button", {
843
+ "data-testid": "canvas-comment-toggle",
844
+ class: je(["canvas-comment-target flex h-32 w-32 items-center justify-center rounded-md text-fm-color-typo-secondary disabled:opacity-50", k.value && "bg-fm-color-neutral-gray-100 text-fm-color-primary"]),
845
+ "aria-pressed": k.value,
846
+ "aria-label": a(i)("reportV5.reportAi.chat.commentWidget"),
847
+ disabled: Z.value || w.value,
848
+ onClick: St
849
+ }, [
850
+ (n(), d("svg", qo, [
851
+ r("path", {
852
+ d: "M5 3.5h5a6.5 6.5 0 1 1-6.5 6.5V5A1.5 1.5 0 0 1 5 3.5Z",
853
+ fill: k.value ? "currentColor" : "none",
854
+ stroke: "currentColor",
855
+ "stroke-width": "1.5",
856
+ "stroke-linecap": "round",
857
+ "stroke-linejoin": "round"
858
+ }, null, 8, Mo)
859
+ ]))
860
+ ], 10, Uo)
861
+ ]),
862
+ _: 1
863
+ }, 8, ["content"])) : g("", !0),
864
+ T.value && !z.value && !w.value ? (n(), te(A, {
865
+ key: 2,
866
+ "data-testid": "report-canvas-chat-open",
867
+ variant: "tertiary",
868
+ "prepend-icon": "auto_awesome",
869
+ label: a(i)("reportV5.reportAi.chat.open"),
870
+ onClick: t[4] || (t[4] = (b) => z.value = !0)
871
+ }, null, 8, ["label"])) : g("", !0)
872
+ ])) : g("", !0)
873
+ ])) : g("", !0)
874
+ ]),
875
+ k.value ? (n(), d("div", jo, [
876
+ a(Fe) || !a(f).length ? (n(), d("span", Ho, u(At.value), 1)) : (n(), te(A, {
877
+ key: 1,
878
+ "data-testid": "canvas-comment-picked",
879
+ variant: "tertiary",
880
+ "prepend-icon": "auto_awesome",
881
+ label: a(i)("reportV5.reportAi.chat.askPicked"),
882
+ onClick: Rt
883
+ }, null, 8, ["label"]))
884
+ ])) : g("", !0),
885
+ le.value && !V.viewOnly ? (n(), d("div", No, [
886
+ r("span", Ko, u(a(i)("reportV5.reportCanvas.draft.pending", { count: oe.value })), 1),
887
+ r("span", Wo, u(a(i)("reportV5.reportCanvas.draft.hint")), 1),
888
+ L.value ? (n(), d("span", Zo, u(L.value), 1)) : g("", !0),
889
+ F(A, {
890
+ "data-testid": "canvas-draft-discard",
891
+ variant: "tertiary",
892
+ label: a(i)("reportV5.reportCanvas.draft.discard"),
893
+ disabled: j.value,
894
+ onClick: ia
895
+ }, null, 8, ["label", "disabled"]),
896
+ F(A, {
897
+ "data-testid": "canvas-draft-publish",
898
+ variant: "primary",
899
+ label: a(i)("reportV5.reportCanvas.draft.publish"),
900
+ disabled: j.value,
901
+ onClick: la
902
+ }, null, 8, ["label", "disabled"])
903
+ ])) : g("", !0),
904
+ H.value ? (n(), d("div", Go, [
905
+ F(C, {
906
+ name: "check_circle",
907
+ size: "sm"
908
+ }),
909
+ r("span", Qo, u(a(i)("reportV5.reportCanvas.history.restored")), 1),
910
+ r("button", {
911
+ class: "flex h-32 w-32 items-center justify-center rounded-md",
912
+ "aria-label": a(i)("reportV5.reportCanvas.draft.close"),
913
+ onClick: t[5] || (t[5] = (b) => H.value = !1)
914
+ }, [
915
+ F(C, {
916
+ name: "close",
917
+ size: "sm"
918
+ })
919
+ ], 8, Jo)
920
+ ])) : g("", !0),
921
+ ma.value ? (n(), d("div", Xo, u(a(i)("reportV5.reportCanvas.canvas.truncated")), 1)) : g("", !0),
922
+ I.value ? (n(), d("p", Yo, u(I.value), 1)) : g("", !0),
923
+ pa(r("iframe", {
924
+ ref_key: "frame",
925
+ ref: Re,
926
+ "data-testid": "report-canvas-frame",
927
+ class: "min-h-0 grow border-0",
928
+ srcdoc: a(Ea),
929
+ sandbox: "allow-scripts",
930
+ title: a(i)("reportV5.reportCanvas.canvas.title")
931
+ }, null, 8, er), [
932
+ [fa, !I.value]
933
+ ])
934
+ ]),
935
+ a(Be) ? (n(), d("button", {
936
+ key: 0,
937
+ type: "button",
938
+ tabindex: "-1",
939
+ "aria-hidden": "true",
940
+ "data-testid": "canvas-scrim",
941
+ class: "canvas-scrim absolute inset-0 z-20 cursor-default",
942
+ onClick: ue
943
+ })) : g("", !0),
944
+ !V.viewOnly && lt.value && (a(Fe) || !o.value) ? (n(), d("div", {
945
+ key: 1,
946
+ ref_key: "drawer",
947
+ ref: ra,
948
+ class: je(
949
+ a(Fe) ? "w-[380px] shrink-0" : "absolute inset-y-0 right-0 z-30 w-full max-w-[380px] shadow-lg"
950
+ ),
951
+ role: a(Be) ? "dialog" : void 0,
952
+ "aria-modal": a(Be) ? "true" : void 0,
953
+ "aria-label": a(i)(w.value ? "reportV5.reportCanvas.draft.history" : "reportV5.reportAi.chat.title")
954
+ }, [
955
+ w.value ? (n(), te(Vo, {
956
+ key: 0,
957
+ "report-id": a(v),
958
+ "published-at": (ut = l.value) == null ? void 0 : ut.publishedAt,
959
+ timezone: a(_).env().timezone,
960
+ "has-draft": le.value,
961
+ busy: Z.value || j.value,
962
+ onClose: t[6] || (t[6] = (b) => w.value = !1),
963
+ onRestored: p,
964
+ onRestoring: t[7] || (t[7] = (b) => Q.value = b)
965
+ }, null, 8, ["report-id", "published-at", "timezone", "has-draft", "busy"])) : (n(), te(Fa, {
966
+ key: 1,
967
+ "home-draft": Ze.value,
968
+ "onUpdate:homeDraft": t[8] || (t[8] = (b) => Ze.value = b),
969
+ "home-open": pe.value,
970
+ "onUpdate:homeOpen": t[9] || (t[9] = (b) => pe.value = b),
971
+ messages: a(we),
972
+ draft: P.value,
973
+ targets: a(Ve),
974
+ "target-stale": a(Ie),
975
+ streaming: Z.value,
976
+ "turn-id": a(tt),
977
+ phase: sa.value,
978
+ slow: a(Wt),
979
+ "started-at": a(Zt),
980
+ error: a(at),
981
+ interrupted: a(jt),
982
+ blank: st.value,
983
+ run: a(U).run.value,
984
+ "run-anchor-id": a(U).anchorId.value,
985
+ "run-stale": a(U).stale.value,
986
+ "retry-error": a(U).retryError.value,
987
+ "undoable-turn-ids": ((ct = l.value) == null ? void 0 : ct.unpublishedTurnIds) ?? [],
988
+ undoing: j.value,
989
+ "unsent-ids": a(Kt),
990
+ "no-reply-id": a(Qt),
991
+ "chat-id": a(Je),
992
+ "chat-title": a(Bt),
993
+ chats: a(Lt),
994
+ "chats-cursor": a(Xe),
995
+ "chats-loading": a(Ot),
996
+ "chats-error": a(zt),
997
+ switching: a(Ye),
998
+ busy: rt.value,
999
+ stoppable: a(Ht),
1000
+ stopping: a(Nt),
1001
+ earlier: a(Ut),
1002
+ "loading-earlier": a(qt),
1003
+ "onUpdate:draft": t[10] || (t[10] = (b) => P.value = b),
1004
+ onClearTarget: a(kt),
1005
+ onSubmit: Ee,
1006
+ onClose: t[11] || (t[11] = (b) => z.value = !1),
1007
+ onRetry: a(U).retry,
1008
+ onUndo: ua,
1009
+ onResend: Ft,
1010
+ onAskAgain: Pt,
1011
+ onEditRequest: Tt,
1012
+ onStop: It,
1013
+ onAskBuilder: Dt,
1014
+ onCheckStatus: a(U).refresh,
1015
+ onNewChat: $t,
1016
+ onSelectChat: Et,
1017
+ onLoadChats: t[12] || (t[12] = (b) => a(N).loadChats()),
1018
+ onLoadMoreChats: t[13] || (t[13] = (b) => a(N).loadChats(a(Xe) ?? void 0)),
1019
+ onLoadEarlier: t[14] || (t[14] = (b) => a(N).loadEarlier())
1020
+ }, null, 8, ["home-draft", "home-open", "messages", "draft", "targets", "target-stale", "streaming", "turn-id", "phase", "slow", "started-at", "error", "interrupted", "blank", "run", "run-anchor-id", "run-stale", "retry-error", "undoable-turn-ids", "undoing", "unsent-ids", "no-reply-id", "chat-id", "chat-title", "chats", "chats-cursor", "chats-loading", "chats-error", "switching", "busy", "stoppable", "stopping", "earlier", "loading-earlier", "onClearTarget", "onRetry", "onCheckStatus"]))
1021
+ ], 10, tr)) : g("", !0),
1022
+ O.value ? (n(), te(re, {
1023
+ key: 2,
1024
+ modelValue: W.value,
1025
+ "onUpdate:modelValue": t[17] || (t[17] = (b) => W.value = b),
1026
+ overlay: !0,
1027
+ "dismiss-away": !0
1028
+ }, {
1029
+ "dialog-header": me(() => [
1030
+ r("p", ar, u(a(i)("report.common.rename")), 1)
1031
+ ]),
1032
+ default: me(() => [
1033
+ r("div", {
1034
+ onKeydown: ya(ba(be, ["prevent"]), ["enter"])
1035
+ }, [
1036
+ F(ce, {
1037
+ modelValue: de.value,
1038
+ "onUpdate:modelValue": t[15] || (t[15] = (b) => de.value = b),
1039
+ label: a(i)("report.view.report.name"),
1040
+ placeholder: a(i)("report.view.report.enter")
1041
+ }, null, 8, ["modelValue", "label", "placeholder"])
1042
+ ], 40, or)
1043
+ ]),
1044
+ "dialog-footer": me(() => [
1045
+ t[18] || (t[18] = r("div", { class: "grow" }, null, -1)),
1046
+ F(A, {
1047
+ label: a(i)("report.common.cancel"),
1048
+ variant: "tertiary",
1049
+ onClick: t[16] || (t[16] = (b) => W.value = !1)
1050
+ }, null, 8, ["label"]),
1051
+ F(A, {
1052
+ label: a(i)("report.common.save"),
1053
+ variant: "primary",
1054
+ disabled: de.value.trim() === "",
1055
+ onClick: be
1056
+ }, null, 8, ["label", "disabled"])
1057
+ ]),
1058
+ _: 1
1059
+ }, 8, ["modelValue"])) : g("", !0)
1060
+ ], 512);
1061
+ };
1062
+ }
1063
+ }), br = /* @__PURE__ */ bt(rr, [["__scopeId", "data-v-01731798"]]);
1064
+ export {
1065
+ br as default
1066
+ };