PageSourceSearch

https://www.tomsguide.com/vite/assets/reduxStore-C7ydtzUl.js

js tomsguide.com collected 2026-09-24 08:23:57 UTC 9,467 bytes, 1 lines download raw bytes

1import{h as e,i as t,j as n,k as r,l as o}from"./vendor-6H_pG-cC.js";import{b as a,g as i}from"./user-D_m6siNs.js";import{g as l}from"./cookies-Btke1V1y.js";import{g as s}from"./screen-size-Dw4LJ_p1.js";import{_ as c}from"./preload-helper-DZ_bAA1L.js";const d=e({name:"vanilla",initialState:{isArticle:!1},reducers:{setIsArticle:(e,t)=>{e.isArticle=t.payload}}}),u={pageChange:!1,page:{title:null,url:null,region:"",type:null,category:null,tags:[],number:null,countryCode:null,index:null},site:{region:"",brand:null,countryCode:null},content:{article:{verticals:null,subVerticals:null,language:null,authors:null,id:null,publishDate:{year:null,month:null,day:null},updateDate:{year:null,month:null,day:null},cmsCategory:null,cmsChildcategory:null,cmsGrandchildCategory:null}},product:{primary:{name:null,brand:null,category:null},secondary:{products:[],brands:[]},source:""}};function g(e,t){const n=structuredClone(e);return m(n,t),n}function m(e,t){if(t)for(const n of Object.keys(t)){const r=t[n];r&&"object"==typeof r&&!Array.isArray(r)?(e[n]||(e[n]={}),m(e[n],r)):e[n]=r}}const p=e({name:"analytics",initialState:{freyrData:u},reducers:{setFreyrData(e,t){e.freyrData=g(u,t.payload)},updateCountryCode(e,t){e.freyrData.page.countryCode=t.payload,e.freyrData.site.countryCode=t.payload},addFreyrTags(e,t){const n=e.freyrData.page.tags,r=t.payload,o=Array.from(new Set([...n,...r]));e.freyrData.page.tags=o},updateDfpData(e,t){const{cmsCategory:n,cmsChildcategory:r,cmsGrandchildCategory:o}=t.payload;e.freyrData.content.article={...e.freyrData.content.article,cmsCategory:n,cmsChildcategory:r,cmsGrandchildCategory:o}}}}),{setFreyrData:y,addFreyrTags:v,updateCountryCode:w,updateDfpData:f}=p.actions,h=e({name:"sponsoredScroll",initialState:{articleUrl:"",articleDocumentTitle:"",sponsorArticleID:"",articlesData:{}},reducers:{setArticleUrl:(e,t)=>{e.articleUrl=t.payload},setArticleDocumentTitle:(e,t)=>
1{e.articleDocumentTitle=t.payload},setSponsorArticleID:(e,t)=>{e.sponsorArticleID=t.payload},setArticlesData:(e,t)=>{e.articlesData={...e.articlesData,...t.payload}}}}),C=t("freyr/sendEventToFreyr"),b=e=>e=>t=>{if(C.match(t)){const{name:e,eventObject:n}=t.payload;window.freyr?(window.freyr.cmd.push((()=>{window.freyr.pushAndUpdate(e,{...n})})),a()):console.warn("[Freyr Middleware] Freyr is not initialized yet. Cannot send event.")}return e(t)},T=e=>t=>n=>{var r,o;const a=t(n);if(y.match(n)){const t=l("FTR_Country_Code")??l("FTR_User_Defined_Country_Code")??"";if(t&&e.dispatch(w(t)),window.dfp_config){const t=e=>{var t;return(null==(t=window.dfp_config)?void 0:t[e])||null},n={cmsCategory:t("category"),cmsChildcategory:t("child_category"),cmsGrandchildCategory:t("grandchild_category")};e.dispatch(f(n))}const n=!!(null==(o=null==(r=null==window?void 0:window.FUTR)?void 0:r.Kiosq)?void 0:o.User);i(),(()=>{const e=document.referrer;return e.includes("l.facebook.com")||e.includes("lm.facebook.com")})()&&e.dispatch(v(["boost-src-facebook"]));const{pageChange:a,...c}=e.getState().analytics.freyrData;e.dispatch(A.freyr.sendEventToFreyr({name:a?"pageChangedEvent":"pageLoadEvent",eventObject:{...c,user:{loggedIn:n,screenWidth:s(),ua:window.navigator.userAgent||null}}}))}return a},D=e({name:"tabNotifications",initialState:{count:0},reducers:{incrementCount:e=>{e.count++},decrementCount:e=>{e.count--},setCount(e,t){e.count=t.payload}}}),L=e({name:"viafouraComments",initialState:{useRestrictedCommentWidgetHeight:!1},reducers:{setUseRestrictedCommentWidgetHeight(e,t){e.useRestrictedCommentWidgetHeight=t.payload}}}),S=e({name:"newsletter",initialState:{formData:null},reducers:{setFormData:(e,t)=>{e.formData=t.payload}}}),A={vanilla:d.actions,analytics:p.actions,tabNotifications:D.actions,sponsoredScroll:h.actions,viafouraComments:L.actions,newsletter:S.actions,freyr:{sendEventToFreyr:C}};function F(e){const[t,n]=e.split(".");return function(e){return e in A}(t)?function(e,t){return t in A[e]}(t,n)?A[t][n]:(console.warn(`Unknown action: ${e}`),null):(console.warn(`Unknown reducer: ${t}`),null)}const P={LCP:{needsImprovement:2500,poor:4e3},INP:{needsImprovement:200,poor:500},CLS:{needsImprovement:.1,poor:.25}},I=(e,t)=>{const n=P[e];return t>n.poor?"poor":t>n.needsImprovement?"needs-improvement":null},E=(...e)=>{console.log("[CWV]",...e)},_=n();let N=!1;_.startListening({matcher:r(p.actions.setFreyrData),effect:async(e,t)=>{if(N)return;N=!0;const n=(()=>{var e,t,n,r,o,a,i,l,s;const c=new URLSearchParams(location.search),d="1"===c.get("cwvLog")||Boolean(null==(n=null==(t=null==(e=null==window?void 0:window.vanilla)?void 0:e.featureFlags)?void 0:t.coreWebVitalsThresholdMonitoring)?void 0:n.logger),u=c.get("cwvLogMode");return{enabled:d,mode:"all"===u||"violations"===u?u:"all",metrics:((e,t)=>{if(!e)return["LCP","INP","CLS"];const n=e.split(",").map((e=>e.trim().toUpperCase())),r=["LCP","INP","CLS"];return n.filter((e=>r.includes(e)))})(c.get("cwvLogMetrics")),showAttribution:"1"===c.get("cwvLogAttr")||Boolean(null==(a=null==(o=null==(r=null==window?void 0:window.vanilla)?void 0:r.featureFlags)?void 0:o.coreWebVitalsThresholdMonitoring)?void 0:a.loggerAttr),showEmits:"1"===c.get("cwvLogEvent")||Boolean(null==(s=null==(l=null==(i=null==window?void 0:window.vanilla)?void 0:i.featureFlags)?void 0:l.coreWebVitalsThresholdMonitoring)?void 0:s.loggerEvent)}})(),r=Boolean(null==(i=null==(a=null==(o=window.vanilla)?void 0:o.featureFlags)?void 0:a.coreWebVitalsThresholdMonitoring)?void 0:i.enabled);var o,a,i;const l=(()=>{const e=navigator.userAgent.toLowerCase();return/bot|crawler|spider|lighthouse|pagespeed|speedcurve|headless/.test(e)})(),s=(()=>{var e;const t=(null==(e=window.PerformanceObserver)?void 0:e.supportedEntryTypes)||[];return{types:t,lcp:t.includes("largest-contentful-paint"),cls:t.includes("layout-shift"),inp:t.includes("event")}})();if(!r&&!n.enabled)return;if(l&&r&&!n.enabled)return;if(r){const e=(()=>{var e,t,n;const r=null==(n=null==(t=null==(e=null==window?void 0:window.vanilla)?void 0:e.featureFlags)?void 0:t.coreWebVitalsThresholdMonitoring)?void 0:n.sampleRate,o=Number(r);return Number.isFinite(o)?o:1})();
1if(Math.random()>e)return;n.enabled&&E("listener start",{flagOn:r,sampleRate:e,bot:l,support:s,cfg:n})}else n.enabled&&E("listener start",{flagOn:r,sampleRate:1,bot:l,support:s,cfg:n});const d=r;try{const{onLCP:e,onINP:t,onCLS:r}=await c((async()=>{const{onLCP:e,onINP:t,onCLS:n}=await import("./vendor-6H_pG-cC.js").then((e=>e.w));return{onLCP:e,onINP:t,onCLS:n}}),[]),o={LCP:null,INP:null,CLS:null},a=(e,t)=>{const n=e.name,r={metric:n,value:e.value,rating:e.rating,threshold:t,id:e.id,delta:e.delta,navigationType:e.navigationType,pageUrl:location.href,userAgent:navigator.userAgent,thresholds:P[n]};if("LCP"===n){const t=(e=>{if(!e)return;const{target:t,url:n,timeToFirstByte:r,resourceLoadDelay:o,resourceLoadDuration:a,elementRenderDelay:i}=e;return{target:t,element:t,url:n,timeToFirstByte:r,resourceLoadDelay:o,resourceLoadDuration:a,elementRenderDelay:i}})(e.attribution),n={...t,lcpElement:(null==t?void 0:t.target)??(null==t?void 0:t.element)};return{...r,metric:"LCP",attribution:n}}if("INP"===n){const t=(e=>{if(!e)return;const{interactionTarget:t,eventType:n}=e;return{interactionTarget:t,eventType:n,loadState:e.loadState??e.interactionLoadState}})(e.attribution),n={...t,inpEventTarget:null==t?void 0:t.interactionTarget};return{...r,metric:"INP",attribution:n}}const o=(e=>{if(!e)return;const{largestShiftTarget:t}=e;return{largestShiftTarget:t}})(e.attribution);return{...r,metric:"CLS",attribution:o}},i=e=>{var t;const r=e.name;((e,t,n,r,o)=>{if(!((e,t,n)=>!(!e.enabled||!e.metrics.includes(t)||"all"!==e.mode&&null===I(t,n)))(e,t,n))return;const a=I(t,n),i=P[t],l="LCP"===t?{target:null==o?void 0:o.target,url:null==o?void 0:o.url}:"INP"===t?{interactionTarget:null==o?void 0:o.interactionTarget,eventType:null==o?void 0:o.eventType}:{largestShiftTarget:null==o?void 0:o.largestShiftTarget},s=`${t} value=${((e,t)=>"CLS"===e?t.toFixed(3):Math.round(t).toString())(t,n)} rating=${r} label=${a??"good"}`;E(s,i),e.showAttribution&&o&&E("attribution",l)})(n,r,e.value,e.rating,e.attribution);const i=I(r,e.value);if(!i)return;if(o[r]===e.value)return;o[r]=e.value;const l=a(e,i);((e,t,n)=>{e.enabled&&e.showEmits&&E("[emit]",t,n)})(n,r,l),d&&(null==(t=window.dispatchOrQueueAction)||t.call(window,"freyr.sendEventToFreyr",{name:"coreWebVitalsThresholdEvent",eventObject:l}))},l=1e3;let s,u=null;const g=()=>{u&&(s&&(window.clearTimeout(s),s=void 0),i(u))};e((e=>i(e)),{reportAllChanges:!0}),t((e=>i(e)),{reportAllChanges:!0,durationThreshold:0}),r((e=>{u=e,s&&window.clearTimeout(s),s=window.setTimeout((()=>i(e)),l)}),{reportAllChanges:!0}),document.addEventListener("visibilitychange",(()=>{"hidden"===document.visibilityState&&g()})),window.addEventListener("pagehide",g)}catch(e){console.warn("[webVitalsListener] Failed to init web-vitals/attribution",e)}}});const R=o({reducer:{vanilla:d.reducer,analytics:p.reducer,tabNotifications:D.reducer,sponsoredScroll:h.reducer,viafouraComments:L.reducer,newsletter:S.reducer},middleware:e=>e().concat(_.middleware,b,T)});if("undefined"!=typeof window&&(window.reduxStore=R,window.Actions=A,window.actionQueue&&window.actionQueue.length)){for(const e of window.actionQueue){const t=F(e.action);if(t)try{const n=t(e.payload);window.reduxStore.dispatch(n),"analytics.setFreyrData"===e.action&&delete window.freyrData}catch(t){console.error(`Error dispatching action ${e.action}:`,t)}}window.actionQueue=[]}export{R as r};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.