"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[576],{79894:function(t,n,e){e.d(n,{L:function(){return u}});var u="unselected"},90576:function(t,n,e){e.d(n,{WZ:function(){return s},fH:function(){return a}});var u,i=e(8529),r=e(79894),o=function(t){var n=t.selectedOptions,e=t.productOptionsMap;return Object.values(n).reduce(function(t,n){if(!e)return t;if(!t.currentMap){var u=e[n];return t.currentMap=u,null!=u&&u.options&&(t.productOptions=u),t}var i=t.currentMap[n];return t.currentMap&&null!=i&&i.options?t.productOptions=i:t.currentMap=i,t},{productOptions:null,currentMap:null}).productOptions},l=((u=l||{}).THUMBNAIL="THUMBNAIL",u.ORIGINAL="ORIGINAL",u.MAGNIFY="MAGNIFY",u),a=function(t){var n,e=null===(n=t.personalisationData)||void 0===n?void 0:n.personalisationSupportImages;if(e){var u=[];return e.forEach(function(n){var e;null===(e=n.supportImages)||void 0===e||null===(e=e.imagesWithAssetSets)||void 0===e||e.forEach(function(n){var e,i,r,o=n.assetSet,a=n.images,s={url:a.find(function(t){return t.size===l.THUMBNAIL}).url,alt:(null==t?void 0:t.title)||""},p={url:a.find(function(t){return t.size===l.ORIGINAL}).url,alt:(null==t?void 0:t.title)||""},d={url:a.find(function(t){return t.size===l.MAGNIFY}).url,alt:(null==t?void 0:t.title)||""},c=u.find(function(t){return t.key===o}),f=c?u.indexOf(c):0;c||(u.push({key:o,images:[],thumbnails:[],zoom:[]}),f=u.length-1),null===(e=u[f])||void 0===e||e.images.push(p),null===(i=u[f])||void 0===i||i.thumbnails.push(s),null===(r=u[f])||void 0===r||r.zoom.push(d)})}),u}},s=function(t){var n,e=t.productOptionsMap,u=t.selectedOptions,l=t.setSelectedOptionsCallback,a=t.setOptionsCallback,s=t.setSelectedVariantCallback,p=t.selectedVariant,d=t.optionKey,c=t.value;u[d]=c,l(u);var f=o({selectedOptions:u,productOptionsMap:e});if(f)return a(f.options),s(f.variant),{updatedSelectedOptions:u,updatedProductOptions:f};if(null!=p&&null!==(n=p.product)&&void 0!==n&&n.linkedOn){var v=Object.entries(u).reduce(function(t,n){var e,u=(0,i.Z)(n,2),o=u[0],l=u[1];return o===(null===(e=p.product)||void 0===e?void 0:e.linkedOn)?t[o]=l:t[o]=r.L,t},{}),O=o({productOptionsMap:e,selectedOptions:v});if(O)return a(O.options),s(O.variant),{updatedSelectedOptions:v,updatedProductOptions:O}}return{updatedSelectedOptions:null,updatedProductOptions:null}}}}]);