@webx-ui/module-inbox 0.11.4 → 0.12.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.
@@ -0,0 +1,2768 @@
1
+ import { inject as Ct, defineComponent as be, useModel as Ke, computed as y, ref as q, watch as Ne, openBlock as d, createElementBlock as R, createElementVNode as Q, toDisplayString as A, createCommentVNode as T, createBlock as g, unref as e, withCtx as u, createTextVNode as z, createVNode as o, mergeModels as Qe, nextTick as At, isRef as ut, Fragment as te, renderList as fe, useTemplateRef as zt, createSlots as dt, toRaw as Ut, normalizeClass as Oe, mergeProps as Nt, resolveDynamicComponent as Wt, defineAsyncComponent as De } from "vue";
2
+ import { useLocales as ye, localizedValue as me, WxBadge as de, WxAction as Ze, WxAutocomplete as It, useModal as rt, WxDialog as ct, WxAlert as _e, WxSkeleton as Et, WxFormItem as D, WxTextarea as Ft, WxSelect as ce, WxRadioGroup as Ot, WxCheckboxGroup as Rt, WxCheckbox as he, WxDatePicker as Re, WxText as H, WxInput as ne, WxSpace as mt, WxButton as ue, toast as se, useElementWidth as qt, createModal as pt, WxTabs as Dt, WxTable as Mt, WxEntityCard as Pt, WxAvatar as at, WxIcon as re, WxTooltip as Bt, confirm as ft, WxSegmented as vt, WxLocales as Lt, WxRichText as nt, WxTimePicker as st, WxInputNumber as ke, WxTagsInput as Ht, WxCard as jt, WxEmpty as Xt, WxSortableList as Yt } from "@webx-ui/core";
3
+ import { useAdmin as Ve, i18nKey as Gt, useTranslate as ve, createRelationsApi as Kt, useErrorText as Me, rowMenuWidth as Qt, WxScreenHead as Zt, WxRowMenu as Ge, WxDate as ot, WxFilterChips as Jt, useRichTextLabels as el, useShortcodesWhen as tl, useRemoveConfirm as ll, WxCodeField as al, codify as nl } from "@webx-ui/module-admin";
4
+ import { useRoute as sl, useRouter as ol } from "vue-router";
5
+ const il = {
6
+ module: {
7
+ title: "Inbox"
8
+ },
9
+ panel: {
10
+ forms: "Forms",
11
+ "new-form": "New form",
12
+ "no-forms": "No forms yet.",
13
+ "no-forms-help": "A form is a few questions and a list of who hears the answers.",
14
+ unread: "Unread",
15
+ submissions: "Submissions in all",
16
+ off: "Off",
17
+ settings: "Settings",
18
+ duplicate: "Duplicate",
19
+ delete: "Delete",
20
+ "delete-form-title": "Delete “:form”?",
21
+ "delete-form-text": "The form and its questions go. This cannot be undone.",
22
+ cancel: "Cancel",
23
+ save: "Save",
24
+ saved: "Saved.",
25
+ deleted: "Deleted.",
26
+ duplicated: "A copy was made.",
27
+ failed: "Some values were not accepted. Check the highlighted fields.",
28
+ "reorder-failed": "The new order could not be saved.",
29
+ reorder: "Reorder",
30
+ "new-form-title": "New form",
31
+ title: "Title",
32
+ description: "Description",
33
+ "description-help": "A line under the title of the form on the site and in a dialog. Empty — nothing is shown.",
34
+ slug: "Address",
35
+ "slug-help": "What the form is called on the site and where it posts.",
36
+ "is-enabled": "Active",
37
+ "is-enabled-help": "A form that is off is neither drawn nor accepted.",
38
+ "tab-general": "General",
39
+ "tab-fields": "Fields",
40
+ "tab-notifications": "Notifications",
41
+ "tab-antispam": "Antispam",
42
+ "tab-embed": "Embedding",
43
+ "after-sending": "After sending",
44
+ "thank-you-heading": "Heading",
45
+ "thank-you-text": "Text",
46
+ "submit-text": "Text on the button",
47
+ redirect: "Instead of the thank-you, go to",
48
+ "redirect-help": "A page of the site opens in the language the form was sent in, or in the main one when it has no translation. Nowhere — the thank-you takes the form’s place.",
49
+ recipients: "Who is written to",
50
+ "recipients-help": "Nobody here means nobody is told. The submission is kept either way.",
51
+ "mail-route": "Letters leave through",
52
+ "no-recipients": "Nobody yet.",
53
+ "add-admin": "Add an administrator",
54
+ "add-email": "Add an address",
55
+ remove: "Remove",
56
+ "remove-recipient-title": "Remove this recipient?",
57
+ "remove-recipient-text": "They stop being told when something arrives.",
58
+ "email-field": "Field with the visitor’s address",
59
+ "email-field-help": "A reply to the letter goes to this address.",
60
+ "email-field-help-channels": "A reply to the letter goes to this address; in channels it is {{reply_to}}.",
61
+ "notify-via": "How to tell about a submission",
62
+ "via-email": "By letter to addresses",
63
+ "via-channels": "Through notification channels",
64
+ "notify-through": "Notify through",
65
+ "notify-through-help": "Channels of the Notifications section: Telegram, e-mail and others. A submission from the site goes to each of them by its own template.",
66
+ "pick-channels": "Add a channel",
67
+ "no-channels": "No channels chosen.",
68
+ "no-channels-yet": "No channels yet.",
69
+ "set-up-channels": "Set up channels",
70
+ channels: "Channels",
71
+ "channels-none": "Nothing was sent through channels.",
72
+ "channels-failed": "A channel did not deliver the notification",
73
+ "no-email-field": "None",
74
+ honeypot: "Hidden field",
75
+ "honeypot-help": "A field nobody sees and a robot fills in.",
76
+ "min-seconds": "Fastest a person could send it, in seconds",
77
+ "min-seconds-help": "Zero switches the check off.",
78
+ throttle: "Sends a minute from one address",
79
+ "throttle-help": "Zero switches the limit off.",
80
+ captcha: "Captcha",
81
+ "captcha-keys": "The keys are not set in the panel but in the site’s .env: WEBX_INBOX_RECAPTCHA_KEY / WEBX_INBOX_RECAPTCHA_SECRET for reCAPTCHA, WEBX_INBOX_TURNSTILE_KEY / WEBX_INBOX_TURNSTILE_SECRET for Turnstile.",
82
+ "captcha-off": "Off",
83
+ "captcha-recaptcha": "reCAPTCHA",
84
+ "captcha-turnstile": "Turnstile",
85
+ "captcha-unconfigured": "The site has no keys for this captcha yet, so the form refuses every submission until they are in its .env.",
86
+ "captcha-recaptcha-checkbox": "This site draws reCAPTCHA as the “I’m not a robot” checkbox, so its keys must be v2 Checkbox keys. To run it invisibly, create v2 Invisible keys and set WEBX_INBOX_RECAPTCHA_TYPE=invisible.",
87
+ "captcha-recaptcha-invisible": "This site runs reCAPTCHA invisibly when the form is sent, so its keys must be v2 Invisible keys (WEBX_INBOX_RECAPTCHA_TYPE=invisible).",
88
+ "captcha-recaptcha-v3": "This site runs reCAPTCHA v3: no widget, only a score checked when the form is sent, so its keys must be v3 keys (WEBX_INBOX_RECAPTCHA_TYPE=v3).",
89
+ "captcha-turnstile-checkbox": "This site draws Turnstile when the page opens, and a Managed widget shows visitors “Verify you are human”. To run it invisibly, set WEBX_INBOX_TURNSTILE_MODE=invisible and the widget mode to Invisible in Cloudflare.",
90
+ "captcha-turnstile-invisible": "This site runs Turnstile invisibly when the form is sent. Set the widget mode to Invisible in Cloudflare: a Managed widget still shows a challenge when it decides one is needed.",
91
+ "embed-blade": "On a page of the site",
92
+ "embed-blade-help": "Put the tag where the form belongs. The markup is published and rewritten by the site.",
93
+ "embed-block": "In the block builder",
94
+ "embed-block-help": "A block type prints the same tag, so an editor drops the form in without touching a template.",
95
+ "embed-block-panel-help": "On this site block templates are written in the panel, in Blocks: put the same tag into the template of a block there.",
96
+ "embed-extras": "Filled in and placed",
97
+ "embed-extras-help": ":values fills the hidden fields by their name; placement names where the form stands, so the submission remembers it and the site can style each place.",
98
+ loading: "Loading…",
99
+ "embed-names": "Names of the fields",
100
+ "embed-names-help": "A hidden field is filled in by the page: the address it was sent from, a product, a campaign.",
101
+ copy: "Copy",
102
+ copied: "Copied.",
103
+ statuses: "Statuses",
104
+ "new-status": "New status",
105
+ "status-key": "Key",
106
+ "status-color": "Colour",
107
+ "status-default": "Given to a new submission",
108
+ "status-spam": "Spam",
109
+ "status-closed": "Nothing further expected",
110
+ "in-use": "In use",
111
+ "delete-status-title": "Delete “:status”?",
112
+ "delete-status-text": "Only a status nothing is in can go.",
113
+ "no-statuses": "No statuses yet.",
114
+ "color-default": "Grey",
115
+ "color-primary": "Blue",
116
+ "color-success": "Green",
117
+ "color-warning": "Amber",
118
+ "color-info": "Cyan",
119
+ "color-danger": "Red",
120
+ // The submissions: the list on the right of the section, and one of them opened.
121
+ id: "ID",
122
+ received: "Received",
123
+ status: "Status",
124
+ assignee: "Assignee",
125
+ unassigned: "Nobody",
126
+ "submissions-empty": "Nothing has come in through this form yet.",
127
+ "search-submissions": "Search the answers",
128
+ "view-all": "All",
129
+ "view-unread": "Unread",
130
+ export: "Export",
131
+ "new-submission": "New submission",
132
+ "new-submission-title": "A submission by hand",
133
+ "new-submission-help": "For one that came by telephone or on paper. It is written the same way and lands in the same list.",
134
+ created: "Added.",
135
+ submission: "Submission :id",
136
+ previous: "Previous",
137
+ next: "Next",
138
+ "mark-read": "Mark as read",
139
+ "mark-unread": "Mark as unread",
140
+ "delete-submission-title": "Delete this submission?",
141
+ "delete-submission-text": "It goes with its attachments. This cannot be undone.",
142
+ selected: ":count selected",
143
+ "move-to": "Move to",
144
+ "delete-selected-title": "Delete :count submissions?",
145
+ answers: "Answers",
146
+ attachments: "Attachments",
147
+ details: "Details",
148
+ "meta-page": "Page",
149
+ "meta-placement": "Placement",
150
+ "any-placement": "Any placement",
151
+ "placement-none": "Not specified",
152
+ "meta-referrer": "Came from",
153
+ "meta-landing": "Landing page",
154
+ "meta-utm-first": "First visit",
155
+ "meta-ip": "Address",
156
+ "meta-agent": "Browser",
157
+ "meta-locale": "Language",
158
+ "meta-source": "How it arrived",
159
+ "source-web": "From the site",
160
+ "source-panel": "Typed in",
161
+ notified: "The notification went out",
162
+ "not-notified": "No notification was sent",
163
+ "notify-failed": "The notification could not be sent",
164
+ reply: "Reply by mail",
165
+ log: "What has happened",
166
+ "event-created": "Arrived",
167
+ "event-status": "Status: :to",
168
+ "event-assignee": "Given to :to",
169
+ "event-unassigned": "Left to nobody",
170
+ "event-note": "A note was added",
171
+ "event-notified": "The notification went out",
172
+ "event-handled": "Handed to :name",
173
+ "event-handler-error": ":name failed: :error",
174
+ system: "System",
175
+ "no-answers": "Nothing was filled in.",
176
+ download: "Download",
177
+ "no-files-by-hand": "A file cannot be attached by hand: the files a submission carries are what was posted with it.",
178
+ "submissions-none": "Nothing here under this filter.",
179
+ "notifies-nobody": "Nobody is told about this form",
180
+ "notifies-nobody-text": "Every submission is kept here, but no letter goes out. Add a recipient on the Notifications tab.",
181
+ "notifies-nobody-short": "Nobody is told",
182
+ "recipient-admin_deleted": "This administrator no longer exists and gets no letter.",
183
+ "recipient-admin_inactive": "This administrator is switched off and gets no letter.",
184
+ "recipient-invalid_email": "This is not an e-mail address.",
185
+ "event-no-recipients": "Nobody was told: the form names no recipients",
186
+ "notified-nobody": "No notification: the form names nobody to tell",
187
+ "notify-queued": "The notification is waiting in the queue",
188
+ "notify-again": "Send the notification again",
189
+ "notify-sent-again": "The notification has been sent again",
190
+ "notify-recipient-queued": "waiting",
191
+ "notify-recipient-delivered": "sent",
192
+ "notify-recipient-failed": "failed",
193
+ "notify-recipient-trapped": "test transport",
194
+ "event-notify-queued": "The notification was queued",
195
+ "event-notify-failed": "The notification to :to failed",
196
+ "event-value": "Answer “:field” corrected: “:from” → “:to”"
197
+ },
198
+ fields: {
199
+ field: "Field",
200
+ "new-field": "New field",
201
+ "edit-field": "Field",
202
+ edit: "Edit",
203
+ "no-fields": "No questions yet.",
204
+ "no-fields-help": "A form with no fields draws nothing on the page.",
205
+ "save-first": "Save the form first, then write its questions.",
206
+ delete: "Delete",
207
+ "delete-title": "Delete “:field”?",
208
+ "delete-text": "It stops being asked. Answers already given keep it.",
209
+ cancel: "Cancel",
210
+ save: "Save",
211
+ name: "Name",
212
+ "name-help": "Needed for variables in notifications — {{field.:name}} — and for integrations. Usually there is no need to change it.",
213
+ "name-renamed": "Templates of notification channels that use {{field.:old}} stop working — change them to {{field.:new}}. Answers already received stay with the field.",
214
+ advanced: "Advanced",
215
+ type: "Type",
216
+ title: "Label",
217
+ placeholder: "Placeholder",
218
+ help: "Hint under the field",
219
+ "is-enabled": "Shown",
220
+ "is-required": "Required",
221
+ "is-fullsize": "Full width",
222
+ "is-halfsize": "Half width",
223
+ "in-table": "A column in the list",
224
+ choices: "Choices",
225
+ "choice-value": "Value",
226
+ "choice-label": "Label",
227
+ "add-choice": "Add a choice",
228
+ "no-choices": "No choices yet. A field with none accepts nothing.",
229
+ maxlength: "Longest answer, in characters",
230
+ rows: "Height, in lines",
231
+ pattern: "Pattern the answer has to match",
232
+ "pattern-help": "The browser’s own, written without delimiters: [0-9+ ()-]{6,}",
233
+ earliest: "Earliest date",
234
+ latest: "Latest date",
235
+ "min-choices": "Fewest ticks",
236
+ "max-choices": "Most ticks",
237
+ view: "Show the choices as",
238
+ "view-list": "List",
239
+ "view-cards": "Cards",
240
+ "view-help": "A card shows a description and a picture with its choice. On a narrow screen the cards stand one under another.",
241
+ columns: "Cards in a row",
242
+ "choice-description": "Description",
243
+ "choice-image": "Picture",
244
+ "consent-text": "The sentence beside the tick",
245
+ "consent-text-help": "A link is allowed here: it is printed as written.",
246
+ "max-size": "Largest file, in kilobytes",
247
+ extensions: "Extensions allowed",
248
+ "extensions-help": "Comma separated. Empty means the list the site allows.",
249
+ multiple: "Several files at once",
250
+ "type-text": "Text",
251
+ "type-email": "E-mail",
252
+ "type-tel": "Telephone",
253
+ "type-textarea": "Long text",
254
+ "type-select": "Drop-down",
255
+ "type-radio": "One of several",
256
+ "type-checkbox": "Several of several",
257
+ "type-consent": "Consent",
258
+ "type-date": "Date",
259
+ "type-file": "File",
260
+ "type-hidden": "Hidden",
261
+ show: "Show",
262
+ "show-always": "Always",
263
+ "show-when": "If",
264
+ "show-unless": "Unless",
265
+ "condition-field": "Field above",
266
+ "condition-values": "Any of these answers",
267
+ "condition-and": "and",
268
+ "condition-add": "One more condition",
269
+ "condition-remove": "Remove",
270
+ "condition-help": "Several answers in a row: any of them will do. Several rows: all of them must hold.",
271
+ "condition-none": "A condition counts on a choice field above this one, and there is none yet.",
272
+ "condition-ticked": "Ticked",
273
+ "condition-stranger": "This field is no longer a choice field above this one. Pick another or remove the row.",
274
+ "condition-removed": "No such answer: :value",
275
+ "condition-kept": "Also hidden if :condition. That stays as it is.",
276
+ "shown-when": "if :condition",
277
+ "shown-unless": "unless :condition",
278
+ "condition-broken": "Check the condition",
279
+ "problem-unknown-field": "The condition names “:field”, and the form has no such field.",
280
+ "problem-not-choice": "The condition names “:field”, which is not a choice field.",
281
+ "problem-not-before": "The condition names “:field”, which is not above this field. Drag it higher.",
282
+ "problem-unknown-value": "“:field” no longer has the answer “:value”.",
283
+ "type-step": "Step",
284
+ "add-step": "Step",
285
+ "new-step": "New step",
286
+ "edit-step": "Step",
287
+ "step-help": "The fields under a step, down to the next one, are asked on one screen; «Next» checks them before the visitor goes on.",
288
+ "step-title": "Title of the step",
289
+ "step-label": "Short label in the indicator",
290
+ "step-label-help": "For a long title. Empty — the title itself.",
291
+ "step-hint": "Line under the title",
292
+ "step-next": "Words of the «Next» button",
293
+ "step-next-help": "Empty — the site’s own word.",
294
+ "step-off-help": "A step that is off takes its fields with it: they are not asked.",
295
+ "step-numbered": "Step :number · :title",
296
+ "step-empty": "Nothing under this step yet: drag a field below it. The site does not show an empty step.",
297
+ "step-empty-badge": "Empty",
298
+ "step-name-help": "The step is called by it in MCP, and «Next» names it to the server when it checks the step.",
299
+ "delete-step-text": "Its fields join the step above. Answers already given keep them.",
300
+ "type-summary": "Summary",
301
+ "summary-help": "Shows the visitor the answers given above it, each with «Edit», before they send the form. Nothing of it goes into the submission.",
302
+ "summary-fields": "What to show",
303
+ "summary-fields-help": "Empty — every field above it, but consents, files and hidden fields.",
304
+ "summary-flat": "The form has no steps: the site shows a summary only in a form of steps, where the answers are out of sight.",
305
+ "summary-all": "Every field above it",
306
+ "type-datetime": "Date and time",
307
+ "datetime-help": "The visitor picks a day in a calendar and a time from a list, in the time zone of the site. A time already gone can never be chosen. Two visitors may choose the same time: whoever reads the submission settles it.",
308
+ "time-step": "Step of the times",
309
+ "time-step-minutes": ":minutes min",
310
+ "time-from": "From",
311
+ "time-to": "To",
312
+ "time-help": "The last time is a step before «To»: 09:00–17:00 by 30 minutes ends at 16:30.",
313
+ weekdays: "Days of the week",
314
+ "weekdays-help": "None chosen — every day.",
315
+ "weekdays-workdays": "Weekdays",
316
+ "timezone-label": "Words about the time zone",
317
+ "timezone-label-help": "Empty — the site says it itself in the visitor’s language, by the name of the zone: :label.",
318
+ "timezone-site": "Time zone of the site: :zone — changed in Settings › Contacts.",
319
+ "times-preview": "Times of a day: :times"
320
+ },
321
+ relations: {
322
+ form: "Form",
323
+ "field-search": "Find a form by its name or address",
324
+ "field-empty": "No form",
325
+ "field-remove": "Remove the form",
326
+ "field-missing": "No such form",
327
+ "field-off": "Switched off",
328
+ "field-nothing": "No form matches",
329
+ "field-searching": "Searching…",
330
+ unknown: "The Inbox has no form “:slug”. It has: :forms.",
331
+ "unknown-none": "The Inbox has no form “:slug” — it has no forms yet."
332
+ }
333
+ }, it = /* @__PURE__ */ new WeakSet();
334
+ function Se() {
335
+ try {
336
+ const { i18n: a } = Ve();
337
+ it.has(a) || (a.defaults("webx-inbox", il), it.add(a));
338
+ } catch {
339
+ }
340
+ }
341
+ function ul() {
342
+ const a = Ct(Gt, null), n = ye();
343
+ return (r) => {
344
+ const x = a?.state.locale;
345
+ return (x === void 0 ? void 0 : r.title[x]) || me(r.title, n.active.value, r.key);
346
+ };
347
+ }
348
+ const dl = { class: "wx-inbox-form-field" }, rl = {
349
+ key: 0,
350
+ class: "wx-inbox-form-field__chosen"
351
+ }, cl = { class: "wx-inbox-form-field__text" }, ml = { class: "wx-inbox-form-field__title" }, pl = {
352
+ key: 0,
353
+ class: "wx-inbox-form-field__slug"
354
+ }, fl = {
355
+ key: 1,
356
+ class: "wx-inbox-form-field__empty"
357
+ }, vl = { class: "wx-inbox-form-field__search" }, hl = /* @__PURE__ */ be({
358
+ name: "WxInboxFormField",
359
+ __name: "FormField",
360
+ props: /* @__PURE__ */ Qe({
361
+ disabled: { type: Boolean, default: !1 },
362
+ placeholder: { default: void 0 },
363
+ emptyText: { default: void 0 }
364
+ }, {
365
+ modelValue: { default: null },
366
+ modelModifiers: {}
367
+ }),
368
+ emits: ["update:modelValue"],
369
+ setup(a) {
370
+ const n = a, r = Ke(a, "modelValue");
371
+ Se();
372
+ const x = Ve(), p = ve("webx-inbox"), F = Kt(x, "inbox-form"), l = y(() => typeof r.value == "string" ? r.value.trim() : ""), t = q(/* @__PURE__ */ new Map()), _ = q(/* @__PURE__ */ new Set()), N = q([]), I = q(!1), W = q("");
373
+ function j(E) {
374
+ const M = new Map(t.value);
375
+ for (const k of E) k.slug && M.set(k.slug, k);
376
+ t.value = M;
377
+ }
378
+ async function $(E) {
379
+ if (!(E === "" || t.value.has(E) || _.value.has(E)))
380
+ try {
381
+ const M = await F.search(E);
382
+ j(M), M.some((k) => k.slug === E) || (_.value = /* @__PURE__ */ new Set([..._.value, E]));
383
+ } catch {
384
+ }
385
+ }
386
+ Ne(l, (E) => {
387
+ $(E);
388
+ }, { immediate: !0 });
389
+ const V = y(() => l.value === "" ? null : t.value.get(l.value) ?? null), ee = y(() => l.value === "" ? null : V.value === null ? _.value.has(l.value) ? p("relations.field-missing") : null : V.value.visible ? null : p("relations.field-off")), X = y(
390
+ () => N.value.filter((E) => E.slug && E.slug !== l.value).map((E) => ({
391
+ value: E.title,
392
+ description: [E.slug, E.visible ? null : p("relations.field-off")].filter((M) => typeof M == "string" && M !== "").join(" · "),
393
+ id: E.slug
394
+ }))
395
+ );
396
+ async function S(E) {
397
+ I.value = !0;
398
+ try {
399
+ const M = await F.search(E);
400
+ N.value = M, j(M);
401
+ } catch {
402
+ N.value = [];
403
+ } finally {
404
+ I.value = !1;
405
+ }
406
+ }
407
+ function Y() {
408
+ N.value.length === 0 && !I.value && S(W.value);
409
+ }
410
+ function G(E) {
411
+ typeof E.id != "string" || E.id === "" || (r.value = E.id, At(() => {
412
+ W.value = "";
413
+ }));
414
+ }
415
+ function B() {
416
+ r.value = null;
417
+ }
418
+ const Z = y(() => n.placeholder ?? p("relations.field-search"));
419
+ return (E, M) => (d(), R("div", dl, [
420
+ l.value !== "" ? (d(), R("div", rl, [
421
+ Q("span", cl, [
422
+ Q("span", ml, A(V.value?.title ?? l.value), 1),
423
+ V.value ? (d(), R("span", pl, A(l.value), 1)) : T("", !0)
424
+ ]),
425
+ ee.value ? (d(), g(e(de), {
426
+ key: 0,
427
+ type: "warning"
428
+ }, {
429
+ default: u(() => [
430
+ z(A(ee.value), 1)
431
+ ]),
432
+ _: 1
433
+ })) : T("", !0),
434
+ n.disabled ? T("", !0) : (d(), g(e(Ze), {
435
+ key: 1,
436
+ type: "remove",
437
+ size: "sm",
438
+ title: e(p)("relations.field-remove"),
439
+ onClick: B
440
+ }, null, 8, ["title"]))
441
+ ])) : (d(), R("p", fl, A(n.emptyText ?? e(p)("relations.field-empty")), 1)),
442
+ Q("div", vl, [
443
+ o(e(It), {
444
+ modelValue: W.value,
445
+ "onUpdate:modelValue": M[0] || (M[0] = (k) => W.value = k),
446
+ options: X.value,
447
+ remote: "",
448
+ teleport: "",
449
+ loading: I.value,
450
+ "loading-text": e(p)("relations.field-searching"),
451
+ "empty-text": e(p)("relations.field-nothing"),
452
+ placeholder: Z.value,
453
+ "aria-label": Z.value,
454
+ disabled: n.disabled,
455
+ onSearch: S,
456
+ onOpen: Y,
457
+ onSelect: G
458
+ }, null, 8, ["modelValue", "options", "loading", "loading-text", "empty-text", "placeholder", "aria-label", "disabled"])
459
+ ])
460
+ ]));
461
+ }
462
+ }), Te = (a, n) => {
463
+ const r = a.__vccOpts || a;
464
+ for (const [x, p] of n)
465
+ r[x] = p;
466
+ return r;
467
+ }, bl = /* @__PURE__ */ Te(hl, [["__scopeId", "data-v-91f60441"]]);
468
+ function ra(a = {}) {
469
+ const n = a.path ?? "/inbox";
470
+ return {
471
+ id: "inbox",
472
+ path: n,
473
+ landing: a.landing ?? !0,
474
+ routes: [
475
+ // The section's own path travels as a prop, so a panel that mounted it somewhere else
476
+ // still links between its screens correctly.
477
+ {
478
+ path: n,
479
+ name: "webx.inbox",
480
+ meta: { help: "inbox.index" },
481
+ component: () => import("./InboxPage-D1j4r5Wf.js"),
482
+ props: { base: n }
483
+ },
484
+ {
485
+ path: `${n}/statuses`,
486
+ name: "webx.inbox.statuses",
487
+ meta: { help: "inbox.statuses" },
488
+ component: () => import("./StatusesPage-4pt80oR1.js"),
489
+ props: { base: n }
490
+ },
491
+ {
492
+ path: `${n}/forms/:id(\\d+)`,
493
+ name: "webx.inbox.form",
494
+ meta: { help: "inbox.form" },
495
+ component: () => import("./FormEditorPage-BsJTI_wN.js"),
496
+ props: { base: n }
497
+ },
498
+ // A submission has an address of its own, not a dialog over the list (§11): it goes in
499
+ // the mail to whoever deals with it, it gets pasted into a chat, an agent links to it.
500
+ {
501
+ path: `${n}/submissions/:id(\\d+)`,
502
+ name: "webx.inbox.submission",
503
+ meta: { help: "inbox.submission" },
504
+ component: () => import("./SubmissionPage-DyygefM1.js"),
505
+ props: { base: n }
506
+ }
507
+ ],
508
+ // A form of the Inbox as a field of any screen or block — the contact block's form — chosen
509
+ // by name and kept by slug. Here and not in the panel: what it lists is this section's.
510
+ types: {
511
+ "wx-inbox-form": { component: bl, kind: "field" }
512
+ }
513
+ };
514
+ }
515
+ const Fe = /* @__PURE__ */ new WeakMap();
516
+ function Pe(a) {
517
+ const n = `${a.apiPath}/inbox`, r = (l) => l.data, x = () => {
518
+ }, p = (l) => (Fe.delete(a.http), l);
519
+ function F() {
520
+ const l = Fe.get(a.http);
521
+ if (l !== void 0)
522
+ return l.then((_) => [..._]);
523
+ const t = a.http.get(`${n}/statuses`).then(r);
524
+ return Fe.set(a.http, t), t.catch(() => Fe.delete(a.http)), t.then((_) => [..._]);
525
+ }
526
+ return {
527
+ forms: () => a.http.get(`${n}/forms`).then(r),
528
+ form: (l) => a.http.get(`${n}/forms/${l}`).then(r),
529
+ createForm: (l) => a.http.post(`${n}/forms`, l).then(r),
530
+ saveForm: (l, t) => a.http.put(`${n}/forms/${l}`, t).then(r),
531
+ removeForm: (l) => a.http.delete(`${n}/forms/${l}`).then(x),
532
+ duplicateForm: (l) => a.http.post(`${n}/forms/${l}/duplicate`, {}).then(r),
533
+ sortForms: (l) => a.http.post(`${n}/forms/sorting`, { ids: l }).then(x),
534
+ fields: (l) => a.http.get(`${n}/forms/${l}/fields`).then(r),
535
+ createField: (l, t) => a.http.post(`${n}/forms/${l}/fields`, t).then(r),
536
+ saveField: (l, t) => a.http.put(`${n}/fields/${l}`, t).then(r),
537
+ removeField: (l) => a.http.delete(`${n}/fields/${l}`).then(x),
538
+ sortFields: (l, t) => a.http.post(`${n}/forms/${l}/fields/sorting`, { ids: t }).then(x),
539
+ statuses: F,
540
+ createStatus: (l) => a.http.post(`${n}/statuses`, l).then(r).then(p),
541
+ saveStatus: (l, t) => a.http.put(`${n}/statuses/${l}`, t).then(r).then(p),
542
+ removeStatus: (l) => a.http.delete(`${n}/statuses/${l}`).then(x).then(p),
543
+ sortStatuses: (l) => a.http.post(`${n}/statuses/sorting`, { ids: l }).then(x).then(p),
544
+ recipients: () => a.http.get(`${n}/recipients`).then(r),
545
+ submissions: (l, t = {}) => a.http.get(`${n}/forms/${l}/submissions`, { query: Ye(t) }).then((_) => ({
546
+ ..._.meta,
547
+ data: _.data,
548
+ columns: _.columns,
549
+ counts: _.counts,
550
+ // Optional on the wire: a server from before placements answers without them.
551
+ placements: _.placements ?? []
552
+ })),
553
+ submission: (l, t = {}) => a.http.get(`${n}/submissions/${l}`, { query: Ye(t) }).then(r),
554
+ createSubmission: (l, t) => a.http.post(`${n}/forms/${l}/submissions`, { fields: t }).then(r),
555
+ saveSubmission: (l, t) => a.http.put(`${n}/submissions/${l}`, t).then(r),
556
+ removeSubmission: (l) => a.http.delete(`${n}/submissions/${l}`).then(x),
557
+ notifySubmission: (l) => a.http.post(`${n}/submissions/${l}/notify`).then(r),
558
+ massSubmissions: (l) => a.http.post(`${n}/submissions/mass`, l).then(r),
559
+ exportUrl: (l, t = {}) => {
560
+ const _ = new URLSearchParams();
561
+ for (const [I, W] of Object.entries(Ye(t)))
562
+ W != null && W !== "" && _.set(I, String(W));
563
+ const N = _.toString();
564
+ return `${n}/forms/${l}/submissions/export${N === "" ? "" : `?${N}`}`;
565
+ }
566
+ };
567
+ }
568
+ function Ye(a) {
569
+ return {
570
+ view: a.view === void 0 || a.view === "" ? void 0 : a.view,
571
+ search: a.search === void 0 || a.search === "" ? void 0 : a.search,
572
+ assignee: a.assignee ?? void 0,
573
+ placement: a.placement ?? void 0,
574
+ sort: a.sort ?? void 0,
575
+ page: a.page,
576
+ per_page: a.per_page
577
+ };
578
+ }
579
+ function ca(a, n, r) {
580
+ return y({
581
+ get: () => a.value[n] ?? r,
582
+ set: (x) => {
583
+ const p = { ...a.value };
584
+ x === "" || x === null || x === void 0 ? delete p[n] : p[n] = x, a.value = p;
585
+ }
586
+ });
587
+ }
588
+ const yl = 10;
589
+ function ie(a) {
590
+ return a.type === "step";
591
+ }
592
+ function gl(a) {
593
+ return a.type !== "step" && a.type !== "summary";
594
+ }
595
+ function wl(a) {
596
+ let n = !0;
597
+ return a.filter((r) => ie(r) ? (n = r.is_enabled, !1) : n && r.is_enabled && gl(r));
598
+ }
599
+ function ht(a) {
600
+ return a.findIndex(ie) > 0;
601
+ }
602
+ function xl(a) {
603
+ const n = a.filter(ie).length;
604
+ return n === 0 ? 0 : n + (ht(a) ? 1 : 0);
605
+ }
606
+ function kl(a) {
607
+ const n = /* @__PURE__ */ new Map();
608
+ let r = ht(a) ? 1 : 0;
609
+ for (const x of a)
610
+ ie(x) && n.set(x.id, ++r);
611
+ return n;
612
+ }
613
+ function _l(a) {
614
+ const n = /* @__PURE__ */ new Set();
615
+ return a.forEach((r, x) => {
616
+ const p = a[x + 1];
617
+ ie(r) && (p === void 0 || ie(p)) && n.add(r.id);
618
+ }), n;
619
+ }
620
+ function Vl(a, n) {
621
+ const r = a.indexOf(n);
622
+ return !ie(n) && a.slice(0, Math.max(r, 0)).some(ie);
623
+ }
624
+ const Sl = { class: "wx-inbox-by-hand" }, Tl = {
625
+ key: 6,
626
+ class: "wx-inbox-by-hand__moment"
627
+ }, $l = /* @__PURE__ */ be({
628
+ __name: "SubmissionCreateDialog",
629
+ props: {
630
+ form: {}
631
+ },
632
+ setup(a) {
633
+ const n = a, { resolve: r, dismiss: x, open: p } = rt(), F = Ve(), l = Pe(F), t = ye();
634
+ Se();
635
+ const _ = ve("webx-inbox"), N = Me(), I = q([]), W = q(!0), j = q(!1), $ = q({}), V = q({}), ee = y(() => I.value.filter((v) => v.type !== "file")), X = y(() => I.value.some((v) => v.type === "file"));
636
+ function S(v) {
637
+ return V.value[`fields.${v.key}`]?.[0];
638
+ }
639
+ function Y(v) {
640
+ return me(v.title, t.active.value, v.key);
641
+ }
642
+ function G(v, b = "") {
643
+ return me(
644
+ v,
645
+ t.active.value,
646
+ b
647
+ );
648
+ }
649
+ function B(v) {
650
+ return (v.options.choices ?? []).map((b) => ({
651
+ value: b.value,
652
+ label: G(b.label, b.value)
653
+ }));
654
+ }
655
+ function Z(v) {
656
+ return $.value[v.key];
657
+ }
658
+ function E(v) {
659
+ const [b, f] = String(v.options["time-from"] ?? "09:00").split(":").map(Number), [m, U] = String(v.options["time-to"] ?? "17:00").split(":").map(Number), w = Number(v.options["time-step"] ?? 30), O = (m ?? 17) * 60 + (U ?? 0), L = [];
660
+ for (let ae = (b ?? 9) * 60 + (f ?? 0); w > 0 && ae + w <= O; ae += w) {
661
+ const ge = `${String(Math.floor(ae / 60)).padStart(2, "0")}:${String(ae % 60).padStart(2, "0")}`;
662
+ L.push({ value: ge, label: ge });
663
+ }
664
+ return L;
665
+ }
666
+ async function M() {
667
+ try {
668
+ const v = await l.form(n.form.id);
669
+ I.value = wl(v.fields ?? []);
670
+ for (const b of I.value)
671
+ $.value[b.key] = b.type === "checkbox" ? [] : b.type === "consent" ? !1 : b.type === "datetime" ? { date: "", time: "" } : "";
672
+ } catch (v) {
673
+ se.danger(N(v));
674
+ } finally {
675
+ W.value = !1;
676
+ }
677
+ }
678
+ M();
679
+ async function k() {
680
+ j.value = !0, V.value = {};
681
+ try {
682
+ r(await l.createSubmission(n.form.id, $.value));
683
+ } catch (v) {
684
+ const b = v.body;
685
+ b?.errors ? (V.value = b.errors, se.danger(_("panel.failed"))) : se.danger(N(v));
686
+ } finally {
687
+ j.value = !1;
688
+ }
689
+ }
690
+ return (v, b) => (d(), g(e(ct), {
691
+ open: e(p),
692
+ "onUpdate:open": b[1] || (b[1] = (f) => ut(p) ? p.value = f : null),
693
+ title: e(_)("panel.new-submission-title"),
694
+ width: 560
695
+ }, {
696
+ footer: u(() => [
697
+ o(e(mt), { size: "sm" }, {
698
+ default: u(() => [
699
+ o(e(ue), {
700
+ variant: "outline",
701
+ onClick: b[0] || (b[0] = (f) => e(x)())
702
+ }, {
703
+ default: u(() => [
704
+ z(A(e(_)("panel.cancel")), 1)
705
+ ]),
706
+ _: 1
707
+ }),
708
+ o(e(ue), {
709
+ type: "primary",
710
+ loading: j.value,
711
+ disabled: W.value,
712
+ onClick: k
713
+ }, {
714
+ default: u(() => [
715
+ z(A(e(_)("panel.save")), 1)
716
+ ]),
717
+ _: 1
718
+ }, 8, ["loading", "disabled"])
719
+ ]),
720
+ _: 1
721
+ })
722
+ ]),
723
+ default: u(() => [
724
+ Q("div", Sl, [
725
+ o(e(_e), {
726
+ type: "info",
727
+ closable: !1
728
+ }, {
729
+ default: u(() => [
730
+ z(A(e(_)("panel.new-submission-help")), 1)
731
+ ]),
732
+ _: 1
733
+ }),
734
+ W.value ? (d(), g(e(Et), {
735
+ key: 0,
736
+ rows: 4
737
+ })) : (d(), R(te, { key: 1 }, [
738
+ (d(!0), R(te, null, fe(ee.value, (f) => (d(), g(e(D), {
739
+ key: f.id,
740
+ label: Y(f),
741
+ help: G(f.help),
742
+ error: S(f),
743
+ required: f.is_required
744
+ }, {
745
+ default: u(() => [
746
+ f.type === "textarea" ? (d(), g(e(Ft), {
747
+ key: 0,
748
+ modelValue: $.value[f.key],
749
+ "onUpdate:modelValue": (m) => $.value[f.key] = m,
750
+ rows: f.options.rows ?? 4,
751
+ placeholder: G(f.placeholder)
752
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "rows", "placeholder"])) : f.type === "select" ? (d(), g(e(ce), {
753
+ key: 1,
754
+ modelValue: $.value[f.key],
755
+ "onUpdate:modelValue": (m) => $.value[f.key] = m,
756
+ options: B(f),
757
+ clearable: "",
758
+ placeholder: G(f.placeholder)
759
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "options", "placeholder"])) : f.type === "radio" ? (d(), g(e(Ot), {
760
+ key: 2,
761
+ modelValue: $.value[f.key],
762
+ "onUpdate:modelValue": (m) => $.value[f.key] = m,
763
+ options: B(f)
764
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "options"])) : f.type === "checkbox" ? (d(), g(e(Rt), {
765
+ key: 3,
766
+ modelValue: $.value[f.key],
767
+ "onUpdate:modelValue": (m) => $.value[f.key] = m,
768
+ options: B(f)
769
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "options"])) : f.type === "consent" ? (d(), g(e(he), {
770
+ key: 4,
771
+ modelValue: $.value[f.key],
772
+ "onUpdate:modelValue": (m) => $.value[f.key] = m,
773
+ label: G(f.options.text, Y(f))
774
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "label"])) : f.type === "date" ? (d(), g(e(Re), {
775
+ key: 5,
776
+ modelValue: $.value[f.key],
777
+ "onUpdate:modelValue": (m) => $.value[f.key] = m,
778
+ placeholder: G(f.placeholder)
779
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])) : f.type === "datetime" ? (d(), R("div", Tl, [
780
+ o(e(Re), {
781
+ "model-value": Z(f).date || null,
782
+ "aria-label": Y(f),
783
+ "onUpdate:modelValue": (m) => Z(f).date = String(m ?? "")
784
+ }, null, 8, ["model-value", "aria-label", "onUpdate:modelValue"]),
785
+ o(e(ce), {
786
+ "model-value": Z(f).time || null,
787
+ options: E(f),
788
+ "aria-label": Y(f),
789
+ clearable: "",
790
+ "onUpdate:modelValue": (m) => Z(f).time = String(m ?? "")
791
+ }, null, 8, ["model-value", "options", "aria-label", "onUpdate:modelValue"]),
792
+ a.form.timezone ? (d(), g(e(H), {
793
+ key: 0,
794
+ size: "sm",
795
+ tone: "muted"
796
+ }, {
797
+ default: u(() => [
798
+ z(A(a.form.timezone), 1)
799
+ ]),
800
+ _: 1
801
+ })) : T("", !0)
802
+ ])) : (d(), g(e(ne), {
803
+ key: 7,
804
+ modelValue: $.value[f.key],
805
+ "onUpdate:modelValue": (m) => $.value[f.key] = m,
806
+ type: f.type === "email" ? "email" : f.type === "tel" ? "tel" : "text",
807
+ placeholder: G(f.placeholder),
808
+ maxlength: f.options.maxlength
809
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "type", "placeholder", "maxlength"]))
810
+ ]),
811
+ _: 2
812
+ }, 1032, ["label", "help", "error", "required"]))), 128)),
813
+ X.value ? (d(), g(e(_e), {
814
+ key: 0,
815
+ type: "warning",
816
+ closable: !1
817
+ }, {
818
+ default: u(() => [
819
+ z(A(e(_)("panel.no-files-by-hand")), 1)
820
+ ]),
821
+ _: 1
822
+ })) : T("", !0)
823
+ ], 64))
824
+ ])
825
+ ]),
826
+ _: 1
827
+ }, 8, ["open", "title"]));
828
+ }
829
+ }), Cl = /* @__PURE__ */ Te($l, [["__scopeId", "data-v-626c8f67"]]), Al = { class: "wx-submissions__mass" }, zl = { class: "wx-submissions__state" }, Ul = 640, Nl = /* @__PURE__ */ be({
830
+ __name: "SubmissionList",
831
+ props: {
832
+ form: {},
833
+ base: { default: "/inbox" }
834
+ },
835
+ emits: ["changed"],
836
+ setup(a, { expose: n, emit: r }) {
837
+ const x = a, p = r, F = Ve(), l = Pe(F), t = sl(), _ = ol(), N = ye();
838
+ Se();
839
+ const I = zt("root"), W = qt(I), j = y(() => W.value > 0 && W.value < Ul), $ = y(() => j.value ? Number.POSITIVE_INFINITY : 0), V = ve("webx-inbox"), ee = ve("webx-admin"), X = Me(), S = q(null), Y = q([]), G = q(!1), B = q([]), Z = q(!1), E = y(() => F.can("inbox.update")), M = pt(Cl), k = y({
840
+ get: () => typeof t.query.view == "string" && t.query.view !== "" ? t.query.view : "all",
841
+ set: (h) => {
842
+ _.replace({
843
+ query: { ...t.query, view: h === "all" ? void 0 : h, page: void 0 }
844
+ });
845
+ }
846
+ }), v = y(() => ({
847
+ view: k.value,
848
+ search: typeof t.query.search == "string" ? t.query.search : "",
849
+ assignee: typeof t.query.assignee == "string" ? t.query.assignee : null,
850
+ placement: typeof t.query.placement == "string" ? t.query.placement : null,
851
+ sort: typeof t.query.sort == "string" ? t.query.sort : null,
852
+ page: Number(t.query.page ?? 1) || 1
853
+ })), b = y(
854
+ () => (S.value?.placements ?? []).map(
855
+ (h) => h === null ? { value: "none", label: V("panel.placement-none") } : { value: h, label: h }
856
+ )
857
+ ), f = y(
858
+ () => b.value.length > 1 || v.value.placement !== null
859
+ ), m = y(() => {
860
+ const h = v.value.placement;
861
+ if (h === null) return [];
862
+ const P = b.value.find((C) => C.value === h)?.label ?? (h === "none" ? V("panel.placement-none") : h);
863
+ return [
864
+ {
865
+ key: "placement",
866
+ label: `${V("panel.meta-placement")}: ${P}`,
867
+ clear: () => U(void 0)
868
+ }
869
+ ];
870
+ });
871
+ function U(h) {
872
+ _.replace({
873
+ query: {
874
+ ...t.query,
875
+ placement: typeof h == "string" && h !== "" ? h : void 0,
876
+ page: void 0
877
+ }
878
+ });
879
+ }
880
+ const w = y(() => {
881
+ const h = S.value?.counts, P = [
882
+ { value: "all", label: V("panel.view-all"), badge: h?.all || void 0 },
883
+ { value: "unread", label: V("panel.view-unread"), badge: h?.unread || void 0 }
884
+ ];
885
+ for (const C of Y.value)
886
+ P.push({
887
+ value: C.key,
888
+ label: we(C),
889
+ badge: h?.statuses[C.key] || void 0
890
+ });
891
+ return P;
892
+ });
893
+ function O(h, P) {
894
+ const C = S.value?.columns?.[P];
895
+ return C ? h.values[C.key] ?? "" : "";
896
+ }
897
+ const L = y(() => {
898
+ const h = S.value?.columns ?? [];
899
+ return j.value ? [{ key: "card", label: "" }] : [
900
+ ...h.map((P, C) => ({
901
+ key: `values.${P.key}`,
902
+ label: P.label,
903
+ sortable: !0,
904
+ // The first answer is what the row is recognised by and stays at any width; every one
905
+ // after it is worth less than the room it takes, so it goes a step sooner. The steps are
906
+ // wide — 640, 960 — because an answer is a sentence and not a number: two of them plus
907
+ // the status and the date is already what a 755px pane holds without scrolling sideways,
908
+ // which is what the pane beside the forms actually is on a 1280 screen (§11).
909
+ hideBelow: C === 0 ? void 0 : 320 + C * 320
910
+ })),
911
+ // A floor rather than a width: the cell holds a badge, sometimes an avatar and sometimes
912
+ // a paperclip, and a fixed width that any of them overflows makes the whole table scroll
913
+ // sideways by two pixels.
914
+ { key: "status", label: V("panel.status"), minWidth: 100 },
915
+ {
916
+ key: "created_at",
917
+ label: V("panel.received"),
918
+ sortable: !0,
919
+ width: 120,
920
+ // "today at 16:22" is three words the table will break over two lines given half a
921
+ // chance, and a date read down a column has to be one line to be read at all.
922
+ cellClass: "wx-submissions__when",
923
+ hideBelow: 520
924
+ // Kept on the card, unlike most dates: "when did this come in" is one of the two
925
+ // questions a submission is looked at for, and the other one is who sent it.
926
+ },
927
+ { key: "actions", label: "", width: Qt, align: "right", hideOnCards: !0 }
928
+ ];
929
+ }), ae = y(
930
+ () => v.value.view === "all" && v.value.search === "" && v.value.assignee === null && v.value.placement === null ? V("panel.submissions-empty") : V("panel.submissions-none")
931
+ ), ge = y(
932
+ () => Y.value.map((h) => ({ value: h.id, label: we(h) }))
933
+ ), we = ul();
934
+ function Be() {
935
+ return me(x.form.title, N.active.value, x.form.slug);
936
+ }
937
+ async function xe(h) {
938
+ G.value = !0;
939
+ try {
940
+ S.value = await l.submissions(x.form.id, {
941
+ view: v.value.view,
942
+ search: h?.search ?? v.value.search,
943
+ assignee: v.value.assignee,
944
+ placement: v.value.placement,
945
+ sort: h?.sort ? `${h.sort.order === "desc" ? "-" : ""}${h.sort.key}` : null,
946
+ page: h?.page ?? v.value.page,
947
+ per_page: h?.perPage
948
+ });
949
+ } catch (P) {
950
+ se.danger(X(P));
951
+ } finally {
952
+ G.value = !1;
953
+ }
954
+ }
955
+ function Le(h) {
956
+ const P = {
957
+ ...t.query,
958
+ search: h.search === "" ? void 0 : h.search,
959
+ sort: h.sort === null ? void 0 : `${h.sort.order === "desc" ? "-" : ""}${h.sort.key}`,
960
+ page: h.page === 1 ? void 0 : String(h.page)
961
+ };
962
+ _.replace({ query: P }), xe(h);
963
+ }
964
+ Ne([() => x.form.id, k, () => v.value.assignee, () => v.value.placement], () => {
965
+ B.value = [], xe();
966
+ }), He();
967
+ async function He() {
968
+ try {
969
+ Y.value = await l.statuses();
970
+ } catch (h) {
971
+ se.danger(X(h));
972
+ }
973
+ }
974
+ function $e(h) {
975
+ _.push({ path: `${x.base}/submissions/${h.id}`, query: { ...t.query } });
976
+ }
977
+ function Ce(h) {
978
+ return E.value ? [
979
+ {
980
+ key: "read",
981
+ icon: h.is_read ? "eye-off" : "eye",
982
+ label: h.is_read ? V("panel.mark-unread") : V("panel.mark-read"),
983
+ run: () => {
984
+ ze([h.id], h.is_read ? "unread" : "read");
985
+ }
986
+ },
987
+ {
988
+ key: "delete",
989
+ icon: "trash",
990
+ label: V("panel.delete"),
991
+ danger: !0,
992
+ run: () => {
993
+ Ae([h.id]);
994
+ }
995
+ }
996
+ ] : [];
997
+ }
998
+ async function We(h) {
999
+ typeof h == "number" && (Z.value = !0, await ze(
1000
+ B.value.map((P) => P.id),
1001
+ "status",
1002
+ h
1003
+ ), Z.value = !1);
1004
+ }
1005
+ async function Ae(h) {
1006
+ await ft({
1007
+ title: h.length === 1 ? V("panel.delete-submission-title") : V("panel.delete-selected-title", { count: h.length }),
1008
+ message: V("panel.delete-submission-text"),
1009
+ confirmText: V("panel.delete"),
1010
+ cancelText: V("panel.cancel"),
1011
+ tone: "danger"
1012
+ }) && await ze(h, "delete");
1013
+ }
1014
+ async function ze(h, P, C) {
1015
+ if (h.length !== 0)
1016
+ try {
1017
+ await l.massSubmissions({ ids: h, action: P, status_id: C }), B.value = [], await xe(), p("changed");
1018
+ } catch (pe) {
1019
+ se.danger(X(pe));
1020
+ }
1021
+ }
1022
+ async function je() {
1023
+ const h = await M({ form: x.form });
1024
+ h && (se.success(V("panel.created")), await xe(), p("changed"), _.push({ path: `${x.base}/submissions/${h.id}`, query: { ...t.query } }));
1025
+ }
1026
+ const Ie = y(
1027
+ () => l.exportUrl(x.form.id, {
1028
+ view: v.value.view,
1029
+ search: v.value.search,
1030
+ assignee: v.value.assignee,
1031
+ placement: v.value.placement,
1032
+ sort: v.value.sort
1033
+ })
1034
+ ), Xe = y(() => [
1035
+ { key: "export", label: V("panel.export"), icon: "download", href: Ie.value }
1036
+ ]);
1037
+ return n({ create: je }), (h, P) => (d(), R("div", {
1038
+ ref_key: "root",
1039
+ ref: I,
1040
+ class: "wx-submissions"
1041
+ }, [
1042
+ o(e(Zt), {
1043
+ class: "wx-submissions__head",
1044
+ level: 3,
1045
+ title: Be(),
1046
+ subtitle: a.form.slug,
1047
+ actions: Xe.value
1048
+ }, null, 8, ["title", "subtitle", "actions"]),
1049
+ o(e(Dt), {
1050
+ modelValue: k.value,
1051
+ "onUpdate:modelValue": P[2] || (P[2] = (C) => k.value = C),
1052
+ class: "wx-submissions__views",
1053
+ items: w.value,
1054
+ "collapse-below": 560,
1055
+ "aria-label": e(V)("panel.status")
1056
+ }, {
1057
+ default: u(() => [
1058
+ o(e(Mt), {
1059
+ data: S.value,
1060
+ columns: L.value,
1061
+ "row-key": "id",
1062
+ searchable: "",
1063
+ clickable: "",
1064
+ hover: "",
1065
+ flush: "",
1066
+ loading: G.value,
1067
+ "loading-text": e(V)("panel.loading"),
1068
+ selectable: E.value,
1069
+ "select-row-label": e(ee)("filters.select-row"),
1070
+ "select-all-label": e(ee)("filters.select-all"),
1071
+ "row-class": (C) => C.is_read ? void 0 : "is-unread",
1072
+ "search-placeholder": e(V)("panel.search-submissions"),
1073
+ "empty-text": ae.value,
1074
+ "cards-below": $.value,
1075
+ "filters-count": m.value.length,
1076
+ onRowClick: $e,
1077
+ onStateChange: Le,
1078
+ onSelectionChange: P[1] || (P[1] = (C, pe) => B.value = pe)
1079
+ }, dt({
1080
+ "cell-status": u(({ row: C }) => [
1081
+ Q("div", zl, [
1082
+ C.status ? (d(), g(e(de), {
1083
+ key: 0,
1084
+ type: C.status.color
1085
+ }, {
1086
+ default: u(() => [
1087
+ z(A(e(we)(C.status)), 1)
1088
+ ]),
1089
+ _: 2
1090
+ }, 1032, ["type"])) : T("", !0),
1091
+ C.assignee ? (d(), g(e(at), {
1092
+ key: 1,
1093
+ name: C.assignee.name,
1094
+ title: C.assignee.name,
1095
+ size: "xs",
1096
+ tone: "auto"
1097
+ }, null, 8, ["name", "title"])) : T("", !0),
1098
+ C.files_count > 0 ? (d(), g(e(Bt), {
1099
+ key: 2,
1100
+ content: e(V)("panel.attachments")
1101
+ }, {
1102
+ default: u(() => [
1103
+ o(e(re), {
1104
+ name: "file",
1105
+ size: "sm"
1106
+ })
1107
+ ]),
1108
+ _: 1
1109
+ }, 8, ["content"])) : T("", !0)
1110
+ ])
1111
+ ]),
1112
+ "cell-created_at": u(({ row: C }) => [
1113
+ o(e(ot), {
1114
+ value: C.created_at,
1115
+ compact: ""
1116
+ }, null, 8, ["value"])
1117
+ ]),
1118
+ "cell-card": u(({ row: C }) => [
1119
+ o(e(Pt), {
1120
+ variant: "plain",
1121
+ shape: "circle",
1122
+ title: O(C, 0)
1123
+ }, {
1124
+ subtitle: u(() => [
1125
+ z(A(O(C, 1)), 1)
1126
+ ]),
1127
+ meta: u(() => [
1128
+ C.status ? (d(), g(e(de), {
1129
+ key: 0,
1130
+ type: C.status.color,
1131
+ size: "sm"
1132
+ }, {
1133
+ default: u(() => [
1134
+ z(A(e(we)(C.status)), 1)
1135
+ ]),
1136
+ _: 2
1137
+ }, 1032, ["type"])) : T("", !0),
1138
+ C.assignee ? (d(), g(e(at), {
1139
+ key: 1,
1140
+ name: C.assignee.name,
1141
+ title: C.assignee.name,
1142
+ size: "xs",
1143
+ tone: "auto"
1144
+ }, null, 8, ["name", "title"])) : T("", !0),
1145
+ C.files_count > 0 ? (d(), g(e(re), {
1146
+ key: 2,
1147
+ name: "file",
1148
+ size: "sm"
1149
+ })) : T("", !0),
1150
+ o(e(ot), {
1151
+ value: C.created_at
1152
+ }, null, 8, ["value"])
1153
+ ]),
1154
+ _: 2
1155
+ }, 1032, ["title"])
1156
+ ]),
1157
+ "card-actions": u(({ row: C }) => [
1158
+ o(e(Ge), {
1159
+ actions: Ce(C),
1160
+ label: String(C.id)
1161
+ }, null, 8, ["actions", "label"])
1162
+ ]),
1163
+ "cell-actions": u(({ row: C }) => [
1164
+ o(e(Ge), {
1165
+ actions: Ce(C),
1166
+ label: String(C.id)
1167
+ }, null, 8, ["actions", "label"])
1168
+ ]),
1169
+ _: 2
1170
+ }, [
1171
+ B.value.length > 0 ? {
1172
+ name: "actions",
1173
+ fn: u(() => [
1174
+ Q("div", Al, [
1175
+ o(e(H), {
1176
+ size: "sm",
1177
+ weight: "medium"
1178
+ }, {
1179
+ default: u(() => [
1180
+ z(A(e(V)("panel.selected", { count: B.value.length })), 1)
1181
+ ]),
1182
+ _: 1
1183
+ }),
1184
+ o(e(ce), {
1185
+ "model-value": null,
1186
+ options: ge.value,
1187
+ placeholder: e(V)("panel.move-to"),
1188
+ disabled: Z.value,
1189
+ size: "sm",
1190
+ style: { width: "180px" },
1191
+ "onUpdate:modelValue": We
1192
+ }, null, 8, ["options", "placeholder", "disabled"]),
1193
+ o(e(ue), {
1194
+ size: "sm",
1195
+ variant: "outline",
1196
+ type: "danger",
1197
+ onClick: P[0] || (P[0] = (C) => Ae(B.value.map((pe) => pe.id)))
1198
+ }, {
1199
+ default: u(() => [
1200
+ z(A(e(V)("panel.delete")), 1)
1201
+ ]),
1202
+ _: 1
1203
+ })
1204
+ ])
1205
+ ]),
1206
+ key: "0"
1207
+ } : void 0,
1208
+ f.value ? {
1209
+ name: "filters",
1210
+ fn: u(() => [
1211
+ o(e(D), {
1212
+ label: e(V)("panel.meta-placement")
1213
+ }, {
1214
+ default: u(() => [
1215
+ o(e(ce), {
1216
+ "model-value": v.value.placement,
1217
+ options: b.value,
1218
+ placeholder: e(V)("panel.any-placement"),
1219
+ clearable: "",
1220
+ size: "sm",
1221
+ "onUpdate:modelValue": U
1222
+ }, null, 8, ["model-value", "options", "placeholder"])
1223
+ ]),
1224
+ _: 1
1225
+ }, 8, ["label"])
1226
+ ]),
1227
+ key: "1"
1228
+ } : void 0,
1229
+ m.value.length > 0 ? {
1230
+ name: "applied",
1231
+ fn: u(() => [
1232
+ o(e(Jt), { filters: m.value }, null, 8, ["filters"])
1233
+ ]),
1234
+ key: "2"
1235
+ } : void 0
1236
+ ]), 1032, ["data", "columns", "loading", "loading-text", "selectable", "select-row-label", "select-all-label", "row-class", "search-placeholder", "empty-text", "cards-below", "filters-count"])
1237
+ ]),
1238
+ _: 1
1239
+ }, 8, ["modelValue", "items", "aria-label"])
1240
+ ], 512));
1241
+ }
1242
+ }), ma = /* @__PURE__ */ Te(Nl, [["__scopeId", "data-v-c743b9e7"]]), Wl = ["when", "unless"], Il = ["select", "radio", "checkbox", "consent"], bt = "1";
1243
+ function yt(a) {
1244
+ if (a === null || typeof a != "object" || Array.isArray(a)) return null;
1245
+ const n = {};
1246
+ for (const [r, x] of Object.entries(a)) {
1247
+ const p = r.trim(), F = (Array.isArray(x) ? x : [x]).map((l) => l === !0 ? bt : typeof l == "string" ? l.trim() : "").filter((l) => l !== "");
1248
+ p !== "" && F.length > 0 && (n[p] = [...new Set(F)]);
1249
+ }
1250
+ return Object.keys(n).length === 0 ? null : n;
1251
+ }
1252
+ function qe(a, n) {
1253
+ return yt(a?.[n]);
1254
+ }
1255
+ function gt(a) {
1256
+ return Il.includes(a);
1257
+ }
1258
+ function Je(a, n) {
1259
+ return a.type === "consent" ? [{ value: bt, label: n }] : Array.isArray(a.options.choices) ? a.options.choices : [];
1260
+ }
1261
+ function El(a, n) {
1262
+ const r = n.findIndex((p) => p.id === a.id), x = [];
1263
+ for (const p of Wl)
1264
+ for (const [F, l] of Object.entries(qe(a.options, p) ?? {})) {
1265
+ const t = n.findIndex((N) => N.key === F), _ = n[t];
1266
+ if (_ === void 0)
1267
+ x.push({ code: "unknown_field", key: p, name: F });
1268
+ else if (!gt(_.type))
1269
+ x.push({ code: "not_choice", key: p, name: F });
1270
+ else if (r >= 0 && t >= r)
1271
+ x.push({ code: "not_before", key: p, name: F });
1272
+ else {
1273
+ const N = Je(_, "").map((I) => I.value);
1274
+ for (const I of l)
1275
+ N.includes(I) || x.push({ code: "unknown_value", key: p, name: F, value: I });
1276
+ }
1277
+ }
1278
+ return x;
1279
+ }
1280
+ function wt(a, n, r, x) {
1281
+ return Object.entries(a).map(([p, F]) => {
1282
+ const l = n.find((N) => N.key === p);
1283
+ if (l === void 0) return `${p} = ${F.join(", ")}`;
1284
+ const t = Je(l, x), _ = F.map((N) => {
1285
+ const I = t.find((W) => W.value === N);
1286
+ return I === void 0 ? N : xt(I.label, r, N);
1287
+ });
1288
+ return `${me(l.title, r, l.key)} = ${_.join(", ")}`;
1289
+ }).join(" · ");
1290
+ }
1291
+ function xt(a, n, r) {
1292
+ return me(a, n, r) || r;
1293
+ }
1294
+ const Fl = { class: "wx-inbox-condition__head" }, Ol = { class: "wx-inbox-condition__controls" }, Rl = {
1295
+ key: 2,
1296
+ class: "wx-inbox-condition__removed"
1297
+ }, ql = /* @__PURE__ */ be({
1298
+ __name: "FieldCondition",
1299
+ props: {
1300
+ options: {},
1301
+ above: {},
1302
+ fields: {},
1303
+ errors: {}
1304
+ },
1305
+ emits: ["update:options"],
1306
+ setup(a, { emit: n }) {
1307
+ const r = a, x = n;
1308
+ Se();
1309
+ const p = ve("webx-inbox"), F = ye(), l = q("always"), t = q([]), _ = q(null);
1310
+ function N(m) {
1311
+ const U = qe(m, "when"), w = qe(m, "unless"), O = U ?? w;
1312
+ l.value = U !== null ? "when" : w !== null ? "unless" : "always", t.value = Object.entries(O ?? {}).map(([L, ae]) => ({ name: L, values: [...ae] })), _.value = U !== null && w !== null ? { key: "unless", condition: w } : null;
1313
+ }
1314
+ N(r.options);
1315
+ let I = null;
1316
+ Ne(
1317
+ () => r.options,
1318
+ (m) => {
1319
+ Ut(m) !== I && N(m);
1320
+ }
1321
+ );
1322
+ const W = y(() => r.above.filter((m) => gt(m.type))), j = y(() => p("fields.condition-ticked"));
1323
+ function $(m) {
1324
+ return me(m.title, F.active.value, m.key);
1325
+ }
1326
+ function V(m) {
1327
+ return m !== "" && !W.value.some((U) => U.key === m);
1328
+ }
1329
+ function ee(m) {
1330
+ const U = t.value.filter((O) => O !== m).map((O) => O.name), w = W.value.filter((O) => !U.includes(O.key)).map((O) => ({ value: O.key, label: $(O) }));
1331
+ if (V(m.name)) {
1332
+ const O = r.fields.find((L) => L.key === m.name);
1333
+ w.unshift({ value: m.name, label: O ? $(O) : m.name });
1334
+ }
1335
+ return w;
1336
+ }
1337
+ function X(m) {
1338
+ const U = W.value.find((w) => w.key === m.name);
1339
+ return U === void 0 ? [] : Je(U, j.value).map((w) => ({
1340
+ value: w.value,
1341
+ label: xt(w.label, F.active.value, w.value)
1342
+ }));
1343
+ }
1344
+ function S(m) {
1345
+ if (V(m.name)) return [];
1346
+ const U = X(m).map((w) => w.value);
1347
+ return m.values.filter((w) => !U.includes(w));
1348
+ }
1349
+ function Y() {
1350
+ const m = yt(
1351
+ Object.fromEntries(t.value.map((w) => [w.name, w.values]))
1352
+ ), U = { ...r.options };
1353
+ delete U.when, delete U.unless, l.value !== "always" && m !== null && (U[l.value] = m), _.value !== null && _.value.key !== l.value && (U[_.value.key] = _.value.condition), I = U, x("update:options", U);
1354
+ }
1355
+ function G(m) {
1356
+ l.value = m, m !== "always" && t.value.length === 0 ? B() : Y();
1357
+ }
1358
+ function B() {
1359
+ const m = W.value.find((U) => !t.value.some((w) => w.name === U.key));
1360
+ t.value = [...t.value, { name: m?.key ?? "", values: [] }], Y();
1361
+ }
1362
+ function Z(m, U) {
1363
+ t.value = t.value.map((w, O) => O === m ? { name: U, values: [] } : w), Y();
1364
+ }
1365
+ function E(m, U) {
1366
+ const w = t.value[m], O = S(w);
1367
+ t.value = t.value.map(
1368
+ (L, ae) => ae === m ? { ...L, values: [...O, ...U] } : L
1369
+ ), Y();
1370
+ }
1371
+ function M(m, U) {
1372
+ t.value = t.value.map(
1373
+ (w, O) => O === m ? { ...w, values: w.values.filter((L) => L !== U) } : w
1374
+ ), Y();
1375
+ }
1376
+ function k(m) {
1377
+ t.value = t.value.filter((U, w) => w !== m), t.value.length === 0 && (l.value = "always"), Y();
1378
+ }
1379
+ const v = y(() => [
1380
+ { value: "always", label: p("fields.show-always") },
1381
+ { value: "when", label: p("fields.show-when") },
1382
+ { value: "unless", label: p("fields.show-unless") }
1383
+ ]), b = y(
1384
+ () => _.value === null || _.value.key === l.value ? null : p("fields.condition-kept", {
1385
+ condition: wt(
1386
+ _.value.condition,
1387
+ r.fields,
1388
+ F.active.value,
1389
+ j.value
1390
+ )
1391
+ })
1392
+ ), f = y(() => t.value.length < W.value.length);
1393
+ return (m, U) => (d(), R("section", {
1394
+ class: Oe(["wx-inbox-condition", { "is-invalid": a.errors?.length }])
1395
+ }, [
1396
+ Q("div", Fl, [
1397
+ o(e(H), {
1398
+ size: "sm",
1399
+ weight: "medium"
1400
+ }, {
1401
+ default: u(() => [
1402
+ z(A(e(p)("fields.show")), 1)
1403
+ ]),
1404
+ _: 1
1405
+ }),
1406
+ o(e(vt), {
1407
+ "model-value": l.value,
1408
+ options: v.value,
1409
+ size: "sm",
1410
+ "aria-label": e(p)("fields.show"),
1411
+ disabled: W.value.length === 0 && l.value === "always",
1412
+ "onUpdate:modelValue": U[0] || (U[0] = (w) => G(w))
1413
+ }, null, 8, ["model-value", "options", "aria-label", "disabled"])
1414
+ ]),
1415
+ W.value.length === 0 && l.value === "always" ? (d(), g(e(H), {
1416
+ key: 0,
1417
+ size: "sm",
1418
+ tone: "placeholder"
1419
+ }, {
1420
+ default: u(() => [
1421
+ z(A(e(p)("fields.condition-none")), 1)
1422
+ ]),
1423
+ _: 1
1424
+ })) : T("", !0),
1425
+ l.value !== "always" ? (d(), R(te, { key: 1 }, [
1426
+ (d(!0), R(te, null, fe(t.value, (w, O) => (d(), R("div", {
1427
+ key: O,
1428
+ class: Oe(["wx-inbox-condition__row", { "is-invalid": V(w.name) || S(w).length > 0 }])
1429
+ }, [
1430
+ O > 0 ? (d(), g(e(H), {
1431
+ key: 0,
1432
+ size: "sm",
1433
+ tone: "muted",
1434
+ class: "wx-inbox-condition__and"
1435
+ }, {
1436
+ default: u(() => [
1437
+ z(A(e(p)("fields.condition-and")), 1)
1438
+ ]),
1439
+ _: 1
1440
+ })) : T("", !0),
1441
+ Q("div", Ol, [
1442
+ o(e(ce), {
1443
+ "model-value": w.name || null,
1444
+ options: ee(w),
1445
+ placeholder: e(p)("fields.condition-field"),
1446
+ "aria-label": e(p)("fields.condition-field"),
1447
+ status: V(w.name) ? "error" : void 0,
1448
+ "onUpdate:modelValue": (L) => Z(O, String(L ?? ""))
1449
+ }, null, 8, ["model-value", "options", "placeholder", "aria-label", "status", "onUpdate:modelValue"]),
1450
+ o(e(ce), {
1451
+ multiple: "",
1452
+ "model-value": w.values.filter((L) => !S(w).includes(L)),
1453
+ options: X(w),
1454
+ placeholder: e(p)("fields.condition-values"),
1455
+ "aria-label": e(p)("fields.condition-values"),
1456
+ disabled: w.name === "" || V(w.name),
1457
+ "onUpdate:modelValue": (L) => E(O, L ?? [])
1458
+ }, null, 8, ["model-value", "options", "placeholder", "aria-label", "disabled", "onUpdate:modelValue"]),
1459
+ o(e(Ze), {
1460
+ icon: "trash",
1461
+ tone: "danger",
1462
+ title: e(p)("fields.condition-remove"),
1463
+ onClick: (L) => k(O)
1464
+ }, null, 8, ["title", "onClick"])
1465
+ ]),
1466
+ V(w.name) ? (d(), g(e(H), {
1467
+ key: 1,
1468
+ size: "sm",
1469
+ tone: "danger"
1470
+ }, {
1471
+ default: u(() => [
1472
+ z(A(e(p)("fields.condition-stranger")), 1)
1473
+ ]),
1474
+ _: 1
1475
+ })) : T("", !0),
1476
+ S(w).length > 0 ? (d(), R("div", Rl, [
1477
+ (d(!0), R(te, null, fe(S(w), (L) => (d(), g(e(de), {
1478
+ key: L,
1479
+ type: "danger",
1480
+ closable: "",
1481
+ "close-label": e(p)("fields.condition-remove"),
1482
+ onClose: (ae) => M(O, L)
1483
+ }, {
1484
+ default: u(() => [
1485
+ z(A(e(p)("fields.condition-removed", { value: L })), 1)
1486
+ ]),
1487
+ _: 2
1488
+ }, 1032, ["close-label", "onClose"]))), 128))
1489
+ ])) : T("", !0)
1490
+ ], 2))), 128)),
1491
+ f.value ? (d(), g(e(ue), {
1492
+ key: 0,
1493
+ variant: "outline",
1494
+ size: "sm",
1495
+ onClick: B
1496
+ }, {
1497
+ icon: u(() => [
1498
+ o(e(re), { name: "plus" })
1499
+ ]),
1500
+ default: u(() => [
1501
+ z(" " + A(e(p)("fields.condition-add")), 1)
1502
+ ]),
1503
+ _: 1
1504
+ })) : T("", !0),
1505
+ o(e(H), {
1506
+ size: "sm",
1507
+ tone: "muted"
1508
+ }, {
1509
+ default: u(() => [
1510
+ z(A(e(p)("fields.condition-help")), 1)
1511
+ ]),
1512
+ _: 1
1513
+ })
1514
+ ], 64)) : T("", !0),
1515
+ b.value ? (d(), g(e(_e), {
1516
+ key: 2,
1517
+ type: "info",
1518
+ variant: "soft",
1519
+ description: b.value
1520
+ }, null, 8, ["description"])) : T("", !0),
1521
+ (d(!0), R(te, null, fe(a.errors ?? [], (w) => (d(), g(e(H), {
1522
+ key: w,
1523
+ size: "sm",
1524
+ tone: "danger",
1525
+ role: "alert"
1526
+ }, {
1527
+ default: u(() => [
1528
+ z(A(w), 1)
1529
+ ]),
1530
+ _: 2
1531
+ }, 1024))), 128))
1532
+ ], 2));
1533
+ }
1534
+ }), Dl = /* @__PURE__ */ Te(ql, [["__scopeId", "data-v-17717667"]]), Ml = /* @__PURE__ */ be({
1535
+ __name: "LocalizedRichText",
1536
+ props: /* @__PURE__ */ Qe({
1537
+ placeholder: { default: void 0 },
1538
+ minHeight: { default: "160px" }
1539
+ }, {
1540
+ modelValue: { default: "" },
1541
+ modelModifiers: {}
1542
+ }),
1543
+ emits: ["update:modelValue"],
1544
+ setup(a) {
1545
+ const n = Ke(a, "modelValue"), r = a, x = ye(), p = el(), F = tl(() => !0), l = ve("webx-admin"), t = y(() => {
1546
+ const N = x.active.value;
1547
+ return x.list.value.some((W) => W.code === N) ? N : x.list.value[0]?.code ?? "";
1548
+ }), _ = y({
1549
+ get: () => {
1550
+ const N = n.value;
1551
+ return typeof N == "string" ? t.value === "" || t.value === x.list.value[0]?.code ? N : "" : N[t.value] ?? "";
1552
+ },
1553
+ set: (N) => {
1554
+ if (t.value === "") {
1555
+ n.value = N;
1556
+ return;
1557
+ }
1558
+ const I = typeof n.value == "string" ? { [t.value]: n.value } : n.value;
1559
+ n.value = { ...I, [t.value]: N };
1560
+ }
1561
+ });
1562
+ return (N, I) => e(x).list.value.length > 0 ? (d(), g(e(Lt), { key: 0 }, {
1563
+ default: u(() => [
1564
+ o(e(nt), {
1565
+ modelValue: _.value,
1566
+ "onUpdate:modelValue": I[0] || (I[0] = (W) => _.value = W),
1567
+ placeholder: r.placeholder,
1568
+ "min-height": r.minHeight,
1569
+ labels: e(p),
1570
+ tokens: e(F).length > 0 ? e(F) : void 0,
1571
+ "tokens-title": e(l)("shortcodes.title"),
1572
+ "tokens-label": e(l)("shortcodes.insert")
1573
+ }, null, 8, ["modelValue", "placeholder", "min-height", "labels", "tokens", "tokens-title", "tokens-label"])
1574
+ ]),
1575
+ _: 1
1576
+ })) : (d(), g(e(nt), {
1577
+ key: 1,
1578
+ modelValue: _.value,
1579
+ "onUpdate:modelValue": I[1] || (I[1] = (W) => _.value = W),
1580
+ placeholder: r.placeholder,
1581
+ "min-height": r.minHeight,
1582
+ labels: e(p),
1583
+ tokens: e(F).length > 0 ? e(F) : void 0,
1584
+ "tokens-title": e(l)("shortcodes.title"),
1585
+ "tokens-label": e(l)("shortcodes.insert")
1586
+ }, null, 8, ["modelValue", "placeholder", "min-height", "labels", "tokens", "tokens-title", "tokens-label"]));
1587
+ }
1588
+ }), Pl = [
1589
+ "text",
1590
+ "email",
1591
+ "tel",
1592
+ "textarea",
1593
+ "select",
1594
+ "radio",
1595
+ "checkbox",
1596
+ "consent",
1597
+ "date",
1598
+ "datetime",
1599
+ "file",
1600
+ "hidden"
1601
+ ], pa = ["default", "primary", "success", "warning", "info", "danger"], Bl = { class: "wx-inbox-field-form" }, Ll = { class: "wx-inbox-field-form__row" }, Hl = { class: "wx-inbox-field-form__days" }, jl = {
1602
+ key: 7,
1603
+ class: "wx-inbox-field-form__row"
1604
+ }, Xl = {
1605
+ key: 8,
1606
+ class: "wx-inbox-choices"
1607
+ }, Yl = { class: "wx-inbox-choices__row" }, Gl = {
1608
+ key: 0,
1609
+ class: "wx-inbox-choices__card"
1610
+ }, Kl = { class: "wx-inbox-field-form__row" }, Ql = { class: "wx-inbox-field-form__checks" }, Zl = { class: "wx-inbox-field-form__advanced" }, Jl = /* @__PURE__ */ be({
1611
+ __name: "FieldDialog",
1612
+ props: {
1613
+ field: {},
1614
+ form: {},
1615
+ taken: { default: () => [] },
1616
+ fields: { default: () => [] },
1617
+ step: { type: Boolean, default: !1 }
1618
+ },
1619
+ setup(a) {
1620
+ const n = a, { resolve: r, dismiss: x, open: p } = rt(), F = Ve(), l = Pe(F);
1621
+ Se();
1622
+ const t = ve("webx-inbox"), _ = ll(), N = Me(), I = q(!1), W = q({}), j = q(""), $ = q("text"), V = q({}), ee = q({}), X = q({}), S = q({}), Y = q(!1), G = ye(), B = q(!0), Z = q(!1), E = q(!0), M = q(!1);
1623
+ Ne(
1624
+ () => n.field,
1625
+ (c) => {
1626
+ j.value = c?.name ?? "", $.value = c?.type ?? (n.step ? "step" : "text"), V.value = { ...c?.title ?? {} }, ee.value = { ...c?.placeholder ?? {} }, X.value = { ...c?.help ?? {} }, S.value = { ...c?.options ?? {} }, B.value = c?.is_enabled ?? !0, Z.value = c?.is_required ?? !1, E.value = c?.is_fullsize ?? !0, M.value = c?.in_table ?? !1, Y.value = c !== null, W.value = {};
1627
+ },
1628
+ { immediate: !0 }
1629
+ );
1630
+ function k(c) {
1631
+ const i = c ?? {}, s = i[G.active.value];
1632
+ if (typeof s == "string" && s.trim() !== "") return [s, G.active.value];
1633
+ const J = Object.entries(i).find(
1634
+ ([, le]) => typeof le == "string" && le.trim() !== ""
1635
+ );
1636
+ return J === void 0 ? ["", G.active.value] : [J[1], J[0]];
1637
+ }
1638
+ function v([c, i]) {
1639
+ let s = nl(c, { separator: "_", max: 60, locale: i });
1640
+ if (s === "") return "";
1641
+ U.value && (s = `step_${s}`.slice(0, 60)), /^[a-z]/.test(s) || (s = `field_${s}`);
1642
+ let J = s;
1643
+ for (let le = 2; n.taken.includes(J); le++) J = `${s}_${le}`;
1644
+ return J;
1645
+ }
1646
+ Ne(
1647
+ () => k(V.value),
1648
+ (c) => {
1649
+ Y.value || (j.value = v(c));
1650
+ }
1651
+ );
1652
+ function b(c) {
1653
+ j.value = c, Y.value = c.trim() !== "", Y.value || (j.value = v(k(V.value)));
1654
+ }
1655
+ const f = y(() => {
1656
+ const c = n.field?.name ?? "", i = j.value.trim();
1657
+ return c !== "" && i !== "" && i !== c ? c : null;
1658
+ }), m = y(() => [
1659
+ ...Pl.map((c) => ({ value: c, label: t(`fields.type-${c}`) })),
1660
+ { value: "summary", label: t("fields.type-summary") }
1661
+ ]), U = y(() => $.value === "step"), w = y(() => $.value === "summary"), O = y(() => !U.value && !w.value), L = y(
1662
+ () => lt.value.filter((c) => !["step", "summary", "consent", "file", "hidden"].includes(c.type)).map((c) => ({
1663
+ value: c.key,
1664
+ label: me(c.title, G.active.value, c.key)
1665
+ }))
1666
+ ), ae = y({
1667
+ get: () => Array.isArray(S.value.fields) ? S.value.fields : [],
1668
+ set: (c) => K("fields", c)
1669
+ }), ge = y(() => !n.fields.some((c) => c.type === "step")), we = y(() => U.value ? n.field ? t("fields.edit-step") : t("fields.new-step") : n.field ? t("fields.edit-field") : t("fields.new-field")), Be = y(() => ["select", "radio", "checkbox"].includes($.value)), xe = y(() => $.value === "datetime"), Le = [15, 20, 30, 60, 90, 120], He = y(
1670
+ () => Le.map((c) => ({ value: c, label: t("fields.time-step-minutes", { minutes: c }) }))
1671
+ ), $e = y(() => Number(S.value["time-step"] ?? 30)), Ce = y(() => String(S.value["time-from"] ?? "09:00")), We = y(() => String(S.value["time-to"] ?? "17:00")), Ae = y(
1672
+ () => Array.isArray(S.value.weekdays) ? S.value.weekdays.map(Number) : []
1673
+ ), ze = y(
1674
+ () => [1, 2, 3, 4, 5, 6, 7].map((c) => ({
1675
+ value: c,
1676
+ label: new Intl.DateTimeFormat(G.active.value, {
1677
+ weekday: "short",
1678
+ timeZone: "UTC"
1679
+ }).format(Date.UTC(2024, 0, c))
1680
+ }))
1681
+ );
1682
+ function je(c, i) {
1683
+ const s = new Set(Ae.value);
1684
+ i ? s.add(c) : s.delete(c), K(
1685
+ "weekdays",
1686
+ [...s].sort((J, le) => J - le)
1687
+ );
1688
+ }
1689
+ const Ie = (c) => {
1690
+ const [i, s] = c.split(":").map(Number);
1691
+ return (i ?? 0) * 60 + (s ?? 0);
1692
+ }, Xe = (c) => `${String(Math.floor(c / 60)).padStart(2, "0")}:${String(c % 60).padStart(2, "0")}`, h = y(() => {
1693
+ const c = [], i = Ie(We.value);
1694
+ for (let s = Ie(Ce.value); s + $e.value <= i && c.length < 200; s += $e.value)
1695
+ c.push(Xe(s));
1696
+ return c.length === 0 ? "—" : c.length > 3 ? `${c[0]}, ${c[1]} … ${c[c.length - 1]}` : c.join(", ");
1697
+ }), P = y(() => n.form.timezone ?? "UTC"), C = y(
1698
+ () => Array.isArray(S.value.choices) ? S.value.choices : []
1699
+ ), pe = y({
1700
+ get: () => Array.isArray(S.value.extensions) ? S.value.extensions : [],
1701
+ set: (c) => K(
1702
+ "extensions",
1703
+ c.map((i) => i.replace(/^\./, ""))
1704
+ )
1705
+ }), et = y(() => $.value === "radio" || $.value === "checkbox"), Ue = y(() => et.value && S.value.view === "cards"), kt = y(() => [
1706
+ { value: "list", label: t("fields.view-list") },
1707
+ { value: "cards", label: t("fields.view-cards") }
1708
+ ]);
1709
+ function _t(c) {
1710
+ const i = { ...S.value };
1711
+ c === "cards" ? i.view = "cards" : (delete i.view, delete i.columns), S.value = i;
1712
+ }
1713
+ const tt = y(() => F.types?.["wx-media"]?.component);
1714
+ function K(c, i) {
1715
+ S.value = { ...S.value, [c]: i };
1716
+ }
1717
+ function Vt() {
1718
+ K("choices", [...C.value, { value: "", label: {} }]);
1719
+ }
1720
+ function St(c) {
1721
+ K(
1722
+ "choices",
1723
+ C.value.filter((i, s) => s !== c)
1724
+ );
1725
+ }
1726
+ function Ee(c, i) {
1727
+ K(
1728
+ "choices",
1729
+ C.value.map((s, J) => J === c ? { ...s, ...i } : s)
1730
+ );
1731
+ }
1732
+ const lt = y(() => {
1733
+ const c = n.field === null ? -1 : n.fields.findIndex((i) => i.id === n.field?.id);
1734
+ return c < 0 ? n.fields.filter((i) => i.id !== n.field?.id) : n.fields.slice(0, c);
1735
+ }), Tt = y(() => [
1736
+ ...W.value["options.when"] ?? [],
1737
+ ...W.value["options.unless"] ?? []
1738
+ ]);
1739
+ function oe(c) {
1740
+ return W.value[c]?.[0];
1741
+ }
1742
+ async function $t() {
1743
+ I.value = !0, W.value = {};
1744
+ const c = {
1745
+ name: j.value.trim() === "" ? null : j.value.trim(),
1746
+ type: $.value,
1747
+ title: V.value,
1748
+ placeholder: ee.value,
1749
+ help: X.value,
1750
+ options: S.value,
1751
+ is_enabled: B.value,
1752
+ is_required: O.value && Z.value,
1753
+ is_fullsize: !O.value || E.value,
1754
+ in_table: O.value && M.value
1755
+ };
1756
+ try {
1757
+ r(
1758
+ n.field === null ? await l.createField(n.form.id, c) : await l.saveField(n.field.id, c)
1759
+ );
1760
+ } catch (i) {
1761
+ const s = i.body;
1762
+ s?.errors ? (W.value = s.errors, se.danger(t("panel.failed"))) : se.danger(N(i));
1763
+ } finally {
1764
+ I.value = !1;
1765
+ }
1766
+ }
1767
+ return (c, i) => (d(), g(e(ct), {
1768
+ open: e(p),
1769
+ "onUpdate:open": i[35] || (i[35] = (s) => ut(p) ? p.value = s : null),
1770
+ title: we.value,
1771
+ width: 720
1772
+ }, {
1773
+ footer: u(() => [
1774
+ o(e(mt), { size: "sm" }, {
1775
+ default: u(() => [
1776
+ o(e(ue), {
1777
+ variant: "outline",
1778
+ onClick: i[34] || (i[34] = (s) => e(x)())
1779
+ }, {
1780
+ default: u(() => [
1781
+ z(A(e(t)("fields.cancel")), 1)
1782
+ ]),
1783
+ _: 1
1784
+ }),
1785
+ o(e(ue), {
1786
+ type: "primary",
1787
+ loading: I.value,
1788
+ onClick: $t
1789
+ }, {
1790
+ default: u(() => [
1791
+ z(A(e(t)("fields.save")), 1)
1792
+ ]),
1793
+ _: 1
1794
+ }, 8, ["loading"])
1795
+ ]),
1796
+ _: 1
1797
+ })
1798
+ ]),
1799
+ default: u(() => [
1800
+ Q("div", Bl, [
1801
+ U.value ? (d(), g(e(H), {
1802
+ key: 0,
1803
+ size: "sm",
1804
+ tone: "muted"
1805
+ }, {
1806
+ default: u(() => [
1807
+ z(A(e(t)("fields.step-help")), 1)
1808
+ ]),
1809
+ _: 1
1810
+ })) : T("", !0),
1811
+ U.value ? T("", !0) : (d(), g(e(D), {
1812
+ key: 1,
1813
+ label: e(t)("fields.type")
1814
+ }, {
1815
+ default: u(() => [
1816
+ o(e(ce), {
1817
+ modelValue: $.value,
1818
+ "onUpdate:modelValue": i[0] || (i[0] = (s) => $.value = s),
1819
+ options: m.value,
1820
+ status: oe("type") ? "error" : void 0
1821
+ }, null, 8, ["modelValue", "options", "status"]),
1822
+ oe("type") ? (d(), g(e(H), {
1823
+ key: 0,
1824
+ size: "sm",
1825
+ tone: "danger"
1826
+ }, {
1827
+ default: u(() => [
1828
+ z(A(oe("type")), 1)
1829
+ ]),
1830
+ _: 1
1831
+ })) : T("", !0)
1832
+ ]),
1833
+ _: 1
1834
+ }, 8, ["label"])),
1835
+ o(e(D), {
1836
+ label: U.value ? e(t)("fields.step-title") : e(t)("fields.title"),
1837
+ error: oe("title"),
1838
+ required: ""
1839
+ }, {
1840
+ default: u(() => [
1841
+ o(e(ne), {
1842
+ modelValue: V.value,
1843
+ "onUpdate:modelValue": i[1] || (i[1] = (s) => V.value = s),
1844
+ localized: ""
1845
+ }, null, 8, ["modelValue"])
1846
+ ]),
1847
+ _: 1
1848
+ }, 8, ["label", "error"]),
1849
+ U.value ? (d(), R(te, { key: 2 }, [
1850
+ o(e(D), {
1851
+ label: e(t)("fields.step-label"),
1852
+ help: e(t)("fields.step-label-help")
1853
+ }, {
1854
+ default: u(() => [
1855
+ o(e(ne), {
1856
+ modelValue: ee.value,
1857
+ "onUpdate:modelValue": i[2] || (i[2] = (s) => ee.value = s),
1858
+ localized: ""
1859
+ }, null, 8, ["modelValue"])
1860
+ ]),
1861
+ _: 1
1862
+ }, 8, ["label", "help"]),
1863
+ o(e(D), {
1864
+ label: e(t)("fields.step-hint")
1865
+ }, {
1866
+ default: u(() => [
1867
+ o(e(ne), {
1868
+ modelValue: X.value,
1869
+ "onUpdate:modelValue": i[3] || (i[3] = (s) => X.value = s),
1870
+ localized: ""
1871
+ }, null, 8, ["modelValue"])
1872
+ ]),
1873
+ _: 1
1874
+ }, 8, ["label"]),
1875
+ o(e(D), {
1876
+ label: e(t)("fields.step-next"),
1877
+ help: e(t)("fields.step-next-help")
1878
+ }, {
1879
+ default: u(() => [
1880
+ o(e(ne), {
1881
+ "model-value": S.value["next-text"] ?? {},
1882
+ localized: "",
1883
+ "onUpdate:modelValue": i[4] || (i[4] = (s) => K("next-text", s))
1884
+ }, null, 8, ["model-value"])
1885
+ ]),
1886
+ _: 1
1887
+ }, 8, ["label", "help"])
1888
+ ], 64)) : w.value ? (d(), R(te, { key: 3 }, [
1889
+ o(e(H), {
1890
+ size: "sm",
1891
+ tone: "muted"
1892
+ }, {
1893
+ default: u(() => [
1894
+ z(A(e(t)("fields.summary-help")), 1)
1895
+ ]),
1896
+ _: 1
1897
+ }),
1898
+ o(e(D), {
1899
+ label: e(t)("fields.help")
1900
+ }, {
1901
+ default: u(() => [
1902
+ o(e(ne), {
1903
+ modelValue: X.value,
1904
+ "onUpdate:modelValue": i[5] || (i[5] = (s) => X.value = s),
1905
+ localized: ""
1906
+ }, null, 8, ["modelValue"])
1907
+ ]),
1908
+ _: 1
1909
+ }, 8, ["label"]),
1910
+ o(e(D), {
1911
+ label: e(t)("fields.summary-fields"),
1912
+ help: e(t)("fields.summary-fields-help")
1913
+ }, {
1914
+ default: u(() => [
1915
+ o(e(ce), {
1916
+ modelValue: ae.value,
1917
+ "onUpdate:modelValue": i[6] || (i[6] = (s) => ae.value = s),
1918
+ options: L.value,
1919
+ placeholder: e(t)("fields.summary-all"),
1920
+ multiple: ""
1921
+ }, null, 8, ["modelValue", "options", "placeholder"])
1922
+ ]),
1923
+ _: 1
1924
+ }, 8, ["label", "help"]),
1925
+ ge.value ? (d(), g(e(_e), {
1926
+ key: 0,
1927
+ type: "info",
1928
+ variant: "soft",
1929
+ description: e(t)("fields.summary-flat")
1930
+ }, null, 8, ["description"])) : T("", !0)
1931
+ ], 64)) : xe.value ? (d(), R(te, { key: 4 }, [
1932
+ o(e(H), {
1933
+ size: "sm",
1934
+ tone: "muted"
1935
+ }, {
1936
+ default: u(() => [
1937
+ z(A(e(t)("fields.datetime-help")), 1)
1938
+ ]),
1939
+ _: 1
1940
+ }),
1941
+ o(e(D), {
1942
+ label: e(t)("fields.help")
1943
+ }, {
1944
+ default: u(() => [
1945
+ o(e(ne), {
1946
+ modelValue: X.value,
1947
+ "onUpdate:modelValue": i[7] || (i[7] = (s) => X.value = s),
1948
+ localized: ""
1949
+ }, null, 8, ["modelValue"])
1950
+ ]),
1951
+ _: 1
1952
+ }, 8, ["label"]),
1953
+ Q("div", Ll, [
1954
+ o(e(D), {
1955
+ label: e(t)("fields.time-step"),
1956
+ error: oe("options.time-step")
1957
+ }, {
1958
+ default: u(() => [
1959
+ o(e(ce), {
1960
+ "model-value": $e.value,
1961
+ options: He.value,
1962
+ "onUpdate:modelValue": i[8] || (i[8] = (s) => K("time-step", Number(s)))
1963
+ }, null, 8, ["model-value", "options"])
1964
+ ]),
1965
+ _: 1
1966
+ }, 8, ["label", "error"]),
1967
+ o(e(D), {
1968
+ label: e(t)("fields.time-from"),
1969
+ error: oe("options.time-from")
1970
+ }, {
1971
+ default: u(() => [
1972
+ o(e(st), {
1973
+ "model-value": Ce.value,
1974
+ "minutes-increment": 5,
1975
+ "aria-label": e(t)("fields.time-from"),
1976
+ "onUpdate:modelValue": i[9] || (i[9] = (s) => K("time-from", s ?? "09:00"))
1977
+ }, null, 8, ["model-value", "aria-label"])
1978
+ ]),
1979
+ _: 1
1980
+ }, 8, ["label", "error"]),
1981
+ o(e(D), {
1982
+ label: e(t)("fields.time-to"),
1983
+ error: oe("options.time-to")
1984
+ }, {
1985
+ default: u(() => [
1986
+ o(e(st), {
1987
+ "model-value": We.value,
1988
+ "minutes-increment": 5,
1989
+ "aria-label": e(t)("fields.time-to"),
1990
+ "onUpdate:modelValue": i[10] || (i[10] = (s) => K("time-to", s ?? "17:00"))
1991
+ }, null, 8, ["model-value", "aria-label"])
1992
+ ]),
1993
+ _: 1
1994
+ }, 8, ["label", "error"])
1995
+ ]),
1996
+ o(e(H), {
1997
+ size: "sm",
1998
+ tone: "muted"
1999
+ }, {
2000
+ default: u(() => [
2001
+ z(A(e(t)("fields.time-help")), 1)
2002
+ ]),
2003
+ _: 1
2004
+ }),
2005
+ o(e(D), {
2006
+ label: e(t)("fields.weekdays"),
2007
+ help: e(t)("fields.weekdays-help"),
2008
+ error: oe("options.weekdays")
2009
+ }, {
2010
+ default: u(() => [
2011
+ Q("div", Hl, [
2012
+ (d(!0), R(te, null, fe(ze.value, (s) => (d(), g(e(he), {
2013
+ key: s.value,
2014
+ "model-value": Ae.value.includes(s.value),
2015
+ label: s.label,
2016
+ "onUpdate:modelValue": (J) => je(s.value, !!J)
2017
+ }, null, 8, ["model-value", "label", "onUpdate:modelValue"]))), 128)),
2018
+ o(e(ue), {
2019
+ variant: "outline",
2020
+ size: "sm",
2021
+ onClick: i[11] || (i[11] = (s) => K("weekdays", [1, 2, 3, 4, 5]))
2022
+ }, {
2023
+ default: u(() => [
2024
+ z(A(e(t)("fields.weekdays-workdays")), 1)
2025
+ ]),
2026
+ _: 1
2027
+ })
2028
+ ])
2029
+ ]),
2030
+ _: 1
2031
+ }, 8, ["label", "help", "error"]),
2032
+ o(e(D), {
2033
+ label: e(t)("fields.timezone-label"),
2034
+ help: e(t)("fields.timezone-label-help", { label: P.value })
2035
+ }, {
2036
+ default: u(() => [
2037
+ o(e(ne), {
2038
+ "model-value": S.value["timezone-label"] ?? {},
2039
+ localized: "",
2040
+ "onUpdate:modelValue": i[12] || (i[12] = (s) => K("timezone-label", s))
2041
+ }, null, 8, ["model-value"])
2042
+ ]),
2043
+ _: 1
2044
+ }, 8, ["label", "help"]),
2045
+ o(e(_e), {
2046
+ type: "info",
2047
+ variant: "soft",
2048
+ description: e(t)("fields.timezone-site", { zone: a.form.timezone ?? "UTC" }) + " " + e(t)("fields.times-preview", { times: h.value })
2049
+ }, null, 8, ["description"])
2050
+ ], 64)) : $.value !== "hidden" ? (d(), R(te, { key: 5 }, [
2051
+ $.value !== "consent" ? (d(), g(e(D), {
2052
+ key: 0,
2053
+ label: e(t)("fields.placeholder")
2054
+ }, {
2055
+ default: u(() => [
2056
+ o(e(ne), {
2057
+ modelValue: ee.value,
2058
+ "onUpdate:modelValue": i[13] || (i[13] = (s) => ee.value = s),
2059
+ localized: ""
2060
+ }, null, 8, ["modelValue"])
2061
+ ]),
2062
+ _: 1
2063
+ }, 8, ["label"])) : T("", !0),
2064
+ o(e(D), {
2065
+ label: e(t)("fields.help")
2066
+ }, {
2067
+ default: u(() => [
2068
+ o(e(ne), {
2069
+ modelValue: X.value,
2070
+ "onUpdate:modelValue": i[14] || (i[14] = (s) => X.value = s),
2071
+ localized: ""
2072
+ }, null, 8, ["modelValue"])
2073
+ ]),
2074
+ _: 1
2075
+ }, 8, ["label"])
2076
+ ], 64)) : T("", !0),
2077
+ $.value === "consent" ? (d(), g(e(D), {
2078
+ key: 6,
2079
+ label: e(t)("fields.consent-text"),
2080
+ help: e(t)("fields.consent-text-help")
2081
+ }, {
2082
+ default: u(() => [
2083
+ o(Ml, {
2084
+ "model-value": S.value.text ?? {},
2085
+ "min-height": "100px",
2086
+ "onUpdate:modelValue": i[15] || (i[15] = (s) => K("text", s))
2087
+ }, null, 8, ["model-value"])
2088
+ ]),
2089
+ _: 1
2090
+ }, 8, ["label", "help"])) : T("", !0),
2091
+ et.value ? (d(), R("div", jl, [
2092
+ o(e(D), {
2093
+ label: e(t)("fields.view"),
2094
+ help: Ue.value ? e(t)("fields.view-help") : void 0
2095
+ }, {
2096
+ default: u(() => [
2097
+ o(e(vt), {
2098
+ "model-value": Ue.value ? "cards" : "list",
2099
+ options: kt.value,
2100
+ size: "sm",
2101
+ "aria-label": e(t)("fields.view"),
2102
+ "onUpdate:modelValue": i[16] || (i[16] = (s) => _t(String(s)))
2103
+ }, null, 8, ["model-value", "options", "aria-label"])
2104
+ ]),
2105
+ _: 1
2106
+ }, 8, ["label", "help"]),
2107
+ Ue.value ? (d(), g(e(D), {
2108
+ key: 0,
2109
+ label: e(t)("fields.columns")
2110
+ }, {
2111
+ default: u(() => [
2112
+ o(e(ke), {
2113
+ "model-value": S.value.columns ?? 1,
2114
+ min: 1,
2115
+ max: 4,
2116
+ "onUpdate:modelValue": i[17] || (i[17] = (s) => K("columns", s))
2117
+ }, null, 8, ["model-value"])
2118
+ ]),
2119
+ _: 1
2120
+ }, 8, ["label"])) : T("", !0)
2121
+ ])) : T("", !0),
2122
+ Be.value ? (d(), R("div", Xl, [
2123
+ o(e(H), {
2124
+ size: "sm",
2125
+ weight: "medium"
2126
+ }, {
2127
+ default: u(() => [
2128
+ z(A(e(t)("fields.choices")), 1)
2129
+ ]),
2130
+ _: 1
2131
+ }),
2132
+ C.value.length === 0 ? (d(), g(e(H), {
2133
+ key: 0,
2134
+ size: "sm",
2135
+ tone: "placeholder"
2136
+ }, {
2137
+ default: u(() => [
2138
+ z(A(e(t)("fields.no-choices")), 1)
2139
+ ]),
2140
+ _: 1
2141
+ })) : T("", !0),
2142
+ (d(!0), R(te, null, fe(C.value, (s, J) => (d(), R("div", {
2143
+ key: J,
2144
+ class: Oe(["wx-inbox-choices__item", { "is-card": Ue.value }])
2145
+ }, [
2146
+ Q("div", Yl, [
2147
+ o(e(ne), {
2148
+ "model-value": s.value,
2149
+ placeholder: e(t)("fields.choice-value"),
2150
+ "onUpdate:modelValue": (le) => Ee(J, { value: String(le) })
2151
+ }, null, 8, ["model-value", "placeholder", "onUpdate:modelValue"]),
2152
+ o(e(ne), {
2153
+ "model-value": s.label,
2154
+ localized: "",
2155
+ placeholder: e(t)("fields.choice-label"),
2156
+ "onUpdate:modelValue": (le) => Ee(J, { label: le })
2157
+ }, null, 8, ["model-value", "placeholder", "onUpdate:modelValue"]),
2158
+ o(e(Ze), Nt({
2159
+ icon: "trash",
2160
+ tone: "danger",
2161
+ title: e(t)("fields.delete")
2162
+ }, { ref_for: !0 }, e(_), {
2163
+ onClick: (le) => St(J)
2164
+ }), null, 16, ["title", "onClick"])
2165
+ ]),
2166
+ Ue.value ? (d(), R("div", Gl, [
2167
+ tt.value ? (d(), g(Wt(tt.value), {
2168
+ key: 0,
2169
+ class: "wx-inbox-choices__image",
2170
+ "model-value": s.image ?? null,
2171
+ label: e(t)("fields.choice-image"),
2172
+ accept: "image",
2173
+ aspect: "4/3",
2174
+ width: 160,
2175
+ captions: !1,
2176
+ "onUpdate:modelValue": (le) => Ee(J, { image: le })
2177
+ }, null, 8, ["model-value", "label", "onUpdate:modelValue"])) : T("", !0),
2178
+ o(e(ne), {
2179
+ class: "wx-inbox-choices__description",
2180
+ "model-value": s.description ?? {},
2181
+ localized: "",
2182
+ placeholder: e(t)("fields.choice-description"),
2183
+ "aria-label": e(t)("fields.choice-description"),
2184
+ "onUpdate:modelValue": (le) => Ee(J, { description: le })
2185
+ }, null, 8, ["model-value", "placeholder", "aria-label", "onUpdate:modelValue"])
2186
+ ])) : T("", !0)
2187
+ ], 2))), 128)),
2188
+ o(e(ue), {
2189
+ variant: "outline",
2190
+ size: "sm",
2191
+ onClick: Vt
2192
+ }, {
2193
+ icon: u(() => [
2194
+ o(e(re), { name: "plus" })
2195
+ ]),
2196
+ default: u(() => [
2197
+ z(" " + A(e(t)("fields.add-choice")), 1)
2198
+ ]),
2199
+ _: 1
2200
+ }),
2201
+ oe("options.choices") ? (d(), g(e(H), {
2202
+ key: 1,
2203
+ size: "sm",
2204
+ tone: "danger"
2205
+ }, {
2206
+ default: u(() => [
2207
+ z(A(oe("options.choices")), 1)
2208
+ ]),
2209
+ _: 1
2210
+ })) : T("", !0)
2211
+ ])) : T("", !0),
2212
+ Q("div", Kl, [
2213
+ $.value === "textarea" ? (d(), g(e(D), {
2214
+ key: 0,
2215
+ label: e(t)("fields.rows")
2216
+ }, {
2217
+ default: u(() => [
2218
+ o(e(ke), {
2219
+ "model-value": S.value.rows ?? 5,
2220
+ min: 2,
2221
+ max: 30,
2222
+ "onUpdate:modelValue": i[18] || (i[18] = (s) => K("rows", s))
2223
+ }, null, 8, ["model-value"])
2224
+ ]),
2225
+ _: 1
2226
+ }, 8, ["label"])) : T("", !0),
2227
+ ["text", "email", "textarea"].includes($.value) ? (d(), g(e(D), {
2228
+ key: 1,
2229
+ label: e(t)("fields.maxlength")
2230
+ }, {
2231
+ default: u(() => [
2232
+ o(e(ke), {
2233
+ "model-value": S.value.maxlength ?? null,
2234
+ min: 1,
2235
+ max: 2e4,
2236
+ "onUpdate:modelValue": i[19] || (i[19] = (s) => K("maxlength", s))
2237
+ }, null, 8, ["model-value"])
2238
+ ]),
2239
+ _: 1
2240
+ }, 8, ["label"])) : T("", !0),
2241
+ $.value === "tel" ? (d(), g(e(D), {
2242
+ key: 2,
2243
+ label: e(t)("fields.pattern"),
2244
+ help: e(t)("fields.pattern-help")
2245
+ }, {
2246
+ default: u(() => [
2247
+ o(e(ne), {
2248
+ "model-value": S.value.pattern ?? "",
2249
+ "onUpdate:modelValue": i[20] || (i[20] = (s) => K("pattern", s))
2250
+ }, null, 8, ["model-value"])
2251
+ ]),
2252
+ _: 1
2253
+ }, 8, ["label", "help"])) : T("", !0),
2254
+ $.value === "date" ? (d(), R(te, { key: 3 }, [
2255
+ o(e(D), {
2256
+ label: e(t)("fields.earliest")
2257
+ }, {
2258
+ default: u(() => [
2259
+ o(e(Re), {
2260
+ clearable: "",
2261
+ "model-value": S.value.min ?? null,
2262
+ "onUpdate:modelValue": i[21] || (i[21] = (s) => K("min", s))
2263
+ }, null, 8, ["model-value"])
2264
+ ]),
2265
+ _: 1
2266
+ }, 8, ["label"]),
2267
+ o(e(D), {
2268
+ label: e(t)("fields.latest")
2269
+ }, {
2270
+ default: u(() => [
2271
+ o(e(Re), {
2272
+ clearable: "",
2273
+ "model-value": S.value.max ?? null,
2274
+ "onUpdate:modelValue": i[22] || (i[22] = (s) => K("max", s))
2275
+ }, null, 8, ["model-value"])
2276
+ ]),
2277
+ _: 1
2278
+ }, 8, ["label"])
2279
+ ], 64)) : T("", !0),
2280
+ $.value === "checkbox" ? (d(), R(te, { key: 4 }, [
2281
+ o(e(D), {
2282
+ label: e(t)("fields.min-choices")
2283
+ }, {
2284
+ default: u(() => [
2285
+ o(e(ke), {
2286
+ "model-value": S.value.min ?? null,
2287
+ min: 0,
2288
+ "onUpdate:modelValue": i[23] || (i[23] = (s) => K("min", s))
2289
+ }, null, 8, ["model-value"])
2290
+ ]),
2291
+ _: 1
2292
+ }, 8, ["label"]),
2293
+ o(e(D), {
2294
+ label: e(t)("fields.max-choices")
2295
+ }, {
2296
+ default: u(() => [
2297
+ o(e(ke), {
2298
+ "model-value": S.value.max ?? null,
2299
+ min: 0,
2300
+ "onUpdate:modelValue": i[24] || (i[24] = (s) => K("max", s))
2301
+ }, null, 8, ["model-value"])
2302
+ ]),
2303
+ _: 1
2304
+ }, 8, ["label"])
2305
+ ], 64)) : T("", !0),
2306
+ $.value === "file" ? (d(), g(e(D), {
2307
+ key: 5,
2308
+ label: e(t)("fields.max-size")
2309
+ }, {
2310
+ default: u(() => [
2311
+ o(e(ke), {
2312
+ "model-value": S.value.max_size ?? null,
2313
+ min: 1,
2314
+ "onUpdate:modelValue": i[25] || (i[25] = (s) => K("max_size", s))
2315
+ }, null, 8, ["model-value"])
2316
+ ]),
2317
+ _: 1
2318
+ }, 8, ["label"])) : T("", !0)
2319
+ ]),
2320
+ $.value === "file" ? (d(), R(te, { key: 9 }, [
2321
+ o(e(D), {
2322
+ label: e(t)("fields.extensions"),
2323
+ help: e(t)("fields.extensions-help")
2324
+ }, {
2325
+ default: u(() => [
2326
+ o(e(Ht), {
2327
+ modelValue: pe.value,
2328
+ "onUpdate:modelValue": i[26] || (i[26] = (s) => pe.value = s)
2329
+ }, null, 8, ["modelValue"])
2330
+ ]),
2331
+ _: 1
2332
+ }, 8, ["label", "help"]),
2333
+ o(e(he), {
2334
+ "model-value": !!S.value.multiple,
2335
+ label: e(t)("fields.multiple"),
2336
+ "onUpdate:modelValue": i[27] || (i[27] = (s) => K("multiple", s))
2337
+ }, null, 8, ["model-value", "label"])
2338
+ ], 64)) : T("", !0),
2339
+ $.value !== "hidden" && !w.value ? (d(), g(Dl, {
2340
+ key: 10,
2341
+ options: S.value,
2342
+ above: lt.value,
2343
+ fields: a.fields,
2344
+ errors: Tt.value,
2345
+ "onUpdate:options": i[28] || (i[28] = (s) => S.value = s)
2346
+ }, null, 8, ["options", "above", "fields", "errors"])) : T("", !0),
2347
+ Q("div", Ql, [
2348
+ o(e(he), {
2349
+ modelValue: B.value,
2350
+ "onUpdate:modelValue": i[29] || (i[29] = (s) => B.value = s),
2351
+ label: e(t)("fields.is-enabled")
2352
+ }, null, 8, ["modelValue", "label"]),
2353
+ O.value ? (d(), R(te, { key: 0 }, [
2354
+ o(e(he), {
2355
+ modelValue: Z.value,
2356
+ "onUpdate:modelValue": i[30] || (i[30] = (s) => Z.value = s),
2357
+ label: e(t)("fields.is-required")
2358
+ }, null, 8, ["modelValue", "label"]),
2359
+ $.value !== "hidden" ? (d(), g(e(he), {
2360
+ key: 0,
2361
+ modelValue: E.value,
2362
+ "onUpdate:modelValue": i[31] || (i[31] = (s) => E.value = s),
2363
+ label: e(t)("fields.is-fullsize")
2364
+ }, null, 8, ["modelValue", "label"])) : T("", !0),
2365
+ o(e(he), {
2366
+ modelValue: M.value,
2367
+ "onUpdate:modelValue": i[32] || (i[32] = (s) => M.value = s),
2368
+ label: e(t)("fields.in-table")
2369
+ }, null, 8, ["modelValue", "label"])
2370
+ ], 64)) : T("", !0)
2371
+ ]),
2372
+ U.value && !B.value ? (d(), g(e(H), {
2373
+ key: 11,
2374
+ size: "sm",
2375
+ tone: "muted"
2376
+ }, {
2377
+ default: u(() => [
2378
+ z(A(e(t)("fields.step-off-help")), 1)
2379
+ ]),
2380
+ _: 1
2381
+ })) : T("", !0),
2382
+ Q("section", Zl, [
2383
+ o(e(H), {
2384
+ size: "sm",
2385
+ weight: "medium",
2386
+ tone: "muted"
2387
+ }, {
2388
+ default: u(() => [
2389
+ z(A(e(t)("fields.advanced")), 1)
2390
+ ]),
2391
+ _: 1
2392
+ }),
2393
+ o(e(D), {
2394
+ label: e(t)("fields.name"),
2395
+ help: U.value ? e(t)("fields.step-name-help") : e(t)("fields.name-help", { name: j.value.trim() || "name" }),
2396
+ error: oe("name")
2397
+ }, {
2398
+ default: u(() => [
2399
+ o(e(al), {
2400
+ "model-value": j.value,
2401
+ separator: "_-",
2402
+ lead: "field",
2403
+ maxlength: 64,
2404
+ placeholder: "phone",
2405
+ "onUpdate:modelValue": i[33] || (i[33] = (s) => b(String(s ?? "")))
2406
+ }, null, 8, ["model-value"])
2407
+ ]),
2408
+ _: 1
2409
+ }, 8, ["label", "help", "error"]),
2410
+ f.value ? (d(), g(e(_e), {
2411
+ key: 0,
2412
+ type: "warning",
2413
+ variant: "soft",
2414
+ description: e(t)("fields.name-renamed", { old: f.value, new: j.value.trim() })
2415
+ }, null, 8, ["description"])) : T("", !0)
2416
+ ])
2417
+ ])
2418
+ ]),
2419
+ _: 1
2420
+ }, 8, ["open", "title"]));
2421
+ }
2422
+ }), ea = /* @__PURE__ */ Te(Jl, [["__scopeId", "data-v-78aed42f"]]), ta = { class: "wx-inbox-fields__add" }, la = {
2423
+ key: 0,
2424
+ class: "wx-inbox-field is-step"
2425
+ }, aa = { class: "wx-inbox-field__name" }, na = { class: "wx-inbox-field__name" }, sa = /* @__PURE__ */ be({
2426
+ __name: "FieldList",
2427
+ props: /* @__PURE__ */ Qe({
2428
+ form: {},
2429
+ canManage: { type: Boolean }
2430
+ }, {
2431
+ modelValue: { required: !0 },
2432
+ modelModifiers: {}
2433
+ }),
2434
+ emits: ["update:modelValue"],
2435
+ setup(a) {
2436
+ const n = a, r = Ke(a, "modelValue"), x = Ve(), p = Pe(x), F = ye();
2437
+ Se();
2438
+ const l = ve("webx-inbox"), t = Me(), _ = pt(ea);
2439
+ function N(k) {
2440
+ return me(k.title, F.active.value, k.key);
2441
+ }
2442
+ function I(k) {
2443
+ return ie(k) ? [] : [
2444
+ l(`fields.type-${k.type}`),
2445
+ ...k.is_required ? [l("fields.is-required")] : [],
2446
+ ...k.in_table ? [l("fields.in-table")] : [],
2447
+ // Full width is the rule; only the exception is worth a word.
2448
+ ...k.is_fullsize ? [] : [l("fields.is-halfsize")]
2449
+ ];
2450
+ }
2451
+ function W(k) {
2452
+ const v = l("fields.condition-ticked"), b = ["when", "unless"].flatMap((f) => {
2453
+ const m = qe(k.options, f);
2454
+ return m === null ? [] : [
2455
+ l(`fields.shown-${f}`, {
2456
+ condition: wt(m, r.value, F.active.value, v)
2457
+ })
2458
+ ];
2459
+ });
2460
+ return b.length === 0 ? null : b.join("; ");
2461
+ }
2462
+ function j(k) {
2463
+ const v = r.value.find((b) => b.key === k.name);
2464
+ return l(`fields.problem-${k.code.replace("_", "-")}`, {
2465
+ field: v ? N(v) : k.name,
2466
+ value: k.value ?? ""
2467
+ });
2468
+ }
2469
+ const $ = y(
2470
+ () => new Map(
2471
+ r.value.map((k) => [k.id, El(k, r.value).map(j)])
2472
+ )
2473
+ ), V = y(() => r.value.length === 0), ee = y(() => kl(r.value)), X = y(() => _l(r.value)), S = y(() => ee.value.size > 0), Y = y(
2474
+ () => !V.value && xl(r.value) + (S.value ? 1 : 2) <= yl
2475
+ );
2476
+ function G(k) {
2477
+ return l("fields.step-numbered", { number: ee.value.get(k.id) ?? 1, title: N(k) });
2478
+ }
2479
+ async function B(k, v = !1) {
2480
+ const b = r.value.filter((m) => m.id !== k?.id).map((m) => m.key), f = await _({ field: k, form: n.form, taken: b, fields: r.value, step: v });
2481
+ f && (r.value = k === null ? [...r.value, f] : r.value.map((m) => m.id === f.id ? f : m));
2482
+ }
2483
+ async function Z(k) {
2484
+ if (await ft({
2485
+ title: l("fields.delete-title", { field: N(k) }),
2486
+ message: ie(k) ? l("fields.delete-step-text") : l("fields.delete-text"),
2487
+ confirmText: l("fields.delete"),
2488
+ cancelText: l("fields.cancel"),
2489
+ tone: "danger"
2490
+ }))
2491
+ try {
2492
+ await p.removeField(k.id), r.value = r.value.filter((b) => b.id !== k.id), se.success(l("panel.deleted"));
2493
+ } catch (b) {
2494
+ se.danger(t(b));
2495
+ }
2496
+ }
2497
+ function E(k) {
2498
+ return n.canManage ? [
2499
+ { key: "edit", icon: "edit", label: l("fields.edit"), run: () => {
2500
+ B(k);
2501
+ } },
2502
+ {
2503
+ key: "delete",
2504
+ icon: "trash",
2505
+ label: l("fields.delete"),
2506
+ danger: !0,
2507
+ run: () => {
2508
+ Z(k);
2509
+ }
2510
+ }
2511
+ ] : [];
2512
+ }
2513
+ async function M() {
2514
+ try {
2515
+ await p.sortFields(
2516
+ n.form.id,
2517
+ r.value.map((k) => k.id)
2518
+ );
2519
+ } catch (k) {
2520
+ se.danger(t(k, l("panel.reorder-failed"))), r.value = await p.fields(n.form.id).catch(() => r.value);
2521
+ }
2522
+ }
2523
+ return (k, v) => (d(), g(e(jt), {
2524
+ title: e(l)("panel.tab-fields")
2525
+ }, dt({
2526
+ default: u(() => [
2527
+ V.value ? (d(), g(e(Xt), {
2528
+ key: 0,
2529
+ title: e(l)("fields.no-fields"),
2530
+ description: e(l)("fields.no-fields-help")
2531
+ }, null, 8, ["title", "description"])) : (d(), g(e(Yt), {
2532
+ key: 1,
2533
+ modelValue: r.value,
2534
+ "onUpdate:modelValue": v[2] || (v[2] = (b) => r.value = b),
2535
+ plain: "",
2536
+ "item-key": "id",
2537
+ "item-label": N,
2538
+ "drag-label": e(l)("panel.reorder"),
2539
+ disabled: !a.canManage,
2540
+ "aria-label": e(l)("panel.tab-fields"),
2541
+ onMove: M
2542
+ }, {
2543
+ default: u(({ item: b }) => [
2544
+ e(ie)(b) ? (d(), R("div", la, [
2545
+ Q("div", aa, [
2546
+ o(e(re), {
2547
+ name: "list",
2548
+ size: "sm",
2549
+ "aria-hidden": "true"
2550
+ }),
2551
+ o(e(H), {
2552
+ weight: "semibold",
2553
+ truncate: ""
2554
+ }, {
2555
+ default: u(() => [
2556
+ z(A(G(b)), 1)
2557
+ ]),
2558
+ _: 2
2559
+ }, 1024),
2560
+ b.is_enabled ? T("", !0) : (d(), g(e(de), {
2561
+ key: 0,
2562
+ type: "default"
2563
+ }, {
2564
+ default: u(() => [
2565
+ z(A(e(l)("panel.off")), 1)
2566
+ ]),
2567
+ _: 1
2568
+ })),
2569
+ X.value.has(b.id) ? (d(), g(e(de), {
2570
+ key: 1,
2571
+ type: "warning"
2572
+ }, {
2573
+ default: u(() => [
2574
+ z(A(e(l)("fields.step-empty-badge")), 1)
2575
+ ]),
2576
+ _: 1
2577
+ })) : T("", !0),
2578
+ $.value.get(b.id)?.length ? (d(), g(e(de), {
2579
+ key: 2,
2580
+ type: "danger"
2581
+ }, {
2582
+ default: u(() => [
2583
+ z(A(e(l)("fields.condition-broken")), 1)
2584
+ ]),
2585
+ _: 1
2586
+ })) : T("", !0)
2587
+ ]),
2588
+ X.value.has(b.id) ? (d(), g(e(H), {
2589
+ key: 0,
2590
+ size: "sm",
2591
+ tone: "warning"
2592
+ }, {
2593
+ default: u(() => [
2594
+ z(A(e(l)("fields.step-empty")), 1)
2595
+ ]),
2596
+ _: 1
2597
+ })) : T("", !0),
2598
+ W(b) ? (d(), g(e(H), {
2599
+ key: 1,
2600
+ size: "sm",
2601
+ tone: "muted",
2602
+ class: "wx-inbox-field__condition"
2603
+ }, {
2604
+ default: u(() => [
2605
+ o(e(re), {
2606
+ name: "eye",
2607
+ size: "sm",
2608
+ "aria-hidden": "true"
2609
+ }),
2610
+ Q("span", null, A(W(b)), 1)
2611
+ ]),
2612
+ _: 2
2613
+ }, 1024)) : T("", !0),
2614
+ (d(!0), R(te, null, fe($.value.get(b.id) ?? [], (f) => (d(), g(e(H), {
2615
+ key: f,
2616
+ size: "sm",
2617
+ tone: "danger"
2618
+ }, {
2619
+ default: u(() => [
2620
+ z(A(f), 1)
2621
+ ]),
2622
+ _: 2
2623
+ }, 1024))), 128))
2624
+ ])) : (d(), R("div", {
2625
+ key: 1,
2626
+ class: Oe(["wx-inbox-field", { "is-inside": e(Vl)(r.value, b) }])
2627
+ }, [
2628
+ Q("div", na, [
2629
+ o(e(H), {
2630
+ weight: "medium",
2631
+ truncate: ""
2632
+ }, {
2633
+ default: u(() => [
2634
+ z(A(N(b)), 1)
2635
+ ]),
2636
+ _: 2
2637
+ }, 1024),
2638
+ b.is_enabled ? T("", !0) : (d(), g(e(de), {
2639
+ key: 0,
2640
+ type: "default"
2641
+ }, {
2642
+ default: u(() => [
2643
+ z(A(e(l)("panel.off")), 1)
2644
+ ]),
2645
+ _: 1
2646
+ })),
2647
+ $.value.get(b.id)?.length ? (d(), g(e(de), {
2648
+ key: 1,
2649
+ type: "danger"
2650
+ }, {
2651
+ default: u(() => [
2652
+ z(A(e(l)("fields.condition-broken")), 1)
2653
+ ]),
2654
+ _: 1
2655
+ })) : T("", !0)
2656
+ ]),
2657
+ o(e(H), {
2658
+ size: "sm",
2659
+ tone: "muted",
2660
+ truncate: ""
2661
+ }, {
2662
+ default: u(() => [
2663
+ b.name ? (d(), R(te, { key: 0 }, [
2664
+ Q("code", null, A(b.name), 1),
2665
+ v[3] || (v[3] = z(" · ", -1))
2666
+ ], 64)) : T("", !0),
2667
+ z(A(I(b).join(" · ")), 1)
2668
+ ]),
2669
+ _: 2
2670
+ }, 1024),
2671
+ W(b) ? (d(), g(e(H), {
2672
+ key: 0,
2673
+ size: "sm",
2674
+ tone: "muted",
2675
+ class: "wx-inbox-field__condition"
2676
+ }, {
2677
+ default: u(() => [
2678
+ o(e(re), {
2679
+ name: "eye",
2680
+ size: "sm",
2681
+ "aria-hidden": "true"
2682
+ }),
2683
+ Q("span", null, A(W(b)), 1)
2684
+ ]),
2685
+ _: 2
2686
+ }, 1024)) : T("", !0),
2687
+ (d(!0), R(te, null, fe($.value.get(b.id) ?? [], (f) => (d(), g(e(H), {
2688
+ key: f,
2689
+ size: "sm",
2690
+ tone: "danger"
2691
+ }, {
2692
+ default: u(() => [
2693
+ z(A(f), 1)
2694
+ ]),
2695
+ _: 2
2696
+ }, 1024))), 128))
2697
+ ], 2))
2698
+ ]),
2699
+ actions: u(({ item: b }) => [
2700
+ o(e(Ge), {
2701
+ actions: E(b),
2702
+ label: N(b)
2703
+ }, null, 8, ["actions", "label"])
2704
+ ]),
2705
+ _: 1
2706
+ }, 8, ["modelValue", "drag-label", "disabled", "aria-label"]))
2707
+ ]),
2708
+ _: 2
2709
+ }, [
2710
+ a.canManage ? {
2711
+ name: "extra",
2712
+ fn: u(() => [
2713
+ Q("div", ta, [
2714
+ o(e(ue), {
2715
+ variant: "outline",
2716
+ size: "sm",
2717
+ disabled: !Y.value,
2718
+ onClick: v[0] || (v[0] = (b) => B(null, !0))
2719
+ }, {
2720
+ icon: u(() => [
2721
+ o(e(re), { name: "plus" })
2722
+ ]),
2723
+ default: u(() => [
2724
+ z(" " + A(e(l)("fields.add-step")), 1)
2725
+ ]),
2726
+ _: 1
2727
+ }, 8, ["disabled"]),
2728
+ o(e(ue), {
2729
+ type: "primary",
2730
+ size: "sm",
2731
+ onClick: v[1] || (v[1] = (b) => B(null))
2732
+ }, {
2733
+ icon: u(() => [
2734
+ o(e(re), { name: "plus" })
2735
+ ]),
2736
+ default: u(() => [
2737
+ z(" " + A(e(l)("fields.new-field")), 1)
2738
+ ]),
2739
+ _: 1
2740
+ })
2741
+ ])
2742
+ ]),
2743
+ key: "0"
2744
+ } : void 0
2745
+ ]), 1032, ["title"]));
2746
+ }
2747
+ }), fa = /* @__PURE__ */ Te(sa, [["__scopeId", "data-v-98c06f16"]]), va = De(() => import("./InboxPage-D1j4r5Wf.js")), ha = De(() => import("./FormEditorPage-BsJTI_wN.js")), ba = De(() => import("./StatusesPage-4pt80oR1.js")), ya = De(() => import("./SubmissionPage-DyygefM1.js"));
2748
+ export {
2749
+ fa as F,
2750
+ ma as S,
2751
+ ha as W,
2752
+ Te as _,
2753
+ Ml as a,
2754
+ pa as b,
2755
+ Pe as c,
2756
+ ul as d,
2757
+ Pl as e,
2758
+ bl as f,
2759
+ va as g,
2760
+ ba as h,
2761
+ ya as i,
2762
+ ra as j,
2763
+ il as k,
2764
+ ca as o,
2765
+ wl as q,
2766
+ Se as u
2767
+ };
2768
+ //# sourceMappingURL=index-CAa0K6Q6.js.map