@flock/wirespec 0.17.20 → 0.18.1-RC.2

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 (87) hide show
  1. package/arrow-arrow-annotations.mjs.map +1 -1
  2. package/arrow-arrow-atomic.mjs +13 -13
  3. package/arrow-arrow-atomic.mjs.map +1 -1
  4. package/arrow-arrow-core.mjs +588 -431
  5. package/arrow-arrow-core.mjs.map +1 -1
  6. package/arrow-arrow-exception-utils.mjs +30 -0
  7. package/arrow-arrow-exception-utils.mjs.map +1 -0
  8. package/clikt-clikt-mordant.mjs +318 -0
  9. package/clikt-clikt-mordant.mjs.map +1 -0
  10. package/clikt-clikt.mjs +3834 -3696
  11. package/clikt-clikt.mjs.map +1 -1
  12. package/colormath-root-colormath.mjs +619 -682
  13. package/colormath-root-colormath.mjs.map +1 -1
  14. package/kotlin-js-core.mjs +4 -0
  15. package/kotlin-js-core.mjs.map +1 -0
  16. package/kotlin-js.mjs +4 -0
  17. package/kotlin-js.mjs.map +1 -0
  18. package/kotlin-kotlin-stdlib.mjs +6284 -5825
  19. package/kotlin-kotlin-stdlib.mjs.map +1 -1
  20. package/kotlin-openapi-bindings.mjs +8163 -8198
  21. package/kotlin-openapi-bindings.mjs.map +1 -1
  22. package/kotlin-plugins-js-plain-objects-runtime.mjs +4 -0
  23. package/kotlin-plugins-js-plain-objects-runtime.mjs.map +1 -0
  24. package/kotlin-rgxgen.mjs +2007 -2062
  25. package/kotlin-rgxgen.mjs.map +1 -1
  26. package/kotlin_org_jetbrains_kotlin_kotlin_dom_api_compat.mjs.map +1 -1
  27. package/kotlinx-atomicfu.mjs +4 -0
  28. package/kotlinx-atomicfu.mjs.map +1 -0
  29. package/kotlinx-coroutines-core.mjs +4 -0
  30. package/kotlinx-coroutines-core.mjs.map +1 -0
  31. package/kotlinx-io-kotlinx-io-bytestring.mjs.map +1 -1
  32. package/kotlinx-io-kotlinx-io-core.mjs +803 -839
  33. package/kotlinx-io-kotlinx-io-core.mjs.map +1 -1
  34. package/kotlinx-serialization-kotlinx-serialization-core.mjs +2483 -2553
  35. package/kotlinx-serialization-kotlinx-serialization-core.mjs.map +1 -1
  36. package/kotlinx-serialization-kotlinx-serialization-json.mjs +1861 -1928
  37. package/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -1
  38. package/mordant-mordant-omnibus.mjs +4 -0
  39. package/mordant-mordant-omnibus.mjs.map +1 -0
  40. package/mordant-mordant.mjs +2525 -4426
  41. package/mordant-mordant.mjs.map +1 -1
  42. package/package.json +4 -7
  43. package/seskar-core.mjs +4 -0
  44. package/seskar-core.mjs.map +1 -0
  45. package/wirespec-bin.mjs +13 -1
  46. package/wirespec-fetch.d.ts +4 -1
  47. package/wirespec-fetch.mjs +34 -0
  48. package/wirespec-serialization.d.ts +13 -2
  49. package/wirespec-serialization.mjs +22 -1
  50. package/wirespec-src-compiler-core.mjs +2857 -3909
  51. package/wirespec-src-compiler-core.mjs.map +1 -1
  52. package/wirespec-src-compiler-emitters-java.mjs +1370 -413
  53. package/wirespec-src-compiler-emitters-java.mjs.map +1 -1
  54. package/wirespec-src-compiler-emitters-kotlin.mjs +1015 -337
  55. package/wirespec-src-compiler-emitters-kotlin.mjs.map +1 -1
  56. package/wirespec-src-compiler-emitters-python.mjs +1465 -387
  57. package/wirespec-src-compiler-emitters-python.mjs.map +1 -1
  58. package/wirespec-src-compiler-emitters-rust.mjs +2461 -0
  59. package/wirespec-src-compiler-emitters-rust.mjs.map +1 -0
  60. package/wirespec-src-compiler-emitters-scala.mjs +1010 -0
  61. package/wirespec-src-compiler-emitters-scala.mjs.map +1 -0
  62. package/wirespec-src-compiler-emitters-typescript.mjs +1533 -450
  63. package/wirespec-src-compiler-emitters-typescript.mjs.map +1 -1
  64. package/wirespec-src-compiler-emitters-wirespec.mjs +122 -144
  65. package/wirespec-src-compiler-emitters-wirespec.mjs.map +1 -1
  66. package/wirespec-src-compiler-ir.mjs +17369 -0
  67. package/wirespec-src-compiler-ir.mjs.map +1 -0
  68. package/wirespec-src-compiler-lib.mjs +662 -728
  69. package/wirespec-src-compiler-lib.mjs.map +1 -1
  70. package/wirespec-src-converter-avro.mjs +630 -656
  71. package/wirespec-src-converter-avro.mjs.map +1 -1
  72. package/wirespec-src-converter-common.mjs.map +1 -1
  73. package/wirespec-src-converter-openapi.mjs +1705 -2024
  74. package/wirespec-src-converter-openapi.mjs.map +1 -1
  75. package/wirespec-src-plugin-arguments.mjs +418 -459
  76. package/wirespec-src-plugin-arguments.mjs.map +1 -1
  77. package/wirespec-src-plugin-cli.mjs +367 -331
  78. package/wirespec-src-plugin-cli.mjs.map +1 -1
  79. package/{wirespec-src-plugin-npm.d.ts → wirespec-src-plugin-npm.d.mts} +247 -0
  80. package/wirespec-src-plugin-npm.mjs +166 -359
  81. package/wirespec-src-plugin-npm.mjs.map +1 -1
  82. package/wirespec-src-tools-generator.mjs +79 -106
  83. package/wirespec-src-tools-generator.mjs.map +1 -1
  84. package/arrow-arrow-continuations.mjs +0 -18
  85. package/arrow-arrow-continuations.mjs.map +0 -1
  86. package/markdown.mjs +0 -6756
  87. package/markdown.mjs.map +0 -1
