@adatechnology/conversations-ui 0.15.1 → 0.16.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.
@@ -24,14 +24,265 @@ import {
24
24
  Headset,
25
25
  Clock3,
26
26
  ShoppingBag,
27
- RotateCcw
27
+ RotateCcw,
28
+ ListChecks
28
29
  } from "lucide-react";
29
30
 
31
+ // src/flows/labels.ts
32
+ var DEFAULT_FLOW_RUNNER_FIELD_LABELS = {
33
+ section: "Resposta do cliente",
34
+ fallbackMessage: "Mensagem quando a resposta n\xE3o serve",
35
+ fallbackPlaceholder: "Ex.: N\xE3o entendi. Escolha uma das op\xE7\xF5es.",
36
+ maxInvalidAnswers: "Tentativas antes de chamar uma pessoa",
37
+ maxInvalidAnswersHint: "Vazio = padr\xE3o do bot (2).",
38
+ minDateToday: "S\xF3 aceitar de hoje em diante",
39
+ afterContextKey: "Depois da data guardada em",
40
+ minValue: "M\xEDnimo",
41
+ maxValue: "M\xE1ximo",
42
+ minLength: "M\xEDnimo de caracteres",
43
+ maxLength: "M\xE1ximo de caracteres",
44
+ skipKeywords: "Palavras que pulam a pergunta",
45
+ skipKeywordsHint: "Separadas por v\xEDrgula. Ex.: pular, n\xE3o sei",
46
+ keywordRoutes: "Palavras-chave (texto livre)",
47
+ keywordRoutesHint: "Se a mensagem contiver a palavra, segue para o destino \u2014 sem acento e sem mai\xFAscula.",
48
+ addKeywordRoute: "Adicionar palavra-chave",
49
+ removeKeywordRoute: "Remover palavra-chave",
50
+ keywordPlaceholder: "hor\xE1rio",
51
+ optionDescription: "Descri\xE7\xE3o (lista)",
52
+ optionSection: "Se\xE7\xE3o",
53
+ listButtonLabel: "Texto do bot\xE3o da lista",
54
+ unmatchedChoice: "Resposta fora das op\xE7\xF5es",
55
+ unmatchedChoiceReask: "Perguntar de novo (padr\xE3o)",
56
+ unmatchedChoiceDefault: 'Seguir o "Caso contr\xE1rio"',
57
+ choiceProvider: "Provedor de op\xE7\xF5es",
58
+ choiceProviderHint: "Chave registrada pelo sistema (registerDynamicChoiceProvider).",
59
+ contextKey: "Guardar a escolha em",
60
+ placeholdersHint: "Use {{chave}} para inserir respostas anteriores, ex.: {{contactFirstName}}.",
61
+ paletteDynamicChoice: "Escolha din\xE2mica",
62
+ paletteDynamicChoiceHint: 'Op\xE7\xF5es calculadas na hora pelo sistema, com "ver mais"',
63
+ paletteMessage: "Mensagem",
64
+ paletteMessageHint: "Envia um texto e segue para o pr\xF3ximo passo"
65
+ };
66
+ var DEFAULT_FLOW_EDITOR_LABELS = {
67
+ legend: {
68
+ question: "Pergunta",
69
+ entrada_choice: "Escolha calculada",
70
+ action: "A\xE7\xE3o (simula\xE7\xE3o/atendimento)",
71
+ menu: "Menu",
72
+ condition: "Condi\xE7\xE3o",
73
+ dynamic_choice: "Escolha din\xE2mica"
74
+ },
75
+ startNodeTooltip: "In\xEDcio do fluxo",
76
+ detachedNodeTooltip: "Sem liga\xE7\xE3o de entrada \u2014 o bot n\xE3o chega neste n\xF3. Puxe um fio de outro card at\xE9 ele.",
77
+ liveCountTooltip: (count) => `${count} conversa(s) ativa(s) aqui agora`,
78
+ edgeFallbackLabel: "outro",
79
+ actionKindLabels: {
80
+ handoff: "Encaminhar para atendimento",
81
+ rate_limited_handoff: "Encaminhar (limite de simula\xE7\xF5es atingido)",
82
+ send_product_list: "Enviar cat\xE1logo de produtos",
83
+ send_media: "Enviar arquivos da biblioteca"
84
+ },
85
+ conditionOperatorLabels: {
86
+ ">": "maior que",
87
+ ">=": "maior ou igual a",
88
+ "<": "menor que",
89
+ "<=": "menor ou igual a",
90
+ "==": "igual a",
91
+ "!=": "diferente de",
92
+ contains: "cont\xE9m"
93
+ },
94
+ questionTypeLabels: {
95
+ text: "Texto livre",
96
+ money: "Valor em R$",
97
+ date: "Data",
98
+ int: "N\xFAmero inteiro",
99
+ cpf: "CPF",
100
+ choice: "Escolha (bot\xF5es/lista)"
101
+ },
102
+ runnerFields: DEFAULT_FLOW_RUNNER_FIELD_LABELS,
103
+ nodePanel: {
104
+ title: "Editar n\xF3",
105
+ contextKey: "Chave (contexto)",
106
+ nodeName: "Nome do n\xF3 (opcional)",
107
+ nodeNamePlaceholder: "Ex.: Enviar tabela de pre\xE7os",
108
+ nodeNameHint: "S\xF3 aparece no editor \u2014 o cliente n\xE3o v\xEA.",
109
+ questionType: "Tipo de resposta",
110
+ question: "Texto da pergunta",
111
+ options: "Op\xE7\xF5es (choice)",
112
+ addOption: "Adicionar op\xE7\xE3o",
113
+ removeOption: "Remover op\xE7\xE3o",
114
+ close: "Fechar painel",
115
+ optionId: "Valor",
116
+ optionLabel: "Texto exibido",
117
+ next: "Pr\xF3ximo n\xF3",
118
+ nextHint: "Tamb\xE9m \xE9 poss\xEDvel arrastar um fio no canvas para conectar.",
119
+ nextRowLabel: "Pr\xF3ximo",
120
+ otherFlowsGroup: "Outros fluxos (salto)",
121
+ nextByAnswer: (id) => `Se responder "${id}" \u2192`,
122
+ nextDefault: "Caso contr\xE1rio \u2192",
123
+ save: "Salvar altera\xE7\xF5es",
124
+ cancel: "Cancelar",
125
+ fixedLogicNotice: "Este n\xF3 tem l\xF3gica fixa (valida\xE7\xF5es/c\xE1lculos do sistema) \u2014 s\xF3 o texto e o destino s\xE3o edit\xE1veis.",
126
+ actionNotice: "N\xF3 de a\xE7\xE3o \u2014 dispara a a\xE7\xE3o registrada ou encaminha para atendimento humano.",
127
+ preview: "Como o cliente v\xEA no WhatsApp",
128
+ previewPlaceholder: "Pr\xE9-visualiza\xE7\xE3o\u2026",
129
+ previewEmptyBody: "(escreva o texto da mensagem)",
130
+ previewEmptyOption: "(sem texto)",
131
+ previewListButton: "Ver op\xE7\xF5es",
132
+ previewModeButtons: "Enviado como bot\xF5es (at\xE9 3 op\xE7\xF5es)",
133
+ previewModeList: "Enviado como lista (4+ op\xE7\xF5es)",
134
+ delete: "Excluir n\xF3",
135
+ deleteConfirm: "Excluir este n\xF3? Liga\xE7\xF5es que apontam para ele ficar\xE3o quebradas.",
136
+ directMessage: "Mensagem (opcional)",
137
+ fallbackMessage: "Mensagem de fallback (quando o cat\xE1logo n\xE3o est\xE1 dispon\xEDvel)",
138
+ conditionNotice: "N\xF3 de condi\xE7\xE3o \u2014 n\xE3o pergunta nada ao cliente, s\xF3 decide automaticamente entre Verdadeiro/Falso.",
139
+ conditionVariable: "Vari\xE1vel (chave j\xE1 coletada por uma pergunta anterior)",
140
+ conditionOperator: "Operador",
141
+ conditionValue: "Valor de compara\xE7\xE3o",
142
+ conditionTrue: "Se verdadeiro \u2192",
143
+ conditionFalse: "Se falso \u2192",
144
+ conditionVariableMissing: "Se a vari\xE1vel ainda n\xE3o foi coletada \u2192",
145
+ media: "Arquivos enviados neste ponto",
146
+ mediaUnavailable: "A biblioteca de arquivos n\xE3o est\xE1 dispon\xEDvel neste painel."
147
+ },
148
+ quickAdd: {
149
+ fromHandle: "Criar o pr\xF3ximo n\xF3 j\xE1 ligado aqui",
150
+ title: "Ligar em um n\xF3 novo",
151
+ disconnect: "Desligar este fio (o n\xF3 continua no fluxo)"
152
+ },
153
+ legendPanel: {
154
+ title: "Legenda",
155
+ nodes: "Cards",
156
+ connections: "Liga\xE7\xF5es",
157
+ linear: "Segue direto para o pr\xF3ximo",
158
+ branch: "Caminho de uma op\xE7\xE3o escolhida",
159
+ fallback: "Quando a resposta n\xE3o casa com nenhuma op\xE7\xE3o",
160
+ crossFlow: "Salta para outro fluxo",
161
+ live: "Tem conversa passando por aqui agora",
162
+ selfLoop: "Volta ao mesmo card \u2014 repete a pergunta",
163
+ detached: "Ningu\xE9m aponta para este card: o bot n\xE3o chega nele",
164
+ startNode: "Onde o fluxo come\xE7a"
165
+ },
166
+ palette: {
167
+ title: "Adicionar ao fluxo",
168
+ question: "Pergunta",
169
+ decision: "Decis\xE3o",
170
+ condition: "Condi\xE7\xE3o",
171
+ conditionHint: "Compara uma vari\xE1vel j\xE1 coletada e segue automaticamente, sem perguntar nada",
172
+ action: "A\xE7\xE3o"
173
+ },
174
+ flowMap: {
175
+ nodeCount: (count) => `${count} n\xF3(s)`,
176
+ openFlow: "Abrir fluxo",
177
+ toggleToMap: "Mapa de fluxos",
178
+ toggleToDetail: "Voltar ao editor"
179
+ },
180
+ flowGroup: {
181
+ focus: "Focar neste fluxo",
182
+ close: "Fechar"
183
+ },
184
+ crossFlowPortal: {
185
+ tooltip: "Clique para abrir esse fluxo aqui do lado, ligado ao ponto de onde ele \xE9 chamado",
186
+ goesTo: (label) => `\u21AA Vai para: ${label}`
187
+ },
188
+ collectionChain: {
189
+ feeds: (label) => `Alimenta: ${label}`
190
+ },
191
+ validation: {
192
+ title: "Antes de publicar",
193
+ errors: (count) => `${count} erro(s) \u2014 corrija antes de salvar`,
194
+ warnings: (count) => `${count} aviso(s)`,
195
+ noStart: "O fluxo precisa de um n\xF3 inicial v\xE1lido.",
196
+ brokenRef: (from, to) => `N\xF3 "${from}": liga\xE7\xE3o aponta para "${to}", que n\xE3o existe.`,
197
+ choiceWithoutOptions: (id) => `N\xF3 "${id}": escolha sem nenhuma op\xE7\xE3o.`,
198
+ duplicatedOptionId: (id, optionId) => `N\xF3 "${id}": valor de op\xE7\xE3o "${optionId}" duplicado.`,
199
+ optionWithoutTarget: (id, label) => `N\xF3 "${id}": op\xE7\xE3o "${label}" n\xE3o tem destino definido.`,
200
+ tooManyOptions: (id, count) => `N\xF3 "${id}": ${count} op\xE7\xF5es \u2014 o WhatsApp aceita no m\xE1ximo 10 em lista.`,
201
+ buttonTitleTooLong: (id, label) => `N\xF3 "${id}": bot\xE3o "${label}" passa de 20 caracteres.`,
202
+ listTitleTooLong: (id, label) => `N\xF3 "${id}": item de lista "${label}" passa de 24 caracteres.`,
203
+ bodyTooLong: (id) => `N\xF3 "${id}": texto passa de 1024 caracteres.`,
204
+ unreachable: (id) => `N\xF3 "${id}" \xE9 inalcan\xE7\xE1vel a partir do in\xEDcio do fluxo.`,
205
+ deadEndQuestion: (id) => `N\xF3 "${id}": pergunta sem pr\xF3ximo passo definido.`,
206
+ conditionIncomplete: (id) => `N\xF3 "${id}": condi\xE7\xE3o incompleta \u2014 defina vari\xE1vel, operador e valor.`,
207
+ conditionBranchMissing: (id, branch) => `N\xF3 "${id}": ramo "${branch === "true" ? "Verdadeiro" : "Falso"}" sem destino definido.`,
208
+ descriptionTooLong: (id, label) => `N\xF3 "${id}": a descri\xE7\xE3o de "${label}" passa de 72 caracteres.`,
209
+ dynamicChoiceWithoutProvider: (id) => `N\xF3 "${id}": escolha din\xE2mica sem provedor de op\xE7\xF5es.`,
210
+ choiceDefaultIgnored: (id) => `N\xF3 "${id}": o bot repergunta quando a resposta n\xE3o casa com uma op\xE7\xE3o, ent\xE3o "Caso contr\xE1rio" n\xE3o \xE9 seguido. Para seguir, mude "Resposta fora das op\xE7\xF5es".`
211
+ },
212
+ workspace: {
213
+ title: "Fluxos do Bot",
214
+ subtitle: "Blueprint visual dos fluxos de conversa, sincronizado com o que est\xE1 em produ\xE7\xE3o.",
215
+ loading: "Carregando fluxos\u2026",
216
+ loadError: "N\xE3o foi poss\xEDvel carregar os fluxos.",
217
+ saveGraph: "Publicar altera\xE7\xF5es",
218
+ saving: "Publicando\u2026",
219
+ saveSuccess: "Fluxo publicado! O bot j\xE1 est\xE1 usando a vers\xE3o nova.",
220
+ saveError: "N\xE3o foi poss\xEDvel salvar \u2014 verifique se todos os destinos apontam para n\xF3s existentes.",
221
+ organize: "Organizar",
222
+ organizeTooltip: "Reorganiza os n\xF3s automaticamente e salva as novas posi\xE7\xF5es",
223
+ discardChanges: "Desfazer altera\xE7\xF5es",
224
+ discardTooltip: "Devolve os fluxos abertos ao que est\xE1 publicado, descartando o que n\xE3o foi salvo",
225
+ discardConfirm: "Descartar todas as altera\xE7\xF5es n\xE3o publicadas e voltar ao fluxo que est\xE1 no ar?",
226
+ unsavedChangesConfirm: "Voc\xEA tem altera\xE7\xF5es n\xE3o publicadas neste fluxo. Trocar de fluxo agora descarta essas edi\xE7\xF5es. Continuar?"
227
+ },
228
+ flowManager: {
229
+ newFlow: "Novo fluxo",
230
+ createTitle: "Criar novo fluxo",
231
+ key: "Identificador \xFAnico",
232
+ keyHint: "letras min\xFAsculas, n\xFAmeros e _ (ex.: promocoes_semana)",
233
+ keyInvalid: "Use apenas letras min\xFAsculas, n\xFAmeros e _ (2 a 40 caracteres)",
234
+ label: "Nome exibido",
235
+ showInMenu: "Exibir como op\xE7\xE3o no menu principal do bot",
236
+ menuOptionLabel: "Texto da op\xE7\xE3o no menu",
237
+ create: "Criar fluxo",
238
+ creating: "Criando\u2026",
239
+ deleteFlow: "Excluir fluxo",
240
+ deleteConfirm: (label) => `Excluir o fluxo "${label}"? Esta a\xE7\xE3o n\xE3o pode ser desfeita.`,
241
+ createError: "N\xE3o foi poss\xEDvel criar o fluxo.",
242
+ deleteError: "N\xE3o foi poss\xEDvel excluir o fluxo."
243
+ }
244
+ };
245
+ function mergeFlowEditorLabels(override) {
246
+ if (!override) return DEFAULT_FLOW_EDITOR_LABELS;
247
+ return {
248
+ ...DEFAULT_FLOW_EDITOR_LABELS,
249
+ ...override,
250
+ legend: { ...DEFAULT_FLOW_EDITOR_LABELS.legend, ...override.legend },
251
+ actionKindLabels: { ...DEFAULT_FLOW_EDITOR_LABELS.actionKindLabels, ...override.actionKindLabels },
252
+ conditionOperatorLabels: {
253
+ ...DEFAULT_FLOW_EDITOR_LABELS.conditionOperatorLabels,
254
+ ...override.conditionOperatorLabels
255
+ },
256
+ questionTypeLabels: { ...DEFAULT_FLOW_EDITOR_LABELS.questionTypeLabels, ...override.questionTypeLabels },
257
+ runnerFields: { ...DEFAULT_FLOW_RUNNER_FIELD_LABELS, ...override.runnerFields },
258
+ nodePanel: { ...DEFAULT_FLOW_EDITOR_LABELS.nodePanel, ...override.nodePanel },
259
+ quickAdd: { ...DEFAULT_FLOW_EDITOR_LABELS.quickAdd, ...override.quickAdd },
260
+ legendPanel: { ...DEFAULT_FLOW_EDITOR_LABELS.legendPanel, ...override.legendPanel },
261
+ palette: { ...DEFAULT_FLOW_EDITOR_LABELS.palette, ...override.palette },
262
+ flowMap: { ...DEFAULT_FLOW_EDITOR_LABELS.flowMap, ...override.flowMap },
263
+ flowGroup: { ...DEFAULT_FLOW_EDITOR_LABELS.flowGroup, ...override.flowGroup },
264
+ crossFlowPortal: { ...DEFAULT_FLOW_EDITOR_LABELS.crossFlowPortal, ...override.crossFlowPortal },
265
+ collectionChain: { ...DEFAULT_FLOW_EDITOR_LABELS.collectionChain, ...override.collectionChain },
266
+ validation: { ...DEFAULT_FLOW_EDITOR_LABELS.validation, ...override.validation },
267
+ workspace: { ...DEFAULT_FLOW_EDITOR_LABELS.workspace, ...override.workspace },
268
+ flowManager: { ...DEFAULT_FLOW_EDITOR_LABELS.flowManager, ...override.flowManager }
269
+ };
270
+ }
271
+
30
272
  // src/flows/flowGraph.ts
