text: (window.webpackJsonp=window.webpackJsonp||[]).push([[0],{"7hx4":function(e,t,a){"use strict";a.r(t);a("OPH6"),a("JBxO"),a("FdtR");var n={page:1,query:"",fetchImages:function(){var e=this,t="?image_type=photo&orientation=horizontal&q="+this.query+"&page="+this.page+"&per_page=12&key=";return fetch("https://pixabay.com/api/"+t+"14260445-94202652c4e141397bd31e336").then((function(e){return e.json()})).then((function(t){return e.incrementPage(),t.hits}))},get searchQuery(){return this.query},set searchQuery(e){this.query=e},incrementPage:function(){this.page+=1},resetPage:function(){this.page=1}},r=a("pZ3e"),s=a.n(r),l=a("dIfx"),i=(a("mNaS"),a("IlkV"),a("dcBu"));a("/I5d");l.a.defaults.styling="material",l.a.defaults.icons="material",l.a.defaults.delay=2500,l.a.info("Hi! Please enter in a form what kind of pictures you want to find.");var o={form:document.querySelector("#search-form"),galleryList:document.querySelector(".gallery"),btnLoadMore:document.querySelector('button[name="load-more"]')};function c(){n.fetchImages().then((function(e){var t,a;l.a.success("Take these wonderful pic"),t=e,a=s()(t),o.galleryList.insertAdjacentHTML("beforeend",a)})).catch((function(e){l.a.error("Something went wrong")}))}o.btnLoadMore.setAttribute("disabled",!0),o.form.addEventListener("submit",(function(e){e.preventDefault();var t=e.currentTarget.elements.query;n.searchQuery=t.value,o.galleryList.innerHTML="",n.resetPage(),c(),o.btnLoadMore.removeAttribute("disabled"),t.value=""})),o.btnLoadMore.addEventListener("click",(function(){c();var e=o.galleryList.lastElementChild;window.scroll({behavior:"smooth"}),e.scrollIntoView()})),o.galleryList.addEventListener("click",(function(e){if(e.target===e.currentTarget)return;i.create('<img src="'+e.target.dataset.source+'">').show()}))},OPH6:function(e,t,a){},pZ3e:function(e,t,a){var n=a("mp5j");e.exports=(n.default||n).template({1:function(e,t,a,n,r){e.propertyIsEnumerable;var s,l=null!=t?t:e.nullContext||{},i=e.hooks.helperMissing,o="function",c=e.escapeExpression;return'<li>\r\n    <div class="photo-card">\r\n        <img src="'+c(typeof(s=null!=(s=a.webformatURL||(null!=t?t.webformatURL:t))?s:i)===o?s.call(l,{name:"webformatURL",hash:{},data:r}):s)+'" data-source="'+c(typeof(s=null!=(s=a.largeImageURL||(null!=t?t.largeImageURL:t))?s:i)===o?s.call(l,{name:"largeImageURL",hash:{},data:r}):s)+'" alt="" width="360" height="360" class="card-img" />\r\n        <div class="stats">\r\n            <p class="stats-item">'+c(typeof(s=null!=(s=a.likes||(null!=t?t.likes:t))?s:i)===o?s.call(l,{name:"likes",hash:{},data:r}):s)+'\r\n                <i class="material-icons">thumb_up</i>\r\n            </p>\r\n            <p class="stats-item">'+c(typeof(s=null!=(s=a.views||(null!=t?t.views:t))?s:i)===o?s.call(l,{name:"views",hash:{},data:r}):s)+'\r\n                <i class="material-icons">visibility</i>\r\n            </p>\r\n            <p class="stats-item">'+c(typeof(s=null!=(s=a.comments||(null!=t?t.comments:t))?s:i)===o?s.call(l,{name:"comments",hash:{},data:r}):s)+'\r\n                <i class="material-icons">comment</i>\r\n            </p>\r\n            <p class="stats-item">'+c(typeof(s=null!=(s=a.downloads||(null!=t?t.downloads:t))?s:i)===o?s.call(l,{name:"downloads",hash:{},data:r}):s)+'\r\n                <i class="material-icons">save_alt</i>\r\n            </p>\r\n        </div>\r\n    </div>\r\n</li>\r\n'},compiler:[8,">= 4.3.0"],main:function(e,t,a,n,r){var s;return null!=(s=a.each.call(null!=t?t:e.nullContext||{},t,{name:"each",hash:{},fn:e.program(1,r,0),inverse:e.noop,data:r}))?s:""},useData:!0})}},[["7hx4",1,2]]]);
  //# sourceMappingURL=main.74bb8b9b8720142309bd.js.map