@glandais/vcyclist-engine 1.2.1 → 3.0.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.
@@ -0,0 +1,3636 @@
1
+ (function (factory) {
2
+ if (typeof define === 'function' && define.amd)
3
+ define(['exports', './kotlin-kotlin-stdlib.js', './xmlutil-core.js', './vcyclist-elevation.js'], factory);
4
+ else if (typeof exports === 'object')
5
+ factory(module.exports, require('./kotlin-kotlin-stdlib.js'), require('./xmlutil-core.js'), require('./vcyclist-elevation.js'));
6
+ else {
7
+ if (typeof globalThis['kotlin-kotlin-stdlib'] === 'undefined') {
8
+ throw new Error("Error loading module 'vcyclist-gpx'. Its dependency 'kotlin-kotlin-stdlib' was not found. Please, check whether 'kotlin-kotlin-stdlib' is loaded prior to 'vcyclist-gpx'.");
9
+ }
10
+ if (typeof globalThis['xmlutil-core'] === 'undefined') {
11
+ throw new Error("Error loading module 'vcyclist-gpx'. Its dependency 'xmlutil-core' was not found. Please, check whether 'xmlutil-core' is loaded prior to 'vcyclist-gpx'.");
12
+ }
13
+ if (typeof globalThis['vcyclist-elevation'] === 'undefined') {
14
+ throw new Error("Error loading module 'vcyclist-gpx'. Its dependency 'vcyclist-elevation' was not found. Please, check whether 'vcyclist-elevation' is loaded prior to 'vcyclist-gpx'.");
15
+ }
16
+ globalThis['vcyclist-gpx'] = factory(typeof globalThis['vcyclist-gpx'] === 'undefined' ? {} : globalThis['vcyclist-gpx'], globalThis['kotlin-kotlin-stdlib'], globalThis['xmlutil-core'], globalThis['vcyclist-elevation']);
17
+ }
18
+ }(function (_, kotlin_kotlin, kotlin_io_github_pdvrieze_xmlutil_core, kotlin_io_github_glandais_elevation) {
19
+ 'use strict';
20
+ //region block: imports
21
+ var imul = Math.imul;
22
+ var enumEntries = kotlin_kotlin.$_$.h4;
23
+ var Unit_instance = kotlin_kotlin.$_$.t;
24
+ var Enum = kotlin_kotlin.$_$.z7;
25
+ var protoOf = kotlin_kotlin.$_$.a6;
26
+ var initMetadataForClass = kotlin_kotlin.$_$.l5;
27
+ var VOID = kotlin_kotlin.$_$.a;
28
+ var toString = kotlin_kotlin.$_$.u8;
29
+ var getNumberHashCode = kotlin_kotlin.$_$.h5;
30
+ var getStringHashCode = kotlin_kotlin.$_$.j5;
31
+ var equals = kotlin_kotlin.$_$.f5;
32
+ var emptyList = kotlin_kotlin.$_$.p2;
33
+ var toString_0 = kotlin_kotlin.$_$.c6;
34
+ var hashCode = kotlin_kotlin.$_$.k5;
35
+ var listOf = kotlin_kotlin.$_$.z2;
36
+ var initMetadataForCompanion = kotlin_kotlin.$_$.m5;
37
+ var ArrayList_init_$Create$ = kotlin_kotlin.$_$.x;
38
+ var addAll = kotlin_kotlin.$_$.e2;
39
+ var constructCallableReference = kotlin_kotlin.$_$.d5;
40
+ var lazy = kotlin_kotlin.$_$.q8;
41
+ var KProperty1 = kotlin_kotlin.$_$.r6;
42
+ var getPropertyCallableRef = kotlin_kotlin.$_$.i5;
43
+ var collectionSizeOrDefault = kotlin_kotlin.$_$.j2;
44
+ var ArrayList_init_$Create$_0 = kotlin_kotlin.$_$.w;
45
+ var checkIndexOverflow = kotlin_kotlin.$_$.i2;
46
+ var getOrNull = kotlin_kotlin.$_$.t2;
47
+ var isNaN_0 = kotlin_kotlin.$_$.p8;
48
+ var numberToLong = kotlin_kotlin.$_$.s4;
49
+ var Long = kotlin_kotlin.$_$.d8;
50
+ var compare = kotlin_kotlin.$_$.l4;
51
+ var roundToLong = kotlin_kotlin.$_$.e6;
52
+ var add = kotlin_kotlin.$_$.k4;
53
+ var roundToInt = kotlin_kotlin.$_$.d6;
54
+ var noWhenBranchMatchedException = kotlin_kotlin.$_$.r8;
55
+ var get_xmlStreaming = kotlin_io_github_pdvrieze_xmlutil_core.$_$.d;
56
+ var IllegalArgumentException_init_$Create$ = kotlin_kotlin.$_$.n1;
57
+ var Exception = kotlin_kotlin.$_$.b8;
58
+ var IllegalArgumentException = kotlin_kotlin.$_$.c8;
59
+ var IllegalArgumentException_init_$Create$_0 = kotlin_kotlin.$_$.m1;
60
+ var EventType_START_ELEMENT_getInstance = kotlin_io_github_pdvrieze_xmlutil_core.$_$.a;
61
+ var THROW_CCE = kotlin_kotlin.$_$.i8;
62
+ var isCharSequence = kotlin_kotlin.$_$.s5;
63
+ var trim = kotlin_kotlin.$_$.v7;
64
+ var charSequenceLength = kotlin_kotlin.$_$.b5;
65
+ var isBlank = kotlin_kotlin.$_$.e7;
66
+ var toDoubleOrNull = kotlin_kotlin.$_$.q7;
67
+ var numberToInt = kotlin_kotlin.$_$.y5;
68
+ var StringBuilder_init_$Create$ = kotlin_kotlin.$_$.g1;
69
+ var Companion_getInstance = kotlin_kotlin.$_$.r;
70
+ var initMetadataForObject = kotlin_kotlin.$_$.r5;
71
+ var firstOrNull = kotlin_kotlin.$_$.r2;
72
+ var IllegalStateException_init_$Create$ = kotlin_kotlin.$_$.o1;
73
+ var toNumber = kotlin_kotlin.$_$.u4;
74
+ var toSet = kotlin_kotlin.$_$.n3;
75
+ var XmlDeclMode_None_getInstance = kotlin_io_github_pdvrieze_xmlutil_core.$_$.b;
76
+ var newGenericWriter = kotlin_io_github_pdvrieze_xmlutil_core.$_$.c;
77
+ var charCodeAt = kotlin_kotlin.$_$.z4;
78
+ var _Char___init__impl__6a9atx = kotlin_kotlin.$_$.b;
79
+ var substring = kotlin_kotlin.$_$.n7;
80
+ var isHighSurrogate = kotlin_kotlin.$_$.g7;
81
+ var isLowSurrogate = kotlin_kotlin.$_$.h7;
82
+ var Char__toInt_impl_vasixd = kotlin_kotlin.$_$.f;
83
+ var StringBuilder_init_$Create$_0 = kotlin_kotlin.$_$.f1;
84
+ var Pair = kotlin_kotlin.$_$.f8;
85
+ var substring_0 = kotlin_kotlin.$_$.o7;
86
+ var toLong = kotlin_kotlin.$_$.t7;
87
+ var numberRangeToNumber = kotlin_kotlin.$_$.w5;
88
+ var ClosedRange = kotlin_kotlin.$_$.g6;
89
+ var isInterface = kotlin_kotlin.$_$.t5;
90
+ var contains = kotlin_kotlin.$_$.l6;
91
+ var convertToInt = kotlin_kotlin.$_$.m4;
92
+ var NumberFormatException = kotlin_kotlin.$_$.e8;
93
+ var isDigit = kotlin_kotlin.$_$.f7;
94
+ var isWhitespace = kotlin_kotlin.$_$.i7;
95
+ var setOf = kotlin_kotlin.$_$.g3;
96
+ var toDouble = kotlin_kotlin.$_$.r7;
97
+ var round = kotlin_kotlin.$_$.f6;
98
+ var divide = kotlin_kotlin.$_$.n4;
99
+ var equalsLong = kotlin_kotlin.$_$.o4;
100
+ var modulo = kotlin_kotlin.$_$.q4;
101
+ var padStart = kotlin_kotlin.$_$.j7;
102
+ var longArray = kotlin_kotlin.$_$.v5;
103
+ var multiply = kotlin_kotlin.$_$.r4;
104
+ var isInfinite = kotlin_kotlin.$_$.o8;
105
+ var charSequenceGet = kotlin_kotlin.$_$.a5;
106
+ var replace = kotlin_kotlin.$_$.k7;
107
+ var toString_1 = kotlin_kotlin.$_$.g;
108
+ var Char__hashCode_impl_otmys = kotlin_kotlin.$_$.d;
109
+ var getBooleanHashCode = kotlin_kotlin.$_$.g5;
110
+ var get_lastIndex = kotlin_kotlin.$_$.w2;
111
+ var toString_2 = kotlin_kotlin.$_$.u7;
112
+ var CoroutineImpl = kotlin_kotlin.$_$.f4;
113
+ var LatLon = kotlin_io_github_glandais_elevation.$_$.f;
114
+ var get_COROUTINE_SUSPENDED = kotlin_kotlin.$_$.q3;
115
+ var initMetadataForCoroutine = kotlin_kotlin.$_$.n5;
116
+ var ElevationSmoother_instance = kotlin_io_github_glandais_elevation.$_$.c;
117
+ var until = kotlin_kotlin.$_$.n6;
118
+ var LatLonElevation = kotlin_io_github_glandais_elevation.$_$.e;
119
+ var arrayCopy = kotlin_kotlin.$_$.f2;
120
+ var Distance_instance = kotlin_io_github_glandais_elevation.$_$.a;
121
+ var DouglasPeucker_instance = kotlin_io_github_glandais_elevation.$_$.b;
122
+ var mapCapacity = kotlin_kotlin.$_$.b3;
123
+ var coerceAtLeast = kotlin_kotlin.$_$.h6;
124
+ var LinkedHashMap_init_$Create$ = kotlin_kotlin.$_$.a1;
125
+ var LinkedHashMap_init_$Create$_0 = kotlin_kotlin.$_$.b1;
126
+ var subtract = kotlin_kotlin.$_$.t4;
127
+ var get_ONE = kotlin_kotlin.$_$.j4;
128
+ var sorted = kotlin_kotlin.$_$.i3;
129
+ //endregion
130
+ //region block: pre-declaration
131
+ initMetadataForClass(GpxPathKind, 'GpxPathKind', VOID, Enum);
132
+ initMetadataForClass(GpxWaypoint, 'GpxWaypoint');
133
+ initMetadataForClass(GpxDocument, 'GpxDocument');
134
+ initMetadataForCompanion(Companion);
135
+ initMetadataForClass(GpxTrack, 'GpxTrack');
136
+ initMetadataForClass(GpxSegment, 'GpxSegment');
137
+ initMetadataForClass(GpxTrackPoint, 'GpxTrackPoint');
138
+ initMetadataForClass(GpxPowerSource, 'GpxPowerSource', VOID, Enum);
139
+ initMetadataForClass(ExtensionsAccumulator, 'ExtensionsAccumulator', ExtensionsAccumulator);
140
+ initMetadataForObject(GpxParser, 'GpxParser');
141
+ initMetadataForObject(GpxWriter, 'GpxWriter');
142
+ initMetadataForClass(NumericRef, 'NumericRef');
143
+ initMetadataForObject(GpxXmlRepair, 'GpxXmlRepair');
144
+ initMetadataForClass(RepairResult, 'RepairResult');
145
+ initMetadataForObject(CsvNumberFormat, 'CsvNumberFormat');
146
+ initMetadataForObject(CsvWriter, 'CsvWriter');
147
+ initMetadataForClass(CsvOptions, 'CsvOptions', CsvOptions);
148
+ initMetadataForObject(JsonWriter, 'JsonWriter');
149
+ initMetadataForClass(JsonOptions, 'JsonOptions', JsonOptions);
150
+ initMetadataForCoroutine($fixElevationCOROUTINE$, CoroutineImpl);
151
+ initMetadataForObject(ElevationStep, 'ElevationStep', VOID, VOID, VOID, [2]);
152
+ initMetadataForClass(GeneratedPath, 'GeneratedPath');
153
+ initMetadataForCompanion(Companion_0);
154
+ initMetadataForClass(BoundsRad, 'BoundsRad');
155
+ initMetadataForCompanion(Companion_1);
156
+ initMetadataForClass(Path, 'Path', VOID, GeneratedPath);
157
+ initMetadataForObject(PathSimplifier, 'PathSimplifier');
158
+ initMetadataForCompanion(Companion_2);
159
+ initMetadataForClass(PointField, 'PointField', VOID, Enum);
160
+ initMetadataForClass(PointFieldCategory, 'PointFieldCategory', VOID, Enum);
161
+ initMetadataForClass(Copy, 'Copy');
162
+ initMetadataForClass(Interpolate, 'Interpolate');
163
+ initMetadataForObject(PointPerDistance, 'PointPerDistance');
164
+ initMetadataForClass(Copy_0, 'Copy');
165
+ initMetadataForClass(Interpolate_0, 'Interpolate');
166
+ initMetadataForObject(PointPerSecond, 'PointPerSecond');
167
+ //endregion
168
+ var GpxPathKind_TRACK_instance;
169
+ var GpxPathKind_ROUTE_instance;
170
+ function values() {
171
+ return [GpxPathKind_TRACK_getInstance(), GpxPathKind_ROUTE_getInstance()];
172
+ }
173
+ function get_entries() {
174
+ if ($ENTRIES == null)
175
+ $ENTRIES = enumEntries(values());
176
+ return $ENTRIES;
177
+ }
178
+ var GpxPathKind_entriesInitialized;
179
+ function GpxPathKind_initEntries() {
180
+ if (GpxPathKind_entriesInitialized)
181
+ return Unit_instance;
182
+ GpxPathKind_entriesInitialized = true;
183
+ GpxPathKind_TRACK_instance = new GpxPathKind('TRACK', 0);
184
+ GpxPathKind_ROUTE_instance = new GpxPathKind('ROUTE', 1);
185
+ }
186
+ var $ENTRIES;
187
+ function GpxPathKind(name, ordinal) {
188
+ Enum.call(this, name, ordinal);
189
+ }
190
+ function GpxWaypoint(latitudeDeg, longitudeDeg, elevationM, name, description, symbol, type, timeEpochMs) {
191
+ elevationM = elevationM === VOID ? null : elevationM;
192
+ name = name === VOID ? null : name;
193
+ description = description === VOID ? null : description;
194
+ symbol = symbol === VOID ? null : symbol;
195
+ type = type === VOID ? null : type;
196
+ timeEpochMs = timeEpochMs === VOID ? null : timeEpochMs;
197
+ this.d1q_1 = latitudeDeg;
198
+ this.e1q_1 = longitudeDeg;
199
+ this.f1q_1 = elevationM;
200
+ this.g1q_1 = name;
201
+ this.h1q_1 = description;
202
+ this.i1q_1 = symbol;
203
+ this.j1q_1 = type;
204
+ this.k1q_1 = timeEpochMs;
205
+ }
206
+ protoOf(GpxWaypoint).toString = function () {
207
+ return 'GpxWaypoint(latitudeDeg=' + this.d1q_1 + ', longitudeDeg=' + this.e1q_1 + ', elevationM=' + this.f1q_1 + ', name=' + this.g1q_1 + ', description=' + this.h1q_1 + ', symbol=' + this.i1q_1 + ', type=' + this.j1q_1 + ', timeEpochMs=' + toString(this.k1q_1) + ')';
208
+ };
209
+ protoOf(GpxWaypoint).hashCode = function () {
210
+ var result = getNumberHashCode(this.d1q_1);
211
+ result = imul(result, 31) + getNumberHashCode(this.e1q_1) | 0;
212
+ result = imul(result, 31) + (this.f1q_1 == null ? 0 : getNumberHashCode(this.f1q_1)) | 0;
213
+ result = imul(result, 31) + (this.g1q_1 == null ? 0 : getStringHashCode(this.g1q_1)) | 0;
214
+ result = imul(result, 31) + (this.h1q_1 == null ? 0 : getStringHashCode(this.h1q_1)) | 0;
215
+ result = imul(result, 31) + (this.i1q_1 == null ? 0 : getStringHashCode(this.i1q_1)) | 0;
216
+ result = imul(result, 31) + (this.j1q_1 == null ? 0 : getStringHashCode(this.j1q_1)) | 0;
217
+ result = imul(result, 31) + (this.k1q_1 == null ? 0 : this.k1q_1.hashCode()) | 0;
218
+ return result;
219
+ };
220
+ protoOf(GpxWaypoint).equals = function (other) {
221
+ if (this === other)
222
+ return true;
223
+ if (!(other instanceof GpxWaypoint))
224
+ return false;
225
+ if (!equals(this.d1q_1, other.d1q_1))
226
+ return false;
227
+ if (!equals(this.e1q_1, other.e1q_1))
228
+ return false;
229
+ if (!equals(this.f1q_1, other.f1q_1))
230
+ return false;
231
+ if (!(this.g1q_1 == other.g1q_1))
232
+ return false;
233
+ if (!(this.h1q_1 == other.h1q_1))
234
+ return false;
235
+ if (!(this.i1q_1 == other.i1q_1))
236
+ return false;
237
+ if (!(this.j1q_1 == other.j1q_1))
238
+ return false;
239
+ if (!equals(this.k1q_1, other.k1q_1))
240
+ return false;
241
+ return true;
242
+ };
243
+ function GpxDocument(name, tracks, waypoints) {
244
+ name = name === VOID ? 'noname' : name;
245
+ waypoints = waypoints === VOID ? emptyList() : waypoints;
246
+ this.l1q_1 = name;
247
+ this.m1q_1 = tracks;
248
+ this.n1q_1 = waypoints;
249
+ }
250
+ protoOf(GpxDocument).toString = function () {
251
+ return 'GpxDocument(name=' + this.l1q_1 + ', tracks=' + toString_0(this.m1q_1) + ', waypoints=' + toString_0(this.n1q_1) + ')';
252
+ };
253
+ protoOf(GpxDocument).hashCode = function () {
254
+ var result = getStringHashCode(this.l1q_1);
255
+ result = imul(result, 31) + hashCode(this.m1q_1) | 0;
256
+ result = imul(result, 31) + hashCode(this.n1q_1) | 0;
257
+ return result;
258
+ };
259
+ protoOf(GpxDocument).equals = function (other) {
260
+ if (this === other)
261
+ return true;
262
+ if (!(other instanceof GpxDocument))
263
+ return false;
264
+ if (!(this.l1q_1 === other.l1q_1))
265
+ return false;
266
+ if (!equals(this.m1q_1, other.m1q_1))
267
+ return false;
268
+ if (!equals(this.n1q_1, other.n1q_1))
269
+ return false;
270
+ return true;
271
+ };
272
+ function Companion() {
273
+ }
274
+ protoOf(Companion).o1q = function (name, type, points, kind) {
275
+ return new GpxTrack(name, type, listOf(new GpxSegment(points)), kind);
276
+ };
277
+ protoOf(Companion).p1q = function (name, type, points, kind, $super) {
278
+ name = name === VOID ? null : name;
279
+ type = type === VOID ? null : type;
280
+ kind = kind === VOID ? GpxPathKind_TRACK_getInstance() : kind;
281
+ return $super === VOID ? this.o1q(name, type, points, kind) : $super.o1q.call(this, name, type, points, kind);
282
+ };
283
+ var Companion_instance;
284
+ function Companion_getInstance_0() {
285
+ return Companion_instance;
286
+ }
287
+ function GpxTrack$points$delegate$lambda(this$0) {
288
+ return function () {
289
+ // Inline function 'kotlin.collections.flatMap' call
290
+ var tmp0 = this$0.s1q_1;
291
+ // Inline function 'kotlin.collections.flatMapTo' call
292
+ var destination = ArrayList_init_$Create$();
293
+ var _iterator__ex2g4s = tmp0.i();
294
+ while (_iterator__ex2g4s.j()) {
295
+ var element = _iterator__ex2g4s.k();
296
+ var list = element.v1q_1;
297
+ addAll(destination, list);
298
+ }
299
+ return destination;
300
+ };
301
+ }
302
+ function GpxTrack$_get_points_$ref_4x48pr() {
303
+ return constructCallableReference(function (p0) {
304
+ return p0.w1q();
305
+ }, 1, 0, 5);
306
+ }
307
+ function GpxTrack(name, type, segments, kind) {
308
+ name = name === VOID ? null : name;
309
+ type = type === VOID ? null : type;
310
+ kind = kind === VOID ? GpxPathKind_TRACK_getInstance() : kind;
311
+ this.q1q_1 = name;
312
+ this.r1q_1 = type;
313
+ this.s1q_1 = segments;
314
+ this.t1q_1 = kind;
315
+ var tmp = this;
316
+ tmp.u1q_1 = lazy(GpxTrack$points$delegate$lambda(this));
317
+ }
318
+ protoOf(GpxTrack).w1q = function () {
319
+ var tmp0 = this.u1q_1;
320
+ var tmp = KProperty1;
321
+ // Inline function 'kotlin.getValue' call
322
+ getPropertyCallableRef('points', 1, tmp, GpxTrack$_get_points_$ref_4x48pr(), null);
323
+ return tmp0.i1();
324
+ };
325
+ protoOf(GpxTrack).toString = function () {
326
+ return 'GpxTrack(name=' + this.q1q_1 + ', type=' + this.r1q_1 + ', segments=' + toString_0(this.s1q_1) + ', kind=' + this.t1q_1.toString() + ')';
327
+ };
328
+ protoOf(GpxTrack).hashCode = function () {
329
+ var result = this.q1q_1 == null ? 0 : getStringHashCode(this.q1q_1);
330
+ result = imul(result, 31) + (this.r1q_1 == null ? 0 : getStringHashCode(this.r1q_1)) | 0;
331
+ result = imul(result, 31) + hashCode(this.s1q_1) | 0;
332
+ result = imul(result, 31) + this.t1q_1.hashCode() | 0;
333
+ return result;
334
+ };
335
+ protoOf(GpxTrack).equals = function (other) {
336
+ if (this === other)
337
+ return true;
338
+ if (!(other instanceof GpxTrack))
339
+ return false;
340
+ if (!(this.q1q_1 == other.q1q_1))
341
+ return false;
342
+ if (!(this.r1q_1 == other.r1q_1))
343
+ return false;
344
+ if (!equals(this.s1q_1, other.s1q_1))
345
+ return false;
346
+ if (!this.t1q_1.equals(other.t1q_1))
347
+ return false;
348
+ return true;
349
+ };
350
+ function GpxSegment(points) {
351
+ this.v1q_1 = points;
352
+ }
353
+ protoOf(GpxSegment).toString = function () {
354
+ return 'GpxSegment(points=' + toString_0(this.v1q_1) + ')';
355
+ };
356
+ protoOf(GpxSegment).hashCode = function () {
357
+ return hashCode(this.v1q_1);
358
+ };
359
+ protoOf(GpxSegment).equals = function (other) {
360
+ if (this === other)
361
+ return true;
362
+ if (!(other instanceof GpxSegment))
363
+ return false;
364
+ if (!equals(this.v1q_1, other.v1q_1))
365
+ return false;
366
+ return true;
367
+ };
368
+ function GpxTrackPoint(latitudeDeg, longitudeDeg, elevationM, timeEpochMs, heartRate, cadence, temperatureC, powerW) {
369
+ elevationM = elevationM === VOID ? null : elevationM;
370
+ timeEpochMs = timeEpochMs === VOID ? null : timeEpochMs;
371
+ heartRate = heartRate === VOID ? null : heartRate;
372
+ cadence = cadence === VOID ? null : cadence;
373
+ temperatureC = temperatureC === VOID ? null : temperatureC;
374
+ powerW = powerW === VOID ? null : powerW;
375
+ this.x1q_1 = latitudeDeg;
376
+ this.y1q_1 = longitudeDeg;
377
+ this.z1q_1 = elevationM;
378
+ this.a1r_1 = timeEpochMs;
379
+ this.b1r_1 = heartRate;
380
+ this.c1r_1 = cadence;
381
+ this.d1r_1 = temperatureC;
382
+ this.e1r_1 = powerW;
383
+ }
384
+ protoOf(GpxTrackPoint).toString = function () {
385
+ return 'GpxTrackPoint(latitudeDeg=' + this.x1q_1 + ', longitudeDeg=' + this.y1q_1 + ', elevationM=' + this.z1q_1 + ', timeEpochMs=' + toString(this.a1r_1) + ', heartRate=' + this.b1r_1 + ', cadence=' + this.c1r_1 + ', temperatureC=' + this.d1r_1 + ', powerW=' + this.e1r_1 + ')';
386
+ };
387
+ protoOf(GpxTrackPoint).hashCode = function () {
388
+ var result = getNumberHashCode(this.x1q_1);
389
+ result = imul(result, 31) + getNumberHashCode(this.y1q_1) | 0;
390
+ result = imul(result, 31) + (this.z1q_1 == null ? 0 : getNumberHashCode(this.z1q_1)) | 0;
391
+ result = imul(result, 31) + (this.a1r_1 == null ? 0 : this.a1r_1.hashCode()) | 0;
392
+ result = imul(result, 31) + (this.b1r_1 == null ? 0 : this.b1r_1) | 0;
393
+ result = imul(result, 31) + (this.c1r_1 == null ? 0 : this.c1r_1) | 0;
394
+ result = imul(result, 31) + (this.d1r_1 == null ? 0 : getNumberHashCode(this.d1r_1)) | 0;
395
+ result = imul(result, 31) + (this.e1r_1 == null ? 0 : getNumberHashCode(this.e1r_1)) | 0;
396
+ return result;
397
+ };
398
+ protoOf(GpxTrackPoint).equals = function (other) {
399
+ if (this === other)
400
+ return true;
401
+ if (!(other instanceof GpxTrackPoint))
402
+ return false;
403
+ if (!equals(this.x1q_1, other.x1q_1))
404
+ return false;
405
+ if (!equals(this.y1q_1, other.y1q_1))
406
+ return false;
407
+ if (!equals(this.z1q_1, other.z1q_1))
408
+ return false;
409
+ if (!equals(this.a1r_1, other.a1r_1))
410
+ return false;
411
+ if (!(this.b1r_1 == other.b1r_1))
412
+ return false;
413
+ if (!(this.c1r_1 == other.c1r_1))
414
+ return false;
415
+ if (!equals(this.d1r_1, other.d1r_1))
416
+ return false;
417
+ if (!equals(this.e1r_1, other.e1r_1))
418
+ return false;
419
+ return true;
420
+ };
421
+ function GpxPathKind_TRACK_getInstance() {
422
+ GpxPathKind_initEntries();
423
+ return GpxPathKind_TRACK_instance;
424
+ }
425
+ function GpxPathKind_ROUTE_getInstance() {
426
+ GpxPathKind_initEntries();
427
+ return GpxPathKind_ROUTE_instance;
428
+ }
429
+ function toGpxDocument(_this__u8e3s4, name, trackName, startTime, powerSource) {
430
+ name = name === VOID ? 'noname' : name;
431
+ trackName = trackName === VOID ? null : trackName;
432
+ startTime = startTime === VOID ? null : startTime;
433
+ powerSource = powerSource === VOID ? GpxPowerSource_INPUT_getInstance() : powerSource;
434
+ return new GpxDocument(name, listOf(toGpxTrack(_this__u8e3s4, trackName, VOID, startTime, powerSource)));
435
+ }
436
+ function pathsToGpxDocument(paths, name, trackNames, waypoints, type, startTime, powerSource) {
437
+ name = name === VOID ? 'noname' : name;
438
+ trackNames = trackNames === VOID ? null : trackNames;
439
+ waypoints = waypoints === VOID ? emptyList() : waypoints;
440
+ type = type === VOID ? 'cycling' : type;
441
+ startTime = startTime === VOID ? null : startTime;
442
+ powerSource = powerSource === VOID ? GpxPowerSource_INPUT_getInstance() : powerSource;
443
+ // Inline function 'kotlin.collections.mapIndexed' call
444
+ // Inline function 'kotlin.collections.mapIndexedTo' call
445
+ var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(paths, 10));
446
+ var index = 0;
447
+ var _iterator__ex2g4s = paths.i();
448
+ while (_iterator__ex2g4s.j()) {
449
+ var item = _iterator__ex2g4s.k();
450
+ var _unary__edvuaz = index;
451
+ index = _unary__edvuaz + 1 | 0;
452
+ var i = checkIndexOverflow(_unary__edvuaz);
453
+ var tmp$ret$2 = toGpxTrack(item, trackNames == null ? null : getOrNull(trackNames, i), type, startTime, powerSource);
454
+ destination.h(tmp$ret$2);
455
+ }
456
+ return new GpxDocument(name, destination, waypoints);
457
+ }
458
+ var GpxPowerSource_INPUT_instance;
459
+ var GpxPowerSource_COMPUTED_instance;
460
+ var GpxPowerSource_COMPUTED_OR_INPUT_instance;
461
+ var GpxPowerSource_entriesInitialized;
462
+ function GpxPowerSource_initEntries() {
463
+ if (GpxPowerSource_entriesInitialized)
464
+ return Unit_instance;
465
+ GpxPowerSource_entriesInitialized = true;
466
+ GpxPowerSource_INPUT_instance = new GpxPowerSource('INPUT', 0);
467
+ GpxPowerSource_COMPUTED_instance = new GpxPowerSource('COMPUTED', 1);
468
+ GpxPowerSource_COMPUTED_OR_INPUT_instance = new GpxPowerSource('COMPUTED_OR_INPUT', 2);
469
+ }
470
+ function GpxPowerSource(name, ordinal) {
471
+ Enum.call(this, name, ordinal);
472
+ }
473
+ function toGpxTrack(_this__u8e3s4, name, type, startTime, powerSource) {
474
+ name = name === VOID ? null : name;
475
+ type = type === VOID ? 'cycling' : type;
476
+ startTime = startTime === VOID ? null : startTime;
477
+ powerSource = powerSource === VOID ? GpxPowerSource_INPUT_getInstance() : powerSource;
478
+ var startTimeMs = startTime == null ? null : startTime.ud();
479
+ // Inline function 'kotlin.collections.List' call
480
+ // Inline function 'kotlin.collections.MutableList' call
481
+ var size = _this__u8e3s4.f1r_1;
482
+ var list = ArrayList_init_$Create$_0(size);
483
+ // Inline function 'kotlin.repeat' call
484
+ var inductionVariable = 0;
485
+ if (inductionVariable < size)
486
+ do {
487
+ var index = inductionVariable;
488
+ inductionVariable = inductionVariable + 1 | 0;
489
+ var tmp = _this__u8e3s4.h1r(index) * 57.29577951308232;
490
+ var tmp_0 = _this__u8e3s4.i1r(index) * 57.29577951308232;
491
+ // Inline function 'kotlin.takeUnless' call
492
+ var this_0 = _this__u8e3s4.j1r(index);
493
+ var tmp_1;
494
+ if (!isNaN_0(this_0)) {
495
+ tmp_1 = this_0;
496
+ } else {
497
+ tmp_1 = null;
498
+ }
499
+ var tmp_2 = tmp_1;
500
+ var tmp_3;
501
+ if (isNaN_0(_this__u8e3s4.k1r(index))) {
502
+ tmp_3 = null;
503
+ } else if (!(startTimeMs == null)) {
504
+ tmp_3 = add(startTimeMs, roundToLong(_this__u8e3s4.k1r(index)));
505
+ } else {
506
+ // Inline function 'kotlin.takeIf' call
507
+ var this_1 = numberToLong(_this__u8e3s4.k1r(index));
508
+ var tmp_4;
509
+ if (compare(this_1, new Long(0, 0)) > 0) {
510
+ tmp_4 = this_1;
511
+ } else {
512
+ tmp_4 = null;
513
+ }
514
+ tmp_3 = tmp_4;
515
+ }
516
+ var tmp_5 = tmp_3;
517
+ // Inline function 'kotlin.takeUnless' call
518
+ var this_2 = _this__u8e3s4.l1r(index);
519
+ var tmp_6;
520
+ if (!isNaN_0(this_2)) {
521
+ tmp_6 = this_2;
522
+ } else {
523
+ tmp_6 = null;
524
+ }
525
+ var tmp0_safe_receiver = tmp_6;
526
+ var tmp_7 = tmp0_safe_receiver == null ? null : roundToInt(tmp0_safe_receiver);
527
+ // Inline function 'kotlin.takeUnless' call
528
+ var this_3 = _this__u8e3s4.m1r(index);
529
+ var tmp_8;
530
+ if (!isNaN_0(this_3)) {
531
+ tmp_8 = this_3;
532
+ } else {
533
+ tmp_8 = null;
534
+ }
535
+ var tmp1_safe_receiver = tmp_8;
536
+ var tmp_9 = tmp1_safe_receiver == null ? null : roundToInt(tmp1_safe_receiver);
537
+ // Inline function 'kotlin.takeUnless' call
538
+ var this_4 = _this__u8e3s4.n1r(index);
539
+ var tmp_10;
540
+ if (!isNaN_0(this_4)) {
541
+ tmp_10 = this_4;
542
+ } else {
543
+ tmp_10 = null;
544
+ }
545
+ var tmp$ret$13 = tmp_10;
546
+ var tmp$ret$4 = new GpxTrackPoint(tmp, tmp_0, tmp_2, tmp_5, tmp_7, tmp_9, tmp$ret$13, powerAt(_this__u8e3s4, index, powerSource));
547
+ list.h(tmp$ret$4);
548
+ }
549
+ while (inductionVariable < size);
550
+ var points = list;
551
+ return Companion_instance.p1q(name, type, points);
552
+ }
553
+ function powerAt(_this__u8e3s4, i, source) {
554
+ // Inline function 'kotlin.takeUnless' call
555
+ var this_0 = _this__u8e3s4.o1r(i);
556
+ var tmp;
557
+ if (!isNaN_0(this_0)) {
558
+ tmp = this_0;
559
+ } else {
560
+ tmp = null;
561
+ }
562
+ var input = tmp;
563
+ // Inline function 'kotlin.takeUnless' call
564
+ var this_1 = _this__u8e3s4.p1r(i);
565
+ var tmp_0;
566
+ if (!(isNaN_0(this_1) || this_1 === 0.0)) {
567
+ tmp_0 = this_1;
568
+ } else {
569
+ tmp_0 = null;
570
+ }
571
+ var computed = tmp_0;
572
+ var tmp_1;
573
+ switch (source.o1_1) {
574
+ case 0:
575
+ tmp_1 = input;
576
+ break;
577
+ case 1:
578
+ tmp_1 = computed;
579
+ break;
580
+ case 2:
581
+ tmp_1 = computed == null ? input : computed;
582
+ break;
583
+ default:
584
+ noWhenBranchMatchedException();
585
+ break;
586
+ }
587
+ return tmp_1;
588
+ }
589
+ function GpxPowerSource_INPUT_getInstance() {
590
+ GpxPowerSource_initEntries();
591
+ return GpxPowerSource_INPUT_instance;
592
+ }
593
+ function parseOnce($this, xml) {
594
+ var tmp;
595
+ try {
596
+ tmp = get_xmlStreaming().f19(xml);
597
+ } catch ($p) {
598
+ var tmp_0;
599
+ if ($p instanceof IllegalArgumentException) {
600
+ var e = $p;
601
+ throw e;
602
+ } else {
603
+ if ($p instanceof Exception) {
604
+ var e_0 = $p;
605
+ throw IllegalArgumentException_init_$Create$('Invalid GPX XML: ' + e_0.message, e_0);
606
+ } else {
607
+ throw $p;
608
+ }
609
+ }
610
+ }
611
+ var reader = tmp;
612
+ var tmp_1;
613
+ try {
614
+ tmp_1 = parseDocument($this, reader);
615
+ } catch ($p_0) {
616
+ var tmp_2;
617
+ if ($p_0 instanceof IllegalArgumentException) {
618
+ var e_1 = $p_0;
619
+ throw e_1;
620
+ } else {
621
+ if ($p_0 instanceof Exception) {
622
+ var e_2 = $p_0;
623
+ throw IllegalArgumentException_init_$Create$('Invalid GPX XML: ' + e_2.message, e_2);
624
+ } else {
625
+ throw $p_0;
626
+ }
627
+ }
628
+ }
629
+ finally {
630
+ reader.n18();
631
+ }
632
+ return tmp_1;
633
+ }
634
+ function parseDocument($this, reader) {
635
+ while (reader.j()) {
636
+ var ev = reader.k();
637
+ if (ev.equals(EventType_START_ELEMENT_getInstance())) {
638
+ if (!(reader.a18() === 'gpx')) {
639
+ throw IllegalArgumentException_init_$Create$_0('Invalid GPX file: missing gpx root element (found ' + reader.a18() + ')');
640
+ }
641
+ return parseGpxRoot($this, reader);
642
+ }
643
+ }
644
+ throw IllegalArgumentException_init_$Create$_0('Invalid GPX file: missing gpx root element');
645
+ }
646
+ function parseGpxRoot($this, reader) {
647
+ var name = 'noname';
648
+ // Inline function 'kotlin.collections.mutableListOf' call
649
+ var tracks = ArrayList_init_$Create$();
650
+ // Inline function 'kotlin.collections.mutableListOf' call
651
+ var waypoints = ArrayList_init_$Create$();
652
+ while (reader.j()) {
653
+ var ev = reader.k();
654
+ switch (ev.o1_1) {
655
+ case 1:
656
+ switch (reader.a18()) {
657
+ case 'metadata':
658
+ var metaName = parseMetadataName($this, reader);
659
+ if (!(metaName == null))
660
+ name = metaName;
661
+ break;
662
+ case 'trk':
663
+ tracks.h(parseTrack($this, reader));
664
+ break;
665
+ case 'rte':
666
+ tracks.h(parseRoute($this, reader));
667
+ break;
668
+ case 'wpt':
669
+ waypoints.h(parseWaypoint($this, reader));
670
+ break;
671
+ default:
672
+ skipElement($this, reader);
673
+ break;
674
+ }
675
+
676
+ break;
677
+ case 2:
678
+ return new GpxDocument(name, tracks, waypoints);
679
+ default:
680
+ break;
681
+ }
682
+ }
683
+ return new GpxDocument(name, tracks, waypoints);
684
+ }
685
+ function parseMetadataName($this, reader) {
686
+ var name = null;
687
+ while (reader.j()) {
688
+ var ev = reader.k();
689
+ switch (ev.o1_1) {
690
+ case 1:
691
+ if (reader.a18() === 'name' && name == null) {
692
+ // Inline function 'kotlin.text.trim' call
693
+ var this_0 = readElementText($this, reader);
694
+ // Inline function 'kotlin.text.ifEmpty' call
695
+ var this_1 = toString_0(trim(isCharSequence(this_0) ? this_0 : THROW_CCE()));
696
+ var tmp;
697
+ // Inline function 'kotlin.text.isEmpty' call
698
+ if (charSequenceLength(this_1) === 0) {
699
+ tmp = null;
700
+ } else {
701
+ tmp = this_1;
702
+ }
703
+ name = tmp;
704
+ } else {
705
+ skipElement($this, reader);
706
+ }
707
+
708
+ break;
709
+ case 2:
710
+ return name;
711
+ default:
712
+ break;
713
+ }
714
+ }
715
+ return name;
716
+ }
717
+ function parseTrack($this, reader) {
718
+ var name = null;
719
+ var type = null;
720
+ // Inline function 'kotlin.collections.mutableListOf' call
721
+ var segments = ArrayList_init_$Create$();
722
+ while (reader.j()) {
723
+ var ev = reader.k();
724
+ switch (ev.o1_1) {
725
+ case 1:
726
+ switch (reader.a18()) {
727
+ case 'name':
728
+ // Inline function 'kotlin.text.trim' call
729
+
730
+ var this_0 = readElementText($this, reader);
731
+ // Inline function 'kotlin.text.ifEmpty' call
732
+
733
+ var this_1 = toString_0(trim(isCharSequence(this_0) ? this_0 : THROW_CCE()));
734
+ var tmp;
735
+ // Inline function 'kotlin.text.isEmpty' call
736
+
737
+ if (charSequenceLength(this_1) === 0) {
738
+ tmp = null;
739
+ } else {
740
+ tmp = this_1;
741
+ }
742
+
743
+ name = tmp;
744
+ break;
745
+ case 'type':
746
+ // Inline function 'kotlin.text.trim' call
747
+
748
+ var this_2 = readElementText($this, reader);
749
+ // Inline function 'kotlin.text.ifEmpty' call
750
+
751
+ var this_3 = toString_0(trim(isCharSequence(this_2) ? this_2 : THROW_CCE()));
752
+ var tmp_0;
753
+ // Inline function 'kotlin.text.isEmpty' call
754
+
755
+ if (charSequenceLength(this_3) === 0) {
756
+ tmp_0 = null;
757
+ } else {
758
+ tmp_0 = this_3;
759
+ }
760
+
761
+ type = tmp_0;
762
+ break;
763
+ case 'trkseg':
764
+ segments.h(parseTrackSegment($this, reader));
765
+ break;
766
+ default:
767
+ skipElement($this, reader);
768
+ break;
769
+ }
770
+
771
+ break;
772
+ case 2:
773
+ return new GpxTrack(name, type, segments);
774
+ default:
775
+ break;
776
+ }
777
+ }
778
+ return new GpxTrack(name, type, segments);
779
+ }
780
+ function parseRoute($this, reader) {
781
+ var name = null;
782
+ var type = null;
783
+ // Inline function 'kotlin.collections.mutableListOf' call
784
+ var points = ArrayList_init_$Create$();
785
+ while (reader.j()) {
786
+ var ev = reader.k();
787
+ switch (ev.o1_1) {
788
+ case 1:
789
+ switch (reader.a18()) {
790
+ case 'name':
791
+ // Inline function 'kotlin.text.trim' call
792
+
793
+ var this_0 = readElementText($this, reader);
794
+ // Inline function 'kotlin.text.ifEmpty' call
795
+
796
+ var this_1 = toString_0(trim(isCharSequence(this_0) ? this_0 : THROW_CCE()));
797
+ var tmp;
798
+ // Inline function 'kotlin.text.isEmpty' call
799
+
800
+ if (charSequenceLength(this_1) === 0) {
801
+ tmp = null;
802
+ } else {
803
+ tmp = this_1;
804
+ }
805
+
806
+ name = tmp;
807
+ break;
808
+ case 'type':
809
+ // Inline function 'kotlin.text.trim' call
810
+
811
+ var this_2 = readElementText($this, reader);
812
+ // Inline function 'kotlin.text.ifEmpty' call
813
+
814
+ var this_3 = toString_0(trim(isCharSequence(this_2) ? this_2 : THROW_CCE()));
815
+ var tmp_0;
816
+ // Inline function 'kotlin.text.isEmpty' call
817
+
818
+ if (charSequenceLength(this_3) === 0) {
819
+ tmp_0 = null;
820
+ } else {
821
+ tmp_0 = this_3;
822
+ }
823
+
824
+ type = tmp_0;
825
+ break;
826
+ case 'rtept':
827
+ points.h(parseTrackPoint($this, reader));
828
+ break;
829
+ default:
830
+ skipElement($this, reader);
831
+ break;
832
+ }
833
+
834
+ break;
835
+ case 2:
836
+ return new GpxTrack(name, type, listOf(new GpxSegment(points)), GpxPathKind_ROUTE_getInstance());
837
+ default:
838
+ break;
839
+ }
840
+ }
841
+ return new GpxTrack(name, type, listOf(new GpxSegment(points)), GpxPathKind_ROUTE_getInstance());
842
+ }
843
+ function parseTrackSegment($this, reader) {
844
+ // Inline function 'kotlin.collections.mutableListOf' call
845
+ var points = ArrayList_init_$Create$();
846
+ while (reader.j()) {
847
+ var ev = reader.k();
848
+ switch (ev.o1_1) {
849
+ case 1:
850
+ if (reader.a18() === 'trkpt') {
851
+ points.h(parseTrackPoint($this, reader));
852
+ } else {
853
+ skipElement($this, reader);
854
+ }
855
+
856
+ break;
857
+ case 2:
858
+ return new GpxSegment(points);
859
+ default:
860
+ break;
861
+ }
862
+ }
863
+ return new GpxSegment(points);
864
+ }
865
+ function parseTrackPoint($this, reader) {
866
+ var latStr = reader.l18(null, 'lat');
867
+ var lonStr = reader.l18(null, 'lon');
868
+ var tmp;
869
+ // Inline function 'kotlin.text.isNullOrBlank' call
870
+ if (latStr == null || isBlank(latStr)) {
871
+ tmp = true;
872
+ } else {
873
+ // Inline function 'kotlin.text.isNullOrBlank' call
874
+ tmp = lonStr == null || isBlank(lonStr);
875
+ }
876
+ if (tmp) {
877
+ throw IllegalArgumentException_init_$Create$_0('Invalid track point: missing latitude or longitude attribute');
878
+ }
879
+ var tmp0_elvis_lhs = toDoubleOrNull(latStr);
880
+ var tmp_0;
881
+ if (tmp0_elvis_lhs == null) {
882
+ throw IllegalArgumentException_init_$Create$_0("Invalid track point: latitude '" + latStr + "' is not a valid number");
883
+ } else {
884
+ tmp_0 = tmp0_elvis_lhs;
885
+ }
886
+ var lat = tmp_0;
887
+ var tmp1_elvis_lhs = toDoubleOrNull(lonStr);
888
+ var tmp_1;
889
+ if (tmp1_elvis_lhs == null) {
890
+ throw IllegalArgumentException_init_$Create$_0("Invalid track point: longitude '" + lonStr + "' is not a valid number");
891
+ } else {
892
+ tmp_1 = tmp1_elvis_lhs;
893
+ }
894
+ var lon = tmp_1;
895
+ var elevation = null;
896
+ var timeMs = null;
897
+ var ext = new ExtensionsAccumulator();
898
+ while (reader.j()) {
899
+ var ev = reader.k();
900
+ switch (ev.o1_1) {
901
+ case 1:
902
+ switch (reader.a18()) {
903
+ case 'ele':
904
+ // Inline function 'kotlin.text.trim' call
905
+
906
+ var this_0 = readElementText($this, reader);
907
+ var txt = toString_0(trim(isCharSequence(this_0) ? this_0 : THROW_CCE()));
908
+ // Inline function 'kotlin.text.isNotEmpty' call
909
+
910
+ if (charSequenceLength(txt) > 0) {
911
+ var tmp4_elvis_lhs = toDoubleOrNull(txt);
912
+ elevation = tmp4_elvis_lhs == null ? elevation : tmp4_elvis_lhs;
913
+ }
914
+
915
+ break;
916
+ case 'time':
917
+ // Inline function 'kotlin.text.trim' call
918
+
919
+ var this_1 = readElementText($this, reader);
920
+ var txt_0 = toString_0(trim(isCharSequence(this_1) ? this_1 : THROW_CCE()));
921
+ // Inline function 'kotlin.text.isNotEmpty' call
922
+
923
+ if (charSequenceLength(txt_0) > 0)
924
+ timeMs = parseTimeIsoToMs($this, txt_0);
925
+ break;
926
+ case 'extensions':
927
+ parseExtensions($this, reader, ext);
928
+ break;
929
+ default:
930
+ skipElement($this, reader);
931
+ break;
932
+ }
933
+
934
+ break;
935
+ case 2:
936
+ return new GpxTrackPoint(lat, lon, elevation, timeMs, ext.q1r_1, ext.r1r_1, ext.s1r_1, ext.t1r_1);
937
+ default:
938
+ break;
939
+ }
940
+ }
941
+ return new GpxTrackPoint(lat, lon, elevation, timeMs, ext.q1r_1, ext.r1r_1, ext.s1r_1, ext.t1r_1);
942
+ }
943
+ function parseWaypoint($this, reader) {
944
+ var latStr = reader.l18(null, 'lat');
945
+ var lonStr = reader.l18(null, 'lon');
946
+ var tmp;
947
+ // Inline function 'kotlin.text.isNullOrBlank' call
948
+ if (latStr == null || isBlank(latStr)) {
949
+ tmp = true;
950
+ } else {
951
+ // Inline function 'kotlin.text.isNullOrBlank' call
952
+ tmp = lonStr == null || isBlank(lonStr);
953
+ }
954
+ if (tmp) {
955
+ throw IllegalArgumentException_init_$Create$_0('Invalid waypoint: missing latitude or longitude attribute');
956
+ }
957
+ var tmp0_elvis_lhs = toDoubleOrNull(latStr);
958
+ var tmp_0;
959
+ if (tmp0_elvis_lhs == null) {
960
+ throw IllegalArgumentException_init_$Create$_0("Invalid waypoint: latitude '" + latStr + "' is not a valid number");
961
+ } else {
962
+ tmp_0 = tmp0_elvis_lhs;
963
+ }
964
+ var lat = tmp_0;
965
+ var tmp1_elvis_lhs = toDoubleOrNull(lonStr);
966
+ var tmp_1;
967
+ if (tmp1_elvis_lhs == null) {
968
+ throw IllegalArgumentException_init_$Create$_0("Invalid waypoint: longitude '" + lonStr + "' is not a valid number");
969
+ } else {
970
+ tmp_1 = tmp1_elvis_lhs;
971
+ }
972
+ var lon = tmp_1;
973
+ var elevation = null;
974
+ var timeMs = null;
975
+ var name = null;
976
+ var description = null;
977
+ var symbol = null;
978
+ var type = null;
979
+ while (reader.j()) {
980
+ var ev = reader.k();
981
+ switch (ev.o1_1) {
982
+ case 1:
983
+ switch (reader.a18()) {
984
+ case 'ele':
985
+ // Inline function 'kotlin.text.trim' call
986
+
987
+ var this_0 = readElementText($this, reader);
988
+ var txt = toString_0(trim(isCharSequence(this_0) ? this_0 : THROW_CCE()));
989
+ // Inline function 'kotlin.text.isNotEmpty' call
990
+
991
+ if (charSequenceLength(txt) > 0) {
992
+ var tmp4_elvis_lhs = toDoubleOrNull(txt);
993
+ elevation = tmp4_elvis_lhs == null ? elevation : tmp4_elvis_lhs;
994
+ }
995
+
996
+ break;
997
+ case 'time':
998
+ // Inline function 'kotlin.text.trim' call
999
+
1000
+ var this_1 = readElementText($this, reader);
1001
+ var txt_0 = toString_0(trim(isCharSequence(this_1) ? this_1 : THROW_CCE()));
1002
+ // Inline function 'kotlin.text.isNotEmpty' call
1003
+
1004
+ if (charSequenceLength(txt_0) > 0)
1005
+ timeMs = parseTimeIsoToMs($this, txt_0);
1006
+ break;
1007
+ case 'name':
1008
+ // Inline function 'kotlin.text.trim' call
1009
+
1010
+ var this_2 = readElementText($this, reader);
1011
+ // Inline function 'kotlin.text.ifEmpty' call
1012
+
1013
+ var this_3 = toString_0(trim(isCharSequence(this_2) ? this_2 : THROW_CCE()));
1014
+ var tmp_2;
1015
+ // Inline function 'kotlin.text.isEmpty' call
1016
+
1017
+ if (charSequenceLength(this_3) === 0) {
1018
+ tmp_2 = null;
1019
+ } else {
1020
+ tmp_2 = this_3;
1021
+ }
1022
+
1023
+ name = tmp_2;
1024
+ break;
1025
+ case 'desc':
1026
+ // Inline function 'kotlin.text.trim' call
1027
+
1028
+ var this_4 = readElementText($this, reader);
1029
+ // Inline function 'kotlin.text.ifEmpty' call
1030
+
1031
+ var this_5 = toString_0(trim(isCharSequence(this_4) ? this_4 : THROW_CCE()));
1032
+ var tmp_3;
1033
+ // Inline function 'kotlin.text.isEmpty' call
1034
+
1035
+ if (charSequenceLength(this_5) === 0) {
1036
+ tmp_3 = null;
1037
+ } else {
1038
+ tmp_3 = this_5;
1039
+ }
1040
+
1041
+ description = tmp_3;
1042
+ break;
1043
+ case 'sym':
1044
+ // Inline function 'kotlin.text.trim' call
1045
+
1046
+ var this_6 = readElementText($this, reader);
1047
+ // Inline function 'kotlin.text.ifEmpty' call
1048
+
1049
+ var this_7 = toString_0(trim(isCharSequence(this_6) ? this_6 : THROW_CCE()));
1050
+ var tmp_4;
1051
+ // Inline function 'kotlin.text.isEmpty' call
1052
+
1053
+ if (charSequenceLength(this_7) === 0) {
1054
+ tmp_4 = null;
1055
+ } else {
1056
+ tmp_4 = this_7;
1057
+ }
1058
+
1059
+ symbol = tmp_4;
1060
+ break;
1061
+ case 'type':
1062
+ // Inline function 'kotlin.text.trim' call
1063
+
1064
+ var this_8 = readElementText($this, reader);
1065
+ // Inline function 'kotlin.text.ifEmpty' call
1066
+
1067
+ var this_9 = toString_0(trim(isCharSequence(this_8) ? this_8 : THROW_CCE()));
1068
+ var tmp_5;
1069
+ // Inline function 'kotlin.text.isEmpty' call
1070
+
1071
+ if (charSequenceLength(this_9) === 0) {
1072
+ tmp_5 = null;
1073
+ } else {
1074
+ tmp_5 = this_9;
1075
+ }
1076
+
1077
+ type = tmp_5;
1078
+ break;
1079
+ default:
1080
+ skipElement($this, reader);
1081
+ break;
1082
+ }
1083
+
1084
+ break;
1085
+ case 2:
1086
+ return new GpxWaypoint(lat, lon, elevation, name, description, symbol, type, timeMs);
1087
+ default:
1088
+ break;
1089
+ }
1090
+ }
1091
+ return new GpxWaypoint(lat, lon, elevation, name, description, symbol, type, timeMs);
1092
+ }
1093
+ function parseExtensions($this, reader, ext) {
1094
+ while (reader.j()) {
1095
+ var ev = reader.k();
1096
+ switch (ev.o1_1) {
1097
+ case 1:
1098
+ var ln = reader.a18();
1099
+ // Inline function 'kotlin.text.lowercase' call
1100
+
1101
+ // Inline function 'kotlin.js.asDynamic' call
1102
+
1103
+ switch (ln.toLowerCase()) {
1104
+ case 'power':
1105
+ var tmp2_safe_receiver = readNumeric($this, reader);
1106
+ if (tmp2_safe_receiver == null)
1107
+ null;
1108
+ else {
1109
+ // Inline function 'kotlin.let' call
1110
+ var tmp = ext;
1111
+ var tmp0_elvis_lhs = ext.t1r_1;
1112
+ tmp.t1r_1 = tmp0_elvis_lhs == null ? tmp2_safe_receiver : tmp0_elvis_lhs;
1113
+ }
1114
+
1115
+ break;
1116
+ case 'hr':
1117
+ case 'heartrate':
1118
+ var tmp3_safe_receiver = readNumeric($this, reader);
1119
+ if (tmp3_safe_receiver == null)
1120
+ null;
1121
+ else {
1122
+ // Inline function 'kotlin.let' call
1123
+ if (ext.q1r_1 == null)
1124
+ ext.q1r_1 = numberToInt(tmp3_safe_receiver);
1125
+ }
1126
+
1127
+ break;
1128
+ case 'cad':
1129
+ case 'cadence':
1130
+ var tmp4_safe_receiver = readNumeric($this, reader);
1131
+ if (tmp4_safe_receiver == null)
1132
+ null;
1133
+ else {
1134
+ // Inline function 'kotlin.let' call
1135
+ if (ext.r1r_1 == null)
1136
+ ext.r1r_1 = numberToInt(tmp4_safe_receiver);
1137
+ }
1138
+
1139
+ break;
1140
+ case 'atemp':
1141
+ case 'temperature':
1142
+ case 'temp':
1143
+ var tmp5_safe_receiver = readNumeric($this, reader);
1144
+ if (tmp5_safe_receiver == null)
1145
+ null;
1146
+ else {
1147
+ // Inline function 'kotlin.let' call
1148
+ var tmp_0 = ext;
1149
+ var tmp0_elvis_lhs_0 = ext.s1r_1;
1150
+ tmp_0.s1r_1 = tmp0_elvis_lhs_0 == null ? tmp5_safe_receiver : tmp0_elvis_lhs_0;
1151
+ }
1152
+
1153
+ break;
1154
+ default:
1155
+ parseExtensions($this, reader, ext);
1156
+ break;
1157
+ }
1158
+
1159
+ break;
1160
+ case 2:
1161
+ return Unit_instance;
1162
+ default:
1163
+ break;
1164
+ }
1165
+ }
1166
+ }
1167
+ function readElementText($this, reader) {
1168
+ var sb = StringBuilder_init_$Create$();
1169
+ while (reader.j()) {
1170
+ var ev = reader.k();
1171
+ switch (ev.o1_1) {
1172
+ case 4:
1173
+ case 5:
1174
+ case 9:
1175
+ case 8:
1176
+ sb.v5(reader.f18());
1177
+ break;
1178
+ case 1:
1179
+ skipElement($this, reader);
1180
+ break;
1181
+ case 2:
1182
+ return sb.toString();
1183
+ default:
1184
+ break;
1185
+ }
1186
+ }
1187
+ return sb.toString();
1188
+ }
1189
+ function readNumeric($this, reader) {
1190
+ // Inline function 'kotlin.text.trim' call
1191
+ var this_0 = readElementText($this, reader);
1192
+ var txt = toString_0(trim(isCharSequence(this_0) ? this_0 : THROW_CCE()));
1193
+ return toDoubleOrNull(txt);
1194
+ }
1195
+ function skipElement($this, reader) {
1196
+ var depth = 1;
1197
+ while (reader.j() && depth > 0) {
1198
+ switch (reader.k().o1_1) {
1199
+ case 1:
1200
+ depth = depth + 1 | 0;
1201
+ break;
1202
+ case 2:
1203
+ depth = depth - 1 | 0;
1204
+ break;
1205
+ default:
1206
+ break;
1207
+ }
1208
+ }
1209
+ }
1210
+ function parseTimeIsoToMs($this, text) {
1211
+ var tmp;
1212
+ try {
1213
+ tmp = Companion_getInstance().qd(text).ud();
1214
+ } catch ($p) {
1215
+ var tmp_0;
1216
+ if ($p instanceof IllegalArgumentException) {
1217
+ var e = $p;
1218
+ tmp_0 = null;
1219
+ } else {
1220
+ if ($p instanceof Error) {
1221
+ var e_0 = $p;
1222
+ tmp_0 = null;
1223
+ } else {
1224
+ throw $p;
1225
+ }
1226
+ }
1227
+ tmp = tmp_0;
1228
+ }
1229
+ return tmp;
1230
+ }
1231
+ function ExtensionsAccumulator(heartRate, cadence, temperatureC, powerW) {
1232
+ heartRate = heartRate === VOID ? null : heartRate;
1233
+ cadence = cadence === VOID ? null : cadence;
1234
+ temperatureC = temperatureC === VOID ? null : temperatureC;
1235
+ powerW = powerW === VOID ? null : powerW;
1236
+ this.q1r_1 = heartRate;
1237
+ this.r1r_1 = cadence;
1238
+ this.s1r_1 = temperatureC;
1239
+ this.t1r_1 = powerW;
1240
+ }
1241
+ function GpxParser() {
1242
+ }
1243
+ protoOf(GpxParser).u1r = function (xml, repairOnFailure) {
1244
+ var tmp;
1245
+ try {
1246
+ tmp = parseOnce(this, xml);
1247
+ } catch ($p) {
1248
+ var tmp_0;
1249
+ if ($p instanceof IllegalArgumentException) {
1250
+ var firstFailure = $p;
1251
+ if (!repairOnFailure)
1252
+ throw firstFailure;
1253
+ var repaired = GpxXmlRepair_getInstance().x1r(xml);
1254
+ var tmp_1;
1255
+ try {
1256
+ tmp_1 = parseOnce(this, repaired);
1257
+ } catch ($p_0) {
1258
+ var tmp_2;
1259
+ if ($p_0 instanceof IllegalArgumentException) {
1260
+ var secondFailure = $p_0;
1261
+ throw IllegalArgumentException_init_$Create$('Invalid GPX XML (repair attempted but parsing still failed): ' + secondFailure.message, secondFailure);
1262
+ } else {
1263
+ throw $p_0;
1264
+ }
1265
+ }
1266
+ tmp_0 = tmp_1;
1267
+ } else {
1268
+ throw $p;
1269
+ }
1270
+ tmp = tmp_0;
1271
+ }
1272
+ return tmp;
1273
+ };
1274
+ protoOf(GpxParser).y1r = function (xml, repairOnFailure, $super) {
1275
+ repairOnFailure = repairOnFailure === VOID ? true : repairOnFailure;
1276
+ return $super === VOID ? this.u1r(xml, repairOnFailure) : $super.u1r.call(this, xml, repairOnFailure);
1277
+ };
1278
+ var GpxParser_instance;
1279
+ function GpxParser_getInstance() {
1280
+ return GpxParser_instance;
1281
+ }
1282
+ function get_ALL_KINDS() {
1283
+ _init_properties_GpxToPath_kt__pb67h9();
1284
+ return ALL_KINDS;
1285
+ }
1286
+ var ALL_KINDS;
1287
+ function firstTrackAsPath(_this__u8e3s4) {
1288
+ _init_properties_GpxToPath_kt__pb67h9();
1289
+ var tmp0_elvis_lhs = firstOrNull(_this__u8e3s4.m1q_1);
1290
+ var tmp;
1291
+ if (tmp0_elvis_lhs == null) {
1292
+ // Inline function 'kotlin.error' call
1293
+ var message = 'GpxDocument has no track';
1294
+ throw IllegalStateException_init_$Create$(toString_0(message));
1295
+ } else {
1296
+ tmp = tmp0_elvis_lhs;
1297
+ }
1298
+ var track = tmp;
1299
+ return toPath(track);
1300
+ }
1301
+ function tracksAsPaths(_this__u8e3s4, kinds) {
1302
+ kinds = kinds === VOID ? get_ALL_KINDS() : kinds;
1303
+ _init_properties_GpxToPath_kt__pb67h9();
1304
+ // Inline function 'kotlin.collections.filter' call
1305
+ var tmp0 = _this__u8e3s4.m1q_1;
1306
+ // Inline function 'kotlin.collections.filterTo' call
1307
+ var destination = ArrayList_init_$Create$();
1308
+ var _iterator__ex2g4s = tmp0.i();
1309
+ while (_iterator__ex2g4s.j()) {
1310
+ var element = _iterator__ex2g4s.k();
1311
+ var tmp;
1312
+ if (kinds.e1(element.t1q_1)) {
1313
+ // Inline function 'kotlin.collections.isNotEmpty' call
1314
+ tmp = !element.w1q().n();
1315
+ } else {
1316
+ tmp = false;
1317
+ }
1318
+ if (tmp) {
1319
+ destination.h(element);
1320
+ }
1321
+ }
1322
+ // Inline function 'kotlin.collections.map' call
1323
+ // Inline function 'kotlin.collections.mapTo' call
1324
+ var destination_0 = ArrayList_init_$Create$_0(collectionSizeOrDefault(destination, 10));
1325
+ var _iterator__ex2g4s_0 = destination.i();
1326
+ while (_iterator__ex2g4s_0.j()) {
1327
+ var item = _iterator__ex2g4s_0.k();
1328
+ var tmp$ret$6 = toPath(item);
1329
+ destination_0.h(tmp$ret$6);
1330
+ }
1331
+ return destination_0;
1332
+ }
1333
+ function segmentsAsPaths(_this__u8e3s4, kinds) {
1334
+ kinds = kinds === VOID ? get_ALL_KINDS() : kinds;
1335
+ _init_properties_GpxToPath_kt__pb67h9();
1336
+ // Inline function 'kotlin.collections.filter' call
1337
+ var tmp0 = _this__u8e3s4.m1q_1;
1338
+ // Inline function 'kotlin.collections.filterTo' call
1339
+ var destination = ArrayList_init_$Create$();
1340
+ var _iterator__ex2g4s = tmp0.i();
1341
+ while (_iterator__ex2g4s.j()) {
1342
+ var element = _iterator__ex2g4s.k();
1343
+ if (kinds.e1(element.t1q_1)) {
1344
+ destination.h(element);
1345
+ }
1346
+ }
1347
+ // Inline function 'kotlin.collections.flatMap' call
1348
+ // Inline function 'kotlin.collections.flatMapTo' call
1349
+ var destination_0 = ArrayList_init_$Create$();
1350
+ var _iterator__ex2g4s_0 = destination.i();
1351
+ while (_iterator__ex2g4s_0.j()) {
1352
+ var element_0 = _iterator__ex2g4s_0.k();
1353
+ var list = element_0.s1q_1;
1354
+ addAll(destination_0, list);
1355
+ }
1356
+ // Inline function 'kotlin.collections.filter' call
1357
+ // Inline function 'kotlin.collections.filterTo' call
1358
+ var destination_1 = ArrayList_init_$Create$();
1359
+ var _iterator__ex2g4s_1 = destination_0.i();
1360
+ while (_iterator__ex2g4s_1.j()) {
1361
+ var element_1 = _iterator__ex2g4s_1.k();
1362
+ // Inline function 'kotlin.collections.isNotEmpty' call
1363
+ if (!element_1.v1q_1.n()) {
1364
+ destination_1.h(element_1);
1365
+ }
1366
+ }
1367
+ // Inline function 'kotlin.collections.map' call
1368
+ // Inline function 'kotlin.collections.mapTo' call
1369
+ var destination_2 = ArrayList_init_$Create$_0(collectionSizeOrDefault(destination_1, 10));
1370
+ var _iterator__ex2g4s_2 = destination_1.i();
1371
+ while (_iterator__ex2g4s_2.j()) {
1372
+ var item = _iterator__ex2g4s_2.k();
1373
+ var tmp$ret$12 = toPath_0(item);
1374
+ destination_2.h(tmp$ret$12);
1375
+ }
1376
+ return destination_2;
1377
+ }
1378
+ function toPath(_this__u8e3s4) {
1379
+ _init_properties_GpxToPath_kt__pb67h9();
1380
+ return pointsToPath(_this__u8e3s4.w1q());
1381
+ }
1382
+ function toPath_0(_this__u8e3s4) {
1383
+ _init_properties_GpxToPath_kt__pb67h9();
1384
+ return pointsToPath(_this__u8e3s4.v1q_1);
1385
+ }
1386
+ function pointsToPath(points) {
1387
+ _init_properties_GpxToPath_kt__pb67h9();
1388
+ var path = new Path(points.l());
1389
+ var iterator = points.i();
1390
+ var index = 0;
1391
+ while (iterator.j()) {
1392
+ var i = index;
1393
+ index = index + 1 | 0;
1394
+ var p = iterator.k();
1395
+ path.z1r(i, p.x1q_1 * 0.017453292519943295);
1396
+ path.a1s(i, p.y1q_1 * 0.017453292519943295);
1397
+ var tmp0_elvis_lhs = p.z1q_1;
1398
+ path.b1s(i, tmp0_elvis_lhs == null ? 0.0 : tmp0_elvis_lhs);
1399
+ var tmp1_elvis_lhs = p.a1r_1;
1400
+ path.c1s(i, toNumber(tmp1_elvis_lhs == null ? new Long(0, 0) : tmp1_elvis_lhs));
1401
+ var tmp2_elvis_lhs = p.e1r_1;
1402
+ path.d1s(i, tmp2_elvis_lhs == null ? NaN : tmp2_elvis_lhs);
1403
+ var tmp3_safe_receiver = p.b1r_1;
1404
+ var tmp4_elvis_lhs = tmp3_safe_receiver == null ? null : tmp3_safe_receiver;
1405
+ path.e1s(i, tmp4_elvis_lhs == null ? NaN : tmp4_elvis_lhs);
1406
+ var tmp5_safe_receiver = p.c1r_1;
1407
+ var tmp6_elvis_lhs = tmp5_safe_receiver == null ? null : tmp5_safe_receiver;
1408
+ path.f1s(i, tmp6_elvis_lhs == null ? NaN : tmp6_elvis_lhs);
1409
+ var tmp7_elvis_lhs = p.d1r_1;
1410
+ path.g1s(i, tmp7_elvis_lhs == null ? NaN : tmp7_elvis_lhs);
1411
+ }
1412
+ path.q1s();
1413
+ return path;
1414
+ }
1415
+ var properties_initialized_GpxToPath_kt_83hcm9;
1416
+ function _init_properties_GpxToPath_kt__pb67h9() {
1417
+ if (!properties_initialized_GpxToPath_kt_83hcm9) {
1418
+ properties_initialized_GpxToPath_kt_83hcm9 = true;
1419
+ ALL_KINDS = toSet(get_entries());
1420
+ }
1421
+ }
1422
+ function writeDocument($this, w, document, writeExtensions) {
1423
+ w.f1a('', 'http://www.topografix.com/GPX/1/1');
1424
+ w.f1a('xsi', 'http://www.w3.org/2001/XMLSchema-instance');
1425
+ if (writeExtensions) {
1426
+ w.f1a('gpxtpx', 'http://www.garmin.com/xmlschemas/TrackPointExtension/v1');
1427
+ }
1428
+ w.h1a('http://www.topografix.com/GPX/1/1', 'gpx', '');
1429
+ w.j1a(null, 'version', null, '1.1');
1430
+ w.j1a(null, 'creator', null, '@glandais/vcyclist');
1431
+ w.g1a('', 'http://www.topografix.com/GPX/1/1');
1432
+ w.g1a('xsi', 'http://www.w3.org/2001/XMLSchema-instance');
1433
+ if (writeExtensions) {
1434
+ w.g1a('gpxtpx', 'http://www.garmin.com/xmlschemas/TrackPointExtension/v1');
1435
+ }
1436
+ w.j1a('http://www.w3.org/2001/XMLSchema-instance', 'schemaLocation', 'xsi', 'http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd');
1437
+ writeMetadata($this, w, document.l1q_1);
1438
+ var _iterator__ex2g4s = document.n1q_1.i();
1439
+ while (_iterator__ex2g4s.j()) {
1440
+ var waypoint = _iterator__ex2g4s.k();
1441
+ writeWaypoint($this, w, waypoint);
1442
+ }
1443
+ var _iterator__ex2g4s_0 = document.m1q_1.i();
1444
+ while (_iterator__ex2g4s_0.j()) {
1445
+ var track = _iterator__ex2g4s_0.k();
1446
+ switch (track.t1q_1.o1_1) {
1447
+ case 1:
1448
+ writeRoute($this, w, track, writeExtensions);
1449
+ break;
1450
+ case 0:
1451
+ writeTrack($this, w, track, writeExtensions);
1452
+ break;
1453
+ default:
1454
+ noWhenBranchMatchedException();
1455
+ break;
1456
+ }
1457
+ }
1458
+ w.m1a('http://www.topografix.com/GPX/1/1', 'gpx', '');
1459
+ }
1460
+ function writeWaypoint($this, w, waypoint) {
1461
+ w.h1a('http://www.topografix.com/GPX/1/1', 'wpt', '');
1462
+ w.j1a(null, 'lat', null, waypoint.d1q_1.toString());
1463
+ w.j1a(null, 'lon', null, waypoint.e1q_1.toString());
1464
+ var tmp0_safe_receiver = waypoint.f1q_1;
1465
+ if (tmp0_safe_receiver == null)
1466
+ null;
1467
+ else {
1468
+ // Inline function 'kotlin.let' call
1469
+ writeSimpleText(GpxWriter_instance, w, 'ele', tmp0_safe_receiver.toString());
1470
+ }
1471
+ var tmp1_safe_receiver = waypoint.k1q_1;
1472
+ if (tmp1_safe_receiver == null)
1473
+ null;
1474
+ else {
1475
+ // Inline function 'kotlin.let' call
1476
+ writeSimpleText(GpxWriter_instance, w, 'time', Companion_getInstance().nd(tmp1_safe_receiver).toString());
1477
+ }
1478
+ var tmp2_safe_receiver = waypoint.g1q_1;
1479
+ if (tmp2_safe_receiver == null)
1480
+ null;
1481
+ else {
1482
+ // Inline function 'kotlin.let' call
1483
+ writeSimpleText(GpxWriter_instance, w, 'name', tmp2_safe_receiver);
1484
+ }
1485
+ var tmp3_safe_receiver = waypoint.h1q_1;
1486
+ if (tmp3_safe_receiver == null)
1487
+ null;
1488
+ else {
1489
+ // Inline function 'kotlin.let' call
1490
+ writeSimpleText(GpxWriter_instance, w, 'desc', tmp3_safe_receiver);
1491
+ }
1492
+ var tmp4_safe_receiver = waypoint.i1q_1;
1493
+ if (tmp4_safe_receiver == null)
1494
+ null;
1495
+ else {
1496
+ // Inline function 'kotlin.let' call
1497
+ writeSimpleText(GpxWriter_instance, w, 'sym', tmp4_safe_receiver);
1498
+ }
1499
+ var tmp5_safe_receiver = waypoint.j1q_1;
1500
+ if (tmp5_safe_receiver == null)
1501
+ null;
1502
+ else {
1503
+ // Inline function 'kotlin.let' call
1504
+ writeSimpleText(GpxWriter_instance, w, 'type', tmp5_safe_receiver);
1505
+ }
1506
+ w.m1a('http://www.topografix.com/GPX/1/1', 'wpt', '');
1507
+ }
1508
+ function writeMetadata($this, w, name) {
1509
+ w.h1a('http://www.topografix.com/GPX/1/1', 'metadata', '');
1510
+ writeSimpleText($this, w, 'name', name);
1511
+ w.m1a('http://www.topografix.com/GPX/1/1', 'metadata', '');
1512
+ }
1513
+ function writeTrack($this, w, track, writeExtensions) {
1514
+ w.h1a('http://www.topografix.com/GPX/1/1', 'trk', '');
1515
+ var tmp0_safe_receiver = track.q1q_1;
1516
+ if (tmp0_safe_receiver == null)
1517
+ null;
1518
+ else {
1519
+ // Inline function 'kotlin.let' call
1520
+ writeSimpleText(GpxWriter_instance, w, 'name', tmp0_safe_receiver);
1521
+ }
1522
+ var tmp1_safe_receiver = track.r1q_1;
1523
+ if (tmp1_safe_receiver == null)
1524
+ null;
1525
+ else {
1526
+ // Inline function 'kotlin.let' call
1527
+ writeSimpleText(GpxWriter_instance, w, 'type', tmp1_safe_receiver);
1528
+ }
1529
+ var _iterator__ex2g4s = track.s1q_1.i();
1530
+ while (_iterator__ex2g4s.j()) {
1531
+ var segment = _iterator__ex2g4s.k();
1532
+ w.h1a('http://www.topografix.com/GPX/1/1', 'trkseg', '');
1533
+ var _iterator__ex2g4s_0 = segment.v1q_1.i();
1534
+ while (_iterator__ex2g4s_0.j()) {
1535
+ var p = _iterator__ex2g4s_0.k();
1536
+ writeTrackPoint($this, w, p, writeExtensions);
1537
+ }
1538
+ w.m1a('http://www.topografix.com/GPX/1/1', 'trkseg', '');
1539
+ }
1540
+ w.m1a('http://www.topografix.com/GPX/1/1', 'trk', '');
1541
+ }
1542
+ function writeRoute($this, w, route, writeExtensions) {
1543
+ w.h1a('http://www.topografix.com/GPX/1/1', 'rte', '');
1544
+ var tmp0_safe_receiver = route.q1q_1;
1545
+ if (tmp0_safe_receiver == null)
1546
+ null;
1547
+ else {
1548
+ // Inline function 'kotlin.let' call
1549
+ writeSimpleText(GpxWriter_instance, w, 'name', tmp0_safe_receiver);
1550
+ }
1551
+ var tmp1_safe_receiver = route.r1q_1;
1552
+ if (tmp1_safe_receiver == null)
1553
+ null;
1554
+ else {
1555
+ // Inline function 'kotlin.let' call
1556
+ writeSimpleText(GpxWriter_instance, w, 'type', tmp1_safe_receiver);
1557
+ }
1558
+ var _iterator__ex2g4s = route.w1q().i();
1559
+ while (_iterator__ex2g4s.j()) {
1560
+ var p = _iterator__ex2g4s.k();
1561
+ writeTrackPoint($this, w, p, writeExtensions, 'rtept');
1562
+ }
1563
+ w.m1a('http://www.topografix.com/GPX/1/1', 'rte', '');
1564
+ }
1565
+ function writeTrackPoint($this, w, p, writeExtensions, localName) {
1566
+ localName = localName === VOID ? 'trkpt' : localName;
1567
+ w.h1a('http://www.topografix.com/GPX/1/1', localName, '');
1568
+ w.j1a(null, 'lat', null, p.x1q_1.toString());
1569
+ w.j1a(null, 'lon', null, p.y1q_1.toString());
1570
+ var tmp0_safe_receiver = p.a1r_1;
1571
+ if (tmp0_safe_receiver == null)
1572
+ null;
1573
+ else {
1574
+ // Inline function 'kotlin.let' call
1575
+ writeSimpleText(GpxWriter_instance, w, 'time', Companion_getInstance().nd(tmp0_safe_receiver).toString());
1576
+ }
1577
+ var tmp1_safe_receiver = p.z1q_1;
1578
+ if (tmp1_safe_receiver == null)
1579
+ null;
1580
+ else {
1581
+ // Inline function 'kotlin.let' call
1582
+ writeSimpleText(GpxWriter_instance, w, 'ele', tmp1_safe_receiver.toString());
1583
+ }
1584
+ var hasGarminExt = !(p.b1r_1 == null) || !(p.c1r_1 == null) || !(p.d1r_1 == null);
1585
+ var hasPower = !(p.e1r_1 == null);
1586
+ if (writeExtensions && (hasGarminExt || hasPower)) {
1587
+ w.h1a('http://www.topografix.com/GPX/1/1', 'extensions', '');
1588
+ if (hasPower) {
1589
+ writeSimpleText($this, w, 'power', p.e1r_1.toString());
1590
+ }
1591
+ if (hasGarminExt) {
1592
+ w.h1a('http://www.garmin.com/xmlschemas/TrackPointExtension/v1', 'TrackPointExtension', 'gpxtpx');
1593
+ var tmp2_safe_receiver = p.b1r_1;
1594
+ if (tmp2_safe_receiver == null)
1595
+ null;
1596
+ else {
1597
+ // Inline function 'kotlin.let' call
1598
+ writeNamespaced(GpxWriter_instance, w, 'http://www.garmin.com/xmlschemas/TrackPointExtension/v1', 'hr', 'gpxtpx', tmp2_safe_receiver.toString());
1599
+ }
1600
+ var tmp3_safe_receiver = p.c1r_1;
1601
+ if (tmp3_safe_receiver == null)
1602
+ null;
1603
+ else {
1604
+ // Inline function 'kotlin.let' call
1605
+ writeNamespaced(GpxWriter_instance, w, 'http://www.garmin.com/xmlschemas/TrackPointExtension/v1', 'cad', 'gpxtpx', tmp3_safe_receiver.toString());
1606
+ }
1607
+ var tmp4_safe_receiver = p.d1r_1;
1608
+ if (tmp4_safe_receiver == null)
1609
+ null;
1610
+ else {
1611
+ // Inline function 'kotlin.let' call
1612
+ writeNamespaced(GpxWriter_instance, w, 'http://www.garmin.com/xmlschemas/TrackPointExtension/v1', 'atemp', 'gpxtpx', tmp4_safe_receiver.toString());
1613
+ }
1614
+ w.m1a('http://www.garmin.com/xmlschemas/TrackPointExtension/v1', 'TrackPointExtension', 'gpxtpx');
1615
+ }
1616
+ w.m1a('http://www.topografix.com/GPX/1/1', 'extensions', '');
1617
+ }
1618
+ w.m1a('http://www.topografix.com/GPX/1/1', localName, '');
1619
+ }
1620
+ function writeSimpleText($this, w, localName, text) {
1621
+ w.h1a('http://www.topografix.com/GPX/1/1', localName, '');
1622
+ w.i1a(text);
1623
+ w.m1a('http://www.topografix.com/GPX/1/1', localName, '');
1624
+ }
1625
+ function writeNamespaced($this, w, namespace, localName, prefix, text) {
1626
+ w.h1a(namespace, localName, prefix);
1627
+ w.i1a(text);
1628
+ w.m1a(namespace, localName, prefix);
1629
+ }
1630
+ function GpxWriter() {
1631
+ this.r1s_1 = 'http://www.topografix.com/GPX/1/1';
1632
+ this.s1s_1 = 'http://www.w3.org/2001/XMLSchema-instance';
1633
+ this.t1s_1 = 'http://www.garmin.com/xmlschemas/TrackPointExtension/v1';
1634
+ this.u1s_1 = 'xsi';
1635
+ this.v1s_1 = 'gpxtpx';
1636
+ this.w1s_1 = 'http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd';
1637
+ this.x1s_1 = '@glandais/vcyclist';
1638
+ }
1639
+ protoOf(GpxWriter).y1s = function (document, writeExtensions) {
1640
+ var out = StringBuilder_init_$Create$();
1641
+ out.v5('<?xml version="1.0" encoding="UTF-8"?>\n');
1642
+ var writer = newGenericWriter(get_xmlStreaming(), out, false, XmlDeclMode_None_getInstance());
1643
+ try {
1644
+ writeDocument(this, writer, document, writeExtensions);
1645
+ }finally {
1646
+ writer.n18();
1647
+ }
1648
+ return out.toString();
1649
+ };
1650
+ protoOf(GpxWriter).z1s = function (paths, name, trackNames, waypoints, startTime, writeExtensions) {
1651
+ return this.y1s(pathsToGpxDocument(paths, name, trackNames, waypoints, VOID, startTime), writeExtensions);
1652
+ };
1653
+ protoOf(GpxWriter).a1t = function (paths, name, trackNames, waypoints, startTime, writeExtensions, $super) {
1654
+ name = name === VOID ? 'noname' : name;
1655
+ trackNames = trackNames === VOID ? null : trackNames;
1656
+ waypoints = waypoints === VOID ? emptyList() : waypoints;
1657
+ startTime = startTime === VOID ? null : startTime;
1658
+ writeExtensions = writeExtensions === VOID ? true : writeExtensions;
1659
+ return $super === VOID ? this.z1s(paths, name, trackNames, waypoints, startTime, writeExtensions) : $super.z1s.call(this, paths, name, trackNames, waypoints, startTime, writeExtensions);
1660
+ };
1661
+ var GpxWriter_instance;
1662
+ function GpxWriter_getInstance() {
1663
+ return GpxWriter_instance;
1664
+ }
1665
+ function stripBom($this, xml) {
1666
+ var tmp;
1667
+ var tmp_0;
1668
+ // Inline function 'kotlin.text.isNotEmpty' call
1669
+ if (charSequenceLength(xml) > 0) {
1670
+ tmp_0 = charCodeAt(xml, 0) === _Char___init__impl__6a9atx(65279);
1671
+ } else {
1672
+ tmp_0 = false;
1673
+ }
1674
+ if (tmp_0) {
1675
+ tmp = substring(xml, 1);
1676
+ } else {
1677
+ tmp = null;
1678
+ }
1679
+ return tmp;
1680
+ }
1681
+ function stripIllegalControlChars($this, xml) {
1682
+ var count = 0;
1683
+ var sb = null;
1684
+ var i = 0;
1685
+ var n = xml.length;
1686
+ $l$loop: while (i < n) {
1687
+ var c = charCodeAt(xml, i);
1688
+ if (isHighSurrogate(c) && (i + 1 | 0) < n && isLowSurrogate(charCodeAt(xml, i + 1 | 0))) {
1689
+ var tmp0_safe_receiver = sb;
1690
+ var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.w5(c);
1691
+ if (tmp1_safe_receiver == null)
1692
+ null;
1693
+ else
1694
+ tmp1_safe_receiver.w5(charCodeAt(xml, i + 1 | 0));
1695
+ i = i + 2 | 0;
1696
+ continue $l$loop;
1697
+ }
1698
+ // Inline function 'kotlin.code' call
1699
+ var code = Char__toInt_impl_vasixd(c);
1700
+ var allowed = code === 9 || code === 10 || code === 13 || (32 <= code ? code <= 55295 : false) || (57344 <= code ? code <= 65533 : false);
1701
+ if (allowed) {
1702
+ var tmp2_safe_receiver = sb;
1703
+ if (tmp2_safe_receiver == null)
1704
+ null;
1705
+ else
1706
+ tmp2_safe_receiver.w5(c);
1707
+ } else {
1708
+ if (sb == null)
1709
+ sb = StringBuilder_init_$Create$_0(xml.length).y8(xml, 0, i);
1710
+ count = count + 1 | 0;
1711
+ }
1712
+ i = i + 1 | 0;
1713
+ }
1714
+ return count > 0 ? new Pair(toString(sb), count) : null;
1715
+ }
1716
+ function escapeBareAmpersands($this, xml) {
1717
+ var count = 0;
1718
+ var sb = null;
1719
+ var i = 0;
1720
+ var n = xml.length;
1721
+ while (i < n) {
1722
+ var c = charCodeAt(xml, i);
1723
+ if (c === _Char___init__impl__6a9atx(38)) {
1724
+ if (!(findReferenceEnd($this, xml, i) === -1)) {
1725
+ var tmp0_safe_receiver = sb;
1726
+ if (tmp0_safe_receiver == null)
1727
+ null;
1728
+ else
1729
+ tmp0_safe_receiver.w5(c);
1730
+ } else {
1731
+ if (sb == null)
1732
+ sb = StringBuilder_init_$Create$_0(xml.length + 16 | 0).y8(xml, 0, i);
1733
+ sb.v5('&amp;');
1734
+ count = count + 1 | 0;
1735
+ }
1736
+ } else {
1737
+ var tmp1_safe_receiver = sb;
1738
+ if (tmp1_safe_receiver == null)
1739
+ null;
1740
+ else
1741
+ tmp1_safe_receiver.w5(c);
1742
+ }
1743
+ i = i + 1 | 0;
1744
+ }
1745
+ return count > 0 ? new Pair(toString(sb), count) : null;
1746
+ }
1747
+ function recombineSurrogatePairReferences($this, xml) {
1748
+ var refs = findNumericReferences($this, xml);
1749
+ if (refs.l() < 2)
1750
+ return null;
1751
+ var count = 0;
1752
+ var sb = StringBuilder_init_$Create$_0(xml.length);
1753
+ var copiedUpTo = 0;
1754
+ var i = 0;
1755
+ while (i < refs.l()) {
1756
+ var high = refs.m(i);
1757
+ var low = getOrNull(refs, i + 1 | 0);
1758
+ if (!(low == null) && high.c1t_1 === low.b1t_1 && isHighSurrogate_0($this, high.d1t_1) && isLowSurrogate_0($this, low.d1t_1)) {
1759
+ sb.y8(xml, copiedUpTo, high.b1t_1);
1760
+ var codePoint = (65536 + imul(high.d1t_1 - 55296 | 0, 1024) | 0) + (low.d1t_1 - 56320 | 0) | 0;
1761
+ sb.v5('&#').a9(codePoint).w5(_Char___init__impl__6a9atx(59));
1762
+ copiedUpTo = low.c1t_1;
1763
+ count = count + 1 | 0;
1764
+ i = i + 2 | 0;
1765
+ } else {
1766
+ i = i + 1 | 0;
1767
+ }
1768
+ }
1769
+ if (count === 0)
1770
+ return null;
1771
+ sb.y8(xml, copiedUpTo, xml.length);
1772
+ return new Pair(sb.toString(), count);
1773
+ }
1774
+ function NumericRef(start, end, value) {
1775
+ this.b1t_1 = start;
1776
+ this.c1t_1 = end;
1777
+ this.d1t_1 = value;
1778
+ }
1779
+ protoOf(NumericRef).toString = function () {
1780
+ return 'NumericRef(start=' + this.b1t_1 + ', end=' + this.c1t_1 + ', value=' + this.d1t_1 + ')';
1781
+ };
1782
+ protoOf(NumericRef).hashCode = function () {
1783
+ var result = this.b1t_1;
1784
+ result = imul(result, 31) + this.c1t_1 | 0;
1785
+ result = imul(result, 31) + this.d1t_1 | 0;
1786
+ return result;
1787
+ };
1788
+ protoOf(NumericRef).equals = function (other) {
1789
+ if (this === other)
1790
+ return true;
1791
+ if (!(other instanceof NumericRef))
1792
+ return false;
1793
+ if (!(this.b1t_1 === other.b1t_1))
1794
+ return false;
1795
+ if (!(this.c1t_1 === other.c1t_1))
1796
+ return false;
1797
+ if (!(this.d1t_1 === other.d1t_1))
1798
+ return false;
1799
+ return true;
1800
+ };
1801
+ function findNumericReferences($this, xml) {
1802
+ // Inline function 'kotlin.collections.mutableListOf' call
1803
+ var refs = ArrayList_init_$Create$();
1804
+ var i = 0;
1805
+ var n = xml.length;
1806
+ $l$loop: while (i < n) {
1807
+ if (charCodeAt(xml, i) === _Char___init__impl__6a9atx(38) && (i + 1 | 0) < n && charCodeAt(xml, i + 1 | 0) === _Char___init__impl__6a9atx(35)) {
1808
+ var end = findReferenceEnd($this, xml, i);
1809
+ if (!(end === -1)) {
1810
+ var value = parseNumericReferenceValue($this, substring_0(xml, i + 2 | 0, end));
1811
+ if (!(value === -1)) {
1812
+ refs.h(new NumericRef(i, end + 1 | 0, value));
1813
+ }
1814
+ i = end + 1 | 0;
1815
+ continue $l$loop;
1816
+ }
1817
+ }
1818
+ i = i + 1 | 0;
1819
+ }
1820
+ return refs;
1821
+ }
1822
+ function parseNumericReferenceValue($this, body) {
1823
+ var tmp;
1824
+ try {
1825
+ var tmp_0;
1826
+ // Inline function 'kotlin.text.isNotEmpty' call
1827
+ if (charSequenceLength(body) > 0) {
1828
+ tmp_0 = charCodeAt(body, 0) === _Char___init__impl__6a9atx(120) || charCodeAt(body, 0) === _Char___init__impl__6a9atx(88);
1829
+ } else {
1830
+ tmp_0 = false;
1831
+ }
1832
+ var hex = tmp_0;
1833
+ var raw = toLong(hex ? substring(body, 1) : body, hex ? 16 : 10);
1834
+ var tmp_1;
1835
+ // Inline function 'kotlin.ranges.contains' call
1836
+ var this_0 = numberRangeToNumber(0, 1114111);
1837
+ if (contains(isInterface(this_0, ClosedRange) ? this_0 : THROW_CCE(), raw)) {
1838
+ tmp_1 = convertToInt(raw);
1839
+ } else {
1840
+ tmp_1 = -1;
1841
+ }
1842
+ tmp = tmp_1;
1843
+ } catch ($p) {
1844
+ var tmp_2;
1845
+ if ($p instanceof NumberFormatException) {
1846
+ var e = $p;
1847
+ tmp_2 = -1;
1848
+ } else {
1849
+ throw $p;
1850
+ }
1851
+ tmp = tmp_2;
1852
+ }
1853
+ return tmp;
1854
+ }
1855
+ function isHighSurrogate_0($this, codePoint) {
1856
+ return 55296 <= codePoint ? codePoint <= 56319 : false;
1857
+ }
1858
+ function isLowSurrogate_0($this, codePoint) {
1859
+ return 56320 <= codePoint ? codePoint <= 57343 : false;
1860
+ }
1861
+ function findReferenceEnd($this, xml, amp) {
1862
+ var n = xml.length;
1863
+ var j = amp + 1 | 0;
1864
+ if (j >= n)
1865
+ return -1;
1866
+ if (charCodeAt(xml, j) === _Char___init__impl__6a9atx(35)) {
1867
+ j = j + 1 | 0;
1868
+ var hex = j < n && (charCodeAt(xml, j) === _Char___init__impl__6a9atx(120) || charCodeAt(xml, j) === _Char___init__impl__6a9atx(88));
1869
+ if (hex) {
1870
+ j = j + 1 | 0;
1871
+ }
1872
+ var digitsStart = j;
1873
+ while (j < n && (j - digitsStart | 0) < 20 && (hex ? isHexDigit($this, charCodeAt(xml, j)) : isDigit(charCodeAt(xml, j)))) {
1874
+ j = j + 1 | 0;
1875
+ }
1876
+ return j > digitsStart && j < n && charCodeAt(xml, j) === _Char___init__impl__6a9atx(59) ? j : -1;
1877
+ }
1878
+ var nameStart = j;
1879
+ while (j < n && (j - nameStart | 0) < 20 && !(charCodeAt(xml, j) === _Char___init__impl__6a9atx(59)) && !(charCodeAt(xml, j) === _Char___init__impl__6a9atx(38)) && !isWhitespace(charCodeAt(xml, j))) {
1880
+ j = j + 1 | 0;
1881
+ }
1882
+ if (j >= n || !(charCodeAt(xml, j) === _Char___init__impl__6a9atx(59)))
1883
+ return -1;
1884
+ return $this.v1r_1.e1(substring_0(xml, nameStart, j)) ? j : -1;
1885
+ }
1886
+ function isHexDigit($this, $receiver) {
1887
+ return isDigit($receiver) || (_Char___init__impl__6a9atx(97) <= $receiver ? $receiver <= _Char___init__impl__6a9atx(102) : false) || (_Char___init__impl__6a9atx(65) <= $receiver ? $receiver <= _Char___init__impl__6a9atx(70) : false);
1888
+ }
1889
+ function GpxXmlRepair() {
1890
+ GpxXmlRepair_instance = this;
1891
+ this.v1r_1 = setOf(['amp', 'lt', 'gt', 'apos', 'quot']);
1892
+ this.w1r_1 = 20;
1893
+ }
1894
+ protoOf(GpxXmlRepair).x1r = function (xml) {
1895
+ return this.g1t(xml).e1t_1;
1896
+ };
1897
+ protoOf(GpxXmlRepair).g1t = function (xml) {
1898
+ // Inline function 'kotlin.collections.mutableListOf' call
1899
+ var repairs = ArrayList_init_$Create$();
1900
+ var current = xml;
1901
+ var tmp0_safe_receiver = stripBom(this, current);
1902
+ if (tmp0_safe_receiver == null)
1903
+ null;
1904
+ else {
1905
+ // Inline function 'kotlin.let' call
1906
+ current = tmp0_safe_receiver;
1907
+ // Inline function 'kotlin.collections.plusAssign' call
1908
+ var element = 'removed leading UTF-8 BOM (U+FEFF)';
1909
+ repairs.h(element);
1910
+ }
1911
+ var tmp1_safe_receiver = stripIllegalControlChars(this, current);
1912
+ if (tmp1_safe_receiver == null)
1913
+ null;
1914
+ else {
1915
+ // Inline function 'kotlin.let' call
1916
+ var repairedXml = tmp1_safe_receiver.qe();
1917
+ var count = tmp1_safe_receiver.re();
1918
+ current = repairedXml;
1919
+ // Inline function 'kotlin.collections.plusAssign' call
1920
+ var element_0 = 'removed ' + count + ' illegal XML 1.0 control character(s)';
1921
+ repairs.h(element_0);
1922
+ }
1923
+ var tmp2_safe_receiver = recombineSurrogatePairReferences(this, current);
1924
+ if (tmp2_safe_receiver == null)
1925
+ null;
1926
+ else {
1927
+ // Inline function 'kotlin.let' call
1928
+ var repairedXml_0 = tmp2_safe_receiver.qe();
1929
+ var count_0 = tmp2_safe_receiver.re();
1930
+ current = repairedXml_0;
1931
+ // Inline function 'kotlin.collections.plusAssign' call
1932
+ var element_1 = 'recombined ' + count_0 + ' surrogate-pair numeric character reference(s)';
1933
+ repairs.h(element_1);
1934
+ }
1935
+ var tmp3_safe_receiver = escapeBareAmpersands(this, current);
1936
+ if (tmp3_safe_receiver == null)
1937
+ null;
1938
+ else {
1939
+ // Inline function 'kotlin.let' call
1940
+ var repairedXml_1 = tmp3_safe_receiver.qe();
1941
+ var count_1 = tmp3_safe_receiver.re();
1942
+ current = repairedXml_1;
1943
+ // Inline function 'kotlin.collections.plusAssign' call
1944
+ var element_2 = 'escaped ' + count_1 + " bare '&' character(s)";
1945
+ repairs.h(element_2);
1946
+ }
1947
+ return new RepairResult(current, repairs);
1948
+ };
1949
+ var GpxXmlRepair_instance;
1950
+ function GpxXmlRepair_getInstance() {
1951
+ if (GpxXmlRepair_instance == null)
1952
+ new GpxXmlRepair();
1953
+ return GpxXmlRepair_instance;
1954
+ }
1955
+ function RepairResult(xml, repairs) {
1956
+ this.e1t_1 = xml;
1957
+ this.f1t_1 = repairs;
1958
+ }
1959
+ protoOf(RepairResult).toString = function () {
1960
+ return 'RepairResult(xml=' + this.e1t_1 + ', repairs=' + toString_0(this.f1t_1) + ')';
1961
+ };
1962
+ protoOf(RepairResult).hashCode = function () {
1963
+ var result = getStringHashCode(this.e1t_1);
1964
+ result = imul(result, 31) + hashCode(this.f1t_1) | 0;
1965
+ return result;
1966
+ };
1967
+ protoOf(RepairResult).equals = function (other) {
1968
+ if (this === other)
1969
+ return true;
1970
+ if (!(other instanceof RepairResult))
1971
+ return false;
1972
+ if (!(this.e1t_1 === other.e1t_1))
1973
+ return false;
1974
+ if (!equals(this.f1t_1, other.f1t_1))
1975
+ return false;
1976
+ return true;
1977
+ };
1978
+ function formatShortestRoundTrip($this, value) {
1979
+ var inductionVariable = 0;
1980
+ if (inductionVariable <= 12)
1981
+ do {
1982
+ var d = inductionVariable;
1983
+ inductionVariable = inductionVariable + 1 | 0;
1984
+ var candidate = formatFixed($this, value, d);
1985
+ if (toDouble(candidate) === value)
1986
+ return candidate;
1987
+ }
1988
+ while (inductionVariable <= 12);
1989
+ return formatFixed($this, value, 12);
1990
+ }
1991
+ function formatFixed($this, value, decimals) {
1992
+ var negative = value < 0.0;
1993
+ // Inline function 'kotlin.math.abs' call
1994
+ var absValue = Math.abs(value);
1995
+ var scale = toNumber($this.i1t_1[decimals]);
1996
+ var scaledLong = numberToLong(round(absValue * scale));
1997
+ var whole = $this.i1t_1[decimals];
1998
+ var intPart = divide(scaledLong, whole);
1999
+ var sign = negative && !equalsLong(scaledLong, new Long(0, 0)) ? '-' : '';
2000
+ var tmp;
2001
+ if (decimals === 0) {
2002
+ tmp = sign + intPart.toString();
2003
+ } else {
2004
+ var fracPart = padStart(modulo(scaledLong, whole).toString(), decimals, _Char___init__impl__6a9atx(48));
2005
+ tmp = sign + intPart.toString() + '.' + fracPart;
2006
+ }
2007
+ return tmp;
2008
+ }
2009
+ function CsvNumberFormat() {
2010
+ CsvNumberFormat_instance = this;
2011
+ this.h1t_1 = 12;
2012
+ var tmp = this;
2013
+ // Inline function 'kotlin.also' call
2014
+ var this_0 = longArray(13);
2015
+ var p = new Long(1, 0);
2016
+ var inductionVariable = 0;
2017
+ var last = this_0.length - 1 | 0;
2018
+ if (inductionVariable <= last)
2019
+ do {
2020
+ var i = inductionVariable;
2021
+ inductionVariable = inductionVariable + 1 | 0;
2022
+ this_0[i] = p;
2023
+ p = multiply(p, new Long(10, 0));
2024
+ }
2025
+ while (inductionVariable <= last);
2026
+ tmp.i1t_1 = this_0;
2027
+ }
2028
+ protoOf(CsvNumberFormat).j1t = function (value, decimals) {
2029
+ if (isNaN_0(value))
2030
+ return '';
2031
+ if (isInfinite(value))
2032
+ return value > 0 ? 'Infinity' : '-Infinity';
2033
+ var tmp;
2034
+ if (!(decimals == null)) {
2035
+ // Inline function 'kotlin.require' call
2036
+ if (!(0 <= decimals ? decimals <= 12 : false)) {
2037
+ var message = 'decimals must be in 0..12, was ' + decimals;
2038
+ throw IllegalArgumentException_init_$Create$_0(toString_0(message));
2039
+ }
2040
+ tmp = formatFixed(this, value, decimals);
2041
+ } else {
2042
+ tmp = formatShortestRoundTrip(this, value);
2043
+ }
2044
+ return tmp;
2045
+ };
2046
+ var CsvNumberFormat_instance;
2047
+ function CsvNumberFormat_getInstance() {
2048
+ if (CsvNumberFormat_instance == null)
2049
+ new CsvNumberFormat();
2050
+ return CsvNumberFormat_instance;
2051
+ }
2052
+ function headerFor($this, field, unitsInHeader) {
2053
+ return unitsInHeader ? field.m1t_1 + ' (' + field.n1t_1 + ')' : field.m1t_1;
2054
+ }
2055
+ function appendRow($this, sb, cells, options) {
2056
+ var iterator = cells.i();
2057
+ var index = 0;
2058
+ while (iterator.j()) {
2059
+ var i = index;
2060
+ index = index + 1 | 0;
2061
+ var cell = iterator.k();
2062
+ if (i > 0) {
2063
+ sb.w5(options.t1t_1);
2064
+ }
2065
+ sb.v5(escapeCsvCell($this, cell, options.t1t_1));
2066
+ }
2067
+ }
2068
+ function escapeCsvCell($this, cell, separator) {
2069
+ var tmp$ret$0;
2070
+ $l$block: {
2071
+ // Inline function 'kotlin.text.any' call
2072
+ var inductionVariable = 0;
2073
+ while (inductionVariable < charSequenceLength(cell)) {
2074
+ var element = charSequenceGet(cell, inductionVariable);
2075
+ inductionVariable = inductionVariable + 1 | 0;
2076
+ if (element === separator || element === _Char___init__impl__6a9atx(34) || element === _Char___init__impl__6a9atx(10) || element === _Char___init__impl__6a9atx(13)) {
2077
+ tmp$ret$0 = true;
2078
+ break $l$block;
2079
+ }
2080
+ }
2081
+ tmp$ret$0 = false;
2082
+ }
2083
+ var needsQuoting = tmp$ret$0;
2084
+ var tmp;
2085
+ if (needsQuoting) {
2086
+ tmp = '"' + replace(cell, '"', '""') + '"';
2087
+ } else {
2088
+ tmp = cell;
2089
+ }
2090
+ return tmp;
2091
+ }
2092
+ function CsvWriter() {
2093
+ }
2094
+ protoOf(CsvWriter).x1t = function (path, options) {
2095
+ var tmp0_elvis_lhs = options.s1t_1;
2096
+ var fields = tmp0_elvis_lhs == null ? get_entries_0() : tmp0_elvis_lhs;
2097
+ var sb = StringBuilder_init_$Create$();
2098
+ // Inline function 'kotlin.collections.map' call
2099
+ // Inline function 'kotlin.collections.mapTo' call
2100
+ var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(fields, 10));
2101
+ var _iterator__ex2g4s = fields.i();
2102
+ while (_iterator__ex2g4s.j()) {
2103
+ var item = _iterator__ex2g4s.k();
2104
+ var tmp$ret$2 = headerFor(CsvWriter_instance, item, options.u1t_1);
2105
+ destination.h(tmp$ret$2);
2106
+ }
2107
+ appendRow(this, sb, destination, options);
2108
+ var inductionVariable = 0;
2109
+ var last = path.f1r_1;
2110
+ if (inductionVariable < last)
2111
+ do {
2112
+ var i = inductionVariable;
2113
+ inductionVariable = inductionVariable + 1 | 0;
2114
+ sb.v5(options.w1t_1);
2115
+ // Inline function 'kotlin.collections.map' call
2116
+ // Inline function 'kotlin.collections.mapTo' call
2117
+ var destination_0 = ArrayList_init_$Create$_0(collectionSizeOrDefault(fields, 10));
2118
+ var _iterator__ex2g4s_0 = fields.i();
2119
+ while (_iterator__ex2g4s_0.j()) {
2120
+ var item_0 = _iterator__ex2g4s_0.k();
2121
+ var tmp$ret$5 = CsvNumberFormat_getInstance().j1t(path.y1t(i, item_0), options.v1t_1);
2122
+ destination_0.h(tmp$ret$5);
2123
+ }
2124
+ appendRow(this, sb, destination_0, options);
2125
+ }
2126
+ while (inductionVariable < last);
2127
+ return sb.toString();
2128
+ };
2129
+ var CsvWriter_instance;
2130
+ function CsvWriter_getInstance() {
2131
+ return CsvWriter_instance;
2132
+ }
2133
+ function CsvOptions(fields, separator, unitsInHeader, decimals, lineSeparator) {
2134
+ fields = fields === VOID ? null : fields;
2135
+ separator = separator === VOID ? _Char___init__impl__6a9atx(44) : separator;
2136
+ unitsInHeader = unitsInHeader === VOID ? true : unitsInHeader;
2137
+ decimals = decimals === VOID ? null : decimals;
2138
+ lineSeparator = lineSeparator === VOID ? '\n' : lineSeparator;
2139
+ this.s1t_1 = fields;
2140
+ this.t1t_1 = separator;
2141
+ this.u1t_1 = unitsInHeader;
2142
+ this.v1t_1 = decimals;
2143
+ this.w1t_1 = lineSeparator;
2144
+ }
2145
+ protoOf(CsvOptions).toString = function () {
2146
+ return 'CsvOptions(fields=' + toString(this.s1t_1) + ', separator=' + toString_1(this.t1t_1) + ', unitsInHeader=' + this.u1t_1 + ', decimals=' + this.v1t_1 + ', lineSeparator=' + this.w1t_1 + ')';
2147
+ };
2148
+ protoOf(CsvOptions).hashCode = function () {
2149
+ var result = this.s1t_1 == null ? 0 : hashCode(this.s1t_1);
2150
+ result = imul(result, 31) + Char__hashCode_impl_otmys(this.t1t_1) | 0;
2151
+ result = imul(result, 31) + getBooleanHashCode(this.u1t_1) | 0;
2152
+ result = imul(result, 31) + (this.v1t_1 == null ? 0 : this.v1t_1) | 0;
2153
+ result = imul(result, 31) + getStringHashCode(this.w1t_1) | 0;
2154
+ return result;
2155
+ };
2156
+ protoOf(CsvOptions).equals = function (other) {
2157
+ if (this === other)
2158
+ return true;
2159
+ if (!(other instanceof CsvOptions))
2160
+ return false;
2161
+ if (!equals(this.s1t_1, other.s1t_1))
2162
+ return false;
2163
+ if (!(this.t1t_1 === other.t1t_1))
2164
+ return false;
2165
+ if (!(this.u1t_1 === other.u1t_1))
2166
+ return false;
2167
+ if (!(this.v1t_1 == other.v1t_1))
2168
+ return false;
2169
+ if (!(this.w1t_1 === other.w1t_1))
2170
+ return false;
2171
+ return true;
2172
+ };
2173
+ function appendMeta($this, sb, path, fields, decimals, indent, nl, colon) {
2174
+ var inner = indent + indent;
2175
+ appendKeyRaw($this, sb, indent, 'meta', colon);
2176
+ sb.w5(_Char___init__impl__6a9atx(123)).v5(nl);
2177
+ appendKeyValueRaw($this, sb, inner, 'totalDistance', numberOrNull($this, path.j1s_1, decimals), colon);
2178
+ sb.w5(_Char___init__impl__6a9atx(44)).v5(nl);
2179
+ appendKeyValueRaw($this, sb, inner, 'durationMs', numberOrNull($this, path.o1s_1, decimals), colon);
2180
+ sb.w5(_Char___init__impl__6a9atx(44)).v5(nl);
2181
+ appendKeyValueRaw($this, sb, inner, 'elevationGain', numberOrNull($this, path.m1s_1, decimals), colon);
2182
+ sb.w5(_Char___init__impl__6a9atx(44)).v5(nl);
2183
+ appendKeyValueRaw($this, sb, inner, 'elevationLoss', numberOrNull($this, path.n1s_1, decimals), colon);
2184
+ sb.w5(_Char___init__impl__6a9atx(44)).v5(nl);
2185
+ appendKeyRaw($this, sb, inner, 'units', colon);
2186
+ sb.w5(_Char___init__impl__6a9atx(123)).v5(nl);
2187
+ var innerUnits = inner + indent;
2188
+ var iterator = fields.i();
2189
+ var index = 0;
2190
+ while (iterator.j()) {
2191
+ var i = index;
2192
+ index = index + 1 | 0;
2193
+ var field = iterator.k();
2194
+ appendKeyValueRaw($this, sb, innerUnits, $this.z1t(field.m1t_1), '"' + $this.z1t(field.n1t_1) + '"', colon);
2195
+ if (!(i === get_lastIndex(fields))) {
2196
+ sb.w5(_Char___init__impl__6a9atx(44));
2197
+ }
2198
+ sb.v5(nl);
2199
+ }
2200
+ sb.v5(inner).w5(_Char___init__impl__6a9atx(125)).v5(nl);
2201
+ sb.v5(indent).w5(_Char___init__impl__6a9atx(125));
2202
+ }
2203
+ function appendFields($this, sb, path, fields, options, indent, nl, colon) {
2204
+ sb.w5(_Char___init__impl__6a9atx(123)).v5(nl);
2205
+ var inner = indent + indent;
2206
+ var iterator = fields.i();
2207
+ var index = 0;
2208
+ while (iterator.j()) {
2209
+ var fi = index;
2210
+ index = index + 1 | 0;
2211
+ var field = iterator.k();
2212
+ appendKeyRaw($this, sb, inner, $this.z1t(field.m1t_1), colon);
2213
+ sb.w5(_Char___init__impl__6a9atx(91));
2214
+ var inductionVariable = 0;
2215
+ var last = path.f1r_1;
2216
+ if (inductionVariable < last)
2217
+ do {
2218
+ var i = inductionVariable;
2219
+ inductionVariable = inductionVariable + 1 | 0;
2220
+ if (i > 0) {
2221
+ sb.w5(_Char___init__impl__6a9atx(44));
2222
+ }
2223
+ sb.v5(numberOrNull($this, path.y1t(i, field), options.c1u_1));
2224
+ }
2225
+ while (inductionVariable < last);
2226
+ sb.w5(_Char___init__impl__6a9atx(93));
2227
+ if (!(fi === get_lastIndex(fields))) {
2228
+ sb.w5(_Char___init__impl__6a9atx(44));
2229
+ }
2230
+ sb.v5(nl);
2231
+ }
2232
+ sb.v5(indent).w5(_Char___init__impl__6a9atx(125));
2233
+ }
2234
+ function numberOrNull($this, value, decimals) {
2235
+ decimals = decimals === VOID ? null : decimals;
2236
+ var tmp;
2237
+ if (isNaN_0(value) || isInfinite(value)) {
2238
+ tmp = 'null';
2239
+ } else {
2240
+ tmp = CsvNumberFormat_getInstance().j1t(value, decimals);
2241
+ }
2242
+ return tmp;
2243
+ }
2244
+ function appendKeyRaw($this, sb, indent, key, colon) {
2245
+ sb.v5(indent).w5(_Char___init__impl__6a9atx(34)).v5(key).w5(_Char___init__impl__6a9atx(34)).v5(colon);
2246
+ }
2247
+ function appendKeyValueRaw($this, sb, indent, key, rawValue, colon) {
2248
+ appendKeyRaw($this, sb, indent, key, colon);
2249
+ sb.v5(rawValue);
2250
+ }
2251
+ function JsonWriter() {
2252
+ }
2253
+ protoOf(JsonWriter).e1u = function (path, options) {
2254
+ var tmp0_elvis_lhs = options.a1u_1;
2255
+ var fields = tmp0_elvis_lhs == null ? get_entries_0() : tmp0_elvis_lhs;
2256
+ var sb = StringBuilder_init_$Create$();
2257
+ var indent = options.b1u_1 ? ' ' : '';
2258
+ var nl = options.b1u_1 ? '\n' : '';
2259
+ var colon = options.b1u_1 ? ': ' : ':';
2260
+ sb.w5(_Char___init__impl__6a9atx(123)).v5(nl);
2261
+ appendKeyValueRaw(this, sb, indent, 'size', path.f1r_1.toString(), colon);
2262
+ sb.w5(_Char___init__impl__6a9atx(44)).v5(nl);
2263
+ if (options.d1u_1) {
2264
+ appendMeta(this, sb, path, fields, options.c1u_1, indent, nl, colon);
2265
+ sb.w5(_Char___init__impl__6a9atx(44)).v5(nl);
2266
+ }
2267
+ appendKeyRaw(this, sb, indent, 'fields', colon);
2268
+ appendFields(this, sb, path, fields, options, indent, nl, colon);
2269
+ sb.v5(nl).w5(_Char___init__impl__6a9atx(125));
2270
+ return sb.toString();
2271
+ };
2272
+ protoOf(JsonWriter).z1t = function (value) {
2273
+ var sb = StringBuilder_init_$Create$_0(value.length);
2274
+ var inductionVariable = 0;
2275
+ var last = value.length;
2276
+ while (inductionVariable < last) {
2277
+ var c = charCodeAt(value, inductionVariable);
2278
+ inductionVariable = inductionVariable + 1 | 0;
2279
+ if (c === _Char___init__impl__6a9atx(34))
2280
+ sb.v5('\\"');
2281
+ else if (c === _Char___init__impl__6a9atx(92))
2282
+ sb.v5('\\\\');
2283
+ else if (c === _Char___init__impl__6a9atx(10))
2284
+ sb.v5('\\n');
2285
+ else if (c === _Char___init__impl__6a9atx(13))
2286
+ sb.v5('\\r');
2287
+ else if (c === _Char___init__impl__6a9atx(9))
2288
+ sb.v5('\\t');
2289
+ else {
2290
+ // Inline function 'kotlin.code' call
2291
+ if (Char__toInt_impl_vasixd(c) < 32) {
2292
+ var tmp = sb.v5('\\u');
2293
+ // Inline function 'kotlin.code' call
2294
+ var tmp$ret$1 = Char__toInt_impl_vasixd(c);
2295
+ tmp.v5(padStart(toString_2(tmp$ret$1, 16), 4, _Char___init__impl__6a9atx(48)));
2296
+ } else {
2297
+ sb.w5(c);
2298
+ }
2299
+ }
2300
+ }
2301
+ return sb.toString();
2302
+ };
2303
+ var JsonWriter_instance;
2304
+ function JsonWriter_getInstance() {
2305
+ return JsonWriter_instance;
2306
+ }
2307
+ function JsonOptions(fields, pretty, decimals, includeMeta) {
2308
+ fields = fields === VOID ? null : fields;
2309
+ pretty = pretty === VOID ? false : pretty;
2310
+ decimals = decimals === VOID ? null : decimals;
2311
+ includeMeta = includeMeta === VOID ? true : includeMeta;
2312
+ this.a1u_1 = fields;
2313
+ this.b1u_1 = pretty;
2314
+ this.c1u_1 = decimals;
2315
+ this.d1u_1 = includeMeta;
2316
+ }
2317
+ protoOf(JsonOptions).toString = function () {
2318
+ return 'JsonOptions(fields=' + toString(this.a1u_1) + ', pretty=' + this.b1u_1 + ', decimals=' + this.c1u_1 + ', includeMeta=' + this.d1u_1 + ')';
2319
+ };
2320
+ protoOf(JsonOptions).hashCode = function () {
2321
+ var result = this.a1u_1 == null ? 0 : hashCode(this.a1u_1);
2322
+ result = imul(result, 31) + getBooleanHashCode(this.b1u_1) | 0;
2323
+ result = imul(result, 31) + (this.c1u_1 == null ? 0 : this.c1u_1) | 0;
2324
+ result = imul(result, 31) + getBooleanHashCode(this.d1u_1) | 0;
2325
+ return result;
2326
+ };
2327
+ protoOf(JsonOptions).equals = function (other) {
2328
+ if (this === other)
2329
+ return true;
2330
+ if (!(other instanceof JsonOptions))
2331
+ return false;
2332
+ if (!equals(this.a1u_1, other.a1u_1))
2333
+ return false;
2334
+ if (!(this.b1u_1 === other.b1u_1))
2335
+ return false;
2336
+ if (!(this.c1u_1 == other.c1u_1))
2337
+ return false;
2338
+ if (!(this.d1u_1 === other.d1u_1))
2339
+ return false;
2340
+ return true;
2341
+ };
2342
+ function copyAllSlots($this, source) {
2343
+ var out = new Path(source.f1r_1);
2344
+ var inductionVariable = 0;
2345
+ var last = source.f1r_1;
2346
+ if (inductionVariable < last)
2347
+ do {
2348
+ var i = inductionVariable;
2349
+ inductionVariable = inductionVariable + 1 | 0;
2350
+ var _iterator__ex2g4s = get_entries_0().i();
2351
+ while (_iterator__ex2g4s.j()) {
2352
+ var field = _iterator__ex2g4s.k();
2353
+ out.f1u(i, field, source.y1t(i, field));
2354
+ }
2355
+ }
2356
+ while (inductionVariable < last);
2357
+ return out;
2358
+ }
2359
+ function $fixElevationCOROUTINE$(_this__u8e3s4, source, provider, resultContinuation) {
2360
+ CoroutineImpl.call(this, resultContinuation);
2361
+ this.o1u_1 = _this__u8e3s4;
2362
+ this.p1u_1 = source;
2363
+ this.q1u_1 = provider;
2364
+ }
2365
+ protoOf($fixElevationCOROUTINE$).p6 = function () {
2366
+ var suspendResult = this.j6_1;
2367
+ $sm: do
2368
+ try {
2369
+ var tmp = this.h6_1;
2370
+ switch (tmp) {
2371
+ case 0:
2372
+ this.i6_1 = 2;
2373
+ if (this.p1u_1.f1r_1 === 0)
2374
+ return new Path(0);
2375
+ var size = this.p1u_1.f1r_1;
2376
+ var list = ArrayList_init_$Create$_0(size);
2377
+ var inductionVariable = 0;
2378
+ if (inductionVariable < size)
2379
+ do {
2380
+ var index = inductionVariable;
2381
+ inductionVariable = inductionVariable + 1 | 0;
2382
+ list.h(new LatLon(this.p1u_1.h1r(index) * 57.29577951308232, this.p1u_1.i1r(index) * 57.29577951308232));
2383
+ }
2384
+ while (inductionVariable < size);
2385
+ var coords = list;
2386
+ this.h6_1 = 1;
2387
+ suspendResult = this.q1u_1.s10(coords, VOID, this);
2388
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
2389
+ return suspendResult;
2390
+ }
2391
+
2392
+ continue $sm;
2393
+ case 1:
2394
+ var corrected = suspendResult;
2395
+ var out = copyAllSlots(this.o1u_1, this.p1u_1);
2396
+ var inductionVariable_0 = 0;
2397
+ var last = out.f1r_1;
2398
+ if (inductionVariable_0 < last)
2399
+ do {
2400
+ var i = inductionVariable_0;
2401
+ inductionVariable_0 = inductionVariable_0 + 1 | 0;
2402
+ out.b1s(i, corrected.m(i).ww());
2403
+ }
2404
+ while (inductionVariable_0 < last);
2405
+ out.q1s();
2406
+ return out;
2407
+ case 2:
2408
+ throw this.k6_1;
2409
+ }
2410
+ } catch ($p) {
2411
+ var e = $p;
2412
+ if (this.i6_1 === 2) {
2413
+ throw e;
2414
+ } else {
2415
+ this.h6_1 = this.i6_1;
2416
+ this.k6_1 = e;
2417
+ }
2418
+ }
2419
+ while (true);
2420
+ };
2421
+ function ElevationStep() {
2422
+ this.r1u_1 = 150.0;
2423
+ }
2424
+ protoOf(ElevationStep).s1u = function (source, provider, $completion) {
2425
+ var tmp = new $fixElevationCOROUTINE$(this, source, provider, $completion);
2426
+ tmp.j6_1 = Unit_instance;
2427
+ tmp.k6_1 = null;
2428
+ return tmp.p6();
2429
+ };
2430
+ protoOf(ElevationStep).t1u = function (source, windowM) {
2431
+ if (source.f1r_1 === 0)
2432
+ return new Path(0);
2433
+ // Inline function 'kotlin.collections.List' call
2434
+ // Inline function 'kotlin.collections.MutableList' call
2435
+ var size = source.f1r_1;
2436
+ var list = ArrayList_init_$Create$_0(size);
2437
+ // Inline function 'kotlin.repeat' call
2438
+ var inductionVariable = 0;
2439
+ if (inductionVariable < size)
2440
+ do {
2441
+ var index = inductionVariable;
2442
+ inductionVariable = inductionVariable + 1 | 0;
2443
+ var tmp$ret$4 = source.u1u(index);
2444
+ list.h(tmp$ret$4);
2445
+ }
2446
+ while (inductionVariable < size);
2447
+ var coords = list;
2448
+ var smoothed = ElevationSmoother_instance.nw(coords, windowM);
2449
+ var out = copyAllSlots(this, source);
2450
+ var inductionVariable_0 = 0;
2451
+ var last = out.f1r_1;
2452
+ if (inductionVariable_0 < last)
2453
+ do {
2454
+ var i = inductionVariable_0;
2455
+ inductionVariable_0 = inductionVariable_0 + 1 | 0;
2456
+ out.b1s(i, smoothed.m(i).ww());
2457
+ }
2458
+ while (inductionVariable_0 < last);
2459
+ out.q1s();
2460
+ return out;
2461
+ };
2462
+ protoOf(ElevationStep).v1u = function (source, windowM, $super) {
2463
+ windowM = windowM === VOID ? 150.0 : windowM;
2464
+ return $super === VOID ? this.t1u(source, windowM) : $super.t1u.call(this, source, windowM);
2465
+ };
2466
+ var ElevationStep_instance;
2467
+ function ElevationStep_getInstance() {
2468
+ return ElevationStep_instance;
2469
+ }
2470
+ function GeneratedPath(size) {
2471
+ this.f1r_1 = size;
2472
+ // Inline function 'kotlin.require' call
2473
+ if (!(this.f1r_1 >= 0)) {
2474
+ var message = 'Negative size: ' + this.f1r_1;
2475
+ throw IllegalArgumentException_init_$Create$_0(toString_0(message));
2476
+ }
2477
+ this.g1r_1 = new Float64Array(imul(this.f1r_1, 36));
2478
+ }
2479
+ protoOf(GeneratedPath).y1t = function (i, field) {
2480
+ return this.g1r_1[imul(i, 36) + field.o1_1 | 0];
2481
+ };
2482
+ protoOf(GeneratedPath).f1u = function (i, field, v) {
2483
+ this.g1r_1[imul(i, 36) + field.o1_1 | 0] = v;
2484
+ };
2485
+ protoOf(GeneratedPath).h1r = function (i) {
2486
+ return this.g1r_1[imul(i, 36) + 0 | 0];
2487
+ };
2488
+ protoOf(GeneratedPath).z1r = function (i, v) {
2489
+ this.g1r_1[imul(i, 36) + 0 | 0] = v;
2490
+ };
2491
+ protoOf(GeneratedPath).i1r = function (i) {
2492
+ return this.g1r_1[imul(i, 36) + 1 | 0];
2493
+ };
2494
+ protoOf(GeneratedPath).a1s = function (i, v) {
2495
+ this.g1r_1[imul(i, 36) + 1 | 0] = v;
2496
+ };
2497
+ protoOf(GeneratedPath).w1u = function (i) {
2498
+ return this.g1r_1[imul(i, 36) + 2 | 0];
2499
+ };
2500
+ protoOf(GeneratedPath).x1u = function (i, v) {
2501
+ this.g1r_1[imul(i, 36) + 2 | 0] = v;
2502
+ };
2503
+ protoOf(GeneratedPath).y1u = function (i, v) {
2504
+ this.g1r_1[imul(i, 36) + 3 | 0] = v;
2505
+ };
2506
+ protoOf(GeneratedPath).k1r = function (i) {
2507
+ return this.g1r_1[imul(i, 36) + 4 | 0];
2508
+ };
2509
+ protoOf(GeneratedPath).c1s = function (i, v) {
2510
+ this.g1r_1[imul(i, 36) + 4 | 0] = v;
2511
+ };
2512
+ protoOf(GeneratedPath).z1u = function (i) {
2513
+ return this.g1r_1[imul(i, 36) + 5 | 0];
2514
+ };
2515
+ protoOf(GeneratedPath).a1v = function (i, v) {
2516
+ this.g1r_1[imul(i, 36) + 5 | 0] = v;
2517
+ };
2518
+ protoOf(GeneratedPath).b1v = function (i) {
2519
+ return this.g1r_1[imul(i, 36) + 6 | 0];
2520
+ };
2521
+ protoOf(GeneratedPath).c1v = function (i, v) {
2522
+ this.g1r_1[imul(i, 36) + 6 | 0] = v;
2523
+ };
2524
+ protoOf(GeneratedPath).d1v = function (i) {
2525
+ return this.g1r_1[imul(i, 36) + 7 | 0];
2526
+ };
2527
+ protoOf(GeneratedPath).e1v = function (i, v) {
2528
+ this.g1r_1[imul(i, 36) + 7 | 0] = v;
2529
+ };
2530
+ protoOf(GeneratedPath).j1r = function (i) {
2531
+ return this.g1r_1[imul(i, 36) + 8 | 0];
2532
+ };
2533
+ protoOf(GeneratedPath).b1s = function (i, v) {
2534
+ this.g1r_1[imul(i, 36) + 8 | 0] = v;
2535
+ };
2536
+ protoOf(GeneratedPath).f1v = function (i) {
2537
+ return this.g1r_1[imul(i, 36) + 9 | 0];
2538
+ };
2539
+ protoOf(GeneratedPath).g1v = function (i, v) {
2540
+ this.g1r_1[imul(i, 36) + 9 | 0] = v;
2541
+ };
2542
+ protoOf(GeneratedPath).h1v = function (i, v) {
2543
+ this.g1r_1[imul(i, 36) + 10 | 0] = v;
2544
+ };
2545
+ protoOf(GeneratedPath).i1v = function (i, v) {
2546
+ this.g1r_1[imul(i, 36) + 11 | 0] = v;
2547
+ };
2548
+ protoOf(GeneratedPath).j1v = function (i, v) {
2549
+ this.g1r_1[imul(i, 36) + 12 | 0] = v;
2550
+ };
2551
+ protoOf(GeneratedPath).k1v = function (i, v) {
2552
+ this.g1r_1[imul(i, 36) + 13 | 0] = v;
2553
+ };
2554
+ protoOf(GeneratedPath).l1v = function (i, v) {
2555
+ this.g1r_1[imul(i, 36) + 14 | 0] = v;
2556
+ };
2557
+ protoOf(GeneratedPath).m1v = function (i, v) {
2558
+ this.g1r_1[imul(i, 36) + 15 | 0] = v;
2559
+ };
2560
+ protoOf(GeneratedPath).n1v = function (i, v) {
2561
+ this.g1r_1[imul(i, 36) + 16 | 0] = v;
2562
+ };
2563
+ protoOf(GeneratedPath).o1v = function (i, v) {
2564
+ this.g1r_1[imul(i, 36) + 17 | 0] = v;
2565
+ };
2566
+ protoOf(GeneratedPath).o1r = function (i) {
2567
+ return this.g1r_1[imul(i, 36) + 18 | 0];
2568
+ };
2569
+ protoOf(GeneratedPath).d1s = function (i, v) {
2570
+ this.g1r_1[imul(i, 36) + 18 | 0] = v;
2571
+ };
2572
+ protoOf(GeneratedPath).p1v = function (i, v) {
2573
+ this.g1r_1[imul(i, 36) + 19 | 0] = v;
2574
+ };
2575
+ protoOf(GeneratedPath).q1v = function (i, v) {
2576
+ this.g1r_1[imul(i, 36) + 20 | 0] = v;
2577
+ };
2578
+ protoOf(GeneratedPath).r1v = function (i, v) {
2579
+ this.g1r_1[imul(i, 36) + 21 | 0] = v;
2580
+ };
2581
+ protoOf(GeneratedPath).s1v = function (i, v) {
2582
+ this.g1r_1[imul(i, 36) + 22 | 0] = v;
2583
+ };
2584
+ protoOf(GeneratedPath).t1v = function (i, v) {
2585
+ this.g1r_1[imul(i, 36) + 23 | 0] = v;
2586
+ };
2587
+ protoOf(GeneratedPath).u1v = function (i, v) {
2588
+ this.g1r_1[imul(i, 36) + 24 | 0] = v;
2589
+ };
2590
+ protoOf(GeneratedPath).v1v = function (i, v) {
2591
+ this.g1r_1[imul(i, 36) + 25 | 0] = v;
2592
+ };
2593
+ protoOf(GeneratedPath).p1r = function (i) {
2594
+ return this.g1r_1[imul(i, 36) + 26 | 0];
2595
+ };
2596
+ protoOf(GeneratedPath).w1v = function (i, v) {
2597
+ this.g1r_1[imul(i, 36) + 26 | 0] = v;
2598
+ };
2599
+ protoOf(GeneratedPath).x1v = function (i) {
2600
+ return this.g1r_1[imul(i, 36) + 27 | 0];
2601
+ };
2602
+ protoOf(GeneratedPath).y1v = function (i, v) {
2603
+ this.g1r_1[imul(i, 36) + 27 | 0] = v;
2604
+ };
2605
+ protoOf(GeneratedPath).z1v = function (i) {
2606
+ return this.g1r_1[imul(i, 36) + 28 | 0];
2607
+ };
2608
+ protoOf(GeneratedPath).a1w = function (i, v) {
2609
+ this.g1r_1[imul(i, 36) + 28 | 0] = v;
2610
+ };
2611
+ protoOf(GeneratedPath).b1w = function (i, v) {
2612
+ this.g1r_1[imul(i, 36) + 29 | 0] = v;
2613
+ };
2614
+ protoOf(GeneratedPath).c1w = function (i, v) {
2615
+ this.g1r_1[imul(i, 36) + 30 | 0] = v;
2616
+ };
2617
+ protoOf(GeneratedPath).n1r = function (i) {
2618
+ return this.g1r_1[imul(i, 36) + 31 | 0];
2619
+ };
2620
+ protoOf(GeneratedPath).g1s = function (i, v) {
2621
+ this.g1r_1[imul(i, 36) + 31 | 0] = v;
2622
+ };
2623
+ protoOf(GeneratedPath).d1w = function (i, v) {
2624
+ this.g1r_1[imul(i, 36) + 32 | 0] = v;
2625
+ };
2626
+ protoOf(GeneratedPath).e1w = function (i, v) {
2627
+ this.g1r_1[imul(i, 36) + 33 | 0] = v;
2628
+ };
2629
+ protoOf(GeneratedPath).l1r = function (i) {
2630
+ return this.g1r_1[imul(i, 36) + 34 | 0];
2631
+ };
2632
+ protoOf(GeneratedPath).e1s = function (i, v) {
2633
+ this.g1r_1[imul(i, 36) + 34 | 0] = v;
2634
+ };
2635
+ protoOf(GeneratedPath).m1r = function (i) {
2636
+ return this.g1r_1[imul(i, 36) + 35 | 0];
2637
+ };
2638
+ protoOf(GeneratedPath).f1s = function (i, v) {
2639
+ this.g1r_1[imul(i, 36) + 35 | 0] = v;
2640
+ };
2641
+ function Companion_0() {
2642
+ Companion_instance_0 = this;
2643
+ this.f1w_1 = new BoundsRad(0.0, 0.0, 0.0, 0.0);
2644
+ }
2645
+ var Companion_instance_0;
2646
+ function Companion_getInstance_1() {
2647
+ if (Companion_instance_0 == null)
2648
+ new Companion_0();
2649
+ return Companion_instance_0;
2650
+ }
2651
+ function BoundsRad(minLat, maxLat, minLon, maxLon) {
2652
+ Companion_getInstance_1();
2653
+ this.g1w_1 = minLat;
2654
+ this.h1w_1 = maxLat;
2655
+ this.i1w_1 = minLon;
2656
+ this.j1w_1 = maxLon;
2657
+ }
2658
+ protoOf(BoundsRad).toString = function () {
2659
+ return 'BoundsRad(minLat=' + this.g1w_1 + ', maxLat=' + this.h1w_1 + ', minLon=' + this.i1w_1 + ', maxLon=' + this.j1w_1 + ')';
2660
+ };
2661
+ protoOf(BoundsRad).hashCode = function () {
2662
+ var result = getNumberHashCode(this.g1w_1);
2663
+ result = imul(result, 31) + getNumberHashCode(this.h1w_1) | 0;
2664
+ result = imul(result, 31) + getNumberHashCode(this.i1w_1) | 0;
2665
+ result = imul(result, 31) + getNumberHashCode(this.j1w_1) | 0;
2666
+ return result;
2667
+ };
2668
+ protoOf(BoundsRad).equals = function (other) {
2669
+ if (this === other)
2670
+ return true;
2671
+ if (!(other instanceof BoundsRad))
2672
+ return false;
2673
+ if (!equals(this.g1w_1, other.g1w_1))
2674
+ return false;
2675
+ if (!equals(this.h1w_1, other.h1w_1))
2676
+ return false;
2677
+ if (!equals(this.i1w_1, other.i1w_1))
2678
+ return false;
2679
+ if (!equals(this.j1w_1, other.j1w_1))
2680
+ return false;
2681
+ return true;
2682
+ };
2683
+ function copyStatsFrom($this, other) {
2684
+ $this.j1s_1 = other.j1s_1;
2685
+ $this.k1s_1 = other.k1s_1;
2686
+ $this.l1s_1 = other.l1s_1;
2687
+ $this.m1s_1 = other.m1s_1;
2688
+ $this.n1s_1 = other.n1s_1;
2689
+ $this.o1s_1 = other.o1s_1;
2690
+ $this.p1s_1 = other.p1s_1;
2691
+ }
2692
+ function resetStats($this) {
2693
+ $this.j1s_1 = 0.0;
2694
+ $this.k1s_1 = 0.0;
2695
+ $this.l1s_1 = 0.0;
2696
+ $this.m1s_1 = 0.0;
2697
+ $this.n1s_1 = 0.0;
2698
+ $this.o1s_1 = 0.0;
2699
+ $this.p1s_1 = Companion_getInstance_1().f1w_1;
2700
+ }
2701
+ function computeBearing($this, from, to) {
2702
+ var lat1 = $this.h1r(from);
2703
+ var lon1 = $this.i1r(from);
2704
+ var lat2 = $this.h1r(to);
2705
+ var lon2 = $this.i1r(to);
2706
+ // Inline function 'kotlin.math.cos' call
2707
+ var x1 = lon1 * Math.cos(lat1);
2708
+ var y1 = lat1;
2709
+ // Inline function 'kotlin.math.cos' call
2710
+ var x2 = lon2 * Math.cos(lat2);
2711
+ var y2 = lat2;
2712
+ var dy = y2 - y1;
2713
+ var dx = x2 - x1;
2714
+ // Inline function 'kotlin.math.atan2' call
2715
+ var y = -dy;
2716
+ return Math.atan2(y, dx);
2717
+ }
2718
+ function Companion_1() {
2719
+ }
2720
+ var Companion_instance_1;
2721
+ function Companion_getInstance_2() {
2722
+ return Companion_instance_1;
2723
+ }
2724
+ function Path(size) {
2725
+ GeneratedPath.call(this, size);
2726
+ this.j1s_1 = 0.0;
2727
+ this.k1s_1 = 0.0;
2728
+ this.l1s_1 = 0.0;
2729
+ this.m1s_1 = 0.0;
2730
+ this.n1s_1 = 0.0;
2731
+ this.o1s_1 = 0.0;
2732
+ this.p1s_1 = Companion_getInstance_1().f1w_1;
2733
+ }
2734
+ protoOf(Path).k1w = function () {
2735
+ return until(0, this.f1r_1);
2736
+ };
2737
+ protoOf(Path).l1w = function (i) {
2738
+ return this.h1r(i) * 57.29577951308232;
2739
+ };
2740
+ protoOf(Path).m1w = function (i) {
2741
+ return this.i1r(i) * 57.29577951308232;
2742
+ };
2743
+ protoOf(Path).u1u = function (i) {
2744
+ return new LatLonElevation(this.l1w(i), this.m1w(i), this.j1r(i));
2745
+ };
2746
+ protoOf(Path).n1w = function () {
2747
+ var out = new Path(this.f1r_1);
2748
+ var tmp0 = this.g1r_1;
2749
+ var tmp2 = out.g1r_1;
2750
+ // Inline function 'kotlin.collections.copyInto' call
2751
+ var endIndex = this.g1r_1.length;
2752
+ // Inline function 'kotlin.js.unsafeCast' call
2753
+ // Inline function 'kotlin.js.asDynamic' call
2754
+ var tmp = tmp0;
2755
+ // Inline function 'kotlin.js.unsafeCast' call
2756
+ // Inline function 'kotlin.js.asDynamic' call
2757
+ arrayCopy(tmp, tmp2, 0, 0, endIndex);
2758
+ copyStatsFrom(out, this);
2759
+ return out;
2760
+ };
2761
+ protoOf(Path).q1s = function () {
2762
+ resetStats(this);
2763
+ if (this.f1r_1 === 0)
2764
+ return Unit_instance;
2765
+ var timeStart = this.k1r(0);
2766
+ var cumDist = 0.0;
2767
+ var minLat = Infinity;
2768
+ var maxLat = -Infinity;
2769
+ var minLon = Infinity;
2770
+ var maxLon = -Infinity;
2771
+ var minEle = Infinity;
2772
+ var maxEle = -Infinity;
2773
+ var gain = 0.0;
2774
+ var loss = 0.0;
2775
+ var inductionVariable = 0;
2776
+ var last = this.f1r_1;
2777
+ if (inductionVariable < last)
2778
+ do {
2779
+ var i = inductionVariable;
2780
+ inductionVariable = inductionVariable + 1 | 0;
2781
+ var lat = this.h1r(i);
2782
+ var lon = this.i1r(i);
2783
+ var ele = this.j1r(i);
2784
+ // Inline function 'kotlin.math.min' call
2785
+ var a = minLat;
2786
+ minLat = Math.min(a, lat);
2787
+ // Inline function 'kotlin.math.max' call
2788
+ var a_0 = maxLat;
2789
+ maxLat = Math.max(a_0, lat);
2790
+ // Inline function 'kotlin.math.min' call
2791
+ var a_1 = minLon;
2792
+ minLon = Math.min(a_1, lon);
2793
+ // Inline function 'kotlin.math.max' call
2794
+ var a_2 = maxLon;
2795
+ maxLon = Math.max(a_2, lon);
2796
+ // Inline function 'kotlin.math.min' call
2797
+ var a_3 = minEle;
2798
+ minEle = Math.min(a_3, ele);
2799
+ // Inline function 'kotlin.math.max' call
2800
+ var a_4 = maxEle;
2801
+ maxEle = Math.max(a_4, ele);
2802
+ if (i > 0) {
2803
+ var prevCoord = new LatLon(this.l1w(i - 1 | 0), this.m1w(i - 1 | 0));
2804
+ var curCoord = new LatLon(this.l1w(i), this.m1w(i));
2805
+ cumDist = cumDist + Distance_instance.rw(prevCoord, curCoord);
2806
+ var dEle = ele - this.j1r(i - 1 | 0);
2807
+ if (dEle > 0)
2808
+ gain = gain + dEle;
2809
+ else
2810
+ loss = loss + dEle;
2811
+ }
2812
+ this.x1u(i, cumDist);
2813
+ }
2814
+ while (inductionVariable < last);
2815
+ this.j1s_1 = cumDist;
2816
+ this.k1s_1 = minEle === Infinity ? 0.0 : minEle;
2817
+ this.l1s_1 = maxEle === -Infinity ? 0.0 : maxEle;
2818
+ this.m1s_1 = gain;
2819
+ this.n1s_1 = loss;
2820
+ this.p1s_1 = new BoundsRad(minLat, maxLat, minLon, maxLon);
2821
+ this.o1s_1 = this.f1r_1 >= 2 ? this.k1r(this.f1r_1 - 1 | 0) - timeStart : 0.0;
2822
+ var inductionVariable_0 = 0;
2823
+ var last_0 = this.f1r_1;
2824
+ if (inductionVariable_0 < last_0)
2825
+ $l$loop: do {
2826
+ var i_0 = inductionVariable_0;
2827
+ inductionVariable_0 = inductionVariable_0 + 1 | 0;
2828
+ this.a1v(i_0, (this.k1r(i_0) - timeStart) / 1000.0);
2829
+ if (this.f1r_1 <= 1)
2830
+ continue $l$loop;
2831
+ // Inline function 'kotlin.math.max' call
2832
+ var b = i_0 - 1 | 0;
2833
+ var im1 = Math.max(0, b);
2834
+ var tmp0 = this.f1r_1 - 1 | 0;
2835
+ // Inline function 'kotlin.math.min' call
2836
+ var b_0 = i_0 + 1 | 0;
2837
+ var ip1 = Math.min(tmp0, b_0);
2838
+ this.e1v(i_0, computeBearing(this, im1, ip1));
2839
+ var dDist = (this.w1u(ip1) - this.w1u(im1)) / 2.0;
2840
+ var dEle_0 = (this.j1r(ip1) - this.j1r(im1)) / 2.0;
2841
+ var grade = dDist === 0.0 ? 0.0 : dEle_0 / dDist;
2842
+ this.g1v(i_0, grade);
2843
+ var dTime = (this.k1r(ip1) - this.k1r(im1)) / 2000.0;
2844
+ this.y1u(i_0, dDist);
2845
+ this.c1v(i_0, dTime);
2846
+ this.y1v(i_0, dTime === 0.0 ? 0.0 : dDist / dTime);
2847
+ }
2848
+ while (inductionVariable_0 < last_0);
2849
+ };
2850
+ function PathSimplifier() {
2851
+ }
2852
+ protoOf(PathSimplifier).o1w = function (path, toleranceM, zExaggeration) {
2853
+ if (path.f1r_1 <= 2)
2854
+ return path.n1w();
2855
+ var coords = ArrayList_init_$Create$_0(path.f1r_1);
2856
+ var inductionVariable = 0;
2857
+ var last = path.f1r_1;
2858
+ if (inductionVariable < last)
2859
+ do {
2860
+ var i = inductionVariable;
2861
+ inductionVariable = inductionVariable + 1 | 0;
2862
+ // Inline function 'kotlin.collections.plusAssign' call
2863
+ var element = new LatLonElevation(path.h1r(i) * 57.29577951308232, path.i1r(i) * 57.29577951308232, path.j1r(i));
2864
+ coords.h(element);
2865
+ }
2866
+ while (inductionVariable < last);
2867
+ var simplified = DouglasPeucker_instance.ow(coords, toleranceM, zExaggeration);
2868
+ var retainedIndices = ArrayList_init_$Create$_0(simplified.l());
2869
+ var cursor = 0;
2870
+ var _iterator__ex2g4s = simplified.i();
2871
+ while (_iterator__ex2g4s.j()) {
2872
+ var kept = _iterator__ex2g4s.k();
2873
+ while (cursor < coords.l() && !(coords.m(cursor) === kept)) {
2874
+ cursor = cursor + 1 | 0;
2875
+ }
2876
+ if (cursor === coords.l()) {
2877
+ // Inline function 'kotlin.error' call
2878
+ var message = 'PathSimplifier: retained point not found in source';
2879
+ throw IllegalStateException_init_$Create$(toString_0(message));
2880
+ }
2881
+ // Inline function 'kotlin.collections.plusAssign' call
2882
+ var element_0 = cursor;
2883
+ retainedIndices.h(element_0);
2884
+ cursor = cursor + 1 | 0;
2885
+ }
2886
+ var out = new Path(retainedIndices.l());
2887
+ var iterator = retainedIndices.i();
2888
+ var index = 0;
2889
+ while (iterator.j()) {
2890
+ var dstIdx = index;
2891
+ index = index + 1 | 0;
2892
+ var srcIdx = iterator.k();
2893
+ var _iterator__ex2g4s_0 = get_entries_0().i();
2894
+ while (_iterator__ex2g4s_0.j()) {
2895
+ var field = _iterator__ex2g4s_0.k();
2896
+ out.f1u(dstIdx, field, path.y1t(srcIdx, field));
2897
+ }
2898
+ }
2899
+ out.q1s();
2900
+ return out;
2901
+ };
2902
+ var PathSimplifier_instance;
2903
+ function PathSimplifier_getInstance() {
2904
+ return PathSimplifier_instance;
2905
+ }
2906
+ var PointField_LATITUDE_instance;
2907
+ var PointField_LONGITUDE_instance;
2908
+ var PointField_DISTANCE_instance;
2909
+ var PointField_DX_instance;
2910
+ var PointField_TIME_instance;
2911
+ var PointField_ELAPSED_instance;
2912
+ var PointField_DT_instance;
2913
+ var PointField_BEARING_instance;
2914
+ var PointField_ELEVATION_instance;
2915
+ var PointField_GRADE_instance;
2916
+ var PointField_RADIUS_instance;
2917
+ var PointField_AERO_COEF_instance;
2918
+ var PointField_WIND_BEARING_instance;
2919
+ var PointField_WIND_ALPHA_instance;
2920
+ var PointField_P_AERO_instance;
2921
+ var PointField_P_GRAVITY_instance;
2922
+ var PointField_P_ROLLING_RESISTANCE_instance;
2923
+ var PointField_P_WHEEL_BEARINGS_instance;
2924
+ var PointField_P_INPUT_POWER_instance;
2925
+ var PointField_P_CYCLIST_PROVIDED_OPTIMAL_POWER_instance;
2926
+ var PointField_P_CYCLIST_PROVIDED_OPTIMAL_POWER_HARMONICS_instance;
2927
+ var PointField_P_CYCLIST_PROVIDED_POWER_NEEDED_instance;
2928
+ var PointField_P_CYCLIST_PROVIDED_MUSCULAR_instance;
2929
+ var PointField_P_CYCLIST_PROVIDED_WHEEL_instance;
2930
+ var PointField_P_COMPUTED_TOTAL_POWER_instance;
2931
+ var PointField_P_COMPUTED_WHEEL_POWER_instance;
2932
+ var PointField_POWER_instance;
2933
+ var PointField_SPEED_instance;
2934
+ var PointField_SPEED_MAX_instance;
2935
+ var PointField_SPEED_MAX_INCLINE_instance;
2936
+ var PointField_VIRT_SPEED_CURRENT_instance;
2937
+ var PointField_TEMPERATURE_instance;
2938
+ var PointField_WIND_SPEED_instance;
2939
+ var PointField_WIND_DIRECTION_instance;
2940
+ var PointField_HEART_RATE_instance;
2941
+ var PointField_CADENCE_instance;
2942
+ function Companion_2() {
2943
+ Companion_instance_2 = this;
2944
+ this.p1w_1 = 36;
2945
+ var tmp = this;
2946
+ // Inline function 'kotlin.collections.associateBy' call
2947
+ var this_0 = get_entries_0();
2948
+ var capacity = coerceAtLeast(mapCapacity(collectionSizeOrDefault(this_0, 10)), 16);
2949
+ // Inline function 'kotlin.collections.associateByTo' call
2950
+ var destination = LinkedHashMap_init_$Create$(capacity);
2951
+ var _iterator__ex2g4s = this_0.i();
2952
+ while (_iterator__ex2g4s.j()) {
2953
+ var element = _iterator__ex2g4s.k();
2954
+ var tmp$ret$2 = element.m1t_1;
2955
+ destination.c3(tmp$ret$2, element);
2956
+ }
2957
+ tmp.q1w_1 = destination;
2958
+ }
2959
+ protoOf(Companion_2).r1w = function (prop) {
2960
+ return this.q1w_1.k1(prop);
2961
+ };
2962
+ var Companion_instance_2;
2963
+ function Companion_getInstance_3() {
2964
+ PointField_initEntries();
2965
+ if (Companion_instance_2 == null)
2966
+ new Companion_2();
2967
+ return Companion_instance_2;
2968
+ }
2969
+ function values_0() {
2970
+ return [PointField_LATITUDE_getInstance(), PointField_LONGITUDE_getInstance(), PointField_DISTANCE_getInstance(), PointField_DX_getInstance(), PointField_TIME_getInstance(), PointField_ELAPSED_getInstance(), PointField_DT_getInstance(), PointField_BEARING_getInstance(), PointField_ELEVATION_getInstance(), PointField_GRADE_getInstance(), PointField_RADIUS_getInstance(), PointField_AERO_COEF_getInstance(), PointField_WIND_BEARING_getInstance(), PointField_WIND_ALPHA_getInstance(), PointField_P_AERO_getInstance(), PointField_P_GRAVITY_getInstance(), PointField_P_ROLLING_RESISTANCE_getInstance(), PointField_P_WHEEL_BEARINGS_getInstance(), PointField_P_INPUT_POWER_getInstance(), PointField_P_CYCLIST_PROVIDED_OPTIMAL_POWER_getInstance(), PointField_P_CYCLIST_PROVIDED_OPTIMAL_POWER_HARMONICS_getInstance(), PointField_P_CYCLIST_PROVIDED_POWER_NEEDED_getInstance(), PointField_P_CYCLIST_PROVIDED_MUSCULAR_getInstance(), PointField_P_CYCLIST_PROVIDED_WHEEL_getInstance(), PointField_P_COMPUTED_TOTAL_POWER_getInstance(), PointField_P_COMPUTED_WHEEL_POWER_getInstance(), PointField_POWER_getInstance(), PointField_SPEED_getInstance(), PointField_SPEED_MAX_getInstance(), PointField_SPEED_MAX_INCLINE_getInstance(), PointField_VIRT_SPEED_CURRENT_getInstance(), PointField_TEMPERATURE_getInstance(), PointField_WIND_SPEED_getInstance(), PointField_WIND_DIRECTION_getInstance(), PointField_HEART_RATE_getInstance(), PointField_CADENCE_getInstance()];
2971
+ }
2972
+ function get_entries_0() {
2973
+ if ($ENTRIES_0 == null)
2974
+ $ENTRIES_0 = enumEntries(values_0());
2975
+ return $ENTRIES_0;
2976
+ }
2977
+ var PointField_entriesInitialized;
2978
+ function PointField_initEntries() {
2979
+ if (PointField_entriesInitialized)
2980
+ return Unit_instance;
2981
+ PointField_entriesInitialized = true;
2982
+ PointField_LATITUDE_instance = new PointField('LATITUDE', 0, 'latitude', 'radians', 'Latitude (radians)', PointFieldCategory_COORDINATES_getInstance(), true, true);
2983
+ PointField_LONGITUDE_instance = new PointField('LONGITUDE', 1, 'longitude', 'radians', 'Longitude (radians)', PointFieldCategory_COORDINATES_getInstance(), true, true);
2984
+ PointField_DISTANCE_instance = new PointField('DISTANCE', 2, 'distance', 'meters', 'Distance (meters)', PointFieldCategory_COORDINATES_getInstance());
2985
+ PointField_DX_instance = new PointField('DX', 3, 'dx', 'meters', 'dx (meters)', PointFieldCategory_COORDINATES_getInstance());
2986
+ PointField_TIME_instance = new PointField('TIME', 4, 'time', 'ms', 'Timestamp (ms since epoch)', PointFieldCategory_TEMPORAL_getInstance(), true);
2987
+ PointField_ELAPSED_instance = new PointField('ELAPSED', 5, 'elapsed', 'ms', 'Elapsed duration (ms)', PointFieldCategory_TEMPORAL_getInstance());
2988
+ PointField_DT_instance = new PointField('DT', 6, 'dt', 'ms', 'dt (ms)', PointFieldCategory_TEMPORAL_getInstance());
2989
+ PointField_BEARING_instance = new PointField('BEARING', 7, 'bearing', 'radians', 'Direction bearing (radians)', PointFieldCategory_ANGLES_getInstance(), VOID, true);
2990
+ PointField_ELEVATION_instance = new PointField('ELEVATION', 8, 'elevation', 'meters', 'Elevation (meters)', PointFieldCategory_ELEVATION_getInstance());
2991
+ PointField_GRADE_instance = new PointField('GRADE', 9, 'grade', '%', 'Road grade/slope (%)', PointFieldCategory_GRADE_getInstance());
2992
+ PointField_RADIUS_instance = new PointField('RADIUS', 10, 'radius', 'meters', 'Turn radius (meters)', PointFieldCategory_RADIUS_getInstance());
2993
+ PointField_AERO_COEF_instance = new PointField('AERO_COEF', 11, 'aeroCoef', 'aero', 'Aerodynamic coefficient', PointFieldCategory_AERO_COEF_getInstance());
2994
+ PointField_WIND_BEARING_instance = new PointField('WIND_BEARING', 12, 'windBearing', 'radians', 'Wind bearing (radians)', PointFieldCategory_CYCLIST_WIND_getInstance(), VOID, true);
2995
+ PointField_WIND_ALPHA_instance = new PointField('WIND_ALPHA', 13, 'windAlpha', 'radians', 'Wind angle (radians)', PointFieldCategory_CYCLIST_WIND_getInstance(), VOID, true);
2996
+ PointField_P_AERO_instance = new PointField('P_AERO', 14, 'pAero', 'watts', 'Aerodynamic power', PointFieldCategory_POWER_PHYSICS_getInstance());
2997
+ PointField_P_GRAVITY_instance = new PointField('P_GRAVITY', 15, 'pGravity', 'watts', 'Gravitational power', PointFieldCategory_POWER_PHYSICS_getInstance());
2998
+ PointField_P_ROLLING_RESISTANCE_instance = new PointField('P_ROLLING_RESISTANCE', 16, 'pRollingResistance', 'watts', 'Rolling resistance power', PointFieldCategory_POWER_PHYSICS_getInstance());
2999
+ PointField_P_WHEEL_BEARINGS_instance = new PointField('P_WHEEL_BEARINGS', 17, 'pWheelBearings', 'watts', 'Wheel bearings power', PointFieldCategory_POWER_PHYSICS_getInstance());
3000
+ PointField_P_INPUT_POWER_instance = new PointField('P_INPUT_POWER', 18, 'pInputPower', 'watts', 'GPX input power', PointFieldCategory_POWER_CYCLIST_getInstance());
3001
+ PointField_P_CYCLIST_PROVIDED_OPTIMAL_POWER_instance = new PointField('P_CYCLIST_PROVIDED_OPTIMAL_POWER', 19, 'pCyclistProvidedOptimalPower', 'watts', 'Optimal power', PointFieldCategory_POWER_CYCLIST_getInstance());
3002
+ PointField_P_CYCLIST_PROVIDED_OPTIMAL_POWER_HARMONICS_instance = new PointField('P_CYCLIST_PROVIDED_OPTIMAL_POWER_HARMONICS', 20, 'pCyclistProvidedOptimalPowerWithHarmonics', 'watts', 'Optimal power with harmonics', PointFieldCategory_POWER_CYCLIST_getInstance());
3003
+ PointField_P_CYCLIST_PROVIDED_POWER_NEEDED_instance = new PointField('P_CYCLIST_PROVIDED_POWER_NEEDED', 21, 'pCyclistPowerNeeded', 'watts', 'Power needed', PointFieldCategory_POWER_CYCLIST_getInstance());
3004
+ PointField_P_CYCLIST_PROVIDED_MUSCULAR_instance = new PointField('P_CYCLIST_PROVIDED_MUSCULAR', 22, 'pCyclistProvidedMuscular', 'watts', 'Raw cyclist power', PointFieldCategory_POWER_CYCLIST_getInstance());
3005
+ PointField_P_CYCLIST_PROVIDED_WHEEL_instance = new PointField('P_CYCLIST_PROVIDED_WHEEL', 23, 'pCyclistProvidedWheel', 'watts', 'Cyclist power transmitted to ground', PointFieldCategory_POWER_CYCLIST_getInstance());
3006
+ PointField_P_COMPUTED_TOTAL_POWER_instance = new PointField('P_COMPUTED_TOTAL_POWER', 24, 'pComputedTotalPower', 'watts', 'Power from kinetic energy change', PointFieldCategory_POWER_POST_getInstance());
3007
+ PointField_P_COMPUTED_WHEEL_POWER_instance = new PointField('P_COMPUTED_WHEEL_POWER', 25, 'pComputedWheelPower', 'watts', 'Wheel power from kinetic energy change', PointFieldCategory_POWER_POST_getInstance());
3008
+ PointField_POWER_instance = new PointField('POWER', 26, 'pComputedPower', 'watts', 'Total power (watts)', PointFieldCategory_POWER_POST_getInstance());
3009
+ PointField_SPEED_instance = new PointField('SPEED', 27, 'speed', 'm/s', 'Current speed (m/s)', PointFieldCategory_SPEED_getInstance());
3010
+ PointField_SPEED_MAX_instance = new PointField('SPEED_MAX', 28, 'speedMax', 'm/s', 'Maximum speed (m/s)', PointFieldCategory_SPEED_getInstance());
3011
+ PointField_SPEED_MAX_INCLINE_instance = new PointField('SPEED_MAX_INCLINE', 29, 'speedMaxIncline', 'm/s', 'Max speed on incline (m/s)', PointFieldCategory_SPEED_getInstance());
3012
+ PointField_VIRT_SPEED_CURRENT_instance = new PointField('VIRT_SPEED_CURRENT', 30, 'virtSpeedCurrent', 'm/s', 'Virtual current speed (m/s)', PointFieldCategory_SPEED_getInstance());
3013
+ PointField_TEMPERATURE_instance = new PointField('TEMPERATURE', 31, 'temperature', 'celsius', 'Temperature (celsius)', PointFieldCategory_ENVIRONMENTAL_getInstance());
3014
+ PointField_WIND_SPEED_instance = new PointField('WIND_SPEED', 32, 'windSpeed', 'm/s', 'Wind speed (m/s)', PointFieldCategory_ENVIRONMENTAL_getInstance());
3015
+ PointField_WIND_DIRECTION_instance = new PointField('WIND_DIRECTION', 33, 'windDirection', 'radians', 'Wind direction (radians)', PointFieldCategory_ENVIRONMENTAL_getInstance(), VOID, true);
3016
+ PointField_HEART_RATE_instance = new PointField('HEART_RATE', 34, 'heartRate', 'bpm', 'Heart rate (bpm)', PointFieldCategory_PHYSIOLOGICAL_getInstance());
3017
+ PointField_CADENCE_instance = new PointField('CADENCE', 35, 'cadence', 'rpm', 'Pedaling cadence (rpm)', PointFieldCategory_PHYSIOLOGICAL_getInstance());
3018
+ Companion_getInstance_3();
3019
+ }
3020
+ var $ENTRIES_0;
3021
+ function PointField(name, ordinal, prop, unit, shortDescription, category, notSelectable, anglesInRadians) {
3022
+ notSelectable = notSelectable === VOID ? false : notSelectable;
3023
+ anglesInRadians = anglesInRadians === VOID ? false : anglesInRadians;
3024
+ Enum.call(this, name, ordinal);
3025
+ this.m1t_1 = prop;
3026
+ this.n1t_1 = unit;
3027
+ this.o1t_1 = shortDescription;
3028
+ this.p1t_1 = category;
3029
+ this.q1t_1 = notSelectable;
3030
+ this.r1t_1 = anglesInRadians;
3031
+ }
3032
+ function PointField_LATITUDE_getInstance() {
3033
+ PointField_initEntries();
3034
+ return PointField_LATITUDE_instance;
3035
+ }
3036
+ function PointField_LONGITUDE_getInstance() {
3037
+ PointField_initEntries();
3038
+ return PointField_LONGITUDE_instance;
3039
+ }
3040
+ function PointField_DISTANCE_getInstance() {
3041
+ PointField_initEntries();
3042
+ return PointField_DISTANCE_instance;
3043
+ }
3044
+ function PointField_DX_getInstance() {
3045
+ PointField_initEntries();
3046
+ return PointField_DX_instance;
3047
+ }
3048
+ function PointField_TIME_getInstance() {
3049
+ PointField_initEntries();
3050
+ return PointField_TIME_instance;
3051
+ }
3052
+ function PointField_ELAPSED_getInstance() {
3053
+ PointField_initEntries();
3054
+ return PointField_ELAPSED_instance;
3055
+ }
3056
+ function PointField_DT_getInstance() {
3057
+ PointField_initEntries();
3058
+ return PointField_DT_instance;
3059
+ }
3060
+ function PointField_BEARING_getInstance() {
3061
+ PointField_initEntries();
3062
+ return PointField_BEARING_instance;
3063
+ }
3064
+ function PointField_ELEVATION_getInstance() {
3065
+ PointField_initEntries();
3066
+ return PointField_ELEVATION_instance;
3067
+ }
3068
+ function PointField_GRADE_getInstance() {
3069
+ PointField_initEntries();
3070
+ return PointField_GRADE_instance;
3071
+ }
3072
+ function PointField_RADIUS_getInstance() {
3073
+ PointField_initEntries();
3074
+ return PointField_RADIUS_instance;
3075
+ }
3076
+ function PointField_AERO_COEF_getInstance() {
3077
+ PointField_initEntries();
3078
+ return PointField_AERO_COEF_instance;
3079
+ }
3080
+ function PointField_WIND_BEARING_getInstance() {
3081
+ PointField_initEntries();
3082
+ return PointField_WIND_BEARING_instance;
3083
+ }
3084
+ function PointField_WIND_ALPHA_getInstance() {
3085
+ PointField_initEntries();
3086
+ return PointField_WIND_ALPHA_instance;
3087
+ }
3088
+ function PointField_P_AERO_getInstance() {
3089
+ PointField_initEntries();
3090
+ return PointField_P_AERO_instance;
3091
+ }
3092
+ function PointField_P_GRAVITY_getInstance() {
3093
+ PointField_initEntries();
3094
+ return PointField_P_GRAVITY_instance;
3095
+ }
3096
+ function PointField_P_ROLLING_RESISTANCE_getInstance() {
3097
+ PointField_initEntries();
3098
+ return PointField_P_ROLLING_RESISTANCE_instance;
3099
+ }
3100
+ function PointField_P_WHEEL_BEARINGS_getInstance() {
3101
+ PointField_initEntries();
3102
+ return PointField_P_WHEEL_BEARINGS_instance;
3103
+ }
3104
+ function PointField_P_INPUT_POWER_getInstance() {
3105
+ PointField_initEntries();
3106
+ return PointField_P_INPUT_POWER_instance;
3107
+ }
3108
+ function PointField_P_CYCLIST_PROVIDED_OPTIMAL_POWER_getInstance() {
3109
+ PointField_initEntries();
3110
+ return PointField_P_CYCLIST_PROVIDED_OPTIMAL_POWER_instance;
3111
+ }
3112
+ function PointField_P_CYCLIST_PROVIDED_OPTIMAL_POWER_HARMONICS_getInstance() {
3113
+ PointField_initEntries();
3114
+ return PointField_P_CYCLIST_PROVIDED_OPTIMAL_POWER_HARMONICS_instance;
3115
+ }
3116
+ function PointField_P_CYCLIST_PROVIDED_POWER_NEEDED_getInstance() {
3117
+ PointField_initEntries();
3118
+ return PointField_P_CYCLIST_PROVIDED_POWER_NEEDED_instance;
3119
+ }
3120
+ function PointField_P_CYCLIST_PROVIDED_MUSCULAR_getInstance() {
3121
+ PointField_initEntries();
3122
+ return PointField_P_CYCLIST_PROVIDED_MUSCULAR_instance;
3123
+ }
3124
+ function PointField_P_CYCLIST_PROVIDED_WHEEL_getInstance() {
3125
+ PointField_initEntries();
3126
+ return PointField_P_CYCLIST_PROVIDED_WHEEL_instance;
3127
+ }
3128
+ function PointField_P_COMPUTED_TOTAL_POWER_getInstance() {
3129
+ PointField_initEntries();
3130
+ return PointField_P_COMPUTED_TOTAL_POWER_instance;
3131
+ }
3132
+ function PointField_P_COMPUTED_WHEEL_POWER_getInstance() {
3133
+ PointField_initEntries();
3134
+ return PointField_P_COMPUTED_WHEEL_POWER_instance;
3135
+ }
3136
+ function PointField_POWER_getInstance() {
3137
+ PointField_initEntries();
3138
+ return PointField_POWER_instance;
3139
+ }
3140
+ function PointField_SPEED_getInstance() {
3141
+ PointField_initEntries();
3142
+ return PointField_SPEED_instance;
3143
+ }
3144
+ function PointField_SPEED_MAX_getInstance() {
3145
+ PointField_initEntries();
3146
+ return PointField_SPEED_MAX_instance;
3147
+ }
3148
+ function PointField_SPEED_MAX_INCLINE_getInstance() {
3149
+ PointField_initEntries();
3150
+ return PointField_SPEED_MAX_INCLINE_instance;
3151
+ }
3152
+ function PointField_VIRT_SPEED_CURRENT_getInstance() {
3153
+ PointField_initEntries();
3154
+ return PointField_VIRT_SPEED_CURRENT_instance;
3155
+ }
3156
+ function PointField_TEMPERATURE_getInstance() {
3157
+ PointField_initEntries();
3158
+ return PointField_TEMPERATURE_instance;
3159
+ }
3160
+ function PointField_WIND_SPEED_getInstance() {
3161
+ PointField_initEntries();
3162
+ return PointField_WIND_SPEED_instance;
3163
+ }
3164
+ function PointField_WIND_DIRECTION_getInstance() {
3165
+ PointField_initEntries();
3166
+ return PointField_WIND_DIRECTION_instance;
3167
+ }
3168
+ function PointField_HEART_RATE_getInstance() {
3169
+ PointField_initEntries();
3170
+ return PointField_HEART_RATE_instance;
3171
+ }
3172
+ function PointField_CADENCE_getInstance() {
3173
+ PointField_initEntries();
3174
+ return PointField_CADENCE_instance;
3175
+ }
3176
+ var PointFieldCategory_COORDINATES_instance;
3177
+ var PointFieldCategory_TEMPORAL_instance;
3178
+ var PointFieldCategory_ANGLES_instance;
3179
+ var PointFieldCategory_ELEVATION_instance;
3180
+ var PointFieldCategory_GRADE_instance;
3181
+ var PointFieldCategory_RADIUS_instance;
3182
+ var PointFieldCategory_AERO_COEF_instance;
3183
+ var PointFieldCategory_CYCLIST_WIND_instance;
3184
+ var PointFieldCategory_POWER_PHYSICS_instance;
3185
+ var PointFieldCategory_POWER_CYCLIST_instance;
3186
+ var PointFieldCategory_POWER_POST_instance;
3187
+ var PointFieldCategory_SPEED_instance;
3188
+ var PointFieldCategory_ENVIRONMENTAL_instance;
3189
+ var PointFieldCategory_PHYSIOLOGICAL_instance;
3190
+ var PointFieldCategory_entriesInitialized;
3191
+ function PointFieldCategory_initEntries() {
3192
+ if (PointFieldCategory_entriesInitialized)
3193
+ return Unit_instance;
3194
+ PointFieldCategory_entriesInitialized = true;
3195
+ PointFieldCategory_COORDINATES_instance = new PointFieldCategory('COORDINATES', 0, 'coordinates', 'Coordinates');
3196
+ PointFieldCategory_TEMPORAL_instance = new PointFieldCategory('TEMPORAL', 1, 'temporal', 'Temporal');
3197
+ PointFieldCategory_ANGLES_instance = new PointFieldCategory('ANGLES', 2, 'angles', 'Angles');
3198
+ PointFieldCategory_ELEVATION_instance = new PointFieldCategory('ELEVATION', 3, 'elevation', '\uD83C\uDFD4\uFE0F Elevation');
3199
+ PointFieldCategory_GRADE_instance = new PointFieldCategory('GRADE', 4, 'grade', '\uD83D\uDCD0 Grade');
3200
+ PointFieldCategory_RADIUS_instance = new PointFieldCategory('RADIUS', 5, 'radius', 'Radius');
3201
+ PointFieldCategory_AERO_COEF_instance = new PointFieldCategory('AERO_COEF', 6, 'aero_coef', 'Aero coef');
3202
+ PointFieldCategory_CYCLIST_WIND_instance = new PointFieldCategory('CYCLIST_WIND', 7, 'cyclist_wind', 'Cyclist wind');
3203
+ PointFieldCategory_POWER_PHYSICS_instance = new PointFieldCategory('POWER_PHYSICS', 8, 'power_physics', '\u26A1 Power Physics');
3204
+ PointFieldCategory_POWER_CYCLIST_instance = new PointFieldCategory('POWER_CYCLIST', 9, 'power_cyclist', '\u26A1 Power Cyclist');
3205
+ PointFieldCategory_POWER_POST_instance = new PointFieldCategory('POWER_POST', 10, 'power_post', '\u26A1 Power Post processed');
3206
+ PointFieldCategory_SPEED_instance = new PointFieldCategory('SPEED', 11, 'speed', 'Speed & Motion');
3207
+ PointFieldCategory_ENVIRONMENTAL_instance = new PointFieldCategory('ENVIRONMENTAL', 12, 'environmental', 'Environmental');
3208
+ PointFieldCategory_PHYSIOLOGICAL_instance = new PointFieldCategory('PHYSIOLOGICAL', 13, 'physiological', 'Physiological');
3209
+ }
3210
+ function PointFieldCategory(name, ordinal, id, displayName) {
3211
+ Enum.call(this, name, ordinal);
3212
+ this.u1w_1 = id;
3213
+ this.v1w_1 = displayName;
3214
+ }
3215
+ function PointFieldCategory_COORDINATES_getInstance() {
3216
+ PointFieldCategory_initEntries();
3217
+ return PointFieldCategory_COORDINATES_instance;
3218
+ }
3219
+ function PointFieldCategory_TEMPORAL_getInstance() {
3220
+ PointFieldCategory_initEntries();
3221
+ return PointFieldCategory_TEMPORAL_instance;
3222
+ }
3223
+ function PointFieldCategory_ANGLES_getInstance() {
3224
+ PointFieldCategory_initEntries();
3225
+ return PointFieldCategory_ANGLES_instance;
3226
+ }
3227
+ function PointFieldCategory_ELEVATION_getInstance() {
3228
+ PointFieldCategory_initEntries();
3229
+ return PointFieldCategory_ELEVATION_instance;
3230
+ }
3231
+ function PointFieldCategory_GRADE_getInstance() {
3232
+ PointFieldCategory_initEntries();
3233
+ return PointFieldCategory_GRADE_instance;
3234
+ }
3235
+ function PointFieldCategory_RADIUS_getInstance() {
3236
+ PointFieldCategory_initEntries();
3237
+ return PointFieldCategory_RADIUS_instance;
3238
+ }
3239
+ function PointFieldCategory_AERO_COEF_getInstance() {
3240
+ PointFieldCategory_initEntries();
3241
+ return PointFieldCategory_AERO_COEF_instance;
3242
+ }
3243
+ function PointFieldCategory_CYCLIST_WIND_getInstance() {
3244
+ PointFieldCategory_initEntries();
3245
+ return PointFieldCategory_CYCLIST_WIND_instance;
3246
+ }
3247
+ function PointFieldCategory_POWER_PHYSICS_getInstance() {
3248
+ PointFieldCategory_initEntries();
3249
+ return PointFieldCategory_POWER_PHYSICS_instance;
3250
+ }
3251
+ function PointFieldCategory_POWER_CYCLIST_getInstance() {
3252
+ PointFieldCategory_initEntries();
3253
+ return PointFieldCategory_POWER_CYCLIST_instance;
3254
+ }
3255
+ function PointFieldCategory_POWER_POST_getInstance() {
3256
+ PointFieldCategory_initEntries();
3257
+ return PointFieldCategory_POWER_POST_instance;
3258
+ }
3259
+ function PointFieldCategory_SPEED_getInstance() {
3260
+ PointFieldCategory_initEntries();
3261
+ return PointFieldCategory_SPEED_instance;
3262
+ }
3263
+ function PointFieldCategory_ENVIRONMENTAL_getInstance() {
3264
+ PointFieldCategory_initEntries();
3265
+ return PointFieldCategory_ENVIRONMENTAL_instance;
3266
+ }
3267
+ function PointFieldCategory_PHYSIOLOGICAL_getInstance() {
3268
+ PointFieldCategory_initEntries();
3269
+ return PointFieldCategory_PHYSIOLOGICAL_instance;
3270
+ }
3271
+ function Copy(sourceIndex) {
3272
+ this.w1w_1 = sourceIndex;
3273
+ }
3274
+ protoOf(Copy).toString = function () {
3275
+ return 'Copy(sourceIndex=' + this.w1w_1 + ')';
3276
+ };
3277
+ protoOf(Copy).hashCode = function () {
3278
+ return this.w1w_1;
3279
+ };
3280
+ protoOf(Copy).equals = function (other) {
3281
+ if (this === other)
3282
+ return true;
3283
+ if (!(other instanceof Copy))
3284
+ return false;
3285
+ if (!(this.w1w_1 === other.w1w_1))
3286
+ return false;
3287
+ return true;
3288
+ };
3289
+ function Interpolate(from, to, coef) {
3290
+ this.x1w_1 = from;
3291
+ this.y1w_1 = to;
3292
+ this.z1w_1 = coef;
3293
+ }
3294
+ protoOf(Interpolate).toString = function () {
3295
+ return 'Interpolate(from=' + this.x1w_1 + ', to=' + this.y1w_1 + ', coef=' + this.z1w_1 + ')';
3296
+ };
3297
+ protoOf(Interpolate).hashCode = function () {
3298
+ var result = this.x1w_1;
3299
+ result = imul(result, 31) + this.y1w_1 | 0;
3300
+ result = imul(result, 31) + getNumberHashCode(this.z1w_1) | 0;
3301
+ return result;
3302
+ };
3303
+ protoOf(Interpolate).equals = function (other) {
3304
+ if (this === other)
3305
+ return true;
3306
+ if (!(other instanceof Interpolate))
3307
+ return false;
3308
+ if (!(this.x1w_1 === other.x1w_1))
3309
+ return false;
3310
+ if (!(this.y1w_1 === other.y1w_1))
3311
+ return false;
3312
+ if (!equals(this.z1w_1, other.z1w_1))
3313
+ return false;
3314
+ return true;
3315
+ };
3316
+ function buildPlan($this, source, minDistanceM, maxDistanceM) {
3317
+ var n = source.f1r_1;
3318
+ var plan = ArrayList_init_$Create$_0(n);
3319
+ // Inline function 'kotlin.collections.plusAssign' call
3320
+ var element = new Copy(0);
3321
+ plan.h(element);
3322
+ var lastAddedDistance = source.w1u(0);
3323
+ var lastAddedIndex = 0;
3324
+ var inductionVariable = 1;
3325
+ if (inductionVariable < n)
3326
+ $l$loop: do {
3327
+ var i = inductionVariable;
3328
+ inductionVariable = inductionVariable + 1 | 0;
3329
+ var curDist = source.w1u(i);
3330
+ var gap = curDist - lastAddedDistance;
3331
+ if (gap < minDistanceM)
3332
+ continue $l$loop;
3333
+ else if (gap <= maxDistanceM) {
3334
+ // Inline function 'kotlin.collections.plusAssign' call
3335
+ var element_0 = new Copy(i);
3336
+ plan.h(element_0);
3337
+ lastAddedDistance = curDist;
3338
+ lastAddedIndex = i;
3339
+ } else {
3340
+ // Inline function 'kotlin.math.ceil' call
3341
+ var x = gap / maxDistanceM;
3342
+ var tmp$ret$2 = Math.ceil(x);
3343
+ var numSegments = numberToInt(tmp$ret$2);
3344
+ var spacing = gap / numSegments;
3345
+ var index1 = lastAddedIndex;
3346
+ var inductionVariable_0 = 1;
3347
+ if (inductionVariable_0 < numSegments)
3348
+ do {
3349
+ var j = inductionVariable_0;
3350
+ inductionVariable_0 = inductionVariable_0 + 1 | 0;
3351
+ var targetDistance = lastAddedDistance + j * spacing;
3352
+ while (index1 < (i - 1 | 0) && source.w1u(index1 + 1 | 0) < targetDistance) {
3353
+ index1 = index1 + 1 | 0;
3354
+ }
3355
+ var dist1 = source.w1u(index1);
3356
+ var dist2 = source.w1u(index1 + 1 | 0);
3357
+ var coef = (targetDistance - dist1) / (dist2 - dist1);
3358
+ // Inline function 'kotlin.collections.plusAssign' call
3359
+ var element_1 = new Interpolate(index1, index1 + 1 | 0, coef);
3360
+ plan.h(element_1);
3361
+ }
3362
+ while (inductionVariable_0 < numSegments);
3363
+ // Inline function 'kotlin.collections.plusAssign' call
3364
+ var element_2 = new Copy(i);
3365
+ plan.h(element_2);
3366
+ lastAddedDistance = curDist;
3367
+ lastAddedIndex = i;
3368
+ }
3369
+ }
3370
+ while (inductionVariable < n);
3371
+ return plan;
3372
+ }
3373
+ function materialize($this, source, plan) {
3374
+ var out = new Path(plan.l());
3375
+ var iterator = plan.i();
3376
+ var index = 0;
3377
+ while (iterator.j()) {
3378
+ var dstIdx = index;
3379
+ index = index + 1 | 0;
3380
+ var op = iterator.k();
3381
+ if (op instanceof Copy) {
3382
+ copyFields($this, source, op.w1w_1, out, dstIdx);
3383
+ } else {
3384
+ if (op instanceof Interpolate) {
3385
+ interpolateFields($this, source, op.x1w_1, op.y1w_1, op.z1w_1, out, dstIdx);
3386
+ } else {
3387
+ noWhenBranchMatchedException();
3388
+ }
3389
+ }
3390
+ }
3391
+ out.q1s();
3392
+ return out;
3393
+ }
3394
+ function copyFields($this, src, srcIdx, dst, dstIdx) {
3395
+ var _iterator__ex2g4s = get_entries_0().i();
3396
+ while (_iterator__ex2g4s.j()) {
3397
+ var field = _iterator__ex2g4s.k();
3398
+ dst.f1u(dstIdx, field, src.y1t(srcIdx, field));
3399
+ }
3400
+ }
3401
+ function interpolateFields($this, src, i1, i2, coef, dst, dstIdx) {
3402
+ var _iterator__ex2g4s = get_entries_0().i();
3403
+ while (_iterator__ex2g4s.j()) {
3404
+ var field = _iterator__ex2g4s.k();
3405
+ var v1 = src.y1t(i1, field);
3406
+ var v2 = src.y1t(i2, field);
3407
+ var v = isNaN_0(v1) || isNaN_0(v2) ? NaN : v1 + (v2 - v1) * coef;
3408
+ dst.f1u(dstIdx, field, v);
3409
+ }
3410
+ }
3411
+ function PointPerDistance() {
3412
+ }
3413
+ protoOf(PointPerDistance).a1x = function (source, minDistanceM, maxDistanceM) {
3414
+ return this.b1x(source, minDistanceM, maxDistanceM);
3415
+ };
3416
+ protoOf(PointPerDistance).b1x = function (source, minDistanceM, maxDistanceM) {
3417
+ // Inline function 'kotlin.require' call
3418
+ if (!(maxDistanceM > 0.0)) {
3419
+ var message = 'maxDistanceM must be > 0, got ' + maxDistanceM;
3420
+ throw IllegalArgumentException_init_$Create$_0(toString_0(message));
3421
+ }
3422
+ if (source.f1r_1 === 0)
3423
+ return new Path(0);
3424
+ if (source.f1r_1 === 1) {
3425
+ var out = new Path(1);
3426
+ copyFields(this, source, 0, out, 0);
3427
+ out.q1s();
3428
+ return out;
3429
+ }
3430
+ var plan = buildPlan(this, source, minDistanceM, maxDistanceM);
3431
+ return materialize(this, source, plan);
3432
+ };
3433
+ var PointPerDistance_instance;
3434
+ function PointPerDistance_getInstance() {
3435
+ return PointPerDistance_instance;
3436
+ }
3437
+ function Copy_0(sourceIndex) {
3438
+ this.c1x_1 = sourceIndex;
3439
+ }
3440
+ protoOf(Copy_0).toString = function () {
3441
+ return 'Copy(sourceIndex=' + this.c1x_1 + ')';
3442
+ };
3443
+ protoOf(Copy_0).hashCode = function () {
3444
+ return this.c1x_1;
3445
+ };
3446
+ protoOf(Copy_0).equals = function (other) {
3447
+ if (this === other)
3448
+ return true;
3449
+ if (!(other instanceof Copy_0))
3450
+ return false;
3451
+ if (!(this.c1x_1 === other.c1x_1))
3452
+ return false;
3453
+ return true;
3454
+ };
3455
+ function Interpolate_0(from, to, coef) {
3456
+ this.d1x_1 = from;
3457
+ this.e1x_1 = to;
3458
+ this.f1x_1 = coef;
3459
+ }
3460
+ protoOf(Interpolate_0).toString = function () {
3461
+ return 'Interpolate(from=' + this.d1x_1 + ', to=' + this.e1x_1 + ', coef=' + this.f1x_1 + ')';
3462
+ };
3463
+ protoOf(Interpolate_0).hashCode = function () {
3464
+ var result = this.d1x_1;
3465
+ result = imul(result, 31) + this.e1x_1 | 0;
3466
+ result = imul(result, 31) + getNumberHashCode(this.f1x_1) | 0;
3467
+ return result;
3468
+ };
3469
+ protoOf(Interpolate_0).equals = function (other) {
3470
+ if (this === other)
3471
+ return true;
3472
+ if (!(other instanceof Interpolate_0))
3473
+ return false;
3474
+ if (!(this.d1x_1 === other.d1x_1))
3475
+ return false;
3476
+ if (!(this.e1x_1 === other.e1x_1))
3477
+ return false;
3478
+ if (!equals(this.f1x_1, other.f1x_1))
3479
+ return false;
3480
+ return true;
3481
+ };
3482
+ function buildPlan_0($this, source) {
3483
+ var plan = LinkedHashMap_init_$Create$_0();
3484
+ var n = source.f1r_1;
3485
+ var inductionVariable = 0;
3486
+ if (inductionVariable < n)
3487
+ $l$loop_0: do {
3488
+ var i = inductionVariable;
3489
+ inductionVariable = inductionVariable + 1 | 0;
3490
+ var time1 = source.k1r(i);
3491
+ // Inline function 'kotlin.math.floor' call
3492
+ var x = time1 / 1000.0;
3493
+ var tmp$ret$0 = Math.floor(x);
3494
+ var epoch1 = numberToLong(tmp$ret$0);
3495
+ var msInSec1 = subtract(numberToLong(time1), multiply(epoch1, new Long(1000, 0)));
3496
+ if (i === 0 && !equalsLong(msInSec1, new Long(0, 0))) {
3497
+ // Inline function 'kotlin.collections.set' call
3498
+ var value = new Copy_0(i);
3499
+ plan.c3(epoch1, value);
3500
+ }
3501
+ if (i === (n - 1 | 0)) {
3502
+ if (!equalsLong(msInSec1, new Long(0, 0))) {
3503
+ var tmp2 = add(epoch1, new Long(1, 0));
3504
+ // Inline function 'kotlin.collections.set' call
3505
+ var value_0 = new Copy_0(i);
3506
+ plan.c3(tmp2, value_0);
3507
+ }
3508
+ continue $l$loop_0;
3509
+ }
3510
+ var time2 = source.k1r(i + 1 | 0);
3511
+ // Inline function 'kotlin.math.floor' call
3512
+ var x_0 = time2 / 1000.0;
3513
+ var tmp$ret$3 = Math.floor(x_0);
3514
+ var epoch2 = numberToLong(tmp$ret$3);
3515
+ if (equalsLong(epoch1, epoch2))
3516
+ continue $l$loop_0;
3517
+ var duration12 = time2 - time1;
3518
+ var epochStart = equalsLong(msInSec1, new Long(0, 0)) ? epoch1 : add(epoch1, new Long(1, 0));
3519
+ var epochEnd = epoch2;
3520
+ var e = epochStart;
3521
+ while (compare(e, epochEnd) <= 0) {
3522
+ // Inline function 'kotlin.Long.times' call
3523
+ var this_0 = e;
3524
+ var epochTime = toNumber(this_0) * 1000.0;
3525
+ var coef = (epochTime - time1) / duration12;
3526
+ var tmp2_0 = e;
3527
+ // Inline function 'kotlin.collections.set' call
3528
+ var value_1 = new Interpolate_0(i, i + 1 | 0, coef);
3529
+ plan.c3(tmp2_0, value_1);
3530
+ var _unary__edvuaz = e;
3531
+ e = add(_unary__edvuaz, get_ONE());
3532
+ }
3533
+ }
3534
+ while (inductionVariable < n);
3535
+ return plan;
3536
+ }
3537
+ function materialize_0($this, source, plan) {
3538
+ var sortedEpochs = sorted(plan.l1());
3539
+ var out = new Path(sortedEpochs.l());
3540
+ var iterator = sortedEpochs.i();
3541
+ var index = 0;
3542
+ $l$loop: while (iterator.j()) {
3543
+ var idx = index;
3544
+ index = index + 1 | 0;
3545
+ var epoch = iterator.k();
3546
+ var tmp0_elvis_lhs = plan.k1(epoch);
3547
+ var tmp;
3548
+ if (tmp0_elvis_lhs == null) {
3549
+ continue $l$loop;
3550
+ } else {
3551
+ tmp = tmp0_elvis_lhs;
3552
+ }
3553
+ var data = tmp;
3554
+ if (data instanceof Copy_0) {
3555
+ copyFields_0($this, source, data.c1x_1, out, idx);
3556
+ } else {
3557
+ if (data instanceof Interpolate_0) {
3558
+ interpolateFields_0($this, source, data.d1x_1, data.e1x_1, data.f1x_1, out, idx);
3559
+ } else {
3560
+ noWhenBranchMatchedException();
3561
+ }
3562
+ }
3563
+ out.c1s(idx, toNumber(multiply(epoch, new Long(1000, 0))));
3564
+ }
3565
+ out.q1s();
3566
+ return out;
3567
+ }
3568
+ function copyFields_0($this, src, srcIdx, dst, dstIdx) {
3569
+ var _iterator__ex2g4s = get_entries_0().i();
3570
+ while (_iterator__ex2g4s.j()) {
3571
+ var field = _iterator__ex2g4s.k();
3572
+ dst.f1u(dstIdx, field, src.y1t(srcIdx, field));
3573
+ }
3574
+ }
3575
+ function interpolateFields_0($this, src, i1, i2, coef, dst, dstIdx) {
3576
+ var _iterator__ex2g4s = get_entries_0().i();
3577
+ while (_iterator__ex2g4s.j()) {
3578
+ var field = _iterator__ex2g4s.k();
3579
+ var v1 = src.y1t(i1, field);
3580
+ var v2 = src.y1t(i2, field);
3581
+ var v = isNaN_0(v1) || isNaN_0(v2) ? NaN : v1 + (v2 - v1) * coef;
3582
+ dst.f1u(dstIdx, field, v);
3583
+ }
3584
+ }
3585
+ function PointPerSecond() {
3586
+ }
3587
+ protoOf(PointPerSecond).g1x = function (source) {
3588
+ if (source.f1r_1 === 0)
3589
+ return new Path(0);
3590
+ var plan = buildPlan_0(this, source);
3591
+ return materialize_0(this, source, plan);
3592
+ };
3593
+ var PointPerSecond_instance;
3594
+ function PointPerSecond_getInstance() {
3595
+ return PointPerSecond_instance;
3596
+ }
3597
+ //region block: init
3598
+ Companion_instance = new Companion();
3599
+ GpxParser_instance = new GpxParser();
3600
+ GpxWriter_instance = new GpxWriter();
3601
+ CsvWriter_instance = new CsvWriter();
3602
+ JsonWriter_instance = new JsonWriter();
3603
+ ElevationStep_instance = new ElevationStep();
3604
+ Companion_instance_1 = new Companion_1();
3605
+ PathSimplifier_instance = new PathSimplifier();
3606
+ PointPerDistance_instance = new PointPerDistance();
3607
+ PointPerSecond_instance = new PointPerSecond();
3608
+ //endregion
3609
+ //region block: exports
3610
+ _.$_$ = _.$_$ || {};
3611
+ _.$_$.a = GpxParser_instance;
3612
+ _.$_$.b = GpxWriter_instance;
3613
+ _.$_$.c = CsvWriter_instance;
3614
+ _.$_$.d = JsonWriter_instance;
3615
+ _.$_$.e = ElevationStep_instance;
3616
+ _.$_$.f = PathSimplifier_instance;
3617
+ _.$_$.g = Companion_getInstance_3;
3618
+ _.$_$.h = PointPerDistance_instance;
3619
+ _.$_$.i = PointPerSecond_instance;
3620
+ _.$_$.j = GpxPathKind_ROUTE_getInstance;
3621
+ _.$_$.k = GpxPathKind_TRACK_getInstance;
3622
+ _.$_$.l = PointField_TEMPERATURE_getInstance;
3623
+ _.$_$.m = GpxWaypoint;
3624
+ _.$_$.n = firstTrackAsPath;
3625
+ _.$_$.o = segmentsAsPaths;
3626
+ _.$_$.p = toGpxDocument;
3627
+ _.$_$.q = tracksAsPaths;
3628
+ _.$_$.r = CsvOptions;
3629
+ _.$_$.s = JsonOptions;
3630
+ _.$_$.t = Path;
3631
+ _.$_$.u = get_entries_0;
3632
+ //endregion
3633
+ return _;
3634
+ }));
3635
+
3636
+ //# sourceMappingURL=vcyclist-gpx.js.map