31
- import { FLOW_ACTION_KIND } from "@adatechnology/meta-whatsapp-contracts";
273
+ import { FLOW_ACTION_KIND, WHATSAPP_CHOICE_LIMIT } from "@adatechnology/meta-whatsapp-contracts";
32
274
  var CONDITION_OPERATORS = [">", ">=", "<", "<=", "==", "!=", "contains"];
33
275
  var BUILT_IN_ACTION_KINDS = FLOW_ACTION_KIND;
34
276
  var PASS_THROUGH_ACTION_KINDS = ["send_media"];
277
+ function isPassThroughAction(node) {
278
+ if (node.type !== "action") return false;
279
+ return !node.actionKind || PASS_THROUGH_ACTION_KINDS.includes(node.actionKind);
280
+ }
281
+ var KEYWORD_HANDLE_PREFIX = "kw:";
282
+ var keywordHandle = (keyword) => `${KEYWORD_HANDLE_PREFIX}${keyword}`;
283
+ function keywordOfHandle(handle) {
284
+ return handle.startsWith(KEYWORD_HANDLE_PREFIX) ? handle.slice(KEYWORD_HANDLE_PREFIX.length) : void 0;
285
+ }
35
286
  var CROSS_FLOW_PREFIX = "flow:";
36
287
  var isCrossFlowTarget = (target) => target.startsWith(CROSS_FLOW_PREFIX);
37
288
  var crossFlowKey = (target) => target.slice(CROSS_FLOW_PREFIX.length);
@@ -43,25 +294,37 @@ function estimateNodeHeight(node) {
43
294
  const ROW_HEIGHT = 34;
44
295
  const rowCount = node.type === "action" ? (
45
296
  // Ação de passagem desenha uma linha de saída; terminal não desenha nenhuma.
46
- node.actionKind && PASS_THROUGH_ACTION_KINDS.includes(node.actionKind) ? 1 : 0
47
- ) : node.type === "condition" ? 2 : node.type === "menu" || node.questionType === "choice" ? (node.options?.length ?? 0) + 1 : 1;
297
+ isPassThroughAction(node) ? 1 : 0
298
+ ) : node.type === "condition" ? 2 : node.type === "menu" || node.questionType === "choice" ? (node.options?.length ?? 0) + 1 + keywordCount(node) : 1 + keywordCount(node);
48
299
  return HEADER_HEIGHT + BODY_HEIGHT + PADDING + rowCount * ROW_HEIGHT;
49
300
  }
301
+ function keywordCount(node) {
302
+ return typeof node.next === "object" && node.next?.byKeyword ? Object.keys(node.next.byKeyword).length : 0;
303
+ }
50
304
  var WHATSAPP_LIMITS = {
51
- MAX_BUTTONS: 3,
52
- MAX_LIST_ROWS: 10,
53
- BUTTON_TITLE_MAX: 20,
54
- LIST_ROW_TITLE_MAX: 24,
55
- BODY_MAX: 1024
305
+ MAX_BUTTONS: WHATSAPP_CHOICE_LIMIT.BUTTONS,
306
+ MAX_LIST_ROWS: WHATSAPP_CHOICE_LIMIT.LIST_ROWS,
307
+ BUTTON_TITLE_MAX: WHATSAPP_CHOICE_LIMIT.BUTTON_TITLE_LENGTH,
308
+ LIST_ROW_TITLE_MAX: WHATSAPP_CHOICE_LIMIT.LIST_ROW_TITLE_LENGTH,
309
+ LIST_ROW_DESCRIPTION_MAX: WHATSAPP_CHOICE_LIMIT.LIST_ROW_DESCRIPTION_LENGTH,
310
+ LIST_SECTION_TITLE_MAX: WHATSAPP_CHOICE_LIMIT.LIST_SECTION_TITLE_LENGTH,
311
+ BODY_MAX: WHATSAPP_CHOICE_LIMIT.BODY_LENGTH
56
312
  };
