@likec4/core 1.34.2 → 1.35.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.
Files changed (56) hide show
  1. package/dist/builder/index.d.mts +2 -2
  2. package/dist/builder/index.mjs +11 -10
  3. package/dist/compute-view/index.d.mts +2 -2
  4. package/dist/compute-view/index.mjs +12 -11
  5. package/dist/compute-view/relationships-view/index.d.mts +2 -2
  6. package/dist/compute-view/relationships-view/index.mjs +2 -2
  7. package/dist/index.d.mts +2 -2
  8. package/dist/index.mjs +9 -8
  9. package/dist/model/connection/deployment/index.d.mts +4 -4
  10. package/dist/model/connection/deployment/index.mjs +3 -3
  11. package/dist/model/connection/index.d.mts +5 -5
  12. package/dist/model/connection/index.mjs +4 -4
  13. package/dist/model/connection/model/index.d.mts +4 -4
  14. package/dist/model/connection/model/index.mjs +3 -3
  15. package/dist/model/index.d.mts +31 -7
  16. package/dist/model/index.mjs +9 -9
  17. package/dist/shared/{core.D3xEWj5B.d.mts → core.72IoI17N.d.mts} +1 -1
  18. package/dist/shared/{core.DXRAwwDB.mjs → core.B1ZN723l.mjs} +1 -1
  19. package/dist/shared/core.BpJu1RrF.mjs +5 -0
  20. package/dist/shared/{core.C80Z37Eu.mjs → core.C1GV0WWV.mjs} +1 -1
  21. package/dist/shared/{core.D5qVzkws.mjs → core.CQS11dNK.mjs} +2 -2
  22. package/dist/shared/{core.C_C-3c1S.mjs → core.DQj9iv_y.mjs} +3 -5
  23. package/dist/shared/{core.IWLie-Ma.d.mts → core.Ddua-wiI.d.mts} +3 -0
  24. package/dist/shared/{core.CJSFKrYf.d.mts → core.DhTO8rgm.d.mts} +2 -2
  25. package/dist/shared/{core.CtKXPqN_.mjs → core.HUONfQfd.mjs} +1 -1
  26. package/dist/shared/{core.Di7__sMg.d.mts → core.NBNeVyag.d.mts} +2 -2
  27. package/dist/shared/{core.PqNe5WxQ.mjs → core.RnUJywKk.mjs} +94 -92
  28. package/dist/shared/{core.DrS4Bf4y.d.mts → core.SciGxb--.d.mts} +183 -8
  29. package/dist/shared/{core.BTnf14gD.mjs → core.Y3j3s-oq.mjs} +2 -2
  30. package/dist/shared/{core.XptQjhMA.mjs → core.b2BzqGz0.mjs} +2 -2
  31. package/dist/shared/{core.4SpVCM9m.mjs → core.rpF8esVq.mjs} +354 -28
  32. package/dist/shared/{core.BMCb0wJI.mjs → core.yaRvRnMW.mjs} +1 -1
  33. package/dist/theme/index.mjs +33 -3
  34. package/dist/types/index.d.mts +2 -2
  35. package/dist/types/index.mjs +2 -2
  36. package/dist/utils/index.d.mts +6 -8
  37. package/dist/utils/index.mjs +5 -5
  38. package/dist/utils/iterable/index.d.mts +18 -1
  39. package/dist/utils/iterable/index.mjs +22 -2
  40. package/package.json +6 -5
  41. package/src/compute-view/element-view/predicates/relation-direct.ts +8 -2
  42. package/src/model/DeploymentModel.ts +1 -1
  43. package/src/model/LikeC4Model.ts +146 -7
  44. package/src/model/index.ts +8 -0
  45. package/src/model/types.ts +1 -8
  46. package/src/model/utils.ts +66 -0
  47. package/src/model/view/LikeC4ViewModel.ts +62 -7
  48. package/src/model/view/LikeC4ViewsFolder.ts +151 -0
  49. package/src/theme/__test__/theme-index.ts +29 -0
  50. package/src/theme/index.ts +49 -3
  51. package/src/types/model-spec.ts +4 -0
  52. package/src/utils/compare-natural.ts +14 -12
  53. package/src/utils/index.ts +1 -0
  54. package/src/utils/iterable/first.ts +48 -0
  55. package/src/utils/iterable/index.ts +1 -0
  56. package/dist/shared/{core.Br7Fab9l.mjs → core.BajmN8zR.mjs} +6 -6
@@ -1,66 +1,63 @@
1
- import { n as a$4, t as t$3, r as r$3, j as isElementModel, f as isNestedElementOfDeployedInstanceModel, d as isDeployedInstanceModel, i as isDeploymentNodeModel, e as isDeploymentElementModel, L as LikeC4Model } from './core.4SpVCM9m.mjs';
2
- import { u as u$6 } from './core.DbRvwARP.mjs';
1
+ import { s as a$2, t as t$3, u as a$3, r as r$3, m as isElementModel, j as isNestedElementOfDeployedInstanceModel, f as isDeployedInstanceModel, i as isDeploymentNodeModel, h as isDeploymentElementModel, L as LikeC4Model } from './core.rpF8esVq.mjs';
2
+ import { u as u$5 } from './core.DbRvwARP.mjs';
3
3
  import { m as m$2 } from './core.ByrmCl9I.mjs';
