@likec4/generators 1.59.2 → 1.59.3
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.
- package/dist/chunks/newline.mjs +4 -0
- package/dist/index.d.mts +18 -1
- package/dist/index.mjs +27 -27
- package/dist/likec4/index.d.mts +61 -19
- package/dist/likec4/index.mjs +2 -3
- package/package.json +10 -10
- package/src/d2/generate-d2.ts +3 -2
- package/src/index.ts +1 -0
- package/src/likec4/operators/base.ts +2 -3
- package/src/likec4/operators/views.ts +5 -1
- package/src/likec4/schemas/specification.ts +1 -5
- package/src/likec4/schemas/views.ts +8 -3
- package/src/markdown/generate-markdown.ts +52 -0
- package/src/markdown/index.ts +1 -0
- package/src/mmd/generate-mmd.ts +3 -2
- package/src/newline.ts +21 -0
- package/src/puml/generate-puml.ts +3 -2
- package/src/views-data-ts/generate-views-data.ts +8 -7
package/dist/likec4/index.d.mts
CHANGED
|
@@ -2684,11 +2684,11 @@ declare const relationship$2: z$1.ZodPipe<z$1.ZodObject<{
|
|
|
2684
2684
|
tail?: any;
|
|
2685
2685
|
}>>;
|
|
2686
2686
|
declare const tagSpec: z$1.ZodPipe<z$1.ZodObject<{
|
|
2687
|
-
color: z$1.ZodOptional<z$1.
|
|
2687
|
+
color: z$1.ZodOptional<z$1.ZodNullable<ZColor>>;
|
|
2688
2688
|
}, z$1.core.$strip>, z$1.ZodTransform<{
|
|
2689
|
-
|
|
2689
|
+
[x: string]: any;
|
|
2690
2690
|
}, {
|
|
2691
|
-
color?:
|
|
2691
|
+
color?: any;
|
|
2692
2692
|
}>>;
|
|
2693
2693
|
declare const schema: z$1.ZodObject<{
|
|
2694
2694
|
elements: z$1.ZodOptional<z$1.ZodRecord<ZKind, z$1.ZodPipe<z$1.ZodObject<{
|
|
@@ -2751,11 +2751,11 @@ declare const schema: z$1.ZodObject<{
|
|
|
2751
2751
|
tail?: any;
|
|
2752
2752
|
}>>>>;
|
|
2753
2753
|
tags: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodRecord<ZTag, z$1.ZodPipe<z$1.ZodObject<{
|
|
2754
|
-
color: z$1.ZodOptional<z$1.
|
|
2754
|
+
color: z$1.ZodOptional<z$1.ZodNullable<ZColor>>;
|
|
2755
2755
|
}, z$1.core.$strip>, z$1.ZodTransform<{
|
|
2756
|
-
|
|
2756
|
+
[x: string]: any;
|
|
2757
2757
|
}, {
|
|
2758
|
-
color?:
|
|
2758
|
+
color?: any;
|
|
2759
2759
|
}>>>, z$1.ZodPipe<z$1.ZodArray<ZTag>, z$1.ZodTransform<Record<scalar.Tag, Record<string, any>>, scalar.Tag[]>>]>>;
|
|
2760
2760
|
}, z$1.core.$strip>;
|
|
2761
2761
|
declare namespace views_d_exports$1 {
|
|
@@ -4986,7 +4986,7 @@ declare const viewRuleRank$1: z$1.ZodPipe<z$1.ZodObject<{
|
|
|
4986
4986
|
rank: "source" | "max" | "min" | "same" | "sink";
|
|
4987
4987
|
}>>;
|
|
4988
4988
|
type ViewRuleGroupInput = {
|
|
4989
|
-
groupRules: Array<z$1.input<typeof viewRulePredicate$1> | ViewRuleGroupInput>;
|
|
4989
|
+
groupRules: Array<z$1.input<typeof viewRulePredicate$1> | z$1.input<typeof viewRuleGlobalPredicate$1> | ViewRuleGroupInput>;
|
|
4990
4990
|
title: string | null;
|
|
4991
4991
|
color?: z$1.input<typeof color> | undefined;
|
|
4992
4992
|
border?: z$1.input<typeof border> | undefined;
|
|
@@ -4997,7 +4997,7 @@ type ViewRuleGroupInput = {
|
|
|
4997
4997
|
textSize?: z$1.input<typeof size> | undefined;
|
|
4998
4998
|
};
|
|
4999
4999
|
type ViewRuleGroupOutput = {
|
|
5000
|
-
groupRules: Array<z$1.infer<typeof viewRulePredicate$1> | ViewRuleGroupOutput>;
|
|
5000
|
+
groupRules: Array<z$1.infer<typeof viewRulePredicate$1> | z$1.infer<typeof viewRuleGlobalPredicate$1> | ViewRuleGroupOutput>;
|
|
5001
5001
|
title: string | null;
|
|
5002
5002
|
color?: z$1.infer<typeof color> | undefined;
|
|
5003
5003
|
border?: z$1.infer<typeof border> | undefined;
|
|
@@ -6515,6 +6515,7 @@ declare const elementView$1: z$1.ZodObject<{
|
|
|
6515
6515
|
id: ZViewId;
|
|
6516
6516
|
title: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
6517
6517
|
description: z$1.ZodOptional<z$1.ZodNullable<ZMarkdownOrString>>;
|
|
6518
|
+
order: z$1.ZodOptional<z$1.ZodNumber>;
|
|
6518
6519
|
tags: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodReadonly<z$1.ZodArray<ZTag>>>>;
|
|
6519
6520
|
links: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodReadonly<z$1.ZodArray<ZLink>>>>;
|
|
6520
6521
|
_type: z$1.ZodLiteral<"element">;
|
|
@@ -9501,6 +9502,7 @@ declare const deploymentView$1: z$1.ZodObject<{
|
|
|
9501
9502
|
id: ZViewId;
|
|
9502
9503
|
title: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
9503
9504
|
description: z$1.ZodOptional<z$1.ZodNullable<ZMarkdownOrString>>;
|
|
9505
|
+
order: z$1.ZodOptional<z$1.ZodNumber>;
|
|
9504
9506
|
tags: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodReadonly<z$1.ZodArray<ZTag>>>>;
|
|
9505
9507
|
links: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodReadonly<z$1.ZodArray<ZLink>>>>;
|
|
9506
9508
|
_type: z$1.ZodLiteral<"deployment">;
|
|
@@ -11872,6 +11874,7 @@ declare const dynamicView$1: z$1.ZodObject<{
|
|
|
11872
11874
|
id: ZViewId;
|
|
11873
11875
|
title: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
11874
11876
|
description: z$1.ZodOptional<z$1.ZodNullable<ZMarkdownOrString>>;
|
|
11877
|
+
order: z$1.ZodOptional<z$1.ZodNumber>;
|
|
11875
11878
|
tags: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodReadonly<z$1.ZodArray<ZTag>>>>;
|
|
11876
11879
|
links: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodReadonly<z$1.ZodArray<ZLink>>>>;
|
|
11877
11880
|
_type: z$1.ZodLiteral<"dynamic">;
|
|
@@ -12282,6 +12285,7 @@ declare const anyView$1: z$1.ZodUnion<readonly [z$1.ZodObject<{
|
|
|
12282
12285
|
id: ZViewId;
|
|
12283
12286
|
title: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
12284
12287
|
description: z$1.ZodOptional<z$1.ZodNullable<ZMarkdownOrString>>;
|
|
12288
|
+
order: z$1.ZodOptional<z$1.ZodNumber>;
|
|
12285
12289
|
tags: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodReadonly<z$1.ZodArray<ZTag>>>>;
|
|
12286
12290
|
links: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodReadonly<z$1.ZodArray<ZLink>>>>;
|
|
12287
12291
|
_type: z$1.ZodLiteral<"element">;
|
|
@@ -13790,6 +13794,7 @@ declare const anyView$1: z$1.ZodUnion<readonly [z$1.ZodObject<{
|
|
|
13790
13794
|
id: ZViewId;
|
|
13791
13795
|
title: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
13792
13796
|
description: z$1.ZodOptional<z$1.ZodNullable<ZMarkdownOrString>>;
|
|
13797
|
+
order: z$1.ZodOptional<z$1.ZodNumber>;
|
|
13793
13798
|
tags: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodReadonly<z$1.ZodArray<ZTag>>>>;
|
|
13794
13799
|
links: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodReadonly<z$1.ZodArray<ZLink>>>>;
|
|
13795
13800
|
_type: z$1.ZodLiteral<"deployment">;
|
|
@@ -15270,6 +15275,7 @@ declare const anyView$1: z$1.ZodUnion<readonly [z$1.ZodObject<{
|
|
|
15270
15275
|
id: ZViewId;
|
|
15271
15276
|
title: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
15272
15277
|
description: z$1.ZodOptional<z$1.ZodNullable<ZMarkdownOrString>>;
|
|
15278
|
+
order: z$1.ZodOptional<z$1.ZodNumber>;
|
|
15273
15279
|
tags: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodReadonly<z$1.ZodArray<ZTag>>>>;
|
|
15274
15280
|
links: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodReadonly<z$1.ZodArray<ZLink>>>>;
|
|
15275
15281
|
_type: z$1.ZodLiteral<"dynamic">;
|
|
@@ -15680,6 +15686,7 @@ declare const views$1: z$1.ZodRecord<ZViewId, z$1.ZodUnion<readonly [z$1.ZodObje
|
|
|
15680
15686
|
id: ZViewId;
|
|
15681
15687
|
title: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
15682
15688
|
description: z$1.ZodOptional<z$1.ZodNullable<ZMarkdownOrString>>;
|
|
15689
|
+
order: z$1.ZodOptional<z$1.ZodNumber>;
|
|
15683
15690
|
tags: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodReadonly<z$1.ZodArray<ZTag>>>>;
|
|
15684
15691
|
links: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodReadonly<z$1.ZodArray<ZLink>>>>;
|
|
15685
15692
|
_type: z$1.ZodLiteral<"element">;
|
|
@@ -17188,6 +17195,7 @@ declare const views$1: z$1.ZodRecord<ZViewId, z$1.ZodUnion<readonly [z$1.ZodObje
|
|
|
17188
17195
|
id: ZViewId;
|
|
17189
17196
|
title: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
17190
17197
|
description: z$1.ZodOptional<z$1.ZodNullable<ZMarkdownOrString>>;
|
|
17198
|
+
order: z$1.ZodOptional<z$1.ZodNumber>;
|
|
17191
17199
|
tags: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodReadonly<z$1.ZodArray<ZTag>>>>;
|
|
17192
17200
|
links: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodReadonly<z$1.ZodArray<ZLink>>>>;
|
|
17193
17201
|
_type: z$1.ZodLiteral<"deployment">;
|
|
@@ -18668,6 +18676,7 @@ declare const views$1: z$1.ZodRecord<ZViewId, z$1.ZodUnion<readonly [z$1.ZodObje
|
|
|
18668
18676
|
id: ZViewId;
|
|
18669
18677
|
title: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
18670
18678
|
description: z$1.ZodOptional<z$1.ZodNullable<ZMarkdownOrString>>;
|
|
18679
|
+
order: z$1.ZodOptional<z$1.ZodNumber>;
|
|
18671
18680
|
tags: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodReadonly<z$1.ZodArray<ZTag>>>>;
|
|
18672
18681
|
links: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodReadonly<z$1.ZodArray<ZLink>>>>;
|
|
18673
18682
|
_type: z$1.ZodLiteral<"dynamic">;
|
|
@@ -19088,6 +19097,7 @@ declare const schemas: {
|
|
|
19088
19097
|
id: ZViewId;
|
|
19089
19098
|
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
19090
19099
|
description: z.ZodOptional<z.ZodNullable<ZMarkdownOrString>>;
|
|
19100
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
19091
19101
|
tags: z.ZodOptional<z.ZodNullable<z.ZodReadonly<z.ZodArray<ZTag>>>>;
|
|
19092
19102
|
links: z.ZodOptional<z.ZodNullable<z.ZodReadonly<z.ZodArray<ZLink>>>>;
|
|
19093
19103
|
_type: z.ZodLiteral<"element">;
|
|
@@ -20596,6 +20606,7 @@ declare const schemas: {
|
|
|
20596
20606
|
id: ZViewId;
|
|
20597
20607
|
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
20598
20608
|
description: z.ZodOptional<z.ZodNullable<ZMarkdownOrString>>;
|
|
20609
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
20599
20610
|
tags: z.ZodOptional<z.ZodNullable<z.ZodReadonly<z.ZodArray<ZTag>>>>;
|
|
20600
20611
|
links: z.ZodOptional<z.ZodNullable<z.ZodReadonly<z.ZodArray<ZLink>>>>;
|
|
20601
20612
|
_type: z.ZodLiteral<"deployment">;
|
|
@@ -22076,6 +22087,7 @@ declare const schemas: {
|
|
|
22076
22087
|
id: ZViewId;
|
|
22077
22088
|
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
22078
22089
|
description: z.ZodOptional<z.ZodNullable<ZMarkdownOrString>>;
|
|
22090
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
22079
22091
|
tags: z.ZodOptional<z.ZodNullable<z.ZodReadonly<z.ZodArray<ZTag>>>>;
|
|
22080
22092
|
links: z.ZodOptional<z.ZodNullable<z.ZodReadonly<z.ZodArray<ZLink>>>>;
|
|
22081
22093
|
_type: z.ZodLiteral<"dynamic">;
|
|
@@ -23031,11 +23043,11 @@ declare const schemas: {
|
|
|
23031
23043
|
tail?: any;
|
|
23032
23044
|
}>>>>;
|
|
23033
23045
|
tags: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<ZTag, z.ZodPipe<z.ZodObject<{
|
|
23034
|
-
color: z.ZodOptional<z.
|
|
23046
|
+
color: z.ZodOptional<z.ZodNullable<ZColor>>;
|
|
23035
23047
|
}, z.core.$strip>, z.ZodTransform<{
|
|
23036
|
-
|
|
23048
|
+
[x: string]: any;
|
|
23037
23049
|
}, {
|
|
23038
|
-
color?:
|
|
23050
|
+
color?: any;
|
|
23039
23051
|
}>>>, z.ZodPipe<z.ZodArray<ZTag>, z.ZodTransform<Record<scalar.Tag, Record<string, any>>, scalar.Tag[]>>]>>;
|
|
23040
23052
|
}, z.core.$strip>>;
|
|
23041
23053
|
elements: z.ZodOptional<z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodRecord<ZFqn, z.ZodReadonly<z.ZodPipe<z.ZodObject<{
|
|
@@ -23207,6 +23219,7 @@ declare const schemas: {
|
|
|
23207
23219
|
rules: any[];
|
|
23208
23220
|
title?: string | null | undefined;
|
|
23209
23221
|
description?: any;
|
|
23222
|
+
order?: number | undefined;
|
|
23210
23223
|
tags?: readonly scalar.Tag[] | null | undefined;
|
|
23211
23224
|
links?: readonly Link[] | null | undefined;
|
|
23212
23225
|
viewOf?: any;
|
|
@@ -23217,6 +23230,7 @@ declare const schemas: {
|
|
|
23217
23230
|
rules: any[];
|
|
23218
23231
|
title?: string | null | undefined;
|
|
23219
23232
|
description?: any;
|
|
23233
|
+
order?: number | undefined;
|
|
23220
23234
|
tags?: readonly scalar.Tag[] | null | undefined;
|
|
23221
23235
|
links?: readonly Link[] | null | undefined;
|
|
23222
23236
|
} | {
|
|
@@ -23224,6 +23238,7 @@ declare const schemas: {
|
|
|
23224
23238
|
_type: "dynamic";
|
|
23225
23239
|
title?: string | null | undefined;
|
|
23226
23240
|
description?: any;
|
|
23241
|
+
order?: number | undefined;
|
|
23227
23242
|
tags?: readonly scalar.Tag[] | null | undefined;
|
|
23228
23243
|
links?: readonly Link[] | null | undefined;
|
|
23229
23244
|
variant?: "diagram" | "sequence" | undefined;
|
|
@@ -23695,7 +23710,7 @@ declare const schemas: {
|
|
|
23695
23710
|
[x: string]: any;
|
|
23696
23711
|
}> | undefined;
|
|
23697
23712
|
tags?: Record<scalar.Tag, Record<string, any>> | Record<scalar.Tag, {
|
|
23698
|
-
|
|
23713
|
+
[x: string]: any;
|
|
23699
23714
|
}> | undefined;
|
|
23700
23715
|
} | undefined;
|
|
23701
23716
|
elements?: Record<scalar.Fqn, Readonly<{
|
|
@@ -23711,6 +23726,7 @@ declare const schemas: {
|
|
|
23711
23726
|
rules: any[];
|
|
23712
23727
|
title?: string | null | undefined;
|
|
23713
23728
|
description?: any;
|
|
23729
|
+
order?: number | undefined;
|
|
23714
23730
|
tags?: readonly scalar.Tag[] | null | undefined;
|
|
23715
23731
|
links?: readonly Link[] | null | undefined;
|
|
23716
23732
|
viewOf?: any;
|
|
@@ -23721,6 +23737,7 @@ declare const schemas: {
|
|
|
23721
23737
|
rules: any[];
|
|
23722
23738
|
title?: string | null | undefined;
|
|
23723
23739
|
description?: any;
|
|
23740
|
+
order?: number | undefined;
|
|
23724
23741
|
tags?: readonly scalar.Tag[] | null | undefined;
|
|
23725
23742
|
links?: readonly Link[] | null | undefined;
|
|
23726
23743
|
} | {
|
|
@@ -23728,6 +23745,7 @@ declare const schemas: {
|
|
|
23728
23745
|
_type: "dynamic";
|
|
23729
23746
|
title?: string | null | undefined;
|
|
23730
23747
|
description?: any;
|
|
23748
|
+
order?: number | undefined;
|
|
23731
23749
|
tags?: readonly scalar.Tag[] | null | undefined;
|
|
23732
23750
|
links?: readonly Link[] | null | undefined;
|
|
23733
23751
|
variant?: "diagram" | "sequence" | undefined;
|
|
@@ -24199,7 +24217,7 @@ declare const schemas: {
|
|
|
24199
24217
|
[x: string]: any;
|
|
24200
24218
|
}> | undefined;
|
|
24201
24219
|
tags?: Record<scalar.Tag, Record<string, any>> | Record<scalar.Tag, {
|
|
24202
|
-
|
|
24220
|
+
[x: string]: any;
|
|
24203
24221
|
}> | undefined;
|
|
24204
24222
|
} | undefined;
|
|
24205
24223
|
elements?: Record<scalar.Fqn, Readonly<{
|
|
@@ -27192,6 +27210,7 @@ declare const likec4data: <A extends Readonly<{
|
|
|
27192
27210
|
_type: "element";
|
|
27193
27211
|
title?: string | null | undefined;
|
|
27194
27212
|
description?: MarkdownOrStringInput | null | undefined;
|
|
27213
|
+
order?: number | undefined;
|
|
27195
27214
|
tags?: readonly string[] | null | undefined;
|
|
27196
27215
|
links?: readonly (string | {
|
|
27197
27216
|
url: string;
|
|
@@ -27956,6 +27975,7 @@ declare const likec4data: <A extends Readonly<{
|
|
|
27956
27975
|
_type: "deployment";
|
|
27957
27976
|
title?: string | null | undefined;
|
|
27958
27977
|
description?: MarkdownOrStringInput | null | undefined;
|
|
27978
|
+
order?: number | undefined;
|
|
27959
27979
|
tags?: readonly string[] | null | undefined;
|
|
27960
27980
|
links?: readonly (string | {
|
|
27961
27981
|
url: string;
|
|
@@ -28706,6 +28726,7 @@ declare const likec4data: <A extends Readonly<{
|
|
|
28706
28726
|
_type: "dynamic";
|
|
28707
28727
|
title?: string | null | undefined;
|
|
28708
28728
|
description?: MarkdownOrStringInput | null | undefined;
|
|
28729
|
+
order?: number | undefined;
|
|
28709
28730
|
tags?: readonly string[] | null | undefined;
|
|
28710
28731
|
links?: readonly (string | {
|
|
28711
28732
|
url: string;
|
|
@@ -29825,7 +29846,7 @@ declare const likec4data: <A extends Readonly<{
|
|
|
29825
29846
|
tail?: any;
|
|
29826
29847
|
}> | undefined;
|
|
29827
29848
|
tags?: string[] | Record<string, {
|
|
29828
|
-
color?:
|
|
29849
|
+
color?: any;
|
|
29829
29850
|
}> | undefined;
|
|
29830
29851
|
} | undefined;
|
|
29831
29852
|
elements?: Record<string, Readonly<{
|
|
@@ -29922,6 +29943,7 @@ declare const likec4data: <A extends Readonly<{
|
|
|
29922
29943
|
_type: "element";
|
|
29923
29944
|
title?: string | null | undefined;
|
|
29924
29945
|
description?: MarkdownOrStringInput | null | undefined;
|
|
29946
|
+
order?: number | undefined;
|
|
29925
29947
|
tags?: readonly string[] | null | undefined;
|
|
29926
29948
|
links?: readonly (string | {
|
|
29927
29949
|
url: string;
|
|
@@ -30686,6 +30708,7 @@ declare const likec4data: <A extends Readonly<{
|
|
|
30686
30708
|
_type: "deployment";
|
|
30687
30709
|
title?: string | null | undefined;
|
|
30688
30710
|
description?: MarkdownOrStringInput | null | undefined;
|
|
30711
|
+
order?: number | undefined;
|
|
30689
30712
|
tags?: readonly string[] | null | undefined;
|
|
30690
30713
|
links?: readonly (string | {
|
|
30691
30714
|
url: string;
|
|
@@ -31436,6 +31459,7 @@ declare const likec4data: <A extends Readonly<{
|
|
|
31436
31459
|
_type: "dynamic";
|
|
31437
31460
|
title?: string | null | undefined;
|
|
31438
31461
|
description?: MarkdownOrStringInput | null | undefined;
|
|
31462
|
+
order?: number | undefined;
|
|
31439
31463
|
tags?: readonly string[] | null | undefined;
|
|
31440
31464
|
links?: readonly (string | {
|
|
31441
31465
|
url: string;
|
|
@@ -32555,7 +32579,7 @@ declare const likec4data: <A extends Readonly<{
|
|
|
32555
32579
|
tail?: any;
|
|
32556
32580
|
}> | undefined;
|
|
32557
32581
|
tags?: string[] | Record<string, {
|
|
32558
|
-
color?:
|
|
32582
|
+
color?: any;
|
|
32559
32583
|
}> | undefined;
|
|
32560
32584
|
} | undefined;
|
|
32561
32585
|
elements?: Record<string, Readonly<{
|
|
@@ -32979,9 +33003,9 @@ declare namespace specification_d_exports {
|
|
|
32979
33003
|
export { elementKind, relationshipKind, specification, tagSpecification };
|
|
32980
33004
|
}
|
|
32981
33005
|
declare const tagSpecification: <A extends [string, {
|
|
32982
|
-
color?:
|
|
33006
|
+
color?: any;
|
|
32983
33007
|
}] = [string, {
|
|
32984
|
-
color?:
|
|
33008
|
+
color?: any;
|
|
32985
33009
|
}]>() => Op<A>;
|
|
32986
33010
|
declare const elementKind: (keyword: "element" | "deploymentNode") => <A extends [string, {
|
|
32987
33011
|
tags?: readonly string[] | null | undefined;
|
|
@@ -33059,7 +33083,7 @@ declare const specification: <A extends {
|
|
|
33059
33083
|
tail?: any;
|
|
33060
33084
|
}> | undefined;
|
|
33061
33085
|
tags?: string[] | Record<string, {
|
|
33062
|
-
color?:
|
|
33086
|
+
color?: any;
|
|
33063
33087
|
}> | undefined;
|
|
33064
33088
|
} = {
|
|
33065
33089
|
elements?: Record<string, {
|
|
@@ -33097,7 +33121,7 @@ declare const specification: <A extends {
|
|
|
33097
33121
|
tail?: any;
|
|
33098
33122
|
}> | undefined;
|
|
33099
33123
|
tags?: string[] | Record<string, {
|
|
33100
|
-
color?:
|
|
33124
|
+
color?: any;
|
|
33101
33125
|
}> | undefined;
|
|
33102
33126
|
}>() => Op<A>;
|
|
33103
33127
|
declare namespace views_d_exports {
|
|
@@ -36124,6 +36148,7 @@ declare const elementView: <A extends {
|
|
|
36124
36148
|
id: string;
|
|
36125
36149
|
title?: string | null | undefined;
|
|
36126
36150
|
description?: MarkdownOrStringInput | null | undefined;
|
|
36151
|
+
order?: number | undefined;
|
|
36127
36152
|
tags?: readonly string[] | null | undefined;
|
|
36128
36153
|
links?: readonly (string | {
|
|
36129
36154
|
url: string;
|
|
@@ -36888,6 +36913,7 @@ declare const elementView: <A extends {
|
|
|
36888
36913
|
id: string;
|
|
36889
36914
|
title?: string | null | undefined;
|
|
36890
36915
|
description?: MarkdownOrStringInput | null | undefined;
|
|
36916
|
+
order?: number | undefined;
|
|
36891
36917
|
tags?: readonly string[] | null | undefined;
|
|
36892
36918
|
links?: readonly (string | {
|
|
36893
36919
|
url: string;
|
|
@@ -39132,6 +39158,7 @@ declare const deploymentView: <A extends {
|
|
|
39132
39158
|
id: string;
|
|
39133
39159
|
title?: string | null | undefined;
|
|
39134
39160
|
description?: MarkdownOrStringInput | null | undefined;
|
|
39161
|
+
order?: number | undefined;
|
|
39135
39162
|
tags?: readonly string[] | null | undefined;
|
|
39136
39163
|
links?: readonly (string | {
|
|
39137
39164
|
url: string;
|
|
@@ -39882,6 +39909,7 @@ declare const deploymentView: <A extends {
|
|
|
39882
39909
|
id: string;
|
|
39883
39910
|
title?: string | null | undefined;
|
|
39884
39911
|
description?: MarkdownOrStringInput | null | undefined;
|
|
39912
|
+
order?: number | undefined;
|
|
39885
39913
|
tags?: readonly string[] | null | undefined;
|
|
39886
39914
|
links?: readonly (string | {
|
|
39887
39915
|
url: string;
|
|
@@ -47419,6 +47447,7 @@ declare const dynamicView: <A extends {
|
|
|
47419
47447
|
id: string;
|
|
47420
47448
|
title?: string | null | undefined;
|
|
47421
47449
|
description?: MarkdownOrStringInput | null | undefined;
|
|
47450
|
+
order?: number | undefined;
|
|
47422
47451
|
tags?: readonly string[] | null | undefined;
|
|
47423
47452
|
links?: readonly (string | {
|
|
47424
47453
|
url: string;
|
|
@@ -48242,6 +48271,7 @@ declare const dynamicView: <A extends {
|
|
|
48242
48271
|
id: string;
|
|
48243
48272
|
title?: string | null | undefined;
|
|
48244
48273
|
description?: MarkdownOrStringInput | null | undefined;
|
|
48274
|
+
order?: number | undefined;
|
|
48245
48275
|
tags?: readonly string[] | null | undefined;
|
|
48246
48276
|
links?: readonly (string | {
|
|
48247
48277
|
url: string;
|
|
@@ -49067,6 +49097,7 @@ declare const anyView: <A extends {
|
|
|
49067
49097
|
_type: "element";
|
|
49068
49098
|
title?: string | null | undefined;
|
|
49069
49099
|
description?: MarkdownOrStringInput | null | undefined;
|
|
49100
|
+
order?: number | undefined;
|
|
49070
49101
|
tags?: readonly string[] | null | undefined;
|
|
49071
49102
|
links?: readonly (string | {
|
|
49072
49103
|
url: string;
|
|
@@ -49831,6 +49862,7 @@ declare const anyView: <A extends {
|
|
|
49831
49862
|
_type: "deployment";
|
|
49832
49863
|
title?: string | null | undefined;
|
|
49833
49864
|
description?: MarkdownOrStringInput | null | undefined;
|
|
49865
|
+
order?: number | undefined;
|
|
49834
49866
|
tags?: readonly string[] | null | undefined;
|
|
49835
49867
|
links?: readonly (string | {
|
|
49836
49868
|
url: string;
|
|
@@ -50581,6 +50613,7 @@ declare const anyView: <A extends {
|
|
|
50581
50613
|
_type: "dynamic";
|
|
50582
50614
|
title?: string | null | undefined;
|
|
50583
50615
|
description?: MarkdownOrStringInput | null | undefined;
|
|
50616
|
+
order?: number | undefined;
|
|
50584
50617
|
tags?: readonly string[] | null | undefined;
|
|
50585
50618
|
links?: readonly (string | {
|
|
50586
50619
|
url: string;
|
|
@@ -51404,6 +51437,7 @@ declare const anyView: <A extends {
|
|
|
51404
51437
|
_type: "element";
|
|
51405
51438
|
title?: string | null | undefined;
|
|
51406
51439
|
description?: MarkdownOrStringInput | null | undefined;
|
|
51440
|
+
order?: number | undefined;
|
|
51407
51441
|
tags?: readonly string[] | null | undefined;
|
|
51408
51442
|
links?: readonly (string | {
|
|
51409
51443
|
url: string;
|
|
@@ -52168,6 +52202,7 @@ declare const anyView: <A extends {
|
|
|
52168
52202
|
_type: "deployment";
|
|
52169
52203
|
title?: string | null | undefined;
|
|
52170
52204
|
description?: MarkdownOrStringInput | null | undefined;
|
|
52205
|
+
order?: number | undefined;
|
|
52171
52206
|
tags?: readonly string[] | null | undefined;
|
|
52172
52207
|
links?: readonly (string | {
|
|
52173
52208
|
url: string;
|
|
@@ -52918,6 +52953,7 @@ declare const anyView: <A extends {
|
|
|
52918
52953
|
_type: "dynamic";
|
|
52919
52954
|
title?: string | null | undefined;
|
|
52920
52955
|
description?: MarkdownOrStringInput | null | undefined;
|
|
52956
|
+
order?: number | undefined;
|
|
52921
52957
|
tags?: readonly string[] | null | undefined;
|
|
52922
52958
|
links?: readonly (string | {
|
|
52923
52959
|
url: string;
|
|
@@ -53742,6 +53778,7 @@ declare const views: <A extends Record<string, {
|
|
|
53742
53778
|
_type: "element";
|
|
53743
53779
|
title?: string | null | undefined;
|
|
53744
53780
|
description?: MarkdownOrStringInput | null | undefined;
|
|
53781
|
+
order?: number | undefined;
|
|
53745
53782
|
tags?: readonly string[] | null | undefined;
|
|
53746
53783
|
links?: readonly (string | {
|
|
53747
53784
|
url: string;
|
|
@@ -54506,6 +54543,7 @@ declare const views: <A extends Record<string, {
|
|
|
54506
54543
|
_type: "deployment";
|
|
54507
54544
|
title?: string | null | undefined;
|
|
54508
54545
|
description?: MarkdownOrStringInput | null | undefined;
|
|
54546
|
+
order?: number | undefined;
|
|
54509
54547
|
tags?: readonly string[] | null | undefined;
|
|
54510
54548
|
links?: readonly (string | {
|
|
54511
54549
|
url: string;
|
|
@@ -55256,6 +55294,7 @@ declare const views: <A extends Record<string, {
|
|
|
55256
55294
|
_type: "dynamic";
|
|
55257
55295
|
title?: string | null | undefined;
|
|
55258
55296
|
description?: MarkdownOrStringInput | null | undefined;
|
|
55297
|
+
order?: number | undefined;
|
|
55259
55298
|
tags?: readonly string[] | null | undefined;
|
|
55260
55299
|
links?: readonly (string | {
|
|
55261
55300
|
url: string;
|
|
@@ -56079,6 +56118,7 @@ declare const views: <A extends Record<string, {
|
|
|
56079
56118
|
_type: "element";
|
|
56080
56119
|
title?: string | null | undefined;
|
|
56081
56120
|
description?: MarkdownOrStringInput | null | undefined;
|
|
56121
|
+
order?: number | undefined;
|
|
56082
56122
|
tags?: readonly string[] | null | undefined;
|
|
56083
56123
|
links?: readonly (string | {
|
|
56084
56124
|
url: string;
|
|
@@ -56843,6 +56883,7 @@ declare const views: <A extends Record<string, {
|
|
|
56843
56883
|
_type: "deployment";
|
|
56844
56884
|
title?: string | null | undefined;
|
|
56845
56885
|
description?: MarkdownOrStringInput | null | undefined;
|
|
56886
|
+
order?: number | undefined;
|
|
56846
56887
|
tags?: readonly string[] | null | undefined;
|
|
56847
56888
|
links?: readonly (string | {
|
|
56848
56889
|
url: string;
|
|
@@ -57593,6 +57634,7 @@ declare const views: <A extends Record<string, {
|
|
|
57593
57634
|
_type: "dynamic";
|
|
57594
57635
|
title?: string | null | undefined;
|
|
57595
57636
|
description?: MarkdownOrStringInput | null | undefined;
|
|
57637
|
+
order?: number | undefined;
|
|
57596
57638
|
tags?: readonly string[] | null | undefined;
|
|
57597
57639
|
links?: readonly (string | {
|
|
57598
57640
|
url: string;
|
package/dist/likec4/index.mjs
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import{n as e,t}from"../chunks/rolldown-runtime.mjs";import{
|
|
2
|
-
`)}function executeOnCtx(e,t,...n){l(t)?(g(n.length===0,`When first argument is an array, no additional operations are allowed`),n=t):n=[t,...n];for(let t of n)e=t(e);return e}function executeOnFresh(e,t,...n){return l(t)?executeOnCtx(fresh(e),t):executeOnCtx(fresh(e),[t,...n])}function eachOnFresh(e,t){return t.map(t=>t(fresh(e)))}function operation(e,t){let r=typeof e==`function`?e:t,wrapped=e=>{let t=r(e);return t instanceof n?{...e,out:t}:e};return typeof e==`string`&&r.name==``&&Object.defineProperties(wrapped,{name:{value:`wrapped(${e})`}}),wrapped}function isPrintable(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`}function print(e){return operation(function printOp({ctx:t,out:n}){let r=typeof e==`function`?e(t):e??t;f(r)||r===``||(g(isPrintable(r),`Value must be a string, number or boolean - got `+typeof r),n.append(String(r)))})}const eq=()=>print(`=`),space=()=>print(` `);function noop(){return te()}function lazy(e){return t=>(e()(t),t)}function newline(e){return operation(({out:t})=>{e===`ifNotEmpty`?t.appendNewLineIfNotEmpty():t.appendNewLine()})}function merge(...e){return operation(function merge({ctx:t,out:n}){let r=executeOnFresh(t,e);n.appendIf(hasContent(r.out),r.out)})}function indent(...e){if(e.length===1&&typeof e[0]==`string`){let t=xe(e[0]);return t.trimStart().length===0?noop():operation(function indent1({out:e}){e.appendNewLineIfNotEmpty().indent({indentEmptyLines:!0,indentedChildren:[a(t.split(/\r?\n/),{separator:r})]}).appendNewLineIfNotEmpty()})}let t=e;return operation(function indent2({ctx:e,out:n}){let r=executeOnFresh(e,t);hasContent(r.out)&&n.appendNewLineIfNotEmpty().indent({indentEmptyLines:!0,indentedChildren:r.out.contents}).appendNewLineIfNotEmpty()})}function body(...e){let t=de(e);if(p(t))return body(t+` {`,`}`);if(e.length===2&&p(e[0])&&p(e[1])){let[t,n]=e;return(...e)=>operation(function body({ctx:r,out:i}){let o=indent(lines(...e))(fresh(r)).out;i.appendIf(hasContent(o),a([t,o,n]))})}let n=e;return body(`{`,`}`)(...n)}function inlineText(e){return operation(({ctx:t,out:n})=>{let r=e??t;if(f(r))return;g(p(r),`Value must be a string - got `+typeof r);let i=r.replace(/(\r?\n|\t)+/g,` `).replaceAll(`'`,`\\'`).trim();n.append(`'${i}'`)})}function multilineText(e,t=`'`){return merge(print(t),indent(e.replaceAll(`'`,`\\'`)),print(t))}function text(e){return operation(function text({ctx:t,out:n}){let r=typeof e==`function`?e(t):e??t;if(!f(r))return g(p(r),`Value must be a string - got `+typeof r),r.includes(`
|
|
3
|
-
`)?multilineText(r)({ctx:r,out:n}):inlineText()({ctx:r,out:n})})}const Me=`'`.repeat(3);function markdown(e){return operation(function markdown(t){let n=e??t.ctx;if(!f(n))return g(p(n),`Value must be a string - got `+typeof n),multilineText(n,Me)(t)})}function markdownOrString(e){return operation(function markdownOrString(t){let n=e??t.ctx;if(!f(n)){if(typeof n==`string`)return text(n)(t);if(`md`in n)return markdown(n.md)(t);if(`txt`in n)return multilineText(n.txt)(t);throw Error(`Invalid MarkdownOrString value: `+n)}})}function join(e){return operation(function joinOp({ctx:t,out:n}){let{operations:r,...i}=e,o=Array.isArray(r)?r:[r];g(c(o,1),`At least one operation is required`);let s;return s=o.length===1?o[0](fresh(t)).out.contents:fe(eachOnFresh(t,o),ce(e=>e.out)),s=ee(s,hasContentOrNewLine),n.appendIf(s.length>0,a(s,i))})}function spaceBetween(...e){return join({operations:e,suffix:(e,t,n)=>!n&&hasContent(e)?` `:void 0})}function lines(...e){let t=de(e);if(oe(t)){let e=fresh(void 0);for(let n=0;n<t;n++)e.out.appendNewLine();return(...t)=>join({operations:t,suffix:(t,n,r)=>r?void 0:e.out})}return join({operations:e,appendNewLineIfNotEmpty:!0,skipNewLineAfterLastItem:!0})}function withctx(...e){let t=e[0];if(e.length===1)return(...e)=>operation(function withctx1({out:n}){executeOnCtx({ctx:t,out:n},e)});let n=e.slice(1);return operation(function withctx2({out:e}){executeOnCtx({ctx:t,out:e},n)})}function property(e,t){return operation(function propertyOp({ctx:n,out:r}){let i=se(n)&&ge(n,e)?n[e]:void 0;if(i!=null){if(!t){g(isPrintable(i),`Property ${e} is not printable "${i}"`),r.append(e,` `,String(i));return}t({ctx:i,out:r})}})}function printProperty(e){return property(e,print())}function foreach(...e){let[t,n]=e;if(e.length===2&&!ie(n)){let e=t,r=n;return operation(function foreachSingleOp({ctx:t,out:n}){let i=[];for(let n of t){let t=e(fresh(n)).out;hasContent(t)&&i.push(t)}n.appendIf(i.length>0,a(i,r))})}let r=e;return operation(({ctx:e,out:t})=>{for(let n of e)executeOnCtx({ctx:n,out:t},r)})}function separateWith(e){return{separator:e}}function separateNewLine(e=1){if(e>1){let t=fresh(void 0);for(let n=0;n<e;n++)t.out.appendNewLine();return separateWith(t.out)}return separateWith(r)}function separateComma(e){return e?{separator:`,`,appendNewLineIfNotEmpty:!0,skipNewLineAfterLastItem:!0}:{separator:`, `}}function foreachNewLine(...e){return operation(function foreachNewLineOp({ctx:t,out:n}){let r=[];for(let n of t){let t=executeOnFresh(n,e).out;hasContent(t)&&r.push(t)}n.appendIf(r.length>0,a(r,separateNewLine()))})}function guard(e,...t){return operation(`guard`,({ctx:n,out:r})=>{if(`safeParse`in e){let i=e.safeParse(n);if(i.success)executeOnCtx({ctx:i.data,out:r},t);else throw Error(`Guard failed: ${y.prettifyError(i.error)}`);return}if(g(typeof e==`function`),e(n)){executeOnCtx({ctx:n,out:r},t);return}})}function when(e,...t){return operation(function whenOp({ctx:n,out:r}){e(n)&&executeOnCtx({ctx:n,out:r},t)})}function select(e,...t){return operation(function selectOp({ctx:n,out:r}){let i=e(n);d(i)&&executeOnCtx({ctx:i,out:r},t)})}function execToOut(e){return(t,...n)=>executeOnCtx({ctx:t,out:e},n)}function zodOp(e){return t=>()=>({ctx:r,out:i})=>{let a=y.safeParse(e,r);if(a.success){let e=t({ctx:a.data,out:i,exec:execToOut(i)});return e instanceof n?{ctx:r,out:e}:typeof e==`function`?{ctx:r,out:i,...e({ctx:r,out:i})}:{ctx:r,out:i}}throw a.error}}var Ne=t({arrow:()=>E,border:()=>Ie,color:()=>j,customColor:()=>Be,fqn:()=>x,icon:()=>w,iconPosition:()=>Le,id:()=>Pe,kind:()=>S,line:()=>D,link:()=>Re,links:()=>O,markdownOrString:()=>A,metadata:()=>Ue,metadataValue:()=>He,opacity:()=>Fe,props:()=>N,shape:()=>C,size:()=>T,style:()=>M,tag:()=>k,tags:()=>Ve,themeColor:()=>ze,viewId:()=>b});const Pe=y.string().regex(/^[a-zA-Z0-9_.-]+$/,`id must consist of alphanumeric characters, underscores or hyphens`),b=Pe.transform(e=>e),x=y.string().regex(/^[a-zA-Z0-9_.-]+$/,`FQN must consist of alphanumeric characters, dots, underscores or hyphens`).transform(e=>e),S=y.string().regex(/^[a-zA-Z0-9_-]+$/,`Kind must consist of alphanumeric characters, underscores or hyphens`).transform(e=>e),Fe=y.int().min(0,`Opacity must be between 0 and 100`).max(100,`Opacity must be between 0 and 100`),C=y.literal(Ce),w=y.string().nonempty(`Icon cannot be empty`).transform(e=>e),Ie=y.literal(Se),T=y.literal(De),Le=y.literal(we),E=y.literal(Te),D=y.literal(Ee),Re=y.union([y.string(),y.object({title:y.string().optional(),url:y.string()})]).transform(e=>_e(typeof e==`string`?{url:e}:e)),O=y.array(Re).readonly(),ze=y.literal(Oe),Be=y.string().nonempty(`Custom color name cannot be empty`).transform(e=>e),k=y.string().nonempty(`Tag cannot be empty`).transform(e=>e.startsWith(`#`)?e.slice(1):e),Ve=y.array(k).readonly(),A=y.union([y.string().transform(e=>({txt:e})),y.strictObject({md:y.string()}),y.strictObject({txt:y.string()})]),j=ze.or(Be),M=y.object({shape:C,icon:w,iconColor:j,iconSize:T,iconPosition:Le,color:j,border:Ie,opacity:Fe,size:T,padding:T,textSize:T,multiple:y.boolean()}).partial().transform(m(d)),He=y.union([y.string(),y.boolean(),y.number()]),Ue=y.record(y.string(),He.or(y.array(He))),N=y.object({tags:Ve.nullish(),title:y.string().nullish(),summary:A.nullish(),description:A.nullish(),notation:y.string().nullish(),technology:y.string().nullish(),links:O.nullish(),metadata:Ue.nullish()});var We=t({directRelationExpr:()=>ft,elementKindExpr:()=>rt,elementTagExpr:()=>it,expression:()=>V,fqnExpr:()=>L,fqnExprAny:()=>dt,fqnExprCustom:()=>ut,fqnExprOrWhere:()=>ot,fqnRef:()=>qe,incomingRelationExpr:()=>pt,inoutRelationExpr:()=>ht,outgoingRelationExpr:()=>mt,refDeployment:()=>Ke,refExpr:()=>nt,refModel:()=>Ge,relationExpr:()=>R,relationExprAny:()=>gt,relationExprCustom:()=>B,relationExprOrWhere:()=>z,selector:()=>Je,whereAnd:()=>Qe,whereExpr:()=>_t,whereKind:()=>P,whereMetadata:()=>F,whereNot:()=>$e,whereOperator:()=>I,whereOr:()=>et,whereParticipant:()=>Ze,whereTag:()=>Ye,wildcardExpr:()=>tt});const Ge=y.strictObject({model:x,project:y.string().optional()}),Ke=y.strictObject({deployment:x,element:x.nullish()}),qe=y.union([Ge,Ke]),Je=y.literal([`children`,`expanded`,`descendants`]);function equalOp(e){return y.union([e.transform(e=>({eq:e})),y.object({eq:e}),y.object({neq:e})])}const Ye=y.object({tag:equalOp(k)}),P=y.object({kind:equalOp(S)}),F=y.object({metadata:y.object({key:y.string(),value:equalOp(y.string()).optional()})}),Xe=y.union([Ye,P,F]),Ze=y.object({participant:y.literal([`source`,`target`]),operator:Xe}),Qe=y.object({get and(){return y.array(I)}}),$e=y.object({get not(){return I}}),et=y.object({get or(){return y.array(I)}}),I=y.union([Ye,P,F,Ze,Qe,et,$e]),tt=y.object({wildcard:y.literal(!0)}),nt=y.object({ref:qe,selector:Je.optional()}),rt=y.object({elementKind:S,isEqual:y.boolean()}),it=y.object({elementTag:k,isEqual:y.boolean()}),L=y.union([tt,nt,rt,it]),at=y.strictObject({where:y.strictObject({expr:L,condition:I})}),ot=y.union([L,at]),st=y.object({title:y.string(),description:A,technology:y.string(),notation:y.string(),notes:A,navigateTo:b,color:j}),ct=y.object({...st.shape,shape:C,icon:w,iconColor:j,iconSize:T,iconPosition:Le,border:Ie,opacity:Fe,multiple:y.boolean(),size:T,padding:T,textSize:T}).partial(),lt=y.object({...st.shape,line:D,head:E,tail:E}).partial(),ut=y.strictObject({custom:ct.extend({expr:ot})}),dt=y.union([ot,ut]),ft=y.object({source:L,target:L,isBidirectional:y.boolean().optional()}),pt=y.object({incoming:L}),mt=y.object({outgoing:L}),ht=y.object({inout:L}),R=y.union([ft,pt,mt,ht]),z=y.union([R,y.strictObject({where:y.strictObject({expr:R,condition:I})})]),B=y.strictObject({customRelation:lt.extend({expr:z})}),gt=y.union([z,B]),_t=y.object({where:y.object({expr:y.union([L,R]),condition:I})}),V=y.union([L,ut,R,B,_t]);var vt=t({element:()=>wt,instance:()=>bt,node:()=>yt,relationship:()=>Ct,schema:()=>Ot});const yt=N.extend({id:x,kind:S,style:M.optional(),shape:C.optional(),color:j.optional(),icon:w.optional()}).readonly().transform(e=>{let{shape:t,color:n,icon:r,...i}=e;return m(ke(i,e=>{e.style=i.style||{},t&&(e.style.shape=t),n&&(e.style.color=n),r&&(e.style.icon=r)}),d)}),bt=N.extend({id:x,element:x,style:M.optional(),shape:C.optional(),color:j.optional(),icon:w.optional()}).readonly().transform(e=>{let{shape:t,color:n,icon:r,...i}=e;return m(ke(i,e=>{e.style=i.style||{},t&&(e.style.shape=t),n&&(e.style.color=n),r&&(e.style.icon=r)}),d)}),xt=Ke,St=Pe.transform(e=>e),Ct=N.extend({id:St.optional(),title:y.string().nullish(),source:xt,target:xt,navigateTo:b.nullish(),color:j.nullish(),kind:S.nullish(),line:D.nullish(),head:E.nullish(),tail:E.nullish()}).readonly().transform(m(d)),wt=y.union([yt,bt]),Tt=y.record(x,wt),Et=y.record(St,Ct),Dt=e(e=>e.id??he(8),`genRelationshipId`),Ot=y.object({elements:y.union([Tt,y.array(wt)]).transform(e=>l(e)?ne(e,me(`id`)):e).optional(),relations:y.union([Et,y.array(Ct)]).transform(e=>l(e)?ne(e,Dt):e).optional()});var kt=t({element:()=>At,relationship:()=>Nt,schema:()=>It});const At=y.object({...N.shape,id:x,kind:S,style:M.optional(),shape:C.optional(),color:j.optional(),icon:w.optional()}).transform(e=>{let{shape:t,color:n,icon:r,...i}=e;return(t||n||r)&&(i=ke(i,e=>{e.style=i.style||{},t&&(e.style.shape=t),n&&(e.style.color=n),r&&(e.style.icon=r)})),m(i,d)}).readonly(),jt=y.union([x,y.strictObject({model:x})]).transform(e=>typeof e==`string`?{model:e}:e),Mt=Pe.transform(e=>e),Nt=y.object({...N.shape,id:Mt.optional(),title:y.string().nullish(),source:jt,target:jt,navigateTo:b.nullish(),color:j.nullish(),kind:S.nullish(),line:D.nullish(),head:E.nullish(),tail:E.nullish()}).transform(m(d)).readonly(),Pt=y.record(x,At),Ft=y.record(Mt,Nt),genRelationshipId=e=>e.id??he(8),It=y.object({elements:y.union([Pt,y.array(At)]).transform(e=>l(e)?ne(e,me(`id`)):e).optional(),relations:y.union([Ft,y.array(Nt)]).transform(e=>l(e)?ne(e,genRelationshipId):e).optional()});var Lt=t({element:()=>H,relationship:()=>Rt,schema:()=>Bt,tagSpec:()=>zt});const H=y.object({tags:Ve.nullable(),title:y.string().nullable(),summary:A.nullable(),description:A.nullable(),technology:y.string().nullable(),notation:y.string().nullable(),links:O.nullable(),style:M.nullable()}).partial().transform(m(d)),Rt=y.object({technology:y.string().nullable(),notation:y.string().nullable(),color:j.nullable(),line:D.nullable(),head:E.nullable(),tail:E.nullable()}).partial().transform(m(d)),zt=y.object({color:y.string().regex(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/).optional().catch(void 0)}).partial().transform(m(d)),Bt=y.object({elements:y.record(S,H),deployments:y.record(S,H),relationships:y.record(S,Rt),tags:y.union([y.record(k,zt),y.array(k).transform(e=>le(e,e=>[e,{}]))])}).partial();var Vt=t({anyView:()=>pn,autoLayoutDirection:()=>Ht,deploymentView:()=>en,deploymentViewRule:()=>$t,deploymentViewRuleIncludeAncestors:()=>Ut,dynamicStep:()=>tn,dynamicStepAlt:()=>sn,dynamicStepAltBranch:()=>on,dynamicStepBlock:()=>rn,dynamicStepSeries:()=>nn,dynamicStepTry:()=>an,dynamicView:()=>fn,dynamicViewIncludeRule:()=>ln,dynamicViewRule:()=>un,dynamicViewStep:()=>cn,dynamicViewVariant:()=>dn,elementView:()=>Qt,elementViewRule:()=>Xt,viewRuleAutoLayout:()=>U,viewRuleExclude:()=>Gt,viewRuleGlobalPredicate:()=>K,viewRuleGlobalStyle:()=>Kt,viewRuleGroup:()=>Yt,viewRuleInclude:()=>Wt,viewRulePredicate:()=>W,viewRuleRank:()=>Jt,viewRuleStyle:()=>G,views:()=>mn});const Ht=y.literal([`TB`,`BT`,`LR`,`RL`]),U=y.object({direction:Ht,nodeSep:y.number().optional(),rankSep:y.number().optional()}),Ut=y.strictObject({includeAncestors:y.boolean()}),Wt=y.strictObject({include:y.array(V)}),Gt=y.strictObject({exclude:y.array(V)}),W=y.union([Wt,Gt]).transform(e=>e),G=y.object({targets:y.array(L),notation:y.string().optional(),style:M}).transform(e=>e),Kt=y.object({styleId:y.string()}).transform(e=>e),K=y.object({predicateId:y.string()}).transform(e=>e),qt=y.literal([`max`,`min`,`same`,`sink`,`source`]),Jt=y.object({targets:y.array(L),rank:qt}).transform(e=>e),Yt=y.lazy(()=>y.object({groupRules:y.array(y.union([W,Yt])),title:y.string().nullable(),color:j.optional(),border:Ie.optional(),opacity:Fe.optional(),multiple:y.boolean().optional(),size:T.optional(),padding:T.optional(),textSize:T.optional()})),Xt=y.union([W,U,G,Kt,K,Jt,Yt]),Zt=y.object({id:b,title:y.string().nullish(),description:A.nullish(),tags:Ve.nullish(),links:O.nullish()}),Qt=Zt.extend({_type:y.literal(`element`),viewOf:x.nullish(),extends:b.nullish(),rules:y.array(Xt).optional().default([])}),$t=y.union([W,U,G,Kt,K,Ut]),en=Zt.extend({_type:y.literal(`deployment`),rules:y.array($t).optional().default([])}),tn=y.object({_type:y.never().exactOptional(),source:x,target:x,title:y.string().nullish().default(null),kind:y.string().nullish(),description:A.nullish(),technology:y.string().nullish(),notation:y.string().nullish(),notes:A.nullish(),color:j.optional(),line:D.optional(),head:E.optional(),tail:E.optional(),isBackward:y.boolean().optional(),navigateTo:b.nullish()}),q=y.object({title:y.string().optional(),source:y.never().exactOptional(),target:y.never().exactOptional(),get steps(){return y.array(cn).nonempty(`must have at least one step`)}}),nn=y.object({_type:y.literal(`series`),steps:y.array(tn).nonempty(`must have at least one step`)}).readonly(),rn=q.extend({_type:y.literal([`par`,`loop`,`opt`,`break`])}).readonly(),an=y.object({_type:y.literal(`try`),try:q,catch:q.optional(),finally:q.optional()}).readonly(),on=q.extend({_type:y.literal([`when`,`if`,`else`])}).readonly(),sn=y.object({_type:y.literal(`alt`),title:y.string().optional(),branches:y.array(on).nonempty(`alt block must have at least one branch`)}).readonly(),cn=y.union([tn,sn,nn,rn,an]),ln=y.strictObject({include:y.array(V)}),un=y.union([ln,K,G,Kt,U]),dn=y.literal([`diagram`,`sequence`]),fn=Zt.extend({_type:y.literal(`dynamic`),variant:dn.optional(),steps:y.array(cn).optional(),rules:y.array(un).optional()}),pn=y.union([Qt,en,fn]),mn=y.record(b,pn),hn=y.object({...It.shape,views:mn,project:y.object({id:y.string(),styles:Ae.nullish()}),deployment:Ot,deployments:Ot,specification:Bt}).partial().readonly().transform(normalizeStyles);function normalizeStyles(e){let t=e.specification?.elements;return!u(t)&&!u(e.elements)&&(e={...e,elements:ue(e.elements,e=>normalizeElementStyles(e,t))}),e}function normalizeElementStyles(e,t){let n=t[e.kind];if(!n)return e;let r=n.style??{};return ke(e,t=>{for(let r of[`description`,`technology`,`tags`,`summary`]){let i=n[r],a=e[r];re(i,a)&&delete t[r]}if(e.style)for(let[n,i]of s(r))re(e.style?.[n],i)&&delete t.style[n]})}const J={common:Ne,expr:We,specification:Lt,model:kt,deployment:vt,views:Vt,likec4data:hn};var gn=t({colorProperty:()=>colorProperty,descriptionProperty:()=>descriptionProperty,iconProperty:()=>iconProperty,linkProperty:()=>linkProperty,linksProperty:()=>linksProperty,markdownProperty:()=>markdownProperty,metadataProperty:()=>metadataProperty,metadataValue:()=>metadataValue,notationProperty:()=>notationProperty,notesProperty:()=>notesProperty,opacityProperty:()=>opacityProperty,styleBlockProperty:()=>styleBlockProperty,styleProperties:()=>Y,summaryProperty:()=>summaryProperty,tagsProperty:()=>tagsProperty,technologyProperty:()=>technologyProperty,textProperty:()=>textProperty,titleProperty:()=>titleProperty});function textProperty(e,t){return select(t=>t[e],spaceBetween(print(t??e),text()))}function markdownProperty(e,t){return select(t=>t[e],spaceBetween(print(t??e),markdownOrString()))}const titleProperty=()=>property(`title`,spaceBetween(print(`title`),text())),summaryProperty=()=>property(`summary`,spaceBetween(print(`summary`),markdownOrString())),descriptionProperty=()=>property(`description`,spaceBetween(print(`description`),markdownOrString())),notesProperty=()=>property(`notes`,spaceBetween(print(`notes`),markdownOrString())),technologyProperty=()=>property(`technology`,spaceBetween(print(`technology`),text())),notationProperty=()=>property(`notation`,spaceBetween(print(`notation`),text()));function printMetadataValue(){return operation(({ctx:e,out:t})=>p(e)?text()({ctx:e,out:t}):print()({ctx:e,out:t}))}function metadataValue(){return pe(guard(ae(l),printMetadataValue()),guard(l,body(`[`,`]`)(foreach(printMetadataValue(),{appendNewLineIfNotEmpty:!0,suffix(e,t,n){return n?void 0:`,`}}))))}const metadataProperty=()=>select(e=>e.metadata?s(e.metadata):void 0,body(`metadata`)(foreach(spaceBetween(print(e=>e[0]),property(`1`,metadataValue())),separateNewLine()))),tagsProperty=()=>property(`tags`,print(e=>e.map(e=>`#${e}`).join(`, `)));function linkProperty(){return spaceBetween(select(e=>typeof e==`string`?{url:e}:_e({url:e.url,title:e.title}),print(`link`),print(e=>e.url),property(`title`,inlineText())))}const linksProperty=()=>property(`links`,foreachNewLine(linkProperty()));function styleBlockProperty(){return select(e=>e.style,body(`style`)(Y()))}function colorProperty(){return property(`color`,spaceBetween(print(`color`),print()))}function opacityProperty(){return property(`opacity`,spaceBetween(print(`opacity`),print(e=>`${e}%`)))}function iconProperty(){return property(`icon`,spaceBetween(print(`icon`),print()))}const Y=zodOp(M)(lines(property(`shape`),colorProperty(),iconProperty(),property(`iconColor`),property(`iconSize`),property(`iconPosition`),property(`border`),opacityProperty(),property(`size`),property(`padding`),property(`textSize`),property(`multiple`)));var _n=t({directRelationExpr:()=>On,expression:()=>$,fqnExpr:()=>Q,fqnExprAny:()=>Dn,fqnExprCustom:()=>Tn,fqnExprOrWhere:()=>En,fqnRef:()=>Z,inOutRelationExpr:()=>jn,incomingRelationExpr:()=>kn,outgoingRelationExpr:()=>An,relationExpr:()=>Mn,relationExprAny:()=>Fn,relationExprCustom:()=>Pn,relationExprOrWhere:()=>Nn,whereAnd:()=>Cn,whereKindEqual:()=>yn,whereMetadataEqual:()=>bn,whereNot:()=>xn,whereOperator:()=>X,whereOr:()=>wn,whereParticipant:()=>Sn,whereTagEqual:()=>vn});function appendSelector(e,t){if(t)switch(t){case`children`:e.append(`.*`);break;case`descendants`:e.append(`.**`);break;case`expanded`:e.append(`._`);break;default:_(t)}return e}const vn=zodOp(Ye)(function whereTagEqualOp({ctx:{tag:e},out:t}){if(`eq`in e)return t.appendTemplate`tag is #${e.eq}`;if(`neq`in e)return t.appendTemplate`tag is not #${e.neq}`;_(e)}),yn=zodOp(P)(function whereKindEqualOp({ctx:{kind:e},out:t}){if(`eq`in e)return t.appendTemplate`kind is ${e.eq}`;if(`neq`in e)return t.appendTemplate`kind is not ${e.neq}`;_(e)});function quoteMetadataValue(e){return e===`true`||e===`false`?e:`"${e}"`}const bn=zodOp(F)(function whereMetadataEqualOp({ctx:{metadata:e},out:t}){let{key:n,value:r}=e;if(r===void 0)return t.appendTemplate`metadata.${n}`;if(`eq`in r)return t.append(`metadata.${n} is ${quoteMetadataValue(r.eq)}`);if(`neq`in r)return t.append(`metadata.${n} is not ${quoteMetadataValue(r.neq)}`);_(r)}),xn=zodOp($e)(property(`not`,spaceBetween(print(`not (`),lazy(()=>X()),print(`)`)))),Sn=zodOp(Ze)(function whereParticipantOp({ctx:{participant:e,operator:t},out:n}){if(n.append(e,`.`),`tag`in t){vn()({ctx:t,out:n});return}if(`kind`in t){yn()({ctx:t,out:n});return}if(`metadata`in t){bn()({ctx:t,out:n});return}_(t)}),Cn=zodOp(Qe)(function whereAndOp({ctx:{and:e},out:t}){let n=ce(e,e=>{let{out:t}=executeOnFresh(e,X());return`or`in e&&(t=fresh().out.append(`(`,...t.contents,`)`)),t});return t.append(a(n,{appendNewLineIfNotEmpty:!0,skipNewLineAfterLastItem:!0,prefix(e,t){return t>0?`and `:void 0}}))}),wn=zodOp(et)(({ctx:{or:e},out:t})=>{let n=ce(e,e=>{let{out:t}=executeOnFresh(e,X());return`and`in e&&(t=fresh().out.append(`(`,...t.contents,`)`)),t});return t.append(a(n,{appendNewLineIfNotEmpty:!0,skipNewLineAfterLastItem:!0,prefix(e,t){return t>0?`or `:void 0}}))}),X=zodOp(I)(({ctx:e,exec:t})=>{if(`and`in e)return t(e,Cn());if(`or`in e)return t(e,wn());if(`not`in e)return t(e,xn());if(`tag`in e)return t(e,vn());if(`kind`in e)return t(e,yn());if(`metadata`in e)return t(e,bn());if(`participant`in e)return t(e,Sn());_(e)}),Z=zodOp(qe)(({ctx:e,out:t})=>(`model`in e?t.append(e.model):(t.append(e.deployment),e.element&&t.append(`.`,e.element)),t)),Q=zodOp(L)(({ctx:e,out:t,exec:n})=>{if(`wildcard`in e)return t.append(`*`);if(`elementKind`in e)return t.append(`element.kind`).append(e.isEqual?` = `:` != `).append(e.elementKind);if(`elementTag`in e)return t.append(`element.tag`).append(e.isEqual?` = `:` != `).append(`#${e.elementTag}`);if(`ref`in e)return n(e.ref,Z()),appendSelector(t,e.selector),t;_(e)}),Tn=zodOp(ut)(({ctx:{custom:e},exec:t})=>{t(e.expr,En());let n=withctx(e)(body(`with`)(titleProperty(),descriptionProperty(),notationProperty(),notesProperty(),property(`navigateTo`),Y()));return`where`in e.expr?t({},indent(n)):t({},space(),n)}),En=zodOp(ot)(({ctx:e,exec:t})=>{if(`where`in e){t(e.where.expr,Q()),t(e.where.condition,indent(print(`where`),indent(X())));return}t(e,Q())}),Dn=zodOp(dt)(({ctx:e,out:t})=>`custom`in e?Tn()({ctx:e,out:t}):En()({ctx:e,out:t})),On=zodOp(ft)(merge(property(`source`,Q()),print(e=>e.isBidirectional?` <-> `:` -> `),property(`target`,Q()))),kn=zodOp(pt)(merge(print(`-> `),property(`incoming`,Q()))),An=zodOp(mt)(merge(property(`outgoing`,Q()),print(` ->`))),jn=zodOp(ht)(merge(print(`-> `),property(`inout`,Q()),print(` ->`))),Mn=zodOp(R)(({ctx:e,exec:t})=>{if(`source`in e)return t(e,On());if(`incoming`in e)return t(e,kn());if(`outgoing`in e)return t(e,An());if(`inout`in e)return t(e,jn());_(e)}),Nn=zodOp(z)(({ctx:e,out:t})=>`where`in e?merge(withctx(e.where.expr)(Mn()),indent(print(`where`),indent(withctx(e.where.condition)(X()))))({ctx:e,out:t}):Mn()({ctx:e,out:t})),Pn=zodOp(B)(({ctx:{customRelation:e},exec:t})=>{t(e.expr,Nn());let n=withctx(e)(body(`with`)(titleProperty(),descriptionProperty(),notationProperty(),markdownProperty(`notes`),property(`navigateTo`),Y(),property(`head`),property(`tail`),property(`line`)));`where`in e.expr?t({},indent(n)):t({},space(),n)}),Fn=zodOp(gt)(({ctx:e,exec:t})=>`customRelation`in e?t(e,Pn()):t(e,Nn())),$=zodOp(V)(({ctx:e,exec:t})=>{if(`custom`in e)return t(e,Tn());if(`customRelation`in e)return t(e,Pn());if(`wildcard`in e||`ref`in e||`elementKind`in e||`elementTag`in e)return t(e,Q());if(`source`in e||`incoming`in e||`outgoing`in e||`inout`in e)return t(e,Mn());if(`where`in e){let{expr:n,condition:r}=e.where;return`source`in n||`incoming`in n||`outgoing`in n||`inout`in n?t({where:{expr:n,condition:r}},Nn()):t({where:{expr:n,condition:r}},En())}_(e)});var In=t({deployment:()=>Bn,instance:()=>Rn,node:()=>node,relationship:()=>zn});function buildTree$1(e){let t=new Map,n=[],r=fe(e,be);for(let e of r){let r;r=`element`in e?e:{...e,children:[]},t.set(e.id,r);let i=ye(e.id),a=i?t.get(i):void 0;a&&`children`in a?a.children.push(r):n.push(r)}return{roots:n,nodes:t,exists:e=>t.has(e)}}e(buildTree$1,`buildTree`);function hasStyleProps$1(e){return!u(e.style)}e(hasStyleProps$1,`hasStyleProps`);function hasElementProps$1(e){return!!(e.description||e.summary||e.technology||e.notation||e.tags&&e.tags.length>0||e.links&&e.links.length>0||!u(e.metadata)||hasStyleProps$1(e))}e(hasElementProps$1,`hasElementProps`);const Ln=zodOp(J.deployment.element)(lines(tagsProperty(),technologyProperty(),summaryProperty(),descriptionProperty(),linksProperty(),metadataProperty(),select(e=>hasStyleProps$1(e)?e.style:void 0,body(`style`)(Y())))),Rn=zodOp(J.deployment.instance)(spaceBetween(when(e=>v(e.id)!==v(e.element),print(e=>v(e.id)),print(` =`)),print(`instanceOf`),printProperty(`element`),when(e=>!!e.title&&e.title!==v(e.id),property(`title`,inlineText())),when(e=>hasElementProps$1(e),body(Ln()))));function node(){return function nodeOp({ctx:e,out:t}){let n=e;if(`element`in n)return Rn()({ctx:n,out:t}),{ctx:e,out:t};ve(`children`in n,`Node must have children property`);let r=n.children.length>0||hasElementProps$1(n),i=v(n.id),a=[print(i),print(`=`),print(n.kind)];return n.title&&n.title!==i&&a.push(inlineText(n.title)),r&&a.push(body(lines(2)(withctx(n,Ln()),...n.children.map(e=>withctx(e,nodeOp))))),spaceBetween(...a)({ctx:e,out:t})}}function hasRelationStyle$1(e){return!!(e.color||e.line||e.head||e.tail)}e(hasRelationStyle$1,`hasRelationStyle`);function hasRelationProps$1(e){return!!(e.description||e.summary||e.technology||e.tags&&e.tags.length>0||e.links&&e.links.length>0||!u(e.metadata)||hasRelationStyle$1(e)||e.navigateTo)}e(hasRelationProps$1,`hasRelationProps`);const zn=zodOp(J.deployment.relationship)(spaceBetween(property(`source`,Z()),print(e=>e.kind?`-[${e.kind}]->`:`->`),property(`target`,Z()),property(`title`,inlineText()),when(hasRelationProps$1,body(tagsProperty(),technologyProperty(),summaryProperty(),descriptionProperty(),property(`navigateTo`),linksProperty(),metadataProperty(),when(hasRelationStyle$1,body(`style`)(colorProperty(),property(`line`),property(`head`),property(`tail`))))))),Bn=zodOp(J.deployment.schema)(body(`deployment`)(lines(2)(select(e=>buildTree$1(e.elements?h(e.elements):[]).roots,lines(2)(foreach(node()))),select(e=>e.relations?h(e.relations):void 0,lines(2)(foreach(zn()))))));var Vn=t({element:()=>Wn,model:()=>Gn,relationship:()=>Un});function buildTree(e){let t=new Map,n=[],r=fe(e,be);for(let e of r){let r={...e,children:[]};t.set(e.id,r);let i=ye(e.id),a=i?t.get(i):void 0;a?a.children.push(r):n.push(r)}return{roots:n,nodes:t,exists:e=>t.has(e)}}function hasStyleProps(e){return!u(e.style)}function hasElementProps(e){return!!(e.description||e.summary||e.technology||e.notation||e.tags&&e.tags.length>0||e.links&&e.links.length>0||!u(e.metadata)||hasStyleProps(e))}const Hn=zodOp(J.model.element)(lines(tagsProperty(),technologyProperty(),summaryProperty(),descriptionProperty(),linksProperty(),metadataProperty(),select(e=>hasStyleProps(e)?e.style:void 0,body(`style`)(Y()))));function elementTree(){return function elementTreeNodeOp({ctx:e,out:t}){let n=e,r=(e.children?.length??0)>0||hasElementProps(n),i=v(n.id),a=[print(i),print(`=`),print(n.kind)];return n.title&&n.title!==i&&a.push(inlineText(n.title)),r&&a.push(body(lines(2)(withctx(n,Hn()),...(e.children??[]).map(e=>withctx(e,elementTree()))))),spaceBetween(...a)({ctx:e,out:t})}}function hasRelationStyle(e){return!!(e.color||e.line||e.head||e.tail)}function hasRelationProps(e){return!!(e.description||e.summary||e.technology||e.tags&&e.tags.length>0||e.links&&e.links.length>0||!u(e.metadata)||hasRelationStyle(e)||e.navigateTo)}const Un=zodOp(J.model.relationship)(spaceBetween(property(`source`,Z()),print(e=>e.kind?`-[${e.kind}]->`:`->`),property(`target`,Z()),property(`title`,inlineText()),when(hasRelationProps,body(tagsProperty(),technologyProperty(),summaryProperty(),descriptionProperty(),property(`navigateTo`),linksProperty(),metadataProperty(),when(hasRelationStyle,body(`style`)(colorProperty(),property(`line`),property(`head`),property(`tail`))))))),Wn=zodOp(J.model.element)(elementTree()),Gn=zodOp(J.model.schema)(body(`model`)(lines(2)(select(e=>buildTree(e.elements?h(e.elements):[]).roots,lines(2)(foreach(elementTree()))),select(e=>e.relations?h(e.relations):void 0,lines(2)(foreach(Un()))))));var Kn=t({elementKind:()=>elementKind,relationshipKind:()=>Jn,specification:()=>Yn,tagSpecification:()=>qn});const qn=zodOp(y.tuple([y.string(),zt]))(spaceBetween(print(`tag`),printProperty(`0`),property(`1`,property(`color`,body(spaceBetween(print(`color`),print())))))),elementKind=e=>zodOp(y.tuple([y.string(),H]))(spaceBetween(print(e),printProperty(`0`),property(`1`,body(tagsProperty(),titleProperty(),summaryProperty(),descriptionProperty(),technologyProperty(),notationProperty(),linksProperty(),property(`style`,body(`style`)(Y())))))),Jn=zodOp(y.tuple([y.string(),Rt]))(spaceBetween(print(`relationship`),printProperty(`0`),property(`1`,body(technologyProperty(),notationProperty(),colorProperty(),property(`line`),property(`head`),property(`tail`))))),Yn=zodOp(Bt)(body(`specification`)(lines(2)(select(e=>e.elements&&s(e.elements),foreachNewLine(elementKind(`element`)())),select(e=>e.deployments&&s(e.deployments),foreachNewLine(elementKind(`deploymentNode`)())),select(e=>e.relationships&&s(e.relationships),foreachNewLine(Jn())),select(e=>e.tags&&s(e.tags),foreachNewLine(qn())))));var Xn=t({anyView:()=>Sr,deploymentView:()=>lr,deploymentViewRule:()=>cr,deploymentViewRuleIncludeAncestors:()=>ir,dynamicView:()=>xr,dynamicViewIncludeRule:()=>yr,dynamicViewRule:()=>br,elementView:()=>sr,elementViewRule:()=>or,step:()=>vr,viewRuleAutoLayout:()=>rr,viewRuleGlobalPredicate:()=>tr,viewRuleGlobalStyle:()=>er,viewRuleGroup:()=>$n,viewRulePredicate:()=>Zn,viewRuleRank:()=>ar,viewRuleStyle:()=>Qn,views:()=>Cr});const viewTitleProperty=()=>property(`title`,spaceBetween(print(`title`),inlineText())),Zn=zodOp(J.views.viewRulePredicate)(({ctx:e,exec:t})=>{let n,r;if(`include`in e?(n=e.include,r=`include`):`exclude`in e&&(n=e.exclude,r=`exclude`),g(n&&r,`Invalid view rule predicate`),!c(n,1))return;let i=c(n,2),a=withctx(n)(foreach($(),separateComma(i)));t(e,merge(print(r),...i?[indent(a)]:[space(),a]))}),Qn=zodOp(J.views.viewRuleStyle)(spaceBetween(print(`style`),property(`targets`,foreach($(),separateComma())),body(`{`,`}`)(notationProperty(),property(`style`,Y())))),$n=zodOp(J.views.viewRuleGroup)(({ctx:e,exec:t})=>{throw Error(`not implemented`)}),er=zodOp(J.views.viewRuleGlobalStyle)(({ctx:e,exec:t})=>{throw Error(`not implemented`)}),tr=zodOp(J.views.viewRuleGlobalPredicate)(({ctx:e,exec:t})=>{throw Error(`not implemented`)}),nr={TB:`TopBottom`,BT:`BottomTop`,LR:`LeftRight`,RL:`RightLeft`},rr=zodOp(J.views.viewRuleAutoLayout)(spaceBetween(print(`autoLayout`),property(`direction`,print(e=>nr[e])),guard(ge(`rankSep`),spaceBetween(printProperty(`rankSep`),printProperty(`nodeSep`))))),ir=zodOp(J.views.deploymentViewRuleIncludeAncestors)(spaceBetween(print(`includeAncestors`),printProperty(`includeAncestors`))),ar=zodOp(J.views.viewRuleRank)(({ctx:e,exec:t})=>{throw Error(`not implemented`)}),or=zodOp(J.views.elementViewRule)(({ctx:e,exec:t})=>{if(`include`in e||`exclude`in e)return t(e,Zn());if(`groupRules`in e)return t(e,$n());if(`rank`in e)return t(e,ar());if(`direction`in e)return t(e,rr());if(`styleId`in e)return t(e,er());if(`predicateId`in e)return t(e,tr());if(`targets`in e&&`style`in e)return t(e,Qn());_(e)}),sr=zodOp(J.views.elementView.partial({_type:!0}))(spaceBetween(print(`view`),print(e=>e.id),property(`viewOf`,spaceBetween(print(`of`),print())),body(lines(2)(lines(tagsProperty(),viewTitleProperty(),descriptionProperty(),linksProperty()),property(`rules`,foreachNewLine(or())))))),cr=zodOp(J.views.deploymentViewRule)(({ctx:e,exec:t})=>{if(`include`in e||`exclude`in e)return t(e,Zn());if(`includeAncestors`in e)return t(e,ir());if(`direction`in e)return t(e,rr());if(`styleId`in e)return t(e,er());if(`predicateId`in e)return t(e,tr());if(`targets`in e&&`style`in e)return t(e,Qn());_(e)}),lr=zodOp(J.views.deploymentView.partial({_type:!0}))(spaceBetween(print(`deployment view`),print(e=>e.id),body(lines(2)(lines(tagsProperty(),viewTitleProperty(),descriptionProperty(),linksProperty()),property(`rules`,foreachNewLine(cr())))))),ur=zodOp(J.views.dynamicStep.partial({source:!0}))(spaceBetween(print(e=>e.isBackward?`<-`:e.kind?`-[${e.kind}]->`:`->`),printProperty(`target`),property(`title`,text()),body(lines(technologyProperty(),descriptionProperty(),notesProperty(),property(`navigateTo`),notationProperty(),colorProperty(),property(`line`),property(`head`),property(`tail`))))),dr=zodOp(J.views.dynamicStep)(spaceBetween(printProperty(`source`),ur())),bodyWithSteps=()=>property(`steps`,body(foreachNewLine(lazy(()=>_r())))),fr=zodOp(J.views.dynamicStepBlock)(spaceBetween(printProperty(`_type`),property(`title`,text()),bodyWithSteps())),pr=zodOp(J.views.dynamicStepSeries)(merge(select(e=>e.steps[0],printProperty(`source`)),indent(property(`steps`,foreachNewLine(ur()))))),mr=zodOp(J.views.dynamicStepTry)(spaceBetween(select(e=>e.try,spaceBetween(print(`try`),property(`title`,text()),bodyWithSteps())),select(e=>e.catch,spaceBetween(print(`catch`),property(`title`,text()),bodyWithSteps())),select(e=>e.finally,spaceBetween(print(`finally`),property(`title`,text()),bodyWithSteps())))),hr=zodOp(J.views.dynamicStepAltBranch)(spaceBetween(printProperty(`_type`),property(`title`,text()),bodyWithSteps())),gr=zodOp(J.views.dynamicStepAlt)(spaceBetween(print(`alt`),property(`title`,text()),body(property(`branches`,foreachNewLine(hr()))))),_r=zodOp(J.views.dynamicViewStep)(({ctx:e,exec:t})=>{if(e.source&&e.target)return t(e,dr());switch(g(e._type,`Step must have a type`),e._type){case`loop`:case`opt`:case`break`:case`par`:return t(e,fr());case`alt`:return t(e,gr());case`series`:return t(e,pr());case`try`:return t(e,mr());default:_(e)}}),vr={single:dr,block:fr,alt:gr,series:pr,try:mr,any:_r},yr=zodOp(J.views.dynamicViewIncludeRule)(({ctx:e,exec:t})=>{if(!c(e.include,1))return;let n=c(e.include,2),r=withctx(e.include)(foreach($(),separateComma(n)));t(e,merge(print(`include`),...n?[indent(r)]:[space(),r]))}),br=zodOp(J.views.dynamicViewRule)(({ctx:e,exec:t})=>{if(`include`in e)return t(e,yr());if(`predicateId`in e)return t(e,tr());if(`targets`in e&&`style`in e)return t(e,Qn());if(`styleId`in e)return t(e,er());if(`direction`in e)return t(e,rr());_(e)}),xr=zodOp(J.views.dynamicView.partial({_type:!0}))(spaceBetween(print(`dynamic view`),print(e=>e.id),body(lines(2)(lines(tagsProperty(),viewTitleProperty(),descriptionProperty(),linksProperty(),property(`variant`)),property(`steps`,foreachNewLine(vr.any())),property(`rules`,foreachNewLine(br())))))),Sr=zodOp(J.views.anyView)(({ctx:e,exec:t})=>{if(`_type`in e){if(e._type==`element`)return t(e,sr());if(e._type===`deployment`)return t(e,lr());if(e._type===`dynamic`)return t(e,xr())}_(e)}),Cr=zodOp(J.views.views)(body(`views`)(select(e=>h(e),foreach(Sr(),{separator:new n().appendNewLine().appendNewLine(),prefix:(e,t,n)=>t===0&&!n?r:void 0})))),wr=zodOp(J.likec4data)(lines(2)(property(`specification`,Yn()),Gn(),property(`deployment`,Bn()),property(`deployments`,Bn()),property(`views`,Cr())));var Tr=t({base:()=>je,deployment:()=>Bn,deploymentView:()=>lr,deployments:()=>In,dynamicView:()=>xr,elementView:()=>sr,expr:()=>_n,expression:()=>$,likec4data:()=>wr,model:()=>Gn,models:()=>Vn,props:()=>gn,specification:()=>Yn,specifications:()=>Kn,views:()=>Xn});function generateLikeC4(e,t){return t={indentation:2,...t},materialize(withctx(e,wr()),t.indentation)}function printOperation(e,t,n){return materialize(withctx(t??{},e),n?.indentation)}function printWithTabIndent(e,t){return materialize(withctx(t??{},e),` `)}export{body,eachOnFresh,eq,executeOnCtx,executeOnFresh,foreach,foreachNewLine,fresh,generateLikeC4 as generate,guard,indent,inlineText,join,lazy,lines,markdown,markdownOrString,materialize,merge,newline,noop,operation,Tr as ops,print,printOperation,printProperty,printWithTabIndent,property,select,separateComma,separateNewLine,separateWith,space,spaceBetween,text,when,withctx,zodOp};
|
|
1
|
+
import{n as e,t}from"../chunks/rolldown-runtime.mjs";import{n,t as r}from"../chunks/newline.mjs";import{CompositeGeneratorNode as i,NewLineNode as a,joinToNode as o}from"langium/generate";import{entries as s,filter as ee,hasAtLeast as c,identity as te,indexBy as ne,isArray as l,isDeepEqual as re,isEmptyish as u,isFunction as ie,isNonNullish as d,isNot as ae,isNullish as f,isNumber as oe,isObjectType as se,isString as p,map as ce,mapToObj as le,mapValues as ue,only as de,pickBy as m,pipe as fe,piped as pe,prop as me,randomString as he,values as h}from"remeda";import{hasProp as ge,invariant as g,nonexhaustive as _}from"@likec4/core";import{exact as _e}from"@likec4/core/types";import{invariant as ve,nameFromFqn as v,parentFqn as ye,sortParentsFirst as be}from"@likec4/core/utils";import{dedent as xe}from"strip-indent";import*as y from"zod/v4";import{BorderStyles as Se,ElementShapes as Ce,IconPositions as we,RelationshipArrowTypes as Te,RelationshipLineTypes as Ee,Sizes as De,ThemeColors as Oe}from"@likec4/core/styles";import{produce as ke}from"immer";import{LikeC4StylesConfigSchema as Ae}from"@likec4/config";var je=t({body:()=>body,eachOnFresh:()=>eachOnFresh,eq:()=>eq,executeOnCtx:()=>executeOnCtx,executeOnFresh:()=>executeOnFresh,foreach:()=>foreach,foreachNewLine:()=>foreachNewLine,fresh:()=>fresh,guard:()=>guard,indent:()=>indent,inlineText:()=>inlineText,join:()=>join,lazy:()=>lazy,lines:()=>lines,markdown:()=>markdown,markdownOrString:()=>markdownOrString,materialize:()=>materialize,merge:()=>merge,newline:()=>newline,noop:()=>noop,operation:()=>operation,print:()=>print,printProperty:()=>printProperty,property:()=>property,select:()=>select,separateComma:()=>separateComma,separateNewLine:()=>separateNewLine,separateWith:()=>separateWith,space:()=>space,spaceBetween:()=>spaceBetween,text:()=>text,when:()=>when,withctx:()=>withctx,zodOp:()=>zodOp});function hasContent(e){return typeof e==`string`?e.trimStart().length!==0:e instanceof i&&e.contents.some(e=>hasContent(e))}function hasContentOrNewLine(e){return typeof e==`string`?e.trimStart().length!==0:e instanceof a?!e.ifNotEmpty:e instanceof i&&e.contents.some(e=>hasContentOrNewLine(e))}function fresh(e){return{ctx:e??void 0,out:new i}}function materialize(e,t=2){let r=ie(e)?executeOnFresh(void 0,[e]).out:e.out;return n(r,t)}function executeOnCtx(e,t,...n){l(t)?(g(n.length===0,`When first argument is an array, no additional operations are allowed`),n=t):n=[t,...n];for(let t of n)e=t(e);return e}function executeOnFresh(e,t,...n){return l(t)?executeOnCtx(fresh(e),t):executeOnCtx(fresh(e),[t,...n])}function eachOnFresh(e,t){return t.map(t=>t(fresh(e)))}function operation(e,t){let n=typeof e==`function`?e:t,wrapped=e=>{let t=n(e);return t instanceof i?{...e,out:t}:e};return typeof e==`string`&&n.name==``&&Object.defineProperties(wrapped,{name:{value:`wrapped(${e})`}}),wrapped}function isPrintable(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`}function print(e){return operation(function printOp({ctx:t,out:n}){let r=typeof e==`function`?e(t):e??t;f(r)||r===``||(g(isPrintable(r),`Value must be a string, number or boolean - got `+typeof r),n.append(String(r)))})}const eq=()=>print(`=`),space=()=>print(` `);function noop(){return te()}function lazy(e){return t=>(e()(t),t)}function newline(e){return operation(({out:t})=>{e===`ifNotEmpty`?t.appendNewLineIfNotEmpty():t.appendNewLine()})}function merge(...e){return operation(function merge({ctx:t,out:n}){let r=executeOnFresh(t,e);n.appendIf(hasContent(r.out),r.out)})}function indent(...e){if(e.length===1&&typeof e[0]==`string`){let t=xe(e[0]);return t.trimStart().length===0?noop():operation(function indent1({out:e}){e.appendNewLineIfNotEmpty().indent({indentEmptyLines:!0,indentedChildren:[o(t.split(/\r?\n/),{separator:r})]}).appendNewLineIfNotEmpty()})}let t=e;return operation(function indent2({ctx:e,out:n}){let r=executeOnFresh(e,t);hasContent(r.out)&&n.appendNewLineIfNotEmpty().indent({indentEmptyLines:!0,indentedChildren:r.out.contents}).appendNewLineIfNotEmpty()})}function body(...e){let t=de(e);if(p(t))return body(t+` {`,`}`);if(e.length===2&&p(e[0])&&p(e[1])){let[t,n]=e;return(...e)=>operation(function body({ctx:r,out:i}){let a=indent(lines(...e))(fresh(r)).out;i.appendIf(hasContent(a),o([t,a,n]))})}let n=e;return body(`{`,`}`)(...n)}function inlineText(e){return operation(({ctx:t,out:n})=>{let r=e??t;if(f(r))return;g(p(r),`Value must be a string - got `+typeof r);let i=r.replace(/(\r?\n|\t)+/g,` `).replaceAll(`'`,`\\'`).trim();n.append(`'${i}'`)})}function multilineText(e,t=`'`){return merge(print(t),indent(e.replaceAll(`'`,`\\'`)),print(t))}function text(e){return operation(function text({ctx:t,out:n}){let r=typeof e==`function`?e(t):e??t;if(!f(r))return g(p(r),`Value must be a string - got `+typeof r),r.includes(`
|
|
2
|
+
`)?multilineText(r)({ctx:r,out:n}):inlineText()({ctx:r,out:n})})}const Me=`'`.repeat(3);function markdown(e){return operation(function markdown(t){let n=e??t.ctx;if(!f(n))return g(p(n),`Value must be a string - got `+typeof n),multilineText(n,Me)(t)})}function markdownOrString(e){return operation(function markdownOrString(t){let n=e??t.ctx;if(!f(n)){if(typeof n==`string`)return text(n)(t);if(`md`in n)return markdown(n.md)(t);if(`txt`in n)return multilineText(n.txt)(t);throw Error(`Invalid MarkdownOrString value: `+n)}})}function join(e){return operation(function joinOp({ctx:t,out:n}){let{operations:r,...i}=e,a=Array.isArray(r)?r:[r];g(c(a,1),`At least one operation is required`);let s;return s=a.length===1?a[0](fresh(t)).out.contents:fe(eachOnFresh(t,a),ce(e=>e.out)),s=ee(s,hasContentOrNewLine),n.appendIf(s.length>0,o(s,i))})}function spaceBetween(...e){return join({operations:e,suffix:(e,t,n)=>!n&&hasContent(e)?` `:void 0})}function lines(...e){let t=de(e);if(oe(t)){let e=fresh(void 0);for(let n=0;n<t;n++)e.out.appendNewLine();return(...t)=>join({operations:t,suffix:(t,n,r)=>r?void 0:e.out})}return join({operations:e,appendNewLineIfNotEmpty:!0,skipNewLineAfterLastItem:!0})}function withctx(...e){let t=e[0];if(e.length===1)return(...e)=>operation(function withctx1({out:n}){executeOnCtx({ctx:t,out:n},e)});let n=e.slice(1);return operation(function withctx2({out:e}){executeOnCtx({ctx:t,out:e},n)})}function property(e,t){return operation(function propertyOp({ctx:n,out:r}){let i=se(n)&&ge(n,e)?n[e]:void 0;if(i!=null){if(!t){g(isPrintable(i),`Property ${e} is not printable "${i}"`),r.append(e,` `,String(i));return}t({ctx:i,out:r})}})}function printProperty(e){return property(e,print())}function foreach(...e){let[t,n]=e;if(e.length===2&&!ie(n)){let e=t,r=n;return operation(function foreachSingleOp({ctx:t,out:n}){let i=[];for(let n of t){let t=e(fresh(n)).out;hasContent(t)&&i.push(t)}n.appendIf(i.length>0,o(i,r))})}let r=e;return operation(({ctx:e,out:t})=>{for(let n of e)executeOnCtx({ctx:n,out:t},r)})}function separateWith(e){return{separator:e}}function separateNewLine(e=1){if(e>1){let t=fresh(void 0);for(let n=0;n<e;n++)t.out.appendNewLine();return separateWith(t.out)}return separateWith(r)}function separateComma(e){return e?{separator:`,`,appendNewLineIfNotEmpty:!0,skipNewLineAfterLastItem:!0}:{separator:`, `}}function foreachNewLine(...e){return operation(function foreachNewLineOp({ctx:t,out:n}){let r=[];for(let n of t){let t=executeOnFresh(n,e).out;hasContent(t)&&r.push(t)}n.appendIf(r.length>0,o(r,separateNewLine()))})}function guard(e,...t){return operation(`guard`,({ctx:n,out:r})=>{if(`safeParse`in e){let i=e.safeParse(n);if(i.success)executeOnCtx({ctx:i.data,out:r},t);else throw Error(`Guard failed: ${y.prettifyError(i.error)}`);return}if(g(typeof e==`function`),e(n)){executeOnCtx({ctx:n,out:r},t);return}})}function when(e,...t){return operation(function whenOp({ctx:n,out:r}){e(n)&&executeOnCtx({ctx:n,out:r},t)})}function select(e,...t){return operation(function selectOp({ctx:n,out:r}){let i=e(n);d(i)&&executeOnCtx({ctx:i,out:r},t)})}function execToOut(e){return(t,...n)=>executeOnCtx({ctx:t,out:e},n)}function zodOp(e){return t=>()=>({ctx:n,out:r})=>{let a=y.safeParse(e,n);if(a.success){let e=t({ctx:a.data,out:r,exec:execToOut(r)});return e instanceof i?{ctx:n,out:e}:typeof e==`function`?{ctx:n,out:r,...e({ctx:n,out:r})}:{ctx:n,out:r}}throw a.error}}var Ne=t({arrow:()=>E,border:()=>Ie,color:()=>j,customColor:()=>Be,fqn:()=>x,icon:()=>w,iconPosition:()=>Le,id:()=>Pe,kind:()=>S,line:()=>D,link:()=>Re,links:()=>O,markdownOrString:()=>A,metadata:()=>Ue,metadataValue:()=>He,opacity:()=>Fe,props:()=>N,shape:()=>C,size:()=>T,style:()=>M,tag:()=>k,tags:()=>Ve,themeColor:()=>ze,viewId:()=>b});const Pe=y.string().regex(/^[a-zA-Z0-9_.-]+$/,`id must consist of alphanumeric characters, underscores or hyphens`),b=Pe.transform(e=>e),x=y.string().regex(/^[a-zA-Z0-9_.-]+$/,`FQN must consist of alphanumeric characters, dots, underscores or hyphens`).transform(e=>e),S=y.string().regex(/^[a-zA-Z0-9_-]+$/,`Kind must consist of alphanumeric characters, underscores or hyphens`).transform(e=>e),Fe=y.int().min(0,`Opacity must be between 0 and 100`).max(100,`Opacity must be between 0 and 100`),C=y.literal(Ce),w=y.string().nonempty(`Icon cannot be empty`).transform(e=>e),Ie=y.literal(Se),T=y.literal(De),Le=y.literal(we),E=y.literal(Te),D=y.literal(Ee),Re=y.union([y.string(),y.object({title:y.string().optional(),url:y.string()})]).transform(e=>_e(typeof e==`string`?{url:e}:e)),O=y.array(Re).readonly(),ze=y.literal(Oe),Be=y.string().nonempty(`Custom color name cannot be empty`).transform(e=>e),k=y.string().nonempty(`Tag cannot be empty`).transform(e=>e.startsWith(`#`)?e.slice(1):e),Ve=y.array(k).readonly(),A=y.union([y.string().transform(e=>({txt:e})),y.strictObject({md:y.string()}),y.strictObject({txt:y.string()})]),j=ze.or(Be),M=y.object({shape:C,icon:w,iconColor:j,iconSize:T,iconPosition:Le,color:j,border:Ie,opacity:Fe,size:T,padding:T,textSize:T,multiple:y.boolean()}).partial().transform(m(d)),He=y.union([y.string(),y.boolean(),y.number()]),Ue=y.record(y.string(),He.or(y.array(He))),N=y.object({tags:Ve.nullish(),title:y.string().nullish(),summary:A.nullish(),description:A.nullish(),notation:y.string().nullish(),technology:y.string().nullish(),links:O.nullish(),metadata:Ue.nullish()});var We=t({directRelationExpr:()=>ft,elementKindExpr:()=>rt,elementTagExpr:()=>it,expression:()=>V,fqnExpr:()=>L,fqnExprAny:()=>dt,fqnExprCustom:()=>ut,fqnExprOrWhere:()=>ot,fqnRef:()=>qe,incomingRelationExpr:()=>pt,inoutRelationExpr:()=>ht,outgoingRelationExpr:()=>mt,refDeployment:()=>Ke,refExpr:()=>nt,refModel:()=>Ge,relationExpr:()=>R,relationExprAny:()=>gt,relationExprCustom:()=>B,relationExprOrWhere:()=>z,selector:()=>Je,whereAnd:()=>Qe,whereExpr:()=>_t,whereKind:()=>P,whereMetadata:()=>F,whereNot:()=>$e,whereOperator:()=>I,whereOr:()=>et,whereParticipant:()=>Ze,whereTag:()=>Ye,wildcardExpr:()=>tt});const Ge=y.strictObject({model:x,project:y.string().optional()}),Ke=y.strictObject({deployment:x,element:x.nullish()}),qe=y.union([Ge,Ke]),Je=y.literal([`children`,`expanded`,`descendants`]);function equalOp(e){return y.union([e.transform(e=>({eq:e})),y.object({eq:e}),y.object({neq:e})])}const Ye=y.object({tag:equalOp(k)}),P=y.object({kind:equalOp(S)}),F=y.object({metadata:y.object({key:y.string(),value:equalOp(y.string()).optional()})}),Xe=y.union([Ye,P,F]),Ze=y.object({participant:y.literal([`source`,`target`]),operator:Xe}),Qe=y.object({get and(){return y.array(I)}}),$e=y.object({get not(){return I}}),et=y.object({get or(){return y.array(I)}}),I=y.union([Ye,P,F,Ze,Qe,et,$e]),tt=y.object({wildcard:y.literal(!0)}),nt=y.object({ref:qe,selector:Je.optional()}),rt=y.object({elementKind:S,isEqual:y.boolean()}),it=y.object({elementTag:k,isEqual:y.boolean()}),L=y.union([tt,nt,rt,it]),at=y.strictObject({where:y.strictObject({expr:L,condition:I})}),ot=y.union([L,at]),st=y.object({title:y.string(),description:A,technology:y.string(),notation:y.string(),notes:A,navigateTo:b,color:j}),ct=y.object({...st.shape,shape:C,icon:w,iconColor:j,iconSize:T,iconPosition:Le,border:Ie,opacity:Fe,multiple:y.boolean(),size:T,padding:T,textSize:T}).partial(),lt=y.object({...st.shape,line:D,head:E,tail:E}).partial(),ut=y.strictObject({custom:ct.extend({expr:ot})}),dt=y.union([ot,ut]),ft=y.object({source:L,target:L,isBidirectional:y.boolean().optional()}),pt=y.object({incoming:L}),mt=y.object({outgoing:L}),ht=y.object({inout:L}),R=y.union([ft,pt,mt,ht]),z=y.union([R,y.strictObject({where:y.strictObject({expr:R,condition:I})})]),B=y.strictObject({customRelation:lt.extend({expr:z})}),gt=y.union([z,B]),_t=y.object({where:y.object({expr:y.union([L,R]),condition:I})}),V=y.union([L,ut,R,B,_t]);var vt=t({element:()=>wt,instance:()=>bt,node:()=>yt,relationship:()=>Ct,schema:()=>Ot});const yt=N.extend({id:x,kind:S,style:M.optional(),shape:C.optional(),color:j.optional(),icon:w.optional()}).readonly().transform(e=>{let{shape:t,color:n,icon:r,...i}=e;return m(ke(i,e=>{e.style=i.style||{},t&&(e.style.shape=t),n&&(e.style.color=n),r&&(e.style.icon=r)}),d)}),bt=N.extend({id:x,element:x,style:M.optional(),shape:C.optional(),color:j.optional(),icon:w.optional()}).readonly().transform(e=>{let{shape:t,color:n,icon:r,...i}=e;return m(ke(i,e=>{e.style=i.style||{},t&&(e.style.shape=t),n&&(e.style.color=n),r&&(e.style.icon=r)}),d)}),xt=Ke,St=Pe.transform(e=>e),Ct=N.extend({id:St.optional(),title:y.string().nullish(),source:xt,target:xt,navigateTo:b.nullish(),color:j.nullish(),kind:S.nullish(),line:D.nullish(),head:E.nullish(),tail:E.nullish()}).readonly().transform(m(d)),wt=y.union([yt,bt]),Tt=y.record(x,wt),Et=y.record(St,Ct),Dt=e(e=>e.id??he(8),`genRelationshipId`),Ot=y.object({elements:y.union([Tt,y.array(wt)]).transform(e=>l(e)?ne(e,me(`id`)):e).optional(),relations:y.union([Et,y.array(Ct)]).transform(e=>l(e)?ne(e,Dt):e).optional()});var kt=t({element:()=>At,relationship:()=>Nt,schema:()=>It});const At=y.object({...N.shape,id:x,kind:S,style:M.optional(),shape:C.optional(),color:j.optional(),icon:w.optional()}).transform(e=>{let{shape:t,color:n,icon:r,...i}=e;return(t||n||r)&&(i=ke(i,e=>{e.style=i.style||{},t&&(e.style.shape=t),n&&(e.style.color=n),r&&(e.style.icon=r)})),m(i,d)}).readonly(),jt=y.union([x,y.strictObject({model:x})]).transform(e=>typeof e==`string`?{model:e}:e),Mt=Pe.transform(e=>e),Nt=y.object({...N.shape,id:Mt.optional(),title:y.string().nullish(),source:jt,target:jt,navigateTo:b.nullish(),color:j.nullish(),kind:S.nullish(),line:D.nullish(),head:E.nullish(),tail:E.nullish()}).transform(m(d)).readonly(),Pt=y.record(x,At),Ft=y.record(Mt,Nt),genRelationshipId=e=>e.id??he(8),It=y.object({elements:y.union([Pt,y.array(At)]).transform(e=>l(e)?ne(e,me(`id`)):e).optional(),relations:y.union([Ft,y.array(Nt)]).transform(e=>l(e)?ne(e,genRelationshipId):e).optional()});var Lt=t({element:()=>H,relationship:()=>Rt,schema:()=>Bt,tagSpec:()=>zt});const H=y.object({tags:Ve.nullable(),title:y.string().nullable(),summary:A.nullable(),description:A.nullable(),technology:y.string().nullable(),notation:y.string().nullable(),links:O.nullable(),style:M.nullable()}).partial().transform(m(d)),Rt=y.object({technology:y.string().nullable(),notation:y.string().nullable(),color:j.nullable(),line:D.nullable(),head:E.nullable(),tail:E.nullable()}).partial().transform(m(d)),zt=y.object({color:j.nullable()}).partial().transform(m(d)),Bt=y.object({elements:y.record(S,H),deployments:y.record(S,H),relationships:y.record(S,Rt),tags:y.union([y.record(k,zt),y.array(k).transform(e=>le(e,e=>[e,{}]))])}).partial();var Vt=t({anyView:()=>pn,autoLayoutDirection:()=>Ht,deploymentView:()=>en,deploymentViewRule:()=>$t,deploymentViewRuleIncludeAncestors:()=>Ut,dynamicStep:()=>tn,dynamicStepAlt:()=>sn,dynamicStepAltBranch:()=>on,dynamicStepBlock:()=>rn,dynamicStepSeries:()=>nn,dynamicStepTry:()=>an,dynamicView:()=>fn,dynamicViewIncludeRule:()=>ln,dynamicViewRule:()=>un,dynamicViewStep:()=>cn,dynamicViewVariant:()=>dn,elementView:()=>Qt,elementViewRule:()=>Xt,viewRuleAutoLayout:()=>U,viewRuleExclude:()=>Gt,viewRuleGlobalPredicate:()=>K,viewRuleGlobalStyle:()=>Kt,viewRuleGroup:()=>Yt,viewRuleInclude:()=>Wt,viewRulePredicate:()=>W,viewRuleRank:()=>Jt,viewRuleStyle:()=>G,views:()=>mn});const Ht=y.literal([`TB`,`BT`,`LR`,`RL`]),U=y.object({direction:Ht,nodeSep:y.number().optional(),rankSep:y.number().optional()}),Ut=y.strictObject({includeAncestors:y.boolean()}),Wt=y.strictObject({include:y.array(V)}),Gt=y.strictObject({exclude:y.array(V)}),W=y.union([Wt,Gt]).transform(e=>e),G=y.object({targets:y.array(L),notation:y.string().optional(),style:M}).transform(e=>e),Kt=y.object({styleId:y.string()}).transform(e=>e),K=y.object({predicateId:y.string()}).transform(e=>e),qt=y.literal([`max`,`min`,`same`,`sink`,`source`]),Jt=y.object({targets:y.array(L),rank:qt}).transform(e=>e),Yt=y.lazy(()=>y.object({groupRules:y.array(y.union([W,K,Yt])),title:y.string().nullable(),color:j.optional(),border:Ie.optional(),opacity:Fe.optional(),multiple:y.boolean().optional(),size:T.optional(),padding:T.optional(),textSize:T.optional()})),Xt=y.union([W,U,G,Kt,K,Jt,Yt]),Zt=y.object({id:b,title:y.string().nullish(),description:A.nullish(),order:y.number().int().nonnegative().optional(),tags:Ve.nullish(),links:O.nullish()}),Qt=Zt.extend({_type:y.literal(`element`),viewOf:x.nullish(),extends:b.nullish(),rules:y.array(Xt).optional().default([])}),$t=y.union([W,U,G,Kt,K,Ut]),en=Zt.extend({_type:y.literal(`deployment`),rules:y.array($t).optional().default([])}),tn=y.object({_type:y.never().exactOptional(),source:x,target:x,title:y.string().nullish().default(null),kind:y.string().nullish(),description:A.nullish(),technology:y.string().nullish(),notation:y.string().nullish(),notes:A.nullish(),color:j.optional(),line:D.optional(),head:E.optional(),tail:E.optional(),isBackward:y.boolean().optional(),navigateTo:b.nullish()}),q=y.object({title:y.string().optional(),source:y.never().exactOptional(),target:y.never().exactOptional(),get steps(){return y.array(cn).nonempty(`must have at least one step`)}}),nn=y.object({_type:y.literal(`series`),steps:y.array(tn).nonempty(`must have at least one step`)}).readonly(),rn=q.extend({_type:y.literal([`par`,`loop`,`opt`,`break`])}).readonly(),an=y.object({_type:y.literal(`try`),try:q,catch:q.optional(),finally:q.optional()}).readonly(),on=q.extend({_type:y.literal([`when`,`if`,`else`])}).readonly(),sn=y.object({_type:y.literal(`alt`),title:y.string().optional(),branches:y.array(on).nonempty(`alt block must have at least one branch`)}).readonly(),cn=y.union([tn,sn,nn,rn,an]),ln=y.strictObject({include:y.array(V)}),un=y.union([ln,K,G,Kt,U]),dn=y.literal([`diagram`,`sequence`]),fn=Zt.extend({_type:y.literal(`dynamic`),variant:dn.optional(),steps:y.array(cn).optional(),rules:y.array(un).optional()}),pn=y.union([Qt,en,fn]),mn=y.record(b,pn),hn=y.object({...It.shape,views:mn,project:y.object({id:y.string(),styles:Ae.nullish()}),deployment:Ot,deployments:Ot,specification:Bt}).partial().readonly().transform(normalizeStyles);function normalizeStyles(e){let t=e.specification?.elements;return!u(t)&&!u(e.elements)&&(e={...e,elements:ue(e.elements,e=>normalizeElementStyles(e,t))}),e}function normalizeElementStyles(e,t){let n=t[e.kind];if(!n)return e;let r=n.style??{};return ke(e,t=>{for(let r of[`description`,`technology`,`tags`,`summary`]){let i=n[r],a=e[r];re(i,a)&&delete t[r]}if(e.style)for(let[n,i]of s(r))re(e.style?.[n],i)&&delete t.style[n]})}const J={common:Ne,expr:We,specification:Lt,model:kt,deployment:vt,views:Vt,likec4data:hn};var gn=t({colorProperty:()=>colorProperty,descriptionProperty:()=>descriptionProperty,iconProperty:()=>iconProperty,linkProperty:()=>linkProperty,linksProperty:()=>linksProperty,markdownProperty:()=>markdownProperty,metadataProperty:()=>metadataProperty,metadataValue:()=>metadataValue,notationProperty:()=>notationProperty,notesProperty:()=>notesProperty,opacityProperty:()=>opacityProperty,styleBlockProperty:()=>styleBlockProperty,styleProperties:()=>Y,summaryProperty:()=>summaryProperty,tagsProperty:()=>tagsProperty,technologyProperty:()=>technologyProperty,textProperty:()=>textProperty,titleProperty:()=>titleProperty});function textProperty(e,t){return select(t=>t[e],spaceBetween(print(t??e),text()))}function markdownProperty(e,t){return select(t=>t[e],spaceBetween(print(t??e),markdownOrString()))}const titleProperty=()=>property(`title`,spaceBetween(print(`title`),text())),summaryProperty=()=>property(`summary`,spaceBetween(print(`summary`),markdownOrString())),descriptionProperty=()=>property(`description`,spaceBetween(print(`description`),markdownOrString())),notesProperty=()=>property(`notes`,spaceBetween(print(`notes`),markdownOrString())),technologyProperty=()=>property(`technology`,spaceBetween(print(`technology`),text())),notationProperty=()=>property(`notation`,spaceBetween(print(`notation`),text()));function printMetadataValue(){return operation(({ctx:e,out:t})=>p(e)?text()({ctx:e,out:t}):print()({ctx:e,out:t}))}function metadataValue(){return pe(guard(ae(l),printMetadataValue()),guard(l,body(`[`,`]`)(foreach(printMetadataValue(),{appendNewLineIfNotEmpty:!0,suffix(e,t,n){return n?void 0:`,`}}))))}const metadataProperty=()=>select(e=>e.metadata?s(e.metadata):void 0,body(`metadata`)(foreach(spaceBetween(print(e=>e[0]),property(`1`,metadataValue())),separateNewLine()))),tagsProperty=()=>property(`tags`,print(e=>e.map(e=>`#${e}`).join(`, `)));function linkProperty(){return spaceBetween(select(e=>typeof e==`string`?{url:e}:_e({url:e.url,title:e.title}),print(`link`),print(e=>e.url),property(`title`,inlineText())))}const linksProperty=()=>property(`links`,foreachNewLine(linkProperty()));function styleBlockProperty(){return select(e=>e.style,body(`style`)(Y()))}function colorProperty(){return property(`color`,spaceBetween(print(`color`),print()))}function opacityProperty(){return property(`opacity`,spaceBetween(print(`opacity`),print(e=>`${e}%`)))}function iconProperty(){return property(`icon`,spaceBetween(print(`icon`),print()))}const Y=zodOp(M)(lines(property(`shape`),colorProperty(),iconProperty(),property(`iconColor`),property(`iconSize`),property(`iconPosition`),property(`border`),opacityProperty(),property(`size`),property(`padding`),property(`textSize`),property(`multiple`)));var _n=t({directRelationExpr:()=>On,expression:()=>$,fqnExpr:()=>Q,fqnExprAny:()=>Dn,fqnExprCustom:()=>Tn,fqnExprOrWhere:()=>En,fqnRef:()=>Z,inOutRelationExpr:()=>jn,incomingRelationExpr:()=>kn,outgoingRelationExpr:()=>An,relationExpr:()=>Mn,relationExprAny:()=>Fn,relationExprCustom:()=>Pn,relationExprOrWhere:()=>Nn,whereAnd:()=>Cn,whereKindEqual:()=>yn,whereMetadataEqual:()=>bn,whereNot:()=>xn,whereOperator:()=>X,whereOr:()=>wn,whereParticipant:()=>Sn,whereTagEqual:()=>vn});function appendSelector(e,t){if(t)switch(t){case`children`:e.append(`.*`);break;case`descendants`:e.append(`.**`);break;case`expanded`:e.append(`._`);break;default:_(t)}return e}const vn=zodOp(Ye)(function whereTagEqualOp({ctx:{tag:e},out:t}){if(`eq`in e)return t.appendTemplate`tag is #${e.eq}`;if(`neq`in e)return t.appendTemplate`tag is not #${e.neq}`;_(e)}),yn=zodOp(P)(function whereKindEqualOp({ctx:{kind:e},out:t}){if(`eq`in e)return t.appendTemplate`kind is ${e.eq}`;if(`neq`in e)return t.appendTemplate`kind is not ${e.neq}`;_(e)});function quoteMetadataValue(e){return e===`true`||e===`false`?e:`"${e}"`}const bn=zodOp(F)(function whereMetadataEqualOp({ctx:{metadata:e},out:t}){let{key:n,value:r}=e;if(r===void 0)return t.appendTemplate`metadata.${n}`;if(`eq`in r)return t.append(`metadata.${n} is ${quoteMetadataValue(r.eq)}`);if(`neq`in r)return t.append(`metadata.${n} is not ${quoteMetadataValue(r.neq)}`);_(r)}),xn=zodOp($e)(property(`not`,spaceBetween(print(`not (`),lazy(()=>X()),print(`)`)))),Sn=zodOp(Ze)(function whereParticipantOp({ctx:{participant:e,operator:t},out:n}){if(n.append(e,`.`),`tag`in t){vn()({ctx:t,out:n});return}if(`kind`in t){yn()({ctx:t,out:n});return}if(`metadata`in t){bn()({ctx:t,out:n});return}_(t)}),Cn=zodOp(Qe)(function whereAndOp({ctx:{and:e},out:t}){let n=ce(e,e=>{let{out:t}=executeOnFresh(e,X());return`or`in e&&(t=fresh().out.append(`(`,...t.contents,`)`)),t});return t.append(o(n,{appendNewLineIfNotEmpty:!0,skipNewLineAfterLastItem:!0,prefix(e,t){return t>0?`and `:void 0}}))}),wn=zodOp(et)(({ctx:{or:e},out:t})=>{let n=ce(e,e=>{let{out:t}=executeOnFresh(e,X());return`and`in e&&(t=fresh().out.append(`(`,...t.contents,`)`)),t});return t.append(o(n,{appendNewLineIfNotEmpty:!0,skipNewLineAfterLastItem:!0,prefix(e,t){return t>0?`or `:void 0}}))}),X=zodOp(I)(({ctx:e,exec:t})=>{if(`and`in e)return t(e,Cn());if(`or`in e)return t(e,wn());if(`not`in e)return t(e,xn());if(`tag`in e)return t(e,vn());if(`kind`in e)return t(e,yn());if(`metadata`in e)return t(e,bn());if(`participant`in e)return t(e,Sn());_(e)}),Z=zodOp(qe)(({ctx:e,out:t})=>(`model`in e?t.append(e.model):(t.append(e.deployment),e.element&&t.append(`.`,e.element)),t)),Q=zodOp(L)(({ctx:e,out:t,exec:n})=>{if(`wildcard`in e)return t.append(`*`);if(`elementKind`in e)return t.append(`element.kind`).append(e.isEqual?` = `:` != `).append(e.elementKind);if(`elementTag`in e)return t.append(`element.tag`).append(e.isEqual?` = `:` != `).append(`#${e.elementTag}`);if(`ref`in e)return n(e.ref,Z()),appendSelector(t,e.selector),t;_(e)}),Tn=zodOp(ut)(({ctx:{custom:e},exec:t})=>{t(e.expr,En());let n=withctx(e)(body(`with`)(titleProperty(),descriptionProperty(),notationProperty(),notesProperty(),property(`navigateTo`),Y()));return`where`in e.expr?t({},indent(n)):t({},space(),n)}),En=zodOp(ot)(({ctx:e,exec:t})=>{if(`where`in e){t(e.where.expr,Q()),t(e.where.condition,indent(print(`where`),indent(X())));return}t(e,Q())}),Dn=zodOp(dt)(({ctx:e,out:t})=>`custom`in e?Tn()({ctx:e,out:t}):En()({ctx:e,out:t})),On=zodOp(ft)(merge(property(`source`,Q()),print(e=>e.isBidirectional?` <-> `:` -> `),property(`target`,Q()))),kn=zodOp(pt)(merge(print(`-> `),property(`incoming`,Q()))),An=zodOp(mt)(merge(property(`outgoing`,Q()),print(` ->`))),jn=zodOp(ht)(merge(print(`-> `),property(`inout`,Q()),print(` ->`))),Mn=zodOp(R)(({ctx:e,exec:t})=>{if(`source`in e)return t(e,On());if(`incoming`in e)return t(e,kn());if(`outgoing`in e)return t(e,An());if(`inout`in e)return t(e,jn());_(e)}),Nn=zodOp(z)(({ctx:e,out:t})=>`where`in e?merge(withctx(e.where.expr)(Mn()),indent(print(`where`),indent(withctx(e.where.condition)(X()))))({ctx:e,out:t}):Mn()({ctx:e,out:t})),Pn=zodOp(B)(({ctx:{customRelation:e},exec:t})=>{t(e.expr,Nn());let n=withctx(e)(body(`with`)(titleProperty(),descriptionProperty(),notationProperty(),markdownProperty(`notes`),property(`navigateTo`),Y(),property(`head`),property(`tail`),property(`line`)));`where`in e.expr?t({},indent(n)):t({},space(),n)}),Fn=zodOp(gt)(({ctx:e,exec:t})=>`customRelation`in e?t(e,Pn()):t(e,Nn())),$=zodOp(V)(({ctx:e,exec:t})=>{if(`custom`in e)return t(e,Tn());if(`customRelation`in e)return t(e,Pn());if(`wildcard`in e||`ref`in e||`elementKind`in e||`elementTag`in e)return t(e,Q());if(`source`in e||`incoming`in e||`outgoing`in e||`inout`in e)return t(e,Mn());if(`where`in e){let{expr:n,condition:r}=e.where;return`source`in n||`incoming`in n||`outgoing`in n||`inout`in n?t({where:{expr:n,condition:r}},Nn()):t({where:{expr:n,condition:r}},En())}_(e)});var In=t({deployment:()=>Bn,instance:()=>Rn,node:()=>node,relationship:()=>zn});function buildTree$1(e){let t=new Map,n=[],r=fe(e,be);for(let e of r){let r;r=`element`in e?e:{...e,children:[]},t.set(e.id,r);let i=ye(e.id),a=i?t.get(i):void 0;a&&`children`in a?a.children.push(r):n.push(r)}return{roots:n,nodes:t,exists:e=>t.has(e)}}e(buildTree$1,`buildTree`);function hasStyleProps$1(e){return!u(e.style)}e(hasStyleProps$1,`hasStyleProps`);function hasElementProps$1(e){return!!(e.description||e.summary||e.technology||e.notation||e.tags&&e.tags.length>0||e.links&&e.links.length>0||!u(e.metadata)||hasStyleProps$1(e))}e(hasElementProps$1,`hasElementProps`);const Ln=zodOp(J.deployment.element)(lines(tagsProperty(),technologyProperty(),summaryProperty(),descriptionProperty(),linksProperty(),metadataProperty(),select(e=>hasStyleProps$1(e)?e.style:void 0,body(`style`)(Y())))),Rn=zodOp(J.deployment.instance)(spaceBetween(when(e=>v(e.id)!==v(e.element),print(e=>v(e.id)),print(` =`)),print(`instanceOf`),printProperty(`element`),when(e=>!!e.title&&e.title!==v(e.id),property(`title`,inlineText())),when(e=>hasElementProps$1(e),body(Ln()))));function node(){return function nodeOp({ctx:e,out:t}){let n=e;if(`element`in n)return Rn()({ctx:n,out:t}),{ctx:e,out:t};ve(`children`in n,`Node must have children property`);let r=n.children.length>0||hasElementProps$1(n),i=v(n.id),a=[print(i),print(`=`),print(n.kind)];return n.title&&n.title!==i&&a.push(inlineText(n.title)),r&&a.push(body(lines(2)(withctx(n,Ln()),...n.children.map(e=>withctx(e,nodeOp))))),spaceBetween(...a)({ctx:e,out:t})}}function hasRelationStyle$1(e){return!!(e.color||e.line||e.head||e.tail)}e(hasRelationStyle$1,`hasRelationStyle`);function hasRelationProps$1(e){return!!(e.description||e.summary||e.technology||e.tags&&e.tags.length>0||e.links&&e.links.length>0||!u(e.metadata)||hasRelationStyle$1(e)||e.navigateTo)}e(hasRelationProps$1,`hasRelationProps`);const zn=zodOp(J.deployment.relationship)(spaceBetween(property(`source`,Z()),print(e=>e.kind?`-[${e.kind}]->`:`->`),property(`target`,Z()),property(`title`,inlineText()),when(hasRelationProps$1,body(tagsProperty(),technologyProperty(),summaryProperty(),descriptionProperty(),property(`navigateTo`),linksProperty(),metadataProperty(),when(hasRelationStyle$1,body(`style`)(colorProperty(),property(`line`),property(`head`),property(`tail`))))))),Bn=zodOp(J.deployment.schema)(body(`deployment`)(lines(2)(select(e=>buildTree$1(e.elements?h(e.elements):[]).roots,lines(2)(foreach(node()))),select(e=>e.relations?h(e.relations):void 0,lines(2)(foreach(zn()))))));var Vn=t({element:()=>Wn,model:()=>Gn,relationship:()=>Un});function buildTree(e){let t=new Map,n=[],r=fe(e,be);for(let e of r){let r={...e,children:[]};t.set(e.id,r);let i=ye(e.id),a=i?t.get(i):void 0;a?a.children.push(r):n.push(r)}return{roots:n,nodes:t,exists:e=>t.has(e)}}function hasStyleProps(e){return!u(e.style)}function hasElementProps(e){return!!(e.description||e.summary||e.technology||e.notation||e.tags&&e.tags.length>0||e.links&&e.links.length>0||!u(e.metadata)||hasStyleProps(e))}const Hn=zodOp(J.model.element)(lines(tagsProperty(),technologyProperty(),summaryProperty(),descriptionProperty(),linksProperty(),metadataProperty(),select(e=>hasStyleProps(e)?e.style:void 0,body(`style`)(Y()))));function elementTree(){return function elementTreeNodeOp({ctx:e,out:t}){let n=e,r=(e.children?.length??0)>0||hasElementProps(n),i=v(n.id),a=[print(i),print(`=`),print(n.kind)];return n.title&&n.title!==i&&a.push(inlineText(n.title)),r&&a.push(body(lines(2)(withctx(n,Hn()),...(e.children??[]).map(e=>withctx(e,elementTree()))))),spaceBetween(...a)({ctx:e,out:t})}}function hasRelationStyle(e){return!!(e.color||e.line||e.head||e.tail)}function hasRelationProps(e){return!!(e.description||e.summary||e.technology||e.tags&&e.tags.length>0||e.links&&e.links.length>0||!u(e.metadata)||hasRelationStyle(e)||e.navigateTo)}const Un=zodOp(J.model.relationship)(spaceBetween(property(`source`,Z()),print(e=>e.kind?`-[${e.kind}]->`:`->`),property(`target`,Z()),property(`title`,inlineText()),when(hasRelationProps,body(tagsProperty(),technologyProperty(),summaryProperty(),descriptionProperty(),property(`navigateTo`),linksProperty(),metadataProperty(),when(hasRelationStyle,body(`style`)(colorProperty(),property(`line`),property(`head`),property(`tail`))))))),Wn=zodOp(J.model.element)(elementTree()),Gn=zodOp(J.model.schema)(body(`model`)(lines(2)(select(e=>buildTree(e.elements?h(e.elements):[]).roots,lines(2)(foreach(elementTree()))),select(e=>e.relations?h(e.relations):void 0,lines(2)(foreach(Un()))))));var Kn=t({elementKind:()=>elementKind,relationshipKind:()=>Jn,specification:()=>Yn,tagSpecification:()=>qn});const qn=zodOp(y.tuple([y.string(),zt]))(spaceBetween(print(`tag`),printProperty(`0`),property(`1`,property(`color`,body(spaceBetween(print(`color`),print())))))),elementKind=e=>zodOp(y.tuple([y.string(),H]))(spaceBetween(print(e),printProperty(`0`),property(`1`,body(tagsProperty(),titleProperty(),summaryProperty(),descriptionProperty(),technologyProperty(),notationProperty(),linksProperty(),property(`style`,body(`style`)(Y())))))),Jn=zodOp(y.tuple([y.string(),Rt]))(spaceBetween(print(`relationship`),printProperty(`0`),property(`1`,body(technologyProperty(),notationProperty(),colorProperty(),property(`line`),property(`head`),property(`tail`))))),Yn=zodOp(Bt)(body(`specification`)(lines(2)(select(e=>e.elements&&s(e.elements),foreachNewLine(elementKind(`element`)())),select(e=>e.deployments&&s(e.deployments),foreachNewLine(elementKind(`deploymentNode`)())),select(e=>e.relationships&&s(e.relationships),foreachNewLine(Jn())),select(e=>e.tags&&s(e.tags),foreachNewLine(qn())))));var Xn=t({anyView:()=>Sr,deploymentView:()=>lr,deploymentViewRule:()=>cr,deploymentViewRuleIncludeAncestors:()=>ir,dynamicView:()=>xr,dynamicViewIncludeRule:()=>yr,dynamicViewRule:()=>br,elementView:()=>sr,elementViewRule:()=>or,step:()=>vr,viewRuleAutoLayout:()=>rr,viewRuleGlobalPredicate:()=>tr,viewRuleGlobalStyle:()=>er,viewRuleGroup:()=>$n,viewRulePredicate:()=>Zn,viewRuleRank:()=>ar,viewRuleStyle:()=>Qn,views:()=>Cr});const viewTitleProperty=()=>property(`title`,spaceBetween(print(`title`),inlineText())),Zn=zodOp(J.views.viewRulePredicate)(({ctx:e,exec:t})=>{let n,r;if(`include`in e?(n=e.include,r=`include`):`exclude`in e&&(n=e.exclude,r=`exclude`),g(n&&r,`Invalid view rule predicate`),!c(n,1))return;let i=c(n,2),a=withctx(n)(foreach($(),separateComma(i)));t(e,merge(print(r),...i?[indent(a)]:[space(),a]))}),Qn=zodOp(J.views.viewRuleStyle)(spaceBetween(print(`style`),property(`targets`,foreach($(),separateComma())),body(`{`,`}`)(notationProperty(),property(`style`,Y())))),$n=zodOp(J.views.viewRuleGroup)(({ctx:e,exec:t})=>{throw Error(`not implemented`)}),er=zodOp(J.views.viewRuleGlobalStyle)(({ctx:e,exec:t})=>{throw Error(`not implemented`)}),tr=zodOp(J.views.viewRuleGlobalPredicate)(({ctx:e,exec:t})=>{throw Error(`not implemented`)}),nr={TB:`TopBottom`,BT:`BottomTop`,LR:`LeftRight`,RL:`RightLeft`},rr=zodOp(J.views.viewRuleAutoLayout)(spaceBetween(print(`autoLayout`),property(`direction`,print(e=>nr[e])),guard(ge(`rankSep`),spaceBetween(printProperty(`rankSep`),printProperty(`nodeSep`))))),ir=zodOp(J.views.deploymentViewRuleIncludeAncestors)(spaceBetween(print(`includeAncestors`),printProperty(`includeAncestors`))),ar=zodOp(J.views.viewRuleRank)(({ctx:e,exec:t})=>{throw Error(`not implemented`)}),or=zodOp(J.views.elementViewRule)(({ctx:e,exec:t})=>{if(`include`in e||`exclude`in e)return t(e,Zn());if(`groupRules`in e)return t(e,$n());if(`rank`in e)return t(e,ar());if(`direction`in e)return t(e,rr());if(`styleId`in e)return t(e,er());if(`predicateId`in e)return t(e,tr());if(`targets`in e&&`style`in e)return t(e,Qn());_(e)}),sr=zodOp(J.views.elementView.partial({_type:!0}))(spaceBetween(print(`view`),print(e=>e.id),property(`viewOf`,spaceBetween(print(`of`),print())),body(lines(2)(lines(tagsProperty(),viewTitleProperty(),property(`order`),descriptionProperty(),linksProperty()),property(`rules`,foreachNewLine(or())))))),cr=zodOp(J.views.deploymentViewRule)(({ctx:e,exec:t})=>{if(`include`in e||`exclude`in e)return t(e,Zn());if(`includeAncestors`in e)return t(e,ir());if(`direction`in e)return t(e,rr());if(`styleId`in e)return t(e,er());if(`predicateId`in e)return t(e,tr());if(`targets`in e&&`style`in e)return t(e,Qn());_(e)}),lr=zodOp(J.views.deploymentView.partial({_type:!0}))(spaceBetween(print(`deployment view`),print(e=>e.id),body(lines(2)(lines(tagsProperty(),viewTitleProperty(),property(`order`),descriptionProperty(),linksProperty()),property(`rules`,foreachNewLine(cr())))))),ur=zodOp(J.views.dynamicStep.partial({source:!0}))(spaceBetween(print(e=>e.isBackward?`<-`:e.kind?`-[${e.kind}]->`:`->`),printProperty(`target`),property(`title`,text()),body(lines(technologyProperty(),descriptionProperty(),notesProperty(),property(`navigateTo`),notationProperty(),colorProperty(),property(`line`),property(`head`),property(`tail`))))),dr=zodOp(J.views.dynamicStep)(spaceBetween(printProperty(`source`),ur())),bodyWithSteps=()=>property(`steps`,body(foreachNewLine(lazy(()=>_r())))),fr=zodOp(J.views.dynamicStepBlock)(spaceBetween(printProperty(`_type`),property(`title`,text()),bodyWithSteps())),pr=zodOp(J.views.dynamicStepSeries)(merge(select(e=>e.steps[0],printProperty(`source`)),indent(property(`steps`,foreachNewLine(ur()))))),mr=zodOp(J.views.dynamicStepTry)(spaceBetween(select(e=>e.try,spaceBetween(print(`try`),property(`title`,text()),bodyWithSteps())),select(e=>e.catch,spaceBetween(print(`catch`),property(`title`,text()),bodyWithSteps())),select(e=>e.finally,spaceBetween(print(`finally`),property(`title`,text()),bodyWithSteps())))),hr=zodOp(J.views.dynamicStepAltBranch)(spaceBetween(printProperty(`_type`),property(`title`,text()),bodyWithSteps())),gr=zodOp(J.views.dynamicStepAlt)(spaceBetween(print(`alt`),property(`title`,text()),body(property(`branches`,foreachNewLine(hr()))))),_r=zodOp(J.views.dynamicViewStep)(({ctx:e,exec:t})=>{if(e.source&&e.target)return t(e,dr());switch(g(e._type,`Step must have a type`),e._type){case`loop`:case`opt`:case`break`:case`par`:return t(e,fr());case`alt`:return t(e,gr());case`series`:return t(e,pr());case`try`:return t(e,mr());default:_(e)}}),vr={single:dr,block:fr,alt:gr,series:pr,try:mr,any:_r},yr=zodOp(J.views.dynamicViewIncludeRule)(({ctx:e,exec:t})=>{if(!c(e.include,1))return;let n=c(e.include,2),r=withctx(e.include)(foreach($(),separateComma(n)));t(e,merge(print(`include`),...n?[indent(r)]:[space(),r]))}),br=zodOp(J.views.dynamicViewRule)(({ctx:e,exec:t})=>{if(`include`in e)return t(e,yr());if(`predicateId`in e)return t(e,tr());if(`targets`in e&&`style`in e)return t(e,Qn());if(`styleId`in e)return t(e,er());if(`direction`in e)return t(e,rr());_(e)}),xr=zodOp(J.views.dynamicView.partial({_type:!0}))(spaceBetween(print(`dynamic view`),print(e=>e.id),body(lines(2)(lines(tagsProperty(),viewTitleProperty(),property(`order`),descriptionProperty(),linksProperty(),property(`variant`)),property(`steps`,foreachNewLine(vr.any())),property(`rules`,foreachNewLine(br())))))),Sr=zodOp(J.views.anyView)(({ctx:e,exec:t})=>{if(`_type`in e){if(e._type==`element`)return t(e,sr());if(e._type===`deployment`)return t(e,lr());if(e._type===`dynamic`)return t(e,xr())}_(e)}),Cr=zodOp(J.views.views)(body(`views`)(select(e=>h(e),foreach(Sr(),{separator:new i().appendNewLine().appendNewLine(),prefix:(e,t,n)=>t===0&&!n?r:void 0})))),wr=zodOp(J.likec4data)(lines(2)(property(`specification`,Yn()),Gn(),property(`deployment`,Bn()),property(`deployments`,Bn()),property(`views`,Cr())));var Tr=t({base:()=>je,deployment:()=>Bn,deploymentView:()=>lr,deployments:()=>In,dynamicView:()=>xr,elementView:()=>sr,expr:()=>_n,expression:()=>$,likec4data:()=>wr,model:()=>Gn,models:()=>Vn,props:()=>gn,specification:()=>Yn,specifications:()=>Kn,views:()=>Xn});function generateLikeC4(e,t){return t={indentation:2,...t},materialize(withctx(e,wr()),t.indentation)}function printOperation(e,t,n){return materialize(withctx(t??{},e),n?.indentation)}function printWithTabIndent(e,t){return materialize(withctx(t??{},e),` `)}export{body,eachOnFresh,eq,executeOnCtx,executeOnFresh,foreach,foreachNewLine,fresh,generateLikeC4 as generate,guard,indent,inlineText,join,lazy,lines,markdown,markdownOrString,materialize,merge,newline,noop,operation,Tr as ops,print,printOperation,printProperty,printWithTabIndent,property,select,separateComma,separateNewLine,separateWith,space,spaceBetween,text,when,withctx,zodOp};
|