@babsey/code-graph 0.0.15 → 0.0.16

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.
@@ -1,15 +1,16 @@
1
- import { AbstractNode as De, sortTopologically as Ce, NodeInterface as Pe, displayInSidebar as ke, NodeInterfaceType as D, BaklavaInterfaceTypes as Ae, CheckboxInterfaceComponent as He, setType as L, IntegerInterfaceComponent as Fe, NumberInterfaceComponent as We, SelectInterfaceComponent as Xe, SliderInterfaceComponent as Ye, TextInputInterfaceComponent as qe, TextareaInputInterfaceComponent as Je, allowMultipleConnections as Y, IntegerInterface as Qe, TextInputInterface as Ze, useViewModel as F, useTemporaryConnection as Ke, Components as be, useGraph as K, GRAPH_NODE_TYPE_PREFIX as q, useTransform as et, useNodeCategories as tt, BaklavaEditor as st, DEFAULT_TOOLBAR_COMMANDS as nt, useBaklava as ot, DependencyEngine as at, applyResult as it } from "baklavajs";
2
- import { CheckboxInterfaceComponent as vn, IntegerInterfaceComponent as mn, NumberInterfaceComponent as fn, SelectInterfaceComponent as gn, SliderInterfaceComponent as bn, TextInputInterfaceComponent as _n, TextareaInputInterfaceComponent as yn } from "baklavajs";
3
- import xe from "mustache";
4
- import { reactive as G, defineComponent as j, createElementBlock as r, openBlock as i, toDisplayString as E, markRaw as z, ref as O, computed as b, onMounted as ee, onUpdated as Ne, normalizeClass as U, createCommentVNode as I, createElementVNode as d, unref as k, renderSlot as J, createStaticVNode as te, onBeforeUnmount as rt, normalizeStyle as se, withModifiers as P, createBlock as V, withDirectives as ne, Fragment as $, createTextVNode as dt, createVNode as T, withKeys as Q, vModelText as oe, renderList as A, nextTick as lt, toRef as Ie, resolveDynamicComponent as ut, inject as ct, Transition as pt, withCtx as X, onUnmounted as ht, normalizeProps as vt, guardReactiveProps as mt, mergeProps as ft } from "vue";
1
+ import { AbstractNode as De, sortTopologically as Ce, NodeInterface as Pe, displayInSidebar as ke, NodeInterfaceType as D, BaklavaInterfaceTypes as He, CheckboxInterfaceComponent as Ae, setType as L, IntegerInterfaceComponent as Fe, NumberInterfaceComponent as We, SelectInterfaceComponent as Xe, SliderInterfaceComponent as Ye, TextInputInterfaceComponent as qe, TextareaInputInterfaceComponent as Je, allowMultipleConnections as Y, IntegerInterface as Qe, TextInputInterface as Ke, useViewModel as F, useTemporaryConnection as Ze, Components as ye, useGraph as ee, GRAPH_NODE_TYPE_PREFIX as J, useTransform as et, useNodeCategories as tt, BaklavaEditor as st, DEFAULT_TOOLBAR_COMMANDS as nt, useBaklava as ot, DependencyEngine as at, applyResult as it } from "baklavajs";
2
+ import { CheckboxInterfaceComponent as vn, IntegerInterfaceComponent as mn, NumberInterfaceComponent as fn, SelectInterfaceComponent as gn, SliderInterfaceComponent as bn, TextInputInterfaceComponent as yn, TextareaInputInterfaceComponent as _n } from "baklavajs";
3
+ import q from "mustache";
4
+ import { reactive as G, defineComponent as j, createElementBlock as r, openBlock as i, toDisplayString as E, markRaw as S, ref as O, computed as b, onMounted as te, onUpdated as Ne, normalizeClass as U, createCommentVNode as N, createElementVNode as d, unref as C, renderSlot as Q, createStaticVNode as se, onBeforeUnmount as rt, normalizeStyle as ne, withModifiers as P, createBlock as V, withDirectives as oe, Fragment as $, createTextVNode as dt, createVNode as T, withKeys as K, vModelText as ae, renderList as H, nextTick as lt, toRef as Ie, resolveDynamicComponent as ut, inject as ct, Transition as pt, withCtx as X, onUnmounted as ht, normalizeProps as vt, guardReactiveProps as mt, mergeProps as ft } from "vue";
5
5
  import gt from "toposort";
6
6
  import { v4 as bt } from "uuid";
