@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.
- package/README.md +166 -28
- package/kotlin-kotlin-stdlib.js +2778 -1761
- package/kotlin-kotlin-stdlib.js.map +1 -1
- package/kotlinx-atomicfu.js +22 -22
- package/kotlinx-coroutines-core.js +1218 -1211
- package/kotlinx-coroutines-core.js.map +1 -1
- package/kotlinx-serialization-kotlinx-serialization-core.js +1 -1
- package/package.json +3 -2
- package/vcyclist-elevation.js +1051 -961
- package/vcyclist-elevation.js.map +1 -1
- package/vcyclist-engine.d.ts +16 -1
- package/vcyclist-engine.js +1290 -2522
- package/vcyclist-engine.js.map +1 -1
- package/vcyclist-fit.js +811 -0
- package/vcyclist-fit.js.map +1 -0
- package/vcyclist-gpx.js +3636 -0
- package/vcyclist-gpx.js.map +1 -0
- package/xmlutil-core.js +2717 -2718
- package/xmlutil-core.js.map +1 -1
package/vcyclist-fit.js
ADDED
|
@@ -0,0 +1,811 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof define === 'function' && define.amd)
|
|
3
|
+
define(['exports', '@garmin/fitsdk', './kotlin-kotlin-stdlib.js'], factory);
|
|
4
|
+
else if (typeof exports === 'object')
|
|
5
|
+
factory(module.exports, require('@garmin/fitsdk'), require('./kotlin-kotlin-stdlib.js'));
|
|
6
|
+
else {
|
|
7
|
+
if (typeof FitSdk === 'undefined') {
|
|
8
|
+
throw new Error("Error loading module 'vcyclist-fit'. Its dependency '@garmin/fitsdk' was not found. Please, check whether '@garmin/fitsdk' is loaded prior to 'vcyclist-fit'.");
|
|
9
|
+
}
|
|
10
|
+
if (typeof globalThis['kotlin-kotlin-stdlib'] === 'undefined') {
|
|
11
|
+
throw new Error("Error loading module 'vcyclist-fit'. Its dependency 'kotlin-kotlin-stdlib' was not found. Please, check whether 'kotlin-kotlin-stdlib' is loaded prior to 'vcyclist-fit'.");
|
|
12
|
+
}
|
|
13
|
+
globalThis['vcyclist-fit'] = factory(typeof globalThis['vcyclist-fit'] === 'undefined' ? {} : globalThis['vcyclist-fit'], FitSdk, globalThis['kotlin-kotlin-stdlib']);
|
|
14
|
+
}
|
|
15
|
+
}(function (_, FitSdk, kotlin_kotlin) {
|
|
16
|
+
'use strict';
|
|
17
|
+
//region block: imports
|
|
18
|
+
var imul = Math.imul;
|
|
19
|
+
var Unit_instance = kotlin_kotlin.$_$.t;
|
|
20
|
+
var Enum = kotlin_kotlin.$_$.z7;
|
|
21
|
+
var protoOf = kotlin_kotlin.$_$.a6;
|
|
22
|
+
var initMetadataForClass = kotlin_kotlin.$_$.l5;
|
|
23
|
+
var VOID = kotlin_kotlin.$_$.a;
|
|
24
|
+
var initMetadataForCompanion = kotlin_kotlin.$_$.m5;
|
|
25
|
+
var toString = kotlin_kotlin.$_$.c6;
|
|
26
|
+
var IllegalArgumentException_init_$Create$ = kotlin_kotlin.$_$.m1;
|
|
27
|
+
var Collection = kotlin_kotlin.$_$.z1;
|
|
28
|
+
var isInterface = kotlin_kotlin.$_$.t5;
|
|
29
|
+
var getStringHashCode = kotlin_kotlin.$_$.j5;
|
|
30
|
+
var hashCode = kotlin_kotlin.$_$.k5;
|
|
31
|
+
var equals = kotlin_kotlin.$_$.f5;
|
|
32
|
+
var getNumberHashCode = kotlin_kotlin.$_$.h5;
|
|
33
|
+
var Long = kotlin_kotlin.$_$.d8;
|
|
34
|
+
var roundToInt = kotlin_kotlin.$_$.d6;
|
|
35
|
+
var initMetadataForObject = kotlin_kotlin.$_$.r5;
|
|
36
|
+
var Companion_getInstance = kotlin_kotlin.$_$.q;
|
|
37
|
+
var listOf = kotlin_kotlin.$_$.z2;
|
|
38
|
+
var collectionSizeOrDefault = kotlin_kotlin.$_$.j2;
|
|
39
|
+
var ArrayList_init_$Create$ = kotlin_kotlin.$_$.w;
|
|
40
|
+
var last = kotlin_kotlin.$_$.y2;
|
|
41
|
+
var numberToLong = kotlin_kotlin.$_$.s4;
|
|
42
|
+
var DurationUnit_MILLISECONDS_getInstance = kotlin_kotlin.$_$.u;
|
|
43
|
+
var toDuration = kotlin_kotlin.$_$.w7;
|
|
44
|
+
var isNaN_0 = kotlin_kotlin.$_$.p8;
|
|
45
|
+
var until = kotlin_kotlin.$_$.n6;
|
|
46
|
+
var round = kotlin_kotlin.$_$.f6;
|
|
47
|
+
var numberToInt = kotlin_kotlin.$_$.y5;
|
|
48
|
+
var toNumber = kotlin_kotlin.$_$.u4;
|
|
49
|
+
var get_lastIndex = kotlin_kotlin.$_$.w2;
|
|
50
|
+
var first = kotlin_kotlin.$_$.s2;
|
|
51
|
+
//endregion
|
|
52
|
+
//region block: pre-declaration
|
|
53
|
+
initMetadataForClass(FitSport, 'FitSport', VOID, Enum);
|
|
54
|
+
initMetadataForCompanion(Companion);
|
|
55
|
+
initMetadataForClass(FitCourse, 'FitCourse');
|
|
56
|
+
initMetadataForClass(FitSegment, 'FitSegment');
|
|
57
|
+
initMetadataForClass(FitRecord, 'FitRecord');
|
|
58
|
+
initMetadataForClass(FitLap, 'FitLap');
|
|
59
|
+
initMetadataForObject(FitUnits, 'FitUnits');
|
|
60
|
+
initMetadataForObject(FitEncoder, 'FitEncoder');
|
|
61
|
+
//endregion
|
|
62
|
+
var FitSport_CYCLING_instance;
|
|
63
|
+
var FitSport_RUNNING_instance;
|
|
64
|
+
var FitSport_GENERIC_instance;
|
|
65
|
+
var FitSport_entriesInitialized;
|
|
66
|
+
function FitSport_initEntries() {
|
|
67
|
+
if (FitSport_entriesInitialized)
|
|
68
|
+
return Unit_instance;
|
|
69
|
+
FitSport_entriesInitialized = true;
|
|
70
|
+
FitSport_CYCLING_instance = new FitSport('CYCLING', 0, 2);
|
|
71
|
+
FitSport_RUNNING_instance = new FitSport('RUNNING', 1, 1);
|
|
72
|
+
FitSport_GENERIC_instance = new FitSport('GENERIC', 2, 0);
|
|
73
|
+
}
|
|
74
|
+
function FitSport(name, ordinal, value) {
|
|
75
|
+
Enum.call(this, name, ordinal);
|
|
76
|
+
this.j1x_1 = value;
|
|
77
|
+
}
|
|
78
|
+
function Companion() {
|
|
79
|
+
}
|
|
80
|
+
var Companion_instance;
|
|
81
|
+
function Companion_getInstance_0() {
|
|
82
|
+
return Companion_instance;
|
|
83
|
+
}
|
|
84
|
+
function FitCourse(name, startTime, segments, sport) {
|
|
85
|
+
sport = sport === VOID ? FitSport_CYCLING_getInstance() : sport;
|
|
86
|
+
this.k1x_1 = name;
|
|
87
|
+
this.l1x_1 = startTime;
|
|
88
|
+
this.m1x_1 = segments;
|
|
89
|
+
this.n1x_1 = sport;
|
|
90
|
+
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
91
|
+
// Inline function 'kotlin.require' call
|
|
92
|
+
if (!!this.m1x_1.n()) {
|
|
93
|
+
var message = 'A FIT course needs at least one segment';
|
|
94
|
+
throw IllegalArgumentException_init_$Create$(toString(message));
|
|
95
|
+
}
|
|
96
|
+
var tmp0 = this.m1x_1;
|
|
97
|
+
var tmp$ret$3;
|
|
98
|
+
$l$block_0: {
|
|
99
|
+
// Inline function 'kotlin.collections.all' call
|
|
100
|
+
var tmp;
|
|
101
|
+
if (isInterface(tmp0, Collection)) {
|
|
102
|
+
tmp = tmp0.n();
|
|
103
|
+
} else {
|
|
104
|
+
tmp = false;
|
|
105
|
+
}
|
|
106
|
+
if (tmp) {
|
|
107
|
+
tmp$ret$3 = true;
|
|
108
|
+
break $l$block_0;
|
|
109
|
+
}
|
|
110
|
+
var _iterator__ex2g4s = tmp0.i();
|
|
111
|
+
while (_iterator__ex2g4s.j()) {
|
|
112
|
+
var element = _iterator__ex2g4s.k();
|
|
113
|
+
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
114
|
+
if (!!element.o1x_1.n()) {
|
|
115
|
+
tmp$ret$3 = false;
|
|
116
|
+
break $l$block_0;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
tmp$ret$3 = true;
|
|
120
|
+
}
|
|
121
|
+
// Inline function 'kotlin.require' call
|
|
122
|
+
if (!tmp$ret$3) {
|
|
123
|
+
var message_0 = 'A FIT course segment needs at least one record';
|
|
124
|
+
throw IllegalArgumentException_init_$Create$(toString(message_0));
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
protoOf(FitCourse).toString = function () {
|
|
128
|
+
return 'FitCourse(name=' + this.k1x_1 + ', startTime=' + this.l1x_1.toString() + ', segments=' + toString(this.m1x_1) + ', sport=' + this.n1x_1.toString() + ')';
|
|
129
|
+
};
|
|
130
|
+
protoOf(FitCourse).hashCode = function () {
|
|
131
|
+
var result = getStringHashCode(this.k1x_1);
|
|
132
|
+
result = imul(result, 31) + this.l1x_1.hashCode() | 0;
|
|
133
|
+
result = imul(result, 31) + hashCode(this.m1x_1) | 0;
|
|
134
|
+
result = imul(result, 31) + this.n1x_1.hashCode() | 0;
|
|
135
|
+
return result;
|
|
136
|
+
};
|
|
137
|
+
protoOf(FitCourse).equals = function (other) {
|
|
138
|
+
if (this === other)
|
|
139
|
+
return true;
|
|
140
|
+
if (!(other instanceof FitCourse))
|
|
141
|
+
return false;
|
|
142
|
+
if (!(this.k1x_1 === other.k1x_1))
|
|
143
|
+
return false;
|
|
144
|
+
if (!this.l1x_1.equals(other.l1x_1))
|
|
145
|
+
return false;
|
|
146
|
+
if (!equals(this.m1x_1, other.m1x_1))
|
|
147
|
+
return false;
|
|
148
|
+
if (!this.n1x_1.equals(other.n1x_1))
|
|
149
|
+
return false;
|
|
150
|
+
return true;
|
|
151
|
+
};
|
|
152
|
+
function FitSegment(records, lap) {
|
|
153
|
+
this.o1x_1 = records;
|
|
154
|
+
this.p1x_1 = lap;
|
|
155
|
+
}
|
|
156
|
+
protoOf(FitSegment).toString = function () {
|
|
157
|
+
return 'FitSegment(records=' + toString(this.o1x_1) + ', lap=' + this.p1x_1.toString() + ')';
|
|
158
|
+
};
|
|
159
|
+
protoOf(FitSegment).hashCode = function () {
|
|
160
|
+
var result = hashCode(this.o1x_1);
|
|
161
|
+
result = imul(result, 31) + this.p1x_1.hashCode() | 0;
|
|
162
|
+
return result;
|
|
163
|
+
};
|
|
164
|
+
protoOf(FitSegment).equals = function (other) {
|
|
165
|
+
if (this === other)
|
|
166
|
+
return true;
|
|
167
|
+
if (!(other instanceof FitSegment))
|
|
168
|
+
return false;
|
|
169
|
+
if (!equals(this.o1x_1, other.o1x_1))
|
|
170
|
+
return false;
|
|
171
|
+
if (!this.p1x_1.equals(other.p1x_1))
|
|
172
|
+
return false;
|
|
173
|
+
return true;
|
|
174
|
+
};
|
|
175
|
+
function FitRecord(timestamp, latitudeDeg, longitudeDeg, altitudeM, distanceM, speedMs, powerW, heartRate, cadence, temperatureC) {
|
|
176
|
+
altitudeM = altitudeM === VOID ? null : altitudeM;
|
|
177
|
+
speedMs = speedMs === VOID ? null : speedMs;
|
|
178
|
+
powerW = powerW === VOID ? null : powerW;
|
|
179
|
+
heartRate = heartRate === VOID ? null : heartRate;
|
|
180
|
+
cadence = cadence === VOID ? null : cadence;
|
|
181
|
+
temperatureC = temperatureC === VOID ? null : temperatureC;
|
|
182
|
+
this.q1x_1 = timestamp;
|
|
183
|
+
this.r1x_1 = latitudeDeg;
|
|
184
|
+
this.s1x_1 = longitudeDeg;
|
|
185
|
+
this.t1x_1 = altitudeM;
|
|
186
|
+
this.u1x_1 = distanceM;
|
|
187
|
+
this.v1x_1 = speedMs;
|
|
188
|
+
this.w1x_1 = powerW;
|
|
189
|
+
this.x1x_1 = heartRate;
|
|
190
|
+
this.y1x_1 = cadence;
|
|
191
|
+
this.z1x_1 = temperatureC;
|
|
192
|
+
}
|
|
193
|
+
protoOf(FitRecord).toString = function () {
|
|
194
|
+
return 'FitRecord(timestamp=' + this.q1x_1.toString() + ', latitudeDeg=' + this.r1x_1 + ', longitudeDeg=' + this.s1x_1 + ', altitudeM=' + this.t1x_1 + ', distanceM=' + this.u1x_1 + ', speedMs=' + this.v1x_1 + ', powerW=' + this.w1x_1 + ', heartRate=' + this.x1x_1 + ', cadence=' + this.y1x_1 + ', temperatureC=' + this.z1x_1 + ')';
|
|
195
|
+
};
|
|
196
|
+
protoOf(FitRecord).hashCode = function () {
|
|
197
|
+
var result = this.q1x_1.hashCode();
|
|
198
|
+
result = imul(result, 31) + getNumberHashCode(this.r1x_1) | 0;
|
|
199
|
+
result = imul(result, 31) + getNumberHashCode(this.s1x_1) | 0;
|
|
200
|
+
result = imul(result, 31) + (this.t1x_1 == null ? 0 : getNumberHashCode(this.t1x_1)) | 0;
|
|
201
|
+
result = imul(result, 31) + getNumberHashCode(this.u1x_1) | 0;
|
|
202
|
+
result = imul(result, 31) + (this.v1x_1 == null ? 0 : getNumberHashCode(this.v1x_1)) | 0;
|
|
203
|
+
result = imul(result, 31) + (this.w1x_1 == null ? 0 : this.w1x_1) | 0;
|
|
204
|
+
result = imul(result, 31) + (this.x1x_1 == null ? 0 : this.x1x_1) | 0;
|
|
205
|
+
result = imul(result, 31) + (this.y1x_1 == null ? 0 : this.y1x_1) | 0;
|
|
206
|
+
result = imul(result, 31) + (this.z1x_1 == null ? 0 : getNumberHashCode(this.z1x_1)) | 0;
|
|
207
|
+
return result;
|
|
208
|
+
};
|
|
209
|
+
protoOf(FitRecord).equals = function (other) {
|
|
210
|
+
if (this === other)
|
|
211
|
+
return true;
|
|
212
|
+
if (!(other instanceof FitRecord))
|
|
213
|
+
return false;
|
|
214
|
+
if (!this.q1x_1.equals(other.q1x_1))
|
|
215
|
+
return false;
|
|
216
|
+
if (!equals(this.r1x_1, other.r1x_1))
|
|
217
|
+
return false;
|
|
218
|
+
if (!equals(this.s1x_1, other.s1x_1))
|
|
219
|
+
return false;
|
|
220
|
+
if (!equals(this.t1x_1, other.t1x_1))
|
|
221
|
+
return false;
|
|
222
|
+
if (!equals(this.u1x_1, other.u1x_1))
|
|
223
|
+
return false;
|
|
224
|
+
if (!equals(this.v1x_1, other.v1x_1))
|
|
225
|
+
return false;
|
|
226
|
+
if (!(this.w1x_1 == other.w1x_1))
|
|
227
|
+
return false;
|
|
228
|
+
if (!(this.x1x_1 == other.x1x_1))
|
|
229
|
+
return false;
|
|
230
|
+
if (!(this.y1x_1 == other.y1x_1))
|
|
231
|
+
return false;
|
|
232
|
+
if (!equals(this.z1x_1, other.z1x_1))
|
|
233
|
+
return false;
|
|
234
|
+
return true;
|
|
235
|
+
};
|
|
236
|
+
function FitLap(startTime, totalElapsedTimeS, totalTimerTimeS, totalDistanceM, totalAscentM, totalDescentM, maxSpeedMs, minAltitudeM, maxAltitudeM, startLatitudeDeg, startLongitudeDeg, endLatitudeDeg, endLongitudeDeg) {
|
|
237
|
+
maxSpeedMs = maxSpeedMs === VOID ? null : maxSpeedMs;
|
|
238
|
+
minAltitudeM = minAltitudeM === VOID ? null : minAltitudeM;
|
|
239
|
+
maxAltitudeM = maxAltitudeM === VOID ? null : maxAltitudeM;
|
|
240
|
+
startLatitudeDeg = startLatitudeDeg === VOID ? null : startLatitudeDeg;
|
|
241
|
+
startLongitudeDeg = startLongitudeDeg === VOID ? null : startLongitudeDeg;
|
|
242
|
+
endLatitudeDeg = endLatitudeDeg === VOID ? null : endLatitudeDeg;
|
|
243
|
+
endLongitudeDeg = endLongitudeDeg === VOID ? null : endLongitudeDeg;
|
|
244
|
+
this.a1y_1 = startTime;
|
|
245
|
+
this.b1y_1 = totalElapsedTimeS;
|
|
246
|
+
this.c1y_1 = totalTimerTimeS;
|
|
247
|
+
this.d1y_1 = totalDistanceM;
|
|
248
|
+
this.e1y_1 = totalAscentM;
|
|
249
|
+
this.f1y_1 = totalDescentM;
|
|
250
|
+
this.g1y_1 = maxSpeedMs;
|
|
251
|
+
this.h1y_1 = minAltitudeM;
|
|
252
|
+
this.i1y_1 = maxAltitudeM;
|
|
253
|
+
this.j1y_1 = startLatitudeDeg;
|
|
254
|
+
this.k1y_1 = startLongitudeDeg;
|
|
255
|
+
this.l1y_1 = endLatitudeDeg;
|
|
256
|
+
this.m1y_1 = endLongitudeDeg;
|
|
257
|
+
}
|
|
258
|
+
protoOf(FitLap).toString = function () {
|
|
259
|
+
return 'FitLap(startTime=' + this.a1y_1.toString() + ', totalElapsedTimeS=' + this.b1y_1 + ', totalTimerTimeS=' + this.c1y_1 + ', totalDistanceM=' + this.d1y_1 + ', totalAscentM=' + this.e1y_1 + ', totalDescentM=' + this.f1y_1 + ', maxSpeedMs=' + this.g1y_1 + ', minAltitudeM=' + this.h1y_1 + ', maxAltitudeM=' + this.i1y_1 + ', startLatitudeDeg=' + this.j1y_1 + ', startLongitudeDeg=' + this.k1y_1 + ', endLatitudeDeg=' + this.l1y_1 + ', endLongitudeDeg=' + this.m1y_1 + ')';
|
|
260
|
+
};
|
|
261
|
+
protoOf(FitLap).hashCode = function () {
|
|
262
|
+
var result = this.a1y_1.hashCode();
|
|
263
|
+
result = imul(result, 31) + getNumberHashCode(this.b1y_1) | 0;
|
|
264
|
+
result = imul(result, 31) + getNumberHashCode(this.c1y_1) | 0;
|
|
265
|
+
result = imul(result, 31) + getNumberHashCode(this.d1y_1) | 0;
|
|
266
|
+
result = imul(result, 31) + this.e1y_1 | 0;
|
|
267
|
+
result = imul(result, 31) + this.f1y_1 | 0;
|
|
268
|
+
result = imul(result, 31) + (this.g1y_1 == null ? 0 : getNumberHashCode(this.g1y_1)) | 0;
|
|
269
|
+
result = imul(result, 31) + (this.h1y_1 == null ? 0 : getNumberHashCode(this.h1y_1)) | 0;
|
|
270
|
+
result = imul(result, 31) + (this.i1y_1 == null ? 0 : getNumberHashCode(this.i1y_1)) | 0;
|
|
271
|
+
result = imul(result, 31) + (this.j1y_1 == null ? 0 : getNumberHashCode(this.j1y_1)) | 0;
|
|
272
|
+
result = imul(result, 31) + (this.k1y_1 == null ? 0 : getNumberHashCode(this.k1y_1)) | 0;
|
|
273
|
+
result = imul(result, 31) + (this.l1y_1 == null ? 0 : getNumberHashCode(this.l1y_1)) | 0;
|
|
274
|
+
result = imul(result, 31) + (this.m1y_1 == null ? 0 : getNumberHashCode(this.m1y_1)) | 0;
|
|
275
|
+
return result;
|
|
276
|
+
};
|
|
277
|
+
protoOf(FitLap).equals = function (other) {
|
|
278
|
+
if (this === other)
|
|
279
|
+
return true;
|
|
280
|
+
if (!(other instanceof FitLap))
|
|
281
|
+
return false;
|
|
282
|
+
if (!this.a1y_1.equals(other.a1y_1))
|
|
283
|
+
return false;
|
|
284
|
+
if (!equals(this.b1y_1, other.b1y_1))
|
|
285
|
+
return false;
|
|
286
|
+
if (!equals(this.c1y_1, other.c1y_1))
|
|
287
|
+
return false;
|
|
288
|
+
if (!equals(this.d1y_1, other.d1y_1))
|
|
289
|
+
return false;
|
|
290
|
+
if (!(this.e1y_1 === other.e1y_1))
|
|
291
|
+
return false;
|
|
292
|
+
if (!(this.f1y_1 === other.f1y_1))
|
|
293
|
+
return false;
|
|
294
|
+
if (!equals(this.g1y_1, other.g1y_1))
|
|
295
|
+
return false;
|
|
296
|
+
if (!equals(this.h1y_1, other.h1y_1))
|
|
297
|
+
return false;
|
|
298
|
+
if (!equals(this.i1y_1, other.i1y_1))
|
|
299
|
+
return false;
|
|
300
|
+
if (!equals(this.j1y_1, other.j1y_1))
|
|
301
|
+
return false;
|
|
302
|
+
if (!equals(this.k1y_1, other.k1y_1))
|
|
303
|
+
return false;
|
|
304
|
+
if (!equals(this.l1y_1, other.l1y_1))
|
|
305
|
+
return false;
|
|
306
|
+
if (!equals(this.m1y_1, other.m1y_1))
|
|
307
|
+
return false;
|
|
308
|
+
return true;
|
|
309
|
+
};
|
|
310
|
+
function FitSport_CYCLING_getInstance() {
|
|
311
|
+
FitSport_initEntries();
|
|
312
|
+
return FitSport_CYCLING_instance;
|
|
313
|
+
}
|
|
314
|
+
function FitUnits() {
|
|
315
|
+
FitUnits_instance = this;
|
|
316
|
+
this.n1y_1 = new Long(-294592512, 146);
|
|
317
|
+
this.o1y_1 = new Long(631065600, 0);
|
|
318
|
+
this.p1y_1 = 1.1930464711111112E7;
|
|
319
|
+
this.q1y_1 = 5.0;
|
|
320
|
+
this.r1y_1 = 500.0;
|
|
321
|
+
this.s1y_1 = 100.0;
|
|
322
|
+
this.t1y_1 = 1000.0;
|
|
323
|
+
}
|
|
324
|
+
protoOf(FitUnits).u1y = function (degrees) {
|
|
325
|
+
return roundToInt(degrees * 1.1930464711111112E7);
|
|
326
|
+
};
|
|
327
|
+
var FitUnits_instance;
|
|
328
|
+
function FitUnits_getInstance() {
|
|
329
|
+
if (FitUnits_instance == null)
|
|
330
|
+
new FitUnits();
|
|
331
|
+
return FitUnits_instance;
|
|
332
|
+
}
|
|
333
|
+
function toFitBytes(_this__u8e3s4, name, startTime, sport) {
|
|
334
|
+
sport = sport === VOID ? FitSport_CYCLING_getInstance() : sport;
|
|
335
|
+
return FitEncoder_instance.x1y(toFitCourse(_this__u8e3s4, name, startTime, sport));
|
|
336
|
+
}
|
|
337
|
+
function toFitBytes_0(_this__u8e3s4, name, startTime, sport, interPathGap) {
|
|
338
|
+
sport = sport === VOID ? FitSport_CYCLING_getInstance() : sport;
|
|
339
|
+
interPathGap = interPathGap === VOID ? Companion_getInstance().dd_1 : interPathGap;
|
|
340
|
+
return FitEncoder_instance.x1y(toFitCourse_0(_this__u8e3s4, name, startTime, sport, interPathGap));
|
|
341
|
+
}
|
|
342
|
+
function toFitCourse(_this__u8e3s4, name, startTime, sport) {
|
|
343
|
+
sport = sport === VOID ? FitSport_CYCLING_getInstance() : sport;
|
|
344
|
+
return toFitCourse_0(listOf(_this__u8e3s4), name, startTime, sport);
|
|
345
|
+
}
|
|
346
|
+
function toFitCourse_0(_this__u8e3s4, name, startTime, sport, interPathGap) {
|
|
347
|
+
sport = sport === VOID ? FitSport_CYCLING_getInstance() : sport;
|
|
348
|
+
interPathGap = interPathGap === VOID ? Companion_getInstance().dd_1 : interPathGap;
|
|
349
|
+
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
350
|
+
// Inline function 'kotlin.require' call
|
|
351
|
+
if (!!_this__u8e3s4.n()) {
|
|
352
|
+
var message = 'Cannot build a FIT course from an empty list of paths';
|
|
353
|
+
throw IllegalArgumentException_init_$Create$(toString(message));
|
|
354
|
+
}
|
|
355
|
+
var tmp$ret$3;
|
|
356
|
+
$l$block_0: {
|
|
357
|
+
// Inline function 'kotlin.collections.all' call
|
|
358
|
+
var tmp;
|
|
359
|
+
if (isInterface(_this__u8e3s4, Collection)) {
|
|
360
|
+
tmp = _this__u8e3s4.n();
|
|
361
|
+
} else {
|
|
362
|
+
tmp = false;
|
|
363
|
+
}
|
|
364
|
+
if (tmp) {
|
|
365
|
+
tmp$ret$3 = true;
|
|
366
|
+
break $l$block_0;
|
|
367
|
+
}
|
|
368
|
+
var _iterator__ex2g4s = _this__u8e3s4.i();
|
|
369
|
+
while (_iterator__ex2g4s.j()) {
|
|
370
|
+
var element = _iterator__ex2g4s.k();
|
|
371
|
+
if (!(element.f1r_1 > 0)) {
|
|
372
|
+
tmp$ret$3 = false;
|
|
373
|
+
break $l$block_0;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
tmp$ret$3 = true;
|
|
377
|
+
}
|
|
378
|
+
// Inline function 'kotlin.require' call
|
|
379
|
+
if (!tmp$ret$3) {
|
|
380
|
+
var message_0 = 'Cannot build a FIT course from an empty Path';
|
|
381
|
+
throw IllegalArgumentException_init_$Create$(toString(message_0));
|
|
382
|
+
}
|
|
383
|
+
var segmentStart = startTime;
|
|
384
|
+
// Inline function 'kotlin.collections.map' call
|
|
385
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
386
|
+
var destination = ArrayList_init_$Create$(collectionSizeOrDefault(_this__u8e3s4, 10));
|
|
387
|
+
var _iterator__ex2g4s_0 = _this__u8e3s4.i();
|
|
388
|
+
while (_iterator__ex2g4s_0.j()) {
|
|
389
|
+
var item = _iterator__ex2g4s_0.k();
|
|
390
|
+
var segment = toFitSegment(item, segmentStart);
|
|
391
|
+
segmentStart = last(segment.o1x_1).q1x_1.vd(interPathGap);
|
|
392
|
+
destination.h(segment);
|
|
393
|
+
}
|
|
394
|
+
var segments = destination;
|
|
395
|
+
return new FitCourse(name, startTime, segments, sport);
|
|
396
|
+
}
|
|
397
|
+
function toFitSegment(_this__u8e3s4, startTime) {
|
|
398
|
+
var t0 = _this__u8e3s4.k1r(0);
|
|
399
|
+
var inductionVariable = 1;
|
|
400
|
+
var last = _this__u8e3s4.f1r_1;
|
|
401
|
+
if (inductionVariable < last)
|
|
402
|
+
do {
|
|
403
|
+
var i = inductionVariable;
|
|
404
|
+
inductionVariable = inductionVariable + 1 | 0;
|
|
405
|
+
// Inline function 'kotlin.require' call
|
|
406
|
+
if (!(_this__u8e3s4.k1r(i) >= _this__u8e3s4.k1r(i - 1 | 0))) {
|
|
407
|
+
var message = 'Path time must be monotonic to encode a FIT file, but time(' + i + ') = ' + _this__u8e3s4.k1r(i) + ' < time(' + (i - 1 | 0) + ') = ' + _this__u8e3s4.k1r(i - 1 | 0);
|
|
408
|
+
throw IllegalArgumentException_init_$Create$(toString(message));
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
while (inductionVariable < last);
|
|
412
|
+
// Inline function 'kotlin.collections.List' call
|
|
413
|
+
// Inline function 'kotlin.collections.MutableList' call
|
|
414
|
+
var size = _this__u8e3s4.f1r_1;
|
|
415
|
+
var list = ArrayList_init_$Create$(size);
|
|
416
|
+
// Inline function 'kotlin.repeat' call
|
|
417
|
+
var inductionVariable_0 = 0;
|
|
418
|
+
if (inductionVariable_0 < size)
|
|
419
|
+
do {
|
|
420
|
+
var index = inductionVariable_0;
|
|
421
|
+
inductionVariable_0 = inductionVariable_0 + 1 | 0;
|
|
422
|
+
Companion_getInstance();
|
|
423
|
+
// Inline function 'kotlin.time.Companion.milliseconds' call
|
|
424
|
+
var this_0 = numberToLong(_this__u8e3s4.k1r(index) - t0);
|
|
425
|
+
var tmp$ret$7 = toDuration(this_0, DurationUnit_MILLISECONDS_getInstance());
|
|
426
|
+
var tmp = startTime.vd(tmp$ret$7);
|
|
427
|
+
var tmp_0 = _this__u8e3s4.h1r(index) * 57.29577951308232;
|
|
428
|
+
var tmp_1 = _this__u8e3s4.i1r(index) * 57.29577951308232;
|
|
429
|
+
// Inline function 'kotlin.takeUnless' call
|
|
430
|
+
var this_1 = _this__u8e3s4.j1r(index);
|
|
431
|
+
var tmp_2;
|
|
432
|
+
if (!isNaN_0(this_1)) {
|
|
433
|
+
tmp_2 = this_1;
|
|
434
|
+
} else {
|
|
435
|
+
tmp_2 = null;
|
|
436
|
+
}
|
|
437
|
+
var tmp_3 = tmp_2;
|
|
438
|
+
var tmp_4 = _this__u8e3s4.w1u(index);
|
|
439
|
+
// Inline function 'kotlin.takeUnless' call
|
|
440
|
+
var this_2 = _this__u8e3s4.x1v(index);
|
|
441
|
+
var tmp_5;
|
|
442
|
+
if (!isNaN_0(this_2)) {
|
|
443
|
+
tmp_5 = this_2;
|
|
444
|
+
} else {
|
|
445
|
+
tmp_5 = null;
|
|
446
|
+
}
|
|
447
|
+
var tmp_6 = tmp_5;
|
|
448
|
+
var tmp0_safe_receiver = optionalComputed(_this__u8e3s4.p1r(index));
|
|
449
|
+
var tmp_7 = tmp0_safe_receiver == null ? null : roundToInt(tmp0_safe_receiver);
|
|
450
|
+
var tmp1_safe_receiver = optionalSensor(_this__u8e3s4.l1r(index));
|
|
451
|
+
var tmp_8 = tmp1_safe_receiver == null ? null : roundToInt(tmp1_safe_receiver);
|
|
452
|
+
var tmp2_safe_receiver = optionalSensor(_this__u8e3s4.m1r(index));
|
|
453
|
+
var tmp$ret$6 = new FitRecord(tmp, tmp_0, tmp_1, tmp_3, tmp_4, tmp_6, tmp_7, tmp_8, tmp2_safe_receiver == null ? null : roundToInt(tmp2_safe_receiver), optionalSensor(_this__u8e3s4.n1r(index)));
|
|
454
|
+
list.h(tmp$ret$6);
|
|
455
|
+
}
|
|
456
|
+
while (inductionVariable_0 < size);
|
|
457
|
+
var records = list;
|
|
458
|
+
var tmp_9 = _this__u8e3s4.o1s_1 / 1000.0;
|
|
459
|
+
var tmp_10 = _this__u8e3s4.o1s_1 / 1000.0;
|
|
460
|
+
var tmp_11 = _this__u8e3s4.j1s_1;
|
|
461
|
+
var tmp_12 = roundToIntOrZero(_this__u8e3s4.m1s_1);
|
|
462
|
+
var tmp_13 = roundToIntOrZero(-_this__u8e3s4.n1s_1);
|
|
463
|
+
var tmp0 = until(0, _this__u8e3s4.f1r_1);
|
|
464
|
+
var tmp$ret$12;
|
|
465
|
+
$l$block: {
|
|
466
|
+
// Inline function 'kotlin.collections.maxOfOrNull' call
|
|
467
|
+
var iterator = tmp0.i();
|
|
468
|
+
if (!iterator.j()) {
|
|
469
|
+
tmp$ret$12 = null;
|
|
470
|
+
break $l$block;
|
|
471
|
+
}
|
|
472
|
+
var it = iterator.k();
|
|
473
|
+
var maxValue = _this__u8e3s4.x1v(it);
|
|
474
|
+
while (iterator.j()) {
|
|
475
|
+
var it_0 = iterator.k();
|
|
476
|
+
var v = _this__u8e3s4.x1v(it_0);
|
|
477
|
+
// Inline function 'kotlin.comparisons.maxOf' call
|
|
478
|
+
var a = maxValue;
|
|
479
|
+
maxValue = Math.max(a, v);
|
|
480
|
+
}
|
|
481
|
+
tmp$ret$12 = maxValue;
|
|
482
|
+
}
|
|
483
|
+
var tmp0_safe_receiver_0 = tmp$ret$12;
|
|
484
|
+
var tmp_14;
|
|
485
|
+
if (tmp0_safe_receiver_0 == null) {
|
|
486
|
+
tmp_14 = null;
|
|
487
|
+
} else {
|
|
488
|
+
// Inline function 'kotlin.takeUnless' call
|
|
489
|
+
var tmp_15;
|
|
490
|
+
if (!isNaN_0(tmp0_safe_receiver_0)) {
|
|
491
|
+
tmp_15 = tmp0_safe_receiver_0;
|
|
492
|
+
} else {
|
|
493
|
+
tmp_15 = null;
|
|
494
|
+
}
|
|
495
|
+
tmp_14 = tmp_15;
|
|
496
|
+
}
|
|
497
|
+
var tmp_16 = tmp_14;
|
|
498
|
+
var tmp0_0 = until(0, _this__u8e3s4.f1r_1);
|
|
499
|
+
var tmp$ret$18;
|
|
500
|
+
$l$block_0: {
|
|
501
|
+
// Inline function 'kotlin.collections.minOfOrNull' call
|
|
502
|
+
var iterator_0 = tmp0_0.i();
|
|
503
|
+
if (!iterator_0.j()) {
|
|
504
|
+
tmp$ret$18 = null;
|
|
505
|
+
break $l$block_0;
|
|
506
|
+
}
|
|
507
|
+
var it_1 = iterator_0.k();
|
|
508
|
+
var minValue = _this__u8e3s4.j1r(it_1);
|
|
509
|
+
while (iterator_0.j()) {
|
|
510
|
+
var it_2 = iterator_0.k();
|
|
511
|
+
var v_0 = _this__u8e3s4.j1r(it_2);
|
|
512
|
+
// Inline function 'kotlin.comparisons.minOf' call
|
|
513
|
+
var a_0 = minValue;
|
|
514
|
+
minValue = Math.min(a_0, v_0);
|
|
515
|
+
}
|
|
516
|
+
tmp$ret$18 = minValue;
|
|
517
|
+
}
|
|
518
|
+
var tmp1_safe_receiver_0 = tmp$ret$18;
|
|
519
|
+
var tmp_17;
|
|
520
|
+
if (tmp1_safe_receiver_0 == null) {
|
|
521
|
+
tmp_17 = null;
|
|
522
|
+
} else {
|
|
523
|
+
// Inline function 'kotlin.takeUnless' call
|
|
524
|
+
var tmp_18;
|
|
525
|
+
if (!isNaN_0(tmp1_safe_receiver_0)) {
|
|
526
|
+
tmp_18 = tmp1_safe_receiver_0;
|
|
527
|
+
} else {
|
|
528
|
+
tmp_18 = null;
|
|
529
|
+
}
|
|
530
|
+
tmp_17 = tmp_18;
|
|
531
|
+
}
|
|
532
|
+
var tmp_19 = tmp_17;
|
|
533
|
+
var tmp0_1 = until(0, _this__u8e3s4.f1r_1);
|
|
534
|
+
var tmp$ret$24;
|
|
535
|
+
$l$block_1: {
|
|
536
|
+
// Inline function 'kotlin.collections.maxOfOrNull' call
|
|
537
|
+
var iterator_1 = tmp0_1.i();
|
|
538
|
+
if (!iterator_1.j()) {
|
|
539
|
+
tmp$ret$24 = null;
|
|
540
|
+
break $l$block_1;
|
|
541
|
+
}
|
|
542
|
+
var it_3 = iterator_1.k();
|
|
543
|
+
var maxValue_0 = _this__u8e3s4.j1r(it_3);
|
|
544
|
+
while (iterator_1.j()) {
|
|
545
|
+
var it_4 = iterator_1.k();
|
|
546
|
+
var v_1 = _this__u8e3s4.j1r(it_4);
|
|
547
|
+
// Inline function 'kotlin.comparisons.maxOf' call
|
|
548
|
+
var a_1 = maxValue_0;
|
|
549
|
+
maxValue_0 = Math.max(a_1, v_1);
|
|
550
|
+
}
|
|
551
|
+
tmp$ret$24 = maxValue_0;
|
|
552
|
+
}
|
|
553
|
+
var tmp2_safe_receiver_0 = tmp$ret$24;
|
|
554
|
+
var tmp_20;
|
|
555
|
+
if (tmp2_safe_receiver_0 == null) {
|
|
556
|
+
tmp_20 = null;
|
|
557
|
+
} else {
|
|
558
|
+
// Inline function 'kotlin.takeUnless' call
|
|
559
|
+
var tmp_21;
|
|
560
|
+
if (!isNaN_0(tmp2_safe_receiver_0)) {
|
|
561
|
+
tmp_21 = tmp2_safe_receiver_0;
|
|
562
|
+
} else {
|
|
563
|
+
tmp_21 = null;
|
|
564
|
+
}
|
|
565
|
+
tmp_20 = tmp_21;
|
|
566
|
+
}
|
|
567
|
+
return new FitSegment(records, new FitLap(startTime, tmp_9, tmp_10, tmp_11, tmp_12, tmp_13, tmp_16, tmp_19, tmp_20, _this__u8e3s4.h1r(0) * 57.29577951308232, _this__u8e3s4.i1r(0) * 57.29577951308232, _this__u8e3s4.h1r(_this__u8e3s4.f1r_1 - 1 | 0) * 57.29577951308232, _this__u8e3s4.i1r(_this__u8e3s4.f1r_1 - 1 | 0) * 57.29577951308232));
|
|
568
|
+
}
|
|
569
|
+
function optionalComputed(_this__u8e3s4) {
|
|
570
|
+
// Inline function 'kotlin.takeUnless' call
|
|
571
|
+
var tmp;
|
|
572
|
+
if (!(isNaN_0(_this__u8e3s4) || _this__u8e3s4 === 0.0)) {
|
|
573
|
+
tmp = _this__u8e3s4;
|
|
574
|
+
} else {
|
|
575
|
+
tmp = null;
|
|
576
|
+
}
|
|
577
|
+
return tmp;
|
|
578
|
+
}
|
|
579
|
+
function optionalSensor(_this__u8e3s4) {
|
|
580
|
+
// Inline function 'kotlin.takeUnless' call
|
|
581
|
+
var tmp;
|
|
582
|
+
if (!isNaN_0(_this__u8e3s4)) {
|
|
583
|
+
tmp = _this__u8e3s4;
|
|
584
|
+
} else {
|
|
585
|
+
tmp = null;
|
|
586
|
+
}
|
|
587
|
+
return tmp;
|
|
588
|
+
}
|
|
589
|
+
function roundToIntOrZero(_this__u8e3s4) {
|
|
590
|
+
return isNaN_0(_this__u8e3s4) ? 0 : roundToInt(_this__u8e3s4);
|
|
591
|
+
}
|
|
592
|
+
function lapMesg($this, lap) {
|
|
593
|
+
// Inline function 'io.github.glandais.fit.FitEncoder.mesg' call
|
|
594
|
+
var o = {};
|
|
595
|
+
o['mesgNum'] = 19;
|
|
596
|
+
o['startTime'] = toJsDate(FitEncoder_instance, lap.a1y_1);
|
|
597
|
+
o['timestamp'] = toJsDate(FitEncoder_instance, lap.a1y_1.vd(seconds(FitEncoder_instance, lap.b1y_1)));
|
|
598
|
+
o['totalElapsedTime'] = lap.b1y_1;
|
|
599
|
+
o['totalTimerTime'] = lap.c1y_1;
|
|
600
|
+
o['totalDistance'] = lap.d1y_1;
|
|
601
|
+
o['totalAscent'] = lap.e1y_1;
|
|
602
|
+
o['totalDescent'] = lap.f1y_1;
|
|
603
|
+
if (lap.c1y_1 > 0.0) {
|
|
604
|
+
o['avgSpeed'] = lap.d1y_1 / lap.c1y_1;
|
|
605
|
+
}
|
|
606
|
+
var tmp0_safe_receiver = lap.g1y_1;
|
|
607
|
+
if (tmp0_safe_receiver == null)
|
|
608
|
+
null;
|
|
609
|
+
else {
|
|
610
|
+
// Inline function 'kotlin.let' call
|
|
611
|
+
o['maxSpeed'] = tmp0_safe_receiver;
|
|
612
|
+
}
|
|
613
|
+
var tmp1_safe_receiver = lap.h1y_1;
|
|
614
|
+
if (tmp1_safe_receiver == null)
|
|
615
|
+
null;
|
|
616
|
+
else {
|
|
617
|
+
// Inline function 'kotlin.let' call
|
|
618
|
+
o['minAltitude'] = tmp1_safe_receiver;
|
|
619
|
+
}
|
|
620
|
+
var tmp2_safe_receiver = lap.i1y_1;
|
|
621
|
+
if (tmp2_safe_receiver == null)
|
|
622
|
+
null;
|
|
623
|
+
else {
|
|
624
|
+
// Inline function 'kotlin.let' call
|
|
625
|
+
o['maxAltitude'] = tmp2_safe_receiver;
|
|
626
|
+
}
|
|
627
|
+
var tmp3_safe_receiver = lap.j1y_1;
|
|
628
|
+
if (tmp3_safe_receiver == null)
|
|
629
|
+
null;
|
|
630
|
+
else {
|
|
631
|
+
// Inline function 'kotlin.let' call
|
|
632
|
+
o['startPositionLat'] = FitUnits_getInstance().u1y(tmp3_safe_receiver);
|
|
633
|
+
}
|
|
634
|
+
var tmp4_safe_receiver = lap.k1y_1;
|
|
635
|
+
if (tmp4_safe_receiver == null)
|
|
636
|
+
null;
|
|
637
|
+
else {
|
|
638
|
+
// Inline function 'kotlin.let' call
|
|
639
|
+
o['startPositionLong'] = FitUnits_getInstance().u1y(tmp4_safe_receiver);
|
|
640
|
+
}
|
|
641
|
+
var tmp5_safe_receiver = lap.l1y_1;
|
|
642
|
+
if (tmp5_safe_receiver == null)
|
|
643
|
+
null;
|
|
644
|
+
else {
|
|
645
|
+
// Inline function 'kotlin.let' call
|
|
646
|
+
o['endPositionLat'] = FitUnits_getInstance().u1y(tmp5_safe_receiver);
|
|
647
|
+
}
|
|
648
|
+
var tmp6_safe_receiver = lap.m1y_1;
|
|
649
|
+
if (tmp6_safe_receiver == null)
|
|
650
|
+
null;
|
|
651
|
+
else {
|
|
652
|
+
// Inline function 'kotlin.let' call
|
|
653
|
+
o['endPositionLong'] = FitUnits_getInstance().u1y(tmp6_safe_receiver);
|
|
654
|
+
}
|
|
655
|
+
return o;
|
|
656
|
+
}
|
|
657
|
+
function recordMesg($this, record) {
|
|
658
|
+
// Inline function 'io.github.glandais.fit.FitEncoder.mesg' call
|
|
659
|
+
var o = {};
|
|
660
|
+
o['mesgNum'] = 20;
|
|
661
|
+
o['timestamp'] = toJsDate(FitEncoder_instance, record.q1x_1);
|
|
662
|
+
o['positionLat'] = FitUnits_getInstance().u1y(record.r1x_1);
|
|
663
|
+
o['positionLong'] = FitUnits_getInstance().u1y(record.s1x_1);
|
|
664
|
+
o['distance'] = record.u1x_1;
|
|
665
|
+
var tmp0_safe_receiver = record.t1x_1;
|
|
666
|
+
if (tmp0_safe_receiver == null)
|
|
667
|
+
null;
|
|
668
|
+
else {
|
|
669
|
+
// Inline function 'kotlin.let' call
|
|
670
|
+
o['altitude'] = tmp0_safe_receiver;
|
|
671
|
+
}
|
|
672
|
+
var tmp1_safe_receiver = record.v1x_1;
|
|
673
|
+
if (tmp1_safe_receiver == null)
|
|
674
|
+
null;
|
|
675
|
+
else {
|
|
676
|
+
// Inline function 'kotlin.let' call
|
|
677
|
+
o['speed'] = tmp1_safe_receiver;
|
|
678
|
+
}
|
|
679
|
+
var tmp2_safe_receiver = record.w1x_1;
|
|
680
|
+
if (tmp2_safe_receiver == null)
|
|
681
|
+
null;
|
|
682
|
+
else {
|
|
683
|
+
// Inline function 'kotlin.let' call
|
|
684
|
+
o['power'] = tmp2_safe_receiver;
|
|
685
|
+
}
|
|
686
|
+
var tmp3_safe_receiver = record.x1x_1;
|
|
687
|
+
if (tmp3_safe_receiver == null)
|
|
688
|
+
null;
|
|
689
|
+
else {
|
|
690
|
+
// Inline function 'kotlin.let' call
|
|
691
|
+
o['heartRate'] = tmp3_safe_receiver;
|
|
692
|
+
}
|
|
693
|
+
var tmp4_safe_receiver = record.y1x_1;
|
|
694
|
+
if (tmp4_safe_receiver == null)
|
|
695
|
+
null;
|
|
696
|
+
else {
|
|
697
|
+
// Inline function 'kotlin.let' call
|
|
698
|
+
o['cadence'] = tmp4_safe_receiver;
|
|
699
|
+
}
|
|
700
|
+
var tmp5_safe_receiver = record.z1x_1;
|
|
701
|
+
if (tmp5_safe_receiver == null)
|
|
702
|
+
null;
|
|
703
|
+
else {
|
|
704
|
+
// Inline function 'kotlin.let' call
|
|
705
|
+
o['temperature'] = numberToInt(round(tmp5_safe_receiver));
|
|
706
|
+
}
|
|
707
|
+
return o;
|
|
708
|
+
}
|
|
709
|
+
function timerEvent($this, at, eventType) {
|
|
710
|
+
// Inline function 'io.github.glandais.fit.FitEncoder.mesg' call
|
|
711
|
+
var o = {};
|
|
712
|
+
o['mesgNum'] = 21;
|
|
713
|
+
o['event'] = 0;
|
|
714
|
+
o['eventType'] = eventType;
|
|
715
|
+
o['eventGroup'] = 0;
|
|
716
|
+
o['timestamp'] = toJsDate(FitEncoder_instance, at);
|
|
717
|
+
return o;
|
|
718
|
+
}
|
|
719
|
+
function toByteArray($this, $receiver) {
|
|
720
|
+
var tmp = 0;
|
|
721
|
+
var tmp_0 = $receiver.length;
|
|
722
|
+
var tmp_1 = new Int8Array(tmp_0);
|
|
723
|
+
while (tmp < tmp_0) {
|
|
724
|
+
var tmp_2 = tmp;
|
|
725
|
+
// Inline function 'org.khronos.webgl.get' call
|
|
726
|
+
// Inline function 'kotlin.js.asDynamic' call
|
|
727
|
+
tmp_1[tmp_2] = $receiver[tmp_2];
|
|
728
|
+
tmp = tmp + 1 | 0;
|
|
729
|
+
}
|
|
730
|
+
return tmp_1;
|
|
731
|
+
}
|
|
732
|
+
function toJsDate($this, $receiver) {
|
|
733
|
+
return new Date(toNumber($receiver.ud()));
|
|
734
|
+
}
|
|
735
|
+
function seconds($this, $receiver) {
|
|
736
|
+
Companion_getInstance();
|
|
737
|
+
// Inline function 'kotlin.time.Companion.milliseconds' call
|
|
738
|
+
var this_0 = numberToLong($receiver * 1000.0);
|
|
739
|
+
return toDuration(this_0, DurationUnit_MILLISECONDS_getInstance());
|
|
740
|
+
}
|
|
741
|
+
function FitEncoder() {
|
|
742
|
+
this.v1y_1 = 12345;
|
|
743
|
+
this.w1y_1 = 12345.0;
|
|
744
|
+
}
|
|
745
|
+
protoOf(FitEncoder).x1y = function (course) {
|
|
746
|
+
var encoder = new FitSdk.Encoder();
|
|
747
|
+
// Inline function 'io.github.glandais.fit.FitEncoder.mesg' call
|
|
748
|
+
var o = {};
|
|
749
|
+
o['mesgNum'] = 0;
|
|
750
|
+
o['type'] = 6;
|
|
751
|
+
o['manufacturer'] = 15;
|
|
752
|
+
o['product'] = 12345;
|
|
753
|
+
o['serialNumber'] = 12345.0;
|
|
754
|
+
o['number'] = getStringHashCode(course.k1x_1) & 65535;
|
|
755
|
+
o['timeCreated'] = toJsDate(FitEncoder_instance, course.l1x_1);
|
|
756
|
+
encoder.writeMesg(o);
|
|
757
|
+
// Inline function 'io.github.glandais.fit.FitEncoder.mesg' call
|
|
758
|
+
var o_0 = {};
|
|
759
|
+
o_0['mesgNum'] = 31;
|
|
760
|
+
o_0['name'] = course.k1x_1;
|
|
761
|
+
o_0['sport'] = course.n1x_1.j1x_1;
|
|
762
|
+
encoder.writeMesg(o_0);
|
|
763
|
+
// Inline function 'kotlin.collections.map' call
|
|
764
|
+
var this_0 = course.m1x_1;
|
|
765
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
766
|
+
var destination = ArrayList_init_$Create$(collectionSizeOrDefault(this_0, 10));
|
|
767
|
+
var _iterator__ex2g4s = this_0.i();
|
|
768
|
+
while (_iterator__ex2g4s.j()) {
|
|
769
|
+
var item = _iterator__ex2g4s.k();
|
|
770
|
+
var tmp$ret$6 = item.p1x_1;
|
|
771
|
+
destination.h(tmp$ret$6);
|
|
772
|
+
}
|
|
773
|
+
var _iterator__ex2g4s_0 = destination.i();
|
|
774
|
+
while (_iterator__ex2g4s_0.j()) {
|
|
775
|
+
var lap = _iterator__ex2g4s_0.k();
|
|
776
|
+
encoder.writeMesg(lapMesg(this, lap));
|
|
777
|
+
}
|
|
778
|
+
var iterator = course.m1x_1.i();
|
|
779
|
+
var index = 0;
|
|
780
|
+
while (iterator.j()) {
|
|
781
|
+
var index_0 = index;
|
|
782
|
+
index = index + 1 | 0;
|
|
783
|
+
var segment = iterator.k();
|
|
784
|
+
var isLast = index_0 === get_lastIndex(course.m1x_1);
|
|
785
|
+
encoder.writeMesg(timerEvent(this, first(segment.o1x_1).q1x_1, 0));
|
|
786
|
+
var _iterator__ex2g4s_1 = segment.o1x_1.i();
|
|
787
|
+
while (_iterator__ex2g4s_1.j()) {
|
|
788
|
+
var record = _iterator__ex2g4s_1.k();
|
|
789
|
+
encoder.writeMesg(recordMesg(this, record));
|
|
790
|
+
}
|
|
791
|
+
encoder.writeMesg(timerEvent(this, last(segment.o1x_1).q1x_1, isLast ? 4 : 1));
|
|
792
|
+
}
|
|
793
|
+
return toByteArray(this, encoder.close());
|
|
794
|
+
};
|
|
795
|
+
var FitEncoder_instance;
|
|
796
|
+
function FitEncoder_getInstance() {
|
|
797
|
+
return FitEncoder_instance;
|
|
798
|
+
}
|
|
799
|
+
//region block: init
|
|
800
|
+
Companion_instance = new Companion();
|
|
801
|
+
FitEncoder_instance = new FitEncoder();
|
|
802
|
+
//endregion
|
|
803
|
+
//region block: exports
|
|
804
|
+
_.$_$ = _.$_$ || {};
|
|
805
|
+
_.$_$.a = toFitBytes;
|
|
806
|
+
_.$_$.b = toFitBytes_0;
|
|
807
|
+
//endregion
|
|
808
|
+
return _;
|
|
809
|
+
}));
|
|
810
|
+
|
|
811
|
+
//# sourceMappingURL=vcyclist-fit.js.map
|