1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7190],{11048:(e,t,a)=>{"use strict";a.d(t,{default:()=>P});var n=a(95155),i=a(12115),r=a(62064);let o={PERMISSION:{DEFAULT:"default",DENIED:"denied",GRANTED:"granted"},WEB_ALERT_STORAGE_NAME:"webAlertPermission",WEB_ALERT_PROVIDER_STORAGE_NAME:"webAlertProvider",TTL:{ACCEPT:99999,DECLINE:30},ONE_SIGNAL:"one-signal"},{WEB_ALERT_STORAGE_NAME:c,PERMISSION:s}=o,l=async e=>{let t=void 0!==window.localStorage,a=`${c}:${e}`,n=t&&localStorage.getItem(a),{expiry:i,permission:r}=n?JSON.parse(n):"",o=r===s.GRANTED,l=new Date().getTime();return i&&i<l&&t||n&&o&&"denied"===("Notification"in window&&Notification.permission)&&t?(localStorage.removeItem(a),!1):!!n};var d=a(4831),u=a(772),m=a(50399),p=a(95404);let E=(e,t="airship")=>{let a=void 0!==window.localStorage,n=JSON.parse(a&&localStorage.getItem(t)||"[]"),i=new Date().getTime(),r=n.filter(e=>e.expiry>i);if(e.length){let t=new Date,a=new Date(t);a.setDate(t.getDate()+3);let n={message:e,expiry:a.getTime()};r.push(n)}a&&localStorage.setItem(t,JSON.stringify(r))},g=(e,t,a)=>{let n=void 0!==window.localStorage,i=new Date,r=new Date(i);r.setDate(i.getDate()+a);let o={permission:t,expiry:r.getTime()};n&&localStorage.setItem(e,JSON.stringify(o))},w=async(e,t,a)=>{let n=await Notification.requestPermission();return t("WEB_ALERTS:BROWSER_PROMPT_DISPLAYED",{linkURL:e,componentID:"",componentText:"",...a}),n===o.PERMISSION.GRANTED&&(t("WEB_ALERTS:BROWSER_PROMPT_ALLOWED",{linkURL:e,componentID:"",componentText:"",...a}),window.feliz.click("web-alert-notification",0,0,{})),n===o.PERMISSION.DENIED&&(t("WEB_ALERTS:BROWSER_PROMPT_BLOCKED",{linkURL:e,componentID:"",componentText:"",...a}),window.feliz.click("web-alert-notification-close",0,0,{})),n},{WEB_ALERT_STORAGE_NAME:S,PERMISSION:_,TTL:f,ONE_SIGNAL:T}=o,h=async(e,t,a,n)=>e===_.DEFAULT&&await w(t,a,n)===_.GRANTED,b=async(e,t,a,n,i,r,c)=>{E("-- Subscribing to OneSignal --",T);let s=await window.OneSignal;if(s){s.setConsentGiven(!0);let l=()=>{let e={[i]:"true"};return c&&(e.is_premium_user="true"),e},d="Notification"in window?Notification.permission:null;if(!d||d===_.DENIED)return;if(d===_.GRANTED||await h(d,t,a,n)){s.User?.addEventListener("change",c=>{c.current.onesignalId&&(E(`OneSignal channel created. ID: ${c.current.onesignalId}`,T),void 0!==window.localStorage&&localStorage.setItem(o.WEB_ALERT_PROVIDER_STORAGE_NAME,T),s.User?.addTags(l()),g(`${S}:${e}${r}`,_.GRANTED,f.ACCEPT),a("WEB_ALERTS:WEB_ALERT_SUBSCRIBE_SUCCESS_OS",{linkURL:t,componentID:"",componentText:"",...n}),E(`OneSignal tag added: ${i}`,T))});try{s.User?.onesignalId?(s.User?.addTags(l()),g(`${S}:${e}${r}`,_.GRANTED,f.ACCEPT),a("WEB_ALERTS:WEB_ALERT_SUBSCRIBE_SUCCESS_OS",{linkURL:t,componentID:"",componentText:"",...n}),E(`OneSignal new tag added: ${i}`,T)):s.Notifications.requestPermission()}catch(e){a("WEB_ALERTS:WEB_ALERT_SUBSCRIBE_FAIL_OS",{linkURL:t,componentID:"",componentText:"",...n})}}}};var A=a(79712),y=a(16528),R=a(83391),v=a(18692),D=a(50910),L=a(64187),N=a.n(L);let I=({publicationName:e,onClose:t,subscribe:a,iconUrl:i})=>{let r=(0,D.c3)("components.molecules.WebAlert");return(0,n.jsx)("div",{className:N()["web-alert-main-container"],children:(0,n.jsxs)("div",{className:N()["web-alert-container"],"data-testid":"WebAlert",children:[(0,n.jsx)(R.default,{src:i,width:48,height:48,alt:e}),(0,n.jsx)(y.A,{children:r("message",{publicationName:e})}),(0,n.jsx)(v.A,{design:"primary",label:r("submit"),dataTestId:"submit",tracking:{dataTmDataTrack:"web-alert-subjective"},onClick:a}),(0,n.jsx)(v.A,{design:"white",label:r("cancel"),dataTestId:"cancel",tracking:{dataTmDataTrack:"web-alert-subjective-close"},onClick:t})]})})},C={showModal:!1,segmentScope:"",segmentTag:"",popupTitle:"",iconName:"",iconUrl:""};function O(e,t){switch(t.type){case"SET_DATA":return{...e,...t.payload};case"SET_ICON_URL":return{...e,iconUrl:t.payload};case"SHOW_MODAL":return{...e,showModal:!0};case"HIDE_MODAL":return{...e,showModal:!1};default:return e}}let k=()=>{},P=function({publication:e,webAlertsConfig:t,tags:a,webAlertsOneStepEnabled:c=!1}){let s=(0,i.useRef)(""),E=(0,i.useRef)(""),[w,S]=(0,i.useReducer)(O,C),{showModal:_,segmentScope:f,segmentTag:T,popupTitle:h,iconName:y,iconUrl:R}=w,{WEB_ALERT_STORAGE_NAME:v,PERMISSION:D,TTL:L}=o,N=(0,A.w)(e=>e.actions.clickEvent),P=(0,A.w)(e=>e.state.client.analytics),B=((e,t,a)=>{let{notification:n}=(0,d.Z)(e=>({notification:e?.state?.client.webAlert?.notification})),[o,c]=(0,i.useState)(!1),[s,m]=(0,i.useState)(!1),[p,E]=(0,i.useState)(!0),[g,w]=(0,i.useState)(!1),[S,_]=(0,i.useState)(!1),[f,T]=(0,i.useState)(!1),h=(0,i.useRef)(!1),b=(0,u.v0)(e=>e),A=(0,r.ms)(b),y=(0,i.useCallback)(()=>
1{if(!h.current){let e;((e=document.documentElement.scrollHeight-window.innerHeight)>200&&window.scrollY>200||e<=200||0)&&(T(!0),h.current=!0)}},[]);return(0,i.useEffect)(()=>{let e=!0,t=async()=>{let a=await window.OneSignal;e&&a&&(c(!0),window.removeEventListener("web.alerts.sdk.snippet.loaded",t))};return window.addEventListener("web.alerts.sdk.snippet.loaded",t),t(),()=>{e=!1,window.removeEventListener("web.alerts.sdk.snippet.loaded",t)}},[o,A]),(0,i.useEffect)(()=>{let n=async()=>{E(await l(e))};a&&t&&o&&n()},[e,o,t,a]),(0,i.useEffect)(()=>{_(!!n)},[n]),(0,i.useEffect)(()=>{let e="Notification"in window&&Notification.permission;w(!!e&&"denied"!==e)},[]),(0,i.useEffect)(()=>(y(),window.addEventListener("scroll",y,{passive:!0}),()=>window.removeEventListener("scroll",y)),[y]),(0,i.useEffect)(()=>{!p&&g&&S&&f&&A?m(!0):m(!1)},[p,g,S,f,A]),s})(`${s.current}${f}`,T,f),{isPremium:x}=(0,m.A)();(0,i.useEffect)(()=>{let{hostname:e,href:t}=window.location;return s.current=`${e}`,E.current=t,()=>{s.current=null,E.current=null}},[]),(0,i.useEffect)(()=>{let{segments:e}=t,n=()=>{S({type:"SET_DATA",payload:{popupTitle:t.defaultTitle,segmentScope:t.defaultScope,segmentTag:t.defaultSegmentName,iconName:t.defaultIcon}})};if(!e||!e.length||h){h||n();return}let i=e.filter(e=>a.some(t=>e.tag===t.name)).map(e=>{let t=a.find(t=>e.tag===t.name);return{...e,isPrimary:t?.isPrimary}}),r=window.location.href,o=e.filter(e=>r.includes(e.scope));if(i.length){let e=i.filter(e=>e.isPrimary);e.length?S({type:"SET_DATA",payload:{popupTitle:e[0].title,segmentScope:e[0].scope,segmentTag:e[0].segmentName,iconName:e[0].icon}}):S({type:"SET_DATA",payload:{popupTitle:i[0].title,segmentScope:i[0].scope,segmentTag:i[0].segmentName,iconName:i[0].icon}})}else o.length?S({type:"SET_DATA",payload:{popupTitle:o[0].title,segmentScope:o[0].scope,segmentTag:o[0].segmentName,iconName:o[0].icon}}):n()},[h,a,t]),(0,i.useEffect)(()=>{y&&!R&&S({type:"SET_ICON_URL",payload:`/assets/${e}/logos/web-alerts/web-alert-${y}.png`})},[y,R,e]);let U=(0,i.useRef)(!1);(0,i.useEffect)(()=>{if(!U.current&&B&&h&&f&&R&&y){if(U.current=!0,c)return void b(s.current,E.current,N,P,T,f,x);S({type:"SHOW_MODAL"}),N("WEB_ALERTS:REACH_PROMPT_DISPLAYED",{componentTitle:"",linkURL:E.current,...P})}},[B,h,f,R,y,c,N,P,T,x]);let j=(0,i.useCallback)(()=>{g(`${v}:${s.current}${f}`,D.DENIED,L.DECLINE),N("WEB_ALERTS:REACH_PROMPT_DECLINED",{componentTitle:"",linkURL:E.current,...P}),S({type:"HIDE_MODAL"})},[v,D,L,f,N,P]),W=(0,i.useCallback)(()=>{b(s.current,E.current,N,P,T,f,x),N("WEB_ALERTS:REACH_PROMPT_ACCEPTED",{componentTitle:"",linkURL:E.current,...P}),S({type:"HIDE_MODAL"})},[N,P,T,f,x]);return _&&_?(0,n.jsx)(p.A,{"data-testid":"web-alert-modal",onClose:k,outsideClickClose:!1,preventBodyScroll:!1,children:(0,n.jsx)(I,{"data-testid":"web-alert-component",iconUrl:R,onClose:j,publicationName:h,subscribe:W})}):null}},15125:(e,t,a)=>{"use strict";a.d(t,{P3:()=>i,ab:()=>r,mH:()=>n,zd:()=>o});let n="https://static.chartbeat.com/js/chartbeat.js",i="https://static.chartbeat.com/js/chartbeat_mab.js",r="https://static.chartbeat.com/js/chartbeat_video.js",o="https://static.chartbeat.com/js/subscriptions.js"},16528:(e,t,a)=>{"use strict";a.d(t,{A:()=>o});var n=a(95155),i=a(76679),r=a.n(i);let o=({children:e,dataTestId:t,className:a,contentType:i,dataTmDataTrack:o,dataTmdatatrackType:c})=>{let s=`${r()["paragraph-text"]}${a?` ${a}`:""}`;return"opinion"===i&&r()["drop-cap"]&&(s+=` ${r()["drop-cap"]}`),(0,n.jsx)("p",{className:s,"data-testid":t||null,"data-tmdatatrack":o,"data-tmdatatrack-type":c,children:e})}},22607:(e,t,a)=>{"use strict";a.d(t,{default:()=>c});var n=a(95155),i=a(12115),r=a(79712),o=a(76203);let c=function({children:e}){let t,a,c=(t=(0,r.w)(e=>e.actions.clickEvent),a=(0,r.w)(e=>{let t=e.state.client.analytics;return{articleType:t?.articleType,pageDomain:t?.pageDomain,pagescreenType:t?.pagescreenType,pageSection:t?.pageSection,pagesecondarySection:t?.pagesecondarySection,pagetertiarySection:t?.pagetertiarySection}}),(0,i.useCallback)(e=>{let n=e.target.closest("[data-analytics]");if(!n)return;let i=n.getAttribute("data-analytics");try{let{event:e,...n}=JSON.parse(i);t(e,{...n,...a,eventTriggeredURL:window.location.href})}catch(e){(0,o.A)().warn({err:e,analyticsDataJson:i},"Failed to parse data-analytics JSON")}},[t,a]));return(0,n.jsx)("div",{onClick:c,role:"presentation",style:{display:"contents"},children:e})}},29317:(e,t,a)=>{"use strict";a.d(t,{default:()=>o});var n=a(95155),i=a(64018),r=a(15125);let o=({configData:e})=>{let{chartbeatUid:t,domainName:a,sections:o}=e;return(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(i.default,{domain:a,chartbeatUid:t,sections:o,authors:"",title:"",path:"",chartbeatSrc:r.mH,chartbeatMabSrc:r.P3})})}},50399:(e,t,a)=>{"use strict";a.d(t,{A:()=>r});var n=a(12115),i=a(29549);function r(){let e="1"===(0,i.Ay)("_pc_is-premium","0").value,[t,a]=(0,n.use
1State)(e),r=(0,n.useCallback)(e=>{e?.detail&&"boolean"==typeof e.detail.isPremium&&a(e.detail.isPremium)},[]);return(0,n.useEffect)(()=>(window.addEventListener("auth-ui.pianoPremiumStatusChanged",r),()=>{window.removeEventListener("auth-ui.pianoPremiumStatusChanged",r)}),[r]),{isPremium:t,setIsPremium:a}}},52325:e=>{e.exports={modal:"Modal_modal__CkaTg","modal-bottom-aligned":"Modal_modal-bottom-aligned__UBA4w"}},64018:(e,t,a)=>{"use strict";a.d(t,{default:()=>s});var n=a(12115),i=a(62064),r=a(772),o=a(65242),c=a(29549);let s=function({chartbeatUid:e,chartbeatSrc:t,chartbeatMabSrc:a,chartbeatConversionSrc:s,domain:l,sections:d="",authors:u="",title:m="",path:p=""}){var E;let g=(0,r.v0)(e=>(0,i.ms)(e)),w=(0,r.v0)(e=>(0,i.aD)("chartbeat")(e)),{isAuthenticated:S}=(0,o.T)(e=>({isAuthenticated:e.state.client.isAuthenticated})),_=(0,c.Ri)("_pc_is-premium"),f=(E=_&&"1"===_,S?E?"paid":"lgdin":"anon");return(0,n.useEffect)(()=>{let n,i;if(!g)return;let r=window._sf_async_config=window._sf_async_config||{};r.uid=e,r.domain=l,r.flickerControl=!1,r.useCanonical=!0,r.useCanonicalDomain=!0,r.sections=d,r.authors=u,r.title=m,r.path=p,r.noCookies=!w,(window._cbq=window._cbq||[]).push(["_acct",f]);let o=document.getElementById("chartbeat-script");o&&o.remove();let c=document.getElementById("chartbeat-conversion-script");if(c&&c.remove(),(n=document.createElement("script")).type="text/javascript",n.async=!0,n.src=t,n.id="chartbeat-script",n.setAttribute("data-testid","chartbeat-script"),document.head.appendChild(n),(i=document.createElement("script")).type="text/javascript",i.async=!0,i.id="chartbeat-conversion-script",i.setAttribute("data-testid","chartbeat-conversion-script"),s&&(i.src=s,document.head.appendChild(i)),a){let e,t=document.getElementById("chartbeat-mab-script");t&&t.remove(),(e=document.createElement("script")).type="text/javascript",e.async=!0,e.id="chartbeat-mab-script",e.setAttribute("data-testid","chartbeat-mab-script"),a&&(e.src=a),document.head.appendChild(e)}return()=>{let e=document.getElementById("chartbeat-script");e&&e.remove();let t=document.getElementById("chartbeat-conversion-script");if(t&&t.remove(),a){let e=document.getElementById("chartbeat-mab-script");e&&e.remove()}}},[g,w,e,t,a,s,l,d,u,m,p,f]),null}},64187:e=>{e.exports={"web-alert-main-container":"WebAlert_web-alert-main-container__ysEvW","web-alert-container":"WebAlert_web-alert-container__TOmlw"}},76679:e=>{e.exports={"paragraph-text":"Paragraph_paragraph-text__PVKlh"}},95404:(e,t,a)=>{"use strict";a.d(t,{A:()=>c});var n=a(95155),i=a(12115),r=a(52325),o=a.n(r);let c=({onClose:e,outsideClickClose:t,preventBodyScroll:a,bottomAlign:r,overRideStyles:c,...s})=>{let l=t=>{let a=document.getElementById("modal");a?.contains(t.target)||e?.()};return(0,i.useEffect)(()=>(a&&(document.body.style.height="100%",document.body.style.overflow="hidden"),t&&e&&document.addEventListener("click",l),()=>{t&&e&&document.removeEventListener("click",l),a&&(document.body.style.overflow="auto",document.body.style.height="auto")}),[a,t]),r?(0,n.jsx)("div",{id:o()["modal-bottom-aligned"],className:c,"data-testid":"pop-up-modal",...s,children:s.children}):(0,n.jsx)("div",{id:o().modal,...s,"data-testid":"pop-up-modal",children:s.children})}}}]); 2//# sourceMappingURL=7190-a76d5e16740a3f8f.js.map
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.