var __extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),AutoSuggest;(function(n){function f(t,r,u,f,e,o,s,h){i(t,r,u,function(t){var i=null;t.status==200&&(i=t.responseText?n.safeExecute(function(){return JSON.parse(t.responseText)},"JSON.parse"):{success:!0});f(i)},e,o,s,h)}function i(i,r,u,f,e,o,s,h,c){var l=c&&_w.XMLHttpRequest?new XMLHttpRequest:sj_gx(),v,a;try{l.open(u?"POST":"GET",i,!0)}catch(y){SharedLogHelper.LogError("fetchUrl",i,y);f&&f({responseText:"",contentType:"",status:-1,result:3});return}if(r)for(v in r)l.setRequestHeader(v,r[v]);e&&(a=e.register(function(){return l.abort()},!1,"xhr abort"));n.config.useEventListeners?(l.addEventListener("load",function(){t(l,0,f,a,e,o)}),l.addEventListener("timeout",function(){t(l,1,f,a,e,o)}),l.addEventListener("abort",function(){t(l,2,f,a,e,o)}),l.addEventListener("error",function(){t(l,3,f,a,e,o)})):(l.onreadystatechange=function(){l.readyState==4&&l.status>0&&t(l,0,f,a,e,o)},l.ontimeout=function(){return t(l,1,f,a,e,o)},l.onabort=function(){return t(l,2,f,a,e,o)},l.onerror=function(){return t(l,3,f,a,e,o)});typeof s!="undefined"?l.withCredentials=s:l.withCredentials!==undefined&&(l.withCredentials=!0);h&&h>0&&(l.timeout=h);l.send(u)}function t(n,t,i,r,u,f){(!f||f())&&(n.readyState==4&&(n.onreadystatechange=function(){}),r&&u.unregister(r),i&&i({responseText:n.responseText,contentType:n.getResponseHeader("content-type")||"",status:n.status,result:t}))}function e(n){var t=n.IconContent;return t?t[0]=="S"?{content:t.slice(1),type:1}:{content:t,type:2}:n.Icon?{content:n.Icon,type:0}:null}var r,u;n.fetchUrlJson=f;n.fetchUrl=i;r=function(){function t(t){this._dataSource=t;this._delay=n.config.webDataSourcesWithThrottling[t]||0;this._timers=[]}return t.prototype.getBaseUrl=function(){throw new Error("Not Implemented");},t.prototype.getPostBody=function(){return undefined},t.prototype.onBeforeFetchUrl=function(){},t.prototype.createUrl=function(t){return decodeURIComponent(this.getBaseUrl())+(t?n.encodeQueryParameter(t.queryToFetch.toLowerCase()):"")},t.prototype.addParamsToUrl=function(n,t){var i=t?Object.keys(t):[];return i.length>0&&(n+=n.includes("?")?"&":"?",n+=i.map(function(n){return n+"="+t[n]}).join("&")),n},t.prototype.fetch=function(t,i,r,u,f,e,o,s,h,c){var p=this,l,v,a,y,w;if(n.isDataSourceEnabled(this._dataSource,t)){if(l=this.addParamsToUrl(this.createUrl(t),e),v=this.getPostBody(t)||"",this._lastSequenceNumber!=r){for(a=0,y=this._timers;a0&&!t.isFormulatedQuery)this._timers.push(n.safeSetTimeout(function(){p.onBeforeFetchUrl(r,l);p.fetchUrl(l,o,v,i,u,f,s,h,c)},this._delay,"fetchDelay"));else{this.onBeforeFetchUrl(r,l);this.fetchUrl(l,o,v,i,u,f,s,h,c)}}},t.prototype.fetchUrl=function(t,r,u,f,e,o,s,h,c){var l=this;i(t,r,u,function(i){var r=i.responseText,o=i.contentType,u=i.status,e;u==200&&(n.config.th&&r&&(r=r.replace(new RegExp("","gm"),"")),r&&o.includes("json")&&(e=n.safeExecute(function(){return JSON.parse(r)},"parseWebProviderResponse",null,t)));f(l._dataSource,e,u==200?null:u.toString())},this._delay>0?e:null,o,h,s,c)},t}();n.JsonDataProvider=r;u=function(t){function i(i,r,u){var f=t.call(this,n.WebDataSource)||this;return f._instrumentationHelper=i,f._responseCacheManager=r,f._headRankingSignalsManager=u,f}return __extends(i,t),i.prototype.getName=function(){return"AsSuggestionsDataProvider"},i.prototype.getBaseUrl=function(){return n.config.u},i.prototype.onBeforeFetchUrl=function(n,t){this._instrumentationHelper.instrumentSnRProviderFetchUrl(n,t)},i.prototype.fetch=function(i,r,u,f,e,o,s){var a=this,c,l,h;if(n.isDataSourceEnabled(this._dataSource,i)){if(this._headRankingSignalsManager&&(c=this._headRankingSignalsManager.get(i),c)){l=this.addParamsToUrl(this.createUrl(i),o);this.onBeforeFetchUrl(u,l);r(this._dataSource,c,null,2);return}h=r;h=function(t,u,f,e){u&&n.isEmptyUrlPrefix(i)&&(u.Suggestions=[]);a.processResourceResponse(u);r(t,u,f,e)};this._responseCacheManager?this.fetchWithCache(i,h,u,f,e,o,s):t.prototype.fetch.call(this,i,h,u,f,e,o,s)}},i.prototype.fetchWithCache=function(n,i,r,u,f,e,o){var h=this,c=this._responseCacheManager.get(n),l,a,s;if(c){l=this.addParamsToUrl(this.createUrl(n),e);this.onBeforeFetchUrl(r,l);i(this._dataSource,c,null,1)}else a=function(){return!0},s=i,s=function(t,r,u){f()&&i(t,r,u,0);n.queryToFetch&&h.responseIsValidForCaching(u,r)&&(r.ELToken&&(r=Object.assign({},r),delete r.ELToken),h._responseCacheManager.put(n,r))},t.prototype.fetch.call(this,n,s,r,u,a,e,o)},i.prototype.responseIsValidForCaching=function(n,t){var i="HS";return!n&&t&&t.Suggestions.every(function(n){return!n.InstantAnswer&&n.Attributes.stype!=i})},i.prototype.processResourceResponse=function(n){var t,i;n&&(t=n.Resources,t)&&(this._downloadedStylesResources?this.updateWithDownloadedResources(t):this._downloadedStylesResources=t.Styles,i={Styles:t.Styles,Scripts:null},JsonInject.WriteHeadAndBeforeContentResources(i))},i.prototype.updateWithDownloadedResources=function(n){var t,i;for(t in n.Styles)for(i in n.Styles[t])this._downloadedStylesResources[t][i]?delete n.Styles[t][i]:this._downloadedStylesResources[t][i]=n.Styles[t][i]},i}(r);n.AsSuggestionsDataProvider=u;n.getIconFromOnlineResponse=e})(AutoSuggest||(AutoSuggest={})),function(n){var t;(function(t){function f(n,t,i,r,f){typeof indexedDB!="undefined"&&new u(n,f,t,i,r)}function e(n,t,i,r,f){typeof indexedDB!="undefined"&&new u(n,f,t,i,r)}function o(n,t,i,r,f,e){typeof indexedDB!="undefined"&&new u(n,e,t,i,r,f)}function s(n,t,i,r,f,e){typeof indexedDB!="undefined"&&new u(n,e,t,i,r,f)}function h(n,t,u){i(n,"deleteDatabase requested");try{var f=indexedDB.deleteDatabase(n);f.onsuccess=function(){i(n,"deleteDatabase completed");t&&t()};f.onerror=r("deleteDatabase.onError",function(t){SharedLogHelper.LogError("deleteDB",n,t);u&&u(t)})}catch(e){u&&u(e)}}function r(n,t){return function(i){var r=n;try{r+=" "+i.target.error.name}catch(u){}t(new Error(r))}}var i,u;t.instanceWithNumberKeys=f;t.instanceWithStringKeys=e;t.instanceWithNumberKeysAndSecondaryKey=o;t.instanceWithStringKeysAndSecondaryKey=s;i=n.config.th&&ClientTestHooks.isTesthookParamSet("dbTrace")?function(t,i){return n.log("["+t+"] "+i)}:function(){};t.deleteDatabase=h;t.handleErrorEvent=r;u=function(){function t(n,u,f,e,o,s){var h=this,c;this._databaseName=n;this.onClosed=o;this._secondaryIndex=s;this._closePending=!1;this._storeName=n+"Store";i(this._databaseName,"open requested");try{c=indexedDB.open(n,u||1)}catch(l){e(new Error("IndexedDbClientSideStorage.const: Could not open database"));return}c.onsuccess=function(n){h._database=n.target.result;t._allInstances.push(h);i(h._databaseName,"open completed");f(h)};c.onupgradeneeded=function(n){var t,r;i(h._databaseName,"upgrading");t=n.target.result;t.objectStoreNames.contains(h._storeName)&&t.deleteObjectStore(h._storeName);r=t.createObjectStore(h._storeName);h._secondaryIndex&&r.createIndex(h._secondaryIndex,h._secondaryIndex,{unique:!1})};c.onerror=r("open.onError",e);c.onblocked=r("open.onBlocked",e)}return t.prototype.put=function(n,t,i,r){this.safeDbOperation("put",n.toString(),"readwrite",i,function(i,r,u){var f=i.put(t,n);f.onsuccess=r;f.onerror=u},r)},t.prototype.putMultiple=function(n,t,i){this.safeDbOperation("putMultiple",n.length.toString(),"readwrite",t,function(t,i,r){var u=0,f=function(){if(u0)i(this._databaseName,"delaying close because of "+t._requestsInProgress+" requests in progress"),this._closePending=!0;else for(f=function(t){t._database&&(n.safeExecute(function(){return t._database.close()},e._databaseName+".close"),i(t._databaseName,"close completed"),t._database=null,t.onClosed())},e=this,r=0,u=t._allInstances;r3&&(f.autoOpenPreviewPaneWhenOnTopHit=!!l.previewPaneLaunchCount);h=s.title||s.secondaryText;i.isSearchHomeZI&&h?(f.additionalInfoText=s.url,f.text=HitHighlightingParser.removeMarkers(h)):f.primaryMetadata=h;t.setUrlSuggestionProperties(f,i,u,s.url,this._host);break;default:return SharedLogHelper.LogError("parseMruWebSuggestion",null,new Error("Unexpected handoff type: "+e.handoffType)),null}return t.isValidSuggestion(f,"parseMruWebSuggestion")?(this.setupRemoveFromHistoryContextMenu(f,r,this._host),f):null},i.prototype.setupRemoveFromHistoryContextMenu=function(n,i,r){var u=this;t.RuntimeConfig.QfMode!=5&&t.RuntimeConfig.QfMode!=9&&i.remove&&t.setExtraVerbs(n,function(t){if(t||!i.remove)return[];if(!n.removeIcon&&n.duplicates&&n.duplicates.some(function(n){return!n.fromHistory}))return[];var f={verb:"RemoveFromDeviceHistory",displayName:r.getLocString("RemoveFromDeviceHistory"),executeSync:function(){i.remove(function(){r.refreshCurrentPane();u._temporaryMessageHandler.showTemporaryMessage(r.getLocString("RemovedFromDeviceHistory",HitHighlightingParser.removeMarkers(n.text)))});delete i.remove},icon:{content:"",type:2}};return[f]},!0)},i}();t.MRUParser=i})(t=n.WSB||(n.WSB={}))}(AutoSuggest||(AutoSuggest={}));__extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var t;(function(t){var i="LastUpdated",r=function(t){function r(r,u,f,e,o,s,h,c){var l=this;r&&r.bindItemLaunch(function(n,t,i){return l.onLaunch(n,t,i)});var a,v=function(t,r,f){return u(s,function(i){t(i);var r=n.getTimeDiffInDays(a);(r===null||r>=1)&&(a=n.getCurrentDate(),l.prune())},r,f,i)},y=function(t,i,r){return n.config.th&&typeof n.MockedMRUData=="object"&&(i=n.MockedMRUData),n.safeExecute(function(){return l.createMruResponse(t,i,r)},"createMruResponse")},p=function(){return!0},w=function(n){return n=="R"?undefined:n};return f.bindClearMRURequested(function(t){l.teardownStorage();n.ClientSideStorage.deleteDatabase(s,function(){return t(!0)},function(){return t(!1)})}),l=t.call(this,v,y,p,w,n.MRUDataSource,f)||this,l.candidatesEnabled=h,l.loggingEnabled=c,l.getSuggestionKey=e,l.getGroupType=o,l._pendingWrites=[],l}return __extends(r,t),r.prototype.getName=function(){return"MRUDataProvider"},r.prototype.shouldStoreSuggestions=function(){return n.config.historySettingsPresent&&this.candidatesEnabled()},r.prototype.createMruResponse=function(t,i,r){var c=this,f,s,u,o,h;if(i=i||[],f=this.getKey(t),this._lastKey=r?f:null,s=r?i.find(function(n){return n.key==f}):null,this._valueForLastKey=s?s.value:null,u={},n.config.mruSignalsEnabled&&this._valueForLastKey&&(u.SuggestionEngagementData=this._valueForLastKey.SuggestionEngagementData),u.LookupCompletions=i.map(function(n){return{key:n.key,value:n.value.SuggestionEngagementData}}),this.shouldStoreSuggestions()){var e=[],v=this.getOldestDateToKeep(),y=function(n,t){var u,i,r,f;if(t.Suggestions)for(u=function(i){var r=l.getRankingData(t,i);r&&r.lastLaunchTime&&r.lastLaunchTime>=v&&e.push({rankingData:n==l._lastKey?{prefixLaunchCount:r.prefixLaunchCount,lastLaunchTime:r.lastLaunchTime,previewPaneLaunchCount:r.previewPaneLaunchCount,lastPreviewPaneLaunchTime:r.lastPreviewPaneLaunchTime}:r,suggestionData:i,remove:function(t){return c.remove(n,i,t)}})},i=0,r=t.Suggestions;i0&&(u.Suggestions=[],e.sort(function(n,t){return t.rankingData.lastLaunchTime-n.rankingData.lastLaunchTime}),e.forEach(function(n){return c.addToResponseIfNotPresent(u.Suggestions,n)}),f?f.length<=n.config.mruLengthA?u.Suggestions.splice(n.config.maxMruA):f.length<=n.config.mruLengthB&&u.Suggestions.splice(n.config.maxMruB):u.Suggestions.splice(n.config.maxMruZeroInput))}return u},r.removeRankerSignals=function(n,t){return n=="highConfidenceMetaSuggestionScore"||n=="prefetchConfidenceScore"?undefined:t},r.prototype.addToResponseIfNotPresent=function(n,t){var f=JSON.stringify(t.suggestionData,r.removeRankerSignals),i=n.find(function(n){return JSON.stringify(n.suggestionData,r.removeRankerSignals)==f}),u;i?(u=i.remove,i.remove=function(n){return u(function(){return t.remove(n)})},i.rankingData.lastLaunchTime=Math.max(i.rankingData.lastLaunchTime,t.rankingData.lastLaunchTime),i.rankingData.prefixLaunchCount+=t.rankingData.prefixLaunchCount,t.rankingData.previewPaneLaunchCount&&(i.rankingData.previewPaneLaunchCount=(i.rankingData.previewPaneLaunchCount||0)+t.rankingData.previewPaneLaunchCount),t.rankingData.lastPreviewPaneLaunchTime&&(i.rankingData.lastPreviewPaneLaunchTime=i.rankingData.lastPreviewPaneLaunchTime?Math.max(i.rankingData.lastPreviewPaneLaunchTime,t.rankingData.lastPreviewPaneLaunchTime):t.rankingData.lastPreviewPaneLaunchTime)):n.push(t)},r.prototype.addToDataIfNotPresent=function(n,t){var i=JSON.stringify(t,r.removeRankerSignals),u=n.find(function(n){return JSON.stringify(n,r.removeRankerSignals)==i});u||n.push(t)},r.prototype.onAfterWrite=function(){if(this._writing=!1,this._pendingWrites.length>0){var n=this._pendingWrites.shift();n()}else this._tearDownPending&&this.teardownStorage()},r.prototype.teardownStorage=function(){this._writing?this._tearDownPending=!0:(this._tearDownPending=!1,t.prototype.teardownStorage.call(this))},r.prototype.onLaunch=function(n,t,i){var r=this,u;if(this.loggingEnabled()){if(this._writing){this._pendingWrites.push(function(){return r.onLaunch(n,t,i)});return}this._writing=!0;u=this.getKey(t);this._lastKey==u?this.updateAndSaveLaunchData(u,this._valueForLastKey,n,i):this.queryStorage(u,function(t){return r.updateAndSaveLaunchData(u,t,n,i)},function(){return r.onAfterWrite()},function(){return r.onAfterWrite()},function(){return r.onAfterWrite()})}},r.prototype.remove=function(n,t,i){var r=this;if(this._writing){this._pendingWrites.push(function(){return r.remove(n,t,i)});return}this._writing=!0;this._lastKey==n?this.removeAndSaveLaunchData(n,this._valueForLastKey,t,i):this.queryStorage(n,function(u){return r.removeAndSaveLaunchData(n,u,t,i)},function(){return r.onAfterWrite()},function(){return r.onAfterWrite()},function(){return r.onAfterWrite()})},r.getUnixTime=function(n){return n||(n=new Date),Math.round(n.getTime()/1e3)},r.prototype.createOrUpdateDbEntry=function(n,t,i,u){var f,e;return t?(t.LastUpdated=r.getUnixTime(),t.SuggestionEngagementData=t.SuggestionEngagementData||{}):t={LastUpdated:r.getUnixTime(),SuggestionEngagementData:{}},f=this.getSuggestionKey(i),t.SuggestionEngagementData[f]=this.updateMRUEntryClicksAndTime(t.SuggestionEngagementData[f],t.LastUpdated,u),this.getGroupType&&(t.SuggestionEngagementData[f].groupType=this.getGroupType(i)),this.shouldStoreSuggestions()&&(e=i.getMruData(),e&&n&&(t.Suggestions||(t.Suggestions=[]),this.addToDataIfNotPresent(t.Suggestions,e))),t},r.prototype.updateMRUEntryClicksAndTime=function(n,t,i){return n?(n.prefixLaunchCount+=1,n.lastLaunchTime=t):n={prefixLaunchCount:1,lastLaunchTime:t},i&&(n.previewPaneLaunchCount=(n.previewPaneLaunchCount||0)+1,n.lastPreviewPaneLaunchTime=t),n},r.prototype.getOldestDateToKeep=function(){var t=n.getCurrentDate();return t.setDate(t.getDate()-n.config.mruMaxAgeInDays),r.getUnixTime(t)},r.prototype.updateAndSaveLaunchData=function(t,i,r,u){var f=this;if(i=n.safeExecute(function(){return f.createOrUpdateDbEntry(t,i,r,u)},"createOrUpdateDbEntry"),!i){this.onAfterWrite();return}n.safeExecute(function(){return f.removeOldLaunches(i,f.getOldestDateToKeep())},"removeOldLaunches");this._lastKey=t;this._valueForLastKey=i;this.withStorage(function(n){return n.put(t,i,function(){return f.onAfterWrite()},function(n){f.onError(n,"updateAndSaveLaunchData");f.onAfterWrite()})})||this.onAfterWrite()},r.prototype.removeAndSaveLaunchData=function(n,t,i,r){var u=this,e,f;if(!t){SharedLogHelper.LogError("removeAndSaveLaunchData",null,new Error("MRU entry not present"));this.onAfterWrite();return}if(e=JSON.stringify(i),f=(t.Suggestions||[]).findIndex(function(n){return JSON.stringify(n)==e}),f==-1){SharedLogHelper.LogError("removeAndSaveLaunchData",null,new Error("Suggestion not present in MRU"));this.onAfterWrite();return}t.Suggestions.splice(f,1);this._lastKey=n;this._valueForLastKey=t;this.withStorage(function(i){return i.put(n,t,function(){r&&r();u.onAfterWrite()},function(n){u.onError(n,"removeAndSaveLaunchData");u.onAfterWrite()})})||this.onAfterWrite()},r.prototype.getRankingData=function(n,t){return n.SuggestionEngagementData?n.SuggestionEngagementData[t.suggestionKey]:undefined},r.prototype.removeOldLaunches=function(n,t){var i,r,u;if(n.Suggestions)for(i=n.Suggestions.length-1;i>=0;--i)r=this.getRankingData(n,n.Suggestions[i]),u=r?r.lastLaunchTime:null,(!u||u1)throw new Error("Multiple strategies for data source: "+n);else return u[0]}function sr(n){return f||tt(),!!f[n]}function hr(n,t,i){if(!f||!f[i]||t.taskFrame)return!1;var r=s(i,t);return r.sfgaoFilter?!r.sfgaoFilter(n.getProperty("System.SFGAOFlags")):!1}function r(n,t){return n=vi.concat(n),t&&(n=n.concat(yi)),n}function tt(){var y=0,nt=c.deviceSearch.getUserSID(),dt=e(t.getKnownFolderPathLC(t.FOLDERID_Profile)),tt=ni(y,nt,!1),it=tt[0],h=tt[1],rt=ni(y,nt,!0),i=rt[0],n=rt[1];k=it;yt=h;var ft='"System.Kind" != ANY ARRAY['+g.concat("link").map(function(n){return"'"+n+"'"}).join(", ")+"] AND "+it,gt="\"System.Kind\" = SOME ARRAY['program'] AND "+i,s='"System.Kind" != ANY ARRAY['+wt.map(function(n){return"'"+n+"'"}).join(", ")+"] AND "+i,a='"System.Kind" != ANY ARRAY['+pt.concat(g).concat("folder").map(function(n){return"'"+n+"'"}).join(", ")+"] AND "+i,ti="\"System.Kind\" = SOME ARRAY['folder'] AND "+i,et="\"System.Kind\" = SOME ARRAY['Music'] AND "+i,bt="\"System.Kind\" = SOME ARRAY['Picture'] AND "+i,kt='"System.Kind" = SOME ARRAY['+d.map(function(n){return"'"+n+"'"}).join(", ")+"] AND "+i,ii="SCOPE = 'file:"+dt+"' AND \"System.Kind\" = SOME ARRAY['folder'] AND "+i;f={};f.IFF=[{selectFields:r(o,!1),filterFieldsSets:t.config.fileStartsWithShortPrefix?[pi]:[ot],mostRelevantProps:l,kindAndScopeClauses:ft,sortClause:u,searchOptions:3,sfgaoFilter:h,enabled:function(n){return!!n.queryToFetch&&!t.supportsShortcuts("IFF",n)}},{selectFields:r(o,!1),filterFieldsSets:[],mostRelevantProps:l,kindAndScopeClauses:ft,sortClause:u,searchOptions:0,sfgaoFilter:h,enabled:function(n){return!n.queryToFetch&&!t.supportsShortcuts("IFF",n)}},{selectFields:r(st,!0),filterFieldsSets:[wi],mostRelevantProps:l,kindAndScopeClauses:s,sortClause:u,searchOptions:3,sfgaoFilter:n,enabled:function(n){return!!n.queryToFetch&&t.supportsShortcuts("IFF",n)}},{selectFields:r(st,!0),filterFieldsSets:[],mostRelevantProps:l,kindAndScopeClauses:s,sortClause:u,searchOptions:0,sfgaoFilter:n,enabled:function(n){return!n.queryToFetch&&t.supportsShortcuts("IFF",n)}},{selectFields:r(o,!0),filterFieldsSets:[bi],mostRelevantProps:l.concat(["System.Title"]),kindAndScopeClauses:s,sortClause:u,searchOptions:0,sfgaoFilter:n,enabled:function(n){return t.config.indexerQuerySimplified&&n.queryToFetch.length<=8&&!!n.queryToFetch}}];f.MDOC=[{selectFields:r(v,!0),filterFieldsSets:[ht.concat(nr)],mostRelevantProps:p,kindAndScopeClauses:a,sortClause:u,searchOptions:3,sfgaoFilter:n,enabled:function(n){return n.queryToFetch&&t.config.minLengthForContentMatch&&n.queryToFetch.length>=t.config.minLengthForContentMatch}},{selectFields:r(v,!0),filterFieldsSets:[ht],mostRelevantProps:p,kindAndScopeClauses:a,sortClause:u,searchOptions:3,sfgaoFilter:n,enabled:function(n){return n.queryToFetch&&(!t.config.minLengthForContentMatch||n.queryToFetch.length0&&(o+="WITH ("+n.mostRelevantProps.join(", ")+") AS #MRProps "),s=tu(n,t,i,u,f),s&&(o+="("+s+") AND "),r&&(o+="(Scope = '"+r+"') AND "),o+n.kindAndScopeClauses}function dr(n,t){return c.deviceSearch.tokenize(n,t)}function gr(n){return c.getLinguisticDataAsync(n)}function bt(t,i){var r="",u=t.filterFieldsSets.length>1;return t.filterFieldsSets.forEach(function(t){var s,f,h,l,e,o,c,a;for(u&&(r?r+=") AND (":r="("),s=!0,f=0,h=t;f1){for(h="",y=0,b=v;y=2&&(n=n.replace(/%/g,"[%]"),n=n.replace(/_/g,"[_]"),n=n.replace(/\[/g,"[[]"),t==3?(n=n.replace(/\*/g,"%"),n=n.replace(/\?/g,"_")):(n=n.replace(/\*/g," "),n=n.replace(/\?/g," "))),n}function e(n){return kt(n,1)}function rt(n){return kt(n,2)}function uu(n){var t=a[n];if(t)return t;throw new Error("select fields for NL Data source was not found: "+n);}function h(n,t,i){for(var u=[],r=3;r='"+r[0]+"' AND System.DateCreated<'"+r[1]+"'","System.DateModified>='"+r[0]+"' AND System.DateModified<'"+r[1]+"'","System.DateAccessed>='"+r[0]+"' AND System.DateAccessed<'"+r[1]+"'","System.DateArchived>='"+r[0]+"' AND System.DateArchived<'"+r[1]+"'","System.DateAcquired>='"+r[0]+"' AND System.DateAcquired<'"+r[1]+"'",]),{selectFields:uu(n),filterFieldsSets:f,kindAndScopeClauses:e?e+" AND "+k:k,mostRelevantProps:[],searchOptions:0,sortClause:u,sfgaoFilter:yt}}function eu(t){var i,f,u,e,r;return t?(i=t.value,!i)?null:(f=i.indexOf("T"),f!=-1&&(i=i.substr(0,f)),u=i.split("-"),u.length<2||u.length>3)?null:(e=new Date(i),!n.isValidDate(e))?null:(r=new Date(i),u.length==3?r.setUTCDate(r.getUTCDate()+1):r.setUTCMonth(r.getUTCMonth()+1),[gt(e),gt(r)]):null}function gt(n){var t=n.toISOString();return t.substr(0,t.indexOf("T"))}function ni(n,i,r){var u,h,c,f,o,s,l,a,v;r||(u="NOT System.Shell.SFGAOFlagsStrings = SOME ARRAY['hidden'] AND NOT System.Shell.SFGAOFlagsStrings = SOME ARRAY['system'] AND NOT System.Shell.SFGAOFlagsStrings = SOME ARRAY['link']");r?h=function(n){return!(n&hi)&&!(n&si)&&(!!(n&&ci)||n&&ai&&!!(n&&ft)||n&&li&&!!(n&&ft))}:(u+=" AND (System.Shell.SFGAOFlagsStrings = SOME ARRAY['stream']",u+=" OR (System.Shell.SFGAOFlagsStrings = SOME ARRAY['fileanc'] AND System.Shell.SFGAOFlagsStrings = SOME ARRAY['folder'])",u+=" OR (System.Shell.SFGAOFlagsStrings = SOME ARRAY['storageanc'] AND System.Shell.SFGAOFlagsStrings = SOME ARRAY['folder'])",u+=")");r?u="System.Shell.OmitFromView != 'true'":u+=" AND System.Shell.OmitFromView != 'true'";c=e(t.getKnownFolderPathLC(t.FOLDERID_Profile));switch(n){case 0:f=e(t.getKnownFolderPathLC(ri));u+=" AND (Scope = 'file://' OR Scope = 'csc://{"+i+"}') AND (Scope <> 'file:"+c+"\\AppData') AND (Scope <> 'file:"+f+"\\Default\\AppData') AND (Scope <> 'file:"+f+"\\Administrator\\AppData')";o=e(t.getKnownFolderPathLC(ti));s=e(t.getKnownFolderPathLC(ii));u+=" AND (Scope <> 'file:"+o+"')";s!=o&&(u+=" AND (Scope <> 'file:"+s+"')");l=e(t.getKnownFolderPathLC(ui));u+=" AND (Scope <> 'file:"+l+"')";a=e(t.getKnownFolderPathLC(fi));u+=" AND (Scope <> 'file:"+a+"')";r&&(v=e(t.getKnownFolderPathLC(ei)),u+=" AND (Scope <> 'file:"+v+"')");break;case 1:u+=" AND (Scope = 'file://' OR Scope = 'csc://{"+i+"}')";break;default:throw new Error("Unknown SearchScope: "+n);}return[u,h]}var c=SearchAppWrapper.CortanaApp.queryFormulationView,ut="PRIME",ti="{905e63b6-c1bf-494e-b29c-65b732d3d21a}",ii="{7C5A40EF-A0FB-4BFC-874A-C0F2E0B9FA8E}",ri="{0762D272-C50A-4BB0-A382-697DCD729B80}",ui="{A4115719-D62E-491D-AA7C-E74B8BE3B067}",fi="{0482af6c-08f1-4c34-8c90-e17ec98b1e17}",ei="{bfb9d5e0-c6a9-404c-b2b2-ae6db6af4968}",oi="{FDD39AD0-238F-46AF-ADB4-6C85480369C7}",si=4096,hi=524288,ci=4194304,ft=536870912,li=8388608,ai=268435456,et=3,u='"System.Search.Rank" DESC, "System.DateModified" DESC, "System.ItemNameDisplay" ASC',vi=["System.Kind","System.Search.Rank","System.ParsingPath","System.DateCreated","System.DateModified","System.Search.QueryPropertyHits","System.ItemNameDisplay","System.FileExtension","System.ItemType",],yi=["System.Link.TargetParsingPath","System.SFGAOFlags",],o=["System.Title","System.Music.AlbumTitle","System.Music.DisplayArtist"],l=["System.ItemNameDisplay","System.Music.DisplayArtist","System.Music.AlbumTitle",],ot=["System.ItemNameDisplay = '{0}' RANK BY COERCION(ABSOLUTE, 990)","CONTAINS(System.ItemNameDisplay, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 960)","System.Title = '{0}' RANK BY COERCION(ABSOLUTE, 890)","CONTAINS(System.Title, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 860)","System.Music.DisplayArtist = '{0}' RANK BY COERCION(ABSOLUTE, 790)","CONTAINS(System.Music.DisplayArtist, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 760)","System.Music.AlbumTitle = '{0}' RANK BY COERCION(ABSOLUTE, 690)","CONTAINS(System.Music.AlbumTitle, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 660)",],pi=["System.ItemNameDisplay = '{0}' RANK BY COERCION(ABSOLUTE, 990)","System.ItemNameDisplay LIKE '{0}%' RANK BY COERCION(ABSOLUTE, 960)","System.Title = '{0}' RANK BY COERCION(ABSOLUTE, 890)","CONTAINS(System.Title, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 860)",],st=o.concat("System.DateAccessed"),wi=ot.concat(["CONTAINS(System.Link.TargetParsingPath, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 920)"]),bi=["System.ItemNameDisplay = '{0}' RANK BY COERCION(ABSOLUTE, 990)","CONTAINS(System.ItemNameDisplay, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 960)","System.Title = '{0}' RANK BY COERCION(ABSOLUTE, 890)","CONTAINS(System.Title, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 860)","CONTAINS(System.Link.TargetParsingPath, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 920)",],ki=["System.DateAccessed",],di=["System.ItemNameDisplay",],gi=["System.ItemNameDisplay = '{0}' RANK BY COERCION(ABSOLUTE, 999)","CONTAINS(System.ItemNameDisplay, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 895)","CONTAINS(System.Link.TargetParsingPath, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 795)",],v=["System.Search.AutoSummary","System.Keywords","System.Title","System.Author","System.Document.LastAuthor",],p=["System.ItemNameDisplay","System.Keywords","System.Title",],ht=["System.ItemNameDisplay = '{0}' RANK BY COERCION(ABSOLUTE, 999)","CONTAINS(System.ItemNameDisplay, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 895)","System.Title = '{0}' RANK BY COERCION(ABSOLUTE, 980)","CONTAINS(System.Title, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 875)","System.Keywords = '{0}' RANK BY COERCION(ABSOLUTE, 960)","CONTAINS(System.Keywords, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 855)",],nr="CONTAINS(System.Search.Contents, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 545)",tr=[],ir=["System.ItemNameDisplay",],rr=["System.ItemNameDisplay = '{0}' RANK BY COERCION(ABSOLUTE, 999)","CONTAINS(System.ItemNameDisplay, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 895)",],w=["System.Photo.TagViewAggregate","System.Title",],ct=["System.ItemNameDisplay","System.Photo.TagViewAggregate",],ur=["System.ItemNameDisplay = '{0}' RANK BY COERCION(ABSOLUTE, 999)","CONTAINS(System.ItemNameDisplay, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 895)","System.Title = '{0}' RANK BY COERCION(ABSOLUTE, 980)","CONTAINS(System.Title, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 875)","System.Photo.TagViewAggregate = '{0}' RANK BY COERCION(ABSOLUTE, 940)","CONTAINS(System.Photo.TagViewAggregate, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 835)",],b=["System.Title","System.Keywords","System.Music.DisplayArtist","System.Music.Genre",],lt=["System.ItemNameDisplay","System.Title","System.Keywords",],fr=["System.ItemNameDisplay = '{0}' RANK BY COERCION(ABSOLUTE, 999)","CONTAINS(System.ItemNameDisplay, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 895)","System.Title = '{0}' RANK BY COERCION(ABSOLUTE, 980)","CONTAINS(System.Title, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 875)","System.Music.DisplayArtist = '{0}' RANK BY COERCION(ABSOLUTE, 960)","CONTAINS(System.Music.DisplayArtist, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 855)","System.Music.Genre = '{0}' RANK BY COERCION(ABSOLUTE, 950)","CONTAINS(System.Music.Genre, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 845)","System.Keywords = '{0}' RANK BY COERCION(ABSOLUTE, 940)","CONTAINS(System.Keywords, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 835)",],at=["System.Title","System.Music.DisplayArtist","System.Music.AlbumTitle","System.Music.Genre",],vt=["System.ItemNameDisplay","System.Title","System.Music.AlbumTitle",],er=["System.ItemNameDisplay = '{0}' RANK BY COERCION(ABSOLUTE, 999)","CONTAINS(System.ItemNameDisplay, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 895)","System.Title = '{0}' RANK BY COERCION(ABSOLUTE, 980)","CONTAINS(System.Title, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 875)","System.Music.AlbumTitle = '{0}' RANK BY COERCION(ABSOLUTE, 970)","CONTAINS(System.Music.AlbumTitle, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 865)","System.Music.DisplayArtist = '{0}' RANK BY COERCION(ABSOLUTE, 960)","CONTAINS(System.Music.DisplayArtist, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 855)","System.Music.Genre = '{0}' RANK BY COERCION(ABSOLUTE, 950)","CONTAINS(System.Music.Genre, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 845)",],or=["path = '{0}'"],f,a,dt;i.getStrategy=s;i.dataSourceSupported=sr;i.suppress=hr;var k,yt,d=["Movie","RecordedTV","Video"],pt=d.concat(["Picture","Music"]),wt=["calendar","game","web history","feed","contact","task","journal","note","instantmessage"],g=wt.concat("program"),nt=pt.concat(g).concat(["folder","link"]).map(function(n){return"'"+n+"'"}).join(",");i.initStrategies=tt;i.generateIndexerQueryAsync=cr;i.generateIndexerQueryForMRUFilesAndFolders=lr;i.generateIndexerQueryForDeviceItemCache=ar;i.generateIndexerPrimerQuery=vr;i.fixKind=pr;a={};a.MPHO=r(w,!1);a.MVID=r(b,!1);a.MDOC=r(v,!1);dt=function(){var n={};return n.Powerpoint="ppt",n.Word="doc",n.Excel="xls",n}()})(i=t.IndexerQueryGenerator||(t.IndexerQueryGenerator={}))})(t=n.WSB||(n.WSB={}))}(AutoSuggest||(AutoSuggest={})),function(n){var t;(function(t){function a(n,i,r,u,f,e,o){var s=u?r+" "+i:r;return t.Promise.safeChainWithGlobalCaching("getIcon",function(i){return n.getImageAsync(t.getImageSizeValue(i))},function(n){return n+"_"+i},function(n){return t.toIcon(n,"getIcon",e,o,s)},e,f?function(){return n.imageType===0}:null,s)}function r(n,i,r,u,f,e){return{deviceItem:n,getIcon:a(n,n.id,r,r&&!t.localDataSourceMayContainPII(r),t.displayedInGridLayout(i),u,f),icon:e?u:null,suggestionType:i}}function v(n,t,i){return{deviceItem:n,icon:i,suggestionType:t}}function at(n){return n.map(function(n){return{isSimulated:!0,displayName:n,id:null,kind:null,getProperty:null,propertyHits:null,rankScore:null}})}function vt(){var r=n.getCurrentTime(),u=i.deviceSearch.getAllAppsAsync();return u.then(function(i){var u=[],f,r;for(f in i)(r=i[f],r)&&(t.config.allowZeroLaunchTopApps||r.totalLaunches>0)&&!n.contains(lt,r.id)&&u.push(r);return t.config.minTopApps&&u.length0&&(i=i.filter(function(t){return!n.contains(v,t)}));a=function(n){for(var i,f,t=0,u=v;t=0;--c)l=i[c],h.hasOwnProperty(l)&&(r[l]=h[l],n.splice(c,1));n.length==0?a(r):(v=!s||t.localDataSourceMayContainPII(s)?s:s+" "+n,t.Promise.safeChain(u,function(){return f(n)},function(u){var o=t.Map.map(n,u,function(n){return e(n)}),f;if(h&&n.forEach(function(n){return h[n]=o[n]}),n.length!=i.length)for(f in r)r.hasOwnProperty(f)&&(o[f]=r[f]);a(o)},function(){return a({})},o,v))}},"resolveIdsWithCache",null,s,function(){return a({})})}function bt(n,t){if(!t.launchArguments||wt.test(n.query))return!0;var i=t.id.toLowerCase();return rt.some(function(n){return i.includes(n)})?!0:!1}function ut(n,i,r,u,f){if(!f)return!1;var o=n.displayName.toLocaleLowerCase(),e=i.queryToFetch.toLocaleLowerCase(),s=null;if(f.Parses&&f.Parses.length>0&&f.Parses[0].SubParses&&f.Parses[0].SubParses.length>1&&f.Parses[0].SubParses[0].Interpretation&&f.Parses[0].SubParses[0].Interpretation==="regex"&&e.length>=f.Parses[0].SubParses[0].QueryEnd&&f.Query!=null){if(e.length===f.Parses[0].SubParses[0].QueryEnd)return!0;e=e.substr(f.Parses[0].SubParses[0].QueryEnd+1);f.Query=f.Query.substr(f.Parses[0].SubParses[0].QueryEnd+1)}return e.length=t.config.filterCICandidatesPrefixLength?!1:(o=e.Query,o.startsWith(i))?!1:t.config.bypassCIFilterOnSubstringMatch&&n.split(" ").some(function(n){return n.startsWith(i)})?!1:(s=n.startsWith(o),!s)?!0:f.Counter>=t.config.maxCISpellCorrectionCandidates?!0:(f.Counter++,!1)}function ft(n,t){var r,i;if(!!t&&t.length==0||(r=t.split(" "),n.length!=r.length))return!1;for(i=0;i0&&n.queryToFetch&&(u=t.escapeRegExp(n.queryToFetch),f=u.split(" ").map(function(n){return new RegExp("^"+n+"| "+n,"i")}),r=r.filter(function(n){return f.every(function(t){return t.test(n)})}));e=at(r);i(e)})},getResults:function(n){return n},dataSource:"FEH",getSuggestionType:function(){return"FEH"},customCreateLocalResponseSuggestion:function(n,t){return v(n,t,{type:2,content:""})},supportsEmptyQuery:!0},{getResultsContainer:function(){return vt()},getResults:function(n,t){return n.then(function(n){return t?n.slice(0,t):n})},dataSource:"TOPP",getSuggestionType:function(){return"TOPL"},customGetMax:function(){return 5},customCreateLocalResponseSuggestion:function(n,i,u){return r(n,i,u,t.ScopeConfig[t.Scope.Apps].icon,t.config.backplateAllIconsInZI||n.isImmersive?n.logoBackgroundColor:undefined)},supportsEmptyQuery:!0},{getResultsContainer:function(n){return ThresholdUtilities.createPromise(function(t){var i=o.retrieveItemsFromCache(n.queryToFetch);t(i)})},getResults:function(n){return n},dataSource:"LDIC",getSuggestionType:function(n){return u(n.kind,n.extension,"FD")},maxUpTo3chars:4,maxAfter3chars:7,maxAfter8charsOrInL2ZeroInput:15,supportsEmptyQuery:!1},],nt=[{getResultsContainer:function(n){return i.startCommandLineQuery(n.originalQuery,"")},dataSource:"CG",getSuggestionType:function(){return"CG"},customCancellation:function(){return i.cancelLastCommandLineQuery()},supportsEmptyQuery:!1},];t.LocalDataProviderDataSources=k.concat(d).concat(g).concat(nt).map(function(n){return n.dataSource});var e={suggestions:[],maxedOut:!1},tt={},o,it={"shell:RecycleBinFolder":{icon:{content:"",type:2},locStringKey:"RecycleBin"}};var yt=["\\system32\\user.exe","\\system32\\sidebar.exe","\\system32\\at.exe","\\system32\\change.exe","\\system32\\control.exe","\\system32\\find.exe","\\system32\\net.exe","\\system32\\share.exe","\\system32\\rundll32.exe","\\system32\\append.exe","\\system32\\choice.exe","\\system32\\clip.exe","\\system32\\comp.exe","\\system32\\compact.exe","\\system32\\consent.exe","\\system32\\convert.exe","\\system32\\format.exe","\\system32\\graphics.com","\\system32\\label.exe","\\system32\\mem.exe","\\system32\\mode.com","\\system32\\more.com","\\system32\\recover.exe","\\system32\\replace.exe","\\system32\\reset.exe","\\system32\\shadow.exe","\\system32\\sort.exe","\\system32\\tree.com","\\system32\\webcam.exe","\\system32\\systemsettings.exe","\\system32\\command.com","\\system32\\tabtip.exe","\\system32\\services.exe","\\system32\\help.exe","\\system32\\where.exe","\\system32\\skydrive.exe","\\system32\\calc.exe","\\system32\\fc.exe","\\accessories\\wordpad.exe",t.config.blacklistNotepadCommand?"\\system32\\notepad.exe":null,].filter(function(n){return!!n}),rt=["\\system32\\finger.exe","\\system32\\ping.exe","\\system32\\print.exe","\\system32\\shutdown.exe","\\system32\\expand.exe","\\system32\\tskill.exe","\\system32\\reg.exe","\\system32\\sc.exe",],pt=["uninstall","outlook","excel","skype","nero","onenote","lync","vmware","firefox","itunes","photoshop","print","opera","visio","thunderbird","smartscreen"],wt=/[\/\.\-\\]/;t.isRealCommand=bt;var kt=["Microsoft.Cortana_8wekyb3d8bbwe!CortanaUI","Microsoft.Windows.Cortana_cw5n1h2txyewy!CortanaUI",],dt=[".dll",".pdb",".obj",".bin",".etl",".bak",".config",".resx",".manifest",".ini",".searchconnector-ms",".settingcontent-ms",".vstx",".vssx",".ms-one-stub",],gt=["visio content","bin","debug","obj","objd","amd64","x86","microsoftedgebackups",];t.isInitials=ft;t.getSuggestionTypeOverride=ot;t.parseConstraintIndexMetaData=st;t.isSuppressed=ht;ct=function(){function f(n,t,i){var r=this;this._previousKeystrokeCache=n;this._host=i;t&&(o=t,i.bindShown(function(){o.clean();r.cacheDeviceItems()}));i.bindAppHidden(function(){tt={}})}return f.prototype.getName=function(){return"LocalDataProvider"},f.setWhereId=function(n){f.whereId=n},f.prototype.fetch=function(r,u,e,o,c){var ft=this,a,v,et,p,ot,l,w,b,st,tt,lt,at,it,ht,rt,vt,yt,ut,ct,y;if(o&&o.register(function(){return t.Promise.clearPendingItemsFromCache()},!1,"clearPendingItemsFromCache"),a=[],v=k.filter(function(t){return n.isDataSourceEnabled(t.dataSource,r)}),t.IndexerQueryGenerator&&(a=a.concat(v.filter(function(n){return t.IndexerQueryGenerator.dataSourceSupported(n.dataSource)})),v=v.filter(function(n){return!t.IndexerQueryGenerator.dataSourceSupported(n.dataSource)})),v.length>0){if(!r.queryToFetch&&!v.every(function(n){return n.supportsEmptyQuery}))throw new Error(s);if(o&&o.register(function(){return i.cancelLastDeviceQuery()},!1,"cancelLastDeviceQuery"),et=n.safeExecute(function(){return i.startDeviceQuery(r.queryToFetch)},"startDeviceQuery",null,r.queryToFetch),et)for(p=0,ot=v;p0){if(!r.queryToFetch&&!l.every(function(n){return n.supportsEmptyQuery}))throw new Error(s);w=r.taskFrame?r.taskFrame.raw:"";t.Promise.safeChain("executeSearchAsync",function(){return h.searchResultsView.executeSearchAsync(r.queryToFetch,w)},function(n){var t,i,e;if(c())if(n)for(t=0,i=l;t0){if(f.lastQuery&&!r.fullPartialQuery.startsWith(f.lastQuery)&&f.setWhereId(null),f.lastQuery=r.fullPartialQuery,!r.queryToFetch&&!a.every(function(n){return n.supportsEmptyQuery}))throw new Error(s);for(b=0,st=a;b0){if(!r.queryToFetch&&!tt.every(function(n){return n.supportsEmptyQuery}))throw new Error(s);for(lt=function(n){o&&n.customCancellation&&o.register(function(){return n.customCancellation()},!0,n.dataSource+" cancellation");at.searchFolderWithMultipleResults(r,n,r,u,c,o,f.whereId)},at=this,it=0,ht=tt;it0){if(!r.queryToFetch&&!rt.every(function(n){return n.supportsEmptyQuery}))throw new Error(s);for(vt=function(n){o&&n.customCancellation&&o.register(function(){return n.customCancellation()},!0,n.dataSource+" cancellation");yt.searchFolderWithSingleResult(r,n,r,u,c)},yt=this,ut=0,ct=rt;ut8?i.maxAfter8charsOrInL2ZeroInput:n.queryToFetch.length>3?i.maxAfter3chars:i.maxUpTo3chars},f.prototype.toLocalResponse=function(n,i,u,f,e){var y,p,a,w,o,v;e&&(p=f,p.getGroupDisplayName&&(y=p.getGroupDisplayName(e)));var k={Counter:0},b=[],d=u.length=t.config.enableCISpellerAtPrefixLength&&this._previousKeystrokeCache&&this._previousKeystrokeCache.enableCISpeller(n.queryToFetch)?!0:n.queryToFetch.length>=t.config.enableCISpellerAtPrefixLength&&t.config.enableCISpeller==1?!0:!1},f.prototype.searchFolderWithMultipleResults=function(r,u,o,s,h,c,l){var w=this,a=u.dataSource,b=this.getMax(r,u),v=!o,k,y,p;if(v){if(t.RuntimeConfig.QfMode==5&&(p=this._host.getFileExplorerCurrentPath()),p&&!/^[a-zA-Z]\:\\/.test(p)){s(a,e,null,null,!0);return}k=function(){return t.IndexerQueryGenerator.generateIndexerQueryAsync(r,p,b,a,l).then(function(n){return i.deviceSearch.queryWindowsSearchIndexerAsync(n)})}}else{if(y=n.safeExecute(function(){return u.getResultsContainer(o)},"getResultsContainer "+a),!y){s(a,e,null);return}k=function(){return w.getResults(r,b,y,u)}}t.Promise.safeChain(v?"queryWindowsSearchIndexerAsync":"getItemsAsync",k,function(n){var i,e,o;h()&&(i=n.resultSet,e=void 0,f.setWhereId(n.whereId),i?e=n.state:i=typeof n.length=="undefined"?Object.keys(n).map(function(t){return n[t]}):n,v&&t.supportsShortcuts(a,r)&&(i=i.map(function(n){return t.IndexerQueryGenerator.fixKind(n)})),o=f.getDataSourceState(e),s(a,w.toLocalResponse(b,r,i,u,y),o))},function(t){n.isCancellation(t)||w.logProviderFailure(a);s(a,e,null)},v?c:null,a+" "+r.queryToFetch)},f.prototype.searchFolderWithSingleResult=function(i,r,u,f,o){var h=this,s=r.dataSource,c=n.safeExecute(function(){return r.getResultsContainer(u)},"getResultsContainer "+s);c?t.Promise.safeChain("tryGetResultAsync "+s,function(){return c.tryGetResultAsync()},function(n){o()&&f(s,h.toLocalResponse(1,i,n?[n]:[],r,null),null)},function(t){n.isCancellation(t)||h.logProviderFailure(s);f(s,e,null)},null,i.queryToFetch):f(s,e,null)},f.prototype.logProviderFailure=function(r){var u=t.providerFailureLogName(r);u&&i.logProviderFailure&&n.safeExecute(function(){return i.logProviderFailure(u,"ErrorForTopHit")},"logProviderFailure")},f.prototype.cacheDeviceItems=function(){var n="LDIC",r=function(){var r=t.IndexerQueryGenerator.generateIndexerQueryForDeviceItemCache(n,f.whereId);return i.deviceSearch.queryWindowsSearchIndexerAsync(r)};o.setReady(!1);t.Promise.safeChain("initializeDeviceItemCacheAsync",r,function(n){var t,i,r;for(f.setWhereId(n.whereId),t=0,i=n.resultSet;t0&&--this._currentScopeTileIndex;t.shouldSkipSelectedScope()&&(this._currentScopeTileIndex=r.indexOf(u[this._currentScopeTileIndex]));this._menuFactory.dismiss();r[this._currentScopeTileIndex].focus()},h.prototype.render=function(n,i,r,u,f){if(this._currentQuery=n,n){var e=t.getEffectiveScope(n);this.innerRender(n.scope,e,n,i,r,u,f)}else this.cleanUp()},h.prototype.getScopeToolTip=function(n,i){var u=t.ScopeConfig[n],f=t.getScopeDisplayName(u,this._host),r;return r=i&&!this._allScopeButtonPresent?"RemovingScopeNarratorText2":n==t.Scope.All?"AddingScopeNarratorTextAll2":"AddingScopeNarratorText",this._host.getLocString(r,f.toLocaleLowerCase())},h.prototype.selectScope=function(n){var i,r,t;for(this._selectedScope&&(this._selectedScope.tooltip=this.getScopeToolTip(this._selectedScope.type,!1),this._selectedScope.enabled=!1,this._selectedScope=null),i=0,r=this._scopeTiles;i0?{opened:this._moreMenuOpened,buttonClickHandler:function(){return n._moreMenuOpened?n.closeMoreMenuDropDown():n.openMoreMenuDropDown(r)}}:null,optionsMenuDataModel:{opened:this._optionsMenuOpened,buttonClickHandler:function(){return n._optionsMenuOpened?n.closeOptionsMenuDropDown():n.openOptionsMenuDropDown()}},userProfileButtonDataModel:t.config.userProfileButtonEnabled&&f?{opened:this._userProfileMenuOpened,buttonClickHandler:function(){return n._userProfileMenuOpened?n.closeUserProfileDropDown():n.openUserProfileDropDown()},icon:f,userName:e}:null,lockscreenMenuDataModel:{opened:this._lockscreenMenuOpened,buttonClickHandler:function(){return n._lockscreenMenuOpened?n.closeLockscreenMenuDropDown():n.openLockscreenMenuDropDown()}}}},h.prototype.renderScopes=function(){var n=this;(!t.config.optScopesRender||this._currentQuery&&this._currentQuery.scopePrefix||this._selectedScope&&this._selectedScope.selected==!1||this._moreMenuOpened||this._optionsMenuOpened)&&(this._shouldRenderScopes=!0);this._shouldRenderScopes&&(this._page.updateScopesHeaderView(this.getScopesHeaderDataModel()),this._shouldRenderScopes=!1);t.config.EnableWebFlyout&&this._currentQuery&&this._currentQuery.originalQuery.length===0&&this.getScopeBarElements().forEach(function(i){i.type==t.Scope.Web&&n.educationalFlyoutWeb(_ge(i.id))})},h.prototype.educationalFlyoutWeb=function(n){this._page.createFlyout("SearchTheWeb",this._storage).addMessage(this._host.getLocString("WebEducationalFlyoutText")).target(n).show()},h.prototype.openMoreMenuDropDown=function(t){var i=this;this._page.ensureWebViewHeightExpanded();this._menuFactory.showDropdownMenu(t,document.getElementById(this._moreButton.id),1,function(){n.safeSetTimeout(function(){return i.closeMoreMenuDropDown()},0,"closeMoreMenuDropDown")});this._moreMenuOpened=!0;this.renderScopes()},h.prototype.closeMoreMenuDropDown=function(){this._moreMenuOpened=!1;this.renderScopes()},h.prototype.openOptionsMenuDropDown=function(){var u=this,i,r;this._page.ensureWebViewHeightExpanded();i=t.RuntimeConfig.AlwaysWide?1:2;r=this.getAdvancedOptions(this._sequenceNumberReader.getSequenceNumber(),i);this._menuFactory.showDropdownMenu(r,document.getElementById(this._optionsButton.id),2,function(){n.safeSetTimeout(function(){return u.closeOptionsMenuDropDown()},0,"closeOptionsMenuDropDown")});this._optionsMenuOpened=!0;this.renderScopes()},h.prototype.openLockscreenMenuDropDown=function(){var r=this,t,i;this._page.ensureWebViewHeightExpanded();t=3;i=this.getAdvancedOptions(this._sequenceNumberReader.getSequenceNumber(),t);this._menuFactory.showDropdownMenu(i,document.getElementById(this._optionsButton.id),2,function(){n.safeSetTimeout(function(){return r.closeLockscreenMenuDropDown()},0,"closeLockscreenMenuDropDown")});this._lockscreenMenuOpened=!0;this.renderScopes()},h.prototype.closeOptionsMenuDropDown=function(){this._optionsMenuOpened=!1;this.renderScopes()},h.prototype.closeLockscreenMenuDropDown=function(){this._lockscreenMenuOpened=!1;this.renderScopes()},h.prototype.openUserProfileDropDown=function(){var t=this,i=this.getAccountOptionsForUserProfileButton(this._sequenceNumberReader.getSequenceNumber());this._menuFactory.showDropdownMenu(i,document.getElementById(this._optionsButton.id),2,function(){n.safeSetTimeout(function(){return t.closeUserProfileDropDown()},0,"closeUserProfileDropDown")});this._userProfileMenuOpened=!0;this.renderScopes()},h.prototype.closeUserProfileDropDown=function(){this._userProfileMenuOpened=!1;this.renderScopes()},h.prototype.cleanUp=function(){this._lastRenderedTopHitHeader=null;this._page.updateTopHitHeaderView(null);t.config.optimizeStartupRendering?(document.activeElement.blur&&document.activeElement.blur(),this._shouldRenderScopes=!0,this.renderScopes()):this._page.updateScopesHeaderView(null)},h.prototype.scopeNamesElements=function(n){var i=this;return n.map(function(n){return i._scopeTiles.find(function(i){return t.Scope[i.type]==n})}).filter(function(n){return!!n})},h.prototype.getEffectiveScopeOrder=function(){var i,r,o,n,u,s,e;if(!this._scopeTiles||this._scopeTiles.length==0)return[];if(this._effectiveScopeOrder&&!t.config.pathCompletionReplacesAll)return this._effectiveScopeOrder.slice(0);if(t.RuntimeConfig.AlwaysWide?(i=t.config.scopesOrderBeginAlwaysWide,r=t.config.scopesOrderLastAlwaysWide,o=t.config.numberOfScopesToRenderAlwaysWide):(i=t.config.scopesOrderBegin,r=t.config.scopesOrderLast,o=t.config.numberOfScopesToRender),n=[],i){if(t.config.pathCompletionReplacesAll&&(r=r.filter(function(n){return n!="PathCompletion"}),this._currentQuery&&this._currentQuery.canBePathCompletion&&(i=i.map(function(n){return n=="All"?"PathCompletion":n}))),u=r?this.scopeNamesElements(r):[],n=this.scopeNamesElements(i),t.config.menuOverflow&&t.RuntimeConfig.AlwaysWide){var f=0,h=10,c=26,l=t.config.scopeMenuWidth*this._scopesHeaderElement.clientWidth;for(s=0;sl)break;o=e+u.length}n=n.slice(0,o-u.length);n.push.apply(n,u)}return this._effectiveScopeOrder=n,n.slice(0)},h.prototype.getHiddenScopeElements=function(n){return this._moreScopeTiles?this._moreScopeTiles.filter(function(i){return n.find(function(n){return n.type==i.type})==undefined&&t.Scope[i.type]!="PathCompletion"&&t.Scope[i.type]!="All"}):[]},h.prototype.getScopeBarElements=function(){var u=this,n,i,r;return this._scopeTiles?(n=this.getEffectiveScopeOrder(),i=n.some(function(n){return n.enabled}),!i&&this._selectedScope&&(t.config.pathCompletionReplacesAll&&t.Scope[this._selectedScope.type]=="PathCompletion"||(r=this._scopeTiles.find(function(n){return n.type==u._selectedScope.type}),n.push(r),i=!0)),n):[]},h.prototype.isFeedbackEnabled=function(){return n.isBingEnabled()},h.prototype.showFeedback=function(){this._page.ensureWebViewHeightExpanded();typeof WindowsFeedbackForm!="undefined"&&WindowsFeedbackForm.Show("")},h.prototype.getHeaderText=function(n,i){var r,u;if(t.RuntimeConfig.FlatListWithoutGroups||t.config.hideBestMatchTag)return null;if(r=t.getScopeDisplayName(i,this._host),r){if(this._topHitPresent)return n==t.Scope.All||n==t.Scope.PathCompletion?(u=t.config.quickMatchLabel?"QuickMatch":"BestMatch",this._host.getLocString(u)):(u=t.config.quickMatchLabel?"QuickMatchFor":"BestMatchFor",this._host.getLocString(u,r.toLocaleLowerCase()));if(this._resultsPresent)return null;if(n!=t.Scope.All)return r}return this._host.getLocString("BestMatch")},h.prototype.getEmptyResultsMessage=function(n,i,r,u,f){return t.RuntimeConfig.QfMode==5||t.RuntimeConfig.QfMode==9||n||!i&&!r||u!=t.Scope.Documents&&f.showUpsellOnSuggestionsList&&f.showUpsellOnSuggestionsList()?["",""]:r?f.getEmptyZIMessages(this._host):[this._host.getLocString("NoResults",this._currentQuery.queryToFetch),""]},h.prototype.init=function(){var u,f,r,i;if(t.initScopePrefixes(this._host),this._scopeTiles=[],this._moreScopeTiles=[],t.RuntimeConfig.ScopesAvailable){u=t.RuntimeConfig.AlwaysWide?t.config.scopesOrderBeginAlwaysWide:t.config.scopesOrderBegin;this._allScopeButtonPresent=n.contains(u,"All");for(f in t.ScopeConfig)(r=parseInt(f),i=t.ScopeConfig[r],(i.prefixes||i.prefixesLocString||i.scopeNameLocString)&&t.isScopeEnabled(r,i))&&((r!=t.Scope.All||this._allScopeButtonPresent)&&this._scopeTiles.push(this.createScopeElement(r,i,!1)),this._moreScopeTiles.push(this.createScopeElement(r,i,!0)));this._moreScopeTiles.sort(function(n,i){return n.type==t.Scope.All?-1:i.type==t.Scope.All?1:n.text.localeCompare(i.text)});this._selectedScope&&this.selectScope(this._selectedScope.type);this._effectiveScopeOrder=null}},h.prototype.createScopeElement=function(n,i,r){var u=this;return{isScopeElement:!0,id:(r?"scope":"l1scope")+n,type:n,enabled:!1,text:t.getScopeDisplayName(i,this._host),title:null,icon:n==t.Scope.All?{content:"",type:1}:i.icon,click:function(){return u.clickHandler(n,"scopeBar")},selected:!1,tooltip:this.getScopeToolTip(n,!1),isSelectable:!0}},h.prototype.clickHandler=function(n,i,r){var h=t.getScopeDisplayName(t.ScopeConfig[n],this._host),e,u=this._currentQuery,f=u.scope,o,s,c;if(this._shouldRenderScopes=!0,this._scopeTiles.some(function(n){return n.type==f})||(f=t.Scope.All),h&&f!=n)e=(n==t.Scope.All||n==t.Scope.PathCompletion?"":h.toLocaleLowerCase()+": ")+u.queryToFetch,this.innerRender(n,n,u,this._topHitPresent,this._resultsPresent,!0,!1),o={query:this._currentQuery,topResults:[],groups:[]},this._page.updateTopResultsView(o,!1),this._page.updateGroupsView(o,!1);else{if(f==t.Scope.All||this._allScopeButtonPresent){this._page.ensureWebViewHeightExpanded();this.setFocusInSearchBox("scope clickHandler noop");return}e=u.queryToFetch;n=t.Scope.All;this.innerRender(n,n,u,this._topHitPresent,this._resultsPresent,!0,!1)}s=t.Scope[n];c={Scope:s,Source:i,GroupSource:r&&r.source?r.source.toString():undefined};this._instHelper.logClientInstEvent("Select","ScopeChanged",null,c);f!=n&&this._host.reformulate(e,undefined,undefined,r);this.setFocusInSearchBox("scope clickHandler "+s)},h.prototype.setFocusInSearchBox=function(t){this._host.setFocusInSearchBox(null,t);var i=n.getCurrentActiveElement();i&&i.blur()},h.prototype.isScopeElement=function(t){return t&&this._scopeTiles&&(this.isScopeButton(t.id)||n.contains(this._scopeTiles,t))},h.prototype.isMenuElement=function(n){return n&&this.isMenuButton(n.id)},h.prototype.isScopeButton=function(n){return n==this._feedbackButton.id||n==this._rewardsBadgeButton.id||n==this._userProfileButton.id||this.isMenuButton(n)},h.prototype.isMenuButton=function(n){return n==this._moreButton.id||n==this._optionsButton.id},h.prototype.getSelectableItems=function(){var n=[],i;return t.RuntimeConfig.ScopesAvailable&&(n=n.concat(this.getScopeSelectableItems())),i=this._advancedOptionsScope.filter(function(n){return n.layout==0||n.layout==6}),i.length>0&&(n=n.concat(i)),n},h.prototype.getSelectableItemsByGroup=function(){var i=[],n=this.getScopeBarElements(),r,u,e,f;return t.shouldSkipSelectedScope()&&this._selectedScope==n[0]&&(n=n.slice(1)),i.push(n.slice(0,1)),r=n.findIndex(function(n){return n.selected}),r>0?i.push(n.slice(r,r+1)):t.shouldSkipSelectedScope()||(u=n.findIndex(function(n){return n.enabled}),u>0&&i.push(n.slice(u,u+1))),e=[this._moreButton,this._rewardsBadgeButton,this._userProfileButton,this._feedbackButton,this._optionsButton],e.forEach(function(n){_ge(n.id)&&i.push([n])}),f=this._advancedOptionsScope.filter(function(n){return n.layout==0||n.layout==6}),f.length>0&&i.push.apply(i,f.map(function(n){return[n]})),i},h.prototype.getScopeSelectableItems=function(){var u=this.getScopeBarElements(),i=this._currentScopeTileIndex,c=u.length,h;if(t.shouldSkipSelectedScope()&&this._selectedScope==u[0]&&(u=u.slice(1),--i,--c),i<0&&this._selectedScope&&!t.shouldSkipSelectedScope())return[this._selectedScope];if(h=n.getCurrentActiveElement(),h)switch(h.id){case f:return[this._moreButton];case r:return[this._feedbackButton];case e:return[this._optionsButton];case o:return[this._rewardsBadgeButton];case s:return[this._userProfileButton]}return(i<0||i>=c)&&(i=0),u.slice(i,i+1)},h.prototype.getSelectedItem=function(){return null},h.prototype.select=function(n){var i=[].slice.call(this._scopesHeaderElement.getElementsByClassName("scopeTile")),r=t.shouldSkipSelectedScope()?i.filter(function(n){return!n.classList.contains("selectedScope")}):i;this._currentScopeTileIndex=r.indexOf(_ge(n.id));t.shouldSkipSelectedScope()&&(this._currentScopeTileIndex=i.indexOf(r[this._currentScopeTileIndex]))},h.prototype.onAfterKeyDown=function(){return!1},h.prototype.getSubstrateUpsellClickHandler=function(n){var i=this,r=function(){i._host.refreshCurrentPane();i._host.setFocusInSearchBox(null,"SubstrateUpsell")};return function(){return i._accessTokenManager.promptAutheticateDialog(n,t.getSubstrateResourceOrScope(n),r,r)}},h.prototype.getSubstrateUpsell=function(i,r,u){var l=null,f="VerifyAccountToSearch",e=0,a="CloudSearch",v=["Verify"],o=null,s=[],y,h,c;return u==0?(y=t.getEffectiveScope(this._currentQuery),e=6,h=this._accessTokenManager?this._accessTokenManager.getCachedAccountInfo(i):null,h&&s.push(h.accountUserName),c=[t.Scope.People,t.Scope.Emails,t.Scope.Documents],t.config.accountVerificationInAllScope&&c.push(t.Scope.All),n.contains(c,y)&&(s.length>0&&(f="VerifyAccount"),o=this._substrateUpsellDismiss),a=""):u==2&&(f=null,e=2,l={content:"",type:2,needsAccentColor:!0},o=this._substrateUpsellDismiss,v=["VerifyAccountToSearch"]),this.createAdvancedOption(i==1?"COFA":"COOA",r,a,f,v,this.getSubstrateUpsellClickHandler(i),e,o,l,null,s,"VerifyButton")},h.prototype.getOneDriveUpsell=function(n){var t=this;return this.createAdvancedOption("SDSC",n,null,null,["SeeResultsFromOneDrive"],function(){t._host.launchCortanaSignIn()},2,null,{content:"",type:2,needsAccentColor:!1})},h.prototype.getIndexingOption=function(n){var i=this,r=t.config.controlPanelSearchSettings?function(){return i._host.launchSearchSettings()}:function(){return t.LocalDataProvider.launchIndexingOptions(i._host,!1)};return this.createAdvancedOption("OMIO",n,"",null,["OptionsMenuIndexing"],r,2,null,{type:2,content:""})},h.prototype.getAdvancedOptionCssClass=function(n){return n==4?"menuInfo":n==5?"menuLabel":null},h.prototype.createContextMenuGroup=function(n,t,i,r){var u=this.createAdvancedOption(n,t,null,i,null,null,5);return u.groupItems=r,u.narratorText=u.message,u},h.prototype.createBuildVersionOption=function(){var n=this._host.getLocString("Build");return{id:"advancedOption"+this._advancedOptionsIdCounter++,selected:!1,title:n,message:undefined,text:n+": "+t.config.snrVersion,instItem:undefined,click:undefined,layout:4,cssClass:this.getAdvancedOptionCssClass(4),isSelectable:!1,subItems:undefined,isExpanded:!1}},h.prototype.createDebugFallbackOption=function(n){return this.createAdvancedOption(null,n,"FallbackBundleText",null,["FallbackBundleText"],function(){return t.fallbackToPrepopulatedBundle(new Error("Fallback button clicked"))},2,null,{type:2,content:""})},h.prototype.createCossOptInOption=function(n){var r=this,i=t.RuntimeConfig.QfMode==2?"CossOptOut":"CossOptIn";return this.createAdvancedOption(null,n,i,null,[i],function(){return r.onCossOptInOutClick()},2,null,{type:2,content:""})},h.prototype.createAdvancedOption=function(i,r,u,f,e,o,s,h,c,l,a,v){var k=this,w,y,b,p;return i&&(y=n.InstrumentedItem.getNonSuggestionInstrumentedItem(i,t.SyntheticQSCodesMaps.KValues),this._instHelper.instrumentSyntheticInstrumentedItem(r,i,y)),b="advancedOption"+this._advancedOptionsIdCounter++,l&&l.length==0&&(l=null),p={id:b,selected:!1,title:this._host.getLocString(u),message:f?(w=this._host).getLocString.apply(w,[f].concat(a)):null,text:this._host.getLocString.apply(this._host,e),instItem:y,click:undefined,layout:s,dismiss:h,icon:c,cssClass:this.getAdvancedOptionCssClass(s),isSelectable:!!o||!!l,subItems:l,buttonLabel:this._host.getLocString(v),isExpanded:!l?undefined:!1},p.click=o?function(n,t){y&&k._instHelper.instrumentItemClick(n,y,r,null,t,null);o(p)}:undefined,p},h.prototype.getAccountOptions=function(n){var u=this,r=[];if(!this._accessTokenManager)return r;var f=this._accessTokenManager.getCachedAccountInfo(0),e=this._accessTokenManager.getCachedAccountInfo(1),c=this._accessTokenManager.isMsaAvailable(),l=this._accessTokenManager.isAadAvailable(),o="menuItemWithButton focusable",s="removeHover",h="highlight",i;return(f||e)&&(i=this.createAdvancedOption(null,n,null,"ConnectedAccounts",null,null,5),i.cssClass=this.getAdvancedOptionCssClass(5),r.push(i),f&&t.isCloudSearchEnabledMsaCache&&(i=this.createAdvancedOption(null,n,null,null,["MicrosoftAccount"],null,4),i.message=f.accountUserName,i.cssClass=this.getAdvancedOptionCssClass(4),t.isSubstrateOutlookAccountConnected||(i.cssClass+=" "+h),r.push(i),this._verifyAccountForMSARequired&&(i=this.createAdvancedOption(null,n,null,"VerifyAccountAttention",null,this.getSubstrateUpsellClickHandler(0),4),i.cssClass=s,i.icon={type:2,content:""},r.push(i),i=this.createAdvancedOption(null,n,null,"VerifyButton",null,this.getSubstrateUpsellClickHandler(0),2),i.cssClass=o,r.push(i))),e&&t.isCloudSearchEnabledAadCache&&(i=this.createAdvancedOption(null,n,null,null,["AadAccount"],null,4),i.message=e.accountUserName,i.cssClass=this.getAdvancedOptionCssClass(4),r.push(i),t.isSubstrateO365AccountConnected||(i.cssClass+=" "+h),this._verifyAccountForAADRequired&&(i=this.createAdvancedOption(null,n,null,"VerifyAccountAttention",null,this.getSubstrateUpsellClickHandler(1),4),i.cssClass=s,i.icon={type:2,content:""},r.push(i),i=this.createAdvancedOption(null,n,null,"VerifyButton",null,this.getSubstrateUpsellClickHandler(1),2),i.cssClass=o,r.push(i))),r.push(this.getMenuDividerOption()),i=this.createAdvancedOption(null,n,null,null,["ManageAccounts"],function(){return u._host.launchWindowsAccountSettings()},2,null,{type:2,content:""}),i.cssClass=this.getAdvancedOptionCssClass(2),r.push(i)),f&&(t.isCloudSearchEnabledMsaCache||!c)||(i=this.createAdvancedOption(null,n,null,null,t.isCloudSearchEnabledMsaCache?["AddMicrosoftAccount"]:["EnableMsaSearch"],t.isCloudSearchEnabledMsaCache?function(){return u._host.launchWindowsAccountSettings()}:function(){return u._host.launchSearchPermissions()},2,null,{type:2,content:t.isCloudSearchEnabledMsaCache?"":""}),i.cssClass=this.getAdvancedOptionCssClass(2),r.push(i)),e&&(t.isCloudSearchEnabledAadCache||!l)||(i=this.createAdvancedOption(null,n,null,null,t.isCloudSearchEnabledAadCache?["AddAadAccount"]:["EnableAadSearch"],t.isCloudSearchEnabledAadCache?function(){return u._host.launchWindowsAccountSettings()}:function(){return u._host.launchSearchPermissions()},2,null,{type:2,content:t.isCloudSearchEnabledMsaCache?"":""}),i.cssClass=this.getAdvancedOptionCssClass(2),r.push(i)),r},h.prototype.getUserProfileButtonData=function(){var i=this,r,t,n=this._accessTokenManager.getSelectedAccountInfo(),u;return n?(t=n.accountProviderAuthority=="consumers"?0:1,r=this._userProfilesCache[n.accountUserName],!r)?(u=this._substrateProfilePictureProvider.getPersonDefaultIcon(n.accountUserName),this._userProfilesCache[n.accountUserName]=u,this._accessTokenManager.getAccount(t,t==1?"https://outlook.office.com/":"https://outlook.office.com/User.ReadWrite",!1,!0,function(r){if(r&&r.Token){var u=i._substrateProfilePictureProvider.getProfilePictureIconForToken(t,r.Token,n.accountUserName);u&&u(1,function(t){t&&(i._userProfilesCache[n.accountUserName]=t,i.renderScopes())})}}),[u,n.accountUserName]):[r,n.accountUserName]:[null,null]},h.prototype.getAccountOptionsForUserProfileButton=function(n){var u=this,r,i,f,a,c,o,l,v;if(!this._accessTokenManager)return[];var s=this._accessTokenManager.getAllAvailableAccounts(0),h=this._accessTokenManager.getAllAvailableAccounts(1),e=s.concat(h);if(s.length+h.length==0)return[];if(r=[],f=this._accessTokenManager.getSelectedAccountInfo(),f&&(e=e.filter(function(n){return n.accountUserName!=f.accountUserName}),i=this.createAdvancedOption(null,n,null,"ConnectedAccount",null,null,5),i.cssClass=this.getAdvancedOptionCssClass(5),r.push(i),i=this.createAdvancedOption(null,n,null,null,f.accountProviderAuthority=="consumers"?["MicrosoftAccount"]:["AadAccount"],null,4),i.message=f.accountUserName,i.cssClass=this.getAdvancedOptionCssClass(4),r.push(i)),e.length>0)for(i=this.createAdvancedOption(null,n,null,"AvailableAccounts",null,null,5),i.cssClass=this.getAdvancedOptionCssClass(5),r.push(i),a=function(t){i=c.createAdvancedOption(null,n,null,null,t.accountProviderAuthority=="consumers"?["MicrosoftAccount"]:["AadAccount"],function(){u._accessTokenManager.setSelectedAccount(t);u._host.notifyAccountSelected(t);u._menuFactory.dismiss()},0,null,{type:2,content:""});i.message=t.accountUserName;i.cssClass=c.getAdvancedOptionCssClass(0);r.push(i)},c=this,o=0,l=e;ou.length;)u.push("0");for(i=0;ie)return!0}return!0},i.prototype.setWebSearchSuggestionProperties=function(n,i,r,u){var e=this;f(n,this._host,i);i.queryToFetch||(n.text=HitHighlightingParser.addMarkers(n.text));n.baseSearchUrl=u;n.click=function(){return e._host.launchSearch(n.query,e._navigationHelper.getSearchUrl(i.fullPartialQuery,n.query,n.type,n.baseSearchUrl,n.handoffType),n.useRaf)};n.narratorText=t.getNarratorText(n);n.type=="HS"&&t.setExtraVerbs(n,function(){var i=[{verb:"ManageSearchHistory",displayName:e._host.getLocString("ManageSearchHistory"),executeSync:function(){return e._host.launchPrivacyPortal()},icon:{content:"",type:2}}];return t.config.removeSuggUrl&&i.unshift({verb:"RemoveFromWebHistory",displayName:e._host.getLocString("RemoveFromWebHistory"),executeSync:function(){return e.removeBingHistorySuggestion(n.text)},icon:{content:"",type:2}}),i},!0)},i.prototype.sendRemoveBingHistorySuggestionRequest=function(i,r){var u=this,f;i=HitHighlightingParser.removeMarkers(i);f=t.config.removeSuggUrl.replace("%7b0%7d",encodeURIComponent(i)).replace("%7bSID%7d",sj_cook.get("_SS","SID"));n.fetchUrlJson(f,r,null,function(t){t&&t.success&&(u._host.refreshCurrentPane(),n.safeSetTimeout(function(){return u._temporaryMessageHandler.showTemporaryMessage(u._host.getLocString("RemoveFromWebHistoryConfirmation",i))},250,"removeBingHistorySuggestion"))})},i.prototype.removeBingHistorySuggestion=function(n){var i=this;this._accessTokenManager?this._accessTokenManager.getAccount(0,t.getBingResourceOrScope(0),!1,!0,function(t){if(t&&t.Token){var r={};r["X-Search-RPSToken"]=t.Token;i.sendRemoveBingHistorySuggestionRequest(n,r)}}):this.sendRemoveBingHistorySuggestionRequest(n,null)},i.prototype.addRelatedSuggestion=function(i,r,u,f,e,o,s){var h=t.createSuggestion(r,f,null,e,o,i?i.Query:u.query,n.InstrumentedItem.createInstrumentedItem(u.sequenceNumber,o),s,u.sequenceNumber,!1,null,null,!0);h.groupType=t.GroupType.Related;h.parent=u;h.tooltip=i?i.SecondaryText:null;h.rankingScore=i?i.RankingScore:0;h.category=i?i.Category:null;h.isAnswer=!0;this.setWebSearchSuggestionProperties(h,r,u.sequenceNumber,i?i.Url:null);h.primaryMetadata=null;t.isValidSuggestion(h,"calculateRelatedSuggestions")&&u.childSuggestions.push(h)},i.prototype.calculateRelatedSuggestions=function(t,i,r,u,f,e){var s,h,o;if(t.childSuggestions=[],r.ChildSuggestions)for(s=0,h=r.ChildSuggestions;s0&&this._instrumentationHelper.instrumentDataSource(t.sequenceNumber,u,t.childSuggestions,null)},i}();t.OnlineSuggestionsParser=e;t.adjustCasing=i;t.setCat1SuggestionProperties=r;t.setUrlSuggestionProperties=u})(t=n.WSB||(n.WSB={}))}(AutoSuggest||(AutoSuggest={})),function(n){var t;(function(t){function b(n){return n?[n]:[]}function et(n){if(n){var t=n.lastIndexOf(".");if(t>=0)return n.substring(t)}return""}function ot(t){var i=t?new Date(t):null;return n.isValidDate(i)?i:null}function st(i){if(i){var r=n.getCurrentDate();if(r.getDate()==i.getDate()&&r.getMonth()==i.getMonth()&&r.getFullYear()==i.getFullYear())return i.toLocaleTimeString(t.uiLanguageCache,{hour:"numeric",minute:"numeric"})}return null}function f(i,f,o,s,h,c){var it,rt,k,v,a,d,y,w,l,b,g;if(c===void 0&&(c=!1),!c&&s.extensionLC&&r.hideFileExtensions&&!t.config.showFileExtn){var nt=s.extensionLC.length,p=s.query,tt=p.toLocaleLowerCase();tt.endsWith(s.extensionLC)&&(it=HitHighlightingParser.addMarkers(p,f),it.toLocaleLowerCase().endsWith(s.extensionLC)&&(s.query=p.substring(0,p.length-nt),rt=HitHighlightingParser.removeMarkers(s.text||"").toLocaleLowerCase(),tt==rt&&(k=s.text.toLocaleLowerCase().lastIndexOf(s.extensionLC),s.text=s.text.substring(0,k)+s.text.substr(k+nt))))}for(s.lastModifiedDate&&(v=s.lastModifiedDate.toLocaleString(t.uiLanguageCache,{day:"numeric",month:"numeric",year:"numeric",hour:"numeric",minute:"numeric"})),a=s.path,s.tooltip=yt(s,a,v,h),s.primaryMetadata=s.sourceForGroup&&s.sourceForGroup!=1?t.getGroupSourceDisplayName(s.sourceForGroup,h):s.itemTypeDisplayName,(i.isSearchHomeZI||t.RuntimeConfig.QfMode==8)&&(s.additionalInfoText=a),s.classNames=[],s.match?(d=(pt(s.match.matchType)?h.getLocString(t.MatchType[s.match.matchType])+": ":"")+HitHighlightingParser.addMarkers(s.match.matchedText,f),s.additionalInfoText=d,s.secondaryMetadata=d,s.classNames.push("withMatchAnnotation","forceNoWrapOutsideTopResult")):v&&t.RuntimeConfig.QfMode!=5&&(s.secondaryMetadata=h.getLocString("LastModified")+": "+v),s.narratorText=t.getNarratorText(s),t.displayedInGridLayout(s.type)&&(o?s.classNames.push("bigIcon","biggerIcon"):s.classNames.push("bigIcon")),!c&&s.handoffType==2&&r.copyToClipboard&&u(s,function(){return[{verb:t.JumplistActionItemType[t.JumplistActionItemType.S_CopyFullPath],displayName:h.getLocString("CopyFullPath"),executeSync:function(){return r.copyToClipboard(s.path,"")},icon:{type:1,content:""}}]},!1),y={},a&&(w=a.lastIndexOf("/"),w<0&&(w=a.lastIndexOf("\\")),l=a.substring(0,w),l.endsWith(":")&&(l=l+"\\"),y[h.getLocString("Location")]=[{text:l,click:function(){return n.isUncOrLocalPath(l)?r.launcher.startLaunchFolder(l):s.locationUrl?r.launcher.launchUriAsync(decodeURI(s.locationUrl)):r.launcher.launchUriAsync(l)}}]),y[h.getLocString("LastModified")]=[{text:v}],b=0,g=e;b=0}function at(n){var i,t;if(n&&typeof n=="object"&&n.length){for(i="",t=0;t0&&(f.childSuggestions=f.childSuggestions?f.childSuggestions.concat(k):k,h(k,v),b.instrumentDataSource(p,w,k,null))}}function c(n,i,r,u){return function(f,e){return t.getIcon(n,u+"_"+n.path+"_"+n.displayName,"jumpList",!r,!1)(f,function(n){n?e(n):i.getIcon(f,e)})}}function rt(i){return i.displayName?!t.RuntimeConfig.AlwaysWide&&n.olderThan2Weeks(i.lastAccessed)?!0:!1:!0}function l(n){switch(n){case 0:return t.GroupType.JumpListTasks;case 1:return t.GroupType.JumpListPinned;case 2:return t.GroupType.JumpListRecent;case 3:return t.GroupType.JumpListFrequent;default:return t.GroupType.JumpListCustom}}function a(n,i,r,u){t.Promise.safeChain("launchJumpList",function(){return i.jumpListItem.launchAsync()},null,function(){i.jumpListItem.deleteAsync&&t.DialogBox?t.DialogBox.show(r.getLocString("JumpListItemUnavailableDeleteConfirmation"),[{id:null,text:r.getLocString("Cancel"),selected:!0,action:function(){return r.setFocusInSearchBox(null,"jumpListItemDialogBoxCancel")}},{id:null,text:r.getLocString("Remove"),selected:!1,action:function(){v(n,i,r,u);r.setFocusInSearchBox(null,"jumpListItemUnavailable1")}}]):(u.showTemporaryMessage(r.getLocString("JumpListItemUnavailable")),v(n,i,r,u),r.setFocusInSearchBox(null,"jumpListItemUnavailable2"))})}function v(n,i,r,u){var f=function(){return fi(i)},e;i.jumpListItem.deleteAsync?(e=i.parent.childSuggestions.length==1,t.Promise.safeChain("deleteJumpList",function(){return i.jumpListItem.deleteAsync()},function(){n.getJumpListAsync&&t.Promise.safeChain("getJumpListAsync",function(){return n.getJumpListAsync()},function(n){e&&n.some(function(n){return l(n.type)==i.groupType&&n.items.some(function(n){return!rt(n)})})?f():(r.refreshCurrentPane(),u.showTemporaryMessage(r.getLocString("RemovedFromList",i.text)))},f)},f)):f()}function ui(n,t,i,r){t.jumpListItem.deleteAsync&&u(t,function(){var u={verb:"RemoveFromThisList",displayName:i.getLocString("RemoveFromThisList"),executeSync:function(){return v(n,t,i,r)},icon:{type:2,content:""}};return[u]},!0)}function fi(n){var i=_ge(n.id);t.setVisibility(i,!1);n.suppressed=!0}function ei(n,t,i){if(n&&n.uxHint){var r=t?HitHighlightingParser.addMarkers(n.uxHint,t):n.uxHint;return i.getLocString("RelatedSynonym",r)}return null}var r=SearchAppWrapper.CortanaApp,ut={"Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge":[0],"Microsoft.InternetExplorer.Default":[0],Chrome:[0],"360browser":[0]},y={skype:[],outlook:[0],"360browser":[0],chrome:[0],iexplore:[0],opera:[0],firefox:[0],safari:[0]},p={"\\msedge.exe":[0]},ft=["Microsoft.Windows.Explorer",],e=[[t.MatchType.LastModifiedBy,"lastModifiedBy"],[t.MatchType.Author,"author"],[t.MatchType.Artist,"artist"],[t.MatchType.Album,"album"],[t.MatchType.Genre,"genre"],[t.MatchType.Tags,"tags"],],w={"Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge":[t.GroupType.JumpListTasks],"Microsoft.MicrosoftStickyNotes_8wekyb3d8bbwe!App":[t.GroupType.JumpListTasks],"Microsoft.XboxApp_8wekyb3d8bbwe!Microsoft.XboxApp":[t.GroupType.JumpListCustom],"com.squirrel.Teams.Teams":[t.GroupType.JumpListTasks],"Microsoft.ScreenSketch_8wekyb3d8bbwe!App":[t.GroupType.JumpListTasks]},d;t.getFileExtension=et;t.toDate=ot;t.getTodayTimeString=st;t.setFileTemplate=f;t.enrichMetadataFromDuplicate=ht;t.getIconForTypeAsync=ct;t.isValidIcon=k;t.isValidSuggestion=o;t.setExtraVerbs=u;t.setExtraVerbsAsync=lt;d=function(){function i(n,t,i){this._host=n;this._instrumentationHelper=t;this._temporaryMessageHandler=i}return i.prototype.parse=function(i,r,u,f,e,o){for(var v,y,s=this,c=[],p=function(t){n.safeExecute(function(){return tt(i,t,u,r,s._host,s._temporaryMessageHandler,t.suggestionType,s._instrumentationHelper,c,function(){return!0})},"parseLocalSuggestion "+u)},l=0,a=f.suggestions;l0&&t.config.supportedCiMarkets[l]&&(l!=e.language||f>e.version||k||it)&&(!s.url||k||u.lastUrl==s.url||s.errorCode!="00000000")){var a="cis_v"+f,v="ci_v"+f,d=o._lightweightStorage.getItem(a)?parseInt(o._lightweightStorage.getItem(a)):0,g=o._lightweightStorage.getItem(v)?parseInt(o._lightweightStorage.getItem(v)):0;o._lightweightStorage.setItem(r.LastCIDownloadAttemptKey,n.getCurrentDate().toString());y="constraintIndexDownloader.tryDownloadFromUrlAsync";t.Promise.safeChain(y,function(){return u.tryDownloadFromUrlAsync(b)},function(n){if(n){var t=o.getContstraintIndexInfo(u.lastUrl);i.currentCIVersion=String(t.version);d++;o._lightweightStorage.setItem(a,d.toString())}else SharedLogHelper.LogError(y,"urlResult: "+w,"Download failed");g++;o._lightweightStorage.setItem(v,g.toString())},null,null,b)}}})}return r.prototype.parseUrlResult=function(n){var r=null,t=null,u=1,i,f;return n&&(i=n.split(":0x"),i.length>1?(r=i[0],t=i[1],t!="00000000"&&SharedLogHelper.LogError("constraintIndexDownloader.urlResult",t,"Download encountered problems"),f=this.getContstraintIndexInfo(r),u=f.version):SharedLogHelper.LogError("constraintIndexDownloader.parseUrlResult","urlResult: "+n,"Invalid URL")),{url:r,version:u,errorCode:t}},r.prototype.getContstraintIndexInfo=function(n){var r=-1,u="",t,i;return n&&(t=n.split("/"),t.length>1?(i=t[t.length-1].split("."),u=i.length==2?i[0]:"",r=+t[t.length-2]):SharedLogHelper.LogError("constraintIndexDownloader.getContstraintIndexInfo","url: "+n,"Invalid URL")),{version:r,language:u}},r.prototype.getUrlForCiCab=function(n,t){return"https://www.bing.com/bcs/ci/"+n+"/"+t+".cab"},r.prototype.getTimeDiffInMins=function(t){if(!n.isValidDate(t))return 0;var i=t.getTime(),r=n.getCurrentTime();return Math.round((r-i)%864e5%36e5/6e4)},r.LastCIDownloadAttemptKey="LastCIDownloadAttempt",r}();i.ConstraintIndexDataLoader=r})(i=t.ConstraintIndex||(t.ConstraintIndex={}))})(t=n.WSB||(n.WSB={}))}(AutoSuggest||(AutoSuggest={}));__extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var t;(function(t){function a(n){switch(n.type){case"Folder":return"FD";case"Photo":return"LI";case"Video":return"LV";case"Audio":case"Music":return"MU";default:return n.fileSize?"FL":"FD"}}function v(n){switch(n){case"FD":return t.Scope.Folders;case"LI":return t.Scope.Photos;case"LV":return t.Scope.Videos;case"MU":return t.Scope.Music;default:return t.Scope.Documents}}var i=SearchAppWrapper.CortanaApp,r=i.fileExplorerSuggestionPage,u="https://onedrive.live.com",f=u+"/redir.aspx?resid=",s="&ancestorId=",h="&contentMatch=",e="OneDrive provider called without {0}",c=621355968e5,l=function(u){function f(n){var t=u.call(this,"ODC")||this;return t._accessTokenManager=n,t}return __extends(f,u),f.prototype.getName=function(){return"OneDriveDataProvider"},f.prototype.addOneDriveAncestorResourceIdQueryString=function(){if(t.RuntimeConfig.QfMode==5&&!t.isFileExplorerCurrentPathThisPcOrQuickAccess){var i=void 0,u=r.currentSyncRootContentUri?n.tryParseUrl(r.currentSyncRootContentUri,!1):null;if(u&&u.parameters&&(i=u.parameters.substr(1).split("&").find(function(n){return n.startsWith("id=")}).substr(3)),i)return s+i;SharedLogHelper.LogError("OneDriveParser","QfMode="+t.RuntimeConfig.QfMode,new Error(n.formatString(e,["currentSyncRootResourceId"])))}return""},f.prototype.addOneDriveContentMatchQueryString=function(n){return t.RuntimeConfig.QfMode==5||n.scope==t.Scope.Documents?h+"1":""},f.prototype.createUrl=function(i){var r=decodeURIComponent(t.config.oneDriveDotComRootUrl),u;return r+=this.addOneDriveAncestorResourceIdQueryString(),r+=this.addOneDriveContentMatchQueryString(i),u=i?n.encodeQueryParameter(i.queryToFetch.toLowerCase()):"",r+"&q="+u},f.prototype.getAllAccountTokens=function(r){if(t.RuntimeConfig.QfMode==5){var u=i.fileExplorerSuggestionPage.currentSyncRootAccount;u?this._accessTokenManager.getAccountByUserName(!1,0,u,!1,!0,function(n){n&&n.Token?r([n.Token]):r(null,"AccountNotFound")}):t.isFileExplorerCurrentPathThisPcOrQuickAccess?this._accessTokenManager.getAllSyncingAccounts(!1,0,!1,!0,function(n){n.length>0?r(n.map(function(n){return n.Token})):r(null,"NoAccountsFound")}):(SharedLogHelper.LogError("OneDriveParser","QfMode="+t.RuntimeConfig.QfMode,new Error(n.formatString(e,["currentSyncRootAccount"]))),r(null,"CurrentSyncRootAccount"))}else t.windowsAccountType==2?this._accessTokenManager.getAccount(0,t.getBingResourceOrScope(0),!1,!0,function(n){n&&n.Token?r([n.Token]):r(null,"NoAccountsFound")}):r(null)},f.prototype.fetch=function(t,i,r,f,e,o,s){var l=this,h,c;n.isDataSourceEnabled(this._dataSource,t)&&(h={numOfPendingResponses:0},s||(s={}),s["BingAPIs-Authorization-Source"]="Explicit",c=function(c){var v=Object.assign({},s),a;c&&(v["X-Search-RPSToken"]=c);a=Object.assign({},o);delete a[n.Service.QueryParams.ImpressionGuid];delete a[n.Service.QueryParams.RequestElToken];u.prototype.fetch.call(l,t,function(n,t,r,u,f){--h.numOfPendingResponses;i(n,t,r,u,f,h.numOfPendingResponses!=0)},r,f,e,a,v)},this.getAllAccountTokens(function(n,t){t?i(l._dataSource,null,t,null,null,!1):n?(h.numOfPendingResponses=n.length,n.forEach(function(n){return c(n)})):(h.numOfPendingResponses=1,c(null))}))},f}(n.JsonDataProvider),o;t.OneDriveDataProvider=l;o=function(){function i(n){this._host=n}return i.prototype.parse=function(n,i,r,u,f,e){var h=[],o,c,l,s,a,v;if(u&&u.suggestionGroups)for(o=0,c=u.suggestionGroups;o=i){SharedLogHelper.LogError("AFCfetchChunked",null,new Error("targetItemCount <= itemCount"));e.fetchInProgress=!1;return}var s=n.getCurrentTime(),h=new Date(s-r*f),c=new Date(s-u[0]*f);this.getUserActivityItemsWithOptionsAsync(function(n){if(e.fetchInProgress){t+=n.length;var r=t1&&u[1]>u[0];o.onChunkReceived(n,r);r?o.fetchChunked(t,i,u[0],u.slice(1),e):e.fetchInProgress=!1}},c,h,i-t)},o.prototype.onChunkReceived=function(n,t){i.push.apply(i,n);this._callback&&this._callback(r,{items:n},undefined,undefined,undefined,t)},o.prototype.getUserActivityItemsWithOptionsAsync=function(i,r,f,e){var s=u.userActivityForWebHelper,o;n.safeExecute(function(){o=s.createActivityQueryOptions();o.endTime=f;o.startTime=r;o.collapseOnActivityId=!0;o.activitySortAggregationType=4;o.activitySortByProperty="System.ActivityHistory.EndTime";o.activitySortOrder=0},"createActivityQueryOptions",undefined,undefined,function(){return o=null});o?t.Promise.safeChain("getUserActivityItemsWithOptionsAsync",function(){return s.getUserActivityItemsWithOptionsAsync(e,!!t.config.filterActivitiesToActivatableItems,o)},i,function(){return i([])}):i([])},o.prototype.getUserActivityItemsCount=function(){var n=u.textScaleFactor||1;return t.shouldEnableTrendingSearches(this.host.getLanguage().toLowerCase())&&t.config.trendingSearchTwoRows?Math.max(t.config.activityInZI-1,0):t.RuntimeConfig.AlwaysWide&&n==1?t.config.activityInZI:t.config.activityInZISinglePane},o}(),o,i;t.ActivityFeedDataProvider=l;o=function(){function r(n){var t=this;this._host=n;this._getEdgeIcon=n.getEdgeIcon;n.bindShown(function(){t._isInternetConnectionMetered=n.isInternetConnectionMetered()})}return r.prototype.parse=function(n,i,r,f,e,o,s){var c=this,h,l;t.config.backplateAllIconsInZI?this.innerParse(n,i,r,f,e,o,s):(h={},f.items.forEach(function(n){n&&n.appId&&(h[n.appId]=n.appId)}),l=Object.keys(h),t.Promise.safeChain("ActivityFeedSuggestionsParser parse",function(){return u.queryFormulationView.deviceSearch.findAppsAsync(l)},function(t){return c.innerParse(n,i,r,f,e,o,s,t)},function(){return c.innerParse(n,i,r,f,e,o,s)},s))},r.prototype.innerParse=function(r,u,f,e,o,s,h,c){for(var p,w=this,v=[],b=function(e){var p=!c||c[e.appId]&&c[e.appId].isImmersive,s=l.getGetIcon(e,p),h=l.getIcon(e,s),a="AFC",o=t.createSuggestion(r,e.activityDisplayText,h?undefined:s,h,a,e.activityDisplayText,n.InstrumentedItem.createInstrumentedItem(u,a),18,u,t.localDataSourceMayContainPII(f),e.id,function(){return e.launchActivity()}),y;o.additionalInfoText=e.description||e.contentUri;o.tooltip=e.activityDisplayText;o.additionalInfoText&&(o.tooltip+="\n\n"+o.additionalInfoText);e.deleteActivityAsync&&t.config.deleteActivity&&(y={verb:"RemoveFromActivityFeed",displayName:l._host.getLocString("RemoveFromActivityFeed"),executeSync:function(){e.deleteActivityAsync();i.clear();w._host.refreshCurrentPane()},icon:{content:"",type:2}},n.WSB.setExtraVerbs(o,function(){return[y]},!1));v.push(o)},l=this,a=0,y=e.items;a=h&&t>=c},getFallbackIcon:t}:undefined},r.prototype.getGetIcon=function(n,i){return t.EdgeAppIds.some(function(t){return n.appId==t})?this._getEdgeIcon:t.Promise.safeChainWithGlobalCaching("activityFeedClientIcon",function(r){return n.getActivityAppLogoAsync(t.getImageSizeValue(r)).then(function(r){return t.toIcon(r,"activityFeedClientIcon toIcon",null,i?n.logoBackgroundColor:undefined)})},function(i){return n.id+"_"+t.getImageSizeValue(i)+"px"})},r}();t.ActivityFeedSuggestionsParser=o,function(n){function i(){t=null}function r(){return!!t}function u(){for(var i=[],n=0;n0&&t.push.apply(t,i)}function f(){return t.slice(0)}var t;n.clear=i;n.isSet=r;n.push=u;n.get=f}(i||(i={}))})(t=n.WSB||(n.WSB={}))}(AutoSuggest||(AutoSuggest={}));__extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var t;(function(t){var i="QSCH",r="MUID",e="WSBT",o=function(f){function o(n){var i=f.call(this,"QSCH")||this;return i._host=n,i._lastTypedQuery=new u,t.config.th&&ClientTestHooks.getUrlValue("mockLastQuery")&&i._lastTypedQuery.setQuery(ClientTestHooks.getUrlValue("mockLastQuery")),n.bindDismissed(function(n){n&&n.queryToFetch&&i._lastTypedQuery.setQuery(n.fullPartialQuery)}),i}return __extends(o,f),o.prototype.getName=function(){return"QuickSearchSuggestionsDataProvider"},o.prototype.getBaseUrl=function(){return t.config.trendingSearchUrl},o.prototype.getQuickSearchFormCode=function(){return t.config.quickSearchToEdge?this._host.getFormCode():"WMSRPM"},o.prototype.getPostBody=function(){return JSON.stringify(this.createTrendingSearchAPIProvision(n.cleanGuid(this._host.getRawImpressionGuid()),this.getMuidCookie(),this.getQuickSearchFormCode(),e))},o.prototype.createTrendingSearchAPIProvision=function(n,i,r,u){return{ext:{pagetype:t.config.trendingSearchTwoRows?"trending6":"trending3",appId:"62BA1100B386183A53994BA2AE01182EBFD4A775"},device:{deviceType:2},id:n,imp:[{id:n}],site:{cat:["trendingrecs"],content:{url:"https://www.windowssearch.com/"},domain:"www.windowssearch.com",keywords:"default",page:"https://www.windowssearch.com/",publisher:{ext:{adunitid:11711330,propertyid:10319711,formcode:r,partnercode:u,test:t.config.th},id:"10319711",name:"windowssearch"}},user:{ext:{muid:i}}}},o.prototype.getMuidCookie=function(){if(!this._muidCache){var n=sj_cook.get(r);n&&(n=n.substr(r.length+1),this._muidCache=n)}return this._muidCache},o.prototype.fetch=function(r,u,e,o,s,h,c){var y=this,v,w;if(r.enabledDataSources[i]){var l={},p=t.ScopeConfig[t.Scope.Web]&&t.ScopeConfig[t.Scope.Web].prefixes?t.ScopeConfig[t.Scope.Web].prefixes[0]:null,a=this._host.getLanguage().toLowerCase();t.config.resumeSearch&&(l.quickSearchQuery=this._lastTypedQuery.getQuery(),l.removeAction=function(){y._lastTypedQuery.setQuery("");y._host.refreshCurrentPane()});t.shouldEnableQuickSearches(a)&&!t.shouldEnableTrendingSearches(a)&&(v=[],l.quickAnswers=n.WSB.getQuickAnswersTranslatedSuggestions(a),l.quickAnswers.forEach(function(n){p?v.push(p.toLowerCase()+": "+n.query):v.push(n.query)}),l.quickSearchQuery&&v.indexOf(l.quickSearchQuery)>-1&&(delete l.quickSearchQuery,delete l.removeAction));t.shouldEnableTrendingSearches(a)?(w=function(n,t){l.trendingSearches=[];!!t&&t.impressions&&t.impressions[0]&&t.impressions[0].queries&&(l.trendingSearches=t.impressions[0].queries.map(function(n){return{query:n.query,tooltip:"Web search for "+n.query,serpURLParams:{reqId:ThresholdUtilities.getUrlParameter(n.url,"reqId"),pc:ThresholdUtilities.getUrlParameter(n.url,"pc")}}}));u(i,l,undefined)},f.prototype.fetch.call(this,r,w,e,o,s,h,c)):u(i,l,undefined)}},o}(n.JsonDataProvider),u,f;t.QuickSearchSuggestionsDataProvider=o;u=function(){function t(){this.LastTypedQueryTTLms=6e5}return t.prototype.getQuery=function(){var t=n.getCurrentTime();return this._lastTypedQueryTimeStamp&&t-this._lastTypedQueryTimeStamp0&&this.isWebSpellCorrectedSuggestion(t[0])&&t.every(function(n){return n.handoffType==0})?!0:n.config.enableCISpeller==2&&!t.some(function(t){return n.isApp(t.type)||n.isSetting(t.type)})?!0:this.enableCISpeller(i)?!0:!1},t.prototype.isWebSpellCorrectedSuggestion=function(n){return n.type=="SC"||n.type=="OS"},t.prototype.isPreviousEventQuery=function(n,t){return n&&t&&n.length==t.length-1&&t.startsWith(n)},t.prototype.isBackspaceEventQuery=function(n,t){return n&&t&&n.length==t.length+1&&n.startsWith(t)},t.prototype.isTypedEventQuery=function(n,t){return(n||n==="")&&t&&n.length=n.config.enableCISpellerAtPrefixLength?!0:!1}return this._previousBestMatchSuggestion&&this._previousBestMatchSuggestion.query.toLocaleLowerCase().startsWith(t.toLocaleLowerCase())&&!this._previousBestMatchSuggestion.query.toLocaleLowerCase().startsWith(i.toLocaleLowerCase())&&this.isTypedEventQuery(t,i)&&i.length>=n.config.enableCISpellerAtPrefixLength?!0:!1},t}();t.PreviousKeystrokeCache=i})(t=n.Cache||(n.Cache={}))})(t=n.WSB||(n.WSB={}))}(AutoSuggest||(AutoSuggest={})),function(n){var t;(function(t){var i;(function(t){function l(n,t){e=n;s=t;var f=_ge("dialogBox");f&&(sj_be(f,"click",function(n){var r=n.target.id,t=i().filter(function(n){return n.id==r}).shift();t?(t.action&&t.action(),u()):r=="dialog_overlay"&&u();sj_sp(n)},!0),t.bindKeyDown(function(n){var e,o,t,s,f,u;if(r){e=void 0;switch(n){case 39:for(t=i(),o=!1,f=0,u=void 0;u=t[f];f++)if(o){e=u;break}else if(o=u.selected==!0,o&&f+1==t.length){e=t[0];break}break;case 37:for(t=i(),s=void 0,f=0,u=void 0;u=t[f];f++){if(u.selected==!0){e=s?s:t[t.length-1];break}s=u}}e&&c(e)}}),t.bindKeyEscape(function(n){o()&&(u(),n.handled=!0)}))}function a(t,i,u,o){var h,c;if(f=[],i.length==0)throw new Error("DialogBox: Empty buttons array");f=i.map(function(n,t){var i=n;return i.id="dialog_b"+t,i.narratorText=i.text,i.selected&&(h=i.id),i});c={isVisible:!0,title:u,messageText:t,buttons:f,isModal:o};e.updateDialogBox(c);h&&n.safeSetTimeout(function(){return _ge(h).focus()},0,"DialogBox.show");s.setFocusInWebView("dialogBoxViewModel");r=!0}function u(){if(r)e.updateDialogBox({isVisible:!1}),r=!1}function o(){return r}function i(){return f}function v(){return i().map(function(n){return[n]})}function h(){return i().filter(function(n){return n.selected}).shift()}function c(n){for(var r,t=0,u=i();t<\/body><\/html>",{},undefined,c);y=n.getCurrentTime();this._previewPaneViewModelParent.onResponseReceived(y);return}var p=r.inorganic?!1:u==0,b=t.RuntimeConfig.QfMode==6?undefined:p?"WMSRPA":"WMSRPM",s=c?this._navigationHelper.getImageSearchUrl(t.config.enableSnipSearchV2):this._navigationHelper.getSearchUrl(r.fullPartialQuery,i.query,i.type,h,i.handoffType,b,!0,null,p);if(s+="&qfig="+this._instrumentationHelper.getImpressionGuid(this._sequenceNumberManager.getSequenceNumber()),this._msRewardsViewModel&&this._msRewardsViewModel.isRewardsEnabled()&&(s+="&rewards=1"),r.serpURLParams)for(a in r.serpURLParams)s=ThresholdUtilities.setUrlParameter(s,a,r.serpURLParams[a]);this._previousURLs=[];c?(v=function(){return o.renderErrorMessage(i.query)},w=r.overrideActionHandlerAsync,w(function(n){n?o.downloadAndDisplayMiniSerp(i,s,n,u,i.previewCallback):(o.miniSerpErrorInstrumentation("notHaveMultipartBody"),v())},function(){o.miniSerpErrorInstrumentation("bingImageSearchActionFailed");v()})):this.downloadAndDisplayMiniSerp(i,s,null,u,i.previewCallback)},i.prototype.miniSERPRenderTimeoutInstrumentation=function(n){var t;t={FunctionCalled:n};this._instrumentationHelper.logClientInstEvent(e,"MiniSERPRenderTimeout",this._sequenceNumberManager.getSequenceNumber(),t)},i.prototype.miniSerpErrorInstrumentation=function(n,t,i){var r;r=i?{ErrorCause:n,ResponseRecievedTimeStamp:t.toString(),ResponseText:i.responseText,ContentType:i.contentType,ResponseStatusCode:i.status.toString(),RequestStatusCode:i.result.toString()}:{ErrorCause:n};this._instrumentationHelper.logClientInstEvent(e,"MiniSERPError",this._sequenceNumberManager.getSequenceNumber(),r)},i.prototype.renderOfflineMessage=function(t){var i=n.isBrowserOnline(),r=this._host.getLocString("PreviewPaneOfflineTitle"),u=this._host.getLocString("PreviewPaneOfflineMessage"),f=u.split("{0}"),e={isOnline:i,previewPaneTitle:r,previewPaneMessageParts:f,fullPartialQuery:t};this._page.updatePreviewErrorMessageView(e)},i.prototype.renderErrorMessage=function(t){var i=n.isBrowserOnline(),r=this._host.getLocString("PreviewPaneErrorMessage"),u=r.split("{0}"),f={isOnline:i,previewPaneTitle:"",previewPaneMessageParts:u,fullPartialQuery:t};this._page.updatePreviewErrorMessageView(f)},i.prototype.downloadAndDisplayMiniSerp=function(i,r,u,f,e){var o=this,l=!1,a,v,y,p,w,s;t.config.th&&(a=ClientTestHooks.getUrlValue("client"),l=a&&a.toLowerCase()=="windows",v=ClientTestHooks.getUrlValue("previewPaneUrlOverride"),r=v?decodeURIComponent(v):ClientTestHooks.CopyTestParameters(_w.location.search,r),l&&(r=ThresholdUtilities.setUrlParameter(r,"client","windowsMiniSerp")),y=ClientTestHooks.getUrlValue("miniSerpBag"),y&&(r=ThresholdUtilities.setUrlParameter(r,"bag",y)),p=ClientTestHooks.getUrlValue("dummyref"),p&&(r=ThresholdUtilities.setUrlParameter(r,"dummyref",p)));w=f==0;sj_evt.fire(t.MiniSerpFetchEvent,i,w);s=this._host.getCustomHeaders(null);s["X-BM-DeviceDimensionsLogical"]=h+"x"+this._root.clientHeight;s["X-BM-DeviceDimensions"]=String(Math.round(h*this._deviceScale))+"x"+this._root.clientHeight;l||(s["User-Agent"]=navigator.userAgent+" RestrictedAPI");u&&(s["Content-Type"]=u.contentType);s["X-Search-SafeSearch"]="Strict";var b=++this._previewRequestId,c,k=function(t){if(c)sb_ct(c),c=null;else return;o.miniSERPRenderTimeoutInstrumentation("miniSerpViewModelCallback");var f=n.getCurrentTime();o._previewPaneViewModelParent.onResponseReceived(f);t.status==200&&t.responseText?(o._previousURLs.push(r),o.renderIframe(r,t.responseText,s,l,!!u,e)):(o.miniSerpErrorInstrumentation("renderErrorMessage",f,t),o.renderErrorMessage(i.query))},d=(t.config.miniSERPRequestRetries+1)*t.config.miniSERPRequestTimeout+1e3;c=n.safeSetTimeout(function(){o._previewedSuggestion!=null&&o._previewedSuggestion==i&&(c=null,o.miniSERPRenderTimeoutInstrumentation("ppMiniSerpRenderTimeout"),o.stopLoadingScreen(),o.renderErrorMessage(i.query))},d,"ppMiniSerpRenderTimer");this.fetchMiniSerpUrl(r,u?u.data:null,s,k,b,u?0:t.config.miniSERPRequestRetries)},i.prototype.isDarkModeEnabled=function(){return s.theme?s.theme.startsWith("000000"):!1},i.prototype.fetchMiniSerpUrl=function(i,r,u,f,o,s){var h=this,c=f;s>0&&(c=function(n){if(n.result==0&&n.responseText)f(n);else{var r={Url:i,StatusCode:n.status.toString(),Timeout:t.config.miniSERPRequestTimeout.toString(),RetriesRemaining:s.toString()};h._instrumentationHelper.logClientInstEvent(e,"MiniSERPRefetch",h._sequenceNumberManager.getSequenceNumber(),r);h.fetchMiniSerpUrl(i,null,u,f,o,s-1)}});t.config.darkMode&&this.isDarkModeEnabled()&&!i.includes("&darkschemeovr=1")&&(i+="&darkschemeovr=1");n.fetchUrl(i,u,r,c,null,function(){return o==h._previewRequestId},!0,r?undefined:t.config.miniSERPRequestTimeout)},i.prototype.renderIframe=function(i,r,u,f,e,o){var s=this;this.clearContent();this._iframe=sj_ce("iframe",t.MiniSerpIframeId);this._iframe.setAttribute("scrolling","no");this._contentContainer.classList.add("miniSerpContainer");this._contentContainer.appendChild(this._iframe);var c=this._iframe.contentWindow,h=this._iframe.contentDocument,l=!1;this._footer&&(t.setVisibility(this._footer,!e),t.setVisibility(this._mask,!e));this.setIframeHeight(0);this._onIFrameLoadedCallback=function(){var e=h.body,o=0,r;s._calculateIFrameHeight=function(){var n=e.offsetHeight;n!=o&&n>0&&(o=s.setIframeHeight(n))};s._calculateIFrameHeight();s.overrideAjaxCalls(c,u,f);s.captureNavigationsAndSizeEvents(i,e,c,h);s._scrollArea.scrollTop=0;t.config.backStackSearchEnabled&&(s._shouldAddSearchBackStack=!0,s._currentBackStackTimeout&&clearTimeout(s._currentBackStackTimeout),s._currentBackStackTimeout=sb_st(function(){s._shouldAddSearchBackStack=!1},t.config.miniSerpRedirectTimeoutInMs));n.contains([2,3],s._currentVertical)&&(r={childList:!0,subtree:!0},s._mutationObserver=new MutationObserver(function(){s._calculateIFrameHeight&&s._calculateIFrameHeight()}),n.safeExecute(function(){s._currentVertical===2?s._mutationObserver.observe(h.getElementById("images"),r):s._currentVertical===3&&s._mutationObserver.observe(h.getElementById("video"),r)},"onIFrameLoadedCallback"));s._msRewardsViewModel&&s._msRewardsViewModel.isRewardsEnabled()&&c.sj_rra&&c.sj_rra(i);s._onPreviewPaneRendered&&(s._onPreviewPaneRendered(!0,!1,null),s._onPreviewPaneRendered=null)};this._iframe.onload=function(){if(l){s.tryLaunchUrl(i,c.location.href,0);return}l=!0;s.overrideAjaxCalls(c,u,f)};h.open();h.write(r);h.write("");o&&o(this._iframe.contentWindow);h.write("