@@ -0,0 +1,1010 @@
1
+ import {
2
+ ArrayList_init_$Create$1jemgvhi5v0js as ArrayList_init_$Create$,
3
+ Unit_instance28fytmsmm6r23 as Unit_instance,
4
+ Paire9pteg33gng7 as Pair,
5
+ plus20p0vtfmu0596 as plus,
6
+ plus310ted5e4i90h as plus_0,
7
+ VOID3gxj6tk5isa35 as VOID,
8
+ setOf45ia9pnfhe90 as setOf,
9
+ listOfvhqybd2zx248 as listOf,
10
+ collectionSizeOrDefault36dulx8yinfqm as collectionSizeOrDefault,
11
+ ArrayList_init_$Create$3ivpeip4ouddx as ArrayList_init_$Create$_0,
12
+ listOf1jh22dvmctj1r as listOf_0,
13
+ addAll1k27qatfgp3k5 as addAll,
14
+ emptyList1g2z5xcrvp2zy as emptyList,
15
+ KProperty1ca4yb4wlo496 as KProperty1,
16
+ getPropertyCallableRef3hckxc0xueiaj as getPropertyCallableRef,
17
+ split2bvyvnrlcifjv as split,
18
+ checkIndexOverflow3frtmheghr0th as checkIndexOverflow,
19
+ joinToString1cxrrlmo0chqs as joinToString,
20
+ StringBuilder_init_$Create$322n630qt3r8c as StringBuilder_init_$Create$,
21
+ charSequenceLength3278n89t01tmv as charSequenceLength,
22
+ charSequenceGet1vxk1y5n17t1z as charSequenceGet,
23
+ isLetterOrDigit2kuxd9e198haf as isLetterOrDigit,
24
+ _Char___init__impl__6a9atx1csff5kwtduxl as _Char___init__impl__6a9atx,
25
+ firstOrNulltrxqttxfxqju as firstOrNull,
26
+ isDigit3mimrri4wkzop as isDigit,
27
+ Char19o2r8palgjof as Char,
28
+ HashSet_init_$Create$33p49hmosnvr4 as HashSet_init_$Create$,
29
+ THROW_CCE2g6jy02ryeudk as THROW_CCE,
30
+ isInterface3d6p8outrmvmk as isInterface,
31
+ singleo93pzdgfc557 as single,
32
+ trimMarginhyd3fsmh8iev as trimMargin,
33
+ protoOf180f3jzyo7rfj as protoOf,
34
+ initMetadataForCompanion1wyw17z38v6ac as initMetadataForCompanion,
35
+ to2cs3ny02qtbcb as to,
36
+ toMap1vec9topfei08 as toMap,
37
+ initMetadataForClassbxx6q50dy2s7 as initMetadataForClass,
38
+ endsWith3cq61xxngobwh as endsWith,
39
+ noWhenBranchMatchedException2a6r7ubxgky5j as noWhenBranchMatchedException,
40
+ lazy2hsh8ze7j6ikd as lazy,
41
+ firstOrNull1982767dljvdy as firstOrNull_0,
42
+ ensureNotNull1e947j3ixpazm as ensureNotNull,
43
+ } from './kotlin-kotlin-stdlib.mjs';
44
+ import {
45
+ Package2tniq694j1763 as Package,
46
+ import5uhkz67bd8tt as import_0,
47
+ File3dimy4iqmuock as File,
48
+ transformChildrend9p91tpcqdkx as transformChildren,
49
+ Interface3pn84xq686t2r as Interface,
50
+ Namespace345pal554qu3j as Namespace,
51
+ Custom2si7lto3wompr as Custom,
52
+ Companion_getInstance3gvtuyxc9uhxj as Companion_getInstance,
53
+ withElements2toq84v08e72 as withElements,
54
+ TransformScopeyrd3lf4zrk76 as TransformScope,
55
+ TransformerBuildera6a1gvlhjj9b as TransformerBuilder,
56
+ transform3eti8i2bqvifx as transform,
57
+ Elementitq62jg6fid3 as Element,
58
+ Struct39wf79cwtn4ty as Struct,
59
+ rawttvqxl50flj9 as raw,
60
+ Nameoqr8dt2fim9d as Name,
61
+ transformChildren2mszeagj5nq4c as transformChildren_0,
62
+ sanitizeFieldName1ptgy1kxy8u2m as sanitizeFieldName,
63
+ ConstructorStatement1x4n4sr59iy4n as ConstructorStatement,
64
+ FunctionCall30872kpnbr7op as FunctionCall,
65
+ SanitizationConfig11mmn3p2c03c1 as SanitizationConfig,
66
+ convertClientServer3s89ijty7q130 as convertClientServer,
67
+ convert13xvfhgrf57n5 as convert,
68
+ generateScala1gu01ibz2u66l as generateScala,
69
+ RawElement2yts1x2rbem1g as RawElement,
70
+ Constructor3io4sluuia3gk as Constructor,
71
+ withLabelField33ehya4zusm70 as withLabelField,
72
+ Enumlszg09mwd24f as Enum,
73
+ transformChildren3n5cjwmxlhwx9 as transformChildren_1,
74
+ FieldCall1iz7z2fx2xo4p as FieldCall,
75
+ TypeParameter1x56bawg1pg87 as TypeParameter,
76
+ Function21cuq8qizkin7 as Function,
77
+ ScalaGenerator_instance3rrk4wjh7ybct as ScalaGenerator_instance,
78
+ emit3bzdcd0f6nwtj as emit,
79
+ withSharedSource1qgrajaccojj3 as withSharedSource,
80
+ emitn3eihixilqyh as emit_0,
81
+ prependImports32gcj3yb8voha as prependImports,
82
+ placeInPackage1ffljbk9me4ug as placeInPackage,
83
+ convertWithValidation3ar3nbcqsbkpn as convertWithValidation,
84
+ sanitizeNames2wqmyf8vafp9x as sanitizeNames,
85
+ convert11ert2po54h1y as convert_0,
86
+ convert37aabdzvtv9vg as convert_1,
87
+ convert17zcptkz4mhr4 as convert_2,
88
+ convert32tuiui3czihh as convert_3,
89
+ flattenNestedStructs3rzqu1ggdb6h2 as flattenNestedStructs,
90
+ convert1cn4bolzoed8c as convert_4,
91
+ emitEndpointClient1meajc90wf3el as emitEndpointClient,
92
+ emitClient32kfwzg2hm5vj as emitClient,
93
+ emit1oxjujel6f3jb as emit_1,
94
+ IrEmitterh2m93ojzvkep as IrEmitter,
95
+ } from './wirespec-src-compiler-ir.mjs';
96
+ import {
97
+ Companion_instancebcq57hoyp8c2 as Companion_instance,
98
+ FieldIdentifier34k7iphndcnl0 as FieldIdentifier,
99
+ addBackticks1di5q03fw4yhx as addBackticks,
100
+ importReferencesy4xv7r53sjjs as importReferences,
101
+ Shared1uygqfbd22ukz as Shared,
102
+ Companion_instance1a2xqc448tlhh as Companion_instance_0,
103
+ Paramvfwnys2w6aj1 as Param,
104
+ Literal331hu9r04vptz as Literal,
105
+ Companion_instance2ryk3262e300f as Companion_instance_1,
106
+ FileExtension_Scala_getInstancedd4dbv51x4if as FileExtension_Scala_getInstance,
107
+ plus14o24vdaiongg as plus_1,
108
+ } from './wirespec-src-compiler-core.mjs';
109
+ //region block: imports
110
+ //endregion
111
+ //region block: pre-declaration
112
+ initMetadataForCompanion(Companion);
113
+ initMetadataForClass(ScalaIrEmitter$shared$1);
114
+ initMetadataForClass(ScalaIrEmitter, 'ScalaIrEmitter', ScalaIrEmitter, VOID, [IrEmitter]);
115
+ //endregion
116
+ function ScalaIrEmitter$shared$o$source$lambda(element, transformer) {
117
+ var tmp;
118
+ if (element instanceof File) {
119
+ // Inline function 'kotlin.collections.partition' call
120
+ var this_0 = element.u1m_1;
121
+ var first = ArrayList_init_$Create$();
122
+ var second = ArrayList_init_$Create$();
123
+ var _iterator__ex2g4s = this_0.t();
124
+ while (_iterator__ex2g4s.u()) {
125
+ var element_0 = _iterator__ex2g4s.v();
126
+ if (element_0 instanceof Package) {
127
+ first.x(element_0);
128
+ } else {
129
+ second.x(element_0);
130
+ }
131
+ }
132
+ var _destruct__k2r9zo = new Pair(first, second);
133
+ var packageElements = _destruct__k2r9zo.ne();
134
+ var rest = _destruct__k2r9zo.oe();
135
+ tmp = element.x1m(VOID, plus_0(plus(packageElements, import_0('scala.reflect', 'ClassTag')), rest));
136
+ } else {
137
+ tmp = element;
138
+ }
139
+ var transformed = tmp;
140
+ return transformChildren(transformed, transformer);
141
+ }
142
+ function ScalaIrEmitter$shared$o$source$lambda_0(element, transformer) {
143
+ var tmp;
144
+ if (element instanceof Namespace) {
145
+ var tmp_0;
146
+ if (element.z1m_1.equals(Companion_getInstance().m1h('Wirespec'))) {
147
+ // Inline function 'kotlin.collections.flatMap' call
148
+ var tmp0 = element.a1n_1;
149
+ // Inline function 'kotlin.collections.flatMapTo' call
150
+ var destination = ArrayList_init_$Create$();
151
+ var _iterator__ex2g4s = tmp0.t();
152
+ while (_iterator__ex2g4s.u()) {
153
+ var element_0 = _iterator__ex2g4s.v();
154
+ var tmp_1;
155
+ var tmp_2;
156
+ if (element_0 instanceof Interface) {
157
+ tmp_2 = setOf(['Request', 'Response']).u1(element_0.m1o_1.x1l());
158
+ } else {
159
+ tmp_2 = false;
160
+ }
161
+ if (tmp_2) {
162
+ // Inline function 'kotlin.collections.filterIsInstance' call
163
+ var tmp0_0 = element_0.n1o_1;
164
+ // Inline function 'kotlin.collections.filterIsInstanceTo' call
165
+ var destination_0 = ArrayList_init_$Create$();
166
+ var _iterator__ex2g4s_0 = tmp0_0.t();
167
+ while (_iterator__ex2g4s_0.u()) {
168
+ var element_1 = _iterator__ex2g4s_0.v();
169
+ if (element_1 instanceof Interface) {
170
+ destination_0.x(element_1);
171
+ }
172
+ }
173
+ var tmp$ret$3;
174
+ $l$block: {
175
+ // Inline function 'kotlin.collections.firstOrNull' call
176
+ var _iterator__ex2g4s_1 = destination_0.t();
177
+ while (_iterator__ex2g4s_1.u()) {
178
+ var element_2 = _iterator__ex2g4s_1.v();
179
+ if (element_2.m1o_1.x1l() === 'Headers') {
180
+ tmp$ret$3 = element_2;
181
+ break $l$block;
182
+ }
183
+ }
184
+ tmp$ret$3 = null;
185
+ }
186
+ var nestedHeaders = tmp$ret$3;
187
+ var tmp_3;
188
+ if (!(nestedHeaders == null)) {
189
+ var tmp_4 = new Namespace(element_0.m1o_1, listOf(nestedHeaders));
190
+ // Inline function 'kotlin.collections.filter' call
191
+ var tmp0_1 = element_0.n1o_1;
192
+ // Inline function 'kotlin.collections.filterTo' call
193
+ var destination_1 = ArrayList_init_$Create$();
194
+ var _iterator__ex2g4s_2 = tmp0_1.t();
195
+ while (_iterator__ex2g4s_2.u()) {
196
+ var element_3 = _iterator__ex2g4s_2.v();
197
+ var tmp_5;
198
+ if (element_3 instanceof Interface) {
199
+ tmp_5 = element_3.m1o_1.x1l() === 'Headers';
200
+ } else {
201
+ tmp_5 = false;
202
+ }
203
+ if (!tmp_5) {
204
+ destination_1.x(element_3);
205
+ }
206
+ }
207
+ var tmp_6 = destination_1;
208
+ // Inline function 'kotlin.collections.map' call
209
+ var this_0 = element_0.r1o_1;
210
+ // Inline function 'kotlin.collections.mapTo' call
211
+ var destination_2 = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
212
+ var _iterator__ex2g4s_3 = this_0.t();
213
+ while (_iterator__ex2g4s_3.u()) {
214
+ var item = _iterator__ex2g4s_3.v();
215
+ var tmp_7;
216
+ if (item.m1n_1.s1h() === 'headers') {
217
+ tmp_7 = item.q1n(VOID, new Custom(element_0.m1o_1.x1l() + '.Headers'));
218
+ } else {
219
+ tmp_7 = item;
220
+ }
221
+ var tmp$ret$7 = tmp_7;
222
+ destination_2.x(tmp$ret$7);
223
+ }
224
+ tmp_3 = listOf_0([tmp_4, element_0.t1o(VOID, tmp_6, VOID, VOID, VOID, destination_2)]);
225
+ } else {
226
+ tmp_3 = listOf(element_0);
227
+ }
228
+ tmp_1 = tmp_3;
229
+ } else {
230
+ tmp_1 = listOf(element_0);
231
+ }
232
+ var list = tmp_1;
233
+ addAll(destination, list);
234
+ }
235
+ var newElements = destination;
236
+ tmp_0 = element.d1n(VOID, newElements);
237
+ } else {
238
+ tmp_0 = element;
239
+ }
240
+ tmp = tmp_0;
241
+ } else {
242
+ tmp = element;
243
+ }
244
+ var transformed = tmp;
245
+ return transformChildren(transformed, transformer);
246
+ }
247
+ function ScalaIrEmitter$shared$o$source$lambda_1(this$0) {
248
+ return function (element, transformer) {
249
+ var tmp;
250
+ if (element instanceof Namespace) {
251
+ var injected = element.z1m_1.equals(Companion_getInstance().m1h('Wirespec')) ? this$0.c20_1 : emptyList();
252
+ var tmp_0;
253
+ // Inline function 'kotlin.collections.isNotEmpty' call
254
+ if (!injected.r()) {
255
+ tmp_0 = withElements(element, plus_0(element.v1m(), injected));
256
+ } else {
257
+ tmp_0 = element;
258
+ }
259
+ tmp = tmp_0;
260
+ } else {
261
+ tmp = element;
262
+ }
263
+ var transformed = tmp;
264
+ return transformChildren(transformed, transformer);
265
+ };
266
+ }
267
+ function _get_sanitizationConfig__sns434($this) {
268
+ var tmp0 = $this.j20_1;
269
+ var tmp = KProperty1;
270
+ // Inline function 'kotlin.getValue' call
271
+ getPropertyCallableRef('sanitizationConfig', 1, tmp, ScalaIrEmitter$_get_sanitizationConfig_$ref_ydarb0(), null);
272
+ return tmp0.l1();
273
+ }
274
+ function sanitize($this, _this__u8e3s4) {
275
+ // Inline function 'kotlin.collections.mapIndexed' call
276
+ var this_0 = split(_this__u8e3s4.l1(), ['.', ' ']);
277
+ // Inline function 'kotlin.collections.mapIndexedTo' call
278
+ var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
279
+ var index = 0;
280
+ var _iterator__ex2g4s = this_0.t();
281
+ while (_iterator__ex2g4s.u()) {
282
+ var item = _iterator__ex2g4s.v();
283
+ var _unary__edvuaz = index;
284
+ index = _unary__edvuaz + 1 | 0;
285
+ var tmp$ret$0 = checkIndexOverflow(_unary__edvuaz) > 0 ? Companion_instance.oq(item) : item;
286
+ destination.x(tmp$ret$0);
287
+ }
288
+ // Inline function 'kotlin.text.filter' call
289
+ var tmp0 = joinToString(destination, '');
290
+ // Inline function 'kotlin.text.filterTo' call
291
+ var destination_0 = StringBuilder_init_$Create$();
292
+ var inductionVariable = 0;
293
+ var last = charSequenceLength(tmp0);
294
+ if (inductionVariable < last)
295
+ do {
296
+ var index_0 = inductionVariable;
297
+ inductionVariable = inductionVariable + 1 | 0;
298
+ var element = charSequenceGet(tmp0, index_0);
299
+ if (isLetterOrDigit(element) || element === _Char___init__impl__6a9atx(95)) {
300
+ destination_0.s(element);
301
+ }
302
+ }
303
+ while (inductionVariable < last);
304
+ var tmp$ret$5 = destination_0.toString();
305
+ // Inline function 'kotlin.let' call
306
+ var it = sanitizeFirstIsDigit($this, tmp$ret$5);
307
+ var tmp;
308
+ if (_this__u8e3s4 instanceof FieldIdentifier) {
309
+ tmp = sanitizeKeywords($this, it);
310
+ } else {
311
+ tmp = it;
312
+ }
313
+ return tmp;
314
+ }
315
+ function sanitizeFirstIsDigit($this, _this__u8e3s4) {
316
+ var tmp;
317
+ var tmp0_safe_receiver = firstOrNull(_this__u8e3s4);
318
+ var tmp_0;
319
+ var tmp_1 = tmp0_safe_receiver;
320
+ if ((tmp_1 == null ? null : new Char(tmp_1)) == null) {
321
+ tmp_0 = null;
322
+ } else {
323
+ tmp_0 = isDigit(tmp0_safe_receiver);
324
+ }
325
+ if (tmp_0 === true) {
326
+ tmp = '_' + _this__u8e3s4;
327
+ } else {
328
+ tmp = _this__u8e3s4;
329
+ }
330
+ return tmp;
331
+ }
332
+ function sanitizeKeywords($this, _this__u8e3s4) {
333
+ return Companion_getInstance_0().l20_1.u1(_this__u8e3s4) ? addBackticks(_this__u8e3s4) : _this__u8e3s4;
334
+ }
335
+ function sanitizeSymbol($this, _this__u8e3s4) {
336
+ // Inline function 'kotlin.collections.mapIndexed' call
337
+ var this_0 = split(_this__u8e3s4, ['.', ' ', '-']);
338
+ // Inline function 'kotlin.collections.mapIndexedTo' call
339
+ var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
340
+ var index = 0;
341
+ var _iterator__ex2g4s = this_0.t();
342
+ while (_iterator__ex2g4s.u()) {
343
+ var item = _iterator__ex2g4s.v();
344
+ var _unary__edvuaz = index;
345
+ index = _unary__edvuaz + 1 | 0;
346
+ var tmp$ret$0 = checkIndexOverflow(_unary__edvuaz) > 0 ? Companion_instance.oq(item) : item;
347
+ destination.x(tmp$ret$0);
348
+ }
349
+ // Inline function 'kotlin.text.filter' call
350
+ var tmp0 = joinToString(destination, '');
351
+ // Inline function 'kotlin.text.filterTo' call
352
+ var destination_0 = StringBuilder_init_$Create$();
353
+ var inductionVariable = 0;
354
+ var last = charSequenceLength(tmp0);
355
+ if (inductionVariable < last)
356
+ do {
357
+ var index_0 = inductionVariable;
358
+ inductionVariable = inductionVariable + 1 | 0;
359
+ var element = charSequenceGet(tmp0, index_0);
360
+ if (isLetterOrDigit(element) || element === _Char___init__impl__6a9atx(95)) {
361
+ destination_0.s(element);
362
+ }
363
+ }
364
+ while (inductionVariable < last);
365
+ var tmp$ret$5 = destination_0.toString();
366
+ return sanitizeFirstIsDigit($this, tmp$ret$5);
367
+ }
368
+ function sanitizeEnum($this, _this__u8e3s4) {
369
+ return sanitizeKeywords($this, sanitizeFirstIsDigit($this, joinToString(split(_this__u8e3s4, ['-', ', ', '.', ' ', '//']), '_')));
370
+ }
371
+ function buildImports($this, _this__u8e3s4) {
372
+ // Inline function 'kotlin.collections.distinctBy' call
373
+ var this_0 = importReferences(_this__u8e3s4);
374
+ var set = HashSet_init_$Create$();
375
+ var list = ArrayList_init_$Create$();
376
+ var _iterator__ex2g4s = this_0.t();
377
+ while (_iterator__ex2g4s.u()) {
378
+ var e = _iterator__ex2g4s.v();
379
+ var key = e.lu_1;
380
+ if (set.x(key)) {
381
+ list.x(e);
382
+ }
383
+ }
384
+ // Inline function 'kotlin.collections.map' call
385
+ // Inline function 'kotlin.collections.mapTo' call
386
+ var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(list, 10));
387
+ var _iterator__ex2g4s_0 = list.t();
388
+ while (_iterator__ex2g4s_0.u()) {
389
+ var item = _iterator__ex2g4s_0.v();
390
+ var tmp$ret$2 = import_0($this.k1v().mr_1 + '.model', item.lu_1);
391
+ destination.x(tmp$ret$2);
392
+ }
393
+ return destination;
394
+ }
395
+ function addIdentityTypeToCall($this, _this__u8e3s4) {
396
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
397
+ var scope = new TransformScope(_this__u8e3s4);
398
+ // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
399
+ var tmp = scope;
400
+ // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
401
+ var this_0 = scope.z1t_1;
402
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
403
+ // Inline function 'kotlin.apply' call
404
+ var this_1 = new TransformerBuilder();
405
+ this_1.d1h(ScalaIrEmitter$addIdentityTypeToCall$lambda);
406
+ var tmp$ret$2 = this_1.e1h();
407
+ tmp.z1t_1 = transform(this_0, tmp$ret$2);
408
+ var tmp_0 = scope.z1t_1;
409
+ return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
410
+ }
411
+ function isRequestObject($this, namespace) {
412
+ // Inline function 'kotlin.collections.filterIsInstance' call
413
+ var tmp0 = namespace.a1n_1;
414
+ // Inline function 'kotlin.collections.filterIsInstanceTo' call
415
+ var destination = ArrayList_init_$Create$();
416
+ var _iterator__ex2g4s = tmp0.t();
417
+ while (_iterator__ex2g4s.u()) {
418
+ var element = _iterator__ex2g4s.v();
419
+ if (element instanceof Struct) {
420
+ destination.x(element);
421
+ }
422
+ }
423
+ var tmp$ret$3;
424
+ $l$block: {
425
+ // Inline function 'kotlin.collections.firstOrNull' call
426
+ var _iterator__ex2g4s_0 = destination.t();
427
+ while (_iterator__ex2g4s_0.u()) {
428
+ var element_0 = _iterator__ex2g4s_0.v();
429
+ if (element_0.f1n_1.x1l() === 'Request') {
430
+ tmp$ret$3 = element_0;
431
+ break $l$block;
432
+ }
433
+ }
434
+ tmp$ret$3 = null;
435
+ }
436
+ var tmp0_elvis_lhs = tmp$ret$3;
437
+ var tmp;
438
+ if (tmp0_elvis_lhs == null) {
439
+ return false;
440
+ } else {
441
+ tmp = tmp0_elvis_lhs;
442
+ }
443
+ var requestStruct = tmp;
444
+ return requestStruct.h1n_1.a1() === 1 && single(requestStruct.h1n_1).r1n_1.r() || (requestStruct.g1n_1.r() && requestStruct.h1n_1.r());
445
+ }
446
+ function injectHandleFunction($this, _this__u8e3s4) {
447
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
448
+ var scope = new TransformScope(_this__u8e3s4);
449
+ // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
450
+ var tmp = scope;
451
+ // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
452
+ var this_0 = scope.z1t_1;
453
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
454
+ // Inline function 'kotlin.apply' call
455
+ var this_1 = new TransformerBuilder();
456
+ this_1.d1h(ScalaIrEmitter$injectHandleFunction$lambda);
457
+ var tmp$ret$2 = this_1.e1h();
458
+ tmp.z1t_1 = transform(this_0, tmp$ret$2);
459
+ var tmp_0 = scope.z1t_1;
460
+ return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
461
+ }
462
+ function buildClientServerObjects($this, endpoint, requestIsObject, namespace) {
463
+ var reqType = requestIsObject ? 'Request.type' : 'Request';
464
+ var pathTemplate = '/' + joinToString(endpoint.gp_1, '/', VOID, VOID, VOID, VOID, ScalaIrEmitter$buildClientServerObjects$lambda);
465
+ var clientObject = raw(trimMargin('\n |object Client extends Wirespec.Client[' + reqType + ', Response[?]] {\n | override val pathTemplate: String = "' + pathTemplate + '"\n | override val method: String = "' + endpoint.fp_1.toString() + '"\n | override def client(serialization: Wirespec.Serialization): Wirespec.ClientEdge[' + reqType + ', Response[?]] = new Wirespec.ClientEdge[' + reqType + ', Response[?]] {\n | override def to(request: ' + reqType + '): Wirespec.RawRequest = toRawRequest(serialization, request)\n | override def from(response: Wirespec.RawResponse): Response[?] = fromRawResponse(serialization, response)\n | }\n |}\n '));
466
+ var serverObject = raw(trimMargin('\n |object Server extends Wirespec.Server[' + reqType + ', Response[?]] {\n | override val pathTemplate: String = "' + pathTemplate + '"\n | override val method: String = "' + endpoint.fp_1.toString() + '"\n | override def server(serialization: Wirespec.Serialization): Wirespec.ServerEdge[' + reqType + ', Response[?]] = new Wirespec.ServerEdge[' + reqType + ', Response[?]] {\n | override def from(request: Wirespec.RawRequest): ' + reqType + ' = fromRawRequest(serialization, request)\n | override def to(response: Response[?]): Wirespec.RawResponse = toRawResponse(serialization, response)\n | }\n |}\n '));
467
+ return namespace.d1n(VOID, plus(plus(namespace.a1n_1, clientObject), serverObject));
468
+ }
469
+ function Companion() {
470
+ Companion_instance_2 = this;
471
+ this.l20_1 = setOf(['abstract', 'case', 'class', 'def', 'do', 'else', 'extends', 'false', 'final', 'for', 'forSome', 'if', 'implicit', 'import', 'lazy', 'match', 'new', 'null', 'object', 'override', 'package', 'private', 'protected', 'return', 'sealed', 'super', 'this', 'throw', 'trait', 'true', 'try', 'type', 'val', 'var', 'while', 'with', 'yield', 'given', 'using', 'enum', 'export', 'then']);
472
+ }
473
+ var Companion_instance_2;
474
+ function Companion_getInstance_0() {
475
+ if (Companion_instance_2 == null)
476
+ new Companion();
477
+ return Companion_instance_2;
478
+ }
479
+ function ScalaIrEmitter$sanitizationConfig$delegate$lambda$lambda(it) {
480
+ return addBackticks(it);
481
+ }
482
+ function ScalaIrEmitter$sanitizationConfig$delegate$lambda$lambda_0(this$0) {
483
+ return function (name) {
484
+ var sanitized = name.n1h_1.a1() > 1 ? name.r1l() : sanitizeSymbol(this$0, name.s1h());
485
+ return new Name(listOf(sanitized));
486
+ };
487
+ }
488
+ function ScalaIrEmitter$sanitizationConfig$delegate$lambda$lambda_1(this$0) {
489
+ return function (name) {
490
+ return new Name(listOf(sanitizeSymbol(this$0, name.r1l())));
491
+ };
492
+ }
493
+ function ScalaIrEmitter$sanitizationConfig$delegate$lambda$lambda_2(this$0) {
494
+ return function (it) {
495
+ return sanitizeSymbol(this$0, it);
496
+ };
497
+ }
498
+ function ScalaIrEmitter$sanitizationConfig$delegate$lambda$lambda_3(this$0) {
499
+ return function (stmt, tr) {
500
+ var tmp;
501
+ if (stmt instanceof FunctionCall) {
502
+ var tmp_0;
503
+ if (stmt.b1m_1.s1h() === 'validate') {
504
+ tmp_0 = transformChildren_0(stmt.f1m(VOID, emptyList()), tr);
505
+ } else {
506
+ tmp_0 = transformChildren_0(stmt, tr);
507
+ }
508
+ tmp = tmp_0;
509
+ } else {
510
+ if (stmt instanceof ConstructorStatement) {
511
+ var tmp_1 = tr.r1t(stmt.p1m_1);
512
+ // Inline function 'kotlin.collections.map' call
513
+ var this_0 = stmt.q1m_1;
514
+ // Inline function 'kotlin.collections.mapTo' call
515
+ var destination = ArrayList_init_$Create$_0(this_0.a1());
516
+ // Inline function 'kotlin.collections.iterator' call
517
+ var _iterator__ex2g4s = this_0.j1().t();
518
+ while (_iterator__ex2g4s.u()) {
519
+ var item = _iterator__ex2g4s.v();
520
+ // Inline function 'kotlin.collections.component1' call
521
+ var name = item.k1();
522
+ // Inline function 'kotlin.collections.component2' call
523
+ var expr = item.l1();
524
+ var tmp$ret$3 = to(sanitizeFieldName(_get_sanitizationConfig__sns434(this$0), name), tr.u1t(expr));
525
+ destination.x(tmp$ret$3);
526
+ }
527
+ tmp = new ConstructorStatement(tmp_1, toMap(destination));
528
+ } else {
529
+ tmp = transformChildren_0(stmt, tr);
530
+ }
531
+ }
532
+ return tmp;
533
+ };
534
+ }
535
+ function ScalaIrEmitter$sanitizationConfig$delegate$lambda(this$0) {
536
+ return function () {
537
+ var tmp = Companion_getInstance_0().l20_1;
538
+ var tmp_0 = ScalaIrEmitter$sanitizationConfig$delegate$lambda$lambda;
539
+ var tmp_1 = ScalaIrEmitter$sanitizationConfig$delegate$lambda$lambda_0(this$0);
540
+ var tmp_2 = ScalaIrEmitter$sanitizationConfig$delegate$lambda$lambda_1(this$0);
541
+ var tmp_3 = ScalaIrEmitter$sanitizationConfig$delegate$lambda$lambda_2(this$0);
542
+ return new SanitizationConfig(tmp, tmp_0, tmp_1, tmp_2, tmp_3, ScalaIrEmitter$sanitizationConfig$delegate$lambda$lambda_3(this$0));
543
+ };
544
+ }
545
+ function ScalaIrEmitter$_get_sanitizationConfig_$ref_ydarb0() {
546
+ return function (p0) {
547
+ return _get_sanitizationConfig__sns434(p0);
548
+ };
549
+ }
550
+ function ScalaIrEmitter$shared$1() {
551
+ this.b20_1 = 'community.flock.wirespec.scala';
552
+ this.c20_1 = convertClientServer(new Shared(this.b20_1));
553
+ var tmp = this;
554
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
555
+ var this_0 = convert(new Shared(this.b20_1));
556
+ var scope = new TransformScope(this_0);
557
+ // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
558
+ var tmp_0 = scope;
559
+ // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
560
+ var this_1 = scope.z1t_1;
561
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
562
+ // Inline function 'kotlin.apply' call
563
+ var this_2 = new TransformerBuilder();
564
+ this_2.d1h(ScalaIrEmitter$shared$o$source$lambda);
565
+ var tmp$ret$2 = this_2.e1h();
566
+ tmp_0.z1t_1 = transform(this_1, tmp$ret$2);
567
+ // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
568
+ var tmp_1 = scope;
569
+ // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
570
+ var this_3 = scope.z1t_1;
571
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
572
+ // Inline function 'kotlin.apply' call
573
+ var this_4 = new TransformerBuilder();
574
+ this_4.d1h(ScalaIrEmitter$shared$o$source$lambda_0);
575
+ var tmp$ret$7 = this_4.e1h();
576
+ tmp_1.z1t_1 = transform(this_3, tmp$ret$7);
577
+ // Inline function 'community.flock.wirespec.ir.core.TransformScope.injectAfter' call
578
+ var tmp_2 = scope;
579
+ // Inline function 'community.flock.wirespec.ir.core.injectAfter' call
580
+ // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
581
+ var this_5 = scope.z1t_1;
582
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
583
+ // Inline function 'kotlin.apply' call
584
+ var this_6 = new TransformerBuilder();
585
+ this_6.d1h(ScalaIrEmitter$shared$o$source$lambda_1(this));
586
+ var tmp$ret$12 = this_6.e1h();
587
+ tmp_2.z1t_1 = transform(this_5, tmp$ret$12);
588
+ var tmp_3 = scope.z1t_1;
589
+ var tmp$ret$17 = isInterface(tmp_3, Element) ? tmp_3 : THROW_CCE();
590
+ tmp.d20_1 = generateScala(tmp$ret$17);
591
+ }
592
+ protoOf(ScalaIrEmitter$shared$1).r1w = function () {
593
+ return this.d20_1;
594
+ };
595
+ function ScalaIrEmitter$emit$lambda(this$0) {
596
+ return function () {
597
+ return new File(Companion_getInstance().m1h(Companion_instance_0.lr('community.flock.wirespec.scala').or() + 'Wirespec'), listOf(new RawElement(this$0.t1v().r1w())));
598
+ };
599
+ }
600
+ function ScalaIrEmitter$emit$lambda_0(element, transformer) {
601
+ var tmp;
602
+ if (element instanceof Struct) {
603
+ tmp = element.g1n_1.r() ? element.l1n(VOID, VOID, listOf(new Constructor(emptyList(), emptyList()))) : element;
604
+ } else {
605
+ tmp = element;
606
+ }
607
+ var transformed = tmp;
608
+ return transformChildren(transformed, transformer);
609
+ }
610
+ function ScalaIrEmitter$emit$lambda$lambda(this$0) {
611
+ return function (it) {
612
+ return sanitizeEnum(this$0, it);
613
+ };
614
+ }
615
+ function ScalaIrEmitter$emit$lambda_1(this$0) {
616
+ return function (element, transformer) {
617
+ var tmp;
618
+ if (element instanceof Enum) {
619
+ tmp = withLabelField(element, ScalaIrEmitter$emit$lambda$lambda(this$0));
620
+ } else {
621
+ tmp = element;
622
+ }
623
+ var transformed = tmp;
624
+ return transformChildren(transformed, transformer);
625
+ };
626
+ }
627
+ function ScalaIrEmitter$emit$lambda_2(expr, tr) {
628
+ var tmp;
629
+ var tmp_0;
630
+ var tmp_1;
631
+ if (expr instanceof FunctionCall) {
632
+ tmp_1 = expr.b1m_1.r1l() === 'toString';
633
+ } else {
634
+ tmp_1 = false;
635
+ }
636
+ if (tmp_1) {
637
+ tmp_0 = !(expr.z1l_1 == null);
638
+ } else {
639
+ tmp_0 = false;
640
+ }
641
+ if (tmp_0) {
642
+ var tmp0_safe_receiver = expr.z1l_1;
643
+ var tmp_2;
644
+ if (tmp0_safe_receiver == null) {
645
+ tmp_2 = null;
646
+ } else {
647
+ // Inline function 'kotlin.let' call
648
+ tmp_2 = tr.u1t(tmp0_safe_receiver);
649
+ }
650
+ tmp = new FieldCall(tmp_2, Companion_getInstance().m1h('toString'));
651
+ } else {
652
+ tmp = transformChildren_1(expr, tr);
653
+ }
654
+ return tmp;
655
+ }
656
+ function ScalaIrEmitter$addIdentityTypeToCall$lambda(element, transformer) {
657
+ var tmp;
658
+ if (element instanceof Struct) {
659
+ // Inline function 'kotlin.collections.map' call
660
+ var this_0 = element.i1n_1;
661
+ // Inline function 'kotlin.collections.mapTo' call
662
+ var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
663
+ var _iterator__ex2g4s = this_0.t();
664
+ while (_iterator__ex2g4s.u()) {
665
+ var item = _iterator__ex2g4s.v();
666
+ var tmp_0;
667
+ var tmp_1;
668
+ if (item instanceof Custom) {
669
+ tmp_1 = endsWith(item.q1h_1, '.Call');
670
+ } else {
671
+ tmp_1 = false;
672
+ }
673
+ if (tmp_1) {
674
+ tmp_0 = item.n1m(VOID, listOf(new Custom('[A] =>> A')));
675
+ } else {
676
+ tmp_0 = item;
677
+ }
678
+ var tmp$ret$0 = tmp_0;
679
+ destination.x(tmp$ret$0);
680
+ }
681
+ tmp = element.l1n(VOID, VOID, VOID, destination);
682
+ } else {
683
+ tmp = element;
684
+ }
685
+ var transformed = tmp;
686
+ return transformChildren(transformed, transformer);
687
+ }
688
+ function ScalaIrEmitter$injectHandleFunction$lambda(element, transformer) {
689
+ var tmp;
690
+ if (element instanceof Interface) {
691
+ var tmp_0;
692
+ if (element.m1o_1.equals(Companion_getInstance().m1h('Handler')) || element.m1o_1.equals(Companion_getInstance().m1h('Call'))) {
693
+ var tmp0_typeParameters = listOf(new TypeParameter(new Custom('F[_]')));
694
+ // Inline function 'kotlin.collections.map' call
695
+ var this_0 = element.n1o_1;
696
+ // Inline function 'kotlin.collections.mapTo' call
697
+ var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
698
+ var _iterator__ex2g4s = this_0.t();
699
+ while (_iterator__ex2g4s.u()) {
700
+ var item = _iterator__ex2g4s.v();
701
+ var tmp_1;
702
+ if (item instanceof Function) {
703
+ var tmp0_safe_receiver = item.w1j_1;
704
+ var tmp_2;
705
+ if (tmp0_safe_receiver == null) {
706
+ tmp_2 = null;
707
+ } else {
708
+ // Inline function 'kotlin.let' call
709
+ tmp_2 = new Custom('F', listOf(tmp0_safe_receiver));
710
+ }
711
+ var tmp2_returnType = tmp_2;
712
+ tmp_1 = item.b1k(VOID, VOID, VOID, tmp2_returnType, VOID, false);
713
+ } else {
714
+ tmp_1 = item;
715
+ }
716
+ var tmp$ret$2 = tmp_1;
717
+ destination.x(tmp$ret$2);
718
+ }
719
+ tmp_0 = element.t1o(VOID, destination, VOID, VOID, tmp0_typeParameters);
720
+ } else {
721
+ tmp_0 = element;
722
+ }
723
+ tmp = tmp_0;
724
+ } else {
725
+ tmp = element;
726
+ }
727
+ var transformed = tmp;
728
+ return transformChildren(transformed, transformer);
729
+ }
730
+ function ScalaIrEmitter$buildClientServerObjects$lambda(it) {
731
+ var tmp;
732
+ if (it instanceof Literal) {
733
+ tmp = it.hq_1;
734
+ } else {
735
+ if (it instanceof Param) {
736
+ tmp = '{' + it.lp_1.l1() + '}';
737
+ } else {
738
+ noWhenBranchMatchedException();
739
+ }
740
+ }
741
+ return tmp;
742
+ }
743
+ function ScalaIrEmitter(packageName, emitShared) {
744
+ Companion_getInstance_0();
745
+ packageName = packageName === VOID ? Companion_instance_0.lr('community.flock.wirespec.generated') : packageName;
746
+ emitShared = emitShared === VOID ? Companion_instance_1.go() : emitShared;
747
+ this.e20_1 = packageName;
748
+ this.f20_1 = emitShared;
749
+ this.g20_1 = ScalaGenerator_instance;
750
+ this.h20_1 = FileExtension_Scala_getInstance();
751
+ this.i20_1 = listOf_0([import_0('community.flock.wirespec.scala', 'Wirespec'), import_0('scala.reflect', 'ClassTag')]);
752
+ var tmp = this;
753
+ tmp.j20_1 = lazy(ScalaIrEmitter$sanitizationConfig$delegate$lambda(this));
754
+ var tmp_0 = this;
755
+ tmp_0.k20_1 = new ScalaIrEmitter$shared$1();
756
+ }
757
+ protoOf(ScalaIrEmitter).k1v = function () {
758
+ return this.e20_1;
759
+ };
760
+ protoOf(ScalaIrEmitter).m1u = function () {
761
+ return this.g20_1;
762
+ };
763
+ protoOf(ScalaIrEmitter).eq = function () {
764
+ return this.h20_1;
765
+ };
766
+ protoOf(ScalaIrEmitter).t1v = function () {
767
+ return this.k20_1;
768
+ };
769
+ protoOf(ScalaIrEmitter).n1u = function (module_0, logger) {
770
+ var tmp = emit.call(this, module_0, logger);
771
+ return withSharedSource(tmp, this.f20_1, ScalaIrEmitter$emit$lambda(this));
772
+ };
773
+ protoOf(ScalaIrEmitter).uq = function (definition, module_0, logger) {
774
+ var file = emit_0.call(this, definition, module_0, logger);
775
+ // Inline function 'kotlin.takeIf' call
776
+ var this_0 = this.i20_1;
777
+ var tmp;
778
+ if (Companion_instance.qq(module_0)) {
779
+ tmp = this_0;
780
+ } else {
781
+ tmp = null;
782
+ }
783
+ var tmp$ret$1 = tmp;
784
+ return placeInPackage(prependImports(file, tmp$ret$1), this.k1v(), definition);
785
+ };
786
+ protoOf(ScalaIrEmitter).up = function (type, module_0) {
787
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
788
+ var this_0 = sanitizeNames(convertWithValidation(type, module_0), _get_sanitizationConfig__sns434(this));
789
+ var scope = new TransformScope(this_0);
790
+ // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
791
+ var tmp = scope;
792
+ // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
793
+ var this_1 = scope.z1t_1;
794
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
795
+ // Inline function 'kotlin.apply' call
796
+ var this_2 = new TransformerBuilder();
797
+ this_2.d1h(ScalaIrEmitter$emit$lambda_0);
798
+ var tmp$ret$2 = this_2.e1h();
799
+ tmp.z1t_1 = transform(this_1, tmp$ret$2);
800
+ var tmp_0 = scope.z1t_1;
801
+ return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
802
+ };
803
+ protoOf(ScalaIrEmitter).ir = function (enum_0, module_0) {
804
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
805
+ var this_0 = sanitizeNames(convert_0(enum_0), _get_sanitizationConfig__sns434(this));
806
+ var scope = new TransformScope(this_0);
807
+ // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
808
+ var tmp = scope;
809
+ // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
810
+ var this_1 = scope.z1t_1;
811
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
812
+ // Inline function 'kotlin.apply' call
813
+ var this_2 = new TransformerBuilder();
814
+ this_2.d1h(ScalaIrEmitter$emit$lambda_1(this));
815
+ var tmp$ret$2 = this_2.e1h();
816
+ tmp.z1t_1 = transform(this_1, tmp$ret$2);
817
+ var tmp_0 = scope.z1t_1;
818
+ return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
819
+ };
820
+ protoOf(ScalaIrEmitter).yq = function (union) {
821
+ return sanitizeNames(convert_1(union), _get_sanitizationConfig__sns434(this));
822
+ };
823
+ protoOf(ScalaIrEmitter).dr = function (refined) {
824
+ var file = sanitizeNames(convert_2(refined), _get_sanitizationConfig__sns434(this));
825
+ // Inline function 'community.flock.wirespec.ir.core.findElement' call
826
+ // Inline function 'kotlin.collections.filterIsInstance' call
827
+ var tmp0 = file.v1m();
828
+ // Inline function 'kotlin.collections.filterIsInstanceTo' call
829
+ var destination = ArrayList_init_$Create$();
830
+ var _iterator__ex2g4s = tmp0.t();
831
+ while (_iterator__ex2g4s.u()) {
832
+ var element = _iterator__ex2g4s.v();
833
+ if (element instanceof Struct) {
834
+ destination.x(element);
835
+ }
836
+ }
837
+ var tmp$ret$2 = firstOrNull_0(destination);
838
+ var struct = ensureNotNull(tmp$ret$2);
839
+ // Inline function 'kotlin.collections.map' call
840
+ var this_0 = struct.g1n_1;
841
+ // Inline function 'kotlin.collections.mapTo' call
842
+ var destination_0 = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
843
+ var _iterator__ex2g4s_0 = this_0.t();
844
+ while (_iterator__ex2g4s_0.u()) {
845
+ var item = _iterator__ex2g4s_0.v();
846
+ var tmp$ret$3 = item.q1n(VOID, VOID, true);
847
+ destination_0.x(tmp$ret$3);
848
+ }
849
+ var tmp = destination_0;
850
+ // Inline function 'kotlin.collections.map' call
851
+ var this_1 = struct.j1n_1;
852
+ // Inline function 'kotlin.collections.mapTo' call
853
+ var destination_1 = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_1, 10));
854
+ var _iterator__ex2g4s_1 = this_1.t();
855
+ while (_iterator__ex2g4s_1.u()) {
856
+ var item_0 = _iterator__ex2g4s_1.v();
857
+ var tmp_0;
858
+ if (item_0 instanceof Function) {
859
+ tmp_0 = item_0.b1k(VOID, VOID, VOID, VOID, VOID, VOID, VOID, true);
860
+ } else {
861
+ tmp_0 = item_0;
862
+ }
863
+ var tmp$ret$6 = tmp_0;
864
+ destination_1.x(tmp$ret$6);
865
+ }
866
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
867
+ var this_2 = struct.l1n(VOID, tmp, VOID, VOID, destination_1);
868
+ var scope = new TransformScope(this_2);
869
+ scope.h1u(ScalaIrEmitter$emit$lambda_2);
870
+ var tmp_1 = scope.z1t_1;
871
+ var updatedStruct = isInterface(tmp_1, Element) ? tmp_1 : THROW_CCE();
872
+ return new File(Companion_getInstance().m1h(sanitize(this, refined.br_1)), listOf(updatedStruct));
873
+ };
874
+ protoOf(ScalaIrEmitter).jr = function (endpoint) {
875
+ var imports = buildImports(this, endpoint);
876
+ var file = convert_3(endpoint);
877
+ // Inline function 'community.flock.wirespec.ir.core.findElement' call
878
+ // Inline function 'kotlin.collections.filterIsInstance' call
879
+ var tmp0 = file.v1m();
880
+ // Inline function 'kotlin.collections.filterIsInstanceTo' call
881
+ var destination = ArrayList_init_$Create$();
882
+ var _iterator__ex2g4s = tmp0.t();
883
+ while (_iterator__ex2g4s.u()) {
884
+ var element = _iterator__ex2g4s.v();
885
+ if (element instanceof Namespace) {
886
+ destination.x(element);
887
+ }
888
+ }
889
+ var tmp$ret$2 = firstOrNull_0(destination);
890
+ var endpointNamespace = ensureNotNull(tmp$ret$2);
891
+ var flattened = flattenNestedStructs(endpointNamespace);
892
+ var requestIsObject = isRequestObject(this, flattened);
893
+ // Inline function 'kotlin.let' call
894
+ var ns = injectHandleFunction(this, flattened);
895
+ var body = buildClientServerObjects(this, endpoint, requestIsObject, ns);
896
+ var sanitized = sanitizeNames(new File(Companion_getInstance().m1h(sanitize(this, endpoint.ep_1)), listOf(body)), _get_sanitizationConfig__sns434(this));
897
+ var tmp;
898
+ // Inline function 'kotlin.collections.isNotEmpty' call
899
+ if (!imports.r()) {
900
+ tmp = sanitized.x1m(VOID, plus_0(imports, sanitized.u1m_1));
901
+ } else {
902
+ tmp = sanitized;
903
+ }
904
+ return tmp;
905
+ };
906
+ protoOf(ScalaIrEmitter).xq = function (channel) {
907
+ var imports = buildImports(this, channel);
908
+ var file = sanitizeNames(convert_4(channel), _get_sanitizationConfig__sns434(this));
909
+ var tmp;
910
+ // Inline function 'kotlin.collections.isNotEmpty' call
911
+ if (!imports.r()) {
912
+ tmp = file.x1m(VOID, plus_0(imports, file.u1m_1));
913
+ } else {
914
+ tmp = file;
915
+ }
916
+ return tmp;
917
+ };
918
+ protoOf(ScalaIrEmitter).q1u = function (endpoint) {
919
+ var imports = buildImports(this, endpoint);
920
+ var endpointImport = import_0(this.k1v().mr_1 + '.endpoint', endpoint.ep_1.l1());
921
+ var file = addIdentityTypeToCall(this, sanitizeNames(emitEndpointClient.call(this, endpoint), _get_sanitizationConfig__sns434(this)));
922
+ var subPackageName = plus_1(this.k1v(), 'client');
923
+ var tmp = Companion_getInstance().m1h(subPackageName.or() + file.t1m_1.x1l());
924
+ // Inline function 'kotlin.collections.buildList' call
925
+ // Inline function 'kotlin.collections.buildListInternal' call
926
+ // Inline function 'kotlin.apply' call
927
+ var this_0 = ArrayList_init_$Create$();
928
+ this_0.x(new Package(subPackageName.mr_1));
929
+ this_0.e1(this.i20_1);
930
+ this_0.e1(imports);
931
+ this_0.x(endpointImport);
932
+ this_0.e1(file.u1m_1);
933
+ var tmp$ret$3 = this_0.o5();
934
+ return new File(tmp, tmp$ret$3);
935
+ };
936
+ protoOf(ScalaIrEmitter).p1u = function (endpoints, logger) {
937
+ // Inline function 'kotlin.collections.flatMap' call
938
+ // Inline function 'kotlin.collections.flatMapTo' call
939
+ var destination = ArrayList_init_$Create$();
940
+ var _iterator__ex2g4s = endpoints.t();
941
+ while (_iterator__ex2g4s.u()) {
942
+ var element = _iterator__ex2g4s.v();
943
+ var list = importReferences(element);
944
+ addAll(destination, list);
945
+ }
946
+ // Inline function 'kotlin.collections.distinctBy' call
947
+ var set = HashSet_init_$Create$();
948
+ var list_0 = ArrayList_init_$Create$();
949
+ var _iterator__ex2g4s_0 = destination.t();
950
+ while (_iterator__ex2g4s_0.u()) {
951
+ var e = _iterator__ex2g4s_0.v();
952
+ var key = e.lu_1;
953
+ if (set.x(key)) {
954
+ list_0.x(e);
955
+ }
956
+ }
957
+ // Inline function 'kotlin.collections.map' call
958
+ // Inline function 'kotlin.collections.mapTo' call
959
+ var destination_0 = ArrayList_init_$Create$_0(collectionSizeOrDefault(list_0, 10));
960
+ var _iterator__ex2g4s_1 = list_0.t();
961
+ while (_iterator__ex2g4s_1.u()) {
962
+ var item = _iterator__ex2g4s_1.v();
963
+ var tmp$ret$5 = import_0(this.k1v().mr_1 + '.model', item.lu_1);
964
+ destination_0.x(tmp$ret$5);
965
+ }
966
+ var imports = destination_0;
967
+ // Inline function 'kotlin.collections.map' call
968
+ // Inline function 'kotlin.collections.mapTo' call
969
+ var destination_1 = ArrayList_init_$Create$_0(collectionSizeOrDefault(endpoints, 10));
970
+ var _iterator__ex2g4s_2 = endpoints.t();
971
+ while (_iterator__ex2g4s_2.u()) {
972
+ var item_0 = _iterator__ex2g4s_2.v();
973
+ var tmp$ret$8 = import_0(this.k1v().mr_1 + '.endpoint', item_0.ep_1.l1());
974
+ destination_1.x(tmp$ret$8);
975
+ }
976
+ var endpointImports = destination_1;
977
+ // Inline function 'kotlin.collections.map' call
978
+ // Inline function 'kotlin.collections.mapTo' call
979
+ var destination_2 = ArrayList_init_$Create$_0(collectionSizeOrDefault(endpoints, 10));
980
+ var _iterator__ex2g4s_3 = endpoints.t();
981
+ while (_iterator__ex2g4s_3.u()) {
982
+ var item_1 = _iterator__ex2g4s_3.v();
983
+ var tmp$ret$11 = import_0(this.k1v().mr_1 + '.client', item_1.ep_1.l1() + 'Client');
984
+ destination_2.x(tmp$ret$11);
985
+ }
986
+ var clientImports = destination_2;
987
+ var allImports = plus_0(plus_0(imports, endpointImports), clientImports);
988
+ var file = addIdentityTypeToCall(this, sanitizeNames(emitClient.call(this, endpoints, logger), _get_sanitizationConfig__sns434(this)));
989
+ var tmp = Companion_getInstance().m1h(this.k1v().or() + file.t1m_1.x1l());
990
+ // Inline function 'kotlin.collections.buildList' call
991
+ // Inline function 'kotlin.collections.buildListInternal' call
992
+ // Inline function 'kotlin.apply' call
993
+ var this_0 = ArrayList_init_$Create$();
994
+ this_0.x(new Package(this.k1v().mr_1));
995
+ this_0.e1(this.i20_1);
996
+ this_0.e1(allImports);
997
+ this_0.e1(file.u1m_1);
998
+ var tmp$ret$17 = this_0.o5();
999
+ return new File(tmp, tmp$ret$17);
1000
+ };
1001
+ //region block: post-declaration
1002
+ protoOf(ScalaIrEmitter).on = emit_1;
1003
+ //endregion
1004
+ //region block: exports
1005
+ export {
1006
+ ScalaIrEmitter as ScalaIrEmitterytuwlk19c8ah,
1007
+ };
1008
+ //endregion
1009
+
1010
+ //# sourceMappingURL=wirespec-src-compiler-emitters-scala.mjs.map