@flock/wirespec 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/kotlin/Kotlinx-Cli-Library-kotlinx-cli-js-ir.js +1601 -0
  2. package/kotlin/Kotlinx-Cli-Library-kotlinx-cli-js-ir.js.map +1 -0
  3. package/kotlin/arrow-arrow-annotations.js +15 -0
  4. package/kotlin/arrow-arrow-annotations.js.map +1 -0
  5. package/kotlin/arrow-arrow-atomic.js +57 -0
  6. package/kotlin/arrow-arrow-atomic.js.map +1 -0
  7. package/kotlin/arrow-arrow-continuations.js +31 -0
  8. package/kotlin/arrow-arrow-continuations.js.map +1 -0
  9. package/kotlin/arrow-arrow-core.js +357 -0
  10. package/kotlin/arrow-arrow-core.js.map +1 -0
  11. package/kotlin/kotlin-kotlin-stdlib-js-ir.js +11509 -0
  12. package/kotlin/kotlin-kotlin-stdlib-js-ir.js.map +1 -0
  13. package/kotlin/kotlin-openapi-bindings.js +12060 -0
  14. package/kotlin/kotlin-openapi-bindings.js.map +1 -0
  15. package/kotlin/kotlinx-serialization-kotlinx-serialization-core-js-ir.js +5362 -0
  16. package/kotlin/kotlinx-serialization-kotlinx-serialization-core-js-ir.js.map +1 -0
  17. package/kotlin/kotlinx-serialization-kotlinx-serialization-json-js-ir.js +4421 -0
  18. package/kotlin/kotlinx-serialization-kotlinx-serialization-json-js-ir.js.map +1 -0
  19. package/kotlin/wirespec-bin.js +3 -0
  20. package/kotlin/wirespec-cli.js +1069 -0
  21. package/kotlin/wirespec-cli.js.map +1 -0
  22. package/kotlin/wirespec-core.js +4687 -0
  23. package/kotlin/wirespec-core.js.map +1 -0
  24. package/kotlin/wirespec-lib.js +620 -0
  25. package/kotlin/wirespec-lib.js.map +1 -0
  26. package/kotlin/wirespec-openapi.js +2614 -0
  27. package/kotlin/wirespec-openapi.js.map +1 -0
  28. package/package.json +17 -0
  29. package/sync-hashes/Kotlinx-Cli-Library-kotlinx-cli-js-ir.js.hash +1 -0
  30. package/sync-hashes/Kotlinx-Cli-Library-kotlinx-cli-js-ir.js.map.hash +1 -0
  31. package/sync-hashes/arrow-arrow-annotations.js.hash +1 -0
  32. package/sync-hashes/arrow-arrow-annotations.js.map.hash +1 -0
  33. package/sync-hashes/arrow-arrow-atomic.js.hash +1 -0
  34. package/sync-hashes/arrow-arrow-atomic.js.map.hash +1 -0
  35. package/sync-hashes/arrow-arrow-continuations.js.hash +1 -0
  36. package/sync-hashes/arrow-arrow-continuations.js.map.hash +1 -0
  37. package/sync-hashes/arrow-arrow-core.js.hash +1 -0
  38. package/sync-hashes/arrow-arrow-core.js.map.hash +1 -0
  39. package/sync-hashes/kotlin-kotlin-stdlib-js-ir.js.hash +1 -0
  40. package/sync-hashes/kotlin-kotlin-stdlib-js-ir.js.map.hash +1 -0
  41. package/sync-hashes/kotlin-openapi-bindings.js.hash +1 -0
  42. package/sync-hashes/kotlin-openapi-bindings.js.map.hash +1 -0
  43. package/sync-hashes/kotlinx-serialization-kotlinx-serialization-core-js-ir.js.hash +1 -0
  44. package/sync-hashes/kotlinx-serialization-kotlinx-serialization-core-js-ir.js.map.hash +1 -0
  45. package/sync-hashes/kotlinx-serialization-kotlinx-serialization-json-js-ir.js.hash +1 -0
  46. package/sync-hashes/kotlinx-serialization-kotlinx-serialization-json-js-ir.js.map.hash +1 -0
  47. package/sync-hashes/wirespec-bin.js.hash +1 -0
  48. package/sync-hashes/wirespec-cli.js.hash +1 -0
  49. package/sync-hashes/wirespec-cli.js.map.hash +1 -0
  50. package/sync-hashes/wirespec-core.js.hash +1 -0
  51. package/sync-hashes/wirespec-core.js.map.hash +1 -0
  52. package/sync-hashes/wirespec-lib.js.hash +1 -0
  53. package/sync-hashes/wirespec-lib.js.map.hash +1 -0
  54. package/sync-hashes/wirespec-openapi.js.hash +1 -0
  55. package/sync-hashes/wirespec-openapi.js.map.hash +1 -0
