ComfyUI/web/assets/index-BMC1ey-i.js.map

1 line
284 KiB
Plaintext

{"version":3,"file":"index-BMC1ey-i.js","sources":["../../src/extensions/core/clipspace.ts","../../src/extensions/core/contextMenuFilter.ts","../../src/extensions/core/dynamicPrompts.ts","../../src/extensions/core/editAttention.ts","../../src/extensions/core/groupNodeManage.ts","../../src/extensions/core/groupNode.ts","../../src/extensions/core/groupOptions.ts","../../src/extensions/core/invertMenuScrolling.ts","../../src/extensions/core/keybinds.ts","../../src/extensions/core/linkRenderMode.ts","../../src/extensions/core/maskeditor.ts","../../src/extensions/core/nodeTemplates.ts","../../src/extensions/core/noteNode.ts","../../src/extensions/core/rerouteNode.ts","../../src/extensions/core/saveImageExtraOutput.ts","../../src/extensions/core/simpleTouchSupport.ts","../../src/extensions/core/slotDefaults.ts","../../src/extensions/core/snapToGrid.ts","../../src/extensions/core/uploadImage.ts","../../src/extensions/core/webcamCapture.ts","../../src/extensions/core/uploadAudio.ts","../../src/extensions/core/nodeBadge.ts"],"sourcesContent":["import { app } from '../../scripts/app'\nimport { ComfyDialog, $el } from '../../scripts/ui'\nimport { ComfyApp } from '../../scripts/app'\n\nexport class ClipspaceDialog extends ComfyDialog {\n static items = []\n static instance = null\n\n static registerButton(name, contextPredicate, callback) {\n const item = $el('button', {\n type: 'button',\n textContent: name,\n contextPredicate: contextPredicate,\n onclick: callback\n })\n\n ClipspaceDialog.items.push(item)\n }\n\n static invalidatePreview() {\n if (\n ComfyApp.clipspace &&\n ComfyApp.clipspace.imgs &&\n ComfyApp.clipspace.imgs.length > 0\n ) {\n const img_preview = document.getElementById(\n 'clipspace_preview'\n ) as HTMLImageElement\n if (img_preview) {\n img_preview.src =\n ComfyApp.clipspace.imgs[ComfyApp.clipspace['selectedIndex']].src\n img_preview.style.maxHeight = '100%'\n img_preview.style.maxWidth = '100%'\n }\n }\n }\n\n static invalidate() {\n if (ClipspaceDialog.instance) {\n const self = ClipspaceDialog.instance\n // allow reconstruct controls when copying from non-image to image content.\n const children = $el('div.comfy-modal-content', [\n self.createImgSettings(),\n ...self.createButtons()\n ])\n\n if (self.element) {\n // update\n self.element.removeChild(self.element.firstChild)\n self.element.appendChild(children)\n } else {\n // new\n self.element = $el('div.comfy-modal', { parent: document.body }, [\n children\n ])\n }\n\n if (self.element.children[0].children.length <= 1) {\n self.element.children[0].appendChild(\n $el('p', {}, [\n 'Unable to find the features to edit content of a format stored in the current Clipspace.'\n ])\n )\n }\n\n ClipspaceDialog.invalidatePreview()\n }\n }\n\n constructor() {\n super()\n }\n\n createButtons() {\n const buttons = []\n\n for (let idx in ClipspaceDialog.items) {\n const item = ClipspaceDialog.items[idx]\n if (!item.contextPredicate || item.contextPredicate())\n buttons.push(ClipspaceDialog.items[idx])\n }\n\n buttons.push(\n $el('button', {\n type: 'button',\n textContent: 'Close',\n onclick: () => {\n this.close()\n }\n })\n )\n\n return buttons\n }\n\n createImgSettings() {\n if (ComfyApp.clipspace.imgs) {\n const combo_items = []\n const imgs = ComfyApp.clipspace.imgs\n\n for (let i = 0; i < imgs.length; i++) {\n combo_items.push($el('option', { value: i }, [`${i}`]))\n }\n\n const combo1 = $el(\n 'select',\n {\n id: 'clipspace_img_selector',\n onchange: (event) => {\n ComfyApp.clipspace['selectedIndex'] = event.target.selectedIndex\n ClipspaceDialog.invalidatePreview()\n }\n },\n combo_items\n )\n\n const row1 = $el('tr', {}, [\n $el('td', {}, [$el('font', { color: 'white' }, ['Select Image'])]),\n $el('td', {}, [combo1])\n ])\n\n const combo2 = $el(\n 'select',\n {\n id: 'clipspace_img_paste_mode',\n onchange: (event) => {\n ComfyApp.clipspace['img_paste_mode'] = event.target.value\n }\n },\n [\n $el('option', { value: 'selected' }, 'selected'),\n $el('option', { value: 'all' }, 'all')\n ]\n ) as HTMLSelectElement\n combo2.value = ComfyApp.clipspace['img_paste_mode']\n\n const row2 = $el('tr', {}, [\n $el('td', {}, [$el('font', { color: 'white' }, ['Paste Mode'])]),\n $el('td', {}, [combo2])\n ])\n\n const td = $el(\n 'td',\n { align: 'center', width: '100px', height: '100px', colSpan: '2' },\n [$el('img', { id: 'clipspace_preview', ondragstart: () => false }, [])]\n )\n\n const row3 = $el('tr', {}, [td])\n\n return $el('table', {}, [row1, row2, row3])\n } else {\n return []\n }\n }\n\n createImgPreview() {\n if (ComfyApp.clipspace.imgs) {\n return $el('img', { id: 'clipspace_preview', ondragstart: () => false })\n } else return []\n }\n\n show() {\n const img_preview = document.getElementById('clipspace_preview')\n ClipspaceDialog.invalidate()\n\n this.element.style.display = 'block'\n }\n}\n\napp.registerExtension({\n name: 'Comfy.Clipspace',\n init(app) {\n // @ts-expect-error Move to ComfyApp\n app.openClipspace = function () {\n if (!ClipspaceDialog.instance) {\n ClipspaceDialog.instance = new ClipspaceDialog()\n ComfyApp.clipspace_invalidate_handler = ClipspaceDialog.invalidate\n }\n\n if (ComfyApp.clipspace) {\n ClipspaceDialog.instance.show()\n } else app.ui.dialog.show('Clipspace is Empty!')\n }\n }\n})\n","import { LiteGraph, LGraphCanvas } from '@comfyorg/litegraph'\nimport { app } from '../../scripts/app'\n\n// Adds filtering to combo context menus\n\nconst ext = {\n name: 'Comfy.ContextMenuFilter',\n init() {\n const ctxMenu = LiteGraph.ContextMenu\n\n // @ts-expect-error TODO Very hacky way to modify Litegraph behaviour. Fix ctx later.\n LiteGraph.ContextMenu = function (values, options) {\n const ctx = new ctxMenu(values, options)\n\n // If we are a dark menu (only used for combo boxes) then add a filter input\n if (options?.className === 'dark' && values?.length > 4) {\n const filter = document.createElement('input')\n filter.classList.add('comfy-context-menu-filter')\n filter.placeholder = 'Filter list'\n\n ctx.root.prepend(filter)\n\n const items = Array.from(\n ctx.root.querySelectorAll('.litemenu-entry')\n ) as HTMLElement[]\n let displayedItems = [...items]\n let itemCount = displayedItems.length\n\n // We must request an animation frame for the current node of the active canvas to update.\n requestAnimationFrame(() => {\n const currentNode = LGraphCanvas.active_canvas.current_node\n const clickedComboValue = currentNode.widgets\n ?.filter(\n (w) =>\n w.type === 'combo' && w.options.values.length === values.length\n )\n .find((w) =>\n w.options.values.every((v, i) => v === values[i])\n )?.value\n\n let selectedIndex = clickedComboValue\n ? values.findIndex((v) => v === clickedComboValue)\n : 0\n if (selectedIndex < 0) {\n selectedIndex = 0\n }\n let selectedItem = displayedItems[selectedIndex]\n updateSelected()\n\n // Apply highlighting to the selected item\n function updateSelected() {\n selectedItem?.style.setProperty('background-color', '')\n selectedItem?.style.setProperty('color', '')\n selectedItem = displayedItems[selectedIndex]\n selectedItem?.style.setProperty(\n 'background-color',\n '#ccc',\n 'important'\n )\n selectedItem?.style.setProperty('color', '#000', 'important')\n }\n\n const positionList = () => {\n const rect = ctx.root.getBoundingClientRect()\n\n // If the top is off-screen then shift the element with scaling applied\n if (rect.top < 0) {\n const scale =\n 1 -\n ctx.root.getBoundingClientRect().height / ctx.root.clientHeight\n\n const shift = (ctx.root.clientHeight * scale) / 2\n\n ctx.root.style.top = -shift + 'px'\n }\n }\n\n // Arrow up/down to select items\n filter.addEventListener('keydown', (event) => {\n switch (event.key) {\n case 'ArrowUp':\n event.preventDefault()\n if (selectedIndex === 0) {\n selectedIndex = itemCount - 1\n } else {\n selectedIndex--\n }\n updateSelected()\n break\n case 'ArrowRight':\n event.preventDefault()\n selectedIndex = itemCount - 1\n updateSelected()\n break\n case 'ArrowDown':\n event.preventDefault()\n if (selectedIndex === itemCount - 1) {\n selectedIndex = 0\n } else {\n selectedIndex++\n }\n updateSelected()\n break\n case 'ArrowLeft':\n event.preventDefault()\n selectedIndex = 0\n updateSelected()\n break\n case 'Enter':\n selectedItem?.click()\n break\n case 'Escape':\n ctx.close()\n break\n }\n })\n\n filter.addEventListener('input', () => {\n // Hide all items that don't match our filter\n const term = filter.value.toLocaleLowerCase()\n // When filtering, recompute which items are visible for arrow up/down and maintain selection.\n displayedItems = items.filter((item) => {\n const isVisible =\n !term || item.textContent.toLocaleLowerCase().includes(term)\n item.style.display = isVisible ? 'block' : 'none'\n return isVisible\n })\n\n selectedIndex = 0\n if (displayedItems.includes(selectedItem)) {\n selectedIndex = displayedItems.findIndex(\n (d) => d === selectedItem\n )\n }\n itemCount = displayedItems.length\n\n updateSelected()\n\n // If we have an event then we can try and position the list under the source\n if (options.event) {\n let top = options.event.clientY - 10\n\n const bodyRect = document.body.getBoundingClientRect()\n\n const rootRect = ctx.root.getBoundingClientRect()\n if (\n bodyRect.height &&\n top > bodyRect.height - rootRect.height - 10\n ) {\n top = Math.max(0, bodyRect.height - rootRect.height - 10)\n }\n\n ctx.root.style.top = top + 'px'\n positionList()\n }\n })\n\n requestAnimationFrame(() => {\n // Focus the filter box when opening\n filter.focus()\n\n positionList()\n })\n })\n }\n\n return ctx\n }\n\n LiteGraph.ContextMenu.prototype = ctxMenu.prototype\n }\n}\n\napp.registerExtension(ext)\n","import { app } from '../../scripts/app'\n\n// Allows for simple dynamic prompt replacement\n// Inputs in the format {a|b} will have a random value of a or b chosen when the prompt is queued.\n\n/*\n * Strips C-style line and block comments from a string\n */\nfunction stripComments(str) {\n return str.replace(/\\/\\*[\\s\\S]*?\\*\\/|\\/\\/.*/g, '')\n}\n\napp.registerExtension({\n name: 'Comfy.DynamicPrompts',\n nodeCreated(node) {\n if (node.widgets) {\n // Locate dynamic prompt text widgets\n // Include any widgets with dynamicPrompts set to true, and customtext\n const widgets = node.widgets.filter((n) => n.dynamicPrompts)\n for (const widget of widgets) {\n // Override the serialization of the value to resolve dynamic prompts for all widgets supporting it in this node\n widget.serializeValue = (workflowNode, widgetIndex) => {\n let prompt = stripComments(widget.value)\n while (\n prompt.replace('\\\\{', '').includes('{') &&\n prompt.replace('\\\\}', '').includes('}')\n ) {\n const startIndex = prompt.replace('\\\\{', '00').indexOf('{')\n const endIndex = prompt.replace('\\\\}', '00').indexOf('}')\n\n const optionsString = prompt.substring(startIndex + 1, endIndex)\n const options = optionsString.split('|')\n\n const randomIndex = Math.floor(Math.random() * options.length)\n const randomOption = options[randomIndex]\n\n prompt =\n prompt.substring(0, startIndex) +\n randomOption +\n prompt.substring(endIndex + 1)\n }\n\n // Overwrite the value in the serialized workflow pnginfo\n if (workflowNode?.widgets_values)\n workflowNode.widgets_values[widgetIndex] = prompt\n\n return prompt\n }\n }\n }\n }\n})\n","import { app } from '../../scripts/app'\n\n// Allows you to edit the attention weight by holding ctrl (or cmd) and using the up/down arrow keys\n\napp.registerExtension({\n name: 'Comfy.EditAttention',\n init() {\n const editAttentionDelta = app.ui.settings.addSetting({\n id: 'Comfy.EditAttention.Delta',\n name: 'Ctrl+up/down precision',\n type: 'slider',\n attrs: {\n min: 0.01,\n max: 0.5,\n step: 0.01\n },\n defaultValue: 0.05\n })\n\n function incrementWeight(weight, delta) {\n const floatWeight = parseFloat(weight)\n if (isNaN(floatWeight)) return weight\n const newWeight = floatWeight + delta\n return String(Number(newWeight.toFixed(10)))\n }\n\n function findNearestEnclosure(text, cursorPos) {\n let start = cursorPos,\n end = cursorPos\n let openCount = 0,\n closeCount = 0\n\n // Find opening parenthesis before cursor\n while (start >= 0) {\n start--\n if (text[start] === '(' && openCount === closeCount) break\n if (text[start] === '(') openCount++\n if (text[start] === ')') closeCount++\n }\n if (start < 0) return false\n\n openCount = 0\n closeCount = 0\n\n // Find closing parenthesis after cursor\n while (end < text.length) {\n if (text[end] === ')' && openCount === closeCount) break\n if (text[end] === '(') openCount++\n if (text[end] === ')') closeCount++\n end++\n }\n if (end === text.length) return false\n\n return { start: start + 1, end: end }\n }\n\n function addWeightToParentheses(text) {\n const parenRegex = /^\\((.*)\\)$/\n const parenMatch = text.match(parenRegex)\n\n const floatRegex = /:([+-]?(\\d*\\.)?\\d+([eE][+-]?\\d+)?)/\n const floatMatch = text.match(floatRegex)\n\n if (parenMatch && !floatMatch) {\n return `(${parenMatch[1]}:1.0)`\n } else {\n return text\n }\n }\n\n function editAttention(event: KeyboardEvent) {\n // @ts-expect-error Runtime narrowing not impl.\n const inputField: HTMLTextAreaElement = event.composedPath()[0]\n const delta = parseFloat(editAttentionDelta.value)\n\n if (inputField.tagName !== 'TEXTAREA') return\n if (!(event.key === 'ArrowUp' || event.key === 'ArrowDown')) return\n if (!event.ctrlKey && !event.metaKey) return\n\n event.preventDefault()\n\n let start = inputField.selectionStart\n let end = inputField.selectionEnd\n let selectedText = inputField.value.substring(start, end)\n\n // If there is no selection, attempt to find the nearest enclosure, or select the current word\n if (!selectedText) {\n const nearestEnclosure = findNearestEnclosure(inputField.value, start)\n if (nearestEnclosure) {\n start = nearestEnclosure.start\n end = nearestEnclosure.end\n selectedText = inputField.value.substring(start, end)\n } else {\n // Select the current word, find the start and end of the word\n const delimiters = ' .,\\\\/!?%^*;:{}=-_`~()\\r\\n\\t'\n\n while (\n !delimiters.includes(inputField.value[start - 1]) &&\n start > 0\n ) {\n start--\n }\n\n while (\n !delimiters.includes(inputField.value[end]) &&\n end < inputField.value.length\n ) {\n end++\n }\n\n selectedText = inputField.value.substring(start, end)\n if (!selectedText) return\n }\n }\n\n // If the selection ends with a space, remove it\n if (selectedText[selectedText.length - 1] === ' ') {\n selectedText = selectedText.substring(0, selectedText.length - 1)\n end -= 1\n }\n\n // If there are parentheses left and right of the selection, select them\n if (\n inputField.value[start - 1] === '(' &&\n inputField.value[end] === ')'\n ) {\n start -= 1\n end += 1\n selectedText = inputField.value.substring(start, end)\n }\n\n // If the selection is not enclosed in parentheses, add them\n if (\n selectedText[0] !== '(' ||\n selectedText[selectedText.length - 1] !== ')'\n ) {\n selectedText = `(${selectedText})`\n }\n\n // If the selection does not have a weight, add a weight of 1.0\n selectedText = addWeightToParentheses(selectedText)\n\n // Increment the weight\n const weightDelta = event.key === 'ArrowUp' ? delta : -delta\n const updatedText = selectedText.replace(\n /\\((.*):([+-]?\\d+(?:\\.\\d+)?)\\)/,\n (match, text, weight) => {\n weight = incrementWeight(weight, weightDelta)\n if (weight == 1) {\n return text\n } else {\n return `(${text}:${weight})`\n }\n }\n )\n\n inputField.setSelectionRange(start, end)\n // Intentional use of deprecated: https://developer.mozilla.org/docs/Web/API/Document/execCommand#using_inserttext\n document.execCommand('insertText', false, updatedText)\n inputField.setSelectionRange(start, start + updatedText.length)\n }\n window.addEventListener('keydown', editAttention)\n }\n})\n","import { $el, ComfyDialog } from '../../scripts/ui'\nimport { DraggableList } from '../../scripts/ui/draggableList'\nimport { GroupNodeConfig, GroupNodeHandler } from './groupNode'\nimport './groupNodeManage.css'\nimport { app, type ComfyApp } from '../../scripts/app'\nimport {\n LiteGraph,\n type LGraphNode,\n type LGraphNodeConstructor\n} from '@comfyorg/litegraph'\nimport { useToastStore } from '@/stores/toastStore'\n\nconst ORDER: symbol = Symbol()\nconst PREFIX = 'workflow'\nconst SEPARATOR = '>'\n\nfunction merge(target, source) {\n if (typeof target === 'object' && typeof source === 'object') {\n for (const key in source) {\n const sv = source[key]\n if (typeof sv === 'object') {\n let tv = target[key]\n if (!tv) tv = target[key] = {}\n merge(tv, source[key])\n } else {\n target[key] = sv\n }\n }\n }\n\n return target\n}\n\nexport class ManageGroupDialog extends ComfyDialog<HTMLDialogElement> {\n tabs: Record<\n 'Inputs' | 'Outputs' | 'Widgets',\n { tab: HTMLAnchorElement; page: HTMLElement }\n >\n selectedNodeIndex: number | null | undefined\n selectedTab: keyof ManageGroupDialog['tabs'] = 'Inputs'\n selectedGroup: string | undefined\n modifications: Record<\n string,\n Record<\n string,\n Record<\n string,\n { name?: string | undefined; visible?: boolean | undefined }\n >\n >\n > = {}\n nodeItems: any[]\n app: ComfyApp\n groupNodeType: LGraphNodeConstructor<LGraphNode>\n groupNodeDef: any\n groupData: any\n\n innerNodesList: HTMLUListElement\n widgetsPage: HTMLElement\n inputsPage: HTMLElement\n outputsPage: HTMLElement\n draggable: any\n\n get selectedNodeInnerIndex() {\n return +this.nodeItems[this.selectedNodeIndex].dataset.nodeindex\n }\n\n constructor(app) {\n super()\n this.app = app\n this.element = $el('dialog.comfy-group-manage', {\n parent: document.body\n }) as HTMLDialogElement\n }\n\n changeTab(tab) {\n this.tabs[this.selectedTab].tab.classList.remove('active')\n this.tabs[this.selectedTab].page.classList.remove('active')\n this.tabs[tab].tab.classList.add('active')\n this.tabs[tab].page.classList.add('active')\n this.selectedTab = tab\n }\n\n changeNode(index, force?) {\n if (!force && this.selectedNodeIndex === index) return\n\n if (this.selectedNodeIndex != null) {\n this.nodeItems[this.selectedNodeIndex].classList.remove('selected')\n }\n this.nodeItems[index].classList.add('selected')\n this.selectedNodeIndex = index\n\n if (!this.buildInputsPage() && this.selectedTab === 'Inputs') {\n this.changeTab('Widgets')\n }\n if (!this.buildWidgetsPage() && this.selectedTab === 'Widgets') {\n this.changeTab('Outputs')\n }\n if (!this.buildOutputsPage() && this.selectedTab === 'Outputs') {\n this.changeTab('Inputs')\n }\n\n this.changeTab(this.selectedTab)\n }\n\n getGroupData() {\n this.groupNodeType =\n LiteGraph.registered_node_types[\n `${PREFIX}${SEPARATOR}` + this.selectedGroup\n ]\n this.groupNodeDef = this.groupNodeType.nodeData\n this.groupData = GroupNodeHandler.getGroupData(this.groupNodeType)\n }\n\n changeGroup(group, reset = true) {\n this.selectedGroup = group\n this.getGroupData()\n\n const nodes = this.groupData.nodeData.nodes\n this.nodeItems = nodes.map((n, i) =>\n $el(\n 'li.draggable-item',\n {\n dataset: {\n nodeindex: n.index + ''\n },\n onclick: () => {\n this.changeNode(i)\n }\n },\n [\n $el('span.drag-handle'),\n $el(\n 'div',\n {\n textContent: n.title ?? n.type\n },\n n.title\n ? $el('span', {\n textContent: n.type\n })\n : []\n )\n ]\n )\n )\n\n this.innerNodesList.replaceChildren(...this.nodeItems)\n\n if (reset) {\n this.selectedNodeIndex = null\n this.changeNode(0)\n } else {\n const items = this.draggable.getAllItems()\n let index = items.findIndex((item) => item.classList.contains('selected'))\n if (index === -1) index = this.selectedNodeIndex\n this.changeNode(index, true)\n }\n\n const ordered = [...nodes]\n this.draggable?.dispose()\n this.draggable = new DraggableList(this.innerNodesList, 'li')\n this.draggable.addEventListener(\n 'dragend',\n ({ detail: { oldPosition, newPosition } }) => {\n if (oldPosition === newPosition) return\n ordered.splice(newPosition, 0, ordered.splice(oldPosition, 1)[0])\n for (let i = 0; i < ordered.length; i++) {\n this.storeModification({\n nodeIndex: ordered[i].index,\n section: ORDER,\n prop: 'order',\n value: i\n })\n }\n }\n )\n }\n\n storeModification(props: {\n nodeIndex?: number\n section: symbol\n prop: string\n value: any\n }) {\n const { nodeIndex, section, prop, value } = props\n const groupMod = (this.modifications[this.selectedGroup] ??= {})\n const nodesMod = (groupMod.nodes ??= {})\n const nodeMod = (nodesMod[nodeIndex ?? this.selectedNodeInnerIndex] ??= {})\n const typeMod = (nodeMod[section] ??= {})\n if (typeof value === 'object') {\n const objMod = (typeMod[prop] ??= {})\n Object.assign(objMod, value)\n } else {\n typeMod[prop] = value\n }\n }\n\n getEditElement(section, prop, value, placeholder, checked, checkable = true) {\n if (value === placeholder) value = ''\n\n const mods =\n this.modifications[this.selectedGroup]?.nodes?.[\n this.selectedNodeInnerIndex\n ]?.[section]?.[prop]\n if (mods) {\n if (mods.name != null) {\n value = mods.name\n }\n if (mods.visible != null) {\n checked = mods.visible\n }\n }\n\n return $el('div', [\n $el('input', {\n value,\n placeholder,\n type: 'text',\n onchange: (e) => {\n this.storeModification({\n section,\n prop,\n value: { name: e.target.value }\n })\n }\n }),\n $el('label', { textContent: 'Visible' }, [\n $el('input', {\n type: 'checkbox',\n checked,\n disabled: !checkable,\n onchange: (e) => {\n this.storeModification({\n section,\n prop,\n value: { visible: !!e.target.checked }\n })\n }\n })\n ])\n ])\n }\n\n buildWidgetsPage() {\n const widgets =\n this.groupData.oldToNewWidgetMap[this.selectedNodeInnerIndex]\n const items = Object.keys(widgets ?? {})\n const type = app.graph.extra.groupNodes[this.selectedGroup]\n const config = type.config?.[this.selectedNodeInnerIndex]?.input\n this.widgetsPage.replaceChildren(\n ...items.map((oldName) => {\n return this.getEditElement(\n 'input',\n oldName,\n widgets[oldName],\n oldName,\n config?.[oldName]?.visible !== false\n )\n })\n )\n return !!items.length\n }\n\n buildInputsPage() {\n const inputs = this.groupData.nodeInputs[this.selectedNodeInnerIndex]\n const items = Object.keys(inputs ?? {})\n const type = app.graph.extra.groupNodes[this.selectedGroup]\n const config = type.config?.[this.selectedNodeInnerIndex]?.input\n this.inputsPage.replaceChildren(\n ...items\n .map((oldName) => {\n let value = inputs[oldName]\n if (!value) {\n return\n }\n\n return this.getEditElement(\n 'input',\n oldName,\n value,\n oldName,\n config?.[oldName]?.visible !== false\n )\n })\n .filter(Boolean)\n )\n return !!items.length\n }\n\n buildOutputsPage() {\n const nodes = this.groupData.nodeData.nodes\n const innerNodeDef = this.groupData.getNodeDef(\n nodes[this.selectedNodeInnerIndex]\n )\n const outputs = innerNodeDef?.output ?? []\n const groupOutputs =\n this.groupData.oldToNewOutputMap[this.selectedNodeInnerIndex]\n\n const type = app.graph.extra.groupNodes[this.selectedGroup]\n const config = type.config?.[this.selectedNodeInnerIndex]?.output\n const node = this.groupData.nodeData.nodes[this.selectedNodeInnerIndex]\n const checkable = node.type !== 'PrimitiveNode'\n this.outputsPage.replaceChildren(\n ...outputs\n .map((type, slot) => {\n const groupOutputIndex = groupOutputs?.[slot]\n const oldName = innerNodeDef.output_name?.[slot] ?? type\n let value = config?.[slot]?.name\n const visible = config?.[slot]?.visible || groupOutputIndex != null\n if (!value || value === oldName) {\n value = ''\n }\n return this.getEditElement(\n 'output',\n slot,\n value,\n oldName,\n visible,\n checkable\n )\n })\n .filter(Boolean)\n )\n return !!outputs.length\n }\n\n show(type?) {\n const groupNodes = Object.keys(app.graph.extra?.groupNodes ?? {}).sort(\n (a, b) => a.localeCompare(b)\n )\n\n this.innerNodesList = $el(\n 'ul.comfy-group-manage-list-items'\n ) as HTMLUListElement\n this.widgetsPage = $el('section.comfy-group-manage-node-page')\n this.inputsPage = $el('section.comfy-group-manage-node-page')\n this.outputsPage = $el('section.comfy-group-manage-node-page')\n const pages = $el('div', [\n this.widgetsPage,\n this.inputsPage,\n this.outputsPage\n ])\n\n this.tabs = [\n ['Inputs', this.inputsPage],\n ['Widgets', this.widgetsPage],\n ['Outputs', this.outputsPage]\n ].reduce((p, [name, page]: [string, HTMLElement]) => {\n p[name] = {\n tab: $el('a', {\n onclick: () => {\n this.changeTab(name)\n },\n textContent: name\n }),\n page\n }\n return p\n }, {}) as any\n\n const outer = $el('div.comfy-group-manage-outer', [\n $el('header', [\n $el('h2', 'Group Nodes'),\n $el(\n 'select',\n {\n onchange: (e) => {\n this.changeGroup(e.target.value)\n }\n },\n groupNodes.map((g) =>\n $el('option', {\n textContent: g,\n selected: `${PREFIX}${SEPARATOR}` + g === type,\n value: g\n })\n )\n )\n ]),\n $el('main', [\n $el('section.comfy-group-manage-list', this.innerNodesList),\n $el('section.comfy-group-manage-node', [\n $el(\n 'header',\n Object.values(this.tabs).map((t) => t.tab)\n ),\n pages\n ])\n ]),\n $el('footer', [\n $el(\n 'button.comfy-btn',\n {\n onclick: (e) => {\n const node = app.graph.nodes.find(\n (n) => n.type === `${PREFIX}${SEPARATOR}` + this.selectedGroup\n )\n if (node) {\n useToastStore().addAlert(\n 'This group node is in use in the current workflow, please first remove these.'\n )\n return\n }\n if (\n confirm(\n `Are you sure you want to remove the node: \"${this.selectedGroup}\"`\n )\n ) {\n delete app.graph.extra.groupNodes[this.selectedGroup]\n LiteGraph.unregisterNodeType(\n `${PREFIX}${SEPARATOR}` + this.selectedGroup\n )\n }\n this.show()\n }\n },\n 'Delete Group Node'\n ),\n $el(\n 'button.comfy-btn',\n {\n onclick: async () => {\n let nodesByType\n let recreateNodes = []\n const types = {}\n for (const g in this.modifications) {\n const type = app.graph.extra.groupNodes[g]\n let config = (type.config ??= {})\n\n let nodeMods = this.modifications[g]?.nodes\n if (nodeMods) {\n const keys = Object.keys(nodeMods)\n if (nodeMods[keys[0]][ORDER]) {\n // If any node is reordered, they will all need sequencing\n const orderedNodes = []\n const orderedMods = {}\n const orderedConfig = {}\n\n for (const n of keys) {\n const order = nodeMods[n][ORDER].order\n orderedNodes[order] = type.nodes[+n]\n orderedMods[order] = nodeMods[n]\n orderedNodes[order].index = order\n }\n\n // Rewrite links\n for (const l of type.links) {\n if (l[0] != null) l[0] = type.nodes[l[0]].index\n if (l[2] != null) l[2] = type.nodes[l[2]].index\n }\n\n // Rewrite externals\n if (type.external) {\n for (const ext of type.external) {\n ext[0] = type.nodes[ext[0]]\n }\n }\n\n // Rewrite modifications\n for (const id of keys) {\n if (config[id]) {\n orderedConfig[type.nodes[id].index] = config[id]\n }\n delete config[id]\n }\n\n type.nodes = orderedNodes\n nodeMods = orderedMods\n type.config = config = orderedConfig\n }\n\n merge(config, nodeMods)\n }\n\n types[g] = type\n\n if (!nodesByType) {\n nodesByType = app.graph.nodes.reduce((p, n) => {\n p[n.type] ??= []\n p[n.type].push(n)\n return p\n }, {})\n }\n\n const nodes = nodesByType[`${PREFIX}${SEPARATOR}` + g]\n if (nodes) recreateNodes.push(...nodes)\n }\n\n await GroupNodeConfig.registerFromWorkflow(types, {})\n\n for (const node of recreateNodes) {\n node.recreate()\n }\n\n this.modifications = {}\n this.app.graph.setDirtyCanvas(true, true)\n this.changeGroup(this.selectedGroup, false)\n }\n },\n 'Save'\n ),\n $el(\n 'button.comfy-btn',\n { onclick: () => this.element.close() },\n 'Close'\n )\n ])\n ])\n\n this.element.replaceChildren(outer)\n this.changeGroup(\n type\n ? groupNodes.find((g) => `${PREFIX}${SEPARATOR}` + g === type)\n : groupNodes[0]\n )\n this.element.showModal()\n\n this.element.addEventListener('close', () => {\n this.draggable?.dispose()\n })\n }\n}\n","import { app } from '../../scripts/app'\nimport { api } from '../../scripts/api'\nimport { mergeIfValid } from './widgetInputs'\nimport { ManageGroupDialog } from './groupNodeManage'\nimport type { LGraphNode } from '@comfyorg/litegraph'\nimport { LGraphCanvas, LiteGraph } from '@comfyorg/litegraph'\nimport { useNodeDefStore } from '@/stores/nodeDefStore'\nimport { ComfyLink, ComfyNode, ComfyWorkflowJSON } from '@/types/comfyWorkflow'\nimport { useToastStore } from '@/stores/toastStore'\n\ntype GroupNodeWorkflowData = {\n external: ComfyLink[]\n links: ComfyLink[]\n nodes: ComfyNode[]\n}\n\nconst GROUP = Symbol()\n\n// v1 Prefix + Separator: workflow/\n// v2 Prefix + Separator: workflow> (ComfyUI_frontend v1.2.63)\nconst PREFIX = 'workflow'\nconst SEPARATOR = '>'\n\nconst Workflow = {\n InUse: {\n Free: 0,\n Registered: 1,\n InWorkflow: 2\n },\n isInUseGroupNode(name) {\n const id = `${PREFIX}${SEPARATOR}${name}`\n // Check if lready registered/in use in this workflow\n if (app.graph.extra?.groupNodes?.[name]) {\n if (app.graph.nodes.find((n) => n.type === id)) {\n return Workflow.InUse.InWorkflow\n } else {\n return Workflow.InUse.Registered\n }\n }\n return Workflow.InUse.Free\n },\n storeGroupNode(name: string, data: GroupNodeWorkflowData) {\n let extra = app.graph.extra\n if (!extra) app.graph.extra = extra = {}\n let groupNodes = extra.groupNodes\n if (!groupNodes) extra.groupNodes = groupNodes = {}\n groupNodes[name] = data\n }\n}\n\nclass GroupNodeBuilder {\n nodes: LGraphNode[]\n nodeData: any\n\n constructor(nodes) {\n this.nodes = nodes\n }\n\n build() {\n const name = this.getName()\n if (!name) return\n\n // Sort the nodes so they are in execution order\n // this allows for widgets to be in the correct order when reconstructing\n this.sortNodes()\n\n this.nodeData = this.getNodeData()\n Workflow.storeGroupNode(name, this.nodeData)\n\n return { name, nodeData: this.nodeData }\n }\n\n getName() {\n const name = prompt('Enter group name')\n if (!name) return\n const used = Workflow.isInUseGroupNode(name)\n switch (used) {\n case Workflow.InUse.InWorkflow:\n useToastStore().addAlert(\n 'An in use group node with this name already exists embedded in this workflow, please remove any instances or use a new name.'\n )\n return\n case Workflow.InUse.Registered:\n if (\n !confirm(\n 'A group node with this name already exists embedded in this workflow, are you sure you want to overwrite it?'\n )\n ) {\n return\n }\n break\n }\n return name\n }\n\n sortNodes() {\n // Gets the builders nodes in graph execution order\n const nodesInOrder = app.graph.computeExecutionOrder(false)\n this.nodes = this.nodes\n .map((node) => ({ index: nodesInOrder.indexOf(node), node }))\n // @ts-expect-error id might be string\n .sort((a, b) => a.index - b.index || a.node.id - b.node.id)\n .map(({ node }) => node)\n }\n\n getNodeData() {\n const storeLinkTypes = (config) => {\n // Store link types for dynamically typed nodes e.g. reroutes\n for (const link of config.links) {\n const origin = app.graph.getNodeById(link[4])\n const type = origin.outputs[link[1]].type\n link.push(type)\n }\n }\n\n const storeExternalLinks = (config) => {\n // Store any external links to the group in the config so when rebuilding we add extra slots\n config.external = []\n for (let i = 0; i < this.nodes.length; i++) {\n const node = this.nodes[i]\n if (!node.outputs?.length) continue\n for (let slot = 0; slot < node.outputs.length; slot++) {\n let hasExternal = false\n const output = node.outputs[slot]\n let type = output.type\n if (!output.links?.length) continue\n for (const l of output.links) {\n const link = app.graph.links[l]\n if (!link) continue\n if (type === '*') type = link.type\n\n if (!app.canvas.selected_nodes[link.target_id]) {\n hasExternal = true\n break\n }\n }\n if (hasExternal) {\n config.external.push([i, slot, type])\n }\n }\n }\n }\n\n // Use the built in copyToClipboard function to generate the node data we need\n const backup = localStorage.getItem('litegrapheditor_clipboard')\n try {\n // @ts-expect-error\n // TODO Figure out if copyToClipboard is really taking this param\n app.canvas.copyToClipboard(this.nodes)\n const config = JSON.parse(\n localStorage.getItem('litegrapheditor_clipboard')\n )\n\n storeLinkTypes(config)\n storeExternalLinks(config)\n\n return config\n } finally {\n localStorage.setItem('litegrapheditor_clipboard', backup)\n }\n }\n}\n\nexport class GroupNodeConfig {\n name: string\n nodeData: any\n inputCount: number\n oldToNewOutputMap: {}\n newToOldOutputMap: {}\n oldToNewInputMap: {}\n oldToNewWidgetMap: {}\n newToOldWidgetMap: {}\n primitiveDefs: {}\n widgetToPrimitive: {}\n primitiveToWidget: {}\n nodeInputs: {}\n outputVisibility: any[]\n nodeDef: any\n inputs: any[]\n linksFrom: {}\n linksTo: {}\n externalFrom: {}\n\n constructor(name, nodeData) {\n this.name = name\n this.nodeData = nodeData\n this.getLinks()\n\n this.inputCount = 0\n this.oldToNewOutputMap = {}\n this.newToOldOutputMap = {}\n this.oldToNewInputMap = {}\n this.oldToNewWidgetMap = {}\n this.newToOldWidgetMap = {}\n this.primitiveDefs = {}\n this.widgetToPrimitive = {}\n this.primitiveToWidget = {}\n this.nodeInputs = {}\n this.outputVisibility = []\n }\n\n async registerType(source = PREFIX) {\n this.nodeDef = {\n output: [],\n output_name: [],\n output_is_list: [],\n output_is_hidden: [],\n name: source + SEPARATOR + this.name,\n display_name: this.name,\n category: 'group nodes' + (SEPARATOR + source),\n input: { required: {} },\n description: `Group node combining ${this.nodeData.nodes\n .map((n) => n.type)\n .join(', ')}`,\n python_module: 'custom_nodes.' + this.name,\n\n [GROUP]: this\n }\n\n this.inputs = []\n const seenInputs = {}\n const seenOutputs = {}\n for (let i = 0; i < this.nodeData.nodes.length; i++) {\n const node = this.nodeData.nodes[i]\n node.index = i\n this.processNode(node, seenInputs, seenOutputs)\n }\n\n for (const p of this.#convertedToProcess) {\n p()\n }\n this.#convertedToProcess = null\n await app.registerNodeDef(`${PREFIX}${SEPARATOR}` + this.name, this.nodeDef)\n useNodeDefStore().addNodeDef(this.nodeDef)\n }\n\n getLinks() {\n this.linksFrom = {}\n this.linksTo = {}\n this.externalFrom = {}\n\n // Extract links for easy lookup\n for (const l of this.nodeData.links) {\n const [sourceNodeId, sourceNodeSlot, targetNodeId, targetNodeSlot] = l\n\n // Skip links outside the copy config\n if (sourceNodeId == null) continue\n\n if (!this.linksFrom[sourceNodeId]) {\n this.linksFrom[sourceNodeId] = {}\n }\n if (!this.linksFrom[sourceNodeId][sourceNodeSlot]) {\n this.linksFrom[sourceNodeId][sourceNodeSlot] = []\n }\n this.linksFrom[sourceNodeId][sourceNodeSlot].push(l)\n\n if (!this.linksTo[targetNodeId]) {\n this.linksTo[targetNodeId] = {}\n }\n this.linksTo[targetNodeId][targetNodeSlot] = l\n }\n\n if (this.nodeData.external) {\n for (const ext of this.nodeData.external) {\n if (!this.externalFrom[ext[0]]) {\n this.externalFrom[ext[0]] = { [ext[1]]: ext[2] }\n } else {\n this.externalFrom[ext[0]][ext[1]] = ext[2]\n }\n }\n }\n }\n\n processNode(node, seenInputs, seenOutputs) {\n const def = this.getNodeDef(node)\n if (!def) return\n\n const inputs = { ...def.input?.required, ...def.input?.optional }\n\n this.inputs.push(this.processNodeInputs(node, seenInputs, inputs))\n if (def.output?.length) this.processNodeOutputs(node, seenOutputs, def)\n }\n\n getNodeDef(node) {\n const def = globalDefs[node.type]\n if (def) return def\n\n const linksFrom = this.linksFrom[node.index]\n if (node.type === 'PrimitiveNode') {\n // Skip as its not linked\n if (!linksFrom) return\n\n let type = linksFrom['0'][0][5]\n if (type === 'COMBO') {\n // Use the array items\n const source = node.outputs[0].widget.name\n const fromTypeName = this.nodeData.nodes[linksFrom['0'][0][2]].type\n const fromType = globalDefs[fromTypeName]\n const input =\n fromType.input.required[source] ?? fromType.input.optional[source]\n type = input[0]\n }\n\n const def = (this.primitiveDefs[node.index] = {\n input: {\n required: {\n value: [type, {}]\n }\n },\n output: [type],\n output_name: [],\n output_is_list: []\n })\n return def\n } else if (node.type === 'Reroute') {\n const linksTo = this.linksTo[node.index]\n if (linksTo && linksFrom && !this.externalFrom[node.index]?.[0]) {\n // Being used internally\n return null\n }\n\n let config = {}\n let rerouteType = '*'\n if (linksFrom) {\n for (const [, , id, slot] of linksFrom['0']) {\n const node = this.nodeData.nodes[id]\n const input = node.inputs[slot]\n if (rerouteType === '*') {\n rerouteType = input.type\n }\n if (input.widget) {\n const targetDef = globalDefs[node.type]\n const targetWidget =\n targetDef.input.required[input.widget.name] ??\n targetDef.input.optional[input.widget.name]\n\n const widget = [targetWidget[0], config]\n const res = mergeIfValid(\n {\n widget\n },\n targetWidget,\n false,\n null,\n widget\n )\n config = res?.customConfig ?? config\n }\n }\n } else if (linksTo) {\n const [id, slot] = linksTo['0']\n rerouteType = this.nodeData.nodes[id].outputs[slot].type\n } else {\n // Reroute used as a pipe\n for (const l of this.nodeData.links) {\n if (l[2] === node.index) {\n rerouteType = l[5]\n break\n }\n }\n if (rerouteType === '*') {\n // Check for an external link\n const t = this.externalFrom[node.index]?.[0]\n if (t) {\n rerouteType = t\n }\n }\n }\n\n // @ts-expect-error\n config.forceInput = true\n return {\n input: {\n required: {\n [rerouteType]: [rerouteType, config]\n }\n },\n output: [rerouteType],\n output_name: [],\n output_is_list: []\n }\n }\n\n console.warn(\n 'Skipping virtual node ' +\n node.type +\n ' when building group node ' +\n this.name\n )\n }\n\n getInputConfig(node, inputName, seenInputs, config, extra?) {\n const customConfig = this.nodeData.config?.[node.index]?.input?.[inputName]\n let name =\n customConfig?.name ??\n node.inputs?.find((inp) => inp.name === inputName)?.label ??\n inputName\n let key = name\n let prefix = ''\n // Special handling for primitive to include the title if it is set rather than just \"value\"\n if ((node.type === 'PrimitiveNode' && node.title) || name in seenInputs) {\n prefix = `${node.title ?? node.type} `\n key = name = `${prefix}${inputName}`\n if (name in seenInputs) {\n name = `${prefix}${seenInputs[name]} ${inputName}`\n }\n }\n seenInputs[key] = (seenInputs[key] ?? 1) + 1\n\n if (inputName === 'seed' || inputName === 'noise_seed') {\n if (!extra) extra = {}\n extra.control_after_generate = `${prefix}control_after_generate`\n }\n if (config[0] === 'IMAGEUPLOAD') {\n if (!extra) extra = {}\n extra.widget =\n this.oldToNewWidgetMap[node.index]?.[config[1]?.widget ?? 'image'] ??\n 'image'\n }\n\n if (extra) {\n config = [config[0], { ...config[1], ...extra }]\n }\n\n return { name, config, customConfig }\n }\n\n processWidgetInputs(inputs, node, inputNames, seenInputs) {\n const slots = []\n const converted = new Map()\n const widgetMap = (this.oldToNewWidgetMap[node.index] = {})\n for (const inputName of inputNames) {\n let widgetType = app.getWidgetType(inputs[inputName], inputName)\n if (widgetType) {\n const convertedIndex = node.inputs?.findIndex(\n (inp) => inp.name === inputName && inp.widget?.name === inputName\n )\n if (convertedIndex > -1) {\n // This widget has been converted to a widget\n // We need to store this in the correct position so link ids line up\n converted.set(convertedIndex, inputName)\n widgetMap[inputName] = null\n } else {\n // Normal widget\n const { name, config } = this.getInputConfig(\n node,\n inputName,\n seenInputs,\n inputs[inputName]\n )\n this.nodeDef.input.required[name] = config\n widgetMap[inputName] = name\n this.newToOldWidgetMap[name] = { node, inputName }\n }\n } else {\n // Normal input\n slots.push(inputName)\n }\n }\n return { converted, slots }\n }\n\n checkPrimitiveConnection(link, inputName, inputs) {\n const sourceNode = this.nodeData.nodes[link[0]]\n if (sourceNode.type === 'PrimitiveNode') {\n // Merge link configurations\n const [sourceNodeId, _, targetNodeId, __] = link\n const primitiveDef = this.primitiveDefs[sourceNodeId]\n const targetWidget = inputs[inputName]\n const primitiveConfig = primitiveDef.input.required.value\n const output = { widget: primitiveConfig }\n const config = mergeIfValid(\n output,\n targetWidget,\n false,\n null,\n primitiveConfig\n )\n primitiveConfig[1] =\n config?.customConfig ?? inputs[inputName][1]\n ? { ...inputs[inputName][1] }\n : {}\n\n let name = this.oldToNewWidgetMap[sourceNodeId]['value']\n name = name.substr(0, name.length - 6)\n primitiveConfig[1].control_after_generate = true\n primitiveConfig[1].control_prefix = name\n\n let toPrimitive = this.widgetToPrimitive[targetNodeId]\n if (!toPrimitive) {\n toPrimitive = this.widgetToPrimitive[targetNodeId] = {}\n }\n if (toPrimitive[inputName]) {\n toPrimitive[inputName].push(sourceNodeId)\n }\n toPrimitive[inputName] = sourceNodeId\n\n let toWidget = this.primitiveToWidget[sourceNodeId]\n if (!toWidget) {\n toWidget = this.primitiveToWidget[sourceNodeId] = []\n }\n toWidget.push({ nodeId: targetNodeId, inputName })\n }\n }\n\n processInputSlots(inputs, node, slots, linksTo, inputMap, seenInputs) {\n this.nodeInputs[node.index] = {}\n for (let i = 0; i < slots.length; i++) {\n const inputName = slots[i]\n if (linksTo[i]) {\n this.checkPrimitiveConnection(linksTo[i], inputName, inputs)\n // This input is linked so we can skip it\n continue\n }\n\n const { name, config, customConfig } = this.getInputConfig(\n node,\n inputName,\n seenInputs,\n inputs[inputName]\n )\n\n this.nodeInputs[node.index][inputName] = name\n if (customConfig?.visible === false) continue\n\n this.nodeDef.input.required[name] = config\n inputMap[i] = this.inputCount++\n }\n }\n\n processConvertedWidgets(\n inputs,\n node,\n slots,\n converted,\n linksTo,\n inputMap,\n seenInputs\n ) {\n // Add converted widgets sorted into their index order (ordered as they were converted) so link ids match up\n const convertedSlots = [...converted.keys()]\n .sort()\n .map((k) => converted.get(k))\n for (let i = 0; i < convertedSlots.length; i++) {\n const inputName = convertedSlots[i]\n if (linksTo[slots.length + i]) {\n this.checkPrimitiveConnection(\n linksTo[slots.length + i],\n inputName,\n inputs\n )\n // This input is linked so we can skip it\n continue\n }\n\n const { name, config } = this.getInputConfig(\n node,\n inputName,\n seenInputs,\n inputs[inputName],\n {\n defaultInput: true\n }\n )\n\n this.nodeDef.input.required[name] = config\n this.newToOldWidgetMap[name] = { node, inputName }\n\n if (!this.oldToNewWidgetMap[node.index]) {\n this.oldToNewWidgetMap[node.index] = {}\n }\n this.oldToNewWidgetMap[node.index][inputName] = name\n\n inputMap[slots.length + i] = this.inputCount++\n }\n }\n\n #convertedToProcess = []\n processNodeInputs(node, seenInputs, inputs) {\n const inputMapping = []\n\n const inputNames = Object.keys(inputs)\n if (!inputNames.length) return\n\n const { converted, slots } = this.processWidgetInputs(\n inputs,\n node,\n inputNames,\n seenInputs\n )\n const linksTo = this.linksTo[node.index] ?? {}\n const inputMap = (this.oldToNewInputMap[node.index] = {})\n this.processInputSlots(inputs, node, slots, linksTo, inputMap, seenInputs)\n\n // Converted inputs have to be processed after all other nodes as they'll be at the end of the list\n this.#convertedToProcess.push(() =>\n this.processConvertedWidgets(\n inputs,\n node,\n slots,\n converted,\n linksTo,\n inputMap,\n seenInputs\n )\n )\n\n return inputMapping\n }\n\n processNodeOutputs(node, seenOutputs, def) {\n const oldToNew = (this.oldToNewOutputMap[node.index] = {})\n\n // Add outputs\n for (let outputId = 0; outputId < def.output.length; outputId++) {\n const linksFrom = this.linksFrom[node.index]\n // If this output is linked internally we flag it to hide\n const hasLink =\n linksFrom?.[outputId] && !this.externalFrom[node.index]?.[outputId]\n const customConfig =\n this.nodeData.config?.[node.index]?.output?.[outputId]\n const visible = customConfig?.visible ?? !hasLink\n this.outputVisibility.push(visible)\n if (!visible) {\n continue\n }\n\n oldToNew[outputId] = this.nodeDef.output.length\n this.newToOldOutputMap[this.nodeDef.output.length] = {\n node,\n slot: outputId\n }\n this.nodeDef.output.push(def.output[outputId])\n this.nodeDef.output_is_list.push(def.output_is_list[outputId])\n\n let label = customConfig?.name\n if (!label) {\n label = def.output_name?.[outputId] ?? def.output[outputId]\n const output = node.outputs.find((o) => o.name === label)\n if (output?.label) {\n label = output.label\n }\n }\n\n let name = label\n if (name in seenOutputs) {\n const prefix = `${node.title ?? node.type} `\n name = `${prefix}${label}`\n if (name in seenOutputs) {\n name = `${prefix}${node.index} ${label}`\n }\n }\n seenOutputs[name] = 1\n\n this.nodeDef.output_name.push(name)\n }\n }\n\n static async registerFromWorkflow(groupNodes, missingNodeTypes) {\n for (const g in groupNodes) {\n const groupData = groupNodes[g]\n\n let hasMissing = false\n for (const n of groupData.nodes) {\n // Find missing node types\n if (!(n.type in LiteGraph.registered_node_types)) {\n missingNodeTypes.push({\n type: n.type,\n hint: ` (In group node '${PREFIX}${SEPARATOR}${g}')`\n })\n\n missingNodeTypes.push({\n type: `${PREFIX}${SEPARATOR}` + g,\n action: {\n text: 'Remove from workflow',\n callback: (e) => {\n delete groupNodes[g]\n e.target.textContent = 'Removed'\n e.target.style.pointerEvents = 'none'\n e.target.style.opacity = 0.7\n }\n }\n })\n\n hasMissing = true\n }\n }\n\n if (hasMissing) continue\n\n const config = new GroupNodeConfig(g, groupData)\n await config.registerType()\n }\n }\n}\n\nexport class GroupNodeHandler {\n node\n groupData\n innerNodes: any\n\n constructor(node) {\n this.node = node\n this.groupData = node.constructor?.nodeData?.[GROUP]\n\n this.node.setInnerNodes = (innerNodes) => {\n this.innerNodes = innerNodes\n\n for (\n let innerNodeIndex = 0;\n innerNodeIndex < this.innerNodes.length;\n innerNodeIndex++\n ) {\n const innerNode = this.innerNodes[innerNodeIndex]\n\n for (const w of innerNode.widgets ?? []) {\n if (w.type === 'converted-widget') {\n w.serializeValue = w.origSerializeValue\n }\n }\n\n innerNode.index = innerNodeIndex\n innerNode.getInputNode = (slot) => {\n // Check if this input is internal or external\n const externalSlot =\n this.groupData.oldToNewInputMap[innerNode.index]?.[slot]\n if (externalSlot != null) {\n return this.node.getInputNode(externalSlot)\n }\n\n // Internal link\n const innerLink = this.groupData.linksTo[innerNode.index]?.[slot]\n if (!innerLink) return null\n\n const inputNode = innerNodes[innerLink[0]]\n // Primitives will already apply their values\n if (inputNode.type === 'PrimitiveNode') return null\n\n return inputNode\n }\n\n innerNode.getInputLink = (slot) => {\n const externalSlot =\n this.groupData.oldToNewInputMap[innerNode.index]?.[slot]\n if (externalSlot != null) {\n // The inner node is connected via the group node inputs\n const linkId = this.node.inputs[externalSlot].link\n let link = app.graph.links[linkId]\n\n // Use the outer link, but update the target to the inner node\n // @ts-expect-error\n // TODO: Fix this\n link = {\n ...link,\n target_id: innerNode.id,\n target_slot: +slot\n }\n return link\n }\n\n let link = this.groupData.linksTo[innerNode.index]?.[slot]\n if (!link) return null\n // Use the inner link, but update the origin node to be inner node id\n link = {\n origin_id: innerNodes[link[0]].id,\n origin_slot: link[1],\n target_id: innerNode.id,\n target_slot: +slot\n }\n return link\n }\n }\n }\n\n this.node.updateLink = (link) => {\n // Replace the group node reference with the internal node\n link = { ...link }\n const output = this.groupData.newToOldOutputMap[link.origin_slot]\n let innerNode = this.innerNodes[output.node.index]\n let l\n while (innerNode?.type === 'Reroute') {\n l = innerNode.getInputLink(0)\n innerNode = innerNode.getInputNode(0)\n }\n\n if (!innerNode) {\n return null\n }\n\n if (l && GroupNodeHandler.isGroupNode(innerNode)) {\n return innerNode.updateLink(l)\n }\n\n link.origin_id = innerNode.id\n link.origin_slot = l?.origin_slot ?? output.slot\n return link\n }\n\n this.node.getInnerNodes = () => {\n if (!this.innerNodes) {\n this.node.setInnerNodes(\n this.groupData.nodeData.nodes.map((n, i) => {\n const innerNode = LiteGraph.createNode(n.type)\n innerNode.configure(n)\n innerNode.id = `${this.node.id}:${i}`\n return innerNode\n })\n )\n }\n\n this.updateInnerWidgets()\n\n return this.innerNodes\n }\n\n this.node.recreate = async () => {\n const id = this.node.id\n const sz = this.node.size\n const nodes = this.node.convertToNodes()\n\n const groupNode = LiteGraph.createNode(this.node.type)\n groupNode.id = id\n\n // Reuse the existing nodes for this instance\n groupNode.setInnerNodes(nodes)\n groupNode[GROUP].populateWidgets()\n app.graph.add(groupNode)\n groupNode.size = [\n Math.max(groupNode.size[0], sz[0]),\n Math.max(groupNode.size[1], sz[1])\n ]\n\n // Remove all converted nodes and relink them\n const builder = new GroupNodeBuilder(nodes)\n const nodeData = builder.getNodeData()\n groupNode[GROUP].groupData.nodeData.links = nodeData.links\n groupNode[GROUP].replaceNodes(nodes)\n return groupNode\n }\n\n this.node.convertToNodes = () => {\n const addInnerNodes = () => {\n const backup = localStorage.getItem('litegrapheditor_clipboard')\n // Clone the node data so we dont mutate it for other nodes\n const c = { ...this.groupData.nodeData }\n c.nodes = [...c.nodes]\n const innerNodes = this.node.getInnerNodes()\n let ids = []\n for (let i = 0; i < c.nodes.length; i++) {\n let id = innerNodes?.[i]?.id\n // Use existing IDs if they are set on the inner nodes\n if (id == null || isNaN(id)) {\n id = undefined\n } else {\n ids.push(id)\n }\n c.nodes[i] = { ...c.nodes[i], id }\n }\n localStorage.setItem('litegrapheditor_clipboard', JSON.stringify(c))\n app.canvas.pasteFromClipboard()\n localStorage.setItem('litegrapheditor_clipboard', backup)\n\n const [x, y] = this.node.pos\n let top\n let left\n // Configure nodes with current widget data\n const selectedIds = ids.length\n ? ids\n : Object.keys(app.canvas.selected_nodes)\n const newNodes = []\n for (let i = 0; i < selectedIds.length; i++) {\n const id = selectedIds[i]\n const newNode = app.graph.getNodeById(id)\n const innerNode = innerNodes[i]\n newNodes.push(newNode)\n\n if (left == null || newNode.pos[0] < left) {\n left = newNode.pos[0]\n }\n if (top == null || newNode.pos[1] < top) {\n top = newNode.pos[1]\n }\n\n if (!newNode.widgets) continue\n\n const map = this.groupData.oldToNewWidgetMap[innerNode.index]\n if (map) {\n const widgets = Object.keys(map)\n\n for (const oldName of widgets) {\n const newName = map[oldName]\n if (!newName) continue\n\n const widgetIndex = this.node.widgets.findIndex(\n (w) => w.name === newName\n )\n if (widgetIndex === -1) continue\n\n // Populate the main and any linked widgets\n if (innerNode.type === 'PrimitiveNode') {\n for (let i = 0; i < newNode.widgets.length; i++) {\n newNode.widgets[i].value =\n this.node.widgets[widgetIndex + i].value\n }\n } else {\n const outerWidget = this.node.widgets[widgetIndex]\n const newWidget = newNode.widgets.find(\n (w) => w.name === oldName\n )\n if (!newWidget) continue\n\n newWidget.value = outerWidget.value\n for (let w = 0; w < outerWidget.linkedWidgets?.length; w++) {\n newWidget.linkedWidgets[w].value =\n outerWidget.linkedWidgets[w].value\n }\n }\n }\n }\n }\n\n // Shift each node\n for (const newNode of newNodes) {\n newNode.pos = [\n newNode.pos[0] - (left - x),\n newNode.pos[1] - (top - y)\n ]\n }\n\n return { newNodes, selectedIds }\n }\n\n const reconnectInputs = (selectedIds) => {\n for (const innerNodeIndex in this.groupData.oldToNewInputMap) {\n const id = selectedIds[innerNodeIndex]\n const newNode = app.graph.getNodeById(id)\n const map = this.groupData.oldToNewInputMap[innerNodeIndex]\n for (const innerInputId in map) {\n const groupSlotId = map[innerInputId]\n if (groupSlotId == null) continue\n const slot = node.inputs[groupSlotId]\n if (slot.link == null) continue\n const link = app.graph.links[slot.link]\n if (!link) continue\n // connect this node output to the input of another node\n const originNode = app.graph.getNodeById(link.origin_id)\n originNode.connect(link.origin_slot, newNode, +innerInputId)\n }\n }\n }\n\n const reconnectOutputs = (selectedIds) => {\n for (\n let groupOutputId = 0;\n groupOutputId < node.outputs?.length;\n groupOutputId++\n ) {\n const output = node.outputs[groupOutputId]\n if (!output.links) continue\n const links = [...output.links]\n for (const l of links) {\n const slot = this.groupData.newToOldOutputMap[groupOutputId]\n const link = app.graph.links[l]\n const targetNode = app.graph.getNodeById(link.target_id)\n const newNode = app.graph.getNodeById(selectedIds[slot.node.index])\n newNode.connect(slot.slot, targetNode, link.target_slot)\n }\n }\n }\n\n const { newNodes, selectedIds } = addInnerNodes()\n reconnectInputs(selectedIds)\n reconnectOutputs(selectedIds)\n app.graph.remove(this.node)\n\n return newNodes\n }\n\n const getExtraMenuOptions = this.node.getExtraMenuOptions\n this.node.getExtraMenuOptions = function (_, options) {\n getExtraMenuOptions?.apply(this, arguments)\n\n let optionIndex = options.findIndex((o) => o.content === 'Outputs')\n if (optionIndex === -1) optionIndex = options.length\n else optionIndex++\n options.splice(\n optionIndex,\n 0,\n null,\n {\n content: 'Convert to nodes',\n callback: () => {\n return this.convertToNodes()\n }\n },\n {\n content: 'Manage Group Node',\n callback: () => {\n new ManageGroupDialog(app).show(this.type)\n }\n }\n )\n }\n\n // Draw custom collapse icon to identity this as a group\n const onDrawTitleBox = this.node.onDrawTitleBox\n this.node.onDrawTitleBox = function (ctx, height, size, scale) {\n onDrawTitleBox?.apply(this, arguments)\n\n const fill = ctx.fillStyle\n ctx.beginPath()\n ctx.rect(11, -height + 11, 2, 2)\n ctx.rect(14, -height + 11, 2, 2)\n ctx.rect(17, -height + 11, 2, 2)\n ctx.rect(11, -height + 14, 2, 2)\n ctx.rect(14, -height + 14, 2, 2)\n ctx.rect(17, -height + 14, 2, 2)\n ctx.rect(11, -height + 17, 2, 2)\n ctx.rect(14, -height + 17, 2, 2)\n ctx.rect(17, -height + 17, 2, 2)\n\n ctx.fillStyle = this.boxcolor || LiteGraph.NODE_DEFAULT_BOXCOLOR\n ctx.fill()\n ctx.fillStyle = fill\n }\n\n // Draw progress label\n const onDrawForeground = node.onDrawForeground\n const groupData = this.groupData.nodeData\n node.onDrawForeground = function (ctx) {\n const r = onDrawForeground?.apply?.(this, arguments)\n if (\n +app.runningNodeId === this.id &&\n this.runningInternalNodeId !== null\n ) {\n const n = groupData.nodes[this.runningInternalNodeId]\n if (!n) return\n const message = `Running ${n.title || n.type} (${this.runningInternalNodeId}/${groupData.nodes.length})`\n ctx.save()\n ctx.font = '12px sans-serif'\n const sz = ctx.measureText(message)\n ctx.fillStyle = node.boxcolor || LiteGraph.NODE_DEFAULT_BOXCOLOR\n ctx.beginPath()\n ctx.roundRect(\n 0,\n -LiteGraph.NODE_TITLE_HEIGHT - 20,\n sz.width + 12,\n 20,\n 5\n )\n ctx.fill()\n\n ctx.fillStyle = '#fff'\n ctx.fillText(message, 6, -LiteGraph.NODE_TITLE_HEIGHT - 6)\n ctx.restore()\n }\n }\n\n // Flag this node as needing to be reset\n const onExecutionStart = this.node.onExecutionStart\n this.node.onExecutionStart = function () {\n this.resetExecution = true\n return onExecutionStart?.apply(this, arguments)\n }\n\n const self = this\n const onNodeCreated = this.node.onNodeCreated\n this.node.onNodeCreated = function () {\n if (!this.widgets) {\n return\n }\n const config = self.groupData.nodeData.config\n if (config) {\n for (const n in config) {\n const inputs = config[n]?.input\n for (const w in inputs) {\n if (inputs[w].visible !== false) continue\n const widgetName = self.groupData.oldToNewWidgetMap[n][w]\n const widget = this.widgets.find((w) => w.name === widgetName)\n if (widget) {\n widget.type = 'hidden'\n widget.computeSize = () => [0, -4]\n }\n }\n }\n }\n\n return onNodeCreated?.apply(this, arguments)\n }\n\n function handleEvent(type, getId, getEvent) {\n const handler = ({ detail }) => {\n const id = getId(detail)\n if (!id) return\n const node = app.graph.getNodeById(id)\n if (node) return\n\n const innerNodeIndex = this.innerNodes?.findIndex((n) => n.id == id)\n if (innerNodeIndex > -1) {\n this.node.runningInternalNodeId = innerNodeIndex\n api.dispatchEvent(\n new CustomEvent(type, {\n detail: getEvent(detail, this.node.id + '', this.node)\n })\n )\n }\n }\n api.addEventListener(type, handler)\n return handler\n }\n\n const executing = handleEvent.call(\n this,\n 'executing',\n (d) => d,\n (d, id, node) => id\n )\n\n const executed = handleEvent.call(\n this,\n 'executed',\n (d) => d?.display_node || d?.node,\n (d, id, node) => ({\n ...d,\n node: id,\n display_node: id,\n merge: !node.resetExecution\n })\n )\n\n const onRemoved = node.onRemoved\n this.node.onRemoved = function () {\n onRemoved?.apply(this, arguments)\n api.removeEventListener('executing', executing)\n api.removeEventListener('executed', executed)\n }\n\n this.node.refreshComboInNode = (defs) => {\n // Update combo widget options\n for (const widgetName in this.groupData.newToOldWidgetMap) {\n const widget = this.node.widgets.find((w) => w.name === widgetName)\n if (widget?.type === 'combo') {\n const old = this.groupData.newToOldWidgetMap[widgetName]\n const def = defs[old.node.type]\n const input =\n def?.input?.required?.[old.inputName] ??\n def?.input?.optional?.[old.inputName]\n if (!input) continue\n\n widget.options.values = input[0]\n\n if (\n old.inputName !== 'image' &&\n !widget.options.values.includes(widget.value)\n ) {\n widget.value = widget.options.values[0]\n widget.callback(widget.value)\n }\n }\n }\n }\n }\n\n updateInnerWidgets() {\n for (const newWidgetName in this.groupData.newToOldWidgetMap) {\n const newWidget = this.node.widgets.find((w) => w.name === newWidgetName)\n if (!newWidget) continue\n\n const newValue = newWidget.value\n const old = this.groupData.newToOldWidgetMap[newWidgetName]\n let innerNode = this.innerNodes[old.node.index]\n\n if (innerNode.type === 'PrimitiveNode') {\n innerNode.primitiveValue = newValue\n const primitiveLinked = this.groupData.primitiveToWidget[old.node.index]\n for (const linked of primitiveLinked ?? []) {\n const node = this.innerNodes[linked.nodeId]\n const widget = node.widgets.find((w) => w.name === linked.inputName)\n\n if (widget) {\n widget.value = newValue\n }\n }\n continue\n } else if (innerNode.type === 'Reroute') {\n const rerouteLinks = this.groupData.linksFrom[old.node.index]\n if (rerouteLinks) {\n for (const [_, , targetNodeId, targetSlot] of rerouteLinks['0']) {\n const node = this.innerNodes[targetNodeId]\n const input = node.inputs[targetSlot]\n if (input.widget) {\n const widget = node.widgets?.find(\n (w) => w.name === input.widget.name\n )\n if (widget) {\n widget.value = newValue\n }\n }\n }\n }\n }\n\n const widget = innerNode.widgets?.find((w) => w.name === old.inputName)\n if (widget) {\n widget.value = newValue\n }\n }\n }\n\n populatePrimitive(node, nodeId, oldName, i, linkedShift) {\n // Converted widget, populate primitive if linked\n const primitiveId = this.groupData.widgetToPrimitive[nodeId]?.[oldName]\n if (primitiveId == null) return\n const targetWidgetName =\n this.groupData.oldToNewWidgetMap[primitiveId]['value']\n const targetWidgetIndex = this.node.widgets.findIndex(\n (w) => w.name === targetWidgetName\n )\n if (targetWidgetIndex > -1) {\n const primitiveNode = this.innerNodes[primitiveId]\n let len = primitiveNode.widgets.length\n if (\n len - 1 !==\n this.node.widgets[targetWidgetIndex].linkedWidgets?.length\n ) {\n // Fallback handling for if some reason the primitive has a different number of widgets\n // we dont want to overwrite random widgets, better to leave blank\n len = 1\n }\n for (let i = 0; i < len; i++) {\n this.node.widgets[targetWidgetIndex + i].value =\n primitiveNode.widgets[i].value\n }\n }\n return true\n }\n\n populateReroute(node, nodeId, map) {\n if (node.type !== 'Reroute') return\n\n const link = this.groupData.linksFrom[nodeId]?.[0]?.[0]\n if (!link) return\n const [, , targetNodeId, targetNodeSlot] = link\n const targetNode = this.groupData.nodeData.nodes[targetNodeId]\n const inputs = targetNode.inputs\n const targetWidget = inputs?.[targetNodeSlot]?.widget\n if (!targetWidget) return\n\n const offset = inputs.length - (targetNode.widgets_values?.length ?? 0)\n const v = targetNode.widgets_values?.[targetNodeSlot - offset]\n if (v == null) return\n\n const widgetName = Object.values(map)[0]\n const widget = this.node.widgets.find((w) => w.name === widgetName)\n if (widget) {\n widget.value = v\n }\n }\n\n populateWidgets() {\n if (!this.node.widgets) return\n\n for (\n let nodeId = 0;\n nodeId < this.groupData.nodeData.nodes.length;\n nodeId++\n ) {\n const node = this.groupData.nodeData.nodes[nodeId]\n const map = this.groupData.oldToNewWidgetMap[nodeId] ?? {}\n const widgets = Object.keys(map)\n\n if (!node.widgets_values?.length) {\n // special handling for populating values into reroutes\n // this allows primitives connect to them to pick up the correct value\n this.populateReroute(node, nodeId, map)\n continue\n }\n\n let linkedShift = 0\n for (let i = 0; i < widgets.length; i++) {\n const oldName = widgets[i]\n const newName = map[oldName]\n const widgetIndex = this.node.widgets.findIndex(\n (w) => w.name === newName\n )\n const mainWidget = this.node.widgets[widgetIndex]\n if (\n this.populatePrimitive(node, nodeId, oldName, i, linkedShift) ||\n widgetIndex === -1\n ) {\n // Find the inner widget and shift by the number of linked widgets as they will have been removed too\n const innerWidget = this.innerNodes[nodeId].widgets?.find(\n (w) => w.name === oldName\n )\n linkedShift += innerWidget?.linkedWidgets?.length ?? 0\n }\n if (widgetIndex === -1) {\n continue\n }\n\n // Populate the main and any linked widget\n mainWidget.value = node.widgets_values[i + linkedShift]\n for (let w = 0; w < mainWidget.linkedWidgets?.length; w++) {\n this.node.widgets[widgetIndex + w + 1].value =\n node.widgets_values[i + ++linkedShift]\n }\n }\n }\n }\n\n replaceNodes(nodes) {\n let top\n let left\n\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i]\n if (left == null || node.pos[0] < left) {\n left = node.pos[0]\n }\n if (top == null || node.pos[1] < top) {\n top = node.pos[1]\n }\n\n this.linkOutputs(node, i)\n app.graph.remove(node)\n }\n\n this.linkInputs()\n this.node.pos = [left, top]\n }\n\n linkOutputs(originalNode, nodeId) {\n if (!originalNode.outputs) return\n\n for (const output of originalNode.outputs) {\n if (!output.links) continue\n // Clone the links as they'll be changed if we reconnect\n const links = [...output.links]\n for (const l of links) {\n const link = app.graph.links[l]\n if (!link) continue\n\n const targetNode = app.graph.getNodeById(link.target_id)\n const newSlot =\n this.groupData.oldToNewOutputMap[nodeId]?.[link.origin_slot]\n if (newSlot != null) {\n this.node.connect(newSlot, targetNode, link.target_slot)\n }\n }\n }\n }\n\n linkInputs() {\n for (const link of this.groupData.nodeData.links ?? []) {\n const [, originSlot, targetId, targetSlot, actualOriginId] = link\n const originNode = app.graph.getNodeById(actualOriginId)\n if (!originNode) continue // this node is in the group\n originNode.connect(\n originSlot,\n this.node.id,\n this.groupData.oldToNewInputMap[targetId][targetSlot]\n )\n }\n }\n\n static getGroupData(node) {\n return (node.nodeData ?? node.constructor?.nodeData)?.[GROUP]\n }\n\n static isGroupNode(node) {\n return !!node.constructor?.nodeData?.[GROUP]\n }\n\n static async fromNodes(nodes) {\n // Process the nodes into the stored workflow group node data\n const builder = new GroupNodeBuilder(nodes)\n const res = builder.build()\n if (!res) return\n\n const { name, nodeData } = res\n\n // Convert this data into a LG node definition and register it\n const config = new GroupNodeConfig(name, nodeData)\n await config.registerType()\n\n const groupNode = LiteGraph.createNode(`${PREFIX}${SEPARATOR}${name}`)\n // Reuse the existing nodes for this instance\n groupNode.setInnerNodes(builder.nodes)\n groupNode[GROUP].populateWidgets()\n app.graph.add(groupNode)\n\n // Remove all converted nodes and relink them\n groupNode[GROUP].replaceNodes(builder.nodes)\n return groupNode\n }\n}\n\nfunction addConvertToGroupOptions() {\n function addConvertOption(options, index) {\n const selected = Object.values(app.canvas.selected_nodes ?? {})\n const disabled =\n selected.length < 2 ||\n selected.find((n) => GroupNodeHandler.isGroupNode(n))\n options.splice(index + 1, null, {\n content: `Convert to Group Node`,\n disabled,\n callback: async () => {\n return await GroupNodeHandler.fromNodes(selected)\n }\n })\n }\n\n function addManageOption(options, index) {\n const groups = app.graph.extra?.groupNodes\n const disabled = !groups || !Object.keys(groups).length\n options.splice(index + 1, null, {\n content: `Manage Group Nodes`,\n disabled,\n callback: () => {\n new ManageGroupDialog(app).show()\n }\n })\n }\n\n // Add to canvas\n const getCanvasMenuOptions = LGraphCanvas.prototype.getCanvasMenuOptions\n LGraphCanvas.prototype.getCanvasMenuOptions = function () {\n const options = getCanvasMenuOptions.apply(this, arguments)\n const index =\n options.findIndex((o) => o?.content === 'Add Group') + 1 || options.length\n addConvertOption(options, index)\n addManageOption(options, index + 1)\n return options\n }\n\n // Add to nodes\n const getNodeMenuOptions = LGraphCanvas.prototype.getNodeMenuOptions\n LGraphCanvas.prototype.getNodeMenuOptions = function (node) {\n const options = getNodeMenuOptions.apply(this, arguments)\n if (!GroupNodeHandler.isGroupNode(node)) {\n const index =\n options.findIndex((o) => o?.content === 'Outputs') + 1 ||\n options.length - 1\n addConvertOption(options, index)\n }\n return options\n }\n}\n\nconst replaceLegacySeparators = (nodes: ComfyNode[]): void => {\n for (const node of nodes) {\n if (typeof node.type === 'string' && node.type.startsWith('workflow/')) {\n node.type = node.type.replace(/^workflow\\//, `${PREFIX}${SEPARATOR}`)\n }\n }\n}\n\nconst id = 'Comfy.GroupNode'\nlet globalDefs\nconst ext = {\n name: id,\n setup() {\n addConvertToGroupOptions()\n },\n async beforeConfigureGraph(\n graphData: ComfyWorkflowJSON,\n missingNodeTypes: string[]\n ) {\n const nodes = graphData?.extra?.groupNodes\n if (nodes) {\n replaceLegacySeparators(graphData.nodes)\n await GroupNodeConfig.registerFromWorkflow(nodes, missingNodeTypes)\n }\n },\n addCustomNodeDefs(defs) {\n // Store this so we can mutate it later with group nodes\n globalDefs = defs\n },\n nodeCreated(node) {\n if (GroupNodeHandler.isGroupNode(node)) {\n node[GROUP] = new GroupNodeHandler(node)\n\n // Ensure group nodes pasted from other workflows are stored\n if (node.title && node[GROUP]?.groupData?.nodeData) {\n Workflow.storeGroupNode(node.title, node[GROUP].groupData.nodeData)\n }\n }\n },\n async refreshComboInNodes(defs) {\n // Re-register group nodes so new ones are created with the correct options\n Object.assign(globalDefs, defs)\n const nodes = app.graph.extra?.groupNodes\n if (nodes) {\n await GroupNodeConfig.registerFromWorkflow(nodes, {})\n }\n }\n}\n\napp.registerExtension(ext)\n","import { LGraphGroup } from '@comfyorg/litegraph'\nimport { app } from '../../scripts/app'\nimport { LGraphCanvas, LiteGraph } from '@comfyorg/litegraph'\n\nfunction setNodeMode(node, mode) {\n node.mode = mode\n node.graph.change()\n}\n\nfunction addNodesToGroup(group, nodes = []) {\n var x1, y1, x2, y2\n var nx1, ny1, nx2, ny2\n var node\n\n x1 = y1 = x2 = y2 = -1\n nx1 = ny1 = nx2 = ny2 = -1\n\n for (var n of [group.nodes, nodes]) {\n for (var i in n) {\n node = n[i]\n\n nx1 = node.pos[0]\n ny1 = node.pos[1]\n nx2 = node.pos[0] + node.size[0]\n ny2 = node.pos[1] + node.size[1]\n\n if (node.type != 'Reroute') {\n ny1 -= LiteGraph.NODE_TITLE_HEIGHT\n }\n\n if (node.flags?.collapsed) {\n ny2 = ny1 + LiteGraph.NODE_TITLE_HEIGHT\n\n if (node?._collapsed_width) {\n nx2 = nx1 + Math.round(node._collapsed_width)\n }\n }\n\n if (x1 == -1 || nx1 < x1) {\n x1 = nx1\n }\n\n if (y1 == -1 || ny1 < y1) {\n y1 = ny1\n }\n\n if (x2 == -1 || nx2 > x2) {\n x2 = nx2\n }\n\n if (y2 == -1 || ny2 > y2) {\n y2 = ny2\n }\n }\n }\n\n var padding = 10\n\n y1 = y1 - Math.round(group.font_size * 1.4)\n\n group.pos = [x1 - padding, y1 - padding]\n group.size = [x2 - x1 + padding * 2, y2 - y1 + padding * 2]\n}\n\napp.registerExtension({\n name: 'Comfy.GroupOptions',\n setup() {\n const orig = LGraphCanvas.prototype.getCanvasMenuOptions\n // graph_mouse\n LGraphCanvas.prototype.getCanvasMenuOptions = function () {\n const options = orig.apply(this, arguments)\n const group = this.graph.getGroupOnPos(\n this.graph_mouse[0],\n this.graph_mouse[1]\n )\n if (!group) {\n options.push({\n content: 'Add Group For Selected Nodes',\n disabled: !Object.keys(app.canvas.selected_nodes || {}).length,\n callback: () => {\n const group = new LGraphGroup()\n addNodesToGroup(group, this.selected_nodes)\n app.canvas.graph.add(group)\n this.graph.change()\n }\n })\n\n return options\n }\n\n // Group nodes aren't recomputed until the group is moved, this ensures the nodes are up-to-date\n group.recomputeInsideNodes()\n const nodesInGroup = group.nodes\n\n options.push({\n content: 'Add Selected Nodes To Group',\n disabled: !Object.keys(app.canvas.selected_nodes || {}).length,\n callback: () => {\n addNodesToGroup(group, this.selected_nodes)\n this.graph.change()\n }\n })\n\n // No nodes in group, return default options\n if (nodesInGroup.length === 0) {\n return options\n } else {\n // Add a separator between the default options and the group options\n options.push(null)\n }\n\n // Check if all nodes are the same mode\n let allNodesAreSameMode = true\n for (let i = 1; i < nodesInGroup.length; i++) {\n if (nodesInGroup[i].mode !== nodesInGroup[0].mode) {\n allNodesAreSameMode = false\n break\n }\n }\n\n options.push({\n content: 'Fit Group To Nodes',\n callback: () => {\n addNodesToGroup(group)\n this.graph.change()\n }\n })\n\n options.push({\n content: 'Select Nodes',\n callback: () => {\n this.selectNodes(nodesInGroup)\n this.graph.change()\n this.canvas.focus()\n }\n })\n\n // Modes\n // 0: Always\n // 1: On Event\n // 2: Never\n // 3: On Trigger\n // 4: Bypass\n // If all nodes are the same mode, add a menu option to change the mode\n if (allNodesAreSameMode) {\n const mode = nodesInGroup[0].mode\n switch (mode) {\n case 0:\n // All nodes are always, option to disable, and bypass\n options.push({\n content: 'Set Group Nodes to Never',\n callback: () => {\n for (const node of nodesInGroup) {\n setNodeMode(node, 2)\n }\n }\n })\n options.push({\n content: 'Bypass Group Nodes',\n callback: () => {\n for (const node of nodesInGroup) {\n setNodeMode(node, 4)\n }\n }\n })\n break\n case 2:\n // All nodes are never, option to enable, and bypass\n options.push({\n content: 'Set Group Nodes to Always',\n callback: () => {\n for (const node of nodesInGroup) {\n setNodeMode(node, 0)\n }\n }\n })\n options.push({\n content: 'Bypass Group Nodes',\n callback: () => {\n for (const node of nodesInGroup) {\n setNodeMode(node, 4)\n }\n }\n })\n break\n case 4:\n // All nodes are bypass, option to enable, and disable\n options.push({\n content: 'Set Group Nodes to Always',\n callback: () => {\n for (const node of nodesInGroup) {\n setNodeMode(node, 0)\n }\n }\n })\n options.push({\n content: 'Set Group Nodes to Never',\n callback: () => {\n for (const node of nodesInGroup) {\n setNodeMode(node, 2)\n }\n }\n })\n break\n default:\n // All nodes are On Trigger or On Event(Or other?), option to disable, set to always, or bypass\n options.push({\n content: 'Set Group Nodes to Always',\n callback: () => {\n for (const node of nodesInGroup) {\n setNodeMode(node, 0)\n }\n }\n })\n options.push({\n content: 'Set Group Nodes to Never',\n callback: () => {\n for (const node of nodesInGroup) {\n setNodeMode(node, 2)\n }\n }\n })\n options.push({\n content: 'Bypass Group Nodes',\n callback: () => {\n for (const node of nodesInGroup) {\n setNodeMode(node, 4)\n }\n }\n })\n break\n }\n } else {\n // Nodes are not all the same mode, add a menu option to change the mode to always, never, or bypass\n options.push({\n content: 'Set Group Nodes to Always',\n callback: () => {\n for (const node of nodesInGroup) {\n setNodeMode(node, 0)\n }\n }\n })\n options.push({\n content: 'Set Group Nodes to Never',\n callback: () => {\n for (const node of nodesInGroup) {\n setNodeMode(node, 2)\n }\n }\n })\n options.push({\n content: 'Bypass Group Nodes',\n callback: () => {\n for (const node of nodesInGroup) {\n setNodeMode(node, 4)\n }\n }\n })\n }\n\n return options\n }\n }\n})\n","import { LiteGraph } from '@comfyorg/litegraph'\nimport { app } from '../../scripts/app'\n\n// Inverts the scrolling of context menus\n\nconst id = 'Comfy.InvertMenuScrolling'\napp.registerExtension({\n name: id,\n init() {\n const ctxMenu = LiteGraph.ContextMenu\n const replace = () => {\n // @ts-expect-error\n LiteGraph.ContextMenu = function (values, options) {\n options = options || {}\n if (options.scroll_speed) {\n options.scroll_speed *= -1\n } else {\n options.scroll_speed = -0.1\n }\n return ctxMenu.call(this, values, options)\n }\n LiteGraph.ContextMenu.prototype = ctxMenu.prototype\n }\n app.ui.settings.addSetting({\n id,\n category: ['Comfy', 'Graph', 'InvertMenuScrolling'],\n name: 'Invert Context Menu Scrolling',\n type: 'boolean',\n defaultValue: false,\n onChange(value) {\n if (value) {\n replace()\n } else {\n LiteGraph.ContextMenu = ctxMenu\n }\n }\n })\n }\n})\n","import { app } from '../../scripts/app'\nimport { KeyComboImpl, useKeybindingStore } from '@/stores/keybindingStore'\nimport { useCommandStore } from '@/stores/commandStore'\n\napp.registerExtension({\n name: 'Comfy.Keybinds',\n init() {\n const keybindListener = async function (event: KeyboardEvent) {\n // Ignore keybindings for legacy jest tests as jest tests don't have\n // a Vue app instance or pinia stores.\n if (!app.vueAppReady) return\n\n const keyCombo = KeyComboImpl.fromEvent(event)\n if (keyCombo.isModifier) {\n return\n }\n\n // Ignore non-modifier keybindings if typing in input fields\n const target = event.composedPath()[0] as HTMLElement\n if (\n !keyCombo.hasModifier &&\n (target.tagName === 'TEXTAREA' ||\n target.tagName === 'INPUT' ||\n (target.tagName === 'SPAN' &&\n target.classList.contains('property_value')))\n ) {\n return\n }\n\n const keybindingStore = useKeybindingStore()\n const commandStore = useCommandStore()\n const keybinding = keybindingStore.getKeybinding(keyCombo)\n if (keybinding && keybinding.targetSelector !== '#graph-canvas') {\n await commandStore.execute(keybinding.commandId)\n event.preventDefault()\n return\n }\n\n // Finished Handling all modifier keybinds, now handle the rest\n if (event.ctrlKey || event.altKey || event.metaKey) {\n return\n }\n\n // Close out of modals using escape\n if (event.key === 'Escape') {\n const modals = document.querySelectorAll<HTMLElement>('.comfy-modal')\n const modal = Array.from(modals).find(\n (modal) =>\n window.getComputedStyle(modal).getPropertyValue('display') !==\n 'none'\n )\n if (modal) {\n modal.style.display = 'none'\n }\n\n ;[...document.querySelectorAll('dialog')].forEach((d) => {\n d.close()\n })\n }\n }\n\n window.addEventListener('keydown', keybindListener)\n }\n})\n","import { app } from '../../scripts/app'\nimport { LiteGraph } from '@comfyorg/litegraph'\nconst id = 'Comfy.LinkRenderMode'\nconst ext = {\n name: id,\n async setup(app) {\n app.ui.settings.addSetting({\n id,\n category: ['Comfy', 'Graph', 'LinkRenderMode'],\n name: 'Link Render Mode',\n defaultValue: 2,\n type: 'combo',\n options: [\n { value: LiteGraph.STRAIGHT_LINK, text: 'Straight' },\n { value: LiteGraph.LINEAR_LINK, text: 'Linear' },\n { value: LiteGraph.SPLINE_LINK, text: 'Spline' },\n { value: LiteGraph.HIDDEN_LINK, text: 'Hidden' }\n ],\n onChange(value: number) {\n app.canvas.links_render_mode = +value\n app.canvas.setDirty(/* fg */ false, /* bg */ true)\n }\n })\n }\n}\n\napp.registerExtension(ext)\n","import { app } from '../../scripts/app'\nimport { ComfyDialog, $el } from '../../scripts/ui'\nimport { ComfyApp } from '../../scripts/app'\nimport { api } from '../../scripts/api'\nimport { ClipspaceDialog } from './clipspace'\n\n// Helper function to convert a data URL to a Blob object\nfunction dataURLToBlob(dataURL) {\n const parts = dataURL.split(';base64,')\n const contentType = parts[0].split(':')[1]\n const byteString = atob(parts[1])\n const arrayBuffer = new ArrayBuffer(byteString.length)\n const uint8Array = new Uint8Array(arrayBuffer)\n for (let i = 0; i < byteString.length; i++) {\n uint8Array[i] = byteString.charCodeAt(i)\n }\n return new Blob([arrayBuffer], { type: contentType })\n}\n\nfunction loadedImageToBlob(image) {\n const canvas = document.createElement('canvas')\n\n canvas.width = image.width\n canvas.height = image.height\n\n const ctx = canvas.getContext('2d')\n\n ctx.drawImage(image, 0, 0)\n\n const dataURL = canvas.toDataURL('image/png', 1)\n const blob = dataURLToBlob(dataURL)\n\n return blob\n}\n\nfunction loadImage(imagePath) {\n return new Promise((resolve, reject) => {\n const image = new Image()\n\n image.onload = function () {\n resolve(image)\n }\n\n image.src = imagePath\n })\n}\n\nasync function uploadMask(filepath, formData) {\n await api\n .fetchApi('/upload/mask', {\n method: 'POST',\n body: formData\n })\n .then((response) => {})\n .catch((error) => {\n console.error('Error:', error)\n })\n\n ComfyApp.clipspace.imgs[ComfyApp.clipspace['selectedIndex']] = new Image()\n ComfyApp.clipspace.imgs[ComfyApp.clipspace['selectedIndex']].src = api.apiURL(\n '/view?' +\n new URLSearchParams(filepath).toString() +\n app.getPreviewFormatParam() +\n app.getRandParam()\n )\n\n if (ComfyApp.clipspace.images)\n ComfyApp.clipspace.images[ComfyApp.clipspace['selectedIndex']] = filepath\n\n ClipspaceDialog.invalidatePreview()\n}\n\nfunction prepare_mask(image, maskCanvas, maskCtx, maskColor) {\n // paste mask data into alpha channel\n maskCtx.drawImage(image, 0, 0, maskCanvas.width, maskCanvas.height)\n const maskData = maskCtx.getImageData(\n 0,\n 0,\n maskCanvas.width,\n maskCanvas.height\n )\n\n // invert mask\n for (let i = 0; i < maskData.data.length; i += 4) {\n if (maskData.data[i + 3] == 255) maskData.data[i + 3] = 0\n else maskData.data[i + 3] = 255\n\n maskData.data[i] = maskColor.r\n maskData.data[i + 1] = maskColor.g\n maskData.data[i + 2] = maskColor.b\n }\n\n maskCtx.globalCompositeOperation = 'source-over'\n maskCtx.putImageData(maskData, 0, 0)\n}\n\n// Define the PointerType enum\nenum PointerType {\n Arc = 'arc',\n Rect = 'rect'\n}\n\nenum CompositionOperation {\n SourceOver = 'source-over',\n DestinationOut = 'destination-out'\n}\n\nclass MaskEditorDialog extends ComfyDialog {\n static instance = null\n static mousedown_x: number | null = null\n static mousedown_y: number | null = null\n\n brush: HTMLDivElement\n maskCtx: any\n maskCanvas: HTMLCanvasElement\n brush_size_slider: HTMLDivElement\n brush_opacity_slider: HTMLDivElement\n colorButton: HTMLButtonElement\n saveButton: HTMLButtonElement\n zoom_ratio: number\n pan_x: number\n pan_y: number\n imgCanvas: HTMLCanvasElement\n last_display_style: string\n is_visible: boolean\n image: HTMLImageElement\n handler_registered: boolean\n brush_slider_input: HTMLInputElement\n cursorX: number\n cursorY: number\n mousedown_pan_x: number\n mousedown_pan_y: number\n last_pressure: number\n pointer_type: PointerType\n brush_pointer_type_select: HTMLDivElement\n\n static getInstance() {\n if (!MaskEditorDialog.instance) {\n MaskEditorDialog.instance = new MaskEditorDialog()\n }\n\n return MaskEditorDialog.instance\n }\n\n is_layout_created = false\n\n constructor() {\n super()\n this.element = $el('div.comfy-modal', { parent: document.body }, [\n $el('div.comfy-modal-content', [...this.createButtons()])\n ])\n }\n\n createButtons() {\n return []\n }\n\n createButton(name, callback): HTMLButtonElement {\n var button = document.createElement('button')\n button.style.pointerEvents = 'auto'\n button.innerText = name\n button.addEventListener('click', callback)\n return button\n }\n\n createLeftButton(name, callback) {\n var button = this.createButton(name, callback)\n button.style.cssFloat = 'left'\n button.style.marginRight = '4px'\n return button\n }\n\n createRightButton(name, callback) {\n var button = this.createButton(name, callback)\n button.style.cssFloat = 'right'\n button.style.marginLeft = '4px'\n return button\n }\n\n createLeftSlider(self, name, callback): HTMLDivElement {\n const divElement = document.createElement('div')\n divElement.id = 'maskeditor-slider'\n divElement.style.cssFloat = 'left'\n divElement.style.fontFamily = 'sans-serif'\n divElement.style.marginRight = '4px'\n divElement.style.color = 'var(--input-text)'\n divElement.style.backgroundColor = 'var(--comfy-input-bg)'\n divElement.style.borderRadius = '8px'\n divElement.style.borderColor = 'var(--border-color)'\n divElement.style.borderStyle = 'solid'\n divElement.style.fontSize = '15px'\n divElement.style.height = '25px'\n divElement.style.padding = '1px 6px'\n divElement.style.display = 'flex'\n divElement.style.position = 'relative'\n divElement.style.top = '2px'\n divElement.style.pointerEvents = 'auto'\n self.brush_slider_input = document.createElement('input')\n self.brush_slider_input.setAttribute('type', 'range')\n self.brush_slider_input.setAttribute('min', '1')\n self.brush_slider_input.setAttribute('max', '100')\n self.brush_slider_input.setAttribute('value', '10')\n const labelElement = document.createElement('label')\n labelElement.textContent = name\n\n divElement.appendChild(labelElement)\n divElement.appendChild(self.brush_slider_input)\n\n self.brush_slider_input.addEventListener('change', callback)\n\n return divElement\n }\n\n createOpacitySlider(self, name, callback): HTMLDivElement {\n const divElement = document.createElement('div')\n divElement.id = 'maskeditor-opacity-slider'\n divElement.style.cssFloat = 'left'\n divElement.style.fontFamily = 'sans-serif'\n divElement.style.marginRight = '4px'\n divElement.style.color = 'var(--input-text)'\n divElement.style.backgroundColor = 'var(--comfy-input-bg)'\n divElement.style.borderRadius = '8px'\n divElement.style.borderColor = 'var(--border-color)'\n divElement.style.borderStyle = 'solid'\n divElement.style.fontSize = '15px'\n divElement.style.height = '25px'\n divElement.style.padding = '1px 6px'\n divElement.style.display = 'flex'\n divElement.style.position = 'relative'\n divElement.style.top = '2px'\n divElement.style.pointerEvents = 'auto'\n self.opacity_slider_input = document.createElement('input')\n self.opacity_slider_input.setAttribute('type', 'range')\n self.opacity_slider_input.setAttribute('min', '0.1')\n self.opacity_slider_input.setAttribute('max', '1.0')\n self.opacity_slider_input.setAttribute('step', '0.01')\n self.opacity_slider_input.setAttribute('value', '0.7')\n const labelElement = document.createElement('label')\n labelElement.textContent = name\n\n divElement.appendChild(labelElement)\n divElement.appendChild(self.opacity_slider_input)\n\n self.opacity_slider_input.addEventListener('input', callback)\n\n return divElement\n }\n\n createPointerTypeSelect(self: any): HTMLDivElement {\n const divElement = document.createElement('div')\n divElement.id = 'maskeditor-pointer-type'\n divElement.style.cssFloat = 'left'\n divElement.style.fontFamily = 'sans-serif'\n divElement.style.marginRight = '4px'\n divElement.style.color = 'var(--input-text)'\n divElement.style.backgroundColor = 'var(--comfy-input-bg)'\n divElement.style.borderRadius = '8px'\n divElement.style.borderColor = 'var(--border-color)'\n divElement.style.borderStyle = 'solid'\n divElement.style.fontSize = '15px'\n divElement.style.height = '25px'\n divElement.style.padding = '1px 6px'\n divElement.style.display = 'flex'\n divElement.style.position = 'relative'\n divElement.style.top = '2px'\n divElement.style.pointerEvents = 'auto'\n\n const labelElement = document.createElement('label')\n labelElement.textContent = 'Pointer Type:'\n\n const selectElement = document.createElement('select')\n selectElement.style.borderRadius = '0'\n selectElement.style.borderColor = 'transparent'\n selectElement.style.borderStyle = 'unset'\n selectElement.style.fontSize = '0.9em'\n\n const optionArc = document.createElement('option')\n optionArc.value = 'arc'\n optionArc.text = 'Circle'\n optionArc.selected = true // Fix for TypeScript, \"selected\" should be boolean\n\n const optionRect = document.createElement('option')\n optionRect.value = 'rect'\n optionRect.text = 'Square'\n\n selectElement.appendChild(optionArc)\n selectElement.appendChild(optionRect)\n\n selectElement.addEventListener('change', (event: Event) => {\n const target = event.target as HTMLSelectElement\n self.pointer_type = target.value\n this.setBrushBorderRadius(self)\n })\n\n divElement.appendChild(labelElement)\n divElement.appendChild(selectElement)\n\n return divElement\n }\n\n setBrushBorderRadius(self: any): void {\n if (self.pointer_type === PointerType.Rect) {\n this.brush.style.borderRadius = '0%'\n // @ts-expect-error\n this.brush.style.MozBorderRadius = '0%'\n // @ts-expect-error\n this.brush.style.WebkitBorderRadius = '0%'\n } else {\n this.brush.style.borderRadius = '50%'\n // @ts-expect-error\n this.brush.style.MozBorderRadius = '50%'\n // @ts-expect-error\n this.brush.style.WebkitBorderRadius = '50%'\n }\n }\n\n setlayout(imgCanvas: HTMLCanvasElement, maskCanvas: HTMLCanvasElement) {\n const self = this\n self.pointer_type = PointerType.Arc\n\n // If it is specified as relative, using it only as a hidden placeholder for padding is recommended\n // to prevent anomalies where it exceeds a certain size and goes outside of the window.\n var bottom_panel = document.createElement('div')\n bottom_panel.style.position = 'absolute'\n bottom_panel.style.bottom = '0px'\n bottom_panel.style.left = '20px'\n bottom_panel.style.right = '20px'\n bottom_panel.style.height = '50px'\n bottom_panel.style.pointerEvents = 'none'\n\n var brush = document.createElement('div')\n brush.id = 'brush'\n brush.style.backgroundColor = 'transparent'\n brush.style.outline = '1px dashed black'\n brush.style.boxShadow = '0 0 0 1px white'\n brush.style.position = 'absolute'\n brush.style.zIndex = '8889'\n brush.style.pointerEvents = 'none'\n this.brush = brush\n this.setBrushBorderRadius(self)\n this.element.appendChild(imgCanvas)\n this.element.appendChild(maskCanvas)\n this.element.appendChild(bottom_panel)\n document.body.appendChild(brush)\n\n var clearButton = this.createLeftButton('Clear', () => {\n self.maskCtx.clearRect(\n 0,\n 0,\n self.maskCanvas.width,\n self.maskCanvas.height\n )\n })\n\n this.brush_size_slider = this.createLeftSlider(\n self,\n 'Thickness',\n (event) => {\n self.brush_size = event.target.value\n self.updateBrushPreview(self)\n }\n )\n\n this.brush_opacity_slider = this.createOpacitySlider(\n self,\n 'Opacity',\n (event) => {\n self.brush_opacity = event.target.value\n if (self.brush_color_mode !== 'negative') {\n self.maskCanvas.style.opacity = self.brush_opacity.toString()\n }\n }\n )\n\n this.brush_pointer_type_select = this.createPointerTypeSelect(self)\n this.colorButton = this.createLeftButton(this.getColorButtonText(), () => {\n if (self.brush_color_mode === 'black') {\n self.brush_color_mode = 'white'\n } else if (self.brush_color_mode === 'white') {\n self.brush_color_mode = 'negative'\n } else {\n self.brush_color_mode = 'black'\n }\n\n self.updateWhenBrushColorModeChanged()\n })\n\n var cancelButton = this.createRightButton('Cancel', () => {\n document.removeEventListener('keydown', MaskEditorDialog.handleKeyDown)\n self.close()\n })\n\n this.saveButton = this.createRightButton('Save', () => {\n document.removeEventListener('keydown', MaskEditorDialog.handleKeyDown)\n self.save()\n })\n\n this.element.appendChild(imgCanvas)\n this.element.appendChild(maskCanvas)\n this.element.appendChild(bottom_panel)\n\n bottom_panel.appendChild(clearButton)\n bottom_panel.appendChild(this.saveButton)\n bottom_panel.appendChild(cancelButton)\n bottom_panel.appendChild(this.brush_size_slider)\n bottom_panel.appendChild(this.brush_opacity_slider)\n bottom_panel.appendChild(this.brush_pointer_type_select)\n bottom_panel.appendChild(this.colorButton)\n\n imgCanvas.style.position = 'absolute'\n maskCanvas.style.position = 'absolute'\n\n imgCanvas.style.top = '200'\n imgCanvas.style.left = '0'\n\n maskCanvas.style.top = imgCanvas.style.top\n maskCanvas.style.left = imgCanvas.style.left\n\n const maskCanvasStyle = this.getMaskCanvasStyle()\n maskCanvas.style.mixBlendMode = maskCanvasStyle.mixBlendMode\n maskCanvas.style.opacity = maskCanvasStyle.opacity.toString()\n }\n\n async show() {\n this.zoom_ratio = 1.0\n this.pan_x = 0\n this.pan_y = 0\n\n if (!this.is_layout_created) {\n // layout\n const imgCanvas = document.createElement('canvas')\n const maskCanvas = document.createElement('canvas')\n\n imgCanvas.id = 'imageCanvas'\n maskCanvas.id = 'maskCanvas'\n\n this.setlayout(imgCanvas, maskCanvas)\n\n // prepare content\n this.imgCanvas = imgCanvas\n this.maskCanvas = maskCanvas\n this.maskCtx = maskCanvas.getContext('2d', { willReadFrequently: true })\n\n this.setEventHandler(maskCanvas)\n\n this.is_layout_created = true\n\n // replacement of onClose hook since close is not real close\n const self = this\n const observer = new MutationObserver(function (mutations) {\n mutations.forEach(function (mutation) {\n if (\n mutation.type === 'attributes' &&\n mutation.attributeName === 'style'\n ) {\n if (\n self.last_display_style &&\n self.last_display_style != 'none' &&\n self.element.style.display == 'none'\n ) {\n self.brush.style.display = 'none'\n ComfyApp.onClipspaceEditorClosed()\n }\n\n self.last_display_style = self.element.style.display\n }\n })\n })\n\n const config = { attributes: true }\n observer.observe(this.element, config)\n }\n\n // The keydown event needs to be reconfigured when closing the dialog as it gets removed.\n document.addEventListener('keydown', MaskEditorDialog.handleKeyDown)\n\n if (ComfyApp.clipspace_return_node) {\n this.saveButton.innerText = 'Save to node'\n } else {\n this.saveButton.innerText = 'Save'\n }\n this.saveButton.disabled = false\n\n this.element.style.display = 'block'\n this.element.style.width = '85%'\n this.element.style.margin = '0 7.5%'\n this.element.style.height = '100vh'\n this.element.style.top = '50%'\n this.element.style.left = '42%'\n this.element.style.zIndex = '8888' // NOTE: alert dialog must be high priority.\n\n await this.setImages(this.imgCanvas)\n\n this.is_visible = true\n }\n\n isOpened() {\n return this.element.style.display == 'block'\n }\n\n invalidateCanvas(orig_image, mask_image) {\n this.imgCanvas.width = orig_image.width\n this.imgCanvas.height = orig_image.height\n\n this.maskCanvas.width = orig_image.width\n this.maskCanvas.height = orig_image.height\n\n let imgCtx = this.imgCanvas.getContext('2d', { willReadFrequently: true })\n let maskCtx = this.maskCanvas.getContext('2d', {\n willReadFrequently: true\n })\n\n imgCtx.drawImage(orig_image, 0, 0, orig_image.width, orig_image.height)\n prepare_mask(mask_image, this.maskCanvas, maskCtx, this.getMaskColor())\n }\n\n async setImages(imgCanvas) {\n let self = this\n\n const imgCtx = imgCanvas.getContext('2d', { willReadFrequently: true })\n const maskCtx = this.maskCtx\n const maskCanvas = this.maskCanvas\n\n imgCtx.clearRect(0, 0, this.imgCanvas.width, this.imgCanvas.height)\n maskCtx.clearRect(0, 0, this.maskCanvas.width, this.maskCanvas.height)\n\n // image load\n const filepath = ComfyApp.clipspace.images\n\n const alpha_url = new URL(\n ComfyApp.clipspace.imgs[ComfyApp.clipspace['selectedIndex']].src\n )\n alpha_url.searchParams.delete('channel')\n alpha_url.searchParams.delete('preview')\n alpha_url.searchParams.set('channel', 'a')\n let mask_image = await loadImage(alpha_url)\n\n // original image load\n const rgb_url = new URL(\n ComfyApp.clipspace.imgs[ComfyApp.clipspace['selectedIndex']].src\n )\n rgb_url.searchParams.delete('channel')\n rgb_url.searchParams.set('channel', 'rgb')\n this.image = new Image()\n this.image.onload = function () {\n maskCanvas.width = self.image.width\n maskCanvas.height = self.image.height\n\n self.invalidateCanvas(self.image, mask_image)\n self.initializeCanvasPanZoom()\n }\n this.image.src = rgb_url.toString()\n }\n\n initializeCanvasPanZoom() {\n // set initialize\n let drawWidth = this.image.width\n let drawHeight = this.image.height\n\n let width = this.element.clientWidth\n let height = this.element.clientHeight\n\n if (this.image.width > width) {\n drawWidth = width\n drawHeight = (drawWidth / this.image.width) * this.image.height\n }\n\n if (drawHeight > height) {\n drawHeight = height\n drawWidth = (drawHeight / this.image.height) * this.image.width\n }\n\n this.zoom_ratio = drawWidth / this.image.width\n\n const canvasX = (width - drawWidth) / 2\n const canvasY = (height - drawHeight) / 2\n this.pan_x = canvasX\n this.pan_y = canvasY\n\n this.invalidatePanZoom()\n }\n\n invalidatePanZoom() {\n let raw_width = this.image.width * this.zoom_ratio\n let raw_height = this.image.height * this.zoom_ratio\n\n if (this.pan_x + raw_width < 10) {\n this.pan_x = 10 - raw_width\n }\n\n if (this.pan_y + raw_height < 10) {\n this.pan_y = 10 - raw_height\n }\n\n let width = `${raw_width}px`\n let height = `${raw_height}px`\n\n let left = `${this.pan_x}px`\n let top = `${this.pan_y}px`\n\n this.maskCanvas.style.width = width\n this.maskCanvas.style.height = height\n this.maskCanvas.style.left = left\n this.maskCanvas.style.top = top\n\n this.imgCanvas.style.width = width\n this.imgCanvas.style.height = height\n this.imgCanvas.style.left = left\n this.imgCanvas.style.top = top\n }\n\n setEventHandler(maskCanvas) {\n const self = this\n\n if (!this.handler_registered) {\n maskCanvas.addEventListener('contextmenu', (event) => {\n event.preventDefault()\n })\n\n this.element.addEventListener('wheel', (event) =>\n this.handleWheelEvent(self, event)\n )\n this.element.addEventListener('pointermove', (event) =>\n this.pointMoveEvent(self, event)\n )\n this.element.addEventListener('touchmove', (event) =>\n this.pointMoveEvent(self, event)\n )\n\n this.element.addEventListener('dragstart', (event) => {\n if (event.ctrlKey) {\n event.preventDefault()\n }\n })\n\n maskCanvas.addEventListener('pointerdown', (event) =>\n this.handlePointerDown(self, event)\n )\n maskCanvas.addEventListener('pointermove', (event) =>\n this.draw_move(self, event)\n )\n maskCanvas.addEventListener('touchmove', (event) =>\n this.draw_move(self, event)\n )\n maskCanvas.addEventListener('pointerover', (event) => {\n this.brush.style.display = 'block'\n })\n maskCanvas.addEventListener('pointerleave', (event) => {\n this.brush.style.display = 'none'\n })\n\n document.addEventListener('pointerup', MaskEditorDialog.handlePointerUp)\n\n this.handler_registered = true\n }\n }\n\n getMaskCanvasStyle() {\n if (this.brush_color_mode === 'negative') {\n return {\n mixBlendMode: 'difference',\n opacity: '1'\n }\n } else {\n return {\n mixBlendMode: 'initial',\n opacity: this.brush_opacity\n }\n }\n }\n\n getMaskColor() {\n if (this.brush_color_mode === 'black') {\n return { r: 0, g: 0, b: 0 }\n }\n if (this.brush_color_mode === 'white') {\n return { r: 255, g: 255, b: 255 }\n }\n if (this.brush_color_mode === 'negative') {\n // negative effect only works with white color\n return { r: 255, g: 255, b: 255 }\n }\n\n return { r: 0, g: 0, b: 0 }\n }\n\n getMaskFillStyle() {\n const maskColor = this.getMaskColor()\n\n return 'rgb(' + maskColor.r + ',' + maskColor.g + ',' + maskColor.b + ')'\n }\n\n getColorButtonText() {\n let colorCaption = 'unknown'\n\n if (this.brush_color_mode === 'black') {\n colorCaption = 'black'\n } else if (this.brush_color_mode === 'white') {\n colorCaption = 'white'\n } else if (this.brush_color_mode === 'negative') {\n colorCaption = 'negative'\n }\n\n return 'Color: ' + colorCaption\n }\n\n updateWhenBrushColorModeChanged() {\n this.colorButton.innerText = this.getColorButtonText()\n\n // update mask canvas css styles\n\n const maskCanvasStyle = this.getMaskCanvasStyle()\n this.maskCanvas.style.mixBlendMode = maskCanvasStyle.mixBlendMode\n this.maskCanvas.style.opacity = maskCanvasStyle.opacity.toString()\n\n // update mask canvas rgb colors\n\n const maskColor = this.getMaskColor()\n\n const maskData = this.maskCtx.getImageData(\n 0,\n 0,\n this.maskCanvas.width,\n this.maskCanvas.height\n )\n\n for (let i = 0; i < maskData.data.length; i += 4) {\n maskData.data[i] = maskColor.r\n maskData.data[i + 1] = maskColor.g\n maskData.data[i + 2] = maskColor.b\n }\n\n this.maskCtx.putImageData(maskData, 0, 0)\n }\n\n brush_opacity = 0.7\n brush_size = 10\n brush_color_mode = 'black'\n drawing_mode = false\n lastx = -1\n lasty = -1\n lasttime = 0\n\n static handleKeyDown(event) {\n const self = MaskEditorDialog.instance\n if (event.key === ']') {\n self.brush_size = Math.min(self.brush_size + 2, 100)\n self.brush_slider_input.value = self.brush_size\n } else if (event.key === '[') {\n self.brush_size = Math.max(self.brush_size - 2, 1)\n self.brush_slider_input.value = self.brush_size\n } else if (event.key === 'Enter') {\n self.save()\n }\n\n self.updateBrushPreview(self)\n }\n\n static handlePointerUp(event) {\n event.preventDefault()\n\n this.mousedown_x = null\n this.mousedown_y = null\n\n MaskEditorDialog.instance.drawing_mode = false\n }\n\n updateBrushPreview(self) {\n const brush = self.brush\n\n var centerX = self.cursorX\n var centerY = self.cursorY\n\n brush.style.width = self.brush_size * 2 * this.zoom_ratio + 'px'\n brush.style.height = self.brush_size * 2 * this.zoom_ratio + 'px'\n brush.style.left = centerX - self.brush_size * this.zoom_ratio + 'px'\n brush.style.top = centerY - self.brush_size * this.zoom_ratio + 'px'\n }\n\n handleWheelEvent(self, event) {\n event.preventDefault()\n\n if (event.ctrlKey) {\n // zoom canvas\n if (event.deltaY < 0) {\n this.zoom_ratio = Math.min(10.0, this.zoom_ratio + 0.2)\n } else {\n this.zoom_ratio = Math.max(0.2, this.zoom_ratio - 0.2)\n }\n\n this.invalidatePanZoom()\n } else {\n // adjust brush size\n if (event.deltaY < 0) this.brush_size = Math.min(this.brush_size + 2, 100)\n else this.brush_size = Math.max(this.brush_size - 2, 1)\n\n this.brush_slider_input.value = this.brush_size.toString()\n\n this.updateBrushPreview(this)\n }\n }\n\n pointMoveEvent(self, event) {\n this.cursorX = event.pageX\n this.cursorY = event.pageY\n\n self.updateBrushPreview(self)\n\n if (event.ctrlKey) {\n event.preventDefault()\n self.pan_move(self, event)\n }\n\n let left_button_down =\n (window.TouchEvent && event instanceof TouchEvent) || event.buttons == 1\n\n if (event.shiftKey && left_button_down) {\n self.drawing_mode = false\n\n const y = event.clientY\n let delta = (self.zoom_lasty - y) * 0.005\n self.zoom_ratio = Math.max(\n Math.min(10.0, self.last_zoom_ratio - delta),\n 0.2\n )\n\n this.invalidatePanZoom()\n return\n }\n }\n\n pan_move(self, event) {\n if (event.buttons == 1) {\n if (MaskEditorDialog.mousedown_x) {\n let deltaX = MaskEditorDialog.mousedown_x - event.clientX\n let deltaY = MaskEditorDialog.mousedown_y - event.clientY\n\n self.pan_x = this.mousedown_pan_x - deltaX\n self.pan_y = this.mousedown_pan_y - deltaY\n\n self.invalidatePanZoom()\n }\n }\n }\n\n draw_move(self, event) {\n if (event.ctrlKey || event.shiftKey) {\n return\n }\n\n event.preventDefault()\n\n this.cursorX = event.pageX\n this.cursorY = event.pageY\n\n self.updateBrushPreview(self)\n\n let left_button_down =\n (window.TouchEvent && event instanceof TouchEvent) || event.buttons == 1\n let right_button_down = [2, 5, 32].includes(event.buttons)\n\n if (!event.altKey && left_button_down) {\n var diff = performance.now() - self.lasttime\n\n const maskRect = self.maskCanvas.getBoundingClientRect()\n\n var x = event.offsetX\n var y = event.offsetY\n\n if (event.offsetX == null) {\n x = event.targetTouches[0].clientX - maskRect.left\n }\n\n if (event.offsetY == null) {\n y = event.targetTouches[0].clientY - maskRect.top\n }\n\n x /= self.zoom_ratio\n y /= self.zoom_ratio\n\n var brush_size = this.brush_size\n if (event instanceof PointerEvent && event.pointerType == 'pen') {\n brush_size *= event.pressure\n this.last_pressure = event.pressure\n } else if (\n window.TouchEvent &&\n event instanceof TouchEvent &&\n diff < 20\n ) {\n // The firing interval of PointerEvents in Pen is unreliable, so it is supplemented by TouchEvents.\n brush_size *= this.last_pressure\n } else {\n brush_size = this.brush_size\n }\n\n if (diff > 20 && !this.drawing_mode)\n requestAnimationFrame(() => {\n self.init_shape(self, CompositionOperation.SourceOver)\n self.draw_shape(self, x, y, brush_size)\n self.lastx = x\n self.lasty = y\n })\n else\n requestAnimationFrame(() => {\n self.init_shape(self, CompositionOperation.SourceOver)\n\n var dx = x - self.lastx\n var dy = y - self.lasty\n\n var distance = Math.sqrt(dx * dx + dy * dy)\n var directionX = dx / distance\n var directionY = dy / distance\n\n for (var i = 0; i < distance; i += 5) {\n var px = self.lastx + directionX * i\n var py = self.lasty + directionY * i\n self.draw_shape(self, px, py, brush_size)\n }\n self.lastx = x\n self.lasty = y\n })\n\n self.lasttime = performance.now()\n } else if ((event.altKey && left_button_down) || right_button_down) {\n const maskRect = self.maskCanvas.getBoundingClientRect()\n const x =\n (event.offsetX || event.targetTouches[0].clientX - maskRect.left) /\n self.zoom_ratio\n const y =\n (event.offsetY || event.targetTouches[0].clientY - maskRect.top) /\n self.zoom_ratio\n\n var brush_size = this.brush_size\n if (event instanceof PointerEvent && event.pointerType == 'pen') {\n brush_size *= event.pressure\n this.last_pressure = event.pressure\n } else if (\n window.TouchEvent &&\n event instanceof TouchEvent &&\n diff < 20\n ) {\n brush_size *= this.last_pressure\n } else {\n brush_size = this.brush_size\n }\n\n if (diff > 20 && !this.drawing_mode)\n // cannot tracking drawing_mode for touch event\n requestAnimationFrame(() => {\n self.init_shape(self, CompositionOperation.DestinationOut)\n self.draw_shape(self, x, y, brush_size)\n self.lastx = x\n self.lasty = y\n })\n else\n requestAnimationFrame(() => {\n self.init_shape(self, CompositionOperation.DestinationOut)\n\n var dx = x - self.lastx\n var dy = y - self.lasty\n\n var distance = Math.sqrt(dx * dx + dy * dy)\n var directionX = dx / distance\n var directionY = dy / distance\n\n for (var i = 0; i < distance; i += 5) {\n var px = self.lastx + directionX * i\n var py = self.lasty + directionY * i\n self.draw_shape(self, px, py, brush_size)\n }\n self.lastx = x\n self.lasty = y\n })\n\n self.lasttime = performance.now()\n }\n }\n\n handlePointerDown(self, event) {\n if (event.ctrlKey) {\n if (event.buttons == 1) {\n MaskEditorDialog.mousedown_x = event.clientX\n MaskEditorDialog.mousedown_y = event.clientY\n\n this.mousedown_pan_x = this.pan_x\n this.mousedown_pan_y = this.pan_y\n }\n return\n }\n\n var brush_size = this.brush_size\n if (event instanceof PointerEvent && event.pointerType == 'pen') {\n brush_size *= event.pressure\n this.last_pressure = event.pressure\n }\n\n if ([0, 2, 5].includes(event.button)) {\n self.drawing_mode = true\n\n event.preventDefault()\n\n if (event.shiftKey) {\n self.zoom_lasty = event.clientY\n self.last_zoom_ratio = self.zoom_ratio\n return\n }\n\n const maskRect = self.maskCanvas.getBoundingClientRect()\n const x =\n (event.offsetX || event.targetTouches[0].clientX - maskRect.left) /\n self.zoom_ratio\n const y =\n (event.offsetY || event.targetTouches[0].clientY - maskRect.top) /\n self.zoom_ratio\n\n if (!event.altKey && event.button == 0) {\n self.init_shape(self, CompositionOperation.SourceOver)\n } else {\n self.init_shape(self, CompositionOperation.DestinationOut)\n }\n self.draw_shape(self, x, y, brush_size)\n self.lastx = x\n self.lasty = y\n self.lasttime = performance.now()\n }\n }\n\n init_shape(self, compositionOperation) {\n self.maskCtx.beginPath()\n if (compositionOperation == CompositionOperation.SourceOver) {\n self.maskCtx.fillStyle = this.getMaskFillStyle()\n self.maskCtx.globalCompositeOperation = CompositionOperation.SourceOver\n } else if (compositionOperation == CompositionOperation.DestinationOut) {\n self.maskCtx.globalCompositeOperation =\n CompositionOperation.DestinationOut\n }\n }\n\n draw_shape(self, x, y, brush_size) {\n if (self.pointer_type === PointerType.Rect) {\n self.maskCtx.rect(\n x - brush_size,\n y - brush_size,\n brush_size * 2,\n brush_size * 2\n )\n } else {\n self.maskCtx.arc(x, y, brush_size, 0, Math.PI * 2, false)\n }\n self.maskCtx.fill()\n }\n\n async save() {\n const backupCanvas = document.createElement('canvas')\n const backupCtx = backupCanvas.getContext('2d', {\n willReadFrequently: true\n })\n backupCanvas.width = this.image.width\n backupCanvas.height = this.image.height\n\n backupCtx.clearRect(0, 0, backupCanvas.width, backupCanvas.height)\n backupCtx.drawImage(\n this.maskCanvas,\n 0,\n 0,\n this.maskCanvas.width,\n this.maskCanvas.height,\n 0,\n 0,\n backupCanvas.width,\n backupCanvas.height\n )\n\n // paste mask data into alpha channel\n const backupData = backupCtx.getImageData(\n 0,\n 0,\n backupCanvas.width,\n backupCanvas.height\n )\n\n // refine mask image\n for (let i = 0; i < backupData.data.length; i += 4) {\n if (backupData.data[i + 3] == 255) backupData.data[i + 3] = 0\n else backupData.data[i + 3] = 255\n\n backupData.data[i] = 0\n backupData.data[i + 1] = 0\n backupData.data[i + 2] = 0\n }\n\n backupCtx.globalCompositeOperation = CompositionOperation.SourceOver\n backupCtx.putImageData(backupData, 0, 0)\n\n const formData = new FormData()\n const filename = 'clipspace-mask-' + performance.now() + '.png'\n\n const item = {\n filename: filename,\n subfolder: 'clipspace',\n type: 'input'\n }\n\n if (ComfyApp.clipspace.images) ComfyApp.clipspace.images[0] = item\n\n if (ComfyApp.clipspace.widgets) {\n const index = ComfyApp.clipspace.widgets.findIndex(\n (obj) => obj.name === 'image'\n )\n\n if (index >= 0) ComfyApp.clipspace.widgets[index].value = item\n }\n\n const dataURL = backupCanvas.toDataURL()\n const blob = dataURLToBlob(dataURL)\n\n let original_url = new URL(this.image.src)\n\n type Ref = { filename: string; subfolder?: string; type?: string }\n\n const original_ref: Ref = {\n filename: original_url.searchParams.get('filename')\n }\n\n let original_subfolder = original_url.searchParams.get('subfolder')\n if (original_subfolder) original_ref.subfolder = original_subfolder\n\n let original_type = original_url.searchParams.get('type')\n if (original_type) original_ref.type = original_type\n\n formData.append('image', blob, filename)\n formData.append('original_ref', JSON.stringify(original_ref))\n formData.append('type', 'input')\n formData.append('subfolder', 'clipspace')\n\n this.saveButton.innerText = 'Saving...'\n this.saveButton.disabled = true\n await uploadMask(item, formData)\n ComfyApp.onClipspaceEditorSave()\n this.close()\n }\n}\n\napp.registerExtension({\n name: 'Comfy.MaskEditor',\n init(app) {\n ComfyApp.open_maskeditor = function () {\n const dlg = MaskEditorDialog.getInstance()\n if (!dlg.isOpened()) {\n dlg.show()\n }\n }\n\n const context_predicate = () =>\n ComfyApp.clipspace &&\n ComfyApp.clipspace.imgs &&\n ComfyApp.clipspace.imgs.length > 0\n ClipspaceDialog.registerButton(\n 'MaskEditor',\n context_predicate,\n ComfyApp.open_maskeditor\n )\n }\n})\n","import { app } from '../../scripts/app'\nimport { api } from '../../scripts/api'\nimport { ComfyDialog, $el } from '../../scripts/ui'\nimport { GroupNodeConfig, GroupNodeHandler } from './groupNode'\nimport { LGraphCanvas } from '@comfyorg/litegraph'\nimport { useToastStore } from '@/stores/toastStore'\n\n// Adds the ability to save and add multiple nodes as a template\n// To save:\n// Select multiple nodes (ctrl + drag to select a region or ctrl+click individual nodes)\n// Right click the canvas\n// Save Node Template -> give it a name\n//\n// To add:\n// Right click the canvas\n// Node templates -> click the one to add\n//\n// To delete/rename:\n// Right click the canvas\n// Node templates -> Manage\n//\n// To rearrange:\n// Open the manage dialog and Drag and drop elements using the \"Name:\" label as handle\n\nconst id = 'Comfy.NodeTemplates'\nconst file = 'comfy.templates.json'\n\nclass ManageTemplates extends ComfyDialog {\n templates: any[]\n draggedEl: HTMLElement | null\n saveVisualCue: number | null\n emptyImg: HTMLImageElement\n importInput: HTMLInputElement\n\n constructor() {\n super()\n this.load().then((v) => {\n this.templates = v\n })\n\n this.element.classList.add('comfy-manage-templates')\n this.draggedEl = null\n this.saveVisualCue = null\n this.emptyImg = new Image()\n this.emptyImg.src =\n 'data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs='\n\n this.importInput = $el('input', {\n type: 'file',\n accept: '.json',\n multiple: true,\n style: { display: 'none' },\n parent: document.body,\n onchange: () => this.importAll()\n }) as HTMLInputElement\n }\n\n createButtons() {\n const btns = super.createButtons()\n btns[0].textContent = 'Close'\n btns[0].onclick = (e) => {\n clearTimeout(this.saveVisualCue)\n this.close()\n }\n btns.unshift(\n $el('button', {\n type: 'button',\n textContent: 'Export',\n onclick: () => this.exportAll()\n })\n )\n btns.unshift(\n $el('button', {\n type: 'button',\n textContent: 'Import',\n onclick: () => {\n this.importInput.click()\n }\n })\n )\n return btns\n }\n\n async load() {\n let templates = []\n if (app.storageLocation === 'server') {\n if (app.isNewUserSession) {\n // New user so migrate existing templates\n const json = localStorage.getItem(id)\n if (json) {\n templates = JSON.parse(json)\n }\n await api.storeUserData(file, json, { stringify: false })\n } else {\n const res = await api.getUserData(file)\n if (res.status === 200) {\n try {\n templates = await res.json()\n } catch (error) {}\n } else if (res.status !== 404) {\n console.error(res.status + ' ' + res.statusText)\n }\n }\n } else {\n const json = localStorage.getItem(id)\n if (json) {\n templates = JSON.parse(json)\n }\n }\n\n return templates ?? []\n }\n\n async store() {\n if (app.storageLocation === 'server') {\n const templates = JSON.stringify(this.templates, undefined, 4)\n localStorage.setItem(id, templates) // Backwards compatibility\n try {\n await api.storeUserData(file, templates, { stringify: false })\n } catch (error) {\n console.error(error)\n useToastStore().addAlert(error.message)\n }\n } else {\n localStorage.setItem(id, JSON.stringify(this.templates))\n }\n }\n\n async importAll() {\n for (const file of this.importInput.files) {\n if (file.type === 'application/json' || file.name.endsWith('.json')) {\n const reader = new FileReader()\n reader.onload = async () => {\n const importFile = JSON.parse(reader.result as string)\n if (importFile?.templates) {\n for (const template of importFile.templates) {\n if (template?.name && template?.data) {\n this.templates.push(template)\n }\n }\n await this.store()\n }\n }\n await reader.readAsText(file)\n }\n }\n\n this.importInput.value = null\n\n this.close()\n }\n\n exportAll() {\n if (this.templates.length == 0) {\n useToastStore().addAlert('No templates to export.')\n return\n }\n\n const json = JSON.stringify({ templates: this.templates }, null, 2) // convert the data to a JSON string\n const blob = new Blob([json], { type: 'application/json' })\n const url = URL.createObjectURL(blob)\n const a = $el('a', {\n href: url,\n download: 'node_templates.json',\n style: { display: 'none' },\n parent: document.body\n })\n a.click()\n setTimeout(function () {\n a.remove()\n window.URL.revokeObjectURL(url)\n }, 0)\n }\n\n show() {\n // Show list of template names + delete button\n super.show(\n $el(\n 'div',\n {},\n this.templates.flatMap((t, i) => {\n let nameInput\n return [\n $el(\n 'div',\n {\n dataset: { id: i.toString() },\n className: 'templateManagerRow',\n style: {\n display: 'grid',\n gridTemplateColumns: '1fr auto',\n border: '1px dashed transparent',\n gap: '5px',\n backgroundColor: 'var(--comfy-menu-bg)'\n },\n ondragstart: (e) => {\n this.draggedEl = e.currentTarget\n e.currentTarget.style.opacity = '0.6'\n e.currentTarget.style.border = '1px dashed yellow'\n e.dataTransfer.effectAllowed = 'move'\n e.dataTransfer.setDragImage(this.emptyImg, 0, 0)\n },\n ondragend: (e) => {\n e.target.style.opacity = '1'\n e.currentTarget.style.border = '1px dashed transparent'\n e.currentTarget.removeAttribute('draggable')\n\n // rearrange the elements\n this.element\n .querySelectorAll('.templateManagerRow')\n .forEach((el: HTMLElement, i) => {\n var prev_i = Number.parseInt(el.dataset.id)\n\n if (el == this.draggedEl && prev_i != i) {\n this.templates.splice(\n i,\n 0,\n this.templates.splice(prev_i, 1)[0]\n )\n }\n el.dataset.id = i.toString()\n })\n this.store()\n },\n ondragover: (e) => {\n e.preventDefault()\n if (e.currentTarget == this.draggedEl) return\n\n let rect = e.currentTarget.getBoundingClientRect()\n if (e.clientY > rect.top + rect.height / 2) {\n e.currentTarget.parentNode.insertBefore(\n this.draggedEl,\n e.currentTarget.nextSibling\n )\n } else {\n e.currentTarget.parentNode.insertBefore(\n this.draggedEl,\n e.currentTarget\n )\n }\n }\n },\n [\n $el(\n 'label',\n {\n textContent: 'Name: ',\n style: {\n cursor: 'grab'\n },\n onmousedown: (e) => {\n // enable dragging only from the label\n if (e.target.localName == 'label')\n e.currentTarget.parentNode.draggable = 'true'\n }\n },\n [\n $el('input', {\n value: t.name,\n dataset: { name: t.name },\n style: {\n transitionProperty: 'background-color',\n transitionDuration: '0s'\n },\n onchange: (e) => {\n clearTimeout(this.saveVisualCue)\n var el = e.target\n var row = el.parentNode.parentNode\n this.templates[row.dataset.id].name =\n el.value.trim() || 'untitled'\n this.store()\n el.style.backgroundColor = 'rgb(40, 95, 40)'\n el.style.transitionDuration = '0s'\n // @ts-expect-error\n // In browser env the return value is number.\n this.saveVisualCue = setTimeout(function () {\n el.style.transitionDuration = '.7s'\n el.style.backgroundColor = 'var(--comfy-input-bg)'\n }, 15)\n },\n onkeypress: (e) => {\n var el = e.target\n clearTimeout(this.saveVisualCue)\n el.style.transitionDuration = '0s'\n el.style.backgroundColor = 'var(--comfy-input-bg)'\n },\n $: (el) => (nameInput = el)\n })\n ]\n ),\n $el('div', {}, [\n $el('button', {\n textContent: 'Export',\n style: {\n fontSize: '12px',\n fontWeight: 'normal'\n },\n onclick: (e) => {\n const json = JSON.stringify({ templates: [t] }, null, 2) // convert the data to a JSON string\n const blob = new Blob([json], {\n type: 'application/json'\n })\n const url = URL.createObjectURL(blob)\n const a = $el('a', {\n href: url,\n download: (nameInput.value || t.name) + '.json',\n style: { display: 'none' },\n parent: document.body\n })\n a.click()\n setTimeout(function () {\n a.remove()\n window.URL.revokeObjectURL(url)\n }, 0)\n }\n }),\n $el('button', {\n textContent: 'Delete',\n style: {\n fontSize: '12px',\n color: 'red',\n fontWeight: 'normal'\n },\n onclick: (e) => {\n const item = e.target.parentNode.parentNode\n item.parentNode.removeChild(item)\n this.templates.splice(item.dataset.id * 1, 1)\n this.store()\n // update the rows index, setTimeout ensures that the list is updated\n var that = this\n setTimeout(function () {\n that.element\n .querySelectorAll('.templateManagerRow')\n .forEach((el: HTMLElement, i) => {\n el.dataset.id = i.toString()\n })\n }, 0)\n }\n })\n ])\n ]\n )\n ]\n })\n )\n )\n }\n}\n\napp.registerExtension({\n name: id,\n setup() {\n const manage = new ManageTemplates()\n\n const clipboardAction = async (cb) => {\n // We use the clipboard functions but dont want to overwrite the current user clipboard\n // Restore it after we've run our callback\n const old = localStorage.getItem('litegrapheditor_clipboard')\n await cb()\n localStorage.setItem('litegrapheditor_clipboard', old)\n }\n\n const orig = LGraphCanvas.prototype.getCanvasMenuOptions\n LGraphCanvas.prototype.getCanvasMenuOptions = function () {\n const options = orig.apply(this, arguments)\n\n options.push(null)\n options.push({\n content: `Save Selected as Template`,\n disabled: !Object.keys(app.canvas.selected_nodes || {}).length,\n callback: () => {\n const name = prompt('Enter name')\n if (!name?.trim()) return\n\n clipboardAction(() => {\n app.canvas.copyToClipboard()\n let data = localStorage.getItem('litegrapheditor_clipboard')\n data = JSON.parse(data)\n const nodeIds = Object.keys(app.canvas.selected_nodes)\n for (let i = 0; i < nodeIds.length; i++) {\n const node = app.graph.getNodeById(nodeIds[i])\n const nodeData = node?.constructor.nodeData\n\n let groupData = GroupNodeHandler.getGroupData(node)\n if (groupData) {\n groupData = groupData.nodeData\n // @ts-expect-error\n if (!data.groupNodes) {\n // @ts-expect-error\n data.groupNodes = {}\n }\n // @ts-expect-error\n data.groupNodes[nodeData.name] = groupData\n // @ts-expect-error\n data.nodes[i].type = nodeData.name\n }\n }\n\n manage.templates.push({\n name,\n data: JSON.stringify(data)\n })\n manage.store()\n })\n }\n })\n\n // Map each template to a menu item\n const subItems = manage.templates.map((t) => {\n return {\n content: t.name,\n callback: () => {\n clipboardAction(async () => {\n const data = JSON.parse(t.data)\n await GroupNodeConfig.registerFromWorkflow(data.groupNodes, {})\n localStorage.setItem('litegrapheditor_clipboard', t.data)\n app.canvas.pasteFromClipboard()\n })\n }\n }\n })\n\n subItems.push(null, {\n content: 'Manage',\n callback: () => manage.show()\n })\n\n options.push({\n content: 'Node Templates',\n submenu: {\n options: subItems\n }\n })\n\n return options\n }\n }\n})\n","import { LiteGraph, LGraphCanvas } from '@comfyorg/litegraph'\nimport { app } from '../../scripts/app'\nimport { ComfyWidgets } from '../../scripts/widgets'\nimport { LGraphNode } from '@comfyorg/litegraph'\n// Node that add notes to your project\n\napp.registerExtension({\n name: 'Comfy.NoteNode',\n registerCustomNodes() {\n class NoteNode extends LGraphNode {\n static category: string\n\n color = LGraphCanvas.node_colors.yellow.color\n bgcolor = LGraphCanvas.node_colors.yellow.bgcolor\n groupcolor = LGraphCanvas.node_colors.yellow.groupcolor\n isVirtualNode: boolean\n collapsable: boolean\n title_mode: number\n\n constructor(title?: string) {\n super(title)\n if (!this.properties) {\n this.properties = { text: '' }\n }\n ComfyWidgets.STRING(\n // Should we extends LGraphNode? Yesss\n this,\n '',\n ['', { default: this.properties.text, multiline: true }],\n app\n )\n\n this.serialize_widgets = true\n this.isVirtualNode = true\n }\n }\n\n // Load default visibility\n\n LiteGraph.registerNodeType(\n 'Note',\n Object.assign(NoteNode, {\n title_mode: LiteGraph.NORMAL_TITLE,\n title: 'Note',\n collapsable: true\n })\n )\n\n NoteNode.category = 'utils'\n }\n})\n","import type { IContextMenuValue } from '@comfyorg/litegraph'\nimport { app } from '../../scripts/app'\nimport { mergeIfValid, getWidgetConfig, setWidgetConfig } from './widgetInputs'\nimport { LiteGraph, LGraphCanvas, LGraphNode } from '@comfyorg/litegraph'\n\n// Node that allows you to redirect connections for cleaner graphs\n\napp.registerExtension({\n name: 'Comfy.RerouteNode',\n registerCustomNodes(app) {\n interface RerouteNode extends LGraphNode {\n __outputType?: string\n }\n\n class RerouteNode extends LGraphNode {\n static category: string | undefined\n static defaultVisibility = false\n\n constructor(title?: string) {\n super(title)\n if (!this.properties) {\n this.properties = {}\n }\n this.properties.showOutputText = RerouteNode.defaultVisibility\n this.properties.horizontal = false\n\n this.addInput('', '*')\n this.addOutput(this.properties.showOutputText ? '*' : '', '*')\n\n this.onAfterGraphConfigured = function () {\n requestAnimationFrame(() => {\n this.onConnectionsChange(LiteGraph.INPUT, null, true, null)\n })\n }\n\n this.onConnectionsChange = (type, index, connected, link_info) => {\n this.applyOrientation()\n\n // Prevent multiple connections to different types when we have no input\n if (connected && type === LiteGraph.OUTPUT) {\n // Ignore wildcard nodes as these will be updated to real types\n const types = new Set(\n this.outputs[0].links\n .map((l) => app.graph.links[l].type)\n .filter((t) => t !== '*')\n )\n if (types.size > 1) {\n const linksToDisconnect = []\n for (let i = 0; i < this.outputs[0].links.length - 1; i++) {\n const linkId = this.outputs[0].links[i]\n const link = app.graph.links[linkId]\n linksToDisconnect.push(link)\n }\n for (const link of linksToDisconnect) {\n const node = app.graph.getNodeById(link.target_id)\n node.disconnectInput(link.target_slot)\n }\n }\n }\n\n // Find root input\n let currentNode: LGraphNode | null = this\n let updateNodes = []\n let inputType = null\n let inputNode = null\n while (currentNode) {\n updateNodes.unshift(currentNode)\n const linkId = currentNode.inputs[0].link\n if (linkId !== null) {\n const link = app.graph.links[linkId]\n if (!link) return\n const node = app.graph.getNodeById(link.origin_id)\n const type = node.constructor.type\n if (type === 'Reroute') {\n if (node === this) {\n // We've found a circle\n currentNode.disconnectInput(link.target_slot)\n currentNode = null\n } else {\n // Move the previous node\n currentNode = node\n }\n } else {\n // We've found the end\n inputNode = currentNode\n inputType = node.outputs[link.origin_slot]?.type ?? null\n break\n }\n } else {\n // This path has no input node\n currentNode = null\n break\n }\n }\n\n // Find all outputs\n const nodes: LGraphNode[] = [this]\n let outputType = null\n while (nodes.length) {\n currentNode = nodes.pop()\n const outputs =\n (currentNode.outputs ? currentNode.outputs[0].links : []) || []\n if (outputs.length) {\n for (const linkId of outputs) {\n const link = app.graph.links[linkId]\n\n // When disconnecting sometimes the link is still registered\n if (!link) continue\n\n const node = app.graph.getNodeById(link.target_id)\n const type = node.constructor.type\n\n if (type === 'Reroute') {\n // Follow reroute nodes\n nodes.push(node)\n updateNodes.push(node)\n } else {\n // We've found an output\n const nodeOutType =\n node.inputs &&\n node.inputs[link?.target_slot] &&\n node.inputs[link.target_slot].type\n ? node.inputs[link.target_slot].type\n : null\n if (\n inputType &&\n !LiteGraph.isValidConnection(inputType, nodeOutType)\n ) {\n // The output doesnt match our input so disconnect it\n node.disconnectInput(link.target_slot)\n } else {\n outputType = nodeOutType\n }\n }\n }\n } else {\n // No more outputs for this path\n }\n }\n\n const displayType = inputType || outputType || '*'\n const color = LGraphCanvas.link_type_colors[displayType]\n\n let widgetConfig\n let targetWidget\n let widgetType\n // Update the types of each node\n for (const node of updateNodes) {\n // If we dont have an input type we are always wildcard but we'll show the output type\n // This lets you change the output link to a different type and all nodes will update\n node.outputs[0].type = inputType || '*'\n node.__outputType = displayType\n node.outputs[0].name = node.properties.showOutputText\n ? displayType\n : ''\n node.size = node.computeSize()\n node.applyOrientation()\n\n for (const l of node.outputs[0].links || []) {\n const link = app.graph.links[l]\n if (link) {\n // @ts-expect-error Fix litegraph types\n link.color = color\n\n if (app.configuringGraph) continue\n const targetNode = app.graph.getNodeById(link.target_id)\n const targetInput = targetNode.inputs?.[link.target_slot]\n if (targetInput?.widget) {\n const config = getWidgetConfig(targetInput)\n if (!widgetConfig) {\n widgetConfig = config[1] ?? {}\n widgetType = config[0]\n }\n if (!targetWidget) {\n targetWidget = targetNode.widgets?.find(\n (w) => w.name === (targetInput.widget as any).name\n )\n }\n\n const merged = mergeIfValid(targetInput, [\n config[0],\n widgetConfig\n ])\n if (merged.customConfig) {\n widgetConfig = merged.customConfig\n }\n }\n }\n }\n }\n\n for (const node of updateNodes) {\n if (widgetConfig && outputType) {\n node.inputs[0].widget = { name: 'value' }\n setWidgetConfig(\n node.inputs[0],\n [widgetType ?? displayType, widgetConfig],\n targetWidget\n )\n } else {\n setWidgetConfig(node.inputs[0], null)\n }\n }\n\n if (inputNode) {\n const link = app.graph.links[inputNode.inputs[0].link]\n if (link) {\n // @ts-expect-error Fix litegraph types\n link.color = color\n }\n }\n }\n\n this.clone = function () {\n const cloned = RerouteNode.prototype.clone.apply(this)\n cloned.removeOutput(0)\n cloned.addOutput(this.properties.showOutputText ? '*' : '', '*')\n cloned.size = cloned.computeSize()\n return cloned\n }\n\n // This node is purely frontend and does not impact the resulting prompt so should not be serialized\n this.isVirtualNode = true\n }\n\n getExtraMenuOptions(_, options): IContextMenuValue[] {\n options.unshift(\n {\n content:\n (this.properties.showOutputText ? 'Hide' : 'Show') + ' Type',\n callback: () => {\n this.properties.showOutputText = !this.properties.showOutputText\n if (this.properties.showOutputText) {\n this.outputs[0].name =\n this.__outputType || (this.outputs[0].type as string)\n } else {\n this.outputs[0].name = ''\n }\n this.size = this.computeSize()\n this.applyOrientation()\n app.graph.setDirtyCanvas(true, true)\n }\n },\n {\n content:\n (RerouteNode.defaultVisibility ? 'Hide' : 'Show') +\n ' Type By Default',\n callback: () => {\n RerouteNode.setDefaultTextVisibility(\n !RerouteNode.defaultVisibility\n )\n }\n },\n {\n // naming is inverted with respect to LiteGraphNode.horizontal\n // LiteGraphNode.horizontal == true means that\n // each slot in the inputs and outputs are laid out horizontally,\n // which is the opposite of the visual orientation of the inputs and outputs as a node\n content:\n 'Set ' + (this.properties.horizontal ? 'Horizontal' : 'Vertical'),\n callback: () => {\n this.properties.horizontal = !this.properties.horizontal\n this.applyOrientation()\n }\n }\n )\n return []\n }\n applyOrientation() {\n this.horizontal = this.properties.horizontal\n if (this.horizontal) {\n // we correct the input position, because LiteGraphNode.horizontal\n // doesn't account for title presence\n // which reroute nodes don't have\n this.inputs[0].pos = [this.size[0] / 2, 0]\n } else {\n delete this.inputs[0].pos\n }\n app.graph.setDirtyCanvas(true, true)\n }\n\n computeSize(): [number, number] {\n return [\n this.properties.showOutputText && this.outputs && this.outputs.length\n ? Math.max(\n 75,\n LiteGraph.NODE_TEXT_SIZE * this.outputs[0].name.length * 0.6 +\n 40\n )\n : 75,\n 26\n ]\n }\n\n static setDefaultTextVisibility(visible) {\n RerouteNode.defaultVisibility = visible\n if (visible) {\n localStorage['Comfy.RerouteNode.DefaultVisibility'] = 'true'\n } else {\n delete localStorage['Comfy.RerouteNode.DefaultVisibility']\n }\n }\n }\n\n // Load default visibility\n RerouteNode.setDefaultTextVisibility(\n !!localStorage['Comfy.RerouteNode.DefaultVisibility']\n )\n\n LiteGraph.registerNodeType(\n 'Reroute',\n Object.assign(RerouteNode, {\n title_mode: LiteGraph.NO_TITLE,\n title: 'Reroute',\n collapsable: false\n })\n )\n\n RerouteNode.category = 'utils'\n }\n})\n","import { app } from '../../scripts/app'\nimport { applyTextReplacements } from '../../scripts/utils'\n// Use widget values and dates in output filenames\n\napp.registerExtension({\n name: 'Comfy.SaveImageExtraOutput',\n async beforeRegisterNodeDef(nodeType, nodeData, app) {\n if (nodeData.name === 'SaveImage' || nodeData.name === 'SaveAnimatedWEBP') {\n const onNodeCreated = nodeType.prototype.onNodeCreated\n // When the SaveImage node is created we want to override the serialization of the output name widget to run our S&R\n nodeType.prototype.onNodeCreated = function () {\n const r = onNodeCreated\n ? onNodeCreated.apply(this, arguments)\n : undefined\n\n const widget = this.widgets.find((w) => w.name === 'filename_prefix')\n widget.serializeValue = () => {\n return applyTextReplacements(app, widget.value)\n }\n\n return r\n }\n } else {\n // When any other node is created add a property to alias the node\n const onNodeCreated = nodeType.prototype.onNodeCreated\n nodeType.prototype.onNodeCreated = function () {\n const r = onNodeCreated\n ? onNodeCreated.apply(this, arguments)\n : undefined\n\n if (!this.properties || !('Node name for S&R' in this.properties)) {\n this.addProperty('Node name for S&R', this.constructor.type, 'string')\n }\n\n return r\n }\n }\n }\n})\n","import { app } from '../../scripts/app'\nimport { LGraphCanvas, LiteGraph } from '@comfyorg/litegraph'\n\nlet touchZooming\nlet touchCount = 0\n\napp.registerExtension({\n name: 'Comfy.SimpleTouchSupport',\n setup() {\n let zoomPos\n let touchTime\n let lastTouch\n\n function getMultiTouchPos(e) {\n return Math.hypot(\n e.touches[0].clientX - e.touches[1].clientX,\n e.touches[0].clientY - e.touches[1].clientY\n )\n }\n\n app.canvasEl.addEventListener(\n 'touchstart',\n (e) => {\n touchCount++\n lastTouch = null\n if (e.touches?.length === 1) {\n // Store start time for press+hold for context menu\n touchTime = new Date()\n lastTouch = e.touches[0]\n } else {\n touchTime = null\n if (e.touches?.length === 2) {\n // Store center pos for zoom\n zoomPos = getMultiTouchPos(e)\n app.canvas.pointer_is_down = false\n }\n }\n },\n true\n )\n\n app.canvasEl.addEventListener('touchend', (e: TouchEvent) => {\n touchZooming = false\n touchCount = e.touches?.length ?? touchCount - 1\n if (touchTime && !e.touches?.length) {\n if (new Date().getTime() - touchTime > 600) {\n try {\n // hack to get litegraph to use this event\n e.constructor = CustomEvent\n } catch (error) {}\n // @ts-expect-error\n e.clientX = lastTouch.clientX\n // @ts-expect-error\n e.clientY = lastTouch.clientY\n\n app.canvas.pointer_is_down = true\n // @ts-expect-error\n app.canvas._mousedown_callback(e)\n }\n touchTime = null\n }\n })\n\n app.canvasEl.addEventListener(\n 'touchmove',\n (e) => {\n touchTime = null\n if (e.touches?.length === 2) {\n app.canvas.pointer_is_down = false\n touchZooming = true\n // @ts-expect-error\n LiteGraph.closeAllContextMenus()\n // @ts-expect-error\n app.canvas.search_box?.close()\n const newZoomPos = getMultiTouchPos(e)\n\n const midX = (e.touches[0].clientX + e.touches[1].clientX) / 2\n const midY = (e.touches[0].clientY + e.touches[1].clientY) / 2\n\n let scale = app.canvas.ds.scale\n const diff = zoomPos - newZoomPos\n if (diff > 0.5) {\n scale *= 1 / 1.07\n } else if (diff < -0.5) {\n scale *= 1.07\n }\n app.canvas.ds.changeScale(scale, [midX, midY])\n app.canvas.setDirty(true, true)\n zoomPos = newZoomPos\n }\n },\n true\n )\n }\n})\n\nconst processMouseDown = LGraphCanvas.prototype.processMouseDown\nLGraphCanvas.prototype.processMouseDown = function (e) {\n if (touchZooming || touchCount) {\n return\n }\n return processMouseDown.apply(this, arguments)\n}\n\nconst processMouseMove = LGraphCanvas.prototype.processMouseMove\nLGraphCanvas.prototype.processMouseMove = function (e) {\n if (touchZooming || touchCount > 1) {\n return\n }\n return processMouseMove.apply(this, arguments)\n}\n","import { app } from '../../scripts/app'\nimport { ComfyWidgets } from '../../scripts/widgets'\nimport { LiteGraph } from '@comfyorg/litegraph'\n// Adds defaults for quickly adding nodes with middle click on the input/output\n\napp.registerExtension({\n name: 'Comfy.SlotDefaults',\n suggestionsNumber: null,\n init() {\n LiteGraph.search_filter_enabled = true\n LiteGraph.middle_click_slot_add_default_node = true\n this.suggestionsNumber = app.ui.settings.addSetting({\n id: 'Comfy.NodeSuggestions.number',\n category: ['Comfy', 'Node Search Box', 'NodeSuggestions'],\n name: 'Number of nodes suggestions',\n tooltip: 'Only for litegraph searchbox/context menu',\n type: 'slider',\n attrs: {\n min: 1,\n max: 100,\n step: 1\n },\n defaultValue: 5,\n onChange: (newVal, oldVal) => {\n this.setDefaults(newVal)\n }\n })\n },\n slot_types_default_out: {},\n slot_types_default_in: {},\n async beforeRegisterNodeDef(nodeType, nodeData, app) {\n var nodeId = nodeData.name\n const inputs = nodeData['input']['required'] //only show required inputs to reduce the mess also not logical to create node with optional inputs\n for (const inputKey in inputs) {\n var input = inputs[inputKey]\n if (typeof input[0] !== 'string') continue\n\n var type = input[0]\n if (type in ComfyWidgets) {\n var customProperties = input[1]\n if (!customProperties?.forceInput) continue //ignore widgets that don't force input\n }\n\n if (!(type in this.slot_types_default_out)) {\n this.slot_types_default_out[type] = ['Reroute']\n }\n if (this.slot_types_default_out[type].includes(nodeId)) continue\n this.slot_types_default_out[type].push(nodeId)\n\n // Input types have to be stored as lower case\n // Store each node that can handle this input type\n const lowerType = type.toLocaleLowerCase()\n if (!(lowerType in LiteGraph.registered_slot_in_types)) {\n LiteGraph.registered_slot_in_types[lowerType] = { nodes: [] }\n }\n LiteGraph.registered_slot_in_types[lowerType].nodes.push(\n nodeType.comfyClass\n )\n }\n\n var outputs = nodeData['output']\n for (const key in outputs) {\n var type = outputs[key] as string\n if (!(type in this.slot_types_default_in)) {\n this.slot_types_default_in[type] = ['Reroute'] // [\"Reroute\", \"Primitive\"]; primitive doesn't always work :'()\n }\n\n this.slot_types_default_in[type].push(nodeId)\n\n // Store each node that can handle this output type\n if (!(type in LiteGraph.registered_slot_out_types)) {\n LiteGraph.registered_slot_out_types[type] = { nodes: [] }\n }\n LiteGraph.registered_slot_out_types[type].nodes.push(nodeType.comfyClass)\n\n if (!LiteGraph.slot_types_out.includes(type)) {\n LiteGraph.slot_types_out.push(type)\n }\n }\n var maxNum = this.suggestionsNumber.value\n this.setDefaults(maxNum)\n },\n setDefaults(maxNum) {\n LiteGraph.slot_types_default_out = {}\n LiteGraph.slot_types_default_in = {}\n\n for (const type in this.slot_types_default_out) {\n LiteGraph.slot_types_default_out[type] = this.slot_types_default_out[\n type\n ].slice(0, maxNum)\n }\n for (const type in this.slot_types_default_in) {\n LiteGraph.slot_types_default_in[type] = this.slot_types_default_in[\n type\n ].slice(0, maxNum)\n }\n }\n})\n","import { app } from '../../scripts/app'\nimport {\n LGraphCanvas,\n LGraphNode,\n LGraphGroup,\n LiteGraph\n} from '@comfyorg/litegraph'\n\n// Shift + drag/resize to snap to grid\n\n/** Rounds a Vector2 in-place to the current CANVAS_GRID_SIZE. */\nfunction roundVectorToGrid(vec) {\n vec[0] =\n LiteGraph.CANVAS_GRID_SIZE * Math.round(vec[0] / LiteGraph.CANVAS_GRID_SIZE)\n vec[1] =\n LiteGraph.CANVAS_GRID_SIZE * Math.round(vec[1] / LiteGraph.CANVAS_GRID_SIZE)\n return vec\n}\n\napp.registerExtension({\n name: 'Comfy.SnapToGrid',\n init() {\n // Add setting to control grid size\n app.ui.settings.addSetting({\n id: 'Comfy.SnapToGrid.GridSize',\n category: ['Comfy', 'Graph', 'GridSize'],\n name: 'Snap to grid size',\n type: 'slider',\n attrs: {\n min: 1,\n max: 500\n },\n tooltip:\n 'When dragging and resizing nodes while holding shift they will be aligned to the grid, this controls the size of that grid.',\n defaultValue: LiteGraph.CANVAS_GRID_SIZE,\n onChange(value) {\n LiteGraph.CANVAS_GRID_SIZE = +value || 10\n }\n })\n\n // After moving a node, if the shift key is down align it to grid\n const onNodeMoved = app.canvas.onNodeMoved\n app.canvas.onNodeMoved = function (node) {\n const r = onNodeMoved?.apply(this, arguments)\n\n if (app.shiftDown) {\n // Ensure all selected nodes are realigned\n for (const id in this.selected_nodes) {\n this.selected_nodes[id].alignToGrid()\n }\n }\n\n return r\n }\n\n // When a node is added, add a resize handler to it so we can fix align the size with the grid\n const onNodeAdded = app.graph.onNodeAdded\n app.graph.onNodeAdded = function (node) {\n const onResize = node.onResize\n node.onResize = function () {\n if (app.shiftDown) {\n roundVectorToGrid(node.size)\n }\n return onResize?.apply(this, arguments)\n }\n return onNodeAdded?.apply(this, arguments)\n }\n\n // Draw a preview of where the node will go if holding shift and the node is selected\n const origDrawNode = LGraphCanvas.prototype.drawNode\n LGraphCanvas.prototype.drawNode = function (node, ctx) {\n if (\n app.shiftDown &&\n this.node_dragged &&\n node.id in this.selected_nodes\n ) {\n const [x, y] = roundVectorToGrid([...node.pos])\n const shiftX = x - node.pos[0]\n let shiftY = y - node.pos[1]\n\n let w, h\n if (node.flags.collapsed) {\n w = node._collapsed_width\n h = LiteGraph.NODE_TITLE_HEIGHT\n shiftY -= LiteGraph.NODE_TITLE_HEIGHT\n } else {\n w = node.size[0]\n h = node.size[1]\n // @ts-expect-error\n let titleMode = node.constructor.title_mode\n if (\n titleMode !== LiteGraph.TRANSPARENT_TITLE &&\n titleMode !== LiteGraph.NO_TITLE\n ) {\n h += LiteGraph.NODE_TITLE_HEIGHT\n shiftY -= LiteGraph.NODE_TITLE_HEIGHT\n }\n }\n const f = ctx.fillStyle\n ctx.fillStyle = 'rgba(100, 100, 100, 0.5)'\n ctx.fillRect(shiftX, shiftY, w, h)\n ctx.fillStyle = f\n }\n\n return origDrawNode.apply(this, arguments)\n }\n\n /**\n * The currently moving, selected group only. Set after the `selected_group` has actually started\n * moving.\n */\n let selectedAndMovingGroup: LGraphGroup | null = null\n\n /**\n * Handles moving a group; tracking when a group has been moved (to show the ghost in `drawGroups`\n * below) as well as handle the last move call from LiteGraph's `processMouseUp`.\n */\n const groupMove = LGraphGroup.prototype.move\n LGraphGroup.prototype.move = function (deltax, deltay, ignore_nodes) {\n const v = groupMove.apply(this, arguments)\n // When we've started moving, set `selectedAndMovingGroup` as LiteGraph sets `selected_group`\n // too eagerly and we don't want to behave like we're moving until we get a delta.\n if (\n !selectedAndMovingGroup &&\n app.canvas.selected_group === this &&\n (deltax || deltay)\n ) {\n selectedAndMovingGroup = this\n }\n\n // LiteGraph will call group.move both on mouse-move as well as mouse-up though we only want\n // to snap on a mouse-up which we can determine by checking if `app.canvas.last_mouse_dragging`\n // has been set to `false`. Essentially, this check here is the equivalent to calling an\n // `LGraphGroup.prototype.onNodeMoved` if it had existed.\n if (app.canvas.last_mouse_dragging === false && app.shiftDown) {\n // After moving a group (while app.shiftDown), snap all the child nodes and, finally,\n // align the group itself.\n this.recomputeInsideNodes()\n for (const node of this.nodes) {\n node.alignToGrid()\n }\n LGraphNode.prototype.alignToGrid.apply(this)\n }\n return v\n }\n\n /**\n * Handles drawing a group when, snapping the size when one is actively being resized tracking and/or\n * drawing a ghost box when one is actively being moved. This mimics the node snapping behavior for\n * both.\n */\n const drawGroups = LGraphCanvas.prototype.drawGroups\n LGraphCanvas.prototype.drawGroups = function (canvas, ctx) {\n if (this.selected_group && app.shiftDown) {\n if (this.selected_group_resizing) {\n roundVectorToGrid(this.selected_group.size)\n } else if (selectedAndMovingGroup) {\n const [x, y] = roundVectorToGrid([...selectedAndMovingGroup.pos])\n const f = ctx.fillStyle\n const s = ctx.strokeStyle\n ctx.fillStyle = 'rgba(100, 100, 100, 0.33)'\n ctx.strokeStyle = 'rgba(100, 100, 100, 0.66)'\n ctx.rect(x, y, ...(selectedAndMovingGroup.size as [number, number]))\n ctx.fill()\n ctx.stroke()\n ctx.fillStyle = f\n ctx.strokeStyle = s\n }\n } else if (!this.selected_group) {\n selectedAndMovingGroup = null\n }\n return drawGroups.apply(this, arguments)\n }\n\n /** Handles adding a group in a snapping-enabled state. */\n const onGroupAdd = LGraphCanvas.onGroupAdd\n LGraphCanvas.onGroupAdd = function () {\n const v = onGroupAdd.apply(app.canvas, arguments)\n if (app.shiftDown) {\n const lastGroup = app.graph.groups[app.graph.groups.length - 1]\n if (lastGroup) {\n roundVectorToGrid(lastGroup.pos)\n roundVectorToGrid(lastGroup.size)\n }\n }\n return v\n }\n }\n})\n","import { app } from '../../scripts/app'\nimport { ComfyNodeDef } from '@/types/apiTypes'\n\n// Adds an upload button to the nodes\n\napp.registerExtension({\n name: 'Comfy.UploadImage',\n async beforeRegisterNodeDef(nodeType, nodeData: ComfyNodeDef, app) {\n if (nodeData?.input?.required?.image?.[1]?.image_upload === true) {\n nodeData.input.required.upload = ['IMAGEUPLOAD']\n }\n }\n})\n","import { app } from '../../scripts/app'\nimport { api } from '../../scripts/api'\nimport { useToastStore } from '@/stores/toastStore'\n\nconst WEBCAM_READY = Symbol()\n\napp.registerExtension({\n name: 'Comfy.WebcamCapture',\n getCustomWidgets(app) {\n return {\n WEBCAM(node, inputName) {\n let res\n node[WEBCAM_READY] = new Promise((resolve) => (res = resolve))\n\n const container = document.createElement('div')\n container.style.background = 'rgba(0,0,0,0.25)'\n container.style.textAlign = 'center'\n\n const video = document.createElement('video')\n video.style.height = video.style.width = '100%'\n\n const loadVideo = async () => {\n try {\n const stream = await navigator.mediaDevices.getUserMedia({\n video: true,\n audio: false\n })\n container.replaceChildren(video)\n\n setTimeout(() => res(video), 500) // Fallback as loadedmetadata doesnt fire sometimes?\n video.addEventListener('loadedmetadata', () => res(video), false)\n video.srcObject = stream\n video.play()\n } catch (error) {\n const label = document.createElement('div')\n label.style.color = 'red'\n label.style.overflow = 'auto'\n label.style.maxHeight = '100%'\n label.style.whiteSpace = 'pre-wrap'\n\n if (window.isSecureContext) {\n label.textContent =\n 'Unable to load webcam, please ensure access is granted:\\n' +\n error.message\n } else {\n label.textContent =\n 'Unable to load webcam. A secure context is required, if you are not accessing ComfyUI on localhost (127.0.0.1) you will have to enable TLS (https)\\n\\n' +\n error.message\n }\n\n container.replaceChildren(label)\n }\n }\n\n loadVideo()\n\n return { widget: node.addDOMWidget(inputName, 'WEBCAM', container) }\n }\n }\n },\n nodeCreated(node) {\n if ((node.type, node.constructor.comfyClass !== 'WebcamCapture')) return\n\n let video\n const camera = node.widgets.find((w) => w.name === 'image')\n const w = node.widgets.find((w) => w.name === 'width')\n const h = node.widgets.find((w) => w.name === 'height')\n const captureOnQueue = node.widgets.find(\n (w) => w.name === 'capture_on_queue'\n )\n\n const canvas = document.createElement('canvas')\n\n const capture = () => {\n canvas.width = w.value\n canvas.height = h.value\n const ctx = canvas.getContext('2d')\n ctx.drawImage(video, 0, 0, w.value, h.value)\n const data = canvas.toDataURL('image/png')\n\n const img = new Image()\n img.onload = () => {\n node.imgs = [img]\n app.graph.setDirtyCanvas(true)\n requestAnimationFrame(() => {\n node.setSizeForImage?.()\n })\n }\n img.src = data\n }\n\n const btn = node.addWidget(\n 'button',\n 'waiting for camera...',\n 'capture',\n capture\n )\n btn.disabled = true\n btn.serializeValue = () => undefined\n\n camera.serializeValue = async () => {\n if (captureOnQueue.value) {\n capture()\n } else if (!node.imgs?.length) {\n const err = `No webcam image captured`\n useToastStore().addAlert(err)\n throw new Error(err)\n }\n\n // Upload image to temp storage\n const blob = await new Promise<Blob>((r) => canvas.toBlob(r))\n const name = `${+new Date()}.png`\n const file = new File([blob], name)\n const body = new FormData()\n body.append('image', file)\n body.append('subfolder', 'webcam')\n body.append('type', 'temp')\n const resp = await api.fetchApi('/upload/image', {\n method: 'POST',\n body\n })\n if (resp.status !== 200) {\n const err = `Error uploading camera image: ${resp.status} - ${resp.statusText}`\n useToastStore().addAlert(err)\n throw new Error(err)\n }\n return `webcam/${name} [temp]`\n }\n\n node[WEBCAM_READY].then((v) => {\n video = v\n // If width isnt specified then use video output resolution\n if (!w.value) {\n w.value = video.videoWidth || 640\n h.value = video.videoHeight || 480\n }\n btn.disabled = false\n btn.label = 'capture'\n })\n }\n})\n","import { app } from '../../scripts/app'\nimport { api } from '../../scripts/api'\nimport type { IWidget } from '@comfyorg/litegraph'\nimport type { DOMWidget } from '@/scripts/domWidget'\nimport { ComfyNodeDef } from '@/types/apiTypes'\nimport { useToastStore } from '@/stores/toastStore'\n\ntype FolderType = 'input' | 'output' | 'temp'\n\nfunction splitFilePath(path: string): [string, string] {\n const folder_separator = path.lastIndexOf('/')\n if (folder_separator === -1) {\n return ['', path]\n }\n return [\n path.substring(0, folder_separator),\n path.substring(folder_separator + 1)\n ]\n}\n\nfunction getResourceURL(\n subfolder: string,\n filename: string,\n type: FolderType = 'input'\n): string {\n const params = [\n 'filename=' + encodeURIComponent(filename),\n 'type=' + type,\n 'subfolder=' + subfolder,\n app.getRandParam().substring(1)\n ].join('&')\n\n return `/view?${params}`\n}\n\nasync function uploadFile(\n audioWidget: IWidget,\n audioUIWidget: DOMWidget<HTMLAudioElement>,\n file: File,\n updateNode: boolean,\n pasted: boolean = false\n) {\n try {\n // Wrap file in formdata so it includes filename\n const body = new FormData()\n body.append('image', file)\n if (pasted) body.append('subfolder', 'pasted')\n const resp = await api.fetchApi('/upload/image', {\n method: 'POST',\n body\n })\n\n if (resp.status === 200) {\n const data = await resp.json()\n // Add the file to the dropdown list and update the widget value\n let path = data.name\n if (data.subfolder) path = data.subfolder + '/' + path\n\n if (!audioWidget.options.values.includes(path)) {\n audioWidget.options.values.push(path)\n }\n\n if (updateNode) {\n audioUIWidget.element.src = api.apiURL(\n getResourceURL(...splitFilePath(path))\n )\n audioWidget.value = path\n }\n } else {\n useToastStore().addAlert(resp.status + ' - ' + resp.statusText)\n }\n } catch (error) {\n useToastStore().addAlert(error)\n }\n}\n\n// AudioWidget MUST be registered first, as AUDIOUPLOAD depends on AUDIO_UI to be\n// present.\napp.registerExtension({\n name: 'Comfy.AudioWidget',\n async beforeRegisterNodeDef(nodeType, nodeData) {\n if (\n ['LoadAudio', 'SaveAudio', 'PreviewAudio'].includes(nodeType.comfyClass)\n ) {\n nodeData.input.required.audioUI = ['AUDIO_UI']\n }\n },\n getCustomWidgets() {\n return {\n AUDIO_UI(node, inputName: string) {\n const audio = document.createElement('audio')\n audio.controls = true\n audio.classList.add('comfy-audio')\n audio.setAttribute('name', 'media')\n\n const audioUIWidget: DOMWidget<HTMLAudioElement> = node.addDOMWidget(\n inputName,\n /* name=*/ 'audioUI',\n audio,\n { serialize: false }\n )\n\n const isOutputNode = node.constructor.nodeData.output_node\n if (isOutputNode) {\n // Hide the audio widget when there is no audio initially.\n audioUIWidget.element.classList.add('empty-audio-widget')\n // Populate the audio widget UI on node execution.\n const onExecuted = node.onExecuted\n node.onExecuted = function (message) {\n onExecuted?.apply(this, arguments)\n const audios = message.audio\n if (!audios) return\n const audio = audios[0]\n audioUIWidget.element.src = api.apiURL(\n getResourceURL(audio.subfolder, audio.filename, audio.type)\n )\n audioUIWidget.element.classList.remove('empty-audio-widget')\n }\n }\n return { widget: audioUIWidget }\n }\n }\n },\n onNodeOutputsUpdated(nodeOutputs: Record<number, any>) {\n for (const [nodeId, output] of Object.entries(nodeOutputs)) {\n const node = app.graph.getNodeById(nodeId)\n if ('audio' in output) {\n const audioUIWidget = node.widgets.find(\n (w) => w.name === 'audioUI'\n ) as unknown as DOMWidget<HTMLAudioElement>\n const audio = output.audio[0]\n audioUIWidget.element.src = api.apiURL(\n getResourceURL(audio.subfolder, audio.filename, audio.type)\n )\n audioUIWidget.element.classList.remove('empty-audio-widget')\n }\n }\n }\n})\n\napp.registerExtension({\n name: 'Comfy.UploadAudio',\n async beforeRegisterNodeDef(nodeType, nodeData: ComfyNodeDef) {\n if (nodeData?.input?.required?.audio?.[1]?.audio_upload === true) {\n nodeData.input.required.upload = ['AUDIOUPLOAD']\n }\n },\n getCustomWidgets() {\n return {\n AUDIOUPLOAD(node, inputName: string) {\n // The widget that allows user to select file.\n const audioWidget: IWidget = node.widgets.find(\n (w: IWidget) => w.name === 'audio'\n )\n const audioUIWidget: DOMWidget<HTMLAudioElement> = node.widgets.find(\n (w: IWidget) => w.name === 'audioUI'\n )\n\n const onAudioWidgetUpdate = () => {\n audioUIWidget.element.src = api.apiURL(\n getResourceURL(...splitFilePath(audioWidget.value as string))\n )\n }\n // Initially load default audio file to audioUIWidget.\n if (audioWidget.value) {\n onAudioWidgetUpdate()\n }\n audioWidget.callback = onAudioWidgetUpdate\n\n // Load saved audio file widget values if restoring from workflow\n const onGraphConfigured = node.onGraphConfigured\n node.onGraphConfigured = function () {\n onGraphConfigured?.apply(this, arguments)\n if (audioWidget.value) {\n onAudioWidgetUpdate()\n }\n }\n\n const fileInput = document.createElement('input')\n fileInput.type = 'file'\n fileInput.accept = 'audio/*'\n fileInput.style.display = 'none'\n fileInput.onchange = () => {\n if (fileInput.files.length) {\n uploadFile(audioWidget, audioUIWidget, fileInput.files[0], true)\n }\n }\n // The widget to pop up the upload dialog.\n const uploadWidget = node.addWidget(\n 'button',\n inputName,\n /* value=*/ '',\n () => {\n fileInput.click()\n },\n { serialize: false }\n )\n uploadWidget.label = 'choose file to upload'\n\n return { widget: uploadWidget }\n }\n }\n }\n})\n","import { app, type ComfyApp } from '@/scripts/app'\nimport type { ComfyExtension } from '@/types/comfy'\nimport type { LGraphNode } from '@comfyorg/litegraph'\nimport { LGraphBadge } from '@comfyorg/litegraph'\nimport { useSettingStore } from '@/stores/settingStore'\nimport { computed, ComputedRef, watch } from 'vue'\nimport { NodeBadgeMode, NodeSource, NodeSourceType } from '@/types/nodeSource'\nimport _ from 'lodash'\nimport { getColorPalette, defaultColorPalette } from './colorPalette'\nimport { BadgePosition } from '@comfyorg/litegraph'\nimport type { Palette } from '@/types/colorPalette'\nimport { useNodeDefStore } from '@/stores/nodeDefStore'\n\nfunction getNodeSource(node: LGraphNode): NodeSource | null {\n const nodeDef = node.constructor.nodeData\n // Frontend-only nodes don't have nodeDef\n if (!nodeDef) {\n return null\n }\n const nodeDefStore = useNodeDefStore()\n return nodeDefStore.nodeDefsByName[nodeDef.name]?.nodeSource ?? null\n}\n\nfunction isCoreNode(node: LGraphNode) {\n return getNodeSource(node)?.type === NodeSourceType.Core\n}\n\nfunction badgeTextVisible(node: LGraphNode, badgeMode: NodeBadgeMode): boolean {\n return (\n badgeMode === NodeBadgeMode.None ||\n (isCoreNode(node) && badgeMode === NodeBadgeMode.HideBuiltIn)\n )\n}\n\nfunction getNodeIdBadgeText(node: LGraphNode, nodeIdBadgeMode: NodeBadgeMode) {\n return badgeTextVisible(node, nodeIdBadgeMode) ? '' : `#${node.id}`\n}\n\nfunction getNodeSourceBadgeText(\n node: LGraphNode,\n nodeSourceBadgeMode: NodeBadgeMode\n) {\n const nodeSource = getNodeSource(node)\n return badgeTextVisible(node, nodeSourceBadgeMode)\n ? ''\n : nodeSource?.badgeText ?? ''\n}\n\nfunction getNodeLifeCycleBadgeText(\n node: LGraphNode,\n nodeLifeCycleBadgeMode: NodeBadgeMode\n) {\n let text = ''\n const nodeDef = node.constructor.nodeData\n\n // Frontend-only nodes don't have nodeDef\n if (!nodeDef) {\n return ''\n }\n\n if (nodeDef.deprecated) {\n text = '[DEPR]'\n }\n\n if (nodeDef.experimental) {\n text = '[BETA]'\n }\n\n return badgeTextVisible(node, nodeLifeCycleBadgeMode) ? '' : text\n}\n\nclass NodeBadgeExtension implements ComfyExtension {\n name = 'Comfy.NodeBadge'\n\n constructor(\n public nodeIdBadgeMode: ComputedRef<NodeBadgeMode> | null = null,\n public nodeSourceBadgeMode: ComputedRef<NodeBadgeMode> | null = null,\n public nodeLifeCycleBadgeMode: ComputedRef<NodeBadgeMode> | null = null,\n public colorPalette: ComputedRef<Palette> | null = null\n ) {}\n\n init(app: ComfyApp) {\n const settingStore = useSettingStore()\n this.nodeSourceBadgeMode = computed(\n () =>\n settingStore.get('Comfy.NodeBadge.NodeSourceBadgeMode') as NodeBadgeMode\n )\n this.nodeIdBadgeMode = computed(\n () => settingStore.get('Comfy.NodeBadge.NodeIdBadgeMode') as NodeBadgeMode\n )\n this.nodeLifeCycleBadgeMode = computed(\n () =>\n settingStore.get(\n 'Comfy.NodeBadge.NodeLifeCycleBadgeMode'\n ) as NodeBadgeMode\n )\n this.colorPalette = computed(() =>\n getColorPalette(settingStore.get('Comfy.ColorPalette'))\n )\n\n watch(this.nodeSourceBadgeMode, () => {\n app.graph.setDirtyCanvas(true, true)\n })\n\n watch(this.nodeIdBadgeMode, () => {\n app.graph.setDirtyCanvas(true, true)\n })\n watch(this.nodeLifeCycleBadgeMode, () => {\n app.graph.setDirtyCanvas(true, true)\n })\n }\n\n nodeCreated(node: LGraphNode, app: ComfyApp) {\n node.badgePosition = BadgePosition.TopRight\n // @ts-expect-error Disable ComfyUI-Manager's badge drawing by setting badge_enabled to true. Remove this when ComfyUI-Manager's badge drawing is removed.\n node.badge_enabled = true\n\n const badge = computed(\n () =>\n new LGraphBadge({\n text: _.truncate(\n [\n getNodeIdBadgeText(node, this.nodeIdBadgeMode.value),\n getNodeLifeCycleBadgeText(\n node,\n this.nodeLifeCycleBadgeMode.value\n ),\n getNodeSourceBadgeText(node, this.nodeSourceBadgeMode.value)\n ]\n .filter((s) => s.length > 0)\n .join(' '),\n {\n length: 31\n }\n ),\n fgColor:\n this.colorPalette.value.colors.litegraph_base?.BADGE_FG_COLOR ||\n defaultColorPalette.colors.litegraph_base.BADGE_FG_COLOR,\n bgColor:\n this.colorPalette.value.colors.litegraph_base?.BADGE_BG_COLOR ||\n defaultColorPalette.colors.litegraph_base.BADGE_BG_COLOR\n })\n )\n\n node.badges.push(() => badge.value)\n }\n}\n\napp.registerExtension(new NodeBadgeExtension())\n"],"names":["app","ext","prompt","PREFIX","SEPARATOR","type","id","def","node","_","link","selectedIds","newNodes","i","w","widget","group","modal","PointerType","CompositionOperation","x","y","file","audio"],"mappings":";;;;;AAIO,MAAM,wBAAwB,YAAY;AAAA,SAAA;AAAA;AAAA;AAAA,EAC/C,OAAO,QAAQ,CAAA;AAAA,EACf,OAAO,WAAW;AAAA,EAElB,OAAO,eAAe,MAAM,kBAAkB,UAAU;AAChD,UAAA,OAAO,IAAI,UAAU;AAAA,MACz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