var sdk=function(t){var e,n,o;!function(t){t.JSCondition="jsCondition",t.JSFunction="jsFunction",t.JSEvent="jsEvent",t.Selector="selector",t.ElementEvent="elementEvent",t.PageLoad="pageLoad",t.Timeout="timeout",t.Inactivity="inactivity",t.ExitIntent="exitIntent",t.Conjunction="conjunction"}(e||(e={})),function(t){t[t.PAUSED=4]="PAUSED"}(n||(n={})),function(t){t[t.LOCAL=0]="LOCAL",t[t.STAGE=1]="STAGE",t[t.PROD=2]="PROD",t[t.TEST=3]="TEST"}(o||(o={}));const i="lmi_preview";let r=!1;function a(){return!0===f(()=>window.vslyDeferResources)}function s(t,e){void 0===e&&(e=20);let n=0;return function(){clearTimeout(n),n=setTimeout(()=>t(...[].slice.call(arguments)),e)}}window.addEventListener("load",()=>{setTimeout(()=>{r=!0},2e3)});const c="vsly-hide-theme-preview",l=()=>new Date(1e3*Math.floor(Date.now()/1e3)),u=function(){try{return Promise.resolve(d(()=>!!f(()=>window.loomi.jitsu),a()?1e3:500,120)).then(function(){return f(()=>window.loomi.jitsu)})}catch(t){return Promise.reject(t)}};function d(t,e,n,o){return void 0===e&&(e=500),void 0===n&&(n=4),new Promise((i,r)=>{t()?i(0):0!==n?setTimeout(()=>{o&&o()&&r(`condition rejected ${f(()=>t.toString())}`),d(t,e,n-1).then(i).catch(r)},e):r(`condition rejected ${f(()=>t.toString())}`)})}function m(t){return!Array.isArray(t)||0===t.length}function w(t){return f(()=>t.toString(),"")}function f(t,e){void 0===e&&(e=void 0);try{return t()}catch{return e}}function h(t,e,n){void 0===e&&(e=5),void 0===n&&(n=500),e>=0&&!f(t)&&setTimeout(()=>{f(t)||h(t,e-1)},n)}function p(){window.loomi_ctx=window.loomi_ctx||{}}function v(t){window.loomi_ctx.tagIds=window.loomi_ctx.tagIds||new Set;const e=f(()=>window.loomi.conf&&window.loomi.conf.googleTags||[],[]);m(e)?t.forEach(t=>window.loomi_ctx.tagIds.add(t)):window.loomi_ctx.tagIds=new Set(e),window.loomi_ctx.gtags=window.loomi_ctx.gtags||[]}function g(t){return t.replace(/[^a-z_A-Z0-9]/gi,"_")}const y=()=>f(()=>window.Shopify.customerPrivacy.analyticsProcessingAllowed)||f(()=>window.Shopify.customerPrivacy.userCanBeTracked)||f(()=>window.visually.analyticsProcessingAllowed),_={DEBUG:{name:"DEBUG",severity:10},INFO:{name:"INFO",severity:100},WARN:{name:"WARN",severity:1e3},ERROR:{name:"ERROR",severity:1e4},NONE:{name:"NONE",severity:1e4}};let E;function S(){return E||(E=function(){const t=f(()=>window.location.search.includes("lmi_debug"))?_.WARN:_.NONE,e={minLogLevel:t};return Object.values(_).forEach(n=>{let{name:o,severity:i}=n;e[o.toLowerCase()]=function(){var e=[].slice.call(arguments);if(i>=t.severity&&e.length>0&&"NONE"!=t.name){const t=e[0],n=e.splice(1),i=`[VSLY-${o}] ${t}`;"DEBUG"===o||"INFO"===o?console.log(i,...n):"WARN"===o?console.warn(i,...n):console.error(i,...n)}}}),e}(),E)}function x(){try{return!!f(()=>f(()=>new URL(window.location.href).searchParams.get(i))||sessionStorage.getItem(i))}catch(t){return S().error("failed getting lmi_preview for preview"),!1}}const I="lmi_type",k="lmi_from",N="lmi_class",A=t=>{const e=t.split(".")[1];return e?e.length>=7?t:t.slice(0,-1)+"0".repeat(7-e.length)+"Z":t};function P(t,e){return t.includes(e,t.length-e.length)}function T(t,e,n,o){void 0===n&&(n=2e3),void 0===o&&(o=5);let i=0,r=0,a=!1;return function(){const s=Date.now();var c,l,u;s-i=o&&!a&&(a=!0,void 0===c&&(c="counter"),void 0===l&&(l="sdk"),void 0===u&&(u="inc"),fetch(`https://logs.loomi-prod.xyz/af3a0f80-908b-4602-9c31-535a453d2b3a/collect/${c}/${l}/${e}/${u}`,{method:"POST",body:JSON.stringify({alias:window.loomi_ctx.storeAlias}),headers:{"Content-Type":"application/json; charset=UTF-8"}}))):r=0,i=s,!a&&t()(...[].slice.call(arguments))}}const C="lmi_utm_data",O={utm_source:"source",utm_medium:"medium",utm_campaign:"campaign",utm_term:"term",utm_content:"content"},b=function(t,e){void 0===e&&(e=3);let n=t;for(let t=0;tnew URLSearchParams(t)).forEach((t,n)=>{if(t){const o=O[n],i=b(t);o?e.utm[o]=i:function(t){return f(()=>[N,k,I].includes(t))}(n)&&(e.lmi_params[n]=i)}}),e};function D(){const t=f(()=>function(){const t=function(t){let e=[];const n=localStorage.getItem(C);return null!=n&&(e=[...JSON.parse(n)].slice(0,20)),t&&(t.ts=l(),e=[t,...e]),e}(function(t){if(function(t){return!t||"{}"===JSON.stringify(t)}(t))return null;const e={};return t.campaign&&(e.campaign=t.campaign),t.medium&&(e.medium=t.medium),t.source&&(e.source=t.source),t.term&&(e.term=t.term),t.content&&(e.content=t.content),e}(f(()=>L().utm)));return localStorage.setItem(C,JSON.stringify(t)),t}(),[]);if(!Array.isArray(t)||0===t.length)return"";const e=t.filter(t=>t.campaign);return 0===e.length?"":f(()=>e.reduce((t,e)=>e.ts>t.ts?e:t,e[0]).campaign,"")||""}const j="vslyCT",$="vslySUBS",R="vslySID",V="vslyUID",U="loomi-cart-history",M="vsly-cart-throttle",B="vsly_session";function G(t){return b((t||"").replace("+"," "))}function J(){const t={id:function(t,e){void 0===e&&(e=8397271938200529);let n=3735928559^e,o=1103547991^e;for(let e,i=0;i>>16,2246822507)^Math.imul(o^o>>>13,3266489909),o=Math.imul(o^o>>>16,2246822507)^Math.imul(n^n>>>13,3266489909),`${4294967296*(2097151&o)+(n>>>0)}`}(window.loomi_ctx.storeAlias+window.loomi_ctx.userId+l()+D()+K()),utm_campaign:D(),last_interaction:new Date,landing_page:f(()=>location.href,""),start_at:new Date};return q(t),t}function q(t){const e=JSON.stringify(t);localStorage.setItem(B,e),window.loomi_ctx.session=t}function H(){window.loomi_ctx=window.loomi_ctx||{};let t=window.loomi_ctx.session||f(()=>{const t=JSON.parse(localStorage.getItem(B));return t.last_interaction=new Date(t.last_interaction),t.start_at=new Date(t.start_at),t})||J();return function(t){const e=new Date,n=t.last_interaction;return(e.valueOf()-n.valueOf())/6e4>30||G(D())!==G(t.utm_campaign)||t.last_interaction.getDate()!==e.getDate()}(t)&&(t=J()),window.loomi_ctx.session=t,t}function F(){const t=H();t.last_interaction=new Date,q(t)}const K=()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15);function W(t,e){if(!t&&!e)return!0;if(!t&&e)return!1;if(t&&!e)return!1;const n=Object.keys(t).sort((t,e)=>t.localeCompare(e)),o=Object.keys(e).sort((t,e)=>t.localeCompare(e));if(n.length!==o.length)return!1;for(const o of n){const n=t[o],i=e[o],r=Y(n)&&Y(i);if(r&&!W(n,i)||!r&&n!==i)return!1}return!0}function Y(t){return null!=t&&"object"==typeof t}function z(t){return f(()=>window.visually.flags[t],!1)}var X;function Q(t){z("kill-ga")||t.isAudience||!t.reportGa||(z("ga-use-store-data-layer")?function(t){try{const e=g(t.gaName),n=g(t.gaVariant),o=`DL-${e}-${n}`;return Z.has(o)||(Z.set(o,!0),d(()=>!!window.dataLayer,100,10).then(()=>{window.dataLayer.push({event:"VISUALLY",EXPERIENCE:e,VARIANT:n,non_interaction:!0})})),Promise.resolve()}catch(t){return Promise.reject(t)}}(t).catch():function(t){try{return p(),v(function(){const t=document.getElementsByTagName("script"),e=[];for(let n=0;n{const n=g(t.gaName),o=g(t.gaVariant),i=`${e}${n}${o}`;if(Z.get(i))return;let r=f(()=>window.gtag);!r&&window.dataLayer&&(r=function(){window.dataLayer.push(arguments)}),Z.set(i,!0),et().then(tt(r,n,o,e))}],f(()=>"ANDIE_SWIM_1"===window.loomi_ctx.storeAlias)&&window.loomi_ctx.tagIds.add("G-D5DRR8JQ64"),window.loomi_ctx.tagIds.forEach(t=>{window.loomi_ctx.gtags.forEach(e=>e(t))}),Promise.resolve()}catch(t){return Promise.reject(t)}}(t).catch())}!function(t){t.SIGNUP="SIGNUP",t.ADD_TO_CART="ADD_TO_CART",t.CHANGE_QTY="CHANGE_QTY",t.REMOVE_FROM_CART="REMOVE_FROM_CART",t.PAGE_LOAD="PAGE_LOAD",t.CLICK="CLICK",t.LOGIN="LOGIN",t.LOGOUT="LOGOUT",t.TIME_SPENT="TIME_SPENT",t.USE_CASE="USE_CASE",t.LEAD_SUBMISSION_EMAIL="LEAD_SUBMISSION_EMAIL",t.LEAD_SUBMISSION_PHONE="LEAD_SUBMISSION_PHONE"}(X||(X={}));const Z=new Map,tt=(t,e,n,o)=>()=>{f(()=>{t("event","VISUALLY",{EXPERIENCE:e,VARIANT:n,non_interaction:!0,send_to:o})})},et=()=>new Promise(t=>{z("ga4_page_load")?d(()=>{try{return window.dataLayer.find(t=>"event"===t[0]&&"page_view"===t[1]||"gtm.load"===t.event)}catch(t){return!1}},500,1e3).then(()=>t(2)):t(1)}),nt=()=>edgetag("getUserId");function ot(){const t="vsly_edgetag";return h(()=>(nt()&&localStorage.setItem(t,nt()),!0)),f(nt)||localStorage.getItem(t)}function it(t){let e=t.trim();return/^[a-zA-Z0-9_\- .:|/]+$/.test(e)||(e=e.replace(/[^a-zA-Z0-9_\- .:|/]/g,"")),e.slice(0,250)}const rt=[{name:"amplitude",track(t,e){d(()=>!!f(()=>window.amplitude.track),100,100).then(()=>{window.amplitude.track("Visually",{vslyExpId:t.use_case,vslyExpVarId:t.use_case_variant,vslyExpName:e.gaName,vslyExpVarName:e.gaVariant,vslyVersion:t.version})})}},{name:"clarity",track(t,e){d(()=>!!window.clarity,100,100).then(()=>{window.clarity("event",`Visually_${e.gaName}_${e.gaVariant}_${t.version}`)})}},{name:"contentsquare",track(t,e){window._uxa=window._uxa||[],window._uxa.push(["trackDynamicVariable",{key:`AB_VI_${it(e.gaName)}`,value:it(e.gaVariant)+`(${t.version})`}])}},{name:"fullstory",track(t,e){d(()=>!!window.FS,100,100).then(()=>{window.FS("trackEvent",{name:"Visually",properties:{vslyExpId:t.use_case,vslyExpVarId:t.use_case_variant,vslyExpName:e.gaName,vslyExpVarName:e.gaVariant,vslyVersion:t.version}})})}},{name:"heatmap",track(t,e){f(()=>{window.dataLayer=window.dataLayer||[],window.dataLayer.push({_heatmap_split_test:{platform:"visually",experimentId:t.use_case,experimentName:e.gaName,variantId:t.use_case_variant,variantName:e.gaVariant}})})}},{name:"hotjar",track(t,e){d(()=>!!window.hj,100,100).then(()=>{window.hj("event",it(`vsly_${e.gaName}_${e.gaVariant}_${t.version}`))})}},{name:"segment",track(t,e){d(()=>!!f(()=>window.analytics.track),100,100).then(()=>{window.analytics.track("Visually",{vslyExpId:t.use_case,vslyExpVarId:t.use_case_variant,vslyExpName:e.gaName,vslyExpVarName:e.gaVariant,vslyVersion:t.version})})}},{name:"shopify",track(t,e){d(()=>!!f(()=>window.Shopify.analytics.publish),100,100).then(()=>{window.Shopify.analytics.publish("Visually-Experience",{vslyExpId:t.use_case,vslyExpVarId:t.use_case_variant,vslyExpName:e.gaName,vslyExpVarName:e.gaVariant,vslyVersion:t.version})})}},{name:"triplewhale",track(t,e){d(()=>!!f(()=>window.TriplePixel),100,100).then(()=>{window.TriplePixel("custom","vslyExperience",{vslyExpId:t.use_case,vslyExpVarId:t.use_case_variant,vslyExpName:e.gaName,vslyExpVarName:e.gaVariant,vslyVersion:t.version})})}},{name:"rudderstack",track(t,e){d(()=>!!f(()=>window.rudderanalytics.track),100,100).then(()=>{window.rudderanalytics.track("Visually",{vslyExpId:t.use_case,vslyExpVarId:t.use_case_variant,vslyExpName:e.gaName,vslyExpVarName:e.gaVariant,vslyVersion:t.version})})}}];let at;function st(t,e){try{if(z("kill-int-track")||e.isAudience)return;at||(at=rt.filter(t=>!!f(()=>window.visually.enabledIntegrations.find(e=>e===t.name)))),at.forEach(n=>{n.track(t,e)})}catch(t){}}let ct,lt=[];const ut=function(t,e){if(void 0===e&&(e=0),0===lt.length)return;const n=lt;lt=[];const o=ht(n),i=ft(n);t({bulk:i,shared:o},!0).catch(()=>{const o=n.concat(lt);o.length<100&&(lt=o,e<2&&setTimeout(()=>ut(t,e+1),500*Math.pow(2,e)))})},dt=s(ut,100);let mt=!1;function wt(){mt||(mt=!0,function(t,e){void 0===t&&(t=()=>window),void 0===e&&(e=!1);try{function n(){return Promise.resolve()}const o=e&&a()?Promise.resolve(d(()=>r,1e3,10)).then(function(){}):Promise.resolve(d(()=>void 0!==f(()=>t().addEventListener),10,1e3)).then(function(){});return Promise.resolve(o&&o.then?o.then(n):n())}catch(i){return Promise.reject(i)}}().then(()=>{window.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState&&ct&<.length>0&&ut(ct)})}))}const ft=t=>t.map(t=>{const e=JSON.parse(JSON.stringify(t));return delete e.user,delete e.event_id,delete e.user_agent,delete e.utc_time,delete e.local_tz_offset,delete e.doc_host,delete e.ids_ga,delete e.alias,delete e.userCanBeTracked,delete e.userDataCanBeSold,delete e.edgetag,delete e.api_key,delete e.src,e}),ht=t=>{const e=f(()=>String(t[0].user.anonymous_id),""),n=f(()=>String(t[0].user_agent),""),o=f(()=>String(t[0].event_id),""),i=f(()=>String(t[0].utc_time),""),r=f(()=>Number(t[0].local_tz_offset)||0),a=f(()=>String(t[0].doc_host),""),s=f(()=>String(t[0].ids_ga),""),c=f(()=>String(t[0].alias),""),l=f(()=>Boolean(t[0].userCanBeTracked),!0),u=f(()=>Boolean(t[0].userDataCanBeSold),!0),d=f(()=>String(t[0].edgetag),""),m=f(()=>String(t[0].api_key),""),w=f(()=>String(t[0].src),"");return Object.entries({anonymous_id:e,event_id:o,user_agent:n,utc_time:i,local_tz_offset:r,doc_host:a,ids_ga:s,alias:c,userCanBeTracked:l,userDataCanBeSold:u,edgetag:d,api_key:m,src:w}).reduce((t,e)=>{let[n,o]=e;if(o){if("undefined"===o)return t;t[n]=o}return t},{})},pt=new Set(["WIDGET_INTERACTION","WIDGET_ADD_TO_CART","OPEN_ATC_OVERLAY"]);class vt{constructor(){this.trackingHost="",this.apiKey="",this.runningUseCases=new Set,this.getAnalyticsCtx=()=>({})}makeEvent(t,e,n){let o=this.getCtx();const i=ot();i&&(o.edgetag=i);const r={api_key:this.apiKey,src:e,event_type:t,...n};return pt.has(t)&&!function(t){return!(!t||"object"!=typeof t||!(t.PRODUCT_ID||t.product_id||t.productId||t.product_Id||t.product?.id||t.product))}(n)&&(delete o.product,delete o.product_id),o=function(t,e){try{Object.keys(t).forEach(t=>{if(f(()=>t.includes("_"))&&t.toUpperCase()===t){const n=f(()=>t.split("_").map(t=>t.toLowerCase()),[""]);switch(n.length){case 1:f(()=>e[n[0]])&&delete e[n[0]];break;case 2:f(()=>e[n[0]][n[1]])&&delete e[n[0]][n[1]];break;case 3:f(()=>e[n[0]][n[1]][n[2]])&&delete e[n[0]][n[1]][n[2]];break;case 4:f(()=>e[n[0]][n[1]][n[2]][n[3]])&&delete e[n[0]][n[1]][n[2]][n[3]]}}})}catch(n){S().error(`vsly 666:${w(e)}:${w(t)}`)}return e}(n,o),{...o,...r}}sendJson(t,e){void 0===e&&(e=!1);let n=`${this.trackingHost}/api/s?token=${this.apiKey}`;e&&(n+="&bulk=1");try{const e=JSON.stringify(t),o=()=>fetch(n,{method:"POST",body:e,headers:{"Content-Type":"text/plain"}});if(e.length>65536)return o();if(!navigator.sendBeacon(n,new Blob([e],{type:"text/plain"})))return o()}catch(t){return Promise.reject(t)}return Promise.resolve()}getCtx(){const t=f(()=>window.loomi_ctx.audiences),e=new Date;return{event_id:"",user:{anonymous_id:window.loomi_ctx.userId},user_agent:navigator.userAgent,utc_time:A(e.toISOString()),local_tz_offset:e.getTimezoneOffset(),url:window.location.href,doc_path:document.location.pathname,doc_host:document.location.hostname,doc_search:window.location.search,ids_ga:f(()=>document.cookie.split(";").map(t=>t.split("=")).find(t=>{let[e,n]=t;return"_ga"==e.trim()})[1],""),alias:window.loomi_ctx.storeAlias,...t?{audiences:t.join("|")}:{},sid:f(()=>window.loomi_ctx.session.id),sid_start:f(()=>window.loomi_ctx.session.start_at.toISOString()),...f(()=>this.getAnalyticsCtx(),{}),...L()}}trackExt(t,e){try{return Q(e),st(t,e),Promise.resolve()}catch(t){return Promise.reject(t)}}track(t,e,n){try{const o=this;return Promise.resolve(d(()=>!!f(()=>!!window.loomi_ctx.storeAlias&&window.loomi_ctx.session.id),200)).then(function(){let i;return Promise.resolve(o.skipTracking()).then(function(r){if(r){const t=Promise.resolve();return i=1,t}t===X.USE_CASE&&(Q(n),st(e,n));const a=()=>o.sendJson(o.makeEvent(t,"jitsu",e||{}));return f(F),n&&n.isRedirect?(e.clickId="redirect",a()):n&&n.immediate?a():void function(t,e){try{return ct=e,t&<.push(t),dt(e),Promise.resolve()}catch(t){return Promise.reject(t)}}(o.makeEvent(t,"jitsu",e||{}),o.sendJson.bind(o))})})}catch(t){return Promise.reject(t)}}skipTracking(){try{let t;const e=this;function n(n){if(t)return n;const i=f(()=>window.location.hostname,"");if("FOO"!==o&&("test"===e.apiKey||x()||"localhost"===i||"127.0.0.1"===i||i.endsWith("netlify.app")||""!=location.port))return!0;if("UNDEROUTFIT"===o){const t=f(()=>window.location.pathname.endsWith("the-comfort-shaping-bra-rp")),e=f(()=>"rp"===new URL(window.location.href).searchParams.get("utm_source"));return t||e}return!1}const o=window.loomi_ctx.storeAlias,i=function(){if(z("do-not-track")||z("block-do-not-track"))return Promise.resolve(d(()=>!!f(y))).then(function(){const e=!y()();return t=1,e})}();return Promise.resolve(i&&i.then?i.then(n):n(i))}catch(r){return Promise.reject(r)}}init(t){wt(),this.getAnalyticsCtx=t.analyticsContext,t.key&&(this.apiKey=t.key,this.trackingHost=(t=>{for(;P(t,"/");)t=t.substr(0,t.length-1);return 0===t.indexOf("https://")||0===t.indexOf("http://")?t:"//"+t})(t.tracking_host||""))}register(t,e,n,o){this.runningUseCases.add({name:t,variant:e,gaName:o,gaVariant:n})}getRunningUseCases(){return JSON.stringify(Array.from(this.runningUseCases))}setAnalyticsContext(t){this.getAnalyticsCtx=t}}function gt(t){const e={trackingHost:"https://live.visually-io.com"};return t===o.TEST&&(e.trackingHost="http://localhost:8088"),t===o.STAGE&&(e.trackingHost="https://sdk.loomi-stg.xyz"),e}var yt;!function(t){t.CART_CHANGE="CART_CHANGE",t.LOYALTY_CHANGE="LOYALTY_CHANGE"}(yt||(yt={}));const _t=s((t,e)=>{const n=function(t,e){const n=new Event("targeting-changed");return n.key=t,n.value=e,n}(t,e);document.dispatchEvent(n),console.debug("Targeting has changed:",n)},80);function Et(t,e){_t(t,e)}function St(){(window.location.search.includes("lmi_debug")||f(()=>window.vsly_fbs))&&console.error("loomi-editor",...[].slice.call(arguments))}const xt=()=>window.loomi_ctx.session.id,It=()=>f(()=>window.loomi.conf.experiments.filter(t=>f(()=>t.elementTracking.length>0)).flatMap(t=>t.elementTracking.map(e=>({...e,steps:e.steps||[],useCase:t.name,variant:t.variant,version:t.version,clientTargetingFormula:t.clientTargetingFormula}))))||[],kt=t=>({event:t,selectors:t.steps.flatMap(t=>t.selectors)}),Nt=t=>`${t.ordinal}-${t.version}-${t.useCase}-${t.variant}`,At=()=>{const t=xt();t&&f(()=>localStorage.setItem("vsly-last-atc-sid",t))};function Pt(){const t=Number(localStorage?.getItem(M)??0);return Date.now()-t<36e5}const Tt=t=>{429==t&&localStorage?.setItem(M,`${Date.now()}`)};function Ct(t,e){try{var n=t()}catch(t){return e(t)}return n&&n.then?n.then(void 0,e):n}function Ot(){return d(()=>f(()=>!!window.loomi.jitsu),100,100)}function bt(){if(f(()=>void 0===window.loomi_ctx.cart)){const t=localStorage.getItem($t);if(t)try{window.loomi_ctx={...window.loomi_ctx||{},cart:JSON.parse(t)}}catch(e){S().error("failed parsing cart",t)}}return f(()=>window.loomi_ctx.cart)}const Lt=(t,e,n,o,i,r)=>{if(Gt(t)){const t=f(()=>e.toUpperCase());"POST"===t?zt(n)?(Ot().then(()=>window.loomi.jitsu.track(X.ADD_TO_CART,Ft(o))),Mt(i,n,!n.includes("update")),At()):function(t){return t.match(/^\/cart\/change.*/)||t.match(/^\/cart\/update.*/)&&!t.includes("vsly=t")||t.match(/cart\/(change|update)\.(js|json)$/)}(n)&&(function(t){const e=e=>Ot().then(()=>window.loomi.jitsu.track(e,t));if(f(()=>!t.qty)||f(()=>!t.variantId))return;const n=f(()=>bt().items.find(e=>e.id==t.variantId||e.variant_id==t.variantId).quantity);if(!n)return void e(X.CHANGE_QTY);const o=parseInt(t.qty);0!==o&&o!==n&&o>n&&(e(X.ADD_TO_CART),At())}(Ft(o)),Mt(i,n)):"GET"!==t&&t||function(t){return t.match(/^\/cart\.json.*|^\/cart\.js.*|^\/cart.*/)||t.match(/cart\.(js|json)$/)}(n)&&i&&Jt(i)&&Ut(i)}},Dt=s(()=>document.body.dispatchEvent(new CustomEvent("pdpresp")),500),jt=(t,e,n)=>{const o="/products/",i=["/collections/",o];Gt(t)&&(n||"").includes(o)&&f(()=>!!i.find(t=>window.location.pathname.includes(t)))&&!z("kill-pdp-intercept")&&Dt()},$t="loomi-cart",Rt=t=>{(function(t,e){const n=f(()=>{const t=e.attributes,n=f(()=>window.loomi_ctx.userId),o=f(()=>window.loomi_ctx.session.id,"");return!(!n||!o||t[j]&&t[V]===n&&t[R]===o)},!1);try{return void 0!==e&&(!W(t,e)||n)}catch(t){return!0}})(bt(),t)&&(!0===f(()=>window.visually.flags["sdk-enable-cart-enrichment"],!1)?function(t){try{function e(){return Promise.resolve(t)}if(f(()=>t.items.length<=0))return Promise.resolve(t);const n=Ct(function(){const e=f(()=>Array.from(t.items.map(t=>t.handle)),[]).map(t=>({name:t,oneOf:{productInfo:{handle:t,includeCollections:!0,includeTags:!0}}}));return Promise.resolve(window.loomi_api.allocatorQuery({queries:e})).then(function(e){t.items=t.items.map(t=>(t.tags=f(()=>e.results[t.handle].tags,[]),t.collections=f(()=>e.results[t.handle].collections,[]),t))})},function(e){St("failed to enrich cart with error",e,t)});return Promise.resolve(n&&n.then?n.then(e):e())}catch(o){return Promise.reject(o)}}(t).then(t=>{Bt(t),Et(yt.CART_CHANGE,f(()=>window.loomi_ctx.cart))}):(Bt(t),Et(yt.CART_CHANGE,f(()=>window.loomi_ctx.cart))))},Vt=s(Rt,400),Ut=t=>{!0===f(()=>window.visually.flags["sdk-enable-cart-change-debounce"],!1)?Vt(t):Rt(t)};function Mt(t,e,n){void 0===n&&(n=!0);const o=!z("disable-update-cart-refresh")||n;Jt(t)&&o&&Ut(t),f(()=>!e.includes("vsly=t"))&&Yt()}function Bt(t){(function(t){try{const n=function(t){return f(()=>t.items.map(t=>{let{variant_id:e,product_id:n,price:o,quantity:i}=t;return{price:o,variant_id:`${e}`,product_id:`${n}`,sid:f(xt),quantity:i,timestamp:Qt()}}),[])}(t);e=function(t){const e=bt();let n=JSON.parse(localStorage.getItem(U)||"[]");const o=f(()=>n.map(t=>`${t.variant_id}`));return f(()=>t.forEach(t=>{const i=o.indexOf(`${t.variant_id}`);i<0?n=[t,...n]:function(t,e){return f(()=>t.items.find(t=>`${t.variant_id}`==`${e.variant_id}`).quantityXt(e)-Xt(t)))})),n}(n),localStorage.setItem(U,JSON.stringify(e.slice(0,25)))}catch(t){S().error("handleCartItemsHistory",t)}var e})(t),localStorage.setItem($t,JSON.stringify(t)),window.loomi_ctx={...window.loomi_ctx||{},cart:t}}function Gt(t){const e=".myshopify.com";return window.location.hostname==f(()=>t.split(":")[0])||f(()=>t.endsWith(e))||t===f(()=>window.loomi_ctx.storeAlias.toLowerCase().replace("_","-")+e)}function Jt(t){return f(()=>void 0!==t.items)&&f(()=>void 0!==t.total_price)&&f(()=>void 0!==t.token)}function qt(t){return f(()=>decodeURIComponent(t).split("&").find(t=>"id"===t.split("=")[0]).split("=")[1].split(":")[0])||f(()=>Kt(t).id)||f(()=>t.get("id"))}function Ht(t){return isNaN(Number(t))}function Ft(t){const e={},n=function(t){return f(()=>decodeURIComponent(t).split("&").find(t=>"quantity"===t.split("=")[0]).split("=")[1])||f(()=>Kt(t).quantity.toString())}(t);let o=qt(t);return o&&!Ht(o)||(o="0"),Ht(n)||(e.qty=n),Ht(o)||(e.variantId=o),e}function Kt(t){try{return f(()=>JSON.parse(t).items[0])}catch(t){return}}const Wt=s(function(){try{if(Pt())return Promise.resolve();const t=Ct(function(){return Promise.resolve(fetch("/cart.json?vsly=t")).then(function(t){Tt(t?.status)})},function(){});return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(t){return Promise.reject(t)}},500);function Yt(){f(()=>"static"!==window.vslyIntegrationType)||z("no-cart-refresh")||Wt()}function zt(t){return t.match(/^\/cart\/add.*/)||t.match(/cart\/add\.(js|json)$/)}function Xt(t){return new Date(t.timestamp).valueOf()}function Qt(){return l().toISOString()}function Zt(){const t=window.ShopifyAnalytics;if(!t)return{};try{const e=function(t){return f(()=>t.meta.product)}(t),n=function(t,e){let n=f(()=>t.meta.selectedVariantId,"0");return ee(n)&&function(t,e){return f(()=>t.variants.find(t=>t.id==e))}(e,n)||(n=function(){try{return new URL("http://"+window.location.pathname+window.location.search).searchParams.get("variant")}catch(t){return S().info("vsly-e: 444"),""}}()),ee(n)||(n=f(()=>e.variants[0].id)),function(t){const e=Number(t),n=isNaN(e)?Number(`${t}`.replace(/[^\d.]+/g,""))||void 0:e;if(void 0!==n)return`${n}`}(n)}(t,e),o={cartId:te(t)};(function(t){return f(()=>!!t.meta.page.pageType)})(t)&&(o.page={pageType:ne(t)});const i=function(t){return t?.id?.toString()||window.loomi_ctx?.productId}(e);i&&(o.product={id:i}),n&&(o.variant={id:n}),o.themeId=f(()=>`${window.loomi_ctx.themeId||f(()=>window.Shopify.theme.id)}`);const r=function(){const t=window.loomi_ctx?.clientId;return t?(window.localStorage.setItem("vsly__st",String(t)),String(t)):window.localStorage.getItem("vsly__st")}();return Boolean(r)&&(o.clientId=r),o}catch(t){return S().error("vsly-e 555",t),{}}}function te(t){let e=f(()=>t.lib.config.initialDocumentCookie);if(!e)return f(()=>window.loomi_ctx.cart.token);e.endsWith(";")||(e+=";");const n=/cart=(.*?);/.exec(e);return f(()=>function(t){if("string"!=typeof t)return t;const e=t.indexOf('\\"');return-1===e?t:t.slice(0,e)}(n[1]))||f(()=>window.loomi_ctx.cart.token)}function ee(t){return("string"==typeof t||"number"==typeof t)&&""!==t&&0!==t}function ne(t){return f(()=>t.meta.page.pageType.toString())}let oe=!1;function ie(t){try{const e=new URL(t);if(ae(e.hostname)){if(!m(f(()=>window.loomi.conf&&window.loomi.conf.googleTags||[],[])))return;const t=e.searchParams.get("tid");t&&(p(),v([]),window.loomi_ctx.tagIds.add(t),window.loomi_ctx.gtags&&window.loomi_ctx.gtags.map(e=>e(t)))}}catch(t){}}function re(t,e,n,o,i,r){"POST"===e&&ae(t)&&(n.startsWith("/")&&(n=`https://${t}${n}`),ie(n))}function ae(t){return t.includes("analytics.google.com")||t.includes("google-analytics.com")}function se(t){try{const e=t&&"function"==typeof f(()=>t.indexOf)&&0==t.indexOf("/")?window.location.origin+t:t,n=e.match(/^https?\:\/\/([^\/?#]+)(?:[\/?#]|$)/i),o=n&&n[1]||"";return{domain:o,path:e.replace("https://","").replace(o,"").replace("http://","")}}catch(t){return{domain:"",path:""}}}function ce(t,e,n){try{if(Gt(t)&&zt(e)){const t=qt(n);t&&t!=f(()=>window.loomi_ctx.last_vid_atc.vid)&&(document.dispatchEvent(new Event("VSLY_PRE_ATC")),window.loomi_ctx.last_vid_atc={vid:""+t,ts:+new Date})}}catch(t){}}let le=[];const ue=()=>{const t=window.loomi_ctx.consent,e={...t?{fin:t.fin,init:t.init,allowed:t.allowed}:{},...{...window.loomi_ctx.performanceMetrics||{}}};return Pt()&&(e.throt="t"),Object.keys(e).length?{metadata:e}:{}},de="loomi_session_products";function me(t){localStorage.setItem(de,JSON.stringify(t)),window.loomi_ctx={...window.loomi_ctx||{},sessionProducts:t}}const we=HTMLFormElement.prototype.submit,fe=(new Date).getTime();let he=!1;const pe=()=>he?Promise.resolve():(console.log("vsly-loyalty","Tracking signup"),he=!0,u().then(()=>window.loomi.jitsu.track(X.SIGNUP,{PAGE_LOAD_ID:`i${fe}`})));function ve(t,e,n,o,i,r){"POST"===e&&(Gt(t)?function(t){return t.endsWith("/account")}(n)&&pe():function(t){const e=f(()=>new URL(t));return!!e&&e.pathname.endsWith("api/public/v1/point_redemptions")}(n)&&document.dispatchEvent(new CustomEvent("vsly:loyalty-changed")))}HTMLFormElement.prototype.submit=function(){try{const t=this.getAttribute("action"),e=this.getAttribute("method");"/account"===t&&"post"===e?pe().then(()=>{we.call(this)}):we.call(this)}catch(t){we.call(this)}};const ge=function(t,e,n,o){try{if(Pt())return Promise.resolve();const i=function(i,r){try{var a=function(){const i=new URLSearchParams;i.append(`attributes[${j}]`,t),i.append(`attributes[${$}]`,`${e}`),n&&i.append(`attributes[${V}]`,`${n}`),o&&i.append(`attributes[${R}]`,`${o}`);const r=i.toString();return Promise.resolve(fetch("/cart/update.js?vsly=t",{credentials:"include",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},body:r,method:"POST",mode:"cors"})).then(function(t){Tt(t?.status)})}()}catch(t){return r(t)}return a&&a.then?a.then(void 0,r):a}(0,function(t){St("vsly cart attr update err",t)});return Promise.resolve(i&&i.then?i.then(function(){}):void 0)}catch(t){return Promise.reject(t)}},ye=T(()=>window.visually.updateCartAttributes,"cart_attr_loop");function _e(t){if(f(()=>window.visually.flags["kill-cart-attr"])||!t)return;if(f(()=>t.token.length,0)<=5)return;const{sid:e,uid:n,vslyCartToken:o,cartSubscriptions:i}=function(t){const e=f(()=>window.loomi_ctx.session.id),n=f(()=>window.loomi_ctx.userId),o=`${j}_${t.token}`,i=function(t){return f(()=>t.items.map(t=>f(()=>t.selling_plan_allocation.selling_plan.name.toLowerCase())).filter(t=>!!t),[])}(t).length;return{sid:e,uid:n,vslyCartToken:o,cartSubscriptions:i}}(t),r=f(()=>t.attributes[j]||"",""),a=f(()=>t.attributes[$]||0,0),s=f(()=>t.attributes[R]||"",""),c=n!==f(()=>t.attributes[V]||"","")&&!!n,l=e!==s&&!!e;(`${i}`!=`${a}`||r!=o&&o||c||l)&&(t.attributes=t.attributes||{},t.attributes[j]=o,t.attributes[$]=`${i}`,c&&(t.attributes[V]=`${n}`),l&&(t.attributes[R]=`${e}`),Bt(t),Ee(o,i,n,e))}s((t,e)=>{ye(t,e)},1e3);const Ee=s(T(()=>ge,"cart_attr_loop"),1e3),Se=s(T(()=>Ie,"click_loop"),500),xe=T(()=>ke,"custom_loop",5e3,10),Ie=(t,e)=>{if(![t._USE_CASE,t._USE_CASE_VARIANT,e].every(Ne)||!Number.isInteger(t._USE_CASE_VERSION))throw new Error("invalid args");window.loomi.jitsu.track(X.CLICK,{use_case:t._USE_CASE,use_case_variant:t._USE_CASE_VARIANT,version:t._USE_CASE_VERSION,clickId:e})},ke=t=>{if(!Number.isInteger(t)||t<1||t>3)throw new Error("invalid event");window.loomi.jitsu.track("CUSTOM_EVENT",{clickid:`custom_${t}`})},Ne=t=>"string"==typeof t&&t.length<40,Ae="VSLY_STEPS_COMPLETED";let Pe;const Te=()=>(Pe||=f(()=>JSON.parse(sessionStorage.getItem(Ae)))||[],Pe=Oe(Pe),Pe),Ce=t=>{sessionStorage.setItem(Ae,JSON.stringify(t))},Oe=t=>t.filter(t=>new Date(t.ts)>new Date((new Date).getTime()-72e5)||t.sid===xt()).slice(0,700),be="[vsly-custom-events]",Le=new Set,De=t=>{try{const e=Nt(t);if(Le.has(e))return t;Le.add(e);const n=t.steps.flatMap(t=>t.selectors)||[];console.log(`${be} Event Registered:`,{experience:t.useCase,variant:t.variant,selectors:n,version:t.version,ordinal:t.ordinal})}catch(t){console.error(`${be} Error logging registered event:`,t)}return t},je=new Map,$e=t=>{if(Re(t))return;if(z("kill-custom-events"))return;const e=Nt(t),n=je.get(e),o=(new Date).valueOf();if(n&&o-n<1e3)return;je.set(e,o),je.forEach((t,e)=>{o-t>1e3&&je.delete(e)});const i=Be();i[e]=t,Ge(i),(t=>{try{console.log(`${be} Event Fired:`,{experience:t.useCase,variant:t.variant,version:t.version,ordinal:t.ordinal})}catch(t){console.error(`${be} Error logging fired event:`,t)}})(t),window.loomi.jitsu.track("CUSTOM_EXP_EVENT",{clickid:`event_${t.ordinal}`,use_case:t.useCase,use_case_variant:t.variant,version:t.version}).then(()=>{console.debug("vsly custom event: ",e),setTimeout(()=>{const t=Be();delete t[e],Ge(t)},1e3)})},Re=t=>!Number.isInteger(t.ordinal)||!Number.isInteger(t.version)||!t.useCase||!t.variant||t.ordinal>12||t.ordinal<0,Ve=()=>{const t=Be();Object.values(t).map($e),It().filter(t=>t.code).forEach(Ue)},Ue=t=>{window.loomi||={};const e=window.loomi.exp_events||=new Set,n=Nt(t);e.has(n)||(f(()=>new Function(t.code)()),e.add(n))},Me="VSLY_REPORT_EVENTS",Be=()=>JSON.parse(sessionStorage.getItem(Me)||"{}"),Ge=t=>{sessionStorage.setItem(Me,JSON.stringify(t))},Je=(t,e)=>{t.isTrusted&&qe(t).forEach(t=>It().map(De).map(kt).forEach(n=>{let{event:o,selectors:i}=n;i.filter(e=>t.matches(e)).forEach(t=>{const n=Nt(o);(function(t){try{return Promise.resolve(d(()=>"function"==typeof window.loomi_ctx.shouldApply,100,100)).then(function(){return window.loomi_ctx.shouldApply(t)})}catch(t){return Promise.reject(t)}})(o.clientTargetingFormula).then(i=>{i&&(function(t,e,n){const o=xt(),i=Te(),r=i.findIndex(o=>o.selector===t&&e===o.action&&o.eventId===n);r>=0?(i[r].ts=new Date,i[r].sid=o):i.push({selector:t,action:e,sid:o,ts:new Date,eventId:n}),Ce(i)}(t,e,n),(t=>{const e=Te(),n=Nt(t),o=t.steps.map(t=>{let o=f(()=>e.find(e=>t.selectors.includes(e.selector)&&e.action===(t=>"action"===t.action?"click":t.action)(t)&&e.eventId===n).ts);return o&&(o=new Date(o)),o}).filter(t=>t)||[];return o.length===t.steps.length&&o.every((t,e)=>!e||t>o[e-1])})(o)&&($e(o),(t=>{const e=Te().filter(e=>e.eventId!==t);Pe=e,Ce(e)})(n)))})})}))},qe=function(t,e){if(void 0===e&&(e=f(()=>Array.from(new Set(It().filter(t=>!!t.steps).flatMap(t=>t.steps.flatMap(t=>t.selectors)))))||[]),0===e.length)return[];const n=t.composedPath()||[],o=[],i=e.join(",");for(const t of n)t instanceof Element&&t.matches(i)&&o.push(t);return o},He=Symbol("vslyClickAttached"),Fe=Symbol("vslyMouseOverAttached"),Ke=function(t){Je(t,"click")},We=function(t){Je(t,"hover")},Ye=new Set(["stepSubmit","submit"]);let ze,Xe=!1;function Qe(t){return"string"==typeof t&&t.trim().length>0}function Ze(t){ze??=u().catch(()=>{}),ze.then(e=>{if(e)return e.track(t)}).catch(t=>{console.error("vsly-klaviyo-leads","Error tracking lead submission",t)})}function tn(t){const e=t.detail;if(!e||!Ye.has(String(e.type)))return;const n="object"!=typeof(o=e.metaData)||null===o||Array.isArray(o)?{}:e.metaData;var o;(function(t){return Qe(t.$email)||Qe(t.email)})(n)&&Ze(X.LEAD_SUBMISSION_EMAIL),function(t){return Qe(t.$phone_number)||Qe(t.phone_number)}(n)&&Ze(X.LEAD_SUBMISSION_PHONE)}const en=()=>{(function(){try{const t=arguments;return z("kill-proxy")||(function(){if(z("kill-beacon-intercept"))return;if(oe)return;const t=navigator.sendBeacon;navigator.sendBeacon=function(e,n){return ie(e),t.call(this,e,n)},oe=!0}(),[].slice.call(t).forEach(t=>{(function(t){try{return Promise.resolve(d(()=>!!window.XMLHttpRequest)).then(function(){if(window.XMLHttpRequest){const e=window.XMLHttpRequest.prototype.send;window.XMLHttpRequest.prototype.send=function(){return this.reqBody=arguments[0],ce(this.reqDomain,this.reqPath,this.reqBody),e.apply(this,arguments)};const n=XMLHttpRequest.prototype.open;window.XMLHttpRequest.prototype.open=function(){const{domain:e,path:o}=se(arguments[1]);this.reqDomain=e,this.reqPath=o,n.apply(this,arguments);try{const n=f(()=>arguments[0]),i=f(()=>arguments[1]);this.requestDetails={method:n,url:i,domain:e,path:o},f(()=>this.addEventListener("load",function(){const{method:e,domain:n,path:o}=this.requestDetails,i=f(()=>JSON.parse(this.responseText),{});t(n,e||"GET",o,this.reqBody,i,"xhr")}))}catch(t){}}}})}catch(t){return Promise.reject(t)}})(t).catch(),function(t){try{return Promise.resolve(d(()=>!!window.fetch)).then(function(){if(window.fetch){const e=window.fetch;window.fetch=function(){const n=arguments[0],o=f(()=>arguments[1])||{},{domain:i,path:r}=se(n),a=f(()=>o.body),s=f(()=>JSON.parse(a),a);return ce(i,r,s),e.call(this,n,o).then(function(e){try{if("string"!=typeof n)return e;e.clone().text().then(function(e){const n=f(()=>JSON.parse(e),e);t(i,f(()=>o.method,"GET"),r,s,n,"fetch")}).catch()}catch(t){}return e})}}})}catch(t){return Promise.reject(t)}}(t).catch()})),Promise.resolve()}catch(t){return Promise.reject(t)}})(Lt,ve,jt,re).then()};function nn(){if("undefined"!=typeof window&&!window.vsly_analytics_init){const{apiKey:t,env:e,storeAlias:n,shouldStart:i}=function(){const t={apiKey:"",storeAlias:"",env:0,shouldStart:!1};try{if(window.location.search.includes("lmi_no_init=1"))return t;if(f(()=>window.loomi_ctx.jitsuKey)){const{jitsuKey:t,storeAlias:e,env:n}=window.loomi_ctx;return{apiKey:t,env:n,storeAlias:e,shouldStart:!!t&&!!n&&!!e}}const e=function(){const t=document.getElementsByTagName("script");let e;for(let n=0;nt[n]);if(["sdk.loomi-prod.xyz/","live.visually-io.com/","sdk.loomi-stg.xyz/","assets.visually.io/"].some(t=>f(()=>o.src.includes(`https://${t}`)))&&o.src.includes("k=")){e=o;break}}return new URL(e.src)}(),n=e.searchParams.get("k"),o=e.searchParams.get("s"),i=parseInt(e.searchParams.get("e")||"");return{apiKey:n,env:i,storeAlias:o,shouldStart:!!n&&!!i&&!!o}}catch(e){return t}}();i&&(window.vsly_analytics_init=!0,function(t,e,n){try{return void 0===n&&(n=o.PROD),Promise.resolve(function(i,r){try{var a=(function(){try{fetch("https://cdn.shopify.com/s/javascripts/currencies.js").then(t=>t.text()).then(t=>new Function(`${t};return Currency`)()).then(t=>{window.loomi_ctx={...f(()=>window.loomi_ctx)||{},Currency:t}}).catch(t=>console.error("fail currencies js",t))}catch(t){}}(),function(t,e,n){p(),window.loomi_ctx.env=window.loomi_ctx.env||t,window.loomi_ctx.storeAlias=window.loomi_ctx.storeAlias||e,n&&(window.loomi_ctx.jitsuKey=window.loomi_ctx.jitsuKey||n)}(n,e,t),en(),Promise.resolve(function(){try{return Promise.resolve(d(()=>!!f(()=>!!window.loomi_ctx.userId&&!!window.visually.flags&&!document.prerendering),500,101)).then(function(){})}catch(t){return Promise.reject(t)}}()).then(function(){function e(){const e=Zt(),i=function(t,e){return function(t,e){return function(t){const e=new vt;return e.init(t),wt(),e}({key:t,tracking_host:gt(e).trackingHost,analyticsContext:()=>({...Zt(),userCanBeTracked:f(()=>window.Shopify.customerPrivacy.analyticsProcessingAllowed(),!1),userDataCanBeSold:f(()=>window.Shopify.customerPrivacy.userCanBeTracked(),!1)})})}(t,e)}(t,n);return function(t){f(H),window.loomi={...window.loomi||{},jitsu:t,reportAnalyticsErr:()=>{},reportSdkErr:()=>{}}}(i),x()&&function(){f(function(){try{return Promise.resolve(d(()=>!!document&&!!document.head,10,2e3)).then(function(){const t=document.head||document.getElementsByTagName("head")[0];if(!t.querySelector(`#${c}`)){const e=document.createElement("style");e.id=c,e.appendChild(document.createTextNode("#preview-bar-iframe,#PBarNextFrameWrapper,#PBarNextFrame { display: none !important;}")),t.appendChild(e)}})}catch(t){return Promise.reject(t)}});const t=document.createElement("script");t.type="text/javascript";const e=(void 0===n&&(n=window.loomi_ctx.env),n===o.STAGE?"sdk.loomi-stg.xyz":"live.visually-io.com");var n;t.src=`https://${e}/preview-widget.js`;const i=document.getElementsByTagName("script")[0];f(()=>i.parentNode.insertBefore(t,i))}(),function(t){le.forEach(clearTimeout),le=[],[{s:11,e:30},{s:31,e:60},{s:61,e:180},{s:181,e:600},{s:601,e:1800},{s:1800,e:1e4}].forEach(e=>{le.push(setTimeout(()=>t.track(X.TIME_SPENT,{...e,...ue()}),1e3*e.s))})}(i),function(t){const e=f(()=>t.product),n=f(()=>t.variant);if(!n&&!e)return;const o=localStorage.getItem(de),i=function(t,e){return{productId:parseInt(f(()=>t.id)||"0"),variantId:parseInt(f(()=>e.id)||"0"),ts:l(),handle:f(()=>window.location.pathname.split("products/")[1])||""}}(e,n);if(o){let t=JSON.parse(o);t=t.filter(t=>{return!((e=t).variantId==(n=i).variantId&&e.productId==n.productId);var e,n}),t.push(i),t.length>20&&t.shift(),me(t)}else me([i])}(e),location.pathname.includes("/account/")&&d(()=>!!document.querySelector('form[action="/account"][method="post"]'),1e3,10).then(()=>{const t=document.querySelector('form[action="/account"][method="post"]');console.debug("vsly-loyalty","Capturing account form submit",t),t&&t.addEventListener("submit",function(e){try{function n(){t.submit()}const o=function(t,n){try{var o=(e.preventDefault(),Promise.resolve(pe()).then(function(){}))}catch(t){return n(t)}return o&&o.then?o.then(void 0,n):o}(0,function(t){console.error("vsly-loyalty","Error tracking signup",t)});return Promise.resolve(o&&o.then?o.then(n):n())}catch(i){return Promise.reject(i)}})}).catch(()=>{}),Xe||(Xe=!0,window.addEventListener("klaviyoForms",tn)),Promise.resolve(i.track(X.PAGE_LOAD)).then(function(){var t;(function(t,e){try{const n=(t=>f(()=>{return e=f(()=>new URLSearchParams(t||window.location.search)).get("vsly-redirected-event"),JSON.parse(decodeURIComponent(escape(atob(e))));var e}))(e);if((t=>{if(!t)return!1;const e=f(()=>t.ts);return!e||(new Date).valueOf()-e<36e5})(n)){f(()=>delete n.payload.now);const e=f(()=>window.loomi_ctx.session.id);e&&(n.payload.sid=e),n.options.immediate=!0,t.track(n.type,n.payload,n.options)}}catch(t){console.error("vsly-sdk-redirection","Failed to track red event",t)}})(i,location.search),Yt(),window.loomi_ctx.maintainCartAttributes=_e,t=()=>_e(bt()),d(()=>!!bt(),500,10).then(t),window.loomi_api||={},window.loomi_api.trackClick=Se,window.loomi_api.trackCustomEvent=xe,function(t){try{return Promise.resolve(d(()=>!!document.body)).then(function(){return Promise.resolve(d(()=>!!f(()=>window.loomi_ctx.session.id))).then(function(){f(()=>{t||=f(()=>window.loomi.conf.custom_goals)||[];const e=()=>window.loomi.custom_goals;t.forEach(t=>{e()||(window.loomi.custom_goals=new Set),e().has(t.id)||(f(()=>new Function(t.code)()),e().add(t.id))})})})})}catch(t){return Promise.reject(t)}}(),function(){if(z("kill-custom-events"))return;f(Ve),window.loomi_api||={},window.loomi_api.trackExpEvent=$e;const t=window.document;t[He]||(t.addEventListener("click",Ke,!0),t[He]=1),t[Fe]||(t.addEventListener("mouseover",We,!0),t[Fe]=1)}()})}if(z("kill-switch")||z("kill-tracking"))return;const i=function(){if(!f(()=>window.vslyNotShopify))return Promise.resolve(function(t,e){void 0===t&&(t=100),void 0===e&&(e=100);try{return Promise.resolve(d(()=>void 0!==window.ShopifyAnalytics,t,e)).then(function(){return"ok"})}catch(t){return Promise.reject(t)}}(100,100)).then(function(){})}();return i&&i.then?i.then(e):e()}))}catch(t){return r(t)}return a&&a.then?a.then(void 0,r):a}(0,function(t){S().error("vsly","init failed",t)}))}catch(t){return Promise.reject(t)}}(t,n,e))}}return nn(),t.bootstrap=nn,t}({});