@elevateab/sdk 1.4.7 → 1.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -3
- package/dist/cartAttributes-MBKMHUMX.js +2 -0
- package/dist/cartAttributes-OBFX2SHM.js +3 -0
- package/dist/{chunk-5TU25234.js → chunk-EDXSTPN4.js} +3 -3
- package/dist/chunk-EDXSTPN4.js.map +1 -0
- package/dist/{chunk-GGAESORE.js → chunk-SCLOA5QZ.js} +3 -3
- package/dist/chunk-SCLOA5QZ.js.map +1 -0
- package/dist/{chunk-7OUZ2CQ5.js → chunk-Z4N3VDSA.js} +2 -2
- package/dist/hydrogen.cjs.map +1 -1
- package/dist/hydrogen.js +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/next.cjs +3 -3
- package/dist/next.cjs.map +1 -1
- package/dist/next.js +1 -1
- package/package.json +1 -1
- package/dist/cartAttributes-DBBVZUFZ.js +0 -2
- package/dist/cartAttributes-V5XBJEGE.js +0 -3
- package/dist/chunk-5TU25234.js.map +0 -1
- package/dist/chunk-GGAESORE.js.map +0 -1
- /package/dist/{cartAttributes-DBBVZUFZ.js.map → cartAttributes-MBKMHUMX.js.map} +0 -0
- /package/dist/{cartAttributes-V5XBJEGE.js.map → cartAttributes-OBFX2SHM.js.map} +0 -0
- /package/dist/{chunk-7OUZ2CQ5.js.map → chunk-Z4N3VDSA.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Lt,b as it,c as w,d as g,e as ie,f as se,g as st,h as ct,i as ce,j as lt,k as ut,l as le,m as dt,n as De}from"./chunk-
|
|
1
|
+
import{a as Lt,b as it,c as w,d as g,e as ie,f as se,g as st,h as ct,i as ce,j as lt,k as ut,l as le,m as dt,n as De}from"./chunk-Z4N3VDSA.js";import{A as be,B as yt,C as ke,D as Se,E as xe,F as Ae,G as S,H as Ue,I as Ie,J as Le,K as ht,L as Re,M as Ve,N as He,O as Oe,c as pt,d as V,e as k,f as H,g as ue,h as de,i as pe,j as fe,k as me,l as ft,m as ge,n as mt,o as ye,p as gt,q as he,r as Rt,s as F,t as we,u as Ce,v as ve,w as Te,x as Pe,y as _e,z as Ee}from"./chunk-EDXSTPN4.js";function Be(){if(typeof navigator>"u")return"desktop";let t=navigator.userAgent||navigator.vendor||window.opera||"",e=t.toLowerCase();return/windows nt.*tablet pc|pixelbook/i.test(t)||/(?:macintosh|windows nt|win(?:95|98)|linux x86_64)/i.test(t)&&!/android|mobile|tablet|ipad|iphone|ipod/i.test(e)?"desktop":/ipad|playbook|tablet|kindle|nexus (7|10)|xoom|sm-t\d+|galaxy tab|tb-\d+|tb\d+[a-z]+|lenovo.*tb|dtab|ideatab|mediapad|matepad|honor.*pad|pad\s+\d+|mi\s+pad|redmi.*pad|xiaomi.*pad|oppo.*pad|oneplus.*pad|opd\d+|tcl.*tab|9\d{3}[a-z]|kobo|archos.*5(?!\d)|ereader|droipad/i.test(t)||/android(?!.*mobile)/i.test(e)&&!/dalvik.*miui|pocophone|mi\s+mix|edge\s+\d+|sm-g9\d+|pixel\s+\d|pixel\s+fold|advan\s+\d{4}/i.test(t)?"tablet":/android.+mobile|iphone|ipod|windows phone|blackberry|mobile|phone|kaios/i.test(e)||/^mobile;/i.test(t)||/dalvik.*miui|pocophone|mi\s+mix|pixel\s+\d|pixel\s+fold/i.test(t)?"mobile":"desktop"}function Vt(){if(typeof navigator>"u")return!1;let t=navigator.userAgent||navigator.vendor||window.opera;return/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i.test(t)}function Ht(){if(typeof navigator>"u")return!1;let t=navigator.userAgent||navigator.vendor||window.opera;return/(instagram)[\/ ]([-\w\.]+)/i.test(t)}function Ot(){if(typeof navigator>"u")return!1;let t=navigator.userAgent||navigator.vendor||window.opera;return/musical_ly/i.test(t)}function Dt(){if(typeof navigator>"u")return!1;let t=navigator.userAgent||navigator.vendor||window.opera;return/(pinterest)[\/ ]([-\w\.]+)/i.test(t)}function Ne(){if(typeof window>"u")return"direct";let t=(document.referrer||"").toLowerCase(),e=t?new URL(t).hostname.replace("www.",""):"",r=window.location.hostname,o=Vt(),n=Ht(),i=Ot(),a=Dt();return o||["facebook.com","fb.com","fb.me","m.facebook.com","l.facebook.com","lm.facebook.com"].includes(e)?"facebook":n||e.includes("instagram")?"instagram":i||["tiktok.com","pangleglobal.com","ads.tiktok.com"].includes(e)?"tiktok":a||e.includes("pinterest")||e==="pin.it"?"pinterest":e.includes("google")?"google":!t||r===e?"direct":"other"}var A={SHOPIFY_LOCALIZATION:"localization",EAB_COUNTRY:"eabCountryCode",EAB_GEO:"eabGeoLocation"};function O(){if(typeof window>"u")return null;let e=new URLSearchParams(window.location.search).get("country");if(e)return V(A.EAB_COUNTRY,e.toUpperCase()),e.toUpperCase();let r=k(A.SHOPIFY_LOCALIZATION);if(r)return r.toUpperCase();let o=k(A.EAB_COUNTRY);if(o)return o.toUpperCase();if(typeof localStorage<"u"){let n=localStorage.getItem(A.EAB_COUNTRY);if(n)return n.toUpperCase()}return null}function Me(){let t=O(),e=k(A.EAB_GEO);if(e)try{let r=JSON.parse(e);return{country:r.country||t,region:r.region,city:r.city}}catch{}return{country:t}}function Bt(t){let e=t.toUpperCase();V(A.EAB_COUNTRY,e),typeof localStorage<"u"&&localStorage.setItem(A.EAB_COUNTRY,e)}function ze(t){t.country&&Bt(t.country),V(A.EAB_GEO,JSON.stringify(t))}function Nt(t,e){let r=e??O();return r?t.map(n=>n.toUpperCase()).includes(r.toUpperCase()):!1}function Mt(t,e){let r=e??O();return r?t.map(n=>n.toUpperCase()).includes(r.toUpperCase()):!1}function Fe(t){let e=O();return!t.includeCountries?.length&&!t.excludeCountries?.length?!0:!e||t.excludeCountries?.length&&Mt(t.excludeCountries,e)?!1:t.includeCountries?.length?Nt(t.includeCountries,e):!0}var $e={US:"US",CA:"CA",GB:"GB",AU:"AU",DE:"DE",FR:"FR",JP:"JP",MX:"MX",BR:"BR",IN:"IN"},qe={NORTH_AMERICA:["US","CA","MX"],EUROPE:["GB","DE","FR","IT","ES","NL","BE","AT","CH","PL","SE","NO","DK","FI","IE","PT"],APAC:["AU","NZ","JP","KR","SG","HK","TW","TH","MY","PH","ID","VN","IN"],LATAM:["MX","BR","AR","CL","CO","PE"]};var X="eab:navigate",Z=!1,wt=0,J=null,Y=null;function Ge(){typeof window>"u"||(wt++,!Z&&(Z=!0,J=history.pushState.bind(history),Y=history.replaceState.bind(history),history.pushState=function(...t){J(...t),window.dispatchEvent(new Event(X))},history.replaceState=function(...t){Y(...t),window.dispatchEvent(new Event(X))}))}function We(){typeof window>"u"||(wt--,!(wt>0||!Z)&&(J&&(history.pushState=J,J=null),Y&&(history.replaceState=Y,Y=null),Z=!1))}function $(t){if(typeof window>"u")return()=>{};let e=window.location.href,r=()=>{let o=window.location.href;o!==e&&(e=o,t())};return Ge(),window.addEventListener(X,r),window.addEventListener("popstate",r),()=>{window.removeEventListener(X,r),window.removeEventListener("popstate",r),We()}}function Ct(t){let{configUrl:e,timeout:r=2e3}=t;return`(function(){
|
|
2
2
|
if(new URLSearchParams(location.search).get('abtr')==='true')return;
|
|
3
3
|
|
|
4
4
|
var style=document.createElement('style');
|
|
@@ -26,5 +26,5 @@ import{a as Lt,b as it,c as w,d as g,e as ie,f as se,g as st,h as ct,i as ce,j a
|
|
|
26
26
|
if(window.__eab_reveal)window.__eab_reveal();
|
|
27
27
|
};
|
|
28
28
|
document.head.appendChild(script);
|
|
29
|
-
})();`}function zt(t){if(!t?.trim())return"";try{let r=`https://${t.trim().replace(/^https?:\/\//,"")}`,o=new URL(r.replace(/\/+$/,""));return o.hostname.startsWith("www.")&&(o.hostname=o.hostname.substring(4)),o.toString().replace(/\/+$/,"")}catch{return t.trim().replace(/\/+$/,"")}}function vt(t,e){let r=zt(t.split("?")[0]);for(let o of e){let n=zt(o.split("?")[0]);if(r===n)return!0;try{let i=new URL(t).pathname,a=new URL(o,t).pathname;if(i===a)return!0}catch{}}return!1}function je(t){return t.data?.redirectBehavior||"redirectAll"}function Ft(t){return!!(H("eabRedirectedTests")||{})[t]}function $t(t){let e=H("eabRedirectedTests")||{};e[t]=!0,V("eabRedirectedTests",JSON.stringify(e))}function Je(t,e){for(let r of t.tests)if(!(r.type!=="SPLIT_URL"||!r.enabled))for(let o of r.variations){let n=o.splitUrlTestLinks||[];if(n.length!==0&&vt(e,n))return{test:r,matchedVariation:o,isControlUrl:!!o.isControl}}return null}function Ye(t){if(typeof window>"u")return;let e=new URL(t,window.location.origin);e.searchParams.set("abtr","true");let r=e.toString(),o=window.__remixRouter?.navigate??window.next?.router?.push??window.$nuxt?.$router?.push??window.__navigate;if(o&&typeof o=="function")try{let n=e.pathname+e.search;o(n);return}catch{}window.location.href=r}function Q(t,e){if(typeof window>"u")return!1;let r=window.location.href;if(new URLSearchParams(window.location.search).get("abtr")==="true")return!1;let n=Je(t,r);if(!n)return!1;let{test:i,matchedVariation:a,isControlUrl:c}=n,s=i.testId,u=je(i),d=S(s);if(!d)return!1;let f=i.variations.find(y=>y.id===d);if(!f)return!1;let l=f.splitUrlTestLinks||[];if(l.length===0||vt(r,l))return!1;switch(u){case"redirectOnlyControlUrl":if(!c||f.isControl)return!1;break;case"redirectOnce":if(Ft(s))return!1;$t(s);break;case"redirectOnceControlUrlOnly":if(!c||Ft(s)||f.isControl)return!1;$t(s);break;default:break}let v=l[0];return Ye(v),!0}function qt(t){return t.tests.some(e=>e.type==="SPLIT_URL"&&e.enabled)}var Tt={type:"SPLIT_URL",shouldActivate(t,e){for(let r of t.variations){let o=r.splitUrlTestLinks||[];if(vt(e.currentUrl,o))return!0}return!1},getVariantData(){return{handlerActivated:!0}}};function _(t){return t?t.includes("gid://")&&t.split("/").pop()||t:""}function Qe(t){return!t||!t.includes("gid://")?null:t.split("/")[3]||null}function Ke(t){return!!t&&t.startsWith("gid://shopify/")}function Xe(){if(typeof window>"u")return;let t=window.Shopify;if(t?.currency?.active)return t.currency.active}var Gt="elv-el-",Wt={ELEMENT_NODE:1,TEXT_NODE:3},tt=new Map,q=new Map,G=new Map,W=new Map,j=!1;function x(t,e){if(e==="*")return!0;if(e.startsWith("*")&&e.endsWith("*")){let r=e.slice(1,-1);return t.includes(r)}if(e.startsWith("*")){let r=e.slice(1);return t.endsWith(r)}return e===t}function bt(){return typeof window>"u"?!1:window.innerWidth<768}function Ze(t){let e="";for(let r=0;r<t.length;r++){let o=t[r];o>="A"&&o<="Z"?(r!==0&&(e+="-"),e+=o.toLowerCase()):e+=o}return e}function tr(t){return t.nodeType===Wt.TEXT_NODE}function Pt(t){return t.nodeType===Wt.ELEMENT_NODE}function _t(t,e){tt.has(t)||tt.set(t,e.cloneNode(!0))}function jt(t){let e=t;e=e.replace(/`/g,"`").replace(/$/g,"$");try{e=JSON.parse('"'+e+'"')}catch{}return e}function Jt(t){if(typeof window>"u"||t.length===0)return;let e=window.location.pathname,r=t.filter(n=>n.pathnames?.length?n.pathnames.some(i=>x(e,i)):!0);j=bt();let o=r.map(n=>({...n,style:n.style?{...n.style.lg,...j&&n.style.sm}:void 0,content:n.content&&j&&n.content.sm?n.content.sm:n.content?.lg}));o.filter(n=>n.content!==void 0).forEach(n=>{(n.applyAll?Array.from(document.querySelectorAll(n.selector)):[document.querySelector(n.selector)].filter(Boolean)).forEach((a,c)=>{if(!a)return;let s=n.applyAll?`${n.selector}-${c}-${a.id||Math.random().toString(36).substr(2,9)}`:n.selector;_t(s,a),tr(a)?a.nodeValue=n.content:Pt(a)&&(a.innerHTML=n.content)})}),o.filter(n=>n.style!==void 0).forEach(n=>{let i=document.querySelector(n.selector);!i||!Pt(i)||(_t(n.selector,i),Object.entries(n.style).forEach(([a,c])=>{let s=Ze(a),u=c.toString().includes("!important"),d=c.toString().replace(/\s*!important\s*$/,"");i.style.setProperty(s,d,u?"important":void 0)}))}),o.filter(n=>n.attributes!==void 0).forEach(n=>{let i=document.querySelector(n.selector);!i||!Pt(i)||(_t(n.selector,i),Object.entries(n.attributes).forEach(([a,c])=>{i.setAttribute(a,c)}))})}function Yt(t){if(typeof window>"u"||t.length===0)return;let e=window.location.pathname;t.filter(o=>o.selector?.pathnames?.length?o.selector.pathnames.some(n=>x(e,n)):!0).forEach(o=>{let n=`${Gt}${o.id}`,i=W.get(n);if(i&&!document.contains(i)&&W.delete(n),W.has(n))return;let a=document.querySelector(o.selector.target);if(!a||a.parentElement?.querySelector(`#${n}`))return;let c=Qt(o);o.selector.placement==="after"?a.after(c):o.selector.placement==="before"&&a.before(c),W.set(n,c)})}function Qt(t){let e=document.createElement(t.tagName);return e.id=`${Gt}${t.id}`,t.style&&Object.assign(e.style,t.style),t.attributes&&Object.entries(t.attributes).forEach(([r,o])=>{e.setAttribute(r,o)}),t.kind==="text"&&t.content&&(e.innerText=t.content),t.kind==="container"&&t.childrens&&t.childrens.forEach(r=>{let o=Qt(r);e.appendChild(o)}),e}function et(t,e){if(typeof window>"u"||t.length===0)return;let r=window.location.pathname;t.filter(n=>n.pathnames?.length?n.excludePathnames?.length&&n.excludePathnames.some(a=>x(r,a))?!1:n.pathnames.some(i=>x(r,i)):!0).forEach(n=>{n.id&&(n.css&&er(n.id,n.css),n.js&&rr(n.id,n.js,e))})}function er(t,e){let r=`css-${t}`,o=q.get(r);if(o&&!document.contains(o)&&q.delete(r),q.has(r)||document.getElementById(r))return;let n=document.createElement("style");n.id=r,n.textContent=jt(e),document.head.appendChild(n),q.set(r,n)}function rr(t,e,r){let o=`js-${t}`,n=G.get(o);if(n&&!document.contains(n)&&G.delete(o),G.has(o)||document.getElementById(o))return;let i=document.createElement("script");i.id=o,r&&i.setAttribute("nonce",r);let a=jt(e);i.textContent="(function(){try{"+a+"}catch(e){console.error('[ElevateAB] Custom script error:', e)}})();",document.head.appendChild(i),G.set(o,i)}function Kt(){tt.forEach((t,e)=>{let r=document.querySelector(e);r&&r.replaceWith(t.cloneNode(!0))})}function Xt(){q.forEach(t=>t.remove()),q.clear(),G.forEach(t=>t.remove()),G.clear(),W.forEach(t=>t.remove()),W.clear(),tt.clear()}function nr(t,e){let r=[],o=[],n=[];return t.tests.filter(a=>a.type==="CONTENT"&&a.enabled).forEach(a=>{let c=S(a.testId);if(!c)return;let s=a.variations.find(u=>u.id===c);s?.content&&(s.content.changes?.length&&r.push(...s.content.changes),s.content.elements?.length&&o.push(...s.content.elements),s.content.customCodes?.length&&n.push(...s.content.customCodes))}),{changes:r,elements:o,blocks:[],customCodes:n}}function K(t){return t.tests.some(e=>e.type==="CONTENT"&&e.enabled)}function rt(t,e,r){if(typeof window>"u"||!K(t))return;let o=nr(t,e);(o.changes.length>0||o.elements.length>0||o.customCodes.length>0)&&(Jt(o.changes),Yt(o.elements),et(o.customCodes,r))}function Et(t,e,r){if(typeof window>"u")return;let o=bt();o!==j&&(Kt(),j=o),rt(t,e,r)}function kt(t,e,r,o=!0){if(typeof window>"u")return()=>{};let n=()=>{bt()!==j&&Et(t,e,r)};window.addEventListener("resize",n);let i=()=>{};return o&&(i=$(()=>{Et(t,e,r)})),()=>{window.removeEventListener("resize",n),i(),Xt()}}import{useEffect as Zt,useRef as yr,useState as hr}from"react";var or="https://bitter-river-9c62.support-67d.workers.dev",ar="https://d339co84ntxcme.cloudfront.net/Prod/orders",C=null;function St(t){C=t}function U(t){let e=t?.storeId||C?.storeId;return e||(console.warn("[ElevateAB] No storeId provided. Call initAnalytics() first or pass storeId to tracking function."),"")}function ir(t){return Object.entries(t).filter(([,e])=>typeof e=="string").map(([e,r])=>({test_id:e,variant_id:r}))}function sr(t,e){return Object.entries(t).filter(([r])=>typeof e[r]=="string").map(([r])=>({test_id:r,variant_id:e[r]}))}function cr(){return typeof window>"u"?!1:k("eabUserPreview")==="true"||new URLSearchParams(window.location.search).get("eabUserPreview")==="true"}function I(t,e,r){if(typeof window>"u"||cr())return null;let o=navigator.userAgent,n=window.location.pathname,i=ut(n,r),{referrer:a,entryPage:c}=gt(),s=lt({referrer:a,entryPage:c,userAgent:o}),u=H("ABTL")||{},d=H("ABAU")||{},f=ir(u),l=sr(d,u),v=st(localStorage.getItem("shopifyCartId")),y=new Date().toISOString(),h=sessionStorage.getItem("eabIsFirstVisit")==="true",m=k("localization")||"";return{pixel_event_id:`sh-${pt()}`,shop_name:t,timestamp:y,event_type:e,client_id:k("_shopify_y")||void 0,visitor_id:ft(),session_id:mt(),cart_token:ct(v||k("cart")),page_url:window.location.href,page_pathname:n,page_search:window.location.search,referrer_url:a,referrer_source:s?.referrer_source,previous_page:document.referrer,page_entry:c,page_entry_path:s?.page_entry_path,page_type:i,utm_medium:s?.utm_medium,utm_source:s?.utm_source,utm_campaign:s?.utm_campaign,utm_content:s?.utm_content,utm_term:s?.utm_term,gclid:s?.gclid,fbclid:s?.fbclid,pins_campaign_id:s?.pins_campaign_id,epik:s?.epik,browser_info:s?.browser_info,os_info:s?.os_info,device_type:s?.device_type,language:navigator.language,root_route:localStorage.getItem("eabRootRoute")||"",user_agent:o,user_agent_no_browser:dt(o),is_first_visit:h,shopify_country:m,ab_test_assignments:f,ab_test_views:l,is_first_order:null}}async function L(t,e=or){try{let r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),keepalive:!0});if(!r.ok)throw new Error(`Worker error: ${r.status}`)}catch(r){console.error("[ElevateAB] Error sending analytics:",r)}}async function te(t={}){let e=U(t);if(!e)return;let r=t.hasLocalizedPaths??C?.hasLocalizedPaths,o=t.workerUrl??C?.workerUrl,n=I(e,"page_viewed",r);if(!n)return;let i={...n,cart_currency:t.currency};await L(i,o)}async function lr(t){let e=U(t);if(!e)return;let{productId:r,productVendor:o,productPrice:n,productSku:i,currency:a}=t,c=t.hasLocalizedPaths??C?.hasLocalizedPaths,s=t.workerUrl??C?.workerUrl,u=I(e,"product_viewed",c);if(!u)return;let d={...u,cart_currency:a,product_id:_(r),product_vendor:w(o),product_price:g(n),product_sku:w(i)};await L(d,s)}async function ur(t){let e=U(t);if(!e)return;let{productId:r,variantId:o,productVendor:n,productPrice:i,productQuantity:a,productSku:c,currency:s,cartId:u}=t,d=t.hasLocalizedPaths??C?.hasLocalizedPaths,f=t.workerUrl??C?.workerUrl,l=t.storefrontAccessToken??C?.storefrontAccessToken,v=I(e,"product_added_to_cart",d);if(!v)return;let y={...v,cart_currency:s,product_id:_(r),variant_id:_(o),product_vendor:w(n),product_price:g(i),product_quantity:a,product_sku:w(c)};if(await L(y,f),u&&l)try{let{updateCartAttributes:h}=await import("./cartAttributes-DBBVZUFZ.js");await h(u,{storefrontAccessToken:l})}catch(h){console.error("[ElevateAB] Failed to update cart attributes:",h)}}async function dr(t){let e=U(t);if(!e)return;let{productId:r,variantId:o,productVendor:n,productPrice:i,productQuantity:a,productSku:c,currency:s}=t,u=t.hasLocalizedPaths??C?.hasLocalizedPaths,d=t.workerUrl??C?.workerUrl,f=I(e,"product_removed_from_cart",u);if(!f)return;let l={...f,cart_currency:s,product_id:_(r),variant_id:_(o),product_vendor:w(n),product_price:g(i),product_quantity:a,product_sku:w(c)};await L(l,d)}async function pr(t){let e=U(t);if(!e)return;let{cartTotalPrice:r,cartTotalQuantity:o,cartItems:n,currency:i}=t,a=t.hasLocalizedPaths??C?.hasLocalizedPaths,c=t.workerUrl??C?.workerUrl,s=I(e,"cart_viewed",a);if(!s)return;let u={...s,cart_currency:i,cart_total_price:g(r),cart_total_quantity:o,cart_items:n?.map(d=>({product_id:_(d.productId),variant_id:_(d.variantId),product_vendor:w(d.productVendor)||"",product_price:g(d.productPrice),product_quantity:d.productQuantity??null,product_sku:w(d.productSku)||""}))};await L(u,c)}async function fr(t){let e=U(t);if(!e)return;let{searchQuery:r,currency:o}=t,n=t.hasLocalizedPaths??C?.hasLocalizedPaths,i=t.workerUrl??C?.workerUrl,a=I(e,"search_submitted",n);if(!a)return;let c={...a,cart_currency:o,search_query:w(r)};await L(c,i)}async function mr(t){let e=U(t);if(!e)return;let{cartTotalPrice:r,cartSubtotalPrice:o,cartShippingPrice:n,cartTaxAmount:i,cartDiscountAmount:a,customerId:c,cartItems:s,currency:u}=t,d=t.hasLocalizedPaths??C?.hasLocalizedPaths,f=t.workerUrl??C?.workerUrl,l=I(e,"checkout_started",d);if(!l)return;let v=0,y=s?.map(m=>{let P=m.productQuantity??0;return v+=P,{product_id:_(m.productId),variant_id:_(m.variantId),product_vendor:w(m.productVendor)||"",vendor:w(m.productVendor)||"",product_price:g(m.productPrice),total_price:g(m.productPrice),product_quantity:P,quantity:P,product_sku:w(m.productSku)||"",sku:w(m.productSku)||"",total_discount:g(m.totalDiscount)}})||[],h={...l,cart_currency:u,cart_total_price:g(r),cart_subtotal_price:g(o),cart_total_quantity:v,cart_shipping_price:g(n),cart_tax_amount:g(i),cart_discount_amount:g(a),cart_items:y,customer_id:c};await L(h,f)}async function gr(t){let e=U(t);if(!e)return;let{orderId:r,cartTotalPrice:o,cartSubtotalPrice:n,cartShippingPrice:i,cartTaxAmount:a,cartDiscountAmount:c,customerId:s,isFirstOrder:u,noteAttributes:d,cartItems:f,currency:l}=t,v=t.hasLocalizedPaths??C?.hasLocalizedPaths,y=t.ordersWorkerUrl??C?.ordersWorkerUrl??ar,h=I(e,"checkout_completed",v);if(!h)return;let m=0,P=f?.map(p=>{let E=p.productQuantity??0;return m+=E,{product_id:_(p.productId),variant_id:_(p.variantId),product_vendor:w(p.productVendor)||"",vendor:w(p.productVendor)||"",product_price:g(p.productPrice),total_price:g(p.productPrice),product_quantity:E,quantity:E,product_sku:w(p.productSku)||"",sku:w(p.productSku)||"",total_discount:g(p.totalDiscount)}})||[],T={...h,cart_currency:l,cart_total_price:g(o),cart_subtotal_price:g(n),cart_total_quantity:m,cart_shipping_price:g(i),cart_tax_amount:g(a),cart_discount_amount:g(c),cart_items:P,order_id:r,customer_id:s,is_first_order:u??null,note_attributes:d};await L(T,y)}function wr(t){let{storeId:e,hasLocalizedPaths:r,currency:o,workerUrl:n,enabled:i=!0,pathname:a}=t,c=yr(null),[s,u]=hr(()=>a||(typeof window<"u"?window.location.pathname:""));Zt(()=>{a&&u(a)},[a]),Zt(()=>{typeof window>"u"||!i||c.current!==s&&(c.current=s,te({storeId:e,hasLocalizedPaths:r,currency:o,workerUrl:n}))},[s,e,r,o,n,i])}import B from"react";var nt=new Map;function D(t){nt.set(t.type,t)}function ot(t){return nt.get(t)}function ee(){return Array.from(nt.values())}function re(t){return nt.has(t)}function Cr(t){try{let o=new URL(t,"https://example.com").pathname.match(/\/products\/([^\/\?]+)/);return o?o[1]:null}catch{return null}}function vr(t,e,r,o){if(typeof window>"u"||!t.prices||!e)return;let n=t.prices[e];if(!n)return;let i=n.price?.[r],a=n.compare?.[r],c=o;if(c?.selectorsV2?.length)for(let s of c.selectorsV2){if(s.price&&i){let u=s.price.replace("{{variant}}",e);document.querySelectorAll(u).forEach(f=>{let l=new Intl.NumberFormat("en-US",{style:"currency",currency:r}).format(parseFloat(i));f.textContent=l})}if(s.compareAt&&a){let u=s.compareAt.replace("{{variant}}",e);document.querySelectorAll(u).forEach(f=>{let l=new Intl.NumberFormat("en-US",{style:"currency",currency:r}).format(parseFloat(a));f.textContent=l})}if(s.saving&&i&&a)for(let u of s.saving){let d=u.selector.replace("{{variant}}",e);document.querySelectorAll(d).forEach(l=>{let v=parseFloat(i),y=parseFloat(a),h=y-v;if(u.isPercentage){let m=Math.round(h/y*100);l.textContent=`${m}%`}else{let m=new Intl.NumberFormat("en-US",{style:"currency",currency:r}).format(h);l.textContent=m}})}}}var xt={type:"PRICE_PLUS",shouldActivate(t,e){let r=t.data;if(!r)return!1;let{productId:o,productHandle:n}=e,i=n||Cr(e.currentUrl),a=o&&r.productIds?.includes(o),c=i&&r.handles?.includes(i);return a||c},applyEffect(t,e,r){vr(e,r.variantId,r.currencyCode||"USD",r.selectors)},getVariantData(t,e,r){let o=t.data;return{prices:e.prices,matchedProductId:r.productId,productIds:o?.productIds,handles:o?.handles,handlerActivated:!0}}};function Tr(t,e){let o=t.data?.pathnames||[];if(!o.length)return!0;try{let i=new URL(e,"https://example.com").pathname;return o.some(a=>x(i,a))}catch{return!1}}var at={type:"CONTENT",shouldActivate(t,e){return Tr(t,e.currentUrl)},getVariantData(t,e,r){let o=t.data;return{content:e.content,pathnames:o?.pathnames,handlerActivated:!0}}};function Pr(t,e){let o=t.data?.pathnames||[];if(!o.length)return!0;try{let i=new URL(e,"https://example.com").pathname;return o.some(a=>x(i,a))}catch{return!1}}var At={type:"CUSTOM_CODE",shouldActivate(t,e){return Pr(t,e.currentUrl)},getVariantData(t,e,r){let o=t.data;return{customCode:e.customCode,pathnames:o?.pathnames,excludePathnames:o?.excludePathnames,handlerActivated:!0}}};D(xt);D(Tt);D(at);D(At);function _r(t){if(typeof window>"u")return{currentUrl:"",selectors:t};let e=window.location.href,r=window.location.pathname,o,n=r.match(/\/products\/([^\/\?]+)/);n&&(o=n[1]);let i,c=new URLSearchParams(window.location.search).get("variant");return c&&(i=c),{currentUrl:e,productHandle:o,variantId:i,selectors:t,currencyCode:"USD"}}function Er(t){let{config:e,previewState:r,selectors:o}=it(),[n,i]=B.useState(null),[a,c]=B.useState(!0),s=B.useMemo(()=>e&&e.tests.find(l=>l.testId===t)||null,[e,t]),u=B.useMemo(()=>r||F(),[r]),d=B.useRef(null),f=B.useRef(null);return B.useEffect(()=>{let l=!0;if(e===null)return;if(!s){d.current!==t&&(d.current=t,console.warn(`[ElevateAB] Test not found: ${t}`)),l&&c(!1);return}if(!s.enabled&&!u?.isPreview){d.current!==`${t}-disabled`&&(d.current=`${t}-disabled`,console.warn(`[ElevateAB] Test disabled: ${t}`)),l&&c(!1);return}let v=S(t);if(!v){l&&c(!1);return}let y=s.variations.find(T=>T.id===v);if(!y){l&&c(!1);return}let h=ot(s.type),m=_r(o),P={...y};if(h?.shouldActivate(s,m)){let T=`${t}-${y.id}`;h.applyEffect&&f.current!==T&&(f.current=T,h.applyEffect(s,y,m));let p=h.getVariantData(s,y,m);P={...P,...p}}return l&&i(P),u?.isPreview||yt(t),l&&c(!1),()=>{l=!1}},[e,s,t,u,o]),{variant:n,isLoading:a,isControl:n?.isControl??!1,isA:n?.isA??!1,isB:n?.isB??!1,isC:n?.isC??!1,isD:n?.isD??!1}}import b,{useRef as br,useCallback as kr}from"react";function Ut(t){return t.tests.some(e=>e.type==="CUSTOM_CODE"&&e.enabled)}function ne(t,e,r){if(typeof window>"u"||!Ut(t))return;let o=t.tests.filter(i=>i.type==="CUSTOM_CODE"&&i.enabled),n=[];o.forEach(i=>{let a=S(i.testId);if(!a)return;let c=i.variations.find(s=>s.id===a);c?.customCode&&(c.customCode.js||c.customCode.css)&&n.push(c.customCode)}),n.length>0&&et(n,r)}import{jsx as Ir,jsxs as Lr}from"react/jsx-runtime";var Sr="https://ds0wlyksfn0sb.cloudfront.net/headless";function xr(t){return t.replace(/^https?:\/\//,"").replace(".myshopify.com","")}function oe(t){return`${Sr}/${xr(t)}.js`}var Ar=typeof window<"u"?b.useLayoutEffect:b.useEffect;function Ur({storeId:t,storefrontAccessToken:e,preventFlickering:r=!1,flickerTimeout:o=3e3,nonce:n,children:i}){let[a,c]=b.useState(null),[s,u]=b.useState(null),[d,f]=b.useState(null);b.useEffect(()=>{if(typeof window>"u")return;St({storeId:t,storefrontAccessToken:e});let P=F();u(P);let T=O();f(T)},[t,e]);let l=kr(()=>{typeof window<"u"&&window.__eab_reveal&&window.__eab_reveal()},[]);b.useEffect(()=>{async function P(){try{let T=typeof window<"u"?F():null,p=null;if(typeof window<"u"&&window.eab_data)p=window.eab_data;else{let M=oe(t);p=await new Promise((z,ae)=>{let R=document.createElement("script");R.src=M,R.async=!0,R.onload=()=>{let It=window.eab_data;R.remove(),It?z(It):ae(new Error("Failed to load config: window.eab_data is undefined"))},R.onerror=()=>{R.remove(),z({allTests:{},selectors:{selectorsV2:[]}})},document.head.appendChild(R)})}if(!p||!p.allTests||Object.keys(p.allTests).length===0){c({tests:[],selectors:void 0}),l();return}if(p.subscriptionPaused){console.error(`[ElevateAB] Subscription is paused or stopped for store: ${t}. `+(p.subscriptionMessage||"A/B tests will not run. Please reactivate your subscription.")),c({tests:[],selectors:void 0}),l();return}if(!(Object.keys(p.allTests||{}).length>0)){c({tests:[],selectors:void 0}),l();return}let N=Rt(p);if(ht(N,T),N.tests.some(M=>M.type==="SPLIT_URL")&&Q(N,T))return;c(N),l()}catch(T){console.error("[ElevateAB] Failed to load config:",T),c({tests:[],selectors:void 0}),l()}}P()},[t,l]),Ar(()=>{if(!a||typeof window>"u")return;let P=()=>qt(a)?Q(a,s):!1,T=()=>{if(K(a))try{rt(a,s,n)}catch(z){console.error("[ElevateAB] Failed to apply CONTENT tests:",z)}if(Ut(a))try{ne(a,s,n)}catch(z){console.error("[ElevateAB] Failed to apply CUSTOM_CODE tests:",z)}};P()||T();let p=null,E=null,N=$(()=>{P()||(T(),p!==null&&window.cancelAnimationFrame(p),E!==null&&window.clearTimeout(E),p=window.requestAnimationFrame(()=>{T(),E=window.setTimeout(()=>{T(),E=null},80),p=null}))}),M=K(a)?kt(a,s,n,!1):()=>{};return()=>{p!==null&&window.cancelAnimationFrame(p),E!==null&&window.clearTimeout(E),N(),M()}},[a,s,n]);let v=b.useMemo(()=>({config:a,storeId:t,storefrontAccessToken:e,isPreviewMode:s?.isPreview??!1,previewTestId:s?.previewTestId??null,previewState:s,selectors:a?.selectors,countryCode:d}),[a,t,e,s,d]),y=br(!1);b.useEffect(()=>{!e&&!y.current&&(y.current=!0,console.warn("[ElevateAB] No storefrontAccessToken provided. Orders won't be attributed to test variants."))},[e]);let h=b.useMemo(()=>oe(t),[t]),m=b.useMemo(()=>Ct({configUrl:h,timeout:r?o:2e3}),[h,r,o]);return Lr(Lt.Provider,{value:v,children:[Ir("script",{nonce:n,dangerouslySetInnerHTML:{__html:m}}),i]})}var Mn="1.1.2";export{Re as CART_ATTRIBUTES_UPDATE_MUTATION,$e as COUNTRIES,De as ElevateAnalytics,Ur as ElevateProvider,qe as REGIONS,Mn as VERSION,Jt as applyContentChanges,Yt as applyContentElements,et as applyCustomCode,ht as assignAllTests,Ue as assignAndPersistVariant,ve as buildEabTestsParam,Ie as canAssignToTest,Vt as checkFacebookBrowser,ce as checkFacebookInstagramBrowser,Ht as checkInstagramBrowser,Dt as checkPinterestBrowser,Ot as checkTikTokBrowser,le as checkVisitorIdParams,ct as cleanCartToken,Oe as cleanupCartAttributes,Xt as cleanupContentTests,Pe as clearPreviewMode,at as contentHandler,ue as deleteCookie,Xe as detectShopifyCurrency,st as extractCartToken,ie as extractProductId,se as extractProductVariantId,_ as extractShopifyId,Qe as extractShopifyType,ee as getAllHandlers,S as getAssignedVariant,Ve as getCartAttributesPayload,k as getCookie,O as getCountryCode,Be as getDeviceType,Me as getGeoLocation,ot as getHandler,H as getJsonCookie,fe as getJsonSessionItem,ut as getPageTypeFromPathname,F as getPreviewState,Ce as getPreviewVariation,gt as getReferrerData,mt as getSessionId,pe as getSessionItem,Ct as getSplitUrlBlockingScript,xe as getTestList,Ne as getTrafficSource,dt as getUserAgentNoBrowser,ft as getVisitorId,K as hasContentTests,re as hasHandler,ke as hasSessionView,Se as hasUniqueView,he as hashString,St as initAnalytics,ge as initializeSessionId,me as initializeVisitorId,Mt as isCountryExcluded,Nt as isCountryIncluded,_e as isInPreviewMode,we as isPreviewTest,Ke as isShopifyGid,Fe as matchesGeoTargeting,x as matchesWildcardPattern,lt as parseAddViewData,rt as processContentTests,Q as processSplitUrlTests,D as registerHandler,Et as reprocessContentTests,Kt as restoreOriginalElements,g as roundToTwo,w as sanitizeString,Ae as saveTestList,V as setCookie,Bt as setCountryCode,ze as setGeoLocation,ye as setReferrerData,de as setSessionItem,kt as setupContentTestListeners,Le as shouldShowTest,ur as trackAddToCart,pr as trackCartView,gr as trackCheckoutCompleted,mr as trackCheckoutStarted,te as trackPageView,lr as trackProductView,dr as trackRemoveFromCart,fr as trackSearchSubmitted,be as trackSessionView,Ee as trackUniqueView,yt as trackViews,He as updateCartAttributes,Te as updateUrlWithTestParams,it as useElevateConfig,Er as useExperiment,wr as usePageViewTracking,pt as uuidv4};
|
|
29
|
+
})();`}function zt(t){if(!t?.trim())return"";try{let r=`https://${t.trim().replace(/^https?:\/\//,"")}`,o=new URL(r.replace(/\/+$/,""));return o.hostname.startsWith("www.")&&(o.hostname=o.hostname.substring(4)),o.toString().replace(/\/+$/,"")}catch{return t.trim().replace(/\/+$/,"")}}function vt(t,e){let r=zt(t.split("?")[0]);for(let o of e){let n=zt(o.split("?")[0]);if(r===n)return!0;try{let i=new URL(t).pathname,a=new URL(o,t).pathname;if(i===a)return!0}catch{}}return!1}function je(t){return t.data?.redirectBehavior||"redirectAll"}function Ft(t){return!!(H("eabRedirectedTests")||{})[t]}function $t(t){let e=H("eabRedirectedTests")||{};e[t]=!0,V("eabRedirectedTests",JSON.stringify(e))}function Je(t,e){for(let r of t.tests)if(!(r.type!=="SPLIT_URL"||!r.enabled))for(let o of r.variations){let n=o.splitUrlTestLinks||[];if(n.length!==0&&vt(e,n))return{test:r,matchedVariation:o,isControlUrl:!!o.isControl}}return null}function Ye(t){if(typeof window>"u")return;let e=new URL(t,window.location.origin);e.searchParams.set("abtr","true");let r=e.toString(),o=window.__remixRouter?.navigate??window.next?.router?.push??window.$nuxt?.$router?.push??window.__navigate;if(o&&typeof o=="function")try{let n=e.pathname+e.search;o(n);return}catch{}window.location.href=r}function Q(t,e){if(typeof window>"u")return!1;let r=window.location.href;if(new URLSearchParams(window.location.search).get("abtr")==="true")return!1;let n=Je(t,r);if(!n)return!1;let{test:i,matchedVariation:a,isControlUrl:c}=n,s=i.testId,u=je(i),d=S(s);if(!d)return!1;let f=i.variations.find(y=>y.id===d);if(!f)return!1;let l=f.splitUrlTestLinks||[];if(l.length===0||vt(r,l))return!1;switch(u){case"redirectOnlyControlUrl":if(!c||f.isControl)return!1;break;case"redirectOnce":if(Ft(s))return!1;$t(s);break;case"redirectOnceControlUrlOnly":if(!c||Ft(s)||f.isControl)return!1;$t(s);break;default:break}let v=l[0];return Ye(v),!0}function qt(t){return t.tests.some(e=>e.type==="SPLIT_URL"&&e.enabled)}var Tt={type:"SPLIT_URL",shouldActivate(t,e){for(let r of t.variations){let o=r.splitUrlTestLinks||[];if(vt(e.currentUrl,o))return!0}return!1},getVariantData(){return{handlerActivated:!0}}};function _(t){return t?t.includes("gid://")&&t.split("/").pop()||t:""}function Qe(t){return!t||!t.includes("gid://")?null:t.split("/")[3]||null}function Ke(t){return!!t&&t.startsWith("gid://shopify/")}function Xe(){if(typeof window>"u")return;let t=window.Shopify;if(t?.currency?.active)return t.currency.active}var Gt="elv-el-",Wt={ELEMENT_NODE:1,TEXT_NODE:3},tt=new Map,q=new Map,G=new Map,W=new Map,j=!1;function x(t,e){if(e==="*")return!0;if(e.startsWith("*")&&e.endsWith("*")){let r=e.slice(1,-1);return t.includes(r)}if(e.startsWith("*")){let r=e.slice(1);return t.endsWith(r)}return e===t}function bt(){return typeof window>"u"?!1:window.innerWidth<768}function Ze(t){let e="";for(let r=0;r<t.length;r++){let o=t[r];o>="A"&&o<="Z"?(r!==0&&(e+="-"),e+=o.toLowerCase()):e+=o}return e}function tr(t){return t.nodeType===Wt.TEXT_NODE}function Pt(t){return t.nodeType===Wt.ELEMENT_NODE}function _t(t,e){tt.has(t)||tt.set(t,e.cloneNode(!0))}function jt(t){let e=t;e=e.replace(/`/g,"`").replace(/$/g,"$");try{e=JSON.parse('"'+e+'"')}catch{}return e}function Jt(t){if(typeof window>"u"||t.length===0)return;let e=window.location.pathname,r=t.filter(n=>n.pathnames?.length?n.pathnames.some(i=>x(e,i)):!0);j=bt();let o=r.map(n=>({...n,style:n.style?{...n.style.lg,...j&&n.style.sm}:void 0,content:n.content&&j&&n.content.sm?n.content.sm:n.content?.lg}));o.filter(n=>n.content!==void 0).forEach(n=>{(n.applyAll?Array.from(document.querySelectorAll(n.selector)):[document.querySelector(n.selector)].filter(Boolean)).forEach((a,c)=>{if(!a)return;let s=n.applyAll?`${n.selector}-${c}-${a.id||Math.random().toString(36).substr(2,9)}`:n.selector;_t(s,a),tr(a)?a.nodeValue=n.content:Pt(a)&&(a.innerHTML=n.content)})}),o.filter(n=>n.style!==void 0).forEach(n=>{let i=document.querySelector(n.selector);!i||!Pt(i)||(_t(n.selector,i),Object.entries(n.style).forEach(([a,c])=>{let s=Ze(a),u=c.toString().includes("!important"),d=c.toString().replace(/\s*!important\s*$/,"");i.style.setProperty(s,d,u?"important":void 0)}))}),o.filter(n=>n.attributes!==void 0).forEach(n=>{let i=document.querySelector(n.selector);!i||!Pt(i)||(_t(n.selector,i),Object.entries(n.attributes).forEach(([a,c])=>{i.setAttribute(a,c)}))})}function Yt(t){if(typeof window>"u"||t.length===0)return;let e=window.location.pathname;t.filter(o=>o.selector?.pathnames?.length?o.selector.pathnames.some(n=>x(e,n)):!0).forEach(o=>{let n=`${Gt}${o.id}`,i=W.get(n);if(i&&!document.contains(i)&&W.delete(n),W.has(n))return;let a=document.querySelector(o.selector.target);if(!a||a.parentElement?.querySelector(`#${n}`))return;let c=Qt(o);o.selector.placement==="after"?a.after(c):o.selector.placement==="before"&&a.before(c),W.set(n,c)})}function Qt(t){let e=document.createElement(t.tagName);return e.id=`${Gt}${t.id}`,t.style&&Object.assign(e.style,t.style),t.attributes&&Object.entries(t.attributes).forEach(([r,o])=>{e.setAttribute(r,o)}),t.kind==="text"&&t.content&&(e.innerText=t.content),t.kind==="container"&&t.childrens&&t.childrens.forEach(r=>{let o=Qt(r);e.appendChild(o)}),e}function et(t,e){if(typeof window>"u"||t.length===0)return;let r=window.location.pathname;t.filter(n=>n.pathnames?.length?n.excludePathnames?.length&&n.excludePathnames.some(a=>x(r,a))?!1:n.pathnames.some(i=>x(r,i)):!0).forEach(n=>{n.id&&(n.css&&er(n.id,n.css),n.js&&rr(n.id,n.js,e))})}function er(t,e){let r=`css-${t}`,o=q.get(r);if(o&&!document.contains(o)&&q.delete(r),q.has(r)||document.getElementById(r))return;let n=document.createElement("style");n.id=r,n.textContent=jt(e),document.head.appendChild(n),q.set(r,n)}function rr(t,e,r){let o=`js-${t}`,n=G.get(o);if(n&&!document.contains(n)&&G.delete(o),G.has(o)||document.getElementById(o))return;let i=document.createElement("script");i.id=o,r&&i.setAttribute("nonce",r);let a=jt(e);i.textContent="(function(){try{"+a+"}catch(e){console.error('[ElevateAB] Custom script error:', e)}})();",document.head.appendChild(i),G.set(o,i)}function Kt(){tt.forEach((t,e)=>{let r=document.querySelector(e);r&&r.replaceWith(t.cloneNode(!0))})}function Xt(){q.forEach(t=>t.remove()),q.clear(),G.forEach(t=>t.remove()),G.clear(),W.forEach(t=>t.remove()),W.clear(),tt.clear()}function nr(t,e){let r=[],o=[],n=[];return t.tests.filter(a=>a.type==="CONTENT"&&a.enabled).forEach(a=>{let c=S(a.testId);if(!c)return;let s=a.variations.find(u=>u.id===c);s?.content&&(s.content.changes?.length&&r.push(...s.content.changes),s.content.elements?.length&&o.push(...s.content.elements),s.content.customCodes?.length&&n.push(...s.content.customCodes))}),{changes:r,elements:o,blocks:[],customCodes:n}}function K(t){return t.tests.some(e=>e.type==="CONTENT"&&e.enabled)}function rt(t,e,r){if(typeof window>"u"||!K(t))return;let o=nr(t,e);(o.changes.length>0||o.elements.length>0||o.customCodes.length>0)&&(Jt(o.changes),Yt(o.elements),et(o.customCodes,r))}function Et(t,e,r){if(typeof window>"u")return;let o=bt();o!==j&&(Kt(),j=o),rt(t,e,r)}function kt(t,e,r,o=!0){if(typeof window>"u")return()=>{};let n=()=>{bt()!==j&&Et(t,e,r)};window.addEventListener("resize",n);let i=()=>{};return o&&(i=$(()=>{Et(t,e,r)})),()=>{window.removeEventListener("resize",n),i(),Xt()}}import{useEffect as Zt,useRef as yr,useState as hr}from"react";var or="https://bitter-river-9c62.support-67d.workers.dev",ar="https://d339co84ntxcme.cloudfront.net/Prod/orders",C=null;function St(t){C=t}function U(t){let e=t?.storeId||C?.storeId;return e||(console.warn("[ElevateAB] No storeId provided. Call initAnalytics() first or pass storeId to tracking function."),"")}function ir(t){return Object.entries(t).filter(([,e])=>typeof e=="string").map(([e,r])=>({test_id:e,variant_id:r}))}function sr(t,e){return Object.entries(t).filter(([r])=>typeof e[r]=="string").map(([r])=>({test_id:r,variant_id:e[r]}))}function cr(){return typeof window>"u"?!1:k("eabUserPreview")==="true"||new URLSearchParams(window.location.search).get("eabUserPreview")==="true"}function I(t,e,r){if(typeof window>"u"||cr())return null;let o=navigator.userAgent,n=window.location.pathname,i=ut(n,r),{referrer:a,entryPage:c}=gt(),s=lt({referrer:a,entryPage:c,userAgent:o}),u=H("ABTL")||{},d=H("ABAU")||{},f=ir(u),l=sr(d,u),v=st(localStorage.getItem("shopifyCartId")),y=new Date().toISOString(),h=sessionStorage.getItem("eabIsFirstVisit")==="true",m=k("localization")||"";return{pixel_event_id:`sh-${pt()}`,shop_name:t,timestamp:y,event_type:e,client_id:k("_shopify_y")||void 0,visitor_id:ft(),session_id:mt(),cart_token:ct(v||k("cart")),page_url:window.location.href,page_pathname:n,page_search:window.location.search,referrer_url:a,referrer_source:s?.referrer_source,previous_page:document.referrer,page_entry:c,page_entry_path:s?.page_entry_path,page_type:i,utm_medium:s?.utm_medium,utm_source:s?.utm_source,utm_campaign:s?.utm_campaign,utm_content:s?.utm_content,utm_term:s?.utm_term,gclid:s?.gclid,fbclid:s?.fbclid,pins_campaign_id:s?.pins_campaign_id,epik:s?.epik,browser_info:s?.browser_info,os_info:s?.os_info,device_type:s?.device_type,language:navigator.language,root_route:localStorage.getItem("eabRootRoute")||"",user_agent:o,user_agent_no_browser:dt(o),is_first_visit:h,shopify_country:m,ab_test_assignments:f,ab_test_views:l,is_first_order:null}}async function L(t,e=or){try{let r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),keepalive:!0});if(!r.ok)throw new Error(`Worker error: ${r.status}`)}catch(r){console.error("[ElevateAB] Error sending analytics:",r)}}async function te(t={}){let e=U(t);if(!e)return;let r=t.hasLocalizedPaths??C?.hasLocalizedPaths,o=t.workerUrl??C?.workerUrl,n=I(e,"page_viewed",r);if(!n)return;let i={...n,cart_currency:t.currency};await L(i,o)}async function lr(t){let e=U(t);if(!e)return;let{productId:r,productVendor:o,productPrice:n,productSku:i,currency:a}=t,c=t.hasLocalizedPaths??C?.hasLocalizedPaths,s=t.workerUrl??C?.workerUrl,u=I(e,"product_viewed",c);if(!u)return;let d={...u,cart_currency:a,product_id:_(r),product_vendor:w(o),product_price:g(n),product_sku:w(i)};await L(d,s)}async function ur(t){let e=U(t);if(!e)return;let{productId:r,variantId:o,productVendor:n,productPrice:i,productQuantity:a,productSku:c,currency:s,cartId:u}=t,d=t.hasLocalizedPaths??C?.hasLocalizedPaths,f=t.workerUrl??C?.workerUrl,l=t.storefrontAccessToken??C?.storefrontAccessToken,v=I(e,"product_added_to_cart",d);if(!v)return;let y={...v,cart_currency:s,product_id:_(r),variant_id:_(o),product_vendor:w(n),product_price:g(i),product_quantity:a,product_sku:w(c)};if(await L(y,f),u&&l)try{let{updateCartAttributes:h}=await import("./cartAttributes-MBKMHUMX.js");await h(u,{storefrontAccessToken:l})}catch(h){console.error("[ElevateAB] Failed to update cart attributes:",h)}}async function dr(t){let e=U(t);if(!e)return;let{productId:r,variantId:o,productVendor:n,productPrice:i,productQuantity:a,productSku:c,currency:s}=t,u=t.hasLocalizedPaths??C?.hasLocalizedPaths,d=t.workerUrl??C?.workerUrl,f=I(e,"product_removed_from_cart",u);if(!f)return;let l={...f,cart_currency:s,product_id:_(r),variant_id:_(o),product_vendor:w(n),product_price:g(i),product_quantity:a,product_sku:w(c)};await L(l,d)}async function pr(t){let e=U(t);if(!e)return;let{cartTotalPrice:r,cartTotalQuantity:o,cartItems:n,currency:i}=t,a=t.hasLocalizedPaths??C?.hasLocalizedPaths,c=t.workerUrl??C?.workerUrl,s=I(e,"cart_viewed",a);if(!s)return;let u={...s,cart_currency:i,cart_total_price:g(r),cart_total_quantity:o,cart_items:n?.map(d=>({product_id:_(d.productId),variant_id:_(d.variantId),product_vendor:w(d.productVendor)||"",product_price:g(d.productPrice),product_quantity:d.productQuantity??null,product_sku:w(d.productSku)||""}))};await L(u,c)}async function fr(t){let e=U(t);if(!e)return;let{searchQuery:r,currency:o}=t,n=t.hasLocalizedPaths??C?.hasLocalizedPaths,i=t.workerUrl??C?.workerUrl,a=I(e,"search_submitted",n);if(!a)return;let c={...a,cart_currency:o,search_query:w(r)};await L(c,i)}async function mr(t){let e=U(t);if(!e)return;let{cartTotalPrice:r,cartSubtotalPrice:o,cartShippingPrice:n,cartTaxAmount:i,cartDiscountAmount:a,customerId:c,cartItems:s,currency:u}=t,d=t.hasLocalizedPaths??C?.hasLocalizedPaths,f=t.workerUrl??C?.workerUrl,l=I(e,"checkout_started",d);if(!l)return;let v=0,y=s?.map(m=>{let P=m.productQuantity??0;return v+=P,{product_id:_(m.productId),variant_id:_(m.variantId),product_vendor:w(m.productVendor)||"",vendor:w(m.productVendor)||"",product_price:g(m.productPrice),total_price:g(m.productPrice),product_quantity:P,quantity:P,product_sku:w(m.productSku)||"",sku:w(m.productSku)||"",total_discount:g(m.totalDiscount)}})||[],h={...l,cart_currency:u,cart_total_price:g(r),cart_subtotal_price:g(o),cart_total_quantity:v,cart_shipping_price:g(n),cart_tax_amount:g(i),cart_discount_amount:g(a),cart_items:y,customer_id:c};await L(h,f)}async function gr(t){let e=U(t);if(!e)return;let{orderId:r,cartTotalPrice:o,cartSubtotalPrice:n,cartShippingPrice:i,cartTaxAmount:a,cartDiscountAmount:c,customerId:s,isFirstOrder:u,noteAttributes:d,cartItems:f,currency:l}=t,v=t.hasLocalizedPaths??C?.hasLocalizedPaths,y=t.ordersWorkerUrl??C?.ordersWorkerUrl??ar,h=I(e,"checkout_completed",v);if(!h)return;let m=0,P=f?.map(p=>{let E=p.productQuantity??0;return m+=E,{product_id:_(p.productId),variant_id:_(p.variantId),product_vendor:w(p.productVendor)||"",vendor:w(p.productVendor)||"",product_price:g(p.productPrice),total_price:g(p.productPrice),product_quantity:E,quantity:E,product_sku:w(p.productSku)||"",sku:w(p.productSku)||"",total_discount:g(p.totalDiscount)}})||[],T={...h,cart_currency:l,cart_total_price:g(o),cart_subtotal_price:g(n),cart_total_quantity:m,cart_shipping_price:g(i),cart_tax_amount:g(a),cart_discount_amount:g(c),cart_items:P,order_id:r,customer_id:s,is_first_order:u??null,note_attributes:d};await L(T,y)}function wr(t){let{storeId:e,hasLocalizedPaths:r,currency:o,workerUrl:n,enabled:i=!0,pathname:a}=t,c=yr(null),[s,u]=hr(()=>a||(typeof window<"u"?window.location.pathname:""));Zt(()=>{a&&u(a)},[a]),Zt(()=>{typeof window>"u"||!i||c.current!==s&&(c.current=s,te({storeId:e,hasLocalizedPaths:r,currency:o,workerUrl:n}))},[s,e,r,o,n,i])}import B from"react";var nt=new Map;function D(t){nt.set(t.type,t)}function ot(t){return nt.get(t)}function ee(){return Array.from(nt.values())}function re(t){return nt.has(t)}function Cr(t){try{let o=new URL(t,"https://example.com").pathname.match(/\/products\/([^\/\?]+)/);return o?o[1]:null}catch{return null}}function vr(t,e,r,o){if(typeof window>"u"||!t.prices||!e)return;let n=t.prices[e];if(!n)return;let i=n.price?.[r],a=n.compare?.[r],c=o;if(c?.selectorsV2?.length)for(let s of c.selectorsV2){if(s.price&&i){let u=s.price.replace("{{variant}}",e);document.querySelectorAll(u).forEach(f=>{let l=new Intl.NumberFormat("en-US",{style:"currency",currency:r}).format(parseFloat(i));f.textContent=l})}if(s.compareAt&&a){let u=s.compareAt.replace("{{variant}}",e);document.querySelectorAll(u).forEach(f=>{let l=new Intl.NumberFormat("en-US",{style:"currency",currency:r}).format(parseFloat(a));f.textContent=l})}if(s.saving&&i&&a)for(let u of s.saving){let d=u.selector.replace("{{variant}}",e);document.querySelectorAll(d).forEach(l=>{let v=parseFloat(i),y=parseFloat(a),h=y-v;if(u.isPercentage){let m=Math.round(h/y*100);l.textContent=`${m}%`}else{let m=new Intl.NumberFormat("en-US",{style:"currency",currency:r}).format(h);l.textContent=m}})}}}var xt={type:"PRICE_PLUS",shouldActivate(t,e){let r=t.data;if(!r)return!1;let{productId:o,productHandle:n}=e,i=n||Cr(e.currentUrl),a=o&&r.productIds?.includes(o),c=i&&r.handles?.includes(i);return a||c},applyEffect(t,e,r){vr(e,r.variantId,r.currencyCode||"USD",r.selectors)},getVariantData(t,e,r){let o=t.data;return{prices:e.prices,matchedProductId:r.productId,productIds:o?.productIds,handles:o?.handles,handlerActivated:!0}}};function Tr(t,e){let o=t.data?.pathnames||[];if(!o.length)return!0;try{let i=new URL(e,"https://example.com").pathname;return o.some(a=>x(i,a))}catch{return!1}}var at={type:"CONTENT",shouldActivate(t,e){return Tr(t,e.currentUrl)},getVariantData(t,e,r){let o=t.data;return{content:e.content,pathnames:o?.pathnames,handlerActivated:!0}}};function Pr(t,e){let o=t.data?.pathnames||[];if(!o.length)return!0;try{let i=new URL(e,"https://example.com").pathname;return o.some(a=>x(i,a))}catch{return!1}}var At={type:"CUSTOM_CODE",shouldActivate(t,e){return Pr(t,e.currentUrl)},getVariantData(t,e,r){let o=t.data;return{customCode:e.customCode,pathnames:o?.pathnames,excludePathnames:o?.excludePathnames,handlerActivated:!0}}};D(xt);D(Tt);D(at);D(At);function _r(t){if(typeof window>"u")return{currentUrl:"",selectors:t};let e=window.location.href,r=window.location.pathname,o,n=r.match(/\/products\/([^\/\?]+)/);n&&(o=n[1]);let i,c=new URLSearchParams(window.location.search).get("variant");return c&&(i=c),{currentUrl:e,productHandle:o,variantId:i,selectors:t,currencyCode:"USD"}}function Er(t){let{config:e,previewState:r,selectors:o}=it(),[n,i]=B.useState(null),[a,c]=B.useState(!0),s=B.useMemo(()=>e&&e.tests.find(l=>l.testId===t)||null,[e,t]),u=B.useMemo(()=>r||F(),[r]),d=B.useRef(null),f=B.useRef(null);return B.useEffect(()=>{let l=!0;if(e===null)return;if(!s){d.current!==t&&(d.current=t,console.warn(`[ElevateAB] Test not found: ${t}`)),l&&c(!1);return}if(!s.enabled&&!u?.isPreview){d.current!==`${t}-disabled`&&(d.current=`${t}-disabled`,console.warn(`[ElevateAB] Test disabled: ${t}`)),l&&c(!1);return}let v=S(t);if(!v){l&&c(!1);return}let y=s.variations.find(T=>T.id===v);if(!y){l&&c(!1);return}let h=ot(s.type),m=_r(o),P={...y};if(h?.shouldActivate(s,m)){let T=`${t}-${y.id}`;h.applyEffect&&f.current!==T&&(f.current=T,h.applyEffect(s,y,m));let p=h.getVariantData(s,y,m);P={...P,...p}}return l&&i(P),u?.isPreview||yt(t),l&&c(!1),()=>{l=!1}},[e,s,t,u,o]),{variant:n,isLoading:a,isControl:n?.isControl??!1,isA:n?.isA??!1,isB:n?.isB??!1,isC:n?.isC??!1,isD:n?.isD??!1}}import b,{useRef as br,useCallback as kr}from"react";function Ut(t){return t.tests.some(e=>e.type==="CUSTOM_CODE"&&e.enabled)}function ne(t,e,r){if(typeof window>"u"||!Ut(t))return;let o=t.tests.filter(i=>i.type==="CUSTOM_CODE"&&i.enabled),n=[];o.forEach(i=>{let a=S(i.testId);if(!a)return;let c=i.variations.find(s=>s.id===a);c?.customCode&&(c.customCode.js||c.customCode.css)&&n.push(c.customCode)}),n.length>0&&et(n,r)}import{jsx as Ir,jsxs as Lr}from"react/jsx-runtime";var Sr="https://ds0wlyksfn0sb.cloudfront.net/headless";function xr(t){return t.replace(/^https?:\/\//,"").replace(".myshopify.com","")}function oe(t){return`${Sr}/${xr(t)}.js`}var Ar=typeof window<"u"?b.useLayoutEffect:b.useEffect;function Ur({storeId:t,storefrontAccessToken:e,preventFlickering:r=!1,flickerTimeout:o=3e3,nonce:n,children:i}){let[a,c]=b.useState(null),[s,u]=b.useState(null),[d,f]=b.useState(null);b.useEffect(()=>{if(typeof window>"u")return;St({storeId:t,storefrontAccessToken:e});let P=F();u(P);let T=O();f(T)},[t,e]);let l=kr(()=>{typeof window<"u"&&window.__eab_reveal&&window.__eab_reveal()},[]);b.useEffect(()=>{async function P(){try{let T=typeof window<"u"?F():null,p=null;if(typeof window<"u"&&window.eab_data)p=window.eab_data;else{let M=oe(t);p=await new Promise((z,ae)=>{let R=document.createElement("script");R.src=M,R.async=!0,R.onload=()=>{let It=window.eab_data;R.remove(),It?z(It):ae(new Error("Failed to load config: window.eab_data is undefined"))},R.onerror=()=>{R.remove(),z({allTests:{},selectors:{selectorsV2:[]}})},document.head.appendChild(R)})}if(!p||!p.allTests||Object.keys(p.allTests).length===0){c({tests:[],selectors:void 0}),l();return}if(p.subscriptionPaused){console.error(`[ElevateAB] Subscription is paused or stopped for store: ${t}. `+(p.subscriptionMessage||"A/B tests will not run. Please reactivate your subscription.")),c({tests:[],selectors:void 0}),l();return}if(!(Object.keys(p.allTests||{}).length>0)){c({tests:[],selectors:void 0}),l();return}let N=Rt(p);if(ht(N,T),N.tests.some(M=>M.type==="SPLIT_URL")&&Q(N,T))return;c(N),l()}catch(T){console.error("[ElevateAB] Failed to load config:",T),c({tests:[],selectors:void 0}),l()}}P()},[t,l]),Ar(()=>{if(!a||typeof window>"u")return;let P=()=>qt(a)?Q(a,s):!1,T=()=>{if(K(a))try{rt(a,s,n)}catch(z){console.error("[ElevateAB] Failed to apply CONTENT tests:",z)}if(Ut(a))try{ne(a,s,n)}catch(z){console.error("[ElevateAB] Failed to apply CUSTOM_CODE tests:",z)}};P()||T();let p=null,E=null,N=$(()=>{P()||(T(),p!==null&&window.cancelAnimationFrame(p),E!==null&&window.clearTimeout(E),p=window.requestAnimationFrame(()=>{T(),E=window.setTimeout(()=>{T(),E=null},80),p=null}))}),M=K(a)?kt(a,s,n,!1):()=>{};return()=>{p!==null&&window.cancelAnimationFrame(p),E!==null&&window.clearTimeout(E),N(),M()}},[a,s,n]);let v=b.useMemo(()=>({config:a,storeId:t,storefrontAccessToken:e,isPreviewMode:s?.isPreview??!1,previewTestId:s?.previewTestId??null,previewState:s,selectors:a?.selectors,countryCode:d}),[a,t,e,s,d]),y=br(!1);b.useEffect(()=>{!e&&!y.current&&(y.current=!0,console.warn("[ElevateAB] No storefrontAccessToken provided. Orders won't be attributed to test variants."))},[e]);let h=b.useMemo(()=>oe(t),[t]),m=b.useMemo(()=>Ct({configUrl:h,timeout:r?o:2e3}),[h,r,o]);return Lr(Lt.Provider,{value:v,children:[Ir("script",{nonce:n,dangerouslySetInnerHTML:{__html:m}}),i]})}var Mn="1.1.2";export{Re as CART_ATTRIBUTES_UPDATE_MUTATION,$e as COUNTRIES,De as ElevateAnalytics,Ur as ElevateProvider,qe as REGIONS,Mn as VERSION,Jt as applyContentChanges,Yt as applyContentElements,et as applyCustomCode,ht as assignAllTests,Ue as assignAndPersistVariant,ve as buildEabTestsParam,Ie as canAssignToTest,Vt as checkFacebookBrowser,ce as checkFacebookInstagramBrowser,Ht as checkInstagramBrowser,Dt as checkPinterestBrowser,Ot as checkTikTokBrowser,le as checkVisitorIdParams,ct as cleanCartToken,Oe as cleanupCartAttributes,Xt as cleanupContentTests,Pe as clearPreviewMode,at as contentHandler,ue as deleteCookie,Xe as detectShopifyCurrency,st as extractCartToken,ie as extractProductId,se as extractProductVariantId,_ as extractShopifyId,Qe as extractShopifyType,ee as getAllHandlers,S as getAssignedVariant,Ve as getCartAttributesPayload,k as getCookie,O as getCountryCode,Be as getDeviceType,Me as getGeoLocation,ot as getHandler,H as getJsonCookie,fe as getJsonSessionItem,ut as getPageTypeFromPathname,F as getPreviewState,Ce as getPreviewVariation,gt as getReferrerData,mt as getSessionId,pe as getSessionItem,Ct as getSplitUrlBlockingScript,xe as getTestList,Ne as getTrafficSource,dt as getUserAgentNoBrowser,ft as getVisitorId,K as hasContentTests,re as hasHandler,ke as hasSessionView,Se as hasUniqueView,he as hashString,St as initAnalytics,ge as initializeSessionId,me as initializeVisitorId,Mt as isCountryExcluded,Nt as isCountryIncluded,_e as isInPreviewMode,we as isPreviewTest,Ke as isShopifyGid,Fe as matchesGeoTargeting,x as matchesWildcardPattern,lt as parseAddViewData,rt as processContentTests,Q as processSplitUrlTests,D as registerHandler,Et as reprocessContentTests,Kt as restoreOriginalElements,g as roundToTwo,w as sanitizeString,Ae as saveTestList,V as setCookie,Bt as setCountryCode,ze as setGeoLocation,ye as setReferrerData,de as setSessionItem,kt as setupContentTestListeners,Le as shouldShowTest,ur as trackAddToCart,pr as trackCartView,gr as trackCheckoutCompleted,mr as trackCheckoutStarted,te as trackPageView,lr as trackProductView,dr as trackRemoveFromCart,fr as trackSearchSubmitted,be as trackSessionView,Ee as trackUniqueView,yt as trackViews,He as updateCartAttributes,Te as updateUrlWithTestParams,it as useElevateConfig,Er as useExperiment,wr as usePageViewTracking,pt as uuidv4};
|
|
30
30
|
//# sourceMappingURL=index.js.map
|
package/dist/next.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";var tn=Object.create;var He=Object.defineProperty;var rn=Object.getOwnPropertyDescriptor;var nn=Object.getOwnPropertyNames;var on=Object.getPrototypeOf,an=Object.prototype.hasOwnProperty;var ee=(e,t)=>()=>(e&&(t=e(e=0)),t);var sn=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),pr=(e,t)=>{for(var r in t)He(e,r,{get:t[r],enumerable:!0})},mr=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of nn(t))!an.call(e,n)&&n!==r&&He(e,n,{get:()=>t[n],enumerable:!(o=rn(t,n))||o.enumerable});return e};var ze=(e,t,r)=>(r=e!=null?tn(on(e)):{},mr(t||!e||!e.__esModule?He(r,"default",{value:e,enumerable:!0}):r,e)),cn=e=>mr(He({},"__esModule",{value:!0}),e);function vt(e){let t=0;for(let r=0;r<e.length;r++){let o=e.charCodeAt(r);t=(t<<5)-t+o,t=t&t}return Math.abs(t)}function gr(e){let t=[];for(let[r,o]of Object.entries(e.allTests)){if(!o.data.isLive)continue;let n=[],u=0;for(let[c,p]of Object.entries(o)){if(c==="data")continue;let d=p;if(typeof d=="object"&&d!==null&&"variationName"in d){let w=!!d.isControl,i=d.content,l;i&&typeof i=="object"&&(l={changes:i.changes||[],elements:i.elements||[],blocks:i.blocks||[],customCodes:i.customCodes||[]});let a=d.customCode,s;a&&typeof a=="object"&&a.id&&(s={id:a.id,js:a.js,css:a.css,pathnames:a.pathnames||[],excludePathnames:a.excludePathnames}),n.push({id:c,name:d.variationName,weight:d.trafficPercentage,isControl:w,productId:d.id,handle:d.handle,price:d.price,prices:d.prices,splitUrlTestLinks:d.splitUrlTestLinks,content:l,customCode:s,isA:!w&&u===0,isB:!w&&u===1,isC:!w&&u===2,isD:!w&&u===3}),w||u++}}n.length>0&&t.push({testId:r,name:o.data.name,enabled:o.data.isLive,type:o.data.type,variations:n,data:o.data})}return{tests:t,selectors:e.selectors}}var Fe=ee(()=>{"use strict"});var wr=sn((_e,je)=>{"use strict";(function(e,t){"use strict";var r="1.0.41",o="",n="?",u="function",c="undefined",p="object",d="string",w="major",i="model",l="name",a="type",s="vendor",f="version",_="architecture",k="console",g="mobile",m="tablet",h="smarttv",P="wearable",L="embedded",M=500,D="Amazon",G="Apple",H="ASUS",pe="BlackBerry",Ve="Browser",Oe="Chrome",Qr="Edge",Le="Firefox",Be="Google",tr="Honor",rr="Huawei",Xr="Lenovo",De="LG",dt="Microsoft",ft="Motorola",pt="Nvidia",nr="OnePlus",me="Opera",mt="OPPO",ge="Samsung",or="Sharp",we="Sony",gt="Xiaomi",wt="Zebra",ir="Facebook",ar="Chromium OS",sr="Mac OS",cr=" Browser",Kr=function(v,x){var y={};for(var C in v)x[C]&&x[C].length%2===0?y[C]=x[C].concat(v[C]):y[C]=v[C];return y},Ne=function(v){for(var x={},y=0;y<v.length;y++)x[v[y].toUpperCase()]=v[y];return x},ur=function(v,x){return typeof v===d?he(x).indexOf(he(v))!==-1:!1},he=function(v){return v.toLowerCase()},Zr=function(v){return typeof v===d?v.replace(/[^\d\.]/g,o).split(".")[0]:t},ht=function(v,x){if(typeof v===d)return v=v.replace(/^\s\s*/,o),typeof x===c?v:v.substring(0,M)},be=function(v,x){for(var y=0,C,j,z,T,b,q;y<x.length&&!b;){var bt=x[y],fr=x[y+1];for(C=j=0;C<bt.length&&!b&&bt[C];)if(b=bt[C++].exec(v),b)for(z=0;z<fr.length;z++)q=b[++j],T=fr[z],typeof T===p&&T.length>0?T.length===2?typeof T[1]==u?this[T[0]]=T[1].call(this,q):this[T[0]]=T[1]:T.length===3?typeof T[1]===u&&!(T[1].exec&&T[1].test)?this[T[0]]=q?T[1].call(this,q,T[2]):t:this[T[0]]=q?q.replace(T[1],T[2]):t:T.length===4&&(this[T[0]]=q?T[3].call(this,q.replace(T[1],T[2])):t):this[T]=q||t;y+=2}},ye=function(v,x){for(var y in x)if(typeof x[y]===p&&x[y].length>0){for(var C=0;C<x[y].length;C++)if(ur(x[y][C],v))return y===n?t:y}else if(ur(x[y],v))return y===n?t:y;return x.hasOwnProperty("*")?x["*"]:v},en={"1.0":"/8","1.2":"/1","1.3":"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},lr={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2","8.1":"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},dr={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[f,[l,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[f,[l,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[l,f],[/opios[\/ ]+([\w\.]+)/i],[f,[l,me+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[f,[l,me+" GX"]],[/\bopr\/([\w\.]+)/i],[f,[l,me]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[f,[l,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[f,[l,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon)\/([-\w\.]+)/i,/(heytap|ovi|115)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[l,f],[/quark(?:pc)?\/([-\w\.]+)/i],[f,[l,"Quark"]],[/\bddg\/([\w\.]+)/i],[f,[l,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[f,[l,"UC"+Ve]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[f,[l,"WeChat"]],[/konqueror\/([\w\.]+)/i],[f,[l,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[f,[l,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[f,[l,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[f,[l,"Smart Lenovo "+Ve]],[/(avast|avg)\/([\w\.]+)/i],[[l,/(.+)/,"$1 Secure "+Ve],f],[/\bfocus\/([\w\.]+)/i],[f,[l,Le+" Focus"]],[/\bopt\/([\w\.]+)/i],[f,[l,me+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[f,[l,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[f,[l,"Dolphin"]],[/coast\/([\w\.]+)/i],[f,[l,me+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[f,[l,"MIUI"+cr]],[/fxios\/([\w\.-]+)/i],[f,[l,Le]],[/\bqihoobrowser\/?([\w\.]*)/i],[f,[l,"360"]],[/\b(qq)\/([\w\.]+)/i],[[l,/(.+)/,"$1Browser"],f],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[l,/(.+)/,"$1"+cr],f],[/samsungbrowser\/([\w\.]+)/i],[f,[l,ge+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[f,[l,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[l,"Sogou Mobile"],f],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[l,f],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[l],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[f,l],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[l,ir],f],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/(daum)apps[\/ ]([\w\.]+)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[l,f],[/\bgsa\/([\w\.]+) .*safari\//i],[f,[l,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[f,[l,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[f,[l,Oe+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[l,Oe+" WebView"],f],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[f,[l,"Android "+Ve]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[l,f],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[f,[l,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[f,l],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[l,[f,ye,en]],[/(webkit|khtml)\/([\w\.]+)/i],[l,f],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[l,"Netscape"],f],[/(wolvic|librewolf)\/([\w\.]+)/i],[l,f],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[f,[l,Le+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[l,[f,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[l,[f,/master.|lts./,""]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[_,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[_,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[_,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[_,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[_,"arm"]],[/((ppc|powerpc)(64)?)( mac|;|\))/i],[[_,/ower/,o,he]],[/ sun4\w[;\)]/i],[[_,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i],[[_,he]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[i,[s,ge],[a,m]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[i,[s,ge],[a,g]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[i,[s,G],[a,g]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[i,[s,G],[a,m]],[/(macintosh);/i],[i,[s,G]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[i,[s,or],[a,g]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[i,[s,tr],[a,m]],[/honor([-\w ]+)[;\)]/i],[i,[s,tr],[a,g]],[/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],[i,[s,rr],[a,m]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[i,[s,rr],[a,g]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[i,/_/g," "],[s,gt],[a,m]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i,/ ([\w ]+) miui\/v?\d/i],[[i,/_/g," "],[s,gt],[a,g]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[i,[s,mt],[a,g]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[i,[s,ye,{OnePlus:["304","403","203"],"*":mt}],[a,m]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[i,[s,"Vivo"],[a,g]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[i,[s,"Realme"],[a,g]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto(?! 360)[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[i,[s,ft],[a,g]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[i,[s,ft],[a,m]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[i,[s,De],[a,m]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv|watch)\w+)/i,/\blg-?([\d\w]+) bui/i],[i,[s,De],[a,g]],[/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],[i,[s,Xr],[a,m]],[/(nokia) (t[12][01])/i],[s,i,[a,m]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*))/i],[[i,/_/g," "],[a,g],[s,"Nokia"]],[/(pixel (c|tablet))\b/i],[i,[s,Be],[a,m]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[i,[s,Be],[a,g]],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[i,[s,we],[a,g]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[i,"Xperia Tablet"],[s,we],[a,m]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[i,[s,nr],[a,g]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[i,[s,D],[a,m]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[i,/(.+)/g,"Fire Phone $1"],[s,D],[a,g]],[/(playbook);[-\w\),; ]+(rim)/i],[i,s,[a,m]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[i,[s,pe],[a,g]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[i,[s,H],[a,m]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[i,[s,H],[a,g]],[/(nexus 9)/i],[i,[s,"HTC"],[a,m]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[s,[i,/_/g," "],[a,g]],[/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])\w*(\)| bui)/i],[i,[s,"TCL"],[a,m]],[/(itel) ((\w+))/i],[[s,he],i,[a,ye,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[i,[s,"Acer"],[a,m]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[i,[s,"Meizu"],[a,g]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[i,[s,"Ulefone"],[a,g]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[i,[s,"Energizer"],[a,g]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[i,[s,"Cat"],[a,g]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[i,[s,"Smartfren"],[a,g]],[/droid.+; (a(?:015|06[35]|142p?))/i],[i,[s,"Nothing"],[a,g]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[i,[s,"Archos"],[a,m]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[i,[s,"Archos"],[a,g]],[/(imo) (tab \w+)/i,/(infinix) (x1101b?)/i],[s,i,[a,m]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (hmd|imo) ([\w ]+?)(?: bui|\))/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i,/(oppo) ?([\w ]+) bui/i],[s,i,[a,g]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[s,i,[a,m]],[/(surface duo)/i],[i,[s,dt],[a,m]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[i,[s,"Fairphone"],[a,g]],[/(u304aa)/i],[i,[s,"AT&T"],[a,g]],[/\bsie-(\w*)/i],[i,[s,"Siemens"],[a,g]],[/\b(rct\w+) b/i],[i,[s,"RCA"],[a,m]],[/\b(venue[\d ]{2,7}) b/i],[i,[s,"Dell"],[a,m]],[/\b(q(?:mv|ta)\w+) b/i],[i,[s,"Verizon"],[a,m]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[i,[s,"Barnes & Noble"],[a,m]],[/\b(tm\d{3}\w+) b/i],[i,[s,"NuVision"],[a,m]],[/\b(k88) b/i],[i,[s,"ZTE"],[a,m]],[/\b(nx\d{3}j) b/i],[i,[s,"ZTE"],[a,g]],[/\b(gen\d{3}) b.+49h/i],[i,[s,"Swiss"],[a,g]],[/\b(zur\d{3}) b/i],[i,[s,"Swiss"],[a,m]],[/\b((zeki)?tb.*\b) b/i],[i,[s,"Zeki"],[a,m]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[s,"Dragon Touch"],i,[a,m]],[/\b(ns-?\w{0,9}) b/i],[i,[s,"Insignia"],[a,m]],[/\b((nxa|next)-?\w{0,9}) b/i],[i,[s,"NextBook"],[a,m]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[s,"Voice"],i,[a,g]],[/\b(lvtel\-)?(v1[12]) b/i],[[s,"LvTel"],i,[a,g]],[/\b(ph-1) /i],[i,[s,"Essential"],[a,g]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[i,[s,"Envizen"],[a,m]],[/\b(trio[-\w\. ]+) b/i],[i,[s,"MachSpeed"],[a,m]],[/\btu_(1491) b/i],[i,[s,"Rotor"],[a,m]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[i,[s,pt],[a,m]],[/(sprint) (\w+)/i],[s,i,[a,g]],[/(kin\.[onetw]{3})/i],[[i,/\./g," "],[s,dt],[a,g]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[i,[s,wt],[a,m]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[i,[s,wt],[a,g]],[/smart-tv.+(samsung)/i],[s,[a,h]],[/hbbtv.+maple;(\d+)/i],[[i,/^/,"SmartTV"],[s,ge],[a,h]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[s,De],[a,h]],[/(apple) ?tv/i],[s,[i,G+" TV"],[a,h]],[/crkey/i],[[i,Oe+"cast"],[s,Be],[a,h]],[/droid.+aft(\w+)( bui|\))/i],[i,[s,D],[a,h]],[/(shield \w+ tv)/i],[i,[s,pt],[a,h]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[i,[s,or],[a,h]],[/(bravia[\w ]+)( bui|\))/i],[i,[s,we],[a,h]],[/(mi(tv|box)-?\w+) bui/i],[i,[s,gt],[a,h]],[/Hbbtv.*(technisat) (.*);/i],[s,i,[a,h]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[s,ht],[i,ht],[a,h]],[/droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i],[i,[a,h]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[a,h]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[s,i,[a,k]],[/droid.+; (shield)( bui|\))/i],[i,[s,pt],[a,k]],[/(playstation \w+)/i],[i,[s,we],[a,k]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[i,[s,dt],[a,k]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[i,[s,ge],[a,P]],[/((pebble))app/i,/(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[s,i,[a,P]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[i,[s,mt],[a,P]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[i,[s,G],[a,P]],[/(opwwe\d{3})/i],[i,[s,nr],[a,P]],[/(moto 360)/i],[i,[s,ft],[a,P]],[/(smartwatch 3)/i],[i,[s,we],[a,P]],[/(g watch r)/i],[i,[s,De],[a,P]],[/droid.+; (wt63?0{2,3})\)/i],[i,[s,wt],[a,P]],[/droid.+; (glass) \d/i],[i,[s,Be],[a,P]],[/(pico) (4|neo3(?: link|pro)?)/i],[s,i,[a,P]],[/; (quest( \d| pro)?)/i],[i,[s,ir],[a,P]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[s,[a,L]],[/(aeobc)\b/i],[i,[s,D],[a,L]],[/(homepod).+mac os/i],[i,[s,G],[a,L]],[/windows iot/i],[[a,L]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[i,[a,g]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[i,[a,m]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[a,m]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[a,g]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[i,[s,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[f,[l,Qr+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[l,f],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[f,[l,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[l,f],[/ladybird\//i],[[l,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[f,l]],os:[[/microsoft (windows) (vista|xp)/i],[l,f],[/(windows (?:phone(?: os)?|mobile|iot))[\/ ]?([\d\.\w ]*)/i],[l,[f,ye,lr]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[f,ye,lr],[l,"Windows"]],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[f,/_/g,"."],[l,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[l,sr],[f,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[f,l],[/(ubuntu) ([\w\.]+) like android/i],[[l,/(.+)/,"$1 Touch"],f],[/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen|webos)\w*[-\/; ]?([\d\.]*)/i],[l,f],[/\(bb(10);/i],[f,[l,pe]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[f,[l,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[f,[l,Le+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[f,[l,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[f,[l,"watchOS"]],[/crkey\/([\d\.]+)/i],[f,[l,Oe+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[l,ar],f],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux)(?: arm\w*| x86\w*| ?)([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[l,f],[/(sunos) ?([\w\.\d]*)/i],[[l,"Solaris"],f],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[l,f]]},O=function(v,x){if(typeof v===p&&(x=v,v=t),!(this instanceof O))return new O(v,x).getResult();var y=typeof e!==c&&e.navigator?e.navigator:t,C=v||(y&&y.userAgent?y.userAgent:o),j=y&&y.userAgentData?y.userAgentData:t,z=x?Kr(dr,x):dr,T=y&&y.userAgent==C;return this.getBrowser=function(){var b={};return b[l]=t,b[f]=t,be.call(b,C,z.browser),b[w]=Zr(b[f]),T&&y&&y.brave&&typeof y.brave.isBrave==u&&(b[l]="Brave"),b},this.getCPU=function(){var b={};return b[_]=t,be.call(b,C,z.cpu),b},this.getDevice=function(){var b={};return b[s]=t,b[i]=t,b[a]=t,be.call(b,C,z.device),T&&!b[a]&&j&&j.mobile&&(b[a]=g),T&&b[i]=="Macintosh"&&y&&typeof y.standalone!==c&&y.maxTouchPoints&&y.maxTouchPoints>2&&(b[i]="iPad",b[a]=m),b},this.getEngine=function(){var b={};return b[l]=t,b[f]=t,be.call(b,C,z.engine),b},this.getOS=function(){var b={};return b[l]=t,b[f]=t,be.call(b,C,z.os),T&&!b[l]&&j&&j.platform&&j.platform!="Unknown"&&(b[l]=j.platform.replace(/chrome os/i,ar).replace(/macos/i,sr)),b},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return C},this.setUA=function(b){return C=typeof b===d&&b.length>M?ht(b,M):b,this},this.setUA(C),this};O.VERSION=r,O.BROWSER=Ne([l,f,w]),O.CPU=Ne([_]),O.DEVICE=Ne([i,s,a,k,g,h,m,P,L]),O.ENGINE=O.OS=Ne([l,f]),typeof _e!==c?(typeof je!==c&&je.exports&&(_e=je.exports=O),_e.UAParser=O):typeof define===u&&define.amd?define(function(){return O}):typeof e!==c&&(e.UAParser=O);var oe=typeof e!==c&&(e.jQuery||e.Zepto);if(oe&&!oe.ua){var Me=new O;oe.ua=Me.getResult(),oe.ua.get=function(){return Me.getUA()},oe.ua.set=function(v){Me.setUA(v);var x=Me.getResult();for(var y in x)oe.ua[y]=x[y]}}})(typeof window=="object"?window:_e)});function ie(){try{if(typeof window<"u"&&window.crypto&&window.crypto.getRandomValues){let e=new Uint8Array(16);window.crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=Array.from(e).map(r=>r.toString(16).padStart(2,"0"));return[t.slice(0,4).join(""),t.slice(4,6).join(""),t.slice(6,8).join(""),t.slice(8,10).join(""),t.slice(10,16).join("")].join("-")}}catch(e){console.warn("[ElevateAB] Crypto UUID generation failed, falling back to Math.random()",e)}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function B(e,t){if(typeof document>"u")return;let r=new Date;r.setTime(r.getTime()+365*24*60*60*1e3);let o="; expires="+r.toUTCString();document.cookie=e+"="+(t||"")+o+"; path=/"}function I(e){if(typeof document>"u")return null;let t=e+"=",r=document.cookie.split(";");for(let o=0;o<r.length;o++){let n=r[o];for(;n.charAt(0)===" ";)n=n.substring(1,n.length);if(n.indexOf(t)===0)return n.substring(t.length,n.length)}return null}function V(e){let t=I(e);if(t)try{return JSON.parse(t)}catch(r){return console.error("[ElevateAB] Error parsing JSON from cookie",r),null}return null}function ae(e,t){typeof sessionStorage>"u"||(typeof t=="string"?sessionStorage.setItem(e,t):sessionStorage.setItem(e,JSON.stringify(t)))}function te(e){if(typeof sessionStorage>"u")return null;let t=sessionStorage.getItem(e);if(t&&t.length>=2&&t.startsWith('"')&&t.endsWith('"'))try{let r=JSON.parse(t);if(typeof r=="string")return sessionStorage.setItem(e,r),r}catch{}return t}function Tt(e){let t=te(e);return t?JSON.parse(t):null}function br(){let e=I("eabUserId");return e||(e=ie(),B("eabUserId",e)),e}function se(){return br()}function yr(){let e=te("eabSessionId");return e||(e=ie(),ae("eabSessionId",e)),e}function Qe(){return yr()}function Xe(){return{referrer:te("eabReferrer")||"",entryPage:te("eabEntry")||""}}var N=ee(()=>{"use strict"});function mn(e){let t={},r={};if(!e)return{assignments:t,views:r};let o=e.split("~");for(let n of o){let u=n.split("_");if(u.length>=2){let c=u[0],p=u[1],d=u[2]==="1";t[c]=p,r[c]=d}}return{assignments:t,views:r}}function $(){if(typeof window>"u")return{isPreview:!1,previewTestId:null,forcedAssignments:{},previewedViews:{}};let e=new URLSearchParams(window.location.search),r=(e.get("eabUserPreview")||I("eabUserPreview"))==="true",o=e.get("abtid");o||(o=te("eabPreviewTestId"));let n=e.get("eab_tests")||"",{assignments:u,views:c}=mn(n);return e.has("eabUserPreview")&&B("eabUserPreview","true"),e.has("abtid")&&o&&ae("eabPreviewTestId",o),{isPreview:r,previewTestId:o,forcedAssignments:u,previewedViews:c}}function Ct(e,t){if(!t.isPreview)return null;if(t.forcedAssignments[e])return t.forcedAssignments[e];let r=e.slice(-5);return t.forcedAssignments[r]?t.forcedAssignments[r]:null}function Pt(){if(!(typeof document>"u")&&(document.cookie="eabUserPreview=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;",typeof sessionStorage<"u"&&sessionStorage.removeItem("eabPreviewTestId"),typeof window<"u")){let e=new URL(window.location.href);e.searchParams.delete("eabUserPreview"),e.searchParams.delete("abtid"),e.searchParams.delete("eab_tests"),window.history.replaceState({},"",e.toString())}}function Et(){return $().isPreview}var ke=ee(()=>{"use strict";N()});function vr(e){let t=V("ABAU")||{};t[e]||(t[e]=!0,B("ABAU",JSON.stringify(t)))}function _r(e){let t=Tt("ABAV")||{};t[e]||(t[e]=!0,ae("ABAV",t))}function xe(e){vr(e),_r(e)}var Ke=ee(()=>{"use strict";N()});function re(){return V("ABTL")||{}}function Tr(e){B("ABTL",JSON.stringify(e))}function F(e){return re()[e]||null}function Cr(e,t){if(e[t]?.isControl)return-1;let o=0;for(let n=0;n<t;n++)e[n]?.isControl||o++;return o}function gn(e,t){let r=e.every(i=>typeof i.weight=="number"),o=[],n=0;if(r)for(let i of e)n+=i.weight,o.push(n);else{let i=100/e.length;for(let l=0;l<e.length;l++)n+=i,o.push(n)}let c=vt(t)%1e4/100,p=0;for(let i=0;i<o.length;i++)if(c<o[i]){p=i;break}let d=e[p]||e[0],w=Cr(e,p);return{...d,isA:w===0,isB:w===1,isC:w===2,isD:w===3}}function kr(e,t){let r=t.findIndex(n=>n.id===e.id),o=Cr(t,r);return{...e,isA:o===0,isB:o===1,isC:o===2,isD:o===3}}function Pr(e,t,r,o){if(o?.isPreview){let w=Ct(e,o);if(w){let i=t.variations.find(l=>l.id===w);if(i)return kr(i,t.variations)}}let n=F(e);if(n){let w=t.variations.find(i=>i.id===n);if(w)return kr(w,t.variations)}let u=t.variations.filter(w=>!w.isDone);if(u.length===0)return null;let c=t.isPersonalization,p;c?p=u.find(i=>!i.isControl)||u[0]:p=gn(u,r);let d=re();return d[e]=p.id,Tr(d),xe(e),p}function xr(e){return typeof e.testTrafficPercentage=="number"}function At(e,t){let r=se(),o=e.tests,n=re();for(let u of o){if(!u.enabled||n[u.testId]||!wn(u.testId,o,n))continue;let c=u.testTrafficPercentage;!t?.isPreview&&typeof c=="number"&&Math.random()*100>=c||(Pr(u.testId,u,r,t??void 0),n=re())}}function wn(e,t,r){let o=Object.keys(r);if(o.length===0)return!0;if(o.some(c=>{let p=t.find(d=>d.testId===c);return p&&xr(p)}))return!1;let u=t.find(c=>c.testId===e);return u?!xr(u):!0}var J=ee(()=>{"use strict";N();Fe();ke();Ke()});var Ze,St=ee(()=>{"use strict";Ze=`#graphql
|
|
2
|
+
"use strict";var tn=Object.create;var He=Object.defineProperty;var rn=Object.getOwnPropertyDescriptor;var nn=Object.getOwnPropertyNames;var on=Object.getPrototypeOf,an=Object.prototype.hasOwnProperty;var te=(e,t)=>()=>(e&&(t=e(e=0)),t);var sn=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),mr=(e,t)=>{for(var r in t)He(e,r,{get:t[r],enumerable:!0})},gr=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of nn(t))!an.call(e,n)&&n!==r&&He(e,n,{get:()=>t[n],enumerable:!(o=rn(t,n))||o.enumerable});return e};var ze=(e,t,r)=>(r=e!=null?tn(on(e)):{},gr(t||!e||!e.__esModule?He(r,"default",{value:e,enumerable:!0}):r,e)),cn=e=>gr(He({},"__esModule",{value:!0}),e);function _t(e){let t=0;for(let r=0;r<e.length;r++){let o=e.charCodeAt(r);t=(t<<5)-t+o,t=t&t}return Math.abs(t)}function wr(e){let t=[];for(let[r,o]of Object.entries(e.allTests)){if(!o.data.isLive)continue;let n=[],s=0;for(let[u,p]of Object.entries(o)){if(u==="data")continue;let d=p;if(typeof d=="object"&&d!==null&&"variationName"in d){let w=!!d.isControl,i=d.content,l;i&&typeof i=="object"&&(l={changes:i.changes||[],elements:i.elements||[],blocks:i.blocks||[],customCodes:i.customCodes||[]});let a=d.customCode,c;a&&typeof a=="object"&&a.id&&(c={id:a.id,js:a.js,css:a.css,pathnames:a.pathnames||[],excludePathnames:a.excludePathnames}),n.push({id:u,name:d.variationName,weight:d.trafficPercentage,isControl:w,productId:d.id,handle:d.handle,price:d.price,prices:d.prices,splitUrlTestLinks:d.splitUrlTestLinks,content:l,customCode:c,isA:!w&&s===0,isB:!w&&s===1,isC:!w&&s===2,isD:!w&&s===3}),w||s++}}n.length>0&&t.push({testId:r,name:o.data.name,enabled:o.data.isLive,type:o.data.type,variations:n,data:o.data})}return{tests:t,selectors:e.selectors}}var Fe=te(()=>{"use strict"});var hr=sn((_e,je)=>{"use strict";(function(e,t){"use strict";var r="1.0.41",o="",n="?",s="function",u="undefined",p="object",d="string",w="major",i="model",l="name",a="type",c="vendor",f="version",_="architecture",k="console",g="mobile",m="tablet",h="smarttv",P="wearable",L="embedded",M=500,D="Amazon",G="Apple",H="ASUS",pe="BlackBerry",Ve="Browser",Oe="Chrome",Qr="Edge",Le="Firefox",Be="Google",rr="Honor",nr="Huawei",Xr="Lenovo",De="LG",ft="Microsoft",pt="Motorola",mt="Nvidia",or="OnePlus",me="Opera",gt="OPPO",ge="Samsung",ir="Sharp",we="Sony",wt="Xiaomi",ht="Zebra",ar="Facebook",sr="Chromium OS",cr="Mac OS",ur=" Browser",Kr=function(v,x){var y={};for(var C in v)x[C]&&x[C].length%2===0?y[C]=x[C].concat(v[C]):y[C]=v[C];return y},Ne=function(v){for(var x={},y=0;y<v.length;y++)x[v[y].toUpperCase()]=v[y];return x},lr=function(v,x){return typeof v===d?he(x).indexOf(he(v))!==-1:!1},he=function(v){return v.toLowerCase()},Zr=function(v){return typeof v===d?v.replace(/[^\d\.]/g,o).split(".")[0]:t},bt=function(v,x){if(typeof v===d)return v=v.replace(/^\s\s*/,o),typeof x===u?v:v.substring(0,M)},be=function(v,x){for(var y=0,C,j,z,T,b,q;y<x.length&&!b;){var yt=x[y],pr=x[y+1];for(C=j=0;C<yt.length&&!b&&yt[C];)if(b=yt[C++].exec(v),b)for(z=0;z<pr.length;z++)q=b[++j],T=pr[z],typeof T===p&&T.length>0?T.length===2?typeof T[1]==s?this[T[0]]=T[1].call(this,q):this[T[0]]=T[1]:T.length===3?typeof T[1]===s&&!(T[1].exec&&T[1].test)?this[T[0]]=q?T[1].call(this,q,T[2]):t:this[T[0]]=q?q.replace(T[1],T[2]):t:T.length===4&&(this[T[0]]=q?T[3].call(this,q.replace(T[1],T[2])):t):this[T]=q||t;y+=2}},ye=function(v,x){for(var y in x)if(typeof x[y]===p&&x[y].length>0){for(var C=0;C<x[y].length;C++)if(lr(x[y][C],v))return y===n?t:y}else if(lr(x[y],v))return y===n?t:y;return x.hasOwnProperty("*")?x["*"]:v},en={"1.0":"/8","1.2":"/1","1.3":"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},dr={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2","8.1":"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},fr={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[f,[l,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[f,[l,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[l,f],[/opios[\/ ]+([\w\.]+)/i],[f,[l,me+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[f,[l,me+" GX"]],[/\bopr\/([\w\.]+)/i],[f,[l,me]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[f,[l,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[f,[l,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon)\/([-\w\.]+)/i,/(heytap|ovi|115)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[l,f],[/quark(?:pc)?\/([-\w\.]+)/i],[f,[l,"Quark"]],[/\bddg\/([\w\.]+)/i],[f,[l,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[f,[l,"UC"+Ve]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[f,[l,"WeChat"]],[/konqueror\/([\w\.]+)/i],[f,[l,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[f,[l,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[f,[l,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[f,[l,"Smart Lenovo "+Ve]],[/(avast|avg)\/([\w\.]+)/i],[[l,/(.+)/,"$1 Secure "+Ve],f],[/\bfocus\/([\w\.]+)/i],[f,[l,Le+" Focus"]],[/\bopt\/([\w\.]+)/i],[f,[l,me+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[f,[l,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[f,[l,"Dolphin"]],[/coast\/([\w\.]+)/i],[f,[l,me+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[f,[l,"MIUI"+ur]],[/fxios\/([\w\.-]+)/i],[f,[l,Le]],[/\bqihoobrowser\/?([\w\.]*)/i],[f,[l,"360"]],[/\b(qq)\/([\w\.]+)/i],[[l,/(.+)/,"$1Browser"],f],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[l,/(.+)/,"$1"+ur],f],[/samsungbrowser\/([\w\.]+)/i],[f,[l,ge+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[f,[l,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[l,"Sogou Mobile"],f],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[l,f],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[l],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[f,l],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[l,ar],f],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/(daum)apps[\/ ]([\w\.]+)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[l,f],[/\bgsa\/([\w\.]+) .*safari\//i],[f,[l,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[f,[l,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[f,[l,Oe+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[l,Oe+" WebView"],f],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[f,[l,"Android "+Ve]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[l,f],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[f,[l,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[f,l],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[l,[f,ye,en]],[/(webkit|khtml)\/([\w\.]+)/i],[l,f],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[l,"Netscape"],f],[/(wolvic|librewolf)\/([\w\.]+)/i],[l,f],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[f,[l,Le+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[l,[f,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[l,[f,/master.|lts./,""]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[_,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[_,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[_,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[_,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[_,"arm"]],[/((ppc|powerpc)(64)?)( mac|;|\))/i],[[_,/ower/,o,he]],[/ sun4\w[;\)]/i],[[_,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i],[[_,he]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[i,[c,ge],[a,m]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[i,[c,ge],[a,g]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[i,[c,G],[a,g]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[i,[c,G],[a,m]],[/(macintosh);/i],[i,[c,G]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[i,[c,ir],[a,g]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[i,[c,rr],[a,m]],[/honor([-\w ]+)[;\)]/i],[i,[c,rr],[a,g]],[/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],[i,[c,nr],[a,m]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[i,[c,nr],[a,g]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[i,/_/g," "],[c,wt],[a,m]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i,/ ([\w ]+) miui\/v?\d/i],[[i,/_/g," "],[c,wt],[a,g]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[i,[c,gt],[a,g]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[i,[c,ye,{OnePlus:["304","403","203"],"*":gt}],[a,m]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[i,[c,"Vivo"],[a,g]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[i,[c,"Realme"],[a,g]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto(?! 360)[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[i,[c,pt],[a,g]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[i,[c,pt],[a,m]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[i,[c,De],[a,m]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv|watch)\w+)/i,/\blg-?([\d\w]+) bui/i],[i,[c,De],[a,g]],[/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],[i,[c,Xr],[a,m]],[/(nokia) (t[12][01])/i],[c,i,[a,m]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*))/i],[[i,/_/g," "],[a,g],[c,"Nokia"]],[/(pixel (c|tablet))\b/i],[i,[c,Be],[a,m]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[i,[c,Be],[a,g]],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[i,[c,we],[a,g]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[i,"Xperia Tablet"],[c,we],[a,m]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[i,[c,or],[a,g]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[i,[c,D],[a,m]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[i,/(.+)/g,"Fire Phone $1"],[c,D],[a,g]],[/(playbook);[-\w\),; ]+(rim)/i],[i,c,[a,m]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[i,[c,pe],[a,g]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[i,[c,H],[a,m]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[i,[c,H],[a,g]],[/(nexus 9)/i],[i,[c,"HTC"],[a,m]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[c,[i,/_/g," "],[a,g]],[/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])\w*(\)| bui)/i],[i,[c,"TCL"],[a,m]],[/(itel) ((\w+))/i],[[c,he],i,[a,ye,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[i,[c,"Acer"],[a,m]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[i,[c,"Meizu"],[a,g]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[i,[c,"Ulefone"],[a,g]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[i,[c,"Energizer"],[a,g]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[i,[c,"Cat"],[a,g]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[i,[c,"Smartfren"],[a,g]],[/droid.+; (a(?:015|06[35]|142p?))/i],[i,[c,"Nothing"],[a,g]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[i,[c,"Archos"],[a,m]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[i,[c,"Archos"],[a,g]],[/(imo) (tab \w+)/i,/(infinix) (x1101b?)/i],[c,i,[a,m]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (hmd|imo) ([\w ]+?)(?: bui|\))/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i,/(oppo) ?([\w ]+) bui/i],[c,i,[a,g]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[c,i,[a,m]],[/(surface duo)/i],[i,[c,ft],[a,m]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[i,[c,"Fairphone"],[a,g]],[/(u304aa)/i],[i,[c,"AT&T"],[a,g]],[/\bsie-(\w*)/i],[i,[c,"Siemens"],[a,g]],[/\b(rct\w+) b/i],[i,[c,"RCA"],[a,m]],[/\b(venue[\d ]{2,7}) b/i],[i,[c,"Dell"],[a,m]],[/\b(q(?:mv|ta)\w+) b/i],[i,[c,"Verizon"],[a,m]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[i,[c,"Barnes & Noble"],[a,m]],[/\b(tm\d{3}\w+) b/i],[i,[c,"NuVision"],[a,m]],[/\b(k88) b/i],[i,[c,"ZTE"],[a,m]],[/\b(nx\d{3}j) b/i],[i,[c,"ZTE"],[a,g]],[/\b(gen\d{3}) b.+49h/i],[i,[c,"Swiss"],[a,g]],[/\b(zur\d{3}) b/i],[i,[c,"Swiss"],[a,m]],[/\b((zeki)?tb.*\b) b/i],[i,[c,"Zeki"],[a,m]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[c,"Dragon Touch"],i,[a,m]],[/\b(ns-?\w{0,9}) b/i],[i,[c,"Insignia"],[a,m]],[/\b((nxa|next)-?\w{0,9}) b/i],[i,[c,"NextBook"],[a,m]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[c,"Voice"],i,[a,g]],[/\b(lvtel\-)?(v1[12]) b/i],[[c,"LvTel"],i,[a,g]],[/\b(ph-1) /i],[i,[c,"Essential"],[a,g]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[i,[c,"Envizen"],[a,m]],[/\b(trio[-\w\. ]+) b/i],[i,[c,"MachSpeed"],[a,m]],[/\btu_(1491) b/i],[i,[c,"Rotor"],[a,m]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[i,[c,mt],[a,m]],[/(sprint) (\w+)/i],[c,i,[a,g]],[/(kin\.[onetw]{3})/i],[[i,/\./g," "],[c,ft],[a,g]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[i,[c,ht],[a,m]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[i,[c,ht],[a,g]],[/smart-tv.+(samsung)/i],[c,[a,h]],[/hbbtv.+maple;(\d+)/i],[[i,/^/,"SmartTV"],[c,ge],[a,h]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[c,De],[a,h]],[/(apple) ?tv/i],[c,[i,G+" TV"],[a,h]],[/crkey/i],[[i,Oe+"cast"],[c,Be],[a,h]],[/droid.+aft(\w+)( bui|\))/i],[i,[c,D],[a,h]],[/(shield \w+ tv)/i],[i,[c,mt],[a,h]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[i,[c,ir],[a,h]],[/(bravia[\w ]+)( bui|\))/i],[i,[c,we],[a,h]],[/(mi(tv|box)-?\w+) bui/i],[i,[c,wt],[a,h]],[/Hbbtv.*(technisat) (.*);/i],[c,i,[a,h]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[c,bt],[i,bt],[a,h]],[/droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i],[i,[a,h]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[a,h]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[c,i,[a,k]],[/droid.+; (shield)( bui|\))/i],[i,[c,mt],[a,k]],[/(playstation \w+)/i],[i,[c,we],[a,k]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[i,[c,ft],[a,k]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[i,[c,ge],[a,P]],[/((pebble))app/i,/(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[c,i,[a,P]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[i,[c,gt],[a,P]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[i,[c,G],[a,P]],[/(opwwe\d{3})/i],[i,[c,or],[a,P]],[/(moto 360)/i],[i,[c,pt],[a,P]],[/(smartwatch 3)/i],[i,[c,we],[a,P]],[/(g watch r)/i],[i,[c,De],[a,P]],[/droid.+; (wt63?0{2,3})\)/i],[i,[c,ht],[a,P]],[/droid.+; (glass) \d/i],[i,[c,Be],[a,P]],[/(pico) (4|neo3(?: link|pro)?)/i],[c,i,[a,P]],[/; (quest( \d| pro)?)/i],[i,[c,ar],[a,P]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[c,[a,L]],[/(aeobc)\b/i],[i,[c,D],[a,L]],[/(homepod).+mac os/i],[i,[c,G],[a,L]],[/windows iot/i],[[a,L]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[i,[a,g]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[i,[a,m]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[a,m]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[a,g]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[i,[c,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[f,[l,Qr+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[l,f],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[f,[l,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[l,f],[/ladybird\//i],[[l,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[f,l]],os:[[/microsoft (windows) (vista|xp)/i],[l,f],[/(windows (?:phone(?: os)?|mobile|iot))[\/ ]?([\d\.\w ]*)/i],[l,[f,ye,dr]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[f,ye,dr],[l,"Windows"]],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[f,/_/g,"."],[l,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[l,cr],[f,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[f,l],[/(ubuntu) ([\w\.]+) like android/i],[[l,/(.+)/,"$1 Touch"],f],[/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen|webos)\w*[-\/; ]?([\d\.]*)/i],[l,f],[/\(bb(10);/i],[f,[l,pe]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[f,[l,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[f,[l,Le+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[f,[l,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[f,[l,"watchOS"]],[/crkey\/([\d\.]+)/i],[f,[l,Oe+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[l,sr],f],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux)(?: arm\w*| x86\w*| ?)([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[l,f],[/(sunos) ?([\w\.\d]*)/i],[[l,"Solaris"],f],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[l,f]]},O=function(v,x){if(typeof v===p&&(x=v,v=t),!(this instanceof O))return new O(v,x).getResult();var y=typeof e!==u&&e.navigator?e.navigator:t,C=v||(y&&y.userAgent?y.userAgent:o),j=y&&y.userAgentData?y.userAgentData:t,z=x?Kr(fr,x):fr,T=y&&y.userAgent==C;return this.getBrowser=function(){var b={};return b[l]=t,b[f]=t,be.call(b,C,z.browser),b[w]=Zr(b[f]),T&&y&&y.brave&&typeof y.brave.isBrave==s&&(b[l]="Brave"),b},this.getCPU=function(){var b={};return b[_]=t,be.call(b,C,z.cpu),b},this.getDevice=function(){var b={};return b[c]=t,b[i]=t,b[a]=t,be.call(b,C,z.device),T&&!b[a]&&j&&j.mobile&&(b[a]=g),T&&b[i]=="Macintosh"&&y&&typeof y.standalone!==u&&y.maxTouchPoints&&y.maxTouchPoints>2&&(b[i]="iPad",b[a]=m),b},this.getEngine=function(){var b={};return b[l]=t,b[f]=t,be.call(b,C,z.engine),b},this.getOS=function(){var b={};return b[l]=t,b[f]=t,be.call(b,C,z.os),T&&!b[l]&&j&&j.platform&&j.platform!="Unknown"&&(b[l]=j.platform.replace(/chrome os/i,sr).replace(/macos/i,cr)),b},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return C},this.setUA=function(b){return C=typeof b===d&&b.length>M?bt(b,M):b,this},this.setUA(C),this};O.VERSION=r,O.BROWSER=Ne([l,f,w]),O.CPU=Ne([_]),O.DEVICE=Ne([i,c,a,k,g,h,m,P,L]),O.ENGINE=O.OS=Ne([l,f]),typeof _e!==u?(typeof je!==u&&je.exports&&(_e=je.exports=O),_e.UAParser=O):typeof define===s&&define.amd?define(function(){return O}):typeof e!==u&&(e.UAParser=O);var oe=typeof e!==u&&(e.jQuery||e.Zepto);if(oe&&!oe.ua){var Me=new O;oe.ua=Me.getResult(),oe.ua.get=function(){return Me.getUA()},oe.ua.set=function(v){Me.setUA(v);var x=Me.getResult();for(var y in x)oe.ua[y]=x[y]}}})(typeof window=="object"?window:_e)});function ie(){try{if(typeof window<"u"&&window.crypto&&window.crypto.getRandomValues){let e=new Uint8Array(16);window.crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=Array.from(e).map(r=>r.toString(16).padStart(2,"0"));return[t.slice(0,4).join(""),t.slice(4,6).join(""),t.slice(6,8).join(""),t.slice(8,10).join(""),t.slice(10,16).join("")].join("-")}}catch(e){console.warn("[ElevateAB] Crypto UUID generation failed, falling back to Math.random()",e)}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function B(e,t){if(typeof document>"u")return;let r=new Date;r.setTime(r.getTime()+365*24*60*60*1e3);let o="; expires="+r.toUTCString();document.cookie=e+"="+(t||"")+o+"; path=/"}function I(e){if(typeof document>"u")return null;let t=e+"=",r=document.cookie.split(";");for(let o=0;o<r.length;o++){let n=r[o];for(;n.charAt(0)===" ";)n=n.substring(1,n.length);if(n.indexOf(t)===0)return n.substring(t.length,n.length)}return null}function V(e){let t=I(e);if(t)try{return JSON.parse(t)}catch(r){return console.error("[ElevateAB] Error parsing JSON from cookie",r),null}return null}function ae(e,t){typeof sessionStorage>"u"||(typeof t=="string"?sessionStorage.setItem(e,t):sessionStorage.setItem(e,JSON.stringify(t)))}function re(e){if(typeof sessionStorage>"u")return null;let t=sessionStorage.getItem(e);if(t&&t.length>=2&&t.startsWith('"')&&t.endsWith('"'))try{let r=JSON.parse(t);if(typeof r=="string")return sessionStorage.setItem(e,r),r}catch{}return t}function Ct(e){let t=re(e);return t?JSON.parse(t):null}function yr(){let e=I("eabUserId");return e||(e=ie(),B("eabUserId",e)),e}function se(){return yr()}function vr(){let e=re("eabSessionId");return e||(e=ie(),ae("eabSessionId",e)),e}function Qe(){return vr()}function Xe(){return{referrer:re("eabReferrer")||"",entryPage:re("eabEntry")||""}}var N=te(()=>{"use strict"});function mn(e){let t={},r={};if(!e)return{assignments:t,views:r};let o=e.split("~");for(let n of o){let s=n.split("_");if(s.length>=2){let u=s[0],p=s[1],d=s[2]==="1";t[u]=p,r[u]=d}}return{assignments:t,views:r}}function $(){if(typeof window>"u")return{isPreview:!1,previewTestId:null,forcedAssignments:{},previewedViews:{}};let e=new URLSearchParams(window.location.search),r=(e.get("eabUserPreview")||I("eabUserPreview"))==="true",o=e.get("abtid");o||(o=re("eabPreviewTestId"));let n=e.get("eab_tests")||"",{assignments:s,views:u}=mn(n);return e.has("eabUserPreview")&&B("eabUserPreview","true"),e.has("abtid")&&o&&ae("eabPreviewTestId",o),{isPreview:r,previewTestId:o,forcedAssignments:s,previewedViews:u}}function Ke(e,t){if(!t.isPreview)return null;if(t.forcedAssignments[e])return t.forcedAssignments[e];let r=e.slice(-5);return t.forcedAssignments[r]?t.forcedAssignments[r]:null}function Pt(){if(!(typeof document>"u")&&(document.cookie="eabUserPreview=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;",typeof sessionStorage<"u"&&sessionStorage.removeItem("eabPreviewTestId"),typeof window<"u")){let e=new URL(window.location.href);e.searchParams.delete("eabUserPreview"),e.searchParams.delete("abtid"),e.searchParams.delete("eab_tests"),window.history.replaceState({},"",e.toString())}}function Et(){return $().isPreview}var ke=te(()=>{"use strict";N()});function _r(e){let t=V("ABAU")||{};t[e]||(t[e]=!0,B("ABAU",JSON.stringify(t)))}function kr(e){let t=Ct("ABAV")||{};t[e]||(t[e]=!0,ae("ABAV",t))}function xe(e){_r(e),kr(e)}var Ze=te(()=>{"use strict";N()});function J(){return V("ABTL")||{}}function At(e){B("ABTL",JSON.stringify(e))}function F(e){return J()[e]||null}function Cr(e,t){if(e[t]?.isControl)return-1;let o=0;for(let n=0;n<t;n++)e[n]?.isControl||o++;return o}function gn(e,t){let r=e.every(i=>typeof i.weight=="number"),o=[],n=0;if(r)for(let i of e)n+=i.weight,o.push(n);else{let i=100/e.length;for(let l=0;l<e.length;l++)n+=i,o.push(n)}let u=_t(t)%1e4/100,p=0;for(let i=0;i<o.length;i++)if(u<o[i]){p=i;break}let d=e[p]||e[0],w=Cr(e,p);return{...d,isA:w===0,isB:w===1,isC:w===2,isD:w===3}}function xr(e,t){let r=t.findIndex(n=>n.id===e.id),o=Cr(t,r);return{...e,isA:o===0,isB:o===1,isC:o===2,isD:o===3}}function Pr(e,t,r,o){if(o?.isPreview){let w=Ke(e,o);if(w){let i=t.variations.find(l=>l.id===w);if(i){let l=J();return l[e]=i.id,At(l),xr(i,t.variations)}}}let n=F(e);if(n){let w=t.variations.find(i=>i.id===n);if(w)return xr(w,t.variations)}let s=t.variations.filter(w=>!w.isDone);if(s.length===0)return null;let u=t.isPersonalization,p;u?p=s.find(i=>!i.isControl)||s[0]:p=gn(s,r);let d=J();return d[e]=p.id,At(d),xe(e),p}function Tr(e){return typeof e.testTrafficPercentage=="number"}function St(e,t){let r=se(),o=e.tests,n=J();for(let s of o){if(!s.enabled)continue;if(n[s.testId])if(t?.isPreview){let p=Ke(s.testId,t);if(!p||p===n[s.testId])continue}else continue;if(!wn(s.testId,o,n))continue;let u=s.testTrafficPercentage;!t?.isPreview&&typeof u=="number"&&Math.random()*100>=u||(Pr(s.testId,s,r,t??void 0),n=J())}}function wn(e,t,r){let o=Object.keys(r);if(o.length===0)return!0;if(o.some(u=>{let p=t.find(d=>d.testId===u);return p&&Tr(p)}))return!1;let s=t.find(u=>u.testId===e);return s?!Tr(s):!0}var Y=te(()=>{"use strict";N();Fe();ke();Ze()});var et,It=te(()=>{"use strict";et=`#graphql
|
|
3
3
|
mutation cartAttributesUpdate($cartId: ID!, $attributes: [AttributeInput!]!) {
|
|
4
4
|
cartAttributesUpdate(cartId: $cartId, attributes: $attributes) {
|
|
5
5
|
cart {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
`});var Sr={};pr(Sr,{cleanupCartAttributes:()=>Er,getCartAttributesPayload:()=>It,updateCartAttributes:()=>Ut});function It(){let e=re(),t=V("ABAU")||{},r=I("eabUserId"),o=I("eabUserPreview")==="true",n=I("abtid"),u={};for(let p in e)t[p]&&(u[p]=e[p]);let c=[{key:"_eabTestsList",value:JSON.stringify(u)},{key:"_eabUserId",value:r||""},{key:"_eabList",value:JSON.stringify(e)}];return o&&n&&c.push({key:"_eabPreviewTest",value:n}),c}async function Ut(e,t={}){if(typeof window>"u")return{success:!1,error:"Not in browser environment"};if(!t.storefrontAccessToken&&!t.storefrontApiUrl)return console.warn("[ElevateAB] Missing storefrontAccessToken. For Next.js/non-Hydrogen stores, you must provide a Storefront Access Token. This token is SAFE to use client-side - it's a public token with limited permissions. Get it from: Shopify Admin \u2192 Settings \u2192 Apps \u2192 Develop apps"),{success:!1,error:"Missing storefrontAccessToken. Required for direct Storefront API calls."};try{let r=It(),o=e.startsWith("gid://")?e:`gid://shopify/Cart/${e}`,n=t.storefrontApiUrl||`https://${Ar()}/api/2025-01/graphql.json`,u=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-Shopify-Storefront-Access-Token":t.storefrontAccessToken},body:JSON.stringify({query:Ze,variables:{cartId:o,attributes:r}})});if(!u.ok)throw new Error(`HTTP error! status: ${u.status}`);let c=await u.json();if(c.errors||c.data?.cartAttributesUpdate?.userErrors?.length>0){let p=c.errors?.[0]?.message||c.data?.cartAttributesUpdate?.userErrors?.[0]?.message||"Unknown error";return console.error("[ElevateAB] Cart attributes update failed:",p),{success:!1,error:p}}return{success:!0}}catch(r){return console.error("[ElevateAB] Error updating cart attributes:",r),{success:!1,error:r instanceof Error?r.message:"Unknown error"}}}async function Er(e,t={}){if(typeof window>"u")return{success:!1,error:"Not in browser environment"};if(!t.storefrontAccessToken&&!t.storefrontApiUrl)return{success:!1,error:"Missing storefrontAccessToken. Required for direct Storefront API calls."};try{let r=e.startsWith("gid://")?e:`gid://shopify/Cart/${e}`,o=[{key:"_eabTestsList",value:""},{key:"_eabUserId",value:""},{key:"_eabList",value:""},{key:"_eabPreviewTest",value:""}],n=t.storefrontApiUrl||`https://${Ar()}/api/2025-01/graphql.json`,u=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-Shopify-Storefront-Access-Token":t.storefrontAccessToken},body:JSON.stringify({query:Ze,variables:{cartId:r,attributes:o}})});if(!u.ok)throw new Error(`HTTP error! status: ${u.status}`);let c=await u.json();if(c.errors||c.data?.cartAttributesUpdate?.userErrors?.length>0){let p=c.errors?.[0]?.message||c.data?.cartAttributesUpdate?.userErrors?.[0]?.message||"Unknown error";return console.error("[ElevateAB] Cart attributes cleanup failed:",p),{success:!1,error:p}}return{success:!0}}catch(r){return console.error("[ElevateAB] Error cleaning up cart attributes:",r),{success:!1,error:r instanceof Error?r.message:"Unknown error"}}}function Ar(){return typeof window>"u"?"":window.location.hostname}var et=ee(()=>{"use strict";J();N();St()});var Wn={};pr(Wn,{ElevateNextProvider:()=>Wr,ProductViewTracker:()=>Jr,clearPreviewMode:()=>Pt,extractShopifyId:()=>R,extractShopifyType:()=>_t,getCountryCode:()=>K,getPreviewState:()=>$,isInPreviewMode:()=>Et,isShopifyGid:()=>kt,matchesGeoTargeting:()=>Mt,trackAddToCart:()=>Rt,trackCartView:()=>Ot,trackCheckoutCompleted:()=>Dt,trackCheckoutStarted:()=>Bt,trackPageView:()=>Ce,trackProductView:()=>Pe,trackRemoveFromCart:()=>Vt,trackSearchSubmitted:()=>Lt,useElevateConfig:()=>ve,useExperiment:()=>Zt});module.exports=cn(Wn);var Re=require("react");var U=ze(require("react"),1);var yt=ze(require("react"),1),qe=yt.default.createContext(null);function ve(){let e=yt.default.useContext(qe);if(e===null)throw new Error("useElevateConfig must be used within ElevateProvider");return e}Fe();function R(e){return e?e.includes("gid://")&&e.split("/").pop()||e:""}function _t(e){return!e||!e.includes("gid://")?null:e.split("/")[3]||null}function kt(e){return!!e&&e.startsWith("gid://shopify/")}var xt=ze(wr(),1),hr={"facebook.com":"Facebook","fb.me":"Facebook","m.facebook.com":"Facebook","l.facebook.com":"Facebook","lm.facebook.com":"Facebook","instagram.com":"Instagram","l.instagram.com":"Instagram","youtube.com":"Youtube","youtu.be":"Youtube","m.youtube.com":"Youtube","bing.com":"Bing","www.bing.com":"Bing","msnbc.msn.com":"Bing","dizionario.it.msn.com":"Bing","cc.bingj.com":"Bing","m.bing.com":"Bing","twitter.com":"Twitter","t.co":"Twitter"};function A(e){return typeof e!="string"?String(e):e.replace(/[\\"'`\x00-\x1F\x7F]/g,"")}function E(e){if(e==null)return null;let t=typeof e=="string"?parseFloat(e):Number(e);return isNaN(t)?null:+(Math.round(+(t+"e2"))+"e-2")}function $e(e){if(!e)return null;let t=/gid:\/\/shopify\/Cart\/([^?]+(\?.+)?)/,r=e.match(t);return r?r[1]:null}function We(e){try{return typeof e!="string"?null:decodeURIComponent(e).split("?")[0]}catch{return e||null}}function un(e){if(!e)return"";switch(e){case"Mobile Safari":return"Safari";case"Chrome Mobile":case"Chrome Mobile iOS":return"Chrome";case"Firefox Mobile":case"Firefox Mobile iOS":return"Firefox";case"Opera Mobile":case"Opera Mini":case"Opera Mini iOS":return"Opera";case"Yandex Browser Lite":return"Yandex Browser";case"Chrome Webview":case"Mobile App":return"Mobile App";default:return e}}function ln(e){let t={};return e.searchParams.forEach((r,o)=>{t[o]||(t[o]=r)}),t}function dn(e){return!!e.host&&["http:","https:"].includes(e.protocol)}function fn(e){return e.replace(/^www\./,"")}function pn(e,t,r){if(t&&{Facebook:"Facebook",Instagram:"Instagram"}[t])return t;let n,u;try{if(e&&e.trim()!=="")n=new URL(e);else return"Direct";if(n?.hostname&&dn(n)){if(u=n.hostname,r&&r===u)return"Direct"}else return""}catch{}if(!u)return"";let c=fn(u);return c?hr[c]?hr[c]:c?.includes("google")?"Google":c:""}function Ge(e){let{referrer:t,entryPage:r,userAgent:o}=e,n={referrer_source:"",browser_info:"",os_info:"",device_type:"",page_entry_path:"",utm_medium:"",utm_source:"",utm_campaign:"",utm_content:"",utm_term:"",referrer_url:t||"",gclid:"",fbclid:"",pins_campaign_id:"",epik:""};try{let u;if(r&&r.trim()!==""&&r.startsWith("http"))try{let c=new URL(r),p=c?.pathname;u=c?.hostname,p&&(n.page_entry_path=p??"");let d=ln(c);n.utm_medium=d.utm_medium??"",n.utm_source=d.utm_source??"",n.utm_campaign=d.utm_campaign??"",n.utm_content=d.utm_content??"",n.utm_term=d.utm_term??"",n.gclid=d.gclid??"",n.fbclid=d.fbclid??"",n.pins_campaign_id=d.pins_campaign_id??"",n.epik=d.epik??""}catch{}if(o){let c=(0,xt.UAParser)(o),p=c?.browser?.name,d=un(p);n.browser_info=d??"",n.os_info=c?.os?.name??"",o&&(n.device_type=(c?.device?.type||"desktop")?.toUpperCase()??"")}return n.referrer_source=pn(t,n?.browser_info,u)??"",n}catch{return n}}function Je(e,t){let r=e==="/"||e==="",n=t&&/^\/[a-z]{2}(-[a-z]{2})?\/?$/i.test(e);return r||n?"index":/\/products\//.test(e)?"product":/\/collections\//.test(e)?"collection":/\/pages\//.test(e)?"page":/\/search/.test(e)?"search":/\/cart/.test(e)?"cart":/\/checkouts\//.test(e)?"checkout":"unknown"}function Ye(e){if(!e)return"";try{let t=(0,xt.UAParser)(e),r=t?.os,o=t?.device,n="";return r?.name&&(n+=r.name,r.version&&(n+=` ${r.version}`)),o?.type&&(n+=n?` (${o.type})`:o.type),o?.vendor&&(n+=n?` ${o.vendor}`:o.vendor),o?.model&&(n+=n?` ${o.model}`:o.model),n||e}catch{return e}}N();var Nt=require("react"),hn="https://bitter-river-9c62.support-67d.workers.dev",bn="https://d339co84ntxcme.cloudfront.net/Prod/orders",S=null;function Te(e){S=e}function Y(e){let t=e?.storeId||S?.storeId;return t||(console.warn("[ElevateAB] No storeId provided. Call initAnalytics() first or pass storeId to tracking function."),"")}function yn(e){return Object.entries(e).filter(([,t])=>typeof t=="string").map(([t,r])=>({test_id:t,variant_id:r}))}function vn(e,t){return Object.entries(e).filter(([r])=>typeof t[r]=="string").map(([r])=>({test_id:r,variant_id:t[r]}))}function _n(){return typeof window>"u"?!1:I("eabUserPreview")==="true"||new URLSearchParams(window.location.search).get("eabUserPreview")==="true"}function Q(e,t,r){if(typeof window>"u"||_n())return null;let o=navigator.userAgent,n=window.location.pathname,u=Je(n,r),{referrer:c,entryPage:p}=Xe(),d=Ge({referrer:c,entryPage:p,userAgent:o}),w=V("ABTL")||{},i=V("ABAU")||{},l=yn(w),a=vn(i,w),s=$e(localStorage.getItem("shopifyCartId")),f=new Date().toISOString(),_=sessionStorage.getItem("eabIsFirstVisit")==="true",k=I("localization")||"";return{pixel_event_id:`sh-${ie()}`,shop_name:e,timestamp:f,event_type:t,client_id:I("_shopify_y")||void 0,visitor_id:se(),session_id:Qe(),cart_token:We(s||I("cart")),page_url:window.location.href,page_pathname:n,page_search:window.location.search,referrer_url:c,referrer_source:d?.referrer_source,previous_page:document.referrer,page_entry:p,page_entry_path:d?.page_entry_path,page_type:u,utm_medium:d?.utm_medium,utm_source:d?.utm_source,utm_campaign:d?.utm_campaign,utm_content:d?.utm_content,utm_term:d?.utm_term,gclid:d?.gclid,fbclid:d?.fbclid,pins_campaign_id:d?.pins_campaign_id,epik:d?.epik,browser_info:d?.browser_info,os_info:d?.os_info,device_type:d?.device_type,language:navigator.language,root_route:localStorage.getItem("eabRootRoute")||"",user_agent:o,user_agent_no_browser:Ye(o),is_first_visit:_,shopify_country:k,ab_test_assignments:l,ab_test_views:a,is_first_order:null}}async function X(e,t=hn){try{let r=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),keepalive:!0});if(!r.ok)throw new Error(`Worker error: ${r.status}`)}catch(r){console.error("[ElevateAB] Error sending analytics:",r)}}async function Ce(e={}){let t=Y(e);if(!t)return;let r=e.hasLocalizedPaths??S?.hasLocalizedPaths,o=e.workerUrl??S?.workerUrl,n=Q(t,"page_viewed",r);if(!n)return;let u={...n,cart_currency:e.currency};await X(u,o)}async function Pe(e){let t=Y(e);if(!t)return;let{productId:r,productVendor:o,productPrice:n,productSku:u,currency:c}=e,p=e.hasLocalizedPaths??S?.hasLocalizedPaths,d=e.workerUrl??S?.workerUrl,w=Q(t,"product_viewed",p);if(!w)return;let i={...w,cart_currency:c,product_id:R(r),product_vendor:A(o),product_price:E(n),product_sku:A(u)};await X(i,d)}async function Rt(e){let t=Y(e);if(!t)return;let{productId:r,variantId:o,productVendor:n,productPrice:u,productQuantity:c,productSku:p,currency:d,cartId:w}=e,i=e.hasLocalizedPaths??S?.hasLocalizedPaths,l=e.workerUrl??S?.workerUrl,a=e.storefrontAccessToken??S?.storefrontAccessToken,s=Q(t,"product_added_to_cart",i);if(!s)return;let f={...s,cart_currency:d,product_id:R(r),variant_id:R(o),product_vendor:A(n),product_price:E(u),product_quantity:c,product_sku:A(p)};if(await X(f,l),w&&a)try{let{updateCartAttributes:_}=await Promise.resolve().then(()=>(et(),Sr));await _(w,{storefrontAccessToken:a})}catch(_){console.error("[ElevateAB] Failed to update cart attributes:",_)}}async function Vt(e){let t=Y(e);if(!t)return;let{productId:r,variantId:o,productVendor:n,productPrice:u,productQuantity:c,productSku:p,currency:d}=e,w=e.hasLocalizedPaths??S?.hasLocalizedPaths,i=e.workerUrl??S?.workerUrl,l=Q(t,"product_removed_from_cart",w);if(!l)return;let a={...l,cart_currency:d,product_id:R(r),variant_id:R(o),product_vendor:A(n),product_price:E(u),product_quantity:c,product_sku:A(p)};await X(a,i)}async function Ot(e){let t=Y(e);if(!t)return;let{cartTotalPrice:r,cartTotalQuantity:o,cartItems:n,currency:u}=e,c=e.hasLocalizedPaths??S?.hasLocalizedPaths,p=e.workerUrl??S?.workerUrl,d=Q(t,"cart_viewed",c);if(!d)return;let w={...d,cart_currency:u,cart_total_price:E(r),cart_total_quantity:o,cart_items:n?.map(i=>({product_id:R(i.productId),variant_id:R(i.variantId),product_vendor:A(i.productVendor)||"",product_price:E(i.productPrice),product_quantity:i.productQuantity??null,product_sku:A(i.productSku)||""}))};await X(w,p)}async function Lt(e){let t=Y(e);if(!t)return;let{searchQuery:r,currency:o}=e,n=e.hasLocalizedPaths??S?.hasLocalizedPaths,u=e.workerUrl??S?.workerUrl,c=Q(t,"search_submitted",n);if(!c)return;let p={...c,cart_currency:o,search_query:A(r)};await X(p,u)}async function Bt(e){let t=Y(e);if(!t)return;let{cartTotalPrice:r,cartSubtotalPrice:o,cartShippingPrice:n,cartTaxAmount:u,cartDiscountAmount:c,customerId:p,cartItems:d,currency:w}=e,i=e.hasLocalizedPaths??S?.hasLocalizedPaths,l=e.workerUrl??S?.workerUrl,a=Q(t,"checkout_started",i);if(!a)return;let s=0,f=d?.map(k=>{let g=k.productQuantity??0;return s+=g,{product_id:R(k.productId),variant_id:R(k.variantId),product_vendor:A(k.productVendor)||"",vendor:A(k.productVendor)||"",product_price:E(k.productPrice),total_price:E(k.productPrice),product_quantity:g,quantity:g,product_sku:A(k.productSku)||"",sku:A(k.productSku)||"",total_discount:E(k.totalDiscount)}})||[],_={...a,cart_currency:w,cart_total_price:E(r),cart_subtotal_price:E(o),cart_total_quantity:s,cart_shipping_price:E(n),cart_tax_amount:E(u),cart_discount_amount:E(c),cart_items:f,customer_id:p};await X(_,l)}async function Dt(e){let t=Y(e);if(!t)return;let{orderId:r,cartTotalPrice:o,cartSubtotalPrice:n,cartShippingPrice:u,cartTaxAmount:c,cartDiscountAmount:p,customerId:d,isFirstOrder:w,noteAttributes:i,cartItems:l,currency:a}=e,s=e.hasLocalizedPaths??S?.hasLocalizedPaths,f=e.ordersWorkerUrl??S?.ordersWorkerUrl??bn,_=Q(t,"checkout_completed",s);if(!_)return;let k=0,g=l?.map(h=>{let P=h.productQuantity??0;return k+=P,{product_id:R(h.productId),variant_id:R(h.variantId),product_vendor:A(h.productVendor)||"",vendor:A(h.productVendor)||"",product_price:E(h.productPrice),total_price:E(h.productPrice),product_quantity:P,quantity:P,product_sku:A(h.productSku)||"",sku:A(h.productSku)||"",total_discount:E(h.totalDiscount)}})||[],m={..._,cart_currency:a,cart_total_price:E(o),cart_subtotal_price:E(n),cart_total_quantity:k,cart_shipping_price:E(u),cart_tax_amount:E(c),cart_discount_amount:E(p),cart_items:g,order_id:r,customer_id:d,is_first_order:w??null,note_attributes:i};await X(m,f)}ke();N();var tt={SHOPIFY_LOCALIZATION:"localization",EAB_COUNTRY:"eabCountryCode",EAB_GEO:"eabGeoLocation"};function K(){if(typeof window>"u")return null;let t=new URLSearchParams(window.location.search).get("country");if(t)return B(tt.EAB_COUNTRY,t.toUpperCase()),t.toUpperCase();let r=I(tt.SHOPIFY_LOCALIZATION);if(r)return r.toUpperCase();let o=I(tt.EAB_COUNTRY);if(o)return o.toUpperCase();if(typeof localStorage<"u"){let n=localStorage.getItem(tt.EAB_COUNTRY);if(n)return n.toUpperCase()}return null}function Ir(e,t){let r=t??K();return r?e.map(n=>n.toUpperCase()).includes(r.toUpperCase()):!1}function Ur(e,t){let r=t??K();return r?e.map(n=>n.toUpperCase()).includes(r.toUpperCase()):!1}function Mt(e){let t=K();return!e.includeCountries?.length&&!e.excludeCountries?.length?!0:!t||e.excludeCountries?.length&&Ur(e.excludeCountries,t)?!1:e.includeCountries?.length?Ir(e.includeCountries,t):!0}J();N();var rt="eab:navigate",nt=!1,Ht=0,Ee=null,Ae=null;function kn(){typeof window>"u"||(Ht++,!nt&&(nt=!0,Ee=history.pushState.bind(history),Ae=history.replaceState.bind(history),history.pushState=function(...e){Ee(...e),window.dispatchEvent(new Event(rt))},history.replaceState=function(...e){Ae(...e),window.dispatchEvent(new Event(rt))}))}function xn(){typeof window>"u"||(Ht--,!(Ht>0||!nt)&&(Ee&&(history.pushState=Ee,Ee=null),Ae&&(history.replaceState=Ae,Ae=null),nt=!1))}function ce(e){if(typeof window>"u")return()=>{};let t=window.location.href,r=()=>{let o=window.location.href;o!==t&&(t=o,e())};return kn(),window.addEventListener(rt,r),window.addEventListener("popstate",r),()=>{window.removeEventListener(rt,r),window.removeEventListener("popstate",r),xn()}}function zt(e){let{configUrl:t,timeout:r=2e3}=e;return`(function(){
|
|
18
|
+
`});var Sr={};mr(Sr,{cleanupCartAttributes:()=>Er,getCartAttributesPayload:()=>Ut,updateCartAttributes:()=>Rt});function Ut(){let e=J(),t=V("ABAU")||{},r=I("eabUserId"),o=I("eabUserPreview")==="true",n=I("abtid"),s={};for(let p in e)t[p]&&(s[p]=e[p]);let u=[{key:"_eabTestsList",value:JSON.stringify(s)},{key:"_eabUserId",value:r||""},{key:"_eabList",value:JSON.stringify(e)}];return o&&n&&u.push({key:"_eabPreviewTest",value:n}),u}async function Rt(e,t={}){if(typeof window>"u")return{success:!1,error:"Not in browser environment"};if(!t.storefrontAccessToken&&!t.storefrontApiUrl)return console.warn("[ElevateAB] Missing storefrontAccessToken. For Next.js/non-Hydrogen stores, you must provide a Storefront Access Token. This token is SAFE to use client-side - it's a public token with limited permissions. Get it from: Shopify Admin \u2192 Settings \u2192 Apps \u2192 Develop apps"),{success:!1,error:"Missing storefrontAccessToken. Required for direct Storefront API calls."};try{let r=Ut(),o=e.startsWith("gid://")?e:`gid://shopify/Cart/${e}`,n=t.storefrontApiUrl||`https://${Ar()}/api/2025-01/graphql.json`,s=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-Shopify-Storefront-Access-Token":t.storefrontAccessToken},body:JSON.stringify({query:et,variables:{cartId:o,attributes:r}})});if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);let u=await s.json();if(u.errors||u.data?.cartAttributesUpdate?.userErrors?.length>0){let p=u.errors?.[0]?.message||u.data?.cartAttributesUpdate?.userErrors?.[0]?.message||"Unknown error";return console.error("[ElevateAB] Cart attributes update failed:",p),{success:!1,error:p}}return{success:!0}}catch(r){return console.error("[ElevateAB] Error updating cart attributes:",r),{success:!1,error:r instanceof Error?r.message:"Unknown error"}}}async function Er(e,t={}){if(typeof window>"u")return{success:!1,error:"Not in browser environment"};if(!t.storefrontAccessToken&&!t.storefrontApiUrl)return{success:!1,error:"Missing storefrontAccessToken. Required for direct Storefront API calls."};try{let r=e.startsWith("gid://")?e:`gid://shopify/Cart/${e}`,o=[{key:"_eabTestsList",value:""},{key:"_eabUserId",value:""},{key:"_eabList",value:""},{key:"_eabPreviewTest",value:""}],n=t.storefrontApiUrl||`https://${Ar()}/api/2025-01/graphql.json`,s=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-Shopify-Storefront-Access-Token":t.storefrontAccessToken},body:JSON.stringify({query:et,variables:{cartId:r,attributes:o}})});if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);let u=await s.json();if(u.errors||u.data?.cartAttributesUpdate?.userErrors?.length>0){let p=u.errors?.[0]?.message||u.data?.cartAttributesUpdate?.userErrors?.[0]?.message||"Unknown error";return console.error("[ElevateAB] Cart attributes cleanup failed:",p),{success:!1,error:p}}return{success:!0}}catch(r){return console.error("[ElevateAB] Error cleaning up cart attributes:",r),{success:!1,error:r instanceof Error?r.message:"Unknown error"}}}function Ar(){return typeof window>"u"?"":window.location.hostname}var tt=te(()=>{"use strict";Y();N();It()});var Wn={};mr(Wn,{ElevateNextProvider:()=>Wr,ProductViewTracker:()=>Jr,clearPreviewMode:()=>Pt,extractShopifyId:()=>R,extractShopifyType:()=>kt,getCountryCode:()=>Z,getPreviewState:()=>$,isInPreviewMode:()=>Et,isShopifyGid:()=>xt,matchesGeoTargeting:()=>Ht,trackAddToCart:()=>Vt,trackCartView:()=>Lt,trackCheckoutCompleted:()=>Nt,trackCheckoutStarted:()=>Dt,trackPageView:()=>Ce,trackProductView:()=>Pe,trackRemoveFromCart:()=>Ot,trackSearchSubmitted:()=>Bt,useElevateConfig:()=>ve,useExperiment:()=>er});module.exports=cn(Wn);var Re=require("react");var U=ze(require("react"),1);var vt=ze(require("react"),1),qe=vt.default.createContext(null);function ve(){let e=vt.default.useContext(qe);if(e===null)throw new Error("useElevateConfig must be used within ElevateProvider");return e}Fe();function R(e){return e?e.includes("gid://")&&e.split("/").pop()||e:""}function kt(e){return!e||!e.includes("gid://")?null:e.split("/")[3]||null}function xt(e){return!!e&&e.startsWith("gid://shopify/")}var Tt=ze(hr(),1),br={"facebook.com":"Facebook","fb.me":"Facebook","m.facebook.com":"Facebook","l.facebook.com":"Facebook","lm.facebook.com":"Facebook","instagram.com":"Instagram","l.instagram.com":"Instagram","youtube.com":"Youtube","youtu.be":"Youtube","m.youtube.com":"Youtube","bing.com":"Bing","www.bing.com":"Bing","msnbc.msn.com":"Bing","dizionario.it.msn.com":"Bing","cc.bingj.com":"Bing","m.bing.com":"Bing","twitter.com":"Twitter","t.co":"Twitter"};function A(e){return typeof e!="string"?String(e):e.replace(/[\\"'`\x00-\x1F\x7F]/g,"")}function E(e){if(e==null)return null;let t=typeof e=="string"?parseFloat(e):Number(e);return isNaN(t)?null:+(Math.round(+(t+"e2"))+"e-2")}function $e(e){if(!e)return null;let t=/gid:\/\/shopify\/Cart\/([^?]+(\?.+)?)/,r=e.match(t);return r?r[1]:null}function We(e){try{return typeof e!="string"?null:decodeURIComponent(e).split("?")[0]}catch{return e||null}}function un(e){if(!e)return"";switch(e){case"Mobile Safari":return"Safari";case"Chrome Mobile":case"Chrome Mobile iOS":return"Chrome";case"Firefox Mobile":case"Firefox Mobile iOS":return"Firefox";case"Opera Mobile":case"Opera Mini":case"Opera Mini iOS":return"Opera";case"Yandex Browser Lite":return"Yandex Browser";case"Chrome Webview":case"Mobile App":return"Mobile App";default:return e}}function ln(e){let t={};return e.searchParams.forEach((r,o)=>{t[o]||(t[o]=r)}),t}function dn(e){return!!e.host&&["http:","https:"].includes(e.protocol)}function fn(e){return e.replace(/^www\./,"")}function pn(e,t,r){if(t&&{Facebook:"Facebook",Instagram:"Instagram"}[t])return t;let n,s;try{if(e&&e.trim()!=="")n=new URL(e);else return"Direct";if(n?.hostname&&dn(n)){if(s=n.hostname,r&&r===s)return"Direct"}else return""}catch{}if(!s)return"";let u=fn(s);return u?br[u]?br[u]:u?.includes("google")?"Google":u:""}function Ge(e){let{referrer:t,entryPage:r,userAgent:o}=e,n={referrer_source:"",browser_info:"",os_info:"",device_type:"",page_entry_path:"",utm_medium:"",utm_source:"",utm_campaign:"",utm_content:"",utm_term:"",referrer_url:t||"",gclid:"",fbclid:"",pins_campaign_id:"",epik:""};try{let s;if(r&&r.trim()!==""&&r.startsWith("http"))try{let u=new URL(r),p=u?.pathname;s=u?.hostname,p&&(n.page_entry_path=p??"");let d=ln(u);n.utm_medium=d.utm_medium??"",n.utm_source=d.utm_source??"",n.utm_campaign=d.utm_campaign??"",n.utm_content=d.utm_content??"",n.utm_term=d.utm_term??"",n.gclid=d.gclid??"",n.fbclid=d.fbclid??"",n.pins_campaign_id=d.pins_campaign_id??"",n.epik=d.epik??""}catch{}if(o){let u=(0,Tt.UAParser)(o),p=u?.browser?.name,d=un(p);n.browser_info=d??"",n.os_info=u?.os?.name??"",o&&(n.device_type=(u?.device?.type||"desktop")?.toUpperCase()??"")}return n.referrer_source=pn(t,n?.browser_info,s)??"",n}catch{return n}}function Je(e,t){let r=e==="/"||e==="",n=t&&/^\/[a-z]{2}(-[a-z]{2})?\/?$/i.test(e);return r||n?"index":/\/products\//.test(e)?"product":/\/collections\//.test(e)?"collection":/\/pages\//.test(e)?"page":/\/search/.test(e)?"search":/\/cart/.test(e)?"cart":/\/checkouts\//.test(e)?"checkout":"unknown"}function Ye(e){if(!e)return"";try{let t=(0,Tt.UAParser)(e),r=t?.os,o=t?.device,n="";return r?.name&&(n+=r.name,r.version&&(n+=` ${r.version}`)),o?.type&&(n+=n?` (${o.type})`:o.type),o?.vendor&&(n+=n?` ${o.vendor}`:o.vendor),o?.model&&(n+=n?` ${o.model}`:o.model),n||e}catch{return e}}N();var Mt=require("react"),hn="https://bitter-river-9c62.support-67d.workers.dev",bn="https://d339co84ntxcme.cloudfront.net/Prod/orders",S=null;function Te(e){S=e}function Q(e){let t=e?.storeId||S?.storeId;return t||(console.warn("[ElevateAB] No storeId provided. Call initAnalytics() first or pass storeId to tracking function."),"")}function yn(e){return Object.entries(e).filter(([,t])=>typeof t=="string").map(([t,r])=>({test_id:t,variant_id:r}))}function vn(e,t){return Object.entries(e).filter(([r])=>typeof t[r]=="string").map(([r])=>({test_id:r,variant_id:t[r]}))}function _n(){return typeof window>"u"?!1:I("eabUserPreview")==="true"||new URLSearchParams(window.location.search).get("eabUserPreview")==="true"}function X(e,t,r){if(typeof window>"u"||_n())return null;let o=navigator.userAgent,n=window.location.pathname,s=Je(n,r),{referrer:u,entryPage:p}=Xe(),d=Ge({referrer:u,entryPage:p,userAgent:o}),w=V("ABTL")||{},i=V("ABAU")||{},l=yn(w),a=vn(i,w),c=$e(localStorage.getItem("shopifyCartId")),f=new Date().toISOString(),_=sessionStorage.getItem("eabIsFirstVisit")==="true",k=I("localization")||"";return{pixel_event_id:`sh-${ie()}`,shop_name:e,timestamp:f,event_type:t,client_id:I("_shopify_y")||void 0,visitor_id:se(),session_id:Qe(),cart_token:We(c||I("cart")),page_url:window.location.href,page_pathname:n,page_search:window.location.search,referrer_url:u,referrer_source:d?.referrer_source,previous_page:document.referrer,page_entry:p,page_entry_path:d?.page_entry_path,page_type:s,utm_medium:d?.utm_medium,utm_source:d?.utm_source,utm_campaign:d?.utm_campaign,utm_content:d?.utm_content,utm_term:d?.utm_term,gclid:d?.gclid,fbclid:d?.fbclid,pins_campaign_id:d?.pins_campaign_id,epik:d?.epik,browser_info:d?.browser_info,os_info:d?.os_info,device_type:d?.device_type,language:navigator.language,root_route:localStorage.getItem("eabRootRoute")||"",user_agent:o,user_agent_no_browser:Ye(o),is_first_visit:_,shopify_country:k,ab_test_assignments:l,ab_test_views:a,is_first_order:null}}async function K(e,t=hn){try{let r=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),keepalive:!0});if(!r.ok)throw new Error(`Worker error: ${r.status}`)}catch(r){console.error("[ElevateAB] Error sending analytics:",r)}}async function Ce(e={}){let t=Q(e);if(!t)return;let r=e.hasLocalizedPaths??S?.hasLocalizedPaths,o=e.workerUrl??S?.workerUrl,n=X(t,"page_viewed",r);if(!n)return;let s={...n,cart_currency:e.currency};await K(s,o)}async function Pe(e){let t=Q(e);if(!t)return;let{productId:r,productVendor:o,productPrice:n,productSku:s,currency:u}=e,p=e.hasLocalizedPaths??S?.hasLocalizedPaths,d=e.workerUrl??S?.workerUrl,w=X(t,"product_viewed",p);if(!w)return;let i={...w,cart_currency:u,product_id:R(r),product_vendor:A(o),product_price:E(n),product_sku:A(s)};await K(i,d)}async function Vt(e){let t=Q(e);if(!t)return;let{productId:r,variantId:o,productVendor:n,productPrice:s,productQuantity:u,productSku:p,currency:d,cartId:w}=e,i=e.hasLocalizedPaths??S?.hasLocalizedPaths,l=e.workerUrl??S?.workerUrl,a=e.storefrontAccessToken??S?.storefrontAccessToken,c=X(t,"product_added_to_cart",i);if(!c)return;let f={...c,cart_currency:d,product_id:R(r),variant_id:R(o),product_vendor:A(n),product_price:E(s),product_quantity:u,product_sku:A(p)};if(await K(f,l),w&&a)try{let{updateCartAttributes:_}=await Promise.resolve().then(()=>(tt(),Sr));await _(w,{storefrontAccessToken:a})}catch(_){console.error("[ElevateAB] Failed to update cart attributes:",_)}}async function Ot(e){let t=Q(e);if(!t)return;let{productId:r,variantId:o,productVendor:n,productPrice:s,productQuantity:u,productSku:p,currency:d}=e,w=e.hasLocalizedPaths??S?.hasLocalizedPaths,i=e.workerUrl??S?.workerUrl,l=X(t,"product_removed_from_cart",w);if(!l)return;let a={...l,cart_currency:d,product_id:R(r),variant_id:R(o),product_vendor:A(n),product_price:E(s),product_quantity:u,product_sku:A(p)};await K(a,i)}async function Lt(e){let t=Q(e);if(!t)return;let{cartTotalPrice:r,cartTotalQuantity:o,cartItems:n,currency:s}=e,u=e.hasLocalizedPaths??S?.hasLocalizedPaths,p=e.workerUrl??S?.workerUrl,d=X(t,"cart_viewed",u);if(!d)return;let w={...d,cart_currency:s,cart_total_price:E(r),cart_total_quantity:o,cart_items:n?.map(i=>({product_id:R(i.productId),variant_id:R(i.variantId),product_vendor:A(i.productVendor)||"",product_price:E(i.productPrice),product_quantity:i.productQuantity??null,product_sku:A(i.productSku)||""}))};await K(w,p)}async function Bt(e){let t=Q(e);if(!t)return;let{searchQuery:r,currency:o}=e,n=e.hasLocalizedPaths??S?.hasLocalizedPaths,s=e.workerUrl??S?.workerUrl,u=X(t,"search_submitted",n);if(!u)return;let p={...u,cart_currency:o,search_query:A(r)};await K(p,s)}async function Dt(e){let t=Q(e);if(!t)return;let{cartTotalPrice:r,cartSubtotalPrice:o,cartShippingPrice:n,cartTaxAmount:s,cartDiscountAmount:u,customerId:p,cartItems:d,currency:w}=e,i=e.hasLocalizedPaths??S?.hasLocalizedPaths,l=e.workerUrl??S?.workerUrl,a=X(t,"checkout_started",i);if(!a)return;let c=0,f=d?.map(k=>{let g=k.productQuantity??0;return c+=g,{product_id:R(k.productId),variant_id:R(k.variantId),product_vendor:A(k.productVendor)||"",vendor:A(k.productVendor)||"",product_price:E(k.productPrice),total_price:E(k.productPrice),product_quantity:g,quantity:g,product_sku:A(k.productSku)||"",sku:A(k.productSku)||"",total_discount:E(k.totalDiscount)}})||[],_={...a,cart_currency:w,cart_total_price:E(r),cart_subtotal_price:E(o),cart_total_quantity:c,cart_shipping_price:E(n),cart_tax_amount:E(s),cart_discount_amount:E(u),cart_items:f,customer_id:p};await K(_,l)}async function Nt(e){let t=Q(e);if(!t)return;let{orderId:r,cartTotalPrice:o,cartSubtotalPrice:n,cartShippingPrice:s,cartTaxAmount:u,cartDiscountAmount:p,customerId:d,isFirstOrder:w,noteAttributes:i,cartItems:l,currency:a}=e,c=e.hasLocalizedPaths??S?.hasLocalizedPaths,f=e.ordersWorkerUrl??S?.ordersWorkerUrl??bn,_=X(t,"checkout_completed",c);if(!_)return;let k=0,g=l?.map(h=>{let P=h.productQuantity??0;return k+=P,{product_id:R(h.productId),variant_id:R(h.variantId),product_vendor:A(h.productVendor)||"",vendor:A(h.productVendor)||"",product_price:E(h.productPrice),total_price:E(h.productPrice),product_quantity:P,quantity:P,product_sku:A(h.productSku)||"",sku:A(h.productSku)||"",total_discount:E(h.totalDiscount)}})||[],m={..._,cart_currency:a,cart_total_price:E(o),cart_subtotal_price:E(n),cart_total_quantity:k,cart_shipping_price:E(s),cart_tax_amount:E(u),cart_discount_amount:E(p),cart_items:g,order_id:r,customer_id:d,is_first_order:w??null,note_attributes:i};await K(m,f)}ke();N();var rt={SHOPIFY_LOCALIZATION:"localization",EAB_COUNTRY:"eabCountryCode",EAB_GEO:"eabGeoLocation"};function Z(){if(typeof window>"u")return null;let t=new URLSearchParams(window.location.search).get("country");if(t)return B(rt.EAB_COUNTRY,t.toUpperCase()),t.toUpperCase();let r=I(rt.SHOPIFY_LOCALIZATION);if(r)return r.toUpperCase();let o=I(rt.EAB_COUNTRY);if(o)return o.toUpperCase();if(typeof localStorage<"u"){let n=localStorage.getItem(rt.EAB_COUNTRY);if(n)return n.toUpperCase()}return null}function Ir(e,t){let r=t??Z();return r?e.map(n=>n.toUpperCase()).includes(r.toUpperCase()):!1}function Ur(e,t){let r=t??Z();return r?e.map(n=>n.toUpperCase()).includes(r.toUpperCase()):!1}function Ht(e){let t=Z();return!e.includeCountries?.length&&!e.excludeCountries?.length?!0:!t||e.excludeCountries?.length&&Ur(e.excludeCountries,t)?!1:e.includeCountries?.length?Ir(e.includeCountries,t):!0}Y();N();var nt="eab:navigate",ot=!1,zt=0,Ee=null,Ae=null;function kn(){typeof window>"u"||(zt++,!ot&&(ot=!0,Ee=history.pushState.bind(history),Ae=history.replaceState.bind(history),history.pushState=function(...e){Ee(...e),window.dispatchEvent(new Event(nt))},history.replaceState=function(...e){Ae(...e),window.dispatchEvent(new Event(nt))}))}function xn(){typeof window>"u"||(zt--,!(zt>0||!ot)&&(Ee&&(history.pushState=Ee,Ee=null),Ae&&(history.replaceState=Ae,Ae=null),ot=!1))}function ce(e){if(typeof window>"u")return()=>{};let t=window.location.href,r=()=>{let o=window.location.href;o!==t&&(t=o,e())};return kn(),window.addEventListener(nt,r),window.addEventListener("popstate",r),()=>{window.removeEventListener(nt,r),window.removeEventListener("popstate",r),xn()}}function qt(e){let{configUrl:t,timeout:r=2e3}=e;return`(function(){
|
|
19
19
|
if(new URLSearchParams(location.search).get('abtr')==='true')return;
|
|
20
20
|
|
|
21
21
|
var style=document.createElement('style');
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
if(window.__eab_reveal)window.__eab_reveal();
|
|
44
44
|
};
|
|
45
45
|
document.head.appendChild(script);
|
|
46
|
-
})();`}function Rr(e){if(!e?.trim())return"";try{let r=`https://${e.trim().replace(/^https?:\/\//,"")}`,o=new URL(r.replace(/\/+$/,""));return o.hostname.startsWith("www.")&&(o.hostname=o.hostname.substring(4)),o.toString().replace(/\/+$/,"")}catch{return e.trim().replace(/\/+$/,"")}}function qt(e,t){let r=Rr(e.split("?")[0]);for(let o of t){let n=Rr(o.split("?")[0]);if(r===n)return!0;try{let u=new URL(e).pathname,c=new URL(o,e).pathname;if(u===c)return!0}catch{}}return!1}function Tn(e){return e.data?.redirectBehavior||"redirectAll"}function Vr(e){return!!(V("eabRedirectedTests")||{})[e]}function Or(e){let t=V("eabRedirectedTests")||{};t[e]=!0,B("eabRedirectedTests",JSON.stringify(t))}function Cn(e,t){for(let r of e.tests)if(!(r.type!=="SPLIT_URL"||!r.enabled))for(let o of r.variations){let n=o.splitUrlTestLinks||[];if(n.length!==0&&qt(t,n))return{test:r,matchedVariation:o,isControlUrl:!!o.isControl}}return null}function Pn(e){if(typeof window>"u")return;let t=new URL(e,window.location.origin);t.searchParams.set("abtr","true");let r=t.toString(),o=window.__remixRouter?.navigate??window.next?.router?.push??window.$nuxt?.$router?.push??window.__navigate;if(o&&typeof o=="function")try{let n=t.pathname+t.search;o(n);return}catch{}window.location.href=r}function Se(e,t){if(typeof window>"u")return!1;let r=window.location.href;if(new URLSearchParams(window.location.search).get("abtr")==="true")return!1;let n=Cn(e,r);if(!n)return!1;let{test:u,matchedVariation:c,isControlUrl:p}=n,d=u.testId,w=Tn(u),i=F(d);if(!i)return!1;let l=u.variations.find(f=>f.id===i);if(!l)return!1;let a=l.splitUrlTestLinks||[];if(a.length===0||qt(r,a))return!1;switch(w){case"redirectOnlyControlUrl":if(!p||l.isControl)return!1;break;case"redirectOnce":if(Vr(d))return!1;Or(d);break;case"redirectOnceControlUrlOnly":if(!p||Vr(d)||l.isControl)return!1;Or(d);break;default:break}let s=a[0];return Pn(s),!0}function Lr(e){return e.tests.some(t=>t.type==="SPLIT_URL"&&t.enabled)}var Ft={type:"SPLIT_URL",shouldActivate(e,t){for(let r of e.variations){let o=r.splitUrlTestLinks||[];if(qt(t.currentUrl,o))return!0}return!1},getVariantData(){return{handlerActivated:!0}}};J();var Br="elv-el-",Dr={ELEMENT_NODE:1,TEXT_NODE:3},ot=new Map,ue=new Map,le=new Map,de=new Map,fe=!1;function W(e,t){if(t==="*")return!0;if(t.startsWith("*")&&t.endsWith("*")){let r=t.slice(1,-1);return e.includes(r)}if(t.startsWith("*")){let r=t.slice(1);return e.endsWith(r)}return t===e}function Gt(){return typeof window>"u"?!1:window.innerWidth<768}function En(e){let t="";for(let r=0;r<e.length;r++){let o=e[r];o>="A"&&o<="Z"?(r!==0&&(t+="-"),t+=o.toLowerCase()):t+=o}return t}function An(e){return e.nodeType===Dr.TEXT_NODE}function jt(e){return e.nodeType===Dr.ELEMENT_NODE}function $t(e,t){ot.has(e)||ot.set(e,t.cloneNode(!0))}function Nr(e){let t=e;t=t.replace(/`/g,"`").replace(/$/g,"$");try{t=JSON.parse('"'+t+'"')}catch{}return t}function Mr(e){if(typeof window>"u"||e.length===0)return;let t=window.location.pathname,r=e.filter(n=>n.pathnames?.length?n.pathnames.some(u=>W(t,u)):!0);fe=Gt();let o=r.map(n=>({...n,style:n.style?{...n.style.lg,...fe&&n.style.sm}:void 0,content:n.content&&fe&&n.content.sm?n.content.sm:n.content?.lg}));o.filter(n=>n.content!==void 0).forEach(n=>{(n.applyAll?Array.from(document.querySelectorAll(n.selector)):[document.querySelector(n.selector)].filter(Boolean)).forEach((c,p)=>{if(!c)return;let d=n.applyAll?`${n.selector}-${p}-${c.id||Math.random().toString(36).substr(2,9)}`:n.selector;$t(d,c),An(c)?c.nodeValue=n.content:jt(c)&&(c.innerHTML=n.content)})}),o.filter(n=>n.style!==void 0).forEach(n=>{let u=document.querySelector(n.selector);!u||!jt(u)||($t(n.selector,u),Object.entries(n.style).forEach(([c,p])=>{let d=En(c),w=p.toString().includes("!important"),i=p.toString().replace(/\s*!important\s*$/,"");u.style.setProperty(d,i,w?"important":void 0)}))}),o.filter(n=>n.attributes!==void 0).forEach(n=>{let u=document.querySelector(n.selector);!u||!jt(u)||($t(n.selector,u),Object.entries(n.attributes).forEach(([c,p])=>{u.setAttribute(c,p)}))})}function Hr(e){if(typeof window>"u"||e.length===0)return;let t=window.location.pathname;e.filter(o=>o.selector?.pathnames?.length?o.selector.pathnames.some(n=>W(t,n)):!0).forEach(o=>{let n=`${Br}${o.id}`,u=de.get(n);if(u&&!document.contains(u)&&de.delete(n),de.has(n))return;let c=document.querySelector(o.selector.target);if(!c||c.parentElement?.querySelector(`#${n}`))return;let p=zr(o);o.selector.placement==="after"?c.after(p):o.selector.placement==="before"&&c.before(p),de.set(n,p)})}function zr(e){let t=document.createElement(e.tagName);return t.id=`${Br}${e.id}`,e.style&&Object.assign(t.style,e.style),e.attributes&&Object.entries(e.attributes).forEach(([r,o])=>{t.setAttribute(r,o)}),e.kind==="text"&&e.content&&(t.innerText=e.content),e.kind==="container"&&e.childrens&&e.childrens.forEach(r=>{let o=zr(r);t.appendChild(o)}),t}function it(e,t){if(typeof window>"u"||e.length===0)return;let r=window.location.pathname;e.filter(n=>n.pathnames?.length?n.excludePathnames?.length&&n.excludePathnames.some(c=>W(r,c))?!1:n.pathnames.some(u=>W(r,u)):!0).forEach(n=>{n.id&&(n.css&&Sn(n.id,n.css),n.js&&In(n.id,n.js,t))})}function Sn(e,t){let r=`css-${e}`,o=ue.get(r);if(o&&!document.contains(o)&&ue.delete(r),ue.has(r)||document.getElementById(r))return;let n=document.createElement("style");n.id=r,n.textContent=Nr(t),document.head.appendChild(n),ue.set(r,n)}function In(e,t,r){let o=`js-${e}`,n=le.get(o);if(n&&!document.contains(n)&&le.delete(o),le.has(o)||document.getElementById(o))return;let u=document.createElement("script");u.id=o,r&&u.setAttribute("nonce",r);let c=Nr(t);u.textContent="(function(){try{"+c+"}catch(e){console.error('[ElevateAB] Custom script error:', e)}})();",document.head.appendChild(u),le.set(o,u)}function qr(){ot.forEach((e,t)=>{let r=document.querySelector(t);r&&r.replaceWith(e.cloneNode(!0))})}function Fr(){ue.forEach(e=>e.remove()),ue.clear(),le.forEach(e=>e.remove()),le.clear(),de.forEach(e=>e.remove()),de.clear(),ot.clear()}function Un(e,t){let r=[],o=[],n=[];return e.tests.filter(c=>c.type==="CONTENT"&&c.enabled).forEach(c=>{let p=F(c.testId);if(!p)return;let d=c.variations.find(w=>w.id===p);d?.content&&(d.content.changes?.length&&r.push(...d.content.changes),d.content.elements?.length&&o.push(...d.content.elements),d.content.customCodes?.length&&n.push(...d.content.customCodes))}),{changes:r,elements:o,blocks:[],customCodes:n}}function Ie(e){return e.tests.some(t=>t.type==="CONTENT"&&t.enabled)}function at(e,t,r){if(typeof window>"u"||!Ie(e))return;let o=Un(e,t);(o.changes.length>0||o.elements.length>0||o.customCodes.length>0)&&(Mr(o.changes),Hr(o.elements),it(o.customCodes,r))}function Wt(e,t,r){if(typeof window>"u")return;let o=Gt();o!==fe&&(qr(),fe=o),at(e,t,r)}function Jt(e,t,r,o=!0){if(typeof window>"u")return()=>{};let n=()=>{Gt()!==fe&&Wt(e,t,r)};window.addEventListener("resize",n);let u=()=>{};return o&&(u=ce(()=>{Wt(e,t,r)})),()=>{window.removeEventListener("resize",n),u(),Fr()}}J();function Yt(e){return e.tests.some(t=>t.type==="CUSTOM_CODE"&&t.enabled)}function jr(e,t,r){if(typeof window>"u"||!Yt(e))return;let o=e.tests.filter(u=>u.type==="CUSTOM_CODE"&&u.enabled),n=[];o.forEach(u=>{let c=F(u.testId);if(!c)return;let p=u.variations.find(d=>d.id===c);p?.customCode&&(p.customCode.js||p.customCode.css)&&n.push(p.customCode)}),n.length>0&&it(n,r)}J();var st=require("react/jsx-runtime"),Rn="https://ds0wlyksfn0sb.cloudfront.net/headless";function Vn(e){return e.replace(/^https?:\/\//,"").replace(".myshopify.com","")}function $r(e){return`${Rn}/${Vn(e)}.js`}var On=typeof window<"u"?U.default.useLayoutEffect:U.default.useEffect;function Qt({storeId:e,storefrontAccessToken:t,preventFlickering:r=!1,flickerTimeout:o=3e3,nonce:n,children:u}){let[c,p]=U.default.useState(null),[d,w]=U.default.useState(null),[i,l]=U.default.useState(null);U.default.useEffect(()=>{if(typeof window>"u")return;Te({storeId:e,storefrontAccessToken:t});let g=$();w(g);let m=K();l(m)},[e,t]);let a=(0,U.useCallback)(()=>{typeof window<"u"&&window.__eab_reveal&&window.__eab_reveal()},[]);U.default.useEffect(()=>{async function g(){try{let m=typeof window<"u"?$():null,h=null;if(typeof window<"u"&&window.eab_data)h=window.eab_data;else{let M=$r(e);h=await new Promise((D,G)=>{let H=document.createElement("script");H.src=M,H.async=!0,H.onload=()=>{let pe=window.eab_data;H.remove(),pe?D(pe):G(new Error("Failed to load config: window.eab_data is undefined"))},H.onerror=()=>{H.remove(),D({allTests:{},selectors:{selectorsV2:[]}})},document.head.appendChild(H)})}if(!h||!h.allTests||Object.keys(h.allTests).length===0){p({tests:[],selectors:void 0}),a();return}if(h.subscriptionPaused){console.error(`[ElevateAB] Subscription is paused or stopped for store: ${e}. `+(h.subscriptionMessage||"A/B tests will not run. Please reactivate your subscription.")),p({tests:[],selectors:void 0}),a();return}if(!(Object.keys(h.allTests||{}).length>0)){p({tests:[],selectors:void 0}),a();return}let L=gr(h);if(At(L,m),L.tests.some(M=>M.type==="SPLIT_URL")&&Se(L,m))return;p(L),a()}catch(m){console.error("[ElevateAB] Failed to load config:",m),p({tests:[],selectors:void 0}),a()}}g()},[e,a]),On(()=>{if(!c||typeof window>"u")return;let g=()=>Lr(c)?Se(c,d):!1,m=()=>{if(Ie(c))try{at(c,d,n)}catch(D){console.error("[ElevateAB] Failed to apply CONTENT tests:",D)}if(Yt(c))try{jr(c,d,n)}catch(D){console.error("[ElevateAB] Failed to apply CUSTOM_CODE tests:",D)}};g()||m();let h=null,P=null,L=ce(()=>{g()||(m(),h!==null&&window.cancelAnimationFrame(h),P!==null&&window.clearTimeout(P),h=window.requestAnimationFrame(()=>{m(),P=window.setTimeout(()=>{m(),P=null},80),h=null}))}),M=Ie(c)?Jt(c,d,n,!1):()=>{};return()=>{h!==null&&window.cancelAnimationFrame(h),P!==null&&window.clearTimeout(P),L(),M()}},[c,d,n]);let s=U.default.useMemo(()=>({config:c,storeId:e,storefrontAccessToken:t,isPreviewMode:d?.isPreview??!1,previewTestId:d?.previewTestId??null,previewState:d,selectors:c?.selectors,countryCode:i}),[c,e,t,d,i]),f=(0,U.useRef)(!1);U.default.useEffect(()=>{!t&&!f.current&&(f.current=!0,console.warn("[ElevateAB] No storefrontAccessToken provided. Orders won't be attributed to test variants."))},[t]);let _=U.default.useMemo(()=>$r(e),[e]),k=U.default.useMemo(()=>zt({configUrl:_,timeout:r?o:2e3}),[_,r,o]);return(0,st.jsxs)(qe.Provider,{value:s,children:[(0,st.jsx)("script",{nonce:n,dangerouslySetInnerHTML:{__html:k}}),u]})}var ct=require("next/navigation");var Ue=require("react/jsx-runtime");function Ln({currency:e}){let t=(0,ct.usePathname)(),r=(0,ct.useSearchParams)();return(0,Re.useEffect)(()=>{r.get("eabUserPreview")!=="true"&&Ce({currency:e})},[t,r,e]),null}function Wr({storeId:e,storefrontAccessToken:t,preventFlickering:r=!1,flickerTimeout:o=3e3,currency:n,children:u}){return(0,Re.useEffect)(()=>{Te({storeId:e,storefrontAccessToken:t})},[e,t]),(0,Ue.jsxs)(Qt,{storeId:e,storefrontAccessToken:t,preventFlickering:r,flickerTimeout:o,children:[(0,Ue.jsx)(Re.Suspense,{fallback:null,children:(0,Ue.jsx)(Ln,{currency:n})}),u]})}var Gr=require("react");function Jr({productId:e,productVendor:t,productPrice:r,productSku:o,currency:n}){return(0,Gr.useEffect)(()=>{e&&Pe({productId:e,productVendor:t,productPrice:r,productSku:o,currency:n})},[e,t,r,o,n]),null}Fe();N();J();Ke();ke();et();St();var Z=ze(require("react"),1);J();Ke();ke();var Yr=new Map;function ne(e){Yr.set(e.type,e)}function ut(e){return Yr.get(e)}function Bn(e){try{let o=new URL(e,"https://example.com").pathname.match(/\/products\/([^\/\?]+)/);return o?o[1]:null}catch{return null}}function Dn(e,t,r,o){if(typeof window>"u"||!e.prices||!t)return;let n=e.prices[t];if(!n)return;let u=n.price?.[r],c=n.compare?.[r],p=o;if(p?.selectorsV2?.length)for(let d of p.selectorsV2){if(d.price&&u){let w=d.price.replace("{{variant}}",t);document.querySelectorAll(w).forEach(l=>{let a=new Intl.NumberFormat("en-US",{style:"currency",currency:r}).format(parseFloat(u));l.textContent=a})}if(d.compareAt&&c){let w=d.compareAt.replace("{{variant}}",t);document.querySelectorAll(w).forEach(l=>{let a=new Intl.NumberFormat("en-US",{style:"currency",currency:r}).format(parseFloat(c));l.textContent=a})}if(d.saving&&u&&c)for(let w of d.saving){let i=w.selector.replace("{{variant}}",t);document.querySelectorAll(i).forEach(a=>{let s=parseFloat(u),f=parseFloat(c),_=f-s;if(w.isPercentage){let k=Math.round(_/f*100);a.textContent=`${k}%`}else{let k=new Intl.NumberFormat("en-US",{style:"currency",currency:r}).format(_);a.textContent=k}})}}}var Xt={type:"PRICE_PLUS",shouldActivate(e,t){let r=e.data;if(!r)return!1;let{productId:o,productHandle:n}=t,u=n||Bn(t.currentUrl),c=o&&r.productIds?.includes(o),p=u&&r.handles?.includes(u);return c||p},applyEffect(e,t,r){Dn(t,r.variantId,r.currencyCode||"USD",r.selectors)},getVariantData(e,t,r){let o=e.data;return{prices:t.prices,matchedProductId:r.productId,productIds:o?.productIds,handles:o?.handles,handlerActivated:!0}}};function Nn(e,t){let o=e.data?.pathnames||[];if(!o.length)return!0;try{let u=new URL(t,"https://example.com").pathname;return o.some(c=>W(u,c))}catch{return!1}}var lt={type:"CONTENT",shouldActivate(e,t){return Nn(e,t.currentUrl)},getVariantData(e,t,r){let o=e.data;return{content:t.content,pathnames:o?.pathnames,handlerActivated:!0}}};function Mn(e,t){let o=e.data?.pathnames||[];if(!o.length)return!0;try{let u=new URL(t,"https://example.com").pathname;return o.some(c=>W(u,c))}catch{return!1}}var Kt={type:"CUSTOM_CODE",shouldActivate(e,t){return Mn(e,t.currentUrl)},getVariantData(e,t,r){let o=e.data;return{customCode:t.customCode,pathnames:o?.pathnames,excludePathnames:o?.excludePathnames,handlerActivated:!0}}};ne(Xt);ne(Ft);ne(lt);ne(Kt);function qn(e){if(typeof window>"u")return{currentUrl:"",selectors:e};let t=window.location.href,r=window.location.pathname,o,n=r.match(/\/products\/([^\/\?]+)/);n&&(o=n[1]);let u,p=new URLSearchParams(window.location.search).get("variant");return p&&(u=p),{currentUrl:t,productHandle:o,variantId:u,selectors:e,currencyCode:"USD"}}function Zt(e){let{config:t,previewState:r,selectors:o}=ve(),[n,u]=Z.default.useState(null),[c,p]=Z.default.useState(!0),d=Z.default.useMemo(()=>t&&t.tests.find(a=>a.testId===e)||null,[t,e]),w=Z.default.useMemo(()=>r||$(),[r]),i=Z.default.useRef(null),l=Z.default.useRef(null);return Z.default.useEffect(()=>{let a=!0;if(t===null)return;if(!d){i.current!==e&&(i.current=e,console.warn(`[ElevateAB] Test not found: ${e}`)),a&&p(!1);return}if(!d.enabled&&!w?.isPreview){i.current!==`${e}-disabled`&&(i.current=`${e}-disabled`,console.warn(`[ElevateAB] Test disabled: ${e}`)),a&&p(!1);return}let s=F(e);if(!s){a&&p(!1);return}let f=d.variations.find(m=>m.id===s);if(!f){a&&p(!1);return}let _=ut(d.type),k=qn(o),g={...f};if(_?.shouldActivate(d,k)){let m=`${e}-${f.id}`;_.applyEffect&&l.current!==m&&(l.current=m,_.applyEffect(d,f,k));let h=_.getVariantData(d,f,k);g={...g,...h}}return a&&u(g),w?.isPreview||xe(e),a&&p(!1),()=>{a=!1}},[t,d,e,w,o]),{variant:n,isLoading:c,isControl:n?.isControl??!1,isA:n?.isA??!1,isB:n?.isB??!1,isC:n?.isC??!1,isD:n?.isD??!1}}var er=require("react");N();N();et();0&&(module.exports={ElevateNextProvider,ProductViewTracker,clearPreviewMode,extractShopifyId,extractShopifyType,getCountryCode,getPreviewState,isInPreviewMode,isShopifyGid,matchesGeoTargeting,trackAddToCart,trackCartView,trackCheckoutCompleted,trackCheckoutStarted,trackPageView,trackProductView,trackRemoveFromCart,trackSearchSubmitted,useElevateConfig,useExperiment});
|
|
46
|
+
})();`}function Rr(e){if(!e?.trim())return"";try{let r=`https://${e.trim().replace(/^https?:\/\//,"")}`,o=new URL(r.replace(/\/+$/,""));return o.hostname.startsWith("www.")&&(o.hostname=o.hostname.substring(4)),o.toString().replace(/\/+$/,"")}catch{return e.trim().replace(/\/+$/,"")}}function Ft(e,t){let r=Rr(e.split("?")[0]);for(let o of t){let n=Rr(o.split("?")[0]);if(r===n)return!0;try{let s=new URL(e).pathname,u=new URL(o,e).pathname;if(s===u)return!0}catch{}}return!1}function Tn(e){return e.data?.redirectBehavior||"redirectAll"}function Vr(e){return!!(V("eabRedirectedTests")||{})[e]}function Or(e){let t=V("eabRedirectedTests")||{};t[e]=!0,B("eabRedirectedTests",JSON.stringify(t))}function Cn(e,t){for(let r of e.tests)if(!(r.type!=="SPLIT_URL"||!r.enabled))for(let o of r.variations){let n=o.splitUrlTestLinks||[];if(n.length!==0&&Ft(t,n))return{test:r,matchedVariation:o,isControlUrl:!!o.isControl}}return null}function Pn(e){if(typeof window>"u")return;let t=new URL(e,window.location.origin);t.searchParams.set("abtr","true");let r=t.toString(),o=window.__remixRouter?.navigate??window.next?.router?.push??window.$nuxt?.$router?.push??window.__navigate;if(o&&typeof o=="function")try{let n=t.pathname+t.search;o(n);return}catch{}window.location.href=r}function Se(e,t){if(typeof window>"u")return!1;let r=window.location.href;if(new URLSearchParams(window.location.search).get("abtr")==="true")return!1;let n=Cn(e,r);if(!n)return!1;let{test:s,matchedVariation:u,isControlUrl:p}=n,d=s.testId,w=Tn(s),i=F(d);if(!i)return!1;let l=s.variations.find(f=>f.id===i);if(!l)return!1;let a=l.splitUrlTestLinks||[];if(a.length===0||Ft(r,a))return!1;switch(w){case"redirectOnlyControlUrl":if(!p||l.isControl)return!1;break;case"redirectOnce":if(Vr(d))return!1;Or(d);break;case"redirectOnceControlUrlOnly":if(!p||Vr(d)||l.isControl)return!1;Or(d);break;default:break}let c=a[0];return Pn(c),!0}function Lr(e){return e.tests.some(t=>t.type==="SPLIT_URL"&&t.enabled)}var jt={type:"SPLIT_URL",shouldActivate(e,t){for(let r of e.variations){let o=r.splitUrlTestLinks||[];if(Ft(t.currentUrl,o))return!0}return!1},getVariantData(){return{handlerActivated:!0}}};Y();var Br="elv-el-",Dr={ELEMENT_NODE:1,TEXT_NODE:3},it=new Map,ue=new Map,le=new Map,de=new Map,fe=!1;function W(e,t){if(t==="*")return!0;if(t.startsWith("*")&&t.endsWith("*")){let r=t.slice(1,-1);return e.includes(r)}if(t.startsWith("*")){let r=t.slice(1);return e.endsWith(r)}return t===e}function Jt(){return typeof window>"u"?!1:window.innerWidth<768}function En(e){let t="";for(let r=0;r<e.length;r++){let o=e[r];o>="A"&&o<="Z"?(r!==0&&(t+="-"),t+=o.toLowerCase()):t+=o}return t}function An(e){return e.nodeType===Dr.TEXT_NODE}function $t(e){return e.nodeType===Dr.ELEMENT_NODE}function Wt(e,t){it.has(e)||it.set(e,t.cloneNode(!0))}function Nr(e){let t=e;t=t.replace(/`/g,"`").replace(/$/g,"$");try{t=JSON.parse('"'+t+'"')}catch{}return t}function Mr(e){if(typeof window>"u"||e.length===0)return;let t=window.location.pathname,r=e.filter(n=>n.pathnames?.length?n.pathnames.some(s=>W(t,s)):!0);fe=Jt();let o=r.map(n=>({...n,style:n.style?{...n.style.lg,...fe&&n.style.sm}:void 0,content:n.content&&fe&&n.content.sm?n.content.sm:n.content?.lg}));o.filter(n=>n.content!==void 0).forEach(n=>{(n.applyAll?Array.from(document.querySelectorAll(n.selector)):[document.querySelector(n.selector)].filter(Boolean)).forEach((u,p)=>{if(!u)return;let d=n.applyAll?`${n.selector}-${p}-${u.id||Math.random().toString(36).substr(2,9)}`:n.selector;Wt(d,u),An(u)?u.nodeValue=n.content:$t(u)&&(u.innerHTML=n.content)})}),o.filter(n=>n.style!==void 0).forEach(n=>{let s=document.querySelector(n.selector);!s||!$t(s)||(Wt(n.selector,s),Object.entries(n.style).forEach(([u,p])=>{let d=En(u),w=p.toString().includes("!important"),i=p.toString().replace(/\s*!important\s*$/,"");s.style.setProperty(d,i,w?"important":void 0)}))}),o.filter(n=>n.attributes!==void 0).forEach(n=>{let s=document.querySelector(n.selector);!s||!$t(s)||(Wt(n.selector,s),Object.entries(n.attributes).forEach(([u,p])=>{s.setAttribute(u,p)}))})}function Hr(e){if(typeof window>"u"||e.length===0)return;let t=window.location.pathname;e.filter(o=>o.selector?.pathnames?.length?o.selector.pathnames.some(n=>W(t,n)):!0).forEach(o=>{let n=`${Br}${o.id}`,s=de.get(n);if(s&&!document.contains(s)&&de.delete(n),de.has(n))return;let u=document.querySelector(o.selector.target);if(!u||u.parentElement?.querySelector(`#${n}`))return;let p=zr(o);o.selector.placement==="after"?u.after(p):o.selector.placement==="before"&&u.before(p),de.set(n,p)})}function zr(e){let t=document.createElement(e.tagName);return t.id=`${Br}${e.id}`,e.style&&Object.assign(t.style,e.style),e.attributes&&Object.entries(e.attributes).forEach(([r,o])=>{t.setAttribute(r,o)}),e.kind==="text"&&e.content&&(t.innerText=e.content),e.kind==="container"&&e.childrens&&e.childrens.forEach(r=>{let o=zr(r);t.appendChild(o)}),t}function at(e,t){if(typeof window>"u"||e.length===0)return;let r=window.location.pathname;e.filter(n=>n.pathnames?.length?n.excludePathnames?.length&&n.excludePathnames.some(u=>W(r,u))?!1:n.pathnames.some(s=>W(r,s)):!0).forEach(n=>{n.id&&(n.css&&Sn(n.id,n.css),n.js&&In(n.id,n.js,t))})}function Sn(e,t){let r=`css-${e}`,o=ue.get(r);if(o&&!document.contains(o)&&ue.delete(r),ue.has(r)||document.getElementById(r))return;let n=document.createElement("style");n.id=r,n.textContent=Nr(t),document.head.appendChild(n),ue.set(r,n)}function In(e,t,r){let o=`js-${e}`,n=le.get(o);if(n&&!document.contains(n)&&le.delete(o),le.has(o)||document.getElementById(o))return;let s=document.createElement("script");s.id=o,r&&s.setAttribute("nonce",r);let u=Nr(t);s.textContent="(function(){try{"+u+"}catch(e){console.error('[ElevateAB] Custom script error:', e)}})();",document.head.appendChild(s),le.set(o,s)}function qr(){it.forEach((e,t)=>{let r=document.querySelector(t);r&&r.replaceWith(e.cloneNode(!0))})}function Fr(){ue.forEach(e=>e.remove()),ue.clear(),le.forEach(e=>e.remove()),le.clear(),de.forEach(e=>e.remove()),de.clear(),it.clear()}function Un(e,t){let r=[],o=[],n=[];return e.tests.filter(u=>u.type==="CONTENT"&&u.enabled).forEach(u=>{let p=F(u.testId);if(!p)return;let d=u.variations.find(w=>w.id===p);d?.content&&(d.content.changes?.length&&r.push(...d.content.changes),d.content.elements?.length&&o.push(...d.content.elements),d.content.customCodes?.length&&n.push(...d.content.customCodes))}),{changes:r,elements:o,blocks:[],customCodes:n}}function Ie(e){return e.tests.some(t=>t.type==="CONTENT"&&t.enabled)}function st(e,t,r){if(typeof window>"u"||!Ie(e))return;let o=Un(e,t);(o.changes.length>0||o.elements.length>0||o.customCodes.length>0)&&(Mr(o.changes),Hr(o.elements),at(o.customCodes,r))}function Gt(e,t,r){if(typeof window>"u")return;let o=Jt();o!==fe&&(qr(),fe=o),st(e,t,r)}function Yt(e,t,r,o=!0){if(typeof window>"u")return()=>{};let n=()=>{Jt()!==fe&&Gt(e,t,r)};window.addEventListener("resize",n);let s=()=>{};return o&&(s=ce(()=>{Gt(e,t,r)})),()=>{window.removeEventListener("resize",n),s(),Fr()}}Y();function Qt(e){return e.tests.some(t=>t.type==="CUSTOM_CODE"&&t.enabled)}function jr(e,t,r){if(typeof window>"u"||!Qt(e))return;let o=e.tests.filter(s=>s.type==="CUSTOM_CODE"&&s.enabled),n=[];o.forEach(s=>{let u=F(s.testId);if(!u)return;let p=s.variations.find(d=>d.id===u);p?.customCode&&(p.customCode.js||p.customCode.css)&&n.push(p.customCode)}),n.length>0&&at(n,r)}Y();var ct=require("react/jsx-runtime"),Rn="https://ds0wlyksfn0sb.cloudfront.net/headless";function Vn(e){return e.replace(/^https?:\/\//,"").replace(".myshopify.com","")}function $r(e){return`${Rn}/${Vn(e)}.js`}var On=typeof window<"u"?U.default.useLayoutEffect:U.default.useEffect;function Xt({storeId:e,storefrontAccessToken:t,preventFlickering:r=!1,flickerTimeout:o=3e3,nonce:n,children:s}){let[u,p]=U.default.useState(null),[d,w]=U.default.useState(null),[i,l]=U.default.useState(null);U.default.useEffect(()=>{if(typeof window>"u")return;Te({storeId:e,storefrontAccessToken:t});let g=$();w(g);let m=Z();l(m)},[e,t]);let a=(0,U.useCallback)(()=>{typeof window<"u"&&window.__eab_reveal&&window.__eab_reveal()},[]);U.default.useEffect(()=>{async function g(){try{let m=typeof window<"u"?$():null,h=null;if(typeof window<"u"&&window.eab_data)h=window.eab_data;else{let M=$r(e);h=await new Promise((D,G)=>{let H=document.createElement("script");H.src=M,H.async=!0,H.onload=()=>{let pe=window.eab_data;H.remove(),pe?D(pe):G(new Error("Failed to load config: window.eab_data is undefined"))},H.onerror=()=>{H.remove(),D({allTests:{},selectors:{selectorsV2:[]}})},document.head.appendChild(H)})}if(!h||!h.allTests||Object.keys(h.allTests).length===0){p({tests:[],selectors:void 0}),a();return}if(h.subscriptionPaused){console.error(`[ElevateAB] Subscription is paused or stopped for store: ${e}. `+(h.subscriptionMessage||"A/B tests will not run. Please reactivate your subscription.")),p({tests:[],selectors:void 0}),a();return}if(!(Object.keys(h.allTests||{}).length>0)){p({tests:[],selectors:void 0}),a();return}let L=wr(h);if(St(L,m),L.tests.some(M=>M.type==="SPLIT_URL")&&Se(L,m))return;p(L),a()}catch(m){console.error("[ElevateAB] Failed to load config:",m),p({tests:[],selectors:void 0}),a()}}g()},[e,a]),On(()=>{if(!u||typeof window>"u")return;let g=()=>Lr(u)?Se(u,d):!1,m=()=>{if(Ie(u))try{st(u,d,n)}catch(D){console.error("[ElevateAB] Failed to apply CONTENT tests:",D)}if(Qt(u))try{jr(u,d,n)}catch(D){console.error("[ElevateAB] Failed to apply CUSTOM_CODE tests:",D)}};g()||m();let h=null,P=null,L=ce(()=>{g()||(m(),h!==null&&window.cancelAnimationFrame(h),P!==null&&window.clearTimeout(P),h=window.requestAnimationFrame(()=>{m(),P=window.setTimeout(()=>{m(),P=null},80),h=null}))}),M=Ie(u)?Yt(u,d,n,!1):()=>{};return()=>{h!==null&&window.cancelAnimationFrame(h),P!==null&&window.clearTimeout(P),L(),M()}},[u,d,n]);let c=U.default.useMemo(()=>({config:u,storeId:e,storefrontAccessToken:t,isPreviewMode:d?.isPreview??!1,previewTestId:d?.previewTestId??null,previewState:d,selectors:u?.selectors,countryCode:i}),[u,e,t,d,i]),f=(0,U.useRef)(!1);U.default.useEffect(()=>{!t&&!f.current&&(f.current=!0,console.warn("[ElevateAB] No storefrontAccessToken provided. Orders won't be attributed to test variants."))},[t]);let _=U.default.useMemo(()=>$r(e),[e]),k=U.default.useMemo(()=>qt({configUrl:_,timeout:r?o:2e3}),[_,r,o]);return(0,ct.jsxs)(qe.Provider,{value:c,children:[(0,ct.jsx)("script",{nonce:n,dangerouslySetInnerHTML:{__html:k}}),s]})}var ut=require("next/navigation");var Ue=require("react/jsx-runtime");function Ln({currency:e}){let t=(0,ut.usePathname)(),r=(0,ut.useSearchParams)();return(0,Re.useEffect)(()=>{r.get("eabUserPreview")!=="true"&&Ce({currency:e})},[t,r,e]),null}function Wr({storeId:e,storefrontAccessToken:t,preventFlickering:r=!1,flickerTimeout:o=3e3,currency:n,children:s}){return(0,Re.useEffect)(()=>{Te({storeId:e,storefrontAccessToken:t})},[e,t]),(0,Ue.jsxs)(Xt,{storeId:e,storefrontAccessToken:t,preventFlickering:r,flickerTimeout:o,children:[(0,Ue.jsx)(Re.Suspense,{fallback:null,children:(0,Ue.jsx)(Ln,{currency:n})}),s]})}var Gr=require("react");function Jr({productId:e,productVendor:t,productPrice:r,productSku:o,currency:n}){return(0,Gr.useEffect)(()=>{e&&Pe({productId:e,productVendor:t,productPrice:r,productSku:o,currency:n})},[e,t,r,o,n]),null}Fe();N();Y();Ze();ke();tt();It();var ee=ze(require("react"),1);Y();Ze();ke();var Yr=new Map;function ne(e){Yr.set(e.type,e)}function lt(e){return Yr.get(e)}function Bn(e){try{let o=new URL(e,"https://example.com").pathname.match(/\/products\/([^\/\?]+)/);return o?o[1]:null}catch{return null}}function Dn(e,t,r,o){if(typeof window>"u"||!e.prices||!t)return;let n=e.prices[t];if(!n)return;let s=n.price?.[r],u=n.compare?.[r],p=o;if(p?.selectorsV2?.length)for(let d of p.selectorsV2){if(d.price&&s){let w=d.price.replace("{{variant}}",t);document.querySelectorAll(w).forEach(l=>{let a=new Intl.NumberFormat("en-US",{style:"currency",currency:r}).format(parseFloat(s));l.textContent=a})}if(d.compareAt&&u){let w=d.compareAt.replace("{{variant}}",t);document.querySelectorAll(w).forEach(l=>{let a=new Intl.NumberFormat("en-US",{style:"currency",currency:r}).format(parseFloat(u));l.textContent=a})}if(d.saving&&s&&u)for(let w of d.saving){let i=w.selector.replace("{{variant}}",t);document.querySelectorAll(i).forEach(a=>{let c=parseFloat(s),f=parseFloat(u),_=f-c;if(w.isPercentage){let k=Math.round(_/f*100);a.textContent=`${k}%`}else{let k=new Intl.NumberFormat("en-US",{style:"currency",currency:r}).format(_);a.textContent=k}})}}}var Kt={type:"PRICE_PLUS",shouldActivate(e,t){let r=e.data;if(!r)return!1;let{productId:o,productHandle:n}=t,s=n||Bn(t.currentUrl),u=o&&r.productIds?.includes(o),p=s&&r.handles?.includes(s);return u||p},applyEffect(e,t,r){Dn(t,r.variantId,r.currencyCode||"USD",r.selectors)},getVariantData(e,t,r){let o=e.data;return{prices:t.prices,matchedProductId:r.productId,productIds:o?.productIds,handles:o?.handles,handlerActivated:!0}}};function Nn(e,t){let o=e.data?.pathnames||[];if(!o.length)return!0;try{let s=new URL(t,"https://example.com").pathname;return o.some(u=>W(s,u))}catch{return!1}}var dt={type:"CONTENT",shouldActivate(e,t){return Nn(e,t.currentUrl)},getVariantData(e,t,r){let o=e.data;return{content:t.content,pathnames:o?.pathnames,handlerActivated:!0}}};function Mn(e,t){let o=e.data?.pathnames||[];if(!o.length)return!0;try{let s=new URL(t,"https://example.com").pathname;return o.some(u=>W(s,u))}catch{return!1}}var Zt={type:"CUSTOM_CODE",shouldActivate(e,t){return Mn(e,t.currentUrl)},getVariantData(e,t,r){let o=e.data;return{customCode:t.customCode,pathnames:o?.pathnames,excludePathnames:o?.excludePathnames,handlerActivated:!0}}};ne(Kt);ne(jt);ne(dt);ne(Zt);function qn(e){if(typeof window>"u")return{currentUrl:"",selectors:e};let t=window.location.href,r=window.location.pathname,o,n=r.match(/\/products\/([^\/\?]+)/);n&&(o=n[1]);let s,p=new URLSearchParams(window.location.search).get("variant");return p&&(s=p),{currentUrl:t,productHandle:o,variantId:s,selectors:e,currencyCode:"USD"}}function er(e){let{config:t,previewState:r,selectors:o}=ve(),[n,s]=ee.default.useState(null),[u,p]=ee.default.useState(!0),d=ee.default.useMemo(()=>t&&t.tests.find(a=>a.testId===e)||null,[t,e]),w=ee.default.useMemo(()=>r||$(),[r]),i=ee.default.useRef(null),l=ee.default.useRef(null);return ee.default.useEffect(()=>{let a=!0;if(t===null)return;if(!d){i.current!==e&&(i.current=e,console.warn(`[ElevateAB] Test not found: ${e}`)),a&&p(!1);return}if(!d.enabled&&!w?.isPreview){i.current!==`${e}-disabled`&&(i.current=`${e}-disabled`,console.warn(`[ElevateAB] Test disabled: ${e}`)),a&&p(!1);return}let c=F(e);if(!c){a&&p(!1);return}let f=d.variations.find(m=>m.id===c);if(!f){a&&p(!1);return}let _=lt(d.type),k=qn(o),g={...f};if(_?.shouldActivate(d,k)){let m=`${e}-${f.id}`;_.applyEffect&&l.current!==m&&(l.current=m,_.applyEffect(d,f,k));let h=_.getVariantData(d,f,k);g={...g,...h}}return a&&s(g),w?.isPreview||xe(e),a&&p(!1),()=>{a=!1}},[t,d,e,w,o]),{variant:n,isLoading:u,isControl:n?.isControl??!1,isA:n?.isA??!1,isB:n?.isB??!1,isC:n?.isC??!1,isD:n?.isD??!1}}var tr=require("react");N();N();tt();0&&(module.exports={ElevateNextProvider,ProductViewTracker,clearPreviewMode,extractShopifyId,extractShopifyType,getCountryCode,getPreviewState,isInPreviewMode,isShopifyGid,matchesGeoTargeting,trackAddToCart,trackCartView,trackCheckoutCompleted,trackCheckoutStarted,trackPageView,trackProductView,trackRemoveFromCart,trackSearchSubmitted,useElevateConfig,useExperiment});
|
|
47
47
|
//# sourceMappingURL=next.cjs.map
|