FitTrackee/fittrackee/dist/static/js/workouts.227b20a7.js
2022-03-26 17:58:21 +01:00

2 lines
74 KiB
JavaScript

(self["webpackChunkfittrackee_client"]=self["webpackChunkfittrackee_client"]||[]).push([[401],{7520:function(t,e){!function(t,o){o(e)}(0,(function(t){"use strict";function e(t){return t&&t.normalize&&t.normalize(),t&&t.textContent||""}function o(t,e){const o=t.getElementsByTagName(e);return o.length?o[0]:null}function a(t){const a={};if(t){const n=o(t,"line");if(n){const t=e(o(n,"color")),l=parseFloat(e(o(n,"opacity"))),r=parseFloat(e(o(n,"width")));t&&(a.stroke=t),isNaN(l)||(a["stroke-opacity"]=l),isNaN(r)||(a["stroke-width"]=96*r/25.4)}}return a}function n(t,a){const n={};let l,r;for(r=0;r<a.length;r++)l=o(t,a[r]),l&&(n[a[r]]=e(l));return n}function l(t){const o=n(t,["name","cmt","desc","type","time","keywords"]),a=t.getElementsByTagNameNS("http://www.garmin.com/xmlschemas/GpxExtensions/v3","*");for(let n=0;n<a.length;n++){const l=a[n];l.parentNode.parentNode===t&&(o[l.tagName.replace(":","_")]=e(l))}const l=t.getElementsByTagName("link");l.length&&(o.links=[]);for(let e=0;e<l.length;e++)o.links.push(Object.assign({href:l[e].getAttribute("href")},n(l[e],["text","type"])));return o}function r(t){const a=[parseFloat(t.getAttribute("lon")),parseFloat(t.getAttribute("lat"))],n=o(t,"ele"),l=o(t,"gpxtpx:hr")||o(t,"hr"),r=o(t,"time");let s;n&&(s=parseFloat(e(n)),isNaN(s)||a.push(s));const i={coordinates:a,time:r?e(r):null,extendedValues:[]};l&&i.extendedValues.push(["heart",parseFloat(e(l))]);const u=o(t,"extensions");if(null!==u)for(const d of["speed","course","hAcc","vAcc"]){const t=parseFloat(e(o(u,d)));isNaN(t)||i.extendedValues.push([d,t])}return i}function s(t){const e=i(t,"rtept");if(e)return{type:"Feature",properties:Object.assign(l(t),a(o(t,"extensions")),{_gpxType:"rte"}),geometry:{type:"LineString",coordinates:e.line}}}function i(t,e){const o=t.getElementsByTagName(e);if(o.length<2)return;const a=[],n=[],l={};for(let s=0;s<o.length;s++){const t=r(o[s]);a.push(t.coordinates),t.time&&n.push(t.time);for(let e=0;e<t.extendedValues.length;e++){const[a,n]=t.extendedValues[e],r="heart"===a?a:a+"s";l[r]||(l[r]=Array(o.length).fill(null)),l[r][s]=n}}return{line:a,times:n,extendedValues:l}}function u(t){const e=t.getElementsByTagName("trkseg"),n=[],r=[],s=[];for(let o=0;o<e.length;o++){const t=i(e[o],"trkpt");t&&(s.push(t),t.times&&t.times.length&&r.push(t.times))}if(0===s.length)return;const u=s.length>1,d=Object.assign(l(t),a(o(t,"extensions")),{_gpxType:"trk"},r.length?{coordinateProperties:{times:u?r:r[0]}}:{});for(let o=0;o<s.length;o++){const t=s[o];n.push(t.line);for(const[e,a]of Object.entries(t.extendedValues)){let t=d;"heart"===e&&(d.coordinateProperties||(d.coordinateProperties={}),t=d.coordinateProperties),u?(t[e]||(t[e]=s.map((t=>new Array(t.line.length).fill(null)))),t[e][o]=a):t[e]=a}}return{type:"Feature",properties:d,geometry:u?{type:"MultiLineString",coordinates:n}:{type:"LineString",coordinates:n[0]}}}function*d(t){const e=t.getElementsByTagName("trk"),o=t.getElementsByTagName("rte"),a=t.getElementsByTagName("wpt");for(let n=0;n<e.length;n++){const t=u(e[n]);t&&(yield t)}for(let n=0;n<o.length;n++){const t=s(o[n]);t&&(yield t)}for(let s=0;s<a.length;s++)yield(i=a[s],{type:"Feature",properties:Object.assign(l(i),n(i,["sym"])),geometry:{type:"Point",coordinates:r(i).coordinates}});var i}const c=[["heartRate","heartRates"],["Cadence","cadences"],["Speed","speeds"],["Watts","watts"]],p=[["TotalTimeSeconds","totalTimeSeconds"],["DistanceMeters","distanceMeters"],["MaximumSpeed","maxSpeed"],["AverageHeartRateBpm","avgHeartRate"],["MaximumHeartRateBpm","maxHeartRate"],["AvgSpeed","avgSpeed"],["AvgWatts","avgWatts"],["MaxWatts","maxWatts"]];function m(t,a){const n=[];for(const[l,r]of a){let a=o(t,l);if(!a){const e=t.getElementsByTagNameNS("http://www.garmin.com/xmlschemas/ActivityExtension/v2",l);e.length&&(a=e[0])}const s=parseFloat(e(a));isNaN(s)||n.push([r,s])}return n}function w(t){const a=e(o(t,"LongitudeDegrees")),n=e(o(t,"LatitudeDegrees"));if(!a.length||!n.length)return null;const l=[parseFloat(a),parseFloat(n)],r=o(t,"AltitudeMeters"),s=o(t,"HeartRateBpm"),i=o(t,"Time");let u;return r&&(u=parseFloat(e(r)),isNaN(u)||l.push(u)),{coordinates:l,time:i?e(i):null,heartRate:s?parseFloat(e(s)):null,extensions:m(t,c)}}function g(t,e){const o=t.getElementsByTagName(e),a=[],n=[],l=[];if(o.length<2)return null;const r={extendedProperties:{}};for(let s=0;s<o.length;s++){const t=w(o[s]);if(null!==t){a.push(t.coordinates),t.time&&n.push(t.time),t.heartRate&&l.push(t.heartRate);for(const[e,a]of t.extensions)r.extendedProperties[e]||(r.extendedProperties[e]=Array(o.length).fill(null)),r.extendedProperties[e][s]=a}}return Object.assign(r,{line:a,times:n,heartRates:l})}function f(t){const a=t.getElementsByTagName("Track"),n=[],l=[],r=[],s=[];let i;const u=function(t){const e={};for(const[o,a]of t)e[o]=a;return e}(m(t,p)),d=o(t,"Name");d&&(u.name=e(d));for(let e=0;e<a.length;e++)i=g(a[e],"Trackpoint"),i&&(n.push(i.line),i.times.length&&l.push(i.times),i.heartRates.length&&r.push(i.heartRates),s.push(i.extendedProperties));for(let e=0;e<s.length;e++){const t=s[e];for(const o in t)1===a.length?u[o]=i.extendedProperties[o]:(u[o]||(u[o]=n.map((t=>Array(t.length).fill(null)))),u[o][e]=t[o])}if(0!==n.length)return(l.length||r.length)&&(u.coordinateProperties=Object.assign(l.length?{times:1===n.length?l[0]:l}:{},r.length?{heart:1===n.length?r[0]:r}:{})),{type:"Feature",properties:u,geometry:{type:1===n.length?"LineString":"MultiLineString",coordinates:1===n.length?n[0]:n}}}function*k(t){const e=t.getElementsByTagName("Lap");for(let a=0;a<e.length;a++){const t=f(e[a]);t&&(yield t)}const o=t.getElementsByTagName("Courses");for(let a=0;a<o.length;a++){const t=f(o[a]);t&&(yield t)}}const y=/\s*/g,v=/^\s*|\s*$/g,h=/\s+/;function S(t){if(!t||!t.length)return 0;let e=0;for(let o=0;o<t.length;o++)e=(e<<5)-e+t.charCodeAt(o)|0;return e}function _(t){return t.replace(y,"").split(",").map(parseFloat)}function U(t){return t.replace(v,"").split(h).map(_)}function b(t){if(void 0!==t.xml)return t.xml;if(t.tagName){let e=t.tagName;for(let o=0;o<t.attributes.length;o++)e+=t.attributes[o].name+t.attributes[o].value;for(let o=0;o<t.childNodes.length;o++)e+=b(t.childNodes[o]);return e}return"#text"===t.nodeName?(t.nodeValue||t.value||"").trim():"#cdata-section"===t.nodeName?t.nodeValue:""}const T=["Polygon","LineString","Point","Track","gx:Track"];function E(t,a,n){let l=e(o(a,"color"))||"";const r="stroke"==n||"fill"===n?n:n+"-color";"#"===l.substr(0,1)&&(l=l.substr(1)),6===l.length||3===l.length?t[r]=l:8===l.length&&(t[n+"-opacity"]=parseInt(l.substr(0,2),16)/255,t[r]="#"+l.substr(6,2)+l.substr(4,2)+l.substr(2,2))}function D(t,a,n,l){const r=parseFloat(e(o(a,n)));isNaN(r)||(t[l]=r)}function O(t){let o=t.getElementsByTagName("coord");const a=[],n=[];0===o.length&&(o=t.getElementsByTagName("gx:coord"));for(let r=0;r<o.length;r++)a.push(e(o[r]).split(" ").map(parseFloat));const l=t.getElementsByTagName("when");for(let r=0;r<l.length;r++)n.push(e(l[r]));return{coords:a,times:n}}function A(t){let a,n,l,r,s;const i=[],u=[];if(o(t,"MultiGeometry"))return A(o(t,"MultiGeometry"));if(o(t,"MultiTrack"))return A(o(t,"MultiTrack"));if(o(t,"gx:MultiTrack"))return A(o(t,"gx:MultiTrack"));for(l=0;l<T.length;l++)if(n=t.getElementsByTagName(T[l]),n)for(r=0;r<n.length;r++)if(a=n[r],"Point"===T[l])i.push({type:"Point",coordinates:_(e(o(a,"coordinates")))});else if("LineString"===T[l])i.push({type:"LineString",coordinates:U(e(o(a,"coordinates")))});else if("Polygon"===T[l]){const t=a.getElementsByTagName("LinearRing"),n=[];for(s=0;s<t.length;s++)n.push(U(e(o(t[s],"coordinates"))));i.push({type:"Polygon",coordinates:n})}else if("Track"===T[l]||"gx:Track"===T[l]){const t=O(a);i.push({type:"LineString",coordinates:t.coords}),t.times.length&&u.push(t.times)}return{geoms:i,coordTimes:u}}function I(t,a,n,l){const r=A(t);let s;const i={},u=e(o(t,"name")),d=e(o(t,"address"));let c=e(o(t,"styleUrl"));const p=e(o(t,"description")),m=o(t,"TimeSpan"),w=o(t,"TimeStamp"),g=o(t,"ExtendedData");let f=o(t,"IconStyle"),k=o(t,"LabelStyle"),y=o(t,"LineStyle"),v=o(t,"PolyStyle");const h=o(t,"visibility");if(u&&(i.name=u),d&&(i.address=d),c){"#"!==c[0]&&(c="#"+c),i.styleUrl=c,a[c]&&(i.styleHash=a[c]),n[c]&&(i.styleMapHash=n[c],i.styleHash=a[n[c].normal]);const t=l[i.styleHash];t&&(f||(f=o(t,"IconStyle")),k||(k=o(t,"LabelStyle")),y||(y=o(t,"LineStyle")),v||(v=o(t,"PolyStyle")))}if(p&&(i.description=p),m){const t=e(o(m,"begin")),a=e(o(m,"end"));i.timespan={begin:t,end:a}}if(w&&(i.timestamp=e(o(w,"when"))),f){E(i,f,"icon"),D(i,f,"scale","icon-scale"),D(i,f,"heading","icon-heading");const t=o(f,"hotSpot");if(t){const e=parseFloat(t.getAttribute("x")),o=parseFloat(t.getAttribute("y"));isNaN(e)||isNaN(o)||(i["icon-offset"]=[e,o])}const a=o(f,"Icon");if(a){const t=e(o(a,"href"));t&&(i.icon=t)}}if(k&&(E(i,k,"label"),D(i,k,"scale","label-scale")),y&&(E(i,y,"stroke"),D(i,y,"width","stroke-width")),v){E(i,v,"fill");const t=e(o(v,"fill")),a=e(o(v,"outline"));t&&(i["fill-opacity"]="1"===t?i["fill-opacity"]||1:0),a&&(i["stroke-opacity"]="1"===a?i["stroke-opacity"]||1:0)}if(g){const t=g.getElementsByTagName("Data"),a=g.getElementsByTagName("SimpleData");for(s=0;s<t.length;s++)i[t[s].getAttribute("name")]=e(o(t[s],"value"));for(s=0;s<a.length;s++)i[a[s].getAttribute("name")]=e(a[s])}h&&(i.visibility=e(h)),r.coordTimes.length&&(i.coordinateProperties={times:1===r.coordTimes.length?r.coordTimes[0]:r.coordTimes});const S={type:"Feature",geometry:0===r.geoms.length?null:1===r.geoms.length?r.geoms[0]:{type:"GeometryCollection",geometries:r.geoms},properties:i};return t.getAttribute("id")&&(S.id=t.getAttribute("id")),S}function*C(t){const a={},n={},l={},r=t.getElementsByTagName("Placemark"),s=t.getElementsByTagName("Style"),i=t.getElementsByTagName("StyleMap");for(let e=0;e<s.length;e++){const t=S(b(s[e])).toString(16);a["#"+s[e].getAttribute("id")]=t,n[t]=s[e]}for(let u=0;u<i.length;u++){a["#"+i[u].getAttribute("id")]=S(b(i[u])).toString(16);const t=i[u].getElementsByTagName("Pair"),n={};for(let a=0;a<t.length;a++)n[e(o(t[a],"key"))]=e(o(t[a],"styleUrl"));l["#"+i[u].getAttribute("id")]=n}for(let e=0;e<r.length;e++){const t=I(r[e],a,l,n);t&&(yield t)}}t.gpx=function(t){return{type:"FeatureCollection",features:Array.from(d(t))}},t.gpxGen=d,t.kml=function(t){return{type:"FeatureCollection",features:Array.from(C(t))}},t.kmlGen=C,t.tcx=function(t){return{type:"FeatureCollection",features:Array.from(k(t))}},t.tcxGen=k,Object.defineProperty(t,"__esModule",{value:!0})}))},8367:function(t,e,o){"use strict";o.d(e,{Z:function(){return et}});var a=o(6252),n=o(3577),l=o(2262),r=o(9963),s=o(3324),i=o(2119),u=o(8602),d=o(9917),c=o(6558),p=o(8966),m=o(631),w=o(3649);const g={id:"workout-form"},f=["onSubmit"],k={class:"form-items"},y={key:0,class:"form-item-radio"},v=["checked","disabled"],h={for:"withGpx"},S=["checked","disabled"],_={for:"withoutGpx"},U={class:"form-item"},b=["disabled"],T=["value"],E={key:1,class:"form-item"},D={for:"gpxFile"},O=["disabled"],A={class:"files-help info-box"},I={key:2,class:"form-item"},C={for:"title"},N=["required","disabled"],R={key:3},x={class:"workout-date-duration"},$={class:"form-item"},L={class:"workout-date-time"},z=["disabled"],j=["disabled"],B={class:"form-item"},P=["disabled"],W=(0,a.Uk)(" : "),F=["disabled"],M=(0,a.Uk)(" : "),H=["disabled"],Z={class:"form-item"},q=["disabled"],G={class:"form-item"},K={key:1},V={key:2,class:"form-buttons"},Y=["disabled"],J=["onClick"];var X=(0,a.aZ)({props:{authUser:null,sports:null,isCreation:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},workout:{default:()=>({})}},setup(t){const e=t,{t:o}=(0,s.QT)(),X=(0,d.o)(),Q=(0,i.tv)(),{authUser:tt,workout:et,isCreation:ot,loading:at}=(0,l.BK)(e),nt=(0,a.Fl)((()=>(0,m.xH)(e.sports,o,"is_active_for_user",et.value.id?[et.value.sport_id]:[]))),lt=(0,a.Fl)((()=>X.getters[u.SY.GETTERS.APP_CONFIG])),rt=lt.value.max_single_file_size?(0,p.Z)(lt.value.max_single_file_size):"",st=lt.value.gpx_limit_import,it=lt.value.max_zip_file_size?(0,p.Z)(lt.value.max_zip_file_size):"",ut=(0,a.Fl)((()=>X.getters[u.SY.GETTERS.ERROR_MESSAGES])),dt=(0,l.qj)({sport_id:"",title:"",notes:"",workoutDate:"",workoutTime:"",workoutDurationHour:"",workoutDurationMinutes:"",workoutDurationSeconds:"",workoutDistance:""});let ct=(0,l.iH)(e.workout.id?e.workout.with_gpx:e.isCreation),pt=null;const mt=(0,l.iH)(!1);function wt(t){dt.notes=t}function gt(){ct.value=!ct.value,mt.value=!1}function ft(t){t.target.files&&(pt=t.target.files[0])}function kt(t){if(dt.sport_id=`${t.sport_id}`,dt.title=t.title,dt.notes=t.notes,!t.with_gpx){const o=(0,c.Jo)((0,c.eB)(t.workout_date,e.authUser.timezone),"yyyy-MM-dd"),a=t.duration.split(":");dt.workoutDistance=`${tt.value.imperial_units?(0,w.sC)(t.distance,"km","mi",2):parseFloat(t.distance.toFixed(2))}`,dt.workoutDate=o.workout_date,dt.workoutTime=o.workout_time,dt.workoutDurationHour=a[0],dt.workoutDurationMinutes=a[1],dt.workoutDurationSeconds=a[2]}}function yt(t){t.title=dt.title,t.distance=tt.value.imperial_units?(0,w.sC)(+dt.workoutDistance,"mi","km",3):+dt.workoutDistance,t.duration=3600*+dt.workoutDurationHour+60*+dt.workoutDurationMinutes+ +dt.workoutDurationSeconds,t.workout_date=`${dt.workoutDate} ${dt.workoutTime}`}function vt(){const t={sport_id:+dt.sport_id,notes:dt.notes};if(e.workout.id)e.workout.with_gpx?t.title=dt.title:yt(t),X.dispatch(u.aX.ACTIONS.EDIT_WORKOUT,{workoutId:e.workout.id,data:t});else if(ct.value){if(!pt){const t="workouts.NO_FILE_PROVIDED";return void X.commit(u.SY.MUTATIONS.SET_ERROR_MESSAGES,t)}t.file=pt,X.dispatch(u.aX.ACTIONS.ADD_WORKOUT,t)}else yt(t),X.dispatch(u.aX.ACTIONS.ADD_WORKOUT_WITHOUT_GPX,t)}function ht(){e.workout.id?Q.push({name:"Workout",params:{workoutId:e.workout.id}}):Q.go(-1)}function St(){mt.value=!0}return(0,a.bv)((()=>{e.workout.id&&kt(e.workout)})),(0,a.Ah)((()=>X.commit(u.SY.MUTATIONS.EMPTY_ERROR_MESSAGES))),(0,a.YP)((()=>e.workout),(async(t,e)=>{t!==e&&t&&t.id&&kt(t)})),(t,e)=>{const o=(0,a.up)("CustomTextArea"),s=(0,a.up)("ErrorMessage"),i=(0,a.up)("Loader"),u=(0,a.up)("Card");return(0,a.wg)(),(0,a.iD)("div",{id:"workout-edition",class:(0,n.C_)(["center-card with-margin",{"center-form":(0,l.SU)(et)&&(0,l.SU)(et).with_gpx}])},[(0,a.Wm)(u,null,{title:(0,a.w5)((()=>[(0,a.Uk)((0,n.zw)(t.$t(`workouts.${(0,l.SU)(ot)?"ADD":"EDIT"}_WORKOUT`)),1)])),content:(0,a.w5)((()=>[(0,a._)("div",g,[(0,a._)("form",{class:(0,n.C_)({errors:mt.value}),onSubmit:(0,r.iM)(vt,["prevent"])},[(0,a._)("div",k,[(0,l.SU)(ot)?((0,a.wg)(),(0,a.iD)("div",y,[(0,a._)("div",null,[(0,a._)("input",{id:"withGpx",type:"radio",checked:(0,l.SU)(ct),disabled:(0,l.SU)(at),onClick:gt},null,8,v),(0,a._)("label",h,(0,n.zw)(t.$t("workouts.WITH_GPX")),1)]),(0,a._)("div",null,[(0,a._)("input",{id:"withoutGpx",type:"radio",checked:!(0,l.SU)(ct),disabled:(0,l.SU)(at),onClick:gt},null,8,S),(0,a._)("label",_,(0,n.zw)(t.$t("workouts.WITHOUT_GPX")),1)])])):(0,a.kq)("",!0),(0,a._)("div",U,[(0,a._)("label",null,(0,n.zw)(t.$t("workouts.SPORT",1))+": ",1),(0,a.wy)((0,a._)("select",{id:"sport",required:"",onInvalid:St,disabled:(0,l.SU)(at),"onUpdate:modelValue":e[0]||(e[0]=t=>(0,l.SU)(dt).sport_id=t)},[((0,a.wg)(!0),(0,a.iD)(a.HY,null,(0,a.Ko)((0,l.SU)(nt),(t=>((0,a.wg)(),(0,a.iD)("option",{value:t.id,key:t.id},(0,n.zw)(t.translatedLabel),9,T)))),128))],40,b),[[r.bM,(0,l.SU)(dt).sport_id]])]),(0,l.SU)(ot)&&(0,l.SU)(ct)?((0,a.wg)(),(0,a.iD)("div",E,[(0,a._)("label",D,(0,n.zw)(t.$t("workouts.GPX_FILE"))+" "+(0,n.zw)(t.$t("workouts.ZIP_ARCHIVE_DESCRIPTION"))+": ",1),(0,a._)("input",{id:"gpxFile",name:"gpxFile",type:"file",accept:".gpx, .zip",disabled:(0,l.SU)(at),required:"",onInvalid:St,onInput:ft},null,40,O),(0,a._)("div",A,[(0,a._)("div",null,[(0,a._)("strong",null,(0,n.zw)(t.$t("workouts.GPX_FILE"))+":",1),(0,a._)("ul",null,[(0,a._)("li",null,(0,n.zw)(t.$t("workouts.MAX_SIZE"))+": "+(0,n.zw)((0,l.SU)(rt)),1)])]),(0,a._)("div",null,[(0,a._)("strong",null,(0,n.zw)(t.$t("workouts.ZIP_ARCHIVE"))+":",1),(0,a._)("ul",null,[(0,a._)("li",null,(0,n.zw)(t.$t("workouts.NO_FOLDER")),1),(0,a._)("li",null,(0,n.zw)(t.$t("workouts.MAX_FILES"))+": "+(0,n.zw)((0,l.SU)(st)),1),(0,a._)("li",null,(0,n.zw)(t.$t("workouts.MAX_SIZE"))+": "+(0,n.zw)((0,l.SU)(it)),1)])])])])):((0,a.wg)(),(0,a.iD)("div",I,[(0,a._)("label",C,(0,n.zw)(t.$t("workouts.TITLE"))+": ",1),(0,a.wy)((0,a._)("input",{id:"title",name:"title",type:"text",required:!(0,l.SU)(ot),onInvalid:St,disabled:(0,l.SU)(at),"onUpdate:modelValue":e[1]||(e[1]=t=>(0,l.SU)(dt).title=t)},null,40,N),[[r.nr,(0,l.SU)(dt).title]])])),(0,l.SU)(ct)?(0,a.kq)("",!0):((0,a.wg)(),(0,a.iD)("div",R,[(0,a._)("div",x,[(0,a._)("div",$,[(0,a._)("label",null,(0,n.zw)(t.$t("workouts.WORKOUT_DATE"))+":",1),(0,a._)("div",L,[(0,a.wy)((0,a._)("input",{id:"workout-date",name:"workout-date",type:"date",required:"",onInvalid:St,disabled:(0,l.SU)(at),"onUpdate:modelValue":e[2]||(e[2]=t=>(0,l.SU)(dt).workoutDate=t)},null,40,z),[[r.nr,(0,l.SU)(dt).workoutDate]]),(0,a.wy)((0,a._)("input",{id:"workout-time",name:"workout-time",class:"workout-time",type:"time",required:"",onInvalid:St,disabled:(0,l.SU)(at),"onUpdate:modelValue":e[3]||(e[3]=t=>(0,l.SU)(dt).workoutTime=t)},null,40,j),[[r.nr,(0,l.SU)(dt).workoutTime]])])]),(0,a._)("div",B,[(0,a._)("label",null,(0,n.zw)(t.$t("workouts.DURATION"))+":",1),(0,a._)("div",null,[(0,a.wy)((0,a._)("input",{id:"workout-duration-hour",name:"workout-duration-hour",class:"workout-duration",type:"text",placeholder:"HH",pattern:"^([0-1]?[0-9]|2[0-3])$",required:"",onInvalid:St,disabled:(0,l.SU)(at),"onUpdate:modelValue":e[4]||(e[4]=t=>(0,l.SU)(dt).workoutDurationHour=t)},null,40,P),[[r.nr,(0,l.SU)(dt).workoutDurationHour]]),W,(0,a.wy)((0,a._)("input",{id:"workout-duration-minutes",name:"workout-duration-minutes",class:"workout-duration",type:"text",pattern:"^([0-5][0-9])$",placeholder:"MM",required:"",onInvalid:St,disabled:(0,l.SU)(at),"onUpdate:modelValue":e[5]||(e[5]=t=>(0,l.SU)(dt).workoutDurationMinutes=t)},null,40,F),[[r.nr,(0,l.SU)(dt).workoutDurationMinutes]]),M,(0,a.wy)((0,a._)("input",{id:"workout-duration-seconds",name:"workout-duration-seconds",class:"workout-duration",type:"text",pattern:"^([0-5][0-9])$",placeholder:"SS",required:"",onInvalid:St,disabled:(0,l.SU)(at),"onUpdate:modelValue":e[6]||(e[6]=t=>(0,l.SU)(dt).workoutDurationSeconds=t)},null,40,H),[[r.nr,(0,l.SU)(dt).workoutDurationSeconds]])])])]),(0,a._)("div",Z,[(0,a._)("label",null,(0,n.zw)(t.$t("workouts.DISTANCE"))+" ("+(0,n.zw)((0,l.SU)(tt).imperial_units?"mi":"km")+"): ",1),(0,a.wy)((0,a._)("input",{name:"workout-distance",type:"number",min:"0",step:"0.001",required:"",onInvalid:St,disabled:(0,l.SU)(at),"onUpdate:modelValue":e[7]||(e[7]=t=>(0,l.SU)(dt).workoutDistance=t)},null,40,q),[[r.nr,(0,l.SU)(dt).workoutDistance]])])])),(0,a._)("div",G,[(0,a._)("label",null,(0,n.zw)(t.$t("workouts.NOTES"))+": ",1),(0,a.Wm)(o,{name:"notes",input:(0,l.SU)(dt).notes,disabled:(0,l.SU)(at),onUpdateValue:wt},null,8,["input","disabled"])])]),(0,l.SU)(ut)?((0,a.wg)(),(0,a.j4)(s,{key:0,message:(0,l.SU)(ut)},null,8,["message"])):(0,a.kq)("",!0),(0,l.SU)(at)?((0,a.wg)(),(0,a.iD)("div",K,[(0,a.Wm)(i)])):((0,a.wg)(),(0,a.iD)("div",V,[(0,a._)("button",{class:"confirm",type:"submit",disabled:(0,l.SU)(at)},(0,n.zw)(t.$t("buttons.SUBMIT")),9,Y),(0,a._)("button",{class:"cancel",onClick:(0,r.iM)(ht,["prevent"])},(0,n.zw)(t.$t("buttons.CANCEL")),9,J)]))],42,f)])])),_:1})],2)}}}),Q=o(3744);const tt=(0,Q.Z)(X,[["__scopeId","data-v-0050001d"]]);var et=tt},4189:function(t,e,o){"use strict";o.r(e),o.d(e,{default:function(){return p}});var a=o(6252),n=o(2262),l=o(8367),r=o(8602),s=o(9917);const i={id:"add-workout",class:"view"},u={class:"container"};var d=(0,a.aZ)({setup(t){const e=(0,s.o)(),o=(0,a.Fl)((()=>e.getters[r.O8.GETTERS.SPORTS])),d=(0,a.Fl)((()=>e.getters[r.YN.GETTERS.AUTH_USER_PROFILE])),c=(0,a.Fl)((()=>e.getters[r.aX.GETTERS.WORKOUT_DATA]));return(t,e)=>((0,a.wg)(),(0,a.iD)("div",i,[(0,a._)("div",u,[(0,a.Wm)(l.Z,{authUser:(0,n.SU)(d),sports:(0,n.SU)(o),isCreation:!0,loading:(0,n.SU)(c).loading},null,8,["authUser","sports","loading"])])]))}});const c=d;var p=c},8237:function(t,e,o){"use strict";o.r(e),o.d(e,{default:function(){return m}});var a=o(6252),n=o(2262),l=o(2119),r=o(8367),s=o(8602),i=o(9917);const u={id:"edit-workout",class:"view"},d={class:"container"};var c=(0,a.aZ)({setup(t){const e=(0,l.yj)(),o=(0,i.o)(),c=(0,a.Fl)((()=>o.getters[s.YN.GETTERS.AUTH_USER_PROFILE])),p=(0,a.Fl)((()=>o.getters[s.O8.GETTERS.SPORTS])),m=(0,a.Fl)((()=>o.getters[s.aX.GETTERS.WORKOUT_DATA]));return(0,a.wF)((()=>{o.dispatch(s.aX.ACTIONS.GET_WORKOUT_DATA,{workoutId:e.params.workoutId})})),(0,a.YP)((()=>e.params.workoutId),(async t=>{t||o.commit(s.aX.MUTATIONS.EMPTY_WORKOUT)})),(t,e)=>((0,a.wg)(),(0,a.iD)("div",u,[(0,a._)("div",d,[(0,a.Wm)(r.Z,{authUser:(0,n.SU)(c),sports:(0,n.SU)(p),workout:(0,n.SU)(m).workout,loading:(0,n.SU)(m).loading},null,8,["authUser","sports","workout","loading"])])]))}});const p=c;var m=p},8461:function(t,e,o){"use strict";o.r(e),o.d(e,{default:function(){return jo}});var a=o(6252),n=o(2262),l=o(2119),r=o(8273),s=o(3577),i=o(9963),u=o(5167);const d=t=>((0,a.dD)("data-v-4d9f9a8a"),t=t(),(0,a.Cn)(),t),c={id:"workout-card-title"},p=["title"],m=d((()=>(0,a._)("i",{class:"fa fa-chevron-left","aria-hidden":"true"},null,-1))),w=[m],g={class:"workout-card-title"},f={class:"workout-title-date"},k={key:0,class:"workout-title"},y={key:1,class:"workout-title"},v={class:"workout-segment"},h=(0,a.Uk)(" — "),S=d((()=>(0,a._)("i",{class:"fa fa-map-marker","aria-hidden":"true"},null,-1))),_={class:"workout-date"},U={class:"workout-link"},b=["title"],T=d((()=>(0,a._)("i",{class:"fa fa-chevron-right","aria-hidden":"true"},null,-1))),E=[T];var D=(0,a.aZ)({props:{sport:null,workoutObject:null},emits:["displayModal"],setup(t,{emit:e}){const o=t,{sport:l,workoutObject:r}=(0,n.BK)(o);async function d(t){await u.Z.get(`workouts/${t}/gpx/download`,{responseType:"blob"}).then((e=>{const o=window.URL.createObjectURL(new Blob([e.data],{type:"application/gpx+xml"})),a=document.createElement("a");a.href=o,a.setAttribute("download",`${t}.gpx`),document.body.appendChild(a),a.click()}))}return(t,o)=>{const u=(0,a.up)("SportImage"),m=(0,a.up)("router-link");return(0,a.wg)(),(0,a.iD)("div",c,[(0,a._)("div",{class:(0,s.C_)(["workout-previous workout-arrow",{inactive:!(0,n.SU)(r).previousUrl}]),title:(0,n.SU)(r).previousUrl?t.$t(`workouts.PREVIOUS_${(0,n.SU)(r).type}`):t.$t(`workouts.NO_PREVIOUS_${(0,n.SU)(r).type}`),onClick:o[0]||(o[0]=e=>(0,n.SU)(r).previousUrl?t.$router.push((0,n.SU)(r).previousUrl):null)},w,10,p),(0,a._)("div",g,[(0,a.Wm)(u,{"sport-label":(0,n.SU)(l).label,color:(0,n.SU)(l).color},null,8,["sport-label","color"]),(0,a._)("div",f,["WORKOUT"===(0,n.SU)(r).type?((0,a.wg)(),(0,a.iD)("div",k,[(0,a._)("span",null,(0,s.zw)((0,n.SU)(r).title),1),(0,a._)("i",{class:"fa fa-edit","aria-hidden":"true",onClick:o[1]||(o[1]=e=>t.$router.push({name:"EditWorkout",params:{workoutId:(0,n.SU)(r).workoutId}}))}),(0,n.SU)(r).with_gpx?((0,a.wg)(),(0,a.iD)("i",{key:0,class:"fa fa-download","aria-hidden":"true",onClick:o[2]||(o[2]=(0,i.iM)((t=>d((0,n.SU)(r).workoutId)),["prevent"]))})):(0,a.kq)("",!0),(0,a._)("i",{class:"fa fa-trash","aria-hidden":"true",onClick:o[3]||(o[3]=t=>e("displayModal",!0))})])):((0,a.wg)(),(0,a.iD)("div",y,[(0,a.Uk)((0,s.zw)((0,n.SU)(r).title)+" ",1),(0,a._)("span",v,[h,S,(0,a.Uk)(" "+(0,s.zw)(t.$t("workouts.SEGMENT"))+" "+(0,s.zw)((0,n.SU)(r).segmentId+1),1)])])),(0,a._)("div",_,[(0,a.Uk)((0,s.zw)((0,n.SU)(r).workoutDate)+" - "+(0,s.zw)((0,n.SU)(r).workoutTime)+" ",1),(0,a._)("span",U,["SEGMENT"===(0,n.SU)(r).type?((0,a.wg)(),(0,a.j4)(m,{key:0,to:{name:"Workout",params:{workoutId:(0,n.SU)(r).workoutId}}},{default:(0,a.w5)((()=>[(0,a.Uk)(" > "+(0,s.zw)(t.$t("workouts.BACK_TO_WORKOUT")),1)])),_:1},8,["to"])):(0,a.kq)("",!0)])])])]),(0,a._)("div",{class:(0,s.C_)(["workout-next workout-arrow",{inactive:!(0,n.SU)(r).nextUrl}]),title:(0,n.SU)(r).nextUrl?t.$t(`workouts.NEXT_${(0,n.SU)(r).type}`):t.$t(`workouts.NO_NEXT_${(0,n.SU)(r).type}`),onClick:o[4]||(o[4]=e=>(0,n.SU)(r).nextUrl?t.$router.push((0,n.SU)(r).nextUrl):null)},E,10,b)])}}}),O=o(3744);const A=(0,O.Z)(D,[["__scopeId","data-v-4d9f9a8a"]]);var I=A;const C=t=>((0,a.dD)("data-v-1a5282f6"),t=t(),(0,a.Cn)(),t),N={key:0,class:"workout-record"},R=C((()=>(0,a._)("sup",null,[(0,a._)("i",{class:"fa fa-trophy","aria-hidden":"true"})],-1))),x=[R];var $=(0,a.aZ)({props:{recordType:null,workoutObject:null},setup(t){const e=t,{recordType:o,workoutObject:l}=(0,n.BK)(e);return(t,e)=>(0,n.SU)(l).records&&(0,n.SU)(l).records.find((t=>t.record_type===(0,n.SU)(o)))?((0,a.wg)(),(0,a.iD)("span",N,x)):(0,a.kq)("",!0)}});const L=(0,O.Z)($,[["__scopeId","data-v-1a5282f6"]]);var z=L,j=o(3324);const B=["N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"],P=t=>{const e=Math.floor(t/22.5+.5);return B[e%16]},W={class:"wind"},F={class:"wind-bearing"},M=["title"];var H=(0,a.aZ)({props:{weather:null,useImperialUnits:{type:Boolean}},setup(t){const e=t,{useImperialUnits:o,weather:l}=(0,n.BK)(e),{t:r}=(0,j.QT)();function i(t){return r(`workouts.WEATHER.WIND_DIRECTIONS.${P(t)}`)}return(t,e)=>{const r=(0,a.up)("Distance");return(0,a.wg)(),(0,a.iD)("div",W,[(0,a.Wm)(r,{distance:(0,n.SU)(l).wind,unitFrom:"m",digits:1,displayUnit:!1,useImperialUnits:(0,n.SU)(o)},null,8,["distance","useImperialUnits"]),(0,a.Uk)(" "+(0,s.zw)((0,n.SU)(o)?"ft":"m")+"/s ",1),(0,a._)("div",F,[(0,n.SU)(l).windBearing?((0,a.wg)(),(0,a.iD)("i",{key:0,class:"fa fa-long-arrow-down",style:(0,s.j5)({transform:`rotate(${(0,n.SU)(l).windBearing}deg)`}),"aria-hidden":"true",title:i((0,n.SU)(l).windBearing)},null,12,M)):(0,a.kq)("",!0)])])}}});const Z=(0,O.Z)(H,[["__scopeId","data-v-46a7c31c"]]);var q=Z;const G=t=>((0,a.dD)("data-v-76e9ab62"),t=t(),(0,a.Cn)(),t),K={key:0,id:"workout-weather"},V={class:"weather-table"},Y=G((()=>(0,a._)("th",null,null,-1))),J={class:"weather-th"},X=["src","alt","title"],Q={class:"weather-th"},tt=["src","alt","title"],et=["alt","title"],ot=["alt","title"],at=["alt","title"];var nt=(0,a.aZ)({props:{workoutObject:null,useImperialUnits:{type:Boolean}},setup(t){const e=t,{useImperialUnits:o,workoutObject:l}=(0,n.BK)(e);return(t,e)=>(0,n.SU)(l).weatherStart&&(0,n.SU)(l).weatherEnd?((0,a.wg)(),(0,a.iD)("div",K,[(0,a._)("table",V,[(0,a._)("thead",null,[(0,a._)("tr",null,[Y,(0,a._)("th",null,[(0,a._)("div",J,[(0,a.Uk)((0,s.zw)(t.$t("workouts.START"))+" ",1),(0,a._)("img",{class:"weather-img",src:`/img/weather/${(0,n.SU)(l).weatherStart.icon}.svg`,alt:t.$t(`workouts.WEATHER.DARK_SKY.${(0,n.SU)(l).weatherStart.icon}`),title:t.$t(`workouts.WEATHER.DARK_SKY.${(0,n.SU)(l).weatherStart.icon}`)},null,8,X)])]),(0,a._)("th",null,[(0,a._)("div",Q,[(0,a.Uk)((0,s.zw)(t.$t("workouts.END"))+" ",1),(0,a._)("img",{class:"weather-img",src:`/img/weather/${(0,n.SU)(l).weatherEnd.icon}.svg`,alt:t.$t(`workouts.WEATHER.DARK_SKY.${(0,n.SU)(l).weatherEnd.icon}`),title:t.$t(`workouts.WEATHER.DARK_SKY.${(0,n.SU)(l).weatherEnd.icon}`)},null,8,tt)])])])]),(0,a._)("tbody",null,[(0,a._)("tr",null,[(0,a._)("td",null,[(0,a._)("img",{class:"weather-img weather-img-small",src:"/img/weather/temperature.svg",alt:t.$t("workouts.WEATHER.TEMPERATURE"),title:t.$t("workouts.WEATHER.TEMPERATURE")},null,8,et)]),(0,a._)("td",null,(0,s.zw)(Number((0,n.SU)(l).weatherStart.temperature).toFixed(1))+"°C ",1),(0,a._)("td",null,(0,s.zw)(Number((0,n.SU)(l).weatherEnd.temperature).toFixed(1))+"°C ",1)]),(0,a._)("tr",null,[(0,a._)("td",null,[(0,a._)("img",{class:"weather-img weather-img-small",src:"/img/weather/pour-rain.svg",alt:t.$t("workouts.WEATHER.HUMIDITY"),title:t.$t("workouts.WEATHER.HUMIDITY")},null,8,ot)]),(0,a._)("td",null,(0,s.zw)(Number(100*(0,n.SU)(l).weatherStart.humidity).toFixed(1))+"% ",1),(0,a._)("td",null,(0,s.zw)(Number(100*(0,n.SU)(l).weatherEnd.humidity).toFixed(1))+"% ",1)]),(0,a._)("tr",null,[(0,a._)("td",null,[(0,a._)("img",{class:"weather-img weather-img-small",src:"/img/weather/breeze.svg",alt:t.$t("workouts.WEATHER.WIND"),title:t.$t("workouts.WEATHER.WIND")},null,8,at)]),(0,a._)("td",null,[(0,a.Wm)(q,{weather:(0,n.SU)(l).weatherStart,useImperialUnits:(0,n.SU)(o)},null,8,["weather","useImperialUnits"])]),(0,a._)("td",null,[(0,a.Wm)(q,{weather:(0,n.SU)(l).weatherEnd,useImperialUnits:(0,n.SU)(o)},null,8,["weather","useImperialUnits"])])])])])])):(0,a.kq)("",!0)}});const lt=(0,O.Z)(nt,[["__scopeId","data-v-76e9ab62"]]);var rt=lt;const st=t=>((0,a.dD)("data-v-dc2fbc66"),t=t(),(0,a.Cn)(),t),it={id:"workout-info"},ut={class:"workout-data"},dt=st((()=>(0,a._)("i",{class:"fa fa-clock-o","aria-hidden":"true"},null,-1))),ct={class:"label"},pt=(0,a.Uk)(": "),mt={class:"value"},wt={key:0},gt={class:"value"},ft={class:"value"},kt={class:"workout-data"},yt=st((()=>(0,a._)("i",{class:"fa fa-road","aria-hidden":"true"},null,-1))),vt={class:"label"},ht=(0,a.Uk)(": "),St={class:"workout-data"},_t=st((()=>(0,a._)("i",{class:"fa fa-tachometer","aria-hidden":"true"},null,-1))),Ut={class:"label"},bt=(0,a.Uk)(": "),Tt=st((()=>(0,a._)("br",null,null,-1))),Et={class:"label"},Dt=(0,a.Uk)(": "),Ot={key:0,class:"workout-data"},At=["alt"],It={class:"label"},Ct=(0,a.Uk)(": "),Nt=st((()=>(0,a._)("br",null,null,-1))),Rt={class:"label"},xt=(0,a.Uk)(": "),$t={key:1,class:"workout-data"},Lt=st((()=>(0,a._)("i",{class:"fa fa-location-arrow","aria-hidden":"true"},null,-1))),zt={class:"label"},jt=(0,a.Uk)(": "),Bt=st((()=>(0,a._)("br",null,null,-1))),Pt={class:"label"},Wt=(0,a.Uk)(": ");var Ft=(0,a.aZ)({props:{workoutObject:null,useImperialUnits:{type:Boolean}},setup(t){const e=t,{workoutObject:o,useImperialUnits:l}=(0,n.BK)(e),r=(0,a.Fl)((()=>"0:00:00"!==e.workoutObject.pauses&&null!==e.workoutObject.pauses));return(t,e)=>{const i=(0,a.up)("Distance");return(0,a.wg)(),(0,a.iD)("div",it,[(0,a._)("div",ut,[dt,(0,a._)("span",ct,(0,s.zw)(t.$t("workouts.DURATION")),1),pt,(0,a._)("span",mt,(0,s.zw)((0,n.SU)(o).moving),1),(0,a.Wm)(z,{workoutObject:(0,n.SU)(o),recordType:"LD"},null,8,["workoutObject"]),(0,n.SU)(r)?((0,a.wg)(),(0,a.iD)("div",wt,[(0,a.Uk)(" ("+(0,s.zw)(t.$t("workouts.PAUSES"))+": ",1),(0,a._)("span",gt,(0,s.zw)((0,n.SU)(o).pauses),1),(0,a.Uk)(" - "+(0,s.zw)(t.$t("workouts.TOTAL_DURATION"))+": ",1),(0,a._)("span",ft,(0,s.zw)((0,n.SU)(o).duration)+")",1)])):(0,a.kq)("",!0)]),(0,a._)("div",kt,[yt,(0,a._)("span",vt,(0,s.zw)(t.$t("workouts.DISTANCE")),1),ht,(0,a.Wm)(i,{distance:(0,n.SU)(o).distance,digits:3,unitFrom:"km",strong:!0,useImperialUnits:(0,n.SU)(l)},null,8,["distance","useImperialUnits"]),(0,a.Wm)(z,{workoutObject:(0,n.SU)(o),recordType:"FD"},null,8,["workoutObject"])]),(0,a._)("div",St,[_t,(0,a._)("span",Ut,(0,s.zw)(t.$t("workouts.AVERAGE_SPEED")),1),bt,(0,a.Wm)(i,{distance:(0,n.SU)(o).aveSpeed,unitFrom:"km",speed:!0,strong:!0,useImperialUnits:(0,n.SU)(l)},null,8,["distance","useImperialUnits"]),(0,a.Wm)(z,{workoutObject:(0,n.SU)(o),recordType:"AS"},null,8,["workoutObject"]),Tt,(0,a._)("span",Et,(0,s.zw)(t.$t("workouts.MAX_SPEED")),1),Dt,(0,a.Wm)(i,{distance:(0,n.SU)(o).maxSpeed,unitFrom:"km",speed:!0,strong:!0,useImperialUnits:(0,n.SU)(l)},null,8,["distance","useImperialUnits"]),(0,a.Wm)(z,{workoutObject:(0,n.SU)(o),recordType:"MS"},null,8,["workoutObject"])]),null!==(0,n.SU)(o).maxAlt&&null!==(0,n.SU)(o).minAlt?((0,a.wg)(),(0,a.iD)("div",Ot,[(0,a._)("img",{class:"mountains",src:"/img/workouts/mountains.svg",alt:t.$t("workouts.ELEVATION")},null,8,At),(0,a._)("span",It,(0,s.zw)(t.$t("workouts.MIN_ALTITUDE")),1),Ct,(0,a.Wm)(i,{distance:(0,n.SU)(o).minAlt,unitFrom:"m",strong:!0,useImperialUnits:(0,n.SU)(l)},null,8,["distance","useImperialUnits"]),Nt,(0,a._)("span",Rt,(0,s.zw)(t.$t("workouts.MAX_ALTITUDE")),1),xt,(0,a.Wm)(i,{distance:(0,n.SU)(o).maxAlt,unitFrom:"m",strong:!0,useImperialUnits:(0,n.SU)(l)},null,8,["distance","useImperialUnits"])])):(0,a.kq)("",!0),null!==(0,n.SU)(o).ascent&&null!==(0,n.SU)(o).descent?((0,a.wg)(),(0,a.iD)("div",$t,[Lt,(0,a._)("span",zt,(0,s.zw)(t.$t("workouts.ASCENT")),1),jt,(0,a.Wm)(i,{distance:(0,n.SU)(o).ascent,unitFrom:"m",strong:!0,useImperialUnits:(0,n.SU)(l)},null,8,["distance","useImperialUnits"]),Bt,(0,a._)("span",Pt,(0,s.zw)(t.$t("workouts.DESCENT")),1),Wt,(0,a.Wm)(i,{distance:(0,n.SU)(o).descent,unitFrom:"m",strong:!0,useImperialUnits:(0,n.SU)(l)},null,8,["distance","useImperialUnits"])])):(0,a.kq)("",!0),(0,a.Wm)(rt,{workoutObject:(0,n.SU)(o),useImperialUnits:(0,n.SU)(l)},null,8,["workoutObject","useImperialUnits"])])}}});const Mt=(0,O.Z)(Ft,[["__scopeId","data-v-dc2fbc66"]]);var Ht=Mt,Zt=o(7520);const qt=(t,e)=>{let o;return function(...a){const n=this;o&&clearTimeout(o),o=setTimeout((()=>{t.apply(n,a),o=null}),e)}},Gt=t=>t&&"function"===typeof t.charAt?t.charAt(0).toUpperCase()+t.slice(1):t,Kt=(t,e,o)=>{for(const n in o){const l="set"+Gt(n);t[l]?(0,a.YP)((()=>o[n]),((e,o)=>{t[l](e,o)})):e[l]&&(0,a.YP)((()=>o[n]),(t=>{e[l](t)}))}},Vt=t=>{const e={};for(const o in t)if(o.startsWith("on")&&!o.startsWith("onUpdate")&&"onReady"!==o){const a=o.slice(2).toLocaleLowerCase();e[a]=t[o]}return e},Yt=async t=>{const e=await Promise.all([o.e(431).then(o.t.bind(o,6431,17)),o.e(93).then(o.t.bind(o,7093,17)),o.e(858).then(o.t.bind(o,8858,17))]);delete t.Default.prototype._getIconUrl,t.Default.mergeOptions({iconRetinaUrl:e[0].default,iconUrl:e[1].default,shadowUrl:e[2].default})},Jt=t=>{const e=(0,n.iH)((()=>console.warn(`Method ${t} has been invoked without being replaced`))),o=(...t)=>e.value(...t);return o.wrapped=e,(0,a.JJ)(t,o),o},Xt=(t,e)=>t.wrapped.value=e,Qt="object"===typeof self&&self.self===self&&self||"object"===typeof o.g&&o.g.global===o.g&&o.g||void 0,te="useGlobalLeaflet",ee={options:{type:Object,default:()=>({})}},oe=t=>({options:t.options,methods:{}}),ae={...ee,pane:{type:String,default:"overlayPane"},attribution:{type:String,default:null},name:{type:String,custom:!0,default:void 0},layerType:{type:String,custom:!0,default:void 0},visible:{type:Boolean,custom:!0,default:!0}},ne=(t,e,o)=>{const n=(0,a.f3)("addLayer"),l=(0,a.f3)("removeLayer"),{options:r,methods:s}=oe(t),i={...r,attribution:t.attribution,pane:t.pane},u=()=>n({leafletObject:e.value}),d=()=>l({leafletObject:e.value}),c={...s,setAttribution(t,e){const o=this.$parent.leafletObject.attributionControl;o.removeAttribution(e).addAttribution(t)},setName(){d(),t.visible&&u()},setLayerType(){d(),t.visible&&u()},setVisible(t){e.value&&(t?u():d())},bindPopup({leafletObject:t}){e.value.bindPopup(t)},bindTooltip({leafletObject:t}){e.value.bindTooltip(t)},unbindTooltip(){const t=e.value?e.value.getTooltip():null;t&&t.unbindTooltip()},unbindPopup(){const t=e.value?e.value.getPopup():null;t&&t.unbindPopup()},updateVisibleProp(t){o.emit("update:visible",t)}};return(0,a.JJ)("bindPopup",c.bindPopup),(0,a.JJ)("bindTooltip",c.bindTooltip),(0,a.JJ)("unbindTooltip",c.unbindTooltip),(0,a.JJ)("unbindPopup",c.unbindPopup),(0,a.Ah)((()=>{c.unbindPopup(),c.unbindTooltip(),d()})),{options:i,methods:c}},le=(t,e)=>{if(t&&e.default)return(0,a.h)("div",{style:{display:"none"}},e.default())},re={...ee,interactive:{type:Boolean,default:!0},bubblingMouseEvents:{type:Boolean,default:!0}},se={...ae,...re,stroke:{type:Boolean,custom:!0,default:!0},color:{type:String,custom:!0,default:"#3388ff"},weight:{type:Number,custom:!0,default:3},opacity:{type:Number,custom:!0,default:1},lineCap:{type:String,custom:!0,default:"round"},lineJoin:{type:String,custom:!0,default:"round"},dashArray:{type:String,custom:!0,default:null},dashOffset:{type:String,custom:!0,default:null},fill:{type:Boolean,custom:!0,default:!1},fillColor:{type:String,custom:!0,default:"#3388ff"},fillOpacity:{type:Number,custom:!0,default:.2},fillRule:{type:String,custom:!0,default:"evenodd"},className:{type:String,custom:!0,default:null}},ie={...se,latLng:{type:[Object,Array],custom:!0,default:null},radius:{type:Number,default:null}};const ue={...ee,position:{type:String,default:"topright"}},de=(t,e)=>{const{options:o,methods:n}=oe(t),l={...o,position:t.position},r={...n,setPosition(t){e.value&&e.value.setPosition(t)}};return(0,a.Ah)((()=>{e.value&&e.value.remove()})),{options:l,methods:r}},ce=t=>t.default?(0,a.h)("div",{ref:"root"},t.default()):null;var pe={name:"LControl",props:{...ue,disableClickPropagation:{type:Boolean,custom:!0,default:!0},disableScrollPropagation:{type:Boolean,custom:!0,default:!1}},setup(t,e){const l=(0,n.iH)({}),r=(0,n.iH)(null),s=(0,a.f3)(te),i=(0,a.f3)("registerControl"),{options:u,methods:d}=de(t,l);return(0,a.bv)((async()=>{const{Control:n,DomEvent:c}=s?Qt.L:await o.e(633).then(o.bind(o,6633)),p=n.extend({onAdd(){return r.value}});l.value=new p(u),Kt(d,l.value,t),i({leafletObject:l.value}),t.disableClickPropagation&&c.disableClickPropagation(r.value),t.disableScrollPropagation&&c.disableScrollPropagation(r.value),(0,a.Y3)((()=>e.emit("ready",l.value)))})),{root:r,leafletObject:l}},render(){return ce(this.$slots)},__file:"src/components/LControl.vue"};const me={...ue,collapsed:{type:Boolean,default:!0},autoZIndex:{type:Boolean,default:!0},hideSingleBase:{type:Boolean,default:!1},sortLayers:{type:Boolean,default:!1},sortFunction:{type:Function,default:void 0}},we=(t,e)=>{const{options:o}=de(t,e),a={...o,collapsed:t.collapsed,autoZIndex:t.autoZIndex,hideSingleBase:t.hideSingleBase,sortLayers:t.sortLayers,sortFunction:t.sortFunction},n={addLayer(t){"base"===t.layerType?e.value.addBaseLayer(t.leafletObject,t.name):"overlay"===t.layerType&&e.value.addOverlay(t.leafletObject,t.name)},removeLayer(t){e.value.removeLayer(t.leafletObject)}};return{options:a,methods:n}};var ge={name:"LControlLayers",props:me,setup(t,e){const l=(0,n.iH)({}),r=(0,a.f3)(te),s=(0,a.f3)("registerLayerControl"),{options:i,methods:u}=we(t,l);return(0,a.bv)((async()=>{const{control:n}=r?Qt.L:await o.e(633).then(o.bind(o,6633));l.value=n.layers(null,null,i),Kt(u,l.value,t),s({...t,...u,leafletObject:l.value}),(0,a.Y3)((()=>e.emit("ready",l.value)))})),{leafletObject:l.value}},render(){return null},__file:"src/components/LControlLayers.vue"};Boolean,Boolean,Boolean;const fe={...ae},ke=(t,e,o)=>{const{options:n,methods:l}=ne(t,e,o),r={...n},s={...l,addLayer(t){e.value.addLayer(t.leafletObject)},removeLayer(t){e.value.removeLayer(t.leafletObject)}};return(0,a.JJ)("addLayer",s.addLayer),(0,a.JJ)("removeLayer",s.removeLayer),{options:r,methods:s}};const ye={...fe,geojson:{type:[Object,Array],default:()=>({})}},ve=(t,e)=>{const{options:o,methods:a}=ke(t,e),n={...o,...t},l={...a,setGeojson(t){e.value.clearLayers(),e.value.addData(t)},getGeoJSONData(){return e.value.toGeoJSON()},getBounds(){return e.value.getBounds()}};return{options:n,methods:l}};var he={props:ye,setup(t,e){const l=(0,n.iH)({}),r=(0,n.iH)(!1),s=(0,a.f3)(te),i=(0,a.f3)("addLayer"),{methods:u,options:d}=ve(t,l);return(0,a.bv)((async()=>{const{geoJSON:n,DomEvent:c}=s?Qt.L:await o.e(633).then(o.bind(o,6633));l.value=n(t.geojson,d);const p=Vt(e.attrs);c.on(l.value,p),Kt(u,l.value,t),i({...t,...u,leafletObject:l.value}),r.value=!0,(0,a.Y3)((()=>e.emit("ready",l.value)))})),{ready:r,leafletObject:l}},render(){return le(this.ready,this.$slots)},__file:"src/components/LGeoJson.vue"};const Se={...ae,pane:{type:String,default:"tilePane"},opacity:{type:Number,custom:!1,default:1},zIndex:{type:Number,default:1},tileSize:{type:Number,default:256},noWrap:{type:Boolean,default:!1},minZoom:{type:Number,default:0},maxZoom:{type:Number,default:void 0}},_e=(t,e,o)=>{const{options:a,methods:n}=ne(t,e,o),l={...a,pane:t.pane,opacity:t.opacity,zIndex:t.zIndex,tileSize:t.tileSize,noWrap:t.noWrap,minZoom:t.minZoom,maxZoom:t.maxZoom};return{options:l,methods:{...n}}};const Ue={iconUrl:{type:String,custom:!0,default:null},iconRetinaUrl:{type:String,custom:!0,default:null},iconSize:{type:[Object,Array],custom:!0,default:null},iconAnchor:{type:[Object,Array],custom:!0,default:null},popupAnchor:{type:[Object,Array],custom:!0,default:()=>[0,0]},tooltipAnchor:{type:[Object,Array],custom:!0,default:()=>[0,0]},shadowUrl:{type:String,custom:!0,default:null},shadowRetinaUrl:{type:String,custom:!0,default:null},shadowSize:{type:[Object,Array],custom:!0,default:null},shadowAnchor:{type:[Object,Array],custom:!0,default:null},bgPos:{type:[Object,Array],custom:!0,default:()=>[0,0]},className:{type:String,custom:!0,default:""},options:{type:Object,custom:!0,default:()=>({})}};var be={name:"LIcon",props:{...Ue,...ee},setup(t,e){const l=(0,n.iH)(null),r=(0,a.f3)(te),s=(0,a.f3)("canSetParentHtml"),i=(0,a.f3)("setParentHtml"),u=(0,a.f3)("setIcon");let d,c,p,m,w;const g=(o,a,n)=>{const l=o&&o.innerHTML;if(!a)return void(n&&w&&s()&&i(l));const r=Vt(e.attrs);w&&c(w,r);const{options:g}=oe(t),f={...g,iconUrl:t.iconUrl,iconRetinaUrl:t.iconRetinaUrl,iconSize:t.iconSize,iconAnchor:t.iconAnchor,popupAnchor:t.popupAnchor,tooltipAnchor:t.tooltipAnchor,shadowUrl:t.shadowUrl,shadowRetinaUrl:t.shadowRetinaUrl,shadowSize:t.shadowSize,shadowAnchor:t.shadowAnchor,bgPos:t.bgPos,className:t.className,html:l||t.html};w=f.html?p(f):m(f),d(w,r),u(w)},f=()=>{(0,a.Y3)((()=>g(l.value,!0,!1)))},k=()=>{(0,a.Y3)((()=>g(l.value,!1,!0)))},y={setIconUrl:f,setIconRetinaUrl:f,setIconSize:f,setIconAnchor:f,setPopupAnchor:f,setTooltipAnchor:f,setShadowUrl:f,setShadowRetinaUrl:f,setShadowAnchor:f,setBgPos:f,setClassName:f,setHtml:f};return(0,a.bv)((async()=>{const{DomEvent:e,divIcon:a,icon:n}=r?Qt.L:await o.e(633).then(o.bind(o,6633));d=e.on,c=e.off,p=a,m=n,Kt(y,{},t);const s=new MutationObserver(k);s.observe(l.value,{attributes:!0,childList:!0,characterData:!0,subtree:!0}),f()})),{root:l}},render(){const t=this.$slots.default?this.$slots.default():void 0;return(0,a.h)("div",{ref:"root"},t)},__file:"src/components/LIcon.vue"};Boolean,Boolean;var Te={props:fe,setup(t,e){const l=(0,n.iH)({}),r=(0,n.iH)(!1),s=(0,a.f3)(te),i=(0,a.f3)("addLayer"),{methods:u}=ke(t,l,e);return(0,a.bv)((async()=>{const{layerGroup:n,DomEvent:d}=s?Qt.L:await o.e(633).then(o.bind(o,6633));l.value=n(t.options);const c=Vt(e.attrs);d.on(l.value,c),Kt(u,l.value,t),i({...t,...u,leafletObject:l.value}),r.value=!0,(0,a.Y3)((()=>e.emit("ready",l.value)))})),{ready:r,leafletObject:l}},render(){return le(this.ready,this.$slots)},__file:"src/components/LLayerGroup.vue"},Ee={emits:["ready","update:zoom","update:center","update:bounds"],props:{...ee,center:{type:[Object,Array],default:()=>[0,0]},bounds:{type:[Array,Object],default:void 0},maxBounds:{type:[Array,Object],default:void 0},zoom:{type:Number,default:0},minZoom:{type:Number,default:void 0},maxZoom:{type:Number,default:void 0},paddingBottomRight:{type:Array,default:void 0},paddingTopLeft:{type:Array,default:void 0},padding:{type:Array,default:void 0},worldCopyJump:{type:Boolean,default:!1},crs:{type:[String,Object],default:"EPSG3857"},maxBoundsViscosity:{type:Number,default:void 0},inertia:{type:Boolean,default:void 0},inertiaDeceleration:{type:Number,default:void 0},inertiaMaxSpeed:{type:Number,default:void 0},easeLinearity:{type:Number,default:void 0},zoomAnimation:{type:Boolean,default:void 0},zoomAnimationThreshold:{type:Number,default:void 0},fadeAnimation:{type:Boolean,default:void 0},markerZoomAnimation:{type:Boolean,default:void 0},noBlockingAnimations:{type:Boolean,default:!1},useGlobalLeaflet:{type:Boolean,default:!1}},setup(t,e){const l=(0,n.iH)(null),r=(0,n.qj)({ready:!1,leafletRef:{},layersToAdd:[],layersInControl:[]}),{options:s}=oe(t),i={...s,minZoom:t.minZoom,maxZoom:t.maxZoom,maxBounds:t.maxBounds,maxBoundsViscosity:t.maxBoundsViscosity,worldCopyJump:t.worldCopyJump,crs:t.crs,center:t.center,zoom:t.zoom,inertia:t.inertia,inertiaDeceleration:t.inertiaDeceleration,inertiaMaxSpeed:t.inertiaMaxSpeed,easeLinearity:t.easeLinearity,zoomAnimation:t.zoomAnimation,zoomAnimationThreshold:t.zoomAnimationThreshold,fadeAnimation:t.fadeAnimation,markerZoomAnimation:t.markerZoomAnimation},u=Jt("addLayer"),d=Jt("removeLayer"),c=Jt("registerControl"),p=Jt("registerLayerControl");(0,a.JJ)(te,t.useGlobalLeaflet);const m={moveEndHandler(){e.emit("update:zoom",r.leafletRef.getZoom()),e.emit("update:center",r.leafletRef.getCenter()),e.emit("update:bounds",r.leafletRef.getBounds())},overlayAddHandler(t){const e=r.layersInControl.find((e=>e.name===t.name));e&&e.updateVisibleProp(!0)},overlayRemoveHandler(t){const e=r.layersInControl.find((e=>e.name===t.name));e&&e.updateVisibleProp(!1)}};(0,a.bv)((async()=>{t.useGlobalLeaflet&&(Qt.L=Qt.L||await o.e(243).then(o.t.bind(o,5243,23)));const{map:n,CRS:s,Icon:w,latLngBounds:g,latLng:f,DomEvent:k}=t.useGlobalLeaflet?Qt.L:await o.e(633).then(o.bind(o,6633));try{i.beforeMapMount&&await i.beforeMapMount()}catch(S){console.error(`The following error occurred running the provided beforeMapMount hook ${S.message}`)}await Yt(w);const y="string"==typeof i.crs?s[i.crs]:i.crs;i.crs=y||s.EPSG3857;const v={addLayer(t){if(void 0!==t.layerType)if(void 0===r.layerControl)r.layersToAdd.push(t);else{const e=r.layersInControl.find((e=>e.leafletObject._leaflet_id===t.leafletObject._leaflet_id));e||(r.layerControl.addLayer(t),r.layersInControl.push(t))}!1!==t.visible&&r.leafletRef.addLayer(t.leafletObject)},removeLayer(t){void 0!==t.layerType&&(void 0===r.layerControl?r.layersToAdd=r.layersToAdd.filter((e=>e.name!==t.name)):(r.layerControl.removeLayer(t.leafletObject),r.layersInControl=r.layersInControl.filter((e=>e.leafletObject._leaflet_id!==t.leafletObject._leaflet_id)))),r.leafletRef.removeLayer(t.leafletObject)},registerLayerControl(t){r.layerControl=t,r.layersToAdd.forEach((t=>{r.layerControl.addLayer(t)})),r.layersToAdd=[],c(t)},registerControl(t){r.leafletRef.addControl(t.leafletObject)},setZoom(e){const o=r.leafletRef.getZoom();e!==o&&r.leafletRef.setZoom(e,{animate:!t.noBlockingAnimations&&null})},setPaddingBottomRight(t){r.paddingBottomRight=t},setPaddingTopLeft(t){r.paddingTopLeft=t},setPadding(t){r.padding=t},setCrs(t){const e=r.leafletRef.getBounds();r.leafletRef.options.crs=t,r.leafletRef.fitBounds(e,{animate:!1,padding:[0,0]})},fitBounds(t){r.leafletRef.fitBounds(t,{animate:!this.noBlockingAnimations&&null})},setBounds(t){if(!t)return;const e=g(t);if(!e.isValid())return;const o=r.lastSetBounds||r.leafletRef.getBounds(),a=!o.equals(e,0);a&&(r.lastSetBounds=e,r.leafletRef.fitBounds(e,this.fitBoundsOptions))},setCenter(t){if(null==t)return;const e=f(t),o=r.lastSetCenter||r.leafletRef.getCenter();o.lat===e.lat&&o.lng===e.lng||(r.lastSetCenter=e,r.leafletRef.panTo(e,{animate:!this.noBlockingAnimations&&null}))}};Xt(u,v.addLayer),Xt(d,v.removeLayer),Xt(c,v.registerControl),Xt(p,v.registerLayerControl),r.leafletRef=n(l.value,i),Kt(v,r.leafletRef,t);const h=Vt(e.attrs);r.leafletRef.on("moveend",qt(m.moveEndHandler,100)),r.leafletRef.on("overlayadd",m.overlayAddHandler),r.leafletRef.on("overlayremove",m.overlayRemoveHandler),k.on(r.leafletRef,h),r.ready=!0,(0,a.Y3)((()=>e.emit("ready",r.leafletRef)))})),(0,a.Jd)((()=>{r.leafletRef&&r.leafletRef.remove()}));const w=(0,a.Fl)((()=>r.leafletRef)),g=(0,a.Fl)((()=>r.ready));return{root:l,ready:g,leafletObject:w}},render(){return(0,a.h)("div",{style:{width:"100%",height:"100%"},ref:"root"},this.ready?this.$slots.default():{})},__file:"src/components/LMap.vue"};const De={...ae,pane:{type:String,default:"markerPane"},draggable:{type:Boolean,custom:!0,default:!1},latLng:{type:[Object,Array],custom:!0,default:null},icon:{type:[Object],default:()=>{},custom:!1},zIndexOffset:{type:Number,custom:!1,default:null}},Oe=(t,e,o)=>{const{options:a,methods:n}=ne(t,e,o),l={...a,...t},r={...n,setDraggable(t){e.value.dragging&&(t?e.value.dragging.enable():e.value.dragging.disable())},latLngSync(t){o.emit("update:latLng",t.latlng),o.emit("update:lat-lng",t.latlng)},setLatLng(t){if(null!=t&&e.value){const o=e.value.getLatLng();o&&o.equals(t)||e.value.setLatLng(t)}}};return{options:l,methods:r}};var Ae={name:"LMarker",props:De,setup(t,e){const l=(0,n.iH)({}),r=(0,n.iH)(!1),s=(0,a.f3)(te),i=(0,a.f3)("addLayer");(0,a.JJ)("canSetParentHtml",(()=>!!l.value.getElement())),(0,a.JJ)("setParentHtml",(t=>l.value.getElement().innerHTML=t)),(0,a.JJ)("setIcon",(t=>l.value.setIcon&&l.value.setIcon(t)));const{options:u,methods:d}=Oe(t,l,e);return void 0===u.icon&&delete u.icon,(0,a.bv)((async()=>{const{marker:n,DomEvent:c}=s?Qt.L:await o.e(633).then(o.bind(o,6633));l.value=n(t.latLng,u);const p=Vt(e.attrs);c.on(l.value,p),l.value.on("move",qt(d.latLngSync,100)),Kt(d,l.value,t),i({...t,...d,leafletObject:l.value}),r.value=!0,(0,a.Y3)((()=>e.emit("ready",l.value)))})),{ready:r,leafletObject:l}},render(){return le(this.ready,this.$slots)},__file:"src/components/LMarker.vue"};const Ie={...se,latLngs:{type:Array,default:()=>[]},smoothFactor:{type:Number,custom:!0,default:1},noClip:{type:Boolean,custom:!0,default:!1}},Ce={...Ie};const Ne={...ee,content:{type:String,default:null}};const Re={...Se,tms:{type:Boolean,default:!1},subdomains:{type:String,default:"abc"},detectRetina:{type:Boolean,default:!1},url:{type:String,default:null}},xe=(t,e)=>{const{options:o,methods:a}=_e(t,e),n={...o,tms:t.tms,subdomains:t.subdomains,detectRetina:t.detectRetina};return{options:n,methods:{...a}}};var $e={props:Re,setup(t,e){const l=(0,n.iH)({}),r=(0,a.f3)(te),s=(0,a.f3)("addLayer"),{options:i,methods:u}=xe(t,l);return(0,a.bv)((async()=>{const{tileLayer:n,DomEvent:d}=r?Qt.L:await o.e(633).then(o.bind(o,6633));l.value=n(t.url,i);const c=Vt(e.attrs);d.on(l.value,c),Kt(u,l.value,t),s({...t,...u,leafletObject:l.value}),(0,a.Y3)((()=>e.emit("ready",l.value)))})),{leafletObject:l}},render(){return null},__file:"src/components/LTileLayer.vue"};Boolean,Boolean;var Le=(0,a.aZ)({props:{markerCoordinates:null,isStart:{type:Boolean}},setup(t){const e=t,{isStart:o,markerCoordinates:l}=(0,n.BK)(e);return(t,e)=>(0,n.SU)(l).latitude?((0,a.wg)(),(0,a.j4)((0,n.SU)(Ae),{key:0,"lat-lng":[(0,n.SU)(l).latitude,(0,n.SU)(l).longitude]},{default:(0,a.w5)((()=>[(0,a.Wm)((0,n.SU)(be),{"icon-url":`/img/workouts/${(0,n.SU)(o)?"start":"finish"}.svg`,iconSize:[15,15]},null,8,["icon-url"])])),_:1},8,["lat-lng"])):(0,a.kq)("",!0)}});const ze=Le;var je=ze,Be=o(8602),Pe=o(9917),We=o(2024);const Fe=t=>((0,a.dD)("data-v-6b490f5d"),t=t(),(0,a.Cn)(),t),Me={id:"workout-map"},He={key:0,class:"leaflet-container"},Ze={key:1},qe=Fe((()=>(0,a._)("i",{class:"fa fa-refresh","aria-hidden":"true"},null,-1))),Ge={key:1,class:"no-map"};var Ke=(0,a.aZ)({props:{workoutData:null,markerCoordinates:{default:()=>({})}},setup(t){const e=t,o=(0,Pe.o)(),{workoutData:l,markerCoordinates:r}=(0,n.BK)(e),i=(0,n.iH)(null),u=(0,a.Fl)((()=>v())),d=(0,a.Fl)((()=>o.getters[Be.SY.GETTERS.APP_CONFIG])),c=(0,a.Fl)((()=>k(u))),p=(0,a.Fl)((()=>e.workoutData&&e.workoutData.gpx?f(e.workoutData.gpx):{})),m=(0,a.Fl)((()=>e.workoutData&&e.workoutData.chartData.length>0?{latitude:e.workoutData.chartData[0].latitude,longitude:e.workoutData.chartData[0].longitude}:{})),w=(0,a.Fl)((()=>e.workoutData&&e.workoutData.chartData.length>0?{latitude:e.workoutData.chartData[e.workoutData.chartData.length-1].latitude,longitude:e.workoutData.chartData[e.workoutData.chartData.length-1].longitude}:{})),g=(0,n.iH)(!1);function f(t){if(!t||""!==t)try{const e=(0,Zt.gpx)((new DOMParser).parseFromString(t,"text/xml"));return{jsonData:e}}catch(e){return console.error("Invalid gpx content"),{}}return{}}function k(t){return[(t.value[0][0]+t.value[1][0])/2,(t.value[0][1]+t.value[1][1])/2]}function y(t){i.value?.leafletObject&&i.value?.leafletObject.fitBounds(t)}function v(){return e.workoutData?[[e.workoutData.workout.bounds[0],e.workoutData.workout.bounds[1]],[e.workoutData.workout.bounds[2],e.workoutData.workout.bounds[3]]]:[]}function h(){i.value?.leafletObject.fitBounds(v())}function S(){g.value=!g.value,g.value||setTimeout((()=>{h()}),100)}return(t,e)=>{const o=(0,a.up)("VFullscreen");return(0,a.wg)(),(0,a.iD)("div",Me,[(0,n.SU)(l).loading?((0,a.wg)(),(0,a.iD)("div",He)):((0,a.wg)(),(0,a.iD)("div",Ze,[(0,n.SU)(l).workout.with_gpx?((0,a.wg)(),(0,a.j4)(o,{key:0,modelValue:g.value,"onUpdate:modelValue":e[1]||(e[1]=t=>g.value=t)},{default:(0,a.w5)((()=>[(0,a._)("div",{class:(0,s.C_)(["leaflet-container",{"fullscreen-map":g.value}])},[(0,n.SU)(p).jsonData&&(0,n.SU)(c)&&2===(0,n.SU)(u).length?((0,a.wg)(),(0,a.j4)((0,n.SU)(Ee),{key:0,zoom:13,maxZoom:19,center:(0,n.SU)(c),bounds:(0,n.SU)(u),ref_key:"workoutMap",ref:i,onReady:e[0]||(e[0]=t=>y((0,n.SU)(u)))},{default:(0,a.w5)((()=>[(0,a.Wm)((0,n.SU)(ge)),(0,a.Wm)((0,n.SU)(pe),{position:"topleft",class:"map-control",onClick:h},{default:(0,a.w5)((()=>[qe])),_:1}),(0,a.Wm)((0,n.SU)(pe),{position:"topleft",class:"map-control",onClick:S},{default:(0,a.w5)((()=>[(0,a._)("i",{class:(0,s.C_)("fa fa-"+(g.value?"compress":"arrows-alt")),"aria-hidden":"true"},null,2)])),_:1}),(0,a.Wm)((0,n.SU)($e),{url:`${(0,n.SU)(We.k)()}workouts/map_tile/{s}/{z}/{x}/{y}.png`,attribution:(0,n.SU)(d).map_attribution,bounds:(0,n.SU)(u)},null,8,["url","attribution","bounds"]),(0,a.Wm)((0,n.SU)(he),{geojson:(0,n.SU)(p).jsonData},null,8,["geojson"]),(0,n.SU)(r).latitude?((0,a.wg)(),(0,a.j4)((0,n.SU)(Ae),{key:0,"lat-lng":[(0,n.SU)(r).latitude,(0,n.SU)(r).longitude]},null,8,["lat-lng"])):(0,a.kq)("",!0),(0,a.Wm)((0,n.SU)(Te),{name:t.$t("workouts.START_AND_FINISH"),"layer-type":"overlay"},{default:(0,a.w5)((()=>[(0,n.SU)(m).latitude?((0,a.wg)(),(0,a.j4)(je,{key:0,markerCoordinates:(0,n.SU)(m),isStart:!0},null,8,["markerCoordinates"])):(0,a.kq)("",!0),(0,n.SU)(w).latitude?((0,a.wg)(),(0,a.j4)(je,{key:1,markerCoordinates:(0,n.SU)(w),isStart:!1},null,8,["markerCoordinates"])):(0,a.kq)("",!0)])),_:1},8,["name"])])),_:1},8,["center","bounds"])):(0,a.kq)("",!0)],2)])),_:1},8,["modelValue"])):((0,a.wg)(),(0,a.iD)("div",Ge,(0,s.zw)(t.$t("workouts.NO_MAP")),1))]))])}}});const Ve=(0,O.Z)(Ke,[["__scopeId","data-v-6b490f5d"]]);var Ye=Ve,Je=o(6558);const Xe={class:"workout-detail"};var Qe=(0,a.aZ)({props:{authUser:null,displaySegment:{type:Boolean},sports:null,workoutData:null,markerCoordinates:{default:()=>({})}},setup(t){const e=t,o=(0,l.yj)(),r=(0,Pe.o)(),{authUser:s,markerCoordinates:i,workoutData:u}=(0,n.BK)(e),d=(0,a.Fl)((()=>e.workoutData.workout));let c=(0,n.iH)(o.params.workoutId?+o.params.segmentId:null);const p=(0,a.Fl)((()=>d.value.segments.length>0&&c.value?d.value.segments[+c.value-1]:null));let m=(0,n.iH)(!1);const w=(0,a.Fl)((()=>e.sports?e.sports.find((t=>t.id===e.workoutData.workout.sport_id)):{})),g=(0,a.Fl)((()=>k(d.value,p.value)));function f(t,e,o){const a=e&&o&&1!==o?`/workouts/${t.id}/segment/${o-1}`:!e&&t.previous_workout?`/workouts/${t.previous_workout}`:null,n=e&&o&&o<t.segments.length?`/workouts/${t.id}/segment/${o+1}`:!e&&t.next_workout?`/workouts/${t.next_workout}`:null;return{previousUrl:a,nextUrl:n}}function k(t,o){const a=f(t,e.displaySegment,c.value?+c.value:null),n=(0,Je.Jo)((0,Je.eB)(e.workoutData.workout.workout_date,e.authUser.timezone));return{ascent:o?o.ascent:t.ascent,aveSpeed:o?o.ave_speed:t.ave_speed,distance:o?o.distance:t.distance,descent:o?o.descent:t.descent,duration:o?o.duration:t.duration,maxAlt:o?o.max_alt:t.max_alt,maxSpeed:o?o.max_speed:t.max_speed,minAlt:o?o.min_alt:t.min_alt,moving:o?o.moving:t.moving,nextUrl:a.nextUrl,pauses:o?o.pauses:t.pauses,previousUrl:a.previousUrl,records:o?[]:t.records,segmentId:o?o.segment_id:null,title:t.title,type:e.displaySegment?"SEGMENT":"WORKOUT",workoutDate:n.workout_date,weatherEnd:o?null:t.weather_end,weatherStart:o?null:t.weather_start,with_gpx:t.with_gpx,workoutId:t.id,workoutTime:n.workout_time}}function y(t){m.value=t}function v(t){r.dispatch(Be.aX.ACTIONS.DELETE_WORKOUT,{workoutId:t})}return(0,a.YP)((()=>o.params.segmentId),(async t=>{t&&(c.value=+t)})),(t,e)=>{const o=(0,a.up)("Modal"),l=(0,a.up)("Card");return(0,a.wg)(),(0,a.iD)("div",Xe,[(0,n.SU)(m)?((0,a.wg)(),(0,a.j4)(o,{key:0,title:t.$t("common.CONFIRMATION"),message:t.$t("workouts.WORKOUT_DELETION_CONFIRMATION"),onConfirmAction:e[0]||(e[0]=t=>v((0,n.SU)(g).workoutId)),onCancelAction:e[1]||(e[1]=t=>y(!1))},null,8,["title","message"])):(0,a.kq)("",!0),(0,a.Wm)(l,null,{title:(0,a.w5)((()=>[(0,a.Wm)(I,{sport:(0,n.SU)(w),workoutObject:(0,n.SU)(g),onDisplayModal:e[2]||(e[2]=t=>y(!0))},null,8,["sport","workoutObject"])])),content:(0,a.w5)((()=>[(0,a.Wm)(Ye,{workoutData:(0,n.SU)(u),markerCoordinates:(0,n.SU)(i)},null,8,["workoutData","markerCoordinates"]),(0,a.Wm)(Ht,{workoutObject:(0,n.SU)(g),useImperialUnits:(0,n.SU)(s).imperial_units},null,8,["workoutObject","useImperialUnits"])])),_:1})])}}});const to=(0,O.Z)(Qe,[["__scopeId","data-v-578bb8ea"]]);var eo=to,oo=o(2820);o(1703);const ao=t=>{const e=document.getElementById(t);if(e){let t=e.querySelector("ul");return t||(t=document.createElement("ul"),e.appendChild(t)),t}throw new Error("No legend container")},no={id:"htmlLegend",afterUpdate(t,e,o){const a=ao(o.containerID);while(a.firstChild)a.firstChild.remove();const n=t.options.plugins?.legend?.labels?.generateLabels?t.options.plugins?.legend?.labels?.generateLabels(t):[];n.forEach((e=>{const o=document.createElement("li");o.onclick=()=>{t.setDatasetVisibility(e.datasetIndex,!t.isDatasetVisible(e.datasetIndex)),t.update()};const n=document.createElement("input");n&&(n.type="checkbox",n.id=e.text,n.checked=!e.hidden);const l=document.createTextNode(e.text),r=document.createElement("span");r&&(r.style.background=String(e.fillStyle),r.style.borderColor=String(e.strokeStyle)),o.appendChild(n),o.appendChild(l),o.appendChild(r),a.appendChild(o)}))}};var lo=o(3649),ro=o(3768);const so=t=>((0,a.dD)("data-v-7b25bb74"),t=t(),(0,a.Cn)(),t),io={id:"workout-chart"},uo={class:"chart-radio"},co=["checked"],po=["checked"],mo=so((()=>(0,a._)("div",{id:"chart-legend"},null,-1))),wo={class:"chart-info"},go={class:"no-data-cleaning"},fo={class:"elevation-start"},ko=["checked"];var yo=(0,a.aZ)({props:{authUser:null,workoutData:null},emits:["getCoordinates"],setup(t,{emit:e}){const o=t,{t:l}=(0,j.QT)();let r=(0,n.iH)(!0),i=(0,n.iH)(!0);const u=(0,a.Fl)((()=>(0,ro.EX)(o.workoutData.chartData,l,o.authUser.imperial_units))),d=h("km"),c=h("m");let p=(0,a.Fl)((()=>({labels:r.value?u.value.distance_labels:u.value.duration_labels,datasets:JSON.parse(JSON.stringify([u.value.datasets.speed,u.value.datasets.elevation]))})));const m=(0,a.Fl)((()=>u.value.coordinates)),w=(0,a.Fl)((()=>({responsive:!0,maintainAspectRatio:!0,animation:!1,layout:{padding:{top:22}},scales:{[r.value?"xDistance":"xDuration"]:{grid:{drawOnChartArea:!1},ticks:{count:10,callback:function(t){return r.value?Number(t).toFixed(2):k(t)}},type:"linear",bounds:"data",title:{display:!0,text:r.value?l("workouts.DISTANCE")+` (${d})`:l("workouts.DURATION")}},ySpeed:{grid:{drawOnChartArea:!1},position:"left",title:{display:!0,text:l("workouts.SPEED")+` (${d}/h)`}},yElevation:{beginAtZero:i.value,grid:{drawOnChartArea:!1},position:"right",title:{display:!0,text:l("workouts.ELEVATION")+` (${c})`}}},elements:{point:{pointStyle:"circle",pointRadius:0}},plugins:{datalabels:{display:!1},tooltip:{interaction:{intersect:!1,mode:"index"},callbacks:{label:function(t){const e=` ${t.dataset.label}: ${t.formattedValue}`;return"yElevation"===t.dataset.yAxisID?e+` ${c}`:e+` ${d}/h`},title:function(t){return t.length>0&&y(m.value[t[0].dataIndex]),0===t.length?"":r.value?`${l("workouts.DISTANCE")}: ${t[0].label} ${d}`:`${l("workouts.DURATION")}: ${k(t[0].label.replace(",",""))}`}}},legend:{display:!1},htmlLegend:{containerID:"chart-legend"}}}))),{lineChartProps:g}=(0,oo.tn)({chartData:p,options:w,plugins:[no]});function f(){r.value=!r.value}function k(t){return new Date(1e3*+t).toISOString().substr(11,8)}function y(t){e("getCoordinates",t)}function v(){y({latitude:null,longitude:null})}function h(t){return o.authUser.imperial_units?lo.Dl[t].defaultTarget:t}return(t,e)=>{const o=(0,a.up)("Card");return(0,a.wg)(),(0,a.iD)("div",io,[(0,a.Wm)(o,null,{title:(0,a.w5)((()=>[(0,a.Uk)((0,s.zw)(t.$t("workouts.ANALYSIS")),1)])),content:(0,a.w5)((()=>[(0,a._)("div",uo,[(0,a._)("label",null,[(0,a._)("input",{type:"radio",name:"distance",checked:(0,n.SU)(r),onClick:f},null,8,co),(0,a.Uk)(" "+(0,s.zw)(t.$t("workouts.DISTANCE")),1)]),(0,a._)("label",null,[(0,a._)("input",{type:"radio",name:"duration",checked:!(0,n.SU)(r),onClick:f},null,8,po),(0,a.Uk)(" "+(0,s.zw)(t.$t("workouts.DURATION")),1)])]),mo,(0,a.Wm)((0,n.SU)(oo.wW),(0,a.dG)((0,n.SU)(g),{class:"line-chart",onMouseleave:v}),null,16),(0,a._)("div",wo,[(0,a._)("div",go,(0,s.zw)(t.$t("workouts.NO_DATA_CLEANING")),1),(0,a._)("div",fo,[(0,a._)("label",null,[(0,a._)("input",{type:"checkbox",checked:(0,n.SU)(i),onClick:e[0]||(e[0]=t=>(0,n.dq)(i)?i.value=!(0,n.SU)(i):i=!(0,n.SU)(i))},null,8,ko),(0,a.Uk)(" "+(0,s.zw)(t.$t("workouts.START_ELEVATION_AT_ZERO")),1)])])])])),_:1})])}}});const vo=(0,O.Z)(yo,[["__scopeId","data-v-7b25bb74"]]);var ho=vo;const So={id:"workout-note"};var _o=(0,a.aZ)({props:{notes:{default:()=>null}},setup(t){const e=t,{notes:o}=(0,n.BK)(e);return(t,e)=>{const l=(0,a.up)("Card");return(0,a.wg)(),(0,a.iD)("div",So,[(0,a.Wm)(l,null,{title:(0,a.w5)((()=>[(0,a.Uk)((0,s.zw)(t.$t("workouts.NOTES")),1)])),content:(0,a.w5)((()=>[(0,a.Uk)((0,s.zw)((0,n.SU)(o)&&""!==(0,n.SU)(o)?(0,n.SU)(o):t.$t("workouts.NO_NOTES")),1)])),_:1})])}}});const Uo=(0,O.Z)(_o,[["__scopeId","data-v-028ad527"]]);var bo=Uo;const To={id:"workout-segments"};var Eo=(0,a.aZ)({props:{segments:null,useImperialUnits:{type:Boolean}},setup(t){const e=t,{segments:o,useImperialUnits:l}=(0,n.BK)(e);return(t,e)=>{const r=(0,a.up)("router-link"),i=(0,a.up)("Distance"),u=(0,a.up)("Card");return(0,a.wg)(),(0,a.iD)("div",To,[(0,a.Wm)(u,null,{title:(0,a.w5)((()=>[(0,a.Uk)((0,s.zw)(t.$t("workouts.SEGMENT",2)),1)])),content:(0,a.w5)((()=>[(0,a._)("ul",null,[((0,a.wg)(!0),(0,a.iD)(a.HY,null,(0,a.Ko)((0,n.SU)(o),((e,o)=>((0,a.wg)(),(0,a.iD)("li",{key:e.segment_id},[(0,a.Wm)(r,{to:{name:"WorkoutSegment",params:{workoutId:e.workout_id,segmentId:o+1}}},{default:(0,a.w5)((()=>[(0,a.Uk)((0,s.zw)(t.$t("workouts.SEGMENT",1))+" "+(0,s.zw)(o+1),1)])),_:2},1032,["to"]),(0,a.Uk)(" ("+(0,s.zw)(t.$t("workouts.DISTANCE"))+": ",1),(0,a.Wm)(i,{distance:e.distance,unitFrom:"km",useImperialUnits:(0,n.SU)(l)},null,8,["distance","useImperialUnits"]),(0,a.Uk)(", "+(0,s.zw)(t.$t("workouts.DURATION"))+": "+(0,s.zw)(e.duration)+") ",1)])))),128))])])),_:1})])}}});const Do=(0,O.Z)(Eo,[["__scopeId","data-v-6b8a27cd"]]);var Oo=Do;const Ao=t=>((0,a.dD)("data-v-85ac744a"),t=t(),(0,a.Cn)(),t),Io={id:"workout",class:"view"},Co={class:"container"},No={key:0,class:"workout-container"},Ro={key:0},xo=Ao((()=>(0,a._)("div",{id:"bottom"},null,-1))),$o={key:1};var Lo=(0,a.aZ)({props:{displaySegment:{type:Boolean}},setup(t){const e=t,o=(0,l.yj)(),s=(0,Pe.o)(),{displaySegment:i}=(0,n.BK)(e),u=(0,a.Fl)((()=>s.getters[Be.aX.GETTERS.WORKOUT_DATA])),d=(0,a.Fl)((()=>s.getters[Be.YN.GETTERS.AUTH_USER_PROFILE])),c=(0,a.Fl)((()=>s.getters[Be.O8.GETTERS.SPORTS]));let p=(0,n.iH)({latitude:null,longitude:null});function m(t){p.value={latitude:t.latitude,longitude:t.longitude}}return(0,a.wF)((()=>{const t={workoutId:o.params.workoutId};e.displaySegment&&(t.segmentId=o.params.segmentId),s.dispatch(Be.aX.ACTIONS.GET_WORKOUT_DATA,t)})),(0,a.Ah)((()=>{s.commit(Be.aX.MUTATIONS.EMPTY_WORKOUT)})),(0,a.YP)((()=>o.params.workoutId),(async t=>{t&&s.dispatch(Be.aX.ACTIONS.GET_WORKOUT_DATA,{workoutId:t})})),(0,a.YP)((()=>o.params.segmentId),(async t=>{if(o.params.workoutId){const e={workoutId:o.params.workoutId};t&&(e.segmentId=t),s.dispatch(Be.aX.ACTIONS.GET_WORKOUT_DATA,e)}})),(t,e)=>((0,a.wg)(),(0,a.iD)("div",Io,[(0,a._)("div",Co,[(0,n.SU)(c).length>0?((0,a.wg)(),(0,a.iD)("div",No,[(0,n.SU)(u).workout.id?((0,a.wg)(),(0,a.iD)("div",Ro,[(0,a.Wm)(eo,{workoutData:(0,n.SU)(u),sports:(0,n.SU)(c),authUser:(0,n.SU)(d),markerCoordinates:(0,n.SU)(p),displaySegment:(0,n.SU)(i)},null,8,["workoutData","sports","authUser","markerCoordinates","displaySegment"]),(0,n.SU)(u).workout.with_gpx&&(0,n.SU)(u).chartData.length>0?((0,a.wg)(),(0,a.j4)(ho,{key:0,workoutData:(0,n.SU)(u),authUser:(0,n.SU)(d),displaySegment:(0,n.SU)(i),onGetCoordinates:m},null,8,["workoutData","authUser","displaySegment"])):(0,a.kq)("",!0),!(0,n.SU)(i)&&(0,n.SU)(u).workout.segments.length>1?((0,a.wg)(),(0,a.j4)(Oo,{key:1,segments:(0,n.SU)(u).workout.segments,useImperialUnits:(0,n.SU)(d).imperial_units},null,8,["segments","useImperialUnits"])):(0,a.kq)("",!0),(0,n.SU)(i)?(0,a.kq)("",!0):((0,a.wg)(),(0,a.j4)(bo,{key:2,notes:(0,n.SU)(u).workout.notes},null,8,["notes"])),xo])):((0,a.wg)(),(0,a.iD)("div",$o,[(0,n.SU)(u).loading?(0,a.kq)("",!0):((0,a.wg)(),(0,a.j4)(r.Z,{key:0,target:"WORKOUT"}))]))])):(0,a.kq)("",!0)])]))}});const zo=(0,O.Z)(Lo,[["__scopeId","data-v-85ac744a"]]);var jo=zo},5298:function(t,e,o){"use strict";o.r(e),o.d(e,{default:function(){return Pt}});var a=o(6252),n=o(2262),l=o(3577),r=o(3324),s=o(2119),i=o(631),u=o(3649);const d=t=>((0,a.dD)("data-v-241c23ba"),t=t(),(0,a.Cn)(),t),c={class:"workouts-filters"},p={class:"box"},m={class:"form"},w={class:"form-items-group"},g={class:"form-item"},f=["value"],k={class:"form-item"},y=["value"],v={class:"form-items-group"},h={class:"form-item"},S=["value"],_=d((()=>(0,a._)("option",{value:""},null,-1))),U=["value"],b={class:"form-items-group"},T={class:"form-item"},E={class:"form-inputs-group"},D=["value"],O=["value"],A={class:"form-items-group"},I={class:"form-item"},C={class:"form-inputs-group"},N=["value"],R=["value"],x={class:"form-items-group"},$={class:"form-item"},L={class:"form-inputs-group"},z=["value"],j=["value"],B={class:"form-items-group"},P={class:"form-item"},W={class:"form-inputs-group"},F=["value"],M=["value"],H={class:"form-button"};var Z=(0,a.aZ)({props:{authUser:null,sports:null},emits:["filter"],setup(t,{emit:e}){const o=t,{t:d}=(0,r.QT)(),Z=(0,s.yj)(),q=(0,s.tv)(),{authUser:G}=(0,n.BK)(o),K=G.value.imperial_units?u.Dl.km.defaultTarget:"km",V=(0,a.Fl)((()=>(0,i.xH)(o.sports,d)));let Y=Object.assign({},Z.query);function J(t){""===t.target.value?delete Y[t.target.name]:Y[t.target.name]=t.target.value}function X(){e("filter"),"page"in Y&&(Y["page"]="1"),q.push({path:"/workouts",query:Y})}function Q(){e("filter"),q.push({path:"/workouts",query:{}})}return(0,a.YP)((()=>Z.query),(t=>{Y=Object.assign({},t)})),(t,e)=>((0,a.wg)(),(0,a.iD)("div",c,[(0,a._)("div",p,[(0,a._)("div",m,[(0,a._)("div",w,[(0,a._)("div",g,[(0,a._)("label",null,(0,l.zw)(t.$t("workouts.FROM"))+": ",1),(0,a._)("input",{name:"from",type:"date",value:t.$route.query.from,onChange:J},null,40,f)]),(0,a._)("div",k,[(0,a._)("label",null,(0,l.zw)(t.$t("workouts.TO"))+": ",1),(0,a._)("input",{name:"to",type:"date",value:t.$route.query.to,onChange:J},null,40,y)])]),(0,a._)("div",v,[(0,a._)("div",h,[(0,a._)("label",null,(0,l.zw)(t.$t("workouts.SPORT",1))+":",1),(0,a._)("select",{name:"sport_id",value:t.$route.query.sport_id,onChange:J},[_,((0,a.wg)(!0),(0,a.iD)(a.HY,null,(0,a.Ko)((0,n.SU)(V).filter((t=>(0,n.SU)(G).sports_list.includes(t.id))),(t=>((0,a.wg)(),(0,a.iD)("option",{value:t.id,key:t.id},(0,l.zw)(t.translatedLabel),9,U)))),128))],40,S)])]),(0,a._)("div",b,[(0,a._)("div",T,[(0,a._)("label",null,(0,l.zw)(t.$t("workouts.DISTANCE"))+" ("+(0,l.zw)((0,n.SU)(K))+"): ",1),(0,a._)("div",E,[(0,a._)("input",{name:"distance_from",type:"number",min:"0",step:"0.1",value:t.$route.query.distance_from,onChange:J},null,40,D),(0,a._)("span",null,(0,l.zw)(t.$t("workouts.TO")),1),(0,a._)("input",{name:"distance_to",type:"number",min:"0",step:"0.1",value:t.$route.query.distance_to,onChange:J},null,40,O)])])]),(0,a._)("div",A,[(0,a._)("div",I,[(0,a._)("label",null,(0,l.zw)(t.$t("workouts.DURATION"))+": ",1),(0,a._)("div",C,[(0,a._)("input",{name:"duration_from",value:t.$route.query.duration_from,onChange:J,pattern:"^([0-9]*[0-9]):([0-5][0-9])$",placeholder:"hh:mm",type:"text"},null,40,N),(0,a._)("span",null,(0,l.zw)(t.$t("workouts.TO")),1),(0,a._)("input",{name:"duration_to",value:t.$route.query.duration_to,onChange:J,pattern:"^([0-9]*[0-9]):([0-5][0-9])$",placeholder:"hh:mm",type:"text"},null,40,R)])])]),(0,a._)("div",x,[(0,a._)("div",$,[(0,a._)("label",null,(0,l.zw)(t.$t("workouts.AVE_SPEED"))+" ("+(0,l.zw)((0,n.SU)(K))+"/h): ",1),(0,a._)("div",L,[(0,a._)("input",{min:"0",name:"ave_speed_from",value:t.$route.query.ave_speed_from,onChange:J,step:"0.1",type:"number"},null,40,z),(0,a._)("span",null,(0,l.zw)(t.$t("workouts.TO")),1),(0,a._)("input",{min:"0",name:"ave_speed_to",value:t.$route.query.ave_speed_to,onChange:J,step:"0.1",type:"number"},null,40,j)])])]),(0,a._)("div",B,[(0,a._)("div",P,[(0,a._)("label",null,(0,l.zw)(t.$t("workouts.MAX_SPEED"))+" ("+(0,l.zw)((0,n.SU)(K))+"/h): ",1),(0,a._)("div",W,[(0,a._)("input",{min:"0",name:"max_speed_from",value:t.$route.query.max_speed_from,onChange:J,step:"0.1",type:"number"},null,40,F),(0,a._)("span",null,(0,l.zw)(t.$t("workouts.TO")),1),(0,a._)("input",{min:"0",name:"max_speed_to",value:t.$route.query.max_speed_to,onChange:J,step:"0.1",type:"number"},null,40,M)])])])]),(0,a._)("div",H,[(0,a._)("button",{class:"confirm",onClick:X},(0,l.zw)(t.$t("buttons.FILTER")),1),(0,a._)("button",{class:"confirm",onClick:Q},(0,l.zw)(t.$t("buttons.CLEAR_FILTER")),1)])])]))}}),q=o(3744);const G=(0,q.Z)(Z,[["__scopeId","data-v-241c23ba"]]);var K=G,V=o(4850),Y=o(8626),J=o(6514),X=o(2056),Q=o(5630),tt=o(8602),et=o(9917),ot=o(2766),at=o(6558),nt=o(3768);const lt=t=>((0,a.dD)("data-v-3be47bc9"),t=t(),(0,a.Cn)(),t),rt={class:"workouts-list"},st={class:"total"},it={class:"total-label"},ut={key:0},dt={key:0,class:"workouts-table responsive-table"},ct=lt((()=>(0,a._)("th",{class:"sport-col"},null,-1))),pt={class:"sport-col"},mt={class:"cell-heading"},wt=["onMouseover"],gt={class:"cell-heading"},ft={key:0,class:"fa fa-map-o","aria-hidden":"true"},kt={class:"cell-heading"},yt={class:"text-right"},vt={class:"cell-heading"},ht={class:"text-right"},St={class:"cell-heading"},_t={class:"text-right"},Ut={class:"cell-heading"},bt={class:"text-right"},Tt={class:"cell-heading"},Et={class:"text-right"},Dt={class:"cell-heading"},Ot={class:"text-right"},At={class:"cell-heading"},It=lt((()=>(0,a._)("div",{id:"bottom"},null,-1)));var Ct=(0,a.aZ)({props:{user:null,sports:null},setup(t){const e=t,o=(0,et.o)(),r=(0,s.yj)(),d=(0,s.tv)(),{user:c,sports:p}=(0,n.BK)(e),m=["ave_speed","distance","duration","workout_date"],w=(0,a.Fl)((()=>o.getters[tt.aX.GETTERS.USER_WORKOUTS])),g=(0,a.Fl)((()=>o.getters[tt.aX.GETTERS.WORKOUTS_PAGINATION]));let f=h(r.query);const k=(0,n.iH)(null);function y(t){o.dispatch(tt.aX.ACTIONS.GET_USER_WORKOUTS,c.value.imperial_units?S(t):t)}function v(t,e){const o=Object.assign({},r.query);o[t]=e,"per_page"===t&&(o["page"]="1"),f=h(o),d.push({path:"/workouts",query:f})}function h(t){let e=(0,ot.pm)(t,m,nt.eR.order_by,{defaultSort:nt.eR.order});return Object.keys(t).filter((t=>ot.Ne.includes(t))).map((o=>{"string"===typeof t[o]&&(e[o]=t[o])})),e}function S(t){const e={...t};return Object.entries(e).map((t=>{t[0].match("speed|distance")&&(e[t[0]]=(0,u.sC)(+t[1],"mi","km"))})),e}function _(t){k.value=t}return(0,a.wF)((()=>{y(f)})),(0,a.YP)((()=>r.query),(async t=>{f=h(t),y(f)})),(t,e)=>{const o=(0,a.up)("SportImage"),r=(0,a.up)("router-link"),s=(0,a.up)("Distance");return(0,a.wg)(),(0,a.iD)("div",rt,[(0,a._)("div",{class:(0,l.C_)(["box",{"empty-table":0===(0,n.SU)(w).length}])},[(0,a._)("div",st,[(0,a._)("span",it,(0,l.zw)(t.$t("common.TOTAL").toLowerCase())+": ",1),null!==(0,n.SU)(g).total?((0,a.wg)(),(0,a.iD)("span",ut,(0,l.zw)((0,n.SU)(g).total)+" "+(0,l.zw)(t.$t("workouts.WORKOUT",(0,n.SU)(g).total)),1)):(0,a.kq)("",!0)]),(0,a.Wm)(Y.Z,{sort:(0,n.SU)(ot.fS),order_by:m,query:(0,n.SU)(f),message:"workouts",onUpdateSelect:v},null,8,["sort","query"]),(0,n.SU)(w).length>0?((0,a.wg)(),(0,a.iD)("div",dt,[(0,a.Wm)(J.Z,{class:"top-pagination",pagination:(0,n.SU)(g),path:"/workouts",query:(0,n.SU)(f)},null,8,["pagination","query"]),(0,a._)("table",null,[(0,a._)("thead",null,[(0,a._)("tr",null,[ct,(0,a._)("th",null,(0,l.zw)((0,l.kC)(t.$t("workouts.WORKOUT",1))),1),(0,a._)("th",null,(0,l.zw)((0,l.kC)(t.$t("workouts.DATE"))),1),(0,a._)("th",null,(0,l.zw)((0,l.kC)(t.$t("workouts.DISTANCE"))),1),(0,a._)("th",null,(0,l.zw)((0,l.kC)(t.$t("workouts.DURATION"))),1),(0,a._)("th",null,(0,l.zw)((0,l.kC)(t.$t("workouts.AVE_SPEED"))),1),(0,a._)("th",null,(0,l.zw)((0,l.kC)(t.$t("workouts.MAX_SPEED"))),1),(0,a._)("th",null,(0,l.zw)((0,l.kC)(t.$t("workouts.ASCENT"))),1),(0,a._)("th",null,(0,l.zw)((0,l.kC)(t.$t("workouts.DESCENT"))),1)])]),(0,a._)("tbody",null,[((0,a.wg)(!0),(0,a.iD)(a.HY,null,(0,a.Ko)((0,n.SU)(w),(u=>((0,a.wg)(),(0,a.iD)("tr",{key:u.id},[(0,a._)("td",pt,[(0,a._)("span",mt,(0,l.zw)(t.$t("workouts.SPORT",1)),1),(0,n.SU)(p).length>0?((0,a.wg)(),(0,a.j4)(o,{key:0,title:(0,n.SU)(p).find((t=>t.id===u.sport_id)).translatedLabel,"sport-label":(0,n.SU)(i.PA)(u,(0,n.SU)(p)),color:(0,n.SU)(i.CM)(u,(0,n.SU)(p))},null,8,["title","sport-label","color"])):(0,a.kq)("",!0)]),(0,a._)("td",{class:"workout-title",onMouseover:t=>_(u.id),onMouseleave:e[0]||(e[0]=t=>_(null))},[(0,a._)("span",gt,(0,l.zw)((0,l.kC)(t.$t("workouts.WORKOUT",1))),1),(0,a.Wm)(r,{class:"nav-item",to:{name:"Workout",params:{workoutId:u.id}}},{default:(0,a.w5)((()=>[u.with_gpx?((0,a.wg)(),(0,a.iD)("i",ft)):(0,a.kq)("",!0),(0,a.Uk)(" "+(0,l.zw)(u.title),1)])),_:2},1032,["to"]),u.with_gpx&&k.value===u.id?((0,a.wg)(),(0,a.j4)(X.Z,{key:0,workout:u,"display-hover":!0},null,8,["workout"])):(0,a.kq)("",!0)],40,wt),(0,a._)("td",null,[(0,a._)("span",kt,(0,l.zw)(t.$t("workouts.DATE")),1),(0,a.Uk)(" "+(0,l.zw)((0,n.SU)(V.Z)((0,n.SU)(at.eB)(u.workout_date,(0,n.SU)(c).timezone),"dd/MM/yyyy HH:mm")),1)]),(0,a._)("td",yt,[(0,a._)("span",vt,(0,l.zw)(t.$t("workouts.DISTANCE")),1),(0,a.Wm)(s,{distance:u.distance,unitFrom:"km",useImperialUnits:(0,n.SU)(c).imperial_units},null,8,["distance","useImperialUnits"])]),(0,a._)("td",ht,[(0,a._)("span",St,(0,l.zw)(t.$t("workouts.DURATION")),1),(0,a.Uk)(" "+(0,l.zw)(u.moving),1)]),(0,a._)("td",_t,[(0,a._)("span",Ut,(0,l.zw)(t.$t("workouts.AVE_SPEED")),1),(0,a.Wm)(s,{distance:u.ave_speed,unitFrom:"km",speed:!0,useImperialUnits:(0,n.SU)(c).imperial_units},null,8,["distance","useImperialUnits"])]),(0,a._)("td",bt,[(0,a._)("span",Tt,(0,l.zw)(t.$t("workouts.MAX_SPEED")),1),(0,a.Wm)(s,{distance:u.max_speed,unitFrom:"km",speed:!0,useImperialUnits:(0,n.SU)(c).imperial_units},null,8,["distance","useImperialUnits"])]),(0,a._)("td",Et,[(0,a._)("span",Dt,(0,l.zw)(t.$t("workouts.ASCENT")),1),u.with_gpx?((0,a.wg)(),(0,a.j4)(s,{key:0,distance:u.ascent,unitFrom:"m",useImperialUnits:(0,n.SU)(c).imperial_units},null,8,["distance","useImperialUnits"])):(0,a.kq)("",!0)]),(0,a._)("td",Ot,[(0,a._)("span",At,(0,l.zw)(t.$t("workouts.DESCENT")),1),u.with_gpx?((0,a.wg)(),(0,a.j4)(s,{key:0,distance:u.descent,unitFrom:"m",useImperialUnits:(0,n.SU)(c).imperial_units},null,8,["distance","useImperialUnits"])):(0,a.kq)("",!0)])])))),128))])]),(0,a.Wm)(J.Z,{pagination:(0,n.SU)(g),path:"/workouts",query:(0,n.SU)(f)},null,8,["pagination","query"])])):(0,a.kq)("",!0)],2),0===(0,n.SU)(w).length?((0,a.wg)(),(0,a.j4)(Q.Z,{key:0})):(0,a.kq)("",!0),It])}}});const Nt=(0,q.Z)(Ct,[["__scopeId","data-v-3be47bc9"]]);var Rt=Nt;const xt={key:0,id:"workouts",class:"view"},$t={class:"container workouts-container"},Lt={class:"display-filters"},zt={class:"list-container"};var jt=(0,a.aZ)({setup(t){const{t:e}=(0,r.QT)(),o=(0,et.o)(),s=(0,a.Fl)((()=>o.getters[tt.YN.GETTERS.AUTH_USER_PROFILE])),u=(0,a.Fl)((()=>o.getters[tt.O8.GETTERS.SPORTS])),d=(0,a.Fl)((()=>(0,i.xH)(u.value,e))),c=(0,n.iH)(!0);function p(){c.value=!c.value}return(t,e)=>(0,n.SU)(s).username?((0,a.wg)(),(0,a.iD)("div",xt,[(0,a._)("div",$t,[(0,a._)("div",{class:(0,l.C_)(["filters-container",{hidden:c.value}])},[(0,a.Wm)(K,{sports:(0,n.SU)(d),authUser:(0,n.SU)(s),onFilter:p},null,8,["sports","authUser"])],2),(0,a._)("div",Lt,[(0,a._)("div",{onClick:p},[(0,a._)("i",{class:(0,l.C_)("fa fa-caret-"+(c.value?"down":"up")),"aria-hidden":"true"},null,2),(0,a._)("span",null,(0,l.zw)(t.$t(`workouts.${c.value?"DISPLAY":"HIDE"}_FILTERS`)),1)])]),(0,a._)("div",zt,[(0,a.Wm)(Rt,{user:(0,n.SU)(s),sports:(0,n.SU)(d)},null,8,["user","sports"])])])])):(0,a.kq)("",!0)}});const Bt=(0,q.Z)(jt,[["__scopeId","data-v-77e54012"]]);var Pt=Bt}}]);
//# sourceMappingURL=workouts.227b20a7.js.map