PageSourceSearch

https://static.foxnews.com/static/orion/scripts/core/auth/ag.app.js

js foxnews.com collected 2026-10-01 09:09:00 UTC 36,171 bytes, 25 lines download raw bytes

1/*! updated; 09-28-2026 11:57 AM **/
2
3
4Modulr.define("core.auth:api",["require","config"],function(require,config){class AuthAPI{constructor(){if(AuthAPI.instance)return AuthAPI.instance;AuthAPI.instance=this;var authType=config.authType;this.config=config,this.authType=authType,this.initialized=!1,this.Centralized=null,this.Middleware=null}initialize(){var authType;this.initialized||(authType=this.authType,"centralized"===authType?require(["models/centralized"],Centralized=>{this.Centralized=Centralized,this.initialized=!0,require(["modules/navbar"])}):"legacy"===authType&&require(["models/middleware"],Middleware=>{this.Middleware=Middleware,this.initialized=!0,require(["modules/navbar.legacy"])}))}middleware(callback){if("function"==typeof callback){let instance=AuthAPI.instance;instance.Middleware?callback(instance.Middleware):require(["models/middleware"],Middleware=>{instance.Middleware=Middleware,callback(Middleware)})}}centralized(callback){if("function"==typeof callback){let instance=AuthAPI.instance;if(instance.Centralized)return callback(instance.Centralized);require(["models/centralized"],Centralized=>{instance.Centralized=Centralized,callback(Centralized)})}}isAuthenticated(){return new Promise(resolve=>{this.centralized(Centralized=>{if(!Centralized)return resolve(!1);Centralized.isAuthenticated(()=>{var authData=Centralized.getUserProps();resolve(authData)})})})}manageAccount(){this.centralized(Centralized=>{Centralized&&Centralized.manageAccount()})}login(opts={},trackingProps={}){this.centralized(Centralized=>{Centralized&&(Centralized.getUserProps()?.isAuthenticated?Centralized.manageAccount():Centralized.login(opts,trackingProps))})}update(opts={}){return new Promise((resolve,reject)=>{this.centralized(Centralized=>{Centralized?Centralized.getUserProps()?.isAuthenticated?Centralized.update(opts).then(result=>{resolve(result)}).catch(error=>{reject(error)}):reject(new Error("Profile update failed - user is not authenticated")):reject(new Error("Profile update failed - Centralized SDK is not available"))})})}}return new AuthAPI});
5Modulr.define("core.auth:config",["require","helper","core.base:utils/localStorage","cdn"],function(Require,Helper,LocalStorage){var Require=Require("cdn"),config={};let domain=window.location.hostname.match(/(foxnews)/g)?"foxnews":"foxbusiness";return config.isWebview=Helper.isAppMode(),config.domain=domain,config.hosts={foxbusiness:"my.foxbusiness.com",foxnews:"my.foxnews.com"},config.authType=(()=>{switch(domain){case"foxbusiness":return"legacy";case"foxnews":return"centralized";default:return"legacy"}})(),config.hostName=config.hosts[domain],config.authCookieKey="FOXKITAUTHN",config.authStateCookieKey="UID_STATE",config.financialIncentiveKey="fi",config.legacyAuthConverted="true"===LocalStorage.get("myfox_converted"),config.cdn=Require,config});
6Modulr.define("core.auth:helper",["require","jquery","core.base:utils/cookie","core.base:utils/localStorage","core.plugins:AppWebviewEvents"],function(require,$,Cookie,LocalStorage){function Helper(){this.webviewEvents=require("core.plugins:AppWebviewEvents")({disableInit:!0})}let XID=window?.FNC?.xid||{},Anon=window?.FNC?.ISA?.anon||{};return Helper.prototype.log=function(){if(window.console){var args=Array.prototype.slice.call(arguments);args.unshift("[core.auth]");try{return window.console.log.apply(window.console,args)}catch(err){window.console.log(args.join(" | "))}}},Helper.prototype.isAppMode=function(){var mode=new URLSearchParams(window.location.search).get("mode");return $("body").hasClass("app-mode")||"app"===mode||"true"===this.getWebviewFlag()||!!this.getWebviewAccessToken()},Helper.prototype.isHybridMode=function(){return"app"===new URLSearchParams(window.location.search).get("mode")},Helper.prototype.getWebviewAccessToken=function(){return Cookie.get("wv_at")||LocalStorage.get("wv_at")||null},Helper.prototype.getWebviewFlag=function(){return Cookie.get("wv")||LocalStorage.get("wv")||null},Helper.prototype.getStoragePrefix=function(){return"fxn_cstore__"},Helper.prototype.getWebviewTokenKey=function(){return"wv_at"},Helper.prototype.triggerProfileEvent=function(eventType){var isAppMode=this.isAppMode();this.webviewEvents&&isAppMode&&this.webviewEvents.triggerProfileEvent(eventType)},Helper.prototype.getWebviewEvents=function(){return this.webviewEvents||require("core.plugins:AppWebviewEvents")({disableInit:!0})},Helper.prototype.setReferrer=function(url=window.location.href){LocalStorage.set("referrerUrl",url)}
6,Helper.prototype.getReferrer=function(){var referrer=LocalStorage.get("referrerUrl");return referrer&&this.clearReferrer(),referrer||"https://"+window.location.hostname},Helper.prototype.clearReferrer=function(){LocalStorage.remove("referrerUrl")},Helper.prototype.setLegacyAuthConverted=function(){return LocalStorage.set("myfox_converted",!0)},Helper.prototype.getXID=function(){return XID?.xid_value||Cookie.get("xid",!0)||null},Helper.prototype.getLeapProps=function(){var leapProps=Cookie.get("__leap_props",!0);if("string"!=typeof leapProps)return{};try{return JSON.parse(leapProps)}catch(e){return{}}},Helper.prototype.getAnonUserData=function(userData){var xid=this.getXID(),{profileId:userData=""}=userData||{},{lastKnownId=""}=this.getLeapProps()||{};return{value:xid,segment:{lastAnonymousProfileId:xid,dcg_profile_id:userData,lastKnownProfileId:userData||lastKnownId}}},Helper.prototype.updateAuthLeapProps=function(userData){userData=(userData||{}).authProps,userData=this.getAnonUserData(userData);Anon.pushAnon(userData)},new Helper});
7Modulr.define("core.auth:models/auth.executioner",[],function(){class AuthExecutioner{constructor(context){if(AuthExecutioner.instance)return AuthExecutioner.instance;(AuthExecutioner.instance=this).context=context||null,this.PRIORITY_QUEUE=[],this.EXECUTION_STACK=[],this.isReady=!1}ready(){this.isReady=!0,this.executePendingQueue()}executePendingQueue(){let{EXECUTION_STACK,PRIORITY_QUEUE,context}=this,queue=[...PRIORITY_QUEUE,...EXECUTION_STACK];if(!(!EXECUTION_STACK&&!PRIORITY_QUEUE||queue.length<=0)){let processQueueMethod=async()=>{if(!(queue.length<=0)){var method=queue.shift();if(method&&"function"==typeof method){let result=null;try{result=method.call(context)}catch(error){return console.error("Error executing method in queue:",error),void processQueueMethod()}if(result&&"function"==typeof result.then)try{await result,processQueueMethod()}catch(error){console.error("Error executing method in queue:",error),processQueueMethod()}else processQueueMethod()}else console.error("Method in queue is not a function:",method),processQueueMethod()}};processQueueMethod()}}executeMethod(method,opts={}){if(method){var{PRIORITY_QUEUE,EXECUTION_STACK,context}=this;if(this.isReady){if("function"==typeof method)try{method.call(context)}catch(error){console.error("Error executing method:",error)}}else{opts=opts.prioritize;opts?PRIORITY_QUEUE.push(method.bind(context)):EXECUTION_STACK.unshift(method.bind(context))}}}}return AuthExecutioner});
8Modulr.define("core.auth:models/centralized",["config","fnc.isa","helper","core.auth:models/auth.executioner","core.base:utils/cookie","core.base:utils/localStorage","core.auth:api","core.auth:modules/login-handler","core.auth:models/webview"],function(AuthConfig,ISA,Helper,AuthExecutioner,Cookie,LocalStorage,AuthAPI,LoginHandler,WebviewAuthController){let path=window.location.pathname,host=window.location.host,queryParams=new URLSearchParams(window.location.search),{isWebview,domain}=AuthConfig;class CentralizedLogin{constructor(){if(CentralizedLogin.instance)return CentralizedLogin.instance;if((CentralizedLogin.instance=this).initialized=!1,this.centralizedSDK=null,this.profileSDK=null,this.foxProfileProvider=null,this.userProps={isAuthenticated:!1,authProps:{}},this.clientId=null,this.refreshListener=null,this.AUTH_EXECUTIONER=new AuthExecutioner(this),this.isCallback="/callback"===path,this.onSuccessPage=document.referrer.includes(`https://${host}/callback`)&&LoginHandler.isSuccess(),this.webviewController=null,this.isWebview=isWebview,this.isLogout="true"===queryParams.get("ice_mplo"),this.isLogout){queryParams.delete("ice_mplo");let adjustedParams=queryParams.toString();0<adjustedParams.length&&(adjustedParams="?"+adjustedParams),window.history.replaceState({},"",""+location.pathname+adjustedParams+location.hash)}this.initialized||this.init()}
8async init(){var initialized=this.initialized;return initialized?null:await this.getProfileProvider()?void(this.isWebview?this.initWebviewAuth():this.initWebAuth()):(console.error("Profile provider not loaded"),this.AUTH_EXECUTIONER.ready(),null)}async initWebAuth(){var refreshToken,token;AuthConfig.legacyAuthConverted||({token,refreshToken}=await this.getLegacyAuth(),token&&refreshToken&&(token={accessToken:token,refreshToken:refreshToken,clientId:this.clientId},this.tokenExchangeV3(token,()=>{this.flushLegacyAuth()})),Helper.setLegacyAuthConverted()),this.refreshListener||(this.refreshListener=document.addEventListener("SDK_ACCESS_TOKEN_UPDATED",()=>{this.isAuthenticated()})),this.checkAuth(),this.updateUserProps(),this.isLogout&&(this.setAuthStateCookie(!1),this.logout()),this.AUTH_EXECUTIONER.ready(),this.initialized=!0,LoginHandler.run(),this.onSuccessPage&&(await this.flagFinancialIncentive(),ISA.track("profile-success-event",{}))}initWebviewAuth(){this.webviewController=new WebviewAuthController(this.webviewLogin.bind(this))}getLegacyAuth(){return new Promise(resolve=>{try{AuthAPI.middleware(Middleware=>{Middleware.getLegacyAuth(legacyData=>{resolve(legacyData)})})}catch(error){console.error("Error getting legacy auth:",error),resolve(null)}})}updateUserProps(){this.AUTH_EXECUTIONER.executeMethod(()=>new Promise(resolve=>{(async()=>{try{var profileId,isAuthenticated=this.userProps.isAuthenticated,userProps=(isAuthenticated&&(profileId=(await this.getUserFromCookie()||{}).profileId,profileId||await this.getUserInfo()),this.getUserProps());Helper.updateAuthLeapProps(userProps),resolve(!0)}catch(error){console.error("Error updating user props:",error),resolve(!1)}})()}),{prioritize:!0})}checkAuth(){var isCallback=this.isCallback;if(isCallback)try{this.onAuthCallback(callbackData=>{this.isAuthenticated(isAuthenticated=>{this.setAuthStateCookie(isAuthenticated),this.handleAuthResult(isAuthenticated)},{prioritize:!0,async:!0})})}catch(error){console.error("Error calling onAuthCallback method from Profile provider:",error),this.setAuthStateCookie(!1),this.handleAuthResult(!1)}else this.isAuthenticated(async isAuthenticated=>{isAuthenticated||this.triggerGoogleFEDCM(),this.setAuthStateCookie(isAuthenticated)},{prioritize:!0,async:!0})}handleAuthResult(isAuthenticated){var referrer=Helper.getReferrer()||"//"+host,referrer=new URL(referrer);referrer.searchParams.set("login",isAuthenticated?"success":"error"),window.open(referrer.toString(),"_self")}getProfileProvider(){return new Promise(resolve=>{if(this.foxProfileProvider)return resolve(!0);ISA.provider("fox-profile",foxProfileProvider=>{if(!foxProfileProvider)return console.error("Fox Profile Provider not found"),resolve(!1);var profileReady=foxProfileProvider.ready;profileReady&&"function"==typeof profileReady&&profileReady((CentralizedSDK,ProfileSDK)=>{try{var config=CentralizedSDK.config,clientId=config.clientId;this.clientId=clientId,this.foxProfileProvider=foxProfileProvider,this.centralizedSDK=CentralizedSDK,this.profileSDK=ProfileSDK,resolve(!0)}catch(error){console.error("Error initializing profile SDK:",error),resolve(!1)}})})})}login(opts={},trackingProps={}){this.isWebview?Helper.triggerProfileEvent():(Helper.setReferrer(),this.AUTH_EXECUTIONER.executeMethod(()=>{window.addEventListener("profile-initiation-event-complete",event=>{setTimeout(()=>{this.foxProfileProvider.login(opts)},500)}),ISA.track("profile-initiation-event",trackingProps)}))}logout(opts={}){Helper.clearReferrer(),this.AUTH_EXECUTIONER.executeMethod(()=>new Promise(resolve=>{this.foxProfileProvider.profileLogout(opts).then(()=>{resolve(!0)}).catch(error=>{resolve(!1)})}),{prioritize:!0})}manageAccount(){this.isWebview||this.AUTH_EXECUTIONER.executeMethod(()=>{var authProps,foxProfileProvider=this.foxProfileProvider;foxProfileProvider&&(foxProfileProvider=foxProfileProvider.getAuthBaseDomain(),foxProfileProvider=new URL(`https://${foxProfileProvider}/manage/news`),{authProps}=this.userProps,authProps=(authProps||null).email,authProps&&foxProfileProvider.searchParams.set("email",authProps),window.open(foxProfileProvider.toString(),"_self"))})}getUserProps(){return this.userProps}onAuthCallback(callback){this.isCallback&&this.AUTH_EXECUTIONER.executeMethod(()=>new Promise(resolve=>{try{this.foxProfileProvider.onAuthCallback().then(callbackData=>{"function"==typeof callback&&callback(callbackData),resolve(!0)}).catch(error=>{"function"==typeof callback&&callback(null),resolve(!1)})}catch(error){console.error("Error handling auth callback:",error),"function"==typeof callback&&callback(null),resolve(!1)}}),{prioritize:!0})}isAuthenticated(callback,opts={}){let isWebview=this.isWebview,{async=!1,prioritize=!1}=opts,runAuthCheck=(resolution=null)=>{let resolutionValid=resolution&&"function"==typeof resolution;var isAuthenticated;isWebview?(isAuthenticated=this.userProps.isAuthenticated,"function"==typeof callback&&callback(isAuthenticated),resolutionValid&&resolution(isAuthenticated)):this.foxProfileProvider.isAuthOrRefresh().then(isAuthenticated=>{this.userProps.isAuthenticated=isAuthenticated,"function"==typeof callback&&callback(isAuthenticated),resolutionValid&&resolution(isAuthenticated)}).catch(error=>{this.userProps.isAuthenticated=!1,"function"==typeof callback&&callback(!1),resolutionValid&&resolution(!1)})};this.AUTH_EXECUTIONER.executeMethod(()=>
8{if(async)return new Promise(resolve=>{runAuthCheck(resolve)});runAuthCheck()},{prioritize:prioritize})}tokenExchangeV3(opts={},callback){this.AUTH_EXECUTIONER.executeMethod(()=>new Promise(resolve=>{try{this.foxProfileProvider.tokenExchangeV3(opts).then(convertedTokens=>{callback&&"function"==typeof callback&&callback(convertedTokens),resolve(!0)}).catch(error=>{callback&&"function"==typeof callback&&callback(null),resolve(!1)})}catch(error){console.error("Error exchanging tokens:",error),resolve(!1)}}),{prioritize:!0})}getUserInfo(){return new Promise(resolve=>{this.foxProfileProvider.getUserInfo().then(userData=>{var{email,profileId}=userData||{};this.userProps.authProps={...this.userProps.authProps,email:email,profileId:profileId},resolve(userData)}).catch(error=>{resolve(null)})})}triggerGoogleFEDCM(){this.AUTH_EXECUTIONER.executeMethod(()=>{this.foxProfileProvider.getGoogleCredentials({autoSignIn:!1,mediation:"required"}).then(response=>{response=(response||{}).token;if(response)try{var tokenObject=JSON.parse(response),{id_token:idToken=""}=tokenObject;this.login({idToken:idToken},{})}catch(error){console.error("Error parsing Google FEDCM token:",error)}}).catch(error=>{console.error("Error getting Google FEDCM credentials:",error)})})}getUserFromCookie(){return new Promise(resolve=>{this.foxProfileProvider.getUserFromCookie().then(userData=>{this.userProps.authProps=userData,resolve(userData)}).catch(error=>{resolve(null)})})}refreshToken(){return new Promise(resolve=>{let runRefresh=()=>new Promise(executionResolve=>{this.foxProfileProvider.refreshToken().then(refreshedTokens=>{[refreshedTokens={}]=[refreshedTokens];var existingAuthProps,refreshedTokens=refreshedTokens&&"object"==typeof refreshedTokens&&(refreshedTokens={accessToken:refreshedTokens.accessToken||refreshedTokens.access_token,idToken:refreshedTokens.idToken||refreshedTokens.id_token,refreshToken:refreshedTokens.refreshToken||refreshedTokens.refresh_token},Object.values(refreshedTokens).some(Boolean))?refreshedTokens:null;refreshedTokens&&(existingAuthProps=this.userProps&&this.userProps.authProps?this.userProps.authProps:{},this.userProps={...this.userProps,isAuthenticated:!0,authProps:{...existingAuthProps,...refreshedTokens}}),resolve(refreshedTokens),executionResolve(!0)}).catch(error=>{console.error("Error refreshing authentication tokens:",error),resolve(null),executionResolve(!1)})});this.AUTH_EXECUTIONER.executeMethod(()=>runRefresh(),{prioritize:!0})})}setAuthStateCookie(authenticated){Cookie.set(AuthConfig.authStateCookieKey,(authenticated=authenticated??!1).toString(),{expires:365,domain:`.${domain}.com`,path:"/"},!0)}flushLegacyAuth(callback){AuthAPI.middleware(Middleware=>{Middleware.flushLegacyAuth(callback)})}webviewLogin(authData){var authData=authData.accessToken,isAuthenticated=!!authData,isAuthenticated=(this.setAuthStateCookie(isAuthenticated),{isAuthenticated:isAuthenticated,authProps:{accessToken:authData}});this.userProps=isAuthenticated,this.AUTH_EXECUTIONER.ready(),this.initialized=!0}flagFinancialIncentive(){let fi=LocalStorage.get(AuthConfig.financialIncentiveKey);return new Promise(resolve=>{"true"===fi?(LocalStorage.remove(AuthConfig.financialIncentiveKey),this.foxProfileProvider.setFlags({fi:!0}).then(()=>{resolve(!0)}).catch(()=>{resolve(!1)})):resolve(!1)})}update(opts={}){return new Promise((resolve,reject)=>{this.AUTH_EXECUTIONER.executeMethod(()=>{this.foxProfileProvider.update(opts).then(async()=>{try{var refreshedTokens=await this.refreshToken();resolve(refreshedTokens||!0)}catch(error){console.error("Error refreshing tokens after profile update:",error),resolve(!0)}}).catch(error=>{reject(error)})})})}}return new CentralizedLogin});
9Modulr.define("core.auth:models/fnnauth.broker",["require","jquery","config","fnc.isa","helper"],function(require,$,config,ISA,Helper){config=config.hostName;let root=window,callbacks={},iframeOrigin="https://"+config,queue=[],ready=!1,iframe=document.getElementById("xdchannel"),iframeLink=iframeOrigin+"/xd-channel.html?_x_auth=foxid&";function dispatch(event){if("fnnBrokerResponse"!==event.data.type)return!1;if(event.data.origin===window.location.protocol+"//"+window.location.host)if("ready"===event.data.name)for(ready=!0;0<queue.length;)iframe.contentWindow.postMessage(queue.shift(),iframeOrigin);else{-1<event.data.name.indexOf("-Broadcast")&&$(document).trigger("xd-channel-"+event.data.name.replace("-Broadcast",""),event.data.data);var cbs=callbacks[event.data.name]||[];for(callbacks[event.data.name]=[];0<cbs.length;)cbs.shift()(event.data.data)}}function startLogin(e){addCallback("startLogin",function(url){var hasTarget=null;try{hasTarget=e.target.hasAttribute("data-omtr-intcmp")}catch(error){}hasTarget?ISA.provider("internal.campaign",function(Provider){window.location.href=Provider.setHash(url,e.target.getAttribute("data-omtr-intcmp"))}):window.location.href=url}),sendMessage("startLogin",window.location.href)}function startLogout(callback){callback&&addCallback("startLogout",callback),sendMessage("startLogout",null)}function clearPasswordlessUser(callback){callback&&"function"==typeof callback&&addCallback("clearPasswordlessUser",callback),sendMessage("clearPasswordlessUser",null)}function FNNAuth(domainName){var refreshProfile=-1!==window.location.search.indexOf("refresh_profile_info=on");(iframe=document.createElement("iframe")).id="xdchannel",iframe.
9style.display="none",iframe.src=iframeLink+(refreshProfile?"refresh_profile_info=on&":""),document.body.appendChild(iframe),root.addEventListener("message",dispatch)}var addCallback=function(name,cb){callbacks[name]=callbacks[name]||[],callbacks[name].push(cb)},sendMessage=function(name,data,callback){data={name:name,data:data,type:"fnnBrokerRequest"};ready?(iframe.contentWindow.postMessage(data,iframeOrigin),callback&&"function"==typeof callback&&addCallback(name,callback)):queue.push(data)},grabAnonQueue=!(!window.FNC.anon||!window.FNC.anon.anon_fpid)&&{data:{anon_fpid:window.FNC.anon.anon_fpid()},name:"updateAnon"};return FNNAuth.prototype.initialize=function(callback){callback({startLogin:startLogin,startLogout:startLogout})},FNNAuth.prototype.sendMessage=sendMessage,FNNAuth.prototype.redirectURL=iframeOrigin,FNNAuth.prototype.addCallback=addCallback,FNNAuth.prototype.checkPendingRequest=function(callback){callback&&"function"==typeof callback&&addCallback("hasPendingPasswordless",callback),sendMessage("hasPendingPasswordless",null)},FNNAuth.prototype.startPasswordless=function(callback,options){if(options=options||{},callback&&"function"==typeof callback){let processCallbacks=response=>{response.data=response.data||{};var responseId=response.id||null,event=response.data.event||null,authed="authenticated"===event||!1;"poll:start"!==responseId&&"initialized"!==responseId&&"pending"!==event||addCallback("startPasswordless",processCallbacks),authed&&clearPasswordlessUser(),callback({authed:authed,response:response})};addCallback("startPasswordless",processCallbacks)}sendMessage("startPasswordless",options)},FNNAuth.prototype.clearPasswordlessUser=clearPasswordlessUser,FNNAuth.prototype.flushLegacyAuth=function(callback){callback&&"function"==typeof callback&&addCallback("flushLegacyAuth",callback),sendMessage("flushLegacyAuth",null)},FNNAuth.prototype.MODE_silentLogin=function(callback){addCallback("silentLogin",callback),grabAnonQueue&&sendMessage(grabAnonQueue.name,grabAnonQueue.data),sendMessage("silentLogin",null)},FNNAuth.prototype.getUserInfo=function(attrs,callback){addCallback("getUserInfo",callback),sendMessage("getUserInfo",attrs)},FNNAuth});
10Modulr.define("core.auth:models/middleware",["require","jquery","lodash","config","helper","models/fnnauth.broker","core.base:utils/localStorage","core.base:utils/cookie","core.plugins:EventMessageHandler","fnc.isa"],function(require,$,_,config,Helper){let hostName=config.hostName;var config=require("models/fnnauth.broker"),ISA=require("fnc.isa"),Auth=new config,config=require("core.plugins:EventMessageHandler"),Cookies=require("core.base:utils/cookie");let Events=new config;return new function(){var Proto=this,_props=null,_events=null;Proto.broker=Auth,Proto.getProps=function(){return _props},Proto.getEvents=function(){return _events},Proto.onLogin=function(cb){if(!cb&&"function"!=typeof cb)return!1},Proto.set=function(callback){"function"==typeof callback&&(Events.addHandler("myfoxAutoLogin",data=>{ISA&&ISA.track;data&&data.ename&&ISA.track(data.ename,data)}),Auth.initialize(function(events){Proto.isAuthenticated(function(props){Helper.log("is authenticated?",props.authenticated),_events=events,(_props=props).authenticated,Proto.updateAnon(props.anon),Proto.insertAnonSegments(props.anon),(props=>{props=props.authenticated,Cookies("UID_STATE",props,{expires:365,path:"/",domain:".foxnews.com"})})(props),callback({authenticated:props.authenticated,userInfo:props.userInfo,token:props.token,anon:props.anon,events:events})})}))},Proto.isAuthenticated=function(callback){Auth.checkPendingRequest(function(hasPending){hasPending.hasPendingPasswordless?Auth.startPasswordless(response=>{response.authed?((response=new URL(location.href)).searchParams.set("login","success"),location.assign(response.search)):Auth.MODE_silentLogin(function(props){callback(props)})}):Auth.MODE_silentLogin(function(props){callback(props)})})},Proto.updateAnon=function(loginState){loginState&&loginState.segment&&window.FNC.anon&&window.FNC.anon.updateAnon(!!loginState.segment.dcg_profile_id)},Proto.insertAnonSegments=function(propData){var fn;window.FNC.anon=window.FNC.anon||{},propData&&propData.segment&&(propData.segment.lastAnonymousProfileId="function"==typeof(fn=_.get(window.FNC,"anon.persist_fpid",null))?fn():null),ISA.anon.pushAnon(propData),window.leapmetrics.push(function(Leap){function cookieVals(key){Leap.cookieProps("get",key)}var traits={dcg_profile_id:(cookieVals("userProfileId"),""),lastAnonymousProfileId:(cookieVals("lastAnonymousProfileId"),cookieVals("persistAnonId"),window.localStorage.getItem("anon_fpid")||window.localStorage.getItem("persist_fpid")||propData&&propData.value||""),lastKnownProfileId:(cookieVals("lastKnownId"),cookieVals("userProfileId"),"")};Leap.callPage(traits)})},Proto.gotoPage=function(page){var url=null;(url="profile"===page?hostName:url)&&window.open("https://"+url,"_self")},Proto.logout=function(){alert("todo: logout")},Proto.getLegacyAuth=function(callback){"function"==typeof callback&&Auth.initialize(function(events){Proto.isAuthenticated(function(props){var{authenticated:props,userInfo,token}=props,refreshToken=userInfo?userInfo["https://foxnews.com/refresh_token"]:null;callback({refreshToken:refreshToken,authenticated:props,userInfo:userInfo,token:token})})})},Proto.flushLegacyAuth=function(callback){Auth.flushLegacyAuth(callback)}}});
11Modulr.define("core.auth:models/webview",["require","helper","core.plugins:AppWebviewEvents"],function(Require,Helper){let STORAGE_PREFIX=Helper.getStoragePrefix(),WV_TOKEN_KEY=Helper.getWebviewTokenKey();class WebviewAuth{constructor(onAuthCallback){return onAuthCallback&&"function"==typeof onAuthCallback?WebviewAuth.instance||((WebviewAuth.instance=this).accessToken=null,this.AppWebviewEvents=null,this.initialized=!1,this.onAuthCallback=onAuthCallback,this.storageListener=null,void(this.initialized||this.init())):null}init(){this.initWebviewEvents(),this.webviewLogin(),this.storageListener||this.registerStorageListener(this.webviewLogin.bind(this))}webviewLogin(){var accessToken=Helper.getWebviewAccessToken(),onAuthCallback=this.onAuthCallback;onAuthCallback&&"function"==typeof onAuthCallback&&onAuthCallback({accessToken:accessToken})}registerStorageListener(callback){window&&window.addEventListener&&(this.storageListener=window.addEventListener("storage",event=>{""+STORAGE_PREFIX+WV_TOKEN_KEY===event.key&&callback&&"function"==typeof callback&&callback()}))}initWebviewEvents(){var AppWebviewEvents;this.initialized||(AppWebviewEvents=Helper.getWebviewEvents(),(this.AppWebviewEvents=AppWebviewEvents).ready(),this.initialized=!0)}}return WebviewAuth});
12Modulr.define("core.auth:modules/login-handler",["require","lodash","core.templates:controls/api"],function(require,_){let Template=require("core.templates:controls/api");return new class{constructor(){var queryParams=new URLSearchParams(window.location.search);if(this.fbn=Boolean(window.location.hostname.match(/(foxbusiness)/g)),this.body=document.body,this.responseModal=null,this.successOrError=!1,this.display=["success","error"].includes(queryParams.get("login")),this.display){"success"===queryParams.get("login")&&(this.successOrError=!0),queryParams.delete("login");let adjustedParams=queryParams.toString();0<adjustedParams.length&&(adjustedParams="?"+adjustedParams),window.history.replaceState({},"",""+location.pathname+adjustedParams+location.hash)}this.userInfo=null}run(userInfo){this.display&&(this.userInfo=userInfo,this.renderModal())}renderModal(){Template.get("/static/orion/scripts/core/auth/app/templates/loginMessage.html",html=>{var site=this.fbn?"FOX Business":"FOX News",siteAbbr=this.fbn?"fb":"fn",html=_.template(html)({siteAbbr:siteAbbr,header:this.successOrError?"Success!":"Something went wrong",subtext:this.successOrError?`You are now logged in to ${site}.`:"Please try logging in again to continue."}),siteAbbr=document.createElement("div");siteAbbr.classList.add("login-response-modal"),siteAbbr.innerHTML=html,this.body.appendChild(siteAbbr),this.responseModal=siteAbbr,this.registerCloseEvent()})}registerCloseEvent(){document.querySelector(".login-response-modal .close-modal").addEventListener("click",e=>{e.preventDefault(),this.closeModal()})}closeModal(){this.responseModal&&this.responseModal.remove()}isSuccess(){return this.successOrError}}});
13Modulr.define("core.auth:modules/navbar",["require","core.auth:api"],function(require,AUTHAPI){class NavBar{constructor(){if(NavBar.instance)return NavBar.instance;(NavBar.instance=this).authTarget=document.querySelector("#account"),this.centralized=null,this.initialized=!1,this.initialized||this.init()}init(){if(!this.authTarget)return null;var centralized=AUTHAPI.centralized;centralized(Centralized=>{Centralized&&(this.centralized=Centralized).isAuthenticated(isAuthed=>{isAuthed?this.loggedIn():this.loggedOut()})})}getProfileMarkup(){return"oki"===document.body.getAttribute("data-theme")?`
14                    <a href="#" class="profile-link" aria-label="User Profile">Profile</a>
15                `:`
16                <div class="user-profile">
17                    <a href="#" class="avatar" aria-label="User Profile">
18                        <div class="m">
19                            <img src="https://static.foxnews.com/static/orion/styles/img/fox-news/auth0/auth0-default-profile-pic.png" data-user-field="picture" alt="User Avatar">
20                        </div>
21                    </a>
22                </div>
23            `}loggedIn(){var{authTarget,centralized}=this;authTarget&&centralized&&(authTarget.classList.add("logged-in"),authTarget.classList.remove("logged-out"),authTarget.innerHTML=this.getProfileMarkup(),centralized=authTarget.querySelector("a"))&&centralized.addEventListener("click",event=>{event.preventDefault(),this.centralized.manageAccount()})}loggedOut(){let{authTarget,centralized}=this;var loginButton;authTarget&&centralized&&(authTarget.classList.add("logged-out"),authTarget.classList.remove("logged-in"),loginButton=authTarget.querySelector(".user-profile.user-login.button"))&&(loginButton.classList.add("show"),loginButton=loginButton.querySelector(":scope > a.login"))&&loginButton.addEventListener("click",event=>{centralized.login({},{loginOrigin:"Log In Button in Header"})})}}return new NavBar});
24Modulr.define("core.auth:modules/navbar.legacy",["require","jquery","config","fnc.isa","core.auth:api","core.auth:modules/login-handler"],function(require,$,config){let triggerEvent="ontouchstart"in document.documentElement?"touchend":"click",LoginHandler=require("core.auth:modules/login-handler");var target=$("#account");let AUTH_API=require("core.auth:api");require=require("fnc.isa");let protocol=["htt","ps:"].join("");require.provider("eu").check(function(bool){bool?target.hide():window.FNC.core.noticias?$(".user-profile.user-login.button").removeClass("show"):AUTH_API.middleware(Middleware=>{Middleware.set(function(props){var markup;props.authenticated?(0!==target.length&&(markup=(markup='<div class="user-profile">                        <a href="#" class="avatar" aria-label="User Profile">                            <div class="m">                                <img src="${avatar}" data-user-field="picture" alt="User Avatar">                            </div>                        </a>                    </div>').replace("${avatar}",props.userInfo[protocol+"//foxnews.com/picture"]),target.addClass("logged-in").removeClass("logged-out").html(markup),target.find(".user-profile a.avatar").on("click",function(evt){evt.preventDefault(),Middleware.gotoPage("profile")})),LoginHandler.run(props.userInfo)):0!==target.length&&(target.addClass("logged-out").removeClass("logged-in"),target.find(".user-profile.user-login.button > a.login").on(triggerEvent,event=>{props.events.startLogin(event)}),-1<location.search.indexOf("launch_login_page=on"))&&props.events.startLogin(),$(".user-profile.user-login.button").addClass("show")})})})});
25((Modulr,FNC)=>
25{if(!Modulr.getInstance("core.auth")){try{var ref;"success"===new URLSearchParams(window.location.search).get("login")&&document.referrer&&(ref=new URL(document.referrer)).origin===window.location.origin&&"/callback"===ref.pathname&&sessionStorage.setItem("fn_braze_login_pending","1")}catch(e){}let config={instance:"core.auth",baseDomain:FNC.CDN.domain,baseUrl:"/static/orion/scripts/core/auth/app",masterFile:"/static/orion/scripts/core/utils/modulr/master.js",packages:["core.plugins"],shim:{jquery:{src:"/static/orion/scripts/core/utils/jquery/core.js",exports:"jQuery"},lodash:{src:"/static/orion/scripts/core/utils/lodash.js",exports:"_"},"akamai.geo":{src:"https://static.foxnews.com/static/orion/scripts/core/utils/geo.js",exports:"FNC.GEO"},ISA:{src:"//static.foxnews.com/static/isa/core.js",exports:"FNC.ISA"}}},initAuthAPI=()=>{var Instance=Modulr.config(config);Instance.define("cdn",function(){return FNC.CDN}),Instance.define("fnc.isa",["ISA"],function(){return FNC.ISA});let AUTH_API={middleware:function(callback){console.warn("AUTH_API.middleware is not available in an iframe."),"function"==typeof callback&&callback(null)}};var isParentFrame=window.self===window.top;window.FNC.core=window.FNC.core||{},window.FNC.core.auth=window.FNC.core.auth||{},isParentFrame&&Instance.require(["api"],API=>{API.initialize(),AUTH_API=API,window.FNC.core.auth=(()=>{var FOXID_API={FoxID:{}};if(AUTH_API){let ALLOWED_LEGACY_METHODS=["getFavorites","setFavorites","deleteFavorites","isLoggedIn","startPasswordless"],BROKER_LISTENERS=[];function sendBrokerMessage(message,messageData,callback){ALLOWED_LEGACY_METHODS.includes(message)&&AUTH_API.middleware(Middleware=>{let messageName="xd-channel-"+message;var existingListener=BROKER_LISTENERS.find(listener=>listener.name===messageName);if(existingListener)existingListener.callbacks.push(callback);else{let callbacks=[];existingListener={name:messageName,callbacks:callbacks,listener:window.jQuery(document).on(messageName,(event,data)=>{callbacks.forEach(callback=>{"function"==typeof callback&&callback(data)}),callbacks=[]})};callbacks.push(callback),BROKER_LISTENERS.push(existingListener)}Middleware.broker.sendMessage(message,messageData)})}FOXID_API.FoxID=new class{constructor(){this.api=AUTH_API}isAuthenticated(){return this.api.isAuthenticated()}login(opts={},trackingProps={}){this.api.login(opts,trackingProps)}manageAccount(){this.api.manageAccount()}startPasswordless(options,callback){this.api.middleware(Middleware=>{Middleware.broker.startPasswordless(callback,options)})}update(opts={}){return new Promise((resolve,reject)=>{this.api.update(opts).then(result=>{resolve(result)}).catch(error=>{reject(error)})})}getFavorites(callback){sendBrokerMessage("getFavorites","",callback)}setFavorites(favorites,callback){sendBrokerMessage("setFavorites",favorites,callback)}deleteFavorites(favorites,callback){sendBrokerMessage("deleteFavorites",favorites,callback)}isLoggedIn(callback){sendBrokerMessage("isLoggedIn","",callback)}redirectToLogin(){AUTH_API.middleware(function(Middleware){window.location=Middleware.broker.redirectURL})}}}return FOXID_API})();var event=new CustomEvent("FOXID_AUTH_READY");window.dispatchEvent(event),(API=>{window.addEventListener("message",function(event){var trackingProps,{data:event={}}=event;event&&"FOXID_INITIATE_LOGIN"===event.type&&({loginProps:event={},trackingProps={}}=event||{},API)&&"function"==typeof API.login&&API.login(event,trackingProps)})})(API)})};window?.FNC?.ISA?initAuthAPI():window.addEventListener("ISA_READY",function(event){initAuthAPI()},{once:!0})}})(window.Modulr,(window.FNC=window.FNC||{},window.FNC.CDN=window.FNC.CDN||(()=>{for(var type="prod",mode="new",found=null,scripts=document.getElementsByTagName("script"),regexNew=/^(http(s|)\:|)\/\/((dev-|stage-|)static\.fox(news|business)\.com)\//,regexOld=/^(http(s|)\:|)\/\/((qa\.|)\global\.fncstatic\.com)\//,regexOldStage=/^(http(s|)\:|)\/\/(v8-staging\.fox(news|business)\.com)\//,i=0;i<scripts.length;i++){var src=scripts[i].getAttribute("src")||"";if(found)break;src&&(regexNew.test(src)?found=src:regexOld.test(src)?(found=src,mode="fncstatic"):regexOldStage.test(src)&&(found=src,mode="v8-staging"))}var domain=(()=>{var res,host;if(found)switch(mode){case"fncstatic":res=found.match(regexOld)[3],type=checkTypeOld(res)||type;break;case"v8-staging":res=found.match(regexOldStage)[3],type="staging";break;default:res=found.match(regexNew)[3],type=checkTypeNew(res)||type}else host=window.location.hostname,regexNew.test(host)?type=checkTypeNew(res=host)||type:regexOld.test(host)?type=checkTypeOld(res=host)||type:regexOldStage.test(host)?(res=h
25ost,type="staging"):res="static.foxnews.com";return res;function checkTypeNew(val){var ret=null;return/^dev\-/.test(val)?ret="qa":/^stage\-/.test(val)&&(ret="staging"),ret}function checkTypeOld(val){var ret=null;return ret=/^qa\./.test(val)?"qa":ret}})(),env="relative"===type?"prod":type,domain="//"+domain;return{domain:window.FOX_ENV_STATIC_DOMAIN=domain,env:window.FOX_ENV_STATIC=env}})(),window.FNC));

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.