@tuprolog/2p-full 0.30.5-dev01 → 0.31.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 (70) hide show
  1. package/2p-bdd.js +609 -0
  2. package/2p-bdd.js.map +1 -0
  3. package/2p-core.js +12057 -0
  4. package/2p-core.js.map +1 -0
  5. package/2p-datalog.js +8 -0
  6. package/2p-datalog.js.map +1 -0
  7. package/2p-dsl-core.js +8 -0
  8. package/2p-dsl-core.js.map +1 -0
  9. package/2p-dsl-solve.js +8 -0
  10. package/2p-dsl-solve.js.map +1 -0
  11. package/2p-dsl-theory.js +8 -0
  12. package/2p-dsl-theory.js.map +1 -0
  13. package/2p-dsl-unify.js +8 -0
  14. package/2p-dsl-unify.js.map +1 -0
  15. package/2p-full.d.ts +270 -0
  16. package/2p-full.js +21 -0
  17. package/2p-full.js.map +1 -0
  18. package/2p-io-lib.js +3600 -0
  19. package/2p-io-lib.js.map +1 -0
  20. package/2p-oop-lib.js +3660 -0
  21. package/2p-oop-lib.js.map +1 -0
  22. package/2p-parser-core.js +1450 -0
  23. package/2p-parser-core.js.map +1 -0
  24. package/2p-parser-js.js +29 -0
  25. package/2p-parser-js.js.map +1 -0
  26. package/2p-parser-theory.js +114 -0
  27. package/2p-parser-theory.js.map +1 -0
  28. package/2p-repl.js +519 -0
  29. package/2p-repl.js.map +1 -0
  30. package/2p-serialize-core.js +8 -0
  31. package/2p-serialize-core.js.map +1 -0
  32. package/2p-serialize-theory.js +8 -0
  33. package/2p-serialize-theory.js.map +1 -0
  34. package/2p-solve-classic.js +3329 -0
  35. package/2p-solve-classic.js.map +1 -0
  36. package/2p-solve-concurrent.js +8 -0
  37. package/2p-solve-concurrent.js.map +1 -0
  38. package/2p-solve-plp.js +44 -0
  39. package/2p-solve-plp.js.map +1 -0
  40. package/2p-solve-problog.js +4547 -0
  41. package/2p-solve-problog.js.map +1 -0
  42. package/2p-solve-streams.js +3028 -0
  43. package/2p-solve-streams.js.map +1 -0
  44. package/2p-solve.js +16824 -0
  45. package/2p-solve.js.map +1 -0
  46. package/2p-theory.js +4902 -0
  47. package/2p-theory.js.map +1 -0
  48. package/2p-unify.js +957 -0
  49. package/2p-unify.js.map +1 -0
  50. package/2p-utils.js +1423 -0
  51. package/2p-utils.js.map +1 -0
  52. package/88b0986a7186d029-atomicfu-js-ir.js +8 -0
  53. package/88b0986a7186d029-atomicfu-js-ir.js.map +1 -0
  54. package/clikt-clikt-js-ir.js +7240 -0
  55. package/clikt-clikt-js-ir.js.map +1 -0
  56. package/kotlin-kotlin-stdlib-js-ir.js +11847 -0
  57. package/kotlin-kotlin-stdlib-js-ir.js.map +1 -0
  58. package/kotlin-kotlinx-atomicfu-runtime-js-ir.js +8 -0
  59. package/kotlin-kotlinx-atomicfu-runtime-js-ir.js.map +1 -0
  60. package/kotlinx.coroutines-kotlinx-coroutines-core-js-ir.js +8 -0
  61. package/kotlinx.coroutines-kotlinx-coroutines-core-js-ir.js.map +1 -0
  62. package/kt-math.js +11348 -0
  63. package/kt-math.js.map +1 -0
  64. package/package.json +4 -36
  65. package/CONTRIBUTORS +0 -10
  66. package/LICENSE +0 -202
  67. package/kotlin/2p-full/it/unibo/tuprolog/tuprolog.kjsm +0 -0
  68. package/kotlin/2p-full.js +0 -15
  69. package/kotlin/2p-full.js.map +0 -1
  70. package/kotlin/2p-full.meta.js +0 -1
