@glandais/vcyclist-engine 5.1.1 → 6.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -30,122 +30,125 @@
30
30
  var imul = Math.imul;
31
31
  var hypot = Math.hypot;
32
32
  var sign = Math.sign;
33
- var protoOf = kotlin_kotlin.$_$.j7;
34
- var initMetadataForCompanion = kotlin_kotlin.$_$.v6;
33
+ var protoOf = kotlin_kotlin.$_$.o7;
34
+ var initMetadataForCompanion = kotlin_kotlin.$_$.a7;
35
35
  var VOID = kotlin_kotlin.$_$.a;
36
- var getNumberHashCode = kotlin_kotlin.$_$.q6;
37
- var equals = kotlin_kotlin.$_$.n6;
38
- var initMetadataForClass = kotlin_kotlin.$_$.u6;
39
- var toString = kotlin_kotlin.$_$.m7;
40
- var hashCode = kotlin_kotlin.$_$.t6;
36
+ var getNumberHashCode = kotlin_kotlin.$_$.v6;
37
+ var equals = kotlin_kotlin.$_$.s6;
38
+ var initMetadataForClass = kotlin_kotlin.$_$.z6;
39
+ var toString = kotlin_kotlin.$_$.r7;
40
+ var hashCode = kotlin_kotlin.$_$.y6;
41
41
  var ElevationGainPreset_DEM_getInstance = kotlin_io_github_glandais_gpx.$_$.c;
42
- var initMetadataForObject = kotlin_kotlin.$_$.a7;
43
- var getBooleanHashCode = kotlin_kotlin.$_$.p6;
44
- var IllegalArgumentException_init_$Create$ = kotlin_kotlin.$_$.a2;
45
- var Unit_instance = kotlin_kotlin.$_$.g1;
42
+ var initMetadataForObject = kotlin_kotlin.$_$.f7;
43
+ var getBooleanHashCode = kotlin_kotlin.$_$.u6;
44
+ var isFinite = kotlin_kotlin.$_$.ab;
45
+ var IllegalArgumentException_init_$Create$ = kotlin_kotlin.$_$.b2;
46
+ var Unit_instance = kotlin_kotlin.$_$.h1;
46
47
  var ElevationGainOptions = kotlin_io_github_glandais_gpx.$_$.y;
47
- var isFinite = kotlin_kotlin.$_$.ma;
48
- var CoroutineImpl = kotlin_kotlin.$_$.d5;
48
+ var CoroutineImpl = kotlin_kotlin.$_$.h5;
49
49
  var PointPerDistance_instance = kotlin_io_github_glandais_gpx.$_$.o;
50
50
  var ElevationStep_instance = kotlin_io_github_glandais_gpx.$_$.l;
51
- var get_COROUTINE_SUSPENDED = kotlin_kotlin.$_$.o4;
51
+ var get_COROUTINE_SUSPENDED = kotlin_kotlin.$_$.s4;
52
52
  var PointPerSecond_instance = kotlin_io_github_glandais_gpx.$_$.p;
53
53
  var PathSimplifier_instance = kotlin_io_github_glandais_gpx.$_$.m;
54
54
  var ElevationGain_instance = kotlin_io_github_glandais_gpx.$_$.k;
55
- var initMetadataForCoroutine = kotlin_kotlin.$_$.w6;
56
- var Companion_instance = kotlin_kotlin.$_$.e1;
57
- var collectionSizeOrDefault = kotlin_kotlin.$_$.x2;
58
- var ArrayList_init_$Create$ = kotlin_kotlin.$_$.i1;
59
- var enumEntries = kotlin_kotlin.$_$.f5;
60
- var Enum = kotlin_kotlin.$_$.t9;
61
- var noWhenBranchMatchedException = kotlin_kotlin.$_$.qa;
62
- var ArrayList_init_$Create$_0 = kotlin_kotlin.$_$.j1;
63
- var last = kotlin_kotlin.$_$.q3;
64
- var toIntArray = kotlin_kotlin.$_$.f4;
65
- var sortedWith = kotlin_kotlin.$_$.b4;
66
- var toMutableList = kotlin_kotlin.$_$.j4;
67
- var first = kotlin_kotlin.$_$.j3;
68
- var removeAll = kotlin_kotlin.$_$.w3;
69
- var numberRangeToNumber = kotlin_kotlin.$_$.f7;
55
+ var initMetadataForCoroutine = kotlin_kotlin.$_$.b7;
56
+ var Companion_instance = kotlin_kotlin.$_$.f1;
57
+ var collectionSizeOrDefault = kotlin_kotlin.$_$.y2;
58
+ var ArrayList_init_$Create$ = kotlin_kotlin.$_$.j1;
59
+ var enumEntries = kotlin_kotlin.$_$.j5;
60
+ var Enum = kotlin_kotlin.$_$.ha;
61
+ var noWhenBranchMatchedException = kotlin_kotlin.$_$.eb;
62
+ var last = kotlin_kotlin.$_$.s3;
63
+ var toIntArray = kotlin_kotlin.$_$.j4;
64
+ var sortedWith = kotlin_kotlin.$_$.f4;
65
+ var toMutableList = kotlin_kotlin.$_$.n4;
66
+ var ArrayList_init_$Create$_0 = kotlin_kotlin.$_$.k1;
67
+ var first = kotlin_kotlin.$_$.l3;
68
+ var removeAll = kotlin_kotlin.$_$.a4;
69
+ var numberRangeToNumber = kotlin_kotlin.$_$.k7;
70
70
  var Vector3D = kotlin_io_github_glandais_elevation.$_$.h;
71
- var emptyList = kotlin_kotlin.$_$.g3;
72
- var coerceIn = kotlin_kotlin.$_$.u7;
71
+ var emptyList = kotlin_kotlin.$_$.h3;
72
+ var coerceIn = kotlin_kotlin.$_$.z7;
73
73
  var DouglasPeucker_instance = kotlin_io_github_glandais_elevation.$_$.b;
74
- var FunctionAdapter = kotlin_kotlin.$_$.b6;
75
- var isInterface = kotlin_kotlin.$_$.c7;
76
- var Comparator = kotlin_kotlin.$_$.s9;
77
- var compareValues = kotlin_kotlin.$_$.m4;
78
- var until = kotlin_kotlin.$_$.z7;
79
- var Pair = kotlin_kotlin.$_$.z9;
80
- var listOf = kotlin_kotlin.$_$.r3;
81
- var Default_getInstance = kotlin_kotlin.$_$.b1;
82
- var equals_0 = kotlin_kotlin.$_$.p8;
83
- var isNaN_0 = kotlin_kotlin.$_$.oa;
74
+ var FunctionAdapter = kotlin_kotlin.$_$.g6;
75
+ var isInterface = kotlin_kotlin.$_$.h7;
76
+ var Comparator = kotlin_kotlin.$_$.ga;
77
+ var compareValues = kotlin_kotlin.$_$.q4;
78
+ var until = kotlin_kotlin.$_$.e8;
79
+ var Pair = kotlin_kotlin.$_$.na;
80
+ var listOf = kotlin_kotlin.$_$.t3;
81
+ var initMetadataForInterface = kotlin_kotlin.$_$.d7;
82
+ var Default_getInstance = kotlin_kotlin.$_$.c1;
83
+ var equals_0 = kotlin_kotlin.$_$.v8;
84
+ var isNaN_0 = kotlin_kotlin.$_$.cb;
84
85
  var PointField_TEMPERATURE_getInstance = kotlin_io_github_glandais_gpx.$_$.d;
85
86
  var get_entries = kotlin_io_github_glandais_gpx.$_$.a1;
86
87
  var Path = kotlin_io_github_glandais_gpx.$_$.z;
