1import{u as e,j as l,b as a,A as t}from"./main-BmYsSTrY.js";import{r as o,C as n,E as i,I as s}from"./vendor-DI-zMLkP.js";import{u as d,D as r}from"./embla-carousel-pagination-button-DPSr7RJ3.js";import{f as u,F as c,j as v,p,k as m,l as _,G as g,g as h,J as b,m as y,K as x,d as D,P as f,N as j}from"./index-9Yy5i9pU.js";const N=a=>{var t,n,i,s,v,p,m,_,g,h,b,y,x,D,f,j,N,T,C;const{t:E}=e(),{productsData:I,productsDataLoading:w,mappingObj:R,paginationPosition:L,pagination:V,sliderView:k,loadImagesLazily:S,emblaRef:O,emblaApi:A,showButtons:B}=a,{selectedIndex:K,scrollSnaps:F,onDotButtonClick:H}=d(A);return l.jsxs(l.Fragment,{children:[!((null==(n=null==(t=null==I?void 0:I.Data)?void 0:t.records)?void 0:n.length)||w||!(null==(i=null==R?void 0:R.sourceKey)?void 0:i.length)||!(null==(s=null==R?void 0:R.sourceValue)?void 0:s.length))&&l.jsx("div",{className:"col",children:l.jsx("p",{className:"h5",children:E("components.e_commerce.product_card.product_listing.txt_noData")})}),!((null==(p=null==(v=null==I?void 0:I.Data)?void 0:v.records)?void 0:p.length)||w||(null==(m=null==R?void 0:R.sourceKey)?void 0:m.length)||(null==(_=null==R?void 0:R.sourceValue)?void 0:_.length))&&l.jsx("div",{className:"col",children:l.jsx("div",{className:"pb-10",children:l.jsx("p",{className:"text-3xl font-secondary text-center",children:E("components.e_commerce.product_card.product_listing.txt_selectCondition")})})}),!((null==(h=null==(g=null==I?void 0:I.Data)?void 0:g.records)?void 0:h.length)||!w)&&l.jsx("div",{className:"position-relative",style:{height:"300px"},children:l.jsx("div",{className:"cart-loading",children:l.jsx("div",{className:"loader-wrapper",children:l.jsx("div",{className:"loader-main flex"})})})}),!!(null==(y=null==(b=null==I?void 0:I.Data)?void 0:b.records)?void 0:y.length)&&l.jsx(l.Fragment,{children:(null==(D=null==(x=null==I?void 0:I.Data)?void 0:x.records)?void 0:D.length)>4&&k===u.WIDGET_CHECK_TRUE?l.jsxs("div",{className:"embla group/top-arrow embla-top-arrow relative",children:[l.jsx("div",{className:"embla__viewport overflow-hidden",ref:O,children:l.jsx("div",{className:"embla__container flex -mx-4",children:null==(j=null==(f=null==I?void 0:I.Data)?void 0:f.records)?void 0:j.map(((e,a)=>l.jsx("div",{className:"embla__slide basis-6/12 sm:basis-4/12 lg:basis-3/12 shrink-0 min-w-0 px-4",children:l.jsx(c,{productDetails:e,showActionButtons:!1,mode:"direct",loadImagesLazily:S})},a)))})}),V===(null==(N=u)?void 0:N.WIDGET_CHECK_TRUE)&&l.jsx("div",{className:`embla__dots mt-8 ${L}`,children:F.map(((e,a)=>l.jsx(r,{onClick:()=>H(a),className:"embla__dot w-2 h-2 border border-solid border-secondary mr-3 last:mr-0".concat(a===K?" embla__dot--selected bg-secondary-default":"")},a)))})]}):l.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-8",children:null==(C=null==(T=null==I?void 0:I.Data)?void 0:T.records)?void 0:C.map(((e,a)=>l.jsx(o.Fragment,{children:l.jsx(c,{productDetails:e,showActionButtons:!1,mode:"direct",loadImagesLazily:S,showButtons:B})},a.toString())))})})]})},T=e=>{var l,a,t,s,d,r,u,c,x,D,f,j,N,T,C,E,I,w,R;const{id:L,titleColor:V,component_content:k,autoPlay:S}=e;let O,A;const B="ps-ssr",[K,F]=o.useState(),[H,P]=o.useState(!1),M={color:V},G=window.__pageData__,{displayAs:W,dataSource:Y,limit:q,contentModel:z,modelInternalName:U,imageData:J,description:$,image_heading:Q,buttonText:X,buttonLink:Z,sourceKey:ee,sourceValue:le,query:ae,operator:te}=JSON.parse(void 0===k?"{}":k);let oe={backgroundImage:J,headingText:n.parseVariableSafeValue(Q),description:n.parseVariableSafeValue($),buttonText:n.parseVariableSafeValue(X),buttonLink:n.parseVariableSafeValue(Z),sourceKey:ee,sourceValue:le};const{setComponentDataDispatcher:ne,componentDataDispatcher:ie,isComponentLoaded:se}=v({id:L,modelInternalName:U,modelKeyForSSR:B}),de=e=>{var l;const a=(()=>{var e;const l=window.location.href;return null==(e=y(l))?void 0:e.join(" ")})();if(!e||0===Object.keys(e).length)return;if(!a||!(null==e?void 0:e.utm_product_set_data))return e;const t=null==(l=null==e?void 0:e.utm_product_set_data)?void 0:l.find((e=>{var l,t,o;return a&&(null==e?void 0:e.utm_content)&&(null==(o=null==a?void 0:a.toLowerCase())?void 0:o.includes(null==(t=null==(l=null==e?void 0:e.utm_content)?void 0:l.toLowerCase())?void 0:t.trim()))}));return t||e};Y===(null==(l=p)?void 0:l.CONTENT_LIBRARY)&&(O={headingText:n.parseVariableSafeValue(null==(a=de(null==ie?void 0:ie.componentData))?void 0:a.heading),description:n.parseVariableSafeValue(null==(t=de(null==ie?void 0:ie.componentData))?void 0:t.description),buttonText:n.parseVariableSafeValue((null==(s=de(null==ie?void 0:ie.componentData))?void 0:s.title_image_button)?null==(r=null==(d=de(null==ie?void 0:ie.componentData))?void 0:d.title_image_button[0])?void 0:r.button_text:""),buttonLink:n.parseVariableSafeValue((null==(u=de(null==ie?void 0:ie.componentData))?void 0:u.title_image_button)?null==(x=null==(c=de(null==ie?void 0:ie.componentData))?void 0:c.title_image_button[0])?void 0:x.button_link:""),backgroundImage:(null==(f=null==(D=null==ie?void 0:ie.componentData)?void 0:D.title_image)?void 0:f.length)?null==(j=de(null==ie?void 0:ie.componentData))?void 0:j.title_image[0]:"",sourceKey:(null==(N=de(null==ie?void 0:ie.componentData))?void 0:N.products_by_filter_query)?"filter":(null==(T=de(null==ie?void 0:ie.componentData))?void 0:T.product_by_sku_list)?"sku":"",sourceValue:(null==(C=de(null==ie?void 0:ie.componentData))?void 0:C.products_by_filter_query)?null==(E=de(null==ie?void 0:ie.componentData))?void 0:E.products_by_filter_query:(null==(I=de(null==ie?void 0:ie.componentData))?void 0:I.product_by_sku_list)?null==(w=de(null==ie?void 0:ie.componentData))?void 0:w.product_by_sku_list:""}),Y===(null==(R=p)?void 0:R.CONTENT_LIBRARY)&&(oe=Object.assign(oe,O));const[re,ue]=o.useState(Date.now());(null==z?void 0:z.trim().length)&&(A=JSON.parse(z));o.useEffect((()=>{var e;Y===p.FREE_FORM?ne({type:m.initializingFreeForm}):Y===p.CONTENT_LIBRARY&&se&&(ne({type:m.fetchingData}),(null==(e=null==z?void 0:z.trim())?void 0:e.length)&&(async()=>{ne({type:m.dataFetched,data:await _(A,U,B,L)})})())}),[z,Y]),o.useEffect((()=>{ue(Date.now())}),[S]);const ce=o.useCallback((()=>{const e=g()??[];if(!(null==ae?void 0:ae.length))return[...e];const l=null==ae?void 0:ae.map((e=>({action:e.condition,field_name:e.field,value:e.value.split(",").map((e=>e.trim()))})));return[{group:{operator:te||"AND",rules:l}},...e]}),[te,ae]);return o.useEffect((()=>{(async({filterArray:e})=>{var l,a,t,o,n,s,d,r;let u;P(!0);try{if(Y===(null==(l=p)?void 0:l.CONTENT_LIBRARY)&&(null==(a=null==oe?void 0:oe.sourceKey)?void 0:a.length)&&(null==(t=null==oe?void 0:oe.sourceValue)?void 0:t.length)){const{currencyInfo:e}=h(),l=g()??[],a={body:{filter:"filter"===(null==oe?void 0:oe.sourceKey)?[{fq:null==oe?void 0:oe.sourceValue},...l]:[{group:{operator:"OR",rules:null==(o=null==oe?void 0:oe.sourceValue)?void 0:o.split(",").map((e=>({action:"equal_to",field_name:"sku",value:e.trim()})))}},...l]},fields:"brand,variants_pricing,brand_page_slug,calculated_price,categories,category_meta,category_tree,custom_url,id,images,name,page_slug,price,provider_id,provider_specific_data,retail_price,reviews_count,reviews_rating_sum,sale_price,sku,sku_for_analytics,variant_options,variants",skip:0,limit:q||4,by_pass_merchandising:!0};if(e&&(a.currency=null==e?void 0:e.currency_code),u=await i.search(a),(null==(s=null==(n=null==u?void 0:u.Data)?void 0:n.records)?void 0:s.length)>0){const e={...G,componentData:null==(d=null==u?void 0:u.Data)?void 0:d.records};b({type:"ItemList",data:e,id:`${L}-category`})}F(u)}if(Y===(null==(r=p)?void 0:r.FREE_FORM)&&(null==e?void 0:e.length)&&ae.length){const{currencyInfo:l}=h(),a={body:{filter:e},fields:"brand,brand_page_slug,variants_pricing,calculated_price,categories,category_meta,category_tree,custom_url,id,images,name,page_slug,price,provider_id,provider_specific_data,retail_price,reviews_count,reviews_rating_sum,sale_price,sku,sku_for_analytics,variant_options,variants",skip:0,limit:q||4,by_pass_merchandising:!0};l&&(a.currency=null==l?void 0:l.currency_code),u=await i.search(a),F(u)}}catch(c){console.error(c)}P(!1)})({filterArray:ce()})}),[q,JSON.stringify(ae)]),{sliderKey:re,title_style:M,displayAs:W,productsData:K,dataSource:Y,imageData:J,mappingObj:oe,productsDataLoading:H,contentModel:z,componentDataDispatcher:ie}},C=o=>{var n,i,d,r,c,v,m,_,g,h,b,y,C,E,I,w,R,L,V,k;const{id:S,titleColor:O,component_content:A,sliderView:B,titleTextPosition:K,pagination:F,paginationPosition:H,sliderArrows:P,autoPlay:M,autoPlaySpeed:G,loadImagesLazily:W,showButtons:Y}=o,{sliderKey:q,productsData:z,dataSource:U,mappingObj:J,componentDataDispatcher:$,productsDataLoading:Q,contentModel:X,title_style:Z}=T({id:S,titleColor:O,component_content:A,autoPlay:M});let ee=!1;P===(null==(n=u)?void 0:n.WIDGET_CHECK_TRUE)?ee=!0:P===(null==(i=u)?void 0:i.WIDGET_CHECK_FALSE)&&(ee=!1);const le={playOnInit:M===(null==(d=u)?void 0:d.WIDGET_CHECK_TRUE),delay:parseInt(G)||1e3,stopOn
1Interaction:M!==(null==(r=u)?void 0:r.WIDGET_CHECK_TRUE)},[ae,te]=a({active:!0,align:"start",slidesToScroll:1,dragFree:!0,loop:!0},[t(le)]),{prevBtnDisabled:oe,nextBtnDisabled:ne,onPrevButtonClick:ie,onNextButtonClick:se}=x(te),{t:de}=e();return(null==(v=null==(c=null==z?void 0:z.Data)?void 0:c.records)?void 0:v.length)?l.jsxs(l.Fragment,{children:[U===(null==(m=p)?void 0:m.CONTENT_LIBRARY)&&l.jsx(D,{loaderClassName:"section-gap product-set-section",contentModel:X,isLoading:null==$?void 0:$.isLoading,componentData:null==(_=null==$?void 0:$.componentData)?void 0:_.id}),(U===(null==(g=p)?void 0:g.FREE_FORM)||U===(null==(h=p)?void 0:h.CONTENT_LIBRARY)&&(null==(b=null==$?void 0:$.componentData)?void 0:b.id))&&l.jsxs("div",{className:"product-set-outer-section mb-12 md:mb-16 lg:mb-24",children:[l.jsx("div",{className:"section-title text-center mb-14",children:l.jsxs("div",{className:"container",children:[l.jsxs("div",{children:[(!!(null==J?void 0:J.headingText)&&s||!s)&&l.jsx("h4",{className:` text-2xl lg:text-3xl font-secondary text-neutral-900 ${K}`,style:Z,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:(null==(y=null==J?void 0:J.headingText)?void 0:y.length)||U===(null==(C=p)?void 0:C.CONTENT_LIBRARY)?null==J?void 0:J.headingText:""}}),(!!(null==J?void 0:J.description)&&s||!s)&&l.jsx("p",{className:"mt-1",dangerouslySetInnerHTML:{__html:(null==(E=null==J?void 0:J.description)?void 0:E.length)||U===(null==(I=p)?void 0:I.CONTENT_LIBRARY)?null==J?void 0:J.description:""}})]}),ee&&z&&(null==(w=null==z?void 0:z.Data)?void 0:w.records)&&!!(null==(L=null==(R=null==z?void 0:z.Data)?void 0:R.records)?void 0:L.length)&&(null==(k=null==(V=null==z?void 0:z.Data)?void 0:V.records)?void 0:k.length)>4&&l.jsx("div",{className:"embla__controls",ref:ae,children:l.jsxs("div",{className:"hidden lg:flex embla__buttons space-x-4 item-center justify-end",children:[l.jsx(f,{onClick:ie,disabled:oe}),l.jsx(j,{onClick:se,disabled:ne})]})})]})}),l.jsx("div",{className:"section-gap product-set-section",children:l.jsx("div",{className:"container",children:l.jsx(N,{sliderKey:q,dataSource:U,mappingObj:J,productsData:z,productsDataLoading:Q,pagination:F,paginationPosition:H,sliderArrowsVisibility:ee,sliderView:B,loadImagesLazily:W===u.WIDGET_CHECK_TRUE,emblaRef:ae,emblaApi:te,showButtons:Y})})})]})]}):l.jsx(l.Fragment,{})};export{C as default};
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.