1(this["webpackJsonprecipes-app-test"]=this["webpackJsonprecipes-app-test"]||[]).push([[0],[,,,,,,,function(e,t,a){"use strict";a.d(t,"b",(function(){return n})),a.d(t,"c",(function(){return r})),a.d(t,"d",(function(){return c})),a.d(t,"e",(function(){return i})),a.d(t,"a",(function(){return s}));var n=11,r=5,c=3,i=12,s=2e3},,function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(1),r=a.n(n),c=a(3);function i(e){return s.apply(this,arguments)}function s(){return(s=Object(c.a)(r.a.mark((function e(t){var a,n;return r.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch(t);case 2:return a=e.sent,e.next=5,a.json();case 5:return n=e.sent,e.abrupt("return",n);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}},function(e,t,a){"use strict";var n=a(0),r=Object(n.createContext)();t.a=r},function(e,t,a){"use strict";(function(e){var n=a(1),r=a.n(n),c=a(3),i=a(2),s=a(0),o=a.n(s),l=a(8),u=a(10),d=a(44),m=a.n(d),p=a(45),f=a.n(p),h=a(13),b=a(17);a(65);t.a=function(t){var a=t.title,n=t.isRender,d=t.classes,p=Object(s.useState)(""),g=Object(i.a)(p,2),v=g[0],E=g[1],O=Object(s.useState)(!1),j=Object(i.a)(O,2),k=j[0],y=j[1],N=Object(s.useContext)(u.a),S=N.setMeals,I=N.setDrinks,x=Object(s.useState)(!1),w=Object(i.a)(x,2),C=w[0],R=w[1],T=Object(s.useState)(!1),P=Object(i.a)(T,2),B=P[0],M=P[1],D=Object(s.useState)(!1),J=Object(i.a)(D,2),A=J[0],L=J[1],F=Object(s.useState)(""),z=Object(i.a)(F,2),_=z[0],G=z[1],H=Object(l.f)();function U(e){var t=e.target;G(t.id)}function Y(){return(Y=Object(c.a)(r.a.mark((function t(){return r.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("/comidas"!==H.location.pathname){t.next=5;break}if(!(v.length>1&&"FIRST_LETTER"===_)){t.next=3;break}return t.abrupt("return",e.alert("Sua busca deve conter somente 1 (um) caracter"));case 3:(function(){var e=Object(c.a)(r.a.mark((function e(){var t;return r.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(h.a)(_,v);case 2:t=e.sent,S(t.meals);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}})()();case 5:if("/bebidas"!==H.location.pathname){t.next=10;break}if(!(v.length>1&&"FIRST_LETTER"===_)){t.next=8;break}return t.abrupt("return",e.alert("Sua busca deve conter somente 1 (um) caracter"));case 8:(function(){var e=Object(c.a)(r.a.mark((function e(){var t;return r.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(b.a)(_,v);case 2:t=e.sent,I(t.drinks);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}})()();case 10:case"end":return t.stop()}}),t)})))).apply(this,arguments)}return o.a.createElement("div",null,o.a.createElement("header",null,o.a.createElement("div",{className:d.headerProfilerContainer},o.a.createElement("input",{type:"image","data-testid":"profile-top-btn",src:m.a,alt:"profileIcon",onClick:function(){H.push("/perfil")},className:d.profileIcon}),o.a.createElement("div",{className:d.headerTitleContainer},o.a.createElement("h1",{"data-testid":"page-title",className:d.headerTitle},a)),n&&o.a.createElement("input",{"data-testid":"search-top-btn",type:"image",src:f.a,alt:"searchIcon",onClick:function(){return y(!k)},className:d.searchIcon})),k&&o.a.createElement("div",{className:d.searchContainer},o.a.createElement("div",{className:d.headerSearchIn\u1e55utContainer},o.a.createElement("input",{className:d.headerSearchInput,"data-testid":"search-input",type:"text",value:v,onChange:function(e){var t=e.target;return E(t.value)},placeholder:"Digitie alguma receita..."})),o.a.createElement("div",{className:d.radioBtnsContainer},o.a.createElement("label",{className:d.radioButtons,htmlFor:"INGREDIENT"},o.a.createElement("input",{className:d.radioButtons,name:"radio-button","data-testid":"ingredient-search-radio",id:"INGREDIENT",type:"radio",checked:C,onClick:function(){return R(!C)},onChange:U}),"Ingrediente"),o.a.createElement("label",{className:d.radioButtons,htmlFor:"NAME"},o.a.createElement("input",{name:"radio-button","data-testid":"name-search-radio",id:"NAME",type:"radio",checked:B,onClick:function(){return M(!B)},onChange:U}),"Nome"),o.a.createElement("label",{className:d.radioButtons,htmlFor:"FIRST_LETTER"},o.a.createElement("input",{name:"radio-button","data-testid":"first-letter-search-radio",id:"FIRST_LETTER",type:"radio",checked:A,onClick:function(){return L(!A)},onChange:U}),"Primeira letra")),o.a.createElement("div",{className:d.headerSearchButton},o.a.createElement("button",{className:d.headerSearchButton,"data-testid":"exec-search-btn",type:"button",onClick:function(){return Y.apply(this,arguments)}},"Buscar")))))}}).call(this,a(28))},,function(e,t,a){"use strict";a.d(t,"a",(function(){return v}));var n=a(1),r=a.n(n),c=a(3),i=a(9),s="https://www.themealdb.com/api/json/v1/1/search.php?s=",o="https://www.themealdb.com/api/json/v1/1/search.php?f=",l="https://www.themealdb.com/api/json/v1/1/filter.php?i=",u="https://www.themealdb.com/api/json/v1/1/list.php?i=list",d="https://www.themealdb.com/api/json/v1/1/list.php?a=list",m="https://www.themealdb.com/api/json/v1/1/filter.php?a=",p="https://www.themealdb.com/api/json/v1/1/random.php",f="https://www.themealdb.com/api/json/v1/1/search.php?s=",h="https://www.themealdb.com/api/json/v1/1/list.php?c=list",b="https://www.themealdb.com/api/json/v1/1/filter.php?c=",g="https://www.themealdb.com/api/json/v1/1/lookup.php?i=";function v(e,t){return E.apply(this,arguments)}function E(){return(E=Object(c.a)(r.a.mark((function e(t,a){return r.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=t,e.next="INGREDIENT"===e.t0?3:"allIngredients"===e.t0?4:"NAME"===e.t0?5:"FIRST_LETTER"===e.t0?6:"random"===e.t0?7:"area"===e.t0?8:"BYAREA"===e.t0?9:"ALL"===e.t0?10:"GET_CATEGORIES"===e.t0?11:"CATEGORIES"===e.t0?12:"ID"===e.t0?13:14;break;case 3:return e.abrupt("return",Object(i.a)("".concat(l).concat(a)));case 4:return e.abrupt("return",Object(i.a)("".concat(u)));case 5:return e.abrupt("return",Object(i.a)("".concat(s).concat(a.split(" ").splice("_"))));case 6:return e.abrupt("return",Object(i.a)("".concat(o).concat(a)));case 7:return e.abrupt("return",Object(i.a)("".concat(p)));case 8:return e.abrupt("return",Object(i.a)("".concat(m).concat(a)));case 9:return e.abrupt("return",Object(i.a)("".concat(d)));case 10:return e.abrupt("return",Object(i.a)("".concat(f)));case 11:return e.abrupt("return",Object(i.a)("".concat(h)));case 12:return e.abrupt("return",Object(i.a)("".concat(b).concat(a)));case 13:return e.abrupt("return",Object(i.a)("".concat(g).concat(a)));case 14:return e.abrupt("break",15);case 15:case"end":return e.stop()}}),e)})))).apply(this,arguments)}},,,,function(e,t,a){"use strict";a.d(t,"a",(function(){return b}));var n=a(1),r=a.n(n),c=a(3),i=a(9),s="https://www.thecocktaildb.com/api/json/v1/1/search.php?s=",o="https://www.thecocktaildb.com/api/json/v1/1/search.php?s=",l="https://www.thecocktaildb.com/api/json/v1/1/search.php?f=",u="https://www.thecocktaildb.com/api/json/v1/1/filter.php?i=",d="https://www.thecocktaildb.com/api/json/v1/1/list.php?i=list",m="https://www.thecocktaildb.com/api/json/v1/1/random.php",p="https://www.thecocktaildb.com/api/json/v1/1/list.php?c=list",f="https://www.thecocktaildb.com/api/json/v1/1/filter.php?c=",h="https://www.thecocktaildb.com/api/json/v1/1/lookup.php?i=";function b(e,t){return g.apply(this,arguments)}function g(){return(g=Object(c.a)(r.a.mark((function e(t,a){return r.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=t,e.next="INGREDIENT"===e.t0?3:"allIngredients"===e.t0?4:"NAME"===e.t0?5:"FIRST_LETTER"===e.t0?6:"RANDOM"===e.t0?7:"ALL"===e.t0?8:"GET_CATEGORIES"===e.t0?9:"CATEGORIES"===e.t0?10:"ID"===e.t0?11:12;break;
1case 3:return e.abrupt("return",Object(i.a)("".concat(u).concat(a)));case 4:return e.abrupt("return",Object(i.a)("".concat(d)));case 5:return e.abrupt("return",Object(i.a)("".concat(o).concat(a.split(" ").splice("_"))));case 6:return e.abrupt("return",Object(i.a)("".concat(l).concat(a)));case 7:return e.abrupt("return",Object(i.a)("".concat(m)));case 8:return e.abrupt("return",Object(i.a)("".concat(s)));case 9:return e.abrupt("return",Object(i.a)("".concat(p)));case 10:return e.abrupt("return",Object(i.a)("".concat(f).concat(a)));case 11:return e.abrupt("return",Object(i.a)("".concat(h).concat(a)));case 12:return e.abrupt("break",13);case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}},,,,function(e,t,a){e.exports=a.p+"static/media/shareIcon.06215ed4.svg"},function(e,t,a){e.exports=a.p+"static/media/blackHeartIcon.b8913346.svg"},,function(e,t,a){e.exports=a.p+"static/media/whiteHeartIcon.ea3b6ba8.svg"},,,,,,,,,function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},,,,,function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){e.exports=a.p+"static/media/profileIcon.74e487e5.svg"},function(e,t,a){e.exports=a.p+"static/media/searchIcon.db812135.svg"},,,,,,,function(e,t,a){"use strict";(function(e){var n=a(0),r=a.n(n),c=a(8),i=a(6),s=a(10),o=a(7);a(35),a(33);t.a=function(t){var a=t.data,l=t.classes,u=Object(n.useContext)(s.a).drinks,d=Object(c.f)(),m=a.isRecommendation,p=a.size;return console.log(m),function(){if(null===u)return e.alert("Sinto muito, n\xe3o encontramos nenhuma receita para esses filtros.");if(1===u.length&&Object.keys(u[0]).length!==o.d){var t=u[0].idDrink;return d.push("/bebidas/".concat(t))}return function(){var e=u.filter((function(e,t){return t<=p}));return r.a.createElement("div",{className:"cards-container"},e.map((function(e,t){var a=e.idDrink,n=e.strDrinkThumb,c=e.strDrink;return r.a.createElement(i.b,{to:"/bebidas/".concat(a),key:a},m?r.a.createElement("div",{"data-testid":"".concat(t,"-recomendation-card"),className:0!==l.length?l:"cards"},r.a.createElement("img",{className:"card-container-drinks","data-testid":"".concat(t,"-card-img"),style:{height:"5em"},src:n,alt:c}),r.a.createElement("p",{className:"centering","data-testid":"".concat(t,"-recomendation-title")},c)):r.a.createElement("div",{className:"card-container-drinks","data-testid":"".concat(t,"-recipe-card")},r.a.createElement("img",{className:"cards","data-testid":"".concat(t,"-card-img"),style:{height:"5em"},src:n,alt:c}),r.a.createElement("div",{className:"card-title"},r.a.createElement("p",{className:"card-text","data-testid":"".concat(t,"-card-name")},c))))})))}()}()}}).call(this,a(28))},function(e,t,a){e.exports=a.p+"static/media/drinkIcon.f87c47c3.svg"},function(e,t,a){e.exports=a.p+"static/media/exploreIcon.157945ff.svg"},function(e,t,a){e.exports=a.p+"static/media/mealIcon.b27ba19e.svg"},function(e,t,a){"use strict";(function(e){var n=a(0),r=a.n(n),c=a(8),i=a(6),s=a(10),o=a(7);a(35);t.a=function(t){var a=t.data,l=Object(n.useContext)(s.a).meals,u=Object(c.f)(),d=a.isRecommendation,m=a.size;return console.log(d),function(){if(null===l)return e.alert("Sinto muito, n\xe3o encontramos nenhuma receita para esses filtros.");if(1===l.length&&Object.keys(l[0]).length!==o.d){var t=l[0].idMeal;return u.push("/comidas/".concat(t))}return function(){var e=l.filter((function(e,t){return t<=m}));return r.a.createElement("div",{className:"cards-container"},e.map((function(e,t){var a=e.idMeal,n=e.strMealThumb,c=e.strMeal;return r.a.createElement(i.b,{to:"/comidas/".concat(a),key:a},d?r.a.createElement("div",{"data-testid":"".concat(t,"-recomendation-card"),className:"cards"},r.a.createElement("img",{"data-testid":"".concat(t,"-card-img"),style:{height:"5em"},src:n,alt:c}),r.a.createElement("p",{"data-testid":"".concat(t,"-recomendation-title")},c)):r.a.createElement("div",{className:"card-container","data-testid":"".concat(t,"-recipe-card")},r.a.createElement("img",{className:"cards","data-testid":"".concat(t,"-card-img"),src:n,alt:c}),r.a.createElement("div",{className:"card-title"},r.a.createElement("p",{className:"card-text","data-testid":"".concat(t,"-card-name")},c))))})))}()}()}}).call(this,a(28))},,function(e,t,a){e.exports=a(90)},,,,,,,function(e,t,a){},,,,,,,,,,,,,,,,,,,,function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){"use strict";a.r(t);var n=a(0),r=a.n(n),c=a(25),i=a.n(c),s=a(6),o=(a(63),a(1)),l=a.n(o),u=a(3),d=a(2),m=a(10),p=a(13),f=a(17);function h(){return b.apply(this,arguments)}function b(){return(b=Object(u.a)(l.a.mark((function e(){var t,a;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"https://www.themealdb.com/api/json/v1/1/list.php?c=list",e.next=3,fetch("https://www.themealdb.com/api/json/v1/1/list.php?c=list");case 3:return t=e.sent,e.next=6,t.json();case 6:return a=e.sent,e.abrupt("return",a);case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function g(){return v.apply(this,arguments)}function v(){return(v=Object(u.a)(l.a.mark((function e(){var t,a;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"https://www.thecocktaildb.com/api/json/v1/1/list.php?c=list",e.next=3,fetch("https://www.thecocktaildb.com/api/json/v1/1/list.php?c=list");case 3:return t=e.sent,e.next=6,t.json();case 6:return a=e.sent,e.abrupt("return",a);case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var E=function(e){var t=e.children,a=Object(n.useState)([]),c=Object(d.a)(a,2),i=c[0],s=c[1],o=Object(n.useState)([]),b=Object(d.a)(o,2),v=b[0],E=b[1],O=Object(n.useState)([]),j=Object(d.a)(O,2),k=j[0],y=j[1],N=Object(n.useState)([]),S=Object(d.a)(N,2),I=S[0],x=S[1],w=Object(n.useState)([]),C=Object(d.a)(w,2),R=C[0],T=C[1],P=Object(n.useState)(!1),B=Object(d.a)(P,2),M=B[0],D=B[1],J=Object(n.useState)(""),A=Object(d.a)(J,2),L=A[0],F=A[1],z=Object(n.useState)([]),_=Object(d.a)(z,2),G=_[0],H=_[1],U=Object(n.useState)({meals:{},cocktails:{}}),Y=Object(d.a)(U,2),K=Y[0],V=Y[1],W=Object(n.useState)([]),$=Object(d.a)(W,2),q=$[0],Q=$[1],X={meals:i,setMeals:s,drinks:v,setDrinks:E,result:k,setResult:y,mealsCategories:I,setMealsCategories:x,drinksCategories:R,setDrinksCategories:T,toggle:M,setToggle:D,cat:L,setCat:F,doneRecipes:G,setDoneRecipes:H,inProgress:K,setInProgress:V,favorites:q,setFavorites:Q};return Object(n.useEffect)((function(){(function(){var e=Object(u.a)(l.a.mark((function e(){var t,a;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,h();case 2:return t=e.sent,e.next=5,g();case 5:a=e.sent,x(t.meals),T(a.drinks);case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}})()()}),[]),Object(n.useEffect)((function(){(function(){var e=Object(u.a)(l.a.mark((function e(){var t;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(p.a)("ALL");case 2:t=e.sent,s(t.meals);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}})()()}),[]),Object(n.useEffect)((function(){(function(){var e=Object(u.a)(l.a.mark((function e(){var t;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(f.a)("ALL");case 2:t=e.sent,E(t.drinks);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}})()()}),[]),Object(n.useEffect)((function(){localStorage.doneRecipes?H(JSON.parse(localStorage.doneRecipes)):localStorage.setItem("doneRecipes",JSON.stringify(G))}),[]),Object(n.useEffect)((function(){localStorage.inProgressRecipes?V(JSON.parse(localStorage.inProgressRecipes)):localStorage.setItem("inProgressRecipes",JSON.stringify(K))}),[]),Object(n.useEffect)((function(){localStorage.favoriteRecipes?Q(JSON.parse(localStorage.favoriteRecipes)):localStorage.setItem("favoriteRecipes",JSON.stringify(q))}),[]),r.a.createElement(m.a.Provider,{value:X},t)},O=a(8),j=a(20),k=a.n(j);var y=function(e){var t=e.setFilterType;function a(e){t(e)}return r.a.createElement("div",{className:"user-options"},r.a.createElement("button",{type:"button","data-testid":"filter-by-all-btn",onClick:function(){t("")}},"All"),r.a.createElement("button",{type:"button","data-testid":"filter-by-food-btn",onClick:function(){return a("comida")}},"Food"),r.a.createElement("button",{type:"button","data-testid":"filter-by-drink-btn",onClick:function(){return a("bebida")}},"Drinks"))},N=a(11),S=a(7),I=a(21),x=a.n(I),w=(a(41),{headerProfilerContainer:"profile-header header-profile-container",profileIcon:"profile-profile-icon",headerTitleContainer:"done-recipes-title-container",headerTitle:"header-name header-title-profile",searchIcon:"search-icon",searchContainer:"search-field","headerSearchIn\u1e55utContainer":"header-search-input-container",headerSearchInput:"header-search-input form-label",radioBtnsContainer:"radius-btns-field",radioButtons:"radio-btn",headerSearchButton:"header-search-btn"});
1var C=function(){var e=Object(n.useState)([]),t=Object(d.a)(e,2),a=t[0],c=t[1],i=Object(n.useState)(!1),o=Object(d.a)(i,2),l=o[0],u=o[1],m=Object(n.useState)(""),p=Object(d.a)(m,2),f=p[0],h=p[1];return console.log(a),Object(n.useEffect)((function(){c((function(){return localStorage.getItem("doneRecipes")?JSON.parse(localStorage.getItem("doneRecipes")):[]}))}),[]),r.a.createElement("div",{className:"done-recipes-body"},r.a.createElement(N.a,{title:"Receitas Feitas",isRender:!1,classes:w}),r.a.createElement(y,{setFilterType:h}),r.a.createElement("div",{className:"done-recipes-container"},a.filter((function(e){return e.type.includes(f)})).map((function(e,t){return r.a.createElement("div",{className:"done-recipe-card-container",key:e.id},r.a.createElement(s.b,{to:"".concat(e.type,"s/").concat(e.id)},r.a.createElement("img",{width:"150px",className:"done-recipe-img","data-testid":"".concat(t,"-horizontal-image"),src:e.image,alt:e.name})),"comida"===e.type&&r.a.createElement("p",{"data-testid":"".concat(t,"-horizontal-top-text")},"".concat(e.area," - ").concat(e.category)),"bebida"===e.type&&r.a.createElement("p",{"data-testid":"".concat(t,"-horizontal-top-text")},"".concat(e.alcoholicOrNot)),r.a.createElement("div",null,r.a.createElement(s.b,{to:"".concat(e.type,"s/").concat(e.id)},r.a.createElement("h3",{className:"done-recipe-title","data-testid":"".concat(t,"-horizontal-name")},e.name))),r.a.createElement("p",{"data-testid":"".concat(t,"-horizontal-done-date")},"Feita em:"," ",e.doneDate),l?r.a.createElement("span",null,"Link copiado!"):r.a.createElement("input",{type:"image",src:x.a,alt:"shareIcon","data-testid":"".concat(t,"-horizontal-share-btn"),onClick:function(){return function(e){var t="http://localhost:3000/".concat(e);k()(t),u(!0),setTimeout((function(){u(!1)}),S.a)}("".concat(e.type,"s/").concat(e.id))}}),e.tags.slice(0,2).map((function(e,a){return r.a.createElement("div",{key:"".concat(e,"-").concat(a)},r.a.createElement("span",{"data-testid":"".concat(t,"-").concat(e,"-horizontal-tag")},e))})))}))))},R=a(19),T=a(15),P=a(14),B=a(32),M=a(92),D=a(24),J=a.n(D),A=a(22),L=a.n(A);var F=function(e){var t=e.data,a=Object(n.useContext)(m.a),c=a.favorites,i=a.setFavorites,s=t.type,o=Object(n.useState)(!1),l=Object(d.a)(o,2),u=l[0],p=l[1],f=function(e){return"comida"===e.type?e.recipe.idMeal:e.recipe.idDrink}(t);return r.a.createElement("div",{className:"details-buttons-container"},r.a.createElement("div",{className:"details-fav-btn-container"},r.a.createElement("button",{type:"button",onClick:function(){if("comida"===s){var e=t.recipe,a=e.idMeal,n=e.strArea,r=e.strCategory,o=e.strMeal,l=e.strMealThumb,u={id:a,type:s,area:n,category:r,alcoholicOrNot:"",name:o,image:l};if(c.some((function(e){return e.id===a}))){var d=c.filter((function(e){return e.id!==a}));i(d);var m=d;localStorage.setItem("favoriteRecipes",JSON.stringify(m))}else{i([].concat(Object(P.a)(c),[u]));var p=[].concat(Object(P.a)(c),[u]);localStorage.setItem("favoriteRecipes",JSON.stringify(p))}}else{var f=t.recipe,h=f.idDrink,b=f.strDrink,g=f.strCategory,v=f.strDrinkThumb,E=f.strAlcoholic,O={id:h,type:s,area:"",category:g,alcoholicOrNot:E,name:b,image:v},j=c.some((function(e){return e.id===h}));if(console.log(j),j){var k=c.filter((function(e){return e.id!==h}));i(k);var y=k;localStorage.setItem("favoriteRecipes",JSON.stringify(y))}else{i([].concat(Object(P.a)(c),[O]));var N=[].concat(Object(P.a)(c),[O]);localStorage.setItem("favoriteRecipes",JSON.stringify(N))}}},className:"details-fav-btn"},r.a.createElement("img",{src:function(){if("comida"===s){var e=t.recipe.idMeal;return c.some((function(t){return t.id===e}))}var a=t.recipe.idDrink;return c.some((function(e){return e.id===a}))}()?L.a:J.a,alt:"blackHeartIcon","data-testid":"favorite-btn"}))),u?r.a.createElement("span",null,"Link copiado!"):r.a.createElement("div",{className:"details-share-btn-container"},r.a.createElement("input",{className:"details-share-btn",type:"image",src:x.a,alt:"shareIcon","data-testid":"share-btn",onClick:function(){return function(e){var t="http://localhost:3000/".concat(e);k()(t),p(!0),setTimeout((function(){p(!1)}),S.a)}("".concat(s,"s/").concat(f))}})))};a(42);var z=function(e){var t=e.img,a=e.title;return r.a.createElement("div",{className:"img-title-container"}
1,r.a.createElement("div",{className:"detailts-image-container"},r.a.createElement("img",{className:"details-image","data-testid":"recipe-photo",src:t,alt:"mealImage"})),r.a.createElement("div",{className:"details-title-container"},r.a.createElement("h1",{className:"details-title","data-testid":"recipe-title"},a)))};var _=function(e){var t=e.ingredients;return r.a.createElement("div",null,r.a.createElement("h1",{className:"details-ingredient-title"},"Ingredients"),r.a.createElement("div",{className:"details-ingredients-container"},t.map((function(e,t){return!1!==e&&r.a.createElement("ul",{className:"details-list",key:t,"data-testid":"".concat(t,"-ingredient-name-and-measure")},r.a.createElement("li",null,e))}))))},G=a(9);a(33);var H=function(e){var t=e.match,a=Object(n.useState)([]),c=Object(d.a)(a,2),i=c[0],o=c[1],p=Object(n.useContext)(m.a),f=p.doneRecipes,h=p.setDoneRecipes,b=p.inProgress,g=p.setInProgress,v=p.meals,E=t.params.id;if(Object(n.useEffect)((function(){(function(){var e=Object(u.a)(l.a.mark((function e(){var t;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(G.a)("https://www.thecocktaildb.com/api/json/v1/1/lookup.php?i=".concat(E));case 2:t=e.sent,o(t);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}})()()}),[E,f]),0===i.length)return null;var O=i.drinks,j=O[0],k=j.strDrinkThumb,y=j.strDrink,N=j.strCategory,S=j.strInstructions,I=j.idDrink,x=j.strArea,w=j.dateModified,C=j.strTags,D=j.strYoutube,J=j.strAlcoholic,A={id:I,type:"bebida",area:x,category:N,alcoholicOrNot:"",name:y,image:k,doneDate:w,tags:[C]},L=Object.keys(O[0]).indexOf("strIngredient1"),H=Object.values(O[0]).splice(L).slice(0,15),U=Object.keys(O[0]).indexOf("strMeasure1"),Y=Object.values(O[0]).slice(U).slice(0,15),K=H.map((function(e,t){return null!==e&&0!==e.length&&e.concat(" - ",Y[t])})),V=b.cocktails,W={recipe:O[0],type:"bebida"};return r.a.createElement("div",{className:"meals-details-body"},r.a.createElement(z,{img:k,title:y}),r.a.createElement(F,{data:W}),r.a.createElement("h3",{className:"details-category","data-testid":"recipe-category"},J),r.a.createElement("h3",{className:"details-category","data-testid":"recipe-category"},N),r.a.createElement(_,{ingredients:K}),r.a.createElement("h1",{className:"details-ingredient-title"},"Instructions"),r.a.createElement("div",{className:"details-ingredients-container"},r.a.createElement("h4",{className:"details-list","data-testid":"instructions"},S)),r.a.createElement("h1",{className:"details-ingredient-title"}," Video "),r.a.createElement("div",{className:"details-video-container","data-testid":"video"},null!==D&&r.a.createElement("div",null,r.a.createElement(B.a,{className:"details-video",videoId:function(e){var t=e.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/);return t&&11===t[2].length?t[2]:null}("".concat(D))}))),r.a.createElement("div",{className:"carousel-container"},r.a.createElement(M.a,null,v.slice(0,6).map((function(e,t){return r.a.createElement(M.a.Item,{className:"carousel-item",key:t},r.a.createElement(s.b,{to:"/comidas/".concat(e.idMeal),key:t},r.a.createElement("img",{className:"d-block w-100 carousel-img",src:e.strMealThumb,alt:"First slide"}),r.a.createElement(M.a.Caption,{className:"caption-container"},r.a.createElement("h3",{className:"carousel-text"},e.strMeal))))})))),Object.keys(V).some((function(e){return e===I}))?r.a.createElement(s.b,{to:"/bebidas/".concat(E,"/in-progress")},r.a.createElement("button",{type:"button",className:"start-recipe-btn","data-testid":"start-recipe-btn",onClick:function(){var e=b.cocktails,t=Object(T.a)(Object(T.a)({},b),{},{cocktails:Object(T.a)(Object(T.a)({},e),{},Object(R.a)({},I,[]))});g(t),localStorage.setItem("inProgressRecipes",JSON.stringify(t))}},"Continuar Receita")):r.a.createElement(s.b,{to:"/bebidas/".concat(E,"/in-progress")},r.a.createElement("button",{className:"start-recipe-btn",type:"button",onClick:function(){h([].concat(Object(P.a)(f),[A]));var e=[].concat(Object(P.a)(f),[A]),t=b.cocktails,a=Object(T.a)(Object(T.a)({},b),{},{cocktails:Object(T.a)(Object(T.a)({},t),{},Object(R.a)({},I,[]))});g(a),localStorage.setItem("inProgressRecipes",JSON.stringify(a)),localStorage.setItem("doneRecipes",JSON.stringify(e))},"data-testid":"start-recipe-btn"},"Iniciar Receita")))};function U(e){return Object.keys(e).map((function(e){return e.includes("Ingredient")?e:""})).reduce((function(t,a){return e[a]&&""!==a&&""!==e[a]?[].concat(Object(P.a)(t),[e[a]]):t}),[])}a(34);function Y(e){var t=e.ingredient,a=e.index,n=e.ingredientsUsed,c=e.setIngredientsUsed,i=e.id,s=JSON.parse(localStorage.getItem("inProgressRecipes")).meals[Object(O.g)("id").id];return r.a.createElement("label",{htmlFor:"".concat(a,"-").concat(t),"data-testid":"".concat(a,"-ingredient-step")},r.a.createElement("input",{className:"radio-progress",type:"checkbox",id:"".concat(a,"-").concat(t),checked:s&&s.some((function(e){return e===t})),onChange:function(){if(n.some((function(e){return e===t}))){var e=n.filter((function(e){return e!==t}));c(Object(P.a)(e));var a=JSON.parse(localStorage.getItem("inProgressRecipes"));Object.assign(a.meals,Object(R.a)({},i,e)),localStorage.setItem("inProgressRecipes",JSON.stringify(a))}else{c([].concat(Object(P.a)(n),[t]));var r=JSON.parse(localStorage.getItem("inProgressRecipes"));Object.assign(r.meals,Object(R.a)({},i,[].concat(Object(P.a)(n),[t]))),localStorage.setItem("inProgressRecipes",JSON.stringify(r))}}}),t)}Y.defaultProps={id:""};var K=Y;var V=function(e){var t=e.recipe,a=e.url,c=Object(n.useState)(!1),i=Object(d.a)(c,2),s=i[0],o=i[1],l=Object(n.useState)([]),u=Object(d.a)(l,2),m=u[0],p=u[1],f=Object(n.useState)([]),h=Object(d.a)(f,2),b=h[0],g=h[1];return Object(n.useEffect)((function(){p((function(){return localStorage.getItem("favoriteRecipes")?JSON.parse(localStorage.getItem("favoriteRecipes")):(localStorage.setItem("favoriteRecipes",JSON.stringify(m)),[])}))}),[]),Object(n.useEffect)((function(){if(!localStorage.getItem("inProgressRecipes")){localStorage.setItem("inProgressRecipes",JSON.stringify({cocktails:{},meals:{}}))}g((function(){if(localStorage.getItem("inProgressRecipes")){var e=JSON.parse(localStorage.getItem("inProgressRecipes"));return e&&t.idMeal in e.meals?e.meals[t.idMeal]:[]}return[]}))}),[t.idMeal]),r.a.createElement("div",{className:"progress-body"},r.a.createElement("main",null,r.a.createElement(z,{img:t.strDrinkThumb,title:t.strDrink}),r.a.createElement("span",{className:"details-category","data-testid":"recipe-category"},t.strCategory),r.a.createElement("div",{className:"details-buttons-container"}
1,r.a.createElement("div",{className:"details-fav-btn-container"},r.a.createElement("input",{type:"image",src:m.some((function(e){return e.id.toString()===t.idMeal}))?L.a:J.a,alt:"blackHeartIcon",onClick:function(){},"data-testid":"favorite-btn"})),s?r.a.createElement("span",null,"Link copiado!"):r.a.createElement("input",{type:"image",src:x.a,alt:"shareIcon","data-testid":"share-btn",onClick:function(){return function(e){var t="http://localhost:3000/".concat(e);k()(t),o(!0),setTimeout((function(){o(!1)}),S.a)}(a)}})),r.a.createElement("div",{className:"progress-ingredients-container"},r.a.createElement("h3",{className:"ingredient-progress-title"},"Ingredientes"),r.a.createElement("div",{className:"ingredients-progress"},U(t).map((function(e,a){return r.a.createElement("div",{className:"ingredients-progress-cards",key:"".concat(a,"-").concat(e)},r.a.createElement(K,{ingredient:e,index:a,ingredientsUsed:b,setIngredientsUsed:g,checked:b.some((function(t){return t===e})),id:t.idDrink}))})))),r.a.createElement("h3",{className:"ingredient-progress-title"},"Instructions"),r.a.createElement("div",{className:"instructions-progress-container"},r.a.createElement("div",{className:"instructions-progress-text"},r.a.createElement("p",{className:"instructions-progress","data-testid":"instructions"},t.strInstructions))),r.a.createElement("button",{className:"finish-recipe-progress-btn",type:"button","data-testid":"finish-recipe-btn"},"Finalizar Receita")))};var W=function(e){var t=e.match,a=t.params.id,c=t.url,i=Object(n.useState)({}),s=Object(d.a)(i,2),o=s[0],m=s[1];return Object(n.useEffect)((function(){Object(u.a)(l.a.mark((function e(){var t,n;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(f.a)("ID",a);case 2:t=e.sent,n=t.drinks,m(n[0]);case 5:case"end":return e.stop()}}),e)})))()}),[a,m]),r.a.createElement(V,{recipe:o,url:c})},$=a(52),q=a(53),Q=a.n(q),X=a(54),Z=a.n(X),ee=a(55),te=a.n(ee);a(85);var ae=function(){return r.a.createElement("div",{className:"footer-container"},r.a.createElement("footer",{"data-testid":"footer",className:"footer"},r.a.createElement(s.b,{className:"footer-link",to:"/bebidas"},r.a.createElement("input",{type:"image","data-testid":"drinks-bottom-btn",src:Q.a,alt:"drinkIcon"})),r.a.createElement(s.b,{to:"/explorar"},r.a.createElement("input",{type:"image","data-testid":"explore-bottom-btn",src:Z.a,alt:"exploreIcon"})),r.a.createElement(s.b,{to:"/comidas"},r.a.createElement("input",{type:"image","data-testid":"food-bottom-btn",src:te.a,alt:"mealIcon"}))))};var ne=function(){var e=Object(n.useContext)(m.a),t=e.setMeals,a=e.setDrinks,c=Object(O.f)();function i(){return(i=Object(u.a)(l.a.mark((function e(){var n,r,i,s;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("/comidas"!==c.location.pathname){e.next=6;break}return e.next=3,Object(p.a)("ALL");case 3:n=e.sent,r=n.meals,t(r);case 6:if("/bebidas"!==c.location.pathname){e.next=12;break}return e.next=9,Object(f.a)("ALL");case 9:i=e.sent,s=i.drinks,a(s);case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}return r.a.createElement("button",{className:"categories-buttons",type:"button",onClick:function(){return function(){return i.apply(this,arguments)}()},"data-testid":"All-category-filter"},"All")};a(36);var re=function(){var e=Object(n.useContext)(m.a),t=e.drinksCategories,a=e.setDrinks,c=e.drinks,i=e.toggle,s=e.setToggle,o=e.cat,d=e.setCat;function p(){return(p=Object(u.a)(l.a.mark((function e(t){var n,r,u,m;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s(!i),d(t),!0!==i||o!==t){e.next=7;break}return e.next=5,Object(f.a)("ALL");case 5:return n=e.sent,e.abrupt("return",a(n.drinks));case 7:return r="https://www.thecocktaildb.com/api/json/v1/1/filter.php?c=".concat(t),e.next=10,fetch(r);case 10:return u=e.sent,e.next=13,u.json();case 13:return m=e.sent,a(m.drinks),e.abrupt("return",c);case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}return r.a.createElement("div",{className:"categories-field"},r.a.createElement(ne,null),t.slice(0,S.c).map((function(e,t){var a=e.strCategory;return r.a.createElement("button",{className:"categories-buttons",type:"button",key:t,"data-testid":"".concat(a,"-category-filter"),onClick:function(){return function(e){return p.apply(this,arguments)}(a)}},a)})))},ce=(a(43),{headerProfilerContainer:"header header-profile-container",profileIcon:"profile-icon",headerTitleContainer:"header-title-container",headerTitle:"header-name header-title-profile",searchIcon:"search-icon",searchContainer:"search-field","headerSearchIn\u1e55utContainer":"header-search-input-container",headerSearchInput:"header-search-input form-label",radioBtnsContainer:"radius-btns-field",radioButtons:"radio-btn",headerSearchButton:"header-search-btn"});function ie(){var e={isRecommendation:!1,size:S.b};return r.a.createElement("div",{className:"meals-body"},r.a.createElement(N.a,{title:"Bebidas",isRender:!0,classes:ce}
1),r.a.createElement(re,null),r.a.createElement($.a,{data:e}),r.a.createElement(ae,null))}a(86);var se={headerProfilerContainer:"profile-header header-profile-container",profileIcon:"profile-profile-icon",headerTitleContainer:"explore-header-title-container",headerTitle:"header-name header-title-profile",searchIcon:"search-icon",searchContainer:"search-field","headerSearchIn\u1e55utContainer":"header-search-input-container",headerSearchInput:"header-search-input form-label",radioBtnsContainer:"radius-btns-field",radioButtons:"radio-btn",headerSearchButton:"header-search-btn"};var oe=function(e){var t=e.history;function a(e){t.push("/explorar/".concat(e))}return r.a.createElement("div",null,r.a.createElement(N.a,{title:"Explorar",isRender:!1,classes:se}),r.a.createElement("div",{className:"explore-btns"},r.a.createElement("button",{type:"button","data-testid":"explore-food",onClick:function(){return a("comidas")}},"Explorar Comidas"),r.a.createElement("button",{type:"button","data-testid":"explore-drinks",onClick:function(){return a("bebidas")}},"Explorar Bebidas")),r.a.createElement(ae,null))},le={headerProfilerContainer:"profile-header header-profile-container",profileIcon:"profile-profile-icon",headerTitleContainer:"explore-meals-title-container",headerTitle:"header-name header-title-profile",searchIcon:"search-icon",searchContainer:"search-field","headerSearchIn\u1e55utContainer":"header-search-input-container",headerSearchInput:"header-search-input form-label",radioBtnsContainer:"radius-btns-field",radioButtons:"radio-btn",headerSearchButton:"header-search-btn"};var ue=function(e){var t=e.history,a=Object(n.useState)([]),c=Object(d.a)(a,2),i=c[0],s=c[1];function o(e,a){a?t.push("/explorar/bebidas/".concat(e)):t.push("/bebidas/".concat(e))}return Object(n.useEffect)((function(){Object(u.a)(l.a.mark((function e(){var t,a;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(f.a)("RANDOM");case 2:t=e.sent,a=t.drinks,s(a[0].idDrink);case 5:case"end":return e.stop()}}),e)})))()}),[]),r.a.createElement("div",null,r.a.createElement(N.a,{title:"Explorar Bebidas",isRender:!1,classes:le}),r.a.createElement("div",{className:"user-options"},r.a.createElement("button",{type:"button","data-testid":"explore-by-ingredient",onClick:function(){return o("ingredientes",!0)}},"Por Ingredientes"),r.a.createElement("button",{type:"button","data-testid":"explore-surprise",onClick:function(){return o(i,!1)}},"Me Surpreenda!")),r.a.createElement(ae,null))};var de=function(e){var t=e.value,a=Object(O.f)(),c=Object(n.useContext)(m.a).setDrinks;function i(e){(function(){var t=Object(u.a)(l.a.mark((function t(){var a,n;return l.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(f.a)("INGREDIENT",e);case 2:a=t.sent,n=a.drinks,c(n);case 5:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}})()(),a.push("/bebidas")}return console.log(t),r.a.createElement("div",{className:"ingredients-container"},t.map((function(e,t){return r.a.createElement("div",{className:"ingredients-cards",role:"button",tabIndex:t,onClick:function(){return i(e.strIngredient1)},onKeyPress:function(){return i(e.strIngredient1)},"data-testid":"".concat(t,"-ingredient-card"),key:"".concat(t).concat(e.strIngredient1)},r.a.createElement("img",{"data-testid":"".concat(t,"-card-img"),src:"https://www.thecocktaildb.com/images/ingredients/".concat(e.strIngredient1,"-Small.png "),alt:e.strIngredient1}),r.a.createElement("div",{className:"ingredient-title-container"},r.a.createElement("h3",{className:"ingredient-title","data-testid":"".concat(t,"-card-name")},e.strIngredient1)))})))},me={headerProfilerContainer:"header header-profile-container",profileIcon:"profile-icon",headerTitleContainer:"explore-by-area-title-container",headerTitle:"explore-by-area-title header-title-profile",searchIcon:"search-icon",searchContainer:"search-field","headerSearchIn\u1e55utContainer":"header-search-input-container",headerSearchInput:"header-search-input form-label",radioBtnsContainer:"radius-btns-field",radioButtons:"radio-btn",headerSearchButton:"header-search-btn"};var pe=function(){var e=Object(n.useState)([]),t=Object(d.a)(e,2),a=t[0],c=t[1];Object(n.useEffect)((function(){Object(u.a)(l.a.mark((function e(){var t,a;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(f.a)("allIngredients");case 2:t=e.sent,a=t.drinks,c(a);case 5:case"end":return e.stop()}}),e)})))()}),[]);var i=a.slice(0,S.e);return console.log(i),r.a.createElement("div",null,r.a.createElement(N.a,{title:"Explorar Ingredientes",isRender:!1,classes:me}),r.a.createElement(de,{value:i}),r.a.createElement(ae,null))},fe={headerProfilerContainer:"profile-header header-profile-container",profileIcon:"profile-profile-icon",headerTitleContainer:"explore-meals-title-container",headerTitle:"header-name header-title-profile",searchIcon:"search-icon",searchContainer:"search-field","headerSearchIn\u1e55utContainer":"header-search-input-container",headerSearchInput:"header-search-input form-label",radioBtnsContainer:"radius-btns-field",radioButtons:"radio-btn",headerSearchButton:"header-search-btn"};var he=function(e){var t=e.history,a=Object(n.useState)([]),c=Object(d.a)(a,2),i=c[0],s=c[1];function o(e,a){a?t.push("/explorar/comidas/".concat(e)):t.push("/comidas/".concat(e))}return Object(n.useEffect)((function(){Object(u.a)(l.a.mark((function e(){var t,a;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(p.a)("random");case 2:t=e.sent,a=t.meals,s(a[0].idMeal);case 5:case"end":return e.stop()}}),e)})))()}),[]),r.a.createElement("div",null,r.a.createElement(N.a,{title:"Explorar Comidas",isRender:!1,classes:fe}),r.a.createElement("div",{className:"user-options"},r.a.createElement("button",{type:"button","data-testid":"explore-by-ingredient",onClick:function(){return o("ingredientes",!0)}},"Por Ingredientes"),r.a.createElement("button",{type:"button","data-testid":"explore-by-area",onClick:function(){return o("area",!0)}},"Por Local de Origem"),r.a.createElement("button",{type:"button","data-testid":"explore-surprise",onClick:function(){return o(i,!1)}},"Me Surpreenda!")),r.a.createElement(ae,null))},be=(a(35),{headerProfilerContainer:"header header-profile-container",profileIcon:"profile-icon",headerTitleContainer:"explore-by-area-title-container",headerTitle:"explore-by-area-title header-title-profile",searchIcon:"search-icon",searchContainer:"search-field","headerSearchIn\u1e55utContainer":"header-search-input-container",headerSearchInput:"header-search-input form-label",radioBtnsContainer:"radius-btns-field",radioButtons:"radio-btn",headerSearchButton:"header-search-btn"});var ge=function(){var e=Object(n.useState)([]),t=Object(d.a)(e,2),a=t[0],c=t[1],i=Object(n.useState)([]),s=Object(d.a)(i,2),o=s[0],m=s[1],f=Object(n.useState)("All"),h=Object(d.a)(f,2),b=h[0],g=h[1],v=Object(O.f)();return Object(n.useEffect)((function(){Object(u.a)(l.a.mark((function e(){var t,a;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(p.a)("BYAREA");
1case 2:t=e.sent,a=t.meals,c(["All"].concat(Object(P.a)(a)));case 5:case"end":return e.stop()}}),e)})))()}),[]),Object(n.useEffect)((function(){Object(u.a)(l.a.mark((function e(){var t,a,n,r,c,i;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("All"!==b){e.next=8;break}return e.next=3,Object(p.a)("ALL");case 3:t=e.sent,(a=t.meals)&&(n=a.slice(0,S.e),m(n)),e.next=13;break;case 8:return e.next=10,Object(p.a)("area",b);case 10:r=e.sent,(c=r.meals)&&(i=c.slice(0,S.e),m(i));case 13:case"end":return e.stop()}}),e)})))()}),[b]),r.a.createElement("div",null,r.a.createElement(N.a,{title:"Explorar Origem",isRender:!0,classes:be}),r.a.createElement("div",{className:"select-container"},r.a.createElement("select",{"data-testid":"explore-by-area-dropdown",value:b,onChange:function(e){var t=e.target;return g(t.value)}},a.map((function(e){return console.log(e),"string"===typeof e?r.a.createElement("option",{key:"".concat(e,"-key"),"data-testid":"".concat(e,"-option"),value:e},e):r.a.createElement("option",{key:"".concat(e.strArea,"-key"),"data-testid":"".concat(e.strArea,"-option"),value:e.strArea},e.strArea)})))),r.a.createElement("div",{className:"cards-container"},o.map((function(e,t){var a=e.strMeal,n=e.strMealThumb,c=e.idMeal;return r.a.createElement("div",{className:"card-container",role:"button",tabIndex:t,onClick:function(){return v.push("/comidas/".concat(c))},onKeyPress:function(){return v.push("/comidas/".concat(c))},key:"".concat(a,"-").concat(t),"data-testid":"".concat(t,"-recipe-card")},r.a.createElement("img",{className:"cards",width:"150px","data-testid":"".concat(t,"-card-img"),src:n,alt:a}),r.a.createElement("div",{className:"card-title"},r.a.createElement("h3",{className:"card-text","data-testid":"".concat(t,"-card-name")},a)))}))),r.a.createElement(ae,null))};a(87);var ve=function(e){var t=e.value,a=Object(n.useContext)(m.a).setMeals,c=Object(O.f)();function i(e){(function(){var t=Object(u.a)(l.a.mark((function t(){var n,r;return l.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(p.a)("INGREDIENT",e);case 2:n=t.sent,r=n.meals,a(r);case 5:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}})()(),c.push("/comidas")}return console.log(t),r.a.createElement("div",{className:"ingredients-container"},t.map((function(e,t){return r.a.createElement("div",{className:"ingredients-cards",role:"button",tabIndex:t,onClick:function(){return i(e.strIngredient)},onKeyPress:function(){return i(e.strIngredient)},"data-testid":"".concat(t,"-ingredient-card"),key:e.idIngredient},r.a.createElement("img",{"data-testid":"".concat(t,"-card-img"),src:"https://www.themealdb.com/images/ingredients/".concat(e.strIngredient,"-Small.png"),alt:e.strDescription}),r.a.createElement("div",{className:"ingredient-title-container"},r.a.createElement("h3",{className:"ingredient-title","data-testid":"".concat(t,"-card-name")},e.strIngredient)))})))},Ee={headerProfilerContainer:"profile-header header-profile-container",profileIcon:"profile-profile-icon",headerTitleContainer:"explore-meals-by-ingredient-title-container",headerTitle:"explore-meals-by-ingredient-title header-title-profile",searchIcon:"search-icon",searchContainer:"search-field","headerSearchIn\u1e55utContainer":"header-search-input-container",headerSearchInput:"header-search-input form-label",radioBtnsContainer:"radius-btns-field",radioButtons:"radio-btn",headerSearchButton:"header-search-btn"};var Oe=function(){var e=Object(n.useState)([]),t=Object(d.a)(e,2),a=t[0],c=t[1];Object(n.useEffect)((function(){Object(u.a)(l.a.mark((function e(){var t,a;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(p.a)("allIngredients");case 2:t=e.sent,a=t.meals,c(a);case 5:case"end":return e.stop()}}),e)})))()}),[]);var i=a.slice(0,S.e);return r.a.createElement("div",null,r.a.createElement(N.a,{title:"Explorar Ingredientes",isRender:!1,classes:Ee}),r.a.createElement(ve,{value:i}),r.a.createElement(ae,null))},je={headerProfilerContainer:"profile-header header-profile-container",profileIcon:"profile-profile-icon",headerTitleContainer:"favorites-recipes-title-container",headerTitle:"header-name header-title-profile",searchIcon:"search-icon",searchContainer:"search-field","headerSearchIn\u1e55utContainer":"header-search-input-container",headerSearchInput:"header-search-input form-label",radioBtnsContainer:"radius-btns-field",radioButtons:"radio-btn",headerSearchButton:"header-search-btn"};var ke=function(){var e=Object(n.useState)([]),t=Object(d.a)(e,2),a=t[0],c=t[1],i=Object(n.useState)(!0),o=Object(d.a)(i,2),l=o[0],u=o[1],m=Object(n.useState)(!1),p=Object(d.a)(m,2),f=p[0],h=p[1],b=Object(n.useState)(""),g=Object(d.a)(b,2),v=g[0],E=g[1];return Object(n.useEffect)((function(){c((function(){return localStorage.getItem("favoriteRecipes")?JSON.parse(localStorage.getItem("favoriteRecipes")):[]}))}),[l]),r.a.createElement("div",{className:"done-recipes-body"},r.a.createElement(N.a,{title:"Receitas Favoritas",isRender:!1,classes:je}),r.a.createElement(y,{setFilterType:E}),r.a.createElement("div",{className:"done-recipes-container"},a.filter((function(e){return e.type.includes(v)})).map((function(e,t){return r.a.createElement("div",{className:"done-recipe-card-container",key:e.id},r.a.createElement(s.b,{to:"".concat(e.type,"s/").concat(e.id)},r.a.createElement("img",{className:"done-recipe-img",width:"150px","data-testid":"".concat(t,"-horizontal-image"),src:e.image,alt:e.name})),"comida"===e.type&&r.a.createElement("p",{"data-testid":"".concat(t,"-horizontal-top-text")},"".concat(e.area," - ").concat(e.category)),"bebida"===e.type&&r.a.createElement("p",{"data-testid":"".concat(t,"-horizontal-top-text")},"".concat(e.alcoholicOrNot)),r.a.createElement(s.b,{to:"".concat(e.type,"s/").concat(e.id)},r.a.createElement("h3",{className:"done-recipe-title","data-testid":"".concat(t,"-horizontal-name")},e.name)),f?r.a.createElement("span",null,"Link copiado!"):r.a.createElement("input",{type:"image",src:x.a,alt:"shareIcon","data-testid":"".concat(t,"-horizontal-share-btn"),onClick:function(){return function(e){var t="http://localhost:3000/".concat(e);k()(t),h(!0),setTimeout((function(){h(!1)}),S.a)}("".concat(e.type,"s/").concat(e.id))}}),r.a.createElement("input",{type:"image",src:L.a,alt:"blackHeartIcon",onClick:function(){!function(e){var t=e.name,n=a.filter((function(e){return e.name!==t}));localStorage.setItem("favoriteRecipes",JSON.stringify(n))}(e),u(!l)},"data-testid":"".concat(t,"-horizontal-favorite-btn")}))}
1))))};var ye=function(e){var t=e.match,a=Object(n.useState)([]),c=Object(d.a)(a,2),i=c[0],o=c[1],p=Object(n.useContext)(m.a),f=p.doneRecipes,h=p.setDoneRecipes,b=p.inProgress,g=p.setInProgress,v=p.drinks,E=t.params.id;if(Object(n.useEffect)((function(){(function(){var e=Object(u.a)(l.a.mark((function e(){var t;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(G.a)("https://www.themealdb.com/api/json/v1/1/lookup.php?i=".concat(E));case 2:t=e.sent,o(t);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}})()()}),[E,f]),0===i.length)return null;var O=i.meals,j=O[0],k=j.strMealThumb,y=j.strMeal,N=j.strCategory,S=j.strInstructions,I=j.idMeal,x=j.strArea,w=j.dateModified,C=j.strTags,D=j.strYoutube,J={id:I,type:"comida",area:x,category:N,alcoholicOrNot:"",name:y,image:k,doneDate:w,tags:[C]},A=Object.keys(O[0]).indexOf("strIngredient1"),L=Object.values(O[0]).splice(A).slice(0,20),H=Object.keys(O[0]).indexOf("strMeasure1"),U=Object.values(O[0]).slice(H).slice(0,20),Y=L.map((function(e,t){return null!==e&&0!==e.length&&e.concat(" - ",U[t])})),K=b.meals,V={recipe:O[0],type:"comida"};return r.a.createElement("div",{className:"meals-details-body"},r.a.createElement(z,{img:k,title:y}),r.a.createElement(F,{data:V}),r.a.createElement("h3",{className:"details-category","data-testid":"recipe-category"},N),r.a.createElement(_,{ingredients:Y}),r.a.createElement("h1",{className:"details-ingredient-title"},"Instructions"),r.a.createElement("div",{className:"details-ingredients-container"},r.a.createElement("h4",{className:"details-list","data-testid":"instructions"},S)),r.a.createElement("h1",{className:"details-ingredient-title"}," Video "),r.a.createElement("div",{className:"details-video-container","data-testid":"video"},null!==D&&r.a.createElement("div",null,r.a.createElement(B.a,{className:"details-video",videoId:function(e){var t=e.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/);return t&&11===t[2].length?t[2]:null}("".concat(D))}))),r.a.createElement("div",{className:"carousel-container"},r.a.createElement(M.a,null,v.slice(0,6).map((function(e,t){return r.a.createElement(M.a.Item,{className:"carousel-item",key:t},r.a.createElement(s.b,{to:"/bebidas/".concat(e.idDrink),key:t},r.a.createElement("img",{className:"d-block w-100 carousel-img",src:e.strDrinkThumb,alt:"First slide"}),r.a.createElement(M.a.Caption,{className:"caption-container"},r.a.createElement("h3",{className:"carousel-text"},e.strDrink))))})))),Object.keys(K).some((function(e){return e===I}))?r.a.createElement(s.b,{to:"/comidas/".concat(E,"/in-progress")},r.a.createElement("button",{type:"button",className:"start-recipe-btn","data-testid":"start-recipe-btn",onClick:function(){var e=b.meals,t=Object(T.a)(Object(T.a)({},b),{},{meals:Object(T.a)(Object(T.a)({},e),{},Object(R.a)({},I,[]))});g(t),localStorage.setItem("inProgressRecipes",JSON.stringify(t))}},"Continuar Receita")):r.a.createElement(s.b,{to:"/comidas/".concat(E,"/in-progress")},r.a.createElement("button",{className:"start-recipe-btn",type:"button",onClick:function(){h([].concat(Object(P.a)(f),[J]));var e=[].concat(Object(P.a)(f),[J]),t=b.meals,a=Object(T.a)(Object(T.a)({},b),{},{meals:Object(T.a)(Object(T.a)({},t),{},Object(R.a)({},I,[]))});g(a),localStorage.setItem("inProgressRecipes",JSON.stringify(a)),localStorage.setItem("doneRecipes",JSON.stringify(e))},"data-testid":"start-recipe-btn"},"Iniciar Receita")))};var Ne=function(e){var t=e.recipe,a=e.url,c=Object(n.useState)(!1),i=Object(d.a)(c,2),s=i[0],o=i[1],l=Object(n.useState)([]),u=Object(d.a)(l,2),m=u[0],p=u[1],f=Object(n.useState)([]),h=Object(d.a)(f,2),b=h[0],g=h[1];return Object(n.useEffect)((function(){p((function(){return localStorage.getItem("favoriteRecipes")?JSON.parse(localStorage.getItem("favoriteRecipes")):(localStorage.setItem("favoriteRecipes",JSON.stringify(m)),[])}))}),[]),Object(n.useEffect)((function(){if(!localStorage.getItem("inProgressRecipes")){localStorage.setItem("inProgressRecipes",JSON.stringify({cocktails:{},meals:{}}))}g((function(){if(localStorage.getItem("inProgressRecipes")){var e=JSON.parse(localStorage.getItem("inProgressRecipes"));return e&&t.idMeal in e.meals?e.meals[t.idMeal]:[]}return[]}))}),[t.idMeal]),r.a.createElement("div",{className:"progress-body"},r.a.createElement("main",null,r.a.createElement(z,{img:t.strMealThumb,title:t.strMeal}),r.a.createElement("span",{className:"details-category","data-testid":"recipe-category"},t.strCategory),r.a.createElement("div",{className:"details-buttons-container"}
1,r.a.createElement("div",null,r.a.createElement("input",{type:"image",src:m.some((function(e){return e.id.toString()===t.idMeal}))?L.a:J.a,alt:"blackHeartIcon",onClick:function(){},"data-testid":"favorite-btn"})),s?r.a.createElement("span",null,"Link copiado!"):r.a.createElement("input",{type:"image",src:x.a,alt:"shareIcon","data-testid":"share-btn",onClick:function(){return function(e){var t="http://localhost:3000/".concat(e);k()(t),o(!0),setTimeout((function(){o(!1)}),S.a)}(a)}})),r.a.createElement("div",{className:"progress-ingredients-container"},r.a.createElement("h3",{className:"ingredient-progress-title"},"Ingredientes"),r.a.createElement("div",{className:"ingredients-progress"},U(t).map((function(e,a){return r.a.createElement("div",{className:"ingredients-progress-cards",key:"".concat(a,"-").concat(e)},r.a.createElement(K,{ingredient:e,index:a,ingredientsUsed:b,setIngredientsUsed:g,checked:b.some((function(t){return t===e})),id:t.idMeal}))})))),r.a.createElement("h3",{className:"ingredient-progress-title"},"Instructions"),r.a.createElement("div",{className:"instructions-progress-container"},r.a.createElement("div",{className:"instructions-progress-text"},r.a.createElement("p",{className:"instructions-progress","data-testid":"instructions"},t.strInstructions))),r.a.createElement("button",{className:"finish-recipe-progress-btn",type:"button","data-testid":"finish-recipe-btn"},"Finalizar Receita")))};var Se=function(e){var t=e.match,a=t.params.id,c=t.url,i=Object(n.useState)({}),s=Object(d.a)(i,2),o=s[0],m=s[1];return Object(n.useEffect)((function(){Object(u.a)(l.a.mark((function e(){var t,n;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(p.a)("ID",a);case 2:t=e.sent,n=t.meals,m(n[0]);case 5:case"end":return e.stop()}}),e)})))()}),[a,m]),r.a.createElement(Ne,{recipe:o,url:c})},Ie=a(56);var xe=function(){var e=Object(n.useContext)(m.a),t=e.mealsCategories,a=e.setMeals,c=e.meals,i=e.toggle,s=e.setToggle,o=e.cat,d=e.setCat;function f(){return(f=Object(u.a)(l.a.mark((function e(t){var n,r,u,m;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s(!i),d(t),!0!==i||o!==t){e.next=7;break}return e.next=5,Object(p.a)("ALL");case 5:return n=e.sent,e.abrupt("return",a(n.meals));case 7:return r="https://www.themealdb.com/api/json/v1/1/filter.php?c=".concat(t),e.next=10,fetch(r);case 10:return u=e.sent,e.next=13,u.json();case 13:return m=e.sent,a(m.meals),e.abrupt("return",c);case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}return r.a.createElement("div",{className:"categories-field"},r.a.createElement(ne,null),t.slice(0,S.c).map((function(e,t){var a=e.strCategory;return r.a.createElement("button",{className:"categories-buttons",id:a,type:"button",key:t,"data-testid":"".concat(a,"-category-filter"),onClick:function(){return function(e){return f.apply(this,arguments)}(a)}},a)})))},we={headerProfilerContainer:"header header-profile-container",profileIcon:"profile-icon",headerTitleContainer:"header-title-container",headerTitle:"header-name header-title-profile",searchIcon:"search-icon",searchContainer:"search-field","headerSearchIn\u1e55utContainer":"header-search-input-container",headerSearchInput:"header-search-input form-label",radioBtnsContainer:"radius-btns-field",radioButtons:"radio-btn",headerSearchButton:"header-search-btn"};function Ce(){var e={isRecommendation:!1,size:S.b};return r.a.createElement("div",{className:"meals-body"},r.a.createElement(N.a,{title:"Comidas",isRender:!0,classes:we}
1),r.a.createElement(xe,null),r.a.createElement(Ie.a,{data:e}),r.a.createElement(ae,null))}a(88);var Re=function(){var e=Object(n.useState)(""),t=Object(d.a)(e,2),a=t[0],c=t[1],i=Object(n.useState)(""),s=Object(d.a)(i,2),o=s[0],l=s[1],u=Object(O.f)();return r.a.createElement("div",null,r.a.createElement("form",null,r.a.createElement("h1",{className:"login-title"},"App de Receitas"),r.a.createElement("fieldset",{className:"login-field"},r.a.createElement("label",{className:"form__label",htmlFor:"email-input"},r.a.createElement("input",{className:"login-inputs",id:"email-input","data-testid":"email-input",type:"email",onChange:function(e){var t=e.target;return c(t.value)},value:a,placeholder:"Informe o seu e-mail"})),r.a.createElement("label",{className:"form__label",htmlFor:"password-input"},r.a.createElement("input",{className:"login-inputs",id:"password-input","data-testid":"password-input",type:"password",onChange:function(e){var t=e.target;return l(t.value)},value:o,placeholder:"Digite sua senha"})),r.a.createElement("button",{className:"login-btn","data-testid":"login-submit-btn",type:"button",disabled:!(/\S+@\S+\.\S+/.test(a)&&o.length>6),onClick:function(){localStorage.setItem("mealsToken",JSON.stringify(1)),localStorage.setItem("cocktailsToken",JSON.stringify(1)),localStorage.setItem("user",JSON.stringify({email:a})),localStorage.setItem("doneRecipes",JSON.stringify([])),localStorage.setItem("favoriteRecipes",JSON.stringify([])),localStorage.setItem("inProgressRecipes",JSON.stringify({cocktails:{},meals:{}})),u.push("/comidas")}},"Entrar"))))},Te=(a(89),{headerProfilerContainer:"profile-header header-profile-container",profileIcon:"profile-profile-icon",headerTitleContainer:"profile-title-container",headerTitle:"header-name header-title-profile",searchIcon:"search-icon",searchContainer:"search-field","headerSearchIn\u1e55utContainer":"header-search-input-container",headerSearchInput:"header-search-input form-label",radioBtnsContainer:"radius-btns-field",radioButtons:"radio-btn",headerSearchButton:"header-search-btn"});var Pe=function(){var e=Object(O.f)();return r.a.createElement("div",null,r.a.createElement(N.a,{title:"Perfil",isRender:!1,classes:Te}),r.a.createElement("div",{className:"user-options"},r.a.createElement("div",{className:"user-container"},r.a.createElement("h3",{"data-testid":"profile-email",className:"user"},localStorage.getItem("user")?JSON.parse(localStorage.getItem("user")).email:"")),r.a.createElement("button",{type:"button","data-testid":"profile-done-btn",onClick:function(){return e.push("/receitas-feitas")}},"Receitas Feitas"),r.a.createElement("button",{type:"button","data-testid":"profile-favorite-btn",onClick:function(){return e.push("/receitas-favoritas")}},"Receitas Favoritas"),r.a.createElement("button",{type:"button","data-testid":"profile-logout-btn",onClick:function(){localStorage.removeItem("mealsToken"),localStorage.removeItem("cocktailsToken"),localStorage.removeItem("user"),localStorage.removeItem("doneRecipes"),localStorage.removeItem("favoriteRecipes"),localStorage.removeItem("inProgressRecipes"),e.push("/")}},"Sair")),r.a.createElement(ae,null))};var Be=function(){return r.a.createElement("h1",null,"Not Found")};var Me=function(){return r.a.createElement(O.c,null,r.a.createElement(O.a,{exact:!0,path:"/comidas",component:Ce}),r.a.createElement(O.a,{exact:!0,path:"/bebidas",component:ie}),r.a.createElement(O.a,{exact:!0,path:"/comidas/:id",component:ye}),r.a.createElement(O.a,{exact:!0,path:"/bebidas/:id",component:H}),r.a.createElement(O.a,{exact:!0,path:"/comidas/:id/in-progress",component:Se}),r.a.createElement(O.a,{exact:!0,path:"/bebidas/:id/in-progress",component:W}),r.a.createElement(O.a,{exact:!0,path:"/explorar",component:oe}),r.a.createElement(O.a,{exact:!0,path:"/explorar/comidas",component:he}),r.a.createElement(O.a,{exact:!0,path:"/explorar/bebidas",component:ue}),r.a.createElement(O.a,{exact:!0,path:"/explorar/comidas/ingredientes",component:Oe}),r.a.createElement(O.a,{exact:!0,path:"/explorar/bebidas/ingredientes",component:pe}),r.a.createElement(O.a,{exact:!0,path:"/explorar/comidas/area",component:ge}),r.a.createElement(O.a,{exact:!0,path:"/perfil",component:Pe}),r.a.createElement(O.a,{exact:!0,path:"/receitas-feitas",component:C}),r.a.createElement(O.a,{exact:!0,path:"/receitas-favoritas",component:ke}),r.a.createElement(O.a,{exact:!0,path:"/",component:Re}),r.a.createElement(O.a,{component:Be}))};var De=function(){return r.a.createElement(E,null,r.a.createElement(Me,null))};Boolean("localhost"===window.location.hostname||"[::1]"===window.location.hostname||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));i.a.render(r.a.createElement(s.a,null,r.a.createElement(De,null)),document.getElementById("root")),"serviceWorker"
1in navigator&&navigator.serviceWorker.ready.then((function(e){e.unregister()}))}],[[58,1,2]]]); 2//# sourceMappingURL=main.d3f1a6fa.chunk.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.