FitTrackee/fittrackee/dist/static/js/main.265d6693.js
2021-11-07 10:20:23 +01:00

2 lines
63 KiB
JavaScript

(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["main"],{"00b4":function(e,t,r){"use strict";r("ac1f");var o=r("23e7"),a=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=a.Error,d=c(/./.test);o({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 o=r("7a23"),a={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(o["createTextVNode"])(" - "),O={key:2},m={class:"account"};function j(e,t,r,j,f,k){var v=Object(o["resolveComponent"])("AlertMessage"),y=Object(o["resolveComponent"])("router-link"),h=Object(o["resolveComponent"])("ErrorMessage");return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",a,[Object(o["createElementVNode"])("div",n,[Object(o["createElementVNode"])("div",{class:Object(o["normalizeClass"])(["form-box",{disabled:e.registration_disabled}])},[e.registration_disabled?(Object(o["openBlock"])(),Object(o["createBlock"])(v,{key:0,message:"user.REGISTER_DISABLED"})):Object(o["createCommentVNode"])("",!0),Object(o["createElementVNode"])("form",{onSubmit:t[4]||(t[4]=Object(o["withModifiers"])((function(t){return e.onSubmit(e.action)}),["prevent"]))},[Object(o["createElementVNode"])("div",c,["register"===e.action?Object(o["withDirectives"])((Object(o["openBlock"])(),Object(o["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)),[[o["vModelText"],e.formData.username]]):Object(o["createCommentVNode"])("",!0),"reset"!==e.action?Object(o["withDirectives"])((Object(o["openBlock"])(),Object(o["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)),[[o["vModelText"],e.formData.email]]):Object(o["createCommentVNode"])("",!0),"reset-request"!==e.action?Object(o["withDirectives"])((Object(o["openBlock"])(),Object(o["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)),[[o["vModelText"],e.formData.password]]):Object(o["createCommentVNode"])("",!0),["register","reset"].includes(e.action)?Object(o["withDirectives"])((Object(o["openBlock"])(),Object(o["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)),[[o["vModelText"],e.formData.password_conf]]):Object(o["createCommentVNode"])("",!0)]),Object(o["createElementVNode"])("button",{type:"submit",disabled:e.registration_disabled},Object(o["toDisplayString"])(e.$t(e.buttonText)),9,d)],32),"login"===e.action?(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",b,[Object(o["createVNode"])(y,{class:"links",to:"/register"},{default:Object(o["withCtx"])((function(){return[Object(o["createTextVNode"])(Object(o["toDisplayString"])(e.$t("user.REGISTER")),1)]})),_:1}),p,Object(o["createVNode"])(y,{class:"links",to:"/password-reset/request"},{default:Object(o["withCtx"])((function(){return[Object(o["createTextVNode"])(Object(o["toDisplayString"])(e.$t("user.PASSWORD_FORGOTTEN")),1)]})),_:1})])):Object(o["createCommentVNode"])("",!0),"register"===e.action?(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",O,[Object(o["createElementVNode"])("span",m,Object(o["toDisplayString"])(e.$t("user.ALREADY_HAVE_ACCOUNT")),1),Object(o["createVNode"])(y,{class:"links",to:"/login"},{default:Object(o["withCtx"])((function(){return[Object(o["createTextVNode"])(Object(o["toDisplayString"])(e.$t("user.LOGIN")),1)]})),_:1})])):Object(o["createCommentVNode"])("",!0),e.errorMessages?(Object(o["openBlock"])(),Object(o["createBlock"])(h,{key:3,message:e.errorMessages},null,8,["message"])):Object(o["createCommentVNode"])("",!0)],2)])])}var f=r("1da1"),k=(r("96cf"),r("6c02")),v=r("dad5"),y=r("2906"),h=Object(o["defineComponent"])({name:"UserAuthForm",props:{action:{type:String,required:!0},token:{type:String,default:""}},setup:function(e){var t=Object(o["reactive"])({username:"",email:"",password:"",password_conf:""}),r=Object(k["c"])(),a=Object(y["a"])(),n=Object(o["computed"])((function(){return u(e.action)})),c=Object(o["computed"])((function(){return a.getters[v["b"].GETTERS.ERROR_MESSAGES]})),s=Object(o["computed"])((function(){return a.getters[v["b"].GETTERS.APP_CONFIG]})),l=Object(o["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(o){switch(o){case"reset":return e.token?a.dispatch(v["a"].ACTIONS.RESET_USER_PASSWORD,{password:t.password,password_conf:t.password_conf,token:e.token}):a.commit(v["b"].MUTATIONS.SET_ERROR_MESSAGES,"user.INVALID_TOKEN");case"reset-request":return a.dispatch(v["a"].ACTIONS.SEND_PASSWORD_RESET_REQUEST,{email:t.email});default:a.dispatch(v["a"].ACTIONS.LOGIN_OR_REGISTER,{actionType:o,formData:t,redirectUrl:r.query.from})}}function d(){t.username="",t.email="",t.password="",t.password_conf=""}return Object(o["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:a.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("147f"),r("6b0d")),w=r.n(S);const E=w()(h,[["render",j],["__scopeId","data-v-3bb54ae5"]]);t["a"]=E},"0ccb":function(e,t,r){var o=r("e330"),a=r("50c4"),n=r("577e"),c=r("1148"),s=r("1d80"),l=o(c),u=o("".slice),i=Math.ceil,d=function(e){return function(t,r,o){var c,d,b=n(s(t)),p=a(r),O=b.length,m=void 0===o?" ":n(o);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){},"147f":function(e,t,r){"use strict";r("bd16")},"21d8":function(e,t,r){"use strict";r("647c")},"224d":function(e,t,r){"use strict";r("8d2d")},"24cc":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){},4682:function(e,t,r){},"4d90":function(e,t,r){"use strict";var o=r("23e7"),a=r("0ccb").start,n=r("9a0c");o({target:"String",proto:!0,forced:n},{padStart:function(e){return a(this,e,arguments.length>1?arguments[1]:void 0)}})},"4fad":function(e,t,r){var o=r("23e7"),a=r("6f53").entries;o({target:"Object",stat:!0},{entries:function(e){return a(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 o=r("83ab"),a=r("e330"),n=r("df75"),c=r("fc6a"),s=r("d1e7").f,l=a(s),u=a([].push),i=function(e){return function(t){var r,a=c(t),s=n(a),i=s.length,d=0,b=[];while(i>d)r=s[d++],o&&!l(a,r)||u(b,e?[r,a[r]]:a[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 o=r("7a23"),a=function(e){return Object(o["pushScopeId"])("data-v-ad6483fc"),e=e(),Object(o["popScopeId"])(),e},n={key:0,id:"dashboard",class:"view"},c={class:"container mobile-menu"},s={class:"box"},l=a((function(){return Object(o["createElementVNode"])("i",{class:"fa fa-bar-chart","aria-hidden":"true"},null,-1)})),u=[l],i=a((function(){return Object(o["createElementVNode"])("i",{class:"fa fa-calendar","aria-hidden":"true"},null,-1)})),d=[i],b=a((function(){return Object(o["createElementVNode"])("i",{class:"fa fa-map-o","aria-hidden":"true"},null,-1)})),p=[b],O=a((function(){return Object(o["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=a((function(){return Object(o["createElementVNode"])("div",{id:"bottom"},null,-1)})),h={key:1,class:"app-loading"};function S(e,t,r,a,l,i){var b=Object(o["resolveComponent"])("UserStatsCards"),O=Object(o["resolveComponent"])("UserMonthStats"),S=Object(o["resolveComponent"])("UserRecords"),w=Object(o["resolveComponent"])("UserCalendar"),E=Object(o["resolveComponent"])("Timeline"),C=Object(o["resolveComponent"])("Loader");return e.authUser.username&&e.sports.length>0?(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",n,[Object(o["createElementVNode"])("div",c,[Object(o["createElementVNode"])("div",s,[Object(o["createElementVNode"])("div",{class:Object(o["normalizeClass"])(["mobile-menu-item",{"is-selected":"chart"===e.isSelected}]),onClick:t[0]||(t[0]=function(t){return e.updateDisplayColumn("chart")})},u,2),Object(o["createElementVNode"])("div",{class:Object(o["normalizeClass"])(["mobile-menu-item",{"is-selected":"calendar"===e.isSelected}]),onClick:t[1]||(t[1]=function(t){return e.updateDisplayColumn("calendar")})},d,2),Object(o["createElementVNode"])("div",{class:Object(o["normalizeClass"])(["mobile-menu-item",{"is-selected":"timeline"===e.isSelected}]),onClick:t[2]||(t[2]=function(t){return e.updateDisplayColumn("timeline")})},p,2),Object(o["createElementVNode"])("div",{class:Object(o["normalizeClass"])(["mobile-menu-item",{"is-selected":"records"===e.isSelected}]),onClick:t[3]||(t[3]=function(t){return e.updateDisplayColumn("records")})},m,2)])]),Object(o["createElementVNode"])("div",j,[Object(o["createVNode"])(b,{user:e.authUser},null,8,["user"])]),Object(o["createElementVNode"])("div",f,[Object(o["createElementVNode"])("div",k,[Object(o["createVNode"])(O,{sports:e.sports,user:e.authUser,class:Object(o["normalizeClass"])({"is-hidden":!("chart"===e.isSelected)})},null,8,["sports","user","class"]),Object(o["createVNode"])(S,{sports:e.sports,user:e.authUser,class:Object(o["normalizeClass"])({"is-hidden":!("records"===e.isSelected)})},null,8,["sports","user","class"])]),Object(o["createElementVNode"])("div",v,[Object(o["createVNode"])(w,{sports:e.sports,user:e.authUser,class:Object(o["normalizeClass"])({"is-hidden":!("calendar"===e.isSelected)})},null,8,["sports","user","class"]),Object(o["createVNode"])(E,{sports:e.sports,user:e.authUser,class:Object(o["normalizeClass"])({"is-hidden":!("timeline"===e.isSelected)})},null,8,["sports","user","class"])])]),y])):(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",h,[Object(o["createVNode"])(C)]))}function w(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r<t;r++)o[r]=e[r];return o}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,a,n,c){var s=Object(o["resolveComponent"])("WorkoutCard"),l=Object(o["resolveComponent"])("NoWorkouts");return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",D,[Object(o["createElementVNode"])("div",V,Object(o["toDisplayString"])(e.$t("workouts.LATEST_WORKOUTS")),1),e.user.nb_workouts>0&&0===e.workouts.length?(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",_,[(Object(o["openBlock"])(!0),Object(o["createElementBlock"])(o["Fragment"],null,Object(o["renderList"])(B(Array(e.initWorkoutsCount).keys()),(function(t){return Object(o["openBlock"])(),Object(o["createBlock"])(s,{user:e.user,key:t},null,8,["user"])})),128))])):(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",T,[(Object(o["openBlock"])(!0),Object(o["createElementBlock"])(o["Fragment"],null,Object(o["renderList"])(e.workouts,(function(t){return Object(o["openBlock"])(),Object(o["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(o["openBlock"])(),Object(o["createBlock"])(l,{key:0})):Object(o["createCommentVNode"])("",!0),e.moreWorkoutsExist?(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",M,[Object(o["createElementVNode"])("button",{onClick:t[0]||(t[0]=function(){return e.loadMoreWorkouts&&e.loadMoreWorkouts.apply(e,arguments)})},Object(o["toDisplayString"])(e.$t("workouts.LOAD_MORE_WORKOUT")),1)])):Object(o["createCommentVNode"])("",!0)]))])}var x=r("5530"),R=function(e){return Object(o["pushScopeId"])("data-v-99d3cd20"),e=e(),Object(o["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(o["createElementVNode"])("i",{class:"fa fa-clock-o","aria-hidden":"true"},null,-1)})),H={key:0},Y={class:"data"},K=R((function(){return Object(o["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(o["createElementVNode"])("i",{class:"fa fa-location-arrow","aria-hidden":"true"},null,-1)})),re={class:"data-values"};function oe(e,t,r,a,n,c){var s=Object(o["resolveComponent"])("UserPicture"),l=Object(o["resolveComponent"])("router-link"),u=Object(o["resolveComponent"])("StaticMap"),i=Object(o["resolveComponent"])("SportImage");return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",A,[Object(o["createElementVNode"])("div",U,[Object(o["createElementVNode"])("div",q,[Object(o["createElementVNode"])("div",L,[Object(o["createVNode"])(s,{user:e.user},null,8,["user"]),e.user.username?(Object(o["openBlock"])(),Object(o["createBlock"])(l,{key:0,class:"workout-user-name",to:{name:"User",params:{username:e.user.username}}},{default:Object(o["withCtx"])((function(){return[Object(o["createTextVNode"])(Object(o["toDisplayString"])(e.user.username),1)]})),_:1},8,["to"])):Object(o["createCommentVNode"])("",!0)]),e.workout?(Object(o["openBlock"])(),Object(o["createBlock"])(l,{key:0,class:"workout-title",to:{name:"Workout",params:{workoutId:e.workout.id}}},{default:Object(o["withCtx"])((function(){return[Object(o["createTextVNode"])(Object(o["toDisplayString"])(e.workout.title),1)]})),_:1},8,["to"])):Object(o["createCommentVNode"])("",!0),e.workout&&e.user?(Object(o["openBlock"])(),Object(o["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(o["toDisplayString"])(e.formatDistance(new Date(e.workout.workout_date),new Date,{addSuffix:!0,locale:e.locale})),9,W)):Object(o["createCommentVNode"])("",!0)]),Object(o["createElementVNode"])("div",{class:Object(o["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(o["openBlock"])(),Object(o["createElementBlock"])("div",F,[e.workout.with_gpx?(Object(o["openBlock"])(),Object(o["createBlock"])(u,{key:0,workout:e.workout},null,8,["workout"])):(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",P,Object(o["toDisplayString"])(e.$t("workouts.NO_MAP")),1))])):Object(o["createCommentVNode"])("",!0)],2),Object(o["createElementVNode"])("div",{class:Object(o["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(o["createElementVNode"])("div",$,[e.sport?(Object(o["openBlock"])(),Object(o["createBlock"])(i,{key:0,"sport-label":e.sport.label},null,8,["sport-label"])):Object(o["createCommentVNode"])("",!0)]),Object(o["createElementVNode"])("div",G,[z,e.workout?(Object(o["openBlock"])(),Object(o["createElementBlock"])("span",H,Object(o["toDisplayString"])(e.workout.moving),1)):Object(o["createCommentVNode"])("",!0)]),Object(o["createElementVNode"])("div",Y,[K,e.workout?(Object(o["openBlock"])(),Object(o["createElementBlock"])("span",X,Object(o["toDisplayString"])(e.workout.distance)+" km",1)):Object(o["createCommentVNode"])("",!0)]),e.workout&&e.workout.with_gpx?(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",J,[Object(o["createElementVNode"])("img",{class:"mountains",src:"/img/workouts/mountains.svg",alt:e.$t("workouts.ELEVATION")},null,8,Z),Object(o["createElementVNode"])("div",Q,[Object(o["createElementVNode"])("span",null,Object(o["toDisplayString"])(e.workout.min_alt)+"/",1),Object(o["createElementVNode"])("span",null,Object(o["toDisplayString"])(e.workout.max_alt)+" m ",1)])])):Object(o["createCommentVNode"])("",!0),e.workout&&e.workout.with_gpx?(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",ee,[te,Object(o["createElementVNode"])("div",re,[Object(o["createElementVNode"])("span",null,"+ "+Object(o["toDisplayString"])(e.workout.ascent)+"/",1),Object(o["createElementVNode"])("span",null,"- "+Object(o["toDisplayString"])(e.workout.descent)+" m ",1)])])):Object(o["createCommentVNode"])("",!0)],2)])])}var ae=r("b166"),ne=r("fd3a"),ce=r("8c86");function se(e,t){Object(ce["a"])(2,arguments);var r=Object(ne["a"])(e),o=Object(ne["a"])(t),a=r.getTime()-o.getTime();return a<0?-1:a>0?1:a}function le(e,t){Object(ce["a"])(2,arguments);var r=Object(ne["a"])(e),o=Object(ne["a"])(t),a=r.getFullYear()-o.getFullYear(),n=r.getMonth()-o.getMonth();return 12*a+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,o=Object(ne["a"])(e),a=Object(ne["a"])(t),n=se(o,a),c=Math.abs(le(o,a));if(c<1)r=0;else{1===o.getMonth()&&o.getDate()>27&&o.setDate(30),o.setMonth(o.getMonth()-n*c);var s=se(o,a)===-n;de(Object(ne["a"])(e))&&1===c&&1===se(e,a)&&(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 o=pe(e,t)/1e3;return je(null===r||void 0===r?void 0:r.roundingMethod)(o)}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 o=r.locale||ke["a"];if(!o.formatDistance)throw new RangeError("locale must contain formatDistance property");var a=se(e,t);if(isNaN(a))throw new RangeError("Invalid time value");var n,c,s=ye(r);s.addSuffix=Boolean(r.addSuffix),s.comparison=a,a>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?o.formatDistance("lessThanXSeconds",5,s):u<10?o.formatDistance("lessThanXSeconds",10,s):u<20?o.formatDistance("lessThanXSeconds",20,s):u<40?o.formatDistance("halfAMinute",null,s):u<60?o.formatDistance("lessThanXMinutes",1,s):o.formatDistance("xMinutes",1,s):0===d?o.formatDistance("lessThanXMinutes",1,s):o.formatDistance("xMinutes",d,s);if(d<45)return o.formatDistance("xMinutes",d,s);if(d<90)return o.formatDistance("aboutXHours",1,s);if(d<Se){var b=Math.round(d/60);return o.formatDistance("aboutXHours",b,s)}if(d<we)return o.formatDistance("xDays",1,s);if(d<Ee){var p=Math.round(d/Se);return o.formatDistance("xDays",p,s)}if(d<Ce)return l=Math.round(d/Ee),o.formatDistance("aboutXMonths",l,s);if(l=be(c,n),l<12){var O=Math.round(d/Ee);return o.formatDistance("xMonths",O,s)}var m=l%12,j=Math.floor(l/12);return m<3?o.formatDistance("aboutXYears",j,s):m<9?o.formatDistance("overXYears",j,s):o.formatDistance("almostXYears",j+1,s)}var Ne=r("68c6"),Be=r("c46a"),De=r("dad5"),Ve=r("2906"),_e=r("5e65"),Te=Object(o["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(o["computed"])((function(){return e.getters[De["b"].GETTERS.LOCALE]}));return{format:ae["a"],formatDistance:ge,getDateWithTZ:_e["c"],locale:t}}}),Me=(r("702c"),r("6b0d")),Ie=r.n(Me);const xe=Ie()(Te,[["render",oe],["__scopeId","data-v-99d3cd20"]]);var Re=xe,Ae=r("1724"),Ue=r("9230"),qe=Object(o["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(o["ref"])(1),a=5,n=e.user.nb_workouts>=a?a:e.user.nb_workouts;Object(o["onBeforeMount"])((function(){return l()}));var c=Object(o["computed"])((function(){return t.getters[De["f"].GETTERS.TIMELINE_WORKOUTS]})),s=Object(o["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:a},Ue["a"]))}function u(){r.value+=1,t.dispatch(De["f"].ACTIONS.GET_MORE_TIMELINE_WORKOUTS,Object(x["a"])({page:r.value,per_page:a},Ue["a"]))}return{initWorkoutsCount:n,moreWorkoutsExist:s,per_page:a,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,a,n,c){var s=Object(o["resolveComponent"])("CalendarHeader"),l=Object(o["resolveComponent"])("CalendarDays"),u=Object(o["resolveComponent"])("CalendarCells");return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",Fe,[Object(o["createElementVNode"])("div",Pe,[Object(o["createVNode"])(s,{day:e.day,"locale-options":"enGB",onDisplayNextMonth:e.displayNextMonth,onDisplayPreviousMonth:e.displayPreviousMonth},null,8,["day","onDisplayNextMonth","onDisplayPreviousMonth"]),Object(o["createVNode"])(l,{"start-date":e.calendarDates.start,"locale-options":"enGB"},null,8,["start-date"]),Object(o["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,a,n,c){var s=Object(o["resolveComponent"])("CalendarWorkouts");return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",He,[(Object(o["openBlock"])(!0),Object(o["createElementBlock"])(o["Fragment"],null,Object(o["renderList"])(e.rows,(function(t,r){return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",{class:"calendar-row",key:r},[(Object(o["openBlock"])(!0),Object(o["createElementBlock"])(o["Fragment"],null,Object(o["renderList"])(t,(function(t,r){return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",{class:Object(o["normalizeClass"])(["calendar-cell",{"disabled-cell":!e.isSameMonth(t,e.currentDay),"week-end":e.isWeekEnd(r),today:e.isToday(t)}]),key:r},[Object(o["createVNode"])(s,{workouts:e.filterWorkouts(t,e.workouts),sports:e.sports},null,8,["workouts","sports"]),Object(o["createElementVNode"])("div",Ye,Object(o["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),o=Je(t);return r.getTime()===o.getTime()}function Qe(e,t){Object(ce["a"])(2,arguments);var r=Object(ne["a"])(e),o=Object(ne["a"])(t);return r.getFullYear()===o.getFullYear()&&r.getMonth()===o.getMonth()}function et(e){return Object(ce["a"])(1,arguments),Ze(e,Date.now())}var tt={class:"calendar-workouts"},rt={class:"desktop-display"},ot={key:0,class:"workouts-display"},at={key:1,class:"donut-display"},nt={class:"mobile-display"},ct={key:0,class:"donut-display"};function st(e,t,r,a,n,c){var s=Object(o["resolveComponent"])("CalendarWorkout"),l=Object(o["resolveComponent"])("CalendarWorkoutsChart");return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",tt,[Object(o["createElementVNode"])("div",rt,[e.workouts.length<=e.displayedWorkoutCount?(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",ot,[(Object(o["openBlock"])(!0),Object(o["createElementBlock"])(o["Fragment"],null,Object(o["renderList"])(e.workouts.slice(0,e.displayedWorkoutCount),(function(t,r){return Object(o["openBlock"])(),Object(o["createBlock"])(s,{key:r,workout:t,sportLabel:e.getSportLabel(t,e.sports)},null,8,["workout","sportLabel"])})),128))])):(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",at,[Object(o["createVNode"])(l,{workouts:e.workouts,sports:e.sports,datasets:e.chartDatasets,colors:e.colors},null,8,["workouts","sports","datasets","colors"])]))]),Object(o["createElementVNode"])("div",nt,[e.workouts.length>0?(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",ct,[Object(o["createVNode"])(l,{workouts:e.workouts,sports:e.sports,datasets:e.chartDatasets,colors:e.colors},null,8,["workouts","sports","datasets","colors"])])):Object(o["createCommentVNode"])("",!0)])])}r("d81d");var lt=["title"];function ut(e,t,r,a,n,c){var s=Object(o["resolveComponent"])("SportImage");return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",{class:"calendar-workout",onClick:t[0]||(t[0]=function(t){return e.$router.push({name:"Workout",params:{workoutId:e.workout.id}})})},[Object(o["createVNode"])(s,{"sport-label":e.sportLabel,title:e.workout.title},null,8,["sport-label","title"]),Object(o["createElementVNode"])("sup",null,[e.workout.records.length>0?(Object(o["openBlock"])(),Object(o["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(o["createCommentVNode"])("",!0)])])}var it=r("47e2"),dt=Object(o["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,a,n,c){var s=Object(o["resolveComponent"])("DonutChart"),l=Object(o["resolveComponent"])("CalendarWorkout"),u=Object(o["resolveDirective"])("click-outside");return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",Ot,[Object(o["createElementVNode"])("div",{class:"workouts-chart",onClick:t[0]||(t[0]=function(){return e.togglePane&&e.togglePane.apply(e,arguments)})},[Object(o["createElementVNode"])("div",mt,Object(o["toDisplayString"])(e.workouts.length),1),Object(o["createVNode"])(s,{datasets:e.datasets,colors:e.colors},null,8,["datasets","colors"])]),e.isHidden?Object(o["createCommentVNode"])("",!0):(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",jt,[Object(o["withDirectives"])(Object(o["createElementVNode"])("div",ft,[Object(o["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(o["openBlock"])(!0),Object(o["createElementBlock"])(o["Fragment"],null,Object(o["renderList"])(e.workouts,(function(t,r){return Object(o["openBlock"])(),Object(o["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,a,n,c){return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",vt,[(Object(o["openBlock"])(),Object(o["createElementBlock"])("svg",yt,[(Object(o["openBlock"])(!0),Object(o["createElementBlock"])(o["Fragment"],null,Object(o["renderList"])(Object.entries(e.datasets),(function(t,r){return Object(o["openBlock"])(),Object(o["createElementBlock"])("g",{key:r},[Object(o["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(o["defineComponent"])({name:"DonutChart",props:{colors:{type:Object,required:!0},datasets:{type:Object,required:!0}},setup:function(){var e=-90,t=16,r=16,o=14,a=2*Math.PI*o;function n(e,t){return t-e*t}function c(o,a){var n="rotate(".concat(e,", ").concat(t,", ").concat(r,")");return e=360*a+e,n}return{angleOffset:e,circumference:a,cx:t,cy:r,radius:o,calculateStrokeDashOffset:n,returnCircleTransformValue:c}}});const Et=Ie()(wt,[["render",St]]);var Ct=Et,gt=r("1119"),Nt=Object(o["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(o["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(o["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(o["computed"])((function(){return Object(Ue["c"])(e.workouts)})),colors:Object(o["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(o["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(o["ref"])([]),r=Object(o["toRefs"])(e),a=r.startDate,n=r.endDate,c=r.weekStartingMonday;function s(){t.value=[];var e=a.value;while(e<=n.value){for(var r=[],o=0;o<7;o++)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(o["onMounted"])((function(){return s()})),Object(o["watch"])((function(){return e.currentDay}),(function(){return s()})),{rows:t,format:ae["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,a,n,c){return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",Rt,[(Object(o["openBlock"])(!0),Object(o["createElementBlock"])(o["Fragment"],null,Object(o["renderList"])(e.days,(function(t,r){return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",{class:"calendar-day",key:r},Object(o["toDisplayString"])(e.format(t,"EEE",e.localeOptions)),1)})),128))])}var Ut=Object(o["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:ae["a"]}}});r("5fcb");const qt=Ie()(Ut,[["render",At]]);var Lt=qt,Wt={class:"calendar-header"},Ft=Object(o["createElementVNode"])("i",{class:"fa fa-chevron-left","aria-hidden":"true"},null,-1),Pt=[Ft],$t={class:"calendar-month"},Gt=Object(o["createElementVNode"])("i",{class:"fa fa-chevron-right","aria-hidden":"true"},null,-1),zt=[Gt];function Ht(e,t,r,a,n,c){return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",Wt,[Object(o["createElementVNode"])("div",{class:"calendar-arrow calendar-arrow-left",onClick:t[0]||(t[0]=function(t){return e.emit("displayPreviousMonth")})},Pt),Object(o["createElementVNode"])("div",$t,[Object(o["createElementVNode"])("span",null,Object(o["toDisplayString"])(e.format(e.day,"MMM yyyy",e.localeOptions)),1)]),Object(o["createElementVNode"])("div",{class:"calendar-arrow calendar-arrow-right",onClick:t[1]||(t[1]=function(t){return e.emit("displayNextMonth")})},zt)])}var Yt=Object(o["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:ae["a"]}}});r("e4ea");const Kt=Ie()(Yt,[["render",Ht]]);var Xt=Kt,Jt=Object(o["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(o["onBeforeMount"])((function(){return s()}));var r="yyyy-MM-dd",a=Object(o["ref"])(new Date),n=Object(o["ref"])(Object(_e["b"])(a.value,e.user.weekm)),c=Object(o["computed"])((function(){return t.getters[De["f"].GETTERS.CALENDAR_WORKOUTS]}));function s(){n.value=Object(_e["b"])(a.value,e.user.weekm);var o=Object(x["a"])({from:Object(ae["a"])(n.value.start,r),to:Object(ae["a"])(n.value.end,r),page:1,per_page:100},Ue["a"]);t.dispatch(De["f"].ACTIONS.GET_CALENDAR_WORKOUTS,o)}function l(){a.value=Object(Ge["a"])(a.value,1),s()}function u(){a.value=Object(ze["a"])(a.value,1),s()}return{day:a,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,a,n,c){var s=Object(o["resolveComponent"])("StatChart"),l=Object(o["resolveComponent"])("Card");return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",er,[Object(o["createVNode"])(l,null,{title:Object(o["withCtx"])((function(){return[Object(o["createTextVNode"])(Object(o["toDisplayString"])(e.$t("dashboard.THIS_MONTH")),1)]})),content:Object(o["withCtx"])((function(){return[Object(o["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"),or=r("ec59"),ar=Object(o["defineComponent"])({name:"UserMonthStats",components:{StatChart:or["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()(ar,[["render",tr],["__scopeId","data-v-7958b39f"]]);var cr=nr,sr=(r("b64b"),r("4e82"),function(e){return Object(o["pushScopeId"])("data-v-080b37ac"),e=e(),Object(o["popScopeId"])(),e}),lr={class:"user-records-section"},ur={class:"section-title"},ir=sr((function(){return Object(o["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,a,n,c){var s=Object(o["resolveComponent"])("RecordsCard");return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",lr,[Object(o["createElementVNode"])("div",ur,[ir,Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.$t("workouts.RECORD",2)),1)]),Object(o["createElementVNode"])("div",dr,[0===Object.keys(e.recordsBySport).length?(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",br,Object(o["toDisplayString"])(e.$t("workouts.NO_RECORDS")),1)):Object(o["createCommentVNode"])("",!0),(Object(o["openBlock"])(!0),Object(o["createElementBlock"])(o["Fragment"],null,Object(o["renderList"])(Object.keys(e.recordsBySport).sort(),(function(t){return Object(o["openBlock"])(),Object(o["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,a,n,c){var s=Object(o["resolveComponent"])("SportImage"),l=Object(o["resolveComponent"])("router-link"),u=Object(o["resolveComponent"])("Card");return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",Or,[Object(o["createVNode"])(u,null,{title:Object(o["withCtx"])((function(){return[Object(o["createVNode"])(s,{"sport-label":e.records.label},null,8,["sport-label"]),Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.sportTranslatedLabel),1)]})),content:Object(o["withCtx"])((function(){return[(Object(o["openBlock"])(!0),Object(o["createElementBlock"])(o["Fragment"],null,Object(o["renderList"])(e.records.records,(function(t){return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",{class:"record",key:t.id},[Object(o["createElementVNode"])("span",mr,Object(o["toDisplayString"])(e.t("workouts.RECORD_".concat(t.record_type))),1),Object(o["createElementVNode"])("span",jr,Object(o["toDisplayString"])(t.value),1),Object(o["createElementVNode"])("span",fr,[Object(o["createVNode"])(l,{to:{name:"Workout",params:{workoutId:t.workout_id}}},{default:Object(o["withCtx"])((function(){return[Object(o["createTextVNode"])(Object(o["toDisplayString"])(t.workout_date),1)]})),_:2},1032,["to"])])])})),128))]})),_:1})])}var vr=Object(o["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,o){var a=t.find((function(e){return e.id===o.sport_id}));return a&&a.label&&(void 0===e[a.translatedLabel]&&(e[a.translatedLabel]={label:a.label,records:[]}),e[a.translatedLabel].records.push(Sr(o,r))),e}),{})},Er=Object(o["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,a=Object(o["computed"])((function(){return wr(e.user.records,Object(gt["d"])(e.sports,r),e.user.timezone)}));return{recordsBySport:a}}});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,a,n,c){var s=Object(o["resolveComponent"])("StatCard");return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",Nr,[Object(o["createVNode"])(s,{icon:"calendar",value:e.user.nb_workouts,text:e.$t("workouts.WORKOUT",e.user.nb_workouts)},null,8,["value","text"]),Object(o["createVNode"])(s,{icon:"road",value:Number(e.user.total_distance).toFixed(2),text:e.$t("workouts.KM")},null,8,["value","text"]),Object(o["createVNode"])(s,{icon:"clock-o",value:e.total_duration.days,text:e.total_duration.duration},null,8,["value","text"]),Object(o["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(o["defineComponent"])({name:"UserStatsCards",components:{StatCard:Dr["a"]},props:{user:{type:Object,required:!0}},setup:function(e){var t=Object(it["b"])(),r=t.t,a=Object(o["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(o["computed"])((function(){return n(a)}))}}});r("d224");const _r=Ie()(Vr,[["render",Br]]);var Tr=_r,Mr=Object(o["defineComponent"])({name:"Dashboard",components:{Timeline:We,UserCalendar:Qt,UserMonthStats:cr,UserRecords:gr,UserStatsCards:Tr},setup:function(){var e=Object(Ve["a"])(),t=Object(o["computed"])((function(){return e.getters[De["a"].GETTERS.AUTH_USER_PROFILE]})),r=Object(o["computed"])((function(){return e.getters[De["c"].GETTERS.SPORTS]})),a=Object(o["ref"])("chart");function n(e){a.value=e}return{authUser:t,sports:r,isSelected:a,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 o=r("b166"),a=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),o=7*r;return Object(j["a"])(e,o)}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=[],o=Object(y["d"])(e.duration,e.start,t);o<=e.end;o=Object(y["e"])(e.duration,o))r.push(o);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,a,n){var c=E(e,t),s=S[e.duration],l=r.filter((function(e){return a.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(o["a"])(e,s.api),r=Object(o["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 o=r?1:0,n="year"===t?Object(a["a"])(l(e,9)):"week"===t?Object(u["a"])(Object(i["a"])(e,2),{weekStartsOn:o}):Object(d["a"])(Object(i["a"])(e,11)),c="year"===t?p(e):"week"===t?Object(O["a"])(e,{weekStartsOn:o}):Object(m["a"])(e);return{duration:t,end:c,start:n}},D=function(e,t,r){var o=e.duration,n=e.start,s=e.end,b=r?1:0;return{duration:o,end:"year"===o?p(t?l(s,1):Object(c["a"])(s,1)):"week"===o?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"===o?Object(a["a"])(t?l(n,1):Object(c["a"])(n,1)):"week"===o?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){},"8def":function(e,t,r){},9080:function(e,t,r){},"92c3":function(e,t,r){},"9a0c":function(e,t,r){var o=r("342f");e.exports=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(o)},a0b1:function(e,t,r){},a618:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var o=r("fe1f"),a=r("74b5"),n=r("8c86");function c(e,t){Object(n["a"])(2,arguments);var r=Object(o["a"])(t);return Object(a["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){},bd16:function(e,t,r){},c11a:function(e,t,r){"use strict";r("b3b8")},c1a9:function(e,t,r){},c71e:function(e,t,r){"use strict";r("8def")},ccb2:function(e,t,r){"use strict";r.r(t);var o=r("7a23"),a={id:"statistics",class:"view"},n={key:0,class:"container"};function c(e,t,r,c,s,l){var u=Object(o["resolveComponent"])("Statistics"),i=Object(o["resolveComponent"])("Card"),d=Object(o["resolveComponent"])("NoWorkouts");return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",a,[e.authUser.username?(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",n,[Object(o["createVNode"])(i,null,{title:Object(o["withCtx"])((function(){return[Object(o["createTextVNode"])(Object(o["toDisplayString"])(e.$t("statistics.STATISTICS")),1)]})),content:Object(o["withCtx"])((function(){return[Object(o["createVNode"])(u,{class:Object(o["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(o["openBlock"])(),Object(o["createBlock"])(d,{key:0})):Object(o["createCommentVNode"])("",!0)])):Object(o["createCommentVNode"])("",!0)])}r("4de4"),r("d3b7"),r("caad"),r("2532");var s={key:0,id:"user-statistics"};function l(e,t,r,a,n,c){var l=Object(o["resolveComponent"])("StatsMenu"),u=Object(o["resolveComponent"])("StatChart"),i=Object(o["resolveComponent"])("SportsMenu");return e.translatedSports?(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",s,[Object(o["createVNode"])(l,{onTimeFrameUpdate:e.updateTimeFrame,onArrowClick:e.handleOnClickArrows},null,8,["onTimeFrameUpdate","onArrowClick"]),Object(o["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(o["createVNode"])(i,{"selected-sport-ids":e.selectedSportIds,"user-sports":e.sports,onSelectedSportIdsUpdate:e.updateSelectedSportIds},null,8,["selected-sport-ids","user-sports","onSelectedSportIdsUpdate"])])):Object(o["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,a,n,c){return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",d,[Object(o["createElementVNode"])("div",b,[Object(o["createElementVNode"])("i",{class:"fa fa-chevron-left","aria-hidden":"true",onClick:t[0]||(t[0]=function(t){return e.emit("arrowClick",!0)})})]),Object(o["createElementVNode"])("div",p,[Object(o["createElementVNode"])("div",O,[(Object(o["openBlock"])(!0),Object(o["createElementBlock"])(o["Fragment"],null,Object(o["renderList"])(e.timeFrames,(function(t){return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",{class:"time-frame custom-checkbox",key:t},[Object(o["createElementVNode"])("label",null,[Object(o["createElementVNode"])("input",{type:"radio",id:t,name:t,checked:e.selectedTimeFrame===t,onInput:function(r){return e.onUpdateTimeFrame(t)}},null,40,m),Object(o["createElementVNode"])("span",null,Object(o["toDisplayString"])(e.$t("statistics.TIME_FRAMES.".concat(t))),1)])])})),128))])]),Object(o["createElementVNode"])("div",j,[Object(o["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(o["defineComponent"])({name:"StatsMenu",emits:["arrowClick","timeFrameUpdate"],setup:function(e,t){var r=t.emit,a=Object(o["ref"])("month"),n=["week","month","year"];function c(e){a.value=e,r("timeFrameUpdate",e)}return{selectedTimeFrame:a,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,a,n,c){var s=Object(o["resolveComponent"])("SportImage");return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",w,[(Object(o["openBlock"])(!0),Object(o["createElementBlock"])(o["Fragment"],null,Object(o["renderList"])(e.translatedSports,(function(t){return Object(o["openBlock"])(),Object(o["createElementBlock"])("label",{type:"checkbox",key:t.id,style:Object(o["normalizeStyle"])({color:e.sportColors[t.label]})},[Object(o["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(o["createVNode"])(s,{"sport-label":t.label},null,8,["sport-label"]),Object(o["createElementVNode"])("span",C,Object(o["toDisplayString"])(t.translatedLabel),1)],4)})),128))])}var N=r("1119"),B=Object(o["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,a=Object(u["b"])(),n=a.t,c=Object(o["computed"])((function(){return Object(N["d"])(e.userSports,n)}));function s(e){r("selectedSportIdsUpdate",e)}return{sportColors:Object(o["inject"])("sportColors"),translatedSports:c,updateSelectedSportIds:s}}});r("fd14");const D=y()(B,[["render",g]]);var V=D,_=r("7416"),T=Object(o["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,a=Object(o["ref"])("month"),n=["week","month","year"],c=Object(o["ref"])(d(a.value)),s=Object(o["computed"])((function(){return Object(N["d"])(e.sports,r)})),l=Object(o["ref"])(p(e.sports));function i(e){a.value=e,c.value=d(a.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(o["watch"])((function(){return e.sports}),(function(e){l.value=p(e)})),{chartParams:c,selectedTimeFrame:a,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(o["defineComponent"])({name:"StatisticsView",components:{NoWorkouts:x["a"],Statistics:I},setup:function(){var e=Object(A["a"])(),t=Object(o["computed"])((function(){return e.getters[R["a"].GETTERS.AUTH_USER_PROFILE]})),r=Object(o["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 o=r("7a23"),a={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(o["resolveComponent"])("BikePic"),b=Object(o["resolveComponent"])("LoginOrRegisterForm");return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",a,[Object(o["createElementVNode"])("div",n,[Object(o["createElementVNode"])("div",c,[Object(o["createVNode"])(d)]),Object(o["createElementVNode"])("div",s,[Object(o["createVNode"])(b,{action:e.action},null,8,["action"])])])])}var u={id:"about"},i=["src"];function d(e,t,r,a,n,c){return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",u,[Object(o["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(o["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 o=r("746f");o("iterator")},d3c0:function(e,t,r){"use strict";r("cfa1")},e01a:function(e,t,r){"use strict";var o=r("23e7"),a=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(a&&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}}),o({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 o=r("7a23"),a={class:"not-found view"};function n(e,t,r,n,c,s){var l=Object(o["resolveComponent"])("NotFound");return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",a,[Object(o["createVNode"])(l)])}var c=r("f7f9"),s=Object(o["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")},ec59:function(e,t,r){"use strict";var o=r("7a23"),a={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(o["resolveComponent"])("Chart");return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",a,[e.hideChartIfNoData&&e.emptyStats?(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",n,Object(o["toDisplayString"])(e.$t("workouts.NO_WORKOUTS")),1)):(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",c,[Object(o["createElementVNode"])("div",s,[Object(o["createElementVNode"])("label",null,[Object(o["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(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.$t("workouts.DISTANCE")),1)]),Object(o["createElementVNode"])("label",null,[Object(o["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(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.$t("workouts.DURATION")),1)]),Object(o["createElementVNode"])("label",null,[Object(o["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(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.$t("workouts.WORKOUT",2)),1)]),e.fullStats?(Object(o["openBlock"])(),Object(o["createElementBlock"])("label",d,[Object(o["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(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.$t("workouts.ASCENT")),1)])):Object(o["createCommentVNode"])("",!0),e.fullStats?(Object(o["openBlock"])(),Object(o["createElementBlock"])("label",p,[Object(o["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(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.$t("workouts.DESCENT")),1)])):Object(o["createCommentVNode"])("",!0)]),e.labels.length>0?(Object(o["openBlock"])(),Object(o["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(o["createCommentVNode"])("",!0)]))])}var j=r("1da1"),f=(r("96cf"),r("b0c0"),r("b64b"),r("b166")),k={class:"chart"};function v(e,t,r,a,n,c){var s=Object(o["resolveComponent"])("BarChart");return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",k,[Object(o["createVNode"])(s,Object(o["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 o=String(Math.floor(e/3600)).padStart(2,"0");e%=3600;var a=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"===o?"":"".concat(o,"h ")).concat(a,"m ").concat(n,"s"):"".concat("00"===o?"":"".concat(o,":")).concat(a,":").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(o["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 a(e){return isNaN(e)?0:+e}function n(e,t){return a(e)+a(t)}var c=Object(o["computed"])((function(){return{labels:e.labels,datasets:JSON.parse(JSON.stringify(e.datasets))}})),s=Object(o["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 o=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&&o>0?w(e.displayedData,o,!1):null}},legend:{display:!1},tooltip:{interaction:{intersect:!0,mode:"index"},filter:function(e){return"0"!==e.formattedValue},callbacks:{label:function(t){var o=r("sports.".concat(t.dataset.label,".LABEL"))||"";return o&&(o+=": "),null!==t.parsed.y&&(o+=w(e.displayedData,t.parsed.y)),o},footer:function(t){var o=0;return t.map((function(e){o+=e.parsed.y})),"".concat(r("common.TOTAL"),": ")+w(e.displayedData,o)}}}}}})),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(o["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(o["ref"])("total_distance"),a=Object(o["computed"])((function(){return t.getters[D["d"].GETTERS.USER_STATS]})),n=Object(o["computed"])((function(){return Object(_["a"])(e.chartParams,e.user.weekm,e.sports,e.displayedSportIds,a.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(o["onBeforeMount"])((function(){return c(l(e.chartParams,e.user))})),Object(o["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(o["computed"])((function(){return n.value.datasets[r.value]})),labels:Object(o["computed"])((function(){return n.value.labels})),emptyStats:Object(o["computed"])((function(){return 0===Object.keys(a.value).length})),displayedData:r,updateDisplayData:s}}});r("c71e");const M=g()(T,[["render",m],["__scopeId","data-v-6566dd7e"]]);t["a"]=M},f153:function(e,t,r){},fb6a:function(e,t,r){"use strict";var o=r("23e7"),a=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=a.Array,k=Math.max;o({target:"Array",proto:!0,forced:!m},{slice:function(e,t){var r,o,a,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(o=new(void 0===r?f:r)(k(v-m,0)),a=0;m<v;m++,a++)m in b&&d(o,a,b[m]);return o.length=a,o}})},fd0a:function(e,t,r){},fd14:function(e,t,r){"use strict";r("4682")}}]);
//# sourceMappingURL=main.265d6693.js.map