diff --git a/assets/sprite-08b3583e.css b/assets/05-modal-exercises-08b3583e.css similarity index 100% rename from assets/sprite-08b3583e.css rename to assets/05-modal-exercises-08b3583e.css diff --git a/assets/05-modal-exercises-65434497.js b/assets/05-modal-exercises-65434497.js new file mode 100644 index 0000000..79fdf21 --- /dev/null +++ b/assets/05-modal-exercises-65434497.js @@ -0,0 +1,77 @@ +(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const o of r)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&s(i)}).observe(document,{childList:!0,subtree:!0});function n(r){const o={};return r.integrity&&(o.integrity=r.integrity),r.referrerPolicy&&(o.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?o.credentials="include":r.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(r){if(r.ep)return;r.ep=!0;const o=n(r);fetch(r.href,o)}})();document.addEventListener("DOMContentLoaded",function(){const e=document.getElementById("homeButton"),t=document.getElementById("favoritesButton");e.addEventListener("click",()=>{console.log("Home button clicked"),e.classList.add("active"),t.classList.remove("active")}),t.addEventListener("click",()=>{console.log("Favorites button clicked"),t.classList.add("active"),e.classList.remove("active")})});const Qe=document.querySelector(".js-open-menu"),Ze=document.querySelector(".js-close-menu"),Ae=document.querySelector("#mobile-menu"),se=document.querySelector("[data-menu-backdrop]"),Ye=document.querySelectorAll(".menu__nav-link");function et(){Ae.classList.add("is-open"),se.classList.remove("is-hidden"),document.body.classList.add("no-scroll")}function re(){Ae.classList.remove("is-open"),se.classList.add("is-hidden"),document.body.classList.remove("no-scroll")}Qe.addEventListener("click",()=>{et()});Ze.addEventListener("click",()=>{re()});se.addEventListener("click",()=>{re()});Ye.forEach(e=>{e.addEventListener("click",()=>{const t=e.getAttribute("href").substring(1),n=document.getElementById(t);n&&(n.scrollIntoView({behavior:"smooth"}),re())})});document.addEventListener("DOMContentLoaded",()=>{const e=window.location.pathname;if(e.includes("index.html")){const t=document.getElementById("homeButton");t.classList.add("active"),t.addEventListener("click",fe)}else if(e.includes("favorites.html")){const t=document.getElementById("favoritesButton");t.classList.add("active"),t.addEventListener("click",fe)}});const fe=e=>{e.currentTarget.classList.contains("active")?e.preventDefault():alert("Button clicked!")};function Le(e,t){return function(){return e.apply(t,arguments)}}const{toString:tt}=Object.prototype,{getPrototypeOf:oe}=Object,I=(e=>t=>{const n=tt.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),R=e=>(e=e.toLowerCase(),t=>I(t)===e),q=e=>t=>typeof t===e,{isArray:N}=Array,v=q("undefined");function nt(e){return e!==null&&!v(e)&&e.constructor!==null&&!v(e.constructor)&&S(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Te=R("ArrayBuffer");function st(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Te(e.buffer),t}const rt=q("string"),S=q("function"),Ce=q("number"),H=e=>e!==null&&typeof e=="object",ot=e=>e===!0||e===!1,k=e=>{if(I(e)!=="object")return!1;const t=oe(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},it=R("Date"),at=R("File"),ct=R("Blob"),lt=R("FileList"),ut=e=>H(e)&&S(e.pipe),dt=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||S(e.append)&&((t=I(e))==="formdata"||t==="object"&&S(e.toString)&&e.toString()==="[object FormData]"))},ft=R("URLSearchParams"),pt=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function F(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let s,r;if(typeof e!="object"&&(e=[e]),N(e))for(s=0,r=e.length;s0;)if(r=n[s],t===r.toLowerCase())return r;return null}const Pe=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),ve=e=>!v(e)&&e!==Pe;function Z(){const{caseless:e}=ve(this)&&this||{},t={},n=(s,r)=>{const o=e&&Ne(t,r)||r;k(t[o])&&k(s)?t[o]=Z(t[o],s):k(s)?t[o]=Z({},s):N(s)?t[o]=s.slice():t[o]=s};for(let s=0,r=arguments.length;s(F(t,(r,o)=>{n&&S(r)?e[o]=Le(r,n):e[o]=r},{allOwnKeys:s}),e),mt=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),yt=(e,t,n,s)=>{e.prototype=Object.create(t.prototype,s),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},bt=(e,t,n,s)=>{let r,o,i;const c={};if(t=t||{},e==null)return t;do{for(r=Object.getOwnPropertyNames(e),o=r.length;o-- >0;)i=r[o],(!s||s(i,e,t))&&!c[i]&&(t[i]=e[i],c[i]=!0);e=n!==!1&&oe(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},gt=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const s=e.indexOf(t,n);return s!==-1&&s===n},Et=e=>{if(!e)return null;if(N(e))return e;let t=e.length;if(!Ce(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},wt=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&oe(Uint8Array)),St=(e,t)=>{const s=(e&&e[Symbol.iterator]).call(e);let r;for(;(r=s.next())&&!r.done;){const o=r.value;t.call(e,o[0],o[1])}},xt=(e,t)=>{let n;const s=[];for(;(n=e.exec(t))!==null;)s.push(n);return s},Rt=R("HTMLFormElement"),_t=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,s,r){return s.toUpperCase()+r}),pe=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Ot=R("RegExp"),Fe=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),s={};F(n,(r,o)=>{let i;(i=t(r,o,e))!==!1&&(s[o]=i||r)}),Object.defineProperties(e,s)},At=e=>{Fe(e,(t,n)=>{if(S(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const s=e[n];if(S(s)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Lt=(e,t)=>{const n={},s=r=>{r.forEach(o=>{n[o]=!0})};return N(e)?s(e):s(String(e).split(t)),n},Tt=()=>{},Ct=(e,t)=>(e=+e,Number.isFinite(e)?e:t),W="abcdefghijklmnopqrstuvwxyz",he="0123456789",Be={DIGIT:he,ALPHA:W,ALPHA_DIGIT:W+W.toUpperCase()+he},Nt=(e=16,t=Be.ALPHA_DIGIT)=>{let n="";const{length:s}=t;for(;e--;)n+=t[Math.random()*s|0];return n};function Pt(e){return!!(e&&S(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const vt=e=>{const t=new Array(10),n=(s,r)=>{if(H(s)){if(t.indexOf(s)>=0)return;if(!("toJSON"in s)){t[r]=s;const o=N(s)?[]:{};return F(s,(i,c)=>{const f=n(i,r+1);!v(f)&&(o[c]=f)}),t[r]=void 0,o}}return s};return n(e,0)},Ft=R("AsyncFunction"),Bt=e=>e&&(H(e)||S(e))&&S(e.then)&&S(e.catch),a={isArray:N,isArrayBuffer:Te,isBuffer:nt,isFormData:dt,isArrayBufferView:st,isString:rt,isNumber:Ce,isBoolean:ot,isObject:H,isPlainObject:k,isUndefined:v,isDate:it,isFile:at,isBlob:ct,isRegExp:Ot,isFunction:S,isStream:ut,isURLSearchParams:ft,isTypedArray:wt,isFileList:lt,forEach:F,merge:Z,extend:ht,trim:pt,stripBOM:mt,inherits:yt,toFlatObject:bt,kindOf:I,kindOfTest:R,endsWith:gt,toArray:Et,forEachEntry:St,matchAll:xt,isHTMLForm:Rt,hasOwnProperty:pe,hasOwnProp:pe,reduceDescriptors:Fe,freezeMethods:At,toObjectSet:Lt,toCamelCase:_t,noop:Tt,toFiniteNumber:Ct,findKey:Ne,global:Pe,isContextDefined:ve,ALPHABET:Be,generateString:Nt,isSpecCompliantForm:Pt,toJSONObject:vt,isAsyncFn:Ft,isThenable:Bt};function m(e,t,n,s,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),s&&(this.request=s),r&&(this.response=r)}a.inherits(m,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:a.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const ke=m.prototype,$e={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{$e[e]={value:e}});Object.defineProperties(m,$e);Object.defineProperty(ke,"isAxiosError",{value:!0});m.from=(e,t,n,s,r,o)=>{const i=Object.create(ke);return a.toFlatObject(e,i,function(f){return f!==Error.prototype},c=>c!=="isAxiosError"),m.call(i,e.message,t,n,s,r),i.cause=e,i.name=e.name,o&&Object.assign(i,o),i};const kt=null;function Y(e){return a.isPlainObject(e)||a.isArray(e)}function De(e){return a.endsWith(e,"[]")?e.slice(0,-2):e}function me(e,t,n){return e?e.concat(t).map(function(r,o){return r=De(r),!n&&o?"["+r+"]":r}).join(n?".":""):t}function $t(e){return a.isArray(e)&&!e.some(Y)}const Dt=a.toFlatObject(a,{},null,function(t){return/^is[A-Z]/.test(t)});function z(e,t,n){if(!a.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=a.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(h,E){return!a.isUndefined(E[h])});const s=n.metaTokens,r=n.visitor||u,o=n.dots,i=n.indexes,f=(n.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(t);if(!a.isFunction(r))throw new TypeError("visitor must be a function");function p(d){if(d===null)return"";if(a.isDate(d))return d.toISOString();if(!f&&a.isBlob(d))throw new m("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(d)||a.isTypedArray(d)?f&&typeof Blob=="function"?new Blob([d]):Buffer.from(d):d}function u(d,h,E){let w=d;if(d&&!E&&typeof d=="object"){if(a.endsWith(h,"{}"))h=s?h:h.slice(0,-2),d=JSON.stringify(d);else if(a.isArray(d)&&$t(d)||(a.isFileList(d)||a.endsWith(h,"[]"))&&(w=a.toArray(d)))return h=De(h),w.forEach(function(A,Xe){!(a.isUndefined(A)||A===null)&&t.append(i===!0?me([h],Xe,o):i===null?h:h+"[]",p(A))}),!1}return Y(d)?!0:(t.append(me(E,h,o),p(d)),!1)}const l=[],y=Object.assign(Dt,{defaultVisitor:u,convertValue:p,isVisitable:Y});function g(d,h){if(!a.isUndefined(d)){if(l.indexOf(d)!==-1)throw Error("Circular reference detected in "+h.join("."));l.push(d),a.forEach(d,function(w,O){(!(a.isUndefined(w)||w===null)&&r.call(t,w,a.isString(O)?O.trim():O,h,y))===!0&&g(w,h?h.concat(O):[O])}),l.pop()}}if(!a.isObject(e))throw new TypeError("data must be an object");return g(e),t}function ye(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(s){return t[s]})}function ie(e,t){this._pairs=[],e&&z(e,this,t)}const Ue=ie.prototype;Ue.append=function(t,n){this._pairs.push([t,n])};Ue.toString=function(t){const n=t?function(s){return t.call(this,s,ye)}:ye;return this._pairs.map(function(r){return n(r[0])+"="+n(r[1])},"").join("&")};function Ut(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function je(e,t,n){if(!t)return e;const s=n&&n.encode||Ut,r=n&&n.serialize;let o;if(r?o=r(t,n):o=a.isURLSearchParams(t)?t.toString():new ie(t,n).toString(s),o){const i=e.indexOf("#");i!==-1&&(e=e.slice(0,i)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class jt{constructor(){this.handlers=[]}use(t,n,s){return this.handlers.push({fulfilled:t,rejected:n,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){a.forEach(this.handlers,function(s){s!==null&&t(s)})}}const be=jt,Me={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Mt=typeof URLSearchParams<"u"?URLSearchParams:ie,It=typeof FormData<"u"?FormData:null,qt=typeof Blob<"u"?Blob:null,Ht={isBrowser:!0,classes:{URLSearchParams:Mt,FormData:It,Blob:qt},protocols:["http","https","file","blob","url","data"]},Ie=typeof window<"u"&&typeof document<"u",zt=(e=>Ie&&["ReactNative","NativeScript","NS"].indexOf(e)<0)(typeof navigator<"u"&&navigator.product),Jt=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),Vt=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Ie,hasStandardBrowserEnv:zt,hasStandardBrowserWebWorkerEnv:Jt},Symbol.toStringTag,{value:"Module"})),x={...Vt,...Ht};function Wt(e,t){return z(e,new x.classes.URLSearchParams,Object.assign({visitor:function(n,s,r,o){return x.isNode&&a.isBuffer(n)?(this.append(s,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)}},t))}function Kt(e){return a.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Gt(e){const t={},n=Object.keys(e);let s;const r=n.length;let o;for(s=0;s=n.length;return i=!i&&a.isArray(r)?r.length:i,f?(a.hasOwnProp(r,i)?r[i]=[r[i],s]:r[i]=s,!c):((!r[i]||!a.isObject(r[i]))&&(r[i]=[]),t(n,s,r[i],o)&&a.isArray(r[i])&&(r[i]=Gt(r[i])),!c)}if(a.isFormData(e)&&a.isFunction(e.entries)){const n={};return a.forEachEntry(e,(s,r)=>{t(Kt(s),r,n,0)}),n}return null}function Xt(e,t,n){if(a.isString(e))try{return(t||JSON.parse)(e),a.trim(e)}catch(s){if(s.name!=="SyntaxError")throw s}return(n||JSON.stringify)(e)}const ae={transitional:Me,adapter:["xhr","http"],transformRequest:[function(t,n){const s=n.getContentType()||"",r=s.indexOf("application/json")>-1,o=a.isObject(t);if(o&&a.isHTMLForm(t)&&(t=new FormData(t)),a.isFormData(t))return r&&r?JSON.stringify(qe(t)):t;if(a.isArrayBuffer(t)||a.isBuffer(t)||a.isStream(t)||a.isFile(t)||a.isBlob(t))return t;if(a.isArrayBufferView(t))return t.buffer;if(a.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(o){if(s.indexOf("application/x-www-form-urlencoded")>-1)return Wt(t,this.formSerializer).toString();if((c=a.isFileList(t))||s.indexOf("multipart/form-data")>-1){const f=this.env&&this.env.FormData;return z(c?{"files[]":t}:t,f&&new f,this.formSerializer)}}return o||r?(n.setContentType("application/json",!1),Xt(t)):t}],transformResponse:[function(t){const n=this.transitional||ae.transitional,s=n&&n.forcedJSONParsing,r=this.responseType==="json";if(t&&a.isString(t)&&(s&&!this.responseType||r)){const i=!(n&&n.silentJSONParsing)&&r;try{return JSON.parse(t)}catch(c){if(i)throw c.name==="SyntaxError"?m.from(c,m.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:x.classes.FormData,Blob:x.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],e=>{ae.headers[e]={}});const ce=ae,Qt=a.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Zt=e=>{const t={};let n,s,r;return e&&e.split(` +`).forEach(function(i){r=i.indexOf(":"),n=i.substring(0,r).trim().toLowerCase(),s=i.substring(r+1).trim(),!(!n||t[n]&&Qt[n])&&(n==="set-cookie"?t[n]?t[n].push(s):t[n]=[s]:t[n]=t[n]?t[n]+", "+s:s)}),t},ge=Symbol("internals");function P(e){return e&&String(e).trim().toLowerCase()}function $(e){return e===!1||e==null?e:a.isArray(e)?e.map($):String(e)}function Yt(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=n.exec(e);)t[s[1]]=s[2];return t}const en=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function K(e,t,n,s,r){if(a.isFunction(s))return s.call(this,t,n);if(r&&(t=n),!!a.isString(t)){if(a.isString(s))return t.indexOf(s)!==-1;if(a.isRegExp(s))return s.test(t)}}function tn(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,s)=>n.toUpperCase()+s)}function nn(e,t){const n=a.toCamelCase(" "+t);["get","set","has"].forEach(s=>{Object.defineProperty(e,s+n,{value:function(r,o,i){return this[s].call(this,t,r,o,i)},configurable:!0})})}class J{constructor(t){t&&this.set(t)}set(t,n,s){const r=this;function o(c,f,p){const u=P(f);if(!u)throw new Error("header name must be a non-empty string");const l=a.findKey(r,u);(!l||r[l]===void 0||p===!0||p===void 0&&r[l]!==!1)&&(r[l||f]=$(c))}const i=(c,f)=>a.forEach(c,(p,u)=>o(p,u,f));return a.isPlainObject(t)||t instanceof this.constructor?i(t,n):a.isString(t)&&(t=t.trim())&&!en(t)?i(Zt(t),n):t!=null&&o(n,t,s),this}get(t,n){if(t=P(t),t){const s=a.findKey(this,t);if(s){const r=this[s];if(!n)return r;if(n===!0)return Yt(r);if(a.isFunction(n))return n.call(this,r,s);if(a.isRegExp(n))return n.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=P(t),t){const s=a.findKey(this,t);return!!(s&&this[s]!==void 0&&(!n||K(this,this[s],s,n)))}return!1}delete(t,n){const s=this;let r=!1;function o(i){if(i=P(i),i){const c=a.findKey(s,i);c&&(!n||K(s,s[c],c,n))&&(delete s[c],r=!0)}}return a.isArray(t)?t.forEach(o):o(t),r}clear(t){const n=Object.keys(this);let s=n.length,r=!1;for(;s--;){const o=n[s];(!t||K(this,this[o],o,t,!0))&&(delete this[o],r=!0)}return r}normalize(t){const n=this,s={};return a.forEach(this,(r,o)=>{const i=a.findKey(s,o);if(i){n[i]=$(r),delete n[o];return}const c=t?tn(o):String(o).trim();c!==o&&delete n[o],n[c]=$(r),s[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return a.forEach(this,(s,r)=>{s!=null&&s!==!1&&(n[r]=t&&a.isArray(s)?s.join(", "):s)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` +`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const s=new this(t);return n.forEach(r=>s.set(r)),s}static accessor(t){const s=(this[ge]=this[ge]={accessors:{}}).accessors,r=this.prototype;function o(i){const c=P(i);s[c]||(nn(r,i),s[c]=!0)}return a.isArray(t)?t.forEach(o):o(t),this}}J.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);a.reduceDescriptors(J.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(s){this[n]=s}}});a.freezeMethods(J);const _=J;function G(e,t){const n=this||ce,s=t||n,r=_.from(s.headers);let o=s.data;return a.forEach(e,function(c){o=c.call(n,o,r.normalize(),t?t.status:void 0)}),r.normalize(),o}function He(e){return!!(e&&e.__CANCEL__)}function B(e,t,n){m.call(this,e??"canceled",m.ERR_CANCELED,t,n),this.name="CanceledError"}a.inherits(B,m,{__CANCEL__:!0});function sn(e,t,n){const s=n.config.validateStatus;!n.status||!s||s(n.status)?e(n):t(new m("Request failed with status code "+n.status,[m.ERR_BAD_REQUEST,m.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}const rn=x.hasStandardBrowserEnv?{write(e,t,n,s,r,o){const i=[e+"="+encodeURIComponent(t)];a.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),a.isString(s)&&i.push("path="+s),a.isString(r)&&i.push("domain="+r),o===!0&&i.push("secure"),document.cookie=i.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function on(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function an(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}function ze(e,t){return e&&!on(t)?an(e,t):t}const cn=x.hasStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");let s;function r(o){let i=o;return t&&(n.setAttribute("href",i),i=n.href),n.setAttribute("href",i),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return s=r(window.location.href),function(i){const c=a.isString(i)?r(i):i;return c.protocol===s.protocol&&c.host===s.host}}():function(){return function(){return!0}}();function ln(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function un(e,t){e=e||10;const n=new Array(e),s=new Array(e);let r=0,o=0,i;return t=t!==void 0?t:1e3,function(f){const p=Date.now(),u=s[o];i||(i=p),n[r]=f,s[r]=p;let l=o,y=0;for(;l!==r;)y+=n[l++],l=l%e;if(r=(r+1)%e,r===o&&(o=(o+1)%e),p-i{const o=r.loaded,i=r.lengthComputable?r.total:void 0,c=o-n,f=s(c),p=o<=i;n=o;const u={loaded:o,total:i,progress:i?o/i:void 0,bytes:c,rate:f||void 0,estimated:f&&i&&p?(i-o)/f:void 0,event:r};u[t?"download":"upload"]=!0,e(u)}}const dn=typeof XMLHttpRequest<"u",fn=dn&&function(e){return new Promise(function(n,s){let r=e.data;const o=_.from(e.headers).normalize();let{responseType:i,withXSRFToken:c}=e,f;function p(){e.cancelToken&&e.cancelToken.unsubscribe(f),e.signal&&e.signal.removeEventListener("abort",f)}let u;if(a.isFormData(r)){if(x.hasStandardBrowserEnv||x.hasStandardBrowserWebWorkerEnv)o.setContentType(!1);else if((u=o.getContentType())!==!1){const[h,...E]=u?u.split(";").map(w=>w.trim()).filter(Boolean):[];o.setContentType([h||"multipart/form-data",...E].join("; "))}}let l=new XMLHttpRequest;if(e.auth){const h=e.auth.username||"",E=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.set("Authorization","Basic "+btoa(h+":"+E))}const y=ze(e.baseURL,e.url);l.open(e.method.toUpperCase(),je(y,e.params,e.paramsSerializer),!0),l.timeout=e.timeout;function g(){if(!l)return;const h=_.from("getAllResponseHeaders"in l&&l.getAllResponseHeaders()),w={data:!i||i==="text"||i==="json"?l.responseText:l.response,status:l.status,statusText:l.statusText,headers:h,config:e,request:l};sn(function(A){n(A),p()},function(A){s(A),p()},w),l=null}if("onloadend"in l?l.onloadend=g:l.onreadystatechange=function(){!l||l.readyState!==4||l.status===0&&!(l.responseURL&&l.responseURL.indexOf("file:")===0)||setTimeout(g)},l.onabort=function(){l&&(s(new m("Request aborted",m.ECONNABORTED,e,l)),l=null)},l.onerror=function(){s(new m("Network Error",m.ERR_NETWORK,e,l)),l=null},l.ontimeout=function(){let E=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const w=e.transitional||Me;e.timeoutErrorMessage&&(E=e.timeoutErrorMessage),s(new m(E,w.clarifyTimeoutError?m.ETIMEDOUT:m.ECONNABORTED,e,l)),l=null},x.hasStandardBrowserEnv&&(c&&a.isFunction(c)&&(c=c(e)),c||c!==!1&&cn(y))){const h=e.xsrfHeaderName&&e.xsrfCookieName&&rn.read(e.xsrfCookieName);h&&o.set(e.xsrfHeaderName,h)}r===void 0&&o.setContentType(null),"setRequestHeader"in l&&a.forEach(o.toJSON(),function(E,w){l.setRequestHeader(w,E)}),a.isUndefined(e.withCredentials)||(l.withCredentials=!!e.withCredentials),i&&i!=="json"&&(l.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&l.addEventListener("progress",Ee(e.onDownloadProgress,!0)),typeof e.onUploadProgress=="function"&&l.upload&&l.upload.addEventListener("progress",Ee(e.onUploadProgress)),(e.cancelToken||e.signal)&&(f=h=>{l&&(s(!h||h.type?new B(null,e,l):h),l.abort(),l=null)},e.cancelToken&&e.cancelToken.subscribe(f),e.signal&&(e.signal.aborted?f():e.signal.addEventListener("abort",f)));const d=ln(y);if(d&&x.protocols.indexOf(d)===-1){s(new m("Unsupported protocol "+d+":",m.ERR_BAD_REQUEST,e));return}l.send(r||null)})},ee={http:kt,xhr:fn};a.forEach(ee,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const we=e=>`- ${e}`,pn=e=>a.isFunction(e)||e===null||e===!1,Je={getAdapter:e=>{e=a.isArray(e)?e:[e];const{length:t}=e;let n,s;const r={};for(let o=0;o`adapter ${c} `+(f===!1?"is not supported by the environment":"is not available in the build"));let i=t?o.length>1?`since : +`+o.map(we).join(` +`):" "+we(o[0]):"as no adapter specified";throw new m("There is no suitable adapter to dispatch the request "+i,"ERR_NOT_SUPPORT")}return s},adapters:ee};function X(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new B(null,e)}function Se(e){return X(e),e.headers=_.from(e.headers),e.data=G.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Je.getAdapter(e.adapter||ce.adapter)(e).then(function(s){return X(e),s.data=G.call(e,e.transformResponse,s),s.headers=_.from(s.headers),s},function(s){return He(s)||(X(e),s&&s.response&&(s.response.data=G.call(e,e.transformResponse,s.response),s.response.headers=_.from(s.response.headers))),Promise.reject(s)})}const xe=e=>e instanceof _?e.toJSON():e;function C(e,t){t=t||{};const n={};function s(p,u,l){return a.isPlainObject(p)&&a.isPlainObject(u)?a.merge.call({caseless:l},p,u):a.isPlainObject(u)?a.merge({},u):a.isArray(u)?u.slice():u}function r(p,u,l){if(a.isUndefined(u)){if(!a.isUndefined(p))return s(void 0,p,l)}else return s(p,u,l)}function o(p,u){if(!a.isUndefined(u))return s(void 0,u)}function i(p,u){if(a.isUndefined(u)){if(!a.isUndefined(p))return s(void 0,p)}else return s(void 0,u)}function c(p,u,l){if(l in t)return s(p,u);if(l in e)return s(void 0,p)}const f={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:c,headers:(p,u)=>r(xe(p),xe(u),!0)};return a.forEach(Object.keys(Object.assign({},e,t)),function(u){const l=f[u]||r,y=l(e[u],t[u],u);a.isUndefined(y)&&l!==c||(n[u]=y)}),n}const Ve="1.6.2",le={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{le[e]=function(s){return typeof s===e||"a"+(t<1?"n ":" ")+e}});const Re={};le.transitional=function(t,n,s){function r(o,i){return"[Axios v"+Ve+"] Transitional option '"+o+"'"+i+(s?". "+s:"")}return(o,i,c)=>{if(t===!1)throw new m(r(i," has been removed"+(n?" in "+n:"")),m.ERR_DEPRECATED);return n&&!Re[i]&&(Re[i]=!0,console.warn(r(i," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(o,i,c):!0}};function hn(e,t,n){if(typeof e!="object")throw new m("options must be an object",m.ERR_BAD_OPTION_VALUE);const s=Object.keys(e);let r=s.length;for(;r-- >0;){const o=s[r],i=t[o];if(i){const c=e[o],f=c===void 0||i(c,o,e);if(f!==!0)throw new m("option "+o+" must be "+f,m.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new m("Unknown option "+o,m.ERR_BAD_OPTION)}}const te={assertOptions:hn,validators:le},L=te.validators;class U{constructor(t){this.defaults=t,this.interceptors={request:new be,response:new be}}request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=C(this.defaults,n);const{transitional:s,paramsSerializer:r,headers:o}=n;s!==void 0&&te.assertOptions(s,{silentJSONParsing:L.transitional(L.boolean),forcedJSONParsing:L.transitional(L.boolean),clarifyTimeoutError:L.transitional(L.boolean)},!1),r!=null&&(a.isFunction(r)?n.paramsSerializer={serialize:r}:te.assertOptions(r,{encode:L.function,serialize:L.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=o&&a.merge(o.common,o[n.method]);o&&a.forEach(["delete","get","head","post","put","patch","common"],d=>{delete o[d]}),n.headers=_.concat(i,o);const c=[];let f=!0;this.interceptors.request.forEach(function(h){typeof h.runWhen=="function"&&h.runWhen(n)===!1||(f=f&&h.synchronous,c.unshift(h.fulfilled,h.rejected))});const p=[];this.interceptors.response.forEach(function(h){p.push(h.fulfilled,h.rejected)});let u,l=0,y;if(!f){const d=[Se.bind(this),void 0];for(d.unshift.apply(d,c),d.push.apply(d,p),y=d.length,u=Promise.resolve(n);l{if(!s._listeners)return;let o=s._listeners.length;for(;o-- >0;)s._listeners[o](r);s._listeners=null}),this.promise.then=r=>{let o;const i=new Promise(c=>{s.subscribe(c),o=c}).then(r);return i.cancel=function(){s.unsubscribe(o)},i},t(function(o,i,c){s.reason||(s.reason=new B(o,i,c),n(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}static source(){let t;return{token:new ue(function(r){t=r}),cancel:t}}}const mn=ue;function yn(e){return function(n){return e.apply(null,n)}}function bn(e){return a.isObject(e)&&e.isAxiosError===!0}const ne={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(ne).forEach(([e,t])=>{ne[t]=e});const gn=ne;function We(e){const t=new D(e),n=Le(D.prototype.request,t);return a.extend(n,D.prototype,t,{allOwnKeys:!0}),a.extend(n,t,null,{allOwnKeys:!0}),n.create=function(r){return We(C(e,r))},n}const b=We(ce);b.Axios=D;b.CanceledError=B;b.CancelToken=mn;b.isCancel=He;b.VERSION=Ve;b.toFormData=z;b.AxiosError=m;b.Cancel=b.CanceledError;b.all=function(t){return Promise.all(t)};b.spread=yn;b.isAxiosError=bn;b.mergeConfig=C;b.AxiosHeaders=_;b.formToJSON=e=>qe(a.isHTMLForm(e)?new FormData(e):e);b.getAdapter=Je.getAdapter;b.HttpStatusCode=gn;b.default=b;const T=b;class Ke{constructor(){this.baseURL="https://your-energy.b.goit.study/api/",this.page=0}resetPage(){this.page=0}async getExercises(t,n){try{return this.page+=1,console.log(`${this.baseURL}exercises?${t}=${n}&page=1&limit=10`),(await T.get(`${this.baseURL}exercises?${t}=${n}&page=1&limit=10`)).data.results}catch(s){console.log(s)}}async getSearch(t,n,s){try{return this.page+=1,(await T.get(`${this.baseURL}exercises?${t}=${n}&keyword=${s}&page=1&limit=10`)).data.results}catch(r){console.log(r)}}async getExercisesById(t){try{return this.page+=1,(await T.get(`${this.baseURL}exercises/${t}`)).data}catch(n){console.log(n)}}async getFilter(t){try{return(await T.get(`${this.baseURL}filters?filter=${t}`)).data.results}catch(n){console.log(n)}}async getQuote(){try{return this.page+=1,(await T.get(`${this.baseURL}quote`)).data}catch(t){console.log(t)}}async patchRating(t,n){try{return this.page+=1,(await T.patch(`${this.baseURL}exercises/${t}/rating`,n)).data}catch(s){console.log(s)}}async postSubscriptions(t){try{return this.page+=1,(await T.post(`${this.baseURL}subscription`,t)).data}catch(n){console.log(n)}}}const En=new Ke,wn=document.querySelector(".modal-exercises");wn.addEventListener("click",Sn);let _e=[];async function Sn(e){if(e.target.closest(".modal-exercises__btn-favorites"))try{const t=e.target.closest(".modal-exercises__btn-favorites").getAttribute("data-id"),n=await En.getExercisesById(t),s=JSON.parse(localStorage.getItem("exerciseData"));if(s!=null&&s.some(r=>r._id===n._id))return;_e.push(n),localStorage.setItem("exerciseData",JSON.stringify(_e))}catch(t){console.log(t)}}const j="/your-energy/assets/sprite-d1b8f2c8.svg",Oe="/your-energy/assets/modal-exercise-image-3ecfcf3d.jpg",xn="/your-energy/assets/modal-exercise-image@2x-88eeae48.jpg",Rn=new Ke;let Q=!1;const V=document.querySelector(".modal-exercises"),M=document.querySelector(".overlay"),_n=document.querySelector(".js-list");_n.addEventListener("click",On);async function On(e){if(e.target.closest(".card__btn"))try{const t=e.target.closest(".card__btn").getAttribute("data-id"),n=await Rn.getExercisesById(t),s=Cn(n);Ln(s),An(),document.querySelector(".modal-exercises__btn-favorites").addEventListener("click",Ge),document.querySelector(".modal-exercises__btn-close").addEventListener("click",de)}catch(t){console.log(t)}}function An(){const e=window.innerWidth-document.body.offsetWidth+"px";V.classList.remove("hidden"),M.classList.remove("hidden"),document.body.style.paddingRight=e,document.body.style.overflow="hidden"}function Ln(e){V.innerHTML=e}function Tn(e){const t="#EEA10C",n="#F4F4F4";let r="";for(let c=0;c<5;c++){const f=`starGradient${c}`,p=c+1<=e?100:c + ${u.map(g=>``).join("")} + + `,y=`url(#${f})`;r+=`${l}`}return`${Number.isInteger(e)?`${e}.0`:e.toFixed(1)} ${r}`}function Cn({_id:e,bodyPart:t,equipment:n,gifUrl:s,name:r,target:o,description:i,rating:c,burnedCalories:f,time:p,popularity:u}){const l=y(s);function y(d){return d===null||!d?`srcset = '${Oe} 1x,${xn} 2x' + src = '${Oe}'`:`src="${d}"`}const g=Tn(c);return` + +`}function Ge(){Q=!Q;const e=document.querySelector(".modal-exercises__btn-favorites");document.querySelector(".btn-favorites__icon"),Q?e.innerHTML=Pn():e.innerHTML=Nn(),document.querySelector(".btn-favorites__icon").addEventListener("click",Ge)}function Nn(){return` + Add to favorites + + + `}function Pn(){return` + Remove from favorites + + + `}function de(){V.classList.add("hidden"),M.classList.add("hidden"),document.body.style.paddingRight="0px",document.body.style.overflow="auto"}M.addEventListener("click",function(e){e.target===M&&de()});window.addEventListener("keydown",function(e){e.key==="Escape"&&!V.classList.contains("hidden")&&de()});export{Ke as A,T as a,j as i}; diff --git a/assets/favorites-3ce64fd3.js b/assets/favorites-9a7feb98.js similarity index 50% rename from assets/favorites-3ce64fd3.js rename to assets/favorites-9a7feb98.js index 9772d59..635db17 100644 --- a/assets/favorites-3ce64fd3.js +++ b/assets/favorites-9a7feb98.js @@ -1,65 +1,71 @@ -import{i}from"./sprite-70ed1671.js";const d=document.querySelector(".favorites__list"),v=document.getElementById("favoritesButton");v.addEventListener("click",l());function l(){const t=JSON.parse(localStorage.getItem("exerciseData"));if(t!==null){d.innerHTML="";const e=t.map(({_id:a,name:s,burnedCalories:r,bodyPart:c,target:n})=>` +import{i as s}from"./05-modal-exercises-65434497.js";const d=document.querySelector(".favorites__list"),l=document.getElementById("favoritesButton");l.addEventListener("click",v());function v(){const t=JSON.parse(localStorage.getItem("exerciseData"));if(t.length!==0){d.innerHTML="";const a=t.map(({_id:e,name:r,burnedCalories:c,bodyPart:i,target:o})=>`
  • Workout

    -
    -
    - + -

    ${s}

    +

    ${r}

    -

    Burned calories:${r}

    -

    Body part:${c}

    -

    Target:${n}

    +

    Burned calories:${c}

    +

    Body part:${i}

    +

    Target:${o}

    -
  • `).join("");d.insertAdjacentHTML("beforeend",e)}}const o=document.querySelector(".favorites__list");o.addEventListener("click",_);function _(t){if(!t.target.closest(".js-remove-btn"))return;const e=t.target.closest(".js-remove-btn").getAttribute("data-id"),s=JSON.parse(localStorage.getItem("exerciseData")).filter(r=>r._id!==e);localStorage.setItem("exerciseData",JSON.stringify(s)),f(s)}function f(t){if(t.length!==0){o.innerHTML="";const e=t.map(({_id:a,name:s,burnedCalories:r,bodyPart:c,target:n})=>` + `).join("");d.insertAdjacentHTML("beforeend",a)}}const n=document.querySelector(".favorites__list");n.addEventListener("click",_);function _(t){if(!t.target.closest(".js-remove-btn"))return;const a=t.target.closest(".js-remove-btn").getAttribute("data-id"),r=JSON.parse(localStorage.getItem("exerciseData")).filter(c=>c._id!==a);localStorage.setItem("exerciseData",JSON.stringify(r)),f()}function f(){const t=JSON.parse(localStorage.getItem("exerciseData"));if(t.length===0){n.innerHTML="";const a=` +
  • + It appears that you haven't added any exercises to your favorites + yet. To get started, you can add exercises that you like to your + favorites for easier access in the future. +
  • + `;n.insertAdjacentHTML("beforeend",a)}else{n.innerHTML="";const a=t.map(({_id:e,name:r,burnedCalories:c,bodyPart:i,target:o})=>`
  • Workout

    -
    -
    - + -

    ${s}

    +

    ${r}

    -

    Burned calories:${r}

    -

    Body part:${c}

    -

    Target:${n}

    +

    Burned calories:${c}

    +

    Body part:${i}

    +

    Target:${o}

    -
  • `).join("");o.insertAdjacentHTML("beforeend",e)}} + `).join("");n.insertAdjacentHTML("beforeend",a)}} diff --git a/assets/index-6630d0a7.js b/assets/index-6630d0a7.js new file mode 100644 index 0000000..e3a8da0 --- /dev/null +++ b/assets/index-6630d0a7.js @@ -0,0 +1,42 @@ +import{A as D,a as se,i as N}from"./05-modal-exercises-65434497.js";const oe=document.querySelector(".js-quote"),re=new D;ae();async function ae(){try{const r=await re.getQuote();le(r)}catch(r){console.log(r)}}function le({author:r,quote:d}){oe.innerHTML=` +

    ${d}

    +

    ${r}

    + `}const ce=new D,G=document.querySelector(".js-list");U("Muscles");async function U(r){try{const d=await ce.getFilter(r);de(d)}catch(d){console.log(d)}}function de(r){const d=r.map(({filter:p,name:f,imgURL:n})=>` +
  • + +
    +

    ${p}

    +

    ${f}

    +
    +
  • + `).join("");G.insertAdjacentHTML("beforeend",d)}document.querySelectorAll(".btnFilters").forEach(r=>{r.addEventListener("click",()=>{const d=r.innerText;G.innerHTML="",U(d)})});document.addEventListener("DOMContentLoaded",function(){const r=document.querySelectorAll(".rating-label"),d=document.querySelector(".rating-value"),p=document.querySelector(".rating-form");let f=0;r.forEach(g=>{g.addEventListener("click",()=>{f=g.dataset.rating,n(f)})});function n(g){d.textContent=g;for(let y=0;yd?R.classList.add("scroll__go-top--show"):R.classList.remove("scroll__go-top--show")}function Y(){window.pageYOffset>0&&(window.scrollBy(0,-75),setTimeout(Y,0))}var x=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ge(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var K={exports:{}};(function(r,d){(function(p,f){r.exports=f(p)})(typeof x<"u"?x:window||x.window||x.global,function(p){var f={},n="iziToast";document.querySelector("body");var g=!!/Mobi/.test(navigator.userAgent),y=/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor),E=typeof InstallTrigger<"u",w="ontouchstart"in document.documentElement,j=["bottomRight","bottomLeft","bottomCenter","topRight","topLeft","topCenter","center"],$={info:{color:"blue",icon:"ico-info"},success:{color:"green",icon:"ico-success"},warning:{color:"orange",icon:"ico-warning"},error:{color:"red",icon:"ico-error"},question:{color:"yellow",icon:"ico-question"}},C=568,I={};f.children={};var B={id:null,class:"",title:"",titleColor:"",titleSize:"",titleLineHeight:"",message:"",messageColor:"",messageSize:"",messageLineHeight:"",backgroundColor:"",theme:"light",color:"",icon:"",iconText:"",iconColor:"",iconUrl:null,image:"",imageWidth:50,maxWidth:null,zindex:null,layout:1,balloon:!1,close:!0,closeOnEscape:!1,closeOnClick:!1,displayMode:0,position:"bottomRight",target:"",targetFirst:!0,timeout:5e3,rtl:!1,animateInside:!0,drag:!0,pauseOnHover:!0,resetOnHover:!1,progressBar:!0,progressBarColor:"",progressBarEasing:"linear",overlay:!1,overlayClose:!1,overlayColor:"rgba(0, 0, 0, 0.6)",transitionIn:"fadeInUp",transitionOut:"fadeOut",transitionInMobile:"fadeInUp",transitionOutMobile:"fadeOutDown",buttons:{},inputs:{},onOpening:function(){},onOpened:function(){},onClosing:function(){},onClosed:function(){}};if("remove"in Element.prototype||(Element.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)}),typeof window.CustomEvent!="function"){var W=function(o,i){i=i||{bubbles:!1,cancelable:!1,detail:void 0};var e=document.createEvent("CustomEvent");return e.initCustomEvent(o,i.bubbles,i.cancelable,i.detail),e};W.prototype=window.Event.prototype,window.CustomEvent=W}var v=function(o,i,e){if(Object.prototype.toString.call(o)==="[object Object]")for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&i.call(e,o[t],t,o);else if(o)for(var a=0,c=o.length;a0?(a=(s-t)/s,a"u"&&(i.classList.remove(n+"-reseted"),s!==null&&(s.style.transition="width "+c.timeout+"ms "+c.progressBarEasing,s.style.width="0%"),c.time.START=new Date().getTime(),c.time.END=c.time.START+c.timeout,c.time.TIMER=setTimeout(function(){clearTimeout(c.time.TIMER),i.classList.contains(n+"-closing")||(t.hide(c,i,"timeout"),typeof e=="function"&&e.apply(t))},c.timeout),t.setSetting(a,"time",c.time))},pause:function(){if(typeof c.time.START<"u"&&!i.classList.contains(n+"-paused")&&!i.classList.contains(n+"-reseted")){if(i.classList.add(n+"-paused"),c.time.REMAINING=c.time.END-new Date().getTime(),clearTimeout(c.time.TIMER),t.setSetting(a,"time",c.time),s!==null){var l=window.getComputedStyle(s),u=l.getPropertyValue("width");s.style.transition="none",s.style.width=u}typeof e=="function"&&setTimeout(function(){e.apply(t)},10)}},resume:function(){typeof c.time.REMAINING<"u"?(i.classList.remove(n+"-paused"),s!==null&&(s.style.transition="width "+c.time.REMAINING+"ms "+c.progressBarEasing,s.style.width="0%"),c.time.END=new Date().getTime()+c.time.REMAINING,c.time.TIMER=setTimeout(function(){clearTimeout(c.time.TIMER),i.classList.contains(n+"-closing")||(t.hide(c,i,"timeout"),typeof e=="function"&&e.apply(t))},c.time.REMAINING),t.setSetting(a,"time",c.time)):this.start()},reset:function(){clearTimeout(c.time.TIMER),delete c.time.REMAINING,t.setSetting(a,"time",c.time),i.classList.add(n+"-reseted"),i.classList.remove(n+"-paused"),s!==null&&(s.style.transition="none",s.style.width="100%"),typeof e=="function"&&setTimeout(function(){e.apply(t)},10)}}},f.hide=function(o,i,e){typeof i!="object"&&(i=document.querySelector(i));var t=this,a=h(this.children[i.getAttribute("data-iziToast-ref")],o||{});a.closedBy=e||null,delete a.time.REMAINING,i.classList.add(n+"-closing"),function(){var l=document.querySelector("."+n+"-overlay");if(l!==null){var u=l.getAttribute("data-iziToast-ref");u=u.split(",");var m=u.indexOf(String(a.ref));m!==-1&&u.splice(m,1),l.setAttribute("data-iziToast-ref",u.join()),u.length===0&&(l.classList.remove("fadeIn"),l.classList.add("fadeOut"),setTimeout(function(){l.remove()},700))}}(),a.transitionIn&&i.classList.remove(a.transitionIn),a.transitionInMobile&&i.classList.remove(a.transitionInMobile),g||window.innerWidth<=C?a.transitionOutMobile&&i.classList.add(a.transitionOutMobile):a.transitionOut&&i.classList.add(a.transitionOut);var c=i.parentNode.offsetHeight;i.parentNode.style.height=c+"px",i.style.pointerEvents="none",(!g||window.innerWidth>C)&&(i.parentNode.style.transitionDelay="0.2s");try{var s=new CustomEvent(n+"-closing",{detail:a,bubbles:!0,cancelable:!0});document.dispatchEvent(s)}catch(l){console.warn(l)}setTimeout(function(){i.parentNode.style.height="0px",i.parentNode.style.overflow="",setTimeout(function(){delete t.children[a.ref],i.parentNode.remove();try{var l=new CustomEvent(n+"-closed",{detail:a,bubbles:!0,cancelable:!0});document.dispatchEvent(l)}catch(u){console.warn(u)}typeof a.onClosed<"u"&&a.onClosed.apply(null,[a,i,e])},1e3)},200),typeof a.onClosing<"u"&&a.onClosing.apply(null,[a,i,e])},f.show=function(o){var i=this,e=h(I,o||{});if(e=h(B,e),e.time={},e.id===null&&(e.id=ee(e.title+e.message+e.color)),e.displayMode===1||e.displayMode=="once")try{if(document.querySelectorAll("."+n+"#"+e.id).length>0)return!1}catch{console.warn("["+n+"] Could not find an element with this selector: #"+e.id+". Try to set an valid id.")}if(e.displayMode===2||e.displayMode=="replace")try{v(document.querySelectorAll("."+n+"#"+e.id),function(s,l){i.hide(e,s,"replaced")})}catch{console.warn("["+n+"] Could not find an element with this selector: #"+e.id+". Try to set an valid id.")}e.ref=new Date().getTime()+Math.floor(Math.random()*1e7+1),f.children[e.ref]=e;var t={body:document.querySelector("body"),overlay:document.createElement("div"),toast:document.createElement("div"),toastBody:document.createElement("div"),toastTexts:document.createElement("div"),toastCapsule:document.createElement("div"),cover:document.createElement("div"),buttons:document.createElement("div"),inputs:document.createElement("div"),icon:e.iconUrl?document.createElement("img"):document.createElement("i"),wrapper:null};t.toast.setAttribute("data-iziToast-ref",e.ref),t.toast.appendChild(t.toastBody),t.toastCapsule.appendChild(t.toast),function(){if(t.toast.classList.add(n),t.toast.classList.add(n+"-opening"),t.toastCapsule.classList.add(n+"-capsule"),t.toastBody.classList.add(n+"-body"),t.toastTexts.classList.add(n+"-texts"),g||window.innerWidth<=C?e.transitionInMobile&&t.toast.classList.add(e.transitionInMobile):e.transitionIn&&t.toast.classList.add(e.transitionIn),e.class){var s=e.class.split(" ");v(s,function(l,u){t.toast.classList.add(l)})}e.id&&(t.toast.id=e.id),e.rtl&&(t.toast.classList.add(n+"-rtl"),t.toast.setAttribute("dir","rtl")),e.layout>1&&t.toast.classList.add(n+"-layout"+e.layout),e.balloon&&t.toast.classList.add(n+"-balloon"),e.maxWidth&&(isNaN(e.maxWidth)?t.toast.style.maxWidth=e.maxWidth:t.toast.style.maxWidth=e.maxWidth+"px"),(e.theme!==""||e.theme!=="light")&&t.toast.classList.add(n+"-theme-"+e.theme),e.color&&(te(e.color)?t.toast.style.background=e.color:t.toast.classList.add(n+"-color-"+e.color)),e.backgroundColor&&(t.toast.style.background=e.backgroundColor,e.balloon&&(t.toast.style.borderColor=e.backgroundColor))}(),function(){e.image&&(t.cover.classList.add(n+"-cover"),t.cover.style.width=e.imageWidth+"px",ne(e.image.replace(/ /g,""))?t.cover.style.backgroundImage="url(data:image/png;base64,"+e.image.replace(/ /g,"")+")":t.cover.style.backgroundImage="url("+e.image+")",e.rtl?t.toastBody.style.marginRight=e.imageWidth+10+"px":t.toastBody.style.marginLeft=e.imageWidth+10+"px",t.toast.appendChild(t.cover))}(),function(){e.close?(t.buttonClose=document.createElement("button"),t.buttonClose.type="button",t.buttonClose.classList.add(n+"-close"),t.buttonClose.addEventListener("click",function(s){s.target,i.hide(e,t.toast,"button")}),t.toast.appendChild(t.buttonClose)):e.rtl?t.toast.style.paddingLeft="18px":t.toast.style.paddingRight="18px"}(),function(){e.progressBar&&(t.progressBar=document.createElement("div"),t.progressBarDiv=document.createElement("div"),t.progressBar.classList.add(n+"-progressbar"),t.progressBarDiv.style.background=e.progressBarColor,t.progressBar.appendChild(t.progressBarDiv),t.toast.appendChild(t.progressBar)),e.timeout&&(e.pauseOnHover&&!e.resetOnHover&&(t.toast.addEventListener("mouseenter",function(s){i.progress(e,t.toast).pause()}),t.toast.addEventListener("mouseleave",function(s){i.progress(e,t.toast).resume()})),e.resetOnHover&&(t.toast.addEventListener("mouseenter",function(s){i.progress(e,t.toast).reset()}),t.toast.addEventListener("mouseleave",function(s){i.progress(e,t.toast).start()})))}(),function(){e.iconUrl?(t.icon.setAttribute("class",n+"-icon"),t.icon.setAttribute("src",e.iconUrl)):e.icon&&(t.icon.setAttribute("class",n+"-icon "+e.icon),e.iconText&&t.icon.appendChild(document.createTextNode(e.iconText)),e.iconColor&&(t.icon.style.color=e.iconColor)),(e.icon||e.iconUrl)&&(e.rtl?t.toastBody.style.paddingRight="33px":t.toastBody.style.paddingLeft="33px",t.toastBody.appendChild(t.icon))}(),function(){e.title.length>0&&(t.strong=document.createElement("strong"),t.strong.classList.add(n+"-title"),t.strong.appendChild(T(e.title)),t.toastTexts.appendChild(t.strong),e.titleColor&&(t.strong.style.color=e.titleColor),e.titleSize&&(isNaN(e.titleSize)?t.strong.style.fontSize=e.titleSize:t.strong.style.fontSize=e.titleSize+"px"),e.titleLineHeight&&(isNaN(e.titleSize)?t.strong.style.lineHeight=e.titleLineHeight:t.strong.style.lineHeight=e.titleLineHeight+"px")),e.message.length>0&&(t.p=document.createElement("p"),t.p.classList.add(n+"-message"),t.p.appendChild(T(e.message)),t.toastTexts.appendChild(t.p),e.messageColor&&(t.p.style.color=e.messageColor),e.messageSize&&(isNaN(e.titleSize)?t.p.style.fontSize=e.messageSize:t.p.style.fontSize=e.messageSize+"px"),e.messageLineHeight&&(isNaN(e.titleSize)?t.p.style.lineHeight=e.messageLineHeight:t.p.style.lineHeight=e.messageLineHeight+"px")),e.title.length>0&&e.message.length>0&&(e.rtl?t.strong.style.marginLeft="10px":e.layout!==2&&!e.rtl&&(t.strong.style.marginRight="10px"))}(),t.toastBody.appendChild(t.toastTexts);var a;(function(){e.inputs.length>0&&(t.inputs.classList.add(n+"-inputs"),v(e.inputs,function(s,l){t.inputs.appendChild(T(s[0])),a=t.inputs.childNodes,a[l].classList.add(n+"-inputs-child"),s[3]&&setTimeout(function(){a[l].focus()},300),a[l].addEventListener(s[1],function(u){var m=s[2];return m(i,t.toast,this,u)})}),t.toastBody.appendChild(t.inputs))})(),function(){e.buttons.length>0&&(t.buttons.classList.add(n+"-buttons"),v(e.buttons,function(s,l){t.buttons.appendChild(T(s[0]));var u=t.buttons.childNodes;u[l].classList.add(n+"-buttons-child"),s[2]&&setTimeout(function(){u[l].focus()},300),u[l].addEventListener("click",function(m){m.preventDefault();var ie=s[1];return ie(i,t.toast,this,m,a)})})),t.toastBody.appendChild(t.buttons)}(),e.message.length>0&&(e.inputs.length>0||e.buttons.length>0)&&(t.p.style.marginBottom="0"),(e.inputs.length>0||e.buttons.length>0)&&(e.rtl?t.toastTexts.style.marginLeft="10px":t.toastTexts.style.marginRight="10px",e.inputs.length>0&&e.buttons.length>0&&(e.rtl?t.inputs.style.marginLeft="8px":t.inputs.style.marginRight="8px")),function(){t.toastCapsule.style.visibility="hidden",setTimeout(function(){var s=t.toast.offsetHeight,l=t.toast.currentStyle||window.getComputedStyle(t.toast),u=l.marginTop;u=u.split("px"),u=parseInt(u[0]);var m=l.marginBottom;m=m.split("px"),m=parseInt(m[0]),t.toastCapsule.style.visibility="",t.toastCapsule.style.height=s+m+u+"px",setTimeout(function(){t.toastCapsule.style.height="auto",e.target&&(t.toastCapsule.style.overflow="visible")},500),e.timeout&&i.progress(e,t.toast).start()},100)}(),function(){var s=e.position;if(e.target)t.wrapper=document.querySelector(e.target),t.wrapper.classList.add(n+"-target"),e.targetFirst?t.wrapper.insertBefore(t.toastCapsule,t.wrapper.firstChild):t.wrapper.appendChild(t.toastCapsule);else{if(j.indexOf(e.position)==-1){console.warn("["+n+`] Incorrect position. +It can be › `+j);return}g||window.innerWidth<=C?e.position=="bottomLeft"||e.position=="bottomRight"||e.position=="bottomCenter"?s=n+"-wrapper-bottomCenter":e.position=="topLeft"||e.position=="topRight"||e.position=="topCenter"?s=n+"-wrapper-topCenter":s=n+"-wrapper-center":s=n+"-wrapper-"+s,t.wrapper=document.querySelector("."+n+"-wrapper."+s),t.wrapper||(t.wrapper=document.createElement("div"),t.wrapper.classList.add(n+"-wrapper"),t.wrapper.classList.add(s),document.body.appendChild(t.wrapper)),e.position=="topLeft"||e.position=="topCenter"||e.position=="topRight"?t.wrapper.insertBefore(t.toastCapsule,t.wrapper.firstChild):t.wrapper.appendChild(t.toastCapsule)}isNaN(e.zindex)?console.warn("["+n+"] Invalid zIndex."):t.wrapper.style.zIndex=e.zindex}(),function(){e.overlay&&(document.querySelector("."+n+"-overlay.fadeIn")!==null?(t.overlay=document.querySelector("."+n+"-overlay"),t.overlay.setAttribute("data-iziToast-ref",t.overlay.getAttribute("data-iziToast-ref")+","+e.ref),!isNaN(e.zindex)&&e.zindex!==null&&(t.overlay.style.zIndex=e.zindex-1)):(t.overlay.classList.add(n+"-overlay"),t.overlay.classList.add("fadeIn"),t.overlay.style.background=e.overlayColor,t.overlay.setAttribute("data-iziToast-ref",e.ref),!isNaN(e.zindex)&&e.zindex!==null&&(t.overlay.style.zIndex=e.zindex-1),document.querySelector("body").appendChild(t.overlay)),e.overlayClose?(t.overlay.removeEventListener("click",{}),t.overlay.addEventListener("click",function(s){i.hide(e,t.toast,"overlay")})):t.overlay.removeEventListener("click",{}))}(),function(){if(e.animateInside){t.toast.classList.add(n+"-animateInside");var s=[200,100,300];(e.transitionIn=="bounceInLeft"||e.transitionIn=="bounceInRight")&&(s=[400,200,400]),e.title.length>0&&setTimeout(function(){t.strong.classList.add("slideIn")},s[0]),e.message.length>0&&setTimeout(function(){t.p.classList.add("slideIn")},s[1]),(e.icon||e.iconUrl)&&setTimeout(function(){t.icon.classList.add("revealIn")},s[2]);var l=150;e.buttons.length>0&&t.buttons&&setTimeout(function(){v(t.buttons.childNodes,function(u,m){setTimeout(function(){u.classList.add("revealIn")},l),l=l+150})},e.inputs.length>0?150:0),e.inputs.length>0&&t.inputs&&(l=150,v(t.inputs.childNodes,function(u,m){setTimeout(function(){u.classList.add("revealIn")},l),l=l+150}))}}(),e.onOpening.apply(null,[e,t.toast]);try{var c=new CustomEvent(n+"-opening",{detail:e,bubbles:!0,cancelable:!0});document.dispatchEvent(c)}catch(s){console.warn(s)}setTimeout(function(){t.toast.classList.remove(n+"-opening"),t.toast.classList.add(n+"-opened");try{var s=new CustomEvent(n+"-opened",{detail:e,bubbles:!0,cancelable:!0});document.dispatchEvent(s)}catch(l){console.warn(l)}e.onOpened.apply(null,[e,t.toast])},1e3),e.drag&&(w?(t.toast.addEventListener("touchstart",function(s){L.startMoving(this,i,e,s)},!1),t.toast.addEventListener("touchend",function(s){L.stopMoving(this,s)},!1)):(t.toast.addEventListener("mousedown",function(s){s.preventDefault(),L.startMoving(this,i,e,s)},!1),t.toast.addEventListener("mouseup",function(s){s.preventDefault(),L.stopMoving(this,s)},!1))),e.closeOnEscape&&document.addEventListener("keyup",function(s){s=s||window.event,s.keyCode==27&&i.hide(e,t.toast,"esc")}),e.closeOnClick&&t.toast.addEventListener("click",function(s){i.hide(e,t.toast,"toast")}),i.toast=t.toast},f})})(K);var ve=K.exports;const k=ge(ve);const z={timeout:3e3,close:!1,closeOnClick:!0,icon:null,position:"topRight",transitionIn:"fadeInDown",transitionOut:"fadeOutUp"};class S{static success(d){k.success({title:"OK",titleColor:"green",message:d,messageColor:"green",progressBarColor:"green",...z})}static error(d){k.error({title:"Error",titleColor:"red",message:d,messageColor:"red",progressBarColor:"red",...z})}static warning(d){k.warning({title:"Caution",message:d,titleColor:"red",messageColor:"red",progressBarColor:"red",...z})}}const O=document.getElementById("subscribeForm"),J=O.querySelector('input[name="email"]'),F=document.getElementById("subscribeBtn");J.addEventListener("input",he);O.addEventListener("submit",be);function ye(r){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r)}function he(){J.value}async function be(r){r.preventDefault();const d=new FormData(O),p=d.get("email");if(!ye(p))return console.error("Invalid email address"),S.error("Invalid email address");try{F.disabled=!0;const n=await se.post("https://your-energy.b.goit.study/api/subscription",d,{headers:{"Content-Type":"application/json"}});return n.status>=200&&n.status<300?(O.reset(),S.success(`${n.data.message}`)):(console.error("Server Error:",n.status,n.statusText),S.error(`Server Error: ${n.status} ${n.statusText}`))}catch(n){return console.error("Error:",n.message),S.error(`Error: ${n.message}`)}finally{F.disabled=!1}}const Le=new D,A=document.querySelector(".js-list");A.addEventListener("click",Ee);async function Ee(r){if(!r.target.closest(".filters__item"))return;const d=r.target.closest(".filters__item");let p=d.lastElementChild.children[0].innerText.toLowerCase().replace(/\s/g,"");const f=d.lastElementChild.children[1].innerText.toLowerCase().replace(/\s/g,"%20");p==="bodyparts"&&(p="bodypart");try{const n=await Le.getExercises(p,f);we(n)}catch(n){console.log(n)}}function we(r){A.innerHTML="";const d=r.map(({_id:p,rating:f,name:n,burnedCalories:g,bodyPart:y,target:E})=>` +
  • +
    +
    +

    Workout

    + + ${f} + + + + + +
    +
    + + + +

    ${n}

    +
    +
    +

    Burned calories:${g}

    +

    Body part:${y}

    +

    Target:${E}

    +
    +
    +
  • `).join("");A.insertAdjacentHTML("beforeend",d)}document.addEventListener("DOMContentLoaded",()=>{const r=document.querySelectorAll(".exercises__btn");r.forEach(d=>{d.addEventListener("click",()=>{r.forEach(p=>p.classList.remove("active")),d.classList.add("active")})})});var b=document.getElementById("mySVG");b.style.transform="scale(1)";b.style.transition="fill 0.3s ease, transform 0.3s ease";var Z=["var(--color-yellow)","var(--color-black)","var(--color-valid)"],q=0;b.addEventListener("mouseover",function(){b.style.fill=Z[q],b.style.transform="scale(1.6) rotate(145deg)"});b.addEventListener("mouseout",function(){b.style.transform="scale(1) rotate(0deg)",q=(q+1)%Z.length});const Ce=document.getElementById("btn"),Ie=document.getElementById("bmi-result"),_=document.getElementById("weight-condition");function Te(){const r=document.getElementById("height").value/100,p=(document.getElementById("weight").value/(r*r)).toFixed(1);Ie.value=p,p<18.5?_.innerText="Under weight":p>=18.5&&p<=24.9?_.innerText="Normal weight":p>=25&&p<=29.9?_.innerText="Overweight":p>=30&&(_.innerText="Obesity")}Ce.addEventListener("click",Te); diff --git a/assets/index-f1adf69c.js b/assets/index-f1adf69c.js deleted file mode 100644 index d3f3fa5..0000000 --- a/assets/index-f1adf69c.js +++ /dev/null @@ -1,114 +0,0 @@ -import{A,i as _,a as ue}from"./sprite-70ed1671.js";const fe=document.querySelector(".js-quote"),me=new A;pe();async function pe(){try{const o=await me.getQuote();ge(o)}catch(o){console.log(o)}}function ge({author:o,quote:d}){fe.innerHTML=` -

    ${d}

    -

    ${o}

    - `}const ve=new A,Q=document.querySelector(".js-list");Y("Muscles");async function Y(o){try{const d=await ve.getFilter(o);ye(d)}catch(d){console.log(d)}}function ye(o){const d=o.map(({filter:m,name:u,imgURL:i})=>` -
  • - -
    -

    ${m}

    -

    ${u}

    -
    -
  • - `).join("");Q.insertAdjacentHTML("beforeend",d)}document.querySelectorAll(".btnFilters").forEach(o=>{o.addEventListener("click",()=>{const d=o.innerText;Q.innerHTML="",Y(d)})});const P="/your-energy/assets/modal-exercise-image-3ecfcf3d.jpg",he="/your-energy/assets/modal-exercise-image@2x-88eeae48.jpg",be=new A;let $=!1;const H=document.querySelector(".modal-exercises"),R=document.querySelector(".overlay"),K=document.querySelector(".js-list");K.addEventListener("click",Le);console.log(K);async function Le(o){if(o.target.closest(".card__btn"))try{const d=o.target.closest(".card__btn").getAttribute("data-id"),m=await be.getExercisesById(d),u=Ce(m);we(u),Ee(),document.querySelector(".modal-exercises__btn-favorites").addEventListener("click",Z),document.querySelector(".modal-exercises__btn-close").addEventListener("click",V)}catch(d){console.log(d)}}function Ee(){const o=window.innerWidth-document.body.offsetWidth+"px";H.classList.remove("hidden"),R.classList.remove("hidden"),document.body.style.paddingRight=o,document.body.style.overflow="hidden"}function we(o){H.innerHTML=o}function xe(o){const d="#EEA10C",m="#F4F4F4";let i="";for(let y=0;y<5;y++){const b=`starGradient${y}`,C=y+1<=o?100:y - ${M.map(L=>``).join("")} - - `,x=`url(#${b})`;i+=`${w}`}return`${Number.isInteger(o)?`${o}.0`:o.toFixed(1)} ${i}`}function Ce({_id:o,bodyPart:d,equipment:m,gifUrl:u,name:i,target:g,description:v,rating:y,burnedCalories:b,time:C,popularity:M}){const w=x(u);function x(T){return T===null||!T?`srcset = '${P} 1x,${he} 2x' - src = '${P}'`:`src="${T}"`}const L=xe(y);return` - -`}function Z(){$=!$;const o=document.querySelector(".modal-exercises__btn-favorites");document.querySelector(".btn-favorites__icon"),$?o.innerHTML=Ie():o.innerHTML=_e(),document.querySelector(".btn-favorites__icon").addEventListener("click",Z)}function _e(){return` - Add to favorites - - - `}function Ie(){return` - Remove from favorites - - - `}function V(){H.classList.add("hidden"),R.classList.add("hidden"),document.body.style.paddingRight="0px",document.body.style.overflow="auto"}R.addEventListener("click",function(o){o.target===R&&V()});window.addEventListener("keydown",function(o){o.key==="Escape"&&!H.classList.contains("hidden")&&V()});document.addEventListener("DOMContentLoaded",function(){const o=document.querySelectorAll(".rating-label"),d=document.querySelector(".rating-value"),m=document.querySelector(".rating-form");let u=0;o.forEach(g=>{g.addEventListener("click",()=>{u=g.dataset.rating,i(u)})});function i(g){d.textContent=g;for(let v=0;vd?j.classList.add("scroll__go-top--show"):j.classList.remove("scroll__go-top--show")}function se(){window.pageYOffset>0&&(window.scrollBy(0,-75),setTimeout(se,0))}var B=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Be(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var ne={exports:{}};(function(o,d){(function(m,u){o.exports=u(m)})(typeof B<"u"?B:window||B.window||B.global,function(m){var u={},i="iziToast";document.querySelector("body");var g=!!/Mobi/.test(navigator.userAgent),v=/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor),y=typeof InstallTrigger<"u",b="ontouchstart"in document.documentElement,C=["bottomRight","bottomLeft","bottomCenter","topRight","topLeft","topCenter","center"],M={info:{color:"blue",icon:"ico-info"},success:{color:"green",icon:"ico-success"},warning:{color:"orange",icon:"ico-warning"},error:{color:"red",icon:"ico-error"},question:{color:"yellow",icon:"ico-question"}},w=568,x={};u.children={};var L={id:null,class:"",title:"",titleColor:"",titleSize:"",titleLineHeight:"",message:"",messageColor:"",messageSize:"",messageLineHeight:"",backgroundColor:"",theme:"light",color:"",icon:"",iconText:"",iconColor:"",iconUrl:null,image:"",imageWidth:50,maxWidth:null,zindex:null,layout:1,balloon:!1,close:!0,closeOnEscape:!1,closeOnClick:!1,displayMode:0,position:"bottomRight",target:"",targetFirst:!0,timeout:5e3,rtl:!1,animateInside:!0,drag:!0,pauseOnHover:!0,resetOnHover:!1,progressBar:!0,progressBarColor:"",progressBarEasing:"linear",overlay:!1,overlayClose:!1,overlayColor:"rgba(0, 0, 0, 0.6)",transitionIn:"fadeInUp",transitionOut:"fadeOut",transitionInMobile:"fadeInUp",transitionOutMobile:"fadeOutDown",buttons:{},inputs:{},onOpening:function(){},onOpened:function(){},onClosing:function(){},onClosed:function(){}};if("remove"in Element.prototype||(Element.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)}),typeof window.CustomEvent!="function"){var T=function(r,s){s=s||{bubbles:!1,cancelable:!1,detail:void 0};var e=document.createEvent("CustomEvent");return e.initCustomEvent(r,s.bubbles,s.cancelable,s.detail),e};T.prototype=window.Event.prototype,window.CustomEvent=T}var h=function(r,s,e){if(Object.prototype.toString.call(r)==="[object Object]")for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&s.call(e,r[t],t,r);else if(r)for(var a=0,c=r.length;a0?(a=(n-t)/n,a"u"&&(s.classList.remove(i+"-reseted"),n!==null&&(n.style.transition="width "+c.timeout+"ms "+c.progressBarEasing,n.style.width="0%"),c.time.START=new Date().getTime(),c.time.END=c.time.START+c.timeout,c.time.TIMER=setTimeout(function(){clearTimeout(c.time.TIMER),s.classList.contains(i+"-closing")||(t.hide(c,s,"timeout"),typeof e=="function"&&e.apply(t))},c.timeout),t.setSetting(a,"time",c.time))},pause:function(){if(typeof c.time.START<"u"&&!s.classList.contains(i+"-paused")&&!s.classList.contains(i+"-reseted")){if(s.classList.add(i+"-paused"),c.time.REMAINING=c.time.END-new Date().getTime(),clearTimeout(c.time.TIMER),t.setSetting(a,"time",c.time),n!==null){var l=window.getComputedStyle(n),f=l.getPropertyValue("width");n.style.transition="none",n.style.width=f}typeof e=="function"&&setTimeout(function(){e.apply(t)},10)}},resume:function(){typeof c.time.REMAINING<"u"?(s.classList.remove(i+"-paused"),n!==null&&(n.style.transition="width "+c.time.REMAINING+"ms "+c.progressBarEasing,n.style.width="0%"),c.time.END=new Date().getTime()+c.time.REMAINING,c.time.TIMER=setTimeout(function(){clearTimeout(c.time.TIMER),s.classList.contains(i+"-closing")||(t.hide(c,s,"timeout"),typeof e=="function"&&e.apply(t))},c.time.REMAINING),t.setSetting(a,"time",c.time)):this.start()},reset:function(){clearTimeout(c.time.TIMER),delete c.time.REMAINING,t.setSetting(a,"time",c.time),s.classList.add(i+"-reseted"),s.classList.remove(i+"-paused"),n!==null&&(n.style.transition="none",n.style.width="100%"),typeof e=="function"&&setTimeout(function(){e.apply(t)},10)}}},u.hide=function(r,s,e){typeof s!="object"&&(s=document.querySelector(s));var t=this,a=E(this.children[s.getAttribute("data-iziToast-ref")],r||{});a.closedBy=e||null,delete a.time.REMAINING,s.classList.add(i+"-closing"),function(){var l=document.querySelector("."+i+"-overlay");if(l!==null){var f=l.getAttribute("data-iziToast-ref");f=f.split(",");var p=f.indexOf(String(a.ref));p!==-1&&f.splice(p,1),l.setAttribute("data-iziToast-ref",f.join()),f.length===0&&(l.classList.remove("fadeIn"),l.classList.add("fadeOut"),setTimeout(function(){l.remove()},700))}}(),a.transitionIn&&s.classList.remove(a.transitionIn),a.transitionInMobile&&s.classList.remove(a.transitionInMobile),g||window.innerWidth<=w?a.transitionOutMobile&&s.classList.add(a.transitionOutMobile):a.transitionOut&&s.classList.add(a.transitionOut);var c=s.parentNode.offsetHeight;s.parentNode.style.height=c+"px",s.style.pointerEvents="none",(!g||window.innerWidth>w)&&(s.parentNode.style.transitionDelay="0.2s");try{var n=new CustomEvent(i+"-closing",{detail:a,bubbles:!0,cancelable:!0});document.dispatchEvent(n)}catch(l){console.warn(l)}setTimeout(function(){s.parentNode.style.height="0px",s.parentNode.style.overflow="",setTimeout(function(){delete t.children[a.ref],s.parentNode.remove();try{var l=new CustomEvent(i+"-closed",{detail:a,bubbles:!0,cancelable:!0});document.dispatchEvent(l)}catch(f){console.warn(f)}typeof a.onClosed<"u"&&a.onClosed.apply(null,[a,s,e])},1e3)},200),typeof a.onClosing<"u"&&a.onClosing.apply(null,[a,s,e])},u.show=function(r){var s=this,e=E(x,r||{});if(e=E(L,e),e.time={},e.id===null&&(e.id=ae(e.title+e.message+e.color)),e.displayMode===1||e.displayMode=="once")try{if(document.querySelectorAll("."+i+"#"+e.id).length>0)return!1}catch{console.warn("["+i+"] Could not find an element with this selector: #"+e.id+". Try to set an valid id.")}if(e.displayMode===2||e.displayMode=="replace")try{h(document.querySelectorAll("."+i+"#"+e.id),function(n,l){s.hide(e,n,"replaced")})}catch{console.warn("["+i+"] Could not find an element with this selector: #"+e.id+". Try to set an valid id.")}e.ref=new Date().getTime()+Math.floor(Math.random()*1e7+1),u.children[e.ref]=e;var t={body:document.querySelector("body"),overlay:document.createElement("div"),toast:document.createElement("div"),toastBody:document.createElement("div"),toastTexts:document.createElement("div"),toastCapsule:document.createElement("div"),cover:document.createElement("div"),buttons:document.createElement("div"),inputs:document.createElement("div"),icon:e.iconUrl?document.createElement("img"):document.createElement("i"),wrapper:null};t.toast.setAttribute("data-iziToast-ref",e.ref),t.toast.appendChild(t.toastBody),t.toastCapsule.appendChild(t.toast),function(){if(t.toast.classList.add(i),t.toast.classList.add(i+"-opening"),t.toastCapsule.classList.add(i+"-capsule"),t.toastBody.classList.add(i+"-body"),t.toastTexts.classList.add(i+"-texts"),g||window.innerWidth<=w?e.transitionInMobile&&t.toast.classList.add(e.transitionInMobile):e.transitionIn&&t.toast.classList.add(e.transitionIn),e.class){var n=e.class.split(" ");h(n,function(l,f){t.toast.classList.add(l)})}e.id&&(t.toast.id=e.id),e.rtl&&(t.toast.classList.add(i+"-rtl"),t.toast.setAttribute("dir","rtl")),e.layout>1&&t.toast.classList.add(i+"-layout"+e.layout),e.balloon&&t.toast.classList.add(i+"-balloon"),e.maxWidth&&(isNaN(e.maxWidth)?t.toast.style.maxWidth=e.maxWidth:t.toast.style.maxWidth=e.maxWidth+"px"),(e.theme!==""||e.theme!=="light")&&t.toast.classList.add(i+"-theme-"+e.theme),e.color&&(le(e.color)?t.toast.style.background=e.color:t.toast.classList.add(i+"-color-"+e.color)),e.backgroundColor&&(t.toast.style.background=e.backgroundColor,e.balloon&&(t.toast.style.borderColor=e.backgroundColor))}(),function(){e.image&&(t.cover.classList.add(i+"-cover"),t.cover.style.width=e.imageWidth+"px",ce(e.image.replace(/ /g,""))?t.cover.style.backgroundImage="url(data:image/png;base64,"+e.image.replace(/ /g,"")+")":t.cover.style.backgroundImage="url("+e.image+")",e.rtl?t.toastBody.style.marginRight=e.imageWidth+10+"px":t.toastBody.style.marginLeft=e.imageWidth+10+"px",t.toast.appendChild(t.cover))}(),function(){e.close?(t.buttonClose=document.createElement("button"),t.buttonClose.type="button",t.buttonClose.classList.add(i+"-close"),t.buttonClose.addEventListener("click",function(n){n.target,s.hide(e,t.toast,"button")}),t.toast.appendChild(t.buttonClose)):e.rtl?t.toast.style.paddingLeft="18px":t.toast.style.paddingRight="18px"}(),function(){e.progressBar&&(t.progressBar=document.createElement("div"),t.progressBarDiv=document.createElement("div"),t.progressBar.classList.add(i+"-progressbar"),t.progressBarDiv.style.background=e.progressBarColor,t.progressBar.appendChild(t.progressBarDiv),t.toast.appendChild(t.progressBar)),e.timeout&&(e.pauseOnHover&&!e.resetOnHover&&(t.toast.addEventListener("mouseenter",function(n){s.progress(e,t.toast).pause()}),t.toast.addEventListener("mouseleave",function(n){s.progress(e,t.toast).resume()})),e.resetOnHover&&(t.toast.addEventListener("mouseenter",function(n){s.progress(e,t.toast).reset()}),t.toast.addEventListener("mouseleave",function(n){s.progress(e,t.toast).start()})))}(),function(){e.iconUrl?(t.icon.setAttribute("class",i+"-icon"),t.icon.setAttribute("src",e.iconUrl)):e.icon&&(t.icon.setAttribute("class",i+"-icon "+e.icon),e.iconText&&t.icon.appendChild(document.createTextNode(e.iconText)),e.iconColor&&(t.icon.style.color=e.iconColor)),(e.icon||e.iconUrl)&&(e.rtl?t.toastBody.style.paddingRight="33px":t.toastBody.style.paddingLeft="33px",t.toastBody.appendChild(t.icon))}(),function(){e.title.length>0&&(t.strong=document.createElement("strong"),t.strong.classList.add(i+"-title"),t.strong.appendChild(k(e.title)),t.toastTexts.appendChild(t.strong),e.titleColor&&(t.strong.style.color=e.titleColor),e.titleSize&&(isNaN(e.titleSize)?t.strong.style.fontSize=e.titleSize:t.strong.style.fontSize=e.titleSize+"px"),e.titleLineHeight&&(isNaN(e.titleSize)?t.strong.style.lineHeight=e.titleLineHeight:t.strong.style.lineHeight=e.titleLineHeight+"px")),e.message.length>0&&(t.p=document.createElement("p"),t.p.classList.add(i+"-message"),t.p.appendChild(k(e.message)),t.toastTexts.appendChild(t.p),e.messageColor&&(t.p.style.color=e.messageColor),e.messageSize&&(isNaN(e.titleSize)?t.p.style.fontSize=e.messageSize:t.p.style.fontSize=e.messageSize+"px"),e.messageLineHeight&&(isNaN(e.titleSize)?t.p.style.lineHeight=e.messageLineHeight:t.p.style.lineHeight=e.messageLineHeight+"px")),e.title.length>0&&e.message.length>0&&(e.rtl?t.strong.style.marginLeft="10px":e.layout!==2&&!e.rtl&&(t.strong.style.marginRight="10px"))}(),t.toastBody.appendChild(t.toastTexts);var a;(function(){e.inputs.length>0&&(t.inputs.classList.add(i+"-inputs"),h(e.inputs,function(n,l){t.inputs.appendChild(k(n[0])),a=t.inputs.childNodes,a[l].classList.add(i+"-inputs-child"),n[3]&&setTimeout(function(){a[l].focus()},300),a[l].addEventListener(n[1],function(f){var p=n[2];return p(s,t.toast,this,f)})}),t.toastBody.appendChild(t.inputs))})(),function(){e.buttons.length>0&&(t.buttons.classList.add(i+"-buttons"),h(e.buttons,function(n,l){t.buttons.appendChild(k(n[0]));var f=t.buttons.childNodes;f[l].classList.add(i+"-buttons-child"),n[2]&&setTimeout(function(){f[l].focus()},300),f[l].addEventListener("click",function(p){p.preventDefault();var de=n[1];return de(s,t.toast,this,p,a)})})),t.toastBody.appendChild(t.buttons)}(),e.message.length>0&&(e.inputs.length>0||e.buttons.length>0)&&(t.p.style.marginBottom="0"),(e.inputs.length>0||e.buttons.length>0)&&(e.rtl?t.toastTexts.style.marginLeft="10px":t.toastTexts.style.marginRight="10px",e.inputs.length>0&&e.buttons.length>0&&(e.rtl?t.inputs.style.marginLeft="8px":t.inputs.style.marginRight="8px")),function(){t.toastCapsule.style.visibility="hidden",setTimeout(function(){var n=t.toast.offsetHeight,l=t.toast.currentStyle||window.getComputedStyle(t.toast),f=l.marginTop;f=f.split("px"),f=parseInt(f[0]);var p=l.marginBottom;p=p.split("px"),p=parseInt(p[0]),t.toastCapsule.style.visibility="",t.toastCapsule.style.height=n+p+f+"px",setTimeout(function(){t.toastCapsule.style.height="auto",e.target&&(t.toastCapsule.style.overflow="visible")},500),e.timeout&&s.progress(e,t.toast).start()},100)}(),function(){var n=e.position;if(e.target)t.wrapper=document.querySelector(e.target),t.wrapper.classList.add(i+"-target"),e.targetFirst?t.wrapper.insertBefore(t.toastCapsule,t.wrapper.firstChild):t.wrapper.appendChild(t.toastCapsule);else{if(C.indexOf(e.position)==-1){console.warn("["+i+`] Incorrect position. -It can be › `+C);return}g||window.innerWidth<=w?e.position=="bottomLeft"||e.position=="bottomRight"||e.position=="bottomCenter"?n=i+"-wrapper-bottomCenter":e.position=="topLeft"||e.position=="topRight"||e.position=="topCenter"?n=i+"-wrapper-topCenter":n=i+"-wrapper-center":n=i+"-wrapper-"+n,t.wrapper=document.querySelector("."+i+"-wrapper."+n),t.wrapper||(t.wrapper=document.createElement("div"),t.wrapper.classList.add(i+"-wrapper"),t.wrapper.classList.add(n),document.body.appendChild(t.wrapper)),e.position=="topLeft"||e.position=="topCenter"||e.position=="topRight"?t.wrapper.insertBefore(t.toastCapsule,t.wrapper.firstChild):t.wrapper.appendChild(t.toastCapsule)}isNaN(e.zindex)?console.warn("["+i+"] Invalid zIndex."):t.wrapper.style.zIndex=e.zindex}(),function(){e.overlay&&(document.querySelector("."+i+"-overlay.fadeIn")!==null?(t.overlay=document.querySelector("."+i+"-overlay"),t.overlay.setAttribute("data-iziToast-ref",t.overlay.getAttribute("data-iziToast-ref")+","+e.ref),!isNaN(e.zindex)&&e.zindex!==null&&(t.overlay.style.zIndex=e.zindex-1)):(t.overlay.classList.add(i+"-overlay"),t.overlay.classList.add("fadeIn"),t.overlay.style.background=e.overlayColor,t.overlay.setAttribute("data-iziToast-ref",e.ref),!isNaN(e.zindex)&&e.zindex!==null&&(t.overlay.style.zIndex=e.zindex-1),document.querySelector("body").appendChild(t.overlay)),e.overlayClose?(t.overlay.removeEventListener("click",{}),t.overlay.addEventListener("click",function(n){s.hide(e,t.toast,"overlay")})):t.overlay.removeEventListener("click",{}))}(),function(){if(e.animateInside){t.toast.classList.add(i+"-animateInside");var n=[200,100,300];(e.transitionIn=="bounceInLeft"||e.transitionIn=="bounceInRight")&&(n=[400,200,400]),e.title.length>0&&setTimeout(function(){t.strong.classList.add("slideIn")},n[0]),e.message.length>0&&setTimeout(function(){t.p.classList.add("slideIn")},n[1]),(e.icon||e.iconUrl)&&setTimeout(function(){t.icon.classList.add("revealIn")},n[2]);var l=150;e.buttons.length>0&&t.buttons&&setTimeout(function(){h(t.buttons.childNodes,function(f,p){setTimeout(function(){f.classList.add("revealIn")},l),l=l+150})},e.inputs.length>0?150:0),e.inputs.length>0&&t.inputs&&(l=150,h(t.inputs.childNodes,function(f,p){setTimeout(function(){f.classList.add("revealIn")},l),l=l+150}))}}(),e.onOpening.apply(null,[e,t.toast]);try{var c=new CustomEvent(i+"-opening",{detail:e,bubbles:!0,cancelable:!0});document.dispatchEvent(c)}catch(n){console.warn(n)}setTimeout(function(){t.toast.classList.remove(i+"-opening"),t.toast.classList.add(i+"-opened");try{var n=new CustomEvent(i+"-opened",{detail:e,bubbles:!0,cancelable:!0});document.dispatchEvent(n)}catch(l){console.warn(l)}e.onOpened.apply(null,[e,t.toast])},1e3),e.drag&&(b?(t.toast.addEventListener("touchstart",function(n){S.startMoving(this,s,e,n)},!1),t.toast.addEventListener("touchend",function(n){S.stopMoving(this,n)},!1)):(t.toast.addEventListener("mousedown",function(n){n.preventDefault(),S.startMoving(this,s,e,n)},!1),t.toast.addEventListener("mouseup",function(n){n.preventDefault(),S.stopMoving(this,n)},!1))),e.closeOnEscape&&document.addEventListener("keyup",function(n){n=n||window.event,n.keyCode==27&&s.hide(e,t.toast,"esc")}),e.closeOnClick&&t.toast.addEventListener("click",function(n){s.hide(e,t.toast,"toast")}),s.toast=t.toast},u})})(ne);var Oe=ne.exports;const D=Be(Oe);const F={timeout:3e3,close:!1,closeOnClick:!0,icon:null,position:"topRight",transitionIn:"fadeInDown",transitionOut:"fadeOutUp"};class O{static success(d){D.success({title:"OK",titleColor:"green",message:d,messageColor:"green",progressBarColor:"green",...F})}static error(d){D.error({title:"Error",titleColor:"red",message:d,messageColor:"red",progressBarColor:"red",...F})}static warning(d){D.warning({title:"Caution",message:d,titleColor:"red",messageColor:"red",progressBarColor:"red",...F})}}const z=document.getElementById("subscribeForm"),oe=z.querySelector('input[name="email"]'),U=document.getElementById("subscribeBtn");oe.addEventListener("input",Re);z.addEventListener("submit",qe);function Ne(o){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o)}function Re(){oe.value}async function qe(o){o.preventDefault();const d=new FormData(z),m=d.get("email");if(!Ne(m))return console.error("Invalid email address"),O.error("Invalid email address");try{U.disabled=!0;const i=await ue.post("https://your-energy.b.goit.study/api/subscription",d,{headers:{"Content-Type":"application/json"}});return i.status>=200&&i.status<300?(z.reset(),O.success(`${i.data.message}`)):(console.error("Server Error:",i.status,i.statusText),O.error(`Server Error: ${i.status} ${i.statusText}`))}catch(i){return console.error("Error:",i.message),O.error(`Error: ${i.message}`)}finally{U.disabled=!1}}const ze=new A,W=document.querySelector(".js-list");W.addEventListener("click",Ae);async function Ae(o){if(!o.target.closest(".filters__item"))return;const d=o.target.closest(".filters__item");let m=d.lastElementChild.children[0].innerText.toLowerCase().replace(/\s/g,"");const u=d.lastElementChild.children[1].innerText.toLowerCase().replace(/\s/g,"%20");m==="bodyparts"&&(m="bodypart");try{const i=await ze.getExercises(m,u);He(i)}catch(i){console.log(i)}}function He(o){W.innerHTML="";const d=o.map(({_id:m,rating:u,name:i,burnedCalories:g,bodyPart:v,target:y})=>` -
  • -
    -
    -

    Workout

    - - ${u} - - - - - -
    -
    - - - -

    ${i}

    -
    -
    -

    Burned calories:${g}

    -

    Body part:${v}

    -

    Target:${y}

    -
    -
    -
  • `).join("");W.insertAdjacentHTML("beforeend",d)}document.addEventListener("DOMContentLoaded",()=>{const o=document.querySelectorAll(".exercises__btn");o.forEach(d=>{d.addEventListener("click",()=>{o.forEach(m=>m.classList.remove("active")),d.classList.add("active")})})});var I=document.getElementById("mySVG");I.style.transform="scale(1)";I.style.transition="fill 0.3s ease, transform 0.3s ease";var re=["var(--color-yellow)","var(--color-black)","var(--color-valid)"],G=0;I.addEventListener("mouseover",function(){I.style.fill=re[G],I.style.transform="scale(1.6) rotate(145deg)"});I.addEventListener("mouseout",function(){I.style.transform="scale(1) rotate(0deg)",G=(G+1)%re.length});const $e=document.getElementById("btn"),De=document.getElementById("bmi-result"),N=document.getElementById("weight-condition");function Fe(){const o=document.getElementById("height").value/100,m=(document.getElementById("weight").value/(o*o)).toFixed(1);De.value=m,m<18.5?N.innerText="Under weight":m>=18.5&&m<=24.9?N.innerText="Normal weight":m>=25&&m<=29.9?N.innerText="Overweight":m>=30&&(N.innerText="Obesity")}$e.addEventListener("click",Fe); diff --git a/assets/sprite-70ed1671.js b/assets/sprite-70ed1671.js deleted file mode 100644 index 7bccd12..0000000 --- a/assets/sprite-70ed1671.js +++ /dev/null @@ -1,5 +0,0 @@ -(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();document.addEventListener("DOMContentLoaded",function(){const e=document.getElementById("homeButton"),t=document.getElementById("favoritesButton");e.addEventListener("click",()=>{console.log("Home button clicked"),e.classList.add("active"),t.classList.remove("active")}),t.addEventListener("click",()=>{console.log("Favorites button clicked"),t.classList.add("active"),e.classList.remove("active")})});const ve=document.querySelector(".js-open-menu"),ze=document.querySelector(".js-close-menu"),Se=document.querySelector("#mobile-menu"),Y=document.querySelector("[data-menu-backdrop]"),Je=document.querySelectorAll(".menu__nav-link");function Ve(){Se.classList.add("is-open"),Y.classList.remove("is-hidden"),document.body.classList.add("no-scroll")}function ee(){Se.classList.remove("is-open"),Y.classList.add("is-hidden"),document.body.classList.remove("no-scroll")}ve.addEventListener("click",()=>{Ve()});ze.addEventListener("click",()=>{ee()});Y.addEventListener("click",()=>{ee()});Je.forEach(e=>{e.addEventListener("click",()=>{const t=e.getAttribute("href").substring(1),n=document.getElementById(t);n&&(n.scrollIntoView({behavior:"smooth"}),ee())})});document.addEventListener("DOMContentLoaded",()=>{const e=window.location.pathname;if(e.includes("index.html")){const t=document.getElementById("homeButton");t.classList.add("active"),t.addEventListener("click",ae)}else if(e.includes("favorites.html")){const t=document.getElementById("favoritesButton");t.classList.add("active"),t.addEventListener("click",ae)}});const ae=e=>{e.currentTarget.classList.contains("active")?e.preventDefault():alert("Button clicked!")};function ge(e,t){return function(){return e.apply(t,arguments)}}const{toString:We}=Object.prototype,{getPrototypeOf:te}=Object,M=(e=>t=>{const n=We.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),O=e=>(e=e.toLowerCase(),t=>M(t)===e),q=e=>t=>typeof t===e,{isArray:C}=Array,F=q("undefined");function Ke(e){return e!==null&&!F(e)&&e.constructor!==null&&!F(e.constructor)&&g(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Re=O("ArrayBuffer");function Ge(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Re(e.buffer),t}const Xe=q("string"),g=q("function"),Oe=q("number"),H=e=>e!==null&&typeof e=="object",Qe=e=>e===!0||e===!1,D=e=>{if(M(e)!=="object")return!1;const t=te(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},Ze=O("Date"),Ye=O("File"),et=O("Blob"),tt=O("FileList"),nt=e=>H(e)&&g(e.pipe),rt=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||g(e.append)&&((t=M(e))==="formdata"||t==="object"&&g(e.toString)&&e.toString()==="[object FormData]"))},st=O("URLSearchParams"),ot=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function _(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),C(e))for(r=0,s=e.length;r0;)if(s=n[r],t===s.toLowerCase())return s;return null}const xe=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),Te=e=>!F(e)&&e!==xe;function K(){const{caseless:e}=Te(this)&&this||{},t={},n=(r,s)=>{const o=e&&Ae(t,s)||s;D(t[o])&&D(r)?t[o]=K(t[o],r):D(r)?t[o]=K({},r):C(r)?t[o]=r.slice():t[o]=r};for(let r=0,s=arguments.length;r(_(t,(s,o)=>{n&&g(s)?e[o]=ge(s,n):e[o]=s},{allOwnKeys:r}),e),at=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),ct=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},lt=(e,t,n,r)=>{let s,o,i;const c={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),o=s.length;o-- >0;)i=s[o],(!r||r(i,e,t))&&!c[i]&&(t[i]=e[i],c[i]=!0);e=n!==!1&&te(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},ut=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},ft=e=>{if(!e)return null;if(C(e))return e;let t=e.length;if(!Oe(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},dt=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&te(Uint8Array)),pt=(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let s;for(;(s=r.next())&&!s.done;){const o=s.value;t.call(e,o[0],o[1])}},ht=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},mt=O("HTMLFormElement"),yt=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),ce=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),bt=O("RegExp"),Le=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};_(n,(s,o)=>{let i;(i=t(s,o,e))!==!1&&(r[o]=i||s)}),Object.defineProperties(e,r)},Et=e=>{Le(e,(t,n)=>{if(g(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(g(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},wt=(e,t)=>{const n={},r=s=>{s.forEach(o=>{n[o]=!0})};return C(e)?r(e):r(String(e).split(t)),n},St=()=>{},gt=(e,t)=>(e=+e,Number.isFinite(e)?e:t),z="abcdefghijklmnopqrstuvwxyz",le="0123456789",Ne={DIGIT:le,ALPHA:z,ALPHA_DIGIT:z+z.toUpperCase()+le},Rt=(e=16,t=Ne.ALPHA_DIGIT)=>{let n="";const{length:r}=t;for(;e--;)n+=t[Math.random()*r|0];return n};function Ot(e){return!!(e&&g(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const At=e=>{const t=new Array(10),n=(r,s)=>{if(H(r)){if(t.indexOf(r)>=0)return;if(!("toJSON"in r)){t[s]=r;const o=C(r)?[]:{};return _(r,(i,c)=>{const p=n(i,s+1);!F(p)&&(o[c]=p)}),t[s]=void 0,o}}return r};return n(e,0)},xt=O("AsyncFunction"),Tt=e=>e&&(H(e)||g(e))&&g(e.then)&&g(e.catch),a={isArray:C,isArrayBuffer:Re,isBuffer:Ke,isFormData:rt,isArrayBufferView:Ge,isString:Xe,isNumber:Oe,isBoolean:Qe,isObject:H,isPlainObject:D,isUndefined:F,isDate:Ze,isFile:Ye,isBlob:et,isRegExp:bt,isFunction:g,isStream:nt,isURLSearchParams:st,isTypedArray:dt,isFileList:tt,forEach:_,merge:K,extend:it,trim:ot,stripBOM:at,inherits:ct,toFlatObject:lt,kindOf:M,kindOfTest:O,endsWith:ut,toArray:ft,forEachEntry:pt,matchAll:ht,isHTMLForm:mt,hasOwnProperty:ce,hasOwnProp:ce,reduceDescriptors:Le,freezeMethods:Et,toObjectSet:wt,toCamelCase:yt,noop:St,toFiniteNumber:gt,findKey:Ae,global:xe,isContextDefined:Te,ALPHABET:Ne,generateString:Rt,isSpecCompliantForm:Ot,toJSONObject:At,isAsyncFn:xt,isThenable:Tt};function m(e,t,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s)}a.inherits(m,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:a.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const Pe=m.prototype,Ce={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{Ce[e]={value:e}});Object.defineProperties(m,Ce);Object.defineProperty(Pe,"isAxiosError",{value:!0});m.from=(e,t,n,r,s,o)=>{const i=Object.create(Pe);return a.toFlatObject(e,i,function(p){return p!==Error.prototype},c=>c!=="isAxiosError"),m.call(i,e.message,t,n,r,s),i.cause=e,i.name=e.name,o&&Object.assign(i,o),i};const Lt=null;function G(e){return a.isPlainObject(e)||a.isArray(e)}function Be(e){return a.endsWith(e,"[]")?e.slice(0,-2):e}function ue(e,t,n){return e?e.concat(t).map(function(s,o){return s=Be(s),!n&&o?"["+s+"]":s}).join(n?".":""):t}function Nt(e){return a.isArray(e)&&!e.some(G)}const Pt=a.toFlatObject(a,{},null,function(t){return/^is[A-Z]/.test(t)});function $(e,t,n){if(!a.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=a.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(d,E){return!a.isUndefined(E[d])});const r=n.metaTokens,s=n.visitor||u,o=n.dots,i=n.indexes,p=(n.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(t);if(!a.isFunction(s))throw new TypeError("visitor must be a function");function h(f){if(f===null)return"";if(a.isDate(f))return f.toISOString();if(!p&&a.isBlob(f))throw new m("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(f)||a.isTypedArray(f)?p&&typeof Blob=="function"?new Blob([f]):Buffer.from(f):f}function u(f,d,E){let w=f;if(f&&!E&&typeof f=="object"){if(a.endsWith(d,"{}"))d=r?d:d.slice(0,-2),f=JSON.stringify(f);else if(a.isArray(f)&&Nt(f)||(a.isFileList(f)||a.endsWith(d,"[]"))&&(w=a.toArray(f)))return d=Be(d),w.forEach(function(T,$e){!(a.isUndefined(T)||T===null)&&t.append(i===!0?ue([d],$e,o):i===null?d:d+"[]",h(T))}),!1}return G(f)?!0:(t.append(ue(E,d,o),h(f)),!1)}const l=[],b=Object.assign(Pt,{defaultVisitor:u,convertValue:h,isVisitable:G});function S(f,d){if(!a.isUndefined(f)){if(l.indexOf(f)!==-1)throw Error("Circular reference detected in "+d.join("."));l.push(f),a.forEach(f,function(w,x){(!(a.isUndefined(w)||w===null)&&s.call(t,w,a.isString(x)?x.trim():x,d,b))===!0&&S(w,d?d.concat(x):[x])}),l.pop()}}if(!a.isObject(e))throw new TypeError("data must be an object");return S(e),t}function fe(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function ne(e,t){this._pairs=[],e&&$(e,this,t)}const Fe=ne.prototype;Fe.append=function(t,n){this._pairs.push([t,n])};Fe.toString=function(t){const n=t?function(r){return t.call(this,r,fe)}:fe;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function Ct(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function _e(e,t,n){if(!t)return e;const r=n&&n.encode||Ct,s=n&&n.serialize;let o;if(s?o=s(t,n):o=a.isURLSearchParams(t)?t.toString():new ne(t,n).toString(r),o){const i=e.indexOf("#");i!==-1&&(e=e.slice(0,i)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class Bt{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){a.forEach(this.handlers,function(r){r!==null&&t(r)})}}const de=Bt,Ue={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Ft=typeof URLSearchParams<"u"?URLSearchParams:ne,_t=typeof FormData<"u"?FormData:null,Ut=typeof Blob<"u"?Blob:null,Dt={isBrowser:!0,classes:{URLSearchParams:Ft,FormData:_t,Blob:Ut},protocols:["http","https","file","blob","url","data"]},De=typeof window<"u"&&typeof document<"u",kt=(e=>De&&["ReactNative","NativeScript","NS"].indexOf(e)<0)(typeof navigator<"u"&&navigator.product),jt=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),It=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:De,hasStandardBrowserEnv:kt,hasStandardBrowserWebWorkerEnv:jt},Symbol.toStringTag,{value:"Module"})),R={...It,...Dt};function Mt(e,t){return $(e,new R.classes.URLSearchParams,Object.assign({visitor:function(n,r,s,o){return R.isNode&&a.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)}},t))}function qt(e){return a.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Ht(e){const t={},n=Object.keys(e);let r;const s=n.length;let o;for(r=0;r=n.length;return i=!i&&a.isArray(s)?s.length:i,p?(a.hasOwnProp(s,i)?s[i]=[s[i],r]:s[i]=r,!c):((!s[i]||!a.isObject(s[i]))&&(s[i]=[]),t(n,r,s[i],o)&&a.isArray(s[i])&&(s[i]=Ht(s[i])),!c)}if(a.isFormData(e)&&a.isFunction(e.entries)){const n={};return a.forEachEntry(e,(r,s)=>{t(qt(r),s,n,0)}),n}return null}function $t(e,t,n){if(a.isString(e))try{return(t||JSON.parse)(e),a.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const re={transitional:Ue,adapter:["xhr","http"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,o=a.isObject(t);if(o&&a.isHTMLForm(t)&&(t=new FormData(t)),a.isFormData(t))return s&&s?JSON.stringify(ke(t)):t;if(a.isArrayBuffer(t)||a.isBuffer(t)||a.isStream(t)||a.isFile(t)||a.isBlob(t))return t;if(a.isArrayBufferView(t))return t.buffer;if(a.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return Mt(t,this.formSerializer).toString();if((c=a.isFileList(t))||r.indexOf("multipart/form-data")>-1){const p=this.env&&this.env.FormData;return $(c?{"files[]":t}:t,p&&new p,this.formSerializer)}}return o||s?(n.setContentType("application/json",!1),$t(t)):t}],transformResponse:[function(t){const n=this.transitional||re.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(t&&a.isString(t)&&(r&&!this.responseType||s)){const i=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t)}catch(c){if(i)throw c.name==="SyntaxError"?m.from(c,m.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:R.classes.FormData,Blob:R.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],e=>{re.headers[e]={}});const se=re,vt=a.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),zt=e=>{const t={};let n,r,s;return e&&e.split(` -`).forEach(function(i){s=i.indexOf(":"),n=i.substring(0,s).trim().toLowerCase(),r=i.substring(s+1).trim(),!(!n||t[n]&&vt[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},pe=Symbol("internals");function B(e){return e&&String(e).trim().toLowerCase()}function k(e){return e===!1||e==null?e:a.isArray(e)?e.map(k):String(e)}function Jt(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const Vt=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function J(e,t,n,r,s){if(a.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!a.isString(t)){if(a.isString(r))return t.indexOf(r)!==-1;if(a.isRegExp(r))return r.test(t)}}function Wt(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function Kt(e,t){const n=a.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(s,o,i){return this[r].call(this,t,s,o,i)},configurable:!0})})}class v{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function o(c,p,h){const u=B(p);if(!u)throw new Error("header name must be a non-empty string");const l=a.findKey(s,u);(!l||s[l]===void 0||h===!0||h===void 0&&s[l]!==!1)&&(s[l||p]=k(c))}const i=(c,p)=>a.forEach(c,(h,u)=>o(h,u,p));return a.isPlainObject(t)||t instanceof this.constructor?i(t,n):a.isString(t)&&(t=t.trim())&&!Vt(t)?i(zt(t),n):t!=null&&o(n,t,r),this}get(t,n){if(t=B(t),t){const r=a.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return Jt(s);if(a.isFunction(n))return n.call(this,s,r);if(a.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=B(t),t){const r=a.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||J(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function o(i){if(i=B(i),i){const c=a.findKey(r,i);c&&(!n||J(r,r[c],c,n))&&(delete r[c],s=!0)}}return a.isArray(t)?t.forEach(o):o(t),s}clear(t){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const o=n[r];(!t||J(this,this[o],o,t,!0))&&(delete this[o],s=!0)}return s}normalize(t){const n=this,r={};return a.forEach(this,(s,o)=>{const i=a.findKey(r,o);if(i){n[i]=k(s),delete n[o];return}const c=t?Wt(o):String(o).trim();c!==o&&delete n[o],n[c]=k(s),r[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return a.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&a.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` -`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[pe]=this[pe]={accessors:{}}).accessors,s=this.prototype;function o(i){const c=B(i);r[c]||(Kt(s,i),r[c]=!0)}return a.isArray(t)?t.forEach(o):o(t),this}}v.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);a.reduceDescriptors(v.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});a.freezeMethods(v);const A=v;function V(e,t){const n=this||se,r=t||n,s=A.from(r.headers);let o=r.data;return a.forEach(e,function(c){o=c.call(n,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function je(e){return!!(e&&e.__CANCEL__)}function U(e,t,n){m.call(this,e??"canceled",m.ERR_CANCELED,t,n),this.name="CanceledError"}a.inherits(U,m,{__CANCEL__:!0});function Gt(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new m("Request failed with status code "+n.status,[m.ERR_BAD_REQUEST,m.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}const Xt=R.hasStandardBrowserEnv?{write(e,t,n,r,s,o){const i=[e+"="+encodeURIComponent(t)];a.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),a.isString(r)&&i.push("path="+r),a.isString(s)&&i.push("domain="+s),o===!0&&i.push("secure"),document.cookie=i.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Qt(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Zt(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}function Ie(e,t){return e&&!Qt(t)?Zt(e,t):t}const Yt=R.hasStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");let r;function s(o){let i=o;return t&&(n.setAttribute("href",i),i=n.href),n.setAttribute("href",i),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return r=s(window.location.href),function(i){const c=a.isString(i)?s(i):i;return c.protocol===r.protocol&&c.host===r.host}}():function(){return function(){return!0}}();function en(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function tn(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,o=0,i;return t=t!==void 0?t:1e3,function(p){const h=Date.now(),u=r[o];i||(i=h),n[s]=p,r[s]=h;let l=o,b=0;for(;l!==s;)b+=n[l++],l=l%e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),h-i{const o=s.loaded,i=s.lengthComputable?s.total:void 0,c=o-n,p=r(c),h=o<=i;n=o;const u={loaded:o,total:i,progress:i?o/i:void 0,bytes:c,rate:p||void 0,estimated:p&&i&&h?(i-o)/p:void 0,event:s};u[t?"download":"upload"]=!0,e(u)}}const nn=typeof XMLHttpRequest<"u",rn=nn&&function(e){return new Promise(function(n,r){let s=e.data;const o=A.from(e.headers).normalize();let{responseType:i,withXSRFToken:c}=e,p;function h(){e.cancelToken&&e.cancelToken.unsubscribe(p),e.signal&&e.signal.removeEventListener("abort",p)}let u;if(a.isFormData(s)){if(R.hasStandardBrowserEnv||R.hasStandardBrowserWebWorkerEnv)o.setContentType(!1);else if((u=o.getContentType())!==!1){const[d,...E]=u?u.split(";").map(w=>w.trim()).filter(Boolean):[];o.setContentType([d||"multipart/form-data",...E].join("; "))}}let l=new XMLHttpRequest;if(e.auth){const d=e.auth.username||"",E=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.set("Authorization","Basic "+btoa(d+":"+E))}const b=Ie(e.baseURL,e.url);l.open(e.method.toUpperCase(),_e(b,e.params,e.paramsSerializer),!0),l.timeout=e.timeout;function S(){if(!l)return;const d=A.from("getAllResponseHeaders"in l&&l.getAllResponseHeaders()),w={data:!i||i==="text"||i==="json"?l.responseText:l.response,status:l.status,statusText:l.statusText,headers:d,config:e,request:l};Gt(function(T){n(T),h()},function(T){r(T),h()},w),l=null}if("onloadend"in l?l.onloadend=S:l.onreadystatechange=function(){!l||l.readyState!==4||l.status===0&&!(l.responseURL&&l.responseURL.indexOf("file:")===0)||setTimeout(S)},l.onabort=function(){l&&(r(new m("Request aborted",m.ECONNABORTED,e,l)),l=null)},l.onerror=function(){r(new m("Network Error",m.ERR_NETWORK,e,l)),l=null},l.ontimeout=function(){let E=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const w=e.transitional||Ue;e.timeoutErrorMessage&&(E=e.timeoutErrorMessage),r(new m(E,w.clarifyTimeoutError?m.ETIMEDOUT:m.ECONNABORTED,e,l)),l=null},R.hasStandardBrowserEnv&&(c&&a.isFunction(c)&&(c=c(e)),c||c!==!1&&Yt(b))){const d=e.xsrfHeaderName&&e.xsrfCookieName&&Xt.read(e.xsrfCookieName);d&&o.set(e.xsrfHeaderName,d)}s===void 0&&o.setContentType(null),"setRequestHeader"in l&&a.forEach(o.toJSON(),function(E,w){l.setRequestHeader(w,E)}),a.isUndefined(e.withCredentials)||(l.withCredentials=!!e.withCredentials),i&&i!=="json"&&(l.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&l.addEventListener("progress",he(e.onDownloadProgress,!0)),typeof e.onUploadProgress=="function"&&l.upload&&l.upload.addEventListener("progress",he(e.onUploadProgress)),(e.cancelToken||e.signal)&&(p=d=>{l&&(r(!d||d.type?new U(null,e,l):d),l.abort(),l=null)},e.cancelToken&&e.cancelToken.subscribe(p),e.signal&&(e.signal.aborted?p():e.signal.addEventListener("abort",p)));const f=en(b);if(f&&R.protocols.indexOf(f)===-1){r(new m("Unsupported protocol "+f+":",m.ERR_BAD_REQUEST,e));return}l.send(s||null)})},X={http:Lt,xhr:rn};a.forEach(X,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const me=e=>`- ${e}`,sn=e=>a.isFunction(e)||e===null||e===!1,Me={getAdapter:e=>{e=a.isArray(e)?e:[e];const{length:t}=e;let n,r;const s={};for(let o=0;o`adapter ${c} `+(p===!1?"is not supported by the environment":"is not available in the build"));let i=t?o.length>1?`since : -`+o.map(me).join(` -`):" "+me(o[0]):"as no adapter specified";throw new m("There is no suitable adapter to dispatch the request "+i,"ERR_NOT_SUPPORT")}return r},adapters:X};function W(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new U(null,e)}function ye(e){return W(e),e.headers=A.from(e.headers),e.data=V.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Me.getAdapter(e.adapter||se.adapter)(e).then(function(r){return W(e),r.data=V.call(e,e.transformResponse,r),r.headers=A.from(r.headers),r},function(r){return je(r)||(W(e),r&&r.response&&(r.response.data=V.call(e,e.transformResponse,r.response),r.response.headers=A.from(r.response.headers))),Promise.reject(r)})}const be=e=>e instanceof A?e.toJSON():e;function P(e,t){t=t||{};const n={};function r(h,u,l){return a.isPlainObject(h)&&a.isPlainObject(u)?a.merge.call({caseless:l},h,u):a.isPlainObject(u)?a.merge({},u):a.isArray(u)?u.slice():u}function s(h,u,l){if(a.isUndefined(u)){if(!a.isUndefined(h))return r(void 0,h,l)}else return r(h,u,l)}function o(h,u){if(!a.isUndefined(u))return r(void 0,u)}function i(h,u){if(a.isUndefined(u)){if(!a.isUndefined(h))return r(void 0,h)}else return r(void 0,u)}function c(h,u,l){if(l in t)return r(h,u);if(l in e)return r(void 0,h)}const p={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:c,headers:(h,u)=>s(be(h),be(u),!0)};return a.forEach(Object.keys(Object.assign({},e,t)),function(u){const l=p[u]||s,b=l(e[u],t[u],u);a.isUndefined(b)&&l!==c||(n[u]=b)}),n}const qe="1.6.2",oe={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{oe[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Ee={};oe.transitional=function(t,n,r){function s(o,i){return"[Axios v"+qe+"] Transitional option '"+o+"'"+i+(r?". "+r:"")}return(o,i,c)=>{if(t===!1)throw new m(s(i," has been removed"+(n?" in "+n:"")),m.ERR_DEPRECATED);return n&&!Ee[i]&&(Ee[i]=!0,console.warn(s(i," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(o,i,c):!0}};function on(e,t,n){if(typeof e!="object")throw new m("options must be an object",m.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const o=r[s],i=t[o];if(i){const c=e[o],p=c===void 0||i(c,o,e);if(p!==!0)throw new m("option "+o+" must be "+p,m.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new m("Unknown option "+o,m.ERR_BAD_OPTION)}}const Q={assertOptions:on,validators:oe},L=Q.validators;class I{constructor(t){this.defaults=t,this.interceptors={request:new de,response:new de}}request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=P(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:o}=n;r!==void 0&&Q.assertOptions(r,{silentJSONParsing:L.transitional(L.boolean),forcedJSONParsing:L.transitional(L.boolean),clarifyTimeoutError:L.transitional(L.boolean)},!1),s!=null&&(a.isFunction(s)?n.paramsSerializer={serialize:s}:Q.assertOptions(s,{encode:L.function,serialize:L.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=o&&a.merge(o.common,o[n.method]);o&&a.forEach(["delete","get","head","post","put","patch","common"],f=>{delete o[f]}),n.headers=A.concat(i,o);const c=[];let p=!0;this.interceptors.request.forEach(function(d){typeof d.runWhen=="function"&&d.runWhen(n)===!1||(p=p&&d.synchronous,c.unshift(d.fulfilled,d.rejected))});const h=[];this.interceptors.response.forEach(function(d){h.push(d.fulfilled,d.rejected)});let u,l=0,b;if(!p){const f=[ye.bind(this),void 0];for(f.unshift.apply(f,c),f.push.apply(f,h),b=f.length,u=Promise.resolve(n);l{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](s);r._listeners=null}),this.promise.then=s=>{let o;const i=new Promise(c=>{r.subscribe(c),o=c}).then(s);return i.cancel=function(){r.unsubscribe(o)},i},t(function(o,i,c){r.reason||(r.reason=new U(o,i,c),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}static source(){let t;return{token:new ie(function(s){t=s}),cancel:t}}}const an=ie;function cn(e){return function(n){return e.apply(null,n)}}function ln(e){return a.isObject(e)&&e.isAxiosError===!0}const Z={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Z).forEach(([e,t])=>{Z[t]=e});const un=Z;function He(e){const t=new j(e),n=ge(j.prototype.request,t);return a.extend(n,j.prototype,t,{allOwnKeys:!0}),a.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return He(P(e,s))},n}const y=He(se);y.Axios=j;y.CanceledError=U;y.CancelToken=an;y.isCancel=je;y.VERSION=qe;y.toFormData=$;y.AxiosError=m;y.Cancel=y.CanceledError;y.all=function(t){return Promise.all(t)};y.spread=cn;y.isAxiosError=ln;y.mergeConfig=P;y.AxiosHeaders=A;y.formToJSON=e=>ke(a.isHTMLForm(e)?new FormData(e):e);y.getAdapter=Me.getAdapter;y.HttpStatusCode=un;y.default=y;const N=y;class fn{constructor(){this.baseURL="https://your-energy.b.goit.study/api/",this.page=0}resetPage(){this.page=0}async getExercises(t,n){try{return this.page+=1,console.log(`${this.baseURL}exercises?${t}=${n}&page=1&limit=10`),(await N.get(`${this.baseURL}exercises?${t}=${n}&page=1&limit=10`)).data.results}catch(r){console.log(r)}}async getSearch(t,n,r){try{return this.page+=1,(await N.get(`${this.baseURL}exercises?${t}=${n}&keyword=${r}&page=1&limit=10`)).data.results}catch(s){console.log(s)}}async getExercisesById(t){try{return this.page+=1,(await N.get(`${this.baseURL}exercises/${t}`)).data}catch(n){console.log(n)}}async getFilter(t){try{return(await N.get(`${this.baseURL}filters?filter=${t}`)).data.results}catch(n){console.log(n)}}async getQuote(){try{return this.page+=1,(await N.get(`${this.baseURL}quote`)).data}catch(t){console.log(t)}}async patchRating(t,n){try{return this.page+=1,(await N.patch(`${this.baseURL}exercises/${t}/rating`,n)).data}catch(r){console.log(r)}}async postSubscriptions(t){try{return this.page+=1,(await N.post(`${this.baseURL}subscription`,t)).data}catch(n){console.log(n)}}}const dn=new fn,pn=document.querySelector(".modal-exercises");pn.addEventListener("click",hn);let we=[];async function hn(e){if(e.target.closest(".modal-exercises__btn-favorites"))try{const t=e.target.closest(".modal-exercises__btn-favorites").getAttribute("data-id"),n=await dn.getExercisesById(t),r=JSON.parse(localStorage.getItem("exerciseData"));if(r!=null&&r.some(s=>s._id===n._id))return;we.push(n),localStorage.setItem("exerciseData",JSON.stringify(we))}catch(t){console.log(t)}}const mn="/your-energy/assets/sprite-d1b8f2c8.svg";export{fn as A,N as a,mn as i}; diff --git a/favorites.html b/favorites.html index dc0928a..90fe66c 100644 --- a/favorites.html +++ b/favorites.html @@ -14,9 +14,9 @@ /> Your Energy - - - + + +
    @@ -208,7 +208,7 @@

    10 mins

    -
      +
      • It appears that you haven't added any exercises to your favorites yet. To get started, you can add exercises that you like to your @@ -297,5 +297,6 @@

        10 mins

        + diff --git a/index.html b/index.html index 5620cf8..5491d81 100644 --- a/index.html +++ b/index.html @@ -14,9 +14,9 @@ /> Your Energy - - - + + +