1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2034],{19001:(e,t,i)=>{i.d(t,{TranscendOverride:()=>l});var r=i(95155),o=i(65596);let l=()=>(0,r.jsx)(o.default,{"data-disable-when-consented":"off","data-unknown-cookie-policy":"block","data-unknown-request-policy":"block",id:"TranscendOverride",strategy:"afterInteractive",children:` 2 function runTranscendOverride() { 3 if (window.__TRANSCEND_OVERRIDE_INITIALIZED__) { 4 return; 5 } 6 window.__TRANSCEND_OVERRIDE_INITIALIZED__ = true; 7 8 const ADVERTISING_TRACKING_PURPOSES = ['Advertising', 'SaleOfInfo']; 9 const override = (event) => { 10 if (ADVERTISING_TRACKING_PURPOSES.some((purpose) => event.purposes.has(purpose))) { 11 event.deny(); 12 } 13 }; 14 15 if (self.airgap && self.airgapLoadEvent) { 16 self.airgap.override(self.airgapLoadEvent, {override}); 17 self.airgap.overrideCookies(self.airgapLoadEvent, override); 18 self.airgap.clearCookies(cookie => { 19 return ADVERTISING_TRACKING_PURPOSES.some(purpose => 20 cookie.purposes.has(purpose) 21 ); 22 }); 23 } 24 } 25 26 // Run immediately if Airgap is already loaded, otherwise wait for the event 27 if (self.airgap && self.airgapLoadEvent) { 28 runTranscendOverride(); 29 } else { 30 window.addEventListener('airgapLoadEventReady', runTranscendOverride, { once: true }); 31 } 32 `})},36493:(e,t,i)=>{i.d(t,{A:()=>h});var r=i(12115),o=i(29722),l=i(97335),n=i(83230),a=i(86670),d=i(16377),s=i(24885),u=i(34449);function c(e){return(0,u.Ay)("MuiTableBody",e)}(0,s.A)("MuiTableBody",["root"]);var p=i(95155);let f=(0,a.default)("tbody",{name:"MuiTableBody",slot:"Root"})({display:"table-row-group"}),m={variant:"body"},x="tbody",h=r.forwardRef(function(e,t){let i=(0,d.b)({props:e,name:"MuiTableBody"}),{className:r,component:a=x,...s}=i,u={...i,component:a},h=(e=>{let{classes:t}=e;return(0,l.A)({root:["root"]},c,t)})(u);return(0,p.jsx)(n.A.Provider,{value:m,children:(0,p.jsx)(f,{className:(0,o.A)(h.root,r),as:a,ref:t,role:a===x?null:"rowgroup",ownerState:u,...s})})})},53296:(e,t,i)=>{i.d(t,{A:()=>v});var r=i(12115),o=i(29722),l=i(97335),n=i(75092),a=i(57042),d=i(83230),s=i(86670),u=i(53083),c=i(16377),p=i(24885),f=i(34449);function m(e){return(0,f.Ay)("MuiTableCell",e)}let x=(0,p.A)("MuiTableCell",["root","head","body","footer","sizeSmall","sizeMedium","paddingCheckbox","paddingNone","alignLeft","alignCenter","alignRight","alignJustify","stickyHeader"]);var h=i(95155);let g=(0,s.default)("td",{name:"MuiTableCell",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:i}=e;return[t.root,t[i.variant],t[`size${(0,n.A)(i.size)}`],"normal"!==i.padding&&t[`padding${(0,n.A)(i.padding)}`],"inherit"!==i.align&&t[`align${(0,n.A)(i.align)}`],i.stickyHeader&&t.stickyHeader]}})((0,u.A)(({theme:e})=>({...e.typography.body2,display:"table-cell",verticalAlign:"inherit",borderBottom:e.vars?`1px solid ${e.vars.palette.TableCell.border}`:`1px solid 33 ${"light"===e.palette.mode?e.lighten(e.alpha(e.palette.divider,1),.88):e.darken(e.alpha(e.palette.divider,1),.68)}`,textAlign:"left",padding:16,variants:[{props:{variant:"head"},style:{color:(e.vars||e).palette.text.primary,lineHeight:e.typography.pxToRem(24),fontWeight:e.typography.fontWeightMedium}},{props:{variant:"body"},style:{color:(e.vars||e).palette.text.primary}},{props:{variant:"footer"},style:{color:(e.vars||e).palette.text.secondary,lineHeight:e.typography.pxToRem(21),fontSize:e.typography.pxToRem(12)}},{props:{size:"small"},style:{padding:"6px 16px",[`&.${x.paddingCheckbox}`]:{width:24,padding:"0 12px 0 16px","& > *":{padding:0}}}},{props:{padding:"checkbox"},style:{width:48,padding:"0 0 0 4px"}},{props:{padding:"none"},style:{padding:0}},{props:{align:"left"},style:{textAlign:"left"}},{props:{align:"center"},style:{textAlign:"center"}},{props:{align:"right"},style:{textAlign:"right",flexDirection:"row-reverse"}},{props:{align:"justify"},style:{textAlign:"justify"}},{props:({ownerState:e})=>e.stickyHeader,style:{position:"sticky",top:0,zIndex:2,backgroundColor:(e.vars||e).palette.background.default}}]}))),v=r.forwardRef(function(e,t){let i,s=(0,c.b)({props:e,name:"MuiTableCell"}),{align:u="inherit",className:p,component:f,padding:x,scope:v,size:y,sortDirection:b,variant:w,...j}=s,A=r.useContext(a.A),T=r.useContext(d.A),_=T&&"head"===T.variant,D=v;"td"===(i=f||(_?"th":"td"))?D=void 0:!D&&_&&(D="col");let S=w||T&&T.variant,k={...s,align:u,component:i,padding:x||(A&&A.padding?A.padding:"normal"),size:y||(A&&A.size?A.size:"medium"),sortDirection:b,stickyHeader:"head"===S&&A&&A.stickyHeader,variant:S},$=(e=>{let{classes:t,variant:i,align:r,padding:o,size:a,stickyHeader:d}=e,s={root:["root",i,d&&"stickyHeader","inherit"!==r&&`align${(0,n.A)(r)}`,"normal"!==o&&`padding${(0,n.A)(o)}`,`size${(0,n.A)(a)}`]};return(0,l.A)(s,m,t)})(k),z=null;return b&&(z="asc"===b?"ascending":"descending"),(0,h.jsx)(g,{as:i,ref:t,className:(0,o.A)($.root,p),"aria-sort":z,scope:D,ownerState:k,...j})})},57042:(e,t,i)=>{i.d(t,{A:()=>r});let r=i(12115).createContext()},70722:(e,t,i)=>{i.d(t,{A:()=>h});var r=i(12115),o=i(29722),l=i(97335),n=i(83230),a=i(86670),d=i(53083),s=i(16377),u=i(24885),c=i(34449);function p(e){return(0,c.Ay)("MuiTableRow",e)}let f=(0,u.A)("MuiTableRow",["root","selected","hover","head","footer"]);var m=i(95155);let x=(0,a.default)("tr",{name:"MuiTableRow",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:i}=e;return[t.root,i.head&&t.head,i.footer&&t.footer]}})((0,d.A)(({theme:e})=>({color:"inherit",display:"table-row",verticalAlign:"middle",outline:0,[`&.${f.hover}:hover`]:{backgroundColor:(e.vars||e).palette.action.hover},[`&.${f.selected}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,(e.vars||e).palette.action.selectedOpacity),"&:hover":{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.hoverOpacity}`)}}}))),h=r.forwardRef(function(e,t){let i=(0,s.b)({props:e,name:"MuiTableRow"}),{className:a,component:d="tr",hover:u=!1,selected:c=!1,...f}=i,h=r.useContext(n.A),g={...i,component:d,hover:u,selected:c,head:h&&"head"===h.variant,footer
33:h&&"footer"===h.variant},v=(e=>{let{classes:t,selected:i,hover:r,head:o,footer:n}=e;return(0,l.A)({root:["root",i&&"selected",r&&"hover",o&&"head",n&&"footer"]},p,t)})(g);return(0,m.jsx)(x,{as:d,ref:t,className:(0,o.A)(v.root,a),role:"tr"===d?null:"row",ownerState:g,...f})})},83230:(e,t,i)=>{i.d(t,{A:()=>r});let r=i(12115).createContext()},92034:(e,t,i)=>{i.d(t,{CouponSetUI:()=>ti});var r=i(95155),o=i(74662),l=i(12115),n=i(12158),a=i(24880),d=i(71706),s=i(19001),u=i(27966),c=i(86670),p=i(10874),f=i(60248),m=i(3187),x=i(34397);let h=e=>!!(e&&Object.keys(e).length>0),g=(0,c.default)(p.Button,{shouldForwardProp:()=>!0})({width:"100%",display:"flex",minHeight:"40px",justifyContent:"center",alignItems:"center"}),v=(0,c.default)(u.default)({display:"flex",width:"100%",flexDirection:"column",gap:a.m72,minHeight:"40px"}),y={display:"flex",objectFit:"cover",width:"100%",aspectRatio:"1 / 1"},b=(0,c.default)(f.Grid,{shouldForwardProp:()=>!0})(()=>({margin:"0 !important",borderTop:`1px solid ${a.z9P}`,borderLeft:`1px solid ${a.z9P}`,borderRight:`1px solid ${a.z9P}`,borderBottom:`1px solid ${a.z9P}`,"& > div":{borderRight:`1px solid ${a.z9P}`,borderBottom:`1px solid ${a.z9P}`},gridTemplateRows:"1fr auto"})),w=(0,c.default)(m.Link,{shouldForwardProp:()=>!0})({"&:focus-visible":{borderRadius:"1px",outline:"2px solid -webkit-focus-ring-color",outlineOffset:"2px"},height:"100%",width:"100%",position:"absolute",top:0,left:0,zIndex:1}),j=(0,c.default)(u.default)({position:"absolute",top:"-85px",left:0}),A=(0,c.default)(u.default)(()=>({display:"flex",flexDirection:"column",position:"relative"})),T=(0,c.default)(u.default)({display:"flex",flexDirection:"column",height:"100%",gap:a.m72}),_=(0,c.default)(u.default)({display:"flex",flexDirection:"column",padding:`0 ${a.Mzk}`,flex:"1 0 0",textAlign:"left"}),D=(0,c.default)(u.default)({display:"flex",flexDirection:"column",marginTop:"auto",gap:a.m72}),S=(0,c.default)(u.default)({display:"flex",flexDirection:"column",flex:"1 0 0",textAlign:"left",gap:a.m72}),k=(0,c.default)(u.default)({display:"flex",alignItems:"center",gap:a.m72,height:a.i_v}),$=(0,c.default)(u.default)({display:"flex",padding:`${a.Mzk} ${a.Mzk} ${a.m72} ${a.Mzk} `,flexDirection:"column",alignItems:"flex-start",gap:a.m72,width:"100%"}),z=(0,c.default)(f.Grid,{shouldForwardProp:()=>!0})({background:a.DJJ,paddingBottom:a.Mzk,position:"relative"}),C=(0,c.default)(n.Text)(({theme:e})=>({fontSize:a.MkR,fontWeight:a.awq,lineHeight:a.MlV,[e.breakpoints.down("md")]:{fontSize:a.tGh}})),I=(0,c.default)(u.default)({display:"flex",flexDirection:"column"}),P=(0,c.default)(n.Text)({color:a.BO,fontSize:a.Yvi,lineHeight:a.MlV,whiteSpace:"normal"});(0,c.default)(u.default)({display:"flex",alignItems:"flex-end"}),(0,c.default)(u.default)({display:"flex",width:"100%",height:a.rSY}),(0,c.default)(n.Text)({display:"flex",flexDirection:"row",color:a.c5c,fontWeight:a.Pqj,fontSize:a.x9N,lineHeight:.889});let R=(0,c.default)(n.Text)({fontSize:a.Yvi,lineHeight:a.MlV,fontWeight:a.awq}),M=(0,c.default)(u.default,{shouldForwardProp:e=>"backgroundStyle"!==e})(({backgroundStyle:e,theme:t})=>({background:e,display:"flex",alignItems:"center",height:"50px",padding:`${a.D3H} ${a.Mzk} ${a.m72} ${a.Mzk}`,[t.breakpoints.down("md")]:{height:"42px"}})),F=(0,c.default)(u.default)({position:"relative"}),H=(0,c.default)(n.Text)({fontSize:a.Yvi,lineHeight:a.MlV,visibility:"hidden",pointerEvents:"none"}),N=(0,c.default)(n.Text)({position:"absolute",bottom:0,left:0,right:0,color:a.BO,fontSize:a.Yvi,lineHeight:a.MlV}),L=(0,c.default)(u.default)(()=>({display:"flex",flexDirection:"column",alignItems:"center",gap:a.iAn,alignSelf:"stretch"}));var O=i(92475),E=i(64835),K=i(78951),B=i(54309),W=i(36118),q=i(83461),U=i(84102),V=i(90830),G=i(12004),J=i(64290),Y=i(25719),X=i(80836);(0,c.default)(X.BW,{shouldForwardProp:()=>!0})(({theme:e})=>({fontSize:a.Yvi,lineHeight:a.MlV,fontWeight:a.Pqj,[e.breakpoints.down("md")]:{fontSize:a.Yvi,lineHeight:a.MlV}}));let Z={fontWeight:a.Pqj,fontSize:{sm:a.tGh,md:a.MkR},lineHeight:a.xUz};(0,c.default)(n.Text)({color:a.c5c,fontWeight:a.Pqj,fontSize:a.x9N,lineHeight:.889}),(0,c.default)(n.Text)({color:a.c5c,fontWeight:a.Pqj,fontSize:a.x9N,lineHeight:.889});let Q=(0,c.default)(u.default)({display:"flex",flexDirection:"column"});(0,c.default)(X.Al,{shouldForwardProp:()=>!0})({fontSize:a.Yvi,fontWeight:a.Pqj,lineHeight:a.MlV});let ee=(0,c.default)(W.Image,{shouldForwardProp:()=>!0})({display:"flex",objectFit:"contain",width:"24px",height:"24px",aspectRatio:"1 / 1"}),et=(0,c.default)(p.Button,{shouldForwardProp:()=>!0})({fontSize:a.Yvi,width:"fit-content",minHeight:"auto",position:"relative",textDecoration:"underline",zIndex:2});(0,c.default)(X.hE,{shouldForwardProp:()=>!0})(({theme:e})=>({display:"flex",fontSize:a.Yvi,lineHeight:a.MlV,fontWeight:a.Pqj,al
33ignSelf:"flex-end",[e.breakpoints.down("md")]:{fontSize:a.Yvi,lineHeight:a.MlV}})),(0,c.default)(X.rI)({padding:"0 2px",alignItems:"flex-end"}),(0,c.default)(u.default)({display:"flex",flexDirection:"column",gap:"1px",padding:`${a.m72} 0`}),a.x9N,a.MkR,(0,c.default)(n.Text)({display:"flex",flexDirection:"row",color:a.c5c,fontWeight:a.Pqj,fontSize:a.x9N,lineHeight:.889,whiteSpace:"pre-wrap"}),(0,c.default)(X.Eo,{shouldForwardProp:()=>!0})({fontSize:".625rem",fontWeight:a.Pqj,lineHeight:a.MlV}),(0,c.default)(X.HU,{shouldForwardProp:()=>!0})(({theme:e})=>({fontSize:a.MkR,fontWeight:a.Pqj,lineHeight:a.xUz,[e.breakpoints.down("md")]:{fontSize:a.MkR,lineHeight:a.xUz}})),(0,c.default)(X.BY,{shouldForwardProp:()=>!0})(({theme:e})=>({fontSize:a.MkR,fontWeight:a.Pqj,lineHeight:a.xUz,alignSelf:"center",[e.breakpoints.down("md")]:{fontSize:a.MkR,lineHeight:a.xUz}})),(0,c.default)(X.Cz,{shouldForwardProp:()=>!0})({fontSize:a.MkR,fontWeight:a.Pqj,lineHeight:a.MlV}),(0,c.default)(X.AK,{shouldForwardProp:()=>!0})({alignItems:"baseline",padding:0}),(0,c.default)(X.hl,{shouldForwardProp:()=>!0})({display:"inline-flex",alignItems:"baseline",padding:0}),(0,c.default)(n.Text)(({theme:e})=>({color:a.c5c,fontWeight:a.Pqj,fontSize:"2.5rem",lineHeight:.8,[e.breakpoints.down("md")]:{fontSize:a.mNA,lineHeight:.786}}));let ei=(0,c.default)(u.default)(({theme:e})=>({display:"flex",flexDirection:"row",[e.breakpoints.down("md")]:{flexDirection:"column"},gap:a.pMV})),er=(0,c.default)(u.default)({display:"flex",flexDirection:"column",gap:a.m72}),eo=(0,c.default)(W.Image)(({theme:e})=>({display:"flex",objectFit:"contain",width:"190px",aspectRatio:"1 / 1",[e.breakpoints.down("md")]:{width:"100%"}})),el=(0,c.default)(n.Text)({fontSize:a.Yvi,lineHeight:a.MlV}),en={backgroundColor:a.JBU,"&:hover":{backgroundColor:a.c5c},"&:focus":{backgroundColor:a.c5c}},ea=(0,c.default)(u.default)({display:"flex",width:"100%",flexDirection:"column",padding:`${a.m72} 0`,gap:a.iAn}),ed=({text:e})=>{if(!e)return null;let t=e.replace(/\s+/g," ").trim().split(" "),i=t[0],o=t[1],l=t.slice(2).join(" ");return(0,r.jsx)(k,{children:(0,r.jsxs)(n.Text,{sx:{display:"flex",flexDirection:"row"},children:[(0,r.jsx)(n.Text,{sx:{...Z,color:a.JHH},children:i}),"\xa0",(0,r.jsx)(n.Text,{sx:{...Z},children:o})," ","\xa0",(0,r.jsx)(n.Text,{sx:{...Z,color:a.iCb},children:l})]})})},es=({msText:e,applicability:t})=>{let i=e.warehouseOnly?(0,r.jsx)(n.Text,{sx:{...Z,color:a.JHH},children:e.warehouseOnly}):null;return({warehouse_only:i,same_day:i,online_only:e.onlineOnly?(0,r.jsx)(n.Text,{sx:{...Z,color:a.iCb},children:e.onlineOnly}):null,warehouse_online:(0,r.jsx)(ed,{text:e.warehouseAndOnline})})[t]};var eu=i(89953);let ec=({lgSize:e,preserveDimensions:t=!1,children:i})=>{let o=(0,r.jsxs)(T,{children:[(0,r.jsxs)($,{children:[(0,r.jsx)(eu.A,{variant:"rounded",sx:{...y,transform:"none",height:"100%"}}),(0,r.jsxs)(u.default,{sx:{display:"flex",gap:1,width:"100%"},children:[(0,r.jsx)(eu.A,{variant:"rounded",width:90,height:24}),(0,r.jsx)(eu.A,{variant:"rounded",width:90,height:24})]})]}),(0,r.jsxs)(_,{children:[(0,r.jsxs)(S,{children:[(0,r.jsx)(eu.A,{variant:"text",width:"35%"}),(0,r.jsx)(eu.A,{variant:"text",width:"90%"}),(0,r.jsx)(eu.A,{variant:"text",width:"75%"})]}),(0,r.jsxs)(D,{children:[(0,r.jsx)(eu.A,{variant:"text",width:"50%"}),(0,r.jsx)(eu.A,{variant:"rounded",height:56}),(0,r.jsxs)(v,{children:[(0,r.jsx)(eu.A,{variant:"text",width:"45%"}),(0,r.jsx)(eu.A,{variant:"rounded",height:24})]})]})]})]});return t?(0,r.jsx)(z,{size:{sm:6,md:3,lg:e},children:(0,r.jsxs)(u.default,{sx:{position:"relative",height:"100%"},children:[(0,r.jsx)(u.default,{sx:{visibility:"hidden",pointerEvents:"none",height:"100%"},children:i}),(0,r.jsx)(u.default,{"data-testid":"coupon-card-skeleton","aria-hidden":!0,sx:{position:"absolute",inset:0},children:o})]})}):(0,r.jsx)(z,{size:{sm:6,md:3,lg:e},children:(0,r.jsx)(u.default,{"data-testid":"coupon-card-skeleton","aria-hidden":!0,children:o})})};var ep=i(49090),ef=i(43525);let em=({enablePreview:e=!1,pricesOffFullyAuthored:t,locale:i})=>t?(0,r.jsx)(Q,{children:t.map((o,l)=>{var n,a,d,s;
33return 0===l?(0,r.jsx)(ef.L,{enablePreview:e,sx:t.length>1?{paddingBottom:0}:{},content:o,text_content_placement:null,locale:i},(null==(a=null==(n=o.prices_and_percentages)?void 0:n._metadata)?void 0:a.uid)??l):(0,r.jsx)(ef.L,{enablePreview:e,variant:"coupon-set-secondary",content:o,text_content_placement:null,locale:i},(null==(s=null==(d=o.prices_and_percentages)?void 0:d._metadata)?void 0:s.uid)??l)})}):(console.error("CouponSet PricesOffSection: Missing data for rendering PricesOffSection"),(0,r.jsx)(r.Fragment,{})),ex=({cardData:e,msText:t,pricesOffFullyAuthored:i,itemDescriptionId:o,locale:n})=>{var a;let[d,s]=(0,l.useState)(!1),{popupSection:u,cardDescription:c,couponType:p,searchTerm:f,itemNumber:m,validDatesOverride:x,imageUrl:h,productImageAltText:g,couponLink:v}=e;if(!u||!u.popup_link_text)return null;let y=null==v?void 0:v.url;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(et,{variant:"text-button",onClick:()=>s(!0),"aria-describedby":o,children:u.popup_link_text}),(0,r.jsx)(ep.Modal,{isOpen:d,modalTitle:t.modalheader,onClose:()=>s(!1),buttons:y?[{action:()=>{window.location.href=y},text:t.shopOnline}]:void 0,children:(0,r.jsxs)(ei,{children:[(0,r.jsxs)(er,{children:[(0,r.jsx)(U.T,{overrides:{span:{component:C}},markdown:c}),(0,r.jsxs)(P,{children:["search"===p?f&&`${t.search} ${f}`:m&&`${t.item} ${m}`,x&&(m||f)&&". ",x]}),i&&i.length>0&&(0,r.jsx)(em,{pricesOffFullyAuthored:i,locale:n}),null==(a=u.popup_text_content)?void 0:a.map((e,t)=>(0,r.jsx)(el,{children:(0,r.jsx)(U.T,{markdown:e.markdown_text})},e._metadata.uid||t))]}),(0,r.jsx)(eo,{loading:"lazy",alt:g,src:h})]})})]})};var eh=i(13641),eg=i(92533),ev=i(36493),ey=i(42138),eb=i(65138),ew=i(19216),ej=i(90162),eA=i(96013),eT=i(68409),e_=i(50716);let eD=({htmlString:e,linkSx:t})=>{let i=e?eT.sanitize(e):"";return(0,e_.Ay)(i,{replace:e=>{if(e instanceof e_.Hg&&"a"===e.name){var i;let{href:o}=e.attribs,l=(i=e.attribs.style)?i.split(";").filter(e=>e.split(":")[0]&&e.split(":")[1]).reduce((e,t)=>{let[i,r]=t.split(":").map(e=>e.trim()),o=i.replace(/-([a-z])/g,e=>e[1].toUpperCase());return{...e,[o]:r}},{}):{};return(0,r.jsx)(p.Button,{variant:"text-button",href:o,sx:[l,...Array.isArray(t)?t:[t]],children:(0,e_.zd)(e.children)})}}})},eS=["subtotal","discounts","costcodirectsavings","shippinghandling","shippinghandlingforlocation","costcogrocerysurcharge","taxoninsurancepremium","estimatedtax","twodaydeliveryfee","estimatedgst","estimatedhst","estimatedpst","estimatedqst","deliverysurcharge","publicimprovementfee","retaildeliveryfee","roadimprovementandfooddeliveryfee","giftofmembershipcardsapplied","shopcardsapplied","walletshopcard","nonmembersurcharge","promocode","inwarehouse","online","ecofee","ecofeemvm","instantsavings","price","taxable"],ek=(e,t)=>{var i;let r=null==e?void 0:e.composable_window;if(!r||!Array.isArray(r))return;let o=r.find(e=>{var i;return(null==(i=e.text_only)?void 0:i.development_field_key)===t});return null==(i=null==o?void 0:o.text_only)?void 0:i.body},e$=(e,t)=>t?`${e}-${t}`:e,ez={"en-ca":"CAD","en-us":"USD","fr-ca":"CAD"},eC=(e,t)=>{if(null==e)return"";let i=ez[t.toLowerCase()];return new Intl.NumberFormat(t,{style:"currency",currency:i,maximumFractionDigits:2,minimumFractionDigits:2}).format(e)},eI=({isAddPromoEnabled:e,onPromoCodeSubmit:t,text:i,promoError:o,promoDeleted:n,uniqueId:d})=>{let s=(0,l.useRef)(null),u=(0,l.useRef)(null);if((0,l.useEffect)(()=>{o&&setTimeout(()=>{var e;return null==(e=s.current)?void 0:e.focus()},0)},[o]),(0,l.useEffect)(()=>{n&&setTimeout(()=>{var e;return null==(e=u.current)?void 0:e.focus()},0)},[n]),!e)return null;if(void 0===t)return console.warn("MathTable: add promo is enabled but onPromoCodeSubmit is not defined"),null;if(void 0===i||void 0===i.addpromocode||void 0===i.addpromocodebuttontext||void 0===i.addpromocodeinputlabel||void 0===i.addpromocoderemovebuttontext||void 0===i.addpromocodetooltip||void 0===i.promocoderemoved||void 0===i.promocodeapplied||void 0===i.promocodeappliednotificationid)return console.warn("MathTable: add promo is enabled but texts are missing"),null;let c=e$(i.promocodeappliednotificationid,d),p=e$("ApplyPromo",d),m=e$("ApplyPromoLabel",d),x=e$("ApplyPromoErrorId",d),h=e$("tooltip-apply-promocode",d),g=async e=>{let r=document.getElementById(c);r&&(r.textContent="");let o=await t(e);return r&&o&&(r.textContent=i.promocodeapplied.replace("{promoCode}",e)),o};return(0,r.jsx)(f.Grid,{size:{xs:12},children:(0,r.jsxs)(f.Grid,{container:!0,hasMargin:!1,sx:{justifyContent:"space-between",marginX:0,paddingTop:a.D3H,flexDirection:"column",alignItems:"flex-start"},children:[(0,r.jsx)("div",{style:B.A,id:c,"aria-live":"polite"}),n&&(0,r.jsx)("div",{ref:u,tabIndex:-1,"data-testid":"promo-removed-notification",style:{marginBottom:a.D3H},children:(0,r.jsx)(ey.Notification,{message:i.promocoderemoved.replace("{promoCode}",n),severity:"success",icon:(0,r.jsx)(ej.A,{}),isRole:!1})}),(0,r.jsx)(eP,{onSubmit:g,text:i,inputRef:s,promoError:o,applyPromoId:p,applyPromoLabelId:m,applyPromoErrorId:x,tooltipId:h})]})})};function eP({onSubmit:e,text:t,inputRef:i,promoError:o,applyPromoId:n,applyPromoLabelId:d,applyPromoErrorId:s,tooltipId:c}){let[f,m]=(0,l.useState)(""),x=async()=>{await (null==e?void 0:e(f))&&m("")};return(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)(u.default,{sx:{display:"flex",alignItems:"flex-start",width:"100%"},children:[(0,r.jsx)(eb.A,{inputRef:i,label:t.addpromocodeinputlabel,value:f,onChange:e=>{(e=>{let t,i,r;for(i=0,r=e.length;i<r;i++)if(!((t=e.charCodeAt(i))>47&&t<58)&&!(t>64&&t<91)&&!(t>96&&t<123))return!1;return!0})(e.target.value)&&m(e.target.value.toUpperCase())},endAdornment:(0,r.jsx)(p.Button,{sx:{zIndex:1},onClick:x,children:t.addpromocodebuttontext}),id:n,inputLabelId:d,maxCharacterLimit:25,isError:!!o,errorText:o,errorTextId:o?s:void 0,sx:o?{marginBottom:a.m72}:{}}),(0,r.jsx)(ew.m,{tooltipId:c,buttonAriaLabel:t.addpromotooltipbuttonarialabel,buttonContent:(0,r.jsx)(eA.A,{style:{height:"18px",width:"18px",marginTop:"10px",marginLeft:"8px",color:a.hGW}}),position:"top",hasArrow:!0,buttonStyles:{marginLeft:a.iAn},content:t.addpromocodetooltip})]})})}var eR=i(70722),eM=i(53296),eF=i(13869),eH=i(19530);let eN=l.forwardRef(({value:e,locale:t,secondaryLabel:i},o)=>{let l=((e,t)=>{if(!eC(e,t))return{wholeNumber:"---",decimals:""};let i=new Intl.NumberFormat(t,{style:"decimal",minimumFractionDigits:2,maximumFractionDigits:2}).formatToParts(Math.abs(e)),r="",o="";for(let e of i)"integer"===e.type?r+=e.value:"fraction"===e.type&&(o+=e.value);return r||(r="0"),o||(o="00"),{wholeNumber:r,decimals:o}})(e,t),d=["en-us","en-ca"].includes(t||""),s=d?".":",";return(0,r.jsxs)(n.Text,{ref:o,component:"p",sx:{borderTop:`${a.Do4} solid ${a.V3k}`,paddingTop:a.iAn},children:[d?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.Text,{component:"span",sx:{fontSize:a.tGh,fontWeight:a.Pqj,lineHeight:".875rem",verticalAlign:"top"},children:"$"}),(0,r.jsx)(n.Text,{component:"span",sx:{fontSize:a.Hrl,fontWeight:a.Pqj,lineHeight:"1.25rem",verticalAlign:"top"},children:l.wholeNumber}),(0,r.jsx)(n.Text,{component:"span",sx:B.A,children:s}),(0,r.jsx)(n.Text,{component:"span",sx:{fontSize:a.tGh,fontWeight:a.Pqj,lineHeight:".875rem",verticalAlign:"top"},children:l.decimals})]}):(0,r.jsxs)(n.Text,{component:"span",sx:{fontSize:a.Hrl,fontWeight:a.Pqj,lineHeight:"1.25rem",verticalAlign:"top"},children:[l.wholeNumber,s,l.decimals,eH.p+"$"]}),i&&(0,r.jsx)(n.Text,{variant:"b2",children:i})]})});eN.displayName="MathTableFinalRowPrice";let eL=({locale:e,rowKey:t,label:i,value:o,variant:l="b2",color:d,characterPrefix:s="",removePadding:u=!1,paddingTop:c,longText:p,errorMessage:f,notificationMessage:m,verticalAlignTop:x,isTotalRow:h=!1,secondaryLabel:g,uniqueId:v})=>{let y=e$(`${t}-label-description`,v),b=null!=i&&"object"==typeof i,w=x??(h||!!p||b);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(eR.A,{children:[(0,r.jsxs)(eM.A,{component:"th",scope:"row",padding:"none",sx:{border:"none",paddingTop:u?0:c??a.iAn,...w&&{verticalAlign:"top"},...h&&{paddingTop:a.iAn}},children:["string"==typeof i&&(0,r.jsx)(n.Text,{variant:l,color:d,...p&&{"aria-describedby":y},...h&&{sx:{fontSize:a.x9N,fontWeight:a.Pqj,lineHeight:a.xUz,borderTop:`${a.Do4} solid ${a.V3k}`,paddingTop:a.iAn}},uniqueId:`${t}`,children:i}),b&&i]}),(0,r.jsx)(eM.A,{align:"right",padding:"none",sx:{border:"none",paddingTop:u?0:c??a.iAn,...w&&{verticalAlign:"top"},...h&&{paddingTop:a.iAn}},children:h?(0,r.jsx)(eN,{value:o,locale:e,secondaryLabel:g}):(0,r.jsx)(n.Text,{variant:l,color:d,uniqueId:`${t}-value`,sx:{fontVariantNumeric:"tabular-nums"},children:((e,t,i="")=>{let r=eC("-"===i?-e:e,t);return r?"+"===i&&e>=0?`+${r}`:r:"---"})(o,e,s)})})]},t),f?(0,r.jsx)(eR.A,{children:(0,r.jsx)(eM.A,{component:"td",colSpan:2,scope:"row",padding:"none",sx:{border:"none",padding:`${a.D3H} 0`},children:(0,r.jsx)(ey.Notification,{severity:"critical",message:f})})},`${t}-status-row`):null,m?(0,r.jsx)(eR.A,{children:(0,r.jsx)(eM.A,{component:"td",colSpan:2,padding:"none",sx:{border:"none",paddingTop:a.D3H,paddingBottom:0},children:(0,r.jsx)("div",{"data-testid":`${t}-notification`,children:(0,r.jsx)(ey.Notification,{severity:"general",icon:(0,r.jsx)(eF.A,{}),message:(0,r.jsx)(eD,{htmlString:m,linkSx:{display:"inline",p:0,minWidth:0,verticalAlign:"baseline",fontSize:"inherit",lineHeight:"inherit",textDecoration:"underline"}})})})})},`${t}-notification-row`):null,p?(0,r.jsx)(eR.A,{children:(0,r.jsx)(eM.A,{component:"td",colSpan:2,scope:"row",padding:"none",sx:{border:"none",paddingTop:a.m72},children:(0,r.jsx)(n.Text,{variant:l,id:y,uniqueId:`${t}-description`,children:p})})},`${t}-label-description-row`):null]})};var eO=i(66149),eE=i(87213);let eK=(0,c.default)(eO.A)` 34 padding-top: ${a.m72}; 35 padding-bottom: ${a.m72}; 36 padding-left: ${a.iAn}; 37 padding-right: ${a.iAn}; 38 border-color: ${a.JBU}; 39 border-radius: ${a.m72}; 40 text-align: left; 41 background-color: transparent !important; 42 &:focus-visible { 43 outline: 2px auto Highlight; 44 outline: 2px auto -webkit-focus-ring-color; 45 outline-offset: 4px; 46 } 47 & .MuiChip-deleteIcon { 48 width: 14px; 49 height: 14px; 50 margin-left: ${a.iAn}; 51 color: ${a.JBU} !important; 52 } 53 & .MuiChip-label { 54 padding: 0; 55 }
56`,eB=({locale:e,rowData:{rowKey:t,label:i,value:o,code:l,color:n,characterPrefix:d,canRemoveCode:s,showCodeInLabel:u,longText:c,errorMessage:p},text:f,onRemove:m,uniqueId:x})=>{let h;if(void 0===l)return console.warn("MathTable: code is undefined"),null;if(s&&void 0===m)return console.warn("MathTable: canRemoveCode is true but onRemove function is undefined"),null;let g="";if("string"==typeof i)g=i.replace("{promoCode}",l);else throw Error("Unsupported label");return(null==f?void 0:f.promocodeapplied)&&(h=null==f?void 0:f.promocodeapplied.replace("{promoCode}",l)),(0,r.jsx)(eL,{locale:e,rowKey:`${t}-${l}`,label:s?(0,r.jsx)(eW,{dataTestId:`remove-promo-button-${l}`,ariaLabel:`Remove ${g}`,label:g,promoCodeApplied:h,onClick:()=>null==m?void 0:m(l)}):u?l:g.replace(l,""),longText:c,value:o,color:n,characterPrefix:d,errorMessage:p,verticalAlignTop:!1,paddingTop:a.D3H,uniqueId:x})};function eW({label:e,onClick:t,ariaLabel:i,dataTestId:o,promoCodeApplied:l}){return(0,r.jsxs)(r.Fragment,{children:[l&&(0,r.jsx)(u.default,{component:"span",sx:B.A,children:l}),(0,r.jsx)(eK,{component:"button","data-testid":o,"aria-label":i,label:(0,r.jsx)(n.Text,{variant:"l1",sx:{color:a.JBU},children:e}),deleteIcon:(0,r.jsx)(eE.Ay,{}),onClick:()=>t(),onDelete:()=>t(),size:"small",variant:"outlined"})]})}let eq=({locale:e,rowData:{rowKey:t,label:i,value:o,tooltipText:l,characterPrefix:d="",tooltipButtonAriaLabel:s},text:u,uniqueId:c})=>{if(void 0===l)return console.warn("MathTable: tooltipText is undefined"),null;let p=e$(`${t}`,c),f=(0,r.jsx)(U.T,{markdown:l});return(0,r.jsx)(eL,{locale:e,rowKey:t,label:(0,r.jsxs)(n.Text,{variant:"b2",uniqueId:`${t}`,children:[i,(0,r.jsx)(ew.m,{tooltipId:p,uniqueId:p,buttonAriaLabel:s&&u[s]?u[s]:u.rowtooltipbuttonarialabel.replace("{label}","string"==typeof i?i:""),buttonContent:(0,r.jsx)(eA.A,{style:{height:"12px",width:"12px",color:a.hGW}}),buttonStyles:{minWidth:"24px",minHeight:"24px",zIndex:25,position:"relative"},hasArrow:!0,position:"top",content:f})]}),value:o,uniqueId:c,characterPrefix:d})},eU=({locale:e,rowData:t,onPromoCodeRemove:i,text:o,uniqueId:l})=>t.showTooltip?(0,r.jsx)(eq,{locale:e,rowData:t,text:o,uniqueId:l}):t.code?(0,r.jsx)(eB,{locale:e,rowData:t,onRemove:i,text:o,uniqueId:l}):(0,r.jsx)(eL,{locale:e,...t,uniqueId:l}),eV=({moduleSettings:e,locale:t,tableAriaLabel:i,rowsData:o,isAddPromoEnabled:l=!1,onPromoCodeRemove:n,onPromoCodeSubmit:a,promoError:d,promoDeleted:s,uniqueId:u})=>{if(0===o.length)return console.warn("MathTable: rowsData is empty"),null;let c=(0,eh.Je)(e);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(eg.A,{size:"small","aria-label":i,children:(0,r.jsx)(ev.A,{children:o.map((e,i)=>(0,r.jsx)(eU,{locale:t,rowData:0===i?{...e,removePadding:!0}:e,onPromoCodeRemove:n,text:c,uniqueId:u},"promocode"===e.rowKey?`${e.rowKey}_${e.code}`:e.rowKey))})}),(0,r.jsx)(eI,{isAddPromoEnabled:l,onPromoCodeSubmit:a,text:c,promoError:d,promoDeleted:s,uniqueId:u})]})},eG=({...e})=>{let{rowsData:t,moduleSettings:i}=e,o=((e,t,i,o="en-us")=>{var l,d,s,u,c,p;let f=null==i?void 0:i.properties,m=null==(l=null==f?void 0:f[0])?void 0:l.customization,x=(null==(d=null==m?void 0:m.pricePrefix)?void 0:d.subtract)||[],h=(null==(s=null==m?void 0:m.pricePrefix)?void 0:s.add)||[],g=(null==(u=null==m?void 0:m.labelColor)?void 0:u.green)||[],v=(null==(c=null==m?void 0:m.finalRow)?void 0:c.labels)||[],y=(null==(p=null==m?void 0:m.finalRow)?void 0:p.secondaryLabels)||[],b=e.find(e=>y.includes(e.rowKey)),w=ek(i,"tooltipmvm"),j={taxoninsurancepremium:t.taxoninsurancepremiumtooltiptext,estimatedtax:t.estimatedtaxtooltiptext,ecofeemvm:w,twodaydeliveryfee:t.twodaydeliveryfeetooltiptext,roadimprovementandfooddeliveryfee:t.roadimprovementandfooddeliveryfeetooltiptext,retaildeliveryfee:t.retaildeliveryfeetooltiptext,publicimprovementfee:t.publicimprovementfeetooltiptext},A={twodaydeliveryfee:"twodaydeliveryfeetooltipbuttontext",retaildeliveryfee:"retaildeliveryfeetooltiparialabel",roadimprovementandfooddeliveryfee:"roadimprovementandfooddeliveryfeetooltiparialabel",publicimprovementfee:"publicimprovementfeetooltipbuttontext"};return e.filter(e=>{let t=eS.includes(e.rowKey),i=y.includes(e.rowKey);if(!t||i)return!1;if("publicimprovementfee"===e.rowKey){let t=e.tooltipContent,i=void 0!==e.value,r=Number.isFinite(null==t?void 0:t.percent);return i&&r}return!0}).sort((e,t)=>
56eS.indexOf(e.rowKey)-eS.indexOf(t.rowKey)).map(e=>{let i=j[e.rowKey],l="",d=e.tooltipButtonAriaLabel??A[e.rowKey]??null;x.includes(e.rowKey)?l="-":h.includes(e.rowKey)&&(l="+");let s="promocode"===e.rowKey?g.includes(e.rowKey)&&!!e.canRemoveCode:g.includes(e.rowKey),u=v.includes(e.rowKey),c=u&&b?t[b.rowKey]:void 0,p=e.label??t[e.rowKey];if("costcogrocerysurcharge"===e.rowKey){let i=t[e.rowKey].replace("{colorCostcoBlue}",a.H4y).replace("{colorCostcoRed}",a.wcX);p=(0,r.jsx)(n.Text,{variant:"b2",children:(0,r.jsx)(eD,{htmlString:i})})}else if("twodaydeliveryfee"===e.rowKey){let l=t[e.rowKey].replace("{colorCostcoBlue}",a.H4y);if(i){let{threshold:t=0,deliveryFee:r=0}=e.tooltipContent||{},l=String(eC(t,o)),n=String(eC(r,o));i=i.replaceAll("{threshold}",l).replaceAll("{deliveryFee}",n)}p=(0,r.jsx)(n.Text,{variant:"b2",component:"span",children:(0,r.jsx)(eD,{htmlString:l})})}else if("publicimprovementfee"===e.rowKey){let{percent:t}=e.tooltipContent||{};if(i){let e,r,l=String((e=t,r=o,new Intl.NumberFormat(r,{maximumFractionDigits:2,minimumFractionDigits:0}).format(e)));i=i.replaceAll("{percent}",l)}}return{...e,label:p,variant:"subtotal"===e.rowKey?"b1":"b2",showTooltip:!!i,tooltipText:i,color:s?"success":void 0,characterPrefix:l,isTotalRow:u,secondaryLabel:c,tooltipButtonAriaLabel:d}})})(t,(0,eh.Je)(i),i,e.locale);return(0,r.jsx)(eV,{...e,rowsData:o})};var eJ=i(96270);let eY=({channelPrice:e,ecoFeePrice:t,locale:i,mathTableText:o,moduleSettings:l,uniqueId:d,sx:s})=>{let c=o.ecofeemvm,p=`${(0,eJ.$g)(i,e,2)} + ${(0,eJ.$g)(i,t,2)} ${c}`,f=ek(l,"tooltipmvm"),m=f?(0,r.jsx)(U.T,{markdown:f}):void 0;return(0,r.jsx)(u.default,{sx:{textAlign:"right",...s},children:(0,r.jsxs)(n.Text,{variant:"b2",sx:{fontSize:a.MkR,zIndex:25,position:"relative"},children:["(",p,m&&(0,r.jsx)(ew.m,{tooltipId:d,uniqueId:d,buttonAriaLabel:o.rowtooltipbuttonarialabel.replace("{label}",c),buttonContent:(0,r.jsx)(eA.A,{style:{height:"12px",width:"12px",margin:"4px",color:a.hGW}}),sx:{textAlign:"left"},hasArrow:!0,position:"top",content:m}),")"]})})};var eX=i(424);let eZ={in_warehouse:"inwarehouse",eco_fee:"ecofeemvm",instant_savings:"instantsavings",online:"online",taxable_food:"taxable"},eQ={priceType:"regular",ecoFeeRenderingStyle:"itemized"},e0=e=>"itemized"===e||"internalized"===e,e1=e=>"standard"===e||"itemized"===e||"internalized"===e,e2=(e,t)=>{let i=null==t?void 0:t.toLowerCase();return e.map(e=>{let t=e.location_amount_mapping.map(e=>e.location.map(e=>e.toLowerCase())),r=i?e.location_amount_mapping.filter((e,r)=>t[r].includes(i)):e.location_amount_mapping;return{...e,location_amount_mapping:r}}).filter(e=>e.location_amount_mapping.length>0)},e5=({priceTable:e,msText:t,locale:i,mathTableModuleSettings:o,uniqueId:l,computedPriceTableData:n})=>{if(!(({locale:e,priceTable:t})=>!!["en-ca","fr-ca"].includes(e)&&!!t&&!!t.price_line_items&&0!==t.price_line_items.length)({locale:i,priceTable:e}))return null;if(!o)return console.warn("PriceTable: MathTable module settings not provided. Table will not be displayed."),null;if(!n)return null;let{rowsData:a,channelKey:d,channelPrice:s,ecoFeePrice:u,ecoFeeRenderingStyle:c,hotBuyRenderingStyle:p}=n;if("internalized"===p&&0!==u){let e=(0,eh.Je)(o);return(0,r.jsx)(ea,{children:(0,r.jsx)(eY,{channelPrice:s,ecoFeePrice:u,locale:i,mathTableText:e,moduleSettings:o,uniqueId:l,sx:{textAlign:"left"}})})}let f=[...a];if("internalized"===c&&0!==u&&void 0===p){let e=(0,eh.Je)(o),t={rowKey:d,value:s+u,longText:(0,r.jsx)(eY,{channelPrice:s,ecoFeePrice:u,locale:i,mathTableText:e,moduleSettings:o,uniqueId:l})},n=f.findIndex(e=>e.rowKey===d);-1!==n?f[n]=t:f.unshift(t)}return 0===f.length?null:(0,r.jsx)(ea,{children:(0,r.jsx)(eG,{moduleSettings:o,locale:i,rowsData:f,tableAriaLabel:t.mathtablelabel,uniqueId:l})})},e3=({couponData:e,msImages:t,msText:i})=>{if(!Array.isArray(e.productFeatures)||0===e.productFeatures.length)return(0,r.jsx)(r.Fragment,{});let o={costco_direct:{src:t.costcoDirect.url,alt:i.costcoDirect}
56,technical_support:{src:t.technicalSupport.url,alt:i.technicalSupport},second_year_warranty:{src:t.twoYearWarranty.url,alt:i.twoYearWarranty}},l=e.productFeatures.filter(e=>e in o);return(0,r.jsx)(Y.CostcoBox,{sx:{display:"flex",flexDirection:"row",gap:a.m72},children:l.map(e=>{var t,i;return(0,r.jsx)(ee,{loading:"lazy",src:null==(t=o[e])?void 0:t.src,alt:null==(i=o[e])?void 0:i.alt},e)})})},e9=({cardData:e,enablePreview:t=!1,isLoading:i,msText:o,msImages:n,msProperties:a,locale:d,numberOfCouponsPerRow:s,locationCode:c,mathTableModuleSettings:p,couponSetPriceTextAndHighlightColor:f,couponSetPriceTextColor:m,deliveryZipCode:x,longestShippingText:h})=>{var b,j,A,k,M;let X=(0,l.useId)(),{externalLinkProps:Z}=(0,O.N)(),{adobeAssetsFeatureToggle:Q}=(0,E.D)(),ee={4:3,5:2.4,6:2}[s??4];if(!e)return i?(0,r.jsx)(ec,{lgSize:ee}):(console.error("CouponCard: No coupon data provided"),null);let et=((e,t,i,r,o)=>{if(!e||0===e.length)return null;let{defaultColors:l,presetColors:n}=t,a=e=>e&&"hex"in e?e.hex:void 0;return e.filter(e=>r||!e.value.includes("0")).map(e=>{var t;let r,d,s=e.price_text_and_highlight_color??i;if(null!=s)if("other"===s)r=a(e.text_color)||a(o)||l.text,d=void 0;else{let e=null==n?void 0:n[s];(null==e?void 0:e.text)?(r=e.text,d=e.background):(r=l.text,d=l.background)}else if(null==(t=e.text_color)?void 0:t.hex){r=e.text_color.hex;let t=n?Object.values(n).find(e=>e.text&&e.text.toLowerCase()===(null==r?void 0:r.toLowerCase())):void 0;t&&(d=t.background)}else r=l.text,d=l.background;let u={hex:r||""};return{prices_and_percentages:{select_style:e.select_style,prepend_text:e.prepend_text,add_currency:e.add_currency,value:e.value,has_off:e.has_off,append_text:e.append_text,text_color:u,highlighter_color:d,_metadata:e._metadata}}})})(e.pricesOffCSObject,a.pricesOffSection,f,t,m),{computedPriceTableData:ei,computedPricesAndPercentagesData:er}=((e,t,i,r=null,o)=>{var l,n,a,d,s;let u={computedPriceTableData:null,computedPricesAndPercentagesData:r};if(!e||!e.price_line_items||0===e.price_line_items.length||!t)return u;let c=((e,t,i)=>{var r,o;if(!("object"==typeof i&&null!==i&&"default"in i&&"string"==typeof(null==(r=i.default)?void 0:r.regular)&&"string"==typeof(null==(o=i.default)?void 0:o.hotBuy)))return eQ;let l=i[null==t?void 0:t.toUpperCase()];if("regular"===e)return l?{priceType:"regular",ecoFeeRenderingStyle:e0(l.regular)?l.regular:"itemized"}:{priceType:"regular",ecoFeeRenderingStyle:e0(i.default.regular)?i.default.regular:"itemized"};let n=e1(i.default.hotBuy)?i.default.hotBuy:"standard";return{priceType:"hot_buy",hotBuyRenderingStyle:e1(null==l?void 0:l.hotBuy)?l.hotBuy:n}})(e.price_type??"regular",t,i);if("regular"===c.priceType){let i,l,n,a,p,f,m,{ecoFeeRenderingStyle:x}=c,h=e2(e.price_line_items,t),g=(n=h.some(e=>"online"===e.line_item_label),a=h.some(e=>"in_warehouse"===e.line_item_label),n?"online":a?"inwarehouse":null);if(!g)return u;let v="online"===g?h.filter(e=>"in_warehouse"!==e.line_item_label):h;if(0===v.length)return u;let{rowsData:y,inWarehousePrice:b,ecoFeePrice:w,onlinePrice:j}=(p=0,f=0,m=0,{rowsData:v.map(e=>{var t;let i=(null==(t=e.location_amount_mapping[0])?void 0:t.amount)||"0",r=parseFloat((0,eX.DD)(i)),o=eZ[e.line_item_label];return"internalized"===x&&("ecofeemvm"===o&&(f=r),"inwarehouse"===o&&(p=r),"online"===o&&(m=r)),{rowKey:o,value:r}}).filter(e=>0!==e.value&&("internalized"!==x||0===f||"ecofeemvm"!==e.rowKey&&"inwarehouse"!==e.rowKey&&"online"!==e.rowKey)),inWarehousePrice:p,ecoFeePrice:f,onlinePrice:m}),A="online"===g?j:b;return{computedPriceTableData:{rowsData:(d="internalized"===x&&0!==w?[{rowKey:g,value:A+w},...y]:y,s=((e,t,i)=>{var r,o;if(!e)return null;let l=null==i?void 0:i.properties,n=null==(r=null==l?void 0:l[0])?void 0:r.customization,a=null==(o=null==n?void 0:n.finalRow)?void 0:o.totalAmtSuffixProvinceMapping,d=null==a?void 0:a[e];if(!d)return e;let s=null==t?void 0:t.toUpperCase();return s&&d.includes(s)?e:null})(e.total_amount_suffix,t,o),i=d.reduce((e,t)=>"instantsavings"===t.rowKey?e-t.value:e+t.value,0),(l=[...d]).push({rowKey:"price",value:i}),s&&l.push({rowKey:"taxable",value:0}
56),l),channelKey:g,channelPrice:A,ecoFeePrice:w,ecoFeeRenderingStyle:x},computedPricesAndPercentagesData:r}}let{hotBuyRenderingStyle:p}=c,f=e2(e.price_line_items,t).find(e=>"eco_fee"===e.line_item_label);if(!f)return u;let m=(null==(l=null==f?void 0:f.location_amount_mapping[0])?void 0:l.amount)??"0",x=parseFloat((0,eX.DD)(m));if("standard"===p)return{computedPriceTableData:{rowsData:f?[{rowKey:eZ.eco_fee,value:x}]:[],channelKey:"inwarehouse",channelPrice:0,ecoFeePrice:x,ecoFeeRenderingStyle:"itemized",hotBuyRenderingStyle:"standard"},computedPricesAndPercentagesData:r};let h=null==(a=null==(n=null==r?void 0:r[0])?void 0:n.prices_and_percentages)?void 0:a.value[0];if(!h)return{computedPriceTableData:{rowsData:x>0?[{rowKey:eZ.eco_fee,value:x}]:[],channelKey:"inwarehouse",channelPrice:0,ecoFeePrice:x,ecoFeeRenderingStyle:"itemized",hotBuyRenderingStyle:"standard"},computedPricesAndPercentagesData:r};let g=parseFloat((0,eX.DD)(h)),v=(g+x).toFixed(2),y=r?r.map((e,t)=>0===t?{...e,prices_and_percentages:{...e.prices_and_percentages,value:[v]}}:e):null,b={rowKey:eZ.eco_fee,value:x},w={rowKey:eZ.in_warehouse,value:g};return{computedPriceTableData:{rowsData:"itemized"===p&&0!==x?[w,b]:[],channelKey:"inwarehouse",channelPrice:g,ecoFeePrice:x,ecoFeeRenderingStyle:"internalized"===p?"internalized":"itemized",hotBuyRenderingStyle:p},computedPricesAndPercentagesData:y}})(e.priceTable,c,a.ecoFeeDisplayFormat,et,p),eo=(null==e?void 0:e.applicability)==="same_day",el=eo?o.viewsamedayoffer:o.shopOnline,ea=`${el} ${null==e?void 0:e.cardDescription}`,ed=!!((null==(b=null==e?void 0:e.couponLink)?void 0:b.url)&&(null==e?void 0:e.applicability)!=="warehouse_only"),eu=null==(j=null==e?void 0:e.productFeatures)?void 0:j.includes("executive_member_only"),ep=`${X}-item-description`,ef=e.cardDescription?`${o.barcodeAlttext} ${e.cardDescription}`:o.barcodeAlttext,eh=((e,t,i)=>{if(e){if(t&&i)try{let t=new URL(e);return t.searchParams.set("zipcode",i),t.toString()}catch{let t=e.includes("?")?"&":"?";return`${e}${t}zipcode=${encodeURIComponent(i)}`}return e}})(null==(A=null==e?void 0:e.couponLink)?void 0:A.url,eo,x),eg=(0,J.C0)(e.productImage,e.productImageAdobe,Q),ev=!(0,J.xL)(eg),ey=(null==e?void 0:e.couponType)==="search"?(null==e?void 0:e.searchTerm)&&`${o.search} ${e.searchTerm}`:(null==e?void 0:e.itemNumber)&&`${o.item} ${e.itemNumber}`,eb=(0,r.jsxs)(T,{children:[(0,r.jsxs)($,{children:[ev?(0,r.jsx)(G.default,{brandFolderAssets:e.productImage,adobeAssets:e.productImageAdobe,imageAltText:e.productImageAltText||"",imageSx:y,sx:y}):e.imageUrl?(0,r.jsx)(W.Image,{src:e.imageUrl,alt:e.productImageAltText||"",sx:y}):null,eu&&(0,r.jsx)(q.l,{text:o.executiveMemberOnly,color:"darkGray"}),(0,r.jsx)(e3,{couponData:e,msImages:n,msText:o})]}),(0,r.jsxs)(_,{children:[(0,r.jsxs)(S,{children:[(0,r.jsx)(es,{msText:o,applicability:null==e?void 0:e.applicability})," ",(0,r.jsx)(Y.CostcoBox,{id:ep,children:(null==e?void 0:e.cardDescription)&&(0,r.jsx)(U.T,{overrides:{span:{component:C}},markdown:e.cardDescription})}),(null==e?void 0:e.offerDetails)&&(0,r.jsx)(U.T,{overrides:{span:{component:R}},markdown:e.offerDetails}),(0,r.jsxs)(I,{children:[!!ey&&(0,r.jsx)(P,{children:ey}),!!(null==e?void 0:e.offerTerms)&&(0,r.jsx)(P,{children:e.offerTerms}),!!(null==e?void 0:e.validDatesOverride)&&(0,r.jsx)(P,{children:e.validDatesOverride})]}),(0,r.jsx)(ex,{cardData:e,msText:o,pricesOffFullyAuthored:er,itemDescriptionId:ep,locale:d})]}),(0,r.jsxs)(D,{children:[er&&er.length>0&&(0,r.jsx)(em,{enablePreview:t,pricesOffFullyAuthored:er,locale:d}),(0,r.jsx)(e5,{priceTable:e.priceTable,msText:o,locale:d,mathTableModuleSettings:p,uniqueId:X,computedPriceTableData:ei}),(0,r.jsxs)(v,{children:[(0,r.jsxs)(F,{children:[(0,r.jsx)(H,{"aria-hidden":!0,children:h||"\xa0"}),(null==e?void 0:e.shipping)&&(0,r.jsx)(N,{children:e.shipping})]}),ed?(0,r.jsx)(g,{variant:"primary",href:eh,"aria-label":ea,sx:eo?en:{},children:el}):(0,r.jsx)(u.default,{"aria-hidden":!0,sx:{minHeight:"40px"}}),((null==e?void 0:e.secondaryImage)||(null==e?void 0:e.secondaryImageAdobe))&&(0,r.jsx)(L,{children:(0,r.jsx)(G.default,{brandFolderAssets:e.secondaryImage,adobeAssets:e.secondaryImageAdobe,imageAltText:ef,sx:{width:"100%",height:"auto",display:"block"}})})]})]})]})]});if(i)return(0,r.jsx)(ec,{lgSize:ee,preserveDimensions:!0,children:eb});if(null==(k=null==e?void 0:e.couponLink)||!k.url)return(0,r.jsxs)(z,{size:{sm:6,md:3,lg:ee},children:[(0,r.jsx)(u.default,{component:"span",sx:B.A,children:null==e?void 0:e.cardDescription}),eb]});{let{external_site:t,title:i,url:o,same_tab_domain:l}=e.couponLink,{target:n}=(0,K.f)(t,l),a=null==(M=null==e?void 0:e.privacyToggle)?void 0:M.disable_third_party_tracking;return(0,r.jsxs)(z,{size:{sm:6,md:3,lg:ee},children:[(0,r.jsx)(V.Analytics,{analyticData:{adItem:{isExternal:t??!1,title:i,url:eh??o},doNotTrack:a,itemCuration:"costco"},children:(0,r.jsx)(w,{...t?{hasExternalLinkWarning:!0}:{},...Z??{},href:eh,target:n,children:(0,r.jsx)(u.default,{component:"span",sx:B.A,children:null==e?void 0:e.cardDescription})})}),eb]})}};var e4=i(9653),e6=i(26250),e7=i(66119),e8=i(16002);let te=async({bdWHNumber:e,itemNumbers:t,locale:i,preferredWarehouse:r,productSummaryV2ServiceConfig:l})=>{var n;let a=(0,e8.OT)(r),d=null==(n=null==l?void 0:l.apiUrl)?void 0:n.trim(),s=null==l?void 0:l.clientId,u=[null==l?void 0:l.warehouseNumber,a
56].filter(Boolean).join(","),c=null==l?void 0:l.clientIdHeader,p=(null==l?void 0:l.maxRequestItemCount)??20,f=(null==l?void 0:l.timeout)??5e3;if(!d||!s||!u)return null;let m=(0,o.T6)()&&e?e:u,x=Array.isArray(t)?t:[t],h=Math.max(1,p),g=[];for(let e=0;e<x.length;e+=h)g.push(x.slice(e,e+h));try{let e={headers:new Headers({"client-identifier":c??"","costco-env":"prd"}),method:"GET"},t=g.map(async t=>{let r=t.join(","),o=`${d}/summary?clientId=${s}&items=${r}&whsNumber=${m}&locales=${i}`,l=await (0,e7.$3)(o,e,f,!0);return(0,e6.Xp)(r,l)});return(await Promise.allSettled(t)).reduce((e,t,i)=>"fulfilled"===t.status?[...e,...t.value]:(console.error("Failed to fetch product summary chunk:",g[i],t.reason),e),[])}catch(e){return console.error("Error fetching product data from Product Summary V2 API:",e),null}};var tt=i(33723);function ti({couponSetId:e,uniqueId:t,couponCards:i,enablePreview:u=!1,msText:c,msImages:p,msProperties:f,locale:m,numberOfCouponsPerRow:g,textAndBackgroundColor:v,mathTableModuleSettings:y,couponSetPriceTextAndHighlightColor:w,couponSetPriceTextColor:T}){var _;let D=(0,l.useRef)(null),{bdDeliveryLocation:S,deliveryLocation:k,preferredTerritory:$}=(0,d.B)(),z=(0,l.useMemo)(()=>{var e,t;let i=(0,o.T6)()?null==(e=null==S?void 0:S.bdLocation)?void 0:e.slice(-2):null==(t=null==$?void 0:$.value)?void 0:t.slice(-2);return null==i?void 0:i.toLowerCase()},[S,$]),C=(0,l.useMemo)(()=>null==k?void 0:k.zipCode,[k]),{couponCardsWithProductData:I,isLoading:P}=(({couponCards:e,enablePreview:t,locale:i,msText:r})=>{var n;let[a,s]=(0,l.useState)(e),u=(0,l.useMemo)(()=>(null==e?void 0:e.filter(e=>"item_dynamic"===e.couponType).map(e=>e.productId).filter(Boolean))||[],[e]),c=u.length>0,[p,f]=(0,l.useState)(c),m=(0,l.useRef)(0),h=(0,d.B)(),{bdWarehouseNumber:g,warehouse:v}=h,{productTileConfigData:y}=(0,tt.P)(),{productDetailApiV2Config:b}=y||{},w=null==(n=null==v?void 0:v.nearestWarehouse)?void 0:n.catalog;return((0,l.useEffect)(()=>{if(!c||!w&&(0,o._t)())return;let l=++m.current,n=!0,a=()=>!n||m.current!==l;return(async()=>{f(!0);try{let o=await te({bdWHNumber:g.value,itemNumbers:u,locale:i,preferredWarehouse:w,productSummaryV2ServiceConfig:b});if(a())return;if(!o||0===o.length){s(e),f(!1);return}let l=null==o?void 0:o.map(e=>{let t=(0,e4.V)({productApiResponseData:e.productApiResponseData},y,!1,h,null,!1,!1,i);return{[e.itemNumber]:t}}),n=(({couponCards:e,enablePreview:t,msText:i,productsDataNormalized:r})=>null==e?void 0:e.flatMap(e=>{var o,l,n;if("item_dynamic"!==e.couponType)return[e];{let a=null==(o=null==r?void 0:r.find(t=>Object.keys(t).includes(e.productId||"")))?void 0:o[e.productId||""];return a?[{...e,cardDescription:e.cardDescription||a.productInfoData.productName,couponLink:(null==(l=e.couponLink)?void 0:l.url)?e.couponLink:{external_site:!1,title:"",url:a.productInfoData.productLinkUrl||""},pricesOffCSObject:(({discountMatchText:e,enablePreview:t,priceMatchText:i,pricesOffCSObject:r,productData:o})=>{var l,n,a,d;let s;if(!o||!r)return[];let u=e=>{if(null!=e)return Array.isArray(e)?e.length>0?e.map(String):void 0:[String(e)]};if(r.value[0])return[r];let{append_text:c,prepend_text:p}=r,f=!!(e&&(null==p?void 0:p.toLowerCase().startsWith(e.toLowerCase()))),m=!!(i&&(null==c?void 0:c.toLowerCase().startsWith(i.toLowerCase()))),h=r.append_text;f?s=u(null==(l=o.priceListData)?void 0:l.discountValue):m&&(s=u(null==(n=o.priceListData)?void 0:n.priceValue));let g=u(null==(a=o.priceListData)?void 0:a.discountValue),v=null==g?void 0:g[0],y=Number(v),b=!(void 0!==v&&!Number.isNaN(y)&&0!==y)&&t?"$X":((e,t)=>{if(!e)return"";let i=Number(e);if(Number.isNaN(i))return e;let r=t||"en-ca",o=x.C[r]||"CAD";return new Intl.NumberFormat(r,{currency:o,maximumFractionDigits:2,minimumFractionDigits:0,style:"currency"}).format(i)})(v,o.locale);if(h=null==(d=r.append_text)?void 0:d.replace(/\$\{\s*discount\s*\}/gi,b),!s)if(!t||!f&&!m)return[];else s=[""];return[{...r,append_text:h,value:s}]})({discountMatchText:null==i?void 0:i.discountMatchText,enablePreview:t,priceMatchText:null==i?void 0:i.priceMatchText,pricesOffCSObject:null==(n=e.pricesOffCSObject)?void 0:n[0],productData:a}),productImage:e.productImage||[{url:a.productInfoData.productImageUrl}],productImageAltText:e.productImageAltText||a.productInfoData.productName,offerTerms:(({offerTerms:e,productData:t})=>{var i;let r=(null==(i=null==t?void 0:t.discountsData)?void 0:i.offerTerms)||"";return e&&r?`${r}. ${e}`:e?e:r?r:""})({offerTerms:e.offerTerms,productData:a}),isFsaEligible:a.isFsaEligible,isChdiEligible:a.isChdiEligible}]:(console.warn(`No product data found for coupon card with item number ${e.itemNumber}`),[e])}}))({couponCards:e,enablePreview:t,msText:r,productsDataNormalized:l});s(n??e),f(!1)}catch(t){if(a())return;console.error("CouponSet product data fetch failed",t),s(e),f(!1)}})(),()=>{n=!1}},[u,g,h,e,t,i,r,c,w,b,y]),c)?{couponCardsWithProductData:a,isLoading:p}:{couponCardsWithProductData:e,isLoading:!1}})({couponCards:i,enablePreview:u,locale:m,msText:c}),R=(0,l.useMemo)(()=>null==I?void 0:I.some(e=>{var t;return(null==e?void 0:e.isFsaEligible)||(null==e?void 0:e.isChdiEligible)||(null==(t=null==e?void 0:e.privacyToggle)?void 0:t.disable_third_party_tracking)}),[I]),F=(0,l.useMemo)(()=>i?i.reduce((e,t)=>
56{var i;return((null==(i=t.shipping)?void 0:i.length)??0)>e.length?t.shipping??"":e},""):"",[i]);if((0,l.useEffect)(()=>{let e=()=>{let e=window.location.hash;!e||"string"!=typeof e||e.substring(1)===t&&D.current&&D.current.focus({preventScroll:!0})};return e(),window.addEventListener("hashchange",e),window.addEventListener("popstate",e),()=>{window.removeEventListener("hashchange",e),window.removeEventListener("popstate",e)}},[t]),!i)return console.error("CouponSetUI error: no valid data or product data provided"),null;let H=(e=>{var t,i,r,o;if(!h(e))return a.hGW;let{background_gradient_style:l,background_color:n,background_gradient_color:d}=e;switch(l){case"solid":return(null==n?void 0:n.hex)||a.hGW;case"linear":return(null==(t=null==d?void 0:d.color1)?void 0:t.hex)&&(null==(i=null==d?void 0:d.color2)?void 0:i.hex)?`linear-gradient(${d.color1.hex}, ${d.color2.hex})`:a.hGW;case"radial":return(null==(r=null==d?void 0:d.color1)?void 0:r.hex)&&(null==(o=null==d?void 0:d.color2)?void 0:o.hex)?`radial-gradient(${d.color1.hex}, ${d.color2.hex})`:a.hGW;default:return a.hGW}})(v),N=h(v)&&(null==(_=v.text_color)?void 0:_.hex)||a.DJJ;return(0,r.jsxs)(A,{"data-testid":`coupon-set-${e}`,children:[R&&(0,r.jsx)(s.TranscendOverride,{}),(0,r.jsx)(j,{id:t}),(0,r.jsx)(M,{backgroundStyle:H,children:e&&(0,r.jsx)(n.Text,{component:"h2",variant:"t2",ref:D,tabIndex:-1,sx:{color:N,fontWeight:a.Pqj},children:e})}),(0,r.jsx)(b,{container:!0,spacing:0,children:I&&I.map((e,t)=>(0,r.jsx)(e9,{cardData:e,enablePreview:u,isLoading:P,msText:c,msImages:p,msProperties:f,locale:m,numberOfCouponsPerRow:g,locationCode:z,mathTableModuleSettings:y,couponSetPriceTextAndHighlightColor:w,couponSetPriceTextColor:T,deliveryZipCode:C,longestShippingText:F},t))})]})}},92533:(e,t,i)=>{i.d(t,{A:()=>h});var r=i(12115),o=i(29722),l=i(97335),n=i(57042),a=i(86670),d=i(53083),s=i(16377),u=i(24885),c=i(34449);function p(e){return(0,c.Ay)("MuiTable",e)}(0,u.A)("MuiTable",["root","stickyHeader"]);var f=i(95155);let m=(0,a.default)("table",{name:"MuiTable",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:i}=e;return[t.root,i.stickyHeader&&t.stickyHeader]}})((0,d.A)(({theme:e})=>({display:"table",width:"100%",borderCollapse:"collapse",borderSpacing:0,"& caption":{...e.typography.body2,padding:e.spacing(2),color:(e.vars||e).palette.text.secondary,textAlign:"left",captionSide:"bottom"},variants:[{props:({ownerState:e})=>e.stickyHeader,style:{borderCollapse:"separate"}}]}))),x="table",h=r.forwardRef(function(e,t){let i=(0,s.b)({props:e,name:"MuiTable"}),{className:a,component:d=x,padding:u="normal",size:c="medium",stickyHeader:h=!1,...g}=i,v={...i,component:d,padding:u,size:c,stickyHeader:h},y=(e=>{let{classes:t,stickyHeader:i}=e;return(0,l.A)({root:["root",i&&"stickyHeader"]},p,t)})(v),b=r.useMemo(()=>({padding:u,size:c,stickyHeader:h}),[u,c,h]);return(0,f.jsx)(n.A.Provider,{value:b,children:(0,f.jsx)(m,{as:d,role:d===x?null:"table",ref:t,className:(0,o.A)(y.root,a),ownerState:v,...g})})})},96270:(e,t,i)=>{i.d(t,{$V:()=>l,$g:()=>d,RE:()=>a,xw:()=>o});var r=i(49909);let o=async(e,t,i,r)=>{var o;try{let o=await fetch(`${e}?orderTotal=${t}&zipcode=${i}`,{method:"POST",signal:r?r.signal:void 0});if(o.ok)return o.json()}catch(e){(null==(o=null==r?void 0:r.signal)?void 0:o.aborted)?console.info("Request getMiniBannerDetails aborted"):console.error("Error fetching MiniBannerDetails:",e);return}},l=(e,t,i,r,o,l)=>i>=r?l?t.reachedMinimumOrderAmount:`${t.surcharge}: ${d(e,0)}`:n(e,l?t.addToPickupText:t.addToRemoveText,r-i,o),n=(e,t,i,r)=>t.replace("${thresholdPrice}",d(e,i)).replace("${surchargePrice}",d(e,r)),a=(e,t,i,r,o,l)=>(l?t.pickupTooltip:i>=r?t.reachedMinimumOrderAmountTooltip:t.tooltip).replace("${freeDeliveryOrderAmount}",d(e,r,0)).replace("${surchargePrice}",d(e,o,0));function d(e,t,i){return new Intl.NumberFormat(e,{currency:r.S6[e],maximumFractionDigits:i,minimumFractionDigits:i,currencyDisplay:"symbol",style:"currency"}).format(t)}}}]);
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.