PageSourceSearch

http://amdflames.org/js/30627458008d6f.js

js amdflames.org collected 2026-10-06 19:42:43 UTC 132,867 bytes, 1 lines download raw bytes

1var e,t;!function(){var e=window.sophi&&window.sophi.demeter;if(e){var t=String(Math.floor(performance.now()/10)/100).replace(/^0\./,".");e.initStatus=(e.initStatus?e.initStatus+",":"")+"x"+t}}(),(()=>{const e=1e4;function t(e){return{lang:e?.lang??void 0,message:e?.message,abortEarly:e?.abortEarly??void 0,abortPipeEarly:e?.abortPipeEarly??void 0}}function n(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 i(e,t,i,r,o){const s=o&&"input"in o?o.input:i.value,a=o?.expected??e.expects??null,l=o?.received??n(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:o?.path,issues:o?.issues,lang:r.lang,abortEarly:r.abortEarly,abortPipeEarly:r.abortPipeEarly},u="schema"===e.kind,p=o?.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&&(i.typed=!1),i.issues?i.issues.push(c):i.issues=[c]}function r(e){return{version:1,vendor:"valibot",validate:n=>e["~run"]({value:n},t())}}function o(e,t){const n=[...new Set(e)];return n.length>1?`(${n.join(` ${t} `)})`:n[0]??"never"}var s=class extends Error{constructor(e){super(e[0].message),this.name="ValiError",this.issues=e}};function a(e,t,n){return"function"==typeof e.fallback?e.fallback(t,n):e.fallback}function l(e,t,n){return"function"==typeof e.default?e.default(t,n):e.default}function c(e){let t;if(e)for(const n of e)t?t.push(...n.issues):t=n.issues;return t}const u=function e(t,n){return{kind:"schema",type:"array",reference:e,expects:"Array",async:!1,item:t,message:n,get"~standard"(){return r(this)},"~run"(e,t){const n=e.value;if(Array.isArray(n)){e.typed=!0,e.value=[];for(let i=0;i<n.length;i++){const r=n[i],o=this.item["~run"]({value:r},t);if(o.issues){const s={type:"array",origin:"value",input:n,key:i,value:r};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 i(this,"type",e,t);return e}}},p=function e(t){return{kind:"schema",type:"boolean",reference:e,expects:"boolean",async:!1,message:t,get"~standard"(){return r(this)},"~run"(e,t){return"boolean"==typeof e.value?e.typed=!0:i(this,"type",e,t),e}}},d=function e(t,n){return{kind:"schema",type:"custom",reference:e,expects:"unknown",async:!1,check:t,message:n,get"~standard"(){return r(this)},"~run"(e,t){return this.check(e.value)?e.typed=!0:i(this,"type",e,t),e}}},y=function e(t,o){return{kind:"schema",type:"literal",reference:e,expects:n(t),async:!1,literal:t,message:o,get"~standard"(){return r(this)},"~run"(e,t){return e.value===this.literal?e.typed=!0:i(this,"type",e,t),e}}},h=function e(t){return{kind:"schema",type:"number",reference:e,expects:"number",async:!1,message:t,get"~standard"(){return r(this)},"~run"(e,t){return"number"!=typeof e.value||isNaN(e.value)?i(this,"type",e,t):e.typed=!0,e}}},f=function e(t,n){return{kind:"schema",type:"object",reference:e,expects:"Object",async:!1,entries:t,message:n,get"~standard"(){return r(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 o=this.entries[r];if(r in n||("exact_optional"===o.type||"optional"===o.type||"nullish"===o.type)&&void 0!==o.default){const i=r in n?n[r]:l(o),s=o["~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}}s.typed||(e.typed=!1),e.value[r]=s.value}else if(void 0!==o.fallback)e.value[r]=a(o);else if("exact_optional"!==o.type&&"optional"!==o.type&&"nullish"!==o.type&&(i(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 i(this,"type",e,t);return e}}},g=function e(t,n){return{kind:"schema",type:"optional",reference:e,expects:`(${t.expects} | undefined)`,async:!1,wrapped:t,default:n,get"~standard"(){return r(this)},"~run"(e,t){return void 0===e.value&&(void 0!==this.default&&(e.value=l(this,e,t)),void 0===e.value)?(e.typed=!0,e):this.wrapped["~run"](e,t)}}},w=function(e,n,i){const r=e["~run"]({value:n},t(i));if(r.issues)throw new s(r.issues);return r.value},m=function(...e){return{...e[0],pipe:e,get"~standard"(){return r(this)},"~run"(t,n){for(const i of e)if("metadata"!==i.kind){if(t.issues&&("schema"===i.kind||"transformation"===i.kind)){t.typed=!1;break}t.issues&&(n.abortEarly||n.abortPipeEarly)||(t=i["~run"](t,n))}return t}}}
1,b=function e(t,n){return{kind:"validation",type:"regex",reference:e,async:!1,expects:`${t}`,requirement:t,message:n,"~run"(e,t){return e.typed&&!this.requirement.test(e.value)&&i(this,"format",e,t),e}}},v=function e(t,n){return{kind:"schema",type:"strict_object",reference:e,expects:"Object",async:!1,entries:t,message:n,get"~standard"(){return r(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 o=this.entries[r];if(r in n||("exact_optional"===o.type||"optional"===o.type||"nullish"===o.type)&&void 0!==o.default){const i=r in n?n[r]:l(o),s=o["~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}}s.typed||(e.typed=!1),e.value[r]=s.value}else if(void 0!==o.fallback)e.value[r]=a(o);else if("exact_optional"!==o.type&&"optional"!==o.type&&"nullish"!==o.type&&(i(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)){i(this,"key",e,t,{input:r,expected:"never",path:[{type:"object",origin:"key",input:n,key:r,value:n[r]}]});break}}else i(this,"type",e,t);return e}}},k=function e(t){return{kind:"schema",type:"string",reference:e,expects:"string",async:!1,message:t,get"~standard"(){return r(this)},"~run"(e,t){return"string"==typeof e.value?e.typed=!0:i(this,"type",e,t),e}}},P=function e(t){return{kind:"transformation",type:"transform",reference:e,async:!1,operation:t,"~run"(e){return e.value=this.operation(e.value),e}}},A=function e(t,n){return{kind:"schema",type:"union",reference:e,expects:o(t.map(e=>e.expects),"|"),async:!1,options:t,message:n,get"~standard"(){return r(this)},"~run"(e,t){let n,r,o;for(const i of this.options){const s=i["~run"]({value:e.value},t);if(s.typed){if(!s.issues){n=s;break}r?r.push(s):r=[s]}else o?o.push(s):o=[s]}if(n)return n;if(r){if(1===r.length)return r[0];i(this,"type",e,t,{issues:c(r)}),e.typed=!0}else{if(1===o?.length)return o[0];i(this,"type",e,t,{issues:c(o)})}return e}}},S={control:"control",variant:"variant",holdout:"holdout"},x={C:S.control,V:S.variant,H:S.holdout},D=/^.+_TEST\d-[CVH]$/,L=m(k(),d(e=>D.test(e))),V=m(k(),b(/[a-z:_-\d]*test(\d)_(a(?:a|b))$/,e=>`Invalid configuration: "id" is required and must be a string ending in test1_ab or similar. Received: ${e}`)),E=m(u(f({distributionPercent:h(),name:L})),d(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}),d(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})),_=f({id:V,groups:E,type:A([y("external"),y("internal")])}),$=g(f({default:p()}),{default:!0}),j=f({name:k()}),C=g(f({id:j}),{id:{name:"_ml_id"}}),T=m(u(_),d(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}),d(e=>{const t=e,n={internal:0,external:0};for(const e of t)n[e.type]++;if(n.internal>1)throw new Error(`Invalid configuration: ${n.internal} internal tests found, only one is allowed`);if(n.external>1)throw new Error(`Invalid configuration: ${n.external} external tests found, only one is allowed`);return!0}),P(e=>(e.sort((e,t)=>"internal"===e.type&&"external"===t.type?-1:"external"===e.type&&"internal"===t.type?1:0),e))),B=v({hostname:k(),experiments:T,cookies:C,consent:$,subMarket:g(k())}),W=JSON.parse('{"hostname":"modernhealthcare.com","experiments":[{"id":"pw:article:test4_ab","type":"external","groups":[{"distributionPercent":50,"name":"MATHER_QS_AB_TEST4-C"},{"distributionPercent":50,"name":"MATHER_QS_AB_TEST4-V"}]},{"id":"i:test2_ab","type":"internal","groups":[{"distributionPercent":100,"name":"INTERNAL_AB_TEST2-C"},{"distributionPercent":0,"name":"INTERNAL_AB_TEST2-V"}]}],"cookies":{"id":{"name":"_ml_id"}}}'),O=new class{constructor(e){const t=w(B,e);this.cookies=t.cookies,this.hostname=t.hostname,this.experiments=t.experiments,this.baseConsent=t.consent}get consent(){const e=(()=>
1{if("undefined"==typeof sessionStorage)return null;const e=sessionStorage.getItem("sophi_abtest_config");if(null!==e)try{return JSON.parse(e)}catch(e){return null}return null})();return e?.consent??this.baseConsent}}(W),I=e=>e?(e^16*Math.random()>>e/4).toString(16):"10000000-1000-4000-8000-100000000000".replace(/[018]/g,I),U=(e,t)=>{try{localStorage?.setItem(e,t)}catch{}},R=e=>{try{return localStorage?.getItem(e)??null}catch{return null}},N=(e,t,n,i)=>{const r=[`${e}=${t}`,`expires=${n}`,`domain=.${i.hostname}`,"path=/","SameSite=None","Secure"].join(";");window.document.cookie=r},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]}},M=e=>{const t=R(e)||G(e);return t&&"false"!==t?t:""},q=O.cookies.id.name,z=(t,n,i)=>((e,t)=>{let n=null;return e.forEach(e=>{t>=e.range_start&&t<=e.range_end&&(n=e.id)}),n})((t=>{if(100!==t.map(e=>e.distributionPercent).reduce((e,t)=>e+t))throw new Error("Total weight percentages must equal 100%");let n=0;const i=[];return t.forEach(t=>{if(n==e)return;const r=n+t.distributionPercent*e/100,o={id:t.name,range_start:0===n?n:n+1,range_end:Math.min(r,e)};n=r,i.push(o)}),i})(t),((e,t=1e4)=>{const n=e/2**32;return Math.floor(n*t)})(((e,t=1)=>function(e,t){var n,i,r,o,s,a,l,c;for(n=3&e.length,i=e.length-n,r=t,s=3432918353,a=461845907,c=0;c<i;)l=255&e.charCodeAt(c)|(255&e.charCodeAt(++c))<<8|(255&e.charCodeAt(++c))<<16|(255&e.charCodeAt(++c))<<24,++c,r=27492+(65535&(o=5*(65535&(r=(r^=l=(65535&(l=(l=(65535&l)*s+(((l>>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<13|r>>>19))+((5*(r>>>16)&65535)<<16)&4294967295))+(((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:r^=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 r^=e.length,r=2246822507*(65535&(r^=r>>>16))+((2246822507*(r>>>16)&65535)<<16)&4294967295,r=3266489909*(65535&(r^=r>>>13))+((3266489909*(r>>>16)&65535)<<16)&4294967295,(r^=r>>>16)>>>0}(e,t))(`${n}-${i}`))),F="always-H",H="Sophi AB Test:",J=(...e)=>{console.log(H,...e)},Y=(...e)=>{console.warn(H,...e)},Z=(...e)=>{console.error(H,...e)},K="sophi_abtest_group",Q="sophi_abtest_id";window.sophi=window.sophi||{};let X=O.consent.default;const ee=()=>{const e=(e=>{if(G(e))return M(e).split(".")[0];const t=new Date,n=new Date(t.setFullYear(t.getFullYear()+2)).toUTCString(),i=I(),r=Math.floor(t.getTime()/1e3);return o=e,s=[i,r,"0",r,r].join("."),a=n,l=O,U(o,s),N(o,s,a,l),i;var o,s,a,l})(q),t=R("_matheriSegs")??"",n=t?t.split(",").filter(e=>D.test(e)):[],i=G("_matheriSegs"),r=(i?i.split(","):[]).filter(e=>e&&e!==F&&!D.test(e)),o=[];for(const t of O.experiments){const i=t.groups.find(e=>n.includes(e.name));o.push(i?.name||z(t.groups,t.id,e))}const s=[...o.filter((e,t)=>"internal"===O.experiments[t].type),...o.filter((e,t)=>"external"===O.experiments[t].type)].join(","),a=((e,t)=>{let n=t;return e.some(e=>"external"===e.type)||(n+=`,${F}`),n})(O.experiments,s),l=r.length?[...r,...a.split(",").filter(Boolean)].join(","):a;a!==t&&U("_matheriSegs",a),l!==i&&N("_matheriSegs",l,(()=>{const e=new Date;return e.setMonth(e.getMonth()+6),e.toUTCString()})(),O)},te=e=>{const t=e.charAt(e.length-1);return x[t]},ne=e=>{const t={...e};if(window.location.search){const n=new URLSearchParams(window.location.search);n.has(Q)&&((e,t,n)=>{e?(t.experimentId=e.toLowerCase(),J(`Test ID override. Original: ${n.experimentId}. Overridden by: ${e}.`)):Y(`Invalid test ID override in URL parameter ${Q}: ${e}`)})(n.get(Q),t,e),n.has(K)&&((e,t,n)=>{e&&e.toLowerCase()in S?(t.assignedGroup=e,J(`Test group override. Original: ${n.assignedGroup}. Overridden by: ${e}.`)):Y(`Invalid test group override in URL parameter ${K}: ${e}`)})(n.get(K),t,e)}return t},ie=function(){if(!X)return[];const e=O.experiments,t=M("_matheriSegs").split(","),n=[];for(const i of e){const e=i.groups.find(e=>
1t.includes(e.name))?.name;if(!e)continue;const r=te(e),o={experimentId:i.id,assignedGroup:r,type:i.type};n.push(o)}return n};function re(e="external"){return ie().filter(t=>t.type===e).map(({type:e,...t})=>t).map("external"===e?ne:e=>e)}function oe(e){if(!X)return;const t=ie();let n="";if("string"!=typeof e)return;n=e.toLowerCase();const i=t.find(e=>e.experimentId.toLowerCase()===n);return void 0===i&&Y(`Experiment ${e} not found`),i&&"external"===i.type?ne(i):i}if(X)try{ee()}catch(e){Z("Error initializing storage:",e)}const se={getAllExperiments:async(e="external")=>re(e),getAllExperimentsSync:(e="external")=>re(e),getExperiment:async e=>oe(e),getExperimentSync:e=>oe(e),enableConsent:()=>{try{X=!0,ee()}catch(e){Z("Error enabling consent:",e)}}};window.sophi.abTests=se,window.dispatchEvent(new Event("sophi.abTests:ready"))})(),e=globalThis,t=()=>(()=>{var e={d:(t,n)=>{for(var i in n)e.o(n,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:n[i]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},t={};function n(e){return{lang:e?.lang??void 0,message:e?.message,abortEarly:e?.abortEarly??void 0,abortPipeEarly:e?.abortPipeEarly??void 0}}function i(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 r(e,t,n,r,o){const s=o&&"input"in o?o.input:n.value,a=o?.expected??e.expects??null,l=o?.received??i(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:o?.path,issues:o?.issues,lang:r.lang,abortEarly:r.abortEarly,abortPipeEarly:r.abortPipeEarly},u="schema"===e.kind,p=o?.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]}function o(e){return{version:1,vendor:"valibot",validate:t=>e["~run"]({value:t},n())}}function s(e,t){return Object.hasOwn(e,t)&&"__proto__"!==t&&"prototype"!==t&&"constructor"!==t}function a(e,t){const n=[...new Set(e)];return n.length>1?`(${n.join(` ${t} `)})`:n[0]??"never"}function l(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}e.d(t,{default:()=>qs});var c=class extends Error{constructor(e){super(e[0].message),this.name="ValiError",this.issues=e}};function u(e){return{kind:"transformation",type:"transform",reference:u,async:!1,operation:e,"~run"(e){return e.value=this.operation(e.value),e}}}function p(e,t,n){return"function"==typeof e.fallback?e.fallback(t,n):e.fallback}function d(e,t,n){return"function"==typeof e.default?e.default(t,n):e.default}function y(e){return{kind:"schema",type:"boolean",reference:y,expects:"boolean",async:!1,message:e,get"~standard"(){return o(this)},"~run"(e,t){return"boolean"==typeof e.value?e.typed=!0:r(this,"type",e,t),e}}}function h(e){return{kind:"schema",type:"date",reference:h,expects:"Date",async:!1,message:e,get"~standard"(){return o(this)},"~run"(e,t){return e.value instanceof Date?isNaN(e.value)?r(this,"type",e,t,{received:'"Invalid Date"'}):e.typed=!0:r(this,"type",e,t),e}}}function f(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){for(const n in t)if(n in e){const i=f(e[n],t[n]);if(i.issue)return i;e[n]=i.value}else e[n]=t[n];return{value:e}}if(Array.isArray(e)&&Array.isArray(t)&&e.length===t.length){for(let n=0;n<e.length;n++){const i=f(e[n],t[n]);if(i.issue)return i;e[n]=i.value}return{value:e}}}return{issue:!0}}function g(e,t){return{kind:"schema",type:"non_optional",reference:g,expects:"!undefined",async:!1,wrapped:e,message:t,get"~standard"(){return o(this)},"~run"(e,t){return void 0!==e.value&&(e=this.wrapped["~run"](e,t)),void 0===e.value&&r(this,"type",e,t),e}}}function w(e){return{kind:"schema",type:"null",reference:w,expects:"null",async:!1,message:e,get"~standard"(){return o(this)},"~run"(e,t){return null===e.value?e.typed=!0:r(this,"type",e,t),e}}}function m(e){return{kind:"schema",type:"number",reference:m,expects:"number",async:!1,message:e,get"~standard"(){return o(this)},"~run"(e,t){return"number"!=typeof e.value||isNaN(e.value)?r(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 o(this)},"~run"(e,t){const n=e.value;if(n&&"object"==typeof n){e.typed=!0,e.value={};for(const i in this.entries){const o=this.entries[i];if(i in n||("exact_optional"===o.type||"optional"===o.type||"nullish"===o.type)&&void 0!==o.default){const r=i in n?n[i]:d(o),s=o["~run"]({value:r},t);if(s.issues){const o={type:"object",origin:"value",input:n,key:i,value:r};for(const t of s.issues)t.path?t.path.unshift(o):t.path=[o],e.issues?.pu
1sh(t);if(e.issues||(e.issues=s.issues),t.abortEarly){e.typed=!1;break}}s.typed||(e.typed=!1),e.value[i]=s.value}else if(void 0!==o.fallback)e.value[i]=p(o);else if("exact_optional"!==o.type&&"optional"!==o.type&&"nullish"!==o.type&&(r(this,"key",e,t,{input:void 0,expected:`"${i}"`,path:[{type:"object",origin:"key",input:n,key:i,value:n[i]}]}),t.abortEarly))break}}else r(this,"type",e,t);return e}}}function v(e,t){return{kind:"schema",type:"optional",reference:v,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:t,get"~standard"(){return o(this)},"~run"(e,t){return void 0===e.value&&(void 0!==this.default&&(e.value=d(this,e,t)),void 0===e.value)?(e.typed=!0,e):this.wrapped["~run"](e,t)}}}function k(e,t){return{kind:"schema",type:"picklist",reference:k,expects:a(e.map(i),"|"),async:!1,options:e,message:t,get"~standard"(){return o(this)},"~run"(e,t){return this.options.includes(e.value)?e.typed=!0:r(this,"type",e,t),e}}}function P(e,t,n){return{kind:"schema",type:"record",reference:P,expects:"Object",async:!1,key:e,value:t,message:n,get"~standard"(){return o(this)},"~run"(e,t){const n=e.value;if(n&&"object"==typeof n){e.typed=!0,e.value={};for(const i in n)if(s(n,i)){const r=n[i],o=this.key["~run"]({value:i},t);if(o.issues){const s={type:"object",origin:"key",input:n,key:i,value:r};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:r},t);if(s.issues){const o={type:"object",origin:"value",input:n,key:i,value:r};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 r(this,"type",e,t);return e}}}function A(e){return{kind:"schema",type:"string",reference:A,expects:"string",async:!1,message:e,get"~standard"(){return o(this)},"~run"(e,t){return"string"==typeof e.value?e.typed=!0:r(this,"type",e,t),e}}}function S(e){let t;if(e)for(const n of e)t?t.push(...n.issues):t=n.issues;return t}function x(e,t){return{kind:"schema",type:"union",reference:x,expects:a(e.map(e=>e.expects),"|"),async:!1,options:e,message:t,get"~standard"(){return o(this)},"~run"(e,t){let n,i,o;for(const r of this.options){const s=r["~run"]({value:e.value},t);if(s.typed){if(!s.issues){n=s;break}i?i.push(s):i=[s]}else o?o.push(s):o=[s]}if(n)return n;if(i){if(1===i.length)return i[0];r(this,"type",e,t,{issues:S(i)}),e.typed=!0}else{if(1===o?.length)return o[0];r(this,"type",e,t,{issues:S(o)})}return e}}}function D(e,t,i){const r=e["~run"]({value:t},n(i));if(r.issues)throw new c(r.issues);return r.value}function L(...e){return{...e[0],pipe:e,get"~standard"(){return o(this)},"~run"(t,n){for(const i of e)if("metadata"!==i.kind){if(t.issues&&("schema"===i.kind||"transformation"===i.kind)){t.typed=!1;break}t.issues&&(n.abortEarly||n.abortPipeEarly)||(t=i["~run"](t,n))}return t}}}const V={any:function e(){return{kind:"schema",type:"any",reference:e,expects:"any",async:!1,get"~standard"(){return o(this)},"~run":e=>(e.typed=!0,e)}},array:function e(t,n){return{kind:"schema",type:"array",reference:e,expects:"Array",async:!1,item:t,message:n,get"~standard"(){return o(this)},"~run"(e,t){const n=e.value;if(Array.isArray(n)){e.typed=!0,e.value=[];for(let i=0;i<n.length;i++){const r=n[i],o=this.item["~run"]({value:r},t);if(o.issues){const s={type:"array",origin:"value",input:n,key:i,value:r};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 r(this,"type",e,t);return e}}},boolean:y,check:function e(t,n){return{kind:"validation",type:"check",reference:e,async:!1,expects:null,requirement:t,message:n,"~run"(e,t){return e.typed&&!this.requirement(e.value)&&r(this,"input",e,t),e}}},custom:function e(t,n){return{kind:"schema",type:"custom",reference:e,expects:"unknown",async:!1,check:t,message:n,get"~standard"(){return o(this)},"~run"(e,t){return this.check(e.value)?e.typed=!0:r(this,"type",e,t),e}}},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 o(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=l(n);e?(t.nested||(t.nested={}),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:function e(t,n){return{kind:"schema",type:"intersect",reference:e,expects:a(t.map(e=>e.expects),"&"),async:!1,options:t,message:n,get"~standard"(){return o(this)},"~run"(e,t){if(this.options.length){const n=e.value;let i;e.typed=!0;for(const r of this.options){const o=r["~run"]({value:n},t);if(o.issues&&(e.issues?e.issues.push(...o.issues):e.issues=o.issues,t.abortE
1arly)){e.typed=!1;break}o.typed||(e.typed=!1),e.typed&&(i?i.push(o.value):i=[o.value])}if(e.typed){e.value=i[0];for(let n=1;n<i.length;n++){const o=f(e.value,i[n]);if(o.issue){r(this,"type",e,t,{received:"unknown"});break}e.value=o.value}}}else r(this,"type",e,t);return e}}},literal:function e(t,n){return{kind:"schema",type:"literal",reference:e,expects:i(t),async:!1,literal:t,message:n,get"~standard"(){return o(this)},"~run"(e,t){return e.value===this.literal?e.typed=!0:r(this,"type",e,t),e}}},maxValue:function e(t,n){return{kind:"validation",type:"max_value",reference:e,async:!1,expects:`<=${t instanceof Date?t.toJSON():i(t)}`,requirement:t,message:n,"~run"(e,t){return!e.typed||e.value<=this.requirement||r(this,"value",e,t,{received:e.value instanceof Date?e.value.toJSON():i(e.value)}),e}}},message:function(e,t){return{...e,get"~standard"(){return o(this)},"~run":(n,i)=>e["~run"](n,{...i,message:t})}},minLength:function e(t,n){return{kind:"validation",type:"min_length",reference:e,async:!1,expects:`>=${t}`,requirement:t,message:n,"~run"(e,t){return e.typed&&e.value.length<this.requirement&&r(this,"length",e,t,{received:`${e.value.length}`}),e}}},minValue:function e(t,n){return{kind:"validation",type:"min_value",reference:e,async:!1,expects:`>=${t instanceof Date?t.toJSON():i(t)}`,requirement:t,message:n,"~run"(e,t){return!e.typed||e.value>=this.requirement||r(this,"value",e,t,{received:e.value instanceof Date?e.value.toJSON():i(e.value)}),e}}},null_:w,number:m,object:b,optional:v,parse:D,partial:function(e,t){const n={};for(const i in e.entries)n[i]=!t||t.includes(i)?v(e.entries[i]):e.entries[i];return{...e,entries:n,get"~standard"(){return o(this)}}},picklist:k,pipe:L,record:P,required:function(e,t,n){const i=Array.isArray(t)?t:void 0,r=Array.isArray(t)?n:t,s={};for(const t in e.entries)s[t]=!i||i.includes(t)?g(e.entries[t],r):e.entries[t];return{...e,entries:s,get"~standard"(){return o(this)}}},safeParse:function(e,t,i){const r=e["~run"]({value:t},n(i));return{typed:r.typed,success:!r.issues,output:r.value,issues:r.issues}},strictObject:function e(t,n){return{kind:"schema",type:"strict_object",reference:e,expects:"Object",async:!1,entries:t,message:n,get"~standard"(){return o(this)},"~run"(e,t){const n=e.value;if(n&&"object"==typeof n){e.typed=!0,e.value={};for(const i in this.entries){const o=this.entries[i];if(i in n||("exact_optional"===o.type||"optional"===o.type||"nullish"===o.type)&&void 0!==o.default){const r=i in n?n[i]:d(o),s=o["~run"]({value:r},t);if(s.issues){const o={type:"object",origin:"value",input:n,key:i,value:r};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}}s.typed||(e.typed=!1),e.value[i]=s.value}else if(void 0!==o.fallback)e.value[i]=p(o);else if("exact_optional"!==o.type&&"optional"!==o.type&&"nullish"!==o.type&&(r(this,"key",e,t,{input:void 0,expected:`"${i}"`,path:[{type:"object",origin:"key",input:n,key:i,value:n[i]}]}),t.abortEarly))break}if(!e.issues||!t.abortEarly)for(const i in n)if(!(i in this.entries)){r(this,"key",e,t,{input:i,expected:"never",path:[{type:"object",origin:"key",input:n,key:i,value:n[i]}]});break}}else r(this,"type",e,t);return e}}},string:A,transform:u,toLowerCase:function e(){return{kind:"transformation",type:"to_lower_case",reference:e,async:!1,"~run":e=>(e.value=e.value.toLowerCase(),e)}},trim:function e(){return{kind:"transformation",type:"trim",reference:e,async:!1,"~run":e=>(e.value=e.value.trim(),e)}},tuple:function e(t,n){return{kind:"schema",type:"tuple",reference:e,expects:"Array",async:!1,items:t,message:n,get"~standard"(){return o(this)},"~run"(e,t){const n=e.value;if(Array.isArray(n)){e.typed=!0,e.value=[];for(let i=0;i<this.items.length;i++){const r=n[i],o=this.items[i]["~run"]({value:r},t);if(o.issues){const s={type:"array",origin:"value",input:n,key:i,value:r};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 r(this,"type",e,t);return e}}},union:x,unwrap:function(e){return e.wrapped}
1,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)&&r(this,"URL",e,t),e}}},ValiError:c,value:function e(t,n){return{kind:"validation",type:"value",reference:e,async:!1,expects:t instanceof Date?t.toJSON():i(t),requirement:t,message:n,"~run"(e,t){return!e.typed||this.requirement<=e.value&&this.requirement>=e.value||r(this,"value",e,t,{received:e.value instanceof Date?e.value.toJSON():i(e.value)}),e}}}},E=b({assignedGroup:k(["control","variant","holdout"]),experimentId:A()}),_={PAYWALL:"paywall",REGWALL:"regwall"},$="always",j="never",C="anonymous",T="registered",B="subscribed",W=V.union([V.literal(C),V.literal(T),V.literal(B)]),O=V.picklist([_.REGWALL,_.PAYWALL]),I=V.picklist([$,j]),U={nowall:0,paywall:1,regwall:2},R={always:1,never:0},N={regwall:"b",paywall:"d",finalEnsemble:"z",onDevicePolicy:"v",contentPropensityTier:"q",userPropensityTier:"s"},G=V.object({wallVisibility:I,wallType:O}),M=V.object({...G.entries,score:V.number(),threshold:V.pipe(V.number(),V.minValue(0),V.maxValue(1))}),q=V.array(M),z=V.object({wallVisibility:V.literal($),wallType:O,outcomes:q}),F=V.object({wallVisibility:V.literal(j),outcomes:q}),H=(V.union([z,F]),V.record(V.string(),V.union([V.string(),V.number(),V.boolean()]))),J=V.optional(H),Y=V.object({wallType:V.literal(_.REGWALL),wallTypeCode:V.literal(U.regwall),wallVisibility:V.literal($),wallVisibilityCode:V.literal(R.always),wallProperties:J}),Z=V.object({wallType:V.literal(_.PAYWALL),wallTypeCode:V.literal(U.paywall),wallVisibility:V.literal($),wallVisibilityCode:V.literal(R.always),wallProperties:J}),K=V.object({wallVisibility:V.literal(j),wallVisibilityCode:V.literal(R.never),wallProperties:J}),Q=V.union([Y,Z,K]),X=V.object({id:V.string(),createdAt:V.string(),trace:V.string(),context:V.string(),inputs:V.string(),outcome:Q,searchParams:V.string(),userProperties:V.string(),wallProperties:V.optional(V.string()),paywallScore:V.optional(V.pipe(V.number(),V.minValue(0),V.maxValue(100))),contentProperties:V.optional(V.string(),""),experiment:V.union([V.null_(),E])}),ee=V.partial(V.object({id:V.string(),createdAt:V.string(),context:V.string(),trace:V.string(),inputs:V.string(),outcome:V.union([V.partial(Y),V.partial(Z),V.partial(K)]),searchParams:V.string(),userProperties:V.string(),wallProperties:V.string(),paywallScore:V.optional(V.pipe(V.number(),V.minValue(0),V.maxValue(100))),contentProperties:V.optional(V.string(),""),experiment:V.union([V.null_(),E])})),te=new class{constructor(){this.key="demeter"}get(){try{const e=sessionStorage.getItem(this.key);return null===e?e:JSON.parse(atob(e))}catch(e){return null}}set(e){try{return sessionStorage.setItem(this.key,btoa(JSON.stringify(e)))}catch(e){}}},ne=V.union([V.literal("warn"),V.literal("info"),V.literal("debug")]),ie=V.partial(V.object({logLevel:V.optional(ne),override:V.optional(ee)}));function re(e){te.set({...te.get(),logLevel:e})}const oe=new class{constructor(e={}){this.logLevel=e.logLevel||function(){const e=new URL(window.location.href).searchParams.get("sophi_log_level");return e&&(V.safeParse(ne,e).success?re(e):ae.warn(`Unknown log level found in URL: ${e}`)),e}()||function(){const e=te.get();if(e)return V.safeParse(ne,e.logLevel).success?e.logLevel:null}()||"warn",this.config=this.config.bind(this)}config(e){V.parse(ie,e),e.logLevel&&(this.logLevel=e.logLevel,re(e.logLevel)),e.override&&(this.override=e.override),ae.info("⚙️ Runtime config",JSON.stringify(e,null,2))}},se={error:0,warn:1,info:2,debug:3},ae=new class{constructor(){this.prefix="QuickStart:"}error(...e){console.log(this.prefix,"🔴",...e)}warn(...e){console.log(this.prefix,"🟠",...e)}info(...e){se[oe.logLevel]>=se.info&&console.log(this.prefix,...e)}debug(...e){se[oe.logLevel]>=se.debug&&console.log(this.prefix,"🔧",...e)}},le=document.currentScript;function ce(e){const t=function(){const e=le||document.querySelector("script#sophi-loader");if(!e)return ae.debug("Loader script element not found"),null;const t=e.getAttribute("src");if(!t)return ae.debug("Loader script has no src attribute"),null;try{return new URL(t,document.baseURI).searchParams}catch(e){return ae.debug("Unable to parse loader script src URL",e),null}}();return t?t.get(e):null}const ue="content.age",pe="content.ageInHours",de="content.section",ye="content.accessCategory";var he=Symbol.for("immer-nothing"),fe=Symbol.for("immer-draftable"),ge=Symbol.for("immer-state");function we(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var me=Object.getPrototypeOf;function be(e){return!!e&&!!e[ge]}function ve(e){return!!e&&(Pe(e)||Array.isArray(e)||!!e[fe]||!!e.constructor?.[fe]||Le(e)||Ve(e))}var ke=Object.prototype.constructor.toString();function Pe(e){if(!e||"object"!=typeof e)return!1;const t=me(e);
1if(null===t)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===ke}function Ae(e,t){0===Se(e)?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,i)=>t(i,n,e))}function Se(e){const t=e[ge];return t?t.type_:Array.isArray(e)?1:Le(e)?2:Ve(e)?3:0}function xe(e,t){return 2===Se(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function De(e,t,n){const i=Se(e);2===i?e.set(t,n):3===i?e.add(n):e[t]=n}function Le(e){return e instanceof Map}function Ve(e){return e instanceof Set}function Ee(e){return e.copy_||e.base_}function _e(e,t){if(Le(e))return new Map(e);if(Ve(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Pe(e);if(!0===t||"class_only"===t&&!n){const t=Object.getOwnPropertyDescriptors(e);delete t[ge];let n=Reflect.ownKeys(t);for(let i=0;i<n.length;i++){const r=n[i],o=t[r];!1===o.writable&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(t[r]={configurable:!0,writable:!0,enumerable:o.enumerable,value:e[r]})}return Object.create(me(e),t)}{const t=me(e);if(null!==t&&n)return{...e};const i=Object.create(t);return Object.assign(i,e)}}function $e(e,t=!1){return Ce(e)||be(e)||!ve(e)||(Se(e)>1&&Object.defineProperties(e,{set:{value:je},add:{value:je},clear:{value:je},delete:{value:je}}),Object.freeze(e),t&&Object.values(e).forEach(e=>$e(e,!0))),e}function je(){we(2)}function Ce(e){return Object.isFrozen(e)}var Te,Be={};function We(e){const t=Be[e];return t||we(0),t}function Oe(){return Te}function Ie(e,t){t&&(We("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ue(e){Re(e),e.drafts_.forEach(Ge),e.drafts_=null}function Re(e){e===Te&&(Te=e.parent_)}function Ne(e){return Te={drafts_:[],parent_:Te,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Ge(e){const t=e[ge];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Me(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[ge].modified_&&(Ue(t),we(4)),ve(e)&&(e=qe(t,e),t.parent_||Fe(t,e)),t.patches_&&We("Patches").generateReplacementPatches_(n[ge].base_,e,t.patches_,t.inversePatches_)):e=qe(t,n,[]),Ue(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==he?e:void 0}function qe(e,t,n){if(Ce(t))return t;const i=t[ge];if(!i)return Ae(t,(r,o)=>ze(e,i,t,r,o,n)),t;if(i.scope_!==e)return t;if(!i.modified_)return Fe(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const t=i.copy_;let r=t,o=!1;3===i.type_&&(r=new Set(t),t.clear(),o=!0),Ae(r,(r,s)=>ze(e,i,t,r,s,n,o)),Fe(e,t,!1),n&&e.patches_&&We("Patches").generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function ze(e,t,n,i,r,o,s){if(be(r)){const s=qe(e,r,o&&t&&3!==t.type_&&!xe(t.assigned_,i)?o.concat(i):void 0);if(De(n,i,s),!be(s))return;e.canAutoFreeze_=!1}else s&&n.add(r);if(ve(r)&&!Ce(r)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;qe(e,r),t&&t.scope_.parent_||"symbol"==typeof i||!(Le(n)?n.has(i):Object.prototype.propertyIsEnumerable.call(n,i))||Fe(e,r)}}function Fe(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&$e(t,n)}var He={get(e,t){if(t===ge)return e;const n=Ee(e);if(!xe(n,t))return function(e,t,n){const i=Ze(t,n);return i?"value"in i?i.value:i.get?.call(e.draft_):void 0}(e,n,t);const i=n[t];return e.finalized_||!ve(i)?i:i===Ye(e.base_,t)?(Qe(e),e.copy_[t]=Xe(i,e)):i},has:(e,t)=>t in Ee(e),ownKeys:e=>Reflect.ownKeys(Ee(e)),set(e,t,n){const i=Ze(Ee(e),t);if(i?.set)return i.set.call(e.draft_,n),!0;if(!e.modified_){const i=Ye(Ee(e),t),s=i?.[ge];if(s&&s.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(((r=n)===(o=i)?0!==r||1/r==1/o:r!=r&&o!=o)&&(void 0!==n||xe(e.base_,t)))return!0;Qe(e),Ke(e)}var r,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!==Ye(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,Qe(e),Ke(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=Ee(e),i=Reflect.getOwnPropertyDescriptor(n,t);return i?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:i.enumerable,value:n[t]}:i},defineProperty(){we(11)},getPrototypeOf:e=>me(e.base_),setPrototypeOf(){we(12)}},Je={};function Ye(e,t){const n=e[ge];return(n?Ee(n):e)[t]}function Ze(e,t){if(!(t in e))return;let n=me(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=me(n)}}function Ke(e){e.modified_||(e.modified_=!0,e.parent_&&Ke(e.parent_))}function Qe(e){e.copy_||(e.copy_=_e(e.base_,e.scope_.immer_.useStrictShallowCopy_))}function Xe(e,t){const n=Le(e)?We("MapSet").proxyMap_(e,t):Ve(e)?We("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),i={type_:n?1:0,scope_:t?t.scope_:Oe(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let r=i,o=He;n&&(r=[i],o=Je);const{revoke:s,proxy:a}=Proxy.revocable(r,o);return i.draft_=a,i.revoke_=s,a}(e,t);return(t?t.scope_:Oe()).drafts_.push(n),n}function et(e){if(!ve(e)||Ce(e))return e;const t=e[ge];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=_e(e,t.scope_.immer_.useStrictShallowCopy_)}else n=_e(e,!0);return Ae(n,(e,t)=>{De(n,e,et(t))}),t&&(t.finalized_=!1),n}Ae(He,(e,t)=>{Je[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),Je.deleteProperty=function(e,t){return Je.set.call(this,e,t,void 0)},Je.set=function(e,t,n){return He.set.call(this,e[0],t,n,e[0])};var tt=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,t,n)=>{if("function"==typeof e&&"function"!=typeof t){const n=t;t=e;const i=this;return function(e=n,...r){return i.produce(e,e=>t.call(this,e,...r))}}let i;if("function"!=typeof t&&we(6),void 0!==n&&"function"!=typeof n&&we(7),ve(e)){const r=Ne(this),o=Xe(e,void 0);let s=!0;try{i=t(o),s=!1}finally{s?Ue(r):Re(r)}return Ie(r,n),Me(i,r)}if(!e||"object"!=typeof e){if(i=t(e),void 0===i&&(i=e),i===he&&(i=void 0),this.autoFreeze_&&$e(i,!0),n){const t=[],r=[];We("Patches").generateReplacementPatches_(e,i,t,r),n(t,r)}return i}we(1)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,i;return[this.produce(e,t,(e,t)=>{n=e,i=t}),n,i]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){var t;ve(e)||we(8),be(e)&&(be(t=e)||we(10),e=et(t));const n=Ne(this),i=Xe(e,void 0);return i[ge].isManual_=!0,Re(n),i}finishDraft(e,t){const n=e&&e[ge];n&&n.isManual_||we(9);const{scope_:i}=n;return Ie(i,t),Me(void 0,i)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const i=t[n];if(0===i.path.length&&"replace"===i.op){e=i.value;break}}n>
1-1&&(t=t.slice(n+1));const i=We("Patches").applyPatches_;return be(e)?i(e,t):this.produce(e,e=>i(e,t))}},nt=tt.produce;const it="sophi_analytics",rt=x([A(),w()]),ot=b({campaignName:rt,referrerDomain:rt,referrerMedium:rt,referrerSource:v(rt,null),referrerChannel:v(rt,null),queryParams:v(P(A(),A()),{}),timestamp:x([L(A(),u(e=>new Date(e)),h()),w()])}),st=b({session:ot}),at=b({campaignName:rt,referrerDomain:rt,referrerMedium:rt,referrerSource:v(rt,null),referrerChannel:v(rt,null),queryParams:P(A(),A()),timestamp:x([h(),w()])}),lt=b({session:at});class ct{constructor(){this.campaignName=null,this.referrerDomain=null,this.referrerMedium=null,this.referrerSource=null,this.referrerChannel=null,this.queryParams={},this.timestamp=null}}const ut=["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20"],pt=k([...ut,"countryCode"]),dt=b({userProperties:P(pt,x([A(),m(),y()])),visitor:st}),yt={userProperties:{},visitor:{session:new ct}},ht=function(){document.hidden||this.update(()=>ft(this.storage))},ft=function(e){const t=e?.getItem(it);if(t)try{const e=JSON.parse(t);return D(dt,e)}catch{return yt}return yt};class gt{storage;state;update=e=>{this.state=nt(this.state,e),this.storage&&this.storage.setItem(it,JSON.stringify(this.state))};constructor(e){this.storage=e,this.state=nt(ft(this.storage),()=>{}),document.addEventListener("visibilitychange",ht.bind(this))}}const wt=[...ut,"content.id",ue,pe,de,ye],mt=V.picklist(wt),bt=V.union([V.string(),V.number(),V.boolean()]),vt=(V.record(mt,bt),{gtmDataLayer:{dataLayerName:"dataLayer",listenToPast:!0}}),kt=V.object({name:V.literal("userProperties"),key:pt,path:V.pipe(V.string(),V.minLength(1))}),Pt=V.object({name:V.pipe(V.string(),V.minLength(1)),actions:V.array(kt)}),At=V.object({dataLayerName:V.optional(V.string(),vt.gtmDataLayer.dataLayerName),events:V.array(Pt),listenToPast:V.optional(V.boolean(),vt.gtmDataLayer.listenToPast)}),St=V.object({gtmDataLayer:V.optional(At)}),xt=e=>"enum"===e.type&&e.options||[],Dt=(e,t)=>"string"===t.type||"number"===t.type||"boolean"===t.type?typeof e===t.type:xt(t).some(t=>Object.is(t,e)),Lt=["content.id","visitor.type","modelTrace","experiment.id","experiment.assignedGroup"],Vt=new Set(Lt);var Et={724(e,t,n){var i;!function(r,o){var s="function",a="undefined",l="object",c="string",u="model",p="name",d="type",y="vendor",h="version",f="architecture",g="console",w="mobile",m="tablet",b="smarttv",v="wearable",k="embedded",P="Amazon",A="Apple",S="ASUS",x="BlackBerry",D="Browser",L="Chrome",V="Firefox",E="Google",_="Huawei",$="LG",j="Microsoft",C="Motorola",T="Opera",B="Samsung",W="Sharp",O="Sony",I="Xiaomi",U="Zebra",R="Facebook",N=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].toUpperCase()]=e[n];return t},G=function(e,t){return typeof e===c&&-1!==M(t).indexOf(M(e))},M=function(e){return e.toLowerCase()},q=function(e,t){if(typeof e===c)return e=e.replace(/^\s\s*/,""),typeof t===a?e:e.substring(0,350)},z=function(e,t){for(var n,i,r,a,c,u,p=0;p<t.length&&!c;){var d=t[p],y=t[p+1];for(n=i=0;n<d.length&&!c;)if(c=d[n++].exec(e))for(r=0;r<y.length;r++)u=c[++i],typeof(a=y[r])===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 i=0;i<t[n].length;i++)if(G(t[n][i],e))return"?"===n?o:n}else if(G(t[n],e))return"?"===n?o:n;return e},H={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"},J={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[h,[p,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[h,[p,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[p,h],[/opios[\/ ]+([\w\.]+)/i],[h,[p,T+" Mini"]],[/\bopr\/([\w\.]+)/i],[h,[p,T]],[/(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,h],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[h,[p,"UC"+D]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[h,[p,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[h,[p,"WeChat"]],[/konqueror\/([\w\.]+)/i],[h,[p,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[h,[p,"IE"]],[/yabrowser\/([\w\.]+)/i],[h,[p,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[p,/(.+)/,"$1 Secure "+D],h],[/\bfocus\/([\w\.]+)/i],[h,[p,V+" Focus"]],[/\bopt\/([\w\.]+)/i],[h,[p,T+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[h,[p,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[h,[p,"Dolphin"]],[/coast\/([\w\.]+)/i],[h,[p,T+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[h,[p,"MIUI "+D]],[/fxios\/([-\w\.]+)/i],[h,[p,V]],[/\bqihu|(qi?ho?o?|360)browser/i],[[p,"360 "+D]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[p,/(.+)/,"$1 "+D],h],[/(comodo_dragon)\/([\w\.]+)/i],[[p,/_/g," "],h],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[p,h],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[p],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[p,R],h],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[p,h],[/\bgsa\/([\w\.]+) .*safari\//i],[h,[p,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[h,[p,L+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[p,L+" WebView"],h],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[h,[p,"Android "+D]],[/(chrome|omniweb|arora|[t
vendor: 4,844 bytes, line 1
1izenoka]{5} ?browser)\/v?([\w\.]+)/i],[p,h],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[h,[p,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[h,p],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[p,[h,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","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[p,h],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[p,"Netscape"],h],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[h,[p,V+" 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,h],[/(cobalt)\/([\w\.]+)/i],[p,[h,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[f,"amd64"]],[/(ia32(?=;))/i],[[f,M]],[/((?:i[346]|x)86)[;\)]/i],[[f,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[f,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[f,"armhf"]],[/windows (ce|mobile); ppc;/i],[[f,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[f,/ower/,"",M]],[/(sun4\w)[;\)]/i],[[f,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[f,M]]],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,B],[d,m]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[u,[y,B],[d,w]],[/((ipod|iphone)\d+,\d+)/i],[u,[y,A],[d,w]],[/(ipad\d+,\d+)/i],[u,[y,A],[d,m]],[/\((ip(?:hone|od)[\w ]*);/i],[u,[y,A],[d,w]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[u,[y,A],[d,m]],[/(macintosh);/i],[u,[y,A]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[u,[y,_],[d,m]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[u,[y,_],[d,w]],[/\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,I],[d,w]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[u,/_/g," "],[y,I],[d,m]],[/; (\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,w]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[u,[y,"Vivo"],[d,w]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[u,[y,"Realme"],[d,w]],[/\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,C],[d,w]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[u,[y,C],[d,m]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[u,[y,$],[d,m]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[u,[y,$],[d,w]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[u,[y,"Lenovo"],[d,m]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[u,/_/g," "],[y,"Nokia"],[d,w]],[/(pixel c)\b/i],[u,[y,E],[d,m]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[u,[y,E],[d,w]],[/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,O],[d,w]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[u,"Xperia Tablet"],[y,O],[d,m]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[u,[y,"OnePlus"],[d,w]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[u,[y,P],[d,m]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[u,/(.+)/g,"Fire Phone $1"],[y,P],[d,w]],[/(playbook);[-\w\),; ]+(rim)/i],[u,y,[d,m]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[u,[y,x],[d,w]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[u,[y,S],[d,m]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[u,[y,S],[d,w]],[/(nexus 9)/i],[u,[y,"HTC"],[d,m]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\w]*)/i],[y,[u,/_/g," "],[d,w]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[u,[y,"Acer"],[d,m]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[u,[y,"Meizu"],[d,w]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[u,[y,W],[d,w]],[/(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,w]],[/(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,m]],[/(surface duo)/i],[u,[y,j],[d,m]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[u,[y,"Fairphone"],[d,w]],[/(u304aa)/i],[u,[y,"AT&T"],[d,w]],[/\bsie-(\w*)/i],[u,[y,"Siemens"],[d,w]],[/\b(rct\w+) b/i],[u,[y,"RCA"],[d,m]],[/\b(venue[\d ]{2,7}) b/i],[u,[y,"Dell"],[d,m]],[/\b(q(?:mv|ta)\w+) b/i],[u,[y,"Verizon"],[d,m]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[u,[y,"Barnes & Noble"],[d,m]],[/\b(tm\d{3}\w+) b/i],[u,[y,"NuVision"],[d,m]],[/\b(k88) b/i],[u,[y,"ZTE"],[d,m]],[/\b(nx\d{3}j) b/i],[u,[y,"ZTE"],[d,w]],[/\b(gen\d{3}) b.+49h/i],[u,[y,"Swiss"],[d,w]],[/\b(zur\d{3}) b/i],[u,[y,"Swiss"],[d,m]],[/\b((zeki)?tb.*\b) b/i],[u,[y,"Zeki"],[d,m]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[y,"Dragon Touch"],u,[d,m]],[/\b(ns-?\w{0,9}) b/i],[u,[y,"Insignia"],[d,m]],[/\b((nxa|next)-?\w{0,9}) b/i],[u,[y,"NextBook"],[d,m]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[y,"Voice"],u,[d,w]],[/\b(lvtel\-)?(v1[12]) b/i],[[y,"LvTel"],u,[d,w]],[/\b(ph-1) /i],[u,[y,"Essential"],[d,w]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[u,[y,"Envizen"],[d,m]],[/\b(trio[-\w\. ]+) b/i],[u,[y,"MachSpeed"],[d,m]],[/\btu_(1491) b/i],[u,[y,"Rotor"],[d,m]],[/(shield[\w ]+) b/i],[u,[y,"Nvidia"],[d,m]],[/(sprint) (\w+)/i],[y,u,[d,w]],[/(kin\.[onetw]{3})/i],[[u,/\./g," "],[y,j],[d,w]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[u,[y,U],[d,m]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[u,[y,U],[d,w]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[y,u,[d,g]],[/droid.+; (shield) bui/i],[u,[y,"Nvidia"],[d,g]],[/(playstation [345portablevi]+)/i],[u,[y,O],[d,g]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[u,[y,j],[d,g]],[/smart-tv.+(samsung)/i],[y,[d,b]],[/hbbtv.+maple;(\d+)/i],[[u,/^/,"SmartTV"],[y,B],[d,b]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[y,$],[d,b]],[/(apple) ?tv/i],[y,[u,A+" TV"],[d,b]],[/crkey/i],[[u,L+"cast"],[y,E],[d,b]],[/droid.+aft(\w)( bui|\))/i],[u,[y,P],[d,b]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[u,[y,W],[d,b]],[/(bravia[\w ]+)( bui|\))/i],[u,[y,O],[d,b]],[/(mitv-\w{5}) bui/i],[u,[y,I],[d,b]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i],[[y,q],[u,q],[d,b]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[d,b]],[/((pebble))app/i],[y,u,[d,v]],[/droid.+; (glass) \d/i],[u,[y,E],[d,v]],[/droid.+; (wt63?0{2,3})\)/i],[u,[y,U],[d,v]],[/(quest( 2)?)/i],[u,[y,R],[d,v]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[y,[d,k]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[u,[d,w]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[u,[d,m]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[d,m]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[d,w]],[/(android[-\w\. ]{0,9});.+buil/i],[u,[y,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[h,[p,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[h,[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,h],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[h,p]],os:[[/microsoft (windows) (vista|xp)/i],[p,h],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[p,[h,F,H]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[p,"Windows"],[h,F,H]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[h,/_/g,"."],[p,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[p,"Mac OS"],[h,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[h,p],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[p,h],[/\(bb(10);/i],[h,[p,x]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[h,[p,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+);
1 rv:.+ gecko\/([\w\.]+)/i],[h,[p,V+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[h,[p,"webOS"]],[/crkey\/([\d\.]+)/i],[h,[p,L+"cast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[p,"Chromium OS"],h],[/(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,h],[/(sunos) ?([\w\.\d]*)/i],[[p,"Solaris"],h],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[p,h]]},Y=function(e,t){if(typeof e===l&&(t=e,e=o),!(this instanceof Y))return new Y(e,t).getResult();var n=e||(typeof r!==a&&r.navigator&&r.navigator.userAgent?r.navigator.userAgent:""),i=t?function(e,t){var n={};for(var i in e)t[i]&&t[i].length%2==0?n[i]=t[i].concat(e[i]):n[i]=e[i];return n}(J,t):J;return this.getBrowser=function(){var e,t={};return t[p]=o,t[h]=o,z.call(t,n,i.browser),t.major=typeof(e=t.version)===c?e.replace(/[^\d\.]/g,"").split(".")[0]:o,t},this.getCPU=function(){var e={};return e[f]=o,z.call(e,n,i.cpu),e},this.getDevice=function(){var e={};return e[y]=o,e[u]=o,e[d]=o,z.call(e,n,i.device),e},this.getEngine=function(){var e={};return e[p]=o,e[h]=o,z.call(e,n,i.engine),e},this.getOS=function(){var e={};return e[p]=o,e[h]=o,z.call(e,n,i.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?q(e,350):e,this},this.setUA(n),this};Y.VERSION="0.7.33",Y.BROWSER=N([p,h,"major"]),Y.CPU=N([f]),Y.DEVICE=N([u,y,d,g,w,b,m,v,k]),Y.ENGINE=Y.OS=N([p,h]),typeof t!==a?(e.exports&&(t=e.exports=Y),t.UAParser=Y):n.amdO?(i=function(){return Y}.call(t,n,t,e))===o||(e.exports=i):typeof r!==a&&(r.UAParser=Y);var Z=typeof r!==a&&(r.jQuery||r.Zepto);if(Z&&!Z.ua){var K=new Y;Z.ua=K.getResult(),Z.ua.get=function(){return K.getUA()},Z.ua.set=function(e){K.setUA(e);var t=K.getResult();for(var n in t)Z.ua[n]=t[n]}}}("object"==typeof window?window:this)}},_t={};function $t(e){var t=_t[e];if(void 0!==t)return t.exports;var n=_t[e]={exports:{}};return Et[e].call(n.exports,n,n.exports,$t),n.exports}$t.amdO={},$t.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return $t.d(t,{a:t}),t},$t.d=(e,t)=>{for(var n in t)$t.o(t,n)&&!$t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},$t.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var jt={};$t.d(jt,{Ay:()=>It,Hi:()=>Wt,Tc:()=>Bt,vV:()=>Ot});var Ct=$t(724),Tt=$t.n(Ct);const Bt={console:0,mobile:1,tablet:2,smarttv:3,wearable:4,other:5},Wt=["type","os","viewer"],Ot=function(e){try{const t=Tt()(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:""}}},It=Ot,Ut=jt.Tc,Rt=jt.Ay,Nt=jt.Hi,Gt="sophi_demeter",Mt=31536e3,qt=!1,zt=12,Ft=!0,Ht={enabled:!1,key:"demeter_tracing"},Jt={visitorType:!1,contentPropensityLevel:!1},Yt=V.union([V.pipe(V.string(),V.trim(),V.toLowerCase(),V.check(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"))]),Zt=V.pipe(V.string(),V.check(e=>{try{return new RegExp(e),!0}catch{return!1}},"Invalid regex pattern")),Kt=V.object({isEnabled:V.literal(!0),name:V.optional(V.string(),Gt),maxAge:V.optional(V.number(),Mt),includeOutcome:V.optional(V.boolean(),qt)}),Qt=V.object({isEnabled:V.literal(!1)}),Xt=V.optional(V.union([Kt,Qt]),{isEnabled:!1}
1),en=V.object({type:V.union([V.literal("client"),V.literal("server")])}),tn=V.object({isDeviceAndLocationDataAllowed:V.literal(!0),isUserBehaviorDataAllowed:V.literal(!0)}),nn=V.object({isDeviceAndLocationDataAllowed:V.literal(!1),isUserBehaviorDataAllowed:V.literal(!1)}),rn=V.optional(V.object({off:V.union([nn,tn]),on:tn}),{off:{isDeviceAndLocationDataAllowed:!1,isUserBehaviorDataAllowed:!1},on:{isDeviceAndLocationDataAllowed:!0,isUserBehaviorDataAllowed:!0}}),on=V.object({name:V.union([V.literal("contains"),V.literal("regex"),V.literal("toBoolean"),V.literal("toNumber")]),args:V.optional(V.record(V.string(),V.any()))}),sn=V.union([V.array(on)]),an=V.object({source:V.pipe(V.string(),V.toLowerCase(),V.literal("url")),expression:Zt}),ln=V.object({source:V.pipe(V.string(),V.toLowerCase(),V.literal("dom")),selector:V.string(),attribute:V.string(),expression:V.optional(Zt)}),cn=V.object({source:V.pipe(V.string(),V.toLowerCase(),V.literal("window")),path:V.pipe(V.string(),V.minLength(1)),expression:V.optional(Zt)}),un=V.union([an,ln,cn]),pn=V.object({name:V.union([V.literal("daysSince"),V.literal("hoursSince"),V.literal("toBoolean"),V.literal("map")]),args:V.optional(V.record(V.string(),V.any()))}),dn=V.object({name:V.pipe(V.string(),V.trim(),V.minLength(1)),handler:V.optional(pn),type:V.union([V.literal("string"),V.literal("number"),V.literal("boolean"),V.literal("list")]),tracked:V.optional(V.boolean())}),yn=V.intersect([un,dn,V.object({key:mt})]),hn=V.array(yn),fn=V.picklist(Nt),gn=V.picklist(["timeZone","referrer"]),wn=V.object({source:V.literal("device"),key:fn}),mn=V.object({source:V.literal("contentProperties"),key:mt}),bn=V.object({source:V.literal("userProperties"),key:pt}),vn=V.object({source:V.literal("visit"),key:gn}),kn=V.union([wn,mn,bn,vn]),Pn=V.object({host:V.pipe(V.string(),V.minLength(1)),url:V.optional(V.string(),"https://paywall.sophi.io"),timeout:V.optional(V.pipe(V.number(),V.check(e=>e>0)),2e3),dataMap:V.pipe(V.optional(V.record(V.string(),kn),{}),V.check(e=>!Lt.some(t=>t in e),"dataMap must not include SDK-reserved parameters: content.id, visitor.type, modelTrace, experiment.id, experiment.assignedGroup"))}),An=V.object({selector:V.string()}),Sn=V.object({event:V.string()}),xn=V.union([An,Sn]),Dn=V.pipe(V.string(),V.trim(),V.minLength(1),V.check(e=>/^[A-Za-z0-9_-]+$/.test(e),"Wall property keys may only contain letters, numbers, underscores, and hyphens")),Ln=V.union([V.string(),V.number(),V.boolean()]),Vn=V.object({key:pt,name:V.string(),type:V.literal("number"),tracked:V.optional(V.boolean(),Ft),handlers:V.optional(sn)}),En=V.object({key:pt,name:V.string(),type:V.literal("string"),minLength:V.optional(V.number()),maxLength:V.optional(V.number(),zt),tracked:V.optional(V.boolean(),Ft),handlers:V.optional(sn)}),_n=V.object({key:pt,name:V.string(),type:V.literal("boolean"),tracked:V.optional(V.boolean(),Ft),handlers:V.optional(sn)}),$n=V.union([V.literal("string"),V.literal("number"),V.literal("boolean")]),jn=V.union([V.literal("visitorType"),pt]),Cn=V.object({key:jn,name:V.string(),type:$n,minLength:V.optional(V.number()),maxLength:V.optional(V.number(),zt),tracked:V.optional(V.boolean(),Ft),handlers:V.optional(sn)}),Tn=V.intersect([Cn,V.object({source:V.pipe(V.string(),V.toLowerCase(),V.literal("window")),path:V.pipe(V.string(),V.minLength(1)),expression:V.optional(Zt)})]),Bn=V.intersect([Cn,V.object({source:V.pipe(V.string(),V.toLowerCase(),V.literal("dom")),selector:V.string(),attribute:V.string(),expression:V.optional(Zt)})]),Wn=V.intersect([Cn,V.object({source:V.pipe(V.string(),V.toLowerCase(),V.literal("url")),expression:Zt})]),On=V.union([Tn,Bn,Wn,Vn,En,_n]),In=V.array(On),Un=V.object({key:Dn,name:V.string(),tracked:V.optional(V.boolean(),!0)}),Rn=V.union([V.object({type:V.literal("string"),default:V.optional(V.string())}),V.object({type:V.literal("number"),default:V.optional(V.number())}),V.object({type:V.literal("boolean"),default:V.optional(V.boolean())}),V.object({type:V.literal("enum"),options:V.pipe(V.array(Ln),V.minLength(1)),default:V.optional(Ln)})]),Nn=V.intersect([Un,Rn]),Gn=V.pipe(Nn,V.check(e=>void 0===e.default||Dt(e.default,e),"Wall property default must match its configured type"),V.check(e=>"enum"===e.type||!("options"in e&&void 0!==e.options),"options is only supported for wall properties with type 'enum'")),Mn=V.array(Gn),qn=V.optional(V.boolean(),!0),zn=V.optional(V.object({enabled:V.optional(V.boolean(),Ht.enabled),key:V.optional(V.string(),Ht.key)}),Ht),Fn=V.optional(V.object({contentPropensityLevel:V.optional(V.union([V.literal(!1),ln]),Jt.contentPropensityLevel),visitorType:V.optional(V.union([V.literal(!1),ln]),Jt.visitorType)}),Jt),Hn=V.pipe(V.string(),V.trim(),V.minLength(1)),Jn=V.strictObject({hostname:Yt,model:V.string(),analytics:V.string(),mainHost:V.optional(Yt),subMarket:V.optional(V.string()),enableExperiment:V.optional(V.boolean()),cookie:Xt,subdomains:V.optional(V.array(Yt),[]),mode:rn,paywallApi:V.optional(Pn),spa:V.optional(xn),userProperties:V.optional(In),wallProperties:V.optional(Mn),contentProperties:V.optional(hn),generatePageviewOnWallHit:qn,wallGeneration:V.optional(en,{type:"client"}),addTracingToLocalStorage:zn,enableWallIndicators:V.optional(V.boolean(),!1),newsletterCampaigns:V.optional(V.array(V.string()),[]),metaValues:Fn,showPaywallScore:V.optional(V.boolean(),!1),policy:V.optional(V.object({evaluator:Hn,thresholds:V.optional(Hn)})),extensions:V.optional(St),tenant:V.string()}),Yn=V.pipe(V.custom(e=>!e||"object"!=typeof e||!("analytics"in e)||"custom"===e.analytics,"Unsupported analytics module"),V.custom(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"),V.custom(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"')),Zn=V.pipe(Jn,Yn,V.transform(e=>({...e,mainHost:e.mainHost??e.hostname}))),Kn=JSON.parse('{"hostname":"modernhealthcare.com","subdomains":[],"model":"crain_modernhealthcare","analytics":"custom","enableExperiment":true,"policy":{"evaluator":"default"},"mode":{"off":{"isDeviceAndLocationDataAllowed":true,"isUserBehaviorDataAllowed":true},"on":{"isDeviceAndLocationDataAllowed":true,"isUserBehaviorDataAllowed":true}},"generatePageviewOnWallHit":false,"contentProperties":[{"key":"content.age","source":"dom","selector":"meta[name=\'s
1ailthru.date\']","attribute":"content","name":"Content Age","type":"number","tracked":false},{"key":"content.ageInHours","source":"dom","selector":"meta[name=\'sailthru.date\']","attribute":"content","name":"Content Age in Hours","type":"number","tracked":false},{"key":"1","source":"url","expression":"^((?:\\\\/[^\\\\/]+)+)\\\\/.+$","name":"Breadcrumb","type":"string","tracked":false},{"key":"2","source":"dom","selector":"meta[name=\'content-code\']","attribute":"content","name":"Content Code","type":"string","tracked":false}],"tenant":"craincommunications"}');class Qn{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.#i()}#t;#n;#e;getDefaultConsentValue(){return!0===this.#t.isDeviceAndLocationDataAllowed&&!0===this.#t.isUserBehaviorDataAllowed?"on":"off"}#i(){const e=ce(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 Xn(e){return e?"selector"in e?`yes\n      · observed DOM element: ${e.selector}`:`yes\n      · listening for event: ${e.event}`:"no"}function ei(e){return!1===e?"disabled":ti(e)}function ti(e){return`enabled\n      · selector: ${e.selector}\n      · attribute: ${e.attribute}`}function ni(e){return e&&0!==e.length?e.map(e=>`${e.key} - ${e.name}`).join(", "):"none"}const ii=(li=(()=>{const e=sessionStorage.getItem("sophi_demeter_config");if(null!==e)try{return JSON.parse(e)}catch(e){return null}})()??Kn,V.parse(Zn,li)),ri=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 Qn(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.newsletterCampaigns=e.newsletterCampaigns,this.metaValues=e.metaValues,this.showPaywallScore=e.showPaywallScore,function(e){const t=e.subdomains??[];0!==t.length&&(!1===e.cookie.isEnabled&&ae.warn("Subdomains are configured while cookie.isEnabled is false. Subdomain events will not be persisted in cookie queue."),t.includes(e.mainHost)&&ae.warn(`Subdomains contain mainHost entry (${e.mainHost}).`))}(e),ae.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`;var n;return t="debug"===oe.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: ${Xn(e.spa)}\n    · Wallhits generate pageviews: ${e.generatePageviewOnWallHit?"yes":"no"}\n    · Wall indicators: ${e.enableWallIndicators?"enabled":"disabled"}\n    · Visitor type detection: ${ei(e.metaValues.visitorType)}\n    · Content propensity level detection: ${ei(e.metaValues.contentPropensityLevel)}\n    · User properties: ${ni(e.userProperties)}\n    · Wall properties: ${ni(e.wallProperties)}\n    · Content properties: ${ni(e.contentProperties)}`:`${t}\n    ${n=[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:Xn(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:ti(e.metaValues.visitorType)},e.metaValues.contentPropensityLevel&&{label:"Content propensity level detection",value:ei(e.metaValues.contentPropensityLevel)}],n.filter(e=>Boolean(e)).map(e=>`· ${e.label}: ${e.value}\n    `).join("")}`,t}(this))}}(ii),oi=function(e){let t=null;if(ri.enableExperiment&&window.sophi?.abTests&&!0===ri.mode.isDeviceAndLocationDataAllowed&&!0===ri.mode.isUserBehaviorDataAllowed){const n=window.sophi?.abTests.getAllExperimentsSync(e);n.length>0&&(t=n[0])}return t},si=()=>oi("external"),ai=()=>oi("internal");var li;si(),ai();var ci=(e=>
1(e.Initialized="i",e.Loading="l",e.Executing="x",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))(ci||{});let ui=0;function pi(e){const t=window.sophi?.demeter;if(!t)return;const n=`${e}${(()=>{const e=performance.now()-ui,t=Math.min(Math.floor(e/10)/100,999.99);return String(t).replace(/^0\./,".")})()}`;t.initStatus=t.initStatus?`${t.initStatus},${n}`:n}const di={trace:"",context:"",inputs:"",experimentsCode:null,assignedGroup:null,userProperties:"",contentProperties:""},yi=()=>{window.sophi.dataLayer={...di}},hi=()=>window.sophi.dataLayer;function fi(e){const t={};var n;return"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 gi(e){window.sophi.dataLayer={...window.sophi.dataLayer,...fi(e)}}const wi=function(){pi(ci.DataLayerReady),window.dispatchEvent(new Event("sophiDataLayerReady"))};var mi=(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))(mi||{});const bi=V.union([V.null_(),V.pipe(V.string(),V.trim(),V.toLowerCase())]),vi=V.object({article:V.boolean(),section:V.optional(bi)}),ki=V.union([V.union([V.pipe(V.string(),V.trim(),V.literal("paywall")),V.pipe(V.string(),V.trim(),V.literal("regwall"))]),V.object({wallType:V.union([V.pipe(V.string(),V.trim(),V.literal("paywall")),V.pipe(V.string(),V.trim(),V.literal("regwall"))]),section:V.optional(bi)})]),Pi=V.union([V.object({type:V.literal("pageview"),payload:vi}),V.object({type:V.literal("wall"),payload:ki}),V.object({type:V.literal("UserProperties"),payload:V.any()})]),Ai=(V.union([Pi,V.object({type:V.literal("GetDecision")}),V.object({type:V.literal("Init")}),V.object({type:V.literal("EnableAllFeatures")})]),(e,t,n)=>{const i=document.querySelector(e);if(null===i)return null;const r=i.getAttribute(t);return null===r?null:n?Li(r,n):r}),Si=e=>"__proto__"!==e&&"constructor"!==e&&"prototype"!==e,xi=e=>{try{const t=e.split(".");if(t.length>10)return ae.warn(`Window path exceeds maximum depth of 10: "${e}" (depth: ${t.length})`),null;let n=window;for(const i of t){if(null==n)return null;if(!Si(i))return ae.warn(`Unsafe path segment detected: "${i}" in path "${e}"`),null;n=n[i]}return void 0===n?null:n}catch(t){return ae.warn(`Error extracting window path "${e}":`,t),null}},Di=(e,t,n,i)=>{const r=n?.minLength,o=n?.maxLength;return"number"==typeof r&&t.length<r?(ae.warn(`${i} ${e} expected to have a minimum length of ${r} but got '${t}' with length ${t.length}, omitting.`),{isValid:!1,processedValue:t}):"number"==typeof o&&t.length>o?(ae.warn(`${i} ${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}},Li=(e,t)=>{try{const n=new RegExp(t),i=e.match(n);if(null===i)return null;const r=i[1]??i[0];return void 0===i[1]&&i[0]&&ae.debug(`No capture group value, using full match: "${r}".`),r}catch(e){return ae.warn(`Regex error "${t}":`,e),null}},Vi=e=>null==e?null:String(e).toLowerCase();function Ei(e){const t=Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()),n=new Date,i=Date.UTC(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate())-t,r=Math.floor(i/864e5);return r<0?0:r}const _i={0:"free access",1:"subscribers only",2:"metered views",3:"special package"},$i=e=>{try{if("dom"===e.source)return Ai(e.selector,e.attribute,e.expression);if("url"===e.source){const t=new URL(location.href);return Li(t.pathname,e.expression)}return null}catch{return null}},ji=(e,t)=>Boolean(e),Ci=(e,t)=>{const n=t.args;return"contains"===t.name&&n?((e,t)=>
1{if(!t||!Array.isArray(e))return null;const{value:n,caseSensitive:i=!0}=t;return(Array.isArray(n)?n:[n]).some(t=>i?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??""),i=t;for(const e of i){const t=Li(n,e);if(t)return t}return null})(e,n):"toBoolean"===t.name?ji(e):"toNumber"===t.name?(e=>{if(null==e)return null;const t=Number(e);return Number.isNaN(t)?null:t})(e):null},Ti=(e,t)=>{let n=e;if(null==n||!t)return null;for(const e of t)n=Ci(n,e);return n??null},Bi={values:null,analyticsString:null};function Wi(e){return null===Bi.values&&Oi(e),Bi.values}function Oi(e){let t={values:{},analyticsString:""};try{t=Yi(e)}catch(e){ae.error("Error computing content properties:",e)}Bi.values=t.values,Bi.analyticsString=t.analyticsString}function Ii(e,t){const n=(t?.dateFormat||"iso").toLowerCase();let i;return i="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(i.getTime())?null:i}const Ui=new Set(["unixseconds","unixmillis"]),Ri=/^\d+$/;function Ni(e,t){const n=(t?.dateFormat||"iso").toLowerCase();return!Ui.has(n)||Ri.test(e.trim())}function Gi(e,t){if(null==e)return null;if(!t)return e;switch(t.name){case"daysSince":{const n=function(e,t){try{if(!Ni(e,t))return null;const n=Ii(e,t);return n?Ei(n):null}catch{return null}}(e,t.args);return null===n?null:n}case"hoursSince":{const n=function(e,t){try{if(!Ni(e,t))return null;const n=Ii(e,t);if(!n)return null;const i=Math.floor((Date.now()-n.getTime())/36e5);return i<0?0:i}catch{return null}}(e,t.args);return null===n?null:n}case"toBoolean":return ji(e);case"lowercase":return Vi(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 Mi(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=(i=e,i.split(",").map(e=>Vi(e)?.replace(/,/g,"").trim()).filter(Boolean)).join(" ")),t.handler&&(n=Gi("string"==typeof n?n:String(n),t.handler));var i;return n}function qi(e,t,n){if(e===ye){const e=Gi(t,{name:"map",args:n.handler?.args});return Number(e)in _i?_i[e]:null}return e===ue&&"string"==typeof t?Gi(t,{name:"daysSince",args:n.handler?.args}):e===pe&&"string"==typeof t?Gi(t,{name:"hoursSince",args:n.handler?.args}):t}function zi(e,t,n){return"string"===n.type&&"string"==typeof t?Di(e,t,n,"Content property"):{isValid:!0,processedValue:t}}function Fi(e){return null==e||""===e}const Hi={[ue]:"A",[de]:"B",[ye]:"C",[pe]:"D"},Ji=e=>e in Hi?Hi[e]:e,Yi=e=>{const t=e.contentProperties||[],n={},i=[],r=[],o=[];for(const e of t){const t=e.key,s=$i(e);let a=null;if(a=t in Hi?qi(t,s,e):Mi(s,e),Fi(a)){r.push(e.name);continue}const{isValid:l,processedValue:c}=zi(t,a,e);l&&(a=c,n[t]=a,o.push({label:e.name||t,value:a}),e.tracked&&i.push(`${Ji(t)}:${a}`))}return t.length>0&&function(e,t){e.length>0&&ae.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)}`);ae.info("Content Properties Found\n\n"+n.join("\n"))}(r,o),{values:n,analyticsString:i.join(",")}};function Zi(e){return Object.entries(e)}const Ki=new class{constructor(){this.key="demeter"}get(){try{const e=localStorage.getItem(this.key);return null===e?e:JSON.parse(atob(e))}catch(e){return null}}set(e){try{return localStorage.setItem(this.key,btoa(JSON.stringify(e)))}catch(e){}}clear(){try{return localStorage.removeItem(this.key)}catch(e){}}},Qi=V.array(V.string()),Xi=V.object({pageViews:V.number(),pageViewsByArticle:V.number(),pageViewsByArticleWithPaywall:V.number(),pageViewsByArticleWithRegwall:V.number(),topLevelSections:Qi,topLevelSectionsByArticle:Qi}),er=V.object({granted:V.boolean(),timestamp:V.string()});function tr(){return(new Date).toISOString()}class nr{constructor(){this.pageViews=0,this.pageViewsByArticle=0,this.pageViewsByArticleWithPaywall=0,this.pageViewsByArticleWithRegwall=0,this.topLevelSections=[],this.topLevelSectionsByArticle=[]}}const ir=V.optional(V.array(Pi),[]),rr=V.object({previous:V.partial(X),events:ir}),or=V.object({previous:V.optional(X),events:ir,outcomes:V.optional(V.array(M),[])}),sr=V.pipe(V.any(),V.transform(e=>{const t=V.safeParse(or,e);if(t.success)return t.output;const n=V.safeParse(rr,e);return n.success?{events:n.output.events,previous:n.output.previous,outcomes:[]}:{events:[],previous:void 0,outcomes:[]}})),ar=V.object({today:Xi,history:V.array(Xi),lastSeen:V.string(),visitor:W,coldDataLayer:sr,consent:V.optional(er)}),lr=V.tuple([V.number(),V.number(),V.number(),V.number(),Qi,Qi]),cr=V.object({lS:V.string(),v:W,t:lr,h:V.array(lr),cDL:sr,c:V.optional(V.tuple([V.boolean(),V.string()]))}),ur=e=>[e.pageViews,e.pageViewsByArticle,e.pageViewsByArticleWithPaywall,e.pageViewsByArticleWithRegwall,e.topLevelSections,e.topLevelSectionsByArticle],pr=e=>({pageViews:e[0],pageViewsByArticle:e[1],pageViewsByArticleWithPaywall:e[2],pageViewsByArticleWithRegwall:e[3],topLevelSections:e[4],topLevelSectionsByArticle:e[5]});class dr{constructor(){this.today={pageViews:0,pageViewsByArticle:0,pageViewsByArticleWithPaywall:0,pageViewsByArticleWithRegwall:0,topLevelSections:[],topLevelSectionsByArticle:[]},this.history=Array(28).fill(void 0).map(()=>new nr),this.lastSeen="",this.visitor="anonymous",this.coldDataLayer={previous:void 0,events:[],outcomes:[]},this.consent=void 0}}const yr=new class{#r;constructor(){const e=Ki.get();this.#r=this.#o(this.#s(e))}#s(e){try{const t=V.safeParse(cr,e);return t.success?(e=>{const{lS:t,v:n,t:i,h:r,cDL:o,c:s}=e,a=r.map(pr);return{lastSeen:t,visitor:n,today:pr(i),history:a,coldDataLayer:o,consent:s?{granted:s[0],timestamp:s[1]}:void 0}})(t.output):V.parse(ar,e)}catch(e){return new dr}}getFromStored(){this.updateState(this.#s(Ki.get()))}updateState(e){this.#r=this.#o(e),Ki.set((e=>{const{today:t,history:n,lastSeen:i,visitor:r,coldDataLayer:o,consent:s}=e,a=n.map(ur);return{lS:i,v:r,t:ur(t),h:a,cDL:o,c:s?[s.granted,s.timestamp]:void 0}})(e))}getState(){return JSON.parse(JSON.stringify(this.#r))}clear(){Ki.clear(),this.#r=this.#o(this.#s(null))}getConsent(){return this.#r.consent}setConsent(e){const t=this.getState();t.consent={granted:e,timestamp:tr()},this.updateState(t)}#o(e){if(!1===ri.mode.isUserBehaviorDataAllowed)return e;const t=new Date(e.lastSeen),n=Math.max(0,Ei(t));if(n>0){e.history.unshift(e.today);for(let t=0;t<n-1;t++)e.history.unshift((new dr).today);e.history=e.history.slice(0,28),e.today=(new dr).today}return e.lastSeen=tr(),e}},hr=yr,fr=(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}},gr=e=>{const t=V.safeParse(W,e);return t.success?{isValid:!0,value:t.output}:(ae.warn(`visitorType should be '${C}' or '${T}', got '${e}'.`),{isValid:!1,value:null})},wr={countryCode:"A"},mr=[{key:"visitorType",name:"Visitor type",type:"string"}],br=(e,t,n)=>"minLength"in n&&void 0!==n.minLength&&t.length<n.minLength?(ae.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?(ae.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},vr=(e,t)=>{if(!0!==e.mode.isDeviceAndLocationDataAllowed||!0!==e.mode.isUserBehaviorDataAllowed)return void ae.debug("Discarding userProperties event");const{custom:n,reserved:i}=((e,t)=>{const n={},i={};if("object"!=typeof t||null===t)return ae.warn("User properties must be in an 'args' object. Received:",t),{custom:n,reserved:i};const r=(e=>{const t=new Map;for(const e of mr)t.set(e.key,e);for(const n of e)t.set(n.key,n);return t})(e.userProperties||[]);for(const e of Zi(t)){let[t,o]=e;const s=r.get(t);if(s){if("handlers"in s&&s.handlers){const e=Ti(o,s.handlers);if(void 0===e){ae.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}=br(t,o,s);if(!e)continue;o=n}if("visitorType"===s.key){const{isValid:e,value:t}=gr(o);if(!e)continue;i[s.key]=t;continue}n[s.key]=o}else ae.warn(`User property ${t} expected to be a ${s.type} but got ${typeof o}, omitting.`)}else ae.warn(`User property ${t} is not configured, omitting.`)}return{custom:n,reserved:i}})(e,t);if(Object.keys(n).length>0&&ae.debug("Setting user properties",n),Object.keys(i).length>0&&ae.debug("Setting reserved properties",i),Object.keys(n).length>0&&Rs.update(e=>{Object.assign(e.userProperties,n)}),i.visitorType){const e=hr.getState(),t=i.visitorType;hr.updateState({...e,visitor:t})}},kr=vr,Pr=["utm_campaign","utm_medium","utm_source"],Ar=function(e=window.location.href){try{const t=new URL(e),n={};return Pr.forEach(e=>{const i=t.searchParams.get(e);null!==i&&(n[e]=i.toLowerCase())}),n}catch(e){return ae.error("Unable to extract query parameters.",e),{}}};var Sr={d:(e,t)=>{for(var n in t)Sr.o(t,n)&&!Sr.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},xr={};Sr.d(xr,{Ay:()=>$r,Fo:()=>Vr,LU:()=>_r,Tk:()=>Lr,VS:()=>Dr,cr:()=>Er});const Dr={campaign:0,direct:1,internal:2,search:3,social:4,other:5},Lr={google:0,yahoo:1,duckduckgo:2,bing:3,facebook:4,instagram:5,x:6,linkedin:7,reddit:8,newsletter:9},Vr={search:0,news:1,discover:2},Er=function(e,t,n,i){return _r(e,t,n,i)?.medium},_r=function(e,t,n,i,r){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=r?.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 i&&t.includes("google.com")&&i.includes("Safari")&&(i.includes("GSA")||i.includes("GNews"))&&(i.includes("604.1")||i.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 h=[{source:"facebook"},{source:"instagram"},{source:"x",domains:["x.com","t.co"]},{source:"linkedin"},{source:"reddit"}];for(const e of h)if(y(e).test(u))return{medium:"social",source:e.source};return{medium:"other",source:u||void 0}},$r=Er,jr=xr.Fo,Cr=xr.VS,Tr=xr.Tk,Br=xr.LU,Wr=function(){try{return Br(window.location.href,document.referrer,window.location.host,navigator.userAgent,ri)}catch(e){return ae.error("Unable to determine referrer.",e),{medium:"",source:"",channel:""}}},Or=()=>{Rs.update(e=>{e.visitor.session.timestamp=new Date})},Ir=()=>{null===(null===Rs.state.visitor.session.timestamp?null:(e=>new Date(e.getTime()+18e5))(Rs.state.visitor.session.timestamp).toISOString()<(new Date).toISOString()?(Rs.update(e=>{e.visitor.session=new ct}),null):Rs.state.visitor.session)?((()=>{const e=/^(?:https?:\/\/)?([^/]+)/i;if("string"==typeof document.referrer){const t=document.referrer.match(e);null!==t&&Rs.update(e=>{e.visitor.session.referrerDomain=t[1]})}})(),(()=>{try{const e=new URLSearchParams(window.location.search).get("utm_campaign");null!==e&&Rs.update(t=>{t.visitor.session.campaignName=e.toLowerCase()})}catch{}})(),(()=>{const{medium:e,source:t,channel:n}=Wr();Rs.update(i=>{i.visitor.session.referrerMedium=e,i.visitor.session.referrerSource=t??null,i.visitor.session.referrerChannel=n??null})})(),(()=>{const e=Ar();Rs.update(t=>{t.visitor.session.queryParams=e})})(),Or()):Or()},Ur="sophiEventQueue",Rr=e=>atob(e),Nr=()=>{const e=Ur+"=",t=decodeURIComponent(document.cookie).split(";");for(let n=0;n<t.length;n++){let i=t[n].trimStart();if(i.startsWith(e)){const t=i.substring(16,i.length);try{return JSON.parse(Rr(t))}catch(e){return[]}}}return[]},Gr=e=>e.trim().toLowerCase(),Mr=new class{constructor(){this.isSubdomain=e
1=>{if(0===this.normalizedSubdomainAllowList.size)return!1;const t=window.location.hostname;return t!==this.normalizedMainHost&&this.normalizedSubdomainAllowList.has(t)},this.store=hr,this.normalizedMainHost=Gr(ri.mainHost),this.normalizedSubdomainAllowList=new Set((ri.subdomains??[]).map(Gr))}dispatch(e){switch(e.type){case mi.Init:this.handleInit();break;case mi.EnableAllFeatures:this.handleEnableAllFeatures();break;case mi.GetDecision:this.handleGetDecision();break;case mi.GetDecisionForArticleWallIndicators:this.handleGetDecisionForArticleWallIndicators();break;case mi.Pageview:e.payload=V.parse(vi,e.payload);try{this.handleSubdomainAwareEvent(e,this.handlePageview)}catch(e){ae.debug("Error in pageview event handler",e)}break;case mi.Wall:V.parse(ki,e.payload);try{this.handleSubdomainAwareEvent(e,this.handleWallHit)}catch(e){ae.debug("Error in wall event handler",e)}break;case mi.UserProperties:try{this.handleSubdomainAwareEvent(e,this.handleUserProperties)}catch(e){ae.debug("Error in userProperties event handler",e)}break;case mi.ContentProperties:try{this.handleContentProperties()}catch(e){ae.debug("Error in contentProperties event handler",e)}break;default:throw new Error("Invalid event type")}}getDispatch(){return this.dispatch.bind(this)}handleInit(){ae.debug("init handler"),this.dispatch({type:mi.ContentProperties})}handleEnableAllFeatures(){ae.info("⚙️ Received enableAllFeatures event"),ri.mode.on(),this.store.setConsent(!0),window.sophi?.abTests?.enableConsent(),this.isSubdomain(ri)||(this.store.getFromStored(),this.processStoredEvents(),Ir())}handleGetDecision(){ae.debug("getDecision event handler"),!0!==ri.mode.isUserBehaviorDataAllowed||Ir()}handleGetDecisionForArticleWallIndicators(){ae.debug("getDecisionForArticleWallIndicators event handler"),!0!==ri.mode.isUserBehaviorDataAllowed||Ir()}handlePageview(e){ae.info("🧮 Received pageview event",JSON.stringify(e,null,2));const{article:t,section:n}=e,i=this.store.getState();i.today.pageViews++,!0===t&&i.today.pageViewsByArticle++,"string"==typeof n&&n.length>0&&(!1===i.today.topLevelSections.includes(n)&&i.today.topLevelSections.push(n),!0===t&&!1===i.today.topLevelSectionsByArticle.includes(n)&&i.today.topLevelSectionsByArticle.push(n)),this.store.updateState(i)}handleWallHit(e){ae.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===ri.generatePageviewOnWallHit&&(ae.debug("Generating pageview from wall event"),this.handlePageview({article:!0,section:e.section}))}handleUserProperties(e){return kr(ri,e)}handleContentProperties(){Oi(ri),(e=>{if(!e.userProperties||0===e.userProperties.length)return;(e=>{const t=ce("userProperties.countryCode");t&&(e.userProperties??[]).some(e=>"countryCode"===e.key)&&vr(e,{countryCode:t})})(e);const t=e.userProperties.filter(e=>"source"in e&&"window"===e.source);if(0===t.length)return;const n=(e=>{const t={},n=[];for(const i of e){const{key:e,path:r,name:o,type:s,handlers:a}=i,l=xi(r);if(null===l){n.push(o);continue}if("visitorType"===e){const{isValid:i,value:r}=gr(l);if(!i||!r){n.push(o);continue}t[e]=r;continue}const c=a?l:fr(l,s);if(null!==c)if("string"==typeof c){const{isValid:r,processedValue:s}=Di(e,c,i,"User property");if(!r){n.push(o);continue}t[e]=s}else t[e]=c;else ae.warn(`User property "${o}" could not be converted to type "${s}". Value: "${l}"`),n.push(o)}return n.length>0&&ae.warn(`Some configured user properties were not found in window variables: ${n.join(", ")}`),t})(t);Object.keys(n).length>0&&(ae.debug("Initializing user properties from window",n),vr(e,n))})(ri),ae.debug("handleContentProperties handler",Wi(ri))}processSubdomainEvents(){this.isSubdomain(ri)||(Nr().forEach(e=>{ae.debug("Event Processed from cookie",e),e.type===mi.Pageview?this.handlePageview(e.payload):e.type===mi.Wall?this.handleWallHit(e.payload):e.type===mi.UserProperties&&this.handleUserProperties(e.payload)}),document.cookie=`${Ur}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; domain=${ri.hostname}; path=/`)}processPreviousPageEvents(){let e=this.store.getState();
1e.coldDataLayer.events.forEach(e=>{ae.debug("Event processed from storage",e),e.type===mi.Pageview&&this.handlePageview(e.payload),e.type===mi.Wall&&this.handleWallHit(e.payload),e.type===mi.UserProperties&&this.handleUserProperties(e.payload)}),e=this.store.getState(),this.store.updateState({...e,coldDataLayer:{...e.coldDataLayer,events:[]}})}processStoredEvents(){if(!1!==ri.mode.isUserBehaviorDataAllowed&&!1!==ri.mode.isDeviceAndLocationDataAllowed){this.processPreviousPageEvents();try{this.processSubdomainEvents()}catch(e){ae.debug("Error processing subdomain events",e)}}}handleSubdomainAwareEvent(e,t){if(this.isSubdomain(ri))try{return((e,t)=>{if(!1===ri.cookie.isEnabled)return;const n=Nr();var i;n.push({type:e,payload:t}),document.cookie=`${Ur}=${i=JSON.stringify(n),btoa(i)}; domain=${ri.hostname}; path=/; max-age=${ri.cookie.maxAge};`})(e.type,e.payload),void ae.debug(`Pushed ${e.type} event to cookie:`,e.payload)}catch(t){ae.debug(`Error pushing ${e.type} event to cookie`,t)}else this.processOrStoreInputEvent(e,t)}storeInputEvent(e){const t=this.store.getState();this.store.updateState({...t,coldDataLayer:{...t.coldDataLayer,events:[...t.coldDataLayer.events,e]}}),ae.debug("Stored event",e)}processOrStoreInputEvent(e,t){!0===ri.mode.isUserBehaviorDataAllowed?(Ir(),"server"===ri.wallGeneration.type?this.storeInputEvent(e):t.call(this,e.payload)):ae.debug(`Discarding ${e.type} event`)}},qr=Mr;function zr(e){return void 0!==e?{wallProperties:e}:{}}function Fr(e){return e.replace(/[_-]+([a-zA-Z0-9])/g,(e,t)=>t.toUpperCase())}function Hr(e){if(void 0!==e.default&&Dt(e.default,e))return e.default}function Jr(e){const t=ri.wallProperties;if(void 0===t)return;const n=t.filter(e=>!1!==e.tracked).map(t=>{const n=e?.[Fr(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 Yr(e,t={}){if(void 0===ri.wallProperties){const{wallProperties:t,outcome:n,...i}=e,{wallProperties:r,...o}=n;return{...i,outcome:o}}const n=function(){const e=new Map;for(const t of ri.wallProperties||[])e.set(t.key,t),e.set(Fr(t.key),t);return e}(),i={};for(const[t,r]of Object.entries(e.outcome.wallProperties??{})){const e=n.get(t);if(e){if(!Dt(r,e)){const n="enum"===e.type?`one of [${xt(e).join(", ")}]`:e.type;ae.debug(`Wall property ${t} expected ${n} but got ${typeof r}, omitting from outcome.`);continue}i[Fr(e.key)]=r}else ae.debug(`Wall property ${t} is not configured, omitting from outcome.`)}for(const[e,r]of Object.entries(t)){const t=n.get(e);if(t){if(!Dt(r,t)){const n="enum"===t.type?`one of [${xt(t).join(", ")}]`:t.type;ae.warn(`Wall property override ${e} expected ${n} but got ${typeof r}, omitting.`);continue}i[Fr(t.key)]=r}else ae.warn(`Wall property override ${e} is not configured, omitting.`)}return{...e,wallProperties:Jr(i),outcome:{...e.outcome,wallProperties:i}}}const Zr=V.object({[_.PAYWALL]:V.number(),[_.REGWALL]:V.optional(V.number())});function Kr(e){let t=0,n=.1,i=0;i=Math.random();let r=Math.round(10*e.todayPageViewsByArticleWithPaywall/e.todayPageViewsByArticle)/10,o=Math.round(10*(e.sevenDayPageViewsByArticleWithPaywall+e.twentyEightDayPageViewsByArticleWithPaywall)/(e.sevenDayPageViewsByArticle+e.twentyEightDayPageViewsByArticle))/10,s=e.todayPageViews+e.sevenDayPageViews+e.twentyEightDayPageViews,a=e.hourOfDay,l=(new Date).getDay(),c="undefined";"number"==typeof l&&(c=["weekends","weekdays","weekdays","weekdays","weekdays","weekdays","weekends"][l]);let u=c+e.hourOfDay.toString(),p=e.os;"string"==typeof p&&(p=p.toLowerCase());let d=e.viewer;"string"==typeof d&&(d=d.toLowerCase());let y=e.type+e.os;"string"==typeof y&&(y=y.toLowerCase()),"anonymous"===e.visitorType?(0===e.daysSinceLastVisit&&(t+=-.017),1===e.daysSinceLastVisit&&(t+=2.22*n),2===e.daysSinceLastVisit&&(t+=.266),3===e.daysSinceLastVisit&&(t+=3*n),4===e.daysSinceLastVisit&&(t+=2.95*n),5===e.daysSinceLastVisit&&(t+=.279),6===e.daysSinceLastVisit&&(t+=.25),7===e.daysSinceLastVisit&&(t+=.81*n),"android"===p&&(t+=-.083),"windows"===p&&(t+=.26*n),"ios"===p&&(t+=.025),"mac os"===p&&(t+=.219),"direct"===e.referrer&&(t+=-.001),"other"===e.referrer&&(t+=.86*n),"search"===e.referrer&&(t+=-.015
1),"social"===e.referrer&&(t+=.094),1===e.todayPageViews&&(t+=-.05),2===e.todayPageViews&&(t+=.219),3===e.todayPageViews&&(t+=.225),4===e.todayPageViews&&(t+=3*n),5===e.todayPageViews&&(t+=3*n),e.todayPageViews>=10&&e.todayPageViews<=14&&(t+=3*n),"chrome"===d&&(t+=-.03),"edge"===d&&(t+=1.86*n),"firefox"===d&&(t+=.064),"safari"===d&&(t+=.79*n),"samsung browser"===d&&(t+=-.35*n),0===s&&(t+=0),0===o&&(t+=-.016),1===o&&(t+=1.78*n),"weekdays"===c&&(t+=.009),"weekends"===c&&(t+=-.53*n),0===a&&(t+=-.54*n),2===a&&(t+=-.061),4===a&&(t+=-.79*n),6===a&&(t+=.1*n),8===a&&(t+=.021),a>=10&&a<=14&&(t+=.05),a>=12&&a<=16&&(t+=.042),a>=14&&a<=18&&(t+=.2*n),a>=16&&a<=20&&(t+=-.016),a>=18&&a<=22&&(t+=-.048),a>=20&&a<=24&&(t+=-0),a>=22&&a<=26&&(t+=-.28*n),.2===r&&(t+=3*n),.4===r&&(t+=3*n),.5===r&&(t+=3*n),.6===r&&(t+=3*n),.8===r&&(t+=3*n),1===r&&(t+=-.034),"weekdays0"===u&&(t+=-.53*n),"weekdays10"===u&&(t+=.062),"weekdays12"===u&&(t+=.059),"weekdays14"===u&&(t+=.28*n),"weekdays16"===u&&(t+=-.19*n),"weekdays18"===u&&(t+=-.45*n),"weekdays2"===u&&(t+=-.05),"weekdays20"===u&&(t+=.006),"weekdays22"===u&&(t+=-.26*n),"weekdays4"===u&&(t+=-.76*n),"weekdays6"===u&&(t+=.034),"weekdays8"===u&&(t+=.031),"weekends0"===u&&(t+=-.059),"weekends10"===u&&(t+=-.39*n),"weekends12"===u&&(t+=-.063),"weekends14"===u&&(t+=-.024),"weekends16"===u&&(t+=.003),"weekends18"===u&&(t+=-.061),"weekends20"===u&&(t+=-.26*n),"weekends22"===u&&(t+=-.037),"weekends8"===u&&(t+=-.063)):(0===e.daysSinceLastVisit&&(t+=.51*n),1===e.daysSinceLastVisit&&(t+=-.14*n),7===e.daysSinceLastVisit&&(t+=-.27*n),"windows"===p&&(t+=-.1*n),"mac os"===p&&(t+=.085),"direct"===e.referrer&&(t+=.07*n),"search"===e.referrer&&(t+=-.52*n),1===e.todayPageViews&&(t+=-.066),2===e.todayPageViews&&(t+=-.44*n),3===e.todayPageViews&&(t+=.11*n),4===e.todayPageViews&&(t+=.012),5===e.todayPageViews&&(t+=1.07*n),"chrome"===d&&(t+=.14*n),"edge"===d&&(t+=-.4*n),"safari"===d&&(t+=.047),0===s&&(t+=0),0===o&&(t+=.049),1===o&&(t+=-.39*n),"weekdays"===c&&(t+=-.001),6===a&&(t+=-.006),8===a&&(t+=-.13*n),a>=10&&a<=14&&(t+=.001),a>=12&&a<=16&&(t+=.03),a>=14&&a<=18&&(t+=-.11*n),.5===r&&(t+=.034),1===r&&(t+=-.062),"weekdays10"===u&&(t+=-0),"weekdays12"===u&&(t+=.03),"weekdays14"===u&&(t+=-.012),"weekdays6"===u&&(t+=-.003),"weekdays8"===u&&(t+=-.14*n));let h=.5+t;h+=.03*(i-.5);let f=h;return"registration-required"===e.contentProperties[2]&&(f+=.2),h<=.1?h=.1:h>1&&(h=.99),{[_.PAYWALL]:h,[_.REGWALL]:f}}const Qr=V.object({todayPageViews:V.number(),todayPageViewsByArticle:V.number(),todayPageViewsByArticleWithPaywall:V.number(),todayPageViewsByArticleWithRegwall:V.number(),todayTopLevelSections:V.number(),todayTopLevelSectionsByArticle:V.number(),sevenDayPageViews:V.number(),sevenDayPageViewsByArticle:V.number(),sevenDayPageViewsByArticleWithPaywall:V.number(),sevenDayPageViewsByArticleWithRegwall:V.number(),sevenDayTopLevelSections:V.number(),sevenDayTopLevelSectionsByArticle:V.number(),sevenDayVisitCount:V.number(),twentyEightDayPageViews:V.number(),twentyEightDayPageViewsByArticle:V.number(),twentyEightDayPageViewsByArticleWithPaywall:V.number(),twentyEightDayPageViewsByArticleWithRegwall:V.number(),twentyEightDayTopLevelSections:V.number(),twentyEightDayTopLevelSectionsByArticle:V.number(),twentyEightDayVisitCount:V.number(),daysSinceLastVisit:V.number(),timeZone:V.string(),referrer:V.string(),referrerData:V.object({medium:V.union([V.string(),V.null_()]),source:V.optional(V.union([V.string(),V.null_()])),channel:V.optional(V.union([V.string(),V.null_()])),queryParams:V.record(V.string(),V.string())}),hourOfDay:V.number(),os:V.string(),type:V.string(),viewer:V.string(),visitorType:V.string(),visitor:lt,userProperties:V.any(),contentProperties:V.any()});function Xr(e){return V.safeParse(Qr,e).success}const eo=new class{constructor(){this.fallback={[_.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),{[_.PAYWALL]:e}}();switch(e.assignedGroup||"control"){case"variant":case"holdout":return function(e){return Kr(e)}(e);default:return Kr(e)}}(e);return V.parse(Zr,t)}catch(t){return ae.debug("Invalid ModelScores returned by `predict`, using fallback.",e,t),pi(ci.ModelEvalFailed),this.fallback}}},to=eo,no=V.object({id:V.string(),outcome:Q,createdAt:V.string(),trace:V.string()});function io(e){return null!=e&&("string"!=typeof e||""!==e)}function ro(e,t,n){switch(e.source){case"device":case"visit":return n[e.key];case"contentProperties":return Wi(t)[e.key];case"userProperties":return Rs.state.userProperties[e.key];default:return void ae.warn(`Unknown dataMap source: ${e.source}`)}}const oo={xhigh:5,high:4,medium:3,low:2,xlow:1,null:null},so=(Array.from(Object.keys(oo)),Array.from(Object.values(oo))),ao=(V.union([...so.filter(e=>null!==e).map(e=>V.literal(e)),V.null_()]),so.filter(e=>null!==e).reverse()),lo=`Unknown content propensity level. Expected one of: ${ao.join(", ")}.`,co=V.pipe(V.union([V.string(),V.number()]),V.transform(Number),V.number(),V.picklist(ao));function uo(e){const t=e.find(e=>e.wallType===_.PAYWALL),n={[_.PAYWALL]:t?.score},i=e.find(e=>e.wallType===_.REGWALL);return void 0!==i&&(n[_.REGWALL]=i.score),n}const po=e=>Math.min(Math.max(.01,e),1),yo=e=>Math.round(100*e),ho=/^t00[23459]\d{3}$/;function fo(e){const t="wallType"in e?e.wallType:"paywall",n=N[t],i=R[e.wallVisibility];let r=0===i?U.nowall:U[t];const o=po(e.score),s=yo(o);let a=100===s?"xx":s.toString().padStart(2,"0");const l=yo(e.threshold);return`${n}${i}${r}${a}${100===l?"xx":l.toString().padStart(2,"0")}`}function go(e){let t="";for(const n of e)t+=fo(n);return t}function wo(e){if(void 0===e)return"--";const t=Math.round(100*e);return 100===t?"xx":t.toString().padStart(2,"0")}function mo(e,t,n,i){return`v${e}${t}${wo(n)}${wo(i)}`}const bo=V.object({paywall:V.object({anonymous:V.number(),registered:V.number()}),regwall:V.optional(V.number())}),vo=V.pipe(V.record(V.string(),V.number()),V.custom(e=>{const t=new Set(["1","2","3","4","5"]),n=Object.entries(e);if(0===n.length)return!1;for(const[e,i]of n){if(!t.has(e))return!1;if(i<0||i>1)return!1}return!0},"Invalid level mapping format. Expected an object with keys '1'-'5' and values between 0 and 1")),ko=V.object({paywall:V.object({anonymous:vo,registered:vo}),regwall:V.optional(vo)}),Po=V.union([V.object({userLevels:ko}),V.object({user:bo}),V.object({userLevels:ko,user:bo}),V.object({userFallback:bo}),V.object({user:bo,userFallback:bo}),V.object({userLevels:ko,userFallback:bo}),V.object({userLevels:ko,user:bo,userFallback:bo})]),Ao=V.object({thresholds:Po}),So=V.object({definition:V.string(),policy:Ao});V.pipe(V.object({experiences:V.array(So)}),V.check(e=>e.experiences.length>0,"At least one experience is required"));var xo=(e=>(e.User="user",e.UserLevels="userLevels",e.UserFallback="userFallback",e))(xo||{});let Do;function Lo(e){const t=e.replace(/\/([\w.]+=[^/&]+)/,"?$1");return t.startsWith("http")?t:`https://${t}`}(new Date).toISOString();const Vo=Object.freeze({paywall:Object.freeze({anonymous:1,registered:1}),regwall:1}
1);function Eo(e){const t=Do?.experiences??[],n=ai()?.assignedGroup,i=e=>e.replace(/^www\./,""),r=ri.subMarket?`${ri.subMarket}-${i(ri.hostname)}`:i(ri.hostname),o=new Map;let s=null;for(const e of t){const t=Lo(e.definition),n=new URL(t);if(i(n.hostname)!==r)continue;const a=n.searchParams.get("experiment.assignedGroup");a?o.set(a,e.policy.thresholds):""===n.search&&(s=e.policy.thresholds)}const a=[n?o.get(n):void 0,o.get("control"),s];for(const t of a)if(null!=t)switch(e){case xo.UserLevels:if(xo.UserLevels in t)return t.userLevels;break;case xo.UserFallback:if(xo.UserFallback in t)return t.userFallback;break;case xo.User:if(xo.User in t)return t.user}return e===xo.UserFallback?(ae.warn("No userFallback thresholds found, using open-access defaults."),Vo):null}class _o extends Error{constructor(e){super(e),this.name="AbortError"}}async function $o(e,t,n,i){try{const i=await async function(e,t,n){if(!e.paywallApi)throw new Error("Paywall API configuration is missing");const i=Wi(e)["content.id"];if(!i){const e=new Error("No value for 'content.id', aborting decision call");throw e.name="ContentIdError",e}const r=new URLSearchParams(n);if(r.append("content.id",String(i)),r.append("visitor.type",t.modelInputs.visitorType),Xr(t.modelInputs)){const n=function(e,t,n){const i=new URLSearchParams;for(const[r,o]of Object.entries(e)){const e=ro(o,t,n);io(e)?i.append(r,String(e)):ae.debug(`Skipping dataMap parameter "${r}", value is: ${e}`)}return i}(e.paywallApi.dataMap,e,t.modelInputs);for(const[e,t]of n.entries())Vt.has(e)||r.append(e,t)}return pi(ci.ApiInitiated),await async function(e,t){const n=function(e,t,n){const i=`/hosts/${e.host}/decisions/me`,r=new URL(e.url+i);return r.search=t.toString(),new Request(r,{signal:n})}(e,t,function(e){const t=new AbortController,n=t.signal;return setTimeout(()=>{t.abort(new _o(`Request exceeded ${e.toLocaleString()}ms`))},e),n}(e.timeout));try{return async function(e){!function(e){if(!e.ok)throw ae.debug(`Response: ok: ${e.ok}, status: ${e.status}, status text: ${e.statusText}`),e}(e);const t=await e.json(),n=V.parse(no,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&&ae.debug("Decision request error",e.name,e.message),ae.debug({err:e}),e}(e)}}(e.paywallApi,r)}(e,t,n.searchParams);pi(ci.ApiCompleted),void 0!==i.outcome.wallProperties&&void 0===n.outcome.wallProperties&&(Object.keys(i.outcome.wallProperties).length>0&&ae.debug("Wall properties not configured but returned by API, discarding:",i.outcome.wallProperties),delete i.outcome.wallProperties);const r=void 0!==n.outcome.wallProperties||void 0!==i.outcome.wallProperties?{...n.outcome.wallProperties??{},...i.outcome.wallProperties??{}}:void 0,o={id:i.id,createdAt:i.createdAt,trace:i.trace,outcome:{...i.outcome,...zr(r)}};return ae.debug("Enhanced with server decision",o),o}catch(r){return function(e,t,n,i,r){e instanceof Error&&"AbortError"===e.name?pi(ci.ApiTimeout):e instanceof Error&&"TypeError"===e.name&&pi(ci.ApiNetworkError);let o="No server decision";if(e instanceof Error&&(o+=`: ${e.message}`),ae.warn(o),ae.debug({err:e}),!t.paywallApi)throw new Error("Paywall API configuration is missing");const s=function(e,t,n,i,r,o){const s=Eo(xo.UserFallback);let a="";o&&void 0!==r&&(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,r));const l=uo(n),c="subscribed"===(u=t.visitorType)?"registered":u;var u;const p=function(e,t,n){const i=e[_.PAYWALL],r=e[_.REGWALL],o=t.paywall[n],s=t.regwall;return i>=o?{wallType:_.PAYWALL,wallVisibility:$,wallVisibilityCode:R.always,wallTypeCode:U.paywall}:void 0!==r&&void 0!==s&&r>=s?{wallType:_.REGWALL,wallVisibility:$,wallVisibilityCode:R.always,wallTypeCode:U.regwall}:{wallVisibility:j,wallVisibilityCode:R.never}}(l,s,c),d=[];for(const e of Object.values(_)){const t=l[e];if(void 0!==t){const n=e===_.PAYWALL?s.paywall[c]:s.regwall;if(void 0===n)continue;const i={score:t,threshold:n,wallVisibility:p.wallVisibility===$&&p.wallType===e?$:j,wallType:e};d.push(i)}}const y=go(d),h=p.wallVisibilityCode,f="wallTypeCode"in p?p.wallTypeCode:U.nowall;let g,w;if("wallType"in p){const e=p.wallType;g=l[e],w=e===_.PAYWALL?s.paywall[c]:s.regwall}const m=mo(h,f,g,w),b={...e,trace:a+m+y,outcome:{...p,...zr(e.outcome.wallProperties)}};return ae.debug("API fallback decision:",b),b}(n,{visitorType:i.modelInputs.visitorType,assignedGroup:n.experiment?.assignedGroup},r,0,t.paywallApi.timeout,e);return{id:n.id,createdAt:n.createdAt,trace:s.trace,outcome:s.outcome}}(r,e,n,t,i.outcomes)}}class jo{constructor(){this.pageViews=0,this.pageViewsByArticle=0,this.pageViewsByArticleWithPaywall=0,this.pageViewsByArticleWithRegwall=0,this.topLevelSections=0,this.topLevelSectionsByArticle=0,this.visitCount=0}}function Co(){const e=new Date;return 2*Math.floor(e.getUTCHours()/2)}function To(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return""}}const Bo={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 Wo(e,t){return Object.entries(e).reduce((e,[n,i])=>({...e,[`${t}${n[0].toUpperCase()}${n.slice(1)}`]:i}),{})}const Oo=function(e,t,n){if(!1===ri.mode.isDeviceAndLocationDataAllowed&&!1===ri.mode.isDeviceAndLocationDataAllowed)return{visitorType:t.visitor};const{durations:[i,r,o],daysSinceLastVisit:s}=function(e,t){const n=[e.today,...e.history],i=n.length,r=Math.min(i,Math.max(...t));let o=[],s=new jo,a=0,l=new Set,c=new Set;for(let e=0;e<r;e++){const i=n[e];s.pageViews=s.pageViews+i.pageViews,s.pageViewsByArticle=s.pageViewsByArticle+i.pageViewsByArticle,s.pageViewsByArticleWithPaywall=s.pageViewsByArticleWithPaywall+i.pageViewsByArticleWithPaywall,s.pageViewsByArticleWithRegwall=s.pageViewsByArticleWithRegwall+i.pageViewsByArticleWithRegwall;for(const e of i.topLevelSections)l.has(e)||l.add(e);
1s.topLevelSections=l.size;for(const e of i.topLevelSectionsByArticle)c.has(e)||c.add(e);s.topLevelSectionsByArticle=c.size,i.pageViews>0&&(s.visitCount++,e>0&&0===a&&(a=e)),t.includes(e+1)&&(o.push({...s}),s=new jo,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,[1,8,29]),{visitCount:a,...l}=i,c=n?.assignedGroup||null,u=Wr(),p=Ar(),d=function(e,t={}){return Zi(e).reduce((e,[n,i])=>{if("number"==typeof i){const r=n in t?t[n]:null;e[n]="number"==typeof r?Math.min(i,r):i}else e[n]=i;return e},{})}({...Wo(l,"today"),...Wo(r,"sevenDay"),...Wo(o,"twentyEightDay"),...Rt(navigator.userAgent),timeZone:To(),referrer:u.medium,referrerData:{...u,queryParams:p},daysSinceLastVisit:s,visitorType:t.visitor,hourOfDay:Co(),assignedGroup:c,userProperties:e.userProperties,contentProperties:Wi(ri)},Bo);return d.visitor=e.visitor,d},Io={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"},Uo={experimentId:"HA",assignedGroup:"HB",visitorType:"FA",referrer:"DC",pageReferrerMedium:"DE",pageReferrerSource:"DF",pageReferrerChannel:"DG",os:"EA",type:"EB",viewer:"EC",hourOfDay:"DD",timeZone:"DB",campaignName:"GA",referrerDomain:"GB",referrerMedium:"GC",referrerSource:"GD",referrerChannel:"GE"},Ro={medium:{alias:Uo.pageReferrerMedium,codes:Cr},source:{alias:Uo.pageReferrerSource,codes:Tr},channel:{alias:Uo.pageReferrerChannel,codes:jr}};function No(e){if("timeZone"in e){const t=e.timeZone;if(t)return[Uo.timeZone+":"+t]}return[]}function Go(e){if("referrer"in e){const t=e.referrer;if(t){const e=Cr[t].toString().padStart(2,"0");return[Uo.referrer+":"+e]}}return[]}function Mo(e,t){return function(e,t,n,i){if("referrerData"in e&&e.referrerData&&t in e.referrerData){const r=e.referrerData[t];if(r&&r in i)return[n+":"+i[r].toString().padStart(2,"0")]}return[]}(e,t,Ro[t].alias,Ro[t].codes)}function qo(e){if("os"in e){const t=e.os;if(t)return[Uo.os+":"+t]}return[]}function zo(e){if("type"in e){const t=e.type;if(t&&t in Ut){const e=Ut[t].toString().padStart(2,"0");return[Uo.type+":"+e]}}return[]}function Fo(e){if("viewer"in e){const t=e.viewer;if(t)return[Uo.viewer+":"+t]}return[]}const Ho={anonymous:0,registered:1,subscribed:2};function Jo(e){const t=e.visitorType;if(t&&t in Ho){const e=Ho[t].toString().padStart(2,"0");return[Uo.visitorType+":"+e]}return[]}function Yo(e){if("hourOfDay"in e){const t=e.hourOfDay;if(void 0!==t)return[Uo.hourOfDay+":"+t]}return[]}function Zo(e){if("visitor"in e){const t=e.visitor.session,n=["campaignName","referrerDomain","referrerMedium","referrerSource","referrerChannel"],i={referrerSource:Tr,referrerChannel:jr};return Zi(t).reduce((e,[t,r])=>{let o;return o=t in i?function(e,t){return e in t?t[e].toString().padStart(2,"0"):null}(r,i[t]):r,o&&n.includes(t)&&e.push(Uo[t]+":"+o),e},[])}return[]}const Ko={aa:"0",ab:"1"},Qo={control:"1",variant:"2",holdout:"3"};function Xo(e){if(e){const t=/[a-z:_-\d]*test(\d)_(a(?:a|b))$/,n=e.experimentId.match(t);let i="9",r="9",o=function(e){return Qo[e.assignedGroup]||"9"}(e);if(n){r=n[1];const e=n[2];i=Ko[e]}return[Uo.experimentId+":"+i+r,Uo.assignedGroup+":"+o]}return[]}function es(e){switch(e){case U.paywall:return{wallType:_.PAYWALL,wallTypeCode:e,wallVisibility:$,wallVisibilityCode:R.always};case U.regwall:return{wallType:_.REGWALL,wallTypeCode:e,wallVisibility:$,wallVisibilityCode:R.always};default:return{wallVisibility:j,wallVisibilityCode:R.never}}}function ts(e,t,n,i){return{wallType:e,wallVisibility:t?$:j,score:n??0,threshold:i??0}}const ns=(e,t,n,i,r)=>e.trace&&!ho.test(e.trace)?{...e}:((e,t,n)=>{const i=uo(n),r=i[_.PAYWALL],o=i[_.REGWALL]??null,s=Eo(xo.User);
1if(!s)return{...e,outcome:{...es(U.nowall),...zr(e.outcome.wallProperties)},trace:"t005001"+mo(R.never,U.nowall,r,void 0)};const a=t.visitorType===B?T:t.visitorType,l=s.paywall[a],c=a===C?s.regwall:void 0,u=void 0!==c&&null!==o;let p;p=es(r>=l?U.paywall:u&&o>=c?U.regwall:U.nowall),p={...p,...zr(e.outcome.wallProperties)};let d=e.trace;const y=[],h="wallType"in p&&p.wallType===_.PAYWALL,f="wallType"in p&&p.wallType===_.REGWALL;return u&&y.push(ts(_.REGWALL,f,o,c)),y.push(ts(_.PAYWALL,h,r,l)),d+=go(y),{...e,outcome:p,trace:d}})(e,t,n),is={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let rs;const os=new Uint8Array(16),ss=[];for(let e=0;e<256;++e)ss.push((e+256).toString(16).slice(1));const as=V.optional(V.object({visitor:V.optional(W)}));function ls(e){if(!ri.showPaywallScore)return;const t=e.outcomes[0];return t?yo(po(t.score)):void 0}function cs(e){if(ae.debug("Decision override:",oe.override),oe.override){ae.debug("⚙️ Decision override",oe.override);let t=e.outcome;return oe.override.outcome&&(t={...t,...oe.override.outcome}),{...e,...oe.override,outcome:t}}return e}function us(e){window.sophi=null===e?{...window.sophi,quickStart:{}}:{...window.sophi,quickStart:{decision:e}}}function ps(e,t){if(t.addTracingToLocalStorage.enabled&&e){const{inputs:n,context:i,trace:r}=e;localStorage.setItem(t.addTracingToLocalStorage.key,JSON.stringify({inputs:n,context:i,trace:r}))}}function ds(e){return"always"===e.outcome.wallVisibility?"paywall"===e.outcome.wallType?"paywall":"regwall":"no-wall"}const ys=e=>{V.parse(as,e);const t=(e=>{try{if(!1===e.metaValues.visitorType)return null;const{selector:t,attribute:n,expression:i}=e.metaValues.visitorType,r=document.querySelector(t),o=r?.getAttribute(n)?.trim();if(!o)return null;const s=Ai(t,n,i),a=V.safeParse(W,s);return a.success?a.output:null}catch(e){return null}})(ri),n=hr.getState().visitor,i=(({argsVisitor:e,metaVisitor:t,storedVisitor:n})=>e||t||n||"anonymous")({argsVisitor:e?.visitor,metaVisitor:t,storedVisitor:n});return hr.updateState({...hr.getState(),visitor:i}),{visitor:i}};function hs(e,t){return"registered"===e&&"always"===t.outcome.wallVisibility&&"regwall"===t.outcome.wallType&&(t.outcome={wallVisibility:"never",wallVisibilityCode:0,...zr(t.outcome.wallProperties)}),t}async function fs(e,t,n){const{experiment:i,modelInputs:r,internalExperiment:o}=e;i&&ae.info("🧪 Experiment",JSON.stringify(i,null,2)),ae.debug("Model inputs",r);const s=function(e){let t="";if(Xr(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}${Io[t]+n[t].toString().padStart(2,"0")}`,"")}return t}(r),a=function(e,t){return[...Xo(t),...Jo(e),...Go(e),...Mo(e,"medium"),...Mo(e,"source"),...Mo(e,"channel"),...qo(e),...zo(e),...Fo(e),...Yo(e),...No(e),...Zo(e)].join("|")}(r,o),l=(e=>{if(!e||0===Object.keys(e).length)return"";const t=(ri.userProperties||[]).filter(e=>!1!==e.tracked).map(e=>e.key);return 0===t.length?"":Zi(e).filter(([e])=>t.includes(e)).map(([e,t])=>`${(e=>wr[e]||e)(e)}:${t}`).join(",")})(Rs.state.userProperties),c=function(){const e=ri.wallProperties;if(void 0===e)return;const t={};for(const n of e){const e=Hr(n);void 0!==e&&(t[Fr(n.key)]=e)}return t}(),u=Jr(c),p=function(e){return e.contentProperties&&e.contentProperties.length>0?function(e){return null===Bi.analyticsString&&Oi(e),Bi.analyticsString}(e):""}(t);n&&n({context:s,inputs:a,userProperties:l,contentProperties:p,...zr(u),experiment:i});const d=to.evaluate(r);ae.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 i in e){const r=e[i],o=N[i],s=t,a=t;if(void 0===r)continue;const l=Math.round(100*r);n+=`${o}${s}${a}${100===l?"xx":l.toString().padStart(2,"0")}${t+t}`}return n}(d),o);let h=function(e,t,n){if(is.randomUUID&&!t&&!e)return is.randomUUID();const i=(e=e||{}).random??e.rng?.()??function(){if(!rs){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");rs=crypto.getRandomValues.bind(crypto)}return rs(os)}();if(i.length<16)throw new Error("Random bytes length must be >= 16");if(i[6]=15&i[6]|64,i[8]=63&i[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]=i[e];return t}return function(e,t=0){return(ss[e[t+0]]+ss[e[t+1]]+ss[e[t+2]]+ss[e[t+3]]+"-"+ss[e[t+4]]+ss[e[t+5]]+"-"+ss[e[t+6]]+ss[e[t+7]]+"-"+ss[e[t+8]]+ss[e[t+9]]+"-"+ss[e[t+10]]+ss[e[t+11]]+ss[e[t+12]]+ss[e[t+13]]+ss[e[t+14]]+ss[e[t+15]]).toLowerCase()}(i)}(),f=(new Date).toISOString();const g=(w=d,{wallVisibility:"never",outcomes:Object.values(_).filter(e=>e in w&&"number"==typeof w[e]).map(e=>({wallType:e,score:w[e],threshold:0,wallVisibility:"never"}))});var w;let m=function(e,t){return"always"===e.wallVisibility?{wallType:e.wallType,wallTypeCode:U[e.wallType],wallVisibility:e.wallVisibility,wallVisibilityCode:R[e.wallVisibility],...zr(t)}:{wallVisibility:e.wallVisibility,wallVisibilityCode:R[e.wallVisibility],...zr(t)}}(g,c),b="";if(t.paywallApi){const n=await $o(t,e,{id:h,createdAt:f,trace:b,context:s,inputs:a,outcome:m,searchParams:y,userProperties:l,...zr(u),contentProperties:p,...void 0!==ls(g)?{paywallScore:ls(g)}:{},experiment:i},g);({id:h,createdAt:f,trace:b,outcome:m}=n)}const v=ls(g),k={id:h,createdAt:f,trace:b,context:s,inputs:a,outcome:m,searchParams:y,userProperties:l,...zr(u),contentProperties:p,...void 0!==v?{paywallScore:v}:{},experiment:i};return ae.debug("Base decision made:",k),{decision:k,outcomes:g.outcomes}}const gs=new class{constructor({config:e}){this.config=e,this.onDevice=null,this.server=null,this.cold=null}async makeParams(){const e=await si(),t=await ai();return{modelInputs:Oo(Rs.state,hr.getState(),t),experiment:e,internalExperiment:t}}async getCached(){const e=await this.makeParams();return null===this.onDevice&&(this.onDevice=fs(e,this.config)),null===this.server&&(this.server=this.onDevice),(await this.server).decision}async updateCache(e){const t=await this.makeParams();return this.config.enableExperiment&&pi(ci.TestAssigned),this.onDevice=fs(t,this.config,e),this.server=this.onDevice,await this.server}}({config:ri});function ws(e){if(!qr.isSubdomain(ri)){const t=e.getState(),n=t.coldDataLayer,{previous:i,outcomes:r}=n;if(i&&Object.keys(i).length>1){const o=Yr(ns(i,{visitorType:t.visitor,assignedGroup:i.experiment?.assignedGroup},r));return us(o),ps(o,ri),gi(o),e.updateState({...t,coldDataLayer:{...t.coldDataLayer,previous:void 0,outcomes:[]}}),n}}return null}function ms(e){return e&&(gs.cold=(async()=>({decision:e.previous,outcomes:e.outcomes||[]}))()),ys(),gs.updateCache(bs).then(Ps)}function bs(e){if("client"===ri.wallGeneration.type&&!ri.enableWallIndicators){const{trace:t,...n}=e;gi(n)}return e}
1function vs(e,t,n){const i=e.getState();e.updateState({...i,coldDataLayer:{...i.coldDataLayer,previous:t,outcomes:n}}),function(e){if(!0===ri.cookie.isEnabled&&!0===ri.mode.isDeviceAndLocationDataAllowed&&!0===ri.mode.isUserBehaviorDataAllowed&&!qr.isSubdomain(ri)){const t=ri.cookie.name,n=ri.hostname,i=ri.cookie.maxAge,r="/";let o=e.searchParams;if(ri.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=${r}; max-age=${i};`}}(t)}async function ks(e){ui=performance.now(),window.sophi?.demeter&&(window.sophi.demeter.initStatus=""),window.sophi.quickStart.decision=void 0,yi(),Bi.values=null,Bi.analyticsString=null,e.dispatch({type:mi.ContentProperties});const t=ws(hr);t&&wi(),e.processStoredEvents(),await ms(t)}const Ps=e=>{const t=e.decision,{visitor:n}=ys(),i=Yr(cs(hs(n,ns(t,{visitorType:n,assignedGroup:t.experiment?.assignedGroup},e.outcomes))));return ae.debug("Policy decision",i),"client"===ri.wallGeneration.type&&!1===ri.enableWallIndicators?(us(i),ps(i,ri),gi(i),wi()):"client"===ri.wallGeneration.type&&!0===ri.enableWallIndicators?(null===gs.cold&&(us(i),ps(i,ri),gi(i),wi()),vs(hr,i,e.outcomes)):"server"===ri.wallGeneration.type&&(null===gs.cold&&(gs.cold=(async()=>({decision:await gs.getCached(),outcomes:e.outcomes}))(),wi()),vs(hr,i,e.outcomes)),pi(ci.DecisionAvailable),i},As=async e=>{{ae.info("🧮 Received getDecision event",e);const{visitor:t}=ys(e);qr.dispatch({type:mi.GetDecision});const n=await(gs.cold?.then(e=>e.decision))||await gs.getCached(),i=(await gs.cold)?.outcomes??(await gs.server)?.outcomes,r=Yr(cs(hs(t,ns(n,{visitorType:t,assignedGroup:n.experiment?.assignedGroup},i))));return ae.debug("Policy decision",r),ae.info("🪧 Decision:",ds(r)),r}};async function Ss(e){!1===ri.enableWallIndicators&&ae.warn("getDecisionForArticleWallIndicators was called but wall indicators are not enabled. Using current decision."),ae.info("🧮 Received getDecisionForArticleWallIndicators event",e),qr.dispatch({type:mi.GetDecisionForArticleWallIndicators});const{visitor:t}=ys(),n=await gs.getCached();hs(t,n),(e=>{if(void 0===e)return null;const t=V.safeParse(co,e);t.success?t.output:ae.warn(lo,"Received:",e)})(e?.contentPropensityLevel);const i=Yr(cs(ns(n,{visitorType:t,assignedGroup:n.experiment?.assignedGroup},(await gs.server).outcomes)));return ae.info("🪧 Decision for next page:",ds(i)),i}const xs=function(){const{context:e,inputs:t,trace:n,experimentsCode:i,assignedGroup:r}=hi(),o={context:e,inputs:t,trace:n,experimentsCode:i,assignedGroup:r};return ae.debug("Sophi context",o),o},Ds=function(){const{context:e,inputs:t,trace:n,userProperties:i}=hi(),r={context:e,inputs:t,trace:n,userProperties:i};return ae.info("🪧 Received getWallContext event",JSON.stringify(r,null,2)),r},Ls="(root)";function Vs(e){return"string"==typeof e?.message?e.message:String(e?.message??"Invalid input")}const Es=V.pipe(V.string(),V.trim(),V.string(),V.trim(),V.picklist(["pageview","wall","config","getDecision","getWallContext","getSophiContext","enableAllFeatures","userProperties","getDecisionForArticleWallIndicators"])),_s=["pageview","wall","userProperties"],$s=["getDecision","getDecisionForArticleWallIndicators","getWallContext","getSophiContext"],js=["config"],Cs=["enableAllFeatures"],Ts=(e,t)=>{"function"==typeof e&&e(t)};async function Bs(e,t,n={}){const{resolve:i,reject:r}=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:r,onError:s}=function(e){let t,n,i;if("object"==typeof e&&null!==e){if("args"in e==0){const t=Object.keys(e).find(e=>"onSuccess"!==e&&"onError"!==e);t&&V.parse(V.object({[t]:V.pipe(V.any(),V.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&&(i=e.onError)}return{args:t,onSuccess:n,onError:i}}(t);o=s;const a=function(e){return V.parse(Es,e)}(e),l=await Ws.call(this,a,n);return Ts(r,l),Ts(i,l),l}catch(e){const t=function(e){if(e instanceof V.ValiError){const t=function(e,t={}){return function(e,{maxIssues:t=20,mapMessage:n=Vs}={}){if(!Array.isArray(e)||!e.length)return[`${Ls}: Invalid input`];const i=e.slice(0,t),r=i.map(e=>{const t=function(e){if(!Array.isArray(e)||!e.length)return Ls;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,"")||Ls}(t)}(e?.path),i="function"==typeof n?n(e):null;return`${t}: ${"string"==typeof i&&i.length>0?i:Vs(e)}`});return e.length>i.length&&r.push(`...and ${e.length-i.length} more issue(s)`),r}(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 ae.error("InputError",`\n${t}`),new Error(`InputError\n${t}`,{cause:e})}return new Error("DecisionError",{cause:e})}(e);throw ae.debug("Error",t),Ts(o,t),Ts(r,t),t}}function Ws(e,t){return this[e](t)}function Os(e,t){const[[n,i]]=e[t],{resolve:r,reject:o}=function(e){let t,n;if(Array.isArray(e)){const[i,r,o]=e;"function"==typeof r&&(t=r),"function"==typeof o&&(n=o)}return{resolve:t,reject:n}}(e[t]);Bs.call(this,n,i,{resolve:r,reject:o}),e.splice(t,1)}function Is(e,t){for(let n=0;n<e.length;n++){const[[i]]=e[n];t.includes(i)&&(Os.call(this,e,n),n--)}}const Us=async function(e){var t,n;t=ri.hostname,n=window.location?.hostname,t===n||new RegExp(`^(.*\\.)?${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}$`).test(n)||ae.warn(`Bundle hostname mismatch: bundle is for "${ri.hostname}", but loaded on "${window.location.hostname}"`),ae.debug("Initializing"),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,ri),Is.call(this,e,js),Is.call(this,e,Cs);const i=ws(this.store);i&&wi(),function(e){if(e&&("event"in e&&window.addEventListener(e.event,()=>{ks(qr)}),"selector"in e)){const t=function(e){let t=null;try{t=document.querySelector(e)}catch(t){ae.warn(`Invalid selector ${e}.`)}return null===t?(ae.warn(`No node found using selector ${e}. Using document.body instead.`),document.body):t}(e.selector);let n=location.href;const i={subtree:!0,childList:!0};new MutationObserver(function(){location.href!==n&&(n=location.href,ks(qr)),ae.debug("MutationObserver callback checked for page change")}).observe(t,i)}}(ri.spa),ri.mode.isUserBehaviorDataAllowed&&Ir(),qr.processStoredEvents(),qr.dispatch({type:mi.Init}),"server"===ri.wallGeneration.type&&Is.call(this,e,_s),await ms(i),Is.call(this,e,$s),"client"===ri.wallGeneration.type&&Is.call(this,e,_s),this.ready=!0,window.demeter=Bs.bind(this);for(let t=0;t<e.length;t++)Os.call(this,e,t),t--},Rs=function(e){return new gt(e.storage)}({storage:localStorage}),Ns=class{constructor(){this.ready=!1,this.store=hr;const e=qr.getDispatch();return this.init=Us.bind(this),this.pageview=t=>e({type:mi.Pageview,payload:t}),this.wall=t=>e({type:mi.Wall,payload:t}),this.enableAllFeatures=()=>e({type:mi.EnableAllFeatures}),this.userProperties=t=>{e({type:mi.UserProperties,payload:t})},this.config=oe.config.bind(oe),this.getDecision=As,this.getWallContext=Ds,this.getDecisionForArticleWallIndicators=Ss,this.getSophiContext=xs,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 Gs=null,Ms=!1;const qs=async function(e){return Gs||(Gs=new Ns),Ms||(e||ae.debug("Error loading 'thresholds' value."),function(e){e&&(Do=e)}(e),await async function(e){window.sophi=window.sophi||{},window.sophi.demeter=window.sophi.demeter||{actions:[],initStatus:""},window.sophi.quickStart=window.sophi.quickStart||{},window.sophi.dataLayer||yi(),e.init(window.sophi.demeter.actions)}(Gs),Ms=!0),Gs};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.modernhealthcare.com",policy:{thresholds:{user:{paywall:{anonymous:.2351,registered:.25},regwall:.09}}}},{definition:"www.modernhealthcare.com/experiment.assignedGroup=control",policy:{thresholds:{user:{paywall:{anonymous:.33,registered:.2},regwall:.19}}}},{definition:"www.modernhealthcare.com/experiment.assignedGroup=variant",policy:{thresholds:{user:{paywall:{anonymous:.33,registered:.2},regwall:.19}}}},{definition:"www.modernhealthcare.com/experiment.assignedGroup=holdout",policy:{thresholds:{user:{paywall:{anonymous:.235,registered:.25},regwall:.09}}}}]});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.