window.__BECHTLE_SERVER_CTX__ = {"country":"BE","language":"en","bid":"47069b00471440b8878c05e25ce27b54_1793344694166_61b26405d105d71ecc47c8912d739ae5","vid":"b70edab1e1bd4c3d86e47ecd90ae6163","user":{"context":"anonymous","xInternal":false,"isInCustomerContext":false,"isInternalUser":false},"tenant":"bechtle","xAbTesting":"art_summary_saving-message_20261020=B;pdp_faq_visibility_20261020=A","environment":"production"};
(function(){"use strict";function U(){document.cookie.indexOf("_dy_cs_gcg")<0&&(!(Math.floor(Math.random()*100)<5)||document.cookie.indexOf("autotest=true")>=0?R("Dynamic Yield Experiences"):R("Control Group"))}function R(e){const n=new Date(Date.now()+3154e10);document.cookie=`_dy_cs_gcg=${e};path=/;expires=${n};`}function S(){document.cookie="_dy_cs_gcg=; path=/; expires=Thu, 01 Jan 1970 00:00:01 GMT;"}function k(){const e={},n={BECHTLE_SERVER_CTX_READY:[],CONSENT_CHANGE:[],PAGE_TYPE_READY:[],GTM_ID_READY:[],PERSISTENCE_ID_CHANGE:[],REALTIME_FILTER_READY:[],BEUS_TRACKING_CTX_READY:[]};return{get currentState(){return e},get listeners(){return n},on(t,o){const i=e[t];i!==void 0&&o(i),n[t].push({listener:o,isOnce:!1})},once(t,o){const i=e[t];if(i!==void 0)return o(i);n[t].push({listener:o,isOnce:!0})},off(t,o){const i=n[t].map(c=>c.listener).indexOf(o);n[t].splice(i,1)},dispatch(t,o){e[t]=o,n[t].forEach(({listener:c})=>{c(o)});const i=n[t].filter(({isOnce:c})=>!c).map(c=>c);n[t]=i},reset(t){e[t]=void 0,n[t].forEach(({listener:o})=>o(void 0))}}}const L=e=>typeof e=="string",N=(e,n,t)=>e&&L(e)?e.split(";").reduce((o,i)=>{const[c,u]=i.split("=").map(l=>l.trim());return o[decodeURIComponent(c)]=decodeURIComponent(u),o},{})[n]:t,a=[];for(let e=0;e<256;++e)a.push((e+256).toString(16).slice(1));function G(e,n=0){return(a[e[n+0]]+a[e[n+1]]+a[e[n+2]]+a[e[n+3]]+"-"+a[e[n+4]]+a[e[n+5]]+"-"+a[e[n+6]]+a[e[n+7]]+"-"+a[e[n+8]]+a[e[n+9]]+"-"+a[e[n+10]]+a[e[n+11]]+a[e[n+12]]+a[e[n+13]]+a[e[n+14]]+a[e[n+15]]).toLowerCase()}let m;const H=new Uint8Array(16);function Y(){if(!m){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");m=crypto.getRandomValues.bind(crypto)}return m(H)}var b={randomUUID:typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function B(e,n,t){var i,c,u;if(b.randomUUID&&!n&&!e)return b.randomUUID();e=e||{};const o=(u=(c=e.random)!=null?c:(i=e.rng)==null?void 0:i.call(e))!=null?u:Y();if(o.length<16)throw new Error("Random bytes length must be >= 16");if(o[6]=o[6]&15|64,o[8]=o[8]&63|128,n){if(t=t||0,t<0||t+16>n.length)throw new RangeError(`UUID byte range ${t}:${t+15} is out of buffer bounds`);for(let l=0;l<16;++l)n[t+l]=o[l];return n}return G(o)}const M=()=>{if(document.cookie.includes("bechtle-p"))return N(document.cookie,"bechtle-p","");{const e=new Date;e.setMonth(e.getMonth()+13);const n=B();return document.cookie=`bechtle-p=${n};path=/;expires=${e};`,n}},V=()=>{document.cookie="bechtle-p=; path=/; expires=Thu, 01 Jan 1970 00:00:01 GMT;"};function $(e){window.addEventListener("UC_EVENT",function(n){e(n.detail)})}const O=()=>{window.ACC=window.ACC||{config:{}}},y={portfolioType:0,showDynamicContent:!0};async function F(){return fetch("/api/beus/context/tracking",{credentials:"include",headers:new Headers({accept:"application/json"})}).then(async e=>e.status===200?await e.json():(console.error("Response status was not successful, using default TrackingContext"),y)).catch(()=>(console.error("Error fetching from BeUS, using default TrackingContext"),y))}const P=async e=>{var n,t,o,i;const c=e?await F():y;(t=(n=window.bechtle)==null?void 0:n.events)==null||t.dispatch("BEUS_TRACKING_CTX_READY",c);const{portfolioType:u,showDynamicContent:l}=c,_=u===1?"portfolio":u===2?"special_portfolio":"no_portfolio";(i=(o=window.bechtle)==null?void 0:o.analytics)==null||i.data("init_preferences",{event:"init_preferences",dc_preferences:{portfolio_type:_,show_dynamic_content:l}})},X=e=>{var n,t;const{language:o,country:i,vid:c,user:u}=e,{partnerId:l,hashedEMail:_,customer:g,context:E,seco:v,isProcurementUser:C,xInternal:f,xCustomer:T,cloudsActive:s}=u,r=f?"intern":"extern",d=C?"punchout":"public",h=E==="admin"?"employee-global":E.length!==0?E:"anonymous",p={shop_country:i,shop_language:o,vid:c,context:h,procurement:d,intern:r};s!==void 0&&(p.clouds=s),l&&(p.partner=l),_&&(p.logged_in="login",p.modus=v?"self":"care",p.hashed_email=_,p.be_nr=T||g),(t=(n=window.bechtle)==null?void 0:n.analytics)==null||t.data("init_session_data",{event:"init_session_data",session_data:p})},W=";",j="=",J="experience_impression",K=(e,n)=>({event:J,experience_id:e,experience_group:n}),q=e=>{var n,t;if(typeof e!="string"||!e)return;const o=e.split(W);for(const i of o){const[c,u]=i.split(j);c&&u&&((t=(n=window.bechtle)==null?void 0:n.analytics)==null||t.push(K(c,u)))}},z=["init_session_data","init_preferences"];function D(...e){return arguments}const Q=()=>{var e;const n=window.dataLayer=(e=window.dataLayer)!=null?e:[],t=[D("consent","default",{ad_personalization:"denied",ad_storage:"denied",ad_user_data:"denied",analytics_storage:"denied",wait_for_update:2e3}),D("set","ads_data_redaction",!0),{"gtm.start":new Date().getTime(),event:"gtm.js"}];let o=!1,i=!1;const c=()=>{for(i=!0;t.length;){const s=t.shift();s&&n.push(s)}},u=s=>i?n.push(s):t.push(s),l={};let _=[];const g=s=>s.every(r=>l[r]!==void 0),E=(s,r)=>{const d=typeof s=="function"?s(l):s;r?i=!0:o=!0,Array.isArray(d)?d.forEach(h=>n.push(h)):n.push(d),r&&c()},v=()=>{const{allDepsReady:s,stillWaiting:r}=_.reduce((d,h)=>(g(h.dependentFrom)?d.allDepsReady.push(h):d.stillWaiting.push(h),d),{allDepsReady:[],stillWaiting:[]});_=r,s.forEach(d=>E(d.callback,d.flush))},C=(s,r,d)=>{i&&!d&&n.push(r),l[s]=r,v()},f=(s,r)=>{var d,h;if(typeof s!="function"&&!r){const Z=s;s=I=>[I.init_session_data,Z,I.init_preferences]}const p={callback:s,dependentFrom:(d=r==null?void 0:r.dependentFrom)!=null?d:z,flush:(h=r==null?void 0:r.flush)!=null?h:!0};g(p.dependentFrom)?E(p.callback,p.flush):_.push(p)},T=window.dataLayer.push;return window.dataLayer.push=function(s){return i||o?(o&&(o=!1),T.apply(window.dataLayer,[s])):(t.push(s),t.length)},{data:C,ready:f,push:u,queue:t,waitingForData:_,dataStorage:l}},A=k(),x=Q();window.bechtle?(window.bechtle.events=A,window.bechtle.analytics=x):window.bechtle={events:A,analytics:x},window.dispatchEvent(new CustomEvent("BECHTLE_LIB_READY"));const w=window.__BECHTLE_SERVER_CTX__;window.bechtle.events.dispatch("BECHTLE_SERVER_CTX_READY",w),window.dispatchEvent(new CustomEvent("BECHTLE_SERVER_CTX_READY",{detail:w})),X(w),P(!!w.user.hashedEMail),O(),q(w.xAbTesting),$(e=>{if(window.bechtle.events.dispatch("CONSENT_CHANGE",e),e["Persistence ID"]){const n=M();window.bechtle.events.dispatch("PERSISTENCE_ID_CHANGE",n)}else V(),window.bechtle.events.dispatch("PERSISTENCE_ID_CHANGE",null);e["Dynamic Yield"]?U():S()})})();