7
- import { usePointer as _t } from "@vueuse/core";
8
- class yt extends De {
7
+ import { usePointer as yt } from "@vueuse/core";
8
+ q.escape = (s) => s;
9
+ class _t extends De {
9
10
  state;
10
11
  code;
11
12
  isCodeNode = !0;
12
- codeTemplate = () => "{{ &outputs.code }}";
13
+ codeTemplate = () => "{{ outputs.code }}";
13
14
  inputs = {};
14
15
  outputs = {};
15
16
  constructor() {
@@ -43,6 +44,8 @@ class yt extends De {
43
44
  get shortId() {
44
45
  return this.id.slice(0, 6);
45
46
  }
47
+ get subgraph() {
48
+ }
46
49
  get variableName() {
47
50
  return this.state.variableName ? this.state.variableName + (this.idxByVariableNames + 1) : "";
48
51
  }
@@ -54,14 +57,14 @@ class yt extends De {
54
57
  getConnectedNodes(e) {
55
58
  let t = [];
56
59
  if (e !== "inputs") {
57
- const s = this.graph?.connections.filter((o) => o.from.name !== "_node").filter((o) => o.from.nodeId === this.id).map((o) => o.to.nodeId);
58
- s && (t = t.concat(s));
60
+ const n = this.graph?.connections.filter((o) => o.from.name !== "_node").filter((o) => o.from.nodeId === this.id).map((o) => o.to.nodeId);
61
+ n && (t = t.concat(n));
59
62
  }
60
63
  if (e !== "outputs") {
61
- const s = this.graph?.connections.filter((o) => o.from.name !== "_node").filter((o) => o.to.nodeId === this.id).map((o) => o.from.nodeId);
62
- s && (t = t.concat(s));
64
+ const n = this.graph?.connections.filter((o) => o.from.name !== "_node").filter((o) => o.to.nodeId === this.id).map((o) => o.from.nodeId);
65
+ n && (t = t.concat(n));
63
66
  }
64
- return !t || t.length == 0 ? [] : t.map((s) => this.graph?.findNodeById(s));
67
+ return !t || t.length == 0 ? [] : t.map((n) => this.graph?.findNodeById(n));
65
68
  }
66
69
  registerCode(e) {
67
70
  this.code = e;
@@ -72,31 +75,31 @@ class yt extends De {
72
75
  renderCode() {
73
76
  this.state.codeTemplate = this.codeTemplate.call(this);
74
77
  const e = {};
75
- Object.keys(this.inputs).forEach((s) => {
76
- if (s === "_node") return;
77
- const o = this.inputs[s], a = _e(o);
78
- o && o.state && (e[s] = o.state.script.length > 0 ? o.state.script : a);
78
+ Object.keys(this.inputs).forEach((n) => {
79
+ if (n === "_node") return;
80
+ const o = this.inputs[n], a = _e(o);
81
+ o && o.state && (e[n] = o.state.script.length > 0 ? o.state.script : a);
79
82
  });
80
83
  const t = {};
81
- Object.keys(this.outputs).forEach((s) => {
82
- if (s === "_node") return;
83
- const o = this.outputs[s], a = _e(o);
84
- o && o.state && (t[s] = a);
85
- }), this.state.script = xe.render(this.state.codeTemplate, { inputs: e, outputs: t }), this.outputs.code && (this.outputs.code.state.script = this.state.script);
84
+ Object.keys(this.outputs).forEach((n) => {
85
+ if (n === "_node") return;
86
+ const o = this.outputs[n], a = _e(o);
87
+ o && o.state && (t[n] = a);
88
+ }), this.state.script = q.render(this.state.codeTemplate, { inputs: e, outputs: t }), this.outputs.code && (this.outputs.code.state.script = this.state.script);
86
89
  }
87
90
  updateCodeNodeInputInterfaces() {
88
91
  if (!this.graph) return;
89
92
  const { connectionsFromNode: e } = Ce(this.graph);
90
93
  e.has(this) && e.get(this).forEach((t) => {
91
- const s = this.graph?.findNodeById(t.from.nodeId);
92
- s && (s.renderCode(), t.from.isCodeNode && t.to.isCodeNode && (t.to.state.script = t.from.script));
94
+ const n = this.graph?.findNodeById(t.from.nodeId);
95
+ n && (n.renderCode(), t.from.isCodeNode && t.to.isCodeNode && (t.to.state.script = t.from.script));
93
96
  });
94
97
  }
95
98
  updateOutputVariableName() {
96
99
  this.outputs.code && (this.outputs.code.name = this.variableName);
97
100
  }
98
101
  }
99
- class Me extends yt {
102
+ class Me extends _t {
100
103
  /**
101
104
  * The default implementation does nothing.
102
105
  * Overwrite this method to do calculation.
@@ -121,59 +124,59 @@ class Me extends yt {
121
124
  }
122
125
  }
123
126
  }
124
- const Ys = (n) => {
125
- const e = [], t = Object.keys(n);
126
- return t.forEach((s) => {
127
- if (n[s]?.hidden) return;
128
- const a = e.length < t.indexOf(s) ? `${s}=` : "";
129
- e.push(`${a}{{& inputs.${s} }}`);
127
+ const Ys = (s) => {
128
+ const e = [], t = Object.keys(s);
129
+ return t.forEach((n) => {
130
+ if (s[n]?.hidden) return;
131
+ const a = e.length < t.indexOf(n) ? `${n}=` : "";
132
+ e.push(`${a}{{ inputs.${n} }}`);
130
133
  }), e;
131
- }, Oe = (n, e) => {
132
- if (!n) return;
133
- const t = n.findNodeById(e.id);
134
+ }, Oe = (s, e) => {
135
+ if (!s) return;
136
+ const t = s.findNodeById(e.id);
134
137
  if (!t || t.subgraph) return;
135
- const s = t;
136
- s.state && (s.state.integrated = e.integrated, s.state.modules = e.modules, s.state.props = e.props), Object.entries(e.inputs).forEach(([o, a]) => {
137
- o !== "_node" && s.inputs[o] && (s.inputs[o].hidden = a.hidden);
138
+ const n = t;
139
+ n.state && (n.state.integrated = e.integrated, n.state.modules = e.modules, n.state.props = e.props), Object.entries(e.inputs).forEach(([o, a]) => {
140
+ o !== "_node" && n.inputs[o] && (n.inputs[o].hidden = a.hidden);
138
141
  }), Object.entries(e.outputs).forEach(([o, a]) => {
139
- o !== "_node" && s.outputs[o] && (s.outputs[o].hidden = a.hidden);
142
+ o !== "_node" && n.outputs[o] && (n.outputs[o].hidden = a.hidden);
140
143
  });
141
- }, wt = (n, e) => {
142
- if (!n) return;
143
- const t = n.findNodeById(e.id);
144
+ }, wt = (s, e) => {
145
+ if (!s) return;
146
+ const t = s.findNodeById(e.id);
144
147
  if (!t || t.subgraph) return;
145
- const s = t;
146
- s.state && (e.integrated = s.state.integrated, e.modules = s.state.modules), Object.entries(e.inputs).forEach(([o, a]) => {
147
- o !== "_node" && s.inputs[o] && (a.hidden = s.inputs[o].hidden);
148
+ const n = t;
149
+ n.state && (e.integrated = n.state.integrated, e.modules = n.state.modules), Object.entries(e.inputs).forEach(([o, a]) => {
150
+ o !== "_node" && n.inputs[o] && (a.hidden = n.inputs[o].hidden);
148
151
  }), Object.entries(e.outputs).forEach(([o, a]) => {
149
- o !== "_node" && s.outputs[o] && (a.hidden = s.outputs[o].hidden);
152
+ o !== "_node" && n.outputs[o] && (a.hidden = n.outputs[o].hidden);
150
153
  });
151
- }, _e = (n) => {
154
+ }, _e = (s) => {
152
155
  let e;
153
- if (n.value == null) return "None";
154
- switch (n.type) {
156
+ if (s.value == null) return "None";
157
+ switch (s.type) {
155
158
  case "boolean":
156
- e = n.value ? "True" : "False";
159
+ e = s.value ? "True" : "False";
157
160
  break;
158
161
  case "string":
159
- e = `'${n.value}'`;
162
+ e = `'${s.value}'`;
160
163
  break;
161
164
  case void 0:
162
165
  e = "None";
163
166
  break;
164
167
  default:
165
- e = `${n.value}`;
168
+ e = `${s.value}`;
166
169
  }
167
170
  return e;
168
- }, Ct = ["title"], ae = /* @__PURE__ */ j({
171
+ }, xt = ["title"], ie = /* @__PURE__ */ j({
169
172
  __name: "CodeNodeInterface",
170
173
  props: {
171
174
  intf: {}
172
175
  },
173
- setup(n) {
176
+ setup(s) {
174
177
  return (e, t) => (i(), r("div", {
175
- title: e.intf.state?.script
176
- }, E(e.intf.name), 9, Ct));
178
+ title: s.intf.state?.script
179
+ }, E(s.intf.name), 9, xt));
177
180
  }
178
181
  });
179
182
  class R extends Pe {
@@ -182,7 +185,7 @@ class R extends Pe {
182
185
  state;
183
186
  type = null;
184
187
  constructor(e, t) {
185
- super(e, t), this.setComponent(z(ae)), this.state = G({
188
+ super(e, t), this.setComponent(S(ie)), this.state = G({
186
189
  optional: !1,
187
190
  script: ""
188
191
  });
@@ -193,97 +196,96 @@ class R extends Pe {
193
196
  get shortId() {
194
197
  return this.id.slice(0, 6);
195
198
  }
196
- // override get value(): T {
197
- // return super.value
198
- // }
199
- // override set value(value: T) {
200
- // super.value = value;
201
- // if (this.name !== '_node') this.setHidden(false);
202
- // }
203
199
  }
204
- const qs = (n, e) => {
205
- n.state.optional = e, n.setHidden(!0);
200
+ const qs = (s, e) => {
201
+ s.state.optional = e, s.setHidden(!0);
206
202
  };
207
- class ie extends R {
203
+ class re extends R {
208
204
  constructor(e = "", t) {
209
- super(e, t), this.setComponent(z(ae)), this.use(ke, !0);
205
+ super(e, t), this.setComponent(S(ie)), this.use(ke, !0);
206
+ }
207
+ get value() {
208
+ return super.value;
209
+ }
210
+ set value(e) {
211
+ super.value = e, this.name !== "_node" && this.setHidden(!1);
210
212
  }
211
213
  }
212
- const $e = new D("boolean"), kt = new D("dict"), xt = new D("list"), H = new D("node"), re = new D("number"), de = new D("string"), Js = (n) => {
213
- new Ae(n.editor, { viewPlugin: n }).addTypes($e, kt, xt, H, re, de);
214
+ const $e = new D("boolean"), Ct = new D("dict"), kt = new D("list"), A = new D("node"), de = new D("number"), le = new D("string"), Js = (s) => {
215
+ new He(s.editor, { viewPlugin: s }).addTypes($e, Ct, kt, A, de, le);
214
216
  };
215
- class Qs extends ie {
217
+ class Qs extends re {
216
218
  constructor(e, t) {
217
- super(e, t), this.setComponent(z(He)), this.use(L, $e);
219
+ super(e, t), this.setComponent(S(Ae)), this.use(L, $e);
218
220
  }
219
221
  }
220
222
  class Nt extends R {
221
223
  isCodeNodeOutput = !0;
222
224
  constructor(e = "", t = "") {
223
- super(e, t), this.setComponent(z(ae));
225
+ super(e, t), this.setComponent(S(ie));
224
226
  }
225
227
  get script() {
226
228
  return this.name.length > 0 ? this.name : this.state.script;
227
229
  }
228
230
  }
229
- class le extends ie {
231
+ class ue extends re {
230
232
  min;
231
233
  max;
232
- constructor(e, t, s, o) {
233
- super(e, t), this.min = s, this.max = o, this.use(L, re);
234
+ constructor(e, t, n, o) {
235
+ super(e, t), this.min = n, this.max = o, this.use(L, de);
234
236
  }
235
237
  validate(e) {
236
238
  return (this.min === void 0 || e >= this.min) && (this.max === void 0 || e <= this.max);
237
239
  }
238
240
  }
239
- class Zs extends le {
240
- component = z(Fe);
241
+ class Ks extends ue {
242
+ component = S(Fe);
241
243
  validate(e) {
242
244
  return Number.isInteger(e) && super.validate(e);
243
245
  }
244
246
  }
245
- class Ks extends le {
246
- component = z(We);
247
+ class Zs extends ue {
248
+ component = S(We);
247
249
  }
248
- class ue extends ie {
250
+ class ce extends re {
249
251
  constructor(e, t) {
250
- super(e, t), this.use(L, de);
252
+ super(e, t), this.use(L, le);
251
253
  }
252
254
  }
253
- class en extends ue {
254
- component = z(Xe);
255
+ class en extends ce {
256
+ component = S(Xe);
255
257
  items;
256
- constructor(e, t, s) {
257
- super(e, t), this.items = s;
258
+ constructor(e, t, n) {
259
+ super(e, t), this.items = n;
258
260
  }
259
261
  }
260
- class tn extends le {
261
- component = z(Ye);
262
+ class tn extends ue {
263
+ component = S(Ye);
262
264
  min;
263
265
  max;
264
- constructor(e, t, s, o) {
265
- super(e, t, s, o), this.min = s, this.max = o;
266
+ constructor(e, t, n, o) {
267
+ super(e, t, n, o), this.min = n, this.max = o;
266
268
  }
267
269
  }
268
- class sn extends ue {
269
- component = z(qe);
270
+ class sn extends ce {
271
+ component = S(qe);
270
272
  }
271
- class nn extends ue {
272
- component = z(Je);
273
+ class nn extends ce {
274
+ component = S(Je);
273
275
  }
274
- function on(n) {
276
+ function on(s) {
275
277
  return class extends Me {
276
- type = n.type;
278
+ type = s.type;
277
279
  inputs = {};
278
280
  outputs = {};
279
281
  constructor() {
280
- super(), this._title = n.title ?? n.type, this.updateModules(n.modules), n.variableName && (this.state.variableName = n.variableName), n.codeTemplate && (this.codeTemplate = n.codeTemplate), this.addInput(
282
+ super(), this._title = s.title ?? s.type, this.updateModules(s.modules), s.variableName && (this.state.variableName = s.variableName), s.codeTemplate && (this.codeTemplate = s.codeTemplate), this.addInput(
281
283
  "_node",
282
- new R("", []).use(L, H).use(Y).setHidden(!0)
284
+ new R("", []).use(L, A).use(Y).setHidden(!0)
283
285
  ), this.addOutput(
284
286
  "_node",
285
- new R("", []).use(L, H).use(Y).setHidden(!0)
286
- ), this.executeFactory("input", n.inputs), this.executeFactory("output", n.outputs), n.onCreate?.call(this);
287
+ new R("", []).use(L, A).use(Y).setHidden(!0)
288
+ ), this.executeFactory("input", s.inputs), this.executeFactory("output", s.outputs), s.onCreate?.call(this);
287
289
  }
288
290
  // public calculate = definition.calculate
289
291
  // ? (inputs: I, globalValues: CalculationContext) => ({
@@ -292,18 +294,18 @@ function on(n) {
292
294
  // })
293
295
  // : undefined
294
296
  onPlaced() {
295
- n.onPlaced?.call(this);
297
+ s.onPlaced?.call(this);
296
298
  }
297
299
  onDestroy() {
298
- n.onDestroy?.call(this);
300
+ s.onDestroy?.call(this);
299
301
  }
300
302
  onCodeUpdate() {
301
- n.onCodeUpdate?.call(this);
303
+ s.onCodeUpdate?.call(this);
302
304
  }
303
305
  executeFactory(e, t) {
304
- Object.keys(t || {}).forEach((s) => {
305
- const o = t[s]();
306
- e === "input" ? this.addInput(s, o) : this.addOutput(s, o);
306
+ Object.keys(t || {}).forEach((n) => {
307
+ const o = t[n]();
308
+ e === "input" ? this.addInput(n, o) : this.addOutput(n, o);
307
309
  });
308
310
  }
309
311
  };
@@ -318,34 +320,34 @@ class It extends Me {
318
320
  */
319
321
  calculate;
320
322
  }
321
- function an(n) {
323
+ function an(s) {
322
324
  return class extends It {
323
- type = n.type;
325
+ type = s.type;
324
326
  inputs = {};
325
327
  outputs = {};
326
328
  calculate;
327
329
  preventUpdate = !1;
328
- staticInputKeys = Object.keys(n.inputs ?? {});
329
- staticOutputKeys = Object.keys(n.outputs ?? {});
330
+ staticInputKeys = Object.keys(s.inputs ?? {});
331
+ staticOutputKeys = Object.keys(s.outputs ?? {});
330
332
  constructor() {
331
- super(), this._title = n.title ?? n.type, this.updateModules(n.modules), n.codeTemplate && (this.codeTemplate = n.codeTemplate), n.variableName && (this.state.variableName = n.variableName), this.addInput(
333
+ super(), this._title = s.title ?? s.type, this.updateModules(s.modules), s.codeTemplate && (this.codeTemplate = s.codeTemplate), s.variableName && (this.state.variableName = s.variableName), this.addInput(
332
334
  "_node",
333
- new R("", []).use(L, H).use(Y).setHidden(!0)
335
+ new R("", []).use(L, A).use(Y).setHidden(!0)
334
336
  ), this.addOutput(
335
337
  "_node",
336
- new R("", []).use(L, H).use(Y).setHidden(!0)
337
- ), this.staticInputKeys.push("_node"), this.staticOutputKeys.push("_node"), this.executeFactory("input", n.inputs), this.executeFactory("output", n.outputs), n.onCreate?.call(this);
338
+ new R("", []).use(L, A).use(Y).setHidden(!0)
339
+ ), this.staticInputKeys.push("_node"), this.staticOutputKeys.push("_node"), this.executeFactory("input", s.inputs), this.executeFactory("output", s.outputs), s.onCreate?.call(this);
338
340
  }
339
341
  onPlaced() {
340
342
  this.events.update.subscribe(this, (e) => {
341
343
  e && (e.type === "input" && this.staticInputKeys.includes(e.name) || e.type === "output" && this.staticOutputKeys.includes(e.name)) && this.onUpdate();
342
- }), this.onUpdate(), n.onPlaced?.call(this);
344
+ }), this.onUpdate(), s.onPlaced?.call(this);
343
345
  }
344
346
  onDestroy() {
345
- n.onDestroy?.call(this);
347
+ s.onDestroy?.call(this);
346
348
  }
347
349
  onCodeUpdate() {
348
- n.onCodeUpdate?.call(this);
350
+ s.onCodeUpdate?.call(this);
349
351
  }
350
352
  load(e) {
351
353
  this.preventUpdate = !0, this.hooks.beforeLoad.execute(e), this.id = e.id, this.title = e.title;
@@ -357,17 +359,17 @@ function an(n) {
357
359
  for (const t of Object.keys(e.inputs))
358
360
  if (!this.staticInputKeys.includes(t)) {
359
361
  if (!this.inputs[t]) {
360
- const s = e.inputs[t].value;
362
+ const n = e.inputs[t].value;
361
363
  let o;
362
- typeof s == "number" ? o = new Qe(t, s).use(L, re) : o = new Ze(t, JSON.stringify(s)).use(L, de), o.use(ke, !0), this.addInput(t, o);
364
+ typeof n == "number" ? o = new Qe(t, n).use(L, de) : o = new Ke(t, JSON.stringify(n)).use(L, le), o.use(ke, !0), this.addInput(t, o);
363
365
  }
364
366
  this.inputs[t] && (this.inputs[t].load(e.inputs[t]), this.inputs[t].nodeId = this.id);
365
367
  }
366
368
  for (const t of Object.keys(e.outputs))
367
369
  if (!this.staticOutputKeys.includes(t)) {
368
370
  if (!this.outputs[t]) {
369
- const s = new Nt(t);
370
- this.addOutput(t, s);
371
+ const n = new Nt(t);
372
+ this.addOutput(t, n);
371
373
  }
372
374
  this.outputs[t] && (this.outputs[t].load(e.outputs[t]), this.outputs[t].nodeId = this.id);
373
375
  }
@@ -376,19 +378,19 @@ function an(n) {
376
378
  onUpdate() {
377
379
  if (this.preventUpdate) return;
378
380
  this.graph && this.graph.activeTransactions++;
379
- const e = this.getStaticValues(this.staticInputKeys, this.inputs), t = this.getStaticValues(this.staticOutputKeys, this.outputs), s = n.onUpdate.call(this, e, t);
380
- this.updateInterfaces("input", s.inputs ?? {}, s.forceUpdateInputs ?? []), this.updateInterfaces("output", s.outputs ?? {}, s.forceUpdateOutputs ?? []), this.graph && this.graph.activeTransactions--;
381
+ const e = this.getStaticValues(this.staticInputKeys, this.inputs), t = this.getStaticValues(this.staticOutputKeys, this.outputs), n = s.onUpdate.call(this, e, t);
382
+ this.updateInterfaces("input", n.inputs ?? {}, n.forceUpdateInputs ?? []), this.updateInterfaces("output", n.outputs ?? {}, n.forceUpdateOutputs ?? []), this.graph && this.graph.activeTransactions--;
381
383
  }
382
384
  getStaticValues(e, t) {
383
- const s = {};
385
+ const n = {};
384
386
  for (const o of e)
385
- s[o] = t[o].value;
386
- return s;
387
+ n[o] = t[o].value;
388
+ return n;
387
389
  }
388
- updateInterfaces(e, t, s) {
390
+ updateInterfaces(e, t, n) {
389
391
  const o = e === "input" ? this.staticInputKeys : this.staticOutputKeys, a = e === "input" ? this.inputs : this.outputs;
390
392
  for (const u of Object.keys(a))
391
- o.includes(u) || t[u] && !s.includes(u) || (e === "input" ? this.removeInput(u) : this.removeOutput(u));
393
+ o.includes(u) || t[u] && !n.includes(u) || (e === "input" ? this.removeInput(u) : this.removeOutput(u));
392
394
  for (const u of Object.keys(t)) {
393
395
  if (a[u]) continue;
394
396
  const l = t[u]();
@@ -396,13 +398,14 @@ function an(n) {
396
398
  }
397
399
  }
398
400
  executeFactory(e, t) {
399
- Object.keys(t || {}).forEach((s) => {
400
- const o = t[s]();
401
- e === "input" ? this.addInput(s, o) : this.addOutput(s, o);
401
+ Object.keys(t || {}).forEach((n) => {
402
+ const o = t[n]();
403
+ e === "input" ? this.addInput(n, o) : this.addOutput(n, o);
402
404
  });
403
405
  }
404
406
  };
405
407
  }
408
+ q.escape = (s) => s;
406
409
  class Mt {
407
410
  _id;
408
411
  _viewModel;
@@ -478,7 +481,7 @@ class Mt {
478
481
  * @param props optional
479
482
  * @returns code node
480
483
  */
481
- addNodeAtCoordinates = (e, t = { x: 0, y: 0 }, s) => (this.addNode(e, s), e.position && (e.position = t), e);
484
+ addNodeAtCoordinates = (e, t = { x: 0, y: 0 }, n) => (this.addNode(e, n), e.position && (e.position = t), e);
482
485
  /**
483
486
  * Add connection of code nodes
484
487
  * @param from code node interface
@@ -515,7 +518,7 @@ class Mt {
515
518
  */
516
519
  hasConnection(e, t) {
517
520
  return this.connections.some(
518
- (s) => s.from.id === e.id && s.to.id === t.id
521
+ (n) => n.from.id === e.id && n.to.id === t.id
519
522
  );
520
523
  }
521
524
  /**
@@ -553,7 +556,7 @@ class Mt {
553
556
  * Render code.
554
557
  */
555
558
  renderCode() {
556
- this.state.script = xe.render(this.state.template || "", this);
559
+ this.state.script = q.render(this.state.template || "", this);
557
560
  }
558
561
  /**
559
562
  * Save code graph.
@@ -569,12 +572,12 @@ class Mt {
569
572
  * @param nodeStates a list of node state.
570
573
  */
571
574
  saveNodeStates(e) {
572
- e.forEach((t, s) => {
573
- const o = this.nodes[s];
574
- Object.entries(t.inputs).forEach(([a]) => {
575
- t.inputs && o.inputs[a] && (t.inputs[a].hidden = o.inputs[a].hidden);
576
- }), Object.entries(t.outputs).forEach(([a]) => {
577
- t.outputs && o.outputs[a] && (t.outputs[a].hidden = o.outputs[a].hidden);
575
+ e.forEach((t, n) => {
576
+ const o = this.nodes[n];
577
+ Object.entries(t.inputs).forEach(([a, u]) => {
578
+ t.inputs && o.inputs[a] && (u.hidden = o.inputs[a].hidden);
579
+ }), Object.entries(t.outputs).forEach(([a, u]) => {
580
+ t.outputs && o.outputs[a] && (u.hidden = o.outputs[a].hidden);
578
581
  });
579
582
  });
580
583
  }
@@ -590,8 +593,8 @@ class Mt {
590
593
  ]);
591
594
  let t = [...this.nodeIds];
592
595
  t.reverse(), t = gt.array(t, e), t.reverse();
593
- const s = this.graph.nodes.map((a) => a.id).filter((a) => !t.includes(a));
594
- t = t.concat(s);
596
+ const n = this.graph.nodes.map((a) => a.id).filter((a) => !t.includes(a));
597
+ t = t.concat(n);
595
598
  const o = t.map((a) => this.findNodeById(a));
596
599
  o && (this.nodes = o);
597
600
  } catch {
@@ -602,63 +605,63 @@ class Mt {
602
605
  this.codeNodes.forEach((e) => e.updateOutputVariableName());
603
606
  }
604
607
  }
605
- const Z = (n) => {
608
+ const Z = (s) => {
606
609
  let e = [];
607
- return n.nodes.forEach((t) => {
610
+ return s.nodes.forEach((t) => {
608
611
  t.subgraph ? e = e.concat(Z(t.subgraph)) : t.isCodeNode && e.push(t);
609
612
  }), e;
610
- }, rn = (n = 0, e = 100) => ({
611
- x: n * 420,
613
+ }, rn = (s = 0, e = 100) => ({
614
+ x: s * 420,
612
615
  y: e
613
- }), dn = (n) => {
614
- const e = { ...n.position };
616
+ }), dn = (s) => {
617
+ const e = { ...s.position };
615
618
  return e.x -= 400, e.y += 50, e;
616
- }, ln = (n) => {
617
- const { calculationOrder: e, connectionsFromNode: t } = Ce(n);
618
- e.forEach((s) => {
619
- if (!s.isCodeNode) return;
620
- const o = s;
619
+ }, ln = (s) => {
620
+ const { calculationOrder: e, connectionsFromNode: t } = Ce(s);
621
+ e.forEach((n) => {
622
+ if (!n.isCodeNode) return;
623
+ const o = n;
621
624
  t.has(o) && t.get(o).forEach((a) => {
622
625
  a.to.state && a.from.script && (a.to.state.script = a.from.script);
623
626
  });
624
627
  });
625
- }, Ot = ["id"], $t = { class: "align-middle" }, ye = /* @__PURE__ */ j({
628
+ }, Ot = ["id"], $t = { class: "align-middle" }, we = /* @__PURE__ */ j({
626
629
  __name: "CodeGraphNodeInterface",
627
630
  props: {
628
631
  node: {},
629
632
  intf: {}
630
633
  },
631
- setup(n) {
632
- const e = n, { viewModel: t } = F(), { hoveredOver: s, temporaryConnection: o } = Ke(), a = O(null), u = b(() => e.intf.connectionCount > 0), l = b(() => ({
634
+ setup(s) {
635
+ const e = s, { viewModel: t } = F(), { hoveredOver: n, temporaryConnection: o } = Ze(), a = O(null), u = b(() => e.intf.connectionCount > 0), l = b(() => ({
633
636
  "--connected": u.value
634
637
  })), v = () => {
635
- s(e.intf);
636
- }, _ = () => {
637
- s(void 0);
638
+ n(e.intf);
638
639
  }, y = () => {
640
+ n(void 0);
641
+ }, _ = () => {
639
642
  a.value && t.value.hooks.renderInterface.execute({ intf: e.intf, el: a.value });
640
643
  };
641
- return ee(y), Ne(y), (x, B) => (i(), r("div", {
642
- id: x.intf.id,
644
+ return te(_), Ne(_), (M, B) => (i(), r("div", {
645
+ id: s.intf.id,
643
646
  ref_key: "el",
644
647
  ref: a,
645
648
  class: U(["baklava-node-interface", l.value])
646
649
  }, [
647
- x.intf.port ? (i(), r("div", {
650
+ s.intf.port ? (i(), r("div", {
648
651
  key: 0,
649
- class: U(["__port", { "--selected": k(o)?.from === x.intf }]),
652
+ class: U(["__port", { "--selected": C(o)?.from === s.intf }]),
650
653
  onPointerover: v,
651
- onPointerout: _
652
- }, null, 34)) : I("", !0),
654
+ onPointerout: y
655
+ }, null, 34)) : N("", !0),
653
656
  d("span", $t, [
654
- J(x.$slots, "default")
657
+ Q(M.$slots, "default")
655
658
  ])
656
659
  ], 10, Ot));
657
660
  }
658
- }), S = (n, e) => {
659
- const t = n.__vccOpts || n;
660
- for (const [s, o] of e)
661
- t[s] = o;
661
+ }), z = (s, e) => {
662
+ const t = s.__vccOpts || s;
663
+ for (const [n, o] of e)
664
+ t[n] = o;
662
665
  return t;
663
666
  }, Tt = {}, Et = {
664
667
  xmlns: "http://www.w3.org/2000/svg",
@@ -668,7 +671,7 @@ const Z = (n) => {
668
671
  fill: "currentColor",
669
672
  class: "baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-left-collapse"
670
673
  };
671
- function zt(n, e) {
674
+ function St(s, e) {
672
675
  return i(), r("svg", Et, [...e[0] || (e[0] = [
673
676
  d("path", {
674
677
  stroke: "none",
@@ -678,7 +681,7 @@ function zt(n, e) {
678
681
  d("path", { d: "M18 3a3 3 0 0 1 2.995 2.824l.005 .176v12a3 3 0 0 1 -2.824 2.995l-.176 .005h-12a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-12a3 3 0 0 1 2.824 -2.995l.176 -.005h12zm0 2h-9v14h9a1 1 0 0 0 .993 -.883l.007 -.117v-12a1 1 0 0 0 -.883 -.993l-.117 -.007zm-2.293 4.293a1 1 0 0 1 .083 1.32l-.083 .094l-1.292 1.293l1.292 1.293a1 1 0 0 1 .083 1.32l-.083 .094a1 1 0 0 1 -1.32 .083l-.094 -.083l-2 -2a1 1 0 0 1 -.083 -1.32l.083 -.094l2 -2a1 1 0 0 1 1.414 0z" }, null, -1)
679
682
  ])]);
680
683
  }
681
- const St = /* @__PURE__ */ S(Tt, [["render", zt]]), Bt = {}, Lt = {
684
+ const zt = /* @__PURE__ */ z(Tt, [["render", St]]), Bt = {}, Lt = {
682
685
  xmlns: "http://www.w3.org/2000/svg",
683
686
  width: "24",
684
687
  height: "24",
@@ -686,7 +689,7 @@ const St = /* @__PURE__ */ S(Tt, [["render", zt]]), Bt = {}, Lt = {
686
689
  fill: "currentColor",
687
690
  class: "baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-left-expand"
688
691
  };
689
- function Vt(n, e) {
692
+ function Vt(s, e) {
690
693
  return i(), r("svg", Lt, [...e[0] || (e[0] = [
691
694
  d("path", {
692
695
  stroke: "none",
@@ -696,7 +699,7 @@ function Vt(n, e) {
696
699
  d("path", { d: "M18 3a3 3 0 0 1 2.995 2.824l.005 .176v12a3 3 0 0 1 -2.824 2.995l-.176 .005h-12a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-12a3 3 0 0 1 2.824 -2.995l.176 -.005h12zm0 2h-9v14h9a1 1 0 0 0 .993 -.883l.007 -.117v-12a1 1 0 0 0 -.883 -.993l-.117 -.007zm-4.387 4.21l.094 .083l2 2a1 1 0 0 1 .083 1.32l-.083 .094l-2 2a1 1 0 0 1 -1.497 -1.32l.083 -.094l1.292 -1.293l-1.292 -1.293a1 1 0 0 1 -.083 -1.32l.083 -.094a1 1 0 0 1 1.32 -.083z" }, null, -1)
697
700
  ])]);
698
701
  }
699
- const jt = /* @__PURE__ */ S(Bt, [["render", Vt]]), Ut = {}, Gt = {
702
+ const jt = /* @__PURE__ */ z(Bt, [["render", Vt]]), Ut = {}, Gt = {
700
703
  xmlns: "http://www.w3.org/2000/svg",
701
704
  width: "24",
702
705
  height: "24",
@@ -704,7 +707,7 @@ const jt = /* @__PURE__ */ S(Bt, [["render", Vt]]), Ut = {}, Gt = {
704
707
  fill: "currentColor",
705
708
  class: "balkava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-right"
706
709
  };
707
- function Rt(n, e) {
710
+ function Rt(s, e) {
708
711
  return i(), r("svg", Gt, [...e[0] || (e[0] = [
709
712
  d("path", {
710
713
  stroke: "none",
@@ -714,7 +717,7 @@ function Rt(n, e) {
714
717
  d("path", { d: "M6 21a3 3 0 0 1 -3 -3v-12a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3zm8 -16h-8a1 1 0 0 0 -1 1v12a1 1 0 0 0 1 1h8z" }, null, -1)
715
718
  ])]);
716
719
  }
717
- const Dt = /* @__PURE__ */ S(Ut, [["render", Rt]]), Pt = {}, At = {
720
+ const Dt = /* @__PURE__ */ z(Ut, [["render", Rt]]), Pt = {}, Ht = {
718
721
  xmlns: "http://www.w3.org/2000/svg",
719
722
  width: "24",
720
723
  height: "24",
@@ -722,8 +725,8 @@ const Dt = /* @__PURE__ */ S(Ut, [["render", Rt]]), Pt = {}, At = {
722
725
  fill: "currentColor",
723
726
  class: "baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-right-collapse"
724
727
  };
725
- function Ht(n, e) {
726
- return i(), r("svg", At, [...e[0] || (e[0] = [
728
+ function At(s, e) {
729
+ return i(), r("svg", Ht, [...e[0] || (e[0] = [
727
730
  d("path", {
728
731
  stroke: "none",
729
732
  d: "M0 0h24v24H0z",
@@ -732,7 +735,7 @@ function Ht(n, e) {
732
735
  d("path", { d: "M18 3a3 3 0 0 1 2.995 2.824l.005 .176v12a3 3 0 0 1 -2.824 2.995l-.176 .005h-12a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-12a3 3 0 0 1 2.824 -2.995l.176 -.005h12zm-3 2h-9a1 1 0 0 0 -.993 .883l-.007 .117v12a1 1 0 0 0 .883 .993l.117 .007h9v-14zm-5.387 4.21l.094 .083l2 2a1 1 0 0 1 .083 1.32l-.083 .094l-2 2a1 1 0 0 1 -1.497 -1.32l.083 -.094l1.292 -1.293l-1.292 -1.293a1 1 0 0 1 -.083 -1.32l.083 -.094a1 1 0 0 1 1.32 -.083z" }, null, -1)
733
736
  ])]);
734
737
  }
735
- const Ft = /* @__PURE__ */ S(Pt, [["render", Ht]]), Wt = {}, Xt = {
738
+ const Ft = /* @__PURE__ */ z(Pt, [["render", At]]), Wt = {}, Xt = {
736
739
  xmlns: "http://www.w3.org/2000/svg",
737
740
  width: "24",
738
741
  height: "24",
@@ -740,7 +743,7 @@ const Ft = /* @__PURE__ */ S(Pt, [["render", Ht]]), Wt = {}, Xt = {
740
743
  fill: "currentColor",
741
744
  class: "baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-right-expand"
742
745
  };
743
- function Yt(n, e) {
746
+ function Yt(s, e) {
744
747
  return i(), r("svg", Xt, [...e[0] || (e[0] = [
745
748
  d("path", {
746
749
  stroke: "none",
@@ -750,7 +753,7 @@ function Yt(n, e) {
750
753
  d("path", { d: "M18 3a3 3 0 0 1 2.995 2.824l.005 .176v12a3 3 0 0 1 -2.824 2.995l-.176 .005h-12a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-12a3 3 0 0 1 2.824 -2.995l.176 -.005h12zm-3 2h-9a1 1 0 0 0 -.993 .883l-.007 .117v12a1 1 0 0 0 .883 .993l.117 .007h9v-14zm-3.293 4.293a1 1 0 0 1 .083 1.32l-.083 .094l-1.292 1.293l1.292 1.293a1 1 0 0 1 .083 1.32l-.083 .094a1 1 0 0 1 -1.32 .083l-.094 -.083l-2 -2a1 1 0 0 1 -.083 -1.32l.083 -.094l2 -2a1 1 0 0 1 1.414 0z" }, null, -1)
751
754
  ])]);
752
755
  }
753
- const qt = /* @__PURE__ */ S(Wt, [["render", Yt]]), Jt = {}, Qt = {
756
+ const qt = /* @__PURE__ */ z(Wt, [["render", Yt]]), Jt = {}, Qt = {
754
757
  xmlns: "http://www.w3.org/2000/svg",
755
758
  class: "baklava-icon",
756
759
  width: "24",
@@ -762,12 +765,12 @@ const qt = /* @__PURE__ */ S(Wt, [["render", Yt]]), Jt = {}, Qt = {
762
765
  "stroke-linecap": "round",
763
766
  "stroke-linejoin": "round"
764
767
  };
765
- function Zt(n, e) {
768
+ function Kt(s, e) {
766
769
  return i(), r("svg", Qt, [...e[0] || (e[0] = [
767
- te('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M5 2h5v4h-5z"></path><path d="M15 10h5v4h-5z"></path><path d="M5 18h5v4h-5z"></path><path d="M5 10h5v4h-5z"></path><path d="M10 12h5"></path><path d="M7.5 6v4"></path><path d="M7.5 14v4"></path>', 8)
770
+ se('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M5 2h5v4h-5z"></path><path d="M15 10h5v4h-5z"></path><path d="M5 18h5v4h-5z"></path><path d="M5 10h5v4h-5z"></path><path d="M10 12h5"></path><path d="M7.5 6v4"></path><path d="M7.5 14v4"></path>', 8)
768
771
  ])]);
769
772
  }
770
- const Kt = /* @__PURE__ */ S(Jt, [["render", Zt]]), es = {}, ts = {
773
+ const Zt = /* @__PURE__ */ z(Jt, [["render", Kt]]), es = {}, ts = {
771
774
  xmlns: "http://www.w3.org/2000/svg",
772
775
  class: "baklava-icon",
773
776
  width: "24",
@@ -779,12 +782,12 @@ const Kt = /* @__PURE__ */ S(Jt, [["render", Zt]]), es = {}, ts = {
779
782
  "stroke-linecap": "round",
780
783
  "stroke-linejoin": "round"
781
784
  };
782
- function ss(n, e) {
785
+ function ss(s, e) {
783
786
  return i(), r("svg", ts, [...e[0] || (e[0] = [
784
- te('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M6 2h4v4m-4 0h-1v-1"></path><path d="M15 11v-1h5v4h-2"></path><path d="M5 18h5v4h-5z"></path><path d="M5 10h5v4h-5z"></path><path d="M10 12h2"></path><path d="M7.5 7.5v2.5"></path><path d="M7.5 14v4"></path><path d="M3 3l18 18"></path>', 9)
787
+ se('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M6 2h4v4m-4 0h-1v-1"></path><path d="M15 11v-1h5v4h-2"></path><path d="M5 18h5v4h-5z"></path><path d="M5 10h5v4h-5z"></path><path d="M10 12h2"></path><path d="M7.5 7.5v2.5"></path><path d="M7.5 14v4"></path><path d="M3 3l18 18"></path>', 9)
785
788
  ])]);
786
789
  }
787
- const ns = /* @__PURE__ */ S(es, [["render", ss]]), os = {}, as = {
790
+ const ns = /* @__PURE__ */ z(es, [["render", ss]]), os = {}, as = {
788
791
  xmlns: "http://www.w3.org/2000/svg",
789
792
  class: "baklava-icon",
790
793
  width: "24",
@@ -796,12 +799,12 @@ const ns = /* @__PURE__ */ S(es, [["render", ss]]), os = {}, as = {
796
799
  "stroke-linecap": "round",
797
800
  "stroke-linejoin": "round"
798
801
  };
799
- function is(n, e) {
802
+ function is(s, e) {
800
803
  return i(), r("svg", as, [...e[0] || (e[0] = [
801
- te('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M3 3l18 18"></path><path d="M4 7h3m4 0h9"></path><path d="M10 11l0 6"></path><path d="M14 14l0 3"></path><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l.077 -.923"></path><path d="M18.384 14.373l.616 -7.373"></path><path d="M9 5v-1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"></path>', 8)
804
+ se('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M3 3l18 18"></path><path d="M4 7h3m4 0h9"></path><path d="M10 11l0 6"></path><path d="M14 14l0 3"></path><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l.077 -.923"></path><path d="M18.384 14.373l.616 -7.373"></path><path d="M9 5v-1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"></path>', 8)
802
805
  ])]);
803
806
  }
804
- const rs = /* @__PURE__ */ S(os, [["render", is]]), ds = {}, ls = {
807
+ const rs = /* @__PURE__ */ z(os, [["render", is]]), ds = {}, ls = {
805
808
  xmlns: "http://www.w3.org/2000/svg",
806
809
  class: "baklava-icon",
807
810
  width: "16",
@@ -813,7 +816,7 @@ const rs = /* @__PURE__ */ S(os, [["render", is]]), ds = {}, ls = {
813
816
  "stroke-linecap": "round",
814
817
  "stroke-linejoin": "round"
815
818
  };
816
- function us(n, e) {
819
+ function us(s, e) {
817
820
  return i(), r("svg", ls, [...e[0] || (e[0] = [
818
821
  d("path", {
819
822
  stroke: "none",
@@ -837,13 +840,13 @@ function us(n, e) {
837
840
  }, null, -1)
838
841
  ])]);
839
842
  }
840
- const cs = /* @__PURE__ */ S(ds, [["render", us]]), ps = ["id", "data-node-type"], hs = {
843
+ const cs = /* @__PURE__ */ z(ds, [["render", us]]), ps = ["id", "data-node-type"], hs = {
841
844
  class: "__title-label",
842
845
  style: { "flex-grow": "1" }
843
846
  }, vs = { key: 0 }, ms = {
844
847
  class: "__menu",
845
848
  style: { display: "flex" }
846
- }, fs = { class: "__outputs" }, gs = { key: 0 }, bs = ["id", "title"], _s = { class: "__inputs" }, ys = { key: 0 }, ws = ["id", "title"], Cs = /* @__PURE__ */ j({
849
+ }, fs = { class: "__outputs" }, gs = { key: 0 }, bs = ["id", "title"], ys = { class: "__inputs" }, _s = { key: 0 }, ws = ["id", "title"], xs = /* @__PURE__ */ j({
847
850
  __name: "CodeGraphNode",
848
851
  props: {
849
852
  node: {},
@@ -851,17 +854,17 @@ const cs = /* @__PURE__ */ S(ds, [["render", us]]), ps = ["id", "data-node-type"
851
854
  dragging: { type: Boolean }
852
855
  },
853
856
  emits: ["select", "start-drag", "update"],
854
- setup(n, { emit: e }) {
855
- const t = be.ContextMenu, s = be.NodeInterface, o = n, a = b(() => o.node), u = e, { viewModel: l } = F(), { graph: v, switchGraph: _ } = K(), y = O(null), x = O(!1), B = O(""), w = O(null), m = O(!1);
857
+ setup(s, { emit: e }) {
858
+ const t = ye.ContextMenu, n = ye.NodeInterface, o = s, a = b(() => o.node), u = e, { viewModel: l } = F(), { graph: v, switchGraph: y } = ee(), _ = O(null), M = O(!1), B = O(""), w = O(null), m = O(!1);
856
859
  let f = 0, h = 0;
857
- const p = O(!1), C = b(() => {
860
+ const p = O(!1), x = b(() => {
858
861
  const c = [
859
862
  { value: "edit", label: "Edit" },
860
863
  { value: "rename", label: "Rename" },
861
864
  { value: "delete", label: "Delete" }
862
865
  ];
863
- return o.node.type.startsWith(q) && c.push({ value: "editSubgraph", label: "Edit Subgraph" }), c;
864
- }), M = b(() => ({
866
+ return o.node.type.startsWith(J) && c.push({ value: "editSubgraph", label: "Edit Subgraph" }), c;
867
+ }), I = b(() => ({
865
868
  "--selected": o.selected,
866
869
  "--dragging": o.dragging,
867
870
  "--two-column": !!o.node.twoColumn,
@@ -872,16 +875,16 @@ const cs = /* @__PURE__ */ S(ds, [["render", us]]), ps = ["id", "data-node-type"
872
875
  top: `${o.node.position?.y ?? 0}px`,
873
876
  left: `${o.node.position?.x ?? 0}px`,
874
877
  "--width": `${o.node.width ?? l.value.settings.nodes.defaultWidth}px`
875
- })), ze = b(() => Object.values(o.node.inputs).filter((c) => !c.hidden)), Se = b(() => Object.values(o.node.outputs).filter((c) => !c.hidden)), ce = () => {
878
+ })), Se = b(() => Object.values(o.node.inputs).filter((c) => !c.hidden)), ze = b(() => Object.values(o.node.outputs).filter((c) => !c.hidden)), pe = () => {
876
879
  u("select");
877
880
  }, Be = (c) => {
878
- o.selected || ce(), u("start-drag", c);
879
- }, pe = () => {
881
+ o.selected || pe(), u("start-drag", c);
882
+ }, he = () => {
880
883
  p.value = !0;
881
884
  }, Le = () => {
882
885
  const c = l.value.displayedGraph.sidebar;
883
886
  c.nodeId = "", c.visible = !1;
884
- }, he = () => {
887
+ }, ve = () => {
885
888
  const c = l.value.displayedGraph.sidebar;
886
889
  c.nodeId = o.node.id, c.visible = !0;
887
890
  }, Ve = () => {
@@ -890,127 +893,127 @@ const cs = /* @__PURE__ */ S(ds, [["render", us]]), ps = ["id", "data-node-type"
890
893
  }, je = async (c) => {
891
894
  switch (c) {
892
895
  case "edit":
893
- he();
896
+ ve();
894
897
  break;
895
898
  case "delete":
896
899
  v.value.removeNode(o.node);
897
900
  break;
898
901
  case "rename":
899
- B.value = o.node.title, x.value = !0, await lt(), w.value?.focus();
902
+ B.value = o.node.title, M.value = !0, await lt(), w.value?.focus();
900
903
  break;
901
904
  case "editSubgraph":
902
- _(o.node.template);
905
+ y(o.node.template);
903
906
  break;
904
907
  }
905
- }, ve = () => {
906
- o.node.title = B.value, x.value = !1;
907
908
  }, me = () => {
908
- y.value && l.value.hooks.renderNode.execute({ node: o.node, el: y.value });
909
+ o.node.title = B.value, M.value = !1;
910
+ }, fe = () => {
911
+ _.value && l.value.hooks.renderNode.execute({ node: o.node, el: _.value });
909
912
  }, Ue = (c) => {
910
913
  m.value = !0, f = o.node.width, h = c.clientX, c.preventDefault();
911
- }, fe = (c) => {
914
+ }, ge = (c) => {
912
915
  if (!m.value) return;
913
- const N = c.clientX - h, g = f + N / v.value.scaling, Ge = l.value.settings.nodes.minWidth, Re = l.value.settings.nodes.maxWidth;
916
+ const k = c.clientX - h, g = f + k / v.value.scaling, Ge = l.value.settings.nodes.minWidth, Re = l.value.settings.nodes.maxWidth;
914
917
  o.node.width = Math.max(Ge, Math.min(Re, g));
915
- }, ge = () => {
918
+ }, be = () => {
916
919
  m.value = !1;
917
920
  };
918
- return ee(() => {
919
- me(), window.addEventListener("mousemove", fe), window.addEventListener("mouseup", ge);
920
- }), Ne(me), rt(() => {
921
- window.removeEventListener("mousemove", fe), window.removeEventListener("mouseup", ge);
922
- }), (c, N) => (i(), r("div", {
921
+ return te(() => {
922
+ fe(), window.addEventListener("mousemove", ge), window.addEventListener("mouseup", be);
923
+ }), Ne(fe), rt(() => {
924
+ window.removeEventListener("mousemove", ge), window.removeEventListener("mouseup", be);
925
+ }), (c, k) => (i(), r("div", {
923
926
  id: a.value.id,
924
927
  ref_key: "el",
925
- ref: y,
926
- class: U([M.value, "baklava-node"]),
928
+ ref: _,
929
+ class: U([I.value, "baklava-node"]),
927
930
  "data-node-type": a.value.type,
928
- style: se(Ee.value),
929
- onPointerdown: ce
931
+ style: ne(Ee.value),
932
+ onPointerdown: pe
930
933
  }, [
931
- k(l).settings.nodes.resizable ? (i(), r("div", {
934
+ C(l).settings.nodes.resizable ? (i(), r("div", {
932
935
  key: 0,
933
936
  class: "__resize-handle",
934
937
  onMousedown: Ue
935
- }, null, 32)) : I("", !0),
938
+ }, null, 32)) : N("", !0),
936
939
  d("div", {
937
940
  class: "__title",
938
941
  onPointerdown: P(Be, ["self", "stop"]),
939
- onContextmenu: P(pe, ["prevent"])
942
+ onContextmenu: P(he, ["prevent"])
940
943
  }, [
941
- a.value.inputs._node ? (i(), V(ye, {
944
+ a.value.inputs._node ? (i(), V(we, {
942
945
  key: 0,
943
946
  node: a.value,
944
947
  intf: a.value.inputs._node,
945
948
  class: "--input",
946
949
  "data-interface-type": "node",
947
950
  style: { "flex-grow": "0" }
948
- }, null, 8, ["node", "intf"])) : I("", !0),
949
- x.value ? ne((i(), r("input", {
951
+ }, null, 8, ["node", "intf"])) : N("", !0),
952
+ M.value ? oe((i(), r("input", {
950
953
  key: 2,
951
954
  ref_key: "renameInputEl",
952
955
  ref: w,
953
- "onUpdate:modelValue": N[1] || (N[1] = (g) => B.value = g),
956
+ "onUpdate:modelValue": k[1] || (k[1] = (g) => B.value = g),
954
957
  class: "baklava-input",
955
958
  placeholder: "Node Name",
956
959
  style: { "flex-grow": "1" },
957
960
  type: "text",
958
- onBlur: ve,
959
- onKeydown: Q(ve, ["enter"])
961
+ onBlur: me,
962
+ onKeydown: K(me, ["enter"])
960
963
  }, null, 544)), [
961
- [oe, B.value]
964
+ [ae, B.value]
962
965
  ]) : (i(), r($, { key: 1 }, [
963
966
  d("div", hs, [
964
- a.value.idx > -1 ? (i(), r("span", vs, E(a.value.idx + 1) + " - ", 1)) : I("", !0),
967
+ a.value.idx > -1 ? (i(), r("span", vs, E(a.value.idx + 1) + " - ", 1)) : N("", !0),
965
968
  dt(E(a.value.title) + " (" + E(a.value.shortId) + ") ", 1)
966
969
  ]),
967
970
  d("div", ms, [
968
- a.value.subgraph ? I("", !0) : (i(), r($, { key: 0 }, [
969
- !k(l).displayedGraph.sidebar.visible && k(l).displayedGraph.sidebar.nodeId !== a.value.id ? (i(), V(k(qt), {
971
+ a.value.subgraph ? N("", !0) : (i(), r($, { key: 0 }, [
972
+ !C(l).displayedGraph.sidebar.visible && C(l).displayedGraph.sidebar.nodeId !== a.value.id ? (i(), V(C(qt), {
970
973
  key: 0,
971
974
  class: "--clickable mx-1",
972
- onClick: he
973
- })) : k(l).displayedGraph.sidebar.visible && k(l).displayedGraph.sidebar.nodeId !== a.value.id ? (i(), V(k(Dt), {
975
+ onClick: ve
976
+ })) : C(l).displayedGraph.sidebar.visible && C(l).displayedGraph.sidebar.nodeId !== a.value.id ? (i(), V(C(Dt), {
974
977
  key: 1,
975
978
  class: "--clickable mx-1",
976
979
  onClick: Ve
977
- })) : (i(), V(k(Ft), {
980
+ })) : (i(), V(C(Ft), {
978
981
  key: 2,
979
982
  class: "--clickable mx-1",
980
983
  onClick: Le
981
984
  }))
982
985
  ], 64)),
983
- T(k(cs), {
986
+ T(C(cs), {
984
987
  class: "--clickable mx-1",
985
- onClick: pe
988
+ onClick: he
986
989
  }),
987
- T(k(t), {
990
+ T(C(t), {
988
991
  modelValue: p.value,
989
- "onUpdate:modelValue": N[0] || (N[0] = (g) => p.value = g),
992
+ "onUpdate:modelValue": k[0] || (k[0] = (g) => p.value = g),
990
993
  x: 0,
991
994
  y: 0,
992
- items: C.value,
995
+ items: x.value,
993
996
  onClick: je
994
997
  }, null, 8, ["modelValue", "items"])
995
998
  ])
996
999
  ], 64)),
997
- a.value.outputs._node ? (i(), V(ye, {
1000
+ a.value.outputs._node ? (i(), V(we, {
998
1001
  key: 3,
999
1002
  node: a.value,
1000
1003
  intf: a.value.outputs._node,
1001
1004
  class: "--output",
1002
1005
  "data-interface-type": "node"
1003
- }, null, 8, ["node", "intf"])) : I("", !0)
1006
+ }, null, 8, ["node", "intf"])) : N("", !0)
1004
1007
  ], 32),
1005
1008
  d("div", {
1006
1009
  class: U(["__content", Te.value]),
1007
- onKeydown: N[2] || (N[2] = Q(P(() => {
1010
+ onKeydown: k[2] || (k[2] = K(P(() => {
1008
1011
  }, ["stop"]), ["delete"])),
1009
- onContextmenu: N[3] || (N[3] = P(() => {
1012
+ onContextmenu: k[3] || (k[3] = P(() => {
1010
1013
  }, ["prevent"]))
1011
1014
  }, [
1012
1015
  d("div", fs, [
1013
- (i(!0), r($, null, A(Se.value, (g) => (i(), r($, {
1016
+ (i(!0), r($, null, H(ze.value, (g) => (i(), r($, {
1014
1017
  key: g.id
1015
1018
  }, [
1016
1019
  a.value.state?.hidden ? (i(), r("div", gs, [
@@ -1019,42 +1022,42 @@ const cs = /* @__PURE__ */ S(ds, [["render", us]]), ps = ["id", "data-node-type"
1019
1022
  id: g.id,
1020
1023
  title: g.name,
1021
1024
  class: "baklava-node-interface --output --connected"
1022
- }, [...N[4] || (N[4] = [
1025
+ }, [...k[4] || (k[4] = [
1023
1026
  d("div", { class: "__port" }, null, -1)
1024
- ])], 8, bs)) : I("", !0)
1025
- ])) : J(c.$slots, "nodeInterface", {
1027
+ ])], 8, bs)) : N("", !0)
1028
+ ])) : Q(c.$slots, "nodeInterface", {
1026
1029
  key: 1,
1027
1030
  type: "output",
1028
1031
  node: a.value,
1029
1032
  intf: g
1030
1033
  }, () => [
1031
- T(k(s), {
1034
+ T(C(n), {
1032
1035
  node: a.value,
1033
1036
  intf: g
1034
1037
  }, null, 8, ["node", "intf"])
1035
1038
  ])
1036
1039
  ], 64))), 128))
1037
1040
  ]),
1038
- d("div", _s, [
1039
- (i(!0), r($, null, A(ze.value, (g) => (i(), r($, {
1041
+ d("div", ys, [
1042
+ (i(!0), r($, null, H(Se.value, (g) => (i(), r($, {
1040
1043
  key: g.id
1041
1044
  }, [
1042
- a.value.state?.hidden ? (i(), r("div", ys, [
1045
+ a.value.state?.hidden ? (i(), r("div", _s, [
1043
1046
  g.port ? (i(), r("div", {
1044
1047
  key: 0,
1045
1048
  id: g.id,
1046
1049
  title: g.name,
1047
1050
  class: "baklava-node-interface --input --connected"
1048
- }, [...N[5] || (N[5] = [
1051
+ }, [...k[5] || (k[5] = [
1049
1052
  d("div", { class: "__port" }, null, -1)
1050
- ])], 8, ws)) : I("", !0)
1051
- ])) : J(c.$slots, "nodeInterface", {
1053
+ ])], 8, ws)) : N("", !0)
1054
+ ])) : Q(c.$slots, "nodeInterface", {
1052
1055
  key: 1,
1053
1056
  node: a.value,
1054
1057
  intf: g,
1055
1058
  type: "input"
1056
1059
  }, () => [
1057
- T(k(s), {
1060
+ T(C(n), {
1058
1061
  node: a.value,
1059
1062
  intf: g,
1060
1063
  title: g.name
@@ -1065,7 +1068,7 @@ const cs = /* @__PURE__ */ S(ds, [["render", us]]), ps = ["id", "data-node-type"
1065
1068
  ], 34)
1066
1069
  ], 46, ps));
1067
1070
  }
1068
- }), ks = ["title"], xs = {
1071
+ }), Cs = ["title"], ks = {
1069
1072
  key: 0,
1070
1073
  class: "__label"
1071
1074
  }, Ns = /* @__PURE__ */ j({
@@ -1077,9 +1080,9 @@ const cs = /* @__PURE__ */ S(ds, [["render", us]]), ps = ["id", "data-node-type"
1077
1080
  name: {}
1078
1081
  },
1079
1082
  emits: ["update:modelValue"],
1080
- setup(n, { emit: e }) {
1083
+ setup(s, { emit: e }) {
1081
1084
  const t = e;
1082
- return (s, o) => (i(), r("div", {
1085
+ return (n, o) => (i(), r("div", {
1083
1086
  class: U(["baklava-checkbox", { "--checked": s.inversed ? !s.modelValue : s.modelValue, "--disabled": s.disabled }]),
1084
1087
  title: s.name,
1085
1088
  onClick: o[0] || (o[0] = (a) => t("update:modelValue", !s.modelValue))
@@ -1098,23 +1101,23 @@ const cs = /* @__PURE__ */ S(ds, [["render", us]]), ps = ["id", "data-node-type"
1098
1101
  })
1099
1102
  ])
1100
1103
  ], -1)),
1101
- s.name ? (i(), r("div", xs, E(s.name), 1)) : I("", !0)
1102
- ], 10, ks));
1104
+ s.name ? (i(), r("div", ks, E(s.name), 1)) : N("", !0)
1105
+ ], 10, Cs));
1103
1106
  }
1104
1107
  }), Is = { class: "__header" }, Ms = { class: "__node-name" }, Os = { style: { display: "flex" } }, $s = {
1105
1108
  key: 1,
1106
1109
  class: "__interface"
1107
1110
  }, Ts = /* @__PURE__ */ j({
1108
1111
  __name: "CodeGraphSidebar",
1109
- setup(n) {
1110
- const { viewModel: e } = F(), { graph: t } = K(), s = O(null), o = Ie(e.value.settings.sidebar, "width"), a = b(() => e.value.settings.sidebar.resizable);
1112
+ setup(s) {
1113
+ const { viewModel: e } = F(), { graph: t } = ee(), n = O(null), o = Ie(e.value.settings.sidebar, "width"), a = b(() => e.value.settings.sidebar.resizable);
1111
1114
  let u = 0, l = 0;
1112
1115
  const v = b(() => {
1113
1116
  const h = t.value.sidebar.nodeId;
1114
1117
  return t.value.nodes.find((p) => p.id === h);
1115
- }), _ = b(() => v.value), y = b(() => ({
1118
+ }), y = b(() => v.value), _ = b(() => ({
1116
1119
  width: `${o.value}px`
1117
- })), x = b(() => _.value ? [...Object.values(_.value.inputs), ...Object.values(_.value.outputs)].filter((p) => p.displayInSidebar && p.component) : []), B = () => {
1120
+ })), M = b(() => y.value ? [...Object.values(y.value.inputs), ...Object.values(y.value.outputs)].filter((p) => p.displayInSidebar && p.component) : []), B = () => {
1118
1121
  t.value.sidebar.visible = !1;
1119
1122
  }, w = () => {
1120
1123
  v.value?.events.update.emit(null);
@@ -1127,21 +1130,21 @@ const cs = /* @__PURE__ */ S(ds, [["render", us]]), ps = ["id", "data-node-type"
1127
1130
  { once: !0 }
1128
1131
  );
1129
1132
  }, f = (h) => {
1130
- const p = s.value?.parentElement?.getBoundingClientRect().width ?? 500, C = h.clientX - l;
1131
- let M = u - C;
1132
- M < 300 ? M = 300 : M > 0.9 * p && (M = 0.9 * p), o.value = M;
1133
+ const p = n.value?.parentElement?.getBoundingClientRect().width ?? 500, x = h.clientX - l;
1134
+ let I = u - x;
1135
+ I < 300 ? I = 300 : I > 0.9 * p && (I = 0.9 * p), o.value = I;
1133
1136
  };
1134
1137
  return (h, p) => (i(), r("div", {
1135
1138
  ref_key: "el",
1136
- ref: s,
1137
- class: U(["baklava-sidebar", { "--open": k(t).sidebar.visible }]),
1138
- style: se(y.value)
1139
+ ref: n,
1140
+ class: U(["baklava-sidebar", { "--open": C(t).sidebar.visible }]),
1141
+ style: ne(_.value)
1139
1142
  }, [
1140
1143
  a.value ? (i(), r("div", {
1141
1144
  key: 0,
1142
1145
  class: "__resizer",
1143
1146
  onMousedown: m
1144
- }, null, 32)) : I("", !0),
1147
+ }, null, 32)) : N("", !0),
1145
1148
  d("div", Is, [
1146
1149
  d("button", {
1147
1150
  tabindex: "-1",
@@ -1152,43 +1155,43 @@ const cs = /* @__PURE__ */ S(ds, [["render", us]]), ps = ["id", "data-node-type"
1152
1155
  d("b", null, E(v.value ? v.value.title : ""), 1)
1153
1156
  ])
1154
1157
  ]),
1155
- (i(!0), r($, null, A(x.value, (C) => (i(), r("div", {
1156
- key: C.id,
1158
+ (i(!0), r($, null, H(M.value, (x) => (i(), r("div", {
1159
+ key: x.id,
1157
1160
  class: "__interface"
1158
1161
  }, [
1159
1162
  d("div", Os, [
1160
1163
  T(Ns, {
1161
- modelValue: C.hidden,
1164
+ modelValue: x.hidden,
1162
1165
  "onUpdate:modelValue": [
1163
- (M) => C.hidden = M,
1166
+ (I) => x.hidden = I,
1164
1167
  p[0] || (p[0] = () => v.value?.events.update.emit(null))
1165
1168
  ],
1166
- disabled: !C.optional,
1169
+ disabled: !x.optional,
1167
1170
  inversed: "",
1168
- style: { "margin-right": "8px" }
1171
+ style: { "padding-right": "8px" }
1169
1172
  }, null, 8, ["modelValue", "onUpdate:modelValue", "disabled"]),
1170
- (i(), V(ut(C.component), {
1171
- modelValue: C.value,
1172
- "onUpdate:modelValue": (M) => C.value = M,
1173
+ (i(), V(ut(x.component), {
1174
+ modelValue: x.value,
1175
+ "onUpdate:modelValue": (I) => x.value = I,
1173
1176
  node: v.value,
1174
- intf: C,
1177
+ intf: x,
1175
1178
  style: { width: "100%" }
1176
1179
  }, null, 8, ["modelValue", "onUpdate:modelValue", "node", "intf"]))
1177
1180
  ])
1178
1181
  ]))), 128)),
1179
- _.value && _.value.state ? (i(), r("div", $s, [
1182
+ y.value && y.value.state ? (i(), r("div", $s, [
1180
1183
  p[2] || (p[2] = d("label", null, "Variable name", -1)),
1181
- ne(d("input", {
1182
- "onUpdate:modelValue": p[1] || (p[1] = (C) => _.value.state.variableName = C),
1184
+ oe(d("input", {
1185
+ "onUpdate:modelValue": p[1] || (p[1] = (x) => y.value.state.variableName = x),
1183
1186
  type: "text",
1184
1187
  class: "baklava-input",
1185
1188
  title: "Variable name",
1186
1189
  onBlur: w,
1187
- onKeydown: Q(w, ["enter"])
1190
+ onKeydown: K(w, ["enter"])
1188
1191
  }, null, 544), [
1189
- [oe, _.value.state.variableName]
1192
+ [ae, y.value.state.variableName]
1190
1193
  ])
1191
- ])) : I("", !0)
1194
+ ])) : N("", !0)
1192
1195
  ], 6));
1193
1196
  }
1194
1197
  }), Es = j({
@@ -1202,38 +1205,38 @@ const cs = /* @__PURE__ */ S(ds, [["render", us]]), ps = ["id", "data-node-type"
1202
1205
  required: !0
1203
1206
  }
1204
1207
  },
1205
- setup(n) {
1206
- const { viewModel: e } = F(), { switchGraph: t } = K(), s = O(!1), o = b(() => n.type.startsWith(q));
1207
- return { showContextMenu: s, hasContextMenu: o, contextMenuItems: [
1208
+ setup(s) {
1209
+ const { viewModel: e } = F(), { switchGraph: t } = ee(), n = O(!1), o = b(() => s.type.startsWith(J));
1210
+ return { showContextMenu: n, hasContextMenu: o, contextMenuItems: [
1208
1211
  { label: "Edit Subgraph", value: "editSubgraph" },
1209
1212
  { label: "Delete Subgraph", value: "deleteSubgraph" }
1210
1213
  ], openContextMenu: () => {
1211
- s.value = !0;
1214
+ n.value = !0;
1212
1215
  }, onContextMenuClick: (v) => {
1213
- const _ = n.type.substring(q.length), y = e.value.editor.graphTemplates.find((x) => x.id === _);
1214
- if (y)
1216
+ const y = s.type.substring(J.length), _ = e.value.editor.graphTemplates.find((M) => M.id === y);
1217
+ if (_)
1215
1218
  switch (v) {
1216
1219
  case "editSubgraph":
1217
- t(y);
1220
+ t(_);
1218
1221
  break;
1219
1222
  case "deleteSubgraph":
1220
- e.value.editor.removeGraphTemplate(y);
1223
+ e.value.editor.removeGraphTemplate(_);
1221
1224
  break;
1222
1225
  }
1223
1226
  } };
1224
1227
  }
1225
- }), zs = ["data-node-type"], Ss = { class: "__title" }, Bs = { class: "__title-label" };
1226
- function Ls(n, e, t, s, o, a) {
1228
+ }), Ss = ["data-node-type"], zs = { class: "__title" }, Bs = { class: "__title-label" };
1229
+ function Ls(s, e, t, n, o, a) {
1227
1230
  return i(), r("div", {
1228
1231
  class: "baklava-node --palette",
1229
- "data-node-type": n.type
1232
+ "data-node-type": s.type
1230
1233
  }, [
1231
- d("div", Ss, [
1232
- d("div", Bs, E(n.title), 1)
1234
+ d("div", zs, [
1235
+ d("div", Bs, E(s.title), 1)
1233
1236
  ])
1234
- ], 8, zs);
1237
+ ], 8, Ss);
1235
1238
  }
1236
- const we = /* @__PURE__ */ S(Es, [["render", Ls]]), Vs = {
1239
+ const xe = /* @__PURE__ */ z(Es, [["render", Ls]]), Vs = {
1237
1240
  class: "baklava-node --palette",
1238
1241
  style: { "margin-top": "-20px", "margin-bottom": "20px" }
1239
1242
  }, js = {
@@ -1244,18 +1247,18 @@ const we = /* @__PURE__ */ S(Es, [["render", Ls]]), Vs = {
1244
1247
  style: { margin: "auto 0", "font-size": "12px" }
1245
1248
  }, Rs = /* @__PURE__ */ j({
1246
1249
  __name: "CodeNodePalette",
1247
- setup(n) {
1248
- const { viewModel: e } = F(), { x: t, y: s } = _t(), { transform: o } = et(), a = tt(e), u = ct("editorEl"), l = O(""), v = O(null), _ = () => l.value ? a.value.filter(
1250
+ setup(s) {
1251
+ const { viewModel: e } = F(), { x: t, y: n } = yt(), { transform: o } = et(), a = tt(e), u = ct("editorEl"), l = O(""), v = O(null), y = () => l.value ? a.value.filter(
1249
1252
  (w) => w.name.toLowerCase().includes(l.value.toLowerCase()) || Object.values(w.nodeTypes).some(
1250
1253
  (m) => m.title.toLowerCase().includes(l.value.toLowerCase())
1251
1254
  )
1252
- ) : a.value, y = (w) => l.value ? Object.values(w).filter(
1255
+ ) : a.value, _ = (w) => l.value ? Object.values(w).filter(
1253
1256
  (m) => m.category.toLowerCase().includes(l.value.toLowerCase()) || m.title.toLowerCase().includes(l.value.toLowerCase())
1254
- ) : Object.values(w), x = b(() => {
1257
+ ) : Object.values(w), M = b(() => {
1255
1258
  if (!v.value || !u?.value) return {};
1256
1259
  const { left: w, top: m } = u.value.getBoundingClientRect();
1257
1260
  return {
1258
- top: `${s.value - m}px`,
1261
+ top: `${n.value - m}px`,
1259
1262
  left: `${t.value - w}px`
1260
1263
  };
1261
1264
  }), B = (w, m) => {
@@ -1266,29 +1269,29 @@ const we = /* @__PURE__ */ S(Es, [["render", Ls]]), Vs = {
1266
1269
  const f = () => {
1267
1270
  const h = G(new m.type());
1268
1271
  e.value.displayedGraph.addNode(h);
1269
- const p = u.value.getBoundingClientRect(), [C, M] = o(t.value - p.left, s.value - p.top);
1270
- h.position.x = C, h.position.y = M, v.value = null, document.removeEventListener("pointerup", f);
1272
+ const p = u.value.getBoundingClientRect(), [x, I] = o(t.value - p.left, n.value - p.top);
1273
+ h.position.x = x, h.position.y = I, v.value = null, document.removeEventListener("pointerup", f);
1271
1274
  };
1272
1275
  document.addEventListener("pointerup", f);
1273
1276
  };
1274
1277
  return (w, m) => (i(), r($, null, [
1275
1278
  d("div", {
1276
- class: U(["baklava-node-palette", { "--open": k(e).settings.palette.enabled }]),
1279
+ class: U(["baklava-node-palette", { "--open": C(e).settings.palette.enabled }]),
1277
1280
  onContextmenu: m[1] || (m[1] = P(() => {
1278
1281
  }, ["stop", "prevent"]))
1279
1282
  }, [
1280
1283
  d("div", Vs, [
1281
- ne(d("input", {
1284
+ oe(d("input", {
1282
1285
  "onUpdate:modelValue": m[0] || (m[0] = (f) => l.value = f),
1283
1286
  type: "text",
1284
1287
  class: "baklava-input",
1285
1288
  title: "Filter nodes",
1286
- onKeyup: _
1289
+ onKeyup: y
1287
1290
  }, null, 544), [
1288
- [oe, l.value]
1291
+ [ae, l.value]
1289
1292
  ])
1290
1293
  ]),
1291
- (i(!0), r($, null, A(_(), (f) => (i(), r("section", {
1294
+ (i(!0), r($, null, H(y(), (f) => (i(), r("section", {
1292
1295
  key: f.name
1293
1296
  }, [
1294
1297
  f.name !== "default" ? (i(), r("h3", js, [
@@ -1296,9 +1299,9 @@ const we = /* @__PURE__ */ S(Es, [["render", Ls]]), Vs = {
1296
1299
  onClick: (h) => l.value = f.name,
1297
1300
  style: { cursor: "pointer" }
1298
1301
  }, E(f.name), 9, Us),
1299
- y(f.nodeTypes).length < Object.values(f.nodeTypes).length ? (i(), r("div", Gs, " ( " + E(y(f.nodeTypes).length) + " / " + E(Object.values(f.nodeTypes).length) + " ) ", 1)) : I("", !0)
1300
- ])) : I("", !0),
1301
- (i(!0), r($, null, A(y(f.nodeTypes), (h) => (i(), V(we, {
1302
+ _(f.nodeTypes).length < Object.values(f.nodeTypes).length ? (i(), r("div", Gs, " ( " + E(_(f.nodeTypes).length) + " / " + E(Object.values(f.nodeTypes).length) + " ) ", 1)) : N("", !0)
1303
+ ])) : N("", !0),
1304
+ (i(!0), r($, null, H(_(f.nodeTypes), (h) => (i(), V(xe, {
1302
1305
  key: h.type,
1303
1306
  type: h.type,
1304
1307
  title: h.title,
@@ -1311,13 +1314,13 @@ const we = /* @__PURE__ */ S(Es, [["render", Ls]]), Vs = {
1311
1314
  v.value ? (i(), r("div", {
1312
1315
  key: 0,
1313
1316
  class: "baklava-dragged-node",
1314
- style: se(x.value)
1317
+ style: ne(M.value)
1315
1318
  }, [
1316
- T(we, {
1319
+ T(xe, {
1317
1320
  type: v.value.type,
1318
1321
  title: v.value.nodeInformation.title
1319
1322
  }, null, 8, ["type", "title"])
1320
- ], 4)) : I("", !0)
1323
+ ], 4)) : N("", !0)
1321
1324
  ]),
1322
1325
  _: 1
1323
1326
  })
@@ -1328,19 +1331,19 @@ const we = /* @__PURE__ */ S(Es, [["render", Ls]]), Vs = {
1328
1331
  props: {
1329
1332
  viewModel: {}
1330
1333
  },
1331
- setup(n) {
1332
- const t = Ie(n, "viewModel"), s = (o) => o.events.update.emit(null);
1333
- return ee(() => {
1334
+ setup(s) {
1335
+ const t = Ie(s, "viewModel"), n = (o) => o.events.update.emit(null);
1336
+ return te(() => {
1334
1337
  t.value.subscribe(), t.value.engine.start();
1335
1338
  }), ht(() => {
1336
1339
  t.value.unsubscribe(), t.value.engine.stop();
1337
- }), (o, a) => (i(), V(k(st), { "view-model": t.value }, {
1340
+ }), (o, a) => (i(), V(C(st), { "view-model": t.value }, {
1338
1341
  palette: X(() => [
1339
1342
  T(Rs)
1340
1343
  ]),
1341
1344
  node: X((u) => [
1342
- T(Cs, ft(u, {
1343
- onUpdate: (l) => s(u.node)
1345
+ T(xs, ft(u, {
1346
+ onUpdate: (l) => n(u.node)
1344
1347
  }), null, 16, ["onUpdate"])
1345
1348
  ]),
1346
1349
  sidebar: X((u) => [
@@ -1349,27 +1352,27 @@ const we = /* @__PURE__ */ S(Es, [["render", Ls]]), Vs = {
1349
1352
  _: 1
1350
1353
  }, 8, ["view-model"]));
1351
1354
  }
1352
- }), Ds = (n) => {
1355
+ }), Ds = (s) => {
1353
1356
  const e = "TOGGLE_PALETTE";
1354
- n.commandHandler.registerCommand(e, {
1355
- execute: () => n.settings.palette.enabled = !n.settings.palette.enabled,
1357
+ s.commandHandler.registerCommand(e, {
1358
+ execute: () => s.settings.palette.enabled = !s.settings.palette.enabled,
1356
1359
  canExecute: () => !0
1357
1360
  });
1358
1361
  const t = "CLEAR_ALL";
1359
- n.commandHandler.registerCommand(t, {
1360
- execute: () => n.code.clear(),
1361
- canExecute: () => n.displayedGraph.nodes.length > 0
1362
+ s.commandHandler.registerCommand(t, {
1363
+ execute: () => s.code.clear(),
1364
+ canExecute: () => s.displayedGraph.nodes.length > 0
1362
1365
  });
1363
- const s = "TOGGLE_MINIMAP";
1364
- n.commandHandler.registerCommand(s, {
1365
- execute: () => n.settings.enableMinimap = !n.settings.enableMinimap,
1366
- canExecute: () => n.displayedGraph.nodes.length > 1
1367
- }), n.settings.toolbar.commands = [
1366
+ const n = "TOGGLE_MINIMAP";
1367
+ s.commandHandler.registerCommand(n, {
1368
+ execute: () => s.settings.enableMinimap = !s.settings.enableMinimap,
1369
+ canExecute: () => s.displayedGraph.nodes.length > 1
1370
+ }), s.settings.toolbar.commands = [
1368
1371
  {
1369
1372
  command: e,
1370
1373
  title: "Toggle palette",
1371
1374
  // Tooltip text
1372
- icon: b(() => n.settings.palette.enabled ? St : jt)
1375
+ icon: b(() => s.settings.palette.enabled ? zt : jt)
1373
1376
  },
1374
1377
  ...nt,
1375
1378
  {
@@ -1379,10 +1382,10 @@ const we = /* @__PURE__ */ S(Es, [["render", Ls]]), Vs = {
1379
1382
  icon: rs
1380
1383
  },
1381
1384
  {
1382
- command: s,
1385
+ command: n,
1383
1386
  title: "Toggle minimap",
1384
1387
  // Tooltip text
1385
- icon: b(() => n.settings.enableMinimap ? ns : Kt)
1388
+ icon: b(() => s.settings.enableMinimap ? ns : Zt)
1386
1389
  }
1387
1390
  ];
1388
1391
  }, W = {
@@ -1400,74 +1403,74 @@ const we = /* @__PURE__ */ S(Es, [["render", Ls]]), Vs = {
1400
1403
  },
1401
1404
  displayValueOnHover: !1
1402
1405
  };
1403
- function cn(n) {
1404
- const e = ot(n?.existingEditor);
1405
- e.code = n?.code ? new n.code(e) : new Mt(e), Ds(e);
1406
+ function cn(s) {
1407
+ const e = ot(s?.existingEditor);
1408
+ e.code = s?.code ? new s.code(e) : new Mt(e), Ds(e);
1406
1409
  const t = {};
1407
- return Object.keys(W).forEach((s) => {
1408
- t[s] = typeof W[s] == "object" ? { ...e.settings[s], ...W[s] } : W[s];
1410
+ return Object.keys(W).forEach((n) => {
1411
+ t[n] = typeof W[n] == "object" ? { ...e.settings[n], ...W[n] } : W[n];
1409
1412
  }), e.settings = G({ ...e.settings, ...t }), e.settings.nodes.defaultWidth = 350, e.state = G({
1410
1413
  modules: {},
1411
1414
  token: null
1412
1415
  }), e.engine = new at(e.editor), e.subscribe = () => {
1413
1416
  e.state.token && e.unsubscribe();
1414
- const s = Symbol();
1415
- e.displayedGraph.events.addNode.subscribe(s, (o) => o.code = e.code), e.engine.events.beforeRun.subscribe(s, () => {
1417
+ const n = Symbol();
1418
+ e.displayedGraph.events.addNode.subscribe(n, (o) => o.code = e.code), e.engine.events.beforeRun.subscribe(n, () => {
1416
1419
  e.engine.pause(), e.code && (e.code.onCodeUpdate(), e.code.sortNodes()), e.engine.resume();
1417
- }), e.engine.events.beforeNodeCalculation.subscribe(s, (o) => {
1420
+ }), e.engine.events.beforeNodeCalculation.subscribe(n, (o) => {
1418
1421
  e.engine.pause();
1419
1422
  const a = o.node;
1420
1423
  a.isCodeNode && (a.updateOutputVariableName(), a.updateCodeNodeInputInterfaces()), e.engine.resume();
1421
- }), e.engine.events.afterRun.subscribe(s, (o) => {
1424
+ }), e.engine.events.afterRun.subscribe(n, (o) => {
1422
1425
  e.engine.pause(), it(o, e.editor), e.code && (e.code.renderNodeCodes(), e.code.renderCode()), e.engine.resume();
1423
- }), e.state.token = s;
1426
+ }), e.state.token = n;
1424
1427
  }, e.unsubscribe = () => {
1425
1428
  if (!e.state.token) return;
1426
- const s = e.state.token;
1427
- e.displayedGraph.events.addNode.unsubscribe(s), e.engine.events.beforeRun.unsubscribe(s), e.engine.events.afterRun.unsubscribe(s), e.state.token = null;
1429
+ const n = e.state.token;
1430
+ e.displayedGraph.events.addNode.unsubscribe(n), e.engine.events.beforeRun.unsubscribe(n), e.engine.events.afterRun.unsubscribe(n), e.state.token = null;
1428
1431
  }, e;
1429
1432
  }
1430
1433
  export {
1431
- yt as AbstractCodeNode,
1434
+ _t as AbstractCodeNode,
1432
1435
  Qs as CheckboxInterface,
1433
1436
  vn as CheckboxInterfaceComponent,
1434
1437
  Mt as Code,
1435
1438
  un as CodeGraphEditor,
1436
1439
  Me as CodeNode,
1437
- ie as CodeNodeInputInterface,
1440
+ re as CodeNodeInputInterface,
1438
1441
  R as CodeNodeInterface,
1439
1442
  Nt as CodeNodeOutputInterface,
1440
1443
  W as DEFAULT_SETTINGS,
1441
1444
  It as DynamicCodeNode,
1442
- Zs as IntegerInterface,
1445
+ Ks as IntegerInterface,
1443
1446
  mn as IntegerInterfaceComponent,
1444
- Ks as NumberInterface,
1447
+ Zs as NumberInterface,
1445
1448
  fn as NumberInterfaceComponent,
1446
1449
  en as SelectInterface,
1447
1450
  gn as SelectInterfaceComponent,
1448
1451
  tn as SliderInterface,
1449
1452
  bn as SliderInterfaceComponent,
1450
1453
  sn as TextInputInterface,
1451
- _n as TextInputInterfaceComponent,
1454
+ yn as TextInputInterfaceComponent,
1452
1455
  nn as TextareaInputInterface,
1453
- yn as TextareaInputInterfaceComponent,
1456
+ _n as TextareaInputInterfaceComponent,
1454
1457
  Js as addDefaultInterfaceTypes,
1455
1458
  Ds as addToolbarCommands,
1456
1459
  $e as booleanType,
1457
1460
  on as defineCodeNode,
1458
1461
  an as defineDynamicCodeNode,
1459
- kt as dictType,
1462
+ Ct as dictType,
1460
1463
  Ys as formatInputs,
1461
1464
  Z as getCodeNodes,
1462
1465
  rn as getPositionAtColumn,
1463
1466
  dn as getPositionBeforeNode,
1464
- xt as listType,
1467
+ kt as listType,
1465
1468
  Oe as loadNodeState,
1466
- H as nodeType,
1467
- re as numberType,
1469
+ A as nodeType,
1470
+ de as numberType,
1468
1471
  wt as saveNodeState,
1469
1472
  qs as setOptional,
1470
- de as stringType,
1473
+ le as stringType,
1471
1474
  ln as transferCodeScript,
1472
1475
  cn as useCodeGraph
1473
1476
  };