text: (window.webpackJsonp=window.webpackJsonp||[]).push([[0],{12:function(e,t,a){e.exports={wrapper:"movie-single_wrapper__1fwj3",additional_Info:"movie-single_additional_Info__3JMSo",addInfoWrapper:"movie-single_addInfoWrapper__rSHTG"}},14:function(e,t,a){e.exports={wrapper:"movie-search_wrapper__2mXKW",wrapperUl:"movie-search_wrapperUl__2J7IG"}},22:function(e,t,a){e.exports={ul:"mainpage_ul__2sy9N",h1:"mainpage_h1__3NTKR"}},23:function(e,t,a){e.exports={castWrapper:"cast_castWrapper__PAqsx"}},24:function(e,t,a){e.exports={wrapperReviews:"reviews_wrapperReviews__11rlK"}},25:function(e,t,a){e.exports={header:"header_header__3r9kd"}},26:function(e,t,a){e.exports={footer:"footer_footer__2a6Tc"}},28:function(e,t,a){e.exports=a(65)},33:function(e,t,a){},65:function(e,t,a){"use strict";a.r(t);var n=a(0),r=a.n(n),c=a(21),o=a.n(c),i=a(68),l=a(70),s=a(69),u=Boolean("localhost"===window.location.hostname||"[::1]"===window.location.hostname||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));function p(e,t){navigator.serviceWorker.register(e).then(function(e){e.onupdatefound=function(){var a=e.installing;null!=a&&(a.onstatechange=function(){"installed"===a.state&&(navigator.serviceWorker.controller?(console.log("New content is available and will be used when all tabs for this page are closed. See http://bit.ly/CRA-PWA."),t&&t.onUpdate&&t.onUpdate(e)):(console.log("Content is cached for offline use."),t&&t.onSuccess&&t.onSuccess(e)))})}}).catch(function(e){console.error("Error during service worker registration:",e)})}a(33);var m=a(2),f=a.n(m),d=a(5),v=a(7),h=a(6),E=a.n(h),g=a(22),w=a.n(g),_="c8c0bc6eb83ed4f63055a8792f6792d7",b=a(67),k=function(){var e=Object(n.useState)(null),t=Object(v.a)(e,2),a=t[0],c=t[1];return Object(n.useEffect)(function(){function e(){return(e=Object(d.a)(f.a.mark(function e(){var t,a;return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,E.a.get("https://api.themoviedb.org/3/trending/movie/week?api_key=".concat(_));case 2:t=e.sent,a=t.data,c(a.results);case 5:case"end":return e.stop()}},e)}))).apply(this,arguments)}!function(){e.apply(this,arguments)}()},[]),r.a.createElement("ul",{className:w.a.ul},a&&a.map(function(e){var t=e.id,a=e.title,n=e.backdrop_path;return r.a.createElement("li",{key:t},r.a.createElement("img",{alt:"movie-mo",src:"https://image.tmdb.org/t/p/original".concat(n)}),r.a.createElement(b.a,{to:"/movies/".concat(t)},a))}))},y=a(14),x=a.n(y),O=function(){var e=Object(n.useState)(null),t=Object(v.a)(e,2),a=t[0],c=t[1],o=function(){var e=Object(d.a)(f.a.mark(function e(t){var a,n,r;return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null===t.target.value||""===t.target.value.trim()){e.next=9;break}return a=t.target.value,e.next=4,E.a.get("https://api.themoviedb.org/3/search/movie?api_key=".concat(_,"&query=").concat(a));case 4:n=e.sent,(r=n.data).results.length?c(r.results):c(null),e.next=10;break;case 9:c(null);case 10:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}();return r.a.createElement("div",{className:x.a.wrapper},r.a.createElement("input",{placeholder:"search keyword",onChange:function(e){return o(e)}}),a&&r.a.createElement("ul",{className:x.a.wrapperUl},a.map(function(e){var t=e.id,a=e.title,n=e.backdrop_path;return r.a.createElement("li",{key:t},r.a.createElement(b.a,{to:"movies/".concat(t)},r.a.createElement("img",{alt:"movie-mo",src:"https://image.tmdb.org/t/p/original".concat(n)}),a))})))},j=a(12),N=a.n(j),W=a(23),A=a.n(W),I=function(e){var t=e.id,a=e.APIkey,c=Object(n.useState)(null),o=Object(v.a)(c,2),i=o[0],l=o[1];return Object(n.useEffect)(function(){function e(){return(e=Object(d.a)(f.a.mark(function e(){var n,r;return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,E.a.get("https://api.themoviedb.org/3/movie/".concat(t,"/credits?api_key=").concat(a));case 2:n=e.sent,r=n.data,l(r);case 5:case"end":return e.stop()}},e)}))).apply(this,arguments)}!function(){e.apply(this,arguments)}()},[]),console.log(i),r.a.createElement(r.a.Fragment,null,i&&r.a.createElement("ul",{className:A.a.castWrapper},i.cast.map(function(e){var t=e.id,a=e.profile_path,n=e.name,c=e.character;return r.a.createElement("li",{key:t},r.a.createElement("span",null,n),r.a.createElement("img",{alt:"cast-pic",src:"https://image.tmdb.org/t/p/original".concat(a)}),r.a.createElement("span",null,"Character: ",c))})))},S=a(24),R=a.n(S),C=function(e){var t=e.id,a=e.APIkey,c=Object(n.useState)(null),o=Object(v.a)(c,2),i=o[0],l=o[1];return Object(n.useEffect)(function(){function e(){return(e=Object(d.a)(f.a.mark(function e(){var n,r;return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,E.a.get("https://api.themoviedb.org/3/movie/".concat(t,"/reviews?api_key=").concat(a));case 2:n=e.sent,r=n.data,l(r);case 5:case"end":return e.stop()}},e)}))).apply(this,arguments)}!function(){e.apply(this,arguments)}()},[]),r.a.createElement("ul",{className:R.a.wrapperReviews},i&&i.results.map(function(e){var t=e.id,a=e.author,n=e.content;return r.a.createElement("li",{key:t},r.a.createElement("h3",null,a),r.a.createElement("p",null,n))}),i&&!i.results.length&&r.a.createElement("h3",null,"no reviews"))},P=function(e){var t=e.match,a=e.location,c=Object(n.useState)(null),o=Object(v.a)(c,2),i=o[0],l=o[1];Object(n.useEffect)(function(){var e=t.params.id;function a(){return(a=Object(d.a)(f.a.mark(function t(){var a,n;return f.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,E.a.get("https://api.themoviedb.org/3/movie/".concat(e,"?api_key=").concat(_));case 2:a=t.sent,n=a.data,l(n);case 5:case"end":return t.stop()}},t)}))).apply(this,arguments)}!function(){a.apply(this,arguments)}()},[]);var s=i||"",u=s.id,p=s.backdrop_path,m=s.title,h=s.vote_average,g=s.overview,w=s.genres;return r.a.createElement("div",null,i&&r.a.createElement(r.a.Fragment,null,r.a.createElement("div",{className:N.a.wrapper},r.a.createElement("img",{alt:"mo-movie",src:"https://image.tmdb.org/t/p/original".concat(p)}),r.a.createElement("div",null,r.a.createElement("h3",null,m),r.a.createElement("h4",null,"Overview"),r.a.createElement("p",null,g),r.a.createElement("h4",null,"Jenres"),w.map(function(e){var t=e.id,a=e.name;return r.a.createElement("span",{key:t},a)}),r.a.createElement("h4",null,"SCORE"),r.a.createElement("p",null,h))),r.a.createElement("h2",{className:N.a.additional_Info},"Additional information"),r.a.createElement("div",{className:N.a.addInfoWrapper},r.a.createElement("span",null,r.a.createElement(b.a,{to:"/movies/".concat(u,"/cast")},"CAST")),r.a.createElement("span",null,r.a.createElement(b.a,{to:"/movies/".concat(u,"/reviews")},"REVIEWS")))),a.pathname.includes("cast")&&r.a.createElement(I,{APIkey:_,id:u}),a.pathname.includes("reviews")&&r.a.createElement(C,{APIkey:_,id:u}))},T=a(25),U=a.n(T),J=function(){return r.a.createElement("header",{className:U.a.header},r.a.createElement("nav",null,r.a.createElement(b.a,{to:"/"}," MAIN "),r.a.createElement(b.a,{to:"/movies"}," SEARCH ")))},F=a(26),H=a.n(F),K=function(){return r.a.createElement("footer",{className:H.a.footer},"FOOTER")},q=function(e){var t=e.children;return r.a.createElement(r.a.Fragment,null,r.a.createElement(J,null),r.a.createElement("div",{style:{minHeight:"100vh"}},t),r.a.createElement(K,null))};o.a.render(r.a.createElement(function(){return r.a.createElement(i.a,null,r.a.createElement(q,null,r.a.createElement(l.a,null,r.a.createElement(s.a,{exact:!0,path:"/",component:k}),r.a.createElement(s.a,{exact:!0,path:"/movies",component:O}),r.a.createElement(s.a,{exact:!0,path:"/movies/:id",component:P}),r.a.createElement(s.a,{exact:!0,path:"/movies/:id/cast",component:P}),r.a.createElement(s.a,{exact:!0,path:"/movies/:id/reviews",component:P}))))},null),document.getElementById("root")),function(e){if("serviceWorker"in navigator){if(new URL("/movies",window.location.href).origin!==window.location.origin)return;window.addEventListener("load",function(){var t="".concat("/movies","/service-worker.js");u?(function(e,t){fetch(e).then(function(a){var n=a.headers.get("content-type");404===a.status||null!=n&&-1===n.indexOf("javascript")?navigator.serviceWorker.ready.then(function(e){e.unregister().then(function(){window.location.reload()})}):p(e,t)}).catch(function(){console.log("No internet connection found. App is running in offline mode.")})}(t,e),navigator.serviceWorker.ready.then(function(){console.log("This web app is being served cache-first by a service worker. To learn more, visit http://bit.ly/CRA-PWA")})):p(t,e)})}}()}},[[28,2,1]]]);
  //# sourceMappingURL=main.612cb2f9.chunk.js.map