1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3067,6050],{19042:(e,t,r)=>{r.d(t,{A:()=>d});var a=r(54568),l=r(65587),s=r.n(l),n=r(7620),i=r(1341);let u={sm:"p-1 rounded-md truncate font-semibold gap-1",md:"py-2 rounded-lg",lg:"py-3 rounded-xl"},o=(0,n.forwardRef)((e,t)=>{let{children:r,size:l="md",variant:n="primary",className:o}=e,d=void 0===e.href&&!!e.disabled,c="primary"===n,m="secondary"===n,h="grayed"===n,p=(0,i.cn)("inline-flex justify-center items-center gap-2 font-bold text-sm",{"border-primary-base px-4 uppercase hover:border-primary-base":c},c&&u[l],{"text-neutral-extralight-base bg-primary-base border hover:text-primary-base hover:bg-neutral-extralight-base":c&&!d,"text-neutral-medium-300 bg-neutral-light-300":c&&d,"underline-offset-4":m,"text-primary-base hover:underline":m&&!d,"text-neutral-medium-300":m&&d,"text-neutral-medium-base bg-neutral-light-base border border-neutral-light-base px-4 uppercase":h,"hover:text-primary-base hover:bg-neutral-extralight-base hover:border-primary-base":h&&!d},h&&u[l],o);if(void 0!==e.href){let{children:l,size:n,variant:i,className:u,...o}=e;return(0,a.jsx)(s(),{...o,ref:t,className:p,children:r})}let{children:f,size:x,variant:b,className:g,...y}=e;return(0,a.jsx)("button",{...y,ref:t,type:"button",className:p,children:r})});o.displayName="Button";let d=o},54016:(e,t,r)=>{r.d(t,{Jy:()=>a});let a={mobile:{slidesPerView:2},desktop:{slidesPerView:4}}},63067:(e,t,r)=>{r.r(t),r.d(t,{default:()=>s});var a=r(54568),l=r(99894);let s=function(e){let{svgProps:t,...r}=e;return(0,a.jsx)(l.A,{icon:(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",fill:"none",viewBox:"0 0 8 12",...t,children:(0,a.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M1.732 12 .667 10.935 5.602 6 .667 1.065 1.732 0l6 6-6 6Z",clipRule:"evenodd"})}),...r})}},86050:(e,t,r)=>{r.r(t),r.d(t,{default:()=>S});var a=r(54568),l=r(7620),s=r(94084),n=r(19042),i=r(63067),u=r(62855),o=r(14940),d=r(29386),c=r(2153),m=r(84952),h=r(21784);async function p({sharedCategoryId:e,country:t,ll:r}){try{let a=(0,c.x)("sponsored_gibs"),l=e?`&shared_cat_id=${e}`:"",s=await fetch(`${a}?ll=${r}&country=${t}${l}`);return await s.json()}catch(a){return h.A.error({error:a,functionName:"fetchSponsoredFlyerGibs",additionalInfo:{sharedCategoryId:e,country:t,ll:r}}),null}}var f=r(42059),x=r(92321),b=r(54016),g=r(82175),y=r(65587),v=r.n(y),w=r(19206);let j=({flyerGib:e,onClick:t})=>{let{type:r,href:l,image:s,publication_url:n}=e,i=((e,t,r)=>{let{latitude:a,longitude:l}=(0,d.useAtomValue)(m.aU),{id:s}=(0,d.useAtomValue)(m.p9),{country:n,utm:i,pageType:u}=(0,d.useAtomValue)(m.dn);if(!e)return"";let o=r||(0,w.A)({pageType:u});if("s2s"===t){var c;return c={latitude:a,longitude:l,pageType:u,userId:s,country:n,utmMedium:o,utmCampaign:i?.utmCampaign},Object.entries({"{{lat}}":c.latitude?.toString(),"{{lng}}":c.longitude?.toString(),"{{type}}":c.pageType,"{{muid}}":c.userId,"{{utm_source}}":c.utmCampaign,"{{utm_medium}}":c.utmMedium,"{{c}}":c.country,"{{t}}":"w"}).reduce((e,[t,r])=>e.replace(t,r??""),e)}return((e,t="")=>{let r=e.indexOf("?")>=0?"&":"?",a=t?`${r}utm_medium=${t}`:"";return`${e}${a}`})(e,o)})("crop"===r?l:n,r,f.kr.sponsoredProducts.item);return(0,a.jsx)(v(),{prefetch:!1,href:i,onClick:()=>t(e),children:(0,a.jsx)("div",{className:"h-full flex justify-center items-center",children:(0,a.jsx)("div",{className:"max-w-full max-h-full h-auto w-auto",children:(0,a.jsx)(g.default,{src:s,className:"object-contain",alt:`${e.title}`,fill:!0})})})})},N=({flyerGibs:e,onItemClick:t})=>(0,a.jsx)(x.A,{arrowClasses:"rounded-full bg-neutral-extralight-base/80",spaceBetween:10,slidesPerView:2,breakpoints:b.Jy,rootClasses:"h-32",children:e.map(e=>(0,a.jsx)(j,{flyerGib:e,onClick:t},e.id))}),S=function({sharedCategoryId:e,className:t,country:r,onLoad:c,onViewAllClick:h,onItemClick:x}){let b=(0,l.useRef)(null),g=(0,o.A)(),y=function(e,t){let{country:r}=(0,d.useAtomValue)(m.dn),a=t??r,{latitude:s,longitude:n}=(0,d.useAtomValue)(m.aU),i=`${s},${n}`,[u,o]=(0,l.useState)([]);return(0,l.useEffect)(()=>{(async()=>{o(await p({sharedCategoryId:e,country:a,ll:i})||[])})()},[e,a,i]),u}(e,r),v=(0,u.c)();return((0,l.useEffect)(()=>{b.current&&y?.length&&c&&c(y)},[b.current]),y&&0!==y.length)?(0,a.jsxs)("div",{ref:b,className:t,children:[(0,a.jsx)("h2",{className:"text-lg font-bold",children:v("SPONSORED_GIBS_TITLE")}),(0,a.jsxs)("div",{className:"pt-3",children:[(0,a.jsxs)("div",{className:"flex justify-between pb-3 py-",children:[(0,a.jsx)(s.A,{label:v("SPONSORED_GIBS_BADGE"),section:"dropdown"}),(0,a.jsxs)(n.A,{variant:"secondary",onClick:()=>{let e=(e=>{let{type:t,href:r}=e,a=r;
1"s2s"===t&&(a=r.replace(/[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}/,""));var l=a,s={flyerGibId:void 0,utm_medium:f.kr.sponsoredProducts.viewAll};if(!l)return"";if(!s)return l;let n=/^https?:\/\//i.test(l),i=n?new URL(l):new URL(l,n?"":"https://www.example.com");return Object.keys(s).forEach(e=>{let t=s[e];t?i.searchParams.set(e,t):i.searchParams.delete(e)}),n?i.toString():`${i.pathname}${i.search}`})(y[0]);g.push(e),h()},children:[v("SPONSORED_GIBS_CTA"),(0,a.jsx)(i.default,{})]})]}),(0,a.jsx)(N,{flyerGibs:y,onItemClick:x})]})]}):null}},92321:(e,t,r)=>{r.d(t,{A:()=>d});var a=r(54568),l=r(7620),s=r(42264),n=r(85753),i=r(2809),u=r(54016),o=r(51237);let d=function({children:e,rootClasses:t,arrowClasses:r,leftArrowClass:d,rightArrowClass:c,spaceBetween:m=0,disabledClass:h,slidesPerView:p=1,slidesToScroll:f=1,breakpoints:x=u.Jy,mobileScrollArrows:b,externalArrows:g=!1,showDots:y=!1}){let[v,w]=(0,l.useState)(0),[j,N]=(0,l.useState)(0),S=(0,l.useRef)(null),A=(0,l.useRef)(null),k=l.Children.toArray(e),P=(0,s.A)(),{isSmartphone:_}=(0,n.k)(),C=g||b||!_,$=x[P]?.slidesPerView||p,{slideWidth:E,scrollByAmount:R,maxDots:I}=function({containerWidth:e,externalArrows:t,isSmartphone:r,spaceBetween:a,currentSlidesPerView:l,currentSlidesToScroll:s,flatChildren:n,showDots:i}){let u=e-(t?r?80:64:0),o=u?Math.floor((u-a*(l-1))/l):0,d=(o+a)*s,c=n.length,m=Math.max(0,c*o+(c-1)*a-u),h=i&&d>0&&m>0?Math.ceil(m/d)+1:1;return{slideWidth:o,scrollByAmount:d,maxDots:h}}({containerWidth:v,externalArrows:g,isSmartphone:_,spaceBetween:m,currentSlidesPerView:$,currentSlidesToScroll:x[P]?.slidesToScroll||f,flatChildren:k,showDots:y}),{scrollStart:z,scrollEnd:B,activeDot:O,handleScroll:T}=(({scrollRef:e,containerWidth:t,showDots:r,scrollByAmount:a,maxDots:s})=>{let[n,i]=(0,l.useState)(!0),[u,o]=(0,l.useState)(!1),[d,c]=(0,l.useState)(0);return{scrollStart:n,scrollEnd:u,activeDot:d,handleScroll:(0,l.useCallback)(()=>{if(e.current&&t>0){let{scrollLeft:t,scrollWidth:l,clientWidth:n}=e.current;i(0===t);let u=l<=n||t+n>=l-1;o(u),r&&a>0&&(u?c(s-1):c(Math.round(t/a)))}},[t,r,a,s,e])}})({scrollRef:A,containerWidth:v,showDots:y,scrollByAmount:R,maxDots:I});(0,l.useEffect)(()=>{let e=()=>{S.current&&(w(S.current.offsetWidth),setTimeout(()=>T(),0))};return e(),window.addEventListener("resize",e),setTimeout(()=>N(1),100),()=>window.removeEventListener("resize",e)},[T]),(0,l.useEffect)(()=>{setTimeout(()=>T(),0)},[k.length,$,T]);let V=(0,i.QP)("relative grid min-h-30 w-full list-none",t,1===j?"opacity-100":"opacity-0"),G=(0,i.QP)("overflow-hidden touch-pan-x mobile:min-h-24",g?"mx-9 tablet:mx-8":""),M=(0,i.Id)("snap-start py-1 px-0 tablet:px-1 shrink-0",`mr-[${m}px]`);return(0,a.jsxs)("div",{className:V,ref:S,"data-testid":"carousel-container",children:[(0,a.jsx)("div",{className:G,children:(0,a.jsx)("div",{className:"flex overflow-x-auto scroll-smooth snap-x snap-mandatory hide-scrollbar","data-testid":"carousel-scroll-container",style:{gap:`${m}px`},onScroll:T,ref:A,children:k.map((e,t)=>(0,a.jsx)("div",{className:(0,i.Id)(M),style:{width:E},"data-testid":"carousel-slide",children:e},`carousel-component-slide-${t+1}`))})}),C&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.A,{className:(0,i.QP)(r,h,d||(g?"left-0":"left-2")),position:"left",onClick:()=>{A.current?.scrollBy({left:-R,behavior:"smooth"})},disabled:z}),(0,a.jsx)(o.A,{className:(0,i.QP)(r,h,c||(g?"right-0":"right-2")),position:"right",onClick:()=>{A.current?.scrollBy({left:R,behavior:"smooth"})},disabled:B})]}),y&&I>1&&(0,a.jsx)("div",{className:"flex justify-center items-center gap-2 mt-6",children:Array.from({length:I}).map((e,t)=>(0,a.jsx)("div",{className:(0,i.QP)("w-2 h-2 rounded-full transition-opacity","bg-neutral-dark-400",t===O?"bg-white opacity-100":"bg-white opacity-60")},t))})]})}},94084:(e,t,r)=>{r.d(t,{A:()=>u});var a=r(54568),l=r(2809);let s={sm:"text-[10px] leading-4 py-0.5 uppercase",md:"text-xs py-1",lg:"text-sm py-2 px-3",xl:"text-sm py-2 px-3"},n={viewer:"bg-neutral-dark-base text-neutral-extralight-base",dropdown:"text-neutral-dark-200 bg-neutral-medium-100",discount:"bg-custom04-base text-neutral-extralight-base",featured:"bg-primary-base text-neutral-extralight-base"},i={primary:"bg-custom02-base",secondary:"bg-custom03-base",tertiary:"bg-custom01-base","neutral-medium":"bg-neutral-medium-base",expired:"bg-custom05-base",grayed:"bg-neutral-medium-base"},u=({size:e="md",section:t="viewer",variant:r="primary",label:u,className:o,...d})=>{if(!u)return null;
1let c=(0,l.QP)("font-bold px-2 rounded-full",s[e],"flyers"===t?i[r]:n[t]||"text-neutral-extralight-base",o);return(0,a.jsx)("span",{className:c,...d,children:u})}}}]);
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.