import{_ as O}from"./CIphFW6W.js";import{_ as X}from"./mNFvUmUr.js";import{d as T,aQ as H,k as a,o as n,e as i,S as G,h as _,p as c,n as A,g as t,l as M,O as L,t as j,w as E,j as D,m as $,f as g,C as y,V as C,s as Q,F as W,v as q}from"./Bxi7Ki28.js";import{_ as J}from"./CwYFwt_q.js";import{u as K}from"./CUgZq_py.js";import{_ as R}from"./BoyXPkCS.js";import{S as Y}from"./0xGS4wW9.js";const Z={class:"progress-bar__container"},I={key:0,class:"progress-bar__message"},ee=T({__name:"progress-bar",props:{value:{default:0},maxValue:{default:100},simple:{type:Boolean}},setup(f){const o=f,p=H(),e=a(()=>o.value>=o.maxValue),u=a(()=>{const s=o.value/o.maxValue*100;return Math.min(s,100)});return(s,m)=>(n(),i("div",Z,[p.default?(n(),i("div",I,[G(s.$slots,"default")])):_("",!0),c("div",{class:A(["progress-bar__inner-container",{"progress-bar--simple":o.simple}])},[c("span",{class:A(["progress-bar__progress",{"progress-bar__progress--reached":t(e)}]),style:M(`width: ${t(u)}%`)},null,6)],2)]))}});var r=(f=>(f.FreeGift="FreeGift",f.Voucher="Voucher",f.Discount="ProductDiscount",f.BuyXGetCheapest="BuyXGetCheapestDiscount",f))(r||{});const te={class:"special-offer-item__container"},re={class:"special-offer-item__icon-wrapper"},oe={class:"special-offer-item__text-wrapper"},se={key:0,class:"special-offer-item__image-wrapper"},ae=["alt","src"],ne={class:"special-offer-item__text-container"},fe={class:"special-offer-item__heading"},ie={class:"special-offer-item__text"},ce={key:0,class:"special-offer-item__text--highlight"},ue={key:0,class:"special-offer-item__button"},le={key:1,class:"special-offer-item__progress"},pe={key:0,class:"special-offer-item__conditions"},de=T({__name:"special-offers-item",props:{countdown:{type:Boolean,default:!0},offer:{}},async setup(f){let o,p;const e=f,u=L(),{translate:s}=j(),{normalizeUrl:m}=K(),h=a(()=>{const l=e.offer.type;return l===r.FreeGift?"gift":l===r.Discount?"discount":"starCircle"}),d=a(()=>e.offer.type===r.FreeGift?`${s("general.value")} ${e.offer.data.gwpValue}`:e.offer.type===r.Discount&&e.offer.data.discountPercentage?`${e.offer.data.badgeText} - ${e.offer.data.discountPercentage}% ${s("specialoffer.off")}`:s("specialoffer.offer")),v=a(()=>{if(!e.countdown&&e.offer.type!==r.Voucher)return e.offer.data.productPageText;if(e.offer.type===r.Voucher)return e.offer.data.voucherText;if(e.offer.customisedTextA)return e.offer.customisedTextA;if(e.offer.type===r.FreeGift)return`${s("specialoffer.freegiftA")} ${e.offer.data.brand} ${s("specialoffer.freegiftB")}`;if(e.offer.type===r.Discount&&e.offer.data.discountPercentage)return`${e.offer.data.discountPercentage}% ${s("specialoffer.discountA")} ${e.offer.minimumAmount} ${u.currency==="kr"?"kr.":u.currency} ${s("specialoffer.discountB")}`;if(e.offer.type===r.BuyXGetCheapest&&e.offer.data.productPageText)return e.offer.data.productPageText}),w=a(()=>{if(!(!e.countdown&&e.offer.type===r.Voucher)&&e.offer.customisedTextB)return e.offer.customisedTextB}),x=a(()=>{switch(e.offer.type){case r.FreeGift:return s("specialoffer.gwp");case r.Voucher:return e.offer.data.voucherTitle;case r.Discount:return s("specialoffer.offer");case r.BuyXGetCheapest:return s("specialoffer.3for2");default:return}}),V=a(()=>e.offer.pendingAmount),S=a(()=>{if(V.value)return`${V.value} ${u.currency}`}),B=a(()=>{if(!e.offer.minimumAmount||!e.offer.pendingAmount)return null;const l=e.offer.minimumAmount-e.offer.pendingAmount,b=e.offer.minimumAmount;return l/b*100}),P=a(()=>e.offer.data.productLink??e.offer.data.campaignPageUrl??e.offer.data.ctaUrl??null),k=a(()=>{if(e.offer.data.productThumbnail)return m(e.offer.data.productThumbnail)});return[o,p]=E(()=>u.waitForHeaderData()),await o,p(),(l,b)=>{const U=O,F=X,z=ee,N=J;return n(),D(N,{class:"special-offer-item__wrapper",url:t(P)?t(P):""},{default:$(()=>[c("div",te,[g(U,{class:"special-offer-item__tag",rounded:!1,size:"medium-plus",text:t(d)},null,8,["text"]),c("div",re,[g(F,{class:"special-offer-item__icon",icon:t(h)},null,8,["icon"])]),c("div",oe,[t(k)?(n(),i("div",se,[c("img",{alt:e.offer.data.productName??"",class:"special-offer-item__image",loading:"lazy",src:t(k)},null,8,ae)])):_("",!0),c("div",ne,[c("div",fe,y(t(x)),1),c("div",ie,[C(y(t(v))+" ",1),l.countdown?(n(),i("span",ce,y(t(S)),1)):_("",!0),C(" "+y(t(w)),1)])]),G(l.$slots,"default")]),e.offer.type===t(r).Voucher?(n(),i("div",ue)):_("",!0),l.countdown&&t(B)?(n(),i("div",le,[g(z,{color:"red",value:t(B)},null,8,["value"])])):_("",!0)]),e.offer.data.conditionText?(n(),i("div",pe,y(e.offer.data.conditionText),1)):_("",!0)]),_:3},8,["url"])}}}),_e={key:0,class:"special-offers--multiple"},me={key:1,class:"special-offers--single"},Te=T({__name:"special-offers",props:{offers:{},carouselOptions:{default:void 0},offset:{default:0}},setup(f){const o=f,{isMobile:p}=Q(),e=a(()=>{var m;return(m=o.offers)==null?void 0:m.filter(h=>{var d;return h.type!==r.Discount||((d=h.data)==null?void 0:d.productPageText)})}),u=a(()=>({breakpoints:{991:{slidesPerGroup:1,slidesPerView:o.offers.length>1?1.1:1,spaceBetween:16},700:{slidesPerGroup:1,slidesPerView:o.offers.length>2?2.15:2,spaceBetween:12},340:{slidesPerGroup:1,slidesPerView:o.offers.length>1?1.05:1,spaceBetween:12}},slidesPerView:o.offers.length>1?1.05:1,spaceBetween:p.value?12:16,loop:!1,navigation:!p.value})),s=a(()=>o.carouselOptions??u.value);return(m,h)=>{const d=de,v=R;return t(e).length>1?(n(),i("div",_e,[g(v,{id:"special-offers","carousel-options":t(s),class:"special-offers__carousel",offset:o.offset,space:0},{carousel:$(()=>[(n(!0),i(W,null,q(t(e),(w,x)=>(n(),D(t(Y),{key:"productOffer"+x},{default:$(()=>[g(d,{countdown:!1,offer:w},null,8,["offer"])]),_:2},1024))),128))]),_:1},8,["carousel-options","offset"])])):t(e).length===1?(n(),i("div",me,[g(d,{countdown:!1,offer:t(e)[0]},null,8,["offer"])])):_("",!0)}}});export{ee as _,Te as a};
