class ReimagineSOUtils{static querySelectorDeep=(selector,rootNode=document.body,deep=false)=>{const results=this.querySelectorAllDeep(selector,rootNode,deep,false);return Array.isArray(results)&&results.length?results[0]:results};static querySelectorAllDeep=(selector,rootNode=document.body,deep=false,all=true)=>{if(!selector)return null;if(!deep){return all?Array.from(rootNode.querySelectorAll(selector)):rootNode.querySelector(selector)}const results=[];const traverser=node=>{if(!all&&results.length)return;if(node.nodeType!==Node.ELEMENT_NODE)return;if(node.matches(selector)){results.push(node);if(!all)return}for(const child of node.children){traverser(child)}if(node.shadowRoot){for(const shadowChild of node.shadowRoot.children){traverser(shadowChild)}}};traverser(rootNode);return all?results:results.length?results[0]:null}} /*! 1113728 - Reconcile recordClick on shadow-DOM vs light-DOM actionables */ (function reconcileRecordClickListeners(){let EVENTS=["AfterProcess-ReimagineButton","AfterProcess-ReimagineLink"];let TAGS=["reimagine-button","reimagine-link"];function getUtils(){return window.reimagineTelemetry&&window.reimagineTelemetry.utils}function deepFindActionable(root){if(!root)return null;if(root.tagName==="A"||root.tagName==="BUTTON")return root;if(root.shadowRoot){let r=deepFindActionable(root.shadowRoot);if(r)return r}let children=root.children||[];for(let i=0;i{const domains={"azure.microsoft.com":"cn33fv2fqq"};const storeClarityId="rcwvv0hsnp";const sites=[["ai","fklpdhl3lg"],["customers","nqgr9bv86z"],["dynamics-365","56ntj8n5ti"],["education","qbw8y1v5xr"],["evalcenter","co915hf5d5"],["events","bx9lrsl3v8"],["fasttrack","co87mqlj22"],["flexibility","8j710qd1zy"],["health-solutions","qch4fin049"],["hololens","8j7188n0nf"],["industry","8j70sts7ed"],["isv","co8cdtj65f"],["marketplace","sxijn6d0cr"],["mesh","8j7188n0nf"],["microsoft-365","8qumfcbe49"],["microsoft-365-copilot","8qumfcbe49"],["microsoft-cloud","8rugvc69mo"],["microsoft-copilot","jf75j84chi"],["microsoft-fabric","gnlfnng0p8"],["microsoft-learn","gxa46mx9ho"],["microsoft-loop","co87wrbsd6"],["microsoft-teams","8j6z5n8me5"],["microsoft-viva","8j70e2bszm"],["power-platform","69q536qdr1"],["security","8j70lgy2cr"],["software-development-companies","r2mqwu0t85"],["sovereignty","v9s43lmegt"],["sql-server","8j71hxh8mv"],["startups","h9oep2750d"],["store",storeClarityId],["sustainability","co90igj0k6"],["system-center","8ruh2qg98n"],["trust-center","8j70lgy2cr"],["us-government","v9s516swgw"],["windows-365","8j705rlc54"],["windows-server","8ruh98y350"]];const sitePathPattern=String.raw`\/([a-z]{2}|[a-z]{2}-[a-z]{2}|[a-z]{2}-[a-z]{4}-[a-z]{2})\/%SECTION%(\/$|\/.*|$)`;const regexList=sites.map(([section,id])=>[new RegExp(sitePathPattern.replace("%SECTION%",section.replace(/-/g,"\\-")),"i"),id]);const homepagePattern=/^\/([a-z]{2}|[a-z]{2}-[a-z]{2}|[a-z]{2}-[a-z]{4}-[a-z]{2})\/?$/i;function getClarityId(){const host=window.location.hostname;if(domains[host]){return domains[host]}const urlPath=window.location.pathname;for(const[regex,id]of regexList){if(regex.test(urlPath)){return id}}if(host==="www.microsoft.com"&&homepagePattern.test(urlPath)){return storeClarityId}return null}const waitForWcpConsentObj=(maxRetries=100,interval=50)=>{return new Promise((resolve,reject)=>{let retries=0;const checkWcpConsent=setInterval(()=>{if(window.WcpConsent&&window.WcpConsent.siteConsent){clearInterval(checkWcpConsent);resolve()}else if(retries>=maxRetries){clearInterval(checkWcpConsent);reject(new Error("WcpConsent object not found within the expected time"))}retries++},interval)})};function isWcpConsentPresent(){return typeof WcpConsent!=="undefined"&&WcpConsent&&typeof WcpConsent.siteConsent!=="undefined"&&WcpConsent.siteConsent}function isGpcOptInPresent(){return typeof GPC_DataSharingOptIn!=="undefined"&&GPC_DataSharingOptIn!=null}function isConsentRequired(){if(isWcpConsentPresent()&&WcpConsent.siteConsent&&WcpConsent.siteConsent.isConsentRequired!==undefined&&WcpConsent.siteConsent.isConsentRequired!==null){return WcpConsent.siteConsent.isConsentRequired}return true}function isConsentGranted(userConsent){return userConsent&&userConsent.Advertising&&userConsent.Analytics&&userConsent.SocialMedia}function getUserConsent(){if(WcpConsent&&WcpConsent.siteConsent&&0!==Object.keys(WcpConsent.siteConsent).length){return WcpConsent.siteConsent.getConsent()}return undefined}function checkUserConsent(){var userConsent=getUserConsent();return isConsentGranted(userConsent)}const loadClarity=()=>{const clarityId=getClarityId();if(!clarityId){console.warn("Clarity not loaded: No matching Clarity project for this site");return}(function(c,l,a,r,i,t,y){c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);t.id="oc-clarity-script-1092966"})(window,document,"clarity","script",clarityId)};await waitForWcpConsentObj().then(()=>{if(isGpcOptInPresent()&&GPC_DataSharingOptIn===true&&(!isConsentRequired()||checkUserConsent())){loadClarity();console.log("Clarity loaded")}else{console.log("Clarity not loaded due to lack of user consent")}}).catch(error=>{console.error("Error loading Clarity:",error)})})(); /*! ticket 1093350 */ (()=>{document.addEventListener("DOMContentLoaded",()=>{const featuredElements=reimagineTelemetry.utils.querySelectorAllDeep(document.body,"reimagine-featured");featuredElements.forEach(featuredElem=>{const interactiveElems=reimagineTelemetry.utils.querySelectorAllDeep(featuredElem,"a, button");interactiveElems.forEach(interactiveElem=>{interactiveElem.setAttribute("data-bi-compnm","ReimagineFeatured")})});const allElements=reimagineTelemetry.utils.querySelectorAllDeep(document.body,"[data-bi-compnm]");allElements.forEach(elem=>{const compnmValue=elem.getAttribute("data-bi-compnm");if(compnmValue&&compnmValue.includes("-")){const pascalCaseValue=compnmValue.split("-").map(word=>{return word.charAt(0).toUpperCase()+word.slice(1)}).join("");elem.setAttribute("data-bi-compnm",pascalCaseValue)}});const bannerFeaturedElements=reimagineTelemetry.utils.querySelectorAllDeep(document.body,"reimagine-banner-featured");bannerFeaturedElements.forEach(bannerElem=>{const interactiveElems=reimagineTelemetry.utils.querySelectorAllDeep(bannerElem,"a, button");interactiveElems.forEach(interactiveElem=>{interactiveElem.setAttribute("data-bi-compnm","ReimagineBannerFeatured")})});const carouselCardGridElements=reimagineTelemetry.utils.querySelectorAllDeep(document.body,"reimagine-carousel-card-grid");carouselCardGridElements.forEach(carouselElem=>{const interactiveElems=reimagineTelemetry.utils.querySelectorAllDeep(carouselElem,"a, button");interactiveElems.forEach(interactiveElem=>{interactiveElem.setAttribute("data-bi-compnm","ReimagineCarouselCardGrid")})})})})();(()=>{const pageScope={"azure.microsoft.com":{paths:["/products/visual-studio-code"],markets:["en-us"]},previews:true};if(!window.SOUtil||!window.SOUtil.pageIsInScope(pageScope)){return}let overrideId="1099449";const styleText=` .experiencefragment reimagine-featured { --ds-ui-shell-gap: 0; } reimagine-secondary-nav .cq-placeholder { display: none; } @media (max-width: 539.98px) { .experiencefragment reimagine-button-group reimagine-button, .experiencefragment reimagine-button-group reimagine-link { width: auto; } .experiencefragment reimagine-button-group { --ds-button-group-margin-inline: auto; --ds-button-group-flex-direction: row; } } `;if(styleText.trim()){window.SOUtil.addStylesheet(styleText,overrideId)}})(); /*! 1100751 - Update visibility if already defined */ (()=>{const TAGS=["reimagine-pricing-grid","reimagine-timeline","reimagine-story-telling","reimagine-hero-author","reimagine-editorial-agenda","reimagine-media-text-stacked","reimagine-banner-timer","reimagine-banner-search","reimagine-media-playlist-video-item","reimagine-media-playlist-video","reimagine-data-tiles","reimagine-immersive-scroll","reimagine-media-with-caption","reimagine-media-video","reimagine-jumplinks","reimagine-long-form-seo","reimagine-banner-heading","reimagine-cta-banner","reimagine-statement-banner","reimagine-section-with-media","reimagine-banner-news","reimagine-banner-featured","reimagine-data-with-icon","reimagine-data-with-caption","reimagine-featured","reimagine-featured-stack","reimagine-card-grid-staggered","reimagine-card-grid-product","reimagine-mixed-stack","reimagine-hero-impact","reimagine-hero-featured-slider","reimagine-hero-featured-slider-item","reimagine-hero-dynamic-text","reimagine-hero-article","reimagine-hero-ai-search","reimagine-hero-search","reimagine-hero-featured-xl-video","reimagine-hero-product","reimagine-hero-category","reimagine-logo-testimonials","reimagine-high-impact-product-accordion","reimagine-media-demo","reimagine-carousel-card-grid","reimagine-carousel-featured","reimagine-filtered-search","reimagine-high-impact-featured-accordion","reimagine-high-impact-accordion","reimagine-features-and-pricing-product-highlight","reimagine-features-and-pricng-3-col","reimagine-dynamic-search-results","reimagine-search-results","reimagine-story-grid","reimagine-editorial-article-takeaway","reimagine-editorial-article-summary","reimagine-story-summary","reimagine-article-list","reimagine-article-list-item","reimagine-editorial-article-chapter","reimagine-editorial-article-quote","reimagine-editorial-article-header","reimagine-editorial-featured","reimagine-secondary-nav","reimagine-scroll-spy","reimagine-announcement","reimagine-base-ui-shell"];const forceVisible=el=>{el.style.setProperty("visibility","visible","important");el.style.setProperty("opacity","1","important")};const isHiddenByCss=el=>{const cs=getComputedStyle(el);return cs.visibility==="hidden"||cs.opacity==="0"};const checkAndUpdateVisibility=()=>{const presentTags=TAGS.filter(t=>document.querySelector(t));if(!presentTags.length){console.info("[WC Visibility Fix] None of the target tags were found in the DOM.");return}for(const tag of presentTags){const els=Array.from(document.querySelectorAll(tag));const registryCtor=customElements.get(tag);for(const el of els){const isRegistered=!!registryCtor;if(isRegistered&&isHiddenByCss(el)){forceVisible(el)}}}};window.SOUtil.runOnPageLoad(()=>{checkAndUpdateVisibility()})})(); /*! 1102133 - Fix ump visibility when not autoplay */ (()=>{const waitForUmpReady=async(ump,maxRetries=50)=>{for(let i=0;isetTimeout(resolve,100))}return false};window.SOUtil.runOnPageLoad(async()=>{const umps=document.querySelectorAll("reimagine-media universal-media-player");for(const ump of umps){const isReady=await waitForUmpReady(ump);if(isReady&&!ump.options.autoplay){ump.classList.add("ump-visible");ump.classList.remove("ump-hidden")}}})})(); /*! 1106652 - Fix inline footnote links */ (()=>{const bindFootnoteLinkFix=()=>{const links=ReimagineSOUtils.querySelectorAllDeep("reimagine-footnote-item a.ms-rte-link");if(!Array.isArray(links)||!links.length)return;links.forEach(link=>{link.addEventListener("click",event=>{event.stopImmediatePropagation()},true)})};window.SOUtil.runOnPageLoad(()=>{bindFootnoteLinkFix()})})(); /*! 1103186 - VFI appears when clicking card grid area */ (()=>{const cardGridFeaturedSelector="reimagine-featured";const tabPanelSelector="reimagine-tab-panel";const soAttr="data-so-1103186";const shadowStyleText=` .tab-panel__base:focus:not(:focus-visible) { outline: none; } `;const removeTabPanelClickVFI=panel=>{if(panel.shadowRoot&&!panel.hasAttribute(soAttr)){panel.setAttribute(soAttr,"");const shadowStyle=document.createElement("style");shadowStyle.textContent=shadowStyleText;panel.shadowRoot.appendChild(shadowStyle)}};const processTabPanels=container=>{const panels=container.querySelectorAll(tabPanelSelector);panels.forEach(removeTabPanelClickVFI)};window.SOUtil.runOnPageLoad(async()=>{await customElements.whenDefined(cardGridFeaturedSelector);await customElements.whenDefined(tabPanelSelector);const featuredElements=document.querySelectorAll(cardGridFeaturedSelector);featuredElements.forEach(featured=>{processTabPanels(featured)})})})(); /*! 1099449 - Update SecondaryNav on the Exchange and VS Code page so it aligns flush with the left edge of the layout. */ (()=>{const pageScope={"www.microsoft.com":{paths:["/microsoft-365/exchange"],markets:["en-us"],allSubpaths:true},"azure.microsoft.com":{paths:["/products/visual-studio-code"],markets:["en-us"],allSubpaths:true}};if(!window.SOUtil||!window.SOUtil.pageIsInScope(pageScope)){return}const overrideId="1099449";const styleText=` reimagine-secondary-nav { --ds-secondary-nav-label-display: none; --ds-secondary-nav-gap: 0; --ds-secondary-nav-scrollslider-padding-inline: 0; } `;if(styleText.trim()){window.SOUtil.addStylesheet(styleText,overrideId)}})(); /*! 16012401 - Update the back to top button position based on the chatbot position */ (()=>{if(typeof window!=="undefined"&&"MutationObserver"in window&&window.SOUtil){window.SOUtil.runOnPageLoad(()=>{let rafPending=false;const updateBackToTopPosition=()=>{const chatbot=document.querySelector(".sa-default-entry-container");const chatbotFlyout=document.querySelector(".sa-highlight-entry-container");const backToTop=document.querySelector("reimagine-back-to-top");if(backToTop){if(chatbotFlyout&&!chatbotFlyout.classList.contains("is-hidden")){const chatBotFlyoutContent=chatbotFlyout.querySelector(".sa-highlight-entry-content");if(chatBotFlyoutContent){const withFlyoutSpacing=window.innerHeight-chatBotFlyoutContent.getBoundingClientRect().top;backToTop.style.setProperty("--ds-back-to-top-bottom",`${withFlyoutSpacing-2}px`);return}}if(chatbot){const chatBotHeight=chatbot.getBoundingClientRect().height;backToTop.style.setProperty("--ds-back-to-top-bottom",`${chatBotHeight+24}px`)}else{backToTop.style.removeProperty("--ds-back-to-top-bottom")}}};const observer=new MutationObserver(()=>{if(!rafPending){rafPending=true;requestAnimationFrame(()=>{rafPending=false;updateBackToTopPosition()})}});observer.observe(document.body,{childList:true,subtree:true,attributes:true,attributeFilter:["class"]})})}})(); /*! 1112840 - add theme dark to card promo */ (()=>{const pageScope={"www.microsoft.com":{paths:["/store/b/sale","/store/category/sale"],markets:["en-au"]},previews:true};function addDarkThemeToCardPromo(){const cardPromos=document.querySelectorAll("reimagine-card-promo");cardPromos.forEach(card=>{const textBlock=card.querySelector("reimagine-text-block");if(textBlock?.getAttribute("theme")==="dark"){card.setAttribute("theme","dark")}})}if(globalThis.SOUtil?.pageIsInScope(pageScope)){globalThis.SOUtil.runOnPageLoad(addDarkThemeToCardPromo)}})(); /*! 1114095 - horizontal carousel scroll fix */ (()=>{const CSS_TEXT=['[part~="layout__base"] {'," overscroll-behavior: auto !important;"," touch-action: pan-x pan-y !important;","}"].join("\n");const MARK="__carouselScrollFixApplied";const injectInto=root=>{if(!root||root[MARK])return;root[MARK]=true;const style=document.createElement("style");style.setAttribute("data-carousel-scroll-fix","");style.textContent=CSS_TEXT;root.appendChild(style)};const bindWheelRedirect=root=>{const base=root.querySelector('[part~="layout__base"]');if(!base||base.__wheelRedirectBound)return;base.__wheelRedirectBound=true;base.addEventListener("wheel",e=>{if(Math.abs(e.deltaY)>Math.abs(e.deltaX)){e.preventDefault();window.scrollBy({top:e.deltaY,left:0,behavior:"auto"})}},{passive:false})};const walkShadow=root=>{if(!root)return;injectInto(root);bindWheelRedirect(root);const all=root.querySelectorAll("*");for(let i=0;i{if(!el)return;let tries=0;const tick=()=>{if(el.shadowRoot){walkShadow(el.shadowRoot);setTimeout(()=>walkShadow(el.shadowRoot),500);return}if(tries++<50)setTimeout(tick,100)};tick();if(window.customElements&&customElements.whenDefined){customElements.whenDefined("reimagine-carousel").then(()=>{if(el.shadowRoot)walkShadow(el.shadowRoot)})}};const patchAll=scope=>{(scope||document).querySelectorAll("reimagine-carousel").forEach(patchCarousel)};const start=()=>{patchAll(document);const mo=new MutationObserver(muts=>{for(let i=0;i{const STAT_CARD_SELECTOR="reimagine-card-stat";const STAT_SELECTOR="reimagine-stat";const CONFIGURATION_ATTR="configuration";const STAT_TYPE_ATTR="type";window.SOUtil.runOnPageLoad(async()=>{await customElements.whenDefined(STAT_CARD_SELECTOR);await customElements.whenDefined(STAT_SELECTOR);function fixStatCards(){const statCards=document.querySelectorAll(STAT_CARD_SELECTOR);statCards.forEach(card=>{const stat=card.querySelector(STAT_SELECTOR);const isSizeMissing=stat&&!stat.hasAttribute("size");const isTypeMissing=stat&&!stat.hasAttribute(STAT_TYPE_ATTR);if(stat&&isSizeMissing&&isTypeMissing){const config=card.getAttribute(CONFIGURATION_ATTR);if(config==="vertical"){stat.setAttribute(STAT_TYPE_ATTR,"large--stacked")}else if(config==="banner"){stat.setAttribute(STAT_TYPE_ATTR,"large")}}if(stat&&stat.getAttribute("theme")==="night"){stat.setAttribute("theme","dark")}})}fixStatCards()})})();