PageSourceSearch

https://cdn.ridewithgps.com/rwgps-javascripts/prod/assets/metricsCalculator-CD6s3HJ6.js

js ridewithgps.com collected 2026-10-01 09:18:23 UTC 2,385 bytes, 1 lines download raw bytes

1import{At as e,Mt as t,nn as n}from"./modulepreload-polyfill-B-nb0kqi.js";import{S as r}from"./geoUtils-C8LoA4AW.js";import{y as i}from"./units-D_5fq-NX.js";var a=class{constructor(e,t,r,i,a){n(this,`x`,void 0),n(this,`y`,void 0),n(this,`winWidth`,void 0),r||=10,i||=.04;let o=r>e.length?e.length%2==0?e.length:e.length+1:r;this.x=e,this.y=t,this.winWidth=a||100,this.kernel=this.createSincKernel(o,i)}filter(){let e=0,t=0,n=0,r=0,i=0,a=0,o,s,c=Array(this.x.length),l=[];e=(this.kernel.length-1)/2;for(let u=0;u<this.x.length;u++){let d=0;for(t=u-e,n=u+e,r=0,i=this.kernel.length-1;t<0;)t+=1,r+=1;for(;n>=this.x.length;)--n,--i;if(this.winWidth>0)for(a=this.x[n]-this.x[t];a>this.winWidth;)t+1<=u&&n-u<=u-t&&(t+=1,r+=1),n-1>=u&&n-1>=u-t&&(--n,--i),a=this.x[n]-this.x[t];l[i+1-r]?o=l[i+1-r]:(o=this.normalizeKernel(this.kernel.slice(r,i+1)),l[i+1-r]=o),s=Array(n-t);let f=0;for(let e=t;e<=n;e+=1)s[f]=this.y[e],f+=1;for(let e=0;e<s.length;e++)d+=s[e]*o[e];c[u]=Math.round(d*1e3)/1e3}return c}createSincKernel(e,t){if(e===1)return[1];let n=Array(e),r=0;for(let i=0;i<=e;i++)n[i]=.54-.46*Math.cos(2*Math.PI*i/e),r=i-e/2,r===0?n[i]=n[i]*2*Math.PI*t:n[i]=n[i]*Math.sin(2*Math.PI*t*r)/r;return n}normalizeKernel(e){let t=0,n=0,r=Array(e.length);for(t=0;t<e.length;t++)n+=e[t];for(t=0;t<e.length;t++)r[t]=e[t]/n;return r}},o=t(`lib`,`metricsCalculator`),s=e=>Number.isFinite(e)?e:void 0,c=([e,t,n,r],i,a)=>e<=i&&n>=i&&t<=a&&r>=a,l=e=>{let t=e.trackPoints;return{...e,rawPoints:t??[],trackPoints:t&&t.length>0?u(t):[]}},u=t=>{o.log(`trackpointMetrics cache miss for array of ${t.length} trackpoints`);let n=0,r=t[0],a=t.map(t=>{let a=d(r,t),o=t.t-r.t,l=f(t),u=Number.isFinite(t.s)?i(t.s):a!==null&&o>0?i(a/o):void 0;a&&(n+=a),(t.d||l)&&(r=t);let p=l?e.find(e=>c(e.slice(0,4),t.y,t.x))?.[4]:{};return Object.assign({lat:s(t.y),lng:s(t.x),time:s(t.t),cad:s(t.c),ele:s(t.e),providedDistance:t.d,speed_orig:u,temp:s(t.T),watts:s(t.p),distance:n,goodPoint:t.d!==void 0||l,excludeFromMetrics:!!t.k,color:s(t.color),poiId:s(t.poi_id)},(e=>({surface:e===95&&p?p[t.R]:e,roadClass:t.R}))(t.S))}),l=p(a);return a.map((e,t)=>({...e,speed:l[t]}))},d=(e,t)=>!e||!t?null:e.d&&t.d?t.d-e.d:f(e)&&f(t)?r([e.y,e.x],[t.y,t.x]):null,f=e=>!!(e.y&&e.x&&e.y>=-90&&e.y<=90&&e.x>=-180&&e.x<=180),p=e=>{let t=e.map(e=>e.goodPoint?e.speed_orig:void 0);return new a(e.map(e=>e.distance),t).filter()};export{l as n,u as t};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.