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