1 line
19 KiB
Plaintext
1 line
19 KiB
Plaintext
!function(){"use strict";!function(){if("undefined"!=typeof __webpack_require__){const t=__webpack_require__.e,n={};var e;const o=document.head.getAttribute("data-info");__webpack_require__.e=function(i){return t(i).catch((function(t){const r=n.hasOwnProperty(i)?n[i]:2;if(void 0===e&&(e=!!(o&&o.indexOf("prg-afdretry-t")>-1)),e&&2===r&&(__webpack_require__.p=__webpack_require__.p.replace("/assets.","/assets2.")),1===r)if(e){const e=new URL(__webpack_require__.p,window.location.href);__webpack_require__.p=e.href.replace(e.host,window.location.host)}else __webpack_require__.p=__webpack_require__.p.replace("/assets.","/assets2.");if(r<1)throw t;return new Promise((function(e){setTimeout((function(){n[i]=r-1,e(__webpack_require__.e(i))}),100)}))}))}}}();let e=new Map;const t=Object.freeze({set(t,n){return e.set(t,n),this},get:function(t,n){let o=e.get(t);return void 0===o&&n&&(o=n(),e.set(t,o)),o},clear(){e.clear()},delete:t=>e.delete(t),has:t=>e.has(t)});function n(){return"undefined"!=typeof window&&window.document&&window.document.createElement&&!window.isRenderServiceEnv?window._pageTimings||(window._pageTimings={}):t.get("__diagnostics_pageTimings",(()=>({})))}let o,i,r;function a(){if(r)return r;const e=document.head.getAttribute("data-info");return r=((/f:\s*([^;]+)/i.exec(e)||{})[1]||"").toLowerCase(),r}var s;!function(e){e.JSON="application/json;charset=UTF-8",e.HTML="text/html;charset=UTF-8"}(s=s||(s={}));function c(){const e=performance.getEntriesByType("navigation")[0].serverTiming;if(e){const t=e.find((e=>"rsClusterName"===e.name));if(t)return t.description}}const d="1.0.19";let l,u,w;(new Date).getTime();try{u="sessionStorage"in window&&window.sessionStorage}catch(e){}try{navigator&&navigator.userAgentData&&"Windows"===navigator.userAgentData.platform&&navigator.userAgentData.getHighEntropyValues&&navigator.userAgentData.getHighEntropyValues(["platformVersion"])&&navigator.userAgentData.getHighEntropyValues(["platformVersion"]).then((e=>{w=e.platformVersion}))}catch(e){}function m(e){if(e)return e.scrollTop||0;return h&&(window.pageYOffset||document.body.scrollTop||document.documentElement.scrollTop)||0}function p(){const e="undefined"!=typeof document&&document.cookie;if(!h&&!e)return"";const t=new RegExp("\\bMUID\\s*=\\s*([^;]*)","i").exec(e);return t&&t.length>1?t[1]:""}const h=!("undefined"==typeof window||!window.document||!window.document.createElement||window.isRenderServiceEnv);function g(){let e=!1;if(h)try{if(w&&parseInt(w.split(".")[0])>=11&&(e=!0),!e&&window&&window.external&&window.external.getHostEnvironmentValue("os-build")){const t=JSON.parse(window.external.getHostEnvironmentValue("os-build"))["os-build"].split(".");(t[0]>10||10===t[0]&&t[1]>0||t[2]>=22e3)&&(e=!0)}}catch(e){}return l=!0===e||null,l}const f="1.0.19";var v;const b=JSON.parse((null===(v=document.head.dataset)||void 0===v?void 0:v.clientSettings)||"{}");let y,S,T={};function _(e){T=e}function R(e,t,n){var o,i,r,s;const l=p(),u=T||{},w=n||{},h=new URLSearchParams(b.queryparams).get("edgessr");return{name:e,time:t.toISOString(),ver:"4.0",iKey:`o:${null===(o=window.oneDSConfig)||void 0===o||null===(i=o.key)||void 0===i?void 0:i.split("-")[0]}`,data:{...u,baseType:"MS.News.Web.Base",baseData:{},page:{...u.page,canvas:"Browser",appType:b.apptype,content:{...null===(r=u.page)||void 0===r?void 0:r.content,title:document.title}},flight:{id:a(),tmpl:`ssrscope:1;ssr-enabled:1;${h?`edgessr:${h};`:""}edge.mem:${navigator.deviceMemory+""};edge.concurrency:${navigator.hardwareConcurrency+""};edge.connection:${navigator.connection.effectiveType+""}`},browser:{width:window.outerWidth,height:window.outerHeight,screenSize:[screen.width,screen.height].join("x"),clientId:l,scrollOffset:m(),anoncknm:"app_anon",cookieEnabled:navigator.cookieEnabled,isWin11:g(),muid:l},request:{activityId:b.aid,requestId:b.aid,afdMuid:b.fd_muid},timestamp:t.getTime(),sdk:{name:"peregrine-lite-telemetry",ver:f,schemaVer:d},build:null===(s=b.bundleInfo)||void 0===s?void 0:s.v,custom:{...u.custom,...w,"rs-cluster-name":c(),"ssr-enabled":1}},ext:{user:{localId:`t:${l}`}}}}function k(e){try{return decodeURIComponent(e)}catch(e){}}function E(e,t){if(!e)return null;if(t)return function(e){var t;const n=null===(t=document.cookie)||void 0===t?void 0:t.match(`\\b${e}=([^;]*)`);return n?k(n[1]):null}(e);if(!y){const e="undefined"!=typeof document&&document.cookie.split("; ");y={};const t=e&&e.length;for(let n=0;n<t;n++){const t=e[n].indexOf("=");y[e[n].slice(0,t).toLocaleLowerCase()]=k(e[n].slice(t+1))}}const n=e.toLocaleLowerCase();return y[n]||null}var A;!function(e){e[e.Alert=0]="Alert",e[e.NoAlert=1]="NoAlert",e[e.HighImpact=2]="HighImpact",e[e.Critical=3]="Critical"}(A||(A={}));const q=new class{constructor(e=20){this.maxLength=20,this.list=[],this.maxLength=e}push(e){this.list.push(e),this.list.length>this.maxLength&&this.list.shift()}get data(){return this.list}};function x(e,t,n,o=A.Alert){try{const r=function(){if(!i){const e=document.head.getAttribute("data-client-settings");e&&(i=JSON.parse(e))}return i}(),s=a(),c=function(e){if(e){const{pcsInfo:t,pageGenTime:n}=e,o=new Date(n).getTime(),i=!t||["prod","prod-ssr","prod-ssrntp"].includes(t.env);S=i?"browser.events.data.msn.com":"events-sandbox.data.msn.com";return{cors:"true","content-type":"application/x-json-stream","client-id":"NO_AUTH","client-version":"1DS-Web-JS-2.2.2",apikey:i?"0ded60c75e44443aa3484c42c1c43fe8-9fc57d3f-fdac-4bcf-b927-75eafe60192e-7279":"f8857dedc6f54ca8962cfb713e01e7d7-e9250191-fe0b-446f-95ae-07516262f98c-7028","upload-time":o,w:"0",anoncknm:"app_anon"}}return null}(r);let d="";c&&c.apikey&&""!==c.apikey&&(d=function(e){if(e){const t=e.indexOf("-");if(t>0)return e.substring(0,t)}return""}(c.apikey));const l=function(e,t,n,o,i,r,a=A.Alert){if(n){i=i||{};const{apptype:c,audienceMode:d,pagetype:l,pageGenTime:u,bundleInfo:w,deviceFormFactor:m="",fd_muid:p,os:h}=n;i.pageGenTime=u,i.build=w&&w.v,i.appType=c;const g=function(e,t,n){const o=n&&"phone"===n.toLowerCase(),i=t&&"enterprise"===t;return{bingHomepage:"binghomepage",mmx:"emmx",edge:"spartan",edgeChromium:i?"entnews":"anaheim",hybrid:"spartan",hub:o?"prime_mobile":"prime",microsoftNews:"msnews",office:"entnews",views:o?"prime_mobile":"prime",windowsShell:"windowsshell"}[e]}(c,d,m),f=g||c,v=document.getElementsByTagName("html")[0].getAttribute("lang");let b,y="",S="muid";try{if("edgeChromium"===c&&"object"==typeof window&&window.location&&window.location.search){const e=new URLSearchParams(window.location.search);b=e.has("startpage")?"msedgdhp":"msedgntp","enterprise"===d?b="entnewsntp":"xbox"===h&&(b="xboxntp")}window&&window.getCookieConsentRequired&&"function"==typeof window.getCookieConsentRequired&&window.getCookieConsentRequired()||(y=E("muid"))}catch{}y||(y=n.aid,S="aid");const T={name:"MS.News.Web.AppError",time:u,ver:"4.0",iKey:`o:${o}`,data:{baseData:{},baseType:"MS.News.Web.Base",page:{name:"default",product:f,type:L(l),content:{category:"standaloneError"},ocid:b},browser:{clientId:y,clientIdType:S},flight:{id:r},request:{activityId:n.aid,requestId:n.aid,afdMuid:p},locale:{mkt:v},extSchema:{id:e,severity:a,pb:i,message:t}}};var s;if(y&&"muid"===S)T.ext={...null==T?void 0:T.ext,user:{...null==T||null===(s=T.ext)||void 0===s?void 0:s.user,localId:`t:${y}`}};return T.data.flight.tmpl="",i.isSSRScope&&(T.data.flight.tmpl+="ssrscope:1"),"object"==typeof window&&(window.isSSREnabled&&(T.data.flight.tmpl+=";ssr-enabled:1"),window.isSSRCompleted&&(T.data.flight.tmpl+=";ssr-completed:1")),T?JSON.stringify(T):null}return null}(t,e,r,d,n,s,o);if(c&&l){console.error(l),q.push(l);const e="https://"+S+"/OneCollector/1.0"+function(e){return"?"+Object.keys(e).map((function(t){return t+"="+encodeURIComponent(e[t])})).join("&")}(c);navigator.sendBeacon(e,l)}}catch{}}function L(e){let t=e;switch(e){case"windowsshellhp":t="dhp";break;case"video":t="watch"}return t}const N="sign-in-active",C="sign-in-pending",I="sign-in-refreshed-page",O="sign-in-refresh-session",P="data-t";function U(e){try{const t=function(){var e,t;if(null===(e=window.oneDSConfig)||void 0===e||!e.endpoint)throw new Error("1DS endpoint not found");const n=new URL(window.oneDSConfig.endpoint);return n.searchParams.append("cors","true"),n.searchParams.append("content-type","application/x-json-stream"),n.searchParams.append("client-id","NO_AUTH"),n.searchParams.append("client-version",`peregrine-lite-telemetry-${null===(t=b.bundleInfo)||void 0===t?void 0:t.v}`),window.oneDSConfig.key&&n.searchParams.append("apikey",window.oneDSConfig.key),n.searchParams.append("upload-time",Date.now().toString()),n.searchParams.append("w","0"),n.searchParams.append("anoncknm","app_anon"),n.searchParams.append("NoResponseBody","true"),n}();navigator.sendBeacon(t,JSON.stringify(e))}catch(e){x("Error sending Lite Telemetry",34019,{error:e.message})}}function B(e){try{if(sessionStorage.getItem(N)||sessionStorage.getItem(C)||sessionStorage.getItem(I)||sessionStorage.getItem(O))return}catch(e){}window.__peregrine_litePVSent=!0;const t=R("MS.News.Web.PageView",new Date,e);(o||(o=new Promise((e=>{"visible"===document.visibilityState&&e(),document.addEventListener("visibilitychange",(function t(){"visible"===document.visibilityState&&(e(),document.removeEventListener("visibilitychange",t))}))}))),o).then((()=>{n().TimeToSendPageView=Math.round(performance.now()),U(t)}))}function D(e,t){if(e)try{const n=R("MS.News.Web.PageAction",new Date);n.data.actionType=t,["click","rightclick"].includes(t)&&(n.data.gesture=t);const o=H(e);if(o){if("search_websearch"===o.n)return;n.data.behavior=o.b,n.data.object={name:o.n,type:o.t,content:{id:o["c.i"],type:o["c.t"],headline:o["c.hl"],vertical:o["c.v"],brandId:o["c.bi"],category:o["c.c"]},ext:o.ext,destinationUrl:e.getAttribute("action")||e.href||""};let t=o.n||"",i=e.parentElement;for(;i&&i!==document.body;){const e=H(i);null!=e&&e.n&&(t=`${e.n}>${t}`),i=i.assignedSlot||i.parentElement||i.parentNode.host}n.data.object.placement={lineage:t}}U(n)}catch(e){x("Error sending Lite Action Telemetry",34019,{error:e.message})}}function M(e){try{if("auxclick"===e.type&&1!==e.button)return;const t=function(e){if(!e)return;if(!e.composedPath||"function"!=typeof e.composedPath)return e.target;{const t=e.composedPath();if(t.length>2&&"hasAttribute"in t[0]&&!t[0].hasAttribute(P)&&"[object ShadowRoot]"===Object.prototype.toString.call(t[1])&&"hasAttribute"in t[2]&&t[2].hasAttribute(P))return t[2];if(t.length>0)return t[0]}}(e),n=t&&function(e){const t=20;for(let o=0;o<t&&e&&!$(e);o++){var n;e=e.assignedSlot||e.parentElement||(null===(n=e.parentNode)||void 0===n?void 0:n.host)}if(!$(e))return;return e}(t);if(n){const t=e.type;D(n,J[t]||"click")}}catch(e){x("Error sending Click Event Telemetry",34019,{error:e.message})}}function $(e){if(!e)return!1;if("BUTTON"===e.nodeName||e.hasAttribute("href")||e.getAttribute&&"button"===e.getAttribute("role")||e.form)return!0;const t=H(e);return t&&(5===t.t||11===t.t||t.b&&e.tagName.includes("-"))}function H(e){try{const t=e.getAttribute(P);return t&&JSON.parse(t)}catch(e){x("Error parsing telemetry attribute",34019,{error:e.message})}}const J={auxclick:"middleclick",contextmenu:"rightclick"},V=e=>{M(e)},j=e=>{e.target&&D(e.target,"submit")};var F;!function(e){e.visibility="visibility",e.adServed="adserved",e.click="click"}(F||(F={}));const W=["control icon-only","menu","ad-label","ad-choice"],z="cs-personalized-feed";function G(){var e,t;if(!window.isSSRCompleted)return;const n=null===(o=document.querySelector("edge-chromium-page"))||void 0===o||null===(i=o.shadowRoot)||void 0===i||null===(r=i.querySelector("grid-view-feed"))||void 0===r||null===(a=r.shadowRoot)||void 0===a||null===(s=a.querySelector("cs-super-container"))||void 0===s||null===(c=s.shadowRoot)||void 0===c||null===(d=c.querySelector(z))||void 0===d||null===(l=d.shadowRoot)||void 0===l?void 0:l.querySelector("cs-feed-layout");var o,i,r,a,s,c,d,l;const u=(null==n||null===(e=n.shadowRoot)||void 0===e?void 0:e.querySelectorAll("cs-native-ad-card"))||[];null===(t=window.ssrAdData)||void 0===t||t.forEach(((e,t)=>{var o,i;Y(e.beaconsJson,F.adServed);let r=null===(o=u[t])||void 0===o||null===(i=o.shadowRoot)||void 0===i?void 0:i.querySelector(`#${e.id}`);if(!r){var a,s,c,d,l;if(r=0==t?null==n||null===(a=n.shadowRoot)||void 0===a?void 0:a.querySelector("#nativead-river-1"):null==n||null===(s=n.shadowRoot)||void 0===s?void 0:s.querySelector("#nativead-resriver-1"),!r)r=null===(c=function(){var e,t,n,o,i;const r=[];return null===(e=document.querySelector("edge-chromium-page"))||void 0===e||null===(t=e.shadowRoot)||void 0===t||null===(n=t.querySelector("grid-view-feed"))||void 0===n||null===(o=n.shadowRoot)||void 0===o||null===(i=o.querySelectorAll("cs-super-container"))||void 0===i||i.forEach((e=>{var t,n;null===(t=e.shadowRoot)||void 0===t||null===(n=t.querySelectorAll(z))||void 0===n||n.forEach((e=>{var t,n;null===(t=e.shadowRoot)||void 0===t||null===(n=t.querySelectorAll("cs-feed-layout"))||void 0===n||n.forEach((e=>{var t,n;null===(t=e.shadowRoot)||void 0===t||null===(n=t.querySelectorAll("cs-native-ad-card"))||void 0===n||n.forEach((e=>{r.push(e)}))}))}))})),r}())||void 0===c||null===(d=c[t])||void 0===d||null===(l=d.shadowRoot)||void 0===l?void 0:l.querySelector(`#${e.id}`);if(!r){var w,m,p,h,g;const o=(null==n||null===(w=n.shadowRoot)||void 0===w||null===(m=w.children)||void 0===m?void 0:m.length)||0,i=[];for(let e=0;e<o;e++){var f,v,b;i.push(null==n||null===(f=n.shadowRoot)||void 0===f||null===(v=f.children)||void 0===v||null===(b=v.item(e))||void 0===b?void 0:b.tagName)}const r=(null===(p=u[t])||void 0===p||null===(h=p.shadowRoot)||void 0===h||null===(g=h.querySelector("cs-card"))||void 0===g?void 0:g.outerHTML)||"";return void x("Ad render doesn't match ssr ad data",20193,{renderedCardTags:JSON.stringify(i),adDataId:e.id,renderedId:JSON.stringify(r)})}}window.adsListened?window.adsListened.push(r.id):window.adsListened=[r.id],r.addEventListener("click",(t=>{const n=t.composedPath();for(let e=0;e<7&&e<n.length;e++){const t=n[e];if(t.className&&W.includes(t.className.replace(/\s/g,"")))return}Y(e.beaconsJson,F.click,e.clickBeaconJson)}));new IntersectionObserver(K(e.beaconsJson),{root:null,rootMargin:"0px",threshold:.5}).observe(r)}))}const K=e=>(t,n)=>{t&&t.forEach((t=>{t.intersectionRatio>=.5&&window.setTimeout((()=>{Y(e,F.visibility)}),1e3,n,t.target)}))};function Y(e,t,n){var o;if(null!=e&&e.length)try{const a=JSON.parse(e);let s;switch(t){case F.adServed:s=a&&a.trb;break;case F.visibility:s=a&&a.tvb;break;case F.click:s=n&&(null===(o=JSON.parse(n))||void 0===o?void 0:o.tcb)}for(let e=0;e<s.length;e++){var i,r;const n=s[e];t===F.visibility&&null!==(i=window.viewedBeaconUrls)&&void 0!==i&&i.includes(n)||t===F.adServed&&null!==(r=window.servedBeaconUrls)&&void 0!==r&&r.includes(n)||Q(n,t,a.e)}}catch(t){x(`Fail to fire ad served call, Fail to parse beacon json tracking data: ${e}`,20179,{error:t.message})}}function Q(e,t,n){n||(e=decodeURIComponent(e)),e&&function(e,t){try{let t=new Image(1,1);t.src=e,t=null}catch(t){x(`Invalid beacon URL, Fail to parse beacon json tracking data: ${e}`,20189,{error:t.message})}finally{t===F.visibility?window.viewedBeaconUrls?window.viewedBeaconUrls.push(e):window.viewedBeaconUrls=[e]:t==F.adServed&&(window.servedBeaconUrls?window.servedBeaconUrls.push(e):window.servedBeaconUrls=[e])}}(e,t)}function X(e){const t=performance.getEntriesByType("visibility-state").filter((t=>t.startTime<e));if(0===t.length)return e;let n=0;for(let i=0;i<t.length;i++){const r=t[i];var o;if("visible"===r.name)n+=((null===(o=t[i+1])||void 0===o?void 0:o.startTime)??e)-r.startTime}return n}class Z{constructor(){this._published=[],this._subscribers=[]}publish(e){this._published.push(e),this._subscribers.forEach((t=>t(e)))}subscribe(e){this._subscribers.push(e),this._published.forEach((t=>e(t)))}bulkPublish(e){e.forEach((e=>this.publish(e)))}}(()=>{const e=location.search.toLowerCase().indexOf("ssronly=true")>-1;e&&(window.SSRONLY=e),window.isSSREnabled&&(history.scrollRestoration="manual",window.setLiteTelemetryContract=_,window.sendLitePV=B,window.standbyClickEventsHandler=V,window.addEventListener("click",window.standbyClickEventsHandler),window.addEventListener("auxclick",window.standbyClickEventsHandler),window.addEventListener("contextmenu",window.standbyClickEventsHandler),window.searchFormSubmitListener=j,window.sendAdBeacon=G,window.ssrLoadedExperience=new Z,window.ssrLoadedBundles=new Z,window.markTTSR=e=>{window._pageTimings[`${e}-Init`]=Math.round(performance.now()),requestAnimationFrame((()=>{window._pageTimings[`${e}-RAF`]=X(Math.round(performance.now())),setTimeout((()=>{window._pageTimings[e]=X(Math.round(performance.now()))}))}))},window.addEventListener("TTSR.SearchBox",(()=>{try{const e=document.querySelector("edge-chromium-page").shadowRoot.querySelector("cs-header-core").shadowRoot.querySelector("common-search-box-edgenext").shadowRoot.querySelector("cs-common-search-box").shadowRoot.querySelector("form");if(!e)throw"Search box form element not found";e.addEventListener("submit",window.searchFormSubmitListener)}catch(e){x("Exception occurred while adding search box form submit event listener",34018,{error:e.message})}}),{once:!0}),window.addEventListener("TTSR.HeaderTag",(()=>{try{const e=["ms-rewards","notification-bell","common-settings-edgenext"],t=document.getElementsByTagName("edge-chromium-page")[0].shadowRoot.querySelector("cs-header-core").shadowRoot;for(const n of e){const e=t.querySelector(n);e&&(e.removeAttribute("needs-hydration"),e.setAttribute("needs-recreation",""))}}catch(e){x("SSR header components not found",20203,{error:e.message})}})),window.addEventListener("TTSR.TopSitesTag",(()=>{const e=document.getElementsByTagName("edge-chromium-page")[0].shadowRoot.querySelector("top-sites-edgenext");if(!e)return;let t;e.removeAttribute("needs-hydration"),e.setAttribute("needs-recreation","");try{t=JSON.parse(localStorage["TSNP1.topsites"])}catch(e){return}const n=e.shadowRoot,o=null==n?void 0:n.querySelectorAll("div.pill-top-site:not(.add-placeholder)");if(o.length>0){const e=Math.min(o.length,t.length);for(let n=0;n<e;n++){const e=t[n],i=o[n];e.contentViewTelemetryTag&&i.setAttribute("data-t",e.contentViewTelemetryTag),i.setAttribute("title",e.title),i.setAttribute("aria-label",e.title),i.querySelector(".image img").setAttribute("src",e.faviconUrl);const r=i.querySelector("a.control");r.setAttribute("href",e.url),e.anchorTelemetryTag?r.setAttribute("data-t",e.anchorTelemetryTag):x("No anchorTelemetryTag",34021,{error:`contentViewTelemetryTag is ${i.getAttribute("data-t")}`}),i.querySelector("a.control .top-site-title span").innerText=e.title}if(o.length>t.length)for(let t=e;t<o.length;t++)o[t].remove();return void window.markTTSR("TTSR.TopSitesEdgeNextWC")}const i=null==n?void 0:n.querySelectorAll("a.pill-top-site");if(i.length>0){const e=Math.min(i.length,t.length);for(let n=0;n<e;n++){const e=t[n],o=i[n];o.setAttribute("href",e.url),o.setAttribute("title",e.title),o.setAttribute("aria-label",e.title),o.querySelector(".left-part img").setAttribute("src",e.faviconUrl),o.querySelector(".left-part span").innerText=e.title,e.anchorTelemetryTag&&o.setAttribute("data-t",e.anchorTelemetryTag)}if(i.length>t.length)for(let t=e;t<i.length;t++)i[t].remove();window.markTTSR("TTSR.TopSitesEdgeNextWC")}else;}),{once:!0}),window.initCrsRequest=e=>{const{url:t}=e||{};t&&(window.crsRequestData=e,window.crsPromise=new Promise(((e,n)=>{fetch(t).then((t=>{e(t)})).catch((e=>{n(e)}))})))},window.isResized=!1,window.addEventListener("resize",(()=>window.isResized=!0),{once:!0}))})()}(); |