package/2p-io-lib.js ADDED
@@ -0,0 +1,3600 @@
1
+ (function (_, kotlin_it_unibo_tuprolog_solve, kotlin_kotlin, kotlin_it_unibo_tuprolog_core, kotlin_it_unibo_tuprolog_parser_core, kotlin_it_unibo_tuprolog_parser_theory, kotlin_it_unibo_tuprolog_theory) {
2
+ 'use strict';
3
+ //region block: imports
4
+ var AbstractLibrary = kotlin_it_unibo_tuprolog_solve.$_$.y2;
5
+ var Companion_getInstance = kotlin_it_unibo_tuprolog_solve.$_$.e2;
6
+ var listOf = kotlin_kotlin.$_$.i4;
7
+ var collectionSizeOrDefault = kotlin_kotlin.$_$.j3;
8
+ var ArrayList_init_$Create$ = kotlin_kotlin.$_$.b1;
9
+ var to = kotlin_kotlin.$_$.ec;
10
+ var Unit_getInstance = kotlin_kotlin.$_$.r2;
11
+ var containsSignature = kotlin_it_unibo_tuprolog_solve.$_$.b3;
12
+ var containsOperator = kotlin_it_unibo_tuprolog_solve.$_$.a3;
13
+ var hasPrimitive = kotlin_it_unibo_tuprolog_solve.$_$.d3;
14
+ var hasFunction = kotlin_it_unibo_tuprolog_solve.$_$.c3;
15
+ var get_ruleSignatures = kotlin_it_unibo_tuprolog_solve.$_$.f3;
16
+ var hasProtected = kotlin_it_unibo_tuprolog_solve.$_$.e3;
17
+ var objectMeta = kotlin_kotlin.$_$.i7;
18
+ var setMetadataFor = kotlin_kotlin.$_$.j7;
19
+ var asSequence = kotlin_kotlin.$_$.h3;
20
+ var map = kotlin_kotlin.$_$.c9;
21
+ var Companion_getInstance_0 = kotlin_it_unibo_tuprolog_core.$_$.s;
22
+ var toSet = kotlin_kotlin.$_$.r9;
23
+ var THROW_ISE = kotlin_kotlin.$_$.tb;
24
+ var Enum = kotlin_kotlin.$_$.hb;
25
+ var classMeta = kotlin_kotlin.$_$.m6;
26
+ var RegexOption_IGNORE_CASE_getInstance = kotlin_kotlin.$_$.d;
27
+ var Regex_init_$Create$ = kotlin_kotlin.$_$.i1;
28
+ var IllegalArgumentException_init_$Create$ = kotlin_kotlin.$_$.p1;
29
+ var toList = kotlin_kotlin.$_$.n5;
30
+ var mapCapacity = kotlin_kotlin.$_$.j4;
31
+ var coerceAtLeast = kotlin_kotlin.$_$.y7;
32
+ var LinkedHashMap_init_$Create$ = kotlin_kotlin.$_$.e1;
33
+ var startsWith$default = kotlin_kotlin.$_$.v;
34
+ var interfaceMeta = kotlin_kotlin.$_$.u6;
35
+ var TuPrologException_init_$Init$ = kotlin_it_unibo_tuprolog_core.$_$.k;
36
+ var captureStack = kotlin_kotlin.$_$.h6;
37
+ var TuPrologException_init_$Init$_0 = kotlin_it_unibo_tuprolog_core.$_$.m;
38
+ var TuPrologException = kotlin_it_unibo_tuprolog_core.$_$.l1;
39
+ var Companion_getInstance_1 = kotlin_it_unibo_tuprolog_solve.$_$.x1;
40
+ var Companion_getInstance_2 = kotlin_it_unibo_tuprolog_solve.$_$.y1;
41
+ var Expected_URL_getInstance = kotlin_it_unibo_tuprolog_solve.$_$.q;
42
+ var Predicative = kotlin_it_unibo_tuprolog_solve.$_$.k3;
43
+ var Predicative_0 = kotlin_it_unibo_tuprolog_solve.$_$.v3;
44
+ var NonBacktrackable = kotlin_it_unibo_tuprolog_solve.$_$.h3;
45
+ var Companion_getInstance_3 = kotlin_it_unibo_tuprolog_solve.$_$.g2;
46
+ var THROW_CCE = kotlin_kotlin.$_$.sb;
47
+ var InputChannel = kotlin_it_unibo_tuprolog_solve.$_$.q2;
48
+ var isInterface = kotlin_kotlin.$_$.y6;
49
+ var OutputChannel = kotlin_it_unibo_tuprolog_solve.$_$.r2;
50
+ var NonBacktrackable_0 = kotlin_it_unibo_tuprolog_solve.$_$.u3;
51
+ var IllegalStateException_init_$Create$ = kotlin_kotlin.$_$.s1;
52
+ var IllegalStateException = kotlin_kotlin.$_$.kb;
53
+ var Atom = kotlin_it_unibo_tuprolog_core.$_$.o1;
54
+ var equals = kotlin_kotlin.$_$.o6;
55
+ var Companion_getInstance_4 = kotlin_it_unibo_tuprolog_solve.$_$.k1;
56
+ var sequenceOf = kotlin_kotlin.$_$.i9;
57
+ var flatMap = kotlin_kotlin.$_$.u8;
58
+ var Companion_getInstance_5 = kotlin_it_unibo_tuprolog_core.$_$.d1;
59
+ var Companion_getInstance_6 = kotlin_it_unibo_tuprolog_core.$_$.i1;
60
+ var Companion_getInstance_7 = kotlin_it_unibo_tuprolog_core.$_$.g1;
61
+ var Companion_getInstance_8 = kotlin_it_unibo_tuprolog_core.$_$.y;
62
+ var asSequence_0 = kotlin_kotlin.$_$.g3;
63
+ var filter = kotlin_kotlin.$_$.r8;
64
+ var Sequence = kotlin_kotlin.$_$.f8;
65
+ var firstOrNull = kotlin_kotlin.$_$.s8;
66
+ var Companion_getInstance_9 = kotlin_it_unibo_tuprolog_core.$_$.e1;
67
+ var LinkedHashMap_init_$Create$_0 = kotlin_kotlin.$_$.f1;
68
+ var ArrayList_init_$Create$_0 = kotlin_kotlin.$_$.c1;
69
+ var asSequence_1 = kotlin_kotlin.$_$.f3;
70
+ var addAll = kotlin_kotlin.$_$.z2;
71
+ var Struct = kotlin_it_unibo_tuprolog_core.$_$.z1;
72
+ var Companion_getInstance_10 = kotlin_it_unibo_tuprolog_solve.$_$.l1;
73
+ var Companion_getInstance_11 = kotlin_it_unibo_tuprolog_solve.$_$.n1;
74
+ var CoroutineImpl = kotlin_kotlin.$_$.c6;
75
+ var SequenceScope = kotlin_kotlin.$_$.e8;
76
+ var get_COROUTINE_SUSPENDED = kotlin_kotlin.$_$.b6;
77
+ var filterNot = kotlin_kotlin.$_$.q8;
78
+ var Truth = kotlin_it_unibo_tuprolog_core.$_$.z2;
79
+ var lazy = kotlin_kotlin.$_$.xb;
80
+ var sequence = kotlin_kotlin.$_$.j9;
81
+ var Companion_getInstance_12 = kotlin_it_unibo_tuprolog_solve.$_$.q1;
82
+ var Expected_STREAM_PROPERTY_getInstance = kotlin_it_unibo_tuprolog_solve.$_$.e;
83
+ var Expected_WRITE_OPTION_getInstance = kotlin_it_unibo_tuprolog_solve.$_$.g;
84
+ var Expected_READ_OPTION_getInstance = kotlin_it_unibo_tuprolog_solve.$_$.b;
85
+ var List = kotlin_it_unibo_tuprolog_core.$_$.v1;
86
+ var Var = kotlin_it_unibo_tuprolog_core.$_$.b3;
87
+ var FuncFormat_LITERAL_getInstance = kotlin_it_unibo_tuprolog_core.$_$.d;
88
+ var FuncFormat_QUOTED_IF_NECESSARY_getInstance = kotlin_it_unibo_tuprolog_core.$_$.e;
89
+ var OpFormat_EXPRESSIONS_getInstance = kotlin_it_unibo_tuprolog_core.$_$.f;
90
+ var OpFormat_IGNORE_OPERATORS_getInstance = kotlin_it_unibo_tuprolog_core.$_$.g;
91
+ var Companion_getInstance_13 = kotlin_it_unibo_tuprolog_core.$_$.f1;
92
+ var VarFormat_UNDERSCORE_getInstance = kotlin_it_unibo_tuprolog_core.$_$.h;
93
+ var Expected_SOURCE_SINK_getInstance = kotlin_it_unibo_tuprolog_solve.$_$.c;
94
+ var Expected_IO_MODE_getInstance = kotlin_it_unibo_tuprolog_solve.$_$.a;
95
+ var Companion_getInstance_14 = kotlin_it_unibo_tuprolog_solve.$_$.s1;
96
+ var Expected_STREAM_OR_ALIAS_getInstance = kotlin_it_unibo_tuprolog_solve.$_$.d;
97
+ var Expected_IN_CHARACTER_getInstance = kotlin_it_unibo_tuprolog_solve.$_$.m;
98
+ var Companion_getInstance_15 = kotlin_it_unibo_tuprolog_solve.$_$.v1;
99
+ var Limit_CHARACTER_CODE_getInstance = kotlin_it_unibo_tuprolog_solve.$_$.i;
100
+ var Companion_getInstance_16 = kotlin_it_unibo_tuprolog_core.$_$.x;
101
+ var Integer = kotlin_it_unibo_tuprolog_core.$_$.u1;
102
+ var Map = kotlin_kotlin.$_$.w2;
103
+ var Expected_STREAM_TYPE_getInstance = kotlin_it_unibo_tuprolog_solve.$_$.f;
104
+ var format = kotlin_it_unibo_tuprolog_core.$_$.c3;
105
+ var Char = kotlin_kotlin.$_$.eb;
106
+ var charSequenceGet = kotlin_kotlin.$_$.k6;
107
+ var Char__toInt_impl_vasixd = kotlin_kotlin.$_$.g2;
108
+ var emptyList = kotlin_kotlin.$_$.s3;
109
+ var get_lastIndex = kotlin_kotlin.$_$.b4;
110
+ var toList_0 = kotlin_kotlin.$_$.p9;
111
+ var last = kotlin_kotlin.$_$.e4;
112
+ var Companion_getInstance_17 = kotlin_it_unibo_tuprolog_solve.$_$.w1;
113
+ var ParseException = kotlin_it_unibo_tuprolog_parser_core.$_$.d;
114
+ var emptySet = kotlin_kotlin.$_$.u3;
115
+ var noWhenBranchMatchedException = kotlin_kotlin.$_$.yb;
116
+ var KProperty1 = kotlin_kotlin.$_$.d8;
117
+ var getPropertyCallableRef = kotlin_kotlin.$_$.r6;
118
+ var NonBacktrackable_1 = kotlin_it_unibo_tuprolog_solve.$_$.p3;
119
+ var NonBacktrackable_2 = kotlin_it_unibo_tuprolog_solve.$_$.m3;
120
+ var Companion_getInstance_18 = kotlin_it_unibo_tuprolog_parser_theory.$_$.a;
121
+ var Companion_getInstance_19 = kotlin_it_unibo_tuprolog_theory.$_$.b;
122
+ var Companion_getInstance_20 = kotlin_it_unibo_tuprolog_theory.$_$.a;
123
+ var charSequenceLength = kotlin_kotlin.$_$.l6;
124
+ var toString = kotlin_kotlin.$_$.h2;
125
+ var titlecase = kotlin_kotlin.$_$.qa;
126
+ var isLowerCase = kotlin_kotlin.$_$.ba;
127
+ var toString_0 = kotlin_kotlin.$_$.n7;
128
+ var BinaryRelation = kotlin_it_unibo_tuprolog_solve.$_$.j3;
129
+ var distinct = kotlin_kotlin.$_$.l8;
130
+ var Info_getInstance = kotlin_it_unibo_tuprolog_core.$_$.k1;
131
+ var Platform_BROWSER_getInstance = kotlin_it_unibo_tuprolog_core.$_$.i;
132
+ var replace$default = kotlin_kotlin.$_$.r;
133
+ var KProperty0 = kotlin_kotlin.$_$.c8;
134
+ var toInt = kotlin_kotlin.$_$.va;
135
+ var getStringHashCode = kotlin_kotlin.$_$.s6;
136
+ //endregion
137
+ //region block: pre-declaration
138
+ setMetadataFor(IOLib, 'IOLib', objectMeta, AbstractLibrary, undefined, undefined, undefined, []);
139
+ setMetadataFor(Companion, 'Companion', objectMeta, undefined, undefined, undefined, undefined, []);
140
+ setMetadataFor(IOMode, 'IOMode', classMeta, Enum, undefined, undefined, undefined, []);
141
+ setMetadataFor(UrlField, 'UrlField', classMeta, Enum, undefined, undefined, undefined, []);
142
+ setMetadataFor(Companion_0, 'Companion', objectMeta, undefined, undefined, undefined, undefined, []);
143
+ function resolve(child) {
144
+ return Companion_getInstance_22().i3k(this.m3k(), this.n3k(), this.o3k(), this.k31() + '/' + child, this.x1v());
145
+ }
146
+ function div(child) {
147
+ return this.resolve(child);
148
+ }
149
+ function get_isFile() {
150
+ return this.m3k() === 'file';
151
+ }
152
+ function get_isHttp() {
153
+ var tmp = this.m3k();
154
+ return startsWith$default(tmp, 'http', false, 2, null);
155
+ }
156
+ setMetadataFor(Url, 'Url', interfaceMeta, undefined, undefined, undefined, undefined, []);
157
+ setMetadataFor(IOException, 'IOException', classMeta, TuPrologException, undefined, undefined, undefined, []);
158
+ setMetadataFor(InvalidUrlException, 'InvalidUrlException', classMeta, TuPrologException, undefined, undefined, undefined, []);
159
+ setMetadataFor(AtEndOfStream0, 'AtEndOfStream0', objectMeta, Predicative, undefined, undefined, undefined, []);
160
+ setMetadataFor(AtEndOfStream1, 'AtEndOfStream1', objectMeta, Predicative_0, undefined, undefined, undefined, []);
161
+ setMetadataFor(CharConversion, 'CharConversion', objectMeta, NonBacktrackable, undefined, undefined, undefined, []);
162
+ setMetadataFor(Close1, 'Close1', objectMeta, NonBacktrackable_0, undefined, undefined, undefined, []);
163
+ setMetadataFor(Close2, 'Close2', objectMeta, NonBacktrackable, undefined, undefined, undefined, []);
164
+ setMetadataFor(Consult, 'Consult', objectMeta, NonBacktrackable_0, undefined, undefined, undefined, []);
165
+ setMetadataFor(CurrentCharConversion, 'CurrentCharConversion', objectMeta, NonBacktrackable, undefined, undefined, undefined, []);
166
+ setMetadataFor(CurrentInput, 'CurrentInput', objectMeta, NonBacktrackable_0, undefined, undefined, undefined, []);
167
+ setMetadataFor(CurrentOutput, 'CurrentOutput', objectMeta, NonBacktrackable_0, undefined, undefined, undefined, []);
168
+ setMetadataFor(FlushOutput, 'FlushOutput', objectMeta, NonBacktrackable_0, undefined, undefined, undefined, []);
169
+ setMetadataFor(GetByte1, 'GetByte1', objectMeta, NonBacktrackable_0, undefined, undefined, undefined, []);
170
+ setMetadataFor(GetByte2, 'GetByte2', objectMeta, NonBacktrackable, undefined, undefined, undefined, []);
171
+ setMetadataFor(GetChar1, 'GetChar1', objectMeta, NonBacktrackable_0, undefined, undefined, undefined, []);
172
+ setMetadataFor(GetChar2, 'GetChar2', objectMeta, NonBacktrackable, undefined, undefined, undefined, []);
173
+ setMetadataFor(GetCode1, 'GetCode1', objectMeta, NonBacktrackable_0, undefined, undefined, undefined, []);
174
+ setMetadataFor(GetCode2, 'GetCode2', objectMeta, NonBacktrackable, undefined, undefined, undefined, []);
175
+ setMetadataFor(IOPrimitiveUtils$propertiesOf$slambda, 'IOPrimitiveUtils$propertiesOf$slambda', classMeta, CoroutineImpl, undefined, undefined, undefined, [1]);
176
+ setMetadataFor(IOPrimitiveUtils, 'IOPrimitiveUtils', objectMeta, undefined, undefined, undefined, undefined, []);
177
+ setMetadataFor(Nl1, 'Nl1', objectMeta, NonBacktrackable_0, undefined, undefined, undefined, []);
178
+ setMetadataFor(Open3, 'Open3', objectMeta, NonBacktrackable_1, undefined, undefined, undefined, []);
179
+ setMetadataFor(Open4, 'Open4', objectMeta, NonBacktrackable_2, undefined, undefined, undefined, []);
180
+ setMetadataFor(PeekByte1, 'PeekByte1', objectMeta, NonBacktrackable_0, undefined, undefined, undefined, []);
181
+ setMetadataFor(PeekByte2, 'PeekByte2', objectMeta, NonBacktrackable, undefined, undefined, undefined, []);
182
+ setMetadataFor(PeekChar1, 'PeekChar1', objectMeta, NonBacktrackable_0, undefined, undefined, undefined, []);
183
+ setMetadataFor(PeekChar2, 'PeekChar2', objectMeta, NonBacktrackable, undefined, undefined, undefined, []);
184
+ setMetadataFor(PeekCode1, 'PeekCode1', objectMeta, NonBacktrackable_0, undefined, undefined, undefined, []);
185
+ setMetadataFor(PeekCode2, 'PeekCode2', objectMeta, NonBacktrackable, undefined, undefined, undefined, []);
186
+ setMetadataFor(PutByte1, 'PutByte1', objectMeta, NonBacktrackable_0, undefined, undefined, undefined, []);
187
+ setMetadataFor(PutByte2, 'PutByte2', objectMeta, NonBacktrackable, undefined, undefined, undefined, []);
188
+ setMetadataFor(PutChar1, 'PutChar1', objectMeta, NonBacktrackable_0, undefined, undefined, undefined, []);
189
+ setMetadataFor(PutChar2, 'PutChar2', objectMeta, NonBacktrackable, undefined, undefined, undefined, []);
190
+ setMetadataFor(PutCode1, 'PutCode1', objectMeta, NonBacktrackable_0, undefined, undefined, undefined, []);
191
+ setMetadataFor(PutCode2, 'PutCode2', objectMeta, NonBacktrackable, undefined, undefined, undefined, []);
192
+ setMetadataFor(Read1, 'Read1', objectMeta, NonBacktrackable_0, undefined, undefined, undefined, []);
193
+ setMetadataFor(Read2, 'Read2', objectMeta, NonBacktrackable, undefined, undefined, undefined, []);
194
+ setMetadataFor(ReadTerm2, 'ReadTerm2', objectMeta, NonBacktrackable, undefined, undefined, undefined, []);
195
+ setMetadataFor(ReadTerm3, 'ReadTerm3', objectMeta, NonBacktrackable_1, undefined, undefined, undefined, []);
196
+ setMetadataFor(SetInput, 'SetInput', objectMeta, NonBacktrackable_0, undefined, undefined, undefined, []);
197
+ setMetadataFor(SetOutput, 'SetOutput', objectMeta, NonBacktrackable_0, undefined, undefined, undefined, []);
198
+ setMetadataFor(SetTheory, 'SetTheory', objectMeta, NonBacktrackable_0, undefined, undefined, undefined, []);
199
+ setMetadataFor(StreamProperty, 'StreamProperty', objectMeta, BinaryRelation, undefined, undefined, undefined, []);
200
+ setMetadataFor(Write2, 'Write2', objectMeta, NonBacktrackable, undefined, undefined, undefined, []);
201
+ setMetadataFor(WriteCanonical1, 'WriteCanonical1', objectMeta, NonBacktrackable_0, undefined, undefined, undefined, []);
202
+ setMetadataFor(WriteCanonical2, 'WriteCanonical2', objectMeta, NonBacktrackable, undefined, undefined, undefined, []);
203
+ setMetadataFor(WriteEq1, 'WriteEq1', objectMeta, NonBacktrackable_0, undefined, undefined, undefined, []);
204
+ setMetadataFor(WriteEq2, 'WriteEq2', objectMeta, NonBacktrackable, undefined, undefined, undefined, []);
205
+ setMetadataFor(WriteTerm2, 'WriteTerm2', objectMeta, NonBacktrackable, undefined, undefined, undefined, []);
206
+ setMetadataFor(WriteTerm3, 'WriteTerm3', objectMeta, NonBacktrackable_1, undefined, undefined, undefined, []);
207
+ setMetadataFor(JsUrl, 'JsUrl', classMeta, undefined, [Url], undefined, undefined, []);
208
+ //endregion
209
+ function IOLib() {
210
+ IOLib_instance = this;
211
+ AbstractLibrary.call(this);
212
+ }
213
+ IOLib.prototype.i2e = function () {
214
+ return 'prolog.io';
215
+ };
216
+ IOLib.prototype.h2e = function () {
217
+ var tmp = Companion_getInstance();
218
+ var tmp$ret$3;
219
+ // Inline function 'kotlin.collections.map' call
220
+ var tmp0_map = listOf([AtEndOfStream0_getInstance(), AtEndOfStream1_getInstance(), CharConversion_getInstance(), Close1_getInstance(), Close2_getInstance(), Consult_getInstance(), CurrentCharConversion_getInstance(), CurrentInput_getInstance(), CurrentOutput_getInstance(), FlushOutput_getInstance(), GetByte1_getInstance(), GetByte2_getInstance(), GetChar1_getInstance(), GetChar2_getInstance(), GetCode1_getInstance(), GetCode2_getInstance(), Nl1_getInstance(), Open3_getInstance(), Open4_getInstance(), PeekByte1_getInstance(), PeekByte2_getInstance(), PeekChar1_getInstance(), PeekChar2_getInstance(), PeekCode1_getInstance(), PeekCode2_getInstance(), PutByte1_getInstance(), PutByte2_getInstance(), PutChar1_getInstance(), PutChar2_getInstance(), PutCode1_getInstance(), PutCode2_getInstance(), Read1_getInstance(), Read2_getInstance(), ReadTerm2_getInstance(), ReadTerm3_getInstance(), SetInput_getInstance(), SetOutput_getInstance(), SetTheory_getInstance(), StreamProperty_getInstance(), Write2_getInstance(), WriteCanonical1_getInstance(), WriteCanonical2_getInstance(), WriteEq1_getInstance(), WriteEq2_getInstance(), WriteTerm2_getInstance(), WriteTerm3_getInstance()]);
221
+ var tmp$ret$2;
222
+ // Inline function 'kotlin.collections.mapTo' call
223
+ var tmp0_mapTo = ArrayList_init_$Create$(collectionSizeOrDefault(tmp0_map, 10));
224
+ var tmp0_iterator = tmp0_map.j();
225
+ while (tmp0_iterator.m()) {
226
+ var item = tmp0_iterator.p();
227
+ var tmp$ret$1;
228
+ // Inline function 'it.unibo.tuprolog.solve.libs.io.IOLib.<get-primitives>.<anonymous>' call
229
+ var tmp$ret$0;
230
+ // Inline function 'it.unibo.tuprolog.solve.AbstractWrapper.descriptionPair' call
231
+ tmp$ret$0 = to(item.signature, item.j1u());
232
+ tmp$ret$1 = tmp$ret$0;
233
+ tmp0_mapTo.g(tmp$ret$1);
234
+ }
235
+ tmp$ret$2 = tmp0_mapTo;
236
+ tmp$ret$3 = tmp$ret$2;
237
+ return tmp.iterableToMapEnsuringNoDuplicates(tmp$ret$3);
238
+ };
239
+ var IOLib_instance;
240
+ function IOLib_getInstance() {
241
+ if (IOLib_instance == null)
242
+ new IOLib();
243
+ return IOLib_instance;
244
+ }
245
+ function IOMode$Companion$atomValues$lambda(it) {
246
+ var tmp$ret$1;
247
+ // Inline function 'kotlin.text.lowercase' call
248
+ var tmp0_lowercase = it.q1_1;
249
+ var tmp$ret$0;
250
+ // Inline function 'kotlin.js.asDynamic' call
251
+ tmp$ret$0 = tmp0_lowercase;
252
+ tmp$ret$1 = tmp$ret$0.toLowerCase();
253
+ return tmp$ret$1;
254
+ }
255
+ function Atom$Companion$of$ref($boundThis) {
256
+ var l = function (p0) {
257
+ return $boundThis.of(p0);
258
+ };
259
+ l.callableName = 'of';
260
+ return l;
261
+ }
262
+ var IOMode_READ_instance;
263
+ var IOMode_WRITE_instance;
264
+ var IOMode_APPEND_instance;
265
+ function Companion() {
266
+ Companion_instance = this;
267
+ var tmp = this;
268
+ var tmp_0 = asSequence(values());
269
+ var tmp_1 = map(tmp_0, IOMode$Companion$atomValues$lambda);
270
+ tmp.f3k_1 = toSet(map(tmp_1, Atom$Companion$of$ref(Companion_getInstance_0())));
271
+ }
272
+ var Companion_instance;
273
+ function Companion_getInstance_21() {
274
+ IOMode_initEntries();
275
+ if (Companion_instance == null)
276
+ new Companion();
277
+ return Companion_instance;
278
+ }
279
+ function values() {
280
+ return [IOMode_READ_getInstance(), IOMode_WRITE_getInstance(), IOMode_APPEND_getInstance()];
281
+ }
282
+ function valueOf(value) {
283
+ switch (value) {
284
+ case 'READ':
285
+ return IOMode_READ_getInstance();
286
+ case 'WRITE':
287
+ return IOMode_WRITE_getInstance();
288
+ case 'APPEND':
289
+ return IOMode_APPEND_getInstance();
290
+ default:
291
+ IOMode_initEntries();
292
+ THROW_ISE();
293
+ break;
294
+ }
295
+ }
296
+ var IOMode_entriesInitialized;
297
+ function IOMode_initEntries() {
298
+ if (IOMode_entriesInitialized)
299
+ return Unit_getInstance();
300
+ IOMode_entriesInitialized = true;
301
+ IOMode_READ_instance = new IOMode('READ', 0);
302
+ IOMode_WRITE_instance = new IOMode('WRITE', 1);
303
+ IOMode_APPEND_instance = new IOMode('APPEND', 2);
304
+ Companion_getInstance_21();
305
+ }
306
+ function IOMode(name, ordinal) {
307
+ Enum.call(this, name, ordinal);
308
+ }
309
+ function IOMode_READ_getInstance() {
310
+ IOMode_initEntries();
311
+ return IOMode_READ_instance;
312
+ }
313
+ function IOMode_WRITE_getInstance() {
314
+ IOMode_initEntries();
315
+ return IOMode_WRITE_instance;
316
+ }
317
+ function IOMode_APPEND_getInstance() {
318
+ IOMode_initEntries();
319
+ return IOMode_APPEND_instance;
320
+ }
321
+ var UrlField_PROTOCOL_instance;
322
+ var UrlField_UNIT_instance;
323
+ var UrlField_HOST_instance;
324
+ var UrlField_PORT_instance;
325
+ var UrlField_PATH_instance;
326
+ var UrlField_QUERY_instance;
327
+ var UrlField_ANCHOR_instance;
328
+ function values_0() {
329
+ return [UrlField_PROTOCOL_getInstance(), UrlField_UNIT_getInstance(), UrlField_HOST_getInstance(), UrlField_PORT_getInstance(), UrlField_PATH_getInstance(), UrlField_QUERY_getInstance(), UrlField_ANCHOR_getInstance()];
330
+ }
331
+ var UrlField_entriesInitialized;
332
+ function UrlField_initEntries() {
333
+ if (UrlField_entriesInitialized)
334
+ return Unit_getInstance();
335
+ UrlField_entriesInitialized = true;
336
+ UrlField_PROTOCOL_instance = new UrlField('PROTOCOL', 0);
337
+ UrlField_UNIT_instance = new UrlField('UNIT', 1);
338
+ UrlField_HOST_instance = new UrlField('HOST', 2);
339
+ UrlField_PORT_instance = new UrlField('PORT', 3);
340
+ UrlField_PATH_instance = new UrlField('PATH', 4);
341
+ UrlField_QUERY_instance = new UrlField('QUERY', 5);
342
+ UrlField_ANCHOR_instance = new UrlField('ANCHOR', 6);
343
+ }
344
+ function str(_this__u8e3s4, $this, transformation) {
345
+ return _this__u8e3s4 == null ? '' : transformation(_this__u8e3s4);
346
+ }
347
+ function UrlField(name, ordinal) {
348
+ Enum.call(this, name, ordinal);
349
+ }
350
+ function urlRegex($this, protocol, unit, host, port, path, query, anchor) {
351
+ var protocolGroup = '(' + str(protocol, $this, Url$Companion$urlRegex$lambda) + '[\\w]+)';
352
+ var unitGroup = '(\\/?' + str(unit, $this, Url$Companion$urlRegex$lambda_0) + '[a-z]:)';
353
+ var hostGroup = '(' + str(host, $this, Url$Companion$urlRegex$lambda_1) + '[^\\s\\/]+[.][a-z]{2,})';
354
+ var portGroup = '(' + str(port, $this, Url$Companion$urlRegex$lambda_2) + '\\d+)';
355
+ var pathGroup = '(' + str(path, $this, Url$Companion$urlRegex$lambda_3) + '(?:\\/[^\\s?#\\/]+)*\\/?)';
356
+ var queryGroup = '(' + str(query, $this, Url$Companion$urlRegex$lambda_4) + '[^\\s\\/?#]+)';
357
+ var anchorGroup = '(' + str(anchor, $this, Url$Companion$urlRegex$lambda_5) + '.*)';
358
+ var pattern = protocolGroup + ':\\/+(?:' + unitGroup + '|' + hostGroup + '(?::' + portGroup + ')?)?' + pathGroup + '(?:\\?' + queryGroup + '?)?(?:#' + anchorGroup + ')?';
359
+ return Regex_init_$Create$(pattern, RegexOption_IGNORE_CASE_getInstance());
360
+ }
361
+ function urlRegex$default($this, protocol, unit, host, port, path, query, anchor, $mask0, $handler) {
362
+ if (!(($mask0 & 2) === 0))
363
+ protocol = null;
364
+ if (!(($mask0 & 4) === 0))
365
+ unit = null;
366
+ if (!(($mask0 & 8) === 0))
367
+ host = null;
368
+ if (!(($mask0 & 16) === 0))
369
+ port = null;
370
+ if (!(($mask0 & 32) === 0))
371
+ path = null;
372
+ if (!(($mask0 & 64) === 0))
373
+ query = null;
374
+ if (!(($mask0 & 128) === 0))
375
+ anchor = null;
376
+ return urlRegex($this, protocol, unit, host, port, path, query, anchor);
377
+ }
378
+ function Url$Companion$urlRegex$lambda(it) {
379
+ return '?<' + it + '>';
380
+ }
381
+ function Url$Companion$urlRegex$lambda_0(it) {
382
+ return '?' + it;
383
+ }
384
+ function Url$Companion$urlRegex$lambda_1(it) {
385
+ return '?<' + it + '>';
386
+ }
387
+ function Url$Companion$urlRegex$lambda_2(it) {
388
+ return '?<' + it + '>';
389
+ }
390
+ function Url$Companion$urlRegex$lambda_3(it) {
391
+ return '?<' + it + '>';
392
+ }
393
+ function Url$Companion$urlRegex$lambda_4(it) {
394
+ return '?<' + it + '>';
395
+ }
396
+ function Url$Companion$urlRegex$lambda_5(it) {
397
+ return '?<' + it + '>';
398
+ }
399
+ function Url$Companion$toString$lambda(it) {
400
+ return ':' + it;
401
+ }
402
+ function Url$Companion$toString$lambda_0(it) {
403
+ return '?' + it;
404
+ }
405
+ function UrlField_PROTOCOL_getInstance() {
406
+ UrlField_initEntries();
407
+ return UrlField_PROTOCOL_instance;
408
+ }
409
+ function UrlField_UNIT_getInstance() {
410
+ UrlField_initEntries();
411
+ return UrlField_UNIT_instance;
412
+ }
413
+ function UrlField_HOST_getInstance() {
414
+ UrlField_initEntries();
415
+ return UrlField_HOST_instance;
416
+ }
417
+ function UrlField_PORT_getInstance() {
418
+ UrlField_initEntries();
419
+ return UrlField_PORT_instance;
420
+ }
421
+ function UrlField_PATH_getInstance() {
422
+ UrlField_initEntries();
423
+ return UrlField_PATH_instance;
424
+ }
425
+ function UrlField_QUERY_getInstance() {
426
+ UrlField_initEntries();
427
+ return UrlField_QUERY_instance;
428
+ }
429
+ function UrlField_ANCHOR_getInstance() {
430
+ UrlField_initEntries();
431
+ return UrlField_ANCHOR_instance;
432
+ }
433
+ function Companion_0() {
434
+ Companion_instance_0 = this;
435
+ var tmp = this;
436
+ tmp.g3k_1 = urlRegex$default(this, null, null, null, null, null, null, null, 254, null);
437
+ }
438
+ Companion_0.prototype.h3k = function (_this__u8e3s4) {
439
+ var tmp;
440
+ if (_this__u8e3s4 < 0) {
441
+ throw IllegalArgumentException_init_$Create$('Invalid port: ' + _this__u8e3s4);
442
+ } else {
443
+ tmp = _this__u8e3s4;
444
+ }
445
+ return tmp;
446
+ };
447
+ Companion_0.prototype.e31 = function (string) {
448
+ var tmp0_safe_receiver = this.g3k_1.jf(string);
449
+ var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.l9();
450
+ var match = tmp1_safe_receiver == null ? null : toList(tmp1_safe_receiver);
451
+ var tmp2_safe_receiver = match;
452
+ var tmp;
453
+ if (tmp2_safe_receiver == null) {
454
+ tmp = null;
455
+ } else {
456
+ var tmp$ret$4;
457
+ // Inline function 'kotlin.let' call
458
+ // Inline function 'kotlin.contracts.contract' call
459
+ var tmp$ret$3;
460
+ // Inline function 'it.unibo.tuprolog.solve.libs.io.Companion.parse.<anonymous>' call
461
+ var tmp$ret$2;
462
+ // Inline function 'kotlin.collections.associate' call
463
+ var tmp0_associate = values_0();
464
+ var capacity = coerceAtLeast(mapCapacity(tmp0_associate.length), 16);
465
+ var tmp$ret$1;
466
+ // Inline function 'kotlin.collections.associateTo' call
467
+ var tmp1_associateTo = LinkedHashMap_init_$Create$(capacity);
468
+ var indexedObject = tmp0_associate;
469
+ var inductionVariable = 0;
470
+ var last = indexedObject.length;
471
+ while (inductionVariable < last) {
472
+ var element = indexedObject[inductionVariable];
473
+ inductionVariable = inductionVariable + 1 | 0;
474
+ // Inline function 'kotlin.collections.plusAssign' call
475
+ var tmp$ret$0;
476
+ // Inline function 'it.unibo.tuprolog.solve.libs.io.Companion.parse.<anonymous>.<anonymous>' call
477
+ var tmp0_safe_receiver_0 = tmp2_safe_receiver.n(element.r1_1 + 1 | 0);
478
+ tmp$ret$0 = to(element, tmp0_safe_receiver_0 == null ? null : tmp0_safe_receiver_0.qf_1);
479
+ var tmp0_plusAssign = tmp$ret$0;
480
+ tmp1_associateTo.w3(tmp0_plusAssign.g4_1, tmp0_plusAssign.h4_1);
481
+ }
482
+ tmp$ret$1 = tmp1_associateTo;
483
+ tmp$ret$2 = tmp$ret$1;
484
+ tmp$ret$3 = tmp$ret$2;
485
+ tmp$ret$4 = tmp$ret$3;
486
+ tmp = tmp$ret$4;
487
+ }
488
+ return tmp;
489
+ };
490
+ Companion_0.prototype.file = function (path) {
491
+ return fileUrl(path);
492
+ };
493
+ Companion_0.prototype.remote = function (protocol, host, port, path, query) {
494
+ return this.i3k(protocol, host === void 1 ? '' : host, port === void 1 ? null : port, path === void 1 ? '' : path, query === void 1 ? null : query);
495
+ };
496
+ Companion_0.prototype.i3k = function (protocol, host, port, path, query) {
497
+ return remoteUrl(protocol, host, port, path, query);
498
+ };
499
+ Companion_0.prototype.http = function (host, port, path, query) {
500
+ return this.j3k(host === void 1 ? '' : host, port === void 1 ? null : port, path === void 1 ? '' : path, query === void 1 ? null : query);
501
+ };
502
+ Companion_0.prototype.j3k = function (host, port, path, query) {
503
+ return this.i3k('http', host, port, path, query);
504
+ };
505
+ Companion_0.prototype.https = function (host, port, path, query) {
506
+ return this.k3k(host === void 1 ? '' : host, port === void 1 ? null : port, path === void 1 ? '' : path, query === void 1 ? null : query);
507
+ };
508
+ Companion_0.prototype.k3k = function (host, port, path, query) {
509
+ return this.i3k('https', host, port, path, query);
510
+ };
511
+ Companion_0.prototype.of = function (string) {
512
+ var tmp;
513
+ try {
514
+ tmp = parseUrl(string);
515
+ } catch ($p) {
516
+ var tmp_0;
517
+ if ($p instanceof InvalidUrlException) {
518
+ var tmp_1;
519
+ try {
520
+ tmp_1 = parseUrl('file://' + string);
521
+ } catch ($p) {
522
+ var tmp_2;
523
+ if ($p instanceof InvalidUrlException) {
524
+ throw $p;
525
+ } else {
526
+ throw $p;
527
+ }
528
+ tmp_1 = tmp_2;
529
+ }
530
+ tmp_0 = tmp_1;
531
+ } else {
532
+ throw $p;
533
+ }
534
+ tmp = tmp_0;
535
+ }
536
+ return tmp;
537
+ };
538
+ Companion_0.prototype.l3k = function (protocol, host, port, path, query) {
539
+ var tmp0_safe_receiver = port;
540
+ var tmp = tmp0_safe_receiver == null ? null : this.h3k(tmp0_safe_receiver);
541
+ var tmp_0 = str(tmp, this, Url$Companion$toString$lambda);
542
+ return protocol + '://' + host + tmp_0 + path + str(query, this, Url$Companion$toString$lambda_0);
543
+ };
544
+ var Companion_instance_0;
545
+ function Companion_getInstance_22() {
546
+ if (Companion_instance_0 == null)
547
+ new Companion_0();
548
+ return Companion_instance_0;
549
+ }
550
+ function Url() {
551
+ }
552
+ function IOException_init_$Init$(message, $this) {
553
+ TuPrologException_init_$Init$(message, $this);
554
+ IOException.call($this);
555
+ return $this;
556
+ }
557
+ function IOException_init_$Create$(message) {
558
+ var tmp = IOException_init_$Init$(message, Object.create(IOException.prototype));
559
+ captureStack(tmp, IOException_init_$Create$);
560
+ return tmp;
561
+ }
562
+ function IOException_init_$Init$_0(message, cause, $this) {
563
+ TuPrologException_init_$Init$_0(message, cause, $this);
564
+ IOException.call($this);
565
+ return $this;
566
+ }
567
+ function IOException_init_$Create$_0(message, cause) {
568
+ var tmp = IOException_init_$Init$_0(message, cause, Object.create(IOException.prototype));
569
+ captureStack(tmp, IOException_init_$Create$_0);
570
+ return tmp;
571
+ }
572
+ IOException.prototype.r3k = function (context) {
573
+ return Companion_getInstance_1().forUncaughtKtException(context, this);
574
+ };
575
+ function IOException() {
576
+ captureStack(this, IOException);
577
+ }
578
+ function InvalidUrlException_init_$Init$(message, $this) {
579
+ TuPrologException_init_$Init$(message, $this);
580
+ InvalidUrlException.call($this);
581
+ return $this;
582
+ }
583
+ function InvalidUrlException_init_$Create$(message) {
584
+ var tmp = InvalidUrlException_init_$Init$(message, Object.create(InvalidUrlException.prototype));
585
+ captureStack(tmp, InvalidUrlException_init_$Create$);
586
+ return tmp;
587
+ }
588
+ InvalidUrlException.prototype.s3k = function (context, signature, culprit, index) {
589
+ return Companion_getInstance_2().q25(context, signature, Expected_URL_getInstance(), culprit, index);
590
+ };
591
+ function InvalidUrlException() {
592
+ captureStack(this, InvalidUrlException);
593
+ }
594
+ function AtEndOfStream0() {
595
+ AtEndOfStream0_instance = this;
596
+ Predicative.call(this, 'at_end_of_stream');
597
+ }
598
+ AtEndOfStream0.prototype.u3k = function (_this__u8e3s4) {
599
+ var tmp$ret$1;
600
+ // Inline function 'kotlin.let' call
601
+ var tmp0_let = IOPrimitiveUtils_getInstance().m3l(_this__u8e3s4);
602
+ // Inline function 'kotlin.contracts.contract' call
603
+ var tmp$ret$0;
604
+ // Inline function 'it.unibo.tuprolog.solve.libs.io.primitives.AtEndOfStream0.compute.<anonymous>' call
605
+ tmp$ret$0 = tmp0_let.m1z() ? true : tmp0_let.wq();
606
+ tmp$ret$1 = tmp$ret$0;
607
+ return tmp$ret$1;
608
+ };
609
+ AtEndOfStream0.prototype.v2g = function (_this__u8e3s4) {
610
+ return this.u3k(_this__u8e3s4);
611
+ };
612
+ var AtEndOfStream0_instance;
613
+ function AtEndOfStream0_getInstance() {
614
+ if (AtEndOfStream0_instance == null)
615
+ new AtEndOfStream0();
616
+ return AtEndOfStream0_instance;
617
+ }
618
+ function AtEndOfStream1() {
619
+ AtEndOfStream1_instance = this;
620
+ Predicative_0.call(this, 'at_end_of_stream');
621
+ }
622
+ AtEndOfStream1.prototype.o3l = function (_this__u8e3s4, first) {
623
+ var tmp$ret$1;
624
+ // Inline function 'kotlin.let' call
625
+ var tmp0_let = IOPrimitiveUtils_getInstance().p3l(_this__u8e3s4, 0);
626
+ // Inline function 'kotlin.contracts.contract' call
627
+ var tmp$ret$0;
628
+ // Inline function 'it.unibo.tuprolog.solve.libs.io.primitives.AtEndOfStream1.compute.<anonymous>' call
629
+ tmp$ret$0 = tmp0_let.m1z() ? true : tmp0_let.wq();
630
+ tmp$ret$1 = tmp$ret$0;
631
+ return tmp$ret$1;
632
+ };
633
+ AtEndOfStream1.prototype.x2j = function (_this__u8e3s4, first) {
634
+ return this.o3l(_this__u8e3s4, first);
635
+ };
636
+ var AtEndOfStream1_instance;
637
+ function AtEndOfStream1_getInstance() {
638
+ if (AtEndOfStream1_instance == null)
639
+ new AtEndOfStream1();
640
+ return AtEndOfStream1_instance;
641
+ }
642
+ function CharConversion() {
643
+ CharConversion_instance = this;
644
+ NonBacktrackable.call(this, 'char_conversion');
645
+ }
646
+ CharConversion.prototype.x2p = function (_this__u8e3s4, first, second) {
647
+ var tmp = Companion_getInstance_3();
648
+ return tmp.j2h(_this__u8e3s4, null, 1, null);
649
+ };
650
+ CharConversion.prototype.a2g = function (_this__u8e3s4, first, second) {
651
+ return this.x2p(_this__u8e3s4, first, second);
652
+ };
653
+ var CharConversion_instance;
654
+ function CharConversion_getInstance() {
655
+ if (CharConversion_instance == null)
656
+ new CharConversion();
657
+ return CharConversion_instance;
658
+ }
659
+ function Close1$computeOne$lambda($this_computeOne, $channel) {
660
+ return function ($this$replySuccess) {
661
+ var tmp = $this_computeOne.context.a1v();
662
+ $this$replySuccess.h2n(tmp.aliasesOf(isInterface($channel, InputChannel) ? $channel : THROW_CCE()));
663
+ return Unit_getInstance();
664
+ };
665
+ }
666
+ function Close1$computeOne$lambda_0($this_computeOne, $channel) {
667
+ return function ($this$replySuccess) {
668
+ var tmp = $this_computeOne.context.b1v();
669
+ $this$replySuccess.k2n(tmp.aliasesOf(isInterface($channel, OutputChannel) ? $channel : THROW_CCE()));
670
+ return Unit_getInstance();
671
+ };
672
+ }
673
+ function Close1() {
674
+ Close1_instance = this;
675
+ NonBacktrackable_0.call(this, 'close');
676
+ }
677
+ Close1.prototype.g2p = function (_this__u8e3s4, first) {
678
+ var channel = IOPrimitiveUtils_getInstance().s3l(_this__u8e3s4, 0);
679
+ try {
680
+ channel.close();
681
+ var tmp0_subject = channel;
682
+ var tmp;
683
+ if (isInterface(tmp0_subject, InputChannel)) {
684
+ tmp = _this__u8e3s4.b2j(null, null, Close1$computeOne$lambda(_this__u8e3s4, channel), 3, null);
685
+ } else {
686
+ if (isInterface(tmp0_subject, OutputChannel)) {
687
+ tmp = _this__u8e3s4.b2j(null, null, Close1$computeOne$lambda_0(_this__u8e3s4, channel), 3, null);
688
+ } else {
689
+ throw IllegalStateException_init_$Create$('This should never happen');
690
+ }
691
+ }
692
+ return tmp;
693
+ } catch ($p) {
694
+ if ($p instanceof IllegalStateException) {
695
+ return _this__u8e3s4.l2g(null, [], 3, null);
696
+ } else {
697
+ throw $p;
698
+ }
699
+ }
700
+ };
701
+ Close1.prototype.a2k = function (_this__u8e3s4, first) {
702
+ return this.g2p(_this__u8e3s4, first);
703
+ };
704
+ var Close1_instance;
705
+ function Close1_getInstance() {
706
+ if (Close1_instance == null)
707
+ new Close1();
708
+ return Close1_instance;
709
+ }
710
+ function Close2() {
711
+ Close2_instance = this;
712
+ NonBacktrackable.call(this, 'close');
713
+ }
714
+ Close2.prototype.x2p = function (_this__u8e3s4, first, second) {
715
+ var tmp = Companion_getInstance_3();
716
+ return tmp.j2h(_this__u8e3s4, null, 1, null);
717
+ };
718
+ Close2.prototype.a2g = function (_this__u8e3s4, first, second) {
719
+ return this.x2p(_this__u8e3s4, first, second);
720
+ };
721
+ var Close2_instance;
722
+ function Close2_getInstance() {
723
+ if (Close2_instance == null)
724
+ new Close2();
725
+ return Close2_instance;
726
+ }
727
+ function Consult() {
728
+ Consult_instance = this;
729
+ NonBacktrackable_0.call(this, 'consult');
730
+ }
731
+ Consult.prototype.g2p = function (_this__u8e3s4, first) {
732
+ Companion_getInstance_3().h2h(_this__u8e3s4, 0);
733
+ Companion_getInstance_3().q2h(_this__u8e3s4, 0);
734
+ var urlString = (isInterface(first, Atom) ? first : THROW_CCE()).b1();
735
+ try {
736
+ var url = Companion_getInstance_22().of(urlString);
737
+ var text = url.readAsText();
738
+ var tmp = SetTheory_getInstance();
739
+ return tmp.w3l(_this__u8e3s4, text, false, 2, null);
740
+ } catch ($p) {
741
+ if ($p instanceof InvalidUrlException) {
742
+ throw $p.s3k(_this__u8e3s4.context, _this__u8e3s4.signature, first, 0);
743
+ } else {
744
+ if ($p instanceof IOException) {
745
+ throw $p.r3k(_this__u8e3s4.context);
746
+ } else {
747
+ throw $p;
748
+ }
749
+ }
750
+ }
751
+ };
752
+ Consult.prototype.a2k = function (_this__u8e3s4, first) {
753
+ return this.g2p(_this__u8e3s4, first);
754
+ };
755
+ var Consult_instance;
756
+ function Consult_getInstance() {
757
+ if (Consult_instance == null)
758
+ new Consult();
759
+ return Consult_instance;
760
+ }
761
+ function CurrentCharConversion() {
762
+ CurrentCharConversion_instance = this;
763
+ NonBacktrackable.call(this, 'current_char_conversion');
764
+ }
765
+ CurrentCharConversion.prototype.x2p = function (_this__u8e3s4, first, second) {
766
+ var tmp = Companion_getInstance_3();
767
+ return tmp.j2h(_this__u8e3s4, null, 1, null);
768
+ };
769
+ CurrentCharConversion.prototype.a2g = function (_this__u8e3s4, first, second) {
770
+ return this.x2p(_this__u8e3s4, first, second);
771
+ };
772
+ var CurrentCharConversion_instance;
773
+ function CurrentCharConversion_getInstance() {
774
+ if (CurrentCharConversion_instance == null)
775
+ new CurrentCharConversion();
776
+ return CurrentCharConversion_instance;
777
+ }
778
+ function CurrentInput() {
779
+ CurrentInput_instance = this;
780
+ NonBacktrackable_0.call(this, 'current_input');
781
+ }
782
+ CurrentInput.prototype.g2p = function (_this__u8e3s4, first) {
783
+ var channel = IOPrimitiveUtils_getInstance().z3l(_this__u8e3s4, 0);
784
+ var tmp$ret$1;
785
+ // Inline function 'kotlin.let' call
786
+ var tmp0_let = _this__u8e3s4.context.a1v();
787
+ // Inline function 'kotlin.contracts.contract' call
788
+ var tmp$ret$0;
789
+ // Inline function 'it.unibo.tuprolog.solve.libs.io.primitives.CurrentInput.computeOne.<anonymous>' call
790
+ var tmp0_elvis_lhs = tmp0_let.uq();
791
+ tmp$ret$0 = tmp0_elvis_lhs == null ? tmp0_let.j1v() : tmp0_elvis_lhs;
792
+ tmp$ret$1 = tmp$ret$0;
793
+ var currentChannel = tmp$ret$1;
794
+ var tmp0_subject = channel;
795
+ var tmp;
796
+ if (tmp0_subject == null) {
797
+ var tmp_0 = Companion_getInstance_3().b2h(_this__u8e3s4, first, currentChannel.g1z());
798
+ tmp = _this__u8e3s4.g2g(tmp_0, null, [], 6, null);
799
+ } else if (equals(tmp0_subject, currentChannel)) {
800
+ tmp = _this__u8e3s4.m2g(null, null, [], 7, null);
801
+ } else {
802
+ tmp = _this__u8e3s4.l2g(null, [], 3, null);
803
+ }
804
+ return tmp;
805
+ };
806
+ CurrentInput.prototype.a2k = function (_this__u8e3s4, first) {
807
+ return this.g2p(_this__u8e3s4, first);
808
+ };
809
+ var CurrentInput_instance;
810
+ function CurrentInput_getInstance() {
811
+ if (CurrentInput_instance == null)
812
+ new CurrentInput();
813
+ return CurrentInput_instance;
814
+ }
815
+ function CurrentOutput() {
816
+ CurrentOutput_instance = this;
817
+ NonBacktrackable_0.call(this, 'current_output');
818
+ }
819
+ CurrentOutput.prototype.g2p = function (_this__u8e3s4, first) {
820
+ var channel = IOPrimitiveUtils_getInstance().z3l(_this__u8e3s4, 0);
821
+ var tmp$ret$1;
822
+ // Inline function 'kotlin.let' call
823
+ var tmp0_let = _this__u8e3s4.context.b1v();
824
+ // Inline function 'kotlin.contracts.contract' call
825
+ var tmp$ret$0;
826
+ // Inline function 'it.unibo.tuprolog.solve.libs.io.primitives.CurrentOutput.computeOne.<anonymous>' call
827
+ var tmp0_elvis_lhs = tmp0_let.uq();
828
+ tmp$ret$0 = tmp0_elvis_lhs == null ? tmp0_let.l1v() : tmp0_elvis_lhs;
829
+ tmp$ret$1 = tmp$ret$0;
830
+ var currentChannel = tmp$ret$1;
831
+ var tmp0_subject = channel;
832
+ var tmp;
833
+ if (tmp0_subject == null) {
834
+ var tmp_0 = Companion_getInstance_3().b2h(_this__u8e3s4, first, currentChannel.g1z());
835
+ tmp = _this__u8e3s4.g2g(tmp_0, null, [], 6, null);
836
+ } else if (equals(tmp0_subject, currentChannel)) {
837
+ tmp = _this__u8e3s4.m2g(null, null, [], 7, null);
838
+ } else {
839
+ tmp = _this__u8e3s4.l2g(null, [], 3, null);
840
+ }
841
+ return tmp;
842
+ };
843
+ CurrentOutput.prototype.a2k = function (_this__u8e3s4, first) {
844
+ return this.g2p(_this__u8e3s4, first);
845
+ };
846
+ var CurrentOutput_instance;
847
+ function CurrentOutput_getInstance() {
848
+ if (CurrentOutput_instance == null)
849
+ new CurrentOutput();
850
+ return CurrentOutput_instance;
851
+ }
852
+ function FlushOutput() {
853
+ FlushOutput_instance = this;
854
+ NonBacktrackable_0.call(this, 'flush_output');
855
+ }
856
+ FlushOutput.prototype.g2p = function (_this__u8e3s4, first) {
857
+ var channel = IOPrimitiveUtils_getInstance().c3m(_this__u8e3s4, 0);
858
+ var tmp;
859
+ try {
860
+ channel.flush();
861
+ tmp = _this__u8e3s4.m2g(null, null, [], 7, null);
862
+ } catch ($p) {
863
+ var tmp_0;
864
+ if ($p instanceof IllegalStateException) {
865
+ tmp_0 = _this__u8e3s4.l2g(null, [], 3, null);
866
+ } else {
867
+ throw $p;
868
+ }
869
+ tmp = tmp_0;
870
+ }
871
+ return tmp;
872
+ };
873
+ FlushOutput.prototype.a2k = function (_this__u8e3s4, first) {
874
+ return this.g2p(_this__u8e3s4, first);
875
+ };
876
+ var FlushOutput_instance;
877
+ function FlushOutput_getInstance() {
878
+ if (FlushOutput_instance == null)
879
+ new FlushOutput();
880
+ return FlushOutput_instance;
881
+ }
882
+ function GetByte1() {
883
+ GetByte1_instance = this;
884
+ NonBacktrackable_0.call(this, 'get_byte');
885
+ }
886
+ GetByte1.prototype.g2p = function (_this__u8e3s4, first) {
887
+ var tmp = Companion_getInstance_3();
888
+ return tmp.j2h(_this__u8e3s4, null, 1, null);
889
+ };
890
+ GetByte1.prototype.a2k = function (_this__u8e3s4, first) {
891
+ return this.g2p(_this__u8e3s4, first);
892
+ };
893
+ var GetByte1_instance;
894
+ function GetByte1_getInstance() {
895
+ if (GetByte1_instance == null)
896
+ new GetByte1();
897
+ return GetByte1_instance;
898
+ }
899
+ function GetByte2() {
900
+ GetByte2_instance = this;
901
+ NonBacktrackable.call(this, 'get_byte');
902
+ }
903
+ GetByte2.prototype.x2p = function (_this__u8e3s4, first, second) {
904
+ var tmp = Companion_getInstance_3();
905
+ return tmp.j2h(_this__u8e3s4, null, 1, null);
906
+ };
907
+ GetByte2.prototype.a2g = function (_this__u8e3s4, first, second) {
908
+ return this.x2p(_this__u8e3s4, first, second);
909
+ };
910
+ var GetByte2_instance;
911
+ function GetByte2_getInstance() {
912
+ if (GetByte2_instance == null)
913
+ new GetByte2();
914
+ return GetByte2_instance;
915
+ }
916
+ function GetChar1() {
917
+ GetChar1_instance = this;
918
+ NonBacktrackable_0.call(this, 'get_char');
919
+ }
920
+ GetChar1.prototype.g2p = function (_this__u8e3s4, first) {
921
+ IOPrimitiveUtils_getInstance().g3m(_this__u8e3s4, 0);
922
+ return IOPrimitiveUtils_getInstance().h3m(_this__u8e3s4, IOPrimitiveUtils_getInstance().m3l(_this__u8e3s4), first);
923
+ };
924
+ GetChar1.prototype.a2k = function (_this__u8e3s4, first) {
925
+ return this.g2p(_this__u8e3s4, first);
926
+ };
927
+ var GetChar1_instance;
928
+ function GetChar1_getInstance() {
929
+ if (GetChar1_instance == null)
930
+ new GetChar1();
931
+ return GetChar1_instance;
932
+ }
933
+ function GetChar2() {
934
+ GetChar2_instance = this;
935
+ NonBacktrackable.call(this, 'get_char');
936
+ }
937
+ GetChar2.prototype.x2p = function (_this__u8e3s4, first, second) {
938
+ var channel = IOPrimitiveUtils_getInstance().p3l(_this__u8e3s4, 0);
939
+ IOPrimitiveUtils_getInstance().g3m(_this__u8e3s4, 1);
940
+ return IOPrimitiveUtils_getInstance().h3m(_this__u8e3s4, channel, second);
941
+ };
942
+ GetChar2.prototype.a2g = function (_this__u8e3s4, first, second) {
943
+ return this.x2p(_this__u8e3s4, first, second);
944
+ };
945
+ var GetChar2_instance;
946
+ function GetChar2_getInstance() {
947
+ if (GetChar2_instance == null)
948
+ new GetChar2();
949
+ return GetChar2_instance;
950
+ }
951
+ function GetCode1() {
952
+ GetCode1_instance = this;
953
+ NonBacktrackable_0.call(this, 'get_code');
954
+ }
955
+ GetCode1.prototype.g2p = function (_this__u8e3s4, first) {
956
+ IOPrimitiveUtils_getInstance().k3m(_this__u8e3s4, 0);
957
+ return IOPrimitiveUtils_getInstance().l3m(_this__u8e3s4, IOPrimitiveUtils_getInstance().m3l(_this__u8e3s4), first);
958
+ };
959
+ GetCode1.prototype.a2k = function (_this__u8e3s4, first) {
960
+ return this.g2p(_this__u8e3s4, first);
961
+ };
962
+ var GetCode1_instance;
963
+ function GetCode1_getInstance() {
964
+ if (GetCode1_instance == null)
965
+ new GetCode1();
966
+ return GetCode1_instance;
967
+ }
968
+ function GetCode2() {
969
+ GetCode2_instance = this;
970
+ NonBacktrackable.call(this, 'get_code');
971
+ }
972
+ GetCode2.prototype.x2p = function (_this__u8e3s4, first, second) {
973
+ var channel = IOPrimitiveUtils_getInstance().p3l(_this__u8e3s4, 0);
974
+ IOPrimitiveUtils_getInstance().k3m(_this__u8e3s4, 0);
975
+ return IOPrimitiveUtils_getInstance().l3m(_this__u8e3s4, channel, first);
976
+ };
977
+ GetCode2.prototype.a2g = function (_this__u8e3s4, first, second) {
978
+ return this.x2p(_this__u8e3s4, first, second);
979
+ };
980
+ var GetCode2_instance;
981
+ function GetCode2_getInstance() {
982
+ if (GetCode2_instance == null)
983
+ new GetCode2();
984
+ return GetCode2_instance;
985
+ }
986
+ function IOPrimitiveUtils$propertiesOf$slambda$lambda(it) {
987
+ Companion_getInstance_4();
988
+ return it === '$current';
989
+ }
990
+ function IOPrimitiveUtils$alias$ref($boundThis) {
991
+ var l = function (p0) {
992
+ return alias($boundThis, p0);
993
+ };
994
+ l.callableName = 'alias';
995
+ return l;
996
+ }
997
+ function IOPrimitiveUtils$propertiesOf$slambda$lambda_0(it) {
998
+ Companion_getInstance_4();
999
+ return it === '$current';
1000
+ }
1001
+ function IOPrimitiveUtils$alias$ref_0($boundThis) {
1002
+ var l = function (p0) {
1003
+ return alias($boundThis, p0);
1004
+ };
1005
+ l.callableName = 'alias';
1006
+ return l;
1007
+ }
1008
+ function _get_INPUT_STREAM_TERM_PATTERN__5fd8p6($this) {
1009
+ var tmp$ret$0;
1010
+ // Inline function 'kotlin.getValue' call
1011
+ var tmp0_getValue = INPUT_STREAM_TERM_PATTERN$factory();
1012
+ tmp$ret$0 = $this.v3k_1.b1();
1013
+ return tmp$ret$0;
1014
+ }
1015
+ function _get_OUTPUT_STREAM_TERM_PATTERN__4vocxf($this) {
1016
+ var tmp$ret$0;
1017
+ // Inline function 'kotlin.getValue' call
1018
+ var tmp0_getValue = OUTPUT_STREAM_TERM_PATTERN$factory();
1019
+ tmp$ret$0 = $this.w3k_1.b1();
1020
+ return tmp$ret$0;
1021
+ }
1022
+ function _get_PROPERTY_TYPE_PATTERN__5nq864($this) {
1023
+ var tmp$ret$0;
1024
+ // Inline function 'kotlin.getValue' call
1025
+ var tmp0_getValue = PROPERTY_TYPE_PATTERN$factory();
1026
+ tmp$ret$0 = $this.x3k_1.b1();
1027
+ return tmp$ret$0;
1028
+ }
1029
+ function _get_PROPERTY_REPOSITION_PATTERN__lznuii($this) {
1030
+ var tmp$ret$0;
1031
+ // Inline function 'kotlin.getValue' call
1032
+ var tmp0_getValue = PROPERTY_REPOSITION_PATTERN$factory();
1033
+ tmp$ret$0 = $this.y3k_1.b1();
1034
+ return tmp$ret$0;
1035
+ }
1036
+ function _get_PROPERTY_EOF_ACTION_PATTERN__8k2shv($this) {
1037
+ var tmp$ret$0;
1038
+ // Inline function 'kotlin.getValue' call
1039
+ var tmp0_getValue = PROPERTY_EOF_ACTION_PATTERN$factory();
1040
+ tmp$ret$0 = $this.z3k_1.b1();
1041
+ return tmp$ret$0;
1042
+ }
1043
+ function _get_PROPERTY_ALIAS_PATTERN__wipd2s($this) {
1044
+ var tmp$ret$0;
1045
+ // Inline function 'kotlin.getValue' call
1046
+ var tmp0_getValue = PROPERTY_ALIAS_PATTERN$factory();
1047
+ tmp$ret$0 = $this.a3l_1.b1();
1048
+ return tmp$ret$0;
1049
+ }
1050
+ function _get_PROPERTY_INPUT__z2zr91($this) {
1051
+ var tmp$ret$0;
1052
+ // Inline function 'kotlin.getValue' call
1053
+ var tmp0_getValue = PROPERTY_INPUT$factory();
1054
+ tmp$ret$0 = $this.b3l_1.b1();
1055
+ return tmp$ret$0;
1056
+ }
1057
+ function _get_PROPERTY_OUTPUT__1pem9m($this) {
1058
+ var tmp$ret$0;
1059
+ // Inline function 'kotlin.getValue' call
1060
+ var tmp0_getValue = PROPERTY_OUTPUT$factory();
1061
+ tmp$ret$0 = $this.c3l_1.b1();
1062
+ return tmp$ret$0;
1063
+ }
1064
+ function _get_PROPERTY_TYPE_TEXT__9rpcwt($this) {
1065
+ var tmp$ret$0;
1066
+ // Inline function 'kotlin.getValue' call
1067
+ var tmp0_getValue = PROPERTY_TYPE_TEXT$factory();
1068
+ tmp$ret$0 = $this.d3l_1.b1();
1069
+ return tmp$ret$0;
1070
+ }
1071
+ function _get_PROPERTY_REPOSITION_FALSE__i73t3b($this) {
1072
+ var tmp$ret$0;
1073
+ // Inline function 'kotlin.getValue' call
1074
+ var tmp0_getValue = PROPERTY_REPOSITION_FALSE$factory();
1075
+ tmp$ret$0 = $this.e3l_1.b1();
1076
+ return tmp$ret$0;
1077
+ }
1078
+ function _get_PROPERTY_EOF_ACTION_EOF_CODE__he3pvl($this) {
1079
+ var tmp$ret$0;
1080
+ // Inline function 'kotlin.getValue' call
1081
+ var tmp0_getValue = PROPERTY_EOF_ACTION_EOF_CODE$factory();
1082
+ tmp$ret$0 = $this.f3l_1.b1();
1083
+ return tmp$ret$0;
1084
+ }
1085
+ function _get_OPTION_QUOTED_PATTERN__n2ri42($this) {
1086
+ var tmp$ret$0;
1087
+ // Inline function 'kotlin.getValue' call
1088
+ var tmp0_getValue = OPTION_QUOTED_PATTERN$factory();
1089
+ tmp$ret$0 = $this.g3l_1.b1();
1090
+ return tmp$ret$0;
1091
+ }
1092
+ function _get_OPTION_NUMBER_VARS_PATTERN__p98ste($this) {
1093
+ var tmp$ret$0;
1094
+ // Inline function 'kotlin.getValue' call
1095
+ var tmp0_getValue = OPTION_NUMBER_VARS_PATTERN$factory();
1096
+ tmp$ret$0 = $this.h3l_1.b1();
1097
+ return tmp$ret$0;
1098
+ }
1099
+ function _get_OPTION_IGNORE_OPS_PATTERN__cpse4v($this) {
1100
+ var tmp$ret$0;
1101
+ // Inline function 'kotlin.getValue' call
1102
+ var tmp0_getValue = OPTION_IGNORE_OPS_PATTERN$factory();
1103
+ tmp$ret$0 = $this.i3l_1.b1();
1104
+ return tmp$ret$0;
1105
+ }
1106
+ function _get_INFO_VARIABLES_PATTERN__bhp1h0($this) {
1107
+ var tmp$ret$0;
1108
+ // Inline function 'kotlin.getValue' call
1109
+ var tmp0_getValue = INFO_VARIABLES_PATTERN$factory();
1110
+ tmp$ret$0 = $this.j3l_1.b1();
1111
+ return tmp$ret$0;
1112
+ }
1113
+ function _get_INFO_VARIABLE_NAMES_PATTERN__j3oaom($this) {
1114
+ var tmp$ret$0;
1115
+ // Inline function 'kotlin.getValue' call
1116
+ var tmp0_getValue = INFO_VARIABLE_NAMES_PATTERN$factory();
1117
+ tmp$ret$0 = $this.k3l_1.b1();
1118
+ return tmp$ret$0;
1119
+ }
1120
+ function _get_INFO_SINGLETONS_PATTERN__y21s87($this) {
1121
+ var tmp$ret$0;
1122
+ // Inline function 'kotlin.getValue' call
1123
+ var tmp0_getValue = INFO_SINGLETONS_PATTERN$factory();
1124
+ tmp$ret$0 = $this.l3l_1.b1();
1125
+ return tmp$ret$0;
1126
+ }
1127
+ function _get_validPropertiesPattern__7s1t06($this) {
1128
+ return sequenceOf([_get_PROPERTY_INPUT__z2zr91($this), _get_PROPERTY_OUTPUT__1pem9m($this), _get_PROPERTY_ALIAS_PATTERN__wipd2s($this), _get_PROPERTY_TYPE_PATTERN__5nq864($this), _get_PROPERTY_EOF_ACTION_PATTERN__8k2shv($this), _get_PROPERTY_REPOSITION_PATTERN__lznuii($this)]);
1129
+ }
1130
+ function _get_validOptionsPattern__akhsd9($this) {
1131
+ var tmp = IOPrimitiveUtils$quoted$ref($this);
1132
+ var tmp_0 = IOPrimitiveUtils$ignoreOps$ref($this);
1133
+ var tmp_1 = sequenceOf([tmp, tmp_0, IOPrimitiveUtils$numberVars$ref($this)]);
1134
+ return flatMap(tmp_1, IOPrimitiveUtils$_get_validOptionsPattern_$lambda_r088xw);
1135
+ }
1136
+ function _get_validInfoPattern__dtwgth($this) {
1137
+ return sequenceOf([_get_INFO_VARIABLES_PATTERN__bhp1h0($this), _get_INFO_VARIABLE_NAMES_PATTERN__j3oaom($this), _get_INFO_SINGLETONS_PATTERN__y21s87($this)]);
1138
+ }
1139
+ function _get_supportedPropertiesPattern__x8u7bw($this) {
1140
+ return sequenceOf([_get_PROPERTY_INPUT__z2zr91($this), _get_PROPERTY_OUTPUT__1pem9m($this), _get_PROPERTY_ALIAS_PATTERN__wipd2s($this), _get_PROPERTY_TYPE_TEXT__9rpcwt($this), _get_PROPERTY_EOF_ACTION_EOF_CODE__he3pvl($this), _get_PROPERTY_REPOSITION_FALSE__i73t3b($this)]);
1141
+ }
1142
+ function alias($this, alias) {
1143
+ var tmp = Companion_getInstance_5();
1144
+ var tmp0_safe_receiver = alias;
1145
+ var tmp_0;
1146
+ if (tmp0_safe_receiver == null) {
1147
+ tmp_0 = null;
1148
+ } else {
1149
+ var tmp$ret$1;
1150
+ // Inline function 'kotlin.let' call
1151
+ // Inline function 'kotlin.contracts.contract' call
1152
+ var tmp$ret$0;
1153
+ // Inline function 'it.unibo.tuprolog.solve.libs.io.primitives.IOPrimitiveUtils.alias.<anonymous>' call
1154
+ tmp$ret$0 = Companion_getInstance_0().of(tmp0_safe_receiver);
1155
+ tmp$ret$1 = tmp$ret$0;
1156
+ tmp_0 = tmp$ret$1;
1157
+ }
1158
+ var tmp1_elvis_lhs = tmp_0;
1159
+ return tmp.of('alias', [tmp1_elvis_lhs == null ? Companion_getInstance_6().anonymous() : tmp1_elvis_lhs]);
1160
+ }
1161
+ function alias$default($this, alias_0, $mask0, $handler) {
1162
+ if (!(($mask0 & 2) === 0))
1163
+ alias_0 = null;
1164
+ return alias($this, alias_0);
1165
+ }
1166
+ function quoted($this, value) {
1167
+ var tmp = Companion_getInstance_5();
1168
+ var tmp0_safe_receiver = value;
1169
+ var tmp_0;
1170
+ if (tmp0_safe_receiver == null) {
1171
+ tmp_0 = null;
1172
+ } else {
1173
+ var tmp$ret$1;
1174
+ // Inline function 'kotlin.let' call
1175
+ // Inline function 'kotlin.contracts.contract' call
1176
+ var tmp$ret$0;
1177
+ // Inline function 'it.unibo.tuprolog.solve.libs.io.primitives.IOPrimitiveUtils.quoted.<anonymous>' call
1178
+ tmp$ret$0 = Companion_getInstance_7().of(tmp0_safe_receiver);
1179
+ tmp$ret$1 = tmp$ret$0;
1180
+ tmp_0 = tmp$ret$1;
1181
+ }
1182
+ var tmp1_elvis_lhs = tmp_0;
1183
+ return tmp.of('quoted', [tmp1_elvis_lhs == null ? Companion_getInstance_6().anonymous() : tmp1_elvis_lhs]);
1184
+ }
1185
+ function quoted$default($this, value, $mask0, $handler) {
1186
+ if (!(($mask0 & 2) === 0))
1187
+ value = null;
1188
+ return quoted($this, value);
1189
+ }
1190
+ function ignoreOps($this, value) {
1191
+ var tmp = Companion_getInstance_5();
1192
+ var tmp0_safe_receiver = value;
1193
+ var tmp_0;
1194
+ if (tmp0_safe_receiver == null) {
1195
+ tmp_0 = null;
1196
+ } else {
1197
+ var tmp$ret$1;
1198
+ // Inline function 'kotlin.let' call
1199
+ // Inline function 'kotlin.contracts.contract' call
1200
+ var tmp$ret$0;
1201
+ // Inline function 'it.unibo.tuprolog.solve.libs.io.primitives.IOPrimitiveUtils.ignoreOps.<anonymous>' call
1202
+ tmp$ret$0 = Companion_getInstance_7().of(tmp0_safe_receiver);
1203
+ tmp$ret$1 = tmp$ret$0;
1204
+ tmp_0 = tmp$ret$1;
1205
+ }
1206
+ var tmp1_elvis_lhs = tmp_0;
1207
+ return tmp.of('ignore_ops', [tmp1_elvis_lhs == null ? Companion_getInstance_6().anonymous() : tmp1_elvis_lhs]);
1208
+ }
1209
+ function ignoreOps$default($this, value, $mask0, $handler) {
1210
+ if (!(($mask0 & 2) === 0))
1211
+ value = null;
1212
+ return ignoreOps($this, value);
1213
+ }
1214
+ function numberVars($this, value) {
1215
+ var tmp = Companion_getInstance_5();
1216
+ var tmp0_safe_receiver = value;
1217
+ var tmp_0;
1218
+ if (tmp0_safe_receiver == null) {
1219
+ tmp_0 = null;
1220
+ } else {
1221
+ var tmp$ret$1;
1222
+ // Inline function 'kotlin.let' call
1223
+ // Inline function 'kotlin.contracts.contract' call
1224
+ var tmp$ret$0;
1225
+ // Inline function 'it.unibo.tuprolog.solve.libs.io.primitives.IOPrimitiveUtils.numberVars.<anonymous>' call
1226
+ tmp$ret$0 = Companion_getInstance_7().of(tmp0_safe_receiver);
1227
+ tmp$ret$1 = tmp$ret$0;
1228
+ tmp_0 = tmp$ret$1;
1229
+ }
1230
+ var tmp1_elvis_lhs = tmp_0;
1231
+ return tmp.of('numbervars', [tmp1_elvis_lhs == null ? Companion_getInstance_6().anonymous() : tmp1_elvis_lhs]);
1232
+ }
1233
+ function numberVars$default($this, value, $mask0, $handler) {
1234
+ if (!(($mask0 & 2) === 0))
1235
+ value = null;
1236
+ return numberVars($this, value);
1237
+ }
1238
+ function variables($this, variables) {
1239
+ var tmp = Companion_getInstance_5();
1240
+ var tmp0_safe_receiver = variables;
1241
+ var tmp_0;
1242
+ if (tmp0_safe_receiver == null) {
1243
+ tmp_0 = null;
1244
+ } else {
1245
+ var tmp$ret$1;
1246
+ // Inline function 'kotlin.let' call
1247
+ // Inline function 'kotlin.contracts.contract' call
1248
+ var tmp$ret$0;
1249
+ // Inline function 'it.unibo.tuprolog.solve.libs.io.primitives.IOPrimitiveUtils.variables.<anonymous>' call
1250
+ tmp$ret$0 = Companion_getInstance_8().ofList(tmp0_safe_receiver);
1251
+ tmp$ret$1 = tmp$ret$0;
1252
+ tmp_0 = tmp$ret$1;
1253
+ }
1254
+ var tmp1_elvis_lhs = tmp_0;
1255
+ return tmp.of('variables', [tmp1_elvis_lhs == null ? Companion_getInstance_6().anonymous() : tmp1_elvis_lhs]);
1256
+ }
1257
+ function variables$default($this, variables_0, $mask0, $handler) {
1258
+ if (!(($mask0 & 2) === 0))
1259
+ variables_0 = null;
1260
+ return variables($this, variables_0);
1261
+ }
1262
+ function vn($this, functor, vNames) {
1263
+ var tmp = Companion_getInstance_5();
1264
+ var tmp0_safe_receiver = vNames;
1265
+ var tmp_0;
1266
+ if (tmp0_safe_receiver == null) {
1267
+ tmp_0 = null;
1268
+ } else {
1269
+ var tmp$ret$2;
1270
+ // Inline function 'kotlin.collections.map' call
1271
+ var tmp$ret$1;
1272
+ // Inline function 'kotlin.collections.mapTo' call
1273
+ var tmp0_mapTo = ArrayList_init_$Create$(collectionSizeOrDefault(tmp0_safe_receiver, 10));
1274
+ var tmp0_iterator = tmp0_safe_receiver.j();
1275
+ while (tmp0_iterator.m()) {
1276
+ var item = tmp0_iterator.p();
1277
+ var tmp$ret$0;
1278
+ // Inline function 'it.unibo.tuprolog.solve.libs.io.primitives.IOPrimitiveUtils.vn.<anonymous>' call
1279
+ var a = item.n3();
1280
+ var v = item.o3();
1281
+ tmp$ret$0 = Companion_getInstance_5().of('=', [a, v]);
1282
+ tmp0_mapTo.g(tmp$ret$0);
1283
+ }
1284
+ tmp$ret$1 = tmp0_mapTo;
1285
+ tmp$ret$2 = tmp$ret$1;
1286
+ tmp_0 = tmp$ret$2;
1287
+ }
1288
+ var tmp1_safe_receiver = tmp_0;
1289
+ var tmp_1;
1290
+ if (tmp1_safe_receiver == null) {
1291
+ tmp_1 = null;
1292
+ } else {
1293
+ var tmp$ret$4;
1294
+ // Inline function 'kotlin.let' call
1295
+ // Inline function 'kotlin.contracts.contract' call
1296
+ var tmp$ret$3;
1297
+ // Inline function 'it.unibo.tuprolog.solve.libs.io.primitives.IOPrimitiveUtils.vn.<anonymous>' call
1298
+ tmp$ret$3 = Companion_getInstance_8().ofList(tmp1_safe_receiver);
1299
+ tmp$ret$4 = tmp$ret$3;
1300
+ tmp_1 = tmp$ret$4;
1301
+ }
1302
+ var tmp2_elvis_lhs = tmp_1;
1303
+ return tmp.of(functor, [tmp2_elvis_lhs == null ? Companion_getInstance_6().anonymous() : tmp2_elvis_lhs]);
1304
+ }
1305
+ function variableNames($this, vNames) {
1306
+ return vn($this, 'variable_names', vNames);
1307
+ }
1308
+ function variableNames$default($this, vNames, $mask0, $handler) {
1309
+ if (!(($mask0 & 2) === 0))
1310
+ vNames = null;
1311
+ return variableNames($this, vNames);
1312
+ }
1313
+ function singletons($this, vNames) {
1314
+ return vn($this, 'singletons', vNames);
1315
+ }
1316
+ function singletons$default($this, vNames, $mask0, $handler) {
1317
+ if (!(($mask0 & 2) === 0))
1318
+ vNames = null;
1319
+ return singletons($this, vNames);
1320
+ }
1321
+ function getOption(_this__u8e3s4, $this, unificator, pattern) {
1322
+ var tmp$ret$1;
1323
+ // Inline function 'kotlin.sequences.filterIsInstance' call
1324
+ var tmp$ret$0;
1325
+ // Inline function 'kotlin.sequences.filterIsInstance' call
1326
+ var tmp0_filterIsInstance = asSequence_0(_this__u8e3s4);
1327
+ var tmp = filter(tmp0_filterIsInstance, IOPrimitiveUtils$getOption$lambda);
1328
+ tmp$ret$0 = isInterface(tmp, Sequence) ? tmp : THROW_CCE();
1329
+ var tmp_0 = tmp$ret$0;
1330
+ var tmp_1 = filter(tmp_0, IOPrimitiveUtils$getOption$lambda_0(unificator, pattern));
1331
+ var tmp1_filterIsInstance = map(tmp_1, IOPrimitiveUtils$getOption$lambda_1);
1332
+ var tmp_2 = filter(tmp1_filterIsInstance, IOPrimitiveUtils$getOption$lambda_2);
1333
+ tmp$ret$1 = isInterface(tmp_2, Sequence) ? tmp_2 : THROW_CCE();
1334
+ var tmp_3 = tmp$ret$1;
1335
+ var tmp0_elvis_lhs = firstOrNull(map(tmp_3, IOPrimitiveUtils$getOption$lambda_3));
1336
+ return tmp0_elvis_lhs == null ? false : tmp0_elvis_lhs;
1337
+ }
1338
+ function getInfo(_this__u8e3s4, $this, unificator, pattern, value) {
1339
+ var tmp$ret$2;
1340
+ $l$block: {
1341
+ // Inline function 'kotlin.sequences.firstOrNull' call
1342
+ var tmp$ret$0;
1343
+ // Inline function 'kotlin.sequences.filterIsInstance' call
1344
+ var tmp0_filterIsInstance = asSequence_0(_this__u8e3s4);
1345
+ var tmp = filter(tmp0_filterIsInstance, IOPrimitiveUtils$getInfo$lambda);
1346
+ tmp$ret$0 = isInterface(tmp, Sequence) ? tmp : THROW_CCE();
1347
+ var tmp1_firstOrNull = tmp$ret$0;
1348
+ var tmp0_iterator = tmp1_firstOrNull.j();
1349
+ while (tmp0_iterator.m()) {
1350
+ var element = tmp0_iterator.p();
1351
+ var tmp$ret$1;
1352
+ // Inline function 'it.unibo.tuprolog.solve.libs.io.primitives.IOPrimitiveUtils.getInfo.<anonymous>' call
1353
+ tmp$ret$1 = unificator.match(element, pattern);
1354
+ if (tmp$ret$1) {
1355
+ tmp$ret$2 = element;
1356
+ break $l$block;
1357
+ }
1358
+ }
1359
+ tmp$ret$2 = null;
1360
+ }
1361
+ var tmp0_safe_receiver = tmp$ret$2;
1362
+ var tmp_0;
1363
+ if (tmp0_safe_receiver == null) {
1364
+ tmp_0 = null;
1365
+ } else {
1366
+ var tmp$ret$4;
1367
+ // Inline function 'kotlin.let' call
1368
+ // Inline function 'kotlin.contracts.contract' call
1369
+ var tmp$ret$3;
1370
+ // Inline function 'it.unibo.tuprolog.solve.libs.io.primitives.IOPrimitiveUtils.getInfo.<anonymous>' call
1371
+ tmp$ret$3 = unificator.mgu(tmp0_safe_receiver, value);
1372
+ tmp$ret$4 = tmp$ret$3;
1373
+ tmp_0 = tmp$ret$4;
1374
+ }
1375
+ var tmp1_elvis_lhs = tmp_0;
1376
+ return tmp1_elvis_lhs == null ? Companion_getInstance_9().empty() : tmp1_elvis_lhs;
1377
+ }
1378
+ function _get_singletons__bihqrn(_this__u8e3s4, $this) {
1379
+ var tmp$ret$4;
1380
+ // Inline function 'kotlin.sequences.groupBy' call
1381
+ var tmp0_groupBy = _this__u8e3s4.hw();
1382
+ var tmp$ret$3;
1383
+ // Inline function 'kotlin.sequences.groupByTo' call
1384
+ var tmp0_groupByTo = LinkedHashMap_init_$Create$_0();
1385
+ var tmp0_iterator = tmp0_groupBy.j();
1386
+ while (tmp0_iterator.m()) {
1387
+ var element = tmp0_iterator.p();
1388
+ var tmp$ret$0;
1389
+ // Inline function 'it.unibo.tuprolog.solve.libs.io.primitives.IOPrimitiveUtils.<get-singletons>.<anonymous>' call
1390
+ tmp$ret$0 = element;
1391
+ var key = tmp$ret$0;
1392
+ var tmp$ret$2;
1393
+ // Inline function 'kotlin.collections.getOrPut' call
1394
+ var value = tmp0_groupByTo.a3(key);
1395
+ var tmp;
1396
+ if (value == null) {
1397
+ var tmp$ret$1;
1398
+ // Inline function 'kotlin.sequences.groupByTo.<anonymous>' call
1399
+ tmp$ret$1 = ArrayList_init_$Create$_0();
1400
+ var answer = tmp$ret$1;
1401
+ tmp0_groupByTo.w3(key, answer);
1402
+ tmp = answer;
1403
+ } else {
1404
+ tmp = value;
1405
+ }
1406
+ tmp$ret$2 = tmp;
1407
+ var list = tmp$ret$2;
1408
+ list.g(element);
1409
+ }
1410
+ tmp$ret$3 = tmp0_groupByTo;
1411
+ tmp$ret$4 = tmp$ret$3;
1412
+ var tmp_0 = asSequence_1(tmp$ret$4);
1413
+ var tmp_1 = filter(tmp_0, IOPrimitiveUtils$_get_singletons_$lambda_kke618);
1414
+ return toSet(map(tmp_1, IOPrimitiveUtils$_get_singletons_$lambda_kke618_0));
1415
+ }
1416
+ function toAssignments(_this__u8e3s4, $this) {
1417
+ return toAssignments_0(asSequence_0(_this__u8e3s4), $this);
1418
+ }
1419
+ function toAssignments_0(_this__u8e3s4, $this) {
1420
+ var tmp$ret$10;
1421
+ // Inline function 'kotlin.collections.flatMap' call
1422
+ var tmp$ret$4;
1423
+ // Inline function 'kotlin.sequences.groupBy' call
1424
+ var tmp$ret$3;
1425
+ // Inline function 'kotlin.sequences.groupByTo' call
1426
+ var tmp0_groupByTo = LinkedHashMap_init_$Create$_0();
1427
+ var tmp0_iterator = _this__u8e3s4.j();
1428
+ while (tmp0_iterator.m()) {
1429
+ var element = tmp0_iterator.p();
1430
+ var tmp$ret$0;
1431
+ // Inline function 'it.unibo.tuprolog.solve.libs.io.primitives.IOPrimitiveUtils.toAssignments.<anonymous>' call
1432
+ tmp$ret$0 = Companion_getInstance_0().of(element.og());
1433
+ var key = tmp$ret$0;
1434
+ var tmp$ret$2;
1435
+ // Inline function 'kotlin.collections.getOrPut' call
1436
+ var value = tmp0_groupByTo.a3(key);
1437
+ var tmp;
1438
+ if (value == null) {
1439
+ var tmp$ret$1;
1440
+ // Inline function 'kotlin.sequences.groupByTo.<anonymous>' call
1441
+ tmp$ret$1 = ArrayList_init_$Create$_0();
1442
+ var answer = tmp$ret$1;
1443
+ tmp0_groupByTo.w3(key, answer);
1444
+ tmp = answer;
1445
+ } else {
1446
+ tmp = value;
1447
+ }
1448
+ tmp$ret$2 = tmp;
1449
+ var list = tmp$ret$2;
1450
+ list.g(element);
1451
+ }
1452
+ tmp$ret$3 = tmp0_groupByTo;
1453
+ tmp$ret$4 = tmp$ret$3;
1454
+ var tmp0_flatMap = tmp$ret$4;
1455
+ var tmp$ret$9;
1456
+ // Inline function 'kotlin.collections.flatMapTo' call
1457
+ var tmp0_flatMapTo = ArrayList_init_$Create$_0();
1458
+ var tmp$ret$5;
1459
+ // Inline function 'kotlin.collections.iterator' call
1460
+ tmp$ret$5 = tmp0_flatMap.z().j();
1461
+ var tmp0_iterator_0 = tmp$ret$5;
1462
+ while (tmp0_iterator_0.m()) {
1463
+ var element_0 = tmp0_iterator_0.p();
1464
+ var tmp$ret$8;
1465
+ // Inline function 'it.unibo.tuprolog.solve.libs.io.primitives.IOPrimitiveUtils.toAssignments.<anonymous>' call
1466
+ var tmp$ret$6;
1467
+ // Inline function 'kotlin.collections.component1' call
1468
+ tmp$ret$6 = element_0.a1();
1469
+ var n = tmp$ret$6;
1470
+ var tmp$ret$7;
1471
+ // Inline function 'kotlin.collections.component2' call
1472
+ tmp$ret$7 = element_0.b1();
1473
+ var vs = tmp$ret$7;
1474
+ var tmp_0 = asSequence_0(vs);
1475
+ tmp$ret$8 = map(tmp_0, IOPrimitiveUtils$toAssignments$lambda(n));
1476
+ var list_0 = tmp$ret$8;
1477
+ addAll(tmp0_flatMapTo, list_0);
1478
+ }
1479
+ tmp$ret$9 = tmp0_flatMapTo;
1480
+ tmp$ret$10 = tmp$ret$9;
1481
+ return toList(tmp$ret$10);
1482
+ }
1483
+ function _get_alias__jw26bj(_this__u8e3s4, $this) {
1484
+ var tmp0_safe_receiver = (!(_this__u8e3s4 == null) ? isInterface(_this__u8e3s4, Struct) : false) ? _this__u8e3s4 : null;
1485
+ var tmp = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.getArgAt(0);
1486
+ var tmp1_safe_receiver = (!(tmp == null) ? isInterface(tmp, Atom) : false) ? tmp : null;
1487
+ return tmp1_safe_receiver == null ? null : tmp1_safe_receiver.b1();
1488
+ }
1489
+ function replyOpeningStream(_this__u8e3s4, $this, channel, third, alias) {
1490
+ var streamTerm = channel.g1z();
1491
+ var tmp = Companion_getInstance_3().b2h(_this__u8e3s4, third, streamTerm);
1492
+ return _this__u8e3s4.u2i(tmp, null, IOPrimitiveUtils$replyOpeningStream$lambda(alias, channel), 2, null);
1493
+ }
1494
+ function replyOpeningStream_0(_this__u8e3s4, $this, channel, third, alias) {
1495
+ var streamTerm = channel.g1z();
1496
+ var tmp = Companion_getInstance_3().b2h(_this__u8e3s4, third, streamTerm);
1497
+ return _this__u8e3s4.u2i(tmp, null, IOPrimitiveUtils$replyOpeningStream$lambda_0(alias, channel), 2, null);
1498
+ }
1499
+ function IOPrimitiveUtils$INPUT_STREAM_TERM_PATTERN$delegate$lambda() {
1500
+ var tmp = Companion_getInstance_10();
1501
+ return tmp.k1z(null, 1, null);
1502
+ }
1503
+ function IOPrimitiveUtils$OUTPUT_STREAM_TERM_PATTERN$delegate$lambda() {
1504
+ var tmp = Companion_getInstance_11();
1505
+ return tmp.k1z(null, 1, null);
1506
+ }
1507
+ function IOPrimitiveUtils$PROPERTY_TYPE_PATTERN$delegate$lambda() {
1508
+ return Companion_getInstance_5().of('type', [Companion_getInstance_6().anonymous()]);
1509
+ }
1510
+ function IOPrimitiveUtils$PROPERTY_REPOSITION_PATTERN$delegate$lambda() {
1511
+ return Companion_getInstance_5().of('reposition', [Companion_getInstance_6().anonymous()]);
1512
+ }
1513
+ function IOPrimitiveUtils$PROPERTY_EOF_ACTION_PATTERN$delegate$lambda() {
1514
+ return Companion_getInstance_5().of('eof_action', [Companion_getInstance_6().anonymous()]);
1515
+ }
1516
+ function IOPrimitiveUtils$PROPERTY_ALIAS_PATTERN$delegate$lambda() {
1517
+ var tmp = IOPrimitiveUtils_getInstance();
1518
+ return alias$default(tmp, null, 2, null);
1519
+ }
1520
+ function IOPrimitiveUtils$PROPERTY_INPUT$delegate$lambda() {
1521
+ return Companion_getInstance_0().of('input');
1522
+ }
1523
+ function IOPrimitiveUtils$PROPERTY_OUTPUT$delegate$lambda() {
1524
+ return Companion_getInstance_0().of('output');
1525
+ }
1526
+ function IOPrimitiveUtils$PROPERTY_TYPE_TEXT$delegate$lambda() {
1527
+ return Companion_getInstance_5().of('type', [Companion_getInstance_0().of('text')]);
1528
+ }
1529
+ function IOPrimitiveUtils$PROPERTY_REPOSITION_FALSE$delegate$lambda() {
1530
+ return Companion_getInstance_5().of('reposition', [Companion_getInstance_7().yv_1]);
1531
+ }
1532
+ function IOPrimitiveUtils$PROPERTY_EOF_ACTION_EOF_CODE$delegate$lambda() {
1533
+ return Companion_getInstance_5().of('eof_action', [Companion_getInstance_0().of('eof_code')]);
1534
+ }
1535
+ function IOPrimitiveUtils$OPTION_QUOTED_PATTERN$delegate$lambda() {
1536
+ var tmp = IOPrimitiveUtils_getInstance();
1537
+ return quoted$default(tmp, null, 2, null);
1538
+ }
1539
+ function IOPrimitiveUtils$OPTION_NUMBER_VARS_PATTERN$delegate$lambda() {
1540
+ var tmp = IOPrimitiveUtils_getInstance();
1541
+ return numberVars$default(tmp, null, 2, null);
1542
+ }
1543
+ function IOPrimitiveUtils$OPTION_IGNORE_OPS_PATTERN$delegate$lambda() {
1544
+ var tmp = IOPrimitiveUtils_getInstance();
1545
+ return ignoreOps$default(tmp, null, 2, null);
1546
+ }
1547
+ function IOPrimitiveUtils$INFO_VARIABLES_PATTERN$delegate$lambda() {
1548
+ var tmp = IOPrimitiveUtils_getInstance();
1549
+ return variables$default(tmp, null, 2, null);
1550
+ }
1551
+ function IOPrimitiveUtils$INFO_VARIABLE_NAMES_PATTERN$delegate$lambda() {
1552
+ var tmp = IOPrimitiveUtils_getInstance();
1553
+ return variableNames$default(tmp, null, 2, null);
1554
+ }
1555
+ function IOPrimitiveUtils$INFO_SINGLETONS_PATTERN$delegate$lambda() {
1556
+ var tmp = IOPrimitiveUtils_getInstance();
1557
+ return singletons$default(tmp, null, 2, null);
1558
+ }
1559
+ function IOPrimitiveUtils$quoted$ref($boundThis) {
1560
+ var l = function (p0) {
1561
+ return quoted($boundThis, p0);
1562
+ };
1563
+ l.callableName = 'quoted';
1564
+ return l;
1565
+ }
1566
+ function IOPrimitiveUtils$ignoreOps$ref($boundThis) {
1567
+ var l = function (p0) {
1568
+ return ignoreOps($boundThis, p0);
1569
+ };
1570
+ l.callableName = 'ignoreOps';
1571
+ return l;
1572
+ }
1573
+ function IOPrimitiveUtils$numberVars$ref($boundThis) {
1574
+ var l = function (p0) {
1575
+ return numberVars($boundThis, p0);
1576
+ };
1577
+ l.callableName = 'numberVars';
1578
+ return l;
1579
+ }
1580
+ function IOPrimitiveUtils$_get_validOptionsPattern_$lambda_r088xw(it) {
1581
+ return map(sequenceOf([true, false]), it);
1582
+ }
1583
+ function IOPrimitiveUtils$propertiesOf$slambda($channel, $this_propertiesOf, resultContinuation) {
1584
+ this.v3m_1 = $channel;
1585
+ this.w3m_1 = $this_propertiesOf;
1586
+ CoroutineImpl.call(this, resultContinuation);
1587
+ }
1588
+ IOPrimitiveUtils$propertiesOf$slambda.prototype.z3m = function ($this$sequence, $cont) {
1589
+ var tmp = this.a3n($this$sequence, $cont);
1590
+ tmp.ei_1 = Unit_getInstance();
1591
+ tmp.fi_1 = null;
1592
+ return tmp.ki();
1593
+ };
1594
+ IOPrimitiveUtils$propertiesOf$slambda.prototype.wi = function (p1, $cont) {
1595
+ return this.z3m(p1 instanceof SequenceScope ? p1 : THROW_CCE(), $cont);
1596
+ };
1597
+ IOPrimitiveUtils$propertiesOf$slambda.prototype.ki = function () {
1598
+ var suspendResult = this.ei_1;
1599
+ $sm: do
1600
+ try {
1601
+ var tmp = this.ci_1;
1602
+ switch (tmp) {
1603
+ case 0:
1604
+ this.di_1 = 7;
1605
+ this.y3m_1 = this.v3m_1;
1606
+ var tmp_0 = this.y3m_1;
1607
+ if (isInterface(tmp_0, InputChannel)) {
1608
+ this.ci_1 = 3;
1609
+ suspendResult = this.x3m_1.z4(_get_PROPERTY_INPUT__z2zr91(IOPrimitiveUtils_getInstance()), this);
1610
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
1611
+ return suspendResult;
1612
+ }
1613
+ continue $sm;
1614
+ } else {
1615
+ var tmp_1 = this.y3m_1;
1616
+ if (isInterface(tmp_1, OutputChannel)) {
1617
+ this.ci_1 = 1;
1618
+ suspendResult = this.x3m_1.z4(_get_PROPERTY_OUTPUT__1pem9m(IOPrimitiveUtils_getInstance()), this);
1619
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
1620
+ return suspendResult;
1621
+ }
1622
+ continue $sm;
1623
+ } else {
1624
+ this.ci_1 = 5;
1625
+ continue $sm;
1626
+ }
1627
+ }
1628
+
1629
+ break;
1630
+ case 1:
1631
+ this.ci_1 = 2;
1632
+ var tmp_2 = this.w3m_1.context.b1v();
1633
+ var tmp_3 = this.v3m_1;
1634
+ var tmp_4 = tmp_2.aliasesOf(isInterface(tmp_3, OutputChannel) ? tmp_3 : THROW_CCE());
1635
+ var tmp_5 = filterNot(tmp_4, IOPrimitiveUtils$propertiesOf$slambda$lambda_0);
1636
+ suspendResult = this.x3m_1.c5(map(tmp_5, IOPrimitiveUtils$alias$ref_0(IOPrimitiveUtils_getInstance())), this);
1637
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
1638
+ return suspendResult;
1639
+ }
1640
+
1641
+ continue $sm;
1642
+ case 2:
1643
+ this.ci_1 = 5;
1644
+ continue $sm;
1645
+ case 3:
1646
+ this.ci_1 = 4;
1647
+ var tmp_6 = this.w3m_1.context.a1v();
1648
+ var tmp_7 = this.v3m_1;
1649
+ var tmp_8 = tmp_6.aliasesOf(isInterface(tmp_7, InputChannel) ? tmp_7 : THROW_CCE());
1650
+ var tmp_9 = filterNot(tmp_8, IOPrimitiveUtils$propertiesOf$slambda$lambda);
1651
+ suspendResult = this.x3m_1.c5(map(tmp_9, IOPrimitiveUtils$alias$ref(IOPrimitiveUtils_getInstance())), this);
1652
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
1653
+ return suspendResult;
1654
+ }
1655
+
1656
+ continue $sm;
1657
+ case 4:
1658
+ this.ci_1 = 5;
1659
+ continue $sm;
1660
+ case 5:
1661
+ this.ci_1 = 6;
1662
+ suspendResult = this.x3m_1.z4(_get_PROPERTY_TYPE_TEXT__9rpcwt(IOPrimitiveUtils_getInstance()), this);
1663
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
1664
+ return suspendResult;
1665
+ }
1666
+
1667
+ continue $sm;
1668
+ case 6:
1669
+ return Unit_getInstance();
1670
+ case 7:
1671
+ throw this.fi_1;
1672
+ }
1673
+ } catch ($p) {
1674
+ if (this.di_1 === 7) {
1675
+ throw $p;
1676
+ } else {
1677
+ this.ci_1 = this.di_1;
1678
+ this.fi_1 = $p;
1679
+ }
1680
+ }
1681
+ while (true);
1682
+ };
1683
+ IOPrimitiveUtils$propertiesOf$slambda.prototype.a3n = function ($this$sequence, completion) {
1684
+ var i = new IOPrimitiveUtils$propertiesOf$slambda(this.v3m_1, this.w3m_1, completion);
1685
+ i.x3m_1 = $this$sequence;
1686
+ return i;
1687
+ };
1688
+ function IOPrimitiveUtils$propertiesOf$slambda_0($channel, $this_propertiesOf, resultContinuation) {
1689
+ var i = new IOPrimitiveUtils$propertiesOf$slambda($channel, $this_propertiesOf, resultContinuation);
1690
+ var l = function ($this$sequence, $cont) {
1691
+ return i.z3m($this$sequence, $cont);
1692
+ };
1693
+ l.$arity = 1;
1694
+ return l;
1695
+ }
1696
+ function IOPrimitiveUtils$getOption$lambda(it) {
1697
+ return !(it == null) ? isInterface(it, Struct) : false;
1698
+ }
1699
+ function IOPrimitiveUtils$getOption$lambda_0($unificator, $pattern) {
1700
+ return function (it) {
1701
+ return $unificator.match(it, $pattern);
1702
+ };
1703
+ }
1704
+ function IOPrimitiveUtils$getOption$lambda_1(it) {
1705
+ return it.get(0);
1706
+ }
1707
+ function IOPrimitiveUtils$getOption$lambda_2(it) {
1708
+ return !(it == null) ? isInterface(it, Truth) : false;
1709
+ }
1710
+ function IOPrimitiveUtils$getOption$lambda_3(it) {
1711
+ return it.dw();
1712
+ }
1713
+ function IOPrimitiveUtils$getInfo$lambda(it) {
1714
+ return !(it == null) ? isInterface(it, Struct) : false;
1715
+ }
1716
+ function IOPrimitiveUtils$_get_singletons_$lambda_kke618(it) {
1717
+ return it.b1().o() === 1;
1718
+ }
1719
+ function IOPrimitiveUtils$_get_singletons_$lambda_kke618_0(it) {
1720
+ return it.a1();
1721
+ }
1722
+ function IOPrimitiveUtils$toAssignments$lambda($n) {
1723
+ return function (it) {
1724
+ return to($n, it);
1725
+ };
1726
+ }
1727
+ function IOPrimitiveUtils$open$lambda($this_open) {
1728
+ return function (it) {
1729
+ return IOPrimitiveUtils_getInstance().b3n($this_open, it);
1730
+ };
1731
+ }
1732
+ function IOPrimitiveUtils$open$lambda_0($this_open) {
1733
+ return function (it) {
1734
+ return IOPrimitiveUtils_getInstance().c3n($this_open, it);
1735
+ };
1736
+ }
1737
+ function IOPrimitiveUtils$replyOpeningStream$lambda($alias, $channel) {
1738
+ return function ($this$replyWith) {
1739
+ var tmp0_elvis_lhs = $alias;
1740
+ $this$replyWith.i2n(tmp0_elvis_lhs == null ? 'output_channel' + $channel.g1z().get(1) : tmp0_elvis_lhs, $channel);
1741
+ return Unit_getInstance();
1742
+ };
1743
+ }
1744
+ function IOPrimitiveUtils$replyOpeningStream$lambda_0($alias, $channel) {
1745
+ return function ($this$replyWith) {
1746
+ var tmp0_elvis_lhs = $alias;
1747
+ $this$replyWith.f2n(tmp0_elvis_lhs == null ? 'input_channel' + $channel.g1z().get(1) : tmp0_elvis_lhs, $channel);
1748
+ return Unit_getInstance();
1749
+ };
1750
+ }
1751
+ function IOPrimitiveUtils() {
1752
+ IOPrimitiveUtils_instance = this;
1753
+ var tmp = this;
1754
+ tmp.v3k_1 = lazy(IOPrimitiveUtils$INPUT_STREAM_TERM_PATTERN$delegate$lambda);
1755
+ var tmp_0 = this;
1756
+ tmp_0.w3k_1 = lazy(IOPrimitiveUtils$OUTPUT_STREAM_TERM_PATTERN$delegate$lambda);
1757
+ var tmp_1 = this;
1758
+ tmp_1.x3k_1 = lazy(IOPrimitiveUtils$PROPERTY_TYPE_PATTERN$delegate$lambda);
1759
+ var tmp_2 = this;
1760
+ tmp_2.y3k_1 = lazy(IOPrimitiveUtils$PROPERTY_REPOSITION_PATTERN$delegate$lambda);
1761
+ var tmp_3 = this;
1762
+ tmp_3.z3k_1 = lazy(IOPrimitiveUtils$PROPERTY_EOF_ACTION_PATTERN$delegate$lambda);
1763
+ var tmp_4 = this;
1764
+ tmp_4.a3l_1 = lazy(IOPrimitiveUtils$PROPERTY_ALIAS_PATTERN$delegate$lambda);
1765
+ var tmp_5 = this;
1766
+ tmp_5.b3l_1 = lazy(IOPrimitiveUtils$PROPERTY_INPUT$delegate$lambda);
1767
+ var tmp_6 = this;
1768
+ tmp_6.c3l_1 = lazy(IOPrimitiveUtils$PROPERTY_OUTPUT$delegate$lambda);
1769
+ var tmp_7 = this;
1770
+ tmp_7.d3l_1 = lazy(IOPrimitiveUtils$PROPERTY_TYPE_TEXT$delegate$lambda);
1771
+ var tmp_8 = this;
1772
+ tmp_8.e3l_1 = lazy(IOPrimitiveUtils$PROPERTY_REPOSITION_FALSE$delegate$lambda);
1773
+ var tmp_9 = this;
1774
+ tmp_9.f3l_1 = lazy(IOPrimitiveUtils$PROPERTY_EOF_ACTION_EOF_CODE$delegate$lambda);
1775
+ var tmp_10 = this;
1776
+ tmp_10.g3l_1 = lazy(IOPrimitiveUtils$OPTION_QUOTED_PATTERN$delegate$lambda);
1777
+ var tmp_11 = this;
1778
+ tmp_11.h3l_1 = lazy(IOPrimitiveUtils$OPTION_NUMBER_VARS_PATTERN$delegate$lambda);
1779
+ var tmp_12 = this;
1780
+ tmp_12.i3l_1 = lazy(IOPrimitiveUtils$OPTION_IGNORE_OPS_PATTERN$delegate$lambda);
1781
+ var tmp_13 = this;
1782
+ tmp_13.j3l_1 = lazy(IOPrimitiveUtils$INFO_VARIABLES_PATTERN$delegate$lambda);
1783
+ var tmp_14 = this;
1784
+ tmp_14.k3l_1 = lazy(IOPrimitiveUtils$INFO_VARIABLE_NAMES_PATTERN$delegate$lambda);
1785
+ var tmp_15 = this;
1786
+ tmp_15.l3l_1 = lazy(IOPrimitiveUtils$INFO_SINGLETONS_PATTERN$delegate$lambda);
1787
+ }
1788
+ IOPrimitiveUtils.prototype.d3n = function (_this__u8e3s4, channel) {
1789
+ return sequence(IOPrimitiveUtils$propertiesOf$slambda_0(channel, _this__u8e3s4, null));
1790
+ };
1791
+ IOPrimitiveUtils.prototype.m3l = function (_this__u8e3s4) {
1792
+ var tmp$ret$1;
1793
+ // Inline function 'kotlin.let' call
1794
+ var tmp0_let = _this__u8e3s4.context.a1v();
1795
+ // Inline function 'kotlin.contracts.contract' call
1796
+ var tmp$ret$0;
1797
+ // Inline function 'it.unibo.tuprolog.solve.libs.io.primitives.IOPrimitiveUtils.<get-currentInputChannel>.<anonymous>' call
1798
+ var tmp0_elvis_lhs = tmp0_let.uq();
1799
+ tmp$ret$0 = tmp0_elvis_lhs == null ? tmp0_let.j1v() : tmp0_elvis_lhs;
1800
+ tmp$ret$1 = tmp$ret$0;
1801
+ return tmp$ret$1;
1802
+ };
1803
+ IOPrimitiveUtils.prototype.e3n = function (_this__u8e3s4) {
1804
+ var tmp$ret$1;
1805
+ // Inline function 'kotlin.let' call
1806
+ var tmp0_let = _this__u8e3s4.context.b1v();
1807
+ // Inline function 'kotlin.contracts.contract' call
1808
+ var tmp$ret$0;
1809
+ // Inline function 'it.unibo.tuprolog.solve.libs.io.primitives.IOPrimitiveUtils.<get-currentOutputChannel>.<anonymous>' call
1810
+ var tmp0_elvis_lhs = tmp0_let.uq();
1811
+ tmp$ret$0 = tmp0_elvis_lhs == null ? tmp0_let.l1v() : tmp0_elvis_lhs;
1812
+ tmp$ret$1 = tmp$ret$0;
1813
+ return tmp$ret$1;
1814
+ };
1815
+ IOPrimitiveUtils.prototype.b3n = function (_this__u8e3s4, term) {
1816
+ var tmp;
1817
+ var tmp$ret$1;
1818
+ $l$block: {
1819
+ // Inline function 'kotlin.sequences.any' call
1820
+ var tmp0_any = _get_validPropertiesPattern__7s1t06(this);
1821
+ var tmp0_iterator = tmp0_any.j();
1822
+ while (tmp0_iterator.m()) {
1823
+ var element = tmp0_iterator.p();
1824
+ var tmp$ret$0;
1825
+ // Inline function 'it.unibo.tuprolog.solve.libs.io.primitives.IOPrimitiveUtils.ensureTermIsValidProperty.<anonymous>' call
1826
+ tmp$ret$0 = Companion_getInstance_3().c2h(_this__u8e3s4, element, term);
1827
+ if (tmp$ret$0) {
1828
+ tmp$ret$1 = true;
1829
+ break $l$block;
1830
+ }
1831
+ }
1832
+ tmp$ret$1 = false;
1833
+ }
1834
+ if (tmp$ret$1) {
1835
+ tmp = term;
1836
+ } else {
1837
+ throw Companion_getInstance_12().forTerm(_this__u8e3s4.context, Expected_STREAM_PROPERTY_getInstance(), term);
1838
+ }
1839
+ return tmp;
1840
+ };
1841
+ IOPrimitiveUtils.prototype.c3n = function (_this__u8e3s4, term) {
1842
+ var tmp;
1843
+ var tmp$ret$1;
1844
+ $l$block: {
1845
+ // Inline function 'kotlin.sequences.any' call
1846
+ var tmp0_any = _get_supportedPropertiesPattern__x8u7bw(this);
1847
+ var tmp0_iterator = tmp0_any.j();
1848
+ while (tmp0_iterator.m()) {
1849
+ var element = tmp0_iterator.p();
1850
+ var tmp$ret$0;
1851
+ // Inline function 'it.unibo.tuprolog.solve.libs.io.primitives.IOPrimitiveUtils.ensureTermIsSupportedProperty.<anonymous>' call
1852
+ tmp$ret$0 = Companion_getInstance_3().c2h(_this__u8e3s4, element, term);
1853
+ if (tmp$ret$0) {
1854
+ tmp$ret$1 = true;
1855
+ break $l$block;
1856
+ }
1857
+ }
1858
+ tmp$ret$1 = false;
1859
+ }
1860
+ if (tmp$ret$1) {
1861
+ tmp = term;
1862
+ } else {
1863
+ throw Companion_getInstance_1().forUncaughtKtException(_this__u8e3s4.context, IllegalStateException_init_$Create$('unsupported option ' + term));
1864
+ }
1865
+ return tmp;
1866
+ };
1867
+ IOPrimitiveUtils.prototype.f3n = function (_this__u8e3s4, term) {
1868
+ var tmp;
1869
+ var tmp$ret$1;
1870
+ $l$block: {
1871
+ // Inline function 'kotlin.sequences.any' call
1872
+ var tmp0_any = _get_validOptionsPattern__akhsd9(this);
1873
+ var tmp0_iterator = tmp0_any.j();
1874
+ while (tmp0_iterator.m()) {
1875
+ var element = tmp0_iterator.p();
1876
+ var tmp$ret$0;
1877
+ // Inline function 'it.unibo.tuprolog.solve.libs.io.primitives.IOPrimitiveUtils.ensureTermIsValidOption.<anonymous>' call
1878
+ tmp$ret$0 = Companion_getInstance_3().c2h(_this__u8e3s4, element, term);
1879
+ if (tmp$ret$0) {
1880
+ tmp$ret$1 = true;
1881
+ break $l$block;
1882
+ }
1883
+ }
1884
+ tmp$ret$1 = false;
1885
+ }
1886
+ if (tmp$ret$1) {
1887
+ tmp = term;
1888
+ } else {
1889
+ throw Companion_getInstance_12().forTerm(_this__u8e3s4.context, Expected_WRITE_OPTION_getInstance(), term);
1890
+ }
1891
+ return tmp;
1892
+ };
1893
+ IOPrimitiveUtils.prototype.g3n = function (_this__u8e3s4, term) {
1894
+ var tmp;
1895
+ var tmp$ret$1;
1896
+ $l$block: {
1897
+ // Inline function 'kotlin.sequences.any' call
1898
+ var tmp0_any = _get_validInfoPattern__dtwgth(this);
1899
+ var tmp0_iterator = tmp0_any.j();
1900
+ while (tmp0_iterator.m()) {
1901
+ var element = tmp0_iterator.p();
1902
+ var tmp$ret$0;
1903
+ // Inline function 'it.unibo.tuprolog.solve.libs.io.primitives.IOPrimitiveUtils.ensureTermIsValidInfo.<anonymous>' call
1904
+ tmp$ret$0 = Companion_getInstance_3().c2h(_this__u8e3s4, element, term);
1905
+ if (tmp$ret$0) {
1906
+ tmp$ret$1 = true;
1907
+ break $l$block;
1908
+ }
1909
+ }
1910
+ tmp$ret$1 = false;
1911
+ }
1912
+ if (tmp$ret$1) {
1913
+ tmp = term;
1914
+ } else {
1915
+ throw Companion_getInstance_12().forTerm(_this__u8e3s4.context, Expected_READ_OPTION_getInstance(), term);
1916
+ }
1917
+ return tmp;
1918
+ };
1919
+ IOPrimitiveUtils.prototype.h3n = function (_this__u8e3s4, index) {
1920
+ Companion_getInstance_3().v2h(_this__u8e3s4, index);
1921
+ var tmp = _this__u8e3s4.arguments.n(index);
1922
+ var list = isInterface(tmp, List) ? tmp : THROW_CCE();
1923
+ var tmp0_iterator = list.ju().j();
1924
+ while (tmp0_iterator.m()) {
1925
+ var term = tmp0_iterator.p();
1926
+ this.f3n(_this__u8e3s4, term);
1927
+ }
1928
+ return _this__u8e3s4;
1929
+ };
1930
+ IOPrimitiveUtils.prototype.i3n = function (_this__u8e3s4, index) {
1931
+ var list = _this__u8e3s4.arguments.n(index);
1932
+ var tmp;
1933
+ if (isInterface(list, Var)) {
1934
+ tmp = null;
1935
+ } else {
1936
+ Companion_getInstance_3().v2h(_this__u8e3s4, index);
1937
+ var listOfInfo = (isInterface(list, List) ? list : THROW_CCE()).toList();
1938
+ var tmp0_iterator = listOfInfo.j();
1939
+ while (tmp0_iterator.m()) {
1940
+ var term = tmp0_iterator.p();
1941
+ this.g3n(_this__u8e3s4, term);
1942
+ }
1943
+ tmp = listOfInfo;
1944
+ }
1945
+ return tmp;
1946
+ };
1947
+ IOPrimitiveUtils.prototype.j3n = function (_this__u8e3s4, index) {
1948
+ this.h3n(_this__u8e3s4, index);
1949
+ var tmp = _this__u8e3s4.arguments.n(index);
1950
+ var optionList = (isInterface(tmp, List) ? tmp : THROW_CCE()).toList();
1951
+ var tmp_0;
1952
+ if (getOption(optionList, this, _this__u8e3s4.context.k1l(), _get_OPTION_QUOTED_PATTERN__n2ri42(this))) {
1953
+ tmp_0 = FuncFormat_QUOTED_IF_NECESSARY_getInstance();
1954
+ } else {
1955
+ tmp_0 = FuncFormat_LITERAL_getInstance();
1956
+ }
1957
+ var funcFormat = tmp_0;
1958
+ var tmp_1;
1959
+ if (getOption(optionList, this, _this__u8e3s4.context.k1l(), _get_OPTION_IGNORE_OPS_PATTERN__cpse4v(this))) {
1960
+ tmp_1 = OpFormat_IGNORE_OPERATORS_getInstance();
1961
+ } else {
1962
+ tmp_1 = OpFormat_EXPRESSIONS_getInstance();
1963
+ }
1964
+ var opFormat = tmp_1;
1965
+ var numberVars = getOption(optionList, this, _this__u8e3s4.context.k1l(), _get_OPTION_NUMBER_VARS_PATTERN__p98ste(this));
1966
+ return Companion_getInstance_13().h14(VarFormat_UNDERSCORE_getInstance(), opFormat, funcFormat, numberVars, _this__u8e3s4.context.h1v());
1967
+ };
1968
+ IOPrimitiveUtils.prototype.k3n = function (_this__u8e3s4, index) {
1969
+ var term = _this__u8e3s4.arguments.n(index);
1970
+ var tmp0_subject = term;
1971
+ if (isInterface(tmp0_subject, Var))
1972
+ return _this__u8e3s4;
1973
+ else {
1974
+ if (isInterface(tmp0_subject, Struct)) {
1975
+ var tmp$ret$1;
1976
+ $l$block: {
1977
+ // Inline function 'kotlin.sequences.any' call
1978
+ var tmp0_any = sequenceOf([_get_PROPERTY_INPUT__z2zr91(this), _get_PROPERTY_OUTPUT__1pem9m(this), _get_PROPERTY_ALIAS_PATTERN__wipd2s(this)]);
1979
+ var tmp0_iterator = tmp0_any.j();
1980
+ while (tmp0_iterator.m()) {
1981
+ var element = tmp0_iterator.p();
1982
+ var tmp$ret$0;
1983
+ // Inline function 'it.unibo.tuprolog.solve.libs.io.primitives.IOPrimitiveUtils.ensuringArgumentIsStreamProperty.<anonymous>' call
1984
+ tmp$ret$0 = Companion_getInstance_3().c2h(_this__u8e3s4, element, term);
1985
+ if (tmp$ret$0) {
1986
+ tmp$ret$1 = true;
1987
+ break $l$block;
1988
+ }
1989
+ }
1990
+ tmp$ret$1 = false;
1991
+ }
1992
+ if (tmp$ret$1) {
1993
+ return _this__u8e3s4;
1994
+ }
1995
+ }
1996
+ }
1997
+ throw Companion_getInstance_12().q25(_this__u8e3s4.context, _this__u8e3s4.signature, Expected_STREAM_PROPERTY_getInstance(), term, index);
1998
+ };
1999
+ IOPrimitiveUtils.prototype.l3n = function (_this__u8e3s4, index) {
2000
+ Companion_getInstance_3().h2h(_this__u8e3s4, index);
2001
+ var term = _this__u8e3s4.arguments.n(index);
2002
+ var error = Companion_getInstance_12().q25(_this__u8e3s4.context, _this__u8e3s4.signature, Expected_SOURCE_SINK_getInstance(), term, index);
2003
+ if (!isInterface(term, Atom)) {
2004
+ throw error;
2005
+ }
2006
+ try {
2007
+ return Companion_getInstance_22().of(term.b1());
2008
+ } catch ($p) {
2009
+ if ($p instanceof InvalidUrlException) {
2010
+ throw error;
2011
+ } else {
2012
+ throw $p;
2013
+ }
2014
+ }
2015
+ };
2016
+ IOPrimitiveUtils.prototype.m3n = function (_this__u8e3s4, index) {
2017
+ Companion_getInstance_3().h2h(_this__u8e3s4, index);
2018
+ Companion_getInstance_3().q2h(_this__u8e3s4, index);
2019
+ var tmp = _this__u8e3s4.arguments.n(index);
2020
+ var term = isInterface(tmp, Atom) ? tmp : THROW_CCE();
2021
+ if (!Companion_getInstance_21().f3k_1.v(term)) {
2022
+ throw Companion_getInstance_12().q25(_this__u8e3s4.context, _this__u8e3s4.signature, Expected_IO_MODE_getInstance(), term, index);
2023
+ }
2024
+ var tmp$ret$1;
2025
+ // Inline function 'kotlin.text.uppercase' call
2026
+ var tmp0_uppercase = term.b1();
2027
+ var tmp$ret$0;
2028
+ // Inline function 'kotlin.js.asDynamic' call
2029
+ tmp$ret$0 = tmp0_uppercase;
2030
+ tmp$ret$1 = tmp$ret$0.toUpperCase();
2031
+ return valueOf(tmp$ret$1);
2032
+ };
2033
+ IOPrimitiveUtils.prototype.z3l = function (_this__u8e3s4, index) {
2034
+ var term = _this__u8e3s4.arguments.n(index);
2035
+ var tmp0_subject = term;
2036
+ if (isInterface(tmp0_subject, Var))
2037
+ return null;
2038
+ else {
2039
+ if (isInterface(tmp0_subject, Struct))
2040
+ if (Companion_getInstance_3().c2h(_this__u8e3s4, term, _get_OUTPUT_STREAM_TERM_PATTERN__4vocxf(this))) {
2041
+ var tmp1_elvis_lhs = firstOrNull(_this__u8e3s4.context.b1v().findByTerm(term));
2042
+ var tmp;
2043
+ if (tmp1_elvis_lhs == null) {
2044
+ throw Companion_getInstance_14().forStream(_this__u8e3s4.context, term);
2045
+ } else {
2046
+ tmp = tmp1_elvis_lhs;
2047
+ }
2048
+ return tmp;
2049
+ } else if (Companion_getInstance_3().c2h(_this__u8e3s4, term, _get_INPUT_STREAM_TERM_PATTERN__5fd8p6(this))) {
2050
+ var tmp2_elvis_lhs = firstOrNull(_this__u8e3s4.context.a1v().findByTerm(term));
2051
+ var tmp_0;
2052
+ if (tmp2_elvis_lhs == null) {
2053
+ throw Companion_getInstance_14().forStream(_this__u8e3s4.context, term);
2054
+ } else {
2055
+ tmp_0 = tmp2_elvis_lhs;
2056
+ }
2057
+ return tmp_0;
2058
+ }
2059
+ }
2060
+ throw Companion_getInstance_12().q25(_this__u8e3s4.context, _this__u8e3s4.signature, Expected_STREAM_OR_ALIAS_getInstance(), term, index);
2061
+ };
2062
+ IOPrimitiveUtils.prototype.g3m = function (_this__u8e3s4, index) {
2063
+ var arg = _this__u8e3s4.arguments.n(index);
2064
+ var tmp;
2065
+ if (isInterface(arg, Var)) {
2066
+ tmp = _this__u8e3s4;
2067
+ } else {
2068
+ if (isInterface(arg, Atom)) {
2069
+ var tmp_0;
2070
+ if (arg.b1() === 'end_of_file') {
2071
+ tmp_0 = _this__u8e3s4;
2072
+ } else if (arg.b1().length === 1) {
2073
+ tmp_0 = _this__u8e3s4;
2074
+ } else {
2075
+ throw Companion_getInstance_2().q25(_this__u8e3s4.context, _this__u8e3s4.signature, Expected_IN_CHARACTER_getInstance(), arg, index);
2076
+ }
2077
+ tmp = tmp_0;
2078
+ } else {
2079
+ throw Companion_getInstance_2().q25(_this__u8e3s4.context, _this__u8e3s4.signature, Expected_IN_CHARACTER_getInstance(), arg, index);
2080
+ }
2081
+ }
2082
+ return tmp;
2083
+ };
2084
+ IOPrimitiveUtils.prototype.k3m = function (_this__u8e3s4, index) {
2085
+ var term = _this__u8e3s4.arguments.n(index);
2086
+ var tmp;
2087
+ if (isInterface(term, Var)) {
2088
+ tmp = _this__u8e3s4;
2089
+ } else {
2090
+ if (!isInterface(term, Integer)) {
2091
+ tmp = Companion_getInstance_3().u2h(_this__u8e3s4, index);
2092
+ } else {
2093
+ if (term.equals(Companion_getInstance_16().w10_1)) {
2094
+ tmp = _this__u8e3s4;
2095
+ } else {
2096
+ if (Companion_getInstance_3().y2h(term)) {
2097
+ var tmp_0 = Companion_getInstance_15();
2098
+ var tmp_1 = Limit_CHARACTER_CODE_getInstance();
2099
+ throw tmp_0.u27(_this__u8e3s4.context, _this__u8e3s4.signature, tmp_1, null, 8, null);
2100
+ } else {
2101
+ tmp = _this__u8e3s4;
2102
+ }
2103
+ }
2104
+ }
2105
+ }
2106
+ return tmp;
2107
+ };
2108
+ IOPrimitiveUtils.prototype.s3l = function (_this__u8e3s4, index) {
2109
+ Companion_getInstance_3().h2h(_this__u8e3s4, index);
2110
+ Companion_getInstance_3().l2h(_this__u8e3s4, index);
2111
+ var tmp = _this__u8e3s4.arguments.n(index);
2112
+ var term = isInterface(tmp, Struct) ? tmp : THROW_CCE();
2113
+ var tmp_0;
2114
+ if (isInterface(term, Atom)) {
2115
+ var tmp$ret$3;
2116
+ $l$block: {
2117
+ // Inline function 'kotlin.sequences.firstOrNull' call
2118
+ var tmp0_firstOrNull = sequenceOf([_this__u8e3s4.context.a1v(), _this__u8e3s4.context.b1v()]);
2119
+ var tmp0_iterator = tmp0_firstOrNull.j();
2120
+ while (tmp0_iterator.m()) {
2121
+ var element = tmp0_iterator.p();
2122
+ var tmp$ret$2;
2123
+ // Inline function 'it.unibo.tuprolog.solve.libs.io.primitives.IOPrimitiveUtils.ensuringArgumentIsChannel.<anonymous>' call
2124
+ var tmp$ret$1;
2125
+ // Inline function 'kotlin.collections.contains' call
2126
+ var tmp0_contains = term.b1();
2127
+ var tmp$ret$0;
2128
+ // Inline function 'kotlin.collections.containsKey' call
2129
+ tmp$ret$0 = (isInterface(element, Map) ? element : THROW_CCE()).u2(tmp0_contains);
2130
+ tmp$ret$1 = tmp$ret$0;
2131
+ tmp$ret$2 = tmp$ret$1;
2132
+ if (tmp$ret$2) {
2133
+ tmp$ret$3 = element;
2134
+ break $l$block;
2135
+ }
2136
+ }
2137
+ tmp$ret$3 = null;
2138
+ }
2139
+ var tmp0_safe_receiver = tmp$ret$3;
2140
+ var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.a3(term.b1());
2141
+ var tmp_1;
2142
+ if (tmp1_elvis_lhs == null) {
2143
+ throw Companion_getInstance_14().forSourceSink(_this__u8e3s4.context, term);
2144
+ } else {
2145
+ tmp_1 = tmp1_elvis_lhs;
2146
+ }
2147
+ tmp_0 = tmp_1;
2148
+ } else {
2149
+ if (Companion_getInstance_3().c2h(_this__u8e3s4, term, _get_OUTPUT_STREAM_TERM_PATTERN__4vocxf(this))) {
2150
+ var tmp2_elvis_lhs = firstOrNull(_this__u8e3s4.context.b1v().findByTerm(term));
2151
+ var tmp_2;
2152
+ if (tmp2_elvis_lhs == null) {
2153
+ throw Companion_getInstance_14().forStream(_this__u8e3s4.context, term);
2154
+ } else {
2155
+ tmp_2 = tmp2_elvis_lhs;
2156
+ }
2157
+ tmp_0 = tmp_2;
2158
+ } else {
2159
+ if (Companion_getInstance_3().c2h(_this__u8e3s4, term, _get_INPUT_STREAM_TERM_PATTERN__5fd8p6(this))) {
2160
+ var tmp3_elvis_lhs = firstOrNull(_this__u8e3s4.context.a1v().findByTerm(term));
2161
+ var tmp_3;
2162
+ if (tmp3_elvis_lhs == null) {
2163
+ throw Companion_getInstance_14().forStream(_this__u8e3s4.context, term);
2164
+ } else {
2165
+ tmp_3 = tmp3_elvis_lhs;
2166
+ }
2167
+ tmp_0 = tmp_3;
2168
+ } else {
2169
+ throw Companion_getInstance_12().q25(_this__u8e3s4.context, _this__u8e3s4.signature, Expected_STREAM_OR_ALIAS_getInstance(), term, index);
2170
+ }
2171
+ }
2172
+ }
2173
+ return tmp_0;
2174
+ };
2175
+ IOPrimitiveUtils.prototype.p3l = function (_this__u8e3s4, index) {
2176
+ var channel = this.s3l(_this__u8e3s4, index);
2177
+ var tmp;
2178
+ if (isInterface(channel, InputChannel)) {
2179
+ tmp = channel;
2180
+ } else {
2181
+ throw Companion_getInstance_12().q25(_this__u8e3s4.context, _this__u8e3s4.signature, Expected_STREAM_TYPE_getInstance(), _this__u8e3s4.arguments.n(index), index);
2182
+ }
2183
+ return tmp;
2184
+ };
2185
+ IOPrimitiveUtils.prototype.c3m = function (_this__u8e3s4, index) {
2186
+ var channel = this.s3l(_this__u8e3s4, index);
2187
+ var tmp;
2188
+ if (isInterface(channel, OutputChannel)) {
2189
+ tmp = channel;
2190
+ } else {
2191
+ throw Companion_getInstance_12().q25(_this__u8e3s4.context, _this__u8e3s4.signature, Expected_STREAM_TYPE_getInstance(), _this__u8e3s4.arguments.n(index), index);
2192
+ }
2193
+ return tmp;
2194
+ };
2195
+ IOPrimitiveUtils.prototype.n3n = function (_this__u8e3s4, channel, term, formatter) {
2196
+ var tmp;
2197
+ try {
2198
+ channel.write(format(term, formatter));
2199
+ tmp = _this__u8e3s4.m2g(null, null, [], 7, null);
2200
+ } catch ($p) {
2201
+ var tmp_0;
2202
+ if ($p instanceof IllegalStateException) {
2203
+ tmp_0 = _this__u8e3s4.l2g(null, [], 3, null);
2204
+ } else {
2205
+ throw $p;
2206
+ }
2207
+ tmp = tmp_0;
2208
+ }
2209
+ return tmp;
2210
+ };
2211
+ IOPrimitiveUtils.prototype.o3n = function (_this__u8e3s4, channel, arg) {
2212
+ var tmp;
2213
+ try {
2214
+ channel.write('' + new Char(arg.p10().toChar()));
2215
+ tmp = _this__u8e3s4.m2g(null, null, [], 7, null);
2216
+ } catch ($p) {
2217
+ var tmp_0;
2218
+ if ($p instanceof IllegalStateException) {
2219
+ tmp_0 = _this__u8e3s4.l2g(null, [], 3, null);
2220
+ } else {
2221
+ throw $p;
2222
+ }
2223
+ tmp = tmp_0;
2224
+ }
2225
+ return tmp;
2226
+ };
2227
+ IOPrimitiveUtils.prototype.p3n = function (_this__u8e3s4, channel, arg) {
2228
+ var tmp;
2229
+ try {
2230
+ channel.write(arg.b1());
2231
+ tmp = _this__u8e3s4.m2g(null, null, [], 7, null);
2232
+ } catch ($p) {
2233
+ var tmp_0;
2234
+ if ($p instanceof IllegalStateException) {
2235
+ tmp_0 = _this__u8e3s4.l2g(null, [], 3, null);
2236
+ } else {
2237
+ throw $p;
2238
+ }
2239
+ tmp = tmp_0;
2240
+ }
2241
+ return tmp;
2242
+ };
2243
+ IOPrimitiveUtils.prototype.q3n = function (_this__u8e3s4, channel, arg) {
2244
+ var tmp;
2245
+ try {
2246
+ var tmp0_safe_receiver = channel.peek();
2247
+ var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : charSequenceGet(tmp0_safe_receiver, 0);
2248
+ var tmp_0;
2249
+ var tmp_1 = tmp1_safe_receiver;
2250
+ if ((tmp_1 == null ? null : new Char(tmp_1)) == null) {
2251
+ tmp_0 = null;
2252
+ } else {
2253
+ var tmp$ret$0;
2254
+ // Inline function 'kotlin.code' call
2255
+ tmp$ret$0 = Char__toInt_impl_vasixd(tmp1_safe_receiver);
2256
+ tmp_0 = tmp$ret$0;
2257
+ }
2258
+ var tmp2_elvis_lhs = tmp_0;
2259
+ var code = tmp2_elvis_lhs == null ? -1 : tmp2_elvis_lhs;
2260
+ var tmp_2 = Companion_getInstance_3().b2h(_this__u8e3s4, arg, Companion_getInstance_16().ofInt(code));
2261
+ tmp = _this__u8e3s4.g2g(tmp_2, null, [], 6, null);
2262
+ } catch ($p) {
2263
+ var tmp_3;
2264
+ if ($p instanceof IllegalStateException) {
2265
+ tmp_3 = _this__u8e3s4.l2g(null, [], 3, null);
2266
+ } else {
2267
+ throw $p;
2268
+ }
2269
+ tmp = tmp_3;
2270
+ }
2271
+ return tmp;
2272
+ };
2273
+ IOPrimitiveUtils.prototype.r3n = function (_this__u8e3s4, channel, arg) {
2274
+ var tmp;
2275
+ try {
2276
+ var tmp0_elvis_lhs = channel.peek();
2277
+ var char = tmp0_elvis_lhs == null ? 'end_of_file' : tmp0_elvis_lhs;
2278
+ var tmp_0 = Companion_getInstance_3().b2h(_this__u8e3s4, arg, Companion_getInstance_0().of(char));
2279
+ tmp = _this__u8e3s4.g2g(tmp_0, null, [], 6, null);
2280
+ } catch ($p) {
2281
+ var tmp_1;
2282
+ if ($p instanceof IllegalStateException) {
2283
+ tmp_1 = _this__u8e3s4.l2g(null, [], 3, null);
2284
+ } else {
2285
+ throw $p;
2286
+ }
2287
+ tmp = tmp_1;
2288
+ }
2289
+ return tmp;
2290
+ };
2291
+ IOPrimitiveUtils.prototype.l3m = function (_this__u8e3s4, channel, arg) {
2292
+ var tmp;
2293
+ try {
2294
+ var tmp0_safe_receiver = channel.read();
2295
+ var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : charSequenceGet(tmp0_safe_receiver, 0);
2296
+ var tmp_0;
2297
+ var tmp_1 = tmp1_safe_receiver;
2298
+ if ((tmp_1 == null ? null : new Char(tmp_1)) == null) {
2299
+ tmp_0 = null;
2300
+ } else {
2301
+ var tmp$ret$0;
2302
+ // Inline function 'kotlin.code' call
2303
+ tmp$ret$0 = Char__toInt_impl_vasixd(tmp1_safe_receiver);
2304
+ tmp_0 = tmp$ret$0;
2305
+ }
2306
+ var tmp2_elvis_lhs = tmp_0;
2307
+ var code = tmp2_elvis_lhs == null ? -1 : tmp2_elvis_lhs;
2308
+ var tmp_2 = Companion_getInstance_3().b2h(_this__u8e3s4, arg, Companion_getInstance_16().ofInt(code));
2309
+ tmp = _this__u8e3s4.g2g(tmp_2, null, [], 6, null);
2310
+ } catch ($p) {
2311
+ var tmp_3;
2312
+ if ($p instanceof IllegalStateException) {
2313
+ tmp_3 = _this__u8e3s4.l2g(null, [], 3, null);
2314
+ } else {
2315
+ throw $p;
2316
+ }
2317
+ tmp = tmp_3;
2318
+ }
2319
+ return tmp;
2320
+ };
2321
+ IOPrimitiveUtils.prototype.h3m = function (_this__u8e3s4, channel, arg) {
2322
+ var tmp;
2323
+ try {
2324
+ var tmp0_elvis_lhs = channel.read();
2325
+ var char = tmp0_elvis_lhs == null ? 'end_of_file' : tmp0_elvis_lhs;
2326
+ var tmp_0 = Companion_getInstance_3().b2h(_this__u8e3s4, arg, Companion_getInstance_0().of(char));
2327
+ tmp = _this__u8e3s4.g2g(tmp_0, null, [], 6, null);
2328
+ } catch ($p) {
2329
+ var tmp_1;
2330
+ if ($p instanceof IllegalStateException) {
2331
+ tmp_1 = _this__u8e3s4.l2g(null, [], 3, null);
2332
+ } else {
2333
+ throw $p;
2334
+ }
2335
+ tmp = tmp_1;
2336
+ }
2337
+ return tmp;
2338
+ };
2339
+ IOPrimitiveUtils.prototype.s3n = function (_this__u8e3s4, channel, arg, lastIsInfoList) {
2340
+ try {
2341
+ var termsChannel = asTermChannel(channel, _this__u8e3s4.context.h1v());
2342
+ var tmp;
2343
+ if (lastIsInfoList) {
2344
+ tmp = this.i3n(_this__u8e3s4, get_lastIndex(_this__u8e3s4.arguments));
2345
+ } else {
2346
+ tmp = emptyList();
2347
+ }
2348
+ var infoList = tmp;
2349
+ if (!termsChannel.l1z()) {
2350
+ return _this__u8e3s4.l2g(null, [], 3, null);
2351
+ }
2352
+ var read = termsChannel.read();
2353
+ var tmp_0;
2354
+ if (read == null) {
2355
+ tmp_0 = _this__u8e3s4.l2g(null, [], 3, null);
2356
+ } else {
2357
+ var variables_0 = variables(this, toList_0(read.hw()));
2358
+ var variableNames_0 = variableNames(this, toAssignments_0(read.hw(), this));
2359
+ var singletons_0 = singletons(this, toAssignments(_get_singletons__bihqrn(read, this), this));
2360
+ var tmp0_safe_receiver = infoList;
2361
+ var tmp_1;
2362
+ if (tmp0_safe_receiver == null) {
2363
+ tmp_1 = null;
2364
+ } else {
2365
+ var tmp$ret$1;
2366
+ // Inline function 'kotlin.let' call
2367
+ // Inline function 'kotlin.contracts.contract' call
2368
+ var tmp$ret$0;
2369
+ // Inline function 'it.unibo.tuprolog.solve.libs.io.primitives.IOPrimitiveUtils.readTermAndReply.<anonymous>' call
2370
+ var u = _this__u8e3s4.context.k1l();
2371
+ tmp$ret$0 = getInfo(tmp0_safe_receiver, IOPrimitiveUtils_getInstance(), u, _get_INFO_SINGLETONS_PATTERN__y21s87(IOPrimitiveUtils_getInstance()), singletons_0).plus(getInfo(tmp0_safe_receiver, IOPrimitiveUtils_getInstance(), u, _get_INFO_VARIABLES_PATTERN__bhp1h0(IOPrimitiveUtils_getInstance()), variables_0)).plus(getInfo(tmp0_safe_receiver, IOPrimitiveUtils_getInstance(), u, _get_INFO_VARIABLE_NAMES_PATTERN__j3oaom(IOPrimitiveUtils_getInstance()), variableNames_0));
2372
+ tmp$ret$1 = tmp$ret$0;
2373
+ tmp_1 = tmp$ret$1;
2374
+ }
2375
+ var tmp1_elvis_lhs = tmp_1;
2376
+ var info = tmp1_elvis_lhs == null ? Companion_getInstance_3().b2h(_this__u8e3s4, last(_this__u8e3s4.arguments), Companion_getInstance_8().of([variables_0, variableNames_0, singletons_0])) : tmp1_elvis_lhs;
2377
+ var tmp_2 = Companion_getInstance_3().b2h(_this__u8e3s4, arg, read).plus(info);
2378
+ tmp_0 = _this__u8e3s4.g2g(tmp_2, null, [], 6, null);
2379
+ }
2380
+ return tmp_0;
2381
+ } catch ($p) {
2382
+ if ($p instanceof IllegalStateException) {
2383
+ throw Companion_getInstance_1().forUncaughtKtException(_this__u8e3s4.context, $p);
2384
+ } else {
2385
+ if ($p instanceof ParseException) {
2386
+ var tmp_3 = Companion_getInstance_17();
2387
+ var tmp_4 = channel.g1z().toString();
2388
+ var tmp_5 = $p.line;
2389
+ var tmp_6 = $p.column;
2390
+ var tmp2_elvis_lhs = $p.message;
2391
+ throw tmp_3.whileParsingTerm(_this__u8e3s4.context, tmp_4, tmp_5, tmp_6, tmp2_elvis_lhs == null ? '<no details provided>' : tmp2_elvis_lhs);
2392
+ } else {
2393
+ throw $p;
2394
+ }
2395
+ }
2396
+ }
2397
+ };
2398
+ IOPrimitiveUtils.prototype.t3n = function (_this__u8e3s4, channel, arg, lastIsInfoList, $mask0, $handler) {
2399
+ if (!(($mask0 & 4) === 0))
2400
+ lastIsInfoList = false;
2401
+ return this.s3n(_this__u8e3s4, channel, arg, lastIsInfoList);
2402
+ };
2403
+ IOPrimitiveUtils.prototype.u3n = function (_this__u8e3s4, third) {
2404
+ var url = this.l3n(_this__u8e3s4, 0);
2405
+ var mode = this.m3n(_this__u8e3s4, 1);
2406
+ Companion_getInstance_3().o2h(_this__u8e3s4, 2);
2407
+ var tmp;
2408
+ if (_this__u8e3s4.arguments.o() >= 4) {
2409
+ Companion_getInstance_3().v2h(_this__u8e3s4, 3);
2410
+ var tmp_0 = _this__u8e3s4.arguments.n(3);
2411
+ var tmp_1 = (isInterface(tmp_0, List) ? tmp_0 : THROW_CCE()).ju();
2412
+ var tmp_2 = map(tmp_1, IOPrimitiveUtils$open$lambda(_this__u8e3s4));
2413
+ tmp = toSet(map(tmp_2, IOPrimitiveUtils$open$lambda_0(_this__u8e3s4)));
2414
+ } else {
2415
+ tmp = emptySet();
2416
+ }
2417
+ var options = tmp;
2418
+ var tmp$ret$1;
2419
+ $l$block: {
2420
+ // Inline function 'kotlin.collections.firstOrNull' call
2421
+ var tmp0_iterator = options.j();
2422
+ while (tmp0_iterator.m()) {
2423
+ var element = tmp0_iterator.p();
2424
+ var tmp$ret$0;
2425
+ // Inline function 'it.unibo.tuprolog.solve.libs.io.primitives.IOPrimitiveUtils.open.<anonymous>' call
2426
+ tmp$ret$0 = Companion_getInstance_3().c2h(_this__u8e3s4, element, _get_PROPERTY_ALIAS_PATTERN__wipd2s(IOPrimitiveUtils_getInstance()));
2427
+ if (tmp$ret$0) {
2428
+ tmp$ret$1 = element;
2429
+ break $l$block;
2430
+ }
2431
+ }
2432
+ tmp$ret$1 = null;
2433
+ }
2434
+ var tmp0_safe_receiver = tmp$ret$1;
2435
+ var alias = tmp0_safe_receiver == null ? null : _get_alias__jw26bj(tmp0_safe_receiver, this);
2436
+ var tmp1_subject = mode;
2437
+ var tmp0 = tmp1_subject.r1_1;
2438
+ var tmp_3;
2439
+ switch (tmp0) {
2440
+ case 0:
2441
+ tmp_3 = replyOpeningStream_0(_this__u8e3s4, this, openInputChannel(url), third, alias);
2442
+ break;
2443
+ case 1:
2444
+ tmp_3 = replyOpeningStream(_this__u8e3s4, this, openOutputChannel(url, false), third, alias);
2445
+ break;
2446
+ case 2:
2447
+ tmp_3 = replyOpeningStream(_this__u8e3s4, this, openOutputChannel(url, true), third, alias);
2448
+ break;
2449
+ default:
2450
+ noWhenBranchMatchedException();
2451
+ break;
2452
+ }
2453
+ return tmp_3;
2454
+ };
2455
+ var IOPrimitiveUtils_instance;
2456
+ function IOPrimitiveUtils_getInstance() {
2457
+ if (IOPrimitiveUtils_instance == null)
2458
+ new IOPrimitiveUtils();
2459
+ return IOPrimitiveUtils_instance;
2460
+ }
2461
+ function INPUT_STREAM_TERM_PATTERN$factory() {
2462
+ return getPropertyCallableRef('INPUT_STREAM_TERM_PATTERN', 1, KProperty1, function (receiver) {
2463
+ return _get_INPUT_STREAM_TERM_PATTERN__5fd8p6(receiver);
2464
+ }, null);
2465
+ }
2466
+ function OUTPUT_STREAM_TERM_PATTERN$factory() {
2467
+ return getPropertyCallableRef('OUTPUT_STREAM_TERM_PATTERN', 1, KProperty1, function (receiver) {
2468
+ return _get_OUTPUT_STREAM_TERM_PATTERN__4vocxf(receiver);
2469
+ }, null);
2470
+ }
2471
+ function PROPERTY_TYPE_PATTERN$factory() {
2472
+ return getPropertyCallableRef('PROPERTY_TYPE_PATTERN', 1, KProperty1, function (receiver) {
2473
+ return _get_PROPERTY_TYPE_PATTERN__5nq864(receiver);
2474
+ }, null);
2475
+ }
2476
+ function PROPERTY_REPOSITION_PATTERN$factory() {
2477
+ return getPropertyCallableRef('PROPERTY_REPOSITION_PATTERN', 1, KProperty1, function (receiver) {
2478
+ return _get_PROPERTY_REPOSITION_PATTERN__lznuii(receiver);
2479
+ }, null);
2480
+ }
2481
+ function PROPERTY_EOF_ACTION_PATTERN$factory() {
2482
+ return getPropertyCallableRef('PROPERTY_EOF_ACTION_PATTERN', 1, KProperty1, function (receiver) {
2483
+ return _get_PROPERTY_EOF_ACTION_PATTERN__8k2shv(receiver);
2484
+ }, null);
2485
+ }
2486
+ function PROPERTY_ALIAS_PATTERN$factory() {
2487
+ return getPropertyCallableRef('PROPERTY_ALIAS_PATTERN', 1, KProperty1, function (receiver) {
2488
+ return _get_PROPERTY_ALIAS_PATTERN__wipd2s(receiver);
2489
+ }, null);
2490
+ }
2491
+ function PROPERTY_INPUT$factory() {
2492
+ return getPropertyCallableRef('PROPERTY_INPUT', 1, KProperty1, function (receiver) {
2493
+ return _get_PROPERTY_INPUT__z2zr91(receiver);
2494
+ }, null);
2495
+ }
2496
+ function PROPERTY_OUTPUT$factory() {
2497
+ return getPropertyCallableRef('PROPERTY_OUTPUT', 1, KProperty1, function (receiver) {
2498
+ return _get_PROPERTY_OUTPUT__1pem9m(receiver);
2499
+ }, null);
2500
+ }
2501
+ function PROPERTY_TYPE_TEXT$factory() {
2502
+ return getPropertyCallableRef('PROPERTY_TYPE_TEXT', 1, KProperty1, function (receiver) {
2503
+ return _get_PROPERTY_TYPE_TEXT__9rpcwt(receiver);
2504
+ }, null);
2505
+ }
2506
+ function PROPERTY_REPOSITION_FALSE$factory() {
2507
+ return getPropertyCallableRef('PROPERTY_REPOSITION_FALSE', 1, KProperty1, function (receiver) {
2508
+ return _get_PROPERTY_REPOSITION_FALSE__i73t3b(receiver);
2509
+ }, null);
2510
+ }
2511
+ function PROPERTY_EOF_ACTION_EOF_CODE$factory() {
2512
+ return getPropertyCallableRef('PROPERTY_EOF_ACTION_EOF_CODE', 1, KProperty1, function (receiver) {
2513
+ return _get_PROPERTY_EOF_ACTION_EOF_CODE__he3pvl(receiver);
2514
+ }, null);
2515
+ }
2516
+ function OPTION_QUOTED_PATTERN$factory() {
2517
+ return getPropertyCallableRef('OPTION_QUOTED_PATTERN', 1, KProperty1, function (receiver) {
2518
+ return _get_OPTION_QUOTED_PATTERN__n2ri42(receiver);
2519
+ }, null);
2520
+ }
2521
+ function OPTION_NUMBER_VARS_PATTERN$factory() {
2522
+ return getPropertyCallableRef('OPTION_NUMBER_VARS_PATTERN', 1, KProperty1, function (receiver) {
2523
+ return _get_OPTION_NUMBER_VARS_PATTERN__p98ste(receiver);
2524
+ }, null);
2525
+ }
2526
+ function OPTION_IGNORE_OPS_PATTERN$factory() {
2527
+ return getPropertyCallableRef('OPTION_IGNORE_OPS_PATTERN', 1, KProperty1, function (receiver) {
2528
+ return _get_OPTION_IGNORE_OPS_PATTERN__cpse4v(receiver);
2529
+ }, null);
2530
+ }
2531
+ function INFO_VARIABLES_PATTERN$factory() {
2532
+ return getPropertyCallableRef('INFO_VARIABLES_PATTERN', 1, KProperty1, function (receiver) {
2533
+ return _get_INFO_VARIABLES_PATTERN__bhp1h0(receiver);
2534
+ }, null);
2535
+ }
2536
+ function INFO_VARIABLE_NAMES_PATTERN$factory() {
2537
+ return getPropertyCallableRef('INFO_VARIABLE_NAMES_PATTERN', 1, KProperty1, function (receiver) {
2538
+ return _get_INFO_VARIABLE_NAMES_PATTERN__j3oaom(receiver);
2539
+ }, null);
2540
+ }
2541
+ function INFO_SINGLETONS_PATTERN$factory() {
2542
+ return getPropertyCallableRef('INFO_SINGLETONS_PATTERN', 1, KProperty1, function (receiver) {
2543
+ return _get_INFO_SINGLETONS_PATTERN__y21s87(receiver);
2544
+ }, null);
2545
+ }
2546
+ function Nl1() {
2547
+ Nl1_instance = this;
2548
+ NonBacktrackable_0.call(this, 'nl');
2549
+ }
2550
+ Nl1.prototype.g2p = function (_this__u8e3s4, first) {
2551
+ var channel = IOPrimitiveUtils_getInstance().c3m(_this__u8e3s4, 0);
2552
+ var tmp;
2553
+ try {
2554
+ channel.write('\n');
2555
+ tmp = _this__u8e3s4.m2g(null, null, [], 7, null);
2556
+ } catch ($p) {
2557
+ var tmp_0;
2558
+ if ($p instanceof IllegalStateException) {
2559
+ tmp_0 = _this__u8e3s4.l2g(null, [], 3, null);
2560
+ } else {
2561
+ throw $p;
2562
+ }
2563
+ tmp = tmp_0;
2564
+ }
2565
+ return tmp;
2566
+ };
2567
+ Nl1.prototype.a2k = function (_this__u8e3s4, first) {
2568
+ return this.g2p(_this__u8e3s4, first);
2569
+ };
2570
+ var Nl1_instance;
2571
+ function Nl1_getInstance() {
2572
+ if (Nl1_instance == null)
2573
+ new Nl1();
2574
+ return Nl1_instance;
2575
+ }
2576
+ function Open3() {
2577
+ Open3_instance = this;
2578
+ NonBacktrackable_1.call(this, 'open');
2579
+ }
2580
+ Open3.prototype.z2r = function (_this__u8e3s4, first, second, third) {
2581
+ return IOPrimitiveUtils_getInstance().u3n(_this__u8e3s4, third);
2582
+ };
2583
+ Open3.prototype.r2j = function (_this__u8e3s4, first, second, third) {
2584
+ return this.z2r(_this__u8e3s4, first, second, third);
2585
+ };
2586
+ var Open3_instance;
2587
+ function Open3_getInstance() {
2588
+ if (Open3_instance == null)
2589
+ new Open3();
2590
+ return Open3_instance;
2591
+ }
2592
+ function Open4() {
2593
+ Open4_instance = this;
2594
+ NonBacktrackable_2.call(this, 'open');
2595
+ }
2596
+ Open4.prototype.y3n = function (_this__u8e3s4, first, second, third, fourth) {
2597
+ return IOPrimitiveUtils_getInstance().u3n(_this__u8e3s4, third);
2598
+ };
2599
+ Open4.prototype.h2i = function (_this__u8e3s4, first, second, third, fourth) {
2600
+ return this.y3n(_this__u8e3s4, first, second, third, fourth);
2601
+ };
2602
+ var Open4_instance;
2603
+ function Open4_getInstance() {
2604
+ if (Open4_instance == null)
2605
+ new Open4();
2606
+ return Open4_instance;
2607
+ }
2608
+ function PeekByte1() {
2609
+ PeekByte1_instance = this;
2610
+ NonBacktrackable_0.call(this, 'peek_byte');
2611
+ }
2612
+ PeekByte1.prototype.g2p = function (_this__u8e3s4, first) {
2613
+ var tmp = Companion_getInstance_3();
2614
+ return tmp.j2h(_this__u8e3s4, null, 1, null);
2615
+ };
2616
+ PeekByte1.prototype.a2k = function (_this__u8e3s4, first) {
2617
+ return this.g2p(_this__u8e3s4, first);
2618
+ };
2619
+ var PeekByte1_instance;
2620
+ function PeekByte1_getInstance() {
2621
+ if (PeekByte1_instance == null)
2622
+ new PeekByte1();
2623
+ return PeekByte1_instance;
2624
+ }
2625
+ function PeekByte2() {
2626
+ PeekByte2_instance = this;
2627
+ NonBacktrackable.call(this, 'peek_byte');
2628
+ }
2629
+ PeekByte2.prototype.x2p = function (_this__u8e3s4, first, second) {
2630
+ var tmp = Companion_getInstance_3();
2631
+ return tmp.j2h(_this__u8e3s4, null, 1, null);
2632
+ };
2633
+ PeekByte2.prototype.a2g = function (_this__u8e3s4, first, second) {
2634
+ return this.x2p(_this__u8e3s4, first, second);
2635
+ };
2636
+ var PeekByte2_instance;
2637
+ function PeekByte2_getInstance() {
2638
+ if (PeekByte2_instance == null)
2639
+ new PeekByte2();
2640
+ return PeekByte2_instance;
2641
+ }
2642
+ function PeekChar1() {
2643
+ PeekChar1_instance = this;
2644
+ NonBacktrackable_0.call(this, 'peek_char');
2645
+ }
2646
+ PeekChar1.prototype.g2p = function (_this__u8e3s4, first) {
2647
+ IOPrimitiveUtils_getInstance().g3m(_this__u8e3s4, 0);
2648
+ return IOPrimitiveUtils_getInstance().r3n(_this__u8e3s4, IOPrimitiveUtils_getInstance().m3l(_this__u8e3s4), first);
2649
+ };
2650
+ PeekChar1.prototype.a2k = function (_this__u8e3s4, first) {
2651
+ return this.g2p(_this__u8e3s4, first);
2652
+ };
2653
+ var PeekChar1_instance;
2654
+ function PeekChar1_getInstance() {
2655
+ if (PeekChar1_instance == null)
2656
+ new PeekChar1();
2657
+ return PeekChar1_instance;
2658
+ }
2659
+ function PeekChar2() {
2660
+ PeekChar2_instance = this;
2661
+ NonBacktrackable.call(this, 'peek_char');
2662
+ }
2663
+ PeekChar2.prototype.x2p = function (_this__u8e3s4, first, second) {
2664
+ var channel = IOPrimitiveUtils_getInstance().p3l(_this__u8e3s4, 0);
2665
+ IOPrimitiveUtils_getInstance().g3m(_this__u8e3s4, 1);
2666
+ return IOPrimitiveUtils_getInstance().r3n(_this__u8e3s4, channel, second);
2667
+ };
2668
+ PeekChar2.prototype.a2g = function (_this__u8e3s4, first, second) {
2669
+ return this.x2p(_this__u8e3s4, first, second);
2670
+ };
2671
+ var PeekChar2_instance;
2672
+ function PeekChar2_getInstance() {
2673
+ if (PeekChar2_instance == null)
2674
+ new PeekChar2();
2675
+ return PeekChar2_instance;
2676
+ }
2677
+ function PeekCode1() {
2678
+ PeekCode1_instance = this;
2679
+ NonBacktrackable_0.call(this, 'peek_code');
2680
+ }
2681
+ PeekCode1.prototype.g2p = function (_this__u8e3s4, first) {
2682
+ IOPrimitiveUtils_getInstance().k3m(_this__u8e3s4, 0);
2683
+ return IOPrimitiveUtils_getInstance().q3n(_this__u8e3s4, IOPrimitiveUtils_getInstance().m3l(_this__u8e3s4), first);
2684
+ };
2685
+ PeekCode1.prototype.a2k = function (_this__u8e3s4, first) {
2686
+ return this.g2p(_this__u8e3s4, first);
2687
+ };
2688
+ var PeekCode1_instance;
2689
+ function PeekCode1_getInstance() {
2690
+ if (PeekCode1_instance == null)
2691
+ new PeekCode1();
2692
+ return PeekCode1_instance;
2693
+ }
2694
+ function PeekCode2() {
2695
+ PeekCode2_instance = this;
2696
+ NonBacktrackable.call(this, 'peek_code');
2697
+ }
2698
+ PeekCode2.prototype.x2p = function (_this__u8e3s4, first, second) {
2699
+ var channel = IOPrimitiveUtils_getInstance().p3l(_this__u8e3s4, 0);
2700
+ IOPrimitiveUtils_getInstance().k3m(_this__u8e3s4, 0);
2701
+ return IOPrimitiveUtils_getInstance().q3n(_this__u8e3s4, channel, first);
2702
+ };
2703
+ PeekCode2.prototype.a2g = function (_this__u8e3s4, first, second) {
2704
+ return this.x2p(_this__u8e3s4, first, second);
2705
+ };
2706
+ var PeekCode2_instance;
2707
+ function PeekCode2_getInstance() {
2708
+ if (PeekCode2_instance == null)
2709
+ new PeekCode2();
2710
+ return PeekCode2_instance;
2711
+ }
2712
+ function PutByte1() {
2713
+ PutByte1_instance = this;
2714
+ NonBacktrackable_0.call(this, 'put_byte');
2715
+ }
2716
+ PutByte1.prototype.g2p = function (_this__u8e3s4, first) {
2717
+ var tmp = Companion_getInstance_3();
2718
+ return tmp.j2h(_this__u8e3s4, null, 1, null);
2719
+ };
2720
+ PutByte1.prototype.a2k = function (_this__u8e3s4, first) {
2721
+ return this.g2p(_this__u8e3s4, first);
2722
+ };
2723
+ var PutByte1_instance;
2724
+ function PutByte1_getInstance() {
2725
+ if (PutByte1_instance == null)
2726
+ new PutByte1();
2727
+ return PutByte1_instance;
2728
+ }
2729
+ function PutByte2() {
2730
+ PutByte2_instance = this;
2731
+ NonBacktrackable.call(this, 'put_byte');
2732
+ }
2733
+ PutByte2.prototype.x2p = function (_this__u8e3s4, first, second) {
2734
+ var tmp = Companion_getInstance_3();
2735
+ return tmp.j2h(_this__u8e3s4, null, 1, null);
2736
+ };
2737
+ PutByte2.prototype.a2g = function (_this__u8e3s4, first, second) {
2738
+ return this.x2p(_this__u8e3s4, first, second);
2739
+ };
2740
+ var PutByte2_instance;
2741
+ function PutByte2_getInstance() {
2742
+ if (PutByte2_instance == null)
2743
+ new PutByte2();
2744
+ return PutByte2_instance;
2745
+ }
2746
+ function PutChar1() {
2747
+ PutChar1_instance = this;
2748
+ NonBacktrackable_0.call(this, 'put_char');
2749
+ }
2750
+ PutChar1.prototype.g2p = function (_this__u8e3s4, first) {
2751
+ Companion_getInstance_3().s2h(_this__u8e3s4, 0);
2752
+ var tmp = IOPrimitiveUtils_getInstance();
2753
+ var tmp_0 = IOPrimitiveUtils_getInstance().e3n(_this__u8e3s4);
2754
+ return tmp.p3n(_this__u8e3s4, tmp_0, isInterface(first, Atom) ? first : THROW_CCE());
2755
+ };
2756
+ PutChar1.prototype.a2k = function (_this__u8e3s4, first) {
2757
+ return this.g2p(_this__u8e3s4, first);
2758
+ };
2759
+ var PutChar1_instance;
2760
+ function PutChar1_getInstance() {
2761
+ if (PutChar1_instance == null)
2762
+ new PutChar1();
2763
+ return PutChar1_instance;
2764
+ }
2765
+ function PutChar2() {
2766
+ PutChar2_instance = this;
2767
+ NonBacktrackable.call(this, 'put_char');
2768
+ }
2769
+ PutChar2.prototype.x2p = function (_this__u8e3s4, first, second) {
2770
+ var channel = IOPrimitiveUtils_getInstance().c3m(_this__u8e3s4, 0);
2771
+ Companion_getInstance_3().s2h(_this__u8e3s4, 1);
2772
+ var tmp = IOPrimitiveUtils_getInstance();
2773
+ return tmp.p3n(_this__u8e3s4, channel, isInterface(first, Atom) ? first : THROW_CCE());
2774
+ };
2775
+ PutChar2.prototype.a2g = function (_this__u8e3s4, first, second) {
2776
+ return this.x2p(_this__u8e3s4, first, second);
2777
+ };
2778
+ var PutChar2_instance;
2779
+ function PutChar2_getInstance() {
2780
+ if (PutChar2_instance == null)
2781
+ new PutChar2();
2782
+ return PutChar2_instance;
2783
+ }
2784
+ function PutCode1() {
2785
+ PutCode1_instance = this;
2786
+ NonBacktrackable_0.call(this, 'put_code');
2787
+ }
2788
+ PutCode1.prototype.g2p = function (_this__u8e3s4, first) {
2789
+ Companion_getInstance_3().b2i(_this__u8e3s4, 0);
2790
+ var tmp = IOPrimitiveUtils_getInstance();
2791
+ var tmp_0 = IOPrimitiveUtils_getInstance().e3n(_this__u8e3s4);
2792
+ return tmp.o3n(_this__u8e3s4, tmp_0, isInterface(first, Integer) ? first : THROW_CCE());
2793
+ };
2794
+ PutCode1.prototype.a2k = function (_this__u8e3s4, first) {
2795
+ return this.g2p(_this__u8e3s4, first);
2796
+ };
2797
+ var PutCode1_instance;
2798
+ function PutCode1_getInstance() {
2799
+ if (PutCode1_instance == null)
2800
+ new PutCode1();
2801
+ return PutCode1_instance;
2802
+ }
2803
+ function PutCode2() {
2804
+ PutCode2_instance = this;
2805
+ NonBacktrackable.call(this, 'put_code');
2806
+ }
2807
+ PutCode2.prototype.x2p = function (_this__u8e3s4, first, second) {
2808
+ var channel = IOPrimitiveUtils_getInstance().c3m(_this__u8e3s4, 0);
2809
+ Companion_getInstance_3().b2i(_this__u8e3s4, 1);
2810
+ var tmp = IOPrimitiveUtils_getInstance();
2811
+ return tmp.o3n(_this__u8e3s4, channel, isInterface(first, Integer) ? first : THROW_CCE());
2812
+ };
2813
+ PutCode2.prototype.a2g = function (_this__u8e3s4, first, second) {
2814
+ return this.x2p(_this__u8e3s4, first, second);
2815
+ };
2816
+ var PutCode2_instance;
2817
+ function PutCode2_getInstance() {
2818
+ if (PutCode2_instance == null)
2819
+ new PutCode2();
2820
+ return PutCode2_instance;
2821
+ }
2822
+ function Read1() {
2823
+ Read1_instance = this;
2824
+ NonBacktrackable_0.call(this, 'read');
2825
+ }
2826
+ Read1.prototype.g2p = function (_this__u8e3s4, first) {
2827
+ var tmp = IOPrimitiveUtils_getInstance();
2828
+ var tmp_0 = IOPrimitiveUtils_getInstance().m3l(_this__u8e3s4);
2829
+ return tmp.t3n(_this__u8e3s4, tmp_0, first, false, 4, null);
2830
+ };
2831
+ Read1.prototype.a2k = function (_this__u8e3s4, first) {
2832
+ return this.g2p(_this__u8e3s4, first);
2833
+ };
2834
+ var Read1_instance;
2835
+ function Read1_getInstance() {
2836
+ if (Read1_instance == null)
2837
+ new Read1();
2838
+ return Read1_instance;
2839
+ }
2840
+ function Read2() {
2841
+ Read2_instance = this;
2842
+ NonBacktrackable.call(this, 'read');
2843
+ }
2844
+ Read2.prototype.x2p = function (_this__u8e3s4, first, second) {
2845
+ var channel = IOPrimitiveUtils_getInstance().p3l(_this__u8e3s4, 0);
2846
+ var tmp = IOPrimitiveUtils_getInstance();
2847
+ return tmp.t3n(_this__u8e3s4, channel, second, false, 4, null);
2848
+ };
2849
+ Read2.prototype.a2g = function (_this__u8e3s4, first, second) {
2850
+ return this.x2p(_this__u8e3s4, first, second);
2851
+ };
2852
+ var Read2_instance;
2853
+ function Read2_getInstance() {
2854
+ if (Read2_instance == null)
2855
+ new Read2();
2856
+ return Read2_instance;
2857
+ }
2858
+ function ReadTerm2() {
2859
+ ReadTerm2_instance = this;
2860
+ NonBacktrackable.call(this, 'read_term');
2861
+ }
2862
+ ReadTerm2.prototype.x2p = function (_this__u8e3s4, first, second) {
2863
+ return IOPrimitiveUtils_getInstance().s3n(_this__u8e3s4, IOPrimitiveUtils_getInstance().m3l(_this__u8e3s4), first, true);
2864
+ };
2865
+ ReadTerm2.prototype.a2g = function (_this__u8e3s4, first, second) {
2866
+ return this.x2p(_this__u8e3s4, first, second);
2867
+ };
2868
+ var ReadTerm2_instance;
2869
+ function ReadTerm2_getInstance() {
2870
+ if (ReadTerm2_instance == null)
2871
+ new ReadTerm2();
2872
+ return ReadTerm2_instance;
2873
+ }
2874
+ function ReadTerm3() {
2875
+ ReadTerm3_instance = this;
2876
+ NonBacktrackable_1.call(this, 'read_term');
2877
+ }
2878
+ ReadTerm3.prototype.z2r = function (_this__u8e3s4, first, second, third) {
2879
+ var channel = IOPrimitiveUtils_getInstance().p3l(_this__u8e3s4, 0);
2880
+ return IOPrimitiveUtils_getInstance().s3n(_this__u8e3s4, channel, second, true);
2881
+ };
2882
+ ReadTerm3.prototype.r2j = function (_this__u8e3s4, first, second, third) {
2883
+ return this.z2r(_this__u8e3s4, first, second, third);
2884
+ };
2885
+ var ReadTerm3_instance;
2886
+ function ReadTerm3_getInstance() {
2887
+ if (ReadTerm3_instance == null)
2888
+ new ReadTerm3();
2889
+ return ReadTerm3_instance;
2890
+ }
2891
+ function SetInput$computeOne$lambda($this_computeOne, $channel) {
2892
+ return function ($this$replySuccess) {
2893
+ $this$replySuccess.g2n($this_computeOne.context.a1v().setCurrentChannel($channel));
2894
+ return Unit_getInstance();
2895
+ };
2896
+ }
2897
+ function SetInput() {
2898
+ SetInput_instance = this;
2899
+ NonBacktrackable_0.call(this, 'set_input');
2900
+ }
2901
+ SetInput.prototype.g2p = function (_this__u8e3s4, first) {
2902
+ var channel = IOPrimitiveUtils_getInstance().p3l(_this__u8e3s4, 0);
2903
+ return _this__u8e3s4.b2j(null, null, SetInput$computeOne$lambda(_this__u8e3s4, channel), 3, null);
2904
+ };
2905
+ SetInput.prototype.a2k = function (_this__u8e3s4, first) {
2906
+ return this.g2p(_this__u8e3s4, first);
2907
+ };
2908
+ var SetInput_instance;
2909
+ function SetInput_getInstance() {
2910
+ if (SetInput_instance == null)
2911
+ new SetInput();
2912
+ return SetInput_instance;
2913
+ }
2914
+ function SetOutput$computeOne$lambda($this_computeOne, $channel) {
2915
+ return function ($this$replySuccess) {
2916
+ $this$replySuccess.j2n($this_computeOne.context.b1v().setCurrentChannel($channel));
2917
+ return Unit_getInstance();
2918
+ };
2919
+ }
2920
+ function SetOutput() {
2921
+ SetOutput_instance = this;
2922
+ NonBacktrackable_0.call(this, 'set_output');
2923
+ }
2924
+ SetOutput.prototype.g2p = function (_this__u8e3s4, first) {
2925
+ var channel = IOPrimitiveUtils_getInstance().c3m(_this__u8e3s4, 0);
2926
+ return _this__u8e3s4.b2j(null, null, SetOutput$computeOne$lambda(_this__u8e3s4, channel), 3, null);
2927
+ };
2928
+ SetOutput.prototype.a2k = function (_this__u8e3s4, first) {
2929
+ return this.g2p(_this__u8e3s4, first);
2930
+ };
2931
+ var SetOutput_instance;
2932
+ function SetOutput_getInstance() {
2933
+ if (SetOutput_instance == null)
2934
+ new SetOutput();
2935
+ return SetOutput_instance;
2936
+ }
2937
+ function SetTheory$setTheory$lambda($append, $solver) {
2938
+ return function ($this$replySuccess) {
2939
+ var tmp;
2940
+ if ($append) {
2941
+ var tmp_0 = $solver.y1u();
2942
+ $this$replySuccess.t2m(tmp_0, false, 2, null);
2943
+ var tmp_1 = $solver.z1u();
2944
+ $this$replySuccess.z2m(tmp_1, false, 2, null);
2945
+ tmp = Unit_getInstance();
2946
+ } else {
2947
+ $this$replySuccess.r2m($solver.y1u());
2948
+ $this$replySuccess.x2m($solver.z1u());
2949
+ tmp = Unit_getInstance();
2950
+ }
2951
+ $this$replySuccess.e2n($solver.h1v());
2952
+ $this$replySuccess.d2n($solver.x1u());
2953
+ return Unit_getInstance();
2954
+ };
2955
+ }
2956
+ function SetTheory() {
2957
+ SetTheory_instance = this;
2958
+ NonBacktrackable_0.call(this, 'set_theory');
2959
+ }
2960
+ SetTheory.prototype.g2p = function (_this__u8e3s4, first) {
2961
+ Companion_getInstance_3().q2h(_this__u8e3s4, 0);
2962
+ return this.r3o(_this__u8e3s4, first.zw().b1(), false);
2963
+ };
2964
+ SetTheory.prototype.a2k = function (_this__u8e3s4, first) {
2965
+ return this.g2p(_this__u8e3s4, first);
2966
+ };
2967
+ SetTheory.prototype.r3o = function (_this__u8e3s4, text, append) {
2968
+ try {
2969
+ var theory = Companion_getInstance_18().withOperatorSet(_this__u8e3s4.context.h1v()).parseTheoryWithDefaultUnificator(text);
2970
+ var tmp = Companion_getInstance_19().empty(_this__u8e3s4.context.k1l());
2971
+ var tmp_0 = Companion_getInstance_20().empty(_this__u8e3s4.context.k1l());
2972
+ var solver = _this__u8e3s4.context.d1v(null, null, null, tmp, tmp_0, null, null, 103, null);
2973
+ solver.loadStaticKb(theory);
2974
+ return _this__u8e3s4.b2j(null, null, SetTheory$setTheory$lambda(append, solver), 3, null);
2975
+ } catch ($p) {
2976
+ if ($p instanceof ParseException) {
2977
+ var tmp_1 = Companion_getInstance_17();
2978
+ var tmp_2 = $p.clauseIndex;
2979
+ var tmp_3 = $p.line;
2980
+ var tmp_4 = $p.column;
2981
+ var tmp0_safe_receiver = $p.message;
2982
+ var tmp_5;
2983
+ if (tmp0_safe_receiver == null) {
2984
+ tmp_5 = null;
2985
+ } else {
2986
+ var tmp$ret$4;
2987
+ // Inline function 'kotlin.text.replaceFirstChar' call
2988
+ var tmp_6;
2989
+ var tmp$ret$0;
2990
+ // Inline function 'kotlin.text.isNotEmpty' call
2991
+ tmp$ret$0 = charSequenceLength(tmp0_safe_receiver) > 0;
2992
+ if (tmp$ret$0) {
2993
+ var tmp$ret$1;
2994
+ // Inline function 'it.unibo.tuprolog.solve.libs.io.primitives.SetTheory.setTheory.<anonymous>' call
2995
+ var tmp0__anonymous__q1qw7t = charSequenceGet(tmp0_safe_receiver, 0);
2996
+ tmp$ret$1 = isLowerCase(tmp0__anonymous__q1qw7t) ? titlecase(tmp0__anonymous__q1qw7t) : toString(tmp0__anonymous__q1qw7t);
2997
+ var tmp_7 = toString_0(tmp$ret$1);
2998
+ var tmp$ret$3;
2999
+ // Inline function 'kotlin.text.substring' call
3000
+ var tmp$ret$2;
3001
+ // Inline function 'kotlin.js.asDynamic' call
3002
+ tmp$ret$2 = tmp0_safe_receiver;
3003
+ tmp$ret$3 = tmp$ret$2.substring(1);
3004
+ tmp_6 = tmp_7 + tmp$ret$3;
3005
+ } else {
3006
+ tmp_6 = tmp0_safe_receiver;
3007
+ }
3008
+ tmp$ret$4 = tmp_6;
3009
+ tmp_5 = tmp$ret$4;
3010
+ }
3011
+ var tmp1_elvis_lhs = tmp_5;
3012
+ throw tmp_1.whileParsingClauses(_this__u8e3s4.context, text, tmp_2, tmp_3, tmp_4, tmp1_elvis_lhs == null ? '<no detail provided>' : tmp1_elvis_lhs);
3013
+ } else {
3014
+ throw $p;
3015
+ }
3016
+ }
3017
+ };
3018
+ SetTheory.prototype.w3l = function (_this__u8e3s4, text, append, $mask0, $handler) {
3019
+ if (!(($mask0 & 2) === 0))
3020
+ append = true;
3021
+ return this.r3o(_this__u8e3s4, text, append);
3022
+ };
3023
+ var SetTheory_instance;
3024
+ function SetTheory_getInstance() {
3025
+ if (SetTheory_instance == null)
3026
+ new SetTheory();
3027
+ return SetTheory_instance;
3028
+ }
3029
+ function StreamProperty$computeAll$lambda(it) {
3030
+ return asSequence_0(it.c3());
3031
+ }
3032
+ function StreamProperty$computeAll$lambda_0($this_computeAll) {
3033
+ return function (it) {
3034
+ return to(it.g1z(), IOPrimitiveUtils_getInstance().d3n($this_computeAll, it));
3035
+ };
3036
+ }
3037
+ function StreamProperty$computeAll$lambda_1(_name_for_destructuring_parameter_0__wldtmu) {
3038
+ var streamTerm = _name_for_destructuring_parameter_0__wldtmu.n3();
3039
+ var properties = _name_for_destructuring_parameter_0__wldtmu.o3();
3040
+ return map(properties, StreamProperty$computeAll$lambda$lambda(streamTerm));
3041
+ }
3042
+ function StreamProperty$computeAll$lambda$lambda($streamTerm) {
3043
+ return function (it) {
3044
+ return to($streamTerm, it);
3045
+ };
3046
+ }
3047
+ function StreamProperty$computeAll$lambda_2($this_computeAll, $first, $second) {
3048
+ return function (_name_for_destructuring_parameter_0__wldtmu) {
3049
+ var streamTerm = _name_for_destructuring_parameter_0__wldtmu.n3();
3050
+ var property = _name_for_destructuring_parameter_0__wldtmu.o3();
3051
+ var tmp = Companion_getInstance_3().b2h($this_computeAll, $first, streamTerm).plus(Companion_getInstance_3().b2h($this_computeAll, $second, property));
3052
+ return $this_computeAll.g2g(tmp, null, [], 6, null);
3053
+ };
3054
+ }
3055
+ function StreamProperty() {
3056
+ StreamProperty_instance = this;
3057
+ BinaryRelation.call(this, 'stream_property');
3058
+ }
3059
+ StreamProperty.prototype.t2p = function (_this__u8e3s4, first, second) {
3060
+ IOPrimitiveUtils_getInstance().z3l(_this__u8e3s4, 0);
3061
+ IOPrimitiveUtils_getInstance().k3n(_this__u8e3s4, 1);
3062
+ var tmp = sequenceOf([_this__u8e3s4.context.a1v(), _this__u8e3s4.context.b1v()]);
3063
+ var tmp_0 = distinct(flatMap(tmp, StreamProperty$computeAll$lambda));
3064
+ var tmp_1 = map(tmp_0, StreamProperty$computeAll$lambda_0(_this__u8e3s4));
3065
+ var tmp_2 = flatMap(tmp_1, StreamProperty$computeAll$lambda_1);
3066
+ return map(tmp_2, StreamProperty$computeAll$lambda_2(_this__u8e3s4, first, second));
3067
+ };
3068
+ StreamProperty.prototype.c2g = function (_this__u8e3s4, first, second) {
3069
+ return this.t2p(_this__u8e3s4, first, second);
3070
+ };
3071
+ var StreamProperty_instance;
3072
+ function StreamProperty_getInstance() {
3073
+ if (StreamProperty_instance == null)
3074
+ new StreamProperty();
3075
+ return StreamProperty_instance;
3076
+ }
3077
+ function Write2() {
3078
+ Write2_instance = this;
3079
+ NonBacktrackable.call(this, 'write');
3080
+ }
3081
+ Write2.prototype.x2p = function (_this__u8e3s4, first, second) {
3082
+ var channel = IOPrimitiveUtils_getInstance().c3m(_this__u8e3s4, 0);
3083
+ return IOPrimitiveUtils_getInstance().n3n(_this__u8e3s4, channel, second, Companion_getInstance_13().j14(_this__u8e3s4.context.h1v()));
3084
+ };
3085
+ Write2.prototype.a2g = function (_this__u8e3s4, first, second) {
3086
+ return this.x2p(_this__u8e3s4, first, second);
3087
+ };
3088
+ var Write2_instance;
3089
+ function Write2_getInstance() {
3090
+ if (Write2_instance == null)
3091
+ new Write2();
3092
+ return Write2_instance;
3093
+ }
3094
+ function WriteCanonical1() {
3095
+ WriteCanonical1_instance = this;
3096
+ NonBacktrackable_0.call(this, 'write_canonical');
3097
+ }
3098
+ WriteCanonical1.prototype.g2p = function (_this__u8e3s4, first) {
3099
+ return IOPrimitiveUtils_getInstance().n3n(_this__u8e3s4, IOPrimitiveUtils_getInstance().e3n(_this__u8e3s4), first, Companion_getInstance_13().canonical());
3100
+ };
3101
+ WriteCanonical1.prototype.a2k = function (_this__u8e3s4, first) {
3102
+ return this.g2p(_this__u8e3s4, first);
3103
+ };
3104
+ var WriteCanonical1_instance;
3105
+ function WriteCanonical1_getInstance() {
3106
+ if (WriteCanonical1_instance == null)
3107
+ new WriteCanonical1();
3108
+ return WriteCanonical1_instance;
3109
+ }
3110
+ function WriteCanonical2() {
3111
+ WriteCanonical2_instance = this;
3112
+ NonBacktrackable.call(this, 'write_canonical');
3113
+ }
3114
+ WriteCanonical2.prototype.x2p = function (_this__u8e3s4, first, second) {
3115
+ var channel = IOPrimitiveUtils_getInstance().c3m(_this__u8e3s4, 0);
3116
+ return IOPrimitiveUtils_getInstance().n3n(_this__u8e3s4, channel, second, Companion_getInstance_13().canonical());
3117
+ };
3118
+ WriteCanonical2.prototype.a2g = function (_this__u8e3s4, first, second) {
3119
+ return this.x2p(_this__u8e3s4, first, second);
3120
+ };
3121
+ var WriteCanonical2_instance;
3122
+ function WriteCanonical2_getInstance() {
3123
+ if (WriteCanonical2_instance == null)
3124
+ new WriteCanonical2();
3125
+ return WriteCanonical2_instance;
3126
+ }
3127
+ function WriteEq1() {
3128
+ WriteEq1_instance = this;
3129
+ NonBacktrackable_0.call(this, 'writeq');
3130
+ }
3131
+ WriteEq1.prototype.g2p = function (_this__u8e3s4, first) {
3132
+ var tmp = IOPrimitiveUtils_getInstance();
3133
+ var tmp_0 = IOPrimitiveUtils_getInstance().e3n(_this__u8e3s4);
3134
+ var tmp_1 = Companion_getInstance_13();
3135
+ return tmp.n3n(_this__u8e3s4, tmp_0, first, tmp_1.l14(null, 1, null));
3136
+ };
3137
+ WriteEq1.prototype.a2k = function (_this__u8e3s4, first) {
3138
+ return this.g2p(_this__u8e3s4, first);
3139
+ };
3140
+ var WriteEq1_instance;
3141
+ function WriteEq1_getInstance() {
3142
+ if (WriteEq1_instance == null)
3143
+ new WriteEq1();
3144
+ return WriteEq1_instance;
3145
+ }
3146
+ function WriteEq2() {
3147
+ WriteEq2_instance = this;
3148
+ NonBacktrackable.call(this, 'writeq');
3149
+ }
3150
+ WriteEq2.prototype.x2p = function (_this__u8e3s4, first, second) {
3151
+ var channel = IOPrimitiveUtils_getInstance().c3m(_this__u8e3s4, 0);
3152
+ var tmp = IOPrimitiveUtils_getInstance();
3153
+ var tmp_0 = Companion_getInstance_13();
3154
+ return tmp.n3n(_this__u8e3s4, channel, second, tmp_0.l14(null, 1, null));
3155
+ };
3156
+ WriteEq2.prototype.a2g = function (_this__u8e3s4, first, second) {
3157
+ return this.x2p(_this__u8e3s4, first, second);
3158
+ };
3159
+ var WriteEq2_instance;
3160
+ function WriteEq2_getInstance() {
3161
+ if (WriteEq2_instance == null)
3162
+ new WriteEq2();
3163
+ return WriteEq2_instance;
3164
+ }
3165
+ function WriteTerm2() {
3166
+ WriteTerm2_instance = this;
3167
+ NonBacktrackable.call(this, 'write_term');
3168
+ }
3169
+ WriteTerm2.prototype.x2p = function (_this__u8e3s4, first, second) {
3170
+ var formatter = IOPrimitiveUtils_getInstance().j3n(_this__u8e3s4, 1);
3171
+ return IOPrimitiveUtils_getInstance().n3n(_this__u8e3s4, IOPrimitiveUtils_getInstance().e3n(_this__u8e3s4), first, formatter);
3172
+ };
3173
+ WriteTerm2.prototype.a2g = function (_this__u8e3s4, first, second) {
3174
+ return this.x2p(_this__u8e3s4, first, second);
3175
+ };
3176
+ var WriteTerm2_instance;
3177
+ function WriteTerm2_getInstance() {
3178
+ if (WriteTerm2_instance == null)
3179
+ new WriteTerm2();
3180
+ return WriteTerm2_instance;
3181
+ }
3182
+ function WriteTerm3() {
3183
+ WriteTerm3_instance = this;
3184
+ NonBacktrackable_1.call(this, 'write_term');
3185
+ }
3186
+ WriteTerm3.prototype.z2r = function (_this__u8e3s4, first, second, third) {
3187
+ var channel = IOPrimitiveUtils_getInstance().c3m(_this__u8e3s4, 0);
3188
+ var formatter = IOPrimitiveUtils_getInstance().j3n(_this__u8e3s4, 1);
3189
+ return IOPrimitiveUtils_getInstance().n3n(_this__u8e3s4, channel, first, formatter);
3190
+ };
3191
+ WriteTerm3.prototype.r2j = function (_this__u8e3s4, first, second, third) {
3192
+ return this.z2r(_this__u8e3s4, first, second, third);
3193
+ };
3194
+ var WriteTerm3_instance;
3195
+ function WriteTerm3_getInstance() {
3196
+ if (WriteTerm3_instance == null)
3197
+ new WriteTerm3();
3198
+ return WriteTerm3_instance;
3199
+ }
3200
+ function asTermChannel(_this__u8e3s4, operators) {
3201
+ throw IllegalStateException_init_$Create$('Reading terms is still not supported for JS');
3202
+ }
3203
+ function get_FS() {
3204
+ init_properties_FileSystem_kt_v57kfj();
3205
+ var tmp$ret$0;
3206
+ // Inline function 'kotlin.getValue' call
3207
+ var tmp0_getValue = FS$factory();
3208
+ tmp$ret$0 = FS$delegate.b1();
3209
+ return tmp$ret$0;
3210
+ }
3211
+ var FS$delegate;
3212
+ function get_PATH() {
3213
+ init_properties_FileSystem_kt_v57kfj();
3214
+ var tmp$ret$0;
3215
+ // Inline function 'kotlin.getValue' call
3216
+ var tmp0_getValue = PATH$factory();
3217
+ tmp$ret$0 = PATH$delegate.b1();
3218
+ return tmp$ret$0;
3219
+ }
3220
+ var PATH$delegate;
3221
+ function get_READ_TEXT() {
3222
+ init_properties_FileSystem_kt_v57kfj();
3223
+ return READ_TEXT;
3224
+ }
3225
+ var READ_TEXT;
3226
+ function get_READ_BINARY() {
3227
+ init_properties_FileSystem_kt_v57kfj();
3228
+ return READ_BINARY;
3229
+ }
3230
+ var READ_BINARY;
3231
+ function get_REQUEST() {
3232
+ init_properties_FileSystem_kt_v57kfj();
3233
+ var tmp$ret$0;
3234
+ // Inline function 'kotlin.getValue' call
3235
+ var tmp0_getValue = REQUEST$factory();
3236
+ tmp$ret$0 = REQUEST$delegate.b1();
3237
+ return tmp$ret$0;
3238
+ }
3239
+ var REQUEST$delegate;
3240
+ function readText(path) {
3241
+ init_properties_FileSystem_kt_v57kfj();
3242
+ var tmp;
3243
+ if (Info_getInstance().pu().equals(Platform_BROWSER_getInstance())) {
3244
+ tmp = browserReadText(path);
3245
+ } else {
3246
+ tmp = nodeReadText(path);
3247
+ }
3248
+ return tmp;
3249
+ }
3250
+ function fetch(url, encoding) {
3251
+ init_properties_FileSystem_kt_v57kfj();
3252
+ try {
3253
+ var response = get_REQUEST()('GET', url, {});
3254
+ var tmp$ret$0;
3255
+ // Inline function 'kotlin.js.unsafeCast' call
3256
+ var tmp0_unsafeCast = response.getBody(encoding);
3257
+ tmp$ret$0 = tmp0_unsafeCast;
3258
+ return tmp$ret$0;
3259
+ } catch ($p) {
3260
+ if ($p instanceof Error) {
3261
+ throw IOException_init_$Create$_0($p.message, $p);
3262
+ } else {
3263
+ throw $p;
3264
+ }
3265
+ }
3266
+ }
3267
+ function fetch$default(url, encoding, $mask0, $handler) {
3268
+ if (!(($mask0 & 2) === 0))
3269
+ encoding = null;
3270
+ return fetch(url, encoding);
3271
+ }
3272
+ function readBin(path) {
3273
+ init_properties_FileSystem_kt_v57kfj();
3274
+ var tmp;
3275
+ if (Info_getInstance().pu().equals(Platform_BROWSER_getInstance())) {
3276
+ tmp = browserReadBin(path);
3277
+ } else {
3278
+ tmp = nodeReadBin(path);
3279
+ }
3280
+ return tmp;
3281
+ }
3282
+ function toByteArray(_this__u8e3s4) {
3283
+ init_properties_FileSystem_kt_v57kfj();
3284
+ return toByteArray_0(toUInt8Array(_this__u8e3s4));
3285
+ }
3286
+ function browserReadText(path) {
3287
+ init_properties_FileSystem_kt_v57kfj();
3288
+ var tmp$ret$0;
3289
+ // Inline function 'kotlin.js.unsafeCast' call
3290
+ var tmp0_unsafeCast = window.localStorage.getItem(path);
3291
+ tmp$ret$0 = tmp0_unsafeCast;
3292
+ var tmp0_elvis_lhs = tmp$ret$0;
3293
+ var tmp;
3294
+ if (tmp0_elvis_lhs == null) {
3295
+ throw IOException_init_$Create$('No such entry in window.localStorage: ' + path);
3296
+ } else {
3297
+ tmp = tmp0_elvis_lhs;
3298
+ }
3299
+ return tmp;
3300
+ }
3301
+ function nodeReadText(path) {
3302
+ init_properties_FileSystem_kt_v57kfj();
3303
+ var tmp;
3304
+ try {
3305
+ var tmp$ret$0;
3306
+ // Inline function 'kotlin.js.unsafeCast' call
3307
+ var tmp0_unsafeCast = get_FS().readFileSync(toOsSpecificPath(path), get_READ_TEXT());
3308
+ tmp$ret$0 = tmp0_unsafeCast;
3309
+ tmp = tmp$ret$0;
3310
+ } catch ($p) {
3311
+ var tmp_0;
3312
+ if ($p instanceof Error) {
3313
+ throw IOException_init_$Create$_0('Error while reading file `' + path + '`: ' + $p.message, $p);
3314
+ } else {
3315
+ throw $p;
3316
+ }
3317
+ tmp = tmp_0;
3318
+ }
3319
+ return tmp;
3320
+ }
3321
+ function browserReadBin(path) {
3322
+ init_properties_FileSystem_kt_v57kfj();
3323
+ var tmp$ret$0;
3324
+ // Inline function 'kotlin.js.unsafeCast' call
3325
+ var tmp0_unsafeCast = window.localStorage.getItem(path);
3326
+ tmp$ret$0 = tmp0_unsafeCast;
3327
+ var tmp0_safe_receiver = tmp$ret$0;
3328
+ var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : toByteArray(tmp0_safe_receiver);
3329
+ var tmp;
3330
+ if (tmp1_elvis_lhs == null) {
3331
+ throw IOException_init_$Create$('No such entry in window.localStorage: ' + path);
3332
+ } else {
3333
+ tmp = tmp1_elvis_lhs;
3334
+ }
3335
+ return tmp;
3336
+ }
3337
+ function nodeReadBin(path) {
3338
+ init_properties_FileSystem_kt_v57kfj();
3339
+ var tmp;
3340
+ try {
3341
+ tmp = toByteArray_1(get_FS().readFileSync(toOsSpecificPath(path), get_READ_BINARY()));
3342
+ } catch ($p) {
3343
+ var tmp_0;
3344
+ if ($p instanceof Error) {
3345
+ throw IOException_init_$Create$_0('Error while reading file ' + path, $p);
3346
+ } else {
3347
+ throw $p;
3348
+ }
3349
+ tmp = tmp_0;
3350
+ }
3351
+ return tmp;
3352
+ }
3353
+ function toByteArray_0(_this__u8e3s4) {
3354
+ init_properties_FileSystem_kt_v57kfj();
3355
+ var tmp = 0;
3356
+ var tmp_0 = _this__u8e3s4.length;
3357
+ var tmp_1 = new Int8Array(tmp_0);
3358
+ while (tmp < tmp_0) {
3359
+ var tmp_2 = tmp;
3360
+ var tmp$ret$2;
3361
+ // Inline function 'it.unibo.tuprolog.solve.libs.io.toByteArray.<anonymous>' call
3362
+ var tmp$ret$1;
3363
+ // Inline function 'org.khronos.webgl.get' call
3364
+ var tmp$ret$0;
3365
+ // Inline function 'kotlin.js.asDynamic' call
3366
+ tmp$ret$0 = _this__u8e3s4;
3367
+ tmp$ret$1 = tmp$ret$0[tmp_2];
3368
+ tmp$ret$2 = tmp$ret$1;
3369
+ tmp_1[tmp_2] = tmp$ret$2;
3370
+ tmp = tmp + 1 | 0;
3371
+ }
3372
+ return tmp_1;
3373
+ }
3374
+ function toUInt8Array(_this__u8e3s4) {
3375
+ init_properties_FileSystem_kt_v57kfj();
3376
+ return new Uint8Array(_this__u8e3s4);
3377
+ }
3378
+ function toOsSpecificPath(_this__u8e3s4) {
3379
+ init_properties_FileSystem_kt_v57kfj();
3380
+ if (get_PATH().sep == '\\') {
3381
+ var tmp;
3382
+ if (startsWith$default(_this__u8e3s4, '/', false, 2, null)) {
3383
+ var tmp$ret$1;
3384
+ // Inline function 'kotlin.text.substring' call
3385
+ var tmp$ret$0;
3386
+ // Inline function 'kotlin.js.asDynamic' call
3387
+ tmp$ret$0 = _this__u8e3s4;
3388
+ tmp$ret$1 = tmp$ret$0.substring(1);
3389
+ tmp = tmp$ret$1;
3390
+ } else {
3391
+ tmp = _this__u8e3s4;
3392
+ }
3393
+ var rootFreePath = tmp;
3394
+ return replace$default(rootFreePath, '/', '\\', false, 4, null);
3395
+ }
3396
+ return _this__u8e3s4;
3397
+ }
3398
+ function toByteArray_1(obj) {
3399
+ init_properties_FileSystem_kt_v57kfj();
3400
+ var tmp = 0;
3401
+ var tmp_0 = obj.length;
3402
+ var tmp_1 = new Int8Array(tmp_0);
3403
+ while (tmp < tmp_0) {
3404
+ var tmp_2 = tmp;
3405
+ var tmp$ret$0;
3406
+ // Inline function 'it.unibo.tuprolog.solve.libs.io.toByteArray.<anonymous>' call
3407
+ tmp$ret$0 = obj[tmp_2];
3408
+ tmp_1[tmp_2] = tmp$ret$0;
3409
+ tmp = tmp + 1 | 0;
3410
+ }
3411
+ return tmp_1;
3412
+ }
3413
+ function FS$delegate$lambda() {
3414
+ init_properties_FileSystem_kt_v57kfj();
3415
+ return require('fs');
3416
+ }
3417
+ function PATH$delegate$lambda() {
3418
+ init_properties_FileSystem_kt_v57kfj();
3419
+ return require('path');
3420
+ }
3421
+ function REQUEST$delegate$lambda() {
3422
+ init_properties_FileSystem_kt_v57kfj();
3423
+ return require('sync-request');
3424
+ }
3425
+ function FS$factory() {
3426
+ return getPropertyCallableRef('FS', 0, KProperty0, function () {
3427
+ return get_FS();
3428
+ }, null);
3429
+ }
3430
+ function PATH$factory() {
3431
+ return getPropertyCallableRef('PATH', 0, KProperty0, function () {
3432
+ return get_PATH();
3433
+ }, null);
3434
+ }
3435
+ function REQUEST$factory() {
3436
+ return getPropertyCallableRef('REQUEST', 0, KProperty0, function () {
3437
+ return get_REQUEST();
3438
+ }, null);
3439
+ }
3440
+ var properties_initialized_FileSystem_kt_g28cz1;
3441
+ function init_properties_FileSystem_kt_v57kfj() {
3442
+ if (properties_initialized_FileSystem_kt_g28cz1) {
3443
+ } else {
3444
+ properties_initialized_FileSystem_kt_g28cz1 = true;
3445
+ FS$delegate = lazy(FS$delegate$lambda);
3446
+ PATH$delegate = lazy(PATH$delegate$lambda);
3447
+ READ_TEXT = {encoding: 'UTF-8', flag: 'r'};
3448
+ READ_BINARY = {encoding: 'binary', flag: 'r'};
3449
+ REQUEST$delegate = lazy(REQUEST$delegate$lambda);
3450
+ }
3451
+ }
3452
+ function JsUrl_init_$Init$(url, $this) {
3453
+ JsUrl.call($this);
3454
+ var tmp0_elvis_lhs = Companion_getInstance_22().e31(url);
3455
+ var tmp;
3456
+ if (tmp0_elvis_lhs == null) {
3457
+ throw InvalidUrlException_init_$Create$('Invalid URL: ' + url);
3458
+ } else {
3459
+ tmp = tmp0_elvis_lhs;
3460
+ }
3461
+ var match = tmp;
3462
+ var tmp_0 = $this;
3463
+ var tmp1_elvis_lhs = match.a3(UrlField_PROTOCOL_getInstance());
3464
+ tmp_0.b3p_1 = tmp1_elvis_lhs == null ? '' : tmp1_elvis_lhs;
3465
+ var tmp_1 = $this;
3466
+ var tmp2_elvis_lhs = match.a3(UrlField_HOST_getInstance());
3467
+ tmp_1.c3p_1 = tmp2_elvis_lhs == null ? '' : tmp2_elvis_lhs;
3468
+ var tmp_2 = $this;
3469
+ var tmp3_elvis_lhs = match.a3(UrlField_PATH_getInstance());
3470
+ tmp_2.d3p_1 = tmp3_elvis_lhs == null ? '' : tmp3_elvis_lhs;
3471
+ var tmp_3 = $this;
3472
+ var tmp4_safe_receiver = match.a3(UrlField_PORT_getInstance());
3473
+ var tmp5_safe_receiver = tmp4_safe_receiver == null ? null : toInt(tmp4_safe_receiver);
3474
+ tmp_3.e3p_1 = tmp5_safe_receiver == null ? null : Companion_getInstance_22().h3k(tmp5_safe_receiver);
3475
+ $this.f3p_1 = match.a3(UrlField_QUERY_getInstance());
3476
+ $this.a3p_1 = url;
3477
+ return $this;
3478
+ }
3479
+ function JsUrl_init_$Create$(url) {
3480
+ return JsUrl_init_$Init$(url, Object.create(JsUrl.prototype));
3481
+ }
3482
+ function JsUrl_init_$Init$_0(protocol, host, port, path, query, $this) {
3483
+ JsUrl.call($this);
3484
+ $this.b3p_1 = protocol;
3485
+ $this.c3p_1 = host;
3486
+ $this.e3p_1 = port;
3487
+ $this.d3p_1 = path;
3488
+ $this.f3p_1 = query;
3489
+ $this.a3p_1 = Companion_getInstance_22().l3k(protocol, host, port, path, query);
3490
+ return $this;
3491
+ }
3492
+ function JsUrl_init_$Create$_0(protocol, host, port, path, query) {
3493
+ return JsUrl_init_$Init$_0(protocol, host, port, path, query, Object.create(JsUrl.prototype));
3494
+ }
3495
+ function JsUrl_init_$Init$_1(protocol, host, port, path, query, $mask0, $marker, $this) {
3496
+ if (!(($mask0 & 2) === 0))
3497
+ host = '';
3498
+ if (!(($mask0 & 4) === 0))
3499
+ port = null;
3500
+ if (!(($mask0 & 8) === 0))
3501
+ path = '';
3502
+ if (!(($mask0 & 16) === 0))
3503
+ query = null;
3504
+ JsUrl_init_$Init$_0(protocol, host, port, path, query, $this);
3505
+ return $this;
3506
+ }
3507
+ function JsUrl_init_$Create$_1(protocol, host, port, path, query, $mask0, $marker) {
3508
+ return JsUrl_init_$Init$_1(protocol, host, port, path, query, $mask0, $marker, Object.create(JsUrl.prototype));
3509
+ }
3510
+ JsUrl.prototype.m3k = function () {
3511
+ return this.b3p_1;
3512
+ };
3513
+ JsUrl.prototype.n3k = function () {
3514
+ return this.c3p_1;
3515
+ };
3516
+ JsUrl.prototype.k31 = function () {
3517
+ return this.d3p_1;
3518
+ };
3519
+ JsUrl.prototype.o3k = function () {
3520
+ return this.e3p_1;
3521
+ };
3522
+ JsUrl.prototype.x1v = function () {
3523
+ return this.f3p_1;
3524
+ };
3525
+ JsUrl.prototype.g3p = function () {
3526
+ if (this.p3k()) {
3527
+ return readText(this.d3p_1);
3528
+ } else {
3529
+ return fetch(this.a3p_1, 'UTF-8');
3530
+ }
3531
+ };
3532
+ JsUrl.prototype.readAsText = function () {
3533
+ return this.g3p();
3534
+ };
3535
+ JsUrl.prototype.h3p = function () {
3536
+ if (this.p3k()) {
3537
+ return readBin(this.d3p_1);
3538
+ } else {
3539
+ return toByteArray(fetch$default(this.a3p_1, null, 2, null));
3540
+ }
3541
+ };
3542
+ JsUrl.prototype.readAsByteArray = function () {
3543
+ return this.h3p();
3544
+ };
3545
+ JsUrl.prototype.equals = function (other) {
3546
+ if (this === other)
3547
+ return true;
3548
+ if (other == null ? true : !(this.constructor == other.constructor))
3549
+ return false;
3550
+ if (other instanceof JsUrl)
3551
+ other;
3552
+ else
3553
+ THROW_CCE();
3554
+ if (!(this.a3p_1 === other.a3p_1))
3555
+ return false;
3556
+ return true;
3557
+ };
3558
+ JsUrl.prototype.hashCode = function () {
3559
+ return getStringHashCode(this.a3p_1);
3560
+ };
3561
+ JsUrl.prototype.toString = function () {
3562
+ return this.a3p_1;
3563
+ };
3564
+ function JsUrl() {
3565
+ }
3566
+ function openInputChannel(_this__u8e3s4) {
3567
+ return Companion_getInstance_10().ofString(_this__u8e3s4.readAsText());
3568
+ }
3569
+ function openOutputChannel(_this__u8e3s4, append) {
3570
+ throw IOException_init_$Create$('Writing not supported for ' + toString_0(_this__u8e3s4));
3571
+ }
3572
+ function fileUrl(path) {
3573
+ return JsUrl_init_$Create$_1('file', null, null, path, null, 22, null);
3574
+ }
3575
+ function remoteUrl(protocol, host, port, path, query) {
3576
+ return JsUrl_init_$Create$_0(protocol, host, port, path, query);
3577
+ }
3578
+ function parseUrl(string) {
3579
+ return JsUrl_init_$Create$(string);
3580
+ }
3581
+ //region block: post-declaration
3582
+ IOLib.prototype.containsSignature = containsSignature;
3583
+ IOLib.prototype.containsOperator = containsOperator;
3584
+ IOLib.prototype.hasPrimitive = hasPrimitive;
3585
+ IOLib.prototype.hasFunction = hasFunction;
3586
+ IOLib.prototype.j2e = get_ruleSignatures;
3587
+ IOLib.prototype.hasProtected = hasProtected;
3588
+ JsUrl.prototype.resolve = resolve;
3589
+ JsUrl.prototype.div = div;
3590
+ JsUrl.prototype.p3k = get_isFile;
3591
+ JsUrl.prototype.q3k = get_isHttp;
3592
+ //endregion
3593
+ //region block: exports
3594
+ _.$_$ = _.$_$ || {};
3595
+ _.$_$.a = IOLib_getInstance;
3596
+ //endregion
3597
+ return _;
3598
+ }(module.exports, require('./2p-solve.js'), require('./kotlin-kotlin-stdlib-js-ir.js'), require('./2p-core.js'), require('./2p-parser-core.js'), require('./2p-parser-theory.js'), require('./2p-theory.js')));
3599
+
3600
+ //# sourceMappingURL=2p-io-lib.js.map