4
- import { i as i$a, t as t$4, n as n$3, d as deploymentConnection, R as RelationshipsAccum, D as DeploymentConnectionModel } from './core.D5qVzkws.mjs';
5
- import { p as p$1, f as findAscendingConnections, m as mergeConnections, d as differenceConnections, j as isNestedConnection, s as sortConnectionsByBoundaryHierarchy, o as findConnectionsBetween$3, n as modelConnection, b as findDescendantConnections, a as findDeepestNestedConnection, i as isAnyInOut, k as isOutgoing, g as isIncoming, C as ConnectionModel } from './core.BTnf14gD.mjs';
6
- import { u as a$3, C, t as s, r as getDefaultExportFromCjs, j as isDescendantOf, m as sortParentsFirst, i as isAncestor, p as parentFqn, e as compareByFqnHierarchically, o as isNonEmptyArray, n as nameFromFqn, s as sortByFqnHierarchically, d as commonAncestor, b as ancestorsFqn, k as isSameHierarchy } from './core.C_C-3c1S.mjs';
7
- import { c as commonHead, r as requireForeach, a as requireIterator, u as u$7, o as objectHash, d as d$5, S as Stack } from './core.CtKXPqN_.mjs';
4
+ import { i as i$a, t as t$4, n as n$2, d as deploymentConnection, R as RelationshipsAccum, D as DeploymentConnectionModel } from './core.CQS11dNK.mjs';
5
+ import { p as p$1, f as findAscendingConnections, m as mergeConnections, d as differenceConnections, j as isNestedConnection, s as sortConnectionsByBoundaryHierarchy, o as findConnectionsBetween$3, n as modelConnection, b as findDescendantConnections, a as findDeepestNestedConnection, i as isAnyInOut, k as isOutgoing, g as isIncoming, C as ConnectionModel } from './core.Y3j3s-oq.mjs';
6
+ import { u as a$1, C, t as s, r as getDefaultExportFromCjs, j as isDescendantOf, m as sortParentsFirst, i as isAncestor, p as parentFqn, e as compareByFqnHierarchically, o as isNonEmptyArray, n as nameFromFqn, s as sortByFqnHierarchically, d as commonAncestor, b as ancestorsFqn, k as isSameHierarchy } from './core.DQj9iv_y.mjs';
7
+ import { c as commonHead, r as requireForeach, a as requireIterator, u as u$6, o as objectHash, d as d$5, S as Stack } from './core.HUONfQfd.mjs';
8
8
  import { a as nonNullable, i as invariant, n as nonexhaustive } from './core.D4npX2q8.mjs';
9
- import { n as n$1, a as DefaultElementShape, D as DefaultThemeColor, f as DefaultArrowType, e as DefaultLineStyle, g as DefaultRelationshipColor } from './core.D56nCp7e.mjs';
9
+ import { n, a as DefaultElementShape, D as DefaultThemeColor, f as DefaultArrowType, e as DefaultLineStyle, g as DefaultRelationshipColor } from './core.D56nCp7e.mjs';
10
10
  import { d as difference, a as intersection, u as union, i as i$b, h as hasIntersection } from './core.CpwrZi3D.mjs';
11
- import { a as isIterable, n as n$2, l as l$6, b as iunique, i as iflat } from './core.8KM0D6va.mjs';
11
+ import { a as isIterable, n as n$1, l as l$5, b as iunique, i as iflat } from './core.8KM0D6va.mjs';
12
12
  import { o as o$7 } from './core.BgvIuGGU.mjs';
13
- import { w as whereOperatorAsPredicate, F as FqnRef, y, m as isGroupElementKind, G as GroupElementKind, a as _type, _ as _stage, t as n$4, p as stepEdgeId } from './core.Br7Fab9l.mjs';
14
- import { M as ModelFqnExpr, c as isViewRuleStyle, F as FqnExpr, R as RelationExpr, s as o$8, i as isViewRulePredicate, o as isViewRuleAutoLayout, r as isViewRuleGroup, m as isViewRuleGlobalPredicateRef, l as isViewRuleGlobalStyle, q as isDynamicViewParallelSteps, a as ModelRelationExpr, b as ModelExpression, k as isDynamicView, j as isDeploymentView, f as isElementView } from './core.DXRAwwDB.mjs';
13
+ import { w as whereOperatorAsPredicate, F as FqnRef, y, m as isGroupElementKind, G as GroupElementKind, a as _type, _ as _stage, t as n$3, p as stepEdgeId } from './core.BajmN8zR.mjs';
14
+ import { M as ModelFqnExpr, c as isViewRuleStyle, F as FqnExpr, R as RelationExpr, s as o$8, i as isViewRulePredicate, o as isViewRuleAutoLayout, r as isViewRuleGroup, m as isViewRuleGlobalPredicateRef, l as isViewRuleGlobalStyle, q as isDynamicViewParallelSteps, a as ModelRelationExpr, b as ModelExpression, k as isDynamicView, j as isDeploymentView, f as isElementView } from './core.B1ZN723l.mjs';
15
+ import { k } from './core.BpJu1RrF.mjs';
15
16
  import { a as toSet, t as toArray, i as imap } from './core.Btl47GOn.mjs';
