(function(){const e="35yFRuYNcrBF4M2r473RzQgKUdM",t="https://analytics.peris.lt/v1/track";let n={},r={};const o=()=>{try{let e=localStorage.getItem("anonymousId");return e||(e="anon-"+Date.now()+"-"+Math.random().toString(16).slice(2),localStorage.setItem("anonymousId",e),e)}catch(e){return"anon-"+Date.now()+"-"+Math.random().toString(16).slice(2)}},i=(n,r)=>fetch(t,{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Basic "+btoa(e+":")},body:JSON.stringify({anonymousId:o(),type:"track",channel:"web",event:n,properties:{source:"Eshop_Frontend_JS",...r},context:{userAgent:navigator.userAgent,locale:navigator.language,page:{path:location.pathname,url:location.href,title:document.title,referrer:document.referrer}},timestamp:(new Date).toISOString()})}).catch(e=>console.warn("[Rudder] error",e)),a=e=>{const t=window.dataLayer;if(!Array.isArray(t))return null;for(let n=t.length-1;n>=0;n--)if(t[n]&&t[n].event===e)return t[n];return null},c=(e,t,o,s=150)=>{if(n[e]===location.href&&"luigisbox_add_to_cart"!==t)return;r[e]&&clearTimeout(r[e]),r[e]=setTimeout(()=>{const r=a(t);r&&(n[e]=location.href,o(r))},s)},l=e=>{const t=e.ecommerce||{},n=t.items||[],r=n[0]||{};i("Product Viewed",{product_id:r.item_id,name:r.item_name,price:r.price,quantity:r.quantity,currency:t.currency,value:t.value,items:n})},u=e=>{const t=e.ecommerce||{},n=t.items||[],r=n[0]||{};i("Promotion Viewed",{promotion_id:r.promotion_id||t.promotion_id,promotion_name:r.promotion_name||t.promotion_name,creative_name:r.creative_name,items:n})},m=e=>{const t=e.ecommerce||{},n=t.items||{};i("view_list",t.scopes?{item_list_name:t.item_list_name,category_identity:t.scopes.CategoryIdentity||"",category_label:t.scopes.CategoryLabel||"",items:n}:{item_list_name:t.item_list_name,search_term:t.search_term||"",items:n})},d=e=>{const t=e.ecommerce||{};i("add_to_cart",{value:t.value,items:t.items||[]})},f=e=>{e&&e.event&&("view_item"===e.event&&c("vi","view_item",l),"view_promotion"===e.event&&c("vp","view_promotion",u),"luigisbox_view_item_list"===e.event&&c("vl","luigisbox_view_item_list",m),"luigisbox_add_to_cart"===e.event&&c("ac","luigisbox_add_to_cart",d))};window.dataLayer=window.dataLayer||[];const v=window.dataLayer.push.bind(window.dataLayer);window.dataLayer.push=function(){for(let e=0;ef(a(e)))})();