FitTrackee/fittrackee/dist/static/js/main.0da63bb9.js
2021-11-06 21:27:32 +01:00

2 lines
63 KiB
JavaScript

(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["main"],{"00b4":function(e,t,r){"use strict";r("ac1f");var a=r("23e7"),o=r("da84"),n=r("c65b"),c=r("e330"),s=r("1626"),l=r("861d"),u=function(){var e=!1,t=/[ac]/;return t.exec=function(){return e=!0,/./.exec.apply(this,arguments)},!0===t.test("abc")&&e}(),i=o.Error,d=c(/./.test);a({target:"RegExp",proto:!0,forced:!u},{test:function(e){var t=this.exec;if(!s(t))return d(this,e);var r=n(t,this,e);if(null!==r&&!l(r))throw new i("RegExp exec method returned something other than an Object or null");return!!r}})},"0395":function(e,t,r){"use strict";r("caad");var a=r("7a23"),o={id:"user-auth-form"},n={id:"user-form"},c={class:"form-items"},s=["disabled","placeholder"],l=["disabled","placeholder"],u=["disabled","placeholder"],i=["disabled","placeholder"],d=["disabled"],b={key:1},p=Object(a["createTextVNode"])(" - "),O={key:2},m={class:"account"};function j(e,t,r,j,f,k){var v=Object(a["resolveComponent"])("AlertMessage"),y=Object(a["resolveComponent"])("router-link"),h=Object(a["resolveComponent"])("ErrorMessage");return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",o,[Object(a["createElementVNode"])("div",n,[Object(a["createElementVNode"])("div",{class:Object(a["normalizeClass"])(["form-box",{disabled:e.registration_disabled}])},[e.registration_disabled?(Object(a["openBlock"])(),Object(a["createBlock"])(v,{key:0,message:"user.REGISTER_DISABLED"})):Object(a["createCommentVNode"])("",!0),Object(a["createElementVNode"])("form",{onSubmit:t[4]||(t[4]=Object(a["withModifiers"])((function(t){return e.onSubmit(e.action)}),["prevent"]))},[Object(a["createElementVNode"])("div",c,["register"===e.action?Object(a["withDirectives"])((Object(a["openBlock"])(),Object(a["createElementBlock"])("input",{key:0,id:"username",disabled:e.registration_disabled,required:"","onUpdate:modelValue":t[0]||(t[0]=function(t){return e.formData.username=t}),placeholder:e.$t("user.USERNAME")},null,8,s)),[[a["vModelText"],e.formData.username]]):Object(a["createCommentVNode"])("",!0),"reset"!==e.action?Object(a["withDirectives"])((Object(a["openBlock"])(),Object(a["createElementBlock"])("input",{key:1,id:"email",disabled:e.registration_disabled,required:"",type:"email","onUpdate:modelValue":t[1]||(t[1]=function(t){return e.formData.email=t}),placeholder:"reset-request"===e.action?e.$t("user.ENTER_EMAIL"):e.$t("user.EMAIL")},null,8,l)),[[a["vModelText"],e.formData.email]]):Object(a["createCommentVNode"])("",!0),"reset-request"!==e.action?Object(a["withDirectives"])((Object(a["openBlock"])(),Object(a["createElementBlock"])("input",{key:2,id:"password",disabled:e.registration_disabled,required:"",type:"password","onUpdate:modelValue":t[2]||(t[2]=function(t){return e.formData.password=t}),placeholder:"reset"===e.action?e.$t("user.ENTER_PASSWORD"):e.$t("user.PASSWORD")},null,8,u)),[[a["vModelText"],e.formData.password]]):Object(a["createCommentVNode"])("",!0),["register","reset"].includes(e.action)?Object(a["withDirectives"])((Object(a["openBlock"])(),Object(a["createElementBlock"])("input",{key:3,id:"confirm-password",disabled:e.registration_disabled,type:"password",required:"","onUpdate:modelValue":t[3]||(t[3]=function(t){return e.formData.password_conf=t}),placeholder:"reset"===e.action?e.$t("user.ENTER_PASSWORD_CONFIRMATION"):e.$t("user.PASSWORD_CONFIRM")},null,8,i)),[[a["vModelText"],e.formData.password_conf]]):Object(a["createCommentVNode"])("",!0)]),Object(a["createElementVNode"])("button",{type:"submit",disabled:e.registration_disabled},Object(a["toDisplayString"])(e.$t(e.buttonText)),9,d)],32),"login"===e.action?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",b,[Object(a["createVNode"])(y,{class:"links",to:"/register"},{default:Object(a["withCtx"])((function(){return[Object(a["createTextVNode"])(Object(a["toDisplayString"])(e.$t("user.REGISTER")),1)]})),_:1}),p,Object(a["createVNode"])(y,{class:"links",to:"/password-reset/request"},{default:Object(a["withCtx"])((function(){return[Object(a["createTextVNode"])(Object(a["toDisplayString"])(e.$t("user.PASSWORD_FORGOTTEN")),1)]})),_:1})])):(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",O,[Object(a["createElementVNode"])("span",m,Object(a["toDisplayString"])(e.$t("user.ALREADY_HAVE_ACCOUNT")),1),Object(a["createVNode"])(y,{class:"links",to:"/login"},{default:Object(a["withCtx"])((function(){return[Object(a["createTextVNode"])(Object(a["toDisplayString"])(e.$t("user.LOGIN")),1)]})),_:1})])),e.errorMessages?(Object(a["openBlock"])(),Object(a["createBlock"])(h,{key:3,message:e.errorMessages},null,8,["message"])):Object(a["createCommentVNode"])("",!0)],2)])])}var f=r("1da1"),k=(r("96cf"),r("6c02")),v=r("dad5"),y=r("2906"),h=Object(a["defineComponent"])({name:"UserAuthForm",props:{action:{type:String,required:!0},token:{type:String,default:""}},setup:function(e){var t=Object(a["reactive"])({username:"",email:"",password:"",password_conf:""}),r=Object(k["c"])(),o=Object(y["a"])(),n=Object(a["computed"])((function(){return u(e.action)})),c=Object(a["computed"])((function(){return o.getters[v["b"].GETTERS.ERROR_MESSAGES]})),s=Object(a["computed"])((function(){return o.getters[v["b"].GETTERS.APP_CONFIG]})),l=Object(a["computed"])((function(){return"register"===e.action&&!s.value.is_registration_enabled}));function u(t){switch(t){case"reset-request":case"reset":return"buttons.SUBMIT";default:return"buttons.".concat(e.action.toUpperCase())}}function i(a){switch(a){case"reset":return e.token?o.dispatch(v["a"].ACTIONS.RESET_USER_PASSWORD,{password:t.password,password_conf:t.password_conf,token:e.token}):o.commit(v["b"].MUTATIONS.SET_ERROR_MESSAGES,"user.INVALID_TOKEN");case"reset-request":return o.dispatch(v["a"].ACTIONS.SEND_PASSWORD_RESET_REQUEST,{email:t.email});default:o.dispatch(v["a"].ACTIONS.LOGIN_OR_REGISTER,{actionType:a,formData:t,redirectUrl:r.query.from})}}function d(){t.username="",t.email="",t.password="",t.password_conf=""}return Object(a["watch"])((function(){return r.path}),Object(f["a"])(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:o.commit(v["b"].MUTATIONS.EMPTY_ERROR_MESSAGES),d();case 2:case"end":return e.stop()}}),e)})))),{appConfig:s,buttonText:n,errorMessages:c,formData:t,registration_disabled:l,onSubmit:i}}}),S=(r("f2b0"),r("6b0d")),w=r.n(S);const E=w()(h,[["render",j],["__scopeId","data-v-06a2ad44"]]);t["a"]=E},"0774":function(e,t,r){"use strict";r("283c")},"0ccb":function(e,t,r){var a=r("e330"),o=r("50c4"),n=r("577e"),c=r("1148"),s=r("1d80"),l=a(c),u=a("".slice),i=Math.ceil,d=function(e){return function(t,r,a){var c,d,b=n(s(t)),p=o(r),O=b.length,m=void 0===a?" ":n(a);return p<=O||""==m?b:(c=p-O,d=l(m,i(c/m.length)),d.length>c&&(d=u(d,0,c)),e?b+d:d+b)}};e.exports={start:d(!1),end:d(!0)}},"0fe0":function(e,t,r){"use strict";r("8338")},"121b":function(e,t,r){},"21d8":function(e,t,r){"use strict";r("647c")},"224d":function(e,t,r){"use strict";r("8d2d")},"24cc":function(e,t,r){},"283c":function(e,t,r){},"288e":function(e,t,r){"use strict";r("bbd4")},"2b62":function(e,t,r){"use strict";r("fd0a")},"38f1":function(e,t,r){"use strict";r("92c3")},"3dde":function(e,t,r){},"4d90":function(e,t,r){"use strict";var a=r("23e7"),o=r("0ccb").start,n=r("9a0c");a({target:"String",proto:!0,forced:n},{padStart:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}})},"4fad":function(e,t,r){var a=r("23e7"),o=r("6f53").entries;a({target:"Object",stat:!0},{entries:function(e){return o(e)}})},"51ce":function(e,t,r){"use strict";r("6553")},5782:function(e,t,r){},"57a9":function(e,t,r){"use strict";r("24cc")},"5fcb":function(e,t,r){"use strict";r("f153")},"647c":function(e,t,r){},6553:function(e,t,r){},"6ca7":function(e,t,r){"use strict";r("3dde")},"6f53":function(e,t,r){var a=r("83ab"),o=r("e330"),n=r("df75"),c=r("fc6a"),s=r("d1e7").f,l=o(s),u=o([].push),i=function(e){return function(t){var r,o=c(t),s=n(o),i=s.length,d=0,b=[];while(i>d)r=s[d++],a&&!l(o,r)||u(b,e?[r,o[r]]:o[r]);return b}};e.exports={entries:i(!0),values:i(!1)}},"702c":function(e,t,r){"use strict";r("83b5")},7277:function(e,t,r){"use strict";r.r(t);var a=r("7a23"),o=function(e){return Object(a["pushScopeId"])("data-v-ad6483fc"),e=e(),Object(a["popScopeId"])(),e},n={key:0,id:"dashboard",class:"view"},c={class:"container mobile-menu"},s={class:"box"},l=o((function(){return Object(a["createElementVNode"])("i",{class:"fa fa-bar-chart","aria-hidden":"true"},null,-1)})),u=[l],i=o((function(){return Object(a["createElementVNode"])("i",{class:"fa fa-calendar","aria-hidden":"true"},null,-1)})),d=[i],b=o((function(){return Object(a["createElementVNode"])("i",{class:"fa fa-map-o","aria-hidden":"true"},null,-1)})),p=[b],O=o((function(){return Object(a["createElementVNode"])("i",{class:"fa fa-trophy","aria-hidden":"true"},null,-1)})),m=[O],j={class:"container"},f={class:"container dashboard-container"},k={class:"left-container dashboard-sub-container"},v={class:"right-container dashboard-sub-container"},y=o((function(){return Object(a["createElementVNode"])("div",{id:"bottom"},null,-1)})),h={key:1,class:"app-loading"};function S(e,t,r,o,l,i){var b=Object(a["resolveComponent"])("UserStatsCards"),O=Object(a["resolveComponent"])("UserMonthStats"),S=Object(a["resolveComponent"])("UserRecords"),w=Object(a["resolveComponent"])("UserCalendar"),E=Object(a["resolveComponent"])("Timeline"),C=Object(a["resolveComponent"])("Loader");return e.authUser.username&&e.sports.length>0?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",n,[Object(a["createElementVNode"])("div",c,[Object(a["createElementVNode"])("div",s,[Object(a["createElementVNode"])("div",{class:Object(a["normalizeClass"])(["mobile-menu-item",{"is-selected":"chart"===e.isSelected}]),onClick:t[0]||(t[0]=function(t){return e.updateDisplayColumn("chart")})},u,2),Object(a["createElementVNode"])("div",{class:Object(a["normalizeClass"])(["mobile-menu-item",{"is-selected":"calendar"===e.isSelected}]),onClick:t[1]||(t[1]=function(t){return e.updateDisplayColumn("calendar")})},d,2),Object(a["createElementVNode"])("div",{class:Object(a["normalizeClass"])(["mobile-menu-item",{"is-selected":"timeline"===e.isSelected}]),onClick:t[2]||(t[2]=function(t){return e.updateDisplayColumn("timeline")})},p,2),Object(a["createElementVNode"])("div",{class:Object(a["normalizeClass"])(["mobile-menu-item",{"is-selected":"records"===e.isSelected}]),onClick:t[3]||(t[3]=function(t){return e.updateDisplayColumn("records")})},m,2)])]),Object(a["createElementVNode"])("div",j,[Object(a["createVNode"])(b,{user:e.authUser},null,8,["user"])]),Object(a["createElementVNode"])("div",f,[Object(a["createElementVNode"])("div",k,[Object(a["createVNode"])(O,{sports:e.sports,user:e.authUser,class:Object(a["normalizeClass"])({"is-hidden":!("chart"===e.isSelected)})},null,8,["sports","user","class"]),Object(a["createVNode"])(S,{sports:e.sports,user:e.authUser,class:Object(a["normalizeClass"])({"is-hidden":!("records"===e.isSelected)})},null,8,["sports","user","class"])]),Object(a["createElementVNode"])("div",v,[Object(a["createVNode"])(w,{sports:e.sports,user:e.authUser,class:Object(a["normalizeClass"])({"is-hidden":!("calendar"===e.isSelected)})},null,8,["sports","user","class"]),Object(a["createVNode"])(E,{sports:e.sports,user:e.authUser,class:Object(a["normalizeClass"])({"is-hidden":!("timeline"===e.isSelected)})},null,8,["sports","user","class"])])]),y])):(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",h,[Object(a["createVNode"])(C)]))}function w(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,a=new Array(t);r<t;r++)a[r]=e[r];return a}function E(e){if(Array.isArray(e))return w(e)}r("a4d3"),r("e01a"),r("d3b7"),r("d28b"),r("3ca3"),r("ddb0"),r("a630");function C(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}r("fb6a"),r("b0c0"),r("ac1f"),r("00b4");function g(e,t){if(e){if("string"===typeof e)return w(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?w(e,t):void 0}}function N(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function B(e){return E(e)||C(e)||g(e)||N()}r("4de4");var D={id:"timeline"},V={class:"section-title"},_={key:0},T={key:1},M={key:1,class:"more-workouts"};function I(e,t,r,o,n,c){var s=Object(a["resolveComponent"])("WorkoutCard"),l=Object(a["resolveComponent"])("NoWorkouts");return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",D,[Object(a["createElementVNode"])("div",V,Object(a["toDisplayString"])(e.$t("workouts.LATEST_WORKOUTS")),1),e.user.nb_workouts>0&&0===e.workouts.length?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",_,[(Object(a["openBlock"])(!0),Object(a["createElementBlock"])(a["Fragment"],null,Object(a["renderList"])(B(Array(e.initWorkoutsCount).keys()),(function(t){return Object(a["openBlock"])(),Object(a["createBlock"])(s,{user:e.user,key:t},null,8,["user"])})),128))])):(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",T,[(Object(a["openBlock"])(!0),Object(a["createElementBlock"])(a["Fragment"],null,Object(a["renderList"])(e.workouts,(function(t){return Object(a["openBlock"])(),Object(a["createBlock"])(s,{workout:t,sport:e.workouts.length>0?e.sports.filter((function(e){return e.id===t.sport_id}))[0]:null,user:e.user,key:t.id},null,8,["workout","sport","user"])})),128)),0===e.workouts.length?(Object(a["openBlock"])(),Object(a["createBlock"])(l,{key:0})):Object(a["createCommentVNode"])("",!0),e.moreWorkoutsExist?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",M,[Object(a["createElementVNode"])("button",{onClick:t[0]||(t[0]=function(){return e.loadMoreWorkouts&&e.loadMoreWorkouts.apply(e,arguments)})},Object(a["toDisplayString"])(e.$t("workouts.LOAD_MORE_WORKOUT")),1)])):Object(a["createCommentVNode"])("",!0)]))])}var x=r("5530"),R=function(e){return Object(a["pushScopeId"])("data-v-99d3cd20"),e=e(),Object(a["popScopeId"])(),e},A={class:"timeline-workout"},U={class:"box"},q={class:"workout-user-date"},L={class:"workout-user"},W=["title"],F={key:0},P={key:1,class:"no-map"},$={class:"img"},G={class:"data"},z=R((function(){return Object(a["createElementVNode"])("i",{class:"fa fa-clock-o","aria-hidden":"true"},null,-1)})),H={key:0},Y={class:"data"},K=R((function(){return Object(a["createElementVNode"])("i",{class:"fa fa-road","aria-hidden":"true"},null,-1)})),X={key:0},J={key:0,class:"data elevation"},Z=["alt"],Q={class:"data-values"},ee={key:1,class:"data altitude"},te=R((function(){return Object(a["createElementVNode"])("i",{class:"fa fa-location-arrow","aria-hidden":"true"},null,-1)})),re={class:"data-values"};function ae(e,t,r,o,n,c){var s=Object(a["resolveComponent"])("UserPicture"),l=Object(a["resolveComponent"])("router-link"),u=Object(a["resolveComponent"])("StaticMap"),i=Object(a["resolveComponent"])("SportImage");return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",A,[Object(a["createElementVNode"])("div",U,[Object(a["createElementVNode"])("div",q,[Object(a["createElementVNode"])("div",L,[Object(a["createVNode"])(s,{user:e.user},null,8,["user"]),e.user.username?(Object(a["openBlock"])(),Object(a["createBlock"])(l,{key:0,class:"workout-user-name",to:{name:"User",params:{username:e.user.username}}},{default:Object(a["withCtx"])((function(){return[Object(a["createTextVNode"])(Object(a["toDisplayString"])(e.user.username),1)]})),_:1},8,["to"])):Object(a["createCommentVNode"])("",!0)]),e.workout?(Object(a["openBlock"])(),Object(a["createBlock"])(l,{key:0,class:"workout-title",to:{name:"Workout",params:{workoutId:e.workout.id}}},{default:Object(a["withCtx"])((function(){return[Object(a["createTextVNode"])(Object(a["toDisplayString"])(e.workout.title),1)]})),_:1},8,["to"])):Object(a["createCommentVNode"])("",!0),e.workout&&e.user?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",{key:1,class:"workout-date",title:e.format(e.getDateWithTZ(e.workout.workout_date,e.user.timezone),"dd/MM/yyyy HH:mm")},Object(a["toDisplayString"])(e.formatDistance(new Date(e.workout.workout_date),new Date,{addSuffix:!0,locale:e.locale})),9,W)):Object(a["createCommentVNode"])("",!0)]),Object(a["createElementVNode"])("div",{class:Object(a["normalizeClass"])(["workout-map",{"no-cursor":!e.workout}]),onClick:t[0]||(t[0]=function(t){return e.workout?e.$router.push({name:"Workout",params:{workoutId:e.workout.id}}):null})},[e.workout?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",F,[e.workout.with_gpx?(Object(a["openBlock"])(),Object(a["createBlock"])(u,{key:0,workout:e.workout},null,8,["workout"])):(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",P,Object(a["toDisplayString"])(e.$t("workouts.NO_MAP")),1))])):Object(a["createCommentVNode"])("",!0)],2),Object(a["createElementVNode"])("div",{class:Object(a["normalizeClass"])(["workout-data",{"without-gpx":e.workout&&!e.workout.with_gpx}]),onClick:t[1]||(t[1]=function(t){return e.$router.push({name:"Workout",params:{workoutId:e.workout.id}})})},[Object(a["createElementVNode"])("div",$,[e.sport?(Object(a["openBlock"])(),Object(a["createBlock"])(i,{key:0,"sport-label":e.sport.label},null,8,["sport-label"])):Object(a["createCommentVNode"])("",!0)]),Object(a["createElementVNode"])("div",G,[z,e.workout?(Object(a["openBlock"])(),Object(a["createElementBlock"])("span",H,Object(a["toDisplayString"])(e.workout.moving),1)):Object(a["createCommentVNode"])("",!0)]),Object(a["createElementVNode"])("div",Y,[K,e.workout?(Object(a["openBlock"])(),Object(a["createElementBlock"])("span",X,Object(a["toDisplayString"])(e.workout.distance)+" km",1)):Object(a["createCommentVNode"])("",!0)]),e.workout&&e.workout.with_gpx?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",J,[Object(a["createElementVNode"])("img",{class:"mountains",src:"/img/workouts/mountains.svg",alt:e.$t("workouts.ELEVATION")},null,8,Z),Object(a["createElementVNode"])("div",Q,[Object(a["createElementVNode"])("span",null,Object(a["toDisplayString"])(e.workout.min_alt)+"/",1),Object(a["createElementVNode"])("span",null,Object(a["toDisplayString"])(e.workout.max_alt)+" m ",1)])])):Object(a["createCommentVNode"])("",!0),e.workout&&e.workout.with_gpx?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",ee,[te,Object(a["createElementVNode"])("div",re,[Object(a["createElementVNode"])("span",null,"+ "+Object(a["toDisplayString"])(e.workout.ascent)+"/",1),Object(a["createElementVNode"])("span",null,"- "+Object(a["toDisplayString"])(e.workout.descent)+" m ",1)])])):Object(a["createCommentVNode"])("",!0)],2)])])}var oe=r("b166"),ne=r("fd3a"),ce=r("8c86");function se(e,t){Object(ce["a"])(2,arguments);var r=Object(ne["a"])(e),a=Object(ne["a"])(t),o=r.getTime()-a.getTime();return o<0?-1:o>0?1:o}function le(e,t){Object(ce["a"])(2,arguments);var r=Object(ne["a"])(e),a=Object(ne["a"])(t),o=r.getFullYear()-a.getFullYear(),n=r.getMonth()-a.getMonth();return 12*o+n}function ue(e){Object(ce["a"])(1,arguments);var t=Object(ne["a"])(e);return t.setHours(23,59,59,999),t}var ie=r("8cac");function de(e){Object(ce["a"])(1,arguments);var t=Object(ne["a"])(e);return ue(t).getTime()===Object(ie["a"])(t).getTime()}function be(e,t){Object(ce["a"])(2,arguments);var r,a=Object(ne["a"])(e),o=Object(ne["a"])(t),n=se(a,o),c=Math.abs(le(a,o));if(c<1)r=0;else{1===a.getMonth()&&a.getDate()>27&&a.setDate(30),a.setMonth(a.getMonth()-n*c);var s=se(a,o)===-n;de(Object(ne["a"])(e))&&1===c&&1===se(e,o)&&(s=!1),r=n*(c-Number(s))}return 0===r?0:r}function pe(e,t){return Object(ce["a"])(2,arguments),Object(ne["a"])(e).getTime()-Object(ne["a"])(t).getTime()}var Oe={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(e){return e<0?Math.ceil(e):Math.floor(e)}},me="trunc";function je(e){return e?Oe[e]:Oe[me]}function fe(e,t,r){Object(ce["a"])(2,arguments);var a=pe(e,t)/1e3;return je(null===r||void 0===r?void 0:r.roundingMethod)(a)}var ke=r("8923");function ve(e,t){if(null==e)throw new TypeError("assign requires that input parameter not be null or undefined");for(var r in t=t||{},t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}function ye(e){return ve({},e)}var he=r("2420"),Se=1440,we=2520,Ee=43200,Ce=86400;function ge(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object(ce["a"])(2,arguments);var a=r.locale||ke["a"];if(!a.formatDistance)throw new RangeError("locale must contain formatDistance property");var o=se(e,t);if(isNaN(o))throw new RangeError("Invalid time value");var n,c,s=ye(r);s.addSuffix=Boolean(r.addSuffix),s.comparison=o,o>0?(n=Object(ne["a"])(t),c=Object(ne["a"])(e)):(n=Object(ne["a"])(e),c=Object(ne["a"])(t));var l,u=fe(c,n),i=(Object(he["a"])(c)-Object(he["a"])(n))/1e3,d=Math.round((u-i)/60);if(d<2)return r.includeSeconds?u<5?a.formatDistance("lessThanXSeconds",5,s):u<10?a.formatDistance("lessThanXSeconds",10,s):u<20?a.formatDistance("lessThanXSeconds",20,s):u<40?a.formatDistance("halfAMinute",null,s):u<60?a.formatDistance("lessThanXMinutes",1,s):a.formatDistance("xMinutes",1,s):0===d?a.formatDistance("lessThanXMinutes",1,s):a.formatDistance("xMinutes",d,s);if(d<45)return a.formatDistance("xMinutes",d,s);if(d<90)return a.formatDistance("aboutXHours",1,s);if(d<Se){var b=Math.round(d/60);return a.formatDistance("aboutXHours",b,s)}if(d<we)return a.formatDistance("xDays",1,s);if(d<Ee){var p=Math.round(d/Se);return a.formatDistance("xDays",p,s)}if(d<Ce)return l=Math.round(d/Ee),a.formatDistance("aboutXMonths",l,s);if(l=be(c,n),l<12){var O=Math.round(d/Ee);return a.formatDistance("xMonths",O,s)}var m=l%12,j=Math.floor(l/12);return m<3?a.formatDistance("aboutXYears",j,s):m<9?a.formatDistance("overXYears",j,s):a.formatDistance("almostXYears",j+1,s)}var Ne=r("68c6"),Be=r("c46a"),De=r("dad5"),Ve=r("2906"),_e=r("5e65"),Te=Object(a["defineComponent"])({name:"WorkoutCard",components:{StaticMap:Ne["a"],UserPicture:Be["a"]},props:{workout:{type:Object,required:!1},user:{type:Object,required:!0},sport:{type:Object,required:!1}},setup:function(){var e=Object(Ve["a"])(),t=Object(a["computed"])((function(){return e.getters[De["b"].GETTERS.LOCALE]}));return{format:oe["a"],formatDistance:ge,getDateWithTZ:_e["c"],locale:t}}}),Me=(r("702c"),r("6b0d")),Ie=r.n(Me);const xe=Ie()(Te,[["render",ae],["__scopeId","data-v-99d3cd20"]]);var Re=xe,Ae=r("1724"),Ue=r("9230"),qe=Object(a["defineComponent"])({name:"Timeline",components:{NoWorkouts:Ae["a"],WorkoutCard:Re},props:{sports:{type:Object,required:!0},user:{type:Object,required:!0}},setup:function(e){var t=Object(Ve["a"])(),r=Object(a["ref"])(1),o=5,n=e.user.nb_workouts>=o?o:e.user.nb_workouts;Object(a["onBeforeMount"])((function(){return l()}));var c=Object(a["computed"])((function(){return t.getters[De["f"].GETTERS.TIMELINE_WORKOUTS]})),s=Object(a["computed"])((function(){return c.value.length>0&&null!==c.value[c.value.length-1].previous_workout}));function l(){t.dispatch(De["f"].ACTIONS.GET_TIMELINE_WORKOUTS,Object(x["a"])({page:r.value,per_page:o},Ue["a"]))}function u(){r.value+=1,t.dispatch(De["f"].ACTIONS.GET_MORE_TIMELINE_WORKOUTS,Object(x["a"])({page:r.value,per_page:o},Ue["a"]))}return{initWorkoutsCount:n,moreWorkoutsExist:s,per_page:o,workouts:c,loadMoreWorkouts:u}}});r("e0ff");const Le=Ie()(qe,[["render",I],["__scopeId","data-v-e324c07c"]]);var We=Le,Fe={id:"user-calendar"},Pe={class:"calendar-card box"};function $e(e,t,r,o,n,c){var s=Object(a["resolveComponent"])("CalendarHeader"),l=Object(a["resolveComponent"])("CalendarDays"),u=Object(a["resolveComponent"])("CalendarCells");return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",Fe,[Object(a["createElementVNode"])("div",Pe,[Object(a["createVNode"])(s,{day:e.day,"locale-options":"enGB",onDisplayNextMonth:e.displayNextMonth,onDisplayPreviousMonth:e.displayPreviousMonth},null,8,["day","onDisplayNextMonth","onDisplayPreviousMonth"]),Object(a["createVNode"])(l,{"start-date":e.calendarDates.start,"locale-options":"enGB"},null,8,["start-date"]),Object(a["createVNode"])(u,{currentDay:e.day,"end-date":e.calendarDates.end,sports:e.sports,"start-date":e.calendarDates.start,timezone:e.user.timezone,workouts:e.calendarWorkouts,weekStartingMonday:e.user.weekm},null,8,["currentDay","end-date","sports","start-date","timezone","workouts","weekStartingMonday"])])])}var Ge=r("74b5"),ze=r("a618"),He={class:"calendar-cells"},Ye={class:"calendar-cell-day"};function Ke(e,t,r,o,n,c){var s=Object(a["resolveComponent"])("CalendarWorkouts");return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",He,[(Object(a["openBlock"])(!0),Object(a["createElementBlock"])(a["Fragment"],null,Object(a["renderList"])(e.rows,(function(t,r){return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",{class:"calendar-row",key:r},[(Object(a["openBlock"])(!0),Object(a["createElementBlock"])(a["Fragment"],null,Object(a["renderList"])(t,(function(t,r){return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",{class:Object(a["normalizeClass"])(["calendar-cell",{"disabled-cell":!e.isSameMonth(t,e.currentDay),"week-end":e.isWeekEnd(r),today:e.isToday(t)}]),key:r},[Object(a["createVNode"])(s,{workouts:e.filterWorkouts(t,e.workouts),sports:e.sports},null,8,["workouts","sports"]),Object(a["createElementVNode"])("div",Ye,Object(a["toDisplayString"])(e.format(t,"d")),1)],2)})),128))])})),128))])}r("caad");var Xe=r("f7f1");function Je(e){Object(ce["a"])(1,arguments);var t=Object(ne["a"])(e);return t.setHours(0,0,0,0),t}function Ze(e,t){Object(ce["a"])(2,arguments);var r=Je(e),a=Je(t);return r.getTime()===a.getTime()}function Qe(e,t){Object(ce["a"])(2,arguments);var r=Object(ne["a"])(e),a=Object(ne["a"])(t);return r.getFullYear()===a.getFullYear()&&r.getMonth()===a.getMonth()}function et(e){return Object(ce["a"])(1,arguments),Ze(e,Date.now())}var tt={class:"calendar-workouts"},rt={class:"desktop-display"},at={key:0,class:"workouts-display"},ot={key:1,class:"donut-display"},nt={class:"mobile-display"},ct={key:0,class:"donut-display"};function st(e,t,r,o,n,c){var s=Object(a["resolveComponent"])("CalendarWorkout"),l=Object(a["resolveComponent"])("CalendarWorkoutsChart");return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",tt,[Object(a["createElementVNode"])("div",rt,[e.workouts.length<=e.displayedWorkoutCount?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",at,[(Object(a["openBlock"])(!0),Object(a["createElementBlock"])(a["Fragment"],null,Object(a["renderList"])(e.workouts.slice(0,e.displayedWorkoutCount),(function(t,r){return Object(a["openBlock"])(),Object(a["createBlock"])(s,{key:r,workout:t,sportLabel:e.getSportLabel(t,e.sports)},null,8,["workout","sportLabel"])})),128))])):(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",ot,[Object(a["createVNode"])(l,{workouts:e.workouts,sports:e.sports,datasets:e.chartDatasets,colors:e.colors},null,8,["workouts","sports","datasets","colors"])]))]),Object(a["createElementVNode"])("div",nt,[e.workouts.length>0?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",ct,[Object(a["createVNode"])(l,{workouts:e.workouts,sports:e.sports,datasets:e.chartDatasets,colors:e.colors},null,8,["workouts","sports","datasets","colors"])])):Object(a["createCommentVNode"])("",!0)])])}r("d81d");var lt=["title"];function ut(e,t,r,o,n,c){var s=Object(a["resolveComponent"])("SportImage");return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",{class:"calendar-workout",onClick:t[0]||(t[0]=function(t){return e.$router.push({name:"Workout",params:{workoutId:e.workout.id}})})},[Object(a["createVNode"])(s,{"sport-label":e.sportLabel,title:e.workout.title},null,8,["sport-label","title"]),Object(a["createElementVNode"])("sup",null,[e.workout.records.length>0?(Object(a["openBlock"])(),Object(a["createElementBlock"])("i",{key:0,class:"fa fa-trophy custom-fa-small","aria-hidden":"true",title:e.workout.records.map((function(t){return" ".concat(e.t("workouts.RECORD_".concat(t.record_type)))}))},null,8,lt)):Object(a["createCommentVNode"])("",!0)])])}var it=r("47e2"),dt=Object(a["defineComponent"])({name:"CalendarWorkout",props:{workout:{type:Object,required:!0},sportLabel:{type:String,required:!0}},setup:function(){var e=Object(it["b"])(),t=e.t;return{t:t}}});r("38f1");const bt=Ie()(dt,[["render",ut]]);var pt=bt,Ot={class:"calendar-workouts-chart"},mt={class:"workouts-count"},jt={key:0,class:"workouts-pane"},ft={class:"more-workouts"};function kt(e,t,r,o,n,c){var s=Object(a["resolveComponent"])("DonutChart"),l=Object(a["resolveComponent"])("CalendarWorkout"),u=Object(a["resolveDirective"])("click-outside");return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",Ot,[Object(a["createElementVNode"])("div",{class:"workouts-chart",onClick:t[0]||(t[0]=function(){return e.togglePane&&e.togglePane.apply(e,arguments)})},[Object(a["createElementVNode"])("div",mt,Object(a["toDisplayString"])(e.workouts.length),1),Object(a["createVNode"])(s,{datasets:e.datasets,colors:e.colors},null,8,["datasets","colors"])]),e.isHidden?Object(a["createCommentVNode"])("",!0):(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",jt,[Object(a["withDirectives"])(Object(a["createElementVNode"])("div",ft,[Object(a["createElementVNode"])("i",{class:"fa fa-times calendar-more","aria-hidden":"true",onClick:t[1]||(t[1]=function(){return e.togglePane&&e.togglePane.apply(e,arguments)})}),(Object(a["openBlock"])(!0),Object(a["createElementBlock"])(a["Fragment"],null,Object(a["renderList"])(e.workouts,(function(t,r){return Object(a["openBlock"])(),Object(a["createBlock"])(l,{key:r,workout:t,sportLabel:e.getSportLabel(t,e.sports)},null,8,["workout","sportLabel"])})),128))],512),[[u,e.togglePane]])]))])}r("4fad");var vt={class:"donut-chart"},yt={height:"34",width:"34",viewBox:"0 0 34 34"},ht=["cx","cy","r","stroke","stroke-dashoffset","stroke-dasharray","transform"];function St(e,t,r,o,n,c){return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",vt,[(Object(a["openBlock"])(),Object(a["createElementBlock"])("svg",yt,[(Object(a["openBlock"])(!0),Object(a["createElementBlock"])(a["Fragment"],null,Object(a["renderList"])(Object.entries(e.datasets),(function(t,r){return Object(a["openBlock"])(),Object(a["createElementBlock"])("g",{key:r},[Object(a["createElementVNode"])("circle",{cx:e.cx,cy:e.cy,r:e.radius,fill:"transparent",stroke:e.colors[+t[0]],"stroke-dashoffset":e.calculateStrokeDashOffset(t[1].percentage,e.circumference),"stroke-dasharray":e.circumference,"stroke-width":"3","stroke-opacity":"0.8",transform:e.returnCircleTransformValue(r,t[1].percentage)},null,8,ht)])})),128))]))])}r("99af");var wt=Object(a["defineComponent"])({name:"DonutChart",props:{colors:{type:Object,required:!0},datasets:{type:Object,required:!0}},setup:function(){var e=-90,t=16,r=16,a=14,o=2*Math.PI*a;function n(e,t){return t-e*t}function c(a,o){var n="rotate(".concat(e,", ").concat(t,", ").concat(r,")");return e=360*o+e,n}return{angleOffset:e,circumference:o,cx:t,cy:r,radius:a,calculateStrokeDashOffset:n,returnCircleTransformValue:c}}});const Et=Ie()(wt,[["render",St]]);var Ct=Et,gt=r("1119"),Nt=Object(a["defineComponent"])({name:"CalendarWorkoutsChart",components:{CalendarWorkout:pt,DonutChart:Ct},props:{colors:{type:Object,required:!0},datasets:{type:Object,required:!0},sports:{type:Object,required:!0},workouts:{type:Object,required:!0}},setup:function(){var e=Object(a["ref"])(!0);function t(t){t.stopPropagation(),e.value=!e.value}return{isHidden:e,getSportLabel:gt["a"],togglePane:t}}});r("0fe0");const Bt=Ie()(Nt,[["render",kt],["__scopeId","data-v-b30dea28"]]);var Dt=Bt,Vt=Object(a["defineComponent"])({name:"CalendarWorkouts",components:{CalendarWorkout:pt,CalendarWorkoutsChart:Dt},props:{workouts:{type:Object,required:!0},sports:{type:Object,required:!0}},setup:function(e){return{chartDatasets:Object(a["computed"])((function(){return Object(Ue["c"])(e.workouts)})),colors:Object(a["computed"])((function(){return Object(gt["c"])(e.sports)})),displayedWorkoutCount:6,getSportLabel:gt["a"]}}});r("21d8");const _t=Ie()(Vt,[["render",st]]);var Tt=_t,Mt=Object(a["defineComponent"])({name:"CalendarCells",components:{CalendarWorkouts:Tt},props:{currentDay:{type:Date,required:!0},endDate:{type:Date,required:!0},sports:{type:Object,required:!0},startDate:{type:Date,required:!0},timezone:{type:String,required:!0},weekStartingMonday:{type:Boolean,required:!0},workouts:{type:Object,required:!0}},setup:function(e){var t=Object(a["ref"])([]),r=Object(a["toRefs"])(e),o=r.startDate,n=r.endDate,c=r.weekStartingMonday;function s(){t.value=[];var e=o.value;while(e<=n.value){for(var r=[],a=0;a<7;a++)r.push(e),e=Object(Xe["a"])(e,1);t.value.push(r)}}function l(e){return c.value?[5,6].includes(e):[0,6].includes(e)}function u(t,r){return r?r.filter((function(r){return Ze(Object(_e["c"])(r.workout_date,e.timezone),t)})).reverse():[]}return Object(a["onMounted"])((function(){return s()})),Object(a["watch"])((function(){return e.currentDay}),(function(){return s()})),{rows:t,format:oe["a"],isSameMonth:Qe,isToday:et,isWeekEnd:l,filterWorkouts:u}}});r("288e");const It=Ie()(Mt,[["render",Ke]]);var xt=It,Rt={class:"calendar-days"};function At(e,t,r,o,n,c){return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",Rt,[(Object(a["openBlock"])(!0),Object(a["createElementBlock"])(a["Fragment"],null,Object(a["renderList"])(e.days,(function(t,r){return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",{class:"calendar-day",key:r},Object(a["toDisplayString"])(e.format(t,"EEE",e.localeOptions)),1)})),128))])}var Ut=Object(a["defineComponent"])({name:"CalendarDays",props:{startDate:{type:Date,required:!0},localeOptions:{type:String,required:!0}},setup:function(e){for(var t=[],r=0;r<7;r++)t.push(Object(Xe["a"])(e.startDate,r));return{days:t,addDays:Xe["a"],format:oe["a"]}}});r("5fcb");const qt=Ie()(Ut,[["render",At]]);var Lt=qt,Wt={class:"calendar-header"},Ft=Object(a["createElementVNode"])("i",{class:"fa fa-chevron-left","aria-hidden":"true"},null,-1),Pt=[Ft],$t={class:"calendar-month"},Gt=Object(a["createElementVNode"])("i",{class:"fa fa-chevron-right","aria-hidden":"true"},null,-1),zt=[Gt];function Ht(e,t,r,o,n,c){return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",Wt,[Object(a["createElementVNode"])("div",{class:"calendar-arrow calendar-arrow-left",onClick:t[0]||(t[0]=function(t){return e.emit("displayPreviousMonth")})},Pt),Object(a["createElementVNode"])("div",$t,[Object(a["createElementVNode"])("span",null,Object(a["toDisplayString"])(e.format(e.day,"MMM yyyy",e.localeOptions)),1)]),Object(a["createElementVNode"])("div",{class:"calendar-arrow calendar-arrow-right",onClick:t[1]||(t[1]=function(t){return e.emit("displayNextMonth")})},zt)])}var Yt=Object(a["defineComponent"])({name:"CalendarHeader",props:{day:{type:Date,required:!0},localeOptions:{type:String,required:!0}},emits:["displayNextMonth","displayPreviousMonth"],setup:function(e,t){var r=t.emit;return{emit:r,format:oe["a"]}}});r("e4ea");const Kt=Ie()(Yt,[["render",Ht]]);var Xt=Kt,Jt=Object(a["defineComponent"])({name:"UserCalendar",components:{CalendarCells:xt,CalendarDays:Lt,CalendarHeader:Xt},props:{sports:{type:Object,required:!0},user:{type:Object,required:!0}},setup:function(e){var t=Object(Ve["a"])();Object(a["onBeforeMount"])((function(){return s()}));var r="yyyy-MM-dd",o=Object(a["ref"])(new Date),n=Object(a["ref"])(Object(_e["b"])(o.value,e.user.weekm)),c=Object(a["computed"])((function(){return t.getters[De["f"].GETTERS.CALENDAR_WORKOUTS]}));function s(){n.value=Object(_e["b"])(o.value,e.user.weekm);var a=Object(x["a"])({from:Object(oe["a"])(n.value.start,r),to:Object(oe["a"])(n.value.end,r),page:1,per_page:100},Ue["a"]);t.dispatch(De["f"].ACTIONS.GET_CALENDAR_WORKOUTS,a)}function l(){o.value=Object(Ge["a"])(o.value,1),s()}function u(){o.value=Object(ze["a"])(o.value,1),s()}return{day:o,calendarDates:n,calendarWorkouts:c,displayNextMonth:l,displayPreviousMonth:u}}});r("51ce");const Zt=Ie()(Jt,[["render",$e]]);var Qt=Zt,er={class:"user-month-stats"};function tr(e,t,r,o,n,c){var s=Object(a["resolveComponent"])("StatChart"),l=Object(a["resolveComponent"])("Card");return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",er,[Object(a["createVNode"])(l,null,{title:Object(a["withCtx"])((function(){return[Object(a["createTextVNode"])(Object(a["toDisplayString"])(e.$t("dashboard.THIS_MONTH")),1)]})),content:Object(a["withCtx"])((function(){return[Object(a["createVNode"])(s,{sports:e.sports,user:e.user,"chart-params":e.chartParams,"displayed-sport-ids":e.selectedSportIds,"hide-chart-if-no-data":!0},null,8,["sports","user","chart-params","displayed-sport-ids"])]})),_:1})])}var rr=r("f628"),ar=r("ec59"),or=Object(a["defineComponent"])({name:"UserMonthStats",components:{StatChart:ar["a"]},props:{sports:{type:Object,required:!0},user:{type:Object,required:!0}},setup:function(e){var t=new Date;return{chartParams:{duration:"week",start:Object(rr["a"])(t),end:Object(ie["a"])(t)},selectedSportIds:e.sports.map((function(e){return e.id}))}}});r("224d");const nr=Ie()(or,[["render",tr],["__scopeId","data-v-7958b39f"]]);var cr=nr,sr=(r("b64b"),r("4e82"),function(e){return Object(a["pushScopeId"])("data-v-080b37ac"),e=e(),Object(a["popScopeId"])(),e}),lr={class:"user-records-section"},ur={class:"section-title"},ir=sr((function(){return Object(a["createElementVNode"])("i",{class:"fa fa-trophy custom-fa-small","aria-hidden":"true"},null,-1)})),dr={class:"user-records"},br={key:0,class:"no-records"};function pr(e,t,r,o,n,c){var s=Object(a["resolveComponent"])("RecordsCard");return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",lr,[Object(a["createElementVNode"])("div",ur,[ir,Object(a["createTextVNode"])(" "+Object(a["toDisplayString"])(e.$t("workouts.RECORD",2)),1)]),Object(a["createElementVNode"])("div",dr,[0===Object.keys(e.recordsBySport).length?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",br,Object(a["toDisplayString"])(e.$t("workouts.NO_RECORDS")),1)):Object(a["createCommentVNode"])("",!0),(Object(a["openBlock"])(!0),Object(a["createElementBlock"])(a["Fragment"],null,Object(a["renderList"])(Object.keys(e.recordsBySport).sort(),(function(t){return Object(a["openBlock"])(),Object(a["createBlock"])(s,{sportTranslatedLabel:t,records:e.recordsBySport[t],key:t},null,8,["sportTranslatedLabel","records"])})),128))])])}var Or={class:"records-card"},mr={class:"record-type"},jr={class:"record-value"},fr={class:"record-date"};function kr(e,t,r,o,n,c){var s=Object(a["resolveComponent"])("SportImage"),l=Object(a["resolveComponent"])("router-link"),u=Object(a["resolveComponent"])("Card");return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",Or,[Object(a["createVNode"])(u,null,{title:Object(a["withCtx"])((function(){return[Object(a["createVNode"])(s,{"sport-label":e.records.label},null,8,["sport-label"]),Object(a["createTextVNode"])(" "+Object(a["toDisplayString"])(e.sportTranslatedLabel),1)]})),content:Object(a["withCtx"])((function(){return[(Object(a["openBlock"])(!0),Object(a["createElementBlock"])(a["Fragment"],null,Object(a["renderList"])(e.records.records,(function(t){return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",{class:"record",key:t.id},[Object(a["createElementVNode"])("span",mr,Object(a["toDisplayString"])(e.t("workouts.RECORD_".concat(t.record_type))),1),Object(a["createElementVNode"])("span",jr,Object(a["toDisplayString"])(t.value),1),Object(a["createElementVNode"])("span",fr,[Object(a["createVNode"])(l,{to:{name:"Workout",params:{workoutId:t.workout_id}}},{default:Object(a["withCtx"])((function(){return[Object(a["createTextVNode"])(Object(a["toDisplayString"])(t.workout_date),1)]})),_:2},1032,["to"])])])})),128))]})),_:1})])}var vr=Object(a["defineComponent"])({name:"RecordsCard",props:{records:{type:Object,required:!0},sportTranslatedLabel:{type:String,required:!0}},setup:function(){var e=Object(it["b"])(),t=e.t;return{t:t}}});r("2b62");const yr=Ie()(vr,[["render",kr],["__scopeId","data-v-db29ce96"]]);var hr=yr,Sr=(r("7db0"),function(e,t){var r;switch(e.record_type){case"AS":case"MS":r="".concat(e.value," km/h");break;case"FD":r="".concat(e.value," km");break;case"LD":r=e.value;break;default:throw new Error('Invalid record type, expected: "AS", "FD", "LD", "MD", got: "'.concat(e.record_type,'"'))}return{workout_date:Object(_e["a"])(Object(_e["c"])(e.workout_date,t)).workout_date,workout_id:e.workout_id,id:e.id,record_type:e.record_type,value:r}}),wr=function(e,t,r){return e.reduce((function(e,a){var o=t.find((function(e){return e.id===a.sport_id}));return o&&o.label&&(void 0===e[o.translatedLabel]&&(e[o.translatedLabel]={label:o.label,records:[]}),e[o.translatedLabel].records.push(Sr(a,r))),e}),{})},Er=Object(a["defineComponent"])({name:"UserRecords",components:{RecordsCard:hr},props:{sports:{type:Object,required:!0},user:{type:Object,required:!0}},setup:function(e){var t=Object(it["b"])(),r=t.t,o=Object(a["computed"])((function(){return wr(e.user.records,Object(gt["d"])(e.sports,r),e.user.timezone)}));return{recordsBySport:o}}});r("c11a");const Cr=Ie()(Er,[["render",pr],["__scopeId","data-v-080b37ac"]]);var gr=Cr,Nr=(r("b680"),r("a9e3"),{id:"user-stats"});function Br(e,t,r,o,n,c){var s=Object(a["resolveComponent"])("StatCard");return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",Nr,[Object(a["createVNode"])(s,{icon:"calendar",value:e.user.nb_workouts,text:e.$t("workouts.WORKOUT",e.user.nb_workouts)},null,8,["value","text"]),Object(a["createVNode"])(s,{icon:"road",value:Number(e.user.total_distance).toFixed(2),text:e.$t("workouts.KM")},null,8,["value","text"]),Object(a["createVNode"])(s,{icon:"clock-o",value:e.total_duration.days,text:e.total_duration.duration},null,8,["value","text"]),Object(a["createVNode"])(s,{icon:"tags",value:e.user.nb_sports,text:e.$t("workouts.SPORT",e.user.nb_sports)},null,8,["value","text"])])}r("466d"),r("1276");var Dr=r("05d9"),Vr=Object(a["defineComponent"])({name:"UserStatsCards",components:{StatCard:Dr["a"]},props:{user:{type:Object,required:!0}},setup:function(e){var t=Object(it["b"])(),r=t.t,o=Object(a["computed"])((function(){return e.user.total_duration}));function n(e){var t=e.value.match(/day/g)?e.value.split(", ")[1]:e.value;return{days:e.value.match(/day/g)?"".concat(e.value.split(" ")[0]," ").concat(e.value.match(/days/g)?r("common.DAY",2):r("common.DAY",1)):"0 ".concat(r("common.DAY",2),","),duration:"".concat(t.split(":")[0],"h ").concat(t.split(":")[1],"min")}}return{total_duration:Object(a["computed"])((function(){return n(o)}))}}});r("d224");const _r=Ie()(Vr,[["render",Br]]);var Tr=_r,Mr=Object(a["defineComponent"])({name:"Dashboard",components:{Timeline:We,UserCalendar:Qt,UserMonthStats:cr,UserRecords:gr,UserStatsCards:Tr},setup:function(){var e=Object(Ve["a"])(),t=Object(a["computed"])((function(){return e.getters[De["a"].GETTERS.AUTH_USER_PROFILE]})),r=Object(a["computed"])((function(){return e.getters[De["c"].GETTERS.SPORTS]})),o=Object(a["ref"])("chart");function n(e){o.value=e}return{authUser:t,sports:r,isSelected:o,updateDisplayColumn:n}}});r("57a9");const Ir=Ie()(Mr,[["render",S],["__scopeId","data-v-ad6483fc"]]);t["default"]=Ir},7416:function(e,t,r){"use strict";r.d(t,"a",(function(){return N})),r.d(t,"b",(function(){return B})),r.d(t,"c",(function(){return D}));r("d81d"),r("4de4"),r("d3b7"),r("caad"),r("2532");var a=r("b166"),o=r("d6e9"),n=r("fe1f"),c=r("cdb6"),s=r("8c86");function l(e,t){Object(s["a"])(2,arguments);var r=Object(n["a"])(t);return Object(c["a"])(e,-r)}var u=r("69eb"),i=r("a618"),d=r("f628"),b=r("fd3a");function p(e){Object(s["a"])(1,arguments);var t=Object(b["a"])(e),r=t.getFullYear();return t.setFullYear(r+1,0,0),t.setHours(23,59,59,999),t}var O=r("2fc8"),m=r("8cac"),j=r("f7f1");function f(e,t){Object(s["a"])(2,arguments);var r=Object(n["a"])(t),a=7*r;return Object(j["a"])(e,a)}function k(e,t){Object(s["a"])(2,arguments);var r=Object(n["a"])(t);return f(e,-r)}var v=r("74b5"),y=r("5e65"),h=r("1119"),S={week:{api:"yyyy-MM-dd",chart:"dd/MM/yyyy"},month:{api:"yyyy-MM",chart:"MM/yyyy"},year:{api:"yyyy",chart:"yyyy"}},w=["nb_workouts","total_duration","total_distance","total_ascent","total_descent"],E=function(e,t){for(var r=[],a=Object(y["d"])(e.duration,e.start,t);a<=e.end;a=Object(y["e"])(e.duration,a))r.push(a);return r},C=function(e,t){return{label:e,backgroundColor:[t],data:[]}},g=function(e){var t={nb_workouts:[],total_distance:[],total_duration:[],total_ascent:[],total_descent:[]};return e.map((function(e){var r=h["b"][e.label];t.nb_workouts.push(C(e.label,r)),t.total_distance.push(C(e.label,r)),t.total_duration.push(C(e.label,r)),t.total_ascent.push(C(e.label,r)),t.total_descent.push(C(e.label,r))})),t},N=function(e,t,r,o,n){var c=E(e,t),s=S[e.duration],l=r.filter((function(e){return o.includes(e.id)})),u=[],i=g(l),d={};return l.map((function(e){return d[e.label]=e.id})),c.map((function(e){var t=Object(a["a"])(e,s.api),r=Object(a["a"])(e,s.chart);u.push(r),w.map((function(e){i[e].map((function(r){r.data.push(n!=={}&&t in n&&d[r.label]in n[t]?n[t][d[r.label]][e]:0)}))}))})),{labels:u,datasets:i}},B=function(e,t,r){var a=r?1:0,n="year"===t?Object(o["a"])(l(e,9)):"week"===t?Object(u["a"])(Object(i["a"])(e,2),{weekStartsOn:a}):Object(d["a"])(Object(i["a"])(e,11)),c="year"===t?p(e):"week"===t?Object(O["a"])(e,{weekStartsOn:a}):Object(m["a"])(e);return{duration:t,end:c,start:n}},D=function(e,t,r){var a=e.duration,n=e.start,s=e.end,b=r?1:0;return{duration:a,end:"year"===a?p(t?l(s,1):Object(c["a"])(s,1)):"week"===a?Object(O["a"])(t?k(s,1):f(s,1),{weekStartsOn:b}):Object(m["a"])(t?Object(i["a"])(s,1):Object(v["a"])(s,1)),start:"year"===a?Object(o["a"])(t?l(n,1):Object(c["a"])(n,1)):"week"===a?Object(u["a"])(t?k(n,1):f(n,1),{weekStartsOn:b}):Object(d["a"])(t?Object(i["a"])(n,1):Object(v["a"])(n,1))}}},"778a":function(e,t,r){"use strict";r("c1a9")},8338:function(e,t,r){},"83b5":function(e,t,r){},"887b":function(e,t,r){"use strict";r("121b")},"8d2d":function(e,t,r){},9080:function(e,t,r){},"92c3":function(e,t,r){},"9a0c":function(e,t,r){var a=r("342f");e.exports=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(a)},a0b1:function(e,t,r){},a618:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var a=r("fe1f"),o=r("74b5"),n=r("8c86");function c(e,t){Object(n["a"])(2,arguments);var r=Object(a["a"])(t);return Object(o["a"])(e,-r)}},a881:function(e,t,r){},b3b8:function(e,t,r){},b499:function(e,t,r){"use strict";r("a881")},bbd4:function(e,t,r){},bf1d:function(e,t,r){"use strict";r("f00c")},c11a:function(e,t,r){"use strict";r("b3b8")},c1a9:function(e,t,r){},ccb2:function(e,t,r){"use strict";r.r(t);var a=r("7a23"),o={id:"statistics",class:"view"},n={key:0,class:"container"};function c(e,t,r,c,s,l){var u=Object(a["resolveComponent"])("Statistics"),i=Object(a["resolveComponent"])("Card"),d=Object(a["resolveComponent"])("NoWorkouts");return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",o,[e.authUser.username?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",n,[Object(a["createVNode"])(i,null,{title:Object(a["withCtx"])((function(){return[Object(a["createTextVNode"])(Object(a["toDisplayString"])(e.$t("statistics.STATISTICS")),1)]})),content:Object(a["withCtx"])((function(){return[Object(a["createVNode"])(u,{class:Object(a["normalizeClass"])({"stats-disabled":0===e.authUser.nb_workouts}),user:e.authUser,sports:e.sports},null,8,["class","user","sports"])]})),_:1}),0===e.authUser.nb_workouts?(Object(a["openBlock"])(),Object(a["createBlock"])(d,{key:0})):Object(a["createCommentVNode"])("",!0)])):Object(a["createCommentVNode"])("",!0)])}r("4de4"),r("d3b7"),r("caad"),r("2532");var s={key:0,id:"user-statistics"};function l(e,t,r,o,n,c){var l=Object(a["resolveComponent"])("StatsMenu"),u=Object(a["resolveComponent"])("StatChart"),i=Object(a["resolveComponent"])("SportsMenu");return e.translatedSports?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",s,[Object(a["createVNode"])(l,{onTimeFrameUpdate:e.updateTimeFrame,onArrowClick:e.handleOnClickArrows},null,8,["onTimeFrameUpdate","onArrowClick"]),Object(a["createVNode"])(u,{sports:e.sports,user:e.user,chartParams:e.chartParams,"displayed-sport-ids":e.selectedSportIds,fullStats:!0},null,8,["sports","user","chartParams","displayed-sport-ids"]),Object(a["createVNode"])(i,{"selected-sport-ids":e.selectedSportIds,"user-sports":e.sports,onSelectedSportIdsUpdate:e.updateSelectedSportIds},null,8,["selected-sport-ids","user-sports","onSelectedSportIdsUpdate"])])):Object(a["createCommentVNode"])("",!0)}r("d81d");var u=r("47e2"),i=r("ec59"),d={class:"chart-menu"},b={class:"chart-arrow"},p={class:"time-frames custom-checkboxes-group"},O={class:"time-frames-checkboxes custom-checkboxes"},m=["id","name","checked","onInput"],j={class:"chart-arrow"};function f(e,t,r,o,n,c){return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",d,[Object(a["createElementVNode"])("div",b,[Object(a["createElementVNode"])("i",{class:"fa fa-chevron-left","aria-hidden":"true",onClick:t[0]||(t[0]=function(t){return e.emit("arrowClick",!0)})})]),Object(a["createElementVNode"])("div",p,[Object(a["createElementVNode"])("div",O,[(Object(a["openBlock"])(!0),Object(a["createElementBlock"])(a["Fragment"],null,Object(a["renderList"])(e.timeFrames,(function(t){return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",{class:"time-frame custom-checkbox",key:t},[Object(a["createElementVNode"])("label",null,[Object(a["createElementVNode"])("input",{type:"radio",id:t,name:t,checked:e.selectedTimeFrame===t,onInput:function(r){return e.onUpdateTimeFrame(t)}},null,40,m),Object(a["createElementVNode"])("span",null,Object(a["toDisplayString"])(e.$t("statistics.TIME_FRAMES.".concat(t))),1)])])})),128))])]),Object(a["createElementVNode"])("div",j,[Object(a["createElementVNode"])("i",{class:"fa fa-chevron-right","aria-hidden":"true",onClick:t[1]||(t[1]=function(t){return e.emit("arrowClick",!1)})})])])}var k=Object(a["defineComponent"])({name:"StatsMenu",emits:["arrowClick","timeFrameUpdate"],setup:function(e,t){var r=t.emit,o=Object(a["ref"])("month"),n=["week","month","year"];function c(e){o.value=e,r("timeFrameUpdate",e)}return{selectedTimeFrame:o,timeFrames:n,onUpdateTimeFrame:c,emit:r}}}),v=(r("b499"),r("6b0d")),y=r.n(v);const h=y()(k,[["render",f],["__scopeId","data-v-56f0f302"]]);var S=h,w={class:"sports-menu"},E=["id","name","checked","onInput"],C={class:"sport-label"};function g(e,t,r,o,n,c){var s=Object(a["resolveComponent"])("SportImage");return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",w,[(Object(a["openBlock"])(!0),Object(a["createElementBlock"])(a["Fragment"],null,Object(a["renderList"])(e.translatedSports,(function(t){return Object(a["openBlock"])(),Object(a["createElementBlock"])("label",{type:"checkbox",key:t.id,style:Object(a["normalizeStyle"])({color:e.sportColors[t.label]})},[Object(a["createElementVNode"])("input",{type:"checkbox",id:t.id,name:t.label,checked:e.selectedSportIds.includes(t.id),onInput:function(r){return e.updateSelectedSportIds(t.id)}},null,40,E),Object(a["createVNode"])(s,{"sport-label":t.label},null,8,["sport-label"]),Object(a["createElementVNode"])("span",C,Object(a["toDisplayString"])(t.translatedLabel),1)],4)})),128))])}var N=r("1119"),B=Object(a["defineComponent"])({name:"SportsMenu",props:{selectedSportIds:{type:Array,default:function(){return[]}},userSports:{type:Object,required:!0}},emits:["selectedSportIdsUpdate"],setup:function(e,t){var r=t.emit,o=Object(u["b"])(),n=o.t,c=Object(a["computed"])((function(){return Object(N["d"])(e.userSports,n)}));function s(e){r("selectedSportIdsUpdate",e)}return{sportColors:Object(a["inject"])("sportColors"),translatedSports:c,updateSelectedSportIds:s}}});r("bf1d");const D=y()(B,[["render",g]]);var V=D,_=r("7416"),T=Object(a["defineComponent"])({name:"Statistics",components:{SportsMenu:V,StatChart:i["a"],StatsMenu:S},props:{sports:{type:Object,required:!0},user:{type:Object,required:!0}},setup:function(e){var t=Object(u["b"])(),r=t.t,o=Object(a["ref"])("month"),n=["week","month","year"],c=Object(a["ref"])(d(o.value)),s=Object(a["computed"])((function(){return Object(N["d"])(e.sports,r)})),l=Object(a["ref"])(p(e.sports));function i(e){o.value=e,c.value=d(o.value)}function d(t){return Object(_["b"])(new Date,t,e.user.weekm)}function b(t){c.value=Object(_["c"])(c.value,t,e.user.weekm)}function p(e){return e.map((function(e){return e.id}))}function O(e){l.value.includes(e)?l.value=l.value.filter((function(t){return t!==e})):l.value.push(e)}return Object(a["watch"])((function(){return e.sports}),(function(e){l.value=p(e)})),{chartParams:c,selectedTimeFrame:o,timeFrames:n,translatedSports:s,selectedSportIds:l,handleOnClickArrows:b,updateSelectedSportIds:O,updateTimeFrame:i}}});r("778a");const M=y()(T,[["render",l],["__scopeId","data-v-dad311d4"]]);var I=M,x=r("1724"),R=r("dad5"),A=r("2906"),U=Object(a["defineComponent"])({name:"StatisticsView",components:{NoWorkouts:x["a"],Statistics:I},setup:function(){var e=Object(A["a"])(),t=Object(a["computed"])((function(){return e.getters[R["a"].GETTERS.AUTH_USER_PROFILE]})),r=Object(a["computed"])((function(){return e.getters[R["c"].GETTERS.SPORTS].filter((function(e){return t.value.sports_list.includes(e.id)}))}));return{authUser:t,sports:r}}});r("d3c0");const q=y()(U,[["render",c],["__scopeId","data-v-cdc23a7c"]]);t["default"]=q},cfa1:function(e,t,r){},d224:function(e,t,r){"use strict";r("a0b1")},d277:function(e,t,r){"use strict";r.r(t);var a=r("7a23"),o={id:"loginOrRegister",class:"view"},n={class:"container"},c={class:"container-sub"},s={class:"container-sub"};function l(e,t,r,l,u,i){var d=Object(a["resolveComponent"])("BikePic"),b=Object(a["resolveComponent"])("LoginOrRegisterForm");return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",o,[Object(a["createElementVNode"])("div",n,[Object(a["createElementVNode"])("div",c,[Object(a["createVNode"])(d)]),Object(a["createElementVNode"])("div",s,[Object(a["createVNode"])(b,{action:e.action},null,8,["action"])])])])}var u={id:"about"},i=["src"];function d(e,t,r,o,n,c){return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",u,[Object(a["createElementVNode"])("img",{class:"bike-img",src:"/img/bike.svg",alt:"mountain bike"},null,8,i)])}var b={name:"About"},p=(r("6ca7"),r("6b0d")),O=r.n(p);const m=O()(b,[["render",d],["__scopeId","data-v-645e8c6f"]]);var j=m,f=r("0395"),k=Object(a["defineComponent"])({name:"NavBar",components:{BikePic:j,LoginOrRegisterForm:f["a"]},props:{action:{type:String,required:!0}}});r("887b");const v=O()(k,[["render",l]]);t["default"]=v},d28b:function(e,t,r){var a=r("746f");a("iterator")},d3c0:function(e,t,r){"use strict";r("cfa1")},e01a:function(e,t,r){"use strict";var a=r("23e7"),o=r("83ab"),n=r("da84"),c=r("e330"),s=r("1a2d"),l=r("1626"),u=r("3a9b"),i=r("577e"),d=r("9bf2").f,b=r("e893"),p=n.Symbol,O=p&&p.prototype;if(o&&l(p)&&(!("description"in O)||void 0!==p().description)){var m={},j=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:i(arguments[0]),t=u(O,this)?new p(e):void 0===e?p():p(e);return""===e&&(m[t]=!0),t};b(j,p),j.prototype=O,O.constructor=j;var f="Symbol(test)"==String(p("test")),k=c(O.toString),v=c(O.valueOf),y=/^Symbol\((.*)\)[^)]+$/,h=c("".replace),S=c("".slice);d(O,"description",{configurable:!0,get:function(){var e=v(this),t=k(e);if(s(m,e))return"";var r=f?S(t,7,-1):h(t,y,"$1");return""===r?void 0:r}}),a({global:!0,forced:!0},{Symbol:j})}},e0ff:function(e,t,r){"use strict";r("9080")},e19f:function(e,t,r){"use strict";r.r(t);var a=r("7a23"),o={class:"not-found view"};function n(e,t,r,n,c,s){var l=Object(a["resolveComponent"])("NotFound");return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",o,[Object(a["createVNode"])(l)])}var c=r("f7f9"),s=Object(a["defineComponent"])({name:"NotFoundView",components:{NotFound:c["a"]}}),l=r("6b0d"),u=r.n(l);const i=u()(s,[["render",n]]);t["default"]=i},e4ea:function(e,t,r){"use strict";r("5782")},e766:function(e,t,r){},ec59:function(e,t,r){"use strict";var a=r("7a23"),o={class:"start-chart"},n={key:0},c={key:1},s={class:"chart-radio"},l=["checked"],u=["checked"],i=["checked"],d={key:0},b=["checked"],p={key:1},O=["checked"];function m(e,t,r,m,j,f){var k=Object(a["resolveComponent"])("Chart");return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",o,[e.hideChartIfNoData&&e.emptyStats?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",n,Object(a["toDisplayString"])(e.$t("workouts.NO_WORKOUTS")),1)):(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",c,[Object(a["createElementVNode"])("div",s,[Object(a["createElementVNode"])("label",null,[Object(a["createElementVNode"])("input",{type:"radio",name:"total_distance",checked:"total_distance"===e.displayedData,onClick:t[0]||(t[0]=function(){return e.updateDisplayData&&e.updateDisplayData.apply(e,arguments)})},null,8,l),Object(a["createTextVNode"])(" "+Object(a["toDisplayString"])(e.$t("workouts.DISTANCE")),1)]),Object(a["createElementVNode"])("label",null,[Object(a["createElementVNode"])("input",{type:"radio",name:"total_duration",checked:"total_duration"===e.displayedData,onClick:t[1]||(t[1]=function(){return e.updateDisplayData&&e.updateDisplayData.apply(e,arguments)})},null,8,u),Object(a["createTextVNode"])(" "+Object(a["toDisplayString"])(e.$t("workouts.DURATION")),1)]),Object(a["createElementVNode"])("label",null,[Object(a["createElementVNode"])("input",{type:"radio",name:"nb_workouts",checked:"nb_workouts"===e.displayedData,onClick:t[2]||(t[2]=function(){return e.updateDisplayData&&e.updateDisplayData.apply(e,arguments)})},null,8,i),Object(a["createTextVNode"])(" "+Object(a["toDisplayString"])(e.$t("workouts.WORKOUT",2)),1)]),e.fullStats?(Object(a["openBlock"])(),Object(a["createElementBlock"])("label",d,[Object(a["createElementVNode"])("input",{type:"radio",name:"total_ascent",checked:"total_ascent"===e.displayedData,onClick:t[3]||(t[3]=function(){return e.updateDisplayData&&e.updateDisplayData.apply(e,arguments)})},null,8,b),Object(a["createTextVNode"])(" "+Object(a["toDisplayString"])(e.$t("workouts.ASCENT")),1)])):Object(a["createCommentVNode"])("",!0),e.fullStats?(Object(a["openBlock"])(),Object(a["createElementBlock"])("label",p,[Object(a["createElementVNode"])("input",{type:"radio",name:"total_descent",checked:"total_descent"===e.displayedData,onClick:t[4]||(t[4]=function(){return e.updateDisplayData&&e.updateDisplayData.apply(e,arguments)})},null,8,O),Object(a["createTextVNode"])(" "+Object(a["toDisplayString"])(e.$t("workouts.DESCENT")),1)])):Object(a["createCommentVNode"])("",!0)]),e.labels.length>0?(Object(a["openBlock"])(),Object(a["createBlock"])(k,{key:0,datasets:e.datasets,labels:e.labels,displayedData:e.displayedData,displayedSportIds:e.displayedSportIds,fullStats:e.fullStats},null,8,["datasets","labels","displayedData","displayedSportIds","fullStats"])):Object(a["createCommentVNode"])("",!0)]))])}var j=r("1da1"),f=(r("96cf"),r("b0c0"),r("b64b"),r("b166")),k={class:"chart"};function v(e,t,r,o,n,c){var s=Object(a["resolveComponent"])("BarChart");return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",k,[Object(a["createVNode"])(s,Object(a["mergeProps"])(e.barChartProps,{class:"bar-chart"}),null,16)])}r("e9c4"),r("d3b7"),r("d81d");var y=r("b48c"),h=r("47e2"),S=(r("b680"),r("25f0"),r("4d90"),r("99af"),function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r="0";t&&(r=String(Math.floor(e/86400)),e%=86400);var a=String(Math.floor(e/3600)).padStart(2,"0");e%=3600;var o=String(Math.floor(e/60)).padStart(2,"0"),n=String(e%60).padStart(2,"0");return t?"".concat("0"===r?"":"".concat(r,"d ")).concat("00"===a?"":"".concat(a,"h ")).concat(o,"m ").concat(n,"s"):"".concat("00"===a?"":"".concat(a,":")).concat(o,":").concat(n)}),w=function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];switch(e){case"total_duration":return S(t,r);case"total_distance":return t.toFixed(2)+" km";case"total_ascent":case"total_descent":return(t/1e3).toFixed(2)+" km";default:return t.toString()}},E=Object(a["defineComponent"])({name:"Chart",components:{BarChart:y["BarChart"]},props:{datasets:{type:Object,required:!0},labels:{type:Object,required:!0},displayedData:{type:String,required:!0},displayedSportIds:{type:Array,required:!0},fullStats:{type:Boolean,required:!0}},setup:function(e){var t=Object(h["b"])(),r=t.t;function o(e){return isNaN(e)?0:+e}function n(e,t){return o(e)+o(t)}var c=Object(a["computed"])((function(){return{labels:e.labels,datasets:JSON.parse(JSON.stringify(e.datasets))}})),s=Object(a["computed"])((function(){return{responsive:!0,maintainAspectRatio:!0,animation:!1,layout:{padding:{top:e.fullStats?40:22}},scales:{x:{stacked:!0,grid:{drawOnChartArea:!1}},y:{stacked:!0,grid:{drawOnChartArea:!1},ticks:{maxTicksLimit:6,callback:function(t){return w(e.displayedData,+t,!1)}},afterFit:function(t){t.width=e.fullStats?75:60}}},plugins:{datalabels:{anchor:"end",align:"end",rotation:function(t){return e.fullStats&&t.chart.chartArea.width<580?310:0},display:function(t){return!(e.fullStats&&t.chart.chartArea.width<300)},formatter:function(t,r){var a=r.chart.data.datasets.map((function(e){return e.data[r.dataIndex]})).reduce((function(e,t){return n(e,t)}),0);return r.datasetIndex===e.displayedSportIds.length-1&&a>0?w(e.displayedData,a,!1):null}},legend:{display:!1},tooltip:{interaction:{intersect:!0,mode:"index"},filter:function(e){return"0"!==e.formattedValue},callbacks:{label:function(t){var a=r("sports.".concat(t.dataset.label,".LABEL"))||"";return a&&(a+=": "),null!==t.parsed.y&&(a+=w(e.displayedData,t.parsed.y)),a},footer:function(t){var a=0;return t.map((function(e){a+=e.parsed.y})),"".concat(r("common.TOTAL"),": ")+w(e.displayedData,a)}}}}}})),l=Object(y["useBarChart"])({chartData:c,options:s}),u=l.barChartProps;return{barChartProps:u}}}),C=r("6b0d"),g=r.n(C);const N=g()(E,[["render",v]]);var B=N,D=r("dad5"),V=r("2906"),_=r("7416"),T=Object(a["defineComponent"])({name:"UserMonthStats",components:{Chart:B},props:{sports:{type:Object,required:!0},user:{type:Object,required:!0},chartParams:{type:Object,required:!0},displayedSportIds:{type:Array,default:function(){return[]}},fullStats:{type:Boolean,default:!1},hideChartIfNoData:{type:Boolean,default:!1}},setup:function(e){var t=Object(V["a"])(),r=Object(a["ref"])("total_distance"),o=Object(a["computed"])((function(){return t.getters[D["d"].GETTERS.USER_STATS]})),n=Object(a["computed"])((function(){return Object(_["a"])(e.chartParams,e.user.weekm,e.sports,e.displayedSportIds,o.value)}));function c(r){t.dispatch(D["d"].ACTIONS.GET_USER_STATS,{username:e.user.username,filterType:"by_time",params:r})}function s(e){r.value=e.target.name}function l(e,t){return{from:Object(f["a"])(e.start,"yyyy-MM-dd"),to:Object(f["a"])(e.end,"yyyy-MM-dd"),time:"week"===e.duration?"week".concat(t.weekm?"m":""):e.duration}}return Object(a["onBeforeMount"])((function(){return c(l(e.chartParams,e.user))})),Object(a["watch"])((function(){return e.chartParams}),function(){var t=Object(j["a"])(regeneratorRuntime.mark((function t(r){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:c(l(r,e.user));case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),{datasets:Object(a["computed"])((function(){return n.value.datasets[r.value]})),labels:Object(a["computed"])((function(){return n.value.labels})),emptyStats:Object(a["computed"])((function(){return 0===Object.keys(o.value).length})),displayedData:r,updateDisplayData:s}}});r("0774");const M=g()(T,[["render",m],["__scopeId","data-v-831b4ece"]]);t["a"]=M},f00c:function(e,t,r){},f153:function(e,t,r){},f2b0:function(e,t,r){"use strict";r("e766")},fb6a:function(e,t,r){"use strict";var a=r("23e7"),o=r("da84"),n=r("e8b5"),c=r("68ee"),s=r("861d"),l=r("23cb"),u=r("07fa"),i=r("fc6a"),d=r("8418"),b=r("b622"),p=r("1dde"),O=r("f36a"),m=p("slice"),j=b("species"),f=o.Array,k=Math.max;a({target:"Array",proto:!0,forced:!m},{slice:function(e,t){var r,a,o,b=i(this),p=u(b),m=l(e,p),v=l(void 0===t?p:t,p);if(n(b)&&(r=b.constructor,c(r)&&(r===f||n(r.prototype))?r=void 0:s(r)&&(r=r[j],null===r&&(r=void 0)),r===f||void 0===r))return O(b,m,v);for(a=new(void 0===r?f:r)(k(v-m,0)),o=0;m<v;m++,o++)m in b&&d(a,o,b[m]);return a.length=o,a}})},fd0a:function(e,t,r){}}]);
//# sourceMappingURL=main.0da63bb9.js.map