16
- import { D as DefaultMap } from './core.BMCb0wJI.mjs';
17
+ import { D as DefaultMap } from './core.yaRvRnMW.mjs';
17
18
  import { i as ifilter } from './core.BH9nN-_I.mjs';
18
- import { C as Connection, c as customInspectSymbol } from './core.C80Z37Eu.mjs';
19
+ import { C as Connection, c as customInspectSymbol } from './core.C1GV0WWV.mjs';
19
20
  import { i as isome } from './core.BoyJPEen.mjs';
20
21
 
21
22
  function d$4(...e){return e.length===2?(n,...r)=>t$2(n,...e,...r):t$2(...e)}var t$2=(e,n,r,...a)=>n(e,...a)?typeof r=="function"?r(e,...a):r.onTrue(e,...a):typeof r=="function"?e:r.onFalse(e,...a);
22
23
 
23
- function l$5(...r){return u$6(o$6,r,u$5)}var o$6=(r,e)=>e<0?[]:r.slice(0,e);function u$5(r){if(r<=0)return a$3;let e=r;return a=>(e-=1,{done:e<=0,hasNext:true,next:a})}
24
+ function l$4(...r){return u$5(o$6,r,u$4)}var o$6=(r,e)=>e<0?[]:r.slice(0,e);function u$4(r){if(r<=0)return a$1;let e=r;return a=>(e-=1,{done:e<=0,hasNext:true,next:a})}
24
25
 
25
- function l$4(...e){return u$6(u$4,e)}var u$4=(e,a,n)=>e.reduce(a,n);
26
+ function l$3(...e){return u$5(u$3,e)}var u$3=(e,a,n)=>e.reduce(a,n);
26
27
 
27
- function t$1(...e){return u$6(r$2,e)}function r$2(e){return [...e].reverse()}
28
+ function t$1(...e){return u$5(r$2,e)}function r$2(e){return [...e].reverse()}
28
29
 
29
- function d$3(...r){return u$6(i$9,r)}var i$9=(r,t)=>{let a=[[],[]];for(let[o,e]of r.entries())t(e,o,r)?a[0].push(e):a[1].push(e);return a};
30
+ function d$3(...r){return u$5(i$9,r)}var i$9=(r,t)=>{let a=[[],[]];for(let[o,e]of r.entries())t(e,o,r)?a[0].push(e):a[1].push(e);return a};
30
31
 
31
- function i$8(...e){return u$6(o$5,e)}function o$5(e,n){let t={};for(let r of n)r in e&&(t[r]=e[r]);return t}
32
+ function i$8(...e){return u$5(o$5,e)}function o$5(e,n){let t={};for(let r of n)r in e&&(t[r]=e[r]);return t}
32
33
 
33
- function d$2(...e){return u$6(i$7,e)}function i$7(e,o){let t={};for(let[r,n]of Object.entries(e))o(n,r,e)&&(t[r]=n);return t}
34
+ function d$2(...e){return u$5(i$7,e)}function i$7(e,o){let t={};for(let[r,n]of Object.entries(e))o(n,r,e)&&(t[r]=n);return t}
34
35
 
35
36
  function i$6(...n){return o=>C(o,...n)}
36
37
 
37
- function d$1(...e){return u$6(l$3,e)}function l$3(e,a){let t={...e};for(let[n,o]of Object.entries(t))a(o,n,e)&&delete t[n];return t}
38
+ function d$1(...e){return u$5(l$2,e)}function l$2(e,a){let t={...e};for(let[n,o]of Object.entries(t))a(o,n,e)&&delete t[n];return t}
38
39
 
39
- function l$2(...n){return u$6(d,n)}function d(n,o){let e={};for(let[a,t]of n.entries()){let[y,u]=o(t,a,n);e[y]=u;}return e}
40
+ function l$1(...n){return u$5(d,n)}function d(n,o){let e={};for(let[a,t]of n.entries()){let[y,u]=o(t,a,n);e[y]=u;}return e}
40
41
 
41
- function i$5(...e){return u$6(o$4,e)}function o$4(e,r){let a={};for(let[n,u]of Object.entries(e)){let l=r(u,n,e);a[n]=l;}return a}
42
-
43
- function a$2(...e){return u$6(n,e)}var n=e=>e.at(-1);
42
+ function i$5(...e){return u$5(o$4,e)}function o$4(e,r){let a={};for(let[n,u]of Object.entries(e)){let l=r(u,n,e);a[n]=l;}return a}
44
43
 
45
44
  function e(o){return typeof o=="boolean"}