87
- var arrayCopy = kotlin_kotlin.$_$.t2;
88
- var sort = kotlin_kotlin.$_$.d4;
89
- var numberToInt = kotlin_kotlin.$_$.h7;
90
- var coerceIn_0 = kotlin_kotlin.$_$.v7;
91
- var lastOrNull = kotlin_kotlin.$_$.p3;
92
- var HashMap_init_$Create$ = kotlin_kotlin.$_$.l1;
93
- var fromInt = kotlin_kotlin.$_$.s5;
94
- var add = kotlin_kotlin.$_$.i5;
95
- var numberToLong = kotlin_kotlin.$_$.v5;
96
- var shiftLeft = kotlin_kotlin.$_$.w5;
97
- var Long = kotlin_kotlin.$_$.x9;
98
- var bitwiseAnd = kotlin_kotlin.$_$.j5;
99
- var bitwiseXor = kotlin_kotlin.$_$.l5;
100
- var copyOf = kotlin_kotlin.$_$.c3;
101
- var coerceAtLeast = kotlin_kotlin.$_$.r7;
102
- var round = kotlin_kotlin.$_$.p7;
103
- var listOf_0 = kotlin_kotlin.$_$.s3;
104
- var Collection = kotlin_kotlin.$_$.n2;
105
- var zipWithNext = kotlin_kotlin.$_$.l4;
106
- var toDoubleArray = kotlin_kotlin.$_$.e4;
107
- var joinToString = kotlin_kotlin.$_$.m3;
88
+ var arrayCopy = kotlin_kotlin.$_$.u2;
89
+ var sort = kotlin_kotlin.$_$.h4;
90
+ var numberToInt = kotlin_kotlin.$_$.m7;
91
+ var coerceIn_0 = kotlin_kotlin.$_$.a8;
92
+ var lastOrNull = kotlin_kotlin.$_$.r3;
93
+ var HashMap_init_$Create$ = kotlin_kotlin.$_$.m1;
94
+ var fromInt = kotlin_kotlin.$_$.w5;
95
+ var add = kotlin_kotlin.$_$.m5;
96
+ var numberToLong = kotlin_kotlin.$_$.a6;
97
+ var shiftLeft = kotlin_kotlin.$_$.b6;
98
+ var Long = kotlin_kotlin.$_$.la;
99
+ var bitwiseAnd = kotlin_kotlin.$_$.n5;
100
+ var bitwiseXor = kotlin_kotlin.$_$.p5;
101
+ var copyOf = kotlin_kotlin.$_$.d3;
102
+ var coerceAtLeast = kotlin_kotlin.$_$.w7;
103
+ var fill = kotlin_kotlin.$_$.i3;
104
+ var round = kotlin_kotlin.$_$.u7;
105
+ var booleanArray = kotlin_kotlin.$_$.i6;
106
+ var listOf_0 = kotlin_kotlin.$_$.u3;
107
+ var Collection = kotlin_kotlin.$_$.o2;
108
+ var zipWithNext = kotlin_kotlin.$_$.p4;
109
+ var toDoubleArray = kotlin_kotlin.$_$.i4;
110
+ var joinToString = kotlin_kotlin.$_$.o3;
108
111
  var GpxParser_instance = kotlin_io_github_glandais_gpx.$_$.e;
109
- var copyToArray = kotlin_kotlin.$_$.f3;
112
+ var copyToArray = kotlin_kotlin.$_$.g3;
110
113
  var firstTrackAsPath = kotlin_io_github_glandais_gpx.$_$.r;
111
114
  var tracksAsPaths = kotlin_io_github_glandais_gpx.$_$.v;
112
115
  var segmentsAsPaths = kotlin_io_github_glandais_gpx.$_$.t;
113
116
  var GpxPathKind_TRACK_getInstance = kotlin_io_github_glandais_gpx.$_$.b;
114
- var setOf = kotlin_kotlin.$_$.z3;
117
+ var setOf = kotlin_kotlin.$_$.d4;
115
118
  var GpxPathKind_ROUTE_getInstance = kotlin_io_github_glandais_gpx.$_$.a;
116
119
  var GpxWriter_instance = kotlin_io_github_glandais_gpx.$_$.g;
117
- var toList = kotlin_kotlin.$_$.i4;
118
- var Companion_getInstance = kotlin_kotlin.$_$.d1;
120
+ var toList = kotlin_kotlin.$_$.m4;
121
+ var Companion_getInstance = kotlin_kotlin.$_$.e1;
119
122
  var pathsToGpxDocument = kotlin_io_github_glandais_gpx.$_$.s;
120
123
  var toGpxDocument = kotlin_io_github_glandais_gpx.$_$.u;
121
124
  var GlobalScope_instance = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.a;
122
- var promise = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.j;
125
+ var promise = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.l;
123
126
  var Companion_getInstance_0 = kotlin_io_github_glandais_gpx.$_$.n;
124
- var IllegalStateException_init_$Create$ = kotlin_kotlin.$_$.c2;
127
+ var IllegalStateException_init_$Create$ = kotlin_kotlin.$_$.d2;
125
128
  var CsvOptions = kotlin_io_github_glandais_gpx.$_$.w;
126
129
  var CsvWriter_instance = kotlin_io_github_glandais_gpx.$_$.h;
127
- var firstOrNull = kotlin_kotlin.$_$.q8;
128
- var Char = kotlin_kotlin.$_$.r9;
129
- var charSequenceLength = kotlin_kotlin.$_$.i6;
130
+ var firstOrNull = kotlin_kotlin.$_$.w8;
131
+ var Char = kotlin_kotlin.$_$.fa;
132
+ var charSequenceLength = kotlin_kotlin.$_$.n6;
130
133
  var JsonOptions = kotlin_io_github_glandais_gpx.$_$.x;
131
134
  var JsonWriter_instance = kotlin_io_github_glandais_gpx.$_$.i;
132
135
  var toFitBytes = kotlin_io_github_glandais_fit.$_$.a;
133
- var Companion_getInstance_1 = kotlin_kotlin.$_$.c1;
134
- var DurationUnit_MILLISECONDS_getInstance = kotlin_kotlin.$_$.w;
135
- var toDuration = kotlin_kotlin.$_$.q9;
136
+ var Companion_getInstance_1 = kotlin_kotlin.$_$.d1;
137
+ var DurationUnit_MILLISECONDS_getInstance = kotlin_kotlin.$_$.x;
138
+ var toDuration = kotlin_kotlin.$_$.ea;
136
139
  var toFitBytes_0 = kotlin_io_github_glandais_fit.$_$.b;
137
- var toNumber = kotlin_kotlin.$_$.a6;
140
+ var toNumber = kotlin_kotlin.$_$.f6;
138
141
  var Companion_getInstance_2 = kotlin_io_github_glandais_gpx.$_$.f;
139
142
  var GpxWaypoint = kotlin_io_github_glandais_gpx.$_$.q;
140
143
  var Companion_instance_0 = kotlin_io_github_glandais_gpx.$_$.j;
141
144
  var ElevationProvider = kotlin_io_github_glandais_elevation.$_$.e;
142
145
  var ElevationProviderConfig = kotlin_io_github_glandais_elevation.$_$.d;
143
- var sorted = kotlin_kotlin.$_$.c4;
144
- var THROW_CCE = kotlin_kotlin.$_$.ca;
145
- var CoroutineScope = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.h;
146
- var initMetadataForLambda = kotlin_kotlin.$_$.z6;
147
- var constructCallableReference = kotlin_kotlin.$_$.k6;
148
- var setOf_0 = kotlin_kotlin.$_$.a4;
146
+ var sorted = kotlin_kotlin.$_$.g4;
147
+ var THROW_CCE = kotlin_kotlin.$_$.qa;
148
+ var CoroutineScope = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.j;
149
+ var initMetadataForLambda = kotlin_kotlin.$_$.e7;
150
+ var constructCallableReference = kotlin_kotlin.$_$.p6;
151
+ var setOf_0 = kotlin_kotlin.$_$.e4;
149
152
  //endregion
150
153
  //region block: pre-declaration
151
154
  initMetadataForCompanion(Companion);
@@ -176,8 +179,11 @@
176
179
  initMetadataForObject(ClimbDetector, 'ClimbDetector');
177
180
  initMetadataForObject(AeroPowerProvider, 'AeroPowerProvider');
178
181
  initMetadataForObject(AeroProviderConstant, 'AeroProviderConstant');
182
+ function onDelivered(pointIndex, powerW) {
183
+ }
184
+ initMetadataForInterface(CyclistPowerProvider, 'CyclistPowerProvider');
179
185
  initMetadataForCompanion(Companion_6);
180
- initMetadataForClass(CyclistPowerProviderBase, 'CyclistPowerProviderBase');
186
+ initMetadataForClass(CyclistPowerProviderBase, 'CyclistPowerProviderBase', VOID, VOID, [CyclistPowerProvider]);
181
187
  initMetadataForCompanion(Companion_7);
182
188
  initMetadataForClass(PowerModel, 'PowerModel', VOID, Enum);
183
189
  initMetadataForClass(CyclistPowerSpec, 'CyclistPowerSpec', CyclistPowerSpec);
@@ -191,10 +197,10 @@
191
197
  initMetadataForClass(PowerProviderCriticalPower, 'PowerProviderCriticalPower', VOID, CyclistPowerProviderBase);
192
198
  initMetadataForCompanion(Companion_9);
193
199
  initMetadataForClass(PowerProviderDurability, 'PowerProviderDurability', VOID, CyclistPowerProviderBase);
194
- initMetadataForObject(PowerProviderFromData, 'PowerProviderFromData');
195
- initMetadataForClass(PowerProviderSlewLimited, 'PowerProviderSlewLimited');
200
+ initMetadataForObject(PowerProviderFromData, 'PowerProviderFromData', VOID, VOID, [CyclistPowerProvider]);
201
+ initMetadataForClass(PowerProviderSlewLimited, 'PowerProviderSlewLimited', VOID, VOID, [CyclistPowerProvider]);
196
202
  initMetadataForCompanion(Companion_10);
197
- initMetadataForClass(PowerProviderTerrainPacing, 'PowerProviderTerrainPacing');
203
+ initMetadataForClass(PowerProviderTerrainPacing, 'PowerProviderTerrainPacing', VOID, VOID, [CyclistPowerProvider]);
198
204
  initMetadataForObject(RhoProviderDefault, 'RhoProviderDefault');
199
205
  initMetadataForObject(RhoProviderEstimate, 'RhoProviderEstimate');
200
206
  initMetadataForObject(RollingResistancePowerProvider, 'RollingResistancePowerProvider');
@@ -367,16 +373,16 @@
367
373
  protoOf(CoursePhysics).get_bike_wojgoa_k$ = function () {
368
374
  return this.course_1.bike_1;
369
375
  };
