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)}}(),__spreadArrays,__assign,WSB;(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.config.moreLogForJSError&&t.responseURL?n.safeExecute(function(){return JSON.parse(t.responseText)},"JSON.parse.moreErrLog "+t.responseURL.substring(0,100),undefined,t.responseText.substring(0,100)):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,responseURL:n.responseURL}))}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),n.config.shGAWDx&&(t===null||t===void 0?void 0:t.fromSearchHome)&&(t===null||t===void 0?void 0:t.queryToFetch)==="Good news - MSN"&&(l="https://api.msn.com/news/feed?ocid=winsearch&market=en-us&query=good%20news&apikey=uvobH5fEn1uz1xwZ5yuwtWzu2y32WpRZ6EMpZx7o09"),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.TestHookUrlParameters&&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(n){var i=t.call(this,"Web")||this;return i._responseCacheManager=n,i}return __extends(i,t),i.prototype.getName=function(){return"AsSuggestionsDataProvider"},i.prototype.getBaseUrl=function(){return n.config.u},i.prototype.onBeforeFetchUrl=function(t,i){n.InstrumentationHelper.instrumentSnRProviderFetchUrl(t,i)},i.prototype.fetch=function(i,r,u,f,e,o,s){var c=this,h;n.isDataSourceEnabled(this._dataSource,i)&&(n.config.enableFetchStartLogging&&n.InstrumentationHelper.instrumentFetchProviderBegin(u,"ASDP:"+this._dataSource),h=r,h=function(t,u,f,e){u&&n.isEmptyUrlPrefix(i)&&(u.Suggestions=[]);c.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(i,r,u,f,e,o,s){var c=this,l=this._responseCacheManager.get(i),a,v,h;if(l){a=this.addParamsToUrl(this.createUrl(i),o);this.onBeforeFetchUrl(u,a);r(this._dataSource,l,null,1);n.config.forceUseNifQF&&this._dataSource=="Web"&&this.fetchWithoutCache(i,r,u,f,e,o,s)}else v=function(){return!0},h=r,h=function(n,t,u){e()&&r(n,t,u,0);i.queryToFetch&&c.responseIsValidForCaching(u,t)&&(t.ELToken&&(t=Object.assign({},t),delete t.ELToken),c._responseCacheManager.put(i,t))},t.prototype.fetch.call(this,i,h,u,f,v,o,s)},i.prototype.fetchWithoutCache=function(n,i,r,u,f,e,o){var s=this,c=function(){return!0},h=i;h=function(t,r,u){f()&&i(t,r,u,0);n.queryToFetch&&s.responseIsValidForCaching(u,r)&&(r.ELToken&&(r=Object.assign({},r),delete r.ELToken),s._responseCacheManager.put(n,r))};t.prototype.fetch.call(this,n,h,r,u,c,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})(WSB||(WSB={})),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.TestHookUrlParameters===null||n.TestHookUrlParameters===void 0?void 0:n.TestHookUrlParameters.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;r0){var n=this._pendingWrites.shift();n()}else this._tearDownPending&&this.teardownStorage()},t.prototype.teardownStorage=function(){this._writing?this._tearDownPending=!0:(this._tearDownPending=!1,this._storage&&this._storage.close())},t.prototype.initStorage=function(){var n=this;!this._storageOpenInProgress&&this.dataPopulated()&&(this._storageOpenInProgress=!0,this._storageFactory(function(t){n._storage=t;n._storageOpenInProgress=!1;n._pendingQueries.forEach(function(n){return n()});n._pendingQueries=[]},function(t){n.onError(t,"open storage");n._storageOpenInProgress=!1;n._pendingQueries.forEach(function(n){return n()});n._pendingQueries=[]},function(){return n._storage=null}))},t.getUnixTime=function(t){return t||(t=n.getCurrentDate()),Math.round(t.getTime()/1e3)},t.prototype.onError=function(n,t){t!="open storage"&&SharedLogHelper.LogError(t,this._dataSource,n);this.teardownStorage()},t.prototype.reloadStorage=function(){this.teardownStorage();this.initStorage()},t.prototype.isReady=function(){return!!this._storage},t.prototype.getTimeout=function(t,i){return!t||(i===null||i===void 0?void 0:i.isSearchHomeZI)?n.config.latencyTimeoutForZeroInput:n.config.indexedDBTimeout},t.prototype.getKey=function(n){return this._dataSource=="ANA"?"anaheimData":n.queryToFetch?n.queryToFetch.toLocaleLowerCase():""},t.prototype.fetch=function(t,i,r,u,f){var o=this,s=n.getCurrentTime(),e;(n.config.enableFetchStartLogging&&n.InstrumentationHelper.instrumentFetchProviderBegin(r,"SBDP:"+this._dataSource),n.isDataSourceEnabled(this._dataSource,t))&&(e=function(r,u){var h=n.getCurrentTime()-s,e;n.InstrumentationHelper.instrumentPerfEvent(n.SequenceNumberManager.getSequenceNumber(),"Fetch"+o._dataSource,h);e=u=="R";f()&&i(o._dataSource,o.createResponse(t,r,e),o.getDataSourceState(u))},this.innerQueryStorage(1,this.getKey(t),function(n){return e(n,"R")},function(){return e(null,"E")},function(){return e(null,"X")},function(){return e(null,"T")},t))},t.prototype.withStorage=function(n){return this._storage?(n(this._storage),!0):!1},t.prototype.getMaxKey=function(n){return n.slice(0,n.length-1)+String.fromCharCode(n.charCodeAt(n.length-1)+1)},t.prototype.getStorage=function(n,t,i,r){this.innerQueryStorage(null,null,function(t){return n(t)},t,i,r)},t.prototype.queryStorage=function(n,t,i,r,u){this.innerQueryStorage(0,n,t,i,r,u)},t.prototype.innerQueryStorage=function(t,i,r,u,f,e,o){var c=this,s=null,h=!1,l=!0,v=function(){if(l)if(l=!1,c._storage){var n=function(n){s&&sb_ct(s);c.onError(n,"query");h||(h=!0,u())};t==0?c._storage.getValue(i,function(n){s&&sb_ct(s);h||(h=!0,r(n))},n):i?c._storage.getRange(i,c.getMaxKey(i),function(n){s&&sb_ct(s);h||(h=!0,r(n))},n):c._storage.getAll(function(n){s&&sb_ct(s);h||(h=!0,r(n))},n)}else s&&sb_ct(s),h||(h=!0,u())},a;if(this._storage)v();else if(this.initStorage(),this._storageOpenInProgress)this._pendingQueries.push(v);else{f();return}a=this.getTimeout(i,o);a&&(s=n.safeSetTimeout(function(){s=null;l=!1;h||(h=!0,e())},a,"innerQueryStorage"))},t}();t.StorageBasedDataProvider=i})(t=n.ClientSideStorage||(n.ClientSideStorage={}))}(WSB||(WSB={})),function(n){var t=function(){function t(n,t){this._navigationHelper=n;this._temporaryMessageHandler=t}return t.prototype.parse=function(t,i,r,u,f,e,o){var c=this,l=[],a=[],v=[],y=[],p=[],w=[],b=[],k=[],d,s,h,g;if(u&&u.Suggestions)for(d=function(r){var u=r.suggestionData,f,e;u.handoffType==2?n.isApp(u.type)?(f=u,a.push(f.id),p.push(r)):n.isSetting(u.type)?(f=u,v.push(f.id),w.push(r)):n.isFileOrFolder(u.type)&&(f=u,y.push(f.id),b.push(r)):n.isBingEnabled()&&(e=n.safeExecute(function(){return c.parseMRUWebSuggestion(t,r,i)},"parseMRUWebSuggestion"),e&&(u.handoffType==0?k.push(e):l.push(e)))},s=0,h=u.Suggestions;s3&&(u.autoOpenPreviewPaneWhenOnTopHit=!!c.previewPaneLaunchCount);s=o.title||o.secondaryText;t.isSearchHomeZI&&s?(u.additionalInfoText=o.url,u.text=HitHighlightingParser.removeMarkers(s)):u.primaryMetadata=s;u.reactKey=o.type+o.url;n.setUrlSuggestionProperties(u,t,r,o.url);n.config.directNavPreviewPane&&u.type=="MD"&&u.url&&(u.getIcon=n.getFaviconUrlForRawUrl(u.url,64,64,1.5),t.isSearchHomeZI||(u.previewPaneType=2));break;default:return SharedLogHelper.LogError("parseMruWebSuggestion",null,new Error("Unexpected handoff type: "+f.handoffType)),null}return n.isValidSuggestion(u,"parseMruWebSuggestion")?(this.setupRemoveFromHistoryContextMenu(u,i,t),u):null},t.prototype.setupRemoveFromHistoryContextMenu=function(t,i,r){var u=this;n.RuntimeConfig.QfMode!=5&&n.RuntimeConfig.QfMode!=9&&i.remove&&n.setExtraVerbs(t,function(f){if(f||!i.remove)return[];if(!t.removeIcon&&t.duplicates&&t.duplicates.some(function(n){return!n.fromHistory}))return[];var e=n.config.mruSearchHome&&r.scope==n.Scope.All,o={verb:e?"RemoveFromDeviceHistoryAll":"RemoveFromDeviceHistory",displayName:n.Host.getLocString("RemoveFromDeviceHistory"),executeSync:function(){i.remove(function(){n.Host.refreshCurrentPane();e||u._temporaryMessageHandler.showTemporaryMessage(n.Host.getLocString("RemovedFromDeviceHistory",HitHighlightingParser.removeMarkers(t.text)))});delete i.remove},icon:{content:"",type:2}};return[o]},!0)},t.prototype.generateReactKey=function(n,t){return(n===null||n===void 0?void 0:n.isSearchHomeZI)?t.type+t.text:t.type+n.fullPartialQuery},t}();n.MRUParser=t}(WSB||(WSB={}));__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 r="LastUpdated",i="MRUNoItemsAvailable",u=function(t){function u(i,u,f,e,o,s,h,c,l){var a=this;i&&i.bindItemLaunch(function(n,t,i){return a.onLaunch(n,t,i)});var v,y=function(t,i,f){return u(s,function(i){t(i);var r=n.getTimeDiffInDays(v);(r===null||r>=1)&&(v=n.getCurrentDate(),a.prune());a.getStorage(function(n){return a.instrumentMRUSize(n)},function(){return a.onAfterWrite()},function(){return a.onAfterWrite()},function(){return a.onAfterWrite()})},i,f,r)},p=function(t,i,r){return n.MockUrlParameters&&typeof n.MockedMRUData=="object"&&(i=n.MockedMRUData),n.safeExecute(function(){return a.createMruResponse(t,i,r)},"createMruResponse")},w=function(){return!0},b=function(n){return n=="R"?undefined:n};return n.Host.bindClearMRURequested(function(t){a.teardownStorage();n.ClientSideStorage.deleteDatabase(s,function(){return t(!0)},function(){return t(!1)})}),a=t.call(this,y,p,w,b,"MRU")||this,a.candidatesEnabled=h,a.loggingEnabled=c,a.getSuggestionKey=f,a.getGroupType=e,a.isMRUHistoryGroupType=o,a.lightweightStorage=l,a._pendingWrites=[],sj_evt.bind("clearMRUButtonClicked",function(){n.ClientSideStorage.deleteDatabase(n.MRUDatabaseName);a.reloadStorage()}),a}return __extends(u,t),u.prototype.getName=function(){return"MRUDataProvider"},u.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.candidatesEnabled()){var e=[],v=this.getOldestDateToKeep(),y=function(n,i){var f,r,u,o;if(i.Suggestions)for(f=function(r){if(!t.isSearchHomeZI&&r.handoffType==0)return"continue";var u=l.getRankingData(i,r);u&&u.lastLaunchTime&&u.lastLaunchTime>=v&&e.push({rankingData:n==l._lastKey?{prefixLaunchCount:u.prefixLaunchCount,lastLaunchTime:u.lastLaunchTime,previewPaneLaunchCount:u.previewPaneLaunchCount,lastPreviewPaneLaunchTime:u.lastPreviewPaneLaunchTime}:u,suggestionData:r,remove:function(t){return c.remove(n,r,t)}})},r=0,u=i.Suggestions;r0&&(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},u.removeRankerSignals=function(n,t){return n=="highConfidenceMetaSuggestionScore"||n=="prefetchConfidenceScore"?undefined:t},u.prototype.addToResponseIfNotPresent=function(n,t){var f=JSON.stringify(t.suggestionData,u.removeRankerSignals),i=n.find(function(n){return JSON.stringify(n.suggestionData,u.removeRankerSignals)==f}),r;i?(r=i.remove,i.remove=function(n){return r(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)},u.prototype.addToDataIfNotPresent=function(n,t){var i=JSON.stringify(t,u.removeRankerSignals),r=n.find(function(n){return JSON.stringify(n,u.removeRankerSignals)==i});r||n.push(t)},u.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()})}},u.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()})},u.prototype.createOrUpdateDbEntry=function(t,r,u,f){var e,o;return r?(r.LastUpdated=n.ClientSideStorage.StorageBasedDataProvider.getUnixTime(),r.SuggestionEngagementData=r.SuggestionEngagementData||{}):r={LastUpdated:n.ClientSideStorage.StorageBasedDataProvider.getUnixTime(),SuggestionEngagementData:{}},e=this.getSuggestionKey(u),r.SuggestionEngagementData[e]=this.updateMRUEntryClicksAndTime(r.SuggestionEngagementData[e],r.LastUpdated,f),this.getGroupType&&(r.SuggestionEngagementData[e].groupType=this.getGroupType(u)),this.lightweightStorage.getItem(i)=="1"&&this.isMRUHistoryGroupType&&this.isMRUHistoryGroupType(u)&&this.lightweightStorage.removeItem(i),this.candidatesEnabled()&&(o=u.getMruData(),o&&t&&(r.Suggestions||(r.Suggestions=[]),this.addToDataIfNotPresent(r.Suggestions,o))),r},u.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},u.prototype.getOldestDateToKeep=function(){var t=n.getCurrentDate();return t.setDate(t.getDate()-n.config.mruMaxAgeInDays),n.ClientSideStorage.StorageBasedDataProvider.getUnixTime(t)},u.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()},u.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()},u.prototype.getRankingData=function(n,t){return n.SuggestionEngagementData?n.SuggestionEngagementData[t.suggestionKey]:undefined},u.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: "+t);else return f[0]}function cr(n){return r||rt(),!!r[n]}function lr(n,t,i){if(!r||!r[i]||t.taskFrame)return!1;var u=o(i,t);return u.sfgaoFilter?!u.sfgaoFilter(n.getProperty("System.SFGAOFlags")):!1}function i(n,t){return n=wi.concat(n),t&&(n=n.concat(bi)),n}function rt(){v=SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.getUserSID();var it=0,ii=f(n.getKnownFolderPathLC(n.FOLDERID_Profile)),rt=ui(it,v,!1),ut=rt[0],y=rt[1],ft=ui(it,v,!0),o=ft[0],t=ft[1];g=ut;kt=y;var ot='"System.Kind" != ANY ARRAY['+tt.concat("link").map(function(n){return"'"+n+"'"}).join(", ")+"] AND "+ut,ri="\"System.Kind\" = SOME ARRAY['program'] AND "+o,s='"System.Kind" != ANY ARRAY['+gt.map(function(n){return"'"+n+"'"}).join(", ")+"] AND "+o,b='"System.Kind" != ANY ARRAY['+dt.concat(tt).concat("folder").map(function(n){return"'"+n+"'"}).join(", ")+"] AND "+o,fi="\"System.Kind\" = SOME ARRAY['folder'] AND "+o,st="\"System.Kind\" = SOME ARRAY['Music'] AND "+o,ni="\"System.Kind\" = SOME ARRAY['Picture'] AND "+o,ti='"System.Kind" = SOME ARRAY['+nt.map(function(n){return"'"+n+"'"}).join(", ")+"] AND "+o,ei="\"System.Kind\" != ANY ARRAY['game', 'calendar', 'web history', 'feed', 'contact', 'task', 'journal', 'note', 'instantmessage'] AND "+o,oi="SCOPE = 'file:"+ii+"' AND \"System.Kind\" = SOME ARRAY['folder'] AND "+o,si=br(v);r={};r.IFF=[{selectFields:i(e,!1),filterFieldsSets:[lt],mostRelevantProps:c,kindAndScopeClauses:ot,sortClause:n.config.enableIndexerQueryExtensionSort?p(h):u,searchOptions:3,sfgaoFilter:y,enabled:function(t){return!!(t===null||t===void 0?void 0:t.queryToFetch)&&!n.supportsShortcuts("IFF",t)}},{selectFields:i(e,!1),filterFieldsSets:[],mostRelevantProps:c,kindAndScopeClauses:ot,sortClause:n.config.enableIndexerQueryExtensionSort?p(h):u,searchOptions:0,sfgaoFilter:y,enabled:function(t){return!(t===null||t===void 0?void 0:t.queryToFetch)&&!n.supportsShortcuts("IFF",t)}},{selectFields:i(at,!0),filterFieldsSets:[ki],mostRelevantProps:c,kindAndScopeClauses:s,sortClause:n.config.enableIndexerQueryExtensionSort?p(h):u,searchOptions:3,sfgaoFilter:t,enabled:function(t){return!!(t===null||t===void 0?void 0:t.queryToFetch)&&n.supportsShortcuts("IFF",t)}},{selectFields:i(at,!0),filterFieldsSets:[],mostRelevantProps:c,kindAndScopeClauses:s,sortClause:n.config.enableIndexerQueryExtensionSort?p(h):u,searchOptions:0,sfgaoFilter:t,enabled:function(t){return t&&!t.queryToFetch&&n.supportsShortcuts("IFF",t)}},{selectFields:i(e,!0),filterFieldsSets:[di],mostRelevantProps:c.concat(["System.Title"]),kindAndScopeClauses:s,sortClause:n.config.enableIndexerQueryExtensionSort?p(h):u,searchOptions:0,sfgaoFilter:t,enabled:function(t){return n.config.indexerQuerySimplified&&(t===null||t===void 0?void 0:t.queryToFetch.length)<=8&&!!(t===null||t===void 0?void 0:t.queryToFetch)}}];r.MDOC=[{selectFields:i(l,!0),filterFieldsSets:[vt.concat(ir)],mostRelevantProps:w,kindAndScopeClauses:b,sortClause:u,searchOptions:3,sfgaoFilter:t,enabled:function(t){return(t===null||t===void 0?void 0:t.queryToFetch)&&n.config.minLengthForContentMatch&&(t===null||t===void 0?void 0:t.queryToFetch.length)>=n.config.minLengthForContentMatch}},{selectFields:i(l,!0),filterFieldsSets:[vt],mostRelevantProps:w,kindAndScopeClauses:b,sortClause:u,searchOptions:3,sfgaoFilter:t,enabled:function(t){return(t===null||t===void 0?void 0:t.queryToFetch)&&(!n.config.minLengthForContentMatch||(t===null||t===void 0?void 0:t.queryToFetch.length)0&&(o+="WITH ("+n.mostRelevantProps.join(", ")+") AS #MRProps "),s=eu(n,t,i,u,e),s&&(o+="("+s+") AND "),h=r?f(r):r,h&&(o+="(Scope = '"+h+"') AND "),o+n.kindAndScopeClauses}function ru(n,t){return SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.tokenize(n,t)}function uu(n){return SearchAppWrapper.CortanaApp.queryFormulationView.getLinguisticDataAsync(n)}function ni(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(s="",v=0,w=a;v0&&(n=n.replace(/'/g,"''"),n=n.replace(/"/g," "),t>=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 f(n){return ti(n,1)}function ft(n){return ti(n,2)}function hu(n){var t=y[n];if(t)return t;throw new Error("select fields for NL Data source was not found: "+n);}function s(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:hu(n),filterFieldsSets:f,kindAndScopeClauses:e?e+" AND "+g:g,mostRelevantProps:[],searchOptions:0,sortClause:u,sfgaoFilter:kt}}function lu(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),[ri(e),ri(r)]):null}function ri(n){var t=n.toISOString();return t.substr(0,t.indexOf("T"))}function ui(t,i,r){var u,h,c,e,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&ai)&&!(n&li)&&(!!(n&&vi)||n&&pi&&!!(n&&ot)||n&&yi&&!!(n&&ot))}:(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=f(n.getKnownFolderPathLC(n.FOLDERID_Profile));switch(t){case 0:e=f(n.getKnownFolderPathLC(oi));u+=" AND (Scope = 'file://' OR Scope = 'csc://{"+i+"}') AND (Scope <> 'file:"+c+"\\AppData') AND (Scope <> 'file:"+e+"\\Default\\AppData') AND (Scope <> 'file:"+e+"\\Administrator\\AppData')";o=f(n.getKnownFolderPathLC(fi));s=f(n.getKnownFolderPathLC(ei));u+=" AND (Scope <> 'file:"+o+"')";s!=o&&(u+=" AND (Scope <> 'file:"+s+"')");l=f(n.getKnownFolderPathLC(si));u+=" AND (Scope <> 'file:"+l+"')";a=f(n.getKnownFolderPathLC(hi));u+=" AND (Scope <> 'file:"+a+"')";r&&(v=f(n.getKnownFolderPathLC(ci)),u+=" AND (Scope <> 'file:"+v+"')");break;case 1:u+=" AND (Scope = 'file://' OR Scope = 'csc://{"+i+"}')";break;default:throw new Error("Unknown SearchScope: "+t);}return[u,h]}function p(n){for(var e,i="CASE ",r=1,t=0,f=n;t0)&&!n.contains(ct,i.id)&&r.push(i);return n.config.minTopApps&&r.length0&&(t=t.filter(function(t){return!n.contains(l,t)}));c=function(t){for(var u,e,r=0,f=l;r=0;--l)a=t[l],s.hasOwnProperty(a)&&(h[a]=s[a],i.splice(l,1));i.length==0?c(h):(v=!o||n.localDataSourceMayContainPII(o)?o:o+" "+i,n.Async.safeChain(r,function(){return u(i)},function(r){var e=n.Map.map(i,r,function(n){return f(n)}),u;if(s&&i.forEach(function(n){return s[n]=e[n]}),i.length!=t.length)for(u in h)h.hasOwnProperty(u)&&(e[u]=h[u]);c(e)},function(){return c({})},e,v))}},"resolveIdsWithCache",null,o,function(){return c({})})}function pt(n,t){if(!t.launchArguments||yt.test(n.query))return!0;var i=t.id.toLowerCase();return it.some(function(n){return i.includes(n)})?!0:!1}function rt(t,i,r,u,f){if(!f)return!1;var o=t.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=n.config.filterCICandidatesPrefixLength?!1:(o=e.Query,o.startsWith(i))?!1:n.config.bypassCIFilterOnSubstringMatch&&t.split(" ").some(function(n){return n.startsWith(i)})?!1:(s=t.startsWith(o),!s)?!0:(h=1,f.Counter>=h)?!0:(f.Counter++,!1)}function ut(n,t){var r,i;if(!!t&&t.length==0||(r=t.split(" "),n.length!=r.length))return!1;for(i=0;i0&&t.queryToFetch&&(u=n.escapeRegex(t.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=lt(r);i(e)})},getResults:function(n){return n},dataSource:"FEH",getSuggestionType:function(){return"FEH"},customCreateLocalResponseSuggestion:function(n,t){return l(n,t,{type:2,content:""})},supportsEmptyQuery:!0},{getResultsContainer:function(){return a()},getResults:function(n,t){return n.then(function(n){return t?n.slice(0,t):n})},dataSource:"TOPP",getSuggestionType:function(){return"TOPL"},customGetMax:function(t){return n.shouldShowStaticSearchHome(t)?6:5},customCreateLocalResponseSuggestion:function(i,r,u){return t(i,r,u,n.ScopeConfig[n.Scope.Apps].icon,i.isImmersive?i.logoBackgroundColor:undefined)},supportsEmptyQuery:!0},{getResultsContainer:function(n){return ThresholdUtilities.createPromise(function(t){var i=r?r.retrieveItemsFromCache(n.queryToFetch):[];t(i)})},getResults:function(n){return n},dataSource:"LDIC",getSuggestionType:function(n){return i(n.kind,n.extension,"FD")},maxUpTo3chars:4,maxAfter3chars:7,maxAfter8charsOrInL2ZeroInput:15,supportsEmptyQuery:!1},],g=[{getResultsContainer:function(n){return SearchAppWrapper.CortanaApp.queryFormulationView.startCommandLineQuery(n.originalQuery,"")},dataSource:"CG",getSuggestionType:function(){return"CG"},customCancellation:function(){return SearchAppWrapper.CortanaApp.queryFormulationView.cancelLastCommandLineQuery()},supportsEmptyQuery:!1},];n.LocalDataProviderDataSources=b.concat(k).concat(d).concat(g).map(function(n){return n.dataSource});var u={suggestions:[],maxedOut:!1},nt={},r,tt={"shell:RecycleBinFolder":{icon:{content:"",type:2},locStringKey:"RecycleBin"}};var at=["\\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",n.config.blocklistNotepadCommand?"\\system32\\notepad.exe":null,].filter(function(n){return!!n}),it=["\\system32\\finger.exe","\\system32\\ping.exe","\\system32\\print.exe","\\system32\\shutdown.exe","\\system32\\expand.exe","\\system32\\tskill.exe","\\system32\\reg.exe","\\system32\\sc.exe",],vt=["uninstall","outlook","excel","skype","nero","onenote","lync","vmware","firefox","itunes","photoshop","print","opera","visio","thunderbird","smartscreen"],yt=/[\/\.\-\\]/;n.isRealCommand=pt;var wt=["Microsoft.Cortana_8wekyb3d8bbwe!CortanaUI","Microsoft.Windows.Cortana_cw5n1h2txyewy!CortanaUI",],bt=[".dll",".pdb",".obj",".bin",".etl",".bak",".config",".resx",".manifest",".ini",".searchconnector-ms",".settingcontent-ms",".vstx",".vssx",".ms-one-stub",],kt=["visio content","bin","debug","obj","objd","amd64","x86","microsoftedgebackups",];n.isInitials=ut;n.getSuggestionTypeOverride=et;n.parseConstraintIndexMetaData=ot;n.isSuppressed=st;ht=function(){function e(t,i){var u=this;this._previousKeystrokeCache=t;i&&(r=i,n.Host.bindShown(function(){r&&(r.clean(),u.cacheDeviceItems())}));n.Host.bindAppHidden(function(){nt={}})}return e.prototype.getName=function(){return"LocalDataProvider"},e.setWhereId=function(n){e.whereId=n},e.prototype.fetch=function(t,i,r,u,o){var it=this,s,c,rt,a,ut,h,v,st,y,ft,p,ht,ct,w,et,nt,lt,at,tt,ot,l;if(u&&u.register(function(){return n.Async.clearPendingItemsFromCache()},!1,"clearPendingItemsFromCache"),s=[],c=b.filter(function(i){return n.isDataSourceEnabled(i.dataSource,t)}),n.IndexerQueryGenerator&&(s=s.concat(c.filter(function(t){return n.IndexerQueryGenerator.dataSourceSupported(t.dataSource)})),c=c.filter(function(t){return!n.IndexerQueryGenerator.dataSourceSupported(t.dataSource)})),c.length>0){if(!t.queryToFetch&&!c.every(function(n){return n.supportsEmptyQuery}))throw new Error(f);if(u&&u.register(function(){return SearchAppWrapper.CortanaApp.queryFormulationView.cancelLastDeviceQuery()},!1,"cancelLastDeviceQuery"),rt=n.safeExecute(function(){var i=n.Host.getRawImpressionGuid();return n.config.logClientPerf&&n.InstrumentationHelper.instrumentDeviceQueryBegin(i),SearchAppWrapper.CortanaApp.queryFormulationView.startDeviceQuery(t.queryToFetch,i)},"startDeviceQuery",null,t.queryToFetch),rt)for(a=0,ut=c;a0){if(!t.queryToFetch&&!h.every(function(n){return n.supportsEmptyQuery}))throw new Error(f);v=t.taskFrame?t.taskFrame.raw:"";n.Async.safeChain("executeSearchAsync",function(){return SearchAppWrapper.CortanaApp.searchResultsView.executeSearchAsync(t.queryToFetch,v)},function(n){var r,f,s;if(o())if(n)for(r=0,f=h;r0){if(e.lastQuery&&!t.fullPartialQuery.startsWith(e.lastQuery)&&e.setWhereId(null),e.lastQuery=t.fullPartialQuery,!t.queryToFetch&&!s.every(function(n){return n.supportsEmptyQuery}))throw new Error(f);if(s.some(function(n){return n.dataSource=="MPHO"})&&s.some(function(n){return n.dataSource=="MVID"})&&s.some(function(n){return n.dataSource=="MDOC"})&&s.some(function(n){return n.dataSource=="MPVD"}))st=s.find(function(n){return n.dataSource=="MPVD"}),this.searchFolderWithMultipleResults(t,st,null,i,o,u,e.whereId);else for(y=0,ft=s;y0){if(!t.queryToFetch&&!p.every(function(n){return n.supportsEmptyQuery}))throw new Error(f);for(ht=function(n){u&&n.customCancellation&&u.register(function(){return n.customCancellation()},!0,n.dataSource+" cancellation");ct.searchFolderWithMultipleResults(t,n,t,i,o,u,e.whereId)},ct=this,w=0,et=p;w0){if(!t.queryToFetch&&!nt.every(function(n){return n.supportsEmptyQuery}))throw new Error(f);for(lt=function(n){u&&n.customCancellation&&u.register(function(){return n.customCancellation()},!0,n.dataSource+" cancellation");at.searchFolderWithSingleResult(t,n,t,i,o)},at=this,tt=0,ot=nt;tt8?i.maxAfter8charsOrInL2ZeroInput:t.queryToFetch.length>3?i.maxAfter3chars:i.maxUpTo3chars},e.prototype.toLocalResponse=function(i,r,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=n.config.enableCISpellerAtPrefixLength&&this._previousKeystrokeCache&&this._previousKeystrokeCache.enableCISpeller(t.queryToFetch)?!0:t.queryToFetch.length>=n.config.enableCISpellerAtPrefixLength&&n.config.enableCISpeller==1?!0:!1},e.prototype.searchFolderWithMultipleResults=function(t,i,r,f,o,s,h){var y=this,c=i.dataSource,p=this.getMax(t,i),l=!r,w,a,v;if(l){if(n.RuntimeConfig.QfMode==5&&(v=n.Host.getFileExplorerCurrentPath()),v&&!/^[a-zA-Z]\:\\/.test(v)){f(c,u,null,null,!0);return}w=function(){return n.IndexerQueryGenerator.generateIndexerQueryAsync(t,v,p,c,h).then(function(n){return SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.queryWindowsSearchIndexerAsync(n)})}}else{if(a=n.safeExecute(function(){return i.getResultsContainer(r)},"getResultsContainer "+c),!a){f(c,u,null);return}w=function(){return y.getResults(t,p,a,i)}}n.Async.safeChain(l?"queryWindowsSearchIndexerAsync":"getItemsAsync",w,function(r){var u,s,h;o()&&(u=r.resultSet,s=void 0,r.whereId&&e.setWhereId(r.whereId),u?s=r.state:u=typeof r.length=="undefined"?Object.keys(r).map(function(n){return r[n]}):r,l&&n.supportsShortcuts(c,t)&&(u=u.map(function(t){return n.IndexerQueryGenerator.fixKind(t)})),h=e.getDataSourceState(s),f(c,y.toLocalResponse(p,t,u,i,a),h))},function(t){n.isCancellation(t)||y.logProviderFailure(c);f(c,u,null)},l?s:null,c+" "+t.queryToFetch)},e.prototype.searchFolderWithSingleResult=function(t,i,r,f,e){var s=this,o=i.dataSource,h=n.safeExecute(function(){return i.getResultsContainer(r)},"getResultsContainer "+o);h?n.Async.safeChain("tryGetResultAsync "+o,function(){return h.tryGetResultAsync()},function(n){e()&&f(o,s.toLocalResponse(1,t,n?[n]:[],i,null),null)},function(t){n.isCancellation(t)||s.logProviderFailure(o);f(o,u,null)},null,t.queryToFetch):f(o,u,null)},e.prototype.logProviderFailure=function(t){var i=n.providerFailureLogName(t);i&&SearchAppWrapper.CortanaApp.queryFormulationView.logProviderFailure&&n.safeExecute(function(){return SearchAppWrapper.CortanaApp.queryFormulationView.logProviderFailure(i,"ErrorForTopHit")},"logProviderFailure")},e.prototype.cacheDeviceItems=function(){var t="LDIC",i=function(){var i=n.IndexerQueryGenerator.generateIndexerQueryForDeviceItemCache(t,e.whereId);return SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.queryWindowsSearchIndexerAsync(i)};r.setReady(!1);n.Async.safeChain("initializeDeviceItemCacheAsync",i,function(n){var t,i,u;for(n.whereId&&e.setWhereId(n.whereId),t=0,i=n.resultSet;t0&&--this._currentScopeTileIndex;n.shouldSkipSelectedScope()&&(this._currentScopeTileIndex=r.indexOf(u[this._currentScopeTileIndex]));this._menuFactory.dismiss();r[this._currentScopeTileIndex].focus()},c.prototype.render=function(t,i,r,u,f){var e,o;this._currentQuery=t;t?(o=n.getEffectiveScope(t),this.handleWorkScopeDotIconShowState(t.scope),this.innerRender(t.scope,o,t,i,r,u,f),this._previousScope=(e=this._selectedScope)===null||e===void 0?void 0:e.type):this.cleanUp()},c.prototype.handleWorkScopeDotIconShowState=function(i){var u,f,r;typeof n.isMsbWorkScopeApplicable=="function"&&n.isMsbWorkScopeApplicable()&&n.config.msbWorkScopeDotIndicatorEnabled&&(u=this.getScopeBarElements().find(function(t){return t.type===n.Scope.Work}),u&&(f=this._storage.getItem(t),r=f?JSON.parse(f):undefined,i===n.Scope.Work&&i!=this._previousScope?(u.isDotIconEnabled=!1,(r===null||r===void 0?void 0:r.clickCount)0?{opened:this._moreMenuOpened,menuItems:u,buttonClickHandler:function(n,i,f){return r?null:t._moreMenuOpened?t.closeMoreMenuDropDown():t.openMoreMenuDropDown(u,n,i,f)}}:null,optionsMenuDataModel:{opened:this._optionsMenuOpened,buttonClickHandler:function(n,i,u){return r?null:t._optionsMenuOpened?t.closeOptionsMenuDropDown():t.openOptionsMenuDropDown(n,i,u)}},userProfileButtonDataModel:n.config.userProfileButtonEnabled&&o?{opened:this._userProfileMenuOpened,buttonClickHandler:function(n,i,u){return r?null:t._userProfileMenuOpened?t.closeUserProfileDropDown():t.openUserProfileDropDown(n,i,u)},icon:o,userName:h}:null,brandBarDataModel:s,closeButtonClickHandler:function(n,i,r){return t.closeButtonClicked(n,i,r)}}},c.prototype.renderScopes=function(){var t;(!n.config.optScopesRender||this._currentQuery&&this._currentQuery.scopePrefix||(this._selectedScope?this._selectedScope.selected==!1:((t=this._currentQuery)===null||t===void 0?void 0:t.scope)==n.Scope.All)||this._moreMenuOpened||this._optionsMenuOpened)&&(this._shouldRenderScopes=!0);this._shouldRenderScopes&&(this._page.updateScopesHeaderView(this.getScopesHeaderDataModel()),this._shouldRenderScopes=!1)},c.prototype.getScopesBrandingDataModel=function(){if(typeof n.getMsbBranding=="function"){var t=n.getMsbBranding();if(!!t)return{msbBranding:t}}return null},c.prototype.renderBranding=function(){var i=_ge("msbBrandingBar"),t;if(i){if(typeof n.enableBrandingBar=="function"&&n.enableBrandingBar()&&(t=this.getScopesBrandingDataModel(),t===null||t===void 0?void 0:t.msbBranding)){this._page.updateBrandingBarView(t);return}this._page.updateBrandingBarView(null)}},c.prototype.createTourFlyout=function(){var t=this,e=Object.keys(n.Host.getQuery().enabledDataSources),o=e.indexOf("MRU")!=-1?this._storage.getItem("MRUNoItemsAvailable")=="1":!0,u=[{id:"web_Tour",message:n.Host.getLocString("TourSearchText"),title:n.Host.getLocString("TourSearchTitle"),group:'document.createElement(\'search\').setAttribute("id", "search")',enabled:!0,icon:"WebSearch"},{id:o?"gr37_TourWide":"gr37_Tour",message:n.Host.getLocString("TourQuickSearchText"),title:n.Host.getLocString("TourQuickSearchTitle"),group:"gr37",enabled:n.shouldEnableQuickSearches(n.Host.getLanguage().toLowerCase()),icon:"QuickSearch"},{id:"SNSC_Tour",message:n.Host.getLocString("TourSnipSearchText"),title:n.Host.getLocString("TourSnipSearchTitle"),group:"SNSC",enabled:n.shouldEnableSnipSearch(),icon:"VisualSearch"},{id:"rewardsBadgeButton_Tour",message:n.Host.getLocString("TourRewardsText"),title:n.Host.getLocString("TourRewardsTitle"),group:"rewardsBadgeButton",enabled:this._msRewardsViewModel.isRewardsEnabled(),icon:"RewardsTrophy"}],i=this._page.createFlyout("WWETour",this._storage),r,f;if(i==null){this._storage.removeItem("wweTourEnabled");n.setZeroInputDataSourcesForL1();n.Host.refreshCurrentPane();_ge("root").classList.remove("overlayEnabled");this._storage.removeItem("wweTourRefreshed");return}n.Host.bindAppHidden(function(){t.removeTourFlyout();t._page.hideOverlayAreaView();t._page.hideFlyoutAreaView();t._page.updateScopesHeaderView(t.getScopesHeaderDataModel())});this._page.updateScopesHeaderView(this.getScopesHeaderDataModel());i.dismissible(Number.MIN_VALUE,null);i.repeat(Number.MAX_VALUE);i.icon("WebSearch").overlay(!0);u.forEach(function(n){n.enabled&&i.addMessage(n.message,n.title,_ge(n.group),n.id,n.icon)});r=u.filter(function(n){return n.enabled}).length;f=r==1;n.InstrumentationHelper.logClientInstEvent("Select","WWETour",null,{intendedFlyouts:r.toString()});i.target(_ge("groups")).button(n.Host.getLocString("WelcomeExpTourFinish"),function(){t.removeTourFlyout();t._page.hideOverlayAreaView();t._page.updateScopesHeaderView(t.getScopesHeaderDataModel())}).isLinkTextButton(!1).showButton(f).show()},c.prototype.removeTourFlyout=function(){this._storage.removeItem("wweTourRefreshed");this._storage.removeItem("wweTourEnabled");_ge("root").classList.remove("overlayEnabled")},c.prototype.getInstItem=function(t,i){var r=n.InstrumentedItem.getNonSuggestionInstrumentedItem(t,n.SyntheticQSCodesMaps.KValues,n.SyntheticQSCodesMaps.HandoffsForNonSuggestions[t]);return n.InstrumentationHelper.instrumentSyntheticInstrumentedItem(i,t,r),r},c.prototype.closeButtonClicked=function(t,i,r){var u=n.SequenceNumberManager.getSequenceNumber(),f=this.getInstItem("CB",u);n.InstrumentationHelper.instrumentItemClick(t,f,u,null,i,r);SearchAppWrapper.CortanaApp.dismissApp()},c.prototype.openMoreMenuDropDown=function(t,i,r,u){var e=this,f=n.SequenceNumberManager.getSequenceNumber(),o=this.getInstItem("MMB",f);n.InstrumentationHelper.instrumentItemClick(i,o,f,null,r,u);this._msRewardsViewModel&&this._msRewardsViewModel.hide();this._menuFactory.showDropdownMenu(t,document.getElementById(this._moreButton.id),1,function(){n.safeSetTimeout(function(){return e.closeMoreMenuDropDown()},0,"closeMoreMenuDropDown")},r);this._moreMenuOpened=!0;this.renderScopes()},c.prototype.closeMoreMenuDropDown=function(){this._moreMenuOpened=!1;this.renderScopes()},c.prototype.openOptionsMenuDropDown=function(t,i,r){var f=this,e=n.RuntimeConfig.AlwaysWide?1:2,u=n.SequenceNumberManager.getSequenceNumber(),o=this.getAdvancedOptions(u,e),s=this.getInstItem("OMB",u);n.InstrumentationHelper.instrumentItemClick(t,s,u,null,i,r);this._msRewardsViewModel&&this._msRewardsViewModel.hide();this._menuFactory.showDropdownMenu(o,document.getElementById(this._optionsButton.id),2,function(){n.safeSetTimeout(function(){return f.closeOptionsMenuDropDown()},0,"closeOptionsMenuDropDown")},i);this._optionsMenuOpened=!0;this.renderScopes()},c.prototype.closeOptionsMenuDropDown=function(){this._optionsMenuOpened=!1;this._shouldShowBuildNumber=!1;this.renderScopes()},c.prototype.openUserProfileDropDown=function(t,i){var u=this,r=n.SequenceNumberManager.getSequenceNumber(),f=this.getAccountOptionsForUserProfileButton(r),e=this.getInstItem("APB",r);n.InstrumentationHelper.instrumentItemClick(t,e,r,null,i,null);this._msRewardsViewModel&&this._msRewardsViewModel.hide();this._menuFactory.showDropdownMenu(f,document.getElementById(this._userProfileButton.id),2,function(){n.safeSetTimeout(function(){return u.closeUserProfileDropDown()},0,"closeUserProfileDropDown")},i);this._userProfileMenuOpened=!0;this.renderScopes()},c.prototype.closeUserProfileDropDown=function(){this._userProfileMenuOpened=!1;this.renderScopes()},c.prototype.cleanUp=function(){_w.ReactDOM&&(_w.ReactDOM.unmountComponentAtNode(_ge("topResults")),_w.ReactDOM.unmountComponentAtNode(_ge("groups")),_w.ReactDOM.unmountComponentAtNode(_ge("topHitHeader")),_w.ReactDOM.unmountComponentAtNode(_ge("scopesHeader")));this._lastRenderedTopHitHeader=null;this._page.updateTopHitHeaderView(null);this._page.updateScopesHeaderView(null)},c.prototype.scopeNamesElements=function(t){var i=this;return t.map(function(t){return i._scopeTiles.find(function(i){return n.Scope[i.type]==t})}).filter(function(n){return!!n})},c.prototype.getEffectiveScopeOrder=function(){var i,r,u,t,f;return!this._scopeTiles||this._scopeTiles.length==0?[]:this._effectiveScopeOrder&&!n.config.pathCompletionReplacesAll?this._effectiveScopeOrder.slice(0):(n.RuntimeConfig.AlwaysWide?(i=n.config.scopesOrderBeginAlwaysWide,r=n.config.scopesOrderLastAlwaysWide,u=n.config.numberOfScopesToRenderAlwaysWide):(i=n.config.scopesOrderBegin,r=n.config.scopesOrderLast,u=n.config.numberOfScopesToRender),t=[],i&&(n.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}))),f=r?this.scopeNamesElements(r):[],t=this.scopeNamesElements(i),t=t.slice(0,u-f.length),t.push.apply(t,f)),this._effectiveScopeOrder=t,t.slice(0))},c.prototype.getHiddenScopeElements=function(t){return this._moreScopeTiles?this._moreScopeTiles.filter(function(i){return t.find(function(n){return n.type==i.type})==undefined&&n.Scope[i.type]!="PathCompletion"&&n.Scope[i.type]!="All"}):[]},c.prototype.getScopeBarElements=function(){var u=this,t,i,r;return this._scopeTiles?(t=this.getEffectiveScopeOrder(),i=t.some(function(n){return n.enabled}),!i&&this._selectedScope&&(n.config.pathCompletionReplacesAll&&n.Scope[this._selectedScope.type]=="PathCompletion"||(r=this._scopeTiles.find(function(n){return n.type==u._selectedScope.type}),t.push(r),i=!0)),t):[]},c.prototype.isFeedbackEnabled=function(){return n.isBingEnabled()},c.prototype.showFeedback=function(){typeof WindowsFeedbackForm!="undefined"&&WindowsFeedbackForm.Show("");this._msRewardsViewModel&&this._msRewardsViewModel.hide()},c.prototype.getHeaderText=function(t,i){var r,u;if(n.RuntimeConfig.FlatListWithoutGroups)return null;if(r=n.getScopeDisplayName(i),r){if(this._topHitPresent)return t==n.Scope.All||t==n.Scope.PathCompletion?(u=n.config.quickMatchLabel?"QuickMatch":"BestMatch",n.Host.getLocString(u)):t==n.Scope.Work?n.Host.getLocString("BestMatch"):(u=n.config.quickMatchLabel?"QuickMatchFor":"BestMatchFor",n.Host.getLocString(u,r.toLocaleLowerCase()));if(this._resultsPresent)return null;if(t!=n.Scope.All)return r}return n.Host.getLocString("BestMatch")},c.prototype.getEmptyResultsMessage=function(t,i,r,u,f){var e;return n.RuntimeConfig.QfMode==5||n.RuntimeConfig.QfMode==9||t||!i&&!r||u!=n.Scope.Documents&&f.showUpsellOnSuggestionsList&&f.showUpsellOnSuggestionsList()?["",""]:r?f.getEmptyZIMessages():[n.Host.getLocString("NoResults",(e=this._currentQuery)===null||e===void 0?void 0:e.queryToFetch),""]},c.prototype.init=function(){var r,u,i,t;if(n.initScopePrefixes(),this._scopeTiles=[],this._moreScopeTiles=[],n.RuntimeConfig.ScopesAvailable){r=n.RuntimeConfig.AlwaysWide?n.config.scopesOrderBeginAlwaysWide:n.config.scopesOrderBegin;this._allScopeButtonPresent=n.contains(r,"All");for(u in n.ScopeConfig)(i=parseInt(u),t=n.ScopeConfig[i],(t.prefixes||t.prefixesLocString||t.scopeNameLocString)&&n.isScopeEnabled(i,t))&&((i!=n.Scope.All||this._allScopeButtonPresent)&&this._scopeTiles.push(this.createScopeElement(i,t,!1)),this._moreScopeTiles.push(this.createScopeElement(i,t,!0)));this._moreScopeTiles.sort(function(t,i){return t.type==n.Scope.All?-1:i.type==n.Scope.All?1:t.text.localeCompare(i.text)});this._selectedScope&&this.selectScope(this._selectedScope.type);this._effectiveScopeOrder=null}},c.prototype.createScopeElement=function(t,i,r){var u=this;return{isScopeElement:!0,id:(r?"scope":"l1scope")+t,type:t,enabled:!1,text:n.getScopeDisplayName(i),title:null,icon:t==n.Scope.All?{content:"",type:1}:i.icon,click:function(){return u.clickHandler(t,"scopeBar")},selected:!1,tooltip:this.getScopeToolTip(t,!1),isSelectable:!0,isDotIconEnabled:this.isDotIconEnabled(t),dotIconColor:this.getDotIconColor(t)}},c.prototype.getDotIconColor=function(t){var i="",r,u;switch(t){case n.Scope.Work:r=n.Host.getWindowsTheme();u=r===2;i=u?n.config.msbWorkScopeDotIndicatorDarkThemeColor:n.config.msbWorkScopeDotIndicatorColor}return i},c.prototype.isDotIconEnabled=function(t){var i=!1;switch(t){case n.Scope.Work:i=this.isWorkScopeDotIconEnabled()}return i},c.prototype.isWorkScopeDotIconEnabled=function(){var r=!1,o,s,i;if(typeof n.isMsbWorkScopeApplicable=="function"&&n.isMsbWorkScopeApplicable()&&n.config.msbWorkScopeDotIndicatorEnabled){var u=new Date,f=u.getDate(),e=this._storage.getItem(t);e?(o=u.getTime(),i=JSON.parse(e),o>i.expiry?r=!1:i.currentDate===f?r=i.clickCounti.currentDate&&(i.clickCount=0,i.currentDate=f,this.setWorkScopeDotIconInfoInLocalStorage(i),r=!0)):(s=u.setDate(u.getDate()+(n.config.msbWorkScopeDotIndicatorExpiryInDays||0)),i={expiry:s,clickCount:0,currentDate:f},this.setWorkScopeDotIconInfoInLocalStorage(i),r=!0)}return r},c.prototype.setWorkScopeDotIconInfoInLocalStorage=function(n){this._storage.setItem(t,JSON.stringify(n))},c.prototype.clickHandler=function(t,i,r){var h=n.getScopeDisplayName(n.ScopeConfig[t]),e,u=this._currentQuery,f=u.scope,o,s,c;if(this._shouldRenderScopes=!0,this._scopeTiles.some(function(n){return n.type==f})||(f=n.Scope.All),h&&f!=t)e=(t==n.Scope.All||t==n.Scope.PathCompletion?"":h.toLocaleLowerCase()+": ")+u.queryToFetch,this.innerRender(t,t,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==n.Scope.All||this._allScopeButtonPresent){this.setFocusInSearchBox("scope clickHandler noop");return}e=u.queryToFetch;t=n.Scope.All;this.innerRender(t,t,u,this._topHitPresent,this._resultsPresent,!0,!1)}s=n.Scope[t];c={Scope:s,Source:i,GroupSource:r&&r.source?r.source.toString():undefined};n.InstrumentationHelper.logClientInstEvent("Select","ScopeChanged",null,c);f!=t&&n.Host.reformulate(e,undefined,undefined,r);this.setFocusInSearchBox("scope clickHandler "+s)},c.prototype.setFocusInSearchBox=function(t){n.Host.setFocusInSearchBox(null,t);var i=n.getCurrentActiveElement();i&&i.blur()},c.prototype.isScopeElement=function(t){return t&&this._scopeTiles&&(this.isScopeButton(t.id)||n.contains(this._scopeTiles,t))},c.prototype.isMenuElement=function(n){return n&&this.isMenuButton(n.id)},c.prototype.isScopeButton=function(n){return n==this._feedbackButton.id||n==this._rewardsBadgeButton.id||n==this._userProfileButton.id||n==this._closeButton.id||this.isMenuButton(n)},c.prototype.isMenuButton=function(n){return n==this._moreButton.id||n==this._optionsButton.id},c.prototype.getSelectableItems=function(){var t=[],i;return n.RuntimeConfig.ScopesAvailable&&(t=t.concat(this.getScopeSelectableItems())),i=this._advancedOptionsScope.filter(function(n){return n.layout==0||n.layout==6}),i.length>0&&(t=t.concat(i)),t},c.prototype.getSelectableItemsByGroup=function(){var i=[],t=this.getScopeBarElements(),r,u,e,f;return n.shouldSkipSelectedScope()&&this._selectedScope==t[0]&&(t=t.slice(1)),n.isWin11DSB(this._currentQuery)||(i.push(t.slice(0,1)),r=t.findIndex(function(n){return n.selected}),r>0?i.push(t.slice(r,r+1)):n.shouldSkipSelectedScope()||(u=t.findIndex(function(n){return n.enabled}),u>0&&i.push(t.slice(u,u+1)))),e=[this._moreButton,this._rewardsBadgeButton,this._userProfileButton,this._feedbackButton,this._optionsButton,this._closeButton],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},c.prototype.getScopeSelectableItems=function(){var i=this.getScopeBarElements(),t=this._currentScopeTileIndex,c=i.length,u;if(n.isWin11DSB(this._currentQuery))return t<0&&(t=0),this.getSelectableItemsByGroup()[t];if(n.shouldSkipSelectedScope()&&this._selectedScope==i[0]&&(i=i.slice(1),--t,--c),t<0&&this._selectedScope&&!n.shouldSkipSelectedScope())return[this._selectedScope];if(u=n.getCurrentActiveElement(),u)switch(u.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];case h:return[this._closeButton]}return(t<0||t>=c)&&(t=0),i.slice(t,t+1)},c.prototype.getSelectedItem=function(){return null},c.prototype.select=function(t){var i=[].slice.call(this._scopesHeaderElement.getElementsByClassName("scope-tile")),r=n.shouldSkipSelectedScope()?i.filter(function(n){return!n.classList.contains("scope-tile--selected")}):i;this._currentScopeTileIndex=r.indexOf(_ge(t.id));n.shouldSkipSelectedScope()&&(this._currentScopeTileIndex=i.indexOf(r[this._currentScopeTileIndex]))},c.prototype.onAfterKeyDown=function(){return!1},c.prototype.getSubstrateUpsellClickHandler=function(t){var r=this,i=function(){n.Host.refreshCurrentPane();n.Host.setFocusInSearchBox(null,"SubstrateUpsell")};return function(){return r._accessTokenManager.promptAutheticateDialog(t,n.getSubstrateResourceOrScope(t),i,i)}},c.prototype.getSubstrateUpsell=function(t,i,r){var c=null,u="VerifyAccountToSearch",f=0,l="CloudSearch",a=["Verify"],e=null,o=[],v,s,h;return r==0?(v=n.getEffectiveScope(this._currentQuery),f=6,s=this._accessTokenManager?this._accessTokenManager.getCachedAccountInfo(t):null,s&&o.push(s.accountUserName),h=[n.Scope.People,n.Scope.Emails,n.Scope.Documents],n.config.accountVerificationInAllScope&&h.push(n.Scope.All),n.contains(h,v)&&(o.length>0&&(u="VerifyAccount"),e=this._substrateUpsellDismiss),l=""):r==2&&(u=null,f=2,c={content:"",type:2,needsAccentColor:!0},e=this._substrateUpsellDismiss,a=["VerifyAccountToSearch"]),this.createAdvancedOption(t==1?"COFA":"COOA",i,l,u,a,this.getSubstrateUpsellClickHandler(t),f,e,c,null,o,"VerifyButton")},c.prototype.getOneDriveUpsell=function(t){return this.createAdvancedOption("SDSC",t,null,null,["SeeResultsFromOneDrive"],function(){n.Host.launchCortanaSignIn()},2,null,{content:"",type:2,needsAccentColor:!1})},c.prototype.getIndexingOption=function(t){var i=n.config.controlPanelSearchSettings?function(){return n.Host.launchSearchSettings()}:function(){return n.LocalDataProvider.launchIndexingOptions(!1)};return this.createAdvancedOption("OMIO",t,"",null,["OptionsMenuIndexing"],i,2,null,{type:2,content:""})},c.prototype.getAdvancedOptionCssClass=function(n,t){return n==4?t?"menuInfo selectedAccount":"menuInfo":n==5?"menuLabel":null},c.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},c.prototype.createBuildVersionOption=function(){var t=n.Host.getLocString("Build");return{id:"advancedOption"+this._advancedOptionsIdCounter++,selected:!1,title:t,message:undefined,text:t+": "+n.config.snrVersion,instItem:undefined,click:undefined,layout:4,cssClass:this.getAdvancedOptionCssClass(4),isSelectable:!1,subItems:undefined,isExpanded:!1}},c.prototype.createDebugFallbackOption=function(t){return this.createAdvancedOption(null,t,"FallbackBundleText",null,["FallbackBundleText"],function(){return n.fallbackToPrepopulatedBundle(new Error("Fallback button clicked"))},2,null,{type:2,content:""})},c.prototype.createAdvancedOption=function(t,i,r,u,f,e,o,s,h,c,l,a){var y,p,v;return t&&(y=this.getInstItem(t,i)),p="advancedOption"+this._advancedOptionsIdCounter++,c&&c.length==0&&(c=null),v={id:p,selected:!1,title:n.Host.getLocString(r),message:u?n.Host.getLocString.apply(n.Host,__spreadArrays([u],l?l:[])):null,text:f?n.Host.getLocString(f[0]):null,instItem:y,click:undefined,layout:o,dismiss:s,icon:h,cssClass:this.getAdvancedOptionCssClass(o),isSelectable:!!e||!!c,subItems:c,buttonLabel:n.Host.getLocString(a),isExpanded:!c?undefined:!1},v.narratorText=v.text,v.click=e?function(t,i){y&&n.InstrumentationHelper.instrumentItemClick(t,y,n.SequenceNumberManager.getSequenceNumber(),null,i,null);e(v)}:undefined,v},c.prototype.getAccountOptions=function(t,i){var u=[];if(!this._accessTokenManager)return u;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",r;return(f||e)&&!i&&(r=this.createAdvancedOption(null,t,null,"ConnectedAccounts",null,null,5),r.cssClass=this.getAdvancedOptionCssClass(5),u.push(r),f&&n.isCloudSearchEnabledMsaCache&&(r=this.createAdvancedOption(null,t,null,null,["MicrosoftAccount"],null,4),r.message=f.accountUserName,r.narratorText=r.message,r.cssClass=this.getAdvancedOptionCssClass(4),n.isSubstrateOutlookAccountConnected||(r.cssClass+=" "+h),u.push(r),this._verifyAccountForMSARequired&&(r=this.createAdvancedOption(null,t,null,"VerifyAccountAttention",null,this.getSubstrateUpsellClickHandler(0),4),r.cssClass=s,r.icon={type:2,content:""},u.push(r),r=this.createAdvancedOption("OMVA",t,null,"VerifyButton",null,this.getSubstrateUpsellClickHandler(0),2),r.cssClass=o,u.push(r))),e&&n.isCloudSearchEnabledAadCache&&(r=this.createAdvancedOption(null,t,null,null,["AadAccount"],null,4),r.message=e.accountUserName,r.narratorText=r.message,r.cssClass=this.getAdvancedOptionCssClass(4),u.push(r),n.isSubstrateO365AccountConnected||(r.cssClass+=" "+h),this._verifyAccountForAADRequired&&(r=this.createAdvancedOption(null,t,null,"VerifyAccountAttention",null,this.getSubstrateUpsellClickHandler(1),4),r.cssClass=s,r.icon={type:2,content:""},u.push(r),r=this.createAdvancedOption("OMVA",t,null,"VerifyButton",null,this.getSubstrateUpsellClickHandler(1),2),r.cssClass=o,u.push(r))),u.push(this.getMenuDividerOption()),r=this.createAdvancedOption("OMAC",t,null,null,["ManageAccounts"],function(){return n.Host.launchWindowsAccountSettings()},2,null,{type:2,content:""}),r.cssClass=this.getAdvancedOptionCssClass(2),u.push(r)),i&&this._accessTokenManager.getSelectedAccountInfo()||(f&&(n.isCloudSearchEnabledMsaCache||!c)||(r=this.createAdvancedOption("OMAC",t,null,null,n.isCloudSearchEnabledMsaCache?["AddMicrosoftAccount"]:["EnableMsaSearch"],n.isCloudSearchEnabledMsaCache?function(){return n.Host.launchWindowsAccountSettings()}:function(){return n.Host.launchSearchPermissions()},2,null,{type:2,content:n.isCloudSearchEnabledMsaCache?"":""}),r.cssClass=this.getAdvancedOptionCssClass(2),u.push(r)),e&&(n.isCloudSearchEnabledAadCache||!l)||(r=this.createAdvancedOption("OMAC",t,null,null,n.isCloudSearchEnabledAadCache?["AddAadAccount"]:["EnableAadSearch"],n.isCloudSearchEnabledAadCache?function(){return n.Host.launchWindowsAccountSettings()}:function(){return n.Host.launchSearchPermissions()},2,null,{type:2,content:n.isCloudSearchEnabledAadCache?"":""}),r.cssClass=this.getAdvancedOptionCssClass(2),u.push(r))),u},c.prototype.getUserProfileButtonData=function(){var r=this,u,i,t=this._accessTokenManager.getSelectedAccountInfo(),f;return t?(i=t.accountProviderAuthority=="consumers"?0:1,u=this._userProfilesCache[t.accountUserName],!u)?(f=this._substrateProfilePictureProvider.getPersonDefaultIcon(t.accountUserName),this._userProfilesCache[t.accountUserName]=f,this._accessTokenManager.getAccount(i,i==1?"https://outlook.office.com/":n.config.useCobaltCSS?"https://outlook.office.com/M365.Access":"https://outlook.office.com/User.ReadWrite",!1,!0,function(n){if(n&&n.Token){var u=r._substrateProfilePictureProvider.getProfilePictureIconForToken(i,n.Token,t.accountUserName);u&&u(1,function(n){n&&(r._userProfilesCache[t.accountUserName]=n,r.renderScopes())})}}),[f,t.accountUserName]):[u,t.accountUserName]:[null,null]},c.prototype.getAccountOptionsForUserProfileButton=function(t){var l=this,r,i,u,y,h,e,c,p;if(!this._accessTokenManager)return[];var a="removeHover",v="menuItemWithButton focusable",o=this._accessTokenManager.getAllAvailableAccounts(0),s=this._accessTokenManager.getAllAvailableAccounts(1),w=this._accessTokenManager.getCachedAccountInfo(0),b=this._accessTokenManager.getCachedAccountInfo(1),f=o.concat(s);if(o.length+s.length==0)return[];if(r=[],u=this._accessTokenManager.getSelectedAccountInfo(),u&&(f=f.filter(function(n){return n.accountUserName!=u.accountUserName}),n.config.useCobaltCSS||(i=this.createAdvancedOption(null,t,null,"Accounts",null,null,5),i.cssClass=this.getAdvancedOptionCssClass(5),r.push(i)),i=this.createAdvancedOption(null,t,null,null,u.accountProviderAuthority=="consumers"?["MicrosoftAccount"]:["AadAccount"],null,4,null,this._userProfilesCache[u.accountUserName]),i.message=u.accountUserName,i.narratorText=i.message,i.cssClass=this.getAdvancedOptionCssClass(4,u),i.isSelectedAccount=u&&n.config.useCobaltCSS,r.push(i),w&&n.isCloudSearchEnabledMsaCache&&this._verifyAccountForMSARequired&&(i=this.createAdvancedOption(null,t,null,"VerifyAccountAttention",null,this.getSubstrateUpsellClickHandler(0),4),i.cssClass=a,i.icon={type:2,content:""},r.push(i),i=this.createAdvancedOption("OMVA",t,null,"VerifyButton",null,this.getSubstrateUpsellClickHandler(0),2),i.cssClass=v,r.push(i)),b&&n.isCloudSearchEnabledAadCache&&this._verifyAccountForAADRequired&&(i=this.createAdvancedOption(null,t,null,"VerifyAccountAttention",null,this.getSubstrateUpsellClickHandler(1),4),i.cssClass=a,i.icon={type:2,content:""},r.push(i),i=this.createAdvancedOption("OMVA",t,null,"VerifyButton",null,this.getSubstrateUpsellClickHandler(1),2),i.cssClass=v,r.push(i))),f.length>0)for(r.push(this.getMenuDividerOption()),y=function(u){i=h.createAdvancedOption("APPA",t,null,null,u.accountProviderAuthority=="consumers"?["MicrosoftAccount"]:["AadAccount"],function(){l._accessTokenManager.setSelectedAccount(u);n.Host.notifyAccountSelected(u);l._menuFactory.dismiss()},0,null,{type:2,content:""});i.message=u.accountUserName;i.narratorText=i.message;i.cssClass=h.getAdvancedOptionCssClass(0);r.push(i)},h=this,e=0,c=f;eu.length;)u.push("0");for(i=0;ie)return!0}return!0},t.prototype.sendRemoveBingHistorySuggestionRequest=function(t,i){var u=this,r;t=HitHighlightingParser.removeMarkers(t);r=n.config.removeSuggUrl.replace("%7b0%7d",encodeURIComponent(t)).replace("%7bSID%7d",sj_cook.get("_SS","SID"));n.fetchUrlJson(r,i,null,function(i){i&&i.success&&(n.Host.refreshCurrentPane(),n.safeSetTimeout(function(){return u._temporaryMessageHandler.showTemporaryMessage(n.Host.getLocString("RemoveFromWebHistoryConfirmation",t))},250,"removeBingHistorySuggestion"))})},t.prototype.addRelatedSuggestion=function(t,i,u,f,e,o,s){var h=n.createSuggestion(i,f,null,e,o,t?t.Query:u.query,n.InstrumentedItem.createInstrumentedItem(u.sequenceNumber,o),s,u.sequenceNumber,!1,null,null,!0);h.groupType=n.GroupType.Related;h.parent=u;h.isChild=!0;h.tooltip=t?t.SecondaryText:null;h.rankingScore=t?t.RankingScore:0;h.category=t?t.Category:null;h.isAnswer=!0;r(h,i,u.sequenceNumber,t?t.Url:null,this._navigationHelper,this.removeBingHistorySuggestionCallBack);h.primaryMetadata=null;h.reactKey=o+f+(t?t.Category+t.SecondaryText:"");n.isValidSuggestion(h,"calculateRelatedSuggestions")&&u.childSuggestions.push(h)},t.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&&n.InstrumentationHelper.instrumentDataSource(t.sequenceNumber,u,t.childSuggestions,null)},t}();n.OnlineSuggestionsParser=e;n.adjustCasing=t;n.setCat1SuggestionProperties=i;n.setWebSearchSuggestionProperties=r;n.setUrlSuggestionProperties=u}(WSB||(WSB={}));__assign=this&&this.__assign||function(){return __assign=Object.assign||function(n){for(var t,r,i=1,u=arguments.length;i=0)return n.substring(t)}return""}function ft(t){var i=t?new Date(t):null;return n.isValidDate(i)?i:null}function et(t){if(t){var i=n.getCurrentDate();if(i.getDate()==t.getDate()&&i.getMonth()==t.getMonth()&&i.getFullYear()==t.getFullYear())return t.toLocaleTimeString(n.uiLanguageCache,{hour:"numeric",minute:"numeric"})}return null}function r(t,r,u,e,o){var nt,tt,p,it,a,w,v,h,c,s,rt,y,b;if(o===void 0&&(o=!1),!o&&e.extensionLC&&SearchAppWrapper.CortanaApp.hideFileExtensions){var d=e.extensionLC.length,l=e.query,g=l.toLocaleLowerCase();g.endsWith(e.extensionLC)&&(nt=r?HitHighlightingParser.addMarkers(l,r):l,tt=n.config.disableSyntaxHighlight?r===""||!e.extensionLC.toLocaleLowerCase().startsWith("."+r.toLocaleLowerCase()):nt.toLocaleLowerCase().endsWith(e.extensionLC),tt&&(e.query=l.substring(0,l.length-d),p=e.text.toLocaleLowerCase(),it=HitHighlightingParser.removeMarkers(p),g==it&&(a=p.lastIndexOf(e.extensionLC),a>0&&(e.text=e.text.substring(0,a)+e.text.substr(a+d)))))}for(e.lastModifiedDate&&(e.lastModifiedDateString=e.lastModifiedDate.toLocaleString(n.uiLanguageCache,{day:"numeric",month:"numeric",year:"numeric",hour:"numeric",minute:"numeric"})),e.lastAccessDate&&(e.lastAccessDateString=e.lastAccessDate.toLocaleString(n.uiLanguageCache,{day:"numeric",month:"numeric",year:"numeric",hour:"numeric",minute:"numeric"})),e.primaryMetadata=e.sourceForGroup&&e.sourceForGroup!=1?n.getGroupSourceDisplayName(e.sourceForGroup):e.itemTypeDisplayName,e.explanation?e.additionalInfoText=e.explanation:t.isSearchHomeZI&&n.config.msbQws3sSugHideTimestamp?e.additionalInfoText=null:t.isSearchHomeZI&&(e.additionalInfoText=e.prettyPrintedPath||e.path),e.classNames=[],e.match?(w=(vt(e.match.matchType)?n.Host.getLocString(n.MatchType[e.match.matchType])+": ":"")+HitHighlightingParser.addMarkers(e.match.matchedText,r),e.additionalInfoText=w,e.secondaryMetadata=w,e.classNames.push("withMatchAnnotation","forceNoWrapOutsideTopResult")):e.lastModifiedDateString&&n.RuntimeConfig.QfMode!=5&&(e.secondaryMetadata=n.Host.getLocString("LastModified")+": "+e.lastModifiedDateString),e.narratorText=n.getNarratorText(e),n.displayedInGridLayout(e.type)&&(u?e.classNames.push("bigIcon","biggerIcon"):e.classNames.push("bigIcon")),!o&&e.handoffType==2&&SearchAppWrapper.CortanaApp.copyToClipboard&&i(e,function(){return[{verb:n.JumplistActionItemType[n.JumplistActionItemType.S_CopyFullPath],displayName:n.Host.getLocString("CopyFullPath"),executeSync:function(){return SearchAppWrapper.CortanaApp.copyToClipboard(e.path,"")},icon:{type:1,content:""}}]},!1),v={},h=e.prettyPrintedPath||e.path,h&&(c=h.lastIndexOf("/"),c<0&&(c=h.lastIndexOf("\\")),c<0&&(c=h.lastIndexOf(" > ")),s=h.substring(0,c),s.endsWith(":")&&(s=s+"\\"),e.parentFolder=s,v[n.Host.getLocString("Location")]=[{text:s,click:function(){return n.isUncOrLocalPath(s)?SearchAppWrapper.CortanaApp.launcher.startLaunchFolder(s):e.locationUrl?SearchAppWrapper.CortanaApp.launcher.launchUriAsync(decodeURI(e.locationUrl)):SearchAppWrapper.CortanaApp.launcher.launchUriAsync(s)}}]),rt=n.nicerCloudFilesEnabled(t,e),e.tooltip=at(e,rt),y=0,b=f;y=0}function ct(n){var i,t;if(n&&typeof n=="object"&&n.length){for(i="",t=0;t0&&(u.childSuggestions=u.childSuggestions?u.childSuggestions.concat(p):p,o(p),n.InstrumentationHelper.instrumentDataSource(v,y,p,null))}}function s(t,i,r,u){return function(f,e){return n.getIcon(t,u+"_"+t.path+"_"+t.displayName,"jumpList",!r,!1,null,null,0)(f,function(n){n?e(n):i.getIcon(f,e)})}}function tt(t){return t.displayName?!n.RuntimeConfig.AlwaysWide&&n.olderThan2Weeks(t.lastAccessed)?!0:!1:!0}function h(t){switch(t){case 0:return n.GroupType.JumpListTasks;case 1:return n.GroupType.JumpListPinned;case 2:return n.GroupType.JumpListRecent;case 3:return n.GroupType.JumpListFrequent;default:return n.GroupType.JumpListCustom}}function c(t,i,r){n.Async.safeChain("launchJumpList",function(){return i.jumpListItem.launchAsync()},function(){return n.Host.manuallyDismissApp()},function(){n.DialogBox?n.DialogBox.show(n.Host.getLocString("JumpListItemUnavailableDeleteConfirmation"),[{id:null,text:n.Host.getLocString("Cancel"),selected:!0,action:function(){return n.Host.setFocusInSearchBox(null,"jumpListItemDialogBoxCancel")}},{id:null,text:n.Host.getLocString("Remove"),selected:!1,action:function(){l(t,i,r);n.Host.setFocusInSearchBox(null,"jumpListItemUnavailable1")}}]):(r.showTemporaryMessage(n.Host.getLocString("JumpListItemUnavailable")),l(t,i,r),n.Host.setFocusInSearchBox(null,"jumpListItemUnavailable2"))})}function l(t,i,r){var u=function(){return r.showTemporaryMessage(n.Host.getLocString("RemoveFromListFailure",i.text))},f=i.parent.childSuggestions.length==1;n.Async.safeChain("deleteJumpList",function(){return i.jumpListItem.deleteAsync()},function(){n.Async.safeChain("getJumpListAsync",function(){return t.getJumpListAsync()},function(t){f&&t.some(function(n){return h(n.type)==i.groupType&&n.items.some(function(n){return!tt(n)})})?u():(n.Host.refreshCurrentPane(),r.showTemporaryMessage(n.Host.getLocString("RemovedFromList",i.text)))},u)},u)}function ri(t,r,u){r.jumpListItem.deleteAsync&&i(r,function(){var i={verb:"RemoveFromThisList",displayName:n.Host.getLocString("RemoveFromThisList"),executeSync:function(){return l(t,r,u)},icon:{type:2,content:""}};return[i]},!0)}function ui(t,i){if(t&&t.uxHint){var r=i?HitHighlightingParser.addMarkers(t.uxHint,i):t.uxHint;return n.Host.getLocString("RelatedSynonym",r)}return null}var it={"Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge":[0],"Microsoft.InternetExplorer.Default":[0],Chrome:[0],"360browser":[0]},a={skype:[],outlook:[0],"360browser":[0],chrome:[0],iexplore:[0],opera:[0],firefox:[0],safari:[0]},v={"\\msedge.exe":[0]},rt=["Microsoft.Windows.Explorer",],f=[[!0,"LastAccessed","lastAccessDateString"],[!1,"LastModified","lastModifiedDateString"],[!1,"LastModifiedBy","lastModifiedBy"],[!1,"Author","author"],[!1,"Artist","artist"],[!1,"Album","album"],[!1,"Genre","genre"],[!1,"Tags","tags"],],y={"Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge":[n.GroupType.JumpListTasks],"Microsoft.MicrosoftStickyNotes_8wekyb3d8bbwe!App":[n.GroupType.JumpListTasks],"Microsoft.XboxApp_8wekyb3d8bbwe!Microsoft.XboxApp":[n.GroupType.JumpListCustom],"com.squirrel.Teams.Teams":[n.GroupType.JumpListTasks],"Microsoft.ScreenSketch_8wekyb3d8bbwe!App":[n.GroupType.JumpListTasks]},b;n.getFileExtension=ut;n.toDate=ft;n.getTodayTimeString=et;n.setFileTemplate=r;n.enrichMetadataFromDuplicate=ot;n.getIconForTypeAsync=st;n.isValidIcon=w;n.isValidSuggestion=e;n.setExtraVerbs=i;n.setExtraVerbsAsync=ht;b=function(){function t(n){this._temporaryMessageHandler=n}return t.prototype.parse=function(t,i,r,u,f,e){for(var l,a,v=this,s=[],y=function(u){n.safeExecute(function(){return g(t,u,r,i,v._temporaryMessageHandler,u.suggestionType,s,function(){return!0})},"parseLocalSuggestion "+r)},h=0,c=u.suggestions;h0&&n.config.supportedCiMarkets[a]&&(a!=e.language||u>e.version||k||tt)&&(!o.url||k||c==o.url||o.errorCode!="00000000")){var y="cis_v"+u,p="ci_v"+u,d=f._lightweightStorage.getItem(y)?parseInt(f._lightweightStorage.getItem(y)):0,g=f._lightweightStorage.getItem(p)?parseInt(f._lightweightStorage.getItem(p)):0;f._lightweightStorage.setItem(i.LastCIDownloadAttemptKey,n.getCurrentDate().toString());h="constraintIndexDownloader.tryDownloadFromUrlAsync";n.Async.safeChain(h,function(){return r.tryDownloadFromUrlAsync(v)},function(n){if(n){var i=f.getContstraintIndexInfo(c);t.currentCIVersion=String(i.version);d++;f._lightweightStorage.setItem(y,d.toString())}else SharedLogHelper.LogError(h,"urlResult: "+w,"Download failed");g++;f._lightweightStorage.setItem(p,g.toString())},function(n){SharedLogHelper.LogError(h,"onError - url: "+v,n.message)},null,v,0)}}})}return i.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.LogWarning("constraintIndexDownloader.urlResult",t,"Download encountered problems"),f=this.getContstraintIndexInfo(r),u=f.version):SharedLogHelper.LogError("constraintIndexDownloader.parseUrlResult","urlResult: "+n,"Invalid URL")):SharedLogHelper.LogError("constraintIndexDownloader.parseUrlResult","No urlResult"),{url:r,version:u,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]):SharedLogHelper.LogError("constraintIndexDownloader.getContstraintIndexInfo","url: "+n,"Invalid URL")):SharedLogHelper.LogError("constraintIndexDownloader.getContstraintIndexInfo","No Url"),{version:r,language:u}},i.prototype.safeGetLastUrl=function(t){if(!n.config.ciDownloadUpdate)return t.lastUrl;var r="https://www.bing.com/bcs/ci/-1/en-us.cab",i=r;try{return i=t.lastUrl,n.isNullOrUndefined(i)||i.length==0?r:i}catch(u){return r}},i.prototype.safeGetUrlResult=function(t){if(!n.config.ciDownloadUpdate)return t.urlResult;var r="https://www.bing.com/bcs/ci/-1/en-us.cab:0x8000FFFF",i=r;try{return i=t.urlResult,n.isNullOrUndefined(i)||i.length==0?r:i}catch(u){return r}},i.prototype.getUrlForCiCab=function(n,t){return"https://www.bing.com/bcs/ci/"+n+"/"+t+".cab"},i.prototype.getTimeDiffInMins=function(t){if(!n.isValidDate(t))return 0;var i=t.getTime(),r=n.getCurrentTime();return Math.round((r-i)%n.DayToMs%n.HourToMs/n.MinuteToMs)},i.LastCIDownloadAttemptKey="LastCIDownloadAttempt",i}();t.ConstraintIndexDataLoader=i})(t=n.ConstraintIndex||(n.ConstraintIndex={}))}(WSB||(WSB={}));__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){function u(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 c(t){switch(t){case"FD":return n.Scope.Folders;case"LI":return n.Scope.Photos;case"LV":return n.Scope.Videos;case"MU":return n.Scope.Music;default:return n.Scope.Documents}}var t="https://onedrive.live.com",i=t+"/redir.aspx?resid=",e="&ancestorId=",o="&contentMatch=",r="OneDrive provider called without {0}",s=621355968e5,h=function(t){function i(n){var i=t.call(this,"ODC")||this;return i._accessTokenManager=n,i}return __extends(i,t),i.prototype.getName=function(){return"OneDriveDataProvider"},i.prototype.addOneDriveAncestorResourceIdQueryString=function(){if(n.RuntimeConfig.QfMode==5&&!n.isFileExplorerCurrentPathThisPcOrQuickAccess){var t=void 0,i=SearchAppWrapper.CortanaApp.fileExplorerSuggestionPage.currentSyncRootContentUri?n.tryParseUrl(SearchAppWrapper.CortanaApp.fileExplorerSuggestionPage.currentSyncRootContentUri,!1):null;if(i&&i.parameters&&(t=i.parameters.substr(1).split("&").find(function(n){return n.startsWith("id=")}).substr(3)),t)return e+t;SharedLogHelper.LogError("OneDriveParser","QfMode="+n.RuntimeConfig.QfMode,new Error(n.formatString(r,["currentSyncRootResourceId"])))}return""},i.prototype.addOneDriveContentMatchQueryString=function(t){return n.RuntimeConfig.QfMode==5||t.scope==n.Scope.Documents?o+"1":""},i.prototype.createUrl=function(t){var i=decodeURIComponent(n.config.oneDriveDotComRootUrl),r;return i+=this.addOneDriveAncestorResourceIdQueryString(),i+=this.addOneDriveContentMatchQueryString(t),r=t?n.encodeQueryParameter(t.queryToFetch.toLowerCase()):"",i+"&q="+r},i.prototype.getAllAccountTokens=function(t){if(n.RuntimeConfig.QfMode==5){var i=SearchAppWrapper.CortanaApp.fileExplorerSuggestionPage.currentSyncRootAccount;i?this._accessTokenManager.getAccountByUserName(!1,0,i,!1,!0,function(n){n&&n.Token?t([n.Token]):t(null,"AccountNotFound")}):n.isFileExplorerCurrentPathThisPcOrQuickAccess?this._accessTokenManager.getAllSyncingAccounts(!1,0,!1,!0,function(n){n.length>0?t(n.map(function(n){return n.Token})):t(null,"NoAccountsFound")}):(SharedLogHelper.LogError("OneDriveParser","QfMode="+n.RuntimeConfig.QfMode,new Error(n.formatString(r,["currentSyncRootAccount"]))),t(null,"CurrentSyncRootAccount"))}else n.AccessTokenManager.getWindowsAccountType()==2?this._accessTokenManager.getAccount(0,n.getBingResourceOrScope(0),!1,!0,function(n){n&&n.Token?t([n.Token]):t(null,"NoAccountsFound")}):t(null)},i.prototype.fetch=function(i,r,u,f,e,o,s){var l=this,h,c;n.isDataSourceEnabled(this._dataSource,i)&&(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];t.prototype.fetch.call(l,i,function(n,t,i,u,f){--h.numOfPendingResponses;r(n,t,i,u,f,h.numOfPendingResponses!=0)},u,f,e,a,v)},this.getAllAccountTokens(function(n,t){t?r(l._dataSource,null,t,null,null,!1):n?(h.numOfPendingResponses=n.length,n.forEach(function(n){return c(n)})):(h.numOfPendingResponses=1,c(null))}))},i}(n.JsonDataProvider),f;n.OneDriveDataProvider=h;f=function(){function r(){}return r.prototype.parse=function(t,i,r,u,f,e){var h=[],o,c,l,s,a,v;if(u&&u.suggestionGroups)for(o=0,c=u.suggestionGroups;o0&&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={}))}(WSB||(WSB={})),function(n){var t;(function(t){function c(t){e=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),n.Host.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&&h(e)}}),n.Host.bindKeyEscape(function(n){o()&&(u(),n.handled=!0)}))}function l(t,i,u,o){var s,h;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&&(s=i.id),i});h={isVisible:!0,title:u,messageText:t,buttons:f,isModal:o};e.updateDialogBox(h);s&&n.safeSetTimeout(function(){return _ge(s).focus()},0,"DialogBox.show");n.Host.setFocusInWebView("dialogBoxViewModel");r=!0}function u(){if(r)e.updateDialogBox({isVisible:!1}),r=!1}function o(){return r}function i(){return f}function a(){return i().map(function(n){return[n]})}function s(){return i().filter(function(n){return n.selected}).shift()}function h(n){for(var r,t=0,u=i();t<\/body><\/html>",{},undefined,!1);k=n.getCurrentTime();this._previewPaneViewModelParent.onResponseReceived(k);return}var d=r==0,g=SearchAppWrapper.CortanaApp.entryPoint=="WNSHVR",tt=g?"WMSHVA":n.mapOSFormCode("WMSRPA"),it=g?"WMSHVM":n.mapOSFormCode("WMSRPM"),rt=d?tt:it,c=this._navigationHelper.getSearchUrl(i.fullPartialQuery,t.query,t.type,l,t.handoffType,rt,!0,null,d,t.msbVerticalHash);if(c+="&qfig="+n.InstrumentationHelper.getImpressionGuid(n.SequenceNumberManager.getSequenceNumber()),this._msRewardsViewModel&&this._msRewardsViewModel.isRewardsEnabled()&&(c+="&rewards=1"),i.serpURLParams)for(y in i.serpURLParams)c=ThresholdUtilities.setUrlParameter(c,y,i.serpURLParams[y]);this._previousURLs=[];this.downloadAndDisplayMiniSerp(t,c,null,r)},t.prototype.getCurrentHandoffType=function(){return this._currentHandoffType},t.prototype.isIframeActive=function(){return this._iframe!==null},t.prototype.updatePreviousState=function(n,t){this._previewedSuggestion=n;this._onPreviewPaneRendered=t;this._timestampFirstRender=null},t.prototype.miniSERPRenderTimeoutInstrumentation=function(t){var i;i={FunctionCalled:t};n.InstrumentationHelper.logClientInstEvent(e,"MiniSERPRenderTimeout",n.SequenceNumberManager.getSequenceNumber(),i)},t.prototype.miniSerpErrorInstrumentation=function(t,i,r){var u;u=r?{ErrorCause:t,ResponseRecievedTimeStamp:i.toString(),ResponseText:r.responseText,ContentType:r.contentType,ResponseStatusCode:r.status.toString(),RequestStatusCode:r.result.toString()}:{ErrorCause:t};n.InstrumentationHelper.notifyTopHitPreviewPaneOpenedOrInterrupted(n.SequenceNumberManager.getSequenceNumber());n.InstrumentationHelper.logClientInstEvent(e,"MiniSERPError",n.SequenceNumberManager.getSequenceNumber(),u)},t.prototype.renderOfflineMessage=function(t){for(var e,o=n.isBrowserOnline(),f=n.Host.getLocString("PreviewPaneOfflineTitle"),r=n.Host.getLocString("PreviewPaneOfflineMessage").split("{0}"),u=[],s=r.length-1,i=0;i0&&(s=function(i){if(i.result==0&&i.responseText)u(i);else{var s={Url:t,StatusCode:i.status.toString(),Timeout:n.config.miniSERPRequestTimeout.toString(),RetriesRemaining:o.toString()};n.InstrumentationHelper.logClientInstEvent(e,"MiniSERPRefetch",n.SequenceNumberManager.getSequenceNumber(),s);h.fetchMiniSerpUrl(t,null,r,u,f,o-1)}});n.config.isThemeAware&&this.isDarkModeEnabled()&&!t.includes("&darkschemeovr=1")&&(t+="&darkschemeovr=1");n.config.useCobaltCSS&&!t.includes("addfeaturesnoexpansion=wsbcobalt")&&(t+="&addfeaturesnoexpansion=wsbcobalt");n.Host.isBingWallpaperAppInstalled()&&(t+="&BWPA=1");n.fetchUrl(t,r,i,s,null,function(){return f==h._previewRequestId},!0,i?undefined:n.config.miniSERPRequestTimeout)},t.prototype.renderIframe=function(t,i,r,u,f){var e=this;this.clearContent();this.isMsbPerfLogEnabled()&&bfbWsbTel.logPerf("miniSERP::renderIframe");this._iframe=sj_ce("iframe",n.MiniSerpIframeId);this._iframe.setAttribute("scrolling","no");this._contentContainer.appendChild(this._iframe);var s=this._iframe.contentWindow,o=this._iframe.contentDocument,h=!1,c=typeof n.isMsbWorkScope=="function"&&n.isMsbWorkScope(this._currentHandoffType);this._footer&&(n.setVisibility(this._footer,!f),n.setVisibility(this._mask,!f));this.setIframeHeight(0);this._onIFrameLoadedCallback=function(){var i,f,h;c&&(n.config.wsbWorkScopeWsbPrefetchEnabled&&e.handleWsbPrefetch(),e.handleLoadingStateForWorkScope());i=o.body;f=0;e._calculateIFrameHeight=function(){var n=i.offsetHeight;n!=f&&n>0&&(f=e.setIframeHeight(n))};e._calculateIFrameHeight();e.overrideAjaxCalls(s,r,u);e.captureNavigationsAndSizeEvents(t,i,s,o);e._scrollArea.scrollTop=0;n.config.backStackSearchEnabled&&(e._shouldAddSearchBackStack=!0,e._currentBackStackTimeout&&clearTimeout(e._currentBackStackTimeout),e._currentBackStackTimeout=sb_st(function(){e._shouldAddSearchBackStack=!1},n.config.miniSerpRedirectTimeoutInMs));n.contains([2,3],e._currentVertical)&&(h={childList:!0,subtree:!0},e._mutationObserver=new MutationObserver(function(){e._calculateIFrameHeight&&e._calculateIFrameHeight()}),n.safeExecute(function(){e._currentVertical===2?e._mutationObserver.observe(o.getElementById("images"),h):e._currentVertical===3&&e._mutationObserver.observe(o.getElementById("video"),h)},"onIFrameLoadedCallback"));e._msRewardsViewModel&&e._msRewardsViewModel.isRewardsEnabled()&&s.sj_rra&&s.sj_rra(t);e._timestampFirstRender=n.getCurrentTime();e.instrumentOnPreviewPaneRendered(!0,!1)};this._iframe.onload=function(){if(e.isMsbPerfLogEnabled()&&bfbWsbTel.logPerf("miniSERP::_iframe.onload"),c&&(e._scrollArea.scrollTop=0,n.config.wsbWorkScopeWsbPrefetchEnabled&&(e.clearWsbPrefetchStorage(),e.stopLoadingScreen())),h){e.tryLaunchUrl(t,s.location.href,0);return}h=!0;e.overrideAjaxCalls(s,r,u)};this.isMsbPerfLogEnabled()&&bfbWsbTel.logPerf("miniSERP::iFrameDocument.open");o.open();o.write(i);o.write("");o.write("