Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Update react code

Roland Geidereec3b997be77
diff --git a/wger/core/static/react/locales/ar/translation.json b/wger/core/static/react/locales/ar/translation.json
index 067aeb800..562fe2b5f 100644
--- a/wger/core/static/react/locales/ar/translation.json
+++ b/wger/core/static/react/locales/ar/translation.json
@@ -1,240 +1,240 @@
{
- "weight": "الوزن",
- "height": "الطول",
- "cm": "سم",
- "date": "التاريخ",
- "timeOfDay": "الوقت من اليوم",
- "submit": "إرسال",
- "edit": "تعديل",
- "delete": "حذف",
- "deleteConfirmation": "هل أنت متأكد أنك تريد حذف \"{{name}}\"؟",
- "add": "إضافة",
- "close": "إغلاق",
- "difference": "الفرق",
- "days": "أيام",
- "all": "الكل",
- "lastYear": "العام الماضي",
- "lastHalfYear": "آخر 6 أشهر",
- "lastMonth": "الشهر الماضي",
- "lastWeek": "الأسبوع الماضي",
- "licenses": {
- "authors": "المؤلف(ون)",
- "authorProfile": "رابط الموقع الشخصي أو الملف الشخصي للمؤلف (إن وجد)",
- "derivativeSourceUrl": "رابط المصدر الأصلي (إذا كان هذا العمل مشتقًا)",
- "derivativeSourceUrlHelper": "ملاحظة: العمل المشتق هو العمل الذي لا يعتمد فقط على عمل سابق، ولكنه يحتوي أيضًا على محتوى جديد وخلاق كافٍ ليمنحه حقوق النشر الخاصة به.",
- "originalObjectUrl": "رابط الموقع الأصلي (إن وجد)",
- "originalTitle": "العنوان"
- },
- "loading": "جاري التحميل...",
- "nutritionalPlan": "الخطة الغذائية",
- "addEntry": "إضافة مدخل",
- "currentWeight": "الوزن الحالي",
- "workout": "التدريب",
- "seeDetails": "عرض التفاصيل",
- "actions": "الإجراءات",
- "nothingHereYet": "لا يوجد شيء هنا بعد...",
- "nothingHereYetAction": "اضغط على زر الإجراء للبدء",
- "notes": "ملاحظات",
- "value": "القيمة",
- "unit": "الوحدة",
- "alsoSearchEnglish": "البحث أيضًا عن الأسماء بالإنجليزية",
- "copyToClipboard": "نسخ إلى الحافظة",
- "filters": "الفلاتر",
- "exercises": {
- "replacements": "البدائل",
- "replacementsInfoText": "يمكنك اختياريًا تحديد تمرين ليحل محل هذا التمرين (على سبيل المثال، لأنه تم إرساله مرتين، أو ما شابه). سيؤدي هذا إلى استبدال التمرين في الروتينات وسجلات التدريب بدلًا من حذفه فقط. هذه التغييرات ستنتشر أيضًا إلى أي نسخة تتم مزامنة التمارين منها.",
- "replacementsSearch": "ابحث عن تمرين أو انسخ ولصق معرف معروف في الحقل ثم انقر على زر \"تحميل\".",
- "noReplacementSelected": "لم يتم اختيار تمرين بديل",
- "contributeExercise": "المساهمة بتمرين",
- "step1HeaderBasics": "الأساسيات بالإنجليزية",
- "variations": "الاختلافات",
- "notEnoughRightsHeader": "لا يمكنك المساهمة بتمارين",
- "notEnoughRights": "يمكنك المساهمة بتمارين فقط إذا كان عمر حسابك أكثر من {{days}} يومًا وقمت بتأكيد بريدك الإلكتروني",
- "muscles": "العضلات",
- "secondaryMuscles": "العضلات الثانوية",
- "whatVariationsExist": "ما هي الاختلافات الموجودة لهذا التمرين، إن وجدت؟",
- "filterVariations": "أدخل اسم التمرين لتصفية الاختلافات",
- "identicalExercise": "تجنب التمارين المكررة",
- "identicalExercisePleaseDiscard": "إذا لاحظت تمرينًا مطابقًا للذي تضيفه، يرجى إلغاء المسودة وتعديل التمرين الموجود بدلًا من ذلك.",
- "translateExerciseNow": "ترجمة هذا التمرين الآن",
- "compatibleImagesCC": "يجب أن تكون الصور متوافقة مع رخصة CC BY SA. إذا كنت في شك، قم بتحميل الصور التي التقطتها بنفسك فقط.",
- "alternativeNames": "أسماء بديلة",
+ "weight": "الوزن",
+ "height": "الطول",
+ "cm": "سم",
+ "date": "التاريخ",
+ "timeOfDay": "الوقت من اليوم",
+ "submit": "إرسال",
+ "edit": "تعديل",
+ "delete": "حذف",
+ "deleteConfirmation": "هل أنت متأكد أنك تريد حذف \"{{name}}\"؟",
+ "add": "إضافة",
+ "close": "إغلاق",
+ "difference": "الفرق",
+ "days": "أيام",
+ "all": "الكل",
+ "lastYear": "العام الماضي",
+ "lastHalfYear": "آخر 6 أشهر",
+ "lastMonth": "الشهر الماضي",
+ "lastWeek": "الأسبوع الماضي",
+ "licenses": {
+ "authors": "المؤلف(ون)",
+ "authorProfile": "رابط الموقع الشخصي أو الملف الشخصي للمؤلف (إن وجد)",
+ "derivativeSourceUrl": "رابط المصدر الأصلي (إذا كان هذا العمل مشتقًا)",
+ "derivativeSourceUrlHelper": "ملاحظة: العمل المشتق هو العمل الذي لا يعتمد فقط على عمل سابق، ولكنه يحتوي أيضًا على محتوى جديد وخلاق كافٍ ليمنحه حقوق النشر الخاصة به.",
+ "originalObjectUrl": "رابط الموقع الأصلي (إن وجد)",
+ "originalTitle": "العنوان"
+ },
+ "loading": "جاري التحميل...",
+ "nutritionalPlan": "الخطة الغذائية",
+ "addEntry": "إضافة مدخل",
+ "currentWeight": "الوزن الحالي",
+ "workout": "التدريب",
+ "seeDetails": "عرض التفاصيل",
+ "actions": "الإجراءات",
+ "nothingHereYet": "لا يوجد شيء هنا بعد...",
+ "nothingHereYetAction": "اضغط على زر الإجراء للبدء",
"notes": "ملاحظات",
- "equipment": "المعدات",
- "checkInformationBeforeSubmitting": "يرجى التحقق من صحة المعلومات قبل إرسال التمرين",
- "cacheWarning": "بسبب التخزين المؤقت، قد تستغرق التغييرات بعض الوقت حتى تظهر في التطبيق بالكامل.",
- "submitExercise": "إرسال التمرين",
- "successfullyUpdated": "تم تحديث التمرين بنجاح. بسبب التخزين المؤقت، قد تستغرق التغييرات بعض الوقت حتى تظهر في التطبيق بالكامل.",
+ "value": "القيمة",
+ "unit": "الوحدة",
+ "alsoSearchEnglish": "البحث أيضًا عن الأسماء بالإنجليزية",
+ "copyToClipboard": "نسخ إلى الحافظة",
+ "filters": "الفلاتر",
+ "exercises": {
+ "replacements": "البدائل",
+ "replacementsInfoText": "يمكنك اختياريًا تحديد تمرين ليحل محل هذا التمرين (على سبيل المثال، لأنه تم إرساله مرتين، أو ما شابه). سيؤدي هذا إلى استبدال التمرين في الروتينات وسجلات التدريب بدلًا من حذفه فقط. هذه التغييرات ستنتشر أيضًا إلى أي نسخة تتم مزامنة التمارين منها.",
+ "replacementsSearch": "ابحث عن تمرين أو انسخ ولصق معرف معروف في الحقل ثم انقر على زر \"تحميل\".",
+ "noReplacementSelected": "لم يتم اختيار تمرين بديل",
+ "contributeExercise": "المساهمة بتمرين",
+ "step1HeaderBasics": "الأساسيات بالإنجليزية",
+ "variations": "الاختلافات",
+ "notEnoughRightsHeader": "لا يمكنك المساهمة بتمارين",
+ "notEnoughRights": "يمكنك المساهمة بتمارين فقط إذا كان عمر حسابك أكثر من {{days}} يومًا وقمت بتأكيد بريدك الإلكتروني",
+ "muscles": "العضلات",
+ "secondaryMuscles": "العضلات الثانوية",
+ "whatVariationsExist": "ما هي الاختلافات الموجودة لهذا التمرين، إن وجدت؟",
+ "filterVariations": "أدخل اسم التمرين لتصفية الاختلافات",
+ "identicalExercise": "تجنب التمارين المكررة",
+ "identicalExercisePleaseDiscard": "إذا لاحظت تمرينًا مطابقًا للذي تضيفه، يرجى إلغاء المسودة وتعديل التمرين الموجود بدلًا من ذلك.",
+ "translateExerciseNow": "ترجمة هذا التمرين الآن",
+ "compatibleImagesCC": "يجب أن تكون الصور متوافقة مع رخصة CC BY SA. إذا كنت في شك، قم بتحميل الصور التي التقطتها بنفسك فقط.",
+ "alternativeNames": "أسماء بديلة",
+ "notes": "ملاحظات",
+ "equipment": "المعدات",
+ "checkInformationBeforeSubmitting": "يرجى التحقق من صحة المعلومات قبل إرسال التمرين",
+ "cacheWarning": "بسبب التخزين المؤقت، قد تستغرق التغييرات بعض الوقت حتى تظهر في التطبيق بالكامل.",
+ "submitExercise": "إرسال التمرين",
+ "successfullyUpdated": "تم تحديث التمرين بنجاح. بسبب التخزين المؤقت، قد تستغرق التغييرات بعض الوقت حتى تظهر في التطبيق بالكامل.",
+ "description": "الوصف",
+ "basics": "الأساسيات",
+ "exerciseNotTranslated": "لا تتوفر ترجمة",
+ "exerciseNotTranslatedBody": "هذا التمرين غير متوفر باللغة المحددة حاليًا. هل تريد المساهمة بترجمة؟",
+ "alsoKnownAs": "معروف أيضًا باسم:",
+ "primaryMuscles": "العضلات الرئيسية",
+ "deleteExerciseBody": "هل تريد حذف التمرين \"{{name}}\"؟ يمكنك حذف الترجمة الحالية ({{language}}) أو التمرين الكامل مع جميع الترجمات والصور وغيرها.",
+ "deleteTranslation": "حذف الترجمة",
+ "deleteExerciseFull": "حذف التمرين بالكامل",
+ "deleteExerciseReplace": "حذف واستبدال",
+ "exercises": "التمارين",
+ "changeExerciseLanguage": "تغيير لغة هذا التمرين",
+ "noEquipment": "لا يوجد معدات",
+ "missingExercise": "هل تفتقد تمرينًا معينًا؟",
+ "missingExerciseDescription": "ساعد المجتمع عن طريق المساهمة به!",
+ "searchExerciseName": "البحث باسم التمرين",
+ "newNote": "ملاحظة جديدة",
+ "notesHelpText": "الملاحظات هي تعليقات قصيرة حول كيفية أداء التمرين مثل \"حافظ على استقامة جسمك\"",
+ "imageStylePhoto": "صورة",
+ "imageStyle3D": "ثلاثي الأبعاد",
+ "imageStyleLine": "خطي",
+ "imageStyleLowPoly": "Low-Poly",
+ "imageStyleOther": "أخرى",
+ "imageDetails": "تفاصيل الصورة"
+ },
+ "nutrition": {
+ "plans": "الخطط الغذائية",
+ "copyPlan": "إنشاء نسخة من هذه الخطة",
+ "plan": "الخطة الغذائية",
+ "onlyLoggingHelpText": "تتبع السعرات الحرارية فقط. حدد المربع إذا كنت تريد تسجيل السعرات الحرارية دون إعداد خطة غذائية مفصلة مع وجبات محددة",
+ "goalsTitle": "الأهداف",
+ "useGoalsHelpText": "إضافة أهداف إلى هذه الخطة",
+ "useGoalsHelpTextLong": "يتيح لك ذلك تعيين أهداف عامة للطاقة أو البروتين أو الكربوهيدرات أو الدهون للخطة. لاحظ أن إعداد خطة وجبات مفصلة سيتغلب على هذه القيم.",
+ "goalEnergy": "هدف الطاقة",
+ "goalProtein": "هدف البروتين",
+ "goalCarbohydrates": "هدف الكربوهيدرات",
+ "goalFiber": "هدف الألياف",
+ "goalFat": "هدف الدهون",
+ "addNutritionalDiary": "إضافة مدخل في اليومية الغذائية",
+ "meal": "الوجبة",
+ "addMeal": "إضافة وجبة",
+ "addMealItem": "إضافة مكون إلى الوجبة",
+ "nutritionalDiary": "اليومية الغذائية",
+ "gramShort": "غ",
+ "kcal": "سعرة",
+ "valueEnergyKcal": "{{value}} سعرة",
+ "valueEnergyKcalKj": "{{kcal}} سعرة / {{kj}} كيلوجول",
+ "searchIngredientName": "البحث باسم المكون",
+ "macronutrient": "المغذيات الكبرى",
+ "percentEnergy": "النسبة المئوية للطاقة",
+ "gPerBodyKg": "غرام لكل كغم من الجسم",
+ "planned": "مخطط",
+ "logged": "مسجل",
+ "loggedToday": "مسجل اليوم",
+ "difference": "الفرق",
+ "today": "اليوم",
+ "7dayAvg": "متوسط 7 أيام",
+ "energy": "الطاقة",
+ "protein": "البروتين",
+ "carbohydrates": "الكربوهيدرات",
+ "sugar": "السكر",
+ "ofWhichSugars": "منها سكريات",
+ "fat": "الدهون",
+ "ofWhichSaturated": "منها مشبعة",
+ "saturatedFat": "الدهون المشبعة",
+ "pseudoMealTitle": "سجلات أخرى",
+ "others": "أخرى",
+ "fibres": "الألياف",
+ "sodium": "الصوديوم",
+ "planDeleteInfo": "سيؤدي هذا إلى حذف جميع مدخلات اليومية الغذائية أيضًا",
+ "mealDeleteInfo": "لن يتم حذف مدخلات اليومية الغذائية لهذه الوجبة وستظهر تحت \"سجلات أخرى\"",
+ "diaryEntrySaved": "تم حفظ مدخل اليومية بنجاح",
+ "logThisMeal": "تسجيل هذه الوجبة كما هي في اليومية الغذائية",
+ "logThisMealItem": "تسجيل هذا المكون كما هو في اليومية الغذائية",
+ "valueRemaining": "متبقي",
+ "valueTooMany": "زيادة"
+ },
+ "bmi": {
+ "calculator": "حاسبة مؤشر كتلة الجسم",
+ "overweight": "وزن زائد",
+ "obese": "سمنة",
+ "normal": "وزن طبيعي",
+ "underweight": "نقص الوزن",
+ "result": "مؤشر كتلة جسمك هو {{value}}"
+ },
+ "downloadAsPdf": "تحميل كـ PDF",
+ "total": "الإجمالي",
"description": "الوصف",
- "basics": "الأساسيات",
- "exerciseNotTranslated": "لا تتوفر ترجمة",
- "exerciseNotTranslatedBody": "هذا التمرين غير متوفر باللغة المحددة حاليًا. هل تريد المساهمة بترجمة؟",
- "alsoKnownAs": "معروف أيضًا باسم:",
- "primaryMuscles": "العضلات الرئيسية",
- "deleteExerciseBody": "هل تريد حذف التمرين \"{{name}}\"؟ يمكنك حذف الترجمة الحالية ({{language}}) أو التمرين الكامل مع جميع الترجمات والصور وغيرها.",
- "deleteTranslation": "حذف الترجمة",
- "deleteExerciseFull": "حذف التمرين بالكامل",
- "deleteExerciseReplace": "حذف واستبدال",
- "exercises": "التمارين",
- "changeExerciseLanguage": "تغيير لغة هذا التمرين",
- "noEquipment": "لا يوجد معدات",
- "missingExercise": "هل تفتقد تمرينًا معينًا؟",
- "missingExerciseDescription": "ساعد المجتمع عن طريق المساهمة به!",
- "searchExerciseName": "البحث باسم التمرين",
- "newNote": "ملاحظة جديدة",
- "notesHelpText": "الملاحظات هي تعليقات قصيرة حول كيفية أداء التمرين مثل \"حافظ على استقامة جسمك\"",
- "imageStylePhoto": "صورة",
- "imageStyle3D": "ثلاثي الأبعاد",
- "imageStyleLine": "خطي",
- "imageStyleLowPoly": "Low-Poly",
- "imageStyleOther": "أخرى",
- "imageDetails": "تفاصيل الصورة"
- },
- "nutrition": {
- "plans": "الخطط الغذائية",
- "copyPlan": "إنشاء نسخة من هذه الخطة",
- "plan": "الخطة الغذائية",
- "onlyLoggingHelpText": "تتبع السعرات الحرارية فقط. حدد المربع إذا كنت تريد تسجيل السعرات الحرارية دون إعداد خطة غذائية مفصلة مع وجبات محددة",
- "goalsTitle": "الأهداف",
- "useGoalsHelpText": "إضافة أهداف إلى هذه الخطة",
- "useGoalsHelpTextLong": "يتيح لك ذلك تعيين أهداف عامة للطاقة أو البروتين أو الكربوهيدرات أو الدهون للخطة. لاحظ أن إعداد خطة وجبات مفصلة سيتغلب على هذه القيم.",
- "goalEnergy": "هدف الطاقة",
- "goalProtein": "هدف البروتين",
- "goalCarbohydrates": "هدف الكربوهيدرات",
- "goalFiber": "هدف الألياف",
- "goalFat": "هدف الدهون",
- "addNutritionalDiary": "إضافة مدخل في اليومية الغذائية",
- "meal": "الوجبة",
- "addMeal": "إضافة وجبة",
- "addMealItem": "إضافة مكون إلى الوجبة",
- "nutritionalDiary": "اليومية الغذائية",
- "gramShort": "غ",
- "kcal": "سعرة",
- "valueEnergyKcal": "{{value}} سعرة",
- "valueEnergyKcalKj": "{{kcal}} سعرة / {{kj}} كيلوجول",
- "searchIngredientName": "البحث باسم المكون",
- "macronutrient": "المغذيات الكبرى",
- "percentEnergy": "النسبة المئوية للطاقة",
- "gPerBodyKg": "غرام لكل كغم من الجسم",
- "planned": "مخطط",
- "logged": "مسجل",
- "loggedToday": "مسجل اليوم",
- "difference": "الفرق",
- "today": "اليوم",
- "7dayAvg": "متوسط 7 أيام",
- "energy": "الطاقة",
- "protein": "البروتين",
- "carbohydrates": "الكربوهيدرات",
- "sugar": "السكر",
- "ofWhichSugars": "منها سكريات",
- "fat": "الدهون",
- "ofWhichSaturated": "منها مشبعة",
- "saturatedFat": "الدهون المشبعة",
- "pseudoMealTitle": "سجلات أخرى",
- "others": "أخرى",
- "fibres": "الألياف",
- "sodium": "الصوديوم",
- "planDeleteInfo": "سيؤدي هذا إلى حذف جميع مدخلات اليومية الغذائية أيضًا",
- "mealDeleteInfo": "لن يتم حذف مدخلات اليومية الغذائية لهذه الوجبة وستظهر تحت \"سجلات أخرى\"",
- "diaryEntrySaved": "تم حفظ مدخل اليومية بنجاح",
- "logThisMeal": "تسجيل هذه الوجبة كما هي في اليومية الغذائية",
- "logThisMealItem": "تسجيل هذا المكون كما هو في اليومية الغذائية",
- "valueRemaining": "متبقي",
- "valueTooMany": "زيادة"
- },
- "bmi": {
- "calculator": "حاسبة مؤشر كتلة الجسم",
- "overweight": "وزن زائد",
- "obese": "سمنة",
- "normal": "وزن طبيعي",
- "underweight": "نقص الوزن",
- "result": "مؤشر كتلة جسمك هو {{value}}"
- },
- "downloadAsPdf": "تحميل كـ PDF",
- "total": "الإجمالي",
- "description": "الوصف",
- "translation": "الترجمة",
- "images": "الصور",
- "overview": "نظرة عامة",
- "preferences": "التفضيلات",
- "continue": "متابعة",
- "goBack": "رجوع",
- "language": "اللغة",
- "forms": {
- "supportedImageFormats": "يتم دعم ملفات JPEG وPNG وWEBP فقط بحجم أقل من 20 ميجابايت",
- "valueTooShort": "القيمة قصيرة جدًا",
- "valueTooLong": "القيمة طويلة جدًا",
- "fieldRequired": "هذا الحقل مطلوب",
- "maxLength": "الرجاء إدخال أقل من {{chars}} حرفًا",
- "minLength": "الرجاء إدخال أكثر من {{chars}} حرفًا",
- "minValue": "يجب أن تكون القيمة أكبر من {{value}}",
- "maxValue": "يجب أن تكون القيمة أقل من {{value}}"
- },
- "name": "الاسم",
- "category": "الفئة",
- "success": "نجاح!",
- "English": "الإنجليزية",
- "save": "حفظ",
- "videos": "الفيديوهات",
- "cannotBeUndone": "لا يمكن التراجع عن هذا الإجراء.",
- "cancel": "إلغاء",
- "noResults": "لا توجد نتائج",
- "noResultsDescription": "لم يتم العثور على نتائج لهذا الاستعلام، يرجى تقليل عدد الفلاتر.",
- "routines": {
- "addDay": "إضافة يوم تدريب",
- "addWeightLog": "إضافة سجل تدريب",
- "logsHeader": "سجل التدريب للتمرين",
- "logsFilterNote": "ملاحظة: فقط المدخلات ذات وحدة الوزن (كجم أو رطل) والتكرارات تظهر في الرسم البياني، وتُهمل التركيبات الأخرى مثل الوقت أو حتى الفشل.",
- "addLogToDay": "إضافة سجل إلى هذا اليوم",
- "routine": "الروتين",
- "routines": "الروتينات",
- "rir": "RiR"
- },
- "measurements": {
- "measurements": "القياسات",
- "unitFormHelpText": "الوحدة التي سيتم بها قياس الفئة، مثل سم أو ٪",
- "deleteInfo": "سيؤدي هذا إلى حذف الفئة وجميع مدخلاتها"
- },
- "server": {
- "abs": "البطن",
- "arms": "الأذرع",
- "back": "الظهر",
- "barbell": "البار",
- "bench": "المقعد",
- "biceps": "العضلة ذات الرأسين",
- "body_weight": "وزن الجسم",
- "calves": "العجول",
- "cardio": "الكارديو",
- "chest": "الصدر",
- "dumbbell": "الدمبل",
- "glutes": "الأرداف",
- "gym_mat": "سجادة الجيم",
- "hamstrings": "أوتار الركبة",
- "incline_bench": "مقعد مائل",
- "kettlebell": "كيتل بيل",
- "kilometers": "كيلومترات",
- "kilometers_per_hour": "كيلومتر في الساعة",
- "lats": "العضلة الظهرية العريضة",
- "legs": "الأرجل",
- "max_reps": "أقصى تكرارات",
- "miles": "أميال",
- "miles_per_hour": "ميل في الساعة",
- "minutes": "دقائق",
- "plates": "الأوزان",
- "pull_up_bar": "بار الشد",
- "quads": "العضلات الرباعية",
- "repetitions": "التكرارات",
- "sz_bar": "البار الملتوي",
- "seconds": "ثواني",
- "shoulders": "الأكتاف",
- "swiss_ball": "الكرة السويسرية",
- "triceps": "العضلة ثلاثية الرؤوس",
- "until_failure": "حتى الفشل",
- "kg": "كجم",
- "lb": "رطل",
- "none__bodyweight_exercise_": "بدون (تمرين بوزن الجسم)"
- },
- "calendar": "التقويم",
- "entries": "المدخلات",
- "no_entries_for_day": "لا توجد مدخلات لهذا اليوم"
-}
\ No newline at end of file
+ "translation": "الترجمة",
+ "images": "الصور",
+ "overview": "نظرة عامة",
+ "preferences": "التفضيلات",
+ "continue": "متابعة",
+ "goBack": "رجوع",
+ "language": "اللغة",
+ "forms": {
+ "supportedImageFormats": "يتم دعم ملفات JPEG وPNG وWEBP فقط بحجم أقل من 20 ميجابايت",
+ "valueTooShort": "القيمة قصيرة جدًا",
+ "valueTooLong": "القيمة طويلة جدًا",
+ "fieldRequired": "هذا الحقل مطلوب",
+ "maxLength": "الرجاء إدخال أقل من {{chars}} حرفًا",
+ "minLength": "الرجاء إدخال أكثر من {{chars}} حرفًا",
+ "minValue": "يجب أن تكون القيمة أكبر من {{value}}",
+ "maxValue": "يجب أن تكون القيمة أقل من {{value}}"
+ },
+ "name": "الاسم",
+ "category": "الفئة",
+ "success": "نجاح!",
+ "English": "الإنجليزية",
+ "save": "حفظ",
+ "videos": "الفيديوهات",
+ "cannotBeUndone": "لا يمكن التراجع عن هذا الإجراء.",
+ "cancel": "إلغاء",
+ "noResults": "لا توجد نتائج",
+ "noResultsDescription": "لم يتم العثور على نتائج لهذا الاستعلام، يرجى تقليل عدد الفلاتر.",
+ "routines": {
+ "addDay": "إضافة يوم تدريب",
+ "addWeightLog": "إضافة سجل تدريب",
+ "logsHeader": "سجل التدريب للتمرين",
+ "logsFilterNote": "ملاحظة: فقط المدخلات ذات وحدة الوزن (كجم أو رطل) والتكرارات تظهر في الرسم البياني، وتُهمل التركيبات الأخرى مثل الوقت أو حتى الفشل.",
+ "addLogToDay": "إضافة سجل إلى هذا اليوم",
+ "routine": "الروتين",
+ "routines": "الروتينات",
+ "rir": "RiR"
+ },
+ "measurements": {
+ "measurements": "القياسات",
+ "unitFormHelpText": "الوحدة التي سيتم بها قياس الفئة، مثل سم أو ٪",
+ "deleteInfo": "سيؤدي هذا إلى حذف الفئة وجميع مدخلاتها"
+ },
+ "server": {
+ "abs": "البطن",
+ "arms": "الأذرع",
+ "back": "الظهر",
+ "barbell": "البار",
+ "bench": "المقعد",
+ "biceps": "العضلة ذات الرأسين",
+ "body_weight": "وزن الجسم",
+ "calves": "العجول",
+ "cardio": "الكارديو",
+ "chest": "الصدر",
+ "dumbbell": "الدمبل",
+ "glutes": "الأرداف",
+ "gym_mat": "سجادة الجيم",
+ "hamstrings": "أوتار الركبة",
+ "incline_bench": "مقعد مائل",
+ "kettlebell": "كيتل بيل",
+ "kilometers": "كيلومترات",
+ "kilometers_per_hour": "كيلومتر في الساعة",
+ "lats": "العضلة الظهرية العريضة",
+ "legs": "الأرجل",
+ "max_reps": "أقصى تكرارات",
+ "miles": "أميال",
+ "miles_per_hour": "ميل في الساعة",
+ "minutes": "دقائق",
+ "plates": "الأوزان",
+ "pull_up_bar": "بار الشد",
+ "quads": "العضلات الرباعية",
+ "repetitions": "التكرارات",
+ "sz_bar": "البار الملتوي",
+ "seconds": "ثواني",
+ "shoulders": "الأكتاف",
+ "swiss_ball": "الكرة السويسرية",
+ "triceps": "العضلة ثلاثية الرؤوس",
+ "until_failure": "حتى الفشل",
+ "kg": "كجم",
+ "lb": "رطل",
+ "none__bodyweight_exercise_": "بدون (تمرين بوزن الجسم)"
+ },
+ "calendar": "التقويم",
+ "entries": "المدخلات",
+ "no_entries_for_day": "لا توجد مدخلات لهذا اليوم"
+}
diff --git a/wger/core/static/react/locales/ca/translation.json b/wger/core/static/react/locales/ca/translation.json
index bb6daba83..2f8585fcb 100644
--- a/wger/core/static/react/locales/ca/translation.json
+++ b/wger/core/static/react/locales/ca/translation.json
@@ -14,5 +14,22 @@
"workout": "Entrenament",
"language": "Llenguatge",
"images": "Imatges",
- "translation": "Traducció"
+ "translation": "Traducció",
+ "timeOfDay": "Hora",
+ "editName": "Editar {{name}}",
+ "start": "Inici",
+ "licenses": {
+ "authors": "Autor(s)",
+ "authorProfile": "Enllaç al lloc web de l'autor, si n'hi ha",
+ "derivativeSourceUrl": "Enllaç a la font original, si es tracta d'una obra derivada"
+ },
+ "comment": "Comentari",
+ "deleteConfirmation": "Segur que vols esborrar \"{{name}}\"?",
+ "lastYear": "Any passat",
+ "lastHalfYear": "Darrers 6 mesos",
+ "lastMonth": "Darrer mes",
+ "height": "Alçada",
+ "cm": "cm",
+ "all": "Tot",
+ "lastWeek": "Darrera setmana"
}
diff --git a/wger/core/static/react/locales/de/translation.json b/wger/core/static/react/locales/de/translation.json
index 05bc04fdc..fdbcb7502 100644
--- a/wger/core/static/react/locales/de/translation.json
+++ b/wger/core/static/react/locales/de/translation.json
@@ -1,269 +1,269 @@
{
- "add": "Hinzufügen",
- "addEntry": "Eintrag hinzufügen",
- "change": "Veränderung",
- "close": "Schließen",
- "currentWeight": "Aktuelles Gewicht",
- "date": "Datum",
- "days": "Tage",
- "loading": "Lade...",
- "delete": "Löschen",
- "difference": "Differenz",
- "edit": "Bearbeiten",
- "category": "Kategorie",
- "English": "Englisch",
- "save": "Speichern",
- "continue": "Fortfahren",
- "exercises": {
- "equipment": "Gerät",
- "exercises": "Übungen",
- "muscles": "Muskeln",
- "secondaryMuscles": "Sekundäre Muskeln",
- "noEquipment": "Keine Ausrüstung",
- "searchExerciseName": "Nach Übungsnamen suchen",
- "exerciseNotTranslated": "Keine Übersetzung verfügbar",
- "exerciseNotTranslatedBody": "Diese Übung ist derzeit nicht in der gewählten Sprache verfügbar. Möchtest du eine Übersetzung beisteuern?",
- "translateExerciseNow": "Diese Übung jetzt übersetzen",
- "notes": "Anmerkungen",
+ "add": "Hinzufügen",
+ "addEntry": "Eintrag hinzufügen",
+ "change": "Veränderung",
+ "close": "Schließen",
+ "currentWeight": "Aktuelles Gewicht",
+ "date": "Datum",
+ "days": "Tage",
+ "loading": "Lade...",
+ "delete": "Löschen",
+ "difference": "Differenz",
+ "edit": "Bearbeiten",
+ "category": "Kategorie",
+ "English": "Englisch",
+ "save": "Speichern",
+ "continue": "Fortfahren",
+ "exercises": {
+ "equipment": "Gerät",
+ "exercises": "Übungen",
+ "muscles": "Muskeln",
+ "secondaryMuscles": "Sekundäre Muskeln",
+ "noEquipment": "Keine Ausrüstung",
+ "searchExerciseName": "Nach Übungsnamen suchen",
+ "exerciseNotTranslated": "Keine Übersetzung verfügbar",
+ "exerciseNotTranslatedBody": "Diese Übung ist derzeit nicht in der gewählten Sprache verfügbar. Möchtest du eine Übersetzung beisteuern?",
+ "translateExerciseNow": "Diese Übung jetzt übersetzen",
+ "notes": "Anmerkungen",
+ "description": "Beschreibung",
+ "primaryMuscles": "Primäre Muskeln",
+ "identicalExercisePleaseDiscard": "Wenn dir eine Übung auffällt, die mit der von dir hinzugefügten identisch ist, verwerfe bitte deinen Entwurf und bearbeite stattdessen diese Übung.",
+ "contributeExercise": "Eine Übung beisteuern",
+ "checkInformationBeforeSubmitting": "Bitte überprüfe vor dem Absenden der Übung, ob die von dir eingegebenen Informationen korrekt sind",
+ "successfullyUpdated": "Die Übung wurde erfolgreich aktualisiert. Aufgrund von Caching kann es einige Zeit dauern, bis die Änderungen in der gesamten Anwendung sichtbar sind.",
+ "alsoKnownAs": "Auch bekannt als:",
+ "deleteExerciseTranslation": "Aktuelle Übersetzung löschen?",
+ "deleteExerciseTranslationBody": "Du bist dabei, die Übersetzung {{language}} für die Übung \"{{name}}\" zu löschen. Diese Aktion kann nicht rückgängig gemacht werden. Weitermachen?",
+ "missingExercise": "Fehlt eine bestimmte Übung?",
+ "newNote": "Neuer Hinweis",
+ "notesHelpText": "Hinweise sind kurze Kommentare zur Ausführung der Übung, wie z. B. \"Halte deinen Körper gerade\"",
+ "variations": "Variationen",
+ "step1HeaderBasics": "Grundlagen auf Englisch",
+ "whatVariationsExist": "Welche Variationen dieser Übung gibt es, wenn überhaupt?",
+ "filterVariations": "Name der Übung eingeben, um Variationen zu filtern",
+ "submitExercise": "Übung einreichen",
+ "compatibleImagesCC": "Die Bilder müssen mit der CC BY SA-Lizenz kompatibel sein. Im Zweifelsfall solltest du nur Fotos hochladen, die du selbst aufgenommen hast.",
+ "alternativeNames": "Alternative Namen",
+ "missingExerciseDescription": "Hilf der Community und leiste einen Beitrag!",
+ "deleteExerciseFull": "Vollständige Übung löschen",
+ "deleteTranslation": "Übersetzung löschen",
+ "deleteExerciseBody": "Möchtest du die Übung \"{{name}}\" löschen? Du kannst entweder die aktuelle {{language}} Übersetzung oder die komplette Übung mit allen Übersetzungen, Bildern usw. löschen.",
+ "basics": "Grundlagen",
+ "notEnoughRightsHeader": "Du kannst keine Übungen beisteuern",
+ "notEnoughRights": "Du kannst Übungen nur dann beisteuern, wenn dein Benutzerkonto älter als {{days}} Tage und deine E-Mail-Adresse verifiziert ist",
+ "changeExerciseLanguage": "Ändere die Sprache dieser Übung",
+ "identicalExercise": "Vermeide doppelte Übungen",
+ "cacheWarning": "Aufgrund von Caching kann es einige Zeit dauern, bis Änderungen in der ganzen Anwendung sichtbar sind.",
+ "replacements": "Ersätze",
+ "replacementsInfoText": "Optional können Sie auch eine Übung auswählen, die diese ersetzen soll (z. B. weil sie zweimal eingereicht wurde oder ähnliches). Dadurch wird die Übung in Routinen sowie Trainingsprotokollen ersetzt, anstatt sie einfach zu löschen. Diese Änderungen werden auch auf alle Instanzen übertragen, die Übungen von dieser übernehmen.",
+ "replacementsSearch": "Suche nach Übungen oder kopiere eine Bekannte ID in das Feld und drücke den \"Laden\" Button.",
+ "noReplacementSelected": " Keine Übung zum ersätzen ausgewählt",
+ "deleteExerciseReplace": "Löschen und ersetzen",
+ "imageStylePhoto": "Foto",
+ "imageStyle3D": "3D",
+ "imageStyleLine": "Linie",
+ "imageStyleLowPoly": "Niedrig-Poly",
+ "imageStyleOther": "andere",
+ "imageDetails": "Bilddetails"
+ },
+ "noResults": "Keine Ergebnisse",
+ "noResultsDescription": "Keine Ergebnisse für diese Suche gefunden, bitte reduziere die Anzahl der Filter.",
+ "nutritionalPlan": "Ernährungsplan",
+ "server": {
+ "abs": "Bauch",
+ "arms": "Arme",
+ "back": "Rücken",
+ "barbell": "Langhantel",
+ "bench": "Bank",
+ "biceps": "Bizeps",
+ "calves": "Waden",
+ "chest": "Brust",
+ "dumbbell": "Kurzhantel",
+ "glutes": "Po",
+ "gym_mat": "Matte",
+ "hamstrings": "Beinbeuger",
+ "incline_bench": "Schrägbank",
+ "kettlebell": "Kugelhantel",
+ "kilometers": "Kilometer",
+ "lats": "Latissimus",
+ "legs": "Beine",
+ "lower_back": "Unterer Rücken",
+ "miles": "Meilen",
+ "minutes": "Minuten",
+ "none__bodyweight_exercise_": "keine (Körpergewichtübung)",
+ "pull_up_bar": "Klimmzugstange",
+ "quads": "Beinstrecker",
+ "repetitions": "Wiederholungen",
+ "seconds": "Sekunden",
+ "shoulders": "Schultern",
+ "swiss_ball": "Schweizer Ball",
+ "sz_bar": "SZ Stange",
+ "triceps": "Trizeps",
+ "until_failure": "Bis zum Muskelversagen",
+ "cardio": "Kardio",
+ "lb": "lb",
+ "kg": "kg",
+ "kilometers_per_hour": "Kilometer pro Stunde",
+ "body_weight": "Körpergewicht",
+ "miles_per_hour": "Meilen pro Stunde",
+ "max_reps": "Max. Wdh.",
+ "plates": "Gewichtsscheiben"
+ },
+ "submit": "Abschicken",
+ "weight": "Gewicht",
+ "workout": "Training",
+ "images": "Bilder",
"description": "Beschreibung",
- "primaryMuscles": "Primäre Muskeln",
- "identicalExercisePleaseDiscard": "Wenn dir eine Übung auffällt, die mit der von dir hinzugefügten identisch ist, verwerfe bitte deinen Entwurf und bearbeite stattdessen diese Übung.",
- "contributeExercise": "Eine Übung beisteuern",
- "checkInformationBeforeSubmitting": "Bitte überprüfe vor dem Absenden der Übung, ob die von dir eingegebenen Informationen korrekt sind",
- "successfullyUpdated": "Die Übung wurde erfolgreich aktualisiert. Aufgrund von Caching kann es einige Zeit dauern, bis die Änderungen in der gesamten Anwendung sichtbar sind.",
- "alsoKnownAs": "Auch bekannt als:",
- "deleteExerciseTranslation": "Aktuelle Übersetzung löschen?",
- "deleteExerciseTranslationBody": "Du bist dabei, die Übersetzung {{language}} für die Übung \"{{name}}\" zu löschen. Diese Aktion kann nicht rückgängig gemacht werden. Weitermachen?",
- "missingExercise": "Fehlt eine bestimmte Übung?",
- "newNote": "Neuer Hinweis",
- "notesHelpText": "Hinweise sind kurze Kommentare zur Ausführung der Übung, wie z. B. \"Halte deinen Körper gerade\"",
- "variations": "Variationen",
- "step1HeaderBasics": "Grundlagen auf Englisch",
- "whatVariationsExist": "Welche Variationen dieser Übung gibt es, wenn überhaupt?",
- "filterVariations": "Name der Übung eingeben, um Variationen zu filtern",
- "submitExercise": "Übung einreichen",
- "compatibleImagesCC": "Die Bilder müssen mit der CC BY SA-Lizenz kompatibel sein. Im Zweifelsfall solltest du nur Fotos hochladen, die du selbst aufgenommen hast.",
- "alternativeNames": "Alternative Namen",
- "missingExerciseDescription": "Hilf der Community und leiste einen Beitrag!",
- "deleteExerciseFull": "Vollständige Übung löschen",
- "deleteTranslation": "Übersetzung löschen",
- "deleteExerciseBody": "Möchtest du die Übung \"{{name}}\" löschen? Du kannst entweder die aktuelle {{language}} Übersetzung oder die komplette Übung mit allen Übersetzungen, Bildern usw. löschen.",
- "basics": "Grundlagen",
- "notEnoughRightsHeader": "Du kannst keine Übungen beisteuern",
- "notEnoughRights": "Du kannst Übungen nur dann beisteuern, wenn dein Benutzerkonto älter als {{days}} Tage und deine E-Mail-Adresse verifiziert ist",
- "changeExerciseLanguage": "Ändere die Sprache dieser Übung",
- "identicalExercise": "Vermeide doppelte Übungen",
- "cacheWarning": "Aufgrund von Caching kann es einige Zeit dauern, bis Änderungen in der ganzen Anwendung sichtbar sind.",
- "replacements": "Ersätze",
- "replacementsInfoText": "Optional können Sie auch eine Übung auswählen, die diese ersetzen soll (z. B. weil sie zweimal eingereicht wurde oder ähnliches). Dadurch wird die Übung in Routinen sowie Trainingsprotokollen ersetzt, anstatt sie einfach zu löschen. Diese Änderungen werden auch auf alle Instanzen übertragen, die Übungen von dieser übernehmen.",
- "replacementsSearch": "Suche nach Übungen oder kopiere eine Bekannte ID in das Feld und drücke den \"Laden\" Button.",
- "noReplacementSelected": " Keine Übung zum ersätzen ausgewählt",
- "deleteExerciseReplace": "Löschen und ersetzen",
- "imageStylePhoto": "Foto",
- "imageStyle3D": "3D",
- "imageStyleLine": "Linie",
- "imageStyleLowPoly": "Niedrig-Poly",
- "imageStyleOther": "andere",
- "imageDetails": "Bilddetails"
- },
- "noResults": "Keine Ergebnisse",
- "noResultsDescription": "Keine Ergebnisse für diese Suche gefunden, bitte reduziere die Anzahl der Filter.",
- "nutritionalPlan": "Ernährungsplan",
- "server": {
- "abs": "Bauch",
- "arms": "Arme",
- "back": "Rücken",
- "barbell": "Langhantel",
- "bench": "Bank",
- "biceps": "Bizeps",
- "calves": "Waden",
- "chest": "Brust",
- "dumbbell": "Kurzhantel",
- "glutes": "Po",
- "gym_mat": "Matte",
- "hamstrings": "Beinbeuger",
- "incline_bench": "Schrägbank",
- "kettlebell": "Kugelhantel",
- "kilometers": "Kilometer",
- "lats": "Latissimus",
- "legs": "Beine",
- "lower_back": "Unterer Rücken",
- "miles": "Meilen",
- "minutes": "Minuten",
- "none__bodyweight_exercise_": "keine (Körpergewichtübung)",
- "pull_up_bar": "Klimmzugstange",
- "quads": "Beinstrecker",
- "repetitions": "Wiederholungen",
- "seconds": "Sekunden",
- "shoulders": "Schultern",
- "swiss_ball": "Schweizer Ball",
- "sz_bar": "SZ Stange",
- "triceps": "Trizeps",
- "until_failure": "Bis zum Muskelversagen",
- "cardio": "Kardio",
- "lb": "lb",
- "kg": "kg",
- "kilometers_per_hour": "Kilometer pro Stunde",
- "body_weight": "Körpergewicht",
- "miles_per_hour": "Meilen pro Stunde",
- "max_reps": "Max. Wdh.",
- "plates": "Gewichtsscheiben"
- },
- "submit": "Abschicken",
- "weight": "Gewicht",
- "workout": "Training",
- "images": "Bilder",
- "description": "Beschreibung",
- "translation": "Übersetzung",
- "overview": "Übersicht",
- "goBack": "Zurück",
- "language": "Sprache",
- "forms": {
- "supportedImageFormats": "Es werden nur JPEG-, PNG- und WEBP-Dateien unter 20Mb unterstützt",
- "valueTooShort": "Der Wert ist zu gering",
- "valueTooLong": "Der Wert ist zu groß",
- "fieldRequired": "Pflichtfeld",
- "maxLength": "Bitte gebe weniger als {{chars}} Zeichen ein",
- "minLength": "Bitte gebe mehr als {{chars}} Zeichen ein",
- "minValue": "Der Wert für dieses Feld muss höher sein als {{value}}",
- "maxValue": "Der Wert für dieses Feld muss niedriger sein als {{value}}"
- },
- "routines": {
- "sets": "Sätze",
- "reps": "Whd.",
- "rir": "RiR",
- "volume": "Volumen",
- "intensity": "Intensität",
- "currentRoutine": "Aktuelle Routine",
- "iteration": "Iteration",
- "weekly": "Wöchentlich",
- "daily": "Täglich",
- "restTime": "Pausenzeit",
- "workoutNr": "Training {{number}}",
- "weekNr": "Woche {{number}}",
- "addDay": "Trainingstag hinzufügen",
- "needsLogsToAdvance": "Benötigt Log zum Fortfahren",
- "needsLogsToAdvanceHelpText": "Wenn du diese Option auswählst, wird die Routine nur dann zum nächsten geplanten Tag fortschreiten, wenn du ein Training für den aktuellen Tag protokolliert hast. Wenn diese Option nicht ausgewählt ist, wird die Routine automatisch zum nächsten Tag fortschreiten, unabhängig davon, ob du ein Training protokolliert hast oder nicht.",
- "routineHasNoDays": "Diese Routine hat keine Trainingstage",
- "setHasNoExercises": "Dieser Satz hat keine Übungen",
- "routine": "Routine",
- "editProgression": "Progression bearbeiten",
- "progressionNeedsReplace": "Einer der vorherigen Einträge muss eine Ersetzungsoperation haben",
- "exerciseHasProgression": "Diese Übung hat Progressionsregeln und kann hier nicht bearbeitet werden. Klicke dazu auf die Schaltfläche.",
- "routines": "Routinen",
- "addSuperset": "Supersatz hinzufügen",
- "addExercise": "Übung hinzufügen",
- "exerciseNr": "Übung {{number}}",
- "supersetNr": "Supersatz {{number}}",
- "statsOverview": "Statistiken",
- "simpleMode": "Einfacher Modus",
- "restDay": "Ruhetag",
- "addWeightLog": "Trainingslog hinzufügen",
- "logsFilterNote": "Beachte, dass nur Einträge mit einer Gewichtseinheit (kg oder lb) und Wiederholungen gezeichnet werden, andere Kombinationen wie Zeit oder bis zum Ausfall werden hier ignoriert",
- "logsHeader": "Trainingsprotokoll für das Workout",
- "addLogToDay": "Protokoll zu diesem Tag hinzufügen"
- },
- "name": "Name",
- "cancel": "Abbrechen",
- "videos": "Videos",
- "cannotBeUndone": "Diese Aktion kann nicht rückgängig gemacht werden.",
- "preferences": "Voreinstellungen",
- "success": "Erfolg!",
- "measurements": {
- "deleteInfo": "Dies wird die Kategorie sowie alle seine Einträge löschen",
- "unitFormHelpText": "Die Einheit, in der die Kategorie gemessen wird, wie cm oder %",
- "measurements": "Messungen"
- },
- "timeOfDay": "Tageszeit",
- "notes": "Notizen",
- "value": "Wert",
- "unit": "Einheit",
- "alsoSearchEnglish": "Namen auch in English suchen",
- "deleteConfirmation": "Möchten Sie sicher mit der Löschung von \"{{name}}\" fortfahren?",
- "seeDetails": "Siehe Einzelheiten",
- "actions": "Aktion",
- "nothingHereYet": "Hier ist noch nichts...",
- "nothingHereYetAction": "Drücke den Aktionsbutton um zu beginnen",
- "copyToClipboard": "In Zwischenablage kopieren",
- "nutrition": {
- "plans": "Ernährungspläne",
- "plan": "Ernährungsplan",
- "useGoalsHelpText": "Ziele zu diesem Plan hinzufügen",
- "meal": "Mahlzeit",
- "gramShort": "g",
- "valueEnergyKcal": "{{value}} kcal",
- "kcal": "kcal",
- "percentEnergy": "Prozent der Energie",
- "gPerBodyKg": "g pro Körper-kg",
- "planned": "Geplant",
- "logged": "Protokolliert",
- "difference": "Unterschied",
- "today": "Heute",
- "7dayAvg": "7-Tage-Durchschnitt",
- "carbohydrates": "Kohlenhydrate",
- "sugar": "Zucker",
- "ofWhichSugars": "davon Zucker",
- "fat": "Fett",
- "others": "Sonstige",
- "fibres": "Ballaststoffe",
- "sodium": "Natrium",
- "planDeleteInfo": "Dies wird ebenfalls alle Nahrungstagebucheinträge löschen",
- "mealDeleteInfo": "Ernährungstagebucheinträge zu dieser Mahlzeit werden nicht gelöscht und erscheinen unter \"andere Protokolle\"",
- "diaryEntrySaved": "Tagebucheintrag erfolgreich gespeichert",
- "goalsTitle": "Ziele",
- "goalEnergy": "Energieziel",
- "goalProtein": "Protein Ziel",
- "goalCarbohydrates": "Kohlenhydrate Ziel",
- "goalFat": "Fett Ziel",
- "addNutritionalDiary": "Nahrungstagebucheintrag hinzufügen",
- "nutritionalDiary": "Ernährungstagebuch",
- "valueEnergyKcalKj": "{{kcal}} kcal / {{kj}} kJ",
- "energy": "Energie",
- "protein": "Eiweiß",
- "ofWhichSaturated": "davon gesättigt",
- "pseudoMealTitle": "Andere Protokolle",
- "valueRemaining": "verbleibend",
- "copyPlan": "Mache eine Kopie dieses Plans",
- "macronutrient": "Makronährstoff",
- "loggedToday": "Heute protokolliert",
- "addMeal": "Mahlzeit hinzufügen",
- "useGoalsHelpTextLong": "So kannst du allgemeine Ziele für Energie, Eiweiß, Kohlenhydrate oder Fett für den Plan festlegen. Beachte, dass diese Werte Vorrang haben, wenn du einen detaillierten Mahlzeitenplan erstellst.",
- "addMealItem": "Zutat zu Mahlzeit hinzufügen",
- "searchIngredientName": "Suche nach Zutatenname",
- "saturatedFat": "Gesättigte Fette",
- "valueTooMany": "zu viele",
- "logThisMealItem": "Diese Zutat unverändert in das Ernährungstagebuch eintragen",
- "onlyLoggingHelpText": "Nur Kalorien verfolgen. Markiere das Kästchen, wenn du nur deine Kalorien protokollieren möchtest und keinen detaillierten Ernährungsplan mit spezifischen Mahlzeiten einrichten willst",
- "goalFiber": "Ballaststoffziel",
- "logThisMeal": "Dieses Gericht unverändert in das Ernährungstagebuch eintragen"
- },
- "downloadAsPdf": "Als PDF runterladen",
- "total": "Summe",
- "licenses": {
- "authors": "Author(en)",
- "derivativeSourceUrl": "Link zur Originalquelle, falls es sich um ein abgeleitetes Werk handelt",
- "originalObjectUrl": "Link zur Quell-Website, falls verfügbar",
- "originalTitle": "Titel",
- "authorProfile": "Link zur Website oder zum Profil des Autors, falls verfügbar",
- "derivativeSourceUrlHelper": "Beachte, dass ein abgeleitetes Werk nicht nur auf einem vorherigen Werk basiert, sondern auch genügend neue, kreative Inhalte enthält, um ein eigenes Urheberrecht zu beanspruchen."
- },
- "filters": "Filter",
- "calendar": "Kalender",
- "entries": "Einträge",
- "no_entries_for_day": "Keine Einträge für diesen Tag",
- "height": "Grösse",
- "cm": "cm",
- "all": "Alle",
- "lastYear": "Letztes Jahr",
- "lastHalfYear": "In den letzten 6 Monate",
- "lastMonth": "Letzter Monat",
- "lastWeek": "Letzte Woche",
- "bmi": {
- "overweight": "Übergewicht",
- "obese": "Fettleibig",
- "normal": "Normales Gewicht",
- "calculator": "BMI Rechner",
- "underweight": "Untergewicht",
- "result": "Dein BMI ist {{value}}"
- }
+ "translation": "Übersetzung",
+ "overview": "Übersicht",
+ "goBack": "Zurück",
+ "language": "Sprache",
+ "forms": {
+ "supportedImageFormats": "Es werden nur JPEG-, PNG- und WEBP-Dateien unter 20Mb unterstützt",
+ "valueTooShort": "Der Wert ist zu gering",
+ "valueTooLong": "Der Wert ist zu groß",
+ "fieldRequired": "Pflichtfeld",
+ "maxLength": "Bitte gebe weniger als {{chars}} Zeichen ein",
+ "minLength": "Bitte gebe mehr als {{chars}} Zeichen ein",
+ "minValue": "Der Wert für dieses Feld muss höher sein als {{value}}",
+ "maxValue": "Der Wert für dieses Feld muss niedriger sein als {{value}}"
+ },
+ "routines": {
+ "sets": "Sätze",
+ "reps": "Whd.",
+ "rir": "RiR",
+ "volume": "Volumen",
+ "intensity": "Intensität",
+ "currentRoutine": "Aktuelle Routine",
+ "iteration": "Iteration",
+ "weekly": "Wöchentlich",
+ "daily": "Täglich",
+ "restTime": "Pausenzeit",
+ "workoutNr": "Training {{number}}",
+ "weekNr": "Woche {{number}}",
+ "addDay": "Trainingstag hinzufügen",
+ "needsLogsToAdvance": "Benötigt Log zum Fortfahren",
+ "needsLogsToAdvanceHelpText": "Wenn du diese Option auswählst, wird die Routine nur dann zum nächsten geplanten Tag fortschreiten, wenn du ein Training für den aktuellen Tag protokolliert hast. Wenn diese Option nicht ausgewählt ist, wird die Routine automatisch zum nächsten Tag fortschreiten, unabhängig davon, ob du ein Training protokolliert hast oder nicht.",
+ "routineHasNoDays": "Diese Routine hat keine Trainingstage",
+ "setHasNoExercises": "Dieser Satz hat keine Übungen",
+ "routine": "Routine",
+ "editProgression": "Progression bearbeiten",
+ "progressionNeedsReplace": "Einer der vorherigen Einträge muss eine Ersetzungsoperation haben",
+ "exerciseHasProgression": "Diese Übung hat Progressionsregeln und kann hier nicht bearbeitet werden. Klicke dazu auf die Schaltfläche.",
+ "routines": "Routinen",
+ "addSuperset": "Supersatz hinzufügen",
+ "addExercise": "Übung hinzufügen",
+ "exerciseNr": "Übung {{number}}",
+ "supersetNr": "Supersatz {{number}}",
+ "statsOverview": "Statistiken",
+ "simpleMode": "Einfacher Modus",
+ "restDay": "Ruhetag",
+ "addWeightLog": "Trainingslog hinzufügen",
+ "logsFilterNote": "Beachte, dass nur Einträge mit einer Gewichtseinheit (kg oder lb) und Wiederholungen gezeichnet werden, andere Kombinationen wie Zeit oder bis zum Ausfall werden hier ignoriert",
+ "logsHeader": "Trainingsprotokoll für das Workout",
+ "addLogToDay": "Protokoll zu diesem Tag hinzufügen"
+ },
+ "name": "Name",
+ "cancel": "Abbrechen",
+ "videos": "Videos",
+ "cannotBeUndone": "Diese Aktion kann nicht rückgängig gemacht werden.",
+ "preferences": "Voreinstellungen",
+ "success": "Erfolg!",
+ "measurements": {
+ "deleteInfo": "Dies wird die Kategorie sowie alle seine Einträge löschen",
+ "unitFormHelpText": "Die Einheit, in der die Kategorie gemessen wird, wie cm oder %",
+ "measurements": "Messungen"
+ },
+ "timeOfDay": "Tageszeit",
+ "notes": "Notizen",
+ "value": "Wert",
+ "unit": "Einheit",
+ "alsoSearchEnglish": "Namen auch in English suchen",
+ "deleteConfirmation": "Möchten Sie sicher mit der Löschung von \"{{name}}\" fortfahren?",
+ "seeDetails": "Siehe Einzelheiten",
+ "actions": "Aktion",
+ "nothingHereYet": "Hier ist noch nichts...",
+ "nothingHereYetAction": "Drücke den Aktionsbutton um zu beginnen",
+ "copyToClipboard": "In Zwischenablage kopieren",
+ "nutrition": {
+ "plans": "Ernährungspläne",
+ "plan": "Ernährungsplan",
+ "useGoalsHelpText": "Ziele zu diesem Plan hinzufügen",
+ "meal": "Mahlzeit",
+ "gramShort": "g",
+ "valueEnergyKcal": "{{value}} kcal",
+ "kcal": "kcal",
+ "percentEnergy": "Prozent der Energie",
+ "gPerBodyKg": "g pro Körper-kg",
+ "planned": "Geplant",
+ "logged": "Protokolliert",
+ "difference": "Unterschied",
+ "today": "Heute",
+ "7dayAvg": "7-Tage-Durchschnitt",
+ "carbohydrates": "Kohlenhydrate",
+ "sugar": "Zucker",
+ "ofWhichSugars": "davon Zucker",
+ "fat": "Fett",
+ "others": "Sonstige",
+ "fibres": "Ballaststoffe",
+ "sodium": "Natrium",
+ "planDeleteInfo": "Dies wird ebenfalls alle Nahrungstagebucheinträge löschen",
+ "mealDeleteInfo": "Ernährungstagebucheinträge zu dieser Mahlzeit werden nicht gelöscht und erscheinen unter \"andere Protokolle\"",
+ "diaryEntrySaved": "Tagebucheintrag erfolgreich gespeichert",
+ "goalsTitle": "Ziele",
+ "goalEnergy": "Energieziel",
+ "goalProtein": "Protein Ziel",
+ "goalCarbohydrates": "Kohlenhydrate Ziel",
+ "goalFat": "Fett Ziel",
+ "addNutritionalDiary": "Nahrungstagebucheintrag hinzufügen",
+ "nutritionalDiary": "Ernährungstagebuch",
+ "valueEnergyKcalKj": "{{kcal}} kcal / {{kj}} kJ",
+ "energy": "Energie",
+ "protein": "Eiweiß",
+ "ofWhichSaturated": "davon gesättigt",
+ "pseudoMealTitle": "Andere Protokolle",
+ "valueRemaining": "verbleibend",
+ "copyPlan": "Mache eine Kopie dieses Plans",
+ "macronutrient": "Makronährstoff",
+ "loggedToday": "Heute protokolliert",
+ "addMeal": "Mahlzeit hinzufügen",
+ "useGoalsHelpTextLong": "So kannst du allgemeine Ziele für Energie, Eiweiß, Kohlenhydrate oder Fett für den Plan festlegen. Beachte, dass diese Werte Vorrang haben, wenn du einen detaillierten Mahlzeitenplan erstellst.",
+ "addMealItem": "Zutat zu Mahlzeit hinzufügen",
+ "searchIngredientName": "Suche nach Zutatenname",
+ "saturatedFat": "Gesättigte Fette",
+ "valueTooMany": "zu viele",
+ "logThisMealItem": "Diese Zutat unverändert in das Ernährungstagebuch eintragen",
+ "onlyLoggingHelpText": "Nur Kalorien verfolgen. Markiere das Kästchen, wenn du nur deine Kalorien protokollieren möchtest und keinen detaillierten Ernährungsplan mit spezifischen Mahlzeiten einrichten willst",
+ "goalFiber": "Ballaststoffziel",
+ "logThisMeal": "Dieses Gericht unverändert in das Ernährungstagebuch eintragen"
+ },
+ "downloadAsPdf": "Als PDF runterladen",
+ "total": "Summe",
+ "licenses": {
+ "authors": "Author(en)",
+ "derivativeSourceUrl": "Link zur Originalquelle, falls es sich um ein abgeleitetes Werk handelt",
+ "originalObjectUrl": "Link zur Quell-Website, falls verfügbar",
+ "originalTitle": "Titel",
+ "authorProfile": "Link zur Website oder zum Profil des Autors, falls verfügbar",
+ "derivativeSourceUrlHelper": "Beachte, dass ein abgeleitetes Werk nicht nur auf einem vorherigen Werk basiert, sondern auch genügend neue, kreative Inhalte enthält, um ein eigenes Urheberrecht zu beanspruchen."
+ },
+ "filters": "Filter",
+ "calendar": "Kalender",
+ "entries": "Einträge",
+ "no_entries_for_day": "Keine Einträge für diesen Tag",
+ "height": "Grösse",
+ "cm": "cm",
+ "all": "Alle",
+ "lastYear": "Letztes Jahr",
+ "lastHalfYear": "In den letzten 6 Monate",
+ "lastMonth": "Letzter Monat",
+ "lastWeek": "Letzte Woche",
+ "bmi": {
+ "overweight": "Übergewicht",
+ "obese": "Fettleibig",
+ "normal": "Normales Gewicht",
+ "calculator": "BMI Rechner",
+ "underweight": "Untergewicht",
+ "result": "Dein BMI ist {{value}}"
+ }
}
diff --git a/wger/core/static/react/locales/fr/translation.json b/wger/core/static/react/locales/fr/translation.json
index a3dbb270e..e23d1a583 100644
--- a/wger/core/static/react/locales/fr/translation.json
+++ b/wger/core/static/react/locales/fr/translation.json
@@ -57,7 +57,8 @@
"imageStyleLine": "Ligne",
"imageDetails": "Détail des images",
"imageStyleOther": "Autre",
- "imageStyleLowPoly": "Low-Poly"
+ "imageStyleLowPoly": "Low-Poly",
+ "swapExercise": "Changer d'exercice"
},
"server": {
"arms": "Bras",
@@ -123,14 +124,18 @@
"minLength": "Veuillez saisir plus de {{chars}} caractères",
"maxLength": "Veuillez saisir moins de {{chars}} caractères",
"maxValue": "La valeur de ce champ doit être inférieure à {{value}}",
- "minValue": "La valeur de ce champ doit être supérieure à {{value}}"
+ "minValue": "La valeur de ce champ doit être supérieure à {{value}}",
+ "enterNumber": "Veuillez entrer un nombre valide",
+ "maxLessThanMin": "La valeur maximale doit être plus grande que la valeur minimale",
+ "endBeforeStart": "La valeur de fin ne peut être avant le début",
+ "enterInteger": "Veuillez entrer un nombre entier"
},
"name": "Nom",
"category": "Catégorie",
"English": "Anglais",
"save": "Sauvegarder",
"cancel": "Annuler",
- "success": "Succès !",
+ "success": "Succès!",
"videos": "Vidéos",
"cannotBeUndone": "Cette action ne peux pas être annulée.",
"translation": "Traduction",
@@ -145,7 +150,8 @@
"routine": "Routine",
"routines": "Routines",
"logsHeader": "Journal de poids pour cet entraînement",
- "rir": "ReR"
+ "rir": "ReR",
+ "reps": "Répétitions"
},
"value": "Valeur",
"deleteConfirmation": "Êtes-vous certain de vouloir supprimer \"{{name}}\" ?",
@@ -229,11 +235,29 @@
"calendar": "Calendrier",
"entries": "Entrées",
"no_entries_for_day": "Aucune entrée pour ce jour",
- "height": "Poids",
+ "height": "taille",
"cm": "cm",
"lastHalfYear": "6 Derniers Mois",
"lastMonth": "Dernier Mois",
"all": "Tout",
"lastYear": "Dernière Année",
- "lastWeek": "Dernière Semaine"
+ "lastWeek": "Dernière Semaine",
+ "start": "Démarrer",
+ "end": "Terminer",
+ "min": "Minimum",
+ "max": "Maximum",
+ "durationWeeks": "{{number}} semaines",
+ "successfullyDeleted": "Suppression effectuée",
+ "durationWeeksDays": "{{nrWeeks}} semaines, {{nrDays}} jours",
+ "undo": "Annuler les modifications",
+ "bmi": {
+ "calculator": "Calculateur BMI",
+ "overweight": "Surpoids",
+ "obese": "Obèse",
+ "normal": "Poids normal",
+ "underweight": "Poids insuffisant",
+ "result": "Votre BMI est {{value}}"
+ },
+ "editName": "Editer {{name}}",
+ "comment": "Commentaire"
}
diff --git a/wger/core/static/react/locales/pt/translation.json b/wger/core/static/react/locales/pt/translation.json
index 771ada9c2..1db424e23 100644
--- a/wger/core/static/react/locales/pt/translation.json
+++ b/wger/core/static/react/locales/pt/translation.json
@@ -83,7 +83,8 @@
"imageStyleLine": "Linha",
"imageStyleLowPoly": "Baixa Poligonalidade",
"imageStyleOther": "Outro",
- "imageDetails": "Detalhes da Imagem"
+ "imageDetails": "Detalhes da Imagem",
+ "swapExercise": "Trocar exercício"
},
"noResults": "Sem resultados",
"noResultsDescription": "Nenhum resultado encontrado para essa consulta, considere reduzir o número de filtros.",
@@ -100,7 +101,10 @@
"minValue": "O valor para esse campo deve ser maior que {{value}}",
"maxLength": "Por favor, entre com menos de {{chars}} caracteres",
"minLength": "Por favor, use mais que {{chars}} caracteres",
- "maxValue": "O valor para esse campo deve ser menor que {{value}}"
+ "maxValue": "O valor para esse campo deve ser menor que {{value}}",
+ "enterNumber": "Favor inserir um número válido",
+ "enterInteger": "Favor inserir um número inteiro",
+ "maxLessThanMin": "O valor máximo deve ser maior que o mínimo"
},
"cannotBeUndone": "Essa ação é irreversível.",
"server": {
@@ -162,7 +166,15 @@
"routines": "Rotinas",
"logsFilterNote": "Note que apenas entradas com uma unidade de massa de kg ou lb e repetições aparecem no gráfico. Outras combinações tais como tempo ou até falha são ignoradas aqui",
"logsHeader": "Registro de peso para treino",
- "rir": "ReR"
+ "rir": "ReR",
+ "sets": "Séries",
+ "intensity": "Intensidade",
+ "currentRoutine": "Rotina atual",
+ "weekly": "Semanal",
+ "daily": "Diária",
+ "restTime": "Tempo de repouso",
+ "backToRoutine": "Voltar para rotina",
+ "reps": "Repetições"
},
"measurements": {
"measurements": "Medidas",
@@ -260,5 +272,10 @@
},
"entries": "Entradas",
"calendar": "Calendário",
- "no_entries_for_day": "Não há entradas para este dia"
+ "no_entries_for_day": "Não há entradas para este dia",
+ "start": "Iniciar",
+ "comment": "Comentário",
+ "editName": "Editar {{name}}",
+ "undo": "Desfazer",
+ "successfullyDeleted": "Apagado com sucesso"
}
diff --git a/wger/core/static/react/locales/ta/translation.json b/wger/core/static/react/locales/ta/translation.json
index e59cc9494..596706a15 100644
--- a/wger/core/static/react/locales/ta/translation.json
+++ b/wger/core/static/react/locales/ta/translation.json
@@ -58,7 +58,8 @@
"alsoKnownAs": "மேலும் அழைக்கப்படுகிறது:",
"deleteExerciseBody": "\"{{name}}\" என்ற பயிற்சியை நீக்க விரும்புகிறீர்களா? நீங்கள் தற்போதைய {{language}} மொழிபெயர்ப்பை அல்லது அனைத்து மொழிபெயர்ப்புகள், படங்கள் போன்றவற்றைக் கொண்ட முழுமையான உடற்பயிற்சியை நீக்கலாம்.",
"translateExerciseNow": "இந்த பயிற்சியை இப்போது மொழிபெயர்க்கவும்",
- "notes": "குறிப்புகள்"
+ "notes": "குறிப்புகள்",
+ "swapExercise": "உடற்பயிற்சியை மாற்றவும்"
},
"nutrition": {
"plans": "ஊட்டச்சத்து திட்டங்கள்",
@@ -121,7 +122,11 @@
"minValue": "இந்த புலத்திற்கான மதிப்பு {{value}} ஐ விட அதிகமாக இருக்க வேண்டும்",
"valueTooLong": "மதிப்பு மிக நீளமானது",
"fieldRequired": "இந்த புலம் தேவை",
- "maxValue": "இந்த புலத்திற்கான மதிப்பு {{value} than ஐ விட குறைவாக இருக்க வேண்டும்"
+ "maxValue": "இந்த புலத்திற்கான மதிப்பு {{value} than ஐ விட குறைவாக இருக்க வேண்டும்",
+ "enterNumber": "செல்லுபடியாகும் எண்ணை உள்ளிடவும்",
+ "enterInteger": "முழு எண்ணையும் உள்ளிடவும்",
+ "maxLessThanMin": "அதிகபட்ச மதிப்பு குறைந்தபட்சத்தை விட பெரியதாக இருக்க வேண்டும்",
+ "endBeforeStart": "இறுதி மதிப்பு தொடக்கத்திற்கு முன் இருக்க முடியாது"
},
"category": "வகை",
"success": "வெற்றி!",
@@ -134,7 +139,83 @@
"routines": "நடைமுறைகள்",
"addDay": "பயிற்சி நாள் சேர்க்கவும்",
"logsHeader": "வொர்க்அவுட்டுக்கான பயிற்சி பதிவு",
- "addLogToDay": "இன்றுவரை பதிவைச் சேர்க்கவும்"
+ "addLogToDay": "இன்றுவரை பதிவைச் சேர்க்கவும்",
+ "daily": "நாள்தோறும்",
+ "routineHasNoDays": "வழக்கத்திற்கு நாட்கள் இல்லை",
+ "setHasNoExercises": "இந்த தொகுப்பில் எந்த பயிற்சிகளும் இல்லை",
+ "fitDaysInWeek": "வாரத்தில் பொருத்தமான நாட்கள்",
+ "needsLogsToAdvance": "முன்னேற பதிவுகள் தேவை",
+ "addSuperset": "சூப்பர்செட் சேர்க்கவும்",
+ "exerciseHasProgression": "இந்த பயிற்சிக்கு முன்னேற்ற விதிகள் உள்ளன, இங்கு திருத்த முடியாது. அவ்வாறு செய்ய, பொத்தானைக் சொடுக்கு செய்க.",
+ "newDay": "புதிய நாள்",
+ "statsOverview": "புள்ளிவிவரங்கள்",
+ "simpleMode": "எளிய முறை",
+ "impressionNeutral": "நடுநிலை",
+ "repeat": "விதி மீண்டும்",
+ "repeatHelpText": "இந்த விதி புதியதை வரையறுக்கும் வரை அடுத்தடுத்த உடற்பயிற்சிகளுக்கும் தொடர்ந்து விண்ணப்பிக்க விரும்பினால் தேர்வுப்பெட்டியை சரிபார்க்கவும்",
+ "markAsTemplate": "வார்ப்புருவை நிர்வகிக்கவும்",
+ "template": "வார்ப்புரு",
+ "templates": "வார்ப்புருக்கள்",
+ "publicTemplate": "பொது வார்ப்புரு",
+ "publicTemplates": "பொது வார்ப்புருக்கள்",
+ "publicTemplateHelpText": "அனைத்து பயனர்களுக்கும் பொது வார்ப்புருக்கள் கிடைக்கின்றன.",
+ "set": {
+ "jump": "தாவு",
+ "type": "வகை",
+ "normalSet": "சாதாரண தொகுப்பு",
+ "dropSet": "துளி தொகுப்பு",
+ "myo": "Myo",
+ "partial": "பகுதி",
+ "forced": "கட்டாயப்படுத்தப்பட்டது",
+ "tut": "Tut",
+ "iso": "ஐசோ"
+ },
+ "sets": "செட்",
+ "reps": "பிரதிநிதிகள்",
+ "volume": "தொகுதி",
+ "intensity": "தீவிரம்",
+ "currentRoutine": "தற்போதைய வழக்கமான",
+ "iteration": "மறுசெய்கை",
+ "weekly": "வாராந்திர",
+ "restTime": "ஓய்வு நேரம்",
+ "workoutNr": "ஒர்க்அவுட் என்.ஆர். {{number}}",
+ "weekNr": "வாரம் {{number}}",
+ "backToRoutine": "வழக்கத்திற்கு திரும்பவும்",
+ "minLengthRoutine": "வழக்கம் குறைந்தது {{number}} வாரங்கள் நீளமாக இருக்க வேண்டும்",
+ "maxLengthRoutine": "வழக்கம் அதிகபட்சம் {{number}} வாரங்கள் நீளமாக இருக்கலாம்",
+ "resultingRoutine": "இதன் விளைவாக வழக்கமான",
+ "deleteDayConfirmation": "இது அனைத்து செட், பயிற்சிகள் மற்றும் முன்னேற்ற விதிகளை அகற்றும்",
+ "fitDaysInWeekHelpText": "பல வாரங்களில் உங்கள் வழக்கமான நாட்கள் எவ்வாறு திட்டமிடப்பட்டுள்ளன என்பதை இந்த அமைப்பு கட்டுப்படுத்துகிறது. இயக்கப்பட்டால், வாரங்கள் வாராந்திர சுழற்சியில் மீண்டும் நிகழும். எடுத்துக்காட்டாக, திங்கள், அறிவன் மற்றும் வெள்ளிக்கிழமைகளில் உடற்பயிற்சிகளுடன் ஒரு வழக்கம் அடுத்த திங்கள், அறிவன் மற்றும் வெள்ளிக்கிழமைகளில் இந்த முறையைத் தொடரும். முடக்கப்பட்டால், ஒரு புதிய வாரத்தின் தொடக்கத்தைப் பொருட்படுத்தாமல் நாட்கள் தொடர்ச்சியாக பின்பற்றப்படும். கடுமையான வாராந்திர அட்டவணையைப் பின்பற்றாத நடைமுறைகளுக்கு இது பயனுள்ளதாக இருக்கும்.",
+ "needsLogsToAdvanceHelpText": "இந்த விருப்பத்தை நீங்கள் தேர்ந்தெடுத்தால், தற்போதைய நாளுக்கு நீங்கள் ஒரு வொர்க்அவுட்டை பதிவு செய்திருந்தால், அடுத்த திட்டமிடப்பட்ட நாளுக்கு மட்டுமே வழக்கம் முன்னேறும். இந்த விருப்பம் தேர்ந்தெடுக்கப்படாவிட்டால், நீங்கள் ஒரு வொர்க்அவுட்டை உள்நுழைந்திருக்கிறீர்களா இல்லையா என்பதைப் பொருட்படுத்தாமல் வழக்கமானது அடுத்த நாளுக்கு தானாகவே முன்னேறும்.",
+ "addExercise": "உடற்பயிற்சியைச் சேர்க்கவும்",
+ "exerciseNr": "உடற்பயிற்சி {{number}}",
+ "supersetNr": "சூப்பர்செட் {{number}}}",
+ "editProgression": "முன்னேற்றத்தைத் திருத்தவும்",
+ "progressionNeedsReplace": "முந்தைய உள்ளீடுகளில் ஒன்று மாற்றும் செயல்பாட்டைக் கொண்டிருக்க வேண்டும்",
+ "defaultRounding": "இயல்புநிலை ரவுண்டிங்",
+ "rounding": "ரவுண்டிங் (இந்த உடற்பயிற்சி)",
+ "roundingHelp": "எடை மற்றும் மறுபடியும் இயல்புநிலை ரவுண்டிங் அமைக்கவும் (முன்னேற்றத்தின் சதவீத அதிகரிப்பு படியைப் பயன்படுத்தும்போது இது மிகவும் பயனுள்ளதாக இருக்கும்). இது அனைத்து புதிய தொகுப்புகளுக்கும் பொருந்தும், ஆனால் முன்னேற்ற வடிவத்தில் தனித்தனியாக மாற்றலாம். வட்டத்தை முடக்க காலியாக விடவும்.",
+ "weightLogNotPlanned": "உடற்பயிற்சிகளும் திட்டமிடப்படாத தேதிக்கு பதிவுகளைச் சேமித்தல்.",
+ "logsOverview": "பதிவுகள் கண்ணோட்டம்",
+ "alsoShowLogs": "பதிவுகளையும் காட்டு",
+ "restDay": "ஓய்வு நாள்",
+ "confirmRestDay": "ஓய்வு நாள் மாற்றத்தை உறுதிப்படுத்தவும்",
+ "confirmRestDayHelpText": "ஒரு நாள் ஓய்வு நாளாக நீங்கள் குறிக்கும்போது அனைத்து தொகுப்புகளும் பயிற்சிகளும் அகற்றப்படும் என்பதை நினைவில் கொள்க.",
+ "duplicate": "நகல் வழக்கமான",
+ "downloadPdfTable": "PDF (அட்டவணை) பதிவிறக்கவும்",
+ "downloadPdfLogs": "PDF (பதிவுகள்) பதிவிறக்கவும்",
+ "downloadIcal": "Ical கோப்பைப் பதிவிறக்கவும்",
+ "impression": "பொது எண்ணம்",
+ "impressionGood": "நல்லது",
+ "impressionBad": "மோசமான",
+ "impressionHelpText": "இந்த படிவம் ஒவ்வொரு உடற்பயிற்சிக்கும் உங்கள் பயிற்சி முடிவுகளை (பிரதிநிதிகள், எடை போன்றவை) பதிவு செய்கிறது. பயிற்சிகளை அகற்றுவது அல்லது மாற்றுவது போன்ற நீங்கள் இங்கு செய்யும் மாற்றங்கள், நீங்கள் சேமிக்கும் குறிப்பிட்ட பதிவுகளை மட்டுமே பாதிக்கின்றன, மேலும் உங்கள் ஒட்டுமொத்த வழக்கத்தை மாற்றாது. எடை அல்லது மறுபடியும் மதிப்புகளைக் கொண்ட வரிசைகள் மட்டுமே சேமிக்கப்படுகின்றன.",
+ "addAdditionalLog": "கூடுதல் பதிவைச் சேர்க்கவும்",
+ "operation": "செயல்பாடு",
+ "step": "படி",
+ "requirements": "தேவைகள்",
+ "requirementsHelpText": "இந்த விதி நடைமுறைக்கு வர நிறைவு செய்யப்பட வேண்டிய வொர்க்அவுட் முடிவுகளை (முந்தைய பதிவுகளிலிருந்து) தேர்ந்தெடுக்கவும்",
+ "templatesHelpText": "வார்ப்புருக்கள் உங்கள் வழக்கத்தை பிற்கால பயன்பாட்டிற்காக சேமிப்பதற்கான ஒரு வழியாகும், மேலும் நடைமுறைகளுக்கான தொடக்க புள்ளியாகவும். நீங்கள் வார்ப்புருக்களைத் திருத்த முடியாது, ஆனால் நீங்கள் அவற்றை நகலெடுத்து நகலில் மாற்றங்களைச் செய்யலாம் (அத்துடன் அவற்றை ஒரு வழக்கமான வழக்கமாக மாற்றலாம்).",
+ "copyAndUseTemplate": "வார்ப்புருவை நகலெடுத்து பயன்படுத்தவும்"
},
"server": {
"incline_bench": "சாய்வு பெஞ்ச்",
@@ -191,7 +272,7 @@
"copyToClipboard": "கிளிப்போர்டுக்கு நகலெடுக்கவும்",
"images": "படங்கள்",
"overview": "கண்ணோட்டம்",
- "goBack": "பின்",
+ "goBack": "திரும்பிச் செல்லுங்கள்",
"language": "மொழி",
"save": "சேமி",
"filters": "வடிப்பான்கள்",
@@ -235,5 +316,16 @@
"lastYear": "கடந்த ஆண்டு",
"lastMonth": "கடந்த மாதம்",
"lastWeek": "கடந்த வாரம்",
- "entries": "உள்ளீடுகள்"
+ "entries": "உள்ளீடுகள்",
+ "min": "மணித்துளி",
+ "max": "அதிகபட்சம்",
+ "calendar": "நாட்காட்டி",
+ "editName": "திருத்து {{name}}",
+ "start": "தொடங்கு",
+ "end": "முடிவு",
+ "comment": "கருத்து",
+ "durationWeeks": "{{number}} வாரங்கள்",
+ "undo": "செயல்தவிர்",
+ "durationWeeksDays": "{{nrWeeks}} வாரங்கள், {{nrDays}} நாட்கள்",
+ "successfullyDeleted": "வெற்றிகரமாக நீக்கப்பட்டது"
}
diff --git a/wger/core/static/react/locales/uk/translation.json b/wger/core/static/react/locales/uk/translation.json
index a34154b4f..6e1c6ff90 100644
--- a/wger/core/static/react/locales/uk/translation.json
+++ b/wger/core/static/react/locales/uk/translation.json
@@ -56,7 +56,8 @@
"imageDetails": "Деталі зображення",
"replacements": "Заміни",
"replacementsInfoText": "За бажанням ви також можете вибрати вправу, яка має замінити цю вправу (наприклад, тому що її було подано двічі або подібне). Це замінить вправу в програмах, а також у журналах тренувань, а не просто видалить її. Ці зміни також поширюватимуться на будь-який екземпляр, який синхронізує вправи з цього.",
- "noReplacementSelected": " Жодна вправа не вибрана для заміни"
+ "noReplacementSelected": " Жодна вправа не вибрана для заміни",
+ "swapExercise": "Обмін вправи"
},
"noResults": "Немає результатів",
"noResultsDescription": "Не знайдено результатів для даного запиту, подумайте про зменшення кількості фільтрів.",
@@ -120,7 +121,11 @@
"maxValue": "Значення для цього поля має бути меншим за {{value}}",
"maxLength": "Будь ласка, введіть менше {{chars} символів",
"minLength": "Будь ласка, введіть більше {{chars}} символів",
- "minValue": "Значення для цього поля має бути більшим за {{value}}"
+ "minValue": "Значення для цього поля має бути більшим за {{value}}",
+ "endBeforeStart": "Кінцеве значення не може передувати початку",
+ "enterNumber": "Введіть дійсний номер",
+ "maxLessThanMin": "Максимальне значення має бути більшим за мінімальне",
+ "enterInteger": "Будь ласка, введіть ціле число"
},
"category": "Категорія",
"cancel": "Скасувати",
@@ -131,7 +136,7 @@
"preferences": "Налаштування",
"overview": "Огляд",
"continue": "Продовжити",
- "goBack": "Назад",
+ "goBack": "Іди назад",
"loading": "Завантаження...",
"success": "Успіх!",
"routines": {
@@ -142,7 +147,83 @@
"routines": "Рутини",
"logsFilterNote": "Зверніть увагу, що на графіку відображаються лише записи з одиницею ваги кг або фунт і повтореннями, інші комбінації, такі як час або до відмови, тут ігноруються",
"logsHeader": "Журнал тренувань для тренування",
- "rir": "RiR"
+ "rir": "RiR",
+ "backToRoutine": "Назад до рутини",
+ "templatesHelpText": "Шаблони - це спосіб зберегти вашу рутину для подальшого використання і як відправну точку для подальших рутин. Ви не можете редагувати шаблони, але ви можете дублювати їх і вносити зміни в копію (а також, звичайно, перетворювати їх назад у звичайну рутину).",
+ "templates": "Шаблони",
+ "markAsTemplate": "Керувати шаблоном",
+ "intensity": "Інтенсивність",
+ "currentRoutine": "Поточна рутина",
+ "daily": "Щодня",
+ "workoutNr": "Тренування № {{number}}",
+ "weekNr": "Тиждень {{number}}",
+ "maxLengthRoutine": "Процедура може тривати щонайбільше {{number}} тижнів",
+ "deleteDayConfirmation": "Це видалить усі підходи, вправи та правила прогресу",
+ "routineHasNoDays": "Розпорядок дня не має",
+ "setHasNoExercises": "Цей комплекс не містить вправ",
+ "needsLogsToAdvance": "Для просування потрібні журнали",
+ "addSuperset": "Додайте надмножину",
+ "addExercise": "Додайте вправи",
+ "exerciseNr": "Вправа {{number}}",
+ "supersetNr": "Суперсет {{number}}",
+ "editProgression": "Редагувати прогрес",
+ "exerciseHasProgression": "Ця вправа має правила прогресу, і її не можна редагувати тут. Для цього натисніть кнопку.",
+ "defaultRounding": "Округлення за замовчуванням",
+ "newDay": "Новий день",
+ "weightLogNotPlanned": "Збереження журналів до дати, на яку не було заплановано тренувань.",
+ "logsOverview": "Огляд журналів",
+ "alsoShowLogs": "Також показати журнали",
+ "simpleMode": "Простий режим",
+ "downloadPdfTable": "Завантажити PDF (таблиця)",
+ "impression": "Загальне враження",
+ "impressionGood": "Добре",
+ "impressionNeutral": "Нейтральний",
+ "impressionBad": "Погано",
+ "addAdditionalLog": "Додати додатковий журнал",
+ "step": "Крок",
+ "requirements": "Вимоги",
+ "template": "Шаблон",
+ "publicTemplate": "Загальнодоступний шаблон",
+ "set": {
+ "type": "Тип",
+ "dropSet": "Дроп набір",
+ "myo": "МІО",
+ "partial": "Частковий",
+ "forced": "Примусово",
+ "tut": "TUT",
+ "iso": "ISO",
+ "jump": "Стрибок",
+ "normalSet": "Звичайний комплект"
+ },
+ "confirmRestDay": "Підтвердити зміну дня відпочинку",
+ "iteration": "Ітерація",
+ "copyAndUseTemplate": "Скопіюйте та використовуйте шаблон",
+ "volume": "Обсяг",
+ "sets": "Набори",
+ "repeatHelpText": "Поставте прапорець, якщо ви хочете, щоб це правило продовжувало застосовуватися до наступних тренувань, доки ви не визначите нове",
+ "restDay": "День відпочинку",
+ "progressionNeedsReplace": "Один із попередніх записів має мати операцію заміни",
+ "reps": "Повторення",
+ "weekly": "Щотижня",
+ "restTime": "Час відпочинку",
+ "requirementsHelpText": "Виберіть результати тренування (з попередніх журналів), які мають бути виконані, щоб це правило вступило в силу",
+ "minLengthRoutine": "Розпорядок має тривати принаймні {{number}} тижнів",
+ "confirmRestDayHelpText": "Будь ласка, зверніть увагу, що всі комплекси та вправи будуть видалені, коли ви позначите день як вихідний.",
+ "resultingRoutine": "Результативна рутина",
+ "fitDaysInWeek": "Відповідні дні тижня",
+ "fitDaysInWeekHelpText": "Цей параметр визначає, як дні вашої рутини будуть розписані на кілька тижнів. Якщо увімкнено, дні повторюватимуться у тижневому циклі. Наприклад, тренування у понеділок, середу та п'ятницю продовжуватимуться за такою схемою наступного понеділка, середи та п'ятниці. Якщо цю опцію вимкнено, дні повторюватимуться послідовно, незалежно від початку нового тижня. Це корисно для тренувань, які не дотримуються суворого тижневого розкладу.",
+ "needsLogsToAdvanceHelpText": "Якщо ви виберете цю опцію, тренування перейде до наступного запланованого дня, тільки якщо ви зареєстрували тренування на поточний день. Якщо цю опцію не вибрано, тренування автоматично перейде на наступний день, незалежно від того, чи ви зареєстрували тренування, чи ні.",
+ "rounding": "Округлення (ця вправа)",
+ "roundingHelp": "Встановіть округлення за замовчуванням для ваги та повторень (це особливо корисно при використанні кроку збільшення у відсотках у прогресії). Це буде застосовано до всіх нових наборів, але може бути змінено індивідуально у формі прогресії. Залиште поле порожнім, щоб вимкнути округлення.",
+ "downloadIcal": "Завантажте файл iCal",
+ "statsOverview": "Статистика",
+ "duplicate": "Дубльована процедура",
+ "downloadPdfLogs": "Завантажити PDF (журнали)",
+ "impressionHelpText": "У цій формі записуються результати тренування (кількість повторень, вага тощо) для кожної вправи. Зміни, які ви вносите тут, наприклад, видалення або заміна вправ, впливають лише на конкретні журнали, які ви зберігаєте, і не змінюють вашу загальну рутину. Зберігаються лише рядки зі значеннями ваги або повторень.",
+ "operation": "Операція",
+ "publicTemplates": "Публічні шаблони",
+ "repeat": "Правило повторення",
+ "publicTemplateHelpText": "Публічні шаблони доступні всім користувачам."
},
"seeDetails": "Дивітити подробиці",
"actions": "Дії",
@@ -241,5 +322,15 @@
},
"calendar": "Календар",
"entries": "Записи",
- "no_entries_for_day": "Немає записів на цей день"
+ "no_entries_for_day": "Немає записів на цей день",
+ "comment": "Коментар",
+ "editName": "Редагувати {{name}}",
+ "start": "Старт",
+ "end": "Кінець",
+ "min": "Мін",
+ "max": "Макс",
+ "durationWeeks": "{{number}} тижнів",
+ "undo": "Відмініти",
+ "successfullyDeleted": "Успішно видалено",
+ "durationWeeksDays": "{{nrWeeks}} тижнів, {{nrDays}} днів"
}
diff --git a/wger/core/static/react/locales/zh_Hans/translation.json b/wger/core/static/react/locales/zh_Hans/translation.json
index 670ed2a4f..fb1dd4107 100644
--- a/wger/core/static/react/locales/zh_Hans/translation.json
+++ b/wger/core/static/react/locales/zh_Hans/translation.json
@@ -60,7 +60,8 @@
"deleteExerciseBody": "你要删除“ {{name}}”训练吗?你可以删除当前{{language}}翻译或带有翻译,图像等的完整的训练。",
"newNote": "新笔记",
"notesHelpText": "笔记是关于如何训练的简短评论,例如「保持身体挺直」",
- "imageStyleOther": "其它"
+ "imageStyleOther": "其它",
+ "swapExercise": "切换练习"
},
"server": {
"arms": "手臂",
@@ -194,7 +195,11 @@
"maxLength": "请勿超过{{chars}}字",
"minLength": "请勿少于{{chars}}字",
"maxValue": "此项必须小于{{value}}",
- "minValue": "此项必须大于{{value}}"
+ "minValue": "此项必须大于{{value}}",
+ "enterInteger": "请输入全数字",
+ "maxLessThanMin": "最大值应大于最小值",
+ "enterNumber": "请输入有效数值",
+ "endBeforeStart": "结束数值必须大于开始数值"
},
"routines": {
"addDay": "添加训练日",
@@ -204,7 +209,26 @@
"routines": "日常",
"logsFilterNote": "注意仅有带有重量及次数的项目能被可视化,诸如时间和力竭的组合则不然",
"addWeightLog": "添加训练记录",
- "routine": "日常"
+ "routine": "日常",
+ "intensity": "强度",
+ "currentRoutine": "当前计划",
+ "volume": "卷",
+ "iteration": "重复次数",
+ "daily": "日",
+ "weekNr": "周 {{number}}",
+ "backToRoutine": "返回 routine",
+ "minLengthRoutine": "此计划至少需要持续 {{number}} 周",
+ "maxLengthRoutine": "此计划最多持续 {{number}} 周",
+ "deleteDayConfirmation": "这将移除所有训练计划、训练内容与训练进度信息",
+ "routineHasNoDays": "此计划不包含任何日期",
+ "setHasNoExercises": "此计划没有任何练习",
+ "fitDaysInWeek": "每周练习天数",
+ "weekly": "周",
+ "restTime": "休息时间",
+ "sets": "组",
+ "workoutNr": "训练计划 Nr. {{number}}",
+ "fitDaysInWeekHelpText": "此设置可控制例程天数在多个星期内的安排方式。如果启用,工作日将以周为周期重复。例如,在周一、周三和周五进行锻炼的例程,将在下周的周一、周三和周五继续这种模式。如果禁用,则各天将按顺序进行,而不考虑新一周的开始。这对于没有严格周计划的例程非常有用。",
+ "reps": "重复次数"
},
"language": "语言",
"cannotBeUndone": "此操作无法撤回。",
@@ -240,5 +264,15 @@
"continue": "继续",
"calendar": "日历",
"entries": "项目",
- "no_entries_for_day": "今日无项目"
+ "no_entries_for_day": "今日无项目",
+ "editName": "编辑 {{name}}",
+ "start": "开始",
+ "comment": "评论",
+ "min": "分钟",
+ "max": "最大",
+ "durationWeeks": "{{number}} 周",
+ "durationWeeksDays": "{{nrWeeks}} 周, {{nrDays}} 天",
+ "undo": "撤销",
+ "successfullyDeleted": "成功删除",
+ "end": "结束"
}
diff --git a/wger/core/static/react/main.js b/wger/core/static/react/main.js
index 74a462f9d..ad3300cb8 100644
--- a/wger/core/static/react/main.js
+++ b/wger/core/static/react/main.js
@@ -501,4 +501,4 @@ ${te.current.stack}
-moz-user-select: none;
-ms-user-select: none;
overflow-anchor: none;
- `}}];return{always:Ob(a,"always"),resting:Ob(a,"resting"),dragging:Ob(a,"dragging"),dropAnimating:Ob(a,"dropAnimating"),userCancel:Ob(a,"userCancel")}};const Ga=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?w.useLayoutEffect:w.useEffect,k$=()=>{const e=document.querySelector("head");return e||vt(),e},NX=e=>{const t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.type="text/css",t};function $0t(e,t){const n=Vn(()=>_0t(e),[e]),r=w.useRef(null),o=w.useRef(null),i=Wt(Yo(d=>{const f=o.current;f||vt(),f.textContent=d}),[]),a=Wt(d=>{const f=r.current;f||vt(),f.textContent=d},[]);Ga(()=>{!r.current&&!o.current||vt();const d=NX(t),f=NX(t);return r.current=d,o.current=f,d.setAttribute(`${sy}-always`,e),f.setAttribute(`${sy}-dynamic`,e),k$().appendChild(d),k$().appendChild(f),a(n.always),i(n.resting),()=>{const h=g=>{const y=g.current;y||vt(),k$().removeChild(y),g.current=null};h(r),h(o)}},[t,a,i,n.always,n.resting,e]);const s=Wt(()=>i(n.dragging),[i,n.dragging]),l=Wt(d=>{if(d==="DROP"){i(n.dropAnimating);return}i(n.userCancel)},[i,n.dropAnimating,n.userCancel]),c=Wt(()=>{o.current&&i(n.resting)},[i,n.resting]);return Vn(()=>({dragging:s,dropping:l,resting:c}),[s,l,c])}function Rde(e,t){return Array.from(e.querySelectorAll(t))}var Dde=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView?e.ownerDocument.defaultView:window;function dO(e){return e instanceof Dde(e).HTMLElement}function N0t(e,t){const n=`[${ly.contextId}="${e}"]`,r=Rde(document,n);if(!r.length)return null;const o=r.find(i=>i.getAttribute(ly.draggableId)===t);return!o||!dO(o)?null:o}function L0t(e){const t=w.useRef({}),n=w.useRef(null),r=w.useRef(null),o=w.useRef(!1),i=Wt(function(f,h){const g={id:f,focus:h};return t.current[f]=g,function(){const v=t.current;v[f]!==g&&delete v[f]}},[]),a=Wt(function(f){const h=N0t(e,f);h&&h!==document.activeElement&&h.focus()},[e]),s=Wt(function(f,h){n.current===f&&(n.current=h)},[]),l=Wt(function(){r.current||o.current&&(r.current=requestAnimationFrame(()=>{r.current=null;const f=n.current;f&&a(f)}))},[a]),c=Wt(function(f){n.current=null;const h=document.activeElement;h&&h.getAttribute(ly.draggableId)===f&&(n.current=f)},[]);return Ga(()=>(o.current=!0,function(){o.current=!1;const f=r.current;f&&cancelAnimationFrame(f)}),[]),Vn(()=>({register:i,tryRecordFocus:c,tryRestoreFocusRecorded:l,tryShiftRecord:s}),[i,c,l,s])}function F0t(){const e={draggables:{},droppables:{}},t=[];function n(d){return t.push(d),function(){const h=t.indexOf(d);h!==-1&&t.splice(h,1)}}function r(d){t.length&&t.forEach(f=>f(d))}function o(d){return e.draggables[d]||null}function i(d){const f=o(d);return f||vt(),f}const a={register:d=>{e.draggables[d.descriptor.id]=d,r({type:"ADDITION",value:d})},update:(d,f)=>{const h=e.draggables[f.descriptor.id];h&&h.uniqueId===d.uniqueId&&(delete e.draggables[f.descriptor.id],e.draggables[d.descriptor.id]=d)},unregister:d=>{const f=d.descriptor.id,h=o(f);h&&d.uniqueId===h.uniqueId&&(delete e.draggables[f],e.droppables[d.descriptor.droppableId]&&r({type:"REMOVAL",value:d}))},getById:i,findById:o,exists:d=>!!o(d),getAllByType:d=>Object.values(e.draggables).filter(f=>f.descriptor.type===d)};function s(d){return e.droppables[d]||null}function l(d){const f=s(d);return f||vt(),f}const c={register:d=>{e.droppables[d.descriptor.id]=d},unregister:d=>{const f=s(d.descriptor.id);f&&d.uniqueId===f.uniqueId&&delete e.droppables[d.descriptor.id]},getById:l,findById:s,exists:d=>!!s(d),getAllByType:d=>Object.values(e.droppables).filter(f=>f.descriptor.type===d)};function u(){e.draggables={},e.droppables={},t.length=0}return{draggable:a,droppable:c,subscribe:n,clean:u}}function j0t(){const e=Vn(F0t,[]);return w.useEffect(()=>function(){e.clean()},[e]),e}var vV=X.createContext(null),ZP=()=>{const e=document.body;return e||vt(),e};const B0t={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"},z0t=e=>`rfd-announcement-${e}`;function V0t(e){const t=Vn(()=>z0t(e),[e]),n=w.useRef(null);return w.useEffect(function(){const i=document.createElement("div");return n.current=i,i.id=t,i.setAttribute("aria-live","assertive"),i.setAttribute("aria-atomic","true"),YP(i.style,B0t),ZP().appendChild(i),function(){setTimeout(function(){const l=ZP();l.contains(i)&&l.removeChild(i),i===n.current&&(n.current=null)})}},[t]),Wt(o=>{const i=n.current;if(i){i.textContent=o;return}},[])}const H0t={separator:"::"};function bV(e,t=H0t){const n=X.useId();return Vn(()=>`${e}${t.separator}${n}`,[t.separator,e,n])}function U0t({contextId:e,uniqueId:t}){return`rfd-hidden-text-${e}-${t}`}function W0t({contextId:e,text:t}){const n=bV("hidden-text",{separator:"-"}),r=Vn(()=>U0t({contextId:e,uniqueId:n}),[n,e]);return w.useEffect(function(){const i=document.createElement("div");return i.id=r,i.textContent=t,i.style.display="none",ZP().appendChild(i),function(){const s=ZP();s.contains(i)&&s.removeChild(i)}},[r,t]),r}var fO=X.createContext(null);function _de(e){const t=w.useRef(e);return w.useEffect(()=>{t.current=e}),t}function G0t(){let e=null;function t(){return!!e}function n(a){return a===e}function r(a){e&&vt();const s={abandon:a};return e=s,s}function o(){e||vt(),e=null}function i(){e&&(e.abandon(),o())}return{isClaimed:t,isActive:n,claim:r,release:o,tryAbandon:i}}function qx(e){return e.phase==="IDLE"||e.phase==="DROP_ANIMATING"?!1:e.isDragging}const q0t=9,K0t=13,wV=27,$de=32,Y0t=33,Q0t=34,X0t=35,J0t=36,Z0t=37,eSt=38,tSt=39,nSt=40,rSt={[K0t]:!0,[q0t]:!0};var Nde=e=>{rSt[e.keyCode]&&e.preventDefault()};const pO=(()=>{const e="visibilitychange";return typeof document>"u"?e:[e,`ms${e}`,`webkit${e}`,`moz${e}`,`o${e}`].find(r=>`on${r}`in document)||e})(),Lde=0,LX=5;function oSt(e,t){return Math.abs(t.x-e.x)>=LX||Math.abs(t.y-e.y)>=LX}const FX={type:"IDLE"};function iSt({cancel:e,completed:t,getPhase:n,setPhase:r}){return[{eventName:"mousemove",fn:o=>{const{button:i,clientX:a,clientY:s}=o;if(i!==Lde)return;const l={x:a,y:s},c=n();if(c.type==="DRAGGING"){o.preventDefault(),c.actions.move(l);return}c.type!=="PENDING"&&vt();const u=c.point;if(!oSt(u,l))return;o.preventDefault();const d=c.actions.fluidLift(l);r({type:"DRAGGING",actions:d})}},{eventName:"mouseup",fn:o=>{const i=n();if(i.type!=="DRAGGING"){e();return}o.preventDefault(),i.actions.drop({shouldBlockNextClick:!0}),t()}},{eventName:"mousedown",fn:o=>{n().type==="DRAGGING"&&o.preventDefault(),e()}},{eventName:"keydown",fn:o=>{if(n().type==="PENDING"){e();return}if(o.keyCode===wV){o.preventDefault(),e();return}Nde(o)}},{eventName:"resize",fn:e},{eventName:"scroll",options:{passive:!0,capture:!1},fn:()=>{n().type==="PENDING"&&e()}},{eventName:"webkitmouseforcedown",fn:o=>{const i=n();if(i.type==="IDLE"&&vt(),i.actions.shouldRespectForcePress()){e();return}o.preventDefault()}},{eventName:pO,fn:e}]}function aSt(e){const t=w.useRef(FX),n=w.useRef(Kd),r=Vn(()=>({eventName:"mousedown",fn:function(d){if(d.defaultPrevented||d.button!==Lde||d.ctrlKey||d.metaKey||d.shiftKey||d.altKey)return;const f=e.findClosestDraggableId(d);if(!f)return;const h=e.tryGetLock(f,a,{sourceEvent:d});if(!h)return;d.preventDefault();const g={x:d.clientX,y:d.clientY};n.current(),c(h,g)}}),[e]),o=Vn(()=>({eventName:"webkitmouseforcewillbegin",fn:u=>{if(u.defaultPrevented)return;const d=e.findClosestDraggableId(u);if(!d)return;const f=e.findOptionsForDraggable(d);f&&(f.shouldRespectForcePress||e.canGetLock(d)&&u.preventDefault())}}),[e]),i=Wt(function(){const d={passive:!1,capture:!0};n.current=$s(window,[o,r],d)},[o,r]),a=Wt(()=>{t.current.type!=="IDLE"&&(t.current=FX,n.current(),i())},[i]),s=Wt(()=>{const u=t.current;a(),u.type==="DRAGGING"&&u.actions.cancel({shouldBlockNextClick:!0}),u.type==="PENDING"&&u.actions.abort()},[a]),l=Wt(function(){const d={capture:!0,passive:!1},f=iSt({cancel:s,completed:a,getPhase:()=>t.current,setPhase:h=>{t.current=h}});n.current=$s(window,f,d)},[s,a]),c=Wt(function(d,f){t.current.type!=="IDLE"&&vt(),t.current={type:"PENDING",point:f,actions:d},l()},[l]);Ga(function(){return i(),function(){n.current()}},[i])}function sSt(){}const lSt={[Q0t]:!0,[Y0t]:!0,[J0t]:!0,[X0t]:!0};function cSt(e,t){function n(){t(),e.cancel()}function r(){t(),e.drop()}return[{eventName:"keydown",fn:o=>{if(o.keyCode===wV){o.preventDefault(),n();return}if(o.keyCode===$de){o.preventDefault(),r();return}if(o.keyCode===nSt){o.preventDefault(),e.moveDown();return}if(o.keyCode===eSt){o.preventDefault(),e.moveUp();return}if(o.keyCode===tSt){o.preventDefault(),e.moveRight();return}if(o.keyCode===Z0t){o.preventDefault(),e.moveLeft();return}if(lSt[o.keyCode]){o.preventDefault();return}Nde(o)}},{eventName:"mousedown",fn:n},{eventName:"mouseup",fn:n},{eventName:"click",fn:n},{eventName:"touchstart",fn:n},{eventName:"resize",fn:n},{eventName:"wheel",fn:n,options:{passive:!0}},{eventName:pO,fn:n}]}function uSt(e){const t=w.useRef(sSt),n=Vn(()=>({eventName:"keydown",fn:function(i){if(i.defaultPrevented||i.keyCode!==$de)return;const a=e.findClosestDraggableId(i);if(!a)return;const s=e.tryGetLock(a,u,{sourceEvent:i});if(!s)return;i.preventDefault();let l=!0;const c=s.snapLift();t.current();function u(){l||vt(),l=!1,t.current(),r()}t.current=$s(window,cSt(c,u),{capture:!0,passive:!1})}}),[e]),r=Wt(function(){const i={passive:!1,capture:!0};t.current=$s(window,[n],i)},[n]);Ga(function(){return r(),function(){t.current()}},[r])}const M$={type:"IDLE"},dSt=120,fSt=.15;function pSt({cancel:e,getPhase:t}){return[{eventName:"orientationchange",fn:e},{eventName:"resize",fn:e},{eventName:"contextmenu",fn:n=>{n.preventDefault()}},{eventName:"keydown",fn:n=>{if(t().type!=="DRAGGING"){e();return}n.keyCode===wV&&n.preventDefault(),e()}},{eventName:pO,fn:e}]}function hSt({cancel:e,completed:t,getPhase:n}){return[{eventName:"touchmove",options:{capture:!1},fn:r=>{const o=n();if(o.type!=="DRAGGING"){e();return}o.hasMoved=!0;const{clientX:i,clientY:a}=r.touches[0],s={x:i,y:a};r.preventDefault(),o.actions.move(s)}},{eventName:"touchend",fn:r=>{const o=n();if(o.type!=="DRAGGING"){e();return}r.preventDefault(),o.actions.drop({shouldBlockNextClick:!0}),t()}},{eventName:"touchcancel",fn:r=>{if(n().type!=="DRAGGING"){e();return}r.preventDefault(),e()}},{eventName:"touchforcechange",fn:r=>{const o=n();o.type==="IDLE"&&vt();const i=r.touches[0];if(!i||!(i.force>=fSt))return;const s=o.actions.shouldRespectForcePress();if(o.type==="PENDING"){s&&e();return}if(s){if(o.hasMoved){r.preventDefault();return}e();return}r.preventDefault()}},{eventName:pO,fn:e}]}function mSt(e){const t=w.useRef(M$),n=w.useRef(Kd),r=Wt(function(){return t.current},[]),o=Wt(function(h){t.current=h},[]),i=Vn(()=>({eventName:"touchstart",fn:function(h){if(h.defaultPrevented)return;const g=e.findClosestDraggableId(h);if(!g)return;const y=e.tryGetLock(g,s,{sourceEvent:h});if(!y)return;const v=h.touches[0],{clientX:x,clientY:S}=v,C={x,y:S};n.current(),d(y,C)}}),[e]),a=Wt(function(){const h={capture:!0,passive:!1};n.current=$s(window,[i],h)},[i]),s=Wt(()=>{const f=t.current;f.type!=="IDLE"&&(f.type==="PENDING"&&clearTimeout(f.longPressTimerId),o(M$),n.current(),a())},[a,o]),l=Wt(()=>{const f=t.current;s(),f.type==="DRAGGING"&&f.actions.cancel({shouldBlockNextClick:!0}),f.type==="PENDING"&&f.actions.abort()},[s]),c=Wt(function(){const h={capture:!0,passive:!1},g={cancel:l,completed:s,getPhase:r},y=$s(window,hSt(g),h),v=$s(window,pSt(g),h);n.current=function(){y(),v()}},[l,r,s]),u=Wt(function(){const h=r();h.type!=="PENDING"&&vt();const g=h.actions.fluidLift(h.point);o({type:"DRAGGING",actions:g,hasMoved:!1})},[r,o]),d=Wt(function(h,g){r().type!=="IDLE"&&vt();const y=setTimeout(u,dSt);o({type:"PENDING",point:g,actions:h,longPressTimerId:y}),c()},[c,r,o,u]);Ga(function(){return a(),function(){n.current();const g=r();g.type==="PENDING"&&(clearTimeout(g.longPressTimerId),o(M$))}},[r,a,o]),Ga(function(){return $s(window,[{eventName:"touchmove",fn:()=>{},options:{capture:!1,passive:!1}}])},[])}const gSt=["input","button","textarea","select","option","optgroup","video","audio"];function Fde(e,t){if(t==null)return!1;if(gSt.includes(t.tagName.toLowerCase()))return!0;const r=t.getAttribute("contenteditable");return r==="true"||r===""?!0:t===e?!1:Fde(e,t.parentElement)}function ySt(e,t){const n=t.target;return dO(n)?Fde(e,n):!1}var vSt=e=>Ol(e.getBoundingClientRect()).center;function bSt(e){return e instanceof Dde(e).Element}const wSt=(()=>{const e="matches";return typeof document>"u"?e:[e,"msMatchesSelector","webkitMatchesSelector"].find(r=>r in Element.prototype)||e})();function jde(e,t){return e==null?null:e[wSt](t)?e:jde(e.parentElement,t)}function xSt(e,t){return e.closest?e.closest(t):jde(e,t)}function SSt(e){return`[${ly.contextId}="${e}"]`}function CSt(e,t){const n=t.target;if(!bSt(n))return null;const r=SSt(e),o=xSt(n,r);return!o||!dO(o)?null:o}function ESt(e,t){const n=CSt(e,t);return n?n.getAttribute(ly.draggableId):null}function PSt(e,t){const n=`[${oF.contextId}="${e}"]`,o=Rde(document,n).find(i=>i.getAttribute(oF.id)===t);return!o||!dO(o)?null:o}function ISt(e){e.preventDefault()}function h1({expected:e,phase:t,isLockActive:n,shouldWarn:r}){return!(!n()||e!==t)}function Bde({lockAPI:e,store:t,registry:n,draggableId:r}){if(e.isClaimed())return!1;const o=n.draggable.findById(r);return!(!o||!o.options.isEnabled||!Ode(t.getState(),r))}function TSt({lockAPI:e,contextId:t,store:n,registry:r,draggableId:o,forceSensorStop:i,sourceEvent:a}){if(!Bde({lockAPI:e,store:n,registry:r,draggableId:o}))return null;const l=r.draggable.getById(o),c=PSt(t,l.descriptor.id);if(!c||a&&!l.options.canDragInteractiveElements&&ySt(c,a))return null;const u=e.claim(i||Kd);let d="PRE_DRAG";function f(){return l.options.shouldRespectForcePress}function h(){return e.isActive(u)}function g(E,T){h1({expected:E,phase:d,isLockActive:h,shouldWarn:!0})&&n.dispatch(T())}const y=g.bind(null,"DRAGGING");function v(E){function T(){e.release(),d="COMPLETED"}d!=="PRE_DRAG"&&(T(),vt()),n.dispatch(xxt(E.liftActionArgs)),d="DRAGGING";function O(A,k={shouldBlockNextClick:!1}){if(E.cleanup(),k.shouldBlockNextClick){const M=$s(window,[{eventName:"click",fn:ISt,options:{once:!0,passive:!1,capture:!0}}]);setTimeout(M)}T(),n.dispatch(wde({reason:A}))}return{isActive:()=>h1({expected:"DRAGGING",phase:d,isLockActive:h,shouldWarn:!1}),shouldRespectForcePress:f,drop:A=>O("DROP",A),cancel:A=>O("CANCEL",A),...E.actions}}function x(E){const T=zx(A=>{y(()=>bde({client:A}))});return{...v({liftActionArgs:{id:o,clientSelection:E,movementMode:"FLUID"},cleanup:()=>T.cancel(),actions:{move:T}}),move:T}}function S(){const E={moveUp:()=>y(Mxt),moveRight:()=>y(Rxt),moveDown:()=>y(Axt),moveLeft:()=>y(Dxt)};return v({liftActionArgs:{id:o,clientSelection:vSt(c),movementMode:"SNAP"},cleanup:Kd,actions:E})}function C(){h1({expected:"PRE_DRAG",phase:d,isLockActive:h,shouldWarn:!0})&&e.release()}return{isActive:()=>h1({expected:"PRE_DRAG",phase:d,isLockActive:h,shouldWarn:!1}),shouldRespectForcePress:f,fluidLift:x,snapLift:S,abort:C}}const OSt=[aSt,uSt,mSt];function kSt({contextId:e,store:t,registry:n,customSensors:r,enableDefaultSensors:o}){const i=[...o?OSt:[],...r||[]],a=w.useState(()=>G0t())[0],s=Wt(function(v,x){qx(v)&&!qx(x)&&a.tryAbandon()},[a]);Ga(function(){let v=t.getState();return t.subscribe(()=>{const S=t.getState();s(v,S),v=S})},[a,t,s]),Ga(()=>a.tryAbandon,[a.tryAbandon]);const l=Wt(y=>Bde({lockAPI:a,registry:n,store:t,draggableId:y}),[a,n,t]),c=Wt((y,v,x)=>TSt({lockAPI:a,registry:n,contextId:e,store:t,draggableId:y,forceSensorStop:v||null,sourceEvent:x&&x.sourceEvent?x.sourceEvent:null}),[e,a,n,t]),u=Wt(y=>ESt(e,y),[e]),d=Wt(y=>{const v=n.draggable.findById(y);return v?v.options:null},[n.draggable]),f=Wt(function(){a.isClaimed()&&(a.tryAbandon(),t.getState().phase!=="IDLE"&&t.dispatch(dV()))},[a,t]),h=Wt(()=>a.isClaimed(),[a]),g=Vn(()=>({canGetLock:l,tryGetLock:c,findClosestDraggableId:u,findOptionsForDraggable:d,tryReleaseLock:f,isLockClaimed:h}),[l,c,u,d,f,h]);for(let y=0;y<i.length;y++)i[y](g)}const MSt=e=>({onBeforeCapture:t=>{const n=()=>{e.onBeforeCapture&&e.onBeforeCapture(t)};u0.flushSync(n)},onBeforeDragStart:e.onBeforeDragStart,onDragStart:e.onDragStart,onDragEnd:e.onDragEnd,onDragUpdate:e.onDragUpdate}),ASt=e=>({...Gx,...e.autoScrollerOptions,durationDampening:{...Gx.durationDampening,...e.autoScrollerOptions}});function kb(e){return e.current||vt(),e.current}function RSt(e){const{contextId:t,setCallbacks:n,sensors:r,nonce:o,dragHandleUsageInstructions:i}=e,a=w.useRef(null),s=_de(e),l=Wt(()=>MSt(s.current),[s]),c=Wt(()=>ASt(s.current),[s]),u=V0t(t),d=W0t({contextId:t,text:i}),f=$0t(t,o),h=Wt(M=>{kb(a).dispatch(M)},[]),g=Vn(()=>uX({publishWhileDragging:Cxt,updateDroppableScroll:Pxt,updateDroppableIsEnabled:Ixt,updateDroppableIsCombineEnabled:Txt,collectionStarting:Ext},h),[h]),y=j0t(),v=Vn(()=>p0t(y,g),[y,g]),x=Vn(()=>M0t({scrollWindow:h0t,scrollDroppable:v.scrollDroppable,getAutoScrollerOptions:c,...uX({move:bde},h)}),[v.scrollDroppable,h,c]),S=L0t(t),C=Vn(()=>c0t({announce:u,autoScroller:x,dimensionMarshal:v,focusMarshal:S,getResponders:l,styleMarshal:f}),[u,x,v,S,l,f]);a.current=C;const I=Wt(()=>{const M=kb(a);M.getState().phase!=="IDLE"&&M.dispatch(dV())},[]),E=Wt(()=>{const M=kb(a).getState();return M.phase==="DROP_ANIMATING"?!0:M.phase==="IDLE"?!1:M.isDragging},[]),T=Vn(()=>({isDragging:E,tryAbort:I}),[E,I]);n(T);const O=Wt(M=>Ode(kb(a).getState(),M),[]),A=Wt(()=>rp(kb(a).getState()),[]),k=Vn(()=>({marshal:v,focus:S,contextId:t,canLift:O,isMovementAllowed:A,dragHandleUsageInstructionsId:d,registry:y}),[t,v,d,S,O,A,y]);return kSt({contextId:t,store:C,registry:y,customSensors:r||null,enableDefaultSensors:e.enableDefaultSensors!==!1}),w.useEffect(()=>I,[I]),X.createElement(fO.Provider,{value:k},X.createElement(iwt,{context:vV,store:C},e.children))}function DSt(){return X.useId()}function zde(e){const t=DSt(),n=e.dragHandleUsageInstructions||G1.dragHandleUsageInstructions;return X.createElement(uwt,null,r=>X.createElement(RSt,{nonce:e.nonce,contextId:t,setCallbacks:r,dragHandleUsageInstructions:n,enableDefaultSensors:e.enableDefaultSensors,sensors:e.sensors,onBeforeCapture:e.onBeforeCapture,onBeforeDragStart:e.onBeforeDragStart,onDragStart:e.onDragStart,onDragUpdate:e.onDragUpdate,onDragEnd:e.onDragEnd,autoScrollerOptions:e.autoScrollerOptions},e.children))}const jX={dragging:5e3,dropAnimating:4500},_St=(e,t)=>t?Iw.drop(t.duration):e?Iw.snap:Iw.fluid,$St=(e,t)=>{if(e)return t?Wx.opacity.drop:Wx.opacity.combining},NSt=e=>e.forceShouldAnimate!=null?e.forceShouldAnimate:e.mode==="SNAP";function LSt(e){const n=e.dimension.client,{offset:r,combineWith:o,dropping:i}=e,a=!!o,s=NSt(e),l=!!i,c=l?nF.drop(r,a):nF.moveTo(r);return{position:"fixed",top:n.marginBox.top,left:n.marginBox.left,boxSizing:"border-box",width:n.borderBox.width,height:n.borderBox.height,transition:_St(s,i),transform:c,opacity:$St(a,l),zIndex:l?jX.dropAnimating:jX.dragging,pointerEvents:"none"}}function FSt(e){return{transform:nF.moveTo(e.offset),transition:e.shouldAnimateDisplacement?void 0:"none"}}function jSt(e){return e.type==="DRAGGING"?LSt(e):FSt(e)}function BSt(e,t,n=Qo){const r=window.getComputedStyle(t),o=t.getBoundingClientRect(),i=que(o,r),a=KP(i,n),s={client:i,tagName:t.tagName.toLowerCase(),display:r.display},l={x:i.marginBox.width,y:i.marginBox.height};return{descriptor:e,placeholder:s,displaceBy:l,client:i,page:a}}function zSt(e){const t=bV("draggable"),{descriptor:n,registry:r,getDraggableRef:o,canDragInteractiveElements:i,shouldRespectForcePress:a,isEnabled:s}=e,l=Vn(()=>({canDragInteractiveElements:i,shouldRespectForcePress:a,isEnabled:s}),[i,s,a]),c=Wt(h=>{const g=o();return g||vt(),BSt(n,g,h)},[n,o]),u=Vn(()=>({uniqueId:t,descriptor:n,options:l,getDimension:c}),[n,c,l,t]),d=w.useRef(u),f=w.useRef(!0);Ga(()=>(r.draggable.register(d.current),()=>r.draggable.unregister(d.current)),[r.draggable]),Ga(()=>{if(f.current){f.current=!1;return}const h=d.current;d.current=u,r.draggable.update(u,h)},[u,r.draggable])}var xV=X.createContext(null);function eI(e){const t=w.useContext(e);return t||vt(),t}function VSt(e){e.preventDefault()}const HSt=e=>{const t=w.useRef(null),n=Wt((T=null)=>{t.current=T},[]),r=Wt(()=>t.current,[]),{contextId:o,dragHandleUsageInstructionsId:i,registry:a}=eI(fO),{type:s,droppableId:l}=eI(xV),c=Vn(()=>({id:e.draggableId,index:e.index,type:s,droppableId:l}),[e.draggableId,e.index,s,l]),{children:u,draggableId:d,isEnabled:f,shouldRespectForcePress:h,canDragInteractiveElements:g,isClone:y,mapped:v,dropAnimationFinished:x}=e;if(!y){const T=Vn(()=>({descriptor:c,registry:a,getDraggableRef:r,canDragInteractiveElements:g,shouldRespectForcePress:h,isEnabled:f}),[c,a,r,g,h,f]);zSt(T)}const S=Vn(()=>f?{tabIndex:0,role:"button","aria-describedby":i,"data-rfd-drag-handle-draggable-id":d,"data-rfd-drag-handle-context-id":o,draggable:!1,onDragStart:VSt}:null,[o,i,d,f]),C=Wt(T=>{v.type==="DRAGGING"&&v.dropping&&T.propertyName==="transform"&&u0.flushSync(x)},[x,v]),I=Vn(()=>{const T=jSt(v),O=v.type==="DRAGGING"&&v.dropping?C:void 0;return{innerRef:n,draggableProps:{"data-rfd-draggable-context-id":o,"data-rfd-draggable-id":d,style:T,onTransitionEnd:O},dragHandleProps:S}},[o,S,d,v,C,n]),E=Vn(()=>({draggableId:c.id,type:c.type,source:{index:c.index,droppableId:c.droppableId}}),[c.droppableId,c.id,c.index,c.type]);return X.createElement(X.Fragment,null,u(I,v.snapshot,E))};var Vde=(e,t)=>e===t,Hde=e=>{const{combine:t,destination:n}=e;return n?n.droppableId:t?t.droppableId:null};const USt=e=>e.combine?e.combine.draggableId:null,WSt=e=>e.at&&e.at.type==="COMBINE"?e.at.combine.draggableId:null;function GSt(){const e=Yo((o,i)=>({x:o,y:i})),t=Yo((o,i,a=null,s=null,l=null)=>({isDragging:!0,isClone:i,isDropAnimating:!!l,dropAnimation:l,mode:o,draggingOver:a,combineWith:s,combineTargetFor:null})),n=Yo((o,i,a,s,l=null,c=null,u=null)=>({mapped:{type:"DRAGGING",dropping:null,draggingOver:l,combineWith:c,mode:i,offset:o,dimension:a,forceShouldAnimate:u,snapshot:t(i,s,l,c,null)}}));return(o,i)=>{if(qx(o)){if(o.critical.draggable.id!==i.draggableId)return null;const a=o.current.client.offset,s=o.dimensions.draggables[i.draggableId],l=Wa(o.impact),c=WSt(o.impact),u=o.forceShouldAnimate;return n(e(a.x,a.y),o.movementMode,s,i.isClone,l,c,u)}if(o.phase==="DROP_ANIMATING"){const a=o.completed;if(a.result.draggableId!==i.draggableId)return null;const s=i.isClone,l=o.dimensions.draggables[i.draggableId],c=a.result,u=c.mode,d=Hde(c),f=USt(c),g={duration:o.dropDuration,curve:pV.drop,moveTo:o.newHomeClientOffset,opacity:f?Wx.opacity.drop:null,scale:f?Wx.scale.drop:null};return{mapped:{type:"DRAGGING",offset:o.newHomeClientOffset,dimension:l,dropping:g,draggingOver:d,combineWith:f,mode:u,forceShouldAnimate:null,snapshot:t(u,s,d,f,g)}}}return null}}function Ude(e=null){return{isDragging:!1,isDropAnimating:!1,isClone:!1,dropAnimation:null,mode:null,draggingOver:null,combineTargetFor:e,combineWith:null}}const qSt={mapped:{type:"SECONDARY",offset:Qo,combineTargetFor:null,shouldAnimateDisplacement:!0,snapshot:Ude(null)}};function KSt(){const e=Yo((a,s)=>({x:a,y:s})),t=Yo(Ude),n=Yo((a,s=null,l)=>({mapped:{type:"SECONDARY",offset:a,combineTargetFor:s,shouldAnimateDisplacement:l,snapshot:t(s)}})),r=a=>a?n(Qo,a,!0):null,o=(a,s,l,c)=>{const u=l.displaced.visible[a],d=!!(c.inVirtualList&&c.effected[a]),f=lO(l),h=f&&f.draggableId===a?s:null;if(!u){if(!d)return r(h);if(l.displaced.invisible[a])return null;const v=lv(c.displacedBy.point),x=e(v.x,v.y);return n(x,h,!0)}if(d)return r(h);const g=l.displacedBy.point,y=e(g.x,g.y);return n(y,h,u.shouldAnimate)};return(a,s)=>{if(qx(a))return a.critical.draggable.id===s.draggableId?null:o(s.draggableId,a.critical.draggable.id,a.impact,a.afterCritical);if(a.phase==="DROP_ANIMATING"){const l=a.completed;return l.result.draggableId===s.draggableId?null:o(s.draggableId,l.result.draggableId,l.impact,l.afterCritical)}return null}}const YSt=()=>{const e=GSt(),t=KSt();return(r,o)=>e(r,o)||t(r,o)||qSt},QSt={dropAnimationFinished:xde},XSt=Gue(YSt,QSt,null,{context:vV,areStatePropsEqual:Vde})(HSt);function Wde(e){return eI(xV).isUsingCloneFor===e.draggableId&&!e.isClone?null:X.createElement(XSt,e)}function Gde(e){const t=typeof e.isDragDisabled=="boolean"?!e.isDragDisabled:!0,n=!!e.disableInteractiveElementBlocking,r=!!e.shouldRespectForcePress;return X.createElement(Wde,YP({},e,{isClone:!1,isEnabled:t,canDragInteractiveElements:n,shouldRespectForcePress:r}))}const qde=e=>t=>e===t,JSt=qde("scroll"),ZSt=qde("auto"),BX=(e,t)=>t(e.overflowX)||t(e.overflowY),eCt=e=>{const t=window.getComputedStyle(e),n={overflowX:t.overflowX,overflowY:t.overflowY};return BX(n,JSt)||BX(n,ZSt)},tCt=()=>!1,Kde=e=>e==null?null:e===document.body?tCt()?e:null:e===document.documentElement?null:eCt(e)?e:Kde(e.parentElement);var iF=e=>({x:e.scrollLeft,y:e.scrollTop});const Yde=e=>e?window.getComputedStyle(e).position==="fixed"?!0:Yde(e.parentElement):!1;var nCt=e=>{const t=Kde(e),n=Yde(e);return{closestScrollable:t,isFixedOnPage:n}},rCt=({descriptor:e,isEnabled:t,isCombineEnabled:n,isFixedOnPage:r,direction:o,client:i,page:a,closest:s})=>{const l=(()=>{if(!s)return null;const{scrollSize:f,client:h}=s,g=Pde({scrollHeight:f.scrollHeight,scrollWidth:f.scrollWidth,height:h.paddingBox.height,width:h.paddingBox.width});return{pageMarginBox:s.page.marginBox,frameClient:h,scrollSize:f,shouldClipSubject:s.shouldClipSubject,scroll:{initial:s.scroll,current:s.scroll,max:g,diff:{value:Qo,displacement:Qo}}}})(),c=o==="vertical"?aV:ode,u=ay({page:a,withPlaceholder:null,axis:c,frame:l});return{descriptor:e,isCombineEnabled:n,isFixedOnPage:r,axis:c,isEnabled:t,client:i,page:a,frame:l,subject:u}};const oCt=(e,t)=>{const n=Kue(e);if(!t||e!==t)return n;const r=n.paddingBox.top-t.scrollTop,o=n.paddingBox.left-t.scrollLeft,i=r+t.scrollHeight,a=o+t.scrollWidth,l=nV({top:r,right:a,bottom:i,left:o},n.border);return rV({borderBox:l,margin:n.margin,border:n.border,padding:n.padding})};var iCt=({ref:e,descriptor:t,env:n,windowScroll:r,direction:o,isDropDisabled:i,isCombineEnabled:a,shouldClipSubject:s})=>{const l=n.closestScrollable,c=oCt(e,l),u=KP(c,r),d=(()=>{if(!l)return null;const h=Kue(l),g={scrollHeight:l.scrollHeight,scrollWidth:l.scrollWidth};return{client:h,page:KP(h,r),scroll:iF(l),scrollSize:g,shouldClipSubject:s}})();return rCt({descriptor:t,isEnabled:!i,isCombineEnabled:a,isFixedOnPage:n.isFixedOnPage,direction:o,client:c,page:u,closest:d})};const aCt={passive:!1},sCt={passive:!0};var zX=e=>e.shouldPublishImmediately?aCt:sCt;const m1=e=>e&&e.env.closestScrollable||null;function lCt(e){const t=w.useRef(null),n=eI(fO),r=bV("droppable"),{registry:o,marshal:i}=n,a=_de(e),s=Vn(()=>({id:e.droppableId,type:e.type,mode:e.mode}),[e.droppableId,e.mode,e.type]),l=w.useRef(s),c=Vn(()=>Yo((I,E)=>{t.current||vt();const T={x:I,y:E};i.updateDroppableScroll(s.id,T)}),[s.id,i]),u=Wt(()=>{const I=t.current;return!I||!I.env.closestScrollable?Qo:iF(I.env.closestScrollable)},[]),d=Wt(()=>{const I=u();c(I.x,I.y)},[u,c]),f=Vn(()=>zx(d),[d]),h=Wt(()=>{const I=t.current,E=m1(I);if(I&&E||vt(),I.scrollOptions.shouldPublishImmediately){d();return}f()},[f,d]),g=Wt((I,E)=>{t.current&&vt();const T=a.current,O=T.getDroppableRef();O||vt();const A=nCt(O),k={ref:O,descriptor:s,env:A,scrollOptions:E};t.current=k;const M=iCt({ref:O,descriptor:s,env:A,windowScroll:I,direction:T.direction,isDropDisabled:T.isDropDisabled,isCombineEnabled:T.isCombineEnabled,shouldClipSubject:!T.ignoreContainerClipping}),R=A.closestScrollable;return R&&(R.setAttribute($X.contextId,n.contextId),R.addEventListener("scroll",h,zX(k.scrollOptions))),M},[n.contextId,s,h,a]),y=Wt(()=>{const I=t.current,E=m1(I);return I&&E||vt(),iF(E)},[]),v=Wt(()=>{const I=t.current;I||vt();const E=m1(I);t.current=null,E&&(f.cancel(),E.removeAttribute($X.contextId),E.removeEventListener("scroll",h,zX(I.scrollOptions)))},[h,f]),x=Wt(I=>{const E=t.current;E||vt();const T=m1(E);T||vt(),T.scrollTop+=I.y,T.scrollLeft+=I.x},[]),S=Vn(()=>({getDimensionAndWatchScroll:g,getScrollWhileDragging:y,dragStopped:v,scroll:x}),[v,g,y,x]),C=Vn(()=>({uniqueId:r,descriptor:s,callbacks:S}),[S,s,r]);Ga(()=>(l.current=C.descriptor,o.droppable.register(C),()=>{t.current&&v(),o.droppable.unregister(C)}),[S,s,v,C,i,o.droppable]),Ga(()=>{t.current&&i.updateDroppableIsEnabled(l.current.id,!e.isDropDisabled)},[e.isDropDisabled,i]),Ga(()=>{t.current&&i.updateDroppableIsCombineEnabled(l.current.id,e.isCombineEnabled)},[e.isCombineEnabled,i])}function A$(){}const VX={width:0,height:0,margin:ywt},cCt=({isAnimatingOpenOnMount:e,placeholder:t,animate:n})=>e||n==="close"?VX:{height:t.client.borderBox.height,width:t.client.borderBox.width,margin:t.client.margin},uCt=({isAnimatingOpenOnMount:e,placeholder:t,animate:n})=>{const r=cCt({isAnimatingOpenOnMount:e,placeholder:t,animate:n});return{display:t.display,boxSizing:"border-box",width:r.width,height:r.height,marginTop:r.margin.top,marginRight:r.margin.right,marginBottom:r.margin.bottom,marginLeft:r.margin.left,flexShrink:"0",flexGrow:"0",pointerEvents:"none",transition:n!=="none"?Iw.placeholder:null}},dCt=e=>{const t=w.useRef(null),n=Wt(()=>{t.current&&(clearTimeout(t.current),t.current=null)},[]),{animate:r,onTransitionEnd:o,onClose:i,contextId:a}=e,[s,l]=w.useState(e.animate==="open");w.useEffect(()=>s?r!=="open"?(n(),l(!1),A$):t.current?A$:(t.current=setTimeout(()=>{t.current=null,l(!1)}),n):A$,[r,s,n]);const c=Wt(d=>{d.propertyName==="height"&&(o(),r==="close"&&i())},[r,i,o]),u=uCt({isAnimatingOpenOnMount:s,animate:e.animate,placeholder:e.placeholder});return X.createElement(e.placeholder.tagName,{style:u,"data-rfd-placeholder-context-id":a,onTransitionEnd:c,ref:e.innerRef})};var fCt=X.memo(dCt);class pCt extends X.PureComponent{constructor(...t){super(...t),this.state={isVisible:!!this.props.on,data:this.props.on,animate:this.props.shouldAnimate&&this.props.on?"open":"none"},this.onClose=()=>{this.state.animate==="close"&&this.setState({isVisible:!1})}}static getDerivedStateFromProps(t,n){return t.shouldAnimate?t.on?{isVisible:!0,data:t.on,animate:"open"}:n.isVisible?{isVisible:!0,data:n.data,animate:"close"}:{isVisible:!1,animate:"close",data:null}:{isVisible:!!t.on,data:t.on,animate:"none"}}render(){if(!this.state.isVisible)return null;const t={onClose:this.onClose,data:this.state.data,animate:this.state.animate};return this.props.children(t)}}const hCt=e=>{const t=w.useContext(fO);t||vt();const{contextId:n,isMovementAllowed:r}=t,o=w.useRef(null),i=w.useRef(null),{children:a,droppableId:s,type:l,mode:c,direction:u,ignoreContainerClipping:d,isDropDisabled:f,isCombineEnabled:h,snapshot:g,useClone:y,updateViewportMaxScroll:v,getContainerForClone:x}=e,S=Wt(()=>o.current,[]),C=Wt((R=null)=>{o.current=R},[]);Wt(()=>i.current,[]);const I=Wt((R=null)=>{i.current=R},[]),E=Wt(()=>{r()&&v({maxScroll:Tde()})},[r,v]);lCt({droppableId:s,type:l,mode:c,direction:u,isDropDisabled:f,isCombineEnabled:h,ignoreContainerClipping:d,getDroppableRef:S});const T=Vn(()=>X.createElement(pCt,{on:e.placeholder,shouldAnimate:e.shouldAnimatePlaceholder},({onClose:R,data:$,animate:L})=>X.createElement(fCt,{placeholder:$,onClose:R,innerRef:I,animate:L,contextId:n,onTransitionEnd:E})),[n,E,e.placeholder,e.shouldAnimatePlaceholder,I]),O=Vn(()=>({innerRef:C,placeholder:T,droppableProps:{"data-rfd-droppable-id":s,"data-rfd-droppable-context-id":n}}),[n,s,T,C]),A=y?y.dragging.draggableId:null,k=Vn(()=>({droppableId:s,type:l,isUsingCloneFor:A}),[s,A,l]);function M(){if(!y)return null;const{dragging:R,render:$}=y,L=X.createElement(Wde,{draggableId:R.draggableId,index:R.source.index,isClone:!0,isEnabled:!0,shouldRespectForcePress:!1,canDragInteractiveElements:!0},(z,N)=>$(z,N,R));return Lb.createPortal(L,x())}return X.createElement(xV.Provider,{value:k},a(O,g),M())};function mCt(){return document.body||vt(),document.body}const HX={mode:"standard",type:"DEFAULT",direction:"vertical",isDropDisabled:!1,isCombineEnabled:!1,ignoreContainerClipping:!1,renderClone:null,getContainerForClone:mCt},Qde=e=>{let t={...e},n;for(n in HX)e[n]===void 0&&(t={...t,[n]:HX[n]});return t},R$=(e,t)=>e===t.droppable.type,UX=(e,t)=>t.draggables[e.draggable.id],gCt=()=>{const e={placeholder:null,shouldAnimatePlaceholder:!0,snapshot:{isDraggingOver:!1,draggingOverWith:null,draggingFromThisWith:null,isUsingPlaceholder:!1},useClone:null},t={...e,shouldAnimatePlaceholder:!1},n=Yo(i=>({draggableId:i.id,type:i.type,source:{index:i.index,droppableId:i.droppableId}})),r=Yo((i,a,s,l,c,u)=>{const d=c.descriptor.id;if(c.descriptor.droppableId===i){const g=u?{render:u,dragging:n(c.descriptor)}:null,y={isDraggingOver:s,draggingOverWith:s?d:null,draggingFromThisWith:d,isUsingPlaceholder:!0};return{placeholder:c.placeholder,shouldAnimatePlaceholder:!1,snapshot:y,useClone:g}}if(!a)return t;if(!l)return e;const h={isDraggingOver:s,draggingOverWith:d,draggingFromThisWith:null,isUsingPlaceholder:!0};return{placeholder:c.placeholder,shouldAnimatePlaceholder:!0,snapshot:h,useClone:null}});return(i,a)=>{const s=Qde(a),l=s.droppableId,c=s.type,u=!s.isDropDisabled,d=s.renderClone;if(qx(i)){const f=i.critical;if(!R$(c,f))return t;const h=UX(f,i.dimensions),g=Wa(i.impact)===l;return r(l,u,g,g,h,d)}if(i.phase==="DROP_ANIMATING"){const f=i.completed;if(!R$(c,f.critical))return t;const h=UX(f.critical,i.dimensions);return r(l,u,Hde(f.result)===l,Wa(f.impact)===l,h,d)}if(i.phase==="IDLE"&&i.completed&&!i.shouldFlush){const f=i.completed;if(!R$(c,f.critical))return t;const h=Wa(f.impact)===l,g=!!(f.impact.at&&f.impact.at.type==="COMBINE"),y=f.critical.droppable.id===l;return h?g?e:t:y?e:t}return t}},yCt={updateViewportMaxScroll:kxt},Xde=Gue(gCt,yCt,(e,t,n)=>({...Qde(n),...e,...t}),{context:vV,areStatePropsEqual:Vde})(hCt);function vCt(e){return je("MuiLoadingButton",e)}const Xc=Be("MuiLoadingButton",["root","label","loading","loadingIndicator","loadingIndicatorCenter","loadingIndicatorStart","loadingIndicatorEnd","endIconLoadingEnd","startIconLoadingStart"]),bCt=e=>{const{loading:t,loadingPosition:n,classes:r}=e,o={root:["root",t&&"loading"],label:["label"],startIcon:[t&&`startIconLoading${we(n)}`],endIcon:[t&&`endIconLoading${we(n)}`],loadingIndicator:["loadingIndicator",t&&`loadingIndicator${we(n)}`]},i=Oe(o,vCt,r);return{...r,...i}},wCt=e=>e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"&&e!=="classes",xCt=se(at,{shouldForwardProp:e=>wCt(e)||e==="classes",name:"MuiLoadingButton",slot:"Root",overridesResolver:(e,t)=>[t.root,t.startIconLoadingStart&&{[`& .${Xc.startIconLoadingStart}`]:t.startIconLoadingStart},t.endIconLoadingEnd&&{[`& .${Xc.endIconLoadingEnd}`]:t.endIconLoadingEnd}]})(rt(({theme:e})=>({display:"inline-flex",[`& .${Xc.startIconLoadingStart}, & .${Xc.endIconLoadingEnd}`]:{transition:e.transitions.create(["opacity"],{duration:e.transitions.duration.short}),opacity:0},variants:[{props:{loadingPosition:"center"},style:{transition:e.transitions.create(["background-color","box-shadow","border-color"],{duration:e.transitions.duration.short}),[`&.${Xc.loading}`]:{color:"transparent"}}},{props:({ownerState:t})=>t.loadingPosition==="start"&&t.fullWidth,style:{[`& .${Xc.startIconLoadingStart}, & .${Xc.endIconLoadingEnd}`]:{transition:e.transitions.create(["opacity"],{duration:e.transitions.duration.short}),opacity:0,marginRight:-8}}},{props:({ownerState:t})=>t.loadingPosition==="end"&&t.fullWidth,style:{[`& .${Xc.startIconLoadingStart}, & .${Xc.endIconLoadingEnd}`]:{transition:e.transitions.create(["opacity"],{duration:e.transitions.duration.short}),opacity:0,marginLeft:-8}}}]}))),SCt=se("span",{name:"MuiLoadingButton",slot:"LoadingIndicator",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.loadingIndicator,t[`loadingIndicator${we(n.loadingPosition)}`]]}})(rt(({theme:e})=>({position:"absolute",visibility:"visible",display:"flex",variants:[{props:{loadingPosition:"start",size:"small"},style:{left:10}},{props:({loadingPosition:t,ownerState:n})=>t==="start"&&n.size!=="small",style:{left:14}},{props:{variant:"text",loadingPosition:"start"},style:{left:6}},{props:{loadingPosition:"center"},style:{left:"50%",transform:"translate(-50%)",color:(e.vars||e).palette.action.disabled}},{props:{loadingPosition:"end",size:"small"},style:{right:10}},{props:({loadingPosition:t,ownerState:n})=>t==="end"&&n.size!=="small",style:{right:14}},{props:{variant:"text",loadingPosition:"end"},style:{right:6}},{props:({ownerState:t})=>t.loadingPosition==="start"&&t.fullWidth,style:{position:"relative",left:-10}},{props:({ownerState:t})=>t.loadingPosition==="end"&&t.fullWidth,style:{position:"relative",right:-10}}]}))),WX=se("span",{name:"MuiLoadingButton",slot:"Label",overridesResolver:(e,t)=>[t.label]})({display:"inherit",alignItems:"inherit",justifyContent:"inherit"}),CCt=w.forwardRef(function(t,n){const r=w.useContext(WF),o=Xd(r,t),i=lt({props:o,name:"MuiLoadingButton"}),{children:a,disabled:s=!1,id:l,loading:c=!1,loadingIndicator:u,loadingPosition:d="center",variant:f="text",...h}=i,g=Dn(l),y=u??_.jsx(yy,{"aria-labelledby":g,color:"inherit",size:16}),v={...i,disabled:s,loading:c,loadingIndicator:y,loadingPosition:d,variant:f},x=bCt(v),S=c?_.jsx(SCt,{className:x.loadingIndicator,ownerState:v,children:y}):null;return _.jsxs(xCt,{disabled:s||c,id:g,ref:n,...h,variant:f,classes:x,ownerState:v,children:[v.loadingPosition==="end"?_.jsx(WX,{className:x.label,children:a}):S,v.loadingPosition==="end"?S:_.jsx(WX,{className:x.label,children:a})]})}),ECt=e=>{const{t}=Re(),n=trt(e.routineId),r=ort(e.routineId),[o,i]=w.useState(!1),[a,s]=w.useState(!1),[l,c]=w.useState(e.day.isRest),u=()=>{l?(c(!1),I({isRest:!1})):s(!0)},d=()=>s(!1),f=()=>{I({isRest:!l}),c(!l),s(!1)},h=()=>i(!0),g=()=>{e.setSelectedDayIndex(null),r.mutate(e.day.id),i(!1)},y=()=>i(!1),v=3,x=20,S=1e3,C=_o().shape({name:Ro().max(x,t("forms.maxLength",{chars:x})).min(v,t("forms.minLength",{chars:v})).required("Name is required"),description:Ro().max(S,t("forms.maxLength",{chars:S})),isRest:mu(),needsLogsToAdvance:mu()}),I=E=>n.mutate({id:e.day.id,routine:e.routineId,...E.name!==void 0&&{name:E.name},...E.description!==void 0&&{description:E.description},...E.isRest!==void 0&&{is_rest:l},...E.needsLogsToAdvance!==void 0&&{needs_logs_to_advance:E.needsLogsToAdvance}});return b(xt,{children:b(ci,{initialValues:{name:e.day.name,description:e.day.description,isRest:e.day.isRest,needsLogsToAdvance:e.day.needLogsToAdvance},validationSchema:C,onSubmit:(E,{setSubmitting:T})=>{I(E),T(!1)},initialTouched:{name:!0,description:!0,isRest:!0,needsLogsToAdvance:!0},children:E=>Q(Zo,{children:[Q(ye,{container:!0,spacing:2,children:[b(ye,{size:{xs:12,sm:6},children:b(Ru,{fieldName:"name",title:"Name",fieldProps:{disabled:l}})}),b(ye,{size:{xs:6,sm:2},children:b(ba,{control:b(li,{checked:l,onChange:u}),label:t("routines.restDay")})}),Q(ye,{size:{xs:6,sm:4},children:[b(ba,{disabled:l,control:b(li,{checked:E.values.needsLogsToAdvance,...E.getFieldProps("needsLogsToAdvance")}),label:t("routines.needsLogsToAdvance")}),b(Do,{title:t("routines.needsLogsToAdvanceHelpText"),children:b(on,{onClick:()=>{},children:b(Dx,{fontSize:"small"})})})]}),b(ye,{size:12,children:b(Ru,{fieldName:"description",title:"Description",fieldProps:{multiline:!0,rows:4,disabled:l}})}),Q(ye,{size:8,children:[n.isPending?b(CCt,{loading:!0,variant:"contained",color:"primary",children:t("save")}):b(at,{variant:"contained",color:"primary",type:"submit",disabled:l,children:t("save")})," ",b(at,{variant:"outlined",startIcon:b(W0,{}),onClick:h,disabled:n.isPending,children:t("delete")})]}),b(ye,{size:4,sx:{display:"flex",justifyContent:"flex-end"},children:b(Zvt,{routineId:e.routineId})})]}),Q($w,{open:a,onClose:d,children:[b(cE,{children:t("routines.confirmRestDay")}),b(Lw,{children:t("routines.confirmRestDayHelpText")}),Q(Nw,{children:[b(at,{onClick:d,children:t("cancel")}),b(at,{onClick:f,children:t("continue")})]})]}),b(aO,{title:t("deleteConfirmation",{name:e.day.getDisplayName()}),message:t("routines.deleteDayConfirmation"),isOpen:o,closeFn:y,deleteFn:g})]})})})},PCt=e=>{const{t}=Re(),n=drt(e.routineId),[r,o]=w.useState(e.slot.comment),[i,a]=w.useState(!1),s=c=>{a(!0),o(c)},l=()=>{i&&(n.mutate({id:e.slot.id,comment:r}),a(!1))};return b(xt,{children:b(tn,{label:t("comment"),variant:"standard",fullWidth:!0,size:"small",value:r,disabled:n.isPending,onChange:c=>s(c.target.value),onBlur:l,InputProps:{endAdornment:n.isPending&&b(zp,{})}})})},ICt={weight:{edit:Mnt,add:Ant,delete:Rnt},"max-weight":{edit:Dnt,add:_nt,delete:$nt},reps:{edit:Nnt,add:Lnt,delete:Fnt},"max-reps":{edit:jnt,add:vY,delete:Bnt},sets:{edit:znt,add:Vnt,delete:Hnt},"max-sets":{edit:Unt,add:Wnt,delete:vY},rest:{edit:Ynt,add:Qnt,delete:Xnt},"max-rest":{edit:Jnt,add:Znt,delete:ert},rir:{edit:nle,add:rle,delete:ole},"max-rir":{edit:Gnt,add:qnt,delete:Knt}},GX=e=>{var C,I,E,T;const{t}=Re(),{edit:n,add:r,delete:o}=ICt[e.type],i=n(e.routineId),a=r(e.routineId),s=o(e.routineId),[l,c]=w.useState(((C=e.config)==null?void 0:C.value)||""),[u,d]=w.useState(null),[f,h]=w.useState(null),g=["sets","max-sets","rir","max-rir","rest","max-rest"].includes(e.type),y=g?parseInt:parseFloat,v=O=>{const A={slot_entry:e.slotEntryId,value:y(O)};O===""?e.config&&s.mutate(e.config.id):e.config?i.mutate({id:e.config.id,...A}):a.mutate({iteration:1,operation:Li,step:"abs",requirements:null,...A})},x=O=>{if(c(O),O!==""&&Number.isNaN(y(O))){d(t(g?"forms.enterInteger":"forms.enterNumber"));return}else d(null);f&&clearTimeout(f),h(setTimeout(()=>v(O),nte))},S=i.isPending||a.isPending||s.isPending;return b(tn,{slotProps:{input:{endAdornment:S&&b(zp,{})}},inputProps:{"data-testid":`${e.type}-field`},label:e.type,value:l,fullWidth:!0,variant:"standard",disabled:S,onChange:O=>x(O.target.value),error:!!u||i.isError||a.isError||s.isError,helperText:u||((I=i.error)==null?void 0:I.message)||((E=a.error)==null?void 0:E.message)||((T=s.error)==null?void 0:T.message)})},TCt=e=>{const{setFieldValue:t}=uz(),{t:n}=Re(),r=e.disabled??!1,[o,i]=w.useState(e.values),[a,s]=X.useState(null),l=u=>{o.includes(u)?i(o.filter(d=>d!==u)):i([...o,u])},c=async()=>{await t(e.fieldName,o),s(null)};return Q(xt,{children:[b(on,{disabled:r,onClick:u=>s(u.currentTarget),children:a?b(brt,{fontSize:"small"}):b(Grt,{fontSize:"small"})}),Q(Sa,{anchorEl:a,open:!!a,onClose:()=>s(null),children:[...$2.map((u,d)=>Q(Ft,{onClick:()=>l(u),children:[b(si,{children:o.includes(u)?b(Ert,{fontSize:"small"}):b(Prt,{fontSize:"small"})}),b(uo,{children:u})]})),b(Ti,{}),b(Ft,{children:b(at,{color:"primary",variant:"contained",type:"submit",size:"small",onClick:c,children:n("save")})})]})]})},OCt=e=>{var i;const t=nle(e.routineId),n=ole(e.routineId),r=rle(e.routineId),o=a=>{const s={value:parseFloat(a)};a===""?e.config&&n.mutate(e.config.id):e.config!==void 0?t.mutate({id:e.config.id,...s}):r.mutate({slot_entry:e.slotEntryId,iteration:1,operation:Li,...s})};return b(tn,{fullWidth:!0,select:!0,label:"RiR",variant:"standard",defaultValue:"",value:(i=e.config)==null?void 0:i.value,disabled:t.isPending,onChange:a=>o(a.target.value),children:Ste.map(a=>b(Ft,{value:a.value,children:a.label},a.value))})};function kCt(e){let t="";for(;e>0;)e--,t=String.fromCharCode(97+e%26)+t,e=Math.floor(e/26);return t}const dl=(e,t,n,r)=>t.length>0?b(GX,{config:t[0],type:e,routineId:n}):b(GX,{type:e,routineId:n,slotEntryId:r}),MCt=e=>{const{t}=Re();return Q(xt,{children:[e.slot.entries.length===0&&Q(Ii,{severity:"warning",children:[b(hg,{children:t("routines.setHasNoExercises")}),t("nothingHereYetAction")]}),e.slot.entries.map((n,r)=>b(ACt,{slotEntry:n,routineId:e.routineId,simpleMode:e.simpleMode,index:r,total:e.slot.entries.length},n.id))]})},ACt=e=>{var g;const{t,i18n:n}=Re(),[r,o]=w.useState(!1),i=()=>o(!r),a=$c(),s=U0(e.routineId),l=srt(e.routineId),c=s.isPending||l.isPending,u=y=>{y!==null&&(s.mutate({id:e.slotEntry.id,exercise:y.data.base_id}),o(!1))};let d;a.isSuccess&&(d=Tu(n.language,a.data));const f=()=>e.simpleMode?Q(X.Fragment,{children:[b(ye,{size:{xs:12,sm:2},children:dl("sets",e.slotEntry.nrOfSetsConfigs,e.routineId,e.slotEntry.id)},`sets-config-${e.slotEntry.id}`),b(ye,{size:{xs:12,sm:3},children:dl("weight",e.slotEntry.weightConfigs,e.routineId,e.slotEntry.id)},`weight-config-${e.slotEntry.id}`),b(ye,{size:{xs:12,sm:3},children:dl("reps",e.slotEntry.repetitionsConfigs,e.routineId,e.slotEntry.id)},`reps-config-${e.slotEntry.id}`)]}):Q(X.Fragment,{children:[b(ye,{size:{xs:6,sm:1},children:dl("sets",e.slotEntry.nrOfSetsConfigs,e.routineId,e.slotEntry.id)}),b(ye,{size:{xs:6,sm:1},children:dl("max-sets",e.slotEntry.maxNrOfSetsConfigs,e.routineId,e.slotEntry.id)}),b(ye,{size:{xs:6,sm:2},children:b(Yvt,{routineId:e.routineId,slotEntry:e.slotEntry})}),b(ye,{size:{xs:12,sm:2},children:b(OCt,{routineId:e.routineId,config:e.slotEntry.rirConfigs.length>0?e.slotEntry.rirConfigs[0]:void 0,slotEntryId:e.slotEntry.id})}),b(ye,{size:{xs:6,sm:1},children:dl("rest",e.slotEntry.restTimeConfigs,e.routineId,e.slotEntry.id)}),b(ye,{size:{xs:6,sm:1},children:dl("max-rest",e.slotEntry.maxRestTimeConfigs,e.routineId,e.slotEntry.id)}),b(ye,{size:{xs:6,sm:2},offset:{sm:4},children:dl("weight",e.slotEntry.weightConfigs,e.routineId,e.slotEntry.id)}),b(ye,{size:{xs:6,sm:2},children:dl("max-weight",e.slotEntry.maxWeightConfigs,e.routineId,e.slotEntry.id)}),b(ye,{size:{xs:12,sm:4},children:b(Xvt,{slotEntry:e.slotEntry,routineId:e.routineId})}),b(ye,{size:{xs:6,sm:2},offset:{sm:4},children:dl("reps",e.slotEntry.repetitionsConfigs,e.routineId,e.slotEntry.id)}),b(ye,{size:{xs:6,sm:2},children:dl("max-reps",e.slotEntry.maxRepetitionsConfigs,e.routineId,e.slotEntry.id)}),b(ye,{size:{xs:12,sm:4},children:b(Qvt,{slotEntry:e.slotEntry,routineId:e.routineId})})]}),h=e.total>1?kCt(e.index+1)+") ":"";return b(X.Fragment,{children:Q(ye,{container:!0,paddingTop:1,spacing:1,children:[Q(ye,{size:{xs:3,sm:1},alignContent:"center",children:[b(on,{size:"small",onClick:i,disabled:c,children:r?b(Art,{}):b(hz,{})}),b(on,{size:"small",onClick:()=>l.mutate(e.slotEntry.id),disabled:c,children:b(kP,{})})]}),b(ye,{size:{xs:9,sm:3},alignContent:"center",children:Q(tt,{variant:"body1",children:[h," ",(g=e.slotEntry.exercise)==null?void 0:g.getTranslation(d).name]})}),r&&Q(X.Fragment,{children:[b(ye,{size:{xs:12,sm:8},children:b(ty,{callback:u})}),b(ye,{size:{xs:12,sm:4}})]}),e.slotEntry.hasProgressionRules?b(ye,{size:8,children:b(Ii,{severity:"info",variant:"standard",sx:{mt:2},children:t("routines.exerciseHasProgression")})}):f()]})})},RCt=e=>{const{t}=Re(),n=_c(e.routineId),r=nrt(e.routineId),o=rrt(e.routineId),i=u=>({background:u?"lightblue":void 0}),a=(u,d)=>({backgroundColor:"white",margin:4,...d,opacity:1}),s=()=>{e.setSelectedDayIndex(null)},l=u=>{if(!u.destination)return;const d=Array.from(n.data.days),[f]=d.splice(u.source.index,1);d.splice(u.destination.index,0,f),e.setSelectedDayIndex(u.destination.index),n.data.days=d,r.mutate(d.map((h,g)=>({id:h.id,order:g+1})))},c=async()=>{const u={routine:e.routineId,name:`${t("routines.newDay")} ${n.data.days.length+1}`,order:n.data.days.length+1,is_rest:!1,needs_logs_to_advance:!1};await o.mutateAsync(u),e.setSelectedDayIndex(n.data.days.length)};return n.isLoading?b(wr,{}):Q(ye,{container:!0,direction:"row",spacing:1,children:[b(ye,{size:12,children:b(_t,{direction:"row",children:Q(zde,{onDragEnd:l,onDragStart:s,children:[b(Xde,{droppableId:"dayDroppable",direction:"horizontal",children:(u,d)=>Q(Cee,{ref:u.innerRef,...u.droppableProps,value:e.selectedDayIndex,variant:"scrollable",scrollButtons:"auto",style:i(d.isDraggingOver),children:[n.data.days.map((f,h)=>b(Gde,{draggableId:f.id.toString(),index:h,children:(g,y)=>b(w2,{ref:g.innerRef,...g.draggableProps,...g.dragHandleProps,style:a(y.isDragging,g.draggableProps.style??{}),label:f.getDisplayName(),value:f.id,icon:b(lle,{}),iconPosition:"start",onClick:()=>e.setSelectedDayIndex(h)})},f.id)),u.placeholder]})}),b(at,{startIcon:o.isPending?b(zp,{}):b($o,{}),onClick:c,disabled:o.isPending,children:t("routines.addDay")})]})})}),n.data.days.length===0&&b(ye,{size:12,children:Q(Ii,{severity:"info",children:[b(hg,{children:t("routines.routineHasNoDays")}),t("nothingHereYetAction")]})})]})},DCt=e=>{const[t,n]=Re(),r=prt(e.routineId),o=art(e.routineId),i=urt(e.routineId),a=frt(e.routineId),s=Pa(),l=Lr(),[c,u]=w.useState(!1),[d,f]=w.useState(null),[h,g]=w.useState(null),[y,v]=w.useState(!0),x=(k,M)=>{h!==null&&(M==="timeout"?(r.mutate(h.id),g(null)):M!=="clickaway"&&(e.day.slots=[...e.day.slots,h].sort((R,$)=>R.order-$.order),g(null))),u(!1)},S=k=>{const M=e.day.slots.findIndex(R=>R.id===k);if(M!==-1){const R=[...e.day.slots],[$]=R.splice(M,1);e.day.slots=R,g($),u(!0)}},C=k=>{if(e.day.slots.find(R=>R.id===k)===void 0){console.info(`Could not find slot with id ${k} to add config`);return}f(d===k?null:k)},I=()=>i.mutate({day:e.day.id,order:e.day.slots.length+1}),E=8,T=k=>{if(!k.destination)return;const M=Array.from(e.day.slots),[R]=M.splice(k.source.index,1);M.splice(k.destination.index,0,R),a.mutate(M.map(($,L)=>({id:$.id,order:L+1}))),e.day.slots=M},O=k=>({background:k?"lightblue":void 0}),A=(k,M)=>({border:k?`1px solid ${l.palette.grey[900]}`:`1px solid ${l.palette.grey[300]}`,backgroundColor:"white",marginBottom:E,...M});return Q(xt,{children:[b(ECt,{routineId:e.routineId,day:e.day,setSelectedDayIndex:e.setSelectedDayIndex},`day-form-${e.day.id}`),!e.day.isRest&&e.day.slots.length>0&&Q(xt,{children:[b(en,{height:40}),b(ba,{control:b(li,{checked:y,onChange:()=>v(!y)}),label:t("routines.simpleMode")})]}),b(en,{height:20}),b(zde,{onDragEnd:T,children:b(Xde,{droppableId:"setDroppable",direction:"vertical",children:(k,M)=>b("div",{...k.droppableProps,ref:k.innerRef,style:O(M.isDraggingOver),children:e.day.slots.map((R,$)=>Q(X.Fragment,{children:[b(Gde,{draggableId:R.id.toString(),index:$,children:(L,z)=>Q(ye,{container:!0,padding:1,ref:L.innerRef,...L.draggableProps,style:A(z.isDragging,L.draggableProps.style??{}),children:[b(ye,{sx:{backgroundColor:l.palette.common.white},size:12,children:Q(ye,{container:!0,justifyContent:"space-between",alignItems:"center",children:[b(ye,{children:Q(tt,{variant:"h6",children:[b(on,{...L.dragHandleProps,children:b(lle,{})}),b(on,{onClick:()=>S(R.id),children:b(W0,{})}),R.entries.length>1?t("routines.supersetNr",{number:$+1}):t("routines.exerciseNr",{number:$+1})]})}),b(ye,{children:R.entries.length>0&&Q(GF,{variant:"outlined",children:[b(at,{onClick:()=>C(R.id),size:"small",disabled:o.isPending,startIcon:o.isPending?b(zp,{}):b($o,{}),children:t("routines.addSuperset")}),R.entries.length>0&&b(at,{startIcon:b(Krt,{}),component:io,size:"small",to:Qt(Kt.ROUTINE_EDIT_PROGRESSION,n.language,{id:e.routineId,id2:R.id}),children:t("routines.editProgression")})]})})]})}),!y&&Q(ye,{size:12,children:[b(PCt,{routineId:e.routineId,slot:R},`slot-form-${R.id}`),b(en,{height:10})]}),b(ye,{size:12,children:b(MCt,{slot:R,routineId:e.routineId,simpleMode:y})}),(d===R.id||R.entries.length===0)&&Q(ye,{size:12,children:[b(en,{height:20}),b(ty,{callback:N=>{N!==null&&(o.mutate({slot:R.id,exercise:N.data.base_id,type:"normal",order:R.entries.length+1,weight_unit:s.data.useMetric?Nke:Lke}),f(null))}})]})]})},R.id),b(en,{height:0,children:k.placeholder})]},`slot-${R.id}-${$}`))})})}),b(II,{open:c,autoHideDuration:NI,onClose:x,children:b(Ii,{severity:"success",variant:"filled",sx:{width:"100%"},action:b(at,{color:"warning",variant:"contained",size:"small",onClick:x,children:t("undo")}),children:"Set successfully deleted"})}),!e.day.isRest&&b(at,{variant:"contained",color:"primary",startIcon:i.isPending?b(zp,{}):b($o,{}),onClick:I,children:t("routines.addExercise")})]})},_Ct=()=>{var c;const{t:e,i18n:t}=Re(),n=Lr(),r=Pa(),o=Ea(),i=o.routineId?parseInt(o.routineId):0,a=_c(i),[s,l]=w.useState(null);return a.isLoading||r.isLoading?b(wr,{}):a.isError?Q("p",{children:["Error: ",a.error.message]}):(s===null&&a.data.days.length>0&&l(0),Q(J0,{title:e("editName",{name:(c=a.data)==null?void 0:c.name}),backToUrl:Qt(Kt.ROUTINE_DETAIL,t.language,{id:i}),children:[Q(ye,{container:!0,children:[b(ye,{size:12,children:b(Zz,{routine:a.data})}),Q(ye,{size:12,children:[b(en,{height:20}),b(RCt,{routineId:i,selectedDayIndex:s,setSelectedDayIndex:l})]}),s!==null&&b(xt,{children:b(ye,{size:12,sx:{backgroundColor:n.palette.grey[100],padding:1},children:b(en,{children:b(DCt,{day:a.data.days[s],routineId:i,setSelectedDayIndex:l})})})})]}),a.data.days.length>0&&Q(_t,{spacing:2,sx:{mt:2},children:[b(en,{height:40}),b(tt,{variant:"h4",children:e("routines.resultingRoutine")}),b(Ti,{}),Q(en,{children:[b(Eit,{}),b(en,{height:20}),b(Fue,{routine:a.data})]})]})]}))},$Ct=({initialSession:e,dayId:t,routineId:n,selectedDate:r,setSelectedDate:o})=>{let i;const[a,s]=Re(),[l,c]=X.useState(e),u=mrt(),d=grt(l==null?void 0:l.id),f=hrt(n,{routine:n,date:co(r.toJSDate()),day:t}),h=u.isPending||d.isPending||f.isLoading,g=_o({notes:Ro().max(y3,a("forms.maxLength",{chars:y3})),date:wc().required(),start:wc().nullable(),end:wc().nullable().min(dz("start"),a("forms.endBeforeStart")),fitInWeek:mu()});return w.useEffect(()=>{f.data?(i.setValues({notes:f.data.notes||"",impression:f.data.impression||ib,date:f.data.date,start:f.data.timeStart?yt.fromJSDate(f.data.timeStart):null,end:f.data.timeEnd?yt.fromJSDate(f.data.timeEnd):null}),c(f.data)):f.isSuccess&&!f.data&&(i.setValues({notes:"",impression:ib,date:(e==null?void 0:e.date)||yt.now().toJSDate(),start:e!=null&&e.timeStart?yt.fromJSDate(e.timeStart):null,end:e!=null&&e.timeEnd?yt.fromJSDate(e.timeEnd):null}),c(void 0))},[f.data,f.isSuccess,e,r]),b(ci,{enableReinitialize:!0,initialValues:{notes:l!==void 0?l.notes:"",date:l!==void 0?l.date:new Date,start:l!==void 0&&l.timeStart!==null?yt.fromJSDate(l.timeStart):null,end:l!==void 0&&l.timeEnd!==null?yt.fromJSDate(l.timeEnd):null,impression:l!==void 0?l.impression:ib},innerRef:y=>i=y,validationSchema:g,onSubmit:async y=>{const v={day:t,routine:n,date:co(r.toJSDate()),notes:y.notes,impression:y.impression,time_start:y.start?Bw(y.start.toJSDate()):null,time_end:y.end?Bw(y.end.toJSDate()):null};l!==void 0?await d.mutateAsync({...v,id:l.id}):await u.mutateAsync(v)},children:y=>b(Zo,{children:Q(ye,{container:!0,spacing:2,children:[b(ye,{size:{xs:12,sm:6},children:b(vc,{dateAdapter:pu,adapterLocale:s.language,children:b(kx,{value:r,defaultValue:yt.now(),label:a("date"),onChange:v=>{v&&(y.setFieldValue("date",v),o(v))},disableFuture:!0,slotProps:{textField:{variant:"standard",fullWidth:!0,error:y.touched.date&&!!y.errors.date}}})})}),b(ye,{size:{xs:6,sm:3},children:b(vc,{dateAdapter:pu,adapterLocale:s.language,children:b(vL,{label:a("start"),...y.getFieldProps("start"),onChange:v=>{v&&y.setFieldValue("start",v)},slotProps:{textField:{variant:"standard",fullWidth:!0,error:y.touched.start&&!!y.errors.start,helperText:y.touched.start&&y.errors.start}}})})}),b(ye,{size:{xs:6,sm:3},children:b(vc,{dateAdapter:pu,adapterLocale:s.language,children:b(vL,{label:a("end"),...y.getFieldProps("end"),onChange:v=>{v&&y.setFieldValue("end",v)},slotProps:{textField:{variant:"standard",fullWidth:!0,error:y.touched.end&&!!y.errors.end,helperText:y.touched.end&&y.errors.end}}})})}),b(ye,{size:12,children:b(Ru,{fieldName:"notes",title:a("notes"),fieldProps:{multiline:!0,rows:4}})}),Q(ye,{size:12,children:[b(tt,{variant:"caption",children:a("routines.impression")}),Q(GF,{fullWidth:!0,color:"primary",children:[Q(at,{size:"small",color:"info",variant:y.values.impression===v3?"contained":"outlined",onClick:()=>y.setFieldValue("impression",v3),children:[b(Wrt,{}),a("routines.impressionBad")]}),Q(at,{size:"small",color:"info",variant:y.values.impression===ib?"contained":"outlined",onClick:()=>y.setFieldValue("impression",ib),children:[b(Hrt,{}),a("routines.impressionNeutral")]}),Q(at,{size:"small",color:"info",variant:y.values.impression===b3?"contained":"outlined",onClick:()=>y.setFieldValue("impression",b3),children:[b(Urt,{}),a("routines.impressionGood")]})]})]}),b(ye,{size:12,display:"flex",justifyContent:"end",children:b(at,{disabled:h,color:"primary",variant:"contained",type:"submit",sx:{mt:2},children:a("submit")})})]})})})},NCt=({dayId:e,routineId:t,selectedDate:n})=>{const{t:r,i18n:o}=Re(),[i,a]=w.useState(!1),s=_c(t),l=irt(t),c=$c(),u=()=>a(!1),[d,f]=w.useState(null);let h;if(c.isSuccess&&(h=Tu(o.language,c.data)),s.isLoading)return b(wr,{});const g=s.data,y=(g==null?void 0:g.getDayData(e,n.toJSDate()))??[],v=y.length===0,x=_o({logs:Dp().of(_o().shape({rir:wo().nullable(),repetitions:wo().typeError(r("forms.enterNumber")).nullable(),weight:wo().typeError(r("forms.enterNumber")).nullable()}))}),S=async T=>{const O=v?null:y[0].iteration,A=T.logs.filter(k=>k.rir!==""||k.repetitions!==""||k.weight!=="").map(k=>{var M,R,$;return{date:n.toISO(),iteration:O,exercise:(M=k.exercise)==null?void 0:M.id,day:e,routine:t,slot_entry:k.slotEntry,rir:k.rir!==""?k.rir:null,rir_target:k.rirTarget!==""?k.rirTarget:null,repetitions_unit:(R=k.repetitionsUnit)==null?void 0:R.id,repetitions:k.repetitions!==""?k.repetitions:null,repetitions_target:k.repetitionsTarget!==""?k.repetitionsTarget:null,weight_unit:($=k.weightUnit)==null?void 0:$.id,weight:k.weight!==""?k.weight:null,weight_target:k.weightTarget!==""?k.weightTarget:null}});await l.mutateAsync(A),a(!0)},C=async(T,O)=>{if(T===null)return;const A=O.values.logs.map(k=>d===k.exercise.id?{...k,weight:"",weightTarget:"",repetitions:"",repetitionsTarget:"",rir:"",rirTarget:"",exercise:T.exercise}:k);await O.setValues({...O.values,logs:A}),f(null)},I={logs:[]},E=v?g.dayDataCurrentIteration.filter(T=>T.day.id===e):y;for(const T of E)for(const O of T.slots)for(const A of O.setConfigs)for(let k=0;k<A.nrOfSets;k++)I.logs.push({exercise:A.exercise,repetitionsUnit:A.repetitionsUnit,weightUnit:A.weightUnit,slotEntry:A.slotEntryId,rir:!v&&A.rir!==null?A.rir:"",rirTarget:!v&&A.rir!==null?A.rir:"",repetitions:!v&&A.repetitions!==null?A.repetitions:"",repetitionsTarget:!v&&A.repetitions!==null?A.repetitions:"",weight:!v&&A.weight!==null?A.weight:"",weightTarget:!v&&A.weight!==null?A.weight:""});return Q(xt,{children:[v&&b(Ii,{severity:"info",sx:{marginTop:2},children:r("routines.weightLogNotPlanned")}),b(ci,{enableReinitialize:!0,initialValues:I,validationSchema:x,onSubmit:S,children:T=>Q(Zo,{children:[b(jse,{name:"logs",children:({insert:O,remove:A,push:k})=>b(xt,{children:T.values.logs.map((M,R)=>{var $,L,z,N;return Q(ye,{container:!0,spacing:1,sx:{mt:2},children:[(R===0||R>0&&T.values.logs[R-1].exercise.id!=T.values.logs[R].exercise.id)&&Q(xt,{children:[Q(ye,{size:12,children:[d!==T.values.logs[R].exercise.id&&b(tt,{variant:"h6",children:($=T.values.logs[R].exercise)==null?void 0:$.getTranslation(h).name}),d===T.values.logs[R].exercise.id&&b(ty,{loadExercise:!0,callback:B=>C(B,T)})]}),Q(ye,{size:12,children:[Q(at,{type:"button",size:"small",onClick:()=>O(R,{exercise:T.values.logs[R].exercise,repetitions:T.values.logs[R].repetitions,weight:T.values.logs[R].weight}),children:[b($o,{}),r("routines.addAdditionalLog")]}),Q(at,{type:"button",size:"small",onClick:()=>{d===T.values.logs[R].exercise.id?f(null):f(T.values.logs[R].exercise.id)},children:[b(Yrt,{}),r("exercises.swapExercise")]}),Q(at,{type:"button",size:"small",onClick:async()=>await T.setValues({...T.values,logs:T.values.logs.filter(B=>B.exercise.id!==T.values.logs[R].exercise.id)}),children:[b(kP,{}),r("delete")]})]})]}),b(ye,{size:4,children:b(Ru,{fieldName:`logs.${R}.repetitions`,title:r("server.repetitions"),fieldProps:{slotProps:{input:{endAdornment:b(ro,{position:"end",children:((L=T.values.logs[R].repetitionsUnit)==null?void 0:L.id)!==$ke?b(tt,{variant:"caption",children:(z=T.values.logs[R].repetitionsUnit)==null?void 0:z.name}):null})}}}})}),b(ye,{size:4,children:b(Ru,{fieldName:`logs.${R}.weight`,title:r("weight"),fieldProps:{slotProps:{input:{endAdornment:b(ro,{position:"end",children:b(tt,{variant:"caption",children:(N=T.values.logs[R].weightUnit)==null?void 0:N.name})})}}}})}),b(ye,{size:3,children:b(tn,{fullWidth:!0,select:!0,label:r("routines.rir"),variant:"standard",...T.getFieldProps(`logs.${R}.rir`),children:Ste.map(B=>b(Ft,{value:B.value,children:B.label},B.value))})}),b(ye,{size:1,children:b(on,{size:"small",onClick:()=>A(R),children:b(kP,{})})})]},R)})})}),b(ye,{container:!0,spacing:2,children:b(ye,{size:12,display:"flex",justifyContent:"end",children:b(at,{color:"primary",disabled:!T.isValid||T.isSubmitting||l.isPending,variant:"contained",type:"submit",sx:{mt:2},children:r("submit")})})})]})}),b(II,{open:i,autoHideDuration:NI,onClose:u,children:b(Ii,{onClose:u,severity:"success",sx:{width:"100%"},children:r("success")})})]})},LCt=()=>{const e=Ea(),{t,i18n:n}=Re(),[r,o]=w.useState(yt.now()),i=parseInt(e.routineId??"");if(Number.isNaN(i))return b("p",{children:"Please pass an integer as the routine id."});const a=parseInt(e.dayId??"");return Number.isNaN(a)?b("p",{children:"Please pass an integer as the day id."}):b(es,{title:t("routines.addWeightLog"),backToUrl:Qt(Kt.ROUTINE_DETAIL,n.language,{id:i}),mainContent:Q(_t,{children:[b($Ct,{routineId:i,dayId:a,selectedDate:r,setSelectedDate:o}),b(tt,{variant:"h5",children:t("exercises.exercises")}),b(tt,{variant:"body2",children:t("routines.impressionHelpText")}),b(NCt,{routineId:i,dayId:a,selectedDate:r})]})})},Mb=e=>{var y,v;const{t}=Re(),[n,r]=w.useState(!0),[o,i]=w.useState([]),a=knt(e.routineId),s=e.forceInteger??!1;let l,c,u="";switch(e.type){case"weight":l=bt.WEIGHT_CONFIG,c=bt.MAX_WEIGHT_CONFIG,u=t("weight");break;case"reps":l=bt.REPETITIONS_CONFIG,c=bt.MAX_REPS_CONFIG,u=t("server.repetitions");break;case"sets":l=bt.NR_OF_SETS_CONFIG,c=bt.MAX_NR_OF_SETS_CONFIG,u=t("routines.sets");break;case"rest":l=bt.REST_CONFIG,c=bt.MAX_REST_CONFIG,u=t("routines.restTime");break;case"rir":l=bt.RIR_CONFIG,c=bt.MAX_RIR_CONFIG,u=t("routines.rir");break}const d=_o({entries:Dp().of(_o().shape({edited:mu(),iteration:wo().required(),value:wo().when("forceInteger",{is:!0,then:x=>x.integer(t("forms.enterInteger")).typeError(t("forms.enterNumber")),otherwise:x=>x.typeError(t("forms.enterNumber")).nullable().notRequired()}),valueMax:wo().typeError(t("forms.enterNumber")).nullable().when("forceInteger",{is:!0,then:x=>x.integer(t("forms.enterInteger")).typeError(t("forms.enterNumber")),otherwise:x=>x.typeError(t("forms.enterNumber")).nullable().notRequired()}).when("operation",{is:Li,then:x=>x.min(dz("value"),t("forms.maxLessThanMin")),otherwise:x=>x}),operation:Ro().required(),operationMax:Ro().required(),requirements:Dp().of(Ro().oneOf($2)),requirementsMax:Dp().of(Ro().oneOf($2)),repeat:mu(),repeatMax:mu()})).test("inter-entry-validation","Your error message here",function(x,S){const{createError:C}=this,I=x;for(let E=0;E<I.length;E++){const T=I[E];if(T.iteration>1&&T.operation!==Li){let O=!1,A=!1;for(let k=0;k<E;k++)I[k].operation===Li&&I[k].value!==""&&I[k].edited&&(O=!0),I[k].operation===Li&&I[k].valueMax!==""&&I[k].edited&&(A=!0);if(!O)return C({path:`entries[${E}].value`,message:t("routines.progressionNeedsReplace")});if(!A)return C({path:`entries[${E}].valueMax`,message:t("routines.progressionNeedsReplace")})}}return!0})}),f=(x,S)=>({forceInteger:s,edited:S,iteration:x,id:null,idMax:null,value:"",valueMax:"",operation:Li,operationMax:Li,step:"abs",stepMax:"abs",requirements:[],requirementsMax:[],repeat:!1,repeatMax:!1}),h={entries:[]};for(const x of e.iterations){const S=e.configs.find(I=>I.iteration===x),C=e.configsMax.find(I=>I.iteration===x);S===void 0?h.entries.push(f(x,!1)):h.entries.push({forceInteger:s,edited:!0,id:S.id,idMax:C===void 0?null:C.id,iteration:x,value:String(S.value),valueMax:C===void 0?"":String(C.value),operation:S.operation,operationMax:C===void 0?Li:S.operation,step:S.step,stepMax:C===void 0?"abs":C.step,requirements:((y=S.requirements)==null?void 0:y.rules)??[],requirementsMax:C===void 0?[]:((v=C.requirements)==null?void 0:v.rules)??[],repeat:S.repeat,repeatMax:C===void 0?!1:S.repeat})}const g=x=>{const S=x.entries.filter(k=>k.edited),C=S.filter(k=>k.id!==null).map(k=>({id:k.id,slot_entry:e.slotEntryId,value:k.value,iteration:k.iteration,operation:k.operation,step:k.step,repeat:k.repeat,requirements:{rules:k.requirements??[]}})),I=S.filter(k=>k.id===null&&k.value!=="").map(k=>({slot_entry:e.slotEntryId,value:k.value,iteration:k.iteration,operation:k.operation,step:k.step,repeat:k.repeat,requirements:{rules:k.requirements??[]}})),E=e.configs.filter(k=>o.includes(k.iteration)).map(k=>k.id);S.forEach(k=>{k.value===""&&k.id!==null&&!E.includes(k.id)&&E.push(k.id)});const T=S.filter(k=>k.idMax!==null&&k.valueMax!=="").map(k=>({id:k.idMax,slot_entry:e.slotEntryId,value:k.valueMax,iteration:k.iteration,operation:k.operation,step:k.step,repeat:k.repeat,requirements:{rules:k.requirements??[]}})),O=S.filter(k=>k.idMax===null&&k.valueMax!=="").map(k=>({iteration:k.iteration,slot_entry:e.slotEntryId,value:k.valueMax,operation:k.operation,step:k.stepMax,repeat:k.repeat,requirements:{rules:k.requirements??[]}})),A=e.configsMax.filter(k=>o.includes(k.iteration)).map(k=>k.id);S.forEach(k=>{k.valueMax===""&&k.idMax!==null&&!E.includes(k.idMax)&&A.push(k.idMax)}),a.mutate({toAdd:I,toDelete:E,toEdit:C,apiPath:l}),a.mutate({toAdd:O,toDelete:A,toEdit:T,apiPath:c})};return b(xt,{children:Q(_t,{sx:{width:"100%"},children:[b(tt,{variant:"h6",children:u}),b(ci,{enableReinitialize:!0,initialValues:h,validationSchema:d,onSubmit:(x,{setSubmitting:S})=>{g(x),S(!1)},children:x=>b(Zo,{children:Q(ye,{container:!0,spacing:1,children:[b(ye,{size:4,offset:2,textAlign:"center",children:t("value")}),b(ye,{size:6,children:Q(ye,{container:!0,spacing:1,children:[b(ye,{size:3,children:t("routines.operation")}),b(ye,{size:3,children:t("routines.step")}),Q(ye,{size:3,textAlign:"center",children:[t("routines.requirements"),b("br",{}),b(Do,{title:t("routines.requirementsHelpText"),children:b(on,{onClick:()=>{},children:b(Dx,{fontSize:"small"})})})]}),Q(ye,{size:3,textAlign:"center",children:[t("routines.repeat"),b("br",{}),b(Do,{title:t("routines.repeatHelpText"),children:b(on,{onClick:()=>{},children:b(Dx,{fontSize:"small"})})})]})]})}),b(ye,{size:12,children:b(Ti,{})}),b(jse,{name:"entries",validateOnChange:!0,children:({insert:S,remove:C})=>b(xt,{children:x.values.entries.map((I,E)=>Q(X.Fragment,{children:[Q(ye,{size:2,display:"flex",justifyContent:"space-around",alignItems:"center",children:[e.cycleLength===7?t("routines.weekNr",{number:I.iteration}):t("routines.workoutNr",{number:I.iteration}),I.edited?b(on,{disabled:I.iteration===1&&x.values.entries.filter(T=>T.edited&&T.iteration!==1).length>0,size:"small",onClick:()=>{I.id!==null&&i([...o,I.iteration]),C(E),S(E,f(I.iteration,!1))},children:b(W0,{})}):b(on,{size:"small",onClick:()=>{C(E),S(E,f(I.iteration,!0))},children:b($o,{})})]}),b(ye,{size:2,children:I.edited&&b(Ru,{fieldName:`entries.${E}.value`,title:t("min"),fullwidth:!0})}),b(ye,{size:2,children:I.edited&&b(Ru,{fieldName:`entries.${E}.valueMax`,title:t("max"),fullwidth:!0})}),b(ye,{size:6,children:Q(ye,{container:!0,spacing:1,children:[b(ye,{size:3,children:I.edited&&b(tn,{disabled:I.iteration===1,fullWidth:!0,select:!0,label:t("routines.operation"),variant:"standard",...x.getFieldProps(`entries.${E}.operation`),onChange:async T=>{x.handleChange(T),T.target.value===Li&&(await x.setFieldValue(`entries.${E}.requirements`,[]),await x.setFieldValue(`entries.${E}.repeat`,!1))},children:fAe.map(T=>b(Ft,{value:T.value,children:T.label},T.value))})}),b(ye,{size:3,children:I.edited&&Q(tn,{disabled:I.iteration===1||I.operation===Li,fullWidth:!0,select:!0,label:t("routines.step"),variant:"standard",...x.getFieldProps(`entries.${E}.step`),children:[dAe.map(T=>b(Ft,{value:T.value,children:T.label},T.value)),(I.iteration===1||I.operation===Li)&&b(Ft,{value:"na",children:"n/a"},"na")]})}),Q(ye,{size:3,textAlign:"center",children:[I.edited&&b(TCt,{disabled:I.iteration===1||I.operation===Li,values:I.requirements,fieldName:`entries.${E}.requirements`}),I.requirements.length>=0&&b("br",{}),I.requirements.length>=0&&I.requirements.map((T,O)=>Q(tt,{variant:"caption",children:[T,"  "]},O))]}),b(ye,{size:3,textAlign:"center",children:I.edited&&b(li,{checked:x.values.entries[E].repeat,...x.getFieldProps(`entries.${E}.repeat`),disabled:I.iteration===1||I.operation===Li})})]})})]},E))})}),b(ye,{size:12,display:"flex",justifyContent:"end",children:b(at,{color:"primary",disabled:!x.isValid||x.isSubmitting||!x.dirty,variant:"contained",type:"submit",sx:{mt:2},children:t("save")})}),b(ye,{size:12,children:b(en,{height:20})})]})})})]})})},FCt=()=>{const{t:e,i18n:t}=Re(),n=Ea(),r=n.routineId?parseInt(n.routineId):-1,o=n.slotId?parseInt(n.slotId):-1,i=_c(r),a=$c();if(i.isLoading)return b(wr,{});const s=i.data;let l;a.isSuccess&&(l=Tu(t.language,a.data));let c=null;for(const d of s.days){const f=d.slots.find(h=>h.id===o);if(f){c=f;break}}if(c===null)return b("p",{children:"Slot not found!"});const u=Object.keys(s.groupedDayDataByIteration).map(Number);return b(xt,{children:b(J0,{title:e("routines.editProgression"),backToUrl:Qt(Kt.ROUTINE_EDIT,t.language,{id:r}),children:c.entries.map(d=>{var f;return Q(X.Fragment,{children:[b(tt,{variant:"h5",gutterBottom:!0,children:(f=d.exercise)==null?void 0:f.getTranslation(l).name}),Q(ye,{container:!0,spacing:1,children:[b(ye,{size:2,display:"flex",alignItems:"end",children:b(tt,{variant:"body2",children:e("routines.rounding")})}),b(ye,{size:5,children:b(WP,{routineId:r,entryId:d.id,initialValue:d.weightRounding,rounding:"weight",editProfile:!1})}),b(ye,{size:5,children:b(WP,{routineId:r,entryId:d.id,initialValue:d.repetitionRounding,rounding:"reps",editProfile:!1})}),b(Mb,{type:"sets",configs:d.nrOfSetsConfigs,configsMax:d.maxNrOfSetsConfigs,slotEntryId:d.id,routineId:r,iterations:u,forceInteger:!0,cycleLength:s.cycleLength}),b(Mb,{type:"weight",configs:d.weightConfigs,configsMax:d.maxWeightConfigs,slotEntryId:d.id,routineId:r,iterations:u,cycleLength:s.cycleLength}),b(Mb,{type:"reps",configs:d.repetitionsConfigs,configsMax:d.maxRepetitionsConfigs,slotEntryId:d.id,routineId:r,iterations:u,cycleLength:s.cycleLength}),b(Mb,{type:"rir",configs:d.rirConfigs,configsMax:d.maxRirConfigs,slotEntryId:d.id,routineId:r,iterations:u,cycleLength:s.cycleLength}),b(Mb,{type:"rest",configs:d.restTimeConfigs,configsMax:d.maxRestTimeConfigs,slotEntryId:d.id,routineId:r,iterations:u,cycleLength:s.cycleLength})]})]},d.id)})})})},jCt=()=>{const{t:e,i18n:t}=Re(),n=Ea(),r=parseInt(n.routineId??"");if(Number.isNaN(r))return b("p",{children:"Please pass an integer as the routine id."});const o=_c(r),i=o.data;return b(UT,{query:o,child:o.isSuccess&&b(es,{title:i!=null&&i.isPublic?e("routines.publicTemplate"):e("routines.template"),subTitle:i.name,mainContent:Q(_t,{spacing:2,children:[Q(tt,{variant:"subtitle1",children:[i.start.toLocaleDateString()," - ",i.end.toLocaleDateString()," (",i.durationText,")"]}),i.description!==""&&b(tt,{variant:"body2",sx:{whiteSpace:"pre-line"},children:i==null?void 0:i.description}),b(at,{component:"a",href:Qt(Kt.ROUTINE_COPY,t.language,{id:r}),variant:"contained",children:e("routines.copyAndUseTemplate")}),i.dayDataCurrentIteration.filter(a=>a.day!==null).map((a,s)=>b(Cz,{dayData:a,routineId:r,readOnly:!0},`dayDetails-${s}`))]}),sideBar:Q(_t,{children:[b(en,{height:40}),Q(ye,{container:!0,children:[b(ye,{size:6,children:b(zl,{primaryMuscles:i.mainMuscles.filter(a=>a.isFront),secondaryMuscles:i.secondaryMuscles.filter(a=>a.isFront),isFront:!0})}),b(ye,{size:6,children:b(zl,{primaryMuscles:i.mainMuscles.filter(a=>!a.isFront),secondaryMuscles:i.secondaryMuscles.filter(a=>!a.isFront),isFront:!1})})]})]})})})},BCt=e=>{var u;const[t,n]=Re(),[r,o]=X.useState(null),i=!!r,a=d=>{o(d.currentTarget)},s=()=>{o(null)},l=()=>window.location.href=Qt(Kt.ROUTINE_EDIT_LOG,n.language,{id:e.log.id}),c=()=>window.location.href=Qt(Kt.ROUTINE_DELETE_LOG,n.language,{id:e.log.id});return Q(Zt,{children:[b(Te,{component:"th",scope:"row",children:yt.fromJSDate(e.log.date).toLocaleString(yt.DATE_MED)}),b(Te,{children:e.log.repetitions}),Q(Te,{children:[e.log.weight,(u=e.log.weightUnitObj)==null?void 0:u.name]}),b(Te,{children:e.log.rirString}),Q(Te,{children:[b(on,{"aria-label":"settings",onClick:a,children:b(gz,{fontSize:"small"})}),Q(Sa,{id:"basic-menu",anchorEl:r,open:i,onClose:s,MenuListProps:{"aria-labelledby":"basic-button"},children:[Q(Ft,{onClick:l,children:[b(hz,{}),t("edit")]}),Q(Ft,{onClick:c,children:[b(W0,{}),t("delete")]})]})]})]},e.log.id)},zCt=e=>{const{t}=Re();let n=e.logEntries??[];const r=[5,10,20],[o,i]=X.useState(r[0]),[a,s]=X.useState(0),l=(u,d)=>{s(d)},c=u=>{i(parseInt(u.target.value,10)),s(0)};return Q(xt,{children:[b(tt,{variant:"h6",sx:{mt:4},children:e.exercise.getTranslation().name}),Q(ye,{container:!0,spacing:2,children:[b(ye,{size:{xs:12,md:5},children:Q(jl,{children:[Q(Ll,{"aria-label":"simple table",size:"small",children:[b(Du,{children:Q(Zt,{children:[b(Te,{children:t("date")}),b(Te,{children:t("routines.reps")}),b(Te,{children:t("weight")}),b(Te,{children:t("routines.rir")}),b(Te,{})]})}),b(Fl,{children:n.slice(a*o,a*o+o).map(u=>b(BCt,{log:u},u.id))})]}),b(nj,{rowsPerPageOptions:r,component:"div",count:n.length,rowsPerPage:o,page:a,onPageChange:l,onRowsPerPageChange:c})]})}),b(ye,{size:{xs:12,md:7},children:b(UCt,{data:n},e.exercise.id)})]})]})},VCt=e=>e.map(t=>({id:t.id,value:t.weight,time:t.date.getTime(),entry:t})),HCt=({active:e,payload:t,label:n})=>{var r,o,i;if(e){let a="";return(r=t==null?void 0:t[1].payload)!=null&&r.entry.rir&&(a=`, ${(o=t==null?void 0:t[1].payload)==null?void 0:o.entry.rir} RiR`),b(fo,{children:Q(Pi,{children:[b(tt,{variant:"body1",children:yt.fromMillis(t==null?void 0:t[0].value).toLocaleString(yt.DATE_MED)}),Q(tt,{variant:"body2",children:[(i=t==null?void 0:t[1].payload)==null?void 0:i.entry.reps," × ",t==null?void 0:t[1].value,t==null?void 0:t[1].unit,a]})]})})}return null},UCt=e=>{let t;t=e.data.reduce(function(r,o){return r.set(o.repetitions,r.get(o.repetitions)||[]),r.get(o.repetitions).push(o),r},new Map);const n=cS(t.size);return b(en,{children:b(Fu,{width:"100%",height:250,children:Q(S8e,{children:[b(Xa,{dataKey:"time",domain:["auto","auto"],name:"Time",tickFormatter:r=>yt.fromMillis(r).toLocaleString(yt.DATE_MED),type:"number"}),b(Ja,{domain:["auto","auto"],dataKey:"value",name:"Value",unit:"kg"}),Array.from(t).map(([r,o])=>{const i=n.next().value,a=VCt(o);return b(N0,{data:a,fill:i,line:{stroke:i},lineType:"joint",lineJointType:"monotoneX",name:r.toString()},r)}),b(ua,{content:b(HCt,{})}),b(Sf,{strokeDasharray:"3 3"}),b(hc,{})]})})})},WCt=()=>{const e=Ea(),t=e.routineId?parseInt(e.routineId):0,[n,r]=Re(),o=ele(t),i=_c(t);if(o.isLoading||i.isLoading)return b(wr,{});let a=new Map;return console.log(o.data),a=o.data.reduce((s,l)=>(l.logs.forEach(c=>{const u=c.exerciseId;s.set(u,s.get(u)||[]),s.get(u).push(c)}),s),a),Q(J0,{title:n("routines.logsHeader"),backToUrl:Qt(Kt.ROUTINE_DETAIL,r.language,{id:t}),optionsMenu:b(Do,{title:n("routines.statsOverview"),children:b(on,{component:"a",href:Qt(Kt.ROUTINE_STATS_OVERVIEW,r.language,{id:t}),children:b(ale,{})})}),children:[b(tt,{variant:"body1",children:n("routines.logsFilterNote")}),i.data.dayDataCurrentIteration.filter(s=>s.day!==null&&!s.day.isRest).map((s,l)=>Q(X.Fragment,{children:[Q(_t,{direction:{xs:"column",sm:"row"},justifyContent:"space-between",alignItems:"center",sx:{mt:4},children:[b(tt,{variant:"h4",children:s.day.name}),b(at,{component:io,to:Qt(Kt.ROUTINE_ADD_LOG,r.language,{id:t,id2:s.day.id}),variant:"contained",children:n("routines.addLogToDay")})]}),s.slots.map(c=>c.exercises.map(u=>b(zCt,{exercise:u,logEntries:a.get(u.id)},u.id)))]},l))]})};var op=(e=>(e.Volume="volume",e.Sets="sets",e.Intensity="intensity",e))(op||{}),ip=(e=>(e.Mesocycle="mesocycle",e.Weekly="weekly",e.Iteration="iteration",e.Daily="daily",e))(ip||{}),ew=(e=>(e.Exercises="exercises",e.Muscles="muscles",e.Total="total",e))(ew||{});const D$=({label:e,options:t,value:n,onChange:r})=>Q(rh,{fullWidth:!0,children:[b(oh,{id:`${e}-label`,children:e}),b(gf,{labelId:`${e}-label`,id:`${e}-select`,value:n,label:e,onChange:r,children:t.map(o=>b(Ft,{value:o.value,children:o.label},o.value))})]});function GCt(e,t,n,r,o){switch(r){case"exercises":{const i=Object.keys(o.exercises).map(s=>{var l,c;return(c=(l=e.find(u=>u.id===parseInt(s)))==null?void 0:l.getTranslation(t))==null?void 0:c.name}),a=Object.keys(o.exercises).map(Number);return{headers:i,data:a.map(s=>o.exercises[s])}}case"muscles":{const i=Object.keys(o.muscle).map(s=>{var l;return qr.t(Ki((l=n.find(c=>c.id===parseInt(s)))==null?void 0:l.nameEn))}),a=Object.keys(o.muscle).map(Number);return{headers:i,data:a.map(s=>o.muscle[s])}}case"total":return{headers:[qr.t("total")],data:[o.total]};default:return{headers:[],data:[]}}}const qCt=(e,t,n,r,o,i,a,s)=>{const l={},c=e[t];let u=[],d=[];const f=(y,v)=>GCt(o,a,i,y,v);d=(y=>{let v=[];switch(n){case"mesocycle":v=f(r,c.mesocycle).headers;break;case"iteration":for(const x in c.iteration)v=v.concat(f(r,c.iteration[x]).headers);break;case"weekly":for(const x in c.weekly)v=v.concat(f(r,c.weekly[x]).headers);break;case"daily":for(const x in c.daily)v=v.concat(f(r,c.daily[x]).headers);break}return[...new Set(v)]})(),d.forEach(y=>{l[y]=0});function g(y,v){d.map(S=>y[f(r,v).headers.indexOf(S)]).forEach((S,C)=>{S!==void 0&&(l[d[C]]+=S)})}switch(n){case"mesocycle":{const{data:y}=f(r,c.mesocycle);u=[{key:qr.t("total"),values:d.map(v=>y[d.indexOf(v)])}];break}case"iteration":{u=Object.entries(c.iteration).map(([y,v])=>{const{data:x}=f(r,v);return g(x,v),{key:`iteration ${y}`,values:d.map(S=>x[f(r,v).headers.indexOf(S)])}});break}case"weekly":{u=Object.entries(c.weekly).map(([y,v])=>{const{data:x}=f(r,v);return g(x,v),{key:`week ${y}`,values:d.map(S=>x[f(r,v).headers.indexOf(S)])}});break}case"daily":{u=Object.entries(c.daily).map(([y,v])=>{const{data:x}=f(r,v);return g(x,v),{key:new Date(y).toLocaleDateString(s),values:d.map(S=>x[f(r,v).headers.indexOf(S)])}});break}}return{headers:d,data:u,totals:l}};function KCt(e){const t=[];return e.headers.forEach(n=>{t.push({name:n,data:[]})}),e.data.forEach(n=>{n.values.forEach((r,o)=>{var a;const i=e.headers[o];i&&((a=t.find(s=>s.name===i))==null||a.data.push({category:n.key.toString(),value:r}))})}),t}const YCt=()=>{const e=Lr(),[t,n]=Re(),r=Ea(),[o,i]=w.useState(op.Volume),[a,s]=w.useState(ip.Daily),[l,c]=w.useState(ew.Exercises),u=parseInt(r.routineId??"");if(Number.isNaN(u))return b("p",{children:"Please pass an integer as the routine id."});const d=_c(u),f=Snt(u),h=Yy(),g=$c();if(f.isLoading||d.isLoading||h.isLoading||g.isLoading)return b(wr,{});const y=Tu(n.language,g.data),v=d.data,x=[{value:op.Volume,label:t("routines.volume")},{value:op.Sets,label:t("routines.sets")},{value:op.Intensity,label:t("routines.intensity")}],S=[{value:ip.Mesocycle,label:t("routines.currentRoutine")},{value:ip.Weekly,label:t("routines.weekly")},{value:ip.Iteration,label:t("routines.iteration")},{value:ip.Daily,label:t("routines.daily")}],C=[{value:ew.Exercises,label:t("exercises.exercises")},{value:ew.Muscles,label:t("exercises.muscles")},{value:ew.Total,label:t("total")}],I=R=>{i(R.target.value)},E=R=>{s(R.target.value)},T=R=>{c(R.target.value)},O=qCt(f.data,o,a,l,v.exercises,h.data,y,n.language),A=KCt(O),k=()=>b(jl,{children:Q(Ll,{size:"small",children:[b(Du,{children:Q(Zt,{children:[b(Te,{}),O.headers.map(R=>b(Te,{sx:{textAlign:"right"},children:R},R))]})}),Q(Fl,{children:[O.data.map(R=>Q(Zt,{children:[b(Te,{children:R.key}),R.values.map(($,L)=>b(Te,{sx:{textAlign:"right"},children:($==null?void 0:$.toFixed(o===op.Intensity?2:0))||""},L))]},R.key)),a!==ip.Mesocycle&&Q(Zt,{children:[b(Te,{sx:{fontWeight:"bold",backgroundColor:e.palette.grey.A200},children:t("total")}),O.headers.map(R=>{var $;return b(Te,{sx:{fontWeight:"bold",backgroundColor:e.palette.grey.A200,textAlign:"right"},children:($=O.totals[R==null?void 0:R.toString()])==null?void 0:$.toFixed(o===op.Intensity?2:0)},R)})]})]})]})}),M=cS(A.length);return b(J0,{title:`${t("routines.statsOverview")} - ${v.name}`,backToUrl:Qt(Kt.ROUTINE_DETAIL,n.language,{id:u}),optionsMenu:b(Do,{title:t("routines.logsOverview"),children:b(on,{component:"a",href:Qt(Kt.ROUTINE_LOGS_OVERVIEW,n.language,{id:u}),children:b(ale,{})})}),children:Q(ye,{container:!0,spacing:1,children:[b(ye,{size:2,offset:3,children:b(D$,{label:"type",options:x,value:o,onChange:I})}),b(ye,{size:2,children:b(D$,{label:"sub type",options:S,value:a,onChange:E})}),b(ye,{size:2,children:b(D$,{label:"group by",options:C,value:l,onChange:T})}),b(ye,{size:12,children:b(en,{width:"100%",height:400,children:b(Fu,{width:"100%",height:"100%",children:Q(AB,{width:500,height:300,children:[b(Sf,{strokeDasharray:"3 3"}),b(Xa,{dataKey:"category",type:"category",allowDuplicatedCategory:!1}),b(Ja,{dataKey:"value"}),b(ua,{formatter:R=>Number.isInteger(R)?R.toFixed(0):R.toFixed(2)}),b(hc,{layout:"vertical",verticalAlign:"middle",align:"right",wrapperStyle:{paddingLeft:"20px"}}),A.map(R=>b(uh,{dataKey:"value",data:R.data,name:R.name,stroke:M.next().value},R.name))]})})})}),Q(ye,{size:12,children:[b(en,{height:20}),k()]})]})})},QCt=()=>{const[e]=Re(),[t,n]=X.useState(!1),r=()=>n(!0),o=()=>n(!1);return Q("div",{children:[b(nh,{color:"secondary","aria-label":"add",onClick:r,sx:{position:"fixed",bottom:"5rem",right:i=>i.spacing(2),zIndex:9},children:b($o,{})}),b(ki,{title:e("add"),isOpen:t,closeFn:o,children:b(Zz,{closeFn:o})})]})},SV=e=>{const[t,n]=Re(),r=e.linkDestination??Kt.ROUTINE_DETAIL,o=Qt(r,n.language,{id:e.routine.id});return Q(xt,{children:[b(Ka,{sx:{p:0},children:Q(mf,{component:"a",href:o,children:[b(uo,{primary:e.routine.name!==""?e.routine.name:t("routines.routine"),secondary:`${e.routine.durationText} (${e.routine.start.toLocaleDateString()} - ${e.routine.end.toLocaleDateString()})`}),b(sle,{})]})}),b(Ti,{component:"li"})]})},qX=()=>{const e=Cnt(),[t]=Re();return e.isLoading?b(wr,{}):b(es,{title:t("routines.routines"),mainContent:b(xt,{children:e.data.length===0?b(ih,{}):b(Kr,{children:b(xa,{sx:{py:0},children:e.data.map(n=>b(SV,{routine:n},n.id))},"abc")})}),fab:b(QCt,{})})},XCt=()=>{const e=Ent(),[t]=Re();return e.isLoading?b(wr,{}):b(es,{title:t("routines.templates"),mainContent:b(xt,{children:e.data.length===0?b(ih,{}):b(Kr,{children:b(xa,{sx:{py:0},children:e.data.map(n=>b(SV,{routine:n,linkDestination:Kt.TEMPLATE_DETAIL},n.id))},"abc")})})})},JCt=()=>{const e=Pnt(),[t]=Re();return e.isLoading?b(wr,{}):b(es,{title:t("routines.publicTemplates"),mainContent:b(xt,{children:e.data.length===0?b(ih,{}):b(Kr,{children:b(xa,{sx:{py:0},children:e.data.map(n=>b(SV,{routine:n,linkDestination:Kt.TEMPLATE_DETAIL},n.id))},"abc")})})})},ZCt=()=>b("div",{children:"About Page"});function CV(e){const[t]=Re(),[n,r,o]=Za(e.fieldName);return b($l,{multiple:!0,freeSolo:!0,id:e.fieldName,value:n.value,options:n.value,onChange:(i,a)=>{o.setValue(a)},renderTags:(i,a)=>i.map((s,l)=>gF(Pu,{label:s,...a({index:l}),key:l})),onBlur:n.onBlur,renderInput:i=>b(tn,{...i,id:"exerciseAliases",variant:"standard",label:t("exercises.alternativeNames"),error:r.touched&&!!r.error,helperText:r.touched&&r.error,value:n.value})})}function e1t(e){const[t]=Re(),[n,r,o]=Za(e.fieldName);return b($l,{multiple:!0,id:e.fieldName,options:e.options.map(i=>i.id),getOptionLabel:i=>t(Ki(e.options.find(a=>a.id===i).name)),...n,onChange:(i,a)=>{o.setValue(a)},renderInput:i=>b(tn,{variant:"standard",label:t("exercises.equipment"),value:n.value,...i})})}function EV(e){const[t]=Re(),[n,r]=Za(e.fieldName);return b(tn,{fullWidth:!0,id:e.fieldName,label:t("name"),variant:"standard",error:r.touched&&!!r.error,helperText:r.touched&&r.error,...n})}function t1t(e){const[t]=Re(),[n,r]=Za(e.fieldName);return Q(rh,{fullWidth:!0,children:[b(oh,{id:"label-category",children:t("category")}),b(gf,{labelId:"label-category",id:"category",label:t("category"),error:r.touched&&!!r.error,...n,children:e.options}),r.touched&&!!r.error&&b(h0,{error:!0,children:r.error})]})}const Jde=5,Zde=40,PV=e=>Ro().min(Jde,e("forms.valueTooShort")).max(Zde,e("forms.valueTooLong")).required(e("forms.fieldRequired")),IV=e=>Dp().ensure().compact().of(Ro().min(Jde,e("forms.valueTooShort")).max(Zde,e("forms.valueTooLong"))),TV=e=>Ro().min(40,e("forms.valueTooShort")).required(e("forms.fieldRequired")),efe=e=>Dp().ensure().compact().of(Ro().min(15,e("forms.valueTooShort"))),n1t=e=>wo().required(e("forms.fieldRequired"));var tfe=(e=>(e[e.SET_NOTIFICATION=0]="SET_NOTIFICATION",e))(tfe||{}),zn=(e=>(e[e.RESET=0]="RESET",e[e.SET_NAME_EN=1]="SET_NAME_EN",e[e.SET_ALIASES_EN=2]="SET_ALIASES_EN",e[e.SET_DESCRIPTION_EN=3]="SET_DESCRIPTION_EN",e[e.SET_NOTES_EN=4]="SET_NOTES_EN",e[e.SET_CATEGORY=5]="SET_CATEGORY",e[e.SET_EQUIPMENT=6]="SET_EQUIPMENT",e[e.SET_PRIMARY_MUSCLES=7]="SET_PRIMARY_MUSCLES",e[e.SET_MUSCLES_SECONDARY=8]="SET_MUSCLES_SECONDARY",e[e.SET_VARIATION_ID=9]="SET_VARIATION_ID",e[e.SET_NEW_VARIATION_BASE_ID=10]="SET_NEW_VARIATION_BASE_ID",e[e.SET_LANGUAGE=11]="SET_LANGUAGE",e[e.SET_NAME_I18N=12]="SET_NAME_I18N",e[e.SET_ALIASES_I18N=13]="SET_ALIASES_I18N",e[e.SET_DESCRIPTION_I18N=14]="SET_DESCRIPTION_I18N",e[e.SET_NOTES_I18N=15]="SET_NOTES_I18N",e[e.SET_IMAGES=16]="SET_IMAGES",e))(zn||{});const KX=e=>({type:tfe.SET_NOTIFICATION,payload:e}),YX={notification:{notify:!1,message:"",severity:void 0,title:"",type:void 0}},r1t=w.createContext([YX,()=>YX]),o1t=()=>w.useContext(r1t),i1t=e=>({type:zn.SET_NAME_EN,payload:e}),a1t=e=>({type:zn.SET_DESCRIPTION_EN,payload:e}),s1t=e=>({type:zn.SET_NOTES_EN,payload:e}),l1t=e=>({type:zn.SET_ALIASES_EN,payload:e}),c1t=e=>({type:zn.SET_NAME_I18N,payload:e}),u1t=e=>({type:zn.SET_DESCRIPTION_I18N,payload:e}),d1t=e=>({type:zn.SET_NOTES_I18N,payload:e}),f1t=e=>({type:zn.SET_ALIASES_I18N,payload:e}),p1t=e=>({type:zn.SET_CATEGORY,payload:e}),h1t=e=>({type:zn.SET_EQUIPMENT,payload:e}),m1t=e=>({type:zn.SET_PRIMARY_MUSCLES,payload:e}),g1t=e=>({type:zn.SET_MUSCLES_SECONDARY,payload:e}),y1t=e=>({type:zn.SET_VARIATION_ID,payload:e}),v1t=e=>({type:zn.SET_NEW_VARIATION_BASE_ID,payload:e}),b1t=e=>({type:zn.SET_LANGUAGE,payload:e}),w1t=e=>({type:zn.SET_IMAGES,payload:e}),x1t=(e,t)=>{if(t===void 0)return e;switch(t.type){case zn.RESET:return tI;case zn.SET_NAME_EN:return{...e,nameEn:t.payload};case zn.SET_DESCRIPTION_EN:return{...e,descriptionEn:t.payload};case zn.SET_NOTES_EN:return{...e,notesEn:t.payload};case zn.SET_ALIASES_EN:return{...e,alternativeNamesEn:t.payload};case zn.SET_CATEGORY:return{...e,category:t.payload};case zn.SET_EQUIPMENT:return{...e,equipment:t.payload};case zn.SET_PRIMARY_MUSCLES:return{...e,muscles:t.payload};case zn.SET_MUSCLES_SECONDARY:return{...e,musclesSecondary:t.payload};case zn.SET_VARIATION_ID:return{...e,variationId:t.payload};case zn.SET_NEW_VARIATION_BASE_ID:return{...e,newVariationExerciseId:t.payload};case zn.SET_LANGUAGE:return{...e,languageId:t.payload};case zn.SET_NAME_I18N:return{...e,nameI18n:t.payload};case zn.SET_DESCRIPTION_I18N:return{...e,descriptionI18n:t.payload};case zn.SET_NOTES_I18N:return{...e,notesI18n:t.payload};case zn.SET_ALIASES_I18N:return{...e,alternativeNamesI18n:t.payload};case zn.SET_IMAGES:return{...e,images:t.payload};default:return e}},tI={category:null,muscles:[],musclesSecondary:[],variationId:null,newVariationExerciseId:null,languageId:null,equipment:[],nameEn:"",descriptionEn:"",alternativeNamesEn:[],notesEn:[],nameI18n:"",alternativeNamesI18n:[],descriptionI18n:"",notesI18n:[],images:[]},nfe=w.createContext([tI,()=>tI]),S1t=({children:e})=>{const[t,n]=w.useReducer(x1t,tI);return b(nfe.Provider,{value:[t,n],children:e})},dv=()=>w.useContext(nfe),C1t=({onContinue:e})=>{const[t]=Re(),[n,r]=dv(),[o,i]=w.useState(n.muscles),[a,s]=w.useState(n.musclesSecondary);w.useEffect(()=>{r(m1t(o))},[r,o]),w.useEffect(()=>{r(g1t(a))},[r,a]);const l=WT(),c=Yy(),u=GT(),d=_o({nameEn:PV(t),newAlternativeNameEn:IV(t),category:n1t(t)});return b(ci,{initialValues:{nameEn:n.nameEn,newAlternativeNameEn:n.alternativeNamesEn,category:n.category!==null?n.category:"",muscles:n.muscles,equipment:n.equipment,musclesSecondary:n.musclesSecondary},validationSchema:d,onSubmit:f=>{r(i1t(f.nameEn)),r(p1t(f.category)),r(l1t(f.newAlternativeNameEn)),r(h1t(f.equipment)),e()},children:f=>Q(Zo,{children:[Q(_t,{spacing:2,children:[b(EV,{fieldName:"nameEn"}),b(CV,{fieldName:"newAlternativeNameEn"}),l.isLoading?Q(en,{children:[" ",b(Ba,{})," "]}):b(t1t,{fieldName:"category",options:l.data.map(h=>b(Ft,{value:h.id,children:t(Ki(h.name))},h.id))}),u.isLoading?Q(en,{children:[" ",b(Ba,{})," "]}):b(e1t,{fieldName:"equipment",options:u.data}),c.isLoading?Q(en,{children:[" ",b(Ba,{})," "]}):Q(xt,{children:[b($l,{multiple:!0,id:"muscles",options:c.data.map(h=>h.id),getOptionDisabled:h=>a.includes(h),getOptionLabel:h=>c.data.find(g=>g.id===h).getName(t),value:o,onChange:(h,g)=>{i(g)},renderInput:h=>b(tn,{...h,variant:"standard",label:t("exercises.muscles"),value:f.getFieldProps("muscles").value,onChange:g=>{f.setFieldValue(f.getFieldProps("muscles").name,g.target.value)}})}),b($l,{multiple:!0,id:"secondary-muscles",options:c.data.map(h=>h.id),getOptionDisabled:h=>o.includes(h),getOptionLabel:h=>c.data.find(g=>g.id===h).getName(t),value:a,onChange:(h,g)=>{s(g)},renderInput:h=>b(tn,{...h,variant:"standard",label:t("exercises.secondaryMuscles"),value:f.getFieldProps("muscles").value})})]}),Q(ye,{container:!0,children:[b(ye,{display:"flex",justifyContent:"center",size:6,children:b(zl,{primaryMuscles:o.map(h=>c.data.find(g=>g.id===h)),secondaryMuscles:a.map(h=>c.data.find(g=>g.id===h)),isFront:!0})}),b(ye,{display:"flex",justifyContent:"center",size:6,children:b(zl,{primaryMuscles:o.map(h=>c.data.find(g=>g.id===h)),secondaryMuscles:a.map(h=>c.data.find(g=>g.id===h)),isFront:!1})})]})]}),b(ye,{container:!0,children:b(ye,{display:"flex",justifyContent:"end",size:12,children:b(en,{sx:{mb:2},children:b("div",{children:b(at,{variant:"contained",type:"submit",sx:{mt:1,mr:1},children:t("continue")})})})})})]})})};function E1t(e,t){const n=new Map;return e.forEach(r=>{const o=t(r),i=n.get(o);i?i.push(r):n.set(o,[r])}),n}const QX=({exercises:e})=>{const r=e[0].variationId,o=e[0].id,[i,a]=dv(),[s,l]=w.useState(!1),[c,u]=w.useState(i.variationId),[d,f]=w.useState(i.newVariationExerciseId);w.useEffect(()=>{a(y1t(c))},[a,c]),w.useEffect(()=>{a(v1t(d))},[a,d]);const h=(y,v)=>()=>{y!==null?(v=null,y===i.variationId&&(y=null)):(y=null,v===i.newVariationExerciseId&&(v=null)),u(y),f(v)};let g;return r===null?g=i.newVariationExerciseId===o:g=r===i.variationId,b(Ka,{disableGutters:!0,children:b(mf,{onClick:h(r,o),children:Q(ye,{container:!0,children:[b(ye,{display:"flex",justifyContent:"start",alignItems:"center",size:{xs:12,sm:3},children:b(F0e,{max:4,spacing:"small",children:e.map(y=>y.mainImage?b(Nl,{src:y.mainImage.url},y.id):b(Nl,{children:b(_u,{})},y.id))})}),Q(ye,{size:{xs:10,sm:7},children:[e.slice(0,s?e.length:5).map(y=>b("p",{style:{margin:0},children:y.getTranslation().name},y.id)),!s&&e.length>5?b(xy,{onMouseEnter:()=>l(!0)}):null]}),b(ye,{display:"flex",justifyContent:"end",size:{xs:2,sm:2},children:b(li,{edge:"start",checked:g,tabIndex:-1,disableRipple:!0},`variation-${r}`)}),b(ye,{size:12,children:b(Ti,{sx:{pt:1}})})]})})})},P1t=({onContinue:e,onBack:t})=>{const[n]=Re(),r=dle(),[o,i]=w.useState("");let a=[],s=new Map;return r.isSuccess&&(a=r.data,o!==""&&(a=a.filter(l=>l.getTranslation().name.toLowerCase().includes(o.toLowerCase())))),s=E1t(a.filter(l=>l.variationId!==null),l=>l.variationId),Q(xt,{children:[Q(ye,{container:!0,children:[b(ye,{size:{xs:12,sm:6},children:b(tt,{children:n("exercises.whatVariationsExist")})}),b(ye,{display:"flex",justifyContent:"end",size:{xs:12,sm:6},children:b(tn,{label:n("exercises.filterVariations"),variant:"standard",onChange:l=>i(l.target.value),InputProps:{startAdornment:b(ro,{position:"start",children:b(JB,{})})}})})]}),r.isLoading?b(wr,{}):b(Kr,{elevation:2,sx:{mt:2},children:Q(xa,{style:{maxHeight:"400px",overflowY:"scroll"},children:[a.filter(l=>l.variationId===null).map(l=>b(QX,{exercises:[l]},"base-"+l.id)),[...s.keys()].map(l=>b(QX,{exercises:s.get(l)},"variation-"+l))]})}),Q(Ii,{severity:"info",variant:"filled",sx:{mt:2},children:[b(hg,{children:n("exercises.identicalExercise")}),n("exercises.identicalExercisePleaseDiscard")]}),b(ye,{container:!0,children:b(ye,{display:"flex",justifyContent:"end",size:12,children:b(en,{sx:{mb:2},children:Q("div",{children:[b(at,{disabled:!1,onClick:t,sx:{mt:1,mr:1},children:n("goBack")}),b(at,{variant:"contained",onClick:e,sx:{mt:1,mr:1},children:n("continue")})]})})})})]})};function I1t(e){const{t}=Re(),[n,r]=X.useState(e.initial.toString()),o=WT(),i=Pa(),a=async s=>{r(s.target.value),await yj(e.exerciseId,{category:parseInt(s.target.value),license_author:i.data.username})};return o.isSuccess?Q(rh,{fullWidth:!0,children:[b(oh,{id:"label-category",children:t("category")}),b(gf,{labelId:"label-category",id:"category",label:t("category"),value:n,onChange:a,children:o.data.map(s=>b(Ft,{value:s.id,children:t(Ki(s.name))},s.id))})]}):null}function T1t(e){const{t}=Re(),[n,r]=X.useState(e.initial),o=GT(),i=Pa(),a=async s=>{r(s),await yj(e.exerciseId,{equipment:s,license_author:i.data.username})};return o.isSuccess?b($l,{multiple:!0,value:n,options:o.data.map(s=>s.id),getOptionLabel:s=>t(Ki(o.data.find(l=>l.id===s).name)),onChange:(s,l)=>a(l),renderInput:s=>b(tn,{variant:"standard",label:t("exercises.equipment"),value:n,...s})}):null}var Ko=function(){return Ko=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Ko.apply(this,arguments)};function hO(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function XX(e){if(e){var t=e.textContent,n=/[\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC]/;e.style.direction=t&&n.test(t[0])?"rtl":"ltr"}}function rfe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.filter(Boolean).join(" ")}function O1t(){if(document.selection)return document.selection.createRange().parentElement();var e=window.getSelection();if(e&&e.rangeCount>0)return e.getRangeAt(0).startContainer.parentNode||void 0}function JX(e){return e?e.replace(/&nbsp;|\u202F|\u00A0/g," ").replace(/<br \/>/g,"<br>"):""}function k1t(e){var t=document.createTextNode("");e.appendChild(t);var n=document.activeElement===e;if(t!==null&&t.nodeValue!==null&&n){var r=window.getSelection();if(r!==null){var o=document.createRange();o.setStart(t,t.nodeValue.length),o.collapse(!0),r.removeAllRanges(),r.addRange(o)}e instanceof HTMLElement&&e.focus()}}function ofe(e,t){typeof t=="function"?t(e):typeof t=="object"&&t&&(t.current=e)}var M1t=X.memo(X.forwardRef(function(t,n){var r=t.className,o=t.disabled,i=t.tagName,a=t.value,s=a===void 0?"":a,l=t.placeholder,c=hO(t,["className","disabled","tagName","value","placeholder"]),u=X.useRef(),d=X.useRef(s),f=X.useRef(c);return X.useEffect(function(){f.current=c;var h=u.current;h&&JX(d.current)!==JX(s)&&(d.current=s,h.innerHTML=s,k1t(h))}),X.useMemo(function(){function h(v){u.current=v,XX(v),ofe(v,n)}function g(v){var x,S,C=u.current;if(C){var I=C.innerHTML;I!==d.current&&((S=(x=f.current).onChange)===null||S===void 0||S.call(x,Ko(Ko({},v),{target:{value:I,name:c.name}}))),XX(C),d.current=I}}var y=rfe("rsw-ce",r);return X.createElement(i||"div",Ko(Ko({},c),{className:y,contentEditable:!o,dangerouslySetInnerHTML:{__html:s},onBlur:function(v){return(f.current.onBlur||g)(v)},onInput:g,onKeyDown:function(v){return(f.current.onKeyDown||g)(v)},onKeyUp:function(v){return(f.current.onKeyUp||g)(v)},placeholder:l,ref:h}))},[r,o,l,i])})),ife=X.createContext(void 0);function afe(e){var t=e.children,n=X.useState({htmlMode:!1,update:i}),r=n[0],o=n[1];function i(a){o(function(s){return Ko(Ko({},s),a)})}return X.createElement(ife.Provider,{value:r},t)}function fS(){var e=X.useContext(ife);if(!e)throw new Error("You should wrap your component by EditorProvider");return e}var ZX=[],Ab=[];function A1t(e,t){if(e&&typeof document<"u"){var n,r=t.prepend===!0?"prepend":"append",o=t.singleTag===!0,i=typeof t.container=="string"?document.querySelector(t.container):document.getElementsByTagName("head")[0];if(o){var a=ZX.indexOf(i);a===-1&&(a=ZX.push(i)-1,Ab[a]={}),n=Ab[a]&&Ab[a][r]?Ab[a][r]:Ab[a][r]=s()}else n=s();e.charCodeAt(0)===65279&&(e=e.substring(1)),n.styleSheet?n.styleSheet.cssText+=e:n.appendChild(document.createTextNode(e))}function s(){var l=document.createElement("style");if(l.setAttribute("type","text/css"),t.attributes)for(var c=Object.keys(t.attributes),u=0;u<c.length;u++)l.setAttribute(c[u],t.attributes[c[u]]);var d=r==="prepend"?"afterbegin":"beforeend";return i.insertAdjacentElement(d,l),l}}var R1t=".rsw-editor{border:1px solid #ddd;border-radius:.375rem;display:flex;flex-direction:column;min-height:100px;overflow:hidden}.rsw-ce{flex:1 0 auto;padding:.5rem}.rsw-ce:focus{outline:1px solid #668}.rsw-ce[contentEditable=true]:empty:not(:focus):before{color:grey;content:attr(placeholder);pointer-events:none}.rsw-html{background:transparent;border:none;font-family:monospace,Courier New}.rsw-separator{align-self:stretch;border-right:1px solid #ddd;display:flex;margin:0 3px}.rsw-dd{box-sizing:border-box;outline:none}.rsw-btn{background:transparent;border:0;color:#222;cursor:pointer;font-size:1em;height:2em;outline:none;padding:0;width:2em}.rsw-btn:hover{background:#eaeaea}.rsw-btn[data-active=true]{background:#e0e0e0}.rsw-toolbar{align-items:center;background-color:#f5f5f5;border-bottom:1px solid #ddd;display:flex}";A1t(R1t,{});var sfe=X.forwardRef(function(t,n){var r=t.autoFocus,o=t.children,i=t.containerProps,a=t.onSelect,s=hO(t,["autoFocus","children","containerProps","onSelect"]),l=fS();X.useEffect(function(){return document.addEventListener("click",c),function(){return document.removeEventListener("click",c)}});function c(h){var g;h.target!==l.$el&&(!((g=l.$el)===null||g===void 0)&&g.contains(h.target)||l.update({$selection:void 0}))}function u(h){a==null||a(h),l.update({$selection:O1t()})}function d(h){l.update({$el:h}),ofe(h,n),r&&h&&l.$el===void 0&&h.focus()}var f=rfe("rsw-editor",i==null?void 0:i.className);return l.htmlMode?X.createElement("div",Ko({},i,{className:f}),o,X.createElement("textarea",Ko({},s,{className:"rsw-ce rsw-html"}))):X.createElement("div",Ko({},i,{className:f}),o,X.createElement(M1t,Ko({},s,{ref:d,onSelect:u})))});function D1t(){return X.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",style:{verticalAlign:"text-top"}},X.createElement("path",{fill:"currentColor",d:"M6.99938 12.998v-2H20.9994v2H6.99938zm0 6.0001v-2H20.9994v2H6.99938zm0-12.00001v-2H20.9994v2H6.99938zm-4 1v-3h-1v-1h2v4h-1zm-1 9.00001v-1h3v4h-3v-1h2v-.5h-1v-1h1v-.5h-2zM4.25 10c.41421 0 .75.3358.75.75 0 .2024-.08017.3861-.2105.521L3.11983 13H5v1H2v-.9218L4 11H2v-1h2.25z"}))}function _1t(){return X.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",style:{verticalAlign:"text-top"}},X.createElement("path",{fill:"currentColor",d:"M7 5h14v2H7V5zm0 8v-2h14v2H7zM4 4.50001c.83 0 1.5.66992 1.5 1.5 0 .83007-.67 1.5-1.5 1.5s-1.5-.66993-1.5-1.5c0-.83008.67-1.5 1.5-1.5zM4 10.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5-1.5-.67-1.5-1.5.67-1.5 1.5-1.5zM7 19v-2h14v2H7zm-3-2.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5-1.5-.67-1.5-1.5.67-1.5 1.5-1.5z"}))}var lfe=Fc("Bold","𝐁","bold"),cfe=Fc("Bullet list",X.createElement(_1t,null),"insertUnorderedList"),$1t=Fc("Clear formatting","T̲ₓ","removeFormat"),ufe=Fc("Italic","𝑰","italic"),N1t=Fc("Strike through",X.createElement("s",null,"ab"),"strikeThrough"),L1t=Fc("Link","🔗",function(e){var t=e.$selection;(t==null?void 0:t.nodeName)==="A"?document.execCommand("unlink"):document.execCommand("createLink",!1,prompt("URL","")||void 0)}),dfe=Fc("Numbered list",X.createElement(D1t,null),"insertOrderedList"),ffe=Fc("Redo","↷","redo"),pfe=Fc("Underline",X.createElement("span",{style:{textDecoration:"underline"}},"𝐔"),"underline"),hfe=Fc("Undo","↶","undo");function Fc(e,t,n){return r.displayName=e.replace(/\s/g,""),r;function r(o){var i=fS(),a=i.$el,s=i.$selection,l=!1;typeof n=="string"&&(l=!!s&&document.queryCommandState(n));function c(u){u.preventDefault(),document.activeElement!==a&&(a==null||a.focus()),typeof n=="function"?n(i):document.execCommand(n)}return i.htmlMode?null:X.createElement("button",Ko({className:"rsw-btn","data-active":l,onMouseDown:c,tabIndex:-1,title:e,type:"button"},o),t)}}var F1t=j1t("Styles",[["Normal","formatBlock","DIV"],["𝗛𝗲𝗮𝗱𝗲𝗿 𝟭","formatBlock","H1"],["Header 2","formatBlock","H2"],["𝙲𝚘𝚍𝚎","formatBlock","PRE"]]);function j1t(e,t){return n.displayName=e,n;function n(r){var o=fS(),i=o.$el,a=o.$selection,s=o.htmlMode;if(s)return null;var l=t.findIndex(function(u){return u[1]==="formatBlock"&&(a==null?void 0:a.nodeName)===u[2]});return X.createElement(B1t,Ko({},r,{items:t,onChange:c,selected:l,tabIndex:-1,title:e}));function c(u){var d=u.target,f=d.value,h=parseInt(f,10),g=t[h]||[],y=g[1],v=g[2];u.preventDefault(),document.activeElement!==i&&(i==null||i.focus()),typeof y=="function"?y(o):y&&document.execCommand(y,!1,v),setTimeout(function(){return d.value=f},10)}}}function B1t(e){var t=e.items,n=e.selected,r=hO(e,["items","selected"]);return X.createElement("select",Ko({},r,{value:n,className:"rsw-dd"}),X.createElement("option",{hidden:!0},r.title),t.map(function(o,i){return X.createElement("option",{key:o[2],value:i},o[0])}))}function z1t(e){var t=hO(e,[]),n=fS();function r(){n.update({htmlMode:!n.htmlMode})}return X.createElement("button",Ko({className:"rsw-btn","data-active":n.htmlMode,onClick:r,tabIndex:-1,title:"HTML mode",type:"button"},t),"</>")}function Lm(){var e=fS();return e.htmlMode?null:X.createElement("div",{className:"rsw-separator"})}function mfe(e){return X.createElement("div",Ko({},e,{className:"rsw-toolbar"}))}X.forwardRef(function(t,n){return X.createElement(afe,null,X.createElement(sfe,Ko({},t,{ref:n}),X.createElement(mfe,null,X.createElement(hfe,null),X.createElement(ffe,null),X.createElement(Lm,null),X.createElement(lfe,null),X.createElement(ufe,null),X.createElement(pfe,null),X.createElement(N1t,null),X.createElement(Lm,null),X.createElement(dfe,null),X.createElement(cfe,null),X.createElement(Lm,null),X.createElement(L1t,null),X.createElement($1t,null),X.createElement(z1t,null),X.createElement(Lm,null),X.createElement(F1t,null))))});function V1t(e){return b(afe,{children:b(sfe,{...e,children:Q(mfe,{children:[b(lfe,{}),b(ufe,{}),b(pfe,{}),b(Lm,{}),b(cfe,{}),b(dfe,{}),b(Lm,{}),b(hfe,{}),b(ffe,{})]})})})}function OV(e){const[t,n,r]=Za(e.fieldName);return Q(xt,{children:[b("div",{"data-testid":"jodit-editor",children:b(V1t,{value:t.value,onChange:o=>r.setValue(o.target.value)})}),n.touched&&!!n.error&&b(h0,{error:!0,children:n.error})]})}const H1t=({exerciseId:e,image:t,canDelete:n})=>{const[r]=Re(),o=eot(e);return Q(fo,{children:[b(Ec,{component:"img",image:t.url,sx:{height:120},alt:""}),b(Ys,{children:n&&b(at,{color:"primary",onClick:()=>o.mutate(t.id),children:r("delete")})})]})},U1t=({exerciseId:e})=>{const[t]=Re(),n=Pa(),r=tot(e),o=async i=>{var s;if(!((s=i.target.files)!=null&&s.length))return;const[a]=i.target.files;n.isSuccess&&await r.mutate({exerciseId:e,image:a,imageData:{url:"",file:a,author:"",authorUrl:"",title:"",objectUrl:"",derivativeSourceUrl:"",style:""}})};return Q(fo,{children:[b(Ec,{children:b(en,{sx:{backgroundColor:"lightgray",height:120},display:"flex",alignItems:"center",justifyContent:"center",children:b(ile,{sx:{fontSize:80,color:"gray"}})})}),b(Ys,{children:Q(at,{component:"label",children:[t("add"),b("input",{style:{display:"none"},id:"camera-input",type:"file",accept:"image/*",capture:"environment",onChange:o})]})})]})};function eJ(e){const{t}=Re(),n=Yy(),r=async o=>{e.setValue(o),await yj(e.exerciseId,e.isMain?{muscles:o}:{muscles_secondary:o})};return n.isSuccess?b($l,{multiple:!0,options:n.data.map(o=>o.id),getOptionDisabled:o=>e.blocked.includes(o),getOptionLabel:o=>n.data.find(i=>i.id===o).getName(t),value:e.value,onChange:(o,i)=>r(i),renderInput:o=>b(tn,{...o,variant:"standard",label:t(e.isMain?"exercises.muscles":"exercises.secondaryMuscles"),value:e.value})}):null}const W1t=({video:e,canDelete:t})=>{const[n]=Re();return Q(fo,{children:[b(Ec,{component:"video",src:e.url,sx:{height:120},controls:!0,preload:"metadata"}),b(Ys,{children:t&&b(at,{color:"primary",onClick:()=>lAe(e.id),children:n("delete")})})]})},G1t=({exerciseId:e})=>{const[t]=Re(),n=Pa(),r=async o=>{var a;if(!((a=o.target.files)!=null&&a.length))return;const[i]=o.target.files;n.isSuccess&&await sAe(e,n.data.username,i)};return Q(fo,{children:[b(Ec,{children:b(en,{sx:{backgroundColor:"lightgray",height:120},display:"flex",alignItems:"center",justifyContent:"center",children:b(ile,{sx:{fontSize:80,color:"gray"}})})}),b(Ys,{children:Q(at,{component:"label",children:[t("add"),b("input",{style:{display:"none"},id:"camera-input",type:"file",accept:"video/*",capture:"environment",onChange:r})]})})]})},q1t="check-permission",K1t=async e=>{const t=dt(q1t,{query:{permission:e}}),n=await nt.get(t,{headers:pt()});return n.status===400?!1:n.data.result};function Od(e){return br({queryKey:[Bke,e],queryFn:()=>K1t(e.valueOf())})}var au=(e=>(e.EDIT_EXERCISE="exercises.change_exercise",e.DELETE_EXERCISE="exercises.delete_exercise",e.ADD_IMAGE="exercises.add_exerciseimage",e.EDIT_IMAGE="exercises.change_exerciseimage",e.DELETE_IMAGE="exercises.delete_exerciseimage",e.ADD_VIDEO="exercises.add_exercisevideo",e.EDIT_VIDEO="exercises.change_exercisevideo",e.DELETE_VIDEO="exercises.delete_exercisevideo",e))(au||{});const Y1t=({exerciseId:e,language:t})=>{const[n]=Re(),[r,o]=w.useState(!1),[i,a]=w.useState([]),[s,l]=w.useState([]),c=Xrt(e),u=Jrt(e),d=Zrt(e),f=Od(au.ADD_IMAGE),h=Od(au.DELETE_IMAGE),g=Od(au.ADD_VIDEO),y=Od(au.DELETE_VIDEO),v=Od(au.EDIT_EXERCISE),x=Yy(),S=Pa(),C=c.data;if(w.useEffect(()=>{c.data!==void 0&&(a(C.muscles.map(k=>k.id)),l(C.musclesSecondary.map(k=>k.id)))},[c.data]),c.isLoading||x.isLoading||c.isLoading||S.isLoading||f.isLoading||h.isLoading||g.isLoading||y.isLoading||v.isLoading)return b(Ba,{});const I=C.getTranslation(t),T=t.id!==(I==null?void 0:I.language)?new hte(null,null,"","",t.id):I,O=C.getTranslation(),A=_o({name:PV(n),alternativeNames:IV(n),description:TV(n)});return Q(xt,{children:[b(ci,{initialValues:{name:T.name,alternativeNames:T.aliases.map(k=>k.alias),description:T.description},enableReinitialize:!0,validationSchema:A,onSubmit:async k=>{const M=T.id?await d.mutateAsync({id:T.id,exerciseId:C.id,languageId:t.id,name:k.name,description:k.description,author:""}):await u.mutateAsync({exerciseId:C.id,languageId:t.id,name:k.name,description:k.description,author:S.data.username}),R=T.aliases.map(N=>N.alias),$=k.alternativeNames,L=$.filter(N=>!R.includes(N));let z=R.filter(N=>!$.includes(N));L.forEach(N=>{_2(M.id,N)}),z.forEach(N=>{aAe(T.aliases.find(B=>B.alias===N).id)}),o(!0)},children:b(Zo,{children:Q(ye,{container:!0,spacing:1,children:[r&&Q(ye,{size:12,children:[b(Ii,{severity:"success",action:b(on,{"aria-label":"close",size:"small",color:"inherit",onClick:()=>{o(!1)},children:b(y0,{fontSize:"inherit"})}),children:n("exercises.successfullyUpdated")}),b(ri,{})]}),b(ye,{size:6,children:b(tt,{variant:"h5",children:n("English")})}),b(ye,{size:6,children:Q(tt,{variant:"h5",children:[t.nameLong," (",t.nameShort,")"]})}),Q(ye,{size:12,children:[b(ri,{}),b(tt,{variant:"h6",children:n("name")})]}),Q(ye,{size:6,children:[O.name,b("ul",{children:O.aliases.map(k=>b("li",{children:k.alias},k.id))})]}),Q(ye,{size:6,children:[b(en,{mb:2,children:b(EV,{fieldName:"name"})}),b(CV,{fieldName:"alternativeNames"})]}),b(ye,{size:12,children:b(ri,{})}),b(ye,{size:12,children:b(tt,{variant:"h6",children:n("exercises.description")})}),b(ye,{size:{xs:12,md:6},children:b("div",{dangerouslySetInnerHTML:{__html:O.description}})}),b(ye,{size:{xs:12,md:6},children:b(OV,{fieldName:"description"})}),v.data&&Q(xt,{children:[b(ye,{size:12,children:b(ri,{})}),b(ye,{size:{xs:12,md:6},children:b(I1t,{exerciseId:C.id,initial:C.category.id})}),b(ye,{size:{xs:12,md:6},children:b(T1t,{exerciseId:C.id,initial:C.equipment.map(k=>k.id)})})]}),Q(ye,{size:12,children:[b(ri,{}),b(at,{variant:"contained",type:"submit",sx:{mt:1,mr:1},disabled:c.isLoading||u.isPending||d.isPending,children:n("save")})]})]})})}),b(ri,{}),b(tt,{variant:"h6",children:n("images")}),Q(ye,{container:!0,spacing:2,mt:2,children:[f.data&&b(ye,{size:{md:3},children:b(U1t,{exerciseId:C.id})},"add"),C.images.map(k=>b(ye,{size:{md:3},children:b(H1t,{exerciseId:C.id,image:k,canDelete:h.data})},k.id))]}),b(ri,{}),b(tt,{variant:"h6",children:n("videos")}),Q(ye,{container:!0,spacing:2,mt:2,children:[g.data&&b(ye,{size:{md:3},children:b(G1t,{exerciseId:C.id})},"add"),C.videos.map(k=>b(ye,{size:{md:3},children:b(W1t,{video:k,canDelete:y.data})},k.id))]}),v.data&&Q(xt,{children:[b(ri,{}),b(tt,{variant:"h6",children:n("exercises.muscles")}),Q(ye,{container:!0,spacing:1,mt:2,children:[b(ye,{size:{xs:12,md:6},children:b(eJ,{exerciseId:C.id,value:i,setValue:a,blocked:s,isMain:!0})}),b(ye,{size:{xs:12,md:6},children:b(eJ,{exerciseId:C.id,value:s,setValue:l,blocked:i,isMain:!1})}),b(ye,{size:{sm:6},offset:{md:3},children:Q(ye,{container:!0,children:[b(ye,{display:"flex",justifyContent:"center",size:6,children:b(zl,{primaryMuscles:i.map(k=>x.data.find(M=>M.id===k)),secondaryMuscles:s.map(k=>x.data.find(M=>M.id===k)),isFront:!0})}),b(ye,{display:"flex",justifyContent:"center",size:6,children:b(zl,{primaryMuscles:i.map(k=>x.data.find(M=>M.id===k)),secondaryMuscles:s.map(k=>x.data.find(M=>M.id===k)),isFront:!1})})]})})]})]})]})},Q1t=({mainImage:e,sideImages:t})=>Q(ye,{container:!0,spacing:1,children:[e&&b(ye,{size:12,children:b(fo,{children:b(Ec,{component:"img",image:e.url,alt:""})})}),t.map(n=>b(ye,{size:6,children:b(fo,{children:b(Ec,{component:"img",image:n.url,sx:{height:120},alt:""})})},n.id))]}),X1t=({videos:e})=>b(ye,{container:!0,spacing:1,children:e.map(t=>b(ye,{size:6,children:b(fo,{children:b(Ec,{component:"video",src:t.url,sx:{height:120},controls:!0,muted:!0,preload:"metadata"})})},t.id))});function kV(){var r,o;const e=Pa(),t=Od(au.EDIT_EXERCISE),n={canContribute:!1,anonymous:!0,emailVerified:!1,admin:!1};if(e.isSuccess&&t.isSuccess){if(e.data===null)return n;n.anonymous=!1,(r=e.data)!=null&&r.emailVerified&&(n.emailVerified=!0),t.data&&(n.admin=!0),(n.admin||(o=e.data)!=null&&o.isTrustworthy)&&(n.canContribute=!0)}return n}const J1t=({setEditMode:e})=>{const[t]=Re();return Q(en,{mb:2,paddingY:2,sx:{width:"100%",backgroundColor:"#ebebeb",textAlign:"center"},children:[b(tt,{variant:"h5",children:t("exercises.exerciseNotTranslated")}),b(tt,{gutterBottom:!0,variant:"body1",component:"div",children:t("exercises.exerciseNotTranslatedBody")}),b(at,{variant:"contained",onClick:()=>e(!0),children:t("exercises.translateExerciseNow")})]})},Z1t=({exercise:e,variations:t,language:n,setEditMode:r})=>{var l;const[o]=Re(),i=kV(),a=e.getTranslation(n),s=n&&n.id!==a.language;return Q(ye,{container:!0,children:[s&&i.canContribute&&b(ye,{order:{xs:2,sm:1},size:{xs:12,sm:7,md:12},children:b(J1t,{setEditMode:r})}),Q(ye,{order:{xs:2,sm:1},size:{xs:12,sm:7,md:8},children:[(a==null?void 0:a.aliases.length)>0&&Q(xt,{children:[Q("p",{children:[o("exercises.alsoKnownAs"),"  ",(l=a==null?void 0:a.aliases)==null?void 0:l.map(c=>c.alias).join(", ")]}),b(ri,{})]}),b(tt,{variant:"h5",children:o("exercises.description")}),b("div",{dangerouslySetInnerHTML:{__html:a==null?void 0:a.description}}),b(ri,{}),(a==null?void 0:a.notes.length)>0&&b(tt,{variant:"h5",children:o("exercises.notes")}),b("ul",{children:a==null?void 0:a.notes.map(c=>b("li",{children:c.note},c.id))}),b(ri,{}),b(tt,{variant:"h5",children:o("exercises.muscles")}),Q(ye,{container:!0,children:[b(ye,{order:{xs:1},size:{xs:6,md:3},children:b(zl,{primaryMuscles:e.muscles,secondaryMuscles:e.musclesSecondary,isFront:!0})}),Q(ye,{order:{xs:2,md:3},size:{xs:6,md:3},children:[b("h3",{children:o("exercises.primaryMuscles")}),b("ul",{children:e.muscles.map(c=>b("li",{children:c.getName(o)},c.id))})]}),b(ye,{order:{xs:3,md:2},size:{xs:6,md:3},children:b(zl,{primaryMuscles:e.muscles,secondaryMuscles:e.musclesSecondary,isFront:!1})}),Q(ye,{order:{xs:4},size:{xs:6,md:3},children:[b("h3",{children:o("exercises.secondaryMuscles")}),b("ul",{children:e.musclesSecondary.map(c=>b("li",{children:c.getName(o)},c.id))})]})]}),b(ri,{})]}),Q(ye,{order:{xs:1,sm:2},size:{xs:12,sm:5,md:4},children:[b(Q1t,{mainImage:e.mainImage,sideImages:e.sideImages}),b(ri,{}),b(X1t,{videos:e.videos})]}),Q(ye,{order:{xs:3},size:12,children:[b(Ti,{}),b(ri,{}),t.length>0&&b(tt,{variant:"h5",children:o("exercises.variations")}),b(ye,{container:!0,spacing:2,children:t.map(c=>b(ye,{size:{xs:6,md:2},children:b(Qle,{exercise:c,language:n},c.id)},c.id))})]}),b(ye,{order:{xs:4},size:12,children:Q(tt,{variant:"caption",display:"block",mt:2,children:["The text on this page is available under the ",b("a",{href:"https://creativecommons.org/licenses/by-sa/4.0/deed",children:"CC BY-SA 4 License"}),"."]})})]})};function eEt(e){var d,f;const[t,n]=X.useState(null),[r,o]=X.useState(null),[i]=Re(),a=zu(),s=()=>{o(null),n(null)},l=async()=>{var h;await nAe((h=e.currentExercise.getTranslation(e.currentLanguage))==null?void 0:h.id),e.onClose(),e.onChangeLanguage()},c=async(h=!1)=>{h?await PW(e.currentExercise.id,r==null?void 0:r.uuid):await PW(e.currentExercise.id),e.onClose(),a("../overview")},u=async h=>{const g=h!==void 0?h:t;if(g!==null)try{const y=await w0(g);o(y)}catch{o(null)}};return Q(xt,{children:[b(cE,{id:"alert-dialog-title",children:i("delete")}),Q(Lw,{children:[b("p",{children:i("exercises.deleteExerciseBody",{name:(d=e.currentExercise.getTranslation(e.currentLanguage))==null?void 0:d.name,language:(f=e.currentLanguage)==null?void 0:f.nameLong})}),b("p",{children:i("cannotBeUndone")}),b("p",{children:b("b",{children:i("exercises.replacements")})}),b("p",{children:i("exercises.replacementsInfoText")}),b("p",{children:i("exercises.replacementsSearch")}),b(ty,{callback:h=>{h!==null&&(n(h.data.base_id),u(h.data.base_id))}}),b(tn,{"data-testid":"exercise-id-field",id:"foo",label:"Exercise ID",onBlur:()=>u(),onChange:async h=>{n(h.target.value!==""?parseInt(h.target.value):null)},value:t??"",InputProps:{endAdornment:b(ro,{position:"start",children:b(on,{onClick:()=>u(),children:b(xrt,{})})})},fullWidth:!0,variant:"standard"}),r===null&&b(xt,{children:b("p",{children:b("i",{children:i("exercises.noReplacementSelected")})})}),r!==null&&Q(xt,{children:[Q("p",{children:["Selected exercise for replacement:",b(Do,{title:i("copyToClipboard"),children:b(on,{onClick:()=>navigator.clipboard.writeText(r.id.toString()),children:b(krt,{})})})]}),Q(Ka,{disablePadding:!0,children:[b(JF,{children:b(Nl,{children:r.mainImage?b(Nl,{alt:"",src:`${cj}${r.mainImage.url}`,variant:"rounded"}):b(_u,{})})}),b(uo,{primary:r.getTranslation().name,secondary:`${r.id} (${r.uuid})`}),b(on,{onClick:s,children:b(Trt,{})})]})]})]}),Q(Nw,{children:[b(at,{onClick:()=>e.onClose(),children:i("cancel")}),b(at,{"data-testid":"button-delete-translation",size:"small",onClick:l,variant:"contained",children:i("exercises.deleteTranslation")}),b(at,{"data-testid":"button-delete-all",size:"small",onClick:()=>c(),variant:"contained",children:i("exercises.deleteExerciseFull")}),b(at,{"data-testid":"button-delete-and-replace",size:"small",disabled:r===null,onClick:()=>c(!0),variant:"contained",children:i("exercises.deleteExerciseReplace")})]})]})}const tEt="_root_l288f_1",nEt="_detail_language_l288f_4",rEt="_detail_l288f_4",oEt="_languages_l288f_28",iEt="_language_l288f_28",aEt="_header_l288f_52",sEt="_toolbar_l288f_55",Xf={root:tEt,detail_language:nEt,detail:rEt,languages:oEt,language:iEt,header:aEt,toolbar:sEt},lEt=({exercise:e,languages:t,changeLanguage:n,language:r,setEditMode:o,editMode:i})=>{var E,T,O;const[a,s]=w.useState(null),[l,c]=X.useState(!1),u=!!a,[d]=Re(),f=Od(au.DELETE_EXERCISE),h=Od(au.EDIT_EXERCISE),g=Pa(),y=g.isSuccess&&g.data===null;let v=!1;g.isSuccess&&h.isSuccess&&(v=h.data||g.data!==null&&g.data.isTrustworthy);const x=A=>{s(A.currentTarget)},S=()=>{s(null)},C=A=>{n(A),S()},I=t.map(A=>Q(Ft,{onClick:()=>C(A),selected:(r==null?void 0:r.id)===A.id,children:[b(uo,{children:A.nameLong}),b(si,{children:e.availableLanguages.includes(A.id)?b(zrt,{}):b($o,{})})]},A.nameShort));return b(ye,{container:!0,children:b(ye,{size:12,children:Q("div",{className:Xf.root,children:[b($w,{open:l,onClose:()=>c(!1),children:b(eEt,{onClose:()=>c(!1),onChangeLanguage:()=>n(t[0]),currentExercise:e,currentLanguage:r})}),Q("div",{className:Xf.detail_language,children:[Q("div",{className:Xf.detail,children:[b(io,{to:"../overview",children:d("exercises.exercises")})," > ",(E=e.getTranslation(r))==null?void 0:E.name]}),b("div",{className:Xf.languages,children:Q("div",{className:Xf.language,children:[b(at,{size:"small",id:"basic-button",onClick:x,startIcon:b(gz,{}),children:r==null?void 0:r.nameLong}),Q(Sa,{id:"basic-menu",anchorEl:a,open:u,onClose:S,MenuListProps:{"aria-labelledby":"basic-button"},sx:{padding:20},children:[b(Ft,{disabled:!0,children:d("exercises.changeExerciseLanguage")}),b(Ti,{}),I]})]})})]}),Q("div",{className:Xf.header,children:[b(tt,{gutterBottom:!0,variant:"h2",margin:0,sx:{mt:2},children:(T=e.getTranslation(r))==null?void 0:T.name}),!y&&Q("nav",{className:Xf.toolbar,children:[f.isSuccess&&f.data&&(r==null?void 0:r.id)===((O=e.getTranslation(r))==null?void 0:O.language)&&b(at,{onClick:()=>c(!0),children:d("delete")}),v&&b(at,{onClick:()=>o(!0),disabled:i,children:"EDIT"}),b(at,{onClick:()=>o(!1),disabled:!i,children:"VIEW"})]})]}),Q(_t,{direction:"row",spacing:1,mt:2,children:[b(Pu,{label:d(Ki(e.category.name)),size:"small"}),e.equipment.map(A=>b(Pu,{label:d(Ki(A.name)),variant:"outlined",size:"small"},A.id))]})]})})})},ri=()=>b(en,{sx:{height:20}}),cEt=()=>{var g;const[e,t]=w.useState(Dke),[n,r]=w.useState(!1),o=Ea(),i=parseInt(o.exerciseId??"");if(Number.isNaN(i))return b("p",{children:"Please pass an integer as the exercise id."});const{i18n:a}=Re(),s=zu(),l=$c(),c=br({queryKey:[jke,i],queryFn:()=>w0(i),enabled:l.isSuccess}),u=br({queryKey:[Fke,(g=c.data)==null?void 0:g.variationId],queryFn:()=>{var y;return XMe((y=c.data)==null?void 0:y.variationId)},enabled:c.isSuccess});if(X.useEffect(()=>{if(l.data===void 0)return;const y=Tu(a.language,l.data);t(y)},[l.data]),c.isError||l.isError||u.isError)return s("/not-found"),null;const d=y=>{const v=Tu(y.nameShort,l.data);v!==void 0&&t(v)},f=u.isSuccess?u.data.filter(y=>y.id!==i):[];let h;return c.isSuccess&&l.isSuccess&&(h=n?b(Y1t,{exerciseId:c.data.id,language:e}):b(Z1t,{exercise:c.data,language:e,variations:f,setEditMode:r})),Q(xt,{children:[c.isSuccess&&l.isSuccess&&b(Iu,{children:b(lEt,{exercise:c.data,languages:l.data,changeLanguage:d,language:e,setEditMode:r,editMode:n})}),b(ri,{}),Q(Iu,{maxWidth:"lg",children:[c.isLoading&&l.isLoading&&b(Ba,{}),h]})]})};function gfe(e){const[t]=Re(),[n,r,o]=Za(e.fieldName),[i,a]=w.useState(""),s=u=>{o.setValue(n.value.filter((d,f)=>f!==u))},l=(u,d)=>{n.value[u]=d,o.setValue(n.value)},c=()=>{n.value.push(i),o.setValue(n.value),a("")};return Q(xt,{children:[b(ye,{size:12,children:b(tn,{fullWidth:!0,label:t("exercises.newNote"),sx:{mb:3},variant:"standard",value:i,onChange:u=>a(u.target.value),error:r.touched&&!!r.error,helperText:r.touched&&r.error?r.error:t("exercises.notesHelpText"),InputProps:{endAdornment:b(ro,{position:"end",children:b(on,{onClick:c,children:b($o,{})})})}})}),n.value.map((u,d)=>b(tn,{fullWidth:!0,value:u,onChange:f=>l(d,f.target.value),sx:{mt:2},variant:"standard",error:r.touched&&!!r.error,InputProps:{endAdornment:b(ro,{position:"end",children:b(on,{onClick:()=>s(d),children:b(W0,{})})})}},d))]})}const uEt=({onContinue:e,onBack:t})=>{const[n]=Re(),[r,o]=dv(),i=_o({description:TV(n),notes:efe(n)});return b(ci,{initialValues:{description:r.descriptionEn,notes:r.notesEn},validationSchema:i,onSubmit:a=>{o(a1t(a.description)),o(s1t(a.notes)),e()},children:b(Zo,{children:Q(_t,{children:[b(OV,{fieldName:"description"}),b(ri,{}),b(gfe,{fieldName:"notes"}),b(ye,{container:!0,children:b(ye,{display:"flex",justifyContent:"end",size:12,children:b(en,{sx:{mb:2},children:Q("div",{children:[b(at,{onClick:t,sx:{mt:1,mr:1},children:n("goBack")}),b(at,{variant:"contained",type:"submit",sx:{mt:1,mr:1},children:n("continue")})]})})})})]})})})},dEt=({onContinue:e,onBack:t})=>{const[n]=Re(),r=$c(),[o,i]=dv(),[a,s]=w.useState(o.languageId!==null),l=_o(a?{description:TV(n),name:PV(n),alternativeNames:IV(n),notes:efe(n),language:wo().required()}:{});return b(ci,{initialValues:{name:o.nameI18n,alternativeNames:o.alternativeNamesI18n,description:o.descriptionI18n,language:o.languageId===null?"":o.languageId,notes:o.notesI18n},validationSchema:l,onSubmit:c=>{i(c1t(c.name)),i(u1t(c.description)),i(f1t(c.alternativeNames)),i(b1t(c.language===""?null:c.language)),i(d1t(c.notes)),e()},children:c=>Q(Zo,{children:[Q(_t,{spacing:2,children:[b(Fw,{children:b(ba,{checked:a,onClick:()=>s(!a),control:b(li,{}),label:n("exercises.translateExerciseNow")})}),a&&Q(xt,{children:[r.isLoading?b(en,{children:b(Ba,{})}):Q(rh,{fullWidth:!0,children:[b(oh,{id:"label-language",children:n("language")}),b(gf,{labelId:"label-language",id:"language",value:c.getFieldProps("language").value,onChange:u=>{c.setFieldValue(c.getFieldProps("language").name,u.target.value)},label:n("language"),error:!!(c.touched.language&&c.errors.language),children:r.data.filter(u=>u.id!==Hp).map(u=>Q(Ft,{value:u.id,children:[u.nameShort," - ",u.nameLong]},u.id))})]}),b(EV,{fieldName:"name"}),b(CV,{fieldName:"alternativeNames"}),b(OV,{fieldName:"description"}),b(ri,{}),b(gfe,{fieldName:"notes"})]})]}),b(ye,{container:!0,children:b(ye,{display:"flex",justifyContent:"end",size:12,children:b(en,{sx:{mb:2},children:Q("div",{children:[b(at,{onClick:t,sx:{mt:1,mr:1},children:n("goBack")}),b(at,{variant:"contained",type:"submit",sx:{mt:1,mr:1},children:n("continue")})]})})})})]})})};function fEt(e){const[t]=Re(),[n,r]=Za(e.fieldName);return b(tn,{fullWidth:!0,id:e.fieldName,label:t("licenses.authors"),variant:"standard",error:r.touched&&!!r.error,helperText:r.touched&&r.error,...n})}function pEt(e){const[t]=Re(),[n,r]=Za(e.fieldName);return b(tn,{fullWidth:!0,id:e.fieldName,label:t("licenses.authorProfile"),variant:"standard",placeholder:"https://",error:r.touched&&!!r.error,helperText:r.touched&&r.error,...n})}function hEt(e){const[t]=Re(),[n,r]=Za(e.fieldName);return b(tn,{fullWidth:!0,id:e.fieldName,label:t("licenses.derivativeSourceUrl"),variant:"standard",placeholder:"https://",error:r.touched&&!!r.error,helperText:t("licenses.derivativeSourceUrlHelper")||r.touched&&r.error,...n})}function mEt(e){const[t]=Re(),[n,r]=Za(e.fieldName);return b(tn,{fullWidth:!0,id:e.fieldName,label:t("licenses.originalObjectUrl"),variant:"standard",placeholder:"https://",error:r.touched&&!!r.error,helperText:r.touched&&r.error,...n})}function gEt(e){const[t]=Re(),[n,r]=Za(e.fieldName);return b(tn,{fullWidth:!0,id:e.fieldName,label:t("licenses.originalTitle"),variant:"standard",error:r.touched&&!!r.error,helperText:r.touched&&r.error,...n})}function yEt(e){const[t]=Re(),[n,r]=w.useState(nu.PHOTO),[o,i,a]=Za(e.fieldName);return Q(ATe,{value:n,exclusive:!0,fullWidth:!0,onChange:(l,c)=>{r(c),a.setValue(c)},"aria-label":"text alignment",children:[b(tb,{value:nu.PHOTO,children:Q(_t,{justifyContent:"center",alignItems:"center",children:[b(Brt,{}),b(tt,{variant:"caption",children:t("exercises.imageStylePhoto")})]})}),b(tb,{value:nu.THREE_D,children:Q(_t,{justifyContent:"center",alignItems:"center",children:[b(_rt,{}),b(tt,{variant:"caption",children:t("exercises.imageStyle3D")})]})}),b(tb,{value:nu.LINE_ART,children:Q(_t,{justifyContent:"center",alignItems:"center",children:[b($rt,{}),b(tt,{variant:"caption",children:t("exercises.imageStyleLine")})]})}),b(tb,{value:nu.LOW_POLY,children:Q(_t,{justifyContent:"center",alignItems:"center",children:[b(Nrt,{}),b(tt,{variant:"caption",children:t("exercises.imageStyleLowPoly")})]})}),b(tb,{value:nu.OTHER,children:Q(_t,{justifyContent:"center",alignItems:"center",children:[b(Lrt,{}),b(tt,{variant:"caption",children:t("exercises.imageStyleOther")})]})})]})}const vEt=({onContinue:e,onBack:t})=>{const[n]=Re(),r=Pa(),[o,i]=dv(),[a,s]=w.useState(o.images),[l,c]=w.useState(void 0),[u,d]=X.useState(!1),f=()=>d(!1);w.useEffect(()=>{i(w1t(a))},[i,a]);const h=S=>{var E;if(!((E=S.target.files)!=null&&E.length))return;const[C]=S.target.files,I=URL.createObjectURL(C);d(!0),c({url:I,file:C,author:"",authorUrl:"",title:"",derivativeSourceUrl:"",objectUrl:"",style:nu.PHOTO.toString()})},g=S=>{s(a.concat({url:l==null?void 0:l.url,file:l==null?void 0:l.file,author:S.author,authorUrl:S.authorUrl,title:S.title,derivativeSourceUrl:S.derivativeSourceUrl,objectUrl:S.objectUrl,style:S.imageStyle.toString()})),f()},y=S=>{const C=a.filter(I=>I.url!==S);s(C)},v=()=>{e()};return Q("div",{children:[b(by,{open:u,onClose:f,"aria-labelledby":"modal-modal-title","aria-describedby":"modal-modal-description",children:Q(en,{sx:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:600,bgcolor:"background.paper",boxShadow:24,p:4},children:[b(tt,{id:"modal-modal-title",variant:"h6",component:"h2",children:n("exercises.imageDetails")}),Q(ye,{container:!0,spacing:2,children:[b(ye,{size:4,children:l&&b("img",{style:{width:"100%"},src:l.url,alt:"",loading:"lazy"})}),b(ye,{size:8,children:b(ci,{initialValues:{title:"",objectUrl:"",author:r.isSuccess?r.data.username:"",authorUrl:"",derivativeSourceUrl:"",imageStyle:nu.PHOTO},onSubmit:S=>{console.log(S),g(S)},children:S=>Q(Zo,{children:[Q(_t,{spacing:2,children:[b(gEt,{fieldName:"title"}),b(mEt,{fieldName:"objectUrl"}),b(fEt,{fieldName:"author"}),b(pEt,{fieldName:"authorUrl"}),b(hEt,{fieldName:"derivativeSourceUrl"}),b(yEt,{fieldName:"imageStyle"}),Q(Ii,{icon:b(cle,{fontSize:"inherit"}),severity:"info",children:["By submitting this image, you agree to release it under the ",b("a",{href:"https://creativecommons.org/licenses/by-sa/4.0/",target:"_blank",rel:"noreferrer",children:"CC BY-SA 4.0"})," license. The image must be either your own work or the author must have released in under a license compatible with CC BY-SA 4.0."]})]}),b(_t,{direction:"row",justifyContent:"end",sx:{mt:2},children:b(at,{color:"primary",variant:"contained",type:"submit",sx:{mt:2},children:n("add")})})]})})})]})]})}),b(tt,{children:n("exercises.compatibleImagesCC")}),Q(_t,{direction:"row",justifyContent:"center",children:[Q("div",{children:[b("label",{htmlFor:"camera-input",children:b(Crt,{fontSize:"large",sx:{m:2}})}),b("input",{style:{display:"none"},id:"camera-input",type:"file",accept:"image/*",capture:"environment",onChange:h})]}),Q("div",{children:[b("label",{htmlFor:"image-input",children:b(Ort,{fontSize:"large",sx:{m:2}})}),b("input",{type:"file",accept:"image/*",name:"image-file",id:"image-input",style:{display:"none"},onChange:h})]})]}),b(see,{cols:3,style:{maxHeight:"400px"},children:a.map(S=>Q(lee,{children:[b("img",{style:{maxHeight:"400px",maxWidth:"400px"},src:S.url,alt:"",loading:"lazy"}),b(k1e,{title:S.title,subtitle:S.author,actionIcon:b(on,{onClick:()=>y(S.url),sx:{color:"white"},children:b(Mrt,{})})})]},S.url))}),b(tt,{children:n("forms.supportedImageFormats")}),b(ye,{container:!0,children:b(ye,{display:"flex",justifyContent:"end",size:12,children:b(en,{sx:{mb:2},children:Q(xt,{children:[b(at,{onClick:t,sx:{mt:1,mr:1},children:n("goBack")}),b(at,{variant:"contained",onClick:v,sx:{mt:1,mr:1},children:n("continue")})]})})})})]})},bEt="exercisecomment",tJ=async e=>{const t=new pte,n=dt(bEt),r=await nt.post(n,t.toJson(e),{headers:pt()});return t.fromJson(r.data)},wEt="variation",xEt=async()=>{const e=dt(wEt);return(await nt.post(e,{},{headers:pt()})).data.id},SEt=({onBack:e})=>{const[t,n]=Re(),[r]=dv(),o=zu(),i=WT(),a=$c(),s=Yy(),l=GT(),c=Pa(),[u,d]=w.useState("initial"),f=async()=>{d("loading");let g;r.newVariationExerciseId!==null?g=await xEt():g=r.variationId;const y=await JMe(r.category,r.equipment,r.muscles,r.musclesSecondary,g,c.data.username),v=await D2({exerciseId:y,languageId:Hp,name:r.nameEn,description:r.descriptionEn,author:c.data.username});for(const x of r.alternativeNamesEn)await _2(v.id,x);for(const x of r.images)await bte({exerciseId:y,image:x.file,imageData:x});for(const x of r.notesEn)await tJ(new R2(null,v.id,x));if(r.languageId!==null){const x=await D2({exerciseId:y,languageId:r.languageId,name:r.nameI18n,description:r.descriptionI18n,author:c.data.username});for(const S of r.alternativeNamesI18n)await _2(x.id,S);for(const S of r.notesI18n)await tJ(new R2(null,x.id,S))}console.log("Exercise created"),d("done")},h=()=>{o(Qt(Kt.EXERCISE_OVERVIEW,n.language))};return l.isLoading||a.isLoading||s.isLoading||i.isLoading?b(wr,{}):Q(xt,{children:[b(tt,{variant:"h6",children:t("exercises.step1HeaderBasics")}),b(jl,{children:b(Ll,{children:Q(Fl,{children:[Q(Zt,{children:[b(Te,{children:t("name")}),b(Te,{children:r.nameEn})]}),Q(Zt,{children:[b(Te,{children:t("exercises.alternativeNames")}),b(Te,{children:r.alternativeNamesEn.join(", ")})]}),Q(Zt,{children:[b(Te,{children:t("description")}),b(Te,{children:r.descriptionEn})]}),Q(Zt,{children:[b(Te,{children:t("exercises.notes")}),b(Te,{children:r.notesEn.map(g=>Q(xt,{children:[g,b("br",{})]}))})]}),Q(Zt,{children:[b(Te,{children:t("category")}),b(Te,{children:t(Ki(i.data.find(g=>g.id===r.category).name))})]}),Q(Zt,{children:[b(Te,{children:t("exercises.equipment")}),b(Te,{children:r.equipment.map(g=>t(Ki(l.data.find(y=>y.id===g).name))).join(", ")})]}),Q(Zt,{children:[b(Te,{children:t("exercises.muscles")}),b(Te,{children:r.muscles.map(g=>s.data.find(y=>y.id===g).getName(t)).join(", ")})]}),Q(Zt,{children:[b(Te,{children:t("exercises.secondaryMuscles")}),b(Te,{children:r.musclesSecondary.map(g=>s.data.find(y=>y.id===g).getName(t)).join(", ")})]}),Q(Zt,{children:[b(Te,{children:t("exercises.variations")}),Q(Te,{children:[r.variationId," / ",r.newVariationExerciseId]})]})]})})}),r.images.length>0&&b(see,{cols:3,style:{maxHeight:"200px"},children:r.images.map(g=>b(lee,{children:b("img",{style:{maxHeight:"200px",maxWidth:"200px"},src:g.url,alt:"",loading:"lazy"})},g.url))}),r.languageId!==null&&Q(xt,{children:[b(tt,{variant:"h6",sx:{mt:3},children:a.data.find(g=>g.id===r.languageId).nameLong}),b(jl,{children:b(Ll,{children:Q(Fl,{children:[Q(Zt,{children:[b(Te,{children:t("name")}),b(Te,{children:r.nameI18n})]}),Q(Zt,{children:[b(Te,{children:t("exercises.alternativeNames")}),b(Te,{children:r.alternativeNamesI18n.join(", ")})]}),Q(Zt,{children:[b(Te,{children:t("description")}),b(Te,{children:r.descriptionI18n})]}),Q(Zt,{children:[b(Te,{children:t("exercises.notes")}),b(Te,{children:r.notesI18n.map(g=>Q(xt,{children:[g,b("br",{})]}))})]})]})})})]}),u!=="done"?b(Ii,{severity:"info",sx:{mt:2},children:t("exercises.checkInformationBeforeSubmitting")}):Q(Ii,{severity:"success",sx:{mt:2},children:[b(hg,{children:t("success")}),t("exercises.cacheWarning")]}),b(ye,{container:!0,children:b(ye,{display:"flex",justifyContent:"end",size:12,children:b(en,{sx:{mb:2},children:Q("div",{children:[u!=="done"&&b(at,{onClick:e,sx:{mt:1,mr:1},children:t("goBack")}),u!=="done"&&b(at,{variant:"contained",disabled:u!=="initial",onClick:f,sx:{mt:1,mr:1},color:"info",children:t("exercises.submitExercise")}),u==="done"&&Q(at,{variant:"contained",onClick:h,sx:{mt:1,mr:1},color:"success",children:[t("overview"),b(Frt,{})]})]})})})})]})},CEt=()=>{const[e]=Re(),[t,n]=X.useState(0),r=()=>{n(i=>i+1)},o=()=>{n(i=>i-1)};return b(S1t,{children:Q(Iu,{maxWidth:"md",children:[b(_t,{direction:"row",children:b(tt,{gutterBottom:!0,variant:"h3",component:"div",children:e("exercises.contributeExercise")})}),b(en,{children:Q(fIe,{activeStep:t,orientation:"vertical",children:[Q(Qh,{children:[b(ep,{children:e("exercises.step1HeaderBasics")}),b(Xh,{children:b(C1t,{onContinue:r,onBack:o})})]},1),Q(Qh,{children:[b(ep,{children:e("exercises.variations")}),b(Xh,{children:b(P1t,{onContinue:r,onBack:o})})]},2),Q(Qh,{children:[b(ep,{children:e("description")}),b(Xh,{children:b(uEt,{onContinue:r,onBack:o})})]},3),Q(Qh,{children:[b(ep,{children:e("translation")}),b(Xh,{children:b(dEt,{onContinue:r,onBack:o})})]},4),Q(Qh,{children:[b(ep,{children:e("images")}),b(Xh,{children:b(vEt,{onContinue:r,onBack:o})})]},5),Q(Qh,{children:[b(ep,{children:e("overview")}),b(Xh,{children:b(SEt,{onBack:o})})]},6)]})})]})})},EEt=()=>{const[e]=Re(),t=kV();return Q(Iu,{maxWidth:"md",children:[b(tt,{variant:"h3",children:e("exercises.notEnoughRightsHeader")}),Q(en,{marginTop:4,padding:4,sx:{width:"100%",backgroundColor:"#ebebeb",textAlign:"center"},children:[b(tt,{mb:2,children:e("exercises.notEnoughRights",{days:_ke})}),!t.anonymous&&!t.emailVerified&&b(at,{variant:"contained",href:"/user/preferences",endIcon:b(wrt,{}),children:e("preferences")})]})]})},PEt=()=>{const e=kV();return b(xt,{children:e.canContribute?b(CEt,{}):b(EEt,{})})},IEt=()=>b("div",{children:"Add Weight Page"}),TEt=({day:e,currentMonth:t,currentDate:n,selectedDay:r,onClick:o})=>{const i=Lr(),a=Zd(i.breakpoints.down("sm")),s=Zd(i.breakpoints.down("md")),l=kl(e.date,r.date),c=kl(e.date,n),u=e.date.getMonth()===t&&(e.date.getDate()<=n.getDate()||e.date.getMonth()<n.getMonth()||e.date.getFullYear()<n.getFullYear()),d=e.date.getDay()===6||e.date.getDay()===0,f=()=>l||c?"white":u?d?"#E53945":"black":"gray",h=()=>a?35:s?40:50,g=()=>a?8:s?9:10,y=()=>e.measurements.length>0||e.weightEntry!==void 0,v=()=>{u&&o(e)},x=h(),S=g();return Q("div",{style:{position:"relative",width:`${x}px`,height:`${x+S/2}px`,display:"flex",flexDirection:"column",alignItems:"center"},children:[b("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",width:`${x}px`,height:`${x}px`,fontSize:a?"0.8rem":s?"0.9rem":"1rem",color:l||c?"white":f(),backgroundColor:l?"#E53945":c?"#FEC107":"transparent",borderRadius:"50%",fontWeight:"bold",cursor:u?"pointer":"default",opacity:e.date.getMonth()!==t?.25:1},"data-testid":`day-${co(e.date)}`,onClick:v,children:e.date.getDate()}),y()&&b("div",{style:{width:`${S}px`,height:`${S}px`,backgroundColor:"black",borderRadius:"50%",position:"absolute",bottom:0,left:"50%",transform:"translateX(-50%)",zIndex:2}})]})},OEt=({days:e,currentMonth:t,currentDate:n,selectedDay:r,onDayClick:o})=>{const{i18n:i}=Re(),a=Array.from({length:7},(s,l)=>new Date(1970,0,l+5).toLocaleString(i.language,{weekday:"short"}));return Q(ye,{container:!0,spacing:1,rowSpacing:2,children:[a.map((s,l)=>b(ye,{size:12/7,children:b(tt,{variant:"body1",sx:{fontWeight:"bold",textAlign:"center"},children:s})},`weekday-${l}`)),e.map((s,l)=>b(ye,{size:12/7,sx:{display:"flex",justifyContent:"center"},children:b(TEt,{day:s,currentMonth:t,currentDate:n,selectedDay:r,onClick:o})},`day-${l}`))]})},kEt=({currentMonth:e,currentYear:t,onPrevMonth:n,onNextMonth:r})=>{const{i18n:o}=Re(),i=Array.from({length:12},(a,s)=>new Date(2024,s,1).toLocaleString(o.language,{month:"long"}));return Q("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",paddingBottom:"3%"},children:[b(at,{variant:"outlined",onClick:n,children:"<"}),Q(tt,{variant:"h5",children:[i[e]," ",t]}),b(at,{variant:"outlined",onClick:r,children:">"})]})};class MEt{constructor(t,n,r,o){this.name=t,this.unit=n,this.value=r,this.date=o}}const AEt=({selectedDay:e})=>{const[t]=Re(),n=t("no_entries_for_day");return Q(fo,{sx:{width:{xs:"auto",md:"65%"},height:{xs:"60%",md:"100%"},m:{xs:0,sm:1,md:2},p:{xs:1,sm:1.5,md:2}},children:[b(Vl,{title:Q(tt,{variant:"h5",component:"div",sx:{fontWeight:"bold"},children:[t("entries")," - ",e.date.toLocaleDateString()]})}),Q(Pi,{sx:{flex:1,overflow:"auto",display:"flex",flexDirection:"column",gap:2},children:[Q("div",{className:"flex items-center gap-2",children:[Q("span",{className:"font-extrabold",children:[t("weight"),": "]}),b("span",{className:`${e.weightEntry?"text-xl font-semibold":"text-gray-500"}`,children:e.weightEntry?`${e.weightEntry.weight.toFixed(1)} kg`:n})]}),Q("div",{className:"flex flex-col gap-1",children:[Q("span",{className:"font-bold",children:[t("measurements.measurements"),": "]}),e.measurements.length===0?b("span",{className:"text-gray-500 mt-1",children:n}):b("div",{className:"flex flex-col gap-0.5",children:e.measurements.map(r=>Q("div",{children:[r.name,": ",r.value," ",r.unit]},r.name))})]})]})]})};function REt(){const t=Jle().data;return(t==null?void 0:t.flatMap(n=>n.entries.map(r=>new MEt(n.name,n.unit,r.value,r.date))))??[]}const DEt=()=>{const[e]=Re(),n=Y0().data,r=REt(),o=(C,I)=>{const E=new Date(C,I,1),T=[];let A=new Date(C,I,1).getDay();A=A===0?6:A-1;for(let R=0;R<A;R++)T.push({date:new Date(C,I,-A+R+1),weightEntry:void 0,measurements:[]});for(;E.getMonth()===I;)T.push({date:new Date(E),weightEntry:n==null?void 0:n.find(R=>kl(R.date,E)),measurements:r.filter(R=>kl(R.date,E))}),E.setDate(E.getDate()+1);A=new Date(C,I+1,0).getDay();const M=A===0?0:7-A;for(let R=1;R<=M;R++)T.push({date:new Date(C,I+1,R),weightEntry:void 0,measurements:[]});return T},i=new Date,a={date:i,weightEntry:void 0,measurements:[]},[s,l]=w.useState(i.getMonth()),[c,u]=w.useState(i.getFullYear()),d=o(c,s),[f,h]=w.useState(d.find(C=>kl(C.date,i))||a),g=Lr(),y=Zd(g.breakpoints.down("sm"));w.useEffect(()=>{l(f.date.getMonth()),u(f.date.getFullYear())},[f]);const v=C=>{h(C)},x=()=>{s===0?(l(11),u(c-1)):l(s-1)},S=()=>{(s<i.getMonth()||c<i.getFullYear())&&(s===11?(l(0),u(c+1)):l(s+1))};return Q(en,{sx:{display:"flex",gap:2,flexDirection:{xs:"column",md:"row"},height:{xs:"auto",md:"calc(100vh - 130px)"},width:"100%"},children:[Q(fo,{sx:{width:{xs:"auto",md:"65%"},height:{xs:"auto%",md:"100%"},m:{xs:0,sm:1,md:2},p:{xs:1,sm:1.5,md:2},display:"flex",flexDirection:"column"},children:[b(Vl,{sx:{"& .MuiCardHeader-content":{width:"100%"}},title:b("div",{style:{display:"flex",flexDirection:"column",width:"100%"},children:Q("div",{style:{display:"flex",alignItems:"center",marginBottom:"16px"},children:[b(Srt,{style:{width:y?"28px":"32px",height:y?"28px":"32px",marginRight:"12px"}}),b("span",{style:{fontSize:y?"1.5rem":"1.8rem",fontWeight:"bold"},children:e("calendar")})]})})}),Q(Pi,{sx:{overflow:"auto",flex:1,"&:last-child":{paddingBottom:2}},children:[b(kEt,{currentMonth:s,currentYear:c,onPrevMonth:x,onNextMonth:S}),b(OEt,{days:d,currentMonth:s,currentDate:i,selectedDay:f,onDayClick:v})]})]}),b(AEt,{selectedDay:f})]})},_Et=()=>b("div",{children:b(DEt,{})}),$Et=()=>b("div",{children:"Calories Calculator Page"}),NEt=()=>b("div",{children:"Equipments Page"}),LEt=()=>b("div",{children:"Gallery Page"}),FEt=()=>b("div",{children:"Ingredients Page"}),jEt=()=>b("div",{children:"Login Page"}),BEt=()=>b("div",{children:"Preferences Page"}),zEt=()=>b("div",{children:"RestApi Page"}),VEt=({weight:e})=>{const t=Oit(),[n]=Re(),[r,o]=X.useState(null),[i,a]=X.useState(!1),s=!!r,l=g=>{o(g.currentTarget)},c=()=>{u(),f()},u=()=>{o(null)},d=()=>{t.mutate(e.id),o(null)},f=()=>a(!0),h=()=>a(!1);return Q("div",{children:[b(at,{onClick:l,children:b(vrt,{})}),Q(Sa,{anchorEl:r,open:s,onClose:u,MenuListProps:{"aria-labelledby":"basic-button"},children:[b(Ft,{onClick:c,children:n("edit")}),b(Ft,{onClick:d,children:n("delete")})]}),b(ki,{title:n("edit"),isOpen:i,closeFn:h,children:b(Jy,{weightEntry:e,closeFn:h})})]})},HEt=()=>{const[e]=Re(),[t,n]=X.useState(!1),r=()=>n(!0),o=()=>n(!1);return Q("div",{children:[b(nh,{color:"primary","aria-label":"add",onClick:r,sx:{position:"fixed",bottom:"5rem",right:i=>i.spacing(2),zIndex:9},children:b($o,{})}),b(ki,{title:e("add"),isOpen:t,closeFn:o,children:b(Jy,{closeFn:o})})]})},UEt=e=>e.map((t,n)=>n===0?{entry:t,change:0,days:Math.abs(t.date.getTime()-t.date.getTime())/(1e3*60*60*24)}:{entry:t,change:e[n].weight-e[n-1].weight,days:Math.abs(t.date.getTime()-e[n-1].date.getTime())/(1e3*60*60*24)}),WEt=Oz(e=>({table:{"& .MuiPaper-root":{border:"1px solid #bababa"}}})),GEt=({weights:e})=>{const t=[10,50,100],[n]=Re(),r=WEt(),o=UEt(e),[i,a]=w.useState(t[0]),[s,l]=w.useState(0),c=(d,f)=>{l(f)},u=d=>{a(parseInt(d.target.value,10)),l(0)};return Q("div",{className:r.table,children:[Q(jl,{children:[Q(Ll,{sx:{minWidth:650},"aria-label":"simple table",children:[b(Du,{children:Q(Zt,{children:[b(Te,{align:"center",children:n("date")}),b(Te,{align:"center",children:n("weight")}),b(Te,{align:"center",children:n("difference")}),b(Te,{align:"center",children:n("days")}),b(Te,{align:"center"})]})}),b(Fl,{children:o.slice(s*i,s*i+i).map(d=>Q(Zt,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[b(Te,{component:"th",scope:"row",align:"center",children:d.entry.date.toLocaleDateString()}),b(Te,{align:"center",children:d.entry.weight}),b(Te,{align:"center",children:+d.change.toFixed(2)}),b(Te,{align:"center",children:d.days}),b(Te,{align:"center",children:b(VEt,{weight:d.entry})})]},d.entry.date.toLocaleDateString()))})]}),b(nj,{rowsPerPageOptions:t,component:"div",count:o.length,rowsPerPage:i,page:s,onPageChange:c,onRowsPerPageChange:u})]}),b(HEt,{})]})},qEt=()=>{const[e]=Re(),[t,n]=w.useState(!1),r=()=>n(!0),o=()=>n(!1);return Q("div",{children:[b(nh,{color:"secondary","aria-label":"add",onClick:r,sx:{position:"fixed",bottom:"5rem",right:i=>i.spacing(2),zIndex:9},children:b($o,{})}),b(ki,{title:e("add"),isOpen:t,closeFn:o,children:b(Jy,{closeFn:o})})]})},KEt=({currentFilter:e,onFilterChange:t})=>{const[n]=Re(),r=Lr(),o=i=>{e!==i&&t(i)};return Q(GF,{variant:"outlined",sx:{mb:2},children:[b(at,{onClick:()=>o(""),color:e===""?"primary":"inherit",variant:e===""?"contained":"outlined",sx:{fontFamily:r.typography.fontFamily},children:n("all")}),b(at,{onClick:()=>o("lastYear"),color:e==="lastYear"?"primary":"inherit",variant:e==="lastYear"?"contained":"outlined",sx:{fontFamily:r.typography.fontFamily},children:n("lastYear")}),b(at,{onClick:()=>o("lastHalfYear"),color:e==="lastHalfYear"?"primary":"inherit",variant:e==="lastHalfYear"?"contained":"outlined",sx:{fontFamily:r.typography.fontFamily},children:n("lastHalfYear")}),b(at,{onClick:()=>o("lastMonth"),color:e==="lastMonth"?"primary":"inherit",variant:e==="lastMonth"?"contained":"outlined",sx:{fontFamily:r.typography.fontFamily},children:n("lastMonth")}),b(at,{onClick:()=>o("lastWeek"),color:e==="lastWeek"?"primary":"inherit",variant:e==="lastWeek"?"contained":"outlined",sx:{fontFamily:r.typography.fontFamily},children:n("lastWeek")})]})},YEt=()=>{const[e]=Re(),[t,n]=w.useState("lastYear"),r=Y0(t),o=i=>{n(i)};return r.isLoading?b(wr,{}):b(es,{title:e("weight"),mainContent:Q(_t,{spacing:2,children:[b(KEt,{currentFilter:t,onFilterChange:o}),r.data.length===0&&b(ih,{}),r.data.length!==0&&Q(xt,{children:[b(Wle,{weights:r.data}),b(en,{sx:{mt:4}}),b(GEt,{weights:r.data})]})]}),fab:b(qEt,{})})},QEt=()=>{const{i18n:e}=Re(),[t,n]=X.useState(null);return Q(xt,{children:[b(at,{color:"inherit",onClick:r=>n(r.currentTarget),children:"Weight"}),Q(Sa,{anchorEl:t,open:!!t,onClose:()=>n(null),children:[b(Ft,{component:io,to:Qt(Kt.WEIGHT_OVERVIEW,e.language),children:"Weight overview"}),b(Ft,{component:io,to:Qt(Kt.WEIGHT_ADD,e.language),children:"Add weight entry"})]})]})},XEt=()=>{const{i18n:e}=Re(),[t,n]=X.useState(null);return Q(xt,{children:[b(at,{color:"inherit",onClick:r=>n(r.currentTarget),children:"Measurements"}),b(Sa,{anchorEl:t,open:!!t,onClose:()=>n(null),children:b(Ft,{component:io,to:Qt(Kt.MEASUREMENT_OVERVIEW,e.language),children:"Overview"})})]})},JEt=()=>{const{i18n:e}=Re(),[t,n]=X.useState(null);return Q(xt,{children:[b(at,{color:"inherit",onClick:r=>n(r.currentTarget),children:"Nutrition"}),b(Sa,{anchorEl:t,open:!!t,onClose:()=>n(null),children:b(Ft,{component:io,to:Qt(Kt.NUTRITION_OVERVIEW,e.language),children:"Overview"})})]})},ZEt=()=>{const{i18n:e}=Re(),[t,n]=X.useState(null);return Q(xt,{children:[b(at,{color:"inherit",onClick:r=>n(r.currentTarget),children:"Routines"}),Q(Sa,{anchorEl:t,open:!!t,onClose:()=>n(null),children:[b(Ft,{component:io,to:Qt(Kt.ROUTINE_OVERVIEW,e.language),children:"Routine overview"}),b(Ft,{component:io,to:Qt(Kt.PRIVATE_TEMPLATE_OVERVIEW,e.language),children:"Private template overview"}),b(Ft,{component:io,to:Qt(Kt.PUBLIC_TEMPLATE_OVERVIEW,e.language),children:"Public template overview"}),b(Ft,{component:io,to:Qt(Kt.EXERCISE_OVERVIEW,e.language),children:"Exercise overview"}),b(Ft,{component:io,to:Qt(Kt.EXERCISE_CONTRIBUTE,e.language),children:"Contribute exercise"}),b(Ft,{component:io,to:Qt(Kt.CALENDAR,e.language),children:"Calendar"})]})]})},ePt=()=>b(Owe,{position:"static",children:Q(wee,{children:[b(tt,{variant:"h6",component:"div",mr:3,children:"wger"}),b(ZEt,{}),b(QEt,{}),b(XEt,{}),b(JEt,{})]})}),tPt=()=>b(YEt,{}),nPt=()=>b("div",{children:"Workout Page"}),_$=()=>b(cEt,{}),MV=()=>Q(Wot,{children:[Q(Ut,{path:"/:lang",children:[Q(Ut,{path:"workout",children:[b(Ut,{path:"overview",element:b(nPt,{})}),b(Ut,{path:"gallery",element:b(LEt,{})})]}),Q(Ut,{path:"routine",children:[b(Ut,{index:!0,element:b(qX,{})}),b(Ut,{path:"overview",element:b(qX,{})}),b(Ut,{path:"calendar",element:b(_Et,{})}),b(Ut,{path:"add",element:b(ebt,{})}),Q(Ut,{path:":routineId",children:[b(Ut,{path:"day/:dayId",children:b(Ut,{path:"add-logs",element:b(LCt,{})})}),Q(Ut,{path:"edit",children:[b(Ut,{index:!0,element:b(_Ct,{})}),b(Ut,{path:"progression/:slotId",element:b(FCt,{})})]}),b(Ut,{path:"view",element:b(rbt,{})}),b(Ut,{path:"table",element:b(obt,{})}),b(Ut,{path:"logs",element:b(WCt,{})}),b(Ut,{path:"statistics",element:b(YCt,{})})]}),Q(Ut,{path:"templates",children:[b(Ut,{path:":routineId",children:b(Ut,{path:"view",element:b(jCt,{})})}),Q(Ut,{path:"overview",children:[b(Ut,{path:"private",element:b(XCt,{})}),b(Ut,{path:"public",element:b(JCt,{})})]})]})]}),Q(Ut,{path:"measurement",children:[b(Ut,{index:!0,element:b(nX,{})}),b(Ut,{path:"overview",element:b(nX,{})}),b(Ut,{path:"category/:categoryId",element:b(kvt,{})})]}),Q(Ut,{path:"exercise",children:[b(Ut,{index:!0,element:b(zY,{})}),b(Ut,{path:"overview",element:b(zY,{})}),b(Ut,{path:":exerciseId",element:b(_$,{}),children:b(Ut,{path:"view",element:b(_$,{}),children:b(Ut,{path:":slug",element:b(_$,{})})})}),b(Ut,{path:"contribute",element:b(PEt,{})})]}),Q(Ut,{path:"weight",children:[b(Ut,{path:"overview",element:b(tPt,{})}),b(Ut,{path:"add",element:b(IEt,{})})]}),Q(Ut,{path:"nutrition",children:[b(Ut,{path:"overview",element:b(Gvt,{})}),Q(Ut,{path:":planId",children:[b(Ut,{path:"view",element:b(Wvt,{})}),b(Ut,{path:":date",element:b(rX,{})}),b(Ut,{path:"diary",element:b(rX,{})})]}),Q(Ut,{path:"calculator",children:[b(Ut,{path:"bmi",element:b(Rvt,{})}),b(Ut,{path:"calories",element:b($Et,{})})]}),b(Ut,{path:"ingredient",children:b(Ut,{path:"overview",element:b(FEt,{})})})]}),Q(Ut,{path:"software",children:[b(Ut,{path:"about-us",element:b(ZCt,{})}),b(Ut,{path:"api",element:b(zEt,{})}),b(Ut,{path:"equipment",element:b(NEt,{})})]}),b(Ut,{path:"login",element:b(jEt,{})}),b(Ut,{path:"user",children:b(Ut,{path:"preferences",element:b(BEt,{})})})]}),b(Ut,{path:"/",element:b(Bst,{})}),b(Ut,{path:"*",element:b("main",{style:{padding:"1rem"},children:b("p",{children:"404, Page NOT FOUND"})})})]}),rPt="_notification_bbb61_1",nJ={notification:rPt},oPt=()=>{const[e,t]=o1t(),n=()=>{t(KX({notify:!1,message:"",severity:void 0,title:"",type:void 0}))},r=()=>{t(KX({notify:!1,message:"",severity:void 0,title:"",type:void 0,undo:!0}))};return e.notification.notify?e.notification.type==="delete"?Q(Ii,{className:nJ.notification,severity:e.notification.severity,action:b(at,{color:"inherit",size:"small",onClick:r,children:"UNDO"}),variant:"filled",children:[b(hg,{children:e.notification.title}),b("strong",{children:e.notification.message})]}):Q(Ii,{className:nJ.notification,severity:e.notification.severity,onClose:()=>n(),variant:"filled",children:[b(hg,{children:e.notification.title}),b("strong",{children:e.notification.message})]}):null};function iPt(){return Q(ye,{container:!0,children:[b(ye,{size:12,children:b(ePt,{})}),b(ye,{size:12,children:b(oPt,{})}),b(ye,{size:12,children:b(MV,{})})]})}const{slice:aPt,forEach:sPt}=[];function lPt(e){return sPt.call(aPt.call(arguments,1),t=>{if(t)for(const n in t)e[n]===void 0&&(e[n]=t[n])}),e}const rJ=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,cPt=function(e,t){const r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},o=encodeURIComponent(t);let i=`${e}=${o}`;if(r.maxAge>0){const a=r.maxAge-0;if(Number.isNaN(a))throw new Error("maxAge should be a Number");i+=`; Max-Age=${Math.floor(a)}`}if(r.domain){if(!rJ.test(r.domain))throw new TypeError("option domain is invalid");i+=`; Domain=${r.domain}`}if(r.path){if(!rJ.test(r.path))throw new TypeError("option path is invalid");i+=`; Path=${r.path}`}if(r.expires){if(typeof r.expires.toUTCString!="function")throw new TypeError("option expires is invalid");i+=`; Expires=${r.expires.toUTCString()}`}if(r.httpOnly&&(i+="; HttpOnly"),r.secure&&(i+="; Secure"),r.sameSite)switch(typeof r.sameSite=="string"?r.sameSite.toLowerCase():r.sameSite){case!0:i+="; SameSite=Strict";break;case"lax":i+="; SameSite=Lax";break;case"strict":i+="; SameSite=Strict";break;case"none":i+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return i},oJ={create(e,t,n,r){let o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};n&&(o.expires=new Date,o.expires.setTime(o.expires.getTime()+n*60*1e3)),r&&(o.domain=r),document.cookie=cPt(e,encodeURIComponent(t),o)},read(e){const t=`${e}=`,n=document.cookie.split(";");for(let r=0;r<n.length;r++){let o=n[r];for(;o.charAt(0)===" ";)o=o.substring(1,o.length);if(o.indexOf(t)===0)return o.substring(t.length,o.length)}return null},remove(e){this.create(e,"",-1)}};var uPt={name:"cookie",lookup(e){let{lookupCookie:t}=e;if(t&&typeof document<"u")return oJ.read(t)||void 0},cacheUserLanguage(e,t){let{lookupCookie:n,cookieMinutes:r,cookieDomain:o,cookieOptions:i}=t;n&&typeof document<"u"&&oJ.create(n,e,r,o,i)}},dPt={name:"querystring",lookup(e){var r;let{lookupQuerystring:t}=e,n;if(typeof window<"u"){let{search:o}=window.location;!window.location.search&&((r=window.location.hash)==null?void 0:r.indexOf("?"))>-1&&(o=window.location.hash.substring(window.location.hash.indexOf("?")));const a=o.substring(1).split("&");for(let s=0;s<a.length;s++){const l=a[s].indexOf("=");l>0&&a[s].substring(0,l)===t&&(n=a[s].substring(l+1))}}return n}};let Rb=null;const iJ=()=>{if(Rb!==null)return Rb;try{Rb=window!=="undefined"&&window.localStorage!==null;const e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{Rb=!1}return Rb};var fPt={name:"localStorage",lookup(e){let{lookupLocalStorage:t}=e;if(t&&iJ())return window.localStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupLocalStorage:n}=t;n&&iJ()&&window.localStorage.setItem(n,e)}};let Db=null;const aJ=()=>{if(Db!==null)return Db;try{Db=window!=="undefined"&&window.sessionStorage!==null;const e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{Db=!1}return Db};var pPt={name:"sessionStorage",lookup(e){let{lookupSessionStorage:t}=e;if(t&&aJ())return window.sessionStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupSessionStorage:n}=t;n&&aJ()&&window.sessionStorage.setItem(n,e)}},hPt={name:"navigator",lookup(e){const t=[];if(typeof navigator<"u"){const{languages:n,userLanguage:r,language:o}=navigator;if(n)for(let i=0;i<n.length;i++)t.push(n[i]);r&&t.push(r),o&&t.push(o)}return t.length>0?t:void 0}},mPt={name:"htmlTag",lookup(e){let{htmlTag:t}=e,n;const r=t||(typeof document<"u"?document.documentElement:null);return r&&typeof r.getAttribute=="function"&&(n=r.getAttribute("lang")),n}},gPt={name:"path",lookup(e){var o;let{lookupFromPathIndex:t}=e;if(typeof window>"u")return;const n=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(n)?(o=n[typeof t=="number"?t:0])==null?void 0:o.replace("/",""):void 0}},yPt={name:"subdomain",lookup(e){var o,i;let{lookupFromSubdomainIndex:t}=e;const n=typeof t=="number"?t+1:1,r=typeof window<"u"&&((i=(o=window.location)==null?void 0:o.hostname)==null?void 0:i.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i));if(r)return r[n]}};let yfe=!1;try{document.cookie,yfe=!0}catch{}const vfe=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];yfe||vfe.splice(1,1);const vPt=()=>({order:vfe,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:e=>e});class bfe{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(t,n)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=t,this.options=lPt(n,this.options||{},vPt()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=o=>o.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=r,this.addDetector(uPt),this.addDetector(dPt),this.addDetector(fPt),this.addDetector(pPt),this.addDetector(hPt),this.addDetector(mPt),this.addDetector(gPt),this.addDetector(yPt)}addDetector(t){return this.detectors[t.name]=t,this}detect(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,n=[];return t.forEach(r=>{if(this.detectors[r]){let o=this.detectors[r].lookup(this.options);o&&typeof o=="string"&&(o=[o]),o&&(n=n.concat(o))}}),n=n.map(r=>this.options.convertDetectedLanguage(r)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?n:n.length>0?n[0]:null}cacheUserLanguage(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;n&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(t)>-1||n.forEach(r=>{this.detectors[r]&&this.detectors[r].cacheUserLanguage(t,this.options)}))}}bfe.type="languageDetector";function aF(e){"@babel/helpers - typeof";return aF=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},aF(e)}function wfe(){return typeof XMLHttpRequest=="function"||(typeof XMLHttpRequest>"u"?"undefined":aF(XMLHttpRequest))==="object"}function bPt(e){return!!e&&typeof e.then=="function"}function wPt(e){return bPt(e)?e:Promise.resolve(e)}function sJ(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function lJ(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?sJ(Object(n),!0).forEach(function(r){xPt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sJ(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function xPt(e,t,n){return(t=SPt(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function SPt(e){var t=CPt(e,"string");return eh(t)=="symbol"?t:t+""}function CPt(e,t){if(eh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(eh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function eh(e){"@babel/helpers - typeof";return eh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},eh(e)}var cf=typeof fetch=="function"?fetch:void 0;typeof global<"u"&&global.fetch?cf=global.fetch:typeof window<"u"&&window.fetch&&(cf=window.fetch);var Kx;wfe()&&(typeof global<"u"&&global.XMLHttpRequest?Kx=global.XMLHttpRequest:typeof window<"u"&&window.XMLHttpRequest&&(Kx=window.XMLHttpRequest));var nI;typeof ActiveXObject=="function"&&(typeof global<"u"&&global.ActiveXObject?nI=global.ActiveXObject:typeof window<"u"&&window.ActiveXObject&&(nI=window.ActiveXObject));typeof cf!="function"&&(cf=void 0);if(!cf&&!Kx&&!nI)try{Kve(()=>import("./browser-ponyfill-C6u-C1Mi.js").then(e=>e.b),[]).then(function(e){cf=e.default}).catch(function(){})}catch{}var sF=function(t,n){if(n&&eh(n)==="object"){var r="";for(var o in n)r+="&"+encodeURIComponent(o)+"="+encodeURIComponent(n[o]);if(!r)return t;t=t+(t.indexOf("?")!==-1?"&":"?")+r.slice(1)}return t},cJ=function(t,n,r,o){var i=function(l){if(!l.ok)return r(l.statusText||"Error",{status:l.status});l.text().then(function(c){r(null,{status:l.status,data:c})}).catch(r)};if(o){var a=o(t,n);if(a instanceof Promise){a.then(i).catch(r);return}}typeof fetch=="function"?fetch(t,n).then(i).catch(r):cf(t,n).then(i).catch(r)},uJ=!1,EPt=function(t,n,r,o){t.queryStringParams&&(n=sF(n,t.queryStringParams));var i=lJ({},typeof t.customHeaders=="function"?t.customHeaders():t.customHeaders);typeof window>"u"&&typeof global<"u"&&typeof global.process<"u"&&global.process.versions&&global.process.versions.node&&(i["User-Agent"]="i18next-http-backend (node/".concat(global.process.version,"; ").concat(global.process.platform," ").concat(global.process.arch,")")),r&&(i["Content-Type"]="application/json");var a=typeof t.requestOptions=="function"?t.requestOptions(r):t.requestOptions,s=lJ({method:r?"POST":"GET",body:r?t.stringify(r):void 0,headers:i},uJ?{}:a),l=typeof t.alternateFetch=="function"&&t.alternateFetch.length>=1?t.alternateFetch:void 0;try{cJ(n,s,o,l)}catch(c){if(!a||Object.keys(a).length===0||!c.message||c.message.indexOf("not implemented")<0)return o(c);try{Object.keys(a).forEach(function(u){delete s[u]}),cJ(n,s,o,l),uJ=!0}catch(u){o(u)}}},PPt=function(t,n,r,o){r&&eh(r)==="object"&&(r=sF("",r).slice(1)),t.queryStringParams&&(n=sF(n,t.queryStringParams));try{var i=Kx?new Kx:new nI("MSXML2.XMLHTTP.3.0");i.open(r?"POST":"GET",n,1),t.crossDomain||i.setRequestHeader("X-Requested-With","XMLHttpRequest"),i.withCredentials=!!t.withCredentials,r&&i.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),i.overrideMimeType&&i.overrideMimeType("application/json");var a=t.customHeaders;if(a=typeof a=="function"?a():a,a)for(var s in a)i.setRequestHeader(s,a[s]);i.onreadystatechange=function(){i.readyState>3&&o(i.status>=400?i.statusText:null,{status:i.status,data:i.responseText})},i.send(r)}catch(l){console&&console.log(l)}},IPt=function(t,n,r,o){if(typeof r=="function"&&(o=r,r=void 0),o=o||function(){},cf&&n.indexOf("file:")!==0)return EPt(t,n,r,o);if(wfe()||typeof ActiveXObject=="function")return PPt(t,n,r,o);o(new Error("No fetch and no xhr implementation found!"))};function cy(e){"@babel/helpers - typeof";return cy=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cy(e)}function dJ(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function $$(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?dJ(Object(n),!0).forEach(function(r){xfe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dJ(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function TPt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function OPt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Sfe(r.key),r)}}function kPt(e,t,n){return t&&OPt(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function xfe(e,t,n){return(t=Sfe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Sfe(e){var t=MPt(e,"string");return cy(t)=="symbol"?t:t+""}function MPt(e,t){if(cy(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(cy(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var APt=function(){return{loadPath:"/locales/{{lng}}/{{ns}}.json",addPath:"/locales/add/{{lng}}/{{ns}}",parse:function(n){return JSON.parse(n)},stringify:JSON.stringify,parsePayload:function(n,r,o){return xfe({},r,o||"")},parseLoadPayload:function(n,r){},request:IPt,reloadInterval:typeof window<"u"?!1:60*60*1e3,customHeaders:{},queryStringParams:{},crossDomain:!1,withCredentials:!1,overrideMimeType:!1,requestOptions:{mode:"cors",credentials:"same-origin",cache:"default"}}},Cfe=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};TPt(this,e),this.services=t,this.options=n,this.allOptions=r,this.type="backend",this.init(t,n,r)}return kPt(e,[{key:"init",value:function(n){var r=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(this.services=n,this.options=$$($$($$({},APt()),this.options||{}),o),this.allOptions=i,this.services&&this.options.reloadInterval){var a=setInterval(function(){return r.reload()},this.options.reloadInterval);cy(a)==="object"&&typeof a.unref=="function"&&a.unref()}}},{key:"readMulti",value:function(n,r,o){this._readAny(n,n,r,r,o)}},{key:"read",value:function(n,r,o){this._readAny([n],n,[r],r,o)}},{key:"_readAny",value:function(n,r,o,i,a){var s=this,l=this.options.loadPath;typeof this.options.loadPath=="function"&&(l=this.options.loadPath(n,o)),l=wPt(l),l.then(function(c){if(!c)return a(null,{});var u=s.services.interpolator.interpolate(c,{lng:n.join("+"),ns:o.join("+")});s.loadUrl(u,a,r,i)})}},{key:"loadUrl",value:function(n,r,o,i){var a=this,s=typeof o=="string"?[o]:o,l=typeof i=="string"?[i]:i,c=this.options.parseLoadPayload(s,l);this.options.request(this.options,n,c,function(u,d){if(d&&(d.status>=500&&d.status<600||!d.status))return r("failed loading "+n+"; status code: "+d.status,!0);if(d&&d.status>=400&&d.status<500)return r("failed loading "+n+"; status code: "+d.status,!1);if(!d&&u&&u.message){var f=u.message.toLowerCase(),h=["failed","fetch","network","load"].find(function(v){return f.indexOf(v)>-1});if(h)return r("failed loading "+n+": "+u.message,!0)}if(u)return r(u,!1);var g,y;try{typeof d.data=="string"?g=a.options.parse(d.data,o,i):g=d.data}catch{y="failed parsing "+n+" to json"}if(y)return r(y,!1);r(null,g)})}},{key:"create",value:function(n,r,o,i,a){var s=this;if(this.options.addPath){typeof n=="string"&&(n=[n]);var l=this.options.parsePayload(r,o,i),c=0,u=[],d=[];n.forEach(function(f){var h=s.options.addPath;typeof s.options.addPath=="function"&&(h=s.options.addPath(f,r));var g=s.services.interpolator.interpolate(h,{lng:f,ns:r});s.options.request(s.options,g,l,function(y,v){c+=1,u.push(y),d.push(v),c===n.length&&typeof a=="function"&&a(u,d)})})}}},{key:"reload",value:function(){var n=this,r=this.services,o=r.backendConnector,i=r.languageUtils,a=r.logger,s=o.language;if(!(s&&s.toLowerCase()==="cimode")){var l=[],c=function(d){var f=i.toResolveHierarchy(d);f.forEach(function(h){l.indexOf(h)<0&&l.push(h)})};c(s),this.allOptions.preload&&this.allOptions.preload.forEach(function(u){return c(u)}),l.forEach(function(u){n.allOptions.ns.forEach(function(d){o.read(u,d,"read",null,null,function(f,h){f&&a.warn("loading namespace ".concat(d," for language ").concat(u," failed"),f),!f&&h&&a.log("loaded namespace ".concat(d," for language ").concat(u),h),o.loaded("".concat(u,"|").concat(d),f,h)})})})}}}])}();Cfe.type="backend";qr.use(Cfe).use(bfe).use(HTe).init({load:"languageOnly",detection:{order:["path","navigator","htmlTag"]},fallbackLng:"en",interpolation:{escapeValue:!1},backend:{loadPath:"/static/react/locales/{{lng}}/{{ns}}.json"}});const fv=new Mve({defaultOptions:{queries:{retry:3,staleTime:1e3*60*5,refetchOnMount:!0,refetchOnWindowFocus:!0,refetchOnReconnect:"always"}}}),RPt=e=>{const t=document.getElementById(e);if(t===null)return;const n=t.attachShadow({mode:"open"}),r=document.createElement("div"),o=document.createElement("style"),i=document.getElementById("react-css");if(i){const l=document.createElement("link");l.setAttribute("rel","stylesheet"),l.setAttribute("href",i.href),n.appendChild(i)}n.appendChild(r),n.appendChild(o);const a=NJ({key:"css",prepend:!0,container:o});bh.createRoot(r).render(b(tme,{value:a,children:b(w.Suspense,{fallback:b(Ba,{}),children:b(Sz,{children:b(th,{theme:Ovt(r),children:b(gy,{client:fv,children:b(MV,{})})})})})}))},fJ=document.getElementById("root");fJ&&bh.createRoot(fJ).render(b(X.StrictMode,{children:b(w.Suspense,{fallback:b(Ba,{}),children:b(Sz,{children:b(th,{theme:xh,children:Q(gy,{client:fv,children:[b(iPt,{}),b(Yve,{})]})})})})}));const pJ=document.getElementById("react-page-no-shadow-dom");pJ&&bh.createRoot(pJ).render(b(w.Suspense,{fallback:b(Ba,{}),children:b(Sz,{children:b(th,{theme:xh,children:b(gy,{client:fv,children:b(MV,{})})})})}));RPt("react-page");const hJ=document.getElementById("react-weight-dashboard");hJ&&bh.createRoot(hJ).render(b(w.Suspense,{fallback:b(Ba,{}),children:b(th,{theme:xh,children:b(gy,{client:fv,children:b(Gle,{})})})}));const mJ=document.getElementById("react-nutrition-dashboard");mJ&&bh.createRoot(mJ).render(b(w.Suspense,{fallback:b(Ba,{}),children:b(th,{theme:xh,children:b(gy,{client:fv,children:b(Jse,{})})})}));const gJ=document.getElementById("react-routine-dashboard");gJ&&bh.createRoot(gJ).render(b(w.Suspense,{fallback:b(Ba,{}),children:b(th,{theme:xh,children:b(gy,{client:fv,children:b(Ole,{})})})}));const yJ=document.getElementById("react-ingredient-search");yJ&&bh.createRoot(yJ).render(b(w.Suspense,{fallback:b(Ba,{}),children:b(th,{theme:xh,children:b(Fst,{})})}));export{vC as c,Fn as g};
+ `}}];return{always:Ob(a,"always"),resting:Ob(a,"resting"),dragging:Ob(a,"dragging"),dropAnimating:Ob(a,"dropAnimating"),userCancel:Ob(a,"userCancel")}};const Ga=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?w.useLayoutEffect:w.useEffect,k$=()=>{const e=document.querySelector("head");return e||vt(),e},NX=e=>{const t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.type="text/css",t};function $0t(e,t){const n=Vn(()=>_0t(e),[e]),r=w.useRef(null),o=w.useRef(null),i=Wt(Yo(d=>{const f=o.current;f||vt(),f.textContent=d}),[]),a=Wt(d=>{const f=r.current;f||vt(),f.textContent=d},[]);Ga(()=>{!r.current&&!o.current||vt();const d=NX(t),f=NX(t);return r.current=d,o.current=f,d.setAttribute(`${sy}-always`,e),f.setAttribute(`${sy}-dynamic`,e),k$().appendChild(d),k$().appendChild(f),a(n.always),i(n.resting),()=>{const h=g=>{const y=g.current;y||vt(),k$().removeChild(y),g.current=null};h(r),h(o)}},[t,a,i,n.always,n.resting,e]);const s=Wt(()=>i(n.dragging),[i,n.dragging]),l=Wt(d=>{if(d==="DROP"){i(n.dropAnimating);return}i(n.userCancel)},[i,n.dropAnimating,n.userCancel]),c=Wt(()=>{o.current&&i(n.resting)},[i,n.resting]);return Vn(()=>({dragging:s,dropping:l,resting:c}),[s,l,c])}function Rde(e,t){return Array.from(e.querySelectorAll(t))}var Dde=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView?e.ownerDocument.defaultView:window;function dO(e){return e instanceof Dde(e).HTMLElement}function N0t(e,t){const n=`[${ly.contextId}="${e}"]`,r=Rde(document,n);if(!r.length)return null;const o=r.find(i=>i.getAttribute(ly.draggableId)===t);return!o||!dO(o)?null:o}function L0t(e){const t=w.useRef({}),n=w.useRef(null),r=w.useRef(null),o=w.useRef(!1),i=Wt(function(f,h){const g={id:f,focus:h};return t.current[f]=g,function(){const v=t.current;v[f]!==g&&delete v[f]}},[]),a=Wt(function(f){const h=N0t(e,f);h&&h!==document.activeElement&&h.focus()},[e]),s=Wt(function(f,h){n.current===f&&(n.current=h)},[]),l=Wt(function(){r.current||o.current&&(r.current=requestAnimationFrame(()=>{r.current=null;const f=n.current;f&&a(f)}))},[a]),c=Wt(function(f){n.current=null;const h=document.activeElement;h&&h.getAttribute(ly.draggableId)===f&&(n.current=f)},[]);return Ga(()=>(o.current=!0,function(){o.current=!1;const f=r.current;f&&cancelAnimationFrame(f)}),[]),Vn(()=>({register:i,tryRecordFocus:c,tryRestoreFocusRecorded:l,tryShiftRecord:s}),[i,c,l,s])}function F0t(){const e={draggables:{},droppables:{}},t=[];function n(d){return t.push(d),function(){const h=t.indexOf(d);h!==-1&&t.splice(h,1)}}function r(d){t.length&&t.forEach(f=>f(d))}function o(d){return e.draggables[d]||null}function i(d){const f=o(d);return f||vt(),f}const a={register:d=>{e.draggables[d.descriptor.id]=d,r({type:"ADDITION",value:d})},update:(d,f)=>{const h=e.draggables[f.descriptor.id];h&&h.uniqueId===d.uniqueId&&(delete e.draggables[f.descriptor.id],e.draggables[d.descriptor.id]=d)},unregister:d=>{const f=d.descriptor.id,h=o(f);h&&d.uniqueId===h.uniqueId&&(delete e.draggables[f],e.droppables[d.descriptor.droppableId]&&r({type:"REMOVAL",value:d}))},getById:i,findById:o,exists:d=>!!o(d),getAllByType:d=>Object.values(e.draggables).filter(f=>f.descriptor.type===d)};function s(d){return e.droppables[d]||null}function l(d){const f=s(d);return f||vt(),f}const c={register:d=>{e.droppables[d.descriptor.id]=d},unregister:d=>{const f=s(d.descriptor.id);f&&d.uniqueId===f.uniqueId&&delete e.droppables[d.descriptor.id]},getById:l,findById:s,exists:d=>!!s(d),getAllByType:d=>Object.values(e.droppables).filter(f=>f.descriptor.type===d)};function u(){e.draggables={},e.droppables={},t.length=0}return{draggable:a,droppable:c,subscribe:n,clean:u}}function j0t(){const e=Vn(F0t,[]);return w.useEffect(()=>function(){e.clean()},[e]),e}var vV=X.createContext(null),ZP=()=>{const e=document.body;return e||vt(),e};const B0t={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"},z0t=e=>`rfd-announcement-${e}`;function V0t(e){const t=Vn(()=>z0t(e),[e]),n=w.useRef(null);return w.useEffect(function(){const i=document.createElement("div");return n.current=i,i.id=t,i.setAttribute("aria-live","assertive"),i.setAttribute("aria-atomic","true"),YP(i.style,B0t),ZP().appendChild(i),function(){setTimeout(function(){const l=ZP();l.contains(i)&&l.removeChild(i),i===n.current&&(n.current=null)})}},[t]),Wt(o=>{const i=n.current;if(i){i.textContent=o;return}},[])}const H0t={separator:"::"};function bV(e,t=H0t){const n=X.useId();return Vn(()=>`${e}${t.separator}${n}`,[t.separator,e,n])}function U0t({contextId:e,uniqueId:t}){return`rfd-hidden-text-${e}-${t}`}function W0t({contextId:e,text:t}){const n=bV("hidden-text",{separator:"-"}),r=Vn(()=>U0t({contextId:e,uniqueId:n}),[n,e]);return w.useEffect(function(){const i=document.createElement("div");return i.id=r,i.textContent=t,i.style.display="none",ZP().appendChild(i),function(){const s=ZP();s.contains(i)&&s.removeChild(i)}},[r,t]),r}var fO=X.createContext(null);function _de(e){const t=w.useRef(e);return w.useEffect(()=>{t.current=e}),t}function G0t(){let e=null;function t(){return!!e}function n(a){return a===e}function r(a){e&&vt();const s={abandon:a};return e=s,s}function o(){e||vt(),e=null}function i(){e&&(e.abandon(),o())}return{isClaimed:t,isActive:n,claim:r,release:o,tryAbandon:i}}function qx(e){return e.phase==="IDLE"||e.phase==="DROP_ANIMATING"?!1:e.isDragging}const q0t=9,K0t=13,wV=27,$de=32,Y0t=33,Q0t=34,X0t=35,J0t=36,Z0t=37,eSt=38,tSt=39,nSt=40,rSt={[K0t]:!0,[q0t]:!0};var Nde=e=>{rSt[e.keyCode]&&e.preventDefault()};const pO=(()=>{const e="visibilitychange";return typeof document>"u"?e:[e,`ms${e}`,`webkit${e}`,`moz${e}`,`o${e}`].find(r=>`on${r}`in document)||e})(),Lde=0,LX=5;function oSt(e,t){return Math.abs(t.x-e.x)>=LX||Math.abs(t.y-e.y)>=LX}const FX={type:"IDLE"};function iSt({cancel:e,completed:t,getPhase:n,setPhase:r}){return[{eventName:"mousemove",fn:o=>{const{button:i,clientX:a,clientY:s}=o;if(i!==Lde)return;const l={x:a,y:s},c=n();if(c.type==="DRAGGING"){o.preventDefault(),c.actions.move(l);return}c.type!=="PENDING"&&vt();const u=c.point;if(!oSt(u,l))return;o.preventDefault();const d=c.actions.fluidLift(l);r({type:"DRAGGING",actions:d})}},{eventName:"mouseup",fn:o=>{const i=n();if(i.type!=="DRAGGING"){e();return}o.preventDefault(),i.actions.drop({shouldBlockNextClick:!0}),t()}},{eventName:"mousedown",fn:o=>{n().type==="DRAGGING"&&o.preventDefault(),e()}},{eventName:"keydown",fn:o=>{if(n().type==="PENDING"){e();return}if(o.keyCode===wV){o.preventDefault(),e();return}Nde(o)}},{eventName:"resize",fn:e},{eventName:"scroll",options:{passive:!0,capture:!1},fn:()=>{n().type==="PENDING"&&e()}},{eventName:"webkitmouseforcedown",fn:o=>{const i=n();if(i.type==="IDLE"&&vt(),i.actions.shouldRespectForcePress()){e();return}o.preventDefault()}},{eventName:pO,fn:e}]}function aSt(e){const t=w.useRef(FX),n=w.useRef(Kd),r=Vn(()=>({eventName:"mousedown",fn:function(d){if(d.defaultPrevented||d.button!==Lde||d.ctrlKey||d.metaKey||d.shiftKey||d.altKey)return;const f=e.findClosestDraggableId(d);if(!f)return;const h=e.tryGetLock(f,a,{sourceEvent:d});if(!h)return;d.preventDefault();const g={x:d.clientX,y:d.clientY};n.current(),c(h,g)}}),[e]),o=Vn(()=>({eventName:"webkitmouseforcewillbegin",fn:u=>{if(u.defaultPrevented)return;const d=e.findClosestDraggableId(u);if(!d)return;const f=e.findOptionsForDraggable(d);f&&(f.shouldRespectForcePress||e.canGetLock(d)&&u.preventDefault())}}),[e]),i=Wt(function(){const d={passive:!1,capture:!0};n.current=$s(window,[o,r],d)},[o,r]),a=Wt(()=>{t.current.type!=="IDLE"&&(t.current=FX,n.current(),i())},[i]),s=Wt(()=>{const u=t.current;a(),u.type==="DRAGGING"&&u.actions.cancel({shouldBlockNextClick:!0}),u.type==="PENDING"&&u.actions.abort()},[a]),l=Wt(function(){const d={capture:!0,passive:!1},f=iSt({cancel:s,completed:a,getPhase:()=>t.current,setPhase:h=>{t.current=h}});n.current=$s(window,f,d)},[s,a]),c=Wt(function(d,f){t.current.type!=="IDLE"&&vt(),t.current={type:"PENDING",point:f,actions:d},l()},[l]);Ga(function(){return i(),function(){n.current()}},[i])}function sSt(){}const lSt={[Q0t]:!0,[Y0t]:!0,[J0t]:!0,[X0t]:!0};function cSt(e,t){function n(){t(),e.cancel()}function r(){t(),e.drop()}return[{eventName:"keydown",fn:o=>{if(o.keyCode===wV){o.preventDefault(),n();return}if(o.keyCode===$de){o.preventDefault(),r();return}if(o.keyCode===nSt){o.preventDefault(),e.moveDown();return}if(o.keyCode===eSt){o.preventDefault(),e.moveUp();return}if(o.keyCode===tSt){o.preventDefault(),e.moveRight();return}if(o.keyCode===Z0t){o.preventDefault(),e.moveLeft();return}if(lSt[o.keyCode]){o.preventDefault();return}Nde(o)}},{eventName:"mousedown",fn:n},{eventName:"mouseup",fn:n},{eventName:"click",fn:n},{eventName:"touchstart",fn:n},{eventName:"resize",fn:n},{eventName:"wheel",fn:n,options:{passive:!0}},{eventName:pO,fn:n}]}function uSt(e){const t=w.useRef(sSt),n=Vn(()=>({eventName:"keydown",fn:function(i){if(i.defaultPrevented||i.keyCode!==$de)return;const a=e.findClosestDraggableId(i);if(!a)return;const s=e.tryGetLock(a,u,{sourceEvent:i});if(!s)return;i.preventDefault();let l=!0;const c=s.snapLift();t.current();function u(){l||vt(),l=!1,t.current(),r()}t.current=$s(window,cSt(c,u),{capture:!0,passive:!1})}}),[e]),r=Wt(function(){const i={passive:!1,capture:!0};t.current=$s(window,[n],i)},[n]);Ga(function(){return r(),function(){t.current()}},[r])}const M$={type:"IDLE"},dSt=120,fSt=.15;function pSt({cancel:e,getPhase:t}){return[{eventName:"orientationchange",fn:e},{eventName:"resize",fn:e},{eventName:"contextmenu",fn:n=>{n.preventDefault()}},{eventName:"keydown",fn:n=>{if(t().type!=="DRAGGING"){e();return}n.keyCode===wV&&n.preventDefault(),e()}},{eventName:pO,fn:e}]}function hSt({cancel:e,completed:t,getPhase:n}){return[{eventName:"touchmove",options:{capture:!1},fn:r=>{const o=n();if(o.type!=="DRAGGING"){e();return}o.hasMoved=!0;const{clientX:i,clientY:a}=r.touches[0],s={x:i,y:a};r.preventDefault(),o.actions.move(s)}},{eventName:"touchend",fn:r=>{const o=n();if(o.type!=="DRAGGING"){e();return}r.preventDefault(),o.actions.drop({shouldBlockNextClick:!0}),t()}},{eventName:"touchcancel",fn:r=>{if(n().type!=="DRAGGING"){e();return}r.preventDefault(),e()}},{eventName:"touchforcechange",fn:r=>{const o=n();o.type==="IDLE"&&vt();const i=r.touches[0];if(!i||!(i.force>=fSt))return;const s=o.actions.shouldRespectForcePress();if(o.type==="PENDING"){s&&e();return}if(s){if(o.hasMoved){r.preventDefault();return}e();return}r.preventDefault()}},{eventName:pO,fn:e}]}function mSt(e){const t=w.useRef(M$),n=w.useRef(Kd),r=Wt(function(){return t.current},[]),o=Wt(function(h){t.current=h},[]),i=Vn(()=>({eventName:"touchstart",fn:function(h){if(h.defaultPrevented)return;const g=e.findClosestDraggableId(h);if(!g)return;const y=e.tryGetLock(g,s,{sourceEvent:h});if(!y)return;const v=h.touches[0],{clientX:x,clientY:S}=v,C={x,y:S};n.current(),d(y,C)}}),[e]),a=Wt(function(){const h={capture:!0,passive:!1};n.current=$s(window,[i],h)},[i]),s=Wt(()=>{const f=t.current;f.type!=="IDLE"&&(f.type==="PENDING"&&clearTimeout(f.longPressTimerId),o(M$),n.current(),a())},[a,o]),l=Wt(()=>{const f=t.current;s(),f.type==="DRAGGING"&&f.actions.cancel({shouldBlockNextClick:!0}),f.type==="PENDING"&&f.actions.abort()},[s]),c=Wt(function(){const h={capture:!0,passive:!1},g={cancel:l,completed:s,getPhase:r},y=$s(window,hSt(g),h),v=$s(window,pSt(g),h);n.current=function(){y(),v()}},[l,r,s]),u=Wt(function(){const h=r();h.type!=="PENDING"&&vt();const g=h.actions.fluidLift(h.point);o({type:"DRAGGING",actions:g,hasMoved:!1})},[r,o]),d=Wt(function(h,g){r().type!=="IDLE"&&vt();const y=setTimeout(u,dSt);o({type:"PENDING",point:g,actions:h,longPressTimerId:y}),c()},[c,r,o,u]);Ga(function(){return a(),function(){n.current();const g=r();g.type==="PENDING"&&(clearTimeout(g.longPressTimerId),o(M$))}},[r,a,o]),Ga(function(){return $s(window,[{eventName:"touchmove",fn:()=>{},options:{capture:!1,passive:!1}}])},[])}const gSt=["input","button","textarea","select","option","optgroup","video","audio"];function Fde(e,t){if(t==null)return!1;if(gSt.includes(t.tagName.toLowerCase()))return!0;const r=t.getAttribute("contenteditable");return r==="true"||r===""?!0:t===e?!1:Fde(e,t.parentElement)}function ySt(e,t){const n=t.target;return dO(n)?Fde(e,n):!1}var vSt=e=>Ol(e.getBoundingClientRect()).center;function bSt(e){return e instanceof Dde(e).Element}const wSt=(()=>{const e="matches";return typeof document>"u"?e:[e,"msMatchesSelector","webkitMatchesSelector"].find(r=>r in Element.prototype)||e})();function jde(e,t){return e==null?null:e[wSt](t)?e:jde(e.parentElement,t)}function xSt(e,t){return e.closest?e.closest(t):jde(e,t)}function SSt(e){return`[${ly.contextId}="${e}"]`}function CSt(e,t){const n=t.target;if(!bSt(n))return null;const r=SSt(e),o=xSt(n,r);return!o||!dO(o)?null:o}function ESt(e,t){const n=CSt(e,t);return n?n.getAttribute(ly.draggableId):null}function PSt(e,t){const n=`[${oF.contextId}="${e}"]`,o=Rde(document,n).find(i=>i.getAttribute(oF.id)===t);return!o||!dO(o)?null:o}function ISt(e){e.preventDefault()}function h1({expected:e,phase:t,isLockActive:n,shouldWarn:r}){return!(!n()||e!==t)}function Bde({lockAPI:e,store:t,registry:n,draggableId:r}){if(e.isClaimed())return!1;const o=n.draggable.findById(r);return!(!o||!o.options.isEnabled||!Ode(t.getState(),r))}function TSt({lockAPI:e,contextId:t,store:n,registry:r,draggableId:o,forceSensorStop:i,sourceEvent:a}){if(!Bde({lockAPI:e,store:n,registry:r,draggableId:o}))return null;const l=r.draggable.getById(o),c=PSt(t,l.descriptor.id);if(!c||a&&!l.options.canDragInteractiveElements&&ySt(c,a))return null;const u=e.claim(i||Kd);let d="PRE_DRAG";function f(){return l.options.shouldRespectForcePress}function h(){return e.isActive(u)}function g(E,T){h1({expected:E,phase:d,isLockActive:h,shouldWarn:!0})&&n.dispatch(T())}const y=g.bind(null,"DRAGGING");function v(E){function T(){e.release(),d="COMPLETED"}d!=="PRE_DRAG"&&(T(),vt()),n.dispatch(xxt(E.liftActionArgs)),d="DRAGGING";function O(A,k={shouldBlockNextClick:!1}){if(E.cleanup(),k.shouldBlockNextClick){const M=$s(window,[{eventName:"click",fn:ISt,options:{once:!0,passive:!1,capture:!0}}]);setTimeout(M)}T(),n.dispatch(wde({reason:A}))}return{isActive:()=>h1({expected:"DRAGGING",phase:d,isLockActive:h,shouldWarn:!1}),shouldRespectForcePress:f,drop:A=>O("DROP",A),cancel:A=>O("CANCEL",A),...E.actions}}function x(E){const T=zx(A=>{y(()=>bde({client:A}))});return{...v({liftActionArgs:{id:o,clientSelection:E,movementMode:"FLUID"},cleanup:()=>T.cancel(),actions:{move:T}}),move:T}}function S(){const E={moveUp:()=>y(Mxt),moveRight:()=>y(Rxt),moveDown:()=>y(Axt),moveLeft:()=>y(Dxt)};return v({liftActionArgs:{id:o,clientSelection:vSt(c),movementMode:"SNAP"},cleanup:Kd,actions:E})}function C(){h1({expected:"PRE_DRAG",phase:d,isLockActive:h,shouldWarn:!0})&&e.release()}return{isActive:()=>h1({expected:"PRE_DRAG",phase:d,isLockActive:h,shouldWarn:!1}),shouldRespectForcePress:f,fluidLift:x,snapLift:S,abort:C}}const OSt=[aSt,uSt,mSt];function kSt({contextId:e,store:t,registry:n,customSensors:r,enableDefaultSensors:o}){const i=[...o?OSt:[],...r||[]],a=w.useState(()=>G0t())[0],s=Wt(function(v,x){qx(v)&&!qx(x)&&a.tryAbandon()},[a]);Ga(function(){let v=t.getState();return t.subscribe(()=>{const S=t.getState();s(v,S),v=S})},[a,t,s]),Ga(()=>a.tryAbandon,[a.tryAbandon]);const l=Wt(y=>Bde({lockAPI:a,registry:n,store:t,draggableId:y}),[a,n,t]),c=Wt((y,v,x)=>TSt({lockAPI:a,registry:n,contextId:e,store:t,draggableId:y,forceSensorStop:v||null,sourceEvent:x&&x.sourceEvent?x.sourceEvent:null}),[e,a,n,t]),u=Wt(y=>ESt(e,y),[e]),d=Wt(y=>{const v=n.draggable.findById(y);return v?v.options:null},[n.draggable]),f=Wt(function(){a.isClaimed()&&(a.tryAbandon(),t.getState().phase!=="IDLE"&&t.dispatch(dV()))},[a,t]),h=Wt(()=>a.isClaimed(),[a]),g=Vn(()=>({canGetLock:l,tryGetLock:c,findClosestDraggableId:u,findOptionsForDraggable:d,tryReleaseLock:f,isLockClaimed:h}),[l,c,u,d,f,h]);for(let y=0;y<i.length;y++)i[y](g)}const MSt=e=>({onBeforeCapture:t=>{const n=()=>{e.onBeforeCapture&&e.onBeforeCapture(t)};u0.flushSync(n)},onBeforeDragStart:e.onBeforeDragStart,onDragStart:e.onDragStart,onDragEnd:e.onDragEnd,onDragUpdate:e.onDragUpdate}),ASt=e=>({...Gx,...e.autoScrollerOptions,durationDampening:{...Gx.durationDampening,...e.autoScrollerOptions}});function kb(e){return e.current||vt(),e.current}function RSt(e){const{contextId:t,setCallbacks:n,sensors:r,nonce:o,dragHandleUsageInstructions:i}=e,a=w.useRef(null),s=_de(e),l=Wt(()=>MSt(s.current),[s]),c=Wt(()=>ASt(s.current),[s]),u=V0t(t),d=W0t({contextId:t,text:i}),f=$0t(t,o),h=Wt(M=>{kb(a).dispatch(M)},[]),g=Vn(()=>uX({publishWhileDragging:Cxt,updateDroppableScroll:Pxt,updateDroppableIsEnabled:Ixt,updateDroppableIsCombineEnabled:Txt,collectionStarting:Ext},h),[h]),y=j0t(),v=Vn(()=>p0t(y,g),[y,g]),x=Vn(()=>M0t({scrollWindow:h0t,scrollDroppable:v.scrollDroppable,getAutoScrollerOptions:c,...uX({move:bde},h)}),[v.scrollDroppable,h,c]),S=L0t(t),C=Vn(()=>c0t({announce:u,autoScroller:x,dimensionMarshal:v,focusMarshal:S,getResponders:l,styleMarshal:f}),[u,x,v,S,l,f]);a.current=C;const I=Wt(()=>{const M=kb(a);M.getState().phase!=="IDLE"&&M.dispatch(dV())},[]),E=Wt(()=>{const M=kb(a).getState();return M.phase==="DROP_ANIMATING"?!0:M.phase==="IDLE"?!1:M.isDragging},[]),T=Vn(()=>({isDragging:E,tryAbort:I}),[E,I]);n(T);const O=Wt(M=>Ode(kb(a).getState(),M),[]),A=Wt(()=>rp(kb(a).getState()),[]),k=Vn(()=>({marshal:v,focus:S,contextId:t,canLift:O,isMovementAllowed:A,dragHandleUsageInstructionsId:d,registry:y}),[t,v,d,S,O,A,y]);return kSt({contextId:t,store:C,registry:y,customSensors:r||null,enableDefaultSensors:e.enableDefaultSensors!==!1}),w.useEffect(()=>I,[I]),X.createElement(fO.Provider,{value:k},X.createElement(iwt,{context:vV,store:C},e.children))}function DSt(){return X.useId()}function zde(e){const t=DSt(),n=e.dragHandleUsageInstructions||G1.dragHandleUsageInstructions;return X.createElement(uwt,null,r=>X.createElement(RSt,{nonce:e.nonce,contextId:t,setCallbacks:r,dragHandleUsageInstructions:n,enableDefaultSensors:e.enableDefaultSensors,sensors:e.sensors,onBeforeCapture:e.onBeforeCapture,onBeforeDragStart:e.onBeforeDragStart,onDragStart:e.onDragStart,onDragUpdate:e.onDragUpdate,onDragEnd:e.onDragEnd,autoScrollerOptions:e.autoScrollerOptions},e.children))}const jX={dragging:5e3,dropAnimating:4500},_St=(e,t)=>t?Iw.drop(t.duration):e?Iw.snap:Iw.fluid,$St=(e,t)=>{if(e)return t?Wx.opacity.drop:Wx.opacity.combining},NSt=e=>e.forceShouldAnimate!=null?e.forceShouldAnimate:e.mode==="SNAP";function LSt(e){const n=e.dimension.client,{offset:r,combineWith:o,dropping:i}=e,a=!!o,s=NSt(e),l=!!i,c=l?nF.drop(r,a):nF.moveTo(r);return{position:"fixed",top:n.marginBox.top,left:n.marginBox.left,boxSizing:"border-box",width:n.borderBox.width,height:n.borderBox.height,transition:_St(s,i),transform:c,opacity:$St(a,l),zIndex:l?jX.dropAnimating:jX.dragging,pointerEvents:"none"}}function FSt(e){return{transform:nF.moveTo(e.offset),transition:e.shouldAnimateDisplacement?void 0:"none"}}function jSt(e){return e.type==="DRAGGING"?LSt(e):FSt(e)}function BSt(e,t,n=Qo){const r=window.getComputedStyle(t),o=t.getBoundingClientRect(),i=que(o,r),a=KP(i,n),s={client:i,tagName:t.tagName.toLowerCase(),display:r.display},l={x:i.marginBox.width,y:i.marginBox.height};return{descriptor:e,placeholder:s,displaceBy:l,client:i,page:a}}function zSt(e){const t=bV("draggable"),{descriptor:n,registry:r,getDraggableRef:o,canDragInteractiveElements:i,shouldRespectForcePress:a,isEnabled:s}=e,l=Vn(()=>({canDragInteractiveElements:i,shouldRespectForcePress:a,isEnabled:s}),[i,s,a]),c=Wt(h=>{const g=o();return g||vt(),BSt(n,g,h)},[n,o]),u=Vn(()=>({uniqueId:t,descriptor:n,options:l,getDimension:c}),[n,c,l,t]),d=w.useRef(u),f=w.useRef(!0);Ga(()=>(r.draggable.register(d.current),()=>r.draggable.unregister(d.current)),[r.draggable]),Ga(()=>{if(f.current){f.current=!1;return}const h=d.current;d.current=u,r.draggable.update(u,h)},[u,r.draggable])}var xV=X.createContext(null);function eI(e){const t=w.useContext(e);return t||vt(),t}function VSt(e){e.preventDefault()}const HSt=e=>{const t=w.useRef(null),n=Wt((T=null)=>{t.current=T},[]),r=Wt(()=>t.current,[]),{contextId:o,dragHandleUsageInstructionsId:i,registry:a}=eI(fO),{type:s,droppableId:l}=eI(xV),c=Vn(()=>({id:e.draggableId,index:e.index,type:s,droppableId:l}),[e.draggableId,e.index,s,l]),{children:u,draggableId:d,isEnabled:f,shouldRespectForcePress:h,canDragInteractiveElements:g,isClone:y,mapped:v,dropAnimationFinished:x}=e;if(!y){const T=Vn(()=>({descriptor:c,registry:a,getDraggableRef:r,canDragInteractiveElements:g,shouldRespectForcePress:h,isEnabled:f}),[c,a,r,g,h,f]);zSt(T)}const S=Vn(()=>f?{tabIndex:0,role:"button","aria-describedby":i,"data-rfd-drag-handle-draggable-id":d,"data-rfd-drag-handle-context-id":o,draggable:!1,onDragStart:VSt}:null,[o,i,d,f]),C=Wt(T=>{v.type==="DRAGGING"&&v.dropping&&T.propertyName==="transform"&&u0.flushSync(x)},[x,v]),I=Vn(()=>{const T=jSt(v),O=v.type==="DRAGGING"&&v.dropping?C:void 0;return{innerRef:n,draggableProps:{"data-rfd-draggable-context-id":o,"data-rfd-draggable-id":d,style:T,onTransitionEnd:O},dragHandleProps:S}},[o,S,d,v,C,n]),E=Vn(()=>({draggableId:c.id,type:c.type,source:{index:c.index,droppableId:c.droppableId}}),[c.droppableId,c.id,c.index,c.type]);return X.createElement(X.Fragment,null,u(I,v.snapshot,E))};var Vde=(e,t)=>e===t,Hde=e=>{const{combine:t,destination:n}=e;return n?n.droppableId:t?t.droppableId:null};const USt=e=>e.combine?e.combine.draggableId:null,WSt=e=>e.at&&e.at.type==="COMBINE"?e.at.combine.draggableId:null;function GSt(){const e=Yo((o,i)=>({x:o,y:i})),t=Yo((o,i,a=null,s=null,l=null)=>({isDragging:!0,isClone:i,isDropAnimating:!!l,dropAnimation:l,mode:o,draggingOver:a,combineWith:s,combineTargetFor:null})),n=Yo((o,i,a,s,l=null,c=null,u=null)=>({mapped:{type:"DRAGGING",dropping:null,draggingOver:l,combineWith:c,mode:i,offset:o,dimension:a,forceShouldAnimate:u,snapshot:t(i,s,l,c,null)}}));return(o,i)=>{if(qx(o)){if(o.critical.draggable.id!==i.draggableId)return null;const a=o.current.client.offset,s=o.dimensions.draggables[i.draggableId],l=Wa(o.impact),c=WSt(o.impact),u=o.forceShouldAnimate;return n(e(a.x,a.y),o.movementMode,s,i.isClone,l,c,u)}if(o.phase==="DROP_ANIMATING"){const a=o.completed;if(a.result.draggableId!==i.draggableId)return null;const s=i.isClone,l=o.dimensions.draggables[i.draggableId],c=a.result,u=c.mode,d=Hde(c),f=USt(c),g={duration:o.dropDuration,curve:pV.drop,moveTo:o.newHomeClientOffset,opacity:f?Wx.opacity.drop:null,scale:f?Wx.scale.drop:null};return{mapped:{type:"DRAGGING",offset:o.newHomeClientOffset,dimension:l,dropping:g,draggingOver:d,combineWith:f,mode:u,forceShouldAnimate:null,snapshot:t(u,s,d,f,g)}}}return null}}function Ude(e=null){return{isDragging:!1,isDropAnimating:!1,isClone:!1,dropAnimation:null,mode:null,draggingOver:null,combineTargetFor:e,combineWith:null}}const qSt={mapped:{type:"SECONDARY",offset:Qo,combineTargetFor:null,shouldAnimateDisplacement:!0,snapshot:Ude(null)}};function KSt(){const e=Yo((a,s)=>({x:a,y:s})),t=Yo(Ude),n=Yo((a,s=null,l)=>({mapped:{type:"SECONDARY",offset:a,combineTargetFor:s,shouldAnimateDisplacement:l,snapshot:t(s)}})),r=a=>a?n(Qo,a,!0):null,o=(a,s,l,c)=>{const u=l.displaced.visible[a],d=!!(c.inVirtualList&&c.effected[a]),f=lO(l),h=f&&f.draggableId===a?s:null;if(!u){if(!d)return r(h);if(l.displaced.invisible[a])return null;const v=lv(c.displacedBy.point),x=e(v.x,v.y);return n(x,h,!0)}if(d)return r(h);const g=l.displacedBy.point,y=e(g.x,g.y);return n(y,h,u.shouldAnimate)};return(a,s)=>{if(qx(a))return a.critical.draggable.id===s.draggableId?null:o(s.draggableId,a.critical.draggable.id,a.impact,a.afterCritical);if(a.phase==="DROP_ANIMATING"){const l=a.completed;return l.result.draggableId===s.draggableId?null:o(s.draggableId,l.result.draggableId,l.impact,l.afterCritical)}return null}}const YSt=()=>{const e=GSt(),t=KSt();return(r,o)=>e(r,o)||t(r,o)||qSt},QSt={dropAnimationFinished:xde},XSt=Gue(YSt,QSt,null,{context:vV,areStatePropsEqual:Vde})(HSt);function Wde(e){return eI(xV).isUsingCloneFor===e.draggableId&&!e.isClone?null:X.createElement(XSt,e)}function Gde(e){const t=typeof e.isDragDisabled=="boolean"?!e.isDragDisabled:!0,n=!!e.disableInteractiveElementBlocking,r=!!e.shouldRespectForcePress;return X.createElement(Wde,YP({},e,{isClone:!1,isEnabled:t,canDragInteractiveElements:n,shouldRespectForcePress:r}))}const qde=e=>t=>e===t,JSt=qde("scroll"),ZSt=qde("auto"),BX=(e,t)=>t(e.overflowX)||t(e.overflowY),eCt=e=>{const t=window.getComputedStyle(e),n={overflowX:t.overflowX,overflowY:t.overflowY};return BX(n,JSt)||BX(n,ZSt)},tCt=()=>!1,Kde=e=>e==null?null:e===document.body?tCt()?e:null:e===document.documentElement?null:eCt(e)?e:Kde(e.parentElement);var iF=e=>({x:e.scrollLeft,y:e.scrollTop});const Yde=e=>e?window.getComputedStyle(e).position==="fixed"?!0:Yde(e.parentElement):!1;var nCt=e=>{const t=Kde(e),n=Yde(e);return{closestScrollable:t,isFixedOnPage:n}},rCt=({descriptor:e,isEnabled:t,isCombineEnabled:n,isFixedOnPage:r,direction:o,client:i,page:a,closest:s})=>{const l=(()=>{if(!s)return null;const{scrollSize:f,client:h}=s,g=Pde({scrollHeight:f.scrollHeight,scrollWidth:f.scrollWidth,height:h.paddingBox.height,width:h.paddingBox.width});return{pageMarginBox:s.page.marginBox,frameClient:h,scrollSize:f,shouldClipSubject:s.shouldClipSubject,scroll:{initial:s.scroll,current:s.scroll,max:g,diff:{value:Qo,displacement:Qo}}}})(),c=o==="vertical"?aV:ode,u=ay({page:a,withPlaceholder:null,axis:c,frame:l});return{descriptor:e,isCombineEnabled:n,isFixedOnPage:r,axis:c,isEnabled:t,client:i,page:a,frame:l,subject:u}};const oCt=(e,t)=>{const n=Kue(e);if(!t||e!==t)return n;const r=n.paddingBox.top-t.scrollTop,o=n.paddingBox.left-t.scrollLeft,i=r+t.scrollHeight,a=o+t.scrollWidth,l=nV({top:r,right:a,bottom:i,left:o},n.border);return rV({borderBox:l,margin:n.margin,border:n.border,padding:n.padding})};var iCt=({ref:e,descriptor:t,env:n,windowScroll:r,direction:o,isDropDisabled:i,isCombineEnabled:a,shouldClipSubject:s})=>{const l=n.closestScrollable,c=oCt(e,l),u=KP(c,r),d=(()=>{if(!l)return null;const h=Kue(l),g={scrollHeight:l.scrollHeight,scrollWidth:l.scrollWidth};return{client:h,page:KP(h,r),scroll:iF(l),scrollSize:g,shouldClipSubject:s}})();return rCt({descriptor:t,isEnabled:!i,isCombineEnabled:a,isFixedOnPage:n.isFixedOnPage,direction:o,client:c,page:u,closest:d})};const aCt={passive:!1},sCt={passive:!0};var zX=e=>e.shouldPublishImmediately?aCt:sCt;const m1=e=>e&&e.env.closestScrollable||null;function lCt(e){const t=w.useRef(null),n=eI(fO),r=bV("droppable"),{registry:o,marshal:i}=n,a=_de(e),s=Vn(()=>({id:e.droppableId,type:e.type,mode:e.mode}),[e.droppableId,e.mode,e.type]),l=w.useRef(s),c=Vn(()=>Yo((I,E)=>{t.current||vt();const T={x:I,y:E};i.updateDroppableScroll(s.id,T)}),[s.id,i]),u=Wt(()=>{const I=t.current;return!I||!I.env.closestScrollable?Qo:iF(I.env.closestScrollable)},[]),d=Wt(()=>{const I=u();c(I.x,I.y)},[u,c]),f=Vn(()=>zx(d),[d]),h=Wt(()=>{const I=t.current,E=m1(I);if(I&&E||vt(),I.scrollOptions.shouldPublishImmediately){d();return}f()},[f,d]),g=Wt((I,E)=>{t.current&&vt();const T=a.current,O=T.getDroppableRef();O||vt();const A=nCt(O),k={ref:O,descriptor:s,env:A,scrollOptions:E};t.current=k;const M=iCt({ref:O,descriptor:s,env:A,windowScroll:I,direction:T.direction,isDropDisabled:T.isDropDisabled,isCombineEnabled:T.isCombineEnabled,shouldClipSubject:!T.ignoreContainerClipping}),R=A.closestScrollable;return R&&(R.setAttribute($X.contextId,n.contextId),R.addEventListener("scroll",h,zX(k.scrollOptions))),M},[n.contextId,s,h,a]),y=Wt(()=>{const I=t.current,E=m1(I);return I&&E||vt(),iF(E)},[]),v=Wt(()=>{const I=t.current;I||vt();const E=m1(I);t.current=null,E&&(f.cancel(),E.removeAttribute($X.contextId),E.removeEventListener("scroll",h,zX(I.scrollOptions)))},[h,f]),x=Wt(I=>{const E=t.current;E||vt();const T=m1(E);T||vt(),T.scrollTop+=I.y,T.scrollLeft+=I.x},[]),S=Vn(()=>({getDimensionAndWatchScroll:g,getScrollWhileDragging:y,dragStopped:v,scroll:x}),[v,g,y,x]),C=Vn(()=>({uniqueId:r,descriptor:s,callbacks:S}),[S,s,r]);Ga(()=>(l.current=C.descriptor,o.droppable.register(C),()=>{t.current&&v(),o.droppable.unregister(C)}),[S,s,v,C,i,o.droppable]),Ga(()=>{t.current&&i.updateDroppableIsEnabled(l.current.id,!e.isDropDisabled)},[e.isDropDisabled,i]),Ga(()=>{t.current&&i.updateDroppableIsCombineEnabled(l.current.id,e.isCombineEnabled)},[e.isCombineEnabled,i])}function A$(){}const VX={width:0,height:0,margin:ywt},cCt=({isAnimatingOpenOnMount:e,placeholder:t,animate:n})=>e||n==="close"?VX:{height:t.client.borderBox.height,width:t.client.borderBox.width,margin:t.client.margin},uCt=({isAnimatingOpenOnMount:e,placeholder:t,animate:n})=>{const r=cCt({isAnimatingOpenOnMount:e,placeholder:t,animate:n});return{display:t.display,boxSizing:"border-box",width:r.width,height:r.height,marginTop:r.margin.top,marginRight:r.margin.right,marginBottom:r.margin.bottom,marginLeft:r.margin.left,flexShrink:"0",flexGrow:"0",pointerEvents:"none",transition:n!=="none"?Iw.placeholder:null}},dCt=e=>{const t=w.useRef(null),n=Wt(()=>{t.current&&(clearTimeout(t.current),t.current=null)},[]),{animate:r,onTransitionEnd:o,onClose:i,contextId:a}=e,[s,l]=w.useState(e.animate==="open");w.useEffect(()=>s?r!=="open"?(n(),l(!1),A$):t.current?A$:(t.current=setTimeout(()=>{t.current=null,l(!1)}),n):A$,[r,s,n]);const c=Wt(d=>{d.propertyName==="height"&&(o(),r==="close"&&i())},[r,i,o]),u=uCt({isAnimatingOpenOnMount:s,animate:e.animate,placeholder:e.placeholder});return X.createElement(e.placeholder.tagName,{style:u,"data-rfd-placeholder-context-id":a,onTransitionEnd:c,ref:e.innerRef})};var fCt=X.memo(dCt);class pCt extends X.PureComponent{constructor(...t){super(...t),this.state={isVisible:!!this.props.on,data:this.props.on,animate:this.props.shouldAnimate&&this.props.on?"open":"none"},this.onClose=()=>{this.state.animate==="close"&&this.setState({isVisible:!1})}}static getDerivedStateFromProps(t,n){return t.shouldAnimate?t.on?{isVisible:!0,data:t.on,animate:"open"}:n.isVisible?{isVisible:!0,data:n.data,animate:"close"}:{isVisible:!1,animate:"close",data:null}:{isVisible:!!t.on,data:t.on,animate:"none"}}render(){if(!this.state.isVisible)return null;const t={onClose:this.onClose,data:this.state.data,animate:this.state.animate};return this.props.children(t)}}const hCt=e=>{const t=w.useContext(fO);t||vt();const{contextId:n,isMovementAllowed:r}=t,o=w.useRef(null),i=w.useRef(null),{children:a,droppableId:s,type:l,mode:c,direction:u,ignoreContainerClipping:d,isDropDisabled:f,isCombineEnabled:h,snapshot:g,useClone:y,updateViewportMaxScroll:v,getContainerForClone:x}=e,S=Wt(()=>o.current,[]),C=Wt((R=null)=>{o.current=R},[]);Wt(()=>i.current,[]);const I=Wt((R=null)=>{i.current=R},[]),E=Wt(()=>{r()&&v({maxScroll:Tde()})},[r,v]);lCt({droppableId:s,type:l,mode:c,direction:u,isDropDisabled:f,isCombineEnabled:h,ignoreContainerClipping:d,getDroppableRef:S});const T=Vn(()=>X.createElement(pCt,{on:e.placeholder,shouldAnimate:e.shouldAnimatePlaceholder},({onClose:R,data:$,animate:L})=>X.createElement(fCt,{placeholder:$,onClose:R,innerRef:I,animate:L,contextId:n,onTransitionEnd:E})),[n,E,e.placeholder,e.shouldAnimatePlaceholder,I]),O=Vn(()=>({innerRef:C,placeholder:T,droppableProps:{"data-rfd-droppable-id":s,"data-rfd-droppable-context-id":n}}),[n,s,T,C]),A=y?y.dragging.draggableId:null,k=Vn(()=>({droppableId:s,type:l,isUsingCloneFor:A}),[s,A,l]);function M(){if(!y)return null;const{dragging:R,render:$}=y,L=X.createElement(Wde,{draggableId:R.draggableId,index:R.source.index,isClone:!0,isEnabled:!0,shouldRespectForcePress:!1,canDragInteractiveElements:!0},(z,N)=>$(z,N,R));return Lb.createPortal(L,x())}return X.createElement(xV.Provider,{value:k},a(O,g),M())};function mCt(){return document.body||vt(),document.body}const HX={mode:"standard",type:"DEFAULT",direction:"vertical",isDropDisabled:!1,isCombineEnabled:!1,ignoreContainerClipping:!1,renderClone:null,getContainerForClone:mCt},Qde=e=>{let t={...e},n;for(n in HX)e[n]===void 0&&(t={...t,[n]:HX[n]});return t},R$=(e,t)=>e===t.droppable.type,UX=(e,t)=>t.draggables[e.draggable.id],gCt=()=>{const e={placeholder:null,shouldAnimatePlaceholder:!0,snapshot:{isDraggingOver:!1,draggingOverWith:null,draggingFromThisWith:null,isUsingPlaceholder:!1},useClone:null},t={...e,shouldAnimatePlaceholder:!1},n=Yo(i=>({draggableId:i.id,type:i.type,source:{index:i.index,droppableId:i.droppableId}})),r=Yo((i,a,s,l,c,u)=>{const d=c.descriptor.id;if(c.descriptor.droppableId===i){const g=u?{render:u,dragging:n(c.descriptor)}:null,y={isDraggingOver:s,draggingOverWith:s?d:null,draggingFromThisWith:d,isUsingPlaceholder:!0};return{placeholder:c.placeholder,shouldAnimatePlaceholder:!1,snapshot:y,useClone:g}}if(!a)return t;if(!l)return e;const h={isDraggingOver:s,draggingOverWith:d,draggingFromThisWith:null,isUsingPlaceholder:!0};return{placeholder:c.placeholder,shouldAnimatePlaceholder:!0,snapshot:h,useClone:null}});return(i,a)=>{const s=Qde(a),l=s.droppableId,c=s.type,u=!s.isDropDisabled,d=s.renderClone;if(qx(i)){const f=i.critical;if(!R$(c,f))return t;const h=UX(f,i.dimensions),g=Wa(i.impact)===l;return r(l,u,g,g,h,d)}if(i.phase==="DROP_ANIMATING"){const f=i.completed;if(!R$(c,f.critical))return t;const h=UX(f.critical,i.dimensions);return r(l,u,Hde(f.result)===l,Wa(f.impact)===l,h,d)}if(i.phase==="IDLE"&&i.completed&&!i.shouldFlush){const f=i.completed;if(!R$(c,f.critical))return t;const h=Wa(f.impact)===l,g=!!(f.impact.at&&f.impact.at.type==="COMBINE"),y=f.critical.droppable.id===l;return h?g?e:t:y?e:t}return t}},yCt={updateViewportMaxScroll:kxt},Xde=Gue(gCt,yCt,(e,t,n)=>({...Qde(n),...e,...t}),{context:vV,areStatePropsEqual:Vde})(hCt);function vCt(e){return je("MuiLoadingButton",e)}const Xc=Be("MuiLoadingButton",["root","label","loading","loadingIndicator","loadingIndicatorCenter","loadingIndicatorStart","loadingIndicatorEnd","endIconLoadingEnd","startIconLoadingStart"]),bCt=e=>{const{loading:t,loadingPosition:n,classes:r}=e,o={root:["root",t&&"loading"],label:["label"],startIcon:[t&&`startIconLoading${we(n)}`],endIcon:[t&&`endIconLoading${we(n)}`],loadingIndicator:["loadingIndicator",t&&`loadingIndicator${we(n)}`]},i=Oe(o,vCt,r);return{...r,...i}},wCt=e=>e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"&&e!=="classes",xCt=se(at,{shouldForwardProp:e=>wCt(e)||e==="classes",name:"MuiLoadingButton",slot:"Root",overridesResolver:(e,t)=>[t.root,t.startIconLoadingStart&&{[`& .${Xc.startIconLoadingStart}`]:t.startIconLoadingStart},t.endIconLoadingEnd&&{[`& .${Xc.endIconLoadingEnd}`]:t.endIconLoadingEnd}]})(rt(({theme:e})=>({display:"inline-flex",[`& .${Xc.startIconLoadingStart}, & .${Xc.endIconLoadingEnd}`]:{transition:e.transitions.create(["opacity"],{duration:e.transitions.duration.short}),opacity:0},variants:[{props:{loadingPosition:"center"},style:{transition:e.transitions.create(["background-color","box-shadow","border-color"],{duration:e.transitions.duration.short}),[`&.${Xc.loading}`]:{color:"transparent"}}},{props:({ownerState:t})=>t.loadingPosition==="start"&&t.fullWidth,style:{[`& .${Xc.startIconLoadingStart}, & .${Xc.endIconLoadingEnd}`]:{transition:e.transitions.create(["opacity"],{duration:e.transitions.duration.short}),opacity:0,marginRight:-8}}},{props:({ownerState:t})=>t.loadingPosition==="end"&&t.fullWidth,style:{[`& .${Xc.startIconLoadingStart}, & .${Xc.endIconLoadingEnd}`]:{transition:e.transitions.create(["opacity"],{duration:e.transitions.duration.short}),opacity:0,marginLeft:-8}}}]}))),SCt=se("span",{name:"MuiLoadingButton",slot:"LoadingIndicator",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.loadingIndicator,t[`loadingIndicator${we(n.loadingPosition)}`]]}})(rt(({theme:e})=>({position:"absolute",visibility:"visible",display:"flex",variants:[{props:{loadingPosition:"start",size:"small"},style:{left:10}},{props:({loadingPosition:t,ownerState:n})=>t==="start"&&n.size!=="small",style:{left:14}},{props:{variant:"text",loadingPosition:"start"},style:{left:6}},{props:{loadingPosition:"center"},style:{left:"50%",transform:"translate(-50%)",color:(e.vars||e).palette.action.disabled}},{props:{loadingPosition:"end",size:"small"},style:{right:10}},{props:({loadingPosition:t,ownerState:n})=>t==="end"&&n.size!=="small",style:{right:14}},{props:{variant:"text",loadingPosition:"end"},style:{right:6}},{props:({ownerState:t})=>t.loadingPosition==="start"&&t.fullWidth,style:{position:"relative",left:-10}},{props:({ownerState:t})=>t.loadingPosition==="end"&&t.fullWidth,style:{position:"relative",right:-10}}]}))),WX=se("span",{name:"MuiLoadingButton",slot:"Label",overridesResolver:(e,t)=>[t.label]})({display:"inherit",alignItems:"inherit",justifyContent:"inherit"}),CCt=w.forwardRef(function(t,n){const r=w.useContext(WF),o=Xd(r,t),i=lt({props:o,name:"MuiLoadingButton"}),{children:a,disabled:s=!1,id:l,loading:c=!1,loadingIndicator:u,loadingPosition:d="center",variant:f="text",...h}=i,g=Dn(l),y=u??_.jsx(yy,{"aria-labelledby":g,color:"inherit",size:16}),v={...i,disabled:s,loading:c,loadingIndicator:y,loadingPosition:d,variant:f},x=bCt(v),S=c?_.jsx(SCt,{className:x.loadingIndicator,ownerState:v,children:y}):null;return _.jsxs(xCt,{disabled:s||c,id:g,ref:n,...h,variant:f,classes:x,ownerState:v,children:[v.loadingPosition==="end"?_.jsx(WX,{className:x.label,children:a}):S,v.loadingPosition==="end"?S:_.jsx(WX,{className:x.label,children:a})]})}),ECt=e=>{const{t}=Re(),n=trt(e.routineId),r=ort(e.routineId),[o,i]=w.useState(!1),[a,s]=w.useState(!1),[l,c]=w.useState(e.day.isRest),u=()=>{l?(c(!1),I({isRest:!1})):s(!0)},d=()=>s(!1),f=()=>{I({isRest:!l}),c(!l),s(!1)},h=()=>i(!0),g=()=>{e.setSelectedDayIndex(null),r.mutate(e.day.id),i(!1)},y=()=>i(!1),v=3,x=20,S=1e3,C=_o().shape({name:Ro().max(x,t("forms.maxLength",{chars:x})).min(v,t("forms.minLength",{chars:v})).required("Name is required"),description:Ro().max(S,t("forms.maxLength",{chars:S})),isRest:mu(),needsLogsToAdvance:mu()}),I=E=>n.mutate({id:e.day.id,routine:e.routineId,...E.name!==void 0&&{name:E.name},...E.description!==void 0&&{description:E.description},...E.isRest!==void 0&&{is_rest:l},...E.needsLogsToAdvance!==void 0&&{need_logs_to_advance:E.needsLogsToAdvance}});return b(xt,{children:b(ci,{initialValues:{name:e.day.name,description:e.day.description,isRest:e.day.isRest,needsLogsToAdvance:e.day.needLogsToAdvance},validationSchema:C,onSubmit:(E,{setSubmitting:T})=>{I(E),T(!1)},initialTouched:{name:!0,description:!0,isRest:!0,needsLogsToAdvance:!0},children:E=>Q(Zo,{children:[Q(ye,{container:!0,spacing:2,children:[b(ye,{size:{xs:12,sm:6},children:b(Ru,{fieldName:"name",title:"Name",fieldProps:{disabled:l}})}),b(ye,{size:{xs:6,sm:2},children:b(ba,{control:b(li,{checked:l,onChange:u}),label:t("routines.restDay")})}),Q(ye,{size:{xs:6,sm:4},children:[b(ba,{disabled:l,control:b(li,{checked:E.values.needsLogsToAdvance,...E.getFieldProps("needsLogsToAdvance")}),label:t("routines.needsLogsToAdvance")}),b(Do,{title:t("routines.needsLogsToAdvanceHelpText"),children:b(on,{onClick:()=>{},children:b(Dx,{fontSize:"small"})})})]}),b(ye,{size:12,children:b(Ru,{fieldName:"description",title:"Description",fieldProps:{multiline:!0,rows:4,disabled:l}})}),Q(ye,{size:8,children:[n.isPending?b(CCt,{loading:!0,variant:"contained",color:"primary",children:t("save")}):b(at,{variant:"contained",color:"primary",type:"submit",disabled:l,children:t("save")})," ",b(at,{variant:"outlined",startIcon:b(W0,{}),onClick:h,disabled:n.isPending,children:t("delete")})]}),b(ye,{size:4,sx:{display:"flex",justifyContent:"flex-end"},children:b(Zvt,{routineId:e.routineId})})]}),Q($w,{open:a,onClose:d,children:[b(cE,{children:t("routines.confirmRestDay")}),b(Lw,{children:t("routines.confirmRestDayHelpText")}),Q(Nw,{children:[b(at,{onClick:d,children:t("cancel")}),b(at,{onClick:f,children:t("continue")})]})]}),b(aO,{title:t("deleteConfirmation",{name:e.day.getDisplayName()}),message:t("routines.deleteDayConfirmation"),isOpen:o,closeFn:y,deleteFn:g})]})})})},PCt=e=>{const{t}=Re(),n=drt(e.routineId),[r,o]=w.useState(e.slot.comment),[i,a]=w.useState(!1),s=c=>{a(!0),o(c)},l=()=>{i&&(n.mutate({id:e.slot.id,comment:r}),a(!1))};return b(xt,{children:b(tn,{label:t("comment"),variant:"standard",fullWidth:!0,size:"small",value:r,disabled:n.isPending,onChange:c=>s(c.target.value),onBlur:l,InputProps:{endAdornment:n.isPending&&b(zp,{})}})})},ICt={weight:{edit:Mnt,add:Ant,delete:Rnt},"max-weight":{edit:Dnt,add:_nt,delete:$nt},reps:{edit:Nnt,add:Lnt,delete:Fnt},"max-reps":{edit:jnt,add:vY,delete:Bnt},sets:{edit:znt,add:Vnt,delete:Hnt},"max-sets":{edit:Unt,add:Wnt,delete:vY},rest:{edit:Ynt,add:Qnt,delete:Xnt},"max-rest":{edit:Jnt,add:Znt,delete:ert},rir:{edit:nle,add:rle,delete:ole},"max-rir":{edit:Gnt,add:qnt,delete:Knt}},GX=e=>{var C,I,E,T;const{t}=Re(),{edit:n,add:r,delete:o}=ICt[e.type],i=n(e.routineId),a=r(e.routineId),s=o(e.routineId),[l,c]=w.useState(((C=e.config)==null?void 0:C.value)||""),[u,d]=w.useState(null),[f,h]=w.useState(null),g=["sets","max-sets","rir","max-rir","rest","max-rest"].includes(e.type),y=g?parseInt:parseFloat,v=O=>{const A={slot_entry:e.slotEntryId,value:y(O)};O===""?e.config&&s.mutate(e.config.id):e.config?i.mutate({id:e.config.id,...A}):a.mutate({iteration:1,operation:Li,step:"abs",requirements:null,...A})},x=O=>{if(c(O),O!==""&&Number.isNaN(y(O))){d(t(g?"forms.enterInteger":"forms.enterNumber"));return}else d(null);f&&clearTimeout(f),h(setTimeout(()=>v(O),nte))},S=i.isPending||a.isPending||s.isPending;return b(tn,{slotProps:{input:{endAdornment:S&&b(zp,{})}},inputProps:{"data-testid":`${e.type}-field`},label:e.type,value:l,fullWidth:!0,variant:"standard",disabled:S,onChange:O=>x(O.target.value),error:!!u||i.isError||a.isError||s.isError,helperText:u||((I=i.error)==null?void 0:I.message)||((E=a.error)==null?void 0:E.message)||((T=s.error)==null?void 0:T.message)})},TCt=e=>{const{setFieldValue:t}=uz(),{t:n}=Re(),r=e.disabled??!1,[o,i]=w.useState(e.values),[a,s]=X.useState(null),l=u=>{o.includes(u)?i(o.filter(d=>d!==u)):i([...o,u])},c=async()=>{await t(e.fieldName,o),s(null)};return Q(xt,{children:[b(on,{disabled:r,onClick:u=>s(u.currentTarget),children:a?b(brt,{fontSize:"small"}):b(Grt,{fontSize:"small"})}),Q(Sa,{anchorEl:a,open:!!a,onClose:()=>s(null),children:[...$2.map((u,d)=>Q(Ft,{onClick:()=>l(u),children:[b(si,{children:o.includes(u)?b(Ert,{fontSize:"small"}):b(Prt,{fontSize:"small"})}),b(uo,{children:u})]})),b(Ti,{}),b(Ft,{children:b(at,{color:"primary",variant:"contained",type:"submit",size:"small",onClick:c,children:n("save")})})]})]})},OCt=e=>{var i;const t=nle(e.routineId),n=ole(e.routineId),r=rle(e.routineId),o=a=>{const s={value:parseFloat(a)};a===""?e.config&&n.mutate(e.config.id):e.config!==void 0?t.mutate({id:e.config.id,...s}):r.mutate({slot_entry:e.slotEntryId,iteration:1,operation:Li,...s})};return b(tn,{fullWidth:!0,select:!0,label:"RiR",variant:"standard",defaultValue:"",value:(i=e.config)==null?void 0:i.value,disabled:t.isPending,onChange:a=>o(a.target.value),children:Ste.map(a=>b(Ft,{value:a.value,children:a.label},a.value))})};function kCt(e){let t="";for(;e>0;)e--,t=String.fromCharCode(97+e%26)+t,e=Math.floor(e/26);return t}const dl=(e,t,n,r)=>t.length>0?b(GX,{config:t[0],type:e,routineId:n}):b(GX,{type:e,routineId:n,slotEntryId:r}),MCt=e=>{const{t}=Re();return Q(xt,{children:[e.slot.entries.length===0&&Q(Ii,{severity:"warning",children:[b(hg,{children:t("routines.setHasNoExercises")}),t("nothingHereYetAction")]}),e.slot.entries.map((n,r)=>b(ACt,{slotEntry:n,routineId:e.routineId,simpleMode:e.simpleMode,index:r,total:e.slot.entries.length},n.id))]})},ACt=e=>{var g;const{t,i18n:n}=Re(),[r,o]=w.useState(!1),i=()=>o(!r),a=$c(),s=U0(e.routineId),l=srt(e.routineId),c=s.isPending||l.isPending,u=y=>{y!==null&&(s.mutate({id:e.slotEntry.id,exercise:y.data.base_id}),o(!1))};let d;a.isSuccess&&(d=Tu(n.language,a.data));const f=()=>e.simpleMode?Q(X.Fragment,{children:[b(ye,{size:{xs:12,sm:2},children:dl("sets",e.slotEntry.nrOfSetsConfigs,e.routineId,e.slotEntry.id)},`sets-config-${e.slotEntry.id}`),b(ye,{size:{xs:12,sm:3},children:dl("weight",e.slotEntry.weightConfigs,e.routineId,e.slotEntry.id)},`weight-config-${e.slotEntry.id}`),b(ye,{size:{xs:12,sm:3},children:dl("reps",e.slotEntry.repetitionsConfigs,e.routineId,e.slotEntry.id)},`reps-config-${e.slotEntry.id}`)]}):Q(X.Fragment,{children:[b(ye,{size:{xs:6,sm:1},children:dl("sets",e.slotEntry.nrOfSetsConfigs,e.routineId,e.slotEntry.id)}),b(ye,{size:{xs:6,sm:1},children:dl("max-sets",e.slotEntry.maxNrOfSetsConfigs,e.routineId,e.slotEntry.id)}),b(ye,{size:{xs:6,sm:2},children:b(Yvt,{routineId:e.routineId,slotEntry:e.slotEntry})}),b(ye,{size:{xs:12,sm:2},children:b(OCt,{routineId:e.routineId,config:e.slotEntry.rirConfigs.length>0?e.slotEntry.rirConfigs[0]:void 0,slotEntryId:e.slotEntry.id})}),b(ye,{size:{xs:6,sm:1},children:dl("rest",e.slotEntry.restTimeConfigs,e.routineId,e.slotEntry.id)}),b(ye,{size:{xs:6,sm:1},children:dl("max-rest",e.slotEntry.maxRestTimeConfigs,e.routineId,e.slotEntry.id)}),b(ye,{size:{xs:6,sm:2},offset:{sm:4},children:dl("weight",e.slotEntry.weightConfigs,e.routineId,e.slotEntry.id)}),b(ye,{size:{xs:6,sm:2},children:dl("max-weight",e.slotEntry.maxWeightConfigs,e.routineId,e.slotEntry.id)}),b(ye,{size:{xs:12,sm:4},children:b(Xvt,{slotEntry:e.slotEntry,routineId:e.routineId})}),b(ye,{size:{xs:6,sm:2},offset:{sm:4},children:dl("reps",e.slotEntry.repetitionsConfigs,e.routineId,e.slotEntry.id)}),b(ye,{size:{xs:6,sm:2},children:dl("max-reps",e.slotEntry.maxRepetitionsConfigs,e.routineId,e.slotEntry.id)}),b(ye,{size:{xs:12,sm:4},children:b(Qvt,{slotEntry:e.slotEntry,routineId:e.routineId})})]}),h=e.total>1?kCt(e.index+1)+") ":"";return b(X.Fragment,{children:Q(ye,{container:!0,paddingTop:1,spacing:1,children:[Q(ye,{size:{xs:3,sm:1},alignContent:"center",children:[b(on,{size:"small",onClick:i,disabled:c,children:r?b(Art,{}):b(hz,{})}),b(on,{size:"small",onClick:()=>l.mutate(e.slotEntry.id),disabled:c,children:b(kP,{})})]}),b(ye,{size:{xs:9,sm:3},alignContent:"center",children:Q(tt,{variant:"body1",children:[h," ",(g=e.slotEntry.exercise)==null?void 0:g.getTranslation(d).name]})}),r&&Q(X.Fragment,{children:[b(ye,{size:{xs:12,sm:8},children:b(ty,{callback:u})}),b(ye,{size:{xs:12,sm:4}})]}),e.slotEntry.hasProgressionRules?b(ye,{size:8,children:b(Ii,{severity:"info",variant:"standard",sx:{mt:2},children:t("routines.exerciseHasProgression")})}):f()]})})},RCt=e=>{const{t}=Re(),n=_c(e.routineId),r=nrt(e.routineId),o=rrt(e.routineId),i=u=>({background:u?"lightblue":void 0}),a=(u,d)=>({backgroundColor:"white",margin:4,...d,opacity:1}),s=()=>{e.setSelectedDayIndex(null)},l=u=>{if(!u.destination)return;const d=Array.from(n.data.days),[f]=d.splice(u.source.index,1);d.splice(u.destination.index,0,f),e.setSelectedDayIndex(u.destination.index),n.data.days=d,r.mutate(d.map((h,g)=>({id:h.id,order:g+1})))},c=async()=>{const u={routine:e.routineId,name:`${t("routines.newDay")} ${n.data.days.length+1}`,order:n.data.days.length+1,is_rest:!1,need_logs_to_advance:!1};await o.mutateAsync(u),e.setSelectedDayIndex(n.data.days.length)};return n.isLoading?b(wr,{}):Q(ye,{container:!0,direction:"row",spacing:1,children:[b(ye,{size:12,children:b(_t,{direction:"row",children:Q(zde,{onDragEnd:l,onDragStart:s,children:[b(Xde,{droppableId:"dayDroppable",direction:"horizontal",children:(u,d)=>Q(Cee,{ref:u.innerRef,...u.droppableProps,value:e.selectedDayIndex,variant:"scrollable",scrollButtons:"auto",style:i(d.isDraggingOver),children:[n.data.days.map((f,h)=>b(Gde,{draggableId:f.id.toString(),index:h,children:(g,y)=>b(w2,{ref:g.innerRef,...g.draggableProps,...g.dragHandleProps,style:a(y.isDragging,g.draggableProps.style??{}),label:f.getDisplayName(),value:f.id,icon:b(lle,{}),iconPosition:"start",onClick:()=>e.setSelectedDayIndex(h)})},f.id)),u.placeholder]})}),b(at,{startIcon:o.isPending?b(zp,{}):b($o,{}),onClick:c,disabled:o.isPending,children:t("routines.addDay")})]})})}),n.data.days.length===0&&b(ye,{size:12,children:Q(Ii,{severity:"info",children:[b(hg,{children:t("routines.routineHasNoDays")}),t("nothingHereYetAction")]})})]})},DCt=e=>{const[t,n]=Re(),r=prt(e.routineId),o=art(e.routineId),i=urt(e.routineId),a=frt(e.routineId),s=Pa(),l=Lr(),[c,u]=w.useState(!1),[d,f]=w.useState(null),[h,g]=w.useState(null),[y,v]=w.useState(!0),x=(k,M)=>{h!==null&&(M==="timeout"?(r.mutate(h.id),g(null)):M!=="clickaway"&&(e.day.slots=[...e.day.slots,h].sort((R,$)=>R.order-$.order),g(null))),u(!1)},S=k=>{const M=e.day.slots.findIndex(R=>R.id===k);if(M!==-1){const R=[...e.day.slots],[$]=R.splice(M,1);e.day.slots=R,g($),u(!0)}},C=k=>{if(e.day.slots.find(R=>R.id===k)===void 0){console.info(`Could not find slot with id ${k} to add config`);return}f(d===k?null:k)},I=()=>i.mutate({day:e.day.id,order:e.day.slots.length+1}),E=8,T=k=>{if(!k.destination)return;const M=Array.from(e.day.slots),[R]=M.splice(k.source.index,1);M.splice(k.destination.index,0,R),a.mutate(M.map(($,L)=>({id:$.id,order:L+1}))),e.day.slots=M},O=k=>({background:k?"lightblue":void 0}),A=(k,M)=>({border:k?`1px solid ${l.palette.grey[900]}`:`1px solid ${l.palette.grey[300]}`,backgroundColor:"white",marginBottom:E,...M});return Q(xt,{children:[b(ECt,{routineId:e.routineId,day:e.day,setSelectedDayIndex:e.setSelectedDayIndex},`day-form-${e.day.id}`),!e.day.isRest&&e.day.slots.length>0&&Q(xt,{children:[b(en,{height:40}),b(ba,{control:b(li,{checked:y,onChange:()=>v(!y)}),label:t("routines.simpleMode")})]}),b(en,{height:20}),b(zde,{onDragEnd:T,children:b(Xde,{droppableId:"setDroppable",direction:"vertical",children:(k,M)=>b("div",{...k.droppableProps,ref:k.innerRef,style:O(M.isDraggingOver),children:e.day.slots.map((R,$)=>Q(X.Fragment,{children:[b(Gde,{draggableId:R.id.toString(),index:$,children:(L,z)=>Q(ye,{container:!0,padding:1,ref:L.innerRef,...L.draggableProps,style:A(z.isDragging,L.draggableProps.style??{}),children:[b(ye,{sx:{backgroundColor:l.palette.common.white},size:12,children:Q(ye,{container:!0,justifyContent:"space-between",alignItems:"center",children:[b(ye,{children:Q(tt,{variant:"h6",children:[b(on,{...L.dragHandleProps,children:b(lle,{})}),b(on,{onClick:()=>S(R.id),children:b(W0,{})}),R.entries.length>1?t("routines.supersetNr",{number:$+1}):t("routines.exerciseNr",{number:$+1})]})}),b(ye,{children:R.entries.length>0&&Q(GF,{variant:"outlined",children:[b(at,{onClick:()=>C(R.id),size:"small",disabled:o.isPending,startIcon:o.isPending?b(zp,{}):b($o,{}),children:t("routines.addSuperset")}),R.entries.length>0&&b(at,{startIcon:b(Krt,{}),component:io,size:"small",to:Qt(Kt.ROUTINE_EDIT_PROGRESSION,n.language,{id:e.routineId,id2:R.id}),children:t("routines.editProgression")})]})})]})}),!y&&Q(ye,{size:12,children:[b(PCt,{routineId:e.routineId,slot:R},`slot-form-${R.id}`),b(en,{height:10})]}),b(ye,{size:12,children:b(MCt,{slot:R,routineId:e.routineId,simpleMode:y})}),(d===R.id||R.entries.length===0)&&Q(ye,{size:12,children:[b(en,{height:20}),b(ty,{callback:N=>{N!==null&&(o.mutate({slot:R.id,exercise:N.data.base_id,type:"normal",order:R.entries.length+1,weight_unit:s.data.useMetric?Nke:Lke}),f(null))}})]})]})},R.id),b(en,{height:0,children:k.placeholder})]},`slot-${R.id}-${$}`))})})}),b(II,{open:c,autoHideDuration:NI,onClose:x,children:b(Ii,{severity:"success",variant:"filled",sx:{width:"100%"},action:b(at,{color:"warning",variant:"contained",size:"small",onClick:x,children:t("undo")}),children:"Set successfully deleted"})}),!e.day.isRest&&b(at,{variant:"contained",color:"primary",startIcon:i.isPending?b(zp,{}):b($o,{}),onClick:I,children:t("routines.addExercise")})]})},_Ct=()=>{var c;const{t:e,i18n:t}=Re(),n=Lr(),r=Pa(),o=Ea(),i=o.routineId?parseInt(o.routineId):0,a=_c(i),[s,l]=w.useState(null);return a.isLoading||r.isLoading?b(wr,{}):a.isError?Q("p",{children:["Error: ",a.error.message]}):(s===null&&a.data.days.length>0&&l(0),Q(J0,{title:e("editName",{name:(c=a.data)==null?void 0:c.name}),backToUrl:Qt(Kt.ROUTINE_DETAIL,t.language,{id:i}),children:[Q(ye,{container:!0,children:[b(ye,{size:12,children:b(Zz,{routine:a.data})}),Q(ye,{size:12,children:[b(en,{height:20}),b(RCt,{routineId:i,selectedDayIndex:s,setSelectedDayIndex:l})]}),s!==null&&b(xt,{children:b(ye,{size:12,sx:{backgroundColor:n.palette.grey[100],padding:1},children:b(en,{children:b(DCt,{day:a.data.days[s],routineId:i,setSelectedDayIndex:l})})})})]}),a.data.days.length>0&&Q(_t,{spacing:2,sx:{mt:2},children:[b(en,{height:40}),b(tt,{variant:"h4",children:e("routines.resultingRoutine")}),b(Ti,{}),Q(en,{children:[b(Eit,{}),b(en,{height:20}),b(Fue,{routine:a.data})]})]})]}))},$Ct=({initialSession:e,dayId:t,routineId:n,selectedDate:r,setSelectedDate:o})=>{let i;const[a,s]=Re(),[l,c]=X.useState(e),u=mrt(),d=grt(l==null?void 0:l.id),f=hrt(n,{routine:n,date:co(r.toJSDate()),day:t}),h=u.isPending||d.isPending||f.isLoading,g=_o({notes:Ro().max(y3,a("forms.maxLength",{chars:y3})),date:wc().required(),start:wc().nullable(),end:wc().nullable().min(dz("start"),a("forms.endBeforeStart")),fitInWeek:mu()});return w.useEffect(()=>{f.data?(i.setValues({notes:f.data.notes||"",impression:f.data.impression||ib,date:f.data.date,start:f.data.timeStart?yt.fromJSDate(f.data.timeStart):null,end:f.data.timeEnd?yt.fromJSDate(f.data.timeEnd):null}),c(f.data)):f.isSuccess&&!f.data&&(i.setValues({notes:"",impression:ib,date:(e==null?void 0:e.date)||yt.now().toJSDate(),start:e!=null&&e.timeStart?yt.fromJSDate(e.timeStart):null,end:e!=null&&e.timeEnd?yt.fromJSDate(e.timeEnd):null}),c(void 0))},[f.data,f.isSuccess,e,r]),b(ci,{enableReinitialize:!0,initialValues:{notes:l!==void 0?l.notes:"",date:l!==void 0?l.date:new Date,start:l!==void 0&&l.timeStart!==null?yt.fromJSDate(l.timeStart):null,end:l!==void 0&&l.timeEnd!==null?yt.fromJSDate(l.timeEnd):null,impression:l!==void 0?l.impression:ib},innerRef:y=>i=y,validationSchema:g,onSubmit:async y=>{const v={day:t,routine:n,date:co(r.toJSDate()),notes:y.notes,impression:y.impression,time_start:y.start?Bw(y.start.toJSDate()):null,time_end:y.end?Bw(y.end.toJSDate()):null};l!==void 0?await d.mutateAsync({...v,id:l.id}):await u.mutateAsync(v)},children:y=>b(Zo,{children:Q(ye,{container:!0,spacing:2,children:[b(ye,{size:{xs:12,sm:6},children:b(vc,{dateAdapter:pu,adapterLocale:s.language,children:b(kx,{value:r,defaultValue:yt.now(),label:a("date"),onChange:v=>{v&&(y.setFieldValue("date",v),o(v))},disableFuture:!0,slotProps:{textField:{variant:"standard",fullWidth:!0,error:y.touched.date&&!!y.errors.date}}})})}),b(ye,{size:{xs:6,sm:3},children:b(vc,{dateAdapter:pu,adapterLocale:s.language,children:b(vL,{label:a("start"),...y.getFieldProps("start"),onChange:v=>{v&&y.setFieldValue("start",v)},slotProps:{textField:{variant:"standard",fullWidth:!0,error:y.touched.start&&!!y.errors.start,helperText:y.touched.start&&y.errors.start}}})})}),b(ye,{size:{xs:6,sm:3},children:b(vc,{dateAdapter:pu,adapterLocale:s.language,children:b(vL,{label:a("end"),...y.getFieldProps("end"),onChange:v=>{v&&y.setFieldValue("end",v)},slotProps:{textField:{variant:"standard",fullWidth:!0,error:y.touched.end&&!!y.errors.end,helperText:y.touched.end&&y.errors.end}}})})}),b(ye,{size:12,children:b(Ru,{fieldName:"notes",title:a("notes"),fieldProps:{multiline:!0,rows:4}})}),Q(ye,{size:12,children:[b(tt,{variant:"caption",children:a("routines.impression")}),Q(GF,{fullWidth:!0,color:"primary",children:[Q(at,{size:"small",color:"info",variant:y.values.impression===v3?"contained":"outlined",onClick:()=>y.setFieldValue("impression",v3),children:[b(Wrt,{}),a("routines.impressionBad")]}),Q(at,{size:"small",color:"info",variant:y.values.impression===ib?"contained":"outlined",onClick:()=>y.setFieldValue("impression",ib),children:[b(Hrt,{}),a("routines.impressionNeutral")]}),Q(at,{size:"small",color:"info",variant:y.values.impression===b3?"contained":"outlined",onClick:()=>y.setFieldValue("impression",b3),children:[b(Urt,{}),a("routines.impressionGood")]})]})]}),b(ye,{size:12,display:"flex",justifyContent:"end",children:b(at,{disabled:h,color:"primary",variant:"contained",type:"submit",sx:{mt:2},children:a("submit")})})]})})})},NCt=({dayId:e,routineId:t,selectedDate:n})=>{const{t:r,i18n:o}=Re(),[i,a]=w.useState(!1),s=_c(t),l=irt(t),c=$c(),u=()=>a(!1),[d,f]=w.useState(null);let h;if(c.isSuccess&&(h=Tu(o.language,c.data)),s.isLoading)return b(wr,{});const g=s.data,y=(g==null?void 0:g.getDayData(e,n.toJSDate()))??[],v=y.length===0,x=_o({logs:Dp().of(_o().shape({rir:wo().nullable(),repetitions:wo().typeError(r("forms.enterNumber")).nullable(),weight:wo().typeError(r("forms.enterNumber")).nullable()}))}),S=async T=>{const O=v?null:y[0].iteration,A=T.logs.filter(k=>k.rir!==""||k.repetitions!==""||k.weight!=="").map(k=>{var M,R,$;return{date:n.toISO(),iteration:O,exercise:(M=k.exercise)==null?void 0:M.id,day:e,routine:t,slot_entry:k.slotEntry,rir:k.rir!==""?k.rir:null,rir_target:k.rirTarget!==""?k.rirTarget:null,repetitions_unit:(R=k.repetitionsUnit)==null?void 0:R.id,repetitions:k.repetitions!==""?k.repetitions:null,repetitions_target:k.repetitionsTarget!==""?k.repetitionsTarget:null,weight_unit:($=k.weightUnit)==null?void 0:$.id,weight:k.weight!==""?k.weight:null,weight_target:k.weightTarget!==""?k.weightTarget:null}});await l.mutateAsync(A),a(!0)},C=async(T,O)=>{if(T===null)return;const A=O.values.logs.map(k=>d===k.exercise.id?{...k,weight:"",weightTarget:"",repetitions:"",repetitionsTarget:"",rir:"",rirTarget:"",exercise:T.exercise}:k);await O.setValues({...O.values,logs:A}),f(null)},I={logs:[]},E=v?g.dayDataCurrentIteration.filter(T=>T.day.id===e):y;for(const T of E)for(const O of T.slots)for(const A of O.setConfigs)for(let k=0;k<A.nrOfSets;k++)I.logs.push({exercise:A.exercise,repetitionsUnit:A.repetitionsUnit,weightUnit:A.weightUnit,slotEntry:A.slotEntryId,rir:!v&&A.rir!==null?A.rir:"",rirTarget:!v&&A.rir!==null?A.rir:"",repetitions:!v&&A.repetitions!==null?A.repetitions:"",repetitionsTarget:!v&&A.repetitions!==null?A.repetitions:"",weight:!v&&A.weight!==null?A.weight:"",weightTarget:!v&&A.weight!==null?A.weight:""});return Q(xt,{children:[v&&b(Ii,{severity:"info",sx:{marginTop:2},children:r("routines.weightLogNotPlanned")}),b(ci,{enableReinitialize:!0,initialValues:I,validationSchema:x,onSubmit:S,children:T=>Q(Zo,{children:[b(jse,{name:"logs",children:({insert:O,remove:A,push:k})=>b(xt,{children:T.values.logs.map((M,R)=>{var $,L,z,N;return Q(ye,{container:!0,spacing:1,sx:{mt:2},children:[(R===0||R>0&&T.values.logs[R-1].exercise.id!=T.values.logs[R].exercise.id)&&Q(xt,{children:[Q(ye,{size:12,children:[d!==T.values.logs[R].exercise.id&&b(tt,{variant:"h6",children:($=T.values.logs[R].exercise)==null?void 0:$.getTranslation(h).name}),d===T.values.logs[R].exercise.id&&b(ty,{loadExercise:!0,callback:B=>C(B,T)})]}),Q(ye,{size:12,children:[Q(at,{type:"button",size:"small",onClick:()=>O(R,{exercise:T.values.logs[R].exercise,repetitions:T.values.logs[R].repetitions,weight:T.values.logs[R].weight}),children:[b($o,{}),r("routines.addAdditionalLog")]}),Q(at,{type:"button",size:"small",onClick:()=>{d===T.values.logs[R].exercise.id?f(null):f(T.values.logs[R].exercise.id)},children:[b(Yrt,{}),r("exercises.swapExercise")]}),Q(at,{type:"button",size:"small",onClick:async()=>await T.setValues({...T.values,logs:T.values.logs.filter(B=>B.exercise.id!==T.values.logs[R].exercise.id)}),children:[b(kP,{}),r("delete")]})]})]}),b(ye,{size:4,children:b(Ru,{fieldName:`logs.${R}.repetitions`,title:r("server.repetitions"),fieldProps:{slotProps:{input:{endAdornment:b(ro,{position:"end",children:((L=T.values.logs[R].repetitionsUnit)==null?void 0:L.id)!==$ke?b(tt,{variant:"caption",children:(z=T.values.logs[R].repetitionsUnit)==null?void 0:z.name}):null})}}}})}),b(ye,{size:4,children:b(Ru,{fieldName:`logs.${R}.weight`,title:r("weight"),fieldProps:{slotProps:{input:{endAdornment:b(ro,{position:"end",children:b(tt,{variant:"caption",children:(N=T.values.logs[R].weightUnit)==null?void 0:N.name})})}}}})}),b(ye,{size:3,children:b(tn,{fullWidth:!0,select:!0,label:r("routines.rir"),variant:"standard",...T.getFieldProps(`logs.${R}.rir`),children:Ste.map(B=>b(Ft,{value:B.value,children:B.label},B.value))})}),b(ye,{size:1,children:b(on,{size:"small",onClick:()=>A(R),children:b(kP,{})})})]},R)})})}),b(ye,{container:!0,spacing:2,children:b(ye,{size:12,display:"flex",justifyContent:"end",children:b(at,{color:"primary",disabled:!T.isValid||T.isSubmitting||l.isPending,variant:"contained",type:"submit",sx:{mt:2},children:r("submit")})})})]})}),b(II,{open:i,autoHideDuration:NI,onClose:u,children:b(Ii,{onClose:u,severity:"success",sx:{width:"100%"},children:r("success")})})]})},LCt=()=>{const e=Ea(),{t,i18n:n}=Re(),[r,o]=w.useState(yt.now()),i=parseInt(e.routineId??"");if(Number.isNaN(i))return b("p",{children:"Please pass an integer as the routine id."});const a=parseInt(e.dayId??"");return Number.isNaN(a)?b("p",{children:"Please pass an integer as the day id."}):b(es,{title:t("routines.addWeightLog"),backToUrl:Qt(Kt.ROUTINE_DETAIL,n.language,{id:i}),mainContent:Q(_t,{children:[b($Ct,{routineId:i,dayId:a,selectedDate:r,setSelectedDate:o}),b(tt,{variant:"h5",children:t("exercises.exercises")}),b(tt,{variant:"body2",children:t("routines.impressionHelpText")}),b(NCt,{routineId:i,dayId:a,selectedDate:r})]})})},Mb=e=>{var y,v;const{t}=Re(),[n,r]=w.useState(!0),[o,i]=w.useState([]),a=knt(e.routineId),s=e.forceInteger??!1;let l,c,u="";switch(e.type){case"weight":l=bt.WEIGHT_CONFIG,c=bt.MAX_WEIGHT_CONFIG,u=t("weight");break;case"reps":l=bt.REPETITIONS_CONFIG,c=bt.MAX_REPS_CONFIG,u=t("server.repetitions");break;case"sets":l=bt.NR_OF_SETS_CONFIG,c=bt.MAX_NR_OF_SETS_CONFIG,u=t("routines.sets");break;case"rest":l=bt.REST_CONFIG,c=bt.MAX_REST_CONFIG,u=t("routines.restTime");break;case"rir":l=bt.RIR_CONFIG,c=bt.MAX_RIR_CONFIG,u=t("routines.rir");break}const d=_o({entries:Dp().of(_o().shape({edited:mu(),iteration:wo().required(),value:wo().when("forceInteger",{is:!0,then:x=>x.integer(t("forms.enterInteger")).typeError(t("forms.enterNumber")),otherwise:x=>x.typeError(t("forms.enterNumber")).nullable().notRequired()}),valueMax:wo().typeError(t("forms.enterNumber")).nullable().when("forceInteger",{is:!0,then:x=>x.integer(t("forms.enterInteger")).typeError(t("forms.enterNumber")),otherwise:x=>x.typeError(t("forms.enterNumber")).nullable().notRequired()}).when("operation",{is:Li,then:x=>x.min(dz("value"),t("forms.maxLessThanMin")),otherwise:x=>x}),operation:Ro().required(),operationMax:Ro().required(),requirements:Dp().of(Ro().oneOf($2)),requirementsMax:Dp().of(Ro().oneOf($2)),repeat:mu(),repeatMax:mu()})).test("inter-entry-validation","Your error message here",function(x,S){const{createError:C}=this,I=x;for(let E=0;E<I.length;E++){const T=I[E];if(T.iteration>1&&T.operation!==Li){let O=!1,A=!1;for(let k=0;k<E;k++)I[k].operation===Li&&I[k].value!==""&&I[k].edited&&(O=!0),I[k].operation===Li&&I[k].valueMax!==""&&I[k].edited&&(A=!0);if(!O)return C({path:`entries[${E}].value`,message:t("routines.progressionNeedsReplace")});if(!A)return C({path:`entries[${E}].valueMax`,message:t("routines.progressionNeedsReplace")})}}return!0})}),f=(x,S)=>({forceInteger:s,edited:S,iteration:x,id:null,idMax:null,value:"",valueMax:"",operation:Li,operationMax:Li,step:"abs",stepMax:"abs",requirements:[],requirementsMax:[],repeat:!1,repeatMax:!1}),h={entries:[]};for(const x of e.iterations){const S=e.configs.find(I=>I.iteration===x),C=e.configsMax.find(I=>I.iteration===x);S===void 0?h.entries.push(f(x,!1)):h.entries.push({forceInteger:s,edited:!0,id:S.id,idMax:C===void 0?null:C.id,iteration:x,value:String(S.value),valueMax:C===void 0?"":String(C.value),operation:S.operation,operationMax:C===void 0?Li:S.operation,step:S.step,stepMax:C===void 0?"abs":C.step,requirements:((y=S.requirements)==null?void 0:y.rules)??[],requirementsMax:C===void 0?[]:((v=C.requirements)==null?void 0:v.rules)??[],repeat:S.repeat,repeatMax:C===void 0?!1:S.repeat})}const g=x=>{const S=x.entries.filter(k=>k.edited),C=S.filter(k=>k.id!==null).map(k=>({id:k.id,slot_entry:e.slotEntryId,value:k.value,iteration:k.iteration,operation:k.operation,step:k.step,repeat:k.repeat,requirements:{rules:k.requirements??[]}})),I=S.filter(k=>k.id===null&&k.value!=="").map(k=>({slot_entry:e.slotEntryId,value:k.value,iteration:k.iteration,operation:k.operation,step:k.step,repeat:k.repeat,requirements:{rules:k.requirements??[]}})),E=e.configs.filter(k=>o.includes(k.iteration)).map(k=>k.id);S.forEach(k=>{k.value===""&&k.id!==null&&!E.includes(k.id)&&E.push(k.id)});const T=S.filter(k=>k.idMax!==null&&k.valueMax!=="").map(k=>({id:k.idMax,slot_entry:e.slotEntryId,value:k.valueMax,iteration:k.iteration,operation:k.operation,step:k.step,repeat:k.repeat,requirements:{rules:k.requirements??[]}})),O=S.filter(k=>k.idMax===null&&k.valueMax!=="").map(k=>({iteration:k.iteration,slot_entry:e.slotEntryId,value:k.valueMax,operation:k.operation,step:k.stepMax,repeat:k.repeat,requirements:{rules:k.requirements??[]}})),A=e.configsMax.filter(k=>o.includes(k.iteration)).map(k=>k.id);S.forEach(k=>{k.valueMax===""&&k.idMax!==null&&!E.includes(k.idMax)&&A.push(k.idMax)}),a.mutate({toAdd:I,toDelete:E,toEdit:C,apiPath:l}),a.mutate({toAdd:O,toDelete:A,toEdit:T,apiPath:c})};return b(xt,{children:Q(_t,{sx:{width:"100%"},children:[b(tt,{variant:"h6",children:u}),b(ci,{enableReinitialize:!0,initialValues:h,validationSchema:d,onSubmit:(x,{setSubmitting:S})=>{g(x),S(!1)},children:x=>b(Zo,{children:Q(ye,{container:!0,spacing:1,children:[b(ye,{size:4,offset:2,textAlign:"center",children:t("value")}),b(ye,{size:6,children:Q(ye,{container:!0,spacing:1,children:[b(ye,{size:3,children:t("routines.operation")}),b(ye,{size:3,children:t("routines.step")}),Q(ye,{size:3,textAlign:"center",children:[t("routines.requirements"),b("br",{}),b(Do,{title:t("routines.requirementsHelpText"),children:b(on,{onClick:()=>{},children:b(Dx,{fontSize:"small"})})})]}),Q(ye,{size:3,textAlign:"center",children:[t("routines.repeat"),b("br",{}),b(Do,{title:t("routines.repeatHelpText"),children:b(on,{onClick:()=>{},children:b(Dx,{fontSize:"small"})})})]})]})}),b(ye,{size:12,children:b(Ti,{})}),b(jse,{name:"entries",validateOnChange:!0,children:({insert:S,remove:C})=>b(xt,{children:x.values.entries.map((I,E)=>Q(X.Fragment,{children:[Q(ye,{size:2,display:"flex",justifyContent:"space-around",alignItems:"center",children:[e.cycleLength===7?t("routines.weekNr",{number:I.iteration}):t("routines.workoutNr",{number:I.iteration}),I.edited?b(on,{disabled:I.iteration===1&&x.values.entries.filter(T=>T.edited&&T.iteration!==1).length>0,size:"small",onClick:()=>{I.id!==null&&i([...o,I.iteration]),C(E),S(E,f(I.iteration,!1))},children:b(W0,{})}):b(on,{size:"small",onClick:()=>{C(E),S(E,f(I.iteration,!0))},children:b($o,{})})]}),b(ye,{size:2,children:I.edited&&b(Ru,{fieldName:`entries.${E}.value`,title:t("min"),fullwidth:!0})}),b(ye,{size:2,children:I.edited&&b(Ru,{fieldName:`entries.${E}.valueMax`,title:t("max"),fullwidth:!0})}),b(ye,{size:6,children:Q(ye,{container:!0,spacing:1,children:[b(ye,{size:3,children:I.edited&&b(tn,{disabled:I.iteration===1,fullWidth:!0,select:!0,label:t("routines.operation"),variant:"standard",...x.getFieldProps(`entries.${E}.operation`),onChange:async T=>{x.handleChange(T),T.target.value===Li&&(await x.setFieldValue(`entries.${E}.requirements`,[]),await x.setFieldValue(`entries.${E}.repeat`,!1))},children:fAe.map(T=>b(Ft,{value:T.value,children:T.label},T.value))})}),b(ye,{size:3,children:I.edited&&Q(tn,{disabled:I.iteration===1||I.operation===Li,fullWidth:!0,select:!0,label:t("routines.step"),variant:"standard",...x.getFieldProps(`entries.${E}.step`),children:[dAe.map(T=>b(Ft,{value:T.value,children:T.label},T.value)),(I.iteration===1||I.operation===Li)&&b(Ft,{value:"na",children:"n/a"},"na")]})}),Q(ye,{size:3,textAlign:"center",children:[I.edited&&b(TCt,{disabled:I.iteration===1||I.operation===Li,values:I.requirements,fieldName:`entries.${E}.requirements`}),I.requirements.length>=0&&b("br",{}),I.requirements.length>=0&&I.requirements.map((T,O)=>Q(tt,{variant:"caption",children:[T,"  "]},O))]}),b(ye,{size:3,textAlign:"center",children:I.edited&&b(li,{checked:x.values.entries[E].repeat,...x.getFieldProps(`entries.${E}.repeat`),disabled:I.iteration===1||I.operation===Li})})]})})]},E))})}),b(ye,{size:12,display:"flex",justifyContent:"end",children:b(at,{color:"primary",disabled:!x.isValid||x.isSubmitting||!x.dirty,variant:"contained",type:"submit",sx:{mt:2},children:t("save")})}),b(ye,{size:12,children:b(en,{height:20})})]})})})]})})},FCt=()=>{const{t:e,i18n:t}=Re(),n=Ea(),r=n.routineId?parseInt(n.routineId):-1,o=n.slotId?parseInt(n.slotId):-1,i=_c(r),a=$c();if(i.isLoading)return b(wr,{});const s=i.data;let l;a.isSuccess&&(l=Tu(t.language,a.data));let c=null;for(const d of s.days){const f=d.slots.find(h=>h.id===o);if(f){c=f;break}}if(c===null)return b("p",{children:"Slot not found!"});const u=Object.keys(s.groupedDayDataByIteration).map(Number);return b(xt,{children:b(J0,{title:e("routines.editProgression"),backToUrl:Qt(Kt.ROUTINE_EDIT,t.language,{id:r}),children:c.entries.map(d=>{var f;return Q(X.Fragment,{children:[b(tt,{variant:"h5",gutterBottom:!0,children:(f=d.exercise)==null?void 0:f.getTranslation(l).name}),Q(ye,{container:!0,spacing:1,children:[b(ye,{size:2,display:"flex",alignItems:"end",children:b(tt,{variant:"body2",children:e("routines.rounding")})}),b(ye,{size:5,children:b(WP,{routineId:r,entryId:d.id,initialValue:d.weightRounding,rounding:"weight",editProfile:!1})}),b(ye,{size:5,children:b(WP,{routineId:r,entryId:d.id,initialValue:d.repetitionRounding,rounding:"reps",editProfile:!1})}),b(Mb,{type:"sets",configs:d.nrOfSetsConfigs,configsMax:d.maxNrOfSetsConfigs,slotEntryId:d.id,routineId:r,iterations:u,forceInteger:!0,cycleLength:s.cycleLength}),b(Mb,{type:"weight",configs:d.weightConfigs,configsMax:d.maxWeightConfigs,slotEntryId:d.id,routineId:r,iterations:u,cycleLength:s.cycleLength}),b(Mb,{type:"reps",configs:d.repetitionsConfigs,configsMax:d.maxRepetitionsConfigs,slotEntryId:d.id,routineId:r,iterations:u,cycleLength:s.cycleLength}),b(Mb,{type:"rir",configs:d.rirConfigs,configsMax:d.maxRirConfigs,slotEntryId:d.id,routineId:r,iterations:u,cycleLength:s.cycleLength}),b(Mb,{type:"rest",configs:d.restTimeConfigs,configsMax:d.maxRestTimeConfigs,slotEntryId:d.id,routineId:r,iterations:u,cycleLength:s.cycleLength})]})]},d.id)})})})},jCt=()=>{const{t:e,i18n:t}=Re(),n=Ea(),r=parseInt(n.routineId??"");if(Number.isNaN(r))return b("p",{children:"Please pass an integer as the routine id."});const o=_c(r),i=o.data;return b(UT,{query:o,child:o.isSuccess&&b(es,{title:i!=null&&i.isPublic?e("routines.publicTemplate"):e("routines.template"),subTitle:i.name,mainContent:Q(_t,{spacing:2,children:[Q(tt,{variant:"subtitle1",children:[i.start.toLocaleDateString()," - ",i.end.toLocaleDateString()," (",i.durationText,")"]}),i.description!==""&&b(tt,{variant:"body2",sx:{whiteSpace:"pre-line"},children:i==null?void 0:i.description}),b(at,{component:"a",href:Qt(Kt.ROUTINE_COPY,t.language,{id:r}),variant:"contained",children:e("routines.copyAndUseTemplate")}),i.dayDataCurrentIteration.filter(a=>a.day!==null).map((a,s)=>b(Cz,{dayData:a,routineId:r,readOnly:!0},`dayDetails-${s}`))]}),sideBar:Q(_t,{children:[b(en,{height:40}),Q(ye,{container:!0,children:[b(ye,{size:6,children:b(zl,{primaryMuscles:i.mainMuscles.filter(a=>a.isFront),secondaryMuscles:i.secondaryMuscles.filter(a=>a.isFront),isFront:!0})}),b(ye,{size:6,children:b(zl,{primaryMuscles:i.mainMuscles.filter(a=>!a.isFront),secondaryMuscles:i.secondaryMuscles.filter(a=>!a.isFront),isFront:!1})})]})]})})})},BCt=e=>{var u;const[t,n]=Re(),[r,o]=X.useState(null),i=!!r,a=d=>{o(d.currentTarget)},s=()=>{o(null)},l=()=>window.location.href=Qt(Kt.ROUTINE_EDIT_LOG,n.language,{id:e.log.id}),c=()=>window.location.href=Qt(Kt.ROUTINE_DELETE_LOG,n.language,{id:e.log.id});return Q(Zt,{children:[b(Te,{component:"th",scope:"row",children:yt.fromJSDate(e.log.date).toLocaleString(yt.DATE_MED)}),b(Te,{children:e.log.repetitions}),Q(Te,{children:[e.log.weight,(u=e.log.weightUnitObj)==null?void 0:u.name]}),b(Te,{children:e.log.rirString}),Q(Te,{children:[b(on,{"aria-label":"settings",onClick:a,children:b(gz,{fontSize:"small"})}),Q(Sa,{id:"basic-menu",anchorEl:r,open:i,onClose:s,MenuListProps:{"aria-labelledby":"basic-button"},children:[Q(Ft,{onClick:l,children:[b(hz,{}),t("edit")]}),Q(Ft,{onClick:c,children:[b(W0,{}),t("delete")]})]})]})]},e.log.id)},zCt=e=>{const{t}=Re();let n=e.logEntries??[];const r=[5,10,20],[o,i]=X.useState(r[0]),[a,s]=X.useState(0),l=(u,d)=>{s(d)},c=u=>{i(parseInt(u.target.value,10)),s(0)};return Q(xt,{children:[b(tt,{variant:"h6",sx:{mt:4},children:e.exercise.getTranslation().name}),Q(ye,{container:!0,spacing:2,children:[b(ye,{size:{xs:12,md:5},children:Q(jl,{children:[Q(Ll,{"aria-label":"simple table",size:"small",children:[b(Du,{children:Q(Zt,{children:[b(Te,{children:t("date")}),b(Te,{children:t("routines.reps")}),b(Te,{children:t("weight")}),b(Te,{children:t("routines.rir")}),b(Te,{})]})}),b(Fl,{children:n.slice(a*o,a*o+o).map(u=>b(BCt,{log:u},u.id))})]}),b(nj,{rowsPerPageOptions:r,component:"div",count:n.length,rowsPerPage:o,page:a,onPageChange:l,onRowsPerPageChange:c})]})}),b(ye,{size:{xs:12,md:7},children:b(UCt,{data:n},e.exercise.id)})]})]})},VCt=e=>e.map(t=>({id:t.id,value:t.weight,time:t.date.getTime(),entry:t})),HCt=({active:e,payload:t,label:n})=>{var r,o,i;if(e){let a="";return(r=t==null?void 0:t[1].payload)!=null&&r.entry.rir&&(a=`, ${(o=t==null?void 0:t[1].payload)==null?void 0:o.entry.rir} RiR`),b(fo,{children:Q(Pi,{children:[b(tt,{variant:"body1",children:yt.fromMillis(t==null?void 0:t[0].value).toLocaleString(yt.DATE_MED)}),Q(tt,{variant:"body2",children:[(i=t==null?void 0:t[1].payload)==null?void 0:i.entry.reps," × ",t==null?void 0:t[1].value,t==null?void 0:t[1].unit,a]})]})})}return null},UCt=e=>{let t;t=e.data.reduce(function(r,o){return r.set(o.repetitions,r.get(o.repetitions)||[]),r.get(o.repetitions).push(o),r},new Map);const n=cS(t.size);return b(en,{children:b(Fu,{width:"100%",height:250,children:Q(S8e,{children:[b(Xa,{dataKey:"time",domain:["auto","auto"],name:"Time",tickFormatter:r=>yt.fromMillis(r).toLocaleString(yt.DATE_MED),type:"number"}),b(Ja,{domain:["auto","auto"],dataKey:"value",name:"Value",unit:"kg"}),Array.from(t).map(([r,o])=>{const i=n.next().value,a=VCt(o);return b(N0,{data:a,fill:i,line:{stroke:i},lineType:"joint",lineJointType:"monotoneX",name:r.toString()},r)}),b(ua,{content:b(HCt,{})}),b(Sf,{strokeDasharray:"3 3"}),b(hc,{})]})})})},WCt=()=>{const e=Ea(),t=e.routineId?parseInt(e.routineId):0,[n,r]=Re(),o=ele(t),i=_c(t);if(o.isLoading||i.isLoading)return b(wr,{});let a=new Map;return console.log(o.data),a=o.data.reduce((s,l)=>(l.logs.forEach(c=>{const u=c.exerciseId;s.set(u,s.get(u)||[]),s.get(u).push(c)}),s),a),Q(J0,{title:n("routines.logsHeader"),backToUrl:Qt(Kt.ROUTINE_DETAIL,r.language,{id:t}),optionsMenu:b(Do,{title:n("routines.statsOverview"),children:b(on,{component:"a",href:Qt(Kt.ROUTINE_STATS_OVERVIEW,r.language,{id:t}),children:b(ale,{})})}),children:[b(tt,{variant:"body1",children:n("routines.logsFilterNote")}),i.data.dayDataCurrentIteration.filter(s=>s.day!==null&&!s.day.isRest).map((s,l)=>Q(X.Fragment,{children:[Q(_t,{direction:{xs:"column",sm:"row"},justifyContent:"space-between",alignItems:"center",sx:{mt:4},children:[b(tt,{variant:"h4",children:s.day.name}),b(at,{component:io,to:Qt(Kt.ROUTINE_ADD_LOG,r.language,{id:t,id2:s.day.id}),variant:"contained",children:n("routines.addLogToDay")})]}),s.slots.map(c=>c.exercises.map(u=>b(zCt,{exercise:u,logEntries:a.get(u.id)},u.id)))]},l))]})};var op=(e=>(e.Volume="volume",e.Sets="sets",e.Intensity="intensity",e))(op||{}),ip=(e=>(e.Mesocycle="mesocycle",e.Weekly="weekly",e.Iteration="iteration",e.Daily="daily",e))(ip||{}),ew=(e=>(e.Exercises="exercises",e.Muscles="muscles",e.Total="total",e))(ew||{});const D$=({label:e,options:t,value:n,onChange:r})=>Q(rh,{fullWidth:!0,children:[b(oh,{id:`${e}-label`,children:e}),b(gf,{labelId:`${e}-label`,id:`${e}-select`,value:n,label:e,onChange:r,children:t.map(o=>b(Ft,{value:o.value,children:o.label},o.value))})]});function GCt(e,t,n,r,o){switch(r){case"exercises":{const i=Object.keys(o.exercises).map(s=>{var l,c;return(c=(l=e.find(u=>u.id===parseInt(s)))==null?void 0:l.getTranslation(t))==null?void 0:c.name}),a=Object.keys(o.exercises).map(Number);return{headers:i,data:a.map(s=>o.exercises[s])}}case"muscles":{const i=Object.keys(o.muscle).map(s=>{var l;return qr.t(Ki((l=n.find(c=>c.id===parseInt(s)))==null?void 0:l.nameEn))}),a=Object.keys(o.muscle).map(Number);return{headers:i,data:a.map(s=>o.muscle[s])}}case"total":return{headers:[qr.t("total")],data:[o.total]};default:return{headers:[],data:[]}}}const qCt=(e,t,n,r,o,i,a,s)=>{const l={},c=e[t];let u=[],d=[];const f=(y,v)=>GCt(o,a,i,y,v);d=(y=>{let v=[];switch(n){case"mesocycle":v=f(r,c.mesocycle).headers;break;case"iteration":for(const x in c.iteration)v=v.concat(f(r,c.iteration[x]).headers);break;case"weekly":for(const x in c.weekly)v=v.concat(f(r,c.weekly[x]).headers);break;case"daily":for(const x in c.daily)v=v.concat(f(r,c.daily[x]).headers);break}return[...new Set(v)]})(),d.forEach(y=>{l[y]=0});function g(y,v){d.map(S=>y[f(r,v).headers.indexOf(S)]).forEach((S,C)=>{S!==void 0&&(l[d[C]]+=S)})}switch(n){case"mesocycle":{const{data:y}=f(r,c.mesocycle);u=[{key:qr.t("total"),values:d.map(v=>y[d.indexOf(v)])}];break}case"iteration":{u=Object.entries(c.iteration).map(([y,v])=>{const{data:x}=f(r,v);return g(x,v),{key:`iteration ${y}`,values:d.map(S=>x[f(r,v).headers.indexOf(S)])}});break}case"weekly":{u=Object.entries(c.weekly).map(([y,v])=>{const{data:x}=f(r,v);return g(x,v),{key:`week ${y}`,values:d.map(S=>x[f(r,v).headers.indexOf(S)])}});break}case"daily":{u=Object.entries(c.daily).map(([y,v])=>{const{data:x}=f(r,v);return g(x,v),{key:new Date(y).toLocaleDateString(s),values:d.map(S=>x[f(r,v).headers.indexOf(S)])}});break}}return{headers:d,data:u,totals:l}};function KCt(e){const t=[];return e.headers.forEach(n=>{t.push({name:n,data:[]})}),e.data.forEach(n=>{n.values.forEach((r,o)=>{var a;const i=e.headers[o];i&&((a=t.find(s=>s.name===i))==null||a.data.push({category:n.key.toString(),value:r}))})}),t}const YCt=()=>{const e=Lr(),[t,n]=Re(),r=Ea(),[o,i]=w.useState(op.Volume),[a,s]=w.useState(ip.Daily),[l,c]=w.useState(ew.Exercises),u=parseInt(r.routineId??"");if(Number.isNaN(u))return b("p",{children:"Please pass an integer as the routine id."});const d=_c(u),f=Snt(u),h=Yy(),g=$c();if(f.isLoading||d.isLoading||h.isLoading||g.isLoading)return b(wr,{});const y=Tu(n.language,g.data),v=d.data,x=[{value:op.Volume,label:t("routines.volume")},{value:op.Sets,label:t("routines.sets")},{value:op.Intensity,label:t("routines.intensity")}],S=[{value:ip.Mesocycle,label:t("routines.currentRoutine")},{value:ip.Weekly,label:t("routines.weekly")},{value:ip.Iteration,label:t("routines.iteration")},{value:ip.Daily,label:t("routines.daily")}],C=[{value:ew.Exercises,label:t("exercises.exercises")},{value:ew.Muscles,label:t("exercises.muscles")},{value:ew.Total,label:t("total")}],I=R=>{i(R.target.value)},E=R=>{s(R.target.value)},T=R=>{c(R.target.value)},O=qCt(f.data,o,a,l,v.exercises,h.data,y,n.language),A=KCt(O),k=()=>b(jl,{children:Q(Ll,{size:"small",children:[b(Du,{children:Q(Zt,{children:[b(Te,{}),O.headers.map(R=>b(Te,{sx:{textAlign:"right"},children:R},R))]})}),Q(Fl,{children:[O.data.map(R=>Q(Zt,{children:[b(Te,{children:R.key}),R.values.map(($,L)=>b(Te,{sx:{textAlign:"right"},children:($==null?void 0:$.toFixed(o===op.Intensity?2:0))||""},L))]},R.key)),a!==ip.Mesocycle&&Q(Zt,{children:[b(Te,{sx:{fontWeight:"bold",backgroundColor:e.palette.grey.A200},children:t("total")}),O.headers.map(R=>{var $;return b(Te,{sx:{fontWeight:"bold",backgroundColor:e.palette.grey.A200,textAlign:"right"},children:($=O.totals[R==null?void 0:R.toString()])==null?void 0:$.toFixed(o===op.Intensity?2:0)},R)})]})]})]})}),M=cS(A.length);return b(J0,{title:`${t("routines.statsOverview")} - ${v.name}`,backToUrl:Qt(Kt.ROUTINE_DETAIL,n.language,{id:u}),optionsMenu:b(Do,{title:t("routines.logsOverview"),children:b(on,{component:"a",href:Qt(Kt.ROUTINE_LOGS_OVERVIEW,n.language,{id:u}),children:b(ale,{})})}),children:Q(ye,{container:!0,spacing:1,children:[b(ye,{size:2,offset:3,children:b(D$,{label:"type",options:x,value:o,onChange:I})}),b(ye,{size:2,children:b(D$,{label:"sub type",options:S,value:a,onChange:E})}),b(ye,{size:2,children:b(D$,{label:"group by",options:C,value:l,onChange:T})}),b(ye,{size:12,children:b(en,{width:"100%",height:400,children:b(Fu,{width:"100%",height:"100%",children:Q(AB,{width:500,height:300,children:[b(Sf,{strokeDasharray:"3 3"}),b(Xa,{dataKey:"category",type:"category",allowDuplicatedCategory:!1}),b(Ja,{dataKey:"value"}),b(ua,{formatter:R=>Number.isInteger(R)?R.toFixed(0):R.toFixed(2)}),b(hc,{layout:"vertical",verticalAlign:"middle",align:"right",wrapperStyle:{paddingLeft:"20px"}}),A.map(R=>b(uh,{dataKey:"value",data:R.data,name:R.name,stroke:M.next().value},R.name))]})})})}),Q(ye,{size:12,children:[b(en,{height:20}),k()]})]})})},QCt=()=>{const[e]=Re(),[t,n]=X.useState(!1),r=()=>n(!0),o=()=>n(!1);return Q("div",{children:[b(nh,{color:"secondary","aria-label":"add",onClick:r,sx:{position:"fixed",bottom:"5rem",right:i=>i.spacing(2),zIndex:9},children:b($o,{})}),b(ki,{title:e("add"),isOpen:t,closeFn:o,children:b(Zz,{closeFn:o})})]})},SV=e=>{const[t,n]=Re(),r=e.linkDestination??Kt.ROUTINE_DETAIL,o=Qt(r,n.language,{id:e.routine.id});return Q(xt,{children:[b(Ka,{sx:{p:0},children:Q(mf,{component:"a",href:o,children:[b(uo,{primary:e.routine.name!==""?e.routine.name:t("routines.routine"),secondary:`${e.routine.durationText} (${e.routine.start.toLocaleDateString()} - ${e.routine.end.toLocaleDateString()})`}),b(sle,{})]})}),b(Ti,{component:"li"})]})},qX=()=>{const e=Cnt(),[t]=Re();return e.isLoading?b(wr,{}):b(es,{title:t("routines.routines"),mainContent:b(xt,{children:e.data.length===0?b(ih,{}):b(Kr,{children:b(xa,{sx:{py:0},children:e.data.map(n=>b(SV,{routine:n},n.id))},"abc")})}),fab:b(QCt,{})})},XCt=()=>{const e=Ent(),[t]=Re();return e.isLoading?b(wr,{}):b(es,{title:t("routines.templates"),mainContent:b(xt,{children:e.data.length===0?b(ih,{}):b(Kr,{children:b(xa,{sx:{py:0},children:e.data.map(n=>b(SV,{routine:n,linkDestination:Kt.TEMPLATE_DETAIL},n.id))},"abc")})})})},JCt=()=>{const e=Pnt(),[t]=Re();return e.isLoading?b(wr,{}):b(es,{title:t("routines.publicTemplates"),mainContent:b(xt,{children:e.data.length===0?b(ih,{}):b(Kr,{children:b(xa,{sx:{py:0},children:e.data.map(n=>b(SV,{routine:n,linkDestination:Kt.TEMPLATE_DETAIL},n.id))},"abc")})})})},ZCt=()=>b("div",{children:"About Page"});function CV(e){const[t]=Re(),[n,r,o]=Za(e.fieldName);return b($l,{multiple:!0,freeSolo:!0,id:e.fieldName,value:n.value,options:n.value,onChange:(i,a)=>{o.setValue(a)},renderTags:(i,a)=>i.map((s,l)=>gF(Pu,{label:s,...a({index:l}),key:l})),onBlur:n.onBlur,renderInput:i=>b(tn,{...i,id:"exerciseAliases",variant:"standard",label:t("exercises.alternativeNames"),error:r.touched&&!!r.error,helperText:r.touched&&r.error,value:n.value})})}function e1t(e){const[t]=Re(),[n,r,o]=Za(e.fieldName);return b($l,{multiple:!0,id:e.fieldName,options:e.options.map(i=>i.id),getOptionLabel:i=>t(Ki(e.options.find(a=>a.id===i).name)),...n,onChange:(i,a)=>{o.setValue(a)},renderInput:i=>b(tn,{variant:"standard",label:t("exercises.equipment"),value:n.value,...i})})}function EV(e){const[t]=Re(),[n,r]=Za(e.fieldName);return b(tn,{fullWidth:!0,id:e.fieldName,label:t("name"),variant:"standard",error:r.touched&&!!r.error,helperText:r.touched&&r.error,...n})}function t1t(e){const[t]=Re(),[n,r]=Za(e.fieldName);return Q(rh,{fullWidth:!0,children:[b(oh,{id:"label-category",children:t("category")}),b(gf,{labelId:"label-category",id:"category",label:t("category"),error:r.touched&&!!r.error,...n,children:e.options}),r.touched&&!!r.error&&b(h0,{error:!0,children:r.error})]})}const Jde=5,Zde=40,PV=e=>Ro().min(Jde,e("forms.valueTooShort")).max(Zde,e("forms.valueTooLong")).required(e("forms.fieldRequired")),IV=e=>Dp().ensure().compact().of(Ro().min(Jde,e("forms.valueTooShort")).max(Zde,e("forms.valueTooLong"))),TV=e=>Ro().min(40,e("forms.valueTooShort")).required(e("forms.fieldRequired")),efe=e=>Dp().ensure().compact().of(Ro().min(15,e("forms.valueTooShort"))),n1t=e=>wo().required(e("forms.fieldRequired"));var tfe=(e=>(e[e.SET_NOTIFICATION=0]="SET_NOTIFICATION",e))(tfe||{}),zn=(e=>(e[e.RESET=0]="RESET",e[e.SET_NAME_EN=1]="SET_NAME_EN",e[e.SET_ALIASES_EN=2]="SET_ALIASES_EN",e[e.SET_DESCRIPTION_EN=3]="SET_DESCRIPTION_EN",e[e.SET_NOTES_EN=4]="SET_NOTES_EN",e[e.SET_CATEGORY=5]="SET_CATEGORY",e[e.SET_EQUIPMENT=6]="SET_EQUIPMENT",e[e.SET_PRIMARY_MUSCLES=7]="SET_PRIMARY_MUSCLES",e[e.SET_MUSCLES_SECONDARY=8]="SET_MUSCLES_SECONDARY",e[e.SET_VARIATION_ID=9]="SET_VARIATION_ID",e[e.SET_NEW_VARIATION_BASE_ID=10]="SET_NEW_VARIATION_BASE_ID",e[e.SET_LANGUAGE=11]="SET_LANGUAGE",e[e.SET_NAME_I18N=12]="SET_NAME_I18N",e[e.SET_ALIASES_I18N=13]="SET_ALIASES_I18N",e[e.SET_DESCRIPTION_I18N=14]="SET_DESCRIPTION_I18N",e[e.SET_NOTES_I18N=15]="SET_NOTES_I18N",e[e.SET_IMAGES=16]="SET_IMAGES",e))(zn||{});const KX=e=>({type:tfe.SET_NOTIFICATION,payload:e}),YX={notification:{notify:!1,message:"",severity:void 0,title:"",type:void 0}},r1t=w.createContext([YX,()=>YX]),o1t=()=>w.useContext(r1t),i1t=e=>({type:zn.SET_NAME_EN,payload:e}),a1t=e=>({type:zn.SET_DESCRIPTION_EN,payload:e}),s1t=e=>({type:zn.SET_NOTES_EN,payload:e}),l1t=e=>({type:zn.SET_ALIASES_EN,payload:e}),c1t=e=>({type:zn.SET_NAME_I18N,payload:e}),u1t=e=>({type:zn.SET_DESCRIPTION_I18N,payload:e}),d1t=e=>({type:zn.SET_NOTES_I18N,payload:e}),f1t=e=>({type:zn.SET_ALIASES_I18N,payload:e}),p1t=e=>({type:zn.SET_CATEGORY,payload:e}),h1t=e=>({type:zn.SET_EQUIPMENT,payload:e}),m1t=e=>({type:zn.SET_PRIMARY_MUSCLES,payload:e}),g1t=e=>({type:zn.SET_MUSCLES_SECONDARY,payload:e}),y1t=e=>({type:zn.SET_VARIATION_ID,payload:e}),v1t=e=>({type:zn.SET_NEW_VARIATION_BASE_ID,payload:e}),b1t=e=>({type:zn.SET_LANGUAGE,payload:e}),w1t=e=>({type:zn.SET_IMAGES,payload:e}),x1t=(e,t)=>{if(t===void 0)return e;switch(t.type){case zn.RESET:return tI;case zn.SET_NAME_EN:return{...e,nameEn:t.payload};case zn.SET_DESCRIPTION_EN:return{...e,descriptionEn:t.payload};case zn.SET_NOTES_EN:return{...e,notesEn:t.payload};case zn.SET_ALIASES_EN:return{...e,alternativeNamesEn:t.payload};case zn.SET_CATEGORY:return{...e,category:t.payload};case zn.SET_EQUIPMENT:return{...e,equipment:t.payload};case zn.SET_PRIMARY_MUSCLES:return{...e,muscles:t.payload};case zn.SET_MUSCLES_SECONDARY:return{...e,musclesSecondary:t.payload};case zn.SET_VARIATION_ID:return{...e,variationId:t.payload};case zn.SET_NEW_VARIATION_BASE_ID:return{...e,newVariationExerciseId:t.payload};case zn.SET_LANGUAGE:return{...e,languageId:t.payload};case zn.SET_NAME_I18N:return{...e,nameI18n:t.payload};case zn.SET_DESCRIPTION_I18N:return{...e,descriptionI18n:t.payload};case zn.SET_NOTES_I18N:return{...e,notesI18n:t.payload};case zn.SET_ALIASES_I18N:return{...e,alternativeNamesI18n:t.payload};case zn.SET_IMAGES:return{...e,images:t.payload};default:return e}},tI={category:null,muscles:[],musclesSecondary:[],variationId:null,newVariationExerciseId:null,languageId:null,equipment:[],nameEn:"",descriptionEn:"",alternativeNamesEn:[],notesEn:[],nameI18n:"",alternativeNamesI18n:[],descriptionI18n:"",notesI18n:[],images:[]},nfe=w.createContext([tI,()=>tI]),S1t=({children:e})=>{const[t,n]=w.useReducer(x1t,tI);return b(nfe.Provider,{value:[t,n],children:e})},dv=()=>w.useContext(nfe),C1t=({onContinue:e})=>{const[t]=Re(),[n,r]=dv(),[o,i]=w.useState(n.muscles),[a,s]=w.useState(n.musclesSecondary);w.useEffect(()=>{r(m1t(o))},[r,o]),w.useEffect(()=>{r(g1t(a))},[r,a]);const l=WT(),c=Yy(),u=GT(),d=_o({nameEn:PV(t),newAlternativeNameEn:IV(t),category:n1t(t)});return b(ci,{initialValues:{nameEn:n.nameEn,newAlternativeNameEn:n.alternativeNamesEn,category:n.category!==null?n.category:"",muscles:n.muscles,equipment:n.equipment,musclesSecondary:n.musclesSecondary},validationSchema:d,onSubmit:f=>{r(i1t(f.nameEn)),r(p1t(f.category)),r(l1t(f.newAlternativeNameEn)),r(h1t(f.equipment)),e()},children:f=>Q(Zo,{children:[Q(_t,{spacing:2,children:[b(EV,{fieldName:"nameEn"}),b(CV,{fieldName:"newAlternativeNameEn"}),l.isLoading?Q(en,{children:[" ",b(Ba,{})," "]}):b(t1t,{fieldName:"category",options:l.data.map(h=>b(Ft,{value:h.id,children:t(Ki(h.name))},h.id))}),u.isLoading?Q(en,{children:[" ",b(Ba,{})," "]}):b(e1t,{fieldName:"equipment",options:u.data}),c.isLoading?Q(en,{children:[" ",b(Ba,{})," "]}):Q(xt,{children:[b($l,{multiple:!0,id:"muscles",options:c.data.map(h=>h.id),getOptionDisabled:h=>a.includes(h),getOptionLabel:h=>c.data.find(g=>g.id===h).getName(t),value:o,onChange:(h,g)=>{i(g)},renderInput:h=>b(tn,{...h,variant:"standard",label:t("exercises.muscles"),value:f.getFieldProps("muscles").value,onChange:g=>{f.setFieldValue(f.getFieldProps("muscles").name,g.target.value)}})}),b($l,{multiple:!0,id:"secondary-muscles",options:c.data.map(h=>h.id),getOptionDisabled:h=>o.includes(h),getOptionLabel:h=>c.data.find(g=>g.id===h).getName(t),value:a,onChange:(h,g)=>{s(g)},renderInput:h=>b(tn,{...h,variant:"standard",label:t("exercises.secondaryMuscles"),value:f.getFieldProps("muscles").value})})]}),Q(ye,{container:!0,children:[b(ye,{display:"flex",justifyContent:"center",size:6,children:b(zl,{primaryMuscles:o.map(h=>c.data.find(g=>g.id===h)),secondaryMuscles:a.map(h=>c.data.find(g=>g.id===h)),isFront:!0})}),b(ye,{display:"flex",justifyContent:"center",size:6,children:b(zl,{primaryMuscles:o.map(h=>c.data.find(g=>g.id===h)),secondaryMuscles:a.map(h=>c.data.find(g=>g.id===h)),isFront:!1})})]})]}),b(ye,{container:!0,children:b(ye,{display:"flex",justifyContent:"end",size:12,children:b(en,{sx:{mb:2},children:b("div",{children:b(at,{variant:"contained",type:"submit",sx:{mt:1,mr:1},children:t("continue")})})})})})]})})};function E1t(e,t){const n=new Map;return e.forEach(r=>{const o=t(r),i=n.get(o);i?i.push(r):n.set(o,[r])}),n}const QX=({exercises:e})=>{const r=e[0].variationId,o=e[0].id,[i,a]=dv(),[s,l]=w.useState(!1),[c,u]=w.useState(i.variationId),[d,f]=w.useState(i.newVariationExerciseId);w.useEffect(()=>{a(y1t(c))},[a,c]),w.useEffect(()=>{a(v1t(d))},[a,d]);const h=(y,v)=>()=>{y!==null?(v=null,y===i.variationId&&(y=null)):(y=null,v===i.newVariationExerciseId&&(v=null)),u(y),f(v)};let g;return r===null?g=i.newVariationExerciseId===o:g=r===i.variationId,b(Ka,{disableGutters:!0,children:b(mf,{onClick:h(r,o),children:Q(ye,{container:!0,children:[b(ye,{display:"flex",justifyContent:"start",alignItems:"center",size:{xs:12,sm:3},children:b(F0e,{max:4,spacing:"small",children:e.map(y=>y.mainImage?b(Nl,{src:y.mainImage.url},y.id):b(Nl,{children:b(_u,{})},y.id))})}),Q(ye,{size:{xs:10,sm:7},children:[e.slice(0,s?e.length:5).map(y=>b("p",{style:{margin:0},children:y.getTranslation().name},y.id)),!s&&e.length>5?b(xy,{onMouseEnter:()=>l(!0)}):null]}),b(ye,{display:"flex",justifyContent:"end",size:{xs:2,sm:2},children:b(li,{edge:"start",checked:g,tabIndex:-1,disableRipple:!0},`variation-${r}`)}),b(ye,{size:12,children:b(Ti,{sx:{pt:1}})})]})})})},P1t=({onContinue:e,onBack:t})=>{const[n]=Re(),r=dle(),[o,i]=w.useState("");let a=[],s=new Map;return r.isSuccess&&(a=r.data,o!==""&&(a=a.filter(l=>l.getTranslation().name.toLowerCase().includes(o.toLowerCase())))),s=E1t(a.filter(l=>l.variationId!==null),l=>l.variationId),Q(xt,{children:[Q(ye,{container:!0,children:[b(ye,{size:{xs:12,sm:6},children:b(tt,{children:n("exercises.whatVariationsExist")})}),b(ye,{display:"flex",justifyContent:"end",size:{xs:12,sm:6},children:b(tn,{label:n("exercises.filterVariations"),variant:"standard",onChange:l=>i(l.target.value),InputProps:{startAdornment:b(ro,{position:"start",children:b(JB,{})})}})})]}),r.isLoading?b(wr,{}):b(Kr,{elevation:2,sx:{mt:2},children:Q(xa,{style:{maxHeight:"400px",overflowY:"scroll"},children:[a.filter(l=>l.variationId===null).map(l=>b(QX,{exercises:[l]},"base-"+l.id)),[...s.keys()].map(l=>b(QX,{exercises:s.get(l)},"variation-"+l))]})}),Q(Ii,{severity:"info",variant:"filled",sx:{mt:2},children:[b(hg,{children:n("exercises.identicalExercise")}),n("exercises.identicalExercisePleaseDiscard")]}),b(ye,{container:!0,children:b(ye,{display:"flex",justifyContent:"end",size:12,children:b(en,{sx:{mb:2},children:Q("div",{children:[b(at,{disabled:!1,onClick:t,sx:{mt:1,mr:1},children:n("goBack")}),b(at,{variant:"contained",onClick:e,sx:{mt:1,mr:1},children:n("continue")})]})})})})]})};function I1t(e){const{t}=Re(),[n,r]=X.useState(e.initial.toString()),o=WT(),i=Pa(),a=async s=>{r(s.target.value),await yj(e.exerciseId,{category:parseInt(s.target.value),license_author:i.data.username})};return o.isSuccess?Q(rh,{fullWidth:!0,children:[b(oh,{id:"label-category",children:t("category")}),b(gf,{labelId:"label-category",id:"category",label:t("category"),value:n,onChange:a,children:o.data.map(s=>b(Ft,{value:s.id,children:t(Ki(s.name))},s.id))})]}):null}function T1t(e){const{t}=Re(),[n,r]=X.useState(e.initial),o=GT(),i=Pa(),a=async s=>{r(s),await yj(e.exerciseId,{equipment:s,license_author:i.data.username})};return o.isSuccess?b($l,{multiple:!0,value:n,options:o.data.map(s=>s.id),getOptionLabel:s=>t(Ki(o.data.find(l=>l.id===s).name)),onChange:(s,l)=>a(l),renderInput:s=>b(tn,{variant:"standard",label:t("exercises.equipment"),value:n,...s})}):null}var Ko=function(){return Ko=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Ko.apply(this,arguments)};function hO(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function XX(e){if(e){var t=e.textContent,n=/[\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC]/;e.style.direction=t&&n.test(t[0])?"rtl":"ltr"}}function rfe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.filter(Boolean).join(" ")}function O1t(){if(document.selection)return document.selection.createRange().parentElement();var e=window.getSelection();if(e&&e.rangeCount>0)return e.getRangeAt(0).startContainer.parentNode||void 0}function JX(e){return e?e.replace(/&nbsp;|\u202F|\u00A0/g," ").replace(/<br \/>/g,"<br>"):""}function k1t(e){var t=document.createTextNode("");e.appendChild(t);var n=document.activeElement===e;if(t!==null&&t.nodeValue!==null&&n){var r=window.getSelection();if(r!==null){var o=document.createRange();o.setStart(t,t.nodeValue.length),o.collapse(!0),r.removeAllRanges(),r.addRange(o)}e instanceof HTMLElement&&e.focus()}}function ofe(e,t){typeof t=="function"?t(e):typeof t=="object"&&t&&(t.current=e)}var M1t=X.memo(X.forwardRef(function(t,n){var r=t.className,o=t.disabled,i=t.tagName,a=t.value,s=a===void 0?"":a,l=t.placeholder,c=hO(t,["className","disabled","tagName","value","placeholder"]),u=X.useRef(),d=X.useRef(s),f=X.useRef(c);return X.useEffect(function(){f.current=c;var h=u.current;h&&JX(d.current)!==JX(s)&&(d.current=s,h.innerHTML=s,k1t(h))}),X.useMemo(function(){function h(v){u.current=v,XX(v),ofe(v,n)}function g(v){var x,S,C=u.current;if(C){var I=C.innerHTML;I!==d.current&&((S=(x=f.current).onChange)===null||S===void 0||S.call(x,Ko(Ko({},v),{target:{value:I,name:c.name}}))),XX(C),d.current=I}}var y=rfe("rsw-ce",r);return X.createElement(i||"div",Ko(Ko({},c),{className:y,contentEditable:!o,dangerouslySetInnerHTML:{__html:s},onBlur:function(v){return(f.current.onBlur||g)(v)},onInput:g,onKeyDown:function(v){return(f.current.onKeyDown||g)(v)},onKeyUp:function(v){return(f.current.onKeyUp||g)(v)},placeholder:l,ref:h}))},[r,o,l,i])})),ife=X.createContext(void 0);function afe(e){var t=e.children,n=X.useState({htmlMode:!1,update:i}),r=n[0],o=n[1];function i(a){o(function(s){return Ko(Ko({},s),a)})}return X.createElement(ife.Provider,{value:r},t)}function fS(){var e=X.useContext(ife);if(!e)throw new Error("You should wrap your component by EditorProvider");return e}var ZX=[],Ab=[];function A1t(e,t){if(e&&typeof document<"u"){var n,r=t.prepend===!0?"prepend":"append",o=t.singleTag===!0,i=typeof t.container=="string"?document.querySelector(t.container):document.getElementsByTagName("head")[0];if(o){var a=ZX.indexOf(i);a===-1&&(a=ZX.push(i)-1,Ab[a]={}),n=Ab[a]&&Ab[a][r]?Ab[a][r]:Ab[a][r]=s()}else n=s();e.charCodeAt(0)===65279&&(e=e.substring(1)),n.styleSheet?n.styleSheet.cssText+=e:n.appendChild(document.createTextNode(e))}function s(){var l=document.createElement("style");if(l.setAttribute("type","text/css"),t.attributes)for(var c=Object.keys(t.attributes),u=0;u<c.length;u++)l.setAttribute(c[u],t.attributes[c[u]]);var d=r==="prepend"?"afterbegin":"beforeend";return i.insertAdjacentElement(d,l),l}}var R1t=".rsw-editor{border:1px solid #ddd;border-radius:.375rem;display:flex;flex-direction:column;min-height:100px;overflow:hidden}.rsw-ce{flex:1 0 auto;padding:.5rem}.rsw-ce:focus{outline:1px solid #668}.rsw-ce[contentEditable=true]:empty:not(:focus):before{color:grey;content:attr(placeholder);pointer-events:none}.rsw-html{background:transparent;border:none;font-family:monospace,Courier New}.rsw-separator{align-self:stretch;border-right:1px solid #ddd;display:flex;margin:0 3px}.rsw-dd{box-sizing:border-box;outline:none}.rsw-btn{background:transparent;border:0;color:#222;cursor:pointer;font-size:1em;height:2em;outline:none;padding:0;width:2em}.rsw-btn:hover{background:#eaeaea}.rsw-btn[data-active=true]{background:#e0e0e0}.rsw-toolbar{align-items:center;background-color:#f5f5f5;border-bottom:1px solid #ddd;display:flex}";A1t(R1t,{});var sfe=X.forwardRef(function(t,n){var r=t.autoFocus,o=t.children,i=t.containerProps,a=t.onSelect,s=hO(t,["autoFocus","children","containerProps","onSelect"]),l=fS();X.useEffect(function(){return document.addEventListener("click",c),function(){return document.removeEventListener("click",c)}});function c(h){var g;h.target!==l.$el&&(!((g=l.$el)===null||g===void 0)&&g.contains(h.target)||l.update({$selection:void 0}))}function u(h){a==null||a(h),l.update({$selection:O1t()})}function d(h){l.update({$el:h}),ofe(h,n),r&&h&&l.$el===void 0&&h.focus()}var f=rfe("rsw-editor",i==null?void 0:i.className);return l.htmlMode?X.createElement("div",Ko({},i,{className:f}),o,X.createElement("textarea",Ko({},s,{className:"rsw-ce rsw-html"}))):X.createElement("div",Ko({},i,{className:f}),o,X.createElement(M1t,Ko({},s,{ref:d,onSelect:u})))});function D1t(){return X.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",style:{verticalAlign:"text-top"}},X.createElement("path",{fill:"currentColor",d:"M6.99938 12.998v-2H20.9994v2H6.99938zm0 6.0001v-2H20.9994v2H6.99938zm0-12.00001v-2H20.9994v2H6.99938zm-4 1v-3h-1v-1h2v4h-1zm-1 9.00001v-1h3v4h-3v-1h2v-.5h-1v-1h1v-.5h-2zM4.25 10c.41421 0 .75.3358.75.75 0 .2024-.08017.3861-.2105.521L3.11983 13H5v1H2v-.9218L4 11H2v-1h2.25z"}))}function _1t(){return X.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",style:{verticalAlign:"text-top"}},X.createElement("path",{fill:"currentColor",d:"M7 5h14v2H7V5zm0 8v-2h14v2H7zM4 4.50001c.83 0 1.5.66992 1.5 1.5 0 .83007-.67 1.5-1.5 1.5s-1.5-.66993-1.5-1.5c0-.83008.67-1.5 1.5-1.5zM4 10.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5-1.5-.67-1.5-1.5.67-1.5 1.5-1.5zM7 19v-2h14v2H7zm-3-2.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5-1.5-.67-1.5-1.5.67-1.5 1.5-1.5z"}))}var lfe=Fc("Bold","𝐁","bold"),cfe=Fc("Bullet list",X.createElement(_1t,null),"insertUnorderedList"),$1t=Fc("Clear formatting","T̲ₓ","removeFormat"),ufe=Fc("Italic","𝑰","italic"),N1t=Fc("Strike through",X.createElement("s",null,"ab"),"strikeThrough"),L1t=Fc("Link","🔗",function(e){var t=e.$selection;(t==null?void 0:t.nodeName)==="A"?document.execCommand("unlink"):document.execCommand("createLink",!1,prompt("URL","")||void 0)}),dfe=Fc("Numbered list",X.createElement(D1t,null),"insertOrderedList"),ffe=Fc("Redo","↷","redo"),pfe=Fc("Underline",X.createElement("span",{style:{textDecoration:"underline"}},"𝐔"),"underline"),hfe=Fc("Undo","↶","undo");function Fc(e,t,n){return r.displayName=e.replace(/\s/g,""),r;function r(o){var i=fS(),a=i.$el,s=i.$selection,l=!1;typeof n=="string"&&(l=!!s&&document.queryCommandState(n));function c(u){u.preventDefault(),document.activeElement!==a&&(a==null||a.focus()),typeof n=="function"?n(i):document.execCommand(n)}return i.htmlMode?null:X.createElement("button",Ko({className:"rsw-btn","data-active":l,onMouseDown:c,tabIndex:-1,title:e,type:"button"},o),t)}}var F1t=j1t("Styles",[["Normal","formatBlock","DIV"],["𝗛𝗲𝗮𝗱𝗲𝗿 𝟭","formatBlock","H1"],["Header 2","formatBlock","H2"],["𝙲𝚘𝚍𝚎","formatBlock","PRE"]]);function j1t(e,t){return n.displayName=e,n;function n(r){var o=fS(),i=o.$el,a=o.$selection,s=o.htmlMode;if(s)return null;var l=t.findIndex(function(u){return u[1]==="formatBlock"&&(a==null?void 0:a.nodeName)===u[2]});return X.createElement(B1t,Ko({},r,{items:t,onChange:c,selected:l,tabIndex:-1,title:e}));function c(u){var d=u.target,f=d.value,h=parseInt(f,10),g=t[h]||[],y=g[1],v=g[2];u.preventDefault(),document.activeElement!==i&&(i==null||i.focus()),typeof y=="function"?y(o):y&&document.execCommand(y,!1,v),setTimeout(function(){return d.value=f},10)}}}function B1t(e){var t=e.items,n=e.selected,r=hO(e,["items","selected"]);return X.createElement("select",Ko({},r,{value:n,className:"rsw-dd"}),X.createElement("option",{hidden:!0},r.title),t.map(function(o,i){return X.createElement("option",{key:o[2],value:i},o[0])}))}function z1t(e){var t=hO(e,[]),n=fS();function r(){n.update({htmlMode:!n.htmlMode})}return X.createElement("button",Ko({className:"rsw-btn","data-active":n.htmlMode,onClick:r,tabIndex:-1,title:"HTML mode",type:"button"},t),"</>")}function Lm(){var e=fS();return e.htmlMode?null:X.createElement("div",{className:"rsw-separator"})}function mfe(e){return X.createElement("div",Ko({},e,{className:"rsw-toolbar"}))}X.forwardRef(function(t,n){return X.createElement(afe,null,X.createElement(sfe,Ko({},t,{ref:n}),X.createElement(mfe,null,X.createElement(hfe,null),X.createElement(ffe,null),X.createElement(Lm,null),X.createElement(lfe,null),X.createElement(ufe,null),X.createElement(pfe,null),X.createElement(N1t,null),X.createElement(Lm,null),X.createElement(dfe,null),X.createElement(cfe,null),X.createElement(Lm,null),X.createElement(L1t,null),X.createElement($1t,null),X.createElement(z1t,null),X.createElement(Lm,null),X.createElement(F1t,null))))});function V1t(e){return b(afe,{children:b(sfe,{...e,children:Q(mfe,{children:[b(lfe,{}),b(ufe,{}),b(pfe,{}),b(Lm,{}),b(cfe,{}),b(dfe,{}),b(Lm,{}),b(hfe,{}),b(ffe,{})]})})})}function OV(e){const[t,n,r]=Za(e.fieldName);return Q(xt,{children:[b("div",{"data-testid":"jodit-editor",children:b(V1t,{value:t.value,onChange:o=>r.setValue(o.target.value)})}),n.touched&&!!n.error&&b(h0,{error:!0,children:n.error})]})}const H1t=({exerciseId:e,image:t,canDelete:n})=>{const[r]=Re(),o=eot(e);return Q(fo,{children:[b(Ec,{component:"img",image:t.url,sx:{height:120},alt:""}),b(Ys,{children:n&&b(at,{color:"primary",onClick:()=>o.mutate(t.id),children:r("delete")})})]})},U1t=({exerciseId:e})=>{const[t]=Re(),n=Pa(),r=tot(e),o=async i=>{var s;if(!((s=i.target.files)!=null&&s.length))return;const[a]=i.target.files;n.isSuccess&&await r.mutate({exerciseId:e,image:a,imageData:{url:"",file:a,author:"",authorUrl:"",title:"",objectUrl:"",derivativeSourceUrl:"",style:""}})};return Q(fo,{children:[b(Ec,{children:b(en,{sx:{backgroundColor:"lightgray",height:120},display:"flex",alignItems:"center",justifyContent:"center",children:b(ile,{sx:{fontSize:80,color:"gray"}})})}),b(Ys,{children:Q(at,{component:"label",children:[t("add"),b("input",{style:{display:"none"},id:"camera-input",type:"file",accept:"image/*",capture:"environment",onChange:o})]})})]})};function eJ(e){const{t}=Re(),n=Yy(),r=async o=>{e.setValue(o),await yj(e.exerciseId,e.isMain?{muscles:o}:{muscles_secondary:o})};return n.isSuccess?b($l,{multiple:!0,options:n.data.map(o=>o.id),getOptionDisabled:o=>e.blocked.includes(o),getOptionLabel:o=>n.data.find(i=>i.id===o).getName(t),value:e.value,onChange:(o,i)=>r(i),renderInput:o=>b(tn,{...o,variant:"standard",label:t(e.isMain?"exercises.muscles":"exercises.secondaryMuscles"),value:e.value})}):null}const W1t=({video:e,canDelete:t})=>{const[n]=Re();return Q(fo,{children:[b(Ec,{component:"video",src:e.url,sx:{height:120},controls:!0,preload:"metadata"}),b(Ys,{children:t&&b(at,{color:"primary",onClick:()=>lAe(e.id),children:n("delete")})})]})},G1t=({exerciseId:e})=>{const[t]=Re(),n=Pa(),r=async o=>{var a;if(!((a=o.target.files)!=null&&a.length))return;const[i]=o.target.files;n.isSuccess&&await sAe(e,n.data.username,i)};return Q(fo,{children:[b(Ec,{children:b(en,{sx:{backgroundColor:"lightgray",height:120},display:"flex",alignItems:"center",justifyContent:"center",children:b(ile,{sx:{fontSize:80,color:"gray"}})})}),b(Ys,{children:Q(at,{component:"label",children:[t("add"),b("input",{style:{display:"none"},id:"camera-input",type:"file",accept:"video/*",capture:"environment",onChange:r})]})})]})},q1t="check-permission",K1t=async e=>{const t=dt(q1t,{query:{permission:e}}),n=await nt.get(t,{headers:pt()});return n.status===400?!1:n.data.result};function Od(e){return br({queryKey:[Bke,e],queryFn:()=>K1t(e.valueOf())})}var au=(e=>(e.EDIT_EXERCISE="exercises.change_exercise",e.DELETE_EXERCISE="exercises.delete_exercise",e.ADD_IMAGE="exercises.add_exerciseimage",e.EDIT_IMAGE="exercises.change_exerciseimage",e.DELETE_IMAGE="exercises.delete_exerciseimage",e.ADD_VIDEO="exercises.add_exercisevideo",e.EDIT_VIDEO="exercises.change_exercisevideo",e.DELETE_VIDEO="exercises.delete_exercisevideo",e))(au||{});const Y1t=({exerciseId:e,language:t})=>{const[n]=Re(),[r,o]=w.useState(!1),[i,a]=w.useState([]),[s,l]=w.useState([]),c=Xrt(e),u=Jrt(e),d=Zrt(e),f=Od(au.ADD_IMAGE),h=Od(au.DELETE_IMAGE),g=Od(au.ADD_VIDEO),y=Od(au.DELETE_VIDEO),v=Od(au.EDIT_EXERCISE),x=Yy(),S=Pa(),C=c.data;if(w.useEffect(()=>{c.data!==void 0&&(a(C.muscles.map(k=>k.id)),l(C.musclesSecondary.map(k=>k.id)))},[c.data]),c.isLoading||x.isLoading||c.isLoading||S.isLoading||f.isLoading||h.isLoading||g.isLoading||y.isLoading||v.isLoading)return b(Ba,{});const I=C.getTranslation(t),T=t.id!==(I==null?void 0:I.language)?new hte(null,null,"","",t.id):I,O=C.getTranslation(),A=_o({name:PV(n),alternativeNames:IV(n),description:TV(n)});return Q(xt,{children:[b(ci,{initialValues:{name:T.name,alternativeNames:T.aliases.map(k=>k.alias),description:T.description},enableReinitialize:!0,validationSchema:A,onSubmit:async k=>{const M=T.id?await d.mutateAsync({id:T.id,exerciseId:C.id,languageId:t.id,name:k.name,description:k.description,author:""}):await u.mutateAsync({exerciseId:C.id,languageId:t.id,name:k.name,description:k.description,author:S.data.username}),R=T.aliases.map(N=>N.alias),$=k.alternativeNames,L=$.filter(N=>!R.includes(N));let z=R.filter(N=>!$.includes(N));L.forEach(N=>{_2(M.id,N)}),z.forEach(N=>{aAe(T.aliases.find(B=>B.alias===N).id)}),o(!0)},children:b(Zo,{children:Q(ye,{container:!0,spacing:1,children:[r&&Q(ye,{size:12,children:[b(Ii,{severity:"success",action:b(on,{"aria-label":"close",size:"small",color:"inherit",onClick:()=>{o(!1)},children:b(y0,{fontSize:"inherit"})}),children:n("exercises.successfullyUpdated")}),b(ri,{})]}),b(ye,{size:6,children:b(tt,{variant:"h5",children:n("English")})}),b(ye,{size:6,children:Q(tt,{variant:"h5",children:[t.nameLong," (",t.nameShort,")"]})}),Q(ye,{size:12,children:[b(ri,{}),b(tt,{variant:"h6",children:n("name")})]}),Q(ye,{size:6,children:[O.name,b("ul",{children:O.aliases.map(k=>b("li",{children:k.alias},k.id))})]}),Q(ye,{size:6,children:[b(en,{mb:2,children:b(EV,{fieldName:"name"})}),b(CV,{fieldName:"alternativeNames"})]}),b(ye,{size:12,children:b(ri,{})}),b(ye,{size:12,children:b(tt,{variant:"h6",children:n("exercises.description")})}),b(ye,{size:{xs:12,md:6},children:b("div",{dangerouslySetInnerHTML:{__html:O.description}})}),b(ye,{size:{xs:12,md:6},children:b(OV,{fieldName:"description"})}),v.data&&Q(xt,{children:[b(ye,{size:12,children:b(ri,{})}),b(ye,{size:{xs:12,md:6},children:b(I1t,{exerciseId:C.id,initial:C.category.id})}),b(ye,{size:{xs:12,md:6},children:b(T1t,{exerciseId:C.id,initial:C.equipment.map(k=>k.id)})})]}),Q(ye,{size:12,children:[b(ri,{}),b(at,{variant:"contained",type:"submit",sx:{mt:1,mr:1},disabled:c.isLoading||u.isPending||d.isPending,children:n("save")})]})]})})}),b(ri,{}),b(tt,{variant:"h6",children:n("images")}),Q(ye,{container:!0,spacing:2,mt:2,children:[f.data&&b(ye,{size:{md:3},children:b(U1t,{exerciseId:C.id})},"add"),C.images.map(k=>b(ye,{size:{md:3},children:b(H1t,{exerciseId:C.id,image:k,canDelete:h.data})},k.id))]}),b(ri,{}),b(tt,{variant:"h6",children:n("videos")}),Q(ye,{container:!0,spacing:2,mt:2,children:[g.data&&b(ye,{size:{md:3},children:b(G1t,{exerciseId:C.id})},"add"),C.videos.map(k=>b(ye,{size:{md:3},children:b(W1t,{video:k,canDelete:y.data})},k.id))]}),v.data&&Q(xt,{children:[b(ri,{}),b(tt,{variant:"h6",children:n("exercises.muscles")}),Q(ye,{container:!0,spacing:1,mt:2,children:[b(ye,{size:{xs:12,md:6},children:b(eJ,{exerciseId:C.id,value:i,setValue:a,blocked:s,isMain:!0})}),b(ye,{size:{xs:12,md:6},children:b(eJ,{exerciseId:C.id,value:s,setValue:l,blocked:i,isMain:!1})}),b(ye,{size:{sm:6},offset:{md:3},children:Q(ye,{container:!0,children:[b(ye,{display:"flex",justifyContent:"center",size:6,children:b(zl,{primaryMuscles:i.map(k=>x.data.find(M=>M.id===k)),secondaryMuscles:s.map(k=>x.data.find(M=>M.id===k)),isFront:!0})}),b(ye,{display:"flex",justifyContent:"center",size:6,children:b(zl,{primaryMuscles:i.map(k=>x.data.find(M=>M.id===k)),secondaryMuscles:s.map(k=>x.data.find(M=>M.id===k)),isFront:!1})})]})})]})]})]})},Q1t=({mainImage:e,sideImages:t})=>Q(ye,{container:!0,spacing:1,children:[e&&b(ye,{size:12,children:b(fo,{children:b(Ec,{component:"img",image:e.url,alt:""})})}),t.map(n=>b(ye,{size:6,children:b(fo,{children:b(Ec,{component:"img",image:n.url,sx:{height:120},alt:""})})},n.id))]}),X1t=({videos:e})=>b(ye,{container:!0,spacing:1,children:e.map(t=>b(ye,{size:6,children:b(fo,{children:b(Ec,{component:"video",src:t.url,sx:{height:120},controls:!0,muted:!0,preload:"metadata"})})},t.id))});function kV(){var r,o;const e=Pa(),t=Od(au.EDIT_EXERCISE),n={canContribute:!1,anonymous:!0,emailVerified:!1,admin:!1};if(e.isSuccess&&t.isSuccess){if(e.data===null)return n;n.anonymous=!1,(r=e.data)!=null&&r.emailVerified&&(n.emailVerified=!0),t.data&&(n.admin=!0),(n.admin||(o=e.data)!=null&&o.isTrustworthy)&&(n.canContribute=!0)}return n}const J1t=({setEditMode:e})=>{const[t]=Re();return Q(en,{mb:2,paddingY:2,sx:{width:"100%",backgroundColor:"#ebebeb",textAlign:"center"},children:[b(tt,{variant:"h5",children:t("exercises.exerciseNotTranslated")}),b(tt,{gutterBottom:!0,variant:"body1",component:"div",children:t("exercises.exerciseNotTranslatedBody")}),b(at,{variant:"contained",onClick:()=>e(!0),children:t("exercises.translateExerciseNow")})]})},Z1t=({exercise:e,variations:t,language:n,setEditMode:r})=>{var l;const[o]=Re(),i=kV(),a=e.getTranslation(n),s=n&&n.id!==a.language;return Q(ye,{container:!0,children:[s&&i.canContribute&&b(ye,{order:{xs:2,sm:1},size:{xs:12,sm:7,md:12},children:b(J1t,{setEditMode:r})}),Q(ye,{order:{xs:2,sm:1},size:{xs:12,sm:7,md:8},children:[(a==null?void 0:a.aliases.length)>0&&Q(xt,{children:[Q("p",{children:[o("exercises.alsoKnownAs"),"  ",(l=a==null?void 0:a.aliases)==null?void 0:l.map(c=>c.alias).join(", ")]}),b(ri,{})]}),b(tt,{variant:"h5",children:o("exercises.description")}),b("div",{dangerouslySetInnerHTML:{__html:a==null?void 0:a.description}}),b(ri,{}),(a==null?void 0:a.notes.length)>0&&b(tt,{variant:"h5",children:o("exercises.notes")}),b("ul",{children:a==null?void 0:a.notes.map(c=>b("li",{children:c.note},c.id))}),b(ri,{}),b(tt,{variant:"h5",children:o("exercises.muscles")}),Q(ye,{container:!0,children:[b(ye,{order:{xs:1},size:{xs:6,md:3},children:b(zl,{primaryMuscles:e.muscles,secondaryMuscles:e.musclesSecondary,isFront:!0})}),Q(ye,{order:{xs:2,md:3},size:{xs:6,md:3},children:[b("h3",{children:o("exercises.primaryMuscles")}),b("ul",{children:e.muscles.map(c=>b("li",{children:c.getName(o)},c.id))})]}),b(ye,{order:{xs:3,md:2},size:{xs:6,md:3},children:b(zl,{primaryMuscles:e.muscles,secondaryMuscles:e.musclesSecondary,isFront:!1})}),Q(ye,{order:{xs:4},size:{xs:6,md:3},children:[b("h3",{children:o("exercises.secondaryMuscles")}),b("ul",{children:e.musclesSecondary.map(c=>b("li",{children:c.getName(o)},c.id))})]})]}),b(ri,{})]}),Q(ye,{order:{xs:1,sm:2},size:{xs:12,sm:5,md:4},children:[b(Q1t,{mainImage:e.mainImage,sideImages:e.sideImages}),b(ri,{}),b(X1t,{videos:e.videos})]}),Q(ye,{order:{xs:3},size:12,children:[b(Ti,{}),b(ri,{}),t.length>0&&b(tt,{variant:"h5",children:o("exercises.variations")}),b(ye,{container:!0,spacing:2,children:t.map(c=>b(ye,{size:{xs:6,md:2},children:b(Qle,{exercise:c,language:n},c.id)},c.id))})]}),b(ye,{order:{xs:4},size:12,children:Q(tt,{variant:"caption",display:"block",mt:2,children:["The text on this page is available under the ",b("a",{href:"https://creativecommons.org/licenses/by-sa/4.0/deed",children:"CC BY-SA 4 License"}),"."]})})]})};function eEt(e){var d,f;const[t,n]=X.useState(null),[r,o]=X.useState(null),[i]=Re(),a=zu(),s=()=>{o(null),n(null)},l=async()=>{var h;await nAe((h=e.currentExercise.getTranslation(e.currentLanguage))==null?void 0:h.id),e.onClose(),e.onChangeLanguage()},c=async(h=!1)=>{h?await PW(e.currentExercise.id,r==null?void 0:r.uuid):await PW(e.currentExercise.id),e.onClose(),a("../overview")},u=async h=>{const g=h!==void 0?h:t;if(g!==null)try{const y=await w0(g);o(y)}catch{o(null)}};return Q(xt,{children:[b(cE,{id:"alert-dialog-title",children:i("delete")}),Q(Lw,{children:[b("p",{children:i("exercises.deleteExerciseBody",{name:(d=e.currentExercise.getTranslation(e.currentLanguage))==null?void 0:d.name,language:(f=e.currentLanguage)==null?void 0:f.nameLong})}),b("p",{children:i("cannotBeUndone")}),b("p",{children:b("b",{children:i("exercises.replacements")})}),b("p",{children:i("exercises.replacementsInfoText")}),b("p",{children:i("exercises.replacementsSearch")}),b(ty,{callback:h=>{h!==null&&(n(h.data.base_id),u(h.data.base_id))}}),b(tn,{"data-testid":"exercise-id-field",id:"foo",label:"Exercise ID",onBlur:()=>u(),onChange:async h=>{n(h.target.value!==""?parseInt(h.target.value):null)},value:t??"",InputProps:{endAdornment:b(ro,{position:"start",children:b(on,{onClick:()=>u(),children:b(xrt,{})})})},fullWidth:!0,variant:"standard"}),r===null&&b(xt,{children:b("p",{children:b("i",{children:i("exercises.noReplacementSelected")})})}),r!==null&&Q(xt,{children:[Q("p",{children:["Selected exercise for replacement:",b(Do,{title:i("copyToClipboard"),children:b(on,{onClick:()=>navigator.clipboard.writeText(r.id.toString()),children:b(krt,{})})})]}),Q(Ka,{disablePadding:!0,children:[b(JF,{children:b(Nl,{children:r.mainImage?b(Nl,{alt:"",src:`${cj}${r.mainImage.url}`,variant:"rounded"}):b(_u,{})})}),b(uo,{primary:r.getTranslation().name,secondary:`${r.id} (${r.uuid})`}),b(on,{onClick:s,children:b(Trt,{})})]})]})]}),Q(Nw,{children:[b(at,{onClick:()=>e.onClose(),children:i("cancel")}),b(at,{"data-testid":"button-delete-translation",size:"small",onClick:l,variant:"contained",children:i("exercises.deleteTranslation")}),b(at,{"data-testid":"button-delete-all",size:"small",onClick:()=>c(),variant:"contained",children:i("exercises.deleteExerciseFull")}),b(at,{"data-testid":"button-delete-and-replace",size:"small",disabled:r===null,onClick:()=>c(!0),variant:"contained",children:i("exercises.deleteExerciseReplace")})]})]})}const tEt="_root_l288f_1",nEt="_detail_language_l288f_4",rEt="_detail_l288f_4",oEt="_languages_l288f_28",iEt="_language_l288f_28",aEt="_header_l288f_52",sEt="_toolbar_l288f_55",Xf={root:tEt,detail_language:nEt,detail:rEt,languages:oEt,language:iEt,header:aEt,toolbar:sEt},lEt=({exercise:e,languages:t,changeLanguage:n,language:r,setEditMode:o,editMode:i})=>{var E,T,O;const[a,s]=w.useState(null),[l,c]=X.useState(!1),u=!!a,[d]=Re(),f=Od(au.DELETE_EXERCISE),h=Od(au.EDIT_EXERCISE),g=Pa(),y=g.isSuccess&&g.data===null;let v=!1;g.isSuccess&&h.isSuccess&&(v=h.data||g.data!==null&&g.data.isTrustworthy);const x=A=>{s(A.currentTarget)},S=()=>{s(null)},C=A=>{n(A),S()},I=t.map(A=>Q(Ft,{onClick:()=>C(A),selected:(r==null?void 0:r.id)===A.id,children:[b(uo,{children:A.nameLong}),b(si,{children:e.availableLanguages.includes(A.id)?b(zrt,{}):b($o,{})})]},A.nameShort));return b(ye,{container:!0,children:b(ye,{size:12,children:Q("div",{className:Xf.root,children:[b($w,{open:l,onClose:()=>c(!1),children:b(eEt,{onClose:()=>c(!1),onChangeLanguage:()=>n(t[0]),currentExercise:e,currentLanguage:r})}),Q("div",{className:Xf.detail_language,children:[Q("div",{className:Xf.detail,children:[b(io,{to:"../overview",children:d("exercises.exercises")})," > ",(E=e.getTranslation(r))==null?void 0:E.name]}),b("div",{className:Xf.languages,children:Q("div",{className:Xf.language,children:[b(at,{size:"small",id:"basic-button",onClick:x,startIcon:b(gz,{}),children:r==null?void 0:r.nameLong}),Q(Sa,{id:"basic-menu",anchorEl:a,open:u,onClose:S,MenuListProps:{"aria-labelledby":"basic-button"},sx:{padding:20},children:[b(Ft,{disabled:!0,children:d("exercises.changeExerciseLanguage")}),b(Ti,{}),I]})]})})]}),Q("div",{className:Xf.header,children:[b(tt,{gutterBottom:!0,variant:"h2",margin:0,sx:{mt:2},children:(T=e.getTranslation(r))==null?void 0:T.name}),!y&&Q("nav",{className:Xf.toolbar,children:[f.isSuccess&&f.data&&(r==null?void 0:r.id)===((O=e.getTranslation(r))==null?void 0:O.language)&&b(at,{onClick:()=>c(!0),children:d("delete")}),v&&b(at,{onClick:()=>o(!0),disabled:i,children:"EDIT"}),b(at,{onClick:()=>o(!1),disabled:!i,children:"VIEW"})]})]}),Q(_t,{direction:"row",spacing:1,mt:2,children:[b(Pu,{label:d(Ki(e.category.name)),size:"small"}),e.equipment.map(A=>b(Pu,{label:d(Ki(A.name)),variant:"outlined",size:"small"},A.id))]})]})})})},ri=()=>b(en,{sx:{height:20}}),cEt=()=>{var g;const[e,t]=w.useState(Dke),[n,r]=w.useState(!1),o=Ea(),i=parseInt(o.exerciseId??"");if(Number.isNaN(i))return b("p",{children:"Please pass an integer as the exercise id."});const{i18n:a}=Re(),s=zu(),l=$c(),c=br({queryKey:[jke,i],queryFn:()=>w0(i),enabled:l.isSuccess}),u=br({queryKey:[Fke,(g=c.data)==null?void 0:g.variationId],queryFn:()=>{var y;return XMe((y=c.data)==null?void 0:y.variationId)},enabled:c.isSuccess});if(X.useEffect(()=>{if(l.data===void 0)return;const y=Tu(a.language,l.data);t(y)},[l.data]),c.isError||l.isError||u.isError)return s("/not-found"),null;const d=y=>{const v=Tu(y.nameShort,l.data);v!==void 0&&t(v)},f=u.isSuccess?u.data.filter(y=>y.id!==i):[];let h;return c.isSuccess&&l.isSuccess&&(h=n?b(Y1t,{exerciseId:c.data.id,language:e}):b(Z1t,{exercise:c.data,language:e,variations:f,setEditMode:r})),Q(xt,{children:[c.isSuccess&&l.isSuccess&&b(Iu,{children:b(lEt,{exercise:c.data,languages:l.data,changeLanguage:d,language:e,setEditMode:r,editMode:n})}),b(ri,{}),Q(Iu,{maxWidth:"lg",children:[c.isLoading&&l.isLoading&&b(Ba,{}),h]})]})};function gfe(e){const[t]=Re(),[n,r,o]=Za(e.fieldName),[i,a]=w.useState(""),s=u=>{o.setValue(n.value.filter((d,f)=>f!==u))},l=(u,d)=>{n.value[u]=d,o.setValue(n.value)},c=()=>{n.value.push(i),o.setValue(n.value),a("")};return Q(xt,{children:[b(ye,{size:12,children:b(tn,{fullWidth:!0,label:t("exercises.newNote"),sx:{mb:3},variant:"standard",value:i,onChange:u=>a(u.target.value),error:r.touched&&!!r.error,helperText:r.touched&&r.error?r.error:t("exercises.notesHelpText"),InputProps:{endAdornment:b(ro,{position:"end",children:b(on,{onClick:c,children:b($o,{})})})}})}),n.value.map((u,d)=>b(tn,{fullWidth:!0,value:u,onChange:f=>l(d,f.target.value),sx:{mt:2},variant:"standard",error:r.touched&&!!r.error,InputProps:{endAdornment:b(ro,{position:"end",children:b(on,{onClick:()=>s(d),children:b(W0,{})})})}},d))]})}const uEt=({onContinue:e,onBack:t})=>{const[n]=Re(),[r,o]=dv(),i=_o({description:TV(n),notes:efe(n)});return b(ci,{initialValues:{description:r.descriptionEn,notes:r.notesEn},validationSchema:i,onSubmit:a=>{o(a1t(a.description)),o(s1t(a.notes)),e()},children:b(Zo,{children:Q(_t,{children:[b(OV,{fieldName:"description"}),b(ri,{}),b(gfe,{fieldName:"notes"}),b(ye,{container:!0,children:b(ye,{display:"flex",justifyContent:"end",size:12,children:b(en,{sx:{mb:2},children:Q("div",{children:[b(at,{onClick:t,sx:{mt:1,mr:1},children:n("goBack")}),b(at,{variant:"contained",type:"submit",sx:{mt:1,mr:1},children:n("continue")})]})})})})]})})})},dEt=({onContinue:e,onBack:t})=>{const[n]=Re(),r=$c(),[o,i]=dv(),[a,s]=w.useState(o.languageId!==null),l=_o(a?{description:TV(n),name:PV(n),alternativeNames:IV(n),notes:efe(n),language:wo().required()}:{});return b(ci,{initialValues:{name:o.nameI18n,alternativeNames:o.alternativeNamesI18n,description:o.descriptionI18n,language:o.languageId===null?"":o.languageId,notes:o.notesI18n},validationSchema:l,onSubmit:c=>{i(c1t(c.name)),i(u1t(c.description)),i(f1t(c.alternativeNames)),i(b1t(c.language===""?null:c.language)),i(d1t(c.notes)),e()},children:c=>Q(Zo,{children:[Q(_t,{spacing:2,children:[b(Fw,{children:b(ba,{checked:a,onClick:()=>s(!a),control:b(li,{}),label:n("exercises.translateExerciseNow")})}),a&&Q(xt,{children:[r.isLoading?b(en,{children:b(Ba,{})}):Q(rh,{fullWidth:!0,children:[b(oh,{id:"label-language",children:n("language")}),b(gf,{labelId:"label-language",id:"language",value:c.getFieldProps("language").value,onChange:u=>{c.setFieldValue(c.getFieldProps("language").name,u.target.value)},label:n("language"),error:!!(c.touched.language&&c.errors.language),children:r.data.filter(u=>u.id!==Hp).map(u=>Q(Ft,{value:u.id,children:[u.nameShort," - ",u.nameLong]},u.id))})]}),b(EV,{fieldName:"name"}),b(CV,{fieldName:"alternativeNames"}),b(OV,{fieldName:"description"}),b(ri,{}),b(gfe,{fieldName:"notes"})]})]}),b(ye,{container:!0,children:b(ye,{display:"flex",justifyContent:"end",size:12,children:b(en,{sx:{mb:2},children:Q("div",{children:[b(at,{onClick:t,sx:{mt:1,mr:1},children:n("goBack")}),b(at,{variant:"contained",type:"submit",sx:{mt:1,mr:1},children:n("continue")})]})})})})]})})};function fEt(e){const[t]=Re(),[n,r]=Za(e.fieldName);return b(tn,{fullWidth:!0,id:e.fieldName,label:t("licenses.authors"),variant:"standard",error:r.touched&&!!r.error,helperText:r.touched&&r.error,...n})}function pEt(e){const[t]=Re(),[n,r]=Za(e.fieldName);return b(tn,{fullWidth:!0,id:e.fieldName,label:t("licenses.authorProfile"),variant:"standard",placeholder:"https://",error:r.touched&&!!r.error,helperText:r.touched&&r.error,...n})}function hEt(e){const[t]=Re(),[n,r]=Za(e.fieldName);return b(tn,{fullWidth:!0,id:e.fieldName,label:t("licenses.derivativeSourceUrl"),variant:"standard",placeholder:"https://",error:r.touched&&!!r.error,helperText:t("licenses.derivativeSourceUrlHelper")||r.touched&&r.error,...n})}function mEt(e){const[t]=Re(),[n,r]=Za(e.fieldName);return b(tn,{fullWidth:!0,id:e.fieldName,label:t("licenses.originalObjectUrl"),variant:"standard",placeholder:"https://",error:r.touched&&!!r.error,helperText:r.touched&&r.error,...n})}function gEt(e){const[t]=Re(),[n,r]=Za(e.fieldName);return b(tn,{fullWidth:!0,id:e.fieldName,label:t("licenses.originalTitle"),variant:"standard",error:r.touched&&!!r.error,helperText:r.touched&&r.error,...n})}function yEt(e){const[t]=Re(),[n,r]=w.useState(nu.PHOTO),[o,i,a]=Za(e.fieldName);return Q(ATe,{value:n,exclusive:!0,fullWidth:!0,onChange:(l,c)=>{r(c),a.setValue(c)},"aria-label":"text alignment",children:[b(tb,{value:nu.PHOTO,children:Q(_t,{justifyContent:"center",alignItems:"center",children:[b(Brt,{}),b(tt,{variant:"caption",children:t("exercises.imageStylePhoto")})]})}),b(tb,{value:nu.THREE_D,children:Q(_t,{justifyContent:"center",alignItems:"center",children:[b(_rt,{}),b(tt,{variant:"caption",children:t("exercises.imageStyle3D")})]})}),b(tb,{value:nu.LINE_ART,children:Q(_t,{justifyContent:"center",alignItems:"center",children:[b($rt,{}),b(tt,{variant:"caption",children:t("exercises.imageStyleLine")})]})}),b(tb,{value:nu.LOW_POLY,children:Q(_t,{justifyContent:"center",alignItems:"center",children:[b(Nrt,{}),b(tt,{variant:"caption",children:t("exercises.imageStyleLowPoly")})]})}),b(tb,{value:nu.OTHER,children:Q(_t,{justifyContent:"center",alignItems:"center",children:[b(Lrt,{}),b(tt,{variant:"caption",children:t("exercises.imageStyleOther")})]})})]})}const vEt=({onContinue:e,onBack:t})=>{const[n]=Re(),r=Pa(),[o,i]=dv(),[a,s]=w.useState(o.images),[l,c]=w.useState(void 0),[u,d]=X.useState(!1),f=()=>d(!1);w.useEffect(()=>{i(w1t(a))},[i,a]);const h=S=>{var E;if(!((E=S.target.files)!=null&&E.length))return;const[C]=S.target.files,I=URL.createObjectURL(C);d(!0),c({url:I,file:C,author:"",authorUrl:"",title:"",derivativeSourceUrl:"",objectUrl:"",style:nu.PHOTO.toString()})},g=S=>{s(a.concat({url:l==null?void 0:l.url,file:l==null?void 0:l.file,author:S.author,authorUrl:S.authorUrl,title:S.title,derivativeSourceUrl:S.derivativeSourceUrl,objectUrl:S.objectUrl,style:S.imageStyle.toString()})),f()},y=S=>{const C=a.filter(I=>I.url!==S);s(C)},v=()=>{e()};return Q("div",{children:[b(by,{open:u,onClose:f,"aria-labelledby":"modal-modal-title","aria-describedby":"modal-modal-description",children:Q(en,{sx:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:600,bgcolor:"background.paper",boxShadow:24,p:4},children:[b(tt,{id:"modal-modal-title",variant:"h6",component:"h2",children:n("exercises.imageDetails")}),Q(ye,{container:!0,spacing:2,children:[b(ye,{size:4,children:l&&b("img",{style:{width:"100%"},src:l.url,alt:"",loading:"lazy"})}),b(ye,{size:8,children:b(ci,{initialValues:{title:"",objectUrl:"",author:r.isSuccess?r.data.username:"",authorUrl:"",derivativeSourceUrl:"",imageStyle:nu.PHOTO},onSubmit:S=>{console.log(S),g(S)},children:S=>Q(Zo,{children:[Q(_t,{spacing:2,children:[b(gEt,{fieldName:"title"}),b(mEt,{fieldName:"objectUrl"}),b(fEt,{fieldName:"author"}),b(pEt,{fieldName:"authorUrl"}),b(hEt,{fieldName:"derivativeSourceUrl"}),b(yEt,{fieldName:"imageStyle"}),Q(Ii,{icon:b(cle,{fontSize:"inherit"}),severity:"info",children:["By submitting this image, you agree to release it under the ",b("a",{href:"https://creativecommons.org/licenses/by-sa/4.0/",target:"_blank",rel:"noreferrer",children:"CC BY-SA 4.0"})," license. The image must be either your own work or the author must have released in under a license compatible with CC BY-SA 4.0."]})]}),b(_t,{direction:"row",justifyContent:"end",sx:{mt:2},children:b(at,{color:"primary",variant:"contained",type:"submit",sx:{mt:2},children:n("add")})})]})})})]})]})}),b(tt,{children:n("exercises.compatibleImagesCC")}),Q(_t,{direction:"row",justifyContent:"center",children:[Q("div",{children:[b("label",{htmlFor:"camera-input",children:b(Crt,{fontSize:"large",sx:{m:2}})}),b("input",{style:{display:"none"},id:"camera-input",type:"file",accept:"image/*",capture:"environment",onChange:h})]}),Q("div",{children:[b("label",{htmlFor:"image-input",children:b(Ort,{fontSize:"large",sx:{m:2}})}),b("input",{type:"file",accept:"image/*",name:"image-file",id:"image-input",style:{display:"none"},onChange:h})]})]}),b(see,{cols:3,style:{maxHeight:"400px"},children:a.map(S=>Q(lee,{children:[b("img",{style:{maxHeight:"400px",maxWidth:"400px"},src:S.url,alt:"",loading:"lazy"}),b(k1e,{title:S.title,subtitle:S.author,actionIcon:b(on,{onClick:()=>y(S.url),sx:{color:"white"},children:b(Mrt,{})})})]},S.url))}),b(tt,{children:n("forms.supportedImageFormats")}),b(ye,{container:!0,children:b(ye,{display:"flex",justifyContent:"end",size:12,children:b(en,{sx:{mb:2},children:Q(xt,{children:[b(at,{onClick:t,sx:{mt:1,mr:1},children:n("goBack")}),b(at,{variant:"contained",onClick:v,sx:{mt:1,mr:1},children:n("continue")})]})})})})]})},bEt="exercisecomment",tJ=async e=>{const t=new pte,n=dt(bEt),r=await nt.post(n,t.toJson(e),{headers:pt()});return t.fromJson(r.data)},wEt="variation",xEt=async()=>{const e=dt(wEt);return(await nt.post(e,{},{headers:pt()})).data.id},SEt=({onBack:e})=>{const[t,n]=Re(),[r]=dv(),o=zu(),i=WT(),a=$c(),s=Yy(),l=GT(),c=Pa(),[u,d]=w.useState("initial"),f=async()=>{d("loading");let g;r.newVariationExerciseId!==null?g=await xEt():g=r.variationId;const y=await JMe(r.category,r.equipment,r.muscles,r.musclesSecondary,g,c.data.username),v=await D2({exerciseId:y,languageId:Hp,name:r.nameEn,description:r.descriptionEn,author:c.data.username});for(const x of r.alternativeNamesEn)await _2(v.id,x);for(const x of r.images)await bte({exerciseId:y,image:x.file,imageData:x});for(const x of r.notesEn)await tJ(new R2(null,v.id,x));if(r.languageId!==null){const x=await D2({exerciseId:y,languageId:r.languageId,name:r.nameI18n,description:r.descriptionI18n,author:c.data.username});for(const S of r.alternativeNamesI18n)await _2(x.id,S);for(const S of r.notesI18n)await tJ(new R2(null,x.id,S))}console.log("Exercise created"),d("done")},h=()=>{o(Qt(Kt.EXERCISE_OVERVIEW,n.language))};return l.isLoading||a.isLoading||s.isLoading||i.isLoading?b(wr,{}):Q(xt,{children:[b(tt,{variant:"h6",children:t("exercises.step1HeaderBasics")}),b(jl,{children:b(Ll,{children:Q(Fl,{children:[Q(Zt,{children:[b(Te,{children:t("name")}),b(Te,{children:r.nameEn})]}),Q(Zt,{children:[b(Te,{children:t("exercises.alternativeNames")}),b(Te,{children:r.alternativeNamesEn.join(", ")})]}),Q(Zt,{children:[b(Te,{children:t("description")}),b(Te,{children:r.descriptionEn})]}),Q(Zt,{children:[b(Te,{children:t("exercises.notes")}),b(Te,{children:r.notesEn.map(g=>Q(xt,{children:[g,b("br",{})]}))})]}),Q(Zt,{children:[b(Te,{children:t("category")}),b(Te,{children:t(Ki(i.data.find(g=>g.id===r.category).name))})]}),Q(Zt,{children:[b(Te,{children:t("exercises.equipment")}),b(Te,{children:r.equipment.map(g=>t(Ki(l.data.find(y=>y.id===g).name))).join(", ")})]}),Q(Zt,{children:[b(Te,{children:t("exercises.muscles")}),b(Te,{children:r.muscles.map(g=>s.data.find(y=>y.id===g).getName(t)).join(", ")})]}),Q(Zt,{children:[b(Te,{children:t("exercises.secondaryMuscles")}),b(Te,{children:r.musclesSecondary.map(g=>s.data.find(y=>y.id===g).getName(t)).join(", ")})]}),Q(Zt,{children:[b(Te,{children:t("exercises.variations")}),Q(Te,{children:[r.variationId," / ",r.newVariationExerciseId]})]})]})})}),r.images.length>0&&b(see,{cols:3,style:{maxHeight:"200px"},children:r.images.map(g=>b(lee,{children:b("img",{style:{maxHeight:"200px",maxWidth:"200px"},src:g.url,alt:"",loading:"lazy"})},g.url))}),r.languageId!==null&&Q(xt,{children:[b(tt,{variant:"h6",sx:{mt:3},children:a.data.find(g=>g.id===r.languageId).nameLong}),b(jl,{children:b(Ll,{children:Q(Fl,{children:[Q(Zt,{children:[b(Te,{children:t("name")}),b(Te,{children:r.nameI18n})]}),Q(Zt,{children:[b(Te,{children:t("exercises.alternativeNames")}),b(Te,{children:r.alternativeNamesI18n.join(", ")})]}),Q(Zt,{children:[b(Te,{children:t("description")}),b(Te,{children:r.descriptionI18n})]}),Q(Zt,{children:[b(Te,{children:t("exercises.notes")}),b(Te,{children:r.notesI18n.map(g=>Q(xt,{children:[g,b("br",{})]}))})]})]})})})]}),u!=="done"?b(Ii,{severity:"info",sx:{mt:2},children:t("exercises.checkInformationBeforeSubmitting")}):Q(Ii,{severity:"success",sx:{mt:2},children:[b(hg,{children:t("success")}),t("exercises.cacheWarning")]}),b(ye,{container:!0,children:b(ye,{display:"flex",justifyContent:"end",size:12,children:b(en,{sx:{mb:2},children:Q("div",{children:[u!=="done"&&b(at,{onClick:e,sx:{mt:1,mr:1},children:t("goBack")}),u!=="done"&&b(at,{variant:"contained",disabled:u!=="initial",onClick:f,sx:{mt:1,mr:1},color:"info",children:t("exercises.submitExercise")}),u==="done"&&Q(at,{variant:"contained",onClick:h,sx:{mt:1,mr:1},color:"success",children:[t("overview"),b(Frt,{})]})]})})})})]})},CEt=()=>{const[e]=Re(),[t,n]=X.useState(0),r=()=>{n(i=>i+1)},o=()=>{n(i=>i-1)};return b(S1t,{children:Q(Iu,{maxWidth:"md",children:[b(_t,{direction:"row",children:b(tt,{gutterBottom:!0,variant:"h3",component:"div",children:e("exercises.contributeExercise")})}),b(en,{children:Q(fIe,{activeStep:t,orientation:"vertical",children:[Q(Qh,{children:[b(ep,{children:e("exercises.step1HeaderBasics")}),b(Xh,{children:b(C1t,{onContinue:r,onBack:o})})]},1),Q(Qh,{children:[b(ep,{children:e("exercises.variations")}),b(Xh,{children:b(P1t,{onContinue:r,onBack:o})})]},2),Q(Qh,{children:[b(ep,{children:e("description")}),b(Xh,{children:b(uEt,{onContinue:r,onBack:o})})]},3),Q(Qh,{children:[b(ep,{children:e("translation")}),b(Xh,{children:b(dEt,{onContinue:r,onBack:o})})]},4),Q(Qh,{children:[b(ep,{children:e("images")}),b(Xh,{children:b(vEt,{onContinue:r,onBack:o})})]},5),Q(Qh,{children:[b(ep,{children:e("overview")}),b(Xh,{children:b(SEt,{onBack:o})})]},6)]})})]})})},EEt=()=>{const[e]=Re(),t=kV();return Q(Iu,{maxWidth:"md",children:[b(tt,{variant:"h3",children:e("exercises.notEnoughRightsHeader")}),Q(en,{marginTop:4,padding:4,sx:{width:"100%",backgroundColor:"#ebebeb",textAlign:"center"},children:[b(tt,{mb:2,children:e("exercises.notEnoughRights",{days:_ke})}),!t.anonymous&&!t.emailVerified&&b(at,{variant:"contained",href:"/user/preferences",endIcon:b(wrt,{}),children:e("preferences")})]})]})},PEt=()=>{const e=kV();return b(xt,{children:e.canContribute?b(CEt,{}):b(EEt,{})})},IEt=()=>b("div",{children:"Add Weight Page"}),TEt=({day:e,currentMonth:t,currentDate:n,selectedDay:r,onClick:o})=>{const i=Lr(),a=Zd(i.breakpoints.down("sm")),s=Zd(i.breakpoints.down("md")),l=kl(e.date,r.date),c=kl(e.date,n),u=e.date.getMonth()===t&&(e.date.getDate()<=n.getDate()||e.date.getMonth()<n.getMonth()||e.date.getFullYear()<n.getFullYear()),d=e.date.getDay()===6||e.date.getDay()===0,f=()=>l||c?"white":u?d?"#E53945":"black":"gray",h=()=>a?35:s?40:50,g=()=>a?8:s?9:10,y=()=>e.measurements.length>0||e.weightEntry!==void 0,v=()=>{u&&o(e)},x=h(),S=g();return Q("div",{style:{position:"relative",width:`${x}px`,height:`${x+S/2}px`,display:"flex",flexDirection:"column",alignItems:"center"},children:[b("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",width:`${x}px`,height:`${x}px`,fontSize:a?"0.8rem":s?"0.9rem":"1rem",color:l||c?"white":f(),backgroundColor:l?"#E53945":c?"#FEC107":"transparent",borderRadius:"50%",fontWeight:"bold",cursor:u?"pointer":"default",opacity:e.date.getMonth()!==t?.25:1},"data-testid":`day-${co(e.date)}`,onClick:v,children:e.date.getDate()}),y()&&b("div",{style:{width:`${S}px`,height:`${S}px`,backgroundColor:"black",borderRadius:"50%",position:"absolute",bottom:0,left:"50%",transform:"translateX(-50%)",zIndex:2}})]})},OEt=({days:e,currentMonth:t,currentDate:n,selectedDay:r,onDayClick:o})=>{const{i18n:i}=Re(),a=Array.from({length:7},(s,l)=>new Date(1970,0,l+5).toLocaleString(i.language,{weekday:"short"}));return Q(ye,{container:!0,spacing:1,rowSpacing:2,children:[a.map((s,l)=>b(ye,{size:12/7,children:b(tt,{variant:"body1",sx:{fontWeight:"bold",textAlign:"center"},children:s})},`weekday-${l}`)),e.map((s,l)=>b(ye,{size:12/7,sx:{display:"flex",justifyContent:"center"},children:b(TEt,{day:s,currentMonth:t,currentDate:n,selectedDay:r,onClick:o})},`day-${l}`))]})},kEt=({currentMonth:e,currentYear:t,onPrevMonth:n,onNextMonth:r})=>{const{i18n:o}=Re(),i=Array.from({length:12},(a,s)=>new Date(2024,s,1).toLocaleString(o.language,{month:"long"}));return Q("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",paddingBottom:"3%"},children:[b(at,{variant:"outlined",onClick:n,children:"<"}),Q(tt,{variant:"h5",children:[i[e]," ",t]}),b(at,{variant:"outlined",onClick:r,children:">"})]})};class MEt{constructor(t,n,r,o){this.name=t,this.unit=n,this.value=r,this.date=o}}const AEt=({selectedDay:e})=>{const[t]=Re(),n=t("no_entries_for_day");return Q(fo,{sx:{width:{xs:"auto",md:"65%"},height:{xs:"60%",md:"100%"},m:{xs:0,sm:1,md:2},p:{xs:1,sm:1.5,md:2}},children:[b(Vl,{title:Q(tt,{variant:"h5",component:"div",sx:{fontWeight:"bold"},children:[t("entries")," - ",e.date.toLocaleDateString()]})}),Q(Pi,{sx:{flex:1,overflow:"auto",display:"flex",flexDirection:"column",gap:2},children:[Q("div",{className:"flex items-center gap-2",children:[Q("span",{className:"font-extrabold",children:[t("weight"),": "]}),b("span",{className:`${e.weightEntry?"text-xl font-semibold":"text-gray-500"}`,children:e.weightEntry?`${e.weightEntry.weight.toFixed(1)} kg`:n})]}),Q("div",{className:"flex flex-col gap-1",children:[Q("span",{className:"font-bold",children:[t("measurements.measurements"),": "]}),e.measurements.length===0?b("span",{className:"text-gray-500 mt-1",children:n}):b("div",{className:"flex flex-col gap-0.5",children:e.measurements.map(r=>Q("div",{children:[r.name,": ",r.value," ",r.unit]},r.name))})]})]})]})};function REt(){const t=Jle().data;return(t==null?void 0:t.flatMap(n=>n.entries.map(r=>new MEt(n.name,n.unit,r.value,r.date))))??[]}const DEt=()=>{const[e]=Re(),n=Y0().data,r=REt(),o=(C,I)=>{const E=new Date(C,I,1),T=[];let A=new Date(C,I,1).getDay();A=A===0?6:A-1;for(let R=0;R<A;R++)T.push({date:new Date(C,I,-A+R+1),weightEntry:void 0,measurements:[]});for(;E.getMonth()===I;)T.push({date:new Date(E),weightEntry:n==null?void 0:n.find(R=>kl(R.date,E)),measurements:r.filter(R=>kl(R.date,E))}),E.setDate(E.getDate()+1);A=new Date(C,I+1,0).getDay();const M=A===0?0:7-A;for(let R=1;R<=M;R++)T.push({date:new Date(C,I+1,R),weightEntry:void 0,measurements:[]});return T},i=new Date,a={date:i,weightEntry:void 0,measurements:[]},[s,l]=w.useState(i.getMonth()),[c,u]=w.useState(i.getFullYear()),d=o(c,s),[f,h]=w.useState(d.find(C=>kl(C.date,i))||a),g=Lr(),y=Zd(g.breakpoints.down("sm"));w.useEffect(()=>{l(f.date.getMonth()),u(f.date.getFullYear())},[f]);const v=C=>{h(C)},x=()=>{s===0?(l(11),u(c-1)):l(s-1)},S=()=>{(s<i.getMonth()||c<i.getFullYear())&&(s===11?(l(0),u(c+1)):l(s+1))};return Q(en,{sx:{display:"flex",gap:2,flexDirection:{xs:"column",md:"row"},height:{xs:"auto",md:"calc(100vh - 130px)"},width:"100%"},children:[Q(fo,{sx:{width:{xs:"auto",md:"65%"},height:{xs:"auto%",md:"100%"},m:{xs:0,sm:1,md:2},p:{xs:1,sm:1.5,md:2},display:"flex",flexDirection:"column"},children:[b(Vl,{sx:{"& .MuiCardHeader-content":{width:"100%"}},title:b("div",{style:{display:"flex",flexDirection:"column",width:"100%"},children:Q("div",{style:{display:"flex",alignItems:"center",marginBottom:"16px"},children:[b(Srt,{style:{width:y?"28px":"32px",height:y?"28px":"32px",marginRight:"12px"}}),b("span",{style:{fontSize:y?"1.5rem":"1.8rem",fontWeight:"bold"},children:e("calendar")})]})})}),Q(Pi,{sx:{overflow:"auto",flex:1,"&:last-child":{paddingBottom:2}},children:[b(kEt,{currentMonth:s,currentYear:c,onPrevMonth:x,onNextMonth:S}),b(OEt,{days:d,currentMonth:s,currentDate:i,selectedDay:f,onDayClick:v})]})]}),b(AEt,{selectedDay:f})]})},_Et=()=>b("div",{children:b(DEt,{})}),$Et=()=>b("div",{children:"Calories Calculator Page"}),NEt=()=>b("div",{children:"Equipments Page"}),LEt=()=>b("div",{children:"Gallery Page"}),FEt=()=>b("div",{children:"Ingredients Page"}),jEt=()=>b("div",{children:"Login Page"}),BEt=()=>b("div",{children:"Preferences Page"}),zEt=()=>b("div",{children:"RestApi Page"}),VEt=({weight:e})=>{const t=Oit(),[n]=Re(),[r,o]=X.useState(null),[i,a]=X.useState(!1),s=!!r,l=g=>{o(g.currentTarget)},c=()=>{u(),f()},u=()=>{o(null)},d=()=>{t.mutate(e.id),o(null)},f=()=>a(!0),h=()=>a(!1);return Q("div",{children:[b(at,{onClick:l,children:b(vrt,{})}),Q(Sa,{anchorEl:r,open:s,onClose:u,MenuListProps:{"aria-labelledby":"basic-button"},children:[b(Ft,{onClick:c,children:n("edit")}),b(Ft,{onClick:d,children:n("delete")})]}),b(ki,{title:n("edit"),isOpen:i,closeFn:h,children:b(Jy,{weightEntry:e,closeFn:h})})]})},HEt=()=>{const[e]=Re(),[t,n]=X.useState(!1),r=()=>n(!0),o=()=>n(!1);return Q("div",{children:[b(nh,{color:"primary","aria-label":"add",onClick:r,sx:{position:"fixed",bottom:"5rem",right:i=>i.spacing(2),zIndex:9},children:b($o,{})}),b(ki,{title:e("add"),isOpen:t,closeFn:o,children:b(Jy,{closeFn:o})})]})},UEt=e=>e.map((t,n)=>n===0?{entry:t,change:0,days:Math.abs(t.date.getTime()-t.date.getTime())/(1e3*60*60*24)}:{entry:t,change:e[n].weight-e[n-1].weight,days:Math.abs(t.date.getTime()-e[n-1].date.getTime())/(1e3*60*60*24)}),WEt=Oz(e=>({table:{"& .MuiPaper-root":{border:"1px solid #bababa"}}})),GEt=({weights:e})=>{const t=[10,50,100],[n]=Re(),r=WEt(),o=UEt(e),[i,a]=w.useState(t[0]),[s,l]=w.useState(0),c=(d,f)=>{l(f)},u=d=>{a(parseInt(d.target.value,10)),l(0)};return Q("div",{className:r.table,children:[Q(jl,{children:[Q(Ll,{sx:{minWidth:650},"aria-label":"simple table",children:[b(Du,{children:Q(Zt,{children:[b(Te,{align:"center",children:n("date")}),b(Te,{align:"center",children:n("weight")}),b(Te,{align:"center",children:n("difference")}),b(Te,{align:"center",children:n("days")}),b(Te,{align:"center"})]})}),b(Fl,{children:o.slice(s*i,s*i+i).map(d=>Q(Zt,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[b(Te,{component:"th",scope:"row",align:"center",children:d.entry.date.toLocaleDateString()}),b(Te,{align:"center",children:d.entry.weight}),b(Te,{align:"center",children:+d.change.toFixed(2)}),b(Te,{align:"center",children:d.days}),b(Te,{align:"center",children:b(VEt,{weight:d.entry})})]},d.entry.date.toLocaleDateString()))})]}),b(nj,{rowsPerPageOptions:t,component:"div",count:o.length,rowsPerPage:i,page:s,onPageChange:c,onRowsPerPageChange:u})]}),b(HEt,{})]})},qEt=()=>{const[e]=Re(),[t,n]=w.useState(!1),r=()=>n(!0),o=()=>n(!1);return Q("div",{children:[b(nh,{color:"secondary","aria-label":"add",onClick:r,sx:{position:"fixed",bottom:"5rem",right:i=>i.spacing(2),zIndex:9},children:b($o,{})}),b(ki,{title:e("add"),isOpen:t,closeFn:o,children:b(Jy,{closeFn:o})})]})},KEt=({currentFilter:e,onFilterChange:t})=>{const[n]=Re(),r=Lr(),o=i=>{e!==i&&t(i)};return Q(GF,{variant:"outlined",sx:{mb:2},children:[b(at,{onClick:()=>o(""),color:e===""?"primary":"inherit",variant:e===""?"contained":"outlined",sx:{fontFamily:r.typography.fontFamily},children:n("all")}),b(at,{onClick:()=>o("lastYear"),color:e==="lastYear"?"primary":"inherit",variant:e==="lastYear"?"contained":"outlined",sx:{fontFamily:r.typography.fontFamily},children:n("lastYear")}),b(at,{onClick:()=>o("lastHalfYear"),color:e==="lastHalfYear"?"primary":"inherit",variant:e==="lastHalfYear"?"contained":"outlined",sx:{fontFamily:r.typography.fontFamily},children:n("lastHalfYear")}),b(at,{onClick:()=>o("lastMonth"),color:e==="lastMonth"?"primary":"inherit",variant:e==="lastMonth"?"contained":"outlined",sx:{fontFamily:r.typography.fontFamily},children:n("lastMonth")}),b(at,{onClick:()=>o("lastWeek"),color:e==="lastWeek"?"primary":"inherit",variant:e==="lastWeek"?"contained":"outlined",sx:{fontFamily:r.typography.fontFamily},children:n("lastWeek")})]})},YEt=()=>{const[e]=Re(),[t,n]=w.useState("lastYear"),r=Y0(t),o=i=>{n(i)};return r.isLoading?b(wr,{}):b(es,{title:e("weight"),mainContent:Q(_t,{spacing:2,children:[b(KEt,{currentFilter:t,onFilterChange:o}),r.data.length===0&&b(ih,{}),r.data.length!==0&&Q(xt,{children:[b(Wle,{weights:r.data}),b(en,{sx:{mt:4}}),b(GEt,{weights:r.data})]})]}),fab:b(qEt,{})})},QEt=()=>{const{i18n:e}=Re(),[t,n]=X.useState(null);return Q(xt,{children:[b(at,{color:"inherit",onClick:r=>n(r.currentTarget),children:"Weight"}),Q(Sa,{anchorEl:t,open:!!t,onClose:()=>n(null),children:[b(Ft,{component:io,to:Qt(Kt.WEIGHT_OVERVIEW,e.language),children:"Weight overview"}),b(Ft,{component:io,to:Qt(Kt.WEIGHT_ADD,e.language),children:"Add weight entry"})]})]})},XEt=()=>{const{i18n:e}=Re(),[t,n]=X.useState(null);return Q(xt,{children:[b(at,{color:"inherit",onClick:r=>n(r.currentTarget),children:"Measurements"}),b(Sa,{anchorEl:t,open:!!t,onClose:()=>n(null),children:b(Ft,{component:io,to:Qt(Kt.MEASUREMENT_OVERVIEW,e.language),children:"Overview"})})]})},JEt=()=>{const{i18n:e}=Re(),[t,n]=X.useState(null);return Q(xt,{children:[b(at,{color:"inherit",onClick:r=>n(r.currentTarget),children:"Nutrition"}),b(Sa,{anchorEl:t,open:!!t,onClose:()=>n(null),children:b(Ft,{component:io,to:Qt(Kt.NUTRITION_OVERVIEW,e.language),children:"Overview"})})]})},ZEt=()=>{const{i18n:e}=Re(),[t,n]=X.useState(null);return Q(xt,{children:[b(at,{color:"inherit",onClick:r=>n(r.currentTarget),children:"Routines"}),Q(Sa,{anchorEl:t,open:!!t,onClose:()=>n(null),children:[b(Ft,{component:io,to:Qt(Kt.ROUTINE_OVERVIEW,e.language),children:"Routine overview"}),b(Ft,{component:io,to:Qt(Kt.PRIVATE_TEMPLATE_OVERVIEW,e.language),children:"Private template overview"}),b(Ft,{component:io,to:Qt(Kt.PUBLIC_TEMPLATE_OVERVIEW,e.language),children:"Public template overview"}),b(Ft,{component:io,to:Qt(Kt.EXERCISE_OVERVIEW,e.language),children:"Exercise overview"}),b(Ft,{component:io,to:Qt(Kt.EXERCISE_CONTRIBUTE,e.language),children:"Contribute exercise"}),b(Ft,{component:io,to:Qt(Kt.CALENDAR,e.language),children:"Calendar"})]})]})},ePt=()=>b(Owe,{position:"static",children:Q(wee,{children:[b(tt,{variant:"h6",component:"div",mr:3,children:"wger"}),b(ZEt,{}),b(QEt,{}),b(XEt,{}),b(JEt,{})]})}),tPt=()=>b(YEt,{}),nPt=()=>b("div",{children:"Workout Page"}),_$=()=>b(cEt,{}),MV=()=>Q(Wot,{children:[Q(Ut,{path:"/:lang",children:[Q(Ut,{path:"workout",children:[b(Ut,{path:"overview",element:b(nPt,{})}),b(Ut,{path:"gallery",element:b(LEt,{})})]}),Q(Ut,{path:"routine",children:[b(Ut,{index:!0,element:b(qX,{})}),b(Ut,{path:"overview",element:b(qX,{})}),b(Ut,{path:"calendar",element:b(_Et,{})}),b(Ut,{path:"add",element:b(ebt,{})}),Q(Ut,{path:":routineId",children:[b(Ut,{path:"day/:dayId",children:b(Ut,{path:"add-logs",element:b(LCt,{})})}),Q(Ut,{path:"edit",children:[b(Ut,{index:!0,element:b(_Ct,{})}),b(Ut,{path:"progression/:slotId",element:b(FCt,{})})]}),b(Ut,{path:"view",element:b(rbt,{})}),b(Ut,{path:"table",element:b(obt,{})}),b(Ut,{path:"logs",element:b(WCt,{})}),b(Ut,{path:"statistics",element:b(YCt,{})})]}),Q(Ut,{path:"templates",children:[b(Ut,{path:":routineId",children:b(Ut,{path:"view",element:b(jCt,{})})}),Q(Ut,{path:"overview",children:[b(Ut,{path:"private",element:b(XCt,{})}),b(Ut,{path:"public",element:b(JCt,{})})]})]})]}),Q(Ut,{path:"measurement",children:[b(Ut,{index:!0,element:b(nX,{})}),b(Ut,{path:"overview",element:b(nX,{})}),b(Ut,{path:"category/:categoryId",element:b(kvt,{})})]}),Q(Ut,{path:"exercise",children:[b(Ut,{index:!0,element:b(zY,{})}),b(Ut,{path:"overview",element:b(zY,{})}),b(Ut,{path:":exerciseId",element:b(_$,{}),children:b(Ut,{path:"view",element:b(_$,{}),children:b(Ut,{path:":slug",element:b(_$,{})})})}),b(Ut,{path:"contribute",element:b(PEt,{})})]}),Q(Ut,{path:"weight",children:[b(Ut,{path:"overview",element:b(tPt,{})}),b(Ut,{path:"add",element:b(IEt,{})})]}),Q(Ut,{path:"nutrition",children:[b(Ut,{path:"overview",element:b(Gvt,{})}),Q(Ut,{path:":planId",children:[b(Ut,{path:"view",element:b(Wvt,{})}),b(Ut,{path:":date",element:b(rX,{})}),b(Ut,{path:"diary",element:b(rX,{})})]}),Q(Ut,{path:"calculator",children:[b(Ut,{path:"bmi",element:b(Rvt,{})}),b(Ut,{path:"calories",element:b($Et,{})})]}),b(Ut,{path:"ingredient",children:b(Ut,{path:"overview",element:b(FEt,{})})})]}),Q(Ut,{path:"software",children:[b(Ut,{path:"about-us",element:b(ZCt,{})}),b(Ut,{path:"api",element:b(zEt,{})}),b(Ut,{path:"equipment",element:b(NEt,{})})]}),b(Ut,{path:"login",element:b(jEt,{})}),b(Ut,{path:"user",children:b(Ut,{path:"preferences",element:b(BEt,{})})})]}),b(Ut,{path:"/",element:b(Bst,{})}),b(Ut,{path:"*",element:b("main",{style:{padding:"1rem"},children:b("p",{children:"404, Page NOT FOUND"})})})]}),rPt="_notification_bbb61_1",nJ={notification:rPt},oPt=()=>{const[e,t]=o1t(),n=()=>{t(KX({notify:!1,message:"",severity:void 0,title:"",type:void 0}))},r=()=>{t(KX({notify:!1,message:"",severity:void 0,title:"",type:void 0,undo:!0}))};return e.notification.notify?e.notification.type==="delete"?Q(Ii,{className:nJ.notification,severity:e.notification.severity,action:b(at,{color:"inherit",size:"small",onClick:r,children:"UNDO"}),variant:"filled",children:[b(hg,{children:e.notification.title}),b("strong",{children:e.notification.message})]}):Q(Ii,{className:nJ.notification,severity:e.notification.severity,onClose:()=>n(),variant:"filled",children:[b(hg,{children:e.notification.title}),b("strong",{children:e.notification.message})]}):null};function iPt(){return Q(ye,{container:!0,children:[b(ye,{size:12,children:b(ePt,{})}),b(ye,{size:12,children:b(oPt,{})}),b(ye,{size:12,children:b(MV,{})})]})}const{slice:aPt,forEach:sPt}=[];function lPt(e){return sPt.call(aPt.call(arguments,1),t=>{if(t)for(const n in t)e[n]===void 0&&(e[n]=t[n])}),e}const rJ=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,cPt=function(e,t){const r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},o=encodeURIComponent(t);let i=`${e}=${o}`;if(r.maxAge>0){const a=r.maxAge-0;if(Number.isNaN(a))throw new Error("maxAge should be a Number");i+=`; Max-Age=${Math.floor(a)}`}if(r.domain){if(!rJ.test(r.domain))throw new TypeError("option domain is invalid");i+=`; Domain=${r.domain}`}if(r.path){if(!rJ.test(r.path))throw new TypeError("option path is invalid");i+=`; Path=${r.path}`}if(r.expires){if(typeof r.expires.toUTCString!="function")throw new TypeError("option expires is invalid");i+=`; Expires=${r.expires.toUTCString()}`}if(r.httpOnly&&(i+="; HttpOnly"),r.secure&&(i+="; Secure"),r.sameSite)switch(typeof r.sameSite=="string"?r.sameSite.toLowerCase():r.sameSite){case!0:i+="; SameSite=Strict";break;case"lax":i+="; SameSite=Lax";break;case"strict":i+="; SameSite=Strict";break;case"none":i+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return i},oJ={create(e,t,n,r){let o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};n&&(o.expires=new Date,o.expires.setTime(o.expires.getTime()+n*60*1e3)),r&&(o.domain=r),document.cookie=cPt(e,encodeURIComponent(t),o)},read(e){const t=`${e}=`,n=document.cookie.split(";");for(let r=0;r<n.length;r++){let o=n[r];for(;o.charAt(0)===" ";)o=o.substring(1,o.length);if(o.indexOf(t)===0)return o.substring(t.length,o.length)}return null},remove(e){this.create(e,"",-1)}};var uPt={name:"cookie",lookup(e){let{lookupCookie:t}=e;if(t&&typeof document<"u")return oJ.read(t)||void 0},cacheUserLanguage(e,t){let{lookupCookie:n,cookieMinutes:r,cookieDomain:o,cookieOptions:i}=t;n&&typeof document<"u"&&oJ.create(n,e,r,o,i)}},dPt={name:"querystring",lookup(e){var r;let{lookupQuerystring:t}=e,n;if(typeof window<"u"){let{search:o}=window.location;!window.location.search&&((r=window.location.hash)==null?void 0:r.indexOf("?"))>-1&&(o=window.location.hash.substring(window.location.hash.indexOf("?")));const a=o.substring(1).split("&");for(let s=0;s<a.length;s++){const l=a[s].indexOf("=");l>0&&a[s].substring(0,l)===t&&(n=a[s].substring(l+1))}}return n}};let Rb=null;const iJ=()=>{if(Rb!==null)return Rb;try{Rb=window!=="undefined"&&window.localStorage!==null;const e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{Rb=!1}return Rb};var fPt={name:"localStorage",lookup(e){let{lookupLocalStorage:t}=e;if(t&&iJ())return window.localStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupLocalStorage:n}=t;n&&iJ()&&window.localStorage.setItem(n,e)}};let Db=null;const aJ=()=>{if(Db!==null)return Db;try{Db=window!=="undefined"&&window.sessionStorage!==null;const e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{Db=!1}return Db};var pPt={name:"sessionStorage",lookup(e){let{lookupSessionStorage:t}=e;if(t&&aJ())return window.sessionStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupSessionStorage:n}=t;n&&aJ()&&window.sessionStorage.setItem(n,e)}},hPt={name:"navigator",lookup(e){const t=[];if(typeof navigator<"u"){const{languages:n,userLanguage:r,language:o}=navigator;if(n)for(let i=0;i<n.length;i++)t.push(n[i]);r&&t.push(r),o&&t.push(o)}return t.length>0?t:void 0}},mPt={name:"htmlTag",lookup(e){let{htmlTag:t}=e,n;const r=t||(typeof document<"u"?document.documentElement:null);return r&&typeof r.getAttribute=="function"&&(n=r.getAttribute("lang")),n}},gPt={name:"path",lookup(e){var o;let{lookupFromPathIndex:t}=e;if(typeof window>"u")return;const n=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(n)?(o=n[typeof t=="number"?t:0])==null?void 0:o.replace("/",""):void 0}},yPt={name:"subdomain",lookup(e){var o,i;let{lookupFromSubdomainIndex:t}=e;const n=typeof t=="number"?t+1:1,r=typeof window<"u"&&((i=(o=window.location)==null?void 0:o.hostname)==null?void 0:i.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i));if(r)return r[n]}};let yfe=!1;try{document.cookie,yfe=!0}catch{}const vfe=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];yfe||vfe.splice(1,1);const vPt=()=>({order:vfe,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:e=>e});class bfe{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(t,n)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=t,this.options=lPt(n,this.options||{},vPt()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=o=>o.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=r,this.addDetector(uPt),this.addDetector(dPt),this.addDetector(fPt),this.addDetector(pPt),this.addDetector(hPt),this.addDetector(mPt),this.addDetector(gPt),this.addDetector(yPt)}addDetector(t){return this.detectors[t.name]=t,this}detect(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,n=[];return t.forEach(r=>{if(this.detectors[r]){let o=this.detectors[r].lookup(this.options);o&&typeof o=="string"&&(o=[o]),o&&(n=n.concat(o))}}),n=n.map(r=>this.options.convertDetectedLanguage(r)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?n:n.length>0?n[0]:null}cacheUserLanguage(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;n&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(t)>-1||n.forEach(r=>{this.detectors[r]&&this.detectors[r].cacheUserLanguage(t,this.options)}))}}bfe.type="languageDetector";function aF(e){"@babel/helpers - typeof";return aF=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},aF(e)}function wfe(){return typeof XMLHttpRequest=="function"||(typeof XMLHttpRequest>"u"?"undefined":aF(XMLHttpRequest))==="object"}function bPt(e){return!!e&&typeof e.then=="function"}function wPt(e){return bPt(e)?e:Promise.resolve(e)}function sJ(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function lJ(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?sJ(Object(n),!0).forEach(function(r){xPt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sJ(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function xPt(e,t,n){return(t=SPt(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function SPt(e){var t=CPt(e,"string");return eh(t)=="symbol"?t:t+""}function CPt(e,t){if(eh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(eh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function eh(e){"@babel/helpers - typeof";return eh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},eh(e)}var cf=typeof fetch=="function"?fetch:void 0;typeof global<"u"&&global.fetch?cf=global.fetch:typeof window<"u"&&window.fetch&&(cf=window.fetch);var Kx;wfe()&&(typeof global<"u"&&global.XMLHttpRequest?Kx=global.XMLHttpRequest:typeof window<"u"&&window.XMLHttpRequest&&(Kx=window.XMLHttpRequest));var nI;typeof ActiveXObject=="function"&&(typeof global<"u"&&global.ActiveXObject?nI=global.ActiveXObject:typeof window<"u"&&window.ActiveXObject&&(nI=window.ActiveXObject));typeof cf!="function"&&(cf=void 0);if(!cf&&!Kx&&!nI)try{Kve(()=>import("./browser-ponyfill-CC9JzGyT.js").then(e=>e.b),[]).then(function(e){cf=e.default}).catch(function(){})}catch{}var sF=function(t,n){if(n&&eh(n)==="object"){var r="";for(var o in n)r+="&"+encodeURIComponent(o)+"="+encodeURIComponent(n[o]);if(!r)return t;t=t+(t.indexOf("?")!==-1?"&":"?")+r.slice(1)}return t},cJ=function(t,n,r,o){var i=function(l){if(!l.ok)return r(l.statusText||"Error",{status:l.status});l.text().then(function(c){r(null,{status:l.status,data:c})}).catch(r)};if(o){var a=o(t,n);if(a instanceof Promise){a.then(i).catch(r);return}}typeof fetch=="function"?fetch(t,n).then(i).catch(r):cf(t,n).then(i).catch(r)},uJ=!1,EPt=function(t,n,r,o){t.queryStringParams&&(n=sF(n,t.queryStringParams));var i=lJ({},typeof t.customHeaders=="function"?t.customHeaders():t.customHeaders);typeof window>"u"&&typeof global<"u"&&typeof global.process<"u"&&global.process.versions&&global.process.versions.node&&(i["User-Agent"]="i18next-http-backend (node/".concat(global.process.version,"; ").concat(global.process.platform," ").concat(global.process.arch,")")),r&&(i["Content-Type"]="application/json");var a=typeof t.requestOptions=="function"?t.requestOptions(r):t.requestOptions,s=lJ({method:r?"POST":"GET",body:r?t.stringify(r):void 0,headers:i},uJ?{}:a),l=typeof t.alternateFetch=="function"&&t.alternateFetch.length>=1?t.alternateFetch:void 0;try{cJ(n,s,o,l)}catch(c){if(!a||Object.keys(a).length===0||!c.message||c.message.indexOf("not implemented")<0)return o(c);try{Object.keys(a).forEach(function(u){delete s[u]}),cJ(n,s,o,l),uJ=!0}catch(u){o(u)}}},PPt=function(t,n,r,o){r&&eh(r)==="object"&&(r=sF("",r).slice(1)),t.queryStringParams&&(n=sF(n,t.queryStringParams));try{var i=Kx?new Kx:new nI("MSXML2.XMLHTTP.3.0");i.open(r?"POST":"GET",n,1),t.crossDomain||i.setRequestHeader("X-Requested-With","XMLHttpRequest"),i.withCredentials=!!t.withCredentials,r&&i.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),i.overrideMimeType&&i.overrideMimeType("application/json");var a=t.customHeaders;if(a=typeof a=="function"?a():a,a)for(var s in a)i.setRequestHeader(s,a[s]);i.onreadystatechange=function(){i.readyState>3&&o(i.status>=400?i.statusText:null,{status:i.status,data:i.responseText})},i.send(r)}catch(l){console&&console.log(l)}},IPt=function(t,n,r,o){if(typeof r=="function"&&(o=r,r=void 0),o=o||function(){},cf&&n.indexOf("file:")!==0)return EPt(t,n,r,o);if(wfe()||typeof ActiveXObject=="function")return PPt(t,n,r,o);o(new Error("No fetch and no xhr implementation found!"))};function cy(e){"@babel/helpers - typeof";return cy=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cy(e)}function dJ(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function $$(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?dJ(Object(n),!0).forEach(function(r){xfe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dJ(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function TPt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function OPt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Sfe(r.key),r)}}function kPt(e,t,n){return t&&OPt(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function xfe(e,t,n){return(t=Sfe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Sfe(e){var t=MPt(e,"string");return cy(t)=="symbol"?t:t+""}function MPt(e,t){if(cy(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(cy(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var APt=function(){return{loadPath:"/locales/{{lng}}/{{ns}}.json",addPath:"/locales/add/{{lng}}/{{ns}}",parse:function(n){return JSON.parse(n)},stringify:JSON.stringify,parsePayload:function(n,r,o){return xfe({},r,o||"")},parseLoadPayload:function(n,r){},request:IPt,reloadInterval:typeof window<"u"?!1:60*60*1e3,customHeaders:{},queryStringParams:{},crossDomain:!1,withCredentials:!1,overrideMimeType:!1,requestOptions:{mode:"cors",credentials:"same-origin",cache:"default"}}},Cfe=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};TPt(this,e),this.services=t,this.options=n,this.allOptions=r,this.type="backend",this.init(t,n,r)}return kPt(e,[{key:"init",value:function(n){var r=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(this.services=n,this.options=$$($$($$({},APt()),this.options||{}),o),this.allOptions=i,this.services&&this.options.reloadInterval){var a=setInterval(function(){return r.reload()},this.options.reloadInterval);cy(a)==="object"&&typeof a.unref=="function"&&a.unref()}}},{key:"readMulti",value:function(n,r,o){this._readAny(n,n,r,r,o)}},{key:"read",value:function(n,r,o){this._readAny([n],n,[r],r,o)}},{key:"_readAny",value:function(n,r,o,i,a){var s=this,l=this.options.loadPath;typeof this.options.loadPath=="function"&&(l=this.options.loadPath(n,o)),l=wPt(l),l.then(function(c){if(!c)return a(null,{});var u=s.services.interpolator.interpolate(c,{lng:n.join("+"),ns:o.join("+")});s.loadUrl(u,a,r,i)})}},{key:"loadUrl",value:function(n,r,o,i){var a=this,s=typeof o=="string"?[o]:o,l=typeof i=="string"?[i]:i,c=this.options.parseLoadPayload(s,l);this.options.request(this.options,n,c,function(u,d){if(d&&(d.status>=500&&d.status<600||!d.status))return r("failed loading "+n+"; status code: "+d.status,!0);if(d&&d.status>=400&&d.status<500)return r("failed loading "+n+"; status code: "+d.status,!1);if(!d&&u&&u.message){var f=u.message.toLowerCase(),h=["failed","fetch","network","load"].find(function(v){return f.indexOf(v)>-1});if(h)return r("failed loading "+n+": "+u.message,!0)}if(u)return r(u,!1);var g,y;try{typeof d.data=="string"?g=a.options.parse(d.data,o,i):g=d.data}catch{y="failed parsing "+n+" to json"}if(y)return r(y,!1);r(null,g)})}},{key:"create",value:function(n,r,o,i,a){var s=this;if(this.options.addPath){typeof n=="string"&&(n=[n]);var l=this.options.parsePayload(r,o,i),c=0,u=[],d=[];n.forEach(function(f){var h=s.options.addPath;typeof s.options.addPath=="function"&&(h=s.options.addPath(f,r));var g=s.services.interpolator.interpolate(h,{lng:f,ns:r});s.options.request(s.options,g,l,function(y,v){c+=1,u.push(y),d.push(v),c===n.length&&typeof a=="function"&&a(u,d)})})}}},{key:"reload",value:function(){var n=this,r=this.services,o=r.backendConnector,i=r.languageUtils,a=r.logger,s=o.language;if(!(s&&s.toLowerCase()==="cimode")){var l=[],c=function(d){var f=i.toResolveHierarchy(d);f.forEach(function(h){l.indexOf(h)<0&&l.push(h)})};c(s),this.allOptions.preload&&this.allOptions.preload.forEach(function(u){return c(u)}),l.forEach(function(u){n.allOptions.ns.forEach(function(d){o.read(u,d,"read",null,null,function(f,h){f&&a.warn("loading namespace ".concat(d," for language ").concat(u," failed"),f),!f&&h&&a.log("loaded namespace ".concat(d," for language ").concat(u),h),o.loaded("".concat(u,"|").concat(d),f,h)})})})}}}])}();Cfe.type="backend";qr.use(Cfe).use(bfe).use(HTe).init({load:"languageOnly",detection:{order:["path","navigator","htmlTag"]},fallbackLng:"en",interpolation:{escapeValue:!1},backend:{loadPath:"/static/react/locales/{{lng}}/{{ns}}.json"}});const fv=new Mve({defaultOptions:{queries:{retry:3,staleTime:1e3*60*5,refetchOnMount:!0,refetchOnWindowFocus:!0,refetchOnReconnect:"always"}}}),RPt=e=>{const t=document.getElementById(e);if(t===null)return;const n=t.attachShadow({mode:"open"}),r=document.createElement("div"),o=document.createElement("style"),i=document.getElementById("react-css");if(i){const l=document.createElement("link");l.setAttribute("rel","stylesheet"),l.setAttribute("href",i.href),n.appendChild(i)}n.appendChild(r),n.appendChild(o);const a=NJ({key:"css",prepend:!0,container:o});bh.createRoot(r).render(b(tme,{value:a,children:b(w.Suspense,{fallback:b(Ba,{}),children:b(Sz,{children:b(th,{theme:Ovt(r),children:b(gy,{client:fv,children:b(MV,{})})})})})}))},fJ=document.getElementById("root");fJ&&bh.createRoot(fJ).render(b(X.StrictMode,{children:b(w.Suspense,{fallback:b(Ba,{}),children:b(Sz,{children:b(th,{theme:xh,children:Q(gy,{client:fv,children:[b(iPt,{}),b(Yve,{})]})})})})}));const pJ=document.getElementById("react-page-no-shadow-dom");pJ&&bh.createRoot(pJ).render(b(w.Suspense,{fallback:b(Ba,{}),children:b(Sz,{children:b(th,{theme:xh,children:b(gy,{client:fv,children:b(MV,{})})})})}));RPt("react-page");const hJ=document.getElementById("react-weight-dashboard");hJ&&bh.createRoot(hJ).render(b(w.Suspense,{fallback:b(Ba,{}),children:b(th,{theme:xh,children:b(gy,{client:fv,children:b(Gle,{})})})}));const mJ=document.getElementById("react-nutrition-dashboard");mJ&&bh.createRoot(mJ).render(b(w.Suspense,{fallback:b(Ba,{}),children:b(th,{theme:xh,children:b(gy,{client:fv,children:b(Jse,{})})})}));const gJ=document.getElementById("react-routine-dashboard");gJ&&bh.createRoot(gJ).render(b(w.Suspense,{fallback:b(Ba,{}),children:b(th,{theme:xh,children:b(gy,{client:fv,children:b(Ole,{})})})}));const yJ=document.getElementById("react-ingredient-search");yJ&&bh.createRoot(yJ).render(b(w.Suspense,{fallback:b(Ba,{}),children:b(th,{theme:xh,children:b(Fst,{})})}));export{vC as c,Fn as g};