370
- protoOf(CoursePhysics).copy_ulppn1_k$ = function (course, rhoProvider, aeroProvider, windProvider, cyclistPowerProvider) {
376
+ protoOf(CoursePhysics).copy_753qsd_k$ = function (course, rhoProvider, aeroProvider, windProvider, cyclistPowerProvider) {
371
377
  return new CoursePhysics(course, rhoProvider, aeroProvider, windProvider, cyclistPowerProvider);
372
378
  };
373
- protoOf(CoursePhysics).copy$default_a3dskc_k$ = function (course, rhoProvider, aeroProvider, windProvider, cyclistPowerProvider, $super) {
379
+ protoOf(CoursePhysics).copy$default_f9apxw_k$ = function (course, rhoProvider, aeroProvider, windProvider, cyclistPowerProvider, $super) {
374
380
  course = course === VOID ? this.course_1 : course;
375
381
  rhoProvider = rhoProvider === VOID ? this.rhoProvider_1 : rhoProvider;
376
382
  aeroProvider = aeroProvider === VOID ? this.aeroProvider_1 : aeroProvider;
377
383
  windProvider = windProvider === VOID ? this.windProvider_1 : windProvider;
378
384
  cyclistPowerProvider = cyclistPowerProvider === VOID ? this.cyclistPowerProvider_1 : cyclistPowerProvider;
379
- return $super === VOID ? this.copy_ulppn1_k$(course, rhoProvider, aeroProvider, windProvider, cyclistPowerProvider) : $super.copy_ulppn1_k$.call(this, course, rhoProvider, aeroProvider, windProvider, cyclistPowerProvider);
385
+ return $super === VOID ? this.copy_753qsd_k$(course, rhoProvider, aeroProvider, windProvider, cyclistPowerProvider) : $super.copy_753qsd_k$.call(this, course, rhoProvider, aeroProvider, windProvider, cyclistPowerProvider);
380
386
  };
381
387
  protoOf(CoursePhysics).toString = function () {
382
388
  return 'CoursePhysics(course=' + this.course_1.toString() + ', rhoProvider=' + toString(this.rhoProvider_1) + ', aeroProvider=' + toString(this.aeroProvider_1) + ', windProvider=' + toString(this.windProvider_1) + ', cyclistPowerProvider=' + toString(this.cyclistPowerProvider_1) + ')';
@@ -561,13 +567,13 @@
561
567
  this.criticalPowerW_1 = criticalPowerW;
562
568
  this.wPrimeJ_1 = wPrimeJ;
563
569
  // Inline function 'kotlin.require' call
564
- if (!(this.criticalPowerW_1 > 0.0)) {
565
- var message = 'criticalPowerW must be > 0, got ' + this.criticalPowerW_1;
570
+ if (!(this.criticalPowerW_1 > 0.0 && isFinite(this.criticalPowerW_1))) {
571
+ var message = 'criticalPowerW must be finite and > 0, got ' + this.criticalPowerW_1;
566
572
  throw IllegalArgumentException_init_$Create$(toString(message));
567
573
  }
568
574
  // Inline function 'kotlin.require' call
569
- if (!(this.wPrimeJ_1 > 0.0)) {
570
- var message_0 = 'wPrimeJ must be > 0, got ' + this.wPrimeJ_1;
575
+ if (!(this.wPrimeJ_1 > 0.0 && isFinite(this.wPrimeJ_1))) {
576
+ var message_0 = 'wPrimeJ must be finite and > 0, got ' + this.wPrimeJ_1;
571
577
  throw IllegalArgumentException_init_$Create$(toString(message_0));
572
578
  }
573
579
  }
@@ -738,14 +744,14 @@
738
744
  PathCurvature_instance.compute_s9yd16_k$(this.path0__1, this.options_1.curvature_1);
739
745
  }
740
746
 
741
- var working = this.course_1.copy$default_a3dskc_k$(this.course_1.course_1.copy$default_mmxsnj_k$(this.path0__1));
747
+ var working = this.course_1.copy$default_f9apxw_k$(this.course_1.course_1.copy$default_mmxsnj_k$(this.path0__1));
742
748
  if (this.options_1.computeMaxSpeeds_1 || this.options_1.virtualizeTrack_1) {
743
749
  MaxSpeedComputer_instance.computeMaxSpeeds_jc4v4o_k$(working.course_1);
744
750
  }
745
751
 
746
752
  if (this.options_1.virtualizeTrack_1) {
747
753
  this.path0__1 = VirtualizeService_instance.virtualizeTrack_tp3afi_k$(working);
748
- working = working.copy$default_a3dskc_k$(working.course_1.copy$default_mmxsnj_k$(this.path0__1));
754
+ working = working.copy$default_f9apxw_k$(working.course_1.copy$default_mmxsnj_k$(this.path0__1));
749
755
  }
750
756
 
751
757
  if (this.options_1.computeOnePointPerSecond_1) {
@@ -920,7 +926,7 @@
920
926
  static_init();
921
927
  return RoadCondition_WET_instance;
922
928
  }
923
- function Climb(startIndex, endIndex, startDistanceM, endDistanceM, startElevationM, endElevationM, positiveElevationM, negativeElevationM, parts) {
929
+ function Climb(startIndex, endIndex, startDistanceM, endDistanceM, startElevationM, endElevationM, positiveElevationM, negativeElevationM, climbingDistanceM, parts) {
924
930
  this.startIndex_1 = startIndex;
925
931
  this.endIndex_1 = endIndex;
926
932
  this.startDistanceM_1 = startDistanceM;
@@ -929,6 +935,7 @@
929
935
  this.endElevationM_1 = endElevationM;
930
936
  this.positiveElevationM_1 = positiveElevationM;
931
937
  this.negativeElevationM_1 = negativeElevationM;
938
+ this.climbingDistanceM_1 = climbingDistanceM;
932
939
  this.parts_1 = parts;
933
940
  }
934
941
  protoOf(Climb).get_lengthM_2aqrzy_k$ = function () {
@@ -941,30 +948,10 @@
941
948
  return this.get_lengthM_2aqrzy_k$() === 0.0 ? 0.0 : this.get_elevationGainM_6kg9eu_k$() / this.get_lengthM_2aqrzy_k$();
942
949
  };
943
950
  protoOf(Climb).get_climbingGrade_olocdd_k$ = function () {
944
- // Inline function 'kotlin.collections.filter' call
945
- var tmp0 = this.parts_1;
946
- // Inline function 'kotlin.collections.filterTo' call
947
- var destination = ArrayList_init_$Create$_0();
948
- var _iterator__ex2g4s = tmp0.iterator_jk1svi_k$();
949
- while (_iterator__ex2g4s.hasNext_bitz1p_k$()) {
950
- var element = _iterator__ex2g4s.next_20eer_k$();
951
- if (element.get_elevationGainM_6kg9eu_k$() > 0) {
952
- destination.add_utx5q5_k$(element);
953
- }
954
- }
955
- // Inline function 'kotlin.collections.sumOf' call
956
- var sum = 0;
957
- var _iterator__ex2g4s_0 = destination.iterator_jk1svi_k$();
958
- while (_iterator__ex2g4s_0.hasNext_bitz1p_k$()) {
959
- var element_0 = _iterator__ex2g4s_0.next_20eer_k$();
960
- var tmp = sum;
961
- sum = tmp + element_0.get_lengthM_2aqrzy_k$();
962
- }
963
- var climbingLength = sum;
964
- return climbingLength === 0.0 ? 0.0 : this.positiveElevationM_1 / climbingLength;
951
+ return this.climbingDistanceM_1 === 0.0 ? 0.0 : this.positiveElevationM_1 / this.climbingDistanceM_1;
965
952
  };
966
953
  protoOf(Climb).toString = function () {
967
- return 'Climb(startIndex=' + this.startIndex_1 + ', endIndex=' + this.endIndex_1 + ', startDistanceM=' + this.startDistanceM_1 + ', endDistanceM=' + this.endDistanceM_1 + ', startElevationM=' + this.startElevationM_1 + ', endElevationM=' + this.endElevationM_1 + ', positiveElevationM=' + this.positiveElevationM_1 + ', negativeElevationM=' + this.negativeElevationM_1 + ', parts=' + toString(this.parts_1) + ')';
954
+ return 'Climb(startIndex=' + this.startIndex_1 + ', endIndex=' + this.endIndex_1 + ', startDistanceM=' + this.startDistanceM_1 + ', endDistanceM=' + this.endDistanceM_1 + ', startElevationM=' + this.startElevationM_1 + ', endElevationM=' + this.endElevationM_1 + ', positiveElevationM=' + this.positiveElevationM_1 + ', negativeElevationM=' + this.negativeElevationM_1 + ', climbingDistanceM=' + this.climbingDistanceM_1 + ', parts=' + toString(this.parts_1) + ')';
968
955
  };
969
956
  protoOf(Climb).hashCode = function () {
970
957
  var result = this.startIndex_1;
@@ -975,6 +962,7 @@
975
962
  result = imul(result, 31) + getNumberHashCode(this.endElevationM_1) | 0;
976
963
  result = imul(result, 31) + getNumberHashCode(this.positiveElevationM_1) | 0;
977
964
  result = imul(result, 31) + getNumberHashCode(this.negativeElevationM_1) | 0;
965
+ result = imul(result, 31) + getNumberHashCode(this.climbingDistanceM_1) | 0;
978
966
  result = imul(result, 31) + hashCode(this.parts_1) | 0;
979
967
  return result;
980
968
  };
@@ -999,6 +987,8 @@
999
987
  return false;
1000
988
  if (!equals(this.negativeElevationM_1, other.negativeElevationM_1))
1001
989
  return false;
990
+ if (!equals(this.climbingDistanceM_1, other.climbingDistanceM_1))
991
+ return false;
1002
992
  if (!equals(this.parts_1, other.parts_1))
1003
993
  return false;
1004
994
  return true;
@@ -1124,8 +1114,8 @@
1124
1114
  }
1125
1115
  tmp = tmp_2;
1126
1116
  } else {
1127
- var stride = ((path.size_1 + maxPoints | 0) - 1 | 0) / maxPoints | 0;
1128
- var kept = ArrayList_init_$Create$(maxPoints + 1 | 0);
1117
+ var stride = (((path.size_1 - 1 | 0) + maxPoints | 0) - 2 | 0) / (maxPoints - 1 | 0) | 0;
1118
+ var kept = ArrayList_init_$Create$(maxPoints);
1129
1119
  var i = 0;
1130
1120
  while (i < path.size_1) {
1131
1121
  kept.add_utx5q5_k$(i);
@@ -1202,7 +1192,7 @@
1202
1192
  var qualifies = gradePercent >= options.minGradePercent_1 && netElevation >= minClimbElevation && score >= bestScore && climbingGradePercent / gradePercent <= options.maxDiffRealGradeRatio_1;
1203
1193
  if (qualifies) {
1204
1194
  bestScore = score;
1205
- best = new Candidate(i, j, score, positiveElevation, negativeElevation);
1195
+ best = new Candidate(i, j, score, positiveElevation, negativeElevation, distClimbing);
1206
1196
  }
1207
1197
  }
1208
1198
  while (inductionVariable < last);
@@ -1229,7 +1219,7 @@
1229
1219
  return kept;
1230
1220
  }
1231
1221
  function toClimb($this, $receiver, path, profile) {
1232
- return new Climb(profile.sourceIndex_1[$receiver.startIndex_1], profile.sourceIndex_1[$receiver.endIndex_1], profile.distance_1[$receiver.startIndex_1], profile.distance_1[$receiver.endIndex_1], profile.elevation_1[$receiver.startIndex_1], profile.elevation_1[$receiver.endIndex_1], $receiver.positiveElevationM_1, $receiver.negativeElevationM_1, splitIntoParts($this, profile, $receiver.startIndex_1, $receiver.endIndex_1));
1222
+ return new Climb(profile.sourceIndex_1[$receiver.startIndex_1], profile.sourceIndex_1[$receiver.endIndex_1], profile.distance_1[$receiver.startIndex_1], profile.distance_1[$receiver.endIndex_1], profile.elevation_1[$receiver.startIndex_1], profile.elevation_1[$receiver.endIndex_1], $receiver.positiveElevationM_1, $receiver.negativeElevationM_1, $receiver.climbingDistanceM_1, splitIntoParts($this, profile, $receiver.startIndex_1, $receiver.endIndex_1));
1233
1223
  }
1234
1224
  function splitIntoParts($this, profile, startIndex, endIndex) {
1235
1225
  // Inline function 'kotlin.collections.map' call
@@ -1279,18 +1269,19 @@
1279
1269
  }
1280
1270
  return tmp$ret$3;
1281
1271
  }
1282
- function Candidate(startIndex, endIndex, score, positiveElevationM, negativeElevationM) {
1272
+ function Candidate(startIndex, endIndex, score, positiveElevationM, negativeElevationM, climbingDistanceM) {
1283
1273
  this.startIndex_1 = startIndex;
1284
1274
  this.endIndex_1 = endIndex;
1285
1275
  this.score_1 = score;
1286
1276
  this.positiveElevationM_1 = positiveElevationM;
1287
1277
  this.negativeElevationM_1 = negativeElevationM;
1278
+ this.climbingDistanceM_1 = climbingDistanceM;
1288
1279
  }
1289
1280
  protoOf(Candidate).overlaps_wp0rru_k$ = function (other) {
1290
1281
  return other.startIndex_1 <= this.startIndex_1 && this.startIndex_1 <= other.endIndex_1 || (other.startIndex_1 <= this.endIndex_1 && this.endIndex_1 <= other.endIndex_1) || (this.startIndex_1 <= other.startIndex_1 && other.endIndex_1 <= this.endIndex_1);
1291
1282
  };
1292
1283
  protoOf(Candidate).toString = function () {
1293
- return 'Candidate(startIndex=' + this.startIndex_1 + ', endIndex=' + this.endIndex_1 + ', score=' + this.score_1 + ', positiveElevationM=' + this.positiveElevationM_1 + ', negativeElevationM=' + this.negativeElevationM_1 + ')';
1284
+ return 'Candidate(startIndex=' + this.startIndex_1 + ', endIndex=' + this.endIndex_1 + ', score=' + this.score_1 + ', positiveElevationM=' + this.positiveElevationM_1 + ', negativeElevationM=' + this.negativeElevationM_1 + ', climbingDistanceM=' + this.climbingDistanceM_1 + ')';
1294
1285
  };
1295
1286
  protoOf(Candidate).hashCode = function () {
1296
1287
  var result = this.startIndex_1;
@@ -1298,6 +1289,7 @@
1298
1289
  result = imul(result, 31) + getNumberHashCode(this.score_1) | 0;
1299
1290
  result = imul(result, 31) + getNumberHashCode(this.positiveElevationM_1) | 0;
1300
1291
  result = imul(result, 31) + getNumberHashCode(this.negativeElevationM_1) | 0;
1292
+ result = imul(result, 31) + getNumberHashCode(this.climbingDistanceM_1) | 0;
1301
1293
  return result;
1302
1294
  };
1303
1295
  protoOf(Candidate).equals = function (other) {
@@ -1315,6 +1307,8 @@
1315
1307
  return false;
1316
1308
  if (!equals(this.negativeElevationM_1, other.negativeElevationM_1))
1317
1309
  return false;
1310
+ if (!equals(this.climbingDistanceM_1, other.climbingDistanceM_1))
1311
+ return false;
1318
1312
  return true;
1319
1313
  };
1320
1314
  function sam$kotlin_Comparator$0(function_0) {
@@ -1502,7 +1496,7 @@
1502
1496
  $l$loop: do {
1503
1497
  var i = inductionVariable;
1504
1498
  inductionVariable = inductionVariable + 1 | 0;
1505
- var dx = (_this__u8e3s4.longitude_a9xl_k$(i) - lon0) * cosLat0;
1499
+ var dx = LocalFrame_instance.unwrap_i6c8al_k$(_this__u8e3s4.longitude_a9xl_k$(i) - lon0) * cosLat0;
1506
1500
  var dy = _this__u8e3s4.latitude_gb4iok_k$(i) - lat0;
1507
1501
  // Inline function 'kotlin.math.hypot' call
1508
1502
  var length = hypot(dx, dy);
@@ -1604,6 +1598,8 @@
1604
1598
  function AeroProviderConstant_getInstance() {
1605
1599
  return AeroProviderConstant_instance;
1606
1600
  }
1601
+ function CyclistPowerProvider() {
1602
+ }
1607
1603
  function Companion_6() {
1608
1604
  this.TOLERANCE_1 = 0.05;
1609
1605
  this.MAX_MULTIPLIER_1 = 3.0;
@@ -1909,15 +1905,25 @@
1909
1905
  // Inline function 'kotlin.math.min' call
1910
1906
  var b_3 = i + k | 0;
1911
1907
  var maxi = Math.min(tmp0_0, b_3);
1912
- var totalBearingChange = $this.normalizeAngleDiff_6gshzi_k$(path.bearing_fz5vxm_k$(maxi) - path.bearing_fz5vxm_k$(mini));
1908
+ var totalBearingChange = 0.0;
1909
+ var inductionVariable = mini;
1910
+ if (inductionVariable < maxi)
1911
+ do {
1912
+ var j = inductionVariable;
1913
+ inductionVariable = inductionVariable + 1 | 0;
1914
+ totalBearingChange = totalBearingChange + $this.normalizeAngleDiff_6gshzi_k$(path.bearing_fz5vxm_k$(j + 1 | 0) - path.bearing_fz5vxm_k$(j));
1915
+ }
1916
+ while (inductionVariable < maxi);
1913
1917
  var totalDistance = path.distance_5s4s77_k$(maxi) - path.distance_5s4s77_k$(mini);
1914
1918
  // Inline function 'kotlin.math.abs' call
1915
- if (Math.abs(totalBearingChange) < 0.001) {
1919
+ var x = totalBearingChange;
1920
+ if (Math.abs(x) < 0.001) {
1916
1921
  path.setRadius_p1cueq_k$(i, 200.0);
1917
1922
  return 200.0;
1918
1923
  }
1919
1924
  // Inline function 'kotlin.math.abs' call
1920
- var raw = totalDistance / Math.abs(totalBearingChange);
1925
+ var x_0 = totalBearingChange;
1926
+ var raw = totalDistance / Math.abs(x_0);
1921
1927
  // Inline function 'kotlin.math.min' call
1922
1928
  // Inline function 'kotlin.math.max' call
1923
1929
  var b_4 = Math.min(200.0, raw);
@@ -2010,6 +2016,7 @@
2010
2016
  var intent = course.cyclistPowerProvider_1.powerAt_ejucaq_k$(course, path, pointIndex);
2011
2017
  var muscular = this.pedalsClear_b5t5mh_k$(course, path, pointIndex) ? intent : 0.0;
2012
2018
  path.setPCyclistProvidedMuscular_aori9q_k$(pointIndex, muscular);
2019
+ course.cyclistPowerProvider_1.onDelivered_drn2rh_k$(pointIndex, muscular);
2013
2020
  var wheel = muscular * course.get_bike_wojgoa_k$().efficiency_1;
2014
2021
  path.setPCyclistProvidedWheel_ofsihz_k$(pointIndex, wheel);
2015
2022
  return wheel;
@@ -2193,6 +2200,10 @@
2193
2200
  this.lastPowerW_1 = rationed;
2194
2201
  return rationed;
2195
2202
  };
2203
+ protoOf(PowerProviderCriticalPower).onDelivered_drn2rh_k$ = function (pointIndex, powerW) {
2204
+ if (pointIndex === this.lastIndex_1 && isFinite(powerW))
2205
+ this.lastPowerW_1 = powerW;
2206
+ };
2196
2207
  protoOf(PowerProviderCriticalPower).ration_enbpy2_k$ = function (target) {
2197
2208
  if (target <= this.criticalPowerW_1)
2198
2209
  return target;
@@ -2313,14 +2324,17 @@
2313
2324
  this.lastIndex_1 = -1;
2314
2325
  this.lastElapsedS_1 = 0.0;
2315
2326
  this.lastPowerW_1 = 0.0;
2327
+ this.lastLimitedW_1 = 0.0;
2316
2328
  }
2317
2329
  protoOf(PowerProviderSlewLimited).powerAt_ejucaq_k$ = function (course, path, pointIndex) {
2318
2330
  var target = this.delegate_1.powerAt_ejucaq_k$(course, path, pointIndex);
2319
2331
  if (pointIndex < this.lastIndex_1) {
2320
2332
  this.reset_5u6xz3_k$();
2321
2333
  }
2322
- if (pointIndex === this.lastIndex_1)
2323
- return this.lastPowerW_1;
2334
+ if (pointIndex === this.lastIndex_1) {
2335
+ this.delegate_1.onDelivered_drn2rh_k$(pointIndex, this.lastLimitedW_1);
2336
+ return this.lastLimitedW_1;
2337
+ }
2324
2338
  var elapsedS = path.elapsed_7307rw_k$(pointIndex);
2325
2339
  var dtS = elapsedS - this.lastElapsedS_1;
2326
2340
  var tmp;
@@ -2343,12 +2357,20 @@
2343
2357
  this.lastElapsedS_1 = elapsedS;
2344
2358
  this.lastIndex_1 = pointIndex;
2345
2359
  this.lastPowerW_1 = limited;
2360
+ this.lastLimitedW_1 = limited;
2361
+ this.delegate_1.onDelivered_drn2rh_k$(pointIndex, limited);
2346
2362
  return limited;
2347
2363
  };
2364
+ protoOf(PowerProviderSlewLimited).onDelivered_drn2rh_k$ = function (pointIndex, powerW) {
2365
+ if (pointIndex === this.lastIndex_1 && isFinite(powerW))
2366
+ this.lastPowerW_1 = powerW;
2367
+ this.delegate_1.onDelivered_drn2rh_k$(pointIndex, powerW);
2368
+ };
2348
2369
  protoOf(PowerProviderSlewLimited).reset_5u6xz3_k$ = function () {
2349
2370
  this.lastIndex_1 = -1;
2350
2371
  this.lastElapsedS_1 = 0.0;
2351
2372
  this.lastPowerW_1 = 0.0;
2373
+ this.lastLimitedW_1 = 0.0;
2352
2374
  };
2353
2375
  function Companion_10() {
2354
2376
  this.DEFAULT_GRADIENT_GAIN_1 = 3.0;
@@ -2434,11 +2456,16 @@
2434
2456
  this.lastElapsedS_1 = elapsedS;
2435
2457
  this.lastIndex_1 = pointIndex;
2436
2458
  }
2437
- var delivered = target * this.multiplier_1 * this.energyCorrection_sm6t7b_k$(target);
2459
+ var ratio = coerceIn(this.multiplier_1 * this.energyCorrection_sm6t7b_k$(target), this.minMultiplier_1, this.maxMultiplier_1);
2460
+ var delivered = target * ratio;
2438
2461
  this.lastTargetW_1 = target;
2439
2462
  this.lastDeliveredW_1 = delivered;
2463
+ this.delegate_1.onDelivered_drn2rh_k$(pointIndex, delivered);
2440
2464
  return delivered;
2441
2465
  };
2466
+ protoOf(PowerProviderTerrainPacing).onDelivered_drn2rh_k$ = function (pointIndex, powerW) {
2467
+ return this.delegate_1.onDelivered_drn2rh_k$(pointIndex, powerW);
2468
+ };
2442
2469
  protoOf(PowerProviderTerrainPacing).energyCorrection_sm6t7b_k$ = function (target) {
2443
2470
  if (target <= 0.0)
2444
2471
  return 1.0;
@@ -2538,7 +2565,6 @@
2538
2565
  }
2539
2566
  }
2540
2567
  function VirtualizeService() {
2541
- this.MAX_ITERATIONS_1 = 100000;
2542
2568
  }
2543
2569
  protoOf(VirtualizeService).virtualizeTrack_tp3afi_k$ = function (course) {
2544
2570
  var input = course.get_path_wos8ry_k$();
@@ -2561,8 +2587,7 @@
2561
2587
  out.setSpeed_1slan1_k$(0, speed);
2562
2588
  out.setVirtSpeedCurrent_kvg8yv_k$(0, speed);
2563
2589
  var i = 1;
2564
- var iter = 0;
2565
- $l$loop_0: while (i < n) {
2590
+ $l$loop: while (i < n) {
2566
2591
  var dx = input.distance_5s4s77_k$(i) - input.distance_5s4s77_k$(i - 1 | 0);
2567
2592
  if (dx <= 0.0) {
2568
2593
  copyAllFields(this, input, i, out, i);
@@ -2573,7 +2598,7 @@
2573
2598
  out.setSpeed_1slan1_k$(i, speed);
2574
2599
  out.setVirtSpeedCurrent_kvg8yv_k$(i, speed);
2575
2600
  i = i + 1 | 0;
2576
- continue $l$loop_0;
2601
+ continue $l$loop;
2577
2602
  }
2578
2603
  var pSum = PowerComputer_instance.getNewPower_puvq9i_k$(course, out, i - 1 | 0, true);
2579
2604
  var dt = PowerComputer_instance.getDt_t0pcee_k$(pSum, mEq, speed, dx);
@@ -2593,10 +2618,6 @@
2593
2618
  out.setSpeed_1slan1_k$(i, speed);
2594
2619
  out.setVirtSpeedCurrent_kvg8yv_k$(i, speed);
2595
2620
  i = i + 1 | 0;
2596
- var _unary__edvuaz = iter;
2597
- iter = _unary__edvuaz + 1 | 0;
2598
- if (_unary__edvuaz > 100000)
2599
- break $l$loop_0;
2600
2621
  }
2601
2622
  var progression = out.get_indices_xelk8u_k$();
2602
2623
  var inductionVariable = progression.first_1;
@@ -3412,31 +3433,38 @@
3412
3433
  var previous = NaN;
3413
3434
  var inductionVariable = 0;
3414
3435
  if (inductionVariable < n)
3415
- do {
3436
+ $l$loop: do {
3416
3437
  var i = inductionVariable;
3417
3438
  inductionVariable = inductionVariable + 1 | 0;
3418
3439
  var a = i > 0 ? i - 1 | 0 : 0;
3419
3440
  var b = i < (n - 1 | 0) ? i + 1 | 0 : n - 1 | 0;
3420
3441
  var dx = frame.x_1[b] - frame.x_1[a];
3421
3442
  var dy = frame.y_1[b] - frame.y_1[a];
3422
- var tmp;
3423
3443
  if (dx === 0.0 && dy === 0.0) {
3424
- tmp = isNaN_0(previous) ? 0.0 : previous;
3425
- } else {
3426
- // Inline function 'kotlin.math.atan2' call
3427
- tmp = Math.atan2(dy, dx);
3444
+ theta[i] = previous;
3445
+ continue $l$loop;
3428
3446
  }
3429
- var raw = tmp;
3430
- var tmp_0;
3431
- if (i === 0 || isNaN_0(previous)) {
3432
- tmp_0 = raw;
3447
+ // Inline function 'kotlin.math.atan2' call
3448
+ var raw = Math.atan2(dy, dx);
3449
+ if (isNaN_0(previous)) {
3450
+ theta[i] = raw;
3451
+ var inductionVariable_0 = 0;
3452
+ if (inductionVariable_0 < i)
3453
+ do {
3454
+ var j = inductionVariable_0;
3455
+ inductionVariable_0 = inductionVariable_0 + 1 | 0;
3456
+ theta[j] = raw;
3457
+ }
3458
+ while (inductionVariable_0 < i);
3433
3459
  } else {
3434
- tmp_0 = previous + LocalFrame_instance.unwrap_i6c8al_k$(raw - previous);
3460
+ theta[i] = previous + LocalFrame_instance.unwrap_i6c8al_k$(raw - previous);
3435
3461
  }
3436
- theta[i] = tmp_0;
3437
3462
  previous = theta[i];
3438
3463
  }
3439
3464
  while (inductionVariable < n);
3465
+ if (isNaN_0(previous)) {
3466
+ fill(theta, 0.0);
3467
+ }
3440
3468
  };
3441
3469
  protoOf(CurvatureEstimator).computeCurvature_emiphc_k$ = function (frame, windowsM, sigmaThetaRad, curvatureSmoothM) {
3442
3470
  var n = frame.get_size_woubt6_k$();
@@ -3491,15 +3519,7 @@
3491
3519
  }
3492
3520
  }
3493
3521
  while (0 <= inductionVariable_1);
3494
- var tmp;
3495
- if (!isNaN_0(chosen)) {
3496
- tmp = chosen;
3497
- } else if (!isNaN_0(widest)) {
3498
- tmp = widest;
3499
- } else {
3500
- tmp = 0.0;
3501
- }
3502
- raw[i] = tmp;
3522
+ raw[i] = !isNaN_0(chosen) ? chosen : widest;
3503
3523
  }
3504
3524
  while (inductionVariable < n);
3505
3525
  var smoothed = LocalFrame_instance.smooth_kce7pb_k$(raw, frame.s_1, curvatureSmoothM);
@@ -3507,10 +3527,10 @@
3507
3527
  var endIndex = smoothed.length;
3508
3528
  // Inline function 'kotlin.js.unsafeCast' call
3509
3529
  // Inline function 'kotlin.js.asDynamic' call
3510
- var tmp_0 = smoothed;
3530
+ var tmp = smoothed;
3511
3531
  // Inline function 'kotlin.js.unsafeCast' call
3512
3532
  // Inline function 'kotlin.js.asDynamic' call
3513
- arrayCopy(tmp_0, kappa, 0, 0, endIndex);
3533
+ arrayCopy(tmp, kappa, 0, 0, endIndex);
3514
3534
  };
3515
3535
  protoOf(CurvatureEstimator).radiusAt_umgvjz_k$ = function (kappa) {
3516
3536
  var tmp;
@@ -3573,7 +3593,7 @@
3573
3593
  };
3574
3594
  protoOf(LocalFrame).unproject_ym27oh_k$ = function (frame, x, y) {
3575
3595
  var lat = frame.lat0__1 + y / 6371000.0;
3576
- var lon = frame.lon0__1 + x / (6371000.0 * frame.k_1);
3596
+ var lon = this.unwrap_i6c8al_k$(frame.lon0__1 + x / (6371000.0 * frame.k_1));
3577
3597
  // Inline function 'kotlin.doubleArrayOf' call
3578
3598
  return new Float64Array([lat, lon]);
3579
3599
  };
@@ -3595,7 +3615,8 @@
3595
3615
  while (inductionVariable < last);
3596
3616
  };
3597
3617
  protoOf(LocalFrame).unwrap_i6c8al_k$ = function (a) {
3598
- return a - 2.0 * 3.141592653589793 * round(a / (2.0 * 3.141592653589793));
3618
+ var r = a - 2.0 * 3.141592653589793 * round(a / (2.0 * 3.141592653589793));
3619
+ return r <= -3.141592653589793 ? r + 2.0 * 3.141592653589793 : r;
3599
3620
  };
3600
3621
  protoOf(LocalFrame).smooth_kce7pb_k$ = function (v, s, windowM) {
3601
3622
  var n = v.length;
@@ -3632,13 +3653,13 @@
3632
3653
  // Inline function 'kotlin.math.abs' call
3633
3654
  var x = s[j] - c;
3634
3655
  var w = 1.0 - Math.abs(x) / windowM;
3635
- if (w <= 0.0)
3656
+ if (w <= 0.0 || isNaN_0(v[j]))
3636
3657
  continue $l$loop;
3637
3658
  weightSum = weightSum + w;
3638
3659
  valueSum = valueSum + v[j] * w;
3639
3660
  }
3640
3661
  while (!(j === last));
3641
- out[i] = weightSum > 0.0 ? valueSum / weightSum : v[i];
3662
+ out[i] = isNaN_0(v[i]) || weightSum <= 0.0 ? v[i] : valueSum / weightSum;
3642
3663
  }
3643
3664
  while (inductionVariable < n);
3644
3665
  return out;
@@ -3649,15 +3670,16 @@
3649
3670
  }
