var __extends=this&&this.__extends||function(){var 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])};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 u(i,r,u,f,e,o,s){t(i,r,u,function(t){return f(t.status==200&&t.responseText?n.safeExecute(function(){return JSON.parse(t.responseText)},"JSON.parse"):null)},e,o,s)}function t(n,t,i,r,u,f,e){var o=sj_gx(),s,h;try{o.open(i?"POST":"GET",n,!0)}catch(c){SharedLogHelper.LogError("fetchUrl",n,c);r&&r({responseText:"",contentType:"",status:-1});return}if(t)for(s in t)o.setRequestHeader(s,t[s]);u&&(h=u.register(function(){return o.abort()},!1,"xhr abort"));o.onreadystatechange=function(){o.readyState==4&&(!f||f())&&(o.onreadystatechange=function(){},h&&u.unregister(h),r&&r({responseText:o.responseText,contentType:o.getResponseHeader("content-type")||"",status:o.status}))};typeof e!="undefined"?o.withCredentials=e:o.withCredentials!==undefined&&(o.withCredentials=!0);o.send(i)}function f(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 i,r;n.fetchUrlJson=u;n.fetchUrl=t;i=function(){function i(t){this._dataSource=t;this._delay=n.config.webDataSourcesWithThrottling[t]||0}return i.prototype.getBaseUrl=function(){throw new Error("Not Implemented");},i.prototype.getPostBody=function(){return undefined},i.prototype.onBeforeFetchUrl=function(){},i.prototype.createUrl=function(t){return decodeURIComponent(this.getBaseUrl())+(t?n.encodeQueryParameter(t.queryToFetch.toLowerCase()):"")},i.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},i.prototype.fetch=function(t,i,r,u,f,e,o){var h=this,s,c;if(n.isDataSourceEnabled(this._dataSource,t))if(s=this.addParamsToUrl(this.createUrl(t),e),c=this.getPostBody(t)||"",this._timer&&(sb_ct(this._timer),this._timer=null),this._delay>0&&!t.isFormulatedQuery)this._timer=sb_st(function(){return n.safeExecute(function(){h._timer=null;h.onBeforeFetchUrl(r,s);h.fetchUrl(s,o,c,i,u,f)},"fetchDelay")},this._delay);else{this.onBeforeFetchUrl(r,s);this.fetchUrl(s,o,c,i,u,f)}},i.prototype.fetchUrl=function(i,r,u,f,e,o){var s=this;t(i,r,u,function(t){var r=t.responseText,o=t.contentType,u=t.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,i)));f(s._dataSource,e,u==200?null:u.toString())},this._delay>0?e:null,o)},i}();n.JsonDataProvider=i;r=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}(i);n.AsSuggestionsDataProvider=r;n.getIconFromOnlineResponse=f})(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=!!h.previewPaneLaunchCount);f.primaryMetadata=s.title||s.secondaryText;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;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)),{content:"",type:2})});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=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])};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.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 i[0]}function or(n){return f||g(),!!f[n]}function sr(n,t,i){if(!f||!f[i]||t.taskFrame)return!1;var r=a(i,t);return r.sfgaoFilter?!r.sfgaoFilter(n.getProperty("System.SFGAOFlags")):!1}function r(n,t){return n=ai.concat(n),t&&(n=n.concat(vi)),n}function g(){var a=0,e=SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.getUserSID(),d=ni(a,e,!1),g=d[0],o=d[1],nt=ni(a,e,!0),i=nt[0],n=nt[1];w=g;vt=o;var tt='"System.Kind" != ANY ARRAY['+k.concat("link").map(function(n){return"'"+n+"'"}).join(", ")+"] AND "+g,gt="\"System.Kind\" = SOME ARRAY['program'] AND "+i,it='"System.Kind" != ANY ARRAY['+pt.map(function(n){return"'"+n+"'"}).join(", ")+"] AND "+i,s='"System.Kind" != ANY ARRAY['+yt.concat(k).concat("folder").map(function(n){return"'"+n+"'"}).join(", ")+"] AND "+i,ti="\"System.Kind\" = SOME ARRAY['folder'] AND "+i,wt="\"System.Kind\" = SOME ARRAY['Music'] AND "+i,bt="\"System.Kind\" = SOME ARRAY['Picture'] AND "+i,kt='"System.Kind" = SOME ARRAY['+b.map(function(n){return"'"+n+"'"}).join(", ")+"] AND "+i,dt="SCOPE = 'winrt://{"+e+"}/LS/Microsoft.MicrosoftEdge_8wekyb3d8bbwe/spartan history'";f={};f.IFF=[{selectFields:r(h,!1),filterFieldsSets:[rt],mostRelevantProps:c,kindAndScopeClauses:tt,sortClause:u,searchOptions:3,sfgaoFilter:o,enabled:function(n){return!!n.queryToFetch&&!t.supportsShortcuts("IFF",n)}},{selectFields:r(h,!1),filterFieldsSets:[],mostRelevantProps:c,kindAndScopeClauses:tt,sortClause:u,searchOptions:0,sfgaoFilter:o,enabled:function(n){return!n.queryToFetch&&!t.supportsShortcuts("IFF",n)}},{selectFields:r(ut,!0),filterFieldsSets:[yi],mostRelevantProps:c,kindAndScopeClauses:it,sortClause:u,searchOptions:3,sfgaoFilter:n,enabled:function(n){return!!n.queryToFetch&&t.supportsShortcuts("IFF",n)}},{selectFields:r(ut,!0),filterFieldsSets:[],mostRelevantProps:c,kindAndScopeClauses:it,sortClause:u,searchOptions:0,sfgaoFilter:n,enabled:function(n){return!n.queryToFetch&&t.supportsShortcuts("IFF",n)}},];f.EBH=[{selectFields:ft,filterFieldsSets:[pi],mostRelevantProps:et,kindAndScopeClauses:dt,sortClause:ot,searchOptions:7,sfgaoFilter:null,enabled:function(n){return!!n.queryToFetch}},{selectFields:ft,filterFieldsSets:[wi],mostRelevantProps:et,kindAndScopeClauses:dt,sortClause:ot,searchOptions:0,sfgaoFilter:null,enabled:function(n){return!n.queryToFetch}},];f.MDOC=[{selectFields:r(l,!0),filterFieldsSets:[st.concat(gi)],mostRelevantProps:v,kindAndScopeClauses:s,sortClause:u,searchOptions:3,sfgaoFilter:n,enabled:function(n){return n.queryToFetch&&t.config.minLengthForContentMatch&&n.queryToFetch.length>=t.config.minLengthForContentMatch}},{selectFields:r(l,!0),filterFieldsSets:[st],mostRelevantProps:v,kindAndScopeClauses:s,sortClause:u,searchOptions:3,sfgaoFilter:n,enabled:function(n){return n.queryToFetch&&(!t.config.minLengthForContentMatch||n.queryToFetch.length0&&(f+="WITH ("+n.mostRelevantProps.join(", ")+") AS #MRProps "),e=gr(n,t,i,r,u),e&&(f+="("+e+") AND "),f+n.kindAndScopeClauses}function br(n,t){return SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.tokenize(n,t)}function kr(n){return SearchAppWrapper.CortanaApp.queryFormulationView.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(e="",c=0,w=y;c=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 nt(n){return kt(n,2)}function iu(n){var t=s[n];if(t)return t;throw new Error("select fields for NL Data source was not found: "+n);}function o(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:iu(n),filterFieldsSets:f,kindAndScopeClauses:e?e+" AND "+w:w,mostRelevantProps:[],searchOptions:0,sortClause:u,sfgaoFilter:vt}}function uu(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&si)&&!(n&oi)&&(!!(n&&hi)||n&&li&&!!(n&&tt)||n&&ci&&!!(n&&tt))}:(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 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=4096,si=524288,hi=4194304,tt=536870912,ci=8388608,li=268435456,it=3,u='"System.Search.Rank" DESC, "System.DateModified" DESC, "System.ItemNameDisplay" ASC',ai=["System.Kind","System.Search.Rank","System.ParsingPath","System.DateCreated","System.DateModified","System.Search.QueryPropertyHits","System.ItemNameDisplay","System.FileExtension","System.ItemType",],vi=["System.Link.TargetParsingPath","System.SFGAOFlags",],h=["System.Title","System.Music.AlbumTitle","System.Music.DisplayArtist"],c=["System.ItemNameDisplay","System.Music.DisplayArtist","System.Music.AlbumTitle",],rt=["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)",],ut=h.concat("System.DateAccessed"),yi=rt.concat(["CONTAINS(System.Link.TargetParsingPath, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 920)"]),ft=["System.ItemNameDisplay","System.Search.QueryPropertyHits","System.Kind","System.Search.Rank","System.Link.TargetUrl","System.Title","System.History.VisitCount","System.Link.DateVisited","System.DateCreated","System.DateModified",],et=["System.Link.TargetUrl","System.Title",],pi=["(System.Link.TargetUrl LIKE 'http%' AND CONTAINS(System.Title, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 1000))","(System.Link.TargetUrl LIKE 'http%' AND CONTAINS(System.Link.TargetUrl, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 995))",],wi=["(System.Link.TargetUrl LIKE 'http%' RANK BY COERCION(ABSOLUTE, 995))",],ot='"System.History.VisitCount" DESC, "System.Link.DateVisited" DESC, "System.Title" ASC',bi=["System.DateAccessed",],ki=["System.ItemNameDisplay",],di=["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)",],l=["System.Search.AutoSummary","System.Keywords","System.Title","System.Author","System.Document.LastAuthor",],v=["System.ItemNameDisplay","System.Keywords","System.Title",],st=["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)",],gi="CONTAINS(System.Search.Contents, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 545)",nr=[],tr=["System.ItemNameDisplay",],ir=["System.ItemNameDisplay = '{0}' RANK BY COERCION(ABSOLUTE, 999)","CONTAINS(System.ItemNameDisplay, '\"{0}*\"') RANK BY COERCION(ABSOLUTE, 895)",],y=["System.Photo.TagViewAggregate","System.Title",],ht=["System.ItemNameDisplay","System.Photo.TagViewAggregate",],rr=["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)",],p=["System.Title","System.Keywords","System.Music.DisplayArtist","System.Music.Genre",],ct=["System.ItemNameDisplay","System.Title","System.Keywords",],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.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)",],lt=["System.Title","System.Music.DisplayArtist","System.Music.AlbumTitle","System.Music.Genre",],at=["System.ItemNameDisplay","System.Title","System.Music.AlbumTitle",],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.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)",],er=["path = '{0}'"],f,s,dt;i.getStrategy=a;i.dataSourceSupported=or;i.suppress=sr;var w,vt,b=["Movie","RecordedTV","Video"],yt=b.concat(["Picture","Music"]),pt=["calendar","game","web history","feed","contact","task","journal","note","instantmessage"],k=pt.concat("program"),d=yt.concat(k).concat(["folder","link"]).map(function(n){return"'"+n+"'"}).join(",");i.initStrategies=g;i.generateIndexerQueryAsync=hr;i.generateIndexerQueryForMRUFilesAndFolders=cr;i.toBrowsingHistoryItem=ar;i.fixKind=vr;s={};s.MPHO=r(y,!1);s.MVID=r(p,!1);s.MDOC=r(l,!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 s(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 i(n,i,r,u,f,e){return{deviceItem:n,getIcon:s(n,n.id,r,r&&!t.localDataSourceMayContainPII(r),t.displayedInGridLayout(i),u,f),icon:e?u:null,suggestionType:i}}function e(n,t,i){return{deviceItem:n,icon:i,suggestionType:t}}function r(t,i,r){switch(t){case"program":return"IBA";case"picture":return i&&n.contains(h,i.toLowerCase())?"FL":"LI";case"video":return i&&n.contains(c,i.toLowerCase())?"FL":"LV";case"movie":case"recordedtv":return"LV";case"music":return"MU";case"folder":return"FD";default:return r}}function o(i,r,u,f,e,o,s,h,c,l){var v=l&&s&&c?i.filter(function(t){return n.contains(Object.keys(g),t)}):[],a;v.length>0&&(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 lt(n,t){if(!t.launchArguments||ct.test(n.query))return!0;var i=t.id.toLowerCase();return nt.some(function(n){return i.includes(n)})?!0:!1}function tt(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:(s=n.startsWith(o),!s)?!0:f.Counter>=t.config.maxCISpellCorrectionCandidates?!0:(f.Counter++,!1)}function it(n,t){var r,i;if(!!t&&t.length==0||(r=t.split(" "),n.length!=r.length))return!1;for(i=0;i0){if(!i.queryToFetch&&!c.every(function(n){return n.supportsEmptyQuery}))throw new Error(u);if(e&&e.register(function(){return SearchAppWrapper.CortanaApp.queryFormulationView.cancelLastDeviceQuery()},!1,"cancelLastDeviceQuery"),rt=n.safeExecute(function(){return SearchAppWrapper.CortanaApp.queryFormulationView.startDeviceQuery(i.queryToFetch)},"startDeviceQuery",null,i.queryToFetch),rt)for(a=0,ut=c;a0){if(!i.queryToFetch&&!s.every(function(n){return n.supportsEmptyQuery}))throw new Error(u);b=i.taskFrame?i.taskFrame.raw:"";t.Promise.safeChain("executeSearchAsync",function(){return SearchAppWrapper.CortanaApp.searchResultsView.executeSearchAsync(i.queryToFetch,b)},function(n){var t,u,f;if(o())if(n)for(t=0,u=s;t0){if(!i.queryToFetch&&!h.every(function(n){return n.supportsEmptyQuery}))throw new Error(u);for(k=0,ft=h;k0){if(!i.queryToFetch&&!d.every(function(n){return n.supportsEmptyQuery}))throw new Error(u);for(st=function(n){e&&n.customCancellation&&e.register(function(){return n.customCancellation()},!0,n.dataSource+" cancellation");ht.searchFolderWithMultipleResults(i,n,i,r,o,e)},ht=this,g=0,et=d;g0){if(!i.queryToFetch&&!nt.every(function(n){return n.supportsEmptyQuery}))throw new Error(u);for(ct=function(n){e&&n.customCancellation&&e.register(function(){return n.customCancellation()},!0,n.dataSource+" cancellation");lt.searchFolderWithSingleResult(i,n,i,r,o)},lt=this,tt=0,ot=nt;tt8?i.maxAfter8charsOrInL2ZeroInput:n.queryToFetch.length>3?i.maxAfter3chars:i.maxUpTo3chars},e.prototype.toLocalResponse=function(n,r,u,f,e){var l,a,c,v,h;e&&(a=f,a.getGroupDisplayName&&(l=a.getGroupDisplayName(e)));var w={Counter:0},p=[],b=u.length=t.config.enableCISpellerAtPrefixLength&&this._previousKeystrokeCache&&this._previousKeystrokeCache.enableCISpeller(n.queryToFetch)?!0:!1},e.prototype.searchFolderWithMultipleResults=function(i,r,u,o,s,h){var v=this,c=r.dataSource,y=this.getMax(i,r),l=!u,p,a;if(l)p=function(){return t.IndexerQueryGenerator.generateIndexerQueryAsync(i,y,c).then(function(n){return SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.queryWindowsSearchIndexerAsync(n)})};else{if(a=n.safeExecute(function(){return r.getResultsContainer(u)},"getResultsContainer "+c),!a){o(c,f,null);return}p=function(){return v.getResults(i,y,a,r)}}t.Promise.safeChain(l?"queryWindowsSearchIndexerAsync":"getItemsAsync",p,function(n){var u,f,h;s()&&(u=n.resultSet,f=void 0,u?f=n.state:u=n,l&&(c=="EBH"?u=u.map(function(n){return t.IndexerQueryGenerator.toBrowsingHistoryItem(n)}):t.supportsShortcuts(c,i)&&(u=u.map(function(n){return t.IndexerQueryGenerator.fixKind(n)}))),h=e.getDataSourceState(f),o(c,v.toLocalResponse(y,i,u,r,a),h))},function(t){n.isCancellation(t)||v.logProviderFailure(c);o(c,f,null)},l?h:null,c+" "+i.queryToFetch)},e.prototype.searchFolderWithSingleResult=function(i,r,u,e,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()&&e(s,h.toLocalResponse(1,i,n?[n]:[],r,null),null)},function(t){n.isCancellation(t)||h.logProviderFailure(s);e(s,f,null)},null,i.queryToFetch):e(s,f,null)},e.prototype.logProviderFailure=function(i){var r=t.providerFailureLogName(i);r&&SearchAppWrapper.CortanaApp.queryFormulationView.logProviderFailure&&n.safeExecute(function(){return SearchAppWrapper.CortanaApp.queryFormulationView.logProviderFailure(r,"ErrorForTopHit")},"logProviderFailure")},e.getDataSourceState=function(n){switch(n){case 0:return"UN";case 1:return"NI";case 2:return"PI"}return undefined},e.getApps=function(n,i,r,u,f){o(n,i,"findAppsAsync",function(n){return SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.findAppsAsync(n)},function(n){return l.customCreateLocalResponseSuggestion(n,null,u)},r,u,t.config.cacheAppItems?b:null,!0,f)},e.getSettings=function(n,i,r,u,f){o(n,i,"findSettingsAsync",function(n){return SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.findSettingsAsync(n)},function(n){return a.customCreateLocalResponseSuggestion(n,null,u)},r,u,t.config.cacheSettingItems&&!f?k:null)},e.getFiles=function(n,u,f,e,s){o(n,u,"findFilesAsync",function(n){if(t.IndexerQueryGenerator){var i=t.IndexerQueryGenerator.generateIndexerQueryForMRUFilesAndFolders(f,"MFF",n);return SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.queryWindowsSearchIndexerAsync(i).then(function(n){for(var i,r={},t=0,u=n.resultSet;t0&&--this._currentScopeTileIndex;i.forEach(function(n){return n.tabIndex=-1});i[this._currentScopeTileIndex].tabIndex=1;i[this._currentScopeTileIndex].focus()},p.prototype.handleOptInOutNavigation=function(n,t){if(!this.isScopesL2Visible()){var i;n.id==="optInYesBtn"&&t?i=_ge("optInNoBtn"):n.id!=="optInNoBtn"||t||(i=_ge("optInYesBtn"));i&&i.focus()}},p.prototype.render=function(n,i,r,u,f){if(this._currentQuery=n,n&&(n.fullPartialQuery||t.zeroInputAvailable)){var e=t.getEffectiveScope(n);this.innerRender(n.scope,e,n,i,r,u,f)}else this.cleanUp()},p.prototype.getScopeToolTip=function(n,i){var u=t.ScopeConfig[n],f=t.getScopeDisplayName(u,this._host),r;if(i){if(n==t.Scope.All)return null;r="RemovingScopeNarratorText2"}else r=n==t.Scope.All?"AddingScopeNarratorTextAll2":"AddingScopeNarratorText";return this._host.getLocString(r,f.toLocaleLowerCase())},p.prototype.getScopeDescription=function(n){var t=this.getSources(n);return t?t.join(this._host.getLocString("Comma")+" "):null},p.prototype.getSources=function(i){var r,u,f;switch(i){case t.Scope.All:return r=[this._host.getLocString("MostRelevantOnThisPC")],n.isBingEnabled()&&r.push(t.getScopeDisplayName(t.ScopeConfig[t.Scope.Web],this._host)),u=t.getAccountTypeForCloudContent(),u!=3&&u!=0&&t.isCloudSearchEnabledCache&&t.substrateProvidersEnabled()&&r.push(this._host.getLocString("CloudServices")),r;case t.Scope.Apps:return n.isBingEnabled()?[this._host.getLocString("Installed"),this._host.getLocString("StoreGroup")]:[this._host.getLocString("Installed")];case t.Scope.Emails:case t.Scope.People:return[this._host.getLocString(t.getAccountTypeForCloudContent()==2?"Personal":"WorkOrSchool")];case t.Scope.Settings:return[this._host.getLocString("SystemSettingsAnnotation"),this._host.getLocString("ControlPanelAnnotation")];case t.Scope.Web:return n.isBingEnabled()?(r=[t.getWebSuggestionsGroupHeader(this._host),t.getWebsitesGroupHeader(this._host),this._host.getLocString("Answers")],t.getAccountTypeForCloudContent()==1&&t.isCloudSearchEnabledCache&&t.bingAtWorkProviderEnabled()&&r.push(this._host.getLocString("Bookmarks"))):r=[],t.edgeBrowsingHistoryAvailable()&&r.push(this._host.getLocString("EdgeHistoryGroup")),r;default:return t.isFileOrFolderScope(i)?(r=[t.getGroupSourceDisplayName(1,this._host)],t.isCloudSearchEnabledCache&&(n.isBingEnabled()&&(t.substrateProvidersEnabled()?t.getAccountTypeForCloudContent()==2&&r.push(t.getGroupSourceDisplayName(2,this._host)):(f=t.isCortanaPersonalized?t.cortanaAccountType:t.windowsAccountType,f!=1&&r.push(t.getGroupSourceDisplayName(2,this._host)))),i==t.Scope.Documents&&t.getAccountTypeForCloudContent()==1&&t.substrateProvidersEnabled()&&r.push(t.getGroupSourceDisplayName(3,this._host),t.getGroupSourceDisplayName(4,this._host))),r):null}},p.prototype.selectScope=function(n){var r,i,u,t;for(this._selectedScope&&(this._selectedScope.tabindex=-1,this._selectedScope.narratorText=this.getScopeToolTip(this._selectedScope.type,!1)),r=!1,i=0,u=this._scopeTiles;i=r.length)&&(t=0),r.slice(t,t+1)},p.prototype.getSelectedItem=function(){return this._selectedL2Item&&this._selectedL2Item.selected?this._selectedL2Item:null},p.prototype.select=function(n,t){var l=this,f,s,r,e,c,i,o,h,u;if(t){SharedLogHelper.LogError("selectScope",null,new Error("Can't update search box value when selecting scope"));return}if(this._selectedL2Item&&(this._selectedL2Item.selected=!1,this._selectedL2Item=null),n){if(w(n)){if(this._scopeTilesL2)for(f=0,s=this._scopeTilesL2;f0)){if(s.length!=1){l=n.safeExecute(function(){return c.parseOnlineSuggestion(u,e,f,i.Resources,o)},"parseOnlineSuggestion "+o);l&&h.push(l);return}a=function(n){var i=e.Attributes;return c.compliesWithMinVersion(i.appMinVersion,n.deviceItem.version)?(n.appContext=i.appContext,c.setRankingSignals(n,e),e.Text&&i.query&&(!t.isApp(n.type)||n.appContext)&&(n.text=e.Text,n.query=i.query),e.SecondaryText&&(n.primaryMetadata=e.SecondaryText),n.handoffType==5)?r(n,u,f,i.actionUri,i.taskFrame,parseFloat(i.confidence),parseInt(i.source),c._host):!0:!1};n.safeExecute(function(){return t.parseLocalSuggestion(u,s[0],o,f,c._host,c._temporaryMessageHandler,e.Attributes.stype,c._instrumentationHelper,h,a)},"parseLocalSuggestion "+o)}},i.prototype.parseOnlineSuggestion=function(i,f,e,s,h){var d=this,l=f.Attributes,v=l.stype,y,c,a;if(l.appId&&v!="CS"||l.settingId)return null;if(y=n.InstrumentedItem.createInstrumentedItem(e),c=t.createSuggestion(f.Text,null,n.getIconFromOnlineResponse(f),v,l.query,y,null,e,!1),c.primaryMetadata=f.SecondaryText,this.setRankingSignals(c,f),c.autoOpenPreviewPaneWhenOnTopHit=l.openPP==="1",l.isAnswer==="1"){if(!l.url&&!t.isCortanaEnabledCache)return null;c.handoffType=l.url||l.vertical?n.verticalToHandoffType(l.vertical):10;c.signals=f.Signals;o(c,i,e,f.InstantAnswer,l.additionalInfoText,l.secondaryIconUrl,l.url,l.segments,l.taskFrame,s,this._host,this._navigationHelper);l.noHeightRestriction==="1"&&c.classNames.push("noHeightRestriction")}else if(l.taskFrame){if(!t.isCortanaEnabledCache||(c.handoffType=l.actionUri.startsWith("action://FindMyStuff/")?4:5,!r(c,i,e,l.actionUri,l.taskFrame,parseFloat(l.confidence),parseInt(l.source),this._host)))return null}else if(c.type=="CS")c.handoffType=3,this.setStoreSuggestionProperties(c,i,e,l);else{if(!l.url)return null;if(c.autoOpenPreviewPaneWhenOnTopHit=l.openPP==="1",c.type=="MD"||c.type=="ML")a=n.prettyPrintUrl(l.query,i.queryToFetch,!0),a!=c.query&&(c.query=a,c.text=i.queryToFetch?HitHighlightingParser.addMarkers(a,i.queryToFetch):a),c.primaryMetadata&&!c.primaryMetadata.includes(HitHighlightingParser.startMarker)&&(c.primaryMetadata=HitHighlightingParser.addMarkers(c.primaryMetadata,i.queryToFetch)),c.handoffType=1,u(c,i,e,l.url,this._host);else{if(n.queryLooksLikeUrl(c.query))return null;c.handoffType=n.verticalToHandoffType(l.vertical);this.setWebSearchSuggestionProperties(c,i,e,l.url)}}if(!t.isValidSuggestion(c,"parseOnlineSuggestion"))return null;var p=c.segments,w=p?p.split(","):[],b=w.some(function(i){return n.contains(t.config.relatedWebImageSupportedSegments,i)}),k=w.some(function(i){return n.contains(t.config.relatedWebVideoSupportedSegments,i)});return(f.ChildSuggestions||b||k)&&(c.calculateChildSuggestions=function(){return d.calculateRelatedSuggestions(c,i,f,h,b,k)}),c},i.prototype.setStoreSuggestionProperties=function(n,i,r,u){var e=this,f;n.icon.bgColor=u.bgColor=="transparent"?this._host.getAccentColor():u.bgColor;n.classNames.push("action");f=parseFloat(u.avgRating);n.stars=this.getStarsRating(f);n.catalogScore=parseFloat(u.catalogScore);n.avgRating=f;n.ratingCount=parseInt(u.ratingCount);n.packageFamilyName=u.appId;n.click=function(){return e._host.launchStorePdp(u.productId)};n.narratorText=t.getNarratorText(n)},i.prototype.getStarsRating=function(n){var t=Math.round(n*2)/2;return Math.max(0,Math.min(5,t))},i.prototype.setRankingSignals=function(n,t){var i=t.Attributes;n.hc=i.hc==="1";n.highConfidenceSuggestionScore=+i.hcs;n.highConfidenceMetaSuggestionScore=t.HighConfidenceMetaSuggestionScore;n.prefetchConfidenceScore=t.PrefetchConfidenceScore;n.suggestionLogMeta=i.lm},i.prototype.compliesWithMinVersion=function(n,t){var r,u,i,f,e;if(!n)return!0;if(!t)return!1;for(r=n.split("."),u=t.split(".");r.length>u.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.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.launchUrl("https://www.bing.com/profile/history?fsi=1&FORM=WNSHIS")},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.removeBingHistorySuggestion=function(i){var r=this,u;i=HitHighlightingParser.removeMarkers(i);u=t.config.removeSuggUrl.replace("%7b0%7d",encodeURIComponent(i)).replace("%7bSID%7d",sj_cook.get("_SS","SID"));n.fetchUrlJson(u,null,null,function(n){n.success&&(r._host.refreshCurrentPane(),sb_st(function(){return r._temporaryMessageHandler.showTemporaryMessage(r._host.getLocString("RemoveFromWebHistoryConfirmation",i),{content:"",type:2})},250))})},i.prototype.addRelatedSuggestion=function(i,r,u,f,e,o,s){var h=t.createSuggestion(f,null,e,o,i?i.Query:u.query,n.InstrumentedItem.createInstrumentedItem(u.sequenceNumber),s,u.sequenceNumber,!1);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 y(n){return n?[n]:[]}function ft(n){if(n){var t=n.lastIndexOf(".");if(t>=0)return n.substring(t)}return""}function et(t){var i=t?new Date(t):null;return n.isValidDate(i)?i:null}function p(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(n,i,f,o,s){var b,h,tt,it,k,d,c,a,l,g,v,y,rt,w,nt;for(s===void 0&&(s=!1),!s&&f.extensionLC&&r.hideFileExtensions&&(b=f.extensionLC.length,h=f.query,h.toLocaleLowerCase().endsWith(f.extensionLC)&&(tt=HitHighlightingParser.addMarkers(h,n),tt.toLocaleLowerCase().endsWith(f.extensionLC)&&(f.query=h.substring(0,h.length-b),it=HitHighlightingParser.removeMarkers(f.text),h==it&&(k=f.text.toLocaleLowerCase().lastIndexOf(f.extensionLC),f.text=f.text.substring(0,k)+f.text.substr(k+b))))),a=f.lastModifiedDate,a&&(d=a.toLocaleDateString(),c=p(a),c||(c=a.toLocaleString(t.uiLanguageCache,{day:"numeric",month:"numeric",year:"numeric",hour:"numeric",minute:"numeric"}))),l=f.handoffType==2?f.path:decodeURI(f.url||""),f.tooltip=at(f,l,c,o),f.primaryMetadata=f.sourceForGroup&&f.sourceForGroup!=1?t.getGroupSourceDisplayName(f.sourceForGroup,o):f.itemTypeDisplayName,f.classNames=[],f.match?(g=(vt(f.match.matchType)?o.getLocString(t.MatchType[f.match.matchType])+": ":"")+HitHighlightingParser.addMarkers(f.match.matchedText,n),f.additionalInfoText=g,f.secondaryMetadata=g,f.classNames.push("withMatchAnnotation","forceNoWrapOutsideTopResult")):d&&(f.secondaryMetadata=o.getLocString("LastModified")+": "+d),f.narratorText=t.getNarratorText(f),t.displayedInGridLayout(f.type)&&(i?f.classNames.push("bigIcon","biggerIcon"):f.classNames.push("bigIcon")),!s&&f.handoffType==2&&r.copyToClipboard&&u(f,function(){return[{verb:"QF.CopyFullPath",displayName:o.getLocString("CopyFullPath"),executeSync:function(){return r.copyToClipboard(f.path,"")},icon:{type:1,content:""}}]},!1),v={},l&&(y=l.lastIndexOf("/"),y<0&&(y=l.lastIndexOf("\\")),rt=l.substring(0,y),v[o.getLocString("Location")]={text:rt,click:f.click}),c&&(v[o.getLocString("LastModified")]={text:c}),w=0,nt=e;w=0}function ct(n){var i,t;if(n&&typeof n=="object"&&n.length){for(i="",t=0;t900));tt=t.getGroupType(v);t.shouldSetThisPcGroupSource(tt,i)&&(v.sourceForGroup=1);bt(b,t.isL2(i),t.supportsShortcuts(u,i),v,u,e);o(v,"parseLocalSuggestion "+u)&&a(v)&&l.push(v)}}function ni(n,i){u(n,function(){var r,u;return n.duplicates&&(r=n.duplicates.find(function(n){return n.handoffType==7||n.handoffType==8}),r)?(u=[],u.push({verb:"OpenInBrowser",displayName:i.getLocString("OpenInBrowser"),executeSync:function(){return i.launchUrl(r.url+(r.handoffType==8?"?web=1":""))},icon:{type:1,content:""}}),r.locationUrl&&u.push({verb:"OpenFileLocationInBrowser",displayName:i.getLocString("OpenFileLocationIn",t.getGroupSourceDisplayName(r.sourceForGroup,i)),executeSync:function(){return i.launchUrl(r.locationUrl)},icon:{type:2,content:""}}),u):[]},!0)}function ti(n,i,r,f,e,o,s){var h=i.id,y=i.filePath,a=rt[h],w,p;if(!a&&y){w=y.toLowerCase();for(p in v)if(w.includes(p)){a=v[p];break}}a&&a.length==0||(t.alwaysWide||!ut.find(function(n){return n==h}))&&(n.calculateChildSuggestions=function(){return ii(h,y,n,i,a,r,f,e,o,s)},t.config.maxJLcm&&u(n,function(u){var e=[],o,s;return u||(n.calculateChildSuggestions&&n.calculateChildSuggestions(),n.childSuggestions&&(o=!1,n.childSuggestions.filter(function(n){return n.type=="JL"&&!n.displayed&&n.groupType==t.GroupType.JumpListTasks}).slice(0,t.config.maxJLcm).forEach(function(n){o=!0;var t={verb:"JumpListTask_"+h+"_"+n.text,displayName:n.text,executeSync:function(){return l(i,n,r,f)},getIcon:c(n.jumpListItem,n.parent,!1,h)};e.push(t)}),s=!1,n.childSuggestions.filter(function(n){return n.type=="JL"&&!n.displayed&&n.groupType!=t.GroupType.JumpListTasks}).slice(0,t.config.maxJLcm).forEach(function(n,t){var u,a;o&&!s&&(u={},e.push(u));s=!0;a={verb:"JumpList_"+h+"_"+t,displayName:n.text,executeSync:function(){return l(i,n,r,f)},getIcon:c(n.jumpListItem,n.parent,!0,h)};e.push(a)}))),e},!0))}function ii(i,r,u,f,e,s,a,v,y,p){var d,b,ft,w,g,rt,k,nt,ut,st;if(u.calculateChildSuggestions=null,d=f.jumpList,d&&d.length!=0){for(b=r||"",ft=b.indexOf("}"),b=b.substr(ft+1),w=[],g=0,rt=d;g0&&(u.childSuggestions=u.childSuggestions?u.childSuggestions.concat(w):w,h(w,s),p.instrumentDataSource(v,y,w,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 tt(i){return i.displayName?!t.alwaysWide&&n.olderThan2Weeks(i.lastAccessed)?!0:!1:!0}function it(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 l(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("jumpListItemDialogBoxCancel")}},{id:null,text:r.getLocString("Remove"),selected:!1,action:function(){a(n,i,r,u);r.setFocusInSearchBox("jumpListItemUnavailable")}}]):(u.showTemporaryMessage(r.getLocString("JumpListItemUnavailable"),{content:"",type:2}),a(n,i,r,u),r.setFocusInSearchBox("jumpListItemUnavailable"))})}function a(n,i,r,u){var f=function(){return ui(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 it(n.type)==i.groupType&&n.items.some(function(n){return!tt(n)})})?f():(r.refreshCurrentPane(),u.showTemporaryMessage(r.getLocString("RemovedFromList",i.text),{content:"",type:2}))},f)},f)):f()}function ri(n,t,i,r){t.jumpListItem.deleteAsync&&u(t,function(){var u={verb:"RemoveFromThisList",displayName:i.getLocString("RemoveFromThisList"),executeSync:function(){return a(n,t,i,r)},icon:{type:2,content:""}};return[u]},!0)}function ui(n){var i=_ge(n.id);t.setVisibility(i,!1);n.suppressed=!0}var r=SearchAppWrapper.CortanaApp,rt={"Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge":[0],"Microsoft.InternetExplorer.Default":[0],Chrome:[0],"360browser":[0]},v={skype:[],outlook:[0],"360browser":[0],chrome:[0],iexplore:[0],opera:[0],firefox:[0],safari:[0]},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"],],ut=["Microsoft.Windows.Explorer",],k;t.getFileExtension=ft;t.toDate=et;t.getTodayTimeString=p;t.setFileTemplate=f;t.enrichMetadataFromDuplicate=ot;t.getOneDriveSuggestionIcon=st;t.getIconForTypeAsync=w;t.isValidIcon=b;t.isValidSuggestion=o;t.setExtraVerbs=u;t.setExtraVerbsAsync=ht;k=function(){function i(n,t,i,r){this._host=n;this._instrumentationHelper=t;this._temporaryMessageHandler=i;this._ciDataLoader=r}return i.prototype.parse=function(i,r,u,f,e,o){for(var v,y,p,s=this,c=[],w=function(t){n.safeExecute(function(){return nt(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[e]&&(e!=r.language||u>r.version||u1&&(r=i[0],t=i[1],t!="00000000"&&SharedLogHelper.LogError("constraintIndexDownloader.urlResult",t,"Download encountered problems"))),{url:r,errorCode:t}},i.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])),{version:r,language:u}},i.prototype.getUrlForCiCab=function(t,i){return n.getWindowProtocol()+"//"+n.getWindowHost()+"/bcs/ci/"+t+"/"+i+".cab"},i.prototype.getCurrentCiVersion=function(){return this._ciVersion},i}();i.ConstraintIndexDataLoader=r})(i=t.ConstraintIndex||(t.ConstraintIndex={}))})(t=n.WSB||(n.WSB={}))}(AutoSuggest||(AutoSuggest={}));__extends=this&&this.__extends||function(){var 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])};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 i(n,i,r,u){r||(r={});t.getAuthAccountForCloudContent()=="Windows"&&t.cortanaAccountType!=3&&t.getWindowsAndCortanaAccountIdentityDiff()!=1&&t.substrateProvidersEnabled()?n.getAccount(0,t.getBingResourceOrScope(0),!1,!0,function(n){r["X-Search-RPSToken"]=n&&n.Token?n.Token:"";u(r)},"Windows"):u(r)}var r=function(r){function u(n,t){var i=r.call(this,"MODC")||this;return i._accessTokenManager=n,i._host=t,i}return __extends(u,r),u.prototype.getName=function(){return"MyStuffOneDriveDataProvider"},u.prototype.getBaseUrl=function(){return t.config.myStuffOneDriveRootUrl},u.prototype.getPostBody=function(n){return n.taskFrame?n.taskFrame.raw:""},u.prototype.fetch=function(t,u,f,e,o,s,h){var l=this,c;n.isDataSourceEnabled(this._dataSource,t)&&(c=function(i){var h=Object.assign({},s);delete h[n.Service.QueryParams.ImpressionGuid];delete h[n.Service.QueryParams.RequestElToken];r.prototype.fetch.call(l,t,u,f,e,o,h,i)},i(this._accessTokenManager,this._host,h,c))},u}(n.JsonDataProvider);t.MyStuffOneDriveDataProvider=r;t.updateOneDriveHeaders=i})(t=n.WSB||(n.WSB={}))}(AutoSuggest||(AutoSuggest={})),function(n){var t;(function(t){var i=function(){function i(n){this._host=n}return i.prototype.parse=function(n,i,r,u,f,e){var o=[];u&&(u.Results?(this.addContent(n,o,u.Results.OneDriveDocuments,"FL",t.Scope.Documents,i),this.addContent(n,o,u.Results.OneDriveFolders,"FD",t.Scope.Folders,i),this.addContent(n,o,u.Results.OneDriveImages,"LI",t.Scope.Photos,i),this.addContent(n,o,u.Results.OneDriveVideos,"LV",t.Scope.Videos,i),this.addContent(n,o,u.Results.OneDriveAudio,"MU",t.Scope.Music,i)):SharedLogHelper.LogError("MyStuffOneDriveParser",null,new Error("Missing Results property")));t.decorateSuggestionsWithParentFolder(o,this._host);e("MODC",o,null)},i.prototype.addContent=function(i,r,u,f,e,o){var s=this,c,l,v,a;if(u&&n.isSuggestionTypeEnabled("MODC",f,7,i)){var h=t.Scope[e],y=function(u){var k,c,d,w,g,b;if(!u.Content)return SharedLogHelper.LogError("MyStuffOneDriveParser",h,new Error("Missing Content property")),{value:void 0};if(c=u.Content.OneDriveData,!c)return SharedLogHelper.LogError("MyStuffOneDriveParser",h,new Error("Missing OneDriveData property")),{value:void 0};if(d=c.propertyHits.length==1&&c.propertyHits[0]=="TextContent",d&&(!t.config.minLengthForContentMatch||i.queryToFetch.length0&&this.isWebSpellCorrectedSuggestion(n[0])&&n.every(function(n){return n.handoffType==0})?!0:!1},n.prototype.isWebSpellCorrectedSuggestion=function(n){return n.type=="SC"||n.type=="OS"},n.prototype.isPreviousEventQuery=function(n,t){return n&&t&&n.length==t.length-1&&t.startsWith(n)},n}();n.PreviousKeystrokeCache=t})(t=n.Cache||(n.Cache={}))})(t=n.WSB||(n.WSB={}))}(AutoSuggest||(AutoSuggest={})),function(n){var t;(function(t){var i;(function(t){function c(t,f){e=t;var o=_ge("dialogBox");if(!o){n.log("DialogBox wrapper element not found");return}sj_be(o,"click",function(n){var u=n.target.id,t=i.filter(function(n){return n.id==u}).shift();t?(t.action&&t.action(),r()):u=="dialog_overlay"&&r();sj_sp(n)},!0);f.bindKeyDown(function(n){var f,e,t,o,r,i;switch(n){case 39:for(t=u(),e=!1,r=0,i=void 0;i=t[r];r++)if(e){f=i;break}else if(e=i.selected==!0,e&&r+1==t.length){f=t[0];break}break;case 37:for(t=u(),o=void 0,r=0,i=void 0;i=t[r];r++){if(i.selected==!0){f=o?o:t[t.length-1];break}o=i}}f&&h(f)})}function l(n,t){i=[];var r;if(t.length==0)throw new Error("DialogBox: Empty buttons array");i=t.map(function(n,t){var i=n;return i.id="dialog_b"+t,i.narratorText=i.text,i.selected&&(r=i.id),i});e.updateDialogBox(!0,n,i);r&&sb_st(function(){return _ge(r).focus()},0);f=!0}function r(){f&&(e.updateDialogBox(!1),f=!1)}function o(){return f}function u(){return i.forEach(function(n){return n.selected=_ge(n.id)==_d.activeElement}),i}function s(){return u().filter(function(n){return n.selected}).shift()}function h(n){for(var r,t=0,u=i;t0&&t[t.length-1].selected&&r();sj_sp(n)}},!0);t.init=c;t.show=l;t.hide=r;t.isVisible=o;t.getSelectableItems=u;t.getSelectedItem=s;t.select=h;t.submit=a;t.onAfterKeyDown=v})(i=t.DialogBox||(t.DialogBox={}))})(t=n.WSB||(n.WSB={}))}(AutoSuggest||(AutoSuggest={})),function(n){var t;(function(n){n.DialogBoxViewModel=n.DialogBox})(t=n.WSB||(n.WSB={}))}(AutoSuggest||(AutoSuggest={})),function(n){var t;(function(t){function c(n){return n.includes("form=vsranf")}function l(t){var i=n.tryParseUrl(t,!0);return!!i&&/[\?\&]q=/i.test(i.parameters)&&!/[\?\&]view=detail/i.test(i.parameters)}function ht(t){var i=n.tryParseUrl(t,!0);return!!i&&st.test(i.parameters)}function ct(n){switch(n){case 1:case 0:return 1;case 13:return 2;case 14:return 3;default:throw Error("Unsupported handoff type: "+n);}}function a(n){switch(n){case 1:return 1;case 2:return 7;case 3:return 8;default:throw Error("Unsupported vertical: "+n);}}function v(t){var i=n.tryGetBingPathLC(t);return i?n.contains(et,i)?2:n.contains(ot,i)?3:n.contains(n.WebSearchPaths,i)?1:null:null}var s=t.PreviewPaneWidth-24,y="miniserp_focus",p="disableOutline",r=2,w=["tab-active","slide"],b=["aria-expanded"],k="videoPreview",d=300,f=30,g="IsSearchAppXYFocusEnabled",nt="WinJS",tt="dFocusExit",i="win-xyfocus-suspended",e="MiniSerpContentLoaded",it=["/account/","/settings.aspx"],u=function(){var n={};return n[37]="left",n[39]="right",n[38]="up",n[40]="down",n}(),rt=1e4,h=800,ut=100,ft=["&form=s00037&"],et=["/images/search","/images"],ot=["/videos/search","/videos"],st=/[\?\&]FORM=HDRSC[1-3]/i,lt=function(){function i(i,r,f,o,s){var h=this;this._host=i;this._navigationHelper=r;this._instrumentationHelper=f;this._sequenceNumberManager=o;this._previewPaneViewModelParent=s;this._deviceScale=1;this._previewRequestId=0;this._previousURLs=[];this.blockedMiniSERPUrls=[_w.location.origin+_w.location.pathname];this._root=_ge("qfPreviewPane");this._seeAllResults=_ge("seeAllResults");this._footer=_ge("footer");this._contentContainer=_ge("previewContainer");this._scrollArea=_ge("qfPreviewScrollArea");sj_be(this._scrollArea,"scroll",function(t){h._iframe&&n.contains([2,3],h._currentVertical)&&h._iframe.contentWindow.dispatchEvent(new Event(t.type,t));h._calculateIFrameHeight&&h._calculateIFrameHeight()});this._footer&&sj_be(this._footer,"keydown",function(i){h._iframe&&n.isUpOrDownKey(i.keyCode)?(i.keyCode==38?h.tryExecuteFocusOnMiniSerp(function(){return h._focusHelper.moveFocusToEdgeFocusableElement(1)}):t.config.allowKeyboardNavCycling&&h.tryExecuteFocusOnMiniSerp(function(){return h._focusHelper.moveFocusToEdgeFocusableElement(0)}),sj_pd(i),sj_sp(i)):i.keyCode==13&&h._footer.click()});sj_be(_w,"message",function(n){var r=n.data?n.data.msWinJSXYFocusControlMessage:null,i,f;r&&r.type==tt&&(i=r.direction,f=r.keyCode,h._focusHelper&&!h._focusHelper.isL2Visible()&&h._focusHelper.getXYFocusRoot()!=h._originalMiniSerpXYFocusRoot?(h._focusHelper.setXYFocusRoot(h._originalMiniSerpXYFocusRoot),h.tryExecuteFocusOnMiniSerp(function(){return h._focusHelper.moveFocus(i,f)})):(i!=u[t.getRtlAdjustedKey(39)]&&n.source.blur(),i==u[40]||i==u[38]&&t.config.allowKeyboardNavCycling?h._footer?h._footer.focus():h._focusHelper.moveFocusToEdgeFocusableElement(i==u[38]?1:0):i!=u[t.getRtlAdjustedKey(37)]||h._host.searchBoxHasFocus()||h._host.setFocusInSearchBox("previewPaneUnfocus")))});_w.addEventListener(e,function(){h._onIFrameLoadedCallback&&(h._onIFrameLoadedCallback(),h._onIFrameLoadedCallback=null)});i.bindShown(function(){ThresholdUtilities.getCortanaHeaders(function(n){n&&n["X-BM-DeviceScale"]&&(h._deviceScale=+n["X-BM-DeviceScale"]/100)});h.setVertical(1)});i.bindAppHidden(function(){h._seeAllResults&&(h._seeAllResults.innerText="");h._currentVertical=null});i.bindSearchBoxGotFocus(function(){h._focusHelper&&h._focusHelper.onSearchBoxFocusChanged()})}return i.prototype.getSelectableItems=function(){return[]},i.prototype.getSelectedItem=function(){return null},i.prototype.select=function(){},i.prototype.onAfterKeyDown=function(){},i.prototype.clear=function(){this._previewedSuggestionType=null;this._previewedSuggestionLayoutKValue=null;this._footer&&(t.setVisibility(this._footer,!1),this._footer.onclick=null);this.clearContent();this._previousURLs=[]},i.prototype.clearContent=function(){for(this._previewRequestId+=1,this._focusHelper=null,this._onIFrameLoadedCallback=null;this._contentContainer.hasChildNodes();)this._contentContainer.removeChild(this._contentContainer.lastChild);this._contentContainer.classList.remove("miniSerpContainer");this._contentContainer.classList.remove("errorMessageContainer");this._iframe&&(this._iframe=null,this._calculateIFrameHeight=null);this._mutationObserver&&(this._mutationObserver.disconnect(),this._mutationObserver=null)},i.prototype.hasFocus=function(){if(this._host.searchBoxHasFocus())return!1;var t=n.getCurrentActiveElement();return t&&t!=this._iframe&&this._root.contains(t)},i.prototype.focus=function(){var t=this,n;this.hasFocus()||(this._iframe?(n=this.tryExecuteFocusOnMiniSerp(function(){return t._focusHelper.moveFocusToLastFocusedElement()}),n?SearchAppWrapper.CortanaApp.focusWebView():this._host.setFocusInSearchBox("MiniSERP VM Focus failed")):this._previewPaneViewModelParent.focusPending=!0)},i.prototype.setVertical=function(n){if(n!=this._currentVertical){if(this._seeAllResults)switch(n){case 1:this._seeAllResults.innerText=this._host.getLocString("SeeAllResults");break;case 2:this._seeAllResults.innerText=this._host.getLocString("SeeAllImageResults");break;case 3:this._seeAllResults.innerText=this._host.getLocString("SeeAllVideoResults");break;default:throw new Error("Unsupported vertical type: "+n);}this._currentVertical=n}},i.prototype.update=function(i,r,u,f){var e=this,o,h,s;if(this._previewPaneId=f,this._previewedSuggestionType=i.type,this._previewedSuggestionLayoutKValue=i.instItem.getLayoutKValue(),o=i.type=="MB"&&i.segments=="Organization"?null:i.baseSearchUrl,this.setVertical(ct(i.handoffType)),this._footer&&(t.setVisibility(this._footer,!0),this._footer.onclick=function(t){e._previewPaneViewModelParent.onBeforeItemLaunch(n.getCurrentTime(),n.getInputType(t),3);e._host.launchSearch(i.query,e._navigationHelper.getSearchUrl(r.fullPartialQuery,i.query,i.type,o,i.handoffType),!1);e._previewPaneViewModelParent.onAfterItemLaunch(3)}),t.config.th&&ClientTestHooks.isTesthookParamSet("noSerp")){this.renderIframe(null,"<\/body><\/html>",{},undefined,u);h=n.getCurrentTime();this._previewPaneViewModelParent.onResponseReceived(h);return}s=this._navigationHelper.getSearchUrl(r.fullPartialQuery,i.query,i.type,o,i.handoffType,u?"WMSRPA":"WMSRPM",!0,null,u);s+="&qfig="+this._instrumentationHelper.getImpressionGuid(this._sequenceNumberManager.getSequenceNumber());this._previousURLs=[];this.downloadAndDisplayMiniSerp(s,u,i.previewCallback)},i.prototype.downloadAndDisplayMiniSerp=function(i,r,u){var f=this,o=!1,h,c,l,e,a;t.config.th&&(h=ClientTestHooks.getUrlValue("client"),o=h&&h.toLowerCase()=="windows",c=ClientTestHooks.getUrlValue("previewPaneUrlOverride"),i=c?decodeURIComponent(c):ClientTestHooks.CopyTestParameters(_w.location.search,i),o&&(i=ThresholdUtilities.setUrlParameter(i,"client","windowsMiniSerp")),l=ClientTestHooks.getUrlValue("miniSerpBag"),l&&(i=ThresholdUtilities.setUrlParameter(i,"bag",l)));e=this._host.getCustomHeaders();e["X-BM-DeviceDimensionsLogical"]=s+"x"+this._root.clientHeight;e["X-BM-DeviceDimensions"]=String(Math.round(s*this._deviceScale))+"x"+this._root.clientHeight;o||(e["User-Agent"]=navigator.userAgent+" RestrictedAPI");a=++this._previewRequestId;n.fetchUrl(i,e,null,function(t){var l=n.getCurrentTime(),h;f._previewPaneViewModelParent.onResponseReceived(l);if(t.status==200&&t.responseText)f._previousURLs.push(i),f.renderIframe(i,t.responseText,e,o,r),u&&u();else{var a=f._host.getLocString("PreviewPaneErrorMessage"),c=a.split("{0}"),v=n.safeExecute(function(){return(new RegExp("[?|&]q=([^&]+?)(&|#|$)").exec(decodeURIComponent(i).replace(/\+/g," "))||[null,""])[1]},"decodePreviewPaneSearchUrl",""),s=sj_ce("div","previewPaneErrorMessage");s.appendChild(_d.createTextNode(c[0]));h=_d.createElement("span");h.textContent=v;s.appendChild(h);s.appendChild(_d.createTextNode(c[1]));f._contentContainer.appendChild(s);f._contentContainer.classList.add("errorMessageContainer")}},null,function(){return a==f._previewRequestId},!0)},i.prototype.renderIframe=function(t,i,r,u){var f=this;this._iframe=sj_ce("iframe","miniIframeSerp");this._iframe.setAttribute("scrolling","no");this._contentContainer.classList.add("miniSerpContainer");this._contentContainer.appendChild(this._iframe);var s=this._iframe.contentWindow,o=this._iframe.contentDocument,h=!1;this.setIframeHeight(0);this._onIFrameLoadedCallback=function(){var e=o.body,h=0,i;f._calculateIFrameHeight=function(){var n=e.offsetHeight;n!=h&&n>0&&(h=f.setIframeHeight(n))};f._calculateIFrameHeight();f.overrideAjaxCalls(s,r,u);f.captureNavigationsAndSizeEvents(t,e,s,o);f._scrollArea.scrollTop=0;n.contains([2,3],f._currentVertical)&&(i={childList:!0,subtree:!0},f._mutationObserver=new MutationObserver(function(){f._calculateIFrameHeight&&f._calculateIFrameHeight()}),f._currentVertical===2?f._mutationObserver.observe(o.getElementById("images"),i):f._currentVertical===3&&f._mutationObserver.observe(o.getElementById("video"),i));f._instrumentationHelper.logClientInstEvent("Select","PreviewPaneRendered",f._sequenceNumberManager.getSequenceNumber(),{ppId:""+f._previewPaneId,suggestion:f._previewedSuggestionLayoutKValue})};this._iframe.onload=function(){if(h){f.tryLaunchUrl(t,s.location.href,0);return}h=!0;f.overrideAjaxCalls(s,r,u)};o.open();o.write(i);o.write("");o.write("