57
- function rendersAsButtons(options) {
58
- return (options?.length ?? 0) <= WHATSAPP_LIMITS.MAX_BUTTONS;
313
+ function countCharacters(text) {
314
+ return Array.from(text).length;
315
+ }
316
+ function rendersAsButtons(options, optionDetails) {
317
+ const hasDetails = (options ?? []).some(
318
+ ([id]) => !!optionDetails?.[id]?.description || !!optionDetails?.[id]?.section
319
+ );
320
+ return !hasDetails && (options?.length ?? 0) <= WHATSAPP_LIMITS.MAX_BUTTONS;
59
321
  }
60
322
  function targetsOf(node) {
61
323
  if (!node.next) return [];
62
324
  if (typeof node.next === "string") return [{ target: node.next }];
63
325
  return [
64
326
  ...Object.entries(node.next.byAnswer).map(([optionId, target]) => ({ target, optionId })),
327
+ ...Object.entries(node.next.byKeyword ?? {}).map(([keyword, target]) => ({ target, keyword })),
65
328
  { target: node.next.default, isDefault: true }
66
329
  ];
67
330
  }
@@ -94,20 +357,34 @@ function validateGraph(graph, issueText) {
94
357
  if (!byAnswer[optionId]) {
95
358
  issues.push({ severity: "warning", nodeId: node.id, message: issueText.optionWithoutTarget(node.id, label) });
96
359
  }
97
- const usesButtons = rendersAsButtons(options);
98
- if (usesButtons && label.length > WHATSAPP_LIMITS.BUTTON_TITLE_MAX) {
360
+ const usesButtons = rendersAsButtons(options, node.optionDetails);
361
+ if (usesButtons && countCharacters(label) > WHATSAPP_LIMITS.BUTTON_TITLE_MAX) {
99
362
  issues.push({ severity: "error", nodeId: node.id, message: issueText.buttonTitleTooLong(node.id, label) });
100
363
  }
101
- if (!usesButtons && label.length > WHATSAPP_LIMITS.LIST_ROW_TITLE_MAX) {
364
+ if (!usesButtons && countCharacters(label) > WHATSAPP_LIMITS.LIST_ROW_TITLE_MAX) {
102
365
  issues.push({ severity: "error", nodeId: node.id, message: issueText.listTitleTooLong(node.id, label) });
103
366
  }
367
+ const description = node.optionDetails?.[optionId]?.description ?? "";
368
+ if (countCharacters(description) > WHATSAPP_LIMITS.LIST_ROW_DESCRIPTION_MAX) {
369
+ const message = issueText.descriptionTooLong?.(node.id, label) ?? `\u201C${label}\u201D em ${node.id}: a descri\xE7\xE3o passa de ${WHATSAPP_LIMITS.LIST_ROW_DESCRIPTION_MAX} caracteres.`;
370
+ issues.push({ severity: "error", nodeId: node.id, message });
371
+ }
372
+ }
373
+ const defaultTarget = typeof node.next === "object" && node.next ? node.next.default : "";
374
+ if (defaultTarget && defaultTarget !== node.id && node.unmatchedChoice !== "default") {
375
+ const message = issueText.choiceDefaultIgnored?.(node.id) ?? `N\xF3 "${node.id}": "caso contr\xE1rio" s\xF3 \xE9 seguido com "resposta fora das op\xE7\xF5es" = seguir o caso contr\xE1rio.`;
376
+ issues.push({ severity: "warning", nodeId: node.id, message });
104
377
  }
105
378
  if (options.length > WHATSAPP_LIMITS.MAX_LIST_ROWS) {
106
379
  issues.push({ severity: "error", nodeId: node.id, message: issueText.tooManyOptions(node.id, options.length) });
107
380
  }
108
381
  }
382
+ if (node.type === "dynamic_choice" && !node.choiceProvider) {
383
+ const message = issueText.dynamicChoiceWithoutProvider?.(node.id) ?? `${node.id}: escolha din\xE2mica sem provedor de op\xE7\xF5es.`;
384
+ issues.push({ severity: "error", nodeId: node.id, message });
385
+ }
109
386
  const bodyText = node.question ?? node.directMessage ?? "";
110
- if (bodyText.length > WHATSAPP_LIMITS.BODY_MAX) {
387
+ if (countCharacters(bodyText) > WHATSAPP_LIMITS.BODY_MAX) {
111
388
  issues.push({ severity: "error", nodeId: node.id, message: issueText.bodyTooLong(node.id) });
112
389
  }
113
390
  if (node.type === "question" && !node.next) {
@@ -276,14 +553,16 @@ var NODE_TYPE_COLOR = {
276
553
  entrada_choice: "border-purple-300 bg-purple-50 dark:bg-purple-950/40 dark:border-purple-800",
277
554
  action: "border-orange-300 bg-orange-50 dark:bg-orange-950/40 dark:border-orange-800",
278
555
  menu: "border-emerald-300 bg-emerald-50 dark:bg-emerald-950/40 dark:border-emerald-800",
279
- condition: "border-cyan-300 bg-cyan-50 dark:bg-cyan-950/40 dark:border-cyan-800"
556
+ condition: "border-cyan-300 bg-cyan-50 dark:bg-cyan-950/40 dark:border-cyan-800",
557
+ dynamic_choice: "border-teal-300 bg-teal-50 dark:bg-teal-950/40 dark:border-teal-800"
280
558
  };
281
559
  var NODE_TYPE_ICON = {
282
560
  question: MessageCircleQuestion,
283
561
  entrada_choice: ListTree,
284
562
  action: Zap,
285
563
  menu: GitBranch,
286
- condition: Diamond
564
+ condition: Diamond,
565
+ dynamic_choice: ListChecks
287
566
  };
288
567
  var DEFAULT_ACTION_KIND_ICON = {
289
568
  handoff: Headset,
@@ -314,12 +593,15 @@ function selfLoopHandles(node) {
314
593
  for (const [optionId, target] of Object.entries(node.next.byAnswer ?? {})) {
315
594
  if (target === node.id) loops.add(optionId);
316
595
  }
596
+ for (const [keyword, target] of Object.entries(node.next.byKeyword ?? {})) {
597
+ if (target === node.id) loops.add(keywordHandle(keyword));
598
+ }
317
599
  if (node.next.default === node.id) loops.add("__default");
318
600
  return loops;
319
601
  }
320
602
  function sourceRows(node, labels) {
321
603
  if (node.type === "action") {
322
- return node.actionKind && PASS_THROUGH_ACTION_KINDS.includes(node.actionKind) ? [{ id: "next", label: labels.nodePanel.nextRowLabel, isDefault: false, isSelfLoop: false }] : [];
604
+ return isPassThroughAction(node) ? [{ id: "next", label: labels.nodePanel.nextRowLabel, isDefault: false, isSelfLoop: false }] : [];
323
605
  }
324
606
  const loops = selfLoopHandles(node);
325
607
  if (node.type === "condition") {
@@ -328,12 +610,24 @@ function sourceRows(node, labels) {
328
610
  { id: "false", label: labels.nodePanel.conditionFalse, isDefault: false, isSelfLoop: loops.has("false") }
329
611
  ];
330
612
  }
613
+ const keywordRows = Object.keys(typeof node.next === "object" ? node.next.byKeyword ?? {} : {}).map((keyword) => ({
614
+ id: keywordHandle(keyword),
615
+ label: `\u201C${keyword}\u201D`,
616
+ isDefault: false,
617
+ isSelfLoop: loops.has(keywordHandle(keyword))
618
+ }));
331
619
  const isChoice = node.type === "menu" || node.questionType === "choice";
332
- if (!isChoice)
620
+ if (!isChoice && typeof node.next !== "object")
333
621
  return [{ id: "next", label: labels.nodePanel.nextRowLabel, isDefault: false, isSelfLoop: loops.has("next") }];
622
+ if (!isChoice)
623
+ return [
624
+ ...keywordRows,
625
+ { id: "__default", label: labels.nodePanel.nextRowLabel, isDefault: true, isSelfLoop: loops.has("__default") }
626
+ ];
334
627
  const options = node.options ?? [];
335
628
  return [
336
629
  ...options.map(([id, label]) => ({ id, label, isDefault: false, isSelfLoop: loops.has(id) })),
630
+ ...keywordRows,
337
631
  { id: "__default", label: labels.edgeFallbackLabel, isDefault: true, isSelfLoop: loops.has("__default") }
338
632
  ];
339
633
  }
@@ -390,316 +684,113 @@ function SourceRow({
390
684
  }
391
685
  )
392
686
  ] }),
393
- onQuickAdd && /* @__PURE__ */ jsx(
394
- "button",
395
- {
396
- type: "button",
397
- "data-cv-tooltip": addLabel,
398
- "aria-label": addLabel,
399
- onClick: (event) => {
400
- event.stopPropagation();
401
- const rect = event.currentTarget.getBoundingClientRect();
402
- onQuickAdd({ handle: handleId, anchor: { x: rect.right, y: rect.top } });
403
- },
404
- style: { opacity: hovered ? 1 : 0.35 },
405
- className: "nodrag absolute right-0 top-1/2 flex h-5 w-5 -translate-y-1/2 items-center justify-center rounded-full border border-blue-300 bg-white text-blue-600 shadow-sm transition-opacity hover:bg-blue-50 dark:border-blue-700 dark:bg-gray-800 dark:text-blue-400 dark:hover:bg-gray-700",
406
- children: /* @__PURE__ */ jsx(Plus, { size: 12, strokeWidth: 3 })
407
- }
408
- )
409
- ]
410
- }
411
- );
412
- }
413
- function FlowNodeCard({ data }) {
414
- const { node, liveCount, isStart, isSelected, isDetached, issues, labels, actionKindIcons, onSelect, onQuickAdd } = data;
415
- const label = nodeLabel(node, labels);
416
- const iconMap = { ...DEFAULT_ACTION_KIND_ICON, ...actionKindIcons };
417
- const Icon = node.type === "action" && node.actionKind ? iconMap[node.actionKind] ?? NODE_TYPE_ICON[node.type] : NODE_TYPE_ICON[node.type];
418
- const rows = sourceRows(node, labels);
419
- const nodeIssues = issues.filter((issue) => issue.nodeId === node.id);
420
- const errors = nodeIssues.filter((issue) => issue.severity === "error");
421
- const warnings = nodeIssues.filter((issue) => issue.severity === "warning");
422
- const hasError = errors.length > 0;
423
- const hasWarning = !hasError && warnings.length > 0;
424
- const issueTooltip = (hasError ? errors : warnings).map((issue) => issue.message).join(" \xB7 ");
425
- return /* @__PURE__ */ jsxs(
426
- "div",
427
- {
428
- "data-cv-tooltip": isDetached ? labels.detachedNodeTooltip : label,
429
- className: `relative rounded-lg border-2 px-3 py-2 w-60 cursor-pointer shadow-sm hover:shadow-md transition-shadow ${NODE_TYPE_COLOR[node.type]} ${isSelected ? "ring-2 ring-blue-500 ring-offset-2 dark:ring-offset-gray-900" : ""} ${isDetached ? "border-dashed !border-amber-400 animate-pulse" : ""}`,
430
- onClick: () => onSelect(node.id),
431
- children: [
432
- /* @__PURE__ */ jsx(
433
- Handle,
434
- {
435
- type: "target",
436
- position: Position.Top,
437
- id: "target",
438
- style: { width: HANDLE_SIZE_PX, height: HANDLE_SIZE_PX },
439
- className: "!bg-gray-400 !border-2 !border-white dark:!bg-gray-500 dark:!border-gray-800"
440
- }
441
- ),
442
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
443
- /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5 uppercase tracking-wide font-semibold text-gray-500 dark:text-gray-400 text-xs", children: [
444
- /* @__PURE__ */ jsx(Icon, { size: 12, strokeWidth: 2.5 }),
445
- isStart && /* @__PURE__ */ jsx("span", { className: "h-1.5 w-1.5 rounded-full bg-emerald-500", "data-cv-tooltip": labels.startNodeTooltip }),
446
- labels.legend[node.type]
447
- ] }),
448
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
449
- hasError && /* @__PURE__ */ jsx(
450
- AlertCircle,
451
- {
452
- size: 13,
453
- "data-cv-tooltip": issueTooltip,
454
- "aria-label": issueTooltip,
455
- className: "text-red-600 dark:text-red-400"
456
- }
457
- ),
458
- hasWarning && /* @__PURE__ */ jsx(
459
- AlertTriangle,
460
- {
461
- size: 13,
462
- "data-cv-tooltip": issueTooltip,
463
- "aria-label": issueTooltip,
464
- className: "text-amber-500 dark:text-amber-400"
465
- }
466
- ),
467
- liveCount > 0 && /* @__PURE__ */ jsx(
468
- "span",
469
- {
470
- "data-cv-tooltip": labels.liveCountTooltip(liveCount),
471
- className: "font-bold bg-blue-600 text-white rounded-full px-1.5 py-0.5 text-xs",
472
- children: liveCount
473
- }
474
- )
475
- ] })
476
- ] }),
477
- /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-900 dark:text-gray-100 mt-1 line-clamp-3", children: label }),
478
- rows.length > 0 && /* @__PURE__ */ jsx("div", { className: "mt-2 space-y-1", children: rows.map((row) => /* @__PURE__ */ jsx(
479
- SourceRow,
480
- {
481
- label: row.label,
482
- isDefault: row.isDefault,
483
- handleId: row.id,
484
- addLabel: labels.quickAdd.fromHandle,
485
- isSelfLoop: row.isSelfLoop,
486
- selfLoopLabel: labels.legendPanel.selfLoop,
487
- ...onQuickAdd ? { onQuickAdd: (params) => onQuickAdd({ nodeId: node.id, ...params }) } : {}
488
- },
489
- row.id
490
- )) })
491
- ]
492
- }
493
- );
494
- }
495
- var flowNodeTypes = { flowNode: FlowNodeCard };
496
-
497
- // src/flows/FlowMapNode.tsx
498
- import { Handle as Handle2, Position as Position2 } from "@xyflow/react";
499
- import { GitBranch as GitBranch2, Maximize2 } from "lucide-react";
500
-
501
- // src/flows/labels.ts
502
- var DEFAULT_FLOW_EDITOR_LABELS = {
503
- legend: {
504
- question: "Pergunta",
505
- entrada_choice: "Escolha calculada",
506
- action: "A\xE7\xE3o (simula\xE7\xE3o/atendimento)",
507
- menu: "Menu",
508
- condition: "Condi\xE7\xE3o"
509
- },
510
- startNodeTooltip: "In\xEDcio do fluxo",
511
- detachedNodeTooltip: "Sem liga\xE7\xE3o de entrada \u2014 o bot n\xE3o chega neste n\xF3. Puxe um fio de outro card at\xE9 ele.",
512
- liveCountTooltip: (count) => `${count} conversa(s) ativa(s) aqui agora`,
513
- edgeFallbackLabel: "outro",
514
- actionKindLabels: {
515
- handoff: "Encaminhar para atendimento",
516
- rate_limited_handoff: "Encaminhar (limite de simula\xE7\xF5es atingido)",
517
- send_product_list: "Enviar cat\xE1logo de produtos",
518
- send_media: "Enviar arquivos da biblioteca"
519
- },
520
- conditionOperatorLabels: {
521
- ">": "maior que",
522
- ">=": "maior ou igual a",
523
- "<": "menor que",
524
- "<=": "menor ou igual a",
525
- "==": "igual a",
526
- "!=": "diferente de",
527
- contains: "cont\xE9m"
528
- },
529
- questionTypeLabels: {
530
- text: "Texto livre",
531
- money: "Valor em R$",
532
- date: "Data",
533
- int: "N\xFAmero inteiro",
534
- cpf: "CPF",
535
- choice: "Escolha (bot\xF5es/lista)"
536
- },
537
- nodePanel: {
538
- title: "Editar n\xF3",
539
- contextKey: "Chave (contexto)",
540
- nodeName: "Nome do n\xF3 (opcional)",
541
- nodeNamePlaceholder: "Ex.: Enviar tabela de pre\xE7os",
542
- nodeNameHint: "S\xF3 aparece no editor \u2014 o cliente n\xE3o v\xEA.",
543
- questionType: "Tipo de resposta",
544
- question: "Texto da pergunta",
545
- options: "Op\xE7\xF5es (choice)",
546
- addOption: "Adicionar op\xE7\xE3o",
547
- removeOption: "Remover op\xE7\xE3o",
548
- close: "Fechar painel",
549
- optionId: "Valor",
550
- optionLabel: "Texto exibido",
551
- next: "Pr\xF3ximo n\xF3",
552
- nextHint: "Tamb\xE9m \xE9 poss\xEDvel arrastar um fio no canvas para conectar.",
553
- nextRowLabel: "Pr\xF3ximo",
554
- otherFlowsGroup: "Outros fluxos (salto)",
555
- nextByAnswer: (id) => `Se responder "${id}" \u2192`,
556
- nextDefault: "Caso contr\xE1rio \u2192",
557
- save: "Salvar altera\xE7\xF5es",
558
- cancel: "Cancelar",
559
- fixedLogicNotice: "Este n\xF3 tem l\xF3gica fixa (valida\xE7\xF5es/c\xE1lculos do sistema) \u2014 s\xF3 o texto e o destino s\xE3o edit\xE1veis.",
560
- actionNotice: "N\xF3 de a\xE7\xE3o \u2014 dispara a a\xE7\xE3o registrada ou encaminha para atendimento humano.",
561
- preview: "Como o cliente v\xEA no WhatsApp",
562
- previewPlaceholder: "Pr\xE9-visualiza\xE7\xE3o\u2026",
563
- previewEmptyBody: "(escreva o texto da mensagem)",
564
- previewEmptyOption: "(sem texto)",
565
- previewListButton: "Ver op\xE7\xF5es",
566
- previewModeButtons: "Enviado como bot\xF5es (at\xE9 3 op\xE7\xF5es)",
567
- previewModeList: "Enviado como lista (4+ op\xE7\xF5es)",
568
- delete: "Excluir n\xF3",
569
- deleteConfirm: "Excluir este n\xF3? Liga\xE7\xF5es que apontam para ele ficar\xE3o quebradas.",
570
- directMessage: "Mensagem (opcional)",
571
- fallbackMessage: "Mensagem de fallback (quando o cat\xE1logo n\xE3o est\xE1 dispon\xEDvel)",
572
- conditionNotice: "N\xF3 de condi\xE7\xE3o \u2014 n\xE3o pergunta nada ao cliente, s\xF3 decide automaticamente entre Verdadeiro/Falso.",
573
- conditionVariable: "Vari\xE1vel (chave j\xE1 coletada por uma pergunta anterior)",
574
- conditionOperator: "Operador",
575
- conditionValue: "Valor de compara\xE7\xE3o",
576
- conditionTrue: "Se verdadeiro \u2192",
577
- conditionFalse: "Se falso \u2192",
578
- conditionVariableMissing: "Se a vari\xE1vel ainda n\xE3o foi coletada \u2192",
579
- media: "Arquivos enviados neste ponto",
580
- mediaUnavailable: "A biblioteca de arquivos n\xE3o est\xE1 dispon\xEDvel neste painel."
581
- },
582
- quickAdd: {
583
- fromHandle: "Criar o pr\xF3ximo n\xF3 j\xE1 ligado aqui",
584
- title: "Ligar em um n\xF3 novo",
585
- disconnect: "Desligar este fio (o n\xF3 continua no fluxo)"
586
- },
587
- legendPanel: {
588
- title: "Legenda",
589
- nodes: "Cards",
590
- connections: "Liga\xE7\xF5es",
591
- linear: "Segue direto para o pr\xF3ximo",
592
- branch: "Caminho de uma op\xE7\xE3o escolhida",
593
- fallback: "Quando a resposta n\xE3o casa com nenhuma op\xE7\xE3o",
594
- crossFlow: "Salta para outro fluxo",
595
- live: "Tem conversa passando por aqui agora",
596
- selfLoop: "Volta ao mesmo card \u2014 repete a pergunta",
597
- detached: "Ningu\xE9m aponta para este card: o bot n\xE3o chega nele",
598
- startNode: "Onde o fluxo come\xE7a"
599
- },
600
- palette: {
601
- title: "Adicionar ao fluxo",
602
- question: "Pergunta",
603
- decision: "Decis\xE3o",
604
- condition: "Condi\xE7\xE3o",
605
- conditionHint: "Compara uma vari\xE1vel j\xE1 coletada e segue automaticamente, sem perguntar nada",
606
- action: "A\xE7\xE3o"
607
- },
608
- flowMap: {
609
- nodeCount: (count) => `${count} n\xF3(s)`,
610
- openFlow: "Abrir fluxo",
611
- toggleToMap: "Mapa de fluxos",
612
- toggleToDetail: "Voltar ao editor"
613
- },
614
- flowGroup: {
615
- focus: "Focar neste fluxo",
616
- close: "Fechar"
617
- },
618
- crossFlowPortal: {
619
- tooltip: "Clique para abrir esse fluxo aqui do lado, ligado ao ponto de onde ele \xE9 chamado",
620
- goesTo: (label) => `\u21AA Vai para: ${label}`
621
- },
622
- collectionChain: {
623
- feeds: (label) => `Alimenta: ${label}`
624
- },
625
- validation: {
626
- title: "Antes de publicar",
627
- errors: (count) => `${count} erro(s) \u2014 corrija antes de salvar`,
628
- warnings: (count) => `${count} aviso(s)`,
629
- noStart: "O fluxo precisa de um n\xF3 inicial v\xE1lido.",
630
- brokenRef: (from, to) => `N\xF3 "${from}": liga\xE7\xE3o aponta para "${to}", que n\xE3o existe.`,
631
- choiceWithoutOptions: (id) => `N\xF3 "${id}": escolha sem nenhuma op\xE7\xE3o.`,
632
- duplicatedOptionId: (id, optionId) => `N\xF3 "${id}": valor de op\xE7\xE3o "${optionId}" duplicado.`,
633
- optionWithoutTarget: (id, label) => `N\xF3 "${id}": op\xE7\xE3o "${label}" n\xE3o tem destino definido.`,
634
- tooManyOptions: (id, count) => `N\xF3 "${id}": ${count} op\xE7\xF5es \u2014 o WhatsApp aceita no m\xE1ximo 10 em lista.`,
635
- buttonTitleTooLong: (id, label) => `N\xF3 "${id}": bot\xE3o "${label}" passa de 20 caracteres.`,
636
- listTitleTooLong: (id, label) => `N\xF3 "${id}": item de lista "${label}" passa de 24 caracteres.`,
637
- bodyTooLong: (id) => `N\xF3 "${id}": texto passa de 1024 caracteres.`,
638
- unreachable: (id) => `N\xF3 "${id}" \xE9 inalcan\xE7\xE1vel a partir do in\xEDcio do fluxo.`,
639
- deadEndQuestion: (id) => `N\xF3 "${id}": pergunta sem pr\xF3ximo passo definido.`,
640
- conditionIncomplete: (id) => `N\xF3 "${id}": condi\xE7\xE3o incompleta \u2014 defina vari\xE1vel, operador e valor.`,
641
- conditionBranchMissing: (id, branch) => `N\xF3 "${id}": ramo "${branch === "true" ? "Verdadeiro" : "Falso"}" sem destino definido.`
642
- },
643
- workspace: {
644
- title: "Fluxos do Bot",
645
- subtitle: "Blueprint visual dos fluxos de conversa, sincronizado com o que est\xE1 em produ\xE7\xE3o.",
646
- loading: "Carregando fluxos\u2026",
647
- loadError: "N\xE3o foi poss\xEDvel carregar os fluxos.",
648
- saveGraph: "Publicar altera\xE7\xF5es",
649
- saving: "Publicando\u2026",
650
- saveSuccess: "Fluxo publicado! O bot j\xE1 est\xE1 usando a vers\xE3o nova.",
651
- saveError: "N\xE3o foi poss\xEDvel salvar \u2014 verifique se todos os destinos apontam para n\xF3s existentes.",
652
- organize: "Organizar",
653
- organizeTooltip: "Reorganiza os n\xF3s automaticamente e salva as novas posi\xE7\xF5es",
654
- discardChanges: "Desfazer altera\xE7\xF5es",
655
- discardTooltip: "Devolve os fluxos abertos ao que est\xE1 publicado, descartando o que n\xE3o foi salvo",
656
- discardConfirm: "Descartar todas as altera\xE7\xF5es n\xE3o publicadas e voltar ao fluxo que est\xE1 no ar?",
657
- unsavedChangesConfirm: "Voc\xEA tem altera\xE7\xF5es n\xE3o publicadas neste fluxo. Trocar de fluxo agora descarta essas edi\xE7\xF5es. Continuar?"
658
- },
659
- flowManager: {
660
- newFlow: "Novo fluxo",
661
- createTitle: "Criar novo fluxo",
662
- key: "Identificador \xFAnico",
663
- keyHint: "letras min\xFAsculas, n\xFAmeros e _ (ex.: promocoes_semana)",
664
- keyInvalid: "Use apenas letras min\xFAsculas, n\xFAmeros e _ (2 a 40 caracteres)",
665
- label: "Nome exibido",
666
- showInMenu: "Exibir como op\xE7\xE3o no menu principal do bot",
667
- menuOptionLabel: "Texto da op\xE7\xE3o no menu",
668
- create: "Criar fluxo",
669
- creating: "Criando\u2026",
670
- deleteFlow: "Excluir fluxo",
671
- deleteConfirm: (label) => `Excluir o fluxo "${label}"? Esta a\xE7\xE3o n\xE3o pode ser desfeita.`,
672
- createError: "N\xE3o foi poss\xEDvel criar o fluxo.",
673
- deleteError: "N\xE3o foi poss\xEDvel excluir o fluxo."
674
- }
675
- };
676
- function mergeFlowEditorLabels(override) {
677
- if (!override) return DEFAULT_FLOW_EDITOR_LABELS;
678
- return {
679
- ...DEFAULT_FLOW_EDITOR_LABELS,
680
- ...override,
681
- legend: { ...DEFAULT_FLOW_EDITOR_LABELS.legend, ...override.legend },
682
- actionKindLabels: { ...DEFAULT_FLOW_EDITOR_LABELS.actionKindLabels, ...override.actionKindLabels },
683
- conditionOperatorLabels: {
684
- ...DEFAULT_FLOW_EDITOR_LABELS.conditionOperatorLabels,
685
- ...override.conditionOperatorLabels
686
- },
687
- questionTypeLabels: { ...DEFAULT_FLOW_EDITOR_LABELS.questionTypeLabels, ...override.questionTypeLabels },
688
- nodePanel: { ...DEFAULT_FLOW_EDITOR_LABELS.nodePanel, ...override.nodePanel },
689
- quickAdd: { ...DEFAULT_FLOW_EDITOR_LABELS.quickAdd, ...override.quickAdd },
690
- legendPanel: { ...DEFAULT_FLOW_EDITOR_LABELS.legendPanel, ...override.legendPanel },
691
- palette: { ...DEFAULT_FLOW_EDITOR_LABELS.palette, ...override.palette },
692
- flowMap: { ...DEFAULT_FLOW_EDITOR_LABELS.flowMap, ...override.flowMap },
693
- flowGroup: { ...DEFAULT_FLOW_EDITOR_LABELS.flowGroup, ...override.flowGroup },
694
- crossFlowPortal: { ...DEFAULT_FLOW_EDITOR_LABELS.crossFlowPortal, ...override.crossFlowPortal },
695
- collectionChain: { ...DEFAULT_FLOW_EDITOR_LABELS.collectionChain, ...override.collectionChain },
696
- validation: { ...DEFAULT_FLOW_EDITOR_LABELS.validation, ...override.validation },
697
- workspace: { ...DEFAULT_FLOW_EDITOR_LABELS.workspace, ...override.workspace },
698
- flowManager: { ...DEFAULT_FLOW_EDITOR_LABELS.flowManager, ...override.flowManager }
699
- };
687
+ onQuickAdd && /* @__PURE__ */ jsx(
688
+ "button",
689
+ {
690
+ type: "button",
691
+ "data-cv-tooltip": addLabel,
692
+ "aria-label": addLabel,
693
+ onClick: (event) => {
694
+ event.stopPropagation();
695
+ const rect = event.currentTarget.getBoundingClientRect();
696
+ onQuickAdd({ handle: handleId, anchor: { x: rect.right, y: rect.top } });
697
+ },
698
+ style: { opacity: hovered ? 1 : 0.35 },
699
+ className: "nodrag absolute right-0 top-1/2 flex h-5 w-5 -translate-y-1/2 items-center justify-center rounded-full border border-blue-300 bg-white text-blue-600 shadow-sm transition-opacity hover:bg-blue-50 dark:border-blue-700 dark:bg-gray-800 dark:text-blue-400 dark:hover:bg-gray-700",
700
+ children: /* @__PURE__ */ jsx(Plus, { size: 12, strokeWidth: 3 })
701
+ }
702
+ )
703
+ ]
704
+ }
705
+ );
706
+ }
707
+ function FlowNodeCard({ data }) {
708
+ const { node, liveCount, isStart, isSelected, isDetached, issues, labels, actionKindIcons, onSelect, onQuickAdd } = data;
709
+ const label = nodeLabel(node, labels);
710
+ const iconMap = { ...DEFAULT_ACTION_KIND_ICON, ...actionKindIcons };
711
+ const Icon = node.type === "action" && node.actionKind ? iconMap[node.actionKind] ?? NODE_TYPE_ICON[node.type] : NODE_TYPE_ICON[node.type];
712
+ const rows = sourceRows(node, labels);
713
+ const nodeIssues = issues.filter((issue) => issue.nodeId === node.id);
714
+ const errors = nodeIssues.filter((issue) => issue.severity === "error");
715
+ const warnings = nodeIssues.filter((issue) => issue.severity === "warning");
716
+ const hasError = errors.length > 0;
717
+ const hasWarning = !hasError && warnings.length > 0;
718
+ const issueTooltip = (hasError ? errors : warnings).map((issue) => issue.message).join(" \xB7 ");
719
+ return /* @__PURE__ */ jsxs(
720
+ "div",
721
+ {
722
+ "data-cv-tooltip": isDetached ? labels.detachedNodeTooltip : label,
723
+ className: `relative rounded-lg border-2 px-3 py-2 w-60 cursor-pointer shadow-sm hover:shadow-md transition-shadow ${NODE_TYPE_COLOR[node.type]} ${isSelected ? "ring-2 ring-blue-500 ring-offset-2 dark:ring-offset-gray-900" : ""} ${isDetached ? "border-dashed !border-amber-400 animate-pulse" : ""}`,
724
+ onClick: () => onSelect(node.id),
725
+ children: [
726
+ /* @__PURE__ */ jsx(
727
+ Handle,
728
+ {
729
+ type: "target",
730
+ position: Position.Top,
731
+ id: "target",
732
+ style: { width: HANDLE_SIZE_PX, height: HANDLE_SIZE_PX },
733
+ className: "!bg-gray-400 !border-2 !border-white dark:!bg-gray-500 dark:!border-gray-800"
734
+ }
735
+ ),
736
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
737
+ /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5 uppercase tracking-wide font-semibold text-gray-500 dark:text-gray-400 text-xs", children: [
738
+ /* @__PURE__ */ jsx(Icon, { size: 12, strokeWidth: 2.5 }),
739
+ isStart && /* @__PURE__ */ jsx("span", { className: "h-1.5 w-1.5 rounded-full bg-emerald-500", "data-cv-tooltip": labels.startNodeTooltip }),
740
+ labels.legend[node.type] ?? DEFAULT_FLOW_EDITOR_LABELS.legend.dynamic_choice
741
+ ] }),
742
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
743
+ hasError && /* @__PURE__ */ jsx(
744
+ AlertCircle,
745
+ {
746
+ size: 13,
747
+ "data-cv-tooltip": issueTooltip,
748
+ "aria-label": issueTooltip,
749
+ className: "text-red-600 dark:text-red-400"
750
+ }
751
+ ),
752
+ hasWarning && /* @__PURE__ */ jsx(
753
+ AlertTriangle,
754
+ {
755
+ size: 13,
756
+ "data-cv-tooltip": issueTooltip,
757
+ "aria-label": issueTooltip,
758
+ className: "text-amber-500 dark:text-amber-400"
759
+ }
760
+ ),
761
+ liveCount > 0 && /* @__PURE__ */ jsx(
762
+ "span",
763
+ {
764
+ "data-cv-tooltip": labels.liveCountTooltip(liveCount),
765
+ className: "font-bold bg-blue-600 text-white rounded-full px-1.5 py-0.5 text-xs",
766
+ children: liveCount
767
+ }
768
+ )
769
+ ] })
770
+ ] }),
771
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-900 dark:text-gray-100 mt-1 line-clamp-3", children: label }),
772
+ rows.length > 0 && /* @__PURE__ */ jsx("div", { className: "mt-2 space-y-1", children: rows.map((row) => /* @__PURE__ */ jsx(
773
+ SourceRow,
774
+ {
775
+ label: row.label,
776
+ isDefault: row.isDefault,
777
+ handleId: row.id,
778
+ addLabel: labels.quickAdd.fromHandle,
779
+ isSelfLoop: row.isSelfLoop,
780
+ selfLoopLabel: labels.legendPanel.selfLoop,
781
+ ...onQuickAdd ? { onQuickAdd: (params) => onQuickAdd({ nodeId: node.id, ...params }) } : {}
782
+ },
783
+ row.id
784
+ )) })
785
+ ]
786
+ }
787
+ );
700
788
  }
