1import{a as ga,b as lo}from"./chunk-N4JQGBHF.min.js";import{a as Qo,b as sa,c as ra,d as na,e as ia,f as la,g as da,h as ca,i as pa,j as ma,k as ze,l as ua,m as Gt,n as fa}from"./chunk-KK24AAMU.min.js";import{a as ta,c as oa,d as aa,e as io,f as He}from"./chunk-GRJEFQDD.min.js";import"./chunk-P2DW6QJ7.min.js";import"./chunk-LLVGVKZL.min.js";import"./chunk-OY6JXUYS.min.js";import"./chunk-7MOZVIML.min.js";import"./chunk-MPFACNBO.min.js";import"./chunk-LC5OYH4X.min.js";import{b as ut}from"./chunk-FK5HJ4ES.min.js";import{a as ye,b as st}from"./chunk-5IEHUROP.min.js";import{b as mt}from"./chunk-T4BC3X3R.min.js";import{p as Ne}from"./chunk-NLA2LLLS.min.js";import"./chunk-DVTH6UTT.min.js";import"./chunk-2UVRPZN3.min.js";import{a as Ee}from"./chunk-XNVQCMZA.min.js";import"./chunk-WMYZEBDI.min.js";import{a as ea}from"./chunk-TLQIO22G.min.js";import"./chunk-Y3SDXRH7.min.js";import"./chunk-MYVQQ3O2.min.js";import{e as Ie}from"./chunk-FLJ6HCE3.min.js";import"./chunk-PBYZT6Z4.min.js";import"./chunk-ETOMESGH.min.js";import"./chunk-3VLAPTVZ.min.js";import"./chunk-HTETHSAU.min.js";import"./chunk-WKMXDW35.min.js";import{a as ue}from"./chunk-NA6D2K2G.min.js";import{a as ft}from"./chunk-RYRKE42S.min.js";import{a as rt,b as Zo}from"./chunk-ENDBY7BH.min.js";import{b as Lt,c as Bt}from"./chunk-IPQLSGDG.min.js";import{a as te,c as Xo,d as St}from"./chunk-GD4OMS7T.min.js";import"./chunk-G6IKBWCJ.min.js";import{a as Mt,b as Dt,j as Ot,m as Uo,n as Nt}from"./chunk-SQXXZFV4.min.js";import"./chunk-LZ5SVXMK.min.js";import{a as ot,b as It,c as ao,d as Rt,f as Et,g as so,h as Ge}from"./chunk-R5R3K2X6.min.js";import{a as Ho,e as Vo,g as pt}from"./chunk-BB7UM4GI.min.js";import{a as Ko}from"./chunk-BIEAE2EF.min.js";import{g as no}from"./chunk-HG4EWVFW.min.js";import"./chunk-LMCUSQQ6.min.js";import"./chunk-7DI43LFM.min.js";import{a as de}from"./chunk-BUPX7SO6.min.js";import{a as Jo}from"./chunk-DVA4KVBX.min.js";import{j as Wo,k as Yo,l as $t}from"./chunk-LQC2UD63.min.js";import{a as ro,b as at}from"./chunk-S2AWRBFJ.min.js";import{b as ge,d as me,g as Y}from"./chunk-3CXJWEDF.min.js";import{d as E}from"./chunk-FWVUCT7Y.min.js";var w=E(me());var gt=E(me());var b=E(Y());function ys({item:e,removeLineItem:o,updateLineItemQuantity:s,handleDisclosureToggle:c,index:l,customDiscountMessage:n,pairHint:u,isBfcm:h,geoBlockedStateName:f=""}){let{final_line_price:g,original_line_price:m,properties:p,url:v,product_title:x,variant_title:A,featured_image:O,quantity:T,key:z,line_level_discount_allocations:I,product_type:$}=e,q=!(p&&Object.keys(p).length>1&&p._fragment),j=p&&Object.keys(p).length>0&&p.Includes,y=p&&Object.keys(p).length>0&&p.Note&&p.Note!="null"&&p.Note!=""?p.Note:!1,C=I&&I[0]&&Object.keys(I[0]).length>0&&I[0].amount&&I[0].amount===m,G=n||(p?._gwpId?p._gwpDiscountMessage||"Free Gift With Purchase!":I&&I[0]&&I[0]?.discount_application?.title?I[0].discount_application.title:!1),M=!!p?._gwpId,k=!!p?._autoAdd,R=(()=>{if(h)return"#4752A3";if(!G)return!1;let nt=G.toLowerCase();return M?"var(--color-secondary)":nt.includes("readers as low as")?"#2C3830":nt.includes("sale items")?"#475B4E":"var(--color-secondary)"})(),B=I&&I[0]&&I[0]?.discount_application?.type==="script"||I&&I[0]&&I[0]?.amount>0&&m>g?m:p&&Object.keys(p).length>0&&p["_compare-at-price"]&&p["_compare-at-price"]!="null"&&p["_compare-at-price"]!=""?p["_compare-at-price"]*T:!1,oe=g,ae=te({amount:oe/100}),re=B&&B!==oe?te({amount:B/100}):te({amount:0}),H=p&&Object.keys(p).length>0&&p["Recipient Name"],L=p&&Object.keys(p).length>0&&p["Recipient Email"],fe=p&&Object.keys(p).length>0&&p["Delivery Date"],S=p&&Object.keys(p).length>0&&p["Gift Note"],pe=rt(x),Q=pe.parenthetical?(0,b.jsxs)(b.Fragment,{children:[pe.base.replace("TEST ",""),(0,b.jsx)("span",{className:"mb-1.5 text-xs font-light leading-none font-primary",children:pe.parenthetical})]}):(0,b.jsx)("span",{children:x.replace("TEST ","")}),be=!!(M||k),ke=`cart_quantity_${z}`,Me=$!=="Accessories"&&$!=="Gift Card",je=x.includes("Polarized"),Ae=x.includes("Mystery"),Le=x.includes("Gift Card"),P=`${ae?.currencyNarrowSymbol??""}${ae.amount.replace(".00","")}`.replace("$0","FREE").replace("$FREE","FREE").replace("CAFREE","FREE"),[ee,D]=(0,gt.useState)(!1),ve=(0,gt.useRef)(null),Ye=(0,gt.useRef)(null),De=(0,gt.useRef)(null),dt=O?.url??null;return k?(0,b.jsxs)("div",{className:"relative flex flex-wrap justify-between pl-3 pr-4 border border-solid border-[#
1E9EBED] rounded-lg order-[100] py-2 items-center",children:[(0,b.jsx)("div",{className:"flex flex-col pr-6 mt-0 text-base font-medium leading-tight",children:Q}),(0,b.jsx)("div",{className:"mr-auto ml-2 text-xs",children:"FREE"}),(0,b.jsxs)("button",{type:"button",className:"text-xs text-[#333]",title:`Remove (${x}) from cart`,onClick:()=>o(e),children:[(0,b.jsxs)("span",{className:"sr-only",children:["Remove (",x,") from cart"]}),(0,b.jsx)(no,{className:"opacity-50 no-reset size-5 fill-transparent hover:opacity-100","aria-hidden":"true"})]})]}):(0,b.jsxs)("div",{className:`relative flex flex-wrap items-start pl-1.5 lg:pl-2 pr-4 border border-solid border-[#E9EBED] rounded-lg ${M?"py-2":"pt-2 pb-2 md:py-4"}`,style:M?{borderColor:"#E9EBED",borderStyle:"solid",borderWidth:"1px"}:{},children:[dt&&(0,b.jsx)("a",{href:q?v:"#",className:`block ${M?"mr-3 lg:mr-4":"mr-0"} ${Ae?"mt-0":Me?"mt-3":"mt-1.5"}`,children:(0,b.jsx)("img",{className:`${M?"block w-full h-auto max-w-[8rem] lg:max-w-[8rem]":"block w-full h-auto max-w-[8rem] lg:max-w-[10rem]"}`,width:"160",height:"70",alt:x,src:M&&x.includes("Pouch")?ue(dt,{height:320,width:400,crop:"center"}):O?.aspect_ratio===1||!O?ue(dt,{height:160,width:400,crop:"center"}):ue(dt,{height:320})})}),(0,b.jsxs)("div",{className:"flex-1 lg:mr-1.5",children:[(0,b.jsx)("a",{href:q?v:"#",className:"flex flex-col pr-6 mt-0 text-base font-semibold leading-tight link font-secondary",children:Q}),A&&(0,b.jsx)("div",{className:"my-0 text-xs text-default",children:H?(0,b.jsxs)("div",{className:"mt-1",children:[(0,b.jsxs)("button",{type:"button",className:"relative text-xs font-medium underline text-secondary",onClick:()=>D(!ee),children:[ee?"Hide":"Show"," Details"]}),ee&&(0,b.jsx)("div",{className:"mt-2 leading-none",children:(0,b.jsxs)("ul",{className:"flex flex-col gap-1 pl-0 list-disc list-outside",children:[(0,b.jsxs)("li",{className:"flex flex-col",children:[(0,b.jsx)("strong",{children:"Recipient Name: "}),H]}),L&&(0,b.jsxs)("li",{className:"flex flex-col",children:[(0,b.jsx)("strong",{children:"Recipient Email: "}),L]}),fe&&(0,b.jsxs)("li",{className:"flex flex-col",children:[(0,b.jsx)("strong",{children:"Delivery Date: "}),fe]}),S&&(0,b.jsxs)("li",{className:"flex flex-col",children:[(0,b.jsx)("strong",{children:"Gift Note: "}),S]})]})})]}):M&&x.includes("Pouch")?(0,b.jsxs)("div",{className:"leading-none",children:[(0,b.jsx)("span",{className:"inline-block py-1",children:"Includes"}),(0,b.jsxs)("ul",{className:"pl-6 list-disc list-outside",children:[(0,b.jsx)("li",{children:"Brown Faux Leather Pouch"}),(0,b.jsx)("li",{children:"Eyeglass Cleaning Spray 30ml"}),(0,b.jsx)("li",{children:"Blue Leopard Cleaning Cloth"}),(0,b.jsx)("li",{children:"Beaded Chain 63cm"}),(0,b.jsx)("li",{children:"Repair kit"})]})]}):je?A.replace(" / No Correction / None",""):A.replace(" / Progressives","").replace(" / No Correction / None"," / No Correction")}),G&&(0,b.jsx)("div",{className:"mt-1.5 mb-1",children:(0,b.jsxs)("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wider",style:{backgroundColor:R==="#4752A3"?"#4752A315":R==="#2C3830"?"#2C383015":R==="#475B4E"?"#475B4E15":"rgba(var(--color-secondary-rgb, 44, 56, 48), 0.08)",color:R==="#4752A3"?"#4752A3":R==="#2C3830"?"#2C3830":R==="#475B4E"?"#475B4E":"var(--color-secondary, #2C3830)"},children:[M&&(0,b.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"mr-1 w-3 h-3",children:[(0,b.jsx)("path",{fillRule:"evenodd",d:"M14 6a2.5 2.5 0 00-4-3 2.5 2.5 0 00-4 3H3.25C2.56 6 2 6.56 2 7.25v.5C2 8.44 2.56 9 3.25 9h6V6h1.5v3h6C17.44 9 18 8.44 18 7.75v-.5C18 6.56 17.44 6 16.75 6H14zm-1-1.5a1 1 0 01-1 1h-1v-1a1 1 0 112 0zm-6 0a1 1 0 001 1h1v-1a1 1 0 00-2 0z",clipRule:"evenodd"}),(0,b.jsx)("path",{d:"M9.25 10.5H3v4.75A2.75 2.75 0 005.75 18h3.5v-7.5zM10.75 18v-7.5H17v4.75A2.75 2.75 0 0114.25 18h-3.5z"})]}),Shopify.currency.active==="USD"?G.replace(" USD",""):G]})}),y&&!M&&(0,b.jsx)("span",{className:"text-sm font-bold text-primary",children:y}),u&&(0,b.jsx)("div",{className:"mt-1 text-xs leading-snug text-secondary/90","data-
1pair-hint":!0,children:u}),f&&(0,b.jsxs)("div",{className:"mt-1 text-xs font-semibold leading-snug text-primary","data-geo-block-notice":!0,children:["Can\u2019t ship to ",f]}),(0,b.jsxs)("div",{className:"flex justify-between items-center mt-3",children:[M||H?(0,b.jsx)("div",{}):C?(0,b.jsxs)("div",{className:"js-number-input number-input",children:[(0,b.jsx)("label",{htmlFor:ke,className:"sr-only",children:"Quantity"}),(0,b.jsx)("span",{className:"m-0 border border-solid border-[#eee] rounded-md px-2 py-1 leading-4 text-[13px]",children:T}),(0,b.jsx)("input",{type:"hidden",value:T})]}):(0,b.jsxs)("div",{className:"mt-1.5 js-number-input number-input",children:[(0,b.jsx)("label",{htmlFor:ke,className:"sr-only","aria-live":"polite",children:"Quantity"}),(0,b.jsxs)("div",{className:"flex overflow-hidden items-center h-8 bg-gray-50 rounded-md border border-gray-200",children:[(0,b.jsx)("button",{ref:ve,type:"button","aria-label":`Decrease quantity of ${x} - ${A} by 1, currently ${T}, would become ${T-1} upon clicking`,onClick:()=>{s(e,T-1),setTimeout(()=>{ve.current&&ve.current.focus()},0)},className:"flex justify-center items-center px-2.5 h-full text-gray-500 transition-colors hover:text-black",children:(0,b.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",style:{width:"0.875em",height:"0.875em"},children:[(0,b.jsx)("title",{children:"minus"}),(0,b.jsx)("path",{d:"M436 284c6.6 0 12-5.4 12-12v-32c0-6.6-5.4-12-12-12H12c-6.6 0-12 5.4-12 12v32c0 6.6 5.4 12 12 12h424z"})]})}),(0,b.jsx)("input",{ref:De,className:"w-9 text-center bg-transparent border-none text-xs font-medium text-gray-900 focus:outline-none [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",type:"number",id:ke,name:ke,value:T,onChange:nt=>{s(e,nt.target.value),setTimeout(()=>{De.current&&De.current.focus()},0)},min:"1",max:"999"}),(0,b.jsx)("button",{ref:Ye,type:"button","aria-label":`Increase quantity of ${x} - ${A} by 1, currently ${T}, would become ${T+1} upon clicking`,onClick:()=>{s(e,T+1),setTimeout(()=>{Ye.current&&Ye.current.focus()},0)},className:"flex justify-center items-center px-2.5 h-full text-gray-500 transition-colors hover:text-black",children:(0,b.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",style:{width:"0.875em",height:"0.875em"},children:[(0,b.jsx)("title",{children:"plus"}),(0,b.jsx)("path",{d:"M436 228H252V44c0-6.6-5.4-12-12-12h-32c-6.6 0-12 5.4-12 12v184H12c-6.6 0-12 5.4-12 12v32c0 6.6 5.4 12 12 12h184v184c0 6.6 5.4 12 12 12h32c6.6 0 12-5.4 12-12V284h184c6.6 0 12-5.4 12-12v-32c0-6.6-5.4-12-12-12z"})]})})]})]}),!M&&B&&B!==oe&&re?(0,b.jsxs)("div",{className:`flex flex-col items-end ${M?"absolute right-2 top-3":""}`,children:[(0,b.jsxs)("span",{className:`${M?"text-xs":"text-base"} font-bold ${h?"text-[#4752A3]":"text-gray-900"}`,children:[M&&(0,b.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"inline-block relative -top-0.5 mr-0.5 w-4 h-4",children:[(0,b.jsx)("path",{fillRule:"evenodd",d:"M14 6a2.5 2.5 0 00-4-3 2.5 2.5 0 00-4 3H3.25C2.56 6 2 6.56 2 7.25v.5C2 8.44 2.56 9 3.25 9h6V6h1.5v3h6C17.44 9 18 8.44 18 7.75v-.5C18 6.56 17.44 6 16.75 6H14zm-1-1.5a1 1 0 01-1 1h-1v-1a1 1 0 112 0zm-6 0a1 1 0 001 1h1v-1a1 1 0 00-2 0z",clipRule:"evenodd"}),(0,b.jsx)("path",{d:"M9.25 10.5H3v4.75A2.75 2.75 0 005.75 18h3.5v-7.5zM10.75 18v-7.5H17v4.75A2.75 2.75 0 0114.25 18h-3.5z"})]}),(0,b.jsx)("span",{className:"sr-only",children:"Current Price: "}),P]}),M?(0,b.jsxs)("span",{className:"mt-0.5 text-xs text-transparent line-through",children:[(0,b.jsx)("span",{className:"sr-only",children:"Compare At Price: "}),re?.currencyNarrowSymbol??"",re.amount.replace(".00","")]}):(0,b.jsxs)("span",{className:"mt-0.5 text-xs text-gray-400 line-through",children:[(0,b.jsx)("span",{className:"sr-only",children:"Compare At Price: "}),re?.currencyNarrowSymbol??"",re.amount.replace(".00","")]})]}):!M&&(0,b.jsx)("span",{className:"text-base font-medium",children:P})]})]}),!be&&(0,b.jsxs)("button",{type:"button",className:`text-xs text-[#333] mb-auto absolute right-4 ${M?"top-2":"top-4"}`,title:`Remove (${x}) from cart`,onClick:()=>o(e),children:[(0,b.jsxs)("span",{className:"sr-only",children:["Remove (",x,") from cart"]}),(0,b.jsx)(no,{className:"opacity-50 no-reset size-5 fill-transparent hover:opacity-100","aria-hidden":"true"})]})]})}var ha=ys;var ht=E(me());var Ct=new Map,co=e=>{if(e?.handle)return e.handle;let o=e?.url;if(typeof o!="string")return null;let s=o.split("/products/")[1];return s&&s.split("?")[0].split("#")[0]||null},Ns=async e=>{if(Ct.has(e))return Ct.get(e);
1try{let o=await fetch(`/products/${e}?view=catalog-generator¤cy=${Shopify?.currency?.active||"USD"}`);if(!o.ok)return Ct.set(e,[]),[];let s=await o.json(),c=Yo(s?.products?.[0]??null);return Ct.set(e,c),c}catch{return Ct.set(e,[]),[]}},ba=(e,o,s=!0)=>{let[c,l]=(0,ht.useState)(()=>new Set),n=o?.region_code,u=(0,ht.useMemo)(()=>Array.from(new Set((e??[]).map(co).filter(Boolean))),[e]),h=u.join(",");return(0,ht.useEffect)(()=>{if(!s||!n||u.length===0){l(m=>m.size===0?m:new Set);return}let f=!1;return(async()=>{let m=await Promise.all(u.map(async p=>[p,await Ns(p)]));f||l(new Set(m.filter(([p,v])=>$t({handle:p,geoBlockedStates:v},{region_code:n})).map(([p])=>p)))})(),()=>{f=!0}},[h,n,s]),c};var Lr=E(me());var se=E(Y());function Ss({item:e,index:o}){let{title:s,variantTitle:c,image:l,quantity:n}=e,u=e.returnValue.amount,h=e.returnValue.refundAmount,f=te({amount:u}),g=te({amount:h}),m=rt(s),p=m.parenthetical?(0,se.jsxs)(se.Fragment,{children:[m.base.replace("TEST ",""),(0,se.jsx)("span",{className:"text-xs mb-1.5 leading-none",children:m.parenthetical})]}):(0,se.jsx)(se.Fragment,{children:(0,se.jsx)("span",{children:s.replace("TEST ","")})}),v=s.includes("Polarized"),x=`${f?.currencyNarrowSymbol??""}${f.amount.replace(".00","")}`,A=`${g?.currencyNarrowSymbol??""}${g.amount.replace(".00","")}`,O=l?.url?l.url:l??null;return(0,se.jsxs)("div",{className:"relative flex flex-wrap items-start pl-1.5 lg:pl-2 pr-4 border border-solid border-[#E9EBED] pt-2 pb-2 md:py-4",children:[O&&(0,se.jsx)("a",{href:"#",className:"block mr-0 mt-1.5",children:(0,se.jsx)("img",{className:"max-w-[8rem] lg:max-w-[10rem] block w-full h-auto mix-blend-multiply",width:"160",height:"70",alt:s,src:ue(O,{height:160,width:400,crop:"center"})})}),(0,se.jsxs)("div",{className:"flex-1 lg:mr-1.5",children:[(0,se.jsx)("a",{href:"#",className:"flex flex-col pr-6 mt-0 text-base font-semibold leading-tight link",children:p}),c&&(0,se.jsx)("div",{className:"my-0 text-xs text-default",children:v?c.replace(" / No Correction / None",""):c.replace(" / Progressives","").replace(" / No Correction / None"," / No Correction")}),(0,se.jsxs)("div",{className:"flex items-start justify-between mt-3",children:[(0,se.jsxs)("div",{className:"flex flex-col items-start gap-1",children:[(0,se.jsx)("span",{className:"text-xs font-bold",children:"Quantity"}),(0,se.jsx)("span",{className:"m-0 leading-4 text-[13px]",children:n})]}),(0,se.jsxs)("div",{className:"flex flex-col items-end gap-1",children:[(0,se.jsx)("span",{className:"text-xs font-bold"}),(0,se.jsxs)("div",{className:"text-base",children:[h!==u&&(0,se.jsx)("span",{className:"mr-2 text-gray-400 line-through",children:A}),(0,se.jsx)("span",{className:"font-medium",children:x})]})]})]})]})]})}var va=Ss;var mo=E(me());var Ve=E(me());var ce=E(Y());function Cs({item:e,addSelectedVariantToCart:o}){let s=(0,Ve.useContext)(ze).swatches,[c,l]=(0,Ve.useState)(!1),{product:n,isMysteryItem:u,isGiftCardItem:h,swatchLimit:f}=e,{featured_image:g,title:m,handle:p,media:v,price:x,compare_at_price:A,tags:O}=n,T=u||h?"#":`/products/${p}`,{compareMoney:z,regularMoney:I}=St({priceCents:x,compareAtPriceCents:A,tags:O}),$=[...new Set(n.variants.filter(S=>S.available).map(S=>S.option1))],q=n.options[0]==="Color"&&$.length>1?$.map(S=>({variantColor:S,frameFrontColor:S.includes("/")?S.split("/")[0]:S,frameTempleColor:S.includes("/")?S.split("/")[1]:S})):null,j=[...$].filter(S=>S.includes("/")).length>1&&Array.from(new Set([...$.filter(S=>S.includes("/")).map(S=>S.split("/")[0])])).length===1,y=q?q.map(S=>({...j?s.find(Q=>Q.color===S.frameTempleColor)??s.find(Q=>Q.color===S.variantColor)??s.find(Q=>Q.color===S.frameFrontColor):s.find(Q=>Q.color===S.variantColor)??s.find(Q=>Q.color===S.frameTempleColor)??s.find(Q=>Q.color===S.frameFrontColor),variantColor:S.variantColor})):null,C=S=>M(S),[G,M]=(0,Ve.useState)(y?y[0].variantColor:null),[k,R]=(0,Ve.useState)(n.variants[0]),B=k.featured_image??v.find(S=>S.src===g||S.src.includes(g));(0,Ve.useEffect)(()=>{G&&R(n.variants.find(S=>S.option1===G))},[G]);let oe=h?"Add To Cart":"ADD +",[ae,re]=(0,Ve.useState)(oe),H=async S=>{S.preventDefault(),de("Recommended Item - Cart","Added upsell item from inline promo recommendation");let pe=S.target.textContent;l(!0),re("Adding..."),await o(k),re("Added!"),l(!1),setTimeout(()=>{re(pe)},2e3)},L=async S=>{S.preventDefault(),PubSub.publish(ge.To.MysteryItemDialog.RequestOpen,{item:e.product})},fe=async S=>{S.preventDefault(),PubSub.publish(ge.To.GiftCardDialog.RequestOpen,{item:e.product})};return(0,ce.jsx)("div",{className:"flex flex-col h-full mx-2 mb-3 text-center bg-white shadow-sm rounded-xl md:mx-0 md:mb-0 md:w-auto",children:(0,ce.jsxs)("div",{className:"flex flex-col flex-grow w-full p-3",children:[(0,ce.jsx)("div",{className:"w-full mb-2",children:(0,ce.jsx)("img",{loading:"lazy",className:"block w-full h-auto max-w-full rounded-lg",src:ue(B.src,{width:256,height:128,crop:"center"}),width:B.width,height:B.height,alt:m})}),(0,ce.jsxs)("div",{className:"flex flex-col flex-grow w-full",children:[(0,ce.jsxs)("div",{children:[h?(0,ce.jsxs)("button",{onClick:fe,className:"mt-2 mb-1 text-base font-medium font-secondary link",children:[m," ",h&&(0,ce.jsx)(io,{className:"w-6 h-6 ml-1 text-primary","aria-hidden":"true"})]}):u?(0,ce.jsxs)("button",{onClick:L,className:"mt-2 mb-1 text-base font-medium font-secondary link",children:[m," ",u&&(0,ce.jsx)(io,{className:"w-6 h-6 ml-1 text-primary","aria-hidden":"true"})]}):(0,ce.jsx)("a",{href:T,className:"mt-2 mb-1 text-base font-medium font-secondary link","aria-label":`View details for ${m}`,children:m}),y&&(0,ce.jsx)(Ie,{value:G,onChange:C,children:(0,ce.jsx)("div",{className:"flex flex-wrap justify-center px-1 pt-2 gap-y-2 gap-x-2",children:y.map((S,pe)=>pe<f?(0,ce.jsxs)(Ie.Option,{value:S.variantColor,className:({active:Q,checked:be})=>at(Q||be?"border border-black":"","-m-0.5 relative p-0.5 rounded-full flex items-center justify-center cursor-pointer focus:outline-none"),children:[(0,ce.jsx)(Ie.Label,{as:"p",className:"sr-only",children:S.variantColor}),(0,ce.jsx)("span",{"aria-hidden":"true",title:S.variantColor,className:"h-4 w-4 border border-black border-opacity-10 rounded-full",style:{background:S.image?`url('${S.image}')`:S.hex}})]},S.variantColor):null)})})]}),!h&&(0,ce.jsxs)("div",{className:"mt-2 text-sm font-semibold text-gray-700",children:[I.currencyNarrowSymbol,I?.amount?.replace(".00","")??""]}
1)]}),(0,ce.jsx)("div",{className:"mt-auto pt-3",children:(0,ce.jsx)("button",{className:"w-full py-2 text-xs font-bold tracking-wider uppercase transition-colors rounded-full bg-secondary/10 text-secondary hover:bg-secondary hover:text-white","aria-label":`Add ${m} to cart for ${I.currencyNarrowSymbol}${I?.amount}`,onClick:h?fe:u?L:H,children:ae})})]})})}var zt=Cs;var po=E(me());var xa=E(Y());var Fe=E(me());var W=E(Y());function _s({product:e,addSelectedVariantToCart:o,defaultStrengthSelection:s,isActive:c,isFirst:l,isLast:n,onRecommendationPrevious:u,onRecommendationNext:h,onAddToCart:f}){let g=(0,Fe.useContext)(ze).swatches,m=(0,Fe.useContext)(ze).settings,[p,v]=(0,Fe.useState)(!1),{featured_image:x,title:A,handle:O,media:T,price:z,compare_at_price:I,tags:$}=e,q=`/products/${O}`,{compareMoney:j,regularMoney:y}=St({priceCents:z,compareAtPriceCents:I,tags:$}),C=rt(A),G=C.parenthetical?(0,W.jsxs)("span",{className:"flex flex-col leading-tight",children:[(0,W.jsx)("span",{children:C.base}),(0,W.jsx)("span",{className:"text-xs font-normal",children:C.parenthetical})]}):(0,W.jsx)("span",{children:A}),M=[...new Set(e.variants.map(P=>P.option1))],k=e.options[0].name==="Color"&&M.length>0?M.map(P=>({variantColor:P,frameFrontColor:P.includes("/")?P.split("/")[0]:P,frameTempleColor:P.includes("/")?P.split("/")[1]:P})):null,R=[...M].filter(P=>P.includes("/")).length>1&&Array.from(new Set([...M.filter(P=>P.includes("/")).map(P=>P.split("/")[0])])).length===1,B=k?k.map(P=>({...R?g.find(D=>D.color===P.frameTempleColor)??g.find(D=>D.color===P.variantColor)??g.find(D=>D.color===P.frameFrontColor):g.find(D=>D.color===P.variantColor)??g.find(D=>D.color===P.frameTempleColor)??g.find(D=>D.color===P.frameFrontColor),variantColor:P.variantColor})):null,oe=P=>re(P),[ae,re]=(0,Fe.useState)(B?B[0].variantColor:null),H=(()=>{if(e.options.find(P=>P.name==="Strength")&&s){let P=e.variants.find(ee=>ee.available&&ee.options.includes(s));return P||e.variants[0]}return e.variants[0]})(),[L,fe]=(0,Fe.useState)(H),S=L?.featured_image??T.find(P=>P.src===x||P.src.includes(x)),pe=(()=>{let P=e.options.findIndex(ee=>ee.name==="Strength");if(P>-1){let ee=`option${P+1}`;return L[ee]}return!1})();(0,Fe.useEffect)(()=>{if(ae){let P=(()=>{if(!pe){let ve=e.variants.find(Ye=>Ye.option1===ae);return ve||e.variants[0]}let ee=`option${e.options.findIndex(ve=>ve.name==="Strength")+1}`,D=e.variants.find(ve=>ve.option1===ae&&ve[ee]===pe);return D||D||e.variants[0]})();fe(P)}},[ae]);let Q=`Add for ${y.currencyNarrowSymbol}${y.amount.replace(".00","")}`,[be,ke]=(0,Fe.useState)(Q),Me=async P=>{P.preventDefault(),f(),de("Promotion - Cart","Added upsell item from inline promo recommendation",A);let ee=P.target.textContent;L.tags=$,v(!0),ke("Adding..."),await o(L),ke("Added!"),v(!1),setTimeout(()=>{ke(ee)},2e3)},je=!1,Ae=()=>null,Le=4;return(0,W.jsxs)("div",{className:`Component__SideCartPromotionRecommendationProduct ${c?"block":"hidden"}`,children:[(0,W.jsxs)("div",{className:"flex items-center justify-center mx-0 text-center bg-white js-product-thumbnail mb-2 md:w-auto flex-row py-0.5 md:py-2 border border-dashed border-[rgba(0,0,0,0.2)]",children:[(0,W.jsx)("div",{className:"flex-1 w-full mb-2",children:(0,W.jsx)("img",{loading:"lazy",className:"block w-full h-auto max-w-full",src:ue(S.src,{width:256,height:128,crop:"center"}),width:S.width,height:S.height})}),(0,W.jsx)("div",{className:"flex-1 p-0 md:w-full",children:(0,W.jsxs)("div",{children:[je?(0,W.jsxs)("button",{onClick:Ae,className:"mt-2 mb-1 text-sm font-bold link",children:[G," ",je&&(0,W.jsx)(QuestionMarkCircleIcon,{className:"w-6 h-6 ml-1 text-primary","aria-hidden":"true"})]}):(0,W.jsx)("a",{href:q,className:"mt-2 mb-1 text-sm font-bold link",children:G}),B&&(0,W.jsx)(Ie,{value:ae,onChange:oe,children:(0,W.jsx)("div",{className:"flex flex-wrap justify-center px-3 pt-3 md:pt-4 gap-y-2 gap-x-3",children:B.map((P,ee)=>ee<Le?(0,W.jsxs)(Ie.Option,{value:P.variantColor,className:({active:D,checked:ve})=>at(D||ve?"border border-black":"","-m-0.5 relative p-0.5 rounded-full flex items-center justify-center cursor-pointer focus:outline-none"),children:[(0,W.jsx)(Ie.Label,{as:"p",className:"sr-only",children:P.variantColor}),(0,W.jsx)("span",{"aria-hidden":"true",title:P.variantColor,className:"h-5 w-5 border border-black border-opacity-10 rounded-full",style:{background:P.image?`url('${P.image}')`:P.hex}})]},P.variantColor):null)})}),pe&&(0,W.jsxs)("div",{className:"mt-2 text-xs truncate",children:[(0,W.jsx)("span",{className:"font-semibold",children:"Strength: "}),(0,W.jsx)("span",{className:"italic",children:pe})]})]})})]}),e?.reason?.type==="cart"&&(0,W.jsxs)("div",{className:"mt-1 mb-2 text-[11px] md:text-xs text-center text-secondary italic",children:["Because you added ",(0,W.jsx)("strong",{children:e.reason.product.title.split(" - ")[0].replace(" (Blue Light)","")})," ","to your cart"]}),(0,W.jsxs)("div",{className:"flex items-center justify-between gap-12 px-2",children:[l?(0,W.jsxs)("div",{className:"text-sm italic font-medium leading-none text-transparent",children:["Previous",(0,W.jsx)("span",{className:"sr-only",children:" not possible, at beginning"})]}):(0,W.jsx)("button",{className:"text-sm italic font-medium leading-none text-primary",onClick:()=>u(),children:"Previous"}),(0,W.jsx)("button",{className:"w-full py-1 btn-ghost",onClick:je?Ae:Me,children:be}),n?(0,W.jsxs)("div",{className:"text-sm italic font-medium leading-none text-transparent",children:["Next",(0,W.jsx)("span",{className:"sr-only",children:" not possible, at end"})]}):(0,W.jsx)("button",{className:"text-sm italic font-medium leading-none text-primary",onClick:()=>h(),children:"Next"})]})]})}var wa=_s;var he=E(Y());function ks({isBfcm:e,totalPrice:o,totalNumberOfFullPriceItems:s,metRequiredEmailViaFormId:c,settings:l,recommendedItems:n,addSelectedVariantToCart:u,isActive:h,defaultStrengthSelection:f,showRecommendations:g}){let[m,p]=(0,mo.useState)(!0),[v,x]=(0,mo.useState)(0),A=()=>x(H=>{let L=H+1;return L+1<=n.length?L:H}),O=()=>x(H=>{let L=H-1;return L>=0?L:H}),{id:T,enabled:z,minimumThresholdCA:I,minimumThresholdUS:$,minimumFullPriceItems:q,belowThresholdMessage:j,metThresholdMessage:y,requiredEmailViaFormId:C}=l;if(!z)return null;let G=Shopify.currency.active==="CAD"?I*100:$*100,M=te({amount:(G-o)/100}
1),k=q&&q>0?q-s:0,R=`${M.currencyNarrowSymbol}${M.amount.replace(".00","")}`,B=j.replace("[amount]",R).replace("$$","$").replace("[items]",k).replace("items",k===1?"item":"items").replace("frames",k===1?"frame":"frames").replace("glasses","glasses"),oe=q&&q>0?s/q*100:o/G*100,ae="Click to supply email address and qualify for free gift",re=oe>=100?C&&!c?ae:y:e?B.split(" from")[0]:B;return G<0?null:(0,he.jsxs)("aside",{className:"px-4 pt-2 pb-2 text-sm font-medium leading-tight border-b md:text-sm border-b-grey text-secondary lg:pt-4",children:[e?oe>=100?(0,he.jsx)("div",{className:"mb-1 w-full text-left",children:(0,he.jsx)("span",{className:`text-xs font-bold text-[#4752A3] ${re===ae?"cursor-pointer":""}`,onClick:H=>{re===ae&&(H.preventDefault(),window._klOnsite=window._klOnsite||[],window._klOnsite.push(["openForm",C]))},children:re})}):oe===0?(0,he.jsx)("div",{className:"mb-1 w-full text-left",children:(0,he.jsx)("span",{className:"text-xs font-medium text-gray-500",children:B})}):(0,he.jsx)("div",{className:"mb-1 w-full text-left",children:(0,he.jsxs)("span",{className:"text-xs font-bold text-[#4752A3] uppercase tracking-wide",children:["Only ",R," away!"]})}):(0,he.jsx)("div",{className:"flex relative justify-center w-full",children:(0,he.jsx)("p",{className:`py-2 text-base ${re===ae?"cursor-pointer":""}`,onClick:H=>{re===ae&&(H.preventDefault(),window._klOnsite=window._klOnsite||[],window._klOnsite.push(["openForm",C]))},children:re})}),(0,he.jsx)("div",{className:"flex flex-row items-center mt-0 md:mt-0",children:(0,he.jsx)("div",{className:"overflow-hidden w-full h-2 bg-gray-100 rounded-full shadow-inner",children:(0,he.jsx)("div",{style:{width:`${oe}%`},className:"h-full bg-gradient-to-r from-[#4752A3] to-[#8a2340] rounded-full transition-all duration-500 ease-out shadow-[0_0_10px_rgba(88,22,41,0.3)]"})})}),m&&h&&oe<100&&n&&n.length>0&&(0,he.jsxs)("div",{className:`relative flex-col items-center justify-center lg:flex ${g?"":"hidden"}`,children:[(0,he.jsx)("h3",{className:"mt-2 lg:mt-3 mb-1 text-[11px] md:text-xs font-bold tracking-wider uppercase",children:"To Help Qualify, We Recommend Adding"}),n.map((H,L)=>(0,he.jsx)("div",{className:"w-full h-full",children:(0,he.jsx)(wa,{isActive:L===v,isFirst:L===0,isLast:L+1===n.length,onRecommendationPrevious:O,onRecommendationNext:A,product:H,addSelectedVariantToCart:u,defaultStrengthSelection:f,onAddToCart:()=>{de("Promotion - Cart","Added upsell item from inline promo recommendation",`${M.amount} ${M.currencyCode}`)}})},`SideCartPromotionRecommendationProduct-${H.id}-${L}`))]})]})}var Ft=ks;var Ue=E(me());var qt=e=>{let{final_price:o,properties:s}=e;return s?.Note==="Closeout Item: No Refunds"||e?.discounts?.length>0&&e?.discounts?.[0]?.amount>0?!0:s?.["_compare-at-price"]?s["_compare-at-price"]>o:!1};var xe=E(Y()),uo="Sale Shelf - Cart",As=()=>{let e=new Set;for(let o of window.Peepers?.sale?.promotions||[])if(o.active){for(let s of o.priceRules||[])if(!s.message)for(let c of s.productNumbers||[])e.add(c)}return e},ya=e=>typeof e=="string"?Math.round(parseFloat(e)*100):e,Ps=e=>(e.options||[]).map(o=>typeof o=="string"?o:o.name),Ts=e=>!!e&&/\d/.test(e)&&parseFloat(e.replace("+",""))>0,Is=(e,o)=>{let s=Ps(e).findIndex(n=>n==="Strength");if(s===-1||!Ts(o))return{variant:e.variants[0],strengthMatched:!1};let c=`option${s+1}`,l=e.variants.find(n=>n[c]===o&&n.available!==!1);return l?{variant:l,strengthMatched:!0}:{variant:e.variants[0],strengthMatched:!1}};function Rs({item:e,collectionHandle:o,index:s}){let{product:c,prices:l,isFav:n,strengthMatched:u,strengthSelection:h}=e,f=Zo(c.title).base.trim(),g=c.images?.[0]?.src,m=te({amount:l.compareAtPriceCents/100}),p=te({amount:l.regularPriceCents/100}),v=/^\d/.test(h||"")?`+${h}`:h,x=n?"One of your favorites":u?`In your ${v}`:null;return(0,xe.jsxs)("a",{href:`/products/${c.handle}`,className:`flex flex-col flex-none items-center w-[136px] md:w-full md:flex-row md:items-center md:gap-2 bg-white rounded-lg shadow-sm p-2.5 md:p-2 no-underline snap-start ${s>2?"md:hidden":""}`,onClick:()=>de(uo,"Clicked product",`${c.handle} (${o})`),children:[g&&(0,xe.jsx)("span",{className:"block overflow-hidden w-full h-[62px] md:w-[84px] md:h-[42px] md:flex-none rounded",children:(0,xe.jsx)("img",{src:ue(g,{width:416,height:208,crop:"center"}),alt:f,loading:"lazy",width:"124",height:"62",className:"object-cover w-full h-full scale-110"})}),(0,xe.jsxs)("span",{className:"flex flex-col items-center md:items-start min-w-0",children:[(0,xe.jsx)("span",{className:"mt-1.5 md:mt-0 w-full text-sm font-medium text-center md:text-left truncate text-default",children:f}),(0,xe.jsxs)("span",{className:"flex gap-1.5 items-baseline mt-0.5 text-sm",children:[(0,xe.jsxs)("s",{className:"font-light text-charcoal/60",children:[m.currencyNarrowSymbol,m.amount.replace(".00","")]}),(0,xe.jsxs)("span",{className:"font-semibold text-primary",children:[p.currencyNarrowSymbol,p.amount.replace(".00","")]})]}),x&&(0,xe.jsxs)("span",{className:"mt-0.5 text-xs leading-tight text-center md:text-left text-secondary/80",children:[n?"\u2665 ":"",x]})]})]})}function Es({settings:e,shopifyCart:o,isCartOpen:s,hidden:c,defaultStrengthSelection:l}){let n=e.saleShelf||{},u=n.collectionHandle,h=window.Peepers?.sale?.meta,[f,g]=(0,Ue.useState)(null),m=(0,Ue.useRef)(!1),p=o.items.some(T=>qt(T)),v=!!n.enabled&&!!u&&!!h&&!c&&o.items.length>0&&!p;(0,Ue.useEffect)(()=>
1{if(!v||!s||f!==null)return;let T=!1;return fetch(`/collections/${u}/products.json?limit=50`).then(z=>z.ok?z.json():{products:[]}).then(z=>{T||g(z.products||[])}).catch(()=>{T||g([])}),()=>{T=!0}},[v,s]);let x=(0,Ue.useMemo)(()=>{if(!f||f.length===0)return[];let T=As(),z=window.Peepers?.favs?.productNumbers||new Set;return f.map(I=>{let{variant:$,strengthMatched:q}=Is(I,l);if(!$?.sku)return null;let j=pt($.sku);if(!j||!T.has(j))return null;let y=ya($.price),C=Xo({priceCents:y,compareAtPriceCents:ya($.compare_at_price)||y,tags:I.tags||[],sku:$.sku});return!C.priceSaleCents||C.regularPriceCents>=C.compareAtPriceCents?null:{product:I,prices:C,isFav:z.has(j),strengthMatched:q,strengthSelection:l,tier:z.has(j)?0:1}}).filter(Boolean).sort((I,$)=>I.tier-$.tier).slice(0,8)},[f,l]),A=x.some(T=>T.isFav);if((0,Ue.useEffect)(()=>{!v||!s||x.length===0||m.current||(m.current=!0,de(uo,"Shown",A?"with favorites":"generic"))},[v,s,x.length]),!v||x.length===0)return null;let O=A&&n.favsHeading?n.favsHeading:n.heading;return(0,xe.jsxs)("div",{className:"Component__SideCartSaleShelf bg-[#F2F0EB] px-4 pt-5 pb-3 md:-mx-[28px] md:px-[28px] border-b border-secondary/10",children:[(0,xe.jsxs)("div",{className:"flex justify-between items-baseline mb-3 gap-3 md:flex-col md:items-start md:gap-1.5",children:[(0,xe.jsx)("h4",{className:"text-lg font-secondary font-normal text-secondary tracking-tight leading-tight",children:O}),(0,xe.jsx)("a",{href:`/collections/${u}`,className:"flex-none text-xs font-primary font-medium text-secondary tracking-wider uppercase border-b border-secondary/30 pb-0.5 hover:border-secondary transition-colors duration-200 no-underline whitespace-nowrap",onClick:()=>de(uo,"Clicked shop all",u),children:"Shop all"})]}),(0,xe.jsx)("div",{className:"flex overflow-x-auto gap-2.5 pb-2 snap-x md:flex-col md:overflow-x-visible",style:{contain:"content"},children:x.map((T,z)=>(0,xe.jsx)(Rs,{item:T,collectionHandle:u,index:z},T.product.id))})]})}var Na=Es;var $n=E(me());var ne=E(Y()),Ms=({promotions:e,isBfcm:o,areItemsExpanded:s,promotionsOpen:c,setPromotionsOpen:l,trackGaEvent:n,activePromotionIndex:u,setActivePromotion:h,firstIncompletePromotionIndex:f,promoScrollRef:g,totalPrice:m,countRegularPriceItems:p,shopifyCart:v,addSelectedVariantToCart:x,defaultStrengthSelection:A,settings:O,desktopAccessoriesUpsellPosition:T,recommendedItems:z})=>!o||e?.filter(I=>I.enableIndicator).length<=1||s||!c?null:(0,ne.jsxs)("div",{className:"hidden lg:flex flex-col border-r border-[#e9ebed] lg:w-[400px] rounded-xl overflow-hidden shadow-sm",style:{"--flex-basis-desktop":`${100/e.length}%`},children:[(0,ne.jsx)("div",{className:"bg-[#4752A3] text-white text-center py-[1.3rem] px-2 text-lg font-secondary relative",children:(0,ne.jsx)("span",{children:"Sale Promotions"})}),(0,ne.jsxs)("div",{className:"relative px-4 py-4 bg-white",children:[(0,ne.jsx)("div",{className:"absolute left-[26px] top-4 w-0.5 bg-gray-100",style:{height:"calc(100% - 2rem)"},"aria-hidden":"true"}),e.filter(I=>I.enableIndicator).map((I,$)=>{let{indicatorMarkup:q}=I,j=e.filter(M=>M.enableIndicator),y=$===j.length-1,C=u>-1&&$===u,G=f===-1||$<f;return(0,ne.jsxs)("div",{children:[(0,ne.jsxs)("button",{className:`relative flex items-start w-full text-left group rounded-lg pl-1 py-1 -ml-1 ${!y&&!C?"pb-6":""} ${C?"bg-[#4752A3]/5 scale-[1.01]":""} transition-all duration-300`,onClick:()=>{h($)},type:"button",children:[(0,ne.jsx)("div",{className:`z-10 flex items-center justify-center flex-shrink-0 w-6 h-6 rounded-full ring-4 ring-white transition-all duration-300 ${G&&!C?"bg-[#4752A3] text-white opacity-60":G&&C?"bg-[#4752A3] text-white shadow-sm scale-110":C?"bg-white border-2 border-[#4752A3] text-transparent shadow-sm scale-110":"bg-white border-2 border-gray-200 text-transparent"}`,children:(0,ne.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"w-3.5 h-3.5",children:(0,ne.jsx)("path",{fillRule:"evenodd",d:"M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z",clipRule:"evenodd"})})}),(0,ne.jsx)("div",{className:`flex flex-col pr-4 mt-0.5 ml-3 w-full ${G&&!C?"opacity-60":""}`,children:(0,ne.jsx)("span",{className:`text-xs flex items-center gap-2 transition-colors duration-300 ${G?"font-semibold text-[#4752A3]":C?"font-bold text-[#4752A3]":"font-medium text-gray-500"}`,children:q})})]}),(0,ne.jsxs)("div",{className:C&&!y?"pb-6":"",children:[C&&s===!1&&(0,ne.jsx)("div",{ref:g,className:"overflow-x-scroll w-full no-scrollbar",children:(0,ne.jsx)("div",{style:{"--container-width-desktop":`${e?.filter(M=>M.showMeter).length*100}%`,"--promotion-width-desktop":`${100/e?.filter(M=>M.showMeter).length}%`},className:"flex w-full",children:e?.filter(M=>M.showMeter).map((M,k)=>{let{meterSettings:R,recommendedItems:B}=M,oe=u>-1&&k===u;return(0,ne.jsx)("div",{className:`${$===k?"block":"hidden"} w-full`,children:(0,ne.jsx)(Ft,{isBfcm:o,isActive:oe,settings:R,totalPrice:m,totalNumberOfFullPriceItems:p,metRequiredEmailViaFormId:v?.attributes?._isConditionalGWPEligible,re
1commendedItems:B,addSelectedVariantToCart:x,defaultStrengthSelection:A,showRecommendations:s})},R.id)})})}),!1]})]},`promotion-${I.id}`)})]}),T===1&&(0,ne.jsxs)("div",{className:"order-2 md:h-full md:px-3 md:order-2 bg-[#ededed] border-t border-solid border-[#cccccc] md:border-0 md:overflow-y-scroll z-[1]",children:[(0,ne.jsx)("h4",{className:"my-5 text-xl text-center font-secondary text-default",children:O.recommendedProducts.header}),(0,ne.jsx)("div",{className:"block gap-4 mt-3 whitespace-nowrap lg:gap-x-4 lg:gap-y-4 md:grid md:grid-cols-2 md:whitespace-normal md:overflow-hidden",children:O.recommendedProducts&&z&&z.map((I,$)=>$+1>4?null:(0,ne.jsx)(zt,{item:I,addSelectedVariantToCart:x},I.product.id))})]})]}),Sa=Ms;var We=E(me());var X=E(Y());function Ds({defaultGender:e}){let[o,s]=(0,We.useState)(null),[c,l]=(0,We.useState)(!1),[n,u]=(0,We.useState)(null),[h,f]=(0,We.useState)(e),{featured_image:g,title:m,description:p,price:v=0}=o||{},x=te({amount:v/100});Ee(ge.To.MysteryItemDialog.RequestOpen,H=>{s(H.item),l(!0)});let{products:A,allVariants:O}=Lt(o),[T]=O,[z]=O,{allOption1Values:I,possibleOption2Values:$,possibleOption3Values:q,selectedOptions:j,handleOptionChange:y,selectedVariant:C,shouldShowOptionValue:G,isOptionSoldOut:M,shouldDisableOptionValue:k,shouldShowOption:R}=sa({products:A,allVariants:O,representativeVariant:T}),B=ra({selectedOptions:j,selectedVariant:C,referenceVariant:z,representativeVariant:T});if(ut(c),!o||!g||O.length===0)return null;let oe=Dt(),ae=async()=>{let L={};C?.product?.tags.find(S=>S.toLowerCase()===oe?.productTagRequirement)&&(L[Mt]=!0);let fe=await It(C.id.toString(),1,L);Ot(fe)},re=async H=>{H.preventDefault(),await ae(),l(!1)};return(0,X.jsx)(Ne.Root,{show:c,as:We.Fragment,children:(0,X.jsxs)(ye,{as:"div",className:"relative z-index-max",onClose:l,ref:st(l),children:[(0,X.jsx)(Ne.Child,{as:We.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,X.jsx)("div",{className:"fixed inset-0 transition-opacity bg-black/50"})}),(0,X.jsx)("div",{className:"fixed inset-0 z-10 overflow-y-auto",children:(0,X.jsx)("div",{className:"flex items-center justify-center min-h-full p-4 text-left sm:items-center sm:p-0",children:(0,X.jsx)(Ne.Child,{as:We.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",enterTo:"opacity-100 translate-y-0 sm:scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-y-0 sm:scale-100",leaveTo:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",children:(0,X.jsxs)(ye.Panel,{className:"relative flex flex-row items-center justify-center px-4 pt-8 pb-4 overflow-hidden text-left transition-all transform bg-white shadow-xl md:pt-5 md:gap-6 sm:my-8 md:max-w-4xl sm:w-full sm:p-6",children:[(0,X.jsxs)("button",{type:"button",className:"absolute top-0 right-0 p-1 text-white bg-secondary focus:outline-none focus:ring-2 focus:ring-white",onClick:()=>l(!1),children:[(0,X.jsx)("span",{className:"sr-only",children:"Close panel"}),(0,X.jsx)(He,{className:"w-6 h-6","aria-hidden":"true"})]}),(0,X.jsx)("div",{children:(0,X.jsx)("img",{loading:"lazy",className:"hidden w-full h-auto max-w-full md:block",src:ue(g,{width:412}),width:"412px"})}),(0,X.jsxs)("div",{children:[(0,X.jsxs)("div",{className:"mt-3 text-left sm:mt-5",children:[(0,X.jsxs)("div",{className:"flex justify-between pb-2 mt-0 mb-3 text-center lg:text-left",children:[(0,X.jsx)(ye.Title,{as:"h3",className:"text-2xl font-medium",children:m}),(0,X.jsxs)("div",{className:"text-lg font-semibold leading-relaxed lg:pl-1",children:[x?.currencyNarrowSymbol??"",x.amount.replace(".00","")]})]}),(0,X.jsx)("div",{className:"rte condensed px-1.5 lg:px-0",dangerouslySetInnerHTML:{__html:p}}),(0,X.jsx)("div",{className:"px-2 mt-3 text-left text-default",children:T.options.map((H,L)=>{let fe=`option${L+1}`,S={name:H.name,values:L===0?I:L===1?$:L===2?q:null,position:L+1,type:H.type},pe=[...S.values].filter(Q=>G(fe,Q));return R(fe)&&(0,X.jsxs)("div",{className:"",children:[S.name==="Gender"&&(()=>{let Q=["Select a gender"].concat(pe),be=j[L]?j[L]:h??Q[1];return(0,X.jsx)(na,{selectedOption:be,label:S.name,option:S,values:Q,optionKey:fe,optionIndex:L,selectedVariant:C,handleOptionChange:y,requirePreviousOptionSelectionToShowNext:!0,shouldShowOptionValue:G,shouldDisableOptionValue:k,isOptionSoldOut:M,optionNamePrefix:"Mystery"})})(),S.name==="Lens"&&(()=>{let Q=pe,be=j[L]?j[L]:n??Q[1];
1return(0,X.jsx)(ia,{selectedOption:be,allValues:[...new Set(O.map(ke=>ke.options.find(Me=>Me.name==="Lens").value))],label:S.name,option:S,values:Q,optionKey:fe,optionIndex:L,selectedVariant:C,handleOptionChange:y,requirePreviousOptionSelectionToShowNext:!0,shouldShowOptionValue:G,shouldDisableOptionValue:k,isOptionSoldOut:M,optionNamePrefix:"Mystery"})})(),S.name==="Strength"&&(()=>{let Q=pe,be=j[L]?j[L]:mt.selection?Q.find(ke=>ke===mt.selection)??null:null;return(0,X.jsx)(la,{selectedVariant:C,selectedOption:be,option:S,values:Q,optionKey:fe,optionIndex:L,handleOptionChange:y,requirePreviousOptionSelectionToShowNext:!0,shouldShowOptionValue:G,shouldDisableOptionValue:k,isOptionSoldOut:M,showSecondaryInfo:!1,optionNamePrefix:"Mystery"})})()]},`${H.name}-${L}`)})})]}),(0,X.jsx)("div",{className:"mt-5 sm:mt-6",children:(0,X.jsx)("button",{type:"button",className:"w-full text-base btn-primary lg:py-6",disabled:!C,onClick:H=>re(H),children:B})})]})]})})})})]})})}var Ca=Ds;var we=E(me());var _=E(Y());function Os(){let[e,o]=(0,we.useState)(null),[s,c]=(0,we.useState)(!1),[l,n]=(0,we.useState)(!0),[u,h]=(0,we.useState)(""),[f,g]=(0,we.useState)(""),[m,p]=(0,we.useState)(new Date().toISOString().split("T")[0]),[v,x]=(0,we.useState)(""),[A,O]=(0,we.useState)(""),{featured_image:T,title:z,description:I}=e||{};Ee(ge.To.GiftCardDialog.RequestOpen,R=>{o(R.item),c(!0)});let{allVariants:$}=Lt(e),q=["$30.00","$50.00","$100.00"],j=$.length>0?$.find(R=>R.options[0].value===q[0]):null,[y,C]=(0,we.useState)(j);(0,we.useEffect)(()=>{C(j)},[j?.id]),(0,we.useEffect)(()=>{let R=$.find(B=>B.options[0].value===`$${A}.00`);R&&C(R)},[A]);let G=[...new Set($.map(R=>R.option1))];if(ut(s),!e||!T||$.length===0||!y)return null;let M=async()=>{let B={};B["_Send To Self"]=!l,B["Recipient Name"]=u,B["Recipient Email"]=f,B["Delivery Date"]=m,B["Gift Note"]=v,B["_Send Copy To Self"]=!1,B["_Notify Sender"]=!1,B["_Card Image"]=T.includes("https:")?T:`https:${T}`;let oe=await It(y.id.toString(),1,B);Ot(oe)},k=async R=>{R.preventDefault(),de("Gift Card - Cart","Added gift card from recommended cart items"),await M(),c(!1)};return(0,_.jsx)(Ne.Root,{show:s,as:we.Fragment,children:(0,_.jsxs)(ye,{as:"div",className:"relative z-index-max",onClose:c,ref:st(c),children:[(0,_.jsx)(Ne.Child,{as:we.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,_.jsx)("div",{className:"fixed inset-0 transition-opacity bg-black/50"})}),(0,_.jsx)("div",{className:"fixed inset-0 z-10 overflow-y-auto",children:(0,_.jsx)("div",{className:"flex items-center justify-center min-h-full p-4 text-left sm:items-center sm:p-0",children:(0,_.jsx)(Ne.Child,{as:we.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",enterTo:"opacity-100 translate-y-0 sm:scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-y-0 sm:scale-100",leaveTo:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",children:(0,_.jsxs)(ye.Panel,{className:"relative flex flex-col items-center justify-center px-4 pt-8 pb-4 overflow-hidden text-left transition-all transform bg-white shadow-xl md:pt-5 md:gap-6 sm:my-8 md:max-w-lg sm:w-full sm:p-6",children:[(0,_.jsxs)("button",{type:"button",className:"absolute top-0 right-0 p-1 text-white bg-secondary focus:outline-none focus:ring-2 focus:ring-white",onClick:()=>c(!1),children:[(0,_.jsx)("span",{className:"sr-only",children:"Close panel"}),(0,_.jsx)(He,{className:"w-6 h-6","aria-hidden":"true"})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("h2",{className:"text-2xl font-bold",children:z}),(0,_.jsx)("div",{dangerouslySetInnerHTML:{__html:I}})]}),(0,_.jsx)("div",{children:(0,_.jsx)("img",{loading:"lazy",className:"hidden w-full h-auto max-w-full md:block",src:ue(T,{width:412}),width:"412px"})}),(0,_.jsxs)("form",{className:"w-full px-8",onSubmit:k,children:[(0,_.jsx)("div",{children:(0,_.jsxs)("div",{className:"flex justify-between w-full gap-3",children:[(0,_.jsxs)("div",{className:"w-1/2",children:[(0,_.jsx)("div",{className:"block text-sm font-medium text-gray-700",children:"Amount"}),(0,_.jsx)("div",{className:"flex justify-between gap-2 mt-1",children:G.filter(R=>q.includes(R)).map((R,B)=>{let oe=y.options[0].value===R,ae=!1;return(0,_.jsxs)("div",{className:"inline-block text-center basis-1/3 whitespace-nowrap",children:[(0,_.jsx)("input",{type:"radio",value:R,id:B,name:"amount",defaultChecked:oe,disabled:ae,className:"sr-only"}),(0,_.jsx)("label",{role:"button",tabIndex:"0",htmlFor:B,title:R,className:`block cursor-pointer leading-loose p-1.5 lg:px-2 w-full text-xs lg:text-sm border border-solid border-default letter-spacing-[0.1px] ${oe?"font-bold shadow-[inset_0_0_0_1px_var(--color-default)]":""} ${ae?"bg-[#e5e5e5] line-through opacity-50":""}`,onClick:re=>C($.find(H=>H.options[0].value===R)),children:(0,_.jsx)("span",{children:R.replace(".00","")})})]},R)})})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("label",{htmlFor:"customAmount",className:"block text-sm font-medium text-gray-700",children:"Custom amount"}),(0,_.jsxs)("div",{className:"relative mt-1",children:[(0,_.jsx)("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none",children:(0,_.jsx)(oa,{className:"w-5 h-5 text-gray-400","aria-hidden":"true"})}),(0,_.jsx)("input",{type:"number",min:"1",step:"1",max:"100",name:"customAmount",id:"customAmount",value:A,onChange:R=>O(R.target.value),className:"block w-full pl-10 pr-3 py-2.5 border border-solid border-default focus:border-peepersnavy-500 focus:ring-peepersnavy-500 sm:text-sm"})]})]})]})}),(0,_.jsxs)("div",{children:[(0,_.jsxs)("div",{className:"flex flex-col py-4 my-4 mb-8 border-t border-b border-gray-700",children:[(0,_.jsx)("label",{className:"block mb-2 text-sm font-medium text-center",children:"This gift card
1is for: "}),(0,_.jsxs)("div",{className:"flex items-center gap-6",children:[(0,_.jsx)("div",{className:`basis-1/3 block text-sm text-right ${l?"font-normal":"font-bold"}`,children:"myself"}),(0,_.jsxs)(Qo,{checked:l,onChange:()=>{n(!l)},className:`bg-peepersnavy 2 relative inline-flex h-[38px] w-[74px] shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75`,children:[(0,_.jsx)("span",{className:"sr-only",children:"Use setting"}),(0,_.jsx)("span",{"aria-hidden":"true",className:`${l?"translate-x-9":"translate-x-0"} 3 pointer-events-none inline-block h-[34px] w-[34px] transform rounded-full bg-white shadow-lg ring-0 transition duration-200 ease-in-out`})]}),(0,_.jsx)("div",{className:`basis-1/3 block text-sm ${l?"font-bold":"font-normal"}`,children:"someone else"})]})]}),l&&(0,_.jsxs)("div",{className:"mt-4",children:[(0,_.jsx)("label",{htmlFor:"recipientName",className:"block text-sm font-medium text-gray-700",children:"Recipient Name"}),(0,_.jsx)("div",{className:"mt-1",children:(0,_.jsx)("input",{type:"text",name:"recipientName",id:"recipientName",required:l,value:u,onChange:R=>h(R.target.value),className:"block w-full px-3 py-2 border border-solid border-default focus:border-peepersnavy-500 focus:ring-peepersnavy-500 sm:text-sm"})})]}),l&&(0,_.jsxs)("div",{className:"mt-4",children:[(0,_.jsx)("label",{htmlFor:"recipientEmail",className:"block text-sm font-medium text-gray-700",children:"Recipient Email"}),(0,_.jsxs)("div",{className:"relative mt-1",children:[(0,_.jsx)("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none",children:(0,_.jsx)(aa,{className:"w-5 h-5 text-gray-400","aria-hidden":"true"})}),(0,_.jsx)("input",{type:"email",name:"recipientEmail",id:"recipientEmail",value:f,required:l,onChange:R=>g(R.target.value),className:"block w-full py-2 pl-10 pr-3 border border-solid border-default focus:border-peepersnavy-500 focus:ring-peepersnavy-500 sm:text-sm",placeholder:"[email protected]"})]})]}),l&&(0,_.jsxs)("div",{className:"mt-4",children:[(0,_.jsx)("label",{htmlFor:"deliveryDate",className:"block text-sm font-medium text-gray-700",children:"Delivery Date"}),(0,_.jsx)("div",{className:"mt-1",children:(0,_.jsx)("input",{type:"date",min:new Date().toISOString().split("T")[0],name:"deliveryDate",id:"deliveryDate",required:l,value:m,onChange:R=>p(R.target.value),className:"block w-full px-3 py-2 border border-solid border-default focus:border-peepersnavy-500 focus:ring-peepersnavy-500 sm:text-sm"})})]}),l&&(0,_.jsxs)("div",{className:"mt-4",children:[(0,_.jsx)("label",{htmlFor:"giftNote",className:"block text-sm font-medium text-gray-700",children:"Add Your Gift Note"}),(0,_.jsx)("div",{className:"mt-1",children:(0,_.jsx)("textarea",{rows:4,name:"giftNote",id:"giftNote",onChange:R=>x(R.target.value),className:"block w-full px-3 py-2 border border-solid border-default focus:border-peepersnavy-500 focus:ring-peepersnavy-500 sm:text-sm",value:v})})]}),(0,_.jsx)("div",{className:"mt-5 sm:mt-6",children:(0,_.jsx)("button",{type:"submit",className:"w-full text-base btn-primary lg:py-6",disabled:!1,children:"Add To Cart"})})]})]})]})})})})]})})}var _a=Os;var _e=E(me());var bt=E(me());var Z=E(Y()),$s=e=>(e.options||[]).map(o=>typeof o=="string"?o:o.name),ka=(e,o)=>e[`option${o+1}`]??e.options?.[o],jt=e=>e?.src??e?.url??null;function Ls({cents:e}){let o=te({amount:(e||0)/100});return e>0?(0,Z.jsxs)("span",{className:"gwp-dlg__value",children:[(0,Z.jsx)("s",{"aria-hidden":"true",children:`${o.currencyNarrowSymbol}${o.amount.replace(".00","")}`}),(0,Z.jsx)("span",{className:"sr-only",children:`${o.currencyNarrowSymbol}${o.amount} value, `}),(0,Z.jsx)("span",{className:"gwp-dlg__free",children:"Free"})]}):(0,Z.jsx)("span",{className:"gwp-dlg__free",children:"Free"})}function Bs({product:e,selectedVariantId:o,onSelect:s,layout:c="card",decoration:l=null,children:n}){let u=(0,bt.useContext)(ze).swatches,h=rt(e.title),f=(0,bt.useMemo)(()=>(e.variants||[]).filter(y=>y.available),[e.variants]),g=$s(e).findIndex(y=>y==="Color"),m=f.find(y=>y.id===o)??null,p=(0,bt.useMemo)(()=>
3{if(g===-1)return[];let y=new Map;for(let C of f){let G=ka(C,g);G&&!y.has(G)&&y.set(G,C)}return[...y.entries()].map(([C,G])=>{let M=C.split("/"),k=u.find(R=>R.color===C)??M.map(R=>u.find(B=>B.color===R)).find(Boolean);return{color:C,variant:G,swatch:k}})},[u,f,g]),v=p[0]?.variant??f[0]??null,x=m??v,A=e.featured_image??e.media?.[0],O=!!m,T=m&&g!==-1?ka(m,g):null,z=(0,bt.useMemo)(()=>(p.length?p.map(({variant:C})=>({id:C.id,src:jt(C.featured_image)??jt(A)})):[{id:x?.id??"product",src:jt(x?.featured_image)??jt(A)}]).filter(C=>C.src),[p,x,A]),I=z.some(y=>y.id===x?.id)?x?.id:z[0]?.id,$=(0,Z.jsx)("div",{className:at("gwp-dlg__stage",c==="card"&&"gwp-dlg__stage--thumb"),"aria-hidden":"true",children:z.map(y=>(0,Z.jsx)("img",{className:"gwp-dlg__photo","data-visible":y.id===I,src:ue(y.src,{width:c==="hero"?960:320}),alt:"",loading:"eager",decoding:"async"},y.id))}),q=(0,Z.jsxs)("div",{className:"gwp-dlg__name-row",children:[(0,Z.jsxs)("span",{className:"gwp-dlg__name",children:[h.base,h.parenthetical&&(0,Z.jsx)("span",{className:"gwp-dlg__name-sub",children:h.parenthetical})]}),v?(0,Z.jsx)(Ls,{cents:x?.price}):(0,Z.jsx)("span",{className:"gwp-dlg__unavailable",children:"Unavailable"})]}),j=p.length>1&&(0,Z.jsxs)(Ie,{value:T,onChange:y=>s(p.find(C=>C.color===y).variant),className:"gwp-dlg__colors",children:[(0,Z.jsxs)(Ie.Label,{className:"gwp-dlg__colors-label",children:["Color",T?":":""," ",(0,Z.jsx)("span",{className:"gwp-dlg__colors-value",children:T}),(0,Z.jsxs)("span",{className:"sr-only",children:[" \u2014 choose a color for your free ",h.base]})]}),(0,Z.jsx)("div",{className:"gwp-dlg__swatches",children:p.map(({color:y,swatch:C})=>(0,Z.jsxs)(Ie.Option,{value:y,title:y,className:"gwp-dlg__swatch",children:[(0,Z.jsx)(Ie.Label,{className:"sr-only",children:y}),(0,Z.jsx)("span",{"aria-hidden":"true",className:"gwp-dlg__swatch-fill",style:{background:C?.image?`center / cover url('${C.image.replace(/_24x(?=\.)/,"_120x")}')`:C?.hex??"#e5e5e5"}})]},y))})]});return c==="hero"?(0,Z.jsxs)("div",{className:"gwp-dlg__hero",children:[(0,Z.jsxs)("div",{className:"gwp-dlg__lid",children:[$,l]}),(0,Z.jsxs)("div",{className:"gwp-dlg__body",children:[n,q,j]})]}):(0,Z.jsxs)("div",{className:at("gwp-dlg__card",O&&"is-selected"),children:[(0,Z.jsxs)("button",{type:"button",className:"gwp-dlg__card-hit",disabled:!v,"aria-pressed":O,onClick:()=>v&&s(v),children:[$,q]}),j]})}var fo=Bs;var Aa="Free Gift With Purchase!",Gs=(e,o)=>o==="USD"?e.minSpendCents??0:o==="CAD"?e.minSpendCentsCA>0?e.minSpendCentsCA:(e.minSpendCents??0)===0?0:null:null,zs=e=>Number(String(e).split("/").pop()),Fs=(e,o)=>{if(!o?.length)return e;let s=l=>o.indexOf(pt(l.sku)),c=(e.variants||[]).filter(l=>s(l)!==-1).sort((l,n)=>s(l)-s(n));return{...e,variants:c}},_t=e=>(e||[]).flatMap(o=>(o.variants||[]).filter(s=>s.available)),qs=e=>e.giftType!=="product"||e.tiers.some(o=>o.thresholdCents!==null&&_t(o.products).length>0),js=(e,o)=>o.size===0?e:{...e,variants:(e.variants||[]).map(s=>o.has(String(s.id))?{...s,available:!1}:s)},Pa=(e,{currency:o,now:s=Date.now(),soldOutVariantIds:c=[]}={})=>{let l=new Set(c.map(String));return(e||[]).filter(n=>n.staged||!n.startsAt||s>=n.startsAt).filter(n=>!n.endsAt||s<=n.endsAt).map(n=>{let u=(n.products||[]).map(f=>js(f,l)),h=(n.tiers||[]).map(f=>({...f,thresholdCents:Gs(f,o),products:(f.giftProductIds||[]).map(g=>u.find(m=>m.id===zs(g))).filter(Boolean).map(g=>Fs(g,f.giftProductNumbers))}));return{...n,products:u,eligibility:n.eligibility||{},themeGates:n.themeGates||{},display:n.display||{},tiers:h}}).filter(n=>n.tiers.some(u=>u.thresholdCents!==null)).filter(qs)},Ht=e=>!!e?.properties?._gwpId,Hs=e=>(e?.items||[]).reduce((o,s)=>Ht(s)?o:o+(s.final_line_price??0),0),Vs=(e,o)=>{let s=new Set(o.eligibility.qualifyingProductNumbers||[]);return s.size===0?0:(e?.items||[]).reduce((c,l)=>{if(Ht(l))return c;let n=pt(l.sku);return n&&s.has(n)?c+l.quantity:c},0)},Us=e=>{if(e?.properties?.Note==="Closeout Item: No Refunds"||e?.discounts?.length>0&&e.discounts[0]?.amount>0)return!0;let o=e?.properties?.["_compare-at-price"];return!!(o&&o>e.final_price)},Ws=e=>(e?.items||[]).filter(o=>!Ht(o)&&!Us(o)).filter(o=>["Readers","Progressives","Sunglasses"].includes(o.product_type)).reduce((o,s)=>o+s.quantity,0),Ys=e=>(e?.items||[]).filter(o=>!Ht(o)&&o.product_type==="Sunglasses").filter(o=>(o.variant_title||"").toLowerCase().includes("no correction")).reduce((o,s)=>o+s.quantity,0),Ks=(e,o,{href:s="",klaviyoIdentified:c=!1}={})=>{let l=o.themeGates;return!(l.requiredLandingPageSubstring&&!(s.includes(l.requiredLandingPageSubstring)||(e?.attributes?._klaviyoLandingPage||"").includes(l.requiredLandingPageSubstring))||l.requiredKlaviyoFormId&&!c&&!e?.attributes?._isConditionalGWPEligible||l.minFullPriceItems>0&&Ws(e)<l.minFullPriceItems||l.minPolarizedSunItems>0&&Ys(e)<l.minPolarizedSunItems)},Ta=(e,o,s={})=>{let c=Hs(e),l=Ks(e,o,s),u=!(o.eligibility.qualifyingProductNumbers?.length&&o.eligibility.minQualifyingCount)||Vs(e,o)>=o.eligibility.minQualifyingCount,h=null,f=-1;for(let m of o.tiers)m.thresholdCents!==null&&c>=m.thresholdCents&&m.thresholdCents>f&&(f=m.thresholdCents,h=m);let g=o.tiers.map(m=>m.thresholdCents).filter(m=>m!==null&&m>c).sort((m,p)=>m-p)[0];return{offer:o,spendCents:c,gatesPass:l,countPass:u,qualifies:l&&u&&h!==null,winningTier:l&&u?h:null,nextThresholdCents:g??null}},vt=e=>({_gwpId:e.id,_gwpDiscountMessage:e.display.discountMessage||Aa}),Ia=e=>{let o=e.tiers.filter(s=>s.thresholdCents!==null).sort((s,c)=>s.thresholdCents-c.thresholdCents)[0];
3return{...e,products:o?.products??[],selectionModal:e.display.selectionModal||{},discountMessage:e.display.discountMessage||Aa}},Ra=(e,o)=>{let s=pt(e.sku);return o.giftProductNumbers?.length?!!(s&&o.giftProductNumbers.includes(s)):(o.products||[]).some(c=>c.id===e.product_id)},Ea="_declinedGwp__",Vt=e=>`${Ea}${e}`,go=(e,o,s={})=>o.filter(c=>c.giftType==="product").map(c=>{let l=Ta(e,c,s),n=l.qualifies?l.winningTier:null,u=e?.attributes?.[Vt(c.id)]||null,h=n!==null&&(e?.items||[]).some(g=>g?.properties?._gwpId===c.id&&Ra(g,n)),f="available";return n?h?f="claimed":u&&(f="declined"):f="ineligible",{offer:c,status:f,tier:n,choices:n?_t(n.products):[],declinedAt:u}}),Ut=(e,o,s)=>(e?.items||[]).some(c=>c?.properties?._gwpId===o&&String(c.variant_id)===String(s)),Ma=(e,o)=>e?.gwp?.giftType!=="product"||(o||[]).some(s=>s.offer.id===e.id&&s.status==="claimed"),Da=(e,o=new Date)=>e?.status==="available"?{[Vt(e.offer.id)]:o.toISOString()}:null,Wt=e=>({[Vt(e.id)]:null}),Oa=(e,o,s={})=>{let c=o.map(v=>Ta(e,v,s)),l=new Map(c.map(v=>[v.offer.id,v])),n=go(e,o,s),u=[],h=[],f=[],g={},m=new Map;for(let v of e?.items||[]){let x=v?.properties?._gwpId;if(!x)continue;let A=l.get(x);if(!A||!A.qualifies||!Ra(v,A.winningTier)){h.push(v.key);continue}let O=Math.max(1,A.winningTier.maxGiftQuantity??1),T=m.get(x)??0,z=Math.max(0,O-T);if(z===0){h.push(v.key);continue}v.quantity>z&&f.push({id:v.key,quantity:z}),m.set(x,T+Math.min(v.quantity,z))}for(let{offer:v,tier:x,status:A,choices:O}of n)A!=="available"||O.length===0||(O.length===1?u.push({offer:v,tier:x,needsSelection:!1,variantId:String(O[0].id),properties:vt(v)}):u.push({offer:v,tier:x,needsSelection:!0,properties:vt(v)}));let p=new Map(n.map(v=>[Vt(v.offer.id),v]));for(let v of Object.keys(e?.attributes||{}).filter(x=>x.startsWith(Ea))){let x=p.get(v)?.status;(!x||x==="ineligible"||x==="claimed")&&(g[v]=null)}return{adds:u,removeKeys:h,quantityUpdates:f,attributeUpdates:Object.keys(g).length>0?g:null}},$a=(e,{currency:o})=>e.filter(s=>s.display.showMeter||s.display.showIndicator||s.display.showToast).map(s=>{let c=s.tiers.filter(n=>n.thresholdCents!==null).sort((n,u)=>n.thresholdCents-u.thresholdCents)[0];if(!c)return null;let l=["USD"];return s.tiers.some(n=>n.minSpendCentsCA>0||n.thresholdCents===0)&&l.push("CAD"),{id:s.id,completed:!1,showMeter:!!s.display.showMeter,meterSettings:{id:s.id,enabled:!!s.display.showMeter,minimumThresholdUS:(c.minSpendCents??0)/100,minimumThresholdCA:(c.minSpendCentsCA??0)/100,belowThresholdMessage:s.display.belowThresholdMessage||"",metThresholdMessage:s.display.metThresholdMessage||""},currencies:l,enableToast:!!s.display.showToast,showPromotionIndicator:!!s.display.showIndicator,indicatorText:s.display.indicatorText||"",isStoreCredit:s.giftType==="store_credit",gwp:s,requiresSelection:s.giftType==="product"&&_t(s.tiers.find(n=>n.thresholdCents!==null)?.products).length>1}}).filter(Boolean);var F=E(Y()),Qs={title:"Choose your free gift",header:"You've qualified for a free gift",subheader:"Choose an option below.",disclaimer:"",showDecline:!1},ho="#0c2340";function Js({label:e}){let[o,s]=(0,_e.useState)(!1),c=window.Peepers?.giftWrap||{},l=c.bowUrl||`${window.Peepers?.assetFileUrl??"//www.peepers.com/cdn/shop/files/"}gwp-gift-bow-navy.png`,n=(c.ribbonColor||ho).toLowerCase(),u={"--gwp-ribbon":n,"--gwp-ink":c.ribbonInk||ho};return n===ho&&Object.assign(u,{"--gwp-ribbon-dk":"#081a31","--gwp-ribbon-hi":"#22497a","--gwp-ribbon-lit":"#12305a"}),(0,F.jsxs)("div",{className:"gwp-wrap","aria-hidden":"true",style:u,children:[(0,F.jsx)("span",{className:"gwp-wrap__band"}),(0,F.jsx)("svg",{className:"gwp-wrap__string",viewBox:"0 0 100 100",preserveAspectRatio:"none",fill:"none",children:(0,F.jsx)("path",{d:"M0 0 C 30 10, 70 55, 100 100",stroke:"currentColor",strokeWidth:"1.25",vectorEffect:"non-scaling-stroke"})}),(0,F.jsx)("span",{className:"gwp-wrap__tag",children:e}),o?(0,F.jsxs)("svg",{className:"gwp-wrap__bow",viewBox:"0 0 112 96",fill:"none",children:[(0,F.jsx)("path",{d:"M52 44 L40 92 L48 86 L54 96 L57 46 Z",fill:"var(--gwp-ribbon)"}),(0,F.jsx)("path",{d:"M60 44 L70 92 L63 86 L58 96 L55 46 Z",fill:"var(--gwp-ribbon-lit)"}),(0,F.jsx)("path",{d:"M56 40 C 34 8, 6 16, 14 38 C 20 54, 44 50, 56 40 Z",fill:"var(--gwp-ribbon-lit)"}),(0,F.jsx)("path",{d:"M56 40 C 78 8, 106 16, 98 38 C 92 54, 68 50, 56 40 Z",fill:"var(--gwp-ribbon-lit)"}),(0,F.jsx)("rect",{x:"48",y:"32",width:"16",height:"16",rx:"5",fill:"var(--gwp-ribbon-hi)"})]}):(0,F.jsx)("img",{className:"gwp-wrap__bow",src:l,alt:"",width:"320",height:"271",onError:()=>s(!0)})]})}function Xs(e){let[o,s]=(0,_e.useState)(0);return(0,_e.useEffect)(()=>
3{if(!e)return;let c=()=>{if(!window.matchMedia("(max-width: 639px)").matches)return s(0);let n=window.innerHeight,u=n;for(let h=n-2;h>n*.3;h=Math.min(h-12,u-2)){let f=document.elementsFromPoint(window.innerWidth/2,h)[0];for(;f?.shadowRoot;){let m=f.shadowRoot.elementsFromPoint(window.innerWidth/2,h)[0];if(!m||m===f)break;f=m}if(!f||f.closest('[id^="headlessui-dialog"]'))break;let g=null;for(let m=f;m&&m!==document.body;m=m.parentElement??m.getRootNode()?.host){let p=m.getBoundingClientRect();if(p.height<n*.7&&p.top>n*.25){g=p;break}}if(!g||g.bottom<u-16)break;u=Math.min(u,g.top)}s(Math.max(0,Math.round(window.innerHeight-u)))};c();let l=setInterval(c,700);return window.addEventListener("resize",c),()=>{clearInterval(l),window.removeEventListener("resize",c)}},[e]),o}function Zs({show:e,gwp:o,onAddToCart:s,onDecline:c,onGiftUnavailable:l}){let[n,u]=(0,_e.useState)(null),[h,f]=(0,_e.useState)(!1),[g,m]=(0,_e.useState)(""),p=(0,_e.useRef)(null),v=!!(e&&o);ut(v);let x=Xs(v);if((0,_e.useEffect)(()=>{let j=o?.products?.length===1?o.products[0]:null;u(j?.variants?.find(y=>y.available)??null),m("")},[o?.id,v]),!o)return null;let A=o.products||[],O={...Qs,...o.selectionModal||{}},T=A.find(j=>j.variants?.some(y=>y.id===n?.id)),z=()=>c(o),I=async()=>{if(!(!n||!T||h)){f(!0),m("");try{let j=await Nt({id:n.id,quantity:1,tags:T.tags||[],properties:vt(o),attributes:Wt(o),doShowDrawer:!0});if(!Ut(j,o.id,n.id)){let y=A.flatMap(G=>G.variants||[]).find(G=>G.available&&G.id!==n.id);u(y??null);let C=y?.title&&y.title!=="Default Title"?y.title:null;m(y?C?`That color just sold out. We've switched you to ${C}.`:"That option just sold out. Please choose another.":"Sorry, this gift just sold out."),l(o,n);return}s(o,n)}catch(j){console.error("Unable to add selected gift:",j),m("That gift could not be added. Please choose another option or try again.")}finally{f(!1)}}},$=A.length===1,q=(0,F.jsxs)("div",{className:"gwp-dlg__copy",children:[(0,F.jsx)(ye.Title,{className:$?"sr-only":"gwp-dlg__eyebrow",children:O.title}),(0,F.jsxs)(ye.Description,{as:"div",children:[(0,F.jsx)("span",{className:"gwp-dlg__header",children:O.header}),O.subheader&&" ",O.subheader&&(0,F.jsx)("span",{className:"gwp-dlg__subheader",children:O.subheader})]})]});return(0,F.jsx)(Ne.Root,{show:v,as:_e.Fragment,children:(0,F.jsxs)(ye,{as:"div",className:"relative z-index-max",onClose:z,ref:st(z),initialFocus:p,children:[(0,F.jsx)("style",{children:er}),(0,F.jsx)(Ne.Child,{as:_e.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,F.jsx)("div",{className:"fixed inset-0 transition-opacity bg-black/50"})}),(0,F.jsx)("div",{className:"fixed inset-0 z-10 overflow-y-auto",children:(0,F.jsx)("div",{className:`gwp-dlg__frame${x?" is-lifted":""}`,style:x?{paddingBottom:x+8,"--gwp-lift":`${x+8}px`}:void 0,children:(0,F.jsx)(Ne.Child,{as:_e.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",enterTo:"opacity-100 translate-y-0 sm:scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-y-0 sm:scale-100",leaveTo:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",children:(0,F.jsxs)(ye.Panel,{className:`gwp-dlg ${$?"gwp-dlg--hero":"gwp-dlg--list"}`,children:[(0,F.jsxs)("button",{type:"button",className:"gwp-dlg__close",onClick:z,children:[(0,F.jsx)("span",{className:"sr-only",children:"Close"}),(0,F.jsx)(He,{className:"w-5 h-5","aria-hidden":"true"})]}),$?(0,F.jsx)(fo,{layout:"hero",decoration:(0,F.jsx)(Js,{label:O.title}),product:A[0],selectedVariantId:n?.id,onSelect:u,children:q}):(0,F.jsxs)("div",{className:"gwp-dlg__body",children:[q,(0,F.jsx)("div",{className:"gwp-dlg__cards",children:A.map(j=>(0,F.jsx)(fo,{product:j,selectedVariantId:n?.id,onSelect:u},j.id))})]}),(0,F.jsxs)("div",{className:"gwp-dlg__footer",children:[O.disclaimer&&(0,F.jsx)("div",{className:"gwp-dlg__disclaimer",children:O.disclaimer}),g&&(0,F.jsx)("div",{className:"gwp-dlg__error",role:"alert",children:g}),(0,F.jsx)("button",{ref:p,type:"button",className:"gwp-dlg__cta",onClick:I,disabled:!n||h,children:h?"Adding\u2026":n?"Add my free gift":"Choose a gift above"}),O.showDecline&&(0,F.jsx)("button",{type:"button",className:"gwp-dlg__decline",onClick:z,children:"No thanks"})]})]})})})})]})})}var er=` 4.gwp-dlg__frame { display: flex; min-height: 100%; align-items: flex-end; justify-content: center; } 5.gwp-dlg { position: relative; width: 100%; max-height: 94vh; overflow-y: auto; background: #fff; color: #373A36; 6 font-family: var(--font-acumin-pro); border-radius: 20px 20px 0 0; box-shadow: 0 -12px 40px rgba(12,35,64,.18); 7 padding-bottom: env(safe-area-inset-bottom); text-align: left; } 8.gwp-dlg__close { position: absolute; top: 12px; right: 12px; z-index: 3; display: flex; align-items: center; justify-content: center; 9 width: 36px; height: 36px; border-radius: 999px; background: rgba(255,255,255,.92); color: #0c2340; 10 box-shadow: 0 1px 4px rgba(12,35,64,.15); transition: background-color .15s; } 11.gwp-dlg__close:hover { background: #fff; } 12.gwp-dlg__close:focus-visible, .gwp-dlg__cta:focus-visible, .gwp-dlg__card-hit:focus-visible { outline: 2px solid #0c2340; outline-offset: 2px; } 13 14.gwp-dlg__stage { position: relative; background: #F2F0EB; aspect-ratio: 16 / 9; overflow: hidden; } 15.gwp-dlg__photo { position: absolute; inset: 7% 8%; width: 84%; height: 86%; object-fit: contain; mix-blend-mode: multiply; 16 opacity: 0; transform: scale(.97); transition: opacity .35s ease, transform .5s cubic-bezier(.2,.7,.2,1); } 17.gwp-dlg__photo[data-visible="true"] { opacity: 1; transform: none; } 18@media (prefers-reduced-motion: reduce) { .gwp-dlg__photo { transition: none; } } 19 20.gwp-dlg__body { padding: 20px 20px 4px; } 21.gwp-dlg__copy { margin-bottom: 16px; } 22.gwp-dlg__eyebrow { margin: 0 0 6px; font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: #0c2340; } 23.gwp-dlg__header { display: block; font-family: var(--font-secondary); font-size: clamp(22px, 6.4vw, 26px); line-height: 1.12; color: #0c2340; text-wrap: balance; } 24.gwp-dlg__subheader { display: block; margin-top: 6px; font-size: 14px; line-height: 1.4; } 25 26.gwp-dlg__name-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; 27 padding-top: 14px; border-top: 1px solid #e9ebed; } 28.gwp-dlg__name { font-size: 15px; font-weight: 600; color: #0c2340; } 29.gwp-dlg__name-sub { display: block; font-size: 12px; font-weight: 400; color: #373A36; } 30.gwp-dlg__value { display: inline-flex; align-items: baseline; gap: 6px; white-space: nowrap; font-size: 14px; } 31.gwp-dlg__value s { color: #8a8c89; } 32.gwp-dlg__free { font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #0c2340; } 33.gwp-dlg__unavailable { font-size: 12px; color: #b91c1c; } 34 35.gwp-dlg__colors { margin-top: 14px; } 36.gwp-dlg__colors-label { display: block; font-size: 13px; margin-bottom: 10px; } 37.gwp-dlg__colors-value { font-weight: 600; color: #0c2340; } 38.gwp-dlg__swatches { display: flex; flex-wrap: wrap; gap: 12px; } 39.gwp-dlg__swatch { position: relative; display: flex; width: 44px; height: 44px; padding: 4px; border-radius: 999px; cursor: pointer; 40 box-shadow: inset 0 0 0 1px rgba(12,35,64,.14); transition: box-shadow .15s; } 41.gwp-dlg__swatch:hover { box-shadow: inset 0 0 0 1px rgba(12,35,64,.45); } 42.gwp-dlg__swatch[data-headlessui-state~="checked"] { box-shadow: inset 0 0 0 2px #0c2340; } 43.gwp-dlg__swatch[data-headlessui-state~="active"] { outline: 2px solid #0c2340; outline-offset: 2px; } 44.gwp-dlg__swatch-fill { display: block; width: 100%; height: 100%; border-radius: 999px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); } 45 46.gwp-dlg__cards { display: grid; gap: 12px; } 47.gwp-dlg__card { border: 1px solid #e3e5e8; border-radius: 12px; padding: 10px; transition: border-color .15s, box-shadow .15s; } 48.gwp-dlg__card.is-selected { border-color: #0c2340; box-shadow: 0 0 0 1px #0c2340; } 49.gwp-dlg__card-hit { display: grid; grid-template-columns: 112px 1fr; align-items: center; gap: 14px; width: 100%; text-align: left; } 50.gwp-dlg__card-hit .gwp-dlg__name-row { border-top: 0; padding-top: 0; flex-direction: column; align-items: flex-start; gap: 4px; } 51.gwp-dlg__stage--thumb { border-radius: 8px; aspect-ratio: 4 / 3; } 52.gwp-dlg__card .gwp-dlg__colors { margin-top: 10px; } 53 54.gwp-dlg__footer { padding: 16px 20px 20px; } 55.gwp-dlg__disclaimer { margin-bottom: 10px; font-size: 12px; font-style: italic;
55 opacity: .8; text-align: center; } 56.gwp-dlg__error { margin-bottom: 10px; font-size: 13px; color: #b91c1c; text-align: center; } 57.gwp-dlg__cta { display: block; width: 100%; min-height: 52px; border-radius: 999px; background: #0c2340; color: #fff; 58 font-size: 14px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; transition: background-color .15s, opacity .15s; } 59.gwp-dlg__cta:hover:not(:disabled) { background: #1a3a63; } 60.gwp-dlg__cta:disabled { opacity: .45; cursor: default; } 61.gwp-dlg__decline { display: block; margin: 12px auto 0; padding: 4px 8px; font-size: 13px; color: #373A36; 62 text-decoration: underline; text-underline-offset: 3px; opacity: .75; } 63.gwp-dlg__decline:hover { opacity: 1; } 64.gwp-dlg__decline:focus-visible { outline: 2px solid #0c2340; outline-offset: 2px; } 65 66/* Gift wrap (hero only). The stage is the lid: the band sits on its bottom 67 edge (the seam with the copy), the bow's knot lands on the band's centre and 68 its tails hang into the body, which is why the hero body pads its top. */ 69.gwp-dlg__lid { position: relative; } 70.gwp-wrap { position: absolute; inset: 0; z-index: 2; pointer-events: none; color: var(--gwp-ink, #0c2340); 71 --gwp-ribbon-dk: color-mix(in srgb, var(--gwp-ribbon, #0c2340) 68%, #000); 72 --gwp-ribbon-lit: color-mix(in srgb, var(--gwp-ribbon, #0c2340) 82%, #fff); 73 --gwp-ribbon-hi: color-mix(in srgb, var(--gwp-ribbon, #0c2340) 62%, #fff); } 74.gwp-wrap__band { position: absolute; left: 0; right: 0; bottom: -10px; height: 20px; 75 background: linear-gradient(180deg, var(--gwp-ribbon-dk) 0%, var(--gwp-ribbon) 24%, var(--gwp-ribbon-hi) 52%, var(--gwp-ribbon) 80%, var(--gwp-ribbon-dk) 100%); 76 box-shadow: 0 2px 6px rgba(12,35,64,.18); transform-origin: center; } 77.gwp-wrap__bow { position: absolute; left: 50%; bottom: 0; width: 116px; height: auto; margin-left: -58px; 78 transform: translateY(58%); filter: drop-shadow(0 4px 6px rgba(12,35,64,.3)); } 79.gwp-wrap__string { position: absolute; left: 27px; bottom: 0; width: calc(50% - 27px); height: 40px; overflow: visible; } /* tag hole \u2192 knot */ 80.gwp-wrap__tag { position: absolute; left: 20px; bottom: 28px; padding: 6px 12px 6px 18px; background: #fff; color: var(--gwp-ink, #0c2340); 81 font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; white-space: nowrap; 82 clip-path: polygon(10px 0, 100% 0, 100% 100%, 10px 100%, 0 50%); border-radius: 0 3px 3px 0; 83 box-shadow: 0 2px 6px rgba(12,35,64,.16); transform: rotate(-6deg); transform-origin: 0 50%; } 84.gwp-wrap__tag::before { content: ""; position: absolute; left: 7px; top: 50%; width: 5px; height: 5px; margin-top: -2.5px; 85 border-radius: 999px; background: #F2F0EB; box-shadow: inset 0 0 0 1px rgba(12,35,64,.35); } 86.gwp-dlg--hero .gwp-dlg__photo { inset: 6% 12% 20%; width: 76%; height: 74%; } 87.gwp-dlg--hero .gwp-dlg__body { padding-top: 66px; text-align: center; } 88.gwp-dlg--hero .gwp-dlg__name-row { justify-content: center; gap: 10px; border-top: 0; padding-top: 0; } 89.gwp-dlg--hero .gwp-dlg__swatches { justify-content: center; } 90.gwp-dlg--hero .gwp-dlg__copy { margin-bottom: 14px; } 91@keyframes gwp-band { from { transform: scaleX(0); } to { transform: scaleX(1); } } 92@keyframes gwp-bow { 0% { transform: translateY(58%) scale(.4) rotate(-10deg); opacity: 0; } 70% { transform: translateY(58%) scale(1.08) rotate(2deg); opacity: 1; } 100% { transform: translateY(58%); } } 93@keyframes gwp-tag { 0% { transform: rotate(-40deg); opacity: 0; } 60% { transform: rotate(3deg);
93 opacity: 1; } 100% { transform: rotate(-6deg); } } 94@keyframes gwp-fade { from { opacity: 0; } to { opacity: 1; } } 95.gwp-wrap__band { animation: gwp-band .45s cubic-bezier(.2,.7,.2,1) .1s both; } 96.gwp-wrap__bow { animation: gwp-bow .55s cubic-bezier(.2,.7,.2,1) .38s both; } 97.gwp-wrap__string { animation: gwp-fade .3s ease .6s both; } 98.gwp-wrap__tag { animation: gwp-tag .7s cubic-bezier(.2,.7,.2,1) .6s both; } 99@media (prefers-reduced-motion: reduce) { .gwp-wrap__band, .gwp-wrap__bow, .gwp-wrap__string, .gwp-wrap__tag { animation: none; } } 100 101.gwp-dlg__frame.is-lifted { padding-left: 8px; padding-right: 8px; } 102.gwp-dlg__frame.is-lifted .gwp-dlg { border-radius: 20px; max-height: calc(100vh - var(--gwp-lift, 0px) - 16px); } 103@media (min-width: 640px) { 104 .gwp-dlg__frame { align-items: center; padding: 32px 16px; } 105 .gwp-dlg { max-width: 440px; border-radius: 20px; box-shadow: 0 24px 64px rgba(12,35,64,.25); } 106 .gwp-dlg__body { padding: 24px 28px 4px; } 107 .gwp-dlg__footer { padding: 18px 28px 28px; } 108 .gwp-dlg__header { font-size: 28px; } 109} 110`,La=Zs;var lt=E(me()),Ba=()=>{let[e,o]=(0,lt.useState)(()=>window.location.hash),s=(0,lt.useCallback)(()=>{o(window.location.hash)},[]);(0,lt.useEffect)(()=>(window.addEventListener("hashchange",s),()=>{window.removeEventListener("hashchange",s)}),[]);let c=(0,lt.useCallback)(l=>{l!==e&&(window.location.hash=l)},[e]);return[e,c]};var qi=E(me());var K=E(Y());function tr({pendingExchangeData:e,remainingExchangeValue:o,shopifyCart:s,totalPriceMoney:c,originalTotalPriceMoney:l,isSaleActive:n}){let u=n?e.shopNowValue+e.shopNowBonus-e.totalDiscounts:e.shopNowValue+e.shopNowBonus;return(0,K.jsxs)("div",{className:"pb-3 !mb-6 !mt-3",children:[(0,K.jsxs)("div",{className:"p-2 bg-grey",children:[(0,K.jsxs)("div",{className:"flex flex-row items-center justify-between gap-3 mb-2",children:[(0,K.jsx)("div",{className:"text-base font-medium text-secondary",children:"Total Exchange Value"}),(0,K.jsxs)("div",{className:"text-base font-bold leading-none text-secondary",children:["$",u]})]}),s?.items.length>0&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)("div",{className:"flex flex-row items-center justify-between gap-3 mb-2",children:[(0,K.jsx)("div",{className:"text-base font-medium text-secondary",children:"Cart Total"}),(0,K.jsx)("div",{className:"flex flex-col items-center justify-center",children:(0,K.jsxs)("div",{className:"text-base font-bold leading-none text-secondary",children:[c.currencyNarrowSymbol,c.amount.replace(".00","")]})})]}),(0,K.jsxs)("div",{className:"flex flex-row items-center justify-between gap-3 py-2 mb-2 border-solid border-y border-[#cccccc",children:[(0,K.jsxs)("div",{className:"text-base font-medium text-secondary",children:[o>=0?"Remaining Exchange Balance":"Amount Due",o>=0&&!1]}),(0,K.jsxs)("div",{className:`relative flex flex-col items-center justify-center ${o!==0?"-mt-2":""}`,children:[(0,K.jsxs)("div",{className:"text-base font-bold leading-none text-secondary",children:["$",Math.abs(o)]}),o!==0&&(0,K.jsx)("span",{className:"absolute right-0 text-sm font-light -bottom-4 whitespace-nowrap",children:"+ tax"})]})]})]}),(0,K.jsxs)("details",{className:"group",children:[(0,K.jsx)("summary",{className:"list-none cursor-pointer",children:(0,K.jsxs)("div",{className:"flex items-center gap-2",children:[(0,K.jsx)("svg",{className:"w-4 h-4 transition-transform group-open:rotate-180",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,K.jsx)("polyline",{points:"6 9 12 15 18 9"})}),(0,K.jsx)("span",{className:"text-xs font-medium",children:"Show Items You're Returning"})]})}),(0,K.jsx)("div",{className:"pt-3",children:e?.lineItems?.map((h,f)=>(0,K.jsx)(va,{item:h,index:f},f))})]})]}),e?.shopNowBonus>0&&(0,K.jsxs)("div",{className:"relative mt-3 flex flex-wrap items-start pl-6 lg:pl-2 pr-6 border border-solid border-[#E9EBED] pt-2 pb-2 md:py-4",children:[(0,K.jsxs)("div",{className:"flex flex-row items-start justify-between w-full gap-1",children:[(0,K.jsx)("span",{className:"text-base font-bold",children:"Shop Now Bonus"}),(0,K.jsxs)("span",{className:"text-base font-medium",children:["$",e.shopNowBonus]})]}),(0,K.jsxs)("div",{className:"mt-2 text-sm text-default",children:["A $",e.shopNowBonus," discount will be applied to your order when you exchange your items instead of returning them."]})]})]})}var Ga=tr;var Ui=E(me()),U=E(Y());function or({shopifyCart:e,remainingExchangeValue:o,isKeepIt:s=!1}){return(0,U.jsx)("div",{className:`w-full ${e?.items.length>0?"!mb-6 pt-4":""}`,children:(0,U.jsxs)("details",{className:"group",children:[(0,U.jsx)("summary",{className:"list-none cursor-pointer",children:(0,U.jsxs)("div",{className:"flex items-center gap-2",children:[(0,U.jsx)("svg",{className:"w-4 h-4 transition-transform group-open:rotate-180",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,U.jsx)("polyline",{points:"6 9 12 15 18 9"})}),(0,U.jsx)("span",{className:"text-base font-medium",children:"How does this exchange work?"})]})}),(0,U.jsx)("div",{className:"pt-3",children:(0,U.jsxs)("ul",{className:"space-y-2",children:[e?.items.length===0&&(0,U.jsxs)("li",{className:"relative flex flex-wrap items-start pl-1.5 lg:pl-2 pr-4 border border-solid border-[#
110E9EBED] pt-2 pb-2 md:py-4",children:[(0,U.jsx)("span",{className:"text-base font-medium",children:"Shop for exchange items."}),(0,U.jsx)("span",{className:"text-sm font-normal opacity-70",children:"Browse the site to add products to your cart and add to your exchange"})]}),o<0&&(0,U.jsxs)("li",{className:"relative flex flex-wrap items-start pl-1.5 lg:pl-2 pr-4 border border-solid border-[#E9EBED] pt-2 pb-2 md:py-4",children:[(0,U.jsx)("span",{className:"text-base font-medium",children:"Pay the remaining balance owed."}),(0,U.jsxs)("span",{className:"text-sm font-normal opacity-70",children:["Click the ",(0,U.jsx)("strong",{children:'"FINALIZE EXCHANGE"'})," button above to be taken to the checkout page."]})]}),s?(0,U.jsxs)("li",{className:"relative flex flex-wrap items-start pl-1.5 lg:pl-2 pr-4 border border-solid border-[#E9EBED] pt-2 pb-2 md:py-4",children:[(0,U.jsx)("span",{className:"text-base font-medium",children:"Keep your original item"}),(0,U.jsx)("span",{className:"text-sm font-normal opacity-70",children:"There's nothing to send back \u2014 no shipping label, no trip to the post office."})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)("li",{className:"relative flex flex-wrap items-start pl-1.5 lg:pl-2 pr-4 border border-solid border-[#E9EBED] pt-2 pb-2 md:py-4",children:[(0,U.jsx)("span",{className:"text-base font-medium",children:"Print your pre-paid shipping label"}),(0,U.jsx)("span",{className:"text-sm font-normal opacity-70",children:"You will receive an email with a link to print your shipping label."})]}),(0,U.jsxs)("li",{className:"relative flex flex-wrap items-start pl-1.5 lg:pl-2 pr-4 border border-solid border-[#E9EBED] pt-2 pb-2 md:py-4",children:[(0,U.jsx)("span",{className:"text-base font-medium",children:"Return your items at your nearest USPS location"}),(0,U.jsx)("span",{className:"text-sm font-normal opacity-70",children:"Use the box we provided to pack your items."})]})]}),o>0&&e?.items.length>0&&(0,U.jsxs)("li",{className:"relative flex flex-wrap items-start pl-1.5 lg:pl-2 pr-4 border border-solid border-[#E9EBED] pt-2 pb-2 md:py-4",children:[(0,U.jsx)("span",{className:"text-base font-medium",children:"Your store credit will be issued to your account"}),(0,U.jsx)("span",{className:"text-sm font-normal opacity-70",children:s?"shortly \u2014 no need to wait for a return.":"when we receive confirmation of your return."})]}),(0,U.jsxs)("li",{className:"pt-2 text-sm",children:["Note that when exchanging items, we use the regular price of both items - the one you're"," ",s?"exchanging":"returning",", and any new items you select. This ensures fair exchanges regardless of any sales."]})]})})]})})}var za=or;var qe=E(me());var Fa="peepers:gwpSoldOut",ar=1800*1e3,sr=()=>{try{let e=JSON.parse(sessionStorage.getItem(Fa)||"[]"),o=Date.now();return e.filter(([,s])=>o-s<ar)}catch{return[]}},rr=e=>{try{sessionStorage.setItem(Fa,JSON.stringify(e))}catch{}};function qa(){let e=typeof Shopify<"u"&&Shopify.currency?.active||"USD",[o,s]=(0,qe.useState)(sr),c=(0,qe.useMemo)(()=>o.map(([f])=>f),[o]),l=(0,qe.useMemo)(()=>Pa(window.Peepers?.giftOffers,{currency:e,soldOutVariantIds:c}),[e,c]),n=(0,qe.useRef)(l);n.current=l;let u=(0,qe.useCallback)(f=>{let g=(f||[]).map(String);g.length!==0&&s(m=>{let p=new Set(m.map(([A])=>A)),v=g.filter(A=>!p.has(A));if(v.length===0)return m;let x=[...m,...v.map(A=>[A,Date.now()])];return rr(x),x})},[]),h=(0,qe.useMemo)(()=>$a(l,{currency:e}),[l,e]);return{enabled:l.length>0,offers:l,markSoldOut:u,promotions:h,plan:(f,g={})=>Oa(f,n.current,{href:window.location.href,...g}),states:(f,g={})=>go(f,n.current,{href:window.location.href,...g})}}var ja=E(me()),Re=E(Y());function nr({state:e,onReAdd:o}){let[s,c]=(0,ja.useState)(!1),l=e.offer.display?.selectionModal?.header||"You've earned a free gift",n=window.Peepers?.giftWrap?.ribbonColor||"#0c2340";return(0,Re.jsxs)(Re.Fragment,{children:[(0,Re.jsx)("style",{children:ir}),(0,Re.jsxs)("button",{type:"button",className:"gwp-readd",style:{"--gwp-ribbon":n,order:"-2"},onClick:async()=>{if(!s){c(!0);try{await o(e)}finally{c(!1)}}},disabled:s,"data-gwp-readd":e.offer.id,children:[(0,Re.jsx)("span",{className:"gwp-readd__icon","aria-hidden":"true",children:(0,Re.jsxs)("svg",{viewBox:"0 0 20 20",fill:"currentColor",width:"18",height:"18",children:[(0,Re.jsx)("path",{fillRule:"evenodd",d:"M14 6a2.5 2.5 0 00-4-3 2.5 2.5 0 00-4 3H3.25C2.56 6 2 6.56 2 7.25v.5C2 8.44 2.56 9 3.25 9h6V6h1.5v3h6C17.44 9 18 8.44 18 7.75v-.5C18 6.56 17.44 6 16.75 6H14zm-1-1.5a1 1 0 01-1 1h-1v-1a1 1 0 112 0zm-6 0a1 1 0 001 1h1v-1a1 1 0 00-2 0z",clipRule:"evenodd"}),(0,Re.jsx)("path",{d:"M9.25 10.5H3v4.75A2.75 2.75 0 005.75 18h3.5v-7.5zM10.75 18v-7.5H17v4.75A2.75 2.75 0 0114.25 18h-3.5z"})]})}),(0,Re.jsx)("span",{className:"gwp-readd__text",children:l}),(0,Re.jsx)("span",{className:"gwp-readd__cta",children:s?"Adding\u2026":"Add it"})]})]})}var ir=` 111.gwp-readd { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 10px 10px 12px; text-align: left; 112 background: #F2F0EB; border: 1px solid rgba(12,35,64,.14); border-left: 4px solid var(--gwp-ribbon, #0c2340); 113 border-radius: 12px; color: #373A36; font-family: var(--font-acumin-pro); transition: border-color .15s, background-color .15s; } 114.gwp-readd:hover:not(:disabled) { background: #ece9e1; border-color: rgba(12,35,64,.28); border-left-color: var(--gwp-ribbon, #0c2340); } 115.gwp-readd:focus-visible { outline: 2px solid #0c2340; outline-offset: 2px; } 116.gwp-readd:disabled { cursor: default; opacity: .7; } 117.gwp-readd__icon { flex: none; display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; 118 border-radius: 999px; background: #fff; color: var(--gwp-ribbon, #0c2340); } 119.gwp-readd__text { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; line-height: 1.25; color: #0c2340; } 120.gwp-readd__cta { flex: none; padding: 8px 14px; border-radius: 999px; background: #0c2340; color: #fff; 121 font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; white-space: nowrap; } 122.gwp-readd:hover:not(:disabled) .gwp-readd__cta { background: #1a3a63; } 123`,Ha=nr;var $e=E(me());
123var Ua="peepers:pairup:",lr=600*1e3,Va=250,dr=3,xt={},cr=e=>{try{let o=sessionStorage.getItem(Ua+e);if(!o)return null;let{at:s,products:c}=JSON.parse(o);return Date.now()-s>lr?null:c}catch{return null}},pr=(e,o)=>{try{sessionStorage.setItem(Ua+e,JSON.stringify({at:Date.now(),products:o}))}catch{}},mr=e=>({id:e.id,handle:e.handle,title:e.title,product_type:e.product_type,tags:e.tags,options:e.options,images:(e.images||[]).slice(0,1).map(o=>({src:o.src})),variants:(e.variants||[]).map(o=>({id:o.id,sku:o.sku,price:o.price,compare_at_price:o.compare_at_price,available:o.available,option1:o.option1,option2:o.option2,option3:o.option3,featured_image:o.featured_image?{src:o.featured_image.src}:null}))}),ur=async e=>{let o=cr(e);if(o)return o;if(xt[e])return xt[e];let s=e?`/collections/${e}/products.json`:"/products.json";return xt[e]=(async()=>{let c=[];for(let l=1;l<=dr;l+=1){let n=await fetch(`${s}?limit=${Va}&page=${l}`);if(!n.ok)break;let h=((await n.json()).products||[]).map(mr);if(c.push(...h),h.length<Va)break}return pr(e,c),delete xt[e],c})().catch(()=>(delete xt[e],[])),xt[e]},Wa=({shopifyCart:e,settings:o,isCartOpen:s,isExchangeFlow:c,defaultStrengthSelection:l})=>{let n=window.Shopify?.currency?.rate||1,u=window.Peepers?.offer,f=!!(u?.active&&!u?.sleeping)?{...o?.pairUp||{},collectionHandle:u.collectionHandle||o?.pairUp?.offerCollectionHandle||o?.pairUp?.collectionHandle||"",eyebrow:u.saleName||o?.pairUp?.eyebrow}:o?.pairUp||{},g=(0,$e.useMemo)(()=>da(window.Peepers?.sale,{rate:n}),[n]),m=f.enabled!==!1&&g.length>0&&!c,p=(0,$e.useMemo)(()=>m&&ca(e,g)[0]||null,[m,e,g]),[v,x]=(0,$e.useState)(null),[A,O]=(0,$e.useState)(!1),T=(0,$e.useRef)(!1),z=m&&s&&p&&p.units>0;(0,$e.useEffect)(()=>{if(!z||T.current)return;T.current=!0,O(!0);let $=!1;return ur(f.collectionHandle||"").then(q=>{$||(x(q),O(!1))}),()=>{$=!0}},[z]);let I=(0,$e.useMemo)(()=>!p||!v||v.length===0?[]:pa({products:v,cart:e,offer:p.offer,strength:l,favProductNumbers:window.Peepers?.favs?.productNumbers||new Set,limit:8}),[p,v,e,l]);return{active:!!(m&&p),evaluation:p,suggestions:I,loadingSuggestions:A,poolSize:v?.length||0,collectionHandle:f.collectionHandle||"",eyebrow:f.eyebrow||window.Peepers?.sale?.meta?.name||"Sale"}};var a=E(Y()),fr=()=>window.matchMedia("(min-width: 1024px)").matches,gr={success:"Success!",warning:"Pick another item",error:"Something went wrong"};function hr({settings:e={},autoAdds:o,installmentsMarkup:s}){let[l,n]=Ba(),u=Ko(),h=Jo();(0,w.useEffect)(()=>{if(h&&h.region_code){let t=h?.region_code==="AL"||!window.Peepers.isCustomerAllowedToSeeProgressives;for(let r of document.querySelectorAll('[href*="/collections/progressives"]'))t?r.parentElement.classList.add("!hidden"):r.parentElement.classList.remove("!hidden");for(let r of document.querySelectorAll('[data-product-handle*="progressive"]'))t?r.closest(".js-product-thumbnail")?.classList.add("!hidden"):r.closest(".js-product-thumbnail")?.classList.remove("!hidden")}},[h,h?.region_code]);let f=Wo(h?.region_code),g=qa(),m=g.offers.map(Ia),p={settings:e,swatches:u},[v,x]=(0,w.useState)(null),[A,O]=(0,w.useState)(!1);(0,w.useEffect)(()=>{(async()=>{let d=0;for(;d<50;)if(typeof klaviyo<"u"&&typeof klaviyo.isIdentified=="function")try{let i=await klaviyo.isIdentified();O(i);let N=await klaviyo.identify();x(N?.$referrer?.first_page);let V=await ot();if(!i&&window.location.href.includes("new-to-peepers")&&(window._klOnsite=window._klOnsite||[],window._klOnsite.push(["openForm","UTB7YL"])),N?.$referrer?.first_page&&!V.attributes._klaviyoLandingPage&&window.location.href.includes("new-to-peepers")&&!i){let ie=await Ge({_klaviyoLandingPage:N?.$referrer?.first_page?.split("?")[0]});Oe(ie)}return}catch(i){console.error("Error identifying with Klaviyo:",i);return}else await new Promise(i=>setTimeout(i,100)),d++;setError("Klaviyo object or identify function is not available after waiting.")})()},[]),(0,w.useEffect)(()=>{let t=async r=>{if(r.detail.type==="submit"&&r.detail.formId==="UTB7YL"){let d=await ot();if(Oe(d),!d.attributes._isConditionalGWPEligible){let i=await Ge({_isConditionalGWPEligible:!0});Oe(i)}}};return window.addEventListener("klaviyoForms",t),()=>{window.removeEventListener("klaviyoForms",t)}},[]);let{itemsRef:T,itemsContainerRef:z,isSideCartScrollable:I,handleHeightToggle:$}=vr(),[q,j]=(0,w.useState)(!1),[y,C]=(0,w.useState)(!!(window.location.hash&&window.location.hash==="#cart")),[G,M]=(0,w.useState)(!1),[k,R]=(0,w.useState)({total_price:0,item_count:0,items:[]}),[B,oe]=(0,w.useState)([]),ae=(0,w.useMemo)(()=>(Array.isArray(B)?B:[]).filter(t=>!$t(t,h)),[B,h?.region_code]),re=ba(k.items,h,y),[H,L]=(0,w.useState)(!1),[fe,S]=(0,w.useState)(!1),[pe,Q]=(0,w.useState)(!1),[be,ke]=(0,w.useState)(!0),[Me,je]=Bt("showBfcmCartPromotions",!0),[Ae,Le]=Bt("pending_exchange_order_id",null),[P,ee]=Bt("pending_exchange_token",null),[D,ve]=(0,w.useState)(null),[Ye,De]=(0,w.useState)("Finalize Exchange"),[dt,
123nt]=(0,w.useState)(!1);(0,w.useEffect)(()=>{let t=new URLSearchParams(window.location.search),r=t.get("pending_exchange"),d=t.get("pex_token");r&&(Le(r),d&&ee(d))},[Le,ee]);let J=(0,w.useCallback)(()=>D!==null,[D]),Be=!1,[Yt,Ya]=(0,w.useState)(0),vo=!1,xo=(0,w.useCallback)(t=>{if(t&&D){let{original_total_price:r,total_price:d}=t,{shopNowValue:i,shopNowBonus:N,totalDiscounts:V}=D,ie=vo?i+N-V:i+N,Pe=d/100,le=ie-Pe;Ya(le)}},[D]);(0,w.useEffect)(()=>{k&&D&&xo(k)},[k,D,xo]),(0,w.useEffect)(()=>{let t=new URLSearchParams(window.location.search),r=t.get("pending_return"),d=t.get("pex_token");r&&(Le(r),d&&ee(d))},[Le,ee]),(0,w.useEffect)(()=>{D&&D.completed&&(Le(null),ee(null),ct("error"),Ke("Your exchange has already been completed. You will be redirected to your status page shortly."),window.setTimeout(()=>{window.location.href=`/a/returns/?orderNumber=${D?.orderName?.replace("#","")}&zipCode=${D?.zip}`},3e3))},[D]);let[wo,Ka]=(0,w.useState)(!1);(0,w.useEffect)(()=>{(async()=>{if(wo===!1&&k.item_count===0&&D&&D.exchangeItems?.length>0)try{await Rt(D.exchangeItems.map(d=>({id:d.variantId.split("/").pop(),quantity:d.quantity,properties:{Note:`Return Reason: ${[d?.reason,d?.note].filter(Boolean).join(" - ")||""}`}}))),Ka(!0);let r=await ot();Oe(r)}catch(r){console.error("Error handling pending exchange:",r)}})()},[wo,D,k]);let yo=()=>window.Peepers?.endpoints?.prex??"https://peepers-rex.fly.dev",Kt=(0,w.useRef)(0),Qa=async t=>{let r=++Kt.current;try{let d=P?`&token=${encodeURIComponent(P)}`:"",N=await(await fetch(`${yo()}/api/pending-exchange?orderId=${t}${d}`)).json();if(r!==Kt.current)return;N.success?ve(N.pendingExchange):(console.error("Error fetching pending exchange data:",N.error),ve(null))}catch(d){if(r!==Kt.current)return;console.error("Error fetching pending exchange data:",d),ve(null)}};(0,w.useEffect)(()=>{Ae&&!D&&Qa(Ae)},[Ae,P]);let[xr,No]=(0,w.useState)(!1),[So,Ke]=(0,w.useState)(""),[Qt,ct]=(0,w.useState)("success"),Ja=async()=>{if(!k||k.item_count===0||!D)return;No(!0),ct("success"),Ke(""),De("Finalizing... Please wait."),nt(!0);let r={exchangeItems:k.items.map(d=>({variantId:`gid://shopify/ProductVariant/${d.variant_id}`,quantity:d.quantity,discounts:d.discounts})),orderId:Ae,token:P};try{let i=await(await fetch(`${yo()}/api/pending-exchange`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})).json();if(i?.code==="EXCHANGE_ITEM_OUT_OF_STOCK"){ct("warning"),Ke(i.error||"One or more items in your cart just sold out. Please remove them and choose a different item to complete your exchange."),De("Finalize Exchange"),nt(!1);return}if(i.success&&i.exchangeType){let N=D?.isKeepIt===!0;i.exchangeType==="downsell"||i.exchangeType==="even"?(Ke(N?"Great news! Your exchange is complete \u2014 no need to return your original item. Your new item will ship shortly. We'll keep you updated on any applicable store credit. Thank you for shopping with us!":"Great news! Your exchange is complete. You'll receive an email shortly with return instructions, including a pre-paid shipping label. We'll keep you updated on any applicable refunds. Thank you for shopping with us!"),De(""),Le(null),ee(null),ao()):i.exchangeType==="upsell"&&(Ke(N?"Your exchange is almost complete \u2014 no need to return your original item! We'll send you an invoice for the remaining balance. Once paid, your new item will ship right away. Thank you for shopping with us!":"Your exchange is almost complete! You'll receive an email shortly with return instructions, including a pre-paid shipping label. Once your return items are in transit, we'll send you an invoice for the remaining balance. Thank you for shopping with us!"),De(""),Le(null),ee(null),ao())}else i.error?(ct("error"),Ke(i.error),De("")):(ct("error"),Ke("An unexpected error occurred. Please try again or contact customer support."),De(""))}catch(d){console.error("Error finalizing return:",d),ct("error"),Ke("An error occurred while processing your return. Please try again or contact customer support."),De("")}finally{No(!1)}},[wr,Co]=(0,w.useState)(!1),yr=t=>{t.preventDefault(),de("BFCM","Shared cart");let r=`${window.location.origin}/cart/c/${k.token}`;navigator.canShare&&navigator.canShare({url:r})?navigator.share({title:"My Peepers.com Cart",url:r}):navigator.clipboard.writeText(r).then(()=>{Co(!0),setTimeout(()=>Co(!1),1e3)})},{total_price:Qe,original_total_price:Je}=k,Jt=k.item_count;if(q)for(let t of document.querySelectorAll(".js-ajax-cart-count"))t.innerHTML=Jt,t.parentNode?.classList.remove("invisible");let it=te({amount:Qe/100}),Xa=te({amount:Je/100});(0,w.useEffect)(()=>{for(let t of document.querySelectorAll("[data-cart-subtotal]"))t.innerHTML=it.localizedString},[it?.localizedString]);let Xt=Je&&Je!==Qe?te({amount:Je/100}):te({amount:Qe/100}),Nr=Je&&Je!==Qe?te({amount:(Je-Qe)/100}):te({amount:0}),Xe={};
123k.items.forEach(t=>{t?.discounts?.length>0&&t.discounts.forEach(r=>{let{amount:d,title:i}=r;Xe[i]?Xe[i].amount=Xe[i].amount+d:Xe[i]={amount:d}})},{});let Za=Object.entries(Xe).reduce((t,[r,{amount:d}])=>t+d,0),_o=te({amount:Za/100}),Sr=Object.entries(Xe).length>0,es=async t=>t?.attributes?._compareAtPrices||t?.attributes?._prices?Ge({_compareAtPrices:null,_prices:null}):t,ts=async t=>{if(J()||Ae)return t;let{adds:r,removeKeys:d,quantityUpdates:i,attributeUpdates:N}=g.plan(t,{href:window.location.href,klaviyoIdentified:A}),V=!1,ie=[...d.map(Te=>({id:Te,quantity:0})),...i];ie.length>0&&(await so(ie),V=!0);let Pe=[];for(let Te of r.filter(tt=>!tt.needsSelection))await Rt([{id:Te.variantId,quantity:1,properties:Te.properties}])?V=!0:Pe.push(Te.variantId);Pe.length>0&&g.markSoldOut(Pe);let le=r.find(Te=>Te.needsSelection);if(le){let Te=m.find(tt=>tt.id===le.offer.id);Te&&L({...Te,products:le.tier.products})}return N&&(await Ge(N),V=!0),V?await ot():t},os=async t=>{try{if(J()||Ae)return new Promise(i=>i(t));if(o.length===0)return new Promise(i=>i(t));if(!t.items.filter(i=>o.map(N=>N.requiredProductTitleSubstring.toLowerCase()).some(N=>i.title.toLowerCase().includes(N))))return new Promise(i=>i(t));let d=o.map(i=>{let N=t.items.find(le=>le.id.toString()===i.product.variants[0].id.toString());if(N&&N.quantity>=i.maximum||!t.items.find(le=>le.title.toLowerCase().includes(i.requiredProductTitleSubstring.toLowerCase()))||t?.attributes?.[`_declinedAutoAdd__${ft(i.requiredProductTitleSubstring)}`])return null;let Pe={_autoAdd:!0,_autoAddTitleIncludesSubstring:i.requiredProductTitleSubstring};return{id:i.product.variants[0].id.toString(),quantity:1,properties:Pe}}).filter(i=>i);return d.length>0?(await Rt(d),await ot()):new Promise(i=>i(t))}catch(r){return console.error("Error in handleAutoAddsAdd",r),new Promise(d=>d(t))}},as=async t=>{try{if(o.length===0)return new Promise(i=>i(t));if(!t.items.find(i=>i?.properties?._autoAddTitleIncludesSubstring))return new Promise(i=>i(t));let d=t.items.filter(i=>i?.properties?._autoAddTitleIncludesSubstring).filter(i=>t.items.filter(N=>N.title.toLowerCase().includes(i.properties._autoAddTitleIncludesSubstring.toLowerCase())).length===0).map(i=>({id:i.key,quantity:0,cartAttribute:ft(i.properties._autoAddTitleIncludesSubstring)})).filter(i=>i);if(d.length===0)return new Promise(i=>i(t));if(d.length>0){await so(d);let i=d.reduce((N,V)=>(N[`_declinedAutoAdd__${V.cartAttribute}`]=null,N),{});return Ge(i)}return new Promise(i=>i(t))}catch(r){return console.error("Error in handleAutoAddsRemove",r),new Promise(d=>d(t))}},ss=async t=>{let r=(ie,Pe)=>{let{key:le,quantity:Te,properties:tt}=ie,xs=Uo([]),ws={...tt,...xs,_channel:"peepers.com"};return{id:le,quantity:Te,properties:ws}},d=(ie,Pe)=>ie.filter(le=>!le.properties?.[Ho]).map(le=>r(le,Pe)),i=async ie=>{for await(let Pe of ie){let{id:le,quantity:Te,properties:tt}=Pe;await Et(le,Te,tt)}},N=Vo();if(!N||N.length===0)return t;let V=d(t.items,N);return V.length>0?(await i(V),await ot()):t},Oe=async t=>{L(!1),t=await ss(t),t=await es(t),t=await ts(t),t=await os(t),t=await as(t),PubSub.publish(ge.From.SideCartApp.ShopifyCartUpdated,{ShopifyCart:t}),j(!0),R(t);for(let r of document.querySelectorAll(".js-ajax-cart-container")){let d=JSON.parse(r.dataset.hasItemsClasses||"[]"),i=JSON.parse(r.dataset.hasNoItemsClasses||"[]");t.items.length>0?(r.classList.remove(...i),r.classList.add(...d),r.querySelector(".js-ajax-cart-count-container")?.classList.remove("hidden")):(r.classList.remove(...d),r.classList.add(...i),r.querySelector(".js-ajax-cart-count-container")?.classList.add("hidden"))}return t};(0,w.useEffect)(()=>{(async()=>{let r=await ot();if(Oe(r),window?.Peepers?.isSunExperience&&!r.attributes._isSunExperience){let d=await Ge({_isSunExperience:!0});Oe(d)}})()},[]);let rs=()=>{C(!y),document.body.classList.toggle("!overflow-y-hidden"),document.body.classList.toggle("cart-is-opened"),document.querySelector("main").ariaHidden=!document.querySelector("main").ariaHidden},ko=()=>{C(!0),M(!0),document.body.classList.add("!overflow-y-hidden"),document.body.classList.add("cart-is-opened"),document.querySelector("main").ariaHidden=!0},Ao=()=>{L(!1),C(!1),document.body.classList.remove("!overflow-y-hidden"),document.body.classList.remove("cart-is-opened"),document.querySelector("main").ariaHidden=!1,document.documentElement.style.removeProperty("overflow"),document.documentElement.style.removeProperty("padding-right")};(0,w.useEffect)(()=>
123{if(l==="#cart"){ko();let t=document.querySelector("#gvloApp"),r=document.querySelector("#gvloModal");t&&r&&(t.style.display="none",r.classList.add("gvlo-hidden"))}},[l]),Ee(ge.To.SideCart.RequestToggle,t=>{rs()}),Ee(ge.To.SideCart.RequestOpen,t=>{ko()}),Ee(ge.To.SideCart.RequestClose,t=>{Ao()}),Ee(ge.To.SideCart.RequestUpdate,t=>{t?.cart&&Oe(t.cart)}),Ee(ge.From.LegacyAjaxSectionLoader.AjaxSectionLoaded,t=>{if(t?.sectionName==="ajax-cart-products"){let r="#side-cart-products";oe(document.querySelector(r)?(d=>{try{return JSON.parse(d)?.products}catch(i){return console.log("Error parsing recommended products JSON",i),[]}})(document.querySelector(r).text):{})}}),(0,w.useEffect)(()=>{y?(document.body.classList.add("!overflow-y-hidden"),document.body.classList.add("cart-is-opened"),document.querySelector("main").ariaHidden=!0):(L(!1),document.body.classList.remove("!overflow-y-hidden"),document.body.classList.remove("cart-is-opened"),document.querySelector("main").ariaHidden=!1,document.documentElement.style.removeProperty("overflow"),document.documentElement.style.removeProperty("padding-right"))},[y]);let ns=async t=>{if(t?.properties?.["_oft-landing"]&&de("OFT Collection","Removed featured product from cart"),t?.properties?._autoAdd&&t.properties._autoAddTitleIncludesSubstring){let d=`_declinedAutoAdd__${ft(t.properties._autoAddTitleIncludesSubstring)}`;await Ge({[d]:!0})}let r=await Et(t.key,0);Oe(r)},is=async(t,r)=>{let d=await Et(t.key,r,t.properties?t.properties:{});Oe(d)},kt=async(t,r={})=>await Nt({id:t.id,quantity:1,compareAtPrice:t.compare_at_price,price:t.price,tags:t.tags,sku:t.sku,properties:r,doShowDrawer:!0}),Po=!!(e.saleShelf?.enabled&&e.saleShelf?.collectionHandle&&window.Peepers?.sale?.meta),At=k.items.length>0?k.items.find(t=>t.options_with_values.find(r=>r.name==="Strength"))?.options_with_values.find(t=>t.name==="Strength").value:mt.selection?mt.selection:null,Ze=Wa({shopifyCart:k,settings:e,isCartOpen:y,isExchangeFlow:J()||!!Ae,defaultStrengthSelection:At}),To=(0,w.useRef)(null);(0,w.useEffect)(()=>{let t=Ze.evaluation?.groups??null;if(!q||t===null)return;let r=To.current;if(To.current=t,r===null||t<=r)return;let{offer:d,units:i,freshGroupCents:N,savingsCents:V}=Ze.evaluation;de(ua,"Completed",d.type,t);let ie=d.type==="multi_buy"?`${i} for ${Gt(N*t)}`:"Buy one, get one";to({toastDuration:2500,toastMarkup:()=>(0,a.jsxs)("div",{className:"flex flex-col justify-center items-start text-left",children:[(0,a.jsxs)("span",{className:"text-lg text-gray-900 font-heading",children:["That's ",ie,"."]}),(0,a.jsxs)("span",{className:"leading-relaxed text-gray-600",children:["You saved ",Gt(V),"."]})]})},{})},[Ze.evaluation?.groups,q]);let Io=(()=>{let t=[];if(J()||Ae)return t;if(e.shippingStandardPromotion.enabled){let{minimumThresholdUS:r,minimumThresholdCA:d,showRecommendedItems:i,showPromotionIndicator:N}=e.shippingStandardPromotion;if(!(d===-1&&Shopify.currency.active!=="USD")){let V=["USD"];d!==-1&&V.push("CAD"),t.push({id:"shippingStandard",completed:!1,showMeter:!0,meterSettings:{...e.shippingStandardPromotion,id:"shippingStandard"},showRecommendedItems:i,recommendedItems:[],recommendationsOnlyOverAmountAwayThreshold:!0,recommendationsSaleItemsOnly:!1,currencies:V,enableToast:Shopify.currency.active==="USD"&&r>0&&e.shippingStandardPromotion.showToast||Shopify.currency.active==="CAD"&&d>0&&e.shippingStandardPromotion.showToast,requiresSelection:!1,toastMarkup:()=>(0,a.jsxs)("div",{className:"flex flex-col justify-center items-start text-left",children:[(0,a.jsxs)("div",{className:"flex flex-row gap-3 justify-start items-center pb-2 w-full",children:[(0,a.jsx)("div",{className:"p-2 rounded-full bg-secondary/10 text-secondary",children:(0,a.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"w-5 h-5",children:[(0,a.jsx)("path",{d:"M6.5 3c-1.051 0-2.093.04-3.125.117A1.49 1.49 0 002 4.607V10.5h9V4.606c0-.771-.59-1.43-1.375-1.489A41.568 41.568 0 006.5 3zM2 12v2.5A1.5 1.5 0 003.5 16h.041a3 3 0 015.918 0h.791a.75.75 0 00.75-.75V12H2z"}),(0,a.jsx)("path",{d:"M6.5 18a1.5 1.5 0 100-3 1.5 1.5 0 000 3zM13.25 5a.75.75 0 00-.75.75v8.514a3.001 3.001 0 014.893 1.44c.37-.275.61-.719.595-1.227a24.905 24.905 0 00-1.784-8.549A1.486 1.486 0 0014.823 5H13.25zM14.5 18a1.5 1.5 0 100-3 1.5 1.5 0 000 3z"})]})}),(0,a.jsx)("span",{className:"text-lg text-gray-900 font-heading",children:"Free Standard Shipping Unlocked"})]}),(0,a.jsx)("span",{className:"leading-relaxed text-gray-600",children:"You've qualified for free standard shipping!"})]}),toastDuration:2250,enableIndicator:N,indicatorMarkup:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"w-5 h-5",children:[(0,a.jsx)("path",{d:"M6.5 3c-1.051 0-2.093.04-3.125.117A1.49 1.49 0 002 4.607V10.5h9V4.606c0-.771-.59-1.43-1.375-1.489A41.568 41.568 0 006.5 3zM2 12v2.5A1.5 1.5 0 003.5 16h.041a3 3 0 015.918 0h.791a.75.75 0 00.75-.75V12H2z"}),(0,a.jsx)("path",{d:"M6.5 18a1.5 1.5 0 100-3 1.5 1.5 0 000 3zM13.25 5a.75.75 0 00-.75.75v8.514a3.001 3.001 0 014.893 1.44c.37-.275.61-.719.595-1.227a24.905 24.905 0 00-1.784-8.549A1.486 1.486 0 0014.823 5H13.25zM14.5 18a1.5 1.5 0 100-3 1.5 1.5 0 000 3z"})]}),(0,a.jsxs)("span",{className:"pt-1 leading-none",children:["Free Standard Shipping"," ",Shopify.currency.active==="USD"?`($${r}+)`:`($${d}+)`]})]})})}}if(g.enabled)for(let r of g.promotions){let d=m.find(le=>le.id===r.id),{isStoreCredit:i,indicatorText:N,requiresSelection:V}=r,{minimumThresholdUS:ie,minimumThresholdCA:Pe}=r.meterSettings;t.push({...r,showRecommendedItems:!0,recommendedItems:[],recommendationsOnlyOverAmountAwayThreshold:!1,recommendationsSaleItemsOnly:!1,gwp:d,toastDuration:2250,toastMarkup:({productTitle:le="gift"})=>(0,a.jsxs)("div",{className:"flex flex-col justify-center items-start text-left",children:[(0,a.jsxs)("div",{className:"flex flex-row gap-3 justify-start items-center pb-2 w-full",children:[(0,a.jsx)("div",{className:"p-2 rounded-full bg-secondary/10 text-secondary",children:i?(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"size-6",style:{fill:"none"},children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v12m-3-2.818.879.659c1.171.879 3.07.879 4.242 0 1.172-.879 1.172-2.303 0-3.182C13.536 12.219 12.768 12 12 12c-.725 0-1.45-.22-2.003-.659-1.106-.879-1.106-2.303 0-3.182s2.9-.879 4.006 0l.415.33M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})}):(0,a.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"w-5 h-5",children:[(0,a.jsx)("path",{fillRule:"evenodd",d:"M14 6a2.5 2.5 0 00-4-3 2.5 2.5 0 00-4 3H3.25C2.56 6 2 6.56 2 7.25v.5C2 8.44 2.56 9 3.25 9h6V6h1.5v3h6C17.44 9 18 8.44 18 7.75v-.5C18 6.56 17.44 6 16.75 6H14zm-1-1.5a1 1 0 01-1 1h-1v-1a1 1 0 112 0zm-6 0a1 1 0 001 1h1v-1a1 1 0 00-2 0z",clipRule:"evenodd"}),(0,a.jsx)("path",{d:"M9.25 10.5H3v4.75A2.75 2.75 0 005.75 18h3.5v-7.5zM10.75 18v-7.5H17v4.75A2.75 2.75 0 0114.25 18h-3.5z"})]})}),(0,a.jsx)("span",{className:"text-lg text-gray-900 font-heading",children:i?"Store Credit Unlocked":"Free Gift Unlocked"})]}),(0,a.jsx)("span",{className:"leading-relaxed text-gray-600",children:i?(0,a.jsx)(a.Fragment,{children:"You've qualified for a bonus store credit! It will be emailed to you after checkout."}):(0,a.jsxs)(a.Fragment,{children:["You've qualified for a free gift with purchase! Your free ",(0,a.jsx)("strong",{children:le})," has been",V?" ":" automatically"," added to your cart."]}
123)})]}),enableIndicator:r.showPromotionIndicator,indicatorMarkup:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"w-5 h-5",children:[(0,a.jsx)("path",{fillRule:"evenodd",d:"M14 6a2.5 2.5 0 00-4-3 2.5 2.5 0 00-4 3H3.25C2.56 6 2 6.56 2 7.25v.5C2 8.44 2.56 9 3.25 9h6V6h1.5v3h6C17.44 9 18 8.44 18 7.75v-.5C18 6.56 17.44 6 16.75 6H14zm-1-1.5a1 1 0 01-1 1h-1v-1a1 1 0 112 0zm-6 0a1 1 0 001 1h1v-1a1 1 0 00-2 0z",clipRule:"evenodd"}),(0,a.jsx)("path",{d:"M9.25 10.5H3v4.75A2.75 2.75 0 005.75 18h3.5v-7.5zM10.75 18v-7.5H17v4.75A2.75 2.75 0 0114.25 18h-3.5z"})]}),(0,a.jsx)("span",{className:"pt-1 leading-none",children:Shopify.currency.active==="USD"?N.replace("[amount]",`$${ie}`):N.replace("[amount]",`$${Pe}`)})]})})}if(e.shippingExpeditedPromotion.enabled){let{minimumThresholdUS:r,minimumThresholdCA:d,showRecommendedItems:i,showPromotionIndicator:N}=e.shippingExpeditedPromotion;if(!(d===-1&&Shopify.currency.active!=="USD")){let V=["USD"];d!==-1&&V.push("CAD"),t.push({id:"shippingExpedited",completed:!1,showMeter:!0,meterSettings:{...e.shippingExpeditedPromotion,id:"shippingExpedited"},showRecommendedItems:i,recommendedItems:[],recommendationsOnlyOverAmountAwayThreshold:!0,recommendationsSaleItemsOnly:!1,currencies:V,enableToast:e.shippingExpeditedPromotion.showToast,toastDuration:2250,requiresSelection:!1,toastMarkup:()=>(0,a.jsxs)("div",{className:"flex flex-col justify-center items-start text-left",children:[(0,a.jsxs)("div",{className:"flex flex-row gap-3 justify-start items-center pb-2 w-full",children:[(0,a.jsx)("div",{className:"p-2 rounded-full bg-secondary/10 text-secondary",children:(0,a.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"w-5 h-5",children:[(0,a.jsx)("path",{d:"M6.5 3c-1.051 0-2.093.04-3.125.117A1.49 1.49 0 002 4.607V10.5h9V4.606c0-.771-.59-1.43-1.375-1.489A41.568 41.568 0 006.5 3zM2 12v2.5A1.5 1.5 0 003.5 16h.041a3 3 0 015.918 0h.791a.75.75 0 00.75-.75V12H2z"}),(0,a.jsx)("path",{d:"M6.5 18a1.5 1.5 0 100-3 1.5 1.5 0 000 3zM13.25 5a.75.75 0 00-.75.75v8.514a3.001 3.001 0 014.893 1.44c.37-.275.61-.719.595-1.227a24.905 24.905 0 00-1.784-8.549A1.486 1.486 0 0014.823 5H13.25zM14.5 18a1.5 1.5 0 100-3 1.5 1.5 0 000 3z"})]})}),(0,a.jsx)("span",{className:"text-lg text-gray-900 font-heading",children:"Free Expedited Shipping Unlocked"})]}),(0,a.jsx)("span",{className:"leading-relaxed text-gray-600",children:"You've qualified for free expedited shipping!"})]}),enableIndicator:N,indicatorMarkup:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex",children:[(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"w-5 h-5",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 13.5l10.5-11.25L12 10.5h8.25L9.75 21.75 12 13.5H3.75z"})}),(0,a.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"w-5 h-5",children:[(0,a.jsx)("path",{d:"M6.5 3c-1.051 0-2.093.04-3.125.117A1.49 1.49 0 002 4.607V10.5h9V4.606c0-.771-.59-1.43-1.375-1.489A41.568 41.568 0 006.5 3zM2 12v2.5A1.5 1.5 0 003.5 16h.041a3 3 0 015.918 0h.791a.75.75 0 00.75-.75V12H2z"}),(0,a.jsx)("path",{d:"M6.5 18a1.5 1.5 0 100-3 1.5 1.5 0 000 3zM13.25 5a.75.75 0 00-.75.75v8.514a3.001 3.001 0 014.893 1.44c.37-.275.61-.719.595-1.227a24.905 24.905 0 00-1.784-8.549A1.486 1.486 0 0014.823 5H13.25zM14.5 18a1.5 1.5 0 100-3 1.5 1.5 0 000 3z"})]})]}),(0,a.jsxs)("span",{className:"pt-1 leading-none",children:["FREE EXPEDITED SHIPPING"," ",Shopify.currency.active==="USD"?`$${r}+`:`$${d}+`]})]})})}}return t?.filter(r=>r.currencies.includes(Shopify.currency.active))})(),[Se,ls]=(0,w.useState)(Io),Ro=(0,w.useRef)(g.offers);(0,w.useEffect)(()=>{Ro.current!==g.offers&&(Ro.current=g.offers,ls(Io))},[g.offers]);let[Pt,ds]=(0,w.useState)(()=>{try{let t=localStorage.getItem("toastedPromotionIds");return t?JSON.parse(t):[]}catch{return[]}}),Eo=(0,w.useRef)(!1),Mo=(0,w.useCallback)(t=>{ds(r=>{let d=typeof t=="function"?t(r):t;if(Eo.current)try{localStorage.setItem("toastedPromotionIds",JSON.stringify(d))}catch(i){console.error("Failed to save toasted IDs to localStorage:",i)}return d})},[]);(0,w.useEffect)(()=>{Eo.current=!0},[]);let Do=(0,w.useRef)(null),Oo=ea(),Ce=Se?.findIndex(t=>(Shopify.currency.active==="USD"?t.meterSettings.minimumThresholdUS:t.meterSettings.minimumThresholdCA)*100-k.total_price>0?t:null),[wt,$o]=(0,w.useState)(Ce);(0,w.useEffect)(()=>{$o(Ce)},[Ce]);let Lo=t=>{$o(t)},[Zt,eo]=(0,w.useState)([]);Ee(ge.From.InternalPdpHub.To.SideCartApp.RequestCurrentState,t=>
123{let r=ge.To.InternalPdpHub.From.SideCartApp.RequestCurrentStateResponse;q?PubSub.publish(r,{ShopifyCart:k}):eo(d=>[...d,r])}),Ee(ge.From.FilterableResultsListingApp.To.SideCartApp.RequestCurrentState,t=>{let r=ge.To.FilterableResultsListingApp.From.SideCartApp.RequestCurrentStateResponse;q?PubSub.publish(r,{ShopifyCart:k}):eo(d=>[...d,r])}),(0,w.useEffect)(()=>{q&&Zt.length>0&&(Zt.forEach(t=>{PubSub.publish(t,{ShopifyCart:k})}),eo([]))},[q,Zt.length]);let Cr=g.enabled,_r=Ce>-1?Se[Ce]:null,et=Ce===-1?Se?.[Se?.length-1]:Ce===0?null:Ce>0?Se[Ce-1]:null,yt=g.states(k,{klaviyoIdentified:A}),cs=yt.filter(t=>t.status==="claimed").map(t=>t.offer.id).join("|"),to=(t,r={},d=2250)=>{let{toastMarkup:i,toastDuration:N}=t,V=N??d;lo.custom(ie=>(0,a.jsx)("div",{className:`${ie.visible?"animate-enter":"animate-leave"} w-full max-w-md overflow-hidden bg-white shadow-2xl pointer-events-auto rounded-2xl border border-gray-100`,children:(0,a.jsxs)("div",{className:"relative p-5",children:[(0,a.jsx)("div",{className:"absolute top-4 right-4",children:(0,a.jsxs)("button",{type:"button",className:"inline-flex text-gray-300 bg-white rounded-md hover:text-gray-500 focus:outline-none",onClick:()=>{lo.dismiss()},children:[(0,a.jsx)("span",{className:"sr-only",children:"Close"}),(0,a.jsx)(He,{className:"w-5 h-5","aria-hidden":"true"})]})}),(0,a.jsx)("div",{className:"flex items-start pr-6",children:(0,a.jsx)("div",{className:"flex-1 w-0",children:(0,a.jsx)("div",{className:"flex flex-col flex-wrap text-sm font-medium text-gray-900",children:i(r)})})})]})}),{duration:V})},oo=(0,w.useRef)(!1);if((0,w.useEffect)(()=>{oo.current||(Do.current=Pt,oo.current=!0)},[Pt]),(0,w.useEffect)(()=>{oo.current&&(Do.current=Pt)},[Pt]),(0,w.useEffect)(()=>{let t=()=>{try{let r=localStorage.getItem("toastedPromotionIds");return r?JSON.parse(r):[]}catch(r){return console.error("Error reading localStorage:",r),[]}};if(Ce>0&&Mo(r=>{let d=r.filter(i=>{let N=Se.findIndex(V=>V.id===i);return N!==-1&&N<Ce});return d.length!==r.length?d:r}),G&&et){let{enableToast:r,requiresSelection:d,id:i}=et,N=t();if(r&&d===!1&&!N.includes(i)&&Ma(et,yt)){let V={productTitle:Array.isArray(et?.gwp?.products)&&et.gwp.products.length>0?et.gwp.products[0].title:null};to(et,V),Mo(ie=>[...ie,i])}}},[Ce,G,et,Se,cs]),!q)return null;let ps=k.items.find(t=>t.properties?.Includes==="free case"),ms=null,Tt=Dt(),us=Tt?.applyToEntireCatalog?!0:k.items.find(t=>t.properties?.[Mt]),Bo=Tt?.code&&Tt?.automaticallyApply&&us?Tt.code:null,Go=k?.attributes?Object.entries(k?.attributes).filter(([t,r],d)=>t.includes("_declinedAutoAdd")).map(([t])=>({key:t.split("__")[1],autoAdd:o.find(r=>ft(r.requiredProductTitleSubstring)===t.split("__")[1])})):[],fs=Go.length>0,gs=async t=>{let r=await Ge({[`_declinedAutoAdd__${ft(t)}`]:null});Oe(r)},hs=J()||Ae?[]:yt.filter(t=>t.status==="declined"&&t.choices.length>0),zo="Gift with purchase",Fo=t=>{yt.find(r=>r.offer.id===t)?.status==="declined"&&de(zo,"Re-added gift",t)},bs=async t=>{if(t.choices.length>1){let N=m.find(V=>V.id===t.offer.id);N&&L({...N,products:t.tier.products});return}let[r]=t.choices,d=t.tier.products.find(N=>N.variants?.some(V=>V.id===r.id)),i=await Nt({id:r.id,quantity:1,tags:d?.tags||[],properties:vt(t.offer),attributes:Wt(t.offer)});if(!Ut(i,t.offer.id,r.id)){g.markSoldOut([r.id]);return}Fo(t.offer.id)},vs=y&&H&&!J(),qo=k.items.filter(t=>!qt(t)).filter(t=>["Readers","Progressives","Sunglasses"].includes(t.product_type)).reduce((t,r)=>t+r.quantity,0),jo=()=>(0,a.jsx)(Ga,{pendingExchangeData:D,remainingExchangeValue:Yt,shopifyCart:k,totalPriceMoney:it,originalTotalPriceMoney:Xa,isSaleActive:vo});return(0,a.jsxs)("div",{className:"Component__SideCartApp",children:[(0,a.jsx)("style",{children:` 124 div[role="dialog"][aria-label="POPUP Form"].needsclick:has([data-testid="klaviyo-form-UTB7YL"]) { 125 z-index: 2147483647 !important; 126 } 127 .SideCartPromotionMeter-wrapper.block.w-full:empty { 128 display: none; 129 } 130 `}),(0,a.jsxs)(ze.Provider,{value:p,children:[(0,a.jsx)(Ca,{defaultGender:ms}),(0,a.jsx)(_a,{}),(0,a.jsx)(ga,{containerStyle:{zIndex:"var(--z-index-max)"},position:"top-left"}),(0,a.jsx)(Ne.Root,{show:y,as:w.Fragment,afterLeave:()=>{setTimeout(()=>{document.documentElement.style.removeProperty("overflow"),document.documentElement.style.removeProperty("padding-right")},50)},children:(0,a.jsxs)(ye,{as:"div",className:"relative z-index-max--1",onClose:C,ref:st(C),children:[(0,a.jsx)(La,{show:vs,gwp:H||null,onAddToCart:(t,r)=>{let d=Se.find(i=>i.id===t.id);if(L(!1),Fo(t.id),d?.enableToast){let i=t.products.find(N=>N.variants?.some(V=>V.id===r.id))?.title?.split(" - ")[0];to(d,{productTitle:i})}},onDecline:async t=>{L(!1);let r=Da(yt.find(i=>i.offer.id===t.id));if(!r)return;de(zo,"Declined gift",t.id);let d=await Ge(r);d&&Oe(d)},onGiftUnavailable:(t,r)=>{g.markSoldOut([r.id]);let d=(t.products||[]).map(i=>({...i,variants:(i.variants||[]).map(N=>String(N.id)===String(r.id)?{...N,available:!1}:N)}));L(_t(d).length>0?{...t,products:d}:!1)}}),(0,a.jsx)(Ne.Child,{as:w.Fragment,enter:"ease-in-out duration-500",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in-out duration-500",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,a.jsx)("div",{className:"fixed inset-0 transition-opacity bg-black/50"})}),(0,a.jsx)("div",{className:"overflow-hidden fixed inset-0",children:(0,a.jsx)("div",{className:"overflow-hidden absolute inset-0",children:(0,a.jsx)("div",{className:"flex fixed inset-y-0 right-0 max-w-full pointer-events-none md:pl-10",children:(0,a.jsx)(Ne.Child,{as:w.Fragment,enter:"transform transition ease-in-out duration-500 sm:duration-700",enterFrom:"translate-x-full",enterTo:"translate-x-0",leave:"transform transition ease-in-out duration-500 sm:duration-700",leaveFrom:"translate-x-0",leaveTo:"translate-x-full",children:(0,a.jsx)(ye.Panel,{className:"max-w-full pointer-events-auto",children:(0,a.jsxs)("div",{className:"flex flex-col h-full md:flex-row max-lg:overflow-y-auto lg:justify-end ",children:[(0,a.jsxs)("div",{className:"flex flex-col h-full bg-white shadow-xl order-1 md:w-[514px] md:order-2 max-h-screen",children:[(0,a.jsxs)("div",{className:"text-center bg-white",children:[(0,a.jsxs)("div",{style:{"--color-background":e.appearance.color.background,"--color-border":e.appearance.color.border,"--color-text":e.appearance.color.text},className:"bg-[color:var(--color-background)] border-[color:var(--color-border)] text-[color:var(--color-text)] flex items-center justify-center px-4 py-1 text-center sm:px-6 md:py-3",children:[(0,a.jsxs)(ye.Title,{className:"flex flex-col justify-center items-center ml-auto",children:[(0,a.jsx)("span",{className:"text-2xl font-secondary",children:J()?"Exchange":"Your Cart"}),J()&&D?.orderName&&(0,a.jsxs)("span",{className:"text-xs font-medium text-gray-500",children:["for Order ",D.orderName]}),(0,a.jsxs)("span",{role:"status","aria-live":"polite",className:"text-[10px] font-bold tracking-widest uppercase text-gray-400 mt-0.5",children:[Jt," Item",Jt===1?"":"s"]})]}),(0,a.jsx)("div",{className:"flex items-center ml-auto h-7",children:(0,a.jsxs)("button",{"aria-label":"Close panel",type:"button",className:"bg-[color:var(--color-background)] border-[color:var(--color-border)] text-[color:var(--color-text)] focu
130s:outline-none focus:ring-2 focus:ring-white",onClick:Ao,children:[(0,a.jsx)("span",{className:"sr-only",children:"Close panel"}),(0,a.jsx)(He,{className:"w-6 h-6","aria-hidden":"true"})]})})]}),(0,a.jsxs)("div",{className:`${Be?"lg:hidden":""}`,children:[Se?.filter(t=>t.enableIndicator).length>1&&!0&&(0,a.jsx)("div",{children:(0,a.jsxs)("div",{className:"mx-2 mt-2 rounded-xl overflow-hidden shadow-sm border border-[#e9ebed]",children:[Be&&(0,a.jsx)("div",{className:"bg-[#4752A3] text-white text-center py-3 px-2 text-lg font-secondary",children:"Sale Promotions"}),(0,a.jsx)("div",{className:"flex divide-x divide-[#e9ebed]",style:{"--flex-basis-desktop":`${100/Se.length}%`},children:Se.filter(t=>t.enableIndicator).map((t,r)=>{let{indicatorMarkup:d}=t,i=wt>-1&&r===wt,N=Ce===-1||r<Ce;return(0,a.jsxs)("button",{className:`relative transition-all duration-150 ease-in-out basis-[var(--flex-basis-desktop)] ${N?"bg-[#e9ebed]":"bg-white"} ${i?"top-px":""}`,onClick:()=>{Lo(r)},type:"button",children:[(0,a.jsx)("div",{className:`transition-all duration-150 ease-in-out h-full flex items-start justify-center ${N?"opacity-50":"opacity-100"} ${i?"border border-grey border-b-0 bg-[#fafafb]":"hover:scale-105"}`,children:(0,a.jsx)("div",{className:"flex flex-col items-center justify-center pt-0.5 pb-1 md:py-2 px-1 gap-0.5 text-[10px] md:text-[11px] font-bold tracking-wider uppercase",children:d})}),N&&(0,a.jsx)("div",{className:"absolute top-1 right-1 text-secondary",children:(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"w-5 h-5",children:(0,a.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})})})]},`promotion-${t.id}`)})})]})}),!J()&&(0,a.jsx)("div",{ref:Oo,className:"w-full overflow-x-scroll no-scrollbar shadow-[0px_5px_8px_-3px_rgba(0,0,0,0.25)]",children:(0,a.jsx)("div",{style:{"--container-width-desktop":`${Se?.filter(t=>t.showMeter).length*100}%`,"--promotion-width-desktop":`${100/Se?.filter(t=>t.showMeter).length}%`},className:"flex w-full",children:Se?.filter(t=>t.showMeter).map((t,r)=>{let{meterSettings:d,recommendedItems:i}=t,N=wt>-1&&r===wt;return(0,a.jsx)("div",{className:`w-full ${N?"block":"hidden"} SideCartPromotionMeter-wrapper`,children:(0,a.jsx)(Ft,{isBfcm:Be,isActive:N,settings:d,totalPrice:Qe,totalNumberOfFullPriceItems:qo,metRequiredEmailViaFormId:k?.attributes?._isConditionalGWPEligible,recommendedItems:i,addSelectedVariantToCart:kt,defaultStrengthSelection:At,showRecommendations:fe})},d.id)})})})]})]}),(0,a.jsx)("div",{ref:z,className:I?"overflow-y-auto flex-1 h-0":"overflow-y-auto",children:(0,a.jsx)("div",{className:"flex flex-col flex-1 justify-between",children:(0,a.jsx)("div",{ref:T,className:"px-4 divide-y divide-gray-200 sm:px-6",children:(0,a.jsx)("div",{className:"pt-0 pb-5 mt-2 space-y-6 lg:mt-2",children:(0,a.jsx)("div",{children:(0,a.jsxs)("div",{className:"",children:[!1,(0,a.jsx)("div",{className:"flex flex-col space-y-3",children:k?.items.length===0?(0,a.jsxs)("div",{className:"order-3 px-2 py-2 bg-white md:order-2",children:[J()&&D?.lineItems&&!D.completed&&jo(),(0,a.jsx)("p",{className:"flex flex-col mt-0 mb-6 text-lg text-center md:text-lg",children:J()&&!D?.completed?"You haven't added any items to your exchange yet. Shop the site to add items.":e.empty.message}),!J()&&(0,a.jsx)("div",{className:"px-4",children:(0,a.jsx)("ul",{className:"flex flex-col gap-4",children:[{link:"/collections/readers",label:"Shop Readers",sublabel:Be?`As low as $22${window?.Shopify?.currency?.active!=="USD"?" USD":""}!`:null},{link:"/collections/progressives",label:"Shop Progressives",sublabel:Be?`$35${window?.Shopify?.currency?.active!=="USD"?" USD":""} Progressives!`:null},{link:"/collections/sunglasses",label:"Shop Sun",sublabel:Be?`$24${window?.Shopify?.currency?.active!=="USD"?" USD":""} Sunglasses!`:null},{link:"/collections/sale",label:"Shop Sale",sublabel:Be?`As low as $12${window?.Shopify?.currency?.active!=="USD"?" USD":""}`:null},{link:"/collections/accessories",label:"Shop Accessories"}].map(t=>(0,a.jsxs)("li",{className:"relative list-none bg-white border-2 border-secondary group hover:bg-secondary hover:border-secondary",children:[(0,a.jsx)("a",{className:"absolute inset-0",href:t.link,"aria-label":t.label}),(0,a.jsxs)("div",{className:"flex flex-col justify-center items-center px-3 py-3 font-semibold tracking-wider text-center uppercase text-secondary group-hover:text-white",children:[(0,a.jsx)("div",{children:t.label}),t.sublabel&&(0,a.jsx)("div",{className:"text-sm italic font-medium tracking-normal normal-case",children:t.sublabel})]})]},t.label))})})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"flex justify-between items-start",children:ps&&!J()&&(0,a.jsx)("div",{style:{order:"-2"},className:"text-[11px] lg:text-xs italic text-left opacity-70",children:e.freeCase.copy})}),fs&&Go.map(t=>t?.autoAdd?.product?(0,a.jsx)("button",{type:"button",style:{order:"100"},className:"flex items-center justify-center gap-3 text-sm text-center bg-[#ededed] px-4 py-1 opacity-70 hover:opacity-100 border-dashed border",onClick:()=>gs(t.key),children:(0,a.jsxs)("span",{className:"leading-none",children:["You declined your"," ",(0,a.jsx)("strong",{children:t.autoAdd.product.title.replace("TEST ","")}),". Click to re-add."]})}):null),hs.map(t=>(0,a.jsx)(Ha,{state:t,onReAdd:bs}
130,t.offer.id)),J()&&D?.lineItems&&!D?.completed&&jo(),J()&&!D?.completed&&(0,a.jsx)("div",{className:"flex flex-row items-center justify-between gap-3 !mt-0",children:(0,a.jsx)("div",{className:"text-lg font-medium text-secondary",children:"Items you've added to your exchange"})}),Ze.active&&(0,a.jsx)("div",{style:{order:-10},className:"!mt-0",children:(0,a.jsx)(fa,{pairUp:Ze,addSelectedVariantToCart:kt,hasItems:k.items.length>0})}),k.items.map((t,r)=>{let d=t.key,i=Ze.active?ma(Ze.evaluation.lines.find(N=>N.key===t.key),Ze.evaluation,{money:Gt}):null;return(0,a.jsx)(ha,{removeLineItem:ns,updateLineItemQuantity:is,item:t,index:r,handleDisclosureToggle:$,customDiscountMessage:!1,pairHint:i,isBfcm:Be,geoBlockedStateName:re.has(co(t))?f:""},d)})]})})]})})})})})}),(k?.items.length>0||J())&&(0,a.jsx)("div",{className:`flex justify-end flex-shrink-0 px-3 md:px-6 pt-2 md:pt-4 pb-2 bg-[#fafafb] ${I?"static md:static z-[1] bottom-0 w-full bg-white shadow-[0px_-5px_8px_-3px_rgba(0,0,0,0.25)]":"z-[1] mt-4 md:mt-8 bg-white shadow-[0px_-5px_8px_-3px_rgba(0,0,0,0.25)]"}`,children:(0,a.jsxs)("div",{className:"flex flex-col items-center space-y-1 w-full",children:[pe&&Object.keys(Xe).length>0&&(0,a.jsxs)("div",{className:"hidden flex-col gap-4 justify-between items-end pb-2 mb-3 w-full text-sm border-b md:flex border-peepersgrey text-secondary",children:[(0,a.jsx)("div",{className:"flex",children:(0,a.jsxs)("button",{className:"flex gap-1 justify-center items-center font-semibold",type:"button",onClick:()=>ke(!be),children:[(0,a.jsx)("span",{className:"font-medium",children:"Total Sale Savings: "}),(0,a.jsxs)("span",{className:"font-semibold",children:[_o.currencyNarrowSymbol,_o.amount.replace(".00","")]}),(0,a.jsx)("span",{className:`${be?"hidden":"inline"} relative -top-px`,children:(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",style:{fill:"none"},viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-4 h-4",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 4.5l7.5 7.5-7.5 7.5"})})}),(0,a.jsx)("span",{className:`${be?"inline":"hidden"} relative -top-px`,children:(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",style:{fill:"none"},viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-4 h-4",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 8.25l-7.5 7.5-7.5-7.5"})})}),(0,a.jsx)("span",{className:"sr-only",children:"Click for detailed savings breakdown"})]})}),(0,a.jsx)("div",{"aria-hidden":!be,className:`${be?"flex":"hidden"} flex-col items-end justify-end -mt-px`,children:Object.entries(Xe).map(([t,{amount:r,endTime:d}])=>(0,a.jsx)(br,{title:t,amount:r},t))})]}),k?.items.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex justify-between items-start mb-1 w-full md:mb-2",children:[(0,a.jsxs)("div",{className:"flex flex-col",children:[!J()&&(0,a.jsx)("span",{className:"font-bold tracking-wide uppercase",children:e.checkout.subtotalLabel}),!1]}),!J()&&(Je!==Qe&&Xt?(0,a.jsxs)("div",{className:"flex flex-row gap-1.5 justify-center items-baseline cursor-pointer",title:"Click for total sale savings breakdown",onClick:()=>Q(!pe),children:[(0,a.jsxs)("span",{className:"text-xl font-medium text-[#7C8289] leading-tight line-through",children:[(0,a.jsx)("span",{className:"sr-only",children:"Compare At Price: "}),Xt.currencyNarrowSymbol,Xt.amount.replace(".00","")]}),(0,a.jsxs)("span",{className:"text-lg font-bold leading-tight lg:text-xl",children:[(0,a.jsx)("span",{className:"sr-only",children:"Current Price: "}),it.currencyNarrowSymbol,it.amount.replace(".00","")]})]}):(0,a.jsxs)("span",{className:"text-lg font-bold leading-tight lg:text-xl",children:[it.currencyNarrowSymbol,it.amount.replace(".00","")]}))]}),(0,a.jsxs)("form",{action:"/cart",method:"post",noValidate:!0,className:"mb-2 w-full",children:[Bo&&(0,a.jsx)("input",{name:"discount",type:"hidden",value:Bo}),(!J()||J()&&Ye)&&!D?.completed&&(0,a.jsxs)("button",{type:J()?"button":"submit",onClick:J()?Ja:void 0,disabled:dt,name:"checkout","aria-label":"Proceed to Checkout",className:"flex justify-center items-center py-4 pr-2 pl-2 w-full text-base font-bold tracking-widest leading-none text-center text-white no-underline uppercase bg-green-500 rounded-full transition-all md:text-lg md:pr-6 js-button-checkout-submit md:py-6 hover:indent-4 group",children:[(0,a.jsxs)("span",{className:"flex justify-center items-center ml-auto",children:[(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"relative left-0 mr-2 w-5 h-5 transition-all ease-in-out md:mr-3 group-hover:left-4",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",style:{fill:"none"},d:"M16.5 10.5V6.75a4.5 4.5 0 10-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 002.25-2.25v-6.75a2.25 2.25 0 00-2.25-2.25H6.75a2.25 2.25 0 00-2.25 2.25v6.75a2.25 2.25 0 002.25 2.25z"})}),J()?Ye:e.checkout.checkoutButtonText]}),(0,a.jsx)(ta,{className:"relative left-0 ml-auto w-6 h-6 transition-all ease-in-out group-hover:left-4","aria-hidden":"true"})]})]})]}),J()&&So&&(0,a.jsxs)("div",{role:Qt==="success"?"status":"alert",className:`p-2 text-lg font-medium text-white rounded-md border-2 ${Qt==="success"?"border-secondary bg-secondary":"border-[#8A5A00] bg-[#8A5A00]"}`,children:[(0,a.jsx)("p",{className:"text-xl font-bold tracking-wider text-center uppercase",children:gr[Qt]}),(0,a.jsx)("div",{className:"p-2 mt-2 bg-white text-secondary",children:So})]}),!J()||J()&&Yt<0&&(0,a.jsx)("span",{className:"pt-1.5 md:pt-3 text-[11px] max-[375px]:text-[10px] md:text-xs leading-none opacity-70s",children:e.checkout.paymentsAcceptedDescription}),!J()&&s&&(0,a.jsx)("div",{dangerouslySetInnerHTML:{__html:s}}),J()&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(za,{shopifyCart:k,remainingExchangeValue:Yt,isKeepIt:D?.isKeepIt===!0}),(0,a.jsx)("a",{href:"?clear_exchange=true",className:"block pt-6 mr-auto text-xs text-left text-gray-500 underline hover:text-gray-700",children:"Exit Exchange & Shop Normally"})]})]})}),I===!1&&(0,a.jsx)("div",{className:"bg-[#fafafb] flex-1"})]}),Me===!1&&(0,a.jsx)("div",{className:`absolute right-0 md:right-[225px] lg:right-0 mb-0 cursor-pointer lg:bg-transparent group lg:static lg:p-0 lg:m-0 z-[-1] lg:border-0 lg:shadow-none ${Me?"block px-4 m-4 mt-8 bg-white border-4 border-secondary highlight":"hidden lg:block"}`,onClick:()=>{Me||je(!0)},children:(0,a.jsx)("div",{className:"hidden group-hover:ml-[-122px] lg:block pr-10 groupX bg-[#ededed] group-hover:bg-white rounded-l-full pl-6 py-4 text-[#475b4e] lg:transition-all duration-150 ease-in-out text-center border border-default border-r-0 z-[-1] cursor-pointer text-lg absolute top-16 shadow-xl bg-[#ededed] group-hover:bg-white left-[-100px]",onClick:()=>{de("BFCM","Re-opened desktop promotions panel"),je(!Me)},children:(0,a.jsxs)("div",{className:"flex justify-center items-center",children:[(0,a.jsxs)("div",{className:"flex flex-col pr-16 text-xs font-bold tracking-widest uppercase",children:[(0,a.jsx)("span",{children:"BLACK"}),(0,a.jsx)("span",{children:"FRIDAY"}),(0,a.jsx)("span",{children:"PROMOS"})]}),(0,a.jsx)("span",{className:"'overflow-hidden pl-4 max-w-0 text-xs font-semibold group-hover:max-w-screen-sm group-hover:pl-4 text-default lg:transition-all lg:duration-150 lg:ease-in-out",children:"Expand"})]})})}),(0,a.jsx)(Sa,{promotions:Se,isBfcm:Be,areItemsExpanded:fe,promotionsOpen:Me,setPromotionsOpen:je,trackGaEvent:de,activePromotionIndex:wt,setActivePromotion:Lo,firstIncompletePromotionIndex:Ce,promoScrollRef:Oo,totalPrice:Qe,countRegularPriceItems:qo,shopifyCart:k,addSelectedVariantToCart:kt,defaultStrengthSelection:At,settings:e,desktopAccessoriesUpsellPosition:1,recommendedItems:B}),(B.length>0||Po)&&!J()&&(0,a.jsxs)("div",{className:`${Be?"lg:hidden":""} order-2 md:h-full md:w-[241px] md:px-[28px] md:order-1 bg-[#ededed] border-t border-solid border-[#cccccc] md:border-0 md:overflow-y-scroll z-[1]`,children:[Po&&(0,a.jsx)(Na,{settings:e,shopifyCart:k,isCartOpen:y,defaultStrengthSelection:At}),ae.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h4",{className:"my-5 text-base font-medium text-center font-primary text-default",children:e.recommendedProducts.header}),(0,a.jsx)("div",{className:"grid grid-cols-2 gap-3 mt-3 md:grid-cols-1 md:gap-4",children:ae.map((t,r)=>(0,a.jsx)(zt,{item:t,addSelectedVariantToCart:kt},t.product.id))})]})]}),!1]})})})})})})]})})]})]})}function br({title:e,amount:o}){let s=te({amount:o/100});return(0,a.jsxs)("div",{className:"flex gap-3 justify-end items-center w-full whitespace-nowrap",children:[(0,a.jsx)("div",{className:"flex flex-col items-start text-xs text-right",children:(0,a.jsx)("div",{className:"flex gap-2 justify-center items-center text-xs lg:text-sm",children:(0,a.jsx)("span",{className:"text-xs font-medium leading-none",children:e})})}),(0,a.jsxs)("span",{className:"pl-2 ml-1 -mt-px text-sm font-semibold border-l border-peepersgrey min-w-[25%] text-right",children:[s.currencyNarrowSymbol,s.amount.replace(".00","")]})]})}function vr(){let[e,o]=(0,w.useState)(null),[s,c]=(0,w.useState)(null),[l,n]=(0,w.useState)(window.innerHeight),[u,h]=(0,w.useState)(!1),[f,g]=(0,w.useState)(0),m=(0,w.useCallback)(A=>{A!==null&&o(A.getBoundingClientRect().height)}),p=(0,w.useCallback)(A=>{A!==null&&c(A.getBoundingClientRect().height)}),v=()=>{n(window.innerHeight)};return(0,w.useEffect)(()=>(window.addEventListener("resize",v),()=>{window.removeEventListener("resize",v)}),[]),(0,w.useEffect)(()=>{e&&s&&(fr()?h(!1):!u&&e>s?h(!0):u&&e<s&&h(!1))},[f,e,s]),{itemsRef:m,itemsContainerRef:p,windowHeight:l,isSideCartScrollable:u,handleHeightToggle:()=>g(f+1)}}var bo=hr;document.addEventListener("DOMContentLoaded",()=>{for(let e of document.querySelectorAll('.unmounted[data-app-section="side-cart"]')){e.classList.remove("unmounted");let o=`#${e.id}`;document.querySelector(o)&&document.querySelector(o).querySelector("[data-props]")&&ro(`#${e.id}`,bo)}});window?.Shopify&&window?.Shopify?.designMode&&document.addEventListener("shopify:section:load",e=>{if(e.target.classList.contains("section-side-cart")){let o=`#section-sideCart-${e.detail.sectionId}`;document.querySelector(o)&&document.querySelector(o).querySelector("[data-props]")&&ro(`#section-side-cart-${e.detail.sectionId}`,bo)}});
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.