@@ -0,0 +1,1069 @@
1
+ (function (root, factory) {
2
+ if (typeof define === 'function' && define.amd)
3
+ define(['exports', './kotlin-kotlin-stdlib-js-ir.js', './Kotlinx-Cli-Library-kotlinx-cli-js-ir.js', './wirespec-core.js', './arrow-arrow-core.js', './wirespec-openapi.js'], factory);
4
+ else if (typeof exports === 'object')
5
+ factory(module.exports, require('./kotlin-kotlin-stdlib-js-ir.js'), require('./Kotlinx-Cli-Library-kotlinx-cli-js-ir.js'), require('./wirespec-core.js'), require('./arrow-arrow-core.js'), require('./wirespec-openapi.js'));
6
+ else {
7
+ if (typeof this['kotlin-kotlin-stdlib-js-ir'] === 'undefined') {
8
+ throw new Error("Error loading module 'wirespec-cli'. Its dependency 'kotlin-kotlin-stdlib-js-ir' was not found. Please, check whether 'kotlin-kotlin-stdlib-js-ir' is loaded prior to 'wirespec-cli'.");
9
+ }
10
+ if (typeof this['Kotlinx-Cli-Library-kotlinx-cli-js-ir'] === 'undefined') {
11
+ throw new Error("Error loading module 'wirespec-cli'. Its dependency 'Kotlinx-Cli-Library-kotlinx-cli-js-ir' was not found. Please, check whether 'Kotlinx-Cli-Library-kotlinx-cli-js-ir' is loaded prior to 'wirespec-cli'.");
12
+ }
13
+ if (typeof this['wirespec-core'] === 'undefined') {
14
+ throw new Error("Error loading module 'wirespec-cli'. Its dependency 'wirespec-core' was not found. Please, check whether 'wirespec-core' is loaded prior to 'wirespec-cli'.");
15
+ }
16
+ if (typeof this['arrow-arrow-core'] === 'undefined') {
17
+ throw new Error("Error loading module 'wirespec-cli'. Its dependency 'arrow-arrow-core' was not found. Please, check whether 'arrow-arrow-core' is loaded prior to 'wirespec-cli'.");
18
+ }
19
+ if (typeof this['wirespec-openapi'] === 'undefined') {
20
+ throw new Error("Error loading module 'wirespec-cli'. Its dependency 'wirespec-openapi' was not found. Please, check whether 'wirespec-openapi' is loaded prior to 'wirespec-cli'.");
21
+ }
22
+ root['wirespec-cli'] = factory(typeof this['wirespec-cli'] === 'undefined' ? {} : this['wirespec-cli'], this['kotlin-kotlin-stdlib-js-ir'], this['Kotlinx-Cli-Library-kotlinx-cli-js-ir'], this['wirespec-core'], this['arrow-arrow-core'], this['wirespec-openapi']);
23
+ }
24
+ }(this, function (_, kotlin_kotlin, kotlin_org_jetbrains_kotlinx_kotlinx_cli, kotlin_community_flock_wirespec_compiler_core, kotlin_io_arrow_kt_arrow_core, kotlin_community_flock_wirespec_openapi) {
25
+ 'use strict';
26
+ //region block: imports
27
+ var imul = Math.imul;
28
+ var numberRangeToNumber = kotlin_kotlin.$_$.p7;
29
+ var ArrayList_init_$Create$ = kotlin_kotlin.$_$.g;
30
+ var Unit_getInstance = kotlin_kotlin.$_$.i3;
31
+ var copyToArray = kotlin_kotlin.$_$.p4;
32
+ var ArgParser = kotlin_org_jetbrains_kotlinx_kotlinx_cli.$_$.d;
33
+ var Boolean_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_cli.$_$.a;
34
+ var VOID = kotlin_kotlin.$_$.ya;
35
+ var default_0 = kotlin_org_jetbrains_kotlinx_kotlinx_cli.$_$.f;
36
+ var KProperty0 = kotlin_kotlin.$_$.e8;
37
+ var THROW_ISE = kotlin_kotlin.$_$.z9;
38
+ var getLocalDelegateReference = kotlin_kotlin.$_$.u6;
39
+ var String_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_cli.$_$.c;
40
+ var collectionSizeOrDefault = kotlin_kotlin.$_$.c4;
41
+ var ArrayList_init_$Create$_0 = kotlin_kotlin.$_$.f;
42
+ var IllegalStateException_init_$Create$ = kotlin_kotlin.$_$.e1;
43
+ var Choice = kotlin_org_jetbrains_kotlinx_kotlinx_cli.$_$.e;
44
+ var multiple = kotlin_org_jetbrains_kotlinx_kotlinx_cli.$_$.g;
45
+ var Companion_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_cli.$_$.b;
46
+ var toList = kotlin_kotlin.$_$.z5;
47
+ var get_DEFAULT_PACKAGE_NAME = kotlin_community_flock_wirespec_compiler_core.$_$.a;
48
+ var toSet = kotlin_kotlin.$_$.b6;
49
+ var Enum = kotlin_kotlin.$_$.p9;
50
+ var protoOf = kotlin_kotlin.$_$.t7;
51
+ var classMeta = kotlin_kotlin.$_$.q6;
52
+ var setMetadataFor = kotlin_kotlin.$_$.u7;
53
+ var plus = kotlin_kotlin.$_$.p5;
54
+ var THROW_CCE = kotlin_kotlin.$_$.y9;
55
+ var isInterface = kotlin_kotlin.$_$.i7;
56
+ var objectMeta = kotlin_kotlin.$_$.s7;
57
+ var interfaceMeta = kotlin_kotlin.$_$.z6;
58
+ var Wirespec_getInstance = kotlin_community_flock_wirespec_compiler_core.$_$.a1;
59
+ var compile = kotlin_community_flock_wirespec_compiler_core.$_$.v;
60
+ var to = kotlin_kotlin.$_$.xa;
61
+ var noWhenBranchMatchedException = kotlin_kotlin.$_$.ta;
62
+ var Left = kotlin_io_arrow_kt_arrow_core.$_$.c;
63
+ var charSequenceLength = kotlin_kotlin.$_$.o6;
64
+ var charSequenceGet = kotlin_kotlin.$_$.n6;
65
+ var toString = kotlin_kotlin.$_$.l1;
66
+ var toString_0 = kotlin_kotlin.$_$.y7;
67
+ var first = kotlin_kotlin.$_$.v4;
68
+ var listOf = kotlin_kotlin.$_$.i5;
69
+ var Right = kotlin_io_arrow_kt_arrow_core.$_$.d;
70
+ var println = kotlin_kotlin.$_$.h6;
71
+ var OpenApiParser_getInstance = kotlin_community_flock_wirespec_openapi.$_$.a;
72
+ var OpenApiParser_getInstance_0 = kotlin_community_flock_wirespec_openapi.$_$.b;
73
+ var WirespecEmitter = kotlin_community_flock_wirespec_compiler_core.$_$.f;
74
+ var equals = kotlin_kotlin.$_$.s6;
75
+ var TypeScriptEmitter = kotlin_community_flock_wirespec_compiler_core.$_$.e;
76
+ var ScalaEmitter = kotlin_community_flock_wirespec_compiler_core.$_$.d;
77
+ var KotlinEmitter = kotlin_community_flock_wirespec_compiler_core.$_$.c;
78
+ var JavaEmitter = kotlin_community_flock_wirespec_compiler_core.$_$.b;
79
+ var equals_0 = kotlin_kotlin.$_$.o8;
80
+ var IllegalArgumentException_init_$Create$ = kotlin_kotlin.$_$.b1;
81
+ var Logger = kotlin_community_flock_wirespec_compiler_core.$_$.w;
82
+ var _Char___init__impl__6a9atx = kotlin_kotlin.$_$.i1;
83
+ var charArrayOf = kotlin_kotlin.$_$.l6;
84
+ var split = kotlin_kotlin.$_$.v8;
85
+ var joinToString = kotlin_kotlin.$_$.a5;
86
+ var split_0 = kotlin_kotlin.$_$.w8;
87
+ var last = kotlin_kotlin.$_$.f5;
88
+ var getStringHashCode = kotlin_kotlin.$_$.x6;
89
+ var endsWith = kotlin_kotlin.$_$.n8;
90
+ var dropLast = kotlin_kotlin.$_$.l8;
91
+ var iterator = kotlin_kotlin.$_$.m7;
92
+ var asSequence = kotlin_kotlin.$_$.h8;
93
+ var map = kotlin_kotlin.$_$.j8;
94
+ var filter = kotlin_kotlin.$_$.i8;
95
+ var toSet_0 = kotlin_kotlin.$_$.k8;
96
+ var Companion_getInstance_0 = kotlin_kotlin.$_$.d3;
97
+ var _Result___init__impl__xyqfz8 = kotlin_kotlin.$_$.m1;
98
+ var createFailure = kotlin_kotlin.$_$.ma;
99
+ var _Result___get_value__impl__bjfvqg = kotlin_kotlin.$_$.p1;
100
+ var isObject = kotlin_kotlin.$_$.k7;
101
+ var _Result___get_isFailure__impl__jpiriv = kotlin_kotlin.$_$.o1;
102
+ var isArray = kotlin_kotlin.$_$.a7;
103
+ //endregion
104
+ //region block: pre-declaration
105
+ setMetadataFor(Language, 'Language', interfaceMeta);
106
+ setMetadataFor(Jvm, 'Jvm', classMeta, Enum, [Enum, Language]);
107
+ setMetadataFor(Script, 'Script', classMeta, Enum, [Enum, Language]);
108
+ setMetadataFor(Companion, 'Companion', objectMeta);
109
+ setMetadataFor(OpenapiVersion, 'OpenapiVersion', classMeta, Enum);
110
+ setMetadataFor(cli$logger$1, VOID, classMeta, Logger);
111
+ setMetadataFor(Extension, 'Extension', classMeta, Enum);
112
+ setMetadataFor(Companion_0, 'Companion', objectMeta);
113
+ setMetadataFor(FullFilePath, 'FullFilePath', classMeta);
114
+ setMetadataFor(File, 'File', classMeta);
115
+ setMetadataFor(JavaFile, 'JavaFile', classMeta, File);
116
+ setMetadataFor(JsonFile, 'JsonFile', classMeta, File);
117
+ setMetadataFor(KotlinFile, 'KotlinFile', classMeta, File);
118
+ setMetadataFor(ScalaFile, 'ScalaFile', classMeta, File);
119
+ setMetadataFor(TypeScriptFile, 'TypeScriptFile', classMeta, File);
120
+ setMetadataFor(WirespecFile, 'WirespecFile', classMeta, File);
121
+ setMetadataFor(Directory, 'Directory', classMeta);
122
+ //endregion
123
+ function main(args) {
124
+ var tmp$ret$5;
125
+ // Inline function 'kotlin.let' call
126
+ var tmp$ret$4;
127
+ // Inline function 'kotlin.collections.toTypedArray' call
128
+ var tmp$ret$3;
129
+ // Inline function 'kotlin.collections.mapNotNull' call
130
+ var tmp1_mapNotNull = numberRangeToNumber(0, 20);
131
+ var tmp$ret$2;
132
+ // Inline function 'kotlin.collections.mapNotNullTo' call
133
+ var tmp0_mapNotNullTo = ArrayList_init_$Create$();
134
+ // Inline function 'kotlin.collections.forEach' call
135
+ var inductionVariable = tmp1_mapNotNull.y_1;
136
+ var last = tmp1_mapNotNull.z_1;
137
+ if (inductionVariable <= last)
138
+ do {
139
+ var element = inductionVariable;
140
+ inductionVariable = inductionVariable + 1 | 0;
141
+ // Inline function 'kotlin.collections.mapNotNullTo.<anonymous>' call
142
+ var tmp$ret$0;
143
+ // Inline function 'community.flock.wirespec.compiler.cli.main.<anonymous>' call
144
+ tmp$ret$0 = orNull(args, element);
145
+ var tmp0_safe_receiver = tmp$ret$0;
146
+ if (tmp0_safe_receiver == null)
147
+ null;
148
+ else {
149
+ var tmp$ret$1;
150
+ // Inline function 'kotlin.let' call
151
+ // Inline function 'kotlin.contracts.contract' call
152
+ tmp0_mapNotNullTo.a(tmp0_safe_receiver);
153
+ tmp$ret$1 = Unit_getInstance();
154
+ }
155
+ }
156
+ while (!(element === last));
157
+ tmp$ret$2 = tmp0_mapNotNullTo;
158
+ tmp$ret$3 = tmp$ret$2;
159
+ var tmp2_toTypedArray = tmp$ret$3;
160
+ tmp$ret$4 = copyToArray(tmp2_toTypedArray);
161
+ var tmp3_let = tmp$ret$4;
162
+ // Inline function 'kotlin.contracts.contract' call
163
+ cli(tmp3_let);
164
+ tmp$ret$5 = Unit_getInstance();
165
+ }
166
+ function cli(args) {
167
+ var parser = new ArgParser('wirespec');
168
+ var debug$delegate = default_0(parser.u1u(Boolean_getInstance(), VOID, 'd', 'Debug mode'), false).x1x(null, getLocalDelegateReference('debug', KProperty0, false, function () {
169
+ return THROW_ISE();
170
+ }));
171
+ var input$delegate = parser.w1u(String_getInstance(), VOID, 'Input file').x1x(null, getLocalDelegateReference('input', KProperty0, false, function () {
172
+ return THROW_ISE();
173
+ }));
174
+ var output$delegate = parser.u1u(String_getInstance(), VOID, 'o', 'Output directory').x1x(null, getLocalDelegateReference('output', KProperty0, false, function () {
175
+ return THROW_ISE();
176
+ }));
177
+ var tmp$ret$5;
178
+ // Inline function 'kotlin.collections.map' call
179
+ var tmp$ret$2;
180
+ // Inline function 'kotlin.collections.map' call
181
+ var tmp1_map = Companion_getInstance_1().d1y();
182
+ var tmp$ret$1;
183
+ // Inline function 'kotlin.collections.mapTo' call
184
+ var tmp0_mapTo = ArrayList_init_$Create$_0(collectionSizeOrDefault(tmp1_map, 10));
185
+ var tmp0_iterator = tmp1_map.c();
186
+ while (tmp0_iterator.d()) {
187
+ var item = tmp0_iterator.e();
188
+ var tmp$ret$0;
189
+ // Inline function 'community.flock.wirespec.compiler.cli.cli.<anonymous>' call
190
+ tmp$ret$0 = item.p4_1;
191
+ tmp0_mapTo.a(tmp$ret$0);
192
+ }
193
+ tmp$ret$1 = tmp0_mapTo;
194
+ tmp$ret$2 = tmp$ret$1;
195
+ var tmp3_map = tmp$ret$2;
196
+ var tmp$ret$4;
197
+ // Inline function 'kotlin.collections.mapTo' call
198
+ var tmp2_mapTo = ArrayList_init_$Create$_0(collectionSizeOrDefault(tmp3_map, 10));
199
+ var tmp0_iterator_0 = tmp3_map.c();
200
+ while (tmp0_iterator_0.d()) {
201
+ var item_0 = tmp0_iterator_0.e();
202
+ var tmp$ret$3;
203
+ // Inline function 'community.flock.wirespec.compiler.cli.cli.<anonymous>' call
204
+ var tmp0_elvis_lhs = Companion_getInstance_1().e1y(item_0);
205
+ var tmp;
206
+ if (tmp0_elvis_lhs == null) {
207
+ throw IllegalStateException_init_$Create$('Language not found');
208
+ } else {
209
+ tmp = tmp0_elvis_lhs;
210
+ }
211
+ tmp$ret$3 = tmp;
212
+ tmp2_mapTo.a(tmp$ret$3);
213
+ }
214
+ tmp$ret$4 = tmp2_mapTo;
215
+ tmp$ret$5 = tmp$ret$4;
216
+ var tmp_0 = tmp$ret$5;
217
+ var language$delegate = multiple(default_0(parser.u1u(new Choice(tmp_0, cli$lambda_5), VOID, 'l', 'Language type'), Jvm_Kotlin_getInstance())).x1x(null, getLocalDelegateReference('language', KProperty0, false, function () {
218
+ return THROW_ISE();
219
+ }));
220
+ var tmp$ret$7;
221
+ // Inline function 'kotlinx.cli.Companion.Choice' call
222
+ var tmp4_Choice = Companion_getInstance();
223
+ var tmp5_Choice = cli$lambda_6;
224
+ var tmp$ret$6;
225
+ // Inline function 'kotlin.enumValues' call
226
+ tmp$ret$6 = values_1();
227
+ var tmp_1 = toList(tmp$ret$6);
228
+ var tmp0_elvis_lhs_0 = null;
229
+ var tmp_2;
230
+ if (tmp0_elvis_lhs_0 == null) {
231
+ tmp_2 = cli$lambda_7(tmp5_Choice);
232
+ } else {
233
+ tmp_2 = tmp0_elvis_lhs_0;
234
+ }
235
+ tmp$ret$7 = new Choice(tmp_1, tmp_2, tmp5_Choice);
236
+ var openapi$delegate = parser.u1u(tmp$ret$7, VOID, 'a', 'Use openapi as input').x1x(null, getLocalDelegateReference('openapi', KProperty0, false, function () {
237
+ return THROW_ISE();
238
+ }));
239
+ var packageName$delegate = default_0(parser.u1u(String_getInstance(), VOID, 'p', 'Package name'), get_DEFAULT_PACKAGE_NAME()).x1x(null, getLocalDelegateReference('packageName', KProperty0, false, function () {
240
+ return THROW_ISE();
241
+ }));
242
+ parser.y1u(args);
243
+ var logger = new cli$logger$1(debug$delegate);
244
+ compile_0(toSet(cli$lambda_2(language$delegate)), cli$lambda_0(input$delegate), cli$lambda_1(output$delegate), cli$lambda_4(packageName$delegate), cli$lambda_3(openapi$delegate), logger);
245
+ }
246
+ var Jvm_Java_instance;
247
+ var Jvm_Kotlin_instance;
248
+ var Jvm_Scala_instance;
249
+ function values() {
250
+ return [Jvm_Java_getInstance(), Jvm_Kotlin_getInstance(), Jvm_Scala_getInstance()];
251
+ }
252
+ var Jvm_entriesInitialized;
253
+ function Jvm_initEntries() {
254
+ if (Jvm_entriesInitialized)
255
+ return Unit_getInstance();
256
+ Jvm_entriesInitialized = true;
257
+ Jvm_Java_instance = new Jvm('Java', 0);
258
+ Jvm_Kotlin_instance = new Jvm('Kotlin', 1);
259
+ Jvm_Scala_instance = new Jvm('Scala', 2);
260
+ }
261
+ var Script_TypeScript_instance;
262
+ var Script_Wirespec_instance;
263
+ function values_0() {
264
+ return [Script_TypeScript_getInstance(), Script_Wirespec_getInstance()];
265
+ }
266
+ var Script_entriesInitialized;
267
+ function Script_initEntries() {
268
+ if (Script_entriesInitialized)
269
+ return Unit_getInstance();
270
+ Script_entriesInitialized = true;
271
+ Script_TypeScript_instance = new Script('TypeScript', 0);
272
+ Script_Wirespec_instance = new Script('Wirespec', 1);
273
+ }
274
+ function Jvm(name, ordinal) {
275
+ Enum.call(this, name, ordinal);
276
+ }
277
+ function Script(name, ordinal) {
278
+ Enum.call(this, name, ordinal);
279
+ }
280
+ function Companion() {
281
+ Companion_instance = this;
282
+ }
283
+ protoOf(Companion).d1y = function () {
284
+ return plus(toList(values()), toList(values_0()));
285
+ };
286
+ protoOf(Companion).e1y = function (s) {
287
+ var tmp$ret$2;
288
+ // Inline function 'kotlin.collections.find' call
289
+ var tmp0_find = this.d1y();
290
+ var tmp$ret$1;
291
+ $l$block: {
292
+ // Inline function 'kotlin.collections.firstOrNull' call
293
+ var tmp0_iterator = tmp0_find.c();
294
+ while (tmp0_iterator.d()) {
295
+ var element = tmp0_iterator.e();
296
+ var tmp$ret$0;
297
+ // Inline function 'community.flock.wirespec.compiler.cli.Companion.valueOf.<anonymous>' call
298
+ tmp$ret$0 = element.p4_1 === s;
299
+ if (tmp$ret$0) {
300
+ tmp$ret$1 = element;
301
+ break $l$block;
302
+ }
303
+ }
304
+ tmp$ret$1 = null;
305
+ }
306
+ tmp$ret$2 = tmp$ret$1;
307
+ var tmp = tmp$ret$2;
308
+ return (tmp == null ? true : isInterface(tmp, Language)) ? tmp : THROW_CCE();
309
+ };
310
+ var Companion_instance;
311
+ function Companion_getInstance_1() {
312
+ if (Companion_instance == null)
313
+ new Companion();
314
+ return Companion_instance;
315
+ }
316
+ function Jvm_Java_getInstance() {
317
+ Jvm_initEntries();
318
+ return Jvm_Java_instance;
319
+ }
320
+ function Jvm_Kotlin_getInstance() {
321
+ Jvm_initEntries();
322
+ return Jvm_Kotlin_instance;
323
+ }
324
+ function Jvm_Scala_getInstance() {
325
+ Jvm_initEntries();
326
+ return Jvm_Scala_instance;
327
+ }
328
+ function Script_TypeScript_getInstance() {
329
+ Script_initEntries();
330
+ return Script_TypeScript_instance;
331
+ }
332
+ function Script_Wirespec_getInstance() {
333
+ Script_initEntries();
334
+ return Script_Wirespec_instance;
335
+ }
336
+ function Language() {
337
+ }
338
+ var OpenapiVersion_V2_instance;
339
+ var OpenapiVersion_V3_instance;
340
+ function values_1() {
341
+ return [OpenapiVersion_V2_getInstance(), OpenapiVersion_V3_getInstance()];
342
+ }
343
+ var OpenapiVersion_entriesInitialized;
344
+ function OpenapiVersion_initEntries() {
345
+ if (OpenapiVersion_entriesInitialized)
346
+ return Unit_getInstance();
347
+ OpenapiVersion_entriesInitialized = true;
348
+ OpenapiVersion_V2_instance = new OpenapiVersion('V2', 0);
349
+ OpenapiVersion_V3_instance = new OpenapiVersion('V3', 1);
350
+ }
351
+ function OpenapiVersion(name, ordinal) {
352
+ Enum.call(this, name, ordinal);
353
+ }
354
+ function compile_0(languages, input, output, packageName, openapi, logger) {
355
+ if (!(openapi == null)) {
356
+ var fullPath = Companion_getInstance_2().r1s(input);
357
+ var file = new JsonFile(fullPath);
358
+ var tmp0_subject = openapi;
359
+ var tmp0 = tmp0_subject.q4_1;
360
+ var tmp;
361
+ switch (tmp0) {
362
+ case 0:
363
+ tmp = OpenApiParser_getInstance().r1s(file.x14());
364
+ break;
365
+ case 1:
366
+ tmp = OpenApiParser_getInstance_0().r1s(file.x14());
367
+ break;
368
+ default:
369
+ noWhenBranchMatchedException();
370
+ break;
371
+ }
372
+ var ast = tmp;
373
+ var path = out(fullPath, packageName, output);
374
+ var tmp$ret$11;
375
+ // Inline function 'kotlin.collections.map' call
376
+ var tmp$ret$9;
377
+ // Inline function 'kotlin.collections.map' call
378
+ var tmp1_map = emit(languages, packageName, path, logger);
379
+ var tmp$ret$8;
380
+ // Inline function 'kotlin.collections.mapTo' call
381
+ var tmp0_mapTo = ArrayList_init_$Create$_0(collectionSizeOrDefault(tmp1_map, 10));
382
+ var tmp0_iterator = tmp1_map.c();
383
+ while (tmp0_iterator.d()) {
384
+ var item = tmp0_iterator.e();
385
+ var tmp$ret$7;
386
+ // Inline function 'community.flock.wirespec.compiler.cli.compile.<anonymous>' call
387
+ var emitter = item.i3();
388
+ var file_0 = item.j3();
389
+ var result = emitter.qh(ast);
390
+ var tmp_0;
391
+ if (!emitter.ph_1) {
392
+ var tmp$ret$6;
393
+ // Inline function 'kotlin.text.replaceFirstChar' call
394
+ var tmp0_replaceFirstChar = fullPath.j1y_1;
395
+ var tmp_1;
396
+ var tmp$ret$0;
397
+ // Inline function 'kotlin.text.isNotEmpty' call
398
+ tmp$ret$0 = charSequenceLength(tmp0_replaceFirstChar) > 0;
399
+ if (tmp$ret$0) {
400
+ var tmp$ret$3;
401
+ // Inline function 'kotlin.text.uppercase' call
402
+ var tmp3_uppercase = charSequenceGet(tmp0_replaceFirstChar, 0);
403
+ var tmp$ret$2;
404
+ // Inline function 'kotlin.js.unsafeCast' call
405
+ var tmp$ret$1;
406
+ // Inline function 'kotlin.js.asDynamic' call
407
+ var tmp1_asDynamic = toString(tmp3_uppercase);
408
+ tmp$ret$1 = tmp1_asDynamic;
409
+ var tmp2_unsafeCast = tmp$ret$1.toUpperCase();
410
+ tmp$ret$2 = tmp2_unsafeCast;
411
+ tmp$ret$3 = tmp$ret$2;
412
+ var tmp_2 = toString_0(tmp$ret$3);
413
+ var tmp$ret$5;
414
+ // Inline function 'kotlin.text.substring' call
415
+ var tmp$ret$4;
416
+ // Inline function 'kotlin.js.asDynamic' call
417
+ tmp$ret$4 = tmp0_replaceFirstChar;
418
+ tmp$ret$5 = tmp$ret$4.substring(1);
419
+ tmp_1 = tmp_2 + tmp$ret$5;
420
+ } else {
421
+ tmp_1 = tmp0_replaceFirstChar;
422
+ }
423
+ tmp$ret$6 = tmp_1;
424
+ tmp_0 = to(listOf(to(tmp$ret$6, first(result).h3_1)), file_0);
425
+ } else {
426
+ tmp_0 = to(result, file_0);
427
+ }
428
+ tmp$ret$7 = tmp_0;
429
+ tmp0_mapTo.a(tmp$ret$7);
430
+ }
431
+ tmp$ret$8 = tmp0_mapTo;
432
+ tmp$ret$9 = tmp$ret$8;
433
+ var tmp3_map = tmp$ret$9;
434
+ var tmp$ret$10;
435
+ // Inline function 'kotlin.collections.mapTo' call
436
+ var tmp2_mapTo = ArrayList_init_$Create$_0(collectionSizeOrDefault(tmp3_map, 10));
437
+ var tmp0_iterator_0 = tmp3_map.c();
438
+ while (tmp0_iterator_0.d()) {
439
+ var item_0 = tmp0_iterator_0.e();
440
+ var results = item_0.i3();
441
+ var file_1 = item_0.j3();
442
+ write(results, file_1);
443
+ tmp2_mapTo.a(Unit_getInstance());
444
+ }
445
+ tmp$ret$10 = tmp2_mapTo;
446
+ tmp$ret$11 = tmp$ret$10;
447
+ } else {
448
+ // Inline function 'kotlin.collections.forEach' call
449
+ var tmp4_forEach = (new Directory(input)).g1y();
450
+ var tmp0_iterator_1 = tmp4_forEach.c();
451
+ while (tmp0_iterator_1.d()) {
452
+ var element = tmp0_iterator_1.e();
453
+ // Inline function 'community.flock.wirespec.compiler.cli.compile.<anonymous>' call
454
+ var path_0 = out(element.h1y_1, packageName, output);
455
+ var tmp$ret$30;
456
+ // Inline function 'kotlin.collections.map' call
457
+ var tmp$ret$28;
458
+ // Inline function 'kotlin.let' call
459
+ var tmp$ret$12;
460
+ // Inline function 'kotlin.let' call
461
+ var tmp0_let = element.x14();
462
+ var tmp1_let = Wirespec_getInstance();
463
+ // Inline function 'kotlin.contracts.contract' call
464
+ tmp$ret$12 = compile(tmp1_let, tmp0_let);
465
+ var tmp2_let = tmp$ret$12(logger);
466
+ // Inline function 'kotlin.contracts.contract' call
467
+ var tmp$ret$27;
468
+ // Inline function 'community.flock.wirespec.compiler.cli.compile.<anonymous>.<anonymous>' call
469
+ var tmp$ret$26;
470
+ // Inline function 'kotlin.collections.map' call
471
+ var tmp1_map_0 = emit(languages, packageName, path_0, logger);
472
+ var tmp$ret$25;
473
+ // Inline function 'kotlin.collections.mapTo' call
474
+ var tmp0_mapTo_0 = ArrayList_init_$Create$_0(collectionSizeOrDefault(tmp1_map_0, 10));
475
+ var tmp0_iterator_2 = tmp1_map_0.c();
476
+ while (tmp0_iterator_2.d()) {
477
+ var item_1 = tmp0_iterator_2.e();
478
+ var tmp$ret$24;
479
+ // Inline function 'community.flock.wirespec.compiler.cli.compile.<anonymous>.<anonymous>.<anonymous>' call
480
+ var emitter_0 = item_1.i3();
481
+ var file_2 = item_1.j3();
482
+ var result_0 = tmp2_let(emitter_0);
483
+ var tmp_3;
484
+ if (!emitter_0.ph_1) {
485
+ var tmp$ret$23;
486
+ // Inline function 'arrow.core.Either.map' call
487
+ // Inline function 'kotlin.contracts.contract' call
488
+ var tmp$ret$22;
489
+ // Inline function 'arrow.core.flatMap' call
490
+ // Inline function 'kotlin.contracts.contract' call
491
+ var tmp0_subject_0 = result_0;
492
+ var tmp_4;
493
+ if (tmp0_subject_0 instanceof Right) {
494
+ var tmp$ret$21;
495
+ // Inline function 'arrow.core.Either.map.<anonymous>' call
496
+ var tmp0__anonymous__q1qw7t = result_0.og_1;
497
+ var tmp$ret$20;
498
+ // Inline function 'community.flock.wirespec.compiler.cli.compile.<anonymous>.<anonymous>.<anonymous>.<anonymous>' call
499
+ var tmp$ret$19;
500
+ // Inline function 'kotlin.text.replaceFirstChar' call
501
+ var tmp0_replaceFirstChar_0 = element.h1y_1.j1y_1;
502
+ var tmp_5;
503
+ var tmp$ret$13;
504
+ // Inline function 'kotlin.text.isNotEmpty' call
505
+ tmp$ret$13 = charSequenceLength(tmp0_replaceFirstChar_0) > 0;
506
+ if (tmp$ret$13) {
507
+ var tmp$ret$16;
508
+ // Inline function 'kotlin.text.uppercase' call
509
+ var tmp3_uppercase_0 = charSequenceGet(tmp0_replaceFirstChar_0, 0);
510
+ var tmp$ret$15;
511
+ // Inline function 'kotlin.js.unsafeCast' call
512
+ var tmp$ret$14;
513
+ // Inline function 'kotlin.js.asDynamic' call
514
+ var tmp1_asDynamic_0 = toString(tmp3_uppercase_0);
515
+ tmp$ret$14 = tmp1_asDynamic_0;
516
+ var tmp2_unsafeCast_0 = tmp$ret$14.toUpperCase();
517
+ tmp$ret$15 = tmp2_unsafeCast_0;
518
+ tmp$ret$16 = tmp$ret$15;
519
+ var tmp_6 = toString_0(tmp$ret$16);
520
+ var tmp$ret$18;
521
+ // Inline function 'kotlin.text.substring' call
522
+ var tmp$ret$17;
523
+ // Inline function 'kotlin.js.asDynamic' call
524
+ tmp$ret$17 = tmp0_replaceFirstChar_0;
525
+ tmp$ret$18 = tmp$ret$17.substring(1);
526
+ tmp_5 = tmp_6 + tmp$ret$18;
527
+ } else {
528
+ tmp_5 = tmp0_replaceFirstChar_0;
529
+ }
530
+ tmp$ret$19 = tmp_5;
531
+ tmp$ret$20 = listOf(to(tmp$ret$19, first(tmp0__anonymous__q1qw7t).h3_1));
532
+ tmp$ret$21 = new Right(tmp$ret$20);
533
+ tmp_4 = tmp$ret$21;
534
+ } else {
535
+ if (tmp0_subject_0 instanceof Left) {
536
+ tmp_4 = result_0;
537
+ } else {
538
+ noWhenBranchMatchedException();
539
+ }
540
+ }
541
+ tmp$ret$22 = tmp_4;
542
+ tmp$ret$23 = tmp$ret$22;
543
+ tmp_3 = to(tmp$ret$23, file_2);
544
+ } else {
545
+ tmp_3 = to(result_0, file_2);
546
+ }
547
+ tmp$ret$24 = tmp_3;
548
+ tmp0_mapTo_0.a(tmp$ret$24);
549
+ }
550
+ tmp$ret$25 = tmp0_mapTo_0;
551
+ tmp$ret$26 = tmp$ret$25;
552
+ tmp$ret$27 = tmp$ret$26;
553
+ tmp$ret$28 = tmp$ret$27;
554
+ var tmp4_map = tmp$ret$28;
555
+ var tmp$ret$29;
556
+ // Inline function 'kotlin.collections.mapTo' call
557
+ var tmp3_mapTo = ArrayList_init_$Create$_0(collectionSizeOrDefault(tmp4_map, 10));
558
+ var tmp0_iterator_3 = tmp4_map.c();
559
+ while (tmp0_iterator_3.d()) {
560
+ var item_2 = tmp0_iterator_3.e();
561
+ // Inline function 'community.flock.wirespec.compiler.cli.compile.<anonymous>.<anonymous>' call
562
+ var results_0 = item_2.i3();
563
+ var file_3 = item_2.j3();
564
+ var tmp0_subject_1 = results_0;
565
+ if (tmp0_subject_1 instanceof Right) {
566
+ write(results_0.og_1, file_3);
567
+ } else {
568
+ if (tmp0_subject_1 instanceof Left) {
569
+ println(results_0.jg_1);
570
+ }
571
+ }
572
+ tmp3_mapTo.a(Unit_getInstance());
573
+ }
574
+ tmp$ret$29 = tmp3_mapTo;
575
+ tmp$ret$30 = tmp$ret$29;
576
+ }
577
+ }
578
+ }
579
+ function out(_this__u8e3s4, packageName, output) {
580
+ return out$lambda(output, _this__u8e3s4, packageName);
581
+ }
582
+ function write(output, file) {
583
+ // Inline function 'kotlin.collections.forEach' call
584
+ var tmp0_iterator = output.c();
585
+ while (tmp0_iterator.d()) {
586
+ var element = tmp0_iterator.e();
587
+ // Inline function 'community.flock.wirespec.compiler.cli.write.<anonymous>' call
588
+ var name = element.i3();
589
+ var result = element.j3();
590
+ file.l1y(name).m1y(result);
591
+ }
592
+ }
593
+ function emit(languages, packageName, path, logger) {
594
+ var tmp$ret$2;
595
+ // Inline function 'kotlin.collections.map' call
596
+ var tmp$ret$1;
597
+ // Inline function 'kotlin.collections.mapTo' call
598
+ var tmp0_mapTo = ArrayList_init_$Create$_0(collectionSizeOrDefault(languages, 10));
599
+ var tmp0_iterator = languages.c();
600
+ while (tmp0_iterator.d()) {
601
+ var item = tmp0_iterator.e();
602
+ var tmp$ret$0;
603
+ // Inline function 'community.flock.wirespec.compiler.cli.emit.<anonymous>' call
604
+ var tmp0_subject = item;
605
+ var tmp;
606
+ if (equals(tmp0_subject, Jvm_Java_getInstance())) {
607
+ tmp = to(new JavaEmitter(packageName, logger), new JavaFile(path(Extension_Java_getInstance())));
608
+ } else if (equals(tmp0_subject, Jvm_Kotlin_getInstance())) {
609
+ tmp = to(new KotlinEmitter(packageName, logger), new KotlinFile(path(Extension_Kotlin_getInstance())));
610
+ } else if (equals(tmp0_subject, Jvm_Scala_getInstance())) {
611
+ tmp = to(new ScalaEmitter(packageName, logger), new ScalaFile(path(Extension_Scala_getInstance())));
612
+ } else if (equals(tmp0_subject, Script_TypeScript_getInstance())) {
613
+ tmp = to(new TypeScriptEmitter(logger), new TypeScriptFile(path(Extension_TypeScript_getInstance())));
614
+ } else if (equals(tmp0_subject, Script_Wirespec_getInstance())) {
615
+ tmp = to(new WirespecEmitter(logger), new WirespecFile(path(Extension_Wirespec_getInstance())));
616
+ } else {
617
+ noWhenBranchMatchedException();
618
+ }
619
+ tmp$ret$0 = tmp;
620
+ tmp0_mapTo.a(tmp$ret$0);
621
+ }
622
+ tmp$ret$1 = tmp0_mapTo;
623
+ tmp$ret$2 = tmp$ret$1;
624
+ return tmp$ret$2;
625
+ }
626
+ function cli$lambda($debug$delegate) {
627
+ return $debug$delegate.k1w(null, getLocalDelegateReference('debug', KProperty0, false, function () {
628
+ return THROW_ISE();
629
+ }));
630
+ }
631
+ function cli$lambda_0($input$delegate) {
632
+ return $input$delegate.k1w(null, getLocalDelegateReference('input', KProperty0, false, function () {
633
+ return THROW_ISE();
634
+ }));
635
+ }
636
+ function cli$lambda_1($output$delegate) {
637
+ return $output$delegate.k1w(null, getLocalDelegateReference('output', KProperty0, false, function () {
638
+ return THROW_ISE();
639
+ }));
640
+ }
641
+ function cli$lambda_2($language$delegate) {
642
+ return $language$delegate.k1w(null, getLocalDelegateReference('language', KProperty0, false, function () {
643
+ return THROW_ISE();
644
+ }));
645
+ }
646
+ function cli$lambda_3($openapi$delegate) {
647
+ return $openapi$delegate.k1w(null, getLocalDelegateReference('openapi', KProperty0, false, function () {
648
+ return THROW_ISE();
649
+ }));
650
+ }
651
+ function cli$lambda_4($packageName$delegate) {
652
+ return $packageName$delegate.k1w(null, getLocalDelegateReference('packageName', KProperty0, false, function () {
653
+ return THROW_ISE();
654
+ }));
655
+ }
656
+ function cli$lambda_5(it) {
657
+ var tmp0_elvis_lhs = Companion_getInstance_1().e1y(it);
658
+ var tmp;
659
+ if (tmp0_elvis_lhs == null) {
660
+ throw IllegalStateException_init_$Create$('Language not found');
661
+ } else {
662
+ tmp = tmp0_elvis_lhs;
663
+ }
664
+ return tmp;
665
+ }
666
+ function cli$lambda_6(it) {
667
+ var tmp$ret$1;
668
+ // Inline function 'kotlin.text.lowercase' call
669
+ var tmp0_lowercase = it.toString();
670
+ var tmp$ret$0;
671
+ // Inline function 'kotlin.js.asDynamic' call
672
+ tmp$ret$0 = tmp0_lowercase;
673
+ tmp$ret$1 = tmp$ret$0.toLowerCase();
674
+ return tmp$ret$1;
675
+ }
676
+ function cli$lambda_7($tmp5_Choice) {
677
+ return function (it) {
678
+ var tmp$ret$3;
679
+ // Inline function 'kotlin.collections.find' call
680
+ var tmp$ret$0;
681
+ // Inline function 'kotlin.enumValues' call
682
+ tmp$ret$0 = values_1();
683
+ var tmp0_find = tmp$ret$0;
684
+ var tmp$ret$2;
685
+ $l$block: {
686
+ // Inline function 'kotlin.collections.firstOrNull' call
687
+ var indexedObject = tmp0_find;
688
+ var inductionVariable = 0;
689
+ var last = indexedObject.length;
690
+ while (inductionVariable < last) {
691
+ var element = indexedObject[inductionVariable];
692
+ inductionVariable = inductionVariable + 1 | 0;
693
+ var tmp$ret$1;
694
+ // Inline function 'community.flock.wirespec.compiler.cli.cli.<anonymous>.<anonymous>' call
695
+ tmp$ret$1 = equals_0($tmp5_Choice(element), it, true);
696
+ if (tmp$ret$1) {
697
+ tmp$ret$2 = element;
698
+ break $l$block;
699
+ }
700
+ }
701
+ tmp$ret$2 = null;
702
+ }
703
+ tmp$ret$3 = tmp$ret$2;
704
+ var tmp0_elvis_lhs = tmp$ret$3;
705
+ var tmp;
706
+ if (tmp0_elvis_lhs == null) {
707
+ throw IllegalArgumentException_init_$Create$('No enum constant ' + it);
708
+ } else {
709
+ tmp = tmp0_elvis_lhs;
710
+ }
711
+ return tmp;
712
+ };
713
+ }
714
+ function cli$logger$1($debug$delegate) {
715
+ Logger.call(this, cli$lambda($debug$delegate));
716
+ }
717
+ function out$lambda($output, $this_out, $packageName) {
718
+ return function (extension) {
719
+ var tmp0_elvis_lhs = $output;
720
+ var tmp;
721
+ if (tmp0_elvis_lhs == null) {
722
+ var tmp$ret$1;
723
+ // Inline function 'kotlin.text.lowercase' call
724
+ var tmp0_lowercase = extension.p4_1;
725
+ var tmp$ret$0;
726
+ // Inline function 'kotlin.js.asDynamic' call
727
+ tmp$ret$0 = tmp0_lowercase;
728
+ tmp$ret$1 = tmp$ret$0.toLowerCase();
729
+ tmp = $this_out.i1y_1 + '/out/' + tmp$ret$1;
730
+ } else {
731
+ tmp = tmp0_elvis_lhs;
732
+ }
733
+ var dir = tmp;
734
+ return $this_out.n1y(dir + '/' + joinToString(split($packageName, charArrayOf([_Char___init__impl__6a9atx(46)])), '/'), VOID, extension);
735
+ };
736
+ }
737
+ function OpenapiVersion_V2_getInstance() {
738
+ OpenapiVersion_initEntries();
739
+ return OpenapiVersion_V2_instance;
740
+ }
741
+ function OpenapiVersion_V3_getInstance() {
742
+ OpenapiVersion_initEntries();
743
+ return OpenapiVersion_V3_instance;
744
+ }
745
+ var Extension_Java_instance;
746
+ var Extension_Kotlin_instance;
747
+ var Extension_Scala_instance;
748
+ var Extension_TypeScript_instance;
749
+ var Extension_Wirespec_instance;
750
+ var Extension_Json_instance;
751
+ function values_2() {
752
+ return [Extension_Java_getInstance(), Extension_Kotlin_getInstance(), Extension_Scala_getInstance(), Extension_TypeScript_getInstance(), Extension_Wirespec_getInstance(), Extension_Json_getInstance()];
753
+ }
754
+ var Extension_entriesInitialized;
755
+ function Extension_initEntries() {
756
+ if (Extension_entriesInitialized)
757
+ return Unit_getInstance();
758
+ Extension_entriesInitialized = true;
759
+ Extension_Java_instance = new Extension('Java', 0, 'java');
760
+ Extension_Kotlin_instance = new Extension('Kotlin', 1, 'kt');
761
+ Extension_Scala_instance = new Extension('Scala', 2, 'scala');
762
+ Extension_TypeScript_instance = new Extension('TypeScript', 3, 'ts');
763
+ Extension_Wirespec_instance = new Extension('Wirespec', 4, 'ws');
764
+ Extension_Json_instance = new Extension('Json', 5, 'json');
765
+ }
766
+ function Extension(name, ordinal, ext) {
767
+ Enum.call(this, name, ordinal);
768
+ this.q1y_1 = ext;
769
+ }
770
+ function Extension_Java_getInstance() {
771
+ Extension_initEntries();
772
+ return Extension_Java_instance;
773
+ }
774
+ function Extension_Kotlin_getInstance() {
775
+ Extension_initEntries();
776
+ return Extension_Kotlin_instance;
777
+ }
778
+ function Extension_Scala_getInstance() {
779
+ Extension_initEntries();
780
+ return Extension_Scala_instance;
781
+ }
782
+ function Extension_TypeScript_getInstance() {
783
+ Extension_initEntries();
784
+ return Extension_TypeScript_instance;
785
+ }
786
+ function Extension_Wirespec_getInstance() {
787
+ Extension_initEntries();
788
+ return Extension_Wirespec_instance;
789
+ }
790
+ function Extension_Json_getInstance() {
791
+ Extension_initEntries();
792
+ return Extension_Json_instance;
793
+ }
794
+ function Companion_0() {
795
+ Companion_instance_0 = this;
796
+ }
797
+ protoOf(Companion_0).r1s = function (input) {
798
+ var list = split_0(input, ['/', '.']);
799
+ var tmp$ret$6;
800
+ // Inline function 'kotlin.let' call
801
+ var tmp$ret$1;
802
+ // Inline function 'kotlin.text.lowercase' call
803
+ var tmp0_lowercase = last(list);
804
+ var tmp$ret$0;
805
+ // Inline function 'kotlin.js.asDynamic' call
806
+ tmp$ret$0 = tmp0_lowercase;
807
+ tmp$ret$1 = tmp$ret$0.toLowerCase();
808
+ var tmp1_let = tmp$ret$1;
809
+ // Inline function 'kotlin.contracts.contract' call
810
+ var tmp$ret$5;
811
+ // Inline function 'community.flock.wirespec.compiler.cli.io.Companion.parse.<anonymous>' call
812
+ var tmp$ret$4;
813
+ // Inline function 'kotlin.collections.find' call
814
+ var tmp0_find = values_2();
815
+ var tmp$ret$3;
816
+ $l$block: {
817
+ // Inline function 'kotlin.collections.firstOrNull' call
818
+ var indexedObject = tmp0_find;
819
+ var inductionVariable = 0;
820
+ var last_0 = indexedObject.length;
821
+ while (inductionVariable < last_0) {
822
+ var element = indexedObject[inductionVariable];
823
+ inductionVariable = inductionVariable + 1 | 0;
824
+ var tmp$ret$2;
825
+ // Inline function 'community.flock.wirespec.compiler.cli.io.Companion.parse.<anonymous>.<anonymous>' call
826
+ tmp$ret$2 = element.q1y_1 === tmp1_let;
827
+ if (tmp$ret$2) {
828
+ tmp$ret$3 = element;
829
+ break $l$block;
830
+ }
831
+ }
832
+ tmp$ret$3 = null;
833
+ }
834
+ tmp$ret$4 = tmp$ret$3;
835
+ tmp$ret$5 = tmp$ret$4;
836
+ tmp$ret$6 = tmp$ret$5;
837
+ var tmp0_elvis_lhs = tmp$ret$6;
838
+ var tmp;
839
+ if (tmp0_elvis_lhs == null) {
840
+ throw IllegalStateException_init_$Create$('Invalid file extension');
841
+ } else {
842
+ tmp = tmp0_elvis_lhs;
843
+ }
844
+ var extension = tmp;
845
+ var filename = list.h(list.f() - 2 | 0);
846
+ var path = joinToString(list.s(0, list.f() - 2 | 0), '/');
847
+ return new FullFilePath(path, filename, extension);
848
+ };
849
+ var Companion_instance_0;
850
+ function Companion_getInstance_2() {
851
+ if (Companion_instance_0 == null)
852
+ new Companion_0();
853
+ return Companion_instance_0;
854
+ }
855
+ function FullFilePath(directory, fileName, extension) {
856
+ Companion_getInstance_2();
857
+ extension = extension === VOID ? Extension_Wirespec_getInstance() : extension;
858
+ this.i1y_1 = directory;
859
+ this.j1y_1 = fileName;
860
+ this.k1y_1 = extension;
861
+ }
862
+ protoOf(FullFilePath).toString = function () {
863
+ return this.i1y_1 + '/' + this.j1y_1 + '.' + this.k1y_1.q1y_1;
864
+ };
865
+ protoOf(FullFilePath).r1y = function (directory, fileName, extension) {
866
+ return new FullFilePath(directory, fileName, extension);
867
+ };
868
+ protoOf(FullFilePath).n1y = function (directory, fileName, extension, $super) {
869
+ directory = directory === VOID ? this.i1y_1 : directory;
870
+ fileName = fileName === VOID ? this.j1y_1 : fileName;
871
+ extension = extension === VOID ? this.k1y_1 : extension;
872
+ return $super === VOID ? this.r1y(directory, fileName, extension) : $super.r1y.call(this, directory, fileName, extension);
873
+ };
874
+ protoOf(FullFilePath).hashCode = function () {
875
+ var result = getStringHashCode(this.i1y_1);
876
+ result = imul(result, 31) + getStringHashCode(this.j1y_1) | 0;
877
+ result = imul(result, 31) + this.k1y_1.hashCode() | 0;
878
+ return result;
879
+ };
880
+ protoOf(FullFilePath).equals = function (other) {
881
+ if (this === other)
882
+ return true;
883
+ if (!(other instanceof FullFilePath))
884
+ return false;
885
+ var tmp0_other_with_cast = other instanceof FullFilePath ? other : THROW_CCE();
886
+ if (!(this.i1y_1 === tmp0_other_with_cast.i1y_1))
887
+ return false;
888
+ if (!(this.j1y_1 === tmp0_other_with_cast.j1y_1))
889
+ return false;
890
+ if (!this.k1y_1.equals(tmp0_other_with_cast.k1y_1))
891
+ return false;
892
+ return true;
893
+ };
894
+ function JavaFile(path) {
895
+ File.call(this, path.n1y(VOID, VOID, Extension_Java_getInstance()));
896
+ }
897
+ protoOf(JavaFile).l1y = function (fileName) {
898
+ return new JavaFile(this.h1y_1.n1y(VOID, fileName));
899
+ };
900
+ function JsonFile(path) {
901
+ File.call(this, path.n1y(VOID, VOID, Extension_Json_getInstance()));
902
+ }
903
+ protoOf(JsonFile).l1y = function (fileName) {
904
+ return new JsonFile(this.h1y_1.n1y(VOID, fileName));
905
+ };
906
+ function KotlinFile(path) {
907
+ File.call(this, path.n1y(VOID, VOID, Extension_Kotlin_getInstance()));
908
+ }
909
+ protoOf(KotlinFile).l1y = function (fileName) {
910
+ return new KotlinFile(this.h1y_1.n1y(VOID, fileName));
911
+ };
912
+ function ScalaFile(path) {
913
+ File.call(this, path.n1y(VOID, VOID, Extension_Scala_getInstance()));
914
+ }
915
+ protoOf(ScalaFile).l1y = function (fileName) {
916
+ return new ScalaFile(this.h1y_1.n1y(VOID, fileName));
917
+ };
918
+ function TypeScriptFile(path) {
919
+ File.call(this, path.n1y(VOID, VOID, Extension_TypeScript_getInstance()));
920
+ }
921
+ protoOf(TypeScriptFile).l1y = function (fileName) {
922
+ return new TypeScriptFile(this.h1y_1.n1y(VOID, fileName));
923
+ };
924
+ function WirespecFile(path) {
925
+ File.call(this, path.n1y(VOID, VOID, Extension_Wirespec_getInstance()));
926
+ }
927
+ protoOf(WirespecFile).l1y = function (fileName) {
928
+ return new WirespecFile(this.h1y_1.n1y(VOID, fileName));
929
+ };
930
+ function Directory$wirespecFiles$lambda(it) {
931
+ var tmp$ret$0;
932
+ // Inline function 'kotlin.js.unsafeCast' call
933
+ tmp$ret$0 = it;
934
+ return tmp$ret$0;
935
+ }
936
+ function Directory$wirespecFiles$lambda_0(it) {
937
+ return endsWith(it, Extension_Wirespec_getInstance().q1y_1);
938
+ }
939
+ function Directory$wirespecFiles$lambda_1(it) {
940
+ return dropLast(it, Extension_Wirespec_getInstance().q1y_1.length + 1 | 0);
941
+ }
942
+ function Directory$wirespecFiles$lambda_2(this$0) {
943
+ return function (it) {
944
+ return new FullFilePath(this$0.f1y_1, it);
945
+ };
946
+ }
947
+ function WirespecFile$_init_$ref_cj1n5j() {
948
+ var l = function (p0) {
949
+ return new WirespecFile(p0);
950
+ };
951
+ l.callableName = '<init>';
952
+ return l;
953
+ }
954
+ function Directory(path) {
955
+ this.f1y_1 = path;
956
+ }
957
+ protoOf(Directory).g1y = function () {
958
+ var tmp = asSequence(iterator(get_fs().readdirSync(this.f1y_1, 'utf-8')));
959
+ var tmp_0 = map(tmp, Directory$wirespecFiles$lambda);
960
+ var tmp_1 = filter(tmp_0, Directory$wirespecFiles$lambda_0);
961
+ var tmp_2 = map(tmp_1, Directory$wirespecFiles$lambda_1);
962
+ var tmp_3 = map(tmp_2, Directory$wirespecFiles$lambda_2(this));
963
+ return toSet_0(map(tmp_3, WirespecFile$_init_$ref_cj1n5j()));
964
+ };
965
+ function File(path) {
966
+ this.h1y_1 = path;
967
+ }
968
+ protoOf(File).x14 = function () {
969
+ var tmp$ret$0;
970
+ // Inline function 'kotlin.js.unsafeCast' call
971
+ var tmp0_unsafeCast = get_fs().readFileSync(this.h1y_1.toString(), 'utf-8');
972
+ tmp$ret$0 = tmp0_unsafeCast;
973
+ return tmp$ret$0;
974
+ };
975
+ protoOf(File).m1y = function (text) {
976
+ var tmp$ret$2;
977
+ // Inline function 'kotlin.run' call
978
+ var tmp0_run = this.h1y_1.n1y(joinToString(split_0(this.h1y_1.i1y_1, ['out']), 'out/node'));
979
+ // Inline function 'kotlin.contracts.contract' call
980
+ var tmp$ret$1;
981
+ // Inline function 'community.flock.wirespec.compiler.cli.io.File.write.<anonymous>' call
982
+ var tmp$ret$0;
983
+ // Inline function 'kotlin.js.unsafeCast' call
984
+ var tmp0_unsafeCast = get_fs().existsSync(tmp0_run.i1y_1);
985
+ tmp$ret$0 = tmp0_unsafeCast;
986
+ if (!tmp$ret$0) {
987
+ get_fs().mkdirSync(tmp0_run.i1y_1, {recursive: true});
988
+ }
989
+ tmp$ret$1 = get_fs().writeFileSync(tmp0_run.toString(), text);
990
+ tmp$ret$2 = tmp$ret$1;
991
+ };
992
+ function get_fs() {
993
+ _init_properties_JavaScriptBindings_kt__clolet();
994
+ return fs;
995
+ }
996
+ var fs;
997
+ var properties_initialized_JavaScriptBindings_kt_6og6hv;
998
+ function _init_properties_JavaScriptBindings_kt__clolet() {
999
+ if (properties_initialized_JavaScriptBindings_kt_6og6hv) {
1000
+ } else {
1001
+ properties_initialized_JavaScriptBindings_kt_6og6hv = true;
1002
+ fs = require('fs');
1003
+ }
1004
+ }
1005
+ function get_nodeArgs() {
1006
+ _init_properties_CommandLineArguments_kt__b5v7hl();
1007
+ return nodeArgs;
1008
+ }
1009
+ var nodeArgs;
1010
+ function orNull(_this__u8e3s4, idx) {
1011
+ _init_properties_CommandLineArguments_kt__b5v7hl();
1012
+ var tmp$ret$4;
1013
+ // Inline function 'kotlin.Result.getOrNull' call
1014
+ var tmp$ret$3;
1015
+ // Inline function 'kotlin.runCatching' call
1016
+ var tmp;
1017
+ try {
1018
+ var tmp$ret$1;
1019
+ // Inline function 'kotlin.Companion.success' call
1020
+ var tmp0_success = Companion_getInstance_0();
1021
+ var tmp$ret$0;
1022
+ // Inline function 'community.flock.wirespec.compiler.utils.orNull.<anonymous>' call
1023
+ tmp$ret$0 = get_nodeArgs()[idx];
1024
+ var tmp1_success = tmp$ret$0;
1025
+ tmp$ret$1 = _Result___init__impl__xyqfz8(tmp1_success);
1026
+ tmp = tmp$ret$1;
1027
+ } catch ($p) {
1028
+ var tmp_0;
1029
+ if ($p instanceof Error) {
1030
+ var e = $p;
1031
+ var tmp$ret$2;
1032
+ // Inline function 'kotlin.Companion.failure' call
1033
+ var tmp2_failure = Companion_getInstance_0();
1034
+ tmp$ret$2 = _Result___init__impl__xyqfz8(createFailure(e));
1035
+ tmp_0 = tmp$ret$2;
1036
+ } else {
1037
+ throw $p;
1038
+ }
1039
+ tmp = tmp_0;
1040
+ }
1041
+ tmp$ret$3 = tmp;
1042
+ var tmp3_getOrNull = tmp$ret$3;
1043
+ var tmp_1;
1044
+ if (_Result___get_isFailure__impl__jpiriv(tmp3_getOrNull)) {
1045
+ tmp_1 = null;
1046
+ } else {
1047
+ var tmp_2 = _Result___get_value__impl__bjfvqg(tmp3_getOrNull);
1048
+ tmp_1 = (tmp_2 == null ? true : isObject(tmp_2)) ? tmp_2 : THROW_CCE();
1049
+ }
1050
+ tmp$ret$4 = tmp_1;
1051
+ return tmp$ret$4;
1052
+ }
1053
+ var properties_initialized_CommandLineArguments_kt_ekn5uh;
1054
+ function _init_properties_CommandLineArguments_kt__b5v7hl() {
1055
+ if (properties_initialized_CommandLineArguments_kt_ekn5uh) {
1056
+ } else {
1057
+ properties_initialized_CommandLineArguments_kt_ekn5uh = true;
1058
+ var tmp = process.argv.slice(2);
1059
+ nodeArgs = (!(tmp == null) ? isArray(tmp) : false) ? tmp : THROW_CCE();
1060
+ }
1061
+ }
1062
+ //region block: exports
1063
+ _.$_$ = _.$_$ || {};
1064
+ _.$_$.a = main;
1065
+ //endregion
1066
+ return _;
1067
+ }));
1068
+
1069
+ //# sourceMappingURL=wirespec-cli.js.map