<!-- 2025-08-12T09:54:34.6136604Z -->
<style>.shoplift-hide { opacity: 0 !important; }</style>
<style id="sl-preview-bar-hide">#preview-bar-iframe, #PBarNextFrameWrapper { display: none !important; }</style>
<script type="text/javascript">(function(rootPath, template, themeRole, themeId, isThemePreview){ /* Generated on 2025-10-08T21:00:01.1642276Z */var se=Object.defineProperty;var re=(T,C,k)=>C in T?se(T,C,{enumerable:!0,configurable:!0,writable:!0,value:k}):T[C]=k;var m=(T,C,k)=>re(T,typeof C!="symbol"?C+"":C,k);(function(){"use strict";var T=document.createElement("style");T.textContent=`#shoplift-preview-control{position:fixed;max-width:332px;height:56px;background-color:#141414;z-index:9999;bottom:20px;display:flex;border-radius:8px;box-shadow:13px 22px 7px #0000,9px 14px 7px #00000003,5px 8px 6px #0000000d,2px 4px 4px #00000017,1px 1px 2px #0000001a,0 0 #0000001a;align-items:center;margin:0 auto;left:16px;right:16px;opacity:0;transform:translateY(20px);visibility:hidden;transition:opacity .4s ease-in-out,transform .4s ease-in-out,visibility 0s .4s}#shoplift-preview-control.visible{opacity:1;transform:translateY(0);visibility:visible;transition:opacity .4s ease-in-out,transform .4s ease-in-out,visibility 0s 0s}#shoplift-preview-control *{font-family:Inter,sans-serif;color:#fff;box-sizing:border-box;font-size:16px}#shoplift-preview-variant-title{font-weight:400;line-height:140%;font-size:16px;text-align:start;letter-spacing:-.16px;flex-grow:1;text-wrap:nowrap;overflow:hidden;text-overflow:ellipsis}#shoplift-preview-variant-selector{position:relative;display:block;padding:6px 0;height:100%;min-width:0;flex:1 1 auto}#shoplift-preview-variant-menu-trigger{border:none;cursor:pointer;width:100%;background-color:transparent;padding:0 16px;border-left:1px solid #333;border-right:1px solid #333;height:100%;display:flex;align-items:center;justify-content:start;gap:8px}#shoplift-preview-variant-selector .menu-variant-label{width:24px;height:24px;border-radius:50%;padding:6px;display:flex;justify-content:center;align-items:center;font-size:12px;font-style:normal;font-weight:600;line-height:100%;letter-spacing:-.12px;flex-shrink:0}#shoplift-preview-variant-selector .preview-variant-menu{position:absolute;bottom:110%;transform:translate3d(0,20px,0);visibility:hidden;pointer-events:none;opacity:0;cursor:pointer;background-color:#141414;border:1px solid #141414;border-radius:6px;width:100%;max-height:156px;overflow-y:auto;box-shadow:0 8px 16px #0003;z-index:1;transition:opacity .3s ease-in-out,transform .3s ease-in-out,visibility 0s .3s}#shoplift-preview-variant-selector .preview-variant-menu.preview-variant-menu__visible{visibility:visible;pointer-events:auto;opacity:100;transform:translateZ(0);transition:opacity .3s ease-in-out,transform .3s ease-in-out,visibility 0s 0s}@media screen and (max-width: 400px){#shoplift-preview-variant-selector .preview-variant-menu{position:fixed;left:0;right:0;width:auto;bottom:110%}}#shoplift-preview-variant-selector .preview-variant-menu .preview-variant-menu--item{padding:12px 16px;display:flex;overflow:hidden}#shoplift-preview-variant-selector .preview-variant-menu .preview-variant-menu--item .menu-variant-label{margin-right:6px}#shoplift-preview-variant-selector .preview-variant-menu .preview-variant-menu--item span{overflow:hidden;text-overflow:ellipsis;text-wrap:nowrap;white-space:nowrap;color:#f6f6f6;font-size:14px;font-style:normal;font-weight:500}#shoplift-preview-variant-selector .preview-variant-menu .preview-variant-menu--item:hover{background-color:#545454}#shoplift-preview-variant-selector .preview-variant-menu .preview-variant-menu--item:last-of-type{border-bottom-left-radius:6px;border-bottom-right-radius:6px}#shoplift-preview-variant-selector .preview-variant-menu .preview-variant-menu--item:first-of-type{border-top-left-radius:6px;border-top-right-radius:6px}#shoplift-preview-control div:has(#shoplift-exit-preview-button){padding:0 16px}#shoplift-exit-preview-button{padding:6px 8px;font-weight:500;line-height:75%;border-radius:4px;background-color:transparent;border:none;text-decoration:none}#shoplift-exit-preview-button:hover{cursor:pointer;background-color:#333}`,document.head.appendChild(T);var C=" daum[ /]| deusu/| yadirectfetcher|(?:^|[^g])news(?!sapphire)|(?<! (?:channel/|google/))google(?!(app|/google| pixel))|(?<! cu)bots?(?:\\b|_)|(?<!(?: ya| yandex|^job|inapp;) ?)search|(?<!(?:lib))http|(?<![hg]m)score|@[a-z][\\w-]+\\.|\\(\\)|\\.com|\\b\\d{13}\\b|^<|^[\\w \\.\\-\\(?:\\):]+(?:/v?\\d+(?:\\.\\d+)?(?:\\.\\d{1,10})*?)?(?:,|$)|^[^ ]{50,}$|^\\d+\\b|^\\w+/[\\w\\(\\)]*$|^active|^ad muncher|^amaya|^avsdevicesdk/|^biglotron|^bot|^bw/|^clamav[ /]|^client/|^cobweb/|^custom|^ddg[_-]android|^discourse|^dispatch/\\d|^downcast/|^duckduckgo|^facebook|^getright/|^gozilla/|^hobbit|^hotzonu|^hwcdn/|^jeode/|^jetty/|^jigsaw|^microsoft bits|^movabletype|^mozilla/\\d\\.\\d \\(compatible;?\\)$|^mozilla/\\d\\.\\d \\w*$|^navermailapp|^netsurf|^offline|^owler|^postman|^python|^rank|^read|^reed|^rest|^rss|^snapchat|^space bison|^svn|^swcd |^taringa|^thumbor/|^track|^valid|^w3c|^webbandit/|^webcopier|^wget|^whatsapp|^wordpress|^xenu link sleuth|^yahoo|^yandex|^zdm/\\d|^zoom marketplace/|^{{.*}}$|admin|analyzer|archive|ask jeeves/teoma|bit\\.ly/|bluecoat drtr|browsex|burpcollaborator|capture|catch|check|chrome-lighthouse|chromeframe|classifier|clean|cloud|crawl|cypress/|dareboost|datanyze|dejaclick|detect|dmbrowser|download|evc-batch/|feed|firephp|gomezagent|headless|httrack|hubspot marketing grader|hydra|ibisbrowser|images|insight|inspect|iplabel|ips-agent|java(?!;)|library|mail\\.ru/|manager|measure|neustar wpm|node|nutch|offbyone|optimize|pageburst|pagespeed|parser|perl|phantomjs|pingdom|powermarks|preview|proxy|ptst[ /]\\d|reputation|resolver|retriever|rexx;|rigor|rss\\b|scan|scrape|server|sogou|sparkler/|speedcurve|spider|splash|statuscake|synapse|synthetic|tools|torrent|trace|transcoder|url|virtuoso|wappalyzer|watch|webglance|webkit2png|whatcms/|zgrab",k=/bot|spider|crawl|http|lighthouse/i,A;function U(){if(A instanceof RegExp)return A;try{A=new RegExp(C,"i")}catch{A=k}return A}function N(c){return!!c&&U().test(c)}class E{constructor(){m(this,"timestamp");this.timestamp=new Date}}class F extends E{constructor(t,i,s){super();m(this,"type");m(this,"testId");m(this,"hypothesisId");this.type=3,this.testId=t,this.hypothesisId=i,this.timestamp=s}}class D extends E{constructor(t){super();m(this,"type");m(this,"path");this.type=4,this.path=t}}class H extends E{constructor(t){super();m(this,"type");m(this,"cart");this.type=5,this.cart=t}}class L extends Error{constructor(){super();m(this,"isBot");this.isBot=!0}}function z(c,e,t){for(const i of e.selectors){const s=c.querySelectorAll(i.cssSelector);for(let r=0;r<s.length;r++)t(e.testId,e.hypothesisId)}V(c,e,(i,s,r,o,n)=>n(s,r),t)}function I(c,e,t){for(const i of e.selectors)_(c,e.testId,e.hypothesisId,i,t??(()=>{}));V(c,e,_,t??(()=>{}))}function j(c){return c.urlPatterns.reduce((e,t)=>{switch(t.operator){case"contains":return e+`.*${t}.*`;case"endsWith":return e+`.*${t}`;case"startsWith":return e+`${t}.*`}},"")}function V(c,e,t,i){new MutationObserver(()=>{for(const r of e.selectors)t(c,e.testId,e.hypothesisId,r,i)}).observe(c.documentElement,{childList:!0,subtree:!0})}function _(c,e,t,i,s){const r=c.querySelectorAll(i.cssSelector);for(let o=0;o<r.length;o++){let n=r.item(o);if(n instanceof HTMLElement&&n.dataset.shoplift!==""){n.dataset.shoplift="";for(const l of i.actions.sort(Q))n=B(c,i.cssSelector,n,l)}}return r.length>0&&s?(s(e,t),!0):!1}function B(c,e,t,i){switch(i.type){case"innerHtml":t.innerHTML=i.value;break;case"attribute":G(t,i.scope,i.value);break;case"css":J(c,e,i.value);break;case"js":K(c,t,i);break;case"copy":return W(t);case"remove":Y(t);break;case"move":Z(t,parseInt(i.value));break}return t}function G(c,e,t){c.setAttribute(e,t)}function J(c,e,t){var s;const i=c.createElement("style");i.innerHTML=`${e} { ${t} }`,(s=c.getElementsByTagName("head")[0])==null||s.appendChild(i)}function K(c,e,t){Function("document","element",`"use strict"; ${t.value}`)(c,e)}function W(c){const e=c.cloneNode(!0);if(!c.parentNode)throw"Can't copy node outside of DOM";return c.parentNode.insertBefore(e,c.nextSibling),e}function Y(c){c.remove()}function Z(c,e){if(e===0)return;const t=Array.prototype.slice.call(c.parentElement.children).indexOf(c),i=Math.min(Math.max(t+e,0),c.parentElement.children.length-1);c.parentElement.children.item(i).insertAdjacentElement(e>0?"afterend":"beforebegin",c)}function Q(c,e){return O(c)-O(e)}function O(c){return c.type==="copy"||c.type==="remove"?0:1}var S=(c=>(c[c.Template=0]="Template",c[c.Theme=1]="Theme",c[c.UrlRedirect=2]="UrlRedirect",c[c.Script=3]="Script",c[c.Dom=4]="Dom",c[c.Price=5]="Price",c))(S||{});const X="data:image/svg+xml,%3csvg%20width='12'%20height='12'%20viewBox='0%200%2012%2012'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M9.96001%207.90004C9.86501%207.90004%209.77001%207.86504%209.69501%207.79004L6.43501%204.53004C6.19501%204.29004%205.80501%204.29004%205.56501%204.53004L2.30501%207.79004C2.16001%207.93504%201.92001%207.93504%201.77501%207.79004C1.63001%207.64504%201.63001%207.40504%201.77501%207.26004L5.03501%204.00004C5.56501%203.47004%206.43001%203.47004%206.96501%204.00004L10.225%207.26004C10.37%207.40504%2010.37%207.64504%2010.225%207.79004C10.15%207.86004%2010.055%207.90004%209.96001%207.90004Z'%20fill='white'/%3e%3c/svg%3e",ee="data:image/svg+xml,%3csvg%20width='14'%20height='24'%20viewBox='0%200%2014%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M12.3976%2014.5255C12.2833%2013.8788%2012.0498%2013.3024%2011.6952%2012.7961C11.3416%2012.2898%2010.9209%2011.8353%2010.4353%2011.4317C9.94868%2011.0291%209.43546%2010.6488%208.89565%2010.292C8.48487%2010.049%208.09577%209.78565%207.72637%209.50402C7.35697%209.2224%207.08016%208.89503%206.89694%208.51987C6.71273%208.14471%206.67826%207.69533%206.79055%207.1697C6.86345%206.83216%206.97476%206.54647%207.12351%206.31162C7.27324%206.07778%207.47124%205.89986%207.7175%205.77684C7.96377%205.65483%208.21989%205.59383%208.48389%205.59383C8.88087%205.59383%209.17639%205.7016%209.3734%205.91714C9.56943%206.13268%209.68271%206.42345%209.71424%206.78946C9.74576%207.15547%209.72015%207.55401%209.63839%207.98509C9.55663%208.41617%209.43645%208.84724%209.27687%209.27934L13.5127%208.80149C13.9638%207.52656%2014.1017%206.42447%2013.9264%205.49725C13.751%204.56901%2013.2664%203.85122%2012.4724%203.34491C12.239%203.19648%2011.9779%203.07041%2011.6893%202.96569L12.0026%201.50979L9.86397%200L7.3875%201.50979L7.11169%202.78878C6.65166%202.8874%206.21724%203.01957%205.8114%203.19038C4.85292%203.594%204.06684%204.15115%203.45117%204.86385C2.83452%205.57655%202.42571%206.40108%202.22378%207.33847C2.06616%208.06947%202.04942%208.70796%202.17551%209.25087C2.30061%209.7948%202.52028%2010.2828%202.8355%2010.7139C3.14974%2011.145%203.51816%2011.5344%203.93977%2011.881C4.36039%2012.2288%204.782%2012.5521%205.20164%2012.851C5.68334%2013.1702%206.13844%2013.5169%206.56497%2013.8921C6.99052%2014.2672%207.31954%2014.7125%207.55004%2015.228C7.78055%2015.7445%207.81502%2016.3769%207.65347%2017.1262C7.56482%2017.5389%207.43676%2017.8765%207.27028%2018.1388C7.10381%2018.4011%206.89596%2018.5983%206.64772%2018.7295C6.3985%2018.8606%206.12071%2018.9267%205.8114%2018.9267C5.21641%2018.9267%204.79776%2018.6034%204.62833%2018.1632C4.4589%2017.7229%204.47367%2017.2583%204.60075%2016.5639C4.72782%2015.8705%205.05092%2015.1395%205.37107%2014.3699H1.17665C1.17665%2014.3699%200.207341%2016.1115%200.0310135%2017.6762C-0.0655232%2018.5302%200.0635208%2019.2653%200.41519%2019.8844C0.76686%2020.5036%201.33032%2020.9814%202.10655%2021.319C2.39222%2021.443%202.7104%2021.5447%203.05813%2021.623L2.54589%2024H7.17473L7.7047%2021.5386C8.08493%2021.442%208.43857%2021.3231%208.76562%2021.1787C9.73985%2020.7476%2010.52%2020.1427%2011.1071%2019.3649C11.6932%2018.5871%2012.0873%2017.7291%2012.2892%2016.7917C12.4744%2015.9295%2012.5099%2015.1741%2012.3966%2014.5275L12.3976%2014.5255Z'%20fill='white'/%3e%3c/svg%3e";async function te(c){let e=c.replace(/-/g,"+").replace(/_/g,"/");for(;e.length%4;)e+="=";const t=atob(e),i=Uint8Array.from(t,o=>o.charCodeAt(0)),s=new Blob([i]).stream().pipeThrough(new DecompressionStream("gzip")),r=await new Response(s).text();return JSON.parse(r)}function x(c,e){return typeof e=="string"&&/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d+(?:Z|[+-]\d+)/.test(e)?new Date(e):e}function $(c,e){return e}let R=!1;class ie{constructor(e,t,i,s,r,o,n,l,a,h,v){m(this,"temporarySessionKey","Shoplift_Session");m(this,"essentialSessionKey","Shoplift_Essential");m(this,"analyticsSessionKey","Shoplift_Analytics");m(this,"legacySessionKey");m(this,"cssHideClass");m(this,"testConfigs");m(this,"inactiveTestConfigs");m(this,"testsFilteredByAudience");m(this,"sendPageView");m(this,"shopliftDebug");m(this,"gaConfig");m(this,"getCountryTimeout");m(this,"state");m(this,"shopifyAnalyticsId");m(this,"cookie",document.cookie);m(this,"isSyncing",!1);m(this,"isSyncingGA",!1);m(this,"fetch");m(this,"localStorageSet");m(this,"localStorageGet");m(this,"sessionStorageSet",window.sessionStorage.setItem.bind(window.sessionStorage));m(this,"sessionStorageGet",window.sessionStorage.getItem.bind(window.sessionStorage));m(this,"urlParams",new URLSearchParams(window.location.search));m(this,"device");m(this,"logHistory");this.shop=e,this.host=t,this.eventHost=i,this.disableReferrerOverride=l,this.logHistory=[],this.legacySessionKey=`SHOPLIFT_SESSION_${this.shop}`,this.cssHideClass=s?"shoplift-hide":"",this.testConfigs=h.map(w=>({...w,startAt:new Date(w.startAt),statusHistory:w.statusHistory.map(u=>({...u,createdAt:new Date(u.createdAt)}))})),this.inactiveTestConfigs=v,this.sendPageView=!!r,this.shopliftDebug=o===!0,this.gaConfig=n!=={"sendEvents":false,"mode":"gtag"}?n:{sendEvents:!1},this.fetch=window.fetch.bind(window),this.localStorageSet=window.localStorage.setItem.bind(window.localStorage),this.localStorageGet=window.localStorage.getItem.bind(window.localStorage);const b=this.getDeviceType();this.device=b!=="tablet"?b:"mobile",this.state=this.loadState(),this.shopifyAnalyticsId=this.getShopifyAnalyticsId(),this.testsFilteredByAudience=h.filter(w=>w.status=="active"),this.getCountryTimeout=a===1000?1e3:a,this.log("State Loaded",JSON.stringify(this.state))}async init(){var e;try{if(this.log("Shoplift script initializing"),window.Shopify&&window.Shopify.designMode){this.log("Skipping script for design mode");return}if(window.location.href.includes("slScreenshot=true")){this.log("Skipping script for screenshot");return}if(window.location.hostname.endsWith(".edgemesh.com")){this.log("Skipping script for preview");return}if(window.location.href.includes("isShopliftMerchant")){const i=this.urlParams.get("isShopliftMerchant")==="true";this.log("Setting merchant session to %s",i),this.state.temporary.isMerchant=i,this.persistTemporaryState()}if(this.state.temporary.isMerchant){this.log("Setting up preview for merchant"),typeof window.shoplift!="object"&&this.setShopliftStub(),this.state.temporary.previewConfig||this.hidePage(),await this.initPreview(),(e=document.querySelector("#sl-preview-bar-hide"))==null||e.remove();return}if(this.state.temporary.previewConfig=void 0,N(navigator.userAgent))return;if(navigator.userAgent.includes("Chrome/118")){this.log("Random: %o",[Math.random(),Math.random(),Math.random()]);const i=await this.makeRequest({url:`${this.eventHost}/api/v0/events/ip`,method:"get"}).then(s=>s==null?void 0:s.json());this.log(`IP: ${i}`),this.makeRequest({url:`${this.eventHost}/api/v0/logs`,method:"post",data:JSON.stringify(this.debugState(),$)}).catch()}if(this.shopifyAnalyticsId=this.getShopifyAnalyticsId(),this.monitorConsentChange(),this.checkForThemePreview())return;if(!this.disableReferrerOverride&&this.state.temporary.originalReferrer!=null){this.log(`Overriding referrer from '${document.referrer}' to '${this.state.temporary.originalReferrer}'`);const i=this.state.temporary.originalReferrer;delete this.state.temporary.originalReferrer,this.persistTemporaryState(),Object.defineProperty(document,"referrer",{get:()=>i,enumerable:!0,configurable:!0})}if(await this.refreshVisitor(this.shopifyAnalyticsId),await this.handleVisitorTest()){this.log("Redirecting for visitor test");return}this.setShoplift(),this.showPage(),await this.ensureCartAttributesForExistingPriceTests(!1),await this.finalize(),console.log("SHOPLIFT SCRIPT INITIALIZED!")}catch(t){if(t instanceof L)return;throw t}finally{typeof window.shoplift!="object"&&this.setShopliftStub()}}getVariantColor(e){switch(e){case"a":return{text:"#141414",bg:"#E2E2E2"};case"b":return{text:"rgba(255, 255, 255, 1)",bg:"rgba(37, 99, 235, 1)"}}}async initPreview(){const e=this.urlParams.get("previewConfig");if(e){this.state.temporary.previewConfig=void 0,this.log("Setting up the preview"),this.log("Found preview config, writing to temporary state");const t=await te(e);if(this.state.temporary.previewConfig=t,this.state.temporary.previewConfig.testTypeCategory===S.Price){this.hidePage(!0);const s=this.state.temporary.previewConfig;let r=`${this.host}/api/dom-selectors/${s.storeId}/${s.testId}/${s.isDraft||!1}`;s.shopifyProductId&&(r+=`?productId=${s.shopifyProductId}`);const o=await this.makeJsonRequest({method:"get",url:r}).catch(n=>(this.log("Error getting domSelectors",n),null));s.variants.forEach(n=>{var l;return n.domSelectors=(l=o[n.id])==null?void 0:l.domSelectors})}this.persistTemporaryState();const i=new URL(window.location.toString());i.searchParams.delete("previewConfig"),this.queueRedirect(i)}else if(this.state.temporary.previewConfig){this.showPage();const t=this.state.temporary.previewConfig;t.testTypeCategory===S.Template&&this.handleTemplatePreview(t)&&this.initPreviewControls(t),t.testTypeCategory===S.UrlRedirect&&this.handleUrlPreview(t)&&this.initPreviewControls(t),t.testTypeCategory===S.Script&&this.handleScriptPreview(t)&&this.initPreviewControls(t),t.testTypeCategory===S.Price&&await this.handlePricePreview(t)&&this.initPreviewControls(t)}}initPreviewControls(e){document.addEventListener("DOMContentLoaded",()=>{const t=e.variants.find(u=>u.id===e.currentVariant),i=(t==null?void 0:t.label)||"a",s=e.variants,r=document.createElement("div");r.id="shoplift-preview-control";const o=document.createElement("div"),n=document.createElement("img");n.src=ee,n.height=24,n.width=14,o.style.padding="0 16px",o.style.lineHeight="100%",o.appendChild(n),r.appendChild(o);const l=document.createElement("div");l.id="shoplift-preview-variant-selector";const a=document.createElement("button");a.id="shoplift-preview-variant-menu-trigger";const h=document.createElement("div");h.className="menu-variant-label",h.style.backgroundColor=this.getVariantColor(i).bg,h.style.color=this.getVariantColor(i).text,h.innerText=i.toUpperCase(),a.appendChild(h);const v=document.createElement("span");if(v.id="shoplift-preview-variant-title",v.innerText=t!=null&&t.title?t.title:"Untitled variant "+i.toUpperCase(),a.appendChild(v),s.length>1){const u=document.createElement("img");u.src=X,u.width=12,u.height=12,u.style.height="12px",u.style.width="12px",a.appendChild(u);const d=document.createElement("div");d.className="preview-variant-menu";for(const p of e.variants.filter(g=>g.id!==e.currentVariant)){const g=document.createElement("div");g.className="preview-variant-menu--item";const y=document.createElement("div");y.className="menu-variant-label",y.style.backgroundColor=this.getVariantColor(p.label).bg,y.style.color=this.getVariantColor(p.label).text,y.style.flexShrink="0",y.innerText=p.label.toUpperCase(),g.appendChild(y);const f=document.createElement("span");f.innerText=p.title?p.title:"Untitled variant "+p.label.toUpperCase(),g.appendChild(f),g.addEventListener("click",()=>{this.pickVariant(p.id)}),d.appendChild(g)}l.appendChild(d),a.addEventListener("click",()=>{d.className!=="preview-variant-menu preview-variant-menu__visible"?d.classList.add("preview-variant-menu__visible"):d.classList.remove("preview-variant-menu__visible")}),document.addEventListener("click",p=>{p.target instanceof Element&&!a.contains(p.target)&&d.className==="preview-variant-menu preview-variant-menu__visible"&&d.classList.remove("preview-variant-menu__visible")})}else a.style.pointerEvents="none",h.style.margin="0";l.appendChild(a),r.appendChild(l);const b=document.createElement("div"),w=document.createElement("button");w.id="shoplift-exit-preview-button",w.innerText="Exit",b.appendChild(w),w.addEventListener("click",()=>{this.exitPreview()}),r.appendChild(b),document.body.appendChild(r),requestAnimationFrame(()=>{r.classList.add("visible")})}),this.ensureCartAttributesForExistingPriceTests(!0).catch(t=>{this.log("Error ensuring cart attributes for price test",t)})}pickVariant(e){var t,i,s,r;if(this.state.temporary.previewConfig){const o=this.state.temporary.previewConfig,n=new URL(window.location.toString());if(o.testTypeCategory===S.UrlRedirect){const l=(t=o.variants.find(a=>a.id===o.currentVariant))==null?void 0:t.redirectUrl;if(n.pathname===l){const a=(i=o.variants.find(h=>h.id===e))==null?void 0:i.redirectUrl;a&&(n.pathname=a)}}if(o.testTypeCategory===S.Template){const l=(s=o.variants.find(a=>a.id===o.currentVariant))==null?void 0:s.pathName;if(l&&n.pathname===l){const a=(r=o.variants.find(h=>h.id===e))==null?void 0:r.pathName;a&&a!==l&&(n.pathname=a)}}o.currentVariant=e,this.persistTemporaryState(),this.queueRedirect(n)}}exitPreview(){var t,i,s,r;const e=new URL(window.location.toString());if(((t=this.state.temporary.previewConfig)==null?void 0:t.testTypeCategory)===S.Template&&e.searchParams.delete("view"),((i=this.state.temporary.previewConfig)==null?void 0:i.testTypeCategory)===S.Script&&e.searchParams.delete("slVariant"),((s=this.state.temporary.previewConfig)==null?void 0:s.testTypeCategory)===S.UrlRedirect){const n=this.state.temporary.previewConfig.variants.filter(a=>a.label!=="a"&&a.redirectUrl!==null).map(a=>a.redirectUrl),l=(r=this.state.temporary.previewConfig.variants.find(a=>a.label==="a"))==null?void 0:r.redirectUrl;n.includes(e.pathname)&&l&&(e.pathname=l)}this.state.temporary.previewConfig=void 0,this.persistTemporaryState(),this.hidePage(),this.queueRedirect(e)}handleTemplatePreview(e){const t=e.currentVariant,i=e.variants.find(o=>o.id===t);if(!i)return!1;this.log("Setting up template preview for type",i.type);const s=new URL(window.location.toString()),r=s.searchParams.get("view");return this.typeFromTemplate()==i.type&&r!==i.affix&&i.affix&&(this.log("Template type matches current variant, redirecting"),s.searchParams.delete("view"),this.log("Setting the new viewParam"),this.hidePage(),s.searchParams.set("view",i.affix),this.queueRedirect(s)),r!==null&&r!==i.affix&&(s.searchParams.delete("view"),this.hidePage(),this.queueRedirect(s)),!0}handleUrlPreview(e){var o;const t=e.currentVariant,i=e.variants.find(n=>n.id===t),s=(o=e.variants.find(n=>n.isControl))==null?void 0:o.redirectUrl;if(!i)return!1;this.log("Setting up URL redirect preview");const r=new URL(window.location.toString());return r.pathname===s&&!i.isControl&&i.redirectUrl!==null&&(this.log("Url matches control, redirecting"),this.hidePage(),r.pathname=i.redirectUrl,this.queueRedirect(r)),!0}handleScriptPreview(e){const t=e.currentVariant,i=e.variants.find(o=>o.id===t);if(!i)return!1;this.log("Setting up script preview");const s=new URL(window.location.toString());return s.searchParams.get("slVariant")!==i.id&&(this.log("current id doesn't match the variant, redirecting"),s.searchParams.delete("slVariant"),this.log("Setting the new slVariantParam"),this.hidePage(),s.searchParams.set("slVariant",i.id),this.queueRedirect(s)),!0}async handlePricePreview(e){const t=e.currentVariant,i=e.variants.find(s=>s.id===t);return i?(this.log("Setting up price preview"),i.domSelectors&&i.domSelectors.length>0&&(I(document,{testId:e.testId,hypothesisId:i.id,selectors:i.domSelectors}),await this.ensureCartAttributesForExistingPriceTests(!0)),!0):!1}async finalize(){const e=await this.getCartState();e!==null&&this.queueCartUpdate(e),this.pruneStateAndSave(),await this.syncAllEvents()}setShoplift(){this.log("Setting up public API");const t=this.urlParams.get("slVariant")==="true",i=t?null:this.urlParams.get("slVariant");window.shoplift={isHypothesisActive:async s=>{if(this.log("Script checking variant for hypothesis '%s'",s),t)return this.log("Forcing variant for hypothesis '%s'",s),!0;if(i!==null)return this.log("Forcing hypothesis '%s'",i),s===i;const r=this.testConfigs.find(n=>n.hypotheses.some(l=>l.id===s));if(!r)return this.log("No test found for hypothesis '%s'",s),!1;const o=this.state.essential.visitorTests.find(n=>n.testId===r.id);return o?(this.log("Active visitor test found",s),o.hypothesisId===s):(await this.manuallySplitVisitor(r),this.testConfigs.some(n=>n.hypotheses.some(l=>l.id===s&&this.state.essential.visitorTests.some(a=>a.hypothesisId===l.id))))},setAnalyticsConsent:async s=>{await this.onConsentChange(s,!0)},getVisitorData:()=>({visitor:this.state.analytics.visitor,visitorTests:this.state.essential.visitorTests.filter(s=>!s.isInvalid).map(s=>{const{shouldSendToGa:r,...o}=s;return o})})}}setShopliftStub(){this.log("Setting up stubbed public API");const t=this.urlParams.get("slVariant")==="true",i=t?null:this.urlParams.get("slVariant");window.shoplift={isHypothesisActive:s=>Promise.resolve(t||s===i),setAnalyticsConsent:()=>Promise.resolve(),getVisitorData:()=>({visitor:null,visitorTests:[]})}}async manuallySplitVisitor(e){this.log("Starting manual split for test '%s'",e.id),await this.handleVisitorTest([e]),this.saveState(),this.syncAllEvents()}async handleVisitorTest(e){await this.filterTestsByAudience(this.testConfigs,this.state.analytics.visitor??this.buildBaseVisitor(),this.state.essential.visitorTests);let t=e?e.filter(i=>this.testsFilteredByAudience.some(s=>s.id===i.id)):[...this.testsForUrl(this.testsFilteredByAudience),...this.domTestsForUrl(this.testsFilteredByAudience)];try{if(t.length===0)return this.log("No tests found"),!1;this.log("Checking for existing visitor test on page");const i=this.getCurrentVisitorHypothesis(t);if(i){this.log("Found current visitor test");const n=this.considerRedirect(i);return n&&(this.log("Redirecting for current visitor test"),this.redirect(i)),n}this.log("No active test relation for test page");const s=this.testsForUrl(this.inactiveTestConfigs.filter(n=>this.testIsPaused(n)&&n.hypotheses.some(l=>this.state.essential.visitorTests.some(a=>a.hypothesisId===l.id)))).map(n=>n.id);if(s.length>0)return this.log("Visitor has paused tests for test page, skipping test assignment: %o",s),!1;if(this.hasThemeAndOtherTestTypes(this.testsFilteredByAudience)){this.log("Store has both theme and non-theme tests");const n=this.visitorActiveTestType();this.log("Current visitor test type is '%s'",n);let l;switch(n){case"templateOrUrlRedirect":this.log("Filtering to non-theme tests"),l=h=>h!=="theme";break;case"theme":this.log("Filtering to theme tests"),l=h=>h==="theme";break;case null:l=Math.random()>.5?(this.log("Filtering to theme tests"),h=>h==="theme"):(this.log("Filtering to non-theme tests"),h=>h!=="theme");break}const a=t.filter(h=>h.hypotheses.every(v=>!v.isControl||!l(v.type)));this.log(`Blocking visitor from being assigned to filtered test IDs: ["${a.map(h=>h.id).join('", "')}"]`),this.state.essential.visitorTests.push(...a.map(h=>({createdAt:new Date,testId:h.id,hypothesisId:null,isThemeTest:h.hypotheses.some(v=>v.type==="theme"),shouldSendToGa:!1,isSaved:!0,isInvalid:!0,themeId:void 0}))),t=t.filter(h=>h.hypotheses.some(v=>v.isControl&&l(v.type)))}if(t.length===0)return this.log("No tests found"),!1;const r=t[Math.floor(Math.random()*t.length)],o=this.pickHypothesis(r);if(o){this.log("Adding local visitor to test '%s', hypothesis '%s'",r.id,o.id),this.queueAddVisitorToTest(r.id,o);const n=this.considerRedirect(o);return n&&(this.log("Redirecting for new test"),this.redirect(o)),n}return this.log("No hypothesis found"),!1}finally{this.includeInDomTests(),this.saveState()}}includeInDomTests(){const e=this.getDomTestsForCurrentUrl(),t=this.getVisitorDomHypothesis(e);for(const i of e){this.log("Evaluating dom test '%s'",i.id);const r=t.find(o=>i.hypotheses.some(n=>o.id===n.id))??this.pickHypothesis(i);if(!r){this.log("Failed to pick hypothesis for test");continue}if(r.isControl){this.log("Control hypothesis - applying DOM selectors and watching for variant selectors");const o=i.hypotheses.filter(n=>n.id!==r.id).flatMap(n=>{var l;return((l=n.domSelectors)==null?void 0:l.map(a=>({...a,testId:i.id})))??[]});o.length>0&&z(document,{testId:i.id,hypothesisId:r.id,selectors:o},n=>{this.queueAddVisitorToTest(n,r),this.syncAllEvents()})}if(!r.domSelectors||r.domSelectors.length===0){this.log("No selectors found, skipping hypothesis");continue}this.log("Watching for selectors"),I(document,{testId:i.id,hypothesisId:r.id,selectors:r.domSelectors},o=>{this.queueAddVisitorToTest(o,r),this.syncAllEvents()})}}considerRedirect(e){if(this.log("Considering redirect for hypothesis '%s'",e.id),e.isControl)return this.log("Skipping redirect for control"),!1;if(e.type==="basicScript"||e.type==="manualScript")return this.log("Skipping redirect for script test"),!1;const t=this.state.essential.visitorTests.find(o=>o.hypothesisId===e.id),i=new URL(window.location.toString()),r=new URLSearchParams(window.location.search).get("view");if(e.type==="theme"){if(!(e.themeId===themeId)){if(this.log("Theme id '%s' is not hypothesis theme ID '%s'",e.themeId,themeId),t&&t.themeId!==e.themeId&&(t.themeId===themeId||!this.isThemePreview()))this.log("On old theme, redirecting and updating local visitor"),t.themeId=e.themeId;else if(this.isThemePreview())return this.log("On non-test theme, skipping redirect"),!1;return this.log("Hiding page to redirect for theme test"),this.hidePage(),!0}return!1}else if(e.type!=="dom"&&e.type!=="price"&&e.affix!==template.suffix&&e.affix!==r||e.redirectPath&&!i.pathname.endsWith(e.redirectPath))return this.log("Hiding page to redirect for template test"),this.hidePage(),!0;return this.log("Not redirecting"),!1}redirect(e){if(this.log("Redirecting to hypothesis '%s'",e.id),e.isControl)return;const t=new URL(window.location.toString());if(t.searchParams.delete("view"),e.redirectPath){const i=RegExp("^(/w{2}-w{2})/").exec(t.pathname);if(i&&i.length>1){const s=i[1];t.pathname=`${s}${e.redirectPath}`}else t.pathname=e.redirectPath}else e.type==="theme"?(t.searchParams.set("_ab","0"),t.searchParams.set("_fd","0"),t.searchParams.set("_sc","1"),t.searchParams.set("preview_theme_id",e.themeId.toString())):e.type!=="urlRedirect"&&t.searchParams.set("view",e.affix);this.queueRedirect(t)}async refreshVisitor(e){if(e===null||!this.state.essential.isFirstLoad||!this.testConfigs.some(i=>i.visitorOption!=="all"))return;this.log("Refreshing visitor"),this.hidePage();const t=await this.getVisitor(e);t&&t.id&&this.updateLocalVisitor(t)}buildBaseVisitor(){return{shopifyAnalyticsId:this.shopifyAnalyticsId,device:this.device,country:null,...this.state.essential.initialState}}getInitialState(){const e=this.getUTMValue("utm_source")??"",t=this.getUTMValue("utm_medium")??"",i=this.getUTMValue("utm_campaign")??"",s=this.getUTMValue("utm_content")??"",r=window.document.referrer,o=this.device;return{createdAt:new Date,utmSource:e,utmMedium:t,utmCampaign:i,utmContent:s,referrer:r,device:o}}checkForThemePreview(){var e,t;return this.log("Checking for theme preview"),window.location.hostname.endsWith(".shopifypreview.com")?(this.log("on shopify preview domain"),this.clearThemeBar(!0,!1,this.state),(e=document.querySelector("#sl-preview-bar-hide"))==null||e.remove(),!1):this.isThemePreview()?this.state.essential.visitorTests.some(i=>i.isThemeTest&&i.hypothesisId!=null&&this.getHypothesis(i.hypothesisId)&&i.themeId===themeId)?(this.log("On active theme test, removing theme bar"),this.clearThemeBar(!1,!0,this.state),!1):this.state.essential.visitorTests.some(i=>i.isThemeTest&&i.hypothesisId!=null&&!this.getHypothesis(i.hypothesisId)&&i.themeId===themeId)?(this.log("Visitor is on an inactive theme test, redirecting to main theme"),this.redirectToMainTheme(),!0):this.state.essential.isFirstLoad?(this.log("No visitor found on theme preview, redirecting to main theme"),this.redirectToMainTheme(),!0):this.inactiveTestConfigs.some(i=>i.hypotheses.some(s=>s.themeId===themeId))?(this.log("Current theme is an inactive theme test, redirecting to main theme"),this.redirectToMainTheme(),!0):this.testConfigs.some(i=>i.hypotheses.some(s=>s.themeId===themeId))?(this.log("Falling back to clearing theme bar"),this.clearThemeBar(!1,!0,this.state),!1):(this.log("No tests on current theme, skipping script"),this.clearThemeBar(!0,!1,this.state),(t=document.querySelector("#sl-preview-bar-hide"))==null||t.remove(),!0):(this.log("Not on theme preview"),this.clearThemeBar(!0,!1,this.state),!1)}redirectToMainTheme(){this.hidePage();const e=new URL(window.location.toString());e.searchParams.set("preview_theme_id",""),this.queueRedirect(e)}testsForUrl(e){const t=new URL(window.location.href),i=this.typeFromTemplate();return e.filter(s=>s.hypotheses.some(r=>r.type!=="dom"&&r.type!=="price"&&(r.isControl&&r.type===i&&r.affix===template.suffix||r.type==="theme"||r.isControl&&r.type==="urlRedirect"&&r.redirectPath&&t.pathname.endsWith(r.redirectPath)||r.type==="basicScript"))&&(s.ignoreTestViewParameterEnforcement||!t.searchParams.has("view")||s.hypotheses.map(r=>r.affix).includes(t.searchParams.get("view")??"")))}domTestsForUrl(e){const t=new URL(window.location.href);return e.filter(i=>i.hypotheses.some(s=>(s.type==="dom"||s.type==="price")&&s.domSelectors&&s.domSelectors.some(r=>new RegExp(j(r)).test(t.toString()))))}async filterTestsByAudience(e,t,i){const s=[];let r=t.country;!r&&e.some(o=>o.requiresCountry&&!i.some(n=>n.testId===o.id))&&(this.log("Hiding page to check geoip"),this.hidePage(),r=await this.makeJsonRequest({method:"get",url:`${this.eventHost}/api/v0/visitors/get-country`,signal:AbortSignal.timeout(this.getCountryTimeout)}).catch(o=>(this.log("Error getting country",o),null)));for(const o of e){if(this.log("Checking audience for test '%s'",o.id),this.state.essential.visitorTests.some(a=>a.testId===o.id&&a.hypothesisId==null)){console.log(`Skipping blocked test '${o.id}'`);continue}const n=this.visitorCreatedDuringTestActive(o.statusHistory);(i.some(a=>a.testId===o.id&&(o.device==="all"||o.device===t.device&&o.device===this.device))||this.isTargetAudience(o,t,n,r))&&(this.log("Visitor is in audience for test '%s'",o.id),s.push(o))}this.testsFilteredByAudience=s}isTargetAudience(e,t,i,s){const r=this.getChannel(t);return(e.device==="all"||e.device===t.device&&e.device===this.device)&&(e.visitorOption==="all"||e.visitorOption==="new"&&i||e.visitorOption==="returning"&&!i)&&(e.targetAudiences.length===0||e.targetAudiences.reduce((o,n)=>o||n.reduce((l,a)=>l&&a(t,i,r,s),!0),!1))}visitorCreatedDuringTestActive(e){let t="";for(const i of e){if(this.state.analytics.visitor!==null&&this.state.analytics.visitor.createdAt<i.createdAt||this.state.essential.initialState.createdAt<i.createdAt)break;t=i.status}return t==="active"}getDomTestsForCurrentUrl(){return this.domTestsForUrl(this.testsFilteredByAudience)}getCurrentVisitorHypothesis(e){return e.flatMap(t=>t.hypotheses).find(t=>t.type!=="dom"&&t.type!=="price"&&this.state.essential.visitorTests.some(i=>i.hypothesisId===t.id))}getVisitorDomHypothesis(e){return e.flatMap(t=>t.hypotheses).filter(t=>(t.type==="dom"||t.type==="price")&&this.state.essential.visitorTests.some(i=>i.hypothesisId===t.id))}getHypothesis(e){return this.testConfigs.filter(t=>t.hypotheses.some(i=>i.id===e)).map(t=>t.hypotheses.find(i=>i.id===e))[0]}hasThemeTest(e){return e.some(t=>t.hypotheses.some(i=>i.type==="theme"))}hasTestThatIsNotThemeTest(e){return e.some(t=>t.hypotheses.some(i=>i.type!=="theme"&&i.type!=="dom"&&i.type!=="price"))}hasThemeAndOtherTestTypes(e){return this.hasThemeTest(e)&&this.hasTestThatIsNotThemeTest(e)}testIsPaused(e){return e.status==="paused"||e.status==="incompatible"||e.status==="suspended"}visitorActiveTestType(){const e=this.state.essential.visitorTests.filter(t=>this.testConfigs.some(i=>i.hypotheses.some(s=>s.id==t.hypothesisId)));return e.length===0?null:e.some(t=>t.isThemeTest)?"theme":"templateOrUrlRedirect"}pickHypothesis(e){let t=Math.random();const i=e.hypotheses.reduce((r,o)=>r+o.visitorCount,0);return e.hypotheses.sort((r,o)=>r.isControl?o.isControl?0:-1:o.isControl?1:0).reduce((r,o)=>{if(r!==null)return r;const l=e.hypotheses.reduce((a,h)=>a&&h.visitorCount>20,!0)?o.visitorCount/i-o.trafficPercentage:0;return t<=o.trafficPercentage-l?o:(t-=o.trafficPercentage,null)},null)}typeFromTemplate(){switch(template.type){case"collection-list":return"collectionList";case"page":return"landing";case"article":case"blog":case"cart":case"collection":case"index":case"product":case"search":return template.type;default:return null}}queueRedirect(e){this.saveState(),this.disableReferrerOverride||(this.log(`Saving temporary referrer override '${document.referrer}'`),this.state.temporary.originalReferrer=document.referrer,this.persistTemporaryState()),window.setTimeout(()=>window.location.assign(e),0),window.setTimeout(()=>void this.syncAllEvents(),2e3)}async syncAllEvents(){const e=async()=>{if(this.isSyncing){window.setTimeout(()=>void(async()=>await e())(),500);return}try{this.isSyncing=!0,await this.syncEvents(),this.syncGAEvents()}finally{this.isSyncing=!1}};await e()}async syncEvents(){var i,s;if(!this.state.essential.consentApproved||!this.shopifyAnalyticsId||this.state.analytics.queue.length===0)return;const e=this.state.analytics.queue.length,t=this.state.analytics.queue.splice(0,e);this.log("Syncing %s events",e);try{const r={shop:this.shop,visitorDetails:{shopifyAnalyticsId:this.shopifyAnalyticsId,device:((i=this.state.analytics.visitor)==null?void 0:i.device)??this.device,country:((s=this.state.analytics.visitor)==null?void 0:s.country)??null,...this.state.essential.initialState},events:this.state.essential.visitorTests.filter(n=>!n.isInvalid&&!n.isSaved&&n.hypothesisId!=null).map(n=>new F(n.testId,n.hypothesisId,n.createdAt)).concat(t)};await this.sendEvents(r);const o=await this.getVisitor(this.shopifyAnalyticsId);o!==null&&this.updateLocalVisitor(o);for(const n of this.state.essential.visitorTests.filter(l=>!l.isInvalid&&!l.isSaved))n.isSaved=!0}catch{this.state.analytics.queue.splice(0,0,...t)}finally{this.saveState()}}syncGAEvents(){if(!this.gaConfig.sendEvents){if(R)return;R=!0,this.log("UseGtag is false — skipping GA Events");return}if(!this.state.essential.consentApproved){this.log("Consent not approved — skipping GA Events");return}if(this.isSyncingGA){this.log("Already syncing GA - skipping GA events");return}const e=this.state.essential.visitorTests.filter(t=>t.shouldSendToGa);if(e.length===0){this.log("No GA Events to sync");return}this.isSyncingGA=!0,this.log("Syncing %s GA Events",e.length),Promise.allSettled(e.map(t=>this.sendGAEvent(t))).then(()=>this.log("All gtag events sent")).finally(()=>this.isSyncingGA=!1)}sendGAEvent(e){return new Promise(t=>{this.log("Sending GA Event for test %s, hypothesis %s",e.testId,e.hypothesisId);const i=()=>{this.log("GA acknowledged event for hypothesis %s",e.hypothesisId),e.shouldSendToGa=!1,this.persistEssentialState(),t()},s={exp_variant_string:`SL-${e.testId}-${e.hypothesisId}`};this.shopliftDebug&&Object.assign(s,{debug_mode:!0});function r(o,n,l){window.dataLayer=window.dataLayer||[],window.dataLayer.push(arguments)}this.gaConfig.mode==="gtag"?r("event","experience_impression",{...s,event_callback:i}):(window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"experience_impression",...s,eventCallback:i}))})}updateLocalVisitor(e){let t;({visitorTests:t,...this.state.analytics.visitor}=e);for(const i of this.state.essential.visitorTests.filter(s=>!t.some(r=>r.testId===s.testId)))i.isSaved=!0,i.isInvalid=!0;for(const i of t){const s=this.state.essential.visitorTests.findIndex(o=>o.testId===i.testId);s!==-1?(i.isInvalid=!1,this.state.essential.visitorTests.splice(s,1,i)):this.state.essential.visitorTests.push(i)}this.state.analytics.visitor.storedAt=new Date}async getVisitor(e){try{return await this.makeJsonRequest({method:"get",url:`${this.eventHost}/api/v0/visitors/by-key/${this.shop}/${e}`})}catch{return null}}async sendEvents(e){await this.makeRequest({method:"post",url:`${this.eventHost}/api/v0/events`,data:JSON.stringify(e)})}getUTMValue(e){const i=decodeURIComponent(window.location.search.substring(1)).split("&");for(let s=0;s<i.length;s++){const r=i[s].split("=");if(r[0]===e)return r[1]||null}return null}hidePage(e){this.log("Hiding page"),this.cssHideClass&&!window.document.documentElement.classList.contains(this.cssHideClass)&&(window.document.documentElement.classList.add(this.cssHideClass),e||setTimeout(this.removeAsyncHide(this.cssHideClass),2e3))}showPage(){this.cssHideClass&&this.removeAsyncHide(this.cssHideClass)()}getDeviceType(){function e(){let i=!1;return function(s){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(s)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(s.substr(0,4)))&&(i=!0)}(navigator.userAgent||navigator.vendor),i}function t(){let i=!1;return function(s){(/android|ipad|playbook|silk/i.test(s)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(s.substr(0,4)))&&(i=!0)}(navigator.userAgent||navigator.vendor),i}return e()?"mobile":t()?"tablet":"desktop"}removeAsyncHide(e){return()=>{e&&window.document.documentElement.classList.remove(e)}}async getCartState(){try{let e=await this.makeJsonRequest({method:"get",url:`${window.location.origin}/cart.js`});return e===null||(e.note===null&&(e=await this.makeJsonRequest({method:"post",url:`${window.location.origin}/cart/update.js`,data:JSON.stringify({note:""})})),e==null)?null:{token:e.token,total_price:e.total_price,total_discount:e.total_discount,currency:e.currency,items_subtotal_price:e.items_subtotal_price,items:e.items.map(t=>({quantity:t.quantity,variant_id:t.variant_id,key:t.key,price:t.price,final_line_price:t.final_line_price,sku:t.sku,product_id:t.product_id}))}}catch(e){return this.log("Error sending cart info",e),null}}async ensureCartAttributesForExistingPriceTests(e){var t;try{if(this.log("Checking visitor assignments for active price tests"),e&&this.state.temporary.previewConfig){const i=this.state.temporary.previewConfig;this.log("Using preview config for merchant:",i.testId);let s="variant";if(i.variants&&i.variants.length>0){const r=i.variants.find(o=>o.id===i.currentVariant);r&&r.isControl&&(s="control")}this.log("Merchant preview - updating hidden inputs:",i.testId,s),this.updatePriceTestHiddenInputs(i.testId,s,!0);return}for(const i of this.state.essential.visitorTests){const s=this.testConfigs.find(o=>o.id===i.testId);if(!s){this.log("Test config not found:",i.testId);continue}const r=s.hypotheses.find(o=>o.id===i.hypothesisId);if(!r||r.type!=="price"){this.log("Skipping non-price hypothesis:",i.hypothesisId);continue}this.log("Found potential price test, validating with server:",i.testId);try{const o=await this.makeJsonRequest({method:"get",url:`${this.eventHost}/api/v0/visitors/price-test/${i.testId}/${(t=this.state.analytics.visitor)==null?void 0:t.id}`});if(!o){this.log("Failed to validate price test with server:",i.testId);continue}if(!o.isActive||!o.isPriceTest||!o.visitorAssigned){this.log("Price test validation failed - Active:",o.isActive,"PriceTest:",o.isPriceTest,"Assigned:",o.visitorAssigned);continue}this.log("Price test validated successfully, updating hidden inputs:",i.testId,o.assignment),this.updatePriceTestHiddenInputs(i.testId,o.assignment,e)}catch(o){this.log("Error validating price test with server:",i.testId,o);const n=r.isControl?"control":"variant";this.updatePriceTestHiddenInputs(i.testId,n,e)}}}catch(i){this.log("Error ensuring cart attributes for existing price tests:",i)}}updatePriceTestHiddenInputs(e,t,i){try{this.cleanupPriceTestObservers();const s=`${e}:${t}:${i?"t":"f"}`,r=u=>{const d=u.getAttribute("data-sl-pid");if(!d)return!0;if(i&&this.state.temporary.previewConfig){const g=this.state.temporary.previewConfig,y=t==="control"?"a":"b",f=g.variants.find(P=>P.label===y);if(!f)return!1;for(const P of f.domSelectors||[]){const q=P.cssSelector.match(/data-sl-attribute-(?:p|cap)="(\d+)"/);if(q){const M=q[1];if(this.log(`Extracted ID from selector: ${M}, comparing to: ${d}`),M===d)return this.log("Product ID match found in preview config:",d,"variant:",f.label),!0}else this.log(`Could not extract ID from selector: ${P.cssSelector}`)}return this.log("No product ID match in preview config for:",d,"variant:",y),!1}const p=this.testConfigs.find(g=>g.id===e);if(!p)return this.log("Test config not found for testId:",e),!1;for(const g of p.hypotheses||[])for(const y of g.domSelectors||[]){const f=y.cssSelector.match(/data-sl-attribute-(?:p|cap)="(\d+)"/);if(f&&f[1]===d)return this.log("Product ID match found:",d,"for test:",e),!0}return this.log("No product ID match for:",d,"in test:",e),!1},o=new Set,n=new MutationObserver(u=>{u.forEach(d=>{d.addedNodes.forEach(p=>{if(p.nodeType===Node.ELEMENT_NODE){const g=p;h(g);const y=g.matches('input[name="properties[_slpt]"]')?[g]:g.querySelectorAll('input[name="properties[_slpt]"]');y.length>0&&this.log(`MutationObserver found ${y.length} new hidden input(s)`),y.forEach(f=>{const P=f.getAttribute("data-sl-pid");this.log(`MutationObserver checking new input with data-sl-pid="${P}"`),r(f)?(f.value!==s&&(f.value=s,this.log("Updated newly added hidden input:",s)),v(f)):(f.remove(),this.log("Removed newly added non-matching hidden input for product ID:",f.getAttribute("data-sl-pid")))})}})})});o.add(n);const l=new MutationObserver(u=>{u.forEach(d=>{if(d.type==="attributes"&&d.attributeName==="data-sl-pid"){const p=d.target;if(this.log("AttributeObserver detected data-sl-pid attribute change on:",p.tagName),p.matches('input[name="properties[_slpt]"]')){const g=p,y=d.oldValue,f=g.getAttribute("data-sl-pid");this.log(`data-sl-pid changed from "${y}" to "${f}" - triggering payment placement updates`),r(g)?(g.value!==s&&(g.value=s,this.log("Updated hidden input after data-sl-pid change:",s)),this.log("Applying DOM selector changes for new variant"),f&&a(f),this.log("Re-running payment placement updates after variant change"),h(document.body)):(g.remove(),this.log("Removed non-matching hidden input after data-sl-pid change:",f))}}})});o.add(l);const a=u=>{if(this.log(`Applying DOM selector changes for product ID: ${u}`),i&&this.state.temporary.previewConfig){const d=t==="control"?"a":"b",p=this.state.temporary.previewConfig.variants.find(g=>g.label===d);if(!(p!=null&&p.domSelectors)){this.log(`No DOM selectors found for preview variant: ${d}`);return}this.log(`Applying preview config DOM selectors, count: ${p.domSelectors.length}`),I(document,{testId:e,hypothesisId:p.id,selectors:p.domSelectors},()=>{this.log("DOM selector changes applied for preview variant")})}else{const d=this.testConfigs.find(g=>g.id===e);if(!d){this.log(`No test config found for testId: ${e}`);return}const p=d.hypotheses.find(g=>t==="control"?g.isControl:!g.isControl);if(!(p!=null&&p.domSelectors)){this.log(`No DOM selectors found for assignment: ${t}`);return}this.log(`Applying live config DOM selectors, count: ${p.domSelectors.length}`),I(document,{testId:e,hypothesisId:p.id,selectors:p.domSelectors},()=>{this.log("DOM selector changes applied for live config")})}},h=u=>{u.tagName==="SHOPIFY-PAYMENT-TERMS"&&(this.log("MutationObserver found new shopify-payment-terms element"),this.updateShopifyPaymentTerms(e,t));const d=u.querySelectorAll("shopify-payment-terms");d.length>0&&(this.log(`MutationObserver found ${d.length} shopify-payment-terms in added node`),this.updateShopifyPaymentTerms(e,t)),u.tagName==="AFTERPAY-PLACEMENT"&&(this.log("MutationObserver found new afterpay-placement element"),this.updateAfterpayPlacements(e,t,"afterpay"));const p=u.querySelectorAll("afterpay-placement");p.length>0&&(this.log(`MutationObserver found ${p.length} afterpay-placement in added node`),this.updateAfterpayPlacements(e,t,"afterpay")),u.tagName==="SQUARE-PLACEMENT"&&(this.log("MutationObserver found new square-placement element"),this.updateAfterpayPlacements(e,t,"square"));const g=u.querySelectorAll("square-placement");g.length>0&&(this.log(`MutationObserver found ${g.length} square-placement in added node`),this.updateAfterpayPlacements(e,t,"square")),u.tagName==="KLARNA-PLACEMENT"&&(this.log("MutationObserver found new klarna-placement element"),this.updateKlarnaPlacements(e,t));const y=u.querySelectorAll("klarna-placement");y.length>0&&(this.log(`MutationObserver found ${y.length} klarna-placement in added node`),this.updateKlarnaPlacements(e,t))},v=u=>{l.observe(u,{attributes:!0,attributeFilter:["data-sl-pid"],attributeOldValue:!0,subtree:!1});const d=u.getAttribute("data-sl-pid");this.log(`Started AttributeObserver on specific input with data-sl-pid="${d}"`)},b=()=>{const u=document.querySelectorAll('input[name="properties[_slpt]"]');this.log(`Found ${u.length} existing hidden inputs to check`),u.forEach(d=>{const p=d.getAttribute("data-sl-pid");this.log(`Checking existing input with data-sl-pid="${p}"`),r(d)?(d.value=s,this.log("Updated existing hidden input:",s),p&&(this.log("Applying initial DOM selector changes for existing product"),a(p)),v(d)):(d.remove(),this.log("Removed non-matching hidden input for product ID:",d.getAttribute("data-sl-pid")))})},w=()=>{document.body?(n.observe(document.body,{childList:!0,subtree:!0}),this.log("Started MutationObserver on document.body"),b(),this.log("Checking existing payment terms on document.body"),h(document.body)):document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{document.body&&(n.observe(document.body,{childList:!0,subtree:!0}),this.log("Started MutationObserver after DOMContentLoaded"),b())}):(this.log("Set timeout on observer"),setTimeout(w,10))};w(),window.__shopliftPriceTestObservers=o,window.__shopliftPriceTestValue=s,this.log("Set up DOM observer for price test hidden inputs")}catch(s){this.log("Error updating price test hidden inputs:",s)}}updateKlarnaPlacements(e,t){this.updatePlacementElements(e,t,"klarna-placement",(i,s)=>{i.setAttribute("data-purchase-amount",s.toString())})}cleanupPriceTestObservers(){const e=window.__shopliftPriceTestObservers;e&&(e.forEach(t=>{t.disconnect()}),e.clear(),this.log("Cleaned up existing price test observers")),delete window.__shopliftPriceTestObservers,delete window.__shopliftPriceTestValue}updateAfterpayPlacements(e,t,i="afterpay"){this.log(`updateAfterpayPlacements called with testId: ${e}, assignment: ${t}, placementBase: ${i}`);const s=i==="square"?"square-placement":"afterpay-placement",r=document.querySelectorAll(s);if(this.log(`Looking for ${s} elements, found: ${r.length}`),r.length===0){this.log(`No ${s} elements found on page - early return`);return}this.updatePlacementElements(e,t,s,(o,n)=>{if(this.log(`setAmount callback called for ${s} with cents: ${n}`),i==="afterpay"){const l=(n/100).toFixed(2);this.log(`Converting ${n} cents to ${l} dollars for Afterpay`),o.setAttribute("data-amount",l),this.log(`Successfully set data-amount="${l}" on Afterpay element`)}else this.log(`Setting ${n} cents for Square placement`),o.setAttribute("data-amount",n.toString()),this.log(`Successfully set data-amount="${n}" on Square element`)}),this.log("updateAfterpayPlacements completed")}updatePlacementElements(e,t,i,s){this.log(`updatePlacementElements called for ${i} with testId: ${e}, assignment: ${t}`);const r=document.querySelectorAll(i);if(this.log(`Found ${r.length} ${i} elements`),r.length===0){this.log(`No ${i} elements found - early return`);return}let o;if(this.log(`isMerchant: ${this.state.temporary.isMerchant}, hasPreviewConfig: ${!!this.state.temporary.previewConfig}`),this.state.temporary.isMerchant&&this.state.temporary.previewConfig){const l=t==="control"?"a":"b";this.log(`Using preview config, looking for variant with label: ${l}`);const a=this.state.temporary.previewConfig.variants.find(h=>h.label===l);if(this.log(`Found target variant: ${!!a}, has domSelectors: ${!!(a!=null&&a.domSelectors)}`),!(a!=null&&a.domSelectors)){this.log(`No variant found for label ${l} in preview config for ${i}`);return}o=a.domSelectors,this.log(`Using preview config for ${i} in merchant mode, variant: ${l}`)}else{this.log(`Using live config, looking for testConfig with id: ${e}`);const l=this.testConfigs.find(h=>h.id===e);if(this.log(`Found testConfig: ${!!l}`),!l){this.log(`No testConfig found for id: ${e} - early return`);return}const a=l.hypotheses.find(h=>t==="control"?h.isControl:!h.isControl);if(this.log(`Found hypothesis: ${!!a}, has domSelectors: ${!!(a!=null&&a.domSelectors)}`),!(a!=null&&a.domSelectors)){this.log(`No hypothesis or domSelectors found for assignment: ${t} - early return`);return}o=a.domSelectors,this.log(`Using live config domSelectors, count: ${o.length}`)}const n=/data-sl-attribute-p=["'](\d+)["']/;this.log(`Starting to process ${r.length} ${i} elements`),r.forEach((l,a)=>{this.log(`Processing ${i} element ${a+1}/${r.length}`);let h=null;const v=l.parentElement;if(v&&(h=v.querySelector('input[name="properties[_slpt]"]'),this.log(`Searched parent for hidden input: ${!!h}`)),h||(h=l.querySelector('input[name="properties[_slpt]"]'),this.log(`Searched element itself for hidden input: ${!!h}`)),!h){this.log(`No hidden input found for ${i} element`);return}const b=h.getAttribute("data-sl-pid");if(this.log(`Found hidden input with productId: ${b}`),!b){this.log("Hidden input has no data-sl-pid attribute - skipping");return}this.log(`Searching ${o.length} domSelectors for productId: ${b}`);const w=o.find((g,y)=>{const f=g.cssSelector.match(n);return(y<5||f)&&this.log(`Selector ${y+1}: ${g.cssSelector} -> match: ${f?f[1]:"none"}`),f&&f[1]===b});if(this.log(`Found matching selector: ${!!w}`),!w){this.log(`No matching selector found for productId: ${b} - skipping element`);return}const u=w.actions.find(g=>g.scope==="price");if(this.log(`Found price action: ${!!u}, value: ${u==null?void 0:u.value}`),!(u!=null&&u.value)){this.log("No price action or value found - skipping element");return}const d=parseFloat(u.value.replace(/[^0-9.]/g,""));if(this.log(`Parsed price: "${u.value}" -> ${d}`),Number.isNaN(d)){this.log(`Invalid price "${u.value}" for product ${b} - skipping`);return}const p=Math.round(d*100);this.log(`Price in cents: ${p}`),this.log(`Calling setAmount callback with element and ${p} cents`),s(l,p),this.log(`Successfully updated ${i} data-amount to: ${p} for product: ${b}`)}),this.log(`updatePlacementElements completed for ${i}`)}updateShopifyPaymentTerms(e,t){const i=document.querySelectorAll("shopify-payment-terms");if(i.length===0)return;this.log("Store using shopify payments");let s;if(this.state.temporary.isMerchant&&this.state.temporary.previewConfig){const r=t==="control"?"a":"b",o=this.state.temporary.previewConfig.variants.find(n=>n.label===r);if(!o||!o.domSelectors){this.log(`No variant found for label ${r} in preview config`);return}s=o.domSelectors,this.log(`Using preview config for shopify-payment-terms in merchant mode, variant: ${r}`)}else{const r=this.testConfigs.find(n=>n.id===e);if(!r)return;const o=r.hypotheses.find(n=>t==="control"?n.isControl===!0:n.isControl===!1);if(!o||!o.domSelectors)return;s=o.domSelectors}i.forEach(r=>{const o=r.getAttribute("variant-id");if(!o)return;const n=s.find(l=>{const a=l.cssSelector.match(/data-sl-attribute-p=["'](\d+)["']/);return a&&a[1]===o});if(n){const l=n.actions.find(a=>a.scope==="price");if(l&&l.value){const a=r.getAttribute("shopify-meta");if(a)try{const h=JSON.parse(a);if(h.variants&&Array.isArray(h.variants)){const v=h.variants.find(b=>{var w;return((w=b.id)==null?void 0:w.toString())===o});if(v){v.full_price=l.value;const b=parseFloat(l.value.replace(/[^0-9.]/g,""));if(v.number_of_payment_terms&&v.number_of_payment_terms>1){const w=b/v.number_of_payment_terms;v.price_per_term=`$${w.toFixed(2)}`}r.setAttribute("shopify-meta",JSON.stringify(h))}}}catch(h){this.log("Error parsing/updating shoplift-meta:",h)}}}})}async makeJsonRequest(e){const t=await this.makeRequest(e);return t===null?null:JSON.parse(await t.text(),x)}async makeRequest(e){const{url:t,method:i,headers:s,data:r,signal:o}=e,n=new Headers;if(s)for(const a in s)n.append(a,s[a]);(!s||!s.Accept)&&n.append("Accept","application/json"),(!s||!s["Content-Type"])&&n.append("Content-Type","application/json"),(this.eventHost.includes("ngrok.io")||this.eventHost.includes("ngrok-free.app"))&&n.append("ngrok-skip-browser-warning","1234");const l=await this.fetch(t,{method:i,headers:n,body:r,signal:o});if(!l.ok){if(l.status===204)return null;if(l.status===422){const a=await l.json();if(typeof a<"u"&&a.isBot)throw new L}throw new Error(`Error sending shoplift request ${l.status}`)}return l}queueAddVisitorToTest(e,t){if(!this.state.essential.visitorTests.some(i=>i.testId===e)&&(this.state.essential.visitorTests.push({createdAt:new Date,testId:e,hypothesisId:t.id,isThemeTest:t.type==="theme",themeId:t.themeId,isSaved:!1,isInvalid:!1,shouldSendToGa:!0}),t.type==="price")){const i=t.isControl?"control":"variant";this.log("Price test assignment detected, updating cart attributes:",e,i),this.updatePriceTestHiddenInputs(e,i,!1)}}queueCartUpdate(e){this.queueEvent(new H(e))}queuePageView(e){this.queueEvent(new D(e))}queueEvent(e){!this.state.essential.consentApproved&&this.state.essential.hasConsentInteraction||this.state.analytics.queue.length>10||this.state.analytics.queue.push(e)}legacyGetLocalStorageVisitor(){const e=this.localStorageGet(this.legacySessionKey);if(e)try{return JSON.parse(e,x)}catch{}return null}pruneStateAndSave(){this.state.essential.visitorTests=this.state.essential.visitorTests.filter(e=>this.testConfigs.some(t=>t.id==e.testId)||this.inactiveTestConfigs.filter(t=>this.testIsPaused(t)).some(t=>t.id===e.testId)),this.saveState()}saveState(){this.persistEssentialState(),this.persistAnalyticsState()}loadState(){const e=this.loadAnalyticsState(),t={analytics:e,essential:this.loadEssentialState(e),temporary:this.loadTemporaryState()},i=this.legacyGetLocalStorageVisitor(),s=this.legacyGetCookieVisitor(),r=[i,s].filter(o=>o!==null).sort((o,n)=>+n.storedAt-+o.storedAt)[0];return t.analytics.visitor===null&&r&&({visitorTests:t.essential.visitorTests,...t.analytics.visitor}=r,t.essential.isFirstLoad=!1,t.essential.initialState={createdAt:r.createdAt,referrer:r.referrer,utmCampaign:r.utmCampaign,utmContent:r.utmContent,utmMedium:r.utmMedium,utmSource:r.utmSource,device:r.device},this.deleteCookie("SHOPLIFT"),this.deleteLocalStorage(this.legacySessionKey)),!t.essential.consentApproved&&t.essential.hasConsentInteraction&&this.deleteLocalStorage(this.analyticsSessionKey),t}loadEssentialState(e){var n;const t=this.loadLocalStorage(this.essentialSessionKey),i=this.loadCookie(this.essentialSessionKey),s=this.getInitialState();(n=e.visitor)!=null&&n.device&&(s.device=e.visitor.device);const r={timestamp:new Date,consentApproved:!1,hasConsentInteraction:!1,debugMode:!1,initialState:s,visitorTests:[],isFirstLoad:!0},o=[t,i].filter(l=>l!==null).sort((l,a)=>+a.timestamp-+l.timestamp)[0]??r;return o.initialState||(e.visitor!==null?o.initialState=e.visitor:(o.initialState=s,o.initialState.createdAt=o.timestamp)),o}loadAnalyticsState(){const e=this.loadLocalStorage(this.analyticsSessionKey),t=this.loadCookie(this.analyticsSessionKey),i={timestamp:new Date,visitor:null,queue:[]},s=[e,t].filter(r=>r!==null).sort((r,o)=>+o.timestamp-+r.timestamp)[0]??i;return s.queue.length===0&&e&&e.queue.length>1&&(s.queue=e.queue),s}loadTemporaryState(){const e=this.sessionStorageGet(this.temporarySessionKey),t=e?JSON.parse(e,x):null,i=this.loadCookie(this.temporarySessionKey);return t??i??{isMerchant:!1,timestamp:new Date}}persistEssentialState(){this.log("Persisting essential state"),this.state.essential.isFirstLoad=!1,this.state.essential.timestamp=new Date,this.persistLocalStorageState(this.essentialSessionKey,this.state.essential),this.persistCookieState(this.essentialSessionKey,this.state.essential)}persistAnalyticsState(){this.log("Persisting analytics state"),this.state.essential.consentApproved&&(this.state.analytics.timestamp=new Date,this.persistLocalStorageState(this.analyticsSessionKey,this.state.analytics),this.persistCookieState(this.analyticsSessionKey,{...this.state.analytics,queue:[]}))}persistTemporaryState(){this.log("Setting temporary session state"),this.state.temporary.timestamp=new Date,this.sessionStorageSet(this.temporarySessionKey,JSON.stringify(this.state.temporary)),this.persistCookieState(this.temporarySessionKey,this.state.temporary,!0)}loadLocalStorage(e){const t=this.localStorageGet(e);if(t===null)return null;try{return JSON.parse(t,x)}catch{return null}}loadCookie(e){const t=this.getCookie(e);if(t===null)return null;try{return JSON.parse(t,x)}catch{return null}}persistLocalStorageState(e,t){this.localStorageSet(e,JSON.stringify(t))}persistCookieState(e,t,i=!1){const s=JSON.stringify(t),r=i?"":`expires=${new Date(new Date().getTime()+864e5*365).toUTCString()};`;document.cookie=`${e}=${s};domain=.${window.location.hostname};path=/;SameSite=Strict;${r}`}deleteCookie(e){const t=new Date(0).toUTCString();document.cookie=`${e}=;domain=.${window.location.hostname};path=/;expires=${t};`}deleteLocalStorage(e){window.localStorage.removeItem(e)}getChannel(e){var i;return((i=[{"name":"cross-network","test":(v) => new RegExp(".*cross-network.*", "i").test(v.utmCampaign)},{"name":"direct","test":(v) => v.utmSource === "" && v.utmMedium === ""},{"name":"paid-shopping","test":(v) => (new RegExp("^(?:Google|IGShopping|aax-us-east\.amazon-adsystem\.com|aax\.amazon-adsystem\.com|alibaba|alibaba\.com|amazon|amazon\.co\.uk|amazon\.com|apps\.shopify\.com|checkout\.shopify\.com|checkout\.stripe\.com|cr\.shopping\.naver\.com|cr2\.shopping\.naver\.com|ebay|ebay\.co\.uk|ebay\.com|ebay\.com\.au|ebay\.de|etsy|etsy\.com|m\.alibaba\.com|m\.shopping\.naver\.com|mercadolibre|mercadolibre\.com|mercadolibre\.com\.ar|mercadolibre\.com\.mx|message\.alibaba\.com|msearch\.shopping\.naver\.com|nl\.shopping\.net|no\.shopping\.net|offer\.alibaba\.com|one\.walmart\.com|order\.shopping\.yahoo\.co\.jp|partners\.shopify\.com|s3\.amazonaws\.com|se\.shopping\.net|shop\.app|shopify|shopify\.com|shopping\.naver\.com|shopping\.yahoo\.co\.jp|shopping\.yahoo\.com|shopzilla|shopzilla\.com|simplycodes\.com|store\.shopping\.yahoo\.co\.jp|stripe|stripe\.com|uk\.shopping\.net|walmart|walmart\.com)$", "i").test(v.utmSource) || new RegExp("^(.*(([^a-df-z]|^)shop|shopping).*)$", "i").test(v.utmCampaign)) && new RegExp("^(.*cp.*|ppc|retargeting|paid.*)$", "i").test(v.utmMedium)},{"name":"paid-search","test":(v) => new RegExp("^(?:360\.cn|alice|aol|ar\.search\.yahoo\.com|ask|at\.search\.yahoo\.com|au\.search\.yahoo\.com|auone|avg|babylon|baidu|biglobe|biglobe\.co\.jp|biglobe\.ne\.jp|bing|br\.search\.yahoo\.com|ca\.search\.yahoo\.com|centrum\.cz|ch\.search\.yahoo\.com|cl\.search\.yahoo\.com|cn\.bing\.com|cnn|co\.search\.yahoo\.com|comcast|conduit|daum|daum\.net|de\.search\.yahoo\.com|dk\.search\.yahoo\.com|dogpile|dogpile\.com|duckduckgo|ecosia\.org|email\.seznam\.cz|eniro|es\.search\.yahoo\.com|espanol\.search\.yahoo\.com|exalead\.com|excite\.com|fi\.search\.yahoo\.com|firmy\.cz|fr\.search\.yahoo\.com|globo|go\.mail\.ru|google|google-play|hk\.search\.yahoo\.com|id\.search\.yahoo\.com|in\.search\.yahoo\.com|incredimail|it\.search\.yahoo\.com|kvasir|lens\.google\.com|lite\.qwant\.com|lycos|m\.baidu\.com|m\.naver\.com|m\.search\.naver\.com|m\.sogou\.com|mail\.rambler\.ru|mail\.yandex\.ru|malaysia\.search\.yahoo\.com|msn|msn\.com|mx\.search\.yahoo\.com|najdi|naver|naver\.com|news\.google\.com|nl\.search\.yahoo\.com|no\.search\.yahoo\.com|ntp\.msn\.com|nz\.search\.yahoo\.com|onet|onet\.pl|pe\.search\.yahoo\.com|ph\.search\.yahoo\.com|pl\.search\.yahoo\.com|play\.google\.com|qwant|qwant\.com|rakuten|rakuten\.co\.jp|rambler|rambler\.ru|se\.search\.yahoo\.com|search-results|search\.aol\.co\.uk|search\.aol\.com|search\.google\.com|search\.smt\.docomo\.ne\.jp|search\.ukr\.net|secureurl\.ukr\.net|seznam|seznam\.cz|sg\.search\.yahoo\.com|so\.com|sogou|sogou\.com|sp-web\.search\.auone\.jp|startsiden|startsiden\.no|suche\.aol\.de|terra|th\.search\.yahoo\.com|tr\.search\.yahoo\.com|tut\.by|tw\.search\.yahoo\.com|uk\.search\.yahoo\.com|ukr|us\.search\.yahoo\.com|virgilio|vn\.search\.yahoo\.com|wap\.sogou\.com|webmaster\.yandex\.ru|websearch\.rakuten\.co\.jp|yahoo|yahoo\.co\.jp|yahoo\.com|yandex|yandex\.by|yandex\.com|yandex\.com\.tr|yandex\.fr|yandex\.kz|yandex\.ru|yandex\.ua|yandex\.uz|zen\.yandex\.ru)$", "i").test(v.utmSource) && new RegExp("^(.*cp.*|ppc|retargeting|paid.*)$", "i").test(v.utmMedium)},{"name":"paid-social","test":(v) => new RegExp("^(?:43things|43things\.com|51\.com|5ch\.net|Hatena|ImageShack|academia\.edu|activerain|activerain\.com|activeworlds|activeworlds\.com|addthis|addthis\.com|airg\.ca|allnurses\.com|allrecipes\.com|alumniclass|alumniclass\.com|ameba\.jp|ameblo\.jp|americantowns|americantowns\.com|amp\.reddit\.com|ancestry\.com|anobii|anobii\.com|answerbag|answerbag\.com|answers\.yahoo\.com|aolanswers|aolanswers\.com|apps\.facebook\.com|ar\.pinterest\.com|artstation\.com|askubuntu|askubuntu\.com|asmallworld\.com|athlinks|athlinks\.com|away\.vk\.com|awe\.sm|b\.hatena\.ne\.jp|baby-gaga|baby-gaga\.com|babyblog\.ru|badoo|badoo\.com|bebo|bebo\.com|beforeitsnews|beforeitsnews\.com|bharatstudent|bharatstudent\.com|biip\.no|biswap\.org|bit\.ly|blackcareernetwork\.com|blackplanet|blackplanet\.com|blip\.fm|blog\.com|blog\.feedspot\.com|blog\.goo\.ne\.jp|blog\.naver\.com|blog\.yahoo\.co\.jp|blogg\.no|bloggang\.com|blogger|blogger\.com|blogher|blogher\.com|bloglines|bloglines\.com|blogs\.com|blogsome|blogsome\.com|blogspot|blogspot\.com|blogster|blogster\.com|blurtit|blurtit\.com|bookmarks\.yahoo\.co\.jp|bookmarks\.yahoo\.com|br\.pinterest\.com|brightkite|brightkite\.com|brizzly|brizzly\.com|business\.facebook\.com|buzzfeed|buzzfeed\.com|buzznet|buzznet\.com|cafe\.naver\.com|cafemom|cafemom\.com|camospace|camospace\.com|canalblog\.com|care\.com|care2|care2\.com|caringbridge\.org|catster|catster\.com|cbnt\.io|cellufun|cellufun\.com|centerblog\.net|chat\.zalo\.me|chegg\.com|chicagonow|chicagonow\.com|chiebukuro\.yahoo\.co\.jp|classmates|classmates\.com|classquest|classquest\.com|co\.pinterest\.com|cocolog-nifty|cocolog-nifty\.com|copainsdavant\.linternaute\.com|couchsurfing\.org|cozycot|cozycot\.com|cross\.tv|crunchyroll|crunchyroll\.com|cyworld|cyworld\.com|cz\.pinterest\.com|d\.hatena\.ne\.jp|dailystrength\.org|deluxe\.com|deviantart|deviantart\.com|dianping|dianping\.com|digg|digg\.com|diigo|diigo\.com|discover\.hubpages\.com|disqus|disqus\.com|dogster|dogster\.com|dol2day|dol2day\.com|doostang|doostang\.com|dopplr|dopplr\.com|douban|douban\.com|draft\.blogger\.com|draugiem\.lv|drugs-forum|drugs-forum\.com|dzone|dzone\.com|edublogs\.org|elftown|elftown\.com|epicurious\.com|everforo\.com|exblog\.jp|extole|extole\.com|facebook|facebook\.com|faceparty|faceparty\.com|fandom\.com|fanpop|fanpop\.com|fark|fark\.com|fb|fb\.me|fc2|fc2\.com|feedspot|feministing|feministing\.com|filmaffinity|filmaffinity\.com|flickr|flickr\.com|flipboard|flipboard\.com|folkdirect|folkdirect\.com|foodservice|foodservice\.com|forums\.androidcentral\.com|forums\.crackberry\.com|forums\.imore\.com|forums\.nexopia\.com|forums\.webosnation\.com|forums\.wpcentral\.com|fotki|fotki\.com|fotolog|fotolog\.com|foursquare|foursquare\.com|free\.facebook\.com|friendfeed|friendfeed\.com|fruehstueckstreff\.org|fubar|fubar\.com|gaiaonline|gaiaonline\.com|gamerdna|gamerdna\.com|gather\.com|geni\.com|getpocket\.com|glassboard|glassboard\.com|glassdoor|glassdoor\.com|godtube|godtube\.com|goldenline\.pl|goldstar|goldstar\.com|goo\.gl|gooblog|goodreads|goodreads\.com|google\+|googlegroups\.com|googleplus|govloop|govloop\.com|gowalla|gowalla\.com|gree\.jp|groups\.google\.com|gulli\.com|gutefrage\.net|habbo|habbo\.com|hi5|hi5\.com|hootsuite|hootsuite\.com|houzz|houzz\.com|hoverspot|hoverspot\.com|hr\.com|hu\.pinterest\.com|hubculture|hubculture\.com|hubpages\.com|hyves\.net|hyves\.nl|ibibo|ibibo\.com|id\.pinterest\.com|identi\.ca|ig|imageshack\.com|imageshack\.us|imvu|imvu\.com|in\.pinterest\.com|insanejournal|insanejournal\.com|instagram|instagram\.com|instapaper|instapaper\.com|internations\.org|interpals\.net|intherooms|intherooms\.com|irc-galleria\.net|is\.gd|italki|italki\.com|jammerdirect|jammerdirect\.com|jappy\.com|jappy\.de|kaboodle\.com|kakao|kakao\.com|kakaocorp\.com|kaneva|kaneva\.com|kin\.naver\.com|l\.facebook\.com|l\.instagram\.com|l\.messenger\.com|last\.fm|librarything|librarything\.com|lifestream\.aol\.com|line|line\.me|linkedin|linkedin\.com|listal|listal\.com|listography|listography\.com|livedoor\.com|livedoorblog|livejournal|livejournal\.com|lm\.facebook\.com|lnkd\.in|m\.blog\.naver\.com|m\.cafe\.naver\.com|m\.facebook\.com|m\.kin\.naver\.com|m\.vk\.com|m\.yelp\.com|mbga\.jp|medium\.com|meetin\.org|meetup|meetup\.com|meinvz\.net|meneame\.net|menuism\.com|messages\.google\.com|messages\.yahoo\.co\.jp|messenger|messenger\.com|mix\.com|mixi\.jp|mobile\.facebook\.com|mocospace|mocospace\.com|mouthshut|mouthshut\.com|movabletype|movabletype\.com|mubi|mubi\.com|my\.opera\.com|myanimelist\.net|myheritage|myheritage\.com|mylife|mylife\.com|mymodernmet|mymodernmet\.com|myspace|myspace\.com|netvibes|netvibes\.com|news\.ycombinator\.com|newsshowcase|nexopia|ngopost\.org|niconico|nicovideo\.jp|nightlifelink|nightlifelink\.com|ning|ning\.com|nl\.pinterest\.com|odnoklassniki\.ru|odnoklassniki\.ua|okwave\.jp|old\.reddit\.com|oneworldgroup\.org|onstartups|onstartups\.com|opendiary|opendiary\.com|oshiete\.goo\.ne\.jp|out\.reddit\.com|over-blog\.com|overblog\.com|paper\.li|partyflock\.nl|photobucket|photobucket\.com|pinboard|pinboard\.in|pingsta|pingsta\.com|pinterest|pinterest\.at|pinterest\.ca|pinterest\.ch|pinterest\.cl|pinterest\.co\.kr|pinterest\.co\.uk|pinterest\.com|pinterest\.com\.au|pinterest\.com\.mx|pinterest\.de|pinterest\.es|pinterest\.fr|pinterest\.it|pinterest\.jp|pinterest\.nz|pinterest\.ph|pinterest\.pt|pinterest\.ru|pinterest\.se|pixiv\.net|pl\.pinterest\.com|playahead\.se|plurk|plurk\.com|plus\.google\.com|plus\.url\.google\.com|pocket\.co|posterous|posterous\.com|pro\.homeadvisor\.com|pulse\.yahoo\.com|qapacity|qapacity\.com|quechup|quechup\.com|quora|quora\.com|qzone\.qq\.com|ravelry|ravelry\.com|reddit|reddit\.com|redux|redux\.com|renren|renren\.com|researchgate\.net|reunion|reunion\.com|reverbnation|reverbnation\.com|rtl\.de|ryze|ryze\.com|salespider|salespider\.com|scoop\.it|screenrant|screenrant\.com|scribd|scribd\.com|scvngr|scvngr\.com|secondlife|secondlife\.com|serverfault|serverfault\.com|shareit|sharethis|sharethis\.com|shvoong\.com|sites\.google\.com|skype|skyrock|skyrock\.com|slashdot\.org|slideshare\.net|smartnews\.com|snapchat|snapchat\.com|social|sociallife\.com\.br|socialvibe|socialvibe\.com|spaces\.live\.com|spoke|spoke\.com|spruz|spruz\.com|ssense\.com|stackapps|stackapps\.com|stackexchange|stackexchange\.com|stackoverflow|stackoverflow\.com|stardoll\.com|stickam|stickam\.com|studivz\.net|suomi24\.fi|superuser|superuser\.com|sweeva|sweeva\.com|t\.co|t\.me|tagged|tagged\.com|taggedmail|taggedmail\.com|talkbiznow|talkbiznow\.com|taringa\.net|techmeme|techmeme\.com|tencent|tencent\.com|tiktok|tiktok\.com|tinyurl|tinyurl\.com|toolbox|toolbox\.com|touch\.facebook\.com|tr\.pinterest\.com|travellerspoint|travellerspoint\.com|tripadvisor|tripadvisor\.com|trombi|trombi\.com|trustpilot|tudou|tudou\.com|tuenti|tuenti\.com|tumblr|tumblr\.com|tweetdeck|tweetdeck\.com|twitter|twitter\.com|twoo\.com|typepad|typepad\.com|unblog\.fr|urbanspoon\.com|ushareit\.com|ushi\.cn|vampirefreaks|vampirefreaks\.com|vampirerave|vampirerave\.com|vg\.no|video\.ibm\.com|vk\.com|vkontakte\.ru|wakoopa|wakoopa\.com|wattpad|wattpad\.com|web\.facebook\.com|web\.skype\.com|webshots|webshots\.com|wechat|wechat\.com|weebly|weebly\.com|weibo|weibo\.com|wer-weiss-was\.de|weread|weread\.com|whatsapp|whatsapp\.com|wiki\.answers\.com|wikihow\.com|wikitravel\.org|woot\.com|wordpress|wordpress\.com|wordpress\.org|xanga|xanga\.com|xing|xing\.com|yahoo-mbga\.jp|yammer|yammer\.com|yelp|yelp\.co\.uk|yelp\.com|youroom\.in|za\.pinterest\.com|zalo|zoo\.gr|zooppa|zooppa\.com)$", "i").test(v.utmSource) && new RegExp("^(.*cp.*|ppc|retargeting|paid.*)$", "i").test(v.utmMedium)},{"name":"paid-video","test":(v) => new RegExp("^(?:blog\.twitch\.tv|crackle|crackle\.com|curiositystream|curiositystream\.com|d\.tube|dailymotion|dailymotion\.com|dashboard\.twitch\.tv|disneyplus|disneyplus\.com|fast\.wistia\.net|help\.hulu\.com|help\.netflix\.com|hulu|hulu\.com|id\.twitch\.tv|iq\.com|iqiyi|iqiyi\.com|jobs\.netflix\.com|justin\.tv|m\.twitch\.tv|m\.youtube\.com|music\.youtube\.com|netflix|netflix\.com|player\.twitch\.tv|player\.vimeo\.com|ted|ted\.com|twitch|twitch\.tv|utreon|utreon\.com|veoh|veoh\.com|viadeo\.journaldunet\.com|vimeo|vimeo\.com|wistia|wistia\.com|youku|youku\.com|youtube|youtube\.com)$", "i").test(v.utmSource) && new RegExp("^(.*cp.*|ppc|retargeting|paid.*)$", "i").test(v.utmMedium)},{"name":"display","test":(v) => new RegExp("^(?:display|banner|expandable|interstitial|cpm)$", "i").test(v.utmMedium)},{"name":"paid-other","test":(v) => new RegExp("^(.*cp.*|ppc|retargeting|paid.*)$", "i").test(v.utmMedium)},{"name":"organic-shopping","test":(v) => new RegExp("^(?:360\.cn|alice|aol|ar\.search\.yahoo\.com|ask|at\.search\.yahoo\.com|au\.search\.yahoo\.com|auone|avg|babylon|baidu|biglobe|biglobe\.co\.jp|biglobe\.ne\.jp|bing|br\.search\.yahoo\.com|ca\.search\.yahoo\.com|centrum\.cz|ch\.search\.yahoo\.com|cl\.search\.yahoo\.com|cn\.bing\.com|cnn|co\.search\.yahoo\.com|comcast|conduit|daum|daum\.net|de\.search\.yahoo\.com|dk\.search\.yahoo\.com|dogpile|dogpile\.com|duckduckgo|ecosia\.org|email\.seznam\.cz|eniro|es\.search\.yahoo\.com|espanol\.search\.yahoo\.com|exalead\.com|excite\.com|fi\.search\.yahoo\.com|firmy\.cz|fr\.search\.yahoo\.com|globo|go\.mail\.ru|google|google-play|hk\.search\.yahoo\.com|id\.search\.yahoo\.com|in\.search\.yahoo\.com|incredimail|it\.search\.yahoo\.com|kvasir|lens\.google\.com|lite\.qwant\.com|lycos|m\.baidu\.com|m\.naver\.com|m\.search\.naver\.com|m\.sogou\.com|mail\.rambler\.ru|mail\.yandex\.ru|malaysia\.search\.yahoo\.com|msn|msn\.com|mx\.search\.yahoo\.com|najdi|naver|naver\.com|news\.google\.com|nl\.search\.yahoo\.com|no\.search\.yahoo\.com|ntp\.msn\.com|nz\.search\.yahoo\.com|onet|onet\.pl|pe\.search\.yahoo\.com|ph\.search\.yahoo\.com|pl\.search\.yahoo\.com|play\.google\.com|qwant|qwant\.com|rakuten|rakuten\.co\.jp|rambler|rambler\.ru|se\.search\.yahoo\.com|search-results|search\.aol\.co\.uk|search\.aol\.com|search\.google\.com|search\.smt\.docomo\.ne\.jp|search\.ukr\.net|secureurl\.ukr\.net|seznam|seznam\.cz|sg\.search\.yahoo\.com|so\.com|sogou|sogou\.com|sp-web\.search\.auone\.jp|startsiden|startsiden\.no|suche\.aol\.de|terra|th\.search\.yahoo\.com|tr\.search\.yahoo\.com|tut\.by|tw\.search\.yahoo\.com|uk\.search\.yahoo\.com|ukr|us\.search\.yahoo\.com|virgilio|vn\.search\.yahoo\.com|wap\.sogou\.com|webmaster\.yandex\.ru|websearch\.rakuten\.co\.jp|yahoo|yahoo\.co\.jp|yahoo\.com|yandex|yandex\.by|yandex\.com|yandex\.com\.tr|yandex\.fr|yandex\.kz|yandex\.ru|yandex\.ua|yandex\.uz|zen\.yandex\.ru)$", "i").test(v.utmSource) || new RegExp("^(.*(([^a-df-z]|^)shop|shopping).*)$", "i").test(v.utmCampaign)},{"name":"organic-social","test":(v) => new RegExp("^(?:43things|43things\.com|51\.com|5ch\.net|Hatena|ImageShack|academia\.edu|activerain|activerain\.com|activeworlds|activeworlds\.com|addthis|addthis\.com|airg\.ca|allnurses\.com|allrecipes\.com|alumniclass|alumniclass\.com|ameba\.jp|ameblo\.jp|americantowns|americantowns\.com|amp\.reddit\.com|ancestry\.com|anobii|anobii\.com|answerbag|answerbag\.com|answers\.yahoo\.com|aolanswers|aolanswers\.com|apps\.facebook\.com|ar\.pinterest\.com|artstation\.com|askubuntu|askubuntu\.com|asmallworld\.com|athlinks|athlinks\.com|away\.vk\.com|awe\.sm|b\.hatena\.ne\.jp|baby-gaga|baby-gaga\.com|babyblog\.ru|badoo|badoo\.com|bebo|bebo\.com|beforeitsnews|beforeitsnews\.com|bharatstudent|bharatstudent\.com|biip\.no|biswap\.org|bit\.ly|blackcareernetwork\.com|blackplanet|blackplanet\.com|blip\.fm|blog\.com|blog\.feedspot\.com|blog\.goo\.ne\.jp|blog\.naver\.com|blog\.yahoo\.co\.jp|blogg\.no|bloggang\.com|blogger|blogger\.com|blogher|blogher\.com|bloglines|bloglines\.com|blogs\.com|blogsome|blogsome\.com|blogspot|blogspot\.com|blogster|blogster\.com|blurtit|blurtit\.com|bookmarks\.yahoo\.co\.jp|bookmarks\.yahoo\.com|br\.pinterest\.com|brightkite|brightkite\.com|brizzly|brizzly\.com|business\.facebook\.com|buzzfeed|buzzfeed\.com|buzznet|buzznet\.com|cafe\.naver\.com|cafemom|cafemom\.com|camospace|camospace\.com|canalblog\.com|care\.com|care2|care2\.com|caringbridge\.org|catster|catster\.com|cbnt\.io|cellufun|cellufun\.com|centerblog\.net|chat\.zalo\.me|chegg\.com|chicagonow|chicagonow\.com|chiebukuro\.yahoo\.co\.jp|classmates|classmates\.com|classquest|classquest\.com|co\.pinterest\.com|cocolog-nifty|cocolog-nifty\.com|copainsdavant\.linternaute\.com|couchsurfing\.org|cozycot|cozycot\.com|cross\.tv|crunchyroll|crunchyroll\.com|cyworld|cyworld\.com|cz\.pinterest\.com|d\.hatena\.ne\.jp|dailystrength\.org|deluxe\.com|deviantart|deviantart\.com|dianping|dianping\.com|digg|digg\.com|diigo|diigo\.com|discover\.hubpages\.com|disqus|disqus\.com|dogster|dogster\.com|dol2day|dol2day\.com|doostang|doostang\.com|dopplr|dopplr\.com|douban|douban\.com|draft\.blogger\.com|draugiem\.lv|drugs-forum|drugs-forum\.com|dzone|dzone\.com|edublogs\.org|elftown|elftown\.com|epicurious\.com|everforo\.com|exblog\.jp|extole|extole\.com|facebook|facebook\.com|faceparty|faceparty\.com|fandom\.com|fanpop|fanpop\.com|fark|fark\.com|fb|fb\.me|fc2|fc2\.com|feedspot|feministing|feministing\.com|filmaffinity|filmaffinity\.com|flickr|flickr\.com|flipboard|flipboard\.com|folkdirect|folkdirect\.com|foodservice|foodservice\.com|forums\.androidcentral\.com|forums\.crackberry\.com|forums\.imore\.com|forums\.nexopia\.com|forums\.webosnation\.com|forums\.wpcentral\.com|fotki|fotki\.com|fotolog|fotolog\.com|foursquare|foursquare\.com|free\.facebook\.com|friendfeed|friendfeed\.com|fruehstueckstreff\.org|fubar|fubar\.com|gaiaonline|gaiaonline\.com|gamerdna|gamerdna\.com|gather\.com|geni\.com|getpocket\.com|glassboard|glassboard\.com|glassdoor|glassdoor\.com|godtube|godtube\.com|goldenline\.pl|goldstar|goldstar\.com|goo\.gl|gooblog|goodreads|goodreads\.com|google\+|googlegroups\.com|googleplus|govloop|govloop\.com|gowalla|gowalla\.com|gree\.jp|groups\.google\.com|gulli\.com|gutefrage\.net|habbo|habbo\.com|hi5|hi5\.com|hootsuite|hootsuite\.com|houzz|houzz\.com|hoverspot|hoverspot\.com|hr\.com|hu\.pinterest\.com|hubculture|hubculture\.com|hubpages\.com|hyves\.net|hyves\.nl|ibibo|ibibo\.com|id\.pinterest\.com|identi\.ca|ig|imageshack\.com|imageshack\.us|imvu|imvu\.com|in\.pinterest\.com|insanejournal|insanejournal\.com|instagram|instagram\.com|instapaper|instapaper\.com|internations\.org|interpals\.net|intherooms|intherooms\.com|irc-galleria\.net|is\.gd|italki|italki\.com|jammerdirect|jammerdirect\.com|jappy\.com|jappy\.de|kaboodle\.com|kakao|kakao\.com|kakaocorp\.com|kaneva|kaneva\.com|kin\.naver\.com|l\.facebook\.com|l\.instagram\.com|l\.messenger\.com|last\.fm|librarything|librarything\.com|lifestream\.aol\.com|line|line\.me|linkedin|linkedin\.com|listal|listal\.com|listography|listography\.com|livedoor\.com|livedoorblog|livejournal|livejournal\.com|lm\.facebook\.com|lnkd\.in|m\.blog\.naver\.com|m\.cafe\.naver\.com|m\.facebook\.com|m\.kin\.naver\.com|m\.vk\.com|m\.yelp\.com|mbga\.jp|medium\.com|meetin\.org|meetup|meetup\.com|meinvz\.net|meneame\.net|menuism\.com|messages\.google\.com|messages\.yahoo\.co\.jp|messenger|messenger\.com|mix\.com|mixi\.jp|mobile\.facebook\.com|mocospace|mocospace\.com|mouthshut|mouthshut\.com|movabletype|movabletype\.com|mubi|mubi\.com|my\.opera\.com|myanimelist\.net|myheritage|myheritage\.com|mylife|mylife\.com|mymodernmet|mymodernmet\.com|myspace|myspace\.com|netvibes|netvibes\.com|news\.ycombinator\.com|newsshowcase|nexopia|ngopost\.org|niconico|nicovideo\.jp|nightlifelink|nightlifelink\.com|ning|ning\.com|nl\.pinterest\.com|odnoklassniki\.ru|odnoklassniki\.ua|okwave\.jp|old\.reddit\.com|oneworldgroup\.org|onstartups|onstartups\.com|opendiary|opendiary\.com|oshiete\.goo\.ne\.jp|out\.reddit\.com|over-blog\.com|overblog\.com|paper\.li|partyflock\.nl|photobucket|photobucket\.com|pinboard|pinboard\.in|pingsta|pingsta\.com|pinterest|pinterest\.at|pinterest\.ca|pinterest\.ch|pinterest\.cl|pinterest\.co\.kr|pinterest\.co\.uk|pinterest\.com|pinterest\.com\.au|pinterest\.com\.mx|pinterest\.de|pinterest\.es|pinterest\.fr|pinterest\.it|pinterest\.jp|pinterest\.nz|pinterest\.ph|pinterest\.pt|pinterest\.ru|pinterest\.se|pixiv\.net|pl\.pinterest\.com|playahead\.se|plurk|plurk\.com|plus\.google\.com|plus\.url\.google\.com|pocket\.co|posterous|posterous\.com|pro\.homeadvisor\.com|pulse\.yahoo\.com|qapacity|qapacity\.com|quechup|quechup\.com|quora|quora\.com|qzone\.qq\.com|ravelry|ravelry\.com|reddit|reddit\.com|redux|redux\.com|renren|renren\.com|researchgate\.net|reunion|reunion\.com|reverbnation|reverbnation\.com|rtl\.de|ryze|ryze\.com|salespider|salespider\.com|scoop\.it|screenrant|screenrant\.com|scribd|scribd\.com|scvngr|scvngr\.com|secondlife|secondlife\.com|serverfault|serverfault\.com|shareit|sharethis|sharethis\.com|shvoong\.com|sites\.google\.com|skype|skyrock|skyrock\.com|slashdot\.org|slideshare\.net|smartnews\.com|snapchat|snapchat\.com|social|sociallife\.com\.br|socialvibe|socialvibe\.com|spaces\.live\.com|spoke|spoke\.com|spruz|spruz\.com|ssense\.com|stackapps|stackapps\.com|stackexchange|stackexchange\.com|stackoverflow|stackoverflow\.com|stardoll\.com|stickam|stickam\.com|studivz\.net|suomi24\.fi|superuser|superuser\.com|sweeva|sweeva\.com|t\.co|t\.me|tagged|tagged\.com|taggedmail|taggedmail\.com|talkbiznow|talkbiznow\.com|taringa\.net|techmeme|techmeme\.com|tencent|tencent\.com|tiktok|tiktok\.com|tinyurl|tinyurl\.com|toolbox|toolbox\.com|touch\.facebook\.com|tr\.pinterest\.com|travellerspoint|travellerspoint\.com|tripadvisor|tripadvisor\.com|trombi|trombi\.com|trustpilot|tudou|tudou\.com|tuenti|tuenti\.com|tumblr|tumblr\.com|tweetdeck|tweetdeck\.com|twitter|twitter\.com|twoo\.com|typepad|typepad\.com|unblog\.fr|urbanspoon\.com|ushareit\.com|ushi\.cn|vampirefreaks|vampirefreaks\.com|vampirerave|vampirerave\.com|vg\.no|video\.ibm\.com|vk\.com|vkontakte\.ru|wakoopa|wakoopa\.com|wattpad|wattpad\.com|web\.facebook\.com|web\.skype\.com|webshots|webshots\.com|wechat|wechat\.com|weebly|weebly\.com|weibo|weibo\.com|wer-weiss-was\.de|weread|weread\.com|whatsapp|whatsapp\.com|wiki\.answers\.com|wikihow\.com|wikitravel\.org|woot\.com|wordpress|wordpress\.com|wordpress\.org|xanga|xanga\.com|xing|xing\.com|yahoo-mbga\.jp|yammer|yammer\.com|yelp|yelp\.co\.uk|yelp\.com|youroom\.in|za\.pinterest\.com|zalo|zoo\.gr|zooppa|zooppa\.com)$", "i").test(v.utmSource) || new RegExp("^(?:social|social-network|social-media|sm|social network|social media)$", "i").test(v.utmMedium)},{"name":"organic-video","test":(v) => new RegExp("^(?:blog\.twitch\.tv|crackle|crackle\.com|curiositystream|curiositystream\.com|d\.tube|dailymotion|dailymotion\.com|dashboard\.twitch\.tv|disneyplus|disneyplus\.com|fast\.wistia\.net|help\.hulu\.com|help\.netflix\.com|hulu|hulu\.com|id\.twitch\.tv|iq\.com|iqiyi|iqiyi\.com|jobs\.netflix\.com|justin\.tv|m\.twitch\.tv|m\.youtube\.com|music\.youtube\.com|netflix|netflix\.com|player\.twitch\.tv|player\.vimeo\.com|ted|ted\.com|twitch|twitch\.tv|utreon|utreon\.com|veoh|veoh\.com|viadeo\.journaldunet\.com|vimeo|vimeo\.com|wistia|wistia\.com|youku|youku\.com|youtube|youtube\.com)$", "i").test(v.utmSource) || new RegExp("^(.*video.*)$", "i").test(v.utmMedium)},{"name":"organic-search","test":(v) => new RegExp("^(?:360\.cn|alice|aol|ar\.search\.yahoo\.com|ask|at\.search\.yahoo\.com|au\.search\.yahoo\.com|auone|avg|babylon|baidu|biglobe|biglobe\.co\.jp|biglobe\.ne\.jp|bing|br\.search\.yahoo\.com|ca\.search\.yahoo\.com|centrum\.cz|ch\.search\.yahoo\.com|cl\.search\.yahoo\.com|cn\.bing\.com|cnn|co\.search\.yahoo\.com|comcast|conduit|daum|daum\.net|de\.search\.yahoo\.com|dk\.search\.yahoo\.com|dogpile|dogpile\.com|duckduckgo|ecosia\.org|email\.seznam\.cz|eniro|es\.search\.yahoo\.com|espanol\.search\.yahoo\.com|exalead\.com|excite\.com|fi\.search\.yahoo\.com|firmy\.cz|fr\.search\.yahoo\.com|globo|go\.mail\.ru|google|google-play|hk\.search\.yahoo\.com|id\.search\.yahoo\.com|in\.search\.yahoo\.com|incredimail|it\.search\.yahoo\.com|kvasir|lens\.google\.com|lite\.qwant\.com|lycos|m\.baidu\.com|m\.naver\.com|m\.search\.naver\.com|m\.sogou\.com|mail\.rambler\.ru|mail\.yandex\.ru|malaysia\.search\.yahoo\.com|msn|msn\.com|mx\.search\.yahoo\.com|najdi|naver|naver\.com|news\.google\.com|nl\.search\.yahoo\.com|no\.search\.yahoo\.com|ntp\.msn\.com|nz\.search\.yahoo\.com|onet|onet\.pl|pe\.search\.yahoo\.com|ph\.search\.yahoo\.com|pl\.search\.yahoo\.com|play\.google\.com|qwant|qwant\.com|rakuten|rakuten\.co\.jp|rambler|rambler\.ru|se\.search\.yahoo\.com|search-results|search\.aol\.co\.uk|search\.aol\.com|search\.google\.com|search\.smt\.docomo\.ne\.jp|search\.ukr\.net|secureurl\.ukr\.net|seznam|seznam\.cz|sg\.search\.yahoo\.com|so\.com|sogou|sogou\.com|sp-web\.search\.auone\.jp|startsiden|startsiden\.no|suche\.aol\.de|terra|th\.search\.yahoo\.com|tr\.search\.yahoo\.com|tut\.by|tw\.search\.yahoo\.com|uk\.search\.yahoo\.com|ukr|us\.search\.yahoo\.com|virgilio|vn\.search\.yahoo\.com|wap\.sogou\.com|webmaster\.yandex\.ru|websearch\.rakuten\.co\.jp|yahoo|yahoo\.co\.jp|yahoo\.com|yandex|yandex\.by|yandex\.com|yandex\.com\.tr|yandex\.fr|yandex\.kz|yandex\.ru|yandex\.ua|yandex\.uz|zen\.yandex\.ru)$", "i").test(v.utmSource) || v.utmMedium.toLowerCase() === "organic"},{"name":"referral","test":(v) => new RegExp("^(?:referral|app|link)$", "i").test(v.utmMedium)},{"name":"email","test":(v) => new RegExp("^(?:email|e-mail|e_mail|e mail)$", "i").test(v.utmMedium) || new RegExp("^(?:email|e-mail|e_mail|e mail)$", "i").test(v.utmSource)},{"name":"affiliate","test":(v) => v.utmMedium.toLowerCase() === "affiliate"},{"name":"audio","test":(v) => v.utmMedium.toLowerCase() === "audio"},{"name":"sms","test":(v) => v.utmSource.toLowerCase() === "sms" || v.utmMedium.toLowerCase() === "sms"},{"name":"mobile-push-notification","test":(v) => v.utmSource.toLowerCase() === "firebase" || new RegExp("(?:.*mobile.*|.*notification.*|push$)", "i").test(v.utmMedium)}].find(s=>s.test(e)))==null?void 0:i.name)??"other"}getShopifyAnalyticsId(){return this.getCookie("_shopify_y")}legacyGetCookieVisitor(){const e=this.getCookie("SHOPLIFT");return e===null?null:JSON.parse(e,x)}getCookie(e){const t=this.cookie.split("; ").filter(i=>i.split("=").at(0)===e).at(0);return t===void 0?null:t.split("=").slice(1).join("=")}monitorConsentChange(){document.addEventListener("visitorConsentCollected",e=>void(async()=>await this.onConsentChange(e.detail.analyticsAllowed,!0))()),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>this.loadShopifyConsentApiWithRetry()):this.loadShopifyConsentApiWithRetry()}loadShopifyConsentApiWithRetry(){let e=0;const t=()=>{this.loadShopifyConsentApi()||e++<10&&window.setTimeout(t,100)};t()}loadShopifyConsentApi(){if(window.Shopify){this.log("Loading Shopify features");const e=async()=>{if(!window.Shopify){this.log("Shopify object missing... suddenly?");return}if(window.Shopify.customerPrivacy===void 0){this.log("Shopify CustomerPrivacy api still missing, trying again in 1000ms"),t=window.setTimeout(()=>void(async()=>await e())(),1e3);return}const i=window.Shopify.customerPrivacy.getTrackingConsent();await this.onConsentChange(window.Shopify.customerPrivacy.analyticsProcessingAllowed(),i==="yes")};let t=window.setTimeout(()=>void(async()=>await e())(),5e3);return window.Shopify.loadFeatures([{name:"consent-tracking-api",version:"0.1"}],i=>{(async()=>{if(window.clearTimeout(t),i){this.log("Error loading consent tracking",i);return}await e()})()}),!0}return!1}async onConsentChange(e,t){try{if(this.log("Consent change detected"),this.state.essential.consentApproved=e,this.state.essential.hasConsentInteraction=t,!this.state.essential.consentApproved){this.state.essential.hasConsentInteraction&&(this.state.analytics.queue.length=0),this.saveState();return}this.cookie=document.cookie,this.shopifyAnalyticsId=this.getShopifyAnalyticsId();for(const i of this.state.analytics.queue.filter(s=>s.type===1||s.type===2)){const s=i;s.shopifyAnalyticsId=this.shopifyAnalyticsId}this.saveState(),await this.syncAllEvents()}catch(i){this.log("Error syncing on consent change",i)}}isThemePreview(){return isThemePreview||themeRole!=="main"}clearThemeBar(e,t,i){const s=structuredClone(i);this.log("Looking for theme bar"),this.waitForElement(null,"body").then(r=>this.waitForElement(r,"#preview-bar-iframe, #PBarNextFrameWrapper").then(o=>(this.log("Found theme bar"),t&&(this.log("Removing theme bar"),o.remove()),e?this.makeRequest({url:`${this.eventHost}/api/v0/logs`,method:"post",data:JSON.stringify({...this.debugState(),stateAtEvaluation:s},$)}):Promise.resolve(null)))).catch(r=>console.error(r))}waitForElement(e,t){return new Promise(i=>{const s=document.querySelector(t);if(s){i(s);return}const r=new MutationObserver(o=>{const n=document.querySelector(t);if(n){r.disconnect(),i(n);return}});r.observe(e??document.documentElement,{childList:!0})})}setDebug(e){this.state.essential.debugMode=e,this.saveState()}log(e,...t){this.logHistory.push([`[SL] ${e}`,...t.map(i=>JSON.stringify(i))].join(" ")),!(!this.state.essential.debugMode&&!this.shopliftDebug)&&console.debug(`[SL] ${e}`,...t)}debugState(){return{state:this.state,storage:{essential:this.loadLocalStorage(this.essentialSessionKey),analytics:this.loadLocalStorage(this.analyticsSessionKey)},params:{shop:this.shop,host:this.host,eventHost:this.eventHost,cssHideClass:this.cssHideClass,testConfigs:this.testConfigs,inactiveTestConfigs:this.inactiveTestConfigs,sendPageView:this.sendPageView,isShopifyMerchantCookie:this.getCookie("is_shopify_merchant"),themeId,url:window.location.href,isThemePreview,themeRole,gaConfig:this.gaConfig},logHistory:this.logHistory}}debug(){const e=this.debugState();console.log(JSON.stringify(e,$,2))}}(async function(){window.shopliftInstance||(window.shopliftInstance=new ie("contractor-training-center.myshopify.com","https://app.shoplift.ai","https://events.shoplift.ai",false,false,false,{"sendEvents":false,"mode":"gtag"},false,1000,[],[{"id":"d62fd5ff-8d97-4bc3-966c-6b375eb4b4e3","status":"paused","hypotheses":[{"id":"a07829a9-8cdb-49b1-bb5b-9d0e280710dc","type":"urlRedirect","themeId":139955765325,"affix":"","isControl":true,"redirectPath":"/collections/tennessee-nascla"},{"id":"e7266e3f-8b6b-4b83-a3c5-3705462ad8b4","type":"urlRedirect","themeId":139955765325,"affix":"","isControl":false,"redirectPath":"/collections/tennessee-nascla-commercial-builder-exam-a-b"}],"ignoreTestViewParameterEnforcement":false},{"id":"32b871a1-74c5-454d-bbfa-cda5c76a18db","status":"paused","hypotheses":[{"id":"50bddbeb-5e51-4216-8718-7785dad51deb","type":"urlRedirect","themeId":139955765325,"affix":"","isControl":true,"redirectPath":"/collections/alabama-nascla"},{"id":"0a96febd-f8f3-4ba6-8223-68755448a3f6","type":"urlRedirect","themeId":139955765325,"affix":"","isControl":false,"redirectPath":"/collections/alabama-nascla-commercial-builder-exam-a-b"}],"ignoreTestViewParameterEnforcement":false},{"id":"e2b17d40-8734-4b2e-9ea3-c3b43c2730ef","status":"paused","hypotheses":[{"id":"2b61976f-e98f-4a7b-a267-d40831319a41","type":"urlRedirect","themeId":139955765325,"affix":"","isControl":true,"redirectPath":"/blogs/news/how-to-become-a-general-contractor-in-florida"},{"id":"0446231e-5f9f-40f9-a947-1797aed3d376","type":"urlRedirect","themeId":139955765325,"affix":"","isControl":false,"redirectPath":"/blogs/news/how-to-become-a-general-contractor-in-florida-2"}],"ignoreTestViewParameterEnforcement":false},{"id":"a236d4df-032d-451d-b812-930a9cfdbde1","status":"paused","hypotheses":[{"id":"88c451bc-07e9-4ce6-983a-06bc0da3b993","type":"urlRedirect","themeId":139955765325,"affix":"","isControl":true,"redirectPath":"/collections/national-nascla"},{"id":"3d13597d-fa1f-4b2c-ac75-d8c1ce2f12ba","type":"urlRedirect","themeId":139955765325,"affix":"","isControl":false,"redirectPath":"/collections/national-nascla-commercial-builder-exam-a-b"}],"ignoreTestViewParameterEnforcement":false},{"id":"83fd2840-50f0-4708-ab19-88c16f26e16f","status":"paused","hypotheses":[{"id":"88ad32a4-0b96-4baa-b2d2-ac86fcdfd2ed","type":"urlRedirect","themeId":139955765325,"affix":"","isControl":true,"redirectPath":"/collections/north-carolina-nascla"},{"id":"e59d1630-be2c-4e7f-8a66-a25fc673d139","type":"urlRedirect","themeId":139955765325,"affix":"","isControl":false,"redirectPath":"/collections/north-carolina-nascla-commercial-builder-exam-a-b"}],"ignoreTestViewParameterEnforcement":false},{"id":"f5f70c72-fa17-40a1-a617-5948c6a12b72","status":"paused","hypotheses":[{"id":"112e32ad-9da0-4cd0-b437-2d5e8353ee2b","type":"urlRedirect","themeId":139955765325,"affix":"","isControl":true,"redirectPath":"/collections/florida-nascla"},{"id":"3e21781a-734b-4f11-b199-de47c857052a","type":"urlRedirect","themeId":139955765325,"affix":"","isControl":false,"redirectPath":"/collections/florida-nascla-commercial-builder-exam-a-b"}],"ignoreTestViewParameterEnforcement":false},{"id":"b1f7d851-d996-4dbf-94a4-e38457d3d7e9","status":"paused","hypotheses":[{"id":"0843b1af-e47e-4ee7-abe1-64e43169e314","type":"urlRedirect","themeId":139955765325,"affix":"","isControl":true,"redirectPath":"/collections/south-carolina-unlimited"},{"id":"fefad671-6f8b-43fc-81ea-dfde7d8d21ac","type":"urlRedirect","themeId":139955765325,"affix":"","isControl":false,"redirectPath":"/collections/south-carolina-unlimited-builder-nascla-exam-a-b"}],"ignoreTestViewParameterEnforcement":false},{"id":"8d4ca658-f904-42a3-bcce-c1acce4b70ad","status":"paused","hypotheses":[{"id":"5fa2e4b9-8ca5-45b0-8bd5-1910c33b45e9","type":"urlRedirect","themeId":139955765325,"affix":"","isControl":true,"redirectPath":"/collections/virginia-nascla"},{"id":"0144f64d-a6ae-4119-bba5-1e08d9c2e34b","type":"urlRedirect","themeId":139955765325,"affix":"","isControl":false,"redirectPath":"/collections/virginia-nascla-commercial-builder-exam-a-b"}],"ignoreTestViewParameterEnforcement":false},{"id":"6cdd87fb-6dd9-4539-be55-efb3c150cd7b","status":"paused","hypotheses":[{"id":"d20ec80d-336a-4cf7-b2e0-d6e9498322fc","type":"urlRedirect","themeId":139955765325,"affix":"","isControl":true,"redirectPath":"/collections/national-nascla"},{"id":"c8f20010-bd9d-4b62-b138-e6e14ba074cc","type":"urlRedirect","themeId":139955765325,"affix":"","isControl":false,"redirectPath":"/collections/national-nascla-2"}],"ignoreTestViewParameterEnforcement":false},{"id":"cf472a25-ce5a-4616-a960-c0a6d4586b63","status":"paused","hypotheses":[{"id":"d5ec812b-b1fc-43de-bb17-07a4bb8f276e","type":"urlRedirect","themeId":139955765325,"affix":"","isControl":true,"redirectPath":"/collections/louisiana-nascla"},{"id":"7f4fe4ed-4479-448d-a38f-69531ebe8f18","type":"urlRedirect","themeId":139955765325,"affix":"","isControl":false,"redirectPath":"/collections/louisiana-nascla-commercial-builder-exam-a-b"}],"ignoreTestViewParameterEnforcement":false},{"id":"17d394b1-be8b-4451-9035-0b05e44e7cb7","status":"paused","hypotheses":[{"id":"55a72a3f-6f92-4f40-9e8f-5d63e220310c","type":"urlRedirect","themeId":139955765325,"affix":"","isControl":true,"redirectPath":"/collections/arizona-nascla"},{"id":"a0c03de7-234b-4e3b-8bd6-76ac1680c2ab","type":"urlRedirect","themeId":139955765325,"affix":"","isControl":false,"redirectPath":"/collections/arizona-nascla-commercial-builder-exam-a-b"}],"ignoreTestViewParameterEnforcement":false},{"id":"686d7f35-217c-42b7-9bad-4551e103e78b","status":"paused","hypotheses":[{"id":"f83e155d-f09f-45b5-809e-a06694622823","type":"urlRedirect","themeId":139955765325,"affix":"","isControl":true,"redirectPath":"/collections/georgia-nascla"},{"id":"286fdf32-bc6a-4a3f-8c21-bb7c0833b068","type":"urlRedirect","themeId":139955765325,"affix":"","isControl":false,"redirectPath":"/collections/georgia-nascla-general-contractor-exam-a-b"}],"ignoreTestViewParameterEnforcement":false}]),await window.shopliftInstance.init())})()})(); })("/", { suffix: "state", type: "collection" }, "main", 139955765325, false)</script>
Join thousands of professionals who launched successful careers through our flexible courses. We offer comprehensive education and tools you need to start and grow your career as a contractor.
Navigating the requirements of becoming a contractor can be confusing, and the process often changes from state to state. Whether you are a first-time applicant or an experienced contractor looking for a license in additional states, getting the answers to your questions can be tedious and time-consuming. Let us help you streamline this process an build a plan to reach your career goals with a 30-minute start-up call and follow-up email support with a contractor licensing expert!
We're here to help you select the best program for your needs. Get in touch with us to discuss your options in selecting the right course to fit your needs.
Most states use licensing procedures for certain professions like real estate and medicine. These regulations protect residents against fraud and lack of experience. Â
The same goes for obtaining a contractor's license. Depending on the state you are in the rules and regulations surrounding contractor's certifications vary.Â
In some states, obtaining a contractor's license is difficult and requires you to jump through a lot of hoops. On the other hand, some states maintain relatively lax requirements.Â
Wherever you plan on getting your certification, being prepared for the exam and collecting all of your supplemental materials are essential if you want to have a smooth experience.Â
At Contractor Training Center, our mission is to help you prepare for the contractor's license exam in your state. Our prep courses set you up not only for passing the exams successfully but also for a long future of working in this business.Â
To become licensed in the state of Kansas, you must acquire certification at the local level through your city, county, or jurisdiction.Â
Kansas does not require licenses for general contractors at a state level (except for asbestos abatement & water well drilling). Therefore, you must meet specific local requirements, supply the necessary documentation, and pay any local fees.Â
Any non-resident contractors and subcontractors have to register with the Department of Revenue if contracts exceed $10,000. Authorized corporations in Kansas do not need to register contracts.Â
To complete registration, you can contact the Director of Taxation Registration at the Kansas Department of Revenue. Additionally, you should contact your local municipality or county.
Why you should get a Contractor's license in Kansas
A contractor's license offers several benefits that ultimately help bolster your success as a contractor.
Gives You Credibility
Having a license increases your credibility, allowing you to build trust with your clients. There are other ways you can gain their trust, but this is a big part of establishing yourself and your business, especially if you're working with new customers.
Getting a contractor's license isn't done overnight, and the process of obtaining a license can be considered a significant investment. Customers often feel at ease knowing a contractor has invested their own time and money working to back up their skills with a license to prove it.
Gives You A Higher Earning Potential
Consequently, there are larger projects that you can't perform without a contractor's license. With one, you can take on big assignments, get more jobs, and increase your profit. More times than not, clients will pay a higher price to a licensed contractor as opposed to unlicensed handymen.
With a license, your clients can trust that you have the knowledge and skills to do what they need. It’s an assurance that you’ll follow all applicable laws and regulations. You can build a relationship with your customers and establish trust in other ways, of course. However, a licensed contractor will stand out far more and attract customers easier.
Additionally, many states legally require businesses to hold a contractor's license to work on projects over a certain financial threshold. If you take the initiative and earn your license now, you can get more business, increase profits, and take on more significant assignments right away. Clients will typically pay a higher fee for licensed contractors because they can trust that the contractor knows what to do and how to do it well.
What to Expect
Get a strong start in building your career
Contractor Training Center operates with industry leaders who have extensive construction and business experience. Our students learn from experts who have a comprehensive knowledge of contractor licensing.Â
We use a live, online learning model so you can get the benefits of an interactive learning experience without having to leave your home or office.Â
When you take one of our courses, you gain access to our application assistance services. With our services, you can be confident in the quality and correctness of your applications. This assistance will save you time and money.Â
With a pass rate of 98%, we're confident our self-study programs can help you succeed. Our exam prep will give you the guidance and clarity you need to thrive as a general contractor.Â
If you do not pass the exam on your first try, we'll create a custom study plan tailored to your learning style. This new plan will address any problem areas so that you can shift your focus to the material you may not have understood the first time around.Â
We're confident that we can meet all of your expectations and even surpass them. We offer a no-fail guarantee so that you can place your trust in us. If our courses do not prevent you from failing your exam after several attempts, you can take our classes for free until you do pass.Â
Exam Preparation
What you'll need to prepare for the exam
At Contractor Training Center, we offer many different prep courses to help you ensure that you pass your contractor's licensing exam.Â
It is our mission to give you all the materials you need to help you study, including tabs for exam books and practice tests. Besides helping you prepare for the licensing exam, we also provide insights about strategic business practices. These insights help you to avoid problems and manage client relationships effectively. All of the information we share is invaluable for a contractor since the profession requires complying with strict regulations and guidelines.Â
Which Exam Should You Take?Â
Type 1: General Contractors License - Class A
The Class A license allows you to build, contract, repair, add onto or demolish any building or structure. With this type of license, you can work on commercial and residential buildings.Â
Type 2: Building Contractor License - Class B
The Class B license will allow you to erect, build, remodel, demolish, or add on to commercial buildings and single or multi-unit residential buildings that are three stories or less.
Type 3: Residential Contractor - Class C
The Class C license allows you to repair, construct, demolish, or remodel single or two-family homes and accessory buildings.
Note: You can also elect to obtain a specialty contractor's license. These specialties included sign and maintenance, electrical, plumbing, etc. Explore our blog where we show you exactly how to earn your electrical contractor license in Kansas!
We offer prep courses and reference materials for these exams:
Kansas 367: This is the exam for the Standard Concrete Contractor
Kansas 550: This is the exam for the Standard General Building Contractor (A)
Kansas 551: This is the exam for the Standard Building Contractor (B)
Kansas 552: This is the exam for the Standard Residential Building Contractor (C)Â
License Requirements
How to get a contractor's license in Kansas
If you've decided that you want to pursue a contractor's license, there are specific steps you need to take. Contractor Training Center can help you through the entire process.Â
Since the state of Kansas doesn't handle licensing directly, you must accomplish this step at a local level. Even though there aren't any statewide licensing requirements, there are still county or city requirements.Â
For example, to work in Overland, KS, as a contractor, you'll need to register with the Johnson County Contractor Licensing Search System. Through this system, clients can verify your status as a contractor using a name, address, or license type.Â
In Wichita, you'll need to obtain a license from the Metropolitan Area Building and Construction Department. The agency's Permits and Neighborhood Code Violation Reporting online portal lets users verify a contractor, business permit, or building.Â
To work as a GC in Kansas City and Wyandotte County, you must hold a business license from the City License Administrator.Â
If you are unsure about what the process is in your city or county, contact the city or county clerk. Application fees, bond amounts, required insurance variability, and experience requirements vary between cities and counties.Â
2. Create a business entity
If you're pursuing your contractor's license, it's likely that you want to make general contracting your full-time profession. If this is the case, you want to create a business entity to establish legitimacy.Â
You can find out if the name you've chosen for your company is available or already in use by someone else through the Kansas Entity Search.
3. Register your businessÂ
Registering your business is necessary to ensure that your company pays the taxes required and adheres to local and state laws.Â
You can find the forms you need to register a new company at the Kansas Department of Revenue website.Â
To register your company, you will need to contact the Kansas Secretary of State, located at:
Kansas Secretary of State
Memorial Hall, First Floor 120 S. W. 10th Ave
Topeka, KS 66612-1594Â
You also should contact the local municipality or county. As mentioned above, different counties and cities have different regulatory bodies that oversee construction in Kansas.Â
4. Decide what type of license your business needs
The exam and type of license you will apply for depends on the type of work you plan to do and your professional goals. The International Code Council administers these exams. You can find out more information about the content of the exams through their bulletin.Â
5. Identify a qualified individual
Every contractor must select one individual from their company to pass a qualifying exam. This individual operates as the "Qualifying Person."Â
Sole proprietors and business owners can choose to be their own qualifying person. The qualifying person can also be a company owner or full-time employee (someone who works 30+ hours weekly).
The qualifying person is required to meet at least one of two requirements:
Pass a required exam through an approved administrator. They must receive a score of 75% or higher.
Have a Bachelor of Science Degree in Construction Science, Architecture, or Engineering from an accredited university. The qualifying person must provide their official transcripts or a copy of their degree.
This person must also prove that they have at least five years of experience as a general, building, or residential contractor.Â
They also will need to obtain general liability and worker's compensation insurance. The policy must be with a licensed company.Â
If you are obtaining the license, and you do not plan to hire any employees, you must sign a worker's compensation waiver.Â
6. Take the examÂ
Depending on where you are in Kansas, requirements may vary. For Wichita, your license will be under the purview of the Sedgwick County Metropolitan Area Building and Construction Department.Â
This license requires you to register for a business license, appoint a qualified individual, present a certificate of good standing, present a notarized certificate of insurance, and pay all application and licensing fees:Â
$50 application fee
$1000 for two years (A)
$600 for two years (B)
$450 for two years (C)Â
Frequently Asked Questions
Learn more about the contractor licensing process.
Does Kansas require continued education?
Kansas does not require continued education at the state level. However, you should check with the local municipality and county regulations.
Does Kansas accept the NASCLA accredited commercial contractor license?
At this time, Kansas does not accept NASCLA transcripts to fulfill licensing test requirements.
How long is my license valid?
The valid period may vary by municipality. In the city of Wichita, the license will be valid for two years, with the expiration date set for December 31st. A grace period until January 31st is available, during which time contractors will need to renew their license and make sure the insurance is up-to-date. Contractors with expired licenses or insurance may face penalties. Other localities have different rules, so it is important to contact your local regulatory authority to know when your license expires.
Stay connected with CTC
Subscribe now
Build your knowledge and sharpen your skills—get contractor tips, tools, and updates straight to your inbox. Sign up today!
By providing my personal information, including phone number, I consent to receive email messages, auto-dialed calls, texts, and prerecorded messages from Contractor Training Center with information and offers, including current and possible future services, customer service and billing and agree to the Terms of Service & Privacy Policy. Â If, at any time, you wish to opt out of electronic or text communications, reply STOP to cancel, HELP for help. Msg & data rates may apply. To opt out of email, follow the unsubscribe process on the email communication. I understand that my consent is not required to purchase, and that cancellation of purchase does not automatically revoke this consent.
Choosing a selection results in a full page refresh.