"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[78],{36:(e,t,a)=>{a.d(t,{a:()=>s});const s={label:"CwfPhig_",cover:"JhHOuv6P"}},37:(e,t,a)=>{a.d(t,{a:()=>s});const s={wrapper:"X8MBwX7x",wrapperBadge:"WS4HAUEw"}},301:(e,t,a)=>{var s=a(0),r=a(2),n=a(1),i=a(16),c=a(63),o=function(e,t,a,s){return new(a||(a=Promise))((function(r,n){function i(e){try{o(s.next(e))}catch(e){n(e)}}function c(e){try{o(s.throw(e))}catch(e){n(e)}}function o(e){var t;e.done?r(e.value):(t=e.value,t instanceof a?t:new a((function(e){e(t)}))).then(i,c)}o((s=s.apply(e,t||[])).next())}))};const l=e=>(e/100).toFixed(2),p="a196748e9a91ab8425286d6cd7a439539c71f9c6",d=(e,t)=>{t(),(0,c.b)("loopReturn");const a=`https://returns.curvy.com.au/#/cart/v2/${e}`,s=document.createElement("a");s.setAttribute("href",a),document.body.appendChild(s),s.click(),s.remove()},u={loop_total:0,loop_return_id:""},{wrapper:g,wrapperOuter:h,wrapperOuterDelayMessage:m,wrapperImageContainer:j,wrapperProductContainer:f,wrapperProductName:w,wrapperProductSize:b,wrapperProductSizeContainer:y,wrapperProductSizeLabel:O,wrapperProductDiscount:x,wrapperProductDiscountItem:v,wrapperProductPrice:C,wrapperProductPriceContainer:N,wrapperProductPriceNew:S,wrapperProductPriceOld:P,wrapperProductIcons:T,wrapperProductCounter:_,wrapperProductCounterIcon:D,wrapperProductTrashButton:k,wrapperProductCounterQuantity:L}={wrapper:"TCqgcuSC",wrapperOuter:"mBIZo4PQ",wrapperOuterDelayMessage:"Tqxxp6xz",wrapperImageContainer:"XakMk0v8",wrapperProductConatiner:"xsgt8YBl",wrapperProductName:"R9RrxGp9",wrapperProductSize:"n3HQ1Sgx",wrapperProductSizeLabel:"qqswm2gZ",wrapperProductSizeContainer:"VFpCBRyu",wrapperProductDiscount:"HiuCoKlO",wrapperProductDiscountItem:"yU5J_3HY",wrapperProductPrice:"E7E9Lszq",wrapperProductPriceContainer:"c1SmClyx",wrapperProductPriceNew:"m5y4JPYl",wrapperProductPriceOld:"w7azL3Av",wrapperProductIcons:"AzaVoj5U",wrapperProductTrashButton:"mv3v9hd7",wrapperProductCounter:"aiGVH0DQ",wrapperProductCounterIcon:"LSNW52m4",wrapperProductCounterQuantity:"jsHwDIYp"},I=({title:e,product_title:t,original_price:a,total_discount:r,discounted_price:n,quantity:c,final_price:o,discount:p,size:d,currencySymbol:u,variant_title:I,shippingDelayDays:E,image:M,changeToCart:F,url:q,properties:V={_shippingTime:0,_quantityAvailable:0},key:B,freeGift:A,delayMessage:z})=>{const R=Math.round((a-n)/a*100),J=l(n),Y=l(a),G="string"==typeof o?o:l(o),H=!!(null==V?void 0:V._shippingTime)&&(null==V?void 0:V._shippingTime)>=E&&V._quantityAvailableF({id:B,quantity:0})},{children:(0,s.jsx)(i.a.eb,{})}))]})),"number"==typeof o&&o>0?(0,s.jsxs)("div",Object.assign({className:_},{children:[(0,s.jsx)("button",Object.assign({className:D,onClick:()=>F({id:B,quantity:c-1})},{children:(0,s.jsx)(i.a.J,{})})),(0,s.jsx)("span",Object.assign({className:L},{children:c})),(0,s.jsx)("button",Object.assign({className:D,onClick:()=>F({id:B,quantity:c+1})},{children:(0,s.jsx)(i.a.N,{})}))]})):null]})),H&&(0,s.jsxs)("div",Object.assign({className:m},{children:[(0,s.jsx)("span",{children:"*"}),(0,s.jsx)("p",{children:z})]}))]}))},E=e=>Math.floor(e/60%60),M=e=>Math.floor(e%60),F={hoursLeft:0,minutesLeft:0,secondsLeft:0},{wrapper:q,wrapperShippingIcon:V,wrapperCloseIcon:B,wrapperDelayMessage:A,wrapperDelayMessageRed:z,wrapperDispatchTitle:R,wrapperDispatchMessage:J,wrapperDispatchContainer:Y,wrapperDispatchTimer:G}={wrapper:"kJLWyST0",wrapperShippingIcon:"B8exyOCC",wrapperCloseIcon:"I0HvE9IB",wrapperDelayMessage:"gt7A5pHv",wrapperDelayMessageRed:"ysTChk8f",wrapperDispatchContainer:"yZ2StJof",wrapperDispatchTitle:"L1v3_GYz",wrapperDispatchMessage:"yGkG6YBP",wrapperDispatchTimer:"c6yfZBeV"},H=({isDelay:e,handleCloseNotification:t,delay:a,onTime:n})=>{const{timer:{hoursLeft:c,minutesLeft:o,secondsLeft:l},isEnabled:p}=(()=>{const[e,t]=(0,r.useState)(!1),[a,s]=(0,r.useState)(F);return(0,r.useEffect)((()=>{const e=setInterval((()=>{const e=(e=>{const t=new Date(e).toLocaleString("en-US",{timeZone:"Australia/Sydney"});return new Date(t)})(new Date),{isTimerEnabled:a,timeLeft:r}=(e=>{const t=(new Date).toLocaleString("en-US",{timeZone:"Australia/Sydney"}),a=t.indexOf(","),s=t.slice(a),r=t.replace(s,", 15:00:00"),n=(new Date(r).getTime()-e.getTime())/1e3,i=Number.isFinite(n)?n:0;return{isTimerEnabled:i>0,timeLeft:i}})(e);var n;t(a),s({hoursLeft:(n=r,Math.floor(n/3600)),minutesLeft:E(r),secondsLeft:M(r)})}),1e3);return()=>clearInterval(e)}),[]),{timer:a,isEnabled:e}})();return e?(0,s.jsxs)("div",Object.assign({className:q},{children:[(0,s.jsx)("div",Object.assign({className:V},{children:(0,s.jsx)(i.a.Y,{})})),(0,s.jsx)("div",Object.assign({className:B,onClick:t},{children:(0,s.jsx)(i.a.q,{})})),(0,s.jsxs)("p",Object.assign({className:A},{children:[a.prefix,(0,s.jsx)("span",Object.assign({className:z},{children:a.infix})),a.suffix]}))]})):p?(0,s.jsxs)("div",Object.assign({className:q},{children:[e?(0,s.jsx)("div",Object.assign({className:V},{children:(0,s.jsx)(i.a.Y,{})})):null,(0,s.jsx)("div",Object.assign({className:B,onClick:t},{children:(0,s.jsx)(i.a.q,{})})),e?(0,s.jsxs)("p",Object.assign({className:A},{children:[a.prefix,(0,s.jsx)("span",Object.assign({className:z},{children:a.infix})),a.suffix]})):(0,s.jsxs)("div",Object.assign({className:Y},{children:[(0,s.jsx)("p",Object.assign({className:R},{children:n.heading})),(0,s.jsxs)("p",Object.assign({className:J},{children:[n.prefix,(0,s.jsxs)("span",Object.assign({className:G},{children:[c<10?`0${c}`:c,":",o<10?`0${o}`:o,":",l<10?`0${l}`:l]}))," ",n.suffix]}))]}))]})):null};var $=a(281),U=a(23);const{backdrop:X,wrapper:Z,wrapperLoadingText:Q,wrapperOpen:K,wrapperIcon:W,wrapperHeader:ee,wrapperItems:te,wrapperDispatchMessage:ae,wrapperFooter:se,wrapperFooterMessage:re,wrapperFooterButtonVariantOne:ne,wrapperFooterButtonVariantOneLabel:ie,wrapperFooterButtonVariantTwo:ce,wrapperFooterButtonVariantTwoLabel:oe,wrapperFooterButtonVariantTwoMiddleText:le}={backdrop:"kZYoOK0k",wrapper:"YFnOt9Gd",wrapperLoadingText:"mL3aWKO9",wrapperOpen:"BbK9zKfb",wrapperIcon:"ksyndb2c",wrapperHeader:"czvcDmxr",wrapperItems:"_7EeYgSS",wrapperDispatchMessage:"fdoFFUq_",wrapperFooter:"YRjarkGi",wrapperFooterMessage:"L3q2f2P5",wrapperFooterButtonVariantOne:"Uy505cAQ",wrapperFooterButtonVariantOneLabel:"J8zGYYXm",wrapperFooterButtonVariantTwo:"TOvPWJjj",wrapperFooterButtonVariantTwoLabel:"o9U1DcNe",wrapperFooterButtonVariantTwoMiddleText:"_tJR_XPr"},pe=({isOpen:e,toggleSlideInCart:t,labels:{heading:a,size:l,discount:g,subtotal:h,checkout:m,loading:j,freeGift:f,delayMessage:w},dispatchMessage:b,items:y,footerMessage:{variantOne:O,variantTwo:x},cartVariant:v="firstVariant",currencySymbol:C,changeToCart:N,isSync:S,limitedProductData:P,addToCart:T,freeGiftFunctionalityVariant:_,isDelay:D,isLoopReturnActive:k,shippingDelayDays:L,updateCart:E})=>{const{isMessageVisible:M,handleCloseNotification:F}=(()=>{const[e,t]=(0,r.useState)(!0);return{isMessageVisible:e,handleCloseNotification:(0,r.useCallback)((()=>{t(!1)}),[])}})(),[q,V]=(0,r.useState)(!1),[B,A]=(0,r.useState)(u),{cartRef:z,loading:R,handleFormClick:J,hasPersisted:Y,setHasPersisted:G}=function({toggleSlideInCart:e,isOpen:t,isLoopReturnActive:a,loopTotal:s}){const n=(0,r.useRef)(null),[i,c]=(0,r.useState)(!1),[o,l]=(0,r.useState)(!1),p=(0,r.useCallback)((e=>{a&&s||c(!0)}),[a,s]);return(0,U.a)(n,e,!t),{cartRef:n,loading:i,hasPersisted:o,setHasPersisted:l,setLoading:c,handleFormClick:p}}({toggleSlideInCart:t,isOpen:e,isLoopReturnActive:k,loopTotal:B.loop_total}),pe=y.reduce(((e,t)=>{const a=(s=t.discounted_price||t.price,String((.01*s).toFixed(2)));var s;return e+parseFloat(a)*t.quantity}),0);(0,r.useEffect)((()=>{const e=(0,c.a)("loopReturn")||'""',t=JSON.parse(e);t&&A(t)}),[k]),(0,r.useEffect)((()=>{if("off"===_)return;if(!S||!P)return;const e=P.variants[0],t={image:P.image.url,product_title:P.title,variant_title:e.Size||"",variant_id:e.id,quantity:1,compareAtPrice:0,price:0,final_price:0,url:`/products/${P.handle}`,vendor:"Curvy",id:e.id,properties:{_shippingTime:P.selectedValues.shippingTime,_quantityAvailable:e.quantityAvailable}},a=y.some((e=>e.handle===P.handle&&(0===e.price||2499===e.price)));if(pe>=150&&!a)T([t]);else if(pe<150&&a){const e=y.find((e=>e.handle===P.handle&&(0===e.price||2499===e.price)));if(!e)return;N({id:e.key,quantity:0})}}),[pe,S]),(0,r.useEffect)((()=>{e&&0===y.length&&t()}),[y.length]);const de=(0,r.useCallback)((()=>{const e=document.getElementById("form"),t=document.createElement("button");t.name="checkout",e.append(t),t.style.display="none",t.click()}),[]);(0,r.useEffect)((()=>{S&&q&&de()}),[S,q]);const ue=(0,r.useCallback)((e=>{return t=void 0,a=void 0,r=function*(){if(e.preventDefault(),!k||!B.loop_total)return V(!0);const t=y.reduce(((e,t)=>Object.assign(e,{[t.key]:Object.assign(Object.assign({},t),{quantity:0})})),{}),a=()=>E(t),s=y.map((e=>e.variant_id)),r=(0,c.a)("loopCart")||'""',n=JSON.parse(r)||"";if(n&&n.loop_return_id===B.loop_return_id){const{token:e}=n;try{return void(yield((e,t,a)=>o(void 0,void 0,void 0,(function*(){try{const s={method:"GET",headers:{accept:"application/json","X-Authorization":p}},r=yield fetch(`https://api.loopreturns.com/api/v1/cart/${e}`,s),n=yield r.json();if(!n)throw new Error("unable to get cart");const i=n.cart||[],c={method:"POST",headers:{accept:"application/json","content-type":"application/json","X-Authorization":p},body:JSON.stringify({cart:[...i,...t]})},o=yield fetch(`https://api.loopreturns.com/api/v1/cart/${e}`,c);if(!(yield o.json()).updated)throw new Error("unable to update cart");return void d(e,a)}catch(e){console.log(e)}})))(e,s,a))}catch(e){console.log(e)}}try{yield((e,t,a)=>o(void 0,void 0,void 0,(function*(){const s={method:"POST",headers:{accept:"application/json","content-type":"application/json","X-Authorization":p},body:JSON.stringify({cart:t})};try{const t=yield fetch("https://api.loopreturns.com/api/v1/cart/",s),r=yield t.json(),n={token:r.token,loop_return_id:e};(0,c.c)("loopCart",JSON.stringify(n),{expires:1}),d(r.token,a)}catch(e){console.log(e)}})))(B.loop_return_id,s,a)}catch(e){console.log(e)}},new((s=void 0)||(s=Promise))((function(e,n){function i(e){try{o(r.next(e))}catch(e){n(e)}}function c(e){try{o(r.throw(e))}catch(e){n(e)}}function o(t){var a;t.done?e(t.value):(a=t.value,a instanceof s?a:new s((function(e){e(a)}))).then(i,c)}o((r=r.apply(t,a||[])).next())}));var t,a,s,r}),[B.loop_total,k,y.length]),ge="firstVariant"===v?ne:ce,he="firstVariant"===v?ie:oe;return(0,s.jsxs)(n.Fragment,{children:[e&&(0,s.jsx)("div",{className:X}),(0,s.jsxs)("div",Object.assign({className:(0,$.a)(Z,e&&K),ref:z},{children:[(0,s.jsx)("button",Object.assign({className:W,onClick:t},{children:(0,s.jsx)(i.a.f,{})})),(0,s.jsx)("p",Object.assign({className:ee},{children:a})),(0,s.jsx)("div",Object.assign({className:te},{children:y.map((e=>(0,s.jsx)(I,Object.assign({},e,{delayMessage:w,size:l,discount:g,currencySymbol:C,changeToCart:N,freeGift:f,shippingDelayDays:L}))))})),M?(0,s.jsx)("div",Object.assign({className:ae},{children:(0,s.jsx)(H,Object.assign({},b,{isDelay:D,handleCloseNotification:F}))})):null,(0,s.jsxs)("div",Object.assign({className:se},{children:[(0,s.jsx)("form",Object.assign({action:"/cart",method:"post",noValidate:!0,id:"form",onClick:J},{children:(0,s.jsx)("button",Object.assign({name:"checkout",className:ge,disabled:0===pe,onClick:ue},{children:R&&!Y?(0,s.jsx)("span",Object.assign({className:Q},{children:j})):(0,s.jsxs)(n.Fragment,{children:[(0,s.jsx)("span",Object.assign({className:he},{children:m})),"secondVariant"===v&&(0,s.jsx)("span",Object.assign({className:le},{children:h})),pe>0?(0,s.jsxs)("span",Object.assign({className:he},{children:[C,pe.toFixed(2)]})):null]})}))})),(0,s.jsx)("p",Object.assign({className:re},{children:"firstVariant"===v?O:(0,s.jsxs)(n.Fragment,{children:[x," ",(0,s.jsx)(i.a.C,{})]})}))]}))]}))]})},de=(e,t=0)=>{const a="https://cdn.shopify.com/s/files/1/0039/2563/9241/";let s=e;if(e.includes(a)){let e="/fast-image/curvy/";t&&(e=`/fast-image/h_${t}/curvy/`),s=s.replace(a,e)}return s},ue="loopReturn";(0,a(4).createEntrypoint)("slideInCart",(function(e){const t=(e=>{var{useSharedState:t}=e,a=function(e,t){var a={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(a[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(s=Object.getOwnPropertySymbols(e);r({cart:e,context:t,isSlideInCartOpened:a,isSync:s,variants:o,changeToCart:r,toggleSlideInCart:n,addToCart:i,updateCart:c,quantity:l}))),{items:h,items_subtotal_price:m,item_count:j}=n,{currency:f}=i,{isLoopReturnActive:w}=function({params:e,updateCart:t,items:a}){const[s,n]=(0,r.useState)(!1),[i,o]=(0,r.useState)(!1);return(0,r.useEffect)((()=>{const t=e.filter((([e,t])=>e.concat(t).toLowerCase().includes("loop"))),a=t.length>0;if(o(a),!a)return;const s=t.reduce(((e,[t,a])=>Object.assign(Object.assign({},e),{[t]:a})),{});(0,c.c)(ue,JSON.stringify(s),{expires:1}),n(!0);const r=new URL(window.location.href);t.forEach((([e])=>r.searchParams.delete(e)));const i=r.searchParams.toString(),l=i.length?"?"+i:"",p=window.location.pathname+l;history.pushState(null,"",p)}),[]),(0,r.useEffect)((()=>{((e,t)=>{"undefined"!=typeof window&&(0,c.a)(t)&&e(!0)})(o,ue)}),[]),(0,r.useEffect)((()=>{if(!s||0===a.length)return;const e=a.reduce(((e,t)=>Object.assign(e,{[t.key]:Object.assign(Object.assign({},t),{quantity:0})})),{});t(e),n(!1)}),[s,a.length]),{isLoopReturnActive:i}}({params:a.params,updateCart:g,items:h});return Object.assign(Object.assign({},a),{isLoopReturnActive:w,isDelay:!1,isOpen:o,currencySymbol:f.symbol,items:h.map((e=>Object.assign(Object.assign({},e),{image:de(e.image,200)}))),subtotal:m,item_count:j,changeToCart:p,toggleSlideInCart:d,isSync:l,addToCart:u,updateCart:g})})(e),{dispatchMessage:{delay:a,onTime:n},items:i,item_count:o}=t,l=(0,r.useMemo)((()=>i.reduce(((e,t)=>{var a,s;if((null===(a=t.properties)||void 0===a?void 0:a._quantityAvailable)>=t.quantity)return e;const r=null===(s=t.properties)||void 0===s?void 0:s._shippingTime;return r?e>r?e:r:e}),0)),[i.length,o]),p=l>=2,{prefix:d,suffix:u}=a.infixBlocks,g=`${d} ${l} ${u}`,h={delay:Object.assign(Object.assign({},a),{infix:g}),onTime:n},m=Object.assign(Object.assign({},t),{dispatchMessage:h,isDelay:p,shippingDelayDays:2});return(0,s.jsx)(pe,Object.assign({},m))}))()},23:(e,t,a)=>{a.d(t,{a:()=>r});var s=a(2);function r(e,t,a){(0,s.useEffect)((()=>{const s=s=>{!e.current||e.current.contains(s.target)||a||t(s)};return document.addEventListener("mousedown",s),document.addEventListener("touchstart",s),()=>{document.removeEventListener("mousedown",s),document.removeEventListener("touchstart",s)}}),[e,t,a])}}},e=>{e.O(0,[1,2,3,6,12,14],(()=>(301,e(e.s=301)))),e.O()}]);