(this.webpackJsonpfittrackee_client=this.webpackJsonpfittrackee_client||[]).push([[0],{198:function(e){e.exports=JSON.parse('{"Workouts":"Workouts","Workout":"Workout","Workout Date":"Workout Date","Add a workout":"Add a workout","Are you sure you want to delete this workout?":"Are you sure you want to delete this workout?","Ave. speed":"Ave. speed","Ascent":"Ascent","Average speed":"Average speed","Chart":"Chart","data from gpx, without any cleaning":"data from gpx, without any cleaning","Date":"Date","Delete workout":"Delete workout","Descent":"Descent","Distance":"Distance","distance":"distance","Duration":"Duration","duration":"duration","Edit a workout":"Edit a workout","Edit workout":"Edit workout","elevation":"elevation","End":"End","Farest distance":"Farest distance","Filter":"Filter","From":"From","gpxFile":"gpx file","Longest duration":"Longest duration","Max. altitude":"Max. altitude","Max. speed":"Max. speed","Min. altitude":"Min. altitude","no folder inside":"no folder inside","files max":"files max","max size":"max size","No data to display":"No data to display","No Map":"No Map","No next workout":"No next workout","No next segment":"No next segment","No notes":"No notes","No previous workout":"No previous workout","No previous segment":"No previous segment","Notes":"Notes","pauses":"pauses","Personal records":"Personal records","See next workout":"See next workout","See next segment":"See next segment","See previous workout":"See previous workout","See previous segment":"See previous segment","segment":"segment","Segments":"Segments","speed":"speed","Start":"Start","Title":"Title","To":"To","total duration":"total duration","with gpx file":"with gpx file","without gpx file":"without gpx file","zipFile":"or zip file containing gpx files"}')},199:function(e){e.exports=JSON.parse('{"Actions":"Actions","Active":"Active","workouts exist":"workouts exist","Add admin rights":"Add admin rights","Add/remove admin rights, delete user account.":"Add/remove admin rights, delete user account.","Administration":"Administration","Application":"Application","Application configuration":"Application configuration","Back":"Back","Disable":"Disable","Enable":"Enable","Enable/disable sports.":"Enable/disable sports.","FitTrackee administration":"FitTrackee administration","id":"id","if 0, no limitation":"if 0, no limitation","Image":"Image","Label":"Label","Max. number of active users":"Max. number of active users","Max. files of zip archive":"Max. files of zip archive","Max. size of uploaded files":"Max. size of uploaded files","Max. size of uploaded files (in Mb)":"Max. size of uploaded files (in Mb)","Max. size of zip archive":"Max. size of zip archive","Max. size of zip archive (in Mb)":"Max. size of zip archive (in Mb)","Registration is currently disabled.":"Registration is currently disabled.","Registration is currently enabled.":"Registration is currently enabled.","Remove admin rights":"Remove admin rights","Sports":"Sports","Update application configuration (maximum number of registered users, maximum files size).":"Update application configuration (maximum number of registered users, maximum files size).","uploads":"uploads","user":"user","Users":"Users","users":"users"}')},200:function(e){e.exports=JSON.parse('{"workouts count":"workouts count","Add workout":"Add workout","admin rights":"admin rights","ascending":"ascending","Back":"Back","Back to home":"Back to home","Cancel":"Cancel","Confirmation":"Confirmation","Dashboard":"Dashboard","descending":"descending","Edit":"Edit","day":"day","days":"days","Next":"Next","No":"No","no":"no","No records.":"No records.","No workouts.":"No workouts.","Page not found":"Page not found","Previous":"Prev","registration date":"registration date","Sort":"Sort","Sort by":"Sort by","Sport":"Sport","sport":"sport","Sports":"Sports","sports":"sports","Statistics":"Statistics","Submit":"Submit","to":"to","user name":"user name","Workout":"Workout","Workouts":"Workouts","workout":"workout","workouts":"workouts","Yes":"Yes","yes":"yes"}')},201:function(e){e.exports=JSON.parse('{"Personal records":"Personal records","This month":"This month","Upload one !":"Upload one !"}')},202:function(e){e.exports=JSON.parse('{"3 to 12 characters required for username.":"3 to 12 characters required for username.","8 characters required for password.":"8 characters required for password.","An error occurred. Please contact the administrator.":"An error occurred. Please contact the administrator.","workouts":"workouts","Error during picture deletion.":"Error during picture deletion.","Error during picture update.":"Error during picture update.","Error during picture update, file size exceeds max size.":"Error during picture update, file size exceeds max size.","Error. Registration is disabled.":"Error. Registration is disabled.","Error. Please try again or contact the administrator.":"Error. Please try again or contact the administrator.","File extension not allowed.":"File extension not allowed.","File size is greater than the allowed size":"File size is greater than the allowed size","Incorrect id":"Incorrect id","Invalid credentials.":"Invalid credentials.","Invalid payload.":"Invalid payload.","Invalid token. Please log in again.":"Invalid token. Please log in again.","No file part.":"No file part.","No picture.":"No picture.","No selected file.":"No selected file.","no correct file.":"no correct file.","no gpx file for this workout":"no gpx file for this workout","Password and password confirmation don\'t match.":"Password and password confirmation don\'t match.","Provide a valid auth token":"Provide a valid auth token","records":"records","Signature expired. Please log in again.":"Signature expired. Please log in again.","Sorry. That user already exists.":"Sorry. That user already exists.","Sport can not be disabled, workouts exist.":"Sport can not be disabled, workouts exist.","Sport does not exist.":"Sport does not exist.","sports":"sports","statistics":"statistiques","User does not exist.":"User does not exist.","Valid email must be provided.\\n":"Valid email must be provided.","You can not delete your account, no other user has admin rights.":"You can not delete your account, no other user has admin rights.","You do not have permissions.":"You do not have permissions."}')},203:function(e){e.exports=JSON.parse('{"Cycling (Sport)":"Cycling (Sport)","Cycling (Transport)":"Cycling (Transport)","Hiking":"Hiking","Mountain Biking":"Mountain Biking","Running":"Running","Walking":"Walking"}')},204:function(e){e.exports=JSON.parse('{"workouts":"workouts","distance":"distance","duration":"duration","month":"month","Statistics":"Statistics","year":"year","week":"week"}')},205:function(e){e.exports=JSON.parse('{"Admin":"Admin","Are you sure you want to delete this account? All data will be deleted, this cannot be undone.":"Are you sure you want to delete this account? All data will be deleted, this cannot be undone.","Are you sure you want to delete your account? All data will be deleted, this cannot be undone.":"Are you sure you want to delete your account? All data will be deleted, this cannot be undone.","Bio":"Bio","Birth Date":"Birth Date","Check your email. If your address is in our database, you\'ll received an email with a link to reset your password.":"Check your email. If your address is in our database, you\'ll received an email with a link to reset your password.","Delete my account":"Delete my account","Delete picture":"Delete picture","Delete user account":"Delete user account","Edit Profile":"Edit Profile","Email":"Email","Enter a username":"Enter a username","Enter an email address":"Enter an email address","Enter a password":"Enter a password","Enter the password confirmation":"Enter the password confirmation","First day of week":"First day of week","First Name":"First Name","Forgot password?":"Forgot password?","Invalid token. Please request a new token.":"Invalid token. Please request a new token.","Language":"Language","Last Name":"Last Name","Location":"Location","loggedOut":"You are now logged out. Click <1>here to log back in.","Login":"Login","login":"login","Logout":"Logout","Monday":"Monday","Password":"Password","Password Confirmation":"Password Confirmation","Password reset":"Password reset","password reset":"password reset","Profile":"Profile","Profile Edition":"Profile Edition","Register":"Register","register":"register","Registration Date":"Registration Date","Reset your password":"Reset your password","reset your password":"reset your password","Send":"Send","Sunday":"Sunday","Timezone":"Timezone","updatedPasswordText":"Your password have been updated. Click <1>here to log in.","Username":"Username"}')},206:function(e){e.exports=JSON.parse('{"Workouts":"S\xe9ances","Workout":"S\xe9ance","Workout Date":"Date de l\'s\xe9ance","Add a workout":"Ajouter une s\xe9ance","Are you sure you want to delete this workout?":"Etes-vous s\xfbr de vouloir supprimer cette s\xe9ance ?","Ave. speed":"Vitesse moyenne","Ascent":"D\xe9nivel\xe9 positif","Average speed":"Vitesse moyenne","Chart":"Analyse","data from gpx, without any cleaning":"donn\xe9es issues du fichier gpx, sans correction","Date":"Date","Delete workout":"Supprimer l\'s\xe9ance","Descent":"D\xe9nivel\xe9 n\xe9gatif","Distance":"Distance","distance":"distance","Duration":"Dur\xe9e","duration":"dur\xe9e","Edit a workout":"Editer une s\xe9ance","Edit workout":"Editer une workout","elevation":"altitude","End":"Arriv\xe9e","Farest distance":"Distance la + longue","Filter":"Filtrer","From":"A partir de","gpxFile":"fichier gpx","Longest duration":"Dur\xe9e la + longue","Max. altitude":"Altitude max","Max. speed":"Vitesse max","Min. altitude":"Altitude min","no folder inside":"pas de r\xe9pertoire","files max":" fichiers max","max size":"taille max","No data to display":"Pas de donn\xe9es \xe0 afficher","No Map":"Pas de carte","No next workout":"Pas d\'s\xe9ance suivante","No next segment":"Pas de segment suivant","No notes":"Pas de notes","No previous workout":"Pas d\'s\xe9ance pr\xe9c\xe9dente","No previous segment":"Pas de segment pr\xe9c\xe9dent","Notes":"Notes","pauses":"pauses","Personal records":"Records personnels","See next workout":"Voir l\'s\xe9ance suivante","See next segment":"Voir le segment suivant","See previous workout":"Voir l\'s\xe9ance pr\xe9c\xe9dente","See previous segment":"Voir le segment pr\xe9c\xe9dent","segment":"segment","Segments":"Segments","Start":"D\xe9part","speed":"vitesse","Title":"Titre","To":"Jusqu\'au","total duration":"dur\xe9e totale","with gpx file":"avec un fichier gpx","without gpx file":"sans fichier gpx","zipFile":"ou un fichier zip contenant des fichiers gpx"}')},207:function(e){e.exports=JSON.parse('{"Actions":"Actions","Active":"Active","Add admin rights":"Ajouter des droits d\'admin","Add/remove admin rights, delete user account.":"Ajouter/retirer des droits d\'adminsitration, supprimer des comptes utilisateurs.","Administration":"Administration","workouts exist":"des s\xe9ances existent","Application":"Application","Application configuration":"Configuration de l\'application","Back":"Retour","Disable":"d\xe9sactiver","Enable":"activer","Enable/disable sports.":"Activer/d\xe9sactiver des sports.","FitTrackee administration":"Administration de FitTrackee","id":"id","if 0, no limitation":"si \xe9gal \xe0 0, pas limite d\'inscription","Image":"Image","Label":"Label","Max. number of active users":"Nombre maximum d\'utilisateurs actifs","Max. files of zip archive":"Nombre max. de fichiers dans une archive zip","Max. size of uploaded files":"Taille max. des fichiers","Max. size of uploaded files (in Mb)":"Taille max. des fichiers (en Mo)","Max. size of zip archive":"Taille max. des archives zip","Max. size of zip archive (in Mb)":"Taille max. des archives zip (en Mo)","Registration is currently disabled.":"Les inscriptions sont actuellement d\xe9sactiv\xe9es.","Registration is currently enabled.":"Les inscriptions sont actuellement activ\xe9es.","Remove admin rights":"Retirer des droits d\'admin","Sports":"Sports","Update application configuration (maximum number of registered users, maximum files size).":"Configurer l\'application (nombre maximum d\'utilisateurs inscrits, taille maximale des fichers).","uploads":"fichiers","user":"user","Users":"Utilisateurs","users":"utilisateurs"}')},208:function(e){e.exports=JSON.parse('{"workouts count":"nombre d\'s\xe9ances","Add workout":"Ajouter une s\xe9ance","admin rights":"droits d\'admin","ascending":"ascendant","Back":"Revenir \xe0 la page pr\xe9c\xe9dente","Back to home":"Retour \xe0 l\'accueil","Cancel":"Annuler","Confirmation":"Confirmation","Dashboard":"Tableau de Bord","descending":"descendant","Edit":"Modifier","day":"jour","days":"jours","Next":"Page suivante","No":"Non","no":"non","No records.":"Pas de records.","No workouts.":"Pas d\'s\xe9ances.","Page not found":"Page introuvable","Previous":"Page pr\xe9c\xe9dente","registration date":"date d\'inscription","Sort":"Tri","Sort by":"Trier par","Sport":"Sport","sport":"sport","Sports":"Sports","sports":"sports","Statistics":"Statistiques","Submit":"Valider","to":"\xe0","user name":"utilisateur","Workout":"S\xe9ance","Workouts":"S\xe9ances","workout":"s\xe9ance","workouts":"s\xe9ances","Yes":"Oui","yes":"oui"}')},209:function(e){e.exports=JSON.parse('{"Personal records":"Mes records","This month":"Ce mois","Upload one !":"Ajoutez votre premi\xe8re s\xe9ance !"}')},210:function(e){e.exports=JSON.parse('{"3 to 12 characters required for username.":"3 \xe0 12 caract\xe8res requis pour le nom.","8 characters required for password.":"8 caract\xe8res minimum pour le mot de passe.","An error occurred. Please contact the administrator.":"Une erreur s\'est produite. Merci de contacter l\'administrateur.","workouts":"s\xe9ances","Error during picture deletion.":"Erreur lors de la suppression de l\'image.","Error during picture update.":"Erreur lors de la mise \xe0 jour de l\'image.","Error during picture update, file size exceeds max size.":"Erreur lors de la mise \xe0 jour de l\'image, la taille du ficher d\xe9passe la taille maximum autoris\xe9e","Error. Registration is disabled.":"Erreur. L\'inscription est d\xe9sactiv\xe9e.","Error. Please try again or contact the administrator.":"Erreur. Veuillez r\xe9essayer ou contacter l\'administrateur","File extension not allowed.":"Extension de fichier non autoris\xe9e.","File size is greater than the allowed size":"La taille du fichier est sup\xe9rieure \xe0 la limite autoris\xe9e","Incorrect id":"Id incorrect","Invalid credentials.":"Identifiants invalides.","Invalid payload.":"Donn\xe9es incorrectes.","Invalid token. Please log in again.":"Jeton invalide. Merci de vous reconnecter.","No file part.":"Pas de fichier fourni.","No picture.":"Pas d\'image.","No selected file.":"Pas de fichier s\xe9lectionn\xe9.","no correct file.":"fichier incorrect","no gpx file for this workout":"pas de fichier gpx pour cette s\xe9ance","Password and password confirmation don\'t match.":"Les mots de passe saisis sont diff\xe9rents.","Provide a valid auth token":"Merci de fournir un jeton valide","records":"records","Signature expired. Please log in again.":"Signature expir\xe9e. Merci de vous reconnecter.","Sorry. That user already exists.":"D\xe9sol\xe9. Cet utilisateur existe d\xe9j\xe0.","Sport can not be disabled, workouts exist.":"Le sport ne peut \xeatre d\xe9sactiv\xe9, des s\xe9ancees existent","Sport does not exist.":"Le sport n\'existe pas.","sports":"sports","statistics":"statistics","User does not exist.":"L\'utilisateur n\'existe pas.","Valid email must be provided.\\n":"L\'email fourni n\'est pas valide.","You can not delete your account, no other user has admin rights.":"Vous ne pouvez pas supprimer votre compte, aucun autre utilisateur n\'a des droits d\'administration.","You do not have permissions.":"Vous n\'avez pas les permissions n\xe9cessaires."}')},211:function(e){e.exports=JSON.parse('{"Cycling (Sport)":"V\xe9lo (Sport)","Cycling (Transport)":"V\xe9lo (Transport)","Hiking":"Randonn\xe9e","Mountain Biking":"VTT","Running":"Course","Walking":"Marche"}')},212:function(e){e.exports=JSON.parse('{"workouts":"s\xe9ances","distance":"distance","duration":"dur\xe9e","month":"mois","Statistics":"Statistiques","year":"ann\xe9e","week":"semaine"}')},213:function(e){e.exports=JSON.parse('{"Admin":"Admin","Are you sure you want to delete this account? All data will be deleted, this cannot be undone.":"Etes-vous s\xfbr de vouloir supprimer ce compte ? Toutes les donn\xe9es seront d\xe9finitivement effac\xe9s.","Are you sure you want to delete your account? All data will be deleted, this cannot be undone.":"Etes-vous s\xfbr de vouloir supprimer votre compte ? Toutes les donn\xe9es seront d\xe9finitivement effac\xe9s.","Bio":"Bio","Birth Date":"Date de naissance","Check your email. If your address is in our database, you\'ll received an email with a link to reset your password.":"V\xe9rifiez vore boite mail. Si vote adresse est dans notre base de donn\xe9es, vous recevrez un email avec un lien pour r\xe9initialiser votre mot de passe","Delete my account":"Supprimer mon compte","Delete picture":"Supprimer l\'image","Delete user account":"Supprimer le compte","Edit Profile":"Editer le profil","Email":"Email","Enter a username":"Saisir un nom","Enter an email address":"Saisir une adresse e-mail","Enter a password":"Saisir un mot de passe","Enter the password confirmation":"Confirmer le mot de passe","First day of week":"Premier jour de la semaine","First Name":"Pr\xe9nom","Forgot password?":"Mot de passe oubli\xe9 ?","Invalid token. Please request a new token.":"Token invalid. Veuillez demander un nouveau token.","Language":"Langue","Last Name":"Nom","Location":"Lieu","loggedOut":"Vous \xeates d\xe9connect\xe9. Cliquez <1>ici pour vous reconnecter.","Login":"Se connecter","login":"se connecter","Logout":"Se d\xe9connecter","Monday":"Lundi","Password":"Mot de passe","Password Confirmation":"Confirmation du mot de passe","Password reset":"R\xe9initialiser votre mot de passe","password reset":"r\xe9initialiser votre mot de passe","Profile":"Profil","Profile Edition":"Edition du profil","Register":"S\'inscrire","register":"s\'inscrire","Registration Date":"Date d\'inscription","Reset your password":"R\xe9initialiser votre mot de passe","reset your password":"r\xe9initialiser votre mot de passe","Send":"Envoyer","Sunday":"Dimanche","Timezone":"Fuseau horaire","updatedPasswordText":"Votre mot de passe a \xe9t\xe9 mis \xe0 jour. Cliquez <1>ici pour vous connecter.","Username":"Nom d\'utilisateur"}')},273:function(e,t,a){},281:function(e,t){},463:function(e,t,a){"use strict";a.r(t),a.d(t,"history",(function(){return Ws})),a.d(t,"rootNode",(function(){return qs})),a.d(t,"store",(function(){return Bs}));var s=a(1),r=a(29),n=a(2),o=a.n(n),c=a(483),i=a(53),l=a.n(i),d=a(194),u=a(57),m=a(195),j=a(81),p=a(196),h=a(197),b={en:{workouts:a(198),administration:a(199),common:a(200),dashboard:a(201),messages:a(202),sports:a(203),statistics:a(204),user:a(205)},fr:{workouts:a(206),administration:a(207),common:a(208),dashboard:a(209),messages:a(210),sports:a(211),statistics:a(212),user:a(213)}};j.a.use(h.a).use(p.a).init({debug:!1,lng:"en",fallbackLng:"en",keySeparator:!1,interpolation:{escapeValue:!1},resources:b,ns:["common"],defaultNS:"common"});var O=j.a,f=a(6),x=a(7),g=a(10),v=a(9),k=a(8),w=a(19),y=(a(273),a(20)),N=a(466),_=function(e){Object(g.a)(a,e);var t=Object(v.a)(a);function a(){return Object(f.a)(this,a),t.apply(this,arguments)}return Object(x.a)(a,[{key:"render",value:function(){var e=this.props,t=e.message,a=e.messages,r=e.t,n=""!==t&&t?t.split("|").length>1?"".concat(r("messages:".concat(t.split("|")[0])),": ").concat(r("messages:".concat(t.split("|")[1]))):r("messages:".concat(t)):"";return Object(s.jsxs)("div",{className:"error-message",children:[""!==n&&Object(s.jsx)("code",{children:n}),a&&a.length>0&&Object(s.jsx)("code",{children:Object(s.jsx)("ul",{children:a.map((function(e){return Object(s.jsx)("li",{children:r("messages:".concat(e.value))},e.id)}))})})]})}}]),a}(o.a.PureComponent),S=a(12),D=a(485),C=a(484),E=a(218);const A=["bytes","KB","MB","GB","TB"],M=(e,t=!0)=>{const a=Math.floor(Math.log(e)/Math.log(1024));if(!e)return t?"0 bytes":{size:0,suffix:"bytes"};const s=(e/Math.pow(1024,a)).toFixed(1),r=A[a];return t?"".concat(s).concat(r):{size:s,suffix:r}},T="/api/",P=[{key:"workouts_count",label:"workouts count"},{key:"admin",label:"admin rights"},{key:"created_at",label:"registration date"},{key:"username",label:"user name"}],F=[{key:"asc",label:"ascending"},{key:"desc",label:"descending"}],z=()=>!!window.localStorage.authToken,R=e=>{const t={};e.noAuthorization||(t.Authorization="Bearer ".concat(window.localStorage.getItem("authToken"))),e.type&&(t["Content-Type"]=e.type);const a={method:e.method,headers:t};"application/json"===e.type&&e.body?a.body=JSON.stringify(e.body):e.body&&(a.body=e.body);const s=new Request("".concat(T).concat(e.url),a);return fetch(s).then((t=>"DELETE"===e.method||413===t.status?t:t.json())).catch((e=>(console.error(e),new Error("An error occurred. Please contact the administrator."))))},L=(e,t)=>{if(!e)return"";const a=E.DateTime.fromISO(Object(D.a)(new Date(e),"yyyy-MM-dd'T'HH:mm:ss.SSSxxx")).setZone(t);return Object(C.a)(a.toFormat("yyyy-MM-dd HH:mm:ss"),"yyyy-MM-dd HH:mm:ss",new Date)},U=(e,t)=>{const a=e.label.toLowerCase(),s=t.label.toLowerCase();return a>s?1:at.map((t=>Object(S.a)(Object(S.a)({},t),{},{label:e("".concat(a,":").concat(t.label))}))).sort(U),W=(e,t)=>{let a=e;return t.id||"users"===e&&t.username?a="".concat(a,"/").concat(t.username?t.username:t.id):Object.keys(t).length>0&&(a+="?",Object.keys(t).filter((e=>t[e])).map(((e,s)=>a+="".concat(0===s?"":"&").concat(e,"=").concat(t[e])))),a};var H=function(){function e(){Object(f.a)(this,e)}return Object(x.a)(e,null,[{key:"getData",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=W(e,t),s={url:a,method:"GET",type:"application/json"};return R(s)}},{key:"addData",value:function(e,t){return R({url:e,method:"POST",body:t,type:"application/json"})}},{key:"addDataWithFile",value:function(e,t){return R({url:e,method:"POST",body:t})}},{key:"postData",value:function(e,t){var a={url:"".concat(e).concat(t.id?"/".concat(t.id):""),method:"POST",body:t,type:"application/json"};return R(a)}},{key:"updateData",value:function(e,t){var a={url:"".concat(e).concat(t.id?"/".concat(t.id):t.username?"/".concat(t.username):""),method:"PATCH",body:t,type:"application/json"};return R(a)}},{key:"deleteData",value:function(e,t){var a={url:"".concat(e,"/").concat(t),method:"DELETE",type:"application/json"};return R(a)}}]),e}(),q=function(e,t){return{type:"SET_DATA",data:t,target:e}},B=function(e,t,a){return{type:"SET_PAGINATED_DATA",data:t,pagination:a,target:e}},V=function(e){return{type:"SET_ERROR",message:e}},G=function(e){return{type:"SET_LOADING",loading:e}},J=function(e){return{type:"UPDATE_SPORT_DATA",data:e}},K=function(e){return{type:"UPDATE_USER_DATA",data:e}},Y=function(e,t,a){var s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];return function(r){return r(G(!0)),a&&a.id&&"workouts"!==t&&isNaN(a.id)?(r(G(!1)),r(V("".concat(t,"|Incorrect id")))):(r(V("")),H[e](t,a).then((function(a){if("success"===a.status)if(s){if("users"===t&&"getData"===e)return r(B(t,a.data,a.pagination));r(q(t,a.data))}else"updateData"===e&&"sports"===t?r(J(a.data.sports[0])):"updateData"===e&&"users"===t&&r(K(a.data.users[0]));else r(V("".concat(t,"|").concat(a.message||a.status)));r(G(!1))})).catch((function(e){r(G(!1)),r(V("".concat(t,"|").concat(e)))})))}},X=function(e){return function(t){j.a.changeLanguage(e).then(t(function(e){return{type:"SET_LANGUAGE",language:e}}(e)))}},$=function(e){return{type:"SET_APP_CONFIG",data:e}},Z=function(e){return function(t){return H.getData(e).then((function(a){"success"===a.status?"config"===e?t($(a.data)):"stats/all"===e&&t({type:"SET_APP_STATS",data:a.data}):t(V("application|".concat(a.message)))})).catch((function(e){return t(V("application|".concat(e)))}))}},Q=function(e){Object(g.a)(a,e);var t=Object(v.a)(a);function a(e,s){var r;return Object(f.a)(this,a),(r=t.call(this,e,s)).state={formData:{},isInEdition:!1},r}return Object(x.a)(a,[{key:"componentDidMount",value:function(){this.initForm()}},{key:"componentDidUpdate",value:function(e){this.props.appConfig!==e.appConfig&&this.initForm()}},{key:"initForm",value:function(){var e=this.props.appConfig,t={};Object.keys(e).map((function(a){return null===e[a]?t[a]="":["max_single_file_size","max_zip_file_size"].includes(a)?t[a]=+(e[a]/1048576).toFixed(2):t[a]=e[a]})),this.setState({formData:t})}},{key:"handleFormChange",value:function(e){var t=this.state.formData;t[e.target.name]=+e.target.value,this.setState(t)}},{key:"toggleInEdition",value:function(e){e.preventDefault();var t=this.state.isInEdition;this.setState({isInEdition:!t})}},{key:"render",value:function(){var e=this,t=this.props,a=t.message,r=t.onHandleConfigFormSubmit,n=t.t,o=this.state,c=o.formData,i=o.isInEdition;return Object(s.jsxs)("div",{children:[a&&Object(s.jsx)(_,{message:a,t:n}),Object.keys(c).length>0&&Object(s.jsx)("div",{className:"row",children:Object(s.jsx)("div",{className:"col-md-12",children:Object(s.jsxs)("div",{className:"card",children:[Object(s.jsx)("div",{className:"card-header",children:Object(s.jsx)("strong",{children:n("administration:Application configuration")})}),Object(s.jsx)("div",{className:"card-body",children:Object(s.jsxs)("form",{className:"app-config-form ".concat(i?"":"form-disabled"),onSubmit:function(t){e.toggleInEdition(t),r(c)},children:[Object(s.jsxs)("div",{className:"form-group row",children:[Object(s.jsxs)("label",{className:"col-sm-6 col-form-label",htmlFor:"max_users",children:[n("administration:Max. number of active users"),Object(s.jsx)("sup",{children:Object(s.jsx)("i",{className:"fa fa-question-circle","aria-hidden":"true",title:n("administration:if 0, no limitation")})}),":"]}),Object(s.jsx)("input",{className:"col-sm-5",id:"max_users",name:"max_users",type:"number",min:"0",value:c.max_users,onChange:function(t){return e.handleFormChange(t)}})]}),Object(s.jsxs)("div",{className:"form-group row",children:[Object(s.jsxs)("label",{className:"col-sm-6 col-form-label",htmlFor:"max_single_file_size",children:[n("administration:Max. size of uploaded files (in Mb)"),":"]}),Object(s.jsx)("input",{className:"col-sm-5",id:"max_single_file_size",name:"max_single_file_size",type:"number",step:"0.1",min:"0",value:c.max_single_file_size,onChange:function(t){return e.handleFormChange(t)}})]}),Object(s.jsxs)("div",{className:"form-group row",children:[Object(s.jsxs)("label",{className:"col-sm-6 col-form-label",htmlFor:"max_zip_file_size",children:[n("administration:Max. size of zip archive (in Mb)"),":"]}),Object(s.jsx)("input",{className:"col-sm-5",id:"max_zip_file_size",name:"max_zip_file_size",type:"number",step:"0.1",min:"0",value:c.max_zip_file_size,onChange:function(t){return e.handleFormChange(t)}})]}),Object(s.jsxs)("div",{className:"form-group row",children:[Object(s.jsx)("label",{className:"col-sm-6 col-form-label",htmlFor:"gpx_limit_import",children:n("administration:Max. files of zip archive")}),Object(s.jsx)("input",{className:"col-sm-5",id:"gpx_limit_import",name:"gpx_limit_import",type:"number",min:"0",value:c.gpx_limit_import,onChange:function(t){return e.handleFormChange(t)}})]}),i?Object(s.jsxs)(s.Fragment,{children:[Object(s.jsx)("input",{type:"submit",className:"btn btn-primary",value:n("common:Submit")}),Object(s.jsx)("input",{type:"submit",className:"btn btn-secondary",onClick:function(t){return e.toggleInEdition(t)},value:n("common:Cancel")})]}):Object(s.jsxs)(s.Fragment,{children:[Object(s.jsx)("input",{type:"submit",className:"btn btn-primary",onClick:function(t){e.toggleInEdition(t)},value:n("common:Edit")}),Object(s.jsx)("input",{type:"submit",className:"btn btn-secondary",onClick:function(){return Ws.push("/admin")},value:n("common:Back")})]})]})})]})})})]})}}]),a}(o.a.Component),ee=Object(k.c)((function(e){return{message:e.message}}),(function(e){return{onHandleConfigFormSubmit:function(t){var a=Object.assign({},t);a.max_single_file_size*=1048576,a.max_zip_file_size*=1048576,e(function(e){return function(t){return H.updateData("config",e).then((function(e){"success"===e.status?t($(e.data)):t(V("application|".concat(e.message)))})).catch((function(e){return t(V("application|".concat(e)))}))}}(a))}}}))(Q),te=a(15),ae=function(e){Object(g.a)(a,e);var t=Object(v.a)(a);function a(){return Object(f.a)(this,a),t.apply(this,arguments)}return Object(x.a)(a,[{key:"componentDidMount",value:function(){this.props.loadAppStats()}},{key:"render",value:function(){var e=this.props,t=e.appStats,a=e.t,r=M(t.uploads_dir_size,!1);return Object(s.jsxs)("div",{className:"row",children:[Object(s.jsx)("div",{className:"col-lg-3 col-md-6 col-sm-6",children:Object(s.jsx)("div",{className:"card workout-card",children:Object(s.jsxs)("div",{className:"card-body row",children:[Object(s.jsx)("div",{className:"col-3",children:Object(s.jsx)("i",{className:"fa fa-users fa-3x fa-color"})}),Object(s.jsxs)("div",{className:"col-9 text-right",children:[Object(s.jsx)("div",{className:"huge",children:t.users?t.users:0}),Object(s.jsx)("div",{children:"".concat(1===t.users?a("administration:user"):a("administration:users"))})]})]})})}),Object(s.jsx)("div",{className:"col-lg-3 col-md-6 col-sm-6",children:Object(s.jsx)("div",{className:"card workout-card",children:Object(s.jsxs)("div",{className:"card-body row",children:[Object(s.jsx)("div",{className:"col-3",children:Object(s.jsx)("i",{className:"fa fa-tags fa-3x fa-color"})}),Object(s.jsxs)("div",{className:"col-9 text-right",children:[Object(s.jsx)("div",{className:"huge",children:t.sports?t.sports:0}),Object(s.jsx)("div",{children:"".concat(1===t.sports?a("common:sport"):a("common:sports"))})]})]})})}),Object(s.jsx)("div",{className:"col-lg-3 col-md-6 col-sm-6",children:Object(s.jsx)("div",{className:"card workout-card",children:Object(s.jsxs)("div",{className:"card-body row",children:[Object(s.jsx)("div",{className:"col-3",children:Object(s.jsx)("i",{className:"fa fa-calendar fa-3x fa-color"})}),Object(s.jsxs)("div",{className:"col-9 text-right",children:[Object(s.jsx)("div",{className:"huge",children:t.workouts?t.workouts:0}),Object(s.jsx)("div",{children:"".concat(1===t.workouts?a("common:workout"):a("common:workouts"))})]})]})})}),Object(s.jsx)("div",{className:"col-lg-3 col-md-6 col-sm-6",children:Object(s.jsx)("div",{className:"card workout-card",children:Object(s.jsxs)("div",{className:"card-body row",children:[Object(s.jsx)("div",{className:"col-3",children:Object(s.jsx)("i",{className:"fa fa-folder-open fa-3x fa-color"})}),Object(s.jsxs)("div",{className:"col-9 text-right",children:[Object(s.jsx)("div",{className:"huge",children:r.size}),Object(s.jsxs)("div",{children:[r.suffix," (",a("administration:uploads"),")"]})]})]})})})]})}}]),a}(o.a.Component),se=Object(N.a)()(Object(k.c)((function(e){return{appStats:e.application.statistics}}),(function(e){return{loadAppStats:function(){e(Z("stats/all"))}}}))(ae));function re(e){var t=e.appConfig,a=e.t;return Object(s.jsxs)("div",{className:"card workout-card",children:[Object(s.jsx)("div",{className:"card-header",children:Object(s.jsx)("strong",{children:a("administration:Administration")})}),Object(s.jsxs)("div",{className:"card-body",children:[Object(s.jsx)(se,{}),Object(s.jsx)("br",{}),Object(s.jsxs)("dl",{className:"admin-items",children:[Object(s.jsx)("dt",{children:Object(s.jsx)(te.a,{to:{pathname:"/admin/application"},children:a("administration:Application")})}),Object(s.jsxs)("dd",{children:[a("administration:Update application configuration (maximum number of registered users, maximum files size)."),Object(s.jsx)("br",{}),Object(s.jsx)("strong",{children:a("administration:Registration is currently ".concat(t.is_registration_enabled?"enabled":"disabled","."))})]}),Object(s.jsx)("br",{}),Object(s.jsx)("dt",{children:Object(s.jsx)(te.a,{to:{pathname:"/admin/sports"},children:a("administration:Sports")})}),Object(s.jsx)("dd",{children:a("administration:Enable/disable sports.")}),Object(s.jsx)("br",{}),Object(s.jsx)("dt",{children:Object(s.jsx)(te.a,{to:{pathname:"/admin/users"},children:a("administration:Users")})}),Object(s.jsx)("dd",{children:a("administration:Add/remove admin rights, delete user account.")})]})]})]})}var ne=function(e){Object(g.a)(a,e);var t=Object(v.a)(a);function a(){return Object(f.a)(this,a),t.apply(this,arguments)}return Object(x.a)(a,[{key:"componentDidMount",value:function(){this.props.loadSports()}},{key:"render",value:function(){var e=this.props,t=e.message,a=e.sports,r=e.t,n=e.updateSport;return Object(s.jsxs)("div",{children:[t&&Object(s.jsx)(_,{message:t,t:r}),Object(s.jsx)("div",{className:"row",children:Object(s.jsx)("div",{className:"col",children:Object(s.jsxs)("div",{className:"card",children:[Object(s.jsx)("div",{className:"card-header",children:Object(s.jsx)("strong",{children:r("administration:Sports")})}),Object(s.jsxs)("div",{className:"card-body",children:[a.length>0&&Object(s.jsxs)("table",{className:"table",children:[Object(s.jsx)("thead",{children:Object(s.jsxs)("tr",{children:[Object(s.jsx)("th",{children:r("administration:id")}),Object(s.jsx)("th",{children:r("administration:Image")}),Object(s.jsx)("th",{children:r("administration:Label")}),Object(s.jsx)("th",{children:r("administration:Active")}),Object(s.jsx)("th",{children:r("administration:Actions")})]})}),Object(s.jsx)("tbody",{children:a.map((function(e){return Object(s.jsxs)("tr",{children:[Object(s.jsxs)("td",{children:[Object(s.jsx)("span",{className:"heading-span-absolute",children:r("administration:id")}),e.id]}),Object(s.jsxs)("td",{children:[Object(s.jsx)("span",{className:"heading-span-absolute",children:r("administration:Image")}),Object(s.jsx)("img",{className:"admin-img",src:e.img?e.img:"/img/photo.png",alt:"sport logo"})]}),Object(s.jsxs)("td",{children:[Object(s.jsx)("span",{className:"heading-span-absolute",children:r("administration:Label")}),r("sports:".concat(e.label))]}),Object(s.jsxs)("td",{children:[Object(s.jsx)("span",{className:"heading-span-absolute",children:r("administration:Active")}),e.is_active?Object(s.jsx)("i",{className:"fa fa-check-square-o custom-fa","aria-hidden":"true","data-toggle":"tooltip"}):Object(s.jsx)("i",{className:"fa fa-square-o custom-fa","aria-hidden":"true","data-toggle":"tooltip"})]}),Object(s.jsxs)("td",{children:[Object(s.jsx)("span",{className:"heading-span-absolute",children:r("administration:Actions")}),Object(s.jsx)("input",{type:"submit",className:"btn btn-".concat(e.is_active?"dark":"primary"," btn-sm"),value:e.is_active?r("administration:Disable"):r("administration:Enable"),onClick:function(){return n(e.id,!e.is_active)}}),e.has_workouts&&Object(s.jsxs)("span",{className:"admin-message",children:[Object(s.jsx)("i",{className:"fa fa-warning custom-fa","aria-hidden":"true"}),r("administration:workouts exist")]})]})]},e.id)}))})]}),Object(s.jsx)("input",{type:"submit",className:"btn btn-secondary",onClick:function(){return Ws.push("/admin/")},value:r("common:Back")})]})]})})})]})}}]),a}(o.a.Component),oe=Object(k.c)((function(e){return{message:e.message,sports:e.sports.data,user:e.user}}),(function(e){return{loadSports:function(){e(Y("getData","sports"))},updateSport:function(t,a){e(Y("updateData","sports",{id:t,is_active:a},!1))}}}))(ne),ce=function(e){Object(g.a)(a,e);var t=Object(v.a)(a);function a(){return Object(f.a)(this,a),t.apply(this,arguments)}return Object(x.a)(a,[{key:"getUrl",value:function(e){var t=this.props,a=t.query,s=t.pathname,r=Object.assign({},a),n=a.page?+a.page:1;switch(e){case"prev":n-=1;break;case"next":n+=1;break;default:n=+e}return r.page=n,W(s,r)}},{key:"render",value:function(){var e,t=this,a=this.props,r=a.pagination,n=a.t;return Object(s.jsx)(s.Fragment,{children:r&&Object.keys(r).length>0&&Object(s.jsx)("nav",{"aria-label":"Page navigation example",children:Object(s.jsxs)("ul",{className:"pagination justify-content-center",children:[Object(s.jsx)("li",{className:"page-item ".concat(r.has_prev?"":"disabled"),children:Object(s.jsx)(te.a,{className:"page-link",to:this.getUrl("prev"),"aria-disabled":!r.has_prev,children:n("common:Previous")})}),(e=r.pages,Array.from({length:e},((e,t)=>t+1))).map((function(e){return Object(s.jsx)("li",{className:"page-item ".concat(e===r.page?"active":""),children:Object(s.jsx)(te.a,{className:"page-link",to:t.getUrl(e),children:e})},e)})),Object(s.jsx)("li",{className:"page-item ".concat(r.has_next?"":"disabled"),children:Object(s.jsx)(te.a,{className:"page-link",to:this.getUrl("next"),"aria-disabled":!r.has_next,children:n("common:Next")})})]})})})}}]),a}(o.a.PureComponent),ie=function(e){Object(g.a)(a,e);var t=Object(v.a)(a);function a(e,s){var r;return Object(f.a)(this,a),(r=t.call(this,e,s)).state={page:null,per_page:null,order_by:"created_at",order:"asc"},r}return Object(x.a)(a,[{key:"componentDidMount",value:function(){this.props.loadUsers(this.initState())}},{key:"componentDidUpdate",value:function(e){e.location.query!==this.props.location.query&&this.props.loadUsers(this.props.location.query)}},{key:"initState",value:function(){var e=this.props.location.query,t={page:e.page,per_page:e.per_page,order_by:e.order_by?e.order_by:"created_at",order:e.order?e.order:"asc"};return this.setState(t),t}},{key:"updatePage",value:function(e,t){var a=Object.assign({},this.state);a[e]=t,this.setState(a);var s=W(this.props.location.pathname,a);Ws.push(s)}},{key:"render",value:function(){var e=this,t=this.props,a=t.authUser,r=t.location,n=t.message,o=t.t,c=t.pagination,i=t.updateUser,l=t.users,d=I(o,P),u=I(o,F);return Object(s.jsxs)("div",{children:[n&&Object(s.jsx)(_,{message:n,t:o}),Object(s.jsx)("div",{className:"container",children:Object(s.jsx)("div",{className:"row",children:Object(s.jsx)("div",{className:"col",children:Object(s.jsxs)("div",{className:"card",children:[Object(s.jsx)("div",{className:"card-header",children:Object(s.jsx)("strong",{children:o("administration:Users")})}),Object(s.jsxs)("div",{className:"card-body",children:[Object(s.jsxs)("div",{className:"row user-filters",children:[Object(s.jsx)("div",{className:"col-lg-4 col-md-6 col-sm-12",children:Object(s.jsxs)("label",{htmlFor:"order_by",children:[o("common:Sort by"),":"," ",Object(s.jsx)("select",{id:"order_by",name:"order_by",value:this.state.order_by,onChange:function(t){return e.updatePage("order_by",t.target.value)},children:d.map((function(e){return Object(s.jsx)("option",{value:e.key,children:e.label},e.key)}))})," "]})}),Object(s.jsx)("div",{className:"col-lg-4 col-md-6 col-sm-12",children:Object(s.jsxs)("label",{htmlFor:"sort",children:[o("common:Sort"),":"," ",Object(s.jsx)("select",{id:"sort",name:"sort",value:this.state.order,onChange:function(t){return e.updatePage("order",t.target.value)},children:u.map((function(e){return Object(s.jsx)("option",{value:e.key,children:e.label},e.key)}))})," "]})})]}),Object(s.jsxs)("table",{className:"table",children:[Object(s.jsx)("thead",{children:Object(s.jsxs)("tr",{children:[Object(s.jsx)("th",{children:"#"}),Object(s.jsx)("th",{children:o("user:Username")}),Object(s.jsx)("th",{children:o("user:Email")}),Object(s.jsx)("th",{children:o("user:Registration Date")}),Object(s.jsx)("th",{children:o("workouts:Workouts")}),Object(s.jsx)("th",{children:o("user:Admin")}),Object(s.jsx)("th",{children:o("administration:Actions")})]})}),Object(s.jsx)("tbody",{children:l.map((function(e){return Object(s.jsxs)("tr",{children:[Object(s.jsxs)("td",{children:[Object(s.jsx)("span",{className:"heading-span-absolute",children:"#"}),!0===e.picture?Object(s.jsx)("img",{alt:"Avatar",src:"".concat(T,"users/").concat(e.username,"/picture?").concat(Date.now()),className:"img-fluid App-nav-profile-img"}):Object(s.jsx)("i",{className:"fa fa-user-circle-o fa-2x no-picture","aria-hidden":"true"})]}),Object(s.jsxs)("td",{children:[Object(s.jsx)("span",{className:"heading-span-absolute",children:o("user:Username")}),Object(s.jsx)(te.a,{to:"/users/".concat(e.username),children:e.username})]}),Object(s.jsxs)("td",{children:[Object(s.jsx)("span",{className:"heading-span-absolute",children:o("user:Email")}),e.email]}),Object(s.jsxs)("td",{children:[Object(s.jsx)("span",{className:"heading-span-absolute",children:o("user:Registration Date")}),Object(D.a)(new Date(e.created_at),"dd/MM/yyyy HH:mm")]}),Object(s.jsxs)("td",{children:[Object(s.jsx)("span",{className:"heading-span-absolute",children:o("workouts:Workouts")}),e.nb_workouts]}),Object(s.jsxs)("td",{children:[Object(s.jsx)("span",{className:"heading-span-absolute",children:o("user:Admin")}),e.admin?Object(s.jsx)("i",{className:"fa fa-check-square-o custom-fa","aria-hidden":"true","data-toggle":"tooltip"}):Object(s.jsx)("i",{className:"fa fa-square-o custom-fa","aria-hidden":"true","data-toggle":"tooltip"})]}),Object(s.jsxs)("td",{children:[Object(s.jsx)("span",{className:"heading-span-absolute",children:o("administration:Actions")}),Object(s.jsx)("input",{type:"submit",className:"btn btn-".concat(e.admin?"dark":"primary"," btn-sm"),disabled:e.username===a.username,value:e.admin?o("administration:Remove admin rights"):o("administration:Add admin rights"),onClick:function(){return i(e.username,!e.admin)}})]})]},e.username)}))})]}),Object(s.jsx)(ce,{pagination:c,pathname:r.pathname,query:this.state,t:o}),Object(s.jsx)("input",{type:"submit",className:"btn btn-secondary",onClick:function(){return Ws.push("/admin/")},value:o("common:Back")})]})]})})})})]})}}]),a}(o.a.Component),le=Object(k.c)((function(e){return{authUser:e.user,location:e.router.location,message:e.message,pagination:e.users.pagination,users:e.users.data}}),(function(e){return{loadUsers:function(t){e(Y("getData","users",t))},updateUser:function(t,a){e(Y("updateData","users",{username:t,admin:a},!1))}}}))(ie),de=a(219);function ue(){var e=Object(de.a)().t;return Object(s.jsxs)("div",{children:[Object(s.jsx)(y.a,{children:Object(s.jsx)("title",{children:"fittrackee - 404"})}),Object(s.jsx)("h1",{className:"page-title",children:e("Page not found")})]})}var me=Object(N.a)()(Object(k.c)((function(e){return{appConfig:e.application.config,user:e.user}}))((function(e){var t=e.appConfig,a=e.t,r=e.user;return Object(s.jsxs)(s.Fragment,{children:[Object(s.jsx)(y.a,{children:Object(s.jsxs)("title",{children:["FitTrackee - ",a("administration:Administration")]})}),Object(s.jsx)("div",{className:"container dashboard",children:r.admin?Object(s.jsxs)(w.d,{children:[Object(s.jsx)(w.b,{exact:!0,path:"/admin",render:function(){return Object(s.jsx)(re,{appConfig:t,t:a})}}),Object(s.jsx)(w.b,{exact:!0,path:"/admin/application",render:function(){return Object(s.jsx)(ee,{appConfig:t,t:a})}}),Object(s.jsx)(w.b,{exact:!0,path:"/admin/sports",render:function(){return Object(s.jsx)(oe,{t:a})}}),Object(s.jsx)(w.b,{exact:!0,path:"/admin/users",render:function(){return Object(s.jsx)(le,{t:a})}}),Object(s.jsx)(w.b,{component:ue})]}):Object(s.jsx)(ue,{})})]})}))),je=a(467),pe=a(24),he=a(487),be=a(222),Oe=a.n(be),fe=["#55a8a3","#98C3A9","#D0838A","#ECC77E","#926692","#929292","#428bca"],xe=[{record_type:"AS",label:"Ave. speed"},{record_type:"FD",label:"Farest distance"},{record_type:"LD",label:"Longest duration"},{record_type:"MS",label:"Max. speed"}],ge=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return t||(t="yyyy/MM/dd"),a||(a="HH:mm"),{workout_date:e?Object(D.a)(e,t):null,workout_time:e?Object(D.a)(e,a):null}},ve=function(e){var t=new Date(0);return(t=Object(he.a)(t.setSeconds(e),1)).getTime()},ke=function(e){for(var t=0;ts?1:a2&&void 0!==arguments[2]&&arguments[2];return e.filter((function(e){return!a||e.is_active})).map((function(e){return Object(S.a)(Object(S.a)({},e),{},{label:t("sports:".concat(e.label))})})).sort(we)},Ne=function(){function e(){Object(f.a)(this,e)}return Object(x.a)(e,null,[{key:"loginOrRegisterOrPasswordReset",value:function(e,t){var a={url:"auth/".concat(e),method:"POST",noAuthorization:!0,body:t,type:"application/json"};return R(a)}},{key:"deletePicture",value:function(){return R({url:"auth/picture",method:"DELETE"})}}]),e}(),_e=function(e){return{type:"PICTURE_ERROR",message:e}},Se=function(e){return{type:"PROFILE_UPDATE_ERROR",message:e}},De=function(){return function(e){return window.localStorage.getItem("authToken")?e(Ce()):{type:"LOGOUT"}}},Ce=function(){return function(e){return H.getData("auth/profile").then((function(t){return"success"===t.status?(e(Y("getData","sports")),t.data.isAuthenticated=!0,t.data.language&&e(X(t.data.language)),e({type:"PROFILE_SUCCESS",profil:t.data})):e({type:"PROFILE_ERROR",message:t.message})})).catch((function(e){throw e}))}},Ee=function(e,t){return function(a){if("register"===t||"password/update"===t){var s=function(e){var t=[];return!(arguments.length>1&&void 0!==arguments[1]&&arguments[1])&&(e.username.length<3||e.username.length>12)&&t.push("3 to 12 characters required for username."),e.password!==e.password_conf&&t.push("Password and password confirmation don't match."),e.password.length<8&&t.push("8 characters required for password."),t}(e,"password/update"===t);if(s.length>0)return a({type:"AUTH_ERRORS",messages:(e=>{let t=0;return e.map((e=>{const a={id:t,value:e};return t++,a}))})(s)})}return a(function(e,t){return function(a){return Ne.loginOrRegisterOrPasswordReset(e,t).then((function(t){if("success"===t.status){if("password/reset-request"===e)return Ws.push({pathname:"/password-reset/sent"});if("password/update"===e)return Ws.push({pathname:"/updated-password"});if("login"===e||"register"===e)return window.localStorage.setItem("authToken",t.auth_token),"register"===e&&a(Z("config")),a(Ce())}return a({type:"AUTH_ERROR",message:t.message})})).catch((function(e){throw e}))}}(t,e))}},Ae=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return function(a){return H.deleteData("users",e).then((function(e){204===e.status?(a(Z("config")),t?Ws.push("/admin/users"):(a({type:"LOGOUT"}),Ws.push("/"))):e.json().then((function(e){return a(V("".concat(e.message)))}))})).catch((function(e){return a(V("user|".concat(e)))}))}},Me=function(e){return{type:"SET_GPX",gpxContent:e}},Te=function(e){return{type:"SET_CHART_DATA",chartData:e}},Pe=function(e){return function(t){return H.updateData("workouts",e).then((function(e){"success"===e.status?(t(De()),Ws.push("/workouts/".concat(e.data.workouts[0].id))):t(V("workouts|".concat(e.message))),t(G(!1))})).catch((function(e){t(G(!1)),t(V("workouts|".concat(e)))}))}},Fe=function(e){return function(t){return H.getData("workouts",e).then((function(e){"success"===e.status?e.data.workouts.length>0&&t({type:"PUSH_WORKOUTS",workouts:e.data.workouts}):t(V("workouts|".concat(e.message)))})).catch((function(e){return t(V("workouts|".concat(e)))}))}};var ze=Object(k.c)((function(e){return{appConfig:e.application.config,loading:e.loading}}),(function(e){return{onAddWorkout:function(t){e(G(!0));var a=new FormData;a.append("file",t.target.form.gpxFile.files[0]),a.append("data",'{"sport_id": '.concat(t.target.form.sport.value,', "notes": "').concat(t.target.form.notes.value,'"}')),e(function(e){return function(t){return H.addDataWithFile("workouts",e).then((function(e){"created"===e.status?0===e.data.workouts.length?t(V("workouts|no correct file.")):1===e.data.workouts.length?(t(De()),Ws.push("/workouts/".concat(e.data.workouts[0].id))):(t(De()),Ws.push("/")):413===e.status?t(V("workouts|File size is greater than the allowed size")):t(V("workouts|".concat(e.message))),t(G(!1))})).catch((function(e){t(G(!1)),t(V("workouts|".concat(e)))}))}}(a))},onEditWorkout:function(t,a){e(Pe({id:a.id,notes:t.target.form.notes.value,sport_id:+t.target.form.sport.value,title:t.target.form.title.value}))}}}))((function(e){var t=e.appConfig,a=e.loading,r=e.onAddWorkout,n=e.onEditWorkout,o=e.sports,c=e.t,i=e.workout,l=i?i.sport_id:"",d=ye(o,c,!0),u="".concat(c("workouts:no folder inside"),", ").concat(t.gpx_limit_import," ").concat(c("workouts:files max"),", ").concat(c("workouts:max size"),": ").concat(M(t.max_zip_file_size)),m=M(t.max_single_file_size);return Object(s.jsxs)("form",{encType:"multipart/form-data",method:"post",onSubmit:function(e){return e.preventDefault()},children:[Object(s.jsx)("div",{className:"form-group",children:Object(s.jsxs)("label",{children:[c("common:Sport"),":",Object(s.jsxs)("select",{className:"form-control input-lg",defaultValue:l,disabled:a,name:"sport",required:!0,children:[Object(s.jsx)("option",{value:""}),d.map((function(e){return Object(s.jsx)("option",{value:e.id,children:e.label},e.id)}))]})]})}),i?Object(s.jsx)("div",{className:"form-group",children:Object(s.jsxs)("label",{children:[c("workouts:Title"),":",Object(s.jsx)("input",{name:"title",defaultValue:i?i.title:"",disabled:a,className:"form-control input-lg"})]})}):Object(s.jsx)("div",{className:"form-group",children:Object(s.jsxs)("label",{children:[Object(s.jsxs)(je.a,{i18nKey:"workouts:gpxFile",children:[Object(s.jsx)("strong",{children:"gpx"})," file"]}),Object(s.jsx)("sup",{children:Object(s.jsx)("i",{className:"fa fa-question-circle","aria-hidden":"true","data-toggle":"tooltip",title:"".concat(c("workouts:max size"),": ").concat(m)})})," ",Object(s.jsxs)(je.a,{i18nKey:"workouts:zipFile",children:["or ",Object(s.jsx)("strong",{children:" zip"})," file containing ",Object(s.jsx)("strong",{children:"gpx "}),"files"]}),Object(s.jsx)("sup",{children:Object(s.jsx)("i",{className:"fa fa-question-circle","aria-hidden":"true","data-toggle":"tooltip","data-placement":"top",title:u})})," ",":",Object(s.jsx)("input",{accept:".gpx, .zip",className:"form-control form-control-file gpx-file",disabled:a,name:"gpxFile",required:!0,type:"file"})]})}),Object(s.jsx)("div",{className:"form-group",children:Object(s.jsxs)("label",{children:[c("workouts:Notes"),":",Object(s.jsx)("textarea",{name:"notes",defaultValue:i?i.notes:"",disabled:a,className:"form-control input-lg",maxLength:"500"})]})}),a?Object(s.jsx)("div",{className:"loader"}):Object(s.jsxs)("div",{children:[Object(s.jsx)("input",{type:"submit",className:"btn btn-primary",onClick:function(e){return i?n(e,i):r(e)},value:c("common:Submit")}),Object(s.jsx)("input",{type:"submit",className:"btn btn-secondary",onClick:function(){return Ws.push("/")},value:c("common:Cancel")})]})]})}));var Re=Object(k.c)((function(e){return{user:e.user}}),(function(e){return{onAddOrEdit:function(t,a){var s,r=t.target.form.duration.value.split(":"),n=60*+r[0]*60+60*+r[1]+ +r[2],o={workout_date:"".concat(t.target.form.workout_date.value," ").concat(t.target.form.workout_time.value),distance:+t.target.form.distance.value,duration:n,notes:t.target.form.notes.value,sport_id:+t.target.form.sport_id.value,title:t.target.form.title.value};a?(o.id=a.id,e(Pe(o))):e((s=o,function(e){return H.addData("workouts/no_gpx",s).then((function(t){"created"===t.status?(e(De()),Ws.push("/workouts/".concat(t.data.workouts[0].id))):e(V("workouts|".concat(t.message)))})).catch((function(t){return e(V("workouts|".concat(t)))}))}))}}}))((function(e){var t,a,r=e.onAddOrEdit,n=e.sports,o=e.t,c=e.user,i=e.workout,l=ye(n,o,!0),d="";if(i){var u=ge(L(i.workout_date,c.timezone),"yyyy-MM-dd");t=u.workout_date,a=u.workout_time,d=i.sport_id}return Object(s.jsxs)("form",{onSubmit:function(e){return e.preventDefault()},children:[Object(s.jsx)("div",{className:"form-group",children:Object(s.jsxs)("label",{children:[o("workouts:Title"),":",Object(s.jsx)("input",{name:"title",defaultValue:i?i.title:"",className:"form-control input-lg"})]})}),Object(s.jsx)("div",{className:"form-group",children:Object(s.jsxs)("label",{children:[o("common:Sport"),":",Object(s.jsxs)("select",{className:"form-control input-lg",defaultValue:d,name:"sport_id",required:!0,children:[Object(s.jsx)("option",{value:""}),l.map((function(e){return Object(s.jsx)("option",{value:e.id,children:e.label},e.id)}))]})]})}),Object(s.jsx)("div",{className:"form-group",children:Object(s.jsxs)("label",{children:[o("workouts:Workout Date"),":",Object(s.jsx)("div",{className:"container",children:Object(s.jsxs)("div",{className:"row",children:[Object(s.jsx)("input",{name:"workout_date",defaultValue:t,className:"form-control col-md",required:!0,type:"date"}),Object(s.jsx)("input",{name:"workout_time",defaultValue:a,className:"form-control col-md",required:!0,type:"time"})]})})]})}),Object(s.jsx)("div",{className:"form-group",children:Object(s.jsxs)("label",{children:[o("workouts:Duration"),":",Object(s.jsx)("input",{name:"duration",defaultValue:i?i.duration:"",className:"form-control col-xs-4",pattern:"^([0-9]*[0-9]):([0-5][0-9]):([0-5][0-9])$",placeholder:"hh:mm:ss",required:!0,type:"text"})]})}),Object(s.jsx)("div",{className:"form-group",children:Object(s.jsxs)("label",{children:[o("workouts:Distance")," (km):",Object(s.jsx)("input",{name:"distance",defaultValue:i?i.distance:"",className:"form-control input-lg",min:0,required:!0,step:"0.001",type:"number"})]})}),Object(s.jsx)("div",{className:"form-group",children:Object(s.jsxs)("label",{children:[o("workouts:Notes"),":",Object(s.jsx)("textarea",{name:"notes",defaultValue:i?i.notes:"",className:"form-control input-lg",maxLength:"500"})]})}),Object(s.jsx)("input",{type:"submit",className:"btn btn-primary",onClick:function(e){return r(e,i)},value:o("common:Submit")}),Object(s.jsx)("input",{type:"submit",className:"btn btn-secondary",onClick:function(){return Ws.push("/")},value:o("common:Cancel")})]})})),Le=function(e){Object(g.a)(a,e);var t=Object(v.a)(a);function a(e,s){var r;return Object(f.a)(this,a),(r=t.call(this,e,s)).state={withGpx:!0},r}return Object(x.a)(a,[{key:"handleRadioChange",value:function(e){this.setState({withGpx:"withGpx"===e.target.name?e.target.value:!e.target.value})}},{key:"render",value:function(){var e=this,t=this.props,a=t.loading,r=t.message,n=t.sports,o=t.t,c=t.workout,i=this.state.withGpx;return Object(s.jsxs)("div",{children:[Object(s.jsx)(y.a,{children:Object(s.jsxs)("title",{children:["FitTrackee -"," ",o(c?"workouts:Edit a workout":"workouts:Add a workout")]})}),Object(s.jsx)("br",{}),Object(s.jsx)("br",{}),Object(s.jsx)(_,{message:r,t:o}),Object(s.jsx)("div",{className:"container",children:Object(s.jsxs)("div",{className:"row",children:[Object(s.jsx)("div",{className:"col-md-2"}),Object(s.jsx)("div",{className:"col-md-8",children:Object(s.jsxs)("div",{className:"card add-workout",children:[Object(s.jsx)("h2",{className:"card-header text-center",children:o(c?"workouts:Edit a workout":"workouts:Add a workout")}),Object(s.jsx)("div",{className:"card-body",children:c?c.with_gpx?Object(s.jsx)(ze,{workout:c,sports:n,t:o}):Object(s.jsx)(Re,{workout:c,sports:n,t:o}):Object(s.jsxs)("div",{children:[Object(s.jsx)("form",{children:Object(s.jsxs)("div",{className:"form-group row",children:[Object(s.jsx)("div",{className:"col",children:Object(s.jsxs)("label",{className:"radioLabel",children:[Object(s.jsx)("input",{className:"add-workout-radio",type:"radio",name:"withGpx",disabled:a,checked:i,onChange:function(t){return e.handleRadioChange(t)}}),o("workouts:with gpx file")]})}),Object(s.jsx)("div",{className:"col",children:Object(s.jsxs)("label",{className:"radioLabel",children:[Object(s.jsx)("input",{className:"add-workout-radio",type:"radio",name:"withoutGpx",disabled:a,checked:!i,onChange:function(t){return e.handleRadioChange(t)}}),o("workouts:without gpx file")]})})]})}),i?Object(s.jsx)(ze,{sports:n,t:o}):Object(s.jsx)(Re,{sports:n,t:o})]})})]})}),Object(s.jsx)("div",{className:"col-md-2"})]})})]})}}]),a}(o.a.Component),Ue=Object(N.a)()(Object(k.c)((function(e){return{loading:e.loading}}))(Le));var Ie=Object(k.c)((function(e){return{message:e.message,sports:e.sports.data,user:e.user}}))((function(e){var t=e.message,a=e.sports;return Object(s.jsx)("div",{children:Object(s.jsx)(Ue,{workout:null,message:t,sports:a})})}));function We(e){var t=Object(de.a)().t;return Object(s.jsx)("div",{className:"custom-modal-backdrop",children:Object(s.jsx)("div",{className:"custom-modal",children:Object(s.jsxs)("div",{className:"modal-content",children:[Object(s.jsxs)("div",{className:"modal-header",children:[Object(s.jsx)("h5",{className:"modal-title",children:e.title}),Object(s.jsx)("button",{type:"button",className:"close","aria-label":"Close",onClick:function(){return e.close()},children:Object(s.jsx)("span",{"aria-hidden":"true",children:"\xd7"})})]}),Object(s.jsx)("div",{className:"modal-body",children:Object(s.jsx)("p",{children:e.text})}),Object(s.jsxs)("div",{className:"modal-footer",children:[Object(s.jsx)("button",{type:"button",className:"btn btn-primary",onClick:function(){return e.confirm()},children:t("common:Yes")}),Object(s.jsx)("button",{type:"button",className:"btn btn-secondary",onClick:function(){return e.close()},children:t("common:No")})]})]})})})}function He(e){var t=e.dataType,a=e.displayModal,r=e.segmentId,n=e.sport,o=e.t,c=e.title,i=e.user,l=e.workout,d=l?ge(L(l.workout_date,i.timezone)):null,u="segment"===t&&1!==r?"/workouts/".concat(l.id,"/segment/").concat(r-1):"workout"===t&&l.previous_workout?"/workouts/".concat(l.previous_workout):null,m="segment"===t&&r0?Object(s.jsxs)("div",{children:[Object(s.jsxs)("div",{className:"row chart-radio",children:[Object(s.jsxs)("label",{className:"radioLabel col-md-1",children:[Object(s.jsx)("input",{type:"radio",name:"distance",checked:i,onChange:function(e){return a.handleRadioChange(e)}}),o("workouts:distance")]}),Object(s.jsxs)("label",{className:"radioLabel col-md-1",children:[Object(s.jsx)("input",{type:"radio",name:"duration",checked:!i,onChange:function(e){return a.handleRadioChange(e)}}),o("workouts:duration")]})]}),Object(s.jsxs)("div",{className:"row chart-radio",children:[Object(s.jsx)("div",{className:"col-md-5"}),Object(s.jsxs)("label",{className:"radioLabel col-md-1",children:[Object(s.jsx)("input",{type:"checkbox",name:"speed",checked:this.displayData("speed"),onChange:function(e){return a.handleLegendChange(e)}}),o("workouts:speed")]}),Object(s.jsxs)("label",{className:"radioLabel col-md-1",children:[Object(s.jsx)("input",{type:"checkbox",name:"elevation",checked:this.displayData("elevation"),onChange:function(e){return a.handleLegendChange(e)}}),o("workouts:elevation")]}),Object(s.jsx)("div",{className:"col-md-5"})]}),Object(s.jsx)("div",{className:"row chart",children:Object(s.jsx)(qe.f,{height:300,children:Object(s.jsxs)(qe.d,{data:n,margin:{top:15,right:30,left:20,bottom:15},onMouseMove:function(e){return c(e.activePayload)},onMouseLeave:function(){return c(null)},children:[Object(s.jsx)(qe.h,{allowDecimals:!1,dataKey:e,label:{value:o("workouts:".concat(e)),offset:0,position:"bottom"},scale:t,interval:l,tickFormatter:function(e){return i?e:Object(D.a)(e,"HH:mm:ss")},type:"number"}),Object(s.jsx)(qe.i,{label:{value:"".concat(o("workouts:speed")," (km/h)"),angle:-90,position:"left"},yAxisId:"left"}),Object(s.jsx)(qe.i,{label:{value:"".concat(o("workouts:elevation")," (m)"),angle:-90,position:"right"},yAxisId:"right",orientation:"right"}),this.displayData("elevation")&&Object(s.jsx)(qe.a,{yAxisId:"right",type:"linear",dataKey:"elevation",name:o("workouts:elevation"),fill:"#e5e5e5",stroke:"#cccccc",dot:!1,unit:" m"}),this.displayData("speed")&&Object(s.jsx)(qe.e,{yAxisId:"left",type:"linear",dataKey:"speed",name:o("workouts:speed"),stroke:"#8884d8",strokeWidth:2,dot:!1,unit:" km/h"}),Object(s.jsx)(qe.g,{labelFormatter:function(e){return i?"".concat(o("workouts:distance"),": ").concat(e," km"):"".concat(o("workouts:duration"),": ").concat(Object(D.a)(e,"HH:mm:ss"))}})]})})}),Object(s.jsx)("div",{className:"chart-info",children:o("workouts:data from gpx, without any cleaning")})]}):o("workouts:No data to display")})}}]),a}(o.a.Component),Ve=Object(k.c)((function(e){return{chartData:e.chartData}}),(function(e){return{loadWorkoutData:function(t){e(function(e){return function(t){if(e)return H.getData("workouts/".concat(e,"/chart_data")).then((function(e){"success"===e.status?t(Te(ke(e.data.chart_data))):t(V("workouts|".concat(e.message)))})).catch((function(e){return t(V("workouts|".concat(e)))}));t(Te(null))}}(t))},loadSegmentData:function(t,a){e(function(e,t){return function(a){if(e)return H.getData("workouts/".concat(e,"/chart_data/segment/").concat(t)).then((function(e){"success"===e.status?a(Te(ke(e.data.chart_data))):a(V("workouts|".concat(e.message)))})).catch((function(e){return a(V("workouts|".concat(e)))}));a(Te(null))}}(t,a))}}}))(Be);function Ge(e){var t=e.t,a=e.workout;return Object(s.jsx)("div",{className:"container",children:a.weather_start&&a.weather_end&&Object(s.jsxs)("table",{className:"table table-borderless weather-table text-center",children:[Object(s.jsx)("thead",{children:Object(s.jsxs)("tr",{children:[Object(s.jsx)("th",{}),Object(s.jsxs)("th",{children:[t("workouts:Start"),Object(s.jsx)("br",{}),Object(s.jsx)("img",{className:"weather-img",src:"/img/weather/".concat(a.weather_start.icon,".png"),alt:"workout weather (".concat(a.weather_start.icon,")"),title:a.weather_start.summary})]}),Object(s.jsxs)("th",{children:[t("workouts:End"),Object(s.jsx)("br",{}),Object(s.jsx)("img",{className:"weather-img",src:"/img/weather/".concat(a.weather_end.icon,".png"),alt:"workout weather (".concat(a.weather_end.icon,")"),title:a.weather_end.summary})]})]})}),Object(s.jsxs)("tbody",{children:[Object(s.jsxs)("tr",{children:[Object(s.jsx)("td",{children:Object(s.jsx)("img",{className:"weather-img-small",src:"/img/weather/temperature.png",alt:"Temperatures"})}),Object(s.jsxs)("td",{children:[Number(a.weather_start.temperature).toFixed(1),"\xb0C"]}),Object(s.jsxs)("td",{children:[Number(a.weather_end.temperature).toFixed(1),"\xb0C"]})]}),Object(s.jsxs)("tr",{children:[Object(s.jsx)("td",{children:Object(s.jsx)("img",{className:"weather-img-small",src:"/img/weather/pour-rain.png",alt:"Temperatures"})}),Object(s.jsxs)("td",{children:[Number(100*a.weather_start.humidity).toFixed(1),"%"]}),Object(s.jsxs)("td",{children:[Number(100*a.weather_end.humidity).toFixed(1),"%"]})]}),Object(s.jsxs)("tr",{children:[Object(s.jsx)("td",{children:Object(s.jsx)("img",{className:"weather-img-small",src:"/img/weather/breeze.png",alt:"Temperatures"})}),Object(s.jsxs)("td",{children:[Number(a.weather_start.wind).toFixed(1),"m/s"]}),Object(s.jsxs)("td",{children:[Number(a.weather_end.wind).toFixed(1),"m/s"]})]})]})]})})}function Je(e){var t=e.t,a=e.workout,r="0:00:00"!==a.pauses&&null!==a.pauses;return Object(s.jsxs)("div",{className:"workout-details",children:[Object(s.jsxs)("p",{children:[Object(s.jsx)("i",{className:"fa fa-clock-o custom-fa","aria-hidden":"true"}),t("workouts:Duration"),": ",a.moving,a.records&&a.records.find((function(e){return"LD"===e.record_type}))&&Object(s.jsx)("sup",{children:Object(s.jsx)("i",{className:"fa fa-trophy custom-fa","aria-hidden":"true"})}),r&&Object(s.jsxs)("span",{children:[Object(s.jsx)("br",{}),"(",t("workouts:pauses"),": ",a.pauses,","," ",t("workouts:total duration"),": ",a.duration,")"]})]}),Object(s.jsxs)("p",{children:[Object(s.jsx)("i",{className:"fa fa-road custom-fa","aria-hidden":"true"}),t("workouts:Distance"),": ",a.distance," km",a.records&&a.records.find((function(e){return"FD"===e.record_type}))&&Object(s.jsx)("sup",{children:Object(s.jsx)("i",{className:"fa fa-trophy custom-fa","aria-hidden":"true"})})]}),Object(s.jsxs)("p",{children:[Object(s.jsx)("i",{className:"fa fa-tachometer custom-fa","aria-hidden":"true"}),t("workouts:Average speed"),": ",a.ave_speed," km/h",a.records&&a.records.find((function(e){return"AS"===e.record_type}))&&Object(s.jsx)("sup",{children:Object(s.jsx)("i",{className:"fa fa-trophy custom-fa","aria-hidden":"true"})}),Object(s.jsx)("br",{}),t("workouts:Max. speed"),": ",a.max_speed," km/h",a.records&&a.records.find((function(e){return"MS"===e.record_type}))&&Object(s.jsx)("sup",{children:Object(s.jsx)("i",{className:"fa fa-trophy custom-fa","aria-hidden":"true"})})]}),a.min_alt&&a.max_alt&&Object(s.jsxs)("p",{children:[Object(s.jsx)("i",{className:"fi-mountains custom-fa"}),t("workouts:Min. altitude"),": ",a.min_alt,"m",Object(s.jsx)("br",{}),t("workouts:Max. altitude"),": ",a.max_alt,"m"]}),a.ascent&&a.descent&&Object(s.jsxs)("p",{children:[Object(s.jsx)("i",{className:"fa fa-location-arrow custom-fa"}),t("workouts:Ascent"),": ",a.ascent,"m",Object(s.jsx)("br",{}),t("workouts:Descent"),": ",a.descent,"m"]}),Object(s.jsx)(Ge,{workout:a,t:t})]})}var Ke=a(471),Ye=a(468),Xe=a(489),$e=a(469),Ze=a(470),Qe=a(233),et=a.n(Qe);function tt(e){var t=e.bounds,a=e.coordinates,r=e.jsonData,n=e.mapAttribution;return Object(Ye.a)().fitBounds(t),Object(s.jsxs)(s.Fragment,{children:[Object(s.jsx)(Xe.a,{attribution:n,url:"".concat(T,"workouts/map_tile/{s}/{z}/{x}/{y}.png")}),Object(s.jsx)($e.a,{data:r},et()(r)),a.latitude&&Object(s.jsx)(Ze.a,{position:[a.latitude,a.longitude]})]})}var at=function(e){Object(g.a)(a,e);var t=Object(v.a)(a);function a(e,s){var r;return Object(f.a)(this,a),(r=t.call(this,e,s)).state={zoom:13},r}return Object(x.a)(a,[{key:"componentDidMount",value:function(){"workout"===this.props.dataType?this.props.loadWorkoutGpx(this.props.workout.id):this.props.loadSegmentGpx(this.props.workout.id,this.props.segmentId)}},{key:"componentDidUpdate",value:function(e){("workout"===this.props.dataType&&e.workout.id!==this.props.workout.id||"workout"===this.props.dataType&&"segment"===e.dataType)&&this.props.loadWorkoutGpx(this.props.workout.id),"segment"===this.props.dataType&&e.segmentId!==this.props.segmentId&&this.props.loadSegmentGpx(this.props.workout.id,this.props.segmentId)}},{key:"componentWillUnmount",value:function(){this.props.loadWorkoutGpx(null)}},{key:"render",value:function(){var e=this.props,t=e.coordinates,a=e.gpxContent,r=e.mapAttribution,n=e.workout,o=function(e){var t;if(e){var a=(new DOMParser).parseFromString(e,"text/xml");t=Oe.a.gpx(a)}return{jsonData:t}}(a).jsonData,c=[[n.bounds[0],n.bounds[1]],[n.bounds[2],n.bounds[3]]];return Object(s.jsx)("div",{children:o&&Object(s.jsx)(Ke.a,{zoom:this.state.zoom,bounds:c,boundsOptions:{padding:[10,10]},children:Object(s.jsx)(tt,{bounds:c,coordinates:t,jsonData:o,mapAttribution:r})})})}}]),a}(o.a.Component),st=Object(k.c)((function(e){return{gpxContent:e.gpx,mapAttribution:e.application.config.map_attribution}}),(function(e){return{loadWorkoutGpx:function(t){e(function(e){return function(t){if(e)return H.getData("workouts/".concat(e,"/gpx")).then((function(e){"success"===e.status?t(Me(e.data.gpx)):t(V("workouts|".concat(e.message)))})).catch((function(e){return t(V("workouts|".concat(e)))}));t(Me(null))}}(t))},loadSegmentGpx:function(t,a){e(function(e,t){return function(a){if(e)return H.getData("workouts/".concat(e,"/gpx/segment/").concat(t)).then((function(e){"success"===e.status?a(Me(e.data.gpx)):a(V("workouts|".concat(e.message)))})).catch((function(e){return a(V("workouts|".concat(e)))}));a(Me(null))}}(t,a))}}}))(at);function rt(e){var t=e.t;return Object(s.jsx)("div",{className:"workout-no-map text-center",children:t("workouts:No Map")})}function nt(e){var t=e.notes,a=e.t;return Object(s.jsx)("div",{className:"row",children:Object(s.jsx)("div",{className:"col",children:Object(s.jsx)("div",{className:"card workout-card",children:Object(s.jsxs)("div",{className:"card-body",children:["Notes",Object(s.jsx)("div",{className:"workout-notes",children:t||a("workouts:No notes")})]})})})})}function ot(e){var t=e.segments,a=e.t;return Object(s.jsx)("div",{className:"row",children:Object(s.jsx)("div",{className:"col",children:Object(s.jsx)("div",{className:"card workout-card",children:Object(s.jsxs)("div",{className:"card-body",children:[a("workouts:Segments"),Object(s.jsx)("div",{className:"workout-segments",children:Object(s.jsx)("ul",{children:t.map((function(e,t){return Object(s.jsxs)("li",{className:"workout-segments-list",children:[Object(s.jsxs)(te.a,{to:"/workouts/".concat(e.workout_id,"/segment/").concat(t+1),children:[a("workouts:segment")," ",t+1]})," ","(",a("workouts:distance"),": ",e.distance," km,"," ",a("workouts:duration"),": ",e.duration,")"]},"segment-".concat(t))}))})})]})})})})}var ct=function(e){Object(g.a)(a,e);var t=Object(v.a)(a);function a(e,s){var r;return Object(f.a)(this,a),(r=t.call(this,e,s)).state={displayModal:!1,coordinates:{latitude:null,longitude:null}},r}return Object(x.a)(a,[{key:"componentDidMount",value:function(){this.props.loadWorkout(this.props.match.params.workoutId)}},{key:"componentDidUpdate",value:function(e){e.match.params.workoutId!==this.props.match.params.workoutId&&this.props.loadWorkout(this.props.match.params.workoutId)}},{key:"displayModal",value:function(e){this.setState((function(t){return Object(S.a)(Object(S.a)({},t),{},{displayModal:e})}))}},{key:"updateCoordinates",value:function(e){var t=e&&e.length>0?{latitude:e[0].payload.latitude,longitude:e[0].payload.longitude}:{latitude:null,longitude:null};this.setState((function(e){return Object(S.a)(Object(S.a)({},e),{},{coordinates:t})}))}},{key:"render",value:function(){var e=this,t=this.props,a=t.message,r=t.onDeleteWorkout,n=t.sports,o=t.t,c=t.user,i=t.workouts,l=this.state,d=l.coordinates,u=l.displayModal,m=Object(pe.a)(i,1)[0],j=m?m.title:o("workouts:Workout"),p=m?n.filter((function(e){return e.id===m.sport_id})):[],h=Object(pe.a)(p,1)[0],b=parseInt(this.props.match.params.segmentId),O=b>=0?"segment":"workout";return Object(s.jsxs)("div",{className:"workout-page",children:[Object(s.jsx)(y.a,{children:Object(s.jsxs)("title",{children:["FitTrackee - ",j]})}),a?Object(s.jsx)(_,{message:a,t:o}):Object(s.jsxs)("div",{className:"container",children:[u&&Object(s.jsx)(We,{title:o("common:Confirmation"),text:o("workouts:Are you sure you want to delete this workout?"),confirm:function(){r(m.id),e.displayModal(!1)},close:function(){return e.displayModal(!1)}}),m&&h&&1===i.length&&Object(s.jsxs)("div",{children:[Object(s.jsx)("div",{className:"row",children:Object(s.jsx)("div",{className:"col",children:Object(s.jsxs)("div",{className:"card workout-card",children:[Object(s.jsx)("div",{className:"card-header",children:Object(s.jsx)(He,{workout:m,dataType:O,segmentId:b,sport:h,t:o,title:j,user:c,displayModal:function(){return e.displayModal(!0)}})}),Object(s.jsx)("div",{className:"card-body",children:Object(s.jsxs)("div",{className:"row",children:[Object(s.jsx)("div",{className:"col-md-8",children:m.with_gpx?Object(s.jsx)(st,{workout:m,coordinates:d,dataType:O,segmentId:b}):Object(s.jsx)(rt,{t:o})}),Object(s.jsx)("div",{className:"col",children:Object(s.jsx)(Je,{workout:"workout"===O?m:m.segments[b-1],t:o})})]})})]})})}),m.with_gpx&&Object(s.jsx)("div",{className:"row",children:Object(s.jsx)("div",{className:"col",children:Object(s.jsx)("div",{className:"card workout-card",children:Object(s.jsx)("div",{className:"card-body",children:Object(s.jsx)("div",{className:"row",children:Object(s.jsxs)("div",{className:"col",children:[Object(s.jsx)("div",{className:"chart-title",children:o("workouts:Chart")}),Object(s.jsx)(Ve,{workout:m,dataType:O,segmentId:b,t:o,updateCoordinates:function(t){return e.updateCoordinates(t)}})]})})})})})}),"workout"===O&&Object(s.jsxs)(s.Fragment,{children:[Object(s.jsx)(nt,{notes:m.notes,t:o}),m.segments.length>1&&Object(s.jsx)(ot,{segments:m.segments,t:o})]})]})]})]})}}]),a}(o.a.Component),it=Object(N.a)()(Object(k.c)((function(e){return{workouts:e.workouts.data,message:e.message,sports:e.sports.data,user:e.user}}),(function(e){return{loadWorkout:function(t){e(Y("getData","workouts",{id:t}))},onDeleteWorkout:function(t){var a;e((a=t,function(e){return H.deleteData("workouts",a).then((function(t){var s;204===t.status?Promise.resolve(e((s=a,{type:"REMOVE_WORKOUT",workoutId:s}))).then((function(){return e(De())})).then((function(){return Ws.push("/")})):e(V("workouts|".concat(t.status)))})).catch((function(t){return e(V("workouts|".concat(t)))}))}))}}}))(ct)),lt=function(e){Object(g.a)(a,e);var t=Object(v.a)(a);function a(){return Object(f.a)(this,a),t.apply(this,arguments)}return Object(x.a)(a,[{key:"componentDidMount",value:function(){this.props.loadWorkout(this.props.match.params.workoutId)}},{key:"render",value:function(){var e=this.props,t=e.message,a=e.sports,r=e.workouts,n=Object(pe.a)(r,1)[0];return Object(s.jsx)("div",{children:a.length>0&&Object(s.jsx)(Ue,{workout:n,message:t,sports:a})})}}]),a}(o.a.Component),dt=Object(k.c)((function(e){return{workouts:e.workouts.data,message:e.message,sports:e.sports.data,user:e.user}}),(function(e){return{loadWorkout:function(t){e(Y("getData","workouts",{id:t}))}}}))(lt);var ut=Object(k.c)((function(e){return{user:e.user}}))((function(){return Object(s.jsx)("div",{children:z()?Object(s.jsxs)(w.d,{children:[Object(s.jsx)(w.b,{exact:!0,path:"/workouts/add",component:Ie}),Object(s.jsx)(w.b,{exact:!0,path:"/workouts/:workoutId",component:it}),Object(s.jsx)(w.b,{exact:!0,path:"/workouts/:workoutId/edit",component:dt}),Object(s.jsx)(w.b,{path:"/workouts/:workoutId/segment/:segmentId",component:it}),Object(s.jsx)(w.b,{component:ue})]}):Object(s.jsx)(w.a,{to:"/login"})})})),mt=function(e){Object(g.a)(a,e);var t=Object(v.a)(a);function a(){return Object(f.a)(this,a),t.apply(this,arguments)}return Object(x.a)(a,[{key:"render",value:function(){var e=this.props.t;return Object(s.jsx)("div",{className:"card text-center",children:Object(s.jsxs)("div",{className:"card-body",children:[e("common:No workouts.")," ",Object(s.jsx)(te.a,{to:{pathname:"/workouts/add"},children:e("dashboard:Upload one !")})]})})}}]),a}(o.a.PureComponent),jt=function(e){Object(g.a)(a,e);var t=Object(v.a)(a);function a(){return Object(f.a)(this,a),t.apply(this,arguments)}return Object(x.a)(a,[{key:"render",value:function(){var e=this.props,t=e.loadWorkouts,a=e.sports,r=e.t,n=e.updateParams,o=ye(a,r);return Object(s.jsx)("div",{className:"card",children:Object(s.jsx)("div",{className:"card-body workout-filter",children:Object(s.jsxs)("form",{onSubmit:function(e){return e.preventDefault()},children:[Object(s.jsxs)("div",{className:"form-group",children:[Object(s.jsxs)("label",{children:[r("workouts:From"),":",Object(s.jsx)("input",{className:"form-control col-md",name:"from",onChange:function(e){return n(e)},type:"date"})]}),Object(s.jsxs)("label",{children:[r("workouts:To"),":",Object(s.jsx)("input",{className:"form-control col-md",name:"to",onChange:function(e){return n(e)},type:"date"})]})]}),Object(s.jsx)("div",{className:"form-group",children:Object(s.jsxs)("label",{children:[r("common:Sport"),":",Object(s.jsxs)("select",{className:"form-control input-lg",name:"sport_id",onChange:function(e){return n(e)},children:[Object(s.jsx)("option",{value:""}),o.map((function(e){return Object(s.jsx)("option",{value:e.id,children:e.label},e.id)}))]})]})}),Object(s.jsx)("div",{className:"form-group",children:Object(s.jsxs)("label",{children:[r("workouts:Distance")," (km):",Object(s.jsx)("div",{className:"container",children:Object(s.jsxs)("div",{className:"row",children:[Object(s.jsx)("div",{className:"col-5",children:Object(s.jsx)("input",{className:"form-control",min:0,name:"distance_from",onChange:function(e){return n(e)},step:"1",type:"number"})}),Object(s.jsx)("div",{className:"col-2 align-middle text-center",children:r("common:to")}),Object(s.jsx)("div",{className:"col-5",children:Object(s.jsx)("input",{className:"form-control",min:0,name:"distance_to",onChange:function(e){return n(e)},step:"1",type:"number"})})]})})]})}),Object(s.jsx)("div",{className:"form-group",children:Object(s.jsxs)("label",{children:[r("workouts:Duration"),":",Object(s.jsx)("div",{className:"container",children:Object(s.jsxs)("div",{className:"row",children:[Object(s.jsx)("div",{className:"col-5",children:Object(s.jsx)("input",{className:"form-control",name:"duration_from",onChange:function(e){return n(e)},pattern:"^([0-9]*[0-9]):([0-5][0-9])$",placeholder:"hh:mm",type:"text"})}),Object(s.jsx)("div",{className:"col-2 align-middle text-center",children:r("common:to")}),Object(s.jsx)("div",{className:"col-5",children:Object(s.jsx)("input",{className:"form-control",name:"duration_to",onChange:function(e){return n(e)},pattern:"^([0-9]*[0-9]):([0-5][0-9])$",placeholder:"hh:mm",type:"text"})})]})})]})}),Object(s.jsx)("div",{className:"form-group",children:Object(s.jsxs)("label",{children:[r("workouts:Average speed")," (km/h):",Object(s.jsx)("div",{className:"container",children:Object(s.jsxs)("div",{className:"row",children:[Object(s.jsx)("div",{className:"col-5",children:Object(s.jsx)("input",{className:"form-control",min:0,name:"ave_speed_from",onChange:function(e){return n(e)},step:"1",type:"number"})}),Object(s.jsx)("div",{className:"col-2 align-middle text-center",children:r("common:to")}),Object(s.jsx)("div",{className:"col-5",children:Object(s.jsx)("input",{className:"form-control",min:0,name:"ave_speed_to",onChange:function(e){return n(e)},step:"1",type:"number"})})]})})]})}),Object(s.jsx)("div",{className:"form-group",children:Object(s.jsxs)("label",{children:[r("workouts:Max. speed")," (km/h):",Object(s.jsx)("div",{className:"container",children:Object(s.jsxs)("div",{className:"row",children:[Object(s.jsx)("div",{className:"col-5",children:Object(s.jsx)("input",{className:"form-control",min:0,name:"max_speed_from",onChange:function(e){return n(e)},step:"1",type:"number"})}),Object(s.jsx)("div",{className:"col-2 align-middle text-center",children:r("common:to")}),Object(s.jsx)("div",{className:"col-5",children:Object(s.jsx)("input",{className:"form-control",min:0,name:"max_speed_to",onChange:function(e){return n(e)},step:"1",type:"number"})})]})})]})}),Object(s.jsx)("input",{className:"btn btn-primary btn-lg btn-block",onClick:function(){return t()},type:"submit",value:r("workouts:Filter")})]})})})}}]),a}(o.a.PureComponent),pt=function(e){Object(g.a)(a,e);var t=Object(v.a)(a);function a(){return Object(f.a)(this,a),t.apply(this,arguments)}return Object(x.a)(a,[{key:"render",value:function(){var e=this.props,t=e.display,a=e.workout;return Object(s.jsxs)("div",{className:"workout-map".concat("list"===t?"-list":""),children:[Object(s.jsx)("img",{src:"".concat(T,"workouts/map/").concat(a.map,"?").concat(Date.now()),alt:"workout map"}),Object(s.jsxs)("div",{className:"map-attribution".concat("list"===t?"-list":""),children:[Object(s.jsx)("span",{className:"map-attribution-text",children:"\xa9"}),Object(s.jsx)("a",{className:"map-attribution-text",href:"http://www.openstreetmap.org/copyright",target:"_blank",rel:"noopener noreferrer",children:"OpenStreetMap"})]})]})}}]),a}(o.a.PureComponent),ht=function(e){Object(g.a)(a,e);var t=Object(v.a)(a);function a(){return Object(f.a)(this,a),t.apply(this,arguments)}return Object(x.a)(a,[{key:"render",value:function(){var e=this.props,t=e.loading,a=e.sports,r=e.t,n=e.user,o=e.workouts;return Object(s.jsx)("div",{className:"card workout-card",children:Object(s.jsxs)("div",{className:"card-body",children:[Object(s.jsxs)("table",{className:"table",children:[Object(s.jsx)("thead",{children:Object(s.jsxs)("tr",{children:[Object(s.jsx)("th",{scope:"col"}),Object(s.jsx)("th",{scope:"col",children:r("common:Workout")}),Object(s.jsx)("th",{scope:"col",children:r("workouts:Date")}),Object(s.jsx)("th",{scope:"col",children:r("workouts:Distance")}),Object(s.jsx)("th",{scope:"col",children:r("workouts:Duration")}),Object(s.jsx)("th",{scope:"col",children:r("workouts:Ave. speed")}),Object(s.jsx)("th",{scope:"col",children:r("workouts:Max. speed")})]})}),Object(s.jsx)("tbody",{children:!t&&a&&o.map((function(e,t){return Object(s.jsxs)("tr",{children:[Object(s.jsxs)("td",{children:[Object(s.jsx)("span",{className:"heading-span-absolute",children:r("common:Sport")}),Object(s.jsx)("img",{className:"workout-sport",src:a.filter((function(t){return t.id===e.sport_id})).map((function(e){return e.img})),alt:"workout sport logo"})]}),Object(s.jsxs)("td",{className:"workout-title",children:[Object(s.jsx)("span",{className:"heading-span-absolute",children:r("common:Workout")}),Object(s.jsx)(te.a,{to:"/workouts/".concat(e.id),children:e.title}),e.map&&Object(s.jsx)(pt,{workout:e,display:"list"})]}),Object(s.jsxs)("td",{children:[Object(s.jsx)("span",{className:"heading-span-absolute",children:r("workouts:Date")}),Object(D.a)(L(e.workout_date,n.timezone),"dd/MM/yyyy HH:mm")]}),Object(s.jsxs)("td",{className:"text-right",children:[Object(s.jsx)("span",{className:"heading-span-absolute",children:r("workouts:Distance")}),Number(e.distance).toFixed(2)," km"]}),Object(s.jsxs)("td",{className:"text-right",children:[Object(s.jsx)("span",{className:"heading-span-absolute",children:r("workouts:Duration")}),e.moving]}),Object(s.jsxs)("td",{className:"text-right",children:[Object(s.jsx)("span",{className:"heading-span-absolute",children:r("workouts:Ave. speed")}),e.ave_speed," km/h"]}),Object(s.jsxs)("td",{className:"text-right",children:[Object(s.jsx)("span",{className:"heading-span-absolute",children:r("workouts:Max. speed")}),e.max_speed," km/h"]})]},t)}))})]}),t&&Object(s.jsx)("div",{className:"loader"})]})})}}]),a}(o.a.PureComponent),bt=function(e){Object(g.a)(a,e);var t=Object(v.a)(a);function a(e,s){var r;return Object(f.a)(this,a),(r=t.call(this,e,s)).state={params:{page:1,per_page:10}},r}return Object(x.a)(a,[{key:"componentDidMount",value:function(){this.props.loadWorkouts(this.state.params)}},{key:"setParams",value:function(e){var t=this.state.params;""===e.target.value?delete t[e.target.name]:t[e.target.name]=e.target.value,t.page=1,this.setState(t)}},{key:"render",value:function(){var e=this,t=this.props,a=t.loading,r=t.loadWorkouts,n=t.loadMoreWorkouts,o=t.message,c=t.sports,i=t.t,l=t.user,d=t.workouts,u=this.state.params,m=!(d.length>0)||null===d[d.length-1].previous_workout;return Object(s.jsxs)("div",{children:[Object(s.jsx)(y.a,{children:Object(s.jsxs)("title",{children:["FitTrackee - ",i("common:Workouts")]})}),o?Object(s.jsx)(_,{message:o,t:i}):Object(s.jsx)("div",{className:"container history",children:Object(s.jsxs)("div",{className:"row",children:[Object(s.jsx)("div",{className:"col-md-3",children:Object(s.jsx)(jt,{sports:c,loadWorkouts:function(){return r(u)},t:i,updateParams:function(t){return e.setParams(t)}})}),Object(s.jsxs)("div",{className:"col-md-9 workouts-result",children:[Object(s.jsx)(ht,{workouts:d,loading:a,sports:c,t:i,user:l}),!m&&Object(s.jsx)("input",{type:"submit",className:"btn btn-default btn-md btn-block",value:"Load more workouts",onClick:function(){u.page+=1,n(u),e.setState(u)}}),0===d.length&&Object(s.jsx)(mt,{t:i})]})]})})]})}}]),a}(o.a.Component),Ot=Object(N.a)()(Object(k.c)((function(e){return{workouts:e.workouts.data,loading:e.loading,message:e.message,sports:e.sports.data,user:e.user}}),(function(e){return{loadWorkouts:function(t){e(Y("getData","workouts",t))},loadMoreWorkouts:function(t){e(Fe(t))}}}))(bt));var ft=Object(N.a)()(Object(k.c)((function(e){return{appConfig:e.application.config,pathname:e.router.location.pathname,message:e.message}}),(function(e){return{onDeletePicture:function(){e((function(e){return Ne.deletePicture().then((function(t){return 204===t.status?e(Ce()):e(_e(t.message))})).catch((function(e){throw e}))}))},onUploadPicture:function(t){e(function(e){return function(t){e.preventDefault();var a=new FormData;return a.append("file",e.target.picture.files[0]),e.target.reset(),H.addDataWithFile("auth/picture",a).then((function(e){if("success"===e.status)return t(Ce());var a=413===e.status?"Error during picture update, file size exceeds max size.":e.message;return t(_e(a))})).catch((function(e){throw e}))}}(t))}}}))((function(e){var t=e.appConfig,a=e.displayModal,r=e.editable,n=e.isDeletable,o=e.message,c=e.onDeletePicture,i=e.onUploadPicture,l=e.pathname,d=e.t,u=e.user,m=u.created_at?Object(D.a)(new Date(u.created_at),"dd/MM/yyyy HH:mm"):"",j=u.birth_date?Object(D.a)(new Date(u.birth_date),"dd/MM/yyyy"):"",p=M(t.max_single_file_size);return Object(s.jsxs)("div",{children:[Object(s.jsx)(y.a,{children:Object(s.jsxs)("title",{children:["FitTrackee - ",d("user:Profile")]})}),Object(s.jsx)(_,{message:o,t:d}),Object(s.jsxs)("div",{className:"container",children:[Object(s.jsx)("h1",{className:"page-title",children:d("user:Profile")}),Object(s.jsx)("div",{className:"row",children:Object(s.jsx)("div",{className:"col-md-12",children:Object(s.jsxs)("div",{className:"card",children:[Object(s.jsx)("div",{className:"card-header userName",children:Object(s.jsx)("strong",{children:u.username})}),Object(s.jsxs)("div",{className:"card-body",children:[Object(s.jsxs)("div",{className:"row",children:[Object(s.jsxs)("div",{className:"col-md-8",children:[Object(s.jsxs)("p",{children:[Object(s.jsx)("span",{className:"user-label",children:d("user:Email")}),": ",u.email]}),Object(s.jsxs)("p",{children:[Object(s.jsx)("span",{className:"user-label",children:d("user:Registration Date")}),": ",m]}),Object(s.jsxs)("p",{children:[Object(s.jsx)("span",{className:"user-label",children:d("user:First Name")}),": ",u.first_name]}),Object(s.jsxs)("p",{children:[Object(s.jsx)("span",{className:"user-label",children:d("user:Last Name")}),": ",u.last_name]}),Object(s.jsxs)("p",{children:[Object(s.jsx)("span",{className:"user-label",children:d("user:Birth Date")}),": ",j]}),Object(s.jsxs)("p",{children:[Object(s.jsx)("span",{className:"user-label",children:d("user:Location")}),": ",u.location]}),Object(s.jsxs)("p",{children:[Object(s.jsx)("span",{className:"user-label",children:d("user:Bio")}),":"," ",u.bio]}),Object(s.jsxs)("p",{children:[Object(s.jsx)("span",{className:"user-label",children:d("user:Language")}),": ",u.language]}),Object(s.jsxs)("p",{children:[Object(s.jsx)("span",{className:"user-label",children:d("user:Timezone")}),": ",u.timezone]}),Object(s.jsxs)("p",{children:[Object(s.jsx)("span",{className:"user-label",children:d("user:First day of week")}),": ",u.weekm?d("user:Monday"):d("user:Sunday")]})]}),Object(s.jsxs)("div",{className:"col-md-4",children:[!0===u.picture&&Object(s.jsxs)("div",{children:[Object(s.jsx)("img",{alt:"Profile",src:"".concat(T,"users/").concat(u.username,"/picture")+"?".concat(Date.now()),className:"img-fluid App-profile-img-small"}),r&&Object(s.jsxs)(s.Fragment,{children:[Object(s.jsx)("br",{}),Object(s.jsx)("button",{type:"submit",onClick:function(){return c()},children:d("user:Delete picture")}),Object(s.jsx)("br",{}),Object(s.jsx)("br",{})]})]}),r&&Object(s.jsxs)("form",{encType:"multipart/form-data",onSubmit:function(e){return i(e)},children:[Object(s.jsx)("input",{type:"file",name:"picture",accept:".png,.jpg,.gif"}),Object(s.jsx)("br",{}),Object(s.jsx)("button",{type:"submit",children:d("user:Send")})," (max. size: ".concat(p,")")]})," "]})]}),r&&Object(s.jsx)("button",{className:"btn btn-primary",onClick:function(){return Ws.push("/profile/edit")},children:d("common:Edit")}),n&&Object(s.jsx)("button",{className:"btn btn-danger",onClick:function(){return a(!0)},children:d("user:Delete user account")}),Object(s.jsx)("button",{className:"btn btn-secondary",onClick:function(){return"/profile"===l?Ws.push("/"):Ws.go(-1)},children:d("/profile"===l?"common:Back to home":"common:Back")})]})]})})})]})]})})));var xt=Object(N.a)()(Object(k.c)((function(e){return{user:e.user}}))((function(e){var t=e.t,a=e.user;return Object(s.jsx)("div",{children:Object(s.jsx)(ft,{editable:!0,t:t,user:a})})}))),gt=a(472),vt=a(473),kt=a(474),wt=a(475),yt=a(234),Nt=a(238),_t=a(476),St=a(477),Dt=a(110),Ct=a(478),Et=a(486),At=a(488);function Mt(e){var t=e.isDisabled,a=e.isMore,r=e.sportImg,n=e.workout;return Object(s.jsx)(te.a,{className:"calendar-workout".concat(a),to:"/workouts/".concat(n.id),children:Object(s.jsxs)(s.Fragment,{children:[Object(s.jsx)("img",{alt:"workout sport logo",className:"workout-sport ".concat(t),src:r,title:n.title}),n.records.length>0&&Object(s.jsx)("sup",{children:Object(s.jsx)("i",{className:"fa fa-trophy custom-fa-small","aria-hidden":"true",title:n.records.map((function(e){return" ".concat(xe.filter((function(t){return t.record_type===e.record_type}))[0].label)}))})})]})})}var Tt=function(e){Object(g.a)(a,e);var t=Object(v.a)(a);function a(e,s){var r;return Object(f.a)(this,a),(r=t.call(this,e,s)).state={isHidden:!0},r}return Object(x.a)(a,[{key:"handleDisplayMore",value:function(){this.setState({isHidden:!this.state.isHidden})}},{key:"render",value:function(){var e=this,t=this.props,a=t.dayWorkouts,r=t.isDisabled,n=t.sports,o=this.state.isHidden;return Object(s.jsxs)("div",{children:[a.map((function(e){return Object(s.jsx)(Mt,{workout:e,isDisabled:r,isMore:"",sportImg:n.filter((function(t){return t.id===e.sport_id})).map((function(e){return e.img}))},e.id)})),a.length>2&&Object(s.jsx)("i",{className:"fa fa-".concat(o?"plus":"times"," calendar-more"),"aria-hidden":"true",onClick:function(){return e.handleDisplayMore()},title:"show more workouts"}),!o&&Object(s.jsx)("div",{className:"calendar-display-more",children:a.map((function(e){return Object(s.jsx)(Mt,{workout:e,isDisabled:r,isMore:"-more",sportImg:n.filter((function(t){return t.id===e.sport_id})).map((function(e){return e.img}))},e.id)}))})]})}}]),a}(o.a.Component),Pt=function(e,t){var a=Object(gt.a)(e),s=Object(vt.a)(e),r=t?1:0;return{start:Object(kt.a)(a,{weekStartsOn:r}),end:Object(wt.a)(s)}},Ft=function(e){Object(g.a)(a,e);var t=Object(v.a)(a);function a(e,s){var r;Object(f.a)(this,a),r=t.call(this,e,s);var n=new Date;return r.state={currentMonth:n,startDate:Pt(n,e.weekm).start,endDate:Pt(n,e.weekm).end,weekStartOnMonday:e.weekm},r}return Object(x.a)(a,[{key:"componentDidMount",value:function(){this.props.loadMonthWorkouts(this.state.startDate,this.state.endDate)}},{key:"renderHeader",value:function(e){var t=this;return Object(s.jsxs)("div",{className:"header row flex-middle",children:[Object(s.jsx)("div",{className:"col col-start",onClick:function(){return t.handlePrevMonth()},children:Object(s.jsx)("i",{className:"fa fa-chevron-left","aria-hidden":"true"})}),Object(s.jsx)("div",{className:"col col-center",children:Object(s.jsx)("span",{children:Object(D.a)(this.state.currentMonth,"MMM yyyy",e)})}),Object(s.jsx)("div",{className:"col col-end",onClick:function(){return t.handleNextMonth()},children:Object(s.jsx)("i",{className:"fa fa-chevron-right","aria-hidden":"true"})})]})}},{key:"renderDays",value:function(e){for(var t=[],a=this.state.startDate,r=0;r<7;r++)t.push(Object(s.jsx)("div",{className:"col col-center",children:Object(D.a)(Object(yt.a)(a,r),"EEE",e)},r));return Object(s.jsx)("div",{className:"days row",children:t})}},{key:"filterWorkouts",value:function(e){var t=this.props,a=t.workouts,s=t.user;return a?a.filter((function(t){return Object(Nt.a)(L(t.workout_date,s.timezone),e)})):[]}},{key:"renderCells",value:function(){for(var e=this.state,t=e.currentMonth,a=e.startDate,r=e.endDate,n=e.weekStartOnMonday,o=this.props.sports,c=[],i=[],l=a,d="";l<=r;){for(var u=0;u<7;u++){d=Object(D.a)(l,"d");var m=this.filterWorkouts(l),j=Object(_t.a)(l,t)?"":"-disabled",p=n?[5,6].includes(u):[0,6].includes(u);i.push(Object(s.jsx)("div",{className:"col cell ".concat(p?" weekend":"").concat(Object(St.a)(l)?" today":""),children:Object(s.jsxs)("div",{className:"img".concat(j),children:[Object(s.jsx)("span",{className:"number",children:d}),Object(s.jsx)(Tt,{dayWorkouts:m,isDisabled:j,sports:o})]})},l)),l=Object(yt.a)(l,1)}c.push(Object(s.jsx)("div",{className:"row",children:i},l)),i=[]}return Object(s.jsx)("div",{className:"body",children:c})}},{key:"updateStateDate",value:function(e){var t=Pt(e,this.state.weekStartOnMonday),a=t.start,s=t.end;this.setState({currentMonth:e,startDate:a,endDate:s}),this.props.loadMonthWorkouts(a,s)}},{key:"handleNextMonth",value:function(){var e=Object(Dt.a)(this.state.currentMonth,1);this.updateStateDate(e)}},{key:"handlePrevMonth",value:function(){var e=Object(Ct.a)(this.state.currentMonth,1);this.updateStateDate(e)}},{key:"render",value:function(){var e={locale:"fr"===this.props.language?Et.a:At.a};return Object(s.jsx)("div",{className:"card workout-card",children:Object(s.jsxs)("div",{className:"calendar",children:[this.renderHeader(e),this.renderDays(e),this.renderCells()]})})}}]),a}(o.a.Component),zt=Object(k.c)((function(e){return{workouts:e.calendarWorkouts.data,language:e.language,sports:e.sports.data,user:e.user}}),(function(e){return{loadMonthWorkouts:function(t,a){var s,r,n="yyyy-MM-dd";e((s=Object(D.a)(t,n),r=Object(D.a)(a,n),function(e){return H.getData("workouts",{from:s,to:r,order:"asc",per_page:100}).then((function(t){"success"===t.status?e({type:"UPDATE_CALENDAR",workouts:t.data.workouts}):e(V("workouts|".concat(t.message)))})).catch((function(t){return e(V("workouts|".concat(t)))}))}))}}}))(Ft);function Rt(e){var t=e.records,a=e.sports,r=e.t,n=e.user,o=ye(a,r),c=t.reduce((function(e,t){var a=o.find((function(e){return e.id===t.sport_id}));return void 0===e[a.label]&&(e[a.label]={img:a.img,records:[]}),e[a.label].records.push(function(e,t){var a;switch(e.record_type){case"AS":case"MS":a="".concat(e.value," km/h");break;case"FD":a="".concat(e.value," km");break;default:a=e.value}var s=xe.filter((function(t){return t.record_type===e.record_type})),r=Object(pe.a)(s,1)[0];return{workout_date:ge(L(e.workout_date,t)).workout_date,workout_id:e.workout_id,id:e.id,record_type:r.label,value:a}}(t,n.timezone)),e}),{});return Object(s.jsxs)("div",{className:"card workout-card",children:[Object(s.jsx)("div",{className:"card-header",children:r("workouts:Personal records")}),Object(s.jsx)("div",{className:"card-body",children:0===Object.keys(c).length?r("common:No records."):Object.keys(c).sort().map((function(e){return Object(s.jsxs)("div",{children:[Object(s.jsxs)("span",{className:"heading-span",children:[Object(s.jsx)("img",{alt:"".concat(e," logo"),className:"record-logo",src:c[e].img}),e]}),Object(s.jsxs)("table",{className:"table table-borderless table-sm record-table",children:[Object(s.jsx)("thead",{children:Object(s.jsx)("tr",{children:Object(s.jsxs)("th",{colSpan:"3",children:[Object(s.jsx)("img",{alt:"".concat(e," logo"),className:"record-logo",src:c[e].img}),e]})})}),Object(s.jsx)("tbody",{children:c[e].records.map((function(e){return Object(s.jsxs)("tr",{className:"record-tr",children:[Object(s.jsx)("td",{className:"record-td",children:r("workouts:".concat(e.record_type))}),Object(s.jsx)("td",{className:"record-td text-right",children:e.value}),Object(s.jsx)("td",{className:"record-td text-right",children:Object(s.jsx)(te.a,{to:"/workouts/".concat(e.workout_id),children:e.workout_date})})]},e.id)}))})]})]},e)}))})]})}var Lt=a(235),Ut=a(479),It=[{duration:"week",dateFormat:"yyyy-MM-dd",xAxis:"dd/MM"},{duration:"month",dateFormat:"yyyy-MM",xAxis:"MM/yyyy"},{duration:"year",dateFormat:"yyyy",xAxis:"yyyy"}],Wt=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a="0";t&&(a=String(Math.floor(e/86400)),e%=86400);var s=String(Math.floor(e/3600)).padStart(2,"0");e%=3600;var r=String(Math.floor(e/60)).padStart(2,"0"),n=String(e%60).padStart(2,"0");return t?"".concat("0"===a?"":"".concat(a,"d:")).concat("00"===s?"":"".concat(s,"h:")).concat(r,"m:").concat(n,"s"):"".concat("00"===s?"":"".concat(s,":")).concat(r,":").concat(n)},Ht=function(e,t){return 0===t?"":"distance"===e?"".concat(t.toFixed(2)," km"):"duration"===e?Wt(t):t},qt=function(e,t){switch(e){case"week":return Object(yt.a)(t,7);case"year":return Object(Lt.a)(t,1);case"month":default:return Object(Dt.a)(t,1)}},Bt=function(e,t,a,s,r){for(var n=[],o=[],c=[],i=function(r){var i=It.filter((function(e){return e.duration===a.duration})),l=Object(pe.a)(i,1)[0],d=Object(D.a)(r,l.dateFormat),u=Object(D.a)(r,l.xAxis),m={date:u},j={date:u},p={date:u};e[d]&&Object.keys(e[d]).filter((function(e){return!s||s.includes(+e)})).map((function(a){var s=t.filter((function(e){return e.id===+a}))[0].label;return m[s]=e[d][a].nb_workouts,j[s]=e[d][a].total_distance,p[s]=e[d][a].total_duration,null})),n.push(m),o.push(j),c.push(p)},l=function(e,t,a){switch(e){case"week":return Object(kt.a)(t,{weekStartsOn:a?1:0});case"year":return Object(Ut.a)(t);case"month":default:return Object(gt.a)(t)}}(a.duration,a.start,r);l<=a.end;l=qt(a.duration,l))i(l);return{workouts:n,distance:o,duration:c}},Vt=function(e,t){return"duration"===e?Wt(t,!0):"distance"===e?t.toFixed(2):t};function Gt(e){if(e.active){var t=e.displayedData,a=e.payload,r=e.label,n=0;return a.map((function(e){return n+=e.value})),Object(s.jsxs)("div",{className:"custom-tooltip",children:[Object(s.jsx)("p",{className:"custom-tooltip-label",children:r}),a.map((function(e){return Object(s.jsxs)("p",{style:{color:e.fill},children:[e.name,": ",Vt(t,e.value)," ",e.unit]},e.name)})),a.length>0&&Object(s.jsxs)("p",{children:["Total: ",Vt(t,n)]})]})}return null}function Jt(e){var t=e.displayedData,a=e.x,r=e.y,n=e.width,o=e.value;if(!o)return null;var c=Ht(t,o);return Object(s.jsx)("g",{children:Object(s.jsx)("text",{x:a+n/2,y:r-10,fill:"#666",fontSize:"11",textAnchor:"middle",dominantBaseline:"middle",children:c})})}var Kt=function(e){Object(g.a)(a,e);var t=Object(v.a)(a);function a(e,s){var r;return Object(f.a)(this,a),(r=t.call(this,e,s)).state={displayedData:"distance"},r}return Object(x.a)(a,[{key:"handleRadioChange",value:function(e){this.setState({displayedData:e.target.name})}},{key:"render",value:function(){var e=this,t=this.state.displayedData,a=this.props,r=a.sports,n=a.stats,o=a.t;return 0===Object.keys(n).length?o("common:No workouts."):Object(s.jsxs)("div",{className:"chart-stats",children:[Object(s.jsxs)("div",{className:"row chart-radio",children:[Object(s.jsxs)("label",{className:"radioLabel col",children:[Object(s.jsx)("input",{type:"radio",name:"distance",checked:"distance"===t,onChange:function(t){return e.handleRadioChange(t)}}),o("statistics:distance")]}),Object(s.jsxs)("label",{className:"radioLabel col",children:[Object(s.jsx)("input",{type:"radio",name:"duration",checked:"duration"===t,onChange:function(t){return e.handleRadioChange(t)}}),o("statistics:duration")]}),Object(s.jsxs)("label",{className:"radioLabel col",children:[Object(s.jsx)("input",{type:"radio",name:"workouts",checked:"workouts"===t,onChange:function(t){return e.handleRadioChange(t)}}),o("statistics:workouts")]})]}),Object(s.jsx)(qe.f,{height:300,children:Object(s.jsxs)(qe.c,{data:n[t],margin:{top:15,bottom:0},children:[Object(s.jsx)(qe.h,{dataKey:"date",interval:0}),Object(s.jsx)(qe.i,{tickFormatter:function(e){return Ht(t,e)}}),Object(s.jsx)(qe.g,{content:Object(s.jsx)(Gt,{displayedData:t})}),r.map((function(e,a){return Object(s.jsx)(qe.b,{isAnimationActive:!1,dataKey:e.label,stackId:"a",fill:fe[a],label:a===r.length-1?Object(s.jsx)(Jt,{displayedData:t}):"",name:o("sports:".concat(e.label))},e.id)}))]})})]})}}]),a}(o.a.PureComponent),Yt=function(e){Object(g.a)(a,e);var t=Object(v.a)(a);function a(){return Object(f.a)(this,a),t.apply(this,arguments)}return Object(x.a)(a,[{key:"componentDidMount",value:function(){this.updateData()}},{key:"componentDidUpdate",value:function(e){(this.props.user.username&&this.props.user.username!==e.user.username||this.props.statsParams!==e.statsParams)&&this.updateData()}},{key:"updateData",value:function(){this.props.user.username&&this.props.loadWorkouts(this.props.user.username,this.props.user.weekm,this.props.statsParams)}},{key:"render",value:function(){var e=this.props,t=e.displayedSports,a=e.sports,r=e.statistics,n=e.statsParams,o=e.displayEmpty,c=e.t,i=e.user;if(!o&&0===Object.keys(r).length)return Object(s.jsx)("span",{children:c("common:No workouts.")});var l=Bt(r,a,n,t,i.weekm);return Object(s.jsx)(Kt,{sports:a,stats:l,t:c})}}]),a}(o.a.PureComponent),Xt=Object(k.c)((function(e){return{sports:e.sports.data,statistics:e.statistics.data,user:e.user}}),(function(e){return{loadWorkouts:function(t,a,s){var r="yyyy-MM-dd",n="week"===s.duration?"".concat(s.duration).concat(a?"m":""):s.duration,o={from:Object(D.a)(s.start,r),to:Object(D.a)(s.end,r),time:n};e(function(e,t,a){return function(s){return H.getData("stats/".concat(e,"/").concat(t),a).then((function(e){"success"===e.status?s(q("statistics",e.data)):s(V("statistics|".concat(e.message)))})).catch((function(e){return s(V("statistics|".concat(e)))}))}}(t,s.type,o))}}}))(Yt),$t=function(e){Object(g.a)(a,e);var t=Object(v.a)(a);function a(e,s){var r;Object(f.a)(this,a),r=t.call(this,e,s);var n=new Date;return r.state={start:Object(gt.a)(n),end:Object(vt.a)(n),duration:"week",type:"by_time"},r}return Object(x.a)(a,[{key:"render",value:function(){var e=this.props.t;return Object(s.jsxs)("div",{className:"card workout-card",children:[Object(s.jsx)("div",{className:"card-header",children:e("dashboard:This month")}),Object(s.jsx)("div",{className:"card-body",children:Object(s.jsx)(Xt,{displayEmpty:!1,statsParams:this.state,t:e})})]})}}]),a}(o.a.Component);function Zt(e){var t=e.t,a=e.user,r=a.total_duration.match(/day/g)?"".concat(a.total_duration.split(" ")[0]," ").concat(a.total_duration.match(/days/g)?t("common:days"):t("common:day")):"0 ".concat(t("common:days"),","),n=a.total_duration.match(/day/g)?a.total_duration.split(", ")[1]:a.total_duration;return n="".concat(n.split(":")[0],"h ").concat(n.split(":")[1],"min"),Object(s.jsxs)("div",{className:"row",children:[Object(s.jsx)("div",{className:"col-lg-3 col-md-6 col-sm-6",children:Object(s.jsx)("div",{className:"card workout-card",children:Object(s.jsxs)("div",{className:"card-body row",children:[Object(s.jsx)("div",{className:"col-3",children:Object(s.jsx)("i",{className:"fa fa-calendar fa-3x fa-color"})}),Object(s.jsxs)("div",{className:"col-9 text-right",children:[Object(s.jsx)("div",{className:"huge",children:a.nb_workouts}),Object(s.jsx)("div",{children:"".concat(1===a.nb_workouts?t("common:workout"):t("common:workouts"))})]})]})})}),Object(s.jsx)("div",{className:"col-lg-3 col-md-6 col-sm-6",children:Object(s.jsx)("div",{className:"card workout-card",children:Object(s.jsxs)("div",{className:"card-body row",children:[Object(s.jsx)("div",{className:"col-3",children:Object(s.jsx)("i",{className:"fa fa-road fa-3x fa-color"})}),Object(s.jsxs)("div",{className:"col-9 text-right",children:[Object(s.jsx)("div",{className:"huge",children:Number(a.total_distance).toFixed(2)}),Object(s.jsx)("div",{children:"km"})]})]})})}),Object(s.jsx)("div",{className:"col-lg-3 col-md-6 col-sm-6",children:Object(s.jsx)("div",{className:"card workout-card",children:Object(s.jsxs)("div",{className:"card-body row",children:[Object(s.jsx)("div",{className:"col-3",children:Object(s.jsx)("i",{className:"fa fa-clock-o fa-3x fa-color"})}),Object(s.jsxs)("div",{className:"col-9 text-right",children:[Object(s.jsx)("div",{className:"huge",children:r}),Object(s.jsx)("div",{children:n})]})]})})}),Object(s.jsx)("div",{className:"col-lg-3 col-md-6 col-sm-6",children:Object(s.jsx)("div",{className:"card workout-card",children:Object(s.jsxs)("div",{className:"card-body row",children:[Object(s.jsx)("div",{className:"col-3",children:Object(s.jsx)("i",{className:"fa fa-tags fa-3x fa-color"})}),Object(s.jsxs)("div",{className:"col-9 text-right",children:[Object(s.jsx)("div",{className:"huge",children:a.nb_sports}),Object(s.jsx)("div",{children:"".concat(1===a.nb_sports?t("common:sport"):t("common:sports"))})]})]})})})]})}function Qt(e){var t=e.sports,a=e.t,r=e.user,n=e.workout;return Object(s.jsxs)("div",{className:"card workout-card text-center",children:[Object(s.jsx)("div",{className:"card-header",children:Object(s.jsxs)(te.a,{to:"/workouts/".concat(n.id),children:[t.filter((function(e){return e.id===n.sport_id})).map((function(e){return a("sports:".concat(e.label))}))," ","-"," ",Object(D.a)(L(n.workout_date,r.timezone),"dd/MM/yyyy HH:mm")]})}),Object(s.jsx)("div",{className:"card-body",children:Object(s.jsxs)("div",{className:"row",children:[n.map&&Object(s.jsx)("div",{className:"col",children:Object(s.jsx)(pt,{workout:n})}),Object(s.jsx)("div",{className:"col",children:Object(s.jsxs)("p",{children:[Object(s.jsx)("i",{className:"fa fa-clock-o","aria-hidden":"true"})," ",a("workouts:Duration"),": ",n.moving,n.map?Object(s.jsxs)("span",{children:[Object(s.jsx)("br",{}),Object(s.jsx)("br",{})]}):" - ",Object(s.jsx)("i",{className:"fa fa-road","aria-hidden":"true"})," ",a("workouts:Distance"),": ",n.distance," km"]})})]})})]})}var ea=function(e){Object(g.a)(a,e);var t=Object(v.a)(a);function a(e,s){var r;return Object(f.a)(this,a),(r=t.call(this,e,s)).state={page:1},r}return Object(x.a)(a,[{key:"componentDidMount",value:function(){this.props.loadWorkouts()}},{key:"render",value:function(){var e=this,t=this.props,a=t.loadMoreWorkouts,r=t.message,n=t.records,o=t.sports,c=t.t,i=t.user,l=t.workouts,d=!(l.length>0)||null===l[l.length-1].previous_workout,u=this.state.page;return Object(s.jsxs)("div",{children:[Object(s.jsx)(y.a,{children:Object(s.jsxs)("title",{children:["FitTrackee - ",c("common:Dashboard")]})}),r?Object(s.jsx)(_,{message:r,t:c}):l&&i.total_duration&&o.length>0&&Object(s.jsxs)("div",{className:"container dashboard",children:[Object(s.jsx)(Zt,{user:i,t:c}),Object(s.jsxs)("div",{className:"row",children:[Object(s.jsxs)("div",{className:"col-md-4",children:[Object(s.jsx)($t,{t:c}),Object(s.jsx)(Rt,{t:c,records:n,sports:o,user:i})]}),Object(s.jsxs)("div",{className:"col-md-8",children:[Object(s.jsx)(zt,{weekm:i.weekm}),l.length>0?l.map((function(e){return Object(s.jsx)(Qt,{workout:e,sports:o,t:c,user:i},e.id)})):Object(s.jsx)(mt,{t:c}),!d&&Object(s.jsx)("input",{type:"submit",className:"btn btn-default btn-md btn-block",value:"Load more workouts",onClick:function(){a(u+1),e.setState({page:u+1})}})]})]})]})]})}}]),a}(o.a.Component),ta=Object(N.a)()(Object(k.c)((function(e){return{workouts:e.workouts.data,message:e.message,records:e.records.data,sports:e.sports.data,user:e.user}}),(function(e){return{loadWorkouts:function(){e(Y("getData","workouts",{page:1})),e(Y("getData","records"))},loadMoreWorkouts:function(t){e(Fe({page:t}))}}}))(ea));function aa(){return Object(s.jsx)("footer",{className:"footer",children:Object(s.jsxs)("div",{className:"container",children:[Object(s.jsx)("strong",{children:"FitTrackee"})," v","0.4.3"," -"," ",Object(s.jsx)("a",{href:"https://github.com/SamR1/FitTrackee",target:"_blank",rel:"noopener noreferrer",children:"source code"})," ","under"," ",Object(s.jsx)("a",{href:"https://choosealicense.com/licenses/gpl-3.0/",target:"_blank",rel:"noopener noreferrer",children:"GPLv3"})," ","license -"," ",Object(s.jsx)("a",{href:"https://samr1.github.io/FitTrackee/",target:"_blank",rel:"noopener noreferrer",children:"documentation"})]})})}var sa=function(e){Object(g.a)(a,e);var t=Object(v.a)(a);function a(){return Object(f.a)(this,a),t.apply(this,arguments)}return Object(x.a)(a,[{key:"componentDidMount",value:function(){this.props.UserLogout()}},{key:"render",value:function(){return Object(s.jsx)("div",{className:"container dashboard",children:Object(s.jsxs)("div",{className:"row",children:[Object(s.jsx)("div",{className:"col-2"}),Object(s.jsx)("div",{className:"card col-8",children:Object(s.jsx)("div",{className:"card-body",children:Object(s.jsx)("div",{className:"text-center",children:Object(s.jsxs)(je.a,{i18nKey:"user:loggedOut",children:["You are now logged out. Click ",Object(s.jsx)(te.a,{to:"/login",children:"here"})," to log back in."]})})})}),Object(s.jsx)("div",{className:"col-2"})]})})}}]),a}(o.a.Component),ra=Object(k.c)((function(e){return{user:e.user}}),(function(e){return{UserLogout:function(){e({type:"LOGOUT"})}}}))(sa);function na(){return(na=Object.assign||function(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(s=0;s=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var ca=n.createElement("path",{d:"m466.916 27.803h-421.832c-24.859 0-45.084 20.225-45.084 45.084v366.226c0 24.859 20.225 45.084 45.084 45.084h421.832c24.859 0 45.084-20.225 45.084-45.084v-366.226c0-24.859-20.225-45.084-45.084-45.084z",fill:"#f0f9ff"}),ia=n.createElement("path",{d:"m198.58 188.334-181.344-150.862c-7.75 6.107-13.456 14.691-15.905 24.554l164.142 136.551h33.102z",fill:"#f40055"}),la=n.createElement("path",{d:"m313.425 198.576h33.93l163.447-135.973c-2.325-9.923-7.93-18.592-15.613-24.796l-181.764 151.211z",fill:"#c20044"}),da=n.createElement("path",{d:"m165.472 313.425-164.141 136.549c2.449 9.863 8.155 18.447 15.905 24.553l181.344-150.861-.005-10.241z",fill:"#f40055"}),ua=n.createElement("path",{d:"m313.425 313.425v9.557l181.765 151.211c7.683-6.204 13.288-14.874 15.613-24.796l-163.446-135.971z",fill:"#c20044"}),ma=n.createElement("path",{d:"m53.273 27.803 145.302 120.879v-120.879z",fill:"#406bd4"}),ja=n.createElement("path",{d:"m313.425 150.571v-122.768h148.082z",fill:"#3257b0"}),pa=n.createElement("path",{d:"m394.732 198.575 117.268-97.556v97.556z",fill:"#3257b0"}),ha=n.createElement("g",{fill:"#406bd4"},n.createElement("path",{d:"m0 99.317v99.258h119.313z"}),n.createElement("path",{d:"m0 313.425v97.699l117.44-97.699z"}),n.createElement("path",{d:"m50.49 484.197 148.085-122.676v122.676z"})),ba=n.createElement("path",{d:"m313.425 484.197v-124.139l149.221 124.139z",fill:"#3257b0"}),Oa=n.createElement("path",{d:"m512 409.423-115.395-95.998h115.395z",fill:"#3257b0"}),fa=n.createElement("path",{d:"m512 222.142h-222.142v-194.339h-67.716v194.339h-222.142v67.716h222.142v194.339h67.716v-194.339h222.142z",fill:"#f40055"}),xa=n.createElement("path",{d:"m289.858 222.142v-194.339h-33.858v456.394h33.858v-194.339h222.142v-67.716z",fill:"#c20044"});function ga(e,t){let a=e.title,s=e.titleId,r=oa(e,["title","titleId"]);return n.createElement("svg",na({id:"Capa_1",enableBackground:"new 0 0 512 512",height:512,viewBox:"0 0 512 512",width:512,xmlns:"http://www.w3.org/2000/svg",ref:t,"aria-labelledby":s},r),a?n.createElement("title",{id:s},a):null,ca,ia,la,da,ua,ma,ja,pa,ha,ba,Oa,fa,xa)}const va=n.forwardRef(ga);a.p;function ka(){return(ka=Object.assign||function(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(s=0;s=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var ya=n.createElement("path",{d:"m173.899 31.804h-8.707l-4.397-4h-115.711c-24.859-.001-45.084 20.224-45.084 45.083v366.226c0 24.859 20.225 45.084 45.084 45.084h115.711l6.348-4h6.755v-448.393z",fill:"#406bd4"}),Na=n.createElement("path",{d:"m466.916 27.803h-115.711l-4.523 4h-5.141v448.393h4.141l5.523 4h115.711c24.859 0 45.084-20.225 45.084-45.084v-366.225c0-24.859-20.225-45.084-45.084-45.084z",fill:"#c20044"}),_a=n.createElement("path",{d:"m160.795 27.803h190.409v456.394h-190.409z",fill:"#f0f9ff"}),Sa=n.createElement("path",{d:"m256 27.803h95.205v456.394h-95.205z",fill:"#cee5f5"});function Da(e,t){let a=e.title,s=e.titleId,r=wa(e,["title","titleId"]);return n.createElement("svg",ka({id:"Capa_1",enableBackground:"new 0 0 512 512",height:512,viewBox:"0 0 512 512",width:512,xmlns:"http://www.w3.org/2000/svg",ref:t,"aria-labelledby":s},r),a?n.createElement("title",{id:s},a):null,ya,Na,_a,Sa)}const Ca=n.forwardRef(Da);a.p;var Ea=[{name:"en",selected:!0,flag:Object(s.jsx)(va,{})},{name:"fr",selected:!1,flag:Object(s.jsx)(Ca,{})}],Aa=function(e){Object(g.a)(a,e);var t=Object(v.a)(a);function a(e){var s;return Object(f.a)(this,a),(s=t.call(this,e)).state={isOpen:!1},s}return Object(x.a)(a,[{key:"toggleDropdown",value:function(){this.setState((function(e){return{isOpen:!e.isOpen}}))}},{key:"render",value:function(){var e=this,t=this.state.isOpen,a=this.props,r=a.language,n=a.onUpdateLanguage;return Object(s.jsx)("div",{className:"dropdown-wrapper",onClick:function(){return e.toggleDropdown()},children:Object(s.jsx)("ul",{className:"dropdown-list i18n-flag",children:Ea.filter((function(e){return t?e:e.name===r})).map((function(e){return Object(s.jsxs)("li",{className:"dropdown-item".concat(e.name===r&&t?" dropdown-item-selected":""),onClick:function(){return n(e.name,r)},children:[e.flag," ",e.name]},e.name)}))})})}}]),a}(n.Component),Ma=Object(k.c)((function(e){return{language:e.language}}),(function(e){return{onUpdateLanguage:function(t,a){t!==a&&e(X(t))}}}))(Aa),Ta=function(e){Object(g.a)(a,e);var t=Object(v.a)(a);function a(){return Object(f.a)(this,a),t.apply(this,arguments)}return Object(x.a)(a,[{key:"render",value:function(){var e=this.props,t=e.admin,a=e.isAuthenticated,r=e.picture,n=e.t,o=e.username;return Object(s.jsx)("header",{children:Object(s.jsx)("nav",{className:"navbar navbar-expand-lg navbar-light bg-light",children:Object(s.jsxs)("div",{className:"container",children:[Object(s.jsx)("span",{className:"navbar-brand",children:"FitTrackee"}),Object(s.jsx)("button",{className:"navbar-toggler",type:"button","data-toggle":"collapse","data-target":"#navbarSupportedContent","aria-controls":"navbarSupportedContent","aria-expanded":"false","aria-label":"Toggle navigation",children:Object(s.jsx)("span",{className:"navbar-toggler-icon"})}),Object(s.jsxs)("div",{className:"collapse navbar-collapse",id:"navbarSupportedContent",children:[Object(s.jsxs)("ul",{className:"navbar-nav mr-auto",children:[Object(s.jsx)("li",{className:"nav-item",children:Object(s.jsx)(te.a,{className:"nav-link",to:{pathname:"/"},children:n("common:Dashboard")})}),a&&Object(s.jsx)("li",{className:"nav-item",children:Object(s.jsx)(te.a,{className:"nav-link",to:{pathname:"/workouts/history"},children:n("Workouts")})}),a&&Object(s.jsx)("li",{className:"nav-item",children:Object(s.jsx)(te.a,{className:"nav-link",to:{pathname:"/workouts/statistics"},children:n("common:Statistics")})}),t&&Object(s.jsx)("li",{className:"nav-item",children:Object(s.jsx)(te.a,{className:"nav-link",to:{pathname:"/admin"},children:"Admin"})}),a&&Object(s.jsx)("li",{className:"nav-item",children:Object(s.jsx)(te.a,{className:"nav-link",to:{pathname:"/workouts/add"},children:Object(s.jsx)("strong",{children:n("common:Add workout")})})})]}),Object(s.jsxs)("ul",{className:"navbar-nav flex-row ml-md-auto d-none d-md-flex",children:[!a&&Object(s.jsx)("li",{className:"nav-item",children:Object(s.jsx)(te.a,{className:"nav-link",to:{pathname:"/register"},children:n("user:Register")})}),!a&&Object(s.jsx)("li",{className:"nav-item",children:Object(s.jsx)(te.a,{className:"nav-link",to:{pathname:"/login"},children:n("user:Login")})}),a&&Object(s.jsxs)(s.Fragment,{children:[!0===r?Object(s.jsx)("img",{alt:"Avatar",src:"".concat(T,"users/").concat(o,"/picture?").concat(Date.now()),className:"img-fluid App-nav-profile-img"}):Object(s.jsx)("i",{className:"fa fa-user-circle-o fa-2x no-picture","aria-hidden":"true"}),Object(s.jsx)("li",{className:"nav-item",children:Object(s.jsx)(te.a,{className:"nav-link",to:{pathname:"/profile"},children:o})}),Object(s.jsx)("li",{className:"nav-item",children:Object(s.jsx)(te.a,{className:"nav-link",to:{pathname:"/logout"},children:n("user:Logout")})})]}),Object(s.jsx)("li",{children:Object(s.jsx)(Ma,{})})]})]})]})})})}}]),a}(o.a.PureComponent),Pa=Object(N.a)()(Object(k.c)((function(e){var t=e.user;return{admin:t.admin,isAuthenticated:t.isAuthenticated,picture:t.picture,username:t.username}}))(Ta));function Fa(){return(Fa=Object.assign||function(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(s=0;s=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var Ra=n.createElement("g",null,n.createElement("g",null,n.createElement("path",{d:"M468.683,287.265h-69.07c-4.147,0-7.508,3.361-7.508,7.508c0,4.147,3.361,7.508,7.508,7.508h69.07 c4.147,0,7.508-3.361,7.508-7.508C476.191,290.626,472.83,287.265,468.683,287.265z"}))),La=n.createElement("g",null,n.createElement("g",null,n.createElement("path",{d:"M105.012,268.377L85.781,256l19.231-12.376c3.487-2.243,4.495-6.888,2.251-10.376c-2.244-3.486-6.888-4.497-10.376-2.25 l-17.471,11.243v-20.776c0-4.147-3.361-7.508-7.508-7.508c-4.147,0-7.508,3.361-7.508,7.508v20.775l-17.47-11.243 c-3.486-2.245-8.132-1.238-10.376,2.25c-2.245,3.487-1.237,8.133,2.25,10.376L58.034,256l-19.231,12.376 c-3.487,2.244-4.495,6.889-2.25,10.376c1.435,2.23,3.852,3.446,6.32,3.446c1.391,0,2.799-0.386,4.056-1.196l17.47-11.243v20.775 c0,4.147,3.361,7.508,7.508,7.508c4.147,0,7.508-3.361,7.508-7.508V269.76l17.471,11.243c1.257,0.809,2.664,1.196,4.056,1.196 c2.467,0,4.885-1.216,6.32-3.446C109.507,275.266,108.499,270.62,105.012,268.377z"}))),Ua=n.createElement("g",null,n.createElement("g",null,n.createElement("path",{d:"M194.441,268.377L175.21,256l19.231-12.376c3.487-2.244,4.495-6.889,2.25-10.376c-2.245-3.486-6.888-4.497-10.376-2.25 l-17.47,11.243v-20.775c0-4.147-3.361-7.508-7.508-7.508c-4.147,0-7.508,3.361-7.508,7.508v20.776l-17.471-11.243 c-3.487-2.245-8.133-1.238-10.376,2.25c-2.245,3.487-1.237,8.133,2.25,10.376L147.463,256l-19.231,12.376 c-3.487,2.244-4.495,6.889-2.25,10.376c1.435,2.23,3.852,3.446,6.32,3.446c1.391,0,2.799-0.386,4.056-1.196l17.471-11.243v20.776 c0,4.147,3.361,7.508,7.508,7.508c4.147,0,7.508-3.361,7.508-7.508V269.76l17.47,11.243c1.257,0.809,2.664,1.196,4.056,1.196 c2.467,0,4.885-1.216,6.32-3.446C198.936,275.266,197.928,270.62,194.441,268.377z"}))),Ia=n.createElement("g",null,n.createElement("g",null,n.createElement("path",{d:"M283.871,268.377L264.64,256l19.231-12.376c3.487-2.243,4.495-6.888,2.251-10.376c-2.245-3.486-6.888-4.497-10.376-2.25 l-17.471,11.243v-20.775c0-4.147-3.361-7.508-7.508-7.508c-4.147,0-7.508,3.361-7.508,7.508v20.775l-17.471-11.243 c-3.486-2.245-8.134-1.238-10.376,2.25c-2.245,3.487-1.237,8.133,2.25,10.376L236.892,256l-19.231,12.376 c-3.487,2.244-4.495,6.889-2.25,10.376c1.435,2.23,3.852,3.446,6.32,3.446c1.391,0,2.799-0.386,4.056-1.196l17.471-11.243v20.775 c0,4.147,3.361,7.508,7.508,7.508c4.147,0,7.508-3.361,7.508-7.508V269.76l17.471,11.243c1.257,0.809,2.664,1.196,4.056,1.196 c2.467,0,4.886-1.216,6.32-3.446C288.366,275.266,287.358,270.62,283.871,268.377z"}))),Wa=n.createElement("g",null,n.createElement("g",null,n.createElement("path",{d:"M373.3,268.377L354.069,256l19.231-12.376c3.487-2.244,4.495-6.889,2.25-10.376c-2.244-3.486-6.888-4.497-10.376-2.25 l-17.471,11.243v-20.776c0-4.147-3.361-7.508-7.508-7.508c-4.147,0-7.508,3.361-7.508,7.508v20.775l-17.47-11.243 c-3.486-2.245-8.132-1.238-10.376,2.25c-2.245,3.487-1.237,8.133,2.25,10.376L326.322,256l-19.231,12.376 c-3.487,2.244-4.495,6.889-2.25,10.376c1.435,2.23,3.852,3.446,6.32,3.446c1.391,0,2.799-0.386,4.056-1.196l17.47-11.243v20.776 c0,4.147,3.361,7.508,7.508,7.508c4.147,0,7.508-3.361,7.508-7.508V269.76l17.471,11.243c1.257,0.809,2.664,1.196,4.056,1.196 c2.467,0,4.885-1.216,6.32-3.446C377.795,275.266,376.787,270.62,373.3,268.377z"}))),Ha=n.createElement("g",null,n.createElement("g",null,n.createElement("path",{d:"M271.792,330.359H15.016V181.642h93.1c4.147,0,7.508-3.361,7.508-7.508c0-4.147-3.361-7.508-7.508-7.508H12.513 C5.613,166.626,0,172.24,0,179.14v153.722c0,6.9,5.613,12.513,12.513,12.513h259.278c4.147,0,7.508-3.361,7.508-7.508 C279.299,333.72,275.939,330.359,271.792,330.359z"}))),qa=n.createElement("g",null,n.createElement("g",null,n.createElement("path",{d:"M499.487,166.626H162.174c-4.147,0-7.508,3.361-7.508,7.508c0,4.147,3.361,7.508,7.508,7.508h334.811v148.716H323.848 c-4.147,0-7.508,3.361-7.508,7.508c0,4.147,3.361,7.508,7.508,7.508h175.64c6.9,0,12.513-5.613,12.513-12.513V179.14 C512.001,172.24,506.387,166.626,499.487,166.626z"})));function Ba(e,t){let a=e.title,s=e.titleId,r=za(e,["title","titleId"]);return n.createElement("svg",Fa({id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 512.001 512.001",style:{enableBackground:"new 0 0 512.001 512.001"},xmlSpace:"preserve",ref:t,"aria-labelledby":s},r),a?n.createElement("title",{id:s},a):null,Ra,La,Ua,Ia,Wa,Ha,qa)}const Va=n.forwardRef(Ba);a.p;function Ga(){return(Ga=Object.assign||function(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(s=0;s=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var Ka=n.createElement("g",null,n.createElement("path",{d:"M339.798,260.429c0.13-0.026,0.257-0.061,0.385-0.094c0.109-0.028,0.219-0.051,0.326-0.084 c0.125-0.038,0.247-0.085,0.369-0.129c0.108-0.039,0.217-0.074,0.324-0.119c0.115-0.048,0.226-0.104,0.338-0.157 c0.109-0.052,0.22-0.1,0.327-0.158c0.107-0.057,0.208-0.122,0.312-0.184c0.107-0.064,0.215-0.124,0.319-0.194 c0.111-0.074,0.214-0.156,0.321-0.236c0.09-0.067,0.182-0.13,0.27-0.202c0.162-0.133,0.316-0.275,0.466-0.421 c0.027-0.026,0.056-0.048,0.083-0.075c0.028-0.028,0.052-0.059,0.079-0.088c0.144-0.148,0.284-0.3,0.416-0.46 c0.077-0.094,0.144-0.192,0.216-0.289c0.074-0.1,0.152-0.197,0.221-0.301c0.074-0.111,0.139-0.226,0.207-0.34 c0.057-0.096,0.118-0.19,0.171-0.289c0.062-0.115,0.114-0.234,0.169-0.351c0.049-0.104,0.101-0.207,0.146-0.314 c0.048-0.115,0.086-0.232,0.128-0.349c0.041-0.114,0.085-0.227,0.12-0.343c0.036-0.118,0.062-0.238,0.092-0.358 c0.029-0.118,0.063-0.234,0.086-0.353c0.028-0.141,0.045-0.283,0.065-0.425c0.014-0.1,0.033-0.199,0.043-0.3 c0.025-0.249,0.038-0.498,0.038-0.748V92.76c0-4.143-3.357-7.5-7.5-7.5h-236.25c-0.066,0-0.13,0.008-0.196,0.01 c-0.143,0.004-0.285,0.01-0.427,0.022c-0.113,0.009-0.225,0.022-0.337,0.037c-0.128,0.016-0.255,0.035-0.382,0.058 c-0.119,0.021-0.237,0.046-0.354,0.073c-0.119,0.028-0.238,0.058-0.356,0.092c-0.117,0.033-0.232,0.069-0.346,0.107 c-0.117,0.04-0.234,0.082-0.349,0.128c-0.109,0.043-0.216,0.087-0.322,0.135c-0.118,0.053-0.235,0.11-0.351,0.169 c-0.099,0.051-0.196,0.103-0.292,0.158c-0.116,0.066-0.23,0.136-0.343,0.208c-0.093,0.06-0.184,0.122-0.274,0.185 c-0.106,0.075-0.211,0.153-0.314,0.235c-0.094,0.075-0.186,0.152-0.277,0.231c-0.09,0.079-0.179,0.158-0.266,0.242 c-0.099,0.095-0.194,0.194-0.288,0.294c-0.047,0.05-0.097,0.094-0.142,0.145c-0.027,0.03-0.048,0.063-0.074,0.093 c-0.094,0.109-0.182,0.223-0.27,0.338c-0.064,0.084-0.13,0.168-0.19,0.254c-0.078,0.112-0.15,0.227-0.222,0.343 c-0.059,0.095-0.12,0.189-0.174,0.286c-0.063,0.112-0.118,0.227-0.175,0.342c-0.052,0.105-0.106,0.21-0.153,0.317 c-0.049,0.113-0.092,0.23-0.135,0.345c-0.043,0.113-0.087,0.225-0.124,0.339c-0.037,0.115-0.067,0.232-0.099,0.349 c-0.032,0.12-0.066,0.239-0.093,0.36c-0.025,0.113-0.042,0.228-0.062,0.342c-0.022,0.13-0.044,0.26-0.06,0.39 c-0.013,0.108-0.019,0.218-0.027,0.328c-0.01,0.14-0.019,0.28-0.021,0.421c-0.001,0.041-0.006,0.081-0.006,0.122v46.252 c0,4.143,3.357,7.5,7.5,7.5s7.5-3.357,7.5-7.5v-29.595l66.681,59.037c-0.348,0.245-0.683,0.516-0.995,0.827l-65.687,65.687v-49.288 c0-4.143-3.357-7.5-7.5-7.5s-7.5,3.357-7.5,7.5v9.164h-38.75c-4.143,0-7.5,3.357-7.5,7.5s3.357,7.5,7.5,7.5h38.75v43.231 c0,4.143,3.357,7.5,7.5,7.5h236.25c0.247,0,0.494-0.013,0.74-0.037c0.115-0.011,0.226-0.033,0.339-0.049 C339.542,260.469,339.67,260.454,339.798,260.429z M330.834,234.967l-65.688-65.687c-0.042-0.042-0.087-0.077-0.13-0.117 l49.383-41.897c3.158-2.68,3.546-7.412,0.866-10.571c-2.678-3.157-7.41-3.547-10.571-0.866l-84.381,71.59l-98.444-87.158h208.965 V234.967z M185.878,179.888c0.535-0.535,0.969-1.131,1.308-1.765l28.051,24.835c1.418,1.255,3.194,1.885,4.972,1.885 c1.726,0,3.451-0.593,4.853-1.781l28.587-24.254c0.26,0.38,0.553,0.743,0.89,1.08l65.687,65.687H120.191L185.878,179.888z"}),n.createElement("path",{d:"M7.5,170.676h126.667c4.143,0,7.5-3.357,7.5-7.5s-3.357-7.5-7.5-7.5H7.5c-4.143,0-7.5,3.357-7.5,7.5 S3.357,170.676,7.5,170.676z"}),n.createElement("path",{d:"M20.625,129.345H77.5c4.143,0,7.5-3.357,7.5-7.5s-3.357-7.5-7.5-7.5H20.625c-4.143,0-7.5,3.357-7.5,7.5 S16.482,129.345,20.625,129.345z"}),n.createElement("path",{d:"M62.5,226.51h-55c-4.143,0-7.5,3.357-7.5,7.5s3.357,7.5,7.5,7.5h55c4.143,0,7.5-3.357,7.5-7.5S66.643,226.51,62.5,226.51z"}));function Ya(e,t){let a=e.title,s=e.titleId,r=Ja(e,["title","titleId"]);return n.createElement("svg",Ga({id:"Capa_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 345.834 345.834",style:{enableBackground:"new 0 0 345.834 345.834"},xmlSpace:"preserve",ref:t,"aria-labelledby":s},r),a?n.createElement("title",{id:s},a):null,Ka)}const Xa=n.forwardRef(Ya);a.p;function $a(e){var t=Object(de.a)().t,a=e.action;return Object(s.jsx)("div",{className:"container dashboard",children:Object(s.jsxs)("div",{className:"row",children:[Object(s.jsx)("div",{className:"col-2"}),Object(s.jsx)("div",{className:"card col-8",children:Object(s.jsx)("div",{className:"card-body",children:Object(s.jsxs)("div",{className:"text-center ",children:["sent"===a&&Object(s.jsxs)(s.Fragment,{children:[Object(s.jsx)("div",{className:"svg-icon",children:Object(s.jsx)(Xa,{})}),t("user:Check your email. If your address is in our database, you'll received an email with a link to reset your password.")]}),"updated"===a&&Object(s.jsxs)(s.Fragment,{children:[Object(s.jsx)("div",{className:"svg-icon",children:Object(s.jsx)(Va,{})}),Object(s.jsxs)(je.a,{i18nKey:"user:updatedPasswordText",children:["Your password have been updated. Click",Object(s.jsx)(te.a,{to:"/login",children:"here"})," to log in."]})]})]})})}),Object(s.jsx)("div",{className:"col-2"})]})})}var Za=a(236),Qa=a.n(Za),es=function(e){Object(g.a)(a,e);var t=Object(v.a)(a);function a(e,s){var r;return Object(f.a)(this,a),(r=t.call(this,e,s)).state={formData:{},displayModal:!1},r}return Object(x.a)(a,[{key:"componentDidMount",value:function(){this.initForm()}},{key:"componentDidUpdate",value:function(e){e.user!==this.props.user&&this.initForm()}},{key:"initForm",value:function(){var e=this.props.user,t={};Object.keys(e).map((function(a){return null===e[a]?t[a]="":t[a]="birth_date"===a?Object(D.a)(new Date(e[a]),"yyyy-MM-DD"):e[a]})),this.setState({formData:t})}},{key:"handleFormChange",value:function(e){var t=this.state.formData;"weekm"===e.target.name?t.weekm="Monday"===e.target.value:t[e.target.name]=e.target.value,this.setState(t)}},{key:"displayModal",value:function(e){this.setState((function(t){return Object(S.a)(Object(S.a)({},t),{},{displayModal:e})}))}},{key:"render",value:function(){var e=this,t=this.props,a=t.message,r=t.onDeleteUser,n=t.onHandleProfileFormSubmit,o=t.t,c=t.user,i=this.state,l=i.displayModal,d=i.formData;return Object(s.jsxs)("div",{children:[Object(s.jsx)(y.a,{children:Object(s.jsxs)("title",{children:["FitTrackee - ",o("user:Profile Edition")]})}),d.isAuthenticated&&Object(s.jsxs)("div",{className:"container",children:[l&&Object(s.jsx)(We,{title:o("common:Confirmation"),text:o("user:Are you sure you want to delete your account? All data will be deleted, this cannot be undone."),confirm:function(){r(c.username),e.displayModal(!1)},close:function(){return e.displayModal(!1)}}),Object(s.jsx)("h1",{className:"page-title",children:o("user:Profile Edition")}),Object(s.jsxs)("div",{className:"row",children:[Object(s.jsx)("div",{className:"col-md-2"}),Object(s.jsx)("div",{className:"col-md-8",children:Object(s.jsxs)("div",{className:"card",children:[Object(s.jsx)("div",{className:"card-header",children:c.username}),Object(s.jsx)("div",{className:"card-body",children:Object(s.jsx)("div",{className:"row",children:Object(s.jsxs)("div",{className:"col-md-12",children:[Object(s.jsxs)("form",{onSubmit:function(e){e.preventDefault(),n(d)},children:[Object(s.jsx)("div",{className:"form-group",children:Object(s.jsxs)("label",{children:[o("user:Email"),":",Object(s.jsx)("input",{name:"email",className:"form-control input-lg",type:"text",value:d.email,readOnly:!0})]})}),Object(s.jsx)("div",{className:"form-group",children:Object(s.jsxs)("label",{children:[o("user:Registration Date"),":",Object(s.jsx)("input",{name:"createdAt",className:"form-control input-lg",type:"text",value:d.created_at,disabled:!0})]})}),Object(s.jsx)("div",{className:"form-group",children:Object(s.jsxs)("label",{children:[o("user:Password"),":",Object(s.jsx)("input",{name:"password",className:"form-control input-lg",type:"password",onChange:function(t){return e.handleFormChange(t)}})]})}),Object(s.jsx)("div",{className:"form-group",children:Object(s.jsxs)("label",{children:[o("user:Password Confirmation"),":",Object(s.jsx)("input",{name:"password_conf",className:"form-control input-lg",type:"password",onChange:function(t){return e.handleFormChange(t)}})]})}),Object(s.jsx)("hr",{}),Object(s.jsx)("div",{className:"form-group",children:Object(s.jsxs)("label",{children:[o("user:First Name"),":",Object(s.jsx)("input",{name:"first_name",className:"form-control input-lg",type:"text",value:d.first_name,onChange:function(t){return e.handleFormChange(t)}})]})}),Object(s.jsx)("div",{className:"form-group",children:Object(s.jsxs)("label",{children:[o("user:Last Name"),":",Object(s.jsx)("input",{name:"last_name",className:"form-control input-lg",type:"text",value:d.last_name,onChange:function(t){return e.handleFormChange(t)}})]})}),Object(s.jsx)("div",{className:"form-group",children:Object(s.jsxs)("label",{children:[o("user:Birth Date"),Object(s.jsx)("input",{name:"birth_date",className:"form-control input-lg",type:"date",value:d.birth_date,onChange:function(t){return e.handleFormChange(t)}})]})}),Object(s.jsx)("div",{className:"form-group",children:Object(s.jsxs)("label",{children:[o("user:Location"),":",Object(s.jsx)("input",{name:"location",className:"form-control input-lg",type:"text",value:d.location,onChange:function(t){return e.handleFormChange(t)}})]})}),Object(s.jsx)("div",{className:"form-group",children:Object(s.jsxs)("label",{children:[o("user:Bio"),":",Object(s.jsx)("textarea",{name:"bio",className:"form-control input-lg",maxLength:"200",value:d.bio,onChange:function(t){return e.handleFormChange(t)}})]})}),Object(s.jsx)("div",{className:"form-group",children:Object(s.jsxs)("label",{children:[o("user:Language"),":",Object(s.jsx)("select",{name:"language",className:"form-control input-lg",value:d.language,onChange:function(t){return e.handleFormChange(t)},children:Ea.map((function(e){return Object(s.jsx)("option",{value:e.name,children:e.name},e.name)}))})]})}),Object(s.jsx)("div",{className:"form-group",children:Object(s.jsxs)("label",{children:[o("user:Timezone"),":",Object(s.jsx)(Qa.a,{className:"form-control timezone-custom",onChange:function(t){var a={target:{name:"timezone",value:t||"Europe/Paris"}};e.handleFormChange(a)},value:d.timezone})]})}),Object(s.jsx)("div",{className:"form-group",children:Object(s.jsxs)("label",{children:[o("user:First day of week"),":",Object(s.jsxs)("select",{name:"weekm",className:"form-control input-lg",value:d.weekm?"Monday":"Sunday",onChange:function(t){return e.handleFormChange(t)},children:[Object(s.jsx)("option",{value:"Sunday",children:o("user:Sunday")}),Object(s.jsx)("option",{value:"Monday",children:o("user:Monday")})]})]})}),Object(s.jsx)("button",{type:"submit",className:"btn btn-primary",children:o("common:Submit")}),Object(s.jsx)("button",{className:"btn btn-danger",onClick:function(t){t.preventDefault(),e.displayModal(!0)},children:o("user:Delete my account")}),Object(s.jsx)("button",{type:"submit",className:"btn btn-secondary",onClick:function(){return Ws.push("/profile")},children:o("common:Cancel")})]}),Object(s.jsx)(_,{message:a,t:o})]})})})]})}),Object(s.jsx)("div",{className:"col-md-2"})]})]})]})}}]),a}(o.a.Component),ts=Object(N.a)()(Object(k.c)((function(e){return{location:e.router.location,message:e.message,user:e.user}}),(function(e){return{onDeleteUser:function(t){e(Ae(t))},onHandleProfileFormSubmit:function(t){e(function(e){return function(t){return!e.password===e.password_conf?t(Se("Password and password confirmation don't match.")):(delete e.id,H.postData("auth/profile/edit",e).then((function(e){if("success"===e.status)return t(Ce()),Ws.push("/profile");t(Se(e.message))})).catch((function(e){throw e})))}}(t))}}}))(es)),as=a(480),ss=a(481),rs=a(482),ns=a(237),os=["week","month","year"],cs=function(e){Object(g.a)(a,e);var t=Object(v.a)(a);function a(e,s){var r;Object(f.a)(this,a),r=t.call(this,e,s);var n=new Date;return r.state={displayedSports:e.sports.map((function(e){return e.id})),statsParams:{start:Object(gt.a)(Object(Ct.a)(n,11)),end:Object(vt.a)(n),duration:"month",type:"by_time"}},r}return Object(x.a)(a,[{key:"componentDidUpdate",value:function(e){this.props.sports!==e.sports&&this.updateDisplayedSports()}},{key:"updateDisplayedSports",value:function(){var e=this.props.sports;this.setState({displayedSports:e.map((function(e){return e.id}))})}},{key:"handleOnChangeDuration",value:function(e){var t=e.target.name,a=new Date,s="year"===t?Object(Ut.a)(Object(as.a)(a,9)):"week"===t?Object(gt.a)(Object(Ct.a)(a,2)):Object(gt.a)(Object(Ct.a)(a,11)),r="year"===t?Object(ss.a)(a):"week"===t?Object(wt.a)(a):Object(vt.a)(a);this.setState({statsParams:{duration:t,end:r,start:s,type:"by_time"}})}},{key:"handleOnChangeSports",value:function(e){var t=this.state.displayedSports;t.includes(e)?this.setState({displayedSports:t.filter((function(t){return t!==e}))}):this.setState({displayedSports:t.concat([e])})}},{key:"handleOnClickArrows",value:function(e){var t,a,s=this.state.statsParams,r=s.start,n=s.end,o=s.duration;e?(t="year"===o?Object(Ut.a)(Object(as.a)(r,1)):"week"===o?Object(kt.a)(Object(rs.a)(r,1)):Object(gt.a)(Object(Ct.a)(r,1)),a="year"===o?Object(ss.a)(Object(as.a)(n,1)):"week"===o?Object(wt.a)(Object(rs.a)(n,1)):Object(vt.a)(Object(Ct.a)(n,1))):(t="year"===o?Object(Ut.a)(Object(Lt.a)(r,1)):"week"===o?Object(kt.a)(Object(ns.a)(r,1)):Object(gt.a)(Object(Dt.a)(r,1)),a="year"===o?Object(ss.a)(Object(Lt.a)(n,1)):"week"===o?Object(wt.a)(Object(ns.a)(n,1)):Object(vt.a)(Object(Dt.a)(n,1))),this.setState({statsParams:{duration:o,end:a,start:t,type:"by_time"}})}},{key:"render",value:function(){var e=this,t=this.state,a=t.displayedSports,r=t.statsParams,n=this.props,o=n.sports,c=n.t,i=n.user,l=ye(o.filter((function(e){return i.sports_list.includes(e.id)})),c);return Object(s.jsxs)(s.Fragment,{children:[Object(s.jsx)(y.a,{children:Object(s.jsxs)("title",{children:["FitTrackee - ",c("statistics:Statistics")]})}),Object(s.jsxs)("div",{className:"container dashboard",children:[Object(s.jsxs)("div",{className:"card workout-card",children:[Object(s.jsx)("div",{className:"card-header",children:c("statistics:Statistics")}),Object(s.jsxs)("div",{className:"card-body".concat(0===i.nb_workouts?" stats-disabled":""),children:[Object(s.jsxs)("div",{className:"chart-filters row",children:[Object(s.jsx)("div",{className:"col chart-arrows",children:Object(s.jsx)("p",{className:"text-center",children:Object(s.jsx)("i",{className:"fa fa-chevron-left","aria-hidden":"true",onClick:function(){return e.handleOnClickArrows(!0)}})})}),Object(s.jsx)("div",{className:"col-md-3 time-frames justify-content-around",children:os.map((function(t){return Object(s.jsx)("div",{className:"time-frame",children:Object(s.jsxs)("label",{children:[Object(s.jsx)("input",{type:"radio",id:t,name:t,checked:t===r.duration,onChange:function(t){return e.handleOnChangeDuration(t)}}),Object(s.jsx)("span",{children:c("statistics:".concat(t))})]})},t)}))}),Object(s.jsx)("div",{className:"col chart-arrows",children:Object(s.jsx)("p",{className:"text-center",children:Object(s.jsx)("i",{className:"fa fa-chevron-right","aria-hidden":"true",onClick:function(){return e.handleOnClickArrows(!1)}})})})]}),Object(s.jsx)(Xt,{displayEmpty:!0,displayedSports:a,statsParams:r,t:c}),Object(s.jsx)("div",{className:"row chart-workouts",children:l.map((function(t){return Object(s.jsxs)("label",{className:"col workout-label",children:[Object(s.jsx)("input",{type:"checkbox",checked:a.includes(t.id),name:t.label,onChange:function(){return e.handleOnChangeSports(t.id)}}),Object(s.jsx)("span",{style:{color:fe[t.id-1]},children:" ".concat(t.label)})]},t.id)}))})]})]}),0===i.nb_workouts&&Object(s.jsx)(mt,{t:c})]})]})}}]),a}(o.a.Component),is=Object(N.a)()(Object(k.c)((function(e){return{sports:e.sports.data,user:e.user}}))(cs));function ls(e){var t=Object(de.a)().t,a="user:".concat(e.formType.charAt(0).toUpperCase()).concat(e.formType.slice(1));return Object(s.jsxs)("div",{children:[Object(s.jsx)(y.a,{children:Object(s.jsxs)("title",{children:["FitTrackee - ",t("user:".concat(e.formType))]})}),Object(s.jsx)("h1",{className:"page-title",children:t(a)}),Object(s.jsx)("div",{className:"container",children:Object(s.jsxs)("div",{className:"row",children:[Object(s.jsx)("div",{className:"col-md-3"}),Object(s.jsxs)("div",{className:"col-md-6",children:[Object(s.jsx)("br",{}),"register"!==e.formType||e.isRegistrationAllowed?Object(s.jsxs)(s.Fragment,{children:[Object(s.jsxs)("form",{onSubmit:function(t){return e.handleUserFormSubmit(t,e.formType)},children:["register"===e.formType&&Object(s.jsx)("div",{className:"form-group",children:Object(s.jsx)("input",{className:"form-control input-lg",name:"username",placeholder:t("user:Enter a username"),required:!0,type:"text",value:e.userForm.username,onChange:e.onHandleFormChange})}),"password reset"!==e.formType&&Object(s.jsx)("div",{className:"form-group",children:Object(s.jsx)("input",{className:"form-control input-lg",name:"email",placeholder:t("user:Enter an email address"),required:!0,type:"email",value:e.userForm.email,onChange:e.onHandleFormChange})}),"reset your password"!==e.formType&&Object(s.jsxs)(s.Fragment,{children:[Object(s.jsx)("div",{className:"form-group",children:Object(s.jsx)("input",{className:"form-control input-lg",name:"password",placeholder:t("user:Enter a password"),required:!0,type:"password",value:e.userForm.password,onChange:e.onHandleFormChange})}),"login"!==e.formType&&Object(s.jsx)("div",{className:"form-group",children:Object(s.jsx)("input",{className:"form-control input-lg",name:"password_conf",placeholder:t("user:Enter the password confirmation"),required:!0,type:"password",value:e.userForm.password_conf,onChange:e.onHandleFormChange})})]}),Object(s.jsx)("input",{type:"submit",className:"btn btn-primary btn-lg btn-block",value:t("Submit")})]}),Object(s.jsx)("p",{className:"password-forget",children:"login"===e.formType&&Object(s.jsx)(te.a,{to:{pathname:"/password-reset/request"},children:t("user:Forgot password?")})})]}):Object(s.jsxs)("div",{className:"card",children:[Object(s.jsx)("div",{className:"card-body",children:"Registration is disabled."}),Object(s.jsx)("div",{className:"card-body",children:Object(s.jsx)("button",{type:"submit",className:"btn btn-secondary btn-lg btn-block",onClick:function(){return Ws.go(-1)},children:"Back"})})]})]}),Object(s.jsx)("div",{className:"col-md-3"})]})})]})}var ds=function(e){Object(g.a)(a,e);var t=Object(v.a)(a);function a(e,s){var r;return Object(f.a)(this,a),(r=t.call(this,e,s)).state={formData:{username:"",email:"",password:"",password_conf:""}},r}return Object(x.a)(a,[{key:"componentDidUpdate",value:function(e){e.location.pathname!==this.props.location.pathname&&this.emptyForm()}},{key:"emptyForm",value:function(){var e=this.state.formData;Object.keys(e).map((function(t){return e[t]=""})),this.setState(e)}},{key:"onHandleFormChange",value:function(e){var t=this.state.formData;t[e.target.name]=e.target.value,this.setState(t)}},{key:"render",value:function(){var e=this,t=this.props,a=t.formType,r=t.isRegistrationAllowed,n=t.message,o=t.messages,c=t.onHandleUserFormSubmit,i=t.t,l=this.state.formData,d=this.props.location.query.token;return Object(s.jsx)("div",{children:z()||"password reset"===a&&!d?Object(s.jsx)(w.a,{to:"/"}):Object(s.jsxs)("div",{children:[Object(s.jsx)(_,{message:n,messages:o,t:i}),Object(s.jsx)(ls,{isRegistrationAllowed:r,formType:a,userForm:l,onHandleFormChange:function(t){return e.onHandleFormChange(t)},handleUserFormSubmit:function(e){e.preventDefault(),"password reset"===a&&(l.token=d),c(l,a)}})]})})}}]),a}(o.a.Component),us=Object(N.a)()(Object(k.c)((function(e){return{isRegistrationAllowed:e.application.config.is_registration_enabled,location:e.router.location,message:e.message,messages:e.messages}}),(function(e){return{onHandleUserFormSubmit:function(t,a){e(Ee(t,a="password reset"===a?"password/update":"reset your password"===a?"password/reset-request":a))}}}))(ds)),ms=function(e){Object(g.a)(a,e);var t=Object(v.a)(a);function a(e,s){var r;return Object(f.a)(this,a),(r=t.call(this,e,s)).state={displayModal:!1},r}return Object(x.a)(a,[{key:"componentDidMount",value:function(){this.props.loadUser(this.props.match.params.userName)}},{key:"componentDidUpdate",value:function(e){e.match.params.userName!==this.props.match.params.userName&&this.props.loadUser(this.props.match.params.userName)}},{key:"displayModal",value:function(e){this.setState((function(t){return Object(S.a)(Object(S.a)({},t),{},{displayModal:e})}))}},{key:"render",value:function(){var e=this,t=this.props,a=t.t,r=t.currentUser,n=t.onDeleteUser,o=t.users,c=this.state.displayModal,i=Object(pe.a)(o,1)[0],l=!!i&&r.username===i.username;return Object(s.jsxs)("div",{children:[c&&Object(s.jsx)(We,{title:a("common:Confirmation"),text:a("user:Are you sure you want to delete this account? All data will be deleted, this cannot be undone."),confirm:function(){n(i.username),e.displayModal(!1)},close:function(){return e.displayModal(!1)}}),i&&Object(s.jsx)(ft,{editable:l,isDeletable:r.admin&&!l,onDeleteUser:n,displayModal:function(t){return e.displayModal(t)},t:a,user:i})]})}}]),a}(o.a.Component),js=Object(N.a)()(Object(k.c)((function(e){return{currentUser:e.user,users:e.users.data}}),(function(e){return{onDeleteUser:function(t){e(Ae(t,!0))},loadUser:function(t){e(Y("getData","users",{username:t}))}}}))(ms)),ps=function(e){Object(g.a)(a,e);var t=Object(v.a)(a);function a(e){var s;return Object(f.a)(this,a),(s=t.call(this,e)).props=e,s}return Object(x.a)(a,[{key:"componentDidMount",value:function(){this.props.loadAppConfig()}},{key:"render",value:function(){return Object(s.jsxs)("div",{className:"App",children:[Object(s.jsx)(Pa,{}),Object(s.jsxs)(w.d,{children:[Object(s.jsx)(w.b,{exact:!0,path:"/",component:ta}),Object(s.jsx)(w.b,{exact:!0,path:"/register",render:function(){return Object(s.jsx)(us,{formType:"register"})}}),Object(s.jsx)(w.b,{exact:!0,path:"/login",render:function(){return Object(s.jsx)(us,{formType:"login"})}}),Object(s.jsx)(w.b,{exact:!0,path:"/password-reset",render:function(){return Object(s.jsx)(us,{formType:"password reset"})}}),Object(s.jsx)(w.b,{exact:!0,path:"/password-reset/request",render:function(){return Object(s.jsx)(us,{formType:"reset your password"})}}),Object(s.jsx)(w.b,{exact:!0,path:"/password-reset/sent",render:function(){return Object(s.jsx)($a,{action:"sent"})}}),Object(s.jsx)(w.b,{exact:!0,path:"/updated-password",render:function(){return Object(s.jsx)($a,{action:"updated"})}}),Object(s.jsx)(w.b,{exact:!0,path:"/password-reset/sent",component:$a}),Object(s.jsx)(w.b,{exact:!0,path:"/logout",component:ra}),Object(s.jsx)(w.b,{exact:!0,path:"/profile/edit",component:ts}),Object(s.jsx)(w.b,{exact:!0,path:"/profile",component:xt}),Object(s.jsx)(w.b,{exact:!0,path:"/workouts/history",component:Ot}),Object(s.jsx)(w.b,{exact:!0,path:"/workouts/statistics",component:is}),Object(s.jsx)(w.b,{exact:!0,path:"/users/:userName",component:js}),Object(s.jsx)(w.b,{path:"/workouts",component:ut}),Object(s.jsx)(w.b,{path:"/admin",component:me}),Object(s.jsx)(w.b,{component:ue})]}),Object(s.jsx)(aa,{})]})}}]),a}(o.a.Component),hs=Object(k.c)((function(){return{}}),(function(e){return{loadAppConfig:function(){e(Z("config"))}}}))(ps),bs=a(78);function Os(e){var t=e.store,a=e.history,r=e.children;return Object(s.jsx)(k.a,{store:t,children:Object(s.jsx)(bs.a,{history:a,children:r})})}var fs=Boolean("localhost"===window.location.hostname||"[::1]"===window.location.hostname||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));function xs(e){navigator.serviceWorker.register(e).then((function(e){e.onupdatefound=function(){var t=e.installing;t.onstatechange=function(){"installed"===t.state&&(navigator.serviceWorker.controller?console.log("New content is available; please refresh."):console.log("Content is cached for offline use."))}}})).catch((function(e){console.error("Error during service worker registration:",e)}))}var gs,vs={data:[]},ks={language:"en",message:"",messages:[],user:{isAuthenticated:!1},workouts:Object(S.a)({},vs),application:{statistics:{},config:{gpx_limit_import:null,is_registration_enabled:null,max_single_file_size:null,max_users:null,max_zip_file_size:null,registration:null}},calendarWorkouts:Object(S.a)({},vs),chartData:[],gpx:null,loading:!1,records:Object(S.a)({},vs),sports:Object(S.a)({},vs),statistics:{data:{}},users:Object(S.a)({},vs)},ws=function(e,t,a){return a.target!==t?e:"SET_DATA"===a.type?Object(S.a)(Object(S.a)({},e),{},{data:a.data[a.target]}):"SET_PAGINATED_DATA"===a.type?Object(S.a)(Object(S.a)({},e),{},{data:a.data[a.target],pagination:a.pagination}):e},ys=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ks.workouts,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"LOGOUT":return ks.workouts;case"PUSH_WORKOUTS":return Object(S.a)(Object(S.a)({},e),{},{data:e.data.concat(t.workouts)});case"REMOVE_WORKOUT":return Object(S.a)(Object(S.a)({},e),{},{data:e.data.filter((function(e){return e.id!==t.workoutId}))});default:return ws(e,"workouts",t)}},Ns=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ks.application,t=arguments.length>1?arguments[1]:void 0;return"SET_APP_CONFIG"===t.type?Object(S.a)(Object(S.a)({},e),{},{config:t.data}):"SET_APP_STATS"===t.type?Object(S.a)(Object(S.a)({},e),{},{statistics:t.data}):e},_s=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ks.calendarWorkouts,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"LOGOUT":return ks.calendarWorkouts;case"UPDATE_CALENDAR":return Object(S.a)(Object(S.a)({},e),{},{data:t.workouts});default:return ws(e,"calendarWorkouts",t)}},Ss=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ks.chartData,t=arguments.length>1?arguments[1]:void 0;return"SET_CHART_DATA"===t.type?t.chartData:e},Ds=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ks.gpx,t=arguments.length>1?arguments[1]:void 0;return"SET_GPX"===t.type?t.gpxContent:e},Cs=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ks.language,t=arguments.length>1?arguments[1]:void 0;return"SET_LANGUAGE"===t.type?t.language:e},Es=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ks.loading,t=arguments.length>1?arguments[1]:void 0;return"SET_LOADING"===t.type?t.loading:e},As=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ks.message,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"AUTH_ERROR":case"PROFILE_ERROR":case"PROFILE_UPDATE_ERROR":case"PICTURE_ERROR":case"SET_ERROR":return t.message;case"LOGOUT":case"PROFILE_SUCCESS":case"SET_RESULTS":case"@@router/LOCATION_CHANGE":return"";default:return e}},Ms=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ks.messages,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"AUTH_ERRORS":return t.messages;case"LOGOUT":case"PROFILE_SUCCESS":case"@@router/LOCATION_CHANGE":return[];default:return e}},Ts=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ks.records,t=arguments.length>1?arguments[1]:void 0;return"LOGOUT"===t.type?ks.records:ws(e,"records",t)},Ps=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ks.sports,t=arguments.length>1?arguments[1]:void 0;return"UPDATE_SPORT_DATA"===t.type?Object(S.a)(Object(S.a)({},e),{},{data:e.data.map((function(e){return e.id===t.data.id&&(e.is_active=t.data.is_active),e}))}):ws(e,"sports",t)},Fs=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ks.users,t=arguments.length>1?arguments[1]:void 0;return"UPDATE_USER_DATA"===t.type?Object(S.a)(Object(S.a)({},e),{},{data:e.data.map((function(e){return e.username===t.data.username&&(e.admin=t.data.admin),e}))}):ws(e,"users",t)},zs=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ks.user,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"AUTH_ERROR":case"PROFILE_ERROR":case"LOGOUT":return window.localStorage.removeItem("authToken"),ks.user;case"PROFILE_SUCCESS":return t.profil;default:return e}},Rs=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ks.statistics,t=arguments.length>1?arguments[1]:void 0;return"LOGOUT"===t.type?ks.statistics:ws(e,"statistics",t)},Ls=["/login","/register","/password-reset","/password-reset/request","/password-reset/sent","/updated-password"],Us=function(e,t){return"string"===typeof e||e instanceof String?e=t:e.pathname=t,e},Is=function(e){return window.localStorage.authToken||Ls.includes(e.pathname)||(e=Us(e,"/login")),window.localStorage.authToken&&Ls.includes(e.pathname)&&(e=Us(e,"/")),e},Ws=((gs=Object(r.a)()).location=Is(gs.location),Object(S.a)(Object(S.a)({},gs),{},{push:function(e){for(var t=arguments.length,a=new Array(t>1?t-1:0),s=1;s1?t-1:0),s=1;s