@nyaruka/temba-components 0.136.0 → 0.136.1
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.
- package/CHANGELOG.md +9 -0
- package/dist/temba-components.js +242 -219
- package/dist/temba-components.js.map +1 -1
- package/out-tsc/src/display/FloatingTab.js +2 -6
- package/out-tsc/src/display/FloatingTab.js.map +1 -1
- package/out-tsc/src/flow/CanvasNode.js +18 -1
- package/out-tsc/src/flow/CanvasNode.js.map +1 -1
- package/out-tsc/src/flow/Editor.js +7 -5
- package/out-tsc/src/flow/Editor.js.map +1 -1
- package/out-tsc/src/layout/FloatingWindow.js.map +1 -1
- package/out-tsc/src/simulator/Simulator.js +46 -12
- package/out-tsc/src/simulator/Simulator.js.map +1 -1
- package/out-tsc/src/store/AppState.js +33 -0
- package/out-tsc/src/store/AppState.js.map +1 -1
- package/out-tsc/test/temba-appstate-node-sorting.test.js +430 -0
- package/out-tsc/test/temba-appstate-node-sorting.test.js.map +1 -0
- package/out-tsc/test/temba-floating-tab.test.js +0 -9
- package/out-tsc/test/temba-floating-tab.test.js.map +1 -1
- package/out-tsc/test/temba-flow-editor.test.js +261 -0
- package/out-tsc/test/temba-flow-editor.test.js.map +1 -1
- package/package.json +1 -1
- package/screenshots/truth/actions/add_contact_groups/render/descriptive-group-names.png +0 -0
- package/screenshots/truth/actions/add_contact_groups/render/long-group-names.png +0 -0
- package/screenshots/truth/actions/add_contact_groups/render/many-groups.png +0 -0
- package/screenshots/truth/actions/add_contact_groups/render/multiple-groups.png +0 -0
- package/screenshots/truth/actions/add_contact_groups/render/single-group.png +0 -0
- package/screenshots/truth/actions/add_contact_urn/render/expression-facebook.png +0 -0
- package/screenshots/truth/actions/add_contact_urn/render/expression-phone.png +0 -0
- package/screenshots/truth/actions/add_contact_urn/render/facebook-id.png +0 -0
- package/screenshots/truth/actions/add_contact_urn/render/instagram-handle.png +0 -0
- package/screenshots/truth/actions/add_contact_urn/render/line-id.png +0 -0
- package/screenshots/truth/actions/add_contact_urn/render/phone-number.png +0 -0
- package/screenshots/truth/actions/add_contact_urn/render/telegram-id.png +0 -0
- package/screenshots/truth/actions/add_contact_urn/render/viber-id.png +0 -0
- package/screenshots/truth/actions/add_contact_urn/render/wechat-id.png +0 -0
- package/screenshots/truth/actions/add_contact_urn/render/whatsapp.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/render/cleanup-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/render/long-descriptive-group-names.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/render/many-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/render/multiple-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/render/remove-from-all-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/render/single-group.png +0 -0
- package/screenshots/truth/actions/send_broadcast/render/contacts-only.png +0 -0
- package/screenshots/truth/actions/send_broadcast/render/groups-and-contacts.png +0 -0
- package/screenshots/truth/actions/send_broadcast/render/groups-only.png +0 -0
- package/screenshots/truth/actions/send_broadcast/render/many-groups.png +0 -0
- package/screenshots/truth/actions/send_broadcast/render/multiline-text.png +0 -0
- package/screenshots/truth/actions/send_email/render/complex-business-email.png +0 -0
- package/screenshots/truth/actions/send_email/render/empty-body.png +0 -0
- package/screenshots/truth/actions/send_email/render/empty-subject.png +0 -0
- package/screenshots/truth/actions/send_email/render/long-subject.png +0 -0
- package/screenshots/truth/actions/send_email/render/multiline-body.png +0 -0
- package/screenshots/truth/actions/send_email/render/multiple-recipients.png +0 -0
- package/screenshots/truth/actions/send_email/render/simple-email.png +0 -0
- package/screenshots/truth/actions/send_email/render/with-expressions.png +0 -0
- package/screenshots/truth/actions/send_msg/render/long-quick-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/render/multiline-text-with-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/render/simple-text.png +0 -0
- package/screenshots/truth/actions/send_msg/render/text-with-linebreaks.png +0 -0
- package/screenshots/truth/actions/send_msg/render/text-with-many-quick-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/render/text-with-quick-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/render/text-without-quick-replies.png +0 -0
- package/screenshots/truth/actions/start_session/render/contact-query.png +0 -0
- package/screenshots/truth/actions/start_session/render/contacts-only.png +0 -0
- package/screenshots/truth/actions/start_session/render/create-contact.png +0 -0
- package/screenshots/truth/actions/start_session/render/groups-and-contacts.png +0 -0
- package/screenshots/truth/actions/start_session/render/groups-only.png +0 -0
- package/screenshots/truth/actions/start_session/render/many-recipients.png +0 -0
- package/screenshots/truth/floating-tab/gray.png +0 -0
- package/screenshots/truth/floating-tab/green.png +0 -0
- package/screenshots/truth/floating-tab/purple.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/render/information-extraction.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/render/sentiment-analysis.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/render/summarization.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/render/translation-task.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/editor/feedback-categorization.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/render/basic-categorization.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/render/custom-input-and-result-name.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/render/feedback-categorization.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/render/many-categories.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/render/minimal-categories.png +0 -0
- package/screenshots/truth/nodes/split_by_random/render/ab-test-multiple-variants.png +0 -0
- package/screenshots/truth/nodes/split_by_random/render/sampling-split.png +0 -0
- package/screenshots/truth/nodes/split_by_random/render/three-way-split.png +0 -0
- package/screenshots/truth/nodes/split_by_random/render/two-bucket-split.png +0 -0
- package/screenshots/truth/nodes/wait_for_digits/render/basic-digits-wait.png +0 -0
- package/screenshots/truth/nodes/wait_for_digits/render/phone-number-collection.png +0 -0
- package/screenshots/truth/nodes/wait_for_digits/render/single-digit-with-timeout.png +0 -0
- package/screenshots/truth/nodes/wait_for_digits/render/verification-code.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/render/basic-wait.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/render/custom-result-name.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/render/no-timeout.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/render/short-timeout.png +0 -0
- package/src/display/FloatingTab.ts +2 -7
- package/src/flow/CanvasNode.ts +18 -1
- package/src/flow/Editor.ts +8 -5
- package/src/layout/FloatingWindow.ts +1 -1
- package/src/simulator/Simulator.ts +67 -14
- package/src/store/AppState.ts +56 -0
- package/test/temba-appstate-node-sorting.test.ts +506 -0
- package/test/temba-floating-tab.test.ts +0 -11
- package/test/temba-flow-editor.test.ts +297 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Editor.js","sourceRoot":"","sources":["../../../src/flow/Editor.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAkB,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,GAAG,EAAoB,SAAS,EAAE,MAAM,KAAK,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAQpD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAY,SAAS,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACvD,OAAO,EAAE,eAAe,EAAa,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;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AAE,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC;4CAC9B;AAGtB;IADP,SAAS,CAAC,OAAO,EAAE,CAAC,KAAe,EAAE,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC;6CAC7B;AAGxB;IADP,SAAS,CAAC,OAAO,EAAE,CAAC,KAAe,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC;yCAC3B;AAGtB;IADP,SAAS,CAAC,OAAO,EAAE,CAAC,KAAe,EAAE,EAAE,CAAC,KAAK,CAAC,kBAAkB,EAAE,CAAC;4CACzC;AAInB;IADP,KAAK,EAAE;0CACmB;AAUnB;IADP,KAAK,EAAE;+CAC6C;AAK7C;IADP,KAAK,EAAE;6CACuC;AAGvC;IADP,KAAK,EAAE;2CACoB;AAGpB;IADP,KAAK,EAAE;4CACyC;AAGzC;IADP,KAAK,EAAE;wCAC+B;AAG/B;IADP,KAAK,EAAE;wCAC+B;AAG/B;IADP,KAAK,EAAE;8CACqC;AAGrC;IADP,KAAK,EAAE;6CACqB;AAGrB;IADP,KAAK,EAAE;wDACgC;AAGhC;IADP,KAAK,EAAE;kDAGN;AAGM;IADP,KAAK,EAAE;2DACoC;AAGpC;IADP,KAAK,EAAE;uDACgC;AAGhC;IADP,KAAK,EAAE;+CACwB;AAGxB;IADP,KAAK,EAAE;kDACmD;AAGnD;IADP,KAAK,EAAE;kDACyC;AAMzC;IADP,KAAK,EAAE;2CACgC;AAGhC;IADP,KAAK,EAAE;6CACoC;AAGpC;IADP,KAAK,EAAE;6CACoC;AAGpC;IADP,KAAK,EAAE;iDAC0B;AAG1B;IADP,KAAK,EAAE;mDACgD;AAIhD;IADP,KAAK,EAAE;iDAOQ;AAER;IADP,KAAK,EAAE;mDAC0C;AAI1C;IADP,KAAK,EAAE;wDAC+C","sourcesContent":["import { html, TemplateResult } from 'lit-html';\nimport { css, PropertyValueMap, unsafeCSS } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport {\n FlowDefinition,\n FlowPosition,\n Action,\n Node,\n NodeUI\n} from '../store/flow-definition';\nimport { getStore } from '../store/Store';\nimport { AppState, fromStore, zustand } from '../store/AppState';\nimport { RapidElement } from '../RapidElement';\nimport { repeat } from 'lit-html/directives/repeat.js';\nimport { CustomEventType, Workspace } from '../interfaces';\nimport { generateUUID, postJSON } from '../utils';\nimport { ACTION_CONFIG, NODE_CONFIG } from './config';\nimport { ACTION_GROUP_METADATA } from './types';\nimport { Checkbox } from '../form/Checkbox';\n\nimport { Plumber } from './Plumber';\nimport { CanvasNode } from './CanvasNode';\nimport { Dialog } from '../layout/Dialog';\nimport { Connection } from '@jsplumb/browser-ui';\nimport { CanvasMenu, CanvasMenuSelection } from './CanvasMenu';\nimport { NodeTypeSelector, NodeTypeSelection } from './NodeTypeSelector';\nimport {\n getNodeBounds,\n calculateReflowPositions,\n NodeBounds,\n nodesOverlap\n} from './utils';\n\nexport function snapToGrid(value: number): number {\n const snapped = Math.round(value / 20) * 20;\n return Math.max(snapped, 0);\n}\n\nexport function findNodeForExit(\n definition: FlowDefinition,\n exitUuid: string\n): string | null {\n for (const node of definition.nodes) {\n const exit = node.exits.find((e) => e.uuid === exitUuid);\n if (exit) {\n return node.uuid;\n }\n }\n return null;\n}\n\nconst SAVE_QUIET_TIME = 500;\n\nexport interface DraggableItem {\n uuid: string;\n position: FlowPosition;\n element: HTMLElement;\n type: 'node' | 'sticky';\n}\n\nexport interface SelectionBox {\n startX: number;\n startY: number;\n endX: number;\n endY: number;\n}\n\nconst DRAG_THRESHOLD = 5;\n\ntype TranslationType = 'property' | 'category';\n\ninterface TranslationEntry {\n uuid: string;\n type: TranslationType;\n attribute: string;\n from: string;\n to: string | null;\n}\n\ninterface TranslationBundle {\n nodeUuid: string;\n actionUuid?: string;\n translations: TranslationEntry[];\n}\n\ninterface TranslationModel {\n uuid: string;\n name: string;\n description?: string;\n}\n\ninterface LocalizationUpdate {\n uuid: string;\n translations: Record<string, string>;\n}\n\nconst AUTO_TRANSLATE_MODELS_ENDPOINT = '/api/internal/llms.json';\n\n// Offset for positioning dropped action node relative to mouse cursor\n// Keep small to make drop location close to cursor position\nconst DROP_PREVIEW_OFFSET_X = 20;\nconst DROP_PREVIEW_OFFSET_Y = 20;\n\nexport class Editor extends RapidElement {\n // unfortunately, jsplumb requires that we be in light DOM\n createRenderRoot() {\n return this;\n }\n\n // this is the master plumber\n private plumber: Plumber;\n\n // timer for debounced saving\n private saveTimer: number | null = null;\n\n @property({ type: String })\n public flow: string;\n\n @property({ type: String })\n public version: string;\n\n @property({ type: String })\n public flowType: string = 'message';\n\n @property({ type: Array })\n public features: string[] = [];\n\n private activityTimer: number | null = null;\n private activityInterval = 100; // Start with 100ms interval for fast initial load\n\n @fromStore(zustand, (state: AppState) => state.flowDefinition)\n private definition!: FlowDefinition;\n\n @fromStore(zustand, (state: AppState) => state.simulatorActive)\n private simulatorActive!: boolean;\n\n @fromStore(zustand, (state: AppState) => state.canvasSize)\n private canvasSize!: { width: number; height: number };\n\n @fromStore(zustand, (state: AppState) => state.dirtyDate)\n private dirtyDate!: Date;\n\n @fromStore(zustand, (state: AppState) => state.languageCode)\n private languageCode!: string;\n\n @fromStore(zustand, (state: AppState) => state.isTranslating)\n private isTranslating!: boolean;\n\n @fromStore(zustand, (state: AppState) => state.workspace)\n private workspace!: Workspace;\n\n @fromStore(zustand, (state: AppState) => state.getCurrentActivity())\n private activityData!: any;\n\n // Drag state\n @state()\n private isDragging = false;\n private isMouseDown = false;\n private dragStartPos = { x: 0, y: 0 };\n\n // Public getter for drag state\n public get dragging(): boolean {\n return this.isDragging;\n }\n\n @state()\n private currentDragItem: DraggableItem | null = null;\n private startPos = { left: 0, top: 0 };\n\n // Selection state\n @state()\n private selectedItems: Set<string> = new Set();\n\n @state()\n private isSelecting = false;\n\n @state()\n private selectionBox: SelectionBox | null = null;\n\n @state()\n private targetId: string | null = null;\n\n @state()\n private sourceId: string | null = null;\n\n @state()\n private dragFromNodeId: string | null = null;\n\n @state()\n private isValidTarget = true;\n\n @state()\n private localizationWindowHidden = true;\n\n @state()\n private translationFilters: { categories: boolean } = {\n categories: false\n };\n\n @state()\n private translationSettingsExpanded = false;\n\n @state()\n private autoTranslateDialogOpen = false;\n\n @state()\n private autoTranslating = false;\n\n @state()\n private autoTranslateModel: TranslationModel | null = null;\n\n @state()\n private autoTranslateError: string | null = null;\n\n private translationCache = new Map<string, string>();\n\n // NodeEditor state - handles both node and action editing\n @state()\n private editingNode: Node | null = null;\n\n @state()\n private editingNodeUI: NodeUI | null = null;\n\n @state()\n private editingAction: Action | null = null;\n\n @state()\n private isCreatingNewNode = false;\n\n @state()\n private pendingNodePosition: FlowPosition | null = null;\n\n // Canvas drop state for dragging actions to canvas\n @state()\n private canvasDropPreview: {\n action: Action;\n nodeUuid: string;\n actionIndex: number;\n position: FlowPosition;\n actionHeight: number;\n } | null = null;\n @state()\n private addActionToNodeUuid: string | null = null;\n\n // Track target node for action drag\n @state()\n private actionDragTargetNodeUuid: string | null = null;\n\n // Track previous target node to clear placeholder when moving between nodes\n private previousActionDragTargetNodeUuid: string | null = null;\n\n private canvasMouseDown = false;\n\n private getAvailableLanguages(): Array<{ code: string; name: string }> {\n // Use languages from workspace if available\n if (this.workspace?.languages && this.workspace.languages.length > 0) {\n const languageNames = new Intl.DisplayNames(['en'], { type: 'language' });\n return this.workspace.languages\n .map((code) => {\n try {\n const name = languageNames.of(code);\n return name ? { code, name } : { code, name: code };\n } catch {\n return { code, name: code };\n }\n })\n .filter((lang) => lang.code && lang.name);\n }\n\n // Fall back to flow definition languages if available\n if (\n this.definition?._ui?.languages &&\n this.definition._ui.languages.length > 0\n ) {\n return this.definition._ui.languages.map((lang: any) => ({\n code: typeof lang === 'string' ? lang : lang.iso || lang.code,\n name: typeof lang === 'string' ? lang : lang.name\n }));\n }\n\n // No languages available\n return [];\n }\n\n // Bound event handlers to maintain proper 'this' context\n private boundMouseMove = this.handleMouseMove.bind(this);\n private boundMouseUp = this.handleMouseUp.bind(this);\n private boundGlobalMouseDown = this.handleGlobalMouseDown.bind(this);\n private boundKeyDown = this.handleKeyDown.bind(this);\n private boundCanvasContextMenu = this.handleCanvasContextMenu.bind(this);\n\n static get styles() {\n return css`\n #editor {\n overflow: scroll;\n flex: 1;\n -webkit-font-smoothing: antialiased;\n }\n\n #grid {\n position: relative;\n background-color: #f9f9f9;\n background-image: radial-gradient(\n circle,\n rgba(61, 177, 255, 0.3) 1px,\n transparent 1px\n );\n background-size: 20px 20px;\n background-position: 10px 10px;\n width: 100%;\n display: flex;\n }\n\n #canvas {\n position: relative;\n padding: 0px;\n flex-grow: 1;\n margin: 20px;\n }\n\n #canvas > .draggable {\n position: absolute;\n z-index: 100;\n }\n\n #canvas > .dragging {\n z-index: 99999 !important;\n transition: none !important;\n }\n\n body .jtk-endpoint {\n width: initial;\n height: initial;\n }\n\n .jtk-endpoint {\n z-index: 600;\n opacity: 0;\n }\n\n .plumb-source {\n z-index: 600;\n cursor: pointer;\n opacity: 0;\n }\n\n .plumb-source.connected {\n border-radius: 50%;\n pointer-events: none;\n }\n\n .plumb-source circle {\n fill: purple;\n }\n\n .plumb-target {\n z-index: 600;\n opacity: 0;\n cursor: pointer;\n fill: transparent;\n }\n\n body svg.jtk-connector.plumb-connector path {\n stroke: var(--color-connectors) !important;\n stroke-width: 3px;\n }\n\n body .plumb-connector {\n z-index: 10 !important;\n }\n\n body .plumb-connector .plumb-arrow {\n fill: var(--color-connectors);\n stroke: var(--color-connectors);\n stroke-width: 0px !important;\n margin-top: 6px;\n z-index: 10;\n }\n\n body svg.jtk-connector.jtk-hover path {\n stroke: var(--color-success) !important;\n stroke-width: 3px;\n }\n\n body .plumb-connector.jtk-hover .plumb-arrow {\n fill: var(--color-success) !important;\n stroke-width: 0px;\n z-index: 10;\n }\n\n /* Activity overlays on connections */\n .jtk-overlay.activity-overlay {\n background: #f3f3f3;\n border: 1px solid #d9d9d9;\n color: #333;\n border-radius: 4px;\n padding: 2px 4px;\n font-size: 10px;\n font-weight: 600;\n line-height: 0.9;\n cursor: pointer;\n z-index: 500;\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);\n }\n\n /* Active contact count on nodes */\n .active-count {\n position: absolute;\n background: var(--color-primary-dark, #3498db);\n border: 1px solid var(--color-primary-darker, #2980b9);\n border-radius: 12px;\n padding: 3px 5px;\n color: #fff;\n font-weight: 500;\n top: -10px;\n left: -10px;\n font-size: 13px;\n min-width: 22px;\n text-align: center;\n z-index: 600;\n line-height: 1;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);\n }\n\n /* Recent contacts popup */\n @keyframes popupBounceIn {\n 0% {\n transform: scale(0.8);\n opacity: 0;\n }\n 50% {\n transform: scale(1.05);\n }\n 100% {\n transform: scale(1);\n opacity: 1;\n }\n }\n\n .recent-contacts-popup {\n display: none;\n position: absolute;\n width: 200px;\n background: #f3f3f3;\n border-radius: 10px;\n box-shadow: 0 1px 3px 1px rgba(130, 130, 130, 0.2);\n z-index: 1015;\n transform-origin: top center;\n }\n\n .recent-contacts-popup.show {\n display: block;\n animation: popupBounceIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);\n }\n\n .recent-contacts-popup .popup-title {\n background: #999;\n color: #fff;\n padding: 6px 0;\n text-align: center;\n border-top-left-radius: 10px;\n border-top-right-radius: 10px;\n font-size: 12px;\n }\n\n .recent-contacts-popup .no-contacts-message {\n padding: 15px;\n text-align: center;\n color: #999;\n font-size: 12px;\n }\n\n .recent-contacts-popup .contact-row {\n padding: 8px 10px;\n border-top: 1px solid #e0e0e0;\n text-align: left;\n }\n\n .recent-contacts-popup .contact-row:last-child {\n border-bottom-left-radius: 10px;\n border-bottom-right-radius: 10px;\n }\n\n .recent-contacts-popup .contact-name {\n display: block;\n font-weight: 500;\n font-size: 12px;\n color: var(--color-link-primary, #1d4ed8);\n cursor: pointer;\n }\n\n .recent-contacts-popup .contact-name:hover {\n text-decoration: underline;\n color: var(--color-link-primary, #1d4ed8);\n }\n\n .recent-contacts-popup .contact-operand {\n padding-top: 3px;\n font-size: 11px;\n color: #666;\n word-wrap: break-word;\n }\n\n .recent-contacts-popup .contact-time {\n padding-top: 3px;\n font-size: 10px;\n color: #999;\n }\n\n /* Connection dragging feedback */\n body svg.jtk-connector.jtk-dragging {\n z-index: 99999 !important;\n }\n\n .katavorio-drag-no-select svg.jtk-connector path,\n .katavorio-drag-no-select svg.jtk-endpoint path {\n pointer-events: none !important;\n border: 1px solid purple;\n }\n\n /* Connection target feedback */\n temba-flow-node.connection-target-valid {\n outline: 3px solid var(--color-success, #22c55e) !important;\n outline-offset: 2px;\n border-radius: var(--curvature);\n }\n\n temba-flow-node.connection-target-invalid {\n outline: 3px solid var(--color-error, #ef4444) !important;\n outline-offset: 2px;\n border-radius: var(--curvature);\n }\n\n /* Selection box styles */\n .selection-box {\n position: absolute;\n border: 2px dashed #6298f0ff;\n background-color: rgba(59, 130, 246, 0.1);\n z-index: 9999;\n pointer-events: none;\n }\n\n /* Selected item styles */\n .draggable.selected {\n outline: 3px solid #6298f0ff;\n outline-offset: 0px;\n border-radius: var(--curvature);\n }\n\n .jtk-floating-endpoint {\n pointer-events: none;\n }\n\n .localization-window-content {\n display: flex;\n flex-direction: column;\n gap: 16px;\n height: 100%;\n }\n\n .localization-header {\n font-size: 13px;\n color: #4b5563;\n line-height: 1.4;\n }\n\n .localization-language-select {\n --color-widget-border: #d1d5db;\n --color-widget-background: #fff;\n }\n\n .localization-language-row {\n display: flex;\n align-items: flex-end;\n gap: 12px;\n }\n\n .localization-language-row temba-select {\n flex: 1;\n }\n\n .localization-progress {\n margin-top: auto;\n display: flex;\n flex-direction: column;\n gap: 8px;\n }\n\n .localization-progress-bar-row {\n display: flex;\n align-items: center;\n gap: 8px;\n }\n\n .localization-progress-trigger {\n flex: 1;\n border-radius: 6px;\n cursor: pointer;\n display: flex;\n align-items: center;\n }\n\n .localization-progress-trigger:focus-visible {\n outline: 2px solid #94a3b8;\n outline-offset: 2px;\n }\n\n .localization-progress-trigger temba-progress {\n flex: 1;\n }\n\n .localization-progress h5 {\n margin: 0;\n font-size: 13px;\n font-weight: 600;\n color: #374151;\n }\n\n .localization-progress-summary {\n font-size: 12px;\n color: #6b7280;\n display: flex;\n align-items: center;\n gap: 6px;\n min-height: 20px;\n }\n\n .translation-settings-toggle {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n background: transparent;\n border: none;\n color: #6b7280;\n font-size: 12px;\n font-weight: 600;\n cursor: pointer;\n padding: 4px;\n border-radius: 4px;\n }\n\n .translation-settings-label {\n font-size: 12px;\n color: #6b7280;\n }\n\n .translation-settings-toggle:focus-visible {\n outline: 2px solid #94a3b8;\n outline-offset: 2px;\n }\n\n .translation-settings-arrow {\n width: 8px;\n height: 8px;\n border-right: 2px solid currentColor;\n border-bottom: 2px solid currentColor;\n transform: rotate(-45deg);\n transition: transform 0.2s ease;\n margin-left: 2px;\n }\n\n .translation-settings-arrow.expanded {\n transform: rotate(45deg);\n }\n\n .translation-settings {\n }\n\n .translation-settings-row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n }\n\n .translation-settings-row temba-checkbox {\n width: 100%;\n }\n\n .auto-translate-button {\n background: var(--color-primary-dark);\n border: none;\n color: #fff;\n padding: 10px 12px;\n border-radius: var(--curvature);\n font-size: 12px;\n font-weight: 600;\n cursor: pointer;\n transition: opacity 0.2s ease;\n }\n\n .auto-translate-button[disabled] {\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n .auto-translate-error {\n font-size: 12px;\n color: #b91c1c;\n }\n\n .auto-translate-dialog-content {\n padding: 20px;\n display: flex;\n flex-direction: column;\n gap: 12px;\n font-size: 14px;\n color: #374151;\n }\n\n .auto-translate-dialog-content p {\n margin: 0;\n }\n\n .auto-translate-loading {\n display: flex;\n align-items: center;\n gap: 8px;\n font-size: 13px;\n color: #6b7280;\n }\n\n .auto-translate-empty {\n font-size: 13px;\n color: #6b7280;\n }\n\n .localization-empty {\n font-size: 13px;\n color: #9ca3af;\n white-space: nowrap;\n }\n `;\n }\n\n constructor() {\n super();\n }\n\n protected firstUpdated(\n changes: PropertyValueMap<any> | Map<PropertyKey, unknown>\n ): void {\n super.firstUpdated(changes);\n this.plumber = new Plumber(this.querySelector('#canvas'), this);\n this.setupGlobalEventListeners();\n if (changes.has('flow')) {\n getStore().getState().fetchRevision(`/flow/revisions/${this.flow}`);\n }\n\n this.plumber.on('connection:drag', (info: Connection) => {\n this.dragFromNodeId = document\n .getElementById(info.sourceId)\n .closest('.node').id;\n this.sourceId = info.sourceId;\n });\n\n this.plumber.on('connection:abort', () => {\n this.makeConnection();\n });\n\n this.plumber.on('connection:detach', () => {\n this.makeConnection();\n });\n }\n\n private makeConnection() {\n if (this.sourceId && this.targetId && this.isValidTarget) {\n this.plumber.connectIds(\n this.dragFromNodeId,\n this.sourceId,\n this.targetId\n );\n getStore()\n .getState()\n .updateConnection(this.dragFromNodeId, this.sourceId, this.targetId);\n\n setTimeout(() => {\n this.plumber.repaintEverything();\n }, 100);\n }\n\n // Clean up visual feedback\n document.querySelectorAll('temba-flow-node').forEach((node) => {\n node.classList.remove(\n 'connection-target-valid',\n 'connection-target-invalid'\n );\n });\n\n this.sourceId = null;\n this.targetId = null;\n this.dragFromNodeId = null;\n this.isValidTarget = true;\n }\n\n protected updated(\n changes: PropertyValueMap<any> | Map<PropertyKey, unknown>\n ): void {\n super.updated(changes);\n if (changes.has('canvasSize')) {\n // console.log('Setting canvas size', this.canvasSize);\n }\n\n if (changes.has('definition')) {\n this.updateCanvasSize();\n\n // Set flowType from the loaded definition\n if (this.definition?.type) {\n this.flowType = this.getFlowTypeFromDefinition(this.definition.type);\n }\n\n const filters = this.definition?._ui?.translation_filters || {\n categories: false\n };\n const normalizedFilters = {\n categories: !!filters.categories\n };\n\n if (this.translationFilters.categories !== normalizedFilters.categories) {\n this.translationFilters = normalizedFilters;\n }\n\n this.translationCache.clear();\n\n // Start fetching activity data when definition is loaded\n if (this.definition?.uuid) {\n this.startActivityFetching();\n }\n }\n\n if (changes.has('simulatorActive')) {\n if (this.simulatorActive) {\n // Stop polling when simulator becomes active\n this.stopActivityFetching();\n } else {\n // Resume polling and refresh activity when simulator closes\n this.activityInterval = 100; // Reset to fast initial interval\n this.startActivityFetching();\n }\n }\n\n if (changes.has('activityData')) {\n // Update plumber with new activity data\n if (this.plumber) {\n this.plumber.setActivityData(this.activityData);\n }\n }\n\n if (changes.has('dirtyDate')) {\n if (this.dirtyDate) {\n this.debouncedSave();\n }\n }\n\n if (changes.has('languageCode')) {\n this.translationCache.clear();\n }\n }\n\n /**\n * Map FlowDefinition type to Editor flowType\n * FlowDefinition uses: 'messaging', 'messaging_background', 'messaging_offline', 'voice'\n * Editor uses: 'message', 'voice', 'background'\n */\n private getFlowTypeFromDefinition(definitionType: string): string {\n if (definitionType === 'voice') {\n return 'voice';\n } else if (\n definitionType === 'messaging_background' ||\n definitionType === 'messaging_offline'\n ) {\n return 'background';\n } else {\n // 'messaging' or any other messaging type defaults to 'message'\n return 'message';\n }\n }\n\n private debouncedSave(): void {\n // Clear any existing timer\n if (this.saveTimer !== null) {\n clearTimeout(this.saveTimer);\n }\n\n this.saveTimer = window.setTimeout(() => {\n const now = new Date();\n const timeSinceLastChange = now.getTime() - this.dirtyDate.getTime();\n\n if (timeSinceLastChange >= SAVE_QUIET_TIME) {\n this.saveChanges();\n this.saveTimer = null;\n } else {\n this.debouncedSave();\n }\n }, SAVE_QUIET_TIME);\n }\n\n private saveChanges(): void {\n // post the flow definition to the server\n getStore()\n .postJSON(`/flow/revisions/${this.flow}/`, this.definition)\n .then((response) => {\n // Update flow info and revision with the response data\n if (response.json) {\n const state = getStore().getState();\n\n if (response.json.info) {\n state.setFlowInfo(response.json.info);\n }\n\n if (response.json.revision?.revision !== undefined) {\n state.setRevision(response.json.revision.revision);\n }\n }\n })\n .catch((error) => {\n console.error('Failed to save flow:', error);\n });\n\n getStore().getState().setDirtyDate(null);\n }\n\n private startActivityFetching(): void {\n // Don't start if simulator is active\n if (this.simulatorActive) {\n return;\n }\n // Fetch immediately\n this.fetchActivityData();\n }\n\n private stopActivityFetching(): void {\n if (this.activityTimer !== null) {\n clearTimeout(this.activityTimer);\n this.activityTimer = null;\n }\n }\n\n private fetchActivityData(): void {\n if (!this.definition?.uuid) {\n return;\n }\n\n // Don't fetch if simulator is active\n if (this.simulatorActive) {\n return;\n }\n\n const activityEndpoint = `/flow/activity/${this.definition.uuid}/`;\n const store = getStore();\n if (!store) {\n return;\n }\n const state = store.getState();\n state.fetchActivity(activityEndpoint).then(() => {\n // Schedule next fetch with exponential backoff (max 5 minutes)\n this.activityInterval = Math.min(60000 * 5, this.activityInterval + 100);\n\n if (this.activityTimer !== null) {\n clearTimeout(this.activityTimer);\n }\n\n this.activityTimer = window.setTimeout(() => {\n this.fetchActivityData();\n }, this.activityInterval);\n });\n }\n\n private handleLanguageChange(languageCode: string): void {\n zustand.getState().setLanguageCode(languageCode);\n\n // Repaint connections after language change since node sizes can change\n if (this.plumber) {\n requestAnimationFrame(() => {\n this.plumber.repaintEverything();\n });\n }\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n if (this.saveTimer !== null) {\n clearTimeout(this.saveTimer);\n this.saveTimer = null;\n }\n if (this.activityTimer !== null) {\n clearTimeout(this.activityTimer);\n this.activityTimer = null;\n }\n document.removeEventListener('mousemove', this.boundMouseMove);\n document.removeEventListener('mouseup', this.boundMouseUp);\n document.removeEventListener('mousedown', this.boundGlobalMouseDown);\n document.removeEventListener('keydown', this.boundKeyDown);\n\n const canvas = this.querySelector('#canvas');\n if (canvas) {\n canvas.removeEventListener('contextmenu', this.boundCanvasContextMenu);\n }\n }\n\n private setupGlobalEventListeners(): void {\n document.addEventListener('mousemove', this.boundMouseMove);\n document.addEventListener('mouseup', this.boundMouseUp);\n document.addEventListener('mousedown', this.boundGlobalMouseDown);\n document.addEventListener('keydown', this.boundKeyDown);\n\n const canvas = this.querySelector('#canvas');\n if (canvas) {\n canvas.addEventListener('contextmenu', this.boundCanvasContextMenu);\n }\n\n // Listen for action edit requests from flow nodes\n this.addEventListener(\n CustomEventType.ActionEditRequested,\n this.handleActionEditRequested.bind(this)\n );\n\n // Listen for add action requests from flow nodes\n this.addEventListener(\n CustomEventType.AddActionRequested,\n this.handleAddActionRequested.bind(this)\n );\n\n // Listen for node edit requests from flow nodes\n this.addEventListener(\n CustomEventType.NodeEditRequested,\n this.handleNodeEditRequested.bind(this)\n );\n\n // Listen for node deletion events\n this.addEventListener(\n CustomEventType.NodeDeleted,\n this.handleNodeDeleted.bind(this)\n );\n\n // Listen for canvas menu selections\n this.addEventListener(CustomEventType.Selection, (event: CustomEvent) => {\n const target = event.target as HTMLElement;\n if (target.tagName === 'TEMBA-CANVAS-MENU') {\n this.handleCanvasMenuSelection(event);\n } else if (target.tagName === 'TEMBA-NODE-TYPE-SELECTOR') {\n this.handleNodeTypeSelection(event);\n }\n });\n\n // Listen for action drag events from nodes\n this.addEventListener(\n CustomEventType.DragExternal,\n this.handleActionDragExternal.bind(this)\n );\n\n this.addEventListener(\n CustomEventType.DragInternal,\n this.handleActionDragInternal.bind(this)\n );\n\n this.addEventListener(CustomEventType.DragStop, (event: CustomEvent) => {\n if (event.detail.isExternal) {\n this.handleActionDropExternal(event);\n }\n });\n }\n\n private getPosition(uuid: string, type: 'node' | 'sticky'): FlowPosition {\n if (type === 'node') {\n return this.definition._ui.nodes[uuid]?.position;\n } else {\n return this.definition._ui.stickies?.[uuid]?.position;\n }\n }\n\n private handleMouseDown(event: MouseEvent): void {\n // ignore right clicks\n if (event.button !== 0) return;\n\n const element = event.currentTarget as HTMLElement;\n // Only start dragging if clicking on the element itself, not on exits or other interactive elements\n const target = event.target as HTMLElement;\n if (target.classList.contains('exit') || target.closest('.exit')) {\n return;\n }\n\n const uuid = element.getAttribute('uuid');\n const type = element.tagName === 'TEMBA-FLOW-NODE' ? 'node' : 'sticky';\n\n const position = this.getPosition(uuid, type);\n if (!position) return;\n\n // If clicking on a non-selected item, clear selection unless Ctrl/Cmd is held\n if (!this.selectedItems.has(uuid) && !event.ctrlKey && !event.metaKey) {\n this.selectedItems.clear();\n // Don't add single items to selection - single clicks just clear existing selection\n } else if (!this.selectedItems.has(uuid)) {\n // Add this item to selection only if Ctrl/Cmd is held\n this.selectedItems.add(uuid);\n }\n\n // Always set up drag state regardless of selection status\n // This allows single nodes to be dragged without being selected\n this.isMouseDown = true;\n this.dragStartPos = { x: event.clientX, y: event.clientY };\n this.startPos = { left: position.left, top: position.top };\n this.currentDragItem = {\n uuid,\n position,\n element,\n type\n };\n\n event.preventDefault();\n event.stopPropagation();\n }\n\n private handleGlobalMouseDown(event: MouseEvent): void {\n // ignore right clicks\n if (event.button !== 0) return;\n\n // Check if the click is within our canvas\n const canvasRect = this.querySelector('#grid')?.getBoundingClientRect();\n\n if (!canvasRect) return;\n\n const isWithinCanvas =\n event.clientX >= canvasRect.left &&\n event.clientX <= canvasRect.right &&\n event.clientY >= canvasRect.top &&\n event.clientY <= canvasRect.bottom;\n\n if (!isWithinCanvas) return;\n\n // Check if we clicked on a draggable item (node or sticky)\n const target = event.target as HTMLElement;\n const clickedOnDraggable = target.closest('.draggable');\n\n if (clickedOnDraggable) {\n // This is handled by the individual item mousedown handlers\n return;\n }\n\n // We clicked on empty canvas space, start selection\n this.handleCanvasMouseDown(event);\n }\n\n private handleCanvasMouseDown(event: MouseEvent): void {\n const target = event.target as HTMLElement;\n if (target.id === 'canvas' || target.id === 'grid') {\n // Ignore clicks on exits\n\n // Start selection box\n this.canvasMouseDown = true;\n this.dragStartPos = { x: event.clientX, y: event.clientY };\n\n const canvasRect = this.querySelector('#canvas')?.getBoundingClientRect();\n if (canvasRect) {\n // Clear current selection\n this.selectedItems.clear();\n\n const relativeX = event.clientX - canvasRect.left;\n const relativeY = event.clientY - canvasRect.top;\n\n this.selectionBox = {\n startX: relativeX,\n startY: relativeY,\n endX: relativeX,\n endY: relativeY\n };\n }\n\n event.preventDefault();\n }\n }\n\n private handleKeyDown(event: KeyboardEvent): void {\n if (event.key === 'Delete' || event.key === 'Backspace') {\n if (this.selectedItems.size > 0) {\n this.showDeleteConfirmation();\n }\n }\n if (event.key === 'Escape') {\n this.selectedItems.clear();\n this.requestUpdate();\n }\n }\n\n private showDeleteConfirmation(): void {\n const itemCount = this.selectedItems.size;\n const itemType = itemCount === 1 ? 'item' : 'items';\n\n // Create and show confirmation dialog\n const dialog = document.createElement('temba-dialog') as Dialog;\n dialog.header = 'Delete Items';\n dialog.primaryButtonName = 'Delete';\n dialog.cancelButtonName = 'Cancel';\n dialog.destructive = true;\n dialog.innerHTML = `<div style=\"padding: 20px;\">Are you sure you want to delete ${itemCount} ${itemType}?</div>`;\n\n dialog.addEventListener('temba-button-clicked', (event: any) => {\n if (event.detail.button.name === 'Delete') {\n this.deleteSelectedItems();\n dialog.open = false;\n }\n });\n\n // Add to document and show\n document.body.appendChild(dialog);\n dialog.open = true;\n\n // Clean up dialog when closed\n dialog.addEventListener('temba-dialog-hidden', () => {\n document.body.removeChild(dialog);\n });\n }\n\n private deleteNodes(uuids: string[]): void {\n // Clean up jsPlumb connections for nodes before removing them\n uuids.forEach((uuid) => {\n this.plumber.removeNodeConnections(uuid);\n });\n\n // Now remove them from the definition\n if (uuids.length > 0 && this.plumber) {\n getStore().getState().removeNodes(uuids);\n }\n }\n\n private deleteSelectedItems(): void {\n const nodes = Array.from(this.selectedItems).filter((uuid) =>\n this.definition.nodes.some((node) => node.uuid === uuid)\n );\n this.deleteNodes(Array.from(nodes));\n\n const stickies = Array.from(this.selectedItems).filter(\n (uuid) => this.definition._ui?.stickies?.[uuid]\n );\n\n getStore().getState().removeStickyNotes(stickies);\n\n // Clear selection\n this.selectedItems.clear();\n }\n\n private updateSelectionBox(event: MouseEvent): void {\n if (!this.selectionBox || !this.canvasMouseDown) return;\n\n const canvasRect = this.querySelector('#canvas')?.getBoundingClientRect();\n if (!canvasRect) return;\n\n const relativeX = event.clientX - canvasRect.left;\n const relativeY = event.clientY - canvasRect.top;\n\n this.selectionBox = {\n ...this.selectionBox,\n endX: relativeX,\n endY: relativeY\n };\n\n // Update selected items based on selection box\n this.updateSelectedItemsFromBox();\n }\n\n private updateSelectedItemsFromBox(): void {\n if (!this.selectionBox) return;\n\n const newSelection = new Set<string>();\n\n const boxLeft = Math.min(this.selectionBox.startX, this.selectionBox.endX);\n const boxTop = Math.min(this.selectionBox.startY, this.selectionBox.endY);\n const boxRight = Math.max(this.selectionBox.startX, this.selectionBox.endX);\n const boxBottom = Math.max(\n this.selectionBox.startY,\n this.selectionBox.endY\n );\n\n // Check nodes\n this.definition?.nodes.forEach((node) => {\n const nodeElement = this.querySelector(`[id=\"${node.uuid}\"]`);\n if (nodeElement) {\n const position = this.definition._ui?.nodes[node.uuid]?.position;\n if (position) {\n const rect = nodeElement.getBoundingClientRect();\n const canvasRect =\n this.querySelector('#canvas')?.getBoundingClientRect();\n\n if (canvasRect) {\n const nodeLeft = position.left;\n const nodeTop = position.top;\n const nodeRight = nodeLeft + rect.width;\n const nodeBottom = nodeTop + rect.height;\n\n // Check if selection box intersects with node\n if (\n boxLeft < nodeRight &&\n boxRight > nodeLeft &&\n boxTop < nodeBottom &&\n boxBottom > nodeTop\n ) {\n newSelection.add(node.uuid);\n }\n }\n }\n }\n });\n\n // Check sticky notes\n const stickies = this.definition?._ui?.stickies || {};\n Object.entries(stickies).forEach(([uuid, sticky]) => {\n if (sticky.position) {\n const stickyElement = this.querySelector(\n `temba-sticky-note[uuid=\"${uuid}\"]`\n ) as HTMLElement;\n\n if (stickyElement) {\n // Use clientWidth/clientHeight instead of getBoundingClientRect() to get element dimensions\n // This avoids the coordinate system mismatch between viewport and canvas coordinates\n const width = stickyElement.clientWidth;\n const height = stickyElement.clientHeight;\n\n // Use the canvas coordinates from the sticky's position\n const stickyLeft = sticky.position.left;\n const stickyTop = sticky.position.top;\n const stickyRight = stickyLeft + width;\n const stickyBottom = stickyTop + height;\n\n // Check if selection box intersects with sticky\n if (\n boxLeft < stickyRight &&\n boxRight > stickyLeft &&\n boxTop < stickyBottom &&\n boxBottom > stickyTop\n ) {\n newSelection.add(uuid);\n }\n }\n }\n });\n\n this.selectedItems = newSelection;\n }\n\n private renderSelectionBox(): TemplateResult | string {\n if (!this.selectionBox || !this.isSelecting) return '';\n\n const left = Math.min(this.selectionBox.startX, this.selectionBox.endX);\n const top = Math.min(this.selectionBox.startY, this.selectionBox.endY);\n const width = Math.abs(this.selectionBox.endX - this.selectionBox.startX);\n const height = Math.abs(this.selectionBox.endY - this.selectionBox.startY);\n\n return html`<div\n class=\"selection-box\"\n style=\"left: ${left}px; top: ${top}px; width: ${width}px; height: ${height}px;\"\n ></div>`;\n }\n\n private renderCanvasDropPreview(): TemplateResult | string {\n if (!this.canvasDropPreview) return '';\n\n const { action, position } = this.canvasDropPreview;\n const actionConfig = ACTION_CONFIG[action.type];\n\n if (!actionConfig) return '';\n\n return html`<div\n class=\"canvas-drop-preview\"\n style=\"position: absolute; left: ${position.left}px; top: ${position.top}px; opacity: 0.6; pointer-events: none; z-index: 10000;\"\n >\n <div\n class=\"node execute-actions\"\n style=\"outline: 3px dashed var(--color-primary, #3b82f6); outline-offset: 2px; border-radius: var(--curvature);\"\n >\n <div class=\"action sortable ${action.type}\">\n <div class=\"action-content\">\n <div\n class=\"cn-title\"\n style=\"background: ${actionConfig.group\n ? ACTION_GROUP_METADATA[actionConfig.group]?.color\n : '#aaaaaa'}\"\n >\n <div class=\"title-spacer\"></div>\n <div class=\"name\">${actionConfig.name}</div>\n <div class=\"title-spacer\"></div>\n </div>\n <div class=\"body\">\n ${actionConfig.render\n ? actionConfig.render({ actions: [action] } as any, action)\n : html`<pre>${action.type}</pre>`}\n </div>\n </div>\n </div>\n <div class=\"action-exits\">\n <div class=\"exit-wrapper\">\n <div class=\"exit\"></div>\n </div>\n </div>\n </div>\n </div>`;\n }\n\n /**\n * Checks for node collisions and reflows nodes as needed.\n * Nodes are only moved downward to resolve collisions.\n *\n * @param movedNodeUuids - UUIDs of nodes that were just moved/dropped\n * @param droppedNodeUuid - UUID of the specific node that was dropped (if applicable)\n * @param dropTargetBounds - Bounds of the node that was dropped onto (if applicable)\n */\n private checkCollisionsAndReflow(\n movedNodeUuids: string[],\n droppedNodeUuid: string | null = null,\n dropTargetBounds: NodeBounds | null = null\n ): void {\n if (!this.definition) return;\n\n // Get all node bounds (only for actual nodes, not stickies)\n const allBounds: NodeBounds[] = [];\n\n for (const node of this.definition.nodes) {\n const nodeUI = this.definition._ui?.nodes[node.uuid];\n if (!nodeUI?.position) continue;\n\n const bounds = getNodeBounds(node.uuid, nodeUI.position);\n if (bounds) {\n allBounds.push(bounds);\n }\n }\n\n // Check if we need to determine midpoint priority for a dropped node\n let targetHasPriority = false;\n if (droppedNodeUuid && dropTargetBounds) {\n const droppedBounds = allBounds.find((b) => b.uuid === droppedNodeUuid);\n if (droppedBounds) {\n // Check if the bottom of the dropped node is below the midpoint of the target\n // If bottom is above midpoint, dropped node gets preference (targetHasPriority = false)\n // If bottom is below midpoint, target gets preference (targetHasPriority = true)\n const droppedBottom = droppedBounds.bottom;\n const targetMidpoint =\n dropTargetBounds.top + dropTargetBounds.height / 2;\n targetHasPriority = droppedBottom > targetMidpoint;\n }\n }\n\n // Calculate reflow positions for each moved node\n const allReflowPositions: { [uuid: string]: FlowPosition } = {};\n\n for (const movedUuid of movedNodeUuids) {\n const movedBounds = allBounds.find((b) => b.uuid === movedUuid);\n if (!movedBounds) continue;\n\n // Calculate reflow for this moved node\n const reflowPositions = calculateReflowPositions(\n movedUuid,\n movedBounds,\n allBounds,\n droppedNodeUuid === movedUuid ? targetHasPriority : false\n );\n\n // Merge into all reflow positions\n for (const [uuid, position] of reflowPositions.entries()) {\n allReflowPositions[uuid] = position;\n }\n }\n\n // If there are positions to update, apply them\n if (Object.keys(allReflowPositions).length > 0) {\n getStore().getState().updateCanvasPositions(allReflowPositions);\n }\n }\n\n private handleMouseMove(event: MouseEvent): void {\n // Handle selection box drawing\n if (this.canvasMouseDown && !this.isMouseDown) {\n this.isSelecting = true;\n this.updateSelectionBox(event);\n this.requestUpdate(); // Force re-render\n return;\n }\n\n if (this.plumber.connectionDragging) {\n const targetNode = document.querySelector('temba-flow-node:hover');\n\n // Clear previous target styles\n document.querySelectorAll('temba-flow-node').forEach((node) => {\n node.classList.remove(\n 'connection-target-valid',\n 'connection-target-invalid'\n );\n });\n\n if (targetNode) {\n this.targetId = targetNode.getAttribute('uuid');\n // Check if target is different from source node (prevent self-targeting)\n this.isValidTarget = this.targetId !== this.dragFromNodeId;\n\n // Apply visual feedback based on validity\n if (this.isValidTarget) {\n targetNode.classList.add('connection-target-valid');\n } else {\n targetNode.classList.add('connection-target-invalid');\n }\n } else {\n this.targetId = null;\n this.isValidTarget = true;\n }\n }\n\n // Handle item dragging\n if (!this.isMouseDown || !this.currentDragItem) return;\n\n const deltaX = event.clientX - this.dragStartPos.x;\n const deltaY = event.clientY - this.dragStartPos.y;\n const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);\n\n // Only start dragging if we've moved beyond the threshold\n if (!this.isDragging && distance > DRAG_THRESHOLD) {\n this.isDragging = true;\n }\n\n // If we're actually dragging, update positions\n if (this.isDragging) {\n // Determine what items to move\n const itemsToMove =\n this.selectedItems.has(this.currentDragItem.uuid) &&\n this.selectedItems.size > 1\n ? Array.from(this.selectedItems)\n : [this.currentDragItem.uuid];\n\n itemsToMove.forEach((uuid) => {\n const element = this.querySelector(`[uuid=\"${uuid}\"]`) as HTMLElement;\n if (element) {\n const type =\n element.tagName === 'TEMBA-FLOW-NODE' ? 'node' : 'sticky';\n const position = this.getPosition(uuid, type);\n\n if (position) {\n const newLeft = position.left + deltaX;\n const newTop = position.top + deltaY;\n\n // Update the visual position during drag\n element.style.left = `${newLeft}px`;\n element.style.top = `${newTop}px`;\n\n // Add dragging class to ensure highest z-index\n element.classList.add('dragging');\n }\n }\n });\n\n this.plumber.revalidate(itemsToMove);\n }\n }\n\n private handleMouseUp(event: MouseEvent): void {\n // Handle selection box completion\n if (this.canvasMouseDown && this.isSelecting) {\n this.isSelecting = false;\n this.selectionBox = null;\n this.canvasMouseDown = false;\n this.requestUpdate();\n return;\n }\n\n // Handle canvas click (clear selection)\n if (this.canvasMouseDown && !this.isSelecting) {\n this.canvasMouseDown = false;\n return;\n }\n\n // Handle item drag completion\n if (!this.isMouseDown || !this.currentDragItem) return;\n\n // If we were actually dragging, handle the drag end\n if (this.isDragging) {\n const deltaX = event.clientX - this.dragStartPos.x;\n const deltaY = event.clientY - this.dragStartPos.y;\n\n // Determine what items were moved\n const itemsToMove =\n this.selectedItems.has(this.currentDragItem.uuid) &&\n this.selectedItems.size > 1\n ? Array.from(this.selectedItems)\n : [this.currentDragItem.uuid];\n\n // Update positions for all moved items\n const newPositions: { [uuid: string]: FlowPosition } = {};\n\n itemsToMove.forEach((uuid) => {\n const type = this.definition.nodes.find((node) => node.uuid === uuid)\n ? 'node'\n : 'sticky';\n const position = this.getPosition(uuid, type);\n\n if (position) {\n const newLeft = position.left + deltaX;\n const newTop = position.top + deltaY;\n\n // Snap to 20px grid for final position\n const snappedLeft = snapToGrid(newLeft);\n const snappedTop = snapToGrid(newTop);\n\n const newPosition = { left: snappedLeft, top: snappedTop };\n newPositions[uuid] = newPosition;\n\n // Remove dragging class\n const element = this.querySelector(`[uuid=\"${uuid}\"]`) as HTMLElement;\n if (element) {\n element.classList.remove('dragging');\n element.style.left = `${snappedLeft}px`;\n element.style.top = `${snappedTop}px`;\n }\n }\n });\n\n if (Object.keys(newPositions).length > 0) {\n getStore().getState().updateCanvasPositions(newPositions);\n\n // Check for collisions and reflow nodes after updating positions\n // Filter to only check nodes (not stickies)\n const nodeUuids = itemsToMove.filter((uuid) =>\n this.definition.nodes.find((node) => node.uuid === uuid)\n );\n\n if (nodeUuids.length > 0) {\n // Allow DOM to update before checking collisions\n setTimeout(() => {\n // If only one node was moved, detect which node it might have been dropped onto\n let droppedNodeUuid: string | null = null;\n let dropTargetBounds: NodeBounds | null = null;\n\n if (nodeUuids.length === 1) {\n droppedNodeUuid = nodeUuids[0];\n const droppedNodeUI = this.definition._ui?.nodes[droppedNodeUuid];\n\n if (droppedNodeUI?.position) {\n const droppedBounds = getNodeBounds(\n droppedNodeUuid,\n droppedNodeUI.position\n );\n\n if (droppedBounds) {\n // Find which node (if any) the dropped node overlaps with\n for (const node of this.definition.nodes) {\n if (node.uuid === droppedNodeUuid) continue;\n\n const nodeUI = this.definition._ui?.nodes[node.uuid];\n if (!nodeUI?.position) continue;\n\n const targetBounds = getNodeBounds(\n node.uuid,\n nodeUI.position\n );\n if (\n targetBounds &&\n nodesOverlap(droppedBounds, targetBounds)\n ) {\n dropTargetBounds = targetBounds;\n break; // Use the first overlapping node\n }\n }\n }\n }\n }\n\n this.checkCollisionsAndReflow(\n nodeUuids,\n droppedNodeUuid,\n dropTargetBounds\n );\n }, 0);\n } else {\n // No nodes moved, just repaint connections\n setTimeout(() => {\n this.plumber.repaintEverything();\n }, 0);\n }\n }\n\n this.selectedItems.clear();\n }\n\n // Reset all drag state\n this.isDragging = false;\n this.isMouseDown = false;\n this.currentDragItem = null;\n this.canvasMouseDown = false;\n }\n\n private updateCanvasSize(): void {\n if (!this.definition) return;\n\n const store = getStore();\n if (!store) return;\n\n // Calculate required canvas size based on all elements\n let maxWidth = 0;\n let maxHeight = 0;\n\n // Check node positions\n this.definition.nodes.forEach((node) => {\n const ui = this.definition._ui.nodes[node.uuid];\n if (ui && ui.position) {\n const nodeElement = this.querySelector(`[id=\"${node.uuid}\"]`);\n if (nodeElement) {\n const rect = nodeElement.getBoundingClientRect();\n maxWidth = Math.max(maxWidth, ui.position.left + rect.width);\n maxHeight = Math.max(maxHeight, ui.position.top + rect.height);\n }\n }\n });\n\n // Check sticky note positions\n const stickies = this.definition._ui?.stickies || {};\n Object.entries(stickies).forEach(([uuid, sticky]) => {\n if (sticky.position) {\n const stickyElement = this.querySelector(\n `temba-sticky-note[uuid=\"${uuid}\"]`\n ) as HTMLElement;\n if (stickyElement) {\n // Use clientWidth/clientHeight instead of getBoundingClientRect() to get element dimensions\n // This avoids the coordinate system mismatch between viewport and canvas coordinates\n const width = stickyElement.clientWidth;\n const height = stickyElement.clientHeight;\n\n // Both sticky.position and width/height are now in the same coordinate system\n maxWidth = Math.max(maxWidth, sticky.position.left + width);\n maxHeight = Math.max(maxHeight, sticky.position.top + height);\n } else {\n // Fallback to default sizes if element not found\n maxWidth = Math.max(maxWidth, sticky.position.left + 200);\n maxHeight = Math.max(maxHeight, sticky.position.top + 100);\n }\n }\n });\n\n // Update canvas size in store\n store.getState().expandCanvas(maxWidth, maxHeight);\n }\n\n private handleCanvasContextMenu(event: MouseEvent): void {\n // Check if we right-clicked on empty canvas space\n const target = event.target as HTMLElement;\n if (target.id !== 'canvas') {\n return;\n }\n\n // Prevent the default browser context menu\n event.preventDefault();\n event.stopPropagation();\n\n // Get canvas position\n const canvas = this.querySelector('#canvas');\n if (!canvas) {\n return;\n }\n\n const canvasRect = canvas.getBoundingClientRect();\n const relativeX = event.clientX - canvasRect.left - 10;\n const relativeY = event.clientY - canvasRect.top - 10;\n\n // Snap position to grid\n const snappedLeft = snapToGrid(relativeX);\n const snappedTop = snapToGrid(relativeY);\n\n // Show the canvas menu at the mouse position (use viewport coordinates)\n const canvasMenu = this.querySelector('temba-canvas-menu') as CanvasMenu;\n if (canvasMenu) {\n canvasMenu.show(event.clientX, event.clientY, {\n x: snappedLeft,\n y: snappedTop\n });\n }\n }\n\n private handleCanvasMenuSelection(event: CustomEvent): void {\n const selection = event.detail as CanvasMenuSelection;\n const store = getStore();\n\n if (selection.action === 'sticky') {\n // Create new sticky note\n store.getState().createStickyNote({\n left: selection.position.x,\n top: selection.position.y\n });\n } else {\n // Show node type selector\n const selector = this.querySelector(\n 'temba-node-type-selector'\n ) as NodeTypeSelector;\n if (selector) {\n selector.show(selection.action, selection.position);\n }\n }\n }\n\n private handleNodeTypeSelection(event: CustomEvent): void {\n const selection = event.detail as NodeTypeSelection;\n\n // Check if we're adding an action to an existing node\n if (this.addActionToNodeUuid) {\n // Find the existing node\n const node = this.definition.nodes.find(\n (n) => n.uuid === this.addActionToNodeUuid\n );\n const nodeUI = this.definition._ui.nodes[this.addActionToNodeUuid];\n\n if (node && nodeUI) {\n // Create a new action to add to the existing node\n const actionUuid = generateUUID();\n this.editingAction = {\n uuid: actionUuid,\n type: selection.nodeType as any\n } as Action;\n\n // Set the editing node to the existing node (not creating new)\n this.editingNode = node;\n this.editingNodeUI = nodeUI;\n this.isCreatingNewNode = false;\n\n // Clear the addActionToNodeUuid flag\n this.addActionToNodeUuid = null;\n\n return;\n }\n\n // If we couldn't find the node, clear the flag and continue with normal flow\n this.addActionToNodeUuid = null;\n }\n\n // Create a temporary node structure for editing (not added to store yet)\n const nodeUuid = generateUUID();\n\n // Determine if this is an action type or a node type\n // Actions need to be wrapped in an execute_actions node\n const isActionType = selection.nodeType in ACTION_CONFIG;\n const nodeType = isActionType ? 'execute_actions' : selection.nodeType;\n\n // For nodes with routers, initialize an empty router to ensure fromFormData works correctly\n const nodeConfig = NODE_CONFIG[nodeType];\n const hasRouter =\n nodeConfig?.form &&\n Object.keys(nodeConfig.form).some(\n (key) =>\n ['rules', 'categories', 'cases'].includes(key) ||\n nodeConfig.form[key]?.type === 'array'\n );\n\n const tempNode: Node = {\n uuid: nodeUuid,\n actions: [],\n exits: hasRouter\n ? [] // Router-based nodes will generate their own exits\n : [\n {\n uuid: generateUUID(),\n destination_uuid: null\n }\n ]\n };\n\n if (hasRouter) {\n // This node uses a router - initialize it with empty structure\n tempNode.router = {\n type: 'switch',\n categories: [],\n cases: [],\n operand: '@input.text',\n default_category_uuid: undefined\n };\n }\n\n const tempNodeUI: NodeUI = {\n position: {\n left: selection.position.x,\n top: selection.position.y\n },\n type: nodeType as any,\n config: {}\n };\n\n // Mark that we're creating a new node and store the position\n this.isCreatingNewNode = true;\n this.pendingNodePosition = {\n left: selection.position.x,\n top: selection.position.y\n };\n\n // Open the node editor with the temporary node\n this.editingNode = tempNode;\n this.editingNodeUI = tempNodeUI;\n\n // If this is an action type, we also need to set up an editing action\n if (isActionType) {\n const actionUuid = generateUUID();\n this.editingAction = {\n uuid: actionUuid,\n type: selection.nodeType as any\n } as Action;\n }\n }\n\n private handleActionEditRequested(event: CustomEvent): void {\n // For action editing, we set the action and find the corresponding node\n this.editingAction = event.detail.action;\n\n // Find the node that contains this action\n const nodeUuid = event.detail.nodeUuid;\n const node = this.definition.nodes.find((n) => n.uuid === nodeUuid);\n\n if (node) {\n this.editingNode = node;\n this.editingNodeUI = this.definition._ui.nodes[nodeUuid];\n }\n }\n\n private handleAddActionRequested(event: CustomEvent): void {\n // Get the node where we want to add the action\n const nodeUuid = event.detail.nodeUuid;\n const node = this.definition.nodes.find((n) => n.uuid === nodeUuid);\n\n if (!node) {\n return;\n }\n\n // Get the node's position to place the selector near it\n const nodeUI = this.definition._ui.nodes[nodeUuid];\n if (!nodeUI) {\n return;\n }\n\n // Show the node type selector in action mode, excluding branching actions\n const selector = this.querySelector(\n 'temba-node-type-selector'\n ) as NodeTypeSelector;\n if (selector) {\n // Show the selector near the node, using a mode that excludes branching actions\n selector.show('action-no-branching', {\n x: nodeUI.position.left,\n y: nodeUI.position.top\n });\n\n // Store the node UUID so we know which node to add the action to\n this.addActionToNodeUuid = nodeUuid;\n }\n }\n\n private handleNodeEditRequested(event: CustomEvent): void {\n this.editingNode = event.detail.node;\n this.editingNodeUI = event.detail.nodeUI;\n }\n\n private handleNodeDeleted(event: CustomEvent): void {\n const nodeUuid = event.detail.uuid;\n if (nodeUuid) {\n this.deleteNodes([nodeUuid]);\n }\n }\n\n private handleActionSaved(updatedAction: Action): void {\n if (this.editingNode && this.editingAction) {\n let updatedActions: Action[];\n\n // Check if this action already exists in the node\n const existingActionIndex = this.editingNode.actions.findIndex(\n (action) => action.uuid === this.editingAction.uuid\n );\n\n if (existingActionIndex >= 0) {\n // Update existing action\n updatedActions = this.editingNode.actions.map((action) =>\n action.uuid === this.editingAction.uuid ? updatedAction : action\n );\n } else {\n // Add new action\n updatedActions = [...this.editingNode.actions, updatedAction];\n }\n\n const updatedNode = { ...this.editingNode, actions: updatedActions };\n\n // Check if we're creating a new node or updating an existing one\n if (this.isCreatingNewNode) {\n // This is a new node with a new action - add it to the store\n const store = getStore();\n\n const nodeUI: NodeUI = {\n position: this.pendingNodePosition || { left: 0, top: 0 },\n type: this.editingNodeUI?.type,\n config: {}\n };\n\n // Add the node to the store\n store.getState().addNode(updatedNode, nodeUI);\n\n // Reset the creation flags\n this.isCreatingNewNode = false;\n this.pendingNodePosition = null;\n\n // Check for collisions and reflow\n requestAnimationFrame(() => {\n this.checkCollisionsAndReflow([updatedNode.uuid]);\n });\n } else {\n // Update existing node in the store\n getStore()?.getState().updateNode(this.editingNode.uuid, updatedNode);\n\n // Check for collisions and reflow in case node size changed\n requestAnimationFrame(() => {\n this.checkCollisionsAndReflow([this.editingNode.uuid]);\n });\n }\n }\n this.closeNodeEditor();\n }\n\n private closeNodeEditor(): void {\n this.editingNode = null;\n this.editingNodeUI = null;\n this.editingAction = null;\n }\n\n private handleActionEditCanceled(): void {\n // If we were creating a new node, just discard it\n if (this.isCreatingNewNode) {\n this.isCreatingNewNode = false;\n this.pendingNodePosition = null;\n }\n this.closeNodeEditor();\n }\n\n private handleNodeSaved(\n updatedNode: Node,\n uiConfig?: Record<string, any>\n ): void {\n if (this.editingNode) {\n if (this.isCreatingNewNode) {\n // This is a new node - add it to the store for the first time\n const store = getStore();\n\n const nodeUI: NodeUI = {\n position: this.pendingNodePosition || { left: 0, top: 0 },\n type: this.editingNodeUI?.type,\n config: uiConfig || {}\n };\n\n // Add the node to the store\n store.getState().addNode(updatedNode, nodeUI);\n\n // Reset the creation flags\n this.isCreatingNewNode = false;\n this.pendingNodePosition = null;\n\n // Check for collisions and reflow\n requestAnimationFrame(() => {\n this.checkCollisionsAndReflow([updatedNode.uuid]);\n });\n } else {\n // This is an existing node - update it\n // Clean up jsPlumb connections for removed exits before updating the node\n if (this.plumber) {\n const oldExits = this.editingNode.exits || [];\n const newExits = updatedNode.exits || [];\n\n // Find exits that were removed\n const removedExits = oldExits.filter(\n (oldExit) =>\n !newExits.find((newExit) => newExit.uuid === oldExit.uuid)\n );\n\n // Remove jsPlumb connections for removed exits\n removedExits.forEach((exit) => {\n this.plumber.removeExitConnection(exit.uuid);\n });\n }\n\n this.plumber.revalidate([updatedNode.uuid]);\n\n // Update the node in the store\n getStore()?.getState().updateNode(this.editingNode.uuid, updatedNode);\n\n // Update the UI config if provided\n if (uiConfig) {\n getStore()?.getState().updateNodeUIConfig(updatedNode.uuid, uiConfig);\n }\n\n // Check for collisions and reflow in case node size changed\n requestAnimationFrame(() => {\n this.checkCollisionsAndReflow([this.editingNode.uuid]);\n });\n }\n }\n this.closeNodeEditor();\n }\n\n private handleNodeEditCanceled(): void {\n // If we were creating a new node, just discard it\n if (this.isCreatingNewNode) {\n this.isCreatingNewNode = false;\n this.pendingNodePosition = null;\n }\n this.closeNodeEditor();\n }\n\n private getNodeAtPosition(mouseX: number, mouseY: number): string | null {\n // Get all node elements\n const nodeElements = this.querySelectorAll('temba-flow-node');\n\n for (const nodeElement of Array.from(nodeElements)) {\n const rect = nodeElement.getBoundingClientRect();\n\n if (\n mouseX >= rect.left &&\n mouseX <= rect.right &&\n mouseY >= rect.top &&\n mouseY <= rect.bottom\n ) {\n return nodeElement.getAttribute('data-node-uuid');\n }\n }\n\n return null;\n }\n\n private calculateCanvasDropPosition(\n mouseX: number,\n mouseY: number,\n applyGridSnapping: boolean = true\n ): FlowPosition {\n // calculate the position on the canvas\n const canvas = this.querySelector('#canvas');\n if (!canvas) return { left: 0, top: 0 };\n\n const canvasRect = canvas.getBoundingClientRect();\n\n // calculate position relative to canvas\n // canvasRect gives us the canvas position in the viewport, which already accounts for scroll\n // so we just need mouseX/Y - canvasRect.left/top to get position within canvas\n const left = mouseX - canvasRect.left - DROP_PREVIEW_OFFSET_X;\n const top = mouseY - canvasRect.top - DROP_PREVIEW_OFFSET_Y;\n\n // Apply grid snapping only if requested (for final drop position)\n if (applyGridSnapping) {\n return {\n left: snapToGrid(left),\n top: snapToGrid(top)\n };\n }\n\n return { left, top };\n }\n\n private handleActionDragExternal(event: CustomEvent): void {\n const {\n action,\n nodeUuid,\n actionIndex,\n mouseX,\n mouseY,\n actionHeight = 60,\n isLastAction = false\n } = event.detail;\n\n // Check if mouse is over another execute_actions node\n const targetNode = this.getNodeAtPosition(mouseX, mouseY);\n\n if (targetNode && targetNode !== nodeUuid) {\n const targetNodeUI = this.definition._ui.nodes[targetNode];\n const targetNodeDef = this.definition.nodes.find(\n (n) => n.uuid === targetNode\n );\n\n // Only allow dropping on execute_actions nodes, and not the source node\n if (targetNodeUI?.type === 'execute_actions' && targetNodeDef) {\n // If we moved to a different target node, clear the previous one's placeholder\n if (\n this.previousActionDragTargetNodeUuid &&\n this.previousActionDragTargetNodeUuid !== targetNode\n ) {\n const previousElement = this.querySelector(\n `temba-flow-node[data-node-uuid=\"${this.previousActionDragTargetNodeUuid}\"]`\n );\n if (previousElement) {\n previousElement.dispatchEvent(\n new CustomEvent('action-drag-leave', {\n detail: {},\n bubbles: false\n })\n );\n }\n }\n\n // Update target node for drop handling\n this.actionDragTargetNodeUuid = targetNode;\n this.previousActionDragTargetNodeUuid = targetNode;\n\n // Hide canvas preview when over a valid target\n this.canvasDropPreview = null;\n\n // Tell source node to show ghost (we're over a valid target)\n const sourceElement = this.querySelector(\n `temba-flow-node[data-node-uuid=\"${nodeUuid}\"]`\n );\n if (sourceElement) {\n sourceElement.dispatchEvent(\n new CustomEvent('action-show-ghost', {\n detail: {},\n bubbles: false\n })\n );\n }\n\n // Notify the target node about the drag\n const targetElement = this.querySelector(\n `temba-flow-node[data-node-uuid=\"${targetNode}\"]`\n );\n if (targetElement) {\n targetElement.dispatchEvent(\n new CustomEvent('action-drag-over', {\n detail: {\n action,\n sourceNodeUuid: nodeUuid,\n actionIndex,\n mouseX,\n mouseY,\n actionHeight\n },\n bubbles: false\n })\n );\n }\n\n this.requestUpdate();\n return;\n }\n }\n\n // Not over a valid target node, clear any previous target's placeholder\n if (this.previousActionDragTargetNodeUuid) {\n const previousElement = this.querySelector(\n `temba-flow-node[data-node-uuid=\"${this.previousActionDragTargetNodeUuid}\"]`\n );\n if (previousElement) {\n previousElement.dispatchEvent(\n new CustomEvent('action-drag-leave', {\n detail: {},\n bubbles: false\n })\n );\n }\n this.previousActionDragTargetNodeUuid = null;\n }\n\n this.actionDragTargetNodeUuid = null;\n\n const sourceElement = this.querySelector(\n `temba-flow-node[data-node-uuid=\"${nodeUuid}\"]`\n );\n\n // Show canvas drop preview only if this is NOT the last action\n // Last actions can only be dropped on other nodes, not on canvas\n if (!isLastAction) {\n // Hide ghost when showing canvas preview (for canvas drops)\n if (sourceElement) {\n sourceElement.dispatchEvent(\n new CustomEvent('action-hide-ghost', {\n detail: {},\n bubbles: false\n })\n );\n }\n\n // Don't snap to grid for preview - let it follow cursor smoothly\n const position = this.calculateCanvasDropPosition(mouseX, mouseY, false);\n\n this.canvasDropPreview = {\n action,\n nodeUuid,\n actionIndex,\n position,\n actionHeight\n };\n } else {\n // For last action, keep ghost visible (can't drop on canvas)\n if (sourceElement) {\n sourceElement.dispatchEvent(\n new CustomEvent('action-show-ghost', {\n detail: {},\n bubbles: false\n })\n );\n }\n\n // Clear any existing preview for last action\n this.canvasDropPreview = null;\n }\n\n // Force re-render to update preview position\n this.requestUpdate();\n }\n\n private handleActionDragInternal(_event: CustomEvent): void {\n // Clear any previous target's placeholder when returning to internal drag\n if (this.previousActionDragTargetNodeUuid) {\n const previousElement = this.querySelector(\n `temba-flow-node[data-node-uuid=\"${this.previousActionDragTargetNodeUuid}\"]`\n );\n if (previousElement) {\n previousElement.dispatchEvent(\n new CustomEvent('action-drag-leave', {\n detail: {},\n bubbles: false\n })\n );\n }\n this.previousActionDragTargetNodeUuid = null;\n }\n\n this.canvasDropPreview = null;\n this.actionDragTargetNodeUuid = null;\n }\n\n private handleActionDropExternal(event: CustomEvent): void {\n const {\n action,\n nodeUuid,\n actionIndex,\n mouseX,\n mouseY,\n isLastAction = false\n } = event.detail;\n\n // Check if we're dropping on an existing execute_actions node\n const targetNodeUuid = this.actionDragTargetNodeUuid;\n\n if (targetNodeUuid && targetNodeUuid !== nodeUuid) {\n // Dropping on another node - notify the target node to handle the drop\n const targetElement = this.querySelector(\n `temba-flow-node[data-node-uuid=\"${targetNodeUuid}\"]`\n );\n if (targetElement) {\n targetElement.dispatchEvent(\n new CustomEvent('action-drop', {\n detail: {\n action,\n sourceNodeUuid: nodeUuid,\n actionIndex,\n mouseX,\n mouseY\n },\n bubbles: false\n })\n );\n }\n\n // Clear state\n this.canvasDropPreview = null;\n this.actionDragTargetNodeUuid = null;\n return;\n }\n\n // If this is the last action and we're not dropping on another node, do nothing\n // Last actions can only be moved to other nodes, not dropped on canvas\n if (isLastAction) {\n this.canvasDropPreview = null;\n this.actionDragTargetNodeUuid = null;\n return;\n }\n\n // Not dropping on another node, create a new one on canvas\n // Snap to grid for the final drop position\n const position = this.calculateCanvasDropPosition(mouseX, mouseY, true);\n\n // remove the action from the original node\n const originalNode = this.definition.nodes.find((n) => n.uuid === nodeUuid);\n if (!originalNode) return;\n\n const updatedActions = originalNode.actions.filter(\n (_a, idx) => idx !== actionIndex\n );\n\n // if no actions remain, delete the node\n if (updatedActions.length === 0) {\n // Use deleteNodes to properly clean up Plumber connections before removing\n this.deleteNodes([nodeUuid]);\n } else {\n // update the node\n const updatedNode = { ...originalNode, actions: updatedActions };\n getStore()?.getState().updateNode(nodeUuid, updatedNode);\n }\n\n // create a new execute_actions node with the dropped action\n const newNode: Node = {\n uuid: generateUUID(),\n actions: [action],\n exits: [\n {\n uuid: generateUUID(),\n destination_uuid: null\n }\n ]\n };\n\n const newNodeUI: NodeUI = {\n position,\n type: 'execute_actions',\n config: {}\n };\n\n // add the new node\n getStore()?.getState().addNode(newNode, newNodeUI);\n\n // clear the preview\n this.canvasDropPreview = null;\n this.actionDragTargetNodeUuid = null;\n\n // Check for collisions and reflow after adding new node\n requestAnimationFrame(() => {\n this.checkCollisionsAndReflow([newNode.uuid]);\n });\n }\n\n private getLocalizationLanguages(): Array<{ code: string; name: string }> {\n if (!this.definition) {\n return [];\n }\n\n const baseLanguage = this.definition.language;\n return this.getAvailableLanguages().filter(\n (lang) => lang.code !== baseLanguage\n );\n }\n\n private getLocalizationProgress(languageCode: string): {\n total: number;\n localized: number;\n } {\n if (\n !this.definition ||\n !languageCode ||\n languageCode === this.definition.language\n ) {\n return { total: 0, localized: 0 };\n }\n\n const bundles = this.buildTranslationBundles(\n this.translationFilters.categories,\n languageCode\n );\n return this.getTranslationCounts(bundles);\n }\n\n private getLanguageLocalization(languageCode: string): Record<string, any> {\n if (!this.definition?.localization) {\n return {};\n }\n return this.definition.localization[languageCode] || {};\n }\n\n private buildTranslationBundles(\n includeCategories: boolean,\n languageCode: string = this.languageCode\n ): TranslationBundle[] {\n if (\n !this.definition ||\n !languageCode ||\n languageCode === this.definition.language\n ) {\n return [];\n }\n\n const languageLocalization = this.getLanguageLocalization(languageCode);\n const bundles: TranslationBundle[] = [];\n\n this.definition.nodes.forEach((node) => {\n node.actions.forEach((action) => {\n const config = ACTION_CONFIG[action.type];\n if (!config?.localizable || config.localizable.length === 0) {\n return;\n }\n\n // For send_msg actions, only count 'text' for progress tracking\n // (quick_replies and attachments are still localizable but don't count toward progress)\n const localizableKeys =\n action.type === 'send_msg'\n ? config.localizable.filter((key) => key === 'text')\n : config.localizable;\n\n const translations = this.findTranslations(\n 'property',\n action.uuid,\n localizableKeys,\n action,\n languageLocalization\n );\n\n if (translations.length > 0) {\n bundles.push({\n nodeUuid: node.uuid,\n actionUuid: action.uuid,\n translations\n });\n }\n });\n\n if (!includeCategories) {\n return;\n }\n\n const nodeUI = this.definition._ui?.nodes?.[node.uuid];\n const nodeType = nodeUI?.type;\n if (!nodeType) {\n return;\n }\n\n const nodeConfig = NODE_CONFIG[nodeType];\n if (\n nodeConfig?.localizable === 'categories' &&\n node.router?.categories?.length\n ) {\n const categoryTranslations = node.router.categories.flatMap(\n (category) =>\n this.findTranslations(\n 'category',\n category.uuid,\n ['name'],\n category,\n languageLocalization\n )\n );\n\n if (categoryTranslations.length > 0) {\n bundles.push({\n nodeUuid: node.uuid,\n translations: categoryTranslations\n });\n }\n }\n });\n\n return bundles;\n }\n\n private findTranslations(\n type: TranslationType,\n uuid: string,\n localizeableKeys: string[],\n source: any,\n localization: Record<string, any>\n ): TranslationEntry[] {\n const translations: TranslationEntry[] = [];\n\n localizeableKeys.forEach((attribute) => {\n if (attribute === 'quick_replies') {\n return;\n }\n\n const pathSegments = attribute.split('.');\n let from: any = source;\n let to: any = [];\n\n while (pathSegments.length > 0 && from) {\n if (from.uuid) {\n to = localization[from.uuid];\n }\n\n const path = pathSegments.shift();\n if (!path) {\n break;\n }\n\n if (to) {\n to = to[path];\n }\n from = from[path];\n }\n\n if (!from) {\n return;\n }\n\n const fromValue = this.formatTranslationValue(from);\n if (!fromValue) {\n return;\n }\n\n const toValue = to ? this.formatTranslationValue(to) : null;\n\n translations.push({\n uuid,\n type,\n attribute,\n from: fromValue,\n to: toValue\n });\n });\n\n return translations;\n }\n\n private formatTranslationValue(value: any): string | null {\n if (value === null || value === undefined) {\n return null;\n }\n\n if (Array.isArray(value)) {\n const normalized = value\n .map((entry) => this.formatTranslationValue(entry))\n .filter((entry) => !!entry) as string[];\n return normalized.length > 0 ? normalized.join(', ') : null;\n }\n\n if (typeof value === 'object') {\n if ('name' in value && value.name) {\n return String(value.name);\n }\n\n if ('arguments' in value && Array.isArray(value.arguments)) {\n return value.arguments.join(' ');\n }\n\n return null;\n }\n\n if (typeof value === 'number') {\n return value.toString();\n }\n\n if (typeof value === 'string') {\n const trimmed = value.trim();\n return trimmed.length > 0 ? trimmed : null;\n }\n\n return null;\n }\n\n private getTranslationCounts(bundles: TranslationBundle[]): {\n total: number;\n localized: number;\n } {\n return bundles.reduce(\n (counts, bundle) => {\n bundle.translations.forEach((translation) => {\n counts.total += 1;\n if (translation.to && translation.to.trim().length > 0) {\n counts.localized += 1;\n }\n });\n return counts;\n },\n { total: 0, localized: 0 }\n );\n }\n\n private handleLocalizationTabClick(): void {\n const languages = this.getLocalizationLanguages();\n if (!languages.length) {\n return;\n }\n\n this.localizationWindowHidden = false;\n\n const alreadySelected = languages.some(\n (lang) => lang.code === this.languageCode\n );\n\n if (!alreadySelected) {\n this.handleLanguageChange(languages[0].code);\n }\n }\n\n private handleLocalizationLanguageSelect(languageCode: string): void {\n if (languageCode === this.languageCode) {\n return;\n }\n this.handleLanguageChange(languageCode);\n }\n\n private handleLocalizationLanguageSelectChange(event: CustomEvent): void {\n const select = event.target as any;\n const nextValue = select?.values?.[0]?.value;\n if (nextValue) {\n this.handleLocalizationLanguageSelect(nextValue);\n }\n }\n\n private handleLocalizationWindowClosed(): void {\n this.localizationWindowHidden = true;\n\n const baseLanguage = this.definition?.language;\n if (baseLanguage && this.languageCode !== baseLanguage) {\n this.handleLanguageChange(baseLanguage);\n }\n }\n\n private toggleTranslationSettings(): void {\n this.translationSettingsExpanded = !this.translationSettingsExpanded;\n }\n\n private handleLocalizationProgressToggleClick(event: MouseEvent): void {\n const target = event.target as HTMLElement;\n if (target.closest('.translation-settings-toggle')) {\n return;\n }\n this.toggleTranslationSettings();\n }\n\n private handleLocalizationProgressToggleKeydown(event: KeyboardEvent): void {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n this.toggleTranslationSettings();\n }\n }\n\n private handleIncludeCategoriesChange(event: Event): void {\n const checkbox = event.target as Checkbox;\n const categories = checkbox?.checked ?? false;\n this.translationFilters = { categories };\n getStore()?.getState().setTranslationFilters({ categories });\n this.requestUpdate();\n }\n\n private async handleAutoTranslateClick(event: Event): Promise<void> {\n event.preventDefault();\n event.stopPropagation();\n\n if (this.autoTranslating) {\n this.autoTranslating = false;\n return;\n }\n\n this.autoTranslateDialogOpen = true;\n }\n\n private handleAutoTranslateDialogButton(event: CustomEvent): void {\n const button = event.detail?.button;\n if (!button) {\n return;\n }\n\n if (button.name === 'Translate') {\n if (!this.autoTranslateModel) {\n return;\n }\n this.autoTranslateDialogOpen = false;\n this.autoTranslateError = null;\n this.autoTranslating = true;\n this.runAutoTranslation().catch((error) => {\n console.error('Auto translation failed', error);\n this.autoTranslateError = 'Auto translation failed. Please try again.';\n this.autoTranslating = false;\n });\n } else if (button.name === 'Cancel' || button.name === 'Close') {\n this.autoTranslateDialogOpen = false;\n }\n }\n\n private handleAutoTranslateModelChange(event: Event): void {\n const select = event.target as any;\n const nextModel = select?.values?.[0] || null;\n this.autoTranslateModel = nextModel;\n }\n\n private shouldTranslateValue(text: string): boolean {\n if (!text) {\n return false;\n }\n const trimmed = text.trim();\n if (trimmed.length <= 1) {\n return false;\n }\n if (/^\\d+$/.test(trimmed)) {\n return false;\n }\n return true;\n }\n\n private async requestAutoTranslation(text: string): Promise<string | null> {\n if (!this.autoTranslateModel || !this.definition) {\n return null;\n }\n\n const payload = {\n text,\n lang: {\n from: this.definition.language,\n to: this.languageCode\n }\n };\n\n const response = await postJSON(\n `/llm/translate/${this.autoTranslateModel.uuid}/`,\n payload\n );\n\n if (response?.status === 200) {\n const result = response.json?.result || response.json?.text;\n return result ? String(result) : null;\n }\n\n throw new Error('Auto translation request failed');\n }\n\n private applyLocalizationUpdates(\n updates: LocalizationUpdate[],\n autoTranslated = false\n ): void {\n if (!updates.length || !this.definition) {\n return;\n }\n\n const store = getStore();\n if (!store) {\n return;\n }\n\n updates.forEach(({ uuid, translations }) => {\n const normalized = Object.entries(translations).reduce(\n (acc, [key, value]) => {\n if (!value) {\n return acc;\n }\n acc[key] = Array.isArray(value) ? value : [value];\n return acc;\n },\n {} as Record<string, any>\n );\n\n const existing =\n this.definition.localization?.[this.languageCode]?.[uuid] || {};\n const merged = { ...existing, ...normalized };\n\n store.getState().updateLocalization(this.languageCode, uuid, merged);\n\n if (autoTranslated) {\n zustand\n .getState()\n .markAutoTranslated(\n this.languageCode,\n uuid,\n Object.keys(translations)\n );\n }\n });\n }\n\n private async runAutoTranslation(): Promise<void> {\n if (\n !this.definition ||\n this.languageCode === this.definition.language ||\n !this.autoTranslateModel\n ) {\n this.autoTranslating = false;\n return;\n }\n\n const bundles = this.buildTranslationBundles(\n this.translationFilters.categories\n );\n\n for (const bundle of bundles) {\n if (!this.autoTranslating) {\n break;\n }\n\n const untranslated = bundle.translations.filter(\n (translation) => !translation.to || translation.to.trim().length === 0\n );\n\n if (untranslated.length === 0) {\n continue;\n }\n\n const updates: LocalizationUpdate[] = [];\n\n for (const translation of untranslated) {\n if (!this.autoTranslating) {\n break;\n }\n\n if (!this.shouldTranslateValue(translation.from)) {\n continue;\n }\n\n const cached = this.translationCache.get(translation.from);\n if (cached) {\n updates.push({\n uuid: translation.uuid,\n translations: { [translation.attribute]: cached }\n });\n continue;\n }\n\n try {\n const result = await this.requestAutoTranslation(translation.from);\n if (result) {\n this.translationCache.set(translation.from, result);\n updates.push({\n uuid: translation.uuid,\n translations: { [translation.attribute]: result }\n });\n }\n } catch (error) {\n console.error('Auto translation request failed', error);\n this.autoTranslateError =\n 'Auto translation failed. Please try again.';\n this.autoTranslating = false;\n break;\n }\n }\n\n if (updates.length > 0) {\n this.applyLocalizationUpdates(updates, true);\n }\n\n if (!this.autoTranslating) {\n break;\n }\n }\n\n this.autoTranslating = false;\n }\n\n private renderLocalizationWindow(): TemplateResult | string {\n const languages = this.getLocalizationLanguages();\n if (!languages.length) {\n return html``;\n }\n\n const baseLanguage = this.definition?.language;\n const availableLanguages = this.getAvailableLanguages();\n const baseName =\n availableLanguages.find((lang) => lang.code === baseLanguage)?.name ||\n 'Base Language';\n\n const activeLanguageCode = languages.some(\n (lang) => lang.code === this.languageCode\n )\n ? this.languageCode\n : languages[0]?.code;\n const activeLanguage = activeLanguageCode\n ? languages.find((lang) => lang.code === activeLanguageCode)\n : null;\n const progress = this.getLocalizationProgress(activeLanguageCode || '');\n const includeCategories = this.translationFilters.categories;\n const settingsPanelId = 'translation-settings-panel';\n const remainingTranslations = Math.max(\n progress.total - progress.localized,\n 0\n );\n const hasTranslations = progress.total > 0;\n const hasPendingTranslations = remainingTranslations > 0;\n const autoTranslateButtonLabel = this.autoTranslating\n ? 'Stop Auto Translate'\n : 'Auto Translate';\n const autoTranslateButtonDisabled =\n !this.autoTranslating && !hasTranslations;\n\n return html`\n <temba-floating-window\n id=\"localization-window\"\n header=\"Translations\"\n .width=${360}\n .maxHeight=${600}\n .top=${170}\n color=\"#6b7280\"\n .hidden=${this.localizationWindowHidden}\n @temba-dialog-hidden=${this.handleLocalizationWindowClosed}\n >\n <div class=\"localization-window-content\">\n <div class=\"localization-header\">\n Translate from <strong>${baseName}</strong> to the languages below.\n Closing this window returns you to editing in ${baseName}.\n </div>\n <div class=\"localization-language-row\">\n <temba-select\n flavor=\"small\"\n class=\"localization-language-select\"\n .values=${activeLanguage\n ? [{ name: activeLanguage.name, value: activeLanguage.code }]\n : []}\n @change=${this.handleLocalizationLanguageSelectChange}\n >\n ${languages.map(\n (lang) => html`<temba-option\n value=\"${lang.code}\"\n name=\"${lang.name}\"\n ></temba-option>`\n )}\n </temba-select>\n <button\n class=\"auto-translate-button\"\n type=\"button\"\n ?disabled=${autoTranslateButtonDisabled}\n @click=${this.handleAutoTranslateClick}\n >\n ${autoTranslateButtonLabel}\n </button>\n </div>\n <div class=\"localization-progress\">\n <div class=\"localization-progress-summary\">\n ${this.autoTranslating\n ? html`<temba-loading units=\"3\" size=\"8\"></temba-loading>\n <span>Auto translating remaining text…</span>`\n : !hasTranslations\n ? html`<span>\n Add content or enable more options to start translating.\n </span>`\n : hasPendingTranslations\n ? html`<span>\n ${progress.localized} of ${progress.total} items translated\n </span>`\n : html`<span>All items are translated.</span>`}\n </div>\n ${this.autoTranslateError\n ? html`<div class=\"auto-translate-error\">\n ${this.autoTranslateError}\n </div>`\n : ''}\n <div class=\"localization-progress-bar-row\">\n <div\n class=\"localization-progress-trigger\"\n role=\"button\"\n tabindex=\"0\"\n aria-expanded=\"${this.translationSettingsExpanded}\"\n aria-controls=\"${settingsPanelId}\"\n @click=${this.handleLocalizationProgressToggleClick}\n @keydown=${this.handleLocalizationProgressToggleKeydown}\n >\n <temba-progress\n .current=${progress.localized}\n .total=${Math.max(progress.total, 1)}\n .animated=${false}\n ></temba-progress>\n </div>\n <button\n class=\"translation-settings-toggle\"\n type=\"button\"\n @click=${this.toggleTranslationSettings}\n aria-expanded=\"${this.translationSettingsExpanded}\"\n aria-controls=\"${settingsPanelId}\"\n >\n <span\n class=\"translation-settings-arrow ${this\n .translationSettingsExpanded\n ? 'expanded'\n : ''}\"\n ></span>\n </button>\n </div>\n ${this.translationSettingsExpanded\n ? html`<div id=\"${settingsPanelId}\" class=\"translation-settings\">\n <div class=\"translation-settings-row\">\n <temba-checkbox\n name=\"include-categories\"\n label=\"Include categories\"\n ?checked=${includeCategories}\n style=\"--checkbox-padding:5px; border-radius:var(--curvature);\"\n @change=${this.handleIncludeCategoriesChange}\n ></temba-checkbox>\n </div>\n </div>`\n : ''}\n </div>\n </div>\n </temba-floating-window>\n `;\n }\n\n private renderAutoTranslateDialog(): TemplateResult | string {\n if (!this.autoTranslateDialogOpen) {\n return html``;\n }\n\n const selectedModel = this.autoTranslateModel\n ? [this.autoTranslateModel]\n : [];\n const disableTranslate = !this.autoTranslateModel;\n\n return html`\n <temba-dialog\n header=\"Auto translate\"\n .open=${this.autoTranslateDialogOpen}\n primaryButtonName=\"Translate\"\n cancelButtonName=\"Cancel\"\n size=\"small\"\n .disabled=${disableTranslate}\n @temba-button-clicked=${this.handleAutoTranslateDialogButton}\n >\n <div class=\"auto-translate-dialog-content\">\n <p>\n We'll send any untranslated text to the selected AI model and save\n the responses automatically.\n </p>\n <div class=\"auto-translate-models\">\n <temba-select\n class=\"auto-translate-model-select\"\n endpoint=\"${AUTO_TRANSLATE_MODELS_ENDPOINT}\"\n .valueKey=${'uuid'}\n .values=${selectedModel}\n ?searchable=${true}\n ?clearable=${true}\n placeholder=\"Select an AI model\"\n @change=${this.handleAutoTranslateModelChange}\n ></temba-select>\n </div>\n <p>Only text without translations will be sent.</p>\n ${this.autoTranslateError\n ? html`<div class=\"auto-translate-error\">\n ${this.autoTranslateError}\n </div>`\n : ''}\n </div>\n </temba-dialog>\n `;\n }\n\n private renderLocalizationTab(): TemplateResult | string {\n const languages = this.getLocalizationLanguages();\n if (!languages.length) {\n return html``;\n }\n\n return html`\n <temba-floating-tab\n id=\"localization-tab\"\n icon=\"language\"\n label=\"Translate Flow\"\n color=\"#6b7280\"\n top=\"180\"\n .hidden=${!this.localizationWindowHidden}\n @temba-button-clicked=${this.handleLocalizationTabClick}\n ></temba-floating-tab>\n `;\n }\n\n /**\n * Focus on a specific node by smoothly scrolling it to the center of the canvas\n */\n public focusNode(nodeUuid: string) {\n const nodeElement = this.querySelector(\n `temba-flow-node[uuid=\"${nodeUuid}\"]`\n ) as HTMLElement;\n if (!nodeElement) {\n return;\n }\n\n const editor = this.querySelector('#editor') as HTMLElement;\n if (!editor) {\n return;\n }\n\n // Get the editor's dimensions and scroll position\n const editorRect = editor.getBoundingClientRect();\n const editorCenterX = editorRect.width / 2;\n const editorCenterY = editorRect.height / 2;\n\n // Get node position relative to the editor's scroll container\n const nodeRect = nodeElement.getBoundingClientRect();\n const nodeCenterX = nodeElement.offsetLeft + nodeRect.width / 2;\n const nodeCenterY = nodeElement.offsetTop + nodeRect.height / 2;\n\n // Calculate the scroll position needed to center the node\n const targetScrollX = nodeCenterX - editorCenterX;\n const targetScrollY = nodeCenterY - editorCenterY;\n\n // Smooth scroll the editor container to the target position\n editor.scrollTo({\n left: Math.max(0, targetScrollX),\n top: Math.max(0, targetScrollY),\n behavior: 'smooth'\n });\n }\n\n public render(): TemplateResult {\n // we have to embed our own style since we are in light DOM\n const style = html`<style>\n ${unsafeCSS(Editor.styles.cssText)}\n ${unsafeCSS(CanvasNode.styles.cssText)}\n </style>`;\n\n const stickies = this.definition?._ui?.stickies || {};\n\n return html`${style} ${this.renderLocalizationWindow()}\n ${this.renderAutoTranslateDialog()}\n <div id=\"editor\">\n <div\n id=\"grid\"\n style=\"min-width:100%;width:${this.canvasSize.width}px; height:${this\n .canvasSize.height}px\"\n >\n <div id=\"canvas\">\n ${this.definition\n ? repeat(\n this.definition.nodes,\n (node) => node.uuid,\n (node) => {\n const position = this.definition._ui?.nodes[node.uuid]\n ?.position || {\n left: 0,\n top: 0\n };\n\n const dragging =\n this.isDragging &&\n this.currentDragItem?.uuid === node.uuid;\n\n const selected = this.selectedItems.has(node.uuid);\n\n return html`<temba-flow-node\n class=\"draggable ${dragging ? 'dragging' : ''} ${selected\n ? 'selected'\n : ''}\"\n @mousedown=${this.handleMouseDown.bind(this)}\n uuid=${node.uuid}\n data-node-uuid=${node.uuid}\n style=\"left:${position.left}px; top:${position.top}px;transition: all 0.2s ease-in-out;\"\n .plumber=${this.plumber}\n .node=${node}\n .ui=${this.definition._ui.nodes[node.uuid]}\n @temba-node-deleted=${(event) => {\n this.deleteNodes([event.detail.uuid]);\n }}\n ></temba-flow-node>`;\n }\n )\n : html`<temba-loading></temba-loading>`}\n ${repeat(\n Object.entries(stickies),\n ([uuid]) => uuid,\n ([uuid, sticky]) => {\n const position = sticky.position || { left: 0, top: 0 };\n const dragging =\n this.isDragging && this.currentDragItem?.uuid === uuid;\n const selected = this.selectedItems.has(uuid);\n return html`<temba-sticky-note\n class=\"draggable ${dragging ? 'dragging' : ''} ${selected\n ? 'selected'\n : ''}\"\n @mousedown=${this.handleMouseDown.bind(this)}\n style=\"left:${position.left}px; top:${position.top}px;\"\n uuid=${uuid}\n .data=${sticky}\n .dragging=${dragging}\n .selected=${selected}\n ></temba-sticky-note>`;\n }\n )}\n ${this.renderSelectionBox()} ${this.renderCanvasDropPreview()}\n </div>\n </div>\n </div>\n\n ${this.editingNode || this.editingAction\n ? html`<temba-node-editor\n .node=${this.editingNode}\n .nodeUI=${this.editingNodeUI}\n .action=${this.editingAction}\n @temba-node-saved=${(e: CustomEvent) =>\n this.handleNodeSaved(e.detail.node, e.detail.uiConfig)}\n @temba-action-saved=${(e: CustomEvent) =>\n this.handleActionSaved(e.detail.action)}\n @temba-node-edit-cancelled=${this.handleNodeEditCanceled}\n ></temba-node-editor>`\n : ''}\n\n <temba-canvas-menu></temba-canvas-menu>\n <temba-node-type-selector\n .flowType=${this.flowType}\n .features=${this.features}\n ></temba-node-type-selector>\n ${this.renderLocalizationTab()} `;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Editor.js","sourceRoot":"","sources":["../../../src/flow/Editor.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAkB,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,GAAG,EAAoB,SAAS,EAAE,MAAM,KAAK,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAQpD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAY,SAAS,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACvD,OAAO,EAAE,eAAe,EAAa,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAGhD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAK1C,OAAO,EACL,aAAa,EACb,wBAAwB,EAExB,YAAY,EACb,MAAM,SAAS,CAAC;AAEjB,MAAM,UAAU,UAAU,CAAC,KAAa;IACtC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC;IAC5C,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;AA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SAAS,CAAC;yCAC3B;AAGtB;IADP,SAAS,CAAC,OAAO,EAAE,CAAC,KAAe,EAAE,EAAE,CAAC,KAAK,CAAC,kBAAkB,EAAE,CAAC;4CACzC;AAInB;IADP,KAAK,EAAE;0CACmB;AAUnB;IADP,KAAK,EAAE;+CAC6C;AAK7C;IADP,KAAK,EAAE;6CACuC;AAGvC;IADP,KAAK,EAAE;2CACoB;AAGpB;IADP,KAAK,EAAE;4CACyC;AAGzC;IADP,KAAK,EAAE;wCAC+B;AAG/B;IADP,KAAK,EAAE;wCAC+B;AAG/B;IADP,KAAK,EAAE;8CACqC;AAGrC;IADP,KAAK,EAAE;6CACqB;AAGrB;IADP,KAAK,EAAE;wDACgC;AAGhC;IADP,KAAK,EAAE;kDAGN;AAGM;IADP,KAAK,EAAE;2DACoC;AAGpC;IADP,KAAK,EAAE;uDACgC;AAGhC;IADP,KAAK,EAAE;+CACwB;AAGxB;IADP,KAAK,EAAE;kDACmD;AAGnD;IADP,KAAK,EAAE;kDACyC;AAMzC;IADP,KAAK,EAAE;2CACgC;AAGhC;IADP,KAAK,EAAE;6CACoC;AAGpC;IADP,KAAK,EAAE;6CACoC;AAGpC;IADP,KAAK,EAAE;iDAC0B;AAG1B;IADP,KAAK,EAAE;mDACgD;AAIhD;IADP,KAAK,EAAE;iDAOQ;AAER;IADP,KAAK,EAAE;mDAC0C;AAI1C;IADP,KAAK,EAAE;wDAC+C","sourcesContent":["import { html, TemplateResult } from 'lit-html';\nimport { css, PropertyValueMap, unsafeCSS } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport {\n FlowDefinition,\n FlowPosition,\n Action,\n Node,\n NodeUI\n} from '../store/flow-definition';\nimport { getStore } from '../store/Store';\nimport { AppState, fromStore, zustand } from '../store/AppState';\nimport { RapidElement } from '../RapidElement';\nimport { repeat } from 'lit-html/directives/repeat.js';\nimport { CustomEventType, Workspace } from '../interfaces';\nimport { generateUUID, postJSON } from '../utils';\nimport { ACTION_CONFIG, NODE_CONFIG } from './config';\nimport { ACTION_GROUP_METADATA } from './types';\nimport { Checkbox } from '../form/Checkbox';\n\nimport { Plumber } from './Plumber';\nimport { CanvasNode } from './CanvasNode';\nimport { Dialog } from '../layout/Dialog';\nimport { Connection } from '@jsplumb/browser-ui';\nimport { CanvasMenu, CanvasMenuSelection } from './CanvasMenu';\nimport { NodeTypeSelector, NodeTypeSelection } from './NodeTypeSelector';\nimport {\n getNodeBounds,\n calculateReflowPositions,\n NodeBounds,\n nodesOverlap\n} from './utils';\n\nexport function snapToGrid(value: number): number {\n const snapped = Math.round(value / 20) * 20;\n return Math.max(snapped, 0);\n}\n\nexport function findNodeForExit(\n definition: FlowDefinition,\n exitUuid: string\n): string | null {\n for (const node of definition.nodes) {\n const exit = node.exits.find((e) => e.uuid === exitUuid);\n if (exit) {\n return node.uuid;\n }\n }\n return null;\n}\n\nconst SAVE_QUIET_TIME = 500;\n\nexport interface DraggableItem {\n uuid: string;\n position: FlowPosition;\n element: HTMLElement;\n type: 'node' | 'sticky';\n}\n\nexport interface SelectionBox {\n startX: number;\n startY: number;\n endX: number;\n endY: number;\n}\n\nconst DRAG_THRESHOLD = 5;\n\ntype TranslationType = 'property' | 'category';\n\ninterface TranslationEntry {\n uuid: string;\n type: TranslationType;\n attribute: string;\n from: string;\n to: string | null;\n}\n\ninterface TranslationBundle {\n nodeUuid: string;\n actionUuid?: string;\n translations: TranslationEntry[];\n}\n\ninterface TranslationModel {\n uuid: string;\n name: string;\n description?: string;\n}\n\ninterface LocalizationUpdate {\n uuid: string;\n translations: Record<string, string>;\n}\n\nconst AUTO_TRANSLATE_MODELS_ENDPOINT = '/api/internal/llms.json';\n\n// Offset for positioning dropped action node relative to mouse cursor\n// Keep small to make drop location close to cursor position\nconst DROP_PREVIEW_OFFSET_X = 20;\nconst DROP_PREVIEW_OFFSET_Y = 20;\n\nexport class Editor extends RapidElement {\n // unfortunately, jsplumb requires that we be in light DOM\n createRenderRoot() {\n return this;\n }\n\n // this is the master plumber\n private plumber: Plumber;\n\n // timer for debounced saving\n private saveTimer: number | null = null;\n\n @property({ type: String })\n public flow: string;\n\n @property({ type: String })\n public version: string;\n\n @property({ type: String })\n public flowType: string = 'message';\n\n @property({ type: Array })\n public features: string[] = [];\n\n private activityTimer: number | null = null;\n private activityInterval = 100; // Start with 100ms interval for fast initial load\n\n @fromStore(zustand, (state: AppState) => state.flowDefinition)\n private definition!: FlowDefinition;\n\n @fromStore(zustand, (state: AppState) => state.simulatorActive)\n private simulatorActive!: boolean;\n\n @fromStore(zustand, (state: AppState) => state.canvasSize)\n private canvasSize!: { width: number; height: number };\n\n @fromStore(zustand, (state: AppState) => state.dirtyDate)\n private dirtyDate!: Date;\n\n @fromStore(zustand, (state: AppState) => state.languageCode)\n private languageCode!: string;\n\n @fromStore(zustand, (state: AppState) => state.isTranslating)\n private isTranslating!: boolean;\n\n @fromStore(zustand, (state: AppState) => state.workspace)\n private workspace!: Workspace;\n\n @fromStore(zustand, (state: AppState) => state.getCurrentActivity())\n private activityData!: any;\n\n // Drag state\n @state()\n private isDragging = false;\n private isMouseDown = false;\n private dragStartPos = { x: 0, y: 0 };\n\n // Public getter for drag state\n public get dragging(): boolean {\n return this.isDragging;\n }\n\n @state()\n private currentDragItem: DraggableItem | null = null;\n private startPos = { left: 0, top: 0 };\n\n // Selection state\n @state()\n private selectedItems: Set<string> = new Set();\n\n @state()\n private isSelecting = false;\n\n @state()\n private selectionBox: SelectionBox | null = null;\n\n @state()\n private targetId: string | null = null;\n\n @state()\n private sourceId: string | null = null;\n\n @state()\n private dragFromNodeId: string | null = null;\n\n @state()\n private isValidTarget = true;\n\n @state()\n private localizationWindowHidden = true;\n\n @state()\n private translationFilters: { categories: boolean } = {\n categories: false\n };\n\n @state()\n private translationSettingsExpanded = false;\n\n @state()\n private autoTranslateDialogOpen = false;\n\n @state()\n private autoTranslating = false;\n\n @state()\n private autoTranslateModel: TranslationModel | null = null;\n\n @state()\n private autoTranslateError: string | null = null;\n\n private translationCache = new Map<string, string>();\n\n // NodeEditor state - handles both node and action editing\n @state()\n private editingNode: Node | null = null;\n\n @state()\n private editingNodeUI: NodeUI | null = null;\n\n @state()\n private editingAction: Action | null = null;\n\n @state()\n private isCreatingNewNode = false;\n\n @state()\n private pendingNodePosition: FlowPosition | null = null;\n\n // Canvas drop state for dragging actions to canvas\n @state()\n private canvasDropPreview: {\n action: Action;\n nodeUuid: string;\n actionIndex: number;\n position: FlowPosition;\n actionHeight: number;\n } | null = null;\n @state()\n private addActionToNodeUuid: string | null = null;\n\n // Track target node for action drag\n @state()\n private actionDragTargetNodeUuid: string | null = null;\n\n // Track previous target node to clear placeholder when moving between nodes\n private previousActionDragTargetNodeUuid: string | null = null;\n\n private canvasMouseDown = false;\n\n private getAvailableLanguages(): Array<{ code: string; name: string }> {\n // Use languages from workspace if available\n if (this.workspace?.languages && this.workspace.languages.length > 0) {\n const languageNames = new Intl.DisplayNames(['en'], { type: 'language' });\n return this.workspace.languages\n .map((code) => {\n try {\n const name = languageNames.of(code);\n return name ? { code, name } : { code, name: code };\n } catch {\n return { code, name: code };\n }\n })\n .filter((lang) => lang.code && lang.name);\n }\n\n // Fall back to flow definition languages if available\n if (\n this.definition?._ui?.languages &&\n this.definition._ui.languages.length > 0\n ) {\n return this.definition._ui.languages.map((lang: any) => ({\n code: typeof lang === 'string' ? lang : lang.iso || lang.code,\n name: typeof lang === 'string' ? lang : lang.name\n }));\n }\n\n // No languages available\n return [];\n }\n\n // Bound event handlers to maintain proper 'this' context\n private boundMouseMove = this.handleMouseMove.bind(this);\n private boundMouseUp = this.handleMouseUp.bind(this);\n private boundGlobalMouseDown = this.handleGlobalMouseDown.bind(this);\n private boundKeyDown = this.handleKeyDown.bind(this);\n private boundCanvasContextMenu = this.handleCanvasContextMenu.bind(this);\n\n static get styles() {\n return css`\n #editor {\n overflow: scroll;\n flex: 1;\n -webkit-font-smoothing: antialiased;\n }\n\n #grid {\n position: relative;\n background-color: #f9f9f9;\n background-image: radial-gradient(\n circle,\n rgba(61, 177, 255, 0.3) 1px,\n transparent 1px\n );\n background-size: 20px 20px;\n background-position: 10px 10px;\n width: 100%;\n display: flex;\n }\n\n #canvas {\n position: relative;\n padding: 0px;\n flex-grow: 1;\n margin: 20px;\n }\n\n #canvas > .draggable {\n position: absolute;\n z-index: 100;\n }\n\n #canvas > .dragging {\n z-index: 99999 !important;\n transition: none !important;\n }\n\n body .jtk-endpoint {\n width: initial;\n height: initial;\n }\n\n .jtk-endpoint {\n z-index: 600;\n opacity: 0;\n }\n\n .plumb-source {\n z-index: 600;\n cursor: pointer;\n opacity: 0;\n }\n\n .plumb-source.connected {\n border-radius: 50%;\n pointer-events: none;\n }\n\n .plumb-source circle {\n fill: purple;\n }\n\n .plumb-target {\n z-index: 600;\n opacity: 0;\n cursor: pointer;\n fill: transparent;\n }\n\n body svg.jtk-connector.plumb-connector path {\n stroke: var(--color-connectors) !important;\n stroke-width: 3px;\n }\n\n body .plumb-connector {\n z-index: 10 !important;\n }\n\n body .plumb-connector .plumb-arrow {\n fill: var(--color-connectors);\n stroke: var(--color-connectors);\n stroke-width: 0px !important;\n margin-top: 6px;\n z-index: 10;\n }\n\n body svg.jtk-connector.jtk-hover path {\n stroke: var(--color-success) !important;\n stroke-width: 3px;\n }\n\n body .plumb-connector.jtk-hover .plumb-arrow {\n fill: var(--color-success) !important;\n stroke-width: 0px;\n z-index: 10;\n }\n\n /* Activity overlays on connections */\n .jtk-overlay.activity-overlay {\n background: #f3f3f3;\n border: 1px solid #d9d9d9;\n color: #333;\n border-radius: 4px;\n padding: 2px 4px;\n font-size: 10px;\n font-weight: 600;\n line-height: 0.9;\n cursor: pointer;\n z-index: 500;\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);\n }\n\n /* Active contact count on nodes */\n .active-count {\n position: absolute;\n background: #3498db;\n border: 1px solid #2980b9;\n border-radius: 12px;\n padding: 3px 5px;\n color: #fff;\n font-weight: 500;\n top: -10px;\n left: -10px;\n font-size: 13px;\n min-width: 22px;\n text-align: center;\n z-index: 600;\n line-height: 1;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);\n }\n\n /* Recent contacts popup */\n @keyframes popupBounceIn {\n 0% {\n transform: scale(0.8);\n opacity: 0;\n }\n 50% {\n transform: scale(1.05);\n }\n 100% {\n transform: scale(1);\n opacity: 1;\n }\n }\n\n .recent-contacts-popup {\n display: none;\n position: absolute;\n width: 200px;\n background: #f3f3f3;\n border-radius: 10px;\n box-shadow: 0 1px 3px 1px rgba(130, 130, 130, 0.2);\n z-index: 1015;\n transform-origin: top center;\n }\n\n .recent-contacts-popup.show {\n display: block;\n animation: popupBounceIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);\n }\n\n .recent-contacts-popup .popup-title {\n background: #999;\n color: #fff;\n padding: 6px 0;\n text-align: center;\n border-top-left-radius: 10px;\n border-top-right-radius: 10px;\n font-size: 12px;\n }\n\n .recent-contacts-popup .no-contacts-message {\n padding: 15px;\n text-align: center;\n color: #999;\n font-size: 12px;\n }\n\n .recent-contacts-popup .contact-row {\n padding: 8px 10px;\n border-top: 1px solid #e0e0e0;\n text-align: left;\n }\n\n .recent-contacts-popup .contact-row:last-child {\n border-bottom-left-radius: 10px;\n border-bottom-right-radius: 10px;\n }\n\n .recent-contacts-popup .contact-name {\n display: block;\n font-weight: 500;\n font-size: 12px;\n color: var(--color-link-primary, #1d4ed8);\n cursor: pointer;\n }\n\n .recent-contacts-popup .contact-name:hover {\n text-decoration: underline;\n color: var(--color-link-primary, #1d4ed8);\n }\n\n .recent-contacts-popup .contact-operand {\n padding-top: 3px;\n font-size: 11px;\n color: #666;\n word-wrap: break-word;\n }\n\n .recent-contacts-popup .contact-time {\n padding-top: 3px;\n font-size: 10px;\n color: #999;\n }\n\n /* Connection dragging feedback */\n body svg.jtk-connector.jtk-dragging {\n z-index: 99999 !important;\n }\n\n .katavorio-drag-no-select svg.jtk-connector path,\n .katavorio-drag-no-select svg.jtk-endpoint path {\n pointer-events: none !important;\n border: 1px solid purple;\n }\n\n /* Connection target feedback */\n temba-flow-node.connection-target-valid {\n outline: 3px solid var(--color-success, #22c55e) !important;\n outline-offset: 2px;\n border-radius: var(--curvature);\n }\n\n temba-flow-node.connection-target-invalid {\n outline: 3px solid var(--color-error, #ef4444) !important;\n outline-offset: 2px;\n border-radius: var(--curvature);\n }\n\n /* Selection box styles */\n .selection-box {\n position: absolute;\n border: 2px dashed #6298f0ff;\n background-color: rgba(59, 130, 246, 0.1);\n z-index: 9999;\n pointer-events: none;\n }\n\n /* Selected item styles */\n .draggable.selected {\n outline: 3px solid #6298f0ff;\n outline-offset: 0px;\n border-radius: var(--curvature);\n }\n\n .jtk-floating-endpoint {\n pointer-events: none;\n }\n\n .localization-window-content {\n display: flex;\n flex-direction: column;\n gap: 16px;\n height: 100%;\n }\n\n .localization-header {\n font-size: 13px;\n color: #4b5563;\n line-height: 1.4;\n }\n\n .localization-language-select {\n --color-widget-border: #d1d5db;\n --color-widget-background: #fff;\n }\n\n .localization-language-row {\n display: flex;\n align-items: flex-end;\n gap: 12px;\n }\n\n .localization-language-row temba-select {\n flex: 1;\n }\n\n .localization-progress {\n margin-top: auto;\n display: flex;\n flex-direction: column;\n gap: 8px;\n }\n\n .localization-progress-bar-row {\n display: flex;\n align-items: center;\n gap: 8px;\n }\n\n .localization-progress-trigger {\n flex: 1;\n border-radius: 6px;\n cursor: pointer;\n display: flex;\n align-items: center;\n }\n\n .localization-progress-trigger:focus-visible {\n outline: 2px solid #94a3b8;\n outline-offset: 2px;\n }\n\n .localization-progress-trigger temba-progress {\n flex: 1;\n }\n\n .localization-progress h5 {\n margin: 0;\n font-size: 13px;\n font-weight: 600;\n color: #374151;\n }\n\n .localization-progress-summary {\n font-size: 12px;\n color: #6b7280;\n display: flex;\n align-items: center;\n gap: 6px;\n min-height: 20px;\n }\n\n .translation-settings-toggle {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n background: transparent;\n border: none;\n color: #6b7280;\n font-size: 12px;\n font-weight: 600;\n cursor: pointer;\n padding: 4px;\n border-radius: 4px;\n }\n\n .translation-settings-label {\n font-size: 12px;\n color: #6b7280;\n }\n\n .translation-settings-toggle:focus-visible {\n outline: 2px solid #94a3b8;\n outline-offset: 2px;\n }\n\n .translation-settings-arrow {\n width: 8px;\n height: 8px;\n border-right: 2px solid currentColor;\n border-bottom: 2px solid currentColor;\n transform: rotate(-45deg);\n transition: transform 0.2s ease;\n margin-left: 2px;\n }\n\n .translation-settings-arrow.expanded {\n transform: rotate(45deg);\n }\n\n .translation-settings {\n }\n\n .translation-settings-row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n }\n\n .translation-settings-row temba-checkbox {\n width: 100%;\n }\n\n .auto-translate-button {\n background: var(--color-primary-dark);\n border: none;\n color: #fff;\n padding: 10px 12px;\n border-radius: var(--curvature);\n font-size: 12px;\n font-weight: 600;\n cursor: pointer;\n transition: opacity 0.2s ease;\n }\n\n .auto-translate-button[disabled] {\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n .auto-translate-error {\n font-size: 12px;\n color: #b91c1c;\n }\n\n .auto-translate-dialog-content {\n padding: 20px;\n display: flex;\n flex-direction: column;\n gap: 12px;\n font-size: 14px;\n color: #374151;\n }\n\n .auto-translate-dialog-content p {\n margin: 0;\n }\n\n .auto-translate-loading {\n display: flex;\n align-items: center;\n gap: 8px;\n font-size: 13px;\n color: #6b7280;\n }\n\n .auto-translate-empty {\n font-size: 13px;\n color: #6b7280;\n }\n\n .localization-empty {\n font-size: 13px;\n color: #9ca3af;\n white-space: nowrap;\n }\n `;\n }\n\n constructor() {\n super();\n }\n\n protected firstUpdated(\n changes: PropertyValueMap<any> | Map<PropertyKey, unknown>\n ): void {\n super.firstUpdated(changes);\n this.plumber = new Plumber(this.querySelector('#canvas'), this);\n this.setupGlobalEventListeners();\n if (changes.has('flow')) {\n getStore().getState().fetchRevision(`/flow/revisions/${this.flow}`);\n }\n\n this.plumber.on('connection:drag', (info: Connection) => {\n this.dragFromNodeId = document\n .getElementById(info.sourceId)\n .closest('.node').id;\n this.sourceId = info.sourceId;\n });\n\n this.plumber.on('connection:abort', () => {\n this.makeConnection();\n });\n\n this.plumber.on('connection:detach', () => {\n this.makeConnection();\n });\n }\n\n private makeConnection() {\n if (this.sourceId && this.targetId && this.isValidTarget) {\n this.plumber.connectIds(\n this.dragFromNodeId,\n this.sourceId,\n this.targetId\n );\n getStore()\n .getState()\n .updateConnection(this.dragFromNodeId, this.sourceId, this.targetId);\n\n setTimeout(() => {\n this.plumber.repaintEverything();\n }, 100);\n }\n\n // Clean up visual feedback\n document.querySelectorAll('temba-flow-node').forEach((node) => {\n node.classList.remove(\n 'connection-target-valid',\n 'connection-target-invalid'\n );\n });\n\n this.sourceId = null;\n this.targetId = null;\n this.dragFromNodeId = null;\n this.isValidTarget = true;\n }\n\n protected updated(\n changes: PropertyValueMap<any> | Map<PropertyKey, unknown>\n ): void {\n super.updated(changes);\n if (changes.has('canvasSize')) {\n // console.log('Setting canvas size', this.canvasSize);\n }\n\n if (changes.has('definition')) {\n this.updateCanvasSize();\n\n // Set flowType from the loaded definition\n if (this.definition?.type) {\n this.flowType = this.getFlowTypeFromDefinition(this.definition.type);\n }\n\n const filters = this.definition?._ui?.translation_filters || {\n categories: false\n };\n const normalizedFilters = {\n categories: !!filters.categories\n };\n\n if (this.translationFilters.categories !== normalizedFilters.categories) {\n this.translationFilters = normalizedFilters;\n }\n\n this.translationCache.clear();\n\n // Start fetching activity data when definition is loaded\n if (this.definition?.uuid) {\n this.startActivityFetching();\n }\n }\n\n if (changes.has('simulatorActive')) {\n if (this.simulatorActive) {\n // Stop polling when simulator becomes active\n this.stopActivityFetching();\n } else {\n // Resume polling and refresh activity when simulator closes\n this.activityInterval = 100; // Reset to fast initial interval\n this.startActivityFetching();\n }\n }\n\n if (changes.has('activityData')) {\n // Update plumber with new activity data\n if (this.plumber) {\n this.plumber.setActivityData(this.activityData);\n }\n }\n\n if (changes.has('dirtyDate')) {\n if (this.dirtyDate) {\n this.debouncedSave();\n }\n }\n\n if (changes.has('languageCode')) {\n this.translationCache.clear();\n }\n }\n\n /**\n * Map FlowDefinition type to Editor flowType\n * FlowDefinition uses: 'messaging', 'messaging_background', 'messaging_offline', 'voice'\n * Editor uses: 'message', 'voice', 'background'\n */\n private getFlowTypeFromDefinition(definitionType: string): string {\n if (definitionType === 'voice') {\n return 'voice';\n } else if (\n definitionType === 'messaging_background' ||\n definitionType === 'messaging_offline'\n ) {\n return 'background';\n } else {\n // 'messaging' or any other messaging type defaults to 'message'\n return 'message';\n }\n }\n\n private debouncedSave(): void {\n // Clear any existing timer\n if (this.saveTimer !== null) {\n clearTimeout(this.saveTimer);\n }\n\n this.saveTimer = window.setTimeout(() => {\n const now = new Date();\n const timeSinceLastChange = now.getTime() - this.dirtyDate.getTime();\n\n if (timeSinceLastChange >= SAVE_QUIET_TIME) {\n this.saveChanges();\n this.saveTimer = null;\n } else {\n this.debouncedSave();\n }\n }, SAVE_QUIET_TIME);\n }\n\n private saveChanges(): void {\n // post the flow definition to the server\n getStore()\n .postJSON(`/flow/revisions/${this.flow}/`, this.definition)\n .then((response) => {\n // Update flow info and revision with the response data\n if (response.json) {\n const state = getStore().getState();\n\n if (response.json.info) {\n state.setFlowInfo(response.json.info);\n }\n\n if (response.json.revision?.revision !== undefined) {\n state.setRevision(response.json.revision.revision);\n }\n }\n })\n .catch((error) => {\n console.error('Failed to save flow:', error);\n });\n\n getStore().getState().setDirtyDate(null);\n }\n\n private startActivityFetching(): void {\n // Don't start if simulator is active\n if (this.simulatorActive) {\n return;\n }\n // Fetch immediately\n this.fetchActivityData();\n }\n\n private stopActivityFetching(): void {\n if (this.activityTimer !== null) {\n clearTimeout(this.activityTimer);\n this.activityTimer = null;\n }\n }\n\n private fetchActivityData(): void {\n if (!this.definition?.uuid) {\n return;\n }\n\n // Don't fetch if simulator is active\n if (this.simulatorActive) {\n return;\n }\n\n const activityEndpoint = `/flow/activity/${this.definition.uuid}/`;\n const store = getStore();\n if (!store) {\n return;\n }\n const state = store.getState();\n state.fetchActivity(activityEndpoint).then(() => {\n // Schedule next fetch with exponential backoff (max 5 minutes)\n this.activityInterval = Math.min(60000 * 5, this.activityInterval + 100);\n\n if (this.activityTimer !== null) {\n clearTimeout(this.activityTimer);\n }\n\n this.activityTimer = window.setTimeout(() => {\n this.fetchActivityData();\n }, this.activityInterval);\n });\n }\n\n private handleLanguageChange(languageCode: string): void {\n zustand.getState().setLanguageCode(languageCode);\n\n // Repaint connections after language change since node sizes can change\n if (this.plumber) {\n requestAnimationFrame(() => {\n this.plumber.repaintEverything();\n });\n }\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n if (this.saveTimer !== null) {\n clearTimeout(this.saveTimer);\n this.saveTimer = null;\n }\n if (this.activityTimer !== null) {\n clearTimeout(this.activityTimer);\n this.activityTimer = null;\n }\n document.removeEventListener('mousemove', this.boundMouseMove);\n document.removeEventListener('mouseup', this.boundMouseUp);\n document.removeEventListener('mousedown', this.boundGlobalMouseDown);\n document.removeEventListener('keydown', this.boundKeyDown);\n\n const canvas = this.querySelector('#canvas');\n if (canvas) {\n canvas.removeEventListener('contextmenu', this.boundCanvasContextMenu);\n }\n }\n\n private setupGlobalEventListeners(): void {\n document.addEventListener('mousemove', this.boundMouseMove);\n document.addEventListener('mouseup', this.boundMouseUp);\n document.addEventListener('mousedown', this.boundGlobalMouseDown);\n document.addEventListener('keydown', this.boundKeyDown);\n\n const canvas = this.querySelector('#canvas');\n if (canvas) {\n canvas.addEventListener('contextmenu', this.boundCanvasContextMenu);\n }\n\n // Listen for action edit requests from flow nodes\n this.addEventListener(\n CustomEventType.ActionEditRequested,\n this.handleActionEditRequested.bind(this)\n );\n\n // Listen for add action requests from flow nodes\n this.addEventListener(\n CustomEventType.AddActionRequested,\n this.handleAddActionRequested.bind(this)\n );\n\n // Listen for node edit requests from flow nodes\n this.addEventListener(\n CustomEventType.NodeEditRequested,\n this.handleNodeEditRequested.bind(this)\n );\n\n // Listen for node deletion events\n this.addEventListener(\n CustomEventType.NodeDeleted,\n this.handleNodeDeleted.bind(this)\n );\n\n // Listen for canvas menu selections\n this.addEventListener(CustomEventType.Selection, (event: CustomEvent) => {\n const target = event.target as HTMLElement;\n if (target.tagName === 'TEMBA-CANVAS-MENU') {\n this.handleCanvasMenuSelection(event);\n } else if (target.tagName === 'TEMBA-NODE-TYPE-SELECTOR') {\n this.handleNodeTypeSelection(event);\n }\n });\n\n // Listen for action drag events from nodes\n this.addEventListener(\n CustomEventType.DragExternal,\n this.handleActionDragExternal.bind(this)\n );\n\n this.addEventListener(\n CustomEventType.DragInternal,\n this.handleActionDragInternal.bind(this)\n );\n\n this.addEventListener(CustomEventType.DragStop, (event: CustomEvent) => {\n if (event.detail.isExternal) {\n this.handleActionDropExternal(event);\n }\n });\n }\n\n private getPosition(uuid: string, type: 'node' | 'sticky'): FlowPosition {\n if (type === 'node') {\n return this.definition._ui.nodes[uuid]?.position;\n } else {\n return this.definition._ui.stickies?.[uuid]?.position;\n }\n }\n\n private handleMouseDown(event: MouseEvent): void {\n // ignore right clicks\n if (event.button !== 0) return;\n\n const element = event.currentTarget as HTMLElement;\n // Only start dragging if clicking on the element itself, not on exits or other interactive elements\n const target = event.target as HTMLElement;\n if (target.classList.contains('exit') || target.closest('.exit')) {\n return;\n }\n\n const uuid = element.getAttribute('uuid');\n const type = element.tagName === 'TEMBA-FLOW-NODE' ? 'node' : 'sticky';\n\n const position = this.getPosition(uuid, type);\n if (!position) return;\n\n // If clicking on a non-selected item, clear selection unless Ctrl/Cmd is held\n if (!this.selectedItems.has(uuid) && !event.ctrlKey && !event.metaKey) {\n this.selectedItems.clear();\n // Don't add single items to selection - single clicks just clear existing selection\n } else if (!this.selectedItems.has(uuid)) {\n // Add this item to selection only if Ctrl/Cmd is held\n this.selectedItems.add(uuid);\n }\n\n // Always set up drag state regardless of selection status\n // This allows single nodes to be dragged without being selected\n this.isMouseDown = true;\n this.dragStartPos = { x: event.clientX, y: event.clientY };\n this.startPos = { left: position.left, top: position.top };\n this.currentDragItem = {\n uuid,\n position,\n element,\n type\n };\n\n event.preventDefault();\n event.stopPropagation();\n }\n\n private handleGlobalMouseDown(event: MouseEvent): void {\n // ignore right clicks\n if (event.button !== 0) return;\n\n // Check if the click is within our canvas\n const canvasRect = this.querySelector('#grid')?.getBoundingClientRect();\n\n if (!canvasRect) return;\n\n const isWithinCanvas =\n event.clientX >= canvasRect.left &&\n event.clientX <= canvasRect.right &&\n event.clientY >= canvasRect.top &&\n event.clientY <= canvasRect.bottom;\n\n if (!isWithinCanvas) return;\n\n // Check if we clicked on a draggable item (node or sticky)\n const target = event.target as HTMLElement;\n const clickedOnDraggable = target.closest('.draggable');\n\n if (clickedOnDraggable) {\n // This is handled by the individual item mousedown handlers\n return;\n }\n\n // We clicked on empty canvas space, start selection\n this.handleCanvasMouseDown(event);\n }\n\n private handleCanvasMouseDown(event: MouseEvent): void {\n const target = event.target as HTMLElement;\n if (target.id === 'canvas' || target.id === 'grid') {\n // Ignore clicks on exits\n\n // Start selection box\n this.canvasMouseDown = true;\n this.dragStartPos = { x: event.clientX, y: event.clientY };\n\n const canvasRect = this.querySelector('#canvas')?.getBoundingClientRect();\n if (canvasRect) {\n // Clear current selection\n this.selectedItems.clear();\n\n const relativeX = event.clientX - canvasRect.left;\n const relativeY = event.clientY - canvasRect.top;\n\n this.selectionBox = {\n startX: relativeX,\n startY: relativeY,\n endX: relativeX,\n endY: relativeY\n };\n }\n\n event.preventDefault();\n }\n }\n\n private handleKeyDown(event: KeyboardEvent): void {\n if (event.key === 'Delete' || event.key === 'Backspace') {\n if (this.selectedItems.size > 0) {\n this.showDeleteConfirmation();\n }\n }\n if (event.key === 'Escape') {\n this.selectedItems.clear();\n this.requestUpdate();\n }\n }\n\n private showDeleteConfirmation(): void {\n const itemCount = this.selectedItems.size;\n const itemType = itemCount === 1 ? 'item' : 'items';\n\n // Create and show confirmation dialog\n const dialog = document.createElement('temba-dialog') as Dialog;\n dialog.header = 'Delete Items';\n dialog.primaryButtonName = 'Delete';\n dialog.cancelButtonName = 'Cancel';\n dialog.destructive = true;\n dialog.innerHTML = `<div style=\"padding: 20px;\">Are you sure you want to delete ${itemCount} ${itemType}?</div>`;\n\n dialog.addEventListener('temba-button-clicked', (event: any) => {\n if (event.detail.button.name === 'Delete') {\n this.deleteSelectedItems();\n dialog.open = false;\n }\n });\n\n // Add to document and show\n document.body.appendChild(dialog);\n dialog.open = true;\n\n // Clean up dialog when closed\n dialog.addEventListener('temba-dialog-hidden', () => {\n document.body.removeChild(dialog);\n });\n }\n\n private deleteNodes(uuids: string[]): void {\n // Clean up jsPlumb connections for nodes before removing them\n uuids.forEach((uuid) => {\n this.plumber.removeNodeConnections(uuid);\n });\n\n // Now remove them from the definition\n if (uuids.length > 0 && this.plumber) {\n getStore().getState().removeNodes(uuids);\n }\n }\n\n private deleteSelectedItems(): void {\n const nodes = Array.from(this.selectedItems).filter((uuid) =>\n this.definition.nodes.some((node) => node.uuid === uuid)\n );\n this.deleteNodes(Array.from(nodes));\n\n const stickies = Array.from(this.selectedItems).filter(\n (uuid) => this.definition._ui?.stickies?.[uuid]\n );\n\n getStore().getState().removeStickyNotes(stickies);\n\n // Clear selection\n this.selectedItems.clear();\n }\n\n private updateSelectionBox(event: MouseEvent): void {\n if (!this.selectionBox || !this.canvasMouseDown) return;\n\n const canvasRect = this.querySelector('#canvas')?.getBoundingClientRect();\n if (!canvasRect) return;\n\n const relativeX = event.clientX - canvasRect.left;\n const relativeY = event.clientY - canvasRect.top;\n\n this.selectionBox = {\n ...this.selectionBox,\n endX: relativeX,\n endY: relativeY\n };\n\n // Update selected items based on selection box\n this.updateSelectedItemsFromBox();\n }\n\n private updateSelectedItemsFromBox(): void {\n if (!this.selectionBox) return;\n\n const newSelection = new Set<string>();\n\n const boxLeft = Math.min(this.selectionBox.startX, this.selectionBox.endX);\n const boxTop = Math.min(this.selectionBox.startY, this.selectionBox.endY);\n const boxRight = Math.max(this.selectionBox.startX, this.selectionBox.endX);\n const boxBottom = Math.max(\n this.selectionBox.startY,\n this.selectionBox.endY\n );\n\n // Check nodes\n this.definition?.nodes.forEach((node) => {\n const nodeElement = this.querySelector(`[id=\"${node.uuid}\"]`);\n if (nodeElement) {\n const position = this.definition._ui?.nodes[node.uuid]?.position;\n if (position) {\n const rect = nodeElement.getBoundingClientRect();\n const canvasRect =\n this.querySelector('#canvas')?.getBoundingClientRect();\n\n if (canvasRect) {\n const nodeLeft = position.left;\n const nodeTop = position.top;\n const nodeRight = nodeLeft + rect.width;\n const nodeBottom = nodeTop + rect.height;\n\n // Check if selection box intersects with node\n if (\n boxLeft < nodeRight &&\n boxRight > nodeLeft &&\n boxTop < nodeBottom &&\n boxBottom > nodeTop\n ) {\n newSelection.add(node.uuid);\n }\n }\n }\n }\n });\n\n // Check sticky notes\n const stickies = this.definition?._ui?.stickies || {};\n Object.entries(stickies).forEach(([uuid, sticky]) => {\n if (sticky.position) {\n const stickyElement = this.querySelector(\n `temba-sticky-note[uuid=\"${uuid}\"]`\n ) as HTMLElement;\n\n if (stickyElement) {\n // Use clientWidth/clientHeight instead of getBoundingClientRect() to get element dimensions\n // This avoids the coordinate system mismatch between viewport and canvas coordinates\n const width = stickyElement.clientWidth;\n const height = stickyElement.clientHeight;\n\n // Use the canvas coordinates from the sticky's position\n const stickyLeft = sticky.position.left;\n const stickyTop = sticky.position.top;\n const stickyRight = stickyLeft + width;\n const stickyBottom = stickyTop + height;\n\n // Check if selection box intersects with sticky\n if (\n boxLeft < stickyRight &&\n boxRight > stickyLeft &&\n boxTop < stickyBottom &&\n boxBottom > stickyTop\n ) {\n newSelection.add(uuid);\n }\n }\n }\n });\n\n this.selectedItems = newSelection;\n }\n\n private renderSelectionBox(): TemplateResult | string {\n if (!this.selectionBox || !this.isSelecting) return '';\n\n const left = Math.min(this.selectionBox.startX, this.selectionBox.endX);\n const top = Math.min(this.selectionBox.startY, this.selectionBox.endY);\n const width = Math.abs(this.selectionBox.endX - this.selectionBox.startX);\n const height = Math.abs(this.selectionBox.endY - this.selectionBox.startY);\n\n return html`<div\n class=\"selection-box\"\n style=\"left: ${left}px; top: ${top}px; width: ${width}px; height: ${height}px;\"\n ></div>`;\n }\n\n private renderCanvasDropPreview(): TemplateResult | string {\n if (!this.canvasDropPreview) return '';\n\n const { action, position } = this.canvasDropPreview;\n const actionConfig = ACTION_CONFIG[action.type];\n\n if (!actionConfig) return '';\n\n return html`<div\n class=\"canvas-drop-preview\"\n style=\"position: absolute; left: ${position.left}px; top: ${position.top}px; opacity: 0.6; pointer-events: none; z-index: 10000;\"\n >\n <div\n class=\"node execute-actions\"\n style=\"outline: 3px dashed var(--color-primary, #3b82f6); outline-offset: 2px; border-radius: var(--curvature);\"\n >\n <div class=\"action sortable ${action.type}\">\n <div class=\"action-content\">\n <div\n class=\"cn-title\"\n style=\"background: ${actionConfig.group\n ? ACTION_GROUP_METADATA[actionConfig.group]?.color\n : '#aaaaaa'}\"\n >\n <div class=\"title-spacer\"></div>\n <div class=\"name\">${actionConfig.name}</div>\n <div class=\"title-spacer\"></div>\n </div>\n <div class=\"body\">\n ${actionConfig.render\n ? actionConfig.render({ actions: [action] } as any, action)\n : html`<pre>${action.type}</pre>`}\n </div>\n </div>\n </div>\n <div class=\"action-exits\">\n <div class=\"exit-wrapper\">\n <div class=\"exit\"></div>\n </div>\n </div>\n </div>\n </div>`;\n }\n\n /**\n * Checks for node collisions and reflows nodes as needed.\n * Nodes are only moved downward to resolve collisions.\n *\n * @param movedNodeUuids - UUIDs of nodes that were just moved/dropped\n * @param droppedNodeUuid - UUID of the specific node that was dropped (if applicable)\n * @param dropTargetBounds - Bounds of the node that was dropped onto (if applicable)\n */\n private checkCollisionsAndReflow(\n movedNodeUuids: string[],\n droppedNodeUuid: string | null = null,\n dropTargetBounds: NodeBounds | null = null\n ): void {\n if (!this.definition) return;\n\n // Get all node bounds (only for actual nodes, not stickies)\n const allBounds: NodeBounds[] = [];\n\n for (const node of this.definition.nodes) {\n const nodeUI = this.definition._ui?.nodes[node.uuid];\n if (!nodeUI?.position) continue;\n\n const bounds = getNodeBounds(node.uuid, nodeUI.position);\n if (bounds) {\n allBounds.push(bounds);\n }\n }\n\n // Check if we need to determine midpoint priority for a dropped node\n let targetHasPriority = false;\n if (droppedNodeUuid && dropTargetBounds) {\n const droppedBounds = allBounds.find((b) => b.uuid === droppedNodeUuid);\n if (droppedBounds) {\n // Check if the bottom of the dropped node is below the midpoint of the target\n // If bottom is above midpoint, dropped node gets preference (targetHasPriority = false)\n // If bottom is below midpoint, target gets preference (targetHasPriority = true)\n const droppedBottom = droppedBounds.bottom;\n const targetMidpoint =\n dropTargetBounds.top + dropTargetBounds.height / 2;\n targetHasPriority = droppedBottom > targetMidpoint;\n }\n }\n\n // Calculate reflow positions for each moved node\n const allReflowPositions: { [uuid: string]: FlowPosition } = {};\n\n for (const movedUuid of movedNodeUuids) {\n const movedBounds = allBounds.find((b) => b.uuid === movedUuid);\n if (!movedBounds) continue;\n\n // Calculate reflow for this moved node\n const reflowPositions = calculateReflowPositions(\n movedUuid,\n movedBounds,\n allBounds,\n droppedNodeUuid === movedUuid ? targetHasPriority : false\n );\n\n // Merge into all reflow positions\n for (const [uuid, position] of reflowPositions.entries()) {\n allReflowPositions[uuid] = position;\n }\n }\n\n // If there are positions to update, apply them\n if (Object.keys(allReflowPositions).length > 0) {\n getStore().getState().updateCanvasPositions(allReflowPositions);\n }\n }\n\n private handleMouseMove(event: MouseEvent): void {\n // Handle selection box drawing\n if (this.canvasMouseDown && !this.isMouseDown) {\n this.isSelecting = true;\n this.updateSelectionBox(event);\n this.requestUpdate(); // Force re-render\n return;\n }\n\n if (this.plumber.connectionDragging) {\n const targetNode = document.querySelector('temba-flow-node:hover');\n\n // Clear previous target styles\n document.querySelectorAll('temba-flow-node').forEach((node) => {\n node.classList.remove(\n 'connection-target-valid',\n 'connection-target-invalid'\n );\n });\n\n if (targetNode) {\n this.targetId = targetNode.getAttribute('uuid');\n // Check if target is different from source node (prevent self-targeting)\n this.isValidTarget = this.targetId !== this.dragFromNodeId;\n\n // Apply visual feedback based on validity\n if (this.isValidTarget) {\n targetNode.classList.add('connection-target-valid');\n } else {\n targetNode.classList.add('connection-target-invalid');\n }\n } else {\n this.targetId = null;\n this.isValidTarget = true;\n }\n }\n\n // Handle item dragging\n if (!this.isMouseDown || !this.currentDragItem) return;\n\n const deltaX = event.clientX - this.dragStartPos.x;\n const deltaY = event.clientY - this.dragStartPos.y;\n const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);\n\n // Only start dragging if we've moved beyond the threshold\n if (!this.isDragging && distance > DRAG_THRESHOLD) {\n this.isDragging = true;\n }\n\n // If we're actually dragging, update positions\n if (this.isDragging) {\n // Determine what items to move\n const itemsToMove =\n this.selectedItems.has(this.currentDragItem.uuid) &&\n this.selectedItems.size > 1\n ? Array.from(this.selectedItems)\n : [this.currentDragItem.uuid];\n\n itemsToMove.forEach((uuid) => {\n const element = this.querySelector(`[uuid=\"${uuid}\"]`) as HTMLElement;\n if (element) {\n const type =\n element.tagName === 'TEMBA-FLOW-NODE' ? 'node' : 'sticky';\n const position = this.getPosition(uuid, type);\n\n if (position) {\n const newLeft = position.left + deltaX;\n const newTop = position.top + deltaY;\n\n // Update the visual position during drag\n element.style.left = `${newLeft}px`;\n element.style.top = `${newTop}px`;\n\n // Add dragging class to ensure highest z-index\n element.classList.add('dragging');\n }\n }\n });\n\n this.plumber.revalidate(itemsToMove);\n }\n }\n\n private handleMouseUp(event: MouseEvent): void {\n // Handle selection box completion\n if (this.canvasMouseDown && this.isSelecting) {\n this.isSelecting = false;\n this.selectionBox = null;\n this.canvasMouseDown = false;\n this.requestUpdate();\n return;\n }\n\n // Handle canvas click (clear selection)\n if (this.canvasMouseDown && !this.isSelecting) {\n this.canvasMouseDown = false;\n return;\n }\n\n // Handle item drag completion\n if (!this.isMouseDown || !this.currentDragItem) return;\n\n // If we were actually dragging, handle the drag end\n if (this.isDragging) {\n const deltaX = event.clientX - this.dragStartPos.x;\n const deltaY = event.clientY - this.dragStartPos.y;\n\n // Determine what items were moved\n const itemsToMove =\n this.selectedItems.has(this.currentDragItem.uuid) &&\n this.selectedItems.size > 1\n ? Array.from(this.selectedItems)\n : [this.currentDragItem.uuid];\n\n // Update positions for all moved items\n const newPositions: { [uuid: string]: FlowPosition } = {};\n\n itemsToMove.forEach((uuid) => {\n const type = this.definition.nodes.find((node) => node.uuid === uuid)\n ? 'node'\n : 'sticky';\n const position = this.getPosition(uuid, type);\n\n if (position) {\n const newLeft = position.left + deltaX;\n const newTop = position.top + deltaY;\n\n // Snap to 20px grid for final position\n const snappedLeft = snapToGrid(newLeft);\n const snappedTop = snapToGrid(newTop);\n\n const newPosition = { left: snappedLeft, top: snappedTop };\n newPositions[uuid] = newPosition;\n\n // Remove dragging class\n const element = this.querySelector(`[uuid=\"${uuid}\"]`) as HTMLElement;\n if (element) {\n element.classList.remove('dragging');\n element.style.left = `${snappedLeft}px`;\n element.style.top = `${snappedTop}px`;\n }\n }\n });\n\n if (Object.keys(newPositions).length > 0) {\n getStore().getState().updateCanvasPositions(newPositions);\n\n // Check for collisions and reflow nodes after updating positions\n // Filter to only check nodes (not stickies)\n const nodeUuids = itemsToMove.filter((uuid) =>\n this.definition.nodes.find((node) => node.uuid === uuid)\n );\n\n if (nodeUuids.length > 0) {\n // Allow DOM to update before checking collisions\n setTimeout(() => {\n // If only one node was moved, detect which node it might have been dropped onto\n let droppedNodeUuid: string | null = null;\n let dropTargetBounds: NodeBounds | null = null;\n\n if (nodeUuids.length === 1) {\n droppedNodeUuid = nodeUuids[0];\n const droppedNodeUI = this.definition._ui?.nodes[droppedNodeUuid];\n\n if (droppedNodeUI?.position) {\n const droppedBounds = getNodeBounds(\n droppedNodeUuid,\n droppedNodeUI.position\n );\n\n if (droppedBounds) {\n // Find which node (if any) the dropped node overlaps with\n for (const node of this.definition.nodes) {\n if (node.uuid === droppedNodeUuid) continue;\n\n const nodeUI = this.definition._ui?.nodes[node.uuid];\n if (!nodeUI?.position) continue;\n\n const targetBounds = getNodeBounds(\n node.uuid,\n nodeUI.position\n );\n if (\n targetBounds &&\n nodesOverlap(droppedBounds, targetBounds)\n ) {\n dropTargetBounds = targetBounds;\n break; // Use the first overlapping node\n }\n }\n }\n }\n }\n\n this.checkCollisionsAndReflow(\n nodeUuids,\n droppedNodeUuid,\n dropTargetBounds\n );\n }, 0);\n } else {\n // No nodes moved, just repaint connections\n setTimeout(() => {\n this.plumber.repaintEverything();\n }, 0);\n }\n }\n\n this.selectedItems.clear();\n }\n\n // Reset all drag state\n this.isDragging = false;\n this.isMouseDown = false;\n this.currentDragItem = null;\n this.canvasMouseDown = false;\n }\n\n private updateCanvasSize(): void {\n if (!this.definition) return;\n\n const store = getStore();\n if (!store) return;\n\n // Calculate required canvas size based on all elements\n let maxWidth = 0;\n let maxHeight = 0;\n\n // Check node positions\n this.definition.nodes.forEach((node) => {\n const ui = this.definition._ui.nodes[node.uuid];\n if (ui && ui.position) {\n const nodeElement = this.querySelector(`[id=\"${node.uuid}\"]`);\n if (nodeElement) {\n const rect = nodeElement.getBoundingClientRect();\n maxWidth = Math.max(maxWidth, ui.position.left + rect.width);\n maxHeight = Math.max(maxHeight, ui.position.top + rect.height);\n }\n }\n });\n\n // Check sticky note positions\n const stickies = this.definition._ui?.stickies || {};\n Object.entries(stickies).forEach(([uuid, sticky]) => {\n if (sticky.position) {\n const stickyElement = this.querySelector(\n `temba-sticky-note[uuid=\"${uuid}\"]`\n ) as HTMLElement;\n if (stickyElement) {\n // Use clientWidth/clientHeight instead of getBoundingClientRect() to get element dimensions\n // This avoids the coordinate system mismatch between viewport and canvas coordinates\n const width = stickyElement.clientWidth;\n const height = stickyElement.clientHeight;\n\n // Both sticky.position and width/height are now in the same coordinate system\n maxWidth = Math.max(maxWidth, sticky.position.left + width);\n maxHeight = Math.max(maxHeight, sticky.position.top + height);\n } else {\n // Fallback to default sizes if element not found\n maxWidth = Math.max(maxWidth, sticky.position.left + 200);\n maxHeight = Math.max(maxHeight, sticky.position.top + 100);\n }\n }\n });\n\n // Update canvas size in store\n store.getState().expandCanvas(maxWidth, maxHeight);\n }\n\n private handleCanvasContextMenu(event: MouseEvent): void {\n // Check if we right-clicked on empty canvas space\n const target = event.target as HTMLElement;\n if (target.id !== 'canvas') {\n return;\n }\n\n // Prevent the default browser context menu\n event.preventDefault();\n event.stopPropagation();\n\n // Get canvas position\n const canvas = this.querySelector('#canvas');\n if (!canvas) {\n return;\n }\n\n const canvasRect = canvas.getBoundingClientRect();\n const relativeX = event.clientX - canvasRect.left - 10;\n const relativeY = event.clientY - canvasRect.top - 10;\n\n // Snap position to grid\n const snappedLeft = snapToGrid(relativeX);\n const snappedTop = snapToGrid(relativeY);\n\n // Show the canvas menu at the mouse position (use viewport coordinates)\n const canvasMenu = this.querySelector('temba-canvas-menu') as CanvasMenu;\n if (canvasMenu) {\n canvasMenu.show(event.clientX, event.clientY, {\n x: snappedLeft,\n y: snappedTop\n });\n }\n }\n\n private handleCanvasMenuSelection(event: CustomEvent): void {\n const selection = event.detail as CanvasMenuSelection;\n const store = getStore();\n\n if (selection.action === 'sticky') {\n // Create new sticky note\n store.getState().createStickyNote({\n left: selection.position.x,\n top: selection.position.y\n });\n } else {\n // Show node type selector\n const selector = this.querySelector(\n 'temba-node-type-selector'\n ) as NodeTypeSelector;\n if (selector) {\n selector.show(selection.action, selection.position);\n }\n }\n }\n\n private handleNodeTypeSelection(event: CustomEvent): void {\n const selection = event.detail as NodeTypeSelection;\n\n // Check if we're adding an action to an existing node\n if (this.addActionToNodeUuid) {\n // Find the existing node\n const node = this.definition.nodes.find(\n (n) => n.uuid === this.addActionToNodeUuid\n );\n const nodeUI = this.definition._ui.nodes[this.addActionToNodeUuid];\n\n if (node && nodeUI) {\n // Create a new action to add to the existing node\n const actionUuid = generateUUID();\n this.editingAction = {\n uuid: actionUuid,\n type: selection.nodeType as any\n } as Action;\n\n // Set the editing node to the existing node (not creating new)\n this.editingNode = node;\n this.editingNodeUI = nodeUI;\n this.isCreatingNewNode = false;\n\n // Clear the addActionToNodeUuid flag\n this.addActionToNodeUuid = null;\n\n return;\n }\n\n // If we couldn't find the node, clear the flag and continue with normal flow\n this.addActionToNodeUuid = null;\n }\n\n // Create a temporary node structure for editing (not added to store yet)\n const nodeUuid = generateUUID();\n\n // Determine if this is an action type or a node type\n // Actions need to be wrapped in an execute_actions node\n const isActionType = selection.nodeType in ACTION_CONFIG;\n const nodeType = isActionType ? 'execute_actions' : selection.nodeType;\n\n // For nodes with routers, initialize an empty router to ensure fromFormData works correctly\n const nodeConfig = NODE_CONFIG[nodeType];\n const hasRouter =\n nodeConfig?.form &&\n Object.keys(nodeConfig.form).some(\n (key) =>\n ['rules', 'categories', 'cases'].includes(key) ||\n nodeConfig.form[key]?.type === 'array'\n );\n\n const tempNode: Node = {\n uuid: nodeUuid,\n actions: [],\n exits: hasRouter\n ? [] // Router-based nodes will generate their own exits\n : [\n {\n uuid: generateUUID(),\n destination_uuid: null\n }\n ]\n };\n\n if (hasRouter) {\n // This node uses a router - initialize it with empty structure\n tempNode.router = {\n type: 'switch',\n categories: [],\n cases: [],\n operand: '@input.text',\n default_category_uuid: undefined\n };\n }\n\n const tempNodeUI: NodeUI = {\n position: {\n left: selection.position.x,\n top: selection.position.y\n },\n type: nodeType as any,\n config: {}\n };\n\n // Mark that we're creating a new node and store the position\n this.isCreatingNewNode = true;\n this.pendingNodePosition = {\n left: selection.position.x,\n top: selection.position.y\n };\n\n // Open the node editor with the temporary node\n this.editingNode = tempNode;\n this.editingNodeUI = tempNodeUI;\n\n // If this is an action type, we also need to set up an editing action\n if (isActionType) {\n const actionUuid = generateUUID();\n this.editingAction = {\n uuid: actionUuid,\n type: selection.nodeType as any\n } as Action;\n }\n }\n\n private handleActionEditRequested(event: CustomEvent): void {\n // For action editing, we set the action and find the corresponding node\n this.editingAction = event.detail.action;\n\n // Find the node that contains this action\n const nodeUuid = event.detail.nodeUuid;\n const node = this.definition.nodes.find((n) => n.uuid === nodeUuid);\n\n if (node) {\n this.editingNode = node;\n this.editingNodeUI = this.definition._ui.nodes[nodeUuid];\n }\n }\n\n private handleAddActionRequested(event: CustomEvent): void {\n // Get the node where we want to add the action\n const nodeUuid = event.detail.nodeUuid;\n const node = this.definition.nodes.find((n) => n.uuid === nodeUuid);\n\n if (!node) {\n return;\n }\n\n // Get the node's position to place the selector near it\n const nodeUI = this.definition._ui.nodes[nodeUuid];\n if (!nodeUI) {\n return;\n }\n\n // Show the node type selector in action mode, excluding branching actions\n const selector = this.querySelector(\n 'temba-node-type-selector'\n ) as NodeTypeSelector;\n if (selector) {\n // Show the selector near the node, using a mode that excludes branching actions\n selector.show('action-no-branching', {\n x: nodeUI.position.left,\n y: nodeUI.position.top\n });\n\n // Store the node UUID so we know which node to add the action to\n this.addActionToNodeUuid = nodeUuid;\n }\n }\n\n private handleNodeEditRequested(event: CustomEvent): void {\n this.editingNode = event.detail.node;\n this.editingNodeUI = event.detail.nodeUI;\n }\n\n private handleNodeDeleted(event: CustomEvent): void {\n const nodeUuid = event.detail.uuid;\n if (nodeUuid) {\n this.deleteNodes([nodeUuid]);\n }\n }\n\n private handleActionSaved(updatedAction: Action): void {\n if (this.editingNode && this.editingAction) {\n let updatedActions: Action[];\n\n // Check if this action already exists in the node\n const existingActionIndex = this.editingNode.actions.findIndex(\n (action) => action.uuid === this.editingAction.uuid\n );\n\n if (existingActionIndex >= 0) {\n // Update existing action\n updatedActions = this.editingNode.actions.map((action) =>\n action.uuid === this.editingAction.uuid ? updatedAction : action\n );\n } else {\n // Add new action\n updatedActions = [...this.editingNode.actions, updatedAction];\n }\n\n const updatedNode = { ...this.editingNode, actions: updatedActions };\n\n // Check if we're creating a new node or updating an existing one\n if (this.isCreatingNewNode) {\n // This is a new node with a new action - add it to the store\n const store = getStore();\n\n const nodeUI: NodeUI = {\n position: this.pendingNodePosition || { left: 0, top: 0 },\n type: this.editingNodeUI?.type,\n config: {}\n };\n\n // Add the node to the store\n store.getState().addNode(updatedNode, nodeUI);\n\n // Reset the creation flags\n this.isCreatingNewNode = false;\n this.pendingNodePosition = null;\n\n // Check for collisions and reflow\n requestAnimationFrame(() => {\n this.checkCollisionsAndReflow([updatedNode.uuid]);\n });\n } else {\n // Update existing node in the store\n getStore()?.getState().updateNode(this.editingNode.uuid, updatedNode);\n\n // Check for collisions and reflow in case node size changed\n requestAnimationFrame(() => {\n this.checkCollisionsAndReflow([this.editingNode.uuid]);\n });\n }\n }\n this.closeNodeEditor();\n }\n\n private closeNodeEditor(): void {\n this.editingNode = null;\n this.editingNodeUI = null;\n this.editingAction = null;\n }\n\n private handleActionEditCanceled(): void {\n // If we were creating a new node, just discard it\n if (this.isCreatingNewNode) {\n this.isCreatingNewNode = false;\n this.pendingNodePosition = null;\n }\n this.closeNodeEditor();\n }\n\n private handleNodeSaved(\n updatedNode: Node,\n uiConfig?: Record<string, any>\n ): void {\n if (this.editingNode) {\n if (this.isCreatingNewNode) {\n // This is a new node - add it to the store for the first time\n const store = getStore();\n\n const nodeUI: NodeUI = {\n position: this.pendingNodePosition || { left: 0, top: 0 },\n type: this.editingNodeUI?.type,\n config: uiConfig || {}\n };\n\n // Add the node to the store\n store.getState().addNode(updatedNode, nodeUI);\n\n // Reset the creation flags\n this.isCreatingNewNode = false;\n this.pendingNodePosition = null;\n\n // Check for collisions and reflow\n requestAnimationFrame(() => {\n this.checkCollisionsAndReflow([updatedNode.uuid]);\n });\n } else {\n // This is an existing node - update it\n // Clean up jsPlumb connections for removed exits before updating the node\n if (this.plumber) {\n const oldExits = this.editingNode.exits || [];\n const newExits = updatedNode.exits || [];\n\n // Find exits that were removed\n const removedExits = oldExits.filter(\n (oldExit) =>\n !newExits.find((newExit) => newExit.uuid === oldExit.uuid)\n );\n\n // Remove jsPlumb connections for removed exits\n removedExits.forEach((exit) => {\n this.plumber.removeExitConnection(exit.uuid);\n });\n }\n\n this.plumber.revalidate([updatedNode.uuid]);\n\n // Update the node in the store\n getStore()?.getState().updateNode(this.editingNode.uuid, updatedNode);\n\n // Update the UI config if provided\n if (uiConfig) {\n getStore()?.getState().updateNodeUIConfig(updatedNode.uuid, uiConfig);\n }\n\n // Check for collisions and reflow in case node size changed\n requestAnimationFrame(() => {\n this.checkCollisionsAndReflow([this.editingNode.uuid]);\n });\n }\n }\n this.closeNodeEditor();\n }\n\n private handleNodeEditCanceled(): void {\n // If we were creating a new node, just discard it\n if (this.isCreatingNewNode) {\n this.isCreatingNewNode = false;\n this.pendingNodePosition = null;\n }\n this.closeNodeEditor();\n }\n\n private getNodeAtPosition(mouseX: number, mouseY: number): string | null {\n // Get all node elements\n const nodeElements = this.querySelectorAll('temba-flow-node');\n\n for (const nodeElement of Array.from(nodeElements)) {\n const rect = nodeElement.getBoundingClientRect();\n\n if (\n mouseX >= rect.left &&\n mouseX <= rect.right &&\n mouseY >= rect.top &&\n mouseY <= rect.bottom\n ) {\n return nodeElement.getAttribute('data-node-uuid');\n }\n }\n\n return null;\n }\n\n private calculateCanvasDropPosition(\n mouseX: number,\n mouseY: number,\n applyGridSnapping: boolean = true\n ): FlowPosition {\n // calculate the position on the canvas\n const canvas = this.querySelector('#canvas');\n if (!canvas) return { left: 0, top: 0 };\n\n const canvasRect = canvas.getBoundingClientRect();\n\n // calculate position relative to canvas\n // canvasRect gives us the canvas position in the viewport, which already accounts for scroll\n // so we just need mouseX/Y - canvasRect.left/top to get position within canvas\n const left = mouseX - canvasRect.left - DROP_PREVIEW_OFFSET_X;\n const top = mouseY - canvasRect.top - DROP_PREVIEW_OFFSET_Y;\n\n // Apply grid snapping only if requested (for final drop position)\n if (applyGridSnapping) {\n return {\n left: snapToGrid(left),\n top: snapToGrid(top)\n };\n }\n\n return { left, top };\n }\n\n private handleActionDragExternal(event: CustomEvent): void {\n const {\n action,\n nodeUuid,\n actionIndex,\n mouseX,\n mouseY,\n actionHeight = 60,\n isLastAction = false\n } = event.detail;\n\n // Check if mouse is over another execute_actions node\n const targetNode = this.getNodeAtPosition(mouseX, mouseY);\n\n if (targetNode && targetNode !== nodeUuid) {\n const targetNodeUI = this.definition._ui.nodes[targetNode];\n const targetNodeDef = this.definition.nodes.find(\n (n) => n.uuid === targetNode\n );\n\n // Only allow dropping on execute_actions nodes, and not the source node\n if (targetNodeUI?.type === 'execute_actions' && targetNodeDef) {\n // If we moved to a different target node, clear the previous one's placeholder\n if (\n this.previousActionDragTargetNodeUuid &&\n this.previousActionDragTargetNodeUuid !== targetNode\n ) {\n const previousElement = this.querySelector(\n `temba-flow-node[data-node-uuid=\"${this.previousActionDragTargetNodeUuid}\"]`\n );\n if (previousElement) {\n previousElement.dispatchEvent(\n new CustomEvent('action-drag-leave', {\n detail: {},\n bubbles: false\n })\n );\n }\n }\n\n // Update target node for drop handling\n this.actionDragTargetNodeUuid = targetNode;\n this.previousActionDragTargetNodeUuid = targetNode;\n\n // Hide canvas preview when over a valid target\n this.canvasDropPreview = null;\n\n // Tell source node to show ghost (we're over a valid target)\n const sourceElement = this.querySelector(\n `temba-flow-node[data-node-uuid=\"${nodeUuid}\"]`\n );\n if (sourceElement) {\n sourceElement.dispatchEvent(\n new CustomEvent('action-show-ghost', {\n detail: {},\n bubbles: false\n })\n );\n }\n\n // Notify the target node about the drag\n const targetElement = this.querySelector(\n `temba-flow-node[data-node-uuid=\"${targetNode}\"]`\n );\n if (targetElement) {\n targetElement.dispatchEvent(\n new CustomEvent('action-drag-over', {\n detail: {\n action,\n sourceNodeUuid: nodeUuid,\n actionIndex,\n mouseX,\n mouseY,\n actionHeight\n },\n bubbles: false\n })\n );\n }\n\n this.requestUpdate();\n return;\n }\n }\n\n // Not over a valid target node, clear any previous target's placeholder\n if (this.previousActionDragTargetNodeUuid) {\n const previousElement = this.querySelector(\n `temba-flow-node[data-node-uuid=\"${this.previousActionDragTargetNodeUuid}\"]`\n );\n if (previousElement) {\n previousElement.dispatchEvent(\n new CustomEvent('action-drag-leave', {\n detail: {},\n bubbles: false\n })\n );\n }\n this.previousActionDragTargetNodeUuid = null;\n }\n\n this.actionDragTargetNodeUuid = null;\n\n const sourceElement = this.querySelector(\n `temba-flow-node[data-node-uuid=\"${nodeUuid}\"]`\n );\n\n // Show canvas drop preview only if this is NOT the last action\n // Last actions can only be dropped on other nodes, not on canvas\n if (!isLastAction) {\n // Hide ghost when showing canvas preview (for canvas drops)\n if (sourceElement) {\n sourceElement.dispatchEvent(\n new CustomEvent('action-hide-ghost', {\n detail: {},\n bubbles: false\n })\n );\n }\n\n // Don't snap to grid for preview - let it follow cursor smoothly\n const position = this.calculateCanvasDropPosition(mouseX, mouseY, false);\n\n this.canvasDropPreview = {\n action,\n nodeUuid,\n actionIndex,\n position,\n actionHeight\n };\n } else {\n // For last action, keep ghost visible (can't drop on canvas)\n if (sourceElement) {\n sourceElement.dispatchEvent(\n new CustomEvent('action-show-ghost', {\n detail: {},\n bubbles: false\n })\n );\n }\n\n // Clear any existing preview for last action\n this.canvasDropPreview = null;\n }\n\n // Force re-render to update preview position\n this.requestUpdate();\n }\n\n private handleActionDragInternal(_event: CustomEvent): void {\n // Clear any previous target's placeholder when returning to internal drag\n if (this.previousActionDragTargetNodeUuid) {\n const previousElement = this.querySelector(\n `temba-flow-node[data-node-uuid=\"${this.previousActionDragTargetNodeUuid}\"]`\n );\n if (previousElement) {\n previousElement.dispatchEvent(\n new CustomEvent('action-drag-leave', {\n detail: {},\n bubbles: false\n })\n );\n }\n this.previousActionDragTargetNodeUuid = null;\n }\n\n this.canvasDropPreview = null;\n this.actionDragTargetNodeUuid = null;\n }\n\n private handleActionDropExternal(event: CustomEvent): void {\n const {\n action,\n nodeUuid,\n actionIndex,\n mouseX,\n mouseY,\n isLastAction = false\n } = event.detail;\n\n // Check if we're dropping on an existing execute_actions node\n const targetNodeUuid = this.actionDragTargetNodeUuid;\n\n if (targetNodeUuid && targetNodeUuid !== nodeUuid) {\n // Dropping on another node - notify the target node to handle the drop\n const targetElement = this.querySelector(\n `temba-flow-node[data-node-uuid=\"${targetNodeUuid}\"]`\n );\n if (targetElement) {\n targetElement.dispatchEvent(\n new CustomEvent('action-drop', {\n detail: {\n action,\n sourceNodeUuid: nodeUuid,\n actionIndex,\n mouseX,\n mouseY\n },\n bubbles: false\n })\n );\n }\n\n // Clear state\n this.canvasDropPreview = null;\n this.actionDragTargetNodeUuid = null;\n return;\n }\n\n // If this is the last action and we're not dropping on another node, do nothing\n // Last actions can only be moved to other nodes, not dropped on canvas\n if (isLastAction) {\n this.canvasDropPreview = null;\n this.actionDragTargetNodeUuid = null;\n return;\n }\n\n // Not dropping on another node, create a new one on canvas\n // Snap to grid for the final drop position\n const position = this.calculateCanvasDropPosition(mouseX, mouseY, true);\n\n // remove the action from the original node\n const originalNode = this.definition.nodes.find((n) => n.uuid === nodeUuid);\n if (!originalNode) return;\n\n const updatedActions = originalNode.actions.filter(\n (_a, idx) => idx !== actionIndex\n );\n\n // if no actions remain, delete the node\n if (updatedActions.length === 0) {\n // Use deleteNodes to properly clean up Plumber connections before removing\n this.deleteNodes([nodeUuid]);\n } else {\n // update the node\n const updatedNode = { ...originalNode, actions: updatedActions };\n getStore()?.getState().updateNode(nodeUuid, updatedNode);\n }\n\n // create a new execute_actions node with the dropped action\n const newNode: Node = {\n uuid: generateUUID(),\n actions: [action],\n exits: [\n {\n uuid: generateUUID(),\n destination_uuid: null\n }\n ]\n };\n\n const newNodeUI: NodeUI = {\n position,\n type: 'execute_actions',\n config: {}\n };\n\n // add the new node\n getStore()?.getState().addNode(newNode, newNodeUI);\n\n // clear the preview\n this.canvasDropPreview = null;\n this.actionDragTargetNodeUuid = null;\n\n // Check for collisions and reflow after adding new node\n requestAnimationFrame(() => {\n this.checkCollisionsAndReflow([newNode.uuid]);\n });\n }\n\n private getLocalizationLanguages(): Array<{ code: string; name: string }> {\n if (!this.definition) {\n return [];\n }\n\n const baseLanguage = this.definition.language;\n return this.getAvailableLanguages().filter(\n (lang) => lang.code !== baseLanguage\n );\n }\n\n private getLocalizationProgress(languageCode: string): {\n total: number;\n localized: number;\n } {\n if (\n !this.definition ||\n !languageCode ||\n languageCode === this.definition.language\n ) {\n return { total: 0, localized: 0 };\n }\n\n const bundles = this.buildTranslationBundles(\n this.translationFilters.categories,\n languageCode\n );\n return this.getTranslationCounts(bundles);\n }\n\n private getLanguageLocalization(languageCode: string): Record<string, any> {\n if (!this.definition?.localization) {\n return {};\n }\n return this.definition.localization[languageCode] || {};\n }\n\n private buildTranslationBundles(\n includeCategories: boolean,\n languageCode: string = this.languageCode\n ): TranslationBundle[] {\n if (\n !this.definition ||\n !languageCode ||\n languageCode === this.definition.language\n ) {\n return [];\n }\n\n const languageLocalization = this.getLanguageLocalization(languageCode);\n const bundles: TranslationBundle[] = [];\n\n this.definition.nodes.forEach((node) => {\n node.actions.forEach((action) => {\n const config = ACTION_CONFIG[action.type];\n if (!config?.localizable || config.localizable.length === 0) {\n return;\n }\n\n // For send_msg actions, only count 'text' for progress tracking\n // (quick_replies and attachments are still localizable but don't count toward progress)\n const localizableKeys =\n action.type === 'send_msg'\n ? config.localizable.filter((key) => key === 'text')\n : config.localizable;\n\n const translations = this.findTranslations(\n 'property',\n action.uuid,\n localizableKeys,\n action,\n languageLocalization\n );\n\n if (translations.length > 0) {\n bundles.push({\n nodeUuid: node.uuid,\n actionUuid: action.uuid,\n translations\n });\n }\n });\n\n if (!includeCategories) {\n return;\n }\n\n const nodeUI = this.definition._ui?.nodes?.[node.uuid];\n const nodeType = nodeUI?.type;\n if (!nodeType) {\n return;\n }\n\n const nodeConfig = NODE_CONFIG[nodeType];\n if (\n nodeConfig?.localizable === 'categories' &&\n node.router?.categories?.length\n ) {\n const categoryTranslations = node.router.categories.flatMap(\n (category) =>\n this.findTranslations(\n 'category',\n category.uuid,\n ['name'],\n category,\n languageLocalization\n )\n );\n\n if (categoryTranslations.length > 0) {\n bundles.push({\n nodeUuid: node.uuid,\n translations: categoryTranslations\n });\n }\n }\n });\n\n return bundles;\n }\n\n private findTranslations(\n type: TranslationType,\n uuid: string,\n localizeableKeys: string[],\n source: any,\n localization: Record<string, any>\n ): TranslationEntry[] {\n const translations: TranslationEntry[] = [];\n\n localizeableKeys.forEach((attribute) => {\n if (attribute === 'quick_replies') {\n return;\n }\n\n const pathSegments = attribute.split('.');\n let from: any = source;\n let to: any = [];\n\n while (pathSegments.length > 0 && from) {\n if (from.uuid) {\n to = localization[from.uuid];\n }\n\n const path = pathSegments.shift();\n if (!path) {\n break;\n }\n\n if (to) {\n to = to[path];\n }\n from = from[path];\n }\n\n if (!from) {\n return;\n }\n\n const fromValue = this.formatTranslationValue(from);\n if (!fromValue) {\n return;\n }\n\n const toValue = to ? this.formatTranslationValue(to) : null;\n\n translations.push({\n uuid,\n type,\n attribute,\n from: fromValue,\n to: toValue\n });\n });\n\n return translations;\n }\n\n private formatTranslationValue(value: any): string | null {\n if (value === null || value === undefined) {\n return null;\n }\n\n if (Array.isArray(value)) {\n const normalized = value\n .map((entry) => this.formatTranslationValue(entry))\n .filter((entry) => !!entry) as string[];\n return normalized.length > 0 ? normalized.join(', ') : null;\n }\n\n if (typeof value === 'object') {\n if ('name' in value && value.name) {\n return String(value.name);\n }\n\n if ('arguments' in value && Array.isArray(value.arguments)) {\n return value.arguments.join(' ');\n }\n\n return null;\n }\n\n if (typeof value === 'number') {\n return value.toString();\n }\n\n if (typeof value === 'string') {\n const trimmed = value.trim();\n return trimmed.length > 0 ? trimmed : null;\n }\n\n return null;\n }\n\n private getTranslationCounts(bundles: TranslationBundle[]): {\n total: number;\n localized: number;\n } {\n return bundles.reduce(\n (counts, bundle) => {\n bundle.translations.forEach((translation) => {\n counts.total += 1;\n if (translation.to && translation.to.trim().length > 0) {\n counts.localized += 1;\n }\n });\n return counts;\n },\n { total: 0, localized: 0 }\n );\n }\n\n private handleLocalizationTabClick(): void {\n const languages = this.getLocalizationLanguages();\n if (!languages.length) {\n return;\n }\n\n this.localizationWindowHidden = false;\n\n const alreadySelected = languages.some(\n (lang) => lang.code === this.languageCode\n );\n\n if (!alreadySelected) {\n this.handleLanguageChange(languages[0].code);\n }\n }\n\n private handleLocalizationLanguageSelect(languageCode: string): void {\n if (languageCode === this.languageCode) {\n return;\n }\n this.handleLanguageChange(languageCode);\n }\n\n private handleLocalizationLanguageSelectChange(event: CustomEvent): void {\n const select = event.target as any;\n const nextValue = select?.values?.[0]?.value;\n if (nextValue) {\n this.handleLocalizationLanguageSelect(nextValue);\n }\n }\n\n private handleLocalizationWindowClosed(): void {\n this.localizationWindowHidden = true;\n\n const baseLanguage = this.definition?.language;\n if (baseLanguage && this.languageCode !== baseLanguage) {\n this.handleLanguageChange(baseLanguage);\n }\n }\n\n private toggleTranslationSettings(): void {\n this.translationSettingsExpanded = !this.translationSettingsExpanded;\n }\n\n private handleLocalizationProgressToggleClick(event: MouseEvent): void {\n const target = event.target as HTMLElement;\n if (target.closest('.translation-settings-toggle')) {\n return;\n }\n this.toggleTranslationSettings();\n }\n\n private handleLocalizationProgressToggleKeydown(event: KeyboardEvent): void {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n this.toggleTranslationSettings();\n }\n }\n\n private handleIncludeCategoriesChange(event: Event): void {\n const checkbox = event.target as Checkbox;\n const categories = checkbox?.checked ?? false;\n this.translationFilters = { categories };\n getStore()?.getState().setTranslationFilters({ categories });\n this.requestUpdate();\n }\n\n private async handleAutoTranslateClick(event: Event): Promise<void> {\n event.preventDefault();\n event.stopPropagation();\n\n if (this.autoTranslating) {\n this.autoTranslating = false;\n return;\n }\n\n this.autoTranslateDialogOpen = true;\n }\n\n private handleAutoTranslateDialogButton(event: CustomEvent): void {\n const button = event.detail?.button;\n if (!button) {\n return;\n }\n\n if (button.name === 'Translate') {\n if (!this.autoTranslateModel) {\n return;\n }\n this.autoTranslateDialogOpen = false;\n this.autoTranslateError = null;\n this.autoTranslating = true;\n this.runAutoTranslation().catch((error) => {\n console.error('Auto translation failed', error);\n this.autoTranslateError = 'Auto translation failed. Please try again.';\n this.autoTranslating = false;\n });\n } else if (button.name === 'Cancel' || button.name === 'Close') {\n this.autoTranslateDialogOpen = false;\n }\n }\n\n private handleAutoTranslateModelChange(event: Event): void {\n const select = event.target as any;\n const nextModel = select?.values?.[0] || null;\n this.autoTranslateModel = nextModel;\n }\n\n private shouldTranslateValue(text: string): boolean {\n if (!text) {\n return false;\n }\n const trimmed = text.trim();\n if (trimmed.length <= 1) {\n return false;\n }\n if (/^\\d+$/.test(trimmed)) {\n return false;\n }\n return true;\n }\n\n private async requestAutoTranslation(text: string): Promise<string | null> {\n if (!this.autoTranslateModel || !this.definition) {\n return null;\n }\n\n const payload = {\n text,\n lang: {\n from: this.definition.language,\n to: this.languageCode\n }\n };\n\n const response = await postJSON(\n `/llm/translate/${this.autoTranslateModel.uuid}/`,\n payload\n );\n\n if (response?.status === 200) {\n const result = response.json?.result || response.json?.text;\n return result ? String(result) : null;\n }\n\n throw new Error('Auto translation request failed');\n }\n\n private applyLocalizationUpdates(\n updates: LocalizationUpdate[],\n autoTranslated = false\n ): void {\n if (!updates.length || !this.definition) {\n return;\n }\n\n const store = getStore();\n if (!store) {\n return;\n }\n\n updates.forEach(({ uuid, translations }) => {\n const normalized = Object.entries(translations).reduce(\n (acc, [key, value]) => {\n if (!value) {\n return acc;\n }\n acc[key] = Array.isArray(value) ? value : [value];\n return acc;\n },\n {} as Record<string, any>\n );\n\n const existing =\n this.definition.localization?.[this.languageCode]?.[uuid] || {};\n const merged = { ...existing, ...normalized };\n\n store.getState().updateLocalization(this.languageCode, uuid, merged);\n\n if (autoTranslated) {\n zustand\n .getState()\n .markAutoTranslated(\n this.languageCode,\n uuid,\n Object.keys(translations)\n );\n }\n });\n }\n\n private async runAutoTranslation(): Promise<void> {\n if (\n !this.definition ||\n this.languageCode === this.definition.language ||\n !this.autoTranslateModel\n ) {\n this.autoTranslating = false;\n return;\n }\n\n const bundles = this.buildTranslationBundles(\n this.translationFilters.categories\n );\n\n for (const bundle of bundles) {\n if (!this.autoTranslating) {\n break;\n }\n\n const untranslated = bundle.translations.filter(\n (translation) => !translation.to || translation.to.trim().length === 0\n );\n\n if (untranslated.length === 0) {\n continue;\n }\n\n const updates: LocalizationUpdate[] = [];\n\n for (const translation of untranslated) {\n if (!this.autoTranslating) {\n break;\n }\n\n if (!this.shouldTranslateValue(translation.from)) {\n continue;\n }\n\n const cached = this.translationCache.get(translation.from);\n if (cached) {\n updates.push({\n uuid: translation.uuid,\n translations: { [translation.attribute]: cached }\n });\n continue;\n }\n\n try {\n const result = await this.requestAutoTranslation(translation.from);\n if (result) {\n this.translationCache.set(translation.from, result);\n updates.push({\n uuid: translation.uuid,\n translations: { [translation.attribute]: result }\n });\n }\n } catch (error) {\n console.error('Auto translation request failed', error);\n this.autoTranslateError =\n 'Auto translation failed. Please try again.';\n this.autoTranslating = false;\n break;\n }\n }\n\n if (updates.length > 0) {\n this.applyLocalizationUpdates(updates, true);\n }\n\n if (!this.autoTranslating) {\n break;\n }\n }\n\n this.autoTranslating = false;\n }\n\n private renderLocalizationWindow(): TemplateResult | string {\n const languages = this.getLocalizationLanguages();\n if (!languages.length) {\n return html``;\n }\n\n const baseLanguage = this.definition?.language;\n const availableLanguages = this.getAvailableLanguages();\n const baseName =\n availableLanguages.find((lang) => lang.code === baseLanguage)?.name ||\n 'Base Language';\n\n const activeLanguageCode = languages.some(\n (lang) => lang.code === this.languageCode\n )\n ? this.languageCode\n : languages[0]?.code;\n const activeLanguage = activeLanguageCode\n ? languages.find((lang) => lang.code === activeLanguageCode)\n : null;\n const progress = this.getLocalizationProgress(activeLanguageCode || '');\n const includeCategories = this.translationFilters.categories;\n const settingsPanelId = 'translation-settings-panel';\n const remainingTranslations = Math.max(\n progress.total - progress.localized,\n 0\n );\n const hasTranslations = progress.total > 0;\n const hasPendingTranslations = remainingTranslations > 0;\n const autoTranslateButtonLabel = this.autoTranslating\n ? 'Stop Auto Translate'\n : 'Auto Translate';\n const autoTranslateButtonDisabled =\n !this.autoTranslating && !hasTranslations;\n\n return html`\n <temba-floating-window\n id=\"localization-window\"\n header=\"Translations\"\n .width=${360}\n .maxHeight=${600}\n .top=${75}\n color=\"#6b7280\"\n .hidden=${this.localizationWindowHidden}\n @temba-dialog-hidden=${this.handleLocalizationWindowClosed}\n >\n <div class=\"localization-window-content\">\n <div class=\"localization-header\">\n Translate from <strong>${baseName}</strong> to the languages below.\n Closing this window returns you to editing in ${baseName}.\n </div>\n <div class=\"localization-language-row\">\n <temba-select\n flavor=\"small\"\n class=\"localization-language-select\"\n .values=${activeLanguage\n ? [{ name: activeLanguage.name, value: activeLanguage.code }]\n : []}\n @change=${this.handleLocalizationLanguageSelectChange}\n >\n ${languages.map(\n (lang) => html`<temba-option\n value=\"${lang.code}\"\n name=\"${lang.name}\"\n ></temba-option>`\n )}\n </temba-select>\n <button\n class=\"auto-translate-button\"\n type=\"button\"\n ?disabled=${autoTranslateButtonDisabled}\n @click=${this.handleAutoTranslateClick}\n >\n ${autoTranslateButtonLabel}\n </button>\n </div>\n <div class=\"localization-progress\">\n <div class=\"localization-progress-summary\">\n ${this.autoTranslating\n ? html`<temba-loading units=\"3\" size=\"8\"></temba-loading>\n <span>Auto translating remaining text…</span>`\n : !hasTranslations\n ? html`<span>\n Add content or enable more options to start translating.\n </span>`\n : hasPendingTranslations\n ? html`<span>\n ${progress.localized} of ${progress.total} items translated\n </span>`\n : html`<span>All items are translated.</span>`}\n </div>\n ${this.autoTranslateError\n ? html`<div class=\"auto-translate-error\">\n ${this.autoTranslateError}\n </div>`\n : ''}\n <div class=\"localization-progress-bar-row\">\n <div\n class=\"localization-progress-trigger\"\n role=\"button\"\n tabindex=\"0\"\n aria-expanded=\"${this.translationSettingsExpanded}\"\n aria-controls=\"${settingsPanelId}\"\n @click=${this.handleLocalizationProgressToggleClick}\n @keydown=${this.handleLocalizationProgressToggleKeydown}\n >\n <temba-progress\n .current=${progress.localized}\n .total=${Math.max(progress.total, 1)}\n .animated=${false}\n ></temba-progress>\n </div>\n <button\n class=\"translation-settings-toggle\"\n type=\"button\"\n @click=${this.toggleTranslationSettings}\n aria-expanded=\"${this.translationSettingsExpanded}\"\n aria-controls=\"${settingsPanelId}\"\n >\n <span\n class=\"translation-settings-arrow ${this\n .translationSettingsExpanded\n ? 'expanded'\n : ''}\"\n ></span>\n </button>\n </div>\n ${this.translationSettingsExpanded\n ? html`<div id=\"${settingsPanelId}\" class=\"translation-settings\">\n <div class=\"translation-settings-row\">\n <temba-checkbox\n name=\"include-categories\"\n label=\"Include categories\"\n ?checked=${includeCategories}\n style=\"--checkbox-padding:5px; border-radius:var(--curvature);\"\n @change=${this.handleIncludeCategoriesChange}\n ></temba-checkbox>\n </div>\n </div>`\n : ''}\n </div>\n </div>\n </temba-floating-window>\n `;\n }\n\n private renderAutoTranslateDialog(): TemplateResult | string {\n if (!this.autoTranslateDialogOpen) {\n return html``;\n }\n\n const selectedModel = this.autoTranslateModel\n ? [this.autoTranslateModel]\n : [];\n const disableTranslate = !this.autoTranslateModel;\n\n return html`\n <temba-dialog\n header=\"Auto translate\"\n .open=${this.autoTranslateDialogOpen}\n primaryButtonName=\"Translate\"\n cancelButtonName=\"Cancel\"\n size=\"small\"\n .disabled=${disableTranslate}\n @temba-button-clicked=${this.handleAutoTranslateDialogButton}\n >\n <div class=\"auto-translate-dialog-content\">\n <p>\n We'll send any untranslated text to the selected AI model and save\n the responses automatically.\n </p>\n <div class=\"auto-translate-models\">\n <temba-select\n class=\"auto-translate-model-select\"\n endpoint=\"${AUTO_TRANSLATE_MODELS_ENDPOINT}\"\n .valueKey=${'uuid'}\n .values=${selectedModel}\n ?searchable=${true}\n ?clearable=${true}\n placeholder=\"Select an AI model\"\n @change=${this.handleAutoTranslateModelChange}\n ></temba-select>\n </div>\n <p>Only text without translations will be sent.</p>\n ${this.autoTranslateError\n ? html`<div class=\"auto-translate-error\">\n ${this.autoTranslateError}\n </div>`\n : ''}\n </div>\n </temba-dialog>\n `;\n }\n\n private renderLocalizationTab(): TemplateResult | string {\n const languages = this.getLocalizationLanguages();\n if (!languages.length) {\n return html``;\n }\n\n return html`\n <temba-floating-tab\n id=\"localization-tab\"\n icon=\"language\"\n label=\"Translate Flow\"\n color=\"#6b7280\"\n top=\"180\"\n .hidden=${!this.localizationWindowHidden}\n @temba-button-clicked=${this.handleLocalizationTabClick}\n ></temba-floating-tab>\n `;\n }\n\n /**\n * Focus on a specific node by smoothly scrolling it to the center of the canvas\n */\n public focusNode(nodeUuid: string) {\n const nodeElement = this.querySelector(\n `temba-flow-node[uuid=\"${nodeUuid}\"]`\n ) as HTMLElement;\n if (!nodeElement) {\n return;\n }\n\n const editor = this.querySelector('#editor') as HTMLElement;\n if (!editor) {\n return;\n }\n\n // Get the editor's dimensions and scroll position\n const editorRect = editor.getBoundingClientRect();\n const editorCenterX = editorRect.width / 2;\n const editorCenterY = editorRect.height / 2;\n\n // Get node position relative to the editor's scroll container\n const nodeRect = nodeElement.getBoundingClientRect();\n const nodeCenterX = nodeElement.offsetLeft + nodeRect.width / 2;\n const nodeCenterY = nodeElement.offsetTop + nodeRect.height / 2;\n\n // Calculate the scroll position needed to center the node\n const targetScrollX = nodeCenterX - editorCenterX;\n const targetScrollY = nodeCenterY - editorCenterY;\n\n // Smooth scroll the editor container to the target position\n editor.scrollTo({\n left: Math.max(0, targetScrollX),\n top: Math.max(0, targetScrollY),\n behavior: 'smooth'\n });\n }\n\n public render(): TemplateResult {\n // we have to embed our own style since we are in light DOM\n const style = html`<style>\n ${unsafeCSS(Editor.styles.cssText)}\n ${unsafeCSS(CanvasNode.styles.cssText)}\n </style>`;\n\n const stickies = this.definition?._ui?.stickies || {};\n\n return html`${style} ${this.renderLocalizationWindow()}\n ${this.renderAutoTranslateDialog()}\n <div id=\"editor\">\n <div\n id=\"grid\"\n style=\"min-width:100%;width:${this.canvasSize.width}px; height:${this\n .canvasSize.height}px\"\n >\n <div id=\"canvas\">\n ${this.definition\n ? repeat(\n this.definition.nodes,\n (node) => node.uuid,\n (node, index) => {\n const position = this.definition._ui?.nodes[node.uuid]\n ?.position || {\n left: 0,\n top: 0\n };\n\n const dragging =\n this.isDragging &&\n this.currentDragItem?.uuid === node.uuid;\n\n const selected = this.selectedItems.has(node.uuid);\n\n // first node is the flow start (nodes are sorted by position)\n const isFlowStart = index === 0;\n\n return html`<temba-flow-node\n class=\"draggable ${dragging ? 'dragging' : ''} ${selected\n ? 'selected'\n : ''} ${isFlowStart ? 'flow-start' : ''}\"\n @mousedown=${this.handleMouseDown.bind(this)}\n uuid=${node.uuid}\n data-node-uuid=${node.uuid}\n style=\"left:${position.left}px; top:${position.top}px;transition: all 0.2s ease-in-out;\"\n .plumber=${this.plumber}\n .node=${node}\n .ui=${this.definition._ui.nodes[node.uuid]}\n @temba-node-deleted=${(event) => {\n this.deleteNodes([event.detail.uuid]);\n }}\n ></temba-flow-node>`;\n }\n )\n : html`<temba-loading></temba-loading>`}\n ${repeat(\n Object.entries(stickies),\n ([uuid]) => uuid,\n ([uuid, sticky]) => {\n const position = sticky.position || { left: 0, top: 0 };\n const dragging =\n this.isDragging && this.currentDragItem?.uuid === uuid;\n const selected = this.selectedItems.has(uuid);\n return html`<temba-sticky-note\n class=\"draggable ${dragging ? 'dragging' : ''} ${selected\n ? 'selected'\n : ''}\"\n @mousedown=${this.handleMouseDown.bind(this)}\n style=\"left:${position.left}px; top:${position.top}px;\"\n uuid=${uuid}\n .data=${sticky}\n .dragging=${dragging}\n .selected=${selected}\n ></temba-sticky-note>`;\n }\n )}\n ${this.renderSelectionBox()} ${this.renderCanvasDropPreview()}\n </div>\n </div>\n </div>\n\n ${this.editingNode || this.editingAction\n ? html`<temba-node-editor\n .node=${this.editingNode}\n .nodeUI=${this.editingNodeUI}\n .action=${this.editingAction}\n @temba-node-saved=${(e: CustomEvent) =>\n this.handleNodeSaved(e.detail.node, e.detail.uiConfig)}\n @temba-action-saved=${(e: CustomEvent) =>\n this.handleActionSaved(e.detail.action)}\n @temba-node-edit-cancelled=${this.handleNodeEditCanceled}\n ></temba-node-editor>`\n : ''}\n\n <temba-canvas-menu></temba-canvas-menu>\n <temba-node-type-selector\n .flowType=${this.flowType}\n .features=${this.features}\n ></temba-node-type-selector>\n ${this.renderLocalizationTab()} `;\n }\n}\n"]}
|