@tuprolog/arg2p-core 0.17.2 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/2p-io-lib.js CHANGED
@@ -1,13 +1,3708 @@
1
1
  (function (factory) {
2
2
  if (typeof define === 'function' && define.amd)
3
- define(['exports'], factory);
3
+ define(['exports', './kotlin-kotlin-stdlib.js', './2p-parser-impl.js', './2p-solve.js', './2p-parser-core.js', './2p-core.js', './okio-parent-okio.js', './2p-parser-theory.js', './2p-theory.js', './okio-parent-okio-nodefilesystem.js'], factory);
4
4
  else if (typeof exports === 'object')
5
- factory(module.exports);
6
- else
7
- globalThis['2p-io-lib'] = factory(typeof globalThis['2p-io-lib'] === 'undefined' ? {} : globalThis['2p-io-lib']);
8
- }(function (_) {
5
+ factory(module.exports, require('./kotlin-kotlin-stdlib.js'), require('./2p-parser-impl.js'), require('./2p-solve.js'), require('./2p-parser-core.js'), require('./2p-core.js'), require('./okio-parent-okio.js'), require('./2p-parser-theory.js'), require('./2p-theory.js'), require('./okio-parent-okio-nodefilesystem.js'));
6
+ else {
7
+ if (typeof globalThis['kotlin-kotlin-stdlib'] === 'undefined') {
8
+ 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'.");
9
+ }
10
+ if (typeof globalThis['2p-parser-impl'] === 'undefined') {
11
+ throw new Error("Error loading module '2p-io-lib'. Its dependency '2p-parser-impl' was not found. Please, check whether '2p-parser-impl' is loaded prior to '2p-io-lib'.");
12
+ }
13
+ if (typeof globalThis['2p-solve'] === 'undefined') {
14
+ 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'.");
15
+ }
16
+ if (typeof globalThis['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 globalThis['2p-core'] === 'undefined') {
20
+ 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'.");
21
+ }
22
+ if (typeof globalThis['okio-parent-okio'] === 'undefined') {
23
+ throw new Error("Error loading module '2p-io-lib'. Its dependency 'okio-parent-okio' was not found. Please, check whether 'okio-parent-okio' is loaded prior to '2p-io-lib'.");
24
+ }
25
+ if (typeof globalThis['2p-parser-theory'] === 'undefined') {
26
+ 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'.");
27
+ }
28
+ if (typeof globalThis['2p-theory'] === 'undefined') {
29
+ 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'.");
30
+ }
31
+ if (typeof globalThis['okio-parent-okio-nodefilesystem'] === 'undefined') {
32
+ throw new Error("Error loading module '2p-io-lib'. Its dependency 'okio-parent-okio-nodefilesystem' was not found. Please, check whether 'okio-parent-okio-nodefilesystem' is loaded prior to '2p-io-lib'.");
33
+ }
34
+ globalThis['2p-io-lib'] = factory(typeof globalThis['2p-io-lib'] === 'undefined' ? {} : globalThis['2p-io-lib'], globalThis['kotlin-kotlin-stdlib'], globalThis['2p-parser-impl'], globalThis['2p-solve'], globalThis['2p-parser-core'], globalThis['2p-core'], globalThis['okio-parent-okio'], globalThis['2p-parser-theory'], globalThis['2p-theory'], globalThis['okio-parent-okio-nodefilesystem']);
35
+ }
36
+ }(function (_, kotlin_kotlin, kotlin_it_unibo_tuprolog_parser_impl, kotlin_it_unibo_tuprolog_solve, kotlin_it_unibo_tuprolog_parser_core, kotlin_it_unibo_tuprolog_core, kotlin_com_squareup_okio_okio, kotlin_it_unibo_tuprolog_parser_theory, kotlin_it_unibo_tuprolog_theory, kotlin_com_squareup_okio_okio_nodefilesystem) {
9
37
  'use strict';
38
+ //region block: imports
39
+ var VOID = kotlin_kotlin.$_$.b;
40
+ var buildParserFor = kotlin_it_unibo_tuprolog_parser_impl.$_$.a1;
41
+ var Companion_instance = kotlin_it_unibo_tuprolog_solve.$_$.s;
42
+ var Unit_instance = kotlin_kotlin.$_$.r;
43
+ var protoOf = kotlin_kotlin.$_$.d8;
44
+ var equals = kotlin_kotlin.$_$.j7;
45
+ var FunctionAdapter = kotlin_kotlin.$_$.y6;
46
+ var isInterface = kotlin_kotlin.$_$.x7;
47
+ var TextChunkSource = kotlin_it_unibo_tuprolog_parser_impl.$_$.y;
48
+ var hashCode = kotlin_kotlin.$_$.p7;
49
+ var initMetadataForClass = kotlin_kotlin.$_$.q7;
50
+ var CoroutineImpl = kotlin_kotlin.$_$.e6;
51
+ var THROW_CCE = kotlin_kotlin.$_$.nc;
52
+ var SequenceScope = kotlin_kotlin.$_$.y8;
53
+ var get_COROUTINE_SUSPENDED = kotlin_kotlin.$_$.d6;
54
+ var toParseException = kotlin_it_unibo_tuprolog_parser_core.$_$.j;
55
+ var PrologSyntaxException = kotlin_it_unibo_tuprolog_parser_impl.$_$.n;
56
+ var initMetadataForLambda = kotlin_kotlin.$_$.t7;
57
+ var constructCallableReference = kotlin_kotlin.$_$.h7;
58
+ var toOperatorTable = kotlin_it_unibo_tuprolog_parser_core.$_$.i;
59
+ var Companion_instance_0 = kotlin_it_unibo_tuprolog_core.$_$.t;
60
+ var PrologTermParserVisitor = kotlin_it_unibo_tuprolog_parser_core.$_$.b;
61
+ var sequence = kotlin_kotlin.$_$.da;
62
+ var LinkedHashMap_init_$Create$ = kotlin_kotlin.$_$.a1;
63
+ var AbstractLibrary = kotlin_it_unibo_tuprolog_solve.$_$.o2;
64
+ var Companion_getInstance = kotlin_it_unibo_tuprolog_solve.$_$.k1;
65
+ var listOf = kotlin_kotlin.$_$.f4;
66
+ var collectionSizeOrDefault = kotlin_kotlin.$_$.x2;
67
+ var ArrayList_init_$Create$ = kotlin_kotlin.$_$.t;
68
+ var to = kotlin_kotlin.$_$.bd;
69
+ var initMetadataForObject = kotlin_kotlin.$_$.u7;
70
+ var Companion_instance_1 = kotlin_kotlin.$_$.p;
71
+ var asSequence = kotlin_kotlin.$_$.t2;
72
+ var map = kotlin_kotlin.$_$.v9;
73
+ var Companion_getInstance_0 = kotlin_it_unibo_tuprolog_core.$_$.k;
74
+ var toSet = kotlin_kotlin.$_$.la;
75
+ var initMetadataForCompanion = kotlin_kotlin.$_$.r7;
76
+ var THROW_IAE = kotlin_kotlin.$_$.oc;
77
+ var enumEntries = kotlin_kotlin.$_$.f6;
78
+ var Enum = kotlin_kotlin.$_$.dc;
79
+ var toString = kotlin_kotlin.$_$.g8;
80
+ var IllegalArgumentException_init_$Create$ = kotlin_kotlin.$_$.n1;
81
+ var startsWith = kotlin_kotlin.$_$.kb;
82
+ var initMetadataForInterface = kotlin_kotlin.$_$.s7;
83
+ var AbstractOutputChannel = kotlin_it_unibo_tuprolog_solve.$_$.h2;
84
+ var AbstractInputChannel = kotlin_it_unibo_tuprolog_solve.$_$.g2;
85
+ var ArrayDeque_init_$Create$ = kotlin_kotlin.$_$.s;
86
+ var _Char___init__impl__6a9atx = kotlin_kotlin.$_$.c;
87
+ var Char__toInt_impl_vasixd = kotlin_kotlin.$_$.g;
88
+ var numberToChar = kotlin_kotlin.$_$.a8;
89
+ var Char = kotlin_kotlin.$_$.ac;
90
+ var toString_0 = kotlin_kotlin.$_$.h;
91
+ var TuPrologException_init_$Init$ = kotlin_it_unibo_tuprolog_core.$_$.h1;
92
+ var objectCreate = kotlin_kotlin.$_$.c8;
93
+ var captureStack = kotlin_kotlin.$_$.a7;
94
+ var TuPrologException_init_$Init$_0 = kotlin_it_unibo_tuprolog_core.$_$.i1;
95
+ var TuPrologException = kotlin_it_unibo_tuprolog_core.$_$.l1;
96
+ var Companion_instance_2 = kotlin_it_unibo_tuprolog_solve.$_$.d1;
97
+ var Companion_instance_3 = kotlin_it_unibo_tuprolog_solve.$_$.e1;
98
+ var Expected_URL_getInstance = kotlin_it_unibo_tuprolog_solve.$_$.q;
99
+ var Predicative = kotlin_it_unibo_tuprolog_solve.$_$.t2;
100
+ var Predicative_0 = kotlin_it_unibo_tuprolog_solve.$_$.z2;
101
+ var NonBacktrackable = kotlin_it_unibo_tuprolog_solve.$_$.q2;
102
+ var Companion_getInstance_1 = kotlin_it_unibo_tuprolog_solve.$_$.m1;
103
+ var InputChannel = kotlin_it_unibo_tuprolog_solve.$_$.i2;
104
+ var OutputChannel = kotlin_it_unibo_tuprolog_solve.$_$.j2;
105
+ var NonBacktrackable_0 = kotlin_it_unibo_tuprolog_solve.$_$.y2;
106
+ var IllegalStateException_init_$Create$ = kotlin_kotlin.$_$.q1;
107
+ var IllegalStateException = kotlin_kotlin.$_$.gc;
108
+ var Atom = kotlin_it_unibo_tuprolog_core.$_$.o1;
109
+ var KProperty1 = kotlin_kotlin.$_$.x8;
110
+ var getPropertyCallableRef = kotlin_kotlin.$_$.n7;
111
+ var sequenceOf = kotlin_kotlin.$_$.ba;
112
+ var flatMap = kotlin_kotlin.$_$.m9;
113
+ var Companion_getInstance_2 = kotlin_it_unibo_tuprolog_core.$_$.u;
114
+ var Companion_getInstance_3 = kotlin_it_unibo_tuprolog_core.$_$.b1;
115
+ var Companion_getInstance_4 = kotlin_it_unibo_tuprolog_core.$_$.z;
116
+ var Companion_instance_4 = kotlin_it_unibo_tuprolog_core.$_$.p;
117
+ var filter = kotlin_kotlin.$_$.j9;
118
+ var Sequence = kotlin_kotlin.$_$.z8;
119
+ var firstOrNull = kotlin_kotlin.$_$.k9;
120
+ var Companion_getInstance_5 = kotlin_it_unibo_tuprolog_core.$_$.v;
121
+ var ArrayList_init_$Create$_0 = kotlin_kotlin.$_$.u;
122
+ var asSequence_0 = kotlin_kotlin.$_$.s2;
123
+ var addAll = kotlin_kotlin.$_$.k2;
124
+ var toList = kotlin_kotlin.$_$.o5;
125
+ var Struct = kotlin_it_unibo_tuprolog_core.$_$.b2;
126
+ var Companion_instance_5 = kotlin_it_unibo_tuprolog_solve.$_$.u;
127
+ var filterNot = kotlin_kotlin.$_$.i9;
128
+ var Truth = kotlin_it_unibo_tuprolog_core.$_$.b3;
129
+ var lazy = kotlin_kotlin.$_$.wc;
130
+ var Companion_instance_6 = kotlin_it_unibo_tuprolog_solve.$_$.x;
131
+ var Expected_STREAM_PROPERTY_getInstance = kotlin_it_unibo_tuprolog_solve.$_$.g;
132
+ var Expected_WRITE_OPTION_getInstance = kotlin_it_unibo_tuprolog_solve.$_$.i;
133
+ var Expected_READ_OPTION_getInstance = kotlin_it_unibo_tuprolog_solve.$_$.d;
134
+ var List = kotlin_it_unibo_tuprolog_core.$_$.w1;
135
+ var Var = kotlin_it_unibo_tuprolog_core.$_$.d3;
136
+ var FuncFormat_LITERAL_getInstance = kotlin_it_unibo_tuprolog_core.$_$.b;
137
+ var FuncFormat_QUOTED_IF_NECESSARY_getInstance = kotlin_it_unibo_tuprolog_core.$_$.c;
138
+ var OpFormat_EXPRESSIONS_getInstance = kotlin_it_unibo_tuprolog_core.$_$.d;
139
+ var OpFormat_IGNORE_OPERATORS_getInstance = kotlin_it_unibo_tuprolog_core.$_$.e;
140
+ var Companion_instance_7 = kotlin_it_unibo_tuprolog_core.$_$.y;
141
+ var VarFormat_UNDERSCORE_getInstance = kotlin_it_unibo_tuprolog_core.$_$.f;
142
+ var Expected_SOURCE_SINK_getInstance = kotlin_it_unibo_tuprolog_solve.$_$.e;
143
+ var Expected_IO_MODE_getInstance = kotlin_it_unibo_tuprolog_solve.$_$.b;
144
+ var Companion_instance_8 = kotlin_it_unibo_tuprolog_solve.$_$.y;
145
+ var Expected_STREAM_OR_ALIAS_getInstance = kotlin_it_unibo_tuprolog_solve.$_$.f;
146
+ var Expected_IN_CHARACTER_getInstance = kotlin_it_unibo_tuprolog_solve.$_$.o;
147
+ var Companion_instance_9 = kotlin_it_unibo_tuprolog_solve.$_$.b1;
148
+ var Limit_CHARACTER_CODE_getInstance = kotlin_it_unibo_tuprolog_solve.$_$.k;
149
+ var Companion_getInstance_6 = kotlin_it_unibo_tuprolog_core.$_$.o;
150
+ var Integer = kotlin_it_unibo_tuprolog_core.$_$.v1;
151
+ var KtMap = kotlin_kotlin.$_$.h2;
152
+ var Expected_STREAM_TYPE_getInstance = kotlin_it_unibo_tuprolog_solve.$_$.h;
153
+ var format = kotlin_it_unibo_tuprolog_core.$_$.e3;
154
+ var charCodeAt = kotlin_kotlin.$_$.d7;
155
+ var emptyList = kotlin_kotlin.$_$.l3;
156
+ var get_lastIndex = kotlin_kotlin.$_$.z3;
157
+ var toList_0 = kotlin_kotlin.$_$.ja;
158
+ var last = kotlin_kotlin.$_$.b4;
159
+ var Companion_instance_10 = kotlin_it_unibo_tuprolog_solve.$_$.c1;
160
+ var ParseException = kotlin_it_unibo_tuprolog_parser_core.$_$.a;
161
+ var emptySet = kotlin_kotlin.$_$.n3;
162
+ var noWhenBranchMatchedException = kotlin_kotlin.$_$.xc;
163
+ var ObjectType_SOURCE_SINK_getInstance = kotlin_it_unibo_tuprolog_solve.$_$.j;
164
+ var ExistenceError_init_$Create$ = kotlin_it_unibo_tuprolog_solve.$_$.c2;
165
+ var FileNotFoundException = kotlin_com_squareup_okio_okio.$_$.d;
166
+ var NonBacktrackable_1 = kotlin_it_unibo_tuprolog_solve.$_$.w2;
167
+ var NonBacktrackable_2 = kotlin_it_unibo_tuprolog_solve.$_$.u2;
168
+ var Companion_instance_11 = kotlin_it_unibo_tuprolog_parser_theory.$_$.a;
169
+ var Companion_instance_12 = kotlin_it_unibo_tuprolog_theory.$_$.b;
170
+ var Companion_instance_13 = kotlin_it_unibo_tuprolog_theory.$_$.a;
171
+ var charSequenceLength = kotlin_kotlin.$_$.f7;
172
+ var titlecase = kotlin_kotlin.$_$.qb;
173
+ var isLowerCase = kotlin_kotlin.$_$.ya;
174
+ var substring = kotlin_kotlin.$_$.ob;
175
+ var BinaryRelation = kotlin_it_unibo_tuprolog_solve.$_$.s2;
176
+ var distinct = kotlin_kotlin.$_$.e9;
177
+ var removeSuffix = kotlin_kotlin.$_$.eb;
178
+ var toIntOrNull = kotlin_kotlin.$_$.tb;
179
+ var removePrefix = kotlin_kotlin.$_$.cb;
180
+ var buffer = kotlin_com_squareup_okio_okio.$_$.g;
181
+ var addSuppressed = kotlin_kotlin.$_$.qc;
182
+ var IOException = kotlin_com_squareup_okio_okio.$_$.f;
183
+ var getStringHashCode = kotlin_kotlin.$_$.o7;
184
+ var KProperty0 = kotlin_kotlin.$_$.w8;
185
+ var Info_getInstance = kotlin_it_unibo_tuprolog_core.$_$.d1;
186
+ var Platform_BROWSER_getInstance = kotlin_it_unibo_tuprolog_core.$_$.g;
187
+ var Companion_getInstance_7 = kotlin_com_squareup_okio_okio.$_$.a;
188
+ var buffer_0 = kotlin_com_squareup_okio_okio.$_$.h;
189
+ var NodeJsFileSystem_getInstance = kotlin_com_squareup_okio_okio_nodefilesystem.$_$.a;
190
+ //endregion
10
191
  //region block: pre-declaration
192
+ initMetadataForClass(sam$it_unibo_tuprolog_parser_TextChunkSource$0, 'sam$it_unibo_tuprolog_parser_TextChunkSource$0', VOID, VOID, [TextChunkSource, FunctionAdapter]);
193
+ initMetadataForLambda(asTermChannel$lambda$slambda, CoroutineImpl, VOID, [1]);
194
+ initMetadataForObject(IOLib, 'IOLib', VOID, AbstractLibrary);
195
+ initMetadataForCompanion(Companion);
196
+ initMetadataForClass(IOMode, 'IOMode', VOID, Enum);
197
+ initMetadataForObject(LocalFileSystem, 'LocalFileSystem');
198
+ initMetadataForCompanion(Companion_0);
199
+ function resolve(child) {
200
+ return Companion_instance_15.k3u(this.o3u(), this.p3u(), this.r3u(), this.q3u() + '/' + child, this.w1z());
201
+ }
202
+ function div(child) {
203
+ return this.resolve(child);
204
+ }
205
+ function get_isFile() {
206
+ return this.o3u() === 'file';
207
+ }
208
+ function get_isHttp() {
209
+ return startsWith(this.o3u(), 'http');
210
+ }
211
+ initMetadataForInterface(Url, 'Url');
212
+ initMetadataForClass(SinkOutputChannel, 'SinkOutputChannel', VOID, AbstractOutputChannel);
213
+ initMetadataForClass(SourceInputChannel, 'SourceInputChannel', VOID, AbstractInputChannel);
214
+ initMetadataForClass(IOException_0, 'IOException', VOID, TuPrologException);
215
+ initMetadataForClass(InvalidUrlException, 'InvalidUrlException', VOID, TuPrologException);
216
+ initMetadataForObject(AtEndOfStream0, 'AtEndOfStream0', VOID, Predicative);
217
+ initMetadataForObject(AtEndOfStream1, 'AtEndOfStream1', VOID, Predicative_0);
218
+ initMetadataForObject(CharConversion, 'CharConversion', VOID, NonBacktrackable);
219
+ initMetadataForObject(Close1, 'Close1', VOID, NonBacktrackable_0);
220
+ initMetadataForObject(Close2, 'Close2', VOID, NonBacktrackable);
221
+ initMetadataForObject(Consult, 'Consult', VOID, NonBacktrackable_0);
222
+ initMetadataForObject(CurrentCharConversion, 'CurrentCharConversion', VOID, NonBacktrackable);
223
+ initMetadataForObject(CurrentInput, 'CurrentInput', VOID, NonBacktrackable_0);
224
+ initMetadataForObject(CurrentOutput, 'CurrentOutput', VOID, NonBacktrackable_0);
225
+ initMetadataForObject(FlushOutput, 'FlushOutput', VOID, NonBacktrackable_0);
226
+ initMetadataForObject(GetByte1, 'GetByte1', VOID, NonBacktrackable_0);
227
+ initMetadataForObject(GetByte2, 'GetByte2', VOID, NonBacktrackable);
228
+ initMetadataForObject(GetChar1, 'GetChar1', VOID, NonBacktrackable_0);
229
+ initMetadataForObject(GetChar2, 'GetChar2', VOID, NonBacktrackable);
230
+ initMetadataForObject(GetCode1, 'GetCode1', VOID, NonBacktrackable_0);
231
+ initMetadataForObject(GetCode2, 'GetCode2', VOID, NonBacktrackable);
232
+ initMetadataForLambda(IOPrimitiveUtils$propertiesOf$slambda, CoroutineImpl, VOID, [1]);
233
+ initMetadataForObject(IOPrimitiveUtils, 'IOPrimitiveUtils');
234
+ initMetadataForObject(Nl1, 'Nl1', VOID, NonBacktrackable_0);
235
+ initMetadataForObject(Open3, 'Open3', VOID, NonBacktrackable_1);
236
+ initMetadataForObject(Open4, 'Open4', VOID, NonBacktrackable_2);
237
+ initMetadataForObject(PeekByte1, 'PeekByte1', VOID, NonBacktrackable_0);
238
+ initMetadataForObject(PeekByte2, 'PeekByte2', VOID, NonBacktrackable);
239
+ initMetadataForObject(PeekChar1, 'PeekChar1', VOID, NonBacktrackable_0);
240
+ initMetadataForObject(PeekChar2, 'PeekChar2', VOID, NonBacktrackable);
241
+ initMetadataForObject(PeekCode1, 'PeekCode1', VOID, NonBacktrackable_0);
242
+ initMetadataForObject(PeekCode2, 'PeekCode2', VOID, NonBacktrackable);
243
+ initMetadataForObject(PutByte1, 'PutByte1', VOID, NonBacktrackable_0);
244
+ initMetadataForObject(PutByte2, 'PutByte2', VOID, NonBacktrackable);
245
+ initMetadataForObject(PutChar1, 'PutChar1', VOID, NonBacktrackable_0);
246
+ initMetadataForObject(PutChar2, 'PutChar2', VOID, NonBacktrackable);
247
+ initMetadataForObject(PutCode1, 'PutCode1', VOID, NonBacktrackable_0);
248
+ initMetadataForObject(PutCode2, 'PutCode2', VOID, NonBacktrackable);
249
+ initMetadataForObject(Read1, 'Read1', VOID, NonBacktrackable_0);
250
+ initMetadataForObject(Read2, 'Read2', VOID, NonBacktrackable);
251
+ initMetadataForObject(ReadTerm2, 'ReadTerm2', VOID, NonBacktrackable);
252
+ initMetadataForObject(ReadTerm3, 'ReadTerm3', VOID, NonBacktrackable_1);
253
+ initMetadataForObject(SetInput, 'SetInput', VOID, NonBacktrackable_0);
254
+ initMetadataForObject(SetOutput, 'SetOutput', VOID, NonBacktrackable_0);
255
+ initMetadataForObject(SetTheory, 'SetTheory', VOID, NonBacktrackable_0);
256
+ initMetadataForObject(StreamProperty, 'StreamProperty', VOID, BinaryRelation);
257
+ initMetadataForObject(Write2, 'Write2', VOID, NonBacktrackable);
258
+ initMetadataForObject(WriteCanonical1, 'WriteCanonical1', VOID, NonBacktrackable_0);
259
+ initMetadataForObject(WriteCanonical2, 'WriteCanonical2', VOID, NonBacktrackable);
260
+ initMetadataForObject(WriteEq1, 'WriteEq1', VOID, NonBacktrackable_0);
261
+ initMetadataForObject(WriteEq2, 'WriteEq2', VOID, NonBacktrackable);
262
+ initMetadataForObject(WriteTerm2, 'WriteTerm2', VOID, NonBacktrackable);
263
+ initMetadataForObject(WriteTerm3, 'WriteTerm3', VOID, NonBacktrackable_1);
264
+ initMetadataForClass(JsUrl, 'JsUrl', VOID, VOID, [Url]);
265
+ //endregion
266
+ function get_cache() {
267
+ _init_properties_ChannelUtils_kt__fqios2();
268
+ return cache;
269
+ }
270
+ var cache;
271
+ function asTermChannel(_this__u8e3s4, operators) {
272
+ _init_properties_ChannelUtils_kt__fqios2();
273
+ // Inline function 'kotlin.collections.getOrPut' call
274
+ var this_0 = get_cache();
275
+ var value = this_0.k2(_this__u8e3s4);
276
+ var tmp;
277
+ if (value == null) {
278
+ var tmp_0 = asTermChannel$lambda(_this__u8e3s4);
279
+ var tmp_1 = new sam$it_unibo_tuprolog_parser_TextChunkSource$0(tmp_0);
280
+ var termIterator = buildParserFor(tmp_1, VOID, VOID, asTermChannel$lambda_0(operators)).n();
281
+ var tmp_2 = Companion_instance;
282
+ var tmp_3 = asTermChannel$lambda_1(termIterator);
283
+ var answer = tmp_2.ofWithAvailabilityChecker(tmp_3, Iterator$hasNext$ref(termIterator));
284
+ this_0.t4(_this__u8e3s4, answer);
285
+ tmp = answer;
286
+ } else {
287
+ tmp = value;
288
+ }
289
+ return tmp;
290
+ }
291
+ function sam$it_unibo_tuprolog_parser_TextChunkSource$0(function_0) {
292
+ this.p3t_1 = function_0;
293
+ }
294
+ protoOf(sam$it_unibo_tuprolog_parser_TextChunkSource$0).x3e = function () {
295
+ return this.p3t_1();
296
+ };
297
+ protoOf(sam$it_unibo_tuprolog_parser_TextChunkSource$0).s2 = function () {
298
+ return this.p3t_1;
299
+ };
300
+ protoOf(sam$it_unibo_tuprolog_parser_TextChunkSource$0).equals = function (other) {
301
+ var tmp;
302
+ if (!(other == null) ? isInterface(other, TextChunkSource) : false) {
303
+ var tmp_0;
304
+ if (!(other == null) ? isInterface(other, FunctionAdapter) : false) {
305
+ tmp_0 = equals(this.s2(), other.s2());
306
+ } else {
307
+ tmp_0 = false;
308
+ }
309
+ tmp = tmp_0;
310
+ } else {
311
+ tmp = false;
312
+ }
313
+ return tmp;
314
+ };
315
+ protoOf(sam$it_unibo_tuprolog_parser_TextChunkSource$0).hashCode = function () {
316
+ return hashCode(this.s2());
317
+ };
318
+ function asTermChannel$lambda($this_asTermChannel) {
319
+ return function () {
320
+ return $this_asTermChannel.read();
321
+ };
322
+ }
323
+ function asTermChannel$lambda$slambda($session, $visitor, $lexedSource, resultContinuation) {
324
+ this.y3t_1 = $session;
325
+ this.z3t_1 = $visitor;
326
+ this.a3u_1 = $lexedSource;
327
+ CoroutineImpl.call(this, resultContinuation);
328
+ }
329
+ protoOf(asTermChannel$lambda$slambda).d1r = function ($this$sequence, $completion) {
330
+ var tmp = this.e1r($this$sequence, $completion);
331
+ tmp.t8_1 = Unit_instance;
332
+ tmp.u8_1 = null;
333
+ return tmp.z8();
334
+ };
335
+ protoOf(asTermChannel$lambda$slambda).q9 = function (p1, $completion) {
336
+ return this.d1r(p1 instanceof SequenceScope ? p1 : THROW_CCE(), $completion);
337
+ };
338
+ protoOf(asTermChannel$lambda$slambda).z8 = function () {
339
+ var suspendResult = this.t8_1;
340
+ $sm: do
341
+ try {
342
+ var tmp = this.r8_1;
343
+ switch (tmp) {
344
+ case 0:
345
+ this.s8_1 = 6;
346
+ this.s8_1 = 5;
347
+ this.c3u_1 = this.y3t_1.p3m();
348
+ this.r8_1 = 1;
349
+ continue $sm;
350
+ case 1:
351
+ if (!!(this.c3u_1 == null)) {
352
+ this.r8_1 = 3;
353
+ continue $sm;
354
+ }
355
+
356
+ this.r8_1 = 2;
357
+ suspendResult = this.b3u_1.bf(this.c3u_1.v3r_1.d3o(this.z3t_1), this);
358
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
359
+ return suspendResult;
360
+ }
361
+
362
+ continue $sm;
363
+ case 2:
364
+ this.c3u_1 = this.y3t_1.p3m();
365
+ this.r8_1 = 1;
366
+ continue $sm;
367
+ case 3:
368
+ this.s8_1 = 6;
369
+ this.r8_1 = 4;
370
+ continue $sm;
371
+ case 4:
372
+ this.s8_1 = 6;
373
+ return Unit_instance;
374
+ case 5:
375
+ this.s8_1 = 6;
376
+ var tmp_0 = this.u8_1;
377
+ if (tmp_0 instanceof PrologSyntaxException) {
378
+ var e = this.u8_1;
379
+ var it = this.a3u_1.m3j();
380
+ var tmp0_elvis_lhs = it.e16();
381
+ var input = tmp0_elvis_lhs == null ? it.t3h() : tmp0_elvis_lhs;
382
+ throw toParseException(e, input);
383
+ } else {
384
+ throw this.u8_1;
385
+ }
386
+
387
+ case 6:
388
+ throw this.u8_1;
389
+ }
390
+ } catch ($p) {
391
+ var e_0 = $p;
392
+ if (this.s8_1 === 6) {
393
+ throw e_0;
394
+ } else {
395
+ this.r8_1 = this.s8_1;
396
+ this.u8_1 = e_0;
397
+ }
398
+ }
399
+ while (true);
400
+ };
401
+ protoOf(asTermChannel$lambda$slambda).e1r = function ($this$sequence, completion) {
402
+ var i = new asTermChannel$lambda$slambda(this.y3t_1, this.z3t_1, this.a3u_1, completion);
403
+ i.b3u_1 = $this$sequence;
404
+ return i;
405
+ };
406
+ function asTermChannel$lambda$slambda_0($session, $visitor, $lexedSource, resultContinuation) {
407
+ var i = new asTermChannel$lambda$slambda($session, $visitor, $lexedSource, resultContinuation);
408
+ return constructCallableReference(function ($this$sequence, $completion) {
409
+ return i.d1r($this$sequence, $completion);
410
+ }, 1);
411
+ }
412
+ function asTermChannel$lambda_0($operators) {
413
+ return function (parser, lexedSource) {
414
+ var session = parser.t3m(lexedSource, toOperatorTable($operators));
415
+ var visitor = new PrologTermParserVisitor(Companion_instance_0.empty());
416
+ return sequence(asTermChannel$lambda$slambda_0(session, visitor, lexedSource, null));
417
+ };
418
+ }
419
+ function asTermChannel$lambda_1($termIterator) {
420
+ return function () {
421
+ return $termIterator.q() ? $termIterator.r() : null;
422
+ };
423
+ }
424
+ function Iterator$hasNext$ref(p0) {
425
+ return constructCallableReference(function () {
426
+ return p0.q();
427
+ }, 0, 0, 84, 'hasNext', [p0]);
428
+ }
429
+ var properties_initialized_ChannelUtils_kt_an3chc;
430
+ function _init_properties_ChannelUtils_kt__fqios2() {
431
+ if (!properties_initialized_ChannelUtils_kt_an3chc) {
432
+ properties_initialized_ChannelUtils_kt_an3chc = true;
433
+ // Inline function 'kotlin.collections.mutableMapOf' call
434
+ cache = LinkedHashMap_init_$Create$();
435
+ }
436
+ }
437
+ function IOLib() {
438
+ IOLib_instance = this;
439
+ AbstractLibrary.call(this);
440
+ this.e3u_1 = "`library('prolog.io')`\n\nProvides the ISO Prolog stream-based input/output predicates. Streams are opened on files or URLs via `open/3,4` and are denoted by aliases (e.g. `user_input`, `user_output`) or by `$stream(Direction, Id)` terms; `close/1`, `current_input/1`, `current_output/1`, `set_input/1`, `set_output/1`, `stream_property/2`, `at_end_of_stream/0,1` and `flush_output/1` manage them. Only text streams are supported, and writing is only possible to local files on the JVM.\n\nCharacter-level I/O is offered by `get_char/1,2`, `get_code/1,2`, `peek_char/1,2`, `peek_code/1,2`, `put_char/1,2`, `put_code/1,2` and `nl/1`, while term-level I/O is offered by `read/1,2`, `read_term/2,3`, `write/2`, `writeq/1,2`, `write_canonical/1,2` and `write_term/2,3`; the variants without a stream argument use the current input or output stream. The tuProlog-specific `consult/1` adds the clauses of a theory loaded from a file or URL to the knowledge base, whereas `set_theory/1` replaces the knowledge base with a theory given as source text.\n\nThe byte-oriented predicates (`get_byte/1,2`, `peek_byte/1,2`, `put_byte/1,2`), the character conversion predicates (`char_conversion/2`, `current_char_conversion/2`) and `close/2` are registered for ISO conformance, but are not supported: calling them always raises a system error.";
441
+ }
442
+ protoOf(IOLib).w1x = function () {
443
+ return this.e3u_1;
444
+ };
445
+ protoOf(IOLib).z2i = function () {
446
+ return 'prolog.io';
447
+ };
448
+ protoOf(IOLib).u2i = function () {
449
+ var tmp = Companion_getInstance();
450
+ // Inline function 'kotlin.collections.map' call
451
+ 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()]);
452
+ // Inline function 'kotlin.collections.mapTo' call
453
+ var destination = ArrayList_init_$Create$(collectionSizeOrDefault(this_0, 10));
454
+ var _iterator__ex2g4s = this_0.n();
455
+ while (_iterator__ex2g4s.q()) {
456
+ var item = _iterator__ex2g4s.r();
457
+ // Inline function 'it.unibo.tuprolog.solve.AbstractWrapper.descriptionPair' call
458
+ var tmp$ret$2 = to(item.signature, item.u1x());
459
+ destination.l(tmp$ret$2);
460
+ }
461
+ return tmp.iterableToMapEnsuringNoDuplicates(destination);
462
+ };
463
+ var IOLib_instance;
464
+ function IOLib_getInstance() {
465
+ if (IOLib_instance == null)
466
+ new IOLib();
467
+ return IOLib_instance;
468
+ }
469
+ function IOMode$Companion$atomValues$lambda(it) {
470
+ // Inline function 'kotlin.text.lowercase' call
471
+ // Inline function 'kotlin.js.asDynamic' call
472
+ return it.n2_1.toLowerCase();
473
+ }
474
+ function Atom$Companion$of$ref(p0) {
475
+ return constructCallableReference(function (p0_0) {
476
+ return p0.of(p0_0);
477
+ }, 1, 0, 85, 'of', [p0]);
478
+ }
479
+ var static_init_called;
480
+ function static_init() {
481
+ if (static_init_called)
482
+ return Unit_instance;
483
+ static_init_called = true;
484
+ IOMode_READ_instance = new IOMode('READ', 0);
485
+ IOMode_WRITE_instance = new IOMode('WRITE', 1);
486
+ IOMode_APPEND_instance = new IOMode('APPEND', 2);
487
+ if (Companion_instance_14 == null) {
488
+ Companion_instance_1;
489
+ new Companion();
490
+ }
491
+ }
492
+ var IOMode_READ_instance;
493
+ var IOMode_WRITE_instance;
494
+ var IOMode_APPEND_instance;
495
+ function Companion() {
496
+ Companion_instance_14 = this;
497
+ var tmp = this;
498
+ var tmp_0 = asSequence(get_entries());
499
+ var tmp_1 = map(tmp_0, IOMode$Companion$atomValues$lambda);
500
+ tmp.f3u_1 = toSet(map(tmp_1, Atom$Companion$of$ref(Companion_getInstance_0())));
501
+ }
502
+ var Companion_instance_14;
503
+ function Companion_getInstance_8() {
504
+ static_init();
505
+ return Companion_instance_14;
506
+ }
507
+ function values() {
508
+ static_init();
509
+ return [IOMode_READ_getInstance(), IOMode_WRITE_getInstance(), IOMode_APPEND_getInstance()];
510
+ }
511
+ function valueOf(value) {
512
+ static_init();
513
+ switch (value) {
514
+ case 'READ':
515
+ return IOMode_READ_getInstance();
516
+ case 'WRITE':
517
+ return IOMode_WRITE_getInstance();
518
+ case 'APPEND':
519
+ return IOMode_APPEND_getInstance();
520
+ default:
521
+ THROW_IAE('No enum constant it.unibo.tuprolog.solve.libs.io.IOMode.' + value);
522
+ break;
523
+ }
524
+ }
525
+ function get_entries() {
526
+ static_init();
527
+ if ($ENTRIES == null)
528
+ $ENTRIES = enumEntries(values());
529
+ return $ENTRIES;
530
+ }
531
+ var $ENTRIES;
532
+ function IOMode(name, ordinal) {
533
+ Enum.call(this, name, ordinal);
534
+ }
535
+ function IOMode_READ_getInstance() {
536
+ static_init();
537
+ return IOMode_READ_instance;
538
+ }
539
+ function IOMode_WRITE_getInstance() {
540
+ static_init();
541
+ return IOMode_WRITE_instance;
542
+ }
543
+ function IOMode_APPEND_getInstance() {
544
+ static_init();
545
+ return IOMode_APPEND_instance;
546
+ }
547
+ function LocalFileSystem() {
548
+ LocalFileSystem_instance = this;
549
+ this.g3u_1 = get_platformFileSystem();
550
+ }
551
+ protoOf(LocalFileSystem).k3c = function (path) {
552
+ return this.g3u_1.k3c(path);
553
+ };
554
+ protoOf(LocalFileSystem).l3c = function (path, mustCreate) {
555
+ return this.g3u_1.l3c(path, mustCreate);
556
+ };
557
+ protoOf(LocalFileSystem).h3u = function (path, mustCreate, $super) {
558
+ mustCreate = mustCreate === VOID ? false : mustCreate;
559
+ return $super === VOID ? this.l3c(path, mustCreate) : $super.l3c.call(this, path, mustCreate);
560
+ };
561
+ protoOf(LocalFileSystem).m3c = function (path, mustExist) {
562
+ return this.g3u_1.m3c(path, mustExist);
563
+ };
564
+ protoOf(LocalFileSystem).i3u = function (path, mustExist, $super) {
565
+ mustExist = mustExist === VOID ? false : mustExist;
566
+ return $super === VOID ? this.m3c(path, mustExist) : $super.m3c.call(this, path, mustExist);
567
+ };
568
+ var LocalFileSystem_instance;
569
+ function LocalFileSystem_getInstance() {
570
+ if (LocalFileSystem_instance == null)
571
+ new LocalFileSystem();
572
+ return LocalFileSystem_instance;
573
+ }
574
+ function str($this, $receiver, transformation) {
575
+ var tmp;
576
+ if (transformation === VOID) {
577
+ tmp = Url$Companion$str$lambda;
578
+ } else {
579
+ tmp = transformation;
580
+ }
581
+ transformation = tmp;
582
+ return $receiver == null ? '' : transformation($receiver);
583
+ }
584
+ function Url$Companion$str$lambda(it) {
585
+ return toString(it);
586
+ }
587
+ function Url$Companion$toString$lambda(it) {
588
+ return ':' + it;
589
+ }
590
+ function Url$Companion$toString$lambda_0(it) {
591
+ return '?' + it;
592
+ }
593
+ function Companion_0() {
594
+ }
595
+ protoOf(Companion_0).j3u = function (_this__u8e3s4) {
596
+ var tmp;
597
+ if (_this__u8e3s4 < 0) {
598
+ throw IllegalArgumentException_init_$Create$('Invalid port: ' + _this__u8e3s4);
599
+ } else {
600
+ tmp = _this__u8e3s4;
601
+ }
602
+ return tmp;
603
+ };
604
+ protoOf(Companion_0).file = function (path) {
605
+ return fileUrl(path);
606
+ };
607
+ protoOf(Companion_0).k3u = function (protocol, host, port, path, query) {
608
+ return remoteUrl(protocol, host, port, path, query);
609
+ };
610
+ protoOf(Companion_0).remote = function (protocol, host, port, path, query, $super) {
611
+ host = host === VOID ? '' : host;
612
+ port = port === VOID ? null : port;
613
+ path = path === VOID ? '' : path;
614
+ query = query === VOID ? null : query;
615
+ return $super === VOID ? this.k3u(protocol, host, port, path, query) : $super.k3u.call(this, protocol, host, port, path, query);
616
+ };
617
+ protoOf(Companion_0).l3u = function (host, port, path, query) {
618
+ return this.k3u('http', host, port, path, query);
619
+ };
620
+ protoOf(Companion_0).http = function (host, port, path, query, $super) {
621
+ host = host === VOID ? '' : host;
622
+ port = port === VOID ? null : port;
623
+ path = path === VOID ? '' : path;
624
+ query = query === VOID ? null : query;
625
+ return $super === VOID ? this.l3u(host, port, path, query) : $super.l3u.call(this, host, port, path, query);
626
+ };
627
+ protoOf(Companion_0).m3u = function (host, port, path, query) {
628
+ return this.k3u('https', host, port, path, query);
629
+ };
630
+ protoOf(Companion_0).https = function (host, port, path, query, $super) {
631
+ host = host === VOID ? '' : host;
632
+ port = port === VOID ? null : port;
633
+ path = path === VOID ? '' : path;
634
+ query = query === VOID ? null : query;
635
+ return $super === VOID ? this.m3u(host, port, path, query) : $super.m3u.call(this, host, port, path, query);
636
+ };
637
+ protoOf(Companion_0).of = function (string) {
638
+ var tmp;
639
+ try {
640
+ tmp = parseUrl(string);
641
+ } catch ($p) {
642
+ var tmp_0;
643
+ if ($p instanceof InvalidUrlException) {
644
+ var e = $p;
645
+ var tmp_1;
646
+ try {
647
+ tmp_1 = parseUrl('file://' + string);
648
+ } catch ($p_0) {
649
+ var tmp_2;
650
+ if ($p_0 instanceof InvalidUrlException) {
651
+ var _unused_var__etf5q3 = $p_0;
652
+ throw e;
653
+ } else {
654
+ throw $p_0;
655
+ }
656
+ }
657
+ tmp_0 = tmp_1;
658
+ } else {
659
+ throw $p;
660
+ }
661
+ tmp = tmp_0;
662
+ }
663
+ return tmp;
664
+ };
665
+ protoOf(Companion_0).n3u = function (protocol, host, port, path, query) {
666
+ var tmp = port == null ? null : this.j3u(port);
667
+ var tmp_0 = str(this, tmp, Url$Companion$toString$lambda);
668
+ return protocol + '://' + host + tmp_0 + path + str(this, query, Url$Companion$toString$lambda_0);
669
+ };
670
+ var Companion_instance_15;
671
+ function Companion_getInstance_9() {
672
+ return Companion_instance_15;
673
+ }
674
+ function Url() {
675
+ }
676
+ function SinkOutputChannel(sink) {
677
+ AbstractOutputChannel.call(this);
678
+ this.y3u_1 = sink;
679
+ }
680
+ protoOf(SinkOutputChannel).z3u = function (value) {
681
+ this.y3u_1.p3b(value);
682
+ };
683
+ protoOf(SinkOutputChannel).r23 = function (value) {
684
+ return this.z3u(typeof value === 'string' ? value : THROW_CCE());
685
+ };
686
+ protoOf(SinkOutputChannel).s23 = function () {
687
+ this.y3u_1.o8();
688
+ };
689
+ protoOf(SinkOutputChannel).z22 = function () {
690
+ this.y3u_1.z22();
691
+ protoOf(AbstractOutputChannel).z22.call(this);
692
+ };
693
+ protoOf(SinkOutputChannel).close = function () {
694
+ return this.z22();
695
+ };
696
+ function SourceInputChannel(source) {
697
+ AbstractInputChannel.call(this);
698
+ this.f3v_1 = source;
699
+ this.g3v_1 = ArrayDeque_init_$Create$();
700
+ }
701
+ protoOf(SourceInputChannel).k23 = function () {
702
+ if (this.g3v_1.i()) {
703
+ if (this.f3v_1.x3b())
704
+ return null;
705
+ var codePoint = this.f3v_1.e3d();
706
+ // Inline function 'kotlin.code' call
707
+ var this_0 = _Char___init__impl__6a9atx(65535);
708
+ if (codePoint > Char__toInt_impl_vasixd(this_0)) {
709
+ var offset = codePoint - 65536 | 0;
710
+ this.g3v_1.wd(new Char(numberToChar((offset >> 10) + 55296 | 0)));
711
+ this.g3v_1.wd(new Char(numberToChar((offset & 1023) + 56320 | 0)));
712
+ } else {
713
+ this.g3v_1.wd(new Char(numberToChar(codePoint)));
714
+ }
715
+ }
716
+ return toString_0(this.g3v_1.xd().p1_1);
717
+ };
718
+ protoOf(SourceInputChannel).z22 = function () {
719
+ this.f3v_1.z22();
720
+ protoOf(AbstractInputChannel).z22.call(this);
721
+ };
722
+ protoOf(SourceInputChannel).close = function () {
723
+ return this.z22();
724
+ };
725
+ function IOException_init_$Init$(message, $this) {
726
+ TuPrologException_init_$Init$(message, $this);
727
+ IOException_0.call($this);
728
+ return $this;
729
+ }
730
+ function IOException_init_$Create$(message) {
731
+ var tmp = IOException_init_$Init$(message, objectCreate(protoOf(IOException_0)));
732
+ captureStack(tmp, IOException_init_$Create$);
733
+ return tmp;
734
+ }
735
+ function IOException_init_$Init$_0(message, cause, $this) {
736
+ TuPrologException_init_$Init$_0(message, cause, $this);
737
+ IOException_0.call($this);
738
+ return $this;
739
+ }
740
+ function IOException_init_$Create$_0(message, cause) {
741
+ var tmp = IOException_init_$Init$_0(message, cause, objectCreate(protoOf(IOException_0)));
742
+ captureStack(tmp, IOException_init_$Create$_0);
743
+ return tmp;
744
+ }
745
+ protoOf(IOException_0).h3v = function (context) {
746
+ return Companion_instance_2.forUncaughtKtException(context, this);
747
+ };
748
+ function IOException_0() {
749
+ captureStack(this, IOException_0);
750
+ }
751
+ function InvalidUrlException_init_$Init$(message, $this) {
752
+ TuPrologException_init_$Init$(message, $this);
753
+ InvalidUrlException.call($this);
754
+ return $this;
755
+ }
756
+ function InvalidUrlException_init_$Create$(message) {
757
+ var tmp = InvalidUrlException_init_$Init$(message, objectCreate(protoOf(InvalidUrlException)));
758
+ captureStack(tmp, InvalidUrlException_init_$Create$);
759
+ return tmp;
760
+ }
761
+ function InvalidUrlException_init_$Init$_0(message, cause, $this) {
762
+ TuPrologException_init_$Init$_0(message, cause, $this);
763
+ InvalidUrlException.call($this);
764
+ return $this;
765
+ }
766
+ function InvalidUrlException_init_$Create$_0(message, cause) {
767
+ var tmp = InvalidUrlException_init_$Init$_0(message, cause, objectCreate(protoOf(InvalidUrlException)));
768
+ captureStack(tmp, InvalidUrlException_init_$Create$_0);
769
+ return tmp;
770
+ }
771
+ protoOf(InvalidUrlException).i3v = function (context, signature, culprit, index) {
772
+ return Companion_instance_3.o2b(context, signature, Expected_URL_getInstance(), culprit, index);
773
+ };
774
+ function InvalidUrlException() {
775
+ captureStack(this, InvalidUrlException);
776
+ }
777
+ function AtEndOfStream0() {
778
+ AtEndOfStream0_instance = this;
779
+ Predicative.call(this, 'at_end_of_stream');
780
+ this.k3v_1 = '`at_end_of_stream`\n\nSucceeds iff the current input stream (standard input, unless changed via `set_input/1`) is closed or has no more characters to read, and fails otherwise. It is deterministic and raises no errors.\n\n**Examples**\n\n```prolog\n% with `foo.` still to be read from standard input\n?- at_end_of_stream.\nno.\n\n% once standard input has been exhausted\n?- at_end_of_stream.\nyes.\n```';
781
+ }
782
+ protoOf(AtEndOfStream0).w1x = function () {
783
+ return this.k3v_1;
784
+ };
785
+ protoOf(AtEndOfStream0).l3v = function (_this__u8e3s4) {
786
+ // Inline function 'kotlin.let' call
787
+ var it = IOPrimitiveUtils_getInstance().d3w(_this__u8e3s4);
788
+ return it.l22() || it.yr();
789
+ };
790
+ protoOf(AtEndOfStream0).j2l = function (_this__u8e3s4) {
791
+ return this.l3v(_this__u8e3s4);
792
+ };
793
+ var AtEndOfStream0_instance;
794
+ function AtEndOfStream0_getInstance() {
795
+ if (AtEndOfStream0_instance == null)
796
+ new AtEndOfStream0();
797
+ return AtEndOfStream0_instance;
798
+ }
799
+ function AtEndOfStream1() {
800
+ AtEndOfStream1_instance = this;
801
+ Predicative_0.call(this, 'at_end_of_stream');
802
+ this.f3w_1 = '`at_end_of_stream(+Stream)`\n\nSucceeds iff the input stream `Stream` is closed or has no more characters to read, and fails otherwise. `Stream` must be an alias (e.g. `user_input`) or a `$stream(in, Id)` term denoting an open stream: an unbound `Stream` raises an instantiation error, an unknown one an existence error, and an output stream a domain error (`stream_type`), where ISO prescribes a permission error.\n\n**Examples**\n\n```prolog\n?- at_end_of_stream(user_output).\nthrows error(domain_error(stream_type, user_output), _).\n\n?- at_end_of_stream(S).\nthrows error(instantiation_error, _).\n\n?- at_end_of_stream(no_such_stream).\nthrows error(existence_error(source_sink, no_such_stream), _).\n```';
803
+ }
804
+ protoOf(AtEndOfStream1).w1x = function () {
805
+ return this.f3w_1;
806
+ };
807
+ protoOf(AtEndOfStream1).g3w = function (_this__u8e3s4, first) {
808
+ // Inline function 'kotlin.let' call
809
+ var it = IOPrimitiveUtils_getInstance().h3w(_this__u8e3s4, 0);
810
+ return it.l22() || it.yr();
811
+ };
812
+ protoOf(AtEndOfStream1).x2n = function (_this__u8e3s4, first) {
813
+ return this.g3w(_this__u8e3s4, first);
814
+ };
815
+ var AtEndOfStream1_instance;
816
+ function AtEndOfStream1_getInstance() {
817
+ if (AtEndOfStream1_instance == null)
818
+ new AtEndOfStream1();
819
+ return AtEndOfStream1_instance;
820
+ }
821
+ function CharConversion() {
822
+ CharConversion_instance = this;
823
+ NonBacktrackable.call(this, 'char_conversion');
824
+ this.j3w_1 = '`char_conversion(+InChar, +OutChar)`\n\nRegistered for ISO conformance only: the current implementation does not support a character conversion table, so every call raises a system error regardless of its arguments.\n\n**Examples**\n\n```prolog\n?- char_conversion(a, b).\nthrows error(system_error, _).\n```';
825
+ }
826
+ protoOf(CharConversion).w1x = function () {
827
+ return this.j3w_1;
828
+ };
829
+ protoOf(CharConversion).z2u = function (_this__u8e3s4, first, second) {
830
+ return Companion_getInstance_1().u2l(_this__u8e3s4);
831
+ };
832
+ protoOf(CharConversion).r2k = function (_this__u8e3s4, first, second) {
833
+ return this.z2u(_this__u8e3s4, first, second);
834
+ };
835
+ var CharConversion_instance;
836
+ function CharConversion_getInstance() {
837
+ if (CharConversion_instance == null)
838
+ new CharConversion();
839
+ return CharConversion_instance;
840
+ }
841
+ function Close1$computeOne$lambda($this_computeOne, $channel) {
842
+ return function ($this$replySuccess) {
843
+ var tmp = $this_computeOne.context.l1y();
844
+ $this$replySuccess.e2r(tmp.aliasesOf(isInterface($channel, InputChannel) ? $channel : THROW_CCE()));
845
+ return Unit_instance;
846
+ };
847
+ }
848
+ function Close1$computeOne$lambda_0($this_computeOne, $channel) {
849
+ return function ($this$replySuccess) {
850
+ var tmp = $this_computeOne.context.m1y();
851
+ $this$replySuccess.h2r(tmp.aliasesOf(isInterface($channel, OutputChannel) ? $channel : THROW_CCE()));
852
+ return Unit_instance;
853
+ };
854
+ }
855
+ function Close1() {
856
+ Close1_instance = this;
857
+ NonBacktrackable_0.call(this, 'close');
858
+ this.l3w_1 = '`close(+Stream)`\n\nCloses the stream `Stream`, given as an alias or a `$stream(Direction, Id)` term, and unregisters every alias it was reachable through, succeeding deterministically. It raises an instantiation error if `Stream` is unbound, an existence error if it does not denote an open stream, and a domain error (`stream_or_alias`) if it is a compound term other than a stream term. It fails, instead of raising an error, if the underlying channel has been closed.\n\n**Examples**\n\n```prolog\n?- close(S).\nthrows error(instantiation_error, _).\n\n?- close(no_such_stream).\nthrows error(existence_error(source_sink, no_such_stream), _).\n\n?- close(foo(bar)).\nthrows error(domain_error(stream_or_alias, foo(bar)), _).\n```';
859
+ }
860
+ protoOf(Close1).w1x = function () {
861
+ return this.l3w_1;
862
+ };
863
+ protoOf(Close1).i2u = function (_this__u8e3s4, first) {
864
+ var channel = IOPrimitiveUtils_getInstance().m3w(_this__u8e3s4, 0);
865
+ try {
866
+ channel.close();
867
+ var tmp;
868
+ if (isInterface(channel, InputChannel)) {
869
+ tmp = _this__u8e3s4.replySuccessBuildingSideEffects(VOID, VOID, Close1$computeOne$lambda(_this__u8e3s4, channel));
870
+ } else {
871
+ if (isInterface(channel, OutputChannel)) {
872
+ tmp = _this__u8e3s4.replySuccessBuildingSideEffects(VOID, VOID, Close1$computeOne$lambda_0(_this__u8e3s4, channel));
873
+ } else {
874
+ throw IllegalStateException_init_$Create$('This should never happen');
875
+ }
876
+ }
877
+ return tmp;
878
+ } catch ($p) {
879
+ if ($p instanceof IllegalStateException) {
880
+ var _unused_var__etf5q3 = $p;
881
+ return _this__u8e3s4.replyFail(VOID, []);
882
+ } else {
883
+ throw $p;
884
+ }
885
+ }
886
+ };
887
+ protoOf(Close1).a2o = function (_this__u8e3s4, first) {
888
+ return this.i2u(_this__u8e3s4, first);
889
+ };
890
+ var Close1_instance;
891
+ function Close1_getInstance() {
892
+ if (Close1_instance == null)
893
+ new Close1();
894
+ return Close1_instance;
895
+ }
896
+ function Close2() {
897
+ Close2_instance = this;
898
+ NonBacktrackable.call(this, 'close');
899
+ this.o3w_1 = '`close(+Stream, +Options)`\n\nRegistered for ISO conformance only: the current implementation does not support close options such as `force(true)`, so every call raises a system error regardless of its arguments; use `close/1` instead.\n\n**Examples**\n\n```prolog\n?- close(user_output, [force(true)]).\nthrows error(system_error, _).\n```';
900
+ }
901
+ protoOf(Close2).w1x = function () {
902
+ return this.o3w_1;
903
+ };
904
+ protoOf(Close2).z2u = function (_this__u8e3s4, first, second) {
905
+ return Companion_getInstance_1().u2l(_this__u8e3s4);
906
+ };
907
+ protoOf(Close2).r2k = function (_this__u8e3s4, first, second) {
908
+ return this.z2u(_this__u8e3s4, first, second);
909
+ };
910
+ var Close2_instance;
911
+ function Close2_getInstance() {
912
+ if (Close2_instance == null)
913
+ new Close2();
914
+ return Close2_instance;
915
+ }
916
+ function Consult() {
917
+ Consult_instance = this;
918
+ NonBacktrackable_0.call(this, 'consult');
919
+ this.q3w_1 = "`consult(+Source)`\n\nLoads the Prolog theory found at `Source`, an atom holding either a URL (e.g. `'https://example.com/theory.pl'`) or a plain absolute or relative file path, parsing it with the current operators. This tuProlog-specific predicate adds the loaded clauses to the knowledge base without removing any existing clause (so consulting the same source twice duplicates its clauses), with clauses of predicates declared dynamic going to the dynamic knowledge base and all others to the static one; operators and flags set by the theory's directives take effect as well. It raises an instantiation error if `Source` is unbound, a type error (`atom`) if it is not an atom, a type error (`url`) if it is not a valid URL or path, a system error if the resource cannot be read, and a syntax error if its content is not a well-formed theory.\n\n**Examples**\n\n```prolog\n% with /path/to/family.pl containing `parent(tom, bob).`\n?- consult('/path/to/family.pl'), parent(tom, X).\nX = bob.\n\n?- consult(F).\nthrows error(instantiation_error, _).\n\n?- consult(42).\nthrows error(type_error(atom, 42), _).\n\n?- consult('/no/such/theory.pl').\nthrows error(system_error, _).\n```";
920
+ }
921
+ protoOf(Consult).w1x = function () {
922
+ return this.q3w_1;
923
+ };
924
+ protoOf(Consult).i2u = function (_this__u8e3s4, first) {
925
+ Companion_getInstance_1().s2l(_this__u8e3s4, 0);
926
+ Companion_getInstance_1().b2m(_this__u8e3s4, 0);
927
+ var urlString = (isInterface(first, Atom) ? first : THROW_CCE()).h2();
928
+ try {
929
+ var url = Companion_instance_15.of(urlString);
930
+ var text = url.readAsText();
931
+ return SetTheory_getInstance().t3w(_this__u8e3s4, text);
932
+ } catch ($p) {
933
+ if ($p instanceof InvalidUrlException) {
934
+ var e = $p;
935
+ throw e.i3v(_this__u8e3s4.context, _this__u8e3s4.signature, first, 0);
936
+ } else {
937
+ if ($p instanceof IOException_0) {
938
+ var e_0 = $p;
939
+ throw e_0.h3v(_this__u8e3s4.context);
940
+ } else {
941
+ throw $p;
942
+ }
943
+ }
944
+ }
945
+ };
946
+ protoOf(Consult).a2o = function (_this__u8e3s4, first) {
947
+ return this.i2u(_this__u8e3s4, first);
948
+ };
949
+ var Consult_instance;
950
+ function Consult_getInstance() {
951
+ if (Consult_instance == null)
952
+ new Consult();
953
+ return Consult_instance;
954
+ }
955
+ function CurrentCharConversion() {
956
+ CurrentCharConversion_instance = this;
957
+ NonBacktrackable.call(this, 'current_char_conversion');
958
+ this.v3w_1 = '`current_char_conversion(?InChar, ?OutChar)`\n\nRegistered for ISO conformance only: since character conversion is not supported (see `char_conversion/2`), the current implementation raises a system error on every call regardless of its arguments.\n\n**Examples**\n\n```prolog\n?- current_char_conversion(X, Y).\nthrows error(system_error, _).\n```';
959
+ }
960
+ protoOf(CurrentCharConversion).w1x = function () {
961
+ return this.v3w_1;
962
+ };
963
+ protoOf(CurrentCharConversion).z2u = function (_this__u8e3s4, first, second) {
964
+ return Companion_getInstance_1().u2l(_this__u8e3s4);
965
+ };
966
+ protoOf(CurrentCharConversion).r2k = function (_this__u8e3s4, first, second) {
967
+ return this.z2u(_this__u8e3s4, first, second);
968
+ };
969
+ var CurrentCharConversion_instance;
970
+ function CurrentCharConversion_getInstance() {
971
+ if (CurrentCharConversion_instance == null)
972
+ new CurrentCharConversion();
973
+ return CurrentCharConversion_instance;
974
+ }
975
+ function CurrentInput() {
976
+ CurrentInput_instance = this;
977
+ NonBacktrackable_0.call(this, 'current_input');
978
+ this.x3w_1 = '`current_input(?Stream)`\n\nUnifies `Stream` with the `$stream(in, Id)` term of the current input stream (standard input, unless changed via `set_input/1`); if `Stream` is already a stream term, it succeeds iff that term denotes the current input stream. It is deterministic. It raises an existence error if `Stream` is a stream term denoting no open stream, and a domain error (`stream_or_alias`) if it is bound to anything else, aliases included.\n\n**Examples**\n\n```prolog\n?- current_input(S), stream_property(S, alias(user_input)).\nyes.\n\n?- current_input(user_input).\nthrows error(domain_error(stream_or_alias, user_input), _).\n```';
979
+ }
980
+ protoOf(CurrentInput).w1x = function () {
981
+ return this.x3w_1;
982
+ };
983
+ protoOf(CurrentInput).i2u = function (_this__u8e3s4, first) {
984
+ var channel = IOPrimitiveUtils_getInstance().y3w(_this__u8e3s4, 0);
985
+ // Inline function 'kotlin.let' call
986
+ var it = _this__u8e3s4.context.l1y();
987
+ var tmp0_elvis_lhs = it.wr();
988
+ var currentChannel = tmp0_elvis_lhs == null ? it.v1y() : tmp0_elvis_lhs;
989
+ return channel == null ? _this__u8e3s4.replyWith(Companion_getInstance_1().m2l(_this__u8e3s4, first, currentChannel.m22()), VOID, []) : equals(channel, currentChannel) ? _this__u8e3s4.replySuccess(VOID, VOID, []) : _this__u8e3s4.replyFail(VOID, []);
990
+ };
991
+ protoOf(CurrentInput).a2o = function (_this__u8e3s4, first) {
992
+ return this.i2u(_this__u8e3s4, first);
993
+ };
994
+ var CurrentInput_instance;
995
+ function CurrentInput_getInstance() {
996
+ if (CurrentInput_instance == null)
997
+ new CurrentInput();
998
+ return CurrentInput_instance;
999
+ }
1000
+ function CurrentOutput() {
1001
+ CurrentOutput_instance = this;
1002
+ NonBacktrackable_0.call(this, 'current_output');
1003
+ this.a3x_1 = '`current_output(?Stream)`\n\nUnifies `Stream` with the `$stream(out, Id)` term of the current output stream (standard output, unless changed via `set_output/1`); if `Stream` is already a stream term, it succeeds iff that term denotes the current output stream. It is deterministic. It raises an existence error if `Stream` is a stream term denoting no open stream, and a domain error (`stream_or_alias`) if it is bound to anything else, aliases included.\n\n**Examples**\n\n```prolog\n?- current_output(S), stream_property(S, alias(user_output)).\nyes.\n\n?- current_output(S), write(S, hello).\n% prints: hello\nyes.\n\n?- current_output(user_output).\nthrows error(domain_error(stream_or_alias, user_output), _).\n```';
1004
+ }
1005
+ protoOf(CurrentOutput).w1x = function () {
1006
+ return this.a3x_1;
1007
+ };
1008
+ protoOf(CurrentOutput).i2u = function (_this__u8e3s4, first) {
1009
+ var channel = IOPrimitiveUtils_getInstance().y3w(_this__u8e3s4, 0);
1010
+ // Inline function 'kotlin.let' call
1011
+ var it = _this__u8e3s4.context.m1y();
1012
+ var tmp0_elvis_lhs = it.wr();
1013
+ var currentChannel = tmp0_elvis_lhs == null ? it.w1y() : tmp0_elvis_lhs;
1014
+ return channel == null ? _this__u8e3s4.replyWith(Companion_getInstance_1().m2l(_this__u8e3s4, first, currentChannel.m22()), VOID, []) : equals(channel, currentChannel) ? _this__u8e3s4.replySuccess(VOID, VOID, []) : _this__u8e3s4.replyFail(VOID, []);
1015
+ };
1016
+ protoOf(CurrentOutput).a2o = function (_this__u8e3s4, first) {
1017
+ return this.i2u(_this__u8e3s4, first);
1018
+ };
1019
+ var CurrentOutput_instance;
1020
+ function CurrentOutput_getInstance() {
1021
+ if (CurrentOutput_instance == null)
1022
+ new CurrentOutput();
1023
+ return CurrentOutput_instance;
1024
+ }
1025
+ function FlushOutput() {
1026
+ FlushOutput_instance = this;
1027
+ NonBacktrackable_0.call(this, 'flush_output');
1028
+ this.c3x_1 = '`flush_output(+Stream)`\n\nForces any buffered output of the output stream `Stream` to be written to its destination, succeeding deterministically. `Stream` must be an alias (e.g. `user_output`) or a `$stream(out, Id)` term denoting an open stream: an unbound `Stream` raises an instantiation error, an unknown one an existence error, and an input stream a domain error (`stream_type`), where ISO prescribes a permission error. It fails, instead of raising an error, if the underlying channel has been closed.\n\n**Examples**\n\n```prolog\n?- write(user_output, hello), flush_output(user_output).\n% prints: hello\nyes.\n\n?- flush_output(user_input).\nthrows error(domain_error(stream_type, user_input), _).\n```';
1029
+ }
1030
+ protoOf(FlushOutput).w1x = function () {
1031
+ return this.c3x_1;
1032
+ };
1033
+ protoOf(FlushOutput).i2u = function (_this__u8e3s4, first) {
1034
+ var channel = IOPrimitiveUtils_getInstance().d3x(_this__u8e3s4, 0);
1035
+ var tmp;
1036
+ try {
1037
+ channel.flush();
1038
+ tmp = _this__u8e3s4.replySuccess(VOID, VOID, []);
1039
+ } catch ($p) {
1040
+ var tmp_0;
1041
+ if ($p instanceof IllegalStateException) {
1042
+ var _unused_var__etf5q3 = $p;
1043
+ tmp_0 = _this__u8e3s4.replyFail(VOID, []);
1044
+ } else {
1045
+ throw $p;
1046
+ }
1047
+ tmp = tmp_0;
1048
+ }
1049
+ return tmp;
1050
+ };
1051
+ protoOf(FlushOutput).a2o = function (_this__u8e3s4, first) {
1052
+ return this.i2u(_this__u8e3s4, first);
1053
+ };
1054
+ var FlushOutput_instance;
1055
+ function FlushOutput_getInstance() {
1056
+ if (FlushOutput_instance == null)
1057
+ new FlushOutput();
1058
+ return FlushOutput_instance;
1059
+ }
1060
+ function GetByte1() {
1061
+ GetByte1_instance = this;
1062
+ NonBacktrackable_0.call(this, 'get_byte');
1063
+ this.f3x_1 = '`get_byte(?Byte)`\n\nRegistered for ISO conformance only: the current implementation supports text streams exclusively, so every call raises a system error regardless of its arguments; use `get_code/1` instead.\n\n**Examples**\n\n```prolog\n?- get_byte(B).\nthrows error(system_error, _).\n```';
1064
+ }
1065
+ protoOf(GetByte1).w1x = function () {
1066
+ return this.f3x_1;
1067
+ };
1068
+ protoOf(GetByte1).i2u = function (_this__u8e3s4, first) {
1069
+ return Companion_getInstance_1().u2l(_this__u8e3s4);
1070
+ };
1071
+ protoOf(GetByte1).a2o = function (_this__u8e3s4, first) {
1072
+ return this.i2u(_this__u8e3s4, first);
1073
+ };
1074
+ var GetByte1_instance;
1075
+ function GetByte1_getInstance() {
1076
+ if (GetByte1_instance == null)
1077
+ new GetByte1();
1078
+ return GetByte1_instance;
1079
+ }
1080
+ function GetByte2() {
1081
+ GetByte2_instance = this;
1082
+ NonBacktrackable.call(this, 'get_byte');
1083
+ this.h3x_1 = '`get_byte(+Stream, ?Byte)`\n\nRegistered for ISO conformance only: the current implementation supports text streams exclusively, so every call raises a system error regardless of its arguments; use `get_code/2` instead.\n\n**Examples**\n\n```prolog\n?- get_byte(user_input, B).\nthrows error(system_error, _).\n```';
1084
+ }
1085
+ protoOf(GetByte2).w1x = function () {
1086
+ return this.h3x_1;
1087
+ };
1088
+ protoOf(GetByte2).z2u = function (_this__u8e3s4, first, second) {
1089
+ return Companion_getInstance_1().u2l(_this__u8e3s4);
1090
+ };
1091
+ protoOf(GetByte2).r2k = function (_this__u8e3s4, first, second) {
1092
+ return this.z2u(_this__u8e3s4, first, second);
1093
+ };
1094
+ var GetByte2_instance;
1095
+ function GetByte2_getInstance() {
1096
+ if (GetByte2_instance == null)
1097
+ new GetByte2();
1098
+ return GetByte2_instance;
1099
+ }
1100
+ function GetChar1() {
1101
+ GetChar1_instance = this;
1102
+ NonBacktrackable_0.call(this, 'get_char');
1103
+ this.j3x_1 = '`get_char(?Char)`\n\nReads and consumes the next character from the current input stream (standard input, unless changed via `set_input/1`) and unifies it with `Char`, which becomes `end_of_file` at the end of the stream. It is deterministic. `Char` must be unbound, `end_of_file`, or a one-character atom, otherwise a type error (`in_character`) is raised. It fails, instead of raising an error, if the underlying channel has been closed.\n\n**Examples**\n\n```prolog\n?- get_char(ab).\nthrows error(type_error(in_character, ab), _).\n\n?- get_char(1).\nthrows error(type_error(in_character, 1), _).\n```';
1104
+ }
1105
+ protoOf(GetChar1).w1x = function () {
1106
+ return this.j3x_1;
1107
+ };
1108
+ protoOf(GetChar1).i2u = function (_this__u8e3s4, first) {
1109
+ IOPrimitiveUtils_getInstance().k3x(_this__u8e3s4, 0);
1110
+ return IOPrimitiveUtils_getInstance().l3x(_this__u8e3s4, IOPrimitiveUtils_getInstance().d3w(_this__u8e3s4), first);
1111
+ };
1112
+ protoOf(GetChar1).a2o = function (_this__u8e3s4, first) {
1113
+ return this.i2u(_this__u8e3s4, first);
1114
+ };
1115
+ var GetChar1_instance;
1116
+ function GetChar1_getInstance() {
1117
+ if (GetChar1_instance == null)
1118
+ new GetChar1();
1119
+ return GetChar1_instance;
1120
+ }
1121
+ function GetChar2() {
1122
+ GetChar2_instance = this;
1123
+ NonBacktrackable.call(this, 'get_char');
1124
+ this.n3x_1 = '`get_char(+Stream, ?Char)`\n\nReads and consumes the next character from the input stream `Stream` and unifies it with `Char`, which becomes `end_of_file` at the end of the stream. `Stream` must be an alias (e.g. `user_input`) or a `$stream(in, Id)` term denoting an open stream: an unbound `Stream` raises an instantiation error, an unknown one an existence error, and an output stream a domain error (`stream_type`), where ISO prescribes a permission error. `Char` must be unbound, `end_of_file`, or a one-character atom, otherwise a type error (`in_character`) is raised. It fails, instead of raising an error, if the underlying channel has been closed.\n\n**Examples**\n\n```prolog\n?- get_char(user_input, ab).\nthrows error(type_error(in_character, ab), _).\n\n?- get_char(S, C).\nthrows error(instantiation_error, _).\n\n?- get_char(user_output, C).\nthrows error(domain_error(stream_type, user_output), _).\n```';
1125
+ }
1126
+ protoOf(GetChar2).w1x = function () {
1127
+ return this.n3x_1;
1128
+ };
1129
+ protoOf(GetChar2).z2u = function (_this__u8e3s4, first, second) {
1130
+ var channel = IOPrimitiveUtils_getInstance().h3w(_this__u8e3s4, 0);
1131
+ IOPrimitiveUtils_getInstance().k3x(_this__u8e3s4, 1);
1132
+ return IOPrimitiveUtils_getInstance().l3x(_this__u8e3s4, channel, second);
1133
+ };
1134
+ protoOf(GetChar2).r2k = function (_this__u8e3s4, first, second) {
1135
+ return this.z2u(_this__u8e3s4, first, second);
1136
+ };
1137
+ var GetChar2_instance;
1138
+ function GetChar2_getInstance() {
1139
+ if (GetChar2_instance == null)
1140
+ new GetChar2();
1141
+ return GetChar2_instance;
1142
+ }
1143
+ function GetCode1() {
1144
+ GetCode1_instance = this;
1145
+ NonBacktrackable_0.call(this, 'get_code');
1146
+ this.p3x_1 = '`get_code(?Code)`\n\nReads and consumes the next character from the current input stream (standard input, unless changed via `set_input/1`) and unifies its code with `Code`, which becomes `-1` at the end of the stream. It is deterministic. `Code` must be unbound or an integer (type error otherwise) within the character-code range or `-1` (representation error otherwise). It fails, instead of raising an error, if the underlying channel has been closed.\n\n**Examples**\n\n```prolog\n?- get_code(a).\nthrows error(type_error(integer, a), _).\n\n?- get_code(-2).\nthrows error(representation_error(character_code), _).\n```';
1147
+ }
1148
+ protoOf(GetCode1).w1x = function () {
1149
+ return this.p3x_1;
1150
+ };
1151
+ protoOf(GetCode1).i2u = function (_this__u8e3s4, first) {
1152
+ IOPrimitiveUtils_getInstance().q3x(_this__u8e3s4, 0);
1153
+ return IOPrimitiveUtils_getInstance().r3x(_this__u8e3s4, IOPrimitiveUtils_getInstance().d3w(_this__u8e3s4), first);
1154
+ };
1155
+ protoOf(GetCode1).a2o = function (_this__u8e3s4, first) {
1156
+ return this.i2u(_this__u8e3s4, first);
1157
+ };
1158
+ var GetCode1_instance;
1159
+ function GetCode1_getInstance() {
1160
+ if (GetCode1_instance == null)
1161
+ new GetCode1();
1162
+ return GetCode1_instance;
1163
+ }
1164
+ function GetCode2() {
1165
+ GetCode2_instance = this;
1166
+ NonBacktrackable.call(this, 'get_code');
1167
+ this.t3x_1 = '`get_code(+Stream, ?Code)`\n\nReads and consumes the next character from the input stream `Stream` and unifies its code with `Code`, which becomes `-1` at the end of the stream. `Stream` must be an alias (e.g. `user_input`) or a `$stream(in, Id)` term denoting an open stream: an unbound `Stream` raises an instantiation error, an unknown one an existence error, and an output stream a domain error (`stream_type`), where ISO prescribes a permission error. `Code` must be unbound or an integer (type error otherwise) within the character-code range or `-1` (representation error otherwise). It fails, instead of raising an error, if the underlying channel has been closed.\n\n**Examples**\n\n```prolog\n?- get_code(user_input, a).\nthrows error(type_error(integer, a), _).\n\n?- get_code(S, C).\nthrows error(instantiation_error, _).\n\n?- get_code(user_output, C).\nthrows error(domain_error(stream_type, user_output), _).\n```';
1168
+ }
1169
+ protoOf(GetCode2).w1x = function () {
1170
+ return this.t3x_1;
1171
+ };
1172
+ protoOf(GetCode2).z2u = function (_this__u8e3s4, first, second) {
1173
+ var channel = IOPrimitiveUtils_getInstance().h3w(_this__u8e3s4, 0);
1174
+ IOPrimitiveUtils_getInstance().q3x(_this__u8e3s4, 1);
1175
+ return IOPrimitiveUtils_getInstance().r3x(_this__u8e3s4, channel, second);
1176
+ };
1177
+ protoOf(GetCode2).r2k = function (_this__u8e3s4, first, second) {
1178
+ return this.z2u(_this__u8e3s4, first, second);
1179
+ };
1180
+ var GetCode2_instance;
1181
+ function GetCode2_getInstance() {
1182
+ if (GetCode2_instance == null)
1183
+ new GetCode2();
1184
+ return GetCode2_instance;
1185
+ }
1186
+ function IOPrimitiveUtils$propertiesOf$slambda$lambda(it) {
1187
+ return it === '$current';
1188
+ }
1189
+ function IOPrimitiveUtils$alias$ref(p0) {
1190
+ return constructCallableReference(function (p0_0) {
1191
+ var tmp0 = p0;
1192
+ return alias(tmp0, p0_0);
1193
+ }, 1, 0, 86, 'alias', [p0]);
1194
+ }
1195
+ function IOPrimitiveUtils$propertiesOf$slambda$lambda_0(it) {
1196
+ return it === '$current';
1197
+ }
1198
+ function _get_INPUT_STREAM_TERM_PATTERN__5fd8p6($this) {
1199
+ var tmp0 = $this.m3v_1;
1200
+ var tmp = KProperty1;
1201
+ // Inline function 'kotlin.getValue' call
1202
+ /* dead property reference removed */
1203
+ return tmp0.h2();
1204
+ }
1205
+ function _get_OUTPUT_STREAM_TERM_PATTERN__4vocxf($this) {
1206
+ var tmp0 = $this.n3v_1;
1207
+ var tmp = KProperty1;
1208
+ // Inline function 'kotlin.getValue' call
1209
+ /* dead property reference removed */
1210
+ return tmp0.h2();
1211
+ }
1212
+ function _get_PROPERTY_TYPE_PATTERN__5nq864($this) {
1213
+ var tmp0 = $this.o3v_1;
1214
+ var tmp = KProperty1;
1215
+ // Inline function 'kotlin.getValue' call
1216
+ /* dead property reference removed */
1217
+ return tmp0.h2();
1218
+ }
1219
+ function _get_PROPERTY_REPOSITION_PATTERN__lznuii($this) {
1220
+ var tmp0 = $this.p3v_1;
1221
+ var tmp = KProperty1;
1222
+ // Inline function 'kotlin.getValue' call
1223
+ /* dead property reference removed */
1224
+ return tmp0.h2();
1225
+ }
1226
+ function _get_PROPERTY_EOF_ACTION_PATTERN__8k2shv($this) {
1227
+ var tmp0 = $this.q3v_1;
1228
+ var tmp = KProperty1;
1229
+ // Inline function 'kotlin.getValue' call
1230
+ /* dead property reference removed */
1231
+ return tmp0.h2();
1232
+ }
1233
+ function _get_PROPERTY_ALIAS_PATTERN__wipd2s($this) {
1234
+ var tmp0 = $this.r3v_1;
1235
+ var tmp = KProperty1;
1236
+ // Inline function 'kotlin.getValue' call
1237
+ /* dead property reference removed */
1238
+ return tmp0.h2();
1239
+ }
1240
+ function _get_PROPERTY_INPUT__z2zr91($this) {
1241
+ var tmp0 = $this.s3v_1;
1242
+ var tmp = KProperty1;
1243
+ // Inline function 'kotlin.getValue' call
1244
+ /* dead property reference removed */
1245
+ return tmp0.h2();
1246
+ }
1247
+ function _get_PROPERTY_OUTPUT__1pem9m($this) {
1248
+ var tmp0 = $this.t3v_1;
1249
+ var tmp = KProperty1;
1250
+ // Inline function 'kotlin.getValue' call
1251
+ /* dead property reference removed */
1252
+ return tmp0.h2();
1253
+ }
1254
+ function _get_PROPERTY_TYPE_TEXT__9rpcwt($this) {
1255
+ var tmp0 = $this.u3v_1;
1256
+ var tmp = KProperty1;
1257
+ // Inline function 'kotlin.getValue' call
1258
+ /* dead property reference removed */
1259
+ return tmp0.h2();
1260
+ }
1261
+ function _get_PROPERTY_REPOSITION_FALSE__i73t3b($this) {
1262
+ var tmp0 = $this.v3v_1;
1263
+ var tmp = KProperty1;
1264
+ // Inline function 'kotlin.getValue' call
1265
+ /* dead property reference removed */
1266
+ return tmp0.h2();
1267
+ }
1268
+ function _get_PROPERTY_EOF_ACTION_EOF_CODE__he3pvl($this) {
1269
+ var tmp0 = $this.w3v_1;
1270
+ var tmp = KProperty1;
1271
+ // Inline function 'kotlin.getValue' call
1272
+ /* dead property reference removed */
1273
+ return tmp0.h2();
1274
+ }
1275
+ function _get_OPTION_QUOTED_PATTERN__n2ri42($this) {
1276
+ var tmp0 = $this.x3v_1;
1277
+ var tmp = KProperty1;
1278
+ // Inline function 'kotlin.getValue' call
1279
+ /* dead property reference removed */
1280
+ return tmp0.h2();
1281
+ }
1282
+ function _get_OPTION_NUMBER_VARS_PATTERN__p98ste($this) {
1283
+ var tmp0 = $this.y3v_1;
1284
+ var tmp = KProperty1;
1285
+ // Inline function 'kotlin.getValue' call
1286
+ /* dead property reference removed */
1287
+ return tmp0.h2();
1288
+ }
1289
+ function _get_OPTION_IGNORE_OPS_PATTERN__cpse4v($this) {
1290
+ var tmp0 = $this.z3v_1;
1291
+ var tmp = KProperty1;
1292
+ // Inline function 'kotlin.getValue' call
1293
+ /* dead property reference removed */
1294
+ return tmp0.h2();
1295
+ }
1296
+ function _get_INFO_VARIABLES_PATTERN__bhp1h0($this) {
1297
+ var tmp0 = $this.a3w_1;
1298
+ var tmp = KProperty1;
1299
+ // Inline function 'kotlin.getValue' call
1300
+ /* dead property reference removed */
1301
+ return tmp0.h2();
1302
+ }
1303
+ function _get_INFO_VARIABLE_NAMES_PATTERN__j3oaom($this) {
1304
+ var tmp0 = $this.b3w_1;
1305
+ var tmp = KProperty1;
1306
+ // Inline function 'kotlin.getValue' call
1307
+ /* dead property reference removed */
1308
+ return tmp0.h2();
1309
+ }
1310
+ function _get_INFO_SINGLETONS_PATTERN__y21s87($this) {
1311
+ var tmp0 = $this.c3w_1;
1312
+ var tmp = KProperty1;
1313
+ // Inline function 'kotlin.getValue' call
1314
+ /* dead property reference removed */
1315
+ return tmp0.h2();
1316
+ }
1317
+ function _get_validPropertiesPattern__7s1t06($this) {
1318
+ 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)]);
1319
+ }
1320
+ function _get_validOptionsPattern__akhsd9($this) {
1321
+ var tmp = IOPrimitiveUtils$quoted$ref($this);
1322
+ var tmp_0 = IOPrimitiveUtils$ignoreOps$ref($this);
1323
+ var tmp_1 = sequenceOf([tmp, tmp_0, IOPrimitiveUtils$numberVars$ref($this)]);
1324
+ return flatMap(tmp_1, IOPrimitiveUtils$_get_validOptionsPattern_$lambda_r088xw);
1325
+ }
1326
+ function _get_validInfoPattern__dtwgth($this) {
1327
+ return sequenceOf([_get_INFO_VARIABLES_PATTERN__bhp1h0($this), _get_INFO_VARIABLE_NAMES_PATTERN__j3oaom($this), _get_INFO_SINGLETONS_PATTERN__y21s87($this)]);
1328
+ }
1329
+ function _get_supportedPropertiesPattern__x8u7bw($this) {
1330
+ 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)]);
1331
+ }
1332
+ function alias($this, alias) {
1333
+ alias = alias === VOID ? null : alias;
1334
+ var tmp = Companion_getInstance_2();
1335
+ var tmp_0;
1336
+ if (alias == null) {
1337
+ tmp_0 = null;
1338
+ } else {
1339
+ // Inline function 'kotlin.let' call
1340
+ tmp_0 = Companion_getInstance_0().of(alias);
1341
+ }
1342
+ var tmp1_elvis_lhs = tmp_0;
1343
+ return tmp.of('alias', [tmp1_elvis_lhs == null ? Companion_getInstance_3().anonymous() : tmp1_elvis_lhs]);
1344
+ }
1345
+ function quoted($this, value) {
1346
+ value = value === VOID ? null : value;
1347
+ var tmp = Companion_getInstance_2();
1348
+ var tmp_0;
1349
+ if (value == null) {
1350
+ tmp_0 = null;
1351
+ } else {
1352
+ // Inline function 'kotlin.let' call
1353
+ tmp_0 = Companion_getInstance_4().of(value);
1354
+ }
1355
+ var tmp1_elvis_lhs = tmp_0;
1356
+ return tmp.of('quoted', [tmp1_elvis_lhs == null ? Companion_getInstance_3().anonymous() : tmp1_elvis_lhs]);
1357
+ }
1358
+ function ignoreOps($this, value) {
1359
+ value = value === VOID ? null : value;
1360
+ var tmp = Companion_getInstance_2();
1361
+ var tmp_0;
1362
+ if (value == null) {
1363
+ tmp_0 = null;
1364
+ } else {
1365
+ // Inline function 'kotlin.let' call
1366
+ tmp_0 = Companion_getInstance_4().of(value);
1367
+ }
1368
+ var tmp1_elvis_lhs = tmp_0;
1369
+ return tmp.of('ignore_ops', [tmp1_elvis_lhs == null ? Companion_getInstance_3().anonymous() : tmp1_elvis_lhs]);
1370
+ }
1371
+ function numberVars($this, value) {
1372
+ value = value === VOID ? null : value;
1373
+ var tmp = Companion_getInstance_2();
1374
+ var tmp_0;
1375
+ if (value == null) {
1376
+ tmp_0 = null;
1377
+ } else {
1378
+ // Inline function 'kotlin.let' call
1379
+ tmp_0 = Companion_getInstance_4().of(value);
1380
+ }
1381
+ var tmp1_elvis_lhs = tmp_0;
1382
+ return tmp.of('numbervars', [tmp1_elvis_lhs == null ? Companion_getInstance_3().anonymous() : tmp1_elvis_lhs]);
1383
+ }
1384
+ function variables($this, variables) {
1385
+ variables = variables === VOID ? null : variables;
1386
+ var tmp = Companion_getInstance_2();
1387
+ var tmp_0;
1388
+ if (variables == null) {
1389
+ tmp_0 = null;
1390
+ } else {
1391
+ // Inline function 'kotlin.let' call
1392
+ tmp_0 = Companion_instance_4.ofList(variables);
1393
+ }
1394
+ var tmp1_elvis_lhs = tmp_0;
1395
+ return tmp.of('variables', [tmp1_elvis_lhs == null ? Companion_getInstance_3().anonymous() : tmp1_elvis_lhs]);
1396
+ }
1397
+ function vn($this, functor, vNames) {
1398
+ vNames = vNames === VOID ? null : vNames;
1399
+ var tmp = Companion_getInstance_2();
1400
+ var tmp_0;
1401
+ if (vNames == null) {
1402
+ tmp_0 = null;
1403
+ } else {
1404
+ // Inline function 'kotlin.collections.map' call
1405
+ // Inline function 'kotlin.collections.mapTo' call
1406
+ var destination = ArrayList_init_$Create$(collectionSizeOrDefault(vNames, 10));
1407
+ var _iterator__ex2g4s = vNames.n();
1408
+ while (_iterator__ex2g4s.q()) {
1409
+ var item = _iterator__ex2g4s.r();
1410
+ var a = item.he();
1411
+ var v = item.ie();
1412
+ var tmp$ret$2 = Companion_getInstance_2().of('=', [a, v]);
1413
+ destination.l(tmp$ret$2);
1414
+ }
1415
+ tmp_0 = destination;
1416
+ }
1417
+ var tmp1_safe_receiver = tmp_0;
1418
+ var tmp_1;
1419
+ if (tmp1_safe_receiver == null) {
1420
+ tmp_1 = null;
1421
+ } else {
1422
+ // Inline function 'kotlin.let' call
1423
+ tmp_1 = Companion_instance_4.ofList(tmp1_safe_receiver);
1424
+ }
1425
+ var tmp2_elvis_lhs = tmp_1;
1426
+ return tmp.of(functor, [tmp2_elvis_lhs == null ? Companion_getInstance_3().anonymous() : tmp2_elvis_lhs]);
1427
+ }
1428
+ function variableNames($this, vNames) {
1429
+ vNames = vNames === VOID ? null : vNames;
1430
+ return vn($this, 'variable_names', vNames);
1431
+ }
1432
+ function singletons($this, vNames) {
1433
+ vNames = vNames === VOID ? null : vNames;
1434
+ return vn($this, 'singletons', vNames);
1435
+ }
1436
+ function getOption($this, $receiver, unificator, pattern) {
1437
+ // Inline function 'kotlin.sequences.filterIsInstance' call
1438
+ var this_0 = asSequence($receiver);
1439
+ var tmp = filter(this_0, IOPrimitiveUtils$getOption$lambda);
1440
+ var tmp_0 = isInterface(tmp, Sequence) ? tmp : THROW_CCE();
1441
+ var tmp_1 = filter(tmp_0, IOPrimitiveUtils$getOption$lambda_0(unificator, pattern));
1442
+ // Inline function 'kotlin.sequences.filterIsInstance' call
1443
+ var this_1 = map(tmp_1, IOPrimitiveUtils$getOption$lambda_1);
1444
+ var tmp_2 = filter(this_1, IOPrimitiveUtils$getOption$lambda_2);
1445
+ var tmp_3 = isInterface(tmp_2, Sequence) ? tmp_2 : THROW_CCE();
1446
+ var tmp0_elvis_lhs = firstOrNull(map(tmp_3, IOPrimitiveUtils$getOption$lambda_3));
1447
+ return tmp0_elvis_lhs == null ? false : tmp0_elvis_lhs;
1448
+ }
1449
+ function getInfo($this, $receiver, unificator, pattern, value) {
1450
+ // Inline function 'kotlin.sequences.filterIsInstance' call
1451
+ var this_0 = asSequence($receiver);
1452
+ var tmp = filter(this_0, IOPrimitiveUtils$getInfo$lambda);
1453
+ var tmp0 = isInterface(tmp, Sequence) ? tmp : THROW_CCE();
1454
+ var tmp$ret$1;
1455
+ $l$block: {
1456
+ // Inline function 'kotlin.sequences.firstOrNull' call
1457
+ var _iterator__ex2g4s = tmp0.n();
1458
+ while (_iterator__ex2g4s.q()) {
1459
+ var element = _iterator__ex2g4s.r();
1460
+ if (unificator.match(pattern, element)) {
1461
+ tmp$ret$1 = element;
1462
+ break $l$block;
1463
+ }
1464
+ }
1465
+ tmp$ret$1 = null;
1466
+ }
1467
+ var tmp0_safe_receiver = tmp$ret$1;
1468
+ var tmp_0;
1469
+ if (tmp0_safe_receiver == null) {
1470
+ tmp_0 = null;
1471
+ } else {
1472
+ // Inline function 'kotlin.let' call
1473
+ tmp_0 = unificator.mgu(tmp0_safe_receiver, value);
1474
+ }
1475
+ var tmp1_elvis_lhs = tmp_0;
1476
+ return tmp1_elvis_lhs == null ? Companion_getInstance_5().empty() : tmp1_elvis_lhs;
1477
+ }
1478
+ function _get_singletons__bihqrn($this, $receiver) {
1479
+ // Inline function 'kotlin.sequences.groupBy' call
1480
+ var tmp0 = $receiver.gx();
1481
+ // Inline function 'kotlin.sequences.groupByTo' call
1482
+ var destination = LinkedHashMap_init_$Create$();
1483
+ var _iterator__ex2g4s = tmp0.n();
1484
+ while (_iterator__ex2g4s.q()) {
1485
+ var element = _iterator__ex2g4s.r();
1486
+ var key = element;
1487
+ // Inline function 'kotlin.collections.getOrPut' call
1488
+ var value = destination.k2(key);
1489
+ var tmp;
1490
+ if (value == null) {
1491
+ var answer = ArrayList_init_$Create$_0();
1492
+ destination.t4(key, answer);
1493
+ tmp = answer;
1494
+ } else {
1495
+ tmp = value;
1496
+ }
1497
+ var list = tmp;
1498
+ list.l(element);
1499
+ }
1500
+ var tmp_0 = asSequence_0(destination);
1501
+ var tmp_1 = filter(tmp_0, IOPrimitiveUtils$_get_singletons_$lambda_kke618);
1502
+ return toSet(map(tmp_1, IOPrimitiveUtils$_get_singletons_$lambda_kke618_0));
1503
+ }
1504
+ function toAssignments($this, $receiver) {
1505
+ return toAssignments_0($this, asSequence($receiver));
1506
+ }
1507
+ function toAssignments_0($this, $receiver) {
1508
+ // Inline function 'kotlin.sequences.groupBy' call
1509
+ // Inline function 'kotlin.sequences.groupByTo' call
1510
+ var destination = LinkedHashMap_init_$Create$();
1511
+ var _iterator__ex2g4s = $receiver.n();
1512
+ while (_iterator__ex2g4s.q()) {
1513
+ var element = _iterator__ex2g4s.r();
1514
+ var key = Companion_getInstance_0().of(element.p2());
1515
+ // Inline function 'kotlin.collections.getOrPut' call
1516
+ var value = destination.k2(key);
1517
+ var tmp;
1518
+ if (value == null) {
1519
+ var answer = ArrayList_init_$Create$_0();
1520
+ destination.t4(key, answer);
1521
+ tmp = answer;
1522
+ } else {
1523
+ tmp = value;
1524
+ }
1525
+ var list = tmp;
1526
+ list.l(element);
1527
+ }
1528
+ // Inline function 'kotlin.collections.flatMap' call
1529
+ // Inline function 'kotlin.collections.flatMapTo' call
1530
+ var destination_0 = ArrayList_init_$Create$_0();
1531
+ // Inline function 'kotlin.collections.iterator' call
1532
+ var _iterator__ex2g4s_0 = destination.d1().n();
1533
+ while (_iterator__ex2g4s_0.q()) {
1534
+ var element_0 = _iterator__ex2g4s_0.r();
1535
+ // Inline function 'kotlin.collections.component1' call
1536
+ var n = element_0.g2();
1537
+ // Inline function 'kotlin.collections.component2' call
1538
+ var vs = element_0.h2();
1539
+ var tmp_0 = asSequence(vs);
1540
+ var list_0 = map(tmp_0, IOPrimitiveUtils$toAssignments$lambda(n));
1541
+ addAll(destination_0, list_0);
1542
+ }
1543
+ return toList(destination_0);
1544
+ }
1545
+ function _get_alias__jw26bj($this, $receiver) {
1546
+ var tmp0_safe_receiver = (!($receiver == null) ? isInterface($receiver, Struct) : false) ? $receiver : null;
1547
+ var tmp = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.getArgAt(0);
1548
+ var tmp1_safe_receiver = (!(tmp == null) ? isInterface(tmp, Atom) : false) ? tmp : null;
1549
+ return tmp1_safe_receiver == null ? null : tmp1_safe_receiver.h2();
1550
+ }
1551
+ function replyOpeningStream($this, $receiver, channel, third, alias) {
1552
+ alias = alias === VOID ? null : alias;
1553
+ var streamTerm = channel.m22();
1554
+ var tmp = Companion_getInstance_1().m2l($receiver, third, streamTerm);
1555
+ return $receiver.replyWithBuildingSideEffects(tmp, VOID, IOPrimitiveUtils$replyOpeningStream$lambda(alias, channel));
1556
+ }
1557
+ function replyOpeningStream_0($this, $receiver, channel, third, alias) {
1558
+ alias = alias === VOID ? null : alias;
1559
+ var streamTerm = channel.m22();
1560
+ var tmp = Companion_getInstance_1().m2l($receiver, third, streamTerm);
1561
+ return $receiver.replyWithBuildingSideEffects(tmp, VOID, IOPrimitiveUtils$replyOpeningStream$lambda_0(alias, channel));
1562
+ }
1563
+ function IOPrimitiveUtils$INPUT_STREAM_TERM_PATTERN$delegate$lambda() {
1564
+ return Companion_instance.streamTerm();
1565
+ }
1566
+ function IOPrimitiveUtils$_get_INPUT_STREAM_TERM_PATTERN_$ref_59oxnp() {
1567
+ return constructCallableReference(function (p0) {
1568
+ return _get_INPUT_STREAM_TERM_PATTERN__5fd8p6(p0);
1569
+ }, 1, 0, 87);
1570
+ }
1571
+ function IOPrimitiveUtils$OUTPUT_STREAM_TERM_PATTERN$delegate$lambda() {
1572
+ return Companion_instance_5.streamTerm();
1573
+ }
1574
+ function IOPrimitiveUtils$_get_OUTPUT_STREAM_TERM_PATTERN_$ref_kcdkmo() {
1575
+ return constructCallableReference(function (p0) {
1576
+ return _get_OUTPUT_STREAM_TERM_PATTERN__4vocxf(p0);
1577
+ }, 1, 0, 88);
1578
+ }
1579
+ function IOPrimitiveUtils$PROPERTY_TYPE_PATTERN$delegate$lambda() {
1580
+ return Companion_getInstance_2().of('type', [Companion_getInstance_3().anonymous()]);
1581
+ }
1582
+ function IOPrimitiveUtils$_get_PROPERTY_TYPE_PATTERN_$ref_qcyh3d() {
1583
+ return constructCallableReference(function (p0) {
1584
+ return _get_PROPERTY_TYPE_PATTERN__5nq864(p0);
1585
+ }, 1, 0, 89);
1586
+ }
1587
+ function IOPrimitiveUtils$PROPERTY_REPOSITION_PATTERN$delegate$lambda() {
1588
+ return Companion_getInstance_2().of('reposition', [Companion_getInstance_3().anonymous()]);
1589
+ }
1590
+ function IOPrimitiveUtils$_get_PROPERTY_REPOSITION_PATTERN_$ref_uil93p() {
1591
+ return constructCallableReference(function (p0) {
1592
+ return _get_PROPERTY_REPOSITION_PATTERN__lznuii(p0);
1593
+ }, 1, 0, 90);
1594
+ }
1595
+ function IOPrimitiveUtils$PROPERTY_EOF_ACTION_PATTERN$delegate$lambda() {
1596
+ return Companion_getInstance_2().of('eof_action', [Companion_getInstance_3().anonymous()]);
1597
+ }
1598
+ function IOPrimitiveUtils$_get_PROPERTY_EOF_ACTION_PATTERN_$ref_bt8ai0() {
1599
+ return constructCallableReference(function (p0) {
1600
+ return _get_PROPERTY_EOF_ACTION_PATTERN__8k2shv(p0);
1601
+ }, 1, 0, 91);
1602
+ }
1603
+ function IOPrimitiveUtils$PROPERTY_ALIAS_PATTERN$delegate$lambda() {
1604
+ return alias(IOPrimitiveUtils_getInstance());
1605
+ }
1606
+ function IOPrimitiveUtils$_get_PROPERTY_ALIAS_PATTERN_$ref_qs5lfb() {
1607
+ return constructCallableReference(function (p0) {
1608
+ return _get_PROPERTY_ALIAS_PATTERN__wipd2s(p0);
1609
+ }, 1, 0, 92);
1610
+ }
1611
+ function IOPrimitiveUtils$PROPERTY_INPUT$delegate$lambda() {
1612
+ return Companion_getInstance_0().of('input');
1613
+ }
1614
+ function IOPrimitiveUtils$_get_PROPERTY_INPUT_$ref_hltzoy() {
1615
+ return constructCallableReference(function (p0) {
1616
+ return _get_PROPERTY_INPUT__z2zr91(p0);
1617
+ }, 1, 0, 93);
1618
+ }
1619
+ function IOPrimitiveUtils$PROPERTY_OUTPUT$delegate$lambda() {
1620
+ return Companion_getInstance_0().of('output');
1621
+ }
1622
+ function IOPrimitiveUtils$_get_PROPERTY_OUTPUT_$ref_9ccgyp() {
1623
+ return constructCallableReference(function (p0) {
1624
+ return _get_PROPERTY_OUTPUT__1pem9m(p0);
1625
+ }, 1, 0, 94);
1626
+ }
1627
+ function IOPrimitiveUtils$PROPERTY_TYPE_TEXT$delegate$lambda() {
1628
+ return Companion_getInstance_2().of('type', [Companion_getInstance_0().of('text')]);
1629
+ }
1630
+ function IOPrimitiveUtils$_get_PROPERTY_TYPE_TEXT_$ref_47hbty() {
1631
+ return constructCallableReference(function (p0) {
1632
+ return _get_PROPERTY_TYPE_TEXT__9rpcwt(p0);
1633
+ }, 1, 0, 95);
1634
+ }
1635
+ function IOPrimitiveUtils$PROPERTY_REPOSITION_FALSE$delegate$lambda() {
1636
+ return Companion_getInstance_2().of('reposition', [Companion_getInstance_4().xw_1]);
1637
+ }
1638
+ function IOPrimitiveUtils$_get_PROPERTY_REPOSITION_FALSE_$ref_jx0m6() {
1639
+ return constructCallableReference(function (p0) {
1640
+ return _get_PROPERTY_REPOSITION_FALSE__i73t3b(p0);
1641
+ }, 1, 0, 96);
1642
+ }
1643
+ function IOPrimitiveUtils$PROPERTY_EOF_ACTION_EOF_CODE$delegate$lambda() {
1644
+ return Companion_getInstance_2().of('eof_action', [Companion_getInstance_0().of('eof_code')]);
1645
+ }
1646
+ function IOPrimitiveUtils$_get_PROPERTY_EOF_ACTION_EOF_CODE_$ref_1cwy66() {
1647
+ return constructCallableReference(function (p0) {
1648
+ return _get_PROPERTY_EOF_ACTION_EOF_CODE__he3pvl(p0);
1649
+ }, 1, 0, 97);
1650
+ }
1651
+ function IOPrimitiveUtils$OPTION_QUOTED_PATTERN$delegate$lambda() {
1652
+ return quoted(IOPrimitiveUtils_getInstance());
1653
+ }
1654
+ function IOPrimitiveUtils$_get_OPTION_QUOTED_PATTERN_$ref_nxjfbr() {
1655
+ return constructCallableReference(function (p0) {
1656
+ return _get_OPTION_QUOTED_PATTERN__n2ri42(p0);
1657
+ }, 1, 0, 98);
1658
+ }
1659
+ function IOPrimitiveUtils$OPTION_NUMBER_VARS_PATTERN$delegate$lambda() {
1660
+ return numberVars(IOPrimitiveUtils_getInstance());
1661
+ }
1662
+ function IOPrimitiveUtils$_get_OPTION_NUMBER_VARS_PATTERN_$ref_pdk9ph() {
1663
+ return constructCallableReference(function (p0) {
1664
+ return _get_OPTION_NUMBER_VARS_PATTERN__p98ste(p0);
1665
+ }, 1, 0, 99);
1666
+ }
1667
+ function IOPrimitiveUtils$OPTION_IGNORE_OPS_PATTERN$delegate$lambda() {
1668
+ return ignoreOps(IOPrimitiveUtils_getInstance());
1669
+ }
1670
+ function IOPrimitiveUtils$_get_OPTION_IGNORE_OPS_PATTERN_$ref_vvsa9g() {
1671
+ return constructCallableReference(function (p0) {
1672
+ return _get_OPTION_IGNORE_OPS_PATTERN__cpse4v(p0);
1673
+ }, 1, 0, 100);
1674
+ }
1675
+ function IOPrimitiveUtils$INFO_VARIABLES_PATTERN$delegate$lambda() {
1676
+ return variables(IOPrimitiveUtils_getInstance());
1677
+ }
1678
+ function IOPrimitiveUtils$_get_INFO_VARIABLES_PATTERN_$ref_ih2rd5() {
1679
+ return constructCallableReference(function (p0) {
1680
+ return _get_INFO_VARIABLES_PATTERN__bhp1h0(p0);
1681
+ }, 1, 0, 101);
1682
+ }
1683
+ function IOPrimitiveUtils$INFO_VARIABLE_NAMES_PATTERN$delegate$lambda() {
1684
+ return variableNames(IOPrimitiveUtils_getInstance());
1685
+ }
1686
+ function IOPrimitiveUtils$_get_INFO_VARIABLE_NAMES_PATTERN_$ref_lzmk91() {
1687
+ return constructCallableReference(function (p0) {
1688
+ return _get_INFO_VARIABLE_NAMES_PATTERN__j3oaom(p0);
1689
+ }, 1, 0, 102);
1690
+ }
1691
+ function IOPrimitiveUtils$INFO_SINGLETONS_PATTERN$delegate$lambda() {
1692
+ return singletons(IOPrimitiveUtils_getInstance());
1693
+ }
1694
+ function IOPrimitiveUtils$_get_INFO_SINGLETONS_PATTERN_$ref_8msi4i() {
1695
+ return constructCallableReference(function (p0) {
1696
+ return _get_INFO_SINGLETONS_PATTERN__y21s87(p0);
1697
+ }, 1, 0, 103);
1698
+ }
1699
+ function IOPrimitiveUtils$quoted$ref(p0) {
1700
+ return constructCallableReference(function (p0_0) {
1701
+ var tmp0 = p0;
1702
+ return quoted(tmp0, p0_0);
1703
+ }, 1, 0, 104, 'quoted', [p0]);
1704
+ }
1705
+ function IOPrimitiveUtils$ignoreOps$ref(p0) {
1706
+ return constructCallableReference(function (p0_0) {
1707
+ var tmp0 = p0;
1708
+ return ignoreOps(tmp0, p0_0);
1709
+ }, 1, 0, 105, 'ignoreOps', [p0]);
1710
+ }
1711
+ function IOPrimitiveUtils$numberVars$ref(p0) {
1712
+ return constructCallableReference(function (p0_0) {
1713
+ var tmp0 = p0;
1714
+ return numberVars(tmp0, p0_0);
1715
+ }, 1, 0, 106, 'numberVars', [p0]);
1716
+ }
1717
+ function IOPrimitiveUtils$_get_validOptionsPattern_$lambda_r088xw(it) {
1718
+ return map(sequenceOf([true, false]), it);
1719
+ }
1720
+ function IOPrimitiveUtils$propertiesOf$slambda($channel, $this_propertiesOf, resultContinuation) {
1721
+ this.c3y_1 = $channel;
1722
+ this.d3y_1 = $this_propertiesOf;
1723
+ CoroutineImpl.call(this, resultContinuation);
1724
+ }
1725
+ protoOf(IOPrimitiveUtils$propertiesOf$slambda).f3y = function ($this$sequence, $completion) {
1726
+ var tmp = this.g3y($this$sequence, $completion);
1727
+ tmp.t8_1 = Unit_instance;
1728
+ tmp.u8_1 = null;
1729
+ return tmp.z8();
1730
+ };
1731
+ protoOf(IOPrimitiveUtils$propertiesOf$slambda).q9 = function (p1, $completion) {
1732
+ return this.f3y(p1 instanceof SequenceScope ? p1 : THROW_CCE(), $completion);
1733
+ };
1734
+ protoOf(IOPrimitiveUtils$propertiesOf$slambda).z8 = function () {
1735
+ var suspendResult = this.t8_1;
1736
+ $sm: do
1737
+ try {
1738
+ var tmp = this.r8_1;
1739
+ switch (tmp) {
1740
+ case 0:
1741
+ this.s8_1 = 7;
1742
+ var tmp0_subject = this.c3y_1;
1743
+ if (isInterface(tmp0_subject, InputChannel)) {
1744
+ this.r8_1 = 3;
1745
+ suspendResult = this.e3y_1.bf(_get_PROPERTY_INPUT__z2zr91(IOPrimitiveUtils_getInstance()), this);
1746
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
1747
+ return suspendResult;
1748
+ }
1749
+ continue $sm;
1750
+ } else {
1751
+ if (isInterface(tmp0_subject, OutputChannel)) {
1752
+ this.r8_1 = 1;
1753
+ suspendResult = this.e3y_1.bf(_get_PROPERTY_OUTPUT__1pem9m(IOPrimitiveUtils_getInstance()), this);
1754
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
1755
+ return suspendResult;
1756
+ }
1757
+ continue $sm;
1758
+ } else {
1759
+ this.r8_1 = 5;
1760
+ continue $sm;
1761
+ }
1762
+ }
1763
+
1764
+ case 1:
1765
+ this.r8_1 = 2;
1766
+ var tmp_0 = this.d3y_1.context.m1y();
1767
+ var tmp_1 = this.c3y_1;
1768
+ var tmp_2 = tmp_0.aliasesOf(isInterface(tmp_1, OutputChannel) ? tmp_1 : THROW_CCE());
1769
+ var tmp_3 = filterNot(tmp_2, IOPrimitiveUtils$propertiesOf$slambda$lambda_0);
1770
+ suspendResult = this.e3y_1.ef(map(tmp_3, IOPrimitiveUtils$alias$ref(IOPrimitiveUtils_getInstance())), this);
1771
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
1772
+ return suspendResult;
1773
+ }
1774
+
1775
+ continue $sm;
1776
+ case 2:
1777
+ this.r8_1 = 5;
1778
+ continue $sm;
1779
+ case 3:
1780
+ this.r8_1 = 4;
1781
+ var tmp_4 = this.d3y_1.context.l1y();
1782
+ var tmp_5 = this.c3y_1;
1783
+ var tmp_6 = tmp_4.aliasesOf(isInterface(tmp_5, InputChannel) ? tmp_5 : THROW_CCE());
1784
+ var tmp_7 = filterNot(tmp_6, IOPrimitiveUtils$propertiesOf$slambda$lambda);
1785
+ suspendResult = this.e3y_1.ef(map(tmp_7, IOPrimitiveUtils$alias$ref(IOPrimitiveUtils_getInstance())), this);
1786
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
1787
+ return suspendResult;
1788
+ }
1789
+
1790
+ continue $sm;
1791
+ case 4:
1792
+ this.r8_1 = 5;
1793
+ continue $sm;
1794
+ case 5:
1795
+ this.r8_1 = 6;
1796
+ suspendResult = this.e3y_1.bf(_get_PROPERTY_TYPE_TEXT__9rpcwt(IOPrimitiveUtils_getInstance()), this);
1797
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
1798
+ return suspendResult;
1799
+ }
1800
+
1801
+ continue $sm;
1802
+ case 6:
1803
+ return Unit_instance;
1804
+ case 7:
1805
+ throw this.u8_1;
1806
+ }
1807
+ } catch ($p) {
1808
+ var e = $p;
1809
+ if (this.s8_1 === 7) {
1810
+ throw e;
1811
+ } else {
1812
+ this.r8_1 = this.s8_1;
1813
+ this.u8_1 = e;
1814
+ }
1815
+ }
1816
+ while (true);
1817
+ };
1818
+ protoOf(IOPrimitiveUtils$propertiesOf$slambda).g3y = function ($this$sequence, completion) {
1819
+ var i = new IOPrimitiveUtils$propertiesOf$slambda(this.c3y_1, this.d3y_1, completion);
1820
+ i.e3y_1 = $this$sequence;
1821
+ return i;
1822
+ };
1823
+ function IOPrimitiveUtils$propertiesOf$slambda_0($channel, $this_propertiesOf, resultContinuation) {
1824
+ var i = new IOPrimitiveUtils$propertiesOf$slambda($channel, $this_propertiesOf, resultContinuation);
1825
+ return constructCallableReference(function ($this$sequence, $completion) {
1826
+ return i.f3y($this$sequence, $completion);
1827
+ }, 1);
1828
+ }
1829
+ function IOPrimitiveUtils$getOption$lambda(it) {
1830
+ return !(it == null) ? isInterface(it, Struct) : false;
1831
+ }
1832
+ function IOPrimitiveUtils$getOption$lambda_0($unificator, $pattern) {
1833
+ return function (it) {
1834
+ return $unificator.match($pattern, it);
1835
+ };
1836
+ }
1837
+ function IOPrimitiveUtils$getOption$lambda_1(it) {
1838
+ return it.get(0);
1839
+ }
1840
+ function IOPrimitiveUtils$getOption$lambda_2(it) {
1841
+ return !(it == null) ? isInterface(it, Truth) : false;
1842
+ }
1843
+ function IOPrimitiveUtils$getOption$lambda_3(it) {
1844
+ return it.cx();
1845
+ }
1846
+ function IOPrimitiveUtils$getInfo$lambda(it) {
1847
+ return !(it == null) ? isInterface(it, Struct) : false;
1848
+ }
1849
+ function IOPrimitiveUtils$_get_singletons_$lambda_kke618(it) {
1850
+ return it.h2().t() === 1;
1851
+ }
1852
+ function IOPrimitiveUtils$_get_singletons_$lambda_kke618_0(it) {
1853
+ return it.g2();
1854
+ }
1855
+ function IOPrimitiveUtils$toAssignments$lambda($n) {
1856
+ return function (it) {
1857
+ return to($n, it);
1858
+ };
1859
+ }
1860
+ function IOPrimitiveUtils$open$lambda($this_open) {
1861
+ return function (it) {
1862
+ return IOPrimitiveUtils_getInstance().h3y($this_open, it);
1863
+ };
1864
+ }
1865
+ function IOPrimitiveUtils$open$lambda_0($this_open) {
1866
+ return function (it) {
1867
+ return IOPrimitiveUtils_getInstance().i3y($this_open, it);
1868
+ };
1869
+ }
1870
+ function IOPrimitiveUtils$replyOpeningStream$lambda($alias, $channel) {
1871
+ return function ($this$replyWith) {
1872
+ var tmp0_elvis_lhs = $alias;
1873
+ $this$replyWith.f2r(tmp0_elvis_lhs == null ? 'output_channel' + $channel.m22().get(1).toString() : tmp0_elvis_lhs, $channel);
1874
+ return Unit_instance;
1875
+ };
1876
+ }
1877
+ function IOPrimitiveUtils$replyOpeningStream$lambda_0($alias, $channel) {
1878
+ return function ($this$replyWith) {
1879
+ var tmp0_elvis_lhs = $alias;
1880
+ $this$replyWith.c2r(tmp0_elvis_lhs == null ? 'input_channel' + $channel.m22().get(1).toString() : tmp0_elvis_lhs, $channel);
1881
+ return Unit_instance;
1882
+ };
1883
+ }
1884
+ function IOPrimitiveUtils() {
1885
+ IOPrimitiveUtils_instance = this;
1886
+ var tmp = this;
1887
+ tmp.m3v_1 = lazy(IOPrimitiveUtils$INPUT_STREAM_TERM_PATTERN$delegate$lambda);
1888
+ var tmp_0 = this;
1889
+ tmp_0.n3v_1 = lazy(IOPrimitiveUtils$OUTPUT_STREAM_TERM_PATTERN$delegate$lambda);
1890
+ var tmp_1 = this;
1891
+ tmp_1.o3v_1 = lazy(IOPrimitiveUtils$PROPERTY_TYPE_PATTERN$delegate$lambda);
1892
+ var tmp_2 = this;
1893
+ tmp_2.p3v_1 = lazy(IOPrimitiveUtils$PROPERTY_REPOSITION_PATTERN$delegate$lambda);
1894
+ var tmp_3 = this;
1895
+ tmp_3.q3v_1 = lazy(IOPrimitiveUtils$PROPERTY_EOF_ACTION_PATTERN$delegate$lambda);
1896
+ var tmp_4 = this;
1897
+ tmp_4.r3v_1 = lazy(IOPrimitiveUtils$PROPERTY_ALIAS_PATTERN$delegate$lambda);
1898
+ var tmp_5 = this;
1899
+ tmp_5.s3v_1 = lazy(IOPrimitiveUtils$PROPERTY_INPUT$delegate$lambda);
1900
+ var tmp_6 = this;
1901
+ tmp_6.t3v_1 = lazy(IOPrimitiveUtils$PROPERTY_OUTPUT$delegate$lambda);
1902
+ var tmp_7 = this;
1903
+ tmp_7.u3v_1 = lazy(IOPrimitiveUtils$PROPERTY_TYPE_TEXT$delegate$lambda);
1904
+ var tmp_8 = this;
1905
+ tmp_8.v3v_1 = lazy(IOPrimitiveUtils$PROPERTY_REPOSITION_FALSE$delegate$lambda);
1906
+ var tmp_9 = this;
1907
+ tmp_9.w3v_1 = lazy(IOPrimitiveUtils$PROPERTY_EOF_ACTION_EOF_CODE$delegate$lambda);
1908
+ var tmp_10 = this;
1909
+ tmp_10.x3v_1 = lazy(IOPrimitiveUtils$OPTION_QUOTED_PATTERN$delegate$lambda);
1910
+ var tmp_11 = this;
1911
+ tmp_11.y3v_1 = lazy(IOPrimitiveUtils$OPTION_NUMBER_VARS_PATTERN$delegate$lambda);
1912
+ var tmp_12 = this;
1913
+ tmp_12.z3v_1 = lazy(IOPrimitiveUtils$OPTION_IGNORE_OPS_PATTERN$delegate$lambda);
1914
+ var tmp_13 = this;
1915
+ tmp_13.a3w_1 = lazy(IOPrimitiveUtils$INFO_VARIABLES_PATTERN$delegate$lambda);
1916
+ var tmp_14 = this;
1917
+ tmp_14.b3w_1 = lazy(IOPrimitiveUtils$INFO_VARIABLE_NAMES_PATTERN$delegate$lambda);
1918
+ var tmp_15 = this;
1919
+ tmp_15.c3w_1 = lazy(IOPrimitiveUtils$INFO_SINGLETONS_PATTERN$delegate$lambda);
1920
+ }
1921
+ protoOf(IOPrimitiveUtils).j3y = function (_this__u8e3s4, channel) {
1922
+ return sequence(IOPrimitiveUtils$propertiesOf$slambda_0(channel, _this__u8e3s4, null));
1923
+ };
1924
+ protoOf(IOPrimitiveUtils).d3w = function (_this__u8e3s4) {
1925
+ // Inline function 'kotlin.let' call
1926
+ var it = _this__u8e3s4.context.l1y();
1927
+ var tmp0_elvis_lhs = it.wr();
1928
+ return tmp0_elvis_lhs == null ? it.v1y() : tmp0_elvis_lhs;
1929
+ };
1930
+ protoOf(IOPrimitiveUtils).k3y = function (_this__u8e3s4) {
1931
+ // Inline function 'kotlin.let' call
1932
+ var it = _this__u8e3s4.context.m1y();
1933
+ var tmp0_elvis_lhs = it.wr();
1934
+ return tmp0_elvis_lhs == null ? it.w1y() : tmp0_elvis_lhs;
1935
+ };
1936
+ protoOf(IOPrimitiveUtils).h3y = function (_this__u8e3s4, term) {
1937
+ var tmp;
1938
+ var tmp0 = _get_validPropertiesPattern__7s1t06(this);
1939
+ var tmp$ret$0;
1940
+ $l$block: {
1941
+ // Inline function 'kotlin.sequences.any' call
1942
+ var _iterator__ex2g4s = tmp0.n();
1943
+ while (_iterator__ex2g4s.q()) {
1944
+ var element = _iterator__ex2g4s.r();
1945
+ if (Companion_getInstance_1().n2l(_this__u8e3s4, term, element)) {
1946
+ tmp$ret$0 = true;
1947
+ break $l$block;
1948
+ }
1949
+ }
1950
+ tmp$ret$0 = false;
1951
+ }
1952
+ if (tmp$ret$0) {
1953
+ tmp = term;
1954
+ } else {
1955
+ throw Companion_instance_6.forTerm(_this__u8e3s4.context, Expected_STREAM_PROPERTY_getInstance(), term);
1956
+ }
1957
+ return tmp;
1958
+ };
1959
+ protoOf(IOPrimitiveUtils).i3y = function (_this__u8e3s4, term) {
1960
+ var tmp;
1961
+ var tmp0 = _get_supportedPropertiesPattern__x8u7bw(this);
1962
+ var tmp$ret$0;
1963
+ $l$block: {
1964
+ // Inline function 'kotlin.sequences.any' call
1965
+ var _iterator__ex2g4s = tmp0.n();
1966
+ while (_iterator__ex2g4s.q()) {
1967
+ var element = _iterator__ex2g4s.r();
1968
+ if (Companion_getInstance_1().n2l(_this__u8e3s4, term, element)) {
1969
+ tmp$ret$0 = true;
1970
+ break $l$block;
1971
+ }
1972
+ }
1973
+ tmp$ret$0 = false;
1974
+ }
1975
+ if (tmp$ret$0) {
1976
+ tmp = term;
1977
+ } else {
1978
+ throw Companion_instance_2.forUncaughtKtException(_this__u8e3s4.context, IllegalStateException_init_$Create$('unsupported option ' + term.toString()));
1979
+ }
1980
+ return tmp;
1981
+ };
1982
+ protoOf(IOPrimitiveUtils).l3y = function (_this__u8e3s4, term) {
1983
+ var tmp;
1984
+ var tmp0 = _get_validOptionsPattern__akhsd9(this);
1985
+ var tmp$ret$0;
1986
+ $l$block: {
1987
+ // Inline function 'kotlin.sequences.any' call
1988
+ var _iterator__ex2g4s = tmp0.n();
1989
+ while (_iterator__ex2g4s.q()) {
1990
+ var element = _iterator__ex2g4s.r();
1991
+ if (Companion_getInstance_1().n2l(_this__u8e3s4, term, element)) {
1992
+ tmp$ret$0 = true;
1993
+ break $l$block;
1994
+ }
1995
+ }
1996
+ tmp$ret$0 = false;
1997
+ }
1998
+ if (tmp$ret$0) {
1999
+ tmp = term;
2000
+ } else {
2001
+ throw Companion_instance_6.forTerm(_this__u8e3s4.context, Expected_WRITE_OPTION_getInstance(), term);
2002
+ }
2003
+ return tmp;
2004
+ };
2005
+ protoOf(IOPrimitiveUtils).m3y = function (_this__u8e3s4, term) {
2006
+ var tmp;
2007
+ var tmp0 = _get_validInfoPattern__dtwgth(this);
2008
+ var tmp$ret$0;
2009
+ $l$block: {
2010
+ // Inline function 'kotlin.sequences.any' call
2011
+ var _iterator__ex2g4s = tmp0.n();
2012
+ while (_iterator__ex2g4s.q()) {
2013
+ var element = _iterator__ex2g4s.r();
2014
+ if (Companion_getInstance_1().n2l(_this__u8e3s4, term, element)) {
2015
+ tmp$ret$0 = true;
2016
+ break $l$block;
2017
+ }
2018
+ }
2019
+ tmp$ret$0 = false;
2020
+ }
2021
+ if (tmp$ret$0) {
2022
+ tmp = term;
2023
+ } else {
2024
+ throw Companion_instance_6.forTerm(_this__u8e3s4.context, Expected_READ_OPTION_getInstance(), term);
2025
+ }
2026
+ return tmp;
2027
+ };
2028
+ protoOf(IOPrimitiveUtils).n3y = function (_this__u8e3s4, index) {
2029
+ Companion_getInstance_1().g2m(_this__u8e3s4, index);
2030
+ var tmp = _this__u8e3s4.arguments.s(index);
2031
+ var list = isInterface(tmp, List) ? tmp : THROW_CCE();
2032
+ var _iterator__ex2g4s = list.iv().n();
2033
+ while (_iterator__ex2g4s.q()) {
2034
+ var term = _iterator__ex2g4s.r();
2035
+ this.l3y(_this__u8e3s4, term);
2036
+ }
2037
+ return _this__u8e3s4;
2038
+ };
2039
+ protoOf(IOPrimitiveUtils).o3y = function (_this__u8e3s4, index) {
2040
+ var list = _this__u8e3s4.arguments.s(index);
2041
+ var tmp;
2042
+ if (isInterface(list, Var)) {
2043
+ tmp = null;
2044
+ } else {
2045
+ Companion_getInstance_1().g2m(_this__u8e3s4, index);
2046
+ var listOfInfo = (isInterface(list, List) ? list : THROW_CCE()).toList();
2047
+ var _iterator__ex2g4s = listOfInfo.n();
2048
+ while (_iterator__ex2g4s.q()) {
2049
+ var term = _iterator__ex2g4s.r();
2050
+ this.m3y(_this__u8e3s4, term);
2051
+ }
2052
+ tmp = listOfInfo;
2053
+ }
2054
+ return tmp;
2055
+ };
2056
+ protoOf(IOPrimitiveUtils).p3y = function (_this__u8e3s4, index) {
2057
+ this.n3y(_this__u8e3s4, index);
2058
+ var tmp = _this__u8e3s4.arguments.s(index);
2059
+ var optionList = (isInterface(tmp, List) ? tmp : THROW_CCE()).toList();
2060
+ var tmp_0;
2061
+ if (getOption(this, optionList, _this__u8e3s4.context.i1o(), _get_OPTION_QUOTED_PATTERN__n2ri42(this))) {
2062
+ tmp_0 = FuncFormat_QUOTED_IF_NECESSARY_getInstance();
2063
+ } else {
2064
+ tmp_0 = FuncFormat_LITERAL_getInstance();
2065
+ }
2066
+ var funcFormat = tmp_0;
2067
+ var tmp_1;
2068
+ if (getOption(this, optionList, _this__u8e3s4.context.i1o(), _get_OPTION_IGNORE_OPS_PATTERN__cpse4v(this))) {
2069
+ tmp_1 = OpFormat_IGNORE_OPERATORS_getInstance();
2070
+ } else {
2071
+ tmp_1 = OpFormat_EXPRESSIONS_getInstance();
2072
+ }
2073
+ var opFormat = tmp_1;
2074
+ var numberVars = getOption(this, optionList, _this__u8e3s4.context.i1o(), _get_OPTION_NUMBER_VARS_PATTERN__p98ste(this));
2075
+ return Companion_instance_7.of(VarFormat_UNDERSCORE_getInstance(), opFormat, funcFormat, numberVars, _this__u8e3s4.context.q1y());
2076
+ };
2077
+ protoOf(IOPrimitiveUtils).q3y = function (_this__u8e3s4, index) {
2078
+ var term = _this__u8e3s4.arguments.s(index);
2079
+ if (isInterface(term, Var))
2080
+ return _this__u8e3s4;
2081
+ else {
2082
+ if (isInterface(term, Struct)) {
2083
+ var tmp0 = sequenceOf([_get_PROPERTY_INPUT__z2zr91(this), _get_PROPERTY_OUTPUT__1pem9m(this), _get_PROPERTY_ALIAS_PATTERN__wipd2s(this)]);
2084
+ var tmp$ret$0;
2085
+ $l$block: {
2086
+ // Inline function 'kotlin.sequences.any' call
2087
+ var _iterator__ex2g4s = tmp0.n();
2088
+ while (_iterator__ex2g4s.q()) {
2089
+ var element = _iterator__ex2g4s.r();
2090
+ if (Companion_getInstance_1().n2l(_this__u8e3s4, term, element)) {
2091
+ tmp$ret$0 = true;
2092
+ break $l$block;
2093
+ }
2094
+ }
2095
+ tmp$ret$0 = false;
2096
+ }
2097
+ if (tmp$ret$0) {
2098
+ return _this__u8e3s4;
2099
+ }
2100
+ }
2101
+ }
2102
+ throw Companion_instance_6.t28(_this__u8e3s4.context, _this__u8e3s4.signature, Expected_STREAM_PROPERTY_getInstance(), term, index);
2103
+ };
2104
+ protoOf(IOPrimitiveUtils).r3y = function (_this__u8e3s4, index) {
2105
+ Companion_getInstance_1().s2l(_this__u8e3s4, index);
2106
+ var term = _this__u8e3s4.arguments.s(index);
2107
+ var error = Companion_instance_6.t28(_this__u8e3s4.context, _this__u8e3s4.signature, Expected_SOURCE_SINK_getInstance(), term, index);
2108
+ if (!isInterface(term, Atom)) {
2109
+ throw error;
2110
+ }
2111
+ try {
2112
+ return Companion_instance_15.of(term.h2());
2113
+ } catch ($p) {
2114
+ if ($p instanceof InvalidUrlException) {
2115
+ var _unused_var__etf5q3 = $p;
2116
+ throw error;
2117
+ } else {
2118
+ throw $p;
2119
+ }
2120
+ }
2121
+ };
2122
+ protoOf(IOPrimitiveUtils).s3y = function (_this__u8e3s4, index) {
2123
+ Companion_getInstance_1().s2l(_this__u8e3s4, index);
2124
+ Companion_getInstance_1().b2m(_this__u8e3s4, index);
2125
+ var tmp = _this__u8e3s4.arguments.s(index);
2126
+ var term = isInterface(tmp, Atom) ? tmp : THROW_CCE();
2127
+ if (!Companion_getInstance_8().f3u_1.z(term)) {
2128
+ throw Companion_instance_6.t28(_this__u8e3s4.context, _this__u8e3s4.signature, Expected_IO_MODE_getInstance(), term, index);
2129
+ }
2130
+ // Inline function 'kotlin.text.uppercase' call
2131
+ // Inline function 'kotlin.js.asDynamic' call
2132
+ var tmp$ret$0 = term.h2().toUpperCase();
2133
+ return valueOf(tmp$ret$0);
2134
+ };
2135
+ protoOf(IOPrimitiveUtils).y3w = function (_this__u8e3s4, index) {
2136
+ var term = _this__u8e3s4.arguments.s(index);
2137
+ if (isInterface(term, Var))
2138
+ return null;
2139
+ else {
2140
+ if (isInterface(term, Struct))
2141
+ if (Companion_getInstance_1().n2l(_this__u8e3s4, term, _get_OUTPUT_STREAM_TERM_PATTERN__4vocxf(this))) {
2142
+ var tmp1_elvis_lhs = firstOrNull(_this__u8e3s4.context.m1y().findByTerm(term));
2143
+ var tmp;
2144
+ if (tmp1_elvis_lhs == null) {
2145
+ throw Companion_instance_8.forStream(_this__u8e3s4.context, term);
2146
+ } else {
2147
+ tmp = tmp1_elvis_lhs;
2148
+ }
2149
+ return tmp;
2150
+ } else if (Companion_getInstance_1().n2l(_this__u8e3s4, term, _get_INPUT_STREAM_TERM_PATTERN__5fd8p6(this))) {
2151
+ var tmp2_elvis_lhs = firstOrNull(_this__u8e3s4.context.l1y().findByTerm(term));
2152
+ var tmp_0;
2153
+ if (tmp2_elvis_lhs == null) {
2154
+ throw Companion_instance_8.forStream(_this__u8e3s4.context, term);
2155
+ } else {
2156
+ tmp_0 = tmp2_elvis_lhs;
2157
+ }
2158
+ return tmp_0;
2159
+ }
2160
+ }
2161
+ throw Companion_instance_6.t28(_this__u8e3s4.context, _this__u8e3s4.signature, Expected_STREAM_OR_ALIAS_getInstance(), term, index);
2162
+ };
2163
+ protoOf(IOPrimitiveUtils).k3x = function (_this__u8e3s4, index) {
2164
+ var arg = _this__u8e3s4.arguments.s(index);
2165
+ var tmp;
2166
+ if (isInterface(arg, Var)) {
2167
+ tmp = _this__u8e3s4;
2168
+ } else {
2169
+ if (isInterface(arg, Atom)) {
2170
+ var tmp_0;
2171
+ if (arg.h2() === 'end_of_file') {
2172
+ tmp_0 = _this__u8e3s4;
2173
+ } else if (arg.h2().length === 1) {
2174
+ tmp_0 = _this__u8e3s4;
2175
+ } else {
2176
+ throw Companion_instance_3.o2b(_this__u8e3s4.context, _this__u8e3s4.signature, Expected_IN_CHARACTER_getInstance(), arg, index);
2177
+ }
2178
+ tmp = tmp_0;
2179
+ } else {
2180
+ throw Companion_instance_3.o2b(_this__u8e3s4.context, _this__u8e3s4.signature, Expected_IN_CHARACTER_getInstance(), arg, index);
2181
+ }
2182
+ }
2183
+ return tmp;
2184
+ };
2185
+ protoOf(IOPrimitiveUtils).q3x = function (_this__u8e3s4, index) {
2186
+ var term = _this__u8e3s4.arguments.s(index);
2187
+ var tmp;
2188
+ if (isInterface(term, Var)) {
2189
+ tmp = _this__u8e3s4;
2190
+ } else {
2191
+ if (!isInterface(term, Integer)) {
2192
+ tmp = Companion_getInstance_1().f2m(_this__u8e3s4, index);
2193
+ } else {
2194
+ if (term.equals(Companion_getInstance_6().t11_1)) {
2195
+ tmp = _this__u8e3s4;
2196
+ } else {
2197
+ if (Companion_getInstance_1().j2m(term)) {
2198
+ throw Companion_instance_9.of(_this__u8e3s4.context, _this__u8e3s4.signature, Limit_CHARACTER_CODE_getInstance());
2199
+ } else {
2200
+ tmp = _this__u8e3s4;
2201
+ }
2202
+ }
2203
+ }
2204
+ }
2205
+ return tmp;
2206
+ };
2207
+ protoOf(IOPrimitiveUtils).m3w = function (_this__u8e3s4, index) {
2208
+ Companion_getInstance_1().s2l(_this__u8e3s4, index);
2209
+ Companion_getInstance_1().w2l(_this__u8e3s4, index);
2210
+ var tmp = _this__u8e3s4.arguments.s(index);
2211
+ var term = isInterface(tmp, Struct) ? tmp : THROW_CCE();
2212
+ var tmp_0;
2213
+ if (isInterface(term, Atom)) {
2214
+ var tmp0 = sequenceOf([_this__u8e3s4.context.l1y(), _this__u8e3s4.context.m1y()]);
2215
+ var tmp$ret$0;
2216
+ $l$block: {
2217
+ // Inline function 'kotlin.sequences.firstOrNull' call
2218
+ var _iterator__ex2g4s = tmp0.n();
2219
+ while (_iterator__ex2g4s.q()) {
2220
+ var element = _iterator__ex2g4s.r();
2221
+ // Inline function 'kotlin.collections.contains' call
2222
+ // Inline function 'kotlin.collections.containsKey' call
2223
+ var key = term.h2();
2224
+ if ((isInterface(element, KtMap) ? element : THROW_CCE()).i2(key)) {
2225
+ tmp$ret$0 = element;
2226
+ break $l$block;
2227
+ }
2228
+ }
2229
+ tmp$ret$0 = null;
2230
+ }
2231
+ var tmp0_safe_receiver = tmp$ret$0;
2232
+ var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.k2(term.h2());
2233
+ var tmp_1;
2234
+ if (tmp1_elvis_lhs == null) {
2235
+ throw Companion_instance_8.forSourceSink(_this__u8e3s4.context, term);
2236
+ } else {
2237
+ tmp_1 = tmp1_elvis_lhs;
2238
+ }
2239
+ tmp_0 = tmp_1;
2240
+ } else {
2241
+ if (Companion_getInstance_1().n2l(_this__u8e3s4, term, _get_OUTPUT_STREAM_TERM_PATTERN__4vocxf(this))) {
2242
+ var tmp2_elvis_lhs = firstOrNull(_this__u8e3s4.context.m1y().findByTerm(term));
2243
+ var tmp_2;
2244
+ if (tmp2_elvis_lhs == null) {
2245
+ throw Companion_instance_8.forStream(_this__u8e3s4.context, term);
2246
+ } else {
2247
+ tmp_2 = tmp2_elvis_lhs;
2248
+ }
2249
+ tmp_0 = tmp_2;
2250
+ } else {
2251
+ if (Companion_getInstance_1().n2l(_this__u8e3s4, term, _get_INPUT_STREAM_TERM_PATTERN__5fd8p6(this))) {
2252
+ var tmp3_elvis_lhs = firstOrNull(_this__u8e3s4.context.l1y().findByTerm(term));
2253
+ var tmp_3;
2254
+ if (tmp3_elvis_lhs == null) {
2255
+ throw Companion_instance_8.forStream(_this__u8e3s4.context, term);
2256
+ } else {
2257
+ tmp_3 = tmp3_elvis_lhs;
2258
+ }
2259
+ tmp_0 = tmp_3;
2260
+ } else {
2261
+ throw Companion_instance_6.t28(_this__u8e3s4.context, _this__u8e3s4.signature, Expected_STREAM_OR_ALIAS_getInstance(), term, index);
2262
+ }
2263
+ }
2264
+ }
2265
+ return tmp_0;
2266
+ };
2267
+ protoOf(IOPrimitiveUtils).h3w = function (_this__u8e3s4, index) {
2268
+ var channel = this.m3w(_this__u8e3s4, index);
2269
+ var tmp;
2270
+ if (isInterface(channel, InputChannel)) {
2271
+ tmp = channel;
2272
+ } else {
2273
+ throw Companion_instance_6.t28(_this__u8e3s4.context, _this__u8e3s4.signature, Expected_STREAM_TYPE_getInstance(), _this__u8e3s4.arguments.s(index), index);
2274
+ }
2275
+ return tmp;
2276
+ };
2277
+ protoOf(IOPrimitiveUtils).d3x = function (_this__u8e3s4, index) {
2278
+ var channel = this.m3w(_this__u8e3s4, index);
2279
+ var tmp;
2280
+ if (isInterface(channel, OutputChannel)) {
2281
+ tmp = channel;
2282
+ } else {
2283
+ throw Companion_instance_6.t28(_this__u8e3s4.context, _this__u8e3s4.signature, Expected_STREAM_TYPE_getInstance(), _this__u8e3s4.arguments.s(index), index);
2284
+ }
2285
+ return tmp;
2286
+ };
2287
+ protoOf(IOPrimitiveUtils).t3y = function (_this__u8e3s4, channel, term, formatter) {
2288
+ var tmp;
2289
+ try {
2290
+ channel.write(format(term, formatter));
2291
+ tmp = _this__u8e3s4.replySuccess(VOID, VOID, []);
2292
+ } catch ($p) {
2293
+ var tmp_0;
2294
+ if ($p instanceof IllegalStateException) {
2295
+ var _unused_var__etf5q3 = $p;
2296
+ tmp_0 = _this__u8e3s4.replyFail(VOID, []);
2297
+ } else {
2298
+ throw $p;
2299
+ }
2300
+ tmp = tmp_0;
2301
+ }
2302
+ return tmp;
2303
+ };
2304
+ protoOf(IOPrimitiveUtils).u3y = function (_this__u8e3s4, channel, arg) {
2305
+ var tmp;
2306
+ try {
2307
+ channel.write(toString_0(arg.m11().toChar()));
2308
+ tmp = _this__u8e3s4.replySuccess(VOID, VOID, []);
2309
+ } catch ($p) {
2310
+ var tmp_0;
2311
+ if ($p instanceof IllegalStateException) {
2312
+ var _unused_var__etf5q3 = $p;
2313
+ tmp_0 = _this__u8e3s4.replyFail(VOID, []);
2314
+ } else {
2315
+ throw $p;
2316
+ }
2317
+ tmp = tmp_0;
2318
+ }
2319
+ return tmp;
2320
+ };
2321
+ protoOf(IOPrimitiveUtils).v3y = function (_this__u8e3s4, channel, arg) {
2322
+ var tmp;
2323
+ try {
2324
+ channel.write(arg.h2());
2325
+ tmp = _this__u8e3s4.replySuccess(VOID, VOID, []);
2326
+ } catch ($p) {
2327
+ var tmp_0;
2328
+ if ($p instanceof IllegalStateException) {
2329
+ var _unused_var__etf5q3 = $p;
2330
+ tmp_0 = _this__u8e3s4.replyFail(VOID, []);
2331
+ } else {
2332
+ throw $p;
2333
+ }
2334
+ tmp = tmp_0;
2335
+ }
2336
+ return tmp;
2337
+ };
2338
+ protoOf(IOPrimitiveUtils).w3y = function (_this__u8e3s4, channel, arg) {
2339
+ var tmp;
2340
+ try {
2341
+ var tmp0_safe_receiver = channel.peek();
2342
+ var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : charCodeAt(tmp0_safe_receiver, 0);
2343
+ var tmp_0;
2344
+ var tmp_1 = tmp1_safe_receiver;
2345
+ if ((tmp_1 == null ? null : new Char(tmp_1)) == null) {
2346
+ tmp_0 = null;
2347
+ } else {
2348
+ // Inline function 'kotlin.code' call
2349
+ tmp_0 = Char__toInt_impl_vasixd(tmp1_safe_receiver);
2350
+ }
2351
+ var tmp2_elvis_lhs = tmp_0;
2352
+ var code = tmp2_elvis_lhs == null ? -1 : tmp2_elvis_lhs;
2353
+ tmp = _this__u8e3s4.replyWith(Companion_getInstance_1().m2l(_this__u8e3s4, arg, Companion_getInstance_6().ofInt(code)), VOID, []);
2354
+ } catch ($p) {
2355
+ var tmp_2;
2356
+ if ($p instanceof IllegalStateException) {
2357
+ var _unused_var__etf5q3 = $p;
2358
+ tmp_2 = _this__u8e3s4.replyFail(VOID, []);
2359
+ } else {
2360
+ throw $p;
2361
+ }
2362
+ tmp = tmp_2;
2363
+ }
2364
+ return tmp;
2365
+ };
2366
+ protoOf(IOPrimitiveUtils).x3y = function (_this__u8e3s4, channel, arg) {
2367
+ var tmp;
2368
+ try {
2369
+ var tmp0_elvis_lhs = channel.peek();
2370
+ var char = tmp0_elvis_lhs == null ? 'end_of_file' : tmp0_elvis_lhs;
2371
+ tmp = _this__u8e3s4.replyWith(Companion_getInstance_1().m2l(_this__u8e3s4, arg, Companion_getInstance_0().of(char)), VOID, []);
2372
+ } catch ($p) {
2373
+ var tmp_0;
2374
+ if ($p instanceof IllegalStateException) {
2375
+ var _unused_var__etf5q3 = $p;
2376
+ tmp_0 = _this__u8e3s4.replyFail(VOID, []);
2377
+ } else {
2378
+ throw $p;
2379
+ }
2380
+ tmp = tmp_0;
2381
+ }
2382
+ return tmp;
2383
+ };
2384
+ protoOf(IOPrimitiveUtils).r3x = function (_this__u8e3s4, channel, arg) {
2385
+ var tmp;
2386
+ try {
2387
+ var tmp0_safe_receiver = channel.read();
2388
+ var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : charCodeAt(tmp0_safe_receiver, 0);
2389
+ var tmp_0;
2390
+ var tmp_1 = tmp1_safe_receiver;
2391
+ if ((tmp_1 == null ? null : new Char(tmp_1)) == null) {
2392
+ tmp_0 = null;
2393
+ } else {
2394
+ // Inline function 'kotlin.code' call
2395
+ tmp_0 = Char__toInt_impl_vasixd(tmp1_safe_receiver);
2396
+ }
2397
+ var tmp2_elvis_lhs = tmp_0;
2398
+ var code = tmp2_elvis_lhs == null ? -1 : tmp2_elvis_lhs;
2399
+ tmp = _this__u8e3s4.replyWith(Companion_getInstance_1().m2l(_this__u8e3s4, arg, Companion_getInstance_6().ofInt(code)), VOID, []);
2400
+ } catch ($p) {
2401
+ var tmp_2;
2402
+ if ($p instanceof IllegalStateException) {
2403
+ var _unused_var__etf5q3 = $p;
2404
+ tmp_2 = _this__u8e3s4.replyFail(VOID, []);
2405
+ } else {
2406
+ throw $p;
2407
+ }
2408
+ tmp = tmp_2;
2409
+ }
2410
+ return tmp;
2411
+ };
2412
+ protoOf(IOPrimitiveUtils).l3x = function (_this__u8e3s4, channel, arg) {
2413
+ var tmp;
2414
+ try {
2415
+ var tmp0_elvis_lhs = channel.read();
2416
+ var char = tmp0_elvis_lhs == null ? 'end_of_file' : tmp0_elvis_lhs;
2417
+ tmp = _this__u8e3s4.replyWith(Companion_getInstance_1().m2l(_this__u8e3s4, arg, Companion_getInstance_0().of(char)), VOID, []);
2418
+ } catch ($p) {
2419
+ var tmp_0;
2420
+ if ($p instanceof IllegalStateException) {
2421
+ var _unused_var__etf5q3 = $p;
2422
+ tmp_0 = _this__u8e3s4.replyFail(VOID, []);
2423
+ } else {
2424
+ throw $p;
2425
+ }
2426
+ tmp = tmp_0;
2427
+ }
2428
+ return tmp;
2429
+ };
2430
+ protoOf(IOPrimitiveUtils).y3y = function (_this__u8e3s4, channel, arg, lastIsInfoList) {
2431
+ try {
2432
+ var termsChannel = asTermChannel(channel, _this__u8e3s4.context.q1y());
2433
+ var tmp;
2434
+ if (lastIsInfoList) {
2435
+ tmp = this.o3y(_this__u8e3s4, get_lastIndex(_this__u8e3s4.arguments));
2436
+ } else {
2437
+ tmp = emptyList();
2438
+ }
2439
+ var infoList = tmp;
2440
+ if (!termsChannel.p22())
2441
+ return _this__u8e3s4.replyFail(VOID, []);
2442
+ var read = termsChannel.read();
2443
+ var tmp_0;
2444
+ if (read == null) {
2445
+ tmp_0 = _this__u8e3s4.replyFail(VOID, []);
2446
+ } else {
2447
+ var variables_0 = variables(this, toList_0(read.gx()));
2448
+ var variableNames_0 = variableNames(this, toAssignments_0(this, read.gx()));
2449
+ var singletons_0 = singletons(this, toAssignments(this, _get_singletons__bihqrn(this, read)));
2450
+ var tmp_1;
2451
+ if (infoList == null) {
2452
+ tmp_1 = null;
2453
+ } else {
2454
+ // Inline function 'kotlin.let' call
2455
+ var u = _this__u8e3s4.context.i1o();
2456
+ tmp_1 = getInfo(IOPrimitiveUtils_getInstance(), infoList, u, _get_INFO_SINGLETONS_PATTERN__y21s87(IOPrimitiveUtils_getInstance()), singletons_0).plus(getInfo(IOPrimitiveUtils_getInstance(), infoList, u, _get_INFO_VARIABLES_PATTERN__bhp1h0(IOPrimitiveUtils_getInstance()), variables_0)).plus(getInfo(IOPrimitiveUtils_getInstance(), infoList, u, _get_INFO_VARIABLE_NAMES_PATTERN__j3oaom(IOPrimitiveUtils_getInstance()), variableNames_0));
2457
+ }
2458
+ var tmp1_elvis_lhs = tmp_1;
2459
+ var info = tmp1_elvis_lhs == null ? Companion_getInstance_1().m2l(_this__u8e3s4, last(_this__u8e3s4.arguments), Companion_instance_4.of([variables_0, variableNames_0, singletons_0])) : tmp1_elvis_lhs;
2460
+ tmp_0 = _this__u8e3s4.replyWith(Companion_getInstance_1().m2l(_this__u8e3s4, arg, read).plus(info), VOID, []);
2461
+ }
2462
+ return tmp_0;
2463
+ } catch ($p) {
2464
+ if ($p instanceof IllegalStateException) {
2465
+ var e = $p;
2466
+ throw Companion_instance_2.forUncaughtKtException(_this__u8e3s4.context, e);
2467
+ } else {
2468
+ if ($p instanceof ParseException) {
2469
+ var e_0 = $p;
2470
+ var tmp_2 = Companion_instance_10;
2471
+ var tmp_3 = channel.m22().toString();
2472
+ var tmp_4 = e_0.line;
2473
+ var tmp_5 = e_0.column;
2474
+ var tmp2_elvis_lhs = e_0.message;
2475
+ throw tmp_2.whileParsingTerm(_this__u8e3s4.context, tmp_3, tmp_4, tmp_5, tmp2_elvis_lhs == null ? '<no details provided>' : tmp2_elvis_lhs);
2476
+ } else {
2477
+ throw $p;
2478
+ }
2479
+ }
2480
+ }
2481
+ };
2482
+ protoOf(IOPrimitiveUtils).z3y = function (_this__u8e3s4, channel, arg, lastIsInfoList, $super) {
2483
+ lastIsInfoList = lastIsInfoList === VOID ? false : lastIsInfoList;
2484
+ return $super === VOID ? this.y3y(_this__u8e3s4, channel, arg, lastIsInfoList) : $super.y3y.call(this, _this__u8e3s4, channel, arg, lastIsInfoList);
2485
+ };
2486
+ protoOf(IOPrimitiveUtils).a3z = function (_this__u8e3s4, third) {
2487
+ var url = this.r3y(_this__u8e3s4, 0);
2488
+ var mode = this.s3y(_this__u8e3s4, 1);
2489
+ Companion_getInstance_1().z2l(_this__u8e3s4, 2);
2490
+ var tmp;
2491
+ if (_this__u8e3s4.arguments.t() >= 4) {
2492
+ Companion_getInstance_1().g2m(_this__u8e3s4, 3);
2493
+ var tmp_0 = _this__u8e3s4.arguments.s(3);
2494
+ var tmp_1 = (isInterface(tmp_0, List) ? tmp_0 : THROW_CCE()).iv();
2495
+ var tmp_2 = map(tmp_1, IOPrimitiveUtils$open$lambda(_this__u8e3s4));
2496
+ tmp = toSet(map(tmp_2, IOPrimitiveUtils$open$lambda_0(_this__u8e3s4)));
2497
+ } else {
2498
+ tmp = emptySet();
2499
+ }
2500
+ var options = tmp;
2501
+ var tmp$ret$0;
2502
+ $l$block: {
2503
+ // Inline function 'kotlin.collections.firstOrNull' call
2504
+ var _iterator__ex2g4s = options.n();
2505
+ while (_iterator__ex2g4s.q()) {
2506
+ var element = _iterator__ex2g4s.r();
2507
+ if (Companion_getInstance_1().n2l(_this__u8e3s4, _get_PROPERTY_ALIAS_PATTERN__wipd2s(IOPrimitiveUtils_getInstance()), element)) {
2508
+ tmp$ret$0 = element;
2509
+ break $l$block;
2510
+ }
2511
+ }
2512
+ tmp$ret$0 = null;
2513
+ }
2514
+ var tmp0_safe_receiver = tmp$ret$0;
2515
+ var alias = tmp0_safe_receiver == null ? null : _get_alias__jw26bj(this, tmp0_safe_receiver);
2516
+ var tmp_3;
2517
+ try {
2518
+ var tmp_4;
2519
+ switch (mode.o2_1) {
2520
+ case 0:
2521
+ tmp_4 = replyOpeningStream_0(this, _this__u8e3s4, openInputChannel(url), third, alias);
2522
+ break;
2523
+ case 1:
2524
+ tmp_4 = replyOpeningStream(this, _this__u8e3s4, openOutputChannel(url, false), third, alias);
2525
+ break;
2526
+ case 2:
2527
+ tmp_4 = replyOpeningStream(this, _this__u8e3s4, openOutputChannel(url, true), third, alias);
2528
+ break;
2529
+ default:
2530
+ noWhenBranchMatchedException();
2531
+ break;
2532
+ }
2533
+ tmp_3 = tmp_4;
2534
+ } catch ($p) {
2535
+ var tmp_5;
2536
+ if ($p instanceof IOException_0) {
2537
+ var e = $p;
2538
+ var tmp_6;
2539
+ var tmp_7 = e.cause;
2540
+ if (tmp_7 instanceof FileNotFoundException) {
2541
+ tmp_6 = ExistenceError_init_$Create$(e.message, e, _this__u8e3s4.context, ObjectType_SOURCE_SINK_getInstance(), _this__u8e3s4.arguments.s(0));
2542
+ } else {
2543
+ tmp_6 = e.h3v(_this__u8e3s4.context);
2544
+ }
2545
+ throw tmp_6;
2546
+ } else {
2547
+ throw $p;
2548
+ }
2549
+ }
2550
+ return tmp_3;
2551
+ };
2552
+ var IOPrimitiveUtils_instance;
2553
+ function IOPrimitiveUtils_getInstance() {
2554
+ if (IOPrimitiveUtils_instance == null)
2555
+ new IOPrimitiveUtils();
2556
+ return IOPrimitiveUtils_instance;
2557
+ }
2558
+ function Nl1() {
2559
+ Nl1_instance = this;
2560
+ NonBacktrackable_0.call(this, 'nl');
2561
+ this.c3z_1 = '`nl(+Stream)`\n\nWrites a newline character to the output stream `Stream`, succeeding deterministically (`nl/0`, writing to the current output, is provided by `prolog.lang`). `Stream` must be an alias (e.g. `user_output`) or a `$stream(out, Id)` term denoting an open stream: an unbound `Stream` raises an instantiation error, an unknown one an existence error, and an input stream a domain error (`stream_type`), where ISO prescribes a permission error. It fails, instead of raising an error, if the underlying channel has been closed.\n\n**Examples**\n\n```prolog\n?- write(user_output, hello), nl(user_output).\n% prints: hello, then a newline\nyes.\n\n?- nl(user_input).\nthrows error(domain_error(stream_type, user_input), _).\n\n?- nl(S).\nthrows error(instantiation_error, _).\n```';
2562
+ }
2563
+ protoOf(Nl1).w1x = function () {
2564
+ return this.c3z_1;
2565
+ };
2566
+ protoOf(Nl1).i2u = function (_this__u8e3s4, first) {
2567
+ var channel = IOPrimitiveUtils_getInstance().d3x(_this__u8e3s4, 0);
2568
+ var tmp;
2569
+ try {
2570
+ channel.write('\n');
2571
+ tmp = _this__u8e3s4.replySuccess(VOID, VOID, []);
2572
+ } catch ($p) {
2573
+ var tmp_0;
2574
+ if ($p instanceof IllegalStateException) {
2575
+ var _unused_var__etf5q3 = $p;
2576
+ tmp_0 = _this__u8e3s4.replyFail(VOID, []);
2577
+ } else {
2578
+ throw $p;
2579
+ }
2580
+ tmp = tmp_0;
2581
+ }
2582
+ return tmp;
2583
+ };
2584
+ protoOf(Nl1).a2o = function (_this__u8e3s4, first) {
2585
+ return this.i2u(_this__u8e3s4, first);
2586
+ };
2587
+ var Nl1_instance;
2588
+ function Nl1_getInstance() {
2589
+ if (Nl1_instance == null)
2590
+ new Nl1();
2591
+ return Nl1_instance;
2592
+ }
2593
+ function Open3() {
2594
+ Open3_instance = this;
2595
+ NonBacktrackable_1.call(this, 'open');
2596
+ this.e3z_1 = "`open(+SourceSink, +Mode, -Stream)`\n\nOpens `SourceSink`, an atom holding a URL or a plain file path, in `Mode` (`read`, `write` or `append`), registers the new stream under an auto-generated alias, and unifies `Stream` with its `$stream(Direction, Id)` term; it behaves as `open/4` with an empty options list. Any URL readable by the platform (e.g. files or `http(s)`) can be opened for reading, but the current implementation can only write or append to local files on the JVM, and never on JS. It raises an instantiation error if `SourceSink` or `Mode` is unbound, a domain error (`source_sink`) if `SourceSink` is not a valid URL or path, a type or domain error (`io_mode`) if `Mode` is not one of the allowed atoms, a type error (`variable`) if `Stream` is bound (ISO prescribes an uninstantiation error), an existence error (`source_sink`) if the resource does not exist, and a system error if it cannot be opened for any other reason.\n\n**Examples**\n\n```prolog\n% with /path/to/data.pl containing `hello(world).`\n?- open('/path/to/data.pl', read, S), read(S, T), close(S).\nT = hello(world).\n\n?- open(F, read, S).\nthrows error(instantiation_error, _).\n\n?- open('/path/to/data.pl', update, S).\nthrows error(domain_error(io_mode, update), _).\n\n?- open('/path/to/data.pl', read, foo).\nthrows error(type_error(variable, foo), _).\n```";
2597
+ }
2598
+ protoOf(Open3).w1x = function () {
2599
+ return this.e3z_1;
2600
+ };
2601
+ protoOf(Open3).t2z = function (_this__u8e3s4, first, second, third) {
2602
+ return IOPrimitiveUtils_getInstance().a3z(_this__u8e3s4, third);
2603
+ };
2604
+ protoOf(Open3).t2n = function (_this__u8e3s4, first, second, third) {
2605
+ return this.t2z(_this__u8e3s4, first, second, third);
2606
+ };
2607
+ var Open3_instance;
2608
+ function Open3_getInstance() {
2609
+ if (Open3_instance == null)
2610
+ new Open3();
2611
+ return Open3_instance;
2612
+ }
2613
+ function Open4() {
2614
+ Open4_instance = this;
2615
+ NonBacktrackable_2.call(this, 'open');
2616
+ this.g3z_1 = "`open(+SourceSink, +Mode, -Stream, +Options)`\n\nLike `open/3`, opens `SourceSink` (a URL or file path atom) in `Mode` (`read`, `write` or `append`) and unifies `Stream` with the new `$stream(Direction, Id)` term, but also takes a list of `Options`. In the current implementation only `alias(Name)` has an effect, registering the stream under `Name` instead of an auto-generated alias; `input`, `output`, `type(text)`, `eof_action(eof_code)` and `reposition(false)` are accepted and ignored, other values of `type/1`, `eof_action/1` and `reposition/1` (e.g. `type(binary)`) raise a system error, and any other element raises a domain error (`stream_property`). `Options` must be a list (type error otherwise, even when unbound), and all other arguments are checked and raise errors exactly as for `open/3`.\n\n**Examples**\n\n```prolog\n?- open('/path/to/out.txt', write, _, [alias(out)]), write(out, hello), close(out).\nyes.\n\n?- open('/path/to/out.txt', write, S, [type(binary)]).\nthrows error(system_error, _).\n\n?- open('/path/to/out.txt', write, S, [foo]).\nthrows error(domain_error(stream_property, foo), _).\n```";
2617
+ }
2618
+ protoOf(Open4).w1x = function () {
2619
+ return this.g3z_1;
2620
+ };
2621
+ protoOf(Open4).h3z = function (_this__u8e3s4, first, second, third, fourth) {
2622
+ return IOPrimitiveUtils_getInstance().a3z(_this__u8e3s4, third);
2623
+ };
2624
+ protoOf(Open4).q2m = function (_this__u8e3s4, first, second, third, fourth) {
2625
+ return this.h3z(_this__u8e3s4, first, second, third, fourth);
2626
+ };
2627
+ var Open4_instance;
2628
+ function Open4_getInstance() {
2629
+ if (Open4_instance == null)
2630
+ new Open4();
2631
+ return Open4_instance;
2632
+ }
2633
+ function PeekByte1() {
2634
+ PeekByte1_instance = this;
2635
+ NonBacktrackable_0.call(this, 'peek_byte');
2636
+ this.j3z_1 = '`peek_byte(?Byte)`\n\nRegistered for ISO conformance only: the current implementation supports text streams exclusively, so every call raises a system error regardless of its arguments; use `peek_code/1` instead.\n\n**Examples**\n\n```prolog\n?- peek_byte(B).\nthrows error(system_error, _).\n```';
2637
+ }
2638
+ protoOf(PeekByte1).w1x = function () {
2639
+ return this.j3z_1;
2640
+ };
2641
+ protoOf(PeekByte1).i2u = function (_this__u8e3s4, first) {
2642
+ return Companion_getInstance_1().u2l(_this__u8e3s4);
2643
+ };
2644
+ protoOf(PeekByte1).a2o = function (_this__u8e3s4, first) {
2645
+ return this.i2u(_this__u8e3s4, first);
2646
+ };
2647
+ var PeekByte1_instance;
2648
+ function PeekByte1_getInstance() {
2649
+ if (PeekByte1_instance == null)
2650
+ new PeekByte1();
2651
+ return PeekByte1_instance;
2652
+ }
2653
+ function PeekByte2() {
2654
+ PeekByte2_instance = this;
2655
+ NonBacktrackable.call(this, 'peek_byte');
2656
+ this.l3z_1 = '`peek_byte(+Stream, ?Byte)`\n\nRegistered for ISO conformance only: the current implementation supports text streams exclusively, so every call raises a system error regardless of its arguments; use `peek_code/2` instead.\n\n**Examples**\n\n```prolog\n?- peek_byte(user_input, B).\nthrows error(system_error, _).\n```';
2657
+ }
2658
+ protoOf(PeekByte2).w1x = function () {
2659
+ return this.l3z_1;
2660
+ };
2661
+ protoOf(PeekByte2).z2u = function (_this__u8e3s4, first, second) {
2662
+ return Companion_getInstance_1().u2l(_this__u8e3s4);
2663
+ };
2664
+ protoOf(PeekByte2).r2k = function (_this__u8e3s4, first, second) {
2665
+ return this.z2u(_this__u8e3s4, first, second);
2666
+ };
2667
+ var PeekByte2_instance;
2668
+ function PeekByte2_getInstance() {
2669
+ if (PeekByte2_instance == null)
2670
+ new PeekByte2();
2671
+ return PeekByte2_instance;
2672
+ }
2673
+ function PeekChar1() {
2674
+ PeekChar1_instance = this;
2675
+ NonBacktrackable_0.call(this, 'peek_char');
2676
+ this.n3z_1 = '`peek_char(?Char)`\n\nUnifies `Char` with the next character of the current input stream (standard input, unless changed via `set_input/1`) without consuming it, or with `end_of_file` at the end of the stream. It is deterministic. `Char` must be unbound, `end_of_file`, or a one-character atom, otherwise a type error (`in_character`) is raised. It fails, instead of raising an error, if the underlying channel has been closed.\n\n**Examples**\n\n```prolog\n?- peek_char(ab).\nthrows error(type_error(in_character, ab), _).\n```';
2677
+ }
2678
+ protoOf(PeekChar1).w1x = function () {
2679
+ return this.n3z_1;
2680
+ };
2681
+ protoOf(PeekChar1).i2u = function (_this__u8e3s4, first) {
2682
+ IOPrimitiveUtils_getInstance().k3x(_this__u8e3s4, 0);
2683
+ return IOPrimitiveUtils_getInstance().x3y(_this__u8e3s4, IOPrimitiveUtils_getInstance().d3w(_this__u8e3s4), first);
2684
+ };
2685
+ protoOf(PeekChar1).a2o = function (_this__u8e3s4, first) {
2686
+ return this.i2u(_this__u8e3s4, first);
2687
+ };
2688
+ var PeekChar1_instance;
2689
+ function PeekChar1_getInstance() {
2690
+ if (PeekChar1_instance == null)
2691
+ new PeekChar1();
2692
+ return PeekChar1_instance;
2693
+ }
2694
+ function PeekChar2() {
2695
+ PeekChar2_instance = this;
2696
+ NonBacktrackable.call(this, 'peek_char');
2697
+ this.p3z_1 = '`peek_char(+Stream, ?Char)`\n\nUnifies `Char` with the next character of the input stream `Stream` without consuming it, or with `end_of_file` at the end of the stream. `Stream` must be an alias (e.g. `user_input`) or a `$stream(in, Id)` term denoting an open stream: an unbound `Stream` raises an instantiation error, an unknown one an existence error, and an output stream a domain error (`stream_type`), where ISO prescribes a permission error. `Char` must be unbound, `end_of_file`, or a one-character atom, otherwise a type error (`in_character`) is raised. It fails, instead of raising an error, if the underlying channel has been closed.\n\n**Examples**\n\n```prolog\n?- peek_char(user_input, ab).\nthrows error(type_error(in_character, ab), _).\n\n?- peek_char(S, C).\nthrows error(instantiation_error, _).\n\n?- peek_char(user_output, C).\nthrows error(domain_error(stream_type, user_output), _).\n```';
2698
+ }
2699
+ protoOf(PeekChar2).w1x = function () {
2700
+ return this.p3z_1;
2701
+ };
2702
+ protoOf(PeekChar2).z2u = function (_this__u8e3s4, first, second) {
2703
+ var channel = IOPrimitiveUtils_getInstance().h3w(_this__u8e3s4, 0);
2704
+ IOPrimitiveUtils_getInstance().k3x(_this__u8e3s4, 1);
2705
+ return IOPrimitiveUtils_getInstance().x3y(_this__u8e3s4, channel, second);
2706
+ };
2707
+ protoOf(PeekChar2).r2k = function (_this__u8e3s4, first, second) {
2708
+ return this.z2u(_this__u8e3s4, first, second);
2709
+ };
2710
+ var PeekChar2_instance;
2711
+ function PeekChar2_getInstance() {
2712
+ if (PeekChar2_instance == null)
2713
+ new PeekChar2();
2714
+ return PeekChar2_instance;
2715
+ }
2716
+ function PeekCode1() {
2717
+ PeekCode1_instance = this;
2718
+ NonBacktrackable_0.call(this, 'peek_code');
2719
+ this.r3z_1 = '`peek_code(?Code)`\n\nUnifies `Code` with the code of the next character of the current input stream (standard input, unless changed via `set_input/1`) without consuming it, or with `-1` at the end of the stream. It is deterministic. `Code` must be unbound or an integer (type error otherwise) within the character-code range or `-1` (representation error otherwise). It fails, instead of raising an error, if the underlying channel has been closed.\n\n**Examples**\n\n```prolog\n?- peek_code(a).\nthrows error(type_error(integer, a), _).\n\n?- peek_code(-2).\nthrows error(representation_error(character_code), _).\n```';
2720
+ }
2721
+ protoOf(PeekCode1).w1x = function () {
2722
+ return this.r3z_1;
2723
+ };
2724
+ protoOf(PeekCode1).i2u = function (_this__u8e3s4, first) {
2725
+ IOPrimitiveUtils_getInstance().q3x(_this__u8e3s4, 0);
2726
+ return IOPrimitiveUtils_getInstance().w3y(_this__u8e3s4, IOPrimitiveUtils_getInstance().d3w(_this__u8e3s4), first);
2727
+ };
2728
+ protoOf(PeekCode1).a2o = function (_this__u8e3s4, first) {
2729
+ return this.i2u(_this__u8e3s4, first);
2730
+ };
2731
+ var PeekCode1_instance;
2732
+ function PeekCode1_getInstance() {
2733
+ if (PeekCode1_instance == null)
2734
+ new PeekCode1();
2735
+ return PeekCode1_instance;
2736
+ }
2737
+ function PeekCode2() {
2738
+ PeekCode2_instance = this;
2739
+ NonBacktrackable.call(this, 'peek_code');
2740
+ this.t3z_1 = '`peek_code(+Stream, ?Code)`\n\nUnifies `Code` with the code of the next character of the input stream `Stream` without consuming it, or with `-1` at the end of the stream. `Stream` must be an alias (e.g. `user_input`) or a `$stream(in, Id)` term denoting an open stream: an unbound `Stream` raises an instantiation error, an unknown one an existence error, and an output stream a domain error (`stream_type`), where ISO prescribes a permission error. `Code` must be unbound or an integer (type error otherwise) within the character-code range or `-1` (representation error otherwise). It fails, instead of raising an error, if the underlying channel has been closed.\n\n**Examples**\n\n```prolog\n?- peek_code(user_input, a).\nthrows error(type_error(integer, a), _).\n\n?- peek_code(S, C).\nthrows error(instantiation_error, _).\n\n?- peek_code(user_output, C).\nthrows error(domain_error(stream_type, user_output), _).\n```';
2741
+ }
2742
+ protoOf(PeekCode2).w1x = function () {
2743
+ return this.t3z_1;
2744
+ };
2745
+ protoOf(PeekCode2).z2u = function (_this__u8e3s4, first, second) {
2746
+ var channel = IOPrimitiveUtils_getInstance().h3w(_this__u8e3s4, 0);
2747
+ IOPrimitiveUtils_getInstance().q3x(_this__u8e3s4, 1);
2748
+ return IOPrimitiveUtils_getInstance().w3y(_this__u8e3s4, channel, second);
2749
+ };
2750
+ protoOf(PeekCode2).r2k = function (_this__u8e3s4, first, second) {
2751
+ return this.z2u(_this__u8e3s4, first, second);
2752
+ };
2753
+ var PeekCode2_instance;
2754
+ function PeekCode2_getInstance() {
2755
+ if (PeekCode2_instance == null)
2756
+ new PeekCode2();
2757
+ return PeekCode2_instance;
2758
+ }
2759
+ function PutByte1() {
2760
+ PutByte1_instance = this;
2761
+ NonBacktrackable_0.call(this, 'put_byte');
2762
+ this.v3z_1 = '`put_byte(+Byte)`\n\nRegistered for ISO conformance only: the current implementation supports text streams exclusively, so every call raises a system error regardless of its arguments; use `put_code/1` instead.\n\n**Examples**\n\n```prolog\n?- put_byte(65).\nthrows error(system_error, _).\n```';
2763
+ }
2764
+ protoOf(PutByte1).w1x = function () {
2765
+ return this.v3z_1;
2766
+ };
2767
+ protoOf(PutByte1).i2u = function (_this__u8e3s4, first) {
2768
+ return Companion_getInstance_1().u2l(_this__u8e3s4);
2769
+ };
2770
+ protoOf(PutByte1).a2o = function (_this__u8e3s4, first) {
2771
+ return this.i2u(_this__u8e3s4, first);
2772
+ };
2773
+ var PutByte1_instance;
2774
+ function PutByte1_getInstance() {
2775
+ if (PutByte1_instance == null)
2776
+ new PutByte1();
2777
+ return PutByte1_instance;
2778
+ }
2779
+ function PutByte2() {
2780
+ PutByte2_instance = this;
2781
+ NonBacktrackable.call(this, 'put_byte');
2782
+ this.x3z_1 = '`put_byte(+Stream, +Byte)`\n\nRegistered for ISO conformance only: the current implementation supports text streams exclusively, so every call raises a system error regardless of its arguments; use `put_code/2` instead.\n\n**Examples**\n\n```prolog\n?- put_byte(user_output, 65).\nthrows error(system_error, _).\n```';
2783
+ }
2784
+ protoOf(PutByte2).w1x = function () {
2785
+ return this.x3z_1;
2786
+ };
2787
+ protoOf(PutByte2).z2u = function (_this__u8e3s4, first, second) {
2788
+ return Companion_getInstance_1().u2l(_this__u8e3s4);
2789
+ };
2790
+ protoOf(PutByte2).r2k = function (_this__u8e3s4, first, second) {
2791
+ return this.z2u(_this__u8e3s4, first, second);
2792
+ };
2793
+ var PutByte2_instance;
2794
+ function PutByte2_getInstance() {
2795
+ if (PutByte2_instance == null)
2796
+ new PutByte2();
2797
+ return PutByte2_instance;
2798
+ }
2799
+ function PutChar1() {
2800
+ PutChar1_instance = this;
2801
+ NonBacktrackable_0.call(this, 'put_char');
2802
+ this.z3z_1 = '`put_char(+Char)`\n\nWrites the character `Char` to the current output stream (standard output, unless changed via `set_output/1`), succeeding deterministically. `Char` must be a one-character atom, otherwise a type error (`character`) is raised; the current implementation raises that type error even when `Char` is unbound, where ISO prescribes an instantiation error. It fails, instead of raising an error, if the underlying channel has been closed.\n\n**Examples**\n\n```prolog\n?- put_char(a).\n% prints: a\nyes.\n\n?- put_char(ab).\nthrows error(type_error(character, ab), _).\n\n?- put_char(C).\nthrows error(type_error(character, _), _).\n```';
2803
+ }
2804
+ protoOf(PutChar1).w1x = function () {
2805
+ return this.z3z_1;
2806
+ };
2807
+ protoOf(PutChar1).i2u = function (_this__u8e3s4, first) {
2808
+ Companion_getInstance_1().d2m(_this__u8e3s4, 0);
2809
+ var tmp = IOPrimitiveUtils_getInstance();
2810
+ var tmp_0 = IOPrimitiveUtils_getInstance().k3y(_this__u8e3s4);
2811
+ return tmp.v3y(_this__u8e3s4, tmp_0, isInterface(first, Atom) ? first : THROW_CCE());
2812
+ };
2813
+ protoOf(PutChar1).a2o = function (_this__u8e3s4, first) {
2814
+ return this.i2u(_this__u8e3s4, first);
2815
+ };
2816
+ var PutChar1_instance;
2817
+ function PutChar1_getInstance() {
2818
+ if (PutChar1_instance == null)
2819
+ new PutChar1();
2820
+ return PutChar1_instance;
2821
+ }
2822
+ function PutChar2() {
2823
+ PutChar2_instance = this;
2824
+ NonBacktrackable.call(this, 'put_char');
2825
+ this.b40_1 = '`put_char(+Stream, +Char)`\n\nWrites the character `Char` to the output stream `Stream`, succeeding deterministically. `Stream` must be an alias (e.g. `user_output`) or a `$stream(out, Id)` term denoting an open stream: an unbound `Stream` raises an instantiation error, an unknown one an existence error, and an input stream a domain error (`stream_type`), where ISO prescribes a permission error. `Char` must be a one-character atom, otherwise (even when unbound) a type error (`character`) is raised. It fails, instead of raising an error, if the underlying channel has been closed.\n\n**Examples**\n\n```prolog\n?- put_char(user_output, a).\n% prints: a\nyes.\n\n?- put_char(user_output, ab).\nthrows error(type_error(character, ab), _).\n\n?- put_char(user_input, a).\nthrows error(domain_error(stream_type, user_input), _).\n```';
2826
+ }
2827
+ protoOf(PutChar2).w1x = function () {
2828
+ return this.b40_1;
2829
+ };
2830
+ protoOf(PutChar2).z2u = function (_this__u8e3s4, first, second) {
2831
+ var channel = IOPrimitiveUtils_getInstance().d3x(_this__u8e3s4, 0);
2832
+ Companion_getInstance_1().d2m(_this__u8e3s4, 1);
2833
+ var tmp = IOPrimitiveUtils_getInstance();
2834
+ return tmp.v3y(_this__u8e3s4, channel, isInterface(second, Atom) ? second : THROW_CCE());
2835
+ };
2836
+ protoOf(PutChar2).r2k = function (_this__u8e3s4, first, second) {
2837
+ return this.z2u(_this__u8e3s4, first, second);
2838
+ };
2839
+ var PutChar2_instance;
2840
+ function PutChar2_getInstance() {
2841
+ if (PutChar2_instance == null)
2842
+ new PutChar2();
2843
+ return PutChar2_instance;
2844
+ }
2845
+ function PutCode1() {
2846
+ PutCode1_instance = this;
2847
+ NonBacktrackable_0.call(this, 'put_code');
2848
+ this.d40_1 = '`put_code(+Code)`\n\nWrites the character whose code is `Code` to the current output stream (standard output, unless changed via `set_output/1`), succeeding deterministically. `Code` must be an integer, otherwise (even when unbound, where ISO prescribes an instantiation error) a type error (`integer`) is raised, and a valid character code, otherwise a representation error (`character_code`) is raised. It fails, instead of raising an error, if the underlying channel has been closed.\n\n**Examples**\n\n```prolog\n?- put_code(97).\n% prints: a\nyes.\n\n?- put_code(a).\nthrows error(type_error(integer, a), _).\n\n?- put_code(-1).\nthrows error(representation_error(character_code), _).\n```';
2849
+ }
2850
+ protoOf(PutCode1).w1x = function () {
2851
+ return this.d40_1;
2852
+ };
2853
+ protoOf(PutCode1).i2u = function (_this__u8e3s4, first) {
2854
+ Companion_getInstance_1().m2m(_this__u8e3s4, 0);
2855
+ var tmp = IOPrimitiveUtils_getInstance();
2856
+ var tmp_0 = IOPrimitiveUtils_getInstance().k3y(_this__u8e3s4);
2857
+ return tmp.u3y(_this__u8e3s4, tmp_0, isInterface(first, Integer) ? first : THROW_CCE());
2858
+ };
2859
+ protoOf(PutCode1).a2o = function (_this__u8e3s4, first) {
2860
+ return this.i2u(_this__u8e3s4, first);
2861
+ };
2862
+ var PutCode1_instance;
2863
+ function PutCode1_getInstance() {
2864
+ if (PutCode1_instance == null)
2865
+ new PutCode1();
2866
+ return PutCode1_instance;
2867
+ }
2868
+ function PutCode2() {
2869
+ PutCode2_instance = this;
2870
+ NonBacktrackable.call(this, 'put_code');
2871
+ this.f40_1 = '`put_code(+Stream, +Code)`\n\nWrites the character whose code is `Code` to the output stream `Stream`, succeeding deterministically. `Stream` must be an alias (e.g. `user_output`) or a `$stream(out, Id)` term denoting an open stream: an unbound `Stream` raises an instantiation error, an unknown one an existence error, and an input stream a domain error (`stream_type`), where ISO prescribes a permission error. `Code` must be an integer (type error otherwise, even when unbound) and a valid character code (representation error otherwise). It fails, instead of raising an error, if the underlying channel has been closed.\n\n**Examples**\n\n```prolog\n?- put_code(user_output, 97).\n% prints: a\nyes.\n\n?- put_code(user_output, C).\nthrows error(type_error(integer, _), _).\n\n?- put_code(user_input, 97).\nthrows error(domain_error(stream_type, user_input), _).\n```';
2872
+ }
2873
+ protoOf(PutCode2).w1x = function () {
2874
+ return this.f40_1;
2875
+ };
2876
+ protoOf(PutCode2).z2u = function (_this__u8e3s4, first, second) {
2877
+ var channel = IOPrimitiveUtils_getInstance().d3x(_this__u8e3s4, 0);
2878
+ Companion_getInstance_1().m2m(_this__u8e3s4, 1);
2879
+ var tmp = IOPrimitiveUtils_getInstance();
2880
+ return tmp.u3y(_this__u8e3s4, channel, isInterface(second, Integer) ? second : THROW_CCE());
2881
+ };
2882
+ protoOf(PutCode2).r2k = function (_this__u8e3s4, first, second) {
2883
+ return this.z2u(_this__u8e3s4, first, second);
2884
+ };
2885
+ var PutCode2_instance;
2886
+ function PutCode2_getInstance() {
2887
+ if (PutCode2_instance == null)
2888
+ new PutCode2();
2889
+ return PutCode2_instance;
2890
+ }
2891
+ function Read1() {
2892
+ Read1_instance = this;
2893
+ NonBacktrackable_0.call(this, 'read');
2894
+ this.h40_1 = '`read(?Term)`\n\nReads the next term, terminated by a full stop, from the current input stream (standard input, unless changed via `set_input/1`) and unifies it with `Term`, using the current operators. It is deterministic. Deviating from ISO, the current implementation fails, instead of unifying `Term` with `end_of_file`, when no more terms are available; it raises a syntax error if the next term is malformed and a system error if the channel is closed or cannot be read term by term.\n\n**Examples**\n\n```prolog\n% with `foo(X, bar).` to be read from standard input\n?- read(T).\nT = foo(_, bar).\n\n% once standard input has been exhausted\n?- read(T).\nno.\n```';
2895
+ }
2896
+ protoOf(Read1).w1x = function () {
2897
+ return this.h40_1;
2898
+ };
2899
+ protoOf(Read1).i2u = function (_this__u8e3s4, first) {
2900
+ return IOPrimitiveUtils_getInstance().z3y(_this__u8e3s4, IOPrimitiveUtils_getInstance().d3w(_this__u8e3s4), first);
2901
+ };
2902
+ protoOf(Read1).a2o = function (_this__u8e3s4, first) {
2903
+ return this.i2u(_this__u8e3s4, first);
2904
+ };
2905
+ var Read1_instance;
2906
+ function Read1_getInstance() {
2907
+ if (Read1_instance == null)
2908
+ new Read1();
2909
+ return Read1_instance;
2910
+ }
2911
+ function Read2() {
2912
+ Read2_instance = this;
2913
+ NonBacktrackable.call(this, 'read');
2914
+ this.j40_1 = '`read(+Stream, ?Term)`\n\nReads the next term, terminated by a full stop, from the input stream `Stream` and unifies it with `Term`, using the current operators. `Stream` must be an alias (e.g. `user_input`) or a `$stream(in, Id)` term denoting an open stream: an unbound `Stream` raises an instantiation error, an unknown one an existence error, and an output stream a domain error (`stream_type`), where ISO prescribes a permission error. Deviating from ISO, the current implementation fails, instead of unifying `Term` with `end_of_file`, when no more terms are available; it raises a syntax error if the next term is malformed and a system error if the channel is closed or cannot be read term by term.\n\n**Examples**\n\n```prolog\n?- read(S, T).\nthrows error(instantiation_error, _).\n\n?- read(user_output, T).\nthrows error(domain_error(stream_type, user_output), _).\n\n?- read(no_such_stream, T).\nthrows error(existence_error(source_sink, no_such_stream), _).\n```';
2915
+ }
2916
+ protoOf(Read2).w1x = function () {
2917
+ return this.j40_1;
2918
+ };
2919
+ protoOf(Read2).z2u = function (_this__u8e3s4, first, second) {
2920
+ var channel = IOPrimitiveUtils_getInstance().h3w(_this__u8e3s4, 0);
2921
+ return IOPrimitiveUtils_getInstance().z3y(_this__u8e3s4, channel, second);
2922
+ };
2923
+ protoOf(Read2).r2k = function (_this__u8e3s4, first, second) {
2924
+ return this.z2u(_this__u8e3s4, first, second);
2925
+ };
2926
+ var Read2_instance;
2927
+ function Read2_getInstance() {
2928
+ if (Read2_instance == null)
2929
+ new Read2();
2930
+ return Read2_instance;
2931
+ }
2932
+ function ReadTerm2() {
2933
+ ReadTerm2_instance = this;
2934
+ NonBacktrackable.call(this, 'read_term');
2935
+ this.l40_1 = "`read_term(?Term, ?Options)`\n\nReads the next term from the current input stream (standard input, unless changed via `set_input/1`) like `read/1`, and unifies the elements of the `Options` list with information about the term's variables. Each element of `Options` may be `variables(Vars)` (the variables of the term, in order of appearance), `variable_names(Names)` (a list of `'Name' = Var` pairs) or `singletons(Names)` (the same, for variables occurring once); other elements raise a domain error (`read_option`). Deviating from ISO, an unbound `Options` is not an error: it is unified with `[variables(Vars), variable_names(Names), singletons(Singletons)]`. Deviating from ISO, the current implementation fails, instead of unifying `Term` with `end_of_file`, when no more terms are available; it raises a syntax error if the next term is malformed and a system error if the channel is closed or cannot be read term by term.\n\n**Examples**\n\n```prolog\n?- read_term(T, [foo]).\nthrows error(domain_error(read_option, foo), _).\n\n?- read_term(T, foo).\nthrows error(type_error(list, foo), _).\n```";
2936
+ }
2937
+ protoOf(ReadTerm2).w1x = function () {
2938
+ return this.l40_1;
2939
+ };
2940
+ protoOf(ReadTerm2).z2u = function (_this__u8e3s4, first, second) {
2941
+ return IOPrimitiveUtils_getInstance().y3y(_this__u8e3s4, IOPrimitiveUtils_getInstance().d3w(_this__u8e3s4), first, true);
2942
+ };
2943
+ protoOf(ReadTerm2).r2k = function (_this__u8e3s4, first, second) {
2944
+ return this.z2u(_this__u8e3s4, first, second);
2945
+ };
2946
+ var ReadTerm2_instance;
2947
+ function ReadTerm2_getInstance() {
2948
+ if (ReadTerm2_instance == null)
2949
+ new ReadTerm2();
2950
+ return ReadTerm2_instance;
2951
+ }
2952
+ function ReadTerm3() {
2953
+ ReadTerm3_instance = this;
2954
+ NonBacktrackable_1.call(this, 'read_term');
2955
+ this.n40_1 = "`read_term(+Stream, ?Term, ?Options)`\n\nReads the next term from the input stream `Stream` like `read/2`, and unifies the elements of the `Options` list with information about the term's variables. `Stream` must be an alias (e.g. `user_input`) or a `$stream(in, Id)` term denoting an open stream: an unbound `Stream` raises an instantiation error, an unknown one an existence error, and an output stream a domain error (`stream_type`), where ISO prescribes a permission error. Each element of `Options` may be `variables(Vars)` (the variables of the term, in order of appearance), `variable_names(Names)` (a list of `'Name' = Var` pairs) or `singletons(Names)` (the same, for variables occurring once); other elements raise a domain error (`read_option`). Deviating from ISO, an unbound `Options` is not an error: it is unified with `[variables(Vars), variable_names(Names), singletons(Singletons)]`. Deviating from ISO, the current implementation fails, instead of unifying `Term` with `end_of_file`, when no more terms are available; it raises a syntax error if the next term is malformed and a system error if the channel is closed or cannot be read term by term.\n\n**Examples**\n\n```prolog\n?- read_term(user_input, T, [foo]).\nthrows error(domain_error(read_option, foo), _).\n\n?- read_term(S, T, []).\nthrows error(instantiation_error, _).\n\n?- read_term(user_output, T, []).\nthrows error(domain_error(stream_type, user_output), _).\n```";
2956
+ }
2957
+ protoOf(ReadTerm3).w1x = function () {
2958
+ return this.n40_1;
2959
+ };
2960
+ protoOf(ReadTerm3).t2z = function (_this__u8e3s4, first, second, third) {
2961
+ var channel = IOPrimitiveUtils_getInstance().h3w(_this__u8e3s4, 0);
2962
+ return IOPrimitiveUtils_getInstance().y3y(_this__u8e3s4, channel, second, true);
2963
+ };
2964
+ protoOf(ReadTerm3).t2n = function (_this__u8e3s4, first, second, third) {
2965
+ return this.t2z(_this__u8e3s4, first, second, third);
2966
+ };
2967
+ var ReadTerm3_instance;
2968
+ function ReadTerm3_getInstance() {
2969
+ if (ReadTerm3_instance == null)
2970
+ new ReadTerm3();
2971
+ return ReadTerm3_instance;
2972
+ }
2973
+ function SetInput$computeOne$lambda($this_computeOne, $channel) {
2974
+ return function ($this$replySuccess) {
2975
+ $this$replySuccess.d2r($this_computeOne.context.l1y().setCurrentChannel($channel));
2976
+ return Unit_instance;
2977
+ };
2978
+ }
2979
+ function SetInput() {
2980
+ SetInput_instance = this;
2981
+ NonBacktrackable_0.call(this, 'set_input');
2982
+ this.p40_1 = '`set_input(+Stream)`\n\nMakes the input stream `Stream` the current input stream, i.e. the one used by the predicates without an explicit stream argument (e.g. `get_char/1`, `read/1`), succeeding deterministically. `Stream` must be an alias (e.g. `user_input`) or a `$stream(in, Id)` term denoting an open stream: an unbound `Stream` raises an instantiation error, an unknown one an existence error, and an output stream a domain error (`stream_type`), where ISO prescribes a permission error.\n\n**Examples**\n\n```prolog\n?- set_input(user_input), current_input(S), stream_property(S, alias(user_input)).\nyes.\n\n?- set_input(user_output).\nthrows error(domain_error(stream_type, user_output), _).\n\n?- set_input(S).\nthrows error(instantiation_error, _).\n```';
2983
+ }
2984
+ protoOf(SetInput).w1x = function () {
2985
+ return this.p40_1;
2986
+ };
2987
+ protoOf(SetInput).i2u = function (_this__u8e3s4, first) {
2988
+ var channel = IOPrimitiveUtils_getInstance().h3w(_this__u8e3s4, 0);
2989
+ return _this__u8e3s4.replySuccessBuildingSideEffects(VOID, VOID, SetInput$computeOne$lambda(_this__u8e3s4, channel));
2990
+ };
2991
+ protoOf(SetInput).a2o = function (_this__u8e3s4, first) {
2992
+ return this.i2u(_this__u8e3s4, first);
2993
+ };
2994
+ var SetInput_instance;
2995
+ function SetInput_getInstance() {
2996
+ if (SetInput_instance == null)
2997
+ new SetInput();
2998
+ return SetInput_instance;
2999
+ }
3000
+ function SetOutput$computeOne$lambda($this_computeOne, $channel) {
3001
+ return function ($this$replySuccess) {
3002
+ $this$replySuccess.g2r($this_computeOne.context.m1y().setCurrentChannel($channel));
3003
+ return Unit_instance;
3004
+ };
3005
+ }
3006
+ function SetOutput() {
3007
+ SetOutput_instance = this;
3008
+ NonBacktrackable_0.call(this, 'set_output');
3009
+ this.r40_1 = '`set_output(+Stream)`\n\nMakes the output stream `Stream` the current output stream, i.e. the one used by the predicates without an explicit stream argument (e.g. `put_char/1`, `write/1`), succeeding deterministically. `Stream` must be an alias (e.g. `user_output`) or a `$stream(out, Id)` term denoting an open stream: an unbound `Stream` raises an instantiation error, an unknown one an existence error, and an input stream a domain error (`stream_type`), where ISO prescribes a permission error.\n\n**Examples**\n\n```prolog\n?- set_output(user_output), put_char(a).\n% prints: a\nyes.\n\n?- set_output(user_input).\nthrows error(domain_error(stream_type, user_input), _).\n\n?- set_output(S).\nthrows error(instantiation_error, _).\n```';
3010
+ }
3011
+ protoOf(SetOutput).w1x = function () {
3012
+ return this.r40_1;
3013
+ };
3014
+ protoOf(SetOutput).i2u = function (_this__u8e3s4, first) {
3015
+ var channel = IOPrimitiveUtils_getInstance().d3x(_this__u8e3s4, 0);
3016
+ return _this__u8e3s4.replySuccessBuildingSideEffects(VOID, VOID, SetOutput$computeOne$lambda(_this__u8e3s4, channel));
3017
+ };
3018
+ protoOf(SetOutput).a2o = function (_this__u8e3s4, first) {
3019
+ return this.i2u(_this__u8e3s4, first);
3020
+ };
3021
+ var SetOutput_instance;
3022
+ function SetOutput_getInstance() {
3023
+ if (SetOutput_instance == null)
3024
+ new SetOutput();
3025
+ return SetOutput_instance;
3026
+ }
3027
+ function SetTheory$setTheory$lambda($append, $solver) {
3028
+ return function ($this$replySuccess) {
3029
+ if ($append) {
3030
+ $this$replySuccess.t2q($solver.j1y());
3031
+ $this$replySuccess.w2q($solver.k1y());
3032
+ } else {
3033
+ $this$replySuccess.r2q($solver.j1y());
3034
+ $this$replySuccess.u2q($solver.k1y());
3035
+ }
3036
+ $this$replySuccess.b2r($solver.q1y());
3037
+ $this$replySuccess.a2r($solver.i1y());
3038
+ return Unit_instance;
3039
+ };
3040
+ }
3041
+ function SetTheory() {
3042
+ SetTheory_instance = this;
3043
+ NonBacktrackable_0.call(this, 'set_theory');
3044
+ this.s3w_1 = "`set_theory(+Text)`\n\nParses the atom `Text` as Prolog source code, using the current operators, and makes the resulting theory the new knowledge base: both the static and the dynamic knowledge bases are replaced (clauses of predicates declared dynamic go to the dynamic one), and operators and flags set by its directives take effect. This predicate is tuProlog-specific; see `consult/1` to add clauses loaded from a file or URL instead. It raises a type error (`atom`) if `Text` is not an atom (including when it is unbound, where an instantiation error would be customary) and a syntax error if `Text` is not a well-formed theory.\n\n**Examples**\n\n```prolog\n?- set_theory('parent(tom, bob). parent(bob, ann).'), parent(bob, X).\nX = ann.\n\n?- set_theory(42).\nthrows error(type_error(atom, 42), _).\n\n?- set_theory('foo(.').\nthrows error(syntax_error, _).\n```";
3045
+ }
3046
+ protoOf(SetTheory).w1x = function () {
3047
+ return this.s3w_1;
3048
+ };
3049
+ protoOf(SetTheory).i2u = function (_this__u8e3s4, first) {
3050
+ Companion_getInstance_1().b2m(_this__u8e3s4, 0);
3051
+ return this.s40(_this__u8e3s4, first.yx().h2(), false);
3052
+ };
3053
+ protoOf(SetTheory).a2o = function (_this__u8e3s4, first) {
3054
+ return this.i2u(_this__u8e3s4, first);
3055
+ };
3056
+ protoOf(SetTheory).s40 = function (_this__u8e3s4, text, append) {
3057
+ try {
3058
+ var theory = Companion_instance_11.withOperatorSet(_this__u8e3s4.context.q1y()).parseTheoryWithDefaultUnificator(text);
3059
+ var solver = _this__u8e3s4.context.createMutableSolver(VOID, VOID, VOID, Companion_instance_12.empty(_this__u8e3s4.context.i1o()), Companion_instance_13.empty(_this__u8e3s4.context.i1o()));
3060
+ solver.loadStaticKb(theory);
3061
+ return _this__u8e3s4.replySuccessBuildingSideEffects(VOID, VOID, SetTheory$setTheory$lambda(append, solver));
3062
+ } catch ($p) {
3063
+ if ($p instanceof ParseException) {
3064
+ var e = $p;
3065
+ var tmp = Companion_instance_10;
3066
+ var tmp_0 = e.clauseIndex;
3067
+ var tmp_1 = e.line;
3068
+ var tmp_2 = e.column;
3069
+ var tmp0_safe_receiver = e.message;
3070
+ var tmp_3;
3071
+ if (tmp0_safe_receiver == null) {
3072
+ tmp_3 = null;
3073
+ } else {
3074
+ // Inline function 'kotlin.text.replaceFirstChar' call
3075
+ var tmp_4;
3076
+ // Inline function 'kotlin.text.isNotEmpty' call
3077
+ if (charSequenceLength(tmp0_safe_receiver) > 0) {
3078
+ var it = charCodeAt(tmp0_safe_receiver, 0);
3079
+ var tmp$ret$2 = isLowerCase(it) ? titlecase(it) : toString_0(it);
3080
+ tmp_4 = toString(tmp$ret$2) + substring(tmp0_safe_receiver, 1);
3081
+ } else {
3082
+ tmp_4 = tmp0_safe_receiver;
3083
+ }
3084
+ tmp_3 = tmp_4;
3085
+ }
3086
+ var tmp1_elvis_lhs = tmp_3;
3087
+ throw tmp.whileParsingClauses(_this__u8e3s4.context, text, tmp_0, tmp_1, tmp_2, tmp1_elvis_lhs == null ? '<no detail provided>' : tmp1_elvis_lhs);
3088
+ } else {
3089
+ throw $p;
3090
+ }
3091
+ }
3092
+ };
3093
+ protoOf(SetTheory).t3w = function (_this__u8e3s4, text, append, $super) {
3094
+ append = append === VOID ? true : append;
3095
+ return $super === VOID ? this.s40(_this__u8e3s4, text, append) : $super.s40.call(this, _this__u8e3s4, text, append);
3096
+ };
3097
+ var SetTheory_instance;
3098
+ function SetTheory_getInstance() {
3099
+ if (SetTheory_instance == null)
3100
+ new SetTheory();
3101
+ return SetTheory_instance;
3102
+ }
3103
+ function StreamProperty$computeAll$lambda(it) {
3104
+ return asSequence(it.m2());
3105
+ }
3106
+ function StreamProperty$computeAll$lambda_0($this_computeAll) {
3107
+ return function (it) {
3108
+ return to(it.m22(), IOPrimitiveUtils_getInstance().j3y($this_computeAll, it));
3109
+ };
3110
+ }
3111
+ function StreamProperty$computeAll$lambda_1(_destruct__k2r9zo) {
3112
+ var streamTerm = _destruct__k2r9zo.he();
3113
+ var properties = _destruct__k2r9zo.ie();
3114
+ return map(properties, StreamProperty$computeAll$lambda$lambda(streamTerm));
3115
+ }
3116
+ function StreamProperty$computeAll$lambda$lambda($streamTerm) {
3117
+ return function (it) {
3118
+ return to($streamTerm, it);
3119
+ };
3120
+ }
3121
+ function StreamProperty$computeAll$lambda_2($this_computeAll, $first, $second) {
3122
+ return function (_destruct__k2r9zo) {
3123
+ var streamTerm = _destruct__k2r9zo.he();
3124
+ var property = _destruct__k2r9zo.ie();
3125
+ return Companion_getInstance_1().m2l($this_computeAll, $first, streamTerm).plus(Companion_getInstance_1().m2l($this_computeAll, $second, property));
3126
+ };
3127
+ }
3128
+ function StreamProperty$computeAll$lambda_3(it) {
3129
+ return it.i13();
3130
+ }
3131
+ function StreamProperty$computeAll$lambda_4($this_computeAll) {
3132
+ return function (it) {
3133
+ return $this_computeAll.replyWith(it, VOID, []);
3134
+ };
3135
+ }
3136
+ function StreamProperty() {
3137
+ StreamProperty_instance = this;
3138
+ BinaryRelation.call(this, 'stream_property');
3139
+ this.u40_1 = '`stream_property(?Stream, ?Property)`\n\nEnumerates, on backtracking, every open stream `Stream` (as a `$stream(Direction, Id)` term) together with each `Property` holding for it; the current implementation reports `input` or `output`, one `alias(Name)` per alias of the stream, and `type(text)`. If `Stream` is bound it must be a stream term (aliases are not accepted), otherwise a domain error (`stream_or_alias`) is raised, or an existence error if it denotes no open stream. If `Property` is bound it must be `input`, `output` or `alias(Name)`, otherwise a domain error (`stream_property`) is raised, so the reported `type(text)` property cannot be queried directly.\n\n**Examples**\n\n```prolog\n?- stream_property(S, alias(user_output)), stream_property(S, output).\nyes.\n\n?- stream_property(S, type(text)).\nthrows error(domain_error(stream_property, type(text)), _).\n\n?- stream_property(user_output, P).\nthrows error(domain_error(stream_or_alias, user_output), _).\n```';
3140
+ }
3141
+ protoOf(StreamProperty).w1x = function () {
3142
+ return this.u40_1;
3143
+ };
3144
+ protoOf(StreamProperty).v2u = function (_this__u8e3s4, first, second) {
3145
+ IOPrimitiveUtils_getInstance().y3w(_this__u8e3s4, 0);
3146
+ IOPrimitiveUtils_getInstance().q3y(_this__u8e3s4, 1);
3147
+ var tmp = sequenceOf([_this__u8e3s4.context.l1y(), _this__u8e3s4.context.m1y()]);
3148
+ var tmp_0 = distinct(flatMap(tmp, StreamProperty$computeAll$lambda));
3149
+ var tmp_1 = map(tmp_0, StreamProperty$computeAll$lambda_0(_this__u8e3s4));
3150
+ var tmp_2 = flatMap(tmp_1, StreamProperty$computeAll$lambda_1);
3151
+ var tmp_3 = map(tmp_2, StreamProperty$computeAll$lambda_2(_this__u8e3s4, first, second));
3152
+ var tmp_4 = filter(tmp_3, StreamProperty$computeAll$lambda_3);
3153
+ return map(tmp_4, StreamProperty$computeAll$lambda_4(_this__u8e3s4));
3154
+ };
3155
+ protoOf(StreamProperty).t2k = function (_this__u8e3s4, first, second) {
3156
+ return this.v2u(_this__u8e3s4, first, second);
3157
+ };
3158
+ var StreamProperty_instance;
3159
+ function StreamProperty_getInstance() {
3160
+ if (StreamProperty_instance == null)
3161
+ new StreamProperty();
3162
+ return StreamProperty_instance;
3163
+ }
3164
+ function Write2() {
3165
+ Write2_instance = this;
3166
+ NonBacktrackable.call(this, 'write');
3167
+ this.w40_1 = "`write(+Stream, @Term)`\n\nWrites `Term` to the output stream `Stream` as `write/1` does: unquoted, using the current operators, and writing `'$VAR'(N)` terms as variable letters. It succeeds deterministically. `Stream` must be an alias (e.g. `user_output`) or a `$stream(out, Id)` term denoting an open stream: an unbound `Stream` raises an instantiation error, an unknown one an existence error, and an input stream a domain error (`stream_type`), where ISO prescribes a permission error. It fails, instead of raising an error, if the underlying channel has been closed.\n\n**Examples**\n\n```prolog\n?- write(user_output, 'hello world').\n% prints: hello world\nyes.\n\n?- write(user_output, f('A', 1 + 2, '$VAR'(27))).\n% prints: f(A, 1 + 2, B1)\nyes.\n\n?- write(user_input, hello).\nthrows error(domain_error(stream_type, user_input), _).\n```";
3168
+ }
3169
+ protoOf(Write2).w1x = function () {
3170
+ return this.w40_1;
3171
+ };
3172
+ protoOf(Write2).z2u = function (_this__u8e3s4, first, second) {
3173
+ var channel = IOPrimitiveUtils_getInstance().d3x(_this__u8e3s4, 0);
3174
+ return IOPrimitiveUtils_getInstance().t3y(_this__u8e3s4, channel, second, Companion_instance_7.default(_this__u8e3s4.context.q1y()));
3175
+ };
3176
+ protoOf(Write2).r2k = function (_this__u8e3s4, first, second) {
3177
+ return this.z2u(_this__u8e3s4, first, second);
3178
+ };
3179
+ var Write2_instance;
3180
+ function Write2_getInstance() {
3181
+ if (Write2_instance == null)
3182
+ new Write2();
3183
+ return Write2_instance;
3184
+ }
3185
+ function WriteCanonical1() {
3186
+ WriteCanonical1_instance = this;
3187
+ NonBacktrackable_0.call(this, 'write_canonical');
3188
+ this.y40_1 = "`write_canonical(@Term)`\n\nWrites `Term` to the current output stream (standard output, unless changed via `set_output/1`) in canonical form: atoms and functors are quoted where needed, operators are written in functional notation, and `'$VAR'(N)` terms are written as-is. It succeeds deterministically. It fails, instead of raising an error, if the underlying channel has been closed.\n\n**Examples**\n\n```prolog\n?- write_canonical(f('A', 1 + 2, '$VAR'(27))).\n% prints: f('A', '+'(1, 2), '$VAR'(27))\nyes.\n```";
3189
+ }
3190
+ protoOf(WriteCanonical1).w1x = function () {
3191
+ return this.y40_1;
3192
+ };
3193
+ protoOf(WriteCanonical1).i2u = function (_this__u8e3s4, first) {
3194
+ return IOPrimitiveUtils_getInstance().t3y(_this__u8e3s4, IOPrimitiveUtils_getInstance().k3y(_this__u8e3s4), first, Companion_instance_7.canonical());
3195
+ };
3196
+ protoOf(WriteCanonical1).a2o = function (_this__u8e3s4, first) {
3197
+ return this.i2u(_this__u8e3s4, first);
3198
+ };
3199
+ var WriteCanonical1_instance;
3200
+ function WriteCanonical1_getInstance() {
3201
+ if (WriteCanonical1_instance == null)
3202
+ new WriteCanonical1();
3203
+ return WriteCanonical1_instance;
3204
+ }
3205
+ function WriteCanonical2() {
3206
+ WriteCanonical2_instance = this;
3207
+ NonBacktrackable.call(this, 'write_canonical');
3208
+ this.a41_1 = "`write_canonical(+Stream, @Term)`\n\nWrites `Term` to the output stream `Stream` in canonical form: atoms and functors are quoted where needed, operators are written in functional notation, and `'$VAR'(N)` terms are written as-is. It succeeds deterministically. `Stream` must be an alias (e.g. `user_output`) or a `$stream(out, Id)` term denoting an open stream: an unbound `Stream` raises an instantiation error, an unknown one an existence error, and an input stream a domain error (`stream_type`), where ISO prescribes a permission error. It fails, instead of raising an error, if the underlying channel has been closed.\n\n**Examples**\n\n```prolog\n?- write_canonical(user_output, f('A', 1 + 2)).\n% prints: f('A', '+'(1, 2))\nyes.\n\n?- write_canonical(user_input, a).\nthrows error(domain_error(stream_type, user_input), _).\n```";
3209
+ }
3210
+ protoOf(WriteCanonical2).w1x = function () {
3211
+ return this.a41_1;
3212
+ };
3213
+ protoOf(WriteCanonical2).z2u = function (_this__u8e3s4, first, second) {
3214
+ var channel = IOPrimitiveUtils_getInstance().d3x(_this__u8e3s4, 0);
3215
+ return IOPrimitiveUtils_getInstance().t3y(_this__u8e3s4, channel, second, Companion_instance_7.canonical());
3216
+ };
3217
+ protoOf(WriteCanonical2).r2k = function (_this__u8e3s4, first, second) {
3218
+ return this.z2u(_this__u8e3s4, first, second);
3219
+ };
3220
+ var WriteCanonical2_instance;
3221
+ function WriteCanonical2_getInstance() {
3222
+ if (WriteCanonical2_instance == null)
3223
+ new WriteCanonical2();
3224
+ return WriteCanonical2_instance;
3225
+ }
3226
+ function WriteEq1() {
3227
+ WriteEq1_instance = this;
3228
+ NonBacktrackable_0.call(this, 'writeq');
3229
+ this.c41_1 = "`writeq(@Term)`\n\nWrites `Term` to the current output stream (standard output, unless changed via `set_output/1`) so that it can be read back: atoms and functors are quoted where needed, operators are written in operator notation, and `'$VAR'(N)` terms are written as variable letters. It succeeds deterministically. The current implementation formats operators according to the default operator table rather than the current one. It fails, instead of raising an error, if the underlying channel has been closed.\n\n**Examples**\n\n```prolog\n?- writeq(f('A', 'hello world', 1 + 2, '$VAR'(27))).\n% prints: f('A', 'hello world', 1 + 2, B1)\nyes.\n```";
3230
+ }
3231
+ protoOf(WriteEq1).w1x = function () {
3232
+ return this.c41_1;
3233
+ };
3234
+ protoOf(WriteEq1).i2u = function (_this__u8e3s4, first) {
3235
+ return IOPrimitiveUtils_getInstance().t3y(_this__u8e3s4, IOPrimitiveUtils_getInstance().k3y(_this__u8e3s4), first, Companion_instance_7.readable());
3236
+ };
3237
+ protoOf(WriteEq1).a2o = function (_this__u8e3s4, first) {
3238
+ return this.i2u(_this__u8e3s4, first);
3239
+ };
3240
+ var WriteEq1_instance;
3241
+ function WriteEq1_getInstance() {
3242
+ if (WriteEq1_instance == null)
3243
+ new WriteEq1();
3244
+ return WriteEq1_instance;
3245
+ }
3246
+ function WriteEq2() {
3247
+ WriteEq2_instance = this;
3248
+ NonBacktrackable.call(this, 'writeq');
3249
+ this.e41_1 = "`writeq(+Stream, @Term)`\n\nWrites `Term` to the output stream `Stream` so that it can be read back, quoting atoms and functors where needed and writing `'$VAR'(N)` terms as variable letters; the current implementation formats operators according to the default operator table rather than the current one. It succeeds deterministically. `Stream` must be an alias (e.g. `user_output`) or a `$stream(out, Id)` term denoting an open stream: an unbound `Stream` raises an instantiation error, an unknown one an existence error, and an input stream a domain error (`stream_type`), where ISO prescribes a permission error. It fails, instead of raising an error, if the underlying channel has been closed.\n\n**Examples**\n\n```prolog\n?- writeq(user_output, f('A', 1 + 2)).\n% prints: f('A', 1 + 2)\nyes.\n\n?- writeq(user_input, a).\nthrows error(domain_error(stream_type, user_input), _).\n```";
3250
+ }
3251
+ protoOf(WriteEq2).w1x = function () {
3252
+ return this.e41_1;
3253
+ };
3254
+ protoOf(WriteEq2).z2u = function (_this__u8e3s4, first, second) {
3255
+ var channel = IOPrimitiveUtils_getInstance().d3x(_this__u8e3s4, 0);
3256
+ return IOPrimitiveUtils_getInstance().t3y(_this__u8e3s4, channel, second, Companion_instance_7.readable());
3257
+ };
3258
+ protoOf(WriteEq2).r2k = function (_this__u8e3s4, first, second) {
3259
+ return this.z2u(_this__u8e3s4, first, second);
3260
+ };
3261
+ var WriteEq2_instance;
3262
+ function WriteEq2_getInstance() {
3263
+ if (WriteEq2_instance == null)
3264
+ new WriteEq2();
3265
+ return WriteEq2_instance;
3266
+ }
3267
+ function WriteTerm2() {
3268
+ WriteTerm2_instance = this;
3269
+ NonBacktrackable.call(this, 'write_term');
3270
+ this.g41_1 = "`write_term(@Term, +Options)`\n\nWrites `Term` to the current output stream (standard output, unless changed via `set_output/1`), formatted according to `Options` and the current operators, succeeding deterministically. `Options` must be a list (an unbound `Options` raises a type error (`list`) rather than ISO's instantiation error) whose elements are `quoted(Bool)` (quote atoms and functors where needed), `ignore_ops(Bool)` (write operators in canonical functional notation) and `numbervars(Bool)` (write `'$VAR'(N)` terms as variable letters), with `Bool` being `true` or `false`; missing options default to `false`, and any other element raises a domain error (`write_option`). It fails, instead of raising an error, if the underlying channel has been closed.\n\n**Examples**\n\n```prolog\n?- write_term(f('A', 1 + 2), [quoted(true), ignore_ops(true)]).\n% prints: f('A', '+'(1, 2))\nyes.\n\n?- write_term(f('A', 1 + 2), []).\n% prints: f(A, 1 + 2)\nyes.\n\n?- write_term(a, [foo]).\nthrows error(domain_error(write_option, foo), _).\n\n?- write_term(a, Options).\nthrows error(type_error(list, _), _).\n```";
3271
+ }
3272
+ protoOf(WriteTerm2).w1x = function () {
3273
+ return this.g41_1;
3274
+ };
3275
+ protoOf(WriteTerm2).z2u = function (_this__u8e3s4, first, second) {
3276
+ var formatter = IOPrimitiveUtils_getInstance().p3y(_this__u8e3s4, 1);
3277
+ return IOPrimitiveUtils_getInstance().t3y(_this__u8e3s4, IOPrimitiveUtils_getInstance().k3y(_this__u8e3s4), first, formatter);
3278
+ };
3279
+ protoOf(WriteTerm2).r2k = function (_this__u8e3s4, first, second) {
3280
+ return this.z2u(_this__u8e3s4, first, second);
3281
+ };
3282
+ var WriteTerm2_instance;
3283
+ function WriteTerm2_getInstance() {
3284
+ if (WriteTerm2_instance == null)
3285
+ new WriteTerm2();
3286
+ return WriteTerm2_instance;
3287
+ }
3288
+ function WriteTerm3() {
3289
+ WriteTerm3_instance = this;
3290
+ NonBacktrackable_1.call(this, 'write_term');
3291
+ this.i41_1 = "`write_term(+Stream, @Term, +Options)`\n\nWrites `Term` to the output stream `Stream`, formatted according to `Options` and the current operators, succeeding deterministically. `Stream` must be an alias (e.g. `user_output`) or a `$stream(out, Id)` term denoting an open stream: an unbound `Stream` raises an instantiation error, an unknown one an existence error, and an input stream a domain error (`stream_type`), where ISO prescribes a permission error. `Options` must be a list (an unbound `Options` raises a type error (`list`) rather than ISO's instantiation error) whose elements are `quoted(Bool)` (quote atoms and functors where needed), `ignore_ops(Bool)` (write operators in canonical functional notation) and `numbervars(Bool)` (write `'$VAR'(N)` terms as variable letters), with `Bool` being `true` or `false`; missing options default to `false`, and any other element raises a domain error (`write_option`). It fails, instead of raising an error, if the underlying channel has been closed.\n\n**Examples**\n\n```prolog\n?- write_term(user_output, '$VAR'(27), [numbervars(true)]).\n% prints: B1\nyes.\n\n?- write_term(user_output, a, [quoted(maybe)]).\nthrows error(domain_error(write_option, quoted(maybe)), _).\n\n?- write_term(user_input, a, []).\nthrows error(domain_error(stream_type, user_input), _).\n```";
3292
+ }
3293
+ protoOf(WriteTerm3).w1x = function () {
3294
+ return this.i41_1;
3295
+ };
3296
+ protoOf(WriteTerm3).t2z = function (_this__u8e3s4, first, second, third) {
3297
+ var channel = IOPrimitiveUtils_getInstance().d3x(_this__u8e3s4, 0);
3298
+ var formatter = IOPrimitiveUtils_getInstance().p3y(_this__u8e3s4, 2);
3299
+ return IOPrimitiveUtils_getInstance().t3y(_this__u8e3s4, channel, second, formatter);
3300
+ };
3301
+ protoOf(WriteTerm3).t2n = function (_this__u8e3s4, first, second, third) {
3302
+ return this.t2z(_this__u8e3s4, first, second, third);
3303
+ };
3304
+ var WriteTerm3_instance;
3305
+ function WriteTerm3_getInstance() {
3306
+ if (WriteTerm3_instance == null)
3307
+ new WriteTerm3();
3308
+ return WriteTerm3_instance;
3309
+ }
3310
+ function JsUrl_init_$Init$(url, $this) {
3311
+ JsUrl.call($this);
3312
+ var tmp;
3313
+ try {
3314
+ tmp = new URL(url);
3315
+ } catch ($p) {
3316
+ var tmp_0;
3317
+ if ($p instanceof Error) {
3318
+ var e = $p;
3319
+ throw InvalidUrlException_init_$Create$_0('Invalid URL: ' + url, e);
3320
+ } else {
3321
+ throw $p;
3322
+ }
3323
+ }
3324
+ var parsed = tmp;
3325
+ if (removeSuffix(parsed.protocol, ':').length === 1) {
3326
+ throw InvalidUrlException_init_$Create$('Invalid URL: ' + url);
3327
+ }
3328
+ $this.k41_1 = removeSuffix(parsed.protocol, ':');
3329
+ $this.l41_1 = parsed.hostname;
3330
+ $this.m41_1 = parsed.pathname;
3331
+ $this.n41_1 = toIntOrNull(parsed.port);
3332
+ var tmp_1 = $this;
3333
+ // Inline function 'kotlin.text.ifEmpty' call
3334
+ var this_0 = removePrefix(parsed.search, '?');
3335
+ var tmp_2;
3336
+ // Inline function 'kotlin.text.isEmpty' call
3337
+ if (charSequenceLength(this_0) === 0) {
3338
+ tmp_2 = null;
3339
+ } else {
3340
+ tmp_2 = this_0;
3341
+ }
3342
+ tmp_1.o41_1 = tmp_2;
3343
+ $this.j41_1 = url;
3344
+ return $this;
3345
+ }
3346
+ function JsUrl_init_$Create$(url) {
3347
+ return JsUrl_init_$Init$(url, objectCreate(protoOf(JsUrl)));
3348
+ }
3349
+ function JsUrl_init_$Init$_0(protocol, host, port, path, query, $this) {
3350
+ host = host === VOID ? '' : host;
3351
+ port = port === VOID ? null : port;
3352
+ path = path === VOID ? '' : path;
3353
+ query = query === VOID ? null : query;
3354
+ JsUrl.call($this);
3355
+ $this.k41_1 = protocol;
3356
+ $this.l41_1 = host;
3357
+ $this.n41_1 = port;
3358
+ $this.m41_1 = path;
3359
+ $this.o41_1 = query;
3360
+ $this.j41_1 = Companion_instance_15.n3u(protocol, host, port, path, query);
3361
+ return $this;
3362
+ }
3363
+ function JsUrl_init_$Create$_0(protocol, host, port, path, query) {
3364
+ return JsUrl_init_$Init$_0(protocol, host, port, path, query, objectCreate(protoOf(JsUrl)));
3365
+ }
3366
+ function readLocalFile($this, action) {
3367
+ var tmp;
3368
+ try {
3369
+ // Inline function 'okio.use' call
3370
+ var this_0 = buffer(LocalFileSystem_getInstance().k3c(toLocalPath($this)));
3371
+ var thrown = null;
3372
+ var tmp_0;
3373
+ try {
3374
+ tmp_0 = action(this_0);
3375
+ } catch ($p) {
3376
+ var tmp_1;
3377
+ if ($p instanceof Error) {
3378
+ var t = $p;
3379
+ thrown = t;
3380
+ tmp_1 = null;
3381
+ } else {
3382
+ throw $p;
3383
+ }
3384
+ tmp_0 = tmp_1;
3385
+ }
3386
+ finally {
3387
+ try {
3388
+ if (this_0 == null)
3389
+ null;
3390
+ else {
3391
+ this_0.z22();
3392
+ }
3393
+ } catch ($p_0) {
3394
+ if ($p_0 instanceof Error) {
3395
+ var t_0 = $p_0;
3396
+ if (thrown == null) {
3397
+ thrown = t_0;
3398
+ } else {
3399
+ addSuppressed(thrown, t_0);
3400
+ }
3401
+ } else {
3402
+ throw $p_0;
3403
+ }
3404
+ }
3405
+ }
3406
+ var result = tmp_0;
3407
+ if (!(thrown == null))
3408
+ throw thrown;
3409
+ tmp = result;
3410
+ } catch ($p_1) {
3411
+ var tmp_2;
3412
+ if ($p_1 instanceof IOException) {
3413
+ var e = $p_1;
3414
+ throw IOException_init_$Create$_0(e.message, e);
3415
+ } else {
3416
+ throw $p_1;
3417
+ }
3418
+ }
3419
+ return tmp;
3420
+ }
3421
+ function JsUrl$readAsText$lambda(it) {
3422
+ return it.c3d();
3423
+ }
3424
+ function JsUrl$readAsByteArray$lambda(it) {
3425
+ return it.f3d();
3426
+ }
3427
+ protoOf(JsUrl).o3u = function () {
3428
+ return this.k41_1;
3429
+ };
3430
+ protoOf(JsUrl).p3u = function () {
3431
+ return this.l41_1;
3432
+ };
3433
+ protoOf(JsUrl).q3u = function () {
3434
+ return this.m41_1;
3435
+ };
3436
+ protoOf(JsUrl).r3u = function () {
3437
+ return this.n41_1;
3438
+ };
3439
+ protoOf(JsUrl).w1z = function () {
3440
+ return this.o41_1;
3441
+ };
3442
+ protoOf(JsUrl).p41 = function () {
3443
+ var tmp;
3444
+ if (this.s3u() && get_isNode()) {
3445
+ tmp = readLocalFile(this, JsUrl$readAsText$lambda);
3446
+ } else if (this.s3u()) {
3447
+ tmp = readText(this.m41_1);
3448
+ } else {
3449
+ tmp = fetch(this.j41_1, 'UTF-8');
3450
+ }
3451
+ return tmp;
3452
+ };
3453
+ protoOf(JsUrl).readAsText = function () {
3454
+ return this.p41();
3455
+ };
3456
+ protoOf(JsUrl).q41 = function () {
3457
+ var tmp;
3458
+ if (this.s3u() && get_isNode()) {
3459
+ tmp = readLocalFile(this, JsUrl$readAsByteArray$lambda);
3460
+ } else if (this.s3u()) {
3461
+ tmp = readBin(this.m41_1);
3462
+ } else {
3463
+ tmp = toByteArray(fetch(this.j41_1));
3464
+ }
3465
+ return tmp;
3466
+ };
3467
+ protoOf(JsUrl).readAsByteArray = function () {
3468
+ return this.q41();
3469
+ };
3470
+ protoOf(JsUrl).equals = function (other) {
3471
+ if (this === other)
3472
+ return true;
3473
+ if (other == null || !(this.constructor == other.constructor))
3474
+ return false;
3475
+ if (!(other instanceof JsUrl))
3476
+ THROW_CCE();
3477
+ if (!(this.j41_1 === other.j41_1))
3478
+ return false;
3479
+ return true;
3480
+ };
3481
+ protoOf(JsUrl).hashCode = function () {
3482
+ return getStringHashCode(this.j41_1);
3483
+ };
3484
+ protoOf(JsUrl).toString = function () {
3485
+ return this.j41_1;
3486
+ };
3487
+ function JsUrl() {
3488
+ }
3489
+ function get_REQUEST() {
3490
+ _init_properties_RemoteAndBrowserIO_kt__6j78jn();
3491
+ var tmp0 = REQUEST$delegate;
3492
+ var tmp = KProperty0;
3493
+ // Inline function 'kotlin.getValue' call
3494
+ /* dead property reference removed */
3495
+ return tmp0.h2();
3496
+ }
3497
+ var REQUEST$delegate;
3498
+ function get_isNode() {
3499
+ _init_properties_RemoteAndBrowserIO_kt__6j78jn();
3500
+ return !Info_getInstance().ov().equals(Platform_BROWSER_getInstance());
3501
+ }
3502
+ function readText(path) {
3503
+ _init_properties_RemoteAndBrowserIO_kt__6j78jn();
3504
+ // Inline function 'kotlin.js.unsafeCast' call
3505
+ var tmp0_elvis_lhs = window.localStorage.getItem(path);
3506
+ var tmp;
3507
+ if (tmp0_elvis_lhs == null) {
3508
+ throw IOException_init_$Create$('No such entry in window.localStorage: ' + path);
3509
+ } else {
3510
+ tmp = tmp0_elvis_lhs;
3511
+ }
3512
+ return tmp;
3513
+ }
3514
+ function fetch(url, encoding) {
3515
+ encoding = encoding === VOID ? null : encoding;
3516
+ _init_properties_RemoteAndBrowserIO_kt__6j78jn();
3517
+ try {
3518
+ var response = get_REQUEST()('GET', url, {});
3519
+ // Inline function 'kotlin.js.unsafeCast' call
3520
+ return response.getBody(encoding);
3521
+ } catch ($p) {
3522
+ if ($p instanceof Error) {
3523
+ var e = $p;
3524
+ throw IOException_init_$Create$_0(e.message, e);
3525
+ } else {
3526
+ throw $p;
3527
+ }
3528
+ }
3529
+ }
3530
+ function readBin(path) {
3531
+ _init_properties_RemoteAndBrowserIO_kt__6j78jn();
3532
+ // Inline function 'kotlin.js.unsafeCast' call
3533
+ var tmp0_safe_receiver = window.localStorage.getItem(path);
3534
+ var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : toByteArray(tmp0_safe_receiver);
3535
+ var tmp;
3536
+ if (tmp1_elvis_lhs == null) {
3537
+ throw IOException_init_$Create$('No such entry in window.localStorage: ' + path);
3538
+ } else {
3539
+ tmp = tmp1_elvis_lhs;
3540
+ }
3541
+ return tmp;
3542
+ }
3543
+ function toByteArray(_this__u8e3s4) {
3544
+ _init_properties_RemoteAndBrowserIO_kt__6j78jn();
3545
+ return toByteArray_0(toUInt8Array(_this__u8e3s4));
3546
+ }
3547
+ function toByteArray_0(_this__u8e3s4) {
3548
+ _init_properties_RemoteAndBrowserIO_kt__6j78jn();
3549
+ var tmp = 0;
3550
+ var tmp_0 = _this__u8e3s4.length;
3551
+ var tmp_1 = new Int8Array(tmp_0);
3552
+ while (tmp < tmp_0) {
3553
+ var tmp_2 = tmp;
3554
+ // Inline function 'org.khronos.webgl.get' call
3555
+ // Inline function 'kotlin.js.asDynamic' call
3556
+ tmp_1[tmp_2] = _this__u8e3s4[tmp_2];
3557
+ tmp = tmp + 1 | 0;
3558
+ }
3559
+ return tmp_1;
3560
+ }
3561
+ function toUInt8Array(_this__u8e3s4) {
3562
+ _init_properties_RemoteAndBrowserIO_kt__6j78jn();
3563
+ return new Uint8Array(_this__u8e3s4);
3564
+ }
3565
+ function REQUEST$delegate$lambda() {
3566
+ _init_properties_RemoteAndBrowserIO_kt__6j78jn();
3567
+ return require('sync-request');
3568
+ }
3569
+ function _get_REQUEST_$ref_g5y4c1() {
3570
+ return constructCallableReference(function () {
3571
+ return get_REQUEST();
3572
+ }, 0, 0, 107);
3573
+ }
3574
+ var properties_initialized_RemoteAndBrowserIO_kt_w2uybl;
3575
+ function _init_properties_RemoteAndBrowserIO_kt__6j78jn() {
3576
+ if (!properties_initialized_RemoteAndBrowserIO_kt_w2uybl) {
3577
+ properties_initialized_RemoteAndBrowserIO_kt_w2uybl = true;
3578
+ REQUEST$delegate = lazy(REQUEST$delegate$lambda);
3579
+ }
3580
+ }
3581
+ function get_platformFileSystem() {
3582
+ _init_properties_UrlUtilsJs_kt__dw3tit();
3583
+ return platformFileSystem;
3584
+ }
3585
+ var platformFileSystem;
3586
+ function get_FILE_URL_TO_PATH() {
3587
+ _init_properties_UrlUtilsJs_kt__dw3tit();
3588
+ var tmp0 = FILE_URL_TO_PATH$delegate;
3589
+ var tmp = KProperty0;
3590
+ // Inline function 'kotlin.getValue' call
3591
+ /* dead property reference removed */
3592
+ return tmp0.h2();
3593
+ }
3594
+ var FILE_URL_TO_PATH$delegate;
3595
+ function fileUrl(path) {
3596
+ _init_properties_UrlUtilsJs_kt__dw3tit();
3597
+ return JsUrl_init_$Create$_0('file', VOID, VOID, path);
3598
+ }
3599
+ function remoteUrl(protocol, host, port, path, query) {
3600
+ host = host === VOID ? '' : host;
3601
+ port = port === VOID ? null : port;
3602
+ path = path === VOID ? '' : path;
3603
+ query = query === VOID ? null : query;
3604
+ _init_properties_UrlUtilsJs_kt__dw3tit();
3605
+ return JsUrl_init_$Create$_0(protocol, host, port, path, query);
3606
+ }
3607
+ function parseUrl(string) {
3608
+ _init_properties_UrlUtilsJs_kt__dw3tit();
3609
+ return JsUrl_init_$Create$(string);
3610
+ }
3611
+ function openInputChannel(_this__u8e3s4) {
3612
+ _init_properties_UrlUtilsJs_kt__dw3tit();
3613
+ var tmp;
3614
+ if (_this__u8e3s4.s3u() && get_isNode()) {
3615
+ tmp = wrappingIOException(openInputChannel$lambda(_this__u8e3s4));
3616
+ } else {
3617
+ tmp = Companion_instance.ofString(_this__u8e3s4.readAsText());
3618
+ }
3619
+ return tmp;
3620
+ }
3621
+ function openOutputChannel(_this__u8e3s4, append) {
3622
+ append = append === VOID ? false : append;
3623
+ _init_properties_UrlUtilsJs_kt__dw3tit();
3624
+ if (!_this__u8e3s4.s3u() || !get_isNode()) {
3625
+ throw IOException_init_$Create$('Writing not supported for ' + toString(_this__u8e3s4));
3626
+ }
3627
+ var path = toLocalPath(_this__u8e3s4);
3628
+ return wrappingIOException(openOutputChannel$lambda(append, path));
3629
+ }
3630
+ function toLocalPath(_this__u8e3s4) {
3631
+ _init_properties_UrlUtilsJs_kt__dw3tit();
3632
+ var tmp;
3633
+ try {
3634
+ var tmp_0 = Companion_getInstance_7();
3635
+ var tmp_1 = get_FILE_URL_TO_PATH()(toString(_this__u8e3s4));
3636
+ tmp = tmp_0.i3c((!(tmp_1 == null) ? typeof tmp_1 === 'string' : false) ? tmp_1 : THROW_CCE());
3637
+ } catch ($p) {
3638
+ var tmp_2;
3639
+ if ($p instanceof Error) {
3640
+ var _unused_var__etf5q3 = $p;
3641
+ tmp_2 = Companion_getInstance_7().i3c(_this__u8e3s4.q3u());
3642
+ } else {
3643
+ throw $p;
3644
+ }
3645
+ tmp = tmp_2;
3646
+ }
3647
+ return tmp;
3648
+ }
3649
+ function wrappingIOException(action) {
3650
+ _init_properties_UrlUtilsJs_kt__dw3tit();
3651
+ var tmp;
3652
+ try {
3653
+ tmp = action();
3654
+ } catch ($p) {
3655
+ var tmp_0;
3656
+ if ($p instanceof IOException) {
3657
+ var e = $p;
3658
+ throw IOException_init_$Create$_0(e.message, e);
3659
+ } else {
3660
+ throw $p;
3661
+ }
3662
+ }
3663
+ return tmp;
3664
+ }
3665
+ function FILE_URL_TO_PATH$delegate$lambda() {
3666
+ _init_properties_UrlUtilsJs_kt__dw3tit();
3667
+ return eval('require')('url').fileURLToPath;
3668
+ }
3669
+ function _get_FILE_URL_TO_PATH_$ref_kwvzgc() {
3670
+ return constructCallableReference(function () {
3671
+ return get_FILE_URL_TO_PATH();
3672
+ }, 0, 0, 108);
3673
+ }
3674
+ function openInputChannel$lambda($this_openInputChannel) {
3675
+ return function () {
3676
+ return new SourceInputChannel(buffer(LocalFileSystem_getInstance().k3c(toLocalPath($this_openInputChannel))));
3677
+ };
3678
+ }
3679
+ function openOutputChannel$lambda($append, $path) {
3680
+ return function () {
3681
+ var sink = $append ? LocalFileSystem_getInstance().i3u($path) : LocalFileSystem_getInstance().h3u($path);
3682
+ return new SinkOutputChannel(buffer_0(sink));
3683
+ };
3684
+ }
3685
+ var properties_initialized_UrlUtilsJs_kt_66lob1;
3686
+ function _init_properties_UrlUtilsJs_kt__dw3tit() {
3687
+ if (!properties_initialized_UrlUtilsJs_kt_66lob1) {
3688
+ properties_initialized_UrlUtilsJs_kt_66lob1 = true;
3689
+ platformFileSystem = NodeJsFileSystem_getInstance();
3690
+ FILE_URL_TO_PATH$delegate = lazy(FILE_URL_TO_PATH$delegate$lambda);
3691
+ }
3692
+ }
3693
+ //region block: post-declaration
3694
+ protoOf(JsUrl).resolve = resolve;
3695
+ protoOf(JsUrl).div = div;
3696
+ protoOf(JsUrl).s3u = get_isFile;
3697
+ protoOf(JsUrl).t3u = get_isHttp;
3698
+ //endregion
3699
+ //region block: init
3700
+ Companion_instance_15 = new Companion_0();
3701
+ //endregion
3702
+ //region block: exports
3703
+ _.$_$ = _.$_$ || {};
3704
+ _.$_$.a = IOLib_getInstance;
3705
+ _.$_$.b = Companion_instance_15;
11
3706
  //endregion
12
3707
  return _;
13
3708
  }));