3650
3671
  function Companion_12() {
3651
3672
  }
3652
- protoOf(Companion_12).assemble_miimn7_k$ = function (frame, center, rho, steeringLengthM, centeringLengthM) {
3673
+ protoOf(Companion_12).assemble_7bjwpt_k$ = function (frame, center, rho, steeringLengthM, centeringLengthM, fixed) {
3653
3674
  var n = frame.get_size_woubt6_k$();
3654
3675
  var h0 = new Float64Array(n);
3655
3676
  var h1 = new Float64Array(n);
3656
3677
  var h2 = new Float64Array(n);
3657
3678
  var linear = new Float64Array(n);
3658
- var constant = 0.0;
3659
3679
  var lambdaR = 1.0 / (steeringLengthM * steeringLengthM);
3660
3680
  var lambdaC = 1.0 / (centeringLengthM * centeringLengthM * centeringLengthM * centeringLengthM);
3681
+ var meanSpacing = n > 1 ? (frame.s_1[n - 1 | 0] - frame.s_1[0]) / (n - 1 | 0) : 0.0;
3682
+ var tie = meanSpacing > 0.0 ? lambdaR / meanSpacing : lambdaR;
3661
3683
  var a = new Float64Array(3);
3662
3684
  var b = new Float64Array(3);
3663
3685
  var inductionVariable = 0;
@@ -3670,7 +3692,13 @@
3670
3692
  var weight = 0.5 * (hMinus + hPlus);
3671
3693
  h0[i] = h0[i] + 2.0 * weight * lambdaC;
3672
3694
  linear[i] = linear[i] - 2.0 * weight * lambdaC * center[i];
3673
- constant = constant + weight * lambdaC * center[i] * center[i];
3695
+ if (weight <= 0.0 && i >= 1 && !fixed[i]) {
3696
+ h0[i] = h0[i] + 2.0 * tie;
3697
+ var _index_0__fvwizt = i - 1 | 0;
3698
+ h0[_index_0__fvwizt] = h0[_index_0__fvwizt] + 2.0 * tie;
3699
+ var _index_0__fvwizt_0 = i - 1 | 0;
3700
+ h1[_index_0__fvwizt_0] = h1[_index_0__fvwizt_0] - 2.0 * tie;
3701
+ }
3674
3702
  if (i < 1 || (i + 1 | 0) >= n)
3675
3703
  continue $l$loop_0;
3676
3704
  var denom = hPlus * hMinus * (hPlus + hMinus);
@@ -3714,37 +3742,44 @@
3714
3742
  while (inductionVariable_1 <= 2);
3715
3743
  }
3716
3744
  while (inductionVariable_0 <= 2);
3717
- constant = constant + wRho * kappaI * kappaI;
3718
3745
  }