46
45
 
47
- function i$4(...e){return u$6(p,e)}var p=(e,d)=>{let r=Object.create(null);for(let n=0;n<e.length;n++){let t=e[n],y=d(t,n,e);if(y!==void 0){let o=r[y];o===void 0?r[y]=[t]:o.push(t);}}return Object.setPrototypeOf(r,Object.prototype),r};
48
-
49
- function k(...n){return u$6(u$3,n)}function u$3(n,e){if(n===e||Object.is(n,e))return true;if(typeof n!="object"||typeof e!="object"||n===null||e===null||Object.getPrototypeOf(n)!==Object.getPrototypeOf(e))return false;if(Array.isArray(n))return l$1(n,e);if(n instanceof Map)return a$1(n,e);if(n instanceof Set)return c(n,e);if(n instanceof Date)return n.getTime()===e.getTime();if(n instanceof RegExp)return n.toString()===e.toString();if(Object.keys(n).length!==Object.keys(e).length)return false;for(let[r,t]of Object.entries(n))if(!(r in e)||!u$3(t,e[r]))return false;return true}function l$1(n,e){if(n.length!==e.length)return false;for(let[r,t]of n.entries())if(!u$3(t,e[r]))return false;return true}function a$1(n,e){if(n.size!==e.size)return false;for(let[r,t]of n.entries())if(!e.has(r)||!u$3(t,e.get(r)))return false;return true}function c(n,e){if(n.size!==e.size)return false;let r=[...e];for(let t of n){let o=false;for(let[s,f]of r.entries())if(u$3(t,f)){o=true,r.splice(s,1);break}if(!o)return false}return true}
46
+ function i$4(...e){return u$5(p,e)}var p=(e,d)=>{let r=Object.create(null);for(let n=0;n<e.length;n++){let t=e[n],y=d(t,n,e);if(y!==void 0){let o=r[y];o===void 0?r[y]=[t]:o.push(t);}}return Object.setPrototypeOf(r,Object.prototype),r};
50
47
 
51
- function u$2(...e){return u$6(i$3,e)}function i$3(e,a){let r={};for(let[o,n]of e.entries()){let d=a(n,o,e);r[d]=n;}return r}
48
+ function u$2(...e){return u$5(i$3,e)}function i$3(e,a){let r={};for(let[o,n]of e.entries()){let d=a(n,o,e);r[d]=n;}return r}
52
49
 
53
- function u$1(...a){return u$6(o$3,a,l)}var o$3=(a,r)=>a.flatMap(r),l=a=>(r,t,y)=>{let n=a(r,t,y);return Array.isArray(n)?{done:false,hasNext:true,hasMany:true,next:n}:{done:false,hasNext:true,next:n}};
50
+ function u$1(...a){return u$5(o$3,a,l)}var o$3=(a,r)=>a.flatMap(r),l=a=>(r,t,y)=>{let n=a(r,t,y);return Array.isArray(n)?{done:false,hasNext:true,hasMany:true,next:n}:{done:false,hasNext:true,next:n}};
54
51
 
55
- function u(...e){return u$6(o$2,e,i$2)}function o$2(e,a){return e.forEach(a),e}var i$2=e=>(a,n,t)=>(e(a,n,t),{done:false,hasNext:true,next:a});
52
+ function u(...e){return u$5(o$2,e,i$2)}function o$2(e,a){return e.forEach(a),e}var i$2=e=>(a,n,t)=>(e(a,n,t),{done:false,hasNext:true,next:a});
56
53
 
57
- function m$1(...e){return u$6(o$1,e,i$1)}var o$1=(e,n)=>e.filter(n),i$1=e=>(n,a,d)=>e(n,a,d)?{done:false,hasNext:true,next:n}:s;
54
+ function m$1(...e){return u$5(o$1,e,i$1)}var o$1=(e,n)=>e.filter(n),i$1=e=>(n,a,d)=>e(n,a,d)?{done:false,hasNext:true,next:n}:s;
58
55
 
59
- function o(...e){return u$6(t,e)}var t=(e,r)=>{for(let n=e.length-1;n>=0;n--){let a=e[n];if(r(a,n,e))return a}};
56
+ function o(...e){return u$5(t,e)}var t=(e,r)=>{for(let n=e.length-1;n>=0;n--){let a=e[n];if(r(a,n,e))return a}};
60
57
 
61
- function m(...e){return u$6(i,e)}function i(e,t){for(let[n,o]of e.entries())if(!t(o,n,e))return e.slice(n);return []}
58
+ function m(...e){return u$5(i,e)}function i(e,t){for(let[n,o]of e.entries())if(!t(o,n,e))return e.slice(n);return []}
62
59
 
63
- function a(...e){return u$6(r$1,e)}var r$1=(e,t)=>[...e,...t];
60
+ function a(...e){return u$5(r$1,e)}var r$1=(e,t)=>[...e,...t];
64
61
 
65
62
  function r(n){return ()=>n}
66
63
 
