text: (()=>{"use strict";var e,t,r,n,a,o={1756:(e,t,r)=>{var n=r(7294),a=r(3935),o=r(6841),c=r(4890),i=r(9711),l=r(6974);const s=n.createContext({});const u=function(e){var t=e.product,r=e.handleAddToCart;return n.createElement("div",{className:"Products-item"},n.createElement("img",{src:t.image,alt:t.title}),n.createElement("div",{className:"Products-item-info"},n.createElement("h2",null,t.title,n.createElement("span",null,"$",t.price)),n.createElement("p",null,t.description)),n.createElement("button",{type:"button",onClick:r(t)},"Comprar"))};const m=function(){var e=(0,n.useContext)(s).products,t=function(e){};return n.createElement("div",{className:"Products"},n.createElement("div",{className:"Products-items"},e.map((function(e){return n.createElement(u,{key:e.id,product:e,handleAddToCart:t})}))))};const p=function(){return n.createElement(m,null)};var d=r(2567);const f=function(e){var t=e.title;return n.createElement("span",null,t)};const g=(0,o.$j)((function(e){return{cart:e.cart}}),null)((function(e){return n.createElement("div",{className:"Header"},n.createElement("h1",{className:"Header-title"},n.createElement("img",{src:d,alt:"Logo",width:"32"}),n.createElement(i.rU,{to:"/"},n.createElement(f,{title:"Platzi Store"}))),n.createElement("div",{className:"Header-checkout"},n.createElement(i.rU,{to:"/checkout"},n.createElement("i",{className:"fas fa-shopping-basket"})),e.cart.length>0&&n.createElement("div",{className:"Header-alert"},e.cart.length)))}));const h=function(){return n.createElement("div",{className:"Footer"},n.createElement("p",{className:"Footer-title"},"Platzi Store"),n.createElement("p",{className:"Footer-copy"},"Todos los Izquierdos Reservados"))};const v=function(e){var t=e.children;return n.createElement("div",{className:"Main"},n.createElement(g,null),t,n.createElement(h,null))};const E=function(){return n.createElement("h1",null,"NotFound")};var b=r(5861),y=r(3324),O=r(7757),w=r.n(O),k=r(9669),j=r.n(k);const P=function(){var e=(0,n.useState)([]),t=(0,y.Z)(e,2),r=t[0],a=t[1];return(0,n.useEffect)((0,b.Z)(w().mark((function e(){var t;return w().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,j()("https://us-central1-gndx-fake-api.cloudfunctions.net/api");case 2:t=e.sent,a(t.data);case 4:case"end":return e.stop()}}),e)}))),[]),{products:r}};var C=n.lazy((function(){r.e(725).then(r.bind(r,725))}));const N=function(){var e=P(),t=Object.keys(e.products).length;return n.createElement(n.Fragment,null,t>0?n.createElement(n.Suspense,{fallback:n.createElement("div",null,"Loading...")},n.createElement(s.Provider,{value:e},n.createElement(i.VK,null,n.createElement(v,null,n.createElement(l.Z5,null,n.createElement(l.AW,{exact:!0,path:"/",element:n.createElement(p,null)}),n.createElement(l.AW,{exact:!0,path:"/checkout",element:n.createElement(C,null)}),n.createElement(l.AW,{exact:!0,path:"*",element:n.createElement(E,null)})))))):n.createElement("h1",null,"Loading ... "))};var S=r(9062),A=r(4942);function T(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function x(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?T(Object(r),!0).forEach((function(t){(0,A.Z)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):T(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}const z=function(e,t){switch(t.type){case"ADD_TO_CART":return x(x({},e),{},{cart:[].concat((0,S.Z)(e.cart),[t.payload])});case"REMOVE_FROM_CART":return x(x({},e),{},{cart:e.cart.filter((function(e){return e.id!==t.payload.id}))});default:return e}};var L=(0,c.MT)(z,{cart:[],products:[{id:"1",image:"https://arepa.s3.amazonaws.com/camiseta.png",title:"Camiseta",price:25,description:"Lorem ipsum dolor sit amet, consectetur adipiscing elit"},{id:"3",image:"https://arepa.s3.amazonaws.com/mug.png",title:"Mug",price:10,description:"Lorem ipsum dolor sit amet, consectetur adipiscing elit"},{id:"4",image:"https://arepa.s3.amazonaws.com/pin.png",title:"Pin",price:4,description:"Lorem ipsum dolor sit amet, consectetur adipiscing elit"},{id:"5",image:"https://arepa.s3.amazonaws.com/stickers1.png",title:"Stickers",price:2,description:"Lorem ipsum dolor sit amet, consectetur adipiscing elit"},{id:"6",image:"https://arepa.s3.amazonaws.com/stickers2.png",title:"Stickers",price:2,description:"Lorem ipsum dolor sit amet, consectetur adipiscing elit"},{id:"7",image:"https://arepa.s3.amazonaws.com/hoodie.png",title:"Hoodie",price:35,description:"Lorem ipsum dolor sit amet, consectetur adipiscing elit"}]});a.render(n.createElement(o.zt,{store:L},n.createElement(N,null)),document.getElementById("app"))},2567:(e,t,r)=>{e.exports=r.p+"2919f2487ede6b463f58.png"}},c={};function i(e){var t=c[e];if(void 0!==t)return t.exports;var r=c[e]={exports:{}};return o[e](r,r.exports,i),r.exports}i.m=o,e=[],i.O=(t,r,n,a)=>{if(!r){var o=1/0;for(u=0;u<e.length;u++){for(var[r,n,a]=e[u],c=!0,l=0;l<r.length;l++)(!1&a||o>=a)&&Object.keys(i.O).every((e=>i.O[e](r[l])))?r.splice(l--,1):(c=!1,a<o&&(o=a));if(c){e.splice(u--,1);var s=n();void 0!==s&&(t=s)}}return t}a=a||0;for(var u=e.length;u>0&&e[u-1][2]>a;u--)e[u]=e[u-1];e[u]=[r,n,a]},i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.f={},i.e=e=>Promise.all(Object.keys(i.f).reduce(((t,r)=>(i.f[r](e,t),t)),[])),i.u=e=>e+".bundle.js",i.miniCssF=e=>"assets/"+e+".css",i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),t={},r="platzi-store:",i.l=(e,n,a,o)=>{if(t[e])t[e].push(n);else{var c,l;if(void 0!==a)for(var s=document.getElementsByTagName("script"),u=0;u<s.length;u++){var m=s[u];if(m.getAttribute("src")==e||m.getAttribute("data-webpack")==r+a){c=m;break}}c||(l=!0,(c=document.createElement("script")).charset="utf-8",c.timeout=120,i.nc&&c.setAttribute("nonce",i.nc),c.setAttribute("data-webpack",r+a),c.src=e),t[e]=[n];var p=(r,n)=>{c.onerror=c.onload=null,clearTimeout(d);var a=t[e];if(delete t[e],c.parentNode&&c.parentNode.removeChild(c),a&&a.forEach((e=>e(n))),r)return r(n)},d=setTimeout(p.bind(null,void 0,{type:"timeout",target:c}),12e4);c.onerror=p.bind(null,c.onerror),c.onload=p.bind(null,c.onload),l&&document.head.appendChild(c)}},i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.j=177,(()=>{var e;i.g.importScripts&&(e=i.g.location+"");var t=i.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");r.length&&(e=r[r.length-1].src)}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i.p=e})(),n=e=>new Promise(((t,r)=>{var n=i.miniCssF(e),a=i.p+n;if(((e,t)=>{for(var r=document.getElementsByTagName("link"),n=0;n<r.length;n++){var a=(c=r[n]).getAttribute("data-href")||c.getAttribute("href");if("stylesheet"===c.rel&&(a===e||a===t))return c}var o=document.getElementsByTagName("style");for(n=0;n<o.length;n++){var c;if((a=(c=o[n]).getAttribute("data-href"))===e||a===t)return c}})(n,a))return t();((e,t,r,n)=>{var a=document.createElement("link");a.rel="stylesheet",a.type="text/css",a.onerror=a.onload=o=>{if(a.onerror=a.onload=null,"load"===o.type)r();else{var c=o&&("load"===o.type?"missing":o.type),i=o&&o.target&&o.target.href||t,l=new Error("Loading CSS chunk "+e+" failed.\n("+i+")");l.code="CSS_CHUNK_LOAD_FAILED",l.type=c,l.request=i,a.parentNode.removeChild(a),n(l)}},a.href=t,document.head.appendChild(a)})(e,a,t,r)})),a={177:0},i.f.miniCss=(e,t)=>{a[e]?t.push(a[e]):0!==a[e]&&{725:1}[e]&&t.push(a[e]=n(e).then((()=>{a[e]=0}),(t=>{throw delete a[e],t})))},(()=>{var e={177:0};i.f.j=(t,r)=>{var n=i.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else{var a=new Promise(((r,a)=>n=e[t]=[r,a]));r.push(n[2]=a);var o=i.p+i.u(t),c=new Error;i.l(o,(r=>{if(i.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var a=r&&("load"===r.type?"missing":r.type),o=r&&r.target&&r.target.src;c.message="Loading chunk "+t+" failed.\n("+a+": "+o+")",c.name="ChunkLoadError",c.type=a,c.request=o,n[1](c)}}),"chunk-"+t,t)}},i.O.j=t=>0===e[t];var t=(t,r)=>{var n,a,[o,c,l]=r,s=0;if(o.some((t=>0!==e[t]))){for(n in c)i.o(c,n)&&(i.m[n]=c[n]);if(l)var u=l(i)}for(t&&t(r);s<o.length;s++)a=o[s],i.o(e,a)&&e[a]&&e[a][0](),e[a]=0;return i.O(u)},r=self.webpackChunkplatzi_store=self.webpackChunkplatzi_store||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var l=i.O(void 0,[351,216],(()=>i(1756)));l=i.O(l)})();