(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2748],{52748:function(e,t,r){"use strict";r.d(t,{p:function(){return tE}});var l=r(85893),n=r(91794),a=r(67294),i=r(93e3),o=r.n(i);let s=(e,t,r)=>r<e?e:r>t?t:r,d=(e,t)=>(1-e/t)*100;var c=r(26873),u=r(90512),x=r(3166),h=r(49460);let p=e=>{let{initialVh:t,minVh:r,maxVh:n,children:i,handleHeight:x=40,draggableBarHeight:p=5}=e,m=(0,a.useRef)(null),[g,f]=(0,a.useState)(t),[j,b]=(0,a.useState)(!1),y=(0,a.useCallback)(()=>b(!0),[]),C=(0,a.useCallback)(()=>b(!1),[]),_=(0,a.useCallback)(e=>f(s(r,n,e)),[r,n]),w=(0,a.useCallback)(e=>{var t;let r=null===(t=e.targetTouches[0])||void 0===t?void 0:t.clientY;j&&r&&(e.preventDefault(),e.stopPropagation(),_(d(e.targetTouches[0].clientY,window.innerHeight)))},[_,j]),k=(0,a.useCallback)(e=>{j&&(e.stopPropagation(),e.preventDefault(),_(d(e.clientY-x/2,window.innerHeight)))},[j,_,x]),N=(0,a.useCallback)(e=>{e.preventDefault(),y()},[y]);(0,c.x)("mousemove",k,[j]),(0,c.x)("mouseup",C,[]),(0,c.x)("touchmove",w,[m.current,j]);let S=()=>{f(r)};return(0,h.t$)(m,S,"mousedown"),(0,h.t$)(m,S,"touchstart"),(0,l.jsxs)("div",{"data-testid":"expandable-panel",ref:m,className:(0,u.Z)("flex flex-col",o().expandablePanel,{[o().notDragged]:!j}),style:{height:"".concat(g,"vh")},children:[(0,l.jsxs)("div",{"data-testid":"draggable-bar",style:{height:x,borderTopLeftRadius:x,borderTopRightRadius:x},className:(0,u.Z)(o().draggableBar,{[o().dragged]:j}),onMouseDown:N,onTouchStart:y,onTouchEnd:C,children:[(0,l.jsx)(v,{handleHeight:x}),(0,l.jsx)("div",{onClick:()=>{f(n)},className:(0,u.Z)(o().draggableBarHandle,{[o().dragged]:j}),style:{height:"".concat(p,"px")}})]}),(0,l.jsx)("div",{className:o().contentWrapper,children:i})]})},v=e=>{let{handleHeight:t}=e;return(0,x.b)()?(0,l.jsx)("div",{"data-testid":"draggable-area-extender",className:"absolute",style:{bottom:0,left:0,right:0,top:-t}}):null};var m=r(39332),g=r(11163);let f=["designName","width","height","depth","opening","hinges","handles","sink","taps","drains"],j=()=>{var e;let t=(0,g.useRouter)(),r=(0,m.usePathname)(),l=(0,m.useSearchParams)(),n={designName:l.get("designName"),width:l.get("width"),height:l.get("height"),depth:l.get("depth"),opening:l.get("opening"),handles:l.get("handles"),sink:l.get("sink"),taps:l.get("taps"),drains:l.get("drains"),hinges:l.get("hinges"),openingOrHingeSku:null!==(e=l.get("hinges"))&&void 0!==e?e:l.get("opening")},a=(e,n)=>{let a=new URLSearchParams(l.toString());a.set(e,n);let i=f.findIndex(t=>t===e);f.slice(i+1).forEach(e=>{a.delete(e)});let o=a.get("hinges");o&&"null"!==o||a.delete("hinges"),t.push(r+"?"+a.toString(),void 0,{shallow:!0})};return[n,a,()=>{a("designName",null),t.push(r,void 0,{shallow:!0})}]};var b=r(94743),y=r.n(b),C=r(22568),_=r(5889),w=r(10879),k=r(53756);let N=()=>{let{push:e}=(0,g.useRouter)();return(0,l.jsx)("button",{className:"z-[1] p-3 absolute top-2 left-2",onClick:()=>e("/range-screen"),children:(0,l.jsx)(w.Z,{height:40,width:40,className:"stroke-[2]"})})},S=()=>{let{t:e}=(0,k.$G)("bathConfigurator"),[,,t]=j();return(0,l.jsx)("button",{className:"!absolute top-[16px] right-[64px] h-[38px] rounded-[19px] bg-[#e7edf1] hover:bg-[#d7e0e5] transition-all duration-500 px-[10px] text-[#0009] text-[13px] z-10",onClick:t,children:e("ResetDesign")})},D=e=>{var t;let{code:r="AVOLIA 60",features:n={}}=e,i=(0,g.useRouter)(),o=(0,_.GQ)(null!==(t=i.locale)&&void 0!==t?t:"en").languageCode,{t:s}=(0,k.$G)("bathConfigurator"),d=(0,x.b)();return(0,a.useEffect)(()=>{"true"===localStorage.getItem("DEBUG")&&console.log("features",n);let e=document.querySelector("cylindo-viewer");if(!e){"true"===localStorage.getItem("DEBUG")&&console.error("viewer not found");return}e.features=n},[n]),(0,h.KS)(()=>{let e=document.querySelector("cylindo-viewer");if(!e){"true"===localStorage.getItem("DEBUG")&&console.error("viewer not found");return}let t={"qr.alt":s("QRCode"),"qr.requirements.key":s("QRMinimumRequirements"),"qr.requirements.value":s("QRRequirementsContent"),"qr.usage":s("QRUsageExplanation"),exitFullScreen:s("ExitFullScreen"),fullScreen:s("FullScreen"),next:"Next",previous:"Previous",show360:s("Show360"),show3D:s("Show3D"),viewInAR:s("ViewInAR"),zoomIn:s("ZoomIn"),zoomOut:s("ZoomOut")};e.locales={...e.locales,[o]:t}},100),(0,a.useLayoutEffect)(()=>{var e;let t=document.querySelector("cylindo-viewer");if(!t){"true"===localStorage.getItem("DEBUG")&&console.error("viewer not found");return}let r=null===(e=t.shadowRoot)||void 0===e?void 0:e.querySelector(".button-group");r&&(r.style.top=d?"5rem":"1rem")},[d]),(0,l.jsx)(l.Fragment,{children:(0,l.jsxs)("div",{className:"relative grid w-full h-full bg-[#e2e2e2]",children:[(0,l.jsx)("cylindo-viewer",{"customer-id":"6199",code:r,lang:o,class:(0,u.Z)("w-full h-[70%] lg:h-full rs:h-[55%]",y().root)}),d&&(0,l.jsx)(N,{}),(0,l.jsx)(S,{}),i.pathname.includes("range-screen")&&(0,l.jsx)(C.Z,{className:y().logo})]})})};var T=r(88767),L=r(2210);let P=e=>{let t={};for(let r in e)null!==e[r]&&void 0!==e[r]&&""!==e[r]&&(t[r]=e[r]);return t},O=(e,t)=>{let{locale:r="en"}=(0,g.useRouter)(),l=P({cultureCode:r,page:1,resultsPerPage:100,sortOrderType:"Ascending",...e});return(0,T.useQuery)({queryFn:()=>L.y.bcCabinetsCreate(l,{headers:{"X-CultureCode":r}}).then(e=>e.data),queryKey:["useCabinets",l],staleTime:3e5,...t})},I=(e,t)=>{let{optionType:r}=e,[{designName:l,width:n,depth:a,height:i}]=j(),o={optionType:r};return"DesignColor"===r||("Width"===r?o.designName=l:"Height"===r?(o.designName=l,o.width=n):"Depth"===r?(o.designName=l,o.width=n,o.height=i):"Opening"===r&&(o.designName=l,o.width=n,o.height=i,o.depth=a)),O(o,t)},E=()=>{var e;let t=I({optionType:"Opening"});return{availableOptions:null==t?void 0:null===(e=t.data)||void 0===e?void 0:e.options}},B=(e,t,r,l)=>{if(r&&t)return R(r,!!l).filter(e=>e.sku===t).map(t=>{let{sku:r,requiredQuantity:l}=t;return{sku:r,quantity:l,type:e}})},R=(e,t)=>{if(!t)return e;let r=e.find(e=>{let{suboptions:t}=e;return!!(null==t?void 0:t.length)}),l=null==r?void 0:r.suboptions;return l?l.map(e=>({...e,requiredQuantity:null==r?void 0:r.requiredQuantity})):(console.error("No suboptions in expected door option object"),[])},H=(e,t)=>{let{locale:r="en"}=(0,g.useRouter)(),l={cultureCode:r,...e};return(0,T.useQuery)({queryFn:()=>L.y.bcFittingsCreate(l,{headers:{"X-CultureCode":r}}),queryKey:["bcFittings",l],staleTime:3e5,...t})},F=e=>{var t,r;let[{openingOrHingeSku:l,hinges:n}]=j(),{availableOptions:a}=E(),i=B("Design",l,a,!!n),o=H({optionType:"Handles",colorName:e,sku:l,selectedProducts:i});return{availableOptions:null==o?void 0:null===(r=o.data)||void 0===r?void 0:null===(t=r.data)||void 0===t?void 0:t.options}},z=()=>{var e,t;let[{openingOrHingeSku:r,handles:l,hinges:n}]=j(),{availableOptions:a}=E(),{availableOptions:i}=F(),o=B("Design",r,n?null==a?void 0:a.map(e=>"Door"===e.name?{...e,sku:n}:e):a),s=B("Handle",l,i),d=H({optionType:"Sink",sku:r,selectedProducts:[...null!=o?o:[],...null!=s?s:[]]});return{availableOptions:null==d?void 0:null===(t=d.data)||void 0===t?void 0:null===(e=t.data)||void 0===e?void 0:e.options}},M=()=>{var e,t,r,l;let[{openingOrHingeSku:n,handles:a,sink:i,hinges:o}]=j(),{availableOptions:s}=E(),{availableOptions:d}=F(),{availableOptions:c}=z(),u=B("Design",n,o?null==s?void 0:s.map(e=>"Door"===e.name?{...e,sku:o}:e):s),x=B("Sink",i,c),h=B("Handle",a,d),p=H({optionType:"Tap",sku:n,selectedProducts:[...null!=u?u:[],...null!=x?x:[],...null!=h?h:[]]});return{availableOptions:null==p?void 0:null===(t=p.data)||void 0===t?void 0:null===(e=t.data)||void 0===e?void 0:e.options,bathConfigurationId:null===(l=p.data)||void 0===l?void 0:null===(r=l.data)||void 0===r?void 0:r.bathConfigurationId}},q=()=>{var e,t;let[{openingOrHingeSku:r,handles:l,sink:n,taps:a,hinges:i}]=j(),{availableOptions:o}=E(),{availableOptions:s}=F(),{availableOptions:d}=z(),{availableOptions:c}=M(),u=B("Design",r,i?null==o?void 0:o.map(e=>"Door"===e.name?{...e,sku:i}:e):o),x=B("Sink",n,d),h=B("Handle",l,s),p=B("Tap",a,c),v=H({optionType:"Drain",sku:r,selectedProducts:[...null!=u?u:[],...null!=x?x:[],...null!=h?h:[],...null!=p?p:[]]});return{availableOptions:null==v?void 0:null===(t=v.data)||void 0===t?void 0:null===(e=t.data)||void 0===e?void 0:e.options}},V=e=>{let{setActiveStep:t}=e,[{designName:r}]=j();(0,a.useEffect)(()=>{r||t(1)},[r])},A=e=>{let{activeStep:t}=e,[r,l]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{l(!1)},[t]),{missingRequiredFieldsError:r,setMissingRequiredFieldsError:l}},Z=(0,a.createContext)({}),G=e=>{let{children:t}=e,[r,n]=(0,a.useState)(1),[i,o]=(0,a.useState)(),[s,d]=(0,a.useState)(0);V({setActiveStep:n});let c=A({activeStep:r,bathConfiguratorUserChoice:i});return(0,l.jsx)(Z.Provider,{value:{activeStep:r,setActiveStep:n,bathConfiguratorUserChoice:i,setBathConfiguratorUserChoice:o,nextButton:c,totalPrice:s,setTotalPrice:d},children:t})},W=()=>{let e=(0,a.useContext)(Z);if(!e)throw Error("useBathConfiguratorContext must be used within BathConfiguratorContextProvider");return e},$=()=>{let[{designName:e,depth:t,height:r,width:l,drains:n,handles:a,opening:i,sink:o,taps:s}]=j();return e&&l?r?t?i?a||o?o?s?n&&"OFF"!==n?"Drain":"Tap":"Sink":"Handles":"Opening":"Depth":"Height":"Width":"DesignColor"},Y=e=>{var t;return null==e?void 0:null===(t=e.cylindoFeatures)||void 0===t?void 0:t.reduce((e,t)=>{if(t.code){var r,l;e[t.code.toUpperCase()]=null===(l=t.options)||void 0===l?void 0:null===(r=l[0])||void 0===r?void 0:r.code}return e},{})},U=()=>{var e;let[{designName:t}]=j(),{data:r}=I({optionType:"DesignColor"}),{setTotalPrice:n}=W(),i=null==r?void 0:null===(e=r.options)||void 0===e?void 0:e.find(e=>e.name===t);(0,a.useEffect)(()=>{(null==i?void 0:i.totalPrice)&&n(null==i?void 0:i.totalPrice)},[i]);let o=Y(i);return(0,l.jsx)(D,{code:null==i?void 0:i.cylindoProduct,features:o})},X=()=>{var e;let[{width:t}]=j(),{data:r}=I({optionType:"Width"}),{setTotalPrice:n}=W(),i=null==r?void 0:null===(e=r.options)||void 0===e?void 0:e.find(e=>e.name===t),o=Y(i);return(0,a.useEffect)(()=>{(null==i?void 0:i.totalPrice)&&n(null==i?void 0:i.totalPrice)},[i]),(0,l.jsx)(D,{code:null==i?void 0:i.cylindoProduct,features:o})},Q=()=>{var e;let[{height:t}]=j(),{data:r}=I({optionType:"Height"}),{setTotalPrice:n}=W(),i=null==r?void 0:null===(e=r.options)||void 0===e?void 0:e.find(e=>e.name===t),o=Y(i);return(0,a.useEffect)(()=>{(null==i?void 0:i.totalPrice)&&n(null==i?void 0:i.totalPrice)},[i]),(0,l.jsx)(D,{code:null==i?void 0:i.cylindoProduct,features:o})},K=()=>{var e;let[{depth:t}]=j(),{data:r}=I({optionType:"Depth"}),{setTotalPrice:n}=W(),i=null==r?void 0:null===(e=r.options)||void 0===e?void 0:e.find(e=>e.name===t),o=Y(i);return(0,a.useEffect)(()=>{(null==i?void 0:i.totalPrice)&&n(null==i?void 0:i.totalPrice)},[i]),(0,l.jsx)(D,{code:null==i?void 0:i.cylindoProduct,features:o})},J=()=>{let[{opening:e}]=j(),{availableOptions:t}=E(),{setTotalPrice:r}=W(),n=null==t?void 0:t.find(t=>t.sku===e),i=Y(n);return(0,a.useEffect)(()=>{(null==n?void 0:n.totalPrice)&&r(null==n?void 0:n.totalPrice)},[n]),(0,l.jsx)(D,{code:null==n?void 0:n.cylindoProduct,features:i})},ee=()=>{let[{handles:e}]=j(),{availableOptions:t}=F(),{setTotalPrice:r}=W(),n=null==t?void 0:t.find(t=>t.sku===e),i=Y(n),o=null==n?void 0:n.cylindoProduct;return(0,a.useEffect)(()=>{(null==n?void 0:n.totalPrice)&&r(null==n?void 0:n.totalPrice)},[n]),(0,l.jsx)(D,{code:o,features:i})},et=()=>{let[{sink:e}]=j(),{availableOptions:t}=z(),{setTotalPrice:r}=W(),n=null==t?void 0:t.find(t=>t.sku===e),i=Y(n),o=null==n?void 0:n.cylindoProduct;return(0,a.useEffect)(()=>{(null==n?void 0:n.totalPrice)&&r(null==n?void 0:n.totalPrice)},[n]),(0,l.jsx)(D,{code:o,features:i})},er=()=>{let[{taps:e}]=j(),{availableOptions:t}=M(),{setTotalPrice:r}=W(),n=null==t?void 0:t.find(t=>t.sku===e),i=Y(n),o=null==n?void 0:n.cylindoProduct;return(0,a.useEffect)(()=>{(null==n?void 0:n.totalPrice)&&r(null==n?void 0:n.totalPrice)},[n]),(0,l.jsx)(D,{code:o,features:i})},el=()=>{let[{drains:e}]=j(),{availableOptions:t}=q(),{setTotalPrice:r}=W(),n=null==t?void 0:t.find(t=>t.sku===e),i=Y(n),o=null==n?void 0:n.cylindoProduct;return(0,a.useEffect)(()=>{(null==n?void 0:n.totalPrice)&&r(null==n?void 0:n.totalPrice)},[n]),(0,l.jsx)(D,{code:o,features:i})},en=()=>{let e=$();return(0,l.jsxs)(l.Fragment,{children:["DesignColor"===e&&(0,l.jsx)(U,{}),"Width"===e&&(0,l.jsx)(X,{}),"Height"===e&&(0,l.jsx)(Q,{}),"Depth"===e&&(0,l.jsx)(K,{}),"Opening"===e&&(0,l.jsx)(J,{}),"Handles"===e&&(0,l.jsx)(ee,{}),"Sink"===e&&(0,l.jsx)(et,{}),"Tap"===e&&(0,l.jsx)(er,{}),"Drain"===e&&(0,l.jsx)(el,{})]})};var ea=r(8667);let ei=(e,t)=>{let r=null==t?void 0:t.map(e=>{var t;let r=null==e?void 0:e.code,l=null==e?void 0:null===(t=e.options)||void 0===t?void 0:t.map(e=>null==e?void 0:e.code);return"feature=".concat(r,":").concat(null==l?void 0:l[0],"&")}).join("");return"https://content.cylindo.com/api/v2/6199/products/".concat(e,"/frames/1/?").concat(r,"encoding=png")};var eo=r(77280),es=r.n(eo),ed=r(44574),ec=r(27377),eu=r(9931);let ex=()=>(0,eu.Vi)();var eh=(0,a.forwardRef)((e,t)=>(0,l.jsxs)("svg",{"data-testid":"svg-no-content",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 119 120",fill:"none",ref:t,...e,children:[(0,l.jsx)("path",{d:"M118 60C118 92.5927 91.8008 119 59.5 119C27.1992 119 1 92.5927 1 60C1 27.4073 27.1992 1 59.5 1C91.8008 1 118 27.4073 118 60Z",stroke:"#D0D0D0",strokeWidth:"2"}),(0,l.jsx)("line",{y1:"-1",x2:"118.051",y2:"-1",transform:"matrix(0.684706 0.728819 -0.723072 0.690772 17.9623 18.1118)",stroke:"#D0D0D0",strokeWidth:"2"})]}));let ep=e=>"OFF"===e;var ev=r(86419);let em=e=>{let{title:t,content:r,classes:n,contentProps:a}=e;return(0,l.jsxs)(ev.fC,{children:[(0,l.jsx)(ev.xz,{asChild:!0,children:(0,l.jsx)("button",{className:"border rounded border-gray-tint border-solid text-gray-tint pt-1 px-2 pb-[1px] text-[0.8125rem] w-fit ".concat(n),children:"?"})}),(0,l.jsx)(ev.h_,{children:(0,l.jsxs)(ev.VY,{className:"z-[2000]",...a,children:[(0,l.jsxs)("div",{className:"relative px-4 py-6 bg-white rounded shadow-md min-w-52 h-fit",children:[(0,l.jsx)(ed.x,{type:"h6",className:"mb-8 mt-9",children:t}),r]}),(0,l.jsx)(ev.x8,{asChild:!0,children:(0,l.jsx)(w.Z,{className:"absolute top-6 right-6 cursor-pointer"})}),(0,l.jsx)(ev.Eh,{className:"fill-white"})]})})]})};var eg=r(32559),ef=r(3498),ej=r(66838),eb=r(25675),ey=r.n(eb);let eC=e=>{let{encoding:t="png",...r}=e,n=(0,a.useCallback)(e=>{let{src:r,width:l}=e,n=[];return n.push("encoding=".concat(t)),l&&n.push("size=".concat(l)),"".concat(r,"&").concat(n.join("&"))},[t]);return(0,l.jsx)(ey(),{loader:n,...r})};var e_=r(85068),ew=r(86607);let ek=e=>{let{price:t}=e;return(0,l.jsx)(ed.x,{variant:"h4",children:(0,l.jsx)(ec.tA,{price:String(t)})})},eN=e=>{let{className:t,isActive:r,...n}=e;return(0,l.jsx)("div",{className:(0,u.Z)(es().productCardContainer,{[es().activeCard]:r},t),...n})},eS=e=>{let{labels:t,tooltipContent:r}=e,{isMobile:n}=(0,eg.Mq)(),[i,o]=(0,a.useState)(!1),s=e=>(0,l.jsxs)(l.Fragment,{children:[e&&(0,l.jsx)(ed.x,{type:"h6",className:"mb-8",children:t.header}),(0,l.jsxs)(ed.x,{type:"p",children:[t.colorLabel,": ",r.colorName]}),r.look&&(0,l.jsxs)(ed.x,{type:"p",children:[t.lookLabel,": ",r.look]}),r.material&&(0,l.jsxs)(ed.x,{type:"p",children:[t.materialLabel,": ",r.material]})]});return n?(0,l.jsx)(ef.dy,{isOpen:i,setOpen:o,trigger:(0,l.jsx)("button",{className:"border rounded border-gray-tint border-solid text-gray-tint pt-1 px-2 pb-[1px] text-[0.8125rem] w-fit absolute top-2 right-2",children:"?"}),isFullScreen:!0,children:s(!0)}):(0,l.jsx)(em,{title:t.header,classes:"absolute top-2 right-2",contentProps:{onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation()},content:s(!1)})},eD=e=>{let{stepName:t,children:r,className:n}=e,{t:a}=(0,k.$G)("bathConfigurator");return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:(0,u.Z)(es().noContentSvgContainer,n),children:(0,l.jsx)(eh,{})}),(0,l.jsx)(ed.x,{variant:"h4",children:r||t&&(e=>{switch(e){case"handles":return a("NoHandle");case"taps":return a("NoTap");case"drains":return a("NoDrains");default:return"something went wrong"}})(t)})]})};var eT=e=>{var t;let{price:r,productName:n,isActive:a,onClick:i,tooltipContent:o,imageData:s,stepName:d,sku:c,isAvailableForSelling:u}=e,x=ep(c),{tooltipLabels:h}=ex(),{t:p}=(0,k.$G)("bathConfigurator"),{isFeatureEnabled:v}=(0,ew.d)(),m="Door"===n?p("Door"):"Drawer"===n?p("Drawer"):n,g=(null===(t=s.url)||void 0===t?void 0:t.includes("cylindo"))?eC:e_.C,f=v("CommerceBathConfigCheckout")&&!1===u;return(0,l.jsxs)(eN,{isActive:a,onClick:i,children:[o&&!x&&(0,l.jsx)(eS,{labels:h,tooltipContent:o}),x?(0,l.jsx)(eD,{stepName:d}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:"relative aspect-square mb-xs w-full",children:(0,l.jsx)(g,{alt:s.alt,src:s.url,width:150,height:150,className:"object-cover"})}),(0,l.jsx)(ed.x,{variant:"h4",children:m}),void 0!==r&&(0,l.jsx)(ek,{price:r}),f?(0,l.jsx)(ej.h,{}):(0,l.jsx)(ed.x,{variant:"xSmall",children:p("PlusShippingCosts")})]})]})},eL=e=>{let{availableOptions:t,setValue:r,selectedProduct:n,stepName:a,saveValueType:i="name",disableCylindoImage:o}=e;return(0,l.jsx)(l.Fragment,{children:t&&t.map(e=>{var t;let s=e.cylindoProduct,d={url:o?e.imageUrl:ei(s,e.cylindoFeatures),alt:null!=s?s:""},c="name"===i?e.name:e.sku;return(0,l.jsx)(eT,{imageData:d,price:null===(t=e.prices)||void 0===t?void 0:t.priceInclTax,productName:e.name,onClick:()=>r("".concat(a),null!=c?c:""),isActive:c===n,stepName:a,sku:e.sku,tooltipContent:e.optionInfo,isAvailableForSelling:e.isAvailableForSelling},e.name)})})},eP=r(86669),eO=r(26549),eI=r.n(eO);let eE=e=>{let{children:t}=e;return(0,l.jsx)("div",{className:"text text-h4 mb-2 rs:font-bold",children:t})},eB=e=>{let{children:t}=e;return(0,l.jsx)("div",{className:"grid gap-sm grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-2 rs:grid-cols-4",children:t})},eR=()=>{let[{designName:e},t]=j(),{t:r}=(0,k.$G)("bathConfigurator"),{data:n}=I({optionType:"DesignColor"});return(null==n?void 0:n.options)?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(eE,{children:r("Design")}),(0,l.jsx)(eB,{children:(0,l.jsx)(eL,{selectedProduct:e,setValue:t,stepName:"designName",availableOptions:null==n?void 0:n.options})})]}):(0,l.jsx)("div",{className:"flex justify-center",children:(0,l.jsx)(eP.a,{className:eI().loader})})};var eH=r(55162),eF=r(31472),ez=r(10279),eM=r.n(ez);let eq=e=>{let{children:t,missingRequiredField:r}=e,{t:n}=(0,k.$G)("bathConfigurator");return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:"flex gap-2xs",children:t}),r&&(0,l.jsx)("p",{className:"text-warning-red text-2xs",children:n("Required")})]})},eV=e=>{let{active:t,children:r,disabled:n,onClick:a,missingRequiredField:i}=e;return(0,l.jsx)(eF.z,{className:(0,u.Z)(eM().button,{[eM().disabledButton]:n,[eM().selectedButton]:t,"!border-warning-red !bg-warning-background-red":i}),onClick:a,children:r})},eA=e=>{let t=Number(e)/10;return"".concat(t,"cm")},eZ=()=>{let{t:e}=(0,k.$G)("bathConfigurator"),{contactLink:t}=ex();return(0,l.jsx)(eH.r,{decoration:"arrow",href:t.url,children:e("ContactUs")})},eG=()=>{var e;let[{width:t},r]=j(),{data:n}=I({optionType:"Width"}),{nextButton:{missingRequiredFieldsError:a}}=W(),i=a&&!t;return(0,l.jsx)(eq,{missingRequiredField:i,children:null==n?void 0:null===(e=n.options)||void 0===e?void 0:e.map(e=>(0,l.jsx)(eV,{active:e.name===t,onClick:()=>{var t;return r("width",null!==(t=e.name)&&void 0!==t?t:"")},missingRequiredField:i,children:eA(e.name)},e.name))})},eW=()=>{var e,t;let[{width:r,height:n,designName:a},i]=j(),{data:o}=O({optionType:"Height",designName:a}),{data:s}=I({optionType:"Height"},{enabled:!!r}),d=null==s?void 0:null===(e=s.options)||void 0===e?void 0:e.map(e=>e.name),{nextButton:{missingRequiredFieldsError:c}}=W(),u=c&&!n;return(0,l.jsx)(eq,{missingRequiredField:u,children:null==o?void 0:null===(t=o.options)||void 0===t?void 0:t.map(e=>(0,l.jsx)(eV,{disabled:!r||!(null==d?void 0:d.includes(e.name)),active:e.name===n,onClick:()=>{var t;return i("height",null!==(t=e.name)&&void 0!==t?t:"")},missingRequiredField:u,children:eA(e.name)},e.name))})},e$=()=>{var e,t;let[{width:r,height:n,depth:a,designName:i},o]=j(),{data:s}=O({optionType:"Depth",designName:i}),{data:d}=I({optionType:"Depth"},{enabled:!!r&&!!n}),c=null==d?void 0:null===(e=d.options)||void 0===e?void 0:e.map(e=>e.name),{nextButton:{missingRequiredFieldsError:u}}=W(),x=u&&!a;return(0,l.jsx)(eq,{missingRequiredField:x,children:null==s?void 0:null===(t=s.options)||void 0===t?void 0:t.map(e=>(0,l.jsx)(eV,{disabled:!n||!(null==c?void 0:c.includes(e.name)),active:e.name===a,onClick:()=>{var t;return o("depth",null!==(t=e.name)&&void 0!==t?t:"")},missingRequiredField:x,children:eA(e.name)},e.name))})},eY=()=>{let e=(0,x.b)(),{t}=(0,k.$G)("bathConfigurator");return(0,l.jsxs)("div",{className:"flex flex-col gap-sm",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2xs",children:[(0,l.jsx)(ed.x,{variant:"small",children:t("SelectWidth")}),(0,l.jsx)(eG,{})]}),(0,l.jsxs)("div",{className:"flex flex-col gap-2xs",children:[(0,l.jsx)(ed.x,{variant:"small",children:t("SelectHeight")}),(0,l.jsx)(eW,{})]}),(0,l.jsxs)("div",{className:"flex flex-col gap-2xs",children:[(0,l.jsx)(ed.x,{variant:"small",children:t("SelectDepth")}),(0,l.jsx)(e$,{})]}),(0,l.jsx)(ed.x,{variant:"small",children:t("DoubleSinkDescription")}),(0,l.jsxs)("div",{className:"flex flex-col",children:[(0,l.jsx)(ed.x,{variant:"small",children:t("RightSizeHint")}),!e&&(0,l.jsx)(eZ,{})]})]})};var eU=r(32837);let eX=!eU.XK,eQ=()=>{var e,t;let[{opening:r,hinges:n,openingOrHingeSku:i},o]=j(),{t:s}=(0,k.$G)("bathConfigurator"),d=(0,a.useRef)(null),{availableOptions:c}=E(),u=eK(null!=c?c:[]),x=u.map(e=>"Door"===e.name?{...e,sku:i}:e).find(e=>e.sku===i),h=null==x?void 0:x.suboptions,p=(0,a.useRef)(!0),v=(null===(t=u.filter(e=>e.sku===r))||void 0===t?void 0:null===(e=t[0])||void 0===e?void 0:e.name)==="Door";return((0,a.useEffect)(()=>{eX&&(null==h?void 0:h.length)&&!n&&o("hinges",h[0].sku)},[h,n,r]),(0,a.useLayoutEffect)(()=>{h&&p.current&&(requestAnimationFrame(()=>{var e;null===(e=d.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"start"})}),p.current=!1),h||(p.current=!0)},[h,r]),c)?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(eE,{children:s("DrawersOrDoors")}),(0,l.jsx)(eB,{children:(0,l.jsx)(eL,{selectedProduct:r,setValue:o,stepName:"opening",availableOptions:u,saveValueType:"sku"})}),(null==h?void 0:h.length)&&eX&&v&&(0,l.jsxs)("div",{className:"flex flex-col gap-2xs mb-xl mt-2",ref:d,children:[(0,l.jsx)(ed.x,{variant:"small",children:s("SelectHingeSide")}),(0,l.jsx)(eJ,{options:h})]})]}):(0,l.jsx)("div",{className:"flex justify-center",children:(0,l.jsx)(eP.a,{className:eI().loader})})},eK=e=>e.filter(e=>!!e.sku&&(!e.suboptions||e.suboptions.every(e=>!!e.sku))),eJ=e=>{let{options:t}=e,[{hinges:r},n]=j(),{t:a}=(0,k.$G)("bathConfigurator"),i=e=>{n("hinges",e)},o=e=>"Left"===e?a("LeftHandSide"):"Right"===e?a("RightHandSide"):e;return(0,l.jsx)(eq,{children:[...t].reverse().map(e=>(0,l.jsx)(eV,{active:e.sku===r,onClick:()=>i(e.sku),children:o(e.name)},e.name))})},e0=()=>{var e,t,r;let[{openingOrHingeSku:l,hinges:n}]=j(),{availableOptions:a}=E(),i=B("Design",l,a,!!n),o=H({optionType:"Handles",sku:l,selectedProducts:i});return{colorDots:null==o?void 0:null===(r=o.data)||void 0===r?void 0:null===(t=r.data)||void 0===t?void 0:null===(e=t.filters)||void 0===e?void 0:e.colors}};var e1=r(43220);let e5=()=>{let{availableOptions:e}=E(),[{openingOrHingeSku:t,hinges:r}]=j(),l=null==e?void 0:e.map(e=>"Door"===e.name?{...e,sku:r}:e).find(e=>e.sku===t);return null==l?void 0:l.integratedHandles};var e2=r(29876);let e9=()=>{let[e,t]=(0,a.useState)(),[{handles:r},n]=j(),{resetFilterText:i}=ex(),{t:o}=(0,k.$G)("bathConfigurator"),s=e5(),{colorDots:d}=e0(),{availableOptions:c}=F(e);return d&&c?(0,l.jsxs)(l.Fragment,{children:[!s&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex justify-between mb-2xs",children:[(0,l.jsx)(eE,{children:o("FilterByColor")}),(0,l.jsx)(e1.z,{className:eI().resetButton,color:"white",size:"xSmall",onClick:()=>t(""),children:i})]}),(0,l.jsx)(e2.m,{colors:d,getColor:e=>{var t;return null!==(t=e.value)&&void 0!==t?t:""},getName:e=>{var t;return null!==(t=e.name)&&void 0!==t?t:""},getUniqueId:e=>{var t;return null!==(t=e.name)&&void 0!==t?t:""},isActive:t=>t.name===e,onClick:e=>{var r;return t(null!==(r=e.name)&&void 0!==r?r:"")},maxDotsVisibleInitially:8,dotSize:"L"})]}),(0,l.jsx)(eE,{children:o("Handles")}),s?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(eB,{children:(0,l.jsxs)(eN,{isActive:!0,children:[(0,l.jsx)(eD,{children:o("IntegratedHandles")}),(0,l.jsx)(ek,{price:0})]})}),(0,l.jsx)(ed.x,{variant:"small",children:o("IntegratedHandlesDescription")})]}):(0,l.jsx)(eB,{children:(0,l.jsx)(eL,{selectedProduct:r,setValue:n,stepName:"handles",availableOptions:c,saveValueType:"sku",disableCylindoImage:!0})})]}):(0,l.jsx)("div",{className:"flex justify-center",children:(0,l.jsx)(eP.a,{className:eI().loader})})},e6=()=>{let[{sink:e},t]=j(),{t:r}=(0,k.$G)("bathConfigurator"),{availableOptions:n}=z();return n?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(eE,{children:r("Sink")}),(0,l.jsx)(eB,{children:(0,l.jsx)(eL,{selectedProduct:e,setValue:t,stepName:"sink",availableOptions:n,saveValueType:"sku",disableCylindoImage:!0})})]}):(0,l.jsx)("div",{className:"flex justify-center",children:(0,l.jsx)(eP.a,{className:eI().loader})})},e4=()=>{let e=(0,x.b)(),[{taps:t,drains:r},n]=j(),{t:a}=(0,k.$G)("bathConfigurator"),{availableOptions:i}=M(),{availableOptions:o}=q();return i?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(eE,{children:a("Tap")}),(0,l.jsx)(eB,{children:(0,l.jsx)(eL,{selectedProduct:t,setValue:n,stepName:"taps",availableOptions:i,saveValueType:"sku",disableCylindoImage:!0})}),(0,l.jsx)(ed.x,{variant:e?"h2":"small",children:a("Accessories")}),(0,l.jsx)(eB,{children:(0,l.jsx)(eL,{selectedProduct:r,setValue:n,stepName:"drains",availableOptions:o,saveValueType:"sku",disableCylindoImage:!0})})]}):(0,l.jsx)("div",{className:"flex justify-center",children:(0,l.jsx)(eP.a,{className:eI().loader})})};var e8=r(35284),e7=r(62469),e3=r(38574),te=r(53842),tt=r(11219),tr=r(8714);let tl=e=>e.filter(e=>{let{sku:t}=e;return!ep(t)}),tn=()=>{let[{opening:e,handles:t,sink:r,taps:l}]=j(),{availableOptions:n}=E(),{availableOptions:a}=F(),{availableOptions:i}=z(),{availableOptions:o}=M(),s=B("Design",e,n),d=B("Sink",r,i),c=B("Handle",t,a),u=B("Tap",l,o);return tl([...null!=s?s:[],...null!=d?d:[],...null!=c?c:[],...null!=u?u:[]])};var ta=r(65520);let ti=()=>{let{updateData:e}=(0,ta.K)(),{push:t,locale:r="en"}=(0,g.useRouter)();return(0,T.useMutation)({mutationFn:e=>{let{bathConfigurationId:t,products:l}=e;return L.y.bcBasketCreate({bathConfigurationId:t,products:l},{headers:{"x-CultureCode":r}})},onSuccess:r=>{e(r.data),t("/checkout")}})},to=e=>{let{locale:t="en"}=(0,g.useRouter)();return(0,T.useQuery)({queryKey:["bcSummaryDetail",e],queryFn:()=>{if(e)return L.y.bcSummaryDetail(e,{headers:{"x-CultureCode":t}}).then(e=>null==e?void 0:e.data)},enabled:!!e})},ts=()=>{let{t:e}=(0,k.$G)(),{setActiveStep:t,activeStep:r}=W();return(0,l.jsxs)("button",{className:"flex gap-2 items-center",onClick:()=>{t(r-1)},children:[(0,l.jsx)(e7.Y4O,{className:"size-4"}),e("Back")]})},td=()=>{var e,t,r;let{bathConfigurationId:n}=M(),{data:a}=to(null!=n?n:void 0),{t:i}=(0,k.$G)(),{mutate:o,isLoading:s,error:d}=ti(),c=null==d?void 0:null===(t=d.error)||void 0===t?void 0:null===(e=t.error)||void 0===e?void 0:e.message,u=tn();return(0,l.jsxs)("div",{className:"h-full flex flex-col gap-6",children:[(0,l.jsx)(ts,{}),(0,l.jsx)("div",{className:"text text-h3",children:i("OrderSummary")}),(0,l.jsxs)(e8.xn.Root,{children:[(0,l.jsx)(e8.xn.Item,{label:"Total",header:!0,children:(null==a?void 0:a.total)?(0,l.jsx)(ec.tA,{price:null==a?void 0:a.total}):"-"}),(0,l.jsx)(e8.xn.Item,{label:i("TotalExcludingVat"),color:"secondary",children:(0,l.jsx)(ec.tA,{price:4695})}),(0,l.jsx)(e8.xn.Item,{label:i("Vat"),color:"secondary",children:(0,l.jsx)(ec.tA,{price:1565})})]}),(0,l.jsx)(e3.i,{}),(0,l.jsxs)("div",{className:"flex-grow",children:[(0,l.jsx)(te.r,{children:(0,l.jsxs)(tt.Y,{children:[(0,l.jsx)("p",{className:"text text-preTitleSmall",children:i("BathConfigurator_DoItYourself")}),(0,l.jsx)("p",{className:"text text-small text-gray",children:i("BathConfigurator_DoItYourselfDetails")})]})}),(0,l.jsx)("div",{className:"text text-h4 mt-6",children:i("Products")}),null==a?void 0:null===(r=a.items)||void 0===r?void 0:r.map((e,t)=>(0,l.jsx)(tr.j,{primaryImage:e.primaryImage,productUrl:"#",productName:e.productName,quantity:e.quantity,shortDescription:e.shortDescription,total:e.priceInclVat,isReadOnly:!0},t))]}),(0,l.jsxs)("div",{className:"sticky -bottom-4 py-6 bg-white",children:[c&&(0,l.jsx)("p",{className:"text text-small text-warning-red mb-2",children:c}),(0,l.jsx)(e1.z,{fullwidth:!0,center:!0,color:"white",onClick:()=>{n&&o({bathConfigurationId:n,products:u})},loading:s,children:i("AddToCart")})]})]})},tc=()=>{let{activeStep:e}=W(),{isFeatureEnabled:t}=(0,ew.d)();return(0,l.jsxs)("div",{className:eI().stepHandlerContainer,children:[1===e&&(0,l.jsx)(eR,{}),2===e&&(0,l.jsx)(eY,{}),3===e&&(0,l.jsx)(eQ,{}),4===e&&(0,l.jsx)(e9,{}),5===e&&(0,l.jsx)(e6,{}),6===e&&(0,l.jsx)(e4,{}),7===e&&t("CommerceBathConfigCheckout")&&(0,l.jsx)(td,{})]})};var tu=r(88648);let tx=e=>{let{onConfim:t,...r}=e,{t:n}=(0,k.$G)();return(0,l.jsx)(tu.u,{title:n("BathConfigurator_ResetModal_Header"),...r,children:(0,l.jsxs)("div",{className:"flex flex-col",children:[(0,l.jsx)(ed.x,{variant:"body",className:"mb-sm",children:n("BathConfigurator_ResetModal_Text")}),(0,l.jsx)(e1.z,{color:"black",onClick:t,center:!0,children:n("BathConfigurator_ResetModal_Button")})]})})};var th=r(72334);let tp=e=>"/"===e[e.length-1]?e.slice(0,-1):e,tv=e=>{let{t}=(0,k.$G)(),[r,n]=(0,h.m9)(),{asPath:a}=(0,g.useRouter)(),{siteUrl:i}=(0,th.N)(),o=i?"".concat(tp(i)).concat(a):"";return(0,l.jsx)(tu.u,{title:t("BathConfigurator_ShareModal_Header"),...e,children:(0,l.jsxs)("div",{className:"flex flex-col overflow-hidden box-border",children:[(0,l.jsx)(ed.x,{variant:"body",className:"mb-sm",children:t("BathConfigurator_ShareModal_Text")}),(0,l.jsx)(ed.x,{variant:"body",color:"gray",className:"mb-sm break-words",children:o}),(0,l.jsx)(e1.z,{color:"black",onClick:()=>{n(o)},center:!0,children:t(r?"BathConfigurator_ShareModal_Copied":"BathConfigurator_ShareModal_Button")})]})})},tm=()=>{let{activeStep:e}=W(),[{designName:t,depth:r,height:l,width:n,opening:a,sink:i,handles:o}]=j(),s=e5();return 1===e?!!t:2===e?!!r&&!!l&&!!n:3===e?!!a:4===e?s||!!o:5!==e||!!i};var tg=(0,a.forwardRef)((e,t)=>(0,l.jsxs)("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:t,...e,children:[(0,l.jsxs)("g",{clipPath:"url(#clip0_901_152)",children:[(0,l.jsx)("path",{d:"M8 15.5C6.14348 15.5 4.36301 14.7625 3.05025 13.4497C1.7375 12.137 1 10.3565 1 8.5C1 6.64348 1.7375 4.86301 3.05025 3.55025C4.36301 2.2375 6.14348 1.5 8 1.5C9.85652 1.5 11.637 2.2375 12.9497 3.55025C14.2625 4.86301 15 6.64348 15 8.5C15 10.3565 14.2625 12.137 12.9497 13.4497C11.637 14.7625 9.85652 15.5 8 15.5ZM8 16.5C10.1217 16.5 12.1566 15.6571 13.6569 14.1569C15.1571 12.6566 16 10.6217 16 8.5C16 6.37827 15.1571 4.34344 13.6569 2.84315C12.1566 1.34285 10.1217 0.5 8 0.5C5.87827 0.5 3.84344 1.34285 2.34315 2.84315C0.842855 4.34344 0 6.37827 0 8.5C0 10.6217 0.842855 12.6566 2.34315 14.1569C3.84344 15.6571 5.87827 16.5 8 16.5Z",fill:"black"}),(0,l.jsx)("path",{d:"M8.92995 7.088L6.63995 7.375L6.55795 7.755L7.00795 7.838C7.30195 7.908 7.35995 8.014 7.29595 8.307L6.55795 11.775C6.36395 12.672 6.66295 13.094 7.36595 13.094C7.91095 13.094 8.54395 12.842 8.83095 12.496L8.91895 12.08C8.71895 12.256 8.42695 12.326 8.23295 12.326C7.95795 12.326 7.85795 12.133 7.92895 11.793L8.92995 7.088ZM8.99995 5C8.99995 5.26522 8.8946 5.51957 8.70706 5.70711C8.51952 5.89464 8.26517 6 7.99995 6C7.73474 6 7.48038 5.89464 7.29285 5.70711C7.10531 5.51957 6.99995 5.26522 6.99995 5C6.99995 4.73478 7.10531 4.48043 7.29285 4.29289C7.48038 4.10536 7.73474 4 7.99995 4C8.26517 4 8.51952 4.10536 8.70706 4.29289C8.8946 4.48043 8.99995 4.73478 8.99995 5Z",fill:"black"})]}),(0,l.jsx)("defs",{children:(0,l.jsx)("clipPath",{id:"clip0_901_152",children:(0,l.jsx)("rect",{width:"16",height:"16",fill:"white",transform:"translate(0 0.5)"})})})]})),tf=r(67296),tj=r(28169);let tb=()=>{var e,t;let[{openingOrHingeSku:r,handles:l,sink:n,taps:a,hinges:i,drains:o}]=j(),{availableOptions:s}=E(),{availableOptions:d}=F(),{availableOptions:c}=z(),{availableOptions:u}=M(),x=B("Design",r,i?null==s?void 0:s.map(e=>"Door"===e.name?{...e,sku:i}:e):s),h=B("Sink",n,c),p=B("Handle",l,d),v=B("Tap",a,u),m=[...null!=x?x:[],...n&&null!=h?h:[],...l&&null!=p?p:[],...a&&null!=v?v:[]],g="Handles";l?g="Handles":n?g="Sink":o&&(g="Drain");let f=H({optionType:g,sku:r,selectedProducts:m});return{bathConfigurationId:null==f?void 0:null===(t=f.data)||void 0===t?void 0:null===(e=t.data)||void 0===e?void 0:e.bathConfigurationId}};var ty=r(44988);let tC=e=>{var t;let{totalPrice:r}=W(),[n,i]=(0,a.useState)("1"),{t:o}=(0,k.$G)(),{bathConfigurationId:s}=tb(),{data:d,isLoading:c}=to(null!=s?s:void 0);return(0,l.jsx)(ef.dy,{width:375,padding:"54px 24px",...e,children:(0,l.jsxs)("div",{className:"pt-6 h-full overflow-y-auto thin-scrollbars",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)(ed.x,{variant:"preTitleSmall",children:o("Overview")}),(0,l.jsx)(ed.x,{variant:"preTitleLarge",children:o("YourDesign")})]}),(0,l.jsxs)(tj.fC,{value:n,onValueChange:i,children:[(0,l.jsxs)(tj.aV,{className:"w-full border-b border-solid border-gray-tint flex mb-6 mt-8 [&>button]:flex-1 [&>button]:text-xs",children:[(0,l.jsx)(tf.E,{value:"1",children:o("ProductList")}),(0,l.jsx)(tf.E,{value:"2",children:o("Delivery")})]}),(0,l.jsx)(tj.VY,{value:"1",children:d?(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"my-8",children:[(0,l.jsx)(ed.x,{variant:"h2",children:r}),(0,l.jsxs)(ed.x,{variant:"preTitle",children:[o("Total")," ",o("Price")]})]}),(0,l.jsx)("div",{children:null==d?void 0:null===(t=d.items)||void 0===t?void 0:t.map((e,t)=>(0,l.jsxs)("div",{className:"flex flex-col gap-2 border-t border-t-light-gray border-solid py-4",children:[(0,l.jsxs)("div",{className:"flex justify-between",children:[(0,l.jsx)(ed.x,{variant:"preTitle",children:e.productName}),e.priceInclVat&&e.quantity&&(0,l.jsx)(ed.x,{variant:"preTitle",children:e.priceInclVat*e.quantity})]}),(0,l.jsxs)("div",{className:"flex justify-between",children:[(0,l.jsx)("div",{children:o("PricePerItem")}),(0,l.jsx)("div",{children:e.priceInclVat})]}),(0,l.jsxs)("div",{className:"flex justify-between",children:[(0,l.jsx)("div",{children:o("Quantity")}),(0,l.jsx)("div",{children:e.quantity})]}),(0,l.jsxs)("div",{className:"flex gap-1",children:[(0,l.jsx)("div",{children:"SKU:"}),(0,l.jsx)("div",{children:e.sku})]})]},t))})]}):(0,l.jsx)("div",{className:"flex justify-center",children:c?(0,l.jsx)(ty.W,{width:40,height:40}):o("BathConfigurator_NoProductsTabContent")})}),(0,l.jsx)(tj.VY,{value:"2",children:(0,l.jsx)("div",{children:o("BathConfigurator_DeliveryTabContent")})})]})]})})},t_=e=>{let{isDisabled:t,...r}=e;return(0,l.jsx)("button",{className:(0,u.Z)("size-10 rs:size-32 rounded-full flex items-center justify-center",t?"bg-light-gray text-black":"bg-black text-white"),...r})},tw=()=>{let{setActiveStep:e}=W();return(0,l.jsx)(t_,{isDisabled:!0,onClick:()=>{e(e=>Math.max(e-1,1))},children:(0,l.jsx)(e7.wyc,{className:"size-5 rs:size-20"})})},tk=()=>{let{push:e}=(0,g.useRouter)(),{trackCustomEvent:t}=(0,ea.Nf)(),r=(0,x.b)(),{activeStep:n,setActiveStep:i,nextButton:o}=W(),s=tm(),{isFeatureEnabled:d}=(0,ew.d)(),{t:c}=(0,k.$G)(),[u,h]=(0,a.useState)(!1),[p,v]=(0,a.useState)(!1),m=6===n;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{onClick:()=>{if(!s){o.setMissingRequiredFieldsError(!0);return}if(m){r?h(!0):d("CommerceBathConfigCheckout")?i(n+1):v(!0);return}let e=sessionStorage.getItem("furthest_step")||"1";if(n<6){i(n+1);let r=e>n.toString()?e:n.toString();sessionStorage.setItem("furthest_step",r),t({tealium_event:"furthest_step",furthest_step:r})}},className:"flex gap-2 cursor-pointer",children:[(0,l.jsx)(t_,{isDisabled:!s,children:r&&m?(0,l.jsx)(e7.X5P,{className:"size-5 rs:size-20"}):m&&!d("CommerceBathConfigCheckout")?(0,l.jsx)(e7.rLr,{className:"size-5 rs:size-20"}):(0,l.jsx)(e7.XCv,{className:"size-5 rs:size-20"})}),(0,l.jsx)(ed.x,{className:"flex items-center rs:text-lg",children:c(r&&m?"Reset":m&&!d("CommerceBathConfigCheckout")?"Share":"Next")})]}),(0,l.jsx)(tx,{onConfim:()=>{e("/range-screen/bath-configurator")},open:u,onOpenChange:h}),(0,l.jsx)(tv,{open:p,onOpenChange:v})]})},tN=()=>{let{activeStep:e}=W();return(0,l.jsx)("div",{className:"flex space-x-2 rs:space-x-4 px-6 rs:px-12 pt-1 rs:pt-3",children:Array.from({length:6}).map((t,r)=>(0,l.jsx)("div",{className:"h-1 rs:h-3 flex-1 rounded-[60px] ".concat(r<e?"bg-black":"bg-light-gray")},r))})},tS=()=>{let{activeStep:e,totalPrice:t}=W(),[r,n]=(0,a.useState)(!1),{bathConfigurationId:i}=tb();return 7===e?null:(0,l.jsxs)("div",{className:"bg-white relative bottom-0 border-t border-solid border-light-gray shadow-top",children:[(0,l.jsx)(tN,{}),(0,l.jsx)(tC,{isOpen:r,setOpen:()=>n(!1)}),(0,l.jsxs)("div",{className:(0,u.Z)("flex items-center gap-2 rs:gap-4 px-6 rs:px-12 py-3 rs:py-6",0===t?"justify-end":"justify-between "),children:[0!==t&&(0,l.jsxs)("div",{className:"flex gap-[6px] rs:gap-3 rs:text-lg",children:[(0,l.jsx)(ec.tA,{price:t}),i&&!eU.XK&&(0,l.jsx)(tg,{className:"cursor-pointer rs:size-12 rs:mt-2",onClick:()=>n(!0)})]}),(0,l.jsxs)("div",{className:"flex gap-2",children:[e>1&&(0,l.jsx)(tw,{}),(0,l.jsx)(tk,{})]})]})]})};var tD=r(4298),tT=r.n(tD);let tL=()=>(0,l.jsx)(tT(),{src:"https://viewer-cdn.cylindo.com/v1/index.mjs",type:"module",strategy:"beforeInteractive",async:!0}),tP=()=>{let{trackCustomEvent:e}=(0,ea.Nf)(),t=!1;(0,a.useEffect)(()=>{let r;return t||(r=setTimeout(()=>{e({tealium_event:"bathConfigurator_started"}),t=!0},1e3)),()=>clearTimeout(r)},[])},tO=e=>{let{children:t}=e,r=(0,x.b)();return!(0,h.ac)("(min-width: 1024px)")||r?(0,l.jsx)(p,{minVh:22,maxVh:80,initialVh:50,handleHeight:r?80:40,draggableBarHeight:r?10:5,children:t}):(0,l.jsx)("div",{className:"overflow-y-auto h-full w-full flex-shrink-0 basis-[440px]",children:t})},tI=()=>{if((0,h.O_)())return(0,l.jsxs)("div",{className:"flex h-[100vh] flex-col lg:flex-row pt-[48px] md:pt-[97px] rs:pt-0",children:[(0,l.jsx)(en,{}),(0,l.jsx)(tO,{children:(0,l.jsxs)("div",{className:"relative h-full w-full flex flex-col",children:[(0,l.jsx)("div",{className:"mt-xs px-sm pb-4 flex-grow overflow-auto thin-scrollbars",children:(0,l.jsx)(tc,{})}),(0,l.jsx)(tS,{})]})})]})},tE=()=>(tP(),(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(tL,{}),(0,l.jsx)(G,{children:(0,l.jsx)(n.V9,{moduleIndex:1,moduleName:"BathConfigurator",children:(0,l.jsx)(tI,{})})})]}))},66838:function(e,t,r){"use strict";r.d(t,{I:function(){return T},h:function(){return w}});var l=r(85893),n=r(90512),a=r(67294),i=r(97930),o=r(44574),s=r(27377),d=r(31472),c=r(94342),u=r(60491),x=r(23455),h=r(82190),p=r(32559),v=r(43916),m=r(82487),g=r(73094),f=r.n(g),j=r(3166),b=r(25675),y=r.n(b),C=r(86607),_=r(53756);let w=()=>{let{t:e}=(0,_.$G)();return(0,l.jsx)("p",{className:"text text-xSmall text-warning-red",children:e("OutOfStock")})},k=e=>{let{src:t,width:r,quality:l=60}=e,n=t.indexOf("?")>-1;return"".concat(t).concat(n?"&":"?","width=").concat(r,"&upscale=true&crop=0&quality=").concat(l)};function N(e){let{primaryImage:t,secondaryImage:r,displayName:i,placeholderImage:o,isDoubleWidth:s}=e,[d,c]=(0,a.useState)(t),[u,x]=(0,a.useState)(r),[h,p]=(0,a.useState)(!1),v=!h,m="(min-width: 1920px) 450px, (min-width: 1024px) 25vw, (min-width: 768px) 50vw, ".concat(s?"100vw":"50vw");return(0,l.jsxs)("div",{children:[d&&(0,l.jsx)("div",{className:(0,n.Z)("opacity-100 transition-opacity ease-in-out duration-200",v&&"group-hover:opacity-0"),children:(0,l.jsx)(y(),{alt:i||"",fill:!0,loader:k,style:{objectFit:t?"scale-down":"cover"},sizes:m,src:t?d:o,onError:()=>c(o)})}),r&&v&&(0,l.jsx)("div",{className:"opacity-0 transition-opacity ease-in-out duration-200 group-hover:opacity-100",children:(0,l.jsx)(y(),{alt:i||"",fill:!0,loader:k,style:{objectFit:r?"scale-down":"cover"},sizes:m,src:r?u:o,onError:()=>{x(o),p(!0)}})})]})}let S=e=>{let{children:t}=e;return(0,l.jsx)(d.z,{className:"absolute bottom-0 left-[1.5rem] z-[1]",size:"small",color:"black",type:"inert",children:t})},D=()=>{};function T(e){var t,r,a,d,g,b;let y=(0,j.b)(),{onClickHandler:_}=(0,m.d)({onClick:D,type:"link",customProps:()=>({tealium_event:"link_click",link_click:"product"})}),k=!!((null===(t=e.prices)||void 0===t?void 0:t.discountInclTax)&&(null===(r=e.prices)||void 0===r?void 0:r.discountInclTax)>0),{isMobile:T}=(0,p.Mq)(),{isFeatureEnabled:L}=(0,C.d)(),P=L("CommerceCheckout"),O="37"===e.lifeCycle;return(0,l.jsx)(i.W,{padding:"none",className:(0,n.Z)("flex flex-col rounded cursor-pointer overflow-hidden bg-light-gray hover:bg-black group hover:border-black",f().root,{[f().seventh]:e.isDoubleWidth}),onClick:_,children:(0,l.jsxs)(u.s,{href:y?"/range-screen/products/".concat(e.variantFriendlyUrl):e.productLink?e.productLink:"/",children:[(0,l.jsxs)("div",{className:(0,n.Z)(f().imageWrapper,e.imageStyle,"relative"),children:[k&&(0,l.jsxs)(l.Fragment,{children:[!e.disableBubbleTag&&(0,l.jsx)(c.a,{type:"percentage",value:"",className:f().discountBubble}),(0,l.jsxs)(S,{children:[e.prices&&(null===(a=e.prices)||void 0===a?void 0:a.discountPercentage),"%"]})]}),(0,l.jsx)(N,{...e})]}),(0,l.jsxs)("div",{className:f().productInfo,children:[(0,l.jsx)("div",{children:O&&(0,l.jsx)(v.V,{children:e.outletLabel})}),(0,l.jsxs)("div",{className:"flex flex-col gap-3xs",children:[(0,l.jsx)(o.x,{variant:"body",className:f().displayName,children:null==e?void 0:e.displayName}),(0,l.jsx)(o.x,{variant:"xSmall",children:null==e?void 0:e.shortDescription})]}),(0,l.jsxs)("div",{className:(0,n.Z)(f().money,{[f().moneyWhenNoEnergyLabel]:!e.dataSheetLink}),children:[e.dataSheetLink&&(0,l.jsx)("div",{children:(0,l.jsx)("div",{className:(0,n.Z)(f().additionalInfo,{"!bottom-0":!k}),children:(0,l.jsxs)("div",{children:[(0,l.jsx)(u.s,{href:e.dataSheetLink,target:"_blank",children:(0,l.jsx)(o.x,{variant:"xSmall",className:f().productDataSheet,children:e.productDataSheetLabel})}),(()=>{let t=(0,x.p)(e.energyLabelScore,e.energyLabelCatalog);if(t)return(0,l.jsx)(h.b,{energyLabelSmallImageLink:t,className:"h-sm",energyLabelImageLink:e.energyLabelImageLink})})()]})})}),(0,l.jsxs)("div",{className:"flex flex-col gap-3xs",children:[(null==e?void 0:null===(d=e.prices)||void 0===d?void 0:d.priceInclTax)&&(0,l.jsx)(o.x,{className:f().price,children:(0,l.jsx)(s.tA,{price:null==e?void 0:null===(g=e.prices)||void 0===g?void 0:g.priceInclTax})}),k&&(0,l.jsx)(o.x,{variant:"small",className:"text-gray line-through",children:(0,l.jsx)(s.tA,{price:(null==e?void 0:null===(b=e.prices)||void 0===b?void 0:b.originalPriceInclTax)||""})})]}),(0,l.jsx)("div",{children:e.ecomProduct?e.stock&&e.stock>0||!P?(0,l.jsx)(o.x,{variant:"xSmall",className:f().inStock,children:e.inStockMessage}):(0,l.jsx)(w,{}):(0,l.jsx)(o.x,{variant:"xSmall",className:f().inStock,children:e.onlyInStoreLabel})})]}),!e.dataSheetLink&&!T&&!y&&(0,l.jsx)("div",{className:"h-0"})]})]})})}},82190:function(e,t,r){"use strict";r.d(t,{b:function(){return a}});var l=r(85893),n=r(60491);function a(e){return(0,l.jsx)("div",{children:e.energyLabelImageLink?(0,l.jsx)(n.s,{href:e.energyLabelImageLink,target:"_blank",children:(0,l.jsx)("img",{className:e.className,src:e.energyLabelSmallImageLink})}):(0,l.jsx)("img",{className:e.className,src:e.energyLabelSmallImageLink})})}},29876:function(e,t,r){"use strict";r.d(t,{m:function(){return p}});var l=r(85893),n=r(90512),a=r(60491),i=r(82487),o=r(66908);let s=e=>{let{children:t,content:r,placement:n="bottom"}=e;return(0,l.jsx)(o.zt,{children:(0,l.jsxs)(o.fC,{delayDuration:100,children:[(0,l.jsx)(o.xz,{asChild:!0,children:t}),(0,l.jsx)(o.h_,{children:(0,l.jsxs)(o.VY,{side:n,className:"rounded bg-white px-2 py-1 shadow-darker",sideOffset:5,children:[(0,l.jsx)("div",{className:"relative",children:r}),(0,l.jsx)(o.Eh,{className:"fill-white"})]})})]})})};var d=r(3166);let c=e=>Array.isArray(e)?e:[e],u={S:20,M:26,ML:34,L:48,XL:64,XXL:128},x=e=>{let{dotSize:t="ML",backgroundColor:r,children:o,active:x,onClick:h,borderOnHover:p,cursorPointer:v,dotClassName:m,link:g,name:f,label:j,onHover:b}=e,y=c(r),C=(0,d.b)(),{onClickHandler:_}=(0,i.d)({onClick:h,type:"button",customProps:()=>({tealium_event:"color_chooser",color_value:y[0],color_name:f})}),w=u[t];C&&(w*=2);let k=(0,l.jsx)("div",{"data-testid":"color-dot",onMouseOver:b,onClick:_,style:{width:w,height:w},className:(0,n.W)("rounded-[50%] relative flex justify-center items-center border border-solid",x?"border-gray":"border-transparent",p&&"hover:border-gray",v&&"cursor-pointer",m),children:(0,l.jsxs)("div",{className:"rounded-[50%] relative flex justify-center items-center border border-gray border-solid w-[75%] h-[75%] overflow-hidden",children:[(0,l.jsx)("div",{className:"w-full h-full flex rotate-45",children:y.map((e,t)=>(0,l.jsx)("div",{className:"flex-1 h-full -ml-px",style:{backgroundColor:e}},t))}),o&&(0,l.jsx)("div",{className:"absolute",style:{fontSize:w/3},children:o})]})}),N=j?(0,l.jsx)(s,{content:j,children:k}):k;return g?(0,l.jsx)(a.s,{href:g,children:N}):N};var h=r(67294);function p(e){let{colors:t,isActive:r,getColor:a,onClick:i,dotSize:o,header:s,maxDotsVisibleInitially:d,borderOnHover:c,cursorPointer:u,dotsContainerClassName:p,dotClassName:m,getLink:g,getName:f,getUniqueId:j,allColorsLabel:b,onSingleDotHover:y,onWrapperHover:C}=e,[_,w]=(0,h.useState)(!1),k=v(t,_,r,d),N=e=>{i&&i(e)},S=e=>{if(g)return g(e)},D=e=>{if(y)return y(e)};return(0,l.jsxs)("div",{className:"flex items-center gap-4",children:[s&&(0,l.jsx)("p",{className:"border-r border-gray border-solid pr-4 text-gray text-sm",children:s}),(0,l.jsxs)("div",{className:(0,n.W)("flex gap-1 flex-wrap",p),onMouseOver:C,children:[k.colors.map((e,t)=>(0,l.jsx)(x,{backgroundColor:a(e),active:r(e),onClick:()=>N(e),link:S(e),dotSize:o,borderOnHover:c,cursorPointer:u,dotClassName:m,name:f(e),label:f(e),onHover:()=>D(e)},j(e,t))),k.showMoreDots&&(0,l.jsx)(x,{backgroundColor:"#ffffff",dotSize:o,cursorPointer:!0,dotClassName:m,onClick:()=>w(!0),name:"show_all_colors",label:b,children:k.hiddenColors&&"+".concat(k.hiddenColors)})]})]})}let v=(e,t,r,l)=>{let n=e.findIndex(r)>(null!=l?l:0);return t||n||!l||l>=e.length?{colors:e,showMoreDots:!1,hiddenColors:0}:{showMoreDots:!0,colors:[...e].splice(0,l),hiddenColors:e.length-l}}},3498:function(e,t,r){"use strict";r.d(t,{dy:function(){return d},iI:function(){return c}});var l=r(85893),n=r(90512),a=r(12854),i=r(97802),o=r(22403),s=r.n(o);let d=e=>{let{children:t,isOpen:r,setOpen:o,trigger:d,isFullScreen:c,width:u=708,padding:x="76px 48px 48px"}=e;return(0,l.jsxs)(a.fC,{open:r,onOpenChange:o,children:[d&&(0,l.jsx)(a.xz,{asChild:!0,children:d}),(0,l.jsxs)(a.h_,{children:[(0,l.jsx)(a.aV,{className:s().DrawerOverlay}),(0,l.jsxs)(a.VY,{className:(0,n.Z)(s().DrawerContent,{[s().fullScreen]:c}),style:{"--drawerContentWidth":"".concat(u,"px"),"--drawerContentPadding":x},children:[t,(0,l.jsx)(a.x8,{asChild:!0,children:(0,l.jsx)("button",{className:(0,n.Z)(s().CloseButton,"rs:size-[64px]"),"aria-label":"Close",children:(0,l.jsx)(i.Z,{className:"rs:size-[64px]"})})})]})]})]})},c=e=>(0,l.jsx)(a.Dx,{...e})},11219:function(e,t,r){"use strict";r.d(t,{Y:function(){return a}});var l=r(85893),n=r(90512);let a=e=>{let{className:t,...r}=e;return(0,l.jsx)("div",{className:(0,n.Z)("p-6",t),...r})}},53842:function(e,t,r){"use strict";r.d(t,{r:function(){return a}});var l=r(85893),n=r(90512);let a=e=>{let{className:t,...r}=e;return(0,l.jsx)("div",{className:(0,n.Z)("bg-light-gray rounded border border-solid border-gray-tint",t),...r})}},43916:function(e,t,r){"use strict";r.d(t,{V:function(){return i}});var l=r(85893),n=r(67294),a=r(90512);let i=(0,n.forwardRef)((e,t)=>{let{className:r,...n}=e;return(0,l.jsx)("div",{ref:t,className:(0,a.Z)("inline-block rounded px-2 py-2 bg-yellow text-black text-md leading-none",r),...n})})},23455:function(e,t,r){"use strict";r.d(t,{p:function(){return l}});let l=(e,t)=>{var r,l,n,a,i,o,s,d,c,u,x,h,p,v;let m="";switch(e){case"A":(null==t?void 0:null===(r=t.energyLabelA)||void 0===r?void 0:r.markup)&&(m=null==t?void 0:null===(l=t.energyLabelA)||void 0===l?void 0:l.url);case"B":(null==t?void 0:null===(n=t.energyLabelB)||void 0===n?void 0:n.markup)&&(m=null==t?void 0:null===(a=t.energyLabelB)||void 0===a?void 0:a.url);case"C":(null==t?void 0:null===(i=t.energyLabelC)||void 0===i?void 0:i.markup)&&(m=null==t?void 0:null===(o=t.energyLabelC)||void 0===o?void 0:o.url);case"D":(null==t?void 0:null===(s=t.energyLabelD)||void 0===s?void 0:s.markup)&&(m=null==t?void 0:null===(d=t.energyLabelD)||void 0===d?void 0:d.url);case"E":(null==t?void 0:null===(c=t.energyLabelE)||void 0===c?void 0:c.markup)&&(m=null==t?void 0:null===(u=t.energyLabelE)||void 0===u?void 0:u.url);case"F":(null==t?void 0:null===(x=t.energyLabelF)||void 0===x?void 0:x.markup)&&(m=null==t?void 0:null===(h=t.energyLabelF)||void 0===h?void 0:h.url);case"G":(null==t?void 0:null===(p=t.energyLabelG)||void 0===p?void 0:p.markup)&&(m=null==t?void 0:null===(v=t.energyLabelG)||void 0===v?void 0:v.url)}if(m.length>0)return m}},94743:function(e){e.exports={root:"cylindo-viewer_root__HmgaX",price:"cylindo-viewer_price__LrdUU",logo:"cylindo-viewer_logo__a_HLs"}},77280:function(e){e.exports={productCardContainer:"product-card_productCardContainer__f45tC",noContentSvgContainer:"product-card_noContentSvgContainer__siO2H",activeCard:"product-card_activeCard__OLBwe",tooltipWrapper:"product-card_tooltipWrapper__tIbOG",tooltipButton:"product-card_tooltipButton__uwrK0"}},26549:function(e){e.exports={buttonContainer:"step-handler_buttonContainer__aOUwo",button:"step-handler_button__TR6kG",span:"step-handler_span__tzjka",resetButton:"step-handler_resetButton__QjqVg",text:"step-handler_text__nsLEk",stepHandlerContainer:"step-handler_stepHandlerContainer__KM99E",offContentIcon:"step-handler_offContentIcon__J94nb",productCardContainer:"step-handler_productCardContainer__0wDby",colorPicker:"step-handler_colorPicker__WDLo2",colorPickerItem:"step-handler_colorPickerItem__fZI3g",colorContainer:"step-handler_colorContainer__WvIkW",loader:"step-handler_loader__PtYjd"}},10279:function(e){e.exports={button:"options_button__SoipU",disabledButton:"options_disabledButton__odPw4",selectedButton:"options_selectedButton__bQCE_"}},93e3:function(e){e.exports={expandablePanel:"expandable-panel_expandablePanel__ehGI1",notDragged:"expandable-panel_notDragged__5evyL",contentWrapper:"expandable-panel_contentWrapper__IUHaj",draggableBar:"expandable-panel_draggableBar__SrlUo",dragged:"expandable-panel_dragged__A6Qxu",draggableBarHandle:"expandable-panel_draggableBarHandle__SsBzr"}},73094:function(e){e.exports={root:"product-card_root__OJjdT",imageWrapper:"product-card_imageWrapper__tSYcV",productInfo:"product-card_productInfo__SytXX",inStock:"product-card_inStock__BEU0L",discountBubble:"product-card_discountBubble__thZmC",displayName:"product-card_displayName__fRcA8",price:"product-card_price__Ac9v_",description:"product-card_description__npzKA",money:"product-card_money__bt08m",moneyWhenNoEnergyLabel:"product-card_moneyWhenNoEnergyLabel__3NvAf",seventh:"product-card_seventh__zmGf7",additionalInfo:"product-card_additionalInfo__pZZTJ"}},22403:function(e){e.exports={DrawerOverlay:"drawer_DrawerOverlay__p1tQv",drawerOverlayHide:"drawer_drawerOverlayHide__fje0G",drawerOverlayShow:"drawer_drawerOverlayShow__XIjx3",DrawerContent:"drawer_DrawerContent__7yAhn",drawerContentHide:"drawer_drawerContentHide__JLihf",drawerContentShow:"drawer_drawerContentShow__DR3N2",CloseButton:"drawer_CloseButton__cyMgY",fullScreen:"drawer_fullScreen__BzC67"}},66908:function(e,t,r){"use strict";r.d(t,{Eh:function(){return Y},VY:function(){return $},fC:function(){return Z},h_:function(){return W},xz:function(){return G},zt:function(){return A}});var l=r(67294),n=r(36206),a=r(28771),i=r(25360),o=r(46063),s=r(91276),d=r(53990),c=r(42651),u=r(29115),x=r(75320),h=r(88426),p=r(77342),v=r(96219),m=r(85893),[g,f]=(0,i.b)("Tooltip",[d.D7]),j=(0,d.D7)(),b="TooltipProvider",y="tooltip.open",[C,_]=g(b),w=e=>{let{__scopeTooltip:t,delayDuration:r=700,skipDelayDuration:n=300,disableHoverableContent:a=!1,children:i}=e,[o,s]=l.useState(!0),d=l.useRef(!1),c=l.useRef(0);return l.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,m.jsx)(C,{scope:t,isOpenDelayed:o,delayDuration:r,onOpen:l.useCallback(()=>{window.clearTimeout(c.current),s(!1)},[]),onClose:l.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>s(!0),n)},[n]),isPointerInTransitRef:d,onPointerInTransitChange:l.useCallback(e=>{d.current=e},[]),disableHoverableContent:a,children:i})};w.displayName=b;var k="Tooltip",[N,S]=g(k),D=e=>{let{__scopeTooltip:t,children:r,open:n,defaultOpen:a=!1,onOpenChange:i,disableHoverableContent:o,delayDuration:c}=e,u=_(k,e.__scopeTooltip),x=j(t),[h,v]=l.useState(null),g=(0,s.M)(),f=l.useRef(0),b=o??u.disableHoverableContent,C=c??u.delayDuration,w=l.useRef(!1),[S=!1,D]=(0,p.T)({prop:n,defaultProp:a,onChange:e=>{e?(u.onOpen(),document.dispatchEvent(new CustomEvent(y))):u.onClose(),i?.(e)}}),T=l.useMemo(()=>S?w.current?"delayed-open":"instant-open":"closed",[S]),L=l.useCallback(()=>{window.clearTimeout(f.current),w.current=!1,D(!0)},[D]),P=l.useCallback(()=>{window.clearTimeout(f.current),D(!1)},[D]),O=l.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>{w.current=!0,D(!0)},C)},[C,D]);return l.useEffect(()=>()=>window.clearTimeout(f.current),[]),(0,m.jsx)(d.fC,{...x,children:(0,m.jsx)(N,{scope:t,contentId:g,open:S,stateAttribute:T,trigger:h,onTriggerChange:v,onTriggerEnter:l.useCallback(()=>{u.isOpenDelayed?O():L()},[u.isOpenDelayed,O,L]),onTriggerLeave:l.useCallback(()=>{b?P():window.clearTimeout(f.current)},[P,b]),onOpen:L,onClose:P,disableHoverableContent:b,children:r})})};D.displayName=k;var T="TooltipTrigger",L=l.forwardRef((e,t)=>{let{__scopeTooltip:r,...i}=e,o=S(T,r),s=_(T,r),c=j(r),u=l.useRef(null),h=(0,a.e)(t,u,o.onTriggerChange),p=l.useRef(!1),v=l.useRef(!1),g=l.useCallback(()=>p.current=!1,[]);return l.useEffect(()=>()=>document.removeEventListener("pointerup",g),[g]),(0,m.jsx)(d.ee,{asChild:!0,...c,children:(0,m.jsx)(x.WV.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...i,ref:h,onPointerMove:(0,n.M)(e.onPointerMove,e=>{"touch"===e.pointerType||v.current||s.isPointerInTransitRef.current||(o.onTriggerEnter(),v.current=!0)}),onPointerLeave:(0,n.M)(e.onPointerLeave,()=>{o.onTriggerLeave(),v.current=!1}),onPointerDown:(0,n.M)(e.onPointerDown,()=>{p.current=!0,document.addEventListener("pointerup",g,{once:!0})}),onFocus:(0,n.M)(e.onFocus,()=>{p.current||o.onOpen()}),onBlur:(0,n.M)(e.onBlur,o.onClose),onClick:(0,n.M)(e.onClick,o.onClose)})})});L.displayName=T;var P="TooltipPortal",[O,I]=g(P,{forceMount:void 0}),E=e=>{let{__scopeTooltip:t,forceMount:r,children:l,container:n}=e,a=S(P,t);return(0,m.jsx)(O,{scope:t,forceMount:r,children:(0,m.jsx)(u.z,{present:r||a.open,children:(0,m.jsx)(c.h,{asChild:!0,container:n,children:l})})})};E.displayName=P;var B="TooltipContent",R=l.forwardRef((e,t)=>{let r=I(B,e.__scopeTooltip),{forceMount:l=r.forceMount,side:n="top",...a}=e,i=S(B,e.__scopeTooltip);return(0,m.jsx)(u.z,{present:l||i.open,children:i.disableHoverableContent?(0,m.jsx)(M,{side:n,...a,ref:t}):(0,m.jsx)(H,{side:n,...a,ref:t})})}),H=l.forwardRef((e,t)=>{let r=S(B,e.__scopeTooltip),n=_(B,e.__scopeTooltip),i=l.useRef(null),o=(0,a.e)(t,i),[s,d]=l.useState(null),{trigger:c,onClose:u}=r,x=i.current,{onPointerInTransitChange:h}=n,p=l.useCallback(()=>{d(null),h(!1)},[h]),v=l.useCallback((e,t)=>{let r=e.currentTarget,l={x:e.clientX,y:e.clientY},n=function(e,t){let r=Math.abs(t.top-e.y),l=Math.abs(t.bottom-e.y),n=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(r,l,n,a)){case a:return"left";case n:return"right";case r:return"top";case l:return"bottom";default:throw Error("unreachable")}}(l,r.getBoundingClientRect());d(function(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:e.y>t.y?1:0),function(e){if(e.length<=1)return e.slice();let t=[];for(let r=0;r<e.length;r++){let l=e[r];for(;t.length>=2;){let e=t[t.length-1],r=t[t.length-2];if((e.x-r.x)*(l.y-r.y)>=(e.y-r.y)*(l.x-r.x))t.pop();else break}t.push(l)}t.pop();let r=[];for(let t=e.length-1;t>=0;t--){let l=e[t];for(;r.length>=2;){let e=r[r.length-1],t=r[r.length-2];if((e.x-t.x)*(l.y-t.y)>=(e.y-t.y)*(l.x-t.x))r.pop();else break}r.push(l)}return(r.pop(),1===t.length&&1===r.length&&t[0].x===r[0].x&&t[0].y===r[0].y)?t:t.concat(r)}(t)}([...function(e,t,r=5){let l=[];switch(t){case"top":l.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":l.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":l.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":l.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r})}return l}(l,n),...function(e){let{top:t,right:r,bottom:l,left:n}=e;return[{x:n,y:t},{x:r,y:t},{x:r,y:l},{x:n,y:l}]}(t.getBoundingClientRect())])),h(!0)},[h]);return l.useEffect(()=>()=>p(),[p]),l.useEffect(()=>{if(c&&x){let e=e=>v(e,x),t=e=>v(e,c);return c.addEventListener("pointerleave",e),x.addEventListener("pointerleave",t),()=>{c.removeEventListener("pointerleave",e),x.removeEventListener("pointerleave",t)}}},[c,x,v,p]),l.useEffect(()=>{if(s){let e=e=>{let t=e.target,r={x:e.clientX,y:e.clientY},l=c?.contains(t)||x?.contains(t),n=!function(e,t){let{x:r,y:l}=e,n=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let i=t[e].x,o=t[e].y,s=t[a].x,d=t[a].y;o>l!=d>l&&r<(s-i)*(l-o)/(d-o)+i&&(n=!n)}return n}(r,s);l?p():n&&(p(),u())};return document.addEventListener("pointermove",e),()=>document.removeEventListener("pointermove",e)}},[c,x,s,u,p]),(0,m.jsx)(M,{...e,ref:o})}),[F,z]=g(k,{isInside:!1}),M=l.forwardRef((e,t)=>{let{__scopeTooltip:r,children:n,"aria-label":a,onEscapeKeyDown:i,onPointerDownOutside:s,...c}=e,u=S(B,r),x=j(r),{onClose:p}=u;return l.useEffect(()=>(document.addEventListener(y,p),()=>document.removeEventListener(y,p)),[p]),l.useEffect(()=>{if(u.trigger){let e=e=>{let t=e.target;t?.contains(u.trigger)&&p()};return window.addEventListener("scroll",e,{capture:!0}),()=>window.removeEventListener("scroll",e,{capture:!0})}},[u.trigger,p]),(0,m.jsx)(o.XB,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:p,children:(0,m.jsxs)(d.VY,{"data-state":u.stateAttribute,...x,...c,ref:t,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[(0,m.jsx)(h.A4,{children:n}),(0,m.jsx)(F,{scope:r,isInside:!0,children:(0,m.jsx)(v.f,{id:u.contentId,role:"tooltip",children:a||n})})]})})});R.displayName=B;var q="TooltipArrow",V=l.forwardRef((e,t)=>{let{__scopeTooltip:r,...l}=e,n=j(r);return z(q,r).isInside?null:(0,m.jsx)(d.Eh,{...n,...l,ref:t})});V.displayName=q;var A=w,Z=D,G=L,W=E,$=R,Y=V}}]);