!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["fast-path"]=t():e["fast-path"]=t()}(this,(()=>(()=>{"use strict";var e={r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=1;tthis.logLevelLimit&&o&&r>o||this.isProd&&!o||console[e](this.prefix,new Date(Date.now()).toISOString(),...t)}logError(e,t,r){var n;const o=r||new Error(t);console.error(this.prefix,new Date(Date.now()).toISOString(),e,t,o),this.isGreaterThanStg&&(null===(n=window.newrelic)||void 0===n||n.noticeError(o,{errorGroup:e,applicationCaller:"fortressClient",displayMessage:t}))}}({isProd:!0,isGreaterThanStg:!0,prefix:"[FORTRESS]"});function w(e,...t){f.log(e,...t)}const g=function(){return"www.bloomberg.com"===window.location.hostname},p=e=>{try{return window.localStorage.getItem(e)}catch(e){return null}},h=e=>{try{window.localStorage.removeItem(e)}catch(t){throw new Error(`Error removing key: ${e} from localStorage`)}},m=(e,t)=>{const r=p(e);if(!r)return null;const n=p(t);if(!n||(e=>{const t=new Date(e).getTime();return!!isNaN(t)||t<=Date.now()})(n))return h(e),h(t),null;try{return JSON.parse(r)}catch(e){return null}},E=()=>{var e;let t;const r=m("__$$user-data","__$$user-data-expiry");try{t=JSON.parse(n.get(o))}catch(e){}try{if(r&&Object.keys(r).length>0){if(!((e,t)=>{if(!e&&!t)return!0;if(!e||!t)return!1;if(e.status!==t.status)return!1;if(e.linkedAccounts!==t.linkedAccounts)return!1;const r=e.newsletterIds||[],n=t.newsletterIds||[];if(r.length!==n.length)return!1;for(let e=0;e{const e=E();if(!g()){const e=new URL(window.location.href).searchParams.get("mockSub");if("bbg"===(null==e?void 0:e.toLowerCase()))return(new Set).add(i.BLOOMBERG_DIGITAL);if("newsletter"===(null==e?void 0:e.toLowerCase()))return(new Set).add(i.NEWSLETTER);if("bw"===(null==e?void 0:e.toLowerCase()))return(new Set).add(i.BUSINESSWEEK_DIGITAL)}return(null==e?void 0:e.subscriptionsData)?e.subscriptionsData.reduce(((e,{entitlements:t})=>(t&&t.forEach((t=>e.add(t))),e)),new Set):new Set},b=e=>[i.BLOOMBERG_ALL,i.BLOOMBERG_DIGITAL].some((t=>e.has(t))),v=e=>[i.BUSINESSWEEK_DIGITAL,i.BUSINESSWEEK_PRINT,i.BUSINESSWEEK_ZINIO].some((t=>e.has(t))),I=()=>{var e;const t=E();return(null==t?void 0:t.subscriptionsData)&&(null===(e=t.subscriptionsData.filter((e=>"NEWSLETTER"===e.product))[0])||void 0===e?void 0:e.features)||[]},L=()=>{let e;if(!g()){const e=new URL(window.location.href).searchParams.get("mockUserStatus");if(e)return e}try{e=JSON.parse(n.get(o))}catch(e){}if(e)return e.status},T=()=>{if(!g()&&new URL(window.location.href).searchParams.get("mockSub"))return!0;return!!E()&&"logged_in"===L()},R=(e,t,r,n,o)=>b(e)||((e,t,r,n)=>v(e)&&(t===s||r===s||n===s))(e,t,r,n)||(e=>{if(0===e.length)return!1;const t=I();return 0!==t.length&&(w("info",`Comparing if any of the newsletters in ${e} are in ${t}`),Boolean(e.find((e=>t.includes(e)))))})(o);const y=e=>!g()&&new URL(window.location.href).searchParams.get("showPaywall")===e,A=()=>"milk"!==n.get("tagalong")&&!y("true")&&!function(){const e=new URL(window.location.href).searchParams;return null!==e.get("abbaPreview")&&null===e.get("accesslistMembership")}()&&(!((g()||"milk"!==n.get("samoa"))&&!y("false"))||!!n.get("_accesslist-membership")),C=e=>{var t;if("undefined"!=typeof window){if("true"===new URLSearchParams(window.location.search).get("mockIsMetered"))return!1}if(window.location.pathname.includes("/press-releases/"))return!0;if(e&&!e.contentId)return!0;if(null==e?void 0:e.contentAccess){const{contentAccess:t}=e;return!(e=>{const{restrictAccessDate:t}=e;return!t||new Date(t).getTime()<(new Date).getTime()})(t)&&"SUBSCRIBER"!==t.openAccessLevel&&("REGISTERED"!==t.openAccessLevel||T())}return!(null==e?void 0:e.archived)&&!(null==e?void 0:e.premium)&&(!1===(null===(t=null==e?void 0:e.metadata)||void 0===t?void 0:t.isMetered)&&!e.metadata.registrationWall)},D=()=>n.get("_breg-uid"),k=["/graphics/","/features/","/billionaires/","/business-schools/"];function O(e){return function(e){return k.some((t=>e.pathname.startsWith(t)))}(e)?e.href.includes("/jp/"):"/jp"===e.pathname||e.pathname.startsWith("/jp/")}const U=e=>{if(!e)return!1;if("string"!=typeof e.locale)return!1;const t=e.locale.toLowerCase();return"en"!==t&&"ja"!==t&&(!O(new URL(window.location.href))||(r=d.japanWall,n=`Japanese content accessed with non-JP locale: ${t}`,f.logError(r,n,o),!1));var r,n,o},B={runChecks:e=>{var t,r,n;w("info",`article info in fast path is ${JSON.stringify(e)}`);return U(e)||R(S(),(null==e?void 0:e.brand)||"",(null==e?void 0:e.franchise)||"",(null===(t=null==e?void 0:e.metadata)||void 0===t?void 0:t.cobrand)||"",(null===(n=null===(r=null==e?void 0:e.metadata)||void 0===r?void 0:r.collections)||void 0===n?void 0:n.newsletterEntitlements)||[])||A()||l.includes(window.navigator.userAgent.toLowerCase())||C(e)?"allow":"indeterminate"}},N=e=>{window.fastPath&&(window.fastPath.result=e)};return window.performance||Object.defineProperty(window,"performance",{value:{mark:()=>{},now:()=>0,getEntriesByName:()=>[]},writable:!1}),window.fastPath={evaluate(e,t){w("info","Running evaluate from fast-path-456");const r=B.runChecks(null==t?void 0:t.articleInfo);var n;w("info",`fast-path result is ${r}`),w("info","",n="fortress: fast-path decision made"),performance.mark(n),r&&"indeterminate"!==r?function(e,t){N(e),t(e,{isUsingOverlay:"block"===e})}(r,e):N(r)}},t})()));