1"use strict";(self.webpackChunkpuratos_react=self.webpackChunkpuratos_react||[]).push([[9456],{60893(e,t,r){r.r(t),r.d(t,{ProductContext:()=>Pt,ProductStencil:()=>St,TranslationsContext:()=>Ot,default:()=>Ct,productPackagingRoot:()=>kt});var n=r(96540),i=r(4589),s=r(74848);let o=function(e){return e.DAM="DAM",e.YOUTUBE="YOUTUBE",e.VIMEO="VIMEO",e}({});const a=e=>{let{videoItem:t,isPlaying:r,onPlay:i}=e;const{id:a,provider:l,thumbnail:c}=t,[d,u]=(0,n.useState)(!1);(0,n.useEffect)(()=>{u(r)},[r]);const v=(e,t)=>{u(!0),setTimeout(()=>{if(e===o.YOUTUBE||e===o.VIMEO){const e=document.querySelector('.slick-active iframe[src*="'.concat(t,'"]'));if(e){const t=e.getAttribute("src"),r=t.includes("?")?"&":"?";e.setAttribute("src","".concat(t).concat(r,"autoplay=1"))}}else if(e===o.DAM){const e=document.querySelector('.slick-active video[data-src="'.concat(t,'"]'));e&&e.play()}},0),i()};let p="";switch(l){case o.YOUTUBE:p="https://img.youtube.com/vi/".concat(a,"/maxresdefault.jpg");break;case o.VIMEO:p="https://vumbnail.com/".concat(a,".jpg");break;default:p=c}const m=l===o.YOUTUBE?"https://www.youtube.com/embed/".concat(a):l===o.VIMEO?"https://player.vimeo.com/video/".concat(a):"",h=l===o.DAM?(0,s.jsxs)("video",{width:"640",height:"360",tabIndex:-1,className:"cmp-teaser__video-element",controls:!0,"data-src":a,children:[(0,s.jsx)("source",{src:a,type:"video/mp4"}),"Your browser does not support the video tag."]}):(0,s.jsx)("iframe",{src:m,frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",allowFullScreen:!0,title:"".concat(l," video")});return(0,s.jsx)(s.Fragment,{children:d?h:(0,s.jsxs)("div",{className:"main-media__thumbnail",onClick:()=>v(l,a),onKeyDown:e=>"Enter"===e.key&&v(l,a),role:"button",tabIndex:0,children:[(0,s.jsx)("img",{src:p,alt:"Video Thumbnail"}),(0,s.jsx)("span",{className:"play-button svg-play-with-circle-white"})]})})},l=e=>{let{src:t,alt:r,mainMedia:n,onPopupOpen:i,fallback:o}=e;return(0,s.jsx)("img",{src:t,alt:r,className:"media__image",onClick:()=>{n&&i&&i()},onError:e=>{const t=e.currentTarget;o&&!t.dataset.fallbackApplied&&(t.src=o,t.dataset.fallbackApplied="true")}})},c=e=>{let{videoId:t,isActive:r,provider:n,thumbnail:i}=e;const a=n===o.YOUTUBE?"https://img.youtube.com/vi/".concat(t,"/maxresdefault.jpg"):n===o.VIMEO?"https://vumbnail.com/".concat(t,".jpg"):i;return(0,s.jsxs)("div",{className:"thumbnail-carousel__thumbnail ".concat(r?"active-thumbnail":""),children:[(0,s.jsx)("img",{src:a,alt:"Video Thumbnail"}),(0,s.jsx)("span",{className:"play-button svg-play-with-circle-white"})]})};var d=r(57261),u=r(29956);r(94531);function v(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?v(Object(r),!0).forEach(function(t){m(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):v(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function m(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const h=()=>{const e=(0,n.useContext)(Pt),{referenceImage:t,packagings:r,overviewAssets:o,renditionFallback:v}=e.product,m=(0,n.useMemo)(()=>[...r,...o],[r,o]),[h,b]=(0,n.useState)((null===t||void 0===t?void 0:t.largeUrl)||v),[x,f]=(0,n.useState)(0),[g,j]=(0,n.useState)(!1),[y,_]=(0,n.use
1State)(!0),[w,N]=(0,n.useState)(null),[P,O]=(0,n.useState)(!1),k=(0,n.useRef)(null),S=(0,n.useRef)(null),C=(0,n.useRef)(0);(0,n.useEffect)(()=>{const e=()=>{O(window.innerWidth<1e3)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),(0,n.useEffect)(()=>{const t=navigator.maxTouchPoints>0,r=window.innerWidth<1e3;_(!(t||r));const n=()=>{const e=window.innerWidth<1e3;_(!(t||e))};if(window.addEventListener("resize",n),e.activeProductIndex!==x){var i,s;f(e.activeProductIndex||0);const t=m[e.activeProductIndex||0];var o,a;if(t)if("image"in t)b((null===(o=t.image)||void 0===o?void 0:o.extraLargeUrl)||(null===(a=t.image)||void 0===a?void 0:a.largeUrl)||v);else if("video"in t){var l;b((null===(l=t.video)||void 0===l?void 0:l.id)||v)}null===(i=k.current)||void 0===i||i.slickGoTo(e.activeProductIndex||0),null===(s=S.current)||void 0===s||s.slickGoTo(e.activeProductIndex||0)}return document.body.style.overflow=g&&y?"hidden":"auto",()=>{window.removeEventListener("resize",n),document.body.style.overflow="auto"}},[e.activeProductIndex,x,g,m,v,y]);const E={speed:500,slidesToShow:1,slidesToScroll:1,arrows:m.length>1,dots:P,beforeChange:(e,t)=>
1{var r;null===(r=S.current)||void 0===r||r.slickGoTo(t)},afterChange:e=>(e=>{C.current=e,f(e),N(null);const t=m[e];var r,n;if(t)if("image"in t)b((null===(r=t.image)||void 0===r?void 0:r.extraLargeUrl)||(null===(n=t.image)||void 0===n?void 0:n.largeUrl)||v);else if("video"in t){var i;b((null===(i=t.video)||void 0===i?void 0:i.id)||v)}})(e)};return(0,s.jsxs)("div",{className:"product-gallery",children:[(0,s.jsx)("div",{className:"main-carousel",children:(0,s.jsx)(i.A,p(p({},E),{},{ref:e=>{k.current=e},children:m.map((e,t)=>{var r,n,i;return(0,s.jsx)("div",{className:"carousel-item",children:"image"in e&&null!==(r=e.image)&&void 0!==r&&r.largeUrl?(0,s.jsx)(l,{src:e.image.largeUrl,alt:(null===(n=e.image)||void 0===n?void 0:n.altText)||"image",mainMedia:!0,onPopupOpen:()=>(e=>{const t=m[e];var r;t&&("image"in t?b((null===(r=t.image)||void 0===r?void 0:r.extraLargeUrl)||t.image.largeUrl||v):"video"in t&&b(t.video.id||v)),j(!0)})(t),fallback:v}):"video"in e&&null!==(i=e.video)&&void 0!==i&&i.id?(0,s.jsx)(a,{videoItem:p(p({},e.video),{},{provider:e.video.type,thumbnail:e.video.thumbnail||v}),isPlaying:w===e.video.id,onPlay:()=>N(e.video.id)}):(0,s.jsx)("img",{src:v,alt:"Fallback"})},t)})}))}),(0,s.jsx)("div",{className:"thumbnail-carousel ".concat(m.length>4?"":"not-infinity"),children:(0,s.jsx)(i.A,p(p({},{speed:500,slidesToShow:4,swipeToSlide:!0}),{},{ref:e=>{S.current=e},children:m.map((e,t)=>{var r,n,i;return(0,s.jsx)("div",{className:"thumbnail-item",onClick:()=>(e=>{var t;e!==C.current&&(null===(t=k.current)||void 0===t||t.slickGoTo(e))})(t),children:"image"in e&&null!==(r=e.image)&&void 0!==r&&r.smallUrl?(0,s.jsx)("img",{src:e.image.smallUrl,alt:(null===(n=e.image)||void 0===n?void 0:n.altText)||"Thumbnail ".concat(t+1),className:x===t?"active-thumbnail":"",onError:e=>{e.currentTarget.src=v}}):"video"in e&&null!==(i=e.video)&&void 0!==i&&i.id?(0,s.jsx)(c,{videoId:e.video.id,provider:e.video.type,isActive:x===t,thumbnail:e.video.thumbnail||v}):(0,s.jsx)("img",{src:v,alt:"Fallback",className:x===t?"active-thumbnail":""})},t)})}))}),y&&(0,s.jsx)(d.Ay,{open:g,close:()=>j(!1),slides:[{src:h}],plugins:[u.A],className:"product-gallery__zoom-popup",carousel:{finite:!0},render:{buttonPrev:()=>null,buttonNext:()=>null},zoom:{scrollToZoom:!0,maxZoomPixelRatio:3},styles:{container:{backgroundColor:"rgba(0, 0, 0, .85)"}}})]})};var b=r(36850),x=r(54585),f=r(297);const g=e=>{let{promoCode:t}=e;return(0,s.jsx)("span",{className:"pdp-badge pdp-badge--promo p-text-color-white p-bg-red",children:t})},j=()=>{const{activeProductIndex:e,materials:t,product:r}=(0,n.useContext)(Pt),{benefits:i}=r.tags,[o]=(0,n.useState)([]),a=null===t||void 0===t?void 0:t[e],l=(0,n.useRef)(new Set);let c=null;var d,u;!(0,x.ay)()||null!==a&&void 0!==a&&a.isObsolete||(c=null!==(d=null===a||void 0===a||null===(u=a.promotion)||void 0===u?void 0:u.promoLabel)&&void 0!==d?d:null);return(0,n.useEffect)(()=>{var e;if(!c||!(0,x.ay)()||null!==a&&void 0!==a&&a.isObsolete)return;const t="".concat(a.materialNumber,"-").concat(c);if(l.current.has(t))return;l.current.add(t);const r=(null===(e=o.find(e=>e.MaterialNumber===a.materialNumber))||void 0===e?void 0:e.Quantity)||0;(0,f.n7)(a,r)},[null===a||void 0===a?void 0:a.materialNumber,c]),(0,s.jsx)("div",{className:"pdp__badges-container",children:c?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(g,{promoCode:c}),i.length>0&&(0,s.jsx)(b.e,{benefit:i[0]})]}):i.length>0&&i.slice(0,2).map((e,t)=>(0,s.jsx)(b.e,{benefit:e},t))})};var y=r(67849),_=r(99792),w=r(6618),N=r(44051),P=r(25905);const O=()=>{const{materials:e,product:t,activeProductIndex:r,breadcrumb:i}=(0,n.useContext)(Pt),[o,a]=(0,n.useState)(!1),l=(0,y.GO)(),{title:c}=t,d=e[r],u=window.location.href;return(0,s.jsxs)("div",{className:"pdp__overview--discontinued",children:[(0,s.jsxs)("h1",{className:"pdp__overview--title",children:[c,(0,s.jsx)("span",{className:"pdp__overview--subtitle",children:d.packaging})]}),(0,s.jsxs)("p",{children:[l("There is no price available for this product"),"."]}),(0,s.jsx)("button",{className:"btn btn-primary",onClick:async()=>{try{a(!0),await(0,w.e)(d.materialNumber,u);let t=i.elements[1].url;const r=P.Gf.replacePlpWithAlgolia,n=new URLSearchParams;if(r){var e;const{category:t,subcategory:r}=(0,N.jX)(null===(e=i.elements[1].queryParams)||void 0===e?void 0:e.enrichedTag);t&&n.set("category",encodeURIComponent(t)),r&&n.set("subcategories",encodeURIComponent(r))}else{const e=i.elements[1].queryParams;if(null!==e&&void 0!==e&&e.tag){const t=e.tag.split("/").slice(0,-1).join("/");t&&n.set("tags",t)}}const s=n.toString();s&&(t+="?".concat(s)),window.location.href=t}catch(t){console.error("Error fetching alternative materials:",t)}},disabled:o,children:l("View alternatives")})]})};var k=r(69082);const S=()=>{const{product:e,materials:t,activeProductIndex:r}=(0,n.useContext)(Pt),i=(0,y.GO)(),o=(0,_.hf)(_.gg.invalid);if(!e)return null;const{title:a}=e,l=null===t||void 0===t?void 0:t[r];
1if(!l)return(0,s.jsx)("h1",{className:"pdp__overview--title",children:a});if(l.isObsolete&&(0,_.M3)())return(0,s.jsx)(O,{});const c=l.packaging&&"0"!==l.packaging.trim()?l.packaging:"";return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("h1",{className:"pdp__overview--title",children:[a,(0,s.jsxs)("div",{className:"pdp__overview--subtitle",children:[c,!o&&(0,s.jsx)(k.A,{stockType:l.stockType})]})]}),(0,s.jsx)("a",{className:"pdp__overview--link",href:"#product-details",children:i("View product details")})]})},C=e=>{let{data:t,onlySingle:r=!1}=e;if(!(0,_.M3)()||(0,_.hf)(_.gg.invalid))return null;const{materials:i,config:o}=(0,n.useContext)(Pt),a=(0,y.GO)(),{VatIncluded:l}=o.Pricing,{salesPrice:c,basePrice:d,finalSalesPrice:u,finalBasePrice:v,hasPromotionalPrice:p}=t,m=!r&&i.length>1,h=()=>(0,s.jsx)("span",{className:"sku__vat",children:"(".concat(a(l?"incl. vat":"excl. vat"),")")});return(0,s.jsxs)("div",{className:"sku__pricing ".concat(m?"sku__pricing--multi":""),children:[(0,s.jsxs)("div",{className:"sku__price ".concat(p?"sku__price--regular":""),children:[(0,s.jsxs)("p",{className:"sku__unit-price",children:[(0,s.jsx)("span",{className:"sku__unit-price--value",children:c}),!p&&(0,s.jsx)(h,{})]}),(0,s.jsxs)("p",{className:"sku__weight-price",children:[d,!p&&(0,s.jsx)(h,{})]})]}),p&&(0,s.jsxs)("div",{className:"sku__price sku__price--promo",children:[(0,s.jsxs)("p",{className:"sku__unit-price",children:[(0,s.jsx)("span",{className:"sku__unit-price--value",children:u}),(0,s.jsx)(h,{})]}),(0,s.jsxs)("p",{className:"sku__weight-price",children:[v,(0,s.jsx)(h,{})]})]})]})},E=e=>{var t,r;let{enabled:i,outsideContext:o=null}=e;const a=(0,n.useContext)(Pt),{activeProductIndex:l,materials:c,materialsFetchSuccess:d}=a,u=(0,y.GO)();let v=null===c||void 0===c?void 0:c[l];if(o){var p;if(null===(p=o.materials)||void 0===p||!p.length)return null;v=o.materials[0]}return o||void 0!==d?o||d||!(0,_.M3)()?null!==(t=v)&&void 0!==t&&t.isObsolete||null===(r=v)||void 0===r||!r.hasPrice?null:(0,s.jsx)("div",{className:"single-sku",children:i&&!(0,_.hf)(_.gg.invalid)&&(0,s.jsx)(C,{data:v,onlySingle:!!o})}):(0,s.jsx)("div",{className:"single-sku",children:(0,s.jsx)("p",{className:"single-sku__no-prices",children:u("No prices available")})}):null},T=e=>{let{enabled:t}=e;const{materials:r,activeProductIndex:i,setActiveProduct:o,materialsFetchSuccess:a}=(0,n.useContext)(Pt),l=(0,y.GO)(),c=e=>{o(e)};return void 0===a?null:!a&&(0,_.M3)()?(0,s.jsx)("div",{className:"multi-sku",children:(0,s.jsx)("p",{className:"multi-sku__no-prices",children:l("No prices available")})}):(0,s.jsx)("div",{className:"multi-sku",children:r.map((e,r)=>(e=>{let{item:r,index:n}=e;const{materialNumber:o,stockType:a,packaging:l,isObsolete:d,hasPrice:u}=r;return(0,s.jsxs)("div",{className:"\n multi-sku__option \n ".concat(n===i?"multi-sku__option--selected":""," \n ").concat("BLOCKSALE"===a?"multi-sku__option--blocksale":"","\n "),role:"button",tabIndex:0,"aria-label":"Select ".concat(l," option"),"aria-checked":n===i,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||c(o)},onClick:()=>{c(o)},children:[(0,s.jsx)("p",{className:"multi-sku__option-size",children:l}),t&&!d&&u&&!(0,_.hf)(_.gg.invalid)&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(C,{data:r}),(0,s.jsx)(k.I,{stockType:a})]})]},n)})({item:e,index:r}))})},I=e=>{let{enabled:t}=e;const{materials:r}=(0,n.useContext)(Pt);return(0,x.ay)()&&null!==r&&void 0!==r&&r.length?(0,s.jsx)(s.Fragment,{children:r.length>1?(0,s.jsx)(T,{enabled:t}):(0,s.jsx)(E,{enabled:t})}):null},A=()=>{var e,t;const{activeProductIndex:r,materials:i}=(0,n.useContext)(Pt),o=null===i||void 0===i?void 0:i[r],a=null!==(e=null===o||void 0===o||null===(t=o.promotion)||void 0===t?void 0:t.longPromotionText)&&void 0!==e?e:null;return!(0,x.ay)()||!a||null!==o&&void 0!==o&&o.isObsolete?null:(0,s.jsx)("p",{className:"promo-text p-text-color-red",children:a})};var L=r(19115),U=r(50285);function D(){var e,t;const r=(0,y.GO)(),{contactUsFindStockist:i}=(0,n.useContext)(Pt);return null!==i&&void 0!==i&&i.distributorsLink||null!==i&&void 0!==i&&i.contactUsLink?(0,s.jsxs)("div",{className:"sign-in",children:[(0,s.jsxs)("div",{className:"sign-in__buttons",children:[(null===i||void 0===i?void 0:i.distributorsLink)&&(0,s.jsx)("button",{className:"btn btn-primary",onClick:()=>{var e;return window.location.href=null===i||void 0===i||null===(e=i.distributorsLink)||void 0===e?void 0:e.url},children:r(null===i||void 0===i||null===(e=i.distributorsLink)||void 0===e?void 0:e.label)}),(null===i||void 0===i?void 0:i.contactUsLink)&&(0,s.jsx)("button",{className:"btn btn-secondary",onClick:()=>{var e;return window.location.href=null===i||void 0===i||null===(e=i.contactUsLink)||void 0===e?void 0:e.url},children:r(null===i||void 0===i||null===(t=i.contactUsLink)||void 0===t?void 0:t.label)})]}),(0,s.jsx)("div",{className:"benefits",dangerouslySetInnerHTML:{__html:null===i||void 0===i?void 0:i.text}})]}):null}function B(){const e=(0,y.GO)(),t=(0,L.useDispatch)(),{stencil:r,signInOrCreateAccount:i}=(0,n.useContext)(Pt);return(0,x.ay)()?(0,_.M3)()?null:(0,s.jsxs)("div",{className:"sign-in",children:[(0,s.jsxs)("div",{className:"sign-in__buttons",children:[(0,s.jsx)("button",{className:"btn btn-primary",onClick:()=>t((0,U.C8)()),children:e("Sign in to view prices")}),(null===r||void 0===r?void 0:r.signUpUrl)&&(0,s.jsx)("button",{className:"btn btn-secondary",onClick:()=>window.location.href=r.signUpUrl,children:e("Create an account")}
1)]}),(null===i||void 0===i?void 0:i.text)&&(0,s.jsx)("div",{className:"benefits",dangerouslySetInnerHTML:{__html:i.text}})]}):(0,s.jsx)(D,{})}var M=r(66224),G=r(44661),R=r(98069),F=r(69727),q=r(52306);function H(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function V(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?H(Object(r),!0).forEach(function(t){Q(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):H(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Q(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Y=e=>{var t,r;let{product:i,quantity:o=1,addedToCart:a,setAddedToCart:l,setQuantity:c,componentType:d=q.Cf.PDP_ADD_TO_CART,showBasketOverlay:u=!0}=e;const v=(0,y.GO)(),p=(0,n.useContext)(Pt),{materials:m,activeProductIndex:h,setShowBasketOverlay:b}=p,x=null===m||void 0===m?void 0:m[h],g=(null===i||void 0===i||null===(t=i.materials)||void 0===t?void 0:t[0])||x;if(null!==g&&void 0!==g&&g.isObsolete)return null;const j=null===g||void 0===g?void 0:g.hasPrice,_=null===g||void 0===g?void 0:g.stockType,w=null===g||void 0===g?void 0:g.materialNumber,N=(null===g||void 0===g?void 0:g.minimumOrderQuantity)||1;if(i&&(null===(r=i.materials)||void 0===r||!r.length))return null;const[P,O]=(0,n.useState)(!1),[k,S]=(0,n.useState)(!1),[C,E]=(0,n.useState)(!1),[T,I]=(0,n.useState)(!1),A=(0,L.useDispatch)();(0,n.useEffect)(()=>{O(!1),S(!1),E(!1);const e=window.localStorage.getItem("priceRequested:".concat(w));I(!!e&&JSON.parse(e))},[w]),(0,n.useEffect)(()=>{k&&A((0,R.YY)())},[k]);const U=i||p.product,D=C||P||k||T||(null===g||void 0===g?void 0:g.isObsolete);return(0,s.jsx)("button",{className:"btn btn-primary ".concat(k||T?"add-to-cart__button add-to-cart__button--added":"add-to-cart__button").concat("BLOCKSALE"===_?" add-to-cart__button--blocksale":""),onClick:j?async()=>{O(!0);try{(await(0,M.c)(Number(w),o)).IsSuccess&&(S(!0),O(!1),u&&b(!0,o),setTimeout(()=>{S(!1)},5e3),(0,f.qg)(g,d,o),d!==q.Cf.PDP_ALSO_BOUGHT&&d!==q.Cf.PDP_RELATED_PRODUCTS||!i||A((0,F.EG)(V(V({},i),{},{materialNumber:null===g||void 0===g?void 0:g.materialNumber,type:(0,q.rU)(d)}))),l&&l(a+o),c&&c(N))}catch(e){console.error(e),O(!1),E(!0),setTimeout(()=>{E(!1)},5e3)}}:async()=>{try{await(0,G.h)(Number(w)),(0,f.Is)(V(V({},U),{},{materials:[g]}),d),I(!0),window.localStorage.setItem("priceRequested:".concat(w),JSON.stringify(!0))}catch(e){console.error(e),I(!1)}},disabled:D,children:(()=>{switch(!0){case k:return v("Added to cart");case T:return v("Price requested");case!j&&!T:return v("Request price");case C:return v("Failed to add to cart");case P:return v("Adding to cart");case"BLOCKSALE"===_:return v("Out of stock");default:return v("Add to cart")}})()})},W=e=>{let{quantity:t,setQuantity:r}=e;const i=(0,y.GO)(),{materials:o,activeProductIndex:a,stencil:l}=(0,n.useContext)(Pt),{minimumOrderQuantity:c,stockType:d}=o[a],{maximumAddToCartQuantity:u}=l;if("BLOCKSALE"===d)return null;return(0,s.jsxs)("div",{className:"add-to-cart__controls",children:[(0,s.jsx)("button",{className:"add-to-cart__controls--decrement","aria-label":i("Decrement quantity"),onClick:()=>{t>c&&r(t-1)},disabled:c>0?t<=c:t<=1}),(0,s.jsx)("input",{type:"number",value:t,"aria-label":i("Quantity input"),onChange:e=>{r(e.target.value)},onBlur:()=>{const e=c>0?c:1;r(t=>Math.max(e,Math.min(u,Number(t))))},min:c,max:u}),(0,s.jsx)("button",{className:"add-to-cart__controls--increment",onClick:()=>{t<u&&r(t+1)},"aria-label":i("Increment quantity"),disabled:t>=u})]})};function K(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function z(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};
1t%2?K(Object(r),!0).forEach(function(t){J(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):K(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function J(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const X=()=>{const e=(0,y.GO)(),{materials:t,activeProductIndex:r}=(0,n.useContext)(Pt);if(!(0,_.M3)()||null===t||void 0===t||!t.length)return null;const i=t[r],{minimumOrderQuantity:o,hasPrice:a,materialNumber:l}=i,c=(0,L.useSelector)(e=>{var t;return(null===e||void 0===e||null===(t=e.myPuratos_cart)||void 0===t||null===(t=t.data)||void 0===t||null===(t=t.basketItems)||void 0===t||null===(t=t.find(e=>{var t;return(null===(t=e.materialNumber)||void 0===t?void 0:t.toString())===(null===l||void 0===l?void 0:l.toString())}))||void 0===t?void 0:t.quantity)||0}
1),[d,u]=(0,n.useState)(o||1),[v,p]=(0,n.useState)({}),[m,h]=(0,n.useState)(c||0);(0,n.useEffect)(()=>{const{minimumOrderQuantity:e}=t[r],n=v[r]||e||1;u(n)},[r]),(0,n.useEffect)(()=>{h(c||0)},[c]);const b=e=>{p(t=>z(z({},t),{},{[r]:e})),u(e)},x=m>0&&e(m>1?"You currently have {0} items in your cart":"You currently have {0} item in your cart",["<strong>".concat(m,"</strong>")]);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"add-to-cart ".concat(a?"add-to-cart":"add-to-cart add-to-cart--request-price "),children:[(0,s.jsx)(W,{quantity:d,setQuantity:b}),(0,s.jsx)(Y,{quantity:d,addedToCart:m,setAddedToCart:h,setQuantity:b})]}),x&&(0,s.jsx)("p",{className:"add-to-cart__quantity-info",dangerouslySetInnerHTML:{__html:x}})]})},Z=()=>{var e;const{materials:t,activeProductIndex:r,materialsFetchSuccess:i,stencil:o}=(0,n.useContext)(Pt);if(!(0,x.ay)()||(0,_.hf)(_.gg.invalid))return null;if(void 0===i)return null;if(!i&&(0,_.M3)()){const{errorMessage:e}=o||{};return(0,s.jsx)("div",{className:"error-block",children:(0,s.jsx)("div",{className:"error-page__text",dangerouslySetInnerHTML:{__html:e}})})}return null===t||void 0===t||!t.length||null!==(e=t[r])&&void 0!==e&&e.isObsolete?null:(0,s.jsx)("div",{className:"pdp__actions",children:(0,s.jsx)(X,{})})};var $=r(70036),ee=r(57107),te=r(74337),re=r(43099);const ne=e=>{var t;let{product:r,componentType:i}=e;const o=(0,L.useDispatch)(),a=(0,y.GO)(),{stencil:l}=(0,n.useContext)(Pt),c=null===(t=r.materials)||void 0===t?void 0:t[0],d=(null===c||void 0===c?void 0:c.minimumOrderQuantity)>0?c.minimumOrderQuantity:1,[u,v]=(0,n.useState)(d),p=(null===l||void 0===l?void 0:l.maximumAddToCartQuantity)||999,m=(0,L.useSelector)(e=>{var t;return(null===e||void 0===e||null===(t=e.myPuratos_cart)||void 0===t||null===(t=t.data)||void 0===t||null===(t=t.basketItems)||void 0===t||null===(t=t.find(e=>{var t,r;return(null===(t=e.materialNumber)||void 0===t?void 0:t.toString())===(null===c||void 0===c||null===(r=c.materialNumber)||void 0===r?void 0:r.toString())}))||void 0===t?void 0:t.quantity)||0}),h=(0,_.hf)(_.gg.invalid)?()=>(0,re.y)():()=>o((0,U.C8)()),b=(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(ee.A,{color:"secondary",className:"btn-secondary product-card__sign-in",onClick:h,children:a("Sign in to view prices")}),(null===l||void 0===l?void 0:l.signUpUrl)&&(0,s.jsx)(te.A,{color:"p-color-black",href:l.signUpUrl,className:"product-card__sign-up",children:a("Create an account")}
1)]}),f=m>0&&a(m>1?"You currently have {0} items in your cart":"You currently have {0} item in your cart",["<strong>".concat(m,"</strong>")]),g=(0,s.jsxs)(s.Fragment,{children:[f&&(0,s.jsx)("p",{className:"add-to-cart__quantity-info",dangerouslySetInnerHTML:{__html:f}}),c&&c.hasPrice&&!c.isObsolete&&(0,s.jsxs)("div",{className:"add-to-cart__controls",children:[(0,s.jsx)("button",{className:"add-to-cart__controls--decrement",onClick:()=>{u>d&&v(u-1)},disabled:u<=d,"aria-label":a("Decrement quantity")}),(0,s.jsx)("input",{type:"number",value:u,"aria-label":a("Quantity input"),onChange:e=>{v(e.target.value)},onBlur:()=>{const e=d>0?d:1;v(t=>Math.max(e,Math.min(p,Number(t))))},min:d,max:p}),(0,s.jsx)("button",{className:"add-to-cart__controls--increment",onClick:()=>{u<p&&v(u+1)},disabled:u>=p,"aria-label":a("Increment quantity")})]}),(0,s.jsx)(Y,{product:r,componentType:i,quantity:u,showBasketOverlay:!1})]}),j=(0,x.ay)()?(0,_.M3)()&&!(0,_.hf)(_.gg.invalid)?g:b:null;return(0,s.jsx)(s.Fragment,{children:j})};var ie=r(31763),se=r(55185),oe=r(95786),ae=r(60040),le=r(73061),ce=r(74983);function de(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function ue(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?de(Object(r),!0).forEach(function(t){ve(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):de(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function ve(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const pe=e=>{switch(e){case ie.W.PRODUCT:return"type--product";case ie.W.RECIPE:return"type--recipe";default:return"type--unknown"}},me=e=>{var t;return null===(t=e.materials)||void 0===t||null===(t=t[0])||void 0===t?void 0:t.materialNumber},he=e=>{var t,r,i,o;let{data:a}=e;const{type:l,image:c,hoverImage:d,tags:u,title:v,subtitle:p,text:m,link:h,product:b,hasProductPrice:g,hasProductFooter:j,hasRecipeFooter:w,isFavorite:N,componentType:P}=a,O=(0,y.GO)(),S=l===ie.W.RECIPE,C=(e=>{var t;return null===(t=e.materials)||void 0===t||null===(t=t[0])||void 0===t||null===(t=t.promotion)||void 0===t?void 0:t.promoLabel})(b),T=(null===d||void 0===d?void 0:d.src)&&(null===d||void 0===d?void 0:d.src)!==(null===c||void 0===c?void 0:c.src),{contactUsFindStockist:I}=(0,n.useContext)(Pt),A=(0,L.useDispatch)(),U=(0,L.useSelector)(ae.B$),D=(0,L.useSelector)(e=>(0,x.G9)(e)),B=e=>{const t=e.currentTarget;T&&!t.classList.contains("hover-img")&&null!==d&&void 0!==d&&d.src&&t.src!==d.src?t.src=d.src:t.dataset.fallbackApplied||(t.src=D,t.dataset.fallbackApplied="true")},M=(e,t,r)=>{if(t===ie.W.PRODUCT){(0,f.lN)(e,r),A((0,F.EG)(ue(ue({},e),{},{materialNumber:me(e),type:(0,q.rU)(r)})));!!(0,q.rU)(r)&&(0,oe.V)(ue(ue({},e),{},{materialNumber:me(e)}),(0,q.Jn)(r),!0,U,"",1)}};return(0,s.jsxs)("div",{className:"product-card ".concat(pe(l)),children:[(0,s.jsxs)("div",{className:"product-card__header",children:[S&&(0,s.jsx)(se.e,{recipe:b,favoriteRecipe:N}),C&&(0,s.jsx)("div",{className:"pdp__badges-container",children:(0,s.jsx)("span",{className:"pdp-badge pdp-badge--promo",children:C})}),(null===c||void 0===c?void 0:c.src)&&(0,s.jsxs)("a",{className:"product-card-img--link ".concat(T&&"has-hover-img"),href:h,onClick:()=>M(b,l,P),onMouseDown:e=>1===e.button&&M(b,l,P),children:[(0,s.jsx)("img",{className:"product-card-img",src:c.src,alt:c.alt,onError:B}),T&&(0,s.jsx)("img",{className:"product-card-img hover-img",src:d.src,alt:d.alt,onError:B})]})]}),(0,s.jsxs)("div",{className:"product-card__content",children:[S&&(0,s.jsx)(le.V,{badges:u}),!S&&(0,s.jsx)(ce.L,{badges:u}),v&&(0,s.jsx)("a",{className:"product-card__content-title--link",href:h,onClick:()=>M(b,l,P),onMouseDown:e=>1===e.button&&M(b,l,P),children:(0,s.jsx)("h3",{className:"product-card__content-title",children:v})}),(0,s.jsxs)("div",{className:"product-card__stock-information",children:[p&&(0,s.jsx)("h4",{className:"product-card__content-subtitle",children:p}
1),b&&!(0,_.hf)(_.gg.invalid)&&(0,s.jsx)(k.A,{stockType:null===b||void 0===b||null===(t=b.materials)||void 0===t||null===(t=t[0])||void 0===t?void 0:t.stockType})]}),m&&(0,s.jsx)("div",{className:"product-card__content-text",children:m})]}),(0,s.jsxs)("div",{className:"product-card__footer",children:[g&&(0,s.jsx)("div",{className:"product-card__content-prices",children:(0,s.jsx)(E,{enabled:!0,outsideContext:b})}),j&&(0,s.jsx)(ne,{product:b,componentType:P}),w&&h&&(0,s.jsx)("a",{href:h,className:"product-card__link",children:O("View recipe")}),!(0,x.ay)()&&!S&&(0,s.jsxs)("div",{className:"contact-us__buttons",children:[(null===I||void 0===I?void 0:I.distributorsLink)&&(0,s.jsx)("button",{className:"btn btn-secondary",onClick:()=>{var e;return window.location.href=null===I||void 0===I||null===(e=I.distributorsLink)||void 0===e?void 0:e.url},children:O(null===I||void 0===I||null===(r=I.distributorsLink)||void 0===r?void 0:r.label)}),(null===I||void 0===I?void 0:I.contactUsLink)&&(0,s.jsx)("a",{href:null===I||void 0===I||null===(i=I.contactUsLink)||void 0===i?void 0:i.url,children:O(null===I||void 0===I||null===(o=I.contactUsLink)||void 0===o?void 0:o.label)})]})]})]})};function be(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function xe(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?be(Object(r),!0).forEach(function(t){fe(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):be(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function fe(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ge(e){let{type:t,className:r,setIsFirstSlide:i,setIsLastSlide:o}=e;const a=!(null===r||void 0===r||!r.includes("slick-disabled"));return(0,n.useEffect)(()=>{"prev"===t?i(a):o(a)},[a,t,i,o]),(0,s.jsx)("div",{})}const je=e=>{let{title:t,componentId:r=null,children:o}=e;const a=(0,y.GO)(),l=[{breakpoint:1399,settings:{slidesToShow:3.01,slidesToScroll:1}},{breakpoint:999,settings:{slidesToShow:2.01,slidesToScroll:1}},{breakpoint:759,settings:{slidesToShow:1.2,slidesToScroll:1}}
1],c=n.useRef(null),[d,u]=(0,n.useState)(!1),[v,p]=(0,n.useState)(!0),[m,h]=(0,n.useState)(!1),[b,x]=(0,n.useState)(0),f=e=>{if(null!==e){const t=l.find(t=>t.breakpoint===e);return t?t.settings.slidesToShow:4.01}const t=[...l].sort((e,t)=>e.breakpoint-t.breakpoint).find(e=>window.innerWidth<e.breakpoint);return t?t.settings.slidesToShow:4.01},g={dots:!1,infinite:!1,speed:500,slidesToShow:f(null),slidesToScroll:1,swipeToSlide:!0,responsive:l,prevArrow:(0,s.jsx)(ge,{type:"prev",setIsFirstSlide:p,setIsLastSlide:h}),nextArrow:(0,s.jsx)(ge,{type:"next",setIsFirstSlide:p,setIsLastSlide:h}),onReInit:()=>{var e,t;const r=null===c||void 0===c||null===(e=c.current)||void 0===e||null===(e=e.props)||void 0===e?void 0:e.children.length,n=f(null===c||void 0===c||null===(t=c.current)||void 0===t?void 0:t.state.breakpoint);u(r>n)},beforeChange:(e,t)=>{var r,n;let i;const s=(null===c||void 0===c||null===(r=c.current)||void 0===r||null===(r=r.props)||void 0===r?void 0:r.children.length)-f(null===c||void 0===c||null===(n=c.current)||void 0===n?void 0:n.state.breakpoint);i=0===t?0:s<=0?100:t/s*100,x(i)}};return(0,s.jsxs)("div",{className:"product-card-slider ".concat(d?"":"slider-disabled"),children:[(0,s.jsxs)("div",{className:"product-card-slider-header",children:[(0,s.jsx)("h2",xe(xe({className:"product-card-slider-title"},r?{id:r}:{}),{},{children:t})),(0,s.jsxs)("div",{className:"product-card-slider-navigation",children:[(0,s.jsx)("button",{"aria-label":a("Previous card"),onClick:()=>{var e;return null===c||void 0===c||null===(e=c.current)||void 0===e?void 0:e.slickPrev()},disabled:v,className:"slick-prev slick-arrow"}),(0,s.jsx)("button",{"aria-label":a("Next card"),onClick:()=>{var e;return null===c||void 0===c||null===(e=c.current)||void 0===e?void 0:e.slickNext()},disabled:m,className:"slick-next slick-arrow"})]})]}),(0,s.jsx)("div",{className:"product-card-slider-content",children:(0,s.jsx)(i.A,xe(xe({ref:c},g),{},{className:"product-card-container-slider",children:o}))}),(0,s.jsx)("div",{className:"product-card-slider-progress",children:(0,s.jsx)("span",{className:"product-card-slider-progress--value",style:{"--progress-value":"".concat(b,"%")}})})]})};var ye=r(95799),_e=r(43516);function we(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Ne(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?we(Object(r),!0).forEach(function(t){Pe(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):we(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Pe(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Oe=e=>(0,s.jsx)("div",{className:"card-slider--loading",children:(0,s.jsx)(_e.Ay,Ne(Ne({height:"400px",width:"100%",speed:ye.P.SPEED,backgroundColor:ye.P.BACKGROUND,foregroundColor:ye.P.FOREGROUND,style:{borderRadius:"10px"}},e),{},{children:(0,s.jsx)("rect",{x:"0",y:"0",width:"100%",height:"100%"})}))}),ke="relatedProductsCount",Se="relatedProductsCountUpdated",Ce=()=>{var e;const t=(0,n.useContext)(Pt),[r,i]=(0,n.useState)([]),[o,a]=(0,n.useState)(!0),l=(0,n.useRef)(!1),c=(0,y.GO)(),d=null===t||void 0===t||null===(e=t.relatedProducts)||void 0===e?void 0:e.products;if((0,n.useEffect)(()=>{if(l.current||null===d||void 0===d||!d.length)return void a(!1);(async()=>{l.current=!0;try{const e=(0,x.ay)()?await(0,$.wW)([...d].splice(0,12)):[...d];i(e),sessionStorage.setItem(ke,e.length.toString()),window.dispatchEvent(new Event(Se))}catch(e){console.error(e)}finally{a(!1)}})()},[d]),o)return(0,s.jsx)(Oe,{});if(!r.length)return null;const u=t.product.recommendedAlternativeVaritionsLabel||"Recommended alternative products",v=t.product.renditionFallback,p=r.map((e,t)=>(0,s.jsx)(he,{data:(0,$.C$)(e,v,q.Cf.PDP_RELATED_PRODUCTS)},t));return(0,s.jsx)("div",{className:"pdp-section__container",children:(0,s.jsx)(je,{title:c(u),componentId:"related-products",children:p})})},Ee=()=>
1{const[e,t]=(0,n.useState)(0),r=(0,y.GO)(),i=(0,n.useContext)(Pt),{hideAlternativeVariationsLabel:o,alternativeVariationsLabel:a,viewAlternativeVariationsLabel:l}=i.product;(0,n.useEffect)(()=>{window.addEventListener(Se,()=>{const e=sessionStorage.getItem(ke);t(e?parseInt(e,10):0)})},[]);const c=l||"View alternative flavours",d=a||"This item is available in {0} alternative flavours";return!e||o||(0,_.hf)(_.gg.invalid)?null:(0,s.jsxs)("p",{className:"pdp-related-products-text",children:[r(d,[e])," ",(0,s.jsx)("br",{}),(0,s.jsx)("a",{href:"#related-products",children:r(c)})]})},Te=e=>{let{item:t,itemIndex:r}=e;const{activeProductIndex:i,product:o}=(0,n.useContext)(Pt),a=(0,y.GO)(),l=null===o||void 0===o?void 0:o.renditionFallback,c=i===r;return(0,s.jsxs)("div",{className:"pdp-bundle__item ".concat(c?"active":""),children:[(0,s.jsx)("img",{src:t.skuImageURL,alt:t.AEMProdName,onError:e=>{l&&(e.currentTarget.src=l)}}),c?(0,s.jsx)("a",{className:"pdp-bundle__item-name",href:t.ProductUrl,children:t.AEMProdName}):(0,s.jsxs)("div",{className:"pdp-bundle__item-name--not-main",children:[(0,s.jsxs)("span",{children:[(0,s.jsx)("strong",{children:"1 x "}),(0,s.jsx)("a",{className:"pdp-bundle__item-name",href:t.ProductUrl,children:t.AEMProdName})]}),(0,s.jsxs)("span",{className:"pdp-bundle__item-price",children:[(0,s.jsx)("strong",{children:t.TotalPrice})," ",a("each")]})]})]},t.MaterialNumber)},Ie=e=>{let{UnitPrice:t,PromotionUnitPrice:r}=e;return(0,s.jsx)(s.Fragment,{children:r?(0,s.jsxs)("div",{className:"pdp-bundle__bundle-price pdp-bundle__bundle-price--promo",children:[(0,s.jsx)("span",{className:"regular",children:t}),(0,s.jsx)("span",{className:"promotion",children:r})]}):(0,s.jsx)("div",{className:"pdp-bundle__bundle-price",children:(0,s.jsx)("span",{className:"regular",children:t})})})};var Ae=r(77106),Le=r(85305);const Ue=(0,Ae.p)();const De=e=>{let{BundleId:t}=e;const r=(0,y.GO)(),i=(0,L.useDispatch)(),[o,a]=n.useState(1),l=9999,[c,d]=(0,n.useState)(!1),[u,v]=(0,n.useState)(!1),[p,m]=(0,n.use
1State)(!1);return(0,n.useEffect)(()=>{u&&i((0,R.YY)())},[u]),(0,s.jsxs)("div",{className:"pdp-bundle__add-to-cart",children:[(0,s.jsxs)("div",{className:"add-to-cart__controls",children:[(0,s.jsx)("button",{className:"add-to-cart__controls--decrement","aria-label":r("Decrement quantity"),onClick:()=>{o>1&&a(o-1)},disabled:o<=1}),(0,s.jsx)("input",{type:"number",value:o,"aria-label":r("Quantity input"),onChange:e=>{a(e.target.value)},onBlur:()=>{a(e=>Math.max(1,Math.min(l,Math.round(Number(e)))))},min:1,max:l}),(0,s.jsx)("button",{className:"add-to-cart__controls--increment",onClick:()=>{o<l&&a(o+1)},"aria-label":r("Increment quantity"),disabled:o>=l})]}),(0,s.jsx)("button",{className:"btn btn-primary ".concat(u?"add-to-cart__button add-to-cart__button--added":"add-to-cart__button"),onClick:async()=>{d(!0);try{await async function(e,t){const r=(0,x.Ul)(),n=(0,Ae.I)("AddBasketBundle"),i=Le.As({Language:r,Quantity:t,BundleId:e});try{const e=await Ue.post("".concat(n,"?").concat(i),{headers:{"Content-Type":"application/json"}});if(e.status>=200&&e.status<300)return e.data;throw console.error("Error:",e.status,e.data),new Error("Error: ".concat(e.status))}catch(s){throw console.error("API Endpoint error: ".concat(s)),s}}(t,o),v(!0),setTimeout(()=>{v(!1),a(1)},2e3)}catch(e){console.error("Error adding to cart:",e),m(!0)}finally{d(!1)}},disabled:p||c||u,children:(()=>{switch(!0){case u:return r("Added to cart");case p:return r("Failed to add to cart");case c:return r("Adding to cart");default:return r("Add to cart")}})()})]})},Be=e=>{let{UnitPrice:t,PromotionUnitPrice:r,BundleId:n}=e;const i=(0,y.GO)();return(0,s.jsxs)("div",{className:"pdp-bundle__summary",children:[(0,s.jsx)("span",{className:"pdp-bundle__summary-title",children:i("Total price")}),(0,s.jsx)(Ie,{UnitPrice:t,PromotionUnitPrice:r}),(0,s.jsx)(De,{BundleId:n})]})},Me=e=>{let{Option:t}=e;return(0,s.jsxs)("div",{className:"pdp-bundle",children:[(0,s.jsx)("div",{className:"pdp__badges-container",children:(0,s.jsx)("span",{className:"pdp-bundle__label pdp-badge pdp-badge--red",children:t.BundleName})}),(0,s.jsx)("div",{className:"pdp-bundle__items",children:t.Items.map((e,t)=>(0,s.jsx)(Te,{item:e,itemIndex:t}))}),(0,s.jsx)(Be,{BundleId:t.BundleId,UnitPrice:t.UnitPrice,PromotionUnitPrice:t.PromotionUnitPrice})]},t.BundleId)},Ge=()=>{const e=(0,y.GO)(),{PromotionStructure:t}=(0,n.useContext)(Pt);if(!(0,_.M3)()||!t)return null;const r=t.map(e=>{let{Promotion:t}=e;return t}).filter(e=>{let{Option:t}=e;return!!t.BundleId});return r&&0!==r.length?(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{className:"pdp-bundles",children:[(0,s.jsx)("h2",{className:"pdp-bundles__title",children:e("Recommended products")}),(0,s.jsx)("div",{className:"pdp-bundles__content",children:r.map(e=>{let{Option:t}=e;return(0,s.jsx)(Me,{Option:t},t.BundleId)})})]})}):null};function Re(){const e=(0,y.GO)(),{stencil:t,signInOrCreateAccount:r}=(0,n.useContext)(Pt);return(0,_.hf)(_.gg.invalid)?(0,s.jsxs)("div",{className:"sign-in",children:[(0,s.jsxs)("div",{className:"sign-in__buttons",children:[(0,s.jsx)("button",{className:"btn btn-primary",onClick:()=>(0,re.y)(),children:e("Sign in to view prices")}),(null===t||void 0===t?void 0:t.signUpUrl)&&(0,s.jsx)("button",{className:"btn btn-secondary",onClick:()=>window.location.href=t.signUpUrl,children:e("Create an account")}
1)]}),(null===r||void 0===r?void 0:r.text)&&(0,s.jsx)("div",{className:"benefits",dangerouslySetInnerHTML:{__html:r.text}})]}):null}const Fe=()=>(0,s.jsxs)("div",{className:"pdp__overview",children:[(0,s.jsx)(j,{}),(0,s.jsx)(S,{}),(0,s.jsx)(I,{enabled:!0}),(0,s.jsx)(A,{}),(0,s.jsx)(B,{}),(0,s.jsx)(Re,{}),(0,s.jsx)(Z,{}),(0,s.jsx)(Ee,{}),(0,s.jsx)(Ge,{})]}),qe=(0,Ae.p)();const He=e=>{var t,r;let{isCarousel:i=!0}=e;const o=(0,y.GO)(),a=(0,n.useContext)(Pt),[l,c]=(0,n.useState)({Products:[]}),[d,u]=(0,n.useState)(!0),v=(0,n.useRef)(!1),p=null===a||void 0===a||null===(t=a.product)||void 0===t?void 0:t.id,m=null===a||void 0===a||null===(r=a.alsoBoughtProducts)||void 0===r?void 0:r.Products;if((0,n.useEffect)(()=>{if(!(0,x.ay)())return void u(!1);if(null!==m&&void 0!==m&&m.length)return c({Products:m}),void u(!1);if(!p||v.current)return void u(!1);(async()=>{v.current=!0;try{const{Products:t}=await async function(e){let{AEMProductID:t}=e;if(!(0,x.ay)())return null;const r=(0,x.Ul)(),n=(0,_.M3)()?(0,Ae.I)("GetProductRecommendations"):(0,Ae.I)("GetAnonRecommendations"),i=Le.As({AEMProductID:t,Language:r,limit:10});try{const e=await qe.get("".concat(n,"?").concat(i));if(e.status>=200&&e.status<300)return e.data;throw new Error("API Endpoint error: ".concat(e.statusText))}catch(s){throw console.error(s),s}}({AEMProductID:p});if(t.length){var e;const r=await(0,$.Z0)([...t].splice(0,12));c({Products:r}),null===a||void 0===a||null===(e=a.setAlsoBoughtProducts)||void 0===e||e.call(a,{Products:r})}}catch(t){console.error(t)}finally{u(!1)}})()},[p,m]),d)return(0,s.jsx)(Oe,{});if(!l.Products.length)return null;const h=a.product.renditionFallback,b=l.Products.map((e,t)=>(0,s.jsx)(he,{data:(0,$.Py)(e,h,q.Cf.PDP_ALSO_BOUGHT)},t));return(0,s.jsx)("div",{className:"pdp-section__container",children:i?(0,s.jsx)(je,{title:o("Customers also bought"),children:b}):(0,s.jsx)("div",{className:"product-cards__container",children:b.slice(0,10)})})};var Ve=r(62834);const Qe=()=>{const e=(0,n.useContext)(Pt),[t,r]=(0,n.useState)(null),i=(0,y.GO)();if((0,n.useEffect)(()=>{(0,_.M3)()&&null!==e&&void 0!==e&&e.relatedRecipes?(async()=>{try{const e=await(0,Ve.l)();r(e)}catch(e){console.error("Error fetching favorite recipes:",e),r(Ve.o)}})():r(Ve.o)},[]),null===e||void 0===e||!e.relatedRecipes)return null;const{recipes:o}=e.relatedRecipes,a=e.product.renditionFallback;if(!o.length)return null;const l=[...o].splice(0,12).map((e,r)=>(0,s.jsx)(he,{data:(0,$.aw)(e,t,a)},r));return(0,s.jsx)("div",{className:"pdp-section__container",children:(0,s.jsx)(je,{title:i("Related recipes"),children:l})})},Ye=(e,t)=>{if(!e.url)return"";if(!e.queryParams)return e.url;if(P.Gf.replacePlpWithAlgolia){let r;r=P.Gf.enablePIM&&1==t?(0,N.Ge)(e.queryParams.enrichedTag,e.label):(0,N.c3)(e.queryParams.enrichedTag,e.label);const n=r.toString();return n?"".concat(e.url,"?").concat(n):e.url}const r=new URLSearchParams;Object.entries(e.queryParams).forEach(e=>{let[t,n]=e;if("enrichedTag"===t||!n)return;const i="tag"===t?(0,N.sF)(n):n;i&&r.set(t,i)});const n=r.toString();return n?"".concat(e.url,"?").concat(n):e.url},We=()=>{const e=n.useContext(Pt).breadcrumb;return(0,s.jsx)("div",{className:"pdp__breadcrumb",children:(0,s.jsx)("ul",{children:e.elements.map((e,t)=>(0,s.jsx)("li",{children:e.url?(0,s.jsx)("a",{href:Ye(e,t),children:e.label}):(0,s.jsx)("span",{children:e.label})},t))})})};var Ke=r(94290),ze=r(64757),Je=r(90011);function Xe(){const e=(0,y.GO)(),{product:t}=(0,n.useContext)(Pt),r=(0,n.useRef)(null),[i,o]=(0,n.useState)(!0),[a,l]=(0,n.use
1State)(!1);(0,n.useEffect)(()=>{if(!r.current)return;const e=document.getElementById("details"),t=e?e.offsetHeight:0,n=r.current.offsetHeight;n>=.5*t?(r.current.style.setProperty("--hiddenContentHeight","".concat(n/2,"px")),l(!0),o(!1)):l(!1)},[r]);const c=()=>{r.current&&r.current.scrollIntoView({behavior:"smooth"}),o(!i)};return(0,s.jsxs)("div",{id:"details",className:"details",children:[(0,s.jsx)("div",{ref:r,"aria-expanded":i,"aria-controls":"product-details","aria-description":e("Product description"),className:"".concat(i||!a?"details__description":"details__description details__description--hidden"),dangerouslySetInnerHTML:{__html:t.description}}),a&&(0,s.jsx)("a",{className:"details__button",onClick:c,role:"button",tabIndex:0,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),c())},"aria-label":e(i?"View less":"View full description"),children:e(i?"View less":"View full description")}),t.benefits&&t.benefits.length>0&&(0,s.jsx)("ul",{className:"details__benefits",children:t.benefits.map((e,t)=>(0,s.jsx)("li",{className:"details__benefit",children:e},t))})]})}var Ze=r(17477);const $e=e=>{let{label:t,openByDefault:r,children:i}=e;const o=(0,Ze.a)("768px"),a=r&&!o,[l,c]=(0,n.useState)(a);(0,n.useEffect)(()=>{c(r&&!o)},[r,o]);const d=()=>{c(!l)};return(0,s.jsxs)("div",{className:"".concat(l?"accordion__item accordion__item--open":"accordion__item"),children:[(0,s.jsx)("div",{className:"accordion__label",role:"button",tabIndex:0,"aria-expanded":l,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),d())},onClick:d,children:t}),(0,s.jsx)("div",{"aria-hidden":!l,className:"".concat(l?"accordion__content":"accordion__content accordion__content--closed"),children:i})]})},et=(0,Ae.p)();const tt=()=>{const e=(0,y.GO)(),{materials:t,activeProductIndex:r}=(0,n.useContext)(Pt);if(!t||0===t.length)return(0,s.jsx)("div",{className:"accordion__specifications no-data"});const i=t[r],{materialDescription:o,packaging:a,materialNumber:l,palletisation:c,eanCode:d,shelfLife:u}=i,v=!o&&!a&&!l&&!c&&!d&&!u;return(0,s.jsxs)("div",{className:"".concat(v?"accordion__specifications no-data":"accordion__specifications"),children:[o&&(0,s.jsxs)("p",{children:[(0,s.jsxs)("b",{children:[e("Description"),": "]}),o]}),l&&(0,s.jsxs)("p",{children:[(0,s.jsxs)("b",{children:[e("Product code"),": "]}),l]}),a&&(0,s.jsxs)("p",{children:[(0,s.jsxs)("b",{children:[e("Packaging"),": "]}),a]}),c&&(0,s.jsxs)("p",{children:[(0,s.jsxs)("b",{children:[e("Palletisation"),": "]}),c]}),u&&(0,s.jsxs)("p",{children:[(0,s.jsxs)("b",{children:[e("Shelf life"),": "]}),u]}),d&&(0,s.jsxs)("p",{children:[(0,s.jsxs)("b",{children:[e("EAN Code"),": "]}),d]})]})},rt=(0,Ae.p)();const nt=e=>e.some(e=>{let{DocTypeLabel:t}=e;return"TDS"===t}),it=e=>{let{downloads:t=[]}=e;const r=(0,y.GO)(),{product:i}=(0,n.useContext)(Pt)||{},o=(null===i||void 0===i?void 0:i.downloadAssets)||[],a=null===i||void 0===i?void 0:i.ingredientsAllergensUsage,l=nt(t),c=!(null!==t&&void 0!==t&&t.length)&&!a&&!(null!==o&&void 0!==o&&o.length),d=(0,L.useDispatch)(),u=async(e,t,r)=>{e.preventDefault(),(0,_.M3)()?await async function(e,t){const r=(0,Ae.I)("GetDoc"),n=Le.As({URLId:e});try{const e=await rt.get("".concat(r,"?").concat(n),{responseType:"arraybuffer"});if(!(e.status>=200&&e.status<300))throw console.error("Error:",e.status,e.data),new Error("Error: ".concat(e.status));{const r=new Blob([e.data],{type:"application/pdf"}),n=window.URL.createObjectURL(r),i=document.createElement("a");i.style.visibility="hidden",i.href=n,i.setAttribute("download","".concat(t,".pdf")),document.body.appendChild(i),i.click(),document.body.removeChild(i),window.URL.revokeObjectURL(n)}}catch(i){console.error("API Endpoint error: ".concat(i))}}(t,r):d((0,U.C8)())},v=(null===t||void 0===t?void 0:t.length)>0,p=(null===o||void 0===o?void 0:o.length)>0;return(0,s.jsxs)("div",{className:"".concat(c?"accordion__ingredients no-data":"accordion__ingredients"),children:[!l&&a&&(0,s.jsx)("div",{className:"accordion__ingredients--author",dangerouslySetInnerHTML:{__html:a}}),(v||p)&&(0,s.jsxs)("div",{className:"accordion__ingredients--downloads",children:[(0,s.jsx)("p",{children:r("Downloads")}),v&&t.map((e,t)=>{let{ProductName:r,URLId:n}=e;return(0,s.jsxs)("a",{onClick:e=>u(e,n,r),href:"#",children:[(0,s.jsx)("div",{className:"download-icon"}),r]},t)}),p&&o.map((e,t)=>{const r=null===e||void 0===e?void 0:e.split("/").pop().replace(".pdf","");return(0,s.jsxs)("a",{href:e,children:[(0,s.jsx)("div",{className:"download-icon"}),r]},t)})]})]})};var st=r(94632);const ot=()=>{const e=(0,y.GO)(),{product:t}=(0,n.useContext)(Pt),{applications:r}=t.tags,i=!r.length;return(0,s.jsx)("div",{className:"".concat(i?"accordion__applications no-data":"accordion__applications"),children:r.map((t,n)=>(0,s.jsxs)("a",{href:(0,st.S)(t),children:[e(t.title),n<r.length-1?",":""]},n))})},at=()=>{const{product:e}=(0,n.useContext)(Pt),{benefits:t}=e.tags,r=!t.length;return(0,s.jsx)("div",{className:"".concat(r?"accordion__benefits no-data":"accordion__benefits"),children:t.map((e,t)=>(0,s.jsx)(b.e,{benefit:e},t))})},lt=()=>{const{contactUsFindStockist:e}=(0,n.useContext)(Pt),t=(0,y.GO)();return null!==e&&void 0!==e&&e.contactUsLink?(0,s.jsxs)("div",{className:"contact-us",children:[(null===e||void 0===e?void 0:e.text)&&(0,s.jsx)("div",{dangerouslySetInnerHTML:{__html:e.text}}),(0,s.jsx)("a",{className:"btn btn-secondary",href:e.contactUsLink.url,children:t(e.contactUsLink.label)})]}):null},ct=()=>{const e=(0,y.GO)(),{product:t,materials:r}
1=(0,n.useContext)(Pt),[i,o]=(0,n.useState)([]),a=t.ingredientsAllergensUsage,[l,c]=(0,n.useState)(!1);(0,n.useEffect)(()=>{(0,x.ay)()&&(async()=>{try{if(null===t||void 0===t||!t.id)return;const{DocGetListItems:e}=await async function(e){if(!(0,x.ay)())return null;const t=(0,x.Ul)(),r=(0,Ae.I)("DocGetList"),n=Le.As({Language:t,AEMProductGUID:e});try{const e=await et.get("".concat(r,"?").concat(n));if(e.status>=200&&e.status<300)return e.data;throw console.error("Error:",e.status,e.data),new Error("Error: ".concat(e.status))}catch(i){throw console.error("API Endpoint error: ".concat(i)),i}}(t.id);e&&o(e)}catch(e){console.error(e)}})()},[null===t||void 0===t?void 0:t.id]),(0,n.useEffect)(()=>{i.length&&c(nt(i)||!!i.length&&!a)},[i,a]);const d=[{label:e("Applications"),content:(0,s.jsx)(ot,{}),openByDefault:!0},{label:e("Ingredients, Allergens, Usage and Downloads"),content:(0,s.jsx)(it,{downloads:i}),openByDefault:l}];return null!==r&&void 0!==r&&r.length&&d.push({label:e("Specifications"),content:(0,s.jsx)(tt,{}),openByDefault:!0}),d.push({label:e(t.additionalAccordionLabel),content:(0,s.jsx)("div",{className:!1===!!t.additionalAccordionContent&&"no-data",dangerouslySetInnerHTML:{__html:t.additionalAccordionContent}}),openByDefault:!1}),(0,s.jsxs)("div",{className:"accordion",children:[(0,s.jsx)(at,{}),d.map((e,t)=>{let{label:r,content:n,openByDefault:i}=e;return(0,s.jsx)($e,{openByDefault:i,label:r,children:n},t)}),(0,s.jsx)(lt,{})]})},dt=()=>{const e=(0,y.GO)();return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("h2",{id:"product-details",className:"product-details__title",children:e("Product details")}),(0,s.jsx)(Xe,{}),(0,s.jsx)(ct,{})]})};let ut=function(e){return e.APPENDIX="appendix",e.WHY="why",e.CTA_BANNER="cta_banner",e}({});const vt=e=>{let{injectType:t}=e;const[r,i]=(0,n.useState)(""),o=t&&"pdp__".concat(t);return(0,n.useEffect)(()=>{if(!o)return null;const e=document.getElementById(o);e&&i(e.innerHTML)},[o]),o&&null!==r&&void 0!==r&&r.trim().length?(window.dispatchEvent(new CustomEvent("teasersRendered",{detail:{sectionClass:o}})),(0,s.jsx)("section",{className:o,children:(0,s.jsx)("div",{dangerouslySetInnerHTML:{__html:r}})})):null},pt=e=>{let{stencil:t}=e;const{errorMessage:r,refreshButtonLabel:n,redirectButtonLabel:i,redirectButtonLink:o}=t;return(0,s.jsxs)("div",{className:"error-page",children:[(0,s.jsx)("div",{className:"error-page__text",dangerouslySetInnerHTML:{__html:r}}),(0,s.jsxs)("div",{className:"error-page__buttons",children:[(0,s.jsx)("button",{className:"btn btn-primary",onClick:()=>window.location.reload(),children:n}),(0,s.jsx)("button",{className:"btn btn-primary",onClick:()=>window.location.href=o,children:i})]})]})};var mt=r(56729);const ht=()=>{const e=(0,y.GO)(),{setShowBasketOverlay:t}=(0,n.useContext)(Pt);return(0,s.jsxs)("div",{className:"overlay-content__label",children:[(0,s.jsx)("div",{className:"overlay-content__label__icon svg-check-mark-green-circle-lg"}),(0,s.jsx)("span",{className:"overlay-content__label__text",children:(0,s.jsx)("strong",{children:e("Added to cart")})}),(0,s.jsx)("button",{className:"overlay-content__label__close svg-close-black75-lg",onClick:()=>t(!1)})]})},bt=()=>{var e,t;const r=(0,y.GO)(),{quantityAddedToCart:i,activeProductIndex:o,materials:a,product:l}=(0,n.useContext)(Pt),c=a[o],{stockType:d,salesPrice:u,basePrice:v,packaging:p,hasPromotionalPrice:m,finalSalesPrice:h,finalBasePrice:b}=c,x=(null===(e=l.packagings[o])||void 0===e||null===(e=e.image)||void 0===e?void 0:e.smallUrl)||(null===(t=l.referenceImage)||void 0===t?void 0:t.smallUrl),f=l.title,g=null===l||void 0===l?void 0:l.renditionFallback;return(0,s.jsxs)("div",{className:"overlay-content__product",children:[(0,s.jsx)("div",{className:"overlay-content__product-image",children:(0,s.jsx)("img",{src:x,alt:f,onError:e=>{g&&(e.currentTarget.src=g)}})}),(0,s.jsxs)("div",{className:"overlay-content__product-info",children:[(0,s.jsx)("span",{className:"overlay-content__product-name",children:(0,s.jsx)("strong",{children:f})}),(0,s.jsxs)("div",{className:"overlay-content__product-size",children:[(0,s.jsx)("span",{children:p}),(0,s.jsx)(k.A,{stockType:d})]}),(0,s.jsxs)("span",{children:[i," ",r(1!==i?"units":"unit")]})]}),(0,s.jsx)("div",{className:"overlay-content__product-prices",children:(0,s.jsxs)("div",{className:"overlay-content__product-prices--container",children:[m&&(0,s.jsxs)("div",{className:"price price--regular",children:[(0,s.jsxs)("span",{children:[(0,s.jsx)("strong",{children:u}),"/",r("unit")]}),(0,s.jsx)("span",{children:(0,s.jsx)("strong",{children:v})})]}),(0,s.jsxs)("div",{className:"".concat(m?"price price--promo":"price"),children:[(0,s.jsxs)("span",{children:[(0,s.jsx)("strong",{children:h}),"/",r("unit")]}),(0,s.jsx)("span",{children:(0,s.jsx)("strong",{children:b})})]})]})})]})},xt=()=>{const e=(0,y.GO)(),t=(0,Ze.a)(),{setShowBasketOverlay:r}=(0,n.useContext)(Pt);return(0,s.jsxs)("div",{className:"overlay-content__actions",children:[(0,s.jsx)("button",{className:"btn btn-secondary",onClick:()=>r(!1),children:e("Continue shopping")}),(0,s.jsx)("button",{className:"btn btn-primary",onClick:()=>window.location.href="".concat(window.location.origin).concat((0,x.kJ)(),"/mypuratos/cart"),children:e(t?"Go to shopping cart":"Go to cart")})]})}
1,ft=()=>{const[e,t]=(0,n.useState)("top"),r=(0,n.useRef)(null),i=(0,y.GO)();return(0,n.useEffect)(()=>{const e=r.current;if(!e||e.clientHeight>=e.scrollHeight)return;const n=()=>{const n=0===e.scrollTop,i=(e=>e.scrollHeight-e.scrollTop-e.clientHeight)(r.current)<=5;t(n?"top":i?"bottom":"middle")};return e.addEventListener("scroll",n),n(),()=>{e.removeEventListener("scroll",n)}},[r.current]),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("h2",{children:i("Other customers bought")}),(0,s.jsx)("div",{ref:r,className:"overlay-content__crosssell overlay-content__crosssell--scrolled-".concat(e),children:(0,s.jsx)(He,{isCarousel:!1})})]})},gt=()=>{const{showBasketOverlay:e,setShowBasketOverlay:t}=(0,n.useContext)(Pt);if(!e)return null;const[r,i]=n.useState(!1);return(0,n.useEffect)(()=>{const e=setTimeout(()=>{i(!0)},500);return()=>{clearTimeout(e)}},[]),(0,s.jsxs)("div",{className:"basket-overlay ".concat(r?" basket-overlay--active":""),children:[(0,s.jsx)("div",{className:"overlay-blur",onClick:()=>t(!1),onKeyDown:e=>"Enter"===e.key&&t(!1),role:"button",tabIndex:0}),(0,s.jsxs)("div",{className:"overlay-content",children:[(0,s.jsx)(ht,{}),(0,s.jsx)(bt,{}),(0,s.jsx)(ft,{}),(0,s.jsx)(xt,{})]})]})},jt=(0,Ae.p)();var yt=r(90251);function _t(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function wt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?_t(Object(r),!0).forEach(function(t){Nt(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_t(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Nt(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Pt=(0,n.createContext)(null),Ot=(0,n.createContext)(null),kt=document.getElementById("react-product--packaging"),St=()=>{var e;const[t,r]=(0,n.useState)(null),[i,o]=(0,n.useState)(!1),[a,l]=(0,n.use
1State)(!0),[c,d]=(0,n.useState)(!1);(0,n.useEffect)(()=>{const e=document.getElementById("pdp__data");if(!e)return console.error("Product data script element not found"),o(!0),void l(!1);const t=JSON.parse(e.textContent.trim()?e.textContent:"{}");if(!t.product||!t.product.id)return console.error("Product data is missing or invalid"),o(!0),void l(!1);r(t),(async()=>{try{var e,n;const s=(null===(e=t.product)||void 0===e||null===(e=e.packagings)||void 0===e?void 0:e.filter(e=>null!==e.code))||[],o=(0,_.M3)()&&await(0,ze.z)();let a=[],c=!0;if(null!==s&&void 0!==s&&s.length)try{a=(await Promise.all(s.map(async e=>{let{code:r}=e;const[n,i]=await Promise.allSettled([(0,Ke.Q)(r,(0,x.ay)()),(0,_.M3)()?(0,Ke.S)(r):Promise.resolve(null)]),s="fulfilled"===n.status?n.value:null,o="fulfilled"===i.status?i.value:null;if(!s)return null;const a=(0,yt.PQ)(s,o,t.product.id);return a&&"rejected"===i.status&&(a.hasPrice=!1),a}))).filter(Boolean),0===a.length&&(c=!1)}catch(i){console.error("Error fetching materials:",i),c=!1}let d=[];try{const e=(0,_.M3)()&&await async function(e){const t=(0,x.Ul)(),r=(0,Ae.I)("GetBundles"),n={AEMProductIds:e},s=Le.As({Language:t});try{const e=await jt.post("".concat(r,"?").concat(s),n,{headers:{"Content-Type":"application/json"}});if(e.status>=200&&e.status<300)return e.data;throw console.error("Error:",e.status,e.data),new Error("Error: ".concat(e.status))}catch(i){throw console.error("API Endpoint error: ".concat(i)),i}}([t.product.id]);d=(null===e||void 0===e?void 0:e.PromotionStructure)||[]}catch(i){console.error("Error fetching bundles:",i)}const h=b(a),f=m(h)||0,g=!1;null!==(n=t.product)&&void 0!==n&&null!==(n=n.packagings)&&void 0!==n&&n.length&&null!==h&&void 0!==h&&h.length&&(t.product.packagings=function(e,t){if(null===e||void 0===e||!e.length||null===t||void 0===t||!t.length)return e?[...e]:[];const r=new Map;return t.forEach((e,t)=>{r.set(e.materialNumber,t)}),[...e].sort((e,t)=>{const n=r.get(e.code),i=r.get(t.code);return void 0===n&&void 0===i?0:void 0===n?1:void 0===i?-1:n-i})}(t.product.packagings,h)),r(wt(wt({},t),{},{materials:h,materialsFetchSuccess:c,PromotionStructure:d,activeProductIndex:f,setActiveProduct:u,config:o||null,quantityAddedToCart:0,showBasketOverlay:g,setShowBasketOverlay:v,alsoBoughtProducts:{Products:[]},setAlsoBoughtProducts:p})),l(!1)}catch(i){console.error("Caught error:",i),o(!0),l(!1)}})()},[]);const u=e=>{r(t=>t?wt(wt({},t),{},{activeProductIndex:t.materials.findIndex(t=>t.materialNumber===e)}):null)},v=(e,t)=>
1{r(r=>r?wt(wt({},r),{},{showBasketOverlay:e,quantityAddedToCart:t||r.quantityAddedToCart}):null)},p=e=>{r(t=>t?wt(wt({},t),{},{alsoBoughtProducts:e}):null)},m=e=>{const t=new URLSearchParams(window.location.search);if(!t.has("materialNumber"))return 0;const r=t.get("materialNumber"),n=e.findIndex(e=>e.materialNumber===r);return n<0?0:n},b=e=>[...e].sort((e,t)=>("BLOCKSALE"===e.stockType?1:0)-("BLOCKSALE"===t.stockType?1:0));return(0,n.useEffect)(()=>{var e;!c&&t&&null!==(e=t.materials)&&void 0!==e&&e.length&&((0,_.M3)()?(0,f.MS)(t):(0,f._x)(t),d(!0))},[null===t||void 0===t?void 0:t.materials]),a?(0,s.jsx)(Je.w,{}):i?(0,s.jsx)(pt,{stencil:{errorMessage:(null===t||void 0===t||null===(g=t.stencil)||void 0===g?void 0:g.errorMessage)||"Something went wrong. Try again later or go to products.",refreshButtonLabel:(null===t||void 0===t||null===(j=t.stencil)||void 0===j?void 0:j.refreshButtonLabel)||"Refresh",redirectButtonLabel:(null===t||void 0===t||null===(y=t.stencil)||void 0===y?void 0:y.redirectButtonLabel)||"Go to products",redirectButtonLink:(null===t||void 0===t||null===(w=t.stencil)||void 0===w?void 0:w.redirectButtonLink)||"/content/usa/en/products"}}):(0,s.jsx)(n.Fragment,{children:(0,s.jsxs)(Pt.Provider,{value:t,children:[(0,s.jsx)(mt.t,{}),(0,s.jsx)(gt,{}),!(null!==t&&void 0!==t&&null!==(e=t.product)&&void 0!==e&&e.hideBreadcrumb)&&(0,s.jsx)(We,{}),(0,s.jsx)("section",{className:"pdp__overview-carousel",children:(0,s.jsxs)("div",{className:"pdp-section__container",children:[(0,s.jsx)(h,{}),(0,s.jsx)(Fe,{})]})}),(0,s.jsx)("section",{className:"pdp__product-details",children:(0,s.jsx)("div",{className:"pdp-section__container",children:(0,s.jsx)(dt,{})})}),!a&&(0,s.jsx)("section",{className:"pdp__related-products",children:(0,s.jsx)(Ce,{})}),(0,s.jsx)(vt,{injectType:ut.WHY}),!a&&(0,s.jsx)("section",{className:"pdp__also-bought",children:(0,s.jsx)(He,{})}),!a&&(0,s.jsx)("section",{className:"pdp__related-recipes",children:(0,s.jsx)(Qe,{})}),(0,s.jsx)(vt,{injectType:ut.APPENDIX}),(0,s.jsx)(vt,{injectType:ut.CTA_BANNER})]})});var g,j,y,w},Ct=St}}]); 2//# sourceMappingURL=productStencil.6fae8568.chunk.js.map
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.