(()=>{"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(t){var o=function(t,o){if("object"!=e(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,o||"default");if("object"!=e(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===o?String:Number)(t)}(t,"string");return"symbol"==e(o)?o:o+""}function o(e,o,n){return(o=t(o))in e?Object.defineProperty(e,o,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[o]=n,e}const n="__DEBUG__",r=["Registration is a free and easy way to support our truly independent journalism"];const i="ssr-auth-state";let c=function(e){return e.GDPR="gdpr",e.USNAT="usnat",e.IOS14="ios14",e.CUSTOM="custom",e}({}),a=function(e){return e[e.CONTINUE_WITHOUT_AGREEING=1]="CONTINUE_WITHOUT_AGREEING",e[e.OPT_IN=2]="OPT_IN",e[e.VIEW_IFRAME=4]="VIEW_IFRAME",e[e.REDIRECT=5]="REDIRECT",e[e.MICRO_PAYMENT=7]="MICRO_PAYMENT",e[e.CUSTOM_JS=9]="CUSTOM_JS",e[e.WELECT_VIDEO=10]="WELECT_VIDEO",e[e.ACCEPT_ALL=11]="ACCEPT_ALL",e[e.VIEW_PRIVACY_MANAGER=12]="VIEW_PRIVACY_MANAGER",e[e.REJECT_ALL=13]="REJECT_ALL",e[e.SAMBA_VIDEO=14]="SAMBA_VIDEO",e[e.DISMISS=15]="DISMISS",e}({});const s="uk",l="cmp-choice";const u=function(){window.dataLayer=window.dataLayer||[],window.dataLayer.push(arguments)},d=(e,t)=>u("event",e,t),p="indy",f=`${p}:ga4Loaded`,g=e=>{window.__GA4__READY?e():document.body.addEventListener(f,e)},_=e=>{g(()=>{d("cookiebanner_click",{link_label:e.label})})};function y(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,n)}return o}function w(e){for(var t=1;t(((e,t={})=>{const o=JSON.stringify(t,null,2),n=o.split("\n").reduce((e,t)=>t.length>=e?t.length:e,0),r=e.length,i=Math.max(r,n),c=` ${e.padEnd(i)} `,a=o.split("\n").map(e=>` ${e.padEnd(i)} `),s=a.length>1?`%c${a.slice(0,1)}\n%c${a.slice(1,-1).join("\n")}\n%c${a.slice(-1)}\n`:`%c${a[0]}\n`,l=a.length>1?["font-family:monospace; background: #333; color: #eee; padding-top: 5px;","font-family:monospace; background: #333; color: #eee;","font-family:monospace; background: #333; color: #eee; padding-bottom: 10px; border-radius: 0 0 6px 6px"]:["font-family:monospace; background: #333; color: #eee; padding-top: 5px; padding-bottom: 10px; border-radius: 0 0 6px 6px"];console.log(`%c${c}\n${s}`,"font-family:monospace; background: #333; color: #eee; border-bottom: 1px solid #666; padding: 5px 0; border-radius: 6px 6px 0 0",...l)})(`CustomEvent: ${e}`,t),new CustomEvent("analytics-trigger",{detail:{data:w({},t),eventName:e}})),m=(e,t)=>{return o=b(e,t),void document.body.dispatchEvent(o);var o};const O=(e={})=>m("sourcepoint_cmp_click",e),v=e=>{sessionStorage.setItem(l,`${e}`)},E=(e,t)=>{const o=sessionStorage.getItem(l)===`${e}`;return o&&(sessionStorage.removeItem(l),O(t),_(t)),o};let P=function(e){return e.ACCEPT_ALL="Accept All",e.REJECT_ALL="Reject All",e.LOG_IN="Log In",e.PRIVACY_POLICY="Privacy Policy",e.PRIVACY_MANAGER="Privacy Manager",e}({});const h="AUTHENTICATED";const S=(e,t=null)=>{var o,n;const r=`; ${document.cookie}`.split(`; ${e}=`);return 2===r.length?decodeURIComponent(null!==(o=null===(n=r.pop())||void 0===n?void 0:n.split(";").shift())&&void 0!==o?o:""):t},A="/login",I={foreground:31,background:41,light:"#AA0000",dark:"#ed4e4c"},j={foreground:33,background:43,light:"#AA5500",dark:"#d2c057"},C="light",R="dark",T=e=>e===n?"":`[${e.replace(/^_+|_+$/g,"")}]`,D=e=>`color: ${e};`,M=e=>("undefined"==typeof window||"function"!=typeof window.matchMedia?C:window.matchMedia("(prefers-color-scheme: dark)").matches?R:C)===R?e.dark:e.light,N=new Map,L=e=>{if("undefined"==typeof window)return"prod"!=={NODE_ENV:"production",npm_config_domain:""}.SERVER;if(!N.has(e)){var t;const o=new URLSearchParams(null===(t=window)||void 0===t||null===(t=t.location)||void 0===t?void 0:t.search);N.set(e,o.has(e))}return N.get(e)||"true"===S(e)};function k(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,n)}return o}let U;let x=0;const G=()=>{return"undefined"!=typeof window&&(void 0===U&&(U=!0===(null===(e=window.JSGlobals)||void 0===e||null===(e=e.featureFlags)||void 0===e?void 0:e.feat__sentry)),U);var e},$=(e,t)=>{const r=()=>L(n)||L(e),i=(e,n)=>{const r=t.filter(({tag:e})=>""!==e);if(0===r.length)return e;const i=r.map(({tag:e,color:t})=>{const r=null!=n?n:t,i=void 0!==r;return function(e){for(var t=1;te+t,""),u=i.filter(e=>"style"in e).map(({style:e})=>e);if("string"==typeof c){return"string"==typeof a&&a.includes("color")&&c.startsWith("%c")?[`${l} ${c}`,...u.concat(a),...s]:[l,...u,c,...e.slice(1)]}return[l,...u,...e]};return{log:(...e)=>{r()&&console.log(...x>0?e:i(e))},info:(...e)=>{r()&&console.info(...x>0?e:i(e))},group:(...e)=>{r()&&(console.group(...i(e)),x+=1)},groupCollapsed:(...e)=>{r()&&(console.groupCollapsed(...i(e)),x+=1)},groupEnd:(...e)=>{r()&&(x=Math.max(0,x-1),console.groupEnd(...e))},table:(...e)=>{r()&&console.table(...e)},warn:(...e)=>{var t;r()&&console.warn(...i(e,M(j))),G()&&(null===(t=window.Sentry)||void 0===t||t.captureException(...e))},error:(...e)=>{var t;r()&&console.error(...i(e,M(I))),G()&&(null===(t=window.Sentry)||void 0===t||t.captureException(...e))},extend:(o,n)=>$(e,[...t,{tag:o,color:n}]),logDate:e=>e.toLocaleString("en-GB",{timeZone:"UTC"})}},V=(({flagName:e,tagSegment:t={}})=>{const{tag:o,color:n}=t;return $(e,[{tag:null!=o?o:T(e),color:n}])})({flagName:n}),{log:J,info:Y,warn:W,error:F,group:B,groupEnd:H,logDate:q}=V;let Z;function z(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,n)}return o}function K(e){for(var t=1;t{try{const t=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),o=decodeURIComponent(atob(t));return JSON.parse(o)}catch(e){return null}};function X(){if(void 0===globalThis.window)return null;const e=(()=>{var e;const t=null!==(e=S("esi_auth"))&&void 0!==e?e:"";return Q(t)})();if(!e)return null;const{email:t,given_name:o,family_name:n,userStatus:r,pUid:i,exp:c,isAdFreeUser:a,isActiveRecurringDonator:s,adFreeExpiryTimestamp:l,recurringDonatorExpiryTimestamp:u,permutiveId:d}=e;return{email:t,givenName:o,familyName:n,userStatus:r,uid:i,exp:c,isAdFreeUser:a,isActiveRecurringDonator:s,adFreeExpiryTimestamp:l,recurringDonatorExpiryTimestamp:u,permutiveId:d}}var ee;function te(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,n)}return o}const oe=Math.random().toString(36).slice(2),ne={status:"ANONYMOUS",loading:!1,__id__:oe},re=function(e){let t=e;const o=new Set;return{get:()=>t,set:e=>{t=e,o.forEach(e=>e(t))},patch:e=>{t=K(K({},t),e),o.forEach(e=>e(t))},subscribe:e=>(o.add(e),()=>o.delete(e))}}(null!==(ee="undefined"!=typeof window?function(e=document){if(void 0===e)return null;if(void 0!==Z)return Z;const t=e.getElementById(i),o=null==t?void 0:t.textContent;let n=null;try{if(!o)throw new Error("No auth snapshot found in DOM");n=JSON.parse(atob(o))}catch(e){J(e)}finally{var r;null===(r=document.getElementById(i))||void 0===r||r.remove()}return Z=n,n}(document):void 0)&&void 0!==ee?ee:ne),ie={__id__:oe,get:re.get,subscribe:re.subscribe,actions:{set:re.set,patch:re.patch,login:e=>{re.patch({loading:!0});const t=new URL(A,window.location.origin);e&&t.searchParams.set("returnPath",e),window.location.href=t.toString()},logout:async()=>{re.patch({loading:!0});try{await fetch("/user/logout",{credentials:"include"})}finally{re.set(ne)}},loadProfile:()=>{const e=X();e?re.patch(function(e){for(var t=1;t{const n=new Date;if(o&&(o.days||o.hours)){const e=o.days?24*o.days*60*60*1e3:60*o.hours*60*1e3;n.setTime(n.getTime()+e)}const r=[];r.push(`${e}=${encodeURIComponent(t)}`),r.push("path=/"),r.push("secure"),o&&r.push(`expires=${n.toUTCString()}`),document.cookie=r.join(";")};var ae;function se(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,n)}return o}function le(e){for(var t=1;t{m("sourcepoint_cmp_impression",e)})(),g(()=>d("cookiebanner_view")))},onConsentReady(e,t,o,n){const r=document.getElementById("privacy-settings");if(r){if(e===c.GDPR&&n.applies){var i;const e=pe?1141355:1171350,n=1403163,c=849303;J("Consent Or Pay: consentUUID and euconsent ---\x3e",{consentUUID:t,euconsent:o});const l=(null!==(i=S("subscriber_origin"))&&void 0!==i?i:s)===s;r.innerHTML="Privacy settings",r.onclick=()=>{var t,o;(v(a.VIEW_PRIVACY_MANAGER),"the-independent.com"===window.JSGlobals.domain)?null===(t=window._sp_)||void 0===t||null===(t=t.gdpr)||void 0===t||t.loadPrivacyManagerModal(c):null===(o=window._sp_)||void 0===o||null===(o=o.gdpr)||void 0===o||o.loadPrivacyManagerModal(l?e:n)},ce("gdprApplies","true",{hours:1})}if(e===c.USNAT){if(!n.applies)return void(r.style.display="none");r.innerHTML="Do Not Sell or Share My Information",r.onclick=()=>{var e;null===(e=window._sp_)||void 0===e||null===(e=e.usnat)||void 0===e||e.loadPrivacyManagerModal(1318285)},ce("us_privacy_string",o,{hours:1})}}},onMessageChoiceSelect(e,t,o){switch(e===c.GDPR&&9===o&&window.localStorage.setItem("consent-to-pay-original-page-redirect-url",window.location.href),o){case a.REJECT_ALL:{const e={label:P.REJECT_ALL};O(e),_(e);break}case a.ACCEPT_ALL:{const e={label:P.ACCEPT_ALL};O(e),_(e);break}case a.CUSTOM_JS:v(a.CUSTOM_JS);break;case a.VIEW_PRIVACY_MANAGER:v(a.VIEW_PRIVACY_MANAGER)}}}})();