"use strict";(globalThis.webpackChunkwp_travel_engine=globalThis.webpackChunkwp_travel_engine||[]).push([[635],{635:(t,e,a)=>{function n(t){var e=document.getElementById("altChart");if(e&&"undefined"!=typeof Chart){var a=t.altitudeUnitData,n=t.altitudeLabelsData,o=t.altitudeUnit,s=""!==t.showLG,d=""!==t.showX,r=""!==t.showY,c=t.themeColor,u=t.xScaleLabel,p=t.yScaleLabel,f=t.tension/10,h=a,g=o;const b={type:"line",data:{labels:n,datasets:[{data:a,borderWidth:1,tension:f,fill:s}]},options:{showAllToolTips:!0,scales:i(d,r,c,u,p),plugins:{datalabels:l(c,n,o)},elements:{point:{backgroundColor:c},line:{tension:0}},layout:{padding:{left:10,right:50,top:50,bottom:0}},responsive:!0,maintainAspectRatio:!1,legend:{fontColor:c,display:!1}}},m=new Chart(e,b);function y(t){if(t!==g){var e={m:"m"!==t?1:.3048,ft:"ft"!==t?1:3.28084};a=a.map((a=>Math.floor(a*e[t])))}else a=h;return m.data.datasets[0].data=a,b.options.plugins.datalabels=l(c,n,t),m.update(),a}document.getElementById("altitude-unit-m").checked="m"===o,document.getElementById("altitude-unit-ft").checked="ft"===o,document.querySelectorAll('input[name="altitude-unit"]').forEach((function(t){t.addEventListener("change",(function(){this.checked&&y(this.value)}))}))}}function i(t,e,a,n,i){return{xAxes:[{display:t,scaleLabel:{display:!0,labelString:n},ticks:{beginAtZero:!0},gridLines:{borderDash:[8,4],color:a}}],yAxes:[{display:e,scaleLabel:{display:!0,labelString:i},ticks:{beginAtZero:!0},gridLines:{display:!1,color:a}}]}}function l(t,e,a){return{color:t,offset:10,align:"top",padding:4,formatter:function(t,n){const i=n.dataIndex,l=e[i],o="m"===a?"m":"ft";return l.concat(" ",t," ").concat(o,".")},font:{size:12,weight:"bold",color:"#147dfe"}}}a.r(e),a.d(e,{initAltitudeChart:()=>n})}}]);