@fragiola/flow-angular 0.0.0-stage → 0.0.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,4688 @@
1
+ import { ENGINE_EVENT_CALLBACKS, createFlowEngine, createFlowModel, edgesLayerAttributes, flag, partAttributes, sameFlowValue, staticGeometry, watchKeyPress } from "@fragiola/flow";
2
+ import * as i0 from "@angular/core";
3
+ import { ApplicationRef, ChangeDetectionStrategy, Component, DestroyRef, Directive, ElementRef, EnvironmentInjector, ErrorHandler, InjectionToken, Injector, TemplateRef, ViewContainerRef, afterEveryRender, afterNextRender, afterRenderEffect, computed, createComponent, effect, inject, input, isSignal, output, runInInjectionContext, signal, untracked } from "@angular/core";
4
+ export * from "@fragiola/flow";
5
+ const FLOW_CONTEXT = new InjectionToken("Flow");
6
+ const FLOW_NODE = new InjectionToken("FlowNode");
7
+ const FLOW_EDGE = new InjectionToken("FlowEdge");
8
+ const FLOW_EDGE_LABEL_LAYER = new InjectionToken("FlowEdgeLabelLayer");
9
+ function injectFlowContext(part) {
10
+ const context = inject(FLOW_CONTEXT, { optional: true });
11
+ if (!context) throw new Error(`${part} must be used inside [flowRoot]`);
12
+ return context;
13
+ }
14
+ function injectNodeContext() {
15
+ return inject(FLOW_NODE, { optional: true });
16
+ }
17
+ function injectEdgeContext() {
18
+ return inject(FLOW_EDGE, { optional: true });
19
+ }
20
+ function eraseModel(model) {
21
+ return model;
22
+ }
23
+ function typedModel(model) {
24
+ return model;
25
+ }
26
+ function typedEngine(engine) {
27
+ return engine;
28
+ }
29
+ const entityKey = (entity) => `${entity.kind}\u0000${entity.id}`;
30
+ function createFlowStore() {
31
+ const view = signal(0, ...ngDevMode ? [{ debugName: "view" }] : /* istanbul ignore next */ []);
32
+ const entity = signal(0, ...ngDevMode ? [{ debugName: "entity" }] : /* istanbul ignore next */ []);
33
+ const measure = signal(0, ...ngDevMode ? [{ debugName: "measure" }] : /* istanbul ignore next */ []);
34
+ const records = /* @__PURE__ */ new Map();
35
+ let engine = null;
36
+ const tokenOf = ({ kind, id }) => untracked(() => !engine ? [] : kind === "node" ? [engine.get("node-rect-by", { nodeId: id }), engine.is("node-measured", { nodeId: id })] : [engine.get("edge-path-by", { edgeId: id })]);
37
+ const bump = (counter) => counter.update((value) => value + 1);
38
+ const tell = (kind) => {
39
+ bump(view);
40
+ if (kind === "view") return;
41
+ if (kind === "entity") {
42
+ for (const record of records.values()) record.token = void 0;
43
+ bump(entity);
44
+ return;
45
+ }
46
+ bump(measure);
47
+ for (const record of records.values()) {
48
+ const token = tokenOf(record.entity);
49
+ const was = record.token;
50
+ if (was !== void 0 && token.length === was.length && token.every((value, i) => Object.is(value, was[i]))) continue;
51
+ record.token = token;
52
+ bump(record.counter);
53
+ }
54
+ };
55
+ let last = {
56
+ model: void 0,
57
+ nodes: void 0,
58
+ edges: void 0
59
+ };
60
+ const measured = measure.asReadonly();
61
+ return {
62
+ view: view.asReadonly(),
63
+ entity: entity.asReadonly(),
64
+ measure: measured,
65
+ counterOf: (of) => records.get(entityKey(of))?.counter ?? measured,
66
+ acquire(of) {
67
+ const key = entityKey(of);
68
+ let record = records.get(key);
69
+ if (!record) {
70
+ record = {
71
+ entity: {
72
+ kind: of.kind,
73
+ id: of.id
74
+ },
75
+ counter: signal(0),
76
+ readers: 0,
77
+ token: tokenOf(of)
78
+ };
79
+ records.set(key, record);
80
+ }
81
+ const held = record;
82
+ held.readers += 1;
83
+ let released = false;
84
+ return () => {
85
+ if (released) return;
86
+ released = true;
87
+ held.readers -= 1;
88
+ if (held.readers <= 0 && records.get(key) === held) records.delete(key);
89
+ };
90
+ },
91
+ commit(model) {
92
+ const next = untracked(() => ({
93
+ model,
94
+ nodes: model.get("all-nodes"),
95
+ edges: model.get("all-edges")
96
+ }));
97
+ const changed = next.model !== last.model || next.nodes !== last.nodes || next.edges !== last.edges;
98
+ last = next;
99
+ tell(changed ? "entity" : "view");
100
+ },
101
+ attach(created, notified) {
102
+ engine = created;
103
+ for (const record of records.values()) record.token = void 0;
104
+ const layered = () => untracked(() => created.get("render-layers").length > 1);
105
+ let wasLayered = layered();
106
+ const stop = created.adapter.subscribe((change) => {
107
+ const isLayered = layered();
108
+ const levels = isLayered || wasLayered;
109
+ wasLayered = isLayered;
110
+ if (change.gesture || levels) tell("entity");
111
+ else if (change.measured) tell(change.viewport ? "entity" : "measured");
112
+ else tell("view");
113
+ notified();
114
+ });
115
+ return () => {
116
+ stop();
117
+ if (engine === created) engine = null;
118
+ };
119
+ }
120
+ };
121
+ }
122
+ function injectHost() {
123
+ return inject(ElementRef).nativeElement;
124
+ }
125
+ function onDestroy(teardown) {
126
+ inject(DestroyRef).onDestroy(teardown);
127
+ }
128
+ function booleanInput(value) {
129
+ return value === "" || value !== "false" && Boolean(value);
130
+ }
131
+ function optionalBoolean(value) {
132
+ return value === void 0 || value === null ? void 0 : booleanInput(value);
133
+ }
134
+ function optionalNumber(value) {
135
+ if (value === void 0 || value === null || value === "") return void 0;
136
+ const number = typeof value === "number" ? value : Number(value);
137
+ return Number.isNaN(number) ? void 0 : number;
138
+ }
139
+ function beforeInputs(fallback, read) {
140
+ try {
141
+ return read();
142
+ } catch (error) {
143
+ if (error?.code === -950) return fallback;
144
+ throw error;
145
+ }
146
+ }
147
+ const kebab = (key) => key.startsWith("--") ? key : key.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
148
+ function cssEntries(style) {
149
+ const entries = /* @__PURE__ */ new Map();
150
+ for (const [key, value] of Object.entries(style)) if (value !== void 0) entries.set(kebab(key), String(value));
151
+ return entries;
152
+ }
153
+ function px(value) {
154
+ return value === void 0 ? void 0 : `${value}px`;
155
+ }
156
+ function bindStructuralStyle(element, style) {
157
+ const owned = /* @__PURE__ */ new Map();
158
+ let left;
159
+ const write = (name, entry) => {
160
+ element.style.setProperty(name, entry.value);
161
+ entry.written = element.style.getPropertyValue(name);
162
+ };
163
+ const assert = () => {
164
+ const now = element.getAttribute("style");
165
+ if (left !== void 0 && now === left) return;
166
+ for (const [name, entry] of owned) {
167
+ const current = element.style.getPropertyValue(name);
168
+ if (current !== entry.written) {
169
+ entry.previous = current;
170
+ write(name, entry);
171
+ }
172
+ }
173
+ left = element.getAttribute("style");
174
+ };
175
+ effect(() => {
176
+ const next = cssEntries(style());
177
+ untracked(() => {
178
+ assert();
179
+ for (const [name, { previous }] of owned) if (!next.has(name)) {
180
+ if (previous === "") element.style.removeProperty(name);
181
+ else element.style.setProperty(name, previous);
182
+ owned.delete(name);
183
+ }
184
+ for (const [name, value] of next) {
185
+ const entry = owned.get(name);
186
+ if (!entry) {
187
+ const created = {
188
+ value,
189
+ written: "",
190
+ previous: element.style.getPropertyValue(name)
191
+ };
192
+ owned.set(name, created);
193
+ write(name, created);
194
+ } else if (entry.value !== value) {
195
+ entry.value = value;
196
+ write(name, entry);
197
+ }
198
+ }
199
+ left = element.getAttribute("style");
200
+ });
201
+ });
202
+ afterEveryRender({ write: assert });
203
+ }
204
+ function bindBaseStyle(element, style) {
205
+ const written = /* @__PURE__ */ new Map();
206
+ effect(() => {
207
+ const next = cssEntries(style());
208
+ untracked(() => {
209
+ for (const [name, last] of written) {
210
+ if (next.has(name)) continue;
211
+ if (element.style.getPropertyValue(name) === last) element.style.removeProperty(name);
212
+ written.delete(name);
213
+ }
214
+ for (const [name, value] of next) {
215
+ const current = element.style.getPropertyValue(name);
216
+ if (current !== "" && current !== written.get(name)) continue;
217
+ element.style.setProperty(name, value);
218
+ written.set(name, element.style.getPropertyValue(name));
219
+ }
220
+ });
221
+ });
222
+ }
223
+ function bindAttributes(element, attributes) {
224
+ let applied = /* @__PURE__ */ new Set();
225
+ effect(() => {
226
+ const next = attributes();
227
+ untracked(() => {
228
+ const now = /* @__PURE__ */ new Set();
229
+ for (const [name, value] of Object.entries(next)) {
230
+ if (value === void 0) continue;
231
+ if (element.getAttribute(name) !== value) element.setAttribute(name, value);
232
+ now.add(name);
233
+ }
234
+ for (const name of applied) if (!now.has(name)) element.removeAttribute(name);
235
+ applied = now;
236
+ });
237
+ });
238
+ }
239
+ function bindBaseAttributes(element, attributes) {
240
+ const written = /* @__PURE__ */ new Map();
241
+ effect(() => {
242
+ const next = attributes();
243
+ untracked(() => {
244
+ for (const [name, value] of Object.entries(next)) {
245
+ const current = element.getAttribute(name);
246
+ if (current !== null && current !== written.get(name)) {
247
+ written.delete(name);
248
+ continue;
249
+ }
250
+ if (value === void 0) {
251
+ if (current !== null) element.removeAttribute(name);
252
+ written.delete(name);
253
+ continue;
254
+ }
255
+ if (current !== value) element.setAttribute(name, value);
256
+ written.set(name, value);
257
+ }
258
+ });
259
+ });
260
+ }
261
+ function same(a, b) {
262
+ if (Object.is(a, b)) return true;
263
+ if (typeof a !== "object" || typeof b !== "object" || a === null || b === null || Array.isArray(a) !== Array.isArray(b)) return false;
264
+ const aRecord = a;
265
+ const bRecord = b;
266
+ const keys = Object.keys(aRecord);
267
+ return keys.length === Object.keys(bRecord).length && keys.every((key) => Object.hasOwn(bRecord, key) && Object.is(aRecord[key], bRecord[key]));
268
+ }
269
+ function shallowEqual(a, b) {
270
+ if (a === b) return true;
271
+ if (!a || !b) return false;
272
+ const keys = Object.keys(a);
273
+ return keys.length === Object.keys(b).length && keys.every((key) => Object.hasOwn(b, key) && same(a[key], b[key]));
274
+ }
275
+ function sameValue(a, b) {
276
+ if (Object.is(a, b)) return true;
277
+ if (typeof a === "object" && typeof b === "object" && a !== null && b !== null && !Array.isArray(a) && !Array.isArray(b)) return shallowEqual(a, b);
278
+ if (Array.isArray(a) && Array.isArray(b)) return a.length === b.length && a.every((value, i) => Object.is(value, b[i]));
279
+ return false;
280
+ }
281
+ function flowValue(context, read, equal = sameValue, options = {}) {
282
+ const { store } = context;
283
+ const { scope = "view", entity } = options;
284
+ if (scope === "view") return computed(() => {
285
+ store.view();
286
+ return read();
287
+ }, { equal });
288
+ let held;
289
+ let destroyed = false;
290
+ if (entity) inject(DestroyRef).onDestroy(() => {
291
+ destroyed = true;
292
+ held?.release();
293
+ held = void 0;
294
+ });
295
+ return computed(() => {
296
+ store.entity();
297
+ const of = entity?.();
298
+ if (of && !destroyed) {
299
+ const key = entityKey(of);
300
+ if (held?.key !== key) {
301
+ held?.release();
302
+ held = {
303
+ key,
304
+ release: untracked(() => store.acquire(of))
305
+ };
306
+ }
307
+ store.counterOf(of)();
308
+ } else {
309
+ held?.release();
310
+ held = void 0;
311
+ store.measure();
312
+ }
313
+ return read();
314
+ }, { equal });
315
+ }
316
+ function entityOf(kind, id) {
317
+ return () => {
318
+ const current = id();
319
+ return current === void 0 ? void 0 : {
320
+ kind,
321
+ id: current
322
+ };
323
+ };
324
+ }
325
+ function valueNow(value) {
326
+ return isSignal(value) || typeof value === "function" ? beforeInputs(void 0, value) : value;
327
+ }
328
+ function partOwnerId(part, own, around, kind, needed = () => true) {
329
+ const id = computed(() => {
330
+ const given = beforeInputs(void 0, own);
331
+ if (given !== void 0) return given;
332
+ if (!around) return void 0;
333
+ return "nodeId" in around ? around.nodeId() : around.edgeId();
334
+ }, ...ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []);
335
+ afterNextRender(() => {
336
+ if (id() === void 0 && needed()) throw new Error(`${part} must be used inside ${kind === "node" ? "[flowNode]" : "[flowEdge]"} (or be given a ${kind === "node" ? "nodeId" : "edgeId"})`);
337
+ });
338
+ return id;
339
+ }
340
+ const SVG$3 = "http://www.w3.org/2000/svg";
341
+ const ATTRIBUTES$4 = partAttributes("background");
342
+ const EMPTY_PATTERN = Object.freeze({
343
+ variant: "dots",
344
+ x: 0,
345
+ y: 0,
346
+ width: 0,
347
+ height: 0,
348
+ dot: void 0,
349
+ path: void 0,
350
+ strokeWidth: 0
351
+ });
352
+ let nextId = 0;
353
+ function set(element, attributes) {
354
+ for (const [name, value] of Object.entries(attributes)) {
355
+ const text = String(value);
356
+ if (element.getAttribute(name) !== text) element.setAttribute(name, text);
357
+ }
358
+ }
359
+ var FlowBackgroundDirective = class FlowBackgroundDirective {
360
+ constructor() {
361
+ this.variant = input(void 0, ...ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []);
362
+ this.gap = input(void 0, ...ngDevMode ? [{ debugName: "gap" }] : /* istanbul ignore next */ []);
363
+ this.size = input(void 0, {
364
+ ...ngDevMode ? { debugName: "size" } : /* istanbul ignore next */ {},
365
+ transform: optionalNumber
366
+ });
367
+ this.offset = input(void 0, ...ngDevMode ? [{ debugName: "offset" }] : /* istanbul ignore next */ []);
368
+ this.context = injectFlowContext("[flowBackground]");
369
+ this.pattern = flowValue(this.context, () => this.context.engine()?.get("background-pattern", {
370
+ variant: this.variant(),
371
+ gap: this.gap(),
372
+ size: this.size(),
373
+ offset: this.offset()
374
+ }));
375
+ this.state = computed(() => ({ pattern: this.pattern() ?? EMPTY_PATTERN }), ...ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []);
376
+ const host = injectHost();
377
+ bindAttributes(host, () => ATTRIBUTES$4);
378
+ bindStructuralStyle(host, () => ({
379
+ position: "absolute",
380
+ top: 0,
381
+ left: 0,
382
+ width: "100%",
383
+ height: "100%",
384
+ pointerEvents: "none"
385
+ }));
386
+ const document = host.ownerDocument;
387
+ const id = `flow-background-${nextId++}`;
388
+ const pattern = document.createElementNS(SVG$3, "pattern");
389
+ set(pattern, {
390
+ "data-flow-part": "background-pattern",
391
+ id,
392
+ patternUnits: "userSpaceOnUse"
393
+ });
394
+ const fill = document.createElementNS(SVG$3, "rect");
395
+ set(fill, {
396
+ "data-flow-part": "background-fill",
397
+ width: "100%",
398
+ height: "100%",
399
+ fill: `url(#${id})`
400
+ });
401
+ let mark;
402
+ effect(() => {
403
+ const tile = this.pattern();
404
+ untracked(() => {
405
+ if (!tile) {
406
+ pattern.remove();
407
+ fill.remove();
408
+ return;
409
+ }
410
+ set(pattern, {
411
+ x: tile.x,
412
+ y: tile.y,
413
+ width: tile.width,
414
+ height: tile.height
415
+ });
416
+ const tag = tile.dot ? "circle" : "path";
417
+ if (mark?.tagName !== tag) {
418
+ mark?.remove();
419
+ mark = document.createElementNS(SVG$3, tag);
420
+ mark.setAttribute("data-flow-part", "background-mark");
421
+ pattern.append(mark);
422
+ }
423
+ if (tile.dot) set(mark, {
424
+ cx: tile.dot.cx,
425
+ cy: tile.dot.cy,
426
+ r: tile.dot.r,
427
+ fill: "currentColor"
428
+ });
429
+ else set(mark, {
430
+ d: tile.path ?? "",
431
+ fill: "none",
432
+ stroke: "currentColor",
433
+ "stroke-width": tile.strokeWidth
434
+ });
435
+ if (!pattern.parentNode) host.append(pattern, fill);
436
+ });
437
+ });
438
+ onDestroy(() => {
439
+ pattern.remove();
440
+ fill.remove();
441
+ });
442
+ }
443
+ static {
444
+ this.ɵfac = i0.ɵɵngDeclareFactory({
445
+ minVersion: "12.0.0",
446
+ version: "22.2.5",
447
+ ngImport: i0,
448
+ type: FlowBackgroundDirective,
449
+ deps: [],
450
+ target: i0.ɵɵFactoryTarget.Directive
451
+ });
452
+ }
453
+ static {
454
+ this.ɵdir = i0.ɵɵngDeclareDirective({
455
+ minVersion: "17.1.0",
456
+ version: "22.2.5",
457
+ type: FlowBackgroundDirective,
458
+ isStandalone: true,
459
+ selector: "[flowBackground]",
460
+ inputs: {
461
+ variant: {
462
+ classPropertyName: "variant",
463
+ publicName: "variant",
464
+ isSignal: true,
465
+ isRequired: false,
466
+ transformFunction: null
467
+ },
468
+ gap: {
469
+ classPropertyName: "gap",
470
+ publicName: "gap",
471
+ isSignal: true,
472
+ isRequired: false,
473
+ transformFunction: null
474
+ },
475
+ size: {
476
+ classPropertyName: "size",
477
+ publicName: "size",
478
+ isSignal: true,
479
+ isRequired: false,
480
+ transformFunction: null
481
+ },
482
+ offset: {
483
+ classPropertyName: "offset",
484
+ publicName: "offset",
485
+ isSignal: true,
486
+ isRequired: false,
487
+ transformFunction: null
488
+ }
489
+ },
490
+ exportAs: ["flowBackground"],
491
+ ngImport: i0
492
+ });
493
+ }
494
+ };
495
+ i0.ɵɵngDeclareClassMetadata({
496
+ minVersion: "12.0.0",
497
+ version: "22.2.5",
498
+ ngImport: i0,
499
+ type: FlowBackgroundDirective,
500
+ decorators: [{
501
+ type: Directive,
502
+ args: [{
503
+ selector: "[flowBackground]",
504
+ exportAs: "flowBackground"
505
+ }]
506
+ }],
507
+ ctorParameters: () => [],
508
+ propDecorators: {
509
+ variant: [{
510
+ type: i0.Input,
511
+ args: [{
512
+ isSignal: true,
513
+ alias: "variant",
514
+ required: false
515
+ }]
516
+ }],
517
+ gap: [{
518
+ type: i0.Input,
519
+ args: [{
520
+ isSignal: true,
521
+ alias: "gap",
522
+ required: false
523
+ }]
524
+ }],
525
+ size: [{
526
+ type: i0.Input,
527
+ args: [{
528
+ isSignal: true,
529
+ alias: "size",
530
+ required: false
531
+ }]
532
+ }],
533
+ offset: [{
534
+ type: i0.Input,
535
+ args: [{
536
+ isSignal: true,
537
+ alias: "offset",
538
+ required: false
539
+ }]
540
+ }]
541
+ }
542
+ });
543
+ function sameConnection(a, b) {
544
+ return a === b || a !== null && b !== null && a.path === b.path && a.status === b.status && a.to === b.to && a.from === b.from && a.toSide === b.toSide;
545
+ }
546
+ function injectConnection() {
547
+ const context = injectFlowContext("injectConnection");
548
+ return flowValue(context, () => context.engine()?.get("connection") ?? null, sameConnection);
549
+ }
550
+ const PLACEHOLDER = "flow-part";
551
+ function bindPresence(element, where) {
552
+ let placeholder;
553
+ const leave = () => {
554
+ if (placeholder?.parentNode) return;
555
+ placeholder ??= element.ownerDocument.createComment(PLACEHOLDER);
556
+ element.before(placeholder);
557
+ };
558
+ effect(() => {
559
+ const next = where();
560
+ untracked(() => {
561
+ if (next === "here") {
562
+ if (placeholder?.parentNode) placeholder.replaceWith(element);
563
+ return;
564
+ }
565
+ if (!placeholder?.parentNode && element.parentNode) leave();
566
+ if (next === null) element.remove();
567
+ else if (element.parentNode !== next) next.append(element);
568
+ });
569
+ });
570
+ onDestroy(() => {
571
+ if (placeholder?.parentNode) {
572
+ placeholder.remove();
573
+ element.remove();
574
+ }
575
+ });
576
+ }
577
+ function defaultContent(element, create) {
578
+ const injector = inject(Injector);
579
+ let added = [];
580
+ afterNextRender(() => {
581
+ if ([...element.childNodes].some((node) => node.nodeType === node.ELEMENT_NODE || node.nodeType === node.COMMENT_NODE && node.nodeValue === "flow-part")) return;
582
+ added = runInInjectionContext(injector, () => create(element.ownerDocument));
583
+ element.append(...added);
584
+ });
585
+ onDestroy(() => {
586
+ for (const child of added) child.remove();
587
+ });
588
+ }
589
+ const SVG$2 = "http://www.w3.org/2000/svg";
590
+ var FlowConnectionLineDirective = class FlowConnectionLineDirective {
591
+ constructor() {
592
+ this.context = injectFlowContext("[flowConnectionLine]");
593
+ this.connection = injectConnection();
594
+ this.attributes = flowValue(this.context, () => this.context.engine()?.adapter.attributes("connection-line") ?? {});
595
+ this.state = computed(() => {
596
+ const connection = this.connection();
597
+ if (!connection) return null;
598
+ const attributes = this.attributes();
599
+ return {
600
+ connection,
601
+ valid: attributes["data-valid"] !== void 0,
602
+ invalid: attributes["data-invalid"] !== void 0
603
+ };
604
+ }, ...ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []);
605
+ const host = injectHost();
606
+ bindAttributes(host, () => ({
607
+ ...this.attributes(),
608
+ "data-flow-part": "connection-line"
609
+ }));
610
+ bindStructuralStyle(host, () => ({
611
+ position: "absolute",
612
+ top: 0,
613
+ left: 0,
614
+ width: "100%",
615
+ height: "100%",
616
+ overflow: "visible",
617
+ pointerEvents: "none"
618
+ }));
619
+ bindPresence(host, () => this.connection() ? "here" : null);
620
+ defaultContent(host, (document) => {
621
+ const path = document.createElementNS(SVG$2, "path");
622
+ path.setAttribute("data-flow-part", "connection-path");
623
+ bindBaseAttributes(path, () => ({
624
+ d: this.connection()?.path,
625
+ fill: "none"
626
+ }));
627
+ return [path];
628
+ });
629
+ }
630
+ static {
631
+ this.ɵfac = i0.ɵɵngDeclareFactory({
632
+ minVersion: "12.0.0",
633
+ version: "22.2.5",
634
+ ngImport: i0,
635
+ type: FlowConnectionLineDirective,
636
+ deps: [],
637
+ target: i0.ɵɵFactoryTarget.Directive
638
+ });
639
+ }
640
+ static {
641
+ this.ɵdir = i0.ɵɵngDeclareDirective({
642
+ minVersion: "14.0.0",
643
+ version: "22.2.5",
644
+ type: FlowConnectionLineDirective,
645
+ isStandalone: true,
646
+ selector: "[flowConnectionLine]",
647
+ exportAs: ["flowConnectionLine"],
648
+ ngImport: i0
649
+ });
650
+ }
651
+ };
652
+ i0.ɵɵngDeclareClassMetadata({
653
+ minVersion: "12.0.0",
654
+ version: "22.2.5",
655
+ ngImport: i0,
656
+ type: FlowConnectionLineDirective,
657
+ decorators: [{
658
+ type: Directive,
659
+ args: [{
660
+ selector: "[flowConnectionLine]",
661
+ exportAs: "flowConnectionLine"
662
+ }]
663
+ }],
664
+ ctorParameters: () => []
665
+ });
666
+ const ATTRIBUTES$3 = partAttributes("controls");
667
+ var FlowControlsDirective = class FlowControlsDirective {
668
+ constructor() {
669
+ this.state = signal({}).asReadonly();
670
+ bindAttributes(injectHost(), () => ATTRIBUTES$3);
671
+ }
672
+ static {
673
+ this.ɵfac = i0.ɵɵngDeclareFactory({
674
+ minVersion: "12.0.0",
675
+ version: "22.2.5",
676
+ ngImport: i0,
677
+ type: FlowControlsDirective,
678
+ deps: [],
679
+ target: i0.ɵɵFactoryTarget.Directive
680
+ });
681
+ }
682
+ static {
683
+ this.ɵdir = i0.ɵɵngDeclareDirective({
684
+ minVersion: "14.0.0",
685
+ version: "22.2.5",
686
+ type: FlowControlsDirective,
687
+ isStandalone: true,
688
+ selector: "[flowControls]",
689
+ exportAs: ["flowControls"],
690
+ ngImport: i0
691
+ });
692
+ }
693
+ };
694
+ i0.ɵɵngDeclareClassMetadata({
695
+ minVersion: "12.0.0",
696
+ version: "22.2.5",
697
+ ngImport: i0,
698
+ type: FlowControlsDirective,
699
+ decorators: [{
700
+ type: Directive,
701
+ args: [{
702
+ selector: "[flowControls]",
703
+ exportAs: "flowControls"
704
+ }]
705
+ }],
706
+ ctorParameters: () => []
707
+ });
708
+ function sameEdgePath(a, b) {
709
+ if (a === b) return true;
710
+ if (!a || !b) return false;
711
+ return a.path === b.path && a.sourceSide === b.sourceSide && a.targetSide === b.targetSide && a.label.x === b.label.x && a.label.y === b.label.y && a.source.x === b.source.x && a.source.y === b.source.y && a.target.x === b.target.x && a.target.y === b.target.y;
712
+ }
713
+ function injectEdge(edge) {
714
+ return bindEdge(injectFlowContext("injectEdge"), injectHost(), () => valueNow(edge));
715
+ }
716
+ function bindEdge(context, element, edge) {
717
+ const view = flowValue(context, () => {
718
+ const edgeId = edge()?.id;
719
+ if (edgeId === void 0) return void 0;
720
+ const engine = context.engine();
721
+ return engine ? {
722
+ attributes: engine.adapter.attributes("edge", { edgeId }),
723
+ path: engine.get("edge-path-by", { edgeId }),
724
+ reconnecting: engine.is("edge-reconnecting", { edgeId }),
725
+ focusable: engine.is("edge-focusable", { edgeId })
726
+ } : {
727
+ attributes: staticEdgeAttributes(context, "edge", edgeId),
728
+ path: context.geometry()?.edgePaths[edgeId],
729
+ reconnecting: false,
730
+ focusable: false
731
+ };
732
+ }, (a, b) => a === b || a !== void 0 && b !== void 0 && a.reconnecting === b.reconnecting && a.focusable === b.focusable && sameEdgePath(a.path, b.path) && shallowEqual(a.attributes, b.attributes), {
733
+ scope: "entity",
734
+ entity: entityOf("edge", () => edge()?.id)
735
+ });
736
+ const state = computed(() => {
737
+ const current = edge();
738
+ const shown = view();
739
+ if (!current || !shown) return void 0;
740
+ return {
741
+ edgeId: current.id,
742
+ edge: current,
743
+ path: shown.path,
744
+ selected: shown.attributes["data-selected"] !== void 0,
745
+ reconnecting: shown.reconnecting,
746
+ focusable: shown.focusable,
747
+ attributes: shown.attributes
748
+ };
749
+ }, ...ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []);
750
+ bindAttributes(element, () => {
751
+ const shown = view();
752
+ return shown ? {
753
+ ...shown.attributes,
754
+ tabindex: shown.focusable ? "0" : void 0
755
+ } : {};
756
+ });
757
+ bindStructuralStyle(element, () => ({ pointerEvents: "visibleStroke" }));
758
+ return { state };
759
+ }
760
+ function staticEdgeAttributes(context, part, edgeId) {
761
+ const edge = context.model().get("edge-by", { id: edgeId });
762
+ return {
763
+ ...partAttributes(part, edgeId),
764
+ "data-selected": flag(edge?.selected === true),
765
+ "data-animated": flag(edge?.animated === true)
766
+ };
767
+ }
768
+ function edgePathOf(context, edgeId) {
769
+ return flowValue(context, () => {
770
+ const id = edgeId();
771
+ if (id === void 0) return void 0;
772
+ const engine = context.engine();
773
+ return engine ? engine.get("edge-path-by", { edgeId: id }) : context.geometry()?.edgePaths[id];
774
+ }, sameEdgePath, {
775
+ scope: "entity",
776
+ entity: entityOf("edge", () => edgeId())
777
+ });
778
+ }
779
+ function bindEdgePath(context, element, edgeId) {
780
+ const path = edgePathOf(context, edgeId);
781
+ const attributes = flowValue(context, () => {
782
+ const id = edgeId();
783
+ if (id === void 0) return void 0;
784
+ const engine = context.engine();
785
+ return engine ? engine.adapter.attributes("edge-path", { edgeId: id }) : staticEdgeAttributes(context, "edge-path", id);
786
+ }, void 0, {
787
+ scope: "entity",
788
+ entity: entityOf("edge", () => edgeId())
789
+ });
790
+ bindAttributes(element, () => attributes() ?? {});
791
+ bindBaseAttributes(element, () => ({
792
+ d: path()?.path,
793
+ fill: "none"
794
+ }));
795
+ return computed(() => {
796
+ const id = edgeId();
797
+ const current = path();
798
+ const own = attributes();
799
+ if (id === void 0 || !current || !own) return void 0;
800
+ return {
801
+ edgeId: id,
802
+ path: current,
803
+ selected: own["data-selected"] !== void 0
804
+ };
805
+ });
806
+ }
807
+ const SVG$1 = "http://www.w3.org/2000/svg";
808
+ var FlowEdgeDirective = class FlowEdgeDirective {
809
+ constructor() {
810
+ this.flowEdge = input.required(...ngDevMode ? [{ debugName: "flowEdge" }] : /* istanbul ignore next */ []);
811
+ this.edge = computed(() => beforeInputs(void 0, this.flowEdge), ...ngDevMode ? [{ debugName: "edge" }] : /* istanbul ignore next */ []);
812
+ this.context = { edgeId: computed(() => this.edge()?.id) };
813
+ const flow = injectFlowContext("[flowEdge]");
814
+ const host = injectHost();
815
+ this.state = bindEdge(flow, host, this.edge).state;
816
+ afterRenderEffect(() => {
817
+ const engine = flow.engine();
818
+ if (engine) untracked(() => engine.adapter.refocus(host));
819
+ });
820
+ defaultContent(host, (document) => {
821
+ const path = document.createElementNS(SVG$1, "path");
822
+ bindEdgePath(flow, path, this.context.edgeId);
823
+ return [path];
824
+ });
825
+ }
826
+ static {
827
+ this.ɵfac = i0.ɵɵngDeclareFactory({
828
+ minVersion: "12.0.0",
829
+ version: "22.2.5",
830
+ ngImport: i0,
831
+ type: FlowEdgeDirective,
832
+ deps: [],
833
+ target: i0.ɵɵFactoryTarget.Directive
834
+ });
835
+ }
836
+ static {
837
+ this.ɵdir = i0.ɵɵngDeclareDirective({
838
+ minVersion: "17.1.0",
839
+ version: "22.2.5",
840
+ type: FlowEdgeDirective,
841
+ isStandalone: true,
842
+ selector: "[flowEdge]",
843
+ inputs: { flowEdge: {
844
+ classPropertyName: "flowEdge",
845
+ publicName: "flowEdge",
846
+ isSignal: true,
847
+ isRequired: true,
848
+ transformFunction: null
849
+ } },
850
+ providers: [{
851
+ provide: FLOW_EDGE,
852
+ useFactory: () => inject(FlowEdgeDirective).context
853
+ }],
854
+ exportAs: ["flowEdge"],
855
+ ngImport: i0
856
+ });
857
+ }
858
+ };
859
+ i0.ɵɵngDeclareClassMetadata({
860
+ minVersion: "12.0.0",
861
+ version: "22.2.5",
862
+ ngImport: i0,
863
+ type: FlowEdgeDirective,
864
+ decorators: [{
865
+ type: Directive,
866
+ args: [{
867
+ selector: "[flowEdge]",
868
+ exportAs: "flowEdge",
869
+ providers: [{
870
+ provide: FLOW_EDGE,
871
+ useFactory: () => inject(FlowEdgeDirective).context
872
+ }]
873
+ }]
874
+ }],
875
+ ctorParameters: () => [],
876
+ propDecorators: { flowEdge: [{
877
+ type: i0.Input,
878
+ args: [{
879
+ isSignal: true,
880
+ alias: "flowEdge",
881
+ required: true
882
+ }]
883
+ }] }
884
+ });
885
+ var FlowEdgeLabelDirective = class FlowEdgeLabelDirective {
886
+ constructor() {
887
+ this.edgeId = input(void 0, ...ngDevMode ? [{ debugName: "edgeId" }] : /* istanbul ignore next */ []);
888
+ this.context = injectFlowContext("[flowEdgeLabel]");
889
+ this.id = partOwnerId("[flowEdgeLabel]", this.edgeId, injectEdgeContext(), "edge");
890
+ this.path = edgePathOf(this.context, this.id);
891
+ this.attributes = flowValue(this.context, () => {
892
+ const edgeId = this.id();
893
+ if (edgeId === void 0) return void 0;
894
+ const engine = this.context.engine();
895
+ return engine ? engine.adapter.attributes("edge-label", { edgeId }) : staticEdgeAttributes(this.context, "edge-label", edgeId);
896
+ }, void 0, {
897
+ scope: "entity",
898
+ entity: entityOf("edge", () => this.id())
899
+ });
900
+ this.state = computed(() => {
901
+ const edgeId = this.id();
902
+ const path = this.path();
903
+ const attributes = this.attributes();
904
+ if (edgeId === void 0 || !path || !attributes) return void 0;
905
+ return {
906
+ edgeId,
907
+ path,
908
+ selected: attributes["data-selected"] !== void 0
909
+ };
910
+ }, ...ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []);
911
+ const host = injectHost();
912
+ const layers = inject(FLOW_EDGE_LABEL_LAYER, { optional: true });
913
+ bindAttributes(host, () => this.attributes() ?? {});
914
+ bindStructuralStyle(host, () => {
915
+ const label = this.path()?.label;
916
+ return {
917
+ position: "absolute",
918
+ top: 0,
919
+ left: 0,
920
+ transform: label ? `translate(${label.x}px, ${label.y}px) translate(-50%, -50%)` : void 0,
921
+ pointerEvents: "all"
922
+ };
923
+ });
924
+ bindPresence(host, () => {
925
+ const state = this.state();
926
+ return state && layers ? layers.of(state.edgeId) : null;
927
+ });
928
+ }
929
+ static {
930
+ this.ɵfac = i0.ɵɵngDeclareFactory({
931
+ minVersion: "12.0.0",
932
+ version: "22.2.5",
933
+ ngImport: i0,
934
+ type: FlowEdgeLabelDirective,
935
+ deps: [],
936
+ target: i0.ɵɵFactoryTarget.Directive
937
+ });
938
+ }
939
+ static {
940
+ this.ɵdir = i0.ɵɵngDeclareDirective({
941
+ minVersion: "17.1.0",
942
+ version: "22.2.5",
943
+ type: FlowEdgeLabelDirective,
944
+ isStandalone: true,
945
+ selector: "[flowEdgeLabel]",
946
+ inputs: { edgeId: {
947
+ classPropertyName: "edgeId",
948
+ publicName: "edgeId",
949
+ isSignal: true,
950
+ isRequired: false,
951
+ transformFunction: null
952
+ } },
953
+ exportAs: ["flowEdgeLabel"],
954
+ ngImport: i0
955
+ });
956
+ }
957
+ };
958
+ i0.ɵɵngDeclareClassMetadata({
959
+ minVersion: "12.0.0",
960
+ version: "22.2.5",
961
+ ngImport: i0,
962
+ type: FlowEdgeLabelDirective,
963
+ decorators: [{
964
+ type: Directive,
965
+ args: [{
966
+ selector: "[flowEdgeLabel]",
967
+ exportAs: "flowEdgeLabel"
968
+ }]
969
+ }],
970
+ ctorParameters: () => [],
971
+ propDecorators: { edgeId: [{
972
+ type: i0.Input,
973
+ args: [{
974
+ isSignal: true,
975
+ alias: "edgeId",
976
+ required: false
977
+ }]
978
+ }] }
979
+ });
980
+ var FlowEdgePathDirective = class FlowEdgePathDirective {
981
+ constructor() {
982
+ this.edgeId = input(void 0, ...ngDevMode ? [{ debugName: "edgeId" }] : /* istanbul ignore next */ []);
983
+ this.state = bindEdgePath(injectFlowContext("[flowEdgePath]"), injectHost(), partOwnerId("[flowEdgePath]", this.edgeId, injectEdgeContext(), "edge"));
984
+ }
985
+ static {
986
+ this.ɵfac = i0.ɵɵngDeclareFactory({
987
+ minVersion: "12.0.0",
988
+ version: "22.2.5",
989
+ ngImport: i0,
990
+ type: FlowEdgePathDirective,
991
+ deps: [],
992
+ target: i0.ɵɵFactoryTarget.Directive
993
+ });
994
+ }
995
+ static {
996
+ this.ɵdir = i0.ɵɵngDeclareDirective({
997
+ minVersion: "17.1.0",
998
+ version: "22.2.5",
999
+ type: FlowEdgePathDirective,
1000
+ isStandalone: true,
1001
+ selector: "[flowEdgePath]",
1002
+ inputs: { edgeId: {
1003
+ classPropertyName: "edgeId",
1004
+ publicName: "edgeId",
1005
+ isSignal: true,
1006
+ isRequired: false,
1007
+ transformFunction: null
1008
+ } },
1009
+ exportAs: ["flowEdgePath"],
1010
+ ngImport: i0
1011
+ });
1012
+ }
1013
+ };
1014
+ i0.ɵɵngDeclareClassMetadata({
1015
+ minVersion: "12.0.0",
1016
+ version: "22.2.5",
1017
+ ngImport: i0,
1018
+ type: FlowEdgePathDirective,
1019
+ decorators: [{
1020
+ type: Directive,
1021
+ args: [{
1022
+ selector: "[flowEdgePath]",
1023
+ exportAs: "flowEdgePath"
1024
+ }]
1025
+ }],
1026
+ propDecorators: { edgeId: [{
1027
+ type: i0.Input,
1028
+ args: [{
1029
+ isSignal: true,
1030
+ alias: "edgeId",
1031
+ required: false
1032
+ }]
1033
+ }] }
1034
+ });
1035
+ var FlowEdgeToolbarDirective = class FlowEdgeToolbarDirective {
1036
+ constructor() {
1037
+ this.edgeId = input(void 0, ...ngDevMode ? [{ debugName: "edgeId" }] : /* istanbul ignore next */ []);
1038
+ this.position = input(void 0, ...ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []);
1039
+ this.point = input(void 0, ...ngDevMode ? [{ debugName: "point" }] : /* istanbul ignore next */ []);
1040
+ this.offset = input(void 0, ...ngDevMode ? [{ debugName: "offset" }] : /* istanbul ignore next */ []);
1041
+ this.alignX = input(void 0, ...ngDevMode ? [{ debugName: "alignX" }] : /* istanbul ignore next */ []);
1042
+ this.alignY = input(void 0, ...ngDevMode ? [{ debugName: "alignY" }] : /* istanbul ignore next */ []);
1043
+ this.open = input(void 0, {
1044
+ ...ngDevMode ? { debugName: "open" } : /* istanbul ignore next */ {},
1045
+ transform: optionalBoolean
1046
+ });
1047
+ this.context = injectFlowContext("[flowEdgeToolbar]");
1048
+ this.id = partOwnerId("[flowEdgeToolbar]", this.edgeId, injectEdgeContext(), "edge");
1049
+ this.view = flowValue(this.context, () => {
1050
+ const engine = this.context.engine();
1051
+ const edgeId = this.id();
1052
+ if (!engine || edgeId === void 0) return void 0;
1053
+ if (!(this.open() ?? this.context.model().is("edge-selected", { edgeId }))) return void 0;
1054
+ const anchor = engine.get("edge-toolbar-by", {
1055
+ edgeId,
1056
+ position: this.position() ?? "label",
1057
+ point: this.point(),
1058
+ offset: this.offset(),
1059
+ alignX: this.alignX(),
1060
+ alignY: this.alignY()
1061
+ });
1062
+ return anchor ? {
1063
+ anchor,
1064
+ attributes: engine.adapter.attributes("toolbar", { edgeId })
1065
+ } : void 0;
1066
+ });
1067
+ this.state = computed(() => {
1068
+ const view = this.view();
1069
+ const edgeId = this.id();
1070
+ if (!view || edgeId === void 0) return null;
1071
+ return {
1072
+ edgeId,
1073
+ position: this.position() ?? "label",
1074
+ anchor: view.anchor
1075
+ };
1076
+ }, ...ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []);
1077
+ const host = injectHost();
1078
+ bindAttributes(host, () => this.view()?.attributes ?? {});
1079
+ bindStructuralStyle(host, () => {
1080
+ const anchor = this.view()?.anchor;
1081
+ return {
1082
+ position: "absolute",
1083
+ top: 0,
1084
+ left: 0,
1085
+ transform: anchor ? `translate(${anchor.x}px, ${anchor.y}px) translate(${-anchor.anchorX * 100}%, ${-anchor.anchorY * 100}%)` : void 0
1086
+ };
1087
+ });
1088
+ bindPresence(host, () => this.state() ? this.context.rootElement : null);
1089
+ }
1090
+ static {
1091
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1092
+ minVersion: "12.0.0",
1093
+ version: "22.2.5",
1094
+ ngImport: i0,
1095
+ type: FlowEdgeToolbarDirective,
1096
+ deps: [],
1097
+ target: i0.ɵɵFactoryTarget.Directive
1098
+ });
1099
+ }
1100
+ static {
1101
+ this.ɵdir = i0.ɵɵngDeclareDirective({
1102
+ minVersion: "17.1.0",
1103
+ version: "22.2.5",
1104
+ type: FlowEdgeToolbarDirective,
1105
+ isStandalone: true,
1106
+ selector: "[flowEdgeToolbar]",
1107
+ inputs: {
1108
+ edgeId: {
1109
+ classPropertyName: "edgeId",
1110
+ publicName: "edgeId",
1111
+ isSignal: true,
1112
+ isRequired: false,
1113
+ transformFunction: null
1114
+ },
1115
+ position: {
1116
+ classPropertyName: "position",
1117
+ publicName: "position",
1118
+ isSignal: true,
1119
+ isRequired: false,
1120
+ transformFunction: null
1121
+ },
1122
+ point: {
1123
+ classPropertyName: "point",
1124
+ publicName: "point",
1125
+ isSignal: true,
1126
+ isRequired: false,
1127
+ transformFunction: null
1128
+ },
1129
+ offset: {
1130
+ classPropertyName: "offset",
1131
+ publicName: "offset",
1132
+ isSignal: true,
1133
+ isRequired: false,
1134
+ transformFunction: null
1135
+ },
1136
+ alignX: {
1137
+ classPropertyName: "alignX",
1138
+ publicName: "alignX",
1139
+ isSignal: true,
1140
+ isRequired: false,
1141
+ transformFunction: null
1142
+ },
1143
+ alignY: {
1144
+ classPropertyName: "alignY",
1145
+ publicName: "alignY",
1146
+ isSignal: true,
1147
+ isRequired: false,
1148
+ transformFunction: null
1149
+ },
1150
+ open: {
1151
+ classPropertyName: "open",
1152
+ publicName: "open",
1153
+ isSignal: true,
1154
+ isRequired: false,
1155
+ transformFunction: null
1156
+ }
1157
+ },
1158
+ exportAs: ["flowEdgeToolbar"],
1159
+ ngImport: i0
1160
+ });
1161
+ }
1162
+ };
1163
+ i0.ɵɵngDeclareClassMetadata({
1164
+ minVersion: "12.0.0",
1165
+ version: "22.2.5",
1166
+ ngImport: i0,
1167
+ type: FlowEdgeToolbarDirective,
1168
+ decorators: [{
1169
+ type: Directive,
1170
+ args: [{
1171
+ selector: "[flowEdgeToolbar]",
1172
+ exportAs: "flowEdgeToolbar"
1173
+ }]
1174
+ }],
1175
+ ctorParameters: () => [],
1176
+ propDecorators: {
1177
+ edgeId: [{
1178
+ type: i0.Input,
1179
+ args: [{
1180
+ isSignal: true,
1181
+ alias: "edgeId",
1182
+ required: false
1183
+ }]
1184
+ }],
1185
+ position: [{
1186
+ type: i0.Input,
1187
+ args: [{
1188
+ isSignal: true,
1189
+ alias: "position",
1190
+ required: false
1191
+ }]
1192
+ }],
1193
+ point: [{
1194
+ type: i0.Input,
1195
+ args: [{
1196
+ isSignal: true,
1197
+ alias: "point",
1198
+ required: false
1199
+ }]
1200
+ }],
1201
+ offset: [{
1202
+ type: i0.Input,
1203
+ args: [{
1204
+ isSignal: true,
1205
+ alias: "offset",
1206
+ required: false
1207
+ }]
1208
+ }],
1209
+ alignX: [{
1210
+ type: i0.Input,
1211
+ args: [{
1212
+ isSignal: true,
1213
+ alias: "alignX",
1214
+ required: false
1215
+ }]
1216
+ }],
1217
+ alignY: [{
1218
+ type: i0.Input,
1219
+ args: [{
1220
+ isSignal: true,
1221
+ alias: "alignY",
1222
+ required: false
1223
+ }]
1224
+ }],
1225
+ open: [{
1226
+ type: i0.Input,
1227
+ args: [{
1228
+ isSignal: true,
1229
+ alias: "open",
1230
+ required: false
1231
+ }]
1232
+ }]
1233
+ }
1234
+ });
1235
+ var SignalContext = class {
1236
+ constructor(initial) {
1237
+ const fields = {};
1238
+ for (const key of Object.keys(initial)) {
1239
+ fields[key] = signal(initial[key]);
1240
+ Object.defineProperty(this, key, {
1241
+ enumerable: true,
1242
+ get: () => fields[key]()
1243
+ });
1244
+ }
1245
+ this.fields = fields;
1246
+ }
1247
+ update(next) {
1248
+ for (const key of Object.keys(next)) {
1249
+ const field = this.fields[key];
1250
+ if (!Object.is(untracked(field), next[key])) field.set(next[key]);
1251
+ }
1252
+ }
1253
+ };
1254
+ function signalContext(initial) {
1255
+ return new SignalContext(initial);
1256
+ }
1257
+ var FlowSlot = class FlowSlot {
1258
+ constructor() {
1259
+ this.container = inject(ViewContainerRef);
1260
+ }
1261
+ static {
1262
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1263
+ minVersion: "12.0.0",
1264
+ version: "22.2.5",
1265
+ ngImport: i0,
1266
+ type: FlowSlot,
1267
+ deps: [],
1268
+ target: i0.ɵɵFactoryTarget.Component
1269
+ });
1270
+ }
1271
+ static {
1272
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
1273
+ minVersion: "14.0.0",
1274
+ version: "22.2.5",
1275
+ type: FlowSlot,
1276
+ isStandalone: true,
1277
+ selector: "flow-slot",
1278
+ ngImport: i0,
1279
+ template: "",
1280
+ isInline: true,
1281
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
1282
+ });
1283
+ }
1284
+ };
1285
+ i0.ɵɵngDeclareClassMetadata({
1286
+ minVersion: "12.0.0",
1287
+ version: "22.2.5",
1288
+ ngImport: i0,
1289
+ type: FlowSlot,
1290
+ decorators: [{
1291
+ type: Component,
1292
+ args: [{
1293
+ selector: "flow-slot",
1294
+ template: "",
1295
+ changeDetection: ChangeDetectionStrategy.OnPush
1296
+ }]
1297
+ }]
1298
+ });
1299
+ var SlotViews = class {
1300
+ constructor(anchor, template) {
1301
+ this.anchor = anchor;
1302
+ this.template = template;
1303
+ this.slots = /* @__PURE__ */ new Map();
1304
+ this.app = inject(ApplicationRef);
1305
+ this.environmentInjector = inject(EnvironmentInjector);
1306
+ this.elementInjector = inject(Injector);
1307
+ }
1308
+ sync(items, moved) {
1309
+ untracked(() => {
1310
+ const keep = new Set(items.map((item) => item.key));
1311
+ for (const [key, slot] of this.slots) if (!keep.has(key)) {
1312
+ slot.ref.destroy();
1313
+ this.slots.delete(key);
1314
+ }
1315
+ const byAnchor = /* @__PURE__ */ new Map();
1316
+ for (const { key, context, anchor } of items) {
1317
+ let slot = this.slots.get(key);
1318
+ if (slot) slot.view.context.update(context);
1319
+ else {
1320
+ slot = this.create(context);
1321
+ this.slots.set(key, slot);
1322
+ }
1323
+ const at = anchor ?? this.anchor;
1324
+ const list = byAnchor.get(at) ?? [];
1325
+ list.push(slot);
1326
+ byAnchor.set(at, list);
1327
+ }
1328
+ const changed = [];
1329
+ const active = this.anchor.ownerDocument.activeElement;
1330
+ for (const [anchor, ordered] of byAnchor) {
1331
+ let next = anchor;
1332
+ const parent = anchor.parentNode;
1333
+ for (let i = ordered.length - 1; i >= 0; i--) {
1334
+ const slot = ordered[i];
1335
+ if (!slot) continue;
1336
+ const from = slot.place;
1337
+ const nodes = slot.view.rootNodes.filter((node) => node.parentNode === parent || node.parentNode === slot.box || from !== null && node.parentNode === from);
1338
+ const last = nodes.at(-1);
1339
+ if (last && last.nextSibling !== next) for (const node of nodes) {
1340
+ const before = node.parentNode;
1341
+ next.parentNode?.insertBefore(node, next);
1342
+ if (before !== slot.box && node.nodeType === 1 && (before !== node.parentNode || active !== null && node.contains(active))) changed.push(node);
1343
+ }
1344
+ slot.place = parent;
1345
+ next = nodes[0] ?? next;
1346
+ }
1347
+ }
1348
+ if (changed.length > 0) moved?.(changed);
1349
+ });
1350
+ }
1351
+ markForCheck() {
1352
+ for (const slot of this.slots.values()) slot.ref.changeDetectorRef.markForCheck();
1353
+ }
1354
+ clear() {
1355
+ for (const slot of this.slots.values()) slot.ref.destroy();
1356
+ this.slots.clear();
1357
+ }
1358
+ create(context) {
1359
+ const document = this.anchor.ownerDocument;
1360
+ const box = document.createElement("div");
1361
+ const host = document.createElement("flow-slot");
1362
+ box.append(host);
1363
+ const ref = createComponent(FlowSlot, {
1364
+ environmentInjector: this.environmentInjector,
1365
+ elementInjector: this.elementInjector,
1366
+ hostElement: host
1367
+ });
1368
+ this.app.attachView(ref.hostView);
1369
+ const view = ref.instance.container.createEmbeddedView(this.template, signalContext(context));
1370
+ ref.changeDetectorRef.markForCheck();
1371
+ return {
1372
+ ref,
1373
+ box,
1374
+ view,
1375
+ place: null
1376
+ };
1377
+ }
1378
+ };
1379
+ const SVG = "http://www.w3.org/2000/svg";
1380
+ const ATTRIBUTES$2 = partAttributes("edges");
1381
+ const LAYER_STYLE = {
1382
+ position: "absolute",
1383
+ top: 0,
1384
+ left: 0,
1385
+ width: "100%",
1386
+ height: "100%",
1387
+ overflow: "visible",
1388
+ pointerEvents: "none"
1389
+ };
1390
+ var FlowEdgesDirective = class FlowEdgesDirective {
1391
+ constructor() {
1392
+ this.context = injectFlowContext("[flowEdges]");
1393
+ this.host = injectHost();
1394
+ this.svg = this.host.ownerDocument.createElementNS(SVG, "svg");
1395
+ this.levels = [];
1396
+ this.injector = inject(Injector);
1397
+ this.list = flowValue(this.context, () => {
1398
+ const engine = this.context.engine();
1399
+ if (engine) return engine.get("drawn-edges");
1400
+ if (this.context.culled()) return [];
1401
+ const geometry = this.context.geometry();
1402
+ if (!geometry) return [];
1403
+ const model = this.context.model();
1404
+ return geometry.drawnEdges.flatMap((id) => {
1405
+ const edge = model.get("edge-by", { id });
1406
+ return edge ? [edge] : [];
1407
+ });
1408
+ });
1409
+ this.layered = computed(() => this.context.layers().length > 1, ...ngDevMode ? [{ debugName: "layered" }] : /* istanbul ignore next */ []);
1410
+ this.levelOf = computed(() => {
1411
+ const levels = /* @__PURE__ */ new Map();
1412
+ for (const layer of this.context.layers()) for (const id of layer.edgeIds) levels.set(id, layer.level);
1413
+ return levels;
1414
+ }, ...ngDevMode ? [{ debugName: "levelOf" }] : /* istanbul ignore next */ []);
1415
+ this.state = flowValue(this.context, () => ({ count: this.list().length }));
1416
+ bindAttributes(this.host, () => ATTRIBUTES$2);
1417
+ bindStructuralStyle(this.host, () => LAYER_STYLE);
1418
+ for (const [name, value] of Object.entries(ATTRIBUTES$2)) if (value !== void 0) this.svg.setAttribute(name, value);
1419
+ bindStructuralStyle(this.svg, () => LAYER_STYLE);
1420
+ this.host.prepend(this.svg);
1421
+ effect(() => {
1422
+ const count = this.context.layers().length;
1423
+ untracked(() => this.arrange(count));
1424
+ });
1425
+ onDestroy(() => {
1426
+ this.svg.remove();
1427
+ for (const { wrapper } of this.levels) wrapper.remove();
1428
+ });
1429
+ }
1430
+ svgOf(level) {
1431
+ return level === 0 ? this.svg : this.level(level).svg;
1432
+ }
1433
+ of(edgeId) {
1434
+ if (!this.layered()) return this.host;
1435
+ const level = this.levelOf().get(edgeId) ?? 0;
1436
+ return untracked(() => this.level(level).wrapper);
1437
+ }
1438
+ level(level) {
1439
+ for (let i = this.levels.length; i <= level; i++) untracked(() => runInInjectionContext(this.injector, () => this.levels.push(this.createLevel(i))));
1440
+ return this.levels[level];
1441
+ }
1442
+ createLevel(level) {
1443
+ const document = this.host.ownerDocument;
1444
+ const wrapper = document.createElement("div");
1445
+ bindAttributes(wrapper, () => {
1446
+ const engine = this.context.engine();
1447
+ return engine ? engine.adapter.attributes("edges-layer", { level }) : edgesLayerAttributes(level);
1448
+ });
1449
+ bindStructuralStyle(wrapper, () => ({
1450
+ ...LAYER_STYLE,
1451
+ zIndex: this.context.layers()[level]?.zIndex
1452
+ }));
1453
+ let svg = this.svg;
1454
+ if (level > 0) {
1455
+ svg = document.createElementNS(SVG, "svg");
1456
+ for (const [name, value] of Object.entries(ATTRIBUTES$2)) if (value !== void 0) svg.setAttribute(name, value);
1457
+ bindStructuralStyle(svg, () => LAYER_STYLE);
1458
+ wrapper.append(svg);
1459
+ }
1460
+ return {
1461
+ wrapper,
1462
+ svg
1463
+ };
1464
+ }
1465
+ arrange(count) {
1466
+ const active = this.host.ownerDocument.activeElement;
1467
+ const focused = active && active !== this.svg && this.svg.contains(active) ? active : void 0;
1468
+ this.place(count);
1469
+ if (focused) this.context.engine()?.adapter.refocus(focused);
1470
+ }
1471
+ place(count) {
1472
+ if (count <= 1) {
1473
+ for (const { wrapper } of this.levels) wrapper.remove();
1474
+ if (this.svg.parentNode !== this.host) this.host.prepend(this.svg);
1475
+ return;
1476
+ }
1477
+ const shown = Array.from({ length: count }, (_, level) => this.level(level).wrapper);
1478
+ for (const { wrapper } of this.levels.slice(count)) wrapper.remove();
1479
+ const first = shown[0];
1480
+ if (this.svg.parentNode !== first) first.prepend(this.svg);
1481
+ if (!shown.every((wrapper, i) => this.host.children[i] === wrapper)) this.host.prepend(...shown);
1482
+ }
1483
+ static {
1484
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1485
+ minVersion: "12.0.0",
1486
+ version: "22.2.5",
1487
+ ngImport: i0,
1488
+ type: FlowEdgesDirective,
1489
+ deps: [],
1490
+ target: i0.ɵɵFactoryTarget.Directive
1491
+ });
1492
+ }
1493
+ static {
1494
+ this.ɵdir = i0.ɵɵngDeclareDirective({
1495
+ minVersion: "14.0.0",
1496
+ version: "22.2.5",
1497
+ type: FlowEdgesDirective,
1498
+ isStandalone: true,
1499
+ selector: "[flowEdges]",
1500
+ providers: [{
1501
+ provide: FLOW_EDGE_LABEL_LAYER,
1502
+ useFactory: () => inject(FlowEdgesDirective)
1503
+ }],
1504
+ exportAs: ["flowEdges"],
1505
+ ngImport: i0
1506
+ });
1507
+ }
1508
+ };
1509
+ i0.ɵɵngDeclareClassMetadata({
1510
+ minVersion: "12.0.0",
1511
+ version: "22.2.5",
1512
+ ngImport: i0,
1513
+ type: FlowEdgesDirective,
1514
+ decorators: [{
1515
+ type: Directive,
1516
+ args: [{
1517
+ selector: "[flowEdges]",
1518
+ exportAs: "flowEdges",
1519
+ providers: [{
1520
+ provide: FLOW_EDGE_LABEL_LAYER,
1521
+ useFactory: () => inject(FlowEdgesDirective)
1522
+ }]
1523
+ }]
1524
+ }],
1525
+ ctorParameters: () => []
1526
+ });
1527
+ var FlowEdgesItemDirective = class FlowEdgesItemDirective {
1528
+ static ngTemplateContextGuard(_directive, _context) {
1529
+ return true;
1530
+ }
1531
+ constructor() {
1532
+ this.flowEdgesItem = input(void 0, ...ngDevMode ? [{ debugName: "flowEdgesItem" }] : /* istanbul ignore next */ []);
1533
+ const edges = inject(FlowEdgesDirective, { optional: true });
1534
+ if (!edges) throw new Error("flowEdgesItem must be used inside [flowEdges]");
1535
+ const anchor = inject(ViewContainerRef).element.nativeElement;
1536
+ edges.svg.append(anchor);
1537
+ const anchors = [anchor];
1538
+ const anchorOf = (level) => {
1539
+ let at = anchors[level];
1540
+ if (!at) {
1541
+ at = anchor.ownerDocument.createComment("");
1542
+ edges.svgOf(level).append(at);
1543
+ anchors[level] = at;
1544
+ }
1545
+ return at;
1546
+ };
1547
+ const views = new SlotViews(anchor, inject(TemplateRef));
1548
+ this.views = views;
1549
+ const context = injectFlowContext("flowEdgesItem");
1550
+ effect(() => {
1551
+ const list = edges.list();
1552
+ const layered = edges.layered();
1553
+ const levels = edges.levelOf();
1554
+ untracked(() => views.sync(list.map((edge) => ({
1555
+ key: edge.id,
1556
+ context: {
1557
+ $implicit: edge,
1558
+ edge
1559
+ },
1560
+ anchor: layered ? anchorOf(levels.get(edge.id) ?? 0) : anchor
1561
+ })), (moved) => {
1562
+ const engine = context.engine();
1563
+ for (const element of moved) engine?.adapter.refocus(element);
1564
+ }));
1565
+ });
1566
+ onDestroy(() => {
1567
+ views.clear();
1568
+ for (const at of anchors) at?.remove();
1569
+ });
1570
+ }
1571
+ ngDoCheck() {
1572
+ this.views.markForCheck();
1573
+ }
1574
+ static {
1575
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1576
+ minVersion: "12.0.0",
1577
+ version: "22.2.5",
1578
+ ngImport: i0,
1579
+ type: FlowEdgesItemDirective,
1580
+ deps: [],
1581
+ target: i0.ɵɵFactoryTarget.Directive
1582
+ });
1583
+ }
1584
+ static {
1585
+ this.ɵdir = i0.ɵɵngDeclareDirective({
1586
+ minVersion: "17.1.0",
1587
+ version: "22.2.5",
1588
+ type: FlowEdgesItemDirective,
1589
+ isStandalone: true,
1590
+ selector: "ng-template[flowEdgesItem]",
1591
+ inputs: { flowEdgesItem: {
1592
+ classPropertyName: "flowEdgesItem",
1593
+ publicName: "flowEdgesItem",
1594
+ isSignal: true,
1595
+ isRequired: false,
1596
+ transformFunction: null
1597
+ } },
1598
+ ngImport: i0
1599
+ });
1600
+ }
1601
+ };
1602
+ i0.ɵɵngDeclareClassMetadata({
1603
+ minVersion: "12.0.0",
1604
+ version: "22.2.5",
1605
+ ngImport: i0,
1606
+ type: FlowEdgesItemDirective,
1607
+ decorators: [{
1608
+ type: Directive,
1609
+ args: [{ selector: "ng-template[flowEdgesItem]" }]
1610
+ }],
1611
+ ctorParameters: () => [],
1612
+ propDecorators: { flowEdgesItem: [{
1613
+ type: i0.Input,
1614
+ args: [{
1615
+ isSignal: true,
1616
+ alias: "flowEdgesItem",
1617
+ required: false
1618
+ }]
1619
+ }] }
1620
+ });
1621
+ function controlButton(part, action, disabledInput, payload = () => ({})) {
1622
+ const context = injectFlowContext(`[flow${pascal(part)}]`);
1623
+ const host = injectHost();
1624
+ const allowed = flowValue(context, () => {
1625
+ const engine = context.engine();
1626
+ return engine ? engine.can(action, payload()) : false;
1627
+ });
1628
+ const state = computed(() => ({ disabled: disabledInput() === true || !allowed() }), ...ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []);
1629
+ bindAttributes(host, () => ({
1630
+ "data-flow-part": part,
1631
+ "data-disabled": state().disabled ? "" : void 0,
1632
+ disabled: state().disabled ? "" : void 0
1633
+ }));
1634
+ bindBaseAttributes(host, () => ({ type: "button" }));
1635
+ return {
1636
+ state,
1637
+ click: () => {
1638
+ const engine = context.engine();
1639
+ if (!engine) return;
1640
+ engine.run(action, payload());
1641
+ }
1642
+ };
1643
+ }
1644
+ function givenPayload(fields) {
1645
+ return Object.fromEntries(Object.entries(fields).filter(([, value]) => value !== void 0));
1646
+ }
1647
+ function pascal(part) {
1648
+ return part.replace(/(^|-)(\w)/g, (_match, _dash, letter) => letter.toUpperCase());
1649
+ }
1650
+ var FlowFitViewDirective = class FlowFitViewDirective {
1651
+ constructor() {
1652
+ this.disabled = input(void 0, {
1653
+ ...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
1654
+ transform: optionalBoolean
1655
+ });
1656
+ this.duration = input(void 0, {
1657
+ ...ngDevMode ? { debugName: "duration" } : /* istanbul ignore next */ {},
1658
+ transform: optionalNumber
1659
+ });
1660
+ this.padding = input(void 0, ...ngDevMode ? [{ debugName: "padding" }] : /* istanbul ignore next */ []);
1661
+ this.nodeIds = input(void 0, ...ngDevMode ? [{ debugName: "nodeIds" }] : /* istanbul ignore next */ []);
1662
+ this.includeHidden = input(void 0, {
1663
+ ...ngDevMode ? { debugName: "includeHidden" } : /* istanbul ignore next */ {},
1664
+ transform: optionalBoolean
1665
+ });
1666
+ this.minZoom = input(void 0, {
1667
+ ...ngDevMode ? { debugName: "minZoom" } : /* istanbul ignore next */ {},
1668
+ transform: optionalNumber
1669
+ });
1670
+ this.maxZoom = input(void 0, {
1671
+ ...ngDevMode ? { debugName: "maxZoom" } : /* istanbul ignore next */ {},
1672
+ transform: optionalNumber
1673
+ });
1674
+ this.button = controlButton("fit-view", "fit-view", this.disabled, () => givenPayload({
1675
+ duration: this.duration(),
1676
+ padding: this.padding(),
1677
+ nodeIds: this.nodeIds(),
1678
+ includeHidden: this.includeHidden(),
1679
+ minZoom: this.minZoom(),
1680
+ maxZoom: this.maxZoom()
1681
+ }));
1682
+ this.state = this.button.state;
1683
+ }
1684
+ click() {
1685
+ if (!this.state().disabled) this.button.click();
1686
+ }
1687
+ static {
1688
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1689
+ minVersion: "12.0.0",
1690
+ version: "22.2.5",
1691
+ ngImport: i0,
1692
+ type: FlowFitViewDirective,
1693
+ deps: [],
1694
+ target: i0.ɵɵFactoryTarget.Directive
1695
+ });
1696
+ }
1697
+ static {
1698
+ this.ɵdir = i0.ɵɵngDeclareDirective({
1699
+ minVersion: "17.1.0",
1700
+ version: "22.2.5",
1701
+ type: FlowFitViewDirective,
1702
+ isStandalone: true,
1703
+ selector: "[flowFitView]",
1704
+ inputs: {
1705
+ disabled: {
1706
+ classPropertyName: "disabled",
1707
+ publicName: "disabled",
1708
+ isSignal: true,
1709
+ isRequired: false,
1710
+ transformFunction: null
1711
+ },
1712
+ duration: {
1713
+ classPropertyName: "duration",
1714
+ publicName: "duration",
1715
+ isSignal: true,
1716
+ isRequired: false,
1717
+ transformFunction: null
1718
+ },
1719
+ padding: {
1720
+ classPropertyName: "padding",
1721
+ publicName: "padding",
1722
+ isSignal: true,
1723
+ isRequired: false,
1724
+ transformFunction: null
1725
+ },
1726
+ nodeIds: {
1727
+ classPropertyName: "nodeIds",
1728
+ publicName: "nodeIds",
1729
+ isSignal: true,
1730
+ isRequired: false,
1731
+ transformFunction: null
1732
+ },
1733
+ includeHidden: {
1734
+ classPropertyName: "includeHidden",
1735
+ publicName: "includeHidden",
1736
+ isSignal: true,
1737
+ isRequired: false,
1738
+ transformFunction: null
1739
+ },
1740
+ minZoom: {
1741
+ classPropertyName: "minZoom",
1742
+ publicName: "minZoom",
1743
+ isSignal: true,
1744
+ isRequired: false,
1745
+ transformFunction: null
1746
+ },
1747
+ maxZoom: {
1748
+ classPropertyName: "maxZoom",
1749
+ publicName: "maxZoom",
1750
+ isSignal: true,
1751
+ isRequired: false,
1752
+ transformFunction: null
1753
+ }
1754
+ },
1755
+ host: { listeners: { "click": "click()" } },
1756
+ exportAs: ["flowFitView"],
1757
+ ngImport: i0
1758
+ });
1759
+ }
1760
+ };
1761
+ i0.ɵɵngDeclareClassMetadata({
1762
+ minVersion: "12.0.0",
1763
+ version: "22.2.5",
1764
+ ngImport: i0,
1765
+ type: FlowFitViewDirective,
1766
+ decorators: [{
1767
+ type: Directive,
1768
+ args: [{
1769
+ selector: "[flowFitView]",
1770
+ exportAs: "flowFitView",
1771
+ host: { "(click)": "click()" }
1772
+ }]
1773
+ }],
1774
+ propDecorators: {
1775
+ disabled: [{
1776
+ type: i0.Input,
1777
+ args: [{
1778
+ isSignal: true,
1779
+ alias: "disabled",
1780
+ required: false
1781
+ }]
1782
+ }],
1783
+ duration: [{
1784
+ type: i0.Input,
1785
+ args: [{
1786
+ isSignal: true,
1787
+ alias: "duration",
1788
+ required: false
1789
+ }]
1790
+ }],
1791
+ padding: [{
1792
+ type: i0.Input,
1793
+ args: [{
1794
+ isSignal: true,
1795
+ alias: "padding",
1796
+ required: false
1797
+ }]
1798
+ }],
1799
+ nodeIds: [{
1800
+ type: i0.Input,
1801
+ args: [{
1802
+ isSignal: true,
1803
+ alias: "nodeIds",
1804
+ required: false
1805
+ }]
1806
+ }],
1807
+ includeHidden: [{
1808
+ type: i0.Input,
1809
+ args: [{
1810
+ isSignal: true,
1811
+ alias: "includeHidden",
1812
+ required: false
1813
+ }]
1814
+ }],
1815
+ minZoom: [{
1816
+ type: i0.Input,
1817
+ args: [{
1818
+ isSignal: true,
1819
+ alias: "minZoom",
1820
+ required: false
1821
+ }]
1822
+ }],
1823
+ maxZoom: [{
1824
+ type: i0.Input,
1825
+ args: [{
1826
+ isSignal: true,
1827
+ alias: "maxZoom",
1828
+ required: false
1829
+ }]
1830
+ }]
1831
+ }
1832
+ });
1833
+ const SIDE_STYLE = {
1834
+ top: {
1835
+ top: 0,
1836
+ left: "50%",
1837
+ transform: "translate(-50%, -50%)"
1838
+ },
1839
+ right: {
1840
+ top: "50%",
1841
+ left: "100%",
1842
+ transform: "translate(-50%, -50%)"
1843
+ },
1844
+ bottom: {
1845
+ top: "100%",
1846
+ left: "50%",
1847
+ transform: "translate(-50%, -50%)"
1848
+ },
1849
+ left: {
1850
+ top: "50%",
1851
+ left: 0,
1852
+ transform: "translate(-50%, -50%)"
1853
+ }
1854
+ };
1855
+ function sameRegistration(a, b) {
1856
+ return a === b || a !== void 0 && b !== void 0 && a.nodeId === b.nodeId && a.handleId === b.handleId && a.type === b.type && a.side === b.side && a.connectable === b.connectable && a.connectableStart === b.connectableStart && a.connectableEnd === b.connectableEnd;
1857
+ }
1858
+ function injectHandle(options) {
1859
+ const context = injectFlowContext("injectHandle");
1860
+ const nodeId = partOwnerId("injectHandle", () => valueNow(options)?.nodeId, injectNodeContext(), "node");
1861
+ return bindHandle(context, injectHost(), () => {
1862
+ const given = valueNow(options);
1863
+ const id = nodeId();
1864
+ return given && id !== void 0 ? {
1865
+ ...given,
1866
+ nodeId: id
1867
+ } : void 0;
1868
+ });
1869
+ }
1870
+ function bindHandle(context, element, options) {
1871
+ const registration = computed(() => {
1872
+ const given = options();
1873
+ if (!given || given.nodeId === void 0) return void 0;
1874
+ return {
1875
+ nodeId: given.nodeId,
1876
+ handleId: given.handleId,
1877
+ type: given.type,
1878
+ side: given.side,
1879
+ connectable: given.connectable,
1880
+ connectableStart: given.connectableStart,
1881
+ connectableEnd: given.connectableEnd
1882
+ };
1883
+ }, {
1884
+ ...ngDevMode ? { debugName: "registration" } : /* istanbul ignore next */ {},
1885
+ equal: sameRegistration
1886
+ });
1887
+ const attributes = flowValue(context, () => {
1888
+ const handle = registration();
1889
+ if (!handle) return void 0;
1890
+ const engine = context.engine();
1891
+ return engine ? engine.adapter.attributes("handle", handle) : {
1892
+ ...partAttributes("handle", handle.handleId),
1893
+ "data-handle-type": handle.type,
1894
+ "data-side": handle.side
1895
+ };
1896
+ }, void 0, { scope: "entity" });
1897
+ const state = computed(() => {
1898
+ const handle = registration();
1899
+ const current = attributes();
1900
+ if (!handle || !current) return void 0;
1901
+ return {
1902
+ nodeId: handle.nodeId,
1903
+ handleId: handle.handleId,
1904
+ type: handle.type,
1905
+ side: handle.side,
1906
+ connectable: current["data-connectable"] !== void 0,
1907
+ connectableStart: current["data-connectable-start"] !== void 0,
1908
+ connectableEnd: current["data-connectable-end"] !== void 0,
1909
+ connecting: current["data-connecting"] !== void 0,
1910
+ valid: current["data-valid"] !== void 0,
1911
+ invalid: current["data-invalid"] !== void 0,
1912
+ attributes: current
1913
+ };
1914
+ }, ...ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []);
1915
+ bindAttributes(element, () => attributes() ?? {});
1916
+ bindStructuralStyle(element, () => ({ position: "absolute" }));
1917
+ bindBaseStyle(element, () => {
1918
+ const side = registration()?.side;
1919
+ return side ? SIDE_STYLE[side] : {};
1920
+ });
1921
+ afterRenderEffect({ earlyRead: (onCleanup) => {
1922
+ const engine = context.engine();
1923
+ const handle = registration();
1924
+ if (!engine || !handle) return;
1925
+ untracked(() => {
1926
+ engine.adapter.registerHandle(handle, element);
1927
+ onCleanup(() => engine.adapter.registerHandle(handle, null));
1928
+ });
1929
+ } });
1930
+ return { state };
1931
+ }
1932
+ var FlowHandleDirective = class FlowHandleDirective {
1933
+ constructor() {
1934
+ this.type = input.required(...ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []);
1935
+ this.side = input.required(...ngDevMode ? [{ debugName: "side" }] : /* istanbul ignore next */ []);
1936
+ this.handleId = input(void 0, ...ngDevMode ? [{ debugName: "handleId" }] : /* istanbul ignore next */ []);
1937
+ this.connectable = input(void 0, {
1938
+ ...ngDevMode ? { debugName: "connectable" } : /* istanbul ignore next */ {},
1939
+ transform: optionalBoolean
1940
+ });
1941
+ this.connectableStart = input(void 0, {
1942
+ ...ngDevMode ? { debugName: "connectableStart" } : /* istanbul ignore next */ {},
1943
+ transform: optionalBoolean
1944
+ });
1945
+ this.connectableEnd = input(void 0, {
1946
+ ...ngDevMode ? { debugName: "connectableEnd" } : /* istanbul ignore next */ {},
1947
+ transform: optionalBoolean
1948
+ });
1949
+ this.nodeId = input(void 0, ...ngDevMode ? [{ debugName: "nodeId" }] : /* istanbul ignore next */ []);
1950
+ const nodeId = partOwnerId("[flowHandle]", this.nodeId, injectNodeContext(), "node");
1951
+ this.state = bindHandle(injectFlowContext("[flowHandle]"), injectHost(), () => beforeInputs(void 0, () => ({
1952
+ type: this.type(),
1953
+ side: this.side(),
1954
+ handleId: this.handleId(),
1955
+ connectable: this.connectable(),
1956
+ connectableStart: this.connectableStart(),
1957
+ connectableEnd: this.connectableEnd(),
1958
+ nodeId: nodeId()
1959
+ }))).state;
1960
+ }
1961
+ static {
1962
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1963
+ minVersion: "12.0.0",
1964
+ version: "22.2.5",
1965
+ ngImport: i0,
1966
+ type: FlowHandleDirective,
1967
+ deps: [],
1968
+ target: i0.ɵɵFactoryTarget.Directive
1969
+ });
1970
+ }
1971
+ static {
1972
+ this.ɵdir = i0.ɵɵngDeclareDirective({
1973
+ minVersion: "17.1.0",
1974
+ version: "22.2.5",
1975
+ type: FlowHandleDirective,
1976
+ isStandalone: true,
1977
+ selector: "[flowHandle]",
1978
+ inputs: {
1979
+ type: {
1980
+ classPropertyName: "type",
1981
+ publicName: "type",
1982
+ isSignal: true,
1983
+ isRequired: true,
1984
+ transformFunction: null
1985
+ },
1986
+ side: {
1987
+ classPropertyName: "side",
1988
+ publicName: "side",
1989
+ isSignal: true,
1990
+ isRequired: true,
1991
+ transformFunction: null
1992
+ },
1993
+ handleId: {
1994
+ classPropertyName: "handleId",
1995
+ publicName: "handleId",
1996
+ isSignal: true,
1997
+ isRequired: false,
1998
+ transformFunction: null
1999
+ },
2000
+ connectable: {
2001
+ classPropertyName: "connectable",
2002
+ publicName: "connectable",
2003
+ isSignal: true,
2004
+ isRequired: false,
2005
+ transformFunction: null
2006
+ },
2007
+ connectableStart: {
2008
+ classPropertyName: "connectableStart",
2009
+ publicName: "connectableStart",
2010
+ isSignal: true,
2011
+ isRequired: false,
2012
+ transformFunction: null
2013
+ },
2014
+ connectableEnd: {
2015
+ classPropertyName: "connectableEnd",
2016
+ publicName: "connectableEnd",
2017
+ isSignal: true,
2018
+ isRequired: false,
2019
+ transformFunction: null
2020
+ },
2021
+ nodeId: {
2022
+ classPropertyName: "nodeId",
2023
+ publicName: "nodeId",
2024
+ isSignal: true,
2025
+ isRequired: false,
2026
+ transformFunction: null
2027
+ }
2028
+ },
2029
+ exportAs: ["flowHandle"],
2030
+ ngImport: i0
2031
+ });
2032
+ }
2033
+ };
2034
+ i0.ɵɵngDeclareClassMetadata({
2035
+ minVersion: "12.0.0",
2036
+ version: "22.2.5",
2037
+ ngImport: i0,
2038
+ type: FlowHandleDirective,
2039
+ decorators: [{
2040
+ type: Directive,
2041
+ args: [{
2042
+ selector: "[flowHandle]",
2043
+ exportAs: "flowHandle"
2044
+ }]
2045
+ }],
2046
+ ctorParameters: () => [],
2047
+ propDecorators: {
2048
+ type: [{
2049
+ type: i0.Input,
2050
+ args: [{
2051
+ isSignal: true,
2052
+ alias: "type",
2053
+ required: true
2054
+ }]
2055
+ }],
2056
+ side: [{
2057
+ type: i0.Input,
2058
+ args: [{
2059
+ isSignal: true,
2060
+ alias: "side",
2061
+ required: true
2062
+ }]
2063
+ }],
2064
+ handleId: [{
2065
+ type: i0.Input,
2066
+ args: [{
2067
+ isSignal: true,
2068
+ alias: "handleId",
2069
+ required: false
2070
+ }]
2071
+ }],
2072
+ connectable: [{
2073
+ type: i0.Input,
2074
+ args: [{
2075
+ isSignal: true,
2076
+ alias: "connectable",
2077
+ required: false
2078
+ }]
2079
+ }],
2080
+ connectableStart: [{
2081
+ type: i0.Input,
2082
+ args: [{
2083
+ isSignal: true,
2084
+ alias: "connectableStart",
2085
+ required: false
2086
+ }]
2087
+ }],
2088
+ connectableEnd: [{
2089
+ type: i0.Input,
2090
+ args: [{
2091
+ isSignal: true,
2092
+ alias: "connectableEnd",
2093
+ required: false
2094
+ }]
2095
+ }],
2096
+ nodeId: [{
2097
+ type: i0.Input,
2098
+ args: [{
2099
+ isSignal: true,
2100
+ alias: "nodeId",
2101
+ required: false
2102
+ }]
2103
+ }]
2104
+ }
2105
+ });
2106
+ function injectNode(node) {
2107
+ return bindNode(injectFlowContext("injectNode"), injectHost(), () => valueNow(node));
2108
+ }
2109
+ function bindNode(context, element, node) {
2110
+ const nodeId = computed(() => node()?.id, ...ngDevMode ? [{ debugName: "nodeId" }] : /* istanbul ignore next */ []);
2111
+ const view = flowValue(context, () => {
2112
+ const current = node();
2113
+ if (!current) return void 0;
2114
+ const id = current.id;
2115
+ const engine = context.engine();
2116
+ if (!engine) {
2117
+ const geometry = context.geometry();
2118
+ const rect = geometry?.nodeRects[id];
2119
+ return {
2120
+ attributes: {
2121
+ ...partAttributes("node", id),
2122
+ "data-selected": flag(current.selected === true)
2123
+ },
2124
+ x: rect?.x ?? current.position.x,
2125
+ y: rect?.y ?? current.position.y,
2126
+ zIndex: geometry?.nodeZIndexes[id],
2127
+ focusable: false
2128
+ };
2129
+ }
2130
+ const rect = engine.get("node-rect-by", { nodeId: id });
2131
+ return {
2132
+ attributes: engine.adapter.attributes("node", { nodeId: id }),
2133
+ x: rect?.x ?? current.position.x,
2134
+ y: rect?.y ?? current.position.y,
2135
+ zIndex: engine.get("node-z-index-by", { nodeId: id }),
2136
+ focusable: engine.is("node-focusable", { nodeId: id })
2137
+ };
2138
+ }, void 0, {
2139
+ scope: "entity",
2140
+ entity: entityOf("node", () => node()?.id)
2141
+ });
2142
+ const state = computed(() => {
2143
+ const current = node();
2144
+ const shown = view();
2145
+ if (!current || !shown) return void 0;
2146
+ const { attributes } = shown;
2147
+ return {
2148
+ nodeId: current.id,
2149
+ node: current,
2150
+ x: shown.x,
2151
+ y: shown.y,
2152
+ selected: attributes["data-selected"] !== void 0,
2153
+ dragging: attributes["data-dragging"] !== void 0,
2154
+ resizing: attributes["data-resizing"] !== void 0,
2155
+ measured: attributes["data-measured"] !== void 0,
2156
+ focusable: shown.focusable,
2157
+ attributes
2158
+ };
2159
+ }, ...ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []);
2160
+ const props = computed(() => {
2161
+ const current = node();
2162
+ const shown = view();
2163
+ if (!current || !shown) return {
2164
+ attributes: {},
2165
+ style: {}
2166
+ };
2167
+ return {
2168
+ attributes: {
2169
+ ...shown.attributes,
2170
+ tabindex: shown.focusable ? "0" : void 0
2171
+ },
2172
+ style: {
2173
+ position: "absolute",
2174
+ top: 0,
2175
+ left: 0,
2176
+ transform: `translate(${shown.x}px, ${shown.y}px)`,
2177
+ zIndex: shown.zIndex,
2178
+ width: px(current.width),
2179
+ height: px(current.height)
2180
+ }
2181
+ };
2182
+ }, ...ngDevMode ? [{ debugName: "props" }] : /* istanbul ignore next */ []);
2183
+ bindAttributes(element, () => props().attributes);
2184
+ bindStructuralStyle(element, () => props().style);
2185
+ afterRenderEffect({ earlyRead: (onCleanup) => {
2186
+ const engine = context.engine();
2187
+ const id = nodeId();
2188
+ if (!engine || id === void 0) return;
2189
+ untracked(() => {
2190
+ engine.adapter.registerNode(id, element);
2191
+ onCleanup(() => engine.adapter.registerNode(id, null));
2192
+ });
2193
+ } });
2194
+ return {
2195
+ state,
2196
+ props
2197
+ };
2198
+ }
2199
+ var FlowNodeDirective = class FlowNodeDirective {
2200
+ constructor() {
2201
+ this.flowNode = input.required(...ngDevMode ? [{ debugName: "flowNode" }] : /* istanbul ignore next */ []);
2202
+ this.node = computed(() => beforeInputs(void 0, () => this.flowNode()), ...ngDevMode ? [{ debugName: "node" }] : /* istanbul ignore next */ []);
2203
+ this.context = { nodeId: computed(() => this.node()?.id) };
2204
+ this.state = bindNode(injectFlowContext("[flowNode]"), injectHost(), this.node).state;
2205
+ }
2206
+ static {
2207
+ this.ɵfac = i0.ɵɵngDeclareFactory({
2208
+ minVersion: "12.0.0",
2209
+ version: "22.2.5",
2210
+ ngImport: i0,
2211
+ type: FlowNodeDirective,
2212
+ deps: [],
2213
+ target: i0.ɵɵFactoryTarget.Directive
2214
+ });
2215
+ }
2216
+ static {
2217
+ this.ɵdir = i0.ɵɵngDeclareDirective({
2218
+ minVersion: "17.1.0",
2219
+ version: "22.2.5",
2220
+ type: FlowNodeDirective,
2221
+ isStandalone: true,
2222
+ selector: "[flowNode]",
2223
+ inputs: { flowNode: {
2224
+ classPropertyName: "flowNode",
2225
+ publicName: "flowNode",
2226
+ isSignal: true,
2227
+ isRequired: true,
2228
+ transformFunction: null
2229
+ } },
2230
+ providers: [{
2231
+ provide: FLOW_NODE,
2232
+ useFactory: () => inject(FlowNodeDirective).context
2233
+ }],
2234
+ exportAs: ["flowNode"],
2235
+ ngImport: i0
2236
+ });
2237
+ }
2238
+ };
2239
+ i0.ɵɵngDeclareClassMetadata({
2240
+ minVersion: "12.0.0",
2241
+ version: "22.2.5",
2242
+ ngImport: i0,
2243
+ type: FlowNodeDirective,
2244
+ decorators: [{
2245
+ type: Directive,
2246
+ args: [{
2247
+ selector: "[flowNode]",
2248
+ exportAs: "flowNode",
2249
+ providers: [{
2250
+ provide: FLOW_NODE,
2251
+ useFactory: () => inject(FlowNodeDirective).context
2252
+ }]
2253
+ }]
2254
+ }],
2255
+ propDecorators: { flowNode: [{
2256
+ type: i0.Input,
2257
+ args: [{
2258
+ isSignal: true,
2259
+ alias: "flowNode",
2260
+ required: true
2261
+ }]
2262
+ }] }
2263
+ });
2264
+ var FlowNodeToolbarDirective = class FlowNodeToolbarDirective {
2265
+ constructor() {
2266
+ this.nodeId = input(void 0, ...ngDevMode ? [{ debugName: "nodeId" }] : /* istanbul ignore next */ []);
2267
+ this.nodeIds = input(void 0, ...ngDevMode ? [{ debugName: "nodeIds" }] : /* istanbul ignore next */ []);
2268
+ this.side = input(void 0, ...ngDevMode ? [{ debugName: "side" }] : /* istanbul ignore next */ []);
2269
+ this.align = input(void 0, ...ngDevMode ? [{ debugName: "align" }] : /* istanbul ignore next */ []);
2270
+ this.offset = input(void 0, {
2271
+ ...ngDevMode ? { debugName: "offset" } : /* istanbul ignore next */ {},
2272
+ transform: optionalNumber
2273
+ });
2274
+ this.open = input(void 0, {
2275
+ ...ngDevMode ? { debugName: "open" } : /* istanbul ignore next */ {},
2276
+ transform: optionalBoolean
2277
+ });
2278
+ this.context = injectFlowContext("[flowNodeToolbar]");
2279
+ this.many = computed(() => (beforeInputs(void 0, this.nodeIds)?.length ?? 0) > 0, ...ngDevMode ? [{ debugName: "many" }] : /* istanbul ignore next */ []);
2280
+ this.id = partOwnerId("[flowNodeToolbar]", this.nodeId, injectNodeContext(), "node", () => !this.many());
2281
+ this.view = flowValue(this.context, () => {
2282
+ const engine = this.context.engine();
2283
+ const many = this.many();
2284
+ const nodeId = many ? void 0 : this.id();
2285
+ if (!engine || !many && nodeId === void 0) return void 0;
2286
+ const nodeIds = nodeId === void 0 ? [...this.nodeIds() ?? []] : [nodeId];
2287
+ const model = this.context.model();
2288
+ if (!(this.open() ?? nodeIds.every((id) => model.is("node-selected", { nodeId: id })))) return void 0;
2289
+ const position = engine.get("node-toolbar-by", {
2290
+ ...nodeId === void 0 ? { nodeIds } : { nodeId },
2291
+ side: this.side() ?? "top",
2292
+ align: this.align(),
2293
+ offset: this.offset()
2294
+ });
2295
+ return position ? {
2296
+ position,
2297
+ nodeId,
2298
+ nodeIds,
2299
+ attributes: engine.adapter.attributes("toolbar", nodeId === void 0 ? {} : { nodeId })
2300
+ } : void 0;
2301
+ });
2302
+ this.state = computed(() => {
2303
+ const view = this.view();
2304
+ if (!view) return null;
2305
+ return {
2306
+ nodeId: view.nodeId,
2307
+ nodeIds: view.nodeIds,
2308
+ position: view.position,
2309
+ side: this.side() ?? "top"
2310
+ };
2311
+ }, ...ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []);
2312
+ const host = injectHost();
2313
+ bindAttributes(host, () => this.view()?.attributes ?? {});
2314
+ bindStructuralStyle(host, () => {
2315
+ const position = this.view()?.position;
2316
+ return {
2317
+ position: "absolute",
2318
+ top: 0,
2319
+ left: 0,
2320
+ transform: position ? `translate(${position.x}px, ${position.y}px) translate(${-position.anchorX * 100}%, ${-position.anchorY * 100}%)` : void 0
2321
+ };
2322
+ });
2323
+ bindPresence(host, () => this.state() ? this.context.rootElement : null);
2324
+ }
2325
+ static {
2326
+ this.ɵfac = i0.ɵɵngDeclareFactory({
2327
+ minVersion: "12.0.0",
2328
+ version: "22.2.5",
2329
+ ngImport: i0,
2330
+ type: FlowNodeToolbarDirective,
2331
+ deps: [],
2332
+ target: i0.ɵɵFactoryTarget.Directive
2333
+ });
2334
+ }
2335
+ static {
2336
+ this.ɵdir = i0.ɵɵngDeclareDirective({
2337
+ minVersion: "17.1.0",
2338
+ version: "22.2.5",
2339
+ type: FlowNodeToolbarDirective,
2340
+ isStandalone: true,
2341
+ selector: "[flowNodeToolbar]",
2342
+ inputs: {
2343
+ nodeId: {
2344
+ classPropertyName: "nodeId",
2345
+ publicName: "nodeId",
2346
+ isSignal: true,
2347
+ isRequired: false,
2348
+ transformFunction: null
2349
+ },
2350
+ nodeIds: {
2351
+ classPropertyName: "nodeIds",
2352
+ publicName: "nodeIds",
2353
+ isSignal: true,
2354
+ isRequired: false,
2355
+ transformFunction: null
2356
+ },
2357
+ side: {
2358
+ classPropertyName: "side",
2359
+ publicName: "side",
2360
+ isSignal: true,
2361
+ isRequired: false,
2362
+ transformFunction: null
2363
+ },
2364
+ align: {
2365
+ classPropertyName: "align",
2366
+ publicName: "align",
2367
+ isSignal: true,
2368
+ isRequired: false,
2369
+ transformFunction: null
2370
+ },
2371
+ offset: {
2372
+ classPropertyName: "offset",
2373
+ publicName: "offset",
2374
+ isSignal: true,
2375
+ isRequired: false,
2376
+ transformFunction: null
2377
+ },
2378
+ open: {
2379
+ classPropertyName: "open",
2380
+ publicName: "open",
2381
+ isSignal: true,
2382
+ isRequired: false,
2383
+ transformFunction: null
2384
+ }
2385
+ },
2386
+ exportAs: ["flowNodeToolbar"],
2387
+ ngImport: i0
2388
+ });
2389
+ }
2390
+ };
2391
+ i0.ɵɵngDeclareClassMetadata({
2392
+ minVersion: "12.0.0",
2393
+ version: "22.2.5",
2394
+ ngImport: i0,
2395
+ type: FlowNodeToolbarDirective,
2396
+ decorators: [{
2397
+ type: Directive,
2398
+ args: [{
2399
+ selector: "[flowNodeToolbar]",
2400
+ exportAs: "flowNodeToolbar"
2401
+ }]
2402
+ }],
2403
+ ctorParameters: () => [],
2404
+ propDecorators: {
2405
+ nodeId: [{
2406
+ type: i0.Input,
2407
+ args: [{
2408
+ isSignal: true,
2409
+ alias: "nodeId",
2410
+ required: false
2411
+ }]
2412
+ }],
2413
+ nodeIds: [{
2414
+ type: i0.Input,
2415
+ args: [{
2416
+ isSignal: true,
2417
+ alias: "nodeIds",
2418
+ required: false
2419
+ }]
2420
+ }],
2421
+ side: [{
2422
+ type: i0.Input,
2423
+ args: [{
2424
+ isSignal: true,
2425
+ alias: "side",
2426
+ required: false
2427
+ }]
2428
+ }],
2429
+ align: [{
2430
+ type: i0.Input,
2431
+ args: [{
2432
+ isSignal: true,
2433
+ alias: "align",
2434
+ required: false
2435
+ }]
2436
+ }],
2437
+ offset: [{
2438
+ type: i0.Input,
2439
+ args: [{
2440
+ isSignal: true,
2441
+ alias: "offset",
2442
+ required: false
2443
+ }]
2444
+ }],
2445
+ open: [{
2446
+ type: i0.Input,
2447
+ args: [{
2448
+ isSignal: true,
2449
+ alias: "open",
2450
+ required: false
2451
+ }]
2452
+ }]
2453
+ }
2454
+ });
2455
+ const ATTRIBUTES$1 = partAttributes("nodes");
2456
+ var FlowNodesDirective = class FlowNodesDirective {
2457
+ constructor() {
2458
+ this.context = injectFlowContext("[flowNodes]");
2459
+ this.list = flowValue(this.context, () => {
2460
+ const engine = this.context.engine();
2461
+ if (engine?.adapter.settings.onlyRenderVisible) return engine.get("visible-nodes");
2462
+ if (!engine && this.context.culled()) return [];
2463
+ return this.context.model().get("all-nodes").filter((node) => node.hidden !== true);
2464
+ });
2465
+ this.state = flowValue(this.context, () => ({ count: this.list().length }));
2466
+ const host = injectHost();
2467
+ bindAttributes(host, () => ATTRIBUTES$1);
2468
+ bindStructuralStyle(host, () => ({
2469
+ position: "absolute",
2470
+ top: 0,
2471
+ left: 0,
2472
+ isolation: this.context.layers().length > 1 ? void 0 : "isolate"
2473
+ }));
2474
+ }
2475
+ static {
2476
+ this.ɵfac = i0.ɵɵngDeclareFactory({
2477
+ minVersion: "12.0.0",
2478
+ version: "22.2.5",
2479
+ ngImport: i0,
2480
+ type: FlowNodesDirective,
2481
+ deps: [],
2482
+ target: i0.ɵɵFactoryTarget.Directive
2483
+ });
2484
+ }
2485
+ static {
2486
+ this.ɵdir = i0.ɵɵngDeclareDirective({
2487
+ minVersion: "14.0.0",
2488
+ version: "22.2.5",
2489
+ type: FlowNodesDirective,
2490
+ isStandalone: true,
2491
+ selector: "[flowNodes]",
2492
+ exportAs: ["flowNodes"],
2493
+ ngImport: i0
2494
+ });
2495
+ }
2496
+ };
2497
+ i0.ɵɵngDeclareClassMetadata({
2498
+ minVersion: "12.0.0",
2499
+ version: "22.2.5",
2500
+ ngImport: i0,
2501
+ type: FlowNodesDirective,
2502
+ decorators: [{
2503
+ type: Directive,
2504
+ args: [{
2505
+ selector: "[flowNodes]",
2506
+ exportAs: "flowNodes"
2507
+ }]
2508
+ }],
2509
+ ctorParameters: () => []
2510
+ });
2511
+ var FlowNodesItemDirective = class FlowNodesItemDirective {
2512
+ static ngTemplateContextGuard(_directive, _context) {
2513
+ return true;
2514
+ }
2515
+ constructor() {
2516
+ this.flowNodesItem = input(void 0, ...ngDevMode ? [{ debugName: "flowNodesItem" }] : /* istanbul ignore next */ []);
2517
+ const nodes = inject(FlowNodesDirective, { optional: true });
2518
+ if (!nodes) throw new Error("flowNodesItem must be used inside [flowNodes]");
2519
+ const anchor = inject(ViewContainerRef).element.nativeElement;
2520
+ const views = new SlotViews(anchor, inject(TemplateRef));
2521
+ this.views = views;
2522
+ effect(() => {
2523
+ const list = nodes.list();
2524
+ views.sync(list.map((node) => ({
2525
+ key: node.id,
2526
+ context: {
2527
+ $implicit: node,
2528
+ node
2529
+ }
2530
+ })));
2531
+ });
2532
+ onDestroy(() => views.clear());
2533
+ }
2534
+ ngDoCheck() {
2535
+ this.views.markForCheck();
2536
+ }
2537
+ static {
2538
+ this.ɵfac = i0.ɵɵngDeclareFactory({
2539
+ minVersion: "12.0.0",
2540
+ version: "22.2.5",
2541
+ ngImport: i0,
2542
+ type: FlowNodesItemDirective,
2543
+ deps: [],
2544
+ target: i0.ɵɵFactoryTarget.Directive
2545
+ });
2546
+ }
2547
+ static {
2548
+ this.ɵdir = i0.ɵɵngDeclareDirective({
2549
+ minVersion: "17.1.0",
2550
+ version: "22.2.5",
2551
+ type: FlowNodesItemDirective,
2552
+ isStandalone: true,
2553
+ selector: "ng-template[flowNodesItem]",
2554
+ inputs: { flowNodesItem: {
2555
+ classPropertyName: "flowNodesItem",
2556
+ publicName: "flowNodesItem",
2557
+ isSignal: true,
2558
+ isRequired: false,
2559
+ transformFunction: null
2560
+ } },
2561
+ ngImport: i0
2562
+ });
2563
+ }
2564
+ };
2565
+ i0.ɵɵngDeclareClassMetadata({
2566
+ minVersion: "12.0.0",
2567
+ version: "22.2.5",
2568
+ ngImport: i0,
2569
+ type: FlowNodesItemDirective,
2570
+ decorators: [{
2571
+ type: Directive,
2572
+ args: [{ selector: "ng-template[flowNodesItem]" }]
2573
+ }],
2574
+ ctorParameters: () => [],
2575
+ propDecorators: { flowNodesItem: [{
2576
+ type: i0.Input,
2577
+ args: [{
2578
+ isSignal: true,
2579
+ alias: "flowNodesItem",
2580
+ required: false
2581
+ }]
2582
+ }] }
2583
+ });
2584
+ var FlowNodesSelectionDirective = class FlowNodesSelectionDirective {
2585
+ constructor() {
2586
+ this.context = injectFlowContext("[flowNodesSelection]");
2587
+ this.rect = flowValue(this.context, () => this.context.engine()?.get("selection-rect") ?? null);
2588
+ this.attributes = flowValue(this.context, () => this.context.engine()?.adapter.attributes("nodes-selection") ?? {});
2589
+ this.state = computed(() => {
2590
+ const rect = this.rect();
2591
+ return rect ? {
2592
+ rect,
2593
+ dragging: this.attributes()["data-dragging"] !== void 0
2594
+ } : null;
2595
+ }, ...ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []);
2596
+ const host = injectHost();
2597
+ bindAttributes(host, () => ({
2598
+ ...this.attributes(),
2599
+ "data-flow-part": "nodes-selection"
2600
+ }));
2601
+ bindStructuralStyle(host, () => {
2602
+ const rect = this.rect();
2603
+ return {
2604
+ position: "absolute",
2605
+ top: 0,
2606
+ left: 0,
2607
+ transform: rect ? `translate(${rect.x}px, ${rect.y}px)` : void 0,
2608
+ width: px(rect?.width),
2609
+ height: px(rect?.height)
2610
+ };
2611
+ });
2612
+ bindPresence(host, () => this.rect() ? "here" : null);
2613
+ }
2614
+ static {
2615
+ this.ɵfac = i0.ɵɵngDeclareFactory({
2616
+ minVersion: "12.0.0",
2617
+ version: "22.2.5",
2618
+ ngImport: i0,
2619
+ type: FlowNodesSelectionDirective,
2620
+ deps: [],
2621
+ target: i0.ɵɵFactoryTarget.Directive
2622
+ });
2623
+ }
2624
+ static {
2625
+ this.ɵdir = i0.ɵɵngDeclareDirective({
2626
+ minVersion: "14.0.0",
2627
+ version: "22.2.5",
2628
+ type: FlowNodesSelectionDirective,
2629
+ isStandalone: true,
2630
+ selector: "[flowNodesSelection]",
2631
+ exportAs: ["flowNodesSelection"],
2632
+ ngImport: i0
2633
+ });
2634
+ }
2635
+ };
2636
+ i0.ɵɵngDeclareClassMetadata({
2637
+ minVersion: "12.0.0",
2638
+ version: "22.2.5",
2639
+ ngImport: i0,
2640
+ type: FlowNodesSelectionDirective,
2641
+ decorators: [{
2642
+ type: Directive,
2643
+ args: [{
2644
+ selector: "[flowNodesSelection]",
2645
+ exportAs: "flowNodesSelection"
2646
+ }]
2647
+ }],
2648
+ ctorParameters: () => []
2649
+ });
2650
+ var FlowReconnectAnchorDirective = class FlowReconnectAnchorDirective {
2651
+ constructor() {
2652
+ this.end = input.required(...ngDevMode ? [{ debugName: "end" }] : /* istanbul ignore next */ []);
2653
+ this.edgeId = input(void 0, ...ngDevMode ? [{ debugName: "edgeId" }] : /* istanbul ignore next */ []);
2654
+ this.context = injectFlowContext("[flowReconnectAnchor]");
2655
+ this.id = partOwnerId("[flowReconnectAnchor]", this.edgeId, injectEdgeContext(), "edge");
2656
+ this.path = edgePathOf(this.context, this.id);
2657
+ this.movable = flowValue(this.context, () => {
2658
+ const edgeId = this.id();
2659
+ const end = beforeInputs(void 0, this.end);
2660
+ if (edgeId === void 0 || !end) return true;
2661
+ return this.context.model().is("edge-reconnectable", {
2662
+ edgeId,
2663
+ end
2664
+ });
2665
+ }, void 0, {
2666
+ scope: "entity",
2667
+ entity: entityOf("edge", () => this.id())
2668
+ });
2669
+ this.view = flowValue(this.context, () => {
2670
+ const edgeId = this.id();
2671
+ const engine = this.context.engine();
2672
+ const end = beforeInputs(void 0, this.end);
2673
+ if (edgeId === void 0 || !engine || !end) return void 0;
2674
+ return {
2675
+ end,
2676
+ attributes: engine.adapter.attributes("reconnect-anchor", {
2677
+ edgeId,
2678
+ end
2679
+ }),
2680
+ reconnecting: engine.is("edge-reconnecting", { edgeId })
2681
+ };
2682
+ }, void 0, {
2683
+ scope: "entity",
2684
+ entity: entityOf("edge", () => this.id())
2685
+ });
2686
+ this.state = computed(() => {
2687
+ const edgeId = this.id();
2688
+ const path = this.path();
2689
+ const view = this.view();
2690
+ if (edgeId === void 0 || !path || !view || !this.movable()) return;
2691
+ return {
2692
+ edgeId,
2693
+ end: view.end,
2694
+ path,
2695
+ reconnecting: view.reconnecting
2696
+ };
2697
+ }, ...ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []);
2698
+ const host = injectHost();
2699
+ bindAttributes(host, () => this.view()?.attributes ?? {});
2700
+ bindBaseAttributes(host, () => {
2701
+ const state = this.state();
2702
+ const point = state ? state.path[state.end] : void 0;
2703
+ return {
2704
+ cx: point === void 0 ? void 0 : String(point.x),
2705
+ cy: point === void 0 ? void 0 : String(point.y),
2706
+ r: "10",
2707
+ fill: "transparent"
2708
+ };
2709
+ });
2710
+ bindStructuralStyle(host, () => ({ pointerEvents: "all" }));
2711
+ bindPresence(host, () => this.movable() ? "here" : null);
2712
+ }
2713
+ static {
2714
+ this.ɵfac = i0.ɵɵngDeclareFactory({
2715
+ minVersion: "12.0.0",
2716
+ version: "22.2.5",
2717
+ ngImport: i0,
2718
+ type: FlowReconnectAnchorDirective,
2719
+ deps: [],
2720
+ target: i0.ɵɵFactoryTarget.Directive
2721
+ });
2722
+ }
2723
+ static {
2724
+ this.ɵdir = i0.ɵɵngDeclareDirective({
2725
+ minVersion: "17.1.0",
2726
+ version: "22.2.5",
2727
+ type: FlowReconnectAnchorDirective,
2728
+ isStandalone: true,
2729
+ selector: "[flowReconnectAnchor]",
2730
+ inputs: {
2731
+ end: {
2732
+ classPropertyName: "end",
2733
+ publicName: "end",
2734
+ isSignal: true,
2735
+ isRequired: true,
2736
+ transformFunction: null
2737
+ },
2738
+ edgeId: {
2739
+ classPropertyName: "edgeId",
2740
+ publicName: "edgeId",
2741
+ isSignal: true,
2742
+ isRequired: false,
2743
+ transformFunction: null
2744
+ }
2745
+ },
2746
+ exportAs: ["flowReconnectAnchor"],
2747
+ ngImport: i0
2748
+ });
2749
+ }
2750
+ };
2751
+ i0.ɵɵngDeclareClassMetadata({
2752
+ minVersion: "12.0.0",
2753
+ version: "22.2.5",
2754
+ ngImport: i0,
2755
+ type: FlowReconnectAnchorDirective,
2756
+ decorators: [{
2757
+ type: Directive,
2758
+ args: [{
2759
+ selector: "[flowReconnectAnchor]",
2760
+ exportAs: "flowReconnectAnchor"
2761
+ }]
2762
+ }],
2763
+ ctorParameters: () => [],
2764
+ propDecorators: {
2765
+ end: [{
2766
+ type: i0.Input,
2767
+ args: [{
2768
+ isSignal: true,
2769
+ alias: "end",
2770
+ required: true
2771
+ }]
2772
+ }],
2773
+ edgeId: [{
2774
+ type: i0.Input,
2775
+ args: [{
2776
+ isSignal: true,
2777
+ alias: "edgeId",
2778
+ required: false
2779
+ }]
2780
+ }]
2781
+ }
2782
+ });
2783
+ const slots = /* @__PURE__ */ new WeakMap();
2784
+ function slotOf(ref) {
2785
+ const slot = slots.get(ref);
2786
+ if (!slot) throw new Error("not a flow ref: create it with createFlowRef");
2787
+ return slot;
2788
+ }
2789
+ function createFlowRef() {
2790
+ const slot = signal(null, ...ngDevMode ? [{ debugName: "slot" }] : /* istanbul ignore next */ []);
2791
+ const ref = Object.freeze({ get current() {
2792
+ return slot();
2793
+ } });
2794
+ slots.set(ref, slot);
2795
+ return ref;
2796
+ }
2797
+ function setFlowRef(ref, value) {
2798
+ const slot = slotOf(ref);
2799
+ if (untracked(slot) === value) return;
2800
+ slot.set(value);
2801
+ }
2802
+ const NOT_MOUNTED = Object.freeze({
2803
+ ok: false,
2804
+ error: Object.freeze({
2805
+ code: "refused",
2806
+ message: "the flow is not mounted"
2807
+ })
2808
+ });
2809
+ function createEngineFacade(initial) {
2810
+ let current = null;
2811
+ const listeners = /* @__PURE__ */ new Set();
2812
+ let unsubscribe = () => {};
2813
+ const empty = {
2814
+ get viewport() {
2815
+ return Object.freeze({ ...initial() });
2816
+ },
2817
+ "root-size": Object.freeze({
2818
+ width: 0,
2819
+ height: 0
2820
+ }),
2821
+ "handles-by": Object.freeze([]),
2822
+ "dragging-node-ids": Object.freeze([]),
2823
+ "selection-box": null,
2824
+ connection: null
2825
+ };
2826
+ const forward = (verb, fallback) => (key, payload) => current ? current[verb](key, payload) : fallback(key, payload);
2827
+ return {
2828
+ engine: Object.freeze({
2829
+ run: forward("run", () => NOT_MOUNTED),
2830
+ can: forward("can", () => false),
2831
+ check: forward("check", () => NOT_MOUNTED),
2832
+ get: forward("get", (key) => Object.hasOwn(empty, key) ? empty[key] : void 0),
2833
+ is: forward("is", () => false),
2834
+ subscribe(listener) {
2835
+ const wrapper = (event) => listener(event);
2836
+ listeners.add(wrapper);
2837
+ return () => {
2838
+ listeners.delete(wrapper);
2839
+ };
2840
+ },
2841
+ destroy() {},
2842
+ get adapter() {
2843
+ if (!current) throw new Error("the flow is not mounted");
2844
+ return current.adapter;
2845
+ }
2846
+ }),
2847
+ get current() {
2848
+ return current;
2849
+ },
2850
+ set(next) {
2851
+ if (next === current) return;
2852
+ unsubscribe();
2853
+ current = next;
2854
+ unsubscribe = next ? next.subscribe((event) => {
2855
+ for (const listener of [...listeners]) listener(event);
2856
+ }) : () => {};
2857
+ }
2858
+ };
2859
+ }
2860
+ function outputName(name) {
2861
+ return name.charAt(0).toLowerCase() + name.slice(1);
2862
+ }
2863
+ const CONTROLLED_META = Object.freeze({ source: "controlled" });
2864
+ function notInitialized() {
2865
+ return Object.assign(/* @__PURE__ */ new Error("[flowRoot]: its model is read before its inputs are set (read it from ngOnInit on, or in a template, a computed or an effect)"), { code: -950 });
2866
+ }
2867
+ const DEFAULT_VIEWPORT = Object.freeze({
2868
+ x: 0,
2869
+ y: 0,
2870
+ zoom: 1
2871
+ });
2872
+ function sameLayers(a, b) {
2873
+ const sameIds = (x, y) => x.length === y.length && x.every((id, i) => id === y[i]);
2874
+ return a === b || a.length === b.length && a.every((layer, i) => {
2875
+ const other = b[i];
2876
+ return other !== void 0 && layer.level === other.level && layer.zIndex === other.zIndex && sameIds(layer.edgeIds, other.edgeIds);
2877
+ });
2878
+ }
2879
+ function featureNames(features) {
2880
+ return (features ?? []).map((feature) => feature.name).join(",");
2881
+ }
2882
+ function optionKeys(options) {
2883
+ return Object.fromEntries(Object.entries(options).map(([key, value]) => [key, typeof value === "function" || value === void 0 ? value : JSON.stringify(value)]));
2884
+ }
2885
+ function panOnDragInput(value) {
2886
+ return Array.isArray(value) ? value : optionalBoolean(value);
2887
+ }
2888
+ function autoPanInput(value) {
2889
+ return value !== null && typeof value === "object" ? value : optionalBoolean(value);
2890
+ }
2891
+ function fitViewInput(value) {
2892
+ if (value === "") return true;
2893
+ return value ?? void 0;
2894
+ }
2895
+ var FlowRootDirective = class FlowRootDirective {
2896
+ renderSoon() {
2897
+ if (this.renderQueued) return;
2898
+ this.renderQueued = true;
2899
+ queueMicrotask(() => {
2900
+ this.renderQueued = false;
2901
+ if (this.application.destroyed) return;
2902
+ try {
2903
+ this.application.tick();
2904
+ } catch (error) {
2905
+ this.errorHandler.handleError(error);
2906
+ }
2907
+ });
2908
+ }
2909
+ constructor() {
2910
+ this.modelInput = input(void 0, {
2911
+ ...ngDevMode ? { debugName: "modelInput" } : /* istanbul ignore next */ {},
2912
+ alias: "model"
2913
+ });
2914
+ this.defaultNodes = input(void 0, ...ngDevMode ? [{ debugName: "defaultNodes" }] : /* istanbul ignore next */ []);
2915
+ this.defaultEdges = input(void 0, ...ngDevMode ? [{ debugName: "defaultEdges" }] : /* istanbul ignore next */ []);
2916
+ this.nodes = input(void 0, ...ngDevMode ? [{ debugName: "nodes" }] : /* istanbul ignore next */ []);
2917
+ this.edges = input(void 0, ...ngDevMode ? [{ debugName: "edges" }] : /* istanbul ignore next */ []);
2918
+ this.features = input(void 0, ...ngDevMode ? [{ debugName: "features" }] : /* istanbul ignore next */ []);
2919
+ this.createId = input(void 0, ...ngDevMode ? [{ debugName: "createId" }] : /* istanbul ignore next */ []);
2920
+ this.defaultEdgeOptions = input(void 0, ...ngDevMode ? [{ debugName: "defaultEdgeOptions" }] : /* istanbul ignore next */ []);
2921
+ this.viewport = input(void 0, ...ngDevMode ? [{ debugName: "viewport" }] : /* istanbul ignore next */ []);
2922
+ this.defaultViewport = input(void 0, ...ngDevMode ? [{ debugName: "defaultViewport" }] : /* istanbul ignore next */ []);
2923
+ this.fitView = input(void 0, {
2924
+ ...ngDevMode ? { debugName: "fitView" } : /* istanbul ignore next */ {},
2925
+ transform: fitViewInput
2926
+ });
2927
+ this.flowRef = input(void 0, ...ngDevMode ? [{ debugName: "flowRef" }] : /* istanbul ignore next */ []);
2928
+ this.minZoom = input(void 0, {
2929
+ ...ngDevMode ? { debugName: "minZoom" } : /* istanbul ignore next */ {},
2930
+ transform: optionalNumber
2931
+ });
2932
+ this.maxZoom = input(void 0, {
2933
+ ...ngDevMode ? { debugName: "maxZoom" } : /* istanbul ignore next */ {},
2934
+ transform: optionalNumber
2935
+ });
2936
+ this.translateExtent = input(void 0, ...ngDevMode ? [{ debugName: "translateExtent" }] : /* istanbul ignore next */ []);
2937
+ this.panOnDrag = input(void 0, {
2938
+ ...ngDevMode ? { debugName: "panOnDrag" } : /* istanbul ignore next */ {},
2939
+ transform: panOnDragInput
2940
+ });
2941
+ this.panOnScroll = input(void 0, {
2942
+ ...ngDevMode ? { debugName: "panOnScroll" } : /* istanbul ignore next */ {},
2943
+ transform: optionalBoolean
2944
+ });
2945
+ this.zoomOnScroll = input(void 0, {
2946
+ ...ngDevMode ? { debugName: "zoomOnScroll" } : /* istanbul ignore next */ {},
2947
+ transform: optionalBoolean
2948
+ });
2949
+ this.zoomOnPinch = input(void 0, {
2950
+ ...ngDevMode ? { debugName: "zoomOnPinch" } : /* istanbul ignore next */ {},
2951
+ transform: optionalBoolean
2952
+ });
2953
+ this.zoomOnDoubleClick = input(void 0, {
2954
+ ...ngDevMode ? { debugName: "zoomOnDoubleClick" } : /* istanbul ignore next */ {},
2955
+ transform: optionalBoolean
2956
+ });
2957
+ this.zoomStep = input(void 0, {
2958
+ ...ngDevMode ? { debugName: "zoomStep" } : /* istanbul ignore next */ {},
2959
+ transform: optionalNumber
2960
+ });
2961
+ this.interactive = input(void 0, {
2962
+ ...ngDevMode ? { debugName: "interactive" } : /* istanbul ignore next */ {},
2963
+ transform: optionalBoolean
2964
+ });
2965
+ this.onlyRenderVisible = input(void 0, {
2966
+ ...ngDevMode ? { debugName: "onlyRenderVisible" } : /* istanbul ignore next */ {},
2967
+ transform: optionalBoolean
2968
+ });
2969
+ this.pathOptions = input(void 0, ...ngDevMode ? [{ debugName: "pathOptions" }] : /* istanbul ignore next */ []);
2970
+ this.autoPan = input(void 0, {
2971
+ ...ngDevMode ? { debugName: "autoPan" } : /* istanbul ignore next */ {},
2972
+ transform: autoPanInput
2973
+ });
2974
+ this.panActivationKey = input(void 0, ...ngDevMode ? [{ debugName: "panActivationKey" }] : /* istanbul ignore next */ []);
2975
+ this.panOnScrollMode = input(void 0, ...ngDevMode ? [{ debugName: "panOnScrollMode" }] : /* istanbul ignore next */ []);
2976
+ this.panOnScrollSpeed = input(void 0, {
2977
+ ...ngDevMode ? { debugName: "panOnScrollSpeed" } : /* istanbul ignore next */ {},
2978
+ transform: optionalNumber
2979
+ });
2980
+ this.zoomActivationKey = input(void 0, ...ngDevMode ? [{ debugName: "zoomActivationKey" }] : /* istanbul ignore next */ []);
2981
+ this.easing = input(void 0, ...ngDevMode ? [{ debugName: "easing" }] : /* istanbul ignore next */ []);
2982
+ this.nodeOrigin = input(void 0, ...ngDevMode ? [{ debugName: "nodeOrigin" }] : /* istanbul ignore next */ []);
2983
+ this.nodeExtent = input(void 0, ...ngDevMode ? [{ debugName: "nodeExtent" }] : /* istanbul ignore next */ []);
2984
+ this.elevateNodesOnSelect = input(void 0, {
2985
+ ...ngDevMode ? { debugName: "elevateNodesOnSelect" } : /* istanbul ignore next */ {},
2986
+ transform: optionalBoolean
2987
+ });
2988
+ this.elevateEdgesOnSelect = input(void 0, {
2989
+ ...ngDevMode ? { debugName: "elevateEdgesOnSelect" } : /* istanbul ignore next */ {},
2990
+ transform: optionalBoolean
2991
+ });
2992
+ this.zIndexMode = input(void 0, ...ngDevMode ? [{ debugName: "zIndexMode" }] : /* istanbul ignore next */ []);
2993
+ this.paneClickDistance = input(void 0, {
2994
+ ...ngDevMode ? { debugName: "paneClickDistance" } : /* istanbul ignore next */ {},
2995
+ transform: optionalNumber
2996
+ });
2997
+ this.nodeClickDistance = input(void 0, {
2998
+ ...ngDevMode ? { debugName: "nodeClickDistance" } : /* istanbul ignore next */ {},
2999
+ transform: optionalNumber
3000
+ });
3001
+ this.preventScrolling = input(void 0, {
3002
+ ...ngDevMode ? { debugName: "preventScrolling" } : /* istanbul ignore next */ {},
3003
+ transform: optionalBoolean
3004
+ });
3005
+ this.nodesFocusable = input(void 0, {
3006
+ ...ngDevMode ? { debugName: "nodesFocusable" } : /* istanbul ignore next */ {},
3007
+ transform: optionalBoolean
3008
+ });
3009
+ this.edgesFocusable = input(void 0, {
3010
+ ...ngDevMode ? { debugName: "edgesFocusable" } : /* istanbul ignore next */ {},
3011
+ transform: optionalBoolean
3012
+ });
3013
+ this.nodesChange = output();
3014
+ this.edgesChange = output();
3015
+ this.viewportChange = output();
3016
+ this.viewportMove = output();
3017
+ this.moveStart = output();
3018
+ this.moveEnd = output();
3019
+ this.init = output();
3020
+ this.nodeClick = output();
3021
+ this.nodeDoubleClick = output();
3022
+ this.nodeContextMenu = output();
3023
+ this.edgeClick = output();
3024
+ this.edgeDoubleClick = output();
3025
+ this.edgeContextMenu = output();
3026
+ this.paneClick = output();
3027
+ this.paneDoubleClick = output();
3028
+ this.paneContextMenu = output();
3029
+ this.selectionContextMenu = output();
3030
+ this.selectionStart = output();
3031
+ this.selectionEnd = output();
3032
+ this.nodeDragStart = output();
3033
+ this.nodesMove = output();
3034
+ this.nodeDragCancel = output();
3035
+ this.selectionDragStart = output();
3036
+ this.selectionDrag = output();
3037
+ this.selectionDragStop = output();
3038
+ this.connectStart = output();
3039
+ this.connectTarget = output();
3040
+ this.connect = output();
3041
+ this.connectCancel = output();
3042
+ this.reconnectStart = output();
3043
+ this.reconnect = output();
3044
+ this.reconnectCancel = output();
3045
+ this.resizeStart = output();
3046
+ this.resizeEnd = output();
3047
+ this.resizeCancel = output();
3048
+ this.delete = output();
3049
+ this.eventOutputs = new Map(Object.entries(ENGINE_EVENT_CALLBACKS).map(([type, name]) => [type, this[outputName(name)]]));
3050
+ this.host = injectHost();
3051
+ this.initialized = signal(false, ...ngDevMode ? [{ debugName: "initialized" }] : /* istanbul ignore next */ []);
3052
+ this.model = computed(() => {
3053
+ if (!this.initialized()) throw notInitialized();
3054
+ const given = this.modelInput();
3055
+ if (given) return given;
3056
+ this.own ??= untracked(() => {
3057
+ const features = this.features();
3058
+ this.createdWith = featureNames(features);
3059
+ return createFlowModel({
3060
+ version: 1,
3061
+ nodes: [...this.nodes() ?? this.defaultNodes() ?? []],
3062
+ edges: [...this.edges() ?? this.defaultEdges() ?? []]
3063
+ }, {
3064
+ features,
3065
+ createId: this.createId(),
3066
+ defaultEdgeOptions: this.defaultEdgeOptions()
3067
+ });
3068
+ });
3069
+ return this.own;
3070
+ }, ...ngDevMode ? [{ debugName: "model" }] : /* istanbul ignore next */ []);
3071
+ this.erased = computed(() => eraseModel(this.model()), ...ngDevMode ? [{ debugName: "erased" }] : /* istanbul ignore next */ []);
3072
+ this.facade = createEngineFacade(() => this.start ?? this.viewport() ?? this.defaultViewport() ?? DEFAULT_VIEWPORT);
3073
+ this.engine = typedEngine(this.facade.engine);
3074
+ this.current = signal(null, ...ngDevMode ? [{ debugName: "current" }] : /* istanbul ignore next */ []);
3075
+ this.store = createFlowStore();
3076
+ this.revision = this.store.view;
3077
+ this.committed = (model) => {
3078
+ this.store.commit(model);
3079
+ this.renderSoon();
3080
+ };
3081
+ this.application = inject(ApplicationRef);
3082
+ this.errorHandler = inject(ErrorHandler);
3083
+ this.renderQueued = false;
3084
+ this.geometry = computed(() => {
3085
+ if (this.current()) return null;
3086
+ this.store.entity();
3087
+ const model = this.erased();
3088
+ const props = this.engineProps();
3089
+ const options = {
3090
+ nodeOrigin: props.nodeOrigin,
3091
+ pathOptions: props.pathOptions,
3092
+ zIndexMode: props.zIndexMode,
3093
+ elevateNodesOnSelect: props.elevateNodesOnSelect,
3094
+ elevateEdgesOnSelect: props.elevateEdgesOnSelect
3095
+ };
3096
+ return untracked(() => {
3097
+ const nodes = model.get("all-nodes");
3098
+ const edges = model.get("all-edges");
3099
+ const key = JSON.stringify(options);
3100
+ const last = this.staticFrom;
3101
+ if (last?.nodes === nodes && last.edges === edges && last.options === key) return last.geometry;
3102
+ const geometry = staticGeometry({
3103
+ nodes,
3104
+ edges
3105
+ }, options);
3106
+ this.staticFrom = {
3107
+ nodes,
3108
+ edges,
3109
+ options: key,
3110
+ geometry
3111
+ };
3112
+ return geometry;
3113
+ });
3114
+ }, ...ngDevMode ? [{ debugName: "geometry" }] : /* istanbul ignore next */ []);
3115
+ this.layers = computed(() => {
3116
+ this.revision();
3117
+ const live = this.current();
3118
+ return live ? live.get("render-layers") : this.geometry()?.layers ?? [];
3119
+ }, {
3120
+ ...ngDevMode ? { debugName: "layers" } : /* istanbul ignore next */ {},
3121
+ equal: sameLayers
3122
+ });
3123
+ this.context = {
3124
+ model: this.erased,
3125
+ engine: this.current.asReadonly(),
3126
+ publicEngine: this.facade.engine,
3127
+ rootElement: this.host,
3128
+ revision: this.revision,
3129
+ store: this.store,
3130
+ culled: computed(() => this.onlyRenderVisible() === true),
3131
+ geometry: this.geometry,
3132
+ layers: this.layers
3133
+ };
3134
+ this.attributes = flowValue(this.context, () => {
3135
+ const live = this.current();
3136
+ return live ? live.adapter.attributes("root") : partAttributes("root");
3137
+ });
3138
+ this.state = computed(() => {
3139
+ const attributes = this.attributes();
3140
+ return {
3141
+ interactive: this.current() ? attributes["data-interactive"] !== void 0 : true,
3142
+ panning: attributes["data-panning"] !== void 0,
3143
+ dragging: attributes["data-dragging"] !== void 0,
3144
+ connecting: attributes["data-connecting"] !== void 0,
3145
+ selecting: attributes["data-selecting"] !== void 0
3146
+ };
3147
+ }, ...ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []);
3148
+ this.engineProps = computed(() => ({
3149
+ minZoom: this.minZoom(),
3150
+ maxZoom: this.maxZoom(),
3151
+ translateExtent: this.translateExtent(),
3152
+ panOnDrag: this.panOnDrag(),
3153
+ panOnScroll: this.panOnScroll(),
3154
+ zoomOnScroll: this.zoomOnScroll(),
3155
+ zoomOnPinch: this.zoomOnPinch(),
3156
+ zoomOnDoubleClick: this.zoomOnDoubleClick(),
3157
+ zoomStep: this.zoomStep(),
3158
+ interactive: this.interactive(),
3159
+ onlyRenderVisible: this.onlyRenderVisible(),
3160
+ pathOptions: this.pathOptions(),
3161
+ autoPan: this.autoPan(),
3162
+ panActivationKey: this.panActivationKey(),
3163
+ panOnScrollMode: this.panOnScrollMode(),
3164
+ panOnScrollSpeed: this.panOnScrollSpeed(),
3165
+ zoomActivationKey: this.zoomActivationKey(),
3166
+ easing: this.easing(),
3167
+ nodeOrigin: this.nodeOrigin(),
3168
+ nodeExtent: this.nodeExtent(),
3169
+ elevateNodesOnSelect: this.elevateNodesOnSelect(),
3170
+ elevateEdgesOnSelect: this.elevateEdgesOnSelect(),
3171
+ zIndexMode: this.zIndexMode(),
3172
+ paneClickDistance: this.paneClickDistance(),
3173
+ nodeClickDistance: this.nodeClickDistance(),
3174
+ preventScrolling: this.preventScrolling(),
3175
+ nodesFocusable: this.nodesFocusable(),
3176
+ edgesFocusable: this.edgesFocusable()
3177
+ }), ...ngDevMode ? [{ debugName: "engineProps" }] : /* istanbul ignore next */ []);
3178
+ this.sent = {
3179
+ model: void 0,
3180
+ nodes: void 0,
3181
+ edges: void 0
3182
+ };
3183
+ bindStructuralStyle(this.host, () => ({
3184
+ position: "relative",
3185
+ overflow: "hidden"
3186
+ }));
3187
+ bindAttributes(this.host, this.attributes);
3188
+ const warned = /* @__PURE__ */ new Set();
3189
+ const warn = (message) => {
3190
+ if (warned.has(message)) return;
3191
+ warned.add(message);
3192
+ console.warn(`[@fragiola/flow-angular] ${message}`);
3193
+ };
3194
+ effect(() => {
3195
+ const names = featureNames(this.features());
3196
+ this.model();
3197
+ untracked(() => {
3198
+ if (!this.modelInput() && this.createdWith !== void 0 && names !== this.createdWith) warn("the features input changed after the root created its model: the change is ignored (the features are fixed when the model is created)");
3199
+ });
3200
+ });
3201
+ effect((onCleanup) => {
3202
+ const model = this.erased();
3203
+ onCleanup(model.subscribe((event) => {
3204
+ this.committed(model);
3205
+ if (event.meta?.source === CONTROLLED_META.source) return;
3206
+ if (event.before.nodes !== event.after.nodes) this.nodesChange.emit(event.after.nodes);
3207
+ if (event.before.edges !== event.after.edges) this.edgesChange.emit(event.after.edges);
3208
+ }));
3209
+ untracked(() => this.committed(model));
3210
+ });
3211
+ effect(() => {
3212
+ const model = this.erased();
3213
+ const nodes = this.nodes();
3214
+ const edges = this.edges();
3215
+ untracked(() => this.syncControlled(model, nodes, edges, warn));
3216
+ });
3217
+ let sentOptions = {};
3218
+ const rendered = signal(false, ...ngDevMode ? [{ debugName: "rendered" }] : /* istanbul ignore next */ []);
3219
+ afterNextRender(() => rendered.set(true));
3220
+ effect((onCleanup) => {
3221
+ if (!rendered()) return;
3222
+ const model = this.erased();
3223
+ untracked(() => {
3224
+ const options = this.engineProps();
3225
+ const created = createFlowEngine(model, {
3226
+ ...options,
3227
+ defaultViewport: { ...this.start ?? this.viewport() ?? this.defaultViewport() ?? DEFAULT_VIEWPORT },
3228
+ fitView: this.fitView()
3229
+ });
3230
+ sentOptions = optionKeys(options);
3231
+ const stops = [this.store.attach(created, () => this.renderSoon()), created.subscribe((event) => {
3232
+ if (event.type !== "viewport-change") {
3233
+ this.eventOutputs.get(event.type)?.emit(event);
3234
+ return;
3235
+ }
3236
+ this.start = event.viewport;
3237
+ this.viewportChange.emit(event.viewport);
3238
+ this.viewportMove.emit({
3239
+ viewport: event.viewport,
3240
+ gesture: event.gesture
3241
+ });
3242
+ })];
3243
+ this.facade.set(created);
3244
+ created.adapter.attachRoot(this.host);
3245
+ this.current.set(created);
3246
+ onCleanup(() => {
3247
+ for (const stop of stops) stop();
3248
+ this.start = created.get("viewport");
3249
+ this.current.set(null);
3250
+ this.facade.set(null);
3251
+ created.adapter.detachRoot();
3252
+ created.destroy();
3253
+ });
3254
+ });
3255
+ });
3256
+ effect(() => {
3257
+ const live = this.current();
3258
+ const options = this.engineProps();
3259
+ if (!live) return;
3260
+ untracked(() => {
3261
+ const next = optionKeys(options);
3262
+ const changed = Object.keys(next).filter((key) => next[key] !== sentOptions[key]);
3263
+ sentOptions = next;
3264
+ if (changed.length === 0) return;
3265
+ const values = options;
3266
+ live.adapter.setOptions(Object.fromEntries(changed.map((key) => [key, values[key]])));
3267
+ });
3268
+ });
3269
+ effect(() => {
3270
+ const live = this.current();
3271
+ const viewport = this.viewport();
3272
+ if (!live || !viewport) return;
3273
+ const { x, y, zoom } = viewport;
3274
+ untracked(() => {
3275
+ const current = live.get("viewport");
3276
+ if (current.x !== x || current.y !== y || current.zoom !== zoom) live.run("set-viewport", {
3277
+ x,
3278
+ y,
3279
+ zoom
3280
+ });
3281
+ });
3282
+ });
3283
+ effect((onCleanup) => {
3284
+ const ref = this.flowRef();
3285
+ const model = this.model();
3286
+ if (!ref) return;
3287
+ untracked(() => setFlowRef(ref, {
3288
+ model,
3289
+ engine: this.facade.engine
3290
+ }));
3291
+ onCleanup(() => setFlowRef(ref, null));
3292
+ });
3293
+ onDestroy(() => this.facade.set(null));
3294
+ }
3295
+ ngOnInit() {
3296
+ this.initialized.set(true);
3297
+ }
3298
+ syncControlled(model, nodes, edges, warn) {
3299
+ const previous = this.sent;
3300
+ const sameModel = previous.model === model;
3301
+ const created = !sameModel && this.own !== void 0 && !this.modelInput();
3302
+ const target = {
3303
+ nodes: created || sameModel && previous.nodes === nodes || nodes === model.get("all-nodes") ? void 0 : nodes,
3304
+ edges: created || sameModel && previous.edges === edges || edges === model.get("all-edges") ? void 0 : edges
3305
+ };
3306
+ this.sent = {
3307
+ model,
3308
+ nodes,
3309
+ edges
3310
+ };
3311
+ if (target.nodes === void 0 && target.edges === void 0) return;
3312
+ const commands = model.get("commands-to", target);
3313
+ if (commands.length === 0) return;
3314
+ const options = { meta: CONTROLLED_META };
3315
+ if (!model.run("batch", { commands: [...commands] }, options).ok) {
3316
+ const refused = [];
3317
+ for (const entry of commands) {
3318
+ const result = model.run("batch", { commands: [entry] }, options);
3319
+ if (!result.ok) refused.push(`${entry.command}: ${result.error.message}`);
3320
+ }
3321
+ warn(`the controlled nodes / edges were not all applied (the model's are reported back):\n${refused.join("\n")}`);
3322
+ }
3323
+ if (target.nodes !== void 0 && model.get("commands-to", { nodes: target.nodes }).length > 0) {
3324
+ const held = model.get("all-nodes");
3325
+ this.sent = {
3326
+ ...this.sent,
3327
+ nodes: held
3328
+ };
3329
+ this.nodesChange.emit(held);
3330
+ }
3331
+ if (target.edges !== void 0 && model.get("commands-to", { edges: target.edges }).length > 0) {
3332
+ const held = model.get("all-edges");
3333
+ this.sent = {
3334
+ ...this.sent,
3335
+ edges: held
3336
+ };
3337
+ this.edgesChange.emit(held);
3338
+ }
3339
+ }
3340
+ static {
3341
+ this.ɵfac = i0.ɵɵngDeclareFactory({
3342
+ minVersion: "12.0.0",
3343
+ version: "22.2.5",
3344
+ ngImport: i0,
3345
+ type: FlowRootDirective,
3346
+ deps: [],
3347
+ target: i0.ɵɵFactoryTarget.Directive
3348
+ });
3349
+ }
3350
+ static {
3351
+ this.ɵdir = i0.ɵɵngDeclareDirective({
3352
+ minVersion: "17.1.0",
3353
+ version: "22.2.5",
3354
+ type: FlowRootDirective,
3355
+ isStandalone: true,
3356
+ selector: "[flowRoot]",
3357
+ inputs: {
3358
+ modelInput: {
3359
+ classPropertyName: "modelInput",
3360
+ publicName: "model",
3361
+ isSignal: true,
3362
+ isRequired: false,
3363
+ transformFunction: null
3364
+ },
3365
+ defaultNodes: {
3366
+ classPropertyName: "defaultNodes",
3367
+ publicName: "defaultNodes",
3368
+ isSignal: true,
3369
+ isRequired: false,
3370
+ transformFunction: null
3371
+ },
3372
+ defaultEdges: {
3373
+ classPropertyName: "defaultEdges",
3374
+ publicName: "defaultEdges",
3375
+ isSignal: true,
3376
+ isRequired: false,
3377
+ transformFunction: null
3378
+ },
3379
+ nodes: {
3380
+ classPropertyName: "nodes",
3381
+ publicName: "nodes",
3382
+ isSignal: true,
3383
+ isRequired: false,
3384
+ transformFunction: null
3385
+ },
3386
+ edges: {
3387
+ classPropertyName: "edges",
3388
+ publicName: "edges",
3389
+ isSignal: true,
3390
+ isRequired: false,
3391
+ transformFunction: null
3392
+ },
3393
+ features: {
3394
+ classPropertyName: "features",
3395
+ publicName: "features",
3396
+ isSignal: true,
3397
+ isRequired: false,
3398
+ transformFunction: null
3399
+ },
3400
+ createId: {
3401
+ classPropertyName: "createId",
3402
+ publicName: "createId",
3403
+ isSignal: true,
3404
+ isRequired: false,
3405
+ transformFunction: null
3406
+ },
3407
+ defaultEdgeOptions: {
3408
+ classPropertyName: "defaultEdgeOptions",
3409
+ publicName: "defaultEdgeOptions",
3410
+ isSignal: true,
3411
+ isRequired: false,
3412
+ transformFunction: null
3413
+ },
3414
+ viewport: {
3415
+ classPropertyName: "viewport",
3416
+ publicName: "viewport",
3417
+ isSignal: true,
3418
+ isRequired: false,
3419
+ transformFunction: null
3420
+ },
3421
+ defaultViewport: {
3422
+ classPropertyName: "defaultViewport",
3423
+ publicName: "defaultViewport",
3424
+ isSignal: true,
3425
+ isRequired: false,
3426
+ transformFunction: null
3427
+ },
3428
+ fitView: {
3429
+ classPropertyName: "fitView",
3430
+ publicName: "fitView",
3431
+ isSignal: true,
3432
+ isRequired: false,
3433
+ transformFunction: null
3434
+ },
3435
+ flowRef: {
3436
+ classPropertyName: "flowRef",
3437
+ publicName: "flowRef",
3438
+ isSignal: true,
3439
+ isRequired: false,
3440
+ transformFunction: null
3441
+ },
3442
+ minZoom: {
3443
+ classPropertyName: "minZoom",
3444
+ publicName: "minZoom",
3445
+ isSignal: true,
3446
+ isRequired: false,
3447
+ transformFunction: null
3448
+ },
3449
+ maxZoom: {
3450
+ classPropertyName: "maxZoom",
3451
+ publicName: "maxZoom",
3452
+ isSignal: true,
3453
+ isRequired: false,
3454
+ transformFunction: null
3455
+ },
3456
+ translateExtent: {
3457
+ classPropertyName: "translateExtent",
3458
+ publicName: "translateExtent",
3459
+ isSignal: true,
3460
+ isRequired: false,
3461
+ transformFunction: null
3462
+ },
3463
+ panOnDrag: {
3464
+ classPropertyName: "panOnDrag",
3465
+ publicName: "panOnDrag",
3466
+ isSignal: true,
3467
+ isRequired: false,
3468
+ transformFunction: null
3469
+ },
3470
+ panOnScroll: {
3471
+ classPropertyName: "panOnScroll",
3472
+ publicName: "panOnScroll",
3473
+ isSignal: true,
3474
+ isRequired: false,
3475
+ transformFunction: null
3476
+ },
3477
+ zoomOnScroll: {
3478
+ classPropertyName: "zoomOnScroll",
3479
+ publicName: "zoomOnScroll",
3480
+ isSignal: true,
3481
+ isRequired: false,
3482
+ transformFunction: null
3483
+ },
3484
+ zoomOnPinch: {
3485
+ classPropertyName: "zoomOnPinch",
3486
+ publicName: "zoomOnPinch",
3487
+ isSignal: true,
3488
+ isRequired: false,
3489
+ transformFunction: null
3490
+ },
3491
+ zoomOnDoubleClick: {
3492
+ classPropertyName: "zoomOnDoubleClick",
3493
+ publicName: "zoomOnDoubleClick",
3494
+ isSignal: true,
3495
+ isRequired: false,
3496
+ transformFunction: null
3497
+ },
3498
+ zoomStep: {
3499
+ classPropertyName: "zoomStep",
3500
+ publicName: "zoomStep",
3501
+ isSignal: true,
3502
+ isRequired: false,
3503
+ transformFunction: null
3504
+ },
3505
+ interactive: {
3506
+ classPropertyName: "interactive",
3507
+ publicName: "interactive",
3508
+ isSignal: true,
3509
+ isRequired: false,
3510
+ transformFunction: null
3511
+ },
3512
+ onlyRenderVisible: {
3513
+ classPropertyName: "onlyRenderVisible",
3514
+ publicName: "onlyRenderVisible",
3515
+ isSignal: true,
3516
+ isRequired: false,
3517
+ transformFunction: null
3518
+ },
3519
+ pathOptions: {
3520
+ classPropertyName: "pathOptions",
3521
+ publicName: "pathOptions",
3522
+ isSignal: true,
3523
+ isRequired: false,
3524
+ transformFunction: null
3525
+ },
3526
+ autoPan: {
3527
+ classPropertyName: "autoPan",
3528
+ publicName: "autoPan",
3529
+ isSignal: true,
3530
+ isRequired: false,
3531
+ transformFunction: null
3532
+ },
3533
+ panActivationKey: {
3534
+ classPropertyName: "panActivationKey",
3535
+ publicName: "panActivationKey",
3536
+ isSignal: true,
3537
+ isRequired: false,
3538
+ transformFunction: null
3539
+ },
3540
+ panOnScrollMode: {
3541
+ classPropertyName: "panOnScrollMode",
3542
+ publicName: "panOnScrollMode",
3543
+ isSignal: true,
3544
+ isRequired: false,
3545
+ transformFunction: null
3546
+ },
3547
+ panOnScrollSpeed: {
3548
+ classPropertyName: "panOnScrollSpeed",
3549
+ publicName: "panOnScrollSpeed",
3550
+ isSignal: true,
3551
+ isRequired: false,
3552
+ transformFunction: null
3553
+ },
3554
+ zoomActivationKey: {
3555
+ classPropertyName: "zoomActivationKey",
3556
+ publicName: "zoomActivationKey",
3557
+ isSignal: true,
3558
+ isRequired: false,
3559
+ transformFunction: null
3560
+ },
3561
+ easing: {
3562
+ classPropertyName: "easing",
3563
+ publicName: "easing",
3564
+ isSignal: true,
3565
+ isRequired: false,
3566
+ transformFunction: null
3567
+ },
3568
+ nodeOrigin: {
3569
+ classPropertyName: "nodeOrigin",
3570
+ publicName: "nodeOrigin",
3571
+ isSignal: true,
3572
+ isRequired: false,
3573
+ transformFunction: null
3574
+ },
3575
+ nodeExtent: {
3576
+ classPropertyName: "nodeExtent",
3577
+ publicName: "nodeExtent",
3578
+ isSignal: true,
3579
+ isRequired: false,
3580
+ transformFunction: null
3581
+ },
3582
+ elevateNodesOnSelect: {
3583
+ classPropertyName: "elevateNodesOnSelect",
3584
+ publicName: "elevateNodesOnSelect",
3585
+ isSignal: true,
3586
+ isRequired: false,
3587
+ transformFunction: null
3588
+ },
3589
+ elevateEdgesOnSelect: {
3590
+ classPropertyName: "elevateEdgesOnSelect",
3591
+ publicName: "elevateEdgesOnSelect",
3592
+ isSignal: true,
3593
+ isRequired: false,
3594
+ transformFunction: null
3595
+ },
3596
+ zIndexMode: {
3597
+ classPropertyName: "zIndexMode",
3598
+ publicName: "zIndexMode",
3599
+ isSignal: true,
3600
+ isRequired: false,
3601
+ transformFunction: null
3602
+ },
3603
+ paneClickDistance: {
3604
+ classPropertyName: "paneClickDistance",
3605
+ publicName: "paneClickDistance",
3606
+ isSignal: true,
3607
+ isRequired: false,
3608
+ transformFunction: null
3609
+ },
3610
+ nodeClickDistance: {
3611
+ classPropertyName: "nodeClickDistance",
3612
+ publicName: "nodeClickDistance",
3613
+ isSignal: true,
3614
+ isRequired: false,
3615
+ transformFunction: null
3616
+ },
3617
+ preventScrolling: {
3618
+ classPropertyName: "preventScrolling",
3619
+ publicName: "preventScrolling",
3620
+ isSignal: true,
3621
+ isRequired: false,
3622
+ transformFunction: null
3623
+ },
3624
+ nodesFocusable: {
3625
+ classPropertyName: "nodesFocusable",
3626
+ publicName: "nodesFocusable",
3627
+ isSignal: true,
3628
+ isRequired: false,
3629
+ transformFunction: null
3630
+ },
3631
+ edgesFocusable: {
3632
+ classPropertyName: "edgesFocusable",
3633
+ publicName: "edgesFocusable",
3634
+ isSignal: true,
3635
+ isRequired: false,
3636
+ transformFunction: null
3637
+ }
3638
+ },
3639
+ outputs: {
3640
+ nodesChange: "nodesChange",
3641
+ edgesChange: "edgesChange",
3642
+ viewportChange: "viewportChange",
3643
+ viewportMove: "viewportMove",
3644
+ moveStart: "moveStart",
3645
+ moveEnd: "moveEnd",
3646
+ init: "init",
3647
+ nodeClick: "nodeClick",
3648
+ nodeDoubleClick: "nodeDoubleClick",
3649
+ nodeContextMenu: "nodeContextMenu",
3650
+ edgeClick: "edgeClick",
3651
+ edgeDoubleClick: "edgeDoubleClick",
3652
+ edgeContextMenu: "edgeContextMenu",
3653
+ paneClick: "paneClick",
3654
+ paneDoubleClick: "paneDoubleClick",
3655
+ paneContextMenu: "paneContextMenu",
3656
+ selectionContextMenu: "selectionContextMenu",
3657
+ selectionStart: "selectionStart",
3658
+ selectionEnd: "selectionEnd",
3659
+ nodeDragStart: "nodeDragStart",
3660
+ nodesMove: "nodesMove",
3661
+ nodeDragCancel: "nodeDragCancel",
3662
+ selectionDragStart: "selectionDragStart",
3663
+ selectionDrag: "selectionDrag",
3664
+ selectionDragStop: "selectionDragStop",
3665
+ connectStart: "connectStart",
3666
+ connectTarget: "connectTarget",
3667
+ connect: "connect",
3668
+ connectCancel: "connectCancel",
3669
+ reconnectStart: "reconnectStart",
3670
+ reconnect: "reconnect",
3671
+ reconnectCancel: "reconnectCancel",
3672
+ resizeStart: "resizeStart",
3673
+ resizeEnd: "resizeEnd",
3674
+ resizeCancel: "resizeCancel",
3675
+ delete: "delete"
3676
+ },
3677
+ providers: [{
3678
+ provide: FLOW_CONTEXT,
3679
+ useFactory: () => inject(FlowRootDirective).context
3680
+ }],
3681
+ exportAs: ["flowRoot"],
3682
+ ngImport: i0
3683
+ });
3684
+ }
3685
+ };
3686
+ i0.ɵɵngDeclareClassMetadata({
3687
+ minVersion: "12.0.0",
3688
+ version: "22.2.5",
3689
+ ngImport: i0,
3690
+ type: FlowRootDirective,
3691
+ decorators: [{
3692
+ type: Directive,
3693
+ args: [{
3694
+ selector: "[flowRoot]",
3695
+ exportAs: "flowRoot",
3696
+ providers: [{
3697
+ provide: FLOW_CONTEXT,
3698
+ useFactory: () => inject(FlowRootDirective).context
3699
+ }]
3700
+ }]
3701
+ }],
3702
+ ctorParameters: () => [],
3703
+ propDecorators: {
3704
+ modelInput: [{
3705
+ type: i0.Input,
3706
+ args: [{
3707
+ isSignal: true,
3708
+ alias: "model",
3709
+ required: false
3710
+ }]
3711
+ }],
3712
+ defaultNodes: [{
3713
+ type: i0.Input,
3714
+ args: [{
3715
+ isSignal: true,
3716
+ alias: "defaultNodes",
3717
+ required: false
3718
+ }]
3719
+ }],
3720
+ defaultEdges: [{
3721
+ type: i0.Input,
3722
+ args: [{
3723
+ isSignal: true,
3724
+ alias: "defaultEdges",
3725
+ required: false
3726
+ }]
3727
+ }],
3728
+ nodes: [{
3729
+ type: i0.Input,
3730
+ args: [{
3731
+ isSignal: true,
3732
+ alias: "nodes",
3733
+ required: false
3734
+ }]
3735
+ }],
3736
+ edges: [{
3737
+ type: i0.Input,
3738
+ args: [{
3739
+ isSignal: true,
3740
+ alias: "edges",
3741
+ required: false
3742
+ }]
3743
+ }],
3744
+ features: [{
3745
+ type: i0.Input,
3746
+ args: [{
3747
+ isSignal: true,
3748
+ alias: "features",
3749
+ required: false
3750
+ }]
3751
+ }],
3752
+ createId: [{
3753
+ type: i0.Input,
3754
+ args: [{
3755
+ isSignal: true,
3756
+ alias: "createId",
3757
+ required: false
3758
+ }]
3759
+ }],
3760
+ defaultEdgeOptions: [{
3761
+ type: i0.Input,
3762
+ args: [{
3763
+ isSignal: true,
3764
+ alias: "defaultEdgeOptions",
3765
+ required: false
3766
+ }]
3767
+ }],
3768
+ viewport: [{
3769
+ type: i0.Input,
3770
+ args: [{
3771
+ isSignal: true,
3772
+ alias: "viewport",
3773
+ required: false
3774
+ }]
3775
+ }],
3776
+ defaultViewport: [{
3777
+ type: i0.Input,
3778
+ args: [{
3779
+ isSignal: true,
3780
+ alias: "defaultViewport",
3781
+ required: false
3782
+ }]
3783
+ }],
3784
+ fitView: [{
3785
+ type: i0.Input,
3786
+ args: [{
3787
+ isSignal: true,
3788
+ alias: "fitView",
3789
+ required: false
3790
+ }]
3791
+ }],
3792
+ flowRef: [{
3793
+ type: i0.Input,
3794
+ args: [{
3795
+ isSignal: true,
3796
+ alias: "flowRef",
3797
+ required: false
3798
+ }]
3799
+ }],
3800
+ minZoom: [{
3801
+ type: i0.Input,
3802
+ args: [{
3803
+ isSignal: true,
3804
+ alias: "minZoom",
3805
+ required: false
3806
+ }]
3807
+ }],
3808
+ maxZoom: [{
3809
+ type: i0.Input,
3810
+ args: [{
3811
+ isSignal: true,
3812
+ alias: "maxZoom",
3813
+ required: false
3814
+ }]
3815
+ }],
3816
+ translateExtent: [{
3817
+ type: i0.Input,
3818
+ args: [{
3819
+ isSignal: true,
3820
+ alias: "translateExtent",
3821
+ required: false
3822
+ }]
3823
+ }],
3824
+ panOnDrag: [{
3825
+ type: i0.Input,
3826
+ args: [{
3827
+ isSignal: true,
3828
+ alias: "panOnDrag",
3829
+ required: false
3830
+ }]
3831
+ }],
3832
+ panOnScroll: [{
3833
+ type: i0.Input,
3834
+ args: [{
3835
+ isSignal: true,
3836
+ alias: "panOnScroll",
3837
+ required: false
3838
+ }]
3839
+ }],
3840
+ zoomOnScroll: [{
3841
+ type: i0.Input,
3842
+ args: [{
3843
+ isSignal: true,
3844
+ alias: "zoomOnScroll",
3845
+ required: false
3846
+ }]
3847
+ }],
3848
+ zoomOnPinch: [{
3849
+ type: i0.Input,
3850
+ args: [{
3851
+ isSignal: true,
3852
+ alias: "zoomOnPinch",
3853
+ required: false
3854
+ }]
3855
+ }],
3856
+ zoomOnDoubleClick: [{
3857
+ type: i0.Input,
3858
+ args: [{
3859
+ isSignal: true,
3860
+ alias: "zoomOnDoubleClick",
3861
+ required: false
3862
+ }]
3863
+ }],
3864
+ zoomStep: [{
3865
+ type: i0.Input,
3866
+ args: [{
3867
+ isSignal: true,
3868
+ alias: "zoomStep",
3869
+ required: false
3870
+ }]
3871
+ }],
3872
+ interactive: [{
3873
+ type: i0.Input,
3874
+ args: [{
3875
+ isSignal: true,
3876
+ alias: "interactive",
3877
+ required: false
3878
+ }]
3879
+ }],
3880
+ onlyRenderVisible: [{
3881
+ type: i0.Input,
3882
+ args: [{
3883
+ isSignal: true,
3884
+ alias: "onlyRenderVisible",
3885
+ required: false
3886
+ }]
3887
+ }],
3888
+ pathOptions: [{
3889
+ type: i0.Input,
3890
+ args: [{
3891
+ isSignal: true,
3892
+ alias: "pathOptions",
3893
+ required: false
3894
+ }]
3895
+ }],
3896
+ autoPan: [{
3897
+ type: i0.Input,
3898
+ args: [{
3899
+ isSignal: true,
3900
+ alias: "autoPan",
3901
+ required: false
3902
+ }]
3903
+ }],
3904
+ panActivationKey: [{
3905
+ type: i0.Input,
3906
+ args: [{
3907
+ isSignal: true,
3908
+ alias: "panActivationKey",
3909
+ required: false
3910
+ }]
3911
+ }],
3912
+ panOnScrollMode: [{
3913
+ type: i0.Input,
3914
+ args: [{
3915
+ isSignal: true,
3916
+ alias: "panOnScrollMode",
3917
+ required: false
3918
+ }]
3919
+ }],
3920
+ panOnScrollSpeed: [{
3921
+ type: i0.Input,
3922
+ args: [{
3923
+ isSignal: true,
3924
+ alias: "panOnScrollSpeed",
3925
+ required: false
3926
+ }]
3927
+ }],
3928
+ zoomActivationKey: [{
3929
+ type: i0.Input,
3930
+ args: [{
3931
+ isSignal: true,
3932
+ alias: "zoomActivationKey",
3933
+ required: false
3934
+ }]
3935
+ }],
3936
+ easing: [{
3937
+ type: i0.Input,
3938
+ args: [{
3939
+ isSignal: true,
3940
+ alias: "easing",
3941
+ required: false
3942
+ }]
3943
+ }],
3944
+ nodeOrigin: [{
3945
+ type: i0.Input,
3946
+ args: [{
3947
+ isSignal: true,
3948
+ alias: "nodeOrigin",
3949
+ required: false
3950
+ }]
3951
+ }],
3952
+ nodeExtent: [{
3953
+ type: i0.Input,
3954
+ args: [{
3955
+ isSignal: true,
3956
+ alias: "nodeExtent",
3957
+ required: false
3958
+ }]
3959
+ }],
3960
+ elevateNodesOnSelect: [{
3961
+ type: i0.Input,
3962
+ args: [{
3963
+ isSignal: true,
3964
+ alias: "elevateNodesOnSelect",
3965
+ required: false
3966
+ }]
3967
+ }],
3968
+ elevateEdgesOnSelect: [{
3969
+ type: i0.Input,
3970
+ args: [{
3971
+ isSignal: true,
3972
+ alias: "elevateEdgesOnSelect",
3973
+ required: false
3974
+ }]
3975
+ }],
3976
+ zIndexMode: [{
3977
+ type: i0.Input,
3978
+ args: [{
3979
+ isSignal: true,
3980
+ alias: "zIndexMode",
3981
+ required: false
3982
+ }]
3983
+ }],
3984
+ paneClickDistance: [{
3985
+ type: i0.Input,
3986
+ args: [{
3987
+ isSignal: true,
3988
+ alias: "paneClickDistance",
3989
+ required: false
3990
+ }]
3991
+ }],
3992
+ nodeClickDistance: [{
3993
+ type: i0.Input,
3994
+ args: [{
3995
+ isSignal: true,
3996
+ alias: "nodeClickDistance",
3997
+ required: false
3998
+ }]
3999
+ }],
4000
+ preventScrolling: [{
4001
+ type: i0.Input,
4002
+ args: [{
4003
+ isSignal: true,
4004
+ alias: "preventScrolling",
4005
+ required: false
4006
+ }]
4007
+ }],
4008
+ nodesFocusable: [{
4009
+ type: i0.Input,
4010
+ args: [{
4011
+ isSignal: true,
4012
+ alias: "nodesFocusable",
4013
+ required: false
4014
+ }]
4015
+ }],
4016
+ edgesFocusable: [{
4017
+ type: i0.Input,
4018
+ args: [{
4019
+ isSignal: true,
4020
+ alias: "edgesFocusable",
4021
+ required: false
4022
+ }]
4023
+ }],
4024
+ nodesChange: [{
4025
+ type: i0.Output,
4026
+ args: ["nodesChange"]
4027
+ }],
4028
+ edgesChange: [{
4029
+ type: i0.Output,
4030
+ args: ["edgesChange"]
4031
+ }],
4032
+ viewportChange: [{
4033
+ type: i0.Output,
4034
+ args: ["viewportChange"]
4035
+ }],
4036
+ viewportMove: [{
4037
+ type: i0.Output,
4038
+ args: ["viewportMove"]
4039
+ }],
4040
+ moveStart: [{
4041
+ type: i0.Output,
4042
+ args: ["moveStart"]
4043
+ }],
4044
+ moveEnd: [{
4045
+ type: i0.Output,
4046
+ args: ["moveEnd"]
4047
+ }],
4048
+ init: [{
4049
+ type: i0.Output,
4050
+ args: ["init"]
4051
+ }],
4052
+ nodeClick: [{
4053
+ type: i0.Output,
4054
+ args: ["nodeClick"]
4055
+ }],
4056
+ nodeDoubleClick: [{
4057
+ type: i0.Output,
4058
+ args: ["nodeDoubleClick"]
4059
+ }],
4060
+ nodeContextMenu: [{
4061
+ type: i0.Output,
4062
+ args: ["nodeContextMenu"]
4063
+ }],
4064
+ edgeClick: [{
4065
+ type: i0.Output,
4066
+ args: ["edgeClick"]
4067
+ }],
4068
+ edgeDoubleClick: [{
4069
+ type: i0.Output,
4070
+ args: ["edgeDoubleClick"]
4071
+ }],
4072
+ edgeContextMenu: [{
4073
+ type: i0.Output,
4074
+ args: ["edgeContextMenu"]
4075
+ }],
4076
+ paneClick: [{
4077
+ type: i0.Output,
4078
+ args: ["paneClick"]
4079
+ }],
4080
+ paneDoubleClick: [{
4081
+ type: i0.Output,
4082
+ args: ["paneDoubleClick"]
4083
+ }],
4084
+ paneContextMenu: [{
4085
+ type: i0.Output,
4086
+ args: ["paneContextMenu"]
4087
+ }],
4088
+ selectionContextMenu: [{
4089
+ type: i0.Output,
4090
+ args: ["selectionContextMenu"]
4091
+ }],
4092
+ selectionStart: [{
4093
+ type: i0.Output,
4094
+ args: ["selectionStart"]
4095
+ }],
4096
+ selectionEnd: [{
4097
+ type: i0.Output,
4098
+ args: ["selectionEnd"]
4099
+ }],
4100
+ nodeDragStart: [{
4101
+ type: i0.Output,
4102
+ args: ["nodeDragStart"]
4103
+ }],
4104
+ nodesMove: [{
4105
+ type: i0.Output,
4106
+ args: ["nodesMove"]
4107
+ }],
4108
+ nodeDragCancel: [{
4109
+ type: i0.Output,
4110
+ args: ["nodeDragCancel"]
4111
+ }],
4112
+ selectionDragStart: [{
4113
+ type: i0.Output,
4114
+ args: ["selectionDragStart"]
4115
+ }],
4116
+ selectionDrag: [{
4117
+ type: i0.Output,
4118
+ args: ["selectionDrag"]
4119
+ }],
4120
+ selectionDragStop: [{
4121
+ type: i0.Output,
4122
+ args: ["selectionDragStop"]
4123
+ }],
4124
+ connectStart: [{
4125
+ type: i0.Output,
4126
+ args: ["connectStart"]
4127
+ }],
4128
+ connectTarget: [{
4129
+ type: i0.Output,
4130
+ args: ["connectTarget"]
4131
+ }],
4132
+ connect: [{
4133
+ type: i0.Output,
4134
+ args: ["connect"]
4135
+ }],
4136
+ connectCancel: [{
4137
+ type: i0.Output,
4138
+ args: ["connectCancel"]
4139
+ }],
4140
+ reconnectStart: [{
4141
+ type: i0.Output,
4142
+ args: ["reconnectStart"]
4143
+ }],
4144
+ reconnect: [{
4145
+ type: i0.Output,
4146
+ args: ["reconnect"]
4147
+ }],
4148
+ reconnectCancel: [{
4149
+ type: i0.Output,
4150
+ args: ["reconnectCancel"]
4151
+ }],
4152
+ resizeStart: [{
4153
+ type: i0.Output,
4154
+ args: ["resizeStart"]
4155
+ }],
4156
+ resizeEnd: [{
4157
+ type: i0.Output,
4158
+ args: ["resizeEnd"]
4159
+ }],
4160
+ resizeCancel: [{
4161
+ type: i0.Output,
4162
+ args: ["resizeCancel"]
4163
+ }],
4164
+ delete: [{
4165
+ type: i0.Output,
4166
+ args: ["delete"]
4167
+ }]
4168
+ }
4169
+ });
4170
+ var FlowSelectionBoxDirective = class FlowSelectionBoxDirective {
4171
+ constructor() {
4172
+ this.context = injectFlowContext("[flowSelectionBox]");
4173
+ this.box = flowValue(this.context, () => this.context.engine()?.get("selection-box") ?? null);
4174
+ this.attributes = flowValue(this.context, () => this.context.engine()?.adapter.attributes("selection-box") ?? {});
4175
+ this.state = computed(() => {
4176
+ const box = this.box();
4177
+ return box ? { box } : null;
4178
+ }, ...ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []);
4179
+ const host = injectHost();
4180
+ bindAttributes(host, () => ({
4181
+ ...this.attributes(),
4182
+ "data-flow-part": "selection-box"
4183
+ }));
4184
+ bindStructuralStyle(host, () => {
4185
+ const box = this.box();
4186
+ return {
4187
+ position: "absolute",
4188
+ left: px(box?.x),
4189
+ top: px(box?.y),
4190
+ width: px(box?.width),
4191
+ height: px(box?.height),
4192
+ pointerEvents: "none"
4193
+ };
4194
+ });
4195
+ bindPresence(host, () => this.box() ? "here" : null);
4196
+ }
4197
+ static {
4198
+ this.ɵfac = i0.ɵɵngDeclareFactory({
4199
+ minVersion: "12.0.0",
4200
+ version: "22.2.5",
4201
+ ngImport: i0,
4202
+ type: FlowSelectionBoxDirective,
4203
+ deps: [],
4204
+ target: i0.ɵɵFactoryTarget.Directive
4205
+ });
4206
+ }
4207
+ static {
4208
+ this.ɵdir = i0.ɵɵngDeclareDirective({
4209
+ minVersion: "14.0.0",
4210
+ version: "22.2.5",
4211
+ type: FlowSelectionBoxDirective,
4212
+ isStandalone: true,
4213
+ selector: "[flowSelectionBox]",
4214
+ exportAs: ["flowSelectionBox"],
4215
+ ngImport: i0
4216
+ });
4217
+ }
4218
+ };
4219
+ i0.ɵɵngDeclareClassMetadata({
4220
+ minVersion: "12.0.0",
4221
+ version: "22.2.5",
4222
+ ngImport: i0,
4223
+ type: FlowSelectionBoxDirective,
4224
+ decorators: [{
4225
+ type: Directive,
4226
+ args: [{
4227
+ selector: "[flowSelectionBox]",
4228
+ exportAs: "flowSelectionBox"
4229
+ }]
4230
+ }],
4231
+ ctorParameters: () => []
4232
+ });
4233
+ const LOCKED_KINDS = [
4234
+ "drag",
4235
+ "connect",
4236
+ "select"
4237
+ ];
4238
+ var FlowToggleInteractiveDirective = class FlowToggleInteractiveDirective {
4239
+ constructor() {
4240
+ this.context = injectFlowContext("[flowToggleInteractive]");
4241
+ this.interactive = flowValue(this.context, () => {
4242
+ const engine = this.context.engine();
4243
+ return engine ? LOCKED_KINDS.some((kind) => engine.is("interactive-by", { kind })) : true;
4244
+ });
4245
+ this.state = computed(() => ({ interactive: this.interactive() }), ...ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []);
4246
+ bindAttributes(injectHost(), () => {
4247
+ const interactive = this.interactive();
4248
+ return {
4249
+ "data-flow-part": "toggle-interactive",
4250
+ "data-interactive": interactive ? "" : void 0,
4251
+ "aria-pressed": String(!interactive),
4252
+ disabled: this.context.engine() ? void 0 : ""
4253
+ };
4254
+ });
4255
+ bindBaseAttributes(injectHost(), () => ({ type: "button" }));
4256
+ }
4257
+ toggle() {
4258
+ this.context.engine()?.run("set-interactive", this.interactive() ? {
4259
+ drag: false,
4260
+ connect: false,
4261
+ select: false
4262
+ } : {
4263
+ interactive: true,
4264
+ drag: true,
4265
+ connect: true,
4266
+ select: true
4267
+ });
4268
+ }
4269
+ static {
4270
+ this.ɵfac = i0.ɵɵngDeclareFactory({
4271
+ minVersion: "12.0.0",
4272
+ version: "22.2.5",
4273
+ ngImport: i0,
4274
+ type: FlowToggleInteractiveDirective,
4275
+ deps: [],
4276
+ target: i0.ɵɵFactoryTarget.Directive
4277
+ });
4278
+ }
4279
+ static {
4280
+ this.ɵdir = i0.ɵɵngDeclareDirective({
4281
+ minVersion: "14.0.0",
4282
+ version: "22.2.5",
4283
+ type: FlowToggleInteractiveDirective,
4284
+ isStandalone: true,
4285
+ selector: "[flowToggleInteractive]",
4286
+ host: { listeners: { "click": "toggle()" } },
4287
+ exportAs: ["flowToggleInteractive"],
4288
+ ngImport: i0
4289
+ });
4290
+ }
4291
+ };
4292
+ i0.ɵɵngDeclareClassMetadata({
4293
+ minVersion: "12.0.0",
4294
+ version: "22.2.5",
4295
+ ngImport: i0,
4296
+ type: FlowToggleInteractiveDirective,
4297
+ decorators: [{
4298
+ type: Directive,
4299
+ args: [{
4300
+ selector: "[flowToggleInteractive]",
4301
+ exportAs: "flowToggleInteractive",
4302
+ host: { "(click)": "toggle()" }
4303
+ }]
4304
+ }],
4305
+ ctorParameters: () => []
4306
+ });
4307
+ function injectViewport() {
4308
+ const context = injectFlowContext("injectViewport");
4309
+ return flowValue(context, () => context.publicEngine.get("viewport"));
4310
+ }
4311
+ const ATTRIBUTES = partAttributes("viewport");
4312
+ var FlowViewportDirective = class FlowViewportDirective {
4313
+ constructor() {
4314
+ this.context = injectFlowContext("[flowViewport]");
4315
+ this.viewport = injectViewport();
4316
+ this.state = computed(() => ({ viewport: this.viewport() }), ...ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []);
4317
+ const host = injectHost();
4318
+ bindAttributes(host, () => ATTRIBUTES);
4319
+ bindStructuralStyle(host, () => ({
4320
+ position: "absolute",
4321
+ top: 0,
4322
+ left: 0,
4323
+ width: "100%",
4324
+ height: "100%",
4325
+ isolation: "isolate"
4326
+ }));
4327
+ effect((onCleanup) => {
4328
+ const engine = this.context.engine();
4329
+ if (!engine) return;
4330
+ engine.adapter.attachViewport(host);
4331
+ onCleanup(() => engine.adapter.attachViewport(null));
4332
+ });
4333
+ }
4334
+ static {
4335
+ this.ɵfac = i0.ɵɵngDeclareFactory({
4336
+ minVersion: "12.0.0",
4337
+ version: "22.2.5",
4338
+ ngImport: i0,
4339
+ type: FlowViewportDirective,
4340
+ deps: [],
4341
+ target: i0.ɵɵFactoryTarget.Directive
4342
+ });
4343
+ }
4344
+ static {
4345
+ this.ɵdir = i0.ɵɵngDeclareDirective({
4346
+ minVersion: "14.0.0",
4347
+ version: "22.2.5",
4348
+ type: FlowViewportDirective,
4349
+ isStandalone: true,
4350
+ selector: "[flowViewport]",
4351
+ exportAs: ["flowViewport"],
4352
+ ngImport: i0
4353
+ });
4354
+ }
4355
+ };
4356
+ i0.ɵɵngDeclareClassMetadata({
4357
+ minVersion: "12.0.0",
4358
+ version: "22.2.5",
4359
+ ngImport: i0,
4360
+ type: FlowViewportDirective,
4361
+ decorators: [{
4362
+ type: Directive,
4363
+ args: [{
4364
+ selector: "[flowViewport]",
4365
+ exportAs: "flowViewport"
4366
+ }]
4367
+ }],
4368
+ ctorParameters: () => []
4369
+ });
4370
+ var FlowZoomInDirective = class FlowZoomInDirective {
4371
+ constructor() {
4372
+ this.disabled = input(void 0, {
4373
+ ...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
4374
+ transform: optionalBoolean
4375
+ });
4376
+ this.duration = input(void 0, {
4377
+ ...ngDevMode ? { debugName: "duration" } : /* istanbul ignore next */ {},
4378
+ transform: optionalNumber
4379
+ });
4380
+ this.button = controlButton("zoom-in", "zoom-in", this.disabled, () => givenPayload({ duration: this.duration() }));
4381
+ this.state = this.button.state;
4382
+ }
4383
+ click() {
4384
+ if (!this.state().disabled) this.button.click();
4385
+ }
4386
+ static {
4387
+ this.ɵfac = i0.ɵɵngDeclareFactory({
4388
+ minVersion: "12.0.0",
4389
+ version: "22.2.5",
4390
+ ngImport: i0,
4391
+ type: FlowZoomInDirective,
4392
+ deps: [],
4393
+ target: i0.ɵɵFactoryTarget.Directive
4394
+ });
4395
+ }
4396
+ static {
4397
+ this.ɵdir = i0.ɵɵngDeclareDirective({
4398
+ minVersion: "17.1.0",
4399
+ version: "22.2.5",
4400
+ type: FlowZoomInDirective,
4401
+ isStandalone: true,
4402
+ selector: "[flowZoomIn]",
4403
+ inputs: {
4404
+ disabled: {
4405
+ classPropertyName: "disabled",
4406
+ publicName: "disabled",
4407
+ isSignal: true,
4408
+ isRequired: false,
4409
+ transformFunction: null
4410
+ },
4411
+ duration: {
4412
+ classPropertyName: "duration",
4413
+ publicName: "duration",
4414
+ isSignal: true,
4415
+ isRequired: false,
4416
+ transformFunction: null
4417
+ }
4418
+ },
4419
+ host: { listeners: { "click": "click()" } },
4420
+ exportAs: ["flowZoomIn"],
4421
+ ngImport: i0
4422
+ });
4423
+ }
4424
+ };
4425
+ i0.ɵɵngDeclareClassMetadata({
4426
+ minVersion: "12.0.0",
4427
+ version: "22.2.5",
4428
+ ngImport: i0,
4429
+ type: FlowZoomInDirective,
4430
+ decorators: [{
4431
+ type: Directive,
4432
+ args: [{
4433
+ selector: "[flowZoomIn]",
4434
+ exportAs: "flowZoomIn",
4435
+ host: { "(click)": "click()" }
4436
+ }]
4437
+ }],
4438
+ propDecorators: {
4439
+ disabled: [{
4440
+ type: i0.Input,
4441
+ args: [{
4442
+ isSignal: true,
4443
+ alias: "disabled",
4444
+ required: false
4445
+ }]
4446
+ }],
4447
+ duration: [{
4448
+ type: i0.Input,
4449
+ args: [{
4450
+ isSignal: true,
4451
+ alias: "duration",
4452
+ required: false
4453
+ }]
4454
+ }]
4455
+ }
4456
+ });
4457
+ var FlowZoomOutDirective = class FlowZoomOutDirective {
4458
+ constructor() {
4459
+ this.disabled = input(void 0, {
4460
+ ...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
4461
+ transform: optionalBoolean
4462
+ });
4463
+ this.duration = input(void 0, {
4464
+ ...ngDevMode ? { debugName: "duration" } : /* istanbul ignore next */ {},
4465
+ transform: optionalNumber
4466
+ });
4467
+ this.button = controlButton("zoom-out", "zoom-out", this.disabled, () => givenPayload({ duration: this.duration() }));
4468
+ this.state = this.button.state;
4469
+ }
4470
+ click() {
4471
+ if (!this.state().disabled) this.button.click();
4472
+ }
4473
+ static {
4474
+ this.ɵfac = i0.ɵɵngDeclareFactory({
4475
+ minVersion: "12.0.0",
4476
+ version: "22.2.5",
4477
+ ngImport: i0,
4478
+ type: FlowZoomOutDirective,
4479
+ deps: [],
4480
+ target: i0.ɵɵFactoryTarget.Directive
4481
+ });
4482
+ }
4483
+ static {
4484
+ this.ɵdir = i0.ɵɵngDeclareDirective({
4485
+ minVersion: "17.1.0",
4486
+ version: "22.2.5",
4487
+ type: FlowZoomOutDirective,
4488
+ isStandalone: true,
4489
+ selector: "[flowZoomOut]",
4490
+ inputs: {
4491
+ disabled: {
4492
+ classPropertyName: "disabled",
4493
+ publicName: "disabled",
4494
+ isSignal: true,
4495
+ isRequired: false,
4496
+ transformFunction: null
4497
+ },
4498
+ duration: {
4499
+ classPropertyName: "duration",
4500
+ publicName: "duration",
4501
+ isSignal: true,
4502
+ isRequired: false,
4503
+ transformFunction: null
4504
+ }
4505
+ },
4506
+ host: { listeners: { "click": "click()" } },
4507
+ exportAs: ["flowZoomOut"],
4508
+ ngImport: i0
4509
+ });
4510
+ }
4511
+ };
4512
+ i0.ɵɵngDeclareClassMetadata({
4513
+ minVersion: "12.0.0",
4514
+ version: "22.2.5",
4515
+ ngImport: i0,
4516
+ type: FlowZoomOutDirective,
4517
+ decorators: [{
4518
+ type: Directive,
4519
+ args: [{
4520
+ selector: "[flowZoomOut]",
4521
+ exportAs: "flowZoomOut",
4522
+ host: { "(click)": "click()" }
4523
+ }]
4524
+ }],
4525
+ propDecorators: {
4526
+ disabled: [{
4527
+ type: i0.Input,
4528
+ args: [{
4529
+ isSignal: true,
4530
+ alias: "disabled",
4531
+ required: false
4532
+ }]
4533
+ }],
4534
+ duration: [{
4535
+ type: i0.Input,
4536
+ args: [{
4537
+ isSignal: true,
4538
+ alias: "duration",
4539
+ required: false
4540
+ }]
4541
+ }]
4542
+ }
4543
+ });
4544
+ const FLOW = [
4545
+ FlowRootDirective,
4546
+ FlowViewportDirective,
4547
+ FlowNodesDirective,
4548
+ FlowNodesItemDirective,
4549
+ FlowNodeDirective,
4550
+ FlowHandleDirective,
4551
+ FlowEdgesDirective,
4552
+ FlowEdgesItemDirective,
4553
+ FlowEdgeDirective,
4554
+ FlowEdgePathDirective,
4555
+ FlowEdgeLabelDirective,
4556
+ FlowReconnectAnchorDirective,
4557
+ FlowConnectionLineDirective,
4558
+ FlowNodesSelectionDirective,
4559
+ FlowSelectionBoxDirective,
4560
+ FlowBackgroundDirective,
4561
+ FlowControlsDirective,
4562
+ FlowZoomInDirective,
4563
+ FlowZoomOutDirective,
4564
+ FlowFitViewDirective,
4565
+ FlowToggleInteractiveDirective,
4566
+ FlowNodeToolbarDirective,
4567
+ FlowEdgeToolbarDirective
4568
+ ];
4569
+ function injectEdges() {
4570
+ const context = injectFlowContext("injectEdges");
4571
+ return flowValue(context, () => context.model().get("all-edges"), Object.is);
4572
+ }
4573
+ function injectFlow() {
4574
+ const context = injectFlowContext("injectFlow");
4575
+ return {
4576
+ model: computed(() => typedModel(context.model())),
4577
+ engine: typedEngine(context.publicEngine)
4578
+ };
4579
+ }
4580
+ function injectFlowRef() {
4581
+ return createFlowRef();
4582
+ }
4583
+ function injectFlowStore(selector, equal = Object.is) {
4584
+ const context = injectFlowContext("injectFlowStore");
4585
+ return flowValue(context, () => selector({
4586
+ model: typedModel(context.model()),
4587
+ engine: typedEngine(context.publicEngine)
4588
+ }), equal);
4589
+ }
4590
+ function injectInternalNode(nodeId) {
4591
+ const context = injectFlowContext("injectInternalNode");
4592
+ return flowValue(context, () => {
4593
+ const engine = context.engine();
4594
+ const id = valueNow(nodeId);
4595
+ if (!engine || id === void 0) return void 0;
4596
+ return engine.get("internal-node-by", { nodeId: id });
4597
+ }, sameFlowValue);
4598
+ }
4599
+ function injectKeyPress(keys, options = {}) {
4600
+ const root = inject(FLOW_CONTEXT, { optional: true })?.rootElement ?? null;
4601
+ const target = computed(() => {
4602
+ const given = options.target === void 0 ? void 0 : valueNow(options.target);
4603
+ if (given !== void 0) return given;
4604
+ return root?.ownerDocument.defaultView ?? null;
4605
+ }, ...ngDevMode ? [{ debugName: "target" }] : /* istanbul ignore next */ []);
4606
+ const combos = computed(() => {
4607
+ const now = valueNow(keys);
4608
+ return now === void 0 ? [] : typeof now === "string" ? [now] : now;
4609
+ }, {
4610
+ ...ngDevMode ? { debugName: "combos" } : /* istanbul ignore next */ {},
4611
+ equal: (a, b) => a.length === b.length && a.every((combo, i) => combo === b[i])
4612
+ });
4613
+ const pressed = signal(false, ...ngDevMode ? [{ debugName: "pressed" }] : /* istanbul ignore next */ []);
4614
+ effect((onCleanup) => {
4615
+ const on = target();
4616
+ const list = combos();
4617
+ if (!on) return;
4618
+ untracked(() => {
4619
+ const stop = watchKeyPress(on, list, (now) => pressed.set(now));
4620
+ onCleanup(() => {
4621
+ stop();
4622
+ pressed.set(false);
4623
+ });
4624
+ });
4625
+ });
4626
+ return pressed.asReadonly();
4627
+ }
4628
+ function injectNodeConnections(options = {}) {
4629
+ const context = injectFlowContext("injectNodeConnections");
4630
+ const around = injectNodeContext();
4631
+ if (!around && !isSignal(options) && typeof options !== "function" && options.id === void 0) throw new Error("injectNodeConnections must be called inside [flowNode] (or be given an id)");
4632
+ const given = computed(() => valueNow(options), ...ngDevMode ? [{ debugName: "given" }] : /* istanbul ignore next */ []);
4633
+ const nodeId = partOwnerId("injectNodeConnections", () => given()?.id, around, "node");
4634
+ return flowValue(context, () => {
4635
+ const id = nodeId();
4636
+ if (id === void 0) return [];
4637
+ const { handleId, type } = given() ?? {};
4638
+ return context.model().get("node-connections-by", {
4639
+ nodeId: id,
4640
+ handleId,
4641
+ handleType: type
4642
+ });
4643
+ }, sameFlowValue);
4644
+ }
4645
+ function injectNodeId() {
4646
+ const around = injectNodeContext();
4647
+ return computed(() => around?.nodeId() ?? null);
4648
+ }
4649
+ function injectNodes() {
4650
+ const context = injectFlowContext("injectNodes");
4651
+ return flowValue(context, () => context.model().get("all-nodes"), Object.is);
4652
+ }
4653
+ function injectNodesData(ids) {
4654
+ const context = injectFlowContext("injectNodesData");
4655
+ const asked = computed(() => valueNow(ids), ...ngDevMode ? [{ debugName: "asked" }] : /* istanbul ignore next */ []);
4656
+ const list = flowValue(context, () => {
4657
+ const now = asked();
4658
+ if (now === void 0) return [];
4659
+ return context.model().get("nodes-data-by", { nodeIds: typeof now === "string" ? [now] : now });
4660
+ }, sameFlowValue);
4661
+ return computed(() => Array.isArray(asked()) ? list() : list()[0] ?? null);
4662
+ }
4663
+ function injectOnViewportChange(options) {
4664
+ const context = injectFlowContext("injectOnViewportChange");
4665
+ effect((onCleanup) => {
4666
+ const engine = context.engine();
4667
+ if (!engine) return;
4668
+ onCleanup(untracked(() => engine.subscribe((event) => {
4669
+ if (event.type !== "viewport-change-start" && event.type !== "viewport-change" && event.type !== "viewport-change-end") return;
4670
+ const { onStart, onChange, onEnd } = untracked(() => valueNow(options)) ?? {};
4671
+ (event.type === "viewport-change-start" ? onStart : event.type === "viewport-change" ? onChange : onEnd)?.(event.viewport, event.gesture);
4672
+ })));
4673
+ });
4674
+ }
4675
+ const NONE = Object.freeze([]);
4676
+ function injectSelection() {
4677
+ const context = injectFlowContext("injectSelection");
4678
+ return flowValue(context, () => {
4679
+ const model = context.model();
4680
+ return {
4681
+ nodes: model.get("selected-nodes") ?? NONE,
4682
+ edges: model.get("selected-edges") ?? NONE
4683
+ };
4684
+ }, (a, b) => a.nodes.length === b.nodes.length && a.edges.length === b.edges.length && a.nodes.every((node, i) => node === b.nodes[i]) && a.edges.every((edge, i) => edge === b.edges[i]));
4685
+ }
4686
+ export { FLOW, FlowBackgroundDirective, FlowConnectionLineDirective, FlowControlsDirective, FlowEdgeDirective, FlowEdgeLabelDirective, FlowEdgePathDirective, FlowEdgeToolbarDirective, FlowEdgesDirective, FlowEdgesItemDirective, FlowFitViewDirective, FlowHandleDirective, FlowNodeDirective, FlowNodeToolbarDirective, FlowNodesDirective, FlowNodesItemDirective, FlowNodesSelectionDirective, FlowReconnectAnchorDirective, FlowRootDirective, FlowSelectionBoxDirective, FlowToggleInteractiveDirective, FlowViewportDirective, FlowZoomInDirective, FlowZoomOutDirective, createFlowRef, injectConnection, injectEdge, injectEdges, injectFlow, injectFlowRef, injectFlowStore, injectHandle, injectInternalNode, injectKeyPress, injectNode, injectNodeConnections, injectNodeId, injectNodes, injectNodesData, injectOnViewportChange, injectSelection, injectViewport, beforeInputs as ɵbeforeInputs, bindAttributes as ɵbindAttributes, bindBaseAttributes as ɵbindBaseAttributes, bindPresence as ɵbindPresence, bindStructuralStyle as ɵbindStructuralStyle, defaultContent as ɵdefaultContent, flowValue as ɵflowValue, injectFlowContext as ɵinjectFlowContext, injectHost as ɵinjectHost, injectNodeContext as ɵinjectNodeContext, onDestroy as ɵonDestroy, optionalBoolean as ɵoptionalBoolean, optionalNumber as ɵoptionalNumber, partOwnerId as ɵpartOwnerId, px as ɵpx };
4687
+
4688
+ //# sourceMappingURL=fragiola-flow-angular.mjs.map