@uniformdev/context
Advanced tools
Comparing version 16.0.1-alpha.194 to 16.0.1-alpha.221
import { a as AggregateGetParameters, b as AggregateGetResponse, c as AggregatePutParameters, d as AggregateDeleteParameters, D as DimensionGetParameters, e as DimensionGetResponse, f as EnrichmentGetParameters, g as EnrichmentGetResponse, h as EnrichmentPutParameters, i as EnrichmentDeleteParameters, j as EnrichmentValuePutParameters, k as EnrichmentValueDeleteParameters, M as ManifestGetParameters, l as ManifestGetResponse, m as QuirkGetParameters, n as QuirkGetResponse, o as QuirkPutParameters, p as QuirkDeleteParameters, q as SignalGetParameters, r as SignalGetResponse, s as SignalPutParameters, t as SignalDeleteParameters, u as TestGetParameters, v as TestGetResponse, w as TestPutParameters, x as TestDeleteParameters, y as DimensionDefinition } from '../contextTypes-572b0d33.js'; | ||
export { A as Aggregate, d as AggregateDeleteParameters, a as AggregateGetParameters, b as AggregateGetResponse, c as AggregatePutParameters, C as CookieCriteria, I as CurrentPageCriteria, y as DimensionDefinition, D as DimensionGetParameters, e as DimensionGetResponse, z as EnrichmentCategory, E as EnrichmentCategoryWithValues, i as EnrichmentDeleteParameters, f as EnrichmentGetParameters, g as EnrichmentGetResponse, h as EnrichmentPutParameters, B as EnrichmentValue, k as EnrichmentValueDeleteParameters, j as EnrichmentValuePutParameters, H as EventCriteria, M as ManifestGetParameters, l as ManifestGetResponse, P as PageViewCountCriteria, F as QueryStringCriteria, Q as Quirk, G as QuirkCriteria, p as QuirkDeleteParameters, m as QuirkGetParameters, n as QuirkGetResponse, o as QuirkPutParameters, R as RootSignalCriteriaGroup, t as SignalDeleteParameters, q as SignalGetParameters, r as SignalGetResponse, s as SignalPutParameters, S as SignalWithId, T as Test, x as TestDeleteParameters, u as TestGetParameters, v as TestGetResponse, w as TestPutParameters } from '../contextTypes-572b0d33.js'; | ||
import { g as ManifestV2 } from '../types-c12d92cd.js'; | ||
import { g as ManifestV2 } from '../types-876fb8b8.js'; | ||
import '../v2-manifest.swagger-ff2af13e.js'; | ||
@@ -5,0 +5,0 @@ import 'mitt'; |
@@ -1,3 +0,3 @@ | ||
import { T as TransitionDataStore, S as StorageCommands, V as VisitorData, a as TransitionDataStoreOptions, D as DecayFunction, O as OutputSeverity, L as LogDrain, C as ContextPlugin, b as CriteriaEvaluator, c as StringMatch, d as ScoreVector, A as AggregateDimension, e as VariantMatchCriteria, f as LogMessage } from './types-c12d92cd.js'; | ||
export { A as AggregateDimension, l as AggregateDimensionInput, ac as BehaviorTag, a0 as Context, $ as ContextEvents, Y as ContextOptions, C as ContextPlugin, t as ContextState, u as ContextStateUpdate, b as CriteriaEvaluator, n as CriteriaEvaluatorParameters, m as CriteriaEvaluatorResult, D as DecayFunction, H as DecayOptions, aj as DevToolsActions, an as DevToolsDataEvent, ak as DevToolsEvent, al as DevToolsEvents, ar as DevToolsForgetEvent, ao as DevToolsHelloEvent, am as DevToolsLogEvent, aq as DevToolsRawCommandsEvent, ai as DevToolsState, ah as DevToolsUiVersion, ap as DevToolsUpdateEvent, ab as DimensionMatch, E as EnrichmentCategory, q as EnrichmentData, r as EventData, G as GroupCriteriaEvaluator, I as IdentifyCommand, L as LogDrain, f as LogMessage, a6 as LogMessageGroup, a5 as LogMessageSingle, a1 as LogMessages, M as ManifestInstance, g as ManifestV2, a3 as MessageCategory, a4 as MessageFunc, w as ModifyScoreCommand, x as ModifySessionScoreCommand, N as NumberMatch, O as OutputSeverity, Z as PersonalizationEvent, P as PersonalizationManifest, a9 as PersonalizeOptions, ae as PersonalizedResult, ad as PersonalizedVariant, Q as Quirks, W as SERVER_STATE_ID, d as ScoreVector, U as ServerToClientTransitionState, y as SetConsentCommand, F as SetControlGroupCommand, z as SetQuirkCommand, B as SetTestCommand, a2 as Severity, h as Signal, j as SignalCriteria, i as SignalCriteriaGroup, o as SignalData, v as StorageCommand, S as StorageCommands, c as StringMatch, k as TestDefinition, _ as TestEvent, a8 as TestOptions, ag as TestResult, af as TestVariant, p as Tests, T as TransitionDataStore, X as TransitionDataStoreEvents, a as TransitionDataStoreOptions, e as VariantMatchCriteria, V as VisitorData, R as VisitorDataStore, K as VisitorDataStoreEvents, J as VisitorDataStoreOptions, s as emptyVisitorData, aa as personalizeVariations, a7 as testVariations } from './types-c12d92cd.js'; | ||
import { T as TransitionDataStore, S as StorageCommands, V as VisitorData, a as TransitionDataStoreOptions, D as DecayFunction, O as OutputSeverity, L as LogDrain, C as ContextPlugin, b as CriteriaEvaluator, c as StringMatch, d as ScoreVector, A as AggregateDimension, e as VariantMatchCriteria, f as LogMessage } from './types-876fb8b8.js'; | ||
export { A as AggregateDimension, l as AggregateDimensionInput, ac as BehaviorTag, a0 as Context, $ as ContextEvents, Y as ContextOptions, C as ContextPlugin, t as ContextState, u as ContextStateUpdate, b as CriteriaEvaluator, n as CriteriaEvaluatorParameters, m as CriteriaEvaluatorResult, D as DecayFunction, H as DecayOptions, aj as DevToolsActions, an as DevToolsDataEvent, ak as DevToolsEvent, al as DevToolsEvents, ar as DevToolsForgetEvent, ao as DevToolsHelloEvent, am as DevToolsLogEvent, aq as DevToolsRawCommandsEvent, ai as DevToolsState, ah as DevToolsUiVersion, ap as DevToolsUpdateEvent, ab as DimensionMatch, E as EnrichmentCategory, q as EnrichmentData, r as EventData, G as GroupCriteriaEvaluator, I as IdentifyCommand, L as LogDrain, f as LogMessage, a6 as LogMessageGroup, a5 as LogMessageSingle, a1 as LogMessages, M as ManifestInstance, g as ManifestV2, a3 as MessageCategory, a4 as MessageFunc, w as ModifyScoreCommand, x as ModifySessionScoreCommand, N as NumberMatch, O as OutputSeverity, Z as PersonalizationEvent, P as PersonalizationManifest, a9 as PersonalizeOptions, ae as PersonalizedResult, ad as PersonalizedVariant, Q as Quirks, W as SERVER_STATE_ID, d as ScoreVector, U as ServerToClientTransitionState, y as SetConsentCommand, F as SetControlGroupCommand, z as SetQuirkCommand, B as SetTestCommand, a2 as Severity, h as Signal, j as SignalCriteria, i as SignalCriteriaGroup, o as SignalData, v as StorageCommand, S as StorageCommands, c as StringMatch, k as TestDefinition, _ as TestEvent, a8 as TestOptions, ag as TestResult, af as TestVariant, p as Tests, T as TransitionDataStore, X as TransitionDataStoreEvents, a as TransitionDataStoreOptions, e as VariantMatchCriteria, V as VisitorData, R as VisitorDataStore, K as VisitorDataStoreEvents, J as VisitorDataStoreOptions, s as emptyVisitorData, aa as personalizeVariations, a7 as testVariations } from './types-876fb8b8.js'; | ||
import Cookies from 'js-cookie'; | ||
@@ -4,0 +4,0 @@ import './v2-manifest.swagger-ff2af13e.js'; |
@@ -1,3 +0,3 @@ | ||
var le=Object.defineProperty;var ce=(e,t,r)=>t in e?le(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var C=(e,t,r)=>(ce(e,typeof t!="symbol"?t+"":t,r),r),ft=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var a=(e,t,r)=>(ft(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)},g=(e,t,r,i)=>(ft(e,t,"write to private field"),i?i.call(e,r):t.set(e,r),r);var D=(e,t,r)=>(ft(e,t,"access private method"),r);function Ot(e,t){let r={...e};for(let i in t){let n=Ut(e,i,t,new Set([i]));n!==0&&(r[i]=n)}return r}function Ut(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=Ut(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 L="_";var K,H,tt=class{constructor(t,r,i){d(this,K,void 0);d(this,H,void 0);C(this,"signal");this.signal=t,g(this,K,r),g(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 E,B,U,et=class{constructor({manifest:t,evaluator:r=new I({}),onLogMessage:i=()=>{}}){C(this,"data");d(this,E,void 0);d(this,B,void 0);d(this,U,void 0);var n,s,o;g(this,E,(n=t.project)!=null?n:{}),this.data=t,g(this,B,Object.entries((o=(s=a(this,E).pz)==null?void 0:s.sig)!=null?o:[]).map(([u,c])=>new tt({...c,id:u},r,i))),g(this,U,i)}rollForControlGroup(){var t,r;return Math.random()<((r=(t=a(this,E).pz)==null?void 0:t.control)!=null?r:0)}getTest(t){var r;return(r=a(this,E).test)==null?void 0:r[t]}computeSignals(t){let r=[];a(this,U).call(this,["debug",200,"GROUP"]);try{a(this,B).forEach(i=>{a(this,U).call(this,["debug",201,"GROUP",i.signal]);try{i.computeSignal(t,r)}finally{a(this,U).call(this,["debug",201,"ENDGROUP"])}})}finally{a(this,U).call(this,["debug",200,"ENDGROUP"])}return r}computeAggregateDimensions(t){var r,i;return Ot(t,(i=(r=a(this,E).pz)==null?void 0:r.agg)!=null?i:{})}getDimensionByKey(t){var i,n,s,o;let r=t.indexOf(L);return r<=0?(n=(i=a(this,E).pz)==null?void 0:i.sig)==null?void 0:n[t]:(o=(s=a(this,E).pz)==null?void 0:s.enr)==null?void 0:o[t.substring(0,r)]}};E=new WeakMap,B=new WeakMap,U=new WeakMap;import{dequal as de}from"dequal/lite";function T(e,t){var o,u,c,l,m,h;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:"":$t(e)).toString(),s=(i?t.rhs:$t(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((m=e==null?void 0:e.toString())!=null?m:"");case"!//":return!new RegExp(t.rhs.toString(),i?"":"i").test((h=e==null?void 0:e.toString())!=null?h:"");default:throw new Error(`Unknown match type ${r}.`)}}function $(e,t){return`'${("cs"in t?t.cs:!1)?e:e==null?void 0:e.toString().toUpperCase()}' ${mt(t)}`}function mt(e){return"rhs"in e?`${e.op} '${e.cs?e.rhs:e.rhs.toString().toUpperCase()}'`:`${e.op==="*"?"exists":"does not exist"}`}function $t(e){var t,r;return(r=(t=e==null?void 0:e.toString())==null?void 0:t.toUpperCase())!=null?r:""}var At=({update:e,criteria:t,onLogMessage:r})=>{var u,c;if(t.type!=="CK")return{result:!1,changed:!1};let i=!de(Nt(e.state.cookies),Nt((u=e.previousState)==null?void 0:u.cookies)),n=(c=e.state.cookies)==null?void 0:c[t.cookieName],o={result:T(n,t.match),changed:i};return r==null||r(["debug",203,{criteria:t,result:o,explanation:$(n,t.match)}]),o};function Nt(e){if(!e)return;if(!e.ufvd)return e;let{ufvd:t,...r}=e;return r}function Gt(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 zt(e,t){return`${e} ${pe(t)}`}function pe(e){return`${e.op} ${e.rhs}`}function rt(e,t){return`${e}${L}${t}`}var ht=rt("$pvc","v"),gt=({update:e,criteria:t,commands:r,onLogMessage:i})=>{var l,m;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())!==((m=e.previousState.url)==null?void 0:m.toString()))),o=(e.visitor.sessionScores[ht]||0)+1,u={result:!1,changed:n},c=r.some(h=>h.type==="modscoreS"&&h.data.dimension===ht);return n&&!c&&r.push({type:"modscoreS",data:{dimension:ht,delta:1}}),Gt(o,t.match)&&(u.result=!0),i==null||i(["debug",203,{criteria:t,result:u,explanation:zt(o,t.match)}]),u};gt.alwaysExecute=!0;var It=({update:e,criteria:t,onLogMessage:r})=>{var u,c,l,m,h;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())!==((m=(l=e.previousState.url)==null?void 0:l.searchParams)==null?void 0:m.toString()),n=(h=e.state.url)==null?void 0:h.searchParams.get(t.queryName),o={result:T(n,t.match),changed:i};return r==null||r(["debug",203,{criteria:t,result:o,explanation:$(n,t.match)}]),o};var qt=({update:e,criteria:t,signal:r,onLogMessage:i})=>{var m;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=(m=e.state.quirks)==null?void 0:m[t.key],o=s!=null?s:n,u=Boolean(s&&n!==s),l={result:T(o,t.match),changed:u};return i==null||i(["debug",203,{criteria:t,result:l,explanation:$(o,t.match)}]),l};var _t=({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=>T(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("', '")}' ${mt(t.event)}`}]),n};var jt=({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:T(i,t.path),changed:n};return r==null||r(["debug",203,{criteria:t,result:o,explanation:$(i,t.path)}]),o};var J,I=class{constructor(t){d(this,J,void 0);g(this,J,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 h of r.clauses){let y;if(h.type==="G")y=this.evaluate(t,h,i,n,s);else{let x=a(this,J)[h.type];if(c&&!x.alwaysExecute)continue;if(!x)throw new Error(`${h.type} signal criteria not registered`);y=x({update:t,criteria:h,commands:i,signal:n,onLogMessage:s})}y.changed&&(l=!0),!c&&y.result===u&&(c={result:u,changed:l})}let m=c!=null?c:{result:!u,changed:l};return o&&(s==null||s(["debug",204,m])),m}finally{o&&(s==null||s(["debug",202,"ENDGROUP"]))}}};J=new WeakMap;var it=()=>({quirks:{},scores:{},sessionScores:{},tests:{},consent:!1,controlGroup:!1});import fe from"mitt";import{dequal as me}from"dequal/lite";var he="__UNIFORM_DATA__",N,q,_=class{constructor({initialData:t}){d(this,N,void 0);d(this,q,fe());C(this,"events",{on:a(this,q).on,off:a(this,q).off});t&&g(this,N,t)}get data(){return a(this,N)}updateData(t,r){return g(this,N,r),this.handleUpdateData(t,r)}async delete(t){g(this,N,void 0),await this.handleDelete(t)}signalAsyncDataUpdate(t){me(this.data,t)||(g(this,N,t),a(this,q).emit("dataUpdatedAsync",t))}getClientTransitionState(){if(typeof document=="undefined")return;let t=document.getElementById(he);return t!=null&&t.textContent?JSON.parse(t.textContent):void 0}};N=new WeakMap,q=new WeakMap;var vt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ft=vt.split(""),Qt=new Array(123);for(let e=0;e<vt.length;e++)Qt[vt.charCodeAt(e)]=e;var St=e=>{if(e<0)return`-${St(-e)}`;let t=e>>>0,r=e/4294967296>>>0,i="";for(;r>0;)i=Ft[63&t]+i,t>>>=6,t|=(63&r)<<26,r>>>=6;let n="";do n=Ft[63&t]+n,t>>>=6;while(t>0);return n+i},Kt=e=>{let t=0,r=e.charAt(0)==="-"?1:0;for(let i=r;i<e.length;i++)t=t*64+Qt[e.charCodeAt(i)];return r?-t:t};import yt from"js-cookie";var Dt=typeof document=="undefined",ge="ufvd",A,W,Ht=class extends _{constructor({serverCookieValue:r,cookieName:i=ge,cookieAttributes:n={sameSite:"lax"}}){super({initialData:Dt?ve(r):void 0});d(this,A,void 0);d(this,W,void 0);g(this,A,i),g(this,W,n)}handleDelete(){return Dt||yt.remove(a(this,A)),Promise.resolve()}async handleUpdateData(r,i){Dt||(i.consent?yt.set(a(this,A),Se(i),a(this,W)):yt.remove(a(this,A)))}};A=new WeakMap,W=new WeakMap;var Wt="~",Yt="!",Xt="-";function ve(e){if(!e)return;let t=e.split(Wt);if(t.length>3)return;let[r,i,n]=t;return{consent:!0,sessionScores:Bt(Ct(i)),scores:Bt(Ct(n)),tests:Ct(r)}}function Ct(e){return e.split(Yt).map(r=>r.split(Xt)).reduce((r,i)=>(i.length!==2||(r[i[0]]=i[1]),r),{})}function Bt(e){return Object.entries(e).reduce((t,[r,i])=>(t[r]=Kt(i),t),{})}function Se(e){return[xt(e.tests),xt(Jt(e.sessionScores)),xt(Jt(e.scores))].join(Wt)}function Jt(e){return Object.entries(e).reduce((t,[r,i])=>(t[r]=St(i),t),{})}function xt(e){return Object.entries(e).map(t=>t.join(Xt)).join(Yt)}var nt,Mt,Zt=class extends _{constructor({serverCookieValue:r,visitorIdCookieName:i="ufvi",...n}){super(n);d(this,nt);n.initialData||D(this,nt,Mt).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)}};nt=new WeakSet,Mt=async function(){let r=await new Promise(i=>{setTimeout(()=>{i(void 0)},2e3)});r&&this.signalAsyncDataUpdate(r)};function wr(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 h=s-o-t;if(h<=0)return!1;let y=h/864e5,x=1-Math.min(i,y*r);return x<=0?!1:(Lt(u,x),Lt(c,x),l==null||l(["info",140,`linear decay factor ${x.toPrecision(6)}`]),!0)}}function Lt(e,t){for(let r in e)r.startsWith("$")||(e[r]*=t)}import Ce from"mitt";import{dequal as st}from"dequal/lite";var ot=class{constructor(){C(this,"inMemoryFallback",{});C(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 ye from"rfdc";var De=ye();function te(e,t,r){let i=t?De(t):it();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 m=(o=i.sessionScores[n.data.dimension])!=null?o:0;i.sessionScores[n.data.dimension]=m+l;break;case"identify":break;case"setcontrol":i.controlGroup=n.data;break;default:throw new Error("Unknown command")}}),i}var at="ufvisitor",k,z,j,S,b,w,R,G,lt,ee,ct,re,Y,bt,X,Vt,ut=class{constructor(t){d(this,b);d(this,R);d(this,lt);d(this,ct);d(this,Y);d(this,X);d(this,k,Ce());d(this,z,new ot);d(this,j,void 0);d(this,S,void 0);C(this,"events",{on:a(this,k).on,off:a(this,k).off});if(g(this,S,t),a(this,b,w)||D(this,R,G).call(this,D(this,X,Vt).call(this),!0),t.transitionStore){let r=t.transitionStore.getClientTransitionState();r&&t.onServerTransitionReceived&&t.onServerTransitionReceived(r),t.transitionStore.events.on("dataUpdatedAsync",n=>{D(this,R,G).call(this,{...a(this,b,w).visitorData,...n})});let i=t.transitionStore.data;i&&D(this,R,G).call(this,{...a(this,b,w).visitorData,...i},!0)}}get data(){var r,i;let t=a(this,b,w);if(D(this,ct,re).call(this,t)){let{sessionScores:n,...s}=t.visitorData;return D(this,R,G).call(this,{...s,sessionScores:{}}),(i=(r=a(this,S)).onLogMessage)==null||i.call(r,["info",120]),a(this,b,w).visitorData}return t.visitorData}get decayEnabled(){return!!a(this,S).decay}async updateData(t){var i,n,s,o;if(t.length===0)return;(n=(i=a(this,S)).onLogMessage)==null||n.call(i,["debug",101,t]);let r=te(t,this.data,(s=a(this,b,w))==null?void 0:s.visitorData.controlGroup);t.some(u=>u.type==="consent"&&!u.data)&&a(this,z).delete(at,!0),D(this,R,G).call(this,r),await((o=a(this,S).transitionStore)==null?void 0:o.updateData(t,a(this,b,w).visitorData))}async delete(t){var r,i,n,s,o;(i=(r=a(this,S)).onLogMessage)==null||i.call(r,["info",103,"GROUP",t]);try{a(this,z).delete(at,!1),await((n=a(this,S).transitionStore)==null?void 0:n.delete(t)),D(this,R,G).call(this,D(this,X,Vt).call(this))}finally{(o=(s=a(this,S)).onLogMessage)==null||o.call(s,["info",103,"ENDGROUP"])}}};k=new WeakMap,z=new WeakMap,j=new WeakMap,S=new WeakMap,b=new WeakSet,w=function(){return a(this,z).get(at)},R=new WeakSet,G=function(t,r=!1){var m,h,y,x,M,kt,Pt,wt,Rt;let i=a(this,b,w),n=Date.now();t.controlGroup?(t.scores={},t.sessionScores={}):(D(this,Y,bt).call(this,t.scores),D(this,Y,bt).call(this,t.sessionScores),(h=(m=a(this,S)).decay)==null||h.call(m,{now:n,lastUpd:i==null?void 0:i.updated,scores:t.scores,sessionScores:t.sessionScores,onLogMessage:a(this,S).onLogMessage}));let s=!st(i==null?void 0:i.visitorData.scores,t.scores),o=!st(i==null?void 0:i.visitorData.sessionScores,t.sessionScores),u=!st(i==null?void 0:i.visitorData.quirks,t.quirks),c=!st(i==null?void 0:i.visitorData.tests,t.tests),l={updated:n,visitorData:t};D(this,lt,ee).call(this),a(this,z).set(at,l,!!t.consent),(x=(y=a(this,S)).onLogMessage)==null||x.call(y,["debug",102,t]),r||((s||o)&&a(this,k).emit("scoresUpdated",t),u&&a(this,k).emit("quirksUpdated",t),c&&a(this,k).emit("testsUpdated",t),((M=i==null?void 0:i.visitorData)==null?void 0:M.consent)!==t.consent&&a(this,k).emit("consentUpdated",t),((kt=i==null?void 0:i.visitorData)==null?void 0:kt.controlGroup)!==t.controlGroup&&(a(this,k).emit("controlGroupUpdated",t),(Rt=(wt=a(this,S)).onLogMessage)==null||Rt.call(wt,["debug",104,(Pt=t.controlGroup)!=null?Pt:!1])))},lt=new WeakSet,ee=function(){typeof document=="undefined"||!a(this,S).visitLifespan||(a(this,j)&&window.clearTimeout(a(this,j)),g(this,j,window.setTimeout(()=>{this.data},a(this,S).visitLifespan+50)))},ct=new WeakSet,re=function(t){let r=a(this,S).visitLifespan;return r?t.updated+r<Date.now():!1},Y=new WeakSet,bt=function(t){var r,i;if(!!a(this,S).manifest)for(let n in t){let s=t[n],o=a(this,S).manifest.getDimensionByKey(n);!o||s>o.cap&&((i=(r=a(this,S)).onLogMessage)==null||i.call(r,["debug",110,{dim:n,score:s,cap:o.cap}]),t[n]=o.cap)}},X=new WeakSet,Vt=function(){var t,r,i;return{...it(),consent:(t=a(this,S).defaultConsent)!=null?t:!1,controlGroup:(i=(r=a(this,S).manifest)==null?void 0:r.rollForControlGroup())!=null?i:!1}};import be from"mitt";function ie({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=[],m=!1,h=t.scores;for(let y of r){if(l.length===i)break;if(!((o=y.pz)!=null&&o.crit.length)){n==null||n(["info",301,"GROUP",{id:y.id,op:(u=y.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(y);continue}c||ne(y.id,y.pz,h,n)&&(m=!0,l.push(y))}return{personalized:m,variations:l}}finally{n==null||n(["info",300,"ENDGROUP"])}}function ne(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=>oe(s,r,i)):n=t.crit.some(s=>oe(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 oe(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 F(r,l,e,s,o),l}else if(i===">="){let l=s>=o;return F(r,l,e,s,o),l}else if(i==="<"){let l=s<o;return F(r,l,e,s,o),l}else if(i==="<="){let l=s<=o;return F(r,l,e,s,o),l}else if(i==="="){let l=s===o;return F(r,l,e,s,o),l}else if(i==="!="){let l=s!==o;return F(r,l,e,s,o),l}else throw new Error(`Unknown op: ${i}`)}function F(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 xe=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},Et=({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=xe(r),u=Math.floor(Math.random()*100),c=0;n=r.find((l,m)=>{let h=o[m];if(u>c&&u<=c+h)return l;c+=h}),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 se}from"dequal/lite";var V,O,P,Z,v,Q,dt,ae=class{constructor(t){d(this,Q);C(this,"manifest");d(this,V,void 0);d(this,O,{});d(this,P,void 0);d(this,Z,{});d(this,v,be());C(this,"events",{on:a(this,v).on,off:a(this,v).off});C(this,"storage");var n,s;let{manifest:r,...i}=t;g(this,P,{}),(n=t.plugins)==null||n.forEach(o=>{!o.logDrain||a(this,v).on("log",o.logDrain)}),a(this,v).emit("log",["info",1,"GROUP"]);try{this.manifest=new et({onLogMessage:o=>a(this,v).emit("log",o),manifest:r,evaluator:new I({CK:At,QS:It,QK:qt,PVC:gt,EVT:_t,PV:jt})}),this.storage=new ut({...i,manifest:this.manifest,onServerTransitionReceived:o=>{g(this,V,o),o.ssv&&(g(this,O,o.ssv),a(this,v).emit("log",["debug",130,o.ssv]))},onLogMessage:o=>a(this,v).emit("log",o)}),this.storage.events.on("scoresUpdated",D(this,Q,dt).bind(this)),a(this,V)||D(this,Q,dt).call(this,this.storage.data),this.storage.events.on("quirksUpdated",o=>{let u=this.manifest.computeSignals({scores:a(this,O),state:a(this,P),previousState:a(this,P),visitor:this.storage.data});this.storage.updateData(u),a(this,v).emit("quirksUpdated",o.quirks),a(this,v).emit("log",["info",4,o.quirks])}),(s=t.plugins)==null||s.forEach(o=>{!o.init||o.init(this)})}finally{a(this,v).emit("log",["info",1,"ENDGROUP"])}}get scores(){return a(this,O)}async update(t){var i,n,s;let r=[];(i=a(this,V))!=null&&i.quirks&&(t={...t,quirks:{...a(this,V).quirks,...t.quirks||{}}}),(n=a(this,V))!=null&&n.tests&&r.push(...Object.entries(a(this,V).tests).map(([o,u])=>({type:"settest",data:{test:o,variant:u}})));try{a(this,v).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=rt(o.cat,o.key);this.manifest.getDimensionByKey(u)?r.push({type:"modscore",data:{dimension:u,delta:o.str}}):a(this,v).emit("log",["warn",5,o])}),r.push(...this.manifest.computeSignals({state:t,previousState:a(this,P),visitor:this.storage.data,scores:a(this,O)})),g(this,P,{...a(this,P),...t}),await this.storage.updateData(r),a(this,V)&&(D(this,Q,dt).call(this,this.storage.data),g(this,V,void 0),a(this,v).emit("log",["debug",131]))}finally{a(this,v).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,v).emit("log",["warn",401,t]),null)}setTestVariantId(t,r){this.storage.updateData([{type:"settest",data:{test:t,variant:r}}])}log(...t){a(this,v).emit("log",t)}test(t){var i,n;let r=Et({...t,context:this,onLogMessage:s=>a(this,v).emit("log",s)});return a(this,v).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=ie({...t,context:this,onLogMessage:s=>a(this,v).emit("log",s)}),i=a(this,Z)[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&&se(n.variantIds,i)&&(n.changed=!1),a(this,v).emit("personalizationResult",n),a(this,Z)[t.name]=n.variantIds,r}async forget(t){g(this,P,{}),await this.storage.delete(t)}};V=new WeakMap,O=new WeakMap,P=new WeakMap,Z=new WeakMap,v=new WeakMap,Q=new WeakSet,dt=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),!se(r,a(this,O))&&(g(this,O,r),a(this,v).emit("scoresUpdated",r),a(this,v).emit("log",["info",3,r]))};import Ve from"rfdc";function pt(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 Ee=Ve();function Te(e){return([t,...r])=>{if(!pt(e,t))return;let[i,...n]=r;console[t](`\u{1F94B} [${t}] Uniform event ID ${i} | ||
`,...n.map(Ee))}}function mi(e){return{logDrain:Te(e)}}var ue={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 ke from"rfdc";var Pe=ke();function we(e,t){let r=typeof document=="undefined",{enableOnServer:i=!1}=t!=null?t:{};return([n,...s])=>{if(!pt(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=ue[o],m="";switch(n){case"debug":m="\u{1F41E}";break;case"info":m="\u{1F4AC}";break;case"warn":m="\u26A0\uFE0F";break;case"error":m="\u{1F4A5}";break}let h=m;if(!l){c(`${h} unknown event ID ${o}. Log messages data may be older than Uniform Context package.`,...u);return}let[y,x,...M]=l(...u);c(`${h}[${y}] ${x} | ||
var le=Object.defineProperty;var ce=(e,t,r)=>t in e?le(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var C=(e,t,r)=>(ce(e,typeof t!="symbol"?t+"":t,r),r),pt=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var a=(e,t,r)=>(pt(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)},g=(e,t,r,i)=>(pt(e,t,"write to private field"),i?i.call(e,r):t.set(e,r),r);var D=(e,t,r)=>(pt(e,t,"access private method"),r);function Ot(e,t){let r={...e};for(let i in t){let n=Ut(e,i,t,new Set([i]));n!==0&&(r[i]=n)}return r}function Ut(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=Ut(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 L="_";var K,H,tt=class{constructor(t,r,i){d(this,K,void 0);d(this,H,void 0);C(this,"signal");this.signal=t,g(this,K,r),g(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 E,B,U,et=class{constructor({manifest:t,evaluator:r=new I({}),onLogMessage:i=()=>{}}){C(this,"data");d(this,E,void 0);d(this,B,void 0);d(this,U,void 0);var n,s,o;g(this,E,(n=t.project)!=null?n:{}),this.data=t,g(this,B,Object.entries((o=(s=a(this,E).pz)==null?void 0:s.sig)!=null?o:[]).map(([u,c])=>new tt({...c,id:u},r,i))),g(this,U,i)}rollForControlGroup(){var t,r;return Math.random()<((r=(t=a(this,E).pz)==null?void 0:t.control)!=null?r:0)}getTest(t){var r;return(r=a(this,E).test)==null?void 0:r[t]}computeSignals(t){let r=[];a(this,U).call(this,["debug",200,"GROUP"]);try{a(this,B).forEach(i=>{a(this,U).call(this,["debug",201,"GROUP",i.signal]);try{i.computeSignal(t,r)}finally{a(this,U).call(this,["debug",201,"ENDGROUP"])}})}finally{a(this,U).call(this,["debug",200,"ENDGROUP"])}return r}computeAggregateDimensions(t){var r,i;return Ot(t,(i=(r=a(this,E).pz)==null?void 0:r.agg)!=null?i:{})}getDimensionByKey(t){var i,n,s,o;let r=t.indexOf(L);return r<=0?(n=(i=a(this,E).pz)==null?void 0:i.sig)==null?void 0:n[t]:(o=(s=a(this,E).pz)==null?void 0:s.enr)==null?void 0:o[t.substring(0,r)]}};E=new WeakMap,B=new WeakMap,U=new WeakMap;import{dequal as de}from"dequal/lite";function T(e,t){var o,u,c,l,m,h;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:"":$t(e)).toString(),s=(i?t.rhs:$t(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((m=e==null?void 0:e.toString())!=null?m:"");case"!//":return!new RegExp(t.rhs.toString(),i?"":"i").test((h=e==null?void 0:e.toString())!=null?h:"");default:throw new Error(`Unknown match type ${r}.`)}}function $(e,t){return`'${("cs"in t?t.cs:!1)?e:e==null?void 0:e.toString().toUpperCase()}' ${mt(t)}`}function mt(e){return"rhs"in e?`${e.op} '${e.cs?e.rhs:e.rhs.toString().toUpperCase()}'`:`${e.op==="*"?"exists":"does not exist"}`}function $t(e){var t,r;return(r=(t=e==null?void 0:e.toString())==null?void 0:t.toUpperCase())!=null?r:""}var At=({update:e,criteria:t,onLogMessage:r})=>{var u,c;if(t.type!=="CK")return{result:!1,changed:!1};let i=!de(Nt(e.state.cookies),Nt((u=e.previousState)==null?void 0:u.cookies)),n=(c=e.state.cookies)==null?void 0:c[t.cookieName],o={result:T(n,t.match),changed:i};return r==null||r(["debug",203,{criteria:t,result:o,explanation:$(n,t.match)}]),o};function Nt(e){if(!e)return;if(!e.ufvd)return e;let{ufvd:t,...r}=e;return r}function Gt(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 zt(e,t){return`${e} ${fe(t)}`}function fe(e){return`${e.op} ${e.rhs}`}function rt(e,t){return`${e}${L}${t}`}var ht=rt("$pvc","v"),gt=({update:e,criteria:t,commands:r,onLogMessage:i})=>{var l,m;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())!==((m=e.previousState.url)==null?void 0:m.toString()))),o=(e.visitor.sessionScores[ht]||0)+1,u={result:!1,changed:n},c=r.some(h=>h.type==="modscoreS"&&h.data.dimension===ht);return n&&!c&&r.push({type:"modscoreS",data:{dimension:ht,delta:1}}),Gt(o,t.match)&&(u.result=!0),i==null||i(["debug",203,{criteria:t,result:u,explanation:zt(o,t.match)}]),u};gt.alwaysExecute=!0;var It=({update:e,criteria:t,onLogMessage:r})=>{var u,c,l,m,h;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())!==((m=(l=e.previousState.url)==null?void 0:l.searchParams)==null?void 0:m.toString()),n=(h=e.state.url)==null?void 0:h.searchParams.get(t.queryName),o={result:T(n,t.match),changed:i};return r==null||r(["debug",203,{criteria:t,result:o,explanation:$(n,t.match)}]),o};var qt=({update:e,criteria:t,signal:r,onLogMessage:i})=>{var m;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=(m=e.state.quirks)==null?void 0:m[t.key],o=s!=null?s:n,u=Boolean(s&&n!==s),l={result:T(o,t.match),changed:u};return i==null||i(["debug",203,{criteria:t,result:l,explanation:$(o,t.match)}]),l};var _t=({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=>T(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("', '")}' ${mt(t.event)}`}]),n};var jt=({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:T(i,t.path),changed:n};return r==null||r(["debug",203,{criteria:t,result:o,explanation:$(i,t.path)}]),o};var J,I=class{constructor(t){d(this,J,void 0);g(this,J,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 h of r.clauses){let y;if(h.type==="G")y=this.evaluate(t,h,i,n,s);else{let x=a(this,J)[h.type];if(c&&!x.alwaysExecute)continue;if(!x)throw new Error(`${h.type} signal criteria not registered`);y=x({update:t,criteria:h,commands:i,signal:n,onLogMessage:s})}y.changed&&(l=!0),!c&&y.result===u&&(c={result:u,changed:l})}let m=c!=null?c:{result:!u,changed:l};return o&&(s==null||s(["debug",204,m])),m}finally{o&&(s==null||s(["debug",202,"ENDGROUP"]))}}};J=new WeakMap;var it=()=>({quirks:{},scores:{},sessionScores:{},tests:{},consent:!1,controlGroup:!1});import pe from"mitt";import{dequal as me}from"dequal/lite";var he="__UNIFORM_DATA__",N,q,_=class{constructor({initialData:t}){d(this,N,void 0);d(this,q,pe());C(this,"events",{on:a(this,q).on,off:a(this,q).off});t&&g(this,N,t)}get data(){return a(this,N)}updateData(t,r){return g(this,N,r),this.handleUpdateData(t,r)}async delete(t){g(this,N,void 0),await this.handleDelete(t)}signalAsyncDataUpdate(t){me(this.data,t)||(g(this,N,t),a(this,q).emit("dataUpdatedAsync",t))}getClientTransitionState(){if(typeof document=="undefined")return;let t=document.getElementById(he);return t!=null&&t.textContent?JSON.parse(t.textContent):void 0}};N=new WeakMap,q=new WeakMap;var vt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Qt=vt.split(""),Ft=new Array(123);for(let e=0;e<vt.length;e++)Ft[vt.charCodeAt(e)]=e;var St=e=>{if(e<0)return`-${St(-e)}`;let t=e>>>0,r=e/4294967296>>>0,i="";for(;r>0;)i=Qt[63&t]+i,t>>>=6,t|=(63&r)<<26,r>>>=6;let n="";do n=Qt[63&t]+n,t>>>=6;while(t>0);return n+i},Kt=e=>{let t=0,r=e.charAt(0)==="-"?1:0;for(let i=r;i<e.length;i++)t=t*64+Ft[e.charCodeAt(i)];return r?-t:t};import yt from"js-cookie";var Dt=typeof document=="undefined",ge="ufvd",A,W,Ht=class extends _{constructor({serverCookieValue:r,cookieName:i=ge,cookieAttributes:n={sameSite:"lax"}}){super({initialData:Dt?ve(r):void 0});d(this,A,void 0);d(this,W,void 0);g(this,A,i),g(this,W,n)}handleDelete(){return Dt||yt.remove(a(this,A)),Promise.resolve()}async handleUpdateData(r,i){Dt||(i.consent?yt.set(a(this,A),Se(i),a(this,W)):yt.remove(a(this,A)))}};A=new WeakMap,W=new WeakMap;var Wt="~",Yt="!",Xt="-";function ve(e){if(!e)return;let t=e.split(Wt);if(t.length>3)return;let[r,i,n]=t;return{consent:!0,sessionScores:Bt(Ct(i)),scores:Bt(Ct(n)),tests:Ct(r)}}function Ct(e){return e.split(Yt).map(r=>r.split(Xt)).reduce((r,i)=>(i.length!==2||(r[i[0]]=i[1]),r),{})}function Bt(e){return Object.entries(e).reduce((t,[r,i])=>(t[r]=Kt(i),t),{})}function Se(e){return[xt(e.tests),xt(Jt(e.sessionScores)),xt(Jt(e.scores))].join(Wt)}function Jt(e){return Object.entries(e).reduce((t,[r,i])=>(t[r]=St(i),t),{})}function xt(e){return Object.entries(e).map(t=>t.join(Xt)).join(Yt)}var nt,Mt,Zt=class extends _{constructor({serverCookieValue:r,visitorIdCookieName:i="ufvi",...n}){super(n);d(this,nt);n.initialData||D(this,nt,Mt).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)}};nt=new WeakSet,Mt=async function(){let r=await new Promise(i=>{setTimeout(()=>{i(void 0)},2e3)});r&&this.signalAsyncDataUpdate(r)};function wr(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 h=s-o-t;if(h<=0)return!1;let y=h/864e5,x=1-Math.min(i,y*r);return x<=0?!1:(Lt(u,x),Lt(c,x),l==null||l(["info",140,`linear decay factor ${x.toPrecision(6)}`]),!0)}}function Lt(e,t){for(let r in e)r.startsWith("$")||(e[r]*=t)}import Ce from"mitt";import{dequal as st}from"dequal/lite";var ot=class{constructor(){C(this,"inMemoryFallback",{});C(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 ye from"rfdc";var De=ye();function te(e,t,r){let i=t?De(t):it();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 m=(o=i.sessionScores[n.data.dimension])!=null?o:0;i.sessionScores[n.data.dimension]=m+l;break;case"identify":break;case"setcontrol":i.controlGroup=n.data;break;default:throw new Error("Unknown command")}}),i}var at="ufvisitor",k,z,j,S,V,w,R,G,lt,ee,ct,re,Y,bt,X,Vt,ut=class{constructor(t){d(this,V);d(this,R);d(this,lt);d(this,ct);d(this,Y);d(this,X);d(this,k,Ce());d(this,z,new ot);d(this,j,void 0);d(this,S,void 0);C(this,"events",{on:a(this,k).on,off:a(this,k).off});if(g(this,S,t),a(this,V,w)||D(this,R,G).call(this,D(this,X,Vt).call(this),!0),t.transitionStore){let r=t.transitionStore.getClientTransitionState();r&&t.onServerTransitionReceived&&t.onServerTransitionReceived(r),t.transitionStore.events.on("dataUpdatedAsync",n=>{D(this,R,G).call(this,{...a(this,V,w).visitorData,...n})});let i=t.transitionStore.data;i&&D(this,R,G).call(this,{...a(this,V,w).visitorData,...i},!0)}}get data(){var r,i;let t=a(this,V,w);if(D(this,ct,re).call(this,t)){let{sessionScores:n,...s}=t.visitorData;return D(this,R,G).call(this,{...s,sessionScores:{}}),(i=(r=a(this,S)).onLogMessage)==null||i.call(r,["info",120]),a(this,V,w).visitorData}return t.visitorData}get decayEnabled(){return!!a(this,S).decay}async updateData(t){var i,n,s,o;if(t.length===0)return;(n=(i=a(this,S)).onLogMessage)==null||n.call(i,["debug",101,t]);let r=te(t,this.data,(s=a(this,V,w))==null?void 0:s.visitorData.controlGroup);t.some(u=>u.type==="consent"&&!u.data)&&a(this,z).delete(at,!0),D(this,R,G).call(this,r),await((o=a(this,S).transitionStore)==null?void 0:o.updateData(t,a(this,V,w).visitorData))}async delete(t){var r,i,n,s,o;(i=(r=a(this,S)).onLogMessage)==null||i.call(r,["info",103,"GROUP",t]);try{a(this,z).delete(at,!1),await((n=a(this,S).transitionStore)==null?void 0:n.delete(t)),D(this,R,G).call(this,D(this,X,Vt).call(this))}finally{(o=(s=a(this,S)).onLogMessage)==null||o.call(s,["info",103,"ENDGROUP"])}}};k=new WeakMap,z=new WeakMap,j=new WeakMap,S=new WeakMap,V=new WeakSet,w=function(){return a(this,z).get(at)},R=new WeakSet,G=function(t,r=!1){var m,h,y,x,M,kt,Pt,wt,Rt;let i=a(this,V,w),n=Date.now();t.controlGroup?(t.scores={},t.sessionScores={}):(D(this,Y,bt).call(this,t.scores),D(this,Y,bt).call(this,t.sessionScores),(h=(m=a(this,S)).decay)==null||h.call(m,{now:n,lastUpd:i==null?void 0:i.updated,scores:t.scores,sessionScores:t.sessionScores,onLogMessage:a(this,S).onLogMessage}));let s=!st(i==null?void 0:i.visitorData.scores,t.scores),o=!st(i==null?void 0:i.visitorData.sessionScores,t.sessionScores),u=!st(i==null?void 0:i.visitorData.quirks,t.quirks),c=!st(i==null?void 0:i.visitorData.tests,t.tests),l={updated:n,visitorData:t};D(this,lt,ee).call(this),a(this,z).set(at,l,!!t.consent),(x=(y=a(this,S)).onLogMessage)==null||x.call(y,["debug",102,t]),r||((s||o)&&a(this,k).emit("scoresUpdated",t),u&&a(this,k).emit("quirksUpdated",t),c&&a(this,k).emit("testsUpdated",t),((M=i==null?void 0:i.visitorData)==null?void 0:M.consent)!==t.consent&&a(this,k).emit("consentUpdated",t),((kt=i==null?void 0:i.visitorData)==null?void 0:kt.controlGroup)!==t.controlGroup&&(a(this,k).emit("controlGroupUpdated",t),(Rt=(wt=a(this,S)).onLogMessage)==null||Rt.call(wt,["debug",104,(Pt=t.controlGroup)!=null?Pt:!1])))},lt=new WeakSet,ee=function(){typeof document=="undefined"||!a(this,S).visitLifespan||(a(this,j)&&window.clearTimeout(a(this,j)),g(this,j,window.setTimeout(()=>{this.data},a(this,S).visitLifespan+50)))},ct=new WeakSet,re=function(t){let r=a(this,S).visitLifespan;return r?t.updated+r<Date.now():!1},Y=new WeakSet,bt=function(t){var r,i;if(!!a(this,S).manifest)for(let n in t){let s=t[n],o=a(this,S).manifest.getDimensionByKey(n);!o||s>o.cap&&((i=(r=a(this,S)).onLogMessage)==null||i.call(r,["debug",110,{dim:n,score:s,cap:o.cap}]),t[n]=o.cap)}},X=new WeakSet,Vt=function(){var t,r,i;return{...it(),consent:(t=a(this,S).defaultConsent)!=null?t:!1,controlGroup:(i=(r=a(this,S).manifest)==null?void 0:r.rollForControlGroup())!=null?i:!1}};import be from"mitt";function ie({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=[],m=!1,h=t.scores;for(let y of r){if(l.length===i)break;if(!((o=y.pz)!=null&&o.crit.length)){n==null||n(["info",301,"GROUP",{id:y.id,op:(u=y.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(y);continue}c||ne(y.id,y.pz,h,n)&&(m=!0,l.push(y))}return{personalized:m,variations:l}}finally{n==null||n(["info",300,"ENDGROUP"])}}function ne(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=>oe(s,r,i)):n=t.crit.some(s=>oe(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 oe(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 Q(r,l,e,s,o),l}else if(i===">="){let l=s>=o;return Q(r,l,e,s,o),l}else if(i==="<"){let l=s<o;return Q(r,l,e,s,o),l}else if(i==="<="){let l=s<=o;return Q(r,l,e,s,o),l}else if(i==="="){let l=s===o;return Q(r,l,e,s,o),l}else if(i==="!="){let l=s!==o;return Q(r,l,e,s,o),l}else throw new Error(`Unknown op: ${i}`)}function Q(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 xe=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},Et=({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=xe(r),u=Math.floor(Math.random()*100),c=0;n=r.find((l,m)=>{let h=o[m];if(u>c&&u<=c+h)return l;c+=h}),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 se}from"dequal/lite";var b,O,P,Z,v,F,dt,ae=class{constructor(t){d(this,F);C(this,"manifest");d(this,b,void 0);d(this,O,{});d(this,P,void 0);d(this,Z,{});d(this,v,be());C(this,"events",{on:a(this,v).on,off:a(this,v).off});C(this,"storage");var n,s;let{manifest:r,...i}=t;g(this,P,{}),(n=t.plugins)==null||n.forEach(o=>{!o.logDrain||a(this,v).on("log",o.logDrain)}),a(this,v).emit("log",["info",1,"GROUP"]);try{this.manifest=new et({onLogMessage:o=>a(this,v).emit("log",o),manifest:r,evaluator:new I({CK:At,QS:It,QK:qt,PVC:gt,EVT:_t,PV:jt})}),this.storage=new ut({...i,manifest:this.manifest,onServerTransitionReceived:o=>{g(this,b,o),o.ssv&&(g(this,O,o.ssv),a(this,v).emit("log",["debug",130,o.ssv]))},onLogMessage:o=>a(this,v).emit("log",o)}),this.storage.events.on("scoresUpdated",D(this,F,dt).bind(this)),a(this,b)||D(this,F,dt).call(this,this.storage.data),this.storage.events.on("quirksUpdated",o=>{let u=this.manifest.computeSignals({scores:a(this,O),state:a(this,P),previousState:a(this,P),visitor:this.storage.data});this.storage.updateData(u),a(this,v).emit("quirksUpdated",o.quirks),a(this,v).emit("log",["info",4,o.quirks])}),(s=t.plugins)==null||s.forEach(o=>{!o.init||o.init(this)})}finally{a(this,v).emit("log",["info",1,"ENDGROUP"])}}get scores(){return a(this,O)}get quirks(){var t,r;return(r=(t=a(this,b))==null?void 0:t.quirks)!=null?r:this.storage.data.quirks}async update(t){var i,n,s;let r=[];(i=a(this,b))!=null&&i.quirks&&(t={...t,quirks:{...a(this,b).quirks,...t.quirks||{}}}),(n=a(this,b))!=null&&n.tests&&r.push(...Object.entries(a(this,b).tests).map(([o,u])=>({type:"settest",data:{test:o,variant:u}})));try{a(this,v).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=rt(o.cat,o.key);this.manifest.getDimensionByKey(u)?r.push({type:"modscore",data:{dimension:u,delta:o.str}}):a(this,v).emit("log",["warn",5,o])}),r.push(...this.manifest.computeSignals({state:t,previousState:a(this,P),visitor:this.storage.data,scores:a(this,O)})),g(this,P,{...a(this,P),...t}),await this.storage.updateData(r),a(this,b)&&(D(this,F,dt).call(this,this.storage.data),g(this,b,void 0),a(this,v).emit("log",["debug",131]))}finally{a(this,v).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,v).emit("log",["warn",401,t]),null)}setTestVariantId(t,r){this.storage.updateData([{type:"settest",data:{test:t,variant:r}}])}log(...t){a(this,v).emit("log",t)}test(t){var i,n;let r=Et({...t,context:this,onLogMessage:s=>a(this,v).emit("log",s)});return a(this,v).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=ie({...t,context:this,onLogMessage:s=>a(this,v).emit("log",s)}),i=a(this,Z)[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&&se(n.variantIds,i)&&(n.changed=!1),a(this,v).emit("personalizationResult",n),a(this,Z)[t.name]=n.variantIds,r}async forget(t){g(this,P,{}),await this.storage.delete(t)}};b=new WeakMap,O=new WeakMap,P=new WeakMap,Z=new WeakMap,v=new WeakMap,F=new WeakSet,dt=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),!se(r,a(this,O))&&(g(this,O,r),a(this,v).emit("scoresUpdated",r),a(this,v).emit("log",["info",3,r]))};import Ve from"rfdc";function ft(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 Ee=Ve();function Te(e){return([t,...r])=>{if(!ft(e,t))return;let[i,...n]=r;console[t](`\u{1F94B} [${t}] Uniform event ID ${i} | ||
`,...n.map(Ee))}}function mi(e){return{logDrain:Te(e)}}var ue={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 ke from"rfdc";var Pe=ke();function we(e,t){let r=typeof document=="undefined",{enableOnServer:i=!1}=t!=null?t:{};return([n,...s])=>{if(!ft(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=ue[o],m="";switch(n){case"debug":m="\u{1F41E}";break;case"info":m="\u{1F4AC}";break;case"warn":m="\u26A0\uFE0F";break;case"error":m="\u{1F4A5}";break}let h=m;if(!l){c(`${h} unknown event ID ${o}. Log messages data may be older than Uniform Context package.`,...u);return}let[y,x,...M]=l(...u);c(`${h}[${y}] ${x} | ||
`,...M.map(Pe))}}function Di(e,t){return{logDrain:we(e,t)}}var Re=(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))(Re||{}),xi="nesitag";var Tt=typeof top!="undefined";function Vi(){return{logDrain:e=>{!Tt||top==null||top.postMessage({type:"uniform:context:log",message:e},window.location.origin)},init:e=>{let t=[],r=[],i=()=>{!Tt||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(Tt){window.__UNIFORM_DEVTOOLS_CONTEXT_INSTANCE__=e;try{top==null||top.addEventListener("message",async o=>{if(!o.data)return;let u=o.data;await Oe(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 Oe(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 Ti(e){return`${e.apiKey}|${e.projectId}${e.apiHost?`|${e.apiHost}`:""}`}function ki(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{ae as Context,Ht as CookieTransitionDataStore,xi as EdgeNodeTagName,Zt as EdgeTransitionDataStore,I as GroupCriteriaEvaluator,et as ManifestInstance,he as SERVER_STATE_ID,Re as ScriptType,_ as TransitionDataStore,ge as UNIFORM_DEFAULT_COOKIE_NAME,ut as VisitorDataStore,Ot as computeAggregateDimensions,At as cookieEvaluator,Te as createConsoleLogDrain,we as createDebugConsoleLogDrain,wr as createLinearDecay,jt as currentPageEvaluator,it as emptyVisitorData,mi as enableConsoleLogDrain,Vi as enableContextDevTools,Di as enableDebugConsoleLogDrain,ne as evaluateVariantMatch,_t as eventEvaluator,$ as explainStringMatch,mt as explainStringMatchCriteria,rt as getEnrichmentVectorKey,T as isStringMatch,ht as pageViewCountDimension,gt as pageViewCountEvaluator,ki as parseQuickConnect,ie as personalizeVariations,It as queryStringEvaluator,qt as quirkEvaluator,Ti as serializeQuickConnect,Et as testVariations}; |
@@ -1,3 +0,3 @@ | ||
var Ve=Object.create;var K=Object.defineProperty;var Ee=Object.getOwnPropertyDescriptor;var Te=Object.getOwnPropertyNames;var ke=Object.getPrototypeOf,Pe=Object.prototype.hasOwnProperty;var we=(e,t,r)=>t in e?K(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Re=(e,t)=>{for(var r in t)K(e,r,{get:t[r],enumerable:!0})},Kt=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Te(t))!Pe.call(e,n)&&n!==r&&K(e,n,{get:()=>t[n],enumerable:!(i=Ee(t,n))||i.enumerable});return e};var N=(e,t,r)=>(r=e!=null?Ve(ke(e)):{},Kt(t||!e||!e.__esModule?K(r,"default",{value:e,enumerable:!0}):r,e)),Oe=e=>Kt(K({},"__esModule",{value:!0}),e);var D=(e,t,r)=>(we(e,typeof t!="symbol"?t+"":t,r),r),yt=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var a=(e,t,r)=>(yt(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)},h=(e,t,r,i)=>(yt(e,t,"write to private field"),i?i.call(e,r):t.set(e,r),r);var y=(e,t,r)=>(yt(e,t,"access private method"),r);var Je={};Re(Je,{Context:()=>It,CookieTransitionDataStore:()=>Ot,EdgeNodeTagName:()=>Fe,EdgeTransitionDataStore:()=>Ut,GroupCriteriaEvaluator:()=>A,ManifestInstance:()=>J,SERVER_STATE_ID:()=>Lt,ScriptType:()=>be,TransitionDataStore:()=>G,UNIFORM_DEFAULT_COOKIE_NAME:()=>oe,VisitorDataStore:()=>tt,computeAggregateDimensions:()=>Dt,cookieEvaluator:()=>Ct,createConsoleLogDrain:()=>ye,createDebugConsoleLogDrain:()=>xe,createLinearDecay:()=>Ae,currentPageEvaluator:()=>Et,emptyVisitorData:()=>Z,enableConsoleLogDrain:()=>qe,enableContextDevTools:()=>Qe,enableDebugConsoleLogDrain:()=>je,evaluateVariantMatch:()=>Gt,eventEvaluator:()=>Vt,explainStringMatch:()=>P,explainStringMatchCriteria:()=>at,getEnrichmentVectorKey:()=>Y,isStringMatch:()=>x,pageViewCountDimension:()=>ut,pageViewCountEvaluator:()=>lt,parseQuickConnect:()=>Be,personalizeVariations:()=>At,queryStringEvaluator:()=>xt,quirkEvaluator:()=>bt,serializeQuickConnect:()=>He,testVariations:()=>gt});module.exports=Oe(Je);function Dt(e,t){let r={...e};for(let i in t){let n=Ht(e,i,t,new Set([i]));n!==0&&(r[i]=n)}return r}function Ht(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=Ht(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 ot="_";var H,B,st=class{constructor(t,r,i){d(this,H,void 0);d(this,B,void 0);D(this,"signal");this.signal=t,h(this,H,r),h(this,B,i)}computeSignal(t,r){if(t.scores[this.signal.id]>=this.signal.cap&&this.signal.dur!=="t")return;let n=a(this,H).evaluate(t,this.signal.crit,r,this.signal,a(this,B)),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}})}}}};H=new WeakMap,B=new WeakMap;var E,W,U,J=class{constructor({manifest:t,evaluator:r=new A({}),onLogMessage:i=()=>{}}){D(this,"data");d(this,E,void 0);d(this,W,void 0);d(this,U,void 0);var n,s,o;h(this,E,(n=t.project)!=null?n:{}),this.data=t,h(this,W,Object.entries((o=(s=a(this,E).pz)==null?void 0:s.sig)!=null?o:[]).map(([u,c])=>new st({...c,id:u},r,i))),h(this,U,i)}rollForControlGroup(){var t,r;return Math.random()<((r=(t=a(this,E).pz)==null?void 0:t.control)!=null?r:0)}getTest(t){var r;return(r=a(this,E).test)==null?void 0:r[t]}computeSignals(t){let r=[];a(this,U).call(this,["debug",200,"GROUP"]);try{a(this,W).forEach(i=>{a(this,U).call(this,["debug",201,"GROUP",i.signal]);try{i.computeSignal(t,r)}finally{a(this,U).call(this,["debug",201,"ENDGROUP"])}})}finally{a(this,U).call(this,["debug",200,"ENDGROUP"])}return r}computeAggregateDimensions(t){var r,i;return Dt(t,(i=(r=a(this,E).pz)==null?void 0:r.agg)!=null?i:{})}getDimensionByKey(t){var i,n,s,o;let r=t.indexOf(ot);return r<=0?(n=(i=a(this,E).pz)==null?void 0:i.sig)==null?void 0:n[t]:(o=(s=a(this,E).pz)==null?void 0:s.enr)==null?void 0:o[t.substring(0,r)]}};E=new WeakMap,W=new WeakMap,U=new WeakMap;var Wt=require("dequal/lite");function x(e,t){var o,u,c,l,f,m;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:"":Bt(e)).toString(),s=(i?t.rhs:Bt(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((m=e==null?void 0:e.toString())!=null?m:"");default:throw new Error(`Unknown match type ${r}.`)}}function P(e,t){return`'${("cs"in t?t.cs:!1)?e:e==null?void 0:e.toString().toUpperCase()}' ${at(t)}`}function at(e){return"rhs"in e?`${e.op} '${e.cs?e.rhs:e.rhs.toString().toUpperCase()}'`:`${e.op==="*"?"exists":"does not exist"}`}function Bt(e){var t,r;return(r=(t=e==null?void 0:e.toString())==null?void 0:t.toUpperCase())!=null?r:""}var Ct=({update:e,criteria:t,onLogMessage:r})=>{var u,c;if(t.type!=="CK")return{result:!1,changed:!1};let i=!(0,Wt.dequal)(Jt(e.state.cookies),Jt((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:P(n,t.match)}]),o};function Jt(e){if(!e)return;if(!e.ufvd)return e;let{ufvd:t,...r}=e;return r}function Yt(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 Xt(e,t){return`${e} ${Ue(t)}`}function Ue(e){return`${e.op} ${e.rhs}`}function Y(e,t){return`${e}${ot}${t}`}var ut=Y("$pvc","v"),lt=({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[ut]||0)+1,u={result:!1,changed:n},c=r.some(m=>m.type==="modscoreS"&&m.data.dimension===ut);return n&&!c&&r.push({type:"modscoreS",data:{dimension:ut,delta:1}}),Yt(o,t.match)&&(u.result=!0),i==null||i(["debug",203,{criteria:t,result:u,explanation:Xt(o,t.match)}]),u};lt.alwaysExecute=!0;var xt=({update:e,criteria:t,onLogMessage:r})=>{var u,c,l,f,m;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=(m=e.state.url)==null?void 0:m.searchParams.get(t.queryName),o={result:x(n,t.match),changed:i};return r==null||r(["debug",203,{criteria:t,result:o,explanation:P(n,t.match)}]),o};var bt=({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:P(o,t.match)}]),l};var Vt=({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("', '")}' ${at(t.event)}`}]),n};var Et=({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:P(i,t.path)}]),o};var X,A=class{constructor(t){d(this,X,void 0);h(this,X,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 m of r.clauses){let S;if(m.type==="G")S=this.evaluate(t,m,i,n,s);else{let C=a(this,X)[m.type];if(c&&!C.alwaysExecute)continue;if(!C)throw new Error(`${m.type} signal criteria not registered`);S=C({update:t,criteria:m,commands:i,signal:n,onLogMessage:s})}S.changed&&(l=!0),!c&&S.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"]))}}};X=new WeakMap;var Z=()=>({quirks:{},scores:{},sessionScores:{},tests:{},consent:!1,controlGroup:!1});var Zt=N(require("mitt")),Mt=require("dequal/lite"),Lt="__UNIFORM_DATA__",$,_,G=class{constructor({initialData:t}){d(this,$,void 0);d(this,_,(0,Zt.default)());D(this,"events",{on:a(this,_).on,off:a(this,_).off});t&&h(this,$,t)}get data(){return a(this,$)}updateData(t,r){return h(this,$,r),this.handleUpdateData(t,r)}async delete(t){h(this,$,void 0),await this.handleDelete(t)}signalAsyncDataUpdate(t){(0,Mt.dequal)(this.data,t)||(h(this,$,t),a(this,_).emit("dataUpdatedAsync",t))}getClientTransitionState(){if(typeof document=="undefined")return;let t=document.getElementById(Lt);return t!=null&&t.textContent?JSON.parse(t.textContent):void 0}};$=new WeakMap,_=new WeakMap;var Tt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",te=Tt.split(""),ee=new Array(123);for(let e=0;e<Tt.length;e++)ee[Tt.charCodeAt(e)]=e;var kt=e=>{if(e<0)return`-${kt(-e)}`;let t=e>>>0,r=e/4294967296>>>0,i="";for(;r>0;)i=te[63&t]+i,t>>>=6,t|=(63&r)<<26,r>>>=6;let n="";do n=te[63&t]+n,t>>>=6;while(t>0);return n+i},re=e=>{let t=0,r=e.charAt(0)==="-"?1:0;for(let i=r;i<e.length;i++)t=t*64+ee[e.charCodeAt(i)];return r?-t:t};var ct=N(require("js-cookie")),Pt=typeof document=="undefined",oe="ufvd",z,M,Ot=class extends G{constructor({serverCookieValue:r,cookieName:i=oe,cookieAttributes:n={sameSite:"lax"}}){super({initialData:Pt?$e(r):void 0});d(this,z,void 0);d(this,M,void 0);h(this,z,i),h(this,M,n)}handleDelete(){return Pt||ct.default.remove(a(this,z)),Promise.resolve()}async handleUpdateData(r,i){Pt||(i.consent?ct.default.set(a(this,z),Ne(i),a(this,M)):ct.default.remove(a(this,z)))}};z=new WeakMap,M=new WeakMap;var se="~",ae="!",ue="-";function $e(e){if(!e)return;let t=e.split(se);if(t.length>3)return;let[r,i,n]=t;return{consent:!0,sessionScores:ie(wt(i)),scores:ie(wt(n)),tests:wt(r)}}function wt(e){return e.split(ae).map(r=>r.split(ue)).reduce((r,i)=>(i.length!==2||(r[i[0]]=i[1]),r),{})}function ie(e){return Object.entries(e).reduce((t,[r,i])=>(t[r]=re(i),t),{})}function Ne(e){return[Rt(e.tests),Rt(ne(e.sessionScores)),Rt(ne(e.scores))].join(se)}function ne(e){return Object.entries(e).reduce((t,[r,i])=>(t[r]=kt(i),t),{})}function Rt(e){return Object.entries(e).map(t=>t.join(ue)).join(ae)}var dt,le,Ut=class extends G{constructor({serverCookieValue:r,visitorIdCookieName:i="ufvi",...n}){super(n);d(this,dt);n.initialData||y(this,dt,le).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)}};dt=new WeakSet,le=async function(){let r=await new Promise(i=>{setTimeout(()=>{i(void 0)},2e3)});r&&this.signalAsyncDataUpdate(r)};function Ae(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 m=s-o-t;if(m<=0)return!1;let S=m/864e5,C=1-Math.min(i,S*r);return C<=0?!1:(ce(u,C),ce(c,C),l==null||l(["info",140,`linear decay factor ${C.toPrecision(6)}`]),!0)}}function ce(e,t){for(let r in e)r.startsWith("$")||(e[r]*=t)}var fe=N(require("mitt")),L=require("dequal/lite");var pt=class{constructor(){D(this,"inMemoryFallback",{});D(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 de=N(require("rfdc"));var Ge=(0,de.default)();function pe(e,t,r){let i=t?Ge(t):Z();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",T,q,j,v,b,w,R,I,mt,me,ht,he,et,$t,rt,Nt,tt=class{constructor(t){d(this,b);d(this,R);d(this,mt);d(this,ht);d(this,et);d(this,rt);d(this,T,(0,fe.default)());d(this,q,new pt);d(this,j,void 0);d(this,v,void 0);D(this,"events",{on:a(this,T).on,off:a(this,T).off});if(h(this,v,t),a(this,b,w)||y(this,R,I).call(this,y(this,rt,Nt).call(this),!0),t.transitionStore){let r=t.transitionStore.getClientTransitionState();r&&t.onServerTransitionReceived&&t.onServerTransitionReceived(r),t.transitionStore.events.on("dataUpdatedAsync",n=>{y(this,R,I).call(this,{...a(this,b,w).visitorData,...n})});let i=t.transitionStore.data;i&&y(this,R,I).call(this,{...a(this,b,w).visitorData,...i},!0)}}get data(){var r,i;let t=a(this,b,w);if(y(this,ht,he).call(this,t)){let{sessionScores:n,...s}=t.visitorData;return y(this,R,I).call(this,{...s,sessionScores:{}}),(i=(r=a(this,v)).onLogMessage)==null||i.call(r,["info",120]),a(this,b,w).visitorData}return t.visitorData}get decayEnabled(){return!!a(this,v).decay}async updateData(t){var i,n,s,o;if(t.length===0)return;(n=(i=a(this,v)).onLogMessage)==null||n.call(i,["debug",101,t]);let r=pe(t,this.data,(s=a(this,b,w))==null?void 0:s.visitorData.controlGroup);t.some(u=>u.type==="consent"&&!u.data)&&a(this,q).delete(ft,!0),y(this,R,I).call(this,r),await((o=a(this,v).transitionStore)==null?void 0:o.updateData(t,a(this,b,w).visitorData))}async delete(t){var r,i,n,s,o;(i=(r=a(this,v)).onLogMessage)==null||i.call(r,["info",103,"GROUP",t]);try{a(this,q).delete(ft,!1),await((n=a(this,v).transitionStore)==null?void 0:n.delete(t)),y(this,R,I).call(this,y(this,rt,Nt).call(this))}finally{(o=(s=a(this,v)).onLogMessage)==null||o.call(s,["info",103,"ENDGROUP"])}}};T=new WeakMap,q=new WeakMap,j=new WeakMap,v=new WeakMap,b=new WeakSet,w=function(){return a(this,q).get(ft)},R=new WeakSet,I=function(t,r=!1){var f,m,S,C,nt,_t,jt,Ft,Qt;let i=a(this,b,w),n=Date.now();t.controlGroup?(t.scores={},t.sessionScores={}):(y(this,et,$t).call(this,t.scores),y(this,et,$t).call(this,t.sessionScores),(m=(f=a(this,v)).decay)==null||m.call(f,{now:n,lastUpd:i==null?void 0:i.updated,scores:t.scores,sessionScores:t.sessionScores,onLogMessage:a(this,v).onLogMessage}));let s=!(0,L.dequal)(i==null?void 0:i.visitorData.scores,t.scores),o=!(0,L.dequal)(i==null?void 0:i.visitorData.sessionScores,t.sessionScores),u=!(0,L.dequal)(i==null?void 0:i.visitorData.quirks,t.quirks),c=!(0,L.dequal)(i==null?void 0:i.visitorData.tests,t.tests),l={updated:n,visitorData:t};y(this,mt,me).call(this),a(this,q).set(ft,l,!!t.consent),(C=(S=a(this,v)).onLogMessage)==null||C.call(S,["debug",102,t]),r||((s||o)&&a(this,T).emit("scoresUpdated",t),u&&a(this,T).emit("quirksUpdated",t),c&&a(this,T).emit("testsUpdated",t),((nt=i==null?void 0:i.visitorData)==null?void 0:nt.consent)!==t.consent&&a(this,T).emit("consentUpdated",t),((_t=i==null?void 0:i.visitorData)==null?void 0:_t.controlGroup)!==t.controlGroup&&(a(this,T).emit("controlGroupUpdated",t),(Qt=(Ft=a(this,v)).onLogMessage)==null||Qt.call(Ft,["debug",104,(jt=t.controlGroup)!=null?jt:!1])))},mt=new WeakSet,me=function(){typeof document=="undefined"||!a(this,v).visitLifespan||(a(this,j)&&window.clearTimeout(a(this,j)),h(this,j,window.setTimeout(()=>{this.data},a(this,v).visitLifespan+50)))},ht=new WeakSet,he=function(t){let r=a(this,v).visitLifespan;return r?t.updated+r<Date.now():!1},et=new WeakSet,$t=function(t){var r,i;if(!!a(this,v).manifest)for(let n in t){let s=t[n],o=a(this,v).manifest.getDimensionByKey(n);!o||s>o.cap&&((i=(r=a(this,v)).onLogMessage)==null||i.call(r,["debug",110,{dim:n,score:s,cap:o.cap}]),t[n]=o.cap)}},rt=new WeakSet,Nt=function(){var t,r,i;return{...Z(),consent:(t=a(this,v).defaultConsent)!=null?t:!1,controlGroup:(i=(r=a(this,v).manifest)==null?void 0:r.rollForControlGroup())!=null?i:!1}};var ve=N(require("mitt"));function At({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,m=t.scores;for(let S of r){if(l.length===i)break;if(!((o=S.pz)!=null&&o.crit.length)){n==null||n(["info",301,"GROUP",{id:S.id,op:(u=S.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(S);continue}c||Gt(S.id,S.pz,m,n)&&(f=!0,l.push(S))}return{personalized:f,variations:l}}finally{n==null||n(["info",300,"ENDGROUP"])}}function Gt(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=>ge(s,r,i)):n=t.crit.some(s=>ge(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 ge(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 F(r,l,e,s,o),l}else if(i===">="){let l=s>=o;return F(r,l,e,s,o),l}else if(i==="<"){let l=s<o;return F(r,l,e,s,o),l}else if(i==="<="){let l=s<=o;return F(r,l,e,s,o),l}else if(i==="="){let l=s===o;return F(r,l,e,s,o),l}else if(i==="!="){let l=s!==o;return F(r,l,e,s,o),l}else throw new Error(`Unknown op: ${i}`)}function F(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 ze=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},gt=({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=ze(r),u=Math.floor(Math.random()*100),c=0;n=r.find((l,f)=>{let m=o[f];if(u>c&&u<=c+m)return l;c+=m}),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 zt=require("dequal/lite"),V,O,k,it,g,Q,vt,It=class{constructor(t){d(this,Q);D(this,"manifest");d(this,V,void 0);d(this,O,{});d(this,k,void 0);d(this,it,{});d(this,g,(0,ve.default)());D(this,"events",{on:a(this,g).on,off:a(this,g).off});D(this,"storage");var n,s;let{manifest:r,...i}=t;h(this,k,{}),(n=t.plugins)==null||n.forEach(o=>{!o.logDrain||a(this,g).on("log",o.logDrain)}),a(this,g).emit("log",["info",1,"GROUP"]);try{this.manifest=new J({onLogMessage:o=>a(this,g).emit("log",o),manifest:r,evaluator:new A({CK:Ct,QS:xt,QK:bt,PVC:lt,EVT:Vt,PV:Et})}),this.storage=new tt({...i,manifest:this.manifest,onServerTransitionReceived:o=>{h(this,V,o),o.ssv&&(h(this,O,o.ssv),a(this,g).emit("log",["debug",130,o.ssv]))},onLogMessage:o=>a(this,g).emit("log",o)}),this.storage.events.on("scoresUpdated",y(this,Q,vt).bind(this)),a(this,V)||y(this,Q,vt).call(this,this.storage.data),this.storage.events.on("quirksUpdated",o=>{let u=this.manifest.computeSignals({scores:a(this,O),state:a(this,k),previousState:a(this,k),visitor:this.storage.data});this.storage.updateData(u),a(this,g).emit("quirksUpdated",o.quirks),a(this,g).emit("log",["info",4,o.quirks])}),(s=t.plugins)==null||s.forEach(o=>{!o.init||o.init(this)})}finally{a(this,g).emit("log",["info",1,"ENDGROUP"])}}get scores(){return a(this,O)}async update(t){var i,n,s;let r=[];(i=a(this,V))!=null&&i.quirks&&(t={...t,quirks:{...a(this,V).quirks,...t.quirks||{}}}),(n=a(this,V))!=null&&n.tests&&r.push(...Object.entries(a(this,V).tests).map(([o,u])=>({type:"settest",data:{test:o,variant:u}})));try{a(this,g).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=Y(o.cat,o.key);this.manifest.getDimensionByKey(u)?r.push({type:"modscore",data:{dimension:u,delta:o.str}}):a(this,g).emit("log",["warn",5,o])}),r.push(...this.manifest.computeSignals({state:t,previousState:a(this,k),visitor:this.storage.data,scores:a(this,O)})),h(this,k,{...a(this,k),...t}),await this.storage.updateData(r),a(this,V)&&(y(this,Q,vt).call(this,this.storage.data),h(this,V,void 0),a(this,g).emit("log",["debug",131]))}finally{a(this,g).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,g).emit("log",["warn",401,t]),null)}setTestVariantId(t,r){this.storage.updateData([{type:"settest",data:{test:t,variant:r}}])}log(...t){a(this,g).emit("log",t)}test(t){var i,n;let r=gt({...t,context:this,onLogMessage:s=>a(this,g).emit("log",s)});return a(this,g).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=At({...t,context:this,onLogMessage:s=>a(this,g).emit("log",s)}),i=a(this,it)[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,zt.dequal)(n.variantIds,i)&&(n.changed=!1),a(this,g).emit("personalizationResult",n),a(this,it)[t.name]=n.variantIds,r}async forget(t){h(this,k,{}),await this.storage.delete(t)}};V=new WeakMap,O=new WeakMap,k=new WeakMap,it=new WeakMap,g=new WeakMap,Q=new WeakSet,vt=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,zt.dequal)(r,a(this,O))&&(h(this,O,r),a(this,g).emit("scoresUpdated",r),a(this,g).emit("log",["info",3,r]))};var Se=N(require("rfdc"));function St(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 Ie=(0,Se.default)();function ye(e){return([t,...r])=>{if(!St(e,t))return;let[i,...n]=r;console[t](`\u{1F94B} [${t}] Uniform event ID ${i} | ||
`,...n.map(Ie))}}function qe(e){return{logDrain:ye(e)}}var De={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 Ce=N(require("rfdc")),_e=(0,Ce.default)();function xe(e,t){let r=typeof document=="undefined",{enableOnServer:i=!1}=t!=null?t:{};return([n,...s])=>{if(!St(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=De[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 m=f;if(!l){c(`${m} unknown event ID ${o}. Log messages data may be older than Uniform Context package.`,...u);return}let[S,C,...nt]=l(...u);c(`${m}[${S}] ${C} | ||
`,...nt.map(_e))}}function je(e,t){return{logDrain:xe(e,t)}}var be=(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))(be||{}),Fe="nesitag";var qt=typeof top!="undefined";function Qe(){return{logDrain:e=>{!qt||top==null||top.postMessage({type:"uniform:context:log",message:e},window.location.origin)},init:e=>{let t=[],r=[],i=()=>{!qt||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(qt){window.__UNIFORM_DEVTOOLS_CONTEXT_INSTANCE__=e;try{top==null||top.addEventListener("message",async o=>{if(!o.data)return;let u=o.data;await Ke(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 Ke(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 He(e){return`${e.apiKey}|${e.projectId}${e.apiHost?`|${e.apiHost}`:""}`}function Be(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}); | ||
var Ve=Object.create;var K=Object.defineProperty;var Ee=Object.getOwnPropertyDescriptor;var Te=Object.getOwnPropertyNames;var ke=Object.getPrototypeOf,Pe=Object.prototype.hasOwnProperty;var we=(e,t,r)=>t in e?K(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Re=(e,t)=>{for(var r in t)K(e,r,{get:t[r],enumerable:!0})},Kt=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Te(t))!Pe.call(e,n)&&n!==r&&K(e,n,{get:()=>t[n],enumerable:!(i=Ee(t,n))||i.enumerable});return e};var N=(e,t,r)=>(r=e!=null?Ve(ke(e)):{},Kt(t||!e||!e.__esModule?K(r,"default",{value:e,enumerable:!0}):r,e)),Oe=e=>Kt(K({},"__esModule",{value:!0}),e);var D=(e,t,r)=>(we(e,typeof t!="symbol"?t+"":t,r),r),yt=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var a=(e,t,r)=>(yt(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)},h=(e,t,r,i)=>(yt(e,t,"write to private field"),i?i.call(e,r):t.set(e,r),r);var y=(e,t,r)=>(yt(e,t,"access private method"),r);var Je={};Re(Je,{Context:()=>It,CookieTransitionDataStore:()=>Ot,EdgeNodeTagName:()=>Qe,EdgeTransitionDataStore:()=>Ut,GroupCriteriaEvaluator:()=>A,ManifestInstance:()=>J,SERVER_STATE_ID:()=>Lt,ScriptType:()=>be,TransitionDataStore:()=>G,UNIFORM_DEFAULT_COOKIE_NAME:()=>oe,VisitorDataStore:()=>tt,computeAggregateDimensions:()=>Dt,cookieEvaluator:()=>Ct,createConsoleLogDrain:()=>ye,createDebugConsoleLogDrain:()=>xe,createLinearDecay:()=>Ae,currentPageEvaluator:()=>Et,emptyVisitorData:()=>Z,enableConsoleLogDrain:()=>qe,enableContextDevTools:()=>Fe,enableDebugConsoleLogDrain:()=>je,evaluateVariantMatch:()=>Gt,eventEvaluator:()=>Vt,explainStringMatch:()=>P,explainStringMatchCriteria:()=>at,getEnrichmentVectorKey:()=>Y,isStringMatch:()=>b,pageViewCountDimension:()=>ut,pageViewCountEvaluator:()=>lt,parseQuickConnect:()=>Be,personalizeVariations:()=>At,queryStringEvaluator:()=>xt,quirkEvaluator:()=>bt,serializeQuickConnect:()=>He,testVariations:()=>gt});module.exports=Oe(Je);function Dt(e,t){let r={...e};for(let i in t){let n=Ht(e,i,t,new Set([i]));n!==0&&(r[i]=n)}return r}function Ht(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=Ht(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 ot="_";var H,B,st=class{constructor(t,r,i){d(this,H,void 0);d(this,B,void 0);D(this,"signal");this.signal=t,h(this,H,r),h(this,B,i)}computeSignal(t,r){if(t.scores[this.signal.id]>=this.signal.cap&&this.signal.dur!=="t")return;let n=a(this,H).evaluate(t,this.signal.crit,r,this.signal,a(this,B)),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}})}}}};H=new WeakMap,B=new WeakMap;var E,W,U,J=class{constructor({manifest:t,evaluator:r=new A({}),onLogMessage:i=()=>{}}){D(this,"data");d(this,E,void 0);d(this,W,void 0);d(this,U,void 0);var n,s,o;h(this,E,(n=t.project)!=null?n:{}),this.data=t,h(this,W,Object.entries((o=(s=a(this,E).pz)==null?void 0:s.sig)!=null?o:[]).map(([u,c])=>new st({...c,id:u},r,i))),h(this,U,i)}rollForControlGroup(){var t,r;return Math.random()<((r=(t=a(this,E).pz)==null?void 0:t.control)!=null?r:0)}getTest(t){var r;return(r=a(this,E).test)==null?void 0:r[t]}computeSignals(t){let r=[];a(this,U).call(this,["debug",200,"GROUP"]);try{a(this,W).forEach(i=>{a(this,U).call(this,["debug",201,"GROUP",i.signal]);try{i.computeSignal(t,r)}finally{a(this,U).call(this,["debug",201,"ENDGROUP"])}})}finally{a(this,U).call(this,["debug",200,"ENDGROUP"])}return r}computeAggregateDimensions(t){var r,i;return Dt(t,(i=(r=a(this,E).pz)==null?void 0:r.agg)!=null?i:{})}getDimensionByKey(t){var i,n,s,o;let r=t.indexOf(ot);return r<=0?(n=(i=a(this,E).pz)==null?void 0:i.sig)==null?void 0:n[t]:(o=(s=a(this,E).pz)==null?void 0:s.enr)==null?void 0:o[t.substring(0,r)]}};E=new WeakMap,W=new WeakMap,U=new WeakMap;var Wt=require("dequal/lite");function b(e,t){var o,u,c,l,p,m;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:"":Bt(e)).toString(),s=(i?t.rhs:Bt(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((p=e==null?void 0:e.toString())!=null?p:"");case"!//":return!new RegExp(t.rhs.toString(),i?"":"i").test((m=e==null?void 0:e.toString())!=null?m:"");default:throw new Error(`Unknown match type ${r}.`)}}function P(e,t){return`'${("cs"in t?t.cs:!1)?e:e==null?void 0:e.toString().toUpperCase()}' ${at(t)}`}function at(e){return"rhs"in e?`${e.op} '${e.cs?e.rhs:e.rhs.toString().toUpperCase()}'`:`${e.op==="*"?"exists":"does not exist"}`}function Bt(e){var t,r;return(r=(t=e==null?void 0:e.toString())==null?void 0:t.toUpperCase())!=null?r:""}var Ct=({update:e,criteria:t,onLogMessage:r})=>{var u,c;if(t.type!=="CK")return{result:!1,changed:!1};let i=!(0,Wt.dequal)(Jt(e.state.cookies),Jt((u=e.previousState)==null?void 0:u.cookies)),n=(c=e.state.cookies)==null?void 0:c[t.cookieName],o={result:b(n,t.match),changed:i};return r==null||r(["debug",203,{criteria:t,result:o,explanation:P(n,t.match)}]),o};function Jt(e){if(!e)return;if(!e.ufvd)return e;let{ufvd:t,...r}=e;return r}function Yt(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 Xt(e,t){return`${e} ${Ue(t)}`}function Ue(e){return`${e.op} ${e.rhs}`}function Y(e,t){return`${e}${ot}${t}`}var ut=Y("$pvc","v"),lt=({update:e,criteria:t,commands:r,onLogMessage:i})=>{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[ut]||0)+1,u={result:!1,changed:n},c=r.some(m=>m.type==="modscoreS"&&m.data.dimension===ut);return n&&!c&&r.push({type:"modscoreS",data:{dimension:ut,delta:1}}),Yt(o,t.match)&&(u.result=!0),i==null||i(["debug",203,{criteria:t,result:u,explanation:Xt(o,t.match)}]),u};lt.alwaysExecute=!0;var xt=({update:e,criteria:t,onLogMessage:r})=>{var u,c,l,p,m;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())!==((p=(l=e.previousState.url)==null?void 0:l.searchParams)==null?void 0:p.toString()),n=(m=e.state.url)==null?void 0:m.searchParams.get(t.queryName),o={result:b(n,t.match),changed:i};return r==null||r(["debug",203,{criteria:t,result:o,explanation:P(n,t.match)}]),o};var bt=({update:e,criteria:t,signal:r,onLogMessage:i})=>{var p;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=(p=e.state.quirks)==null?void 0:p[t.key],o=s!=null?s:n,u=Boolean(s&&n!==s),l={result:b(o,t.match),changed:u};return i==null||i(["debug",203,{criteria:t,result:l,explanation:P(o,t.match)}]),l};var Vt=({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=>b(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("', '")}' ${at(t.event)}`}]),n};var Et=({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:b(i,t.path),changed:n};return r==null||r(["debug",203,{criteria:t,result:o,explanation:P(i,t.path)}]),o};var X,A=class{constructor(t){d(this,X,void 0);h(this,X,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 m of r.clauses){let S;if(m.type==="G")S=this.evaluate(t,m,i,n,s);else{let C=a(this,X)[m.type];if(c&&!C.alwaysExecute)continue;if(!C)throw new Error(`${m.type} signal criteria not registered`);S=C({update:t,criteria:m,commands:i,signal:n,onLogMessage:s})}S.changed&&(l=!0),!c&&S.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"]))}}};X=new WeakMap;var Z=()=>({quirks:{},scores:{},sessionScores:{},tests:{},consent:!1,controlGroup:!1});var Zt=N(require("mitt")),Mt=require("dequal/lite"),Lt="__UNIFORM_DATA__",$,_,G=class{constructor({initialData:t}){d(this,$,void 0);d(this,_,(0,Zt.default)());D(this,"events",{on:a(this,_).on,off:a(this,_).off});t&&h(this,$,t)}get data(){return a(this,$)}updateData(t,r){return h(this,$,r),this.handleUpdateData(t,r)}async delete(t){h(this,$,void 0),await this.handleDelete(t)}signalAsyncDataUpdate(t){(0,Mt.dequal)(this.data,t)||(h(this,$,t),a(this,_).emit("dataUpdatedAsync",t))}getClientTransitionState(){if(typeof document=="undefined")return;let t=document.getElementById(Lt);return t!=null&&t.textContent?JSON.parse(t.textContent):void 0}};$=new WeakMap,_=new WeakMap;var Tt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",te=Tt.split(""),ee=new Array(123);for(let e=0;e<Tt.length;e++)ee[Tt.charCodeAt(e)]=e;var kt=e=>{if(e<0)return`-${kt(-e)}`;let t=e>>>0,r=e/4294967296>>>0,i="";for(;r>0;)i=te[63&t]+i,t>>>=6,t|=(63&r)<<26,r>>>=6;let n="";do n=te[63&t]+n,t>>>=6;while(t>0);return n+i},re=e=>{let t=0,r=e.charAt(0)==="-"?1:0;for(let i=r;i<e.length;i++)t=t*64+ee[e.charCodeAt(i)];return r?-t:t};var ct=N(require("js-cookie")),Pt=typeof document=="undefined",oe="ufvd",z,M,Ot=class extends G{constructor({serverCookieValue:r,cookieName:i=oe,cookieAttributes:n={sameSite:"lax"}}){super({initialData:Pt?$e(r):void 0});d(this,z,void 0);d(this,M,void 0);h(this,z,i),h(this,M,n)}handleDelete(){return Pt||ct.default.remove(a(this,z)),Promise.resolve()}async handleUpdateData(r,i){Pt||(i.consent?ct.default.set(a(this,z),Ne(i),a(this,M)):ct.default.remove(a(this,z)))}};z=new WeakMap,M=new WeakMap;var se="~",ae="!",ue="-";function $e(e){if(!e)return;let t=e.split(se);if(t.length>3)return;let[r,i,n]=t;return{consent:!0,sessionScores:ie(wt(i)),scores:ie(wt(n)),tests:wt(r)}}function wt(e){return e.split(ae).map(r=>r.split(ue)).reduce((r,i)=>(i.length!==2||(r[i[0]]=i[1]),r),{})}function ie(e){return Object.entries(e).reduce((t,[r,i])=>(t[r]=re(i),t),{})}function Ne(e){return[Rt(e.tests),Rt(ne(e.sessionScores)),Rt(ne(e.scores))].join(se)}function ne(e){return Object.entries(e).reduce((t,[r,i])=>(t[r]=kt(i),t),{})}function Rt(e){return Object.entries(e).map(t=>t.join(ue)).join(ae)}var dt,le,Ut=class extends G{constructor({serverCookieValue:r,visitorIdCookieName:i="ufvi",...n}){super(n);d(this,dt);n.initialData||y(this,dt,le).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)}};dt=new WeakSet,le=async function(){let r=await new Promise(i=>{setTimeout(()=>{i(void 0)},2e3)});r&&this.signalAsyncDataUpdate(r)};function Ae(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 m=s-o-t;if(m<=0)return!1;let S=m/864e5,C=1-Math.min(i,S*r);return C<=0?!1:(ce(u,C),ce(c,C),l==null||l(["info",140,`linear decay factor ${C.toPrecision(6)}`]),!0)}}function ce(e,t){for(let r in e)r.startsWith("$")||(e[r]*=t)}var pe=N(require("mitt")),L=require("dequal/lite");var ft=class{constructor(){D(this,"inMemoryFallback",{});D(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 de=N(require("rfdc"));var Ge=(0,de.default)();function fe(e,t,r){let i=t?Ge(t):Z();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 p=(o=i.sessionScores[n.data.dimension])!=null?o:0;i.sessionScores[n.data.dimension]=p+l;break;case"identify":break;case"setcontrol":i.controlGroup=n.data;break;default:throw new Error("Unknown command")}}),i}var pt="ufvisitor",T,q,j,v,V,w,R,I,mt,me,ht,he,et,$t,rt,Nt,tt=class{constructor(t){d(this,V);d(this,R);d(this,mt);d(this,ht);d(this,et);d(this,rt);d(this,T,(0,pe.default)());d(this,q,new ft);d(this,j,void 0);d(this,v,void 0);D(this,"events",{on:a(this,T).on,off:a(this,T).off});if(h(this,v,t),a(this,V,w)||y(this,R,I).call(this,y(this,rt,Nt).call(this),!0),t.transitionStore){let r=t.transitionStore.getClientTransitionState();r&&t.onServerTransitionReceived&&t.onServerTransitionReceived(r),t.transitionStore.events.on("dataUpdatedAsync",n=>{y(this,R,I).call(this,{...a(this,V,w).visitorData,...n})});let i=t.transitionStore.data;i&&y(this,R,I).call(this,{...a(this,V,w).visitorData,...i},!0)}}get data(){var r,i;let t=a(this,V,w);if(y(this,ht,he).call(this,t)){let{sessionScores:n,...s}=t.visitorData;return y(this,R,I).call(this,{...s,sessionScores:{}}),(i=(r=a(this,v)).onLogMessage)==null||i.call(r,["info",120]),a(this,V,w).visitorData}return t.visitorData}get decayEnabled(){return!!a(this,v).decay}async updateData(t){var i,n,s,o;if(t.length===0)return;(n=(i=a(this,v)).onLogMessage)==null||n.call(i,["debug",101,t]);let r=fe(t,this.data,(s=a(this,V,w))==null?void 0:s.visitorData.controlGroup);t.some(u=>u.type==="consent"&&!u.data)&&a(this,q).delete(pt,!0),y(this,R,I).call(this,r),await((o=a(this,v).transitionStore)==null?void 0:o.updateData(t,a(this,V,w).visitorData))}async delete(t){var r,i,n,s,o;(i=(r=a(this,v)).onLogMessage)==null||i.call(r,["info",103,"GROUP",t]);try{a(this,q).delete(pt,!1),await((n=a(this,v).transitionStore)==null?void 0:n.delete(t)),y(this,R,I).call(this,y(this,rt,Nt).call(this))}finally{(o=(s=a(this,v)).onLogMessage)==null||o.call(s,["info",103,"ENDGROUP"])}}};T=new WeakMap,q=new WeakMap,j=new WeakMap,v=new WeakMap,V=new WeakSet,w=function(){return a(this,q).get(pt)},R=new WeakSet,I=function(t,r=!1){var p,m,S,C,nt,_t,jt,Qt,Ft;let i=a(this,V,w),n=Date.now();t.controlGroup?(t.scores={},t.sessionScores={}):(y(this,et,$t).call(this,t.scores),y(this,et,$t).call(this,t.sessionScores),(m=(p=a(this,v)).decay)==null||m.call(p,{now:n,lastUpd:i==null?void 0:i.updated,scores:t.scores,sessionScores:t.sessionScores,onLogMessage:a(this,v).onLogMessage}));let s=!(0,L.dequal)(i==null?void 0:i.visitorData.scores,t.scores),o=!(0,L.dequal)(i==null?void 0:i.visitorData.sessionScores,t.sessionScores),u=!(0,L.dequal)(i==null?void 0:i.visitorData.quirks,t.quirks),c=!(0,L.dequal)(i==null?void 0:i.visitorData.tests,t.tests),l={updated:n,visitorData:t};y(this,mt,me).call(this),a(this,q).set(pt,l,!!t.consent),(C=(S=a(this,v)).onLogMessage)==null||C.call(S,["debug",102,t]),r||((s||o)&&a(this,T).emit("scoresUpdated",t),u&&a(this,T).emit("quirksUpdated",t),c&&a(this,T).emit("testsUpdated",t),((nt=i==null?void 0:i.visitorData)==null?void 0:nt.consent)!==t.consent&&a(this,T).emit("consentUpdated",t),((_t=i==null?void 0:i.visitorData)==null?void 0:_t.controlGroup)!==t.controlGroup&&(a(this,T).emit("controlGroupUpdated",t),(Ft=(Qt=a(this,v)).onLogMessage)==null||Ft.call(Qt,["debug",104,(jt=t.controlGroup)!=null?jt:!1])))},mt=new WeakSet,me=function(){typeof document=="undefined"||!a(this,v).visitLifespan||(a(this,j)&&window.clearTimeout(a(this,j)),h(this,j,window.setTimeout(()=>{this.data},a(this,v).visitLifespan+50)))},ht=new WeakSet,he=function(t){let r=a(this,v).visitLifespan;return r?t.updated+r<Date.now():!1},et=new WeakSet,$t=function(t){var r,i;if(!!a(this,v).manifest)for(let n in t){let s=t[n],o=a(this,v).manifest.getDimensionByKey(n);!o||s>o.cap&&((i=(r=a(this,v)).onLogMessage)==null||i.call(r,["debug",110,{dim:n,score:s,cap:o.cap}]),t[n]=o.cap)}},rt=new WeakSet,Nt=function(){var t,r,i;return{...Z(),consent:(t=a(this,v).defaultConsent)!=null?t:!1,controlGroup:(i=(r=a(this,v).manifest)==null?void 0:r.rollForControlGroup())!=null?i:!1}};var ve=N(require("mitt"));function At({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=[],p=!1,m=t.scores;for(let S of r){if(l.length===i)break;if(!((o=S.pz)!=null&&o.crit.length)){n==null||n(["info",301,"GROUP",{id:S.id,op:(u=S.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(S);continue}c||Gt(S.id,S.pz,m,n)&&(p=!0,l.push(S))}return{personalized:p,variations:l}}finally{n==null||n(["info",300,"ENDGROUP"])}}function Gt(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=>ge(s,r,i)):n=t.crit.some(s=>ge(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 ge(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 Q(r,l,e,s,o),l}else if(i===">="){let l=s>=o;return Q(r,l,e,s,o),l}else if(i==="<"){let l=s<o;return Q(r,l,e,s,o),l}else if(i==="<="){let l=s<=o;return Q(r,l,e,s,o),l}else if(i==="="){let l=s===o;return Q(r,l,e,s,o),l}else if(i==="!="){let l=s!==o;return Q(r,l,e,s,o),l}else throw new Error(`Unknown op: ${i}`)}function Q(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 ze=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},gt=({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=ze(r),u=Math.floor(Math.random()*100),c=0;n=r.find((l,p)=>{let m=o[p];if(u>c&&u<=c+m)return l;c+=m}),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 zt=require("dequal/lite"),x,O,k,it,g,F,vt,It=class{constructor(t){d(this,F);D(this,"manifest");d(this,x,void 0);d(this,O,{});d(this,k,void 0);d(this,it,{});d(this,g,(0,ve.default)());D(this,"events",{on:a(this,g).on,off:a(this,g).off});D(this,"storage");var n,s;let{manifest:r,...i}=t;h(this,k,{}),(n=t.plugins)==null||n.forEach(o=>{!o.logDrain||a(this,g).on("log",o.logDrain)}),a(this,g).emit("log",["info",1,"GROUP"]);try{this.manifest=new J({onLogMessage:o=>a(this,g).emit("log",o),manifest:r,evaluator:new A({CK:Ct,QS:xt,QK:bt,PVC:lt,EVT:Vt,PV:Et})}),this.storage=new tt({...i,manifest:this.manifest,onServerTransitionReceived:o=>{h(this,x,o),o.ssv&&(h(this,O,o.ssv),a(this,g).emit("log",["debug",130,o.ssv]))},onLogMessage:o=>a(this,g).emit("log",o)}),this.storage.events.on("scoresUpdated",y(this,F,vt).bind(this)),a(this,x)||y(this,F,vt).call(this,this.storage.data),this.storage.events.on("quirksUpdated",o=>{let u=this.manifest.computeSignals({scores:a(this,O),state:a(this,k),previousState:a(this,k),visitor:this.storage.data});this.storage.updateData(u),a(this,g).emit("quirksUpdated",o.quirks),a(this,g).emit("log",["info",4,o.quirks])}),(s=t.plugins)==null||s.forEach(o=>{!o.init||o.init(this)})}finally{a(this,g).emit("log",["info",1,"ENDGROUP"])}}get scores(){return a(this,O)}get quirks(){var t,r;return(r=(t=a(this,x))==null?void 0:t.quirks)!=null?r:this.storage.data.quirks}async update(t){var i,n,s;let r=[];(i=a(this,x))!=null&&i.quirks&&(t={...t,quirks:{...a(this,x).quirks,...t.quirks||{}}}),(n=a(this,x))!=null&&n.tests&&r.push(...Object.entries(a(this,x).tests).map(([o,u])=>({type:"settest",data:{test:o,variant:u}})));try{a(this,g).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=Y(o.cat,o.key);this.manifest.getDimensionByKey(u)?r.push({type:"modscore",data:{dimension:u,delta:o.str}}):a(this,g).emit("log",["warn",5,o])}),r.push(...this.manifest.computeSignals({state:t,previousState:a(this,k),visitor:this.storage.data,scores:a(this,O)})),h(this,k,{...a(this,k),...t}),await this.storage.updateData(r),a(this,x)&&(y(this,F,vt).call(this,this.storage.data),h(this,x,void 0),a(this,g).emit("log",["debug",131]))}finally{a(this,g).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,g).emit("log",["warn",401,t]),null)}setTestVariantId(t,r){this.storage.updateData([{type:"settest",data:{test:t,variant:r}}])}log(...t){a(this,g).emit("log",t)}test(t){var i,n;let r=gt({...t,context:this,onLogMessage:s=>a(this,g).emit("log",s)});return a(this,g).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=At({...t,context:this,onLogMessage:s=>a(this,g).emit("log",s)}),i=a(this,it)[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,zt.dequal)(n.variantIds,i)&&(n.changed=!1),a(this,g).emit("personalizationResult",n),a(this,it)[t.name]=n.variantIds,r}async forget(t){h(this,k,{}),await this.storage.delete(t)}};x=new WeakMap,O=new WeakMap,k=new WeakMap,it=new WeakMap,g=new WeakMap,F=new WeakSet,vt=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,zt.dequal)(r,a(this,O))&&(h(this,O,r),a(this,g).emit("scoresUpdated",r),a(this,g).emit("log",["info",3,r]))};var Se=N(require("rfdc"));function St(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 Ie=(0,Se.default)();function ye(e){return([t,...r])=>{if(!St(e,t))return;let[i,...n]=r;console[t](`\u{1F94B} [${t}] Uniform event ID ${i} | ||
`,...n.map(Ie))}}function qe(e){return{logDrain:ye(e)}}var De={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 Ce=N(require("rfdc")),_e=(0,Ce.default)();function xe(e,t){let r=typeof document=="undefined",{enableOnServer:i=!1}=t!=null?t:{};return([n,...s])=>{if(!St(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=De[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 m=p;if(!l){c(`${m} unknown event ID ${o}. Log messages data may be older than Uniform Context package.`,...u);return}let[S,C,...nt]=l(...u);c(`${m}[${S}] ${C} | ||
`,...nt.map(_e))}}function je(e,t){return{logDrain:xe(e,t)}}var be=(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))(be||{}),Qe="nesitag";var qt=typeof top!="undefined";function Fe(){return{logDrain:e=>{!qt||top==null||top.postMessage({type:"uniform:context:log",message:e},window.location.origin)},init:e=>{let t=[],r=[],i=()=>{!qt||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(qt){window.__UNIFORM_DEVTOOLS_CONTEXT_INSTANCE__=e;try{top==null||top.addEventListener("message",async o=>{if(!o.data)return;let u=o.data;await Ke(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 Ke(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 He(e){return`${e.apiKey}|${e.projectId}${e.apiHost?`|${e.apiHost}`:""}`}function Be(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.194+4ec8d4fea", | ||
"version": "16.0.1-alpha.221+a3ca75662", | ||
"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.194+4ec8d4fea", | ||
"@uniformdev/cli": "^16.0.1-alpha.221+a3ca75662", | ||
"benny": "3.7.1", | ||
@@ -73,3 +73,3 @@ "yargs": "17.5.1" | ||
}, | ||
"gitHead": "4ec8d4feac57ef54a0c53203a938611900385c3a" | ||
"gitHead": "a3ca7566254cda6539ae81923567cc06754241aa" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
687831
5162