(window.webpackJsonp=window.webpackJsonp||[]).push([[196],{1075:function(e,r,t){"use strict";t.r(r);var o=t(7),n=(t(29),t(17),t(33),t(8),t(351),t(34),t(122),{asyncData:function(e){return Object(o.a)(regeneratorRuntime.mark((function r(){var t,o,n,l,c,d,h,f,v,m,y,k,x,w;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return f=e.store,v=e.params,m=e.redirect,y=e.query,k=e.app,x=v.library,r.next=4,f.dispatch("libraries/fetch",x);case 4:if(r.sent){r.next=7;break}return r.abrupt("return",m("/oops?message=Library not found"));case 7:return r.next=9,k.$axios.$get("/api/libraries/".concat(x,"/search?q=").concat(encodeURIComponent(y.q))).catch((function(e){return console.error("Failed to search library",e),null}));case 9:return w=r.sent,w={podcasts:(null===(t=w)||void 0===t?void 0:t.podcast)||[],episodes:(null===(o=w)||void 0===o?void 0:o.episodes)||[],books:(null===(n=w)||void 0===n?void 0:n.book)||[],authors:(null===(l=w)||void 0===l?void 0:l.authors)||[],series:(null===(c=w)||void 0===c?void 0:c.series)||[],tags:(null===(d=w)||void 0===d?void 0:d.tags)||[],narrators:(null===(h=w)||void 0===h?void 0:h.narrators)||[]},r.abrupt("return",{libraryId:x,results:w,query:y.q});case 12:case"end":return r.stop()}}),r)})))()},data:function(){return{}},watch:{"$route.query":function(e,r){e&&e.q&&e.q!==this.query&&(this.query=e.q,this.search())}},computed:{streamLibraryItem:function(){return this.$store.state.streamLibraryItem},hasResults:function(){return Object.values(this.results).find((function(e){return!!e&&e.length}))}},methods:{search:function(){var e=this;return Object(o.a)(regeneratorRuntime.mark((function r(){var t;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,e.$axios.$get("/api/libraries/".concat(e.libraryId,"/search?q=").concat(encodeURIComponent(e.query))).catch((function(e){return console.error("Failed to search library",e),null}));case 2:t=r.sent,e.results={podcasts:(null==t?void 0:t.podcast)||[],episodes:(null==t?void 0:t.episodes)||[],books:(null==t?void 0:t.book)||[],authors:(null==t?void 0:t.authors)||[],series:(null==t?void 0:t.series)||[],tags:(null==t?void 0:t.tags)||[],narrators:(null==t?void 0:t.narrators)||[]},e.$nextTick((function(){e.$refs.bookshelf&&e.$refs.bookshelf.setShelvesFromSearch()}));case 5:case"end":return r.stop()}}),r)})))()}},mounted:function(){},beforeDestroy:function(){}}),l=t(4),component=Object(l.a)(n,(function(){var e=this,r=e._self._c;return r("div",{staticClass:"page",class:e.streamLibraryItem?"streaming":""},[r("app-book-shelf-toolbar",{attrs:{"is-home":"",page:"search","search-query":e.query}}),e._v(" "),e.hasResults?r("app-book-shelf-categorized",{ref:"bookshelf",attrs:{search:"",results:e.results}}):r("div",{staticClass:"w-full py-16"},[r("p",{staticClass:"text-xl text-center"},[e._v(e._s(e.$getString("MessageNoSearchResultsFor",[e.query])))])])],1)}),[],!1,null,null,null);r.default=component.exports;installComponents(component,{AppBookShelfToolbar:t(690).default,AppBookShelfCategorized:t(866).default})}}]);