let dp_eventsToCheck=["add_to_cart","view_item","login","sign_up","view_cart","begin_checkout","remove_from_cart","view_item_list","select_item","add_to_wishlist","view_promotion","select_promotion","add_payment_info","add_shipping_info","refund"],dp_eventsForUpgates={"cart.add":"add_to_cart","cart.remove":"remove_from_cart","checkout.initiate":"begin_checkout","checkout.payment.select":"add_payment_info","checkout.shipment.select":"add_shipping_info"};var dp_xdataSent=!1;let dp_lastTrackedUrl=window.location.href;window.index_conversion=window.index_conversion||{},window.index_conversion.automatic_event=window.index_conversion.automatic_event||[];var dp_shopType,dp_dataProcessed=!1,urlForErrors="https://n8n.advisio.cz/webhook/cc0a1f34-d512-46b6-b8ad-f60750a019ea",dp_cbLastTransactionId=null,dp_debug=!1,dp_logOriginalPush=null;function dp_log(e,t){try{if(!(dp_debug||window.dp_config&&window.dp_config.debug))return;window.dataLayer=window.dataLayer||[];var n={event:"dp_"+e,dp_timestamp:(new Date).toISOString()};null!=t&&(n.dp_detail=t),dp_logOriginalPush?dp_logOriginalPush.call(window.dataLayer,n):Array.prototype.push.call(window.dataLayer,n)}catch(e){}}function dp_isCbPurchaseEventName(e){const t=String(e||"").trim();return/^EEpurchase(?:[A-Za-z]{2})?$/.test(t)}function dp_getConfigFromLocalStorage(){try{if("undefined"==typeof window)return null;const e=window.localStorage;if(!e||"function"!=typeof e.getItem)return null;const t=e.getItem("dp_config")||e.getItem("dpConfig")||e.getItem("dataplus_config")||e.getItem("dataPlus_config");if(!t||"string"!=typeof t)return null;const n=JSON.parse(t);return n&&"object"==typeof n?n:null}catch(e){return null}}function dp_getConfig(){const e=window.dp_config&&"object"==typeof window.dp_config?window.dp_config:null,t=dp_getConfigFromLocalStorage();return e&&t?{...t,...e}:e||(t||{})}function dp_hasDpConfig(){try{const e="undefined"!=typeof window&&window.dp_config&&"object"==typeof window.dp_config?window.dp_config:null;if(e&&Object.keys(e).length>0)return!0;if("undefined"==typeof window)return!1;const t=window.localStorage;if(!t||"function"!=typeof t.getItem)return!1;const n=t.getItem("dp_config")||t.getItem("dpConfig")||t.getItem("dataplus_config")||t.getItem("dataPlus_config");return"string"==typeof n&&n.trim().length>0}catch(e){return!1}}function dp_clearDpConfigStorage(){try{if("undefined"==typeof window)return;const e=window.localStorage;if(!e||"function"!=typeof e.removeItem)return;const t=["dp_config","dpConfig","dataplus_config","dataPlus_config"];for(let n=0;n<t.length;n++)try{e.removeItem(t[n])}catch(e){}}catch(e){}}function dp_cfgString(e){return"string"==typeof e&&e.trim()?e.trim():""}function dp_getDlTypePreference(){const e=dp_getConfig();return dp_cfgString(e.dl_type||e.dlType)}function dp_dlTypeAllowed(e){const t=dp_getConfig(),n=t.dl_type||t.dlType;if(null==n||""===n)return!0;if(Array.isArray(n)){for(var r=0;r<n.length;r++)if(String(n[r]).trim()===String(e))return!0;return!1}if("string"==typeof n&&-1!==n.indexOf(",")){for(var i=n.split(",").map((function(e){return String(e).trim()})).filter(Boolean),o=0;o<i.length;o++)if(i[o]===String(e))return!0;return!1}const a=dp_cfgString(n);return!a||String(a)===String(e)}function dp_getPurchaseEventNames(){const e=dp_getConfig(),t=e.purchase_change||e.purchaseChange||e.purchase_event||e.purchaseEvent;return"string"==typeof t&&t.trim()?[t.trim()]:Array.isArray(t)&&t.length?t.map((e=>String(e).trim())).filter(Boolean):["purchase","purchase_stape"]}function dp_isPurchaseEventName(e){const t=String(e||"").trim();if(!t)return!1;const n=dp_getPurchaseEventNames();for(let e=0;e<n.length;e++)if(t===n[e])return!0;return!1}function dp_toFiniteNumber(e){if(null==e)return null;if("number"==typeof e)return isFinite(e)?e:null;const t=String(e).trim();if(!t)return null;const n=t.replace(/\s+/g,"").replace(",","."),r=Number(n);return isFinite(r)?r:null}function dp_getByDotPath(e,t){if(!e||"object"!=typeof e)return;const n=String(t||"").trim();if(!n)return;if(-1===n.indexOf("."))return e[n];const r=n.split(".").filter(Boolean);let i=e;for(let e=0;e<r.length;e++){if(!i||"object"!=typeof i)return;i=i[r[e]]}return i}function dp_resolveRelativePath(e,t){const n=dp_cfgString(t);if(!n)return;let r=n,i=0;for(;r.startsWith("../");)i++,r=r.slice(3);const o=Math.min(i,Math.max(0,(e?.length||1)-1)),a=Array.isArray(e)&&e.length>0?e[o]:null;return a&&"object"==typeof a?r?dp_getByDotPath(a,r):a:void 0}function dp_getPurchaseDecimals(){const e=dp_getConfig(),t=e.purchase_decimals??e.purchaseDecimals,n=Number(t);return Number.isFinite(n)&&n>=0&&n<=6?n:2}function dp_isPathOnlySpec(e){const t=dp_cfgString(e);return!!t&&(!t.includes("(")&&!t.includes(")")&&(!t.includes("**")&&!/[+\-*/%]/.test(t)))}function dp_tokenizeExpr(e){const t=String(e||"").replace(/\s+/g,""),n=[];let r=0;const i=e=>e>="0"&&e<="9",o=e=>e>="a"&&e<="z"||e>="A"&&e<="Z"||"_"===e||"."===e||"/"===e,a=e=>o(e)||i(e);for(;r<t.length;){const e=t[r];if(i(e)||"."===e&&i(t[r+1])){let e=r+1;for(;e<t.length&&(i(t[e])||"."===t[e]);)e++;n.push({t:"num",v:t.slice(r,e)}),r=e}else if("("!==e&&")"!==e)if("+-*/%".includes(e))"*"===e&&"*"===t[r+1]?(n.push({t:"op",v:"**"}),r+=2):(n.push({t:"op",v:e}),r++);else{if(!o(e))return null;{let e=r+1;for(;e<t.length&&a(t[e]);)e++;n.push({t:"id",v:t.slice(r,e)}),r=e}}else n.push({t:"par",v:e}),r++}return n}function dp_toRpn(e){const t=[],n=[],r={"u-":5,"**":4,"*":3,"/":3,"%":3,"+":2,"-":2},i={"**":!0,"u-":!0};let o="start";for(let a=0;a<e.length;a++){const c=e[a];if("num"!==c.t&&"id"!==c.t)if("par"!==c.t||"("!==c.v)if("par"!==c.t||")"!==c.v){if("op"!==c.t)return null;{let e=c.v;"-"!==e||"start"!==o&&"op"!==o&&"("!==o||(e="u-");const a={t:"op",v:e};for(;n.length;){const e=n[n.length-1];if("op"!==e.t)break;const o=r[a.v],c=r[e.v];if(void 0===o||void 0===c)return null;if(!(i[a.v]?o<c:o<=c))break;t.push(n.pop())}n.push(a),o="op"}}else{for(;n.length&&("par"!==n[n.length-1].t||"("!==n[n.length-1].v);)t.push(n.pop());if(!n.length)return null;n.pop(),o=")"}else n.push(c),o="(";else t.push(c),o=c.t}for(;n.length;){const e=n.pop();if("par"===e.t)return null;t.push(e)}return t}function dp_evalRpn(e,t,n){const r=[],i=e=>{const r=String(e||"");if(!r)return null;if("value"===r.toLowerCase())return dp_toFiniteNumber(n);return dp_toFiniteNumber(dp_resolveRelativePath(t,r))};for(let t=0;t<e.length;t++){const n=e[t];if("num"!==n.t)if("id"!==n.t){if("op"!==n.t)return null;{if("u-"===n.v){if(r.length<1)return null;r.push(-r.pop());continue}if(r.length<2)return null;const e=r.pop(),t=r.pop();let i;switch(n.v){case"+":i=t+e;break;case"-":i=t-e;break;case"*":i=t*e;break;case"/":i=t/e;break;case"%":i=t%e;break;case"**":i=Math.pow(t,e);break;default:return null}if(!isFinite(i))return null;r.push(i)}}else{const e=i(n.v);if(null===e)return null;r.push(e)}else{const e=dp_toFiniteNumber(n.v);if(null===e)return null;r.push(e)}}return 1!==r.length?null:r[0]}function dp_computeFromSpec(e,t,n){const r=dp_cfgString(e);if(!r)return null;if(dp_isPathOnlySpec(r)){const e=dp_resolveRelativePath(t,r);return void 0===e?null:e}const i=dp_tokenizeExpr(r);if(!i)return null;const o=dp_toRpn(i);if(!o)return null;const a=dp_evalRpn(o,t,n);if(null===a)return null;const c=dp_getPurchaseDecimals();return Number(a).toFixed(c)}function dp_getPurchaseFieldsConfig(){const e=dp_getConfig(),t=(e.purchase_fields&&"object"==typeof e.purchase_fields?e.purchase_fields:null)||(e.purchaseFields&&"object"==typeof e.purchaseFields?e.purchaseFields:null)||{},n=dp_cfgString(e.value);return n&&!Object.prototype.hasOwnProperty.call(t,"value")&&(t.value=n),t}function dp_getPurchaseItemsConfig(){const e=dp_getConfig();return(e.purchase_items&&"object"==typeof e.purchase_items?e.purchase_items:null)||(e.purchaseItems&&"object"==typeof e.purchaseItems?e.purchaseItems:null)}function dp_transformPurchaseItems(e,t,n){if(!Array.isArray(e))return[];const r=(t||"ga4").toLowerCase();if("dp"===r)return e.map((e=>e&&"object"==typeof e?e:null)).filter(Boolean);if("map"===r){const t=n&&"object"==typeof n?n.map:null;return t&&"object"==typeof t?e.map((e=>e&&"object"==typeof e?e:null)).filter(Boolean).map((e=>{const n={};return Object.keys(t).forEach((r=>{const i=t[r];if("string"!=typeof i||!i.trim())return;const o=dp_getByDotPath(e,i.trim());null!=o&&""!==String(o).trim()&&(n[r]="lp"===r?Number(o):String(o))})),Object.keys(n).length?n:null})).filter(Boolean):[]}const i=transformItemsObject(e);return Array.isArray(i)?i:[]}function dp_applyPurchaseConfig(e,t,n,r,i){try{const o=dp_getPurchaseFieldsConfig(),a={name:!0,version:!0,items:!0};o&&"object"==typeof o&&Object.keys(o).forEach((r=>{if(!r||a[r])return;const i=dp_computeFromSpec(o[r],t,n);if(null==i)return;if("transaction_id"===r||"transactionId"===r){const t=String(i||"").trim();return void(t&&(e.transaction_id=t))}if("currency"===r){const t=String(i||"").trim();return void(t&&(e.currency=t))}if("value"===r||"tax"===r||"shipping"===r||"order_profit"===r){const t=dp_toFiniteNumber(i);if(null!==t){const n=dp_getPurchaseDecimals();e[r]=String(Number(t).toFixed(n))}else e[r]=String(i);return}const c=String(i);""!==c&&(e[r]=c)}));const c=dp_getPurchaseItemsConfig();if(c&&"object"==typeof c){const n=dp_cfgString(c.path||c.items_path||c.itemsPath),o=dp_cfgString(c.mode)||"ga4";let a=null;if(n){const e=dp_resolveRelativePath(t,n);Array.isArray(e)&&(a=e)}!a&&Array.isArray(r)&&(a=r);const s=dp_transformPurchaseItems(a,o,c);Array.isArray(s)&&s.length>0?e.items=s:Array.isArray(i)&&(e.items=i)}}catch(e){dp_reportError(e,{where:"dp_processTransaction"})}}function dp_buildCbPurchaseEvent(e){if(!e||"object"!=typeof e)return null;if(!dp_isCbPurchaseEventName(e.event))return null;const t=e.ecommerce&&"object"==typeof e.ecommerce?e.ecommerce:null;if(!t)return null;const n=t.purchase&&"object"==typeof t.purchase?t.purchase:{},r=n.actionField&&"object"==typeof n.actionField?n.actionField:{},i=null!=r.id?String(r.id):"";if(!i)return null;const o=null!=t.currencyCode?String(t.currencyCode):null!=r.currency?String(r.currency):tldToCurrency(),a=null!=r.revenue&&""!==String(r.revenue)?String(r.revenue):"0",c=Array.isArray(t.products)?t.products:[],s=c.map((function(e){const t=e||{};if(!t||"object"!=typeof t)return null;const n={};null!=t.id&&String(t.id)&&(n.id=String(t.id)),"string"==typeof t.name&&t.name&&(n.nm=trimString(t.name)),null!=t.price&&""!==String(t.price)&&(n.pr=String(t.price)),null!=t.quantity&&""!==String(t.quantity)&&(n.qt=String(t.quantity)),null!=t.brand&&String(t.brand)&&(n.br=String(t.brand)),null!=t.variant&&String(t.variant)&&(n.va=String(t.variant));let r=null;if("string"==typeof t.category?r=t.category.split("|"):Array.isArray(t.category)&&(r=t.category),Array.isArray(r))for(let e=0;e<r.length;e++){const t=r[e]?String(r[e]).trim():"";if(!t)continue;n[0===e?"ca":"c"+(e+1)]=trimString(t)}return Object.keys(n).length>0?n:null})).filter(Boolean),d={name:"purchase",currency:o,transaction_id:i,version:"custom_cb",value:a,items:s};return null!=r.affiliation&&""!==String(r.affiliation)&&(d.affiliation=String(r.affiliation)),null!=r.shipping&&""!==String(r.shipping)&&(d.shipping=String(r.shipping)),null!=r.coupon&&""!==String(r.coupon)&&(d.coupon=String(r.coupon)),dp_applyPurchaseConfig(d,[r,n,t,e],a,c,s),d}function dp_getCustomPurchaseRootPath(){const e=dp_getConfig();return dp_cfgString(e.purchase_data_path||e.purchaseDataPath||e.purchase_custom_path||e.purchaseCustomPath||e.purchase_path||e.purchasePath)||"purchase"}function dp_buildCustomDlPurchaseEvent(e){try{if(!e||"object"!=typeof e)return null;if(!dp_isPurchaseEventName(e.event))return null;const t=dp_getCustomPurchaseRootPath(),n="."===t?e:dp_getByDotPath(e,t);if(!n||"object"!=typeof n)return null;const r=null!=n.id?String(n.id):null!=n.transaction_id?String(n.transaction_id):null!=n.transactionId?String(n.transactionId):"",i=null!=n.currency&&String(n.currency).trim()?String(n.currency):tldToCurrency(),o=null!=n.totalWithVat?n.totalWithVat:null!=n.total?n.total:null!=n.value?n.value:0,a=dp_toFiniteNumber(o),c=String(null!==a?Number(a).toFixed(dp_getPurchaseDecimals()):o||"0"),s=Array.isArray(n.products)?n.products:Array.isArray(n.items)?n.items:[],d=s.map((function(e){const t=e||{};if(!t||"object"!=typeof t)return null;const n={};null!=t.idProduct&&String(t.idProduct)?n.id=String(t.idProduct):null!=t.id&&String(t.id)?n.id=String(t.id):null!=t.code&&String(t.code)?n.id=String(t.code):null!=t.productCode&&String(t.productCode)&&(n.id=String(t.productCode)),null!=t.name&&String(t.name)&&(n.nm=trimString(String(t.name))),null!=t.priceWithVat&&""!==String(t.priceWithVat)?n.pr=String(t.priceWithVat):null!=t.price&&""!==String(t.price)&&(n.pr=String(t.price)),null!=t.quantity&&""!==String(t.quantity)&&(n.qt=String(t.quantity)),null!=t.producer&&String(t.producer)&&(n.br=String(t.producer)),null!=t.variationName&&String(t.variationName)?n.va=String(t.variationName):null!=t.variationCode&&String(t.variationCode)&&(n.va=String(t.variationCode));const r=Array.isArray(t.categoryMain)?t.categoryMain:Array.isArray(t.category)?t.category:null;if(Array.isArray(r))for(let e=0;e<r.length;e++){const t=r[e]&&null!=r[e].name?String(r[e].name).trim():"";if(!t)continue;n[0===e?"ca":"c"+(e+1)]=trimString(t)}return Object.keys(n).length?n:null})).filter(Boolean),p={name:"purchase",currency:i,transaction_id:r,version:"dataLayer_custom",value:c,items:d};dp_applyPurchaseConfig(p,[n,e],o,s,d);return String(p.transaction_id||"").trim()?p:null}catch(e){return dp_reportError(e,{where:"dp_processTransaction"}),null}}function dp_processCbPurchase(e){try{dp_shopType="custom_cb",dp_log("processCbPurchase",{event:e&&e.event});const t=dp_buildCbPurchaseEvent(e);if(!t)return dp_log("processCbPurchase_no_event"),!1;if(dp_cbLastTransactionId&&dp_cbLastTransactionId===t.transaction_id)return!0;window.index_conversion=window.index_conversion||{},window.index_conversion.automatic_event=window.index_conversion.automatic_event||[],dp_xdataSent=!1,window.index_conversion.automatic_event=[],index_conversion.automatic_event=[],index_conversion.automatic_event.push(t),window.index_conversion.__dp_forceBody=!0,dp_sendData();try{delete window.index_conversion.__dp_forceBody}catch(e){}return dp_cbLastTransactionId=t.transaction_id,dp_clearDpConfigStorage(),!0}catch(e){return dp_reportError(e,{where:"dp_processCbPurchase",shopType:"custom_cb",location:window.location.href}),!1}}function isBotUA(e){if(!e)return!1;e=String(e).toLowerCase();return["googlebot","adsbot","adsbot-google","mediapartners-google","bingbot","duckduckbot","slurp","baiduspider","yandexbot","facebot","ia_archiver","semrush","ahrefsbot","mj12bot","screaming frog","lighthouse","chrome-lighthouse","pagespeed","google-inspectiontool","gtmetrix","uptimerobot","headlesschrome","puppeteer","phantomjs","crawler","spider","bot/","bot "].some((function(t){return-1!==e.indexOf(t)}))}var _cs=document.currentScript&&document.currentScript.src||"",dp_scriptURL=_cs?-1!==_cs.indexOf("myshoptet.com")?window.location.href:_cs:window.location.href;function sendData(){dp_xdataSent=!1,dp_sendData()}function dp_sendData(){if(dp_xdataSent)dp_log("sendData_skipped",{reason:"dp_xdataSent=true"});else try{var e=[];try{window.index_conversion&&Array.isArray(window.index_conversion.automatic_event)&&(e=window.index_conversion.automatic_event.map((function(e){return e&&e.name?e.name:"unknown"})))}catch(e){}dp_log("sendData",{events:e,count:e.length});var t=new URL(dp_scriptURL).origin;window.index_conversion=window.index_conversion||{};var n="undefined"!=typeof window&&window.screen&&window.screen.width&&window.screen.height?window.screen.width+"x"+window.screen.height:"unknown";if(index_conversion.currentURL=window.location.href||"",window.location.href.includes("cfpm_ref"))try{const e=new URLSearchParams(window.location.search).get("cfpm_ref");index_conversion.referrerURL=e?decodeURIComponent(e):document.referrer||""}catch(r){index_conversion.referrerURL=document.referrer||""}else index_conversion.referrerURL=document.referrer||"";index_conversion.titleURL=document.title||"",index_conversion.screen_resolution=n||"",index_conversion.language=("undefined"!=typeof navigator&&"string"==typeof navigator?.language?navigator.language:"cs-cz").toLowerCase(),index_conversion.mobile="undefined"!=typeof navigator&&(navigator.userAgentData?.mobile??/Mobi|Android/i.test(navigator?.userAgent||"")),index_conversion.version="4",index_conversion.cookie=getSpecificCookies();var r=t,i=0;if(window.index_conversion.automatic_event&&window.index_conversion.automatic_event.length>0)for(var o=0;o<index_conversion.automatic_event.length;o++)index_conversion.automatic_event[o].items&&(i+=index_conversion.automatic_event[o].items.length);var a=window.index_conversion&&!0===window.index_conversion.__dp_forceBody;if(a)try{delete window.index_conversion.__dp_forceBody}catch(e){}var c=JSON.stringify(index_conversion),s=`z=${(new Date).getTime()}`,d=a||i>2;if(!d)for(var p in index_conversion)if(index_conversion.hasOwnProperty(p)){var u=index_conversion[p];"object"==typeof u&&null!==u&&(u=JSON.stringify(u)),s+="&"+encodeURIComponent(p)+"="+encodeURIComponent(u)}var l=r+"/index_gv3/?"+s+"&img=true",_=function(){var e=new XMLHttpRequest;e.open(d?"POST":"GET",l,!0),e.setRequestHeader("Content-Type","text/plain"),e.onreadystatechange=function(){e.readyState===XMLHttpRequest.DONE&&(e.status>=200&&e.status<300||444===e.status?console.log("XHR success: ",e.status):(console.error(`XHR error: ${e.status} ${e.statusText} -> fallback to image`),g()))},e.onerror=function(){console.error(`XHR onerror: ${e.status} ${e.statusText} -> fallback to image`),g()},e.send(d?c:null)},g=function(){try{(new Image).src=l}catch(e){console.error("Image request error:",e),dp_reportError(e,{where:"sendUsingImage"})}};window.fetch?fetch(l,{method:d?"POST":"GET",mode:"no-cors",headers:{"Content-Type":"text/plain"},body:d?c:null,cache:"no-store"}).catch((function(e){console.error("Fetch error:",e),_()})):_(),dp_xdataSent=!0,window.index_conversion&&Array.isArray(window.index_conversion.automatic_event)&&(window.index_conversion.automatic_event=[])}catch(e){console.error("Error in try block:",e),dp_reportError(e,{where:"dp_sendData"})}}function dp_reportError(e,t){try{dp_log("reportError",{where:t&&t.where,message:e&&e.message});if(isBotUA("undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent:""))return;if(!t||!t.where)return void console.warn("[DataPlus] Error without context - ignoring:",e);if(!["dp_sendData","sendUsingImage","sendUsingXHR","sendUsingFetch","dp_checkAndSendAiOverview","history.wrapper","event_listeners.wrapper","transformItemsObject","processShoptetEvents","processGA4DataLayerEvent","processGtagEvent","setupGtagWrapper","upgates.event_handler","dp_processTransaction","dp_sendCustomEvent","dp_processCbPurchase"].includes(t.where))return void console.warn("[DataPlus] Error from unknown context - ignoring:",t.where,e);let n="",r="",i="";e&&"object"==typeof e?(n=String(e.message||""),r=String(e.stack||""),i=e.name||typeof e):(n=String(e),i="Error");let o=null,a=0;try{if(window.index_conversion?.automatic_event?.length>0){a=window.index_conversion.automatic_event.length;const e=window.index_conversion.automatic_event[a-1];o=e?.name||null}}catch(e){}const c="string"==typeof dp_scriptURL?dp_scriptURL:"undefined"!=typeof location?location.href:"",s="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent:"Unknown",d="undefined"!=typeof navigator&&navigator.language?navigator.language:"Unknown",p={fetch:"function"==typeof window.fetch,xhr:"function"==typeof window.XMLHttpRequest,image:"function"==typeof window.Image},u={online:"undefined"!=typeof navigator?navigator.onLine:null};try{const e=navigator.connection||navigator.mozConnection||navigator.webkitConnection;e&&(u.type=e.effectiveType||e.type||null,u.rtt=e.rtt||null,u.downlink=e.downlink||null)}catch(e){}const l={readyState:"undefined"!=typeof document?document.readyState:null,visibilityState:"undefined"!=typeof document?document.visibilityState:null};let _="*🚨 DataPlus Script Error fix*\n\n";if(_+=`*${i}:* \`${n}\`\n\n`,r&&(_+=`*Stack Trace:*\n\`\`\`\n${r}\n\`\`\`\n\n`),t||o||dp_shopType){if(_+="*Context:*\n",t?.where&&(_+=`  • where: ${t.where}\n`),o&&(_+=`  • processing_event: ${o}\n`),dp_shopType&&(_+=`  • shop_type: ${dp_shopType}\n`),t){const e={...t};delete e.where,Object.entries(e).forEach((([e,t])=>{null!=t&&("failures"===e&&Array.isArray(t)?(_+="  • failures:\n",t.forEach(((e,t)=>{_+=`    ${t+1}. Transport: ${e.step||"unknown"}\n`,e.name&&(_+=`       Error Type: ${e.name}\n`),e.message&&(_+=`       Message: ${e.message}\n`),e.extra&&(_+=`       Details: ${JSON.stringify(e.extra)}\n`)}))):_+=`  • ${e}: ${"object"==typeof t?JSON.stringify(t):t}\n`)}))}_+="\n"}_+="*Environment:*\n",_+=`  • Browser: fetch=${p.fetch}, xhr=${p.xhr}, img=${p.image}\n`,_+=`  • Network: online=${u.online}`,u.type&&(_+=`, type=${u.type}`,u.rtt&&(_+=`, rtt=${u.rtt}ms`)),_+="\n",_+=`  • Page: ${l.readyState}, visibility=${l.visibilityState}\n`,_+=`  • State: dp_xdataSent=${dp_xdataSent}, event_count=${a}\n\n`,_+=`*URL:* ${c}\n`,_+=`*User Agent:* ${s}\n`,_+=`*Language:* ${d}`;const g={text:_},m="string"==typeof urlForErrors&&urlForErrors?urlForErrors:"string"==typeof REPORT_URL&&REPORT_URL?REPORT_URL:"";if(!m)return;fetch(m,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(g),mode:"cors",keepalive:!0}).catch((e=>{console.error("Error reporting failed:",e)}))}catch(e){console.error("dp_reportError failed:",e)}}function dp_sendCustomEvent(e){try{if(!e||"object"!=typeof e)return;if(!e.event||"string"!=typeof e.event)return;dp_log("sendCustomEvent",{event:e.event}),window.index_conversion=window.index_conversion||{},window.index_conversion.automatic_event=window.index_conversion.automatic_event||[],dp_xdataSent=!1,window.index_conversion.automatic_event=[];const t={name:e.event,version:"custom"};e.user_data&&"object"==typeof e.user_data&&(window.index_conversion.user_data=window.index_conversion.user_data||{},Object.keys(e.user_data).forEach((t=>{const n=e.user_data[t];null!=n&&(window.index_conversion.user_data[t]="number"==typeof n?n:String(n))})));const n={};Object.keys(e).forEach((t=>{if("event"===t||"user_data"===t)return;const r=e[t];null!=r&&(n[t]="number"==typeof r?r:String(r))})),Object.keys(n).length>0&&(t.event_data=n),window.index_conversion.automatic_event.push(t),dp_sendData()}catch(t){dp_reportError(t,{where:"dp_sendCustomEvent",payload:e})}}function tldToCurrency(){var e=window.location.hostname.split("."),t="",n="",r="CZK";return 2===e.length?(t=e[0],n=e[1]):3===e.length?(t=e[1],n=e[2]):e.length>3&&(t=e[e.length-2],n=e[e.length-1]),"nedeto"===(t=t.toLowerCase())||"maluna"===t||"trenirkaren"===t?r="CZK":"sk"===n?r="EUR":"pl"===n?r="PLN":"hu"===n&&(r="HUF"),r}function trimString(e){return e.replace(/[\n\t]/g,"").trim()}function getSpecificCookies(){var e=["_ga","_fbp","_fbc","d5b8v3a2d7v3","_gcl_aw"],t=[],n=[];try{n=document?.cookie?.split(";")||[]}catch(e){n=[]}for(var r=0;r<n.length;r++){var i=n[r].trim().split("="),o=i[0],a=i[1]||"";e.includes(o)&&("_gcl_aw"===o&&3===a.split(".").length?t.push(o+"="+a.split(".")[2]):t.push(o+"="+a))}return t.join("; ")}window.dp_sendCustomEvent=window.dp_sendCustomEvent||dp_sendCustomEvent,function e(){try{if(dp_log("checkAiOverview",{referrer:document.referrer||""}),!document.referrer?.includes(".google."))return;const e="undefined"!=typeof performance&&"function"==typeof performance.getEntries&&performance.getEntries().length>0&&performance.getEntries()[0]||null,t=(e&&e.name||window.location.href).match(/#:~:text=([^&]*)/);if(t?.[1]){const e=decodeURIComponent(t[1]).normalize("NFD").replace(/[\u0300-\u036f\u2013]/g,"");window.index_conversion=window.index_conversion||{},window.index_conversion.automatic_event=window.index_conversion.automatic_event||[],window.index_conversion.automatic_event.push({name:"ai_overview",ai_overview_text:e}),dp_xdataSent=!1,dp_sendData()}}catch(e){dp_reportError(e,{where:"dp_checkAndSendAiOverview"})}window.dp_checkAndSendAiOverview=e}();try{!function(e){const t=e.pushState,n=e.replaceState,r=e=>{if(!e)return;const t=new URL(e,window.location.href).href;t!==dp_lastTrackedUrl&&(dp_log("historyChange",{from:dp_lastTrackedUrl,to:t}),dp_lastTrackedUrl=t,dp_xdataSent=!1,dp_sendData(),setTimeout((()=>dp_processTransaction()),500))};e.pushState=function(){return r(arguments[2]),t.apply(e,arguments)},e.replaceState=function(){return r(arguments[2]),n.apply(e,arguments)},window.addEventListener("popstate",(function(){r(window.location.href)}))}(window.history)}catch(e){dp_reportError(e,{where:"history.wrapper"})}try{dp_sendData(),document.addEventListener("DOMContentLoaded",dp_sendData),"undefined"!=typeof window&&"function"==typeof window.addEventListener&&(window.addEventListener("load",dp_sendData),window.addEventListener("beforeunload",dp_sendData))}catch(e){console.error("Error in try block:",e),dp_reportError(e,{where:"event_listeners.wrapper"})}!function(){function e(e){try{/(?:^|;\s*)_ga=/.test(document.cookie||"")||console.warn("Cookie '_ga' not found via document.cookie"+(e?" â€“ "+e:""))}catch(e){console.warn("document.cookie access failed:",e)}}try{const t="undefined"!=typeof window&&window.cookieStore||null;if(!t||"function"!=typeof t.get)return void e("cookieStore not available");const n=e=>{try{const r=e&&e.changed||[];for(let e=0;e<r.length;e++){const i=r[e];if(i&&"_ga"===i.name){dp_xdataSent=!1,dp_sendData();try{t.removeEventListener("change",n)}catch(e){}break}}}catch(e){console.warn("cookieStore change handler error:",e)}};let r;try{r=t.get("_ga")}catch(t){return console.warn("cookieStore.get threw synchronously:",t),void e("cookieStore.get sync error")}r.then((e=>{try{if(!e||!e.value)try{t.addEventListener("change",n)}catch(e){console.warn("cookieStore.addEventListener failed:",e)}}catch(e){console.warn("cookieStore then-block failed:",e)}})).catch((t=>{console.warn("cookieStore.get rejected:",t),e("cookieStore.get rejected")}))}catch(t){console.warn("cookieStore block failed:",t),e("cookieStore block exception")}}();const transformItemsObject=e=>{try{if(Array.isArray(e)){let t=[];return e.forEach((e=>{if(!e||"object"!=typeof e)return;let n={};if((e.item_brand||e.brand)&&(n.br=e.item_brand||e.brand),e.item_id?n.id=e.item_id.toString():e.option?.id?n.id=String(e.option.id):e.id&&(n.id=String(e.id)),(e.item_name||e.title)&&(n.nm=e.item_name||e.title),e.quantity&&(n.qt=e.quantity.toString()),e.price)if("object"==typeof e.price){const t="undefined"!=typeof upgates&&upgates&&upgates.settings&&upgates.settings.conversionPricesWithVat;n.pr=t&&e.price&&e.price.withVat?e.price.withVat.toString():e.price&&e.price.withoutVat?e.price.withoutVat.toString():"0"}else n.pr=e.price.toString();let r=1;Object.keys(e).forEach((t=>{t.includes("item_category")&&(1===r?n.ca=e[t]:n[`c${r}`]=e[t],r++)})),t.push(n)})),t}}catch(e){dp_reportError(e,{where:"transformItemsObject"})}},dp_enrichmentTtlMs=5e3,dp_enrichmentCache=new Map;function dp_enrichmentNow(){return Date.now()}function dp_enrichmentPrune(){const e=dp_enrichmentNow();for(const[t,n]of dp_enrichmentCache.entries())(!n||!n.t||e-n.t>dp_enrichmentTtlMs)&&dp_enrichmentCache.delete(t)}function dp_enrichmentSet(e,t){e&&dp_enrichmentCache.set(e,{t:dp_enrichmentNow(),data:t||{}})}function dp_enrichmentGet(e){if(!e)return null;const t=dp_enrichmentCache.get(e);return t?dp_enrichmentNow()-t.t>dp_enrichmentTtlMs?(dp_enrichmentCache.delete(e),null):t.data||null:null}function dp_setIfMissing(e,t,n){e&&(void 0!==e[t]&&null!==e[t]&&""!==e[t]||null!=n&&""!==n&&(e[t]=n))}function dp_extractEnrichmentFromParams(e){const t=e||{},n={};t.payment_type&&(n.payment_type=String(t.payment_type)),t.shipping_tier&&(n.shipping_tier=String(t.shipping_tier)),t.coupon&&(n.coupon=String(t.coupon)),t.item_list_id&&(n.item_list_id=String(t.item_list_id)),t.item_list_name&&(n.item_list_name=String(t.item_list_name)),t.promotion_id&&(n.promotion_id=String(t.promotion_id)),t.promotion_name&&(n.promotion_name=String(t.promotion_name)),t.creative_name&&(n.creative_name=String(t.creative_name)),t.creative_slot&&(n.creative_slot=String(t.creative_slot)),t.transaction_id&&(n.transaction_id=String(t.transaction_id)),t.affiliation&&(n.affiliation=String(t.affiliation)),void 0===t.tax||null===t.tax||""===t.tax||isNaN(Number(t.tax))||(n.tax=Number(t.tax)),void 0===t.shipping||null===t.shipping||""===t.shipping||isNaN(Number(t.shipping))||(n.shipping=Number(t.shipping)),t.currency&&(n.currency=String(t.currency)),void 0!==t.value&&null!==t.value&&""!==t.value&&(n.value=String(t.value));const r=transformItemsObject(t.items);return Array.isArray(r)&&r.length>0&&(n.items=r),n}function dp_applyEnrichment(e,t,n){try{const r=dp_enrichmentGet(n),i=dp_enrichmentGet(t+"|"),o=r||i;if(!o)return;const a=["payment_type","shipping_tier","coupon","item_list_id","item_list_name","promotion_id","promotion_name","creative_name","creative_slot","transaction_id","affiliation","tax","shipping","currency","value"];for(let t=0;t<a.length;t++){const n=a[t];void 0!==o[n]&&null!==o[n]&&""!==o[n]&&dp_setIfMissing(e,n,o[n])}(!e.items||!Array.isArray(e.items)||0===e.items.length)&&Array.isArray(o.items)&&o.items.length>0&&(e.items=o.items)}catch(e){dp_reportError(e,{where:"processShoptetEvents"})}}const processShoptetEvents=(e,t,n)=>{try{dp_log("processShoptetEvents",{type:t,signature:n});if(!(window.dataLayer&&Array.isArray(window.dataLayer)&&window.dataLayer.length>0&&window.dataLayer[0]&&window.dataLayer[0].shoptet))return!1;if(!t||!dp_eventsToCheck.includes(t))return!1;const r=["add_to_cart","view_item","view_cart","remove_from_cart","view_item_list","select_item","add_to_wishlist","view_promotion","select_promotion","refund"],i=transformItemsObject(e?.[2]?.items),o="string"==typeof n&&n?n:t+"|",a=dp_enrichmentGet(o)||dp_enrichmentGet(t+"|"),c=Array.isArray(i)&&i.length>0?i:a&&Array.isArray(a.items)?a.items:i;if(r.includes(t)){if(!(Array.isArray(c)&&c.length>0&&c.some((e=>e&&"string"==typeof e.id&&e.id))))return!1}dp_xdataSent=!1,index_conversion.automatic_event=[],window.index_conversion=window.index_conversion||{},window.index_conversion.user_data=window.index_conversion.user_data||{},window.index_conversion.user_data.user_type=window.dataLayer[0]&&window.dataLayer[0].shoptet&&window.dataLayer[0].shoptet.customer&&window.dataLayer[0].shoptet.customer.groupId?window.dataLayer[0].shoptet.customer.groupId:0;const s=e?.[2]||{},d={name:t,currency:s?.currency||tldToCurrency(),value:s?.value?.toString()||null,version:"shoptet",items:Array.isArray(c)?c:null},p=dp_extractEnrichmentFromParams(s);return Object.keys(p).forEach((e=>{"items"!==e&&void 0!==p[e]&&null!==p[e]&&""!==p[e]&&(d[e]=p[e])})),dp_applyEnrichment(d,t,o),index_conversion.automatic_event.push(d),window.index_conversion.automatic_event.forEach((e=>{for(const[t,n]of Object.entries(e))null===n&&delete e[t]})),dp_sendData(),!0}catch(e){return dp_reportError(e,{where:"processShoptetEvents"}),!1}};function processGA4DataLayerEvent(e){try{const t=e?.event;if(dp_log("processGA4DataLayerEvent",{eventName:t||null}),!t||!dp_eventsToCheck.includes(t))return;if(dp_isPurchaseEventName(t))return;const n=e?.ecommerce||{};if(!(e?.ecommerce&&e.ecommerce.items))return;if(["add_to_cart","view_item","view_cart","remove_from_cart","view_item_list","select_item","add_to_wishlist","view_promotion","select_promotion","refund"].includes(t)&&(!n.items||!Array.isArray(n.items)||0===n.items.length))return;dp_xdataSent=!1,index_conversion.automatic_event=[];const r=(Array.isArray(n?.items)?n.items:[]).map((function(e){const t={},n=[];for(const t in e)-1!==t?.indexOf("item_category")&&n.push({key:t,value:e?.[t]});for(let e=0;e<n.length;e++){t[0===e?"ca":"c"+(e+1)]=n[e]?.value}return(e?.id||e?.item_id)&&(t.id=String(e?.id||e?.item_id)),(e?.name||e?.item_name)&&(t.nm=trimString(e?.name||e?.item_name)),void 0===e?.price&&void 0===e?.item_price||(t.pr=String(e?.price??e?.item_price)),(e?.quantity||e?.item_quantity)&&(t.qt=String(e?.quantity||e?.item_quantity)),(e?.brand||e?.item_brand)&&(t.br=String(e?.brand||e?.item_brand)),(e?.variant||e?.item_variant)&&(t.va=String(e?.variant||e?.item_variant)),e?.item_list_id&&(t.li=String(e.item_list_id)),e?.item_list_name&&(t.ln=String(e.item_list_name)),void 0===e?.index||isNaN(Number(e.index))||(t.lp=Number(e.index)),t})),i={name:t,version:"dataLayer_GA4",currency:n?.currency||tldToCurrency()};switch(void 0!==n?.value&&(i.value=String(n?.value)),t){case"view_item_list":case"select_item":n?.item_list_id&&(i.item_list_id=String(n?.item_list_id)),n?.item_list_name&&(i.item_list_name=String(n?.item_list_name));break;case"view_promotion":case"select_promotion":n?.promotion_id&&(i.promotion_id=String(n?.promotion_id)),n?.promotion_name&&(i.promotion_name=String(n?.promotion_name)),n?.creative_name&&(i.creative_name=String(n?.creative_name)),n?.creative_slot&&(i.creative_slot=String(n?.creative_slot));break;case"add_payment_info":n?.payment_type&&(i.payment_type=String(n?.payment_type)),n?.coupon&&(i.coupon=String(n?.coupon));break;case"add_shipping_info":n?.shipping_tier&&(i.shipping_tier=String(n?.shipping_tier)),n?.coupon&&(i.coupon=String(n?.coupon));break;case"begin_checkout":n?.coupon&&(i.coupon=String(n?.coupon));break;case"refund":n?.transaction_id&&(i.transaction_id=String(n.transaction_id)),n?.affiliation&&(i.affiliation=String(n.affiliation)),void 0===n?.tax||""===n.tax||isNaN(Number(n.tax))||(i.tax=Number(n.tax)),void 0===n?.shipping||""===n.shipping||isNaN(Number(n.shipping))||(i.shipping=Number(n.shipping)),void 0===n?.value||""===n.value||isNaN(Number(n.value))||(i.value=Number(n.value)),n?.currency&&(i.currency=String(n.currency))}r.length>0&&(i.items=r),index_conversion.automatic_event.push(i),window.index_conversion.automatic_event.forEach((e=>{Object.entries(e).forEach((([t,n])=>{null==n&&delete e[t]}))})),dp_sendData()}catch(t){dp_reportError(t,{where:"processGA4DataLayerEvent",eventName:e?.event})}}const dp_translateUpgatesEvents=(e,t)=>e[t]||null;if(window.upgates&&"object"==typeof window.upgates){if(upgates&&"product"===upgates.pageType&&upgates.product){dp_log("upgates_view_item",{productId:upgates.product.id}),dp_xdataSent=!1,index_conversion.automatic_event=[];const e=upgates.settings&&upgates.settings.conversionPricesWithVat&&upgates.product.price&&upgates.product.price.withVat?upgates.product.price.withVat:upgates.product.price&&upgates.product.price.withoutVat?upgates.product.price.withoutVat:0,t=upgates.settings&&upgates.settings.conversionPricesWithVat&&upgates.product.price&&upgates.product.price.withVat?String(upgates.product.price.withVat):upgates.product.price&&upgates.product.price.withoutVat?String(upgates.product.price.withoutVat):"0";index_conversion.automatic_event.push({name:"view_item",currency:upgates?.currency||tldToCurrency(),value:e,version:"upgates",items:[{id:String(upgates.product.id),nm:trimString(upgates.product.title),pr:t,qt:"1",ca:upgates.product.category&&upgates.product.category.path&&upgates.product.category.path[0]?upgates.product.category.path[0]:null,c2:upgates.product.category&&upgates.product.category.path&&upgates.product.category.path[1]?upgates.product.category.path[1]:null,c3:upgates.product.category&&upgates.product.category.path&&upgates.product.category.path[2]?upgates.product.category.path[2]:null,br:upgates.product.manufacturer||null}]}),dp_sendData(),index_conversion.automatic_event=[]}Object.keys(dp_eventsForUpgates).forEach((e=>{upgates.on(e,(t=>{try{dp_xdataSent=!1,index_conversion.automatic_event=[];const n=dp_translateUpgatesEvents(dp_eventsForUpgates,e);if(!n)return;dp_log("upgates_event",{original:e,converted:n});const r="cart.add"===e||"cart.remove"===e?(upgates&&upgates.settings&&upgates.settings.conversionPricesWithVat&&t&&t.price&&t.price.withVat?t.price.withVat:t&&t.price&&t.price.withoutVat?t.price.withoutVat:0)*(t&&t.quantity?t.quantity:1):upgates&&upgates.cart&&Array.isArray(upgates.cart.products)?upgates.cart.products.map((function(e){return upgates.settings.conversionPricesWithVat?e.price.withVat:e.price.withoutVat})).reduce((function(e,t){return e+t}),0):0;index_conversion.automatic_event.push({name:n,currency:upgates?.currency||tldToCurrency(),value:Number(r).toFixed(2),version:"upgates",items:("cart.add"===e||"cart.remove"===e?transformItemsObject([t]):upgates&&upgates.cart&&upgates.cart.products?transformItemsObject(upgates.cart.products):[])||[]}),window.index_conversion.automatic_event.forEach((e=>{Object.entries(e).forEach((([t,n])=>{null===n&&delete e[t]}))})),dp_sendData(),index_conversion.automatic_event=[]}catch(e){dp_reportError(e,{where:"upgates.event_handler"})}}))}))}let dp_gtagCommandQueue=[],dp_gtagOriginal=null;function processGtagEvent(e,...t){try{if("event"!==e)return;const n=t[0],r=t[1]||{};if(dp_log("processGtagEvent",{eventName:n}),!dp_eventsToCheck.includes(n)||dp_isPurchaseEventName(n))return;const i=["add_to_cart","view_item","view_cart","remove_from_cart","view_item_list","select_item","add_to_wishlist","view_promotion","select_promotion","refund"],o=r.items&&Array.isArray(r.items)&&r.items.length>0,a=r.item_id||r.id||r.item_name||r.name;if(i.includes(n)&&!o&&!a)return;dp_xdataSent=!1,index_conversion.automatic_event=[];let c=[];if(o)c=r.items.map((function(e){const t={},n=[];for(const t in e)-1!==t?.indexOf("item_category")&&n.push({key:t,value:e?.[t]});for(let e=0;e<n.length;e++){t[0===e?"ca":"c"+(e+1)]=n[e]?.value}return(e?.item_id||e?.id)&&(t.id=String(e.item_id||e.id)),(e?.item_name||e?.name)&&(t.nm=trimString(e.item_name||e.name)),void 0!==e?.price&&(t.pr=String(e.price)),e?.quantity&&(t.qt=String(e.quantity)),(e?.item_brand||e?.brand)&&(t.br=String(e.item_brand||e.brand)),(e?.item_variant||e?.variant)&&(t.va=String(e.item_variant||e.variant)),e?.item_list_id&&(t.li=String(e.item_list_id)),e?.item_list_name&&(t.ln=String(e.item_list_name)),void 0===e?.index||isNaN(Number(e.index))||(t.lp=Number(e.index)),t}));else if(a){const e={},t=[];for(const e in r)-1!==e?.indexOf("item_category")&&t.push({key:e,value:r[e]});for(let n=0;n<t.length;n++){e[0===n?"ca":"c"+(n+1)]=t[n]?.value}(r?.item_id||r?.id)&&(e.id=String(r.item_id||r.id)),(r?.item_name||r?.name)&&(e.nm=trimString(r.item_name||r.name)),void 0!==r?.price&&(e.pr=String(r.price)),r?.quantity&&(e.qt=String(r.quantity)),(r?.item_brand||r?.brand)&&(e.br=String(r.item_brand||r.brand)),(r?.item_variant||r?.variant)&&(e.va=String(r.item_variant||r.variant)),c=[e]}const s={name:n,version:"gtag",currency:r?.currency||tldToCurrency()};switch(void 0!==r?.value&&(s.value=String(r.value)),n){case"view_item_list":case"select_item":r?.item_list_id&&(s.item_list_id=String(r.item_list_id)),r?.item_list_name&&(s.item_list_name=String(r.item_list_name));break;case"view_promotion":case"select_promotion":r?.promotion_id&&(s.promotion_id=String(r.promotion_id)),r?.promotion_name&&(s.promotion_name=String(r.promotion_name)),r?.creative_name&&(s.creative_name=String(r.creative_name)),r?.creative_slot&&(s.creative_slot=String(r.creative_slot));break;case"add_payment_info":r?.payment_type&&(s.payment_type=String(r.payment_type)),r?.coupon&&(s.coupon=String(r.coupon));break;case"add_shipping_info":r?.shipping_tier&&(s.shipping_tier=String(r.shipping_tier)),r?.coupon&&(s.coupon=String(r.coupon));break;case"begin_checkout":r?.coupon&&(s.coupon=String(r.coupon));break;case"refund":r?.transaction_id&&(s.transaction_id=String(r.transaction_id)),r?.affiliation&&(s.affiliation=String(r.affiliation)),void 0===r?.tax||isNaN(Number(r.tax))||(s.tax=Number(r.tax)),void 0===r?.shipping||isNaN(Number(r.shipping))||(s.shipping=Number(r.shipping))}c.length>0&&(s.items=c),index_conversion.automatic_event.push(s),window.index_conversion.automatic_event.forEach((e=>{Object.entries(e).forEach((([t,n])=>{null==n&&delete e[t]}))})),dp_sendData()}catch(e){dp_reportError(e,{where:"processGtagEvent",eventName:t[0]})}}function dp_processTransaction(){try{if(dp_log("processTransaction_start",{automatic_event_count:window.index_conversion&&window.index_conversion.automatic_event?window.index_conversion.automatic_event.length:0,dp_dataProcessed:dp_dataProcessed,hasDpConfig:dp_hasDpConfig(),dataLayerLength:window.dataLayer&&window.dataLayer.length||0}),window.index_conversion.automatic_event&&window.index_conversion.automatic_event.length>0&&!window.index_conversion.automatic_event.some((e=>"form_submit"===e.name)))return void dp_log("processTransaction_blocked",{reason:"automatic_event not empty and no form_submit",events:window.index_conversion.automatic_event.map((function(e){return e&&e.name}))});if(dp_dataProcessed)return void dp_log("processTransaction_blocked",{reason:"dp_dataProcessed=true"});if(!dp_hasDpConfig())return void dp_log("processTransaction_blocked",{reason:"no dp_config"});if(window.dataLayer&&Array.isArray(window.dataLayer)){dp_log("processTransaction_scanning",{dataLayerLength:window.dataLayer.length,purchaseEventNames:dp_getPurchaseEventNames()});for(var e=0;e<window.dataLayer.length;e++){const t=window.dataLayer[e];if(!t||"object"!=typeof t)continue;if(t.event&&dp_isCbPurchaseEventName(t.event))continue;if(!dp_isPurchaseEventName(t.event))continue;dp_log("processTransaction_found",{index:e,event:t.event});const n=dp_buildCustomDlPurchaseEvent(t);if(n){dp_log("processTransaction_built",{transaction_id:n.transaction_id,value:n.value,items_count:n.items?n.items.length:0}),dp_shopType="dataLayer_custom",window.index_conversion=window.index_conversion||{},window.index_conversion.automatic_event=window.index_conversion.automatic_event||[],window.index_conversion.automatic_event.push(n);break}dp_log("processTransaction_build_failed",{index:e,event:t.event})}}window.index_conversion.automatic_event&&window.index_conversion.automatic_event.length>0?(dp_log("processTransaction_sending",{events:window.index_conversion.automatic_event.map((function(e){return e&&e.name}))}),dp_xdataSent=!1,dp_sendData(),dp_dataProcessed=!0,dp_clearDpConfigStorage()):dp_log("processTransaction_no_purchase_found")}catch(e){dp_reportError(e,{where:"dp_processTransaction",shopType:dp_shopType,location:window.location.href})}}dp_processTransaction(),document.addEventListener("DOMContentLoaded",(function(){setTimeout((function(){dp_processTransaction()}),100)})),"undefined"!=typeof window&&"function"==typeof window.addEventListener&&window.addEventListener("load",dp_processTransaction),document.addEventListener("DOMContentLoaded",(function(){for(var e=document.querySelectorAll("form"),t=0;t<e.length;t++)e[t].addEventListener("submit",(function(e){!1===window.index_conversion.automatic_event.some((e=>"purchase"===e?.name))&&(window.index_conversion.automatic_event=[]),window.index_conversion.automatic_event.push({name:"form_submit"}),dp_log("formSubmit"),dp_xdataSent=!1,dp_sendData()}))})),function(e){window.dataLayer=window.dataLayer||[];const t=new Map,n=new Map,r=()=>Date.now(),i=()=>{const e=r();for(const[n,r]of t.entries())e-r>2e3&&t.delete(n)},o=e=>{if(!Array.isArray(e)||0===e.length)return[];const t=[];for(let n=0;n<e.length;n++){const r=e[n]||{},i=r.item_id??r.id??(r.option&&r.option.id)??null;if(null!=i){const e=String(i);e&&t.push(e)}}return t},a=e=>{const t=e?.[1]||"",n=e?.[2]||{},r=o(n.items);if(r.length>0)return t+"|"+r.join(",");const i=n.item_id??n.id??(n.option&&n.option.id)??null;return t+"|"+(null!=i?String(i):"")},c=e=>{const t=e?.event||"",n=o(e?.ecommerce?.items);return n.length>0?t+"|"+n.join(","):t+"|"},s=(e,t)=>{if(!e)return;if(n.has(e)){try{clearTimeout(n.get(e))}catch(e){}n.delete(e)}const r=setTimeout((()=>{n.delete(e),i(),dp_enrichmentPrune(),t()}),200);n.set(e,r)},d=o=>{i();var d=[];try{for(var p=0;p<o.length;p++){var u=o[p];u&&u.event?d.push(u.event):u&&"event"===u[0]&&u[1]&&d.push("gtag:"+u[1])}}catch(e){}d.length>0&&dp_log("processBatch",{count:o.length,events:d}),(t=>{try{dp_enrichmentPrune();for(let n=0;n<t.length;n++){const r=t[n],i=r?.[2]?.send_to,o="string"==typeof i&&i.startsWith("AW-");if("event"===r?.[0]&&r?.[1]&&e.includes(r[1])&&!dp_isPurchaseEventName(r[1])&&r[2]&&!o){const e=a(r),t=r[1],n=dp_extractEnrichmentFromParams(r[2]);dp_enrichmentSet(e,n),dp_enrichmentSet(t+"|",n)}else if(r?.event&&e.includes(r.event)&&!dp_isPurchaseEventName(r.event)){const e=c(r),t=r.event,n=r.ecommerce||{},i=dp_extractEnrichmentFromParams({currency:r.currency||n.currency,value:r.value||n.value,items:n.items||r.items,payment_type:n.payment_type,shipping_tier:n.shipping_tier,coupon:n.coupon,item_list_id:n.item_list_id,item_list_name:n.item_list_name,promotion_id:n.promotion_id,promotion_name:n.promotion_name,creative_name:n.creative_name,creative_slot:n.creative_slot,transaction_id:n.transaction_id,affiliation:n.affiliation,tax:n.tax,shipping:n.shipping});dp_enrichmentSet(e,i),dp_enrichmentSet(t+"|",i)}}}catch(e){dp_reportError(e,{where:"event_listeners.wrapper"})}})(o);const l=!!(window.dataLayer&&window.dataLayer[0]&&window.dataLayer[0].shoptet);l&&o.forEach((i=>{const o=i?.[1];if("event"===i?.[0]&&o&&e.includes(o)&&(c=i?.[2]?.send_to,c&&("string"==typeof c?"ga4"===c.toLowerCase():Array.isArray(c)&&c.some((e=>"ga4"===String(e).toLowerCase()))))){const e=a(i);processShoptetEvents(i,o,e)&&(t.set(e,r()),t.set(o+"|",r()),((e,t)=>{if(t&&n.has(t)){try{clearTimeout(n.get(t))}catch(e){}n.delete(t)}if(e)for(const[t,r]of n.entries())if(t===e+"|"||t.startsWith(e+"|")){try{clearTimeout(r)}catch(e){}n.delete(t)}})(o,e))}var c})),o.forEach((n=>{if(dp_isPurchaseEventName(n?.event))return void dp_processTransaction();const r=n?.[2]?.send_to,i="string"==typeof r&&r.startsWith("AW-");if("event"===n?.[0]&&n?.[1]&&e.includes(n[1])&&!dp_isPurchaseEventName(n[1])&&n[2]&&!i){if(l){const e=a(n);if(t.has(e)||t.has(n[1]+"|"))return;return void s(e,(()=>{t.has(e)||t.has(n[1]+"|")||processGtagEvent("event",n[1],n[2])}))}processGtagEvent("event",n[1],n[2])}else if(n?.event&&e.includes(n?.event)){if(l){const e=c(n);if(t.has(e)||t.has(n.event+"|"))return;return void s(e,(()=>{t.has(e)||t.has(n.event+"|")||processGA4DataLayerEvent(n)}))}processGA4DataLayerEvent(n)}}))},p=window.dataLayer;d(p);const u=window.dataLayer.push;dp_logOriginalPush=u,window.dataLayer.push=function(...e){const t=u.apply(this,e);return d(e),t}}(dp_eventsToCheck);