1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8780],{78780:function(e,i,t){"use strict";t.r(i),t.d(i,{ProductCombineSection:function(){return ProductCombineSection}});var r=t(55732),a=t(27378),n=t(12279),o=t(43179),c=t(95024),d=t(40745),l=t(35689),s=t(43779);function getShelfProductOffer(e){var i,t,r,a,n,o=null===(i=e.items)||void 0===i?void 0:i[0];if(!o)return null;var c=null!==(t=null===(r=o.sellers)||void 0===r?void 0:r.find(e=>e.sellerDefault))&&void 0!==t?t:null===(a=o.sellers)||void 0===a?void 0:a[0];return null!==(n=null==c?void 0:c.commertialOffer)&&void 0!==n?n:null}function calculateMyLindtPoints(e,i){var t=null;if(null==i||i.forEach(e=>{var i;null===(i=e.specifications)||void 0===i||i.forEach(e=>{var i;if((null===(i=e.name)||void 0===i?void 0:i.toLowerCase())==="pontos"){var r,a,n=null===(r=e.values)||void 0===r?void 0:null===(a=r[0])||void 0===a?void 0:a.toString().trim();n&&(t=n)}})}),t&&"0"!==t&&""!==t){var r=Number(t);if(!isNaN(r)&&r>0)return Math.floor(r)}return e?Math.floor(e):0}function getMainProductPoints(e){var i,t,r;return calculateMyLindtPoints(null===(i=e.offers)||void 0===i?void 0:null===(t=i.offers)||void 0===t?void 0:null===(r=t[0])||void 0===r?void 0:r.price,e.extendedSpecificationGroups)}var u=t(76465),m=t.n(u),v=t(24246),CombineSummary=e=>{var{totalPrice:i,mainProduct:t,mainQuantity:r,selectedSuggestions:a,selection:n,disabled:o,loading:c=!1,onAddToCart:d}=e,{formatPrice:l}=(0,s.U)(),u=getMainProductPoints(t)*r+a.reduce((e,i)=>{var t,r,a=null!==(t=null===(r=n[i.productId])||void 0===r?void 0:r.quantity)&&void 0!==t?t:1,o=getShelfProductOffer(i);return e+calculateMyLindtPoints(null==o?void 0:o.Price)*a},0);return(0,v.jsxs)("div",{className:m().summary,"data-fs-combine-summary":!0,children:[(0,v.jsx)("div",{className:m().summaryTitle,children:(0,v.jsx)("span",{className:m().summaryTitleText,children:"Resumo da combina\xe7\xe3o:"})}),(0,v.jsxs)("div",{className:m().summaryTotal,children:[(0,v.jsx)("span",{className:m().summaryTotalLabel,children:"Total"}),(0,v.jsx)("span",{className:m().summaryTotalPrice,children:l(i)})]}),u>0&&(0,v.jsx)("div",{className:m().summaryPoints,children:(0,v.jsxs)("span",{className:m().summaryPointsText,children:[u," Pontos MyLindt Totais"]})}),(0,v.jsx)("button",{type:"button",className:m().addButton,disabled:o||c,onClick:d,children:"Adicionar \xe0 sacola"})]})},p=t(54057),_=t(92818),MainProductCard=e=>{var i,t,r,{product:a,quantity:n}=e,{formatPrice:o}=(0,s.U)(),c=null===(i=a.offers)||void 0===i?void 0:null===(t=i.offers)||void 0===t?void 0:t[0],d=null===(r=a.image)||void 0===r?void 0:r[0],l=getMainProductPoints(a);if(!c)return null;var u=c.listPrice>c.price;return(0,v.jsxs)("div",{className:m().card,"data-fs-combine-main-card":!0,children:[(0,v.jsx)("span",{className:m().viewingBadge,children:"Voc\xea est\xe1 vendo"}),(0,v.jsx)("div",{className:m().cardImageWrapper,children:(null==d?void 0:d.url)&&(0,v.jsx)(_.Z,{src:d.url,alt:d.alternateName||a.name,className:m().cardImage,loading:"lazy",width:180,height:180})}),(0,v.jsxs)("div",{className:m().cardBottomContent,children:[(0,v.jsx)(p.Y,{points:l,price:c.price,specificationGroups:a.extendedSpecificationGroups,className:m().cardPoints,textClassName:m().cardPointsText,useDefaultStyles:!1}),(0,v.jsx)("h3",{className:m().cardTitle,children:a.name}),(0,v.jsxs)("div",{className:m().cardPrices,children:[u&&(0,v.jsx)("span",{className:m().cardListPrice,children:o(c.listPrice)}),(0,v.jsx)("span",{className:m().cardPrice,children:o(c.price)})]}),(0,v.jsxs)("span",{className:m().cardQuantityLabel,children:["Qtd: ",n]})]})]})},SelectAllBar=e=>{var{onSelectAll:i,onClear:t}=e;return(0,v.jsxs)("div",{className:m().selectAllBar,"data-fs-combine-select-all":!0,children:[(0,v.jsx)("button",{type:"button",className:m().selectAllButton,onClick:i,children:"Selecionar todos"}),(0,v.jsx)("span",{className:m().selectAllDivider,children:"|"}),(0,v.jsx)("button",{type:"button",className:m().selectAllButton,onClick:t,children:"Limpar sele\xe7\xe3o"})]})},b=t(40624),P=t(48318),h=t(55861),SuggestionCard=e=>{var i,t,r,a,n,o,c,d,l,u,{product:x,selected:f,quantity:C,onToggle:y,onQuantityChange:S}=e,{formatPrice:g}=(0,s.U)(),j=getShelfProductOffer(x),N=null==(o=Array.isArray(n=null===(i=x.items)||void 0===i?void 0:null===(t=i[0])||void 0===t?void 0:null===(r=t.images)||void 0===r?void 0:null===(a=r[0])||void 0===a?void 0:a.imageUrl)?n[0]:n)?void 0:o.replace("vteximg.com.br","vtexassets.com"),k=(null===(c=x.items)||void 0===c?void 0:null===(d=c[0])||void 0===d?void 0:null===(l=d.images)||void 0===l?void 0:null===(u=l[0])||void 0===u?void 0:u.imageText)||x.productName,O=calculateMyLindtPoints(null==j?void 0:j.Price);if(!j)return null;var T=j.ListPrice>j.Price;
1return(0,v.jsxs)("div",{className:(0,b.Z)(m().card,f&&m().cardSelected),onClick:y,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),y())},role:"button",tabIndex:0,"data-fs-combine-suggestion-card":!0,children:[(0,v.jsxs)("div",{className:m().cardHeader,children:[(0,v.jsx)("div",{className:m().cardCheckboxContainer,onClick:e=>e.stopPropagation(),children:(0,v.jsxs)("div",{className:m().cardCheckboxInputContainer,children:[(0,v.jsx)("div",{className:(0,b.Z)(m().cardCheckboxInner,f&&m().cardCheckboxInnerSelected)}),(0,v.jsx)("div",{className:m().cardCheckboxBoxWrapper,children:(0,v.jsx)("div",{className:m().cardCheckboxBox,children:f&&(0,v.jsx)("svg",{width:"9",height:"7",viewBox:"0 0 9 7",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,v.jsx)("path",{d:"M3 6.4L0 3.4L1.4 2L3 3.6L7.6 0L9 1.4L3 6.4Z",fill:"white"})})})}),(0,v.jsx)(P.Z,{checked:f,onChange:y})]})}),f&&(0,v.jsx)("span",{className:m().addedBadge,children:"Adicionado"})]}),(0,v.jsxs)("div",{className:m().cardImageWrapper,children:[N&&(0,v.jsx)(_.Z,{src:N,alt:k,className:m().cardImage,loading:"lazy",width:180,height:180}),(0,v.jsx)("div",{className:(0,b.Z)(m().cardQuantity,!f&&m().cardQuantityHidden),onClick:e=>e.stopPropagation(),"aria-hidden":!f,children:f&&(0,v.jsx)(h.Z,{initial:C,min:1,onChange:S},C)})]}),(0,v.jsxs)("div",{className:m().cardBottomContent,children:[(0,v.jsx)(p.Y,{points:O,price:j.Price,className:m().cardPoints,textClassName:m().cardPointsText,useDefaultStyles:!1}),(0,v.jsx)("h3",{className:m().cardTitle,children:x.productName}),(0,v.jsxs)("div",{className:m().cardPrices,children:[T&&(0,v.jsx)("span",{className:m().cardListPrice,children:g(j.ListPrice)}),(0,v.jsx)("span",{className:m().cardPrice,children:g(j.Price)})]})]})]})},x=t(9377).Iu,f=t(90849);function ownKeys(e,i){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);i&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),t.push.apply(t,r)}return t}function _objectSpread(e){for(var i=1;i<arguments.length;i++){var t=null!=arguments[i]?arguments[i]:{};i%2?ownKeys(Object(t),!0).forEach(function(i){(0,f.Z)(e,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(t,i))})}return e}var ProductCombineSection=e=>{var i,{title:t,subtitle:s}=e,{product:u}=(0,d.Z)(),{quantity:p}=(0,l.Q)(),{addToCart:_}=(0,c.t)(),{pushToast:b,openCart:P}=(0,n.l8)(),{0:h,1:f}=(0,a.useState)(!1),{data:C,isLoading:y}=(0,o.aM)(x,{productId:null==u?void 0:u.id},{doNotRun:!(null!=u&&u.id)}),S=(0,a.useMemo)(()=>{var e;return(null!==(e=null==C?void 0:C.getShelfProducts)&&void 0!==e?e:[]).filter(e=>{var i;return e.productId!==(null==u?void 0:u.id)&&(null==(i=getShelfProductOffer(e))?void 0:i.IsAvailable)===!0})},[null==C?void 0:C.getShelfProducts,null==u?void 0:u.id]),{selection:g,toggle:j,setQuantity:N,selectAll:k,clearAll:O,hasSelection:T}=function(e){var i=(0,a.useMemo)(()=>e.join(","),[e]),{0:t,1:r}=(0,a.useState)(()=>Object.fromEntries(e.map(e=>[e,{selected:!1,quantity:1}])));(0,a.useEffect)(()=>{r(Object.fromEntries(e.map(e=>[e,{selected:!1,quantity:1}])))},[i,e]);var n=Object.entries(t).filter(e=>{var[,i]=e;return i.selected}).map(e=>{var[i]=e;return i});return{selection:t,toggle:e=>r(i=>{var t;return _objectSpread(_objectSpread({},i),{},{[e]:_objectSpread(_objectSpread({},i[e]),{},{selected:!(null!==(t=i[e])&&void 0!==t&&t.selected)})})}),setQuantity:(e,i)=>r(t=>_objectSpread(_objectSpread({},t),{},{[e]:_objectSpread(_objectSpread({},t[e]),{},{quantity:Math.max(1,i)})})),selectAll:()=>r(e=>Object.fromEntries(Object.keys(e).map(i=>[i,_objectSpread(_objectSpread({},e[i]),{},{selected:!0})]))),clearAll:()=>r(e=>Object.fromEntries(Object.keys(e).map(i=>[i,_objectSpread(_objectSpread({},e[i]),{},{selected:!1})]))),selectedIds:n,hasSelection:n.length>0}}((0,a.useMemo)(()=>S.map(e=>e.productId),[S]));if(!u||y||0===S.length)return null;var I=u.offers.offers[0].price,w=S.filter(e=>{var i;return null===(i=g[e.productId])||void 0===i?void 0:i.selected}),L=I*p+w.reduce((e,i)=>{var t,r=g[i.productId].quantity,a=getShelfProductOffer(i);return e+(null!==(t=null==a?void 0:a.Price)&&void 0!==t?t:0)*r},0),B=(i=(0,r.Z)(function*(){if(T){var e,i,t,r=(t=null===(e=u.offers)||void 0===e?void 0:null===(i=e.offers)||void 0===i?void 0:i[0])?{quantity:p,price:t.price,priceWithTaxes:t.priceWithTaxes,listPriceWithTaxes:t.listPriceWithTaxes,listPrice:t.listPrice,seller:{identifier:t.seller.identifier},itemOffered:{sku:u.sku,name:u.name,unitMultiplier:u.unitMultiplier,gtin:u.gt
1in,image:u.image.map(e=>({url:e.url,alternateName:e.alternateName})),brand:{name:u.brand.name},isVariantOf:{productGroupID:u.isVariantOf.productGroupID,name:u.isVariantOf.name,skuVariants:u.isVariantOf.skuVariants},additionalProperty:u.additionalProperty,extendedSpecificationGroups:u.extendedSpecificationGroups}}:null;if(r)try{for(var a of(f(!0),yield _(r),w)){var n=function(e,i){var t,r,a,n,o,c,d,l,s,u,m=null===(t=e.items)||void 0===t?void 0:t[0],v=null!==(r=null==m?void 0:null===(a=m.sellers)||void 0===a?void 0:a.find(e=>e.sellerDefault))&&void 0!==r?r:null==m?void 0:null===(n=m.sellers)||void 0===n?void 0:n[0],p=null==v?void 0:v.commertialOffer;if(!m||!v||!(null!=p&&p.IsAvailable))return null;var _=null===(o=m.images)||void 0===o?void 0:null===(c=o[0])||void 0===c?void 0:c.imageUrl,b=Array.isArray(_)?_[0]:_;return{quantity:i,price:p.Price,priceWithTaxes:p.Price,listPrice:p.ListPrice,listPriceWithTaxes:p.ListPrice,seller:{identifier:v.sellerId},itemOffered:{sku:m.itemId,name:m.name,unitMultiplier:1,gtin:"",image:[{url:null!==(d=null==b?void 0:b.replace("vteximg.com.br","vtexassets.com"))&&void 0!==d?d:"",alternateName:null!==(l=null===(s=m.images)||void 0===s?void 0:null===(u=s[0])||void 0===u?void 0:u.imageText)&&void 0!==l?l:""}],brand:{name:e.brand},isVariantOf:{productGroupID:e.productId,name:e.productName,skuVariants:{activeVariations:{},availableVariations:{},slugsMap:{}}},additionalProperty:[]}}}(a,g[a.productId].quantity);n&&(yield _(n))}b({message:"Produtos adicionados \xe0 sacola!",status:"INFO"}),P()}catch(e){b({message:"Erro ao adicionar produtos \xe0 sacola",status:"ERROR"})}finally{f(!1)}}}),function(){return i.apply(this,arguments)});return(0,v.jsxs)("section",{className:m().combineSection,"data-fs-product-combine":!0,children:[(0,v.jsxs)("header",{className:m().header,children:[(0,v.jsx)("h2",{className:m().title,children:null!=t?t:"Combine com sua escolha"}),(0,v.jsx)("p",{className:m().subtitle,children:null!=s?s:"Adicione alguns itens para completar a sua experi\xeancia."}),(0,v.jsx)(SelectAllBar,{onSelectAll:k,onClear:O})]}),(0,v.jsxs)("div",{className:m().grid,children:[(0,v.jsx)(MainProductCard,{product:u,quantity:p}
1),(0,v.jsx)("span",{className:m().plusDivider,"aria-hidden":"true",children:(0,v.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,v.jsx)("path",{d:"M0.75 6.75H12.75M6.75009 0.75L6.75009 12.75",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})})}),S.map(e=>{var i,t,r,a;return(0,v.jsx)(SuggestionCard,{product:e,selected:null!==(i=null===(t=g[e.productId])||void 0===t?void 0:t.selected)&&void 0!==i&&i,quantity:null!==(r=null===(a=g[e.productId])||void 0===a?void 0:a.quantity)&&void 0!==r?r:1,onToggle:()=>j(e.productId),onQuantityChange:i=>N(e.productId,i)},e.productId)}),(0,v.jsx)(CombineSummary,{totalPrice:L,mainProduct:u,mainQuantity:p,selectedSuggestions:w,selection:g,disabled:!T,loading:h,onAddToCart:B})]})]})}},76465:function(e){e.exports={combineSection:"ProductCombineSection_combineSection__dY2Kf",header:"ProductCombineSection_header__WI7v4",title:"ProductCombineSection_title__ch1jV",subtitle:"ProductCombineSection_subtitle__E6ppL",selectAllBar:"ProductCombineSection_selectAllBar__7pwDS",selectAllButton:"ProductCombineSection_selectAllButton__hkNLk",selectAllDivider:"ProductCombineSection_selectAllDivider__5ObLP",grid:"ProductCombineSection_grid__dJZfo",card:"ProductCombineSection_card__w21X_",cardSelected:"ProductCombineSection_cardSelected__ukDWv",cardCheckboxContainer:"ProductCombineSection_cardCheckboxContainer__r8BrG",cardCheckboxInputContainer:"ProductCombineSection_cardCheckboxInputContainer__tFW_w",cardCheckboxInner:"ProductCombineSection_cardCheckboxInner__D9bYz",cardCheckboxInnerSelected:"ProductCombineSection_cardCheckboxInnerSelected__6UNfx",cardCheckboxBoxWrapper:"ProductCombineSection_cardCheckboxBoxWrapper__Aszi2",cardCheckboxBox:"ProductCombineSection_cardCheckboxBox__9a50X",cardHeader:"ProductCombineSection_cardHeader__i_RZD",viewingBadge:"ProductCombineSection_viewingBadge__uNuqc",addedBadge:"ProductCombineSection_addedBadge__H07cV",cardBottomContent:"ProductCombineSection_cardBottomContent__rnbVe",cardImageWrapper:"ProductCombineSection_cardImageWrapper__cL0mN",cardImage:"ProductCombineSection_cardImage__MCKBy",cardPoints:"ProductCombineSection_cardPoints__PyOBC",cardPointsText:"ProductCombineSection_cardPointsText__LiMD6",cardTitle:"ProductCombineSection_cardTitle__mugYV",cardPrices:"ProductCombineSection_cardPrices__E2jHe",cardListPrice:"ProductCombineSection_cardListPrice__cOCsi",cardPrice:"ProductCombineSection_cardPrice__TPjX2",cardQuantityLabel:"ProductCombineSection_cardQuantityLabel__nX30M",cardQuantity:"ProductCombineSection_cardQuantity__B3YcU",cardQuantityHidden:"ProductCombineSection_cardQuantityHidden__L38On",plusDivider:"ProductCombineSection_plusDivider__R3zyJ",summary:"ProductCombineSection_summary__3ldq4",summaryTitle:"ProductCombineSection_summaryTitle__M6AA3",summaryTitleText:"ProductCombineSection_summaryTitleText__5H9Ov",summaryTotal:"ProductCombineSection_summaryTotal__2EleX",summaryTotalLabel:"ProductCombineSection_summaryTotalLabel__vcyt_",summaryTotalPrice:"ProductCombineSection_summaryTotalPrice__bhsPR",summaryPoints:"ProductCombineSection_summaryPoints__RfuKn",summaryPointsText:"ProductCombineSection_summaryPointsText__cqt8S",addButton:"ProductCombineSection_addButton__AgDWK"}}}]);
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.