define(["baseView","focusManager","inputManager","connectionManager","searchFields","./searchresults","events","emby-scroller"],function(BaseView,focusManager,inputManager,connectionManager,SearchFields,SearchResults,events){"use strict";function SearchView(view,params){BaseView.apply(this,arguments);var self=this;self.searchFields=new SearchFields({serverId:params.serverId||connectionManager.currentApiClient().serverId(),element:view.querySelector(".searchFields")}),self.searchResults=new SearchResults({element:view.querySelector(".searchResults"),serverId:params.serverId||connectionManager.currentApiClient().serverId(),parentId:params.parentId,collectionType:params.collectionType}),events.on(self.searchFields,"search",function(e,value){self.searchResults.search(value)}),inputManager.on(view,function(e){"search"===e.detail.command&&(focusManager.focus(view.querySelector(".searchfields-txtSearch")),e.preventDefault())})}return Object.assign(SearchView.prototype,BaseView.prototype),SearchView.prototype.onPause=function(){BaseView.prototype.onPause.apply(this,arguments),this.searchFields&&this.searchFields.pause()},SearchView.prototype.onResume=function(){BaseView.prototype.onResume.apply(this,arguments),this.searchFields&&this.searchFields.resume()},SearchView.prototype.destroy=function(){BaseView.prototype.destroy.apply(this,arguments),this.searchFields&&(this.searchFields.destroy(),this.searchFields=null),this.searchResults&&(this.searchResults.destroy(),this.searchResults=null)},SearchView});