1import{a as I}from"/build/_shared/chunk-TUIHAGXD.js";import{b as u}from"/build/_shared/chunk-DZGDZ3GC.js";import{b as S}from"/build/_shared/chunk-2VHJHPYT.js";import{a as w}from"/build/_shared/chunk-POUH3CHJ.js";import{b as P}from"/build/_shared/chunk-FONEQPGK.js";import{a as W}from"/build/_shared/chunk-H6S7FWVP.js";import{d as k}from"/build/_shared/chunk-T36URGAI.js";var p=k(W());var E=i=>typeof(i==null?void 0:i.node)!="undefined",V=i=>i.map(n=>{var d,c,s,m;if(E(n))return{node:n.node};if("pid"in n&&"thumb_image"in n){let e=n,r=e.thumb_image?{__typename:"ImageMedia",desktop:{url:e.thumb_image},mobile:{url:e.thumb_image},tablet:{url:e.thumb_image}}:null;return{node:{__typename:"ViewProduct",id:e.pid,productKey:e.pid,name:e.title,slug:e.slug,price:((d=e.sale_price)==null?void 0:d.toString())||((c=e.price)==null?void 0:c.toString())||"0",wasPrice:e.price>e.sale_price?e.price.toString():void 0,description:e.description,brand:e.brand,colour:e.colourFacet,categoryNames:((s=e.categorySlugs)==null?void 0:s.map(g=>g.replace(/-/g," ")))||[],breadcrumbs:e.breadcrumbs,images:r?[r]:[],imagesResponsive:r?[r]:[],options:[],percentageSaving:(m=e.discountPercentage)==null?void 0:m.toString(),averageRating:e.averageRating,totalReviewCount:e.totalReviewCount,giftWithPurchase:e.giftWithPurchase?{description:e.giftWithPurchase}:void 0,hasGiftWithPurchase:!!e.giftWithPurchase}}}return{node:n}}),D=()=>{let{enableJellyfishEventIds:i}=(0,p.useContext)(w);return{viewItemList:(0,p.useCallback)((d,c,s=0,m={},e,r)=>{let{attributionToken:g,pageCategories:l,searchQuery:_,userId:y}=m,L=[...V(d).map((t,a)=>({...t,index:a+s})),...r?V(r.items).map((t,a)=>({...t,index:a,listName:r.listName})):[]];P({event:"view_item_list",event_id:S(),offset:s,...g&&{attribution_token:g},...l&&{pageCategories:l},..._&&{searchQuery:_},...y&&{vertexUserId:y},mirakl:e?{pageId:e}:null,ecommerce:{item_list_name:c,items:L.map(t=>{var f,v;let a=(f=t.node.breadcrumbs)!=null?f:[],o=I(a),b=t.node.wasPrice?+t.node.wasPrice.replace(/[^0-9.-]/g,""):void 0,h=t.node.price?+t.node.price.replace(/[^0-9.-]/g,""):0;return{item_id:i?t.node.productKey||u(t.node.id)||void 0:u(t.node.id),item_name:t.node.name||void 0,discount:b?b-h:0,index:t.index,item_brand:t.node.brand||void 0,item_category:o[0],item_category2:o[1],item_category3:o[2],item_category4:o[3],item_category5:o[4],...t.listName&&{item_list_id:t.listName,item_list_name:t.listName},item_variant:i?t.node.productKey||u(t.node.id)||void 0:t.node.id||void 0,item_variant_id:t.node.colour||void 0,item_variant_skus:((v=t.node.variantSkus)==null?void 0:v.filter(N=>N!=null))||void 0,price:h}})}})},[i])}};export{D as a};
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.