789
+ var flowNodeTypes = { flowNode: FlowNodeCard };
701
790
 
702
791
  // src/flows/FlowMapNode.tsx
792
+ import { Handle as Handle2, Position as Position2 } from "@xyflow/react";
793
+ import { GitBranch as GitBranch2, Maximize2 } from "lucide-react";
703
794
  import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
704
795
  function FlowMapNode({ data }) {
705
796
  const { label, nodeCount, isRoot, labels = DEFAULT_FLOW_EDITOR_LABELS, onOpen } = data;
@@ -862,7 +953,7 @@ var flowPortalNodeTypes = { flowPortal: FlowPortalNode };
862
953
 
863
954
  // src/flows/FlowPalette.tsx
864
955
  import { useEffect, useLayoutEffect, useRef, useState as useState2 } from "react";
865
- import { Plus as Plus2, MessageCircleQuestion as MessageCircleQuestion2, GitBranch as GitBranch3, Zap as Zap2, Diamond as Diamond2, ChevronRight } from "lucide-react";
956
+ import { Plus as Plus2, MessageCircleQuestion as MessageCircleQuestion2, GitBranch as GitBranch3, Zap as Zap2, Diamond as Diamond2, ChevronRight, ListChecks as ListChecks2, MessageSquareText } from "lucide-react";
866
957
 
867
958
  // src/flows/flowMenuPlacement.ts
868
959
  var DEFAULT_GAP = 4;
@@ -903,6 +994,7 @@ function FlowPaletteMenu({ onSelect, labels, actionOptions }) {
903
994
  const resolvedActionOptions = actionOptions ?? [
904
995
  { actionKind: "handoff", label: labels.actionKindLabels.handoff ?? "Encaminhar para atendimento" }
905
996
  ];
997
+ const runnerLabels = labels.runnerFields ?? DEFAULT_FLOW_RUNNER_FIELD_LABELS;
906
998
  const [submenu, setSubmenu] = useState2(null);
907
999
  const questionTriggerRef = useRef(null);
908
1000
  const actionTriggerRef = useRef(null);
@@ -1011,6 +1103,36 @@ function FlowPaletteMenu({ onSelect, labels, actionOptions }) {
1011
1103
  ]
1012
1104
  }
1013
1105
  ),
