dsh-mo-image 0.5.1 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,528 @@
1
+ /**
2
+ * ComfyUI 工作流解析:把用户贴进来的任何一种工作流,变成「参数该写进哪个节点」的映射。
3
+ *
4
+ * 纯函数,不碰网络和文件:/object_info 由调用方取好传进来。
5
+ * 这里做的判断都会摆到设置页让用户确认,所以宁可给出候选,也不要做"聪明"的静默回退。
6
+ *
7
+ * 定位策略:先找到主采样器,再把**它整条上游闭包**摊开,按角色(positive/negative)、
8
+ * 名字(seed/ckpt_name)和类型去匹配。不逐输入查表——FLUX.2 的 SamplerCustomAdvanced
9
+ * 自己没有 positive/seed/model,这些散落在 CFGGuider 和 RandomNoise 上。
10
+ */
11
+
12
+ export const MAPPING_KEYS = ['prompt', 'negative_prompt', 'width', 'height', 'seed', 'model', 'image'];
13
+
14
+ /** 输入名优先级:先认这些名字,再退而求其次找其它字符串输入。 */
15
+ const TEXTISH = /^(text|prompt|string|value|positive)$/i;
16
+ const SEEDISH = /^(seed|noise_seed)$/i;
17
+ const MODELISH = /^(ckpt_name|unet_name|model_name)$/i;
18
+ /** UI 格式里,种子后面那个「fixed/randomize」下拉不是节点输入,但占了一个 widgets_values 位。 */
19
+ const PHANTOM_WIDGETS = new Set(['fixed', 'increment', 'decrement', 'randomize']);
20
+
21
+ const SUMMARY_MAX = 80;
22
+
23
+ /** 只在字符串外剥离 // 行注释,避免把提示词里的网址吃掉。 */
24
+ function stripLineComments(text) {
25
+ let out = '';
26
+ let inString = false;
27
+ let escaped = false;
28
+ for (let i = 0; i < text.length; i += 1) {
29
+ const ch = text[i];
30
+ if (inString) {
31
+ out += ch;
32
+ if (escaped) escaped = false;
33
+ else if (ch === '\\') escaped = true;
34
+ else if (ch === '"') inString = false;
35
+ continue;
36
+ }
37
+ if (ch === '"') { inString = true; out += ch; continue; }
38
+ if (ch === '/' && text[i + 1] === '/') {
39
+ while (i < text.length && text[i] !== '\n') i += 1;
40
+ out += '\n';
41
+ continue;
42
+ }
43
+ out += ch;
44
+ }
45
+ return out;
46
+ }
47
+
48
+ function parseJsonLenient(source) {
49
+ try {
50
+ return JSON.parse(source);
51
+ } catch (first) {
52
+ const stripped = stripLineComments(source).replace(/,\s*([}[\]])/g, '$1');
53
+ try {
54
+ return JSON.parse(stripped);
55
+ } catch (_second) {
56
+ throw new Error('工作流不是合法 JSON:' + String(first && first.message ? first.message : first));
57
+ }
58
+ }
59
+ }
60
+
61
+ /** 判定格式:UI 格式带 nodes/links,API 格式是 节点id → {class_type, inputs}。 */
62
+ export function parseWorkflow(text) {
63
+ const source = String(text || '').replace(/^\uFEFF/, '');
64
+ const parsed = parseJsonLenient(source);
65
+ if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
66
+ throw new Error('工作流必须是 ComfyUI 的 API 格式对象或 UI 格式工作流。');
67
+ }
68
+ if (Array.isArray(parsed.nodes) && Array.isArray(parsed.links)) {
69
+ return { format: 'ui', ui: parsed, warnings: [] };
70
+ }
71
+ const entries = Object.entries(parsed);
72
+ const looksApi = entries.length > 0 && entries.every(([, value]) =>
73
+ value && typeof value === 'object' && !Array.isArray(value) && typeof value.class_type === 'string');
74
+ if (looksApi) return { format: 'api', graph: parsed, warnings: [] };
75
+ throw new Error('工作流必须是 ComfyUI 的 API 格式对象或 UI 格式工作流。');
76
+ }
77
+
78
+ function linkSource(link) {
79
+ if (Array.isArray(link)) return { from: String(link[1]), fromSlot: Number(link[2]) };
80
+ if (link && typeof link === 'object') {
81
+ return { from: String(link.origin_id), fromSlot: Number(link.origin_slot) };
82
+ }
83
+ return null;
84
+ }
85
+
86
+ function linkTargetOf(link) {
87
+ if (Array.isArray(link)) return { target: String(link[3]), type: String(link[5] || '') };
88
+ return { target: String(link.target_id), type: String(link.type || '') };
89
+ }
90
+
91
+ /**
92
+ * UI 格式 → API 格式。widgets_values 按 object_info 的输入顺序对齐。
93
+ * `missing` 列出缺签名的节点类:UI 格式丢了节点就会留下悬空连线,调用方必须当硬错误处理。
94
+ */
95
+ export function uiToApi(ui, objectInfo) {
96
+ const warnings = [];
97
+ const missing = [];
98
+ const links = new Map();
99
+ for (const link of ui.links || []) {
100
+ const linkId = Array.isArray(link) ? link[0] : link && link.id;
101
+ const source = linkSource(link);
102
+ const resolved = linkTargetOf(link);
103
+ if (linkId === undefined || !source || !resolved) continue;
104
+ links.set(linkId, { from: source.from, fromSlot: source.fromSlot });
105
+ }
106
+
107
+ const graph = {};
108
+ for (const node of ui.nodes || []) {
109
+ const type = node && node.type;
110
+ const schema = type ? objectInfo[type] : undefined;
111
+ if (!schema) {
112
+ if (type && !missing.includes(type)) missing.push(type);
113
+ continue;
114
+ }
115
+ const id = String(node.id);
116
+ const inputs = {};
117
+ const linked = new Map();
118
+ for (const entry of node.inputs || []) {
119
+ if (!entry || entry.link === null || entry.link === undefined) continue;
120
+ const resolved = links.get(entry.link);
121
+ if (resolved) linked.set(entry.name, [resolved.from, resolved.fromSlot]);
122
+ }
123
+ const required = schema.input && schema.input.required ? Object.keys(schema.input.required) : [];
124
+ const optional = schema.input && schema.input.optional ? Object.keys(schema.input.optional) : [];
125
+ const widgets = Array.isArray(node.widgets_values) ? [...node.widgets_values] : [];
126
+ let cursor = 0;
127
+ for (const name of [...required, ...optional]) {
128
+ const spec = (schema.input.required && schema.input.required[name]) || (schema.input.optional && schema.input.optional[name]) || [];
129
+ if (spec[1] && typeof spec[1] === 'object' && spec[1].forceInput) continue;
130
+ if (linked.has(name)) { inputs[name] = linked.get(name); continue; }
131
+ if (cursor >= widgets.length) continue;
132
+ inputs[name] = widgets[cursor];
133
+ cursor += 1;
134
+ if (SEEDISH.test(name) && typeof widgets[cursor] === 'string' && PHANTOM_WIDGETS.has(widgets[cursor])) cursor += 1;
135
+ }
136
+ graph[id] = { class_type: type, inputs };
137
+ }
138
+ for (const type of missing) warnings.push('工作流里的节点 ' + type + ' 没有安装,涉及它的连线会被忽略');
139
+ return { graph, warnings, missing };
140
+ }
141
+
142
+ /* ------------------------------------------------------------------ 图遍历 */
143
+
144
+ function isLink(value) {
145
+ return Array.isArray(value) && value.length === 2 && typeof value[0] === 'string' && typeof value[1] === 'number';
146
+ }
147
+
148
+ function inputEntries(node) {
149
+ if (!node || !node.inputs || typeof node.inputs !== 'object') return [];
150
+ return Object.entries(node.inputs);
151
+ }
152
+
153
+ function summarize(value) {
154
+ const text = typeof value === 'string' ? value : JSON.stringify(value);
155
+ const flat = String(text === undefined ? '' : text).replace(/\s+/g, ' ').trim();
156
+ return flat.length > SUMMARY_MAX ? flat.slice(0, SUMMARY_MAX) + '…' : flat;
157
+ }
158
+
159
+ function makeCandidate(id, node, input, value) {
160
+ return { node: id, input, classType: node.class_type, value: summarize(value) };
161
+ }
162
+
163
+ function findOutputNodes(graph, objectInfo) {
164
+ return Object.keys(graph).filter((id) => {
165
+ const schema = objectInfo[graph[id].class_type];
166
+ return !!(schema && schema.output_node);
167
+ }).sort();
168
+ }
169
+
170
+ function outputTypes(node, objectInfo) {
171
+ const schema = objectInfo[node.class_type];
172
+ return schema && Array.isArray(schema.output) ? schema.output : [];
173
+ }
174
+
175
+ /** 从输出节点反向 BFS,按距离找出所有采样器(最近的是主采样器)。 */
176
+ function findSamplers(graph, objectInfo, outputIds) {
177
+ const found = [];
178
+ const seen = new Set(outputIds);
179
+ let frontier = outputIds.map((id) => ({ id, depth: 0 }));
180
+ while (frontier.length) {
181
+ const next = [];
182
+ for (const item of frontier) {
183
+ const node = graph[item.id];
184
+ if (!node) continue;
185
+ const hasLatent = inputEntries(node).some(([name]) => name === 'latent_image');
186
+ const types = outputTypes(node, objectInfo);
187
+ if (hasLatent && item.depth > 0 && (types.includes('LATENT') || !types.length)) {
188
+ found.push({ id: item.id, depth: item.depth });
189
+ }
190
+ for (const [, value] of inputEntries(node)) {
191
+ if (!isLink(value)) continue;
192
+ const source = String(value[0]);
193
+ if (seen.has(source) || !graph[source]) continue;
194
+ seen.add(source);
195
+ next.push({ id: source, depth: item.depth + 1 });
196
+ }
197
+ }
198
+ frontier = next;
199
+ }
200
+ found.sort((a, b) => a.depth - b.depth || a.id.localeCompare(b.id));
201
+ return found.map((item) => item.id);
202
+ }
203
+
204
+ /** 主采样器的整条上游闭包:id → 距采样器的层数。 */
205
+ function upstreamClosure(graph, samplerId) {
206
+ const depth = new Map([[samplerId, 0]]);
207
+ let frontier = [samplerId];
208
+ while (frontier.length) {
209
+ const next = [];
210
+ for (const id of frontier) {
211
+ const node = graph[id];
212
+ if (!node) continue;
213
+ for (const [, value] of inputEntries(node)) {
214
+ if (!isLink(value)) continue;
215
+ const source = String(value[0]);
216
+ if (depth.has(source) || !graph[source]) continue;
217
+ depth.set(source, depth.get(id) + 1);
218
+ next.push(source);
219
+ }
220
+ }
221
+ frontier = next;
222
+ }
223
+ return depth;
224
+ }
225
+
226
+ /** 在上游闭包里按角色找输入(positive/negative),最近的优先。 */
227
+ function findRoleLink(graph, closure, samplerId, role) {
228
+ const sampler = graph[samplerId];
229
+ if (sampler && isLink(sampler.inputs && sampler.inputs[role])) return sampler.inputs[role];
230
+ const ids = [...closure.keys()].filter((id) => id !== samplerId)
231
+ .sort((a, b) => closure.get(a) - closure.get(b) || a.localeCompare(b));
232
+ for (const id of ids) {
233
+ const hit = inputEntries(graph[id]).find(([name, value]) => name === role && isLink(value));
234
+ if (hit) return hit[1];
235
+ }
236
+ return null;
237
+ }
238
+
239
+ /** 从某个输入出发,按优先级向上找字面量字符串输入;沿途收集候选。 */
240
+ function walkText(graph, startLink, pool) {
241
+ const visited = new Set();
242
+ let primary = null;
243
+
244
+ const rank = (name) => (TEXTISH.test(name) ? 0 : name === 'system_prompt' ? 2 : 1);
245
+ const visit = (link) => {
246
+ if (!isLink(link)) return;
247
+ const id = String(link[0]);
248
+ if (visited.has(id)) return;
249
+ visited.add(id);
250
+ const node = graph[id];
251
+ if (!node) return;
252
+ const ordered = [...inputEntries(node)].sort(([a], [b]) => rank(a) - rank(b));
253
+ for (const [name, value] of ordered) {
254
+ // 空字符串也是字面量:导出和模板里的文本框默认就是空的,跳过它等于让整条角色参数消失。
255
+ if (typeof value !== 'string') continue;
256
+ pool.push(makeCandidate(id, node, name, value));
257
+ if (!primary && TEXTISH.test(name)) primary = { node: id, input: name };
258
+ }
259
+ for (const [name, value] of ordered) {
260
+ if (!isLink(value)) continue;
261
+ if (name === 'clip' || name === 'model' || name === 'vae') continue;
262
+ visit(value);
263
+ }
264
+ };
265
+ visit(startLink);
266
+ if (!primary && pool.length) primary = { node: pool[0].node, input: pool[0].input };
267
+ return primary;
268
+ }
269
+
270
+ /** 在上游闭包里按名字找某个输入,最近的优先。 */
271
+ function findInClosure(graph, closure, samplerId, matcher, { literalOnly = false } = {}) {
272
+ const ids = [...closure.keys()].sort((a, b) => closure.get(a) - closure.get(b) || a.localeCompare(b));
273
+ for (const id of ids) {
274
+ for (const [name, value] of inputEntries(graph[id]).sort(([a], [b]) => a.localeCompare(b))) {
275
+ if (!matcher.test(name)) continue;
276
+ if (literalOnly && isLink(value)) continue;
277
+ return { node: id, input: name };
278
+ }
279
+ }
280
+ return null;
281
+ }
282
+
283
+ /**
284
+ * 分析整张图。返回的 mapping 里每一项要么是 {node, input},要么是 null。
285
+ * @throws 图里没有输出节点时抛错——ComfyUI 会直接拒绝执行这种图。
286
+ */
287
+ export function analyzeWorkflow(graph, objectInfo) {
288
+ const warnings = [];
289
+ const outputIds = findOutputNodes(graph, objectInfo);
290
+ if (!outputIds.length) throw new Error('这个工作流没有输出节点,ComfyUI 不会执行它。');
291
+
292
+ const samplers = findSamplers(graph, objectInfo, outputIds);
293
+ const samplerId = samplers.length ? samplers[0] : null;
294
+ if (!samplerId) warnings.push('没有找到采样器,提示词和尺寸需要手动指定');
295
+
296
+ const mapping = { prompt: null, negative_prompt: null, width: null, height: null, seed: null, model: null, image: null };
297
+ const promptPool = [];
298
+ const negativePool = [];
299
+
300
+ if (samplerId) {
301
+ const closure = upstreamClosure(graph, samplerId);
302
+ mapping.prompt = walkText(graph, findRoleLink(graph, closure, samplerId, 'positive'), promptPool);
303
+ mapping.negative_prompt = walkText(graph, findRoleLink(graph, closure, samplerId, 'negative'), negativePool);
304
+ if (mapping.prompt && mapping.negative_prompt
305
+ && mapping.prompt.node === mapping.negative_prompt.node
306
+ && mapping.prompt.input === mapping.negative_prompt.input) {
307
+ mapping.negative_prompt = null;
308
+ }
309
+ mapping.seed = findInClosure(graph, closure, samplerId, SEEDISH);
310
+ mapping.model = findInClosure(graph, closure, samplerId, MODELISH, { literalOnly: true });
311
+ mapping.width = findInClosure(graph, closure, samplerId, /^width$/);
312
+ mapping.height = findInClosure(graph, closure, samplerId, /^height$/);
313
+ }
314
+
315
+ const imageNode = Object.keys(graph).filter((id) => graph[id].class_type === 'LoadImage').sort()[0];
316
+ if (imageNode) mapping.image = { node: imageNode, input: 'image' };
317
+
318
+ const candidates = {
319
+ prompt: promptPool,
320
+ negative_prompt: negativePool,
321
+ width: collectInputs(graph, /^width$/),
322
+ height: collectInputs(graph, /^height$/),
323
+ seed: collectInputs(graph, SEEDISH),
324
+ model: collectInputs(graph, MODELISH),
325
+ image: Object.keys(graph).filter((id) => graph[id].class_type === 'LoadImage').sort()
326
+ .map((id) => makeCandidate(id, graph[id], 'image', graph[id].inputs.image)),
327
+ sampler: samplers.map((id) => makeCandidate(id, graph[id], 'latent_image', id))
328
+ };
329
+
330
+ return {
331
+ mapping, candidates, warnings, samplerId, outputIds,
332
+ params: [
333
+ ...collectRoleParams(graph, mapping, objectInfo).map((param) => (
334
+ Object.assign({}, param, { candidates: paramCandidates(graph, param.name) })
335
+ )),
336
+ ...collectParams(graph, mapping, objectInfo).map((param) => (
337
+ Object.assign({}, param, { candidates: paramCandidates(graph, param.name) })
338
+ ))
339
+ ]
340
+ };
341
+ }
342
+
343
+ function collectInputs(graph, matcher) {
344
+ const out = [];
345
+ for (const id of Object.keys(graph).sort()) {
346
+ const node = graph[id];
347
+ for (const [name, value] of inputEntries(node)) {
348
+ if (!matcher.test(name)) continue;
349
+ out.push(makeCandidate(id, node, name, value));
350
+ }
351
+ }
352
+ return out;
353
+ }
354
+
355
+ /* ------------------------------------------------------------------ 注入 */
356
+
357
+ const VALUE_KEYS = {
358
+ prompt: 'prompt',
359
+ negative_prompt: 'negativePrompt',
360
+ width: 'width',
361
+ height: 'height',
362
+ seed: 'seed',
363
+ model: 'model',
364
+ image: 'image'
365
+ };
366
+
367
+ /**
368
+ * 按映射把运行时参数写进工作流副本。
369
+ * @throws 映射指向的节点不存在时抛错——静默跳过会生成一张参数没进去的图。
370
+ */
371
+ export function injectByMapping(graph, mapping, values) {
372
+ const out = structuredClone(graph);
373
+ const applied = [];
374
+ for (const key of MAPPING_KEYS) {
375
+ const target = mapping && mapping[key];
376
+ if (!target) continue;
377
+ const value = values ? values[VALUE_KEYS[key]] : undefined;
378
+ if (value === undefined || value === null || value === '') continue;
379
+ const node = out[target.node];
380
+ if (!node) {
381
+ throw new Error('工作流里找不到节点 ' + target.node + ',映射已失效,请重新解析工作流。');
382
+ }
383
+ node.inputs = node.inputs || {};
384
+ node.inputs[target.input] = value;
385
+ applied.push(key);
386
+ }
387
+ return { graph: out, applied };
388
+ }
389
+
390
+ /* -------------------------------------------------------------- 可调参数 */
391
+
392
+ /**
393
+ * 方案 A:只暴露这几个常用参数。它们在不在,取决于工作流里有没有,
394
+ * 且永远不碰映射已经占用的输入(种子、宽高、提示词等)。
395
+ */
396
+ const TUNABLE_PARAMS = ['steps', 'cfg', 'sampler_name', 'scheduler', 'denoise', 'guidance', 'batch_size'];
397
+
398
+ /**
399
+ * 从图里收集可调参数。默认值取工作流当前写死的那个值,
400
+ * 枚举的候选来自 object_info,方便对话模型知道能填什么。
401
+ */
402
+ export function collectParams(graph, mapping, objectInfo) {
403
+ const owned = new Set();
404
+ for (const key of MAPPING_KEYS) {
405
+ const target = mapping && mapping[key];
406
+ if (target) owned.add(target.node + '::' + target.input);
407
+ }
408
+ const found = new Map();
409
+ for (const id of Object.keys(graph).sort()) {
410
+ const node = graph[id];
411
+ const schema = objectInfo ? objectInfo[node.class_type] : null;
412
+ if (!schema) continue;
413
+ const required = (schema.input && schema.input.required) || {};
414
+ const optional = (schema.input && schema.input.optional) || {};
415
+ for (const [name, value] of inputEntries(node)) {
416
+ if (!TUNABLE_PARAMS.includes(name)) continue;
417
+ if (owned.has(id + '::' + name)) continue;
418
+ if (isLink(value)) continue;
419
+ if (found.has(name)) continue;
420
+ const spec = required[name] || optional[name] || [];
421
+ const options = Array.isArray(spec[0]) ? spec[0].map(String) : null;
422
+ found.set(name, {
423
+ name,
424
+ node: id,
425
+ input: name,
426
+ type: options ? 'enum' : String(spec[0] || typeof value),
427
+ ...(options ? { options } : {})
428
+ });
429
+ }
430
+ }
431
+ return TUNABLE_PARAMS.filter((name) => found.has(name)).map((name) => found.get(name));
432
+ }
433
+
434
+ /**
435
+ * 默认对对话模型可见的参数:只有提示词和负面词。
436
+ * 宽高、种子、模型都由选择器或插件决定,暴露出去只会多一条绕过选择器的后门。
437
+ */
438
+ export const DEFAULT_EXPOSED = new Set(['prompt', 'negative_prompt']);
439
+
440
+ /**
441
+ * 映射角色也当成参数:提示词、负面词、宽高、种子、模型。
442
+ * 它们在工作流里已经有确定位置,和可调参数放进同一张表,但默认只有前四个暴露。
443
+ * 类型来自 object_info;值是连线时按输入名推断,避免把 ["19",0] 当成字符串。
444
+ */
445
+ export function collectRoleParams(graph, mapping, objectInfo) {
446
+ const out = [];
447
+ for (const key of ['prompt', 'negative_prompt', 'width', 'height', 'seed', 'model']) {
448
+ const target = mapping && mapping[key];
449
+ if (!target) continue;
450
+ const node = graph[target.node];
451
+ if (!node) continue;
452
+ const value = node.inputs ? node.inputs[target.input] : undefined;
453
+ const schema = objectInfo ? objectInfo[node.class_type] : null;
454
+ const spec = schema && schema.input
455
+ ? ((schema.input.required && schema.input.required[target.input])
456
+ || (schema.input.optional && schema.input.optional[target.input]))
457
+ : null;
458
+ let type = 'STRING';
459
+ if (Array.isArray(spec) && spec.length) {
460
+ type = Array.isArray(spec[0]) ? 'enum' : String(spec[0]);
461
+ } else if (isLink(value)) {
462
+ type = key === 'width' || key === 'height' || key === 'seed' ? 'INT' : 'STRING';
463
+ } else if (typeof value === 'number') {
464
+ type = 'INT';
465
+ }
466
+ out.push({
467
+ name: key,
468
+ role: true,
469
+ node: target.node,
470
+ input: target.input,
471
+ type
472
+ });
473
+ }
474
+ return out;
475
+ }
476
+
477
+ /** 同名输入的其它位置,给面板下拉用:多个采样器时可以换一个绑。 */
478
+ function paramCandidates(graph, name) {
479
+ const out = [];
480
+ for (const id of Object.keys(graph).sort()) {
481
+ for (const [input, value] of inputEntries(graph[id])) {
482
+ if (input !== name) continue;
483
+ if (isLink(value)) continue;
484
+ out.push({ node: id, input });
485
+ }
486
+ }
487
+ return out;
488
+ }
489
+
490
+ function coerceParam(value, param, previous) {
491
+ if (param.type === 'enum') {
492
+ const text = String(value);
493
+ return Array.isArray(param.options) && param.options.length && !param.options.includes(text) ? null : text;
494
+ }
495
+ if (typeof previous === 'number') {
496
+ const number = typeof value === 'number' ? value : Number(String(value).trim());
497
+ return Number.isFinite(number) ? number : null;
498
+ }
499
+ if (typeof previous === 'boolean') {
500
+ if (typeof value === 'boolean') return value;
501
+ const text = String(value).toLowerCase();
502
+ if (text === 'true' || text === 'false') return text === 'true';
503
+ return null;
504
+ }
505
+ return String(value);
506
+ }
507
+
508
+ /**
509
+ * 把对话模型传来的参数写进图。不认识的键、解析不了的值都退回默认值并报告,
510
+ * 让工具能告诉模型「这个参数被忽略了」。
511
+ */
512
+ export function applyWorkflowParams(graph, params, overrides) {
513
+ const byName = new Map((Array.isArray(params) ? params : []).map((param) => [param.name, param]));
514
+ const applied = [];
515
+ const ignored = [];
516
+ for (const [name, raw] of Object.entries(overrides || {})) {
517
+ const param = byName.get(name);
518
+ if (!param) { ignored.push(name); continue; }
519
+ const node = graph[param.node];
520
+ if (!node) { ignored.push(name); continue; }
521
+ node.inputs = node.inputs || {};
522
+ const next = coerceParam(raw, param, node.inputs[param.input]);
523
+ if (next === null) { ignored.push(name); continue; }
524
+ node.inputs[param.input] = next;
525
+ applied.push(name);
526
+ }
527
+ return { graph, applied, ignored };
528
+ }