PageSourceSearch

https://www.banyuls-sur-mer.com/app/dist/banyuls-sur-mer/addons/wo…ry-elevation-chart-component.d8cf15671e.mjs

js banyuls-sur-mer.com collected 2026-10-02 06:35:07 UTC 3,024 bytes, 1 lines download raw bytes

1import d from"woody_library_woody_component";import g from"highcharts";class u extends d{#e={style:{var_color:"--primary-color",var_bg_color:"--white"}};constructor(){super()}init(t){super.init(t),this.config=Object.assign(this.#e,this.config);const o=this.getSize(),i=this.getData(),n=window.getComputedStyle(document.body),s=n.getPropertyValue(this.config.style.var_bg_color),e=n.getPropertyValue(this.config.style.var_color);g.chart(this,{chart:{type:"areaspline",width:null,height:o.height||200,backgroundColor:s,spacingBottom:15,spacingTop:15,spacingLeft:10,spacingRight:10},title:{floating:!0,text:""},legend:{enabled:!1},tooltip:{style:{fontSize:"0.7em"},formatter:function(){return"Altitude: "+Math.round(this.y)+" m<br>Distance: "+Math.round(this.x*1e3)/1e3+"km"}},xAxis:{title:{text:""},labels:{format:"{value} km",style:{fontSize:"0.6em",color:e}},showLastLabel:!0,lineColor:e,tickColor:"transparent",gridLineColor:"transparent"},yAxis:{title:{text:""},labels:{format:"{value} m",style:{fontSize:"0.6em",color:e}},min:i.min,lineWidth:1,lineColor:e,tickColor:"transparent",gridLineColor:"transparent"},series:[{data:i.serie,color:e,lineWidth:2,fillOpacity:.2,marker:{enabled:!1,states:{hover:{enabled:!0,radius:4}}}}],credits:{enabled:!1},plotOptions:{areaspline:{point:{events:{mouseOver:l=>{this.elevationHover(l)}}},events:{mouseOut:()=>{this.elevationOut()},mouseOver:()=>{this.elevationIn()}}}}})}elevationHover(t){const o=this.getGeoPoint(t.target.index)}elevationOut(){console.warn("events.mouseOut")}elevationIn(){console.warn("events.mouseOver")}getSize(){const t=this.offsetWidth,o=this.offsetHeight;return{width:t,height:o}}getGeoPoint(t){return this.config.points&&typeof this.config.points[t]<"u"?this.config.points[t]:null}getData(){let t=[],o=1/0,i=-1/0,n=0,s=0;if(this.config.points&&this.config.points.length>0&&(this.config.points.forEach(e=>{if("distanceFromStart"in e&&"elevation"in e){const l=t.at(-1);if(l){const r=e.elevation-l[1];r>0?n+=r:s+=r}t.push([e.distanceFromStart/1e3,e.elevation]),e.elevation<o&&(o=e.elevation),e.elevation>i&&(i=e.elevation)}else console.warn("missed data in point : "+e)}),o=Math.floor(o)),t.length>2){const e=t.at(-1)[0],l=Math.min(.5,Math.max(.3,e*.1));t=this.#o(t,l);const r=t.reduce((f,c)=>Math.min(f,c[1]),1/0),a=t.reduce((f,c)=>Math.max(f,c[1]),-1/0),h=Math.max(1,(a-r)*.02);t=this.#t(t,h)}return t.length<1&&console.warn("no points founds"),{serie:t,min:o,max:i,denivele_pos:Math.round(n),denivele_neg:Math.round(s)}}#o(t,o){const i=o/2;let n=0,s=0,e=0;const l=[];for(let r=0;r<t.length;r++){const a=t[r][0];for(;s<t.length&&t[s][0]<=a+i;)e+=t[s][1],s++;for(;t[n][0]<a-i;)e-=t[n][1],n++;l.push([a,e/(s-n)])}return l}#t(t,o){if(t.length<=2)return t;const i=t[0],n=t[t.length-1],s=n[0]-i[0],e=n[1]-i[1];let l=0,r=0;for(let a=1;a<t.length-1;a++){const h=s===0?0:(t[a][0]-i[0])/s,f=i[1]+h*e,c=Math.abs(t[a][1]-f);c>l&&(l=c,r=a)}if(l>o){const a=this.#t(t.slice(0,r+1),o),h=this.#t(t.slice(r),o);return[...a.slice(0,-1),...h]}return[i,n]}}export{u as default};

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.