var Cc=Components.classes,Ci=Components.interfaces,Cr=Components.results,Cu=Components.utils,LP_CLASS_ID=Components.ID("01258260-ceed-11de-8a39-0800200c9a66"),LP_CLASS_NAME="LastPass Autocomplete Search",LP_CONTRACT_ID="@mozilla.org/autocomplete/search;1?name=lastpass";function lastpassAutoCompleteResult(a,b,c,d,e){this._searchString=a;this._searchResult=b;this._defaultIndex=c;this._errorDescription=d;this._results=e}
lastpassAutoCompleteResult.prototype={_searchString:"",_searchResult:0,_defaultIndex:0,_errorDescription:"",_results:[],searchString:function(){return this._searchString},searchResult:function(){return this._searchResult},defaultIndex:function(){return this._defaultIndex},errorDescription:function(){return this._errorDescription},matchCount:function(){return this._results.length},getCommentAt:function(a){if(!this._results||a>=this._results.length)return null;return this._results[a].comment},getImageAt:function(a){if(!this._results||
a>=this._results.length)return null;return this._results[a].image},getStyleAt:function(a){if(!this._results||a>=this._results.length)return null;return this._results[a].style},getValueAt:function(a){if(!this._results||a>=this._results.length)return null;return this._results[a].value},removeValueAt:function(){},QueryInterface:function(a){if(!a.equals(Ci.nsIAutoCompleteResult)&&!a.equals(Ci.nsISupports))throw Components.results.NS_ERROR_NO_INTERFACE;return this}};
function lastpassAutoCompleteSearch(){}
lastpassAutoCompleteSearch.prototype={classDescription:LP_CLASS_NAME,ContractID:LP_CONTRACT_ID,classID:LP_CLASS_ID,_listener:null,_results:null,_searchString:null,startSearch:function(a,b,c,d){try{this._searchString=a;this._listener=d;if(this._timer)this._timer.cancel();else this._timer=Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);this._results=Components.classes["@lastpass.com/lastpass;1"].getService().wrappedJSObject.autocomplete_search(a);this.processResult()}catch(e){}},processResult:function(){try{this._timer.initWithCallback(this,
100,Ci.nsITimer.TYPE_ONE_SHOT)}catch(a){}},notify:function(){try{this._results.length>0?this._listener.onSearchResult(this,new lastpassAutoCompleteResult(this._searchString,Ci.nsIAutoCompleteResult.RESULT_SUCCESS,0,"",this._results)):this._listener.onSearchResult(this,new lastpassAutoCompleteResult(this._searchString,Ci.nsIAutoCompleteResult.RESULT_NOMATCH,0,"",this._results))}catch(a){}},stopSearch:function(){},QueryInterface:function(a){if(!a.equals(Ci.nsIAutoCompleteSearch)&&!a.equals(Ci.nsISupports))throw Components.results.NS_ERROR_NO_INTERFACE;
return this}};
var lastpassAutoCompleteSearchFactory={singleton:null,createInstance:function(a,b){if(a!=null)throw Components.results.NS_ERROR_NO_AGGREGATION;if(this.singleton==null)this.singleton=new lastpassAutoCompleteSearch;return this.singleton.QueryInterface(b)}},lastpassAutoCompleteSearchModule={registerSelf:function(a,b,c,d){a=a.QueryInterface(Components.interfaces.nsIComponentRegistrar);a.registerFactoryLocation(LP_CLASS_ID,LP_CLASS_NAME,LP_CONTRACT_ID,b,c,d)},unregisterSelf:function(a,b){a=a.QueryInterface(Components.interfaces.nsIComponentRegistrar);
a.unregisterFactoryLocation(LP_CLASS_ID,b)},getClassObject:function(a,b,c){if(!c.equals(Components.interfaces.nsIFactory))throw Components.results.NS_ERROR_NOT_IMPLEMENTED;if(b.equals(LP_CLASS_ID))return lastpassAutoCompleteSearchFactory;throw Components.results.NS_ERROR_NO_INTERFACE;},canUnload:function(){return true}};function NSGetModule(){return lastpassAutoCompleteSearchModule};