@@ -106,7 +103,7 @@ function buildElementNotations(nodes) {
106
103
  kinds
107
104
  }))
108
105
  ),
109
- a$4(
106
+ a$2(
110
107
  p$1("shape"),
111
108
  p$1("title"),
112
109
  [
@@ -139,7 +136,7 @@ function linkNodesWithEdges(nodesMap, edges) {
139
136
  const sourceAncestors = ancestorsOfNode(source, nodesMap);
140
137
  const targetAncestors = ancestorsOfNode(target, nodesMap);
141
138
  const hasAncestors = sourceAncestors.length > 0 && targetAncestors.length > 0;
142
- const edgeParent = hasAncestors ? a$2(
139
+ const edgeParent = hasAncestors ? a$3(
143
140
  commonHead(
144
141
  t$1(sourceAncestors),
145
142
  t$1(targetAncestors)
@@ -1202,7 +1199,7 @@ function topologicalSort(param) {
1202
1199
  if (target.parent && target.parent !== edge.parent) {
1203
1200
  C(
1204
1201
  ancestorsOfNode(target, param.nodes),
1205
- u$7((ancestor) => ancestor.inEdges.includes(edge.id)),
1202
+ u$6((ancestor) => ancestor.inEdges.includes(edge.id)),
1206
1203
  u((ancestor) => {
1207
1204
  g.mergeNode(ancestor.id);
1208
1205
  if (!willCreateCycle(g, edge.source, ancestor.id)) {
@@ -1268,19 +1265,19 @@ function calcViewLayoutHash(view) {
1268
1265
  autoLayout: view.autoLayout,
1269
1266
  nodes: C(
1270
1267
  view.nodes,
1271
- m$2((n) => ({
1272
- id: n.id,
1273
- icon: n$1(n.icon) ? "Y" : "N",
1274
- title: n.title,
1275
- description: n.description?.md ?? n.description?.txt ?? null,
1276
- technology: n.technology ?? null,
1277
- shape: n.shape,
1278
- size: n.style.size ?? null,
1279
- textSize: n.style.textSize ?? null,
1280
- padding: n.style.padding ?? null,
1281
- children: n.children
1268
+ m$2((n$1) => ({
1269
+ id: n$1.id,
1270
+ icon: n(n$1.icon) ? "Y" : "N",
1271
+ title: n$1.title,
1272
+ description: n$1.description?.md ?? n$1.description?.txt ?? null,
1273
+ technology: n$1.technology ?? null,
1274
+ shape: n$1.shape,
1275
+ size: n$1.style.size ?? null,
1276
+ textSize: n$1.style.textSize ?? null,
1277
+ padding: n$1.style.padding ?? null,
1278
+ children: n$1.children
1282
1279
  })),
1283
- l$2(({ id, ...node }) => [id, node])
1280
+ l$1(({ id, ...node }) => [id, node])
1284
1281
  ),
1285
1282
  edges: C(
1286
1283
  view.edges,
@@ -1295,7 +1292,7 @@ function calcViewLayoutHash(view) {
1295
1292
  tail: e.tail,
1296
1293
  line: e.line
1297
1294
  })),
1298
- l$2(({ source, target, ...edge }) => [`${source}:${target}`, edge])
1295
+ l$1(({ source, target, ...edge }) => [`${source}:${target}`, edge])
1299
1296
  )
1300
1297
  };
1301
1298
  view.hash = objectHash(tohash);
@@ -1739,29 +1736,29 @@ function applyViewRuleStyle(rule, predicates, nodes) {
1739
1736
  u((n) => {
1740
1737
  n.shape = rule.style.shape ?? n.shape;
1741
1738
  n.color = rule.style.color ?? n.color;
1742
- if (n$2(rule.style.icon)) {
1739
+ if (n$1(rule.style.icon)) {
1743
1740
  n.icon = rule.style.icon;
1744
1741
  }
1745
- if (n$2(rule.notation)) {
1742
+ if (n$1(rule.notation)) {
1746
1743
  n.notation = rule.notation;
1747
1744
  }
1748
1745
  let styleOverride;
1749
- if (n$2(rule.style.border)) {
1746
+ if (n$1(rule.style.border)) {
1750
1747
  styleOverride = { border: rule.style.border };
1751
1748
  }
1752
- if (n$2(rule.style.opacity)) {
1749
+ if (n$1(rule.style.opacity)) {
1753
1750
  styleOverride = { ...styleOverride, opacity: rule.style.opacity };
1754
1751
  }
1755
- if (n$2(rule.style.multiple)) {
1752
+ if (n$1(rule.style.multiple)) {
1756
1753
  styleOverride = { ...styleOverride, multiple: rule.style.multiple };
1757
1754
  }
1758
- if (n$2(rule.style.padding)) {
1755
+ if (n$1(rule.style.padding)) {
1759
1756
  styleOverride = { ...styleOverride, padding: rule.style.padding };
1760
1757
  }
1761
- if (n$2(rule.style.size)) {
1758
+ if (n$1(rule.style.size)) {
1762
1759
  styleOverride = { ...styleOverride, size: rule.style.size };
1763
1760
  }
1764
- if (n$2(rule.style.textSize)) {
1761
+ if (n$1(rule.style.textSize)) {
1765
1762
  styleOverride = { ...styleOverride, textSize: rule.style.textSize };
1766
1763
  }
1767
1764
  if (styleOverride) {
@@ -1925,33 +1922,33 @@ function pickRelationshipProps(relation) {
1925
1922
  function mergePropsFromRelationships(relations, prefer) {
1926
1923
  const allprops = C(
1927
1924
  relations,
1928
- l$4(
1925
+ l$3(
1929
1926
  (acc, r) => {
1930
- if (n$1(r.title) && !acc.title.includes(r.title)) {
1927
+ if (n(r.title) && !acc.title.includes(r.title)) {
1931
1928
  acc.title.push(r.title);
1932
1929
  }
1933
- if (n$1(r.description) && !acc.description.some(k(r.description))) {
1930
+ if (n(r.description) && !acc.description.some(k(r.description))) {
1934
1931
  acc.description.push(r.description);
1935
1932
  }
1936
- if (n$1(r.technology) && !acc.technology.includes(r.technology)) {
1933
+ if (n(r.technology) && !acc.technology.includes(r.technology)) {
1937
1934
  acc.technology.push(r.technology);
1938
1935
  }
1939
- if (n$1(r.kind) && !acc.kind.includes(r.kind)) {
1936
+ if (n(r.kind) && !acc.kind.includes(r.kind)) {
1940
1937
  acc.kind.push(r.kind);
1941
1938
  }
1942
- if (n$1(r.color) && !acc.color.includes(r.color)) {
1939
+ if (n(r.color) && !acc.color.includes(r.color)) {
1943
1940
  acc.color.push(r.color);
1944
1941
  }
1945
- if (n$1(r.line) && !acc.line.includes(r.line)) {
1942
+ if (n(r.line) && !acc.line.includes(r.line)) {
1946
1943
  acc.line.push(r.line);
1947
1944
  }
1948
- if (n$1(r.head) && !acc.head.includes(r.head)) {
1945
+ if (n(r.head) && !acc.head.includes(r.head)) {
1949
1946
  acc.head.push(r.head);
1950
1947
  }
1951
- if (n$1(r.tail) && !acc.tail.includes(r.tail)) {
1948
+ if (n(r.tail) && !acc.tail.includes(r.tail)) {
1952
1949
  acc.tail.push(r.tail);
1953
1950
  }
1954
- if (n$1(r.navigateTo) && !acc.navigateTo.includes(r.navigateTo)) {
1951
+ if (n(r.navigateTo) && !acc.navigateTo.includes(r.navigateTo)) {
1955
1952
  acc.navigateTo.push(r.navigateTo);
1956
1953
  }
1957
1954
  if (r.tags) {
@@ -1995,12 +1992,12 @@ function mergePropsFromRelationships(relations, prefer) {
1995
1992
  ...isNonEmptyArray(allprops.links) && { links: allprops.links },
1996
1993
  ...isNonEmptyArray(tags) && { tags }
1997
1994
  },
1998
- n$1
1995
+ n
1999
1996
  );
2000
1997
  if (prefer) {
2001
1998
  return {
2002
1999
  ...merged,
2003
- ...d$2(pickRelationshipProps(prefer), n$1)
2000
+ ...d$2(pickRelationshipProps(prefer), n)
2004
2001
  };
2005
2002
  }
2006
2003
  return merged;
@@ -2161,7 +2158,7 @@ function toNodeSource(el) {
2161
2158
  deploymentRef: instance.id,
2162
2159
  modelRef: element.id,
2163
2160
  ...notation && { notation },
2164
- ...!n$3(metadata) && { metadata }
2161
+ ...!n$2(metadata) && { metadata }
2165
2162
  };
2166
2163
  }
2167
2164
  function toComputedEdges$1(connections) {
@@ -2314,7 +2311,7 @@ function findRedundantConnections$1(connections) {
2314
2311
  return C(
2315
2312
  connections,
2316
2313
  mergeConnections,
2317
- l$4((redundants, connection) => {
2314
+ l$3((redundants, connection) => {
2318
2315
  const { source, target, relations } = connection;
2319
2316
  if (source.isInstance() && target.isInstance()) {
2320
2317
  return redundants;
@@ -2410,7 +2407,7 @@ let StageInclude$1 = class StageInclude extends AbstractStageInclude {
2410
2407
  ),
2411
2408
  // Filter out common ancestors
2412
2409
  m(([sourceAncestor, targetAncestor]) => sourceAncestor === targetAncestor),
2413
- l$5(1),
2410
+ l$4(1),
2414
2411
  u(([sourceAncestor, targetAncestor]) => {
2415
2412
  if (source === sourceAncestor && target === targetAncestor) {
2416
2413
  this.addImplicit(boundary);
@@ -2711,10 +2708,10 @@ const DirectRelationPredicate = {
2711
2708
  }
2712
2709
  }
2713
2710
  stage.addConnections(connections);
2714
- if (FqnExpr.isDeploymentRef(source) && l$6(source.selector)) {
2711
+ if (FqnExpr.isDeploymentRef(source) && l$5(source.selector)) {
2715
2712
  stage.addImplicit(model.element(source.ref.deployment));
2716
2713
  }
2717
- if (FqnExpr.isDeploymentRef(target) && l$6(target.selector)) {
2714
+ if (FqnExpr.isDeploymentRef(target) && l$5(target.selector)) {
2718
2715
  stage.addImplicit(model.element(target.ref.deployment));
2719
2716
  }
2720
2717
  return stage;
@@ -3112,7 +3109,7 @@ function findConnectedElements(stage) {
3112
3109
  stage.mergedConnections(),
3113
3110
  cleanCrossBoundary,
3114
3111
  cleanRedundantRelationships,
3115
- l$4((acc, c) => {
3112
+ l$3((acc, c) => {
3116
3113
  acc.add(c.source);
3117
3114
  acc.add(c.target);
3118
3115
  return acc;
@@ -3378,8 +3375,8 @@ function applyCustomElementProperties(_rules, _nodes) {
3378
3375
  textSize,
3379
3376
  description,
3380
3377
  ...rest
3381
- } = d$1(props, n$4);
3382
- const notEmpty = !n$3(rest);
3378
+ } = d$1(props, n$3);
3379
+ const notEmpty = !n$2(rest);
3383
3380
  const satisfies = elementExprToPredicate(expr);
3384
3381
  nodes.forEach((node, i) => {
3385
3382
  if (isGroupElementKind(node) || !satisfies(node)) {
@@ -3438,14 +3435,14 @@ function resolveGlobalRulesInElementView(rules, globals) {
3438
3435
  return rules.reduce((acc, rule) => {
3439
3436
  if (isViewRuleGlobalPredicateRef(rule)) {
3440
3437
  const globalPredicates = globals.predicates[rule.predicateId];
3441
- if (n$4(globalPredicates)) {
3438
+ if (n$3(globalPredicates)) {
3442
3439
  return acc;
3443
3440
  }
3444
3441
  return acc.concat(globalPredicates);
3445
3442
  }
3446
3443
  if (isViewRuleGlobalStyle(rule)) {
3447
3444
  const globalStyles = globals.styles[rule.styleId];
3448
- if (n$4(globalStyles)) {
3445
+ if (n$3(globalStyles)) {
3449
3446
  return acc;
3450
3447
  }
3451
3448
  return acc.concat(globalStyles);
@@ -3458,14 +3455,14 @@ function resolveGlobalRulesInDynamicView(rules, globals) {
3458
3455
  return rules.reduce((acc, rule) => {
3459
3456
  if (isViewRuleGlobalPredicateRef(rule)) {
3460
3457
  const globalPredicates = globals.dynamicPredicates[rule.predicateId];
3461
- if (n$4(globalPredicates)) {
3458
+ if (n$3(globalPredicates)) {
3462
3459
  return acc;
3463
3460
  }
3464
3461
  return acc.concat(globalPredicates);
3465
3462
  }
3466
3463
  if (isViewRuleGlobalStyle(rule)) {
3467
3464
  const globalStyles = globals.styles[rule.styleId];
3468
- if (n$4(globalStyles)) {
3465
+ if (n$3(globalStyles)) {
3469
3466
  return acc;
3470
3467
  }
3471
3468
  return acc.concat(globalStyles);
@@ -3505,7 +3502,7 @@ class DynamicViewCompute {
3505
3502
  color,
3506
3503
  line
3507
3504
  } = this.findRelations(source, target);
3508
- const navigateTo = n$1(stepNavigateTo) && stepNavigateTo !== this.view.id ? stepNavigateTo : derivedNavigateTo;
3505
+ const navigateTo = n(stepNavigateTo) && stepNavigateTo !== this.view.id ? stepNavigateTo : derivedNavigateTo;
3509
3506
  this.steps.push({
3510
3507
  id,
3511
3508
  ...step,
@@ -3648,7 +3645,7 @@ class DynamicViewCompute {
3648
3645
  const alltags = C(
3649
3646
  relationships,
3650
3647
  u$1((r) => r.tags),
3651
- m$1(n$1),
3648
+ m$1(n),
3652
3649
  i$a()
3653
3650
  );
3654
3651
  const tags = i$b(alltags, 1) ? alltags : null;
@@ -3658,17 +3655,17 @@ class DynamicViewCompute {
3658
3655
  const navigateTo = relationNavigateTo && relationNavigateTo !== this.view.id ? relationNavigateTo : C(
3659
3656
  relationships,
3660
3657
  m$2((r) => r.$relationship.navigateTo),
3661
- m$1(n$1),
3658
+ m$1(n),
3662
3659
  m$1((v) => v !== this.view.id),
3663
3660
  i$a(),
3664
3661
  t$4()
3665
3662
  );
3666
3663
  const commonProperties = C(
3667
3664
  relationships,
3668
- l$4((acc, { title, $relationship: r }) => {
3669
- n$1(title) && acc.title.add(title);
3670
- n$1(r.color) && acc.color.add(r.color);
3671
- n$1(r.line) && acc.line.add(r.line);
3665
+ l$3((acc, { title, $relationship: r }) => {
3666
+ n(title) && acc.title.add(title);
3667
+ n(r.color) && acc.color.add(r.color);
3668
+ n(r.line) && acc.line.add(r.line);
3672
3669
  return acc;
3673
3670
  }, {
3674
3671
  color: /* @__PURE__ */ new Set(),
@@ -3743,7 +3740,7 @@ function applyCustomRelationProperties(_rules, nodes, _edges) {
3743
3740
  ...customprops
3744
3741
  }
3745
3742
  } of rules) {
3746
- const props = d$1(customprops, n$4);
3743
+ const props = d$1(customprops, n$3);
3747
3744
  const satisfies = relationExpressionToPredicates(expr);
3748
3745
  edges.forEach((edge, i) => {
3749
3746
  let source, target;
@@ -3909,7 +3906,7 @@ class StageInclude extends AbstractStageInclude {
3909
3906
  ),
3910
3907
  // Filter out common ancestors
3911
3908
  m(([sourceAncestor, targetAncestor]) => sourceAncestor === targetAncestor),
3912
- l$5(1),
3909
+ l$4(1),
3913
3910
  u(([sourceAncestor, targetAncestor]) => {
3914
3911
  if (sourceAncestor === source && targetAncestor === target) {
3915
3912
  this.addImplicitWithinScope(boundary);
@@ -4065,7 +4062,7 @@ function findRedundantConnections(connections) {
4065
4062
  return C(
4066
4063
  [...connections],
4067
4064
  mergeConnections,
4068
- l$4((reducedConnections, connection, _, all) => {
4065
+ l$3((reducedConnections, connection, _, all) => {
4069
4066
  const descendants = findDescendantConnections(all, connection);
4070
4067
  const nestedRelations = union(
4071
4068
  ...descendants.map(p$1("relations"))
@@ -4354,6 +4351,7 @@ function buildNodes(memory) {
4354
4351
  }
4355
4352
 
4356
4353
  const isWildcard = ModelFqnExpr.isWildcard;
4354
+ const isAncestorOrDescendantOf = (a, b) => a.isAncestorOf(b) || a.isDescendantOf(b);
4357
4355
  const DirectRelationExprPredicate = {
4358
4356
  include: ({ expr: { source, target, isBidirectional = false }, memory, model, stage, where, filterWhere }) => {
4359
4357
  const sourceIsWildcard = isWildcard(source);
@@ -4407,6 +4405,7 @@ const DirectRelationExprPredicate = {
4407
4405
  ([outgoing, incoming]) => a(
4408
4406
  C(
4409
4407
  outgoing,
4408
+ m$1((r) => !isAncestorOrDescendantOf(source2, r.target)),
4410
4409
  m$2(
4411
4410
  (outgoing2) => new ConnectionModel(
4412
4411
  source2,
@@ -4417,6 +4416,7 @@ const DirectRelationExprPredicate = {
4417
4416
  ),
4418
4417
  C(
4419
4418
  incoming,
4419
+ m$1((r) => !isAncestorOrDescendantOf(source2, r.source)),
4420
4420
  m$2(
4421
4421
  (incoming2) => new ConnectionModel(
4422
4422
  incoming2.source,
@@ -4462,6 +4462,7 @@ const DirectRelationExprPredicate = {
4462
4462
  ([incoming, outgoing]) => a(
4463
4463
  C(
4464
4464
  outgoing,
4465
+ m$1((r) => !isAncestorOrDescendantOf(target2, r.target)),
4465
4466
  m$2(
4466
4467
  (outgoing2) => new ConnectionModel(
4467
4468
  target2,
@@ -4472,6 +4473,7 @@ const DirectRelationExprPredicate = {
4472
4473
  ),
4473
4474
  C(
4474
4475
  incoming,
4476
+ m$1((r) => !isAncestorOrDescendantOf(target2, r.source)),
4475
4477
  m$2(
4476
4478
  (incoming2) => new ConnectionModel(
4477
4479
  incoming2.source,
@@ -5227,4 +5229,4 @@ function computeLikeC4Model(parsed) {
5227
5229
  return LikeC4Model.create(computeParsedModelData(parsed));
5228
5230
  }
5229
5231
 
5230
- export { Graph as G, computeParsedModelData as a, computeView as b, computeLikeC4Model as c, d$2 as d, i$5 as i, l$2 as l, topologicalSortExports as t, unsafeComputeView as u, willCreateCycle as w };
5232
+ export { Graph as G, computeParsedModelData as a, computeView as b, computeLikeC4Model as c, d$2 as d, i$5 as i, l$1 as l, topologicalSortExports as t, unsafeComputeView as u, willCreateCycle as w };