PageSourceSearch

https://www.theglobeandmail.com/files/dev/www/cache-short/vendor/sophi/demeter-4179400192.js?isConsented=true

js theglobeandmail.com collected 2026-09-24 06:42:56 UTC 160,639 bytes, 1 lines download raw bytes

1var e,t;!function(){var e=window.sophi&&window.sophi.demeter;if(e){var t=function(e,t){try{var n=e[t];return"string"==typeof n?n:""}catch(e){return""}},n=function(e,t,n){try{e[t]=n}catch(e){}},r=t(window,"sophiInitStatus")||t(e,"initStatus"),i=function(e,t){try{var n=Object.getOwnPropertyDescriptor(e,t);if(n&&!n.configurable)return;Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:function(){return r},set:function(e){r="string"==typeof e?e:""}})}catch(e){}};i(window,"sophiInitStatus"),i(e,"initStatus"),n(window,"sophiInitStatus",r),n(e,"initStatus",r);var o=String(Math.floor(performance.now()/10)/100).replace(/^0\./,".");r=(r?r+",":"")+"x"+o,n(window,"sophiInitStatus",r),n(e,"initStatus",r)}}(),(e=>{const t=1e4;let n;const r={lang:void 0,message:void 0,abortEarly:void 0,abortPipeEarly:void 0};function i(e){return e||n?{lang:e?.lang??void 0,message:e?.message,abortEarly:e?.abortEarly??void 0,abortPipeEarly:e?.abortPipeEarly??void 0}:r}function o(e){const t=typeof e;return"string"===t?`"${e}"`:"number"===t||"bigint"===t||"boolean"===t?`${e}`:"object"===t||"function"===t?(e&&Object.getPrototypeOf(e)?.constructor?.name)??"null":t}function s(e,t,n,r,i){const s=i&&"input"in i?i.input:n.value,a=i?.expected??e.expects??null,l=i?.received??o(s),c={kind:e.kind,type:e.type,input:s,expected:a,received:l,message:`Invalid ${t}: ${a?`Expected ${a} but r`:"R"}eceived ${l}`,requirement:e.requirement,path:i?.path,issues:i?.issues,lang:r.lang,abortEarly:r.abortEarly,abortPipeEarly:r.abortPipeEarly},u="schema"===e.kind,p=i?.message??e.message??(e.reference,void c.lang)??(u?void c.lang:null)??r.message??void c.lang;void 0!==p&&(c.message="function"==typeof p?p(c):p),u&&(n.typed=!1),n.issues?n.issues.push(c):n.issues=[c]}const a=new WeakMap;function l(e){let t=a.get(e);return t||(t={version:1,vendor:"valibot",validate:t=>e["~run"]({value:t},i())},a.set(e,t)),t}function c(e,t){const n=[...new Set(e)];return n.length>1?`(${n.join(` ${t} `)})`:n[0]??"never"}var u=class extends Error{constructor(e){super(e[0].message),this.name="ValiError",this.issues=e}};function p(e,t){return{kind:"validation",type:"regex",reference:p,async:!1,expects:`${e}`,requirement:e,message:t,"~run"(e,t){return e.typed&&!this.requirement.test(e.value)&&s(this,"format",e,t),e}}}function d(e){return{kind:"transformation",type:"transform",reference:d,async:!1,operation:e,"~run"(e){return e.value=this.operation(e.value),e}}}function y(e,t,n){return"function"==typeof e.fallback?e.fallback(t,n):e.fallback}function f(e,t,n){return"function"==typeof e.default?e.default(t,n):e.default}function h(e,t){return{kind:"schema",type:"array",reference:h,expects:"Array",async:!1,item:e,message:t,get"~standard"(){return l(this)},"~run"(e,t){const n=e.value;if(Array.isArray(n)){e.typed=!0,e.value=[];for(let r=0;r<n.length;r++){const i=n[r],o=this.item["~run"]({value:i},t);if(o.issues){const s={type:"array",origin:"value",input:n,key:r,value:i};for(const t of o.issues)t.path?t.path.unshift(s):t.path=[s],e.issues?.push(t);if(e.issues||(e.issues=o.issues),t.abortEarly){e.typed=!1;break}}o.typed||(e.typed=!1),e.value.push(o.value)}}else s(this,"type",e,t);return e}}}function m(e){return{kind:"schema",type:"boolean",reference:m,expects:"boolean",async:!1,message:e,get"~standard"(){return l(this)},"~run"(e,t){return"boolean"==typeof e.value?e.typed=!0:s(this,"type",e,t),e}}}function g(e,t){return{kind:"schema",type:"custom",reference:g,expects:"unknown",async:!1,check:e,message:t,get"~standard"(){return l(this)},"~run"(e,t){return this.check(e.value)?e.typed=!0:s(this,"type",e,t),e}}}function w(e,t){return{kind:"schema",type:"literal",reference:w,expects:o(e),async:!1,literal:e,message:t,get"~standard"(){return l(this)},"~run"(e,t){return e.value===this.literal?e.typed=!0:s(this,"type",e,t),e}}}function v(e){return{kind:"schema",type:"number",reference:v,expects:"number",async:!1,message:e,get"~standard"(){return l(this)},"~run"(e,t){return"number"!=typeof e.value||isNaN(e.value)?s(this,"type",e,t):e.typed=!0,e}}}function b(e,t){return{kind:"schema",type:"object",reference:b,expects:"Object",async:!1,entries:e,message:t,get"~standard"(){return l(this)},"~run"(e,t){const n=e.value;if(n&&"object"==typeof n){e.typed=!0,e.value={};for(const r in this.entries){const i=this.entries[r];if(r in n||("exact_optional"===i.type||"optional"===i.type||"nullish"===i.type)&&void 0!==i.default){const o=r in n?n[r]:f(i),s=i["~run"]({value:o},t);
1if(s.issues){const i={type:"object",origin:"value",input:n,key:r,value:o};for(const t of s.issues)t.path?t.path.unshift(i):t.path=[i],e.issues?.push(t);if(e.issues||(e.issues=s.issues),t.abortEarly){e.typed=!1;break}}s.typed||(e.typed=!1),e.value[r]=s.value}else if(void 0!==i.fallback)e.value[r]=y(i);else if("exact_optional"!==i.type&&"optional"!==i.type&&"nullish"!==i.type&&(s(this,"key",e,t,{input:void 0,expected:`"${r}"`,path:[{type:"object",origin:"key",input:n,key:r,value:n[r]}]}),t.abortEarly))break}}else s(this,"type",e,t);return e}}}function A(e,t){return{kind:"schema",type:"optional",reference:A,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:t,get"~standard"(){return l(this)},"~run"(e,t){return void 0===e.value&&(void 0!==this.default&&(e.value=f(this,e,t)),void 0===e.value)?(e.typed=!0,e):this.wrapped["~run"](e,t)}}}function P(e,t){return{kind:"schema",type:"strict_object",reference:P,expects:"Object",async:!1,entries:e,message:t,get"~standard"(){return l(this)},"~run"(e,t){const n=e.value;if(n&&"object"==typeof n){e.typed=!0,e.value={};for(const r in this.entries){const i=this.entries[r];if(r in n||("exact_optional"===i.type||"optional"===i.type||"nullish"===i.type)&&void 0!==i.default){const o=r in n?n[r]:f(i),s=i["~run"]({value:o},t);if(s.issues){const i={type:"object",origin:"value",input:n,key:r,value:o};for(const t of s.issues)t.path?t.path.unshift(i):t.path=[i],e.issues?.push(t);if(e.issues||(e.issues=s.issues),t.abortEarly){e.typed=!1;break}}s.typed||(e.typed=!1),e.value[r]=s.value}else if(void 0!==i.fallback)e.value[r]=y(i);else if("exact_optional"!==i.type&&"optional"!==i.type&&"nullish"!==i.type&&(s(this,"key",e,t,{input:void 0,expected:`"${r}"`,path:[{type:"object",origin:"key",input:n,key:r,value:n[r]}]}),t.abortEarly))break}if(!e.issues||!t.abortEarly)for(const r in n)if(!(r in this.entries)){s(this,"key",e,t,{input:r,expected:"never",path:[{type:"object",origin:"key",input:n,key:r,value:n[r]}]});break}}else s(this,"type",e,t);return e}}}function S(e){return{kind:"schema",type:"string",reference:S,expects:"string",async:!1,message:e,get"~standard"(){return l(this)},"~run"(e,t){return"string"==typeof e.value?e.typed=!0:s(this,"type",e,t),e}}}function D(e){let t;if(e)for(const n of e)if(t)for(const e of n.issues)t.push(e);else t=n.issues;return t}function k(...e){return{...e[0],pipe:e,get"~standard"(){return l(this)},"~run"(t,n){for(const r of e)if("metadata"!==r.kind){if(t.issues&&("schema"===r.kind||"transformation"===r.kind)){t.typed=!1;break}t.issues&&(n.abortEarly||n.abortPipeEarly)||(t=r["~run"](t,n))}return t}}}var x={control:"control",variant:"variant",holdout:"holdout"},L={C:x.control,V:x.variant,H:x.holdout},E=/^.+_TEST\d-[CVH]$/,V=/[a-z:_-\d]*test(\d)_(a(?:a|b))$/;function C(e){return k(S(),"sdk"===e?g(e=>E.test(e)):p(E,"Invalid configuration: segment name is invalid"))}function _(e){return k(S(),p(V,"sdk"===e?e=>`Invalid configuration: "id" is required and must be a string ending in test1_ab or similar. Received: ${e}`:'Invalid configuration: "id" must be a string ending in test1_ab or similar'))}var T=function e(t,n){return{kind:"schema",type:"union",reference:e,expects:c(t.map(e=>e.expects),"|"),async:!1,options:t,message:n,get"~standard"(){return l(this)},"~run"(e,t){let n,r,i;for(const o of this.options){const s=o["~run"]({value:e.value},t);if(s.typed){if(!s.issues){n=s;break}r?r.push(s):r=[s]}else i?i.push(s):i=[s]}if(n)return n;if(r){if(1===r.length)return r[0];s(this,"type",e,t,{issues:D(r)}),e.typed=!0}else{if(1===i?.length)return i[0];s(this,"type",e,t,{issues:D(i)})}return e}}}([w("external"),w("internal")]);function $({profile:e,normalize:t}){const n=k(h(b({distributionPercent:v(),name:C(e)})),g(e=>{const t=e.reduce((e,t)=>e+t.distributionPercent,0);if(100!==t)throw new Error(`Invalid configuration: sum of distributionPercent must be 100. Received: ${t}`);return!0}),g(e=>{const t=e.map(e=>e.name);if(new Set(t).size!==t.length)throw new Error("Invalid configuration: segment names must be unique");return!0})),r=k(h(b({id:_(e),groups:n,type:T})),g(e=>{const t=e.map(e=>e.id);if(new Set(t).size!==t.length)throw new Error("Invalid configuration: experiment IDs must be unique");return!0}),g(e=>{const t={internal:0,external:0};for(const n of e)t[n.type]++;if(t.internal>1)throw new Error(`Invalid configuration: ${t.internal} internal tests found, only one is allowed`);if(t.external>1)throw new Error(`Invalid configuration: ${t.external} external tests found, only one is allowed`);return!0})),i=t?k(r,d(e=>(e.sort((e,t)=>
1"internal"===e.type&&"external"===t.type?-1:"external"===e.type&&"internal"===t.type?1:0),e))):r,o=b({id:b({name:S()})}),s=b({default:m()});return P({hostname:S(),experiments:i,cookies:t?A(o,{id:{name:"_ml_id"}}):A(o),consent:t?A(s,{default:!0}):A(s),subMarket:A(S())})}null&&$({profile:"bundler",normalize:!1});var B=$({profile:"sdk",normalize:!0});const O="sophi_abtest_config",j=e,I=new class{constructor(e){const t=function(e){return function(e,t,n){const r=e["~run"]({value:t},i(n));if(r.issues)throw new u(r.issues);return r.value}(B,e)}(e);this.cookies=t.cookies,this.hostname=t.hostname,this.experiments=t.experiments,this.baseConsent=t.consent}get consent(){const e=(()=>{if("undefined"==typeof sessionStorage)return null;const e=sessionStorage.getItem(O);if(null!==e)try{return JSON.parse(e)}catch(e){return null}return null})();return e?.consent??this.baseConsent}}(j),W=I,U=e=>e?(e^16*Math.random()>>e/4).toString(16):("10000000-1000-4000-8000"+-1e11).replace(/[018]/g,U),R=(e,t)=>{try{localStorage?.setItem(e,t)}catch{}},M=e=>{try{return localStorage?.getItem(e)??null}catch{return null}},N=(e,t,n,r)=>{const i=[`${e}=${t}`,`expires=${n}`,`domain=.${r.hostname}`,"path=/","SameSite=None","Secure"].join(";");window.document.cookie=i},G=e=>{if(!document.cookie)return"";const t=document.cookie.split("; ").find(t=>0===t.indexOf(e));if(!t)return"";try{return decodeURIComponent(t.split("=")[1])}catch{return t.split("=")[1]}},z=e=>{const t=M(e)||G(e);return t&&"false"!==t?t:""},q=W.cookies.id.name,F=(e,n,r)=>((e,n,r)=>{const i=((e,n=t)=>{const r=e/2**32;return Math.floor(r*n)})(((e,t=1)=>function(e,t){var n,r,i,o,s,a,l,c;for(n=3&e.length,r=e.length-n,i=t,s=3432918353,a=461845907,c=0;c<r;)l=255&e.charCodeAt(c)|(255&e.charCodeAt(++c))<<8|(255&e.charCodeAt(++c))<<16|(255&e.charCodeAt(++c))<<24,++c,i=(65535&(o=5*(65535&(i=(i^=l=(65535&(l=(l=(65535&l)*s+(((l>>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<13|i>>>19))+((5*(i>>>16)&65535)<<16)&4294967295))+27492+(((o>>>16)+58964&65535)<<16);switch(l=0,n){case 3:l^=(255&e.charCodeAt(c+2))<<16;case 2:l^=(255&e.charCodeAt(c+1))<<8;case 1:i^=l=(65535&(l=(l=(65535&(l^=255&e.charCodeAt(c)))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295}return i^=e.length,i=2246822507*(65535&(i^=i>>>16))+((2246822507*(i>>>16)&65535)<<16)&4294967295,i=3266489909*(65535&(i^=i>>>13))+((3266489909*(i>>>16)&65535)<<16)&4294967295,(i^=i>>>16)>>>0}(e,t))(`${n}-${r}`));return((e,t)=>{let n=null;return e.forEach(e=>{t>=e.range_start&&t<=e.range_end&&(n=e.id)}),n})(e,i)})((e=>{if(100!==e.map(e=>e.distributionPercent).reduce((e,t)=>e+t))throw new Error(`Total weight percentages must equal 100%`);let n=0;const r=[];return e.forEach(e=>{if(n==t)return;const i=n+e.distributionPercent*t/100,o={id:e.name,range_start:0===n?n:n+1,range_end:Math.min(i,t)};n=i,r.push(o)}),r})(e),n,r),Z="always-H",H="Sophi AB Test:",J={log:(...e)=>{console.log(H,...e)},warn:(...e)=>{console.warn(H,...e)},error:(...e)=>{console.error(H,...e)}},Y=J,K="sophi_abtest_group",X="sophi_abtest_id";window.sophi=window.sophi||{};let Q=W.consent.default;const ee=()=>{const e=(e=>{if(G(e))return z(e).split(".")[0];const t=new Date,n=new Date(t.setFullYear(t.getFullYear()+2)).toUTCString(),r=U(),i=Math.floor(t.getTime()/1e3);return((e,t,n,r)=>{R(e,t),N(e,t,n,r)})(e,[r,i,"0",i,i].join("."),n,W),r})(q),t=M("_matheriSegs")??"",n=t?t.split(",").filter(e=>E.test(e)):[],r=G("_matheriSegs"),i=(r?r.split(","):[]).filter(e=>e&&e!==Z&&!E.test(e)),o=[];for(const t of W.experiments){const r=t.groups.find(e=>n.includes(e.name));o.push(r?.name||F(t.groups,t.id,e))}const s=[...o.filter((e,t)=>"internal"===W.experiments[t].type),...o.filter((e,t)=>"external"===W.experiments[t].type)].join(","),a=((e,t)=>{let n=t;return e.some(e=>"external"===e.type)||(n+=`,${Z}`),n})(W.experiments,s),l=i.length?[...i,...a.split(",").filter(Boolean)].join(","):a;a!==t&&R("_matheriSegs",a),l!==r&&N("_matheriSegs",l,(()=>{const e=new Date;return e.setMonth(e.getMonth()+6),e.toUTCString()})(),W)},te=e=>{const t=e.charAt(e.length-1);return L[t]},ne=e=>{const t={...e};if(window.location.search){const n=new URLSearchParams(window.location.search);n.has(X)&&((e,t,n)=>{e?(t.experimentId=e.toLowerCase(),Y.log(`Test ID override. Original: ${n.experimentId}. Overridden by: ${e}.`)):Y.warn(`Invalid test ID override in URL parameter ${X}: ${e}`)})(n.get(X),t,e),n.has(K)&&((e,t,n)=>{e&&e.toLowerCase()in x?(t.assignedGroup=e,Y.log(`Test group override. Original: ${n.assignedGroup}. Overridden by: ${e}.`)):Y.warn(`Invalid test group override in URL parameter ${K}: ${e}`)})(n.get(K),t,e)}return t},re=function(){if(!Q)return[];const e=W.experiments,t=z("_matheriSegs").split(","),n=[];for(const r of e){const e=r.groups.find(e=>
1t.includes(e.name))?.name;if(!e)continue;const i=te(e),o={experimentId:r.id,assignedGroup:i,type:r.type};n.push(o)}return n};function ie(e="external"){return re().filter(t=>t.type===e).map(({type:e,...t})=>t).map("external"===e?ne:e=>e)}function oe(e){if(!Q)return;const t=re();let n="";if("string"!=typeof e)return;n=e.toLowerCase();const r=t.find(e=>e.experimentId.toLowerCase()===n);return void 0===r&&Y.warn(`Experiment ${e} not found`),r&&"external"===r.type?ne(r):r}if(Q)try{ee()}catch(t){Y.error("Error initializing storage:",t)}const se={getAllExperiments:async(e="external")=>ie(e),getAllExperimentsSync:(e="external")=>ie(e),getExperiment:async e=>oe(e),getExperimentSync:e=>oe(e),enableConsent:()=>{try{Q=!0,ee()}catch(e){Y.error("Error enabling consent:",e)}}};window.sophi.abTests=se,window.dispatchEvent(new Event("sophi.abTests:ready"))})(JSON.parse(/*__ABTEST_CONFIG__*/'{"hostname":"theglobeandmail.com","experiments":[{"id":"i:test3_ab","groups":[{"distributionPercent":50,"name":"INTERNAL_AB_TEST3-C"},{"distributionPercent":50,"name":"INTERNAL_AB_TEST3-V"},{"distributionPercent":0,"name":"INTERNAL_AB_TEST3-H"}],"type":"internal"}]}')),e=globalThis,t=()=>(()=>{var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},t={};let n;e.d(t,{default:()=>Ja});const r={lang:void 0,message:void 0,abortEarly:void 0,abortPipeEarly:void 0};function i(e){return e||n?{lang:e?.lang??void 0,message:e?.message,abortEarly:e?.abortEarly??void 0,abortPipeEarly:e?.abortPipeEarly??void 0}:r}function o(e){const t=typeof e;return"string"===t?`"${e}"`:"number"===t||"bigint"===t||"boolean"===t?`${e}`:"object"===t||"function"===t?(e&&Object.getPrototypeOf(e)?.constructor?.name)??"null":t}function s(e,t,n,r,i){const s=i&&"input"in i?i.input:n.value,a=i?.expected??e.expects??null,l=i?.received??o(s),c={kind:e.kind,type:e.type,input:s,expected:a,received:l,message:`Invalid ${t}: ${a?`Expected ${a} but r`:"R"}eceived ${l}`,requirement:e.requirement,path:i?.path,issues:i?.issues,lang:r.lang,abortEarly:r.abortEarly,abortPipeEarly:r.abortPipeEarly},u="schema"===e.kind,p=i?.message??e.message??(e.reference,void c.lang)??(u?void c.lang:null)??r.message??void c.lang;void 0!==p&&(c.message="function"==typeof p?p(c):p),u&&(n.typed=!1),n.issues?n.issues.push(c):n.issues=[c]}const a=new WeakMap;function l(e){let t=a.get(e);return t||(t={version:1,vendor:"valibot",validate:t=>e["~run"]({value:t},i())},a.set(e,t)),t}function c(e,t){return Object.prototype.hasOwnProperty.call(e,t)&&"__proto__"!==t&&"prototype"!==t&&"constructor"!==t}function u(e,t){const n=[...new Set(e)];return n.length>1?`(${n.join(` ${t} `)})`:n[0]??"never"}function p(e){if(e.path){let t="";for(const n of e.path){if("string"!=typeof n.key&&"number"!=typeof n.key)return null;t+=t?`.${n.key}`:n.key}return t}return null}var d=class extends Error{constructor(e){super(e[0].message),this.name="ValiError",this.issues=e}};function y(e,t){return{kind:"validation",type:"check",reference:y,async:!1,expects:null,requirement:e,message:t,"~run"(e,t){return e.typed&&!this.requirement(e.value)&&s(this,"input",e,t),e}}}function f(e,t){return{kind:"validation",type:"min_length",reference:f,async:!1,expects:`>=${e}`,requirement:e,message:t,"~run"(e,t){return e.typed&&e.value.length<this.requirement&&s(this,"length",e,t,{received:`${e.value.length}`}),e}}}function h(){return{kind:"transformation",type:"to_lower_case",reference:h,async:!1,"~run":e=>(e.value=e.value.toLowerCase(),e)}}function m(e){return{kind:"transformation",type:"transform",reference:m,async:!1,operation:e,"~run"(e){return e.value=this.operation(e.value),e}}}function g(){return{kind:"transformation",type:"trim",reference:g,async:!1,"~run":e=>(e.value=e.value.trim(),e)}}function w(e,t,n){return"function"==typeof e.fallback?e.fallback(t,n):e.fallback}function v(e,t,n){return"function"==typeof e.default?e.default(t,n):e.default}function b(){return{kind:"schema",type:"any",reference:b,expects:"any",async:!1,get"~standard"(){return l(this)},"~run":e=>(e.typed=!0,e)}}function A(e,t){return{kind:"schema",type:"array",reference:A,expects:"Array",async:!1,item:e,message:t,get"~standard"(){return l(this)},"~run"(e,t){const n=e.value;if(Array.isArray(n)){e.typed=!0,e.value=[];for(let r=0;r<n.length;r++){const i=n[r],o=this.item["~run"]({value:i},t);if(o.issues){const s={type:"array",origin:"value",input:n,key:r,value:i};for(const t of o.issues)t.path?t.path.unshift(s):t.path=[s],e.issues?.pu
1sh(t);if(e.issues||(e.issues=o.issues),t.abortEarly){e.typed=!1;break}}o.typed||(e.typed=!1),e.value.push(o.value)}}else s(this,"type",e,t);return e}}}function P(e){return{kind:"schema",type:"boolean",reference:P,expects:"boolean",async:!1,message:e,get"~standard"(){return l(this)},"~run"(e,t){return"boolean"==typeof e.value?e.typed=!0:s(this,"type",e,t),e}}}function S(e,t){return{kind:"schema",type:"custom",reference:S,expects:"unknown",async:!1,check:e,message:t,get"~standard"(){return l(this)},"~run"(e,t){return this.check(e.value)?e.typed=!0:s(this,"type",e,t),e}}}function D(e){return{kind:"schema",type:"date",reference:D,expects:"Date",async:!1,message:e,get"~standard"(){return l(this)},"~run"(e,t){return e.value instanceof Date?isNaN(e.value)?s(this,"type",e,t,{received:'"Invalid Date"'}):e.typed=!0:s(this,"type",e,t),e}}}function k(e,t){if(typeof e==typeof t){if(e===t||e instanceof Date&&t instanceof Date&&+e===+t)return{value:e};if(e&&t&&e.constructor===Object&&t.constructor===Object){const n={...e};for(const r in t)if(Object.prototype.hasOwnProperty.call(e,r)){const i=k(e[r],t[r]);if(i.issue)return i;n[r]=i.value}else n[r]=t[r];return{value:n}}if(Array.isArray(e)&&Array.isArray(t)&&e.length===t.length){const n=[...e];for(let r=0;r<e.length;r++){const i=k(e[r],t[r]);if(i.issue)return i;n[r]=i.value}return{value:n}}}return{issue:!0}}function x(e,t){return{kind:"schema",type:"intersect",reference:x,expects:u(e.map(e=>e.expects),"&"),async:!1,options:e,message:t,get"~standard"(){return l(this)},"~run"(e,t){if(this.options.length){const n=e.value;let r;e.typed=!0;for(const i of this.options){const o=i["~run"]({value:n},t);if(o.issues){if(e.issues)for(const t of o.issues)e.issues.push(t);else e.issues=o.issues;if(t.abortEarly){e.typed=!1;break}}o.typed||(e.typed=!1),e.typed&&(r?r.push(o.value):r=[o.value])}if(e.typed){e.value=r[0];for(let n=1;n<r.length;n++){const i=k(e.value,r[n]);if(i.issue){s(this,"type",e,t,{received:"unknown"});break}e.value=i.value}}}else s(this,"type",e,t);return e}}}function L(e,t){return{kind:"schema",type:"literal",reference:L,expects:o(e),async:!1,literal:e,message:t,get"~standard"(){return l(this)},"~run"(e,t){return e.value===this.literal?e.typed=!0:s(this,"type",e,t),e}}}function E(e,t){return{kind:"schema",type:"non_optional",reference:E,expects:"!undefined",async:!1,wrapped:e,message:t,get"~standard"(){return l(this)},"~run"(e,t){return void 0!==e.value&&(e=this.wrapped["~run"](e,t)),void 0===e.value&&s(this,"type",e,t),e}}}function V(e){return{kind:"schema",type:"null",reference:V,expects:"null",async:!1,message:e,get"~standard"(){return l(this)},"~run"(e,t){return null===e.value?e.typed=!0:s(this,"type",e,t),e}}}function C(e){return{kind:"schema",type:"number",reference:C,expects:"number",async:!1,message:e,get"~standard"(){return l(this)},"~run"(e,t){return"number"!=typeof e.value||isNaN(e.value)?s(this,"type",e,t):e.typed=!0,e}}}function _(e,t){return{kind:"schema",type:"object",reference:_,expects:"Object",async:!1,entries:e,message:t,get"~standard"(){return l(this)},"~run"(e,t){const n=e.value;if(n&&"object"==typeof n){e.typed=!0,e.value={};for(const r in this.entries){const i=this.entries[r];if(r in n||("exact_optional"===i.type||"optional"===i.type||"nullish"===i.type)&&void 0!==i.default){const o=r in n?n[r]:v(i),s=i["~run"]({value:o},t);if(s.issues){const i={type:"object",origin:"value",input:n,key:r,value:o};for(const t of s.issues)t.path?t.path.unshift(i):t.path=[i],e.issues?.push(t);if(e.issues||(e.issues=s.issues),t.abortEarly){e.typed=!1;break}}s.typed||(e.typed=!1),e.value[r]=s.value}else if(void 0!==i.fallback)e.value[r]=w(i);else if("exact_optional"!==i.type&&"optional"!==i.type&&"nullish"!==i.type&&(s(this,"key",e,t,{input:void 0,expected:`"${r}"`,path:[{type:"object",origin:"key",input:n,key:r,value:n[r]}]}),t.abortEarly))break}}else s(this,"type",e,t);return e}}}function T(e,t){return{kind:"schema",type:"optional",reference:T,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:t,get"~standard"(){return l(this)},"~run"(e,t){return void 0===e.value&&(void 0!==this.default&&(e.value=v(this,e,t)),void 0===e.value)?(e.typed=!0,e):this.wrapped["~run"](e,t)}}}function $(e,t){return{kind:"schema",type:"picklist",reference:$,expects:u(e.map(o),"|"),async:!1,options:e,message:t,get"~standard"(){return l(this)},"~run"(e,t){return this.options.includes(e.value)?e.typed=!0:s(this,"type",e,t),e}}}function B(e,t,n){return{kind:"schema",type:"record",reference:B,expects:"Object",async:!1,key:e,value:t,message:n,get"~standard"(){return l(this)},"~run"(e,t){const n=e.value;if(n&&"object"==typeof n){e.typed=!0,e.value={};for(const r in n)if(c(n,r)){const i=n[r],o=this.key["~run"]({value:r},t);
1if(o.issues){const s={type:"object",origin:"key",input:n,key:r,value:i};for(const t of o.issues)t.path=[s],e.issues?.push(t);if(e.issues||(e.issues=o.issues),t.abortEarly){e.typed=!1;break}}const s=this.value["~run"]({value:i},t);if(s.issues){const o={type:"object",origin:"value",input:n,key:r,value:i};for(const t of s.issues)t.path?t.path.unshift(o):t.path=[o],e.issues?.push(t);if(e.issues||(e.issues=s.issues),t.abortEarly){e.typed=!1;break}}o.typed&&s.typed||(e.typed=!1),o.typed&&(e.value[o.value]=s.value)}}else s(this,"type",e,t);return e}}}function O(e,t){return{kind:"schema",type:"strict_object",reference:O,expects:"Object",async:!1,entries:e,message:t,get"~standard"(){return l(this)},"~run"(e,t){const n=e.value;if(n&&"object"==typeof n){e.typed=!0,e.value={};for(const r in this.entries){const i=this.entries[r];if(r in n||("exact_optional"===i.type||"optional"===i.type||"nullish"===i.type)&&void 0!==i.default){const o=r in n?n[r]:v(i),s=i["~run"]({value:o},t);if(s.issues){const i={type:"object",origin:"value",input:n,key:r,value:o};for(const t of s.issues)t.path?t.path.unshift(i):t.path=[i],e.issues?.push(t);if(e.issues||(e.issues=s.issues),t.abortEarly){e.typed=!1;break}}s.typed||(e.typed=!1),e.value[r]=s.value}else if(void 0!==i.fallback)e.value[r]=w(i);else if("exact_optional"!==i.type&&"optional"!==i.type&&"nullish"!==i.type&&(s(this,"key",e,t,{input:void 0,expected:`"${r}"`,path:[{type:"object",origin:"key",input:n,key:r,value:n[r]}]}),t.abortEarly))break}if(!e.issues||!t.abortEarly)for(const r in n)if(!(r in this.entries)){s(this,"key",e,t,{input:r,expected:"never",path:[{type:"object",origin:"key",input:n,key:r,value:n[r]}]});break}}else s(this,"type",e,t);return e}}}function j(e){return{kind:"schema",type:"string",reference:j,expects:"string",async:!1,message:e,get"~standard"(){return l(this)},"~run"(e,t){return"string"==typeof e.value?e.typed=!0:s(this,"type",e,t),e}}}function I(e){let t;if(e)for(const n of e)if(t)for(const e of n.issues)t.push(e);else t=n.issues;return t}function W(e,t){return{kind:"schema",type:"union",reference:W,expects:u(e.map(e=>e.expects),"|"),async:!1,options:e,message:t,get"~standard"(){return l(this)},"~run"(e,t){let n,r,i;for(const o of this.options){const s=o["~run"]({value:e.value},t);if(s.typed){if(!s.issues){n=s;break}r?r.push(s):r=[s]}else i?i.push(s):i=[s]}if(n)return n;if(r){if(1===r.length)return r[0];s(this,"type",e,t,{issues:I(r)}),e.typed=!0}else{if(1===i?.length)return i[0];s(this,"type",e,t,{issues:I(i)})}return e}}}function U(e,t,n){const r=e["~run"]({value:t},i(n));if(r.issues)throw new d(r.issues);return r.value}function R(...e){return{...e[0],pipe:e,get"~standard"(){return l(this)},"~run"(t,n){for(const r of e)if("metadata"!==r.kind){if(t.issues&&("schema"===r.kind||"transformation"===r.kind)){t.typed=!1;break}t.issues&&(n.abortEarly||n.abortPipeEarly)||(t=r["~run"](t,n))}return t}}}const M={any:b,array:A,boolean:P,check:y,custom:S,exactOptional:function e(t,n){return{kind:"schema",type:"exact_optional",reference:e,expects:t.expects,async:!1,wrapped:t,default:n,get"~standard"(){return l(this)},"~run"(e,t){return this.wrapped["~run"](e,t)}}},flatten:function(e){const t={};for(const n of e)if(n.path){const e=p(n);e?(t.nested||(t.nested={}),Object.prototype.hasOwnProperty.call(t.nested,e)?t.nested[e].push(n.message):t.nested[e]=[n.message]):t.other?t.other.push(n.message):t.other=[n.message]}else t.root?t.root.push(n.message):t.root=[n.message];return t},intersect:x,literal:L,maxValue:function e(t,n){return{kind:"validation",type:"max_value",reference:e,async:!1,expects:`<=${t instanceof Date?t.toJSON():o(t)}`,requirement:t,message:n,"~run"(e,t){return!e.typed||e.value<=this.requirement||s(this,"value",e,t,{received:e.value instanceof Date?e.value.toJSON():o(e.value)}),e}}},message:function(e,t){return{...e,get"~standard"(){return l(this)},"~run":(n,r)=>e["~run"](n,{...r,message:t})}},minLength:f,minValue:function e(t,n){return{kind:"validation",type:"min_value",reference:e,async:!1,expects:`>=${t instanceof Date?t.toJSON():o(t)}`,requirement:t,message:n,"~run"(e,t){return!e.typed||e.value>=this.requirement||s(this,"value",e,t,{received:e.value instanceof Date?e.value.toJSON():o(e.value)}),e}}},null_:V,number:C,object:_,optional:T,parse:U,partial:function(e,t){const n={};for(const r in e.entries)n[r]=!t||t.includes(r)?T(e.entries[r]):e.entries[r];return{...e,entries:n,get"~standard"(){return l(this)}}},picklist:$,pipe:R,record:B,required:function(e,t,n){const r=Array.isArray(t)?t:void 0,i=Array.isArray(t)?n:t,o={};for(const t in e.entries)o[t]=!r||r.includes(t)?E(e.entries[t],i):e.entries[t];return{...e,entries:o,get"~standard"(){return l(this)}}},safeParse:function(e,t,n){const r=e["~run"]({value:t},i(n));return{typed:r.typed,success:!r.issues,output:r.value,issues:r.issues}},strictObject:O,string:j,transform:m,toLowerCase:h,trim:g,tuple:function e(t,n){return{kind:"schema",type:"tuple",reference:e,expects:"Array",async:!1,items:t,message:n,get"~standard"(){return l(this)},"~run"(e,t){const n=e.value;if(Array.isArray(n)){e.typed=!0,e.value=[];for(let r=0;r<this.items.length;r++){const i=n[r],o=this.items[r]["~run"]({value:i},t);if(o.issues){const s={type:"array",origin:"value",input:n,key:r,value:i};for(const t of o.issues)t.path?t.path.unshift(s):t.path=[s],e.issues?.pu
1sh(t);if(e.issues||(e.issues=o.issues),t.abortEarly){e.typed=!1;break}}o.typed||(e.typed=!1),e.value.push(o.value)}}else s(this,"type",e,t);return e}}},union:W,unwrap:function(e){return e.wrapped},url:function e(t){return{kind:"validation",type:"url",reference:e,async:!1,expects:null,requirement(e){try{return new URL(e),!0}catch{return!1}},message:t,"~run"(e,t){return e.typed&&!this.requirement(e.value)&&s(this,"URL",e,t),e}}},ValiError:d,value:function e(t,n){return{kind:"validation",type:"value",reference:e,async:!1,expects:t instanceof Date?t.toJSON():o(t),requirement:t,message:n,"~run"(e,t){return!e.typed||this.requirement<=e.value&&this.requirement>=e.value||s(this,"value",e,t,{received:e.value instanceof Date?e.value.toJSON():o(e.value)}),e}}}},N=_({assignedGroup:$(["control","variant","holdout"]),experimentId:j()}),G={PAYWALL:"paywall",REGWALL:"regwall"},z="always",q="never",F="anonymous",Z="registered",H="subscribed",J=M.union([M.literal(F),M.literal(Z),M.literal(H)]),Y=M.picklist([G.REGWALL,G.PAYWALL]),K=M.picklist([z,q]),X={nowall:0,paywall:1,regwall:2},Q={always:1,never:0},ee={regwall:"b",paywall:"d",finalEnsemble:"z",onDevicePolicy:"v",contentPropensityTier:"q",userPropensityTier:"s"},te=M.object({wallVisibility:K,wallType:Y}),ne=M.object({...te.entries,score:M.number(),threshold:M.pipe(M.number(),M.minValue(0),M.maxValue(1))}),re=M.array(ne),ie=M.object({wallVisibility:M.literal(z),wallType:Y,outcomes:re}),oe=M.object({wallVisibility:M.literal(q),outcomes:re}),se=(M.union([ie,oe]),M.record(M.string(),M.union([M.string(),M.number(),M.boolean()]))),ae=M.optional(se),le=M.object({wallType:M.literal(G.REGWALL),wallTypeCode:M.literal(X.regwall),wallVisibility:M.literal(z),wallVisibilityCode:M.literal(Q.always),wallProperties:ae}),ce=M.object({wallType:M.literal(G.PAYWALL),wallTypeCode:M.literal(X.paywall),wallVisibility:M.literal(z),wallVisibilityCode:M.literal(Q.always),wallProperties:ae}),ue=M.object({wallVisibility:M.literal(q),wallVisibilityCode:M.literal(Q.never),wallProperties:ae}),pe=M.union([le,ce,ue]),de=M.object({id:M.string(),createdAt:M.string(),trace:M.string(),context:M.string(),inputs:M.string(),outcome:pe,searchParams:M.string(),userProperties:M.string(),wallProperties:M.optional(M.string()),paywallScore:M.optional(M.pipe(M.number(),M.minValue(0),M.maxValue(100))),contentProperties:M.optional(M.string(),""),experiment:M.union([M.null_(),N])}),ye=M.partial(M.object({id:M.string(),createdAt:M.string(),context:M.string(),trace:M.string(),inputs:M.string(),outcome:M.union([M.partial(le),M.partial(ce),M.partial(ue)]),searchParams:M.string(),userProperties:M.string(),wallProperties:M.string(),paywallScore:M.optional(M.pipe(M.number(),M.minValue(0),M.maxValue(100))),contentProperties:M.optional(M.string(),""),experiment:M.union([M.null_(),N])}));function fe(e){return function(e){const t=(new TextEncoder).encode(e);let n="";for(const e of t)n+=String.fromCharCode(e);return btoa(n)}(JSON.stringify(e))}function he(e){return JSON.parse(function(e){const t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e+=1)n[e]=t.charCodeAt(e);return(new TextDecoder).decode(n)}(e))}const me=new class{constructor(){this.key="demeter"}get(){try{const e=sessionStorage.getItem(this.key);return null===e?e:he(e)}catch(e){return null}}set(e){try{return sessionStorage.setItem(this.key,fe(e))}catch(e){}}},ge=me,we="sophi_log_level",ve=M.union([M.literal("warn"),M.literal("info"),M.literal("debug")]),be=M.partial(M.object({logLevel:M.optional(ve),override:M.optional(ye)}));function Ae(e){ge.set({...ge.get()||{},logLevel:e})}const Pe=new class{constructor(e={}){this.logLevel=e.logLevel||function(){const e=new URL(window.location.href).searchParams.get(we);if(e){const t=M.safeParse(ve,e);return t.success?(Ae(e),t.output):(ke.warn(`Unknown log level found in URL: ${e}`),null)}return null}()||function(){const e=ge.get();if(e)return M.safeParse(ve,e.logLevel).success?e.logLevel:null}()||"warn",this.config=this.config.bind(this)}config(e){M.parse(be,e),e.logLevel&&(this.logLevel=e.logLevel,Ae(e.logLevel)),e.override&&(this.override=e.override),ke.info("⚙️ Runtime config",JSON.stringify(e,null,2))}},Se={error:0,warn:1,info:2,debug:3},De=new class{constructor(){this.prefix="QuickStart:"}error(...e){console.log(this.prefix,"🔴",...e)}warn(...e){console.log(this.prefix,"🟠",...e)}info(...e){Se[Pe.logLevel]>=Se.info&&console.log(this.prefix,...e)}debug(...e){Se[Pe.logLevel]>=Se.debug&&console.log(this.prefix,"🔧",...e)}},ke=De,xe=document.currentScript,Le="script#sophi-loader";function Ee(e){const t=function(){const e=xe||document.querySelector(Le);if(!e)return ke.debug("Loader script element not found"),null;const t=e.getAttribute("src");if(!t)return ke.debug("Loader script has no src attribute"),null;try{return new URL(t,document.baseURI).searchParams}catch(e){return ke.debug("Unable to parse loader script src URL",e),null}}();return t?t.get(e):null}var Ve="content.age",Ce="content.ageInHours",_e="content.section",Te="content.accessCategory",$e=["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20"],Be=$([...$e,"countryCode"]),Oe=$([...$e,"content.id",Ve,Ce,_e,Te]),je=W([j(),C(),P()]),Ie=(B(Oe,je),{gtmDataLayer:{dataLayerName:"dataLayer",listenToPast:!0}}),We=_({name:L("userProperties"),key:Be,path:R(j(),f(1))}),Ue=_({name:R(j(),f(1)),actions:A(We)}),Re=_({dataLayerName:T(j(),Ie.gtmDataLayer.dataLayerName),events:A(Ue),listenToPast:T(P(),Ie.gtmDataLayer.listenToPast)}),Me=_({gtmDataLayer:T(Re)}),Ne=e=>"enum"===e.type&&e.options||[],Ge=(e,t)=>
1"string"===t.type||"number"===t.type||"boolean"===t.type?typeof e===t.type:Ne(t).some(t=>Object.is(t,e)),ze=["content.id","visitor.type","modelTrace","experiment.id","experiment.assignedGroup"],qe=new Set(ze),Fe=31536e3,Ze={isEnabled:!0,name:"sophi_demeter",maxAge:Fe,includeOutcome:!1},He={isEnabled:!1},Je=2e3,Ye="https://paywall.sophi.io",Ke={},Xe={maxLength:12},Qe=!0,et={enabled:!1,key:"demeter_tracing"},tt={visitorType:!1,contentPropensityLevel:!1},nt=W([R(j(),g(),h(),y(e=>{if(0===e.length||e.startsWith(".")||e.endsWith(".")||e.includes("..")||e.includes(":"))return!1;try{return new URL("http://"+e).hostname===e}catch{return!1}},"Invalid hostname"))]),rt=R(j(),y(e=>{try{return new RegExp(e),!0}catch{return!1}},"Invalid regex pattern")),it=_({isEnabled:L(!0),name:T(j(),Ze.name),maxAge:T(C(),Fe),includeOutcome:T(P(),Ze.includeOutcome)}),ot=T(W([it,_({isEnabled:L(!1)})]),He),st=T(_({isEnabled:P()}),{isEnabled:!1}),at=_({type:W([L("client"),L("server")])}),lt=_({isDeviceAndLocationDataAllowed:L(!0),isUserBehaviorDataAllowed:L(!0)}),ct=_({isDeviceAndLocationDataAllowed:L(!1),isUserBehaviorDataAllowed:L(!1)}),ut=T(_({off:W([ct,lt]),on:lt}),{off:{isDeviceAndLocationDataAllowed:!1,isUserBehaviorDataAllowed:!1},on:{isDeviceAndLocationDataAllowed:!0,isUserBehaviorDataAllowed:!0}}),pt=_({name:W([L("contains"),L("regex"),L("toBoolean"),L("toNumber")]),args:T(B(j(),b()))}),dt=W([A(pt)]),yt=_({source:R(j(),h(),L("url")),expression:rt}),ft=_({source:R(j(),h(),L("dom")),selector:j(),attribute:j(),expression:T(rt)}),ht=W([yt,ft,_({source:R(j(),h(),L("window")),path:R(j(),f(1)),expression:T(rt)})]),mt=_({name:W([L("daysSince"),L("hoursSince"),L("toBoolean"),L("map")]),args:T(B(j(),b()))}),gt=A(x([ht,_({name:R(j(),g(),f(1)),handler:T(mt),type:W([L("string"),L("number"),L("boolean"),L("list")]),tracked:T(P())}),_({key:Oe})])),wt=$(["type","os","viewer"]),vt=$(["timeZone","referrer"]),bt=$(["todayPageViews","todayPageViewsByArticle","todayPageViewsByArticleWithPaywall","todayPageViewsByArticleWithRegwall","todayTopLevelSections","todayTopLevelSectionsByArticle","sevenDayPageViews","sevenDayPageViewsByArticle","sevenDayPageViewsByArticleWithPaywall","sevenDayPageViewsByArticleWithRegwall","sevenDayTopLevelSections","sevenDayTopLevelSectionsByArticle","sevenDayVisitCount","twentyEightDayPageViews","twentyEightDayPageViewsByArticle","twentyEightDayPageViewsByArticleWithPaywall","twentyEightDayPageViewsByArticleWithRegwall","twentyEightDayTopLevelSections","twentyEightDayTopLevelSectionsByArticle","twentyEightDayVisitCount","daysSinceLastVisit","hourOfDay","localDayOfWeek","localHourOfDay"]),At=W([_({source:L("device"),key:wt}),_({source:L("contentProperties"),key:Oe}),_({source:L("userProperties"),key:Be}),_({source:L("visit"),key:vt}),_({source:L("modelInputs"),key:bt})]),Pt=_({host:R(j(),f(1)),url:T(j(),Ye),timeout:T(R(C(),y(e=>e>0)),Je),dataMap:R(T(B(j(),At),Ke),y(e=>!ze.some(t=>t in e),"dataMap must not include SDK-reserved parameters: content.id, visitor.type, modelTrace, experiment.id, experiment.assignedGroup"))}),St=W([_({selector:j()}),_({event:j()})]),Dt=R(j(),g(),f(1),y(e=>/^[A-Za-z0-9_-]+$/.test(e),"Wall property keys may only contain letters, numbers, underscores, and hyphens")),kt=W([j(),C(),P()]),xt=_({key:Be,name:j(),type:L("number"),tracked:T(P(),Qe),handlers:T(dt)}),Lt=_({key:Be,name:j(),type:L("string"),minLength:T(C()),maxLength:T(C(),Xe.maxLength),tracked:T(P(),Qe),handlers:T(dt)}),Et=_({key:Be,name:j(),type:L("boolean"),tracked:T(P(),Qe),handlers:T(dt)}),Vt=W([L("string"),L("number"),L("boolean")]),Ct=_({key:W([L("visitorType"),Be]),name:j(),type:Vt,minLength:T(C()),maxLength:T(C(),Xe.maxLength),tracked:T(P(),Qe),handlers:T(dt)}),_t=A(W([x([Ct,_({source:R(j(),h(),L("window")),path:R(j(),f(1)),expression:T(rt)})]),x([Ct,_({source:R(j(),h(),L("dom")),selector:j(),attribute:j(),expression:T(rt)})]),x([Ct,_({source:R(j(),h(),L("url")),expression:rt})]),x([Ct,_({source:R(j(),h(),L("cookie")),path:R(j(),f(1)),expression:T(rt)})]),xt,Lt,Et])),Tt=_({key:Dt,name:j(),tracked:T(P(),!0)}),$t=W([_({type:L("string"),default:T(j())}),_({type:L("number"),default:T(C())}),_({type:L("boolean"),default:T(P())}),_({type:L("enum"),options:R(A(kt),f(1)),default:T(kt)})]),Bt=A(R(x([Tt,$t]),y(e=>void 0===e.default||Ge(e.default,e),"Wall property default must match its configured type"),y(e=>"enum"===e.type||!("options"in e&&void 0!==e.options),"options is only supported for wall properties with type 'enum'"))),Ot=T(P(),!0),jt=T(_({enabled:T(P(),et.enabled),key:T(j(),et.key)}),et),It=T(_({contentPropensityLevel:T(W([L(!1),ft]),tt.contentPropensityLevel),visitorType:T(W([L(!1),ft]),tt.visitorType)}),tt),Wt=R(j(),g(),f(1)),Ut=O({hostname:nt,metadataHost:T(nt),model:j(),analytics:j(),mainHost:T(nt),subMarket:T(j()),enableExperiment:T(P(),!0),cookie:ot,subdomains:T(A(nt),[]),mode:ut,paywallApi:T(Pt),spa:T(St),userProperties:T(_t),wallProperties:T(Bt),contentProperties:T(gt),generatePageviewOnWallHit:Ot,wallGeneration:T(at,{type:"client"}),addTracingToLocalStorage:jt,enableWallIndicators:T(P(),!1),holdInputEventsUntilConsent:T(P(),!1),newsletterCampaigns:T(A(j()),[]),metaValues:It,showPaywallScore:T(P(),!1),policy:T(_({evaluator:Wt,thresholds:T(Wt)}
1)),extensions:T(Me),stateCookie:st,tenant:j()}),Rt=R(S(e=>!e||"object"!=typeof e||!("analytics"in e)||"custom"===e.analytics,"Unsupported analytics module"),S(e=>{if(e&&"object"==typeof e&&"contentProperties"in e){if("enableWallIndicators"in e&&e.enableWallIndicators)return!1;if("wallGeneration"in e&&"object"==typeof e.wallGeneration&&null!==e.wallGeneration&&"type"in e.wallGeneration&&"server"===e.wallGeneration.type)return!1}return!0},"Content properties cannot be used with server-side wall generation or wall indicators"),S(e=>!e||"object"!=typeof e||!("paywallApi"in e)||!e.paywallApi||!(!("contentProperties"in e)||!Array.isArray(e.contentProperties))&&e.contentProperties.some(e=>e&&"object"==typeof e&&"key"in e&&"content.id"===e.key),'Paywall API requires contentProperties to include key "content.id"')),Mt=R(Ut,Rt,m(e=>({...e,mainHost:e.mainHost??e.hostname})));const Nt="sophi_demeter_config";class Gt{constructor(e){this.#e="isConsented",this.consentParameterValue=null,this.#t=e.off,this.#n=e.on,this.isDeviceAndLocationDataAllowed=this.#t.isDeviceAndLocationDataAllowed,this.isUserBehaviorDataAllowed=this.#t.isUserBehaviorDataAllowed,this.#r()}#t;#n;#e;getDefaultConsentValue(){return!0===this.#t.isDeviceAndLocationDataAllowed&&!0===this.#t.isUserBehaviorDataAllowed?"on":"off"}#r(){const e=Ee(this.#e);"true"===e?(this.on(),this.consentParameterValue=!0):"false"===e&&(this.off(),this.consentParameterValue=!1)}on(){this.isDeviceAndLocationDataAllowed=this.#n.isDeviceAndLocationDataAllowed,this.isUserBehaviorDataAllowed=this.#n.isUserBehaviorDataAllowed}off(){this.isDeviceAndLocationDataAllowed=!1,this.isUserBehaviorDataAllowed=!1}}function zt(e){return e?"selector"in e?`yes\n      · observed DOM element: ${e.selector}`:`yes\n      · listening for event: ${e.event}`:"no"}function qt(e){return!1===e?"disabled":Ft(e)}function Ft(e){return`enabled\n      · selector: ${e.selector}\n      · attribute: ${e.attribute}`}function Zt(e){return e&&0!==e.length?e.map(e=>`${e.key} - ${e.name}`).join(", "):"none"}const Ht=JSON.parse('{"tenant":"tgam","hostname":"theglobeandmail.com","metadataHost":"www.theglobeandmail.com","model":"theglobeandmail","policy":{"evaluator":"default"},"analytics":"custom","subdomains":[],"contentProperties":[{"key":"content.id","name":"Content ID","type":"string","source":"dom","selector":"meta[name=\'arc-id\']","attribute":"content","expression":".*","tracked":false},{"key":"1","name":"URL Pathname","type":"string","source":"url","expression":".*","tracked":false}],"enableExperiment":true,"holdInputEventsUntilConsent":false,"newsletterCampaigns":[],"userProperties":[{"key":"1","name":"last_newsletter_subscription","type":"string","source":"window","path":"tgam.datalayer.identity.newsletter","tracked":true,"maxLength":12},{"key":"2","name":"is_past_subscriber_registered","type":"boolean","source":"window","path":"tgam.datalayer.identity.registered","tracked":true,"maxLength":12},{"key":"3","name":"is_past_subscriber_prev_service","type":"boolean","source":"window","path":"tgam.datalayer.identity.previous_services.0","tracked":true,"maxLength":12},{"key":"4","name":"is_advisor","type":"boolean","source":"window","path":"tgam.datalayer.identity.advisor","tracked":true,"maxLength":12}],"generatePageviewOnWallHit":false,"mode":{"off":{"isDeviceAndLocationDataAllowed":false,"isUserBehaviorDataAllowed":false},"on":{"isDeviceAndLocationDataAllowed":true,"isUserBehaviorDataAllowed":true}},"showPaywallScore":false,"paywallApi":{"host":"www.theglobeandmail.com","dataMap":{"visitor.visit.timezone":{"source":"visit","key":"timeZone"},"visitor.device.os":{"source":"device","key":"os"},"visitor.visit.referrer":{"source":"visit","key":"referrer"},"visitor.device.viewer":{"source":"device","key":"viewer"},"visitor.device.type":{"source":"device","key":"type"}},"url":"https://paywall.sophi.io","timeout":2000},"wallGeneration":{"type":"client"}}'),Jt=function(e){return U(Mt,e)}((()=>{const e=sessionStorage.getItem(Nt);if(null!==e)try{return JSON.parse(e)}catch(e){return null}})()??Ht),Yt=new class{constructor(e){this.hostname=e.hostname,this.mainHost=e.mainHost,this.subMarket=e.subMarket,this.enableExperiment=e.enableExperiment,this.cookie=e.cookie,this.subdomains=e.subdomains,this.mode=new Gt(e.mode),this.paywallApi=e.paywallApi,this.spa=e.spa,this.userProperties=e.userProperties,this.wallProperties=e.wallProperties,this.contentProperties=e.contentProperties,this.generatePageviewOnWallHit=e.generatePageviewOnWallHit,this.wallGeneration=e.wallGeneration,this.addTracingToLocalStorage=e.addTracingToLocalStorage,this.enableWallIndicators=e.enableWallIndicators,this.holdInputEventsUntilConsent=e.holdInputEventsUntilConsent,this.newsletterCampaigns=e.newsletterCampaigns,this.metaValues=e.metaValues,this.showPaywallScore=e.showPaywallScore,this.stateCookie=e.stateCookie,function(e){const t=e.subdomains??[];0!==t.length&&t.includes(e.mainHost)&&ke.warn(`Subdomains contain mainHost entry (${e.mainHost}).`)}(e),ke.info(function(e){let t=`⚙️ Bundle settings\n    · Host: ${e.hostname}\n    · Main host: ${e.mainHost}\n    · Subdomains: ${e.subdomains?.join(", ")||"none"}\n    · Wall type: ${e.wallGeneration.type} side`;return t="debug"===Pe.logLevel?`${t}\n    · Experiments: ${e.enableExperiment?"enabled":"disabled"}\n    · Cookie: ${e.cookie?.isEnabled?"enabled":"disabled"}\n    · Paywall API: ${e.paywallApi?"enabled":"disabled"}\n    · Default consent: ${e.mode.getDefaultConsentValue()}\n    · Single Page Application: ${zt(e.spa)}\n    · Wallhits generate pageviews: ${e.generatePageviewOnWallHit?"yes":"no"}\n    · Wall indicators: ${e.enableWallIndicators?"enabled":"disabled"}\n    · Visitor type detection: ${qt(e.metaValues.visitorType)}\n    · Content propensity level detection: ${qt(e.metaValues.contentPropensityLevel)}\n    · User properties: ${Zt(e.userProperties)}\n    · Wall properties: ${Zt(e.wallProperties)}\n    · Content properties: ${Zt(e.contentProperties)}`:`${t}\n    ${function(e){return e.filter(e=>Boolean(e)).map(e=>`· ${e.label}: ${e.value}\n    `).join("")}([e.enableExperiment&&{label:"Experiments",value:"enabled"},e.cookie?.isEnabled&&{label:"Cookie",value:"enabled"},e.paywallApi&&{label:"Paywall API",value:"enabled"},e.mode.getDefaultConsentValue()&&{label:"Default consent",value:e.mode.getDefaultConsentValue()},{label:"Single Page Application",value:zt(e.spa)},e.generatePageviewOnWallHit&&{label:"Wallhits generate pageviews",value:"yes"},e.enableWallIndicators&&{label:"Wall indicators",value:"enabled"},e.metaValues.visitorType&&{label:"Visitor type detection",value:Ft(e.metaValues.visitorType)},e.metaValues.contentPropensityLevel&&{label:"Content propensity level detection",value:qt(e.metaValues.contentPropensityLevel)}])}`,t}(this))}}(Jt),Kt=function(e){let t=null;if(Yt.enableExperiment&&window.sophi?.abTests&&!0===Yt.mode.isDeviceAndLocationDataAllowed&&!0===Yt.mode.isUserBehaviorDataAllowed){const n=window.sophi?.abTests.getAllExperimentsSync(e);n.length>0&&(t=n[0])}return t},Xt=()=>Kt("external"),Qt=()=>Kt("internal");Xt(),Qt();var en=(e=>(e["Initialized"]="i",e["Loading"]="l",e["Executing"]="x",e["StateInitial"]="si",e["StateCookie"]="sc",e["StateLocal"]="sl",e["TestAssigned"]="t",e["ApiInitiated"]="ai",e["ApiCompleted"]="ac",e["DecisionAvailable"]="d",e["DataLayerReady"]="dl",e["ScriptLoadError"]="xsl",e["ApiTimeout"]="xat",e["ApiNetworkError"]="xan",e["ModelEvalFailed"]="xme",e))(en||{});let tn=0;const nn=999.99;let rn="";const on=e=>"string"==typeof e?e:"",sn=(e,t)=>{try{return on(e[t])}catch{return""}},an=(e,t,n)=>{try{e[t]=n}catch{}},ln=(e,t)=>{try{const n=Object.getOwnPropertyDescriptor(e,t);if(n&&(!n.configurable||n.get&&n.set))return;Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:()=>rn,set:e=>{rn=on(e)}})}catch{}};function cn(){const e=window.sophi?.demeter;if(!e)return;const t=window,n=e,r=sn(t,"sophiInitStatus"),i=sn(n,"initStatus");rn=r||i,ln(t,"sophiInitStatus"),ln(n,"initStatus"),an(t,"sophiInitStatus",rn),an(n,"initStatus",rn)}function un(e){const t=window.sophi?.demeter;if(!t)return;cn();const n=`${e}${(()=>{const e=performance.now()-tn,t=Math.min(Math.floor(e/10)/100,nn);return String(t).replace(/^0\./,".")})()}`;rn=rn?`${rn},${n}`:n;const r=window,i=t;an(r,"sophiInitStatus",rn),an(i,"initStatus",rn)}const pn="sophiDataLayerReady",dn={trace:"",context:"",inputs:"",experimentsCode:null,assignedGroup:null,userProperties:"",contentProperties:""},yn=()=>{window.sophi.dataLayer={...dn}},fn=()=>window.sophi.dataLayer;function hn(e){const t={};var n;
1return"context"in e&&(t.context=e.context),"inputs"in e&&(t.inputs=e.inputs),"trace"in e&&(t.trace=e.trace),"userProperties"in e&&(t.userProperties=e.userProperties),"wallProperties"in e&&(t.wallProperties=e.wallProperties),"contentProperties"in e&&(t.contentProperties=e.contentProperties),"experiment"in e&&e.experiment&&(t.experimentsCode=null===(n=e.experiment)?null:`${n.experimentId}${"="}${n.assignedGroup}`,t.assignedGroup=e.experiment.assignedGroup),t}function mn(e){window.sophi.dataLayer={...window.sophi.dataLayer,...hn(e)}}const gn=function(){un(en.DataLayerReady),window.dispatchEvent(new Event(pn))};var wn=(e=>(e["GetDecision"]="GetDecision",e["GetDecisionForArticleWallIndicators"]="GetDecisionForArticleWallIndicators",e["Init"]="Init",e["Pageview"]="pageview",e["Wall"]="wall",e["EnableAllFeatures"]="EnableAllFeatures",e["UserProperties"]="UserProperties",e["ContentProperties"]="ContentProperties",e))(wn||{});const vn=M.union([M.null_(),M.pipe(M.string(),M.trim(),M.toLowerCase())]),bn=M.object({article:M.boolean(),section:M.optional(vn)}),An=M.union([M.union([M.pipe(M.string(),M.trim(),M.literal("paywall")),M.pipe(M.string(),M.trim(),M.literal("regwall"))]),M.object({wallType:M.union([M.pipe(M.string(),M.trim(),M.literal("paywall")),M.pipe(M.string(),M.trim(),M.literal("regwall"))]),section:M.optional(vn)})]),Pn=M.union([M.object({type:M.literal("pageview"),payload:bn}),M.object({type:M.literal("wall"),payload:An}),M.object({type:M.literal("UserProperties"),payload:M.any()})]),Sn=(M.union([Pn,M.object({type:M.literal("GetDecision")}),M.object({type:M.literal("Init")}),M.object({type:M.literal("EnableAllFeatures")})]),(e,t,n)=>{const r=document.querySelector(e);if(null===r)return null;const i=r.getAttribute(t);return null===i?null:n?Ln(i,n):i}),Dn=e=>"__proto__"!==e&&"constructor"!==e&&"prototype"!==e,kn=e=>{try{const t=e.split(".");if(t.length>10)return ke.warn(`Window path exceeds maximum depth of 10: "${e}" (depth: ${t.length})`),null;let n=window;for(const r of t){if(null==n)return null;if(!Dn(r))return ke.warn(`Unsafe path segment detected: "${r}" in path "${e}"`),null;n=n[r]}return void 0===n?null:n}catch(t){return ke.warn(`Error extracting window path "${e}":`,t),null}},xn=(e,t,n,r)=>{const i=n?.minLength,o=n?.maxLength;return"number"==typeof i&&t.length<i?(ke.warn(`${r} ${e} expected to have a minimum length of ${i} but got '${t}' with length ${t.length}, omitting.`),{isValid:!1,processedValue:t}):"number"==typeof o&&t.length>o?(ke.warn(`${r} ${e} expected to have maximum length of ${o} but got '${t}' with length ${t.length}, truncating.`),{isValid:!0,processedValue:t.slice(0,o)}):{isValid:!0,processedValue:t}},Ln=(e,t)=>{try{const n=new RegExp(t),r=e.match(n);if(null===r)return null;const i=r[1]??r[0];return void 0===r[1]&&r[0]&&ke.debug(`No capture group value, using full match: "${i}".`),i}catch(e){return ke.warn(`Regex error "${t}":`,e),null}},En=(e,t)=>{try{const n=e+"=",r=document.cookie.split(";");for(const e of r){const r=e.trimStart();if(r.startsWith(n)){const e=r.substring(n.length);let i;try{i=decodeURIComponent(e)}catch{i=e}return t?Ln(i,t):i}}return null}catch{return null}},Vn=e=>null==e?null:String(e).toLowerCase();function Cn(e){const t=Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()),n=new Date,r=Date.UTC(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate())-t,i=Math.floor(r/(1e3*60*60*24));return i<0?0:i}const _n={0:"free access",1:"subscribers only",2:"metered views",3:"special package"},Tn=e=>{try{if("dom"===e.source)return Sn(e.selector,e.attribute,e.expression);if("url"===e.source){const t=new URL(location.href);return Ln(t.pathname,e.expression)}return null}catch{return null}},$n=new Set(["","0","false","n","no","none","null","off","undefined"]),Bn=(e,t)=>"string"==typeof e?!(e=>$n.has(e.trim().toLowerCase()))(e):Boolean(e),On=(e,t)=>{const n=t.args;return"contains"===t.name&&n?((e,t)=>{if(!t||!Array.isArray(e))return null;const{value:n,caseSensitive:r=!0}=t;return(Array.isArray(n)?n:[n]).some(t=>r?e.includes(String(t)):e.some(e=>e.toLowerCase()===String(t).toLowerCase()))})(e,n):"regex"===t.name&&n?((e,{patterns:t})=>{if(!t||!Array.isArray(t))return null;const n="string"==typeof e?e:String(e??""),r=t;for(const e of r){const t=Ln(n,e);if(t)return t}return null})(e,n):"toBoolean"===t.name?Bn(e):"toNumber"===t.name?(e=>{if(null==e)return null;const t=Number(e);return Number.isNaN(t)?null:t})(e):null},jn=(e,t)=>{let n=e;if(null==n||!t)return null;for(const e of t)n=On(n,e);return n??null},In={values:null,analyticsString:null};function Wn(e){return null===In.values&&Un(e),In.values}function Un(e){let t={values:{},analyticsString:""};try{t=Kn(e)}catch(e){ke.error("Error computing content properties:",e)}In.values=t.values,In.analyticsString=t.analyticsString}function Rn(e,t){const n=(t?.dateFormat||"iso").toLowerCase();let r;return r="iso"===n||"iso8601"===n?new Date(e):"unixseconds"===n?new Date(1e3*parseInt(e,10)):"unixmillis"===n?new Date(parseInt(e,10)):new Date(e),isNaN(r.getTime())?null:r}const Mn=new Set(["unixseconds","unixmillis"]),Nn=/^\d+$/;function Gn(e,t){const n=(t?.dateFormat||"iso").toLowerCase();return!Mn.has(n)||Nn.test(e.trim())}function zn(e,t){if(null==e)return null;if(!t)return e;switch(t.name){case"daysSince":{const n=function(e,t){try{if(!Gn(e,t))return null;const n=Rn(e,t);return n?Cn(n):null}catch{return null}}(e,t.args);return null===n?null:n}case"hoursSince":{const n=function(e,t){try{if(!Gn(e,t))return null;const n=Rn(e,t);if(!n)return null;const r=Math.floor((Date.now()-n.getTime())/(1e3*60*60));return r<0?0:r}catch{return null}}(e,t.args);return null===n?null:n}case"toBoolean":return Bn(e);case"lowercase":return Vn(e);case"map":return function(e,t){return t&&"object"==typeof t&&e in t?t[e]:e}(e,t.args);default:return e}}function qn(e,t){let n=e;if("boolean"===t.type&&"dom"===t.source)n=null!==document.querySelector(t.selector);else if("number"===t.type&&"string"==typeof e){const t=Number(e.trim());n=isNaN(t)?null:t}else"list"===t.type&&null!==e&&(n=(r=e,r.split(",").map(e=>
1Vn(e)?.replace(/,/g,"").trim()).filter(Boolean)).join(" ")),t.handler&&(n=zn("string"==typeof n?n:String(n),t.handler));var r;return n}function Fn(e,t,n){if(e===Te){const e=zn(t,{name:"map",args:n.handler?.args});return Number(e)in _n?_n[e]:null}return e===Ve&&"string"==typeof t?zn(t,{name:"daysSince",args:n.handler?.args}):e===Ce&&"string"==typeof t?zn(t,{name:"hoursSince",args:n.handler?.args}):t}function Zn(e,t,n){return"string"===n.type&&"string"==typeof t?xn(e,t,n,"Content property"):{isValid:!0,processedValue:t}}function Hn(e){return null==e||""===e}const Jn={[Ve]:"A",[_e]:"B",[Te]:"C",[Ce]:"D"},Yn=e=>e in Jn?Jn[e]:e,Kn=e=>{const t=e.contentProperties||[],n={},r=[],i=[],o=[];for(const e of t){const t=e.key,s=Tn(e);let a=null;if(a=t in Jn?Fn(t,s,e):qn(s,e),Hn(a)){i.push(e.name);continue}const{isValid:l,processedValue:c}=Zn(t,a,e);l&&(a=c,n[t]=a,o.push({label:e.name||t,value:a}),e.tracked&&r.push(`${Yn(t)}:${a}`))}return t.length>0&&function(e,t){e.length>0&&ke.warn(`Some configured content properties were not found on this page: ${e.join(", ")}. Note: This is expected on homepages or section pages without article content.`);const n=t.map(e=>"Content Age"===e.label&&"number"==typeof e.value?`    · ${e.label}: ${e.value} days`:"Content Age in Hours"===e.label&&"number"==typeof e.value?`    · ${e.label}: ${e.value} hours`:"string"==typeof e.value?`    · ${e.label}: "${e.value}"`:`    · ${e.label}: ${JSON.stringify(e.value)}`);ke.info("Content Properties Found\n\n"+n.join("\n"))}(i,o),{values:n,analyticsString:r.join(",")}};function Xn(e){return Object.entries(e)}const Qn=new class{constructor(){this.key="demeter"}get(){try{const e=localStorage.getItem(this.key);return null===e?e:he(e)}catch(e){return null}}set(e){try{return localStorage.setItem(this.key,fe(e))}catch(e){}}clear(){try{return localStorage.removeItem(this.key)}catch(e){}}},er=Qn,tr=M.array(M.string()),nr=M.object({pageViews:M.number(),pageViewsByArticle:M.number(),pageViewsByArticleWithPaywall:M.number(),pageViewsByArticleWithRegwall:M.number(),topLevelSections:tr,topLevelSectionsByArticle:tr}),rr=M.object({granted:M.boolean(),timestamp:M.string()}),ir=28;function or(){return(new Date).toISOString()}class sr{constructor(){this.pageViews=0,this.pageViewsByArticle=0,this.pageViewsByArticleWithPaywall=0,this.pageViewsByArticleWithRegwall=0,this.topLevelSections=[],this.topLevelSectionsByArticle=[]}}const ar=M.optional(M.array(Pn),[]),lr=M.object({previous:M.partial(de),events:ar}),cr=M.object({previous:M.optional(de),events:ar,outcomes:M.optional(M.array(ne),[])}),ur=M.pipe(M.any(),M.transform(e=>{const t=M.safeParse(cr,e);if(t.success)return t.output;const n=M.safeParse(lr,e);return n.success?{events:n.output.events,previous:n.output.previous,outcomes:[]}:{events:[],previous:void 0,outcomes:[]}})),pr=M.object({today:nr,history:M.array(nr),lastSeen:M.string(),visitor:J,coldDataLayer:ur,consent:M.optional(rr)}),dr=M.tuple([M.number(),M.number(),M.number(),M.number(),tr,tr]),yr=M.object({lS:M.string(),v:J,t:dr,h:M.array(dr),cDL:ur,c:M.optional(M.tuple([M.boolean(),M.string()]))}),fr=e=>[e.pageViews,e.pageViewsByArticle,e.pageViewsByArticleWithPaywall,e.pageViewsByArticleWithRegwall,e.topLevelSections,e.topLevelSectionsByArticle],hr=e=>({pageViews:e[0],pageViewsByArticle:e[1],pageViewsByArticleWithPaywall:e[2],pageViewsByArticleWithRegwall:e[3],topLevelSections:e[4],topLevelSectionsByArticle:e[5]});class mr{constructor(){this.today={pageViews:0,pageViewsByArticle:0,pageViewsByArticleWithPaywall:0,pageViewsByArticleWithRegwall:0,topLevelSections:[],topLevelSectionsByArticle:[]},this.history=Array(ir).fill(void 0).map(()=>new sr),this.lastSeen="",this.visitor="anonymous",this.coldDataLayer={previous:void 0,events:[],outcomes:[]},this.consent=void 0}}let gr;const wr=new class{#i;constructor(){const e=er.get();this.#i=this.#o(this.#s(e))}#s(e){try{const t=M.safeParse(yr,e);return t.success?(e=>{const{lS:t,v:n,t:r,h:i,cDL:o,c:s}=e,a=i.map(hr);return{lastSeen:t,visitor:n,today:hr(r),history:a,coldDataLayer:o,consent:s?{granted:s[0],timestamp:s[1]}:void 0}})(t.output):M.parse(pr,e)}catch(e){return new mr}}getFromStored(){this.updateState(this.#s(er.get()))}updateState(e){this.#i=this.#o(e),er.set((e=>{const{today:t,history:n,lastSeen:r,visitor:i,coldDataLayer:o,consent:s}=e,a=n.map(fr);return{lS:r,v:i,t:fr(t),h:a,cDL:o,c:s?[s.granted,s.timestamp]:void 0}})(e));try{gr?.()}catch{}}getState(){return JSON.parse(JSON.stringify(this.#i))}clear(){er.clear(),this.#i=this.#o(this.#s(null))}getConsent(){return this.#i.consent}setConsent(e){const t=this.getState();t.consent={granted:e,timestamp:or()},this.updateState(t)}#o(e){if(!1===Yt.mode.isUserBehaviorDataAllowed)return e;const t=new Date(e.lastSeen),n=Math.max(0,Cn(t));if(n>0){e.history.unshift(e.today);for(let t=0;t<n-1;t++)e.history.unshift((new mr).today);e.history=e.history.slice(0,ir),e.today=(new mr).today}return e.lastSeen=or(),e}},vr=wr,br=(e,t)=>{if(null==e)return null;try{switch(t){case"string":{const t=String(e);return""===t.trim()?null:t}case"number":{const t=Number(e);return isNaN(t)?null:t}case"boolean":if("boolean"==typeof e)return e;if("string"==typeof e){const t=e.toLowerCase();if("true"===t)return!0;
1if("false"===t)return!1}return Boolean(e);default:return null}}catch(e){return null}},Ar=e=>{const t=M.safeParse(J,e);return t.success?{isValid:!0,value:t.output}:(ke.warn(`visitorType should be '${F}' or '${Z}', got '${e}'.`),{isValid:!1,value:null})},Pr="userProperties.countryCode",Sr={countryCode:"A"},Dr=[{key:"visitorType",name:"Visitor type",type:"string"}],kr=(e,t,n)=>"minLength"in n&&void 0!==n.minLength&&t.length<n.minLength?(ke.warn(`User property ${e} expected to have a minimum length of ${n.minLength} but got '${t}' with length ${t.length}, omitting.`),{isValid:!1,processedValue:t}):"maxLength"in n&&void 0!==n.maxLength&&t.length>n.maxLength?(ke.warn(`User property ${e} expected to have maximum length of ${n.maxLength} but got '${t}' with length ${t.length}, truncating.`),{isValid:!0,processedValue:t.slice(0,n.maxLength)}):{isValid:!0,processedValue:t},xr=(e,t)=>{if(!0!==e.mode.isDeviceAndLocationDataAllowed||!0!==e.mode.isUserBehaviorDataAllowed)return void ke.debug("Discarding userProperties event");const{custom:n,reserved:r}=((e,t)=>{const n={},r={};if("object"!=typeof t||null===t)return ke.warn(`User properties must be in an 'args' object. Received:`,t),{custom:n,reserved:r};const i=(e=>{const t=new Map;for(const e of Dr)t.set(e.key,e);for(const n of e)t.set(n.key,n);return t})(e.userProperties||[]);for(const e of Xn(t)){let[t,o]=e;const s=i.get(t);if(s){if("handlers"in s&&s.handlers){const e=jn(o,s.handlers);if(void 0===e){ke.debug(`User property ${t} handler returned undefined, omitting.`);continue}o=e}if(typeof o===s.type){if("string"==typeof o){const{isValid:e,processedValue:n}=kr(t,o,s);if(!e)continue;o=n}if("visitorType"===s.key){const{isValid:e,value:t}=Ar(o);if(!e)continue;r[s.key]=t;continue}n[s.key]=o}else ke.warn(`User property ${t} expected to be a ${s.type} but got ${typeof o}, omitting.`)}else ke.warn(`User property ${t} is not configured, omitting.`)}return{custom:n,reserved:r}})(e,t);if(Object.keys(n).length>0&&ke.debug("Setting user properties",n),Object.keys(r).length>0&&ke.debug("Setting reserved properties",r),Object.keys(n).length>0&&qa.update(e=>{Object.assign(e.userProperties,n)}),r.visitorType){const e=vr.getState(),t=r.visitorType;vr.updateState({...e,visitor:t})}},Lr=e=>{if(!e.userProperties||0===e.userProperties.length)return;(e=>{const t=Ee(Pr);t&&(e.userProperties??[]).some(e=>"countryCode"===e.key)&&xr(e,{countryCode:t})})(e);const t=e.userProperties.filter(e=>"source"in e&&"window"===e.source);if(t.length>0){const n=(e=>{const t={},n=[];for(const r of e){const{key:e,path:i,name:o,type:s,handlers:a}=r,l=kn(i);if(null===l){n.push(o);continue}if("visitorType"===e){const{isValid:r,value:i}=Ar(l);if(!r||!i){n.push(o);continue}t[e]=i;continue}const c=a?l:br(l,s);if(null!==c)if("string"==typeof c){const{isValid:i,processedValue:s}=xn(e,c,r,"User property");if(!i){n.push(o);continue}t[e]=s}else t[e]=c;else ke.warn(`User property "${o}" could not be converted to type "${s}". Value: "${l}"`),n.push(o)}return n.length>0&&ke.warn(`Some configured user properties were not found in window variables: ${n.join(", ")}`),t})(t);Object.keys(n).length>0&&(ke.debug("Initializing user properties from window",n),xr(e,n))}const n=e.userProperties.filter(e=>"source"in e&&"cookie"===e.source);if(n.length>0){const t=(e=>{const t={},n=[];for(const r of e){const{key:e,path:i,name:o,type:s,handlers:a}=r,l=r.expression,c=En(i),u=null!==c&&l?Ln(c,l):c;if(null===u){n.push(o);continue}if("visitorType"===e){const{isValid:r,value:i}=Ar(u);if(!r||!i){n.push(o);continue}t[e]=i;continue}const p=a?u:br(u,s);if(null!==p)if("string"==typeof p){const{isValid:i,processedValue:s}=xn(e,p,r,"User property");if(!i){n.push(o);continue}t[e]=s}else t[e]=p;else ke.warn(`User property "${o}" could not be converted to type "${s}". Value: "${u}"`),n.push(o)}return n.length>0&&ke.warn(`Some configured user properties could not be extracted from cookies: ${n.join(", ")}`),t})(n);Object.keys(t).length>0&&(ke.debug("Initializing user properties from cookies",t),xr(e,t))}},Er=xr,Vr=["utm_campaign","utm_medium","utm_source"],Cr=function(e=window.location.href){try{const t=new URL(e),n={};
1return Vr.forEach(e=>{const r=t.searchParams.get(e);null!==r&&(n[e]=r.toLowerCase())}),n}catch(e){return ke.error("Unable to extract query parameters.",e),{}}};var _r={d:(e,t)=>{for(var n in t)_r.o(t,n)&&!_r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},Tr={};_r.d(Tr,{Ay:()=>Wr,Fo:()=>Or,LU:()=>Ir,Tk:()=>Br,VS:()=>$r,cr:()=>jr});const $r={campaign:0,direct:1,internal:2,search:3,social:4,other:5},Br={google:0,yahoo:1,duckduckgo:2,bing:3,facebook:4,instagram:5,x:6,linkedin:7,reddit:8,newsletter:9},Or={search:0,news:1,discover:2},jr=function(e,t,n,r){return Ir(e,t,n,r)?.medium},Ir=function(e,t,n,r,i){if("string"!=typeof e)throw new Error("locationHref should be a string");if("string"!=typeof t)throw new Error("documentReferrer should be a string");if("string"!=typeof n)throw new Error("locationHost should be a string");const o=t.toLowerCase().trim(),s=e.toLowerCase().trim(),a=n.toLowerCase().trim();let l;try{l=new URLSearchParams(new URL(s).search).get("utm_campaign")}catch{l=null}if(l){const e=i?.newsletterCampaigns;return{medium:"campaign",source:e?.includes(l)?"newsletter":void 0}}if(!o)return{medium:"direct"};const c=o.match(/^(?:.+:\/\/)?([^/]+)/i),u=c?c[1].replace(/^www\./i,""):"",p=a.replace(/^www\./i,"");if(u===p||u.endsWith(`.${p}`)&&u.length>p.length+1)return{medium:"internal"};if(/^[^\s.][^\s]*\.google\.android\.googlequicksearchbox\b/i.test(u))return{medium:"search",source:"google",channel:"discover"};if("string"==typeof r&&t.includes("google.com")&&r.includes("Safari")&&(r.includes("GSA")||r.includes("GNews"))&&(r.includes("604.1")||r.includes("605.1.15")))return{medium:"search",source:"google",channel:"discover"};if("news.google.com"===u)return{medium:"search",source:"google",channel:"news"};const d=[{source:"google",channel:"search"},{source:"yahoo"},{source:"duckduckgo"},{source:"bing"}],y=e=>{if(e.domains){const t=e.domains.map(e=>`(^|\\.)${e.replace(".","\\.")}$`).join("|");return new RegExp(t,"i")}return new RegExp(String.raw`(^|.*\.)${e.source}\.(?:[a-z]{2,63}|[a-z]{2,63}\.[a-z]{2})$`,"i")};for(const e of d)if(y(e).test(u))return"google"===e.source?{medium:"search",source:e.source,channel:e.channel}:{medium:"search",source:e.source};const f=[{source:"facebook"},{source:"instagram"},{source:"x",domains:["x.com","t.co"]},{source:"linkedin"},{source:"reddit"}];for(const e of f)if(y(e).test(u))return{medium:"social",source:e.source};return{medium:"other",source:u||void 0}},Wr=jr,Ur=Tr.Fo,Rr=Tr.VS,Mr=Tr.Tk,Nr=Tr.LU,Gr=function(){try{return Nr(window.location.href,document.referrer,window.location.host,navigator.userAgent,Yt)}catch(e){return ke.error("Unable to determine referrer.",e),{medium:"",source:"",channel:""}}};var zr=Symbol.for("immer-nothing"),qr=Symbol.for("immer-draftable"),Fr=Symbol.for("immer-state");function Zr(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Hr=Object.getPrototypeOf;function Jr(e){return!!e&&!!e[Fr]}function Yr(e){return!!e&&(Qr(e)||Array.isArray(e)||!!e[qr]||!!e.constructor?.[qr]||ii(e)||oi(e))}var Kr=Object.prototype.constructor.toString(),Xr=new WeakMap;function Qr(e){if(!e||"object"!=typeof e)return!1;const t=Object.getPrototypeOf(e);if(null===t||t===Object.prototype)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(n===Object)return!0;if("function"!=typeof n)return!1;let r=Xr.get(n);return void 0===r&&(r=Function.toString.call(n),Xr.set(n,r)),r===Kr}function ei(e,t,n=!0){0===ti(e)?(n?Reflect.ownKeys(e):Object.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function ti(e){const t=e[Fr];return t?t.type_:Array.isArray(e)?1:ii(e)?2:oi(e)?3:0}function ni(e,t){return 2===ti(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function ri(e,t,n){const r=ti(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function ii(e){return e instanceof Map}function oi(e){return e instanceof Set}function si(e){return e.copy_||e.base_}function ai(e,t){if(ii(e))return new Map(e);if(oi(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Qr(e);if(!0===t||"class_only"===t&&!n){const t=Object.getOwnPropertyDescriptors(e);delete t[Fr];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){const i=n[r],o=t[i];!1===o.writable&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(t[i]={configurable:!0,writable:!0,enumerable:o.enumerable,value:e[i]})}return Object.create(Hr(e),t)}{const t=Hr(e);if(null!==t&&n)return{...e};const r=Object.create(t);return Object.assign(r,e)}}function li(e,t=!1){return ui(e)||Jr(e)||!Yr(e)||(ti(e)>
11&&Object.defineProperties(e,{set:ci,add:ci,clear:ci,delete:ci}),Object.freeze(e),t&&Object.values(e).forEach(e=>li(e,!0))),e}var ci={value:function(){Zr(2)}};function ui(e){return null===e||"object"!=typeof e||Object.isFrozen(e)}var pi,di={};function yi(e){const t=di[e];return t||Zr(0),t}function fi(){return pi}function hi(e,t){t&&(yi("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function mi(e){gi(e),e.drafts_.forEach(vi),e.drafts_=null}function gi(e){e===pi&&(pi=e.parent_)}function wi(e){return pi={drafts_:[],parent_:pi,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function vi(e){const t=e[Fr];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function bi(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[Fr].modified_&&(mi(t),Zr(4)),Yr(e)&&(e=Ai(t,e),t.parent_||Si(t,e)),t.patches_&&yi("Patches").generateReplacementPatches_(n[Fr].base_,e,t.patches_,t.inversePatches_)):e=Ai(t,n,[]),mi(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==zr?e:void 0}function Ai(e,t,n){if(ui(t))return t;const r=e.immer_.shouldUseStrictIteration(),i=t[Fr];if(!i)return ei(t,(r,o)=>Pi(e,i,t,r,o,n),r),t;if(i.scope_!==e)return t;if(!i.modified_)return Si(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const t=i.copy_;let o=t,s=!1;3===i.type_&&(o=new Set(t),t.clear(),s=!0),ei(o,(r,o)=>Pi(e,i,t,r,o,n,s),r),Si(e,t,!1),n&&e.patches_&&yi("Patches").generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function Pi(e,t,n,r,i,o,s){if(null==i)return;if("object"!=typeof i&&!s)return;const a=ui(i);if(!a||s){if(Jr(i)){const s=Ai(e,i,o&&t&&3!==t.type_&&!ni(t.assigned_,r)?o.concat(r):void 0);if(ri(n,r,s),!Jr(s))return;e.canAutoFreeze_=!1}else s&&n.add(i);if(Yr(i)&&!a){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;if(t&&t.base_&&t.base_[r]===i&&a)return;Ai(e,i),t&&t.scope_.parent_||"symbol"==typeof r||!(ii(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))||Si(e,i)}}}function Si(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&li(t,n)}var Di={get(e,t){if(t===Fr)return e;const n=si(e);if(!ni(n,t))return function(e,t,n){const r=Li(t,n);return r?`value`in r?r.value:r.get?.call(e.draft_):void 0}(e,n,t);const r=n[t];return e.finalized_||!Yr(r)?r:r===xi(e.base_,t)?(Vi(e),e.copy_[t]=Ci(r,e)):r},has:(e,t)=>t in si(e),ownKeys:e=>Reflect.ownKeys(si(e)),set(e,t,n){const r=Li(si(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=xi(si(e),t),s=r?.[Fr];if(s&&s.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(((i=n)===(o=r)?0!==i||1/i==1/o:i!=i&&o!=o)&&(void 0!==n||ni(e.base_,t)))return!0;Vi(e),Ei(e)}var i,o;return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==xi(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,Vi(e),Ei(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=si(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){Zr(11)},getPrototypeOf:e=>Hr(e.base_),setPrototypeOf(){Zr(12)}},ki={};function xi(e,t){const n=e[Fr];return(n?si(n):e)[t]}function Li(e,t){if(!(t in e))return;let n=Hr(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=Hr(n)}}function Ei(e){e.modified_||(e.modified_=!0,e.parent_&&Ei(e.parent_))}function Vi(e){e.copy_||(e.copy_=ai(e.base_,e.scope_.immer_.useStrictShallowCopy_))}function Ci(e,t){const n=ii(e)?yi("MapSet").proxyMap_(e,t):oi(e)?yi("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:fi(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,o=Di;n&&(i=[r],o=ki);const{revoke:s,proxy:a}=Proxy.revocable(i,o);return r.draft_=a,r.revoke_=s,a}(e,t);return(t?t.scope_:fi()).drafts_.push(n),n}function _i(e){if(!Yr(e)||ui(e))return e;const t=e[Fr];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=ai(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=ai(e,!0);return ei(n,(e,t)=>{ri(n,e,_i(t))},r),t&&(t.finalized_=!1),n}ei(Di,(e,t)=>{ki[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),ki.deleteProperty=function(e,t){return ki.set.call(this,e,t,void 0)},ki.set=function(e,t,n){return Di.set.call(this,e[0],t,n,e[0])};var Ti=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(e,t,n)=>{if("function"==typeof e&&"function"!=typeof t){const n=t;t=e;const r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}let r;if("function"!=typeof t&&Zr(6),void 0!==n&&"function"!=typeof n&&Zr(7),Yr(e)){const i=wi(this),o=Ci(e,void 0);let s=!0;try{r=t(o),s=!1}finally{s?mi(i):gi(i)}return hi(i,n),bi(r,i)}if(!e||"object"!=typeof e){if(r=t(e),void 0===r&&(r=e),r===zr&&(r=void 0),this.autoFreeze_&&li(r,!0),n){const t=[],i=[];yi("Patches").generateReplacementPatches_(e,r,t,i),n(t,i)}return r}Zr(1)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;const i=this.produce(e,t,(e,t)=>{n=e,r=t});return[i,n,r]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),"boolean"==typeof e?.useStrictIteration&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Yr(e)||Zr(8),Jr(e)&&(e=function(e){return Jr(e)||Zr(10),_i(e)}(e));const t=wi(this),n=Ci(e,void 0);return n[Fr].isManual_=!0,gi(t),n}finishDraft(e,t){const n=e&&e[Fr];n&&n.isManual_||Zr(9);const{scope_:r}=n;return hi(r,t),bi(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>
1-1&&(t=t.slice(n+1));const r=yi("Patches").applyPatches_;return Jr(e)?r(e,t):this.produce(e,e=>r(e,t))}},$i=Ti.produce;null&&Ti.produceWithPatches.bind(Ti),null&&Ti.setAutoFreeze.bind(Ti),null&&Ti.setUseStrictShallowCopy.bind(Ti),null&&Ti.setUseStrictIteration.bind(Ti),null&&Ti.applyPatches.bind(Ti),null&&Ti.createDraft.bind(Ti),null&&Ti.finishDraft.bind(Ti);const Bi="sophi_analytics",Oi=W([j(),V()]),ji=_({campaignName:Oi,referrerDomain:Oi,referrerMedium:Oi,referrerSource:T(Oi,null),referrerChannel:T(Oi,null),queryParams:T(B(j(),j()),{}),timestamp:W([R(j(),m(e=>new Date(e)),D()),V()])}),Ii=_({session:ji}),Wi=_({campaignName:Oi,referrerDomain:Oi,referrerMedium:Oi,referrerSource:T(Oi,null),referrerChannel:T(Oi,null),queryParams:B(j(),j()),timestamp:W([D(),V()])}),Ui=_({session:Wi});class Ri{constructor(){this.campaignName=null,this.referrerDomain=null,this.referrerMedium=null,this.referrerSource=null,this.referrerChannel=null,this.queryParams={},this.timestamp=null}}const Mi=$(["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","countryCode"]),Ni=W([j(),C(),P()]),Gi=_({userProperties:B(Mi,Ni),visitor:Ii}),zi={userProperties:{},visitor:{session:new Ri}},qi=function(){document.hidden||this.update(()=>Fi(this.storage))},Fi=function(e){const t=e?.getItem(Bi);if(t)try{const e=JSON.parse(t);return U(Gi,e)}catch{return zi}return zi};class Zi{storage;state;#a;update=e=>{this.state=$i(this.state,e),this.storage&&this.storage.setItem(Bi,JSON.stringify(this.state));try{this.#a?.()}catch{}};constructor(e,t){this.storage=e,this.#a=t,this.state=$i(Fi(this.storage),()=>{}),document.addEventListener("visibilitychange",qi.bind(this))}}const Hi=30,Ji=()=>{qa.update(e=>{e.visitor.session.timestamp=new Date})},Yi=()=>{null===(null===qa.state.visitor.session.timestamp?null:((e,t)=>new Date(e.getTime()+6e4*t))(qa.state.visitor.session.timestamp,Hi).toISOString()<(new Date).toISOString()?(qa.update(e=>{e.visitor.session=new Ri}),null):qa.state.visitor.session)?((()=>{const e=/^(?:https?:\/\/)?([^/]+)/i;if("string"==typeof document.referrer){const t=document.referrer.match(e);null!==t&&qa.update(e=>{e.visitor.session.referrerDomain=t[1]})}})(),(()=>{try{const e=new URLSearchParams(window.location.search).get("utm_campaign");null!==e&&qa.update(t=>{t.visitor.session.campaignName=e.toLowerCase()})}catch{}})(),(()=>{const{medium:e,source:t,channel:n}=Gr();qa.update(r=>{r.visitor.session.referrerMedium=e,r.visitor.session.referrerSource=t??null,r.visitor.session.referrerChannel=n??null})})(),(()=>{const e=Cr();qa.update(t=>{t.visitor.session.queryParams=e})})(),Ji()):Ji()},Ki="sophiEventQueue",Xi=()=>{const e=Ki+"=",t=decodeURIComponent(document.cookie).split(";");for(let n=0;n<t.length;n++){let r=t[n].trimStart();if(r.startsWith(e)){const t=r.substring(e.length,r.length);try{return he(t)}catch(e){return[]}}}return[]},Qi=e=>e.trim().toLowerCase(),eo=new class{constructor(){this.serverWallDeferInputsToColdLayer=!0,this.isSubdomain=e=>{if(0===this.normalizedSubdomainAllowList.size)return!1;const t=window.location.hostname;return t!==this.normalizedMainHost&&this.normalizedSubdomainAllowList.has(t)},this.store=vr,this.heldInputEvents=[],this.normalizedMainHost=Qi(Yt.mainHost),this.normalizedSubdomainAllowList=new Set((Yt.subdomains??[]).map(Qi))}dispatch(e){switch(e.type){case wn.Init:this.handleInit();break;case wn.EnableAllFeatures:return this.handleEnableAllFeatures();case wn.GetDecision:this.handleGetDecision();break;case wn.GetDecisionForArticleWallIndicators:this.handleGetDecisionForArticleWallIndicators();break;case wn.Pageview:e.payload=M.parse(bn,e.payload);try{return this.handleSubdomainAwareEvent(e,this.handlePageview)}catch(e){ke.debug("Error in pageview event handler",e)}break;case wn.Wall:M.parse(An,e.payload);try{return this.handleSubdomainAwareEvent(e,this.handleWallHit)}catch(e){ke.debug("Error in wall event handler",e)}break;case wn.UserProperties:try{return this.handleSubdomainAwareEvent(e,this.handleUserProperties)}catch(e){ke.debug("Error in userProperties event handler",e)}break;case wn.ContentProperties:try{this.handleContentProperties()}catch(e){ke.debug("Error in contentProperties event handler",e)}break;default:throw new Error("Invalid event type")}}getDispatch(){return this.dispatch.bind(this)}finishServerWallInputBootstrap(){this.serverWallDeferInputsToColdLayer=!1}handleInit(){ke.debug("init handler"),this.dispatch({type:wn.ContentProperties})}handleEnableAllFeatures(){if(ke.info("⚙️ Received enableAllFeatures event"),Yt.mode.on(),this.store.setConsent(!0),window.sophi?.abTests?.enableConsent(),this.isSubdomain(Yt)&&!Yt.stateCookie.isEnabled)return!1;this.store.getFromStored();const e=this.processStoredEvents(),t=this.processHeldInputEvents();return Yi(),e||t}clearHeldInputEvents(){this.heldInputEvents=[]}processHeldInputEvents(){const e=this.heldInputEvents;
1return this.clearHeldInputEvents(),0!==e.length&&(e.forEach(e=>{ke.debug("Event processed from in-memory queue",e),e.type===wn.Pageview&&this.handlePageview(e.payload),e.type===wn.Wall&&this.handleWallHit(e.payload),e.type===wn.UserProperties&&this.handleUserProperties(e.payload)}),!0)}handleGetDecision(){ke.debug("getDecision event handler"),!0!==Yt.mode.isUserBehaviorDataAllowed||Yi()}handleGetDecisionForArticleWallIndicators(){ke.debug("getDecisionForArticleWallIndicators event handler"),!0!==Yt.mode.isUserBehaviorDataAllowed||Yi()}handlePageview(e){ke.info("🧮 Received pageview event",JSON.stringify(e,null,2));const{article:t,section:n}=e,r=this.store.getState();r.today.pageViews++,!0===t&&r.today.pageViewsByArticle++,"string"==typeof n&&n.length>0&&(!1===r.today.topLevelSections.includes(n)&&r.today.topLevelSections.push(n),!0===t&&!1===r.today.topLevelSectionsByArticle.includes(n)&&r.today.topLevelSectionsByArticle.push(n)),this.store.updateState(r)}handleWallHit(e){ke.info("🧮 Received wall event",JSON.stringify(e,null,2));const t=this.store.getState(),n="string"==typeof e?e:e.wallType;"paywall"===n?t.today.pageViewsByArticleWithPaywall++:"regwall"===n&&t.today.pageViewsByArticleWithRegwall++,this.store.updateState(t),"object"==typeof e&&!0===Yt.generatePageviewOnWallHit&&(ke.debug("Generating pageview from wall event"),this.handlePageview({article:!0,section:e.section}))}handleUserProperties(e){return Er(Yt,e)}handleContentProperties(){Un(Yt),Lr(Yt),ke.debug("handleContentProperties handler",Wn(Yt))}processSubdomainEvents(){if(this.isSubdomain(Yt))return!1;const e=Xi();return 0!==e.length&&(e.forEach(e=>{ke.debug("Event Processed from cookie",e),e.type===wn.Pageview?this.handlePageview(e.payload):e.type===wn.Wall?this.handleWallHit(e.payload):e.type===wn.UserProperties&&this.handleUserProperties(e.payload)}),document.cookie=`${Ki}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; domain=${Yt.hostname}; path=/`,!0)}processPreviousPageEvents(){let e=this.store.getState();const t=e.coldDataLayer.events;return 0!==t.length&&(t.forEach(e=>{ke.debug("Event processed from storage",e),e.type===wn.Pageview&&this.handlePageview(e.payload),e.type===wn.Wall&&this.handleWallHit(e.payload),e.type===wn.UserProperties&&this.handleUserProperties(e.payload)}),e=this.store.getState(),this.store.updateState({...e,coldDataLayer:{...e.coldDataLayer,events:[]}}),!0)}processStoredEvents(){if(!1===Yt.mode.isUserBehaviorDataAllowed||!1===Yt.mode.isDeviceAndLocationDataAllowed)return!1;const e=this.processPreviousPageEvents();let t=!1;try{t=this.processSubdomainEvents()}catch(e){ke.debug("Error processing subdomain events",e)}return e||t}handleSubdomainAwareEvent(e,t){if(this.isSubdomain(Yt)&&!Yt.stateCookie.isEnabled){try{const t=((e,t)=>{if(!0!==Yt.mode.isUserBehaviorDataAllowed)return!1;const n=Xi();return n.push({type:e,payload:t}),document.cookie=`${Ki}=${fe(n)}; domain=${Yt.hostname}; path=/; max-age=${Fe};`,!0})(e.type,e.payload);t&&ke.debug(`Pushed ${e.type} event to cookie:`,e.payload)}catch(t){ke.debug(`Error pushing ${e.type} event to cookie`,t)}return!1}return this.processOrStoreInputEvent(e,t)}storeInputEvent(e){const t=this.store.getState();return this.store.updateState({...t,coldDataLayer:{...t.coldDataLayer,events:[...t.coldDataLayer.events,e]}}),ke.debug("Stored event",e),!0}processOrStoreInputEvent(e,t){return!0===Yt.mode.isUserBehaviorDataAllowed?(Yi(),"server"===Yt.wallGeneration.type&&this.serverWallDeferInputsToColdLayer?this.storeInputEvent(e):(t.call(this,e.payload),!0)):!0===Yt.holdInputEventsUntilConsent?(this.heldInputEvents.push(e),ke.debug(`Holding ${e.type} event until consent`),!1):(ke.debug(`Discarding ${e.type} event`),!1)}},to=eo;function no(e){return void 0!==e?{wallProperties:e}:{}}function ro(e){return e.replace(/[_-]+([a-zA-Z0-9])/g,(e,t)=>t.toUpperCase())}function io(e){if(void 0!==e.default&&Ge(e.default,e))return e.default}function oo(e){const t=Yt.wallProperties;if(void 0===t)return;const n=t.filter(e=>!1!==e.tracked).map(t=>{const n=e?.[ro(t.key)];return void 0===n?null:[t.key,n]}).filter(e=>null!==e);return 0===n.length?"":n.map(([e,t])=>`${e}:${t}`).join(",")}function so(e,t={}){if(void 0===Yt.wallProperties){const{wallProperties:t,outcome:n,...r}=e,{wallProperties:i,...o}=n;return{...r,outcome:o}}const n=function(){const e=new Map;for(const t of Yt.wallProperties||[])e.set(t.key,t),e.set(ro(t.key),t);return e}(),r={};for(const[t,i]of Object.entries(e.outcome.wallProperties??{})){const e=n.get(t);if(e){if(!Ge(i,e)){const n="enum"===e.type?`one of [${Ne(e).join(", ")}]`:e.type;ke.debug(`Wall property ${t} expected ${n} but got ${typeof i}, omitting from outcome.`);continue}r[ro(e.key)]=i}else ke.debug(`Wall property ${t} is not configured, omitting from outcome.`)}for(const[e,i]of Object.entries(t)){const t=n.get(e);if(t){if(!Ge(i,t)){const n="enum"===t.type?`one of [${Ne(t).join(", ")}]`:t.type;ke.warn(`Wall property override ${e} expected ${n} but got ${typeof i}, omitting.`);continue}r[ro(t.key)]=i}else ke.warn(`Wall property override ${e} is not configured, omitting.`)}return{...e,wallProperties:oo(r),outcome:{...e.outcome,wallProperties:r}}}const ao=M.object({[G.PAYWALL]:M.number(),[G.REGWALL]:M.optional(M.number())}),lo=!0;function co(e){let t=0,n=.13,r=0;r=lo?Math.random():.5;let i=Math.round(10*e.todayPageViewsByArticleWithPaywall/e.todayPageViewsByArticle)/10,o=e.todayPageViewsByArticle+e.sevenDayPageViewsByArticle+e.twentyEightDayPageViewsByArticle,s=e.todayPageViews+e.sevenDayPageViews+e.twentyEightDayPageViews,a=e.visitor.session.timestamp?.getDay(),l="undefined";"number"==typeof a&&(l=["weekends","weekdays","weekdays","weekdays","weekdays","weekdays","weekends"][a]);let c=e.viewer.toLowerCase(),u=e.referrer.toLowerCase(),p=e.twentyEightDayVisitCount+e.sevenDayVisitCount,d=Math.max(e.twentyEightDayTopLevelSections,e.sevenDayTopLevelSections,e.todayTopLevelSections,0),y=e.visitor.session.referrerMedium+e.referrer;"string"==typeof y&&(y=y.toLowerCase());let f=Math.max(e.twentyEightDayTopLevelSectionsByArticle,e.sevenDayTopLevelSectionsByArticle,e.todayTopLevelSectionsByArticle,0);const h="zlzu!8!kqtb3y6@a"===new URLSearchParams(window.location.search).get("cu_id")?.toLowerCase();let m=e.type;""!==m&&null!==m||(m="other");let g=m+e.os;
1"string"==typeof g&&(g=g.toLowerCase());let w=e.os;"string"==typeof w&&(w=w.toLowerCase());let v="";"string"==typeof e.viewer&&(v=e.viewer.toLowerCase());let b=e.todayPageViewsByArticle,A=0;"othermac os"===g&&(A=1);let P=0;"mobileios"===g&&(P=1);let S=0;"mobileandroid"===g&&(S=1);let D=0;"mobilewindows"===g&&(D=1);let k=0;"internal"===u&&(k=1);let x=0;"search"===u&&(x=1);let L=0;"direct"===u&&(L=1);let E=0;"safari"===v&&(E=1);let V=0;"mobile safari"===v&&(V=1);let C=0;"chrome"===v&&(C=1);let _=0;"gsa"===v&&(_=1);let T=e.hourOfDay,$=0;"America/Toronto"===e.timeZone&&($=1);let B=0;"America/Vancouver"===e.timeZone&&(B=1);let O=0;"America/Edmonton"===e.timeZone&&(O=1);let j=0;"America/New_York"===e.timeZone&&(j=1);let I=e.daysSinceLastVisit,W=e.twentyEightDayTopLevelSections,U=e.todayPageViews,R=e.sevenDayPageViewsByArticle,M=e.twentyEightDayPageViews,N=e.sevenDayTopLevelSections,z=e.twentyEightDayVisitCount,q=e.twentyEightDayPageViewsByArticleWithPaywall,F=e.sevenDayPageViews,Z=e.sevenDayVisitCount,H=e.sevenDayTopLevelSectionsByArticle,J=e.twentyEightDayPageViewsByArticle,Y=e.twentyEightDayTopLevelSectionsByArticle,K=Math.round(10*e.twentyEightDayPageViewsByArticleWithPaywall/e.twentyEightDayPageViewsByArticle)/10,X=0,Q=0,ee=e.visitor.session.referrerMedium;"string"==typeof ee&&(ee=ee.toLowerCase()),"campaign"===ee&&(X=1),"search"===ee&&(Q=1);let te=0;"www.google.com"===e.visitor.session.referrerDomain&&(te=1);let ne=0;"news.google.com"===e.visitor.session.referrerDomain&&(ne=1);let re=0;re="anonymous"===e.visitorType?S<=.5?_<=.5?ne<=.5?W<=6.5?b<=.5?A<=.5?.08:.119:te<=.5?.1:.24:F<=.5?.096:W<=22.5?.026:.002:E<=.5?$<=.5?V<=.5?.016:.042:P<=.5?.06:.015:T<=13?U<=3.5?.029:.012:B<=.5?.003:.018:k<=.5?W<=4.5?F<=1.5?O<=.5?.023:.009:T<=13?.053:.023:Y<=2.5?0:.022:$<=.5?.051:.079:x<=.5?X<=.5?te<=.5?C<=.5?T<=13?.027:.006:$<=.5?.027:.074:R<=.5?.019:.122:.118:te<=.5?q<=1.5?Z<=.5?O<=.5?.009:.023:I<=.5?.028:.009:K<=.75?.021:Y<=2.5?.007:.001:R<=.5?C<=.5?.058:N<=.5?.026:.018:.072:W<=1.5?z<=2.5?J<=4.5?S<=.5?F<=4.5?L<=.5?.052:.08:H<=.5?0:.022:R<=.5?U<=4.5?.003:.018:T<=15?.048:.017:j<=.5?J<=72.5?D<=.5?.008:.029:W<=.5?.013:.043:.044:P<=.5?K<=.35?.136:J<=47.5?U<=2.5?.016:.073:R<=1.5?.125:.066:.023:W<=12.5?z<=6.5?M<=.5?W<=6.5?Z<=4.5?.027:.008:b<=.5?.006:.015:.07:.078:F<=2.5?C<=.5?.037:.005:Z<=4.5?K<=.05?U<=1.5?0:.029:Q<=.5?.009:0:x<=.5?0:.009,"anonymous"===e.visitorType&&(0===e.daysSinceLastVisit&&(t+=.06*n),1===e.daysSinceLastVisit&&(t+=-.32*n),2===e.daysSinceLastVisit&&(t+=-.4*n),3===e.daysSinceLastVisit&&(t+=-.48*n),4===e.daysSinceLastVisit&&(t+=-.68*n),5===e.daysSinceLastVisit&&(t+=-.64*n),0===e.hourOfDay&&(t+=-.1*n),2===e.hourOfDay&&(t+=-.14*n),4===e.hourOfDay&&(t+=-.06*n),6===e.hourOfDay&&(t+=.06*n),8===e.hourOfDay&&(t+=.05*n),10===e.hourOfDay&&(t+=-.02*n),12===e.hourOfDay&&(t+=.26*n),14===e.hourOfDay&&(t+=.17*n),16===e.hourOfDay&&(t+=.15*n),18===e.hourOfDay&&(t+=.13*n),20===e.hourOfDay&&(t+=-.05*n),22===e.hourOfDay&&(t+=-.15*n),"campaign"===e.referrer&&(t+=.48*n),"direct"===e.referrer&&(t+=.14*n),"internal"===e.referrer&&(t+=.32*n),"other"===e.referrer&&(t+=.1*n),"search"===e.referrer&&(t+=-.06*n),"social"===e.referrer&&(t+=-.17*n),"America/Chicago"===e.timeZone&&(t+=.13*n),"America/Denver"===e.timeZone&&(t+=.23*n),"America/Edmonton"===e.timeZone&&(t+=-.14*n),"America/Halifax"===e.timeZone&&(t+=.11*n),"America/Los_Angeles"===e.timeZone&&(t+=-.06*n),"America/Moncton"===e.timeZone&&(t+=-.52*n),"America/New_York"===e.timeZone&&(t+=.22*n),"America/Phoenix"===e.timeZone&&(t+=-.09*n),"America/Regina"===e.timeZone&&(t+=-.28*n),"America/St_Johns"===e.timeZone&&(t+=-.2*n),"America/Toronto"===e.timeZone&&(t+=.07*n),"America/Vancouver"===e.timeZone&&(t+=-.05*n),"America/Winnipeg"===e.timeZone&&(t+=-.16*n),"Asia/Calcutta"===e.timeZone&&(t+=.34*n),"Asia/Shanghai"===e.timeZone&&(t+=-.85*n),"Asia/Singapore"===e.timeZone&&(t+=-.04*n),"Australia/Sydney"===e.timeZone&&(t+=-.31*n),"Europe/Berlin"===e.timeZone&&(t+=-.04*n),"Europe/Dublin"===e.timeZone&&(t+=-.59*n),"Europe/London"===e.timeZone&&(t+=-.08*n),"Europe/Madrid"===e.timeZone&&(t+=-.17*n),"Europe/Paris"===e.timeZone&&(t+=.48*n),"UTC"===e.timeZone&&(t+=-.99*n),0===e.todayPageViews&&(t+=.07*n),1===e.todayPageViews&&(t+=-.12*n),2===e.todayPageViews&&(t+=-.15*n),3===e.todayPageViews&&(t+=-.27*n),4===e.todayPageViews&&(t+=-.17*n),5===e.todayPageViews&&(t+=-.21*n),0===e.todayPageViewsByArticle&&(t+=-.04*n),1===e.todayPageViewsByArticle&&(t+=.3*n),2===e.todayPageViewsByArticle&&(t+=.46*n),3===e.todayPageViewsByArticle&&(t+=.48*n),4===e.todayPageViewsByArticle&&(t+=.44*n),5===e.todayPageViewsByArticle&&(t+=.53*n),e.todayPageViewsByArticle>=10&&e.todayPageViewsByArticle<=14&&(t+=-.33*n),"chrome"===c&&(t+=.2*n),"chrome webview"===c&&(t+=-.97*n),"edge"===c&&(t+=.67*n),"facebook"===c&&(t+=.04*n),"firefox"===c&&(t+=-.02*n),"gsa"===c&&(t+=-.54*n),"mobile safari"===c&&(t+=-.34*n),"safari"===c&&(t+=-.42*n),"samsung browser"===c&&(t+=-.17*n),"webkit"===c&&(t+=-.81*n),"android-app:"===e.visitor.session.referrerDomain&&(t+=-.02*n),"apple.news"===e.visitor.session.referrerDomain&&(t+=2.08*n),"flipboard.com"===e.visitor.session.referrerDomain&&(t+=-.9*n),"go.bsky.app"===e.visitor.session.referrerDomain&&(t+=.1*n),"m.facebook.com"===e.visitor.session.referrerDomain&&(t+=-.53*n),"news.google.com"===e.visitor.session.referrerDomain&&(t+=-.21*n),"other"===e.visitor.session.referrerDomain&&(t+=.17*n),"t.co"===e.visitor.session.referrerDomain&&(t+=-.21*n),"www.bing.com"===e.visitor.session.referrerDomain&&(t+=.61*n),"www.google.ca"===e.visitor.session.referrerDomain&&(t+=-.44*n),"www.google.com"===e.visitor.session.referrerDomain&&(t+=-.01*n),"www.linkedin.com"===e.visitor.session.referrerDomain&&(t+=.8*n),"www.reddit.com"===e.visitor.session.referrerDomain&&(t+=-.59*n),"www.theglobeandmail.com"===e.visitor.session.referrerDomain&&(t+=-.07*n),"campaign"===e.visitor.session.referrerMedium&&(t+=.41*n),"direct"===e.visitor.session.referrerMedium&&(t+=.12*n),"internal"===e.visitor.session.referrerMedium&&(t+=-.05*n),"other"===e.visitor.session.referrerMedium&&(t+=.16*n),"search"===e.visitor.session.referrerMedium&&(t+=-.03*n),"s
1ocial"===e.visitor.session.referrerMedium&&(t+=-.16*n),0===o&&(t+=.06*n),1===o&&(t+=-.23*n),2===o&&(t+=-.41*n),3===o&&(t+=-.23*n),4===o&&(t+=-.28*n),5===o&&(t+=-.39*n),6===o&&(t+=-.12*n),7===o&&(t+=-.34*n),8===o&&(t+=-.08*n),9===o&&(t+=-.07*n),o>=10&&o<=14&&(t+=.11*n),o>=15&&o<=19&&(t+=.39*n),o>=20&&o<=24&&(t+=.3*n),o>=95&&o<=99&&(t+=-.29*n),0===s&&(t+=.03*n),1===s&&(t+=-.36*n),2===s&&(t+=-.29*n),3===s&&(t+=-.47*n),4===s&&(t+=-.72*n),0===d&&(t+=.12*n),1===d&&(t+=-.11*n),2===d&&(t+=-.23*n),3===d&&(t+=-.37*n),4===d&&(t+=-.34*n),5===d&&(t+=-.4*n),6===d&&(t+=-.65*n),7===d&&(t+=-.37*n),8===d&&(t+=-.48*n),9===d&&(t+=-.49*n),d>=10&&d<=14&&(t+=-.47*n),d>=15&&d<=19&&(t+=-.51*n),d>=20&&d<=24&&(t+=-.57*n),d>=60&&d<=64&&(t+=-.87*n),0===f&&(t+=.06*n),1===f&&(t+=-.24*n),2===f&&(t+=-.28*n),3===f&&(t+=-.22*n),4===f&&(t+=-.27*n),5===f&&(t+=-.07*n),6===f&&(t+=.09*n),f>=10&&f<=14&&(t+=-.03*n),0===p&&(t+=.06*n),1===p&&(t+=-.22*n),2===p&&(t+=-.35*n),3===p&&(t+=-.43*n),4===p&&(t+=-.44*n),5===p&&(t+=.21*n),p>=10&&p<=14&&(t+=-.33*n),0===K&&(t+=.05*n),.1===K&&(t+=-.4*n),.2===K&&(t+=.27*n),.3===K&&(t+=.39*n),.5===K&&(t+=.04*n),.6===K&&(t+=.51*n),.7===K&&(t+=.78*n),.8===K&&(t+=.48*n),1===K&&(t+=-.38*n),"weekdays"===l&&(t+=.01*n),"weekends"===l&&(t+=-.02*n),"campaigncampaign"===y&&(t+=.47*n),"campaigninternal"===y&&(t+=.28*n),"directdirect"===y&&(t+=.14*n),"directinternal"===y&&(t+=.01*n),"internalinternal"===y&&(t+=-.09*n),"otherother"===y&&(t+=.07*n),"searchdirect"===y&&(t+=.1*n),"searchinternal"===y&&(t+=.78*n),"searchsearch"===y&&(t+=-.07*n),"socialsocial"===y&&(t+=-.21*n),0===i&&(t+=.56*n),.5===i&&(t+=.06*n),1===i&&(t+=-.17*n),"mobileandroid"===g&&(t+=.1*n),"mobileios"===g&&(t+=-.46*n),"mobilemac os"===g&&(t+=1.45*n),"mobilewindows"===g&&(t+=3.9*n),"otherchromium os"===g&&(t+=2.04*n),"otherlinux"===g&&(t+=-.34*n),"othermac os"===g&&(t+=.11*n),"otherwindows"===g&&(t+=.37*n),"tabletandroid"===g&&(t+=-.03*n),"tabletios"===g&&(t+=-.56*n),"tabletmac os"===g&&(t+=-.48*n));let ie=.5+re+0,oe=.5+t;return lo&&(ie+=.01*(r-.5)),lo&&(oe+=.01*(r-.5)),ie<=.01?ie=.01:ie>1&&(ie=1),oe<=.01?oe=.01:oe>1&&(oe=1),"search"===e.referrerData.medium&&"google"===e.referrerData.source&&"discover"===e.referrerData.channel&&ie<.4&&(ie=0),h&&(ie=0),{[G.PAYWALL]:ie,[G.REGWALL]:oe}}const uo=!0,po=M.object({todayPageViews:M.number(),todayPageViewsByArticle:M.number(),todayPageViewsByArticleWithPaywall:M.number(),todayPageViewsByArticleWithRegwall:M.number(),todayTopLevelSections:M.number(),todayTopLevelSectionsByArticle:M.number(),sevenDayPageViews:M.number(),sevenDayPageViewsByArticle:M.number(),sevenDayPageViewsByArticleWithPaywall:M.number(),sevenDayPageViewsByArticleWithRegwall:M.number(),sevenDayTopLevelSections:M.number(),sevenDayTopLevelSectionsByArticle:M.number(),sevenDayVisitCount:M.number(),twentyEightDayPageViews:M.number(),twentyEightDayPageViewsByArticle:M.number(),twentyEightDayPageViewsByArticleWithPaywall:M.number(),twentyEightDayPageViewsByArticleWithRegwall:M.number(),twentyEightDayTopLevelSections:M.number(),twentyEightDayTopLevelSectionsByArticle:M.number(),twentyEightDayVisitCount:M.number(),daysSinceLastVisit:M.number(),timeZone:M.string(),referrer:M.string(),referrerData:M.object({medium:M.union([M.string(),M.null_()]),source:M.optional(M.union([M.string(),M.null_()])),channel:M.optional(M.union([M.string(),M.null_()])),queryParams:M.record(M.string(),M.string())}),hourOfDay:M.number(),localDayOfWeek:M.number(),localHourOfDay:M.number(),os:M.string(),type:M.string(),viewer:M.string(),visitorType:M.string(),visitor:Ui,userProperties:M.record(Mi,Ni),contentProperties:M.record(Oe,je)});function yo(e){return M.safeParse(po,e).success}const fo=new class{constructor(){this.fallback={[G.PAYWALL]:0}}evaluate(e){try{const t=function(e){if(!function(e){return"todayPageViews"in e}(e))return function(){let e=Math.random();return e<=.1?e=.1:e>=1&&(e=.99),{[G.PAYWALL]:e}}();switch(e.assignedGroup||"control"){case"variant":return function(e){let t=.5,n=.13,r=0,i=.13,o=0;o=uo?Math.random():.5;let s=Math.round(10*e.todayPageViewsByArticleWithPaywall/e.todayPageViewsByArticle)/10,a=e.todayPageViewsByArticle+e.sevenDayPageViewsByArticle+e.twentyEightDayPageViewsByArticle,l=e.todayPageViews+e.sevenDayPageViews+e.twentyEightDayPageViews,c=e.visitor.session.timestamp?.getDay(),u="undefined";"number"==typeof c&&(u=["weekends","weekdays","weekdays","weekdays","weekdays","weekdays","weekends"][c]);let p=e.viewer.toLowerCase(),d=e.referrer.toLowerCase(),y=e.twentyEightDayVisitCount+e.sevenDayVisitCount,f=M
1ath.max(e.twentyEightDayTopLevelSections,e.sevenDayTopLevelSections,e.todayTopLevelSections,0),h=e.visitor.session.referrerMedium+e.referrer;"string"==typeof h&&(h=h.toLowerCase());let m=Math.max(e.twentyEightDayTopLevelSectionsByArticle,e.sevenDayTopLevelSectionsByArticle,e.todayTopLevelSectionsByArticle,0),g=e.type;""!==g&&null!==g||(g="other");let w=g+e.os;"string"==typeof w&&(w=w.toLowerCase());let v=e.os;"string"==typeof v&&(v=v.toLowerCase());const b="zlzu!8!kqtb3y6@a"===new URLSearchParams(window.location.search.toLowerCase()).get("cu_id");let A="";"string"==typeof e.viewer&&(A=e.viewer.toLowerCase());let P=e.userProperties["1"];"string"==typeof P&&(P=P.toLowerCase());let S=e.userProperties["2"];"string"==typeof S&&(S=S.toLowerCase());let D=e.userProperties["3"];"string"==typeof D&&(D=D.toLowerCase());let k=e.userProperties["4"];"string"==typeof k&&(k=k.toLowerCase());let x=e.todayPageViewsByArticle,L=0;"othermac os"===w&&(L=1);let E=0;"mobileios"===w&&(E=1);let V=0;"mobileandroid"===w&&(V=1);let C=0;"mobilewindows"===w&&(C=1);let _=0;"internal"===d&&(_=1);let T=0;"search"===d&&(T=1);let $=0;"direct"===d&&($=1);let B=0;"safari"===A&&(B=1);let O=0;"mobile safari"===A&&(O=1);let j=0;"chrome"===A&&(j=1);let I=0;"gsa"===A&&(I=1);let W=e.hourOfDay,U=0;"America/Toronto"===e.timeZone&&(U=1);let R=0;"America/Vancouver"===e.timeZone&&(R=1);let M=0;"America/Edmonton"===e.timeZone&&(M=1);let N=0;"America/New_York"===e.timeZone&&(N=1);let z=e.daysSinceLastVisit,q=e.twentyEightDayTopLevelSections,F=e.todayPageViews,Z=e.sevenDayPageViewsByArticle,H=e.twentyEightDayPageViews,J=e.sevenDayTopLevelSections,Y=e.twentyEightDayVisitCount,K=e.twentyEightDayPageViewsByArticleWithPaywall,X=e.sevenDayPageViews,Q=e.sevenDayVisitCount,ee=e.sevenDayTopLevelSectionsByArticle,te=e.twentyEightDayPageViewsByArticle,ne=e.twentyEightDayTopLevelSectionsByArticle,re=Math.round(10*e.twentyEightDayPageViewsByArticleWithPaywall/e.twentyEightDayPageViewsByArticle)/10,ie=0,oe=0,se=e.visitor.session.referrerMedium;"string"==typeof se&&(se=se.toLowerCase()),"campaign"===se&&(ie=1),"search"===se&&(oe=1);let ae=0;"www.google.com"===e.visitor.session.referrerDomain&&(ae=1);let le=0;"news.google.com"===e.visitor.session.referrerDomain&&(le=1);let ce=0;ce="anonymous"===e.visitorType?V<=.5?I<=.5?le<=.5?q<=6.5?x<=.5?L<=.5?.08:.119:ae<=.5?.1:.24:X<=.5?.096:q<=22.5?.026:.002:B<=.5?U<=.5?O<=.5?.016:.042:E<=.5?.06:.015:W<=13?F<=3.5?.029:.012:R<=.5?.003:.018:_<=.5?q<=4.5?X<=1.5?M<=.5?.023:.009:W<=13?.053:.023:ne<=2.5?0:.022:U<=.5?.051:.079:T<=.5?ie<=.5?ae<=.5?j<=.5?W<=13?.027:.006:U<=.5?.027:.074:Z<=.5?.019:.122:.118:ae<=.5?K<=1.5?Q<=.5?M<=.5?.009:.023:z<=.5?.028:.009:re<=.75?.021:ne<=2.5?.007:.001:Z<=.5?j<=.5?.058:J<=.5?.026:.018:.072:q<=1.5?Y<=2.5?te<=4.5?V<=.5?X<=4.5?$<=.5?.052:.08:ee<=.5?0:.022:Z<=.5?F<=4.5?.003:.018:W<=15?.048:.017:N<=.5?te<=72.5?C<=.5?.008:.029:q<=.5?.013:.043:.044:E<=.5?re<=.35?.136:te<=47.5?F<=2.5?.016:.073:Z<=1.5?.125:.066:.023:q<=12.5?Y<=6.5?H<=.5?q<=6.5?Q<=4.5?.027:.008:x<=.5?.006:.015:.07:.078:X<=2.5?j<=.5?.037:.005:Q<=4.5?re<=.05?F<=1.5?0:.029:oe<=.5?.009:0:T<=.5?0:.009;let ue=0;"false"===k&&(ue+=0*n),"false"===D&&(ue+=.3303317535545*n),"true"===D&&(ue+=.9492890995261*n),"null"===D&&(ue+=-.0016587677725*n),"false"===S&&(ue+=0*n),"not empty"===P&&(ue+=-.036018957346*n),"null"===P&&(ue+=.000473933649299996*n);let pe,de=0;"false"===k&&(de+=-.0012361743656*n),"true"===k&&(de+=.0187215354587*n),"false"===D&&(de+=-.0089134677944*n),"true"===D&&(de+=.0231945348081*n),"null"===D&&(de+=.1501301236174*n),"true"===S&&(de+=.000569290826299995*n),"not empty"===P&&(de+=-.000585556278499999*n),"null"===P&&(de+=.00029277813919999*n),"anonymous"===e.visitorType&&(0===e.daysSinceLastVisit&&(r+=.06*i),1===e.daysSinceLastVisit&&(r+=-.32*i),2===e.daysSinceLastVisit&&(r+=-.4*i),3===e.daysSinceLastVisit&&(r+=-.48*i),4===e.daysSinceLastVisit&&(r+=-.68*i),5===e.daysSinceLastVisit&&(r+=-.64*i),0===e.hourOfDay&&(r+=-.1*i),2===e.hourOfDay&&(r+=-.14*i),4===e.hourOfDay&&(r+=-.06*i),6===e.hourOfDay&&(r+=.06*i),8===e.hourOfDay&&(r+=.05*i),10===e.hourOfDay&&(r+=-.02*i),12===e.hourOfDay&&(r+=.26*i),14===e.hourOfDay&&(r+=.17*i),16===e.hourOfDay&&(r+=.15*i),18===e.hourOfDay&&(r+=.13*i),20===e.hourOfDay&&(r+=-.05*i),22
1===e.hourOfDay&&(r+=-.15*i),"campaign"===e.referrer&&(r+=.48*i),"direct"===e.referrer&&(r+=.14*i),"internal"===e.referrer&&(r+=.32*i),"other"===e.referrer&&(r+=.1*i),"search"===e.referrer&&(r+=-.06*i),"social"===e.referrer&&(r+=-.17*i),"America/Chicago"===e.timeZone&&(r+=.13*i),"America/Denver"===e.timeZone&&(r+=.23*i),"America/Edmonton"===e.timeZone&&(r+=-.14*i),"America/Halifax"===e.timeZone&&(r+=.11*i),"America/Los_Angeles"===e.timeZone&&(r+=-.06*i),"America/Moncton"===e.timeZone&&(r+=-.52*i),"America/New_York"===e.timeZone&&(r+=.22*i),"America/Phoenix"===e.timeZone&&(r+=-.09*i),"America/Regina"===e.timeZone&&(r+=-.28*i),"America/St_Johns"===e.timeZone&&(r+=-.2*i),"America/Toronto"===e.timeZone&&(r+=.07*i),"America/Vancouver"===e.timeZone&&(r+=-.05*i),"America/Winnipeg"===e.timeZone&&(r+=-.16*i),"Asia/Calcutta"===e.timeZone&&(r+=.34*i),"Asia/Shanghai"===e.timeZone&&(r+=-.85*i),"Asia/Singapore"===e.timeZone&&(r+=-.04*i),"Australia/Sydney"===e.timeZone&&(r+=-.31*i),"Europe/Berlin"===e.timeZone&&(r+=-.04*i),"Europe/Dublin"===e.timeZone&&(r+=-.59*i),"Europe/London"===e.timeZone&&(r+=-.
108*i),"Europe/Madrid"===e.timeZone&&(r+=-.17*i),"Europe/Paris"===e.timeZone&&(r+=.48*i),"UTC"===e.timeZone&&(r+=-.99*i),0===e.todayPageViews&&(r+=.07*i),1===e.todayPageViews&&(r+=-.12*i),2===e.todayPageViews&&(r+=-.15*i),3===e.todayPageViews&&(r+=-.27*i),4===e.todayPageViews&&(r+=-.17*i),5===e.todayPageViews&&(r+=-.21*i),0===e.todayPageViewsByArticle&&(r+=-.04*i),1===e.todayPageViewsByArticle&&(r+=.3*i),2===e.todayPageViewsByArticle&&(r+=.46*i),3===e.todayPageViewsByArticle&&(r+=.48*i),4===e.todayPageViewsByArticle&&(r+=.44*i),5===e.todayPageViewsByArticle&&(r+=.53*i),e.todayPageViewsByArticle>=10&&e.todayPageViewsByArticle<=14&&(r+=-.33*i),"chrome"===p&&(r+=.2*i),"chrome webview"===p&&(r+=-.97*i),"edge"===p&&(r+=.67*i),"facebook"===p&&(r+=.04*i),"firefox"===p&&(r+=-.02*i),"gsa"===p&&(r+=-.54*i),"mobile safari"===p&&(r+=-.34*i),"safari"===p&&(r+=-.42*i),"samsung browser"===p&&(r+=-.17*i),"webkit"===p&&(r+=-.81*i),"android-app:"===e.visitor.session.referrerDomain&&(r+=-.02*i),"apple.news"===e.visitor.session.referrerDomain&&(r+=2.08*i),"flipboard.com"===e.visitor.session.referrerDomain&&(r+=-.9*i),"go.bsky.app"===e.visitor.session.referrerDomain&&(r+=.1*i),"m.facebook.com"===e.visitor.session.referrerDomain&&(r+=-.53*i),"news.google.com"===e.visitor.session.referrerDomain&&(r+=-.21*i),"other"===e.visitor.session.referrerDomain&&(r+=.17*i),"t.co"===e.visitor.session.referrerDomain&&(r+=-.21*i),"www.bing.com"===e.visitor.session.referrerDomain&&(r+=.61*i),"www.google.ca"===e.visitor.session.referrerDomain&&(r+=-.44*i),"www.google.com"===e.visitor.session.referrerDomain&&(r+=-.01*i),"www.linkedin.com"===e.visitor.session.referrerDomain&&(r+=.8*i),"www.reddit.com"===e.visitor.session.referrerDomain&&(r+=-.59*i),"www.theglobeandmail.com"===e.visitor.session.referrerDomain&&(r+=-.07*i),"campaign"===e.visitor.session.referrerMedium&&(r+=.41*i),"direct"===e.visitor.session.referrerMedium&&(r+=.12*i),"internal"===e.visitor.session.referrerMedium&&(r+=-.05*i),"other"===e.visitor.session.referrerMedium&&(r+=.16*i),"search"===e.visitor.session.referrerMedium&&(r+=-.03*i),"social"===e.visitor.session.referrerMedium&&(r+=-.16*i),0===a&&(r+=.06*i),1===a&&(r+=-.23*i),2===a&&(r+=-.41*i),3===a&&(r+=-.23*i),4===a&&(r+=-.28*i),5===a&&(r+=-.39*i),6===a&&(r+=-.12*i),7===a&&(r+=-.34*i),8===a&&(r+=-.08*i),9===a&&(r+=-.07*i),a>=10&&a<=14&&(r+=.11*i),a>=15&&a<=19&&(r+=.39*i),a>=20&&a<=24&&(r+=.3*i),a>=95&&a<=99&&(r+=-.29*i),0===l&&(r+=.03*i),1===l&&(r+=-.36*i),2===l&&(r+=-.29*i),3===l&&(r+=-.47*i),4===l&&(r+=-.72*i),0===f&&(r+=.12*i),1===f&&(r+=-.11*i),2===f&&(r+=-.23*i),3===f&&(r+=-.37*i),4===f&&(r+=-.34*i),5===f&&(r+=-.4*i),6===f&&(r+=-.65*i),7===f&&(r+=-.37*i),8===f&&(r+=-.48*i),9===f&&(r+=-.49*i),f>=10&&f<=14&&(r+=-.47*i),f>=15&&f<=19&&(r+=-.51*i),f>=20&&f<=24&&(r+=-.57*i),f>=60&&f<=64&&(r+=-.87*i),0===m&&(r+=.06*i),1===m&&(r+=-.24*i),2===m&&(r+=-.28*i),3===m&&(r+=-.22*i),4===m&&(r+=-.27*i),5===m&&(r+=-.
107*i),6===m&&(r+=.09*i),m>=10&&m<=14&&(r+=-.03*i),0===y&&(r+=.06*i),1===y&&(r+=-.22*i),2===y&&(r+=-.35*i),3===y&&(r+=-.43*i),4===y&&(r+=-.44*i),5===y&&(r+=.21*i),y>=10&&y<=14&&(r+=-.33*i),0===re&&(r+=.05*i),.1===re&&(r+=-.4*i),.2===re&&(r+=.27*i),.3===re&&(r+=.39*i),.5===re&&(r+=.04*i),.6===re&&(r+=.51*i),.7===re&&(r+=.78*i),.8===re&&(r+=.48*i),1===re&&(r+=-.38*i),"weekdays"===u&&(r+=.01*i),"weekends"===u&&(r+=-.02*i),"campaigncampaign"===h&&(r+=.47*i),"campaigninternal"===h&&(r+=.28*i),"directdirect"===h&&(r+=.14*i),"directinternal"===h&&(r+=.01*i),"internalinternal"===h&&(r+=-.09*i),"otherother"===h&&(r+=.07*i),"searchdirect"===h&&(r+=.1*i),"searchinternal"===h&&(r+=.78*i),"searchsearch"===h&&(r+=-.07*i),"socialsocial"===h&&(r+=-.21*i),0===s&&(r+=.56*i),.5===s&&(r+=.06*i),1===s&&(r+=-.17*i),"mobileandroid"===w&&(r+=.1*i),"mobileios"===w&&(r+=-.46*i),"mobilemac os"===w&&(r+=1.45*i),"mobilewindows"===w&&(r+=3.9*i),"otherchromium os"===w&&(r+=2.04*i),"otherlinux"===w&&(r+=-.34*i),"othermac os"===w&&(r+=.11*i),"otherwindows"===w&&(r+=.37*i),"tabletandroid"===w&&(r+=-.03*i),"tabletios"===w&&(r+=-.56*i),"tabletmac os"===w&&(r+=-.48*i)),pe="anonymous"===e.visitorType?t+ce+ue:t+ce+de;let ye=.5+r;return uo&&(pe+=.01*(o-.5)),uo&&(ye+=.01*(o-.5)),pe<=.01?pe=.01:pe>1&&(pe=1),ye<=.01?ye=.01:ye>1&&(ye=1),"search"===e.referrerData.medium&&"google"===e.referrerData.source&&"discover"===e.referrerData.channel&&pe<.4&&(pe=0),b&&(pe=0),{[G.PAYWALL]:pe,[G.REGWALL]:ye}}(e);case"holdout":return function(e){return co(e)}(e);default:return co(e)}}(e);return M.parse(ao,t)}catch(t){return ke.debug("Invalid ModelScores returned by `predict`, using fallback.",e,t),un(en.ModelEvalFailed),this.fallback}}},ho=fo,mo=M.object({id:M.string(),outcome:pe,createdAt:M.string(),trace:M.string()});function go(e){return null!=e&&("string"!=typeof e||""!==e)}function wo(e,t){switch(e.source){case"device":case"visit":case"modelInputs":return t[e.key];case"contentProperties":return t.contentProperties[e.key];case"userProperties":return t.userProperties[e.key];default:return void ke.warn(`Unknown dataMap source: ${e.source}`)}}const vo={xhigh:5,high:4,medium:3,low:2,xlow:1,null:null},bo=(Array.from(Object.keys(vo)),Array.from(Object.values(vo))),Ao=(M.union([...bo.filter(e=>null!==e).map(e=>M.literal(e)),M.null_()]),bo.filter(e=>null!==e).reverse()),Po=`Unknown content propensity level. Expected one of: ${Ao.join(", ")}.`,So=M.pipe(M.union([M.string(),M.number()]),M.transform(Number),M.number(),M.picklist(Ao));function Do(e){const t=e.find(e=>e.wallType===G.PAYWALL),n={[G.PAYWALL]:t?.score},r=e.find(e=>e.wallType===G.REGWALL);return void 0!==r&&(n[G.REGWALL]=r.score),n}const ko=.01,xo=1,Lo=e=>Math.min(Math.max(ko,e),xo),Eo=e=>Math.round(100*e),Vo=`t005001`,Co=/^t[01][012][23459]\d{3}$/,_o=/t[01][012]([23459]\d{3})/g;function To(e,t,n){return e.replace(_o,(e,r)=>`t${t}${n}${r}`)}function $o(e){const t="wallType"in e?e.wallType:"paywall",n=ee[t],r=Q[e.wallVisibility];let i=0===r?X.nowall:X[t];const o=Lo(e.score),s=Eo(o);let a=100===s?"xx":s.toString().padStart(2,"0");const l=Eo(e.threshold);return`${n}${r}${i}${a}${100===l?"xx":l.toString().padStart(2,"0")}`}function Bo(e){let t="";for(const n of e)t+=$o(n);return t}function Oo(e){if(void 0===e)return"--";const t=Math.round(100*e);return 100===t?"xx":t.toString().padStart(2,"0")}function jo(e,t,n,r){return`v${e}${t}${Oo(n)}${Oo(r)}`}const Io=M.object({paywall:M.object({anonymous:M.number(),registered:M.number()}),regwall:M.optional(M.number())}),Wo=M.pipe(M.record(M.string(),M.number()),M.custom(e=>{const t=new Set(["1","2","3","4","5"]),n=Object.entries(e);if(0===n.length)return!1;for(const[e,r]of n){if(!t.has(e))return!1;if(r<0||r>1)return!1}return!0},"Invalid level mapping format. Expected an object with keys '1'-'5' and values between 0 and 1")),Uo=M.object({paywall:M.object({anonymous:Wo,registered:Wo}),regwall:M.optional(Wo)}),Ro=M.union([M.object({userLevels:Uo}),M.object({user:Io}),M.object({userLevels:Uo,user:Io}),M.object({userFallback:Io}),M.object({user:Io,userFallback:Io}),M.object({userLevels:Uo,userFallback:Io}),M.object({userLevels:Uo,user:Io,userFallback:Io})]),Mo=M.object({thresholds:Ro}),No=M.object({definition:M.string(),policy:Mo});M.pipe(M.object({experiences:M.array(No)}),M.check(e=>e.experiences.length>0,"At least one experience is required"));var Go=(e=>(e["User"]="user",e["UserLevels"]="userLevels",e["UserFallback"]="userFallback",e))(Go||{});const zo="control";function qo(e){return e.trim().toLowerCase().replace(/^www\./,"")}function Fo(e){return e.trim().toLowerCase()}function Zo(e,t){const n=qo(t.hostname);return e.map((e,r)=>{const i=function(e){const t=e.trim();if(!t)return null;try{const e=new URL(/^[a-z][a-z\d+.-]*:\/\//i.test(t)?t:`https://${t}`);let n=e.search.slice(1);if(""!==e.pathname&&"/"!==e.pathname){if(n)return null;n=e.pathname.replace(/^\//,"")}return n?n.split("&").some(e=>e.indexOf("=")<=0)?null:{hostname:qo(e.hostname),parameters:Array.from(new URLSearchParams(n).entries())}:{hostname:qo(e.hostname),parameters:[]}}catch{return null}}(e.definition);return null!==i&&i.hostname===n&&function(e,t){return e.every(([e,n])=>{const r=t[e];if(void 0===r)return!1;const i=Fo(r);return n.split(",").some(e=>Fo(e)===i)})}(i.parameters,t.values)?{target:e,specificity:i.parameters.length,originalIndex:r}:null}).filter(e=>null!==e).sort((e,t)=>
vendor: 4,239 bytes, line 1
1t.specificity-e.specificity||t.originalIndex-e.originalIndex)}(new Date).toISOString();var Ho={724(e,t,n){var r;!function(i,o){var s="function",a="undefined",l="object",c="string",u="model",p="name",d="type",y="vendor",f="version",h="architecture",m="console",g="mobile",w="tablet",v="smarttv",b="wearable",A="embedded",P="Amazon",S="Apple",D="ASUS",k="BlackBerry",x="Browser",L="Chrome",E="Firefox",V="Google",C="Huawei",_="LG",T="Microsoft",$="Motorola",B="Opera",O="Samsung",j="Sharp",I="Sony",W="Xiaomi",U="Zebra",R="Facebook",M=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].toUpperCase()]=e[n];return t},N=function(e,t){return typeof e===c&&-1!==G(t).indexOf(G(e))},G=function(e){return e.toLowerCase()},z=function(e,t){if(typeof e===c)return e=e.replace(/^\s\s*/,""),typeof t===a?e:e.substring(0,350)},q=function(e,t){for(var n,r,i,a,c,u,p=0;p<t.length&&!c;){var d=t[p],y=t[p+1];for(n=r=0;n<d.length&&!c;)if(c=d[n++].exec(e))for(i=0;i<y.length;i++)u=c[++r],typeof(a=y[i])===l&&a.length>0?2===a.length?typeof a[1]==s?this[a[0]]=a[1].call(this,u):this[a[0]]=a[1]:3===a.length?typeof a[1]!==s||a[1].exec&&a[1].test?this[a[0]]=u?u.replace(a[1],a[2]):o:this[a[0]]=u?a[1].call(this,u,a[2]):o:4===a.length&&(this[a[0]]=u?a[3].call(this,u.replace(a[1],a[2])):o):this[a]=u||o;p+=2}},F=function(e,t){for(var n in t)if(typeof t[n]===l&&t[n].length>0){for(var r=0;r<t[n].length;r++)if(N(t[n][r],e))return"?"===n?o:n}else if(N(t[n],e))return"?"===n?o:n;return e},Z={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},H={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[f,[p,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[f,[p,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[p,f],[/opios[\/ ]+([\w\.]+)/i],[f,[p,B+" Mini"]],[/\bopr\/([\w\.]+)/i],[f,[p,B]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[p,f],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[f,[p,"UC"+x]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[f,[p,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[f,[p,"WeChat"]],[/konqueror\/([\w\.]+)/i],[f,[p,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[f,[p,"IE"]],[/yabrowser\/([\w\.]+)/i],[f,[p,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[p,/(.+)/,"$1 Secure "+x],f],[/\bfocus\/([\w\.]+)/i],[f,[p,E+" Focus"]],[/\bopt\/([\w\.]+)/i],[f,[p,B+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[f,[p,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[f,[p,"Dolphin"]],[/coast\/([\w\.]+)/i],[f,[p,B+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[f,[p,"MIUI "+x]],[/fxios\/([-\w\.]+)/i],[f,[p,E]],[/\bqihu|(qi?ho?o?|360)browser/i],[[p,"360 "+x]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[p,/(.+)/,"$1 "+x],f],[/(comodo_dragon)\/([\w\.]+)/i],[[p,/_/g," "],f],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[p,f],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[p],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[p,R],f],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[p,f],[/\bgsa\/([\w\.]+) .*safari\//i],[f,[p,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[f,[p,L+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[p,L+" WebView"],f],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[f,[p,"Android "+x]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[p,f],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[f,[p,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[f,p],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[p,[f,F,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}
vendor: 4,513 bytes, line 1
1]],[/(webkit|khtml)\/([\w\.]+)/i],[p,f],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[p,"Netscape"],f],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[f,[p,E+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[p,f],[/(cobalt)\/([\w\.]+)/i],[p,[f,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[h,"amd64"]],[/(ia32(?=;))/i],[[h,G]],[/((?:i[346]|x)86)[;\)]/i],[[h,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[h,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[h,"armhf"]],[/windows (ce|mobile); ppc;/i],[[h,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[h,/ower/,"",G]],[/(sun4\w)[;\)]/i],[[h,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[h,G]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[u,[y,O],[d,w]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[u,[y,O],[d,g]],[/((ipod|iphone)\d+,\d+)/i],[u,[y,S],[d,g]],[/(ipad\d+,\d+)/i],[u,[y,S],[d,w]],[/\((ip(?:hone|od)[\w ]*);/i],[u,[y,S],[d,g]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[u,[y,S],[d,w]],[/(macintosh);/i],[u,[y,S]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[u,[y,C],[d,w]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[u,[y,C],[d,g]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[u,/_/g," "],[y,W],[d,g]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[u,/_/g," "],[y,W],[d,w]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[u,[y,"OPPO"],[d,g]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[u,[y,"Vivo"],[d,g]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[u,[y,"Realme"],[d,g]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[u,[y,$],[d,g]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[u,[y,$],[d,w]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[u,[y,_],[d,w]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[u,[y,_],[d,g]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[u,[y,"Lenovo"],[d,w]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[u,/_/g," "],[y,"Nokia"],[d,g]],[/(pixel c)\b/i],[u,[y,V],[d,w]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[u,[y,V],[d,g]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[u,[y,I],[d,g]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[u,"Xperia Tablet"],[y,I],[d,w]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[u,[y,"OnePlus"],[d,g]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[u,[y,P],[d,w]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[u,/(.+)/g,"Fire Phone $1"],[y,P],[d,g]],[/(playbook);[-\w\),; ]+(rim)/i],[u,y,[d,w]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[u,[y,k],[d,g]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[u,[y,D],[d,w]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[u,[y,D],[d,g]],[/(nexus 9)/i],[u,[y,"HTC"],[d,w]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\w]*)/i],[y,[u,/_/g," "],[d,g]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[u,[y,"Acer"],[d,w]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[u,[y,"Meizu"],[d,g]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[u,[y,j],[d,g]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asu
vendor: 4,378 bytes, line 1
1s)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[y,u,[d,g]],[/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[y,u,[d,w]],[/(surface duo)/i],[u,[y,T],[d,w]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[u,[y,"Fairphone"],[d,g]],[/(u304aa)/i],[u,[y,"AT&T"],[d,g]],[/\bsie-(\w*)/i],[u,[y,"Siemens"],[d,g]],[/\b(rct\w+) b/i],[u,[y,"RCA"],[d,w]],[/\b(venue[\d ]{2,7}) b/i],[u,[y,"Dell"],[d,w]],[/\b(q(?:mv|ta)\w+) b/i],[u,[y,"Verizon"],[d,w]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[u,[y,"Barnes & Noble"],[d,w]],[/\b(tm\d{3}\w+) b/i],[u,[y,"NuVision"],[d,w]],[/\b(k88) b/i],[u,[y,"ZTE"],[d,w]],[/\b(nx\d{3}j) b/i],[u,[y,"ZTE"],[d,g]],[/\b(gen\d{3}) b.+49h/i],[u,[y,"Swiss"],[d,g]],[/\b(zur\d{3}) b/i],[u,[y,"Swiss"],[d,w]],[/\b((zeki)?tb.*\b) b/i],[u,[y,"Zeki"],[d,w]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[y,"Dragon Touch"],u,[d,w]],[/\b(ns-?\w{0,9}) b/i],[u,[y,"Insignia"],[d,w]],[/\b((nxa|next)-?\w{0,9}) b/i],[u,[y,"NextBook"],[d,w]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[y,"Voice"],u,[d,g]],[/\b(lvtel\-)?(v1[12]) b/i],[[y,"LvTel"],u,[d,g]],[/\b(ph-1) /i],[u,[y,"Essential"],[d,g]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[u,[y,"Envizen"],[d,w]],[/\b(trio[-\w\. ]+) b/i],[u,[y,"MachSpeed"],[d,w]],[/\btu_(1491) b/i],[u,[y,"Rotor"],[d,w]],[/(shield[\w ]+) b/i],[u,[y,"Nvidia"],[d,w]],[/(sprint) (\w+)/i],[y,u,[d,g]],[/(kin\.[onetw]{3})/i],[[u,/\./g," "],[y,T],[d,g]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[u,[y,U],[d,w]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[u,[y,U],[d,g]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[y,u,[d,m]],[/droid.+; (shield) bui/i],[u,[y,"Nvidia"],[d,m]],[/(playstation [345portablevi]+)/i],[u,[y,I],[d,m]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[u,[y,T],[d,m]],[/smart-tv.+(samsung)/i],[y,[d,v]],[/hbbtv.+maple;(\d+)/i],[[u,/^/,"SmartTV"],[y,O],[d,v]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[y,_],[d,v]],[/(apple) ?tv/i],[y,[u,S+" TV"],[d,v]],[/crkey/i],[[u,L+"cast"],[y,V],[d,v]],[/droid.+aft(\w)( bui|\))/i],[u,[y,P],[d,v]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[u,[y,j],[d,v]],[/(bravia[\w ]+)( bui|\))/i],[u,[y,I],[d,v]],[/(mitv-\w{5}) bui/i],[u,[y,W],[d,v]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i],[[y,z],[u,z],[d,v]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[d,v]],[/((pebble))app/i],[y,u,[d,b]],[/droid.+; (glass) \d/i],[u,[y,V],[d,b]],[/droid.+; (wt63?0{2,3})\)/i],[u,[y,U],[d,b]],[/(quest( 2)?)/i],[u,[y,R],[d,b]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[y,[d,A]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[u,[d,g]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[u,[d,w]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[d,w]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[d,g]],[/(android[-\w\. ]{0,9});.+buil/i],[u,[y,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[f,[p,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[f,[p,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[p,f],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[f,p]],os:[[/microsoft (windows) (vista|xp)/i],[p,f],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[p,[f,F,Z]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[p,"Windows"],[f,F,Z]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[f,/_/g,"."],[p,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[p,"Mac OS"],[f,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[f,p],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[p,f],[/\(bb(10);/i],[f,[p,k]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[f,[p,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+);
1 rv:.+ gecko\/([\w\.]+)/i],[f,[p,E+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[f,[p,"webOS"]],[/crkey\/([\d\.]+)/i],[f,[p,L+"cast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[p,"Chromium OS"],f],[/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[p,f],[/(sunos) ?([\w\.\d]*)/i],[[p,"Solaris"],f],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[p,f]]},J=function(e,t){if(typeof e===l&&(t=e,e=o),!(this instanceof J))return new J(e,t).getResult();var n=e||(typeof i!==a&&i.navigator&&i.navigator.userAgent?i.navigator.userAgent:""),r=t?function(e,t){var n={};for(var r in e)t[r]&&t[r].length%2==0?n[r]=t[r].concat(e[r]):n[r]=e[r];return n}(H,t):H;return this.getBrowser=function(){var e,t={};return t[p]=o,t[f]=o,q.call(t,n,r.browser),t.major=typeof(e=t.version)===c?e.replace(/[^\d\.]/g,"").split(".")[0]:o,t},this.getCPU=function(){var e={};return e[h]=o,q.call(e,n,r.cpu),e},this.getDevice=function(){var e={};return e[y]=o,e[u]=o,e[d]=o,q.call(e,n,r.device),e},this.getEngine=function(){var e={};return e[p]=o,e[f]=o,q.call(e,n,r.engine),e},this.getOS=function(){var e={};return e[p]=o,e[f]=o,q.call(e,n,r.os),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return n},this.setUA=function(e){return n=typeof e===c&&e.length>350?z(e,350):e,this},this.setUA(n),this};J.VERSION="0.7.33",J.BROWSER=M([p,f,"major"]),J.CPU=M([h]),J.DEVICE=M([u,y,d,m,g,v,w,b,A]),J.ENGINE=J.OS=M([p,f]),typeof t!==a?(e.exports&&(t=e.exports=J),t.UAParser=J):n.amdO?(r=function(){return J}.call(t,n,t,e))===o||(e.exports=r):typeof i!==a&&(i.UAParser=J);var Y=typeof i!==a&&(i.jQuery||i.Zepto);if(Y&&!Y.ua){var K=new J;Y.ua=K.getResult(),Y.ua.get=function(){return K.getUA()},Y.ua.set=function(e){K.setUA(e);var t=K.getResult();for(var n in t)Y.ua[n]=t[n]}}}("object"==typeof window?window:this)}},Jo={};function Yo(e){var t=Jo[e];if(void 0!==t)return t.exports;var n=Jo[e]={exports:{}};return Ho[e].call(n.exports,n,n.exports,Yo),n.exports}Yo.amdO={},Yo.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return Yo.d(t,{a:t}),t},Yo.d=(e,t)=>{for(var n in t)Yo.o(t,n)&&!Yo.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},Yo.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Ko={};Yo.d(Ko,{Ay:()=>rs,Hi:()=>ts,Tc:()=>es,vV:()=>ns});var Xo=Yo(724),Qo=Yo.n(Xo);const es={console:0,mobile:1,tablet:2,smarttv:3,wearable:4,other:5},ts=["type","os","viewer"],ns=function(e){try{const t=Qo()(e);return{viewer:void 0===t?.browser?.name?"":t.browser.name,type:void 0===t?.device?.type?"":t.device.type,os:void 0===t?.os?.name?"":t.os.name}}catch(e){return{viewer:"",type:"",os:""}}},rs=ns,is=Ko.Tc,os=Ko.Ay,ss=function(){return os(navigator.userAgent)};let as,ls=()=>{};const cs=Object.freeze({paywall:Object.freeze({anonymous:1,registered:1}),regwall:1});function us(e,t){return Zo(e,t).find(e=>e.specificity>0)?.target??null}function ps(e){const t=(as?.experiences??[]).filter(t=>function(e,t){return t in e.policy.thresholds}(t,e)),n=function({hostname:e,subMarket:t,assignedGroup:n,isDeviceAndLocationDataAllowed:r,isUserBehaviorDataAllowed:i,getDevice:o,getCountryCode:s}){const a=e.trim().replace(/^www\./i,""),l={"experiment.assignedGroup":n??zo,"visitor.device.platform":"web"};if(r){const e=o();l["visitor.device.os"]=e.os,l["visitor.device.type"]=e.type,l["visitor.device.viewer"]=e.viewer}if(r&&i){const e=s();"string"==typeof e&&(l["userProperties.countryCode"]=e)}return{hostname:t?`${t.trim()}-${a}`:a,values:l}}({hostname:Yt.hostname,subMarket:Yt.subMarket,assignedGroup:Qt()?.assignedGroup,isDeviceAndLocationDataAllowed:!0===Yt.mode?.isDeviceAndLocationDataAllowed,isUserBehaviorDataAllowed:!0===Yt.mode?.isUserBehaviorDataAllowed,getDevice:ss,getCountryCode:ls}),r=n.values["experiment.assignedGroup"];let i=us(t,n);return null===i&&r!==zo&&(i=us(t,{...n,values:{...n.values,"experiment.assignedGroup":zo}})),i??=function(e,t){return Zo(e,t).find(e=>0===e.specificity)?.target??null}(t,n),null!==i?function(e,t){switch(t){case Go.UserLevels:return Go.UserLevels in e?e.userLevels:null;case Go.UserFallback:return Go.UserFallback in e?e.userFallback:null;case Go.User:return Go.User in e?e.user:null}}(i.policy.thresholds,e):e===Go.UserFallback?(ke.warn("No userFallback thresholds found, using open-access defaults."),cs):null}
1class ds extends Error{constructor(e){super(e),this.name="AbortError"}}async function ys(e,t){const n=function(e,t,n){const r=`/hosts/${e.host}/decisions/me`,i=new URL(e.url+r);return i.search=t.toString(),new Request(i,{signal:n})}(e,t,function(e){const t=new AbortController,n=t.signal;return setTimeout(()=>{t.abort(new ds(`Request exceeded ${e.toLocaleString()}ms`))},e),n}(e.timeout));try{return async function(e){!function(e){if(!e.ok)throw ke.debug(`Response: ok: ${e.ok}, status: ${e.status}, status text: ${e.statusText}`),e}(e);const t=await e.json(),n=M.parse(mo,t);return{id:n.id,createdAt:n.createdAt,trace:n.trace,outcome:n.outcome}}(await fetch(n))}catch(e){return function(e){throw e instanceof Error&&ke.debug("Decision request error",e.name,e.message),ke.debug({err:e}),e}(e)}}async function fs(e,t,n,r){try{const r=await async function(e,t,n){if(!e.paywallApi)throw new Error("Paywall API configuration is missing");const r=Wn(e)["content.id"];if(!r){const e=new Error("No value for 'content.id', aborting decision call");throw e.name="ContentIdError",e}const i=new URLSearchParams(n);if(i.append("content.id",String(r)),i.append("visitor.type",t.modelInputs.visitorType),yo(t.modelInputs)){const n=function(e,t){const n=new URLSearchParams;for(const[r,i]of Object.entries(e)){const e=wo(i,t);go(e)?n.append(r,String(e)):ke.debug(`Skipping dataMap parameter "${r}", value is: ${e}`)}return n}(e.paywallApi.dataMap,t.modelInputs);for(const[e,t]of n.entries())qe.has(e)||i.append(e,t)}return un(en.ApiInitiated),await ys(e.paywallApi,i)}(e,t,n.searchParams);un(en.ApiCompleted),void 0!==r.outcome.wallProperties&&void 0===n.outcome.wallProperties&&(Object.keys(r.outcome.wallProperties).length>0&&ke.debug("Wall properties not configured but returned by API, discarding:",r.outcome.wallProperties),delete r.outcome.wallProperties);const i=void 0!==n.outcome.wallProperties||void 0!==r.outcome.wallProperties?{...n.outcome.wallProperties??{},...r.outcome.wallProperties??{}}:void 0,o={id:r.id,createdAt:r.createdAt,trace:r.trace,outcome:{...r.outcome,...no(i)}};return ke.debug("Enhanced with server decision",o),o}catch(i){return function(e,t,n,r,i){e instanceof Error&&"AbortError"===e.name?un(en.ApiTimeout):e instanceof Error&&"TypeError"===e.name&&un(en.ApiNetworkError);let o="No server decision";if(e instanceof Error&&(o+=`: ${e.message}`),ke.warn(o),ke.debug({err:e}),!t.paywallApi)throw new Error("Paywall API configuration is missing");const s=function(e,t,n,r,i,o){const s=ps(Go.UserFallback);let a="";o&&void 0!==i&&(a=((e,t)=>{let n="t";return e instanceof Error&&"AbortError"===e.name?(n+="002",n+=Math.round(t/10)):e instanceof Error&&"TypeError"===e.name?n+="003001":e instanceof Error&&"ContentIdError"===e.name?n+="00401":e&&e instanceof Response?n+="003"+e.status:n+="009000",n=n.substring(0,7).padEnd(7,"0"),n})(o,i));const l=Do(n),c="subscribed"===(u=t.visitorType)?"registered":u;var u;const p=function(e,t,n){const r=e[G.PAYWALL],i=e[G.REGWALL],o=t.paywall[n],s=t.regwall;return r>=o?{wallType:G.PAYWALL,wallVisibility:z,wallVisibilityCode:Q.always,wallTypeCode:X.paywall}:void 0!==i&&void 0!==s&&i>=s?{wallType:G.REGWALL,wallVisibility:z,wallVisibilityCode:Q.always,wallTypeCode:X.regwall}:{wallVisibility:q,wallVisibilityCode:Q.never}}(l,s,c),d=[];for(const e of Object.values(G)){const t=l[e];if(void 0!==t){const n=e===G.PAYWALL?s.paywall[c]:s.regwall;if(void 0===n)continue;const r={score:t,threshold:n,wallVisibility:p.wallVisibility===z&&p.wallType===e?z:q,wallType:e};d.push(r)}}const y=Bo(d),f=p.wallVisibilityCode,h="wallTypeCode"in p?p.wallTypeCode:X.nowall;let m,g;if("wallType"in p){const e=p.wallType;m=l[e],g=e===G.PAYWALL?s.paywall[c]:s.regwall}const w=jo(f,h,m,g),v={...e,trace:a+w+y,outcome:{...p,...no(e.outcome.wallProperties)}};return ke.debug(`API fallback decision:`,v),v}(n,{visitorType:r.modelInputs.visitorType,assignedGroup:n.experiment?.assignedGroup},i,0,t.paywallApi.timeout,e);return{id:n.id,createdAt:n.createdAt,trace:s.trace,outcome:s.outcome}}(i,e,n,t,r.outcomes)}}class hs{constructor(){this.pageViews=0,this.pageViewsByArticle=0,this.pageViewsByArticleWithPaywall=0,this.pageViewsByArticleWithRegwall=0,this.topLevelSections=0,this.topLevelSectionsByArticle=0,this.visitCount=0}}function ms(e=new Date){return 2*Math.floor(e.getUTCHours()/2)}function gs(e=new Date){return 2*Math.floor(e.getHours()/2)}function ws(e=new Date){return e.getDay()}function vs(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return""}}const bs=1,As=8,Ps=29,Ss={todayPageViews:10,todayPageViewsByArticle:10,todayPageViewsByArticleWithPaywall:10,todayPageViewsByArticleWithRegwall:10,todayTopLevelSections:10,todayTopLevelSectionsByArticle:10,sevenDayPageViews:15,sevenDayPageViewsByArticle:15,sevenDayPageViewsByArticleWithPaywall:15,sevenDayPageViewsByArticleWithRegwall:15,sevenDayTopLevelSections:15,sevenDayTopLevelSectionsByArticle:15,sevenDayVisitCount:10,twentyEightDayPageViews:99,twentyEightDayPageViewsByArticle:60,twentyEightDayPageViewsByArticleWithPaywall:60,twentyEightDayPageViewsByArticleWithRegwall:60,twentyEightDayTopLevelSections:20,twentyEightDayTopLevelSectionsByArticle:20,twentyEightDayVisitCount:30,daysSinceLastVisit:5};function Ds(e,t){return Object.entries(e).reduce((e,[n,r])=>({...e,[`${t}${n[0].toUpperCase()}${n.slice(1)}`]:r}),{})}const ks=function(e,t,n){if(!1===Yt.mode.isDeviceAndLocationDataAllowed&&!1===Yt.mode.isDeviceAndLocationDataAllowed)return{visitorType:t.visitor};const{durations:[r,i,o],daysSinceLastVisit:s}=function(e,t){const n=[e.today,...e.history],r=n.length,i=Math.min(r,Math.max(...t));let o=[],s=new hs,a=0,l=new Set,c=new Set;for(let e=0;e<i;e++){const r=n[e];s.pageViews=s.pageViews+r.pageViews,s.pageViewsByArticle=s.pageViewsByArticle+r.pageViewsByArticle,s.pageViewsByArticleWithPaywall=s.pageViewsByArticleWithPaywall+r.pageViewsByArticleWithPaywall,s.pageViewsByArticleWithRegwall=s.pageViewsByArticleWithRegwall+r.pageViewsByArticleWithRegwall;for(const e of r.topLevelSections)l.has(e)||l.add(e);
1s.topLevelSections=l.size;for(const e of r.topLevelSectionsByArticle)c.has(e)||c.add(e);s.topLevelSectionsByArticle=c.size,r.pageViews>0&&(s.visitCount++,e>0&&0===a&&(a=e)),t.includes(e+1)&&(o.push({...s}),s=new hs,l=new Set,c=new Set)}if(o.length<t.length)for(let e=o.length;e<t.length;e++)o.push({...s});return{durations:o,daysSinceLastVisit:a}}(t,[bs,As,Ps]),{visitCount:a,...l}=r,c=n?.assignedGroup||null,u=Gr(),p=Cr(),d=new Date,y=function(e,t={}){return Xn(e).reduce((e,[n,r])=>{if("number"==typeof r){const i=n in t?t[n]:null;e[n]="number"==typeof i?Math.min(r,i):r}else e[n]=r;return e},{})}({...Ds(l,"today"),...Ds(i,"sevenDay"),...Ds(o,"twentyEightDay"),...ss(),timeZone:vs(),referrer:u.medium,referrerData:{...u,queryParams:p},daysSinceLastVisit:s,visitorType:t.visitor,hourOfDay:ms(d),localDayOfWeek:ws(d),localHourOfDay:gs(d),assignedGroup:c,userProperties:e.userProperties,contentProperties:Wn(Yt)},Ss);return y.visitor=e.visitor,y};function xs(e){switch(e){case X.paywall:return{wallType:G.PAYWALL,wallTypeCode:e,wallVisibility:z,wallVisibilityCode:Q.always};case X.regwall:return{wallType:G.REGWALL,wallTypeCode:e,wallVisibility:z,wallVisibilityCode:Q.always};default:return{wallVisibility:q,wallVisibilityCode:Q.never}}}function Ls(e,t,n,r){return{wallType:e,wallVisibility:t?z:q,score:n??0,threshold:r??0}}function Es(e,t,n,r,i){const o=((e,t,n)=>e.trace&&!Co.test(e.trace)?{...e}:((e,t,n)=>{const r=Do(n),i=r[G.PAYWALL],o=r[G.REGWALL]??null,s=ps(Go.User);if(!s)return{...e,outcome:{...xs(X.nowall),...no(e.outcome.wallProperties)},trace:Vo+jo(Q.never,X.nowall,i,void 0)};const a=t.visitorType===H?Z:t.visitorType,l=s.paywall[a],c=a===F?s.regwall:void 0,u=void 0!==c&&null!==o;let p;p=xs(i>=l?X.paywall:u&&o>=c?X.regwall:X.nowall),p={...p,...no(e.outcome.wallProperties)};let d=e.trace;const y=[],f="wallType"in p&&p.wallType===G.PAYWALL,h="wallType"in p&&p.wallType===G.REGWALL;return u&&y.push(Ls(G.REGWALL,h,o,c)),y.push(Ls(G.PAYWALL,f,i,l)),d+=Bo(y),{...e,outcome:p,trace:d}})(e,t,n))(e,t,n),s=o.outcome.wallVisibilityCode,a="wallTypeCode"in o.outcome?o.outcome.wallTypeCode:X.nowall;return{...o,trace:To(o.trace,s,a)}}const Vs={daysSinceLastVisit:"DA",todayPageViews:"AA",todayPageViewsByArticle:"AB",todayPageViewsByArticleWithPaywall:"AC",sevenDayPageViews:"BA",sevenDayPageViewsByArticle:"BB",sevenDayPageViewsByArticleWithPaywall:"BC",todayTopLevelSections:"AD",todayTopLevelSectionsByArticle:"AE",sevenDayTopLevelSections:"BD",sevenDayTopLevelSectionsByArticle:"BE",sevenDayVisitCount:"BF",todayPageViewsByArticleWithRegwall:"AF",sevenDayPageViewsByArticleWithRegwall:"BG",twentyEightDayPageViews:"CA",twentyEightDayPageViewsByArticle:"CB",twentyEightDayPageViewsByArticleWithPaywall:"CC",twentyEightDayTopLevelSections:"CD",twentyEightDayTopLevelSectionsByArticle:"CE",twentyEightDayVisitCount:"CF",twentyEightDayPageViewsByArticleWithRegwall:"CG"},Cs={experimentId:"HA",assignedGroup:"HB",visitorType:"FA",referrer:"DC",pageReferrerMedium:"DE",pageReferrerSource:"DF",pageReferrerChannel:"DG",os:"EA",type:"EB",viewer:"EC",hourOfDay:"DD",localDayOfWeek:"DH",localHourOfDay:"DI",timeZone:"DB",campaignName:"GA",referrerDomain:"GB",referrerMedium:"GC",referrerSource:"GD",referrerChannel:"GE"},_s={medium:{alias:Cs.pageReferrerMedium,codes:Rr},source:{alias:Cs.pageReferrerSource,codes:Mr},channel:{alias:Cs.pageReferrerChannel,codes:Ur}};function Ts(e){if("timeZone"in e){const t=e.timeZone;if(t)return[Cs.timeZone+":"+t]}return[]}function $s(e){if("referrer"in e){const t=e.referrer;if(t){const e=Rr[t].toString().padStart(2,"0");return[Cs.referrer+":"+e]}}return[]}function Bs(e,t){return function(e,t,n,r){if("referrerData"in e&&e.referrerData&&t in e.referrerData){const i=e.referrerData[t];if(i&&i in r)return[n+":"+r[i].toString().padStart(2,"0")]}return[]}(e,t,_s[t].alias,_s[t].codes)}function Os(e){if("os"in e){const t=e.os;if(t)return[Cs.os+":"+t]}return[]}function js(e){if("type"in e){const t=e.type;if(t&&t in is){const e=is[t].toString().padStart(2,"0");return[Cs.type+":"+e]}}return[]}function Is(e){if("viewer"in e){const t=e.viewer;if(t)return[Cs.viewer+":"+t]}return[]}const Ws={anonymous:0,registered:1,subscribed:2};function Us(e){const t=e.visitorType;if(t&&t in Ws){const e=Ws[t].toString().padStart(2,"0");return[Cs.visitorType+":"+e]}return[]}function Rs(e){if("hourOfDay"in e){const t=e.hourOfDay;if(void 0!==t)return[Cs.hourOfDay+":"+t]}return[]}function Ms(e){if("localDayOfWeek"in e){const t=e.localDayOfWeek;if(void 0!==t)return[Cs.localDayOfWeek+":"+t]}return[]}function Ns(e){if("localHourOfDay"in e){const t=e.localHourOfDay;if(void 0!==t)return[Cs.localHourOfDay+":"+t]}return[]}function Gs(e){if("visitor"in e){const t=e.visitor.session,n=["campaignName","referrerDomain","referrerMedium","referrerSource","referrerChannel"],r={referrerSource:Mr,referrerChannel:Ur};return Xn(t).reduce((e,[t,i])=>{let o;return o=t in r?function(e,t){return e in t?t[e].toString().padStart(2,"0"):null}(i,r[t]):i,o&&n.includes(t)&&e.push(Cs[t]+":"+o),e},[])}return[]}const zs={aa:"0",ab:"1"},qs={control:"1",variant:"2",holdout:"3"};function Fs(e){if(e){const t=/[a-z:_-\d]*test(\d)_(a(?:a|b))$/,n=e.experimentId.match(t);let r="9",i="9",o=function(e){return qs[e.assignedGroup]||"9"}(e);if(n){i=n[1];const e=n[2];r=zs[e]}return[Cs.experimentId+":"+r+i,Cs.assignedGroup+":"+o]}return[]}const Zs=new Uint8Array(16),Hs=[];for(let e=0;e<256;++e)Hs.push((e+256).toString(16).slice(1));const Js=function(e,t,n){return t||e||!crypto.randomUUID?function(e,t,n){const r=(e=e||{}).random??e.rng?.()??crypto.getRandomValues(Zs);if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){if((n=n||0)<0||n+16>t.length)throw new RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=r[e];return t}return function(e,t=0){return(Hs[e[t+0]]+Hs[e[t+1]]+Hs[e[t+2]]+Hs[e[t+3]]+"-"+Hs[e[t+4]]+
1Hs[e[t+5]]+"-"+Hs[e[t+6]]+Hs[e[t+7]]+"-"+Hs[e[t+8]]+Hs[e[t+9]]+"-"+Hs[e[t+10]]+Hs[e[t+11]]+Hs[e[t+12]]+Hs[e[t+13]]+Hs[e[t+14]]+Hs[e[t+15]]).toLowerCase()}(r)}(e,t,n):crypto.randomUUID()},Ys=M.optional(M.object({visitor:M.optional(J)}));function Ks(e){if(!Yt.showPaywallScore)return;const t=e.outcomes[0];return t?Eo(Lo(t.score)):void 0}function Xs(e){if(ke.debug("Decision override:",Pe.override),Pe.override){ke.debug("⚙️ Decision override",Pe.override);let t=e.outcome;return Pe.override.outcome&&(t={...t,...Pe.override.outcome}),{...e,...Pe.override,outcome:t}}return e}function Qs(e){window.sophi=null===e?{...window.sophi,quickStart:{}}:{...window.sophi,quickStart:{decision:e}}}function ea(e,t){if(t.addTracingToLocalStorage.enabled&&e){const{inputs:n,context:r,trace:i}=e;localStorage.setItem(t.addTracingToLocalStorage.key,JSON.stringify({inputs:n,context:r,trace:i}))}}function ta(e){return"always"===e.outcome.wallVisibility?"paywall"===e.outcome.wallType?"paywall":"regwall":"no-wall"}const na=e=>{M.parse(Ys,e);const t=(e=>{try{if(!1===e.metaValues.visitorType)return null;const{selector:t,attribute:n,expression:r}=e.metaValues.visitorType,i=document.querySelector(t),o=i?.getAttribute(n)?.trim();if(!o)return null;const s=Sn(t,n,r),a=M.safeParse(J,s);return a.success?a.output:null}catch(e){return null}})(Yt),n=vr.getState().visitor,r=(({argsVisitor:e,metaVisitor:t,storedVisitor:n})=>e||t||n||"anonymous")({argsVisitor:e?.visitor,metaVisitor:t,storedVisitor:n});return vr.updateState({...vr.getState(),visitor:r}),{visitor:r}};function ra(e,t){return"registered"===e&&"always"===t.outcome.wallVisibility&&"regwall"===t.outcome.wallType&&(t.outcome={wallVisibility:"never",wallVisibilityCode:0,...no(t.outcome.wallProperties)}),t}async function ia(e,t,n){const{experiment:r,modelInputs:i,internalExperiment:o}=e;r&&ke.info("🧪 Experiment",JSON.stringify(r,null,2)),ke.debug("Model inputs",i);const s=function(e){let t="";if(yo(e)){const n={daysSinceLastVisit:e.daysSinceLastVisit,todayPageViews:e.todayPageViews,todayPageViewsByArticle:e.todayPageViewsByArticle,todayPageViewsByArticleWithPaywall:e.todayPageViewsByArticleWithPaywall,sevenDayPageViews:e.sevenDayPageViews,sevenDayPageViewsByArticle:e.sevenDayPageViewsByArticle,sevenDayPageViewsByArticleWithPaywall:e.sevenDayPageViewsByArticleWithPaywall,todayTopLevelSections:e.todayTopLevelSections,todayTopLevelSectionsByArticle:e.todayTopLevelSectionsByArticle,sevenDayTopLevelSections:e.sevenDayTopLevelSections,sevenDayTopLevelSectionsByArticle:e.sevenDayTopLevelSectionsByArticle,sevenDayVisitCount:e.sevenDayVisitCount,todayPageViewsByArticleWithRegwall:e.todayPageViewsByArticleWithRegwall,sevenDayPageViewsByArticleWithRegwall:e.sevenDayPageViewsByArticleWithRegwall,twentyEightDayPageViews:e.twentyEightDayPageViews,twentyEightDayPageViewsByArticle:e.twentyEightDayPageViewsByArticle,twentyEightDayPageViewsByArticleWithPaywall:e.twentyEightDayPageViewsByArticleWithPaywall,twentyEightDayTopLevelSections:e.twentyEightDayTopLevelSections,twentyEightDayTopLevelSectionsByArticle:e.twentyEightDayTopLevelSectionsByArticle,twentyEightDayVisitCount:e.twentyEightDayVisitCount,twentyEightDayPageViewsByArticleWithRegwall:e.twentyEightDayPageViewsByArticleWithRegwall};t=Object.keys(n).reduce((e,t)=>`${e}${Vs[t]+n[t].toString().padStart(2,"0")}`,"")}return t}(i),a=function(e,t){return[...Fs(t),...Us(e),...$s(e),...Bs(e,"medium"),...Bs(e,"source"),...Bs(e,"channel"),...Os(e),...js(e),...Is(e),...Rs(e),...Ms(e),...Ns(e),...Ts(e),...Gs(e)].join("|")}(i,o),l=(e=>{if(!e||0===Object.keys(e).length)return"";const t=(Yt.userProperties||[]).filter(e=>!1!==e.tracked).map(e=>e.key);return 0===t.length?"":Xn(e).filter(([e])=>t.includes(e)).map(([e,t])=>`${(e=>Sr[e]||e)(e)}:${t}`).join(",")})(qa.state.userProperties),c=function(){const e=Yt.wallProperties;if(void 0===e)return;const t={};for(const n of e){const e=io(n);void 0!==e&&(t[ro(n.key)]=e)}return t}(),u=oo(c),p=function(e){return e.contentProperties&&e.contentProperties.length>0?function(e){return null===In.analyticsString&&Un(e),In.analyticsString}(e):""}(t);n&&n({context:s,inputs:a,userProperties:l,contentProperties:p,...no(u),experiment:r});const d=ho.evaluate(i);ke.debug("Model output",d);const y=function(e,t){const n=new URLSearchParams;return e&&n.append("modelTrace",e),t&&(n.append("experiment.id",t.experimentId),n.append("experiment.assignedGroup",t.assignedGroup)),n.toString()}(function(e){const t="-";let n="";for(const r in e){const i=e[r],o=ee[r],s=t,a=t;if(void 0===i)continue;const l=Math.round(100*i);n+=`${o}${s}${a}${100===l?"xx":l.toString().padStart(2,"0")}${t+t}`}return n}(d),o);let f=Js(),h=(new Date).toISOString();const m=function(e){return{wallVisibility:"never",outcomes:Object.values(G).filter(t=>t in e&&"number"==typeof e[t]).map(t=>({wallType:t,score:e[t],threshold:0,wallVisibility:"never"}))}}(d);let g=function(e,t){return"always"===e.wallVisibility?{wallType:e.wallType,wallTypeCode:X[e.wallType],wallVisibility:e.wallVisibility,wallVisibilityCode:Q[e.wallVisibility],...no(t)}:{wallVisibility:e.wallVisibility,wallVisibilityCode:Q[e.wallVisibility],...no(t)}}(m,c),w="";if(t.paywallApi){const n=await fs(t,e,{id:f,createdAt:h,trace:w,context:s,inputs:a,outcome:g,searchParams:y,userProperties:l,...no(u),contentProperties:p,...void 0!==Ks(m)?{paywallScore:Ks(m)}:{},experiment:r},m);({id:f,createdAt:h,trace:w,outcome:g}=n)}const v=Ks(m),b={id:f,createdAt:h,trace:w,context:s,inputs:a,outcome:g,searchParams:y,userProperties:l,...no(u),contentProperties:p,...void 0!==v?{paywallScore:v}:{},experiment:r};return ke.debug("Base decision made:",b),{decision:b,outcomes:m.outcomes}}const oa=new class{constructor({config:e}){this.config=e,this.onDevice=null,this.server=null,this.cold=null}
1async makeParams(){const e=await Xt(),t=await Qt();return{modelInputs:ks(qa.state,vr.getState(),t),experiment:e,internalExperiment:t}}async getCached(){const e=await this.makeParams();return null===this.onDevice&&(this.onDevice=ia(e,this.config)),null===this.server&&(this.server=this.onDevice),(await this.server).decision}async updateCache(e){const t=await this.makeParams();return function(e){return Boolean(e.experiment||e.internalExperiment)}(t)&&un(en.TestAssigned),this.onDevice=ia(t,this.config,e),this.server=this.onDevice,await this.server}}({config:Yt});function sa(){window.sophi.quickStart.decision=void 0,yn(),In.values=null,In.analyticsString=null}function aa(e){if(!to.isSubdomain(Yt)||Yt.stateCookie.isEnabled){const t=e.getState(),n=t.coldDataLayer,{previous:r,outcomes:i}=n;if(r&&Object.keys(r).length>1){const o=so(Es(r,{visitorType:t.visitor,assignedGroup:r.experiment?.assignedGroup},i));return Qs(o),ea(o,Yt),mn(o),e.updateState({...t,coldDataLayer:{...t.coldDataLayer,previous:void 0,outcomes:[]}}),n}}return null}function la(e){return e&&(oa.cold=(async()=>({decision:e.previous,outcomes:e.outcomes||[]}))()),na(),oa.updateCache(pa).then(fa)}let ca=null,ua=!1;function pa(e){if("client"===Yt.wallGeneration.type&&!Yt.enableWallIndicators){const{trace:t,...n}=e;mn(n)}return e}function da(e,t,n){const r=e.getState();e.updateState({...r,coldDataLayer:{...r.coldDataLayer,previous:t,outcomes:n}}),function(e){if(!0===Yt.cookie.isEnabled&&!0===Yt.mode.isDeviceAndLocationDataAllowed&&!0===Yt.mode.isUserBehaviorDataAllowed&&(!to.isSubdomain(Yt)||Yt.stateCookie.isEnabled)){const t=Yt.cookie.name,n=Yt.hostname,r=Yt.cookie.maxAge,i="/";let o=e.searchParams;if(Yt.cookie.includeOutcome){o.length&&(o+="&"),o+="outcome.wallVisibility="+e.outcome.wallVisibility,"always"===e.outcome.wallVisibility&&(o+="&outcome.wallType="+e.outcome.wallType);const t=e.outcome.wallProperties;t&&Object.keys(t).length&&(o+=`&outcome.wallProperties=${encodeURIComponent(JSON.stringify(t))}`)}document.cookie=`${t}=${o}; domain=${n}; path=${i}; max-age=${r};`}}(t)}async function ya(e){e.clearHeldInputEvents(),function(){if(tn=performance.now(),!window.sophi?.demeter)return;cn(),rn="";const e=window,t=window.sophi.demeter;an(e,"sophiInitStatus",rn),an(t,"initStatus",rn)}(),sa(),e.dispatch({type:wn.ContentProperties});const t=aa(vr);t&&gn(),e.processStoredEvents(),await la(t)}const fa=e=>{const t=e.decision,{visitor:n}=na(),r=so(Xs(ra(n,Es(t,{visitorType:n,assignedGroup:t.experiment?.assignedGroup},e.outcomes))));return ke.debug("Policy decision",r),"client"===Yt.wallGeneration.type&&!1===Yt.enableWallIndicators?(Qs(r),ea(r,Yt),mn(r),gn()):"client"===Yt.wallGeneration.type&&!0===Yt.enableWallIndicators?(null===oa.cold&&(Qs(r),ea(r,Yt),mn(r),gn()),da(vr,r,e.outcomes)):"server"===Yt.wallGeneration.type&&(null===oa.cold&&(oa.cold=(async()=>({decision:await oa.getCached(),outcomes:e.outcomes}))(),gn()),da(vr,r,e.outcomes)),un(en.DecisionAvailable),r},ha=async e=>{{ke.info("🧮 Received getDecision event",e);const{visitor:t}=na(e);to.dispatch({type:wn.GetDecision});const n=await(oa.cold?.then(e=>e.decision))||await oa.getCached(),r=(await oa.cold)?.outcomes??(await oa.server)?.outcomes,i=so(Xs(ra(t,Es(n,{visitorType:t,assignedGroup:n.experiment?.assignedGroup},r))));return ke.debug("Policy decision",i),ke.info("🪧 Decision:",ta(i)),i}};async function ma(e){!1===Yt.enableWallIndicators&&ke.warn("getDecisionForArticleWallIndicators was called but wall indicators are not enabled. Using current decision."),ke.info("🧮 Received getDecisionForArticleWallIndicators event",e),to.dispatch({type:wn.GetDecisionForArticleWallIndicators});const{visitor:t}=na(),n=await oa.getCached();ra(t,n),(e=>{if(void 0===e)return null;const t=M.safeParse(So,e);t.success?t.output:ke.warn(Po,`Received:`,e)})(e?.contentPropensityLevel);const r=so(Xs(Es(n,{visitorType:t,assignedGroup:n.experiment?.assignedGroup},(await oa.server).outcomes)));return ke.info("🪧 Decision for next page:",ta(r)),r}const ga=function(){const{context:e,inputs:t,trace:n,experimentsCode:r,assignedGroup:i}=fn(),o={context:e,inputs:t,trace:n,experimentsCode:r,assignedGroup:i};return ke.debug("Sophi context",o),o},wa=function(){const{context:e,inputs:t,trace:n,userProperties:r}=fn(),i={context:e,inputs:t,trace:n,userProperties:r};return ke.info("🪧 Received getWallContext event",JSON.stringify(i,null,2)),i};function va(){return"undefined"!=typeof CompressionStream&&"undefined"!=typeof DecompressionStream}const ba=Math.max(Ss.twentyEightDayTopLevelSections,Ss.twentyEightDayTopLevelSectionsByArticle),Aa=As-1;function Pa(e,t){const n=e[4],r=e[5];return n.length<=t&&r.length<=t?e:[e[0],e[1],e[2],e[3],n.slice(0,t),r.slice(0,t)]}function Sa(e,t,n){let r=null;for(let i=0;i<e.length;i++){const o=e[i],s=!t.has(o),a=s&&t.size<n;s&&a&&t.add(o),a?null!==r&&r.push(o):null===r&&(r=e.slice(0,i))}return r??e}function Da(e){const t=Pa(e.t,ba),n=e.h.slice(0,Aa),r=e.h.slice(Aa),i=[...n.map(e=>Pa(e,ba)),...function(e,t){const n=new Set,r=new Set;return e.map(e=>{const i=Sa(e[4],n,t),o=Sa(e[5],r,t);return i===e[4]&&o===e[5]?e:[e[0],e[1],e[2],e[3],i,o]})}(r,ba)];return{...e,t,h:i}}const ka="sophi_st",xa=2592e3;let La=null;async function Ea(e){const t=function(){const e=localStorage.getItem("demeter");if(!e)return null;try{return he(e)}catch{return null}}();if(!t)return;const n={d:Da(t),a:e},r=JSON.stringify(n),i=await async function(e){if(!va())return null;const t=new TextEncoder,n=new Blob([t.encode(e)]).stream().pipeThrough(new CompressionStream("gzip")),r=await new Response(n).arrayBuffer(),i=new Uint8Array(r);let o="";for(let e=0;e<i.length;e++)o+=String.fromCharCode(i[e]);return btoa(o)}(r);if(null===i)return void(va()||ke.debug("State cookie skipped: CompressionStream not supported"));const o=Yt.hostname;document.cookie=`${ka}=${i}; domain=${o}; path=/; max-age=${xa}; Secure; SameSite=Lax`}const Va="(root)";function Ca(e){return"string"==typeof e?.message?e.message:String(e?.message??"Invalid input")}function _a(e,{maxIssues:t=20,mapMessage:n=Ca}={}){if(!Array.isArray(e)||!e.length)return[`${Va}: Invalid input`];const r=e.slice(0,t),i=r.map(e=>{const t=function(e){if(!Array.isArray(e)||!e.length)return Va;const t=[];for(const n of e){const e=n?.key;null!=e&&t.push("number"==typeof e?`[${e}
1]`:String(e))}return function(e){return Array.isArray(e)&&e.length&&e.reduce((e,t)=>"string"==typeof t&&t?t.startsWith("[")?`${e}${t}`:e?`${e}.${t}`:t:e,"")||Va}(t)}(e?.path),r="function"==typeof n?n(e):null;return`${t}: ${"string"==typeof r&&r.length>0?r:Ca(e)}`});return e.length>r.length&&i.push(`...and ${e.length-r.length} more issue(s)`),i}const Ta=M.pipe(M.string(),M.trim(),M.string(),M.trim(),M.picklist(["pageview","wall","config","getDecision","getWallContext","getSophiContext","enableAllFeatures","userProperties","getDecisionForArticleWallIndicators","getExperiment"])),$a=["pageview","wall","userProperties"],Ba=["getDecision","getDecisionForArticleWallIndicators","getWallContext","getSophiContext","getExperiment"],Oa=["config"],ja=["enableAllFeatures"],Ia=(e,t)=>{"function"==typeof e&&e(t)};async function Wa(e,t,n={}){const{resolve:r,reject:i}=n;let o=function(e){if(!e||"object"!=typeof e)return;const t=e.onError;return"function"==typeof t?t:void 0}(t);try{const{args:n,onSuccess:i,onError:s}=function(e){let t,n,r;if("object"==typeof e&&null!==e){if("args"in e==!1){const t=Object.keys(e).find(e=>"onSuccess"!==e&&"onError"!==e);t&&M.parse(M.object({[t]:M.pipe(M.any(),M.check(()=>!1,"Unexpected payload key"))}),e)}"args"in e&&void 0!==e.args&&(t=e.args),"onSuccess"in e&&"function"==typeof e.onSuccess&&(n=e.onSuccess),"onError"in e&&"function"==typeof e.onError&&(r=e.onError)}return{args:t,onSuccess:n,onError:r}}(t);o=s;const a=function(e){return M.parse(Ta,e)}(e),l=await Ua.call(this,a,n);return Ia(i,l),Ia(r,l),l}catch(e){const t=function(e){if(e instanceof M.ValiError){const t=function(e,t={}){return _a(e,{maxIssues:t.maxIssues??20,mapMessage:e=>"string"==typeof e.message?e.message:String(e.message??"Invalid input")})}(e.issues).map(e=>`- ${e}`).join("\n");return ke.error("InputError",`\n${t}`),new Error(`InputError\n${t}`,{cause:e})}return new Error("DecisionError",{cause:e})}(e);throw ke.debug("Error",t),Ia(o,t),Ia(i,t),t}}function Ua(e,t){return this[e](t)}function Ra(e,t){const[[n,r]]=e[t],{resolve:i,reject:o}=function(e){let t,n;if(Array.isArray(e)){const[r,i,o]=e;"function"==typeof i&&(t=i),"function"==typeof o&&(n=o)}return{resolve:t,reject:n}}(e[t]);Wa.call(this,n,r,{resolve:i,reject:o}),e.splice(t,1)}function Ma(e,t){for(let n=0;n<e.length;n++){const[[r]]=e[n];t.includes(r)&&(Ra.call(this,e,n),n--)}}const Na=async function(e){var t,n;if(t=Yt.hostname,n=window.location?.hostname,t===n||new RegExp(`^(.*\\.)?${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}$`).test(n)||ke.warn(`Bundle hostname mismatch: bundle is for "${Yt.hostname}", but loaded on "${window.location.hostname}"`),ke.debug("Initializing"),Yt.stateCookie.isEnabled){let e="";try{const t=localStorage.getItem("demeter");t&&(e=he(t)?.lS??"")}catch{}const t=await async function(){const e=function(){const e=`${ka}=`,t=document.cookie.split(";");for(const n of t){const t=n.trim();if(t.startsWith(e))return t.substring(e.length)}return null}();if(!e)return null;const t=await async function(e){if(!va())return null;const t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);const r=new Blob([n]).stream().pipeThrough(new DecompressionStream("gzip"));return await new Response(r).text()}(e);if(null===t)return null;try{const e=JSON.parse(t),n=(La||(La=M.object({d:yr,a:Gi})),La),r=M.safeParse(n,e);return r.success?r.output:null}catch{return null}}();if(t){const n=function(e,t){const n=e.d.lS;if(t&&n){if(new Date(t)>new Date(n))return!1}else if(t&&!n)return!1;try{localStorage.setItem("demeter",fe(e.d))}catch{return!1}try{const t=M.parse(Gi,e.a);localStorage.setItem(Bi,JSON.stringify(t))}catch{}return!0}(t,e);n?(this.store.getFromStored(),qa.update(()=>Fi(localStorage)),un(en.StateCookie),ke.debug("State initialized from cookie")):(un(en.StateLocal),ke.debug("State cookie found but local state is newer"))}else e?(un(en.StateLocal),ke.debug("No state cookie, using local state")):(un(en.StateInitial),ke.debug("No state cookie or local state, fresh init"))}!function(e,t){if(null!==t.mode.consentParameterValue)!0===t.mode.consentParameterValue?(t.mode.on(),e.setConsent(!0),window.sophi?.abTests?.enableConsent()):!1===t.mode.consentParameterValue&&(t.mode.off(),e.setConsent(!1));else{const n=e.getConsent();void 0!==n&&(!0===n.granted&&(t.mode.on(),window.sophi?.abTests?.enableConsent()),!1===n.granted&&t.mode.off())}}(this.store,Yt),Ma.call(this,e,Oa),Ma.call(this,e,ja);const r=aa(this.store);r&&gn(),function(e){if(e&&("event"in e&&window.addEventListener(e.event,()=>{ya(to)}),"selector"in e)){const t=function(e){let t=null;try{t=document.querySelector(e)}catch(t){ke.warn(`Invalid selector ${e}.`)}return null===t?(ke.warn(`No node found using selector ${e}. Using document.body instead.`),document.body):t}(e.selector);let n=location.href;const r={subtree:!0,childList:!0};new MutationObserver(function(){location.href!==n&&(n=location.href,ya(to)),ke.debug("MutationObserver callback checked for page change")}).observe(t,r)}}(Yt.spa),Yt.mode.isUserBehaviorDataAllowed&&Yi(),to.processStoredEvents(),to.dispatch({type:wn.Init}),"server"===Yt.wallGeneration.type&&(Ma.call(this,e,$a),to.processPreviousPageEvents()),await la(r),"server"===Yt.wallGeneration.type&&to.finishServerWallInputBootstrap(),Ma.call(this,e,Ba),"client"===Yt.wallGeneration.type&&Ma.call(this,e,$a),this.ready=!0,window.demeter=Wa.bind(this);for(let t=0;t<e.length;t++)Ra.call(this,e,t),t--},Ga={C:"control",V:"variant",H:"holdout"},za=e=>{if(!e||"sophivssophi"!==e.type?.toLowerCase())return null;if(window.sophi?.abTests){const e=window.sophi.abTests.getAllExperimentsSync("internal");if(e.length>0)return{assignedGroup:e[0].assignedGroup}}return function(){const e=document.cookie.split("; ");let t=null;for(const n of e){const[e,r]=n.split("=");
1if("_matheriSegs"===e){t=decodeURIComponent(r);break}}if(!t)return null;const n=t.split(",");for(const e of n){const t=e.match(/^INTERNAL_AB_TEST(\d+)-([CVH])$/);if(t)return{assignedGroup:Ga[t[2]]}}return null}()},qa=function(e){return new Zi(e.storage,e.onUpdate)}({storage:localStorage,onUpdate:()=>{Yt.stateCookie.isEnabled&&Yt.mode.isUserBehaviorDataAllowed&&Ea(qa.state).catch(()=>{})}});ls=()=>qa.state.userProperties.countryCode,gr=()=>{Yt.stateCookie.isEnabled&&Yt.mode.isUserBehaviorDataAllowed&&Ea(qa.state).catch(()=>{})};const Fa=class{constructor(){this.ready=!1,this.store=vr;const e=to.getDispatch();this.init=Na.bind(this);const t=e=>{if(this.ready&&!0===e)return"server"!==Yt.wallGeneration.type||!0===Yt.enableWallIndicators?Promise.resolve():(ua=!0,null===ca&&(ca=async function(){for(;ua;){ua=!1,to.processPreviousPageEvents();try{await la(null)}catch(e){ke.error("Create new decision failed",e)}}}().finally(()=>{ca=null})),ca)};return this.pageview=n=>t(e({type:wn.Pageview,payload:n})),this.wall=n=>t(e({type:wn.Wall,payload:n})),this.enableAllFeatures=()=>{const n=e({type:wn.EnableAllFeatures});return t(n)},this.userProperties=n=>t(e({type:wn.UserProperties,payload:n})),this.config=Pe.config.bind(Pe),this.getDecision=ha,this.getWallContext=wa,this.getDecisionForArticleWallIndicators=ma,this.getSophiContext=ga,this.getExperiment=za,new Proxy(this,{get:function(e,t){return"function"==typeof e[t]&&"init"!==t?async(...n)=>{if(!e.ready)throw new Error(`InitError: ${String(t)}() was called before init(). Please initialize before using this function.`);return e[t](...n)}:e[t]}})}};let Za=null,Ha=!1;const Ja=async function(e){return Za||(Za=new Fa),Ha||(e||ke.debug("Error loading 'thresholds' value."),function(e){e&&(as=e)}(e),await async function(e){window.sophi=window.sophi||{},window.sophi.demeter=window.sophi.demeter||{actions:[]},window.sophi.demeter.actions=window.sophi.demeter.actions||[],cn(),window.sophi.quickStart=window.sophi.quickStart||{},window.sophi.dataLayer||yn(),e.init(window.sophi.demeter.actions)}(Za),Ha=!0),Za};return t["default"]})(),"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["createDemeter"]=t():e["createDemeter"]=t(),function(){var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:this,t=e&&e.createDemeter;if("function"==typeof t){try{delete e.createDemeter}catch(t){e.createDemeter=void 0}try{var n=t({experiences:[{definition:"www.theglobeandmail.com",policy:{thresholds:{user:{paywall:{anonymous:.01,registered:.01},regwall:.3}}}},{definition:"www.theglobeandmail.com/experiment.assignedGroup=control",policy:{thresholds:{user:{paywall:{anonymous:.01,registered:.01},regwall:.3}}}},{definition:"www.theglobeandmail.com/experiment.assignedGroup=variant",policy:{thresholds:{user:{paywall:{anonymous:.01,registered:.01},regwall:.3}}}}]});n&&"function"==typeof n.then&&n.catch(function(e){console.error("Error initializing SDK with thresholds",e)})}catch(e){console.error("Error initializing SDK with thresholds",e)}}else console.error("createDemeter is not defined on window/globalThis")}();

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.