1106
+ /* @__PURE__ */ jsxs6(
1107
+ "button",
1108
+ {
1109
+ onMouseEnter: () => setSubmenu(null),
1110
+ onClick: () => select({ kind: "dynamicChoice" }),
1111
+ className: "w-full flex items-center gap-2 px-3 py-2 text-sm text-gray-700 dark:text-gray-200 hover:bg-gray-50 dark:hover:bg-gray-700",
1112
+ "data-cv-tooltip": runnerLabels.paletteDynamicChoiceHint,
1113
+ "aria-label": runnerLabels.paletteDynamicChoiceHint,
1114
+ children: [
1115
+ /* @__PURE__ */ jsx7(ListChecks2, { size: 15, className: "text-teal-500", "aria-hidden": "true" }),
1116
+ " ",
1117
+ runnerLabels.paletteDynamicChoice
1118
+ ]
1119
+ }
1120
+ ),
1121
+ /* @__PURE__ */ jsxs6(
1122
+ "button",
1123
+ {
1124
+ onMouseEnter: () => setSubmenu(null),
1125
+ onClick: () => select({ kind: "message" }),
1126
+ className: "w-full flex items-center gap-2 px-3 py-2 text-sm text-gray-700 dark:text-gray-200 hover:bg-gray-50 dark:hover:bg-gray-700",
1127
+ "data-cv-tooltip": runnerLabels.paletteMessageHint,
1128
+ "aria-label": runnerLabels.paletteMessageHint,
1129
+ children: [
1130
+ /* @__PURE__ */ jsx7(MessageSquareText, { size: 15, className: "text-orange-500", "aria-hidden": "true" }),
1131
+ " ",
1132
+ runnerLabels.paletteMessage
1133
+ ]
1134
+ }
1135
+ ),
1014
1136
  /* @__PURE__ */ jsxs6("div", { className: "relative", children: [
1015
1137
  /* @__PURE__ */ jsxs6(
1016
1138
  "button",
@@ -1142,7 +1264,7 @@ function FlowLegend({ labels, edgeSamples, nodeSwatches }) {
1142
1264
  /* @__PURE__ */ jsxs7("ul", { className: "space-y-1.5", children: [
1143
1265
  nodeSwatches.map((swatch) => /* @__PURE__ */ jsxs7("li", { className: "flex items-center gap-2", children: [
1144
1266
  /* @__PURE__ */ jsx8("span", { className: `h-3 w-5 shrink-0 rounded border-2 ${swatch.className}`, "aria-hidden": "true" }),
1145
- /* @__PURE__ */ jsx8("span", { className: "text-[11px] leading-tight text-gray-600 dark:text-gray-300", children: labels.legend[swatch.type] })
1267
+ /* @__PURE__ */ jsx8("span", { className: "text-[11px] leading-tight text-gray-600 dark:text-gray-300", children: labels.legend[swatch.type] ?? DEFAULT_FLOW_EDITOR_LABELS.legend.dynamic_choice })
1146
1268
  ] }, swatch.type)),
1147
1269
  /* @__PURE__ */ jsxs7("li", { className: "flex items-center gap-2", children: [
1148
1270
  /* @__PURE__ */ jsx8(
@@ -1243,20 +1365,31 @@ var flowEdgeTypes = { flowConnection: FlowConnectionEdge };
1243
1365
 
1244
1366
  // src/flows/FlowNodePanel.tsx
1245
1367
  import { useState as useState5 } from "react";
1246
- import { Plus as Plus3, Trash2, Save, X as X3, AlertTriangle as AlertTriangle2, AlertCircle as AlertCircle2 } from "lucide-react";
1368
+ import { Plus as Plus4, Trash2 as Trash22, Save, X as X3, AlertTriangle as AlertTriangle2, AlertCircle as AlertCircle2 } from "lucide-react";
1247
1369
 
1248
1370
  // src/flows/FlowWhatsAppPreview.tsx
1249
1371
  import { List } from "lucide-react";
1250
1372
  import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
1373
+ function groupBySection(options, optionDetails) {
1374
+ const sections = [];
1375
+ for (const option of options.slice(0, WHATSAPP_LIMITS.MAX_LIST_ROWS)) {
1376
+ const title = optionDetails?.[option[0]]?.section?.trim() || void 0;
1377
+ const existing = sections.find((section) => section.title === title);
1378
+ if (existing) existing.rows.push(option);
1379
+ else sections.push({ title, rows: [option] });
1380
+ }
1381
+ return sections;
1382
+ }
1251
1383
  function FlowWhatsAppPreview({
1252
1384
  body,
1253
1385
  options,
1386
+ optionDetails,
1254
1387
  labels = DEFAULT_FLOW_EDITOR_LABELS.nodePanel
1255
1388
  }) {
1256
1389
  if (!body && (!options || options.length === 0)) {
1257
1390
  return /* @__PURE__ */ jsx10("p", { className: "text-xs text-gray-400 dark:text-gray-500 italic px-1", children: labels.previewPlaceholder });
1258
1391
  }
1259
- const usesButtons = rendersAsButtons(options);
1392
+ const usesButtons = rendersAsButtons(options, optionDetails);
1260
1393
  const hasOptions = (options?.length ?? 0) > 0;
1261
1394
  return /* @__PURE__ */ jsxs9(
1262
1395
  WhatsAppMessagePreview,
@@ -1270,10 +1403,16 @@ function FlowWhatsAppPreview({
1270
1403
  },
1271
1404
  id
1272
1405
  )) }),
1273
- hasOptions && !usesButtons && /* @__PURE__ */ jsx10("div", { className: "mt-1.5 rounded-lg bg-white dark:bg-gray-700 shadow-sm divide-y divide-gray-100 dark:divide-gray-600 overflow-hidden", children: options.slice(0, WHATSAPP_LIMITS.MAX_LIST_ROWS).map(([id, label]) => /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-2 px-3 py-1.5 text-sm text-gray-800 dark:text-gray-100", children: [
1274
- /* @__PURE__ */ jsx10("span", { className: "h-3.5 w-3.5 rounded-full border border-gray-300 dark:border-gray-500 shrink-0" }),
1275
- label || /* @__PURE__ */ jsx10("span", { className: "italic text-gray-400", children: labels.previewEmptyOption })
1276
- ] }, id)) })
1406
+ hasOptions && !usesButtons && /* @__PURE__ */ jsx10("div", { className: "mt-1.5 rounded-lg bg-white dark:bg-gray-700 shadow-sm divide-y divide-gray-100 dark:divide-gray-600 overflow-hidden", children: groupBySection(options, optionDetails).map((section, sectionIndex) => /* @__PURE__ */ jsxs9("div", { children: [
1407
+ section.title && /* @__PURE__ */ jsx10("p", { className: "px-3 pt-1.5 text-[11px] font-medium uppercase text-cyan-700 dark:text-cyan-400", children: section.title }),
1408
+ section.rows.map(([id, label]) => /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-2 px-3 py-1.5 text-sm text-gray-800 dark:text-gray-100", children: [
1409
+ /* @__PURE__ */ jsx10("span", { className: "h-3.5 w-3.5 rounded-full border border-gray-300 dark:border-gray-500 shrink-0" }),
1410
+ /* @__PURE__ */ jsxs9("span", { className: "min-w-0", children: [
1411
+ label || /* @__PURE__ */ jsx10("span", { className: "italic text-gray-400", children: labels.previewEmptyOption }),
1412
+ optionDetails?.[id]?.description && /* @__PURE__ */ jsx10("span", { className: "block text-xs text-gray-500 dark:text-gray-400", children: optionDetails[id].description })
1413
+ ] })
1414
+ ] }, id))
1415
+ ] }, section.title ?? `section-${sectionIndex}`)) })
1277
1416
  ] }),
1278
1417
  footer: hasOptions && /* @__PURE__ */ jsx10("p", { className: "text-[11px] text-gray-500 dark:text-gray-400 px-1", children: usesButtons ? labels.previewModeButtons : labels.previewModeList }),
1279
1418
  children: [
@@ -1288,10 +1427,339 @@ function FlowWhatsAppPreview({
1288
1427
  );
1289
1428
  }
1290
1429
 
1430
+ // src/flows/FlowKeywordRoutesField.tsx
1431
+ import { Plus as Plus3, Trash2 } from "lucide-react";
1432
+
1433
+ // src/flows/flowPanelStyles.ts
1434
+ var PANEL_FIELD_CLASSNAME = "border border-gray-200 dark:border-gray-600 dark:bg-gray-700 dark:text-gray-100 rounded-xl px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400 focus:border-transparent transition-all";
1435
+ var PANEL_LABEL_CLASSNAME = "text-xs font-medium text-gray-500 dark:text-gray-400";
1436
+ var PANEL_HINT_CLASSNAME = "text-[11px] text-gray-400 dark:text-gray-500 mt-1";
1437
+
1438
+ // src/flows/FlowKeywordRoutesField.tsx
1439
+ import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
1440
+ function withRoutes(node, routes) {
1441
+ const current = typeof node.next === "object" && node.next ? node.next : { byAnswer: {}, default: node.next ?? "" };
1442
+ const rest = { ...current };
1443
+ delete rest.byKeyword;
1444
+ return { ...node, next: routes.length > 0 ? { ...rest, byKeyword: Object.fromEntries(routes) } : rest };
1445
+ }
1446
+ function FlowKeywordRoutesField({
1447
+ draft,
1448
+ onDraftChange,
1449
+ renderTargetOptions,
1450
+ labels
1451
+ }) {
1452
+ const routes = typeof draft.next === "object" && draft.next?.byKeyword ? Object.entries(draft.next.byKeyword) : [];
1453
+ function updateRoute(index, field, value) {
1454
+ const next = routes.map((route, routeIndex) => {
1455
+ if (routeIndex !== index) return route;
1456
+ return field === 0 ? [value, route[1]] : [route[0], value];
1457
+ });
1458
+ onDraftChange((previous) => withRoutes(previous, next));
1459
+ }
1460
+ function addRoute() {
1461
+ onDraftChange((previous) => withRoutes(previous, [...routes, [labels.keywordPlaceholder, ""]]));
1462
+ }
1463
+ function removeRoute(index) {
1464
+ onDraftChange(
1465
+ (previous) => withRoutes(
1466
+ previous,
1467
+ routes.filter((_, routeIndex) => routeIndex !== index)
1468
+ )
1469
+ );
1470
+ }
1471
+ return /* @__PURE__ */ jsxs10("div", { children: [
1472
+ /* @__PURE__ */ jsxs10("div", { className: "flex items-center justify-between", children: [
1473
+ /* @__PURE__ */ jsx11("label", { className: PANEL_LABEL_CLASSNAME, children: labels.keywordRoutes }),
1474
+ /* @__PURE__ */ jsxs10(
1475
+ "button",
1476
+ {
1477
+ type: "button",
1478
+ "data-cv-tooltip": labels.addKeywordRoute,
1479
+ "aria-label": labels.addKeywordRoute,
1480
+ onClick: addRoute,
1481
+ className: "text-xs text-blue-600 hover:underline flex items-center gap-1",
1482
+ children: [
1483
+ /* @__PURE__ */ jsx11(Plus3, { size: 12, "aria-hidden": "true" }),
1484
+ " ",
1485
+ labels.addKeywordRoute
1486
+ ]
1487
+ }
1488
+ )
1489
+ ] }),
1490
+ /* @__PURE__ */ jsx11("p", { className: PANEL_HINT_CLASSNAME, children: labels.keywordRoutesHint }),
1491
+ /* @__PURE__ */ jsx11("div", { className: "space-y-2 mt-1", children: routes.map(([keyword, target], index) => /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
1492
+ /* @__PURE__ */ jsx11(
1493
+ "input",
1494
+ {
1495
+ value: keyword,
1496
+ "aria-label": labels.keywordRoutes,
1497
+ onChange: (event) => updateRoute(index, 0, event.target.value),
1498
+ className: `w-28 ${PANEL_FIELD_CLASSNAME}`
1499
+ }
1500
+ ),
1501
+ /* @__PURE__ */ jsxs10(
1502
+ "select",
1503
+ {
1504
+ value: target,
1505
+ "aria-label": labels.keywordRoutes,
1506
+ onChange: (event) => updateRoute(index, 1, event.target.value),
1507
+ className: `flex-1 ${PANEL_FIELD_CLASSNAME}`,
1508
+ children: [
1509
+ /* @__PURE__ */ jsx11("option", { value: "", children: "\u2014" }),
1510
+ renderTargetOptions()
1511
+ ]
1512
+ }
1513
+ ),
1514
+ /* @__PURE__ */ jsx11(
1515
+ "button",
1516
+ {
1517
+ type: "button",
1518
+ "data-cv-tooltip": labels.removeKeywordRoute,
1519
+ "aria-label": labels.removeKeywordRoute,
1520
+ onClick: () => removeRoute(index),
1521
+ className: "text-gray-400 hover:text-red-600",
1522
+ children: /* @__PURE__ */ jsx11(Trash2, { size: 14, "aria-hidden": "true" })
1523
+ }
1524
+ )
1525
+ ] }, index)) })
1526
+ ] });
1527
+ }
1528
+
1529
+ // src/flows/FlowRunnerFields.tsx
1530
+ import { Fragment as Fragment4, jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
1531
+ function toNumber(value) {
1532
+ if (value.trim() === "") return void 0;
1533
+ const parsed = Number(value);
1534
+ return Number.isFinite(parsed) ? parsed : void 0;
1535
+ }
1536
+ function withValidation(node, patch) {
1537
+ const merged = { ...node.validation, ...patch };
1538
+ const cleaned = Object.fromEntries(Object.entries(merged).filter(([, value]) => value !== void 0 && value !== ""));
1539
+ return { ...node, validation: Object.keys(cleaned).length > 0 ? cleaned : void 0 };
1540
+ }
1541
+ function NumberField(props) {
1542
+ return /* @__PURE__ */ jsxs11("div", { className: "flex-1", children: [
1543
+ /* @__PURE__ */ jsx12("label", { className: PANEL_LABEL_CLASSNAME, children: props.label }),
1544
+ /* @__PURE__ */ jsx12(
1545
+ "input",
1546
+ {
1547
+ type: "number",
1548
+ value: props.value ?? "",
1549
+ onChange: (event) => props.onValueChange(toNumber(event.target.value)),
1550
+ className: `w-full mt-1 ${PANEL_FIELD_CLASSNAME}`
1551
+ }
1552
+ )
1553
+ ] });
1554
+ }
1555
+ function ValidationFields({ draft, onDraftChange, knownContextKeys, labels }) {
1556
+ const validation = draft.validation ?? {};
1557
+ const update = (patch) => onDraftChange((previous) => withValidation(previous, patch));
1558
+ if (draft.questionType === "date") {
1559
+ return /* @__PURE__ */ jsxs11("div", { className: "space-y-2", children: [
1560
+ /* @__PURE__ */ jsxs11("label", { className: "flex items-center gap-2 text-xs text-gray-600 dark:text-gray-300", children: [
1561
+ /* @__PURE__ */ jsx12(
1562
+ "input",
1563
+ {
1564
+ type: "checkbox",
1565
+ checked: validation.minDate === "today",
1566
+ onChange: (event) => update({ minDate: event.target.checked ? "today" : void 0 })
1567
+ }
1568
+ ),
1569
+ labels.minDateToday
1570
+ ] }),
1571
+ /* @__PURE__ */ jsxs11("div", { children: [
1572
+ /* @__PURE__ */ jsx12("label", { className: PANEL_LABEL_CLASSNAME, children: labels.afterContextKey }),
1573
+ /* @__PURE__ */ jsx12(
1574
+ "input",
1575
+ {
1576
+ value: validation.afterContextKey ?? "",
1577
+ list: "runner-context-keys",
1578
+ onChange: (event) => update({ afterContextKey: event.target.value || void 0 }),
1579
+ className: `w-full mt-1 ${PANEL_FIELD_CLASSNAME}`
1580
+ }
1581
+ ),
1582
+ /* @__PURE__ */ jsx12("datalist", { id: "runner-context-keys", children: knownContextKeys.map((key) => /* @__PURE__ */ jsx12("option", { value: key }, key)) })
1583
+ ] })
1584
+ ] });
1585
+ }
1586
+ if (draft.questionType === "int" || draft.questionType === "money") {
1587
+ return /* @__PURE__ */ jsxs11("div", { className: "flex gap-2", children: [
1588
+ /* @__PURE__ */ jsx12(NumberField, { label: labels.minValue, value: validation.min, onValueChange: (min) => update({ min }) }),
1589
+ /* @__PURE__ */ jsx12(NumberField, { label: labels.maxValue, value: validation.max, onValueChange: (max) => update({ max }) })
1590
+ ] });
1591
+ }
1592
+ if (!draft.questionType || draft.questionType === "text") {
1593
+ return /* @__PURE__ */ jsxs11("div", { className: "flex gap-2", children: [
1594
+ /* @__PURE__ */ jsx12(
1595
+ NumberField,
1596
+ {
1597
+ label: labels.minLength,
1598
+ value: validation.minLength,
1599
+ onValueChange: (minLength) => update({ minLength })
1600
+ }
1601
+ ),
1602
+ /* @__PURE__ */ jsx12(
1603
+ NumberField,
1604
+ {
1605
+ label: labels.maxLength,
1606
+ value: validation.maxLength,
1607
+ onValueChange: (maxLength) => update({ maxLength })
1608
+ }
1609
+ )
1610
+ ] });
1611
+ }
1612
+ return null;
1613
+ }
1614
+ function OptionDetailsField({ draft, onDraftChange, labels }) {
1615
+ const options = draft.options ?? [];
1616
+ if (options.length === 0) return null;
1617
+ function updateDetail(optionId, field, value) {
1618
+ onDraftChange((previous) => {
1619
+ const current = previous.optionDetails?.[optionId] ?? {};
1620
+ const detail = { ...current, [field]: value || void 0 };
1621
+ return { ...previous, optionDetails: { ...previous.optionDetails, [optionId]: detail } };
1622
+ });
1623
+ }
1624
+ return /* @__PURE__ */ jsx12("div", { className: "space-y-2", children: options.map(([optionId, title]) => /* @__PURE__ */ jsxs11("div", { className: "space-y-1", children: [
1625
+ /* @__PURE__ */ jsx12("span", { className: "text-[11px] font-medium text-gray-500 dark:text-gray-400", children: title || optionId }),
1626
+ /* @__PURE__ */ jsxs11("div", { className: "flex gap-2", children: [
1627
+ /* @__PURE__ */ jsx12(
1628
+ "input",
1629
+ {
1630
+ value: draft.optionDetails?.[optionId]?.description ?? "",
1631
+ placeholder: labels.optionDescription,
1632
+ "aria-label": `${labels.optionDescription}: ${title}`,
1633
+ onChange: (event) => updateDetail(optionId, "description", event.target.value),
1634
+ className: `flex-1 ${PANEL_FIELD_CLASSNAME}`
1635
+ }
1636
+ ),
1637
+ /* @__PURE__ */ jsx12(
1638
+ "input",
1639
+ {
1640
+ value: draft.optionDetails?.[optionId]?.section ?? "",
1641
+ placeholder: labels.optionSection,
1642
+ "aria-label": `${labels.optionSection}: ${title}`,
1643
+ onChange: (event) => updateDetail(optionId, "section", event.target.value),
1644
+ className: `w-24 ${PANEL_FIELD_CLASSNAME}`
1645
+ }
1646
+ )
1647
+ ] })
1648
+ ] }, optionId)) });
1649
+ }
1650
+ function TextField(props) {
1651
+ return /* @__PURE__ */ jsxs11("div", { children: [
1652
+ /* @__PURE__ */ jsx12("label", { className: PANEL_LABEL_CLASSNAME, children: props.label }),
1653
+ /* @__PURE__ */ jsx12(
1654
+ "input",
1655
+ {
1656
+ value: props.value,
1657
+ placeholder: props.placeholder,
1658
+ onChange: (event) => props.onValueChange(event.target.value),
1659
+ className: `w-full mt-1 ${PANEL_FIELD_CLASSNAME}`
1660
+ }
1661
+ ),
1662
+ props.hint && /* @__PURE__ */ jsx12("p", { className: PANEL_HINT_CLASSNAME, children: props.hint })
1663
+ ] });
1664
+ }
1665
+ function FlowRunnerFields(props) {
1666
+ const { draft, onDraftChange, labels } = props;
1667
+ const isDynamic = draft.type === "dynamic_choice";
1668
+ const isChoice = draft.type === "menu" || draft.questionType === "choice";
1669
+ const isQuestion = draft.type === "question" && !isChoice;
1670
+ return /* @__PURE__ */ jsxs11("div", { className: "pt-2 border-t border-gray-100 dark:border-gray-700 space-y-3", children: [
1671
+ /* @__PURE__ */ jsx12("p", { className: "text-xs font-semibold text-gray-700 dark:text-gray-200", children: labels.section }),
1672
+ /* @__PURE__ */ jsx12("p", { className: PANEL_HINT_CLASSNAME, children: labels.placeholdersHint }),
1673
+ isDynamic && /* @__PURE__ */ jsxs11(Fragment4, { children: [
1674
+ /* @__PURE__ */ jsx12(
1675
+ TextField,
1676
+ {
1677
+ label: labels.choiceProvider,
1678
+ hint: labels.choiceProviderHint,
1679
+ value: draft.choiceProvider ?? "",
1680
+ onValueChange: (value) => onDraftChange((previous) => ({ ...previous, choiceProvider: value || void 0 }))
1681
+ }
1682
+ ),
1683
+ /* @__PURE__ */ jsx12(
1684
+ TextField,
1685
+ {
1686
+ label: labels.contextKey,
1687
+ value: draft.contextKey ?? "",
1688
+ onValueChange: (value) => onDraftChange((previous) => ({ ...previous, contextKey: value || void 0 }))
1689
+ }
1690
+ )
1691
+ ] }),
1692
+ isQuestion && /* @__PURE__ */ jsx12(ValidationFields, { ...props }),
1693
+ isChoice && /* @__PURE__ */ jsx12(OptionDetailsField, { ...props }),
1694
+ isChoice && /* @__PURE__ */ jsxs11("div", { children: [
1695
+ /* @__PURE__ */ jsx12("label", { className: PANEL_LABEL_CLASSNAME, children: labels.unmatchedChoice }),
1696
+ /* @__PURE__ */ jsxs11(
1697
+ "select",
1698
+ {
1699
+ value: draft.unmatchedChoice ?? "reask",
1700
+ onChange: (event) => {
1701
+ const value = event.target.value === "default" ? "default" : void 0;
1702
+ onDraftChange((previous) => ({ ...previous, unmatchedChoice: value }));
1703
+ },
1704
+ className: `w-full mt-1 ${PANEL_FIELD_CLASSNAME}`,
1705
+ children: [
1706
+ /* @__PURE__ */ jsx12("option", { value: "reask", children: labels.unmatchedChoiceReask }),
1707
+ /* @__PURE__ */ jsx12("option", { value: "default", children: labels.unmatchedChoiceDefault })
1708
+ ]
1709
+ }
1710
+ )
1711
+ ] }),
1712
+ (isChoice || isDynamic) && /* @__PURE__ */ jsx12(
1713
+ TextField,
1714
+ {
1715
+ label: labels.listButtonLabel,
1716
+ value: draft.listButtonLabel ?? "",
1717
+ onValueChange: (value) => onDraftChange((previous) => ({ ...previous, listButtonLabel: value || void 0 }))
1718
+ }
1719
+ ),
1720
+ isQuestion && /* @__PURE__ */ jsx12(
1721
+ TextField,
1722
+ {
1723
+ label: labels.skipKeywords,
1724
+ hint: labels.skipKeywordsHint,
1725
+ value: (draft.skipKeywords ?? []).join(", "),
1726
+ onValueChange: (value) => {
1727
+ const keywords = value.split(",").map((keyword) => keyword.trim()).filter(Boolean);
1728
+ onDraftChange((previous) => ({ ...previous, skipKeywords: keywords.length > 0 ? keywords : void 0 }));
1729
+ }
1730
+ }
1731
+ ),
1732
+ /* @__PURE__ */ jsx12(
1733
+ TextField,
1734
+ {
1735
+ label: labels.fallbackMessage,
1736
+ placeholder: labels.fallbackPlaceholder,
1737
+ value: draft.fallbackMessage ?? "",
1738
+ onValueChange: (value) => onDraftChange((previous) => ({ ...previous, fallbackMessage: value || void 0 }))
1739
+ }
1740
+ ),
1741
+ /* @__PURE__ */ jsxs11("div", { children: [
1742
+ /* @__PURE__ */ jsx12(
1743
+ NumberField,
1744
+ {
1745
+ label: labels.maxInvalidAnswers,
1746
+ value: draft.maxInvalidAnswers,
1747
+ onValueChange: (value) => onDraftChange((previous) => ({
1748
+ ...previous,
1749
+ maxInvalidAnswers: value && value > 0 ? Math.floor(value) : void 0
1750
+ }))
1751
+ }
1752
+ ),
1753
+ /* @__PURE__ */ jsx12("p", { className: PANEL_HINT_CLASSNAME, children: labels.maxInvalidAnswersHint })
1754
+ ] }),
1755
+ (draft.type === "menu" || draft.type === "question") && /* @__PURE__ */ jsx12(FlowKeywordRoutesField, { ...props })
1756
+ ] });
1757
+ }
1758
+
1291
1759
  // src/flows/FlowNodePanel.tsx
1292
- import { Fragment as Fragment4, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
1293
- var SELECT_CLASSNAME = "border border-gray-200 dark:border-gray-600 dark:bg-gray-700 dark:text-gray-100 rounded-xl px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400 focus:border-transparent transition-all";
1294
- var INPUT_CLASSNAME = "border border-gray-200 dark:border-gray-600 dark:bg-gray-700 dark:text-gray-100 rounded-xl px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400 focus:border-transparent transition-all";
1760
+ import { Fragment as Fragment5, jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
1761
+ var SELECT_CLASSNAME = PANEL_FIELD_CLASSNAME;
1762
+ var INPUT_CLASSNAME = PANEL_FIELD_CLASSNAME;
1295
1763
  function truncateLabel(value, max = 60) {
1296
1764
  if (!value) return "\u2014";
1297
1765
  return value.length > max ? `${value.slice(0, max - 1)}\u2026` : value;
@@ -1301,13 +1769,14 @@ function WhatsAppTextField({
1301
1769
  value,
1302
1770
  onValueChange,
1303
1771
  options,
1772
+ optionDetails,
1304
1773
  placeholder,
1305
1774
  labels
1306
1775
  }) {
1307
- return /* @__PURE__ */ jsxs10("div", { className: "space-y-2", children: [
1308
- /* @__PURE__ */ jsxs10("div", { children: [
1309
- /* @__PURE__ */ jsx11("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: label }),
1310
- /* @__PURE__ */ jsx11(
1776
+ return /* @__PURE__ */ jsxs12("div", { className: "space-y-2", children: [
1777
+ /* @__PURE__ */ jsxs12("div", { children: [
1778
+ /* @__PURE__ */ jsx13("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: label }),
1779
+ /* @__PURE__ */ jsx13(
1311
1780
  "textarea",
1312
1781
  {
1313
1782
  value,
@@ -1318,18 +1787,18 @@ function WhatsAppTextField({
1318
1787
  }
1319
1788
  )
1320
1789
  ] }),
1321
- /* @__PURE__ */ jsxs10("div", { children: [
1322
- /* @__PURE__ */ jsx11("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.preview }),
1323
- /* @__PURE__ */ jsx11("div", { className: "mt-1", children: /* @__PURE__ */ jsx11(FlowWhatsAppPreview, { body: value, options, labels: labels.nodePanel }) })
1790
+ /* @__PURE__ */ jsxs12("div", { children: [
1791
+ /* @__PURE__ */ jsx13("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.preview }),
1792
+ /* @__PURE__ */ jsx13("div", { className: "mt-1", children: /* @__PURE__ */ jsx13(FlowWhatsAppPreview, { body: value, options, optionDetails, labels: labels.nodePanel }) })
1324
1793
  ] })
1325
1794
  ] });
1326
1795
  }
1327
1796
  function IssueRow({ issue }) {
1328
1797
  const Icon = issue.severity === "error" ? AlertCircle2 : AlertTriangle2;
1329
1798
  const color = issue.severity === "error" ? "text-red-600 dark:text-red-400" : "text-amber-600 dark:text-amber-400";
1330
- return /* @__PURE__ */ jsxs10("div", { className: `flex items-start gap-1.5 text-xs ${color}`, children: [
1331
- /* @__PURE__ */ jsx11(Icon, { size: 13, className: "mt-0.5 shrink-0" }),
1332
- /* @__PURE__ */ jsx11("span", { children: issue.message })
1799
+ return /* @__PURE__ */ jsxs12("div", { className: `flex items-start gap-1.5 text-xs ${color}`, children: [
1800
+ /* @__PURE__ */ jsx13(Icon, { size: 13, className: "mt-0.5 shrink-0" }),
1801
+ /* @__PURE__ */ jsx13("span", { children: issue.message })
1333
1802
  ] });
1334
1803
  }
1335
1804
  function FlowNodePanel({
@@ -1349,8 +1818,9 @@ function FlowNodePanel({
1349
1818
  const isFixedLogic = draft.type === "entrada_choice";
1350
1819
  const isAction = draft.type === "action";
1351
1820
  const isSendMedia = isAction && draft.actionKind === BUILT_IN_ACTION_KINDS.SEND_MEDIA;
1352
- const isPassThroughAction = isAction && Boolean(draft.actionKind && PASS_THROUGH_ACTION_KINDS.includes(draft.actionKind));
1821
+ const isPassThroughAction2 = isPassThroughAction(draft);
1353
1822
  const isCondition = draft.type === "condition";
1823
+ const isDynamicChoice = draft.type === "dynamic_choice";
1354
1824
  const isStart = graph.startNodeId === node.id;
1355
1825
  const nodeIssues = issues.filter((i) => i.nodeId === node.id);
1356
1826
  const knownContextKeys = [
@@ -1393,24 +1863,24 @@ function FlowNodePanel({
1393
1863
  setDraft((prev) => ({ ...prev, options: (prev.options ?? []).filter((_, i) => i !== index) }));
1394
1864
  }
1395
1865
  function nextNodeOptions() {
1396
- return /* @__PURE__ */ jsxs10(Fragment4, { children: [
1397
- otherNodeIds.map((id) => /* @__PURE__ */ jsx11("option", { value: id, children: truncateLabel(nodeLabel(graph.nodes[id], labels)) }, id)),
1398
- otherFlows.length > 0 && /* @__PURE__ */ jsx11("optgroup", { label: labels.nodePanel.otherFlowsGroup, children: otherFlows.map((flow) => /* @__PURE__ */ jsx11("option", { value: `${CROSS_FLOW_PREFIX}${flow.key}`, children: flow.label }, flow.key)) })
1866
+ return /* @__PURE__ */ jsxs12(Fragment5, { children: [
1867
+ otherNodeIds.map((id) => /* @__PURE__ */ jsx13("option", { value: id, children: truncateLabel(nodeLabel(graph.nodes[id], labels)) }, id)),
1868
+ otherFlows.length > 0 && /* @__PURE__ */ jsx13("optgroup", { label: labels.nodePanel.otherFlowsGroup, children: otherFlows.map((flow) => /* @__PURE__ */ jsx13("option", { value: `${CROSS_FLOW_PREFIX}${flow.key}`, children: flow.label }, flow.key)) })
1399
1869
  ] });
1400
1870
  }
1401
- return /* @__PURE__ */ jsxs10("div", { className: "fixed inset-y-0 right-0 w-96 bg-white dark:bg-gray-800 border-l border-gray-200 dark:border-gray-700 shadow-xl z-50 flex flex-col", children: [
1402
- /* @__PURE__ */ jsxs10("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-100 dark:border-gray-700", children: [
1403
- /* @__PURE__ */ jsx11("h3", { className: "text-sm font-semibold text-gray-900 dark:text-gray-100", children: labels.nodePanel.title }),
1404
- /* @__PURE__ */ jsx11("button", { "data-cv-tooltip": labels.nodePanel.close, "aria-label": labels.nodePanel.close, onClick: onClose, className: "text-gray-400 hover:text-gray-600", children: /* @__PURE__ */ jsx11(X3, { size: 18 }) })
1871
+ return /* @__PURE__ */ jsxs12("div", { className: "fixed inset-y-0 right-0 w-96 bg-white dark:bg-gray-800 border-l border-gray-200 dark:border-gray-700 shadow-xl z-50 flex flex-col", children: [
1872
+ /* @__PURE__ */ jsxs12("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-100 dark:border-gray-700", children: [
1873
+ /* @__PURE__ */ jsx13("h3", { className: "text-sm font-semibold text-gray-900 dark:text-gray-100", children: labels.nodePanel.title }),
1874
+ /* @__PURE__ */ jsx13("button", { "data-cv-tooltip": labels.nodePanel.close, "aria-label": labels.nodePanel.close, onClick: onClose, className: "text-gray-400 hover:text-gray-600", children: /* @__PURE__ */ jsx13(X3, { size: 18 }) })
1405
1875
  ] }),
1406
- /* @__PURE__ */ jsxs10("div", { className: "flex-1 overflow-y-auto p-4 space-y-4", children: [
1407
- nodeIssues.length > 0 && /* @__PURE__ */ jsx11("div", { className: "rounded-lg border border-gray-100 dark:border-gray-700 bg-gray-50 dark:bg-gray-900/40 p-2.5 space-y-1.5", children: nodeIssues.map((issue, i) => /* @__PURE__ */ jsx11(IssueRow, { issue }, i)) }),
1408
- isFixedLogic && /* @__PURE__ */ jsx11("p", { className: "text-xs text-purple-700 dark:text-purple-400 bg-purple-50 dark:bg-purple-950/30 rounded-lg p-2", children: labels.nodePanel.fixedLogicNotice }),
1409
- isAction && /* @__PURE__ */ jsx11("p", { className: "text-xs text-orange-700 dark:text-orange-400 bg-orange-50 dark:bg-orange-950/30 rounded-lg p-2", children: labels.nodePanel.actionNotice }),
1410
- isCondition && /* @__PURE__ */ jsx11("p", { className: "text-xs text-cyan-700 dark:text-cyan-400 bg-cyan-50 dark:bg-cyan-950/30 rounded-lg p-2", children: labels.nodePanel.conditionNotice }),
1411
- /* @__PURE__ */ jsxs10("div", { children: [
1412
- /* @__PURE__ */ jsx11("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.nodeName }),
1413
- /* @__PURE__ */ jsx11(
1876
+ /* @__PURE__ */ jsxs12("div", { className: "flex-1 overflow-y-auto p-4 space-y-4", children: [
1877
+ nodeIssues.length > 0 && /* @__PURE__ */ jsx13("div", { className: "rounded-lg border border-gray-100 dark:border-gray-700 bg-gray-50 dark:bg-gray-900/40 p-2.5 space-y-1.5", children: nodeIssues.map((issue, i) => /* @__PURE__ */ jsx13(IssueRow, { issue }, i)) }),
1878
+ isFixedLogic && /* @__PURE__ */ jsx13("p", { className: "text-xs text-purple-700 dark:text-purple-400 bg-purple-50 dark:bg-purple-950/30 rounded-lg p-2", children: labels.nodePanel.fixedLogicNotice }),
1879
+ isAction && /* @__PURE__ */ jsx13("p", { className: "text-xs text-orange-700 dark:text-orange-400 bg-orange-50 dark:bg-orange-950/30 rounded-lg p-2", children: labels.nodePanel.actionNotice }),
1880
+ isCondition && /* @__PURE__ */ jsx13("p", { className: "text-xs text-cyan-700 dark:text-cyan-400 bg-cyan-50 dark:bg-cyan-950/30 rounded-lg p-2", children: labels.nodePanel.conditionNotice }),
1881
+ /* @__PURE__ */ jsxs12("div", { children: [
1882
+ /* @__PURE__ */ jsx13("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.nodeName }),
1883
+ /* @__PURE__ */ jsx13(
1414
1884
  "input",
1415
1885
  {
1416
1886
  value: draft.label ?? "",
@@ -1419,11 +1889,11 @@ function FlowNodePanel({
1419
1889
  className: `w-full mt-1 ${INPUT_CLASSNAME}`
1420
1890
  }
1421
1891
  ),
1422
- /* @__PURE__ */ jsx11("p", { className: "text-[11px] text-gray-400 dark:text-gray-500 mt-1", children: labels.nodePanel.nodeNameHint })
1892
+ /* @__PURE__ */ jsx13("p", { className: "text-[11px] text-gray-400 dark:text-gray-500 mt-1", children: labels.nodePanel.nodeNameHint })
1423
1893
  ] }),
1424
- draft.contextKey && /* @__PURE__ */ jsxs10("div", { children: [
1425
- /* @__PURE__ */ jsx11("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.contextKey }),
1426
- /* @__PURE__ */ jsx11(
1894
+ draft.contextKey && /* @__PURE__ */ jsxs12("div", { children: [
1895
+ /* @__PURE__ */ jsx13("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.contextKey }),
1896
+ /* @__PURE__ */ jsx13(
1427
1897
  "input",
1428
1898
  {
1429
1899
  value: draft.contextKey,
@@ -1432,32 +1902,33 @@ function FlowNodePanel({
1432
1902
  }
1433
1903
  )
1434
1904
  ] }),
1435
- !isFixedLogic && !isAction && !isCondition && /* @__PURE__ */ jsxs10("div", { children: [
1436
- /* @__PURE__ */ jsx11("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.questionType }),
1437
- /* @__PURE__ */ jsx11(
1905
+ !isFixedLogic && !isAction && !isCondition && !isDynamicChoice && /* @__PURE__ */ jsxs12("div", { children: [
1906
+ /* @__PURE__ */ jsx13("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.questionType }),
1907
+ /* @__PURE__ */ jsx13(
1438
1908
  "select",
1439
1909
  {
1440
1910
  value: draft.questionType ?? "text",
1441
1911
  onChange: (e) => setDraft((prev) => ({ ...prev, questionType: e.target.value })),
1442
1912
  className: `w-full mt-1 ${SELECT_CLASSNAME}`,
1443
- children: Object.entries(labels.questionTypeLabels).map(([key, label]) => /* @__PURE__ */ jsx11("option", { value: key, children: label }, key))
1913
+ children: Object.entries(labels.questionTypeLabels).map(([key, label]) => /* @__PURE__ */ jsx13("option", { value: key, children: label }, key))
1444
1914
  }
1445
1915
  )
1446
1916
  ] }),
1447
- !isFixedLogic && !isAction && !isCondition && /* @__PURE__ */ jsx11(
1917
+ !isFixedLogic && !isAction && !isCondition && /* @__PURE__ */ jsx13(
1448
1918
  WhatsAppTextField,
1449
1919
  {
1450
1920
  label: labels.nodePanel.question,
1451
1921
  value: draft.question ?? "",
1452
- options: draft.questionType === "choice" ? draft.options : void 0,
1922
+ options: draft.questionType === "choice" || draft.type === "menu" ? draft.options : void 0,
1923
+ optionDetails: draft.optionDetails,
1453
1924
  onValueChange: (value) => setDraft((prev) => ({ ...prev, question: value })),
1454
1925
  labels
1455
1926
  }
1456
1927
  ),
1457
- isCondition && /* @__PURE__ */ jsxs10("div", { className: "space-y-3", children: [
1458
- /* @__PURE__ */ jsxs10("div", { children: [
1459
- /* @__PURE__ */ jsx11("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.conditionVariable }),
1460
- /* @__PURE__ */ jsx11(
1928
+ isCondition && /* @__PURE__ */ jsxs12("div", { className: "space-y-3", children: [
1929
+ /* @__PURE__ */ jsxs12("div", { children: [
1930
+ /* @__PURE__ */ jsx13("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.conditionVariable }),
1931
+ /* @__PURE__ */ jsx13(
1461
1932
  "input",
1462
1933
  {
1463
1934
  value: draft.conditionContextKey ?? "",
@@ -1466,11 +1937,11 @@ function FlowNodePanel({
1466
1937
  className: `w-full mt-1 ${INPUT_CLASSNAME}`
1467
1938
  }
1468
1939
  ),
1469
- /* @__PURE__ */ jsx11("datalist", { id: "condition-context-keys", children: knownContextKeys.map((key) => /* @__PURE__ */ jsx11("option", { value: key }, key)) })
1940
+ /* @__PURE__ */ jsx13("datalist", { id: "condition-context-keys", children: knownContextKeys.map((key) => /* @__PURE__ */ jsx13("option", { value: key }, key)) })
1470
1941
  ] }),
1471
- /* @__PURE__ */ jsxs10("div", { children: [
1472
- /* @__PURE__ */ jsx11("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.conditionOperator }),
1473
- /* @__PURE__ */ jsx11(
1942
+ /* @__PURE__ */ jsxs12("div", { children: [
1943
+ /* @__PURE__ */ jsx13("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.conditionOperator }),
1944
+ /* @__PURE__ */ jsx13(
1474
1945
  "select",
1475
1946
  {
1476
1947
  value: draft.conditionOperator ?? ">",
@@ -1479,13 +1950,13 @@ function FlowNodePanel({
1479
1950
  conditionOperator: e.target.value
1480
1951
  })),
1481
1952
  className: `w-full mt-1 ${SELECT_CLASSNAME}`,
1482
- children: CONDITION_OPERATORS.map((operator) => /* @__PURE__ */ jsx11("option", { value: operator, children: labels.conditionOperatorLabels[operator] ?? operator }, operator))
1953
+ children: CONDITION_OPERATORS.map((operator) => /* @__PURE__ */ jsx13("option", { value: operator, children: labels.conditionOperatorLabels[operator] ?? operator }, operator))
1483
1954
  }
1484
1955
  )
1485
1956
  ] }),
1486
- /* @__PURE__ */ jsxs10("div", { children: [
1487
- /* @__PURE__ */ jsx11("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.conditionValue }),
1488
- /* @__PURE__ */ jsx11(
1957
+ /* @__PURE__ */ jsxs12("div", { children: [
1958
+ /* @__PURE__ */ jsx13("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.conditionValue }),
1959
+ /* @__PURE__ */ jsx13(
1489
1960
  "input",
1490
1961
  {
1491
1962
  value: draft.conditionValue ?? "",
@@ -1495,7 +1966,7 @@ function FlowNodePanel({
1495
1966
  )
1496
1967
  ] })
1497
1968
  ] }),
1498
- isAction && draft.actionKind === "send_product_list" && /* @__PURE__ */ jsx11(
1969
+ isAction && draft.actionKind === "send_product_list" && /* @__PURE__ */ jsx13(
1499
1970
  WhatsAppTextField,
1500
1971
  {
1501
1972
  label: labels.nodePanel.fallbackMessage,
@@ -1505,11 +1976,11 @@ function FlowNodePanel({
1505
1976
  labels
1506
1977
  }
1507
1978
  ),
1508
- isSendMedia && /* @__PURE__ */ jsxs10("div", { children: [
1509
- /* @__PURE__ */ jsx11("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.media }),
1510
- /* @__PURE__ */ jsx11("div", { className: "mt-1", children: renderMediaPicker?.(node, graph) ?? /* @__PURE__ */ jsx11("p", { className: "text-xs text-gray-400", children: labels.nodePanel.mediaUnavailable }) })
1979
+ isSendMedia && /* @__PURE__ */ jsxs12("div", { children: [
1980
+ /* @__PURE__ */ jsx13("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.media }),
1981
+ /* @__PURE__ */ jsx13("div", { className: "mt-1", children: renderMediaPicker?.(node, graph) ?? /* @__PURE__ */ jsx13("p", { className: "text-xs text-gray-400", children: labels.nodePanel.mediaUnavailable }) })
1511
1982
  ] }),
1512
- isAction && draft.actionKind !== "send_product_list" && !isSendMedia && /* @__PURE__ */ jsx11(
1983
+ isAction && draft.actionKind !== "send_product_list" && !isSendMedia && /* @__PURE__ */ jsx13(
1513
1984
  WhatsAppTextField,
1514
1985
  {
1515
1986
  label: labels.nodePanel.directMessage,
@@ -1519,17 +1990,17 @@ function FlowNodePanel({
1519
1990
  labels
1520
1991
  }
1521
1992
  ),
1522
- (draft.questionType === "choice" || draft.type === "menu") && /* @__PURE__ */ jsxs10("div", { children: [
1523
- /* @__PURE__ */ jsxs10("div", { className: "flex items-center justify-between mb-1.5", children: [
1524
- /* @__PURE__ */ jsx11("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.options }),
1525
- /* @__PURE__ */ jsxs10("button", { "data-cv-tooltip": labels.nodePanel.addOption, "aria-label": labels.nodePanel.addOption, onClick: addOption, className: "text-xs text-blue-600 hover:underline flex items-center gap-1", children: [
1526
- /* @__PURE__ */ jsx11(Plus3, { size: 12 }),
1993
+ (draft.questionType === "choice" || draft.type === "menu") && /* @__PURE__ */ jsxs12("div", { children: [
1994
+ /* @__PURE__ */ jsxs12("div", { className: "flex items-center justify-between mb-1.5", children: [
1995
+ /* @__PURE__ */ jsx13("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.options }),
1996
+ /* @__PURE__ */ jsxs12("button", { "data-cv-tooltip": labels.nodePanel.addOption, "aria-label": labels.nodePanel.addOption, onClick: addOption, className: "text-xs text-blue-600 hover:underline flex items-center gap-1", children: [
1997
+ /* @__PURE__ */ jsx13(Plus4, { size: 12 }),
1527
1998
  " ",
1528
1999
  labels.nodePanel.addOption
1529
2000
  ] })
1530
2001
  ] }),
1531
- /* @__PURE__ */ jsx11("div", { className: "space-y-2", children: (draft.options ?? []).map(([id, label], i) => /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
1532
- /* @__PURE__ */ jsx11(
2002
+ /* @__PURE__ */ jsx13("div", { className: "space-y-2", children: (draft.options ?? []).map(([id, label], i) => /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
2003
+ /* @__PURE__ */ jsx13(
1533
2004
  "input",
1534
2005
  {
1535
2006
  value: id,
@@ -1538,7 +2009,7 @@ function FlowNodePanel({
1538
2009
  className: `w-16 ${INPUT_CLASSNAME}`
1539
2010
  }
1540
2011
  ),
1541
- /* @__PURE__ */ jsx11(
2012
+ /* @__PURE__ */ jsx13(
1542
2013
  "input",
1543
2014
  {
1544
2015
  value: label,
@@ -1547,49 +2018,59 @@ function FlowNodePanel({
1547
2018
  className: `flex-1 ${INPUT_CLASSNAME}`
1548
2019
  }
1549
2020
  ),
1550
- /* @__PURE__ */ jsx11("button", { "data-cv-tooltip": labels.nodePanel.removeOption, "aria-label": labels.nodePanel.removeOption, onClick: () => removeOption(i), className: "text-gray-400 hover:text-red-600", children: /* @__PURE__ */ jsx11(Trash2, { size: 14 }) })
2021
+ /* @__PURE__ */ jsx13("button", { "data-cv-tooltip": labels.nodePanel.removeOption, "aria-label": labels.nodePanel.removeOption, onClick: () => removeOption(i), className: "text-gray-400 hover:text-red-600", children: /* @__PURE__ */ jsx13(Trash22, { size: 14 }) })
1551
2022
  ] }, i)) })
1552
2023
  ] }),
1553
- (!isAction || isPassThroughAction) && /* @__PURE__ */ jsxs10("div", { className: "pt-2 border-t border-gray-100 dark:border-gray-700", children: [
1554
- /* @__PURE__ */ jsx11("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.next }),
1555
- /* @__PURE__ */ jsx11("p", { className: "text-[11px] text-gray-400 dark:text-gray-500 mb-1", children: labels.nodePanel.nextHint }),
1556
- typeof draft.next !== "object" && !isCondition ? /* @__PURE__ */ jsxs10(
2024
+ !isFixedLogic && !isAction && !isCondition && /* @__PURE__ */ jsx13(
2025
+ FlowRunnerFields,
2026
+ {
2027
+ draft,
2028
+ onDraftChange: setDraft,
2029
+ renderTargetOptions: nextNodeOptions,
2030
+ knownContextKeys,
2031
+ labels: labels.runnerFields ?? DEFAULT_FLOW_RUNNER_FIELD_LABELS
2032
+ }
2033
+ ),
2034
+ (!isAction || isPassThroughAction2) && /* @__PURE__ */ jsxs12("div", { className: "pt-2 border-t border-gray-100 dark:border-gray-700", children: [
2035
+ /* @__PURE__ */ jsx13("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.next }),
2036
+ /* @__PURE__ */ jsx13("p", { className: "text-[11px] text-gray-400 dark:text-gray-500 mb-1", children: labels.nodePanel.nextHint }),
2037
+ typeof draft.next !== "object" && !isCondition ? /* @__PURE__ */ jsxs12(
1557
2038
  "select",
1558
2039
  {
1559
2040
  value: typeof draft.next === "string" ? draft.next : "",
1560
2041
  onChange: (e) => updateNextString(e.target.value),
1561
2042
  className: `w-full mt-1 ${SELECT_CLASSNAME}`,
1562
2043
  children: [
1563
- /* @__PURE__ */ jsx11("option", { value: "", children: "\u2014" }),
2044
+ /* @__PURE__ */ jsx13("option", { value: "", children: "\u2014" }),
1564
2045
  nextNodeOptions()
1565
2046
  ]
1566
2047
  }
1567
- ) : /* @__PURE__ */ jsxs10("div", { className: "space-y-2 mt-1", children: [
1568
- conditionAnswerIds.map((id) => /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
1569
- /* @__PURE__ */ jsx11("span", { className: "text-xs text-gray-500 w-32 shrink-0", children: isCondition ? id === "true" ? labels.nodePanel.conditionTrue : labels.nodePanel.conditionFalse : labels.nodePanel.nextByAnswer(id) }),
1570
- /* @__PURE__ */ jsxs10(
2048
+ ) : /* @__PURE__ */ jsxs12("div", { className: "space-y-2 mt-1", children: [
2049
+ conditionAnswerIds.map((id) => /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
2050
+ /* @__PURE__ */ jsx13("span", { className: "text-xs text-gray-500 w-32 shrink-0", children: isCondition ? id === "true" ? labels.nodePanel.conditionTrue : labels.nodePanel.conditionFalse : labels.nodePanel.nextByAnswer(id) }),
2051
+ /* @__PURE__ */ jsxs12(
1571
2052
  "select",
1572
2053
  {
1573
2054
  value: draft.next && typeof draft.next === "object" ? draft.next.byAnswer[id] ?? "" : "",
1574
2055
  onChange: (e) => updateNextByAnswer(id, e.target.value),
1575
2056
  className: `flex-1 ${SELECT_CLASSNAME}`,
1576
2057
  children: [
1577
- /* @__PURE__ */ jsx11("option", { value: "", children: "\u2014" }),
2058
+ /* @__PURE__ */ jsx13("option", { value: "", children: "\u2014" }),
1578
2059
  nextNodeOptions()
1579
2060
  ]
1580
2061
  }
1581
2062
  )
1582
2063
  ] }, id)),
1583
- /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
1584
- /* @__PURE__ */ jsx11("span", { className: "text-xs text-gray-500 w-32 shrink-0", children: isCondition ? labels.nodePanel.conditionVariableMissing : labels.nodePanel.nextDefault }),
1585
- /* @__PURE__ */ jsxs10(
2064
+ /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
2065
+ /* @__PURE__ */ jsx13("span", { className: "text-xs text-gray-500 w-32 shrink-0", children: isCondition ? labels.nodePanel.conditionVariableMissing : labels.nodePanel.nextDefault }),
2066
+ /* @__PURE__ */ jsxs12(
1586
2067
  "select",
1587
2068
  {
1588
2069
  value: draft.next && typeof draft.next === "object" ? draft.next.default : "",
1589
2070
  onChange: (e) => updateNextDefault(e.target.value),
1590
2071
  className: `flex-1 ${SELECT_CLASSNAME}`,
1591
2072
  children: [
1592
- /* @__PURE__ */ jsx11("option", { value: "", children: "\u2014" }),
2073
+ /* @__PURE__ */ jsx13("option", { value: "", children: "\u2014" }),
1593
2074
  nextNodeOptions()
1594
2075
  ]
1595
2076
  }
@@ -1598,8 +2079,8 @@ function FlowNodePanel({
1598
2079
  ] })
1599
2080
  ] })
1600
2081
  ] }),
1601
- /* @__PURE__ */ jsxs10("div", { className: "p-4 border-t border-gray-100 dark:border-gray-700 flex gap-2", children: [
1602
- /* @__PURE__ */ jsxs10(
2082
+ /* @__PURE__ */ jsxs12("div", { className: "p-4 border-t border-gray-100 dark:border-gray-700 flex gap-2", children: [
2083
+ /* @__PURE__ */ jsxs12(
1603
2084
  "button",
1604
2085
  {
1605
2086
  "data-cv-tooltip": labels.nodePanel.save,
@@ -1607,13 +2088,13 @@ function FlowNodePanel({
1607
2088
  onClick: () => onChange(draft),
1608
2089
  className: "flex-1 inline-flex items-center justify-center gap-2 rounded-lg bg-blue-600 px-4 py-2 text-sm font-medium text-white hover:bg-blue-700",
1609
2090
  children: [
1610
- /* @__PURE__ */ jsx11(Save, { size: 14 }),
2091
+ /* @__PURE__ */ jsx13(Save, { size: 14 }),
1611
2092
  " ",
1612
2093
  labels.nodePanel.save
1613
2094
  ]
1614
2095
  }
1615
2096
  ),
1616
- !isStart && /* @__PURE__ */ jsx11(
2097
+ !isStart && /* @__PURE__ */ jsx13(
1617
2098
  "button",
1618
2099
  {
1619
2100
  onClick: () => {
@@ -1622,10 +2103,10 @@ function FlowNodePanel({
1622
2103
  "data-cv-tooltip": labels.nodePanel.delete,
1623
2104
  "aria-label": labels.nodePanel.delete,
1624
2105
  className: "px-3 py-2 text-sm text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-950/30 rounded-lg",
1625
- children: /* @__PURE__ */ jsx11(Trash2, { size: 14 })
2106
+ children: /* @__PURE__ */ jsx13(Trash22, { size: 14 })
1626
2107
  }
1627
2108
  ),
1628
- /* @__PURE__ */ jsx11("button", { "data-cv-tooltip": labels.nodePanel.cancel, "aria-label": labels.nodePanel.cancel, onClick: onClose, className: "px-4 py-2 text-sm text-gray-600 dark:text-gray-300 hover:underline", children: labels.nodePanel.cancel })
2109
+ /* @__PURE__ */ jsx13("button", { "data-cv-tooltip": labels.nodePanel.cancel, "aria-label": labels.nodePanel.cancel, onClick: onClose, className: "px-4 py-2 text-sm text-gray-600 dark:text-gray-300 hover:underline", children: labels.nodePanel.cancel })
1629
2110
  ] })
1630
2111
  ] });
1631
2112
  }
@@ -1642,7 +2123,7 @@ import {
1642
2123
  applyNodeChanges
1643
2124
  } from "@xyflow/react";
1644
2125
  import "@xyflow/react/dist/style.css";
1645
- import { Plus as Plus4, Trash2 as Trash22, LayoutGrid, AlertTriangle as AlertTriangle3, AlertCircle as AlertCircle3, Save as Save2, Undo2, Map as MapIcon, Workflow } from "lucide-react";
2126
+ import { Plus as Plus5, Trash2 as Trash23, LayoutGrid, AlertTriangle as AlertTriangle3, AlertCircle as AlertCircle3, Save as Save2, Undo2, Map as MapIcon, Workflow } from "lucide-react";
1646
2127
 
1647
2128
  // src/flows/flowEditorOps.ts
1648
2129
  var NAMESPACE_SEPARATOR = "::";
@@ -1708,11 +2189,24 @@ function applyConnection(node, resolved) {
1708
2189
  const currentNext = typeof node.next === "object" && node.next ? node.next : void 0;
1709
2190
  if (resolved.handle === "next") return { ...node, next: resolved.targetValue };
1710
2191
  if (resolved.handle === "__default") {
1711
- return { ...node, next: { byAnswer: currentNext?.byAnswer ?? {}, default: resolved.targetValue } };
2192
+ return { ...node, next: { ...currentNext, byAnswer: currentNext?.byAnswer ?? {}, default: resolved.targetValue } };
2193
+ }
2194
+ const keyword = keywordOfHandle(resolved.handle);
2195
+ if (keyword !== void 0) {
2196
+ return {
2197
+ ...node,
2198
+ next: {
2199
+ ...currentNext,
2200
+ byAnswer: currentNext?.byAnswer ?? {},
2201
+ byKeyword: { ...currentNext?.byKeyword ?? {}, [keyword]: resolved.targetValue },
2202
+ default: currentNext?.default ?? ""
2203
+ }
2204
+ };
1712
2205
  }
1713
2206
  return {
1714
2207
  ...node,
1715
2208
  next: {
2209
+ ...currentNext,
1716
2210
  byAnswer: { ...currentNext?.byAnswer ?? {}, [resolved.handle]: resolved.targetValue },
1717
2211
  default: currentNext?.default ?? ""
1718
2212
  }
@@ -1727,11 +2221,16 @@ function clearConnection(node, handle) {
1727
2221
  return { ...node, next: "" };
1728
2222
  }
1729
2223
  if (handle === "__default") {
1730
- return { ...node, next: { byAnswer: node.next.byAnswer ?? {}, default: "" } };
2224
+ return { ...node, next: { ...node.next, byAnswer: node.next.byAnswer ?? {}, default: "" } };
2225
+ }
2226
+ const keyword = keywordOfHandle(handle);
2227
+ if (keyword !== void 0) {
2228
+ return { ...node, next: { ...node.next, byKeyword: { ...node.next.byKeyword ?? {}, [keyword]: "" } } };
1731
2229
  }
1732
2230
  return {
1733
2231
  ...node,
1734
2232
  next: {
2233
+ ...node.next,
1735
2234
  byAnswer: { ...node.next.byAnswer ?? {}, [handle]: "" },
1736
2235
  default: node.next.default ?? ""
1737
2236
  }
@@ -1818,7 +2317,8 @@ function buildFlowEdges(params) {
1818
2317
  const liveCounts = countLiveByNode({ flowKey, rootFlowKey, positions: livePositions });
1819
2318
  for (const [nodeId, node] of Object.entries(graph.nodes)) {
1820
2319
  const live = (liveCounts[nodeId] ?? 0) > 0;
1821
- for (const { target, optionId, isDefault } of targetsOf(node)) {
2320
+ for (const { target, optionId: answerId, keyword, isDefault } of targetsOf(node)) {
2321
+ const optionId = keyword !== void 0 ? keywordHandle(keyword) : answerId;
1822
2322
  if (!target) continue;
1823
2323
  const crossFlow = isCrossFlowTarget(target);
1824
2324
  let targetFlowKey = flowKey;
@@ -1918,6 +2418,14 @@ function newNodeFromSpec(spec, existingIds) {
1918
2418
  const id2 = slugifyNodeId("nova_condicao", existingIds);
1919
2419
  return { id: id2, type: "condition", conditionOperator: ">" };
1920
2420
  }
2421
+ if (spec.kind === "dynamicChoice") {
2422
+ const id2 = slugifyNodeId("nova_escolha_dinamica", existingIds);
2423
+ return { id: id2, type: "dynamic_choice", contextKey: id2, question: "" };
2424
+ }
2425
+ if (spec.kind === "message") {
2426
+ const id2 = slugifyNodeId("nova_mensagem", existingIds);
2427
+ return { id: id2, type: "action", directMessage: "" };
2428
+ }
1921
2429
  const id = slugifyNodeId("nova_acao", existingIds);
1922
2430
  return { id, type: "action", actionKind: spec.actionKind };
1923
2431
  }
@@ -1935,7 +2443,7 @@ function findFreeSlot(params) {
1935
2443
  }
1936
2444
 
1937
2445
  // src/flows/FlowsWorkspace.tsx
1938
- import { Fragment as Fragment5, jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
2446
+ import { Fragment as Fragment6, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
1939
2447
  var RF_NODE_TYPES = {
1940
2448
  ...flowNodeTypes,
1941
2449
  ...flowPortalNodeTypes,
@@ -2534,17 +3042,17 @@ function FlowsWorkspace({
2534
3042
  const keyIsValid = FLOW_KEY_PATTERN.test(newFlow.key);
2535
3043
  const canCreateFlow = Boolean(api.createFlow);
2536
3044
  const canDeleteFlow = Boolean(api.deleteFlow) && primaryFlowKey !== rootFlowKey;
2537
- return /* @__PURE__ */ jsxs11("div", { className: `space-y-4 h-full flex flex-col ${className ?? ""}`, children: [
2538
- /* @__PURE__ */ jsx12(TooltipLayer, {}),
2539
- /* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between flex-wrap gap-3", children: [
2540
- showHeader && /* @__PURE__ */ jsxs11("div", { className: "min-w-0", children: [
2541
- /* @__PURE__ */ jsx12("h2", { className: "text-2xl font-bold text-gray-900 dark:text-gray-100", children: labels.workspace.title }),
2542
- /* @__PURE__ */ jsx12("p", { className: "text-gray-500 dark:text-gray-400 text-sm mt-1", children: labels.workspace.subtitle })
3045
+ return /* @__PURE__ */ jsxs13("div", { className: `space-y-4 h-full flex flex-col ${className ?? ""}`, children: [
3046
+ /* @__PURE__ */ jsx14(TooltipLayer, {}),
3047
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center justify-between flex-wrap gap-3", children: [
3048
+ showHeader && /* @__PURE__ */ jsxs13("div", { className: "min-w-0", children: [
3049
+ /* @__PURE__ */ jsx14("h2", { className: "text-2xl font-bold text-gray-900 dark:text-gray-100", children: labels.workspace.title }),
3050
+ /* @__PURE__ */ jsx14("p", { className: "text-gray-500 dark:text-gray-400 text-sm mt-1", children: labels.workspace.subtitle })
2543
3051
  ] }),
2544
- /* @__PURE__ */ jsxs11("div", { className: "flex flex-wrap items-center justify-end gap-3 ml-auto", children: [
2545
- saveState === "success" && /* @__PURE__ */ jsx12("span", { className: "text-sm text-green-600", children: labels.workspace.saveSuccess }),
2546
- saveState === "error" && /* @__PURE__ */ jsx12("span", { className: "text-sm text-red-600", children: saveErrorMessage ?? labels.workspace.saveError }),
2547
- /* @__PURE__ */ jsxs11(
3052
+ /* @__PURE__ */ jsxs13("div", { className: "flex flex-wrap items-center justify-end gap-3 ml-auto", children: [
3053
+ saveState === "success" && /* @__PURE__ */ jsx14("span", { className: "text-sm text-green-600", children: labels.workspace.saveSuccess }),
3054
+ saveState === "error" && /* @__PURE__ */ jsx14("span", { className: "text-sm text-red-600", children: saveErrorMessage ?? labels.workspace.saveError }),
3055
+ /* @__PURE__ */ jsxs13(
2548
3056
  "button",
2549
3057
  {
2550
3058
  "data-cv-tooltip": viewMode === "map" ? labels.flowMap.toggleToDetail : labels.flowMap.toggleToMap,
@@ -2553,13 +3061,13 @@ function FlowsWorkspace({
2553
3061
  onClick: () => setViewMode((mode) => mode === "map" ? "detail" : "map"),
2554
3062
  className: OUTLINE_BUTTON,
2555
3063
  children: [
2556
- viewMode === "map" ? /* @__PURE__ */ jsx12(Workflow, { size: 14, "aria-hidden": "true" }) : /* @__PURE__ */ jsx12(MapIcon, { size: 14, "aria-hidden": "true" }),
3064
+ viewMode === "map" ? /* @__PURE__ */ jsx14(Workflow, { size: 14, "aria-hidden": "true" }) : /* @__PURE__ */ jsx14(MapIcon, { size: 14, "aria-hidden": "true" }),
2557
3065
  viewMode === "map" ? labels.flowMap.toggleToDetail : labels.flowMap.toggleToMap
2558
3066
  ]
2559
3067
  }
2560
3068
  ),
2561
- viewMode === "detail" && /* @__PURE__ */ jsxs11(Fragment5, { children: [
2562
- /* @__PURE__ */ jsxs11(
3069
+ viewMode === "detail" && /* @__PURE__ */ jsxs13(Fragment6, { children: [
3070
+ /* @__PURE__ */ jsxs13(
2563
3071
  "button",
2564
3072
  {
2565
3073
  type: "button",
@@ -2569,13 +3077,13 @@ function FlowsWorkspace({
2569
3077
  "aria-label": labels.workspace.organizeTooltip,
2570
3078
  disabled: !primaryGraph,
2571
3079
  children: [
2572
- /* @__PURE__ */ jsx12(LayoutGrid, { size: 14, "aria-hidden": "true" }),
3080
+ /* @__PURE__ */ jsx14(LayoutGrid, { size: 14, "aria-hidden": "true" }),
2573
3081
  " ",
2574
3082
  labels.workspace.organize
2575
3083
  ]
2576
3084
  }
2577
3085
  ),
2578
- /* @__PURE__ */ jsxs11(
3086
+ /* @__PURE__ */ jsxs13(
2579
3087
  "button",
2580
3088
  {
2581
3089
  type: "button",
@@ -2585,13 +3093,13 @@ function FlowsWorkspace({
2585
3093
  "aria-label": labels.workspace.discardTooltip,
2586
3094
  disabled: !isDirty || saveState === "saving",
2587
3095
  children: [
2588
- /* @__PURE__ */ jsx12(Undo2, { size: 14, "aria-hidden": "true" }),
3096
+ /* @__PURE__ */ jsx14(Undo2, { size: 14, "aria-hidden": "true" }),
2589
3097
  " ",
2590
3098
  labels.workspace.discardChanges
2591
3099
  ]
2592
3100
  }
2593
3101
  ),
2594
- /* @__PURE__ */ jsxs11(
3102
+ /* @__PURE__ */ jsxs13(
2595
3103
  "button",
2596
3104
  {
2597
3105
  "data-cv-tooltip": labels.workspace.saveGraph,
@@ -2601,7 +3109,7 @@ function FlowsWorkspace({
2601
3109
  className: PRIMARY_BUTTON,
2602
3110
  disabled: !isDirty || errorCount > 0 || saveState === "saving",
2603
3111
  children: [
2604
- /* @__PURE__ */ jsx12(Save2, { size: 14, "aria-hidden": "true" }),
3112
+ /* @__PURE__ */ jsx14(Save2, { size: 14, "aria-hidden": "true" }),
2605
3113
  saveState === "saving" ? labels.workspace.saving : labels.workspace.saveGraph
2606
3114
  ]
2607
3115
  }
@@ -2609,9 +3117,9 @@ function FlowsWorkspace({
2609
3117
  ] })
2610
3118
  ] })
2611
3119
  ] }),
2612
- viewMode === "detail" && /* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between gap-2 flex-wrap", children: [
2613
- /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2 flex-wrap", children: [
2614
- graphs && Object.values(graphs).map((graph) => /* @__PURE__ */ jsx12(
3120
+ viewMode === "detail" && /* @__PURE__ */ jsxs13("div", { className: "flex items-center justify-between gap-2 flex-wrap", children: [
3121
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2 flex-wrap", children: [
3122
+ graphs && Object.values(graphs).map((graph) => /* @__PURE__ */ jsx14(
2615
3123
  "button",
2616
3124
  {
2617
3125
  "data-cv-tooltip": graph.label,
@@ -2623,7 +3131,7 @@ function FlowsWorkspace({
2623
3131
  },
2624
3132
  graph.key
2625
3133
  )),
2626
- canCreateFlow && /* @__PURE__ */ jsxs11(
3134
+ canCreateFlow && /* @__PURE__ */ jsxs13(
2627
3135
  "button",
2628
3136
  {
2629
3137
  "data-cv-tooltip": labels.flowManager.newFlow,
@@ -2635,15 +3143,15 @@ function FlowsWorkspace({
2635
3143
  },
2636
3144
  className: "inline-flex items-center gap-1 px-3 py-1.5 rounded-full text-xs font-medium border border-dashed border-gray-300 dark:border-gray-600 text-gray-500 dark:text-gray-400 hover:border-blue-400 hover:text-blue-600",
2637
3145
  children: [
2638
- /* @__PURE__ */ jsx12(Plus4, { size: 12, "aria-hidden": "true" }),
3146
+ /* @__PURE__ */ jsx14(Plus5, { size: 12, "aria-hidden": "true" }),
2639
3147
  " ",
2640
3148
  labels.flowManager.newFlow
2641
3149
  ]
2642
3150
  }
2643
3151
  )
2644
3152
  ] }),
2645
- /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
2646
- primaryGraph && /* @__PURE__ */ jsx12(
3153
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
3154
+ primaryGraph && /* @__PURE__ */ jsx14(
2647
3155
  FlowPalette,
2648
3156
  {
2649
3157
  onAdd: handleAddNode,
@@ -2651,7 +3159,7 @@ function FlowsWorkspace({
2651
3159
  ...actionOptions ? { actionOptions: [...actionOptions] } : {}
2652
3160
  }
2653
3161
  ),
2654
- primaryGraph && canDeleteFlow && /* @__PURE__ */ jsxs11(
3162
+ primaryGraph && canDeleteFlow && /* @__PURE__ */ jsxs13(
2655
3163
  "button",
2656
3164
  {
2657
3165
  "data-cv-tooltip": labels.flowManager.deleteFlow,
@@ -2663,7 +3171,7 @@ function FlowsWorkspace({
2663
3171
  },
2664
3172
  className: "inline-flex items-center gap-1.5 rounded-lg border border-red-200 dark:border-red-900 px-3 py-1.5 text-xs font-medium text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-950/30",
2665
3173
  children: [
2666
- /* @__PURE__ */ jsx12(Trash22, { size: 13, "aria-hidden": "true" }),
3174
+ /* @__PURE__ */ jsx14(Trash23, { size: 13, "aria-hidden": "true" }),
2667
3175
  " ",
2668
3176
  labels.flowManager.deleteFlow
2669
3177
  ]
@@ -2671,26 +3179,26 @@ function FlowsWorkspace({
2671
3179
  )
2672
3180
  ] })
2673
3181
  ] }),
2674
- viewMode === "detail" && (errorCount > 0 || warningCount > 0) && /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-4 rounded-lg border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/60 px-3 py-2 text-xs", children: [
2675
- /* @__PURE__ */ jsxs11("span", { className: "font-medium text-gray-600 dark:text-gray-300", children: [
3182
+ viewMode === "detail" && (errorCount > 0 || warningCount > 0) && /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-4 rounded-lg border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/60 px-3 py-2 text-xs", children: [
3183
+ /* @__PURE__ */ jsxs13("span", { className: "font-medium text-gray-600 dark:text-gray-300", children: [
2676
3184
  labels.validation.title,
2677
3185
  ":"
2678
3186
  ] }),
2679
- errorCount > 0 && /* @__PURE__ */ jsxs11("span", { className: "flex items-center gap-1 text-red-600 dark:text-red-400 font-medium", children: [
2680
- /* @__PURE__ */ jsx12(AlertCircle3, { size: 13, "aria-hidden": "true" }),
3187
+ errorCount > 0 && /* @__PURE__ */ jsxs13("span", { className: "flex items-center gap-1 text-red-600 dark:text-red-400 font-medium", children: [
3188
+ /* @__PURE__ */ jsx14(AlertCircle3, { size: 13, "aria-hidden": "true" }),
2681
3189
  " ",
2682
3190
  labels.validation.errors(errorCount)
2683
3191
  ] }),
2684
- warningCount > 0 && /* @__PURE__ */ jsxs11("span", { className: "flex items-center gap-1 text-amber-600 dark:text-amber-400", children: [
2685
- /* @__PURE__ */ jsx12(AlertTriangle3, { size: 13, "aria-hidden": "true" }),
3192
+ warningCount > 0 && /* @__PURE__ */ jsxs13("span", { className: "flex items-center gap-1 text-amber-600 dark:text-amber-400", children: [
3193
+ /* @__PURE__ */ jsx14(AlertTriangle3, { size: 13, "aria-hidden": "true" }),
2686
3194
  " ",
2687
3195
  labels.validation.warnings(warningCount)
2688
3196
  ] })
2689
3197
  ] }),
2690
- /* @__PURE__ */ jsxs11("div", { className: "flex-1 rounded-xl border border-gray-200 dark:border-gray-700 overflow-hidden relative", children: [
2691
- loadState === "loading" && /* @__PURE__ */ jsx12("p", { className: "text-center text-gray-400 py-12", children: labels.workspace.loading }),
2692
- loadState === "error" && /* @__PURE__ */ jsx12("p", { className: "text-center text-red-500 py-12", children: labels.workspace.loadError }),
2693
- loadState === "ready" && graphs && viewMode === "map" && /* @__PURE__ */ jsx12(
3198
+ /* @__PURE__ */ jsxs13("div", { className: "flex-1 rounded-xl border border-gray-200 dark:border-gray-700 overflow-hidden relative", children: [
3199
+ loadState === "loading" && /* @__PURE__ */ jsx14("p", { className: "text-center text-gray-400 py-12", children: labels.workspace.loading }),
3200
+ loadState === "error" && /* @__PURE__ */ jsx14("p", { className: "text-center text-red-500 py-12", children: labels.workspace.loadError }),
3201
+ loadState === "ready" && graphs && viewMode === "map" && /* @__PURE__ */ jsx14(
2694
3202
  FlowMapCanvas,
2695
3203
  {
2696
3204
  graphs,
@@ -2702,7 +3210,7 @@ function FlowsWorkspace({
2702
3210
  }
2703
3211
  }
2704
3212
  ),
2705
- loadState === "ready" && viewMode === "detail" && primaryGraph && /* @__PURE__ */ jsxs11(
3213
+ loadState === "ready" && viewMode === "detail" && primaryGraph && /* @__PURE__ */ jsxs13(
2706
3214
  ReactFlow2,
2707
3215
  {
2708
3216
  nodes: rfNodes,
@@ -2718,9 +3226,9 @@ function FlowsWorkspace({
2718
3226
  proOptions: { hideAttribution: true },
2719
3227
  colorMode: isDark ? "dark" : "light",
2720
3228
  children: [
2721
- /* @__PURE__ */ jsx12(Background2, { color: isDark ? BACKGROUND_COLOR_DARK2 : BACKGROUND_COLOR_LIGHT2 }),
2722
- /* @__PURE__ */ jsx12(Controls2, {}),
2723
- /* @__PURE__ */ jsx12(Panel, { position: "top-right", children: /* @__PURE__ */ jsx12(
3229
+ /* @__PURE__ */ jsx14(Background2, { color: isDark ? BACKGROUND_COLOR_DARK2 : BACKGROUND_COLOR_LIGHT2 }),
3230
+ /* @__PURE__ */ jsx14(Controls2, {}),
3231
+ /* @__PURE__ */ jsx14(Panel, { position: "top-right", children: /* @__PURE__ */ jsx14(
2724
3232
  FlowLegend,
2725
3233
  {
2726
3234
  labels,
@@ -2728,22 +3236,22 @@ function FlowsWorkspace({
2728
3236
  nodeSwatches: LEGEND_NODE_SWATCHES
2729
3237
  }
2730
3238
  ) }),
2731
- /* @__PURE__ */ jsx12(MiniMap, { pannable: true, zoomable: true, className: "!bg-white dark:!bg-gray-800" })
3239
+ /* @__PURE__ */ jsx14(MiniMap, { pannable: true, zoomable: true, className: "!bg-white dark:!bg-gray-800" })
2732
3240
  ]
2733
3241
  }
2734
3242
  )
2735
3243
  ] }),
2736
- quickAddFrom && /* @__PURE__ */ jsxs11(Fragment5, { children: [
2737
- /* @__PURE__ */ jsx12("div", { className: "fixed inset-0 z-40", onClick: () => setQuickAddFrom(null) }),
2738
- /* @__PURE__ */ jsxs11(
3244
+ quickAddFrom && /* @__PURE__ */ jsxs13(Fragment6, { children: [
3245
+ /* @__PURE__ */ jsx14("div", { className: "fixed inset-0 z-40", onClick: () => setQuickAddFrom(null) }),
3246
+ /* @__PURE__ */ jsxs13(
2739
3247
  "div",
2740
3248
  {
2741
3249
  ref: quickAddMenuRef,
2742
3250
  className: "fixed z-50 w-64 rounded-xl border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 shadow-lg py-1",
2743
3251
  style: quickAddMenuStyle,
2744
3252
  children: [
2745
- /* @__PURE__ */ jsx12("p", { className: "px-3 py-1.5 text-xs font-semibold uppercase tracking-wide text-gray-400 dark:text-gray-500", children: labels.quickAdd.title }),
2746
- /* @__PURE__ */ jsx12(
3253
+ /* @__PURE__ */ jsx14("p", { className: "px-3 py-1.5 text-xs font-semibold uppercase tracking-wide text-gray-400 dark:text-gray-500", children: labels.quickAdd.title }),
3254
+ /* @__PURE__ */ jsx14(
2747
3255
  FlowPaletteMenu,
2748
3256
  {
2749
3257
  onSelect: handleQuickAdd,
@@ -2755,7 +3263,7 @@ function FlowsWorkspace({
2755
3263
  }
2756
3264
  )
2757
3265
  ] }),
2758
- editingNode && editingGraph && /* @__PURE__ */ jsx12(
3266
+ editingNode && editingGraph && /* @__PURE__ */ jsx14(
2759
3267
  FlowNodePanel,
2760
3268
  {
2761
3269
  graph: editingGraph,
@@ -2770,11 +3278,11 @@ function FlowsWorkspace({
2770
3278
  },
2771
3279
  `${editingRef?.flowKey}:${editingRef?.nodeId}`
2772
3280
  ),
2773
- showCreateDialog && canCreateFlow && /* @__PURE__ */ jsxs11(FlowDialog, { title: labels.flowManager.createTitle, onClose: () => setShowCreateDialog(false), children: [
2774
- /* @__PURE__ */ jsxs11("div", { className: "space-y-3", children: [
2775
- /* @__PURE__ */ jsxs11("div", { children: [
2776
- /* @__PURE__ */ jsx12("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.flowManager.label }),
2777
- /* @__PURE__ */ jsx12(
3281
+ showCreateDialog && canCreateFlow && /* @__PURE__ */ jsxs13(FlowDialog, { title: labels.flowManager.createTitle, onClose: () => setShowCreateDialog(false), children: [
3282
+ /* @__PURE__ */ jsxs13("div", { className: "space-y-3", children: [
3283
+ /* @__PURE__ */ jsxs13("div", { children: [
3284
+ /* @__PURE__ */ jsx14("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.flowManager.label }),
3285
+ /* @__PURE__ */ jsx14(
2778
3286
  "input",
2779
3287
  {
2780
3288
  value: newFlow.label,
@@ -2783,9 +3291,9 @@ function FlowsWorkspace({
2783
3291
  }
2784
3292
  )
2785
3293
  ] }),
2786
- /* @__PURE__ */ jsxs11("div", { children: [
2787
- /* @__PURE__ */ jsx12("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.flowManager.key }),
2788
- /* @__PURE__ */ jsx12(
3294
+ /* @__PURE__ */ jsxs13("div", { children: [
3295
+ /* @__PURE__ */ jsx14("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.flowManager.key }),
3296
+ /* @__PURE__ */ jsx14(
2789
3297
  "input",
2790
3298
  {
2791
3299
  value: newFlow.key,
@@ -2793,10 +3301,10 @@ function FlowsWorkspace({
2793
3301
  className: `mt-1 ${DIALOG_INPUT}`
2794
3302
  }
2795
3303
  ),
2796
- /* @__PURE__ */ jsx12("p", { className: "text-[11px] text-gray-400 mt-1", children: newFlow.key && !keyIsValid ? labels.flowManager.keyInvalid : labels.flowManager.keyHint })
3304
+ /* @__PURE__ */ jsx14("p", { className: "text-[11px] text-gray-400 mt-1", children: newFlow.key && !keyIsValid ? labels.flowManager.keyInvalid : labels.flowManager.keyHint })
2797
3305
  ] }),
2798
- /* @__PURE__ */ jsxs11("label", { className: "flex items-center gap-2 text-sm text-gray-700 dark:text-gray-200", children: [
2799
- /* @__PURE__ */ jsx12(
3306
+ /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2 text-sm text-gray-700 dark:text-gray-200", children: [
3307
+ /* @__PURE__ */ jsx14(
2800
3308
  "input",
2801
3309
  {
2802
3310
  type: "checkbox",
@@ -2806,9 +3314,9 @@ function FlowsWorkspace({
2806
3314
  ),
2807
3315
  labels.flowManager.showInMenu
2808
3316
  ] }),
2809
- newFlow.showInMenu && /* @__PURE__ */ jsxs11("div", { children: [
2810
- /* @__PURE__ */ jsx12("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.flowManager.menuOptionLabel }),
2811
- /* @__PURE__ */ jsx12(
3317
+ newFlow.showInMenu && /* @__PURE__ */ jsxs13("div", { children: [
3318
+ /* @__PURE__ */ jsx14("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.flowManager.menuOptionLabel }),
3319
+ /* @__PURE__ */ jsx14(
2812
3320
  "input",
2813
3321
  {
2814
3322
  value: newFlow.menuOptionLabel,
@@ -2818,11 +3326,11 @@ function FlowsWorkspace({
2818
3326
  }
2819
3327
  )
2820
3328
  ] }),
2821
- flowMutationState.error && /* @__PURE__ */ jsx12("p", { className: "text-xs text-red-600", children: flowMutationState.error })
3329
+ flowMutationState.error && /* @__PURE__ */ jsx14("p", { className: "text-xs text-red-600", children: flowMutationState.error })
2822
3330
  ] }),
2823
- /* @__PURE__ */ jsxs11("div", { className: "flex justify-end gap-2 mt-4", children: [
2824
- /* @__PURE__ */ jsx12("button", { "data-cv-tooltip": labels.nodePanel.cancel, "aria-label": labels.nodePanel.cancel, type: "button", className: OUTLINE_BUTTON, onClick: () => setShowCreateDialog(false), children: labels.nodePanel.cancel }),
2825
- /* @__PURE__ */ jsx12(
3331
+ /* @__PURE__ */ jsxs13("div", { className: "flex justify-end gap-2 mt-4", children: [
3332
+ /* @__PURE__ */ jsx14("button", { "data-cv-tooltip": labels.nodePanel.cancel, "aria-label": labels.nodePanel.cancel, type: "button", className: OUTLINE_BUTTON, onClick: () => setShowCreateDialog(false), children: labels.nodePanel.cancel }),
3333
+ /* @__PURE__ */ jsx14(
2826
3334
  "button",
2827
3335
  {
2828
3336
  "data-cv-tooltip": labels.flowManager.create,
@@ -2836,12 +3344,12 @@ function FlowsWorkspace({
2836
3344
  )
2837
3345
  ] })
2838
3346
  ] }),
2839
- showDeleteDialog && canDeleteFlow && /* @__PURE__ */ jsxs11(FlowDialog, { title: labels.flowManager.deleteFlow, onClose: () => setShowDeleteDialog(false), children: [
2840
- /* @__PURE__ */ jsx12("p", { className: "text-sm text-gray-600 dark:text-gray-300", children: primaryGraph ? labels.flowManager.deleteConfirm(primaryGraph.label) : "" }),
2841
- flowMutationState.error && /* @__PURE__ */ jsx12("p", { className: "text-xs text-red-600 mt-2", children: flowMutationState.error }),
2842
- /* @__PURE__ */ jsxs11("div", { className: "flex justify-end gap-2 mt-4", children: [
2843
- /* @__PURE__ */ jsx12("button", { "data-cv-tooltip": labels.nodePanel.cancel, "aria-label": labels.nodePanel.cancel, type: "button", className: OUTLINE_BUTTON, onClick: () => setShowDeleteDialog(false), children: labels.nodePanel.cancel }),
2844
- /* @__PURE__ */ jsxs11(
3347
+ showDeleteDialog && canDeleteFlow && /* @__PURE__ */ jsxs13(FlowDialog, { title: labels.flowManager.deleteFlow, onClose: () => setShowDeleteDialog(false), children: [
3348
+ /* @__PURE__ */ jsx14("p", { className: "text-sm text-gray-600 dark:text-gray-300", children: primaryGraph ? labels.flowManager.deleteConfirm(primaryGraph.label) : "" }),
3349
+ flowMutationState.error && /* @__PURE__ */ jsx14("p", { className: "text-xs text-red-600 mt-2", children: flowMutationState.error }),
3350
+ /* @__PURE__ */ jsxs13("div", { className: "flex justify-end gap-2 mt-4", children: [
3351
+ /* @__PURE__ */ jsx14("button", { "data-cv-tooltip": labels.nodePanel.cancel, "aria-label": labels.nodePanel.cancel, type: "button", className: OUTLINE_BUTTON, onClick: () => setShowDeleteDialog(false), children: labels.nodePanel.cancel }),
3352
+ /* @__PURE__ */ jsxs13(
2845
3353
  "button",
2846
3354
  {
2847
3355
  "data-cv-tooltip": labels.flowManager.deleteFlow,
@@ -2851,7 +3359,7 @@ function FlowsWorkspace({
2851
3359
  onClick: () => void handleDeleteFlow(),
2852
3360
  disabled: flowMutationState.pending,
2853
3361
  children: [
2854
- /* @__PURE__ */ jsx12(Trash22, { size: 13, "aria-hidden": "true" }),
3362
+ /* @__PURE__ */ jsx14(Trash23, { size: 13, "aria-hidden": "true" }),
2855
3363
  " ",
2856
3364
  labels.flowManager.deleteFlow
2857
3365
  ]
@@ -2866,9 +3374,9 @@ function FlowDialog({
2866
3374
  onClose,
2867
3375
  children
2868
3376
  }) {
2869
- return /* @__PURE__ */ jsxs11("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/40 px-4", children: [
2870
- /* @__PURE__ */ jsx12("div", { className: "absolute inset-0", onClick: onClose, "aria-hidden": "true" }),
2871
- /* @__PURE__ */ jsxs11(
3377
+ return /* @__PURE__ */ jsxs13("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/40 px-4", children: [
3378
+ /* @__PURE__ */ jsx14("div", { className: "absolute inset-0", onClick: onClose, "aria-hidden": "true" }),
3379
+ /* @__PURE__ */ jsxs13(
2872
3380
  "div",
2873
3381
  {
2874
3382
  role: "dialog",
@@ -2876,7 +3384,7 @@ function FlowDialog({
2876
3384
  "aria-label": title,
2877
3385
  className: "relative w-full max-w-md rounded-2xl bg-white dark:bg-gray-800 p-5 shadow-xl",
2878
3386
  children: [
2879
- /* @__PURE__ */ jsx12("h3", { className: "text-base font-semibold text-gray-900 dark:text-gray-100 mb-3", children: title }),
3387
+ /* @__PURE__ */ jsx14("h3", { className: "text-base font-semibold text-gray-900 dark:text-gray-100 mb-3", children: title }),
2880
3388
  children
2881
3389
  ]
2882
3390
  }