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