3719
3746
  while (inductionVariable < n);
3720
- return new OffsetEnergy(h0, h1, h2, linear, constant);
3747
+ return new OffsetEnergy(h0, h1, h2, linear);
3721
3748
  };
3722
3749
  var Companion_instance_14;
3723
3750
  function Companion_getInstance_16() {
3724
3751
  return Companion_instance_14;
3725
3752
  }
3726
- function OffsetEnergy(h0, h1, h2, linear, constant) {
3753
+ function OffsetEnergy(h0, h1, h2, linear) {
3727
3754
  this.h0__1 = h0;
3728
3755
  this.h1__1 = h1;
3729
3756
  this.h2__1 = h2;
3730
3757
  this.linear_1 = linear;
3731
- this.constant_1 = constant;
3732
3758
  }
3733
3759
  protoOf(OffsetEnergy).get_size_woubt6_k$ = function () {
3734
3760
  return this.h0__1.length;
3735
3761
  };
3736
- protoOf(OffsetEnergy).value_6wg803_k$ = function (n, scratch) {
3737
- BandedLdl_instance.multiply_dwj15t_k$(this.h0__1, this.h1__1, this.h2__1, n, scratch);
3738
- var acc = this.constant_1;
3762
+ protoOf(OffsetEnergy).change_z3fx8j_k$ = function (from, to, gradient, delta, scratch) {
3739
3763
  var inductionVariable = 0;
3740
- var last = n.length - 1 | 0;
3764
+ var last = delta.length - 1 | 0;
3741
3765
  if (inductionVariable <= last)
3742
3766
  do {
3743
3767
  var i = inductionVariable;
3744
3768
  inductionVariable = inductionVariable + 1 | 0;
3745
- acc = acc + (0.5 * scratch[i] * n[i] + this.linear_1[i] * n[i]);
3769
+ delta[i] = to[i] - from[i];
3746
3770
  }
3747
3771
  while (inductionVariable <= last);
3772
+ BandedLdl_instance.multiply_dwj15t_k$(this.h0__1, this.h1__1, this.h2__1, delta, scratch);
3773
+ var acc = 0.0;
3774
+ var inductionVariable_0 = 0;
3775
+ var last_0 = delta.length - 1 | 0;
3776
+ if (inductionVariable_0 <= last_0)
3777
+ do {
3778
+ var i_0 = inductionVariable_0;
3779
+ inductionVariable_0 = inductionVariable_0 + 1 | 0;
3780
+ acc = acc + (gradient[i_0] + 0.5 * scratch[i_0]) * delta[i_0];
3781
+ }
3782
+ while (inductionVariable_0 <= last_0);
3748
3783
  return acc;
3749
3784
  };
3750
3785
  protoOf(OffsetEnergy).gradient_zecmby_k$ = function (n, out) {
@@ -3767,7 +3802,7 @@
3767
3802
  this.activeConstraints_1 = activeConstraints;
3768
3803
  }
3769
3804
  function isFree($this, x, lo, hi, g, epsilon) {
3770
- if (hi - lo <= 2.0 * epsilon)
3805
+ if ($this.isFixed_s6zw2k_k$(lo, hi, epsilon))
3771
3806
  return false;
3772
3807
  if (x <= lo + epsilon && g > 0.0)
3773
3808
  return false;
@@ -3849,7 +3884,10 @@
3849
3884
  var f1 = new Float64Array(n);
3850
3885
  var f2 = new Float64Array(n);
3851
3886
  var rhs = new Float64Array(n);
3852
- $l$loop_3: while (iterations < maxIterations) {
3887
+ var solveIndex = new Int32Array(n);
3888
+ var held = booleanArray(n);
3889
+ var delta = new Float64Array(n);
3890
+ $l$loop_5: while (iterations < maxIterations) {
3853
3891
  energy.gradient_zecmby_k$(x, g);
3854
3892
  var freeCount = 0;
3855
3893
  var residual = 0.0;
@@ -3875,81 +3913,124 @@
3875
3913
  relativeResidual = residual / referenceGradient;
3876
3914
  if (freeCount === 0 || relativeResidual <= gradientTolerance) {
3877
3915
  converged = true;
3878
- break $l$loop_3;
3879
- }
3880
- buildFreeSystem(this, energy, freeIndex, freeCount, f0, f1, f2);
3881
- var fa0 = copyOf(f0, freeCount);
3882
- var fa1 = copyOf(f1, freeCount);
3883
- var fa2 = copyOf(f2, freeCount);
3884
- if (!BandedLdl_instance.factor_n459o6_k$(fa0, fa1, fa2)) {
3885
- break $l$loop_3;
3916
+ break $l$loop_5;
3886
3917
  }
3887
3918
  var inductionVariable_1 = 0;
3888
- var last = freeCount;
3889
- if (inductionVariable_1 < last)
3919
+ if (inductionVariable_1 < n)
3890
3920
  do {
3891
- var p = inductionVariable_1;
3921
+ var i_1 = inductionVariable_1;
3892
3922
  inductionVariable_1 = inductionVariable_1 + 1 | 0;
3893
- rhs[p] = -g[freeIndex[p]];
3894
- }
3895
- while (inductionVariable_1 < last);
3896
- BandedLdl_instance.solveInPlace_jrw92v_k$(fa0, fa1, fa2, rhs);
3897
- var inductionVariable_2 = 0;
3898
- if (inductionVariable_2 < n)
3899
- do {
3900
- var i_1 = inductionVariable_2;
3901
- inductionVariable_2 = inductionVariable_2 + 1 | 0;
3902
- direction[i_1] = 0.0;
3923
+ held[i_1] = false;
3903
3924
  }
3904
- while (inductionVariable_2 < n);
3905
- var inductionVariable_3 = 0;
3906
- var last_0 = freeCount;
3907
- if (inductionVariable_3 < last_0)
3908
- do {
3909
- var p_0 = inductionVariable_3;
3910
- inductionVariable_3 = inductionVariable_3 + 1 | 0;
3911
- direction[freeIndex[p_0]] = rhs[p_0];
3912
- }
3913
- while (inductionVariable_3 < last_0);
3914
- var directionalDerivative = 0.0;
3915
- var inductionVariable_4 = 0;
3916
- var last_1 = freeCount;
3917
- if (inductionVariable_4 < last_1)
3918
- do {
3919
- var p_1 = inductionVariable_4;
3920
- inductionVariable_4 = inductionVariable_4 + 1 | 0;
3921
- var i_2 = freeIndex[p_1];
3922
- directionalDerivative = directionalDerivative + g[i_2] * direction[i_2];
3923
- }
3924
- while (inductionVariable_4 < last_1);
3925
- if (directionalDerivative >= 0.0)
3926
- break $l$loop_3;
3927
- var current = energy.value_6wg803_k$(x, scratch);
3928
- var step = 1.0;
3925
+ while (inductionVariable_1 < n);
3929
3926
  var accepted = false;
3930
- var inductionVariable_5 = 0;
3931
- if (inductionVariable_5 < 20)
3932
- $l$loop_2: do {
3933
- var attempt = inductionVariable_5;
3934
- inductionVariable_5 = inductionVariable_5 + 1 | 0;
3935
- var inductionVariable_6 = 0;
3936
- if (inductionVariable_6 < n)
3937
- do {
3938
- var i_3 = inductionVariable_6;
3939
- inductionVariable_6 = inductionVariable_6 + 1 | 0;
3940
- candidate[i_3] = coerceIn(x[i_3] + step * direction[i_3], lo[i_3], hi[i_3]);
3927
+ $l$loop_4: while (true) {
3928
+ var solveCount = 0;
3929
+ var inductionVariable_2 = 0;
3930
+ var last = freeCount;
3931
+ if (inductionVariable_2 < last)
3932
+ do {
3933
+ var p = inductionVariable_2;
3934
+ inductionVariable_2 = inductionVariable_2 + 1 | 0;
3935
+ if (!held[freeIndex[p]]) {
3936
+ var _unary__edvuaz_0 = solveCount;
3937
+ solveCount = _unary__edvuaz_0 + 1 | 0;
3938
+ solveIndex[_unary__edvuaz_0] = freeIndex[p];
3941
3939
  }
3942
- while (inductionVariable_6 < n);
3943
- var trial = energy.value_6wg803_k$(candidate, scratch);
3944
- if (trial <= current + 1.0E-4 * step * directionalDerivative) {
3945
- accepted = true;
3946
- break $l$loop_2;
3947
3940
  }
3948
- step = step / 2.0;
3941
+ while (inductionVariable_2 < last);
3942
+ buildFreeSystem(this, energy, solveIndex, solveCount, f0, f1, f2);
3943
+ var fa0 = copyOf(f0, solveCount);
3944
+ var fa1 = copyOf(f1, solveCount);
3945
+ var fa2 = copyOf(f2, solveCount);
3946
+ if (!BandedLdl_instance.factor_n459o6_k$(fa0, fa1, fa2)) {
3947
+ break $l$loop_4;
3949
3948
  }
3950
- while (inductionVariable_5 < 20);
3949
+ var inductionVariable_3 = 0;
3950
+ var last_0 = solveCount;
3951
+ if (inductionVariable_3 < last_0)
3952
+ do {
3953
+ var p_0 = inductionVariable_3;
3954
+ inductionVariable_3 = inductionVariable_3 + 1 | 0;
3955
+ rhs[p_0] = -g[solveIndex[p_0]];
3956
+ }
3957
+ while (inductionVariable_3 < last_0);
3958
+ BandedLdl_instance.solveInPlace_jrw92v_k$(fa0, fa1, fa2, rhs);
3959
+ var inductionVariable_4 = 0;
3960
+ if (inductionVariable_4 < n)
3961
+ do {
3962
+ var i_2 = inductionVariable_4;
3963
+ inductionVariable_4 = inductionVariable_4 + 1 | 0;
3964
+ direction[i_2] = 0.0;
3965
+ }
3966
+ while (inductionVariable_4 < n);
3967
+ var inductionVariable_5 = 0;
3968
+ var last_1 = solveCount;
3969
+ if (inductionVariable_5 < last_1)
3970
+ do {
3971
+ var p_1 = inductionVariable_5;
3972
+ inductionVariable_5 = inductionVariable_5 + 1 | 0;
3973
+ direction[solveIndex[p_1]] = rhs[p_1];
3974
+ }
3975
+ while (inductionVariable_5 < last_1);
3976
+ var directionalDerivative = 0.0;
3977
+ var inductionVariable_6 = 0;
3978
+ var last_2 = solveCount;
3979
+ if (inductionVariable_6 < last_2)
3980
+ do {
3981
+ var p_2 = inductionVariable_6;
3982
+ inductionVariable_6 = inductionVariable_6 + 1 | 0;
3983
+ var i_3 = solveIndex[p_2];
3984
+ directionalDerivative = directionalDerivative + g[i_3] * direction[i_3];
3985
+ }
3986
+ while (inductionVariable_6 < last_2);
3987
+ if (directionalDerivative >= 0.0)
3988
+ break $l$loop_4;
3989
+ var step = 1.0;
3990
+ var lastStep = step;
3991
+ var inductionVariable_7 = 0;
3992
+ if (inductionVariable_7 < 20)
3993
+ $l$loop_2: do {
3994
+ var attempt = inductionVariable_7;
3995
+ inductionVariable_7 = inductionVariable_7 + 1 | 0;
3996
+ var inductionVariable_8 = 0;
3997
+ if (inductionVariable_8 < n)
3998
+ do {
3999
+ var i_4 = inductionVariable_8;
4000
+ inductionVariable_8 = inductionVariable_8 + 1 | 0;
4001
+ candidate[i_4] = coerceIn(x[i_4] + step * direction[i_4], lo[i_4], hi[i_4]);
4002
+ }
4003
+ while (inductionVariable_8 < n);
4004
+ if (energy.change_z3fx8j_k$(x, candidate, g, delta, scratch) <= 1.0E-4 * step * directionalDerivative) {
4005
+ accepted = true;
4006
+ break $l$loop_2;
4007
+ }
4008
+ lastStep = step;
4009
+ step = step / 2.0;
4010
+ }
4011
+ while (inductionVariable_7 < 20);
4012
+ if (accepted)
4013
+ break $l$loop_4;
4014
+ var newlyHeld = 0;
4015
+ var inductionVariable_9 = 0;
4016
+ var last_3 = solveCount;
4017
+ if (inductionVariable_9 < last_3)
4018
+ do {
4019
+ var p_3 = inductionVariable_9;
4020
+ inductionVariable_9 = inductionVariable_9 + 1 | 0;
4021
+ var i_5 = solveIndex[p_3];
4022
+ var target = x[i_5] + lastStep * direction[i_5];
4023
+ if (target < lo[i_5] || target > hi[i_5]) {
4024
+ held[i_5] = true;
4025
+ newlyHeld = newlyHeld + 1 | 0;
4026
+ }
4027
+ }
4028
+ while (inductionVariable_9 < last_3);
4029
+ if (newlyHeld === 0)
4030
+ break $l$loop_4;
4031
+ }
3951
4032
  if (!accepted)
3952
- break $l$loop_3;
4033
+ break $l$loop_5;
3953
4034
  // Inline function 'kotlin.collections.copyInto' call
3954
4035
  var endIndex = candidate.length;
3955
4036
  // Inline function 'kotlin.js.unsafeCast' call
@@ -3961,18 +4042,21 @@
3961
4042
  iterations = iterations + 1 | 0;
3962
4043
  }
3963
4044
  var active = 0;
3964
- var inductionVariable_7 = 0;
3965
- if (inductionVariable_7 < n)
4045
+ var inductionVariable_10 = 0;
4046
+ if (inductionVariable_10 < n)
3966
4047
  do {
3967
- var i_4 = inductionVariable_7;
3968
- inductionVariable_7 = inductionVariable_7 + 1 | 0;
3969
- if (x[i_4] <= lo[i_4] + boundEpsilonM || x[i_4] >= hi[i_4] - boundEpsilonM) {
4048
+ var i_6 = inductionVariable_10;
4049
+ inductionVariable_10 = inductionVariable_10 + 1 | 0;
4050
+ if (x[i_6] <= lo[i_6] + boundEpsilonM || x[i_6] >= hi[i_6] - boundEpsilonM) {
3970
4051
  active = active + 1 | 0;
3971
4052
  }
3972
4053
  }
3973
- while (inductionVariable_7 < n);
4054
+ while (inductionVariable_10 < n);
3974
4055
  return new QpResult(x, iterations, relativeResidual, converged, active);
3975
4056
  };
4057
+ protoOf(OffsetQp).isFixed_s6zw2k_k$ = function (lo, hi, epsilon) {
4058
+ return hi - lo <= 2.0 * epsilon;
4059
+ };
3976
4060
  var OffsetQp_instance;
3977
4061
  function OffsetQp_getInstance() {
3978
4062
  return OffsetQp_instance;
@@ -4203,6 +4287,17 @@
4203
4287
  var frame = tmp;
4204
4288
  CurvatureEstimator_instance.computeHeadings_ev7p13_k$(frame);
4205
4289
  CurvatureEstimator_instance.computeCurvature_emiphc_k$(frame, toDoubleArray(options.curvature_1.curvatureWindowsM_1), options.curvature_1.headingNoiseRad_1, options.curvature_1.curvatureSmoothWindowM_1);
4290
+ var inductionVariable = 0;
4291
+ var last = frame.get_size_woubt6_k$();
4292
+ if (inductionVariable < last)
4293
+ do {
4294
+ var i = inductionVariable;
4295
+ inductionVariable = inductionVariable + 1 | 0;
4296
+ if (isNaN_0(frame.kappa_1[i])) {
4297
+ frame.kappa_1[i] = 0.0;
4298
+ }
4299
+ }
4300
+ while (inductionVariable < last);
4206
4301
  return frame;
4207
4302
  }
4208
4303
  function analyzeFrame($this, path, frame, options) {
@@ -4236,15 +4331,24 @@
4236
4331
  tmp_3 = tmp_3 + 1 | 0;
4237
4332
  }
4238
4333
  var rho = tmp_5;
4239
- var energy = Companion_instance_14.assemble_miimn7_k$(frame, center, rho, options.steeringLengthM_1, options.centeringLengthM_1);
4334
+ var tmp_8 = Companion_instance_14;
4335
+ var tmp_9 = 0;
4336
+ var tmp_10 = frame.get_size_woubt6_k$();
4337
+ var tmp_11 = booleanArray(tmp_10);
4338
+ while (tmp_9 < tmp_10) {
4339
+ var tmp_12 = tmp_9;
4340
+ tmp_11[tmp_12] = OffsetQp_instance.isFixed_s6zw2k_k$(bounds.lo_1[tmp_12], bounds.hi_1[tmp_12], options.boundEpsilonM_1);
4341
+ tmp_9 = tmp_9 + 1 | 0;
4342
+ }
4343
+ var energy = tmp_8.assemble_7bjwpt_k$(frame, center, rho, options.steeringLengthM_1, options.centeringLengthM_1, tmp_11);
4240
4344
  var seed = center;
4241
4345
  var solved = OffsetQp_instance.solve_j37bz7_k$(energy, bounds.lo_1, bounds.hi_1, seed, options.maxNewtonIterations_1, options.gradientTolerance_1, options.boundEpsilonM_1);
4242
4346
  var trajectoryCurvature = measureOffsetCurvature($this, frame, solved.offset_1, options);
4243
- var tmp_8 = frame.get_size_woubt6_k$();
4347
+ var tmp_13 = frame.get_size_woubt6_k$();
4244
4348
  // Inline function 'kotlin.collections.copyOf' call
4245
4349
  // Inline function 'kotlin.js.asDynamic' call
4246
- var tmp$ret$3 = frame.kappa_1.slice();
4247
- return new RacingLineReport(tmp_8, corners, tmp$ret$3, bounds.lo_1, bounds.hi_1, bounds.halfWidthM_1, solved.offset_1, trajectoryCurvature, solved.iterations_1, solved.gradientInfNorm_1, solved.converged_1, solved.activeConstraints_1);
4350
+ var tmp$ret$4 = frame.kappa_1.slice();
4351
+ return new RacingLineReport(tmp_13, corners, tmp$ret$4, bounds.lo_1, bounds.hi_1, bounds.halfWidthM_1, solved.offset_1, trajectoryCurvature, solved.iterations_1, solved.gradientInfNorm_1, solved.converged_1, solved.activeConstraints_1);
4248
4352
  }
4249
4353
  function measureOffsetCurvature($this, frame, offset, options) {
4250
4354
  var size = frame.get_size_woubt6_k$();
@@ -5451,6 +5555,10 @@
5451
5555
  ENHANCE_OPTIONS_KEYS = setOf_0(['fixElevation', 'computeMaxSpeeds', 'virtualizeTrack', 'computeOnePointPerSecond', 'simplifyEnabled', 'simplifyToleranceM', 'simplifyZExaggeration', 'wPrimeBalanceEnabled', 'wPrimeBalanceCriticalPower', 'wPrimeBalanceWPrime', 'curvatureEnabled', 'racingLineEnabled', 'racingLineCorridor', 'racingLineRoadWidthM', 'elevationGainPreset', 'elevationGainThresholdM', 'elevationGainEnabled', 'elevationSmoothWindowM', 'demZoom']);
5452
5556
  }
5453
5557
  }
5558
+ //region block: post-declaration
5559
+ protoOf(CyclistPowerProviderBase).onDelivered_drn2rh_k$ = onDelivered;
5560
+ protoOf(PowerProviderFromData).onDelivered_drn2rh_k$ = onDelivered;
5561
+ //endregion
5454
5562
  //region block: init
5455
5563
  Enhancer_instance = new Enhancer();
5456
5564
  Companion_instance_7 = new Companion_5();