Socket
Socket
Sign inDemoInstall

@uniformdev/context

Package Overview
Dependencies
Maintainers
10
Versions
591
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uniformdev/context - npm Package Compare versions

Comparing version 16.0.1-alpha.128 to 16.0.1-alpha.143

2

dist/api/api.js

@@ -1,2 +0,2 @@

var N=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var Q=Object.getOwnPropertyNames;var H=Object.prototype.hasOwnProperty;var K=(r,e,t)=>e in r?N(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var q=(r,e)=>{for(var t in e)N(r,t,{get:e[t],enumerable:!0})},z=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Q(e))!H.call(r,n)&&n!==t&&N(r,n,{get:()=>e[n],enumerable:!(i=V(e,n))||i.enumerable});return r};var B=r=>z(N({},"__esModule",{value:!0}),r);var l=(r,e,t)=>(K(r,typeof e!="symbol"?e+"":e,t),t),Y=(r,e,t)=>{if(!e.has(r))throw TypeError("Cannot "+t)};var s=(r,e,t)=>(Y(r,e,"read from private field"),t?t.call(r):e.get(r)),p=(r,e,t)=>{if(e.has(r))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(r):e.set(r,t)};var X={};q(X,{AggregateClient:()=>g,ApiClientError:()=>u,ContextClient:()=>J,DimensionClient:()=>P,EnrichmentClient:()=>y,ManifestClient:()=>x,QuirkClient:()=>E,SignalClient:()=>C,computeDimensionDefinitionDisplayData:()=>M,computeDimensionDisplayData:()=>F,computeDimensionDisplayName:()=>W,nullLimitPolicy:()=>k});module.exports=B(X);var k=async r=>await r(),u=class extends Error{constructor(t,i,n,a,c,m){super(`${t}
"use strict";var N=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var Q=Object.getOwnPropertyNames;var H=Object.prototype.hasOwnProperty;var K=(r,e,t)=>e in r?N(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var q=(r,e)=>{for(var t in e)N(r,t,{get:e[t],enumerable:!0})},z=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Q(e))!H.call(r,n)&&n!==t&&N(r,n,{get:()=>e[n],enumerable:!(i=V(e,n))||i.enumerable});return r};var B=r=>z(N({},"__esModule",{value:!0}),r);var l=(r,e,t)=>(K(r,typeof e!="symbol"?e+"":e,t),t),Y=(r,e,t)=>{if(!e.has(r))throw TypeError("Cannot "+t)};var s=(r,e,t)=>(Y(r,e,"read from private field"),t?t.call(r):e.get(r)),p=(r,e,t)=>{if(e.has(r))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(r):e.set(r,t)};var X={};q(X,{AggregateClient:()=>g,ApiClientError:()=>u,ContextClient:()=>J,DimensionClient:()=>P,EnrichmentClient:()=>y,ManifestClient:()=>x,QuirkClient:()=>E,SignalClient:()=>C,computeDimensionDefinitionDisplayData:()=>M,computeDimensionDisplayData:()=>F,computeDimensionDisplayName:()=>W,nullLimitPolicy:()=>k});module.exports=B(X);var k=async r=>await r(),u=class extends Error{constructor(t,i,n,a,c,m){super(`${t}
${a}${c?" "+c:""} (${i} ${n}${m?` Request ID: ${m}`:""})`);this.errorMessage=t;this.fetchMethod=i;this.fetchUri=n;this.statusCode=a;this.statusText=c;this.requestId=m;Object.setPrototypeOf(this,u.prototype)}};var o=class{constructor(e){l(this,"options");var t,i,n,a,c,m;if(!e.apiKey&&!e.bearerToken)throw new Error("You must provide an API key or a bearer token");this.options={...e,fetch:(t=e.fetch)!=null?t:fetch,apiHost:(i=e.apiHost)!=null?i:"https://uniform.app",apiKey:(n=e.apiKey)!=null?n:null,projectId:(a=e.projectId)!=null?a:null,bearerToken:(c=e.bearerToken)!=null?c:null,limitPolicy:(m=e.limitPolicy)!=null?m:k}}async apiClient(e,t){return this.options.limitPolicy(async()=>{var a;let i=this.options.apiKey?{"x-api-key":this.options.apiKey}:{Authorization:`Bearer ${this.options.bearerToken}`},n=await fetch(e.toString(),{...t,headers:{...t==null?void 0:t.headers,...i}});if(!n.ok){let c="";try{let m=await n.text();try{let R=JSON.parse(m);R.errorMessage?c=Array.isArray(R.errorMessage)?R.errorMessage.join(", "):R.errorMessage:c=m}catch(R){c=m}}catch(m){c="General error"}throw new u(c,(a=t==null?void 0:t.method)!=null?a:"GET",e.toString(),n.status,n.statusText,o.getRequestId(n))}return t!=null&&t.expectNoContent?null:await n.json()})}createUrl(e,t){let i=new URL(`${this.options.apiHost}${e}`);return Object.entries(t!=null?t:{}).forEach(([n,a])=>{var c;typeof a!="undefined"&&a!==null&&i.searchParams.append(n,(c=a==null?void 0:a.toString())!=null?c:"")}),i}static getRequestId(e){let t=e.headers.get("x-nf-request-id");if(t)return t}};var f,I=class extends o{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,i=this.createUrl(s(I,f),{...e,projectId:t});return await this.apiClient(i)}async upsert(e){let t=this.createUrl(s(I,f));await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){let t=this.createUrl(s(I,f));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},g=I;f=new WeakMap,p(g,f,"/api/v2/aggregate");var S,L=class extends o{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,i=this.createUrl(s(L,S),{...e,projectId:t});return await this.apiClient(i)}},P=L;S=new WeakMap,p(P,S,"/api/v2/dimension");var d,T,h=class extends o{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,i=this.createUrl(s(h,d),{...e,projectId:t});return await this.apiClient(i)}async upsertCategory(e){let t=this.createUrl(s(h,d));await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async removeCategory(e){let t=this.createUrl(s(h,d));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async upsertValue(e){let t=this.createUrl(s(h,T));await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async removeValue(e){let t=this.createUrl(s(h,T));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},y=h;d=new WeakMap,T=new WeakMap,p(y,d,"/api/v1/enrichments"),p(y,T,"/api/v1/enrichment-values");var A,v=class extends o{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,i=this.createUrl(s(v,A),{...e,projectId:t});return await this.apiClient(i)}},x=v;A=new WeakMap,p(x,A,"/api/v2/manifest");var j,O=class extends o{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,i=this.createUrl(s(O,j),{...e,projectId:t});return await this.apiClient(i)}async upsert(e){let t=this.createUrl(s(O,j));await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){let t=this.createUrl(s(O,j));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},E=O;j=new WeakMap,p(E,j,"/api/v2/quirk");var U,G=class extends o{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,i=this.createUrl(s(G,U),{...e,projectId:t});return await this.apiClient(i)}async upsert(e){let t=this.createUrl(s(G,U));await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){let t=this.createUrl(s(G,U));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},C=G;U=new WeakMap,p(C,U,"/api/v2/signal");var D,b=class extends o{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,i=this.createUrl(s(b,D),{...e,projectId:t});return await this.apiClient(i)}async upsert(e){let t=this.createUrl(s(b,D));await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){let t=this.createUrl(s(b,D));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},w=b;D=new WeakMap,p(w,D,"/api/v2/test");var J=class{constructor(e){l(this,"enrichments");l(this,"aggregates");l(this,"dimensions");l(this,"manifest");l(this,"quirks");l(this,"signals");l(this,"tests");this.enrichments=new y(e),this.aggregates=new g(e),this.dimensions=new P(e),this.manifest=new x(e),this.quirks=new E(e),this.signals=new C(e),this.tests=new w(e)}};var $="_";function M(r){let e=r.category==="ENR"?"Enrichment":r.category==="SIG"?"Signal":r.subcategory==="1"?"Intent":r.subcategory==="0"?"Audience":"Aggregate";return{dim:r.dim,name:r.name,type:e,category:r.category==="ENR"?r.subcategory:void 0}}function F(r,e){var t,i,n,a;if((i=(t=e.project.pz)==null?void 0:t.agg)!=null&&i[r])return{dim:r,name:r,type:"Aggregate"};if((a=(n=e.project.pz)==null?void 0:n.sig)!=null&&a[r])return{dim:r,name:r,type:"Signal"};if(r.indexOf($)>=0){let[c,m]=r.split($);return{dim:r,name:m,type:"Enrichment",category:c}}}function W(r){let{type:e,name:t}=M(r);return`${e}: ${t}`}0&&(module.exports={AggregateClient,ApiClientError,ContextClient,DimensionClient,EnrichmentClient,ManifestClient,QuirkClient,SignalClient,computeDimensionDefinitionDisplayData,computeDimensionDisplayData,computeDimensionDisplayName,nullLimitPolicy});

@@ -1,3 +0,3 @@

var ae=Object.defineProperty;var ue=(e,t,i)=>t in e?ae(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var y=(e,t,i)=>(ue(e,typeof t!="symbol"?t+"":t,i),i),dt=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)};var a=(e,t,i)=>(dt(e,t,"read from private field"),i?i.call(e):t.get(e)),d=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},m=(e,t,i,r)=>(dt(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i);var S=(e,t,i)=>(dt(e,t,"access private method"),i);function wt(e,t){let i={...e};for(let r in t){let n=Rt(e,r,t,new Set([r]));n!==0&&(i[r]=n)}return i}function Rt(e,t,i,r){var s;let n=0;for(let o of i[t].inputs){let u=(s=e[o.dim])!=null?s:0;if(!u&&i[o.dim]){if(r.has(o.dim))continue;let l=new Set(r);l.add(o.dim),u=Rt(e,o.dim,i,l)}if(u!==0)if(o.sign==="c"){n=0;break}else o.sign==="-"?n-=u:n+=u}return n}var Z="_";var Q,F,M=class{constructor(t,i,r){d(this,Q,void 0);d(this,F,void 0);y(this,"signal");this.signal=t,m(this,Q,i),m(this,F,r)}computeSignal(t,i){if(t.scores[this.signal.id]>=this.signal.cap&&this.signal.dur!=="t")return;let n=a(this,Q).evaluate(t,this.signal.crit,i,this.signal,a(this,F)),s=this.signal.dur==="s"||this.signal.dur==="t"?"modscoreS":"modscore";if(!!n.changed){if(n.result)i.push({type:s,data:{dimension:this.signal.id,delta:this.signal.str}});else if(this.signal.dur==="t"){let o=t.visitor.sessionScores[this.signal.id];o&&i.push({type:s,data:{dimension:this.signal.id,delta:-o}})}}}};Q=new WeakMap,F=new WeakMap;var b,K,R,L=class{constructor({manifest:t,evaluator:i=new A({}),onLogMessage:r=()=>{}}){y(this,"data");d(this,b,void 0);d(this,K,void 0);d(this,R,void 0);var n,s,o;m(this,b,(n=t.project)!=null?n:{}),this.data=t,m(this,K,Object.entries((o=(s=a(this,b).pz)==null?void 0:s.sig)!=null?o:[]).map(([u,c])=>new M({...c,id:u},i,r))),m(this,R,r)}rollForControlGroup(){var t,i;return Math.random()<((i=(t=a(this,b).pz)==null?void 0:t.control)!=null?i:0)}getTest(t){var i;return(i=a(this,b).test)==null?void 0:i[t]}computeSignals(t){let i=[];a(this,R).call(this,["debug",200,"GROUP"]);try{a(this,K).forEach(r=>{a(this,R).call(this,["debug",201,"GROUP",r.signal]);try{r.computeSignal(t,i)}finally{a(this,R).call(this,["debug",201,"ENDGROUP"])}})}finally{a(this,R).call(this,["debug",200,"ENDGROUP"])}return i}computeAggregateDimensions(t){var i,r;return wt(t,(r=(i=a(this,b).pz)==null?void 0:i.agg)!=null?r:{})}getDimensionByKey(t){var r,n,s,o;let i=t.indexOf(Z);return i<=0?(n=(r=a(this,b).pz)==null?void 0:r.sig)==null?void 0:n[t]:(o=(s=a(this,b).pz)==null?void 0:s.enr)==null?void 0:o[t.substring(0,i)]}};b=new WeakMap,K=new WeakMap,R=new WeakMap;import{dequal as le}from"dequal/lite";function V(e,t){var o,u,c,l,p,f;let i=(o=t==null?void 0:t.op)!=null?o:"=";if(t.op==="*")return e!==null&&typeof e!="undefined";if(t.op==="!*")return e===null||typeof e=="undefined";if(!("rhs"in t))throw new Error(`Match expression is required for match type ${i}`);let r=(u=t.cs)!=null?u:!1,n=(r?e!=null?e:"":Ot(e)).toString(),s=(r?t.rhs:Ot(t.rhs)).toString();switch(i){case"=":return n===s;case"!=":return n!==s;case"~":return(c=n.includes(s))!=null?c:!1;case"!~":return!((l=n.includes(s))==null||l);case"//":return new RegExp(t.rhs.toString(),r?"":"i").test((p=e==null?void 0:e.toString())!=null?p:"");case"!//":return!new RegExp(t.rhs.toString(),r?"":"i").test((f=e==null?void 0:e.toString())!=null?f:"");default:throw new Error(`Unknown match type ${i}.`)}}function O(e,t){return`'${("cs"in t?t.cs:!1)?e:e==null?void 0:e.toString().toUpperCase()}' ${pt(t)}`}function pt(e){return"rhs"in e?`${e.op} '${e.cs?e.rhs:e.rhs.toString().toUpperCase()}'`:`${e.op==="*"?"exists":"does not exist"}`}function Ot(e){var t,i;return(i=(t=e==null?void 0:e.toString())==null?void 0:t.toUpperCase())!=null?i:""}var $t=({update:e,criteria:t,onLogMessage:i})=>{var u,c;if(t.type!=="CK")return{result:!1,changed:!1};let r=!le(Ut(e.state.cookies),Ut((u=e.previousState)==null?void 0:u.cookies)),n=(c=e.state.cookies)==null?void 0:c[t.cookieName],o={result:V(n,t.match),changed:r};return i==null||i(["debug",203,{criteria:t,result:o,explanation:O(n,t.match)}]),o};function Ut(e){if(!e)return;if(!e.ufvd)return e;let{ufvd:t,...i}=e;return i}function zt(e,t){var r;if(typeof e=="undefined"||e===null)return!1;let i=Number(e);if(isNaN(i))return!1;switch((r=t==null?void 0:t.op)!=null?r:"="){case"=":return i===t.rhs;case"!=":return i!==t.rhs;case">":return i>t.rhs;case"<":return i<t.rhs;default:return console.warn(`Unknown match type ${t.op} is false.`),!1}}function Nt(e,t){return`${e} ${ce(t)}`}function ce(e){return`${e.op} ${e.rhs}`}function tt(e,t){return`${e}${Z}${t}`}var ft=tt("$pvc","v"),mt=({update:e,criteria:t,commands:i,onLogMessage:r})=>{var l,p;if(t.type!=="PVC")return{result:!1,changed:!1};let n=Boolean(e.state.url&&(!e.previousState||((l=e.state.url)==null?void 0:l.toString())!==((p=e.previousState.url)==null?void 0:p.toString()))),o=(e.visitor.sessionScores[ft]||0)+1,u={result:!1,changed:n},c=i.some(f=>f.type==="modscoreS"&&f.data.dimension===ft);return n&&!c&&i.push({type:"modscoreS",data:{dimension:ft,delta:1}}),zt(o,t.match)&&(u.result=!0),r==null||r(["debug",203,{criteria:t,result:u,explanation:Nt(o,t.match)}]),u};mt.alwaysExecute=!0;var At=({update:e,criteria:t,onLogMessage:i})=>{var u,c,l,p,f;if(t.type!=="QS")return{result:!1,changed:!1};let r=!e.previousState||((c=(u=e.state.url)==null?void 0:u.searchParams)==null?void 0:c.toString())!==((p=(l=e.previousState.url)==null?void 0:l.searchParams)==null?void 0:p.toString()),n=(f=e.state.url)==null?void 0:f.searchParams.get(t.queryName),o={result:V(n,t.match),changed:r};return i==null||i(["debug",203,{criteria:t,result:o,explanation:O(n,t.match)}]),o};var Gt=({update:e,criteria:t,signal:i,onLogMessage:r})=>{var p;if(t.type!=="QK")return{result:!1,changed:!1};if(typeof document=="undefined"&&i.dur==="t"&&e.scores[i.id]>0)return{result:!0,changed:!1};let n=e.visitor.quirks[t.key],s=(p=e.state.quirks)==null?void 0:p[t.key],o=s!=null?s:n,u=Boolean(s&&n!==s),l={result:V(o,t.match),changed:u};return r==null||r(["debug",203,{criteria:t,result:l,explanation:O(o,t.match)}]),l};var It=({update:e,criteria:t,onLogMessage:i})=>{var s,o,u;if(t.type!=="EVT")return{result:!1,changed:!1};let r=(o=(s=e.state.events)==null?void 0:s.some(c=>V(c.event,t.event)))!=null?o:!1,n={result:r,changed:r};return i==null||i(["debug",203,{criteria:t,result:n,explanation:`'${(u=e.state.events)==null?void 0:u.join("', '")}' ${pt(t.event)}`}]),n};var qt=({update:e,criteria:t,onLogMessage:i})=>{var u,c,l;if(t.type!=="PV")return{result:!1,changed:!1};let r=(u=e.state.url)==null?void 0:u.pathname,n=!e.previousState||(r==null?void 0:r.toString())!==((l=(c=e.previousState.url)==null?void 0:c.pathname)==null?void 0:l.toString()),o={result:V(r,t.path),changed:n};return i==null||i(["debug",203,{criteria:t,result:o,explanation:O(r,t.path)}]),o};var H,A=class{constructor(t){d(this,H,void 0);m(this,H,t)}evaluate(t,i,r,n,s){let o=i.clauses.length>1;o&&(s==null||s(["debug",202,"GROUP",i]));try{let u=!(i.op==="&"||!i.op),c=null,l=!1;for(let f of i.clauses){let v;if(f.type==="G")v=this.evaluate(t,f,r,n,s);else{let D=a(this,H)[f.type];if(c&&!D.alwaysExecute)continue;if(!D)throw new Error(`${f.type} signal criteria not registered`);v=D({update:t,criteria:f,commands:r,signal:n,onLogMessage:s})}v.changed&&(l=!0),!c&&v.result===u&&(c={result:u,changed:l})}let p=c!=null?c:{result:!u,changed:l};return o&&(s==null||s(["debug",204,p])),p}finally{o&&(s==null||s(["debug",202,"ENDGROUP"]))}}};H=new WeakMap;var et=()=>({quirks:{},scores:{},sessionScores:{},tests:{},consent:!1,controlGroup:!1});import de from"mitt";import{dequal as pe}from"dequal/lite";var fe="__UNIFORM_DATA__",U,G,I=class{constructor({initialData:t}){d(this,U,void 0);d(this,G,de());y(this,"events",{on:a(this,G).on,off:a(this,G).off});t&&m(this,U,t)}get data(){return a(this,U)}updateData(t,i){return m(this,U,i),this.handleUpdateData(t,i)}async delete(t){m(this,U,void 0),await this.handleDelete(t)}signalAsyncDataUpdate(t){pe(this.data,t)||(m(this,U,t),a(this,G).emit("dataUpdatedAsync",t))}getClientTransitionState(){if(typeof document=="undefined")return;let t=document.getElementById(fe);return t!=null&&t.textContent?JSON.parse(t.textContent):void 0}};U=new WeakMap,G=new WeakMap;var ht="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_t=ht.split(""),jt=new Array(123);for(let e=0;e<ht.length;e++)jt[ht.charCodeAt(e)]=e;var gt=e=>{if(e<0)return`-${gt(-e)}`;let t=e>>>0,i=e/4294967296>>>0,r="";for(;i>0;)r=_t[63&t]+r,t>>>=6,t|=(63&i)<<26,i>>>=6;let n="";do n=_t[63&t]+n,t>>>=6;while(t>0);return n+r},Qt=e=>{let t=0,i=e.charAt(0)==="-"?1:0;for(let r=i;r<e.length;r++)t=t*64+jt[e.charCodeAt(r)];return i?-t:t};import vt from"js-cookie";var St=typeof document=="undefined",me="ufvd",$,B,Ft=class extends I{constructor({serverCookieValue:i,cookieName:r=me,cookieAttributes:n={sameSite:"lax"}}){super({initialData:St?he(i):void 0});d(this,$,void 0);d(this,B,void 0);m(this,$,r),m(this,B,n)}handleDelete(){return St||vt.remove(a(this,$)),Promise.resolve()}async handleUpdateData(i,r){St||(r.consent?vt.set(a(this,$),ge(r),a(this,B)):vt.remove(a(this,$)))}};$=new WeakMap,B=new WeakMap;var Bt="~",Jt="!",Wt="-";function he(e){if(!e)return;let t=e.split(Bt);if(t.length>3)return;let[i,r,n]=t;return{consent:!0,sessionScores:Kt(yt(r)),scores:Kt(yt(n)),tests:yt(i)}}function yt(e){return e.split(Jt).map(i=>i.split(Wt)).reduce((i,r)=>(r.length!==2||(i[r[0]]=r[1]),i),{})}function Kt(e){return Object.entries(e).reduce((t,[i,r])=>(t[i]=Qt(r),t),{})}function ge(e){return[Dt(e.tests),Dt(Ht(e.sessionScores)),Dt(Ht(e.scores))].join(Bt)}function Ht(e){return Object.entries(e).reduce((t,[i,r])=>(t[i]=gt(r),t),{})}function Dt(e){return Object.entries(e).map(t=>t.join(Wt)).join(Jt)}var it,Xt,Yt=class extends I{constructor({serverCookieValue:i,visitorIdCookieName:r="ufvi",...n}){super(n);d(this,it);n.initialData||S(this,it,Xt).call(this).catch(s=>{console.error(s)})}handleDelete(i){throw new Error("Method not implemented.")}async handleUpdateData(i){let r=await new Promise(n=>{setTimeout(()=>{n(void 0)},2e3)});r&&this.signalAsyncDataUpdate(r)}};it=new WeakSet,Xt=async function(){let i=await new Promise(r=>{setTimeout(()=>{r(void 0)},2e3)});i&&this.signalAsyncDataUpdate(i)};function ki(e){let{gracePeriod:t=864e5,decayRate:i=1/30,decayCap:r=.95}=e!=null?e:{};return function({now:s,lastUpd:o,scores:u,sessionScores:c,onLogMessage:l}){if(typeof o!="number")return!1;let f=s-o-t;if(f<=0)return!1;let v=f/864e5,D=1-Math.min(r,v*i);return D<=0?!1:(Zt(u,D),Zt(c,D),l==null||l(["info",140,`linear decay factor ${D.toPrecision(6)}`]),!0)}}function Zt(e,t){for(let i in e)i.startsWith("$")||(e[i]*=t)}import ye from"mitt";import{dequal as nt}from"dequal/lite";var rt=class{constructor(){y(this,"inMemoryFallback",{});y(this,"hasLocalStorageObject",typeof localStorage!="undefined")}get(t){let i=this.inMemoryFallback[t];if(!this.hasLocalStorageObject||i)return i;try{let r=localStorage.getItem(t);return r?JSON.parse(r):void 0}catch(r){return i}}set(t,i,r){if(this.inMemoryFallback[t]=i,!(!this.hasLocalStorageObject||!r))try{localStorage.setItem(t,JSON.stringify(i))}catch(n){console.warn(n)}}delete(t,i){i||delete this.inMemoryFallback[t];try{localStorage.removeItem(t)}catch(r){}}};import ve from"rfdc";var Se=ve();function Mt(e,t,i){let r=t?Se(t):et();return e.forEach(n=>{var s,o;switch(n.type){case"consent":r.consent=n.data;break;case"setquirk":r.quirks[n.data.key]=n.data.value;break;case"settest":r.tests[n.data.test]=n.data.variant;break;case"modscore":if(i)break;let u=Number(n.data.delta);if(isNaN(u))throw new Error("Non-number delta received");let c=(s=r.scores[n.data.dimension])!=null?s:0;r.scores[n.data.dimension]=c+u;break;case"modscoreS":if(i)break;let l=Number(n.data.delta);if(isNaN(l))throw new Error("Non-number delta received");let p=(o=r.sessionScores[n.data.dimension])!=null?o:0;r.sessionScores[n.data.dimension]=p+l;break;case"identify":break;case"setcontrol":r.controlGroup=n.data;break;default:throw new Error("Unknown command")}}),r}var ot="ufvisitor",E,N,q,g,x,k,P,z,at,Lt,ut,te,J,Ct,W,xt,st=class{constructor(t){d(this,x);d(this,P);d(this,at);d(this,ut);d(this,J);d(this,W);d(this,E,ye());d(this,N,new rt);d(this,q,void 0);d(this,g,void 0);y(this,"events",{on:a(this,E).on,off:a(this,E).off});if(m(this,g,t),a(this,x,k)||S(this,P,z).call(this,S(this,W,xt).call(this),!0),t.transitionStore){let i=t.transitionStore.getClientTransitionState();i&&t.onServerTransitionReceived&&t.onServerTransitionReceived(i),t.transitionStore.events.on("dataUpdatedAsync",n=>{S(this,P,z).call(this,{...a(this,x,k).visitorData,...n})});let r=t.transitionStore.data;r&&S(this,P,z).call(this,{...a(this,x,k).visitorData,...r},!0)}}get data(){var i,r;let t=a(this,x,k);if(S(this,ut,te).call(this,t)){let{sessionScores:n,...s}=t.visitorData;return S(this,P,z).call(this,{...s,sessionScores:{}}),(r=(i=a(this,g)).onLogMessage)==null||r.call(i,["info",120]),a(this,x,k).visitorData}return t.visitorData}get decayEnabled(){return!!a(this,g).decay}async updateData(t){var r,n,s,o;if(t.length===0)return;(n=(r=a(this,g)).onLogMessage)==null||n.call(r,["debug",101,t]);let i=Mt(t,this.data,(s=a(this,x,k))==null?void 0:s.visitorData.controlGroup);t.some(u=>u.type==="consent"&&!u.data)&&a(this,N).delete(ot,!0),S(this,P,z).call(this,i),await((o=a(this,g).transitionStore)==null?void 0:o.updateData(t,a(this,x,k).visitorData))}async delete(t){var i,r,n,s,o;(r=(i=a(this,g)).onLogMessage)==null||r.call(i,["info",103,"GROUP",t]);try{a(this,N).delete(ot,!1),await((n=a(this,g).transitionStore)==null?void 0:n.delete(t)),S(this,P,z).call(this,S(this,W,xt).call(this))}finally{(o=(s=a(this,g)).onLogMessage)==null||o.call(s,["info",103,"ENDGROUP"])}}};E=new WeakMap,N=new WeakMap,q=new WeakMap,g=new WeakMap,x=new WeakSet,k=function(){return a(this,N).get(ot)},P=new WeakSet,z=function(t,i=!1){var p,f,v,D,X,Et,Tt,kt,Pt;let r=a(this,x,k),n=Date.now();t.controlGroup?(t.scores={},t.sessionScores={}):(S(this,J,Ct).call(this,t.scores),S(this,J,Ct).call(this,t.sessionScores),(f=(p=a(this,g)).decay)==null||f.call(p,{now:n,lastUpd:r==null?void 0:r.updated,scores:t.scores,sessionScores:t.sessionScores,onLogMessage:a(this,g).onLogMessage}));let s=!nt(r==null?void 0:r.visitorData.scores,t.scores),o=!nt(r==null?void 0:r.visitorData.sessionScores,t.sessionScores),u=!nt(r==null?void 0:r.visitorData.quirks,t.quirks),c=!nt(r==null?void 0:r.visitorData.tests,t.tests),l={updated:n,visitorData:t};S(this,at,Lt).call(this),a(this,N).set(ot,l,!!t.consent),(D=(v=a(this,g)).onLogMessage)==null||D.call(v,["debug",102,t]),i||((s||o)&&a(this,E).emit("scoresUpdated",t),u&&a(this,E).emit("quirksUpdated",t),c&&a(this,E).emit("testsUpdated",t),((X=r==null?void 0:r.visitorData)==null?void 0:X.consent)!==t.consent&&a(this,E).emit("consentUpdated",t),((Et=r==null?void 0:r.visitorData)==null?void 0:Et.controlGroup)!==t.controlGroup&&(a(this,E).emit("controlGroupUpdated",t),(Pt=(kt=a(this,g)).onLogMessage)==null||Pt.call(kt,["debug",104,(Tt=t.controlGroup)!=null?Tt:!1])))},at=new WeakSet,Lt=function(){typeof document=="undefined"||!a(this,g).visitLifespan||(a(this,q)&&window.clearTimeout(a(this,q)),m(this,q,window.setTimeout(()=>{this.data},a(this,g).visitLifespan+50)))},ut=new WeakSet,te=function(t){let i=a(this,g).visitLifespan;return i?t.updated+i<Date.now():!1},J=new WeakSet,Ct=function(t){var i,r;if(!!a(this,g).manifest)for(let n in t){let s=t[n],o=a(this,g).manifest.getDimensionByKey(n);!o||s>o.cap&&((r=(i=a(this,g)).onLogMessage)==null||r.call(i,["debug",110,{dim:n,score:s,cap:o.cap}]),t[n]=o.cap)}},W=new WeakSet,xt=function(){var t,i,r;return{...et(),consent:(t=a(this,g).defaultConsent)!=null?t:!1,controlGroup:(r=(i=a(this,g).manifest)==null?void 0:i.rollForControlGroup())!=null?r:!1}};import Ce from"mitt";function ee({name:e,context:t,variations:i,take:r=1,onLogMessage:n}){var s,o,u;console.log("personalizeVariations called"),n==null||n(["info",300,"GROUP",{name:e,take:r}]);try{let c=(s=t.storage.data.controlGroup)!=null?s:!1,l=[],p=!1,f=t.scores;console.log("personalizeVariations context",t),console.log("personalizeVariations scores",f);for(let v of i){if(l.length===r)break;if(!((o=v.pz)!=null&&o.crit.length)){n==null||n(["info",301,"GROUP",{id:v.id,op:(u=v.pz)==null?void 0:u.op}]),n==null||n(["info",302,{matched:!0,description:"default variation"}]),n==null||n(["info",303,!0]),n==null||n(["info",301,"ENDGROUP"]),l.push(v);continue}c||ie(v.id,v.pz,f,n)&&(p=!0,l.push(v))}return console.log("personalizeVariations personalized",p),console.log("personalizeVariations results",l),{personalized:p,variations:l}}finally{n==null||n(["info",300,"ENDGROUP"])}}function ie(e,t,i,r){r==null||r(["info",301,"GROUP",{id:e,op:t==null?void 0:t.op}]);let n;try{t!=null&&t.crit?!t.op||t.op==="&"?n=t.crit.every(s=>re(s,i,r)):n=t.crit.some(s=>re(s,i,r)):(r==null||r(["info",302,{matched:!0,description:"default variation"}]),n=!0),r==null||r(["info",303,n])}finally{r==null||r(["info",301,"ENDGROUP"])}return n}function re(e,t,i){var u,c;console.log("evaluateDimensionMatch crit",e),console.log("evaluateDimensionMatch vec",t);let{op:r,l:n}=e,s=(u=t[n])!=null?u:0;if(r==="+"){let l=Math.max(...Object.values(t))===s&&s>0;return i==null||i(["info",302,{matched:l,description:`${e.l} has the highest score`}]),l}else if(r==="-"){let l=Math.min(...Object.values(t))===s&&s>0;return i==null||i(["info",302,{matched:l,description:`${e.l} has the lowest non-zero score`}]),l}let o=parseInt(e.rDim?t[e.rDim]:e.r,10);if(isNaN(o))return i==null||i(["info",302,{matched:!1,description:`${(c=e.rDim)!=null?c:e.r} has no score value`}]),!1;if(r===">"){let l=s>o;return _(i,l,e,s,o),l}else if(r===">="){let l=s>=o;return _(i,l,e,s,o),l}else if(r==="<"){let l=s<o;return _(i,l,e,s,o),l}else if(r==="<="){let l=s<=o;return _(i,l,e,s,o),l}else if(r==="="){let l=s===o;return _(i,l,e,s,o),l}else if(r==="!="){let l=s!==o;return _(i,l,e,s,o),l}else throw new Error(`Unknown op: ${r}`)}function _(e,t,i,r,n){console.log("crit",i),console.log("lhsScore",r),e==null||e(["info",302,{matched:t,description:`${i.l}[${r}] ${i.op} ${i.rDim?`${i.rDim}[${n}]`:i.r}`}])}var De=e=>{let{values:t,total:i,missingDistribution:r}=e.reduce((n,s)=>(s.testDistribution?n.total+=s.testDistribution:++n.missingDistribution,n.values.push(s.testDistribution),n),{values:[],total:0,missingDistribution:0});if(i>100)throw new Error(`Total distribution ${i} is over the maximum 100.`);if(i<100){let s=(100-i)/r;t.forEach((o,u)=>{typeof o=="undefined"&&(t[u]=s)})}return t},bt=({name:e,context:t,variations:i,onLogMessage:r})=>{r==null||r(["info",400,"GROUP",e]);try{let n,s=t.getTestVariantId(e);if(s===null)return r==null||r(["error",401,e]),{result:void 0,variantAssigned:!1};if(s&&(n=i.find(o=>o.id===s),n||r==null||r(["warn",402,{missingVariant:s,variants:i.map(o=>o.id)}])),!n){let o=De(i),u=Math.floor(Math.random()*100),c=0;n=i.find((l,p)=>{let f=o[p];if(u>c&&u<=c+f)return l;c+=f}),n&&(r==null||r(["info",403,n.id]),t.setTestVariantId(e,n.id))}return n&&(r==null||r(["info",404,n.id])),{result:n,variantAssigned:!s}}finally{r==null||r(["info",400,"ENDGROUP"])}};import{dequal as ne}from"dequal/lite";var C,w,T,Y,h,j,lt,oe=class{constructor(t){d(this,j);y(this,"manifest");d(this,C,void 0);d(this,w,{});d(this,T,void 0);d(this,Y,{});d(this,h,Ce());y(this,"events",{on:a(this,h).on,off:a(this,h).off});y(this,"storage");var n,s;let{manifest:i,...r}=t;m(this,T,{}),(n=t.plugins)==null||n.forEach(o=>{!o.logDrain||a(this,h).on("log",o.logDrain)}),a(this,h).emit("log",["info",1,"GROUP"]);try{this.manifest=new L({onLogMessage:o=>a(this,h).emit("log",o),manifest:i,evaluator:new A({CK:$t,QS:At,QK:Gt,PVC:mt,EVT:It,PV:qt})}),this.storage=new st({...r,manifest:this.manifest,onServerTransitionReceived:o=>{m(this,C,o),o.ssv&&(m(this,w,o.ssv),a(this,h).emit("log",["debug",130,o.ssv]))},onLogMessage:o=>a(this,h).emit("log",o)}),this.storage.events.on("scoresUpdated",S(this,j,lt).bind(this)),a(this,C)||S(this,j,lt).call(this,this.storage.data),this.storage.events.on("quirksUpdated",o=>{let u=this.manifest.computeSignals({scores:a(this,w),state:a(this,T),previousState:a(this,T),visitor:this.storage.data});this.storage.updateData(u),a(this,h).emit("quirksUpdated",o.quirks),a(this,h).emit("log",["info",4,o.quirks])}),(s=t.plugins)==null||s.forEach(o=>{!o.init||o.init(this)})}finally{a(this,h).emit("log",["info",1,"ENDGROUP"])}}get scores(){return a(this,w)}get quirks(){var t,i;return(i=(t=a(this,C))==null?void 0:t.quirks)!=null?i:this.storage.data.quirks}async update(t){var r,n,s;let i=[];(r=a(this,C))!=null&&r.quirks&&(t={...t,quirks:{...a(this,C).quirks,...t.quirks||{}}}),(n=a(this,C))!=null&&n.tests&&i.push(...Object.entries(a(this,C).tests).map(([o,u])=>({type:"settest",data:{test:o,variant:u}})));try{a(this,h).emit("log",["info",2,"GROUP",{...t,url:(s=t.url)==null?void 0:s.toString()}]),t.quirks&&i.push(...Object.entries(t.quirks).map(([o,u])=>({type:"setquirk",data:{key:o,value:u}}))),t.enrichments&&t.enrichments.forEach(o=>{let u=tt(o.cat,o.key),c=this.manifest.getDimensionByKey(u);console.log("\u2728 Update enrichment"),console.log("dimension",u),console.log("dimData",c),c?i.push({type:"modscore",data:{dimension:u,delta:o.str}}):a(this,h).emit("log",["warn",5,o])}),i.push(...this.manifest.computeSignals({state:t,previousState:a(this,T),visitor:this.storage.data,scores:a(this,w)})),m(this,T,{...a(this,T),...t}),await this.storage.updateData(i),a(this,C)&&(S(this,j,lt).call(this,this.storage.data),m(this,C,void 0),a(this,h).emit("log",["debug",131]))}finally{a(this,h).emit("log",["info",2,"ENDGROUP"])}}getTestVariantId(t){var r;let i=this.manifest.getTest(t);return i?(r=i.wv)!=null?r:this.storage.data.tests[t]:(a(this,h).emit("log",["warn",401,t]),null)}setTestVariantId(t,i){this.storage.updateData([{type:"settest",data:{test:t,variant:i}}])}log(...t){a(this,h).emit("log",t)}test(t){var r,n;let i=bt({...t,context:this,onLogMessage:s=>a(this,h).emit("log",s)});return a(this,h).emit("testResult",{name:t.name,variantId:(n=(r=i.result)==null?void 0:r.id)!=null?n:void 0,variantAssigned:i.variantAssigned}),i}personalize(t){console.log("personalize called");let i=ee({...t,context:this,onLogMessage:s=>a(this,h).emit("log",s)}),r=a(this,Y)[t.name],n={name:t.name,variantIds:i.variations.map(s=>{var o;return(o=s.id)!=null?o:"Unknown"}),control:this.storage.data.controlGroup,changed:!0};return r&&ne(n.variantIds,r)&&(n.changed=!1),a(this,h).emit("personalizationResult",n),a(this,Y)[t.name]=n.variantIds,i}async forget(t){m(this,T,{}),await this.storage.delete(t)}};C=new WeakMap,w=new WeakMap,T=new WeakMap,Y=new WeakMap,h=new WeakMap,j=new WeakSet,lt=function(t){var n;let i={...t.scores};for(let s in t.sessionScores)i[s]=((n=i[s])!=null?n:0)+t.sessionScores[s];i=this.manifest.computeAggregateDimensions(i),!ne(i,a(this,w))&&(m(this,w,i),a(this,h).emit("scoresUpdated",i),a(this,h).emit("log",["info",3,i]))};import xe from"rfdc";function ct(e,t){if(e==="none")return!1;switch(t){case"debug":return e==="debug";case"info":return e==="info"||e==="debug";case"warn":return e==="warn"||e==="info"||e==="debug";case"error":return e==="debug"||"info";default:return!1}}var be=xe();function Ve(e){return([t,...i])=>{if(!ct(e,t))return;let[r,...n]=i;console[t](`\u{1F94B} [${t}] Uniform event ID ${r}
`,...n.map(be))}}function pr(e){return{logDrain:Ve(e)}}var se={1:()=>["context","initializing Uniform Context"],2:e=>["context","received update()",e],3:e=>["context","new score vector",e],4:e=>["context","updated quirks",e],5:e=>["context","ignored enrichment update for unknown enrichment category",e.cat],101:e=>["storage","received update commands",e],102:e=>["storage","data was updated",e],103:e=>["storage",`deleting visitor data ${e?"from all devices":"from this device"}`],104:e=>["context",e?"Visitor assigned to personalization control group":"Visitor assigned to personalization experiment group"],110:({dim:e,cap:t,score:i})=>["storage",`${e} score ${i} exceeded cap ${t}. Rounded down.`],120:()=>["storage","visitor data expired and was cleared"],130:e=>["storage","server to client transition score data was loaded; it will persist until the next update event occurs",e],131:()=>["storage","server to client transition data was discarded"],140:e=>["storage",`score decay was applied: ${e}`],200:()=>["signals","evaluating signals"],201:e=>["signals",`evaluating signal ${e.id} (${e.dur})`],202:e=>["signals",e.op==="|"?"OR":"AND"],203:({criteria:e,result:t,explanation:i})=>["signals",`${e.type}: ${i} is ${t.result} [${t.changed?"CHANGED":"unchanged"}]`],204:e=>["signals",`group result: ${e.result} [${e.changed?"CHANGED":"unchanged"}]`],300:e=>["personalization",`executing personalization '${e.name}'`],301:({id:e,op:t})=>["personalization",`testing variation ${e} (${t==="|"?"OR":"AND"})`],302:({matched:e,description:t})=>["personalization",`${t} is ${e}`],303:e=>["personalization",e?"selected variation":"did not select variation"],400:e=>["testing",`executing A/B test '${e}'`],401:e=>["testing",`${e} is not registered in the manifest; it will not be run.`],402:({missingVariant:e,variants:t})=>["testing",`test variation '${e}' previously assigned to the visitor for this test no longer exists as a variant. It will be removed. This may indicate changing test variations after publishing a test, which will make results invalid. Known variants: ${t.join(", ")}`],403:e=>["testing",`assigned new test variant '${e}'`],404:e=>["testing",`displaying variation '${e}'`],700:()=>["gtag","gtag is not defined, skipping analytics event emission. Ensure you have added the gtag script to your page."],701:()=>["gtag","enabled gtag event signal redirection"]};import Ee from"rfdc";var Te=Ee();function ke(e,t){let i=typeof document=="undefined",{enableOnServer:r=!1}=t!=null?t:{};return([n,...s])=>{if(!ct(e,n)||i&&!r)return;let[o,...u]=s,c=console[n];if(u[0]==="GROUP"&&(u.shift(),c=console.groupCollapsed),u[0]==="ENDGROUP"){console.groupEnd();return}let l=se[o],p="";switch(n){case"debug":p="\u{1F41E}";break;case"info":p="\u{1F4AC}";break;case"warn":p="\u26A0\uFE0F";break;case"error":p="\u{1F4A5}";break}let f=p;if(!l){c(`${f} unknown event ID ${o}. Log messages data may be older than Uniform Context package.`,...u);return}let[v,D,...X]=l(...u);c(`${f}[${v}] ${D}
`,...X.map(Te))}}function Sr(e,t){return{logDrain:ke(e,t)}}var Pe=(u=>(u.ListStart="nesi-list-start",u.ListEnd="nesi-list-end",u.ListItem="nesi-list-item-html",u.ListItemSettings="nesi-list-item-settings",u.TestStart="nesi-test-start",u.TestEnd="nesi-test-end",u.Unknown="unknown",u))(Pe||{}),Dr="nesitag";var Vt=typeof top!="undefined";function xr(){return{logDrain:e=>{!Vt||top==null||top.postMessage({type:"uniform:context:log",message:e},window.location.origin)},init:e=>{let t=[],i=[],r=()=>{!Vt||top==null||top.postMessage({type:"uniform:context:data",data:{scores:e.scores,data:e.storage.data,manifest:e.manifest.data,personalizations:t,tests:i}},window.location.origin)},n=o=>{!o.changed||(t.push(o),r())},s=o=>{!o.variantAssigned||(i.push(o),r())};if(Vt){window.__UNIFORM_DEVTOOLS_CONTEXT_INSTANCE__=e;try{top==null||top.addEventListener("message",async o=>{if(!o.data)return;let u=o.data;await we(u,e)})}catch(o){console.warn("Unable to initialize Uniform Context DevTools because it is in a cross-domain iframe.",o)}top==null||top.postMessage({type:"uniform:context:hello",uiVersion:2},window.location.origin),r()}return e.events.on("personalizationResult",n),e.events.on("testResult",s),e.events.on("scoresUpdated",r),e.storage.events.on("*",r),()=>{e.events.off("scoresUpdated",r),e.storage.events.off("*",r),e.events.off("personalizationResult",n),e.events.off("testResult",s)}}}}async function we(e,t){e.type==="uniform-in:context:update"&&e.newData&&await t.update(e.newData),e.type==="uniform-in:context:commands"&&e.commands&&Array.isArray(e.commands)&&await t.storage.updateData(e.commands),e.type==="uniform-in:context:forget"&&await t.forget(!1)}function Vr(e){return`${e.apiKey}|${e.projectId}${e.apiHost?`|${e.apiHost}`:""}`}function Er(e){let[t,i,r]=e.split("|");if(!t.startsWith("uf"))throw new Error("Invalid API key");if(!/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})$/i.test(i))throw new Error("Invalid project ID");return{apiKey:t,projectId:i,apiHost:r||"https://uniform.app"}}export{oe as Context,Ft as CookieTransitionDataStore,Dr as EdgeNodeTagName,Yt as EdgeTransitionDataStore,A as GroupCriteriaEvaluator,L as ManifestInstance,fe as SERVER_STATE_ID,Pe as ScriptType,I as TransitionDataStore,me as UNIFORM_DEFAULT_COOKIE_NAME,st as VisitorDataStore,wt as computeAggregateDimensions,$t as cookieEvaluator,Ve as createConsoleLogDrain,ke as createDebugConsoleLogDrain,ki as createLinearDecay,qt as currentPageEvaluator,et as emptyVisitorData,pr as enableConsoleLogDrain,xr as enableContextDevTools,Sr as enableDebugConsoleLogDrain,ie as evaluateVariantMatch,It as eventEvaluator,O as explainStringMatch,pt as explainStringMatchCriteria,tt as getEnrichmentVectorKey,V as isStringMatch,ft as pageViewCountDimension,mt as pageViewCountEvaluator,Er as parseQuickConnect,ee as personalizeVariations,At as queryStringEvaluator,Gt as quirkEvaluator,Vr as serializeQuickConnect,bt as testVariations};
"use strict";var ae=Object.defineProperty;var ue=(e,t,r)=>t in e?ae(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var y=(e,t,r)=>(ue(e,typeof t!="symbol"?t+"":t,r),r),dt=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var a=(e,t,r)=>(dt(e,t,"read from private field"),r?r.call(e):t.get(e)),d=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},m=(e,t,r,i)=>(dt(e,t,"write to private field"),i?i.call(e,r):t.set(e,r),r);var S=(e,t,r)=>(dt(e,t,"access private method"),r);function wt(e,t){let r={...e};for(let i in t){let n=Rt(e,i,t,new Set([i]));n!==0&&(r[i]=n)}return r}function Rt(e,t,r,i){var s;let n=0;for(let o of r[t].inputs){let u=(s=e[o.dim])!=null?s:0;if(!u&&r[o.dim]){if(i.has(o.dim))continue;let l=new Set(i);l.add(o.dim),u=Rt(e,o.dim,r,l)}if(u!==0)if(o.sign==="c"){n=0;break}else o.sign==="-"?n-=u:n+=u}return n}var Z="_";var Q,F,M=class{constructor(t,r,i){d(this,Q,void 0);d(this,F,void 0);y(this,"signal");this.signal=t,m(this,Q,r),m(this,F,i)}computeSignal(t,r){if(t.scores[this.signal.id]>=this.signal.cap&&this.signal.dur!=="t")return;let n=a(this,Q).evaluate(t,this.signal.crit,r,this.signal,a(this,F)),s=this.signal.dur==="s"||this.signal.dur==="t"?"modscoreS":"modscore";if(!!n.changed){if(n.result)r.push({type:s,data:{dimension:this.signal.id,delta:this.signal.str}});else if(this.signal.dur==="t"){let o=t.visitor.sessionScores[this.signal.id];o&&r.push({type:s,data:{dimension:this.signal.id,delta:-o}})}}}};Q=new WeakMap,F=new WeakMap;var b,K,R,L=class{constructor({manifest:t,evaluator:r=new G({}),onLogMessage:i=()=>{}}){y(this,"data");d(this,b,void 0);d(this,K,void 0);d(this,R,void 0);var n,s,o;m(this,b,(n=t.project)!=null?n:{}),this.data=t,m(this,K,Object.entries((o=(s=a(this,b).pz)==null?void 0:s.sig)!=null?o:[]).map(([u,c])=>new M({...c,id:u},r,i))),m(this,R,i)}rollForControlGroup(){var t,r;return Math.random()<((r=(t=a(this,b).pz)==null?void 0:t.control)!=null?r:0)}getTest(t){var r;return(r=a(this,b).test)==null?void 0:r[t]}computeSignals(t){let r=[];a(this,R).call(this,["debug",200,"GROUP"]);try{a(this,K).forEach(i=>{a(this,R).call(this,["debug",201,"GROUP",i.signal]);try{i.computeSignal(t,r)}finally{a(this,R).call(this,["debug",201,"ENDGROUP"])}})}finally{a(this,R).call(this,["debug",200,"ENDGROUP"])}return r}computeAggregateDimensions(t){var r,i;return wt(t,(i=(r=a(this,b).pz)==null?void 0:r.agg)!=null?i:{})}getDimensionByKey(t){var i,n,s,o;let r=t.indexOf(Z);return r<=0?(n=(i=a(this,b).pz)==null?void 0:i.sig)==null?void 0:n[t]:(o=(s=a(this,b).pz)==null?void 0:s.enr)==null?void 0:o[t.substring(0,r)]}};b=new WeakMap,K=new WeakMap,R=new WeakMap;import{dequal as le}from"dequal/lite";function V(e,t){var o,u,c,l,f,p;let r=(o=t==null?void 0:t.op)!=null?o:"=";if(t.op==="*")return e!==null&&typeof e!="undefined";if(t.op==="!*")return e===null||typeof e=="undefined";if(!("rhs"in t))throw new Error(`Match expression is required for match type ${r}`);let i=(u=t.cs)!=null?u:!1,n=(i?e!=null?e:"":Ot(e)).toString(),s=(i?t.rhs:Ot(t.rhs)).toString();switch(r){case"=":return n===s;case"!=":return n!==s;case"~":return(c=n.includes(s))!=null?c:!1;case"!~":return!((l=n.includes(s))==null||l);case"//":return new RegExp(t.rhs.toString(),i?"":"i").test((f=e==null?void 0:e.toString())!=null?f:"");case"!//":return!new RegExp(t.rhs.toString(),i?"":"i").test((p=e==null?void 0:e.toString())!=null?p:"");default:throw new Error(`Unknown match type ${r}.`)}}function O(e,t){return`'${("cs"in t?t.cs:!1)?e:e==null?void 0:e.toString().toUpperCase()}' ${ft(t)}`}function ft(e){return"rhs"in e?`${e.op} '${e.cs?e.rhs:e.rhs.toString().toUpperCase()}'`:`${e.op==="*"?"exists":"does not exist"}`}function Ot(e){var t,r;return(r=(t=e==null?void 0:e.toString())==null?void 0:t.toUpperCase())!=null?r:""}var $t=({update:e,criteria:t,onLogMessage:r})=>{var u,c;if(t.type!=="CK")return{result:!1,changed:!1};let i=!le(Ut(e.state.cookies),Ut((u=e.previousState)==null?void 0:u.cookies)),n=(c=e.state.cookies)==null?void 0:c[t.cookieName],o={result:V(n,t.match),changed:i};return r==null||r(["debug",203,{criteria:t,result:o,explanation:O(n,t.match)}]),o};function Ut(e){if(!e)return;if(!e.ufvd)return e;let{ufvd:t,...r}=e;return r}function Nt(e,t){var i;if(typeof e=="undefined"||e===null)return!1;let r=Number(e);if(isNaN(r))return!1;switch((i=t==null?void 0:t.op)!=null?i:"="){case"=":return r===t.rhs;case"!=":return r!==t.rhs;case">":return r>t.rhs;case"<":return r<t.rhs;default:return console.warn(`Unknown match type ${t.op} is false.`),!1}}function At(e,t){return`${e} ${ce(t)}`}function ce(e){return`${e.op} ${e.rhs}`}function tt(e,t){return`${e}${Z}${t}`}var pt=tt("$pvc","v"),mt=({update:e,criteria:t,commands:r,onLogMessage:i})=>{var l,f;if(t.type!=="PVC")return{result:!1,changed:!1};let n=Boolean(e.state.url&&(!e.previousState||((l=e.state.url)==null?void 0:l.toString())!==((f=e.previousState.url)==null?void 0:f.toString()))),o=(e.visitor.sessionScores[pt]||0)+1,u={result:!1,changed:n},c=r.some(p=>p.type==="modscoreS"&&p.data.dimension===pt);return n&&!c&&r.push({type:"modscoreS",data:{dimension:pt,delta:1}}),Nt(o,t.match)&&(u.result=!0),i==null||i(["debug",203,{criteria:t,result:u,explanation:At(o,t.match)}]),u};mt.alwaysExecute=!0;var Gt=({update:e,criteria:t,onLogMessage:r})=>{var u,c,l,f,p;if(t.type!=="QS")return{result:!1,changed:!1};let i=!e.previousState||((c=(u=e.state.url)==null?void 0:u.searchParams)==null?void 0:c.toString())!==((f=(l=e.previousState.url)==null?void 0:l.searchParams)==null?void 0:f.toString()),n=(p=e.state.url)==null?void 0:p.searchParams.get(t.queryName),o={result:V(n,t.match),changed:i};return r==null||r(["debug",203,{criteria:t,result:o,explanation:O(n,t.match)}]),o};var zt=({update:e,criteria:t,signal:r,onLogMessage:i})=>{var f;if(t.type!=="QK")return{result:!1,changed:!1};if(typeof document=="undefined"&&r.dur==="t"&&e.scores[r.id]>0)return{result:!0,changed:!1};let n=e.visitor.quirks[t.key],s=(f=e.state.quirks)==null?void 0:f[t.key],o=s!=null?s:n,u=Boolean(s&&n!==s),l={result:V(o,t.match),changed:u};return i==null||i(["debug",203,{criteria:t,result:l,explanation:O(o,t.match)}]),l};var It=({update:e,criteria:t,onLogMessage:r})=>{var s,o,u;if(t.type!=="EVT")return{result:!1,changed:!1};let i=(o=(s=e.state.events)==null?void 0:s.some(c=>V(c.event,t.event)))!=null?o:!1,n={result:i,changed:i};return r==null||r(["debug",203,{criteria:t,result:n,explanation:`'${(u=e.state.events)==null?void 0:u.join("', '")}' ${ft(t.event)}`}]),n};var qt=({update:e,criteria:t,onLogMessage:r})=>{var u,c,l;if(t.type!=="PV")return{result:!1,changed:!1};let i=(u=e.state.url)==null?void 0:u.pathname,n=!e.previousState||(i==null?void 0:i.toString())!==((l=(c=e.previousState.url)==null?void 0:c.pathname)==null?void 0:l.toString()),o={result:V(i,t.path),changed:n};return r==null||r(["debug",203,{criteria:t,result:o,explanation:O(i,t.path)}]),o};var H,G=class{constructor(t){d(this,H,void 0);m(this,H,t)}evaluate(t,r,i,n,s){let o=r.clauses.length>1;o&&(s==null||s(["debug",202,"GROUP",r]));try{let u=!(r.op==="&"||!r.op),c=null,l=!1;for(let p of r.clauses){let v;if(p.type==="G")v=this.evaluate(t,p,i,n,s);else{let D=a(this,H)[p.type];if(c&&!D.alwaysExecute)continue;if(!D)throw new Error(`${p.type} signal criteria not registered`);v=D({update:t,criteria:p,commands:i,signal:n,onLogMessage:s})}v.changed&&(l=!0),!c&&v.result===u&&(c={result:u,changed:l})}let f=c!=null?c:{result:!u,changed:l};return o&&(s==null||s(["debug",204,f])),f}finally{o&&(s==null||s(["debug",202,"ENDGROUP"]))}}};H=new WeakMap;var et=()=>({quirks:{},scores:{},sessionScores:{},tests:{},consent:!1,controlGroup:!1});import de from"mitt";import{dequal as fe}from"dequal/lite";var pe="__UNIFORM_DATA__",U,z,I=class{constructor({initialData:t}){d(this,U,void 0);d(this,z,de());y(this,"events",{on:a(this,z).on,off:a(this,z).off});t&&m(this,U,t)}get data(){return a(this,U)}updateData(t,r){return m(this,U,r),this.handleUpdateData(t,r)}async delete(t){m(this,U,void 0),await this.handleDelete(t)}signalAsyncDataUpdate(t){fe(this.data,t)||(m(this,U,t),a(this,z).emit("dataUpdatedAsync",t))}getClientTransitionState(){if(typeof document=="undefined")return;let t=document.getElementById(pe);return t!=null&&t.textContent?JSON.parse(t.textContent):void 0}};U=new WeakMap,z=new WeakMap;var ht="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_t=ht.split(""),jt=new Array(123);for(let e=0;e<ht.length;e++)jt[ht.charCodeAt(e)]=e;var gt=e=>{if(e<0)return`-${gt(-e)}`;let t=e>>>0,r=e/4294967296>>>0,i="";for(;r>0;)i=_t[63&t]+i,t>>>=6,t|=(63&r)<<26,r>>>=6;let n="";do n=_t[63&t]+n,t>>>=6;while(t>0);return n+i},Qt=e=>{let t=0,r=e.charAt(0)==="-"?1:0;for(let i=r;i<e.length;i++)t=t*64+jt[e.charCodeAt(i)];return r?-t:t};import vt from"js-cookie";var St=typeof document=="undefined",me="ufvd",$,B,Ft=class extends I{constructor({serverCookieValue:r,cookieName:i=me,cookieAttributes:n={sameSite:"lax"}}){super({initialData:St?he(r):void 0});d(this,$,void 0);d(this,B,void 0);m(this,$,i),m(this,B,n)}handleDelete(){return St||vt.remove(a(this,$)),Promise.resolve()}async handleUpdateData(r,i){St||(i.consent?vt.set(a(this,$),ge(i),a(this,B)):vt.remove(a(this,$)))}};$=new WeakMap,B=new WeakMap;var Bt="~",Jt="!",Wt="-";function he(e){if(!e)return;let t=e.split(Bt);if(t.length>3)return;let[r,i,n]=t;return{consent:!0,sessionScores:Kt(yt(i)),scores:Kt(yt(n)),tests:yt(r)}}function yt(e){return e.split(Jt).map(r=>r.split(Wt)).reduce((r,i)=>(i.length!==2||(r[i[0]]=i[1]),r),{})}function Kt(e){return Object.entries(e).reduce((t,[r,i])=>(t[r]=Qt(i),t),{})}function ge(e){return[Dt(e.tests),Dt(Ht(e.sessionScores)),Dt(Ht(e.scores))].join(Bt)}function Ht(e){return Object.entries(e).reduce((t,[r,i])=>(t[r]=gt(i),t),{})}function Dt(e){return Object.entries(e).map(t=>t.join(Wt)).join(Jt)}var rt,Xt,Yt=class extends I{constructor({serverCookieValue:r,visitorIdCookieName:i="ufvi",...n}){super(n);d(this,rt);n.initialData||S(this,rt,Xt).call(this).catch(s=>{console.error(s)})}handleDelete(r){throw new Error("Method not implemented.")}async handleUpdateData(r){let i=await new Promise(n=>{setTimeout(()=>{n(void 0)},2e3)});i&&this.signalAsyncDataUpdate(i)}};rt=new WeakSet,Xt=async function(){let r=await new Promise(i=>{setTimeout(()=>{i(void 0)},2e3)});r&&this.signalAsyncDataUpdate(r)};function kr(e){let{gracePeriod:t=864e5,decayRate:r=1/30,decayCap:i=.95}=e!=null?e:{};return function({now:s,lastUpd:o,scores:u,sessionScores:c,onLogMessage:l}){if(typeof o!="number")return!1;let p=s-o-t;if(p<=0)return!1;let v=p/864e5,D=1-Math.min(i,v*r);return D<=0?!1:(Zt(u,D),Zt(c,D),l==null||l(["info",140,`linear decay factor ${D.toPrecision(6)}`]),!0)}}function Zt(e,t){for(let r in e)r.startsWith("$")||(e[r]*=t)}import ye from"mitt";import{dequal as nt}from"dequal/lite";var it=class{constructor(){y(this,"inMemoryFallback",{});y(this,"hasLocalStorageObject",typeof localStorage!="undefined")}get(t){let r=this.inMemoryFallback[t];if(!this.hasLocalStorageObject||r)return r;try{let i=localStorage.getItem(t);return i?JSON.parse(i):void 0}catch(i){return r}}set(t,r,i){if(this.inMemoryFallback[t]=r,!(!this.hasLocalStorageObject||!i))try{localStorage.setItem(t,JSON.stringify(r))}catch(n){console.warn(n)}}delete(t,r){r||delete this.inMemoryFallback[t];try{localStorage.removeItem(t)}catch(i){}}};import ve from"rfdc";var Se=ve();function Mt(e,t,r){let i=t?Se(t):et();return e.forEach(n=>{var s,o;switch(n.type){case"consent":i.consent=n.data;break;case"setquirk":i.quirks[n.data.key]=n.data.value;break;case"settest":i.tests[n.data.test]=n.data.variant;break;case"modscore":if(r)break;let u=Number(n.data.delta);if(isNaN(u))throw new Error("Non-number delta received");let c=(s=i.scores[n.data.dimension])!=null?s:0;i.scores[n.data.dimension]=c+u;break;case"modscoreS":if(r)break;let l=Number(n.data.delta);if(isNaN(l))throw new Error("Non-number delta received");let f=(o=i.sessionScores[n.data.dimension])!=null?o:0;i.sessionScores[n.data.dimension]=f+l;break;case"identify":break;case"setcontrol":i.controlGroup=n.data;break;default:throw new Error("Unknown command")}}),i}var ot="ufvisitor",E,A,q,g,x,k,P,N,at,Lt,ut,te,J,Ct,W,xt,st=class{constructor(t){d(this,x);d(this,P);d(this,at);d(this,ut);d(this,J);d(this,W);d(this,E,ye());d(this,A,new it);d(this,q,void 0);d(this,g,void 0);y(this,"events",{on:a(this,E).on,off:a(this,E).off});if(m(this,g,t),a(this,x,k)||S(this,P,N).call(this,S(this,W,xt).call(this),!0),t.transitionStore){let r=t.transitionStore.getClientTransitionState();r&&t.onServerTransitionReceived&&t.onServerTransitionReceived(r),t.transitionStore.events.on("dataUpdatedAsync",n=>{S(this,P,N).call(this,{...a(this,x,k).visitorData,...n})});let i=t.transitionStore.data;i&&S(this,P,N).call(this,{...a(this,x,k).visitorData,...i},!0)}}get data(){var r,i;let t=a(this,x,k);if(S(this,ut,te).call(this,t)){let{sessionScores:n,...s}=t.visitorData;return S(this,P,N).call(this,{...s,sessionScores:{}}),(i=(r=a(this,g)).onLogMessage)==null||i.call(r,["info",120]),a(this,x,k).visitorData}return t.visitorData}get decayEnabled(){return!!a(this,g).decay}async updateData(t){var i,n,s,o;if(t.length===0)return;(n=(i=a(this,g)).onLogMessage)==null||n.call(i,["debug",101,t]);let r=Mt(t,this.data,(s=a(this,x,k))==null?void 0:s.visitorData.controlGroup);t.some(u=>u.type==="consent"&&!u.data)&&a(this,A).delete(ot,!0),S(this,P,N).call(this,r),await((o=a(this,g).transitionStore)==null?void 0:o.updateData(t,a(this,x,k).visitorData))}async delete(t){var r,i,n,s,o;(i=(r=a(this,g)).onLogMessage)==null||i.call(r,["info",103,"GROUP",t]);try{a(this,A).delete(ot,!1),await((n=a(this,g).transitionStore)==null?void 0:n.delete(t)),S(this,P,N).call(this,S(this,W,xt).call(this))}finally{(o=(s=a(this,g)).onLogMessage)==null||o.call(s,["info",103,"ENDGROUP"])}}};E=new WeakMap,A=new WeakMap,q=new WeakMap,g=new WeakMap,x=new WeakSet,k=function(){return a(this,A).get(ot)},P=new WeakSet,N=function(t,r=!1){var f,p,v,D,X,Et,Tt,kt,Pt;let i=a(this,x,k),n=Date.now();t.controlGroup?(t.scores={},t.sessionScores={}):(S(this,J,Ct).call(this,t.scores),S(this,J,Ct).call(this,t.sessionScores),(p=(f=a(this,g)).decay)==null||p.call(f,{now:n,lastUpd:i==null?void 0:i.updated,scores:t.scores,sessionScores:t.sessionScores,onLogMessage:a(this,g).onLogMessage}));let s=!nt(i==null?void 0:i.visitorData.scores,t.scores),o=!nt(i==null?void 0:i.visitorData.sessionScores,t.sessionScores),u=!nt(i==null?void 0:i.visitorData.quirks,t.quirks),c=!nt(i==null?void 0:i.visitorData.tests,t.tests),l={updated:n,visitorData:t};S(this,at,Lt).call(this),a(this,A).set(ot,l,!!t.consent),(D=(v=a(this,g)).onLogMessage)==null||D.call(v,["debug",102,t]),r||((s||o)&&a(this,E).emit("scoresUpdated",t),u&&a(this,E).emit("quirksUpdated",t),c&&a(this,E).emit("testsUpdated",t),((X=i==null?void 0:i.visitorData)==null?void 0:X.consent)!==t.consent&&a(this,E).emit("consentUpdated",t),((Et=i==null?void 0:i.visitorData)==null?void 0:Et.controlGroup)!==t.controlGroup&&(a(this,E).emit("controlGroupUpdated",t),(Pt=(kt=a(this,g)).onLogMessage)==null||Pt.call(kt,["debug",104,(Tt=t.controlGroup)!=null?Tt:!1])))},at=new WeakSet,Lt=function(){typeof document=="undefined"||!a(this,g).visitLifespan||(a(this,q)&&window.clearTimeout(a(this,q)),m(this,q,window.setTimeout(()=>{this.data},a(this,g).visitLifespan+50)))},ut=new WeakSet,te=function(t){let r=a(this,g).visitLifespan;return r?t.updated+r<Date.now():!1},J=new WeakSet,Ct=function(t){var r,i;if(!!a(this,g).manifest)for(let n in t){let s=t[n],o=a(this,g).manifest.getDimensionByKey(n);!o||s>o.cap&&((i=(r=a(this,g)).onLogMessage)==null||i.call(r,["debug",110,{dim:n,score:s,cap:o.cap}]),t[n]=o.cap)}},W=new WeakSet,xt=function(){var t,r,i;return{...et(),consent:(t=a(this,g).defaultConsent)!=null?t:!1,controlGroup:(i=(r=a(this,g).manifest)==null?void 0:r.rollForControlGroup())!=null?i:!1}};import Ce from"mitt";function ee({name:e,context:t,variations:r,take:i=1,onLogMessage:n}){var s,o,u;n==null||n(["info",300,"GROUP",{name:e,take:i}]);try{let c=(s=t.storage.data.controlGroup)!=null?s:!1,l=[],f=!1,p=t.scores;for(let v of r){if(l.length===i)break;if(!((o=v.pz)!=null&&o.crit.length)){n==null||n(["info",301,"GROUP",{id:v.id,op:(u=v.pz)==null?void 0:u.op}]),n==null||n(["info",302,{matched:!0,description:"default variation"}]),n==null||n(["info",303,!0]),n==null||n(["info",301,"ENDGROUP"]),l.push(v);continue}c||re(v.id,v.pz,p,n)&&(f=!0,l.push(v))}return{personalized:f,variations:l}}finally{n==null||n(["info",300,"ENDGROUP"])}}function re(e,t,r,i){i==null||i(["info",301,"GROUP",{id:e,op:t==null?void 0:t.op}]);let n;try{t!=null&&t.crit?!t.op||t.op==="&"?n=t.crit.every(s=>ie(s,r,i)):n=t.crit.some(s=>ie(s,r,i)):(i==null||i(["info",302,{matched:!0,description:"default variation"}]),n=!0),i==null||i(["info",303,n])}finally{i==null||i(["info",301,"ENDGROUP"])}return n}function ie(e,t,r){var u,c;let{op:i,l:n}=e,s=(u=t[n])!=null?u:0;if(i==="+"){let l=Math.max(...Object.values(t))===s&&s>0;return r==null||r(["info",302,{matched:l,description:`${e.l} has the highest score`}]),l}else if(i==="-"){let l=Math.min(...Object.values(t))===s&&s>0;return r==null||r(["info",302,{matched:l,description:`${e.l} has the lowest non-zero score`}]),l}let o=parseInt(e.rDim?t[e.rDim]:e.r,10);if(isNaN(o))return r==null||r(["info",302,{matched:!1,description:`${(c=e.rDim)!=null?c:e.r} has no score value`}]),!1;if(i===">"){let l=s>o;return _(r,l,e,s,o),l}else if(i===">="){let l=s>=o;return _(r,l,e,s,o),l}else if(i==="<"){let l=s<o;return _(r,l,e,s,o),l}else if(i==="<="){let l=s<=o;return _(r,l,e,s,o),l}else if(i==="="){let l=s===o;return _(r,l,e,s,o),l}else if(i==="!="){let l=s!==o;return _(r,l,e,s,o),l}else throw new Error(`Unknown op: ${i}`)}function _(e,t,r,i,n){e==null||e(["info",302,{matched:t,description:`${r.l}[${i}] ${r.op} ${r.rDim?`${r.rDim}[${n}]`:r.r}`}])}var De=e=>{let{values:t,total:r,missingDistribution:i}=e.reduce((n,s)=>(s.testDistribution?n.total+=s.testDistribution:++n.missingDistribution,n.values.push(s.testDistribution),n),{values:[],total:0,missingDistribution:0});if(r>100)throw new Error(`Total distribution ${r} is over the maximum 100.`);if(r<100){let s=(100-r)/i;t.forEach((o,u)=>{typeof o=="undefined"&&(t[u]=s)})}return t},bt=({name:e,context:t,variations:r,onLogMessage:i})=>{i==null||i(["info",400,"GROUP",e]);try{let n,s=t.getTestVariantId(e);if(s===null)return i==null||i(["error",401,e]),{result:void 0,variantAssigned:!1};if(s&&(n=r.find(o=>o.id===s),n||i==null||i(["warn",402,{missingVariant:s,variants:r.map(o=>o.id)}])),!n){let o=De(r),u=Math.floor(Math.random()*100),c=0;n=r.find((l,f)=>{let p=o[f];if(u>c&&u<=c+p)return l;c+=p}),n&&(i==null||i(["info",403,n.id]),t.setTestVariantId(e,n.id))}return n&&(i==null||i(["info",404,n.id])),{result:n,variantAssigned:!s}}finally{i==null||i(["info",400,"ENDGROUP"])}};import{dequal as ne}from"dequal/lite";var C,w,T,Y,h,j,lt,oe=class{constructor(t){d(this,j);y(this,"manifest");d(this,C,void 0);d(this,w,{});d(this,T,void 0);d(this,Y,{});d(this,h,Ce());y(this,"events",{on:a(this,h).on,off:a(this,h).off});y(this,"storage");var n,s;let{manifest:r,...i}=t;m(this,T,{}),(n=t.plugins)==null||n.forEach(o=>{!o.logDrain||a(this,h).on("log",o.logDrain)}),a(this,h).emit("log",["info",1,"GROUP"]);try{this.manifest=new L({onLogMessage:o=>a(this,h).emit("log",o),manifest:r,evaluator:new G({CK:$t,QS:Gt,QK:zt,PVC:mt,EVT:It,PV:qt})}),this.storage=new st({...i,manifest:this.manifest,onServerTransitionReceived:o=>{m(this,C,o),o.ssv&&(m(this,w,o.ssv),a(this,h).emit("log",["debug",130,o.ssv]))},onLogMessage:o=>a(this,h).emit("log",o)}),this.storage.events.on("scoresUpdated",S(this,j,lt).bind(this)),a(this,C)||S(this,j,lt).call(this,this.storage.data),this.storage.events.on("quirksUpdated",o=>{let u=this.manifest.computeSignals({scores:a(this,w),state:a(this,T),previousState:a(this,T),visitor:this.storage.data});this.storage.updateData(u),a(this,h).emit("quirksUpdated",o.quirks),a(this,h).emit("log",["info",4,o.quirks])}),(s=t.plugins)==null||s.forEach(o=>{!o.init||o.init(this)})}finally{a(this,h).emit("log",["info",1,"ENDGROUP"])}}get scores(){return a(this,w)}get quirks(){var t,r;return(r=(t=a(this,C))==null?void 0:t.quirks)!=null?r:this.storage.data.quirks}async update(t){var i,n,s;let r=[];(i=a(this,C))!=null&&i.quirks&&(t={...t,quirks:{...a(this,C).quirks,...t.quirks||{}}}),(n=a(this,C))!=null&&n.tests&&r.push(...Object.entries(a(this,C).tests).map(([o,u])=>({type:"settest",data:{test:o,variant:u}})));try{a(this,h).emit("log",["info",2,"GROUP",{...t,url:(s=t.url)==null?void 0:s.toString()}]),t.quirks&&r.push(...Object.entries(t.quirks).map(([o,u])=>({type:"setquirk",data:{key:o,value:u}}))),t.enrichments&&t.enrichments.forEach(o=>{let u=tt(o.cat,o.key);this.manifest.getDimensionByKey(u)?r.push({type:"modscore",data:{dimension:u,delta:o.str}}):a(this,h).emit("log",["warn",5,o])}),r.push(...this.manifest.computeSignals({state:t,previousState:a(this,T),visitor:this.storage.data,scores:a(this,w)})),m(this,T,{...a(this,T),...t}),await this.storage.updateData(r),a(this,C)&&(S(this,j,lt).call(this,this.storage.data),m(this,C,void 0),a(this,h).emit("log",["debug",131]))}finally{a(this,h).emit("log",["info",2,"ENDGROUP"])}}getTestVariantId(t){var i;let r=this.manifest.getTest(t);return r?(i=r.wv)!=null?i:this.storage.data.tests[t]:(a(this,h).emit("log",["warn",401,t]),null)}setTestVariantId(t,r){this.storage.updateData([{type:"settest",data:{test:t,variant:r}}])}log(...t){a(this,h).emit("log",t)}test(t){var i,n;let r=bt({...t,context:this,onLogMessage:s=>a(this,h).emit("log",s)});return a(this,h).emit("testResult",{name:t.name,variantId:(n=(i=r.result)==null?void 0:i.id)!=null?n:void 0,variantAssigned:r.variantAssigned}),r}personalize(t){let r=ee({...t,context:this,onLogMessage:s=>a(this,h).emit("log",s)}),i=a(this,Y)[t.name],n={name:t.name,variantIds:r.variations.map(s=>{var o;return(o=s.id)!=null?o:"Unknown"}),control:this.storage.data.controlGroup,changed:!0};return i&&ne(n.variantIds,i)&&(n.changed=!1),a(this,h).emit("personalizationResult",n),a(this,Y)[t.name]=n.variantIds,r}async forget(t){m(this,T,{}),await this.storage.delete(t)}};C=new WeakMap,w=new WeakMap,T=new WeakMap,Y=new WeakMap,h=new WeakMap,j=new WeakSet,lt=function(t){var n;let r={...t.scores};for(let s in t.sessionScores)r[s]=((n=r[s])!=null?n:0)+t.sessionScores[s];r=this.manifest.computeAggregateDimensions(r),!ne(r,a(this,w))&&(m(this,w,r),a(this,h).emit("scoresUpdated",r),a(this,h).emit("log",["info",3,r]))};import xe from"rfdc";function ct(e,t){if(e==="none")return!1;switch(t){case"debug":return e==="debug";case"info":return e==="info"||e==="debug";case"warn":return e==="warn"||e==="info"||e==="debug";case"error":return e==="debug"||"info";default:return!1}}var be=xe();function Ve(e){return([t,...r])=>{if(!ct(e,t))return;let[i,...n]=r;console[t](`\u{1F94B} [${t}] Uniform event ID ${i}
`,...n.map(be))}}function fi(e){return{logDrain:Ve(e)}}var se={1:()=>["context","initializing Uniform Context"],2:e=>["context","received update()",e],3:e=>["context","new score vector",e],4:e=>["context","updated quirks",e],5:e=>["context","ignored enrichment update for unknown enrichment category",e.cat],101:e=>["storage","received update commands",e],102:e=>["storage","data was updated",e],103:e=>["storage",`deleting visitor data ${e?"from all devices":"from this device"}`],104:e=>["context",e?"Visitor assigned to personalization control group":"Visitor assigned to personalization experiment group"],110:({dim:e,cap:t,score:r})=>["storage",`${e} score ${r} exceeded cap ${t}. Rounded down.`],120:()=>["storage","visitor data expired and was cleared"],130:e=>["storage","server to client transition score data was loaded; it will persist until the next update event occurs",e],131:()=>["storage","server to client transition data was discarded"],140:e=>["storage",`score decay was applied: ${e}`],200:()=>["signals","evaluating signals"],201:e=>["signals",`evaluating signal ${e.id} (${e.dur})`],202:e=>["signals",e.op==="|"?"OR":"AND"],203:({criteria:e,result:t,explanation:r})=>["signals",`${e.type}: ${r} is ${t.result} [${t.changed?"CHANGED":"unchanged"}]`],204:e=>["signals",`group result: ${e.result} [${e.changed?"CHANGED":"unchanged"}]`],300:e=>["personalization",`executing personalization '${e.name}'`],301:({id:e,op:t})=>["personalization",`testing variation ${e} (${t==="|"?"OR":"AND"})`],302:({matched:e,description:t})=>["personalization",`${t} is ${e}`],303:e=>["personalization",e?"selected variation":"did not select variation"],400:e=>["testing",`executing A/B test '${e}'`],401:e=>["testing",`${e} is not registered in the manifest; it will not be run.`],402:({missingVariant:e,variants:t})=>["testing",`test variation '${e}' previously assigned to the visitor for this test no longer exists as a variant. It will be removed. This may indicate changing test variations after publishing a test, which will make results invalid. Known variants: ${t.join(", ")}`],403:e=>["testing",`assigned new test variant '${e}'`],404:e=>["testing",`displaying variation '${e}'`],700:()=>["gtag","gtag is not defined, skipping analytics event emission. Ensure you have added the gtag script to your page."],701:()=>["gtag","enabled gtag event signal redirection"]};import Ee from"rfdc";var Te=Ee();function ke(e,t){let r=typeof document=="undefined",{enableOnServer:i=!1}=t!=null?t:{};return([n,...s])=>{if(!ct(e,n)||r&&!i)return;let[o,...u]=s,c=console[n];if(u[0]==="GROUP"&&(u.shift(),c=console.groupCollapsed),u[0]==="ENDGROUP"){console.groupEnd();return}let l=se[o],f="";switch(n){case"debug":f="\u{1F41E}";break;case"info":f="\u{1F4AC}";break;case"warn":f="\u26A0\uFE0F";break;case"error":f="\u{1F4A5}";break}let p=f;if(!l){c(`${p} unknown event ID ${o}. Log messages data may be older than Uniform Context package.`,...u);return}let[v,D,...X]=l(...u);c(`${p}[${v}] ${D}
`,...X.map(Te))}}function Si(e,t){return{logDrain:ke(e,t)}}var Pe=(u=>(u.ListStart="nesi-list-start",u.ListEnd="nesi-list-end",u.ListItem="nesi-list-item-html",u.ListItemSettings="nesi-list-item-settings",u.TestStart="nesi-test-start",u.TestEnd="nesi-test-end",u.Unknown="unknown",u))(Pe||{}),Di="nesitag";var Vt=typeof top!="undefined";function xi(){return{logDrain:e=>{!Vt||top==null||top.postMessage({type:"uniform:context:log",message:e},window.location.origin)},init:e=>{let t=[],r=[],i=()=>{!Vt||top==null||top.postMessage({type:"uniform:context:data",data:{scores:e.scores,data:e.storage.data,manifest:e.manifest.data,personalizations:t,tests:r}},window.location.origin)},n=o=>{!o.changed||(t.push(o),i())},s=o=>{!o.variantAssigned||(r.push(o),i())};if(Vt){window.__UNIFORM_DEVTOOLS_CONTEXT_INSTANCE__=e;try{top==null||top.addEventListener("message",async o=>{if(!o.data)return;let u=o.data;await we(u,e)})}catch(o){console.warn("Unable to initialize Uniform Context DevTools because it is in a cross-domain iframe.",o)}top==null||top.postMessage({type:"uniform:context:hello",uiVersion:2},window.location.origin),i()}return e.events.on("personalizationResult",n),e.events.on("testResult",s),e.events.on("scoresUpdated",i),e.storage.events.on("*",i),()=>{e.events.off("scoresUpdated",i),e.storage.events.off("*",i),e.events.off("personalizationResult",n),e.events.off("testResult",s)}}}}async function we(e,t){e.type==="uniform-in:context:update"&&e.newData&&await t.update(e.newData),e.type==="uniform-in:context:commands"&&e.commands&&Array.isArray(e.commands)&&await t.storage.updateData(e.commands),e.type==="uniform-in:context:forget"&&await t.forget(!1)}function Vi(e){return`${e.apiKey}|${e.projectId}${e.apiHost?`|${e.apiHost}`:""}`}function Ei(e){let[t,r,i]=e.split("|");if(!t.startsWith("uf"))throw new Error("Invalid API key");if(!/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})$/i.test(r))throw new Error("Invalid project ID");return{apiKey:t,projectId:r,apiHost:i||"https://uniform.app"}}export{oe as Context,Ft as CookieTransitionDataStore,Di as EdgeNodeTagName,Yt as EdgeTransitionDataStore,G as GroupCriteriaEvaluator,L as ManifestInstance,pe as SERVER_STATE_ID,Pe as ScriptType,I as TransitionDataStore,me as UNIFORM_DEFAULT_COOKIE_NAME,st as VisitorDataStore,wt as computeAggregateDimensions,$t as cookieEvaluator,Ve as createConsoleLogDrain,ke as createDebugConsoleLogDrain,kr as createLinearDecay,qt as currentPageEvaluator,et as emptyVisitorData,fi as enableConsoleLogDrain,xi as enableContextDevTools,Si as enableDebugConsoleLogDrain,re as evaluateVariantMatch,It as eventEvaluator,O as explainStringMatch,ft as explainStringMatchCriteria,tt as getEnrichmentVectorKey,V as isStringMatch,pt as pageViewCountDimension,mt as pageViewCountEvaluator,Ei as parseQuickConnect,ee as personalizeVariations,Gt as queryStringEvaluator,zt as quirkEvaluator,Vi as serializeQuickConnect,bt as testVariations};

@@ -1,3 +0,3 @@

var be=Object.create;var F=Object.defineProperty;var Ve=Object.getOwnPropertyDescriptor;var Ee=Object.getOwnPropertyNames;var Te=Object.getPrototypeOf,ke=Object.prototype.hasOwnProperty;var Pe=(e,t,i)=>t in e?F(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var we=(e,t)=>{for(var i in t)F(e,i,{get:t[i],enumerable:!0})},Ft=(e,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Ee(t))!ke.call(e,n)&&n!==i&&F(e,n,{get:()=>t[n],enumerable:!(r=Ve(t,n))||r.enumerable});return e};var $=(e,t,i)=>(i=e!=null?be(Te(e)):{},Ft(t||!e||!e.__esModule?F(i,"default",{value:e,enumerable:!0}):i,e)),Re=e=>Ft(F({},"__esModule",{value:!0}),e);var y=(e,t,i)=>(Pe(e,typeof t!="symbol"?t+"":t,i),i),St=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)};var a=(e,t,i)=>(St(e,t,"read from private field"),i?i.call(e):t.get(e)),d=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},m=(e,t,i,r)=>(St(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i);var S=(e,t,i)=>(St(e,t,"access private method"),i);var Be={};we(Be,{Context:()=>Gt,CookieTransitionDataStore:()=>Rt,EdgeNodeTagName:()=>je,EdgeTransitionDataStore:()=>Ot,GroupCriteriaEvaluator:()=>z,ManifestInstance:()=>B,SERVER_STATE_ID:()=>Mt,ScriptType:()=>xe,TransitionDataStore:()=>N,UNIFORM_DEFAULT_COOKIE_NAME:()=>ne,VisitorDataStore:()=>L,computeAggregateDimensions:()=>yt,cookieEvaluator:()=>Dt,createConsoleLogDrain:()=>Se,createDebugConsoleLogDrain:()=>Ce,createLinearDecay:()=>ze,currentPageEvaluator:()=>Vt,emptyVisitorData:()=>X,enableConsoleLogDrain:()=>Ie,enableContextDevTools:()=>Qe,enableDebugConsoleLogDrain:()=>_e,evaluateVariantMatch:()=>Nt,eventEvaluator:()=>bt,explainStringMatch:()=>k,explainStringMatchCriteria:()=>st,getEnrichmentVectorKey:()=>W,isStringMatch:()=>x,pageViewCountDimension:()=>at,pageViewCountEvaluator:()=>ut,parseQuickConnect:()=>He,personalizeVariations:()=>zt,queryStringEvaluator:()=>Ct,quirkEvaluator:()=>xt,serializeQuickConnect:()=>Ke,testVariations:()=>ht});module.exports=Re(Be);function yt(e,t){let i={...e};for(let r in t){let n=Kt(e,r,t,new Set([r]));n!==0&&(i[r]=n)}return i}function Kt(e,t,i,r){var s;let n=0;for(let o of i[t].inputs){let u=(s=e[o.dim])!=null?s:0;if(!u&&i[o.dim]){if(r.has(o.dim))continue;let l=new Set(r);l.add(o.dim),u=Kt(e,o.dim,i,l)}if(u!==0)if(o.sign==="c"){n=0;break}else o.sign==="-"?n-=u:n+=u}return n}var nt="_";var K,H,ot=class{constructor(t,i,r){d(this,K,void 0);d(this,H,void 0);y(this,"signal");this.signal=t,m(this,K,i),m(this,H,r)}computeSignal(t,i){if(t.scores[this.signal.id]>=this.signal.cap&&this.signal.dur!=="t")return;let n=a(this,K).evaluate(t,this.signal.crit,i,this.signal,a(this,H)),s=this.signal.dur==="s"||this.signal.dur==="t"?"modscoreS":"modscore";if(!!n.changed){if(n.result)i.push({type:s,data:{dimension:this.signal.id,delta:this.signal.str}});else if(this.signal.dur==="t"){let o=t.visitor.sessionScores[this.signal.id];o&&i.push({type:s,data:{dimension:this.signal.id,delta:-o}})}}}};K=new WeakMap,H=new WeakMap;var V,J,O,B=class{constructor({manifest:t,evaluator:i=new z({}),onLogMessage:r=()=>{}}){y(this,"data");d(this,V,void 0);d(this,J,void 0);d(this,O,void 0);var n,s,o;m(this,V,(n=t.project)!=null?n:{}),this.data=t,m(this,J,Object.entries((o=(s=a(this,V).pz)==null?void 0:s.sig)!=null?o:[]).map(([u,c])=>new ot({...c,id:u},i,r))),m(this,O,r)}rollForControlGroup(){var t,i;return Math.random()<((i=(t=a(this,V).pz)==null?void 0:t.control)!=null?i:0)}getTest(t){var i;return(i=a(this,V).test)==null?void 0:i[t]}computeSignals(t){let i=[];a(this,O).call(this,["debug",200,"GROUP"]);try{a(this,J).forEach(r=>{a(this,O).call(this,["debug",201,"GROUP",r.signal]);try{r.computeSignal(t,i)}finally{a(this,O).call(this,["debug",201,"ENDGROUP"])}})}finally{a(this,O).call(this,["debug",200,"ENDGROUP"])}return i}computeAggregateDimensions(t){var i,r;return yt(t,(r=(i=a(this,V).pz)==null?void 0:i.agg)!=null?r:{})}getDimensionByKey(t){var r,n,s,o;let i=t.indexOf(nt);return i<=0?(n=(r=a(this,V).pz)==null?void 0:r.sig)==null?void 0:n[t]:(o=(s=a(this,V).pz)==null?void 0:s.enr)==null?void 0:o[t.substring(0,i)]}};V=new WeakMap,J=new WeakMap,O=new WeakMap;var Jt=require("dequal/lite");function x(e,t){var o,u,c,l,p,f;let i=(o=t==null?void 0:t.op)!=null?o:"=";if(t.op==="*")return e!==null&&typeof e!="undefined";if(t.op==="!*")return e===null||typeof e=="undefined";if(!("rhs"in t))throw new Error(`Match expression is required for match type ${i}`);let r=(u=t.cs)!=null?u:!1,n=(r?e!=null?e:"":Ht(e)).toString(),s=(r?t.rhs:Ht(t.rhs)).toString();switch(i){case"=":return n===s;case"!=":return n!==s;case"~":return(c=n.includes(s))!=null?c:!1;case"!~":return!((l=n.includes(s))==null||l);case"//":return new RegExp(t.rhs.toString(),r?"":"i").test((p=e==null?void 0:e.toString())!=null?p:"");case"!//":return!new RegExp(t.rhs.toString(),r?"":"i").test((f=e==null?void 0:e.toString())!=null?f:"");default:throw new Error(`Unknown match type ${i}.`)}}function k(e,t){return`'${("cs"in t?t.cs:!1)?e:e==null?void 0:e.toString().toUpperCase()}' ${st(t)}`}function st(e){return"rhs"in e?`${e.op} '${e.cs?e.rhs:e.rhs.toString().toUpperCase()}'`:`${e.op==="*"?"exists":"does not exist"}`}function Ht(e){var t,i;return(i=(t=e==null?void 0:e.toString())==null?void 0:t.toUpperCase())!=null?i:""}var Dt=({update:e,criteria:t,onLogMessage:i})=>{var u,c;if(t.type!=="CK")return{result:!1,changed:!1};let r=!(0,Jt.dequal)(Bt(e.state.cookies),Bt((u=e.previousState)==null?void 0:u.cookies)),n=(c=e.state.cookies)==null?void 0:c[t.cookieName],o={result:x(n,t.match),changed:r};return i==null||i(["debug",203,{criteria:t,result:o,explanation:k(n,t.match)}]),o};function Bt(e){if(!e)return;if(!e.ufvd)return e;let{ufvd:t,...i}=e;return i}function Wt(e,t){var r;if(typeof e=="undefined"||e===null)return!1;let i=Number(e);if(isNaN(i))return!1;switch((r=t==null?void 0:t.op)!=null?r:"="){case"=":return i===t.rhs;case"!=":return i!==t.rhs;case">":return i>t.rhs;case"<":return i<t.rhs;default:return console.warn(`Unknown match type ${t.op} is false.`),!1}}function Yt(e,t){return`${e} ${Oe(t)}`}function Oe(e){return`${e.op} ${e.rhs}`}function W(e,t){return`${e}${nt}${t}`}var at=W("$pvc","v"),ut=({update:e,criteria:t,commands:i,onLogMessage:r})=>{var l,p;if(t.type!=="PVC")return{result:!1,changed:!1};let n=Boolean(e.state.url&&(!e.previousState||((l=e.state.url)==null?void 0:l.toString())!==((p=e.previousState.url)==null?void 0:p.toString()))),o=(e.visitor.sessionScores[at]||0)+1,u={result:!1,changed:n},c=i.some(f=>f.type==="modscoreS"&&f.data.dimension===at);return n&&!c&&i.push({type:"modscoreS",data:{dimension:at,delta:1}}),Wt(o,t.match)&&(u.result=!0),r==null||r(["debug",203,{criteria:t,result:u,explanation:Yt(o,t.match)}]),u};ut.alwaysExecute=!0;var Ct=({update:e,criteria:t,onLogMessage:i})=>{var u,c,l,p,f;if(t.type!=="QS")return{result:!1,changed:!1};let r=!e.previousState||((c=(u=e.state.url)==null?void 0:u.searchParams)==null?void 0:c.toString())!==((p=(l=e.previousState.url)==null?void 0:l.searchParams)==null?void 0:p.toString()),n=(f=e.state.url)==null?void 0:f.searchParams.get(t.queryName),o={result:x(n,t.match),changed:r};return i==null||i(["debug",203,{criteria:t,result:o,explanation:k(n,t.match)}]),o};var xt=({update:e,criteria:t,signal:i,onLogMessage:r})=>{var p;if(t.type!=="QK")return{result:!1,changed:!1};if(typeof document=="undefined"&&i.dur==="t"&&e.scores[i.id]>0)return{result:!0,changed:!1};let n=e.visitor.quirks[t.key],s=(p=e.state.quirks)==null?void 0:p[t.key],o=s!=null?s:n,u=Boolean(s&&n!==s),l={result:x(o,t.match),changed:u};return r==null||r(["debug",203,{criteria:t,result:l,explanation:k(o,t.match)}]),l};var bt=({update:e,criteria:t,onLogMessage:i})=>{var s,o,u;if(t.type!=="EVT")return{result:!1,changed:!1};let r=(o=(s=e.state.events)==null?void 0:s.some(c=>x(c.event,t.event)))!=null?o:!1,n={result:r,changed:r};return i==null||i(["debug",203,{criteria:t,result:n,explanation:`'${(u=e.state.events)==null?void 0:u.join("', '")}' ${st(t.event)}`}]),n};var Vt=({update:e,criteria:t,onLogMessage:i})=>{var u,c,l;if(t.type!=="PV")return{result:!1,changed:!1};let r=(u=e.state.url)==null?void 0:u.pathname,n=!e.previousState||(r==null?void 0:r.toString())!==((l=(c=e.previousState.url)==null?void 0:c.pathname)==null?void 0:l.toString()),o={result:x(r,t.path),changed:n};return i==null||i(["debug",203,{criteria:t,result:o,explanation:k(r,t.path)}]),o};var Y,z=class{constructor(t){d(this,Y,void 0);m(this,Y,t)}evaluate(t,i,r,n,s){let o=i.clauses.length>1;o&&(s==null||s(["debug",202,"GROUP",i]));try{let u=!(i.op==="&"||!i.op),c=null,l=!1;for(let f of i.clauses){let v;if(f.type==="G")v=this.evaluate(t,f,r,n,s);else{let D=a(this,Y)[f.type];if(c&&!D.alwaysExecute)continue;if(!D)throw new Error(`${f.type} signal criteria not registered`);v=D({update:t,criteria:f,commands:r,signal:n,onLogMessage:s})}v.changed&&(l=!0),!c&&v.result===u&&(c={result:u,changed:l})}let p=c!=null?c:{result:!u,changed:l};return o&&(s==null||s(["debug",204,p])),p}finally{o&&(s==null||s(["debug",202,"ENDGROUP"]))}}};Y=new WeakMap;var X=()=>({quirks:{},scores:{},sessionScores:{},tests:{},consent:!1,controlGroup:!1});var Xt=$(require("mitt")),Zt=require("dequal/lite"),Mt="__UNIFORM_DATA__",U,q,N=class{constructor({initialData:t}){d(this,U,void 0);d(this,q,(0,Xt.default)());y(this,"events",{on:a(this,q).on,off:a(this,q).off});t&&m(this,U,t)}get data(){return a(this,U)}updateData(t,i){return m(this,U,i),this.handleUpdateData(t,i)}async delete(t){m(this,U,void 0),await this.handleDelete(t)}signalAsyncDataUpdate(t){(0,Zt.dequal)(this.data,t)||(m(this,U,t),a(this,q).emit("dataUpdatedAsync",t))}getClientTransitionState(){if(typeof document=="undefined")return;let t=document.getElementById(Mt);return t!=null&&t.textContent?JSON.parse(t.textContent):void 0}};U=new WeakMap,q=new WeakMap;var Et="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Lt=Et.split(""),te=new Array(123);for(let e=0;e<Et.length;e++)te[Et.charCodeAt(e)]=e;var Tt=e=>{if(e<0)return`-${Tt(-e)}`;let t=e>>>0,i=e/4294967296>>>0,r="";for(;i>0;)r=Lt[63&t]+r,t>>>=6,t|=(63&i)<<26,i>>>=6;let n="";do n=Lt[63&t]+n,t>>>=6;while(t>0);return n+r},ee=e=>{let t=0,i=e.charAt(0)==="-"?1:0;for(let r=i;r<e.length;r++)t=t*64+te[e.charCodeAt(r)];return i?-t:t};var lt=$(require("js-cookie")),kt=typeof document=="undefined",ne="ufvd",A,Z,Rt=class extends N{constructor({serverCookieValue:i,cookieName:r=ne,cookieAttributes:n={sameSite:"lax"}}){super({initialData:kt?Ue(i):void 0});d(this,A,void 0);d(this,Z,void 0);m(this,A,r),m(this,Z,n)}handleDelete(){return kt||lt.default.remove(a(this,A)),Promise.resolve()}async handleUpdateData(i,r){kt||(r.consent?lt.default.set(a(this,A),$e(r),a(this,Z)):lt.default.remove(a(this,A)))}};A=new WeakMap,Z=new WeakMap;var oe="~",se="!",ae="-";function Ue(e){if(!e)return;let t=e.split(oe);if(t.length>3)return;let[i,r,n]=t;return{consent:!0,sessionScores:ie(Pt(r)),scores:ie(Pt(n)),tests:Pt(i)}}function Pt(e){return e.split(se).map(i=>i.split(ae)).reduce((i,r)=>(r.length!==2||(i[r[0]]=r[1]),i),{})}function ie(e){return Object.entries(e).reduce((t,[i,r])=>(t[i]=ee(r),t),{})}function $e(e){return[wt(e.tests),wt(re(e.sessionScores)),wt(re(e.scores))].join(oe)}function re(e){return Object.entries(e).reduce((t,[i,r])=>(t[i]=Tt(r),t),{})}function wt(e){return Object.entries(e).map(t=>t.join(ae)).join(se)}var ct,ue,Ot=class extends N{constructor({serverCookieValue:i,visitorIdCookieName:r="ufvi",...n}){super(n);d(this,ct);n.initialData||S(this,ct,ue).call(this).catch(s=>{console.error(s)})}handleDelete(i){throw new Error("Method not implemented.")}async handleUpdateData(i){let r=await new Promise(n=>{setTimeout(()=>{n(void 0)},2e3)});r&&this.signalAsyncDataUpdate(r)}};ct=new WeakSet,ue=async function(){let i=await new Promise(r=>{setTimeout(()=>{r(void 0)},2e3)});i&&this.signalAsyncDataUpdate(i)};function ze(e){let{gracePeriod:t=864e5,decayRate:i=1/30,decayCap:r=.95}=e!=null?e:{};return function({now:s,lastUpd:o,scores:u,sessionScores:c,onLogMessage:l}){if(typeof o!="number")return!1;let f=s-o-t;if(f<=0)return!1;let v=f/864e5,D=1-Math.min(r,v*i);return D<=0?!1:(le(u,D),le(c,D),l==null||l(["info",140,`linear decay factor ${D.toPrecision(6)}`]),!0)}}function le(e,t){for(let i in e)i.startsWith("$")||(e[i]*=t)}var pe=$(require("mitt")),M=require("dequal/lite");var dt=class{constructor(){y(this,"inMemoryFallback",{});y(this,"hasLocalStorageObject",typeof localStorage!="undefined")}get(t){let i=this.inMemoryFallback[t];if(!this.hasLocalStorageObject||i)return i;try{let r=localStorage.getItem(t);return r?JSON.parse(r):void 0}catch(r){return i}}set(t,i,r){if(this.inMemoryFallback[t]=i,!(!this.hasLocalStorageObject||!r))try{localStorage.setItem(t,JSON.stringify(i))}catch(n){console.warn(n)}}delete(t,i){i||delete this.inMemoryFallback[t];try{localStorage.removeItem(t)}catch(r){}}};var ce=$(require("rfdc"));var Ne=(0,ce.default)();function de(e,t,i){let r=t?Ne(t):X();return e.forEach(n=>{var s,o;switch(n.type){case"consent":r.consent=n.data;break;case"setquirk":r.quirks[n.data.key]=n.data.value;break;case"settest":r.tests[n.data.test]=n.data.variant;break;case"modscore":if(i)break;let u=Number(n.data.delta);if(isNaN(u))throw new Error("Non-number delta received");let c=(s=r.scores[n.data.dimension])!=null?s:0;r.scores[n.data.dimension]=c+u;break;case"modscoreS":if(i)break;let l=Number(n.data.delta);if(isNaN(l))throw new Error("Non-number delta received");let p=(o=r.sessionScores[n.data.dimension])!=null?o:0;r.sessionScores[n.data.dimension]=p+l;break;case"identify":break;case"setcontrol":r.controlGroup=n.data;break;default:throw new Error("Unknown command")}}),r}var pt="ufvisitor",E,I,_,g,b,P,w,G,ft,fe,mt,me,tt,Ut,et,$t,L=class{constructor(t){d(this,b);d(this,w);d(this,ft);d(this,mt);d(this,tt);d(this,et);d(this,E,(0,pe.default)());d(this,I,new dt);d(this,_,void 0);d(this,g,void 0);y(this,"events",{on:a(this,E).on,off:a(this,E).off});if(m(this,g,t),a(this,b,P)||S(this,w,G).call(this,S(this,et,$t).call(this),!0),t.transitionStore){let i=t.transitionStore.getClientTransitionState();i&&t.onServerTransitionReceived&&t.onServerTransitionReceived(i),t.transitionStore.events.on("dataUpdatedAsync",n=>{S(this,w,G).call(this,{...a(this,b,P).visitorData,...n})});let r=t.transitionStore.data;r&&S(this,w,G).call(this,{...a(this,b,P).visitorData,...r},!0)}}get data(){var i,r;let t=a(this,b,P);if(S(this,mt,me).call(this,t)){let{sessionScores:n,...s}=t.visitorData;return S(this,w,G).call(this,{...s,sessionScores:{}}),(r=(i=a(this,g)).onLogMessage)==null||r.call(i,["info",120]),a(this,b,P).visitorData}return t.visitorData}get decayEnabled(){return!!a(this,g).decay}async updateData(t){var r,n,s,o;if(t.length===0)return;(n=(r=a(this,g)).onLogMessage)==null||n.call(r,["debug",101,t]);let i=de(t,this.data,(s=a(this,b,P))==null?void 0:s.visitorData.controlGroup);t.some(u=>u.type==="consent"&&!u.data)&&a(this,I).delete(pt,!0),S(this,w,G).call(this,i),await((o=a(this,g).transitionStore)==null?void 0:o.updateData(t,a(this,b,P).visitorData))}async delete(t){var i,r,n,s,o;(r=(i=a(this,g)).onLogMessage)==null||r.call(i,["info",103,"GROUP",t]);try{a(this,I).delete(pt,!1),await((n=a(this,g).transitionStore)==null?void 0:n.delete(t)),S(this,w,G).call(this,S(this,et,$t).call(this))}finally{(o=(s=a(this,g)).onLogMessage)==null||o.call(s,["info",103,"ENDGROUP"])}}};E=new WeakMap,I=new WeakMap,_=new WeakMap,g=new WeakMap,b=new WeakSet,P=function(){return a(this,I).get(pt)},w=new WeakSet,G=function(t,i=!1){var p,f,v,D,rt,qt,_t,jt,Qt;let r=a(this,b,P),n=Date.now();t.controlGroup?(t.scores={},t.sessionScores={}):(S(this,tt,Ut).call(this,t.scores),S(this,tt,Ut).call(this,t.sessionScores),(f=(p=a(this,g)).decay)==null||f.call(p,{now:n,lastUpd:r==null?void 0:r.updated,scores:t.scores,sessionScores:t.sessionScores,onLogMessage:a(this,g).onLogMessage}));let s=!(0,M.dequal)(r==null?void 0:r.visitorData.scores,t.scores),o=!(0,M.dequal)(r==null?void 0:r.visitorData.sessionScores,t.sessionScores),u=!(0,M.dequal)(r==null?void 0:r.visitorData.quirks,t.quirks),c=!(0,M.dequal)(r==null?void 0:r.visitorData.tests,t.tests),l={updated:n,visitorData:t};S(this,ft,fe).call(this),a(this,I).set(pt,l,!!t.consent),(D=(v=a(this,g)).onLogMessage)==null||D.call(v,["debug",102,t]),i||((s||o)&&a(this,E).emit("scoresUpdated",t),u&&a(this,E).emit("quirksUpdated",t),c&&a(this,E).emit("testsUpdated",t),((rt=r==null?void 0:r.visitorData)==null?void 0:rt.consent)!==t.consent&&a(this,E).emit("consentUpdated",t),((qt=r==null?void 0:r.visitorData)==null?void 0:qt.controlGroup)!==t.controlGroup&&(a(this,E).emit("controlGroupUpdated",t),(Qt=(jt=a(this,g)).onLogMessage)==null||Qt.call(jt,["debug",104,(_t=t.controlGroup)!=null?_t:!1])))},ft=new WeakSet,fe=function(){typeof document=="undefined"||!a(this,g).visitLifespan||(a(this,_)&&window.clearTimeout(a(this,_)),m(this,_,window.setTimeout(()=>{this.data},a(this,g).visitLifespan+50)))},mt=new WeakSet,me=function(t){let i=a(this,g).visitLifespan;return i?t.updated+i<Date.now():!1},tt=new WeakSet,Ut=function(t){var i,r;if(!!a(this,g).manifest)for(let n in t){let s=t[n],o=a(this,g).manifest.getDimensionByKey(n);!o||s>o.cap&&((r=(i=a(this,g)).onLogMessage)==null||r.call(i,["debug",110,{dim:n,score:s,cap:o.cap}]),t[n]=o.cap)}},et=new WeakSet,$t=function(){var t,i,r;return{...X(),consent:(t=a(this,g).defaultConsent)!=null?t:!1,controlGroup:(r=(i=a(this,g).manifest)==null?void 0:i.rollForControlGroup())!=null?r:!1}};var ge=$(require("mitt"));function zt({name:e,context:t,variations:i,take:r=1,onLogMessage:n}){var s,o,u;console.log("personalizeVariations called"),n==null||n(["info",300,"GROUP",{name:e,take:r}]);try{let c=(s=t.storage.data.controlGroup)!=null?s:!1,l=[],p=!1,f=t.scores;console.log("personalizeVariations context",t),console.log("personalizeVariations scores",f);for(let v of i){if(l.length===r)break;if(!((o=v.pz)!=null&&o.crit.length)){n==null||n(["info",301,"GROUP",{id:v.id,op:(u=v.pz)==null?void 0:u.op}]),n==null||n(["info",302,{matched:!0,description:"default variation"}]),n==null||n(["info",303,!0]),n==null||n(["info",301,"ENDGROUP"]),l.push(v);continue}c||Nt(v.id,v.pz,f,n)&&(p=!0,l.push(v))}return console.log("personalizeVariations personalized",p),console.log("personalizeVariations results",l),{personalized:p,variations:l}}finally{n==null||n(["info",300,"ENDGROUP"])}}function Nt(e,t,i,r){r==null||r(["info",301,"GROUP",{id:e,op:t==null?void 0:t.op}]);let n;try{t!=null&&t.crit?!t.op||t.op==="&"?n=t.crit.every(s=>he(s,i,r)):n=t.crit.some(s=>he(s,i,r)):(r==null||r(["info",302,{matched:!0,description:"default variation"}]),n=!0),r==null||r(["info",303,n])}finally{r==null||r(["info",301,"ENDGROUP"])}return n}function he(e,t,i){var u,c;console.log("evaluateDimensionMatch crit",e),console.log("evaluateDimensionMatch vec",t);let{op:r,l:n}=e,s=(u=t[n])!=null?u:0;if(r==="+"){let l=Math.max(...Object.values(t))===s&&s>0;return i==null||i(["info",302,{matched:l,description:`${e.l} has the highest score`}]),l}else if(r==="-"){let l=Math.min(...Object.values(t))===s&&s>0;return i==null||i(["info",302,{matched:l,description:`${e.l} has the lowest non-zero score`}]),l}let o=parseInt(e.rDim?t[e.rDim]:e.r,10);if(isNaN(o))return i==null||i(["info",302,{matched:!1,description:`${(c=e.rDim)!=null?c:e.r} has no score value`}]),!1;if(r===">"){let l=s>o;return j(i,l,e,s,o),l}else if(r===">="){let l=s>=o;return j(i,l,e,s,o),l}else if(r==="<"){let l=s<o;return j(i,l,e,s,o),l}else if(r==="<="){let l=s<=o;return j(i,l,e,s,o),l}else if(r==="="){let l=s===o;return j(i,l,e,s,o),l}else if(r==="!="){let l=s!==o;return j(i,l,e,s,o),l}else throw new Error(`Unknown op: ${r}`)}function j(e,t,i,r,n){console.log("crit",i),console.log("lhsScore",r),e==null||e(["info",302,{matched:t,description:`${i.l}[${r}] ${i.op} ${i.rDim?`${i.rDim}[${n}]`:i.r}`}])}var Ae=e=>{let{values:t,total:i,missingDistribution:r}=e.reduce((n,s)=>(s.testDistribution?n.total+=s.testDistribution:++n.missingDistribution,n.values.push(s.testDistribution),n),{values:[],total:0,missingDistribution:0});if(i>100)throw new Error(`Total distribution ${i} is over the maximum 100.`);if(i<100){let s=(100-i)/r;t.forEach((o,u)=>{typeof o=="undefined"&&(t[u]=s)})}return t},ht=({name:e,context:t,variations:i,onLogMessage:r})=>{r==null||r(["info",400,"GROUP",e]);try{let n,s=t.getTestVariantId(e);if(s===null)return r==null||r(["error",401,e]),{result:void 0,variantAssigned:!1};if(s&&(n=i.find(o=>o.id===s),n||r==null||r(["warn",402,{missingVariant:s,variants:i.map(o=>o.id)}])),!n){let o=Ae(i),u=Math.floor(Math.random()*100),c=0;n=i.find((l,p)=>{let f=o[p];if(u>c&&u<=c+f)return l;c+=f}),n&&(r==null||r(["info",403,n.id]),t.setTestVariantId(e,n.id))}return n&&(r==null||r(["info",404,n.id])),{result:n,variantAssigned:!s}}finally{r==null||r(["info",400,"ENDGROUP"])}};var At=require("dequal/lite"),C,R,T,it,h,Q,gt,Gt=class{constructor(t){d(this,Q);y(this,"manifest");d(this,C,void 0);d(this,R,{});d(this,T,void 0);d(this,it,{});d(this,h,(0,ge.default)());y(this,"events",{on:a(this,h).on,off:a(this,h).off});y(this,"storage");var n,s;let{manifest:i,...r}=t;m(this,T,{}),(n=t.plugins)==null||n.forEach(o=>{!o.logDrain||a(this,h).on("log",o.logDrain)}),a(this,h).emit("log",["info",1,"GROUP"]);try{this.manifest=new B({onLogMessage:o=>a(this,h).emit("log",o),manifest:i,evaluator:new z({CK:Dt,QS:Ct,QK:xt,PVC:ut,EVT:bt,PV:Vt})}),this.storage=new L({...r,manifest:this.manifest,onServerTransitionReceived:o=>{m(this,C,o),o.ssv&&(m(this,R,o.ssv),a(this,h).emit("log",["debug",130,o.ssv]))},onLogMessage:o=>a(this,h).emit("log",o)}),this.storage.events.on("scoresUpdated",S(this,Q,gt).bind(this)),a(this,C)||S(this,Q,gt).call(this,this.storage.data),this.storage.events.on("quirksUpdated",o=>{let u=this.manifest.computeSignals({scores:a(this,R),state:a(this,T),previousState:a(this,T),visitor:this.storage.data});this.storage.updateData(u),a(this,h).emit("quirksUpdated",o.quirks),a(this,h).emit("log",["info",4,o.quirks])}),(s=t.plugins)==null||s.forEach(o=>{!o.init||o.init(this)})}finally{a(this,h).emit("log",["info",1,"ENDGROUP"])}}get scores(){return a(this,R)}get quirks(){var t,i;return(i=(t=a(this,C))==null?void 0:t.quirks)!=null?i:this.storage.data.quirks}async update(t){var r,n,s;let i=[];(r=a(this,C))!=null&&r.quirks&&(t={...t,quirks:{...a(this,C).quirks,...t.quirks||{}}}),(n=a(this,C))!=null&&n.tests&&i.push(...Object.entries(a(this,C).tests).map(([o,u])=>({type:"settest",data:{test:o,variant:u}})));try{a(this,h).emit("log",["info",2,"GROUP",{...t,url:(s=t.url)==null?void 0:s.toString()}]),t.quirks&&i.push(...Object.entries(t.quirks).map(([o,u])=>({type:"setquirk",data:{key:o,value:u}}))),t.enrichments&&t.enrichments.forEach(o=>{let u=W(o.cat,o.key),c=this.manifest.getDimensionByKey(u);console.log("\u2728 Update enrichment"),console.log("dimension",u),console.log("dimData",c),c?i.push({type:"modscore",data:{dimension:u,delta:o.str}}):a(this,h).emit("log",["warn",5,o])}),i.push(...this.manifest.computeSignals({state:t,previousState:a(this,T),visitor:this.storage.data,scores:a(this,R)})),m(this,T,{...a(this,T),...t}),await this.storage.updateData(i),a(this,C)&&(S(this,Q,gt).call(this,this.storage.data),m(this,C,void 0),a(this,h).emit("log",["debug",131]))}finally{a(this,h).emit("log",["info",2,"ENDGROUP"])}}getTestVariantId(t){var r;let i=this.manifest.getTest(t);return i?(r=i.wv)!=null?r:this.storage.data.tests[t]:(a(this,h).emit("log",["warn",401,t]),null)}setTestVariantId(t,i){this.storage.updateData([{type:"settest",data:{test:t,variant:i}}])}log(...t){a(this,h).emit("log",t)}test(t){var r,n;let i=ht({...t,context:this,onLogMessage:s=>a(this,h).emit("log",s)});return a(this,h).emit("testResult",{name:t.name,variantId:(n=(r=i.result)==null?void 0:r.id)!=null?n:void 0,variantAssigned:i.variantAssigned}),i}personalize(t){console.log("personalize called");let i=zt({...t,context:this,onLogMessage:s=>a(this,h).emit("log",s)}),r=a(this,it)[t.name],n={name:t.name,variantIds:i.variations.map(s=>{var o;return(o=s.id)!=null?o:"Unknown"}),control:this.storage.data.controlGroup,changed:!0};return r&&(0,At.dequal)(n.variantIds,r)&&(n.changed=!1),a(this,h).emit("personalizationResult",n),a(this,it)[t.name]=n.variantIds,i}async forget(t){m(this,T,{}),await this.storage.delete(t)}};C=new WeakMap,R=new WeakMap,T=new WeakMap,it=new WeakMap,h=new WeakMap,Q=new WeakSet,gt=function(t){var n;let i={...t.scores};for(let s in t.sessionScores)i[s]=((n=i[s])!=null?n:0)+t.sessionScores[s];i=this.manifest.computeAggregateDimensions(i),!(0,At.dequal)(i,a(this,R))&&(m(this,R,i),a(this,h).emit("scoresUpdated",i),a(this,h).emit("log",["info",3,i]))};var ve=$(require("rfdc"));function vt(e,t){if(e==="none")return!1;switch(t){case"debug":return e==="debug";case"info":return e==="info"||e==="debug";case"warn":return e==="warn"||e==="info"||e==="debug";case"error":return e==="debug"||"info";default:return!1}}var Ge=(0,ve.default)();function Se(e){return([t,...i])=>{if(!vt(e,t))return;let[r,...n]=i;console[t](`\u{1F94B} [${t}] Uniform event ID ${r}
`,...n.map(Ge))}}function Ie(e){return{logDrain:Se(e)}}var ye={1:()=>["context","initializing Uniform Context"],2:e=>["context","received update()",e],3:e=>["context","new score vector",e],4:e=>["context","updated quirks",e],5:e=>["context","ignored enrichment update for unknown enrichment category",e.cat],101:e=>["storage","received update commands",e],102:e=>["storage","data was updated",e],103:e=>["storage",`deleting visitor data ${e?"from all devices":"from this device"}`],104:e=>["context",e?"Visitor assigned to personalization control group":"Visitor assigned to personalization experiment group"],110:({dim:e,cap:t,score:i})=>["storage",`${e} score ${i} exceeded cap ${t}. Rounded down.`],120:()=>["storage","visitor data expired and was cleared"],130:e=>["storage","server to client transition score data was loaded; it will persist until the next update event occurs",e],131:()=>["storage","server to client transition data was discarded"],140:e=>["storage",`score decay was applied: ${e}`],200:()=>["signals","evaluating signals"],201:e=>["signals",`evaluating signal ${e.id} (${e.dur})`],202:e=>["signals",e.op==="|"?"OR":"AND"],203:({criteria:e,result:t,explanation:i})=>["signals",`${e.type}: ${i} is ${t.result} [${t.changed?"CHANGED":"unchanged"}]`],204:e=>["signals",`group result: ${e.result} [${e.changed?"CHANGED":"unchanged"}]`],300:e=>["personalization",`executing personalization '${e.name}'`],301:({id:e,op:t})=>["personalization",`testing variation ${e} (${t==="|"?"OR":"AND"})`],302:({matched:e,description:t})=>["personalization",`${t} is ${e}`],303:e=>["personalization",e?"selected variation":"did not select variation"],400:e=>["testing",`executing A/B test '${e}'`],401:e=>["testing",`${e} is not registered in the manifest; it will not be run.`],402:({missingVariant:e,variants:t})=>["testing",`test variation '${e}' previously assigned to the visitor for this test no longer exists as a variant. It will be removed. This may indicate changing test variations after publishing a test, which will make results invalid. Known variants: ${t.join(", ")}`],403:e=>["testing",`assigned new test variant '${e}'`],404:e=>["testing",`displaying variation '${e}'`],700:()=>["gtag","gtag is not defined, skipping analytics event emission. Ensure you have added the gtag script to your page."],701:()=>["gtag","enabled gtag event signal redirection"]};var De=$(require("rfdc")),qe=(0,De.default)();function Ce(e,t){let i=typeof document=="undefined",{enableOnServer:r=!1}=t!=null?t:{};return([n,...s])=>{if(!vt(e,n)||i&&!r)return;let[o,...u]=s,c=console[n];if(u[0]==="GROUP"&&(u.shift(),c=console.groupCollapsed),u[0]==="ENDGROUP"){console.groupEnd();return}let l=ye[o],p="";switch(n){case"debug":p="\u{1F41E}";break;case"info":p="\u{1F4AC}";break;case"warn":p="\u26A0\uFE0F";break;case"error":p="\u{1F4A5}";break}let f=p;if(!l){c(`${f} unknown event ID ${o}. Log messages data may be older than Uniform Context package.`,...u);return}let[v,D,...rt]=l(...u);c(`${f}[${v}] ${D}
`,...rt.map(qe))}}function _e(e,t){return{logDrain:Ce(e,t)}}var xe=(u=>(u.ListStart="nesi-list-start",u.ListEnd="nesi-list-end",u.ListItem="nesi-list-item-html",u.ListItemSettings="nesi-list-item-settings",u.TestStart="nesi-test-start",u.TestEnd="nesi-test-end",u.Unknown="unknown",u))(xe||{}),je="nesitag";var It=typeof top!="undefined";function Qe(){return{logDrain:e=>{!It||top==null||top.postMessage({type:"uniform:context:log",message:e},window.location.origin)},init:e=>{let t=[],i=[],r=()=>{!It||top==null||top.postMessage({type:"uniform:context:data",data:{scores:e.scores,data:e.storage.data,manifest:e.manifest.data,personalizations:t,tests:i}},window.location.origin)},n=o=>{!o.changed||(t.push(o),r())},s=o=>{!o.variantAssigned||(i.push(o),r())};if(It){window.__UNIFORM_DEVTOOLS_CONTEXT_INSTANCE__=e;try{top==null||top.addEventListener("message",async o=>{if(!o.data)return;let u=o.data;await Fe(u,e)})}catch(o){console.warn("Unable to initialize Uniform Context DevTools because it is in a cross-domain iframe.",o)}top==null||top.postMessage({type:"uniform:context:hello",uiVersion:2},window.location.origin),r()}return e.events.on("personalizationResult",n),e.events.on("testResult",s),e.events.on("scoresUpdated",r),e.storage.events.on("*",r),()=>{e.events.off("scoresUpdated",r),e.storage.events.off("*",r),e.events.off("personalizationResult",n),e.events.off("testResult",s)}}}}async function Fe(e,t){e.type==="uniform-in:context:update"&&e.newData&&await t.update(e.newData),e.type==="uniform-in:context:commands"&&e.commands&&Array.isArray(e.commands)&&await t.storage.updateData(e.commands),e.type==="uniform-in:context:forget"&&await t.forget(!1)}function Ke(e){return`${e.apiKey}|${e.projectId}${e.apiHost?`|${e.apiHost}`:""}`}function He(e){let[t,i,r]=e.split("|");if(!t.startsWith("uf"))throw new Error("Invalid API key");if(!/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})$/i.test(i))throw new Error("Invalid project ID");return{apiKey:t,projectId:i,apiHost:r||"https://uniform.app"}}0&&(module.exports={Context,CookieTransitionDataStore,EdgeNodeTagName,EdgeTransitionDataStore,GroupCriteriaEvaluator,ManifestInstance,SERVER_STATE_ID,ScriptType,TransitionDataStore,UNIFORM_DEFAULT_COOKIE_NAME,VisitorDataStore,computeAggregateDimensions,cookieEvaluator,createConsoleLogDrain,createDebugConsoleLogDrain,createLinearDecay,currentPageEvaluator,emptyVisitorData,enableConsoleLogDrain,enableContextDevTools,enableDebugConsoleLogDrain,evaluateVariantMatch,eventEvaluator,explainStringMatch,explainStringMatchCriteria,getEnrichmentVectorKey,isStringMatch,pageViewCountDimension,pageViewCountEvaluator,parseQuickConnect,personalizeVariations,queryStringEvaluator,quirkEvaluator,serializeQuickConnect,testVariations});
"use strict";var be=Object.create;var F=Object.defineProperty;var Ve=Object.getOwnPropertyDescriptor;var Ee=Object.getOwnPropertyNames;var Te=Object.getPrototypeOf,ke=Object.prototype.hasOwnProperty;var Pe=(e,t,r)=>t in e?F(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var we=(e,t)=>{for(var r in t)F(e,r,{get:t[r],enumerable:!0})},Ft=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Ee(t))!ke.call(e,n)&&n!==r&&F(e,n,{get:()=>t[n],enumerable:!(i=Ve(t,n))||i.enumerable});return e};var $=(e,t,r)=>(r=e!=null?be(Te(e)):{},Ft(t||!e||!e.__esModule?F(r,"default",{value:e,enumerable:!0}):r,e)),Re=e=>Ft(F({},"__esModule",{value:!0}),e);var y=(e,t,r)=>(Pe(e,typeof t!="symbol"?t+"":t,r),r),St=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var a=(e,t,r)=>(St(e,t,"read from private field"),r?r.call(e):t.get(e)),d=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},m=(e,t,r,i)=>(St(e,t,"write to private field"),i?i.call(e,r):t.set(e,r),r);var S=(e,t,r)=>(St(e,t,"access private method"),r);var Be={};we(Be,{Context:()=>zt,CookieTransitionDataStore:()=>Rt,EdgeNodeTagName:()=>je,EdgeTransitionDataStore:()=>Ot,GroupCriteriaEvaluator:()=>N,ManifestInstance:()=>B,SERVER_STATE_ID:()=>Mt,ScriptType:()=>xe,TransitionDataStore:()=>A,UNIFORM_DEFAULT_COOKIE_NAME:()=>ne,VisitorDataStore:()=>L,computeAggregateDimensions:()=>yt,cookieEvaluator:()=>Dt,createConsoleLogDrain:()=>Se,createDebugConsoleLogDrain:()=>Ce,createLinearDecay:()=>Ne,currentPageEvaluator:()=>Vt,emptyVisitorData:()=>X,enableConsoleLogDrain:()=>Ie,enableContextDevTools:()=>Qe,enableDebugConsoleLogDrain:()=>_e,evaluateVariantMatch:()=>At,eventEvaluator:()=>bt,explainStringMatch:()=>k,explainStringMatchCriteria:()=>st,getEnrichmentVectorKey:()=>W,isStringMatch:()=>x,pageViewCountDimension:()=>at,pageViewCountEvaluator:()=>ut,parseQuickConnect:()=>He,personalizeVariations:()=>Nt,queryStringEvaluator:()=>Ct,quirkEvaluator:()=>xt,serializeQuickConnect:()=>Ke,testVariations:()=>ht});module.exports=Re(Be);function yt(e,t){let r={...e};for(let i in t){let n=Kt(e,i,t,new Set([i]));n!==0&&(r[i]=n)}return r}function Kt(e,t,r,i){var s;let n=0;for(let o of r[t].inputs){let u=(s=e[o.dim])!=null?s:0;if(!u&&r[o.dim]){if(i.has(o.dim))continue;let l=new Set(i);l.add(o.dim),u=Kt(e,o.dim,r,l)}if(u!==0)if(o.sign==="c"){n=0;break}else o.sign==="-"?n-=u:n+=u}return n}var nt="_";var K,H,ot=class{constructor(t,r,i){d(this,K,void 0);d(this,H,void 0);y(this,"signal");this.signal=t,m(this,K,r),m(this,H,i)}computeSignal(t,r){if(t.scores[this.signal.id]>=this.signal.cap&&this.signal.dur!=="t")return;let n=a(this,K).evaluate(t,this.signal.crit,r,this.signal,a(this,H)),s=this.signal.dur==="s"||this.signal.dur==="t"?"modscoreS":"modscore";if(!!n.changed){if(n.result)r.push({type:s,data:{dimension:this.signal.id,delta:this.signal.str}});else if(this.signal.dur==="t"){let o=t.visitor.sessionScores[this.signal.id];o&&r.push({type:s,data:{dimension:this.signal.id,delta:-o}})}}}};K=new WeakMap,H=new WeakMap;var V,J,O,B=class{constructor({manifest:t,evaluator:r=new N({}),onLogMessage:i=()=>{}}){y(this,"data");d(this,V,void 0);d(this,J,void 0);d(this,O,void 0);var n,s,o;m(this,V,(n=t.project)!=null?n:{}),this.data=t,m(this,J,Object.entries((o=(s=a(this,V).pz)==null?void 0:s.sig)!=null?o:[]).map(([u,c])=>new ot({...c,id:u},r,i))),m(this,O,i)}rollForControlGroup(){var t,r;return Math.random()<((r=(t=a(this,V).pz)==null?void 0:t.control)!=null?r:0)}getTest(t){var r;return(r=a(this,V).test)==null?void 0:r[t]}computeSignals(t){let r=[];a(this,O).call(this,["debug",200,"GROUP"]);try{a(this,J).forEach(i=>{a(this,O).call(this,["debug",201,"GROUP",i.signal]);try{i.computeSignal(t,r)}finally{a(this,O).call(this,["debug",201,"ENDGROUP"])}})}finally{a(this,O).call(this,["debug",200,"ENDGROUP"])}return r}computeAggregateDimensions(t){var r,i;return yt(t,(i=(r=a(this,V).pz)==null?void 0:r.agg)!=null?i:{})}getDimensionByKey(t){var i,n,s,o;let r=t.indexOf(nt);return r<=0?(n=(i=a(this,V).pz)==null?void 0:i.sig)==null?void 0:n[t]:(o=(s=a(this,V).pz)==null?void 0:s.enr)==null?void 0:o[t.substring(0,r)]}};V=new WeakMap,J=new WeakMap,O=new WeakMap;var Jt=require("dequal/lite");function x(e,t){var o,u,c,l,f,p;let r=(o=t==null?void 0:t.op)!=null?o:"=";if(t.op==="*")return e!==null&&typeof e!="undefined";if(t.op==="!*")return e===null||typeof e=="undefined";if(!("rhs"in t))throw new Error(`Match expression is required for match type ${r}`);let i=(u=t.cs)!=null?u:!1,n=(i?e!=null?e:"":Ht(e)).toString(),s=(i?t.rhs:Ht(t.rhs)).toString();switch(r){case"=":return n===s;case"!=":return n!==s;case"~":return(c=n.includes(s))!=null?c:!1;case"!~":return!((l=n.includes(s))==null||l);case"//":return new RegExp(t.rhs.toString(),i?"":"i").test((f=e==null?void 0:e.toString())!=null?f:"");case"!//":return!new RegExp(t.rhs.toString(),i?"":"i").test((p=e==null?void 0:e.toString())!=null?p:"");default:throw new Error(`Unknown match type ${r}.`)}}function k(e,t){return`'${("cs"in t?t.cs:!1)?e:e==null?void 0:e.toString().toUpperCase()}' ${st(t)}`}function st(e){return"rhs"in e?`${e.op} '${e.cs?e.rhs:e.rhs.toString().toUpperCase()}'`:`${e.op==="*"?"exists":"does not exist"}`}function Ht(e){var t,r;return(r=(t=e==null?void 0:e.toString())==null?void 0:t.toUpperCase())!=null?r:""}var Dt=({update:e,criteria:t,onLogMessage:r})=>{var u,c;if(t.type!=="CK")return{result:!1,changed:!1};let i=!(0,Jt.dequal)(Bt(e.state.cookies),Bt((u=e.previousState)==null?void 0:u.cookies)),n=(c=e.state.cookies)==null?void 0:c[t.cookieName],o={result:x(n,t.match),changed:i};return r==null||r(["debug",203,{criteria:t,result:o,explanation:k(n,t.match)}]),o};function Bt(e){if(!e)return;if(!e.ufvd)return e;let{ufvd:t,...r}=e;return r}function Wt(e,t){var i;if(typeof e=="undefined"||e===null)return!1;let r=Number(e);if(isNaN(r))return!1;switch((i=t==null?void 0:t.op)!=null?i:"="){case"=":return r===t.rhs;case"!=":return r!==t.rhs;case">":return r>t.rhs;case"<":return r<t.rhs;default:return console.warn(`Unknown match type ${t.op} is false.`),!1}}function Yt(e,t){return`${e} ${Oe(t)}`}function Oe(e){return`${e.op} ${e.rhs}`}function W(e,t){return`${e}${nt}${t}`}var at=W("$pvc","v"),ut=({update:e,criteria:t,commands:r,onLogMessage:i})=>{var l,f;if(t.type!=="PVC")return{result:!1,changed:!1};let n=Boolean(e.state.url&&(!e.previousState||((l=e.state.url)==null?void 0:l.toString())!==((f=e.previousState.url)==null?void 0:f.toString()))),o=(e.visitor.sessionScores[at]||0)+1,u={result:!1,changed:n},c=r.some(p=>p.type==="modscoreS"&&p.data.dimension===at);return n&&!c&&r.push({type:"modscoreS",data:{dimension:at,delta:1}}),Wt(o,t.match)&&(u.result=!0),i==null||i(["debug",203,{criteria:t,result:u,explanation:Yt(o,t.match)}]),u};ut.alwaysExecute=!0;var Ct=({update:e,criteria:t,onLogMessage:r})=>{var u,c,l,f,p;if(t.type!=="QS")return{result:!1,changed:!1};let i=!e.previousState||((c=(u=e.state.url)==null?void 0:u.searchParams)==null?void 0:c.toString())!==((f=(l=e.previousState.url)==null?void 0:l.searchParams)==null?void 0:f.toString()),n=(p=e.state.url)==null?void 0:p.searchParams.get(t.queryName),o={result:x(n,t.match),changed:i};return r==null||r(["debug",203,{criteria:t,result:o,explanation:k(n,t.match)}]),o};var xt=({update:e,criteria:t,signal:r,onLogMessage:i})=>{var f;if(t.type!=="QK")return{result:!1,changed:!1};if(typeof document=="undefined"&&r.dur==="t"&&e.scores[r.id]>0)return{result:!0,changed:!1};let n=e.visitor.quirks[t.key],s=(f=e.state.quirks)==null?void 0:f[t.key],o=s!=null?s:n,u=Boolean(s&&n!==s),l={result:x(o,t.match),changed:u};return i==null||i(["debug",203,{criteria:t,result:l,explanation:k(o,t.match)}]),l};var bt=({update:e,criteria:t,onLogMessage:r})=>{var s,o,u;if(t.type!=="EVT")return{result:!1,changed:!1};let i=(o=(s=e.state.events)==null?void 0:s.some(c=>x(c.event,t.event)))!=null?o:!1,n={result:i,changed:i};return r==null||r(["debug",203,{criteria:t,result:n,explanation:`'${(u=e.state.events)==null?void 0:u.join("', '")}' ${st(t.event)}`}]),n};var Vt=({update:e,criteria:t,onLogMessage:r})=>{var u,c,l;if(t.type!=="PV")return{result:!1,changed:!1};let i=(u=e.state.url)==null?void 0:u.pathname,n=!e.previousState||(i==null?void 0:i.toString())!==((l=(c=e.previousState.url)==null?void 0:c.pathname)==null?void 0:l.toString()),o={result:x(i,t.path),changed:n};return r==null||r(["debug",203,{criteria:t,result:o,explanation:k(i,t.path)}]),o};var Y,N=class{constructor(t){d(this,Y,void 0);m(this,Y,t)}evaluate(t,r,i,n,s){let o=r.clauses.length>1;o&&(s==null||s(["debug",202,"GROUP",r]));try{let u=!(r.op==="&"||!r.op),c=null,l=!1;for(let p of r.clauses){let v;if(p.type==="G")v=this.evaluate(t,p,i,n,s);else{let D=a(this,Y)[p.type];if(c&&!D.alwaysExecute)continue;if(!D)throw new Error(`${p.type} signal criteria not registered`);v=D({update:t,criteria:p,commands:i,signal:n,onLogMessage:s})}v.changed&&(l=!0),!c&&v.result===u&&(c={result:u,changed:l})}let f=c!=null?c:{result:!u,changed:l};return o&&(s==null||s(["debug",204,f])),f}finally{o&&(s==null||s(["debug",202,"ENDGROUP"]))}}};Y=new WeakMap;var X=()=>({quirks:{},scores:{},sessionScores:{},tests:{},consent:!1,controlGroup:!1});var Xt=$(require("mitt")),Zt=require("dequal/lite"),Mt="__UNIFORM_DATA__",U,q,A=class{constructor({initialData:t}){d(this,U,void 0);d(this,q,(0,Xt.default)());y(this,"events",{on:a(this,q).on,off:a(this,q).off});t&&m(this,U,t)}get data(){return a(this,U)}updateData(t,r){return m(this,U,r),this.handleUpdateData(t,r)}async delete(t){m(this,U,void 0),await this.handleDelete(t)}signalAsyncDataUpdate(t){(0,Zt.dequal)(this.data,t)||(m(this,U,t),a(this,q).emit("dataUpdatedAsync",t))}getClientTransitionState(){if(typeof document=="undefined")return;let t=document.getElementById(Mt);return t!=null&&t.textContent?JSON.parse(t.textContent):void 0}};U=new WeakMap,q=new WeakMap;var Et="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Lt=Et.split(""),te=new Array(123);for(let e=0;e<Et.length;e++)te[Et.charCodeAt(e)]=e;var Tt=e=>{if(e<0)return`-${Tt(-e)}`;let t=e>>>0,r=e/4294967296>>>0,i="";for(;r>0;)i=Lt[63&t]+i,t>>>=6,t|=(63&r)<<26,r>>>=6;let n="";do n=Lt[63&t]+n,t>>>=6;while(t>0);return n+i},ee=e=>{let t=0,r=e.charAt(0)==="-"?1:0;for(let i=r;i<e.length;i++)t=t*64+te[e.charCodeAt(i)];return r?-t:t};var lt=$(require("js-cookie")),kt=typeof document=="undefined",ne="ufvd",G,Z,Rt=class extends A{constructor({serverCookieValue:r,cookieName:i=ne,cookieAttributes:n={sameSite:"lax"}}){super({initialData:kt?Ue(r):void 0});d(this,G,void 0);d(this,Z,void 0);m(this,G,i),m(this,Z,n)}handleDelete(){return kt||lt.default.remove(a(this,G)),Promise.resolve()}async handleUpdateData(r,i){kt||(i.consent?lt.default.set(a(this,G),$e(i),a(this,Z)):lt.default.remove(a(this,G)))}};G=new WeakMap,Z=new WeakMap;var oe="~",se="!",ae="-";function Ue(e){if(!e)return;let t=e.split(oe);if(t.length>3)return;let[r,i,n]=t;return{consent:!0,sessionScores:re(Pt(i)),scores:re(Pt(n)),tests:Pt(r)}}function Pt(e){return e.split(se).map(r=>r.split(ae)).reduce((r,i)=>(i.length!==2||(r[i[0]]=i[1]),r),{})}function re(e){return Object.entries(e).reduce((t,[r,i])=>(t[r]=ee(i),t),{})}function $e(e){return[wt(e.tests),wt(ie(e.sessionScores)),wt(ie(e.scores))].join(oe)}function ie(e){return Object.entries(e).reduce((t,[r,i])=>(t[r]=Tt(i),t),{})}function wt(e){return Object.entries(e).map(t=>t.join(ae)).join(se)}var ct,ue,Ot=class extends A{constructor({serverCookieValue:r,visitorIdCookieName:i="ufvi",...n}){super(n);d(this,ct);n.initialData||S(this,ct,ue).call(this).catch(s=>{console.error(s)})}handleDelete(r){throw new Error("Method not implemented.")}async handleUpdateData(r){let i=await new Promise(n=>{setTimeout(()=>{n(void 0)},2e3)});i&&this.signalAsyncDataUpdate(i)}};ct=new WeakSet,ue=async function(){let r=await new Promise(i=>{setTimeout(()=>{i(void 0)},2e3)});r&&this.signalAsyncDataUpdate(r)};function Ne(e){let{gracePeriod:t=864e5,decayRate:r=1/30,decayCap:i=.95}=e!=null?e:{};return function({now:s,lastUpd:o,scores:u,sessionScores:c,onLogMessage:l}){if(typeof o!="number")return!1;let p=s-o-t;if(p<=0)return!1;let v=p/864e5,D=1-Math.min(i,v*r);return D<=0?!1:(le(u,D),le(c,D),l==null||l(["info",140,`linear decay factor ${D.toPrecision(6)}`]),!0)}}function le(e,t){for(let r in e)r.startsWith("$")||(e[r]*=t)}var fe=$(require("mitt")),M=require("dequal/lite");var dt=class{constructor(){y(this,"inMemoryFallback",{});y(this,"hasLocalStorageObject",typeof localStorage!="undefined")}get(t){let r=this.inMemoryFallback[t];if(!this.hasLocalStorageObject||r)return r;try{let i=localStorage.getItem(t);return i?JSON.parse(i):void 0}catch(i){return r}}set(t,r,i){if(this.inMemoryFallback[t]=r,!(!this.hasLocalStorageObject||!i))try{localStorage.setItem(t,JSON.stringify(r))}catch(n){console.warn(n)}}delete(t,r){r||delete this.inMemoryFallback[t];try{localStorage.removeItem(t)}catch(i){}}};var ce=$(require("rfdc"));var Ae=(0,ce.default)();function de(e,t,r){let i=t?Ae(t):X();return e.forEach(n=>{var s,o;switch(n.type){case"consent":i.consent=n.data;break;case"setquirk":i.quirks[n.data.key]=n.data.value;break;case"settest":i.tests[n.data.test]=n.data.variant;break;case"modscore":if(r)break;let u=Number(n.data.delta);if(isNaN(u))throw new Error("Non-number delta received");let c=(s=i.scores[n.data.dimension])!=null?s:0;i.scores[n.data.dimension]=c+u;break;case"modscoreS":if(r)break;let l=Number(n.data.delta);if(isNaN(l))throw new Error("Non-number delta received");let f=(o=i.sessionScores[n.data.dimension])!=null?o:0;i.sessionScores[n.data.dimension]=f+l;break;case"identify":break;case"setcontrol":i.controlGroup=n.data;break;default:throw new Error("Unknown command")}}),i}var ft="ufvisitor",E,I,_,g,b,P,w,z,pt,pe,mt,me,tt,Ut,et,$t,L=class{constructor(t){d(this,b);d(this,w);d(this,pt);d(this,mt);d(this,tt);d(this,et);d(this,E,(0,fe.default)());d(this,I,new dt);d(this,_,void 0);d(this,g,void 0);y(this,"events",{on:a(this,E).on,off:a(this,E).off});if(m(this,g,t),a(this,b,P)||S(this,w,z).call(this,S(this,et,$t).call(this),!0),t.transitionStore){let r=t.transitionStore.getClientTransitionState();r&&t.onServerTransitionReceived&&t.onServerTransitionReceived(r),t.transitionStore.events.on("dataUpdatedAsync",n=>{S(this,w,z).call(this,{...a(this,b,P).visitorData,...n})});let i=t.transitionStore.data;i&&S(this,w,z).call(this,{...a(this,b,P).visitorData,...i},!0)}}get data(){var r,i;let t=a(this,b,P);if(S(this,mt,me).call(this,t)){let{sessionScores:n,...s}=t.visitorData;return S(this,w,z).call(this,{...s,sessionScores:{}}),(i=(r=a(this,g)).onLogMessage)==null||i.call(r,["info",120]),a(this,b,P).visitorData}return t.visitorData}get decayEnabled(){return!!a(this,g).decay}async updateData(t){var i,n,s,o;if(t.length===0)return;(n=(i=a(this,g)).onLogMessage)==null||n.call(i,["debug",101,t]);let r=de(t,this.data,(s=a(this,b,P))==null?void 0:s.visitorData.controlGroup);t.some(u=>u.type==="consent"&&!u.data)&&a(this,I).delete(ft,!0),S(this,w,z).call(this,r),await((o=a(this,g).transitionStore)==null?void 0:o.updateData(t,a(this,b,P).visitorData))}async delete(t){var r,i,n,s,o;(i=(r=a(this,g)).onLogMessage)==null||i.call(r,["info",103,"GROUP",t]);try{a(this,I).delete(ft,!1),await((n=a(this,g).transitionStore)==null?void 0:n.delete(t)),S(this,w,z).call(this,S(this,et,$t).call(this))}finally{(o=(s=a(this,g)).onLogMessage)==null||o.call(s,["info",103,"ENDGROUP"])}}};E=new WeakMap,I=new WeakMap,_=new WeakMap,g=new WeakMap,b=new WeakSet,P=function(){return a(this,I).get(ft)},w=new WeakSet,z=function(t,r=!1){var f,p,v,D,it,qt,_t,jt,Qt;let i=a(this,b,P),n=Date.now();t.controlGroup?(t.scores={},t.sessionScores={}):(S(this,tt,Ut).call(this,t.scores),S(this,tt,Ut).call(this,t.sessionScores),(p=(f=a(this,g)).decay)==null||p.call(f,{now:n,lastUpd:i==null?void 0:i.updated,scores:t.scores,sessionScores:t.sessionScores,onLogMessage:a(this,g).onLogMessage}));let s=!(0,M.dequal)(i==null?void 0:i.visitorData.scores,t.scores),o=!(0,M.dequal)(i==null?void 0:i.visitorData.sessionScores,t.sessionScores),u=!(0,M.dequal)(i==null?void 0:i.visitorData.quirks,t.quirks),c=!(0,M.dequal)(i==null?void 0:i.visitorData.tests,t.tests),l={updated:n,visitorData:t};S(this,pt,pe).call(this),a(this,I).set(ft,l,!!t.consent),(D=(v=a(this,g)).onLogMessage)==null||D.call(v,["debug",102,t]),r||((s||o)&&a(this,E).emit("scoresUpdated",t),u&&a(this,E).emit("quirksUpdated",t),c&&a(this,E).emit("testsUpdated",t),((it=i==null?void 0:i.visitorData)==null?void 0:it.consent)!==t.consent&&a(this,E).emit("consentUpdated",t),((qt=i==null?void 0:i.visitorData)==null?void 0:qt.controlGroup)!==t.controlGroup&&(a(this,E).emit("controlGroupUpdated",t),(Qt=(jt=a(this,g)).onLogMessage)==null||Qt.call(jt,["debug",104,(_t=t.controlGroup)!=null?_t:!1])))},pt=new WeakSet,pe=function(){typeof document=="undefined"||!a(this,g).visitLifespan||(a(this,_)&&window.clearTimeout(a(this,_)),m(this,_,window.setTimeout(()=>{this.data},a(this,g).visitLifespan+50)))},mt=new WeakSet,me=function(t){let r=a(this,g).visitLifespan;return r?t.updated+r<Date.now():!1},tt=new WeakSet,Ut=function(t){var r,i;if(!!a(this,g).manifest)for(let n in t){let s=t[n],o=a(this,g).manifest.getDimensionByKey(n);!o||s>o.cap&&((i=(r=a(this,g)).onLogMessage)==null||i.call(r,["debug",110,{dim:n,score:s,cap:o.cap}]),t[n]=o.cap)}},et=new WeakSet,$t=function(){var t,r,i;return{...X(),consent:(t=a(this,g).defaultConsent)!=null?t:!1,controlGroup:(i=(r=a(this,g).manifest)==null?void 0:r.rollForControlGroup())!=null?i:!1}};var ge=$(require("mitt"));function Nt({name:e,context:t,variations:r,take:i=1,onLogMessage:n}){var s,o,u;n==null||n(["info",300,"GROUP",{name:e,take:i}]);try{let c=(s=t.storage.data.controlGroup)!=null?s:!1,l=[],f=!1,p=t.scores;for(let v of r){if(l.length===i)break;if(!((o=v.pz)!=null&&o.crit.length)){n==null||n(["info",301,"GROUP",{id:v.id,op:(u=v.pz)==null?void 0:u.op}]),n==null||n(["info",302,{matched:!0,description:"default variation"}]),n==null||n(["info",303,!0]),n==null||n(["info",301,"ENDGROUP"]),l.push(v);continue}c||At(v.id,v.pz,p,n)&&(f=!0,l.push(v))}return{personalized:f,variations:l}}finally{n==null||n(["info",300,"ENDGROUP"])}}function At(e,t,r,i){i==null||i(["info",301,"GROUP",{id:e,op:t==null?void 0:t.op}]);let n;try{t!=null&&t.crit?!t.op||t.op==="&"?n=t.crit.every(s=>he(s,r,i)):n=t.crit.some(s=>he(s,r,i)):(i==null||i(["info",302,{matched:!0,description:"default variation"}]),n=!0),i==null||i(["info",303,n])}finally{i==null||i(["info",301,"ENDGROUP"])}return n}function he(e,t,r){var u,c;let{op:i,l:n}=e,s=(u=t[n])!=null?u:0;if(i==="+"){let l=Math.max(...Object.values(t))===s&&s>0;return r==null||r(["info",302,{matched:l,description:`${e.l} has the highest score`}]),l}else if(i==="-"){let l=Math.min(...Object.values(t))===s&&s>0;return r==null||r(["info",302,{matched:l,description:`${e.l} has the lowest non-zero score`}]),l}let o=parseInt(e.rDim?t[e.rDim]:e.r,10);if(isNaN(o))return r==null||r(["info",302,{matched:!1,description:`${(c=e.rDim)!=null?c:e.r} has no score value`}]),!1;if(i===">"){let l=s>o;return j(r,l,e,s,o),l}else if(i===">="){let l=s>=o;return j(r,l,e,s,o),l}else if(i==="<"){let l=s<o;return j(r,l,e,s,o),l}else if(i==="<="){let l=s<=o;return j(r,l,e,s,o),l}else if(i==="="){let l=s===o;return j(r,l,e,s,o),l}else if(i==="!="){let l=s!==o;return j(r,l,e,s,o),l}else throw new Error(`Unknown op: ${i}`)}function j(e,t,r,i,n){e==null||e(["info",302,{matched:t,description:`${r.l}[${i}] ${r.op} ${r.rDim?`${r.rDim}[${n}]`:r.r}`}])}var Ge=e=>{let{values:t,total:r,missingDistribution:i}=e.reduce((n,s)=>(s.testDistribution?n.total+=s.testDistribution:++n.missingDistribution,n.values.push(s.testDistribution),n),{values:[],total:0,missingDistribution:0});if(r>100)throw new Error(`Total distribution ${r} is over the maximum 100.`);if(r<100){let s=(100-r)/i;t.forEach((o,u)=>{typeof o=="undefined"&&(t[u]=s)})}return t},ht=({name:e,context:t,variations:r,onLogMessage:i})=>{i==null||i(["info",400,"GROUP",e]);try{let n,s=t.getTestVariantId(e);if(s===null)return i==null||i(["error",401,e]),{result:void 0,variantAssigned:!1};if(s&&(n=r.find(o=>o.id===s),n||i==null||i(["warn",402,{missingVariant:s,variants:r.map(o=>o.id)}])),!n){let o=Ge(r),u=Math.floor(Math.random()*100),c=0;n=r.find((l,f)=>{let p=o[f];if(u>c&&u<=c+p)return l;c+=p}),n&&(i==null||i(["info",403,n.id]),t.setTestVariantId(e,n.id))}return n&&(i==null||i(["info",404,n.id])),{result:n,variantAssigned:!s}}finally{i==null||i(["info",400,"ENDGROUP"])}};var Gt=require("dequal/lite"),C,R,T,rt,h,Q,gt,zt=class{constructor(t){d(this,Q);y(this,"manifest");d(this,C,void 0);d(this,R,{});d(this,T,void 0);d(this,rt,{});d(this,h,(0,ge.default)());y(this,"events",{on:a(this,h).on,off:a(this,h).off});y(this,"storage");var n,s;let{manifest:r,...i}=t;m(this,T,{}),(n=t.plugins)==null||n.forEach(o=>{!o.logDrain||a(this,h).on("log",o.logDrain)}),a(this,h).emit("log",["info",1,"GROUP"]);try{this.manifest=new B({onLogMessage:o=>a(this,h).emit("log",o),manifest:r,evaluator:new N({CK:Dt,QS:Ct,QK:xt,PVC:ut,EVT:bt,PV:Vt})}),this.storage=new L({...i,manifest:this.manifest,onServerTransitionReceived:o=>{m(this,C,o),o.ssv&&(m(this,R,o.ssv),a(this,h).emit("log",["debug",130,o.ssv]))},onLogMessage:o=>a(this,h).emit("log",o)}),this.storage.events.on("scoresUpdated",S(this,Q,gt).bind(this)),a(this,C)||S(this,Q,gt).call(this,this.storage.data),this.storage.events.on("quirksUpdated",o=>{let u=this.manifest.computeSignals({scores:a(this,R),state:a(this,T),previousState:a(this,T),visitor:this.storage.data});this.storage.updateData(u),a(this,h).emit("quirksUpdated",o.quirks),a(this,h).emit("log",["info",4,o.quirks])}),(s=t.plugins)==null||s.forEach(o=>{!o.init||o.init(this)})}finally{a(this,h).emit("log",["info",1,"ENDGROUP"])}}get scores(){return a(this,R)}get quirks(){var t,r;return(r=(t=a(this,C))==null?void 0:t.quirks)!=null?r:this.storage.data.quirks}async update(t){var i,n,s;let r=[];(i=a(this,C))!=null&&i.quirks&&(t={...t,quirks:{...a(this,C).quirks,...t.quirks||{}}}),(n=a(this,C))!=null&&n.tests&&r.push(...Object.entries(a(this,C).tests).map(([o,u])=>({type:"settest",data:{test:o,variant:u}})));try{a(this,h).emit("log",["info",2,"GROUP",{...t,url:(s=t.url)==null?void 0:s.toString()}]),t.quirks&&r.push(...Object.entries(t.quirks).map(([o,u])=>({type:"setquirk",data:{key:o,value:u}}))),t.enrichments&&t.enrichments.forEach(o=>{let u=W(o.cat,o.key);this.manifest.getDimensionByKey(u)?r.push({type:"modscore",data:{dimension:u,delta:o.str}}):a(this,h).emit("log",["warn",5,o])}),r.push(...this.manifest.computeSignals({state:t,previousState:a(this,T),visitor:this.storage.data,scores:a(this,R)})),m(this,T,{...a(this,T),...t}),await this.storage.updateData(r),a(this,C)&&(S(this,Q,gt).call(this,this.storage.data),m(this,C,void 0),a(this,h).emit("log",["debug",131]))}finally{a(this,h).emit("log",["info",2,"ENDGROUP"])}}getTestVariantId(t){var i;let r=this.manifest.getTest(t);return r?(i=r.wv)!=null?i:this.storage.data.tests[t]:(a(this,h).emit("log",["warn",401,t]),null)}setTestVariantId(t,r){this.storage.updateData([{type:"settest",data:{test:t,variant:r}}])}log(...t){a(this,h).emit("log",t)}test(t){var i,n;let r=ht({...t,context:this,onLogMessage:s=>a(this,h).emit("log",s)});return a(this,h).emit("testResult",{name:t.name,variantId:(n=(i=r.result)==null?void 0:i.id)!=null?n:void 0,variantAssigned:r.variantAssigned}),r}personalize(t){let r=Nt({...t,context:this,onLogMessage:s=>a(this,h).emit("log",s)}),i=a(this,rt)[t.name],n={name:t.name,variantIds:r.variations.map(s=>{var o;return(o=s.id)!=null?o:"Unknown"}),control:this.storage.data.controlGroup,changed:!0};return i&&(0,Gt.dequal)(n.variantIds,i)&&(n.changed=!1),a(this,h).emit("personalizationResult",n),a(this,rt)[t.name]=n.variantIds,r}async forget(t){m(this,T,{}),await this.storage.delete(t)}};C=new WeakMap,R=new WeakMap,T=new WeakMap,rt=new WeakMap,h=new WeakMap,Q=new WeakSet,gt=function(t){var n;let r={...t.scores};for(let s in t.sessionScores)r[s]=((n=r[s])!=null?n:0)+t.sessionScores[s];r=this.manifest.computeAggregateDimensions(r),!(0,Gt.dequal)(r,a(this,R))&&(m(this,R,r),a(this,h).emit("scoresUpdated",r),a(this,h).emit("log",["info",3,r]))};var ve=$(require("rfdc"));function vt(e,t){if(e==="none")return!1;switch(t){case"debug":return e==="debug";case"info":return e==="info"||e==="debug";case"warn":return e==="warn"||e==="info"||e==="debug";case"error":return e==="debug"||"info";default:return!1}}var ze=(0,ve.default)();function Se(e){return([t,...r])=>{if(!vt(e,t))return;let[i,...n]=r;console[t](`\u{1F94B} [${t}] Uniform event ID ${i}
`,...n.map(ze))}}function Ie(e){return{logDrain:Se(e)}}var ye={1:()=>["context","initializing Uniform Context"],2:e=>["context","received update()",e],3:e=>["context","new score vector",e],4:e=>["context","updated quirks",e],5:e=>["context","ignored enrichment update for unknown enrichment category",e.cat],101:e=>["storage","received update commands",e],102:e=>["storage","data was updated",e],103:e=>["storage",`deleting visitor data ${e?"from all devices":"from this device"}`],104:e=>["context",e?"Visitor assigned to personalization control group":"Visitor assigned to personalization experiment group"],110:({dim:e,cap:t,score:r})=>["storage",`${e} score ${r} exceeded cap ${t}. Rounded down.`],120:()=>["storage","visitor data expired and was cleared"],130:e=>["storage","server to client transition score data was loaded; it will persist until the next update event occurs",e],131:()=>["storage","server to client transition data was discarded"],140:e=>["storage",`score decay was applied: ${e}`],200:()=>["signals","evaluating signals"],201:e=>["signals",`evaluating signal ${e.id} (${e.dur})`],202:e=>["signals",e.op==="|"?"OR":"AND"],203:({criteria:e,result:t,explanation:r})=>["signals",`${e.type}: ${r} is ${t.result} [${t.changed?"CHANGED":"unchanged"}]`],204:e=>["signals",`group result: ${e.result} [${e.changed?"CHANGED":"unchanged"}]`],300:e=>["personalization",`executing personalization '${e.name}'`],301:({id:e,op:t})=>["personalization",`testing variation ${e} (${t==="|"?"OR":"AND"})`],302:({matched:e,description:t})=>["personalization",`${t} is ${e}`],303:e=>["personalization",e?"selected variation":"did not select variation"],400:e=>["testing",`executing A/B test '${e}'`],401:e=>["testing",`${e} is not registered in the manifest; it will not be run.`],402:({missingVariant:e,variants:t})=>["testing",`test variation '${e}' previously assigned to the visitor for this test no longer exists as a variant. It will be removed. This may indicate changing test variations after publishing a test, which will make results invalid. Known variants: ${t.join(", ")}`],403:e=>["testing",`assigned new test variant '${e}'`],404:e=>["testing",`displaying variation '${e}'`],700:()=>["gtag","gtag is not defined, skipping analytics event emission. Ensure you have added the gtag script to your page."],701:()=>["gtag","enabled gtag event signal redirection"]};var De=$(require("rfdc")),qe=(0,De.default)();function Ce(e,t){let r=typeof document=="undefined",{enableOnServer:i=!1}=t!=null?t:{};return([n,...s])=>{if(!vt(e,n)||r&&!i)return;let[o,...u]=s,c=console[n];if(u[0]==="GROUP"&&(u.shift(),c=console.groupCollapsed),u[0]==="ENDGROUP"){console.groupEnd();return}let l=ye[o],f="";switch(n){case"debug":f="\u{1F41E}";break;case"info":f="\u{1F4AC}";break;case"warn":f="\u26A0\uFE0F";break;case"error":f="\u{1F4A5}";break}let p=f;if(!l){c(`${p} unknown event ID ${o}. Log messages data may be older than Uniform Context package.`,...u);return}let[v,D,...it]=l(...u);c(`${p}[${v}] ${D}
`,...it.map(qe))}}function _e(e,t){return{logDrain:Ce(e,t)}}var xe=(u=>(u.ListStart="nesi-list-start",u.ListEnd="nesi-list-end",u.ListItem="nesi-list-item-html",u.ListItemSettings="nesi-list-item-settings",u.TestStart="nesi-test-start",u.TestEnd="nesi-test-end",u.Unknown="unknown",u))(xe||{}),je="nesitag";var It=typeof top!="undefined";function Qe(){return{logDrain:e=>{!It||top==null||top.postMessage({type:"uniform:context:log",message:e},window.location.origin)},init:e=>{let t=[],r=[],i=()=>{!It||top==null||top.postMessage({type:"uniform:context:data",data:{scores:e.scores,data:e.storage.data,manifest:e.manifest.data,personalizations:t,tests:r}},window.location.origin)},n=o=>{!o.changed||(t.push(o),i())},s=o=>{!o.variantAssigned||(r.push(o),i())};if(It){window.__UNIFORM_DEVTOOLS_CONTEXT_INSTANCE__=e;try{top==null||top.addEventListener("message",async o=>{if(!o.data)return;let u=o.data;await Fe(u,e)})}catch(o){console.warn("Unable to initialize Uniform Context DevTools because it is in a cross-domain iframe.",o)}top==null||top.postMessage({type:"uniform:context:hello",uiVersion:2},window.location.origin),i()}return e.events.on("personalizationResult",n),e.events.on("testResult",s),e.events.on("scoresUpdated",i),e.storage.events.on("*",i),()=>{e.events.off("scoresUpdated",i),e.storage.events.off("*",i),e.events.off("personalizationResult",n),e.events.off("testResult",s)}}}}async function Fe(e,t){e.type==="uniform-in:context:update"&&e.newData&&await t.update(e.newData),e.type==="uniform-in:context:commands"&&e.commands&&Array.isArray(e.commands)&&await t.storage.updateData(e.commands),e.type==="uniform-in:context:forget"&&await t.forget(!1)}function Ke(e){return`${e.apiKey}|${e.projectId}${e.apiHost?`|${e.apiHost}`:""}`}function He(e){let[t,r,i]=e.split("|");if(!t.startsWith("uf"))throw new Error("Invalid API key");if(!/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})$/i.test(r))throw new Error("Invalid project ID");return{apiKey:t,projectId:r,apiHost:i||"https://uniform.app"}}0&&(module.exports={Context,CookieTransitionDataStore,EdgeNodeTagName,EdgeTransitionDataStore,GroupCriteriaEvaluator,ManifestInstance,SERVER_STATE_ID,ScriptType,TransitionDataStore,UNIFORM_DEFAULT_COOKIE_NAME,VisitorDataStore,computeAggregateDimensions,cookieEvaluator,createConsoleLogDrain,createDebugConsoleLogDrain,createLinearDecay,currentPageEvaluator,emptyVisitorData,enableConsoleLogDrain,enableContextDevTools,enableDebugConsoleLogDrain,evaluateVariantMatch,eventEvaluator,explainStringMatch,explainStringMatchCriteria,getEnrichmentVectorKey,isStringMatch,pageViewCountDimension,pageViewCountEvaluator,parseQuickConnect,personalizeVariations,queryStringEvaluator,quirkEvaluator,serializeQuickConnect,testVariations});
{
"name": "@uniformdev/context",
"version": "16.0.1-alpha.128+6cdb4ff33",
"version": "16.0.1-alpha.143+8bf270fcc",
"description": "Uniform Context core package",

@@ -54,3 +54,3 @@ "license": "SEE LICENSE IN LICENSE.txt",

"@types/yargs": "17.0.10",
"@uniformdev/cli": "^16.0.1-alpha.128+6cdb4ff33",
"@uniformdev/cli": "^16.0.1-alpha.143+8bf270fcc",
"benny": "3.7.1",

@@ -73,3 +73,3 @@ "yargs": "17.5.1"

},
"gitHead": "6cdb4ff331d6d0d9d5c154b7b342e7703067bfc3"
"gitHead": "8bf270fcc0cc82383d1f30311fe11dafd5fe3782"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc