1import{a as h,c as g,M as b,ae as i}from"./B30BqIw0.js";import{u as P}from"./DB5XoyW6.js";const k=["fr","nl","se","es","br","tw","cn"],A=()=>{const{sessionContext:u}=h(),{isLoggedIn:m,user:d}=P(),l=b().public.shopware.salesChannels,f=()=>{if(typeof window>"u")return"us_en";let e=window.location.hostname.replace(/^www\./i,"");const t=window.location.pathname.split("/")[1];t&&k.includes(t)&&(e+=`/${t}`);for(const n in l)if(l[n].devStorefrontUrl===e)return n;return"us_en"},o=g(()=>{if(typeof window>"u")return!1;const e=f();return!!l[e]?.metaPixelId?.length});async function c(e,t,n,r={}){const a=f();try{await $fetch("/api/meta-event",{method:"POST",headers:{"x-sales-channel-key":a},body:{event_name:e,event_id:n,event_source_url:window.location.href,test_event_code:i("meta_test_event_code").value||i("meta_test").value||void 0,user_data:{fbc:i("_fbc").value||void 0,fbp:i("_fbp").value||void 0,fb_login_id:i("c_user").value||void 0,client_user_agent:navigator.userAgent,...r},custom_data:t}})}catch(w){console.error("[Meta CAPI] Client error:",w)}}function s(){return m.value?{em:d.value?.email??"",ph:d.value?.customFields?.phone??""}:{}}async function _(e){o.value&&await c("PageView",{},e,s())}async function y(e,t){if(!o.value)return;const n={content_ids:[e.productNumber??""],content_type:"product",content_name:e.translated?.name??"",currency:u.value?.currency?.isoCode??"",value:e.calculatedPrice?.totalPrice??0};await c("ViewContent",n,t,s())}async function v(e,t){if(!o.value)return;const n={content_ids:[e.productNumber??""],content_type:"product",content_name:e.translated?.name??"",currency:u.value?.currency?.isoCode??"",value:e.calculatedPrice?.totalPrice??e.calculatedCheapestPrice?.totalPrice??0,num_items:1};await c("AddToCart",n,t,s())}async function p(e,t,n){if(!o.value)return;const r={content_type:"product",currency:u.value?.currency?.isoCode??"",value:t,contents:e.map(a=>({id:a.payload?.productNumber??"",title:a.label??"",item_price:a.price?.unitPrice??0,quantity:a.quantity??1})),num_items:e.length};await c("InitiateCheckout",r,n,s())}async function C(e,t,n={}){if(!o.value)return;const r={content_type:"product",currency:u.value?.currency?.isoCode??"",value:e.amountNet??0,order_id:e.orderNumber??"",contents:(e.lineItems??[]).map(a=>({id:a.payload?.productNumber??"",title:a.label??"",item_price:a.unitPrice??0,quantity:a.quantity??1})),num_items:(e.lineItems??[]).length};await c("Purchase",r,t,n)}return{trackPageView:_,trackViewContent:y,trackAddToCart:v,trackInitiateCheckout:p,trackPurchase:C}};export{A as u};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.