1System.register([],function(f){"use strict";return{execute:function(){const p=()=>typeof window>"u";var T="3.5.1";function te(){let e=window?.tracking?.visit();if(e)return e;const t=document.cookie.split(";").find(n=>n.trim().startsWith("visit"));return t&&(e=t.split("=")[1].trim()),e}function ne(){const e=async r=>await fetch(re(window.location.hostname),{method:"POST",body:r,headers:{"Content-Type":"application/json"}}),t={},n=Math.random().toString(36).substring(2,15);return{log:async(...r)=>{try{const i=r.reduce((o,s)=>{const c=typeof s=="string"?s:s.message;if(t[c])return o;t[c]=!0;let a={};return typeof s=="string"?a.message=s:a={...s},o.push(a),o},new Array);if(i.length===0)return;await e(JSON.stringify([{common:{attributes:{host:window.location.href,agent:window.navigator.userAgent,serviceName:"ab-reader",visit:te(),version:T,logtype:"browser",logsId:n}},logs:i}]))}catch(i){console.error("ab-reader failed sending logs",JSON.stringify(i))}}}}function re(e){let t="https://nrlogger-prod.cf-exp.vpsvc.com?partition=exp";return(e==="localhost"||e.startsWith("staging"))&&(t="https://nrlogger-dev.cf-exp.vpsvc.com?partition=exp"),t}const w=()=>window?.abReader||{getVariation:()=>null,getAllExperiments:()=>[],checkFeature:()=>null,isAvailable:()=>!1,getTestUserId:()=>null,fireImpression:()=>!1,fireFeatureImpression:()=>!1},ie=ne();let F=()=>{};const oe=e=>{F=e},I="ab-script-loaded",V=(e,t,n=!1)=>
1{if(p())return!1;const r=t?` with experiment key [${t}]`:"";return window.abReaderInitialized?!0:(n||k({message:`Library not initialized before using method ${e}${r}.`}),!1)},h=(e,t,n)=>{try{return e()}catch(r){k({message:`ab-reader library failed when calling ${t}.`,error:JSON.stringify(r)})}return n},ct=f("isAvailable",()=>V("isAvailable")?S():!1),S=()=>h(()=>window.abReader?.isAvailable()??!1,"isAvailable",!1),se=e=>y("checkFeature",e)?h(()=>w().checkFeature(e),"checkFeature",null):null,ae=f("getVariation",e=>y("getVariation",e)?h(()=>w().getVariation(e),"getVariation",null):null),lt=f("getAllExperiments",()=>y("getAllExperiments")?h(w().getAllExperiments,"getAllExperiments",[]):[]),ce=f("fireImpression",(e,t,n)=>$(()=>w().fireImpression(e,t,n||null,T),"fireImpression")),le=f("fireFeatureImpression",(e,t,n)=>$(()=>w().fireFeatureImpression(e,t,n?"true":"false",T),"fireFeatureImpression")),$=(e,t)=>{p()&&k({message:`${t} called serverside. `,error:"Tracking is not available."});const n=()=>h(e,t,!1),r=async()=>{n(),window.removeEventListener(I,r)};return y(t,void 0,!0)?n():(window.abReaderInitialized||F(),window.addEventListener(I,r),!1)},ut=f("getTestUserId",()=>y("getTestUserId")?h(w().getTestUserId,"getTestUserId",null):null),dt=f("waitTillAvailable",e=>new Promise(t=>{ue(n=>t(!!n),e)})),ue=f("whenAvailable",(e,t)=>{if(p()){e(!1);return}if(S()){e(!0);return}let n;const r=new Promise(m=>{n=m}),i=()=>{window.removeEventListener(I,i),S()?n(!0):a()},o=()=>{window.addEventListener(I,i)},s="variationsResolved",c=()=>{window.removeEventListener(s,c),n(!0)},a=()=>{window.addEventListener(s,c)},u=[r];t&&u.push(new Promise(m=>{setTimeout(m,t)})),window.abReader?a():o(),Promise.race(u).then(()=>{e(S())})}),ft=f("activate",e=>{const t=ae(e);return t&&ce(e,t),t}),mt=f("isFeatureEnabled",e=>{const t=se(e);return t!==null&&(le(t.featureName,t.ruleId,t.enabled==="true"),t.enabled==="true")}),y=(e,t,n=!1)=>
1{if(!V(e,t,n))return!1;const r=t?` with experiment key [${t}]`:"";return window.abReader===void 0?(n||k({message:`ab-reader library not ready before using method ${e}${r}.`}),!1):!0},g={logs:[]};function k(e){const t=async()=>{g.logs.length!==0&&(ie.log(...g.logs),g.logs=[],g.timeoutId=void 0)};g.logs.push(e),g.timeoutId&&clearTimeout(g.timeoutId),g.timeoutId=window.setTimeout(()=>{t()},1e3)}function A(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function de(e){if(Array.isArray(e))return e}function fe(e){if(Array.isArray(e))return A(e)}function me(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,ke(r.key),r)}}function ge(e,t,n){return t&&pe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function ve(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=_(e))||t){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(a){throw a},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. 2In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o,s=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var a=n.next();return s=a.done,a},e:function(a){c=!0,o=a},f:function(){try{s||n.return==null||n.return()}finally{if(c)throw o}}}}function we(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function he(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,o,s,c=[],a=!0,u=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(a=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);a=!0);}catch(m){u=!0,i=m}finally{try{if(!a&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(u)throw i}}return c}}function Ie(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 3In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ye(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 4In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function be(e,t){return de(e)||he(e,t)||_(e,t)||Ie()}function xe(e){return fe(e)||we(e)||_(e)||ye()}function Se(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function ke(e){var t=Se(e,"string");return typeof t=="symbol"?t:t+""}function _(e,t){if(e){if(typeof e=="string")return A(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?A(e,t):void 0}}var Ee=function(t){var n=document.cookie?document.cookie.split("; "):[],r=ve(n),i;try{for(r.s();!(i=r.n()).done;){var o=i.value,s=o.split("=");if(s[0]===t)return s.slice(1).join("=")}}catch(c){r.e(c)}finally{r.f()}return null},Te=function(t,n,r){var i=["".concat(t,"=").concat(n)].concat(xe(Object.entries(r||{}).map(function(o){var s=be(o,2),c=s[0],a=s[1];return"".concat(c,"=").concat(a)})));document.cookie=i.join("; ")};const l=[];for(let e=0;e<256;++e)l.push((e+256).toString(16).slice(1));function Ae(e,t=0){return(l[e[t+0]]+l[e[t+1]]+l[e[t+2]]+l[e[t+3]]+"-"+l[e[t+4]]+l[e[t+5]]+"-"+l[e[t+6]]+l[e[t+7]]+"-"+l[e[t+8]]+l[e[t+9]]+"-"+l[e[t+10]]+l[e[t+11]]+l[e[t+12]]+l[e[t+13]]+l[e[t+14]]+l[e[t+15]]).toLowerCase()}let C;const _e=new Uint8Array(16);function Ce(){if(!C){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");C=crypto.getRandomValues.bind(crypto)}return C(_e)}var N={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Ue(e,t,n){if(N.randomUUID&&!e)return N.randomUUID();e=e||{};const r=e.random??e.rng?.()??Ce();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=r[6]&15|64,r[8]=r[8]&63|128,Ae(r)}var P="testUserId",Oe=function(){function e(){me(this,e)}return ge(e,[{key:"ensureUserTestId",value:function(){var n=this.getUserIdFromCookie(P);return n||(n=this.setNewUserIdCookie()),n}},{key:"getUserIdFromCookie",value:function(n){var r=Ee(n);if(r)return r}},{key:"setNewUserIdCookie",value:function(){var n={"max-age":15552e3,path:"/"},r=Ue();return Te(P,r,n),r}}]),e}(),Le=new Oe,b=function(){return Le.ensureUserTestId()},x={},j;function Re(){if(j)return x;j=1,Object.defineProperty(x,"__esModule",{value:!0}),x.isBot=void 0;var e=/bot|crawl|spider|AutoIt|requests|microsoft office|CFNetwork|Scrapy|k6\.io|vp-digital-image-processor|feed|facebookexternal|github\.com/i,t=function(n){return n?e.test(n):!1};return x.isBot=t,x}var Fe=Re();const D="expCtx",Ve="expFlagCtx",z="expIsQA",B="exp-ab-impression-v2",$e="expCtxInit",H=12e4,Ne=6e5,M=21e3,v={experiments:new Map([]),features:new Map([])},J=()=>{if(p())return!1;const e=window.location.search?.includes("exp_param_ignore");return e&&console.debug("(exp_param_ignore) Bypass experimentation"),e},Pe=()=>window.location.hostname?.endsWith("proshopnext.com")||window.location.hostname?.endsWith("ourproshop.com"),je=()=>{if(p()||!["localhost","127.0.0.1"].includes(window.location.hostname))return;const e=window.location.search,t="exp_e_",n="exp_f_";(e?.includes(t)||e?.includes(n))&&new URLSearchParams(e).forEach((o,s)=>{s.startsWith(t)&&v.experiments.set(s.replace(t,""),o),s.startsWith(n)&&v.features.set(s.replace(n,""),o)})},W=(()=>
4{if(p())return null;const e="overrideInitTimeout";if(window.location.search?.includes(e)){console.debug(`(${e}) Override init timeout`);const n=new URLSearchParams(window.location.search);return parseInt(n.get(e)||"")}return null})()||60*60*1e3,U=e=>localStorage.getItem(e)||"";function E(e){const t=document.cookie.split(";");for(const n of t){const[r,i]=n.trim().split("=");if(r===e)return i}return null}const d=(e,t)=>{console.warn(`AB reader failed in ${e}`,t)},X=()=>{try{if(J()||!L())return[];const e=U(D);if(e){const t=q(e,"|",Xe);return v.experiments.forEach((n,r)=>{let i=!1;t.forEach(o=>{o.experimentKey===r&&(i=!0,o.variationKey=n)}),i||t.push({experimentKey:r,variationKey:n})}),t}}catch(e){d("getAllExperiments",e)}return[]},De=e=>{try{const t=v.experiments.get(e);if(t)return t;const r=X().find(i=>i.experimentKey===e);return r?r.variationKey:null}catch(t){return d("getVariation",t),null}},ze=()=>{try{if(J()||!L())return[];const e=U(Ve);if(e)return q(e,"|",qe)}catch(e){d("getAllFeatures",e)}return[]},Be=e=>{try{const t=v.features.get(e);return t?{enabled:t,featureName:e,ruleId:"override"}:ze().find(i=>i.featureName===e)??null}catch(t){return d("getVariation",t),null}},O=()=>{try{return R()||v.experiments.size>0||v.features.size>0?!0:!!U(D)}catch(e){return d("isAvailable",e),!1}},He=e=>{e(O())},Me=()=>b();function Je(e,t,n,r){if(!e||!t)return d("fireImpression",`Invalid input parameters for the fireImpression ${JSON.stringify({experimentKey:e,variationKey:t})}`),!1;let i={experimentName:e,variationName:t,impressionEventVersion:3,abReaderVersion:r||"3"};n&&(n.pageName&&n.pageSection&&n.pageStage?i={...i,pageName:n.pageName,pageSection:n.pageSection,pageStage:n.pageStage}:d("fireImpression","Page parameters format is wrong"));try{if(G(e,t))return!1;const o=E(z)==="1";return ee("Experiment Viewed",i),Z(e,t,o?M:H),!0}catch(o){return d("fireImpression",o),!1}}function We(e,t,n,r){if(!e||!t||!n)return d("fireImpression",`Invalid input parameters for the fireFeatureImpression ${JSON.stringify({featureName:e,ruleId:t,enabled:n})}`),!1;try{if(G(e,n)||t==="disabled")return!1;const i={flagName:e,passes:n==="true",ruleId:t,abReaderVersion:r||"3"},o=E(z)==="1";return ee("Experiment Flag Viewed",i),Z(e,n,o?M:Ne),!0}catch(i){return d("fireFeatureImpression",i),!1}}const q=(e,t,n)=>{const r=[],i=new Set,o=e.split("~");return o!==null&&o.length===2&&o[1].split(t).forEach(a=>{const u=n(a);u?.key&&(i.has(u.key)?console.debug(`Exp: context has more than one instance of key ${u.key}`,e):(i.add(u.key),r.push(u.entry)))}),r},Xe=e=>{const t=e.split(":");return t.length!=2?(console.debug("Exp context is malformed: ",e),null):{key:t[0].trim(),entry:{experimentKey:t[0].trim(),variationKey:t[1].trim()}}},qe=e=>{const t=e.split("^");return t.length!=3?(console.debug("Features context is malformed: ",e),null):{key:t[0].trim(),entry:{featureName:t[0].trim(),ruleId:t[1].trim(),ruleName:t[1].trim(),enabled:t[2].trim()}}},Ke=()=>{try{const e=document.getElementById("ubik-user-context");if(!e?.innerText)return{};const t=JSON.parse(e.innerText);return{tenant:t?.tenant??t?.Tenant,locale:t?.locale??t?.Locale}}catch{return{}}},Qe=["localhost","127.0.0.1"],Ye="vistaprint",Ge="vp-experimentation-tenant",Ze="vp-experimentation-locale",et=/(^|\/)experimentation(\/|$)/,tt=()=>et.test(window.location.pathname)?{tenant:E(Ge)??void 0,locale:E(Ze)??void 0}:{},K=()=>{const e=Ke();if(e.tenant)return e;const t=tt();return t.tenant?t:{}},nt=e=>{const t=e?.locales?.supported;if(Array.isArray(t)&&t.length===1)return e.locales?.primary??t[0]},rt=async()=>{const e=K();if(e.tenant)return e;const t=window.location.hostname;if(Qe.includes(t))return{tenant:Ye};try{const n=window.location.pathname,r=await fetch(`https://api.experience.cimpress.io/tenants/v1/resolve?domain=${encodeURIComponent(t)}&path=${encodeURIComponent(n)}`);if(!r.ok)return{};const i=await r.json();return{tenant:i?.tenant,locale:i?.tenant?nt(i):void 0}}catch{return{}}},Q=async()=>{try{const e=b(),t=Date.now(),{tenant:n,locale:r}=await rt(),i=n?`&tenant=${n}`:"",o=r?`&locale=${encodeURIComponent(r)}`:"";(await(await fetch(`https://context-init-prod.cf-exp.vpsvc.com/?requestUrl=${encodeURIComponent(window.location.origin)}&testUserId=${e}&expIsClientSide=1${i}${o}
4`)).json()).forEach(a=>{if(a.destination==="client"&&a.name==="Set-Cookie"&&(document.cookie=a.value),a.destination==="client"&&a.name==="Add-Script"){const u=/localStorage\.setItem\(\s*"(?<key>\w+)"\s*,\s*"(?<value>[^\s]+)"\s*\)/g;let m=null,at=5;do m=u.exec(a.value)?.groups,m?.key&&localStorage.setItem(m.key,m.value);while(m!=null&&--at>0)}}),window.dispatchEvent(new Event("variationsResolved")),localStorage.setItem("expCtxInit",JSON.stringify({testUserId:e,timestamp:t,tenant:n,locale:r}))}catch{console.warn("Experiment conext initialization failed")}};function Y(){const e={testUserId:b(),experimentsV2:{}};try{const t=JSON.parse(localStorage.getItem(B)||"{}");if(t&&t.testUserId===b()){const n=new Date().getTime();return t.experimentsV2=Object.entries(t.experimentsV2||{}).reduce((r,[i,o])=>(o._ttl>n&&(r[i]=o),r),{}),t}}catch(t){d("fireImpression",t)}return e}function G(e,t){return Y().experimentsV2[e]?.variation===t}function Z(e,t,n=H){const r=Y();r.experimentsV2[e]={variation:t,_ttl:new Date().getTime()+n},localStorage.setItem(B,JSON.stringify(r))}function ee(e,t){if(window?.tracking?.track)n();else{const r=new Date().getTime();window.addEventListener("trackingReady",function(){n(new Date().getTime()-r)})}function n(r){if(!window?.tracking?.track){console.debug("ab-reader: tracking still not available");return}t.trackingDelay=r??0,window.tracking.track(e,t)}}function it(e){const t=K(),n=(r,i)=>!!r&&!!i&&r.toLowerCase()!==i.toLowerCase();return n(t.tenant,e.tenant)||n(t.locale,e.locale)}function L(){try{if(R())return!0;const e=localStorage.getItem($e);if(!e)return console.debug("ab-reader: unknown context init details"),!0;const t=JSON.parse(e);return b()!==t.testUserId?(console.debug("ab-reader: mismatched user id"),!1):Date.now()-t.timestamp>W?(console.debug("ab-reader: stale context"),!1):it(t)?(console.debug("ab-reader: mismatched site context"),!1):!0}catch(e){return d("isValidContext",e),!1}}const R=()=>p()?!1:Fe.isBot(window.navigator?.userAgent);(function(){!p()&&!Pe()&&(je(),setTimeout(()=>{window.abReaderInitialized=!0,R()||setInterval(()=>{Q()},W),(!O()||!L())&&Q()},200))})();var ot=Object.freeze({__proto__:null,checkFeature:Be,fireFeatureImpression:We,fireImpression:Je,getAllExperiments:X,getTestUserId:Me,getVariation:De,isAvailable:O,whenAvailable:He});const st=f("initialize",()=>{p()||window.abReaderInitialized||(window.abReader=ot,window.dispatchEvent(new CustomEvent(I)),window.abReaderInitialized=!0)});oe(st)}}}); 5//# sourceMappingURL=ab-reader-BBf4WTai.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.