1!function(){try{var e="u">typeof window?window:"u">typeof global?global:"u">typeof globalThis?globalThis:"u">typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="8e9ddacc-376a-4c1e-aaeb-a54d7424a205",e._sentryDebugIdIdentifier="sentry-dbid-8e9ddacc-376a-4c1e-aaeb-a54d7424a205")}catch(e){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4887],{35645:(e,t,a)=>{"use strict";a.d(t,{A:()=>m});var r=a(14232),s=a(55504),n=a(58673),i=a(89307),o=a(70572),l=a(19462),c=a(58827),d=a(67454),u=a(32568);async function p(e){let t=new Set(e.map(e=>e.productCode)),a=new Set;e.forEach(e=>{e.relationships&&e.category.toLowerCase()==l.Ay.BUNDLES&&e.relationships.forEach(e=>{e.relatedProductCodes.forEach(e=>{t.has(e)||a.add(e)})})});let r=[...a],s=[];return r.length>0&&(s=await (0,c.Y)("/catalog",d.lR,{productCodes:r})),e.map(t=>{let a=Object.assign({},t);return a.bundledProducts=[],a.relationships.forEach(t=>{"bundledProducts"===t.relationshipLabel&&t.relatedProductCodes.forEach(t=>{let r=s.products.find(e=>e.productCode===t)||e.find(e=>e.productCode===t);a.bundledProducts.push(r)})}),a})}let h=async(e,t)=>{try{let a=await (0,c.Y)("/content",u.ov,{tags:e},t);return a?.getProductDataByTags??[]}catch(e){return console.error(`Error fetching recently viewed content data: ${e.message}`),[]}};function m({productsData:e,sourceProducts:t,enabled:a=!0}){let[l,u]=(0,r.useState)([]),[g,f]=(0,r.useState)(!0),[y,v]=(0,r.useState)(!1),_=(0,s.useAddProducts)();return(0,r.useEffect)(()=>{_([...l])},[l,_]),(0,r.useEffect)(()=>{if(!a)return;let r=(0,o.xG)();(async()=>{try{let a,s=t??(0,i.n)(),o=!1;if(s?.length||void 0!==t||(f(!0),o=(s=await (0,n.getNewProducts)("https://www.saatva.com/coresite/api/storefront")).length>0),!s?.length){u([]),v(!1),f(!1);return}f(!0),v(o);let l=s.map(e=>e.productCode),m=e&&Array.isArray(e)&&e.length>0?e.filter(e=>l.includes(e.productCode)):[],g=new Set(m.map(({productCode:e})=>e)),y=l.filter(e=>!g.has(e)),_=[];if(y.length){let{products:e}=await (0,c.Y)("/catalog",d.lR,{productCodes:y},r),t=await (0,c.Z)("/review-enrichment",e,"POST"),a=await p(t);if(o)_=a;else{let e=await h(y,r);_=a.map(t=>{let a=e.find(({sku:e})=>e===t.productCode);return a?{...t,...a}:t})}}let w=[...m,..._],b=w;if(o){let e;e=s,b=w.map(t=>{let a=e.find(({productCode:e})=>e===t.productCode);if(!a)return t;let r={...a};return delete r.sku,{...t,...r,productCode:t.productCode,url:r.url||t.url}})}else t&&(b=w.map(e=>{let a=t.find(t=>t.productCode===e.productCode);if(!a)return e;let{ardadDescriptors:r,title:s,subtitle:n}=a;return{...e,...r&&{ardadDescriptors:((e=[],t=[])=>{let a=new Set(t.map(({slot:e})=>e));return[...e.filter(({slot:e})=>!a.has(e)),...t]})(e.ardadDescriptors,r)},...s&&{title:s},...n&&{subtitle:n}}}));let C=(a=b,s.map(e=>a.find(t=>t.productCode===e.productCode)).filter(Boolean));if(o&&C.length<n.MIN_NEW_PRODUCTS){u([]),v(!1);return}u(C)}catch(e){console.error(`Error fetching recently viewed data: ${e.message}`),u([]),v(!1)}finally{f(!1)}})()},[t,a]),{recentlyViewedData:l,isLoading:g,isNewProducts:y}}},54318:(e,t,a)=>{"use strict";a.d(t,{A:()=>c});var r=a(37876),s=a(46166),n=a(16577),i=a(74024),o=a(96460),l=a.n(o);function c(){return(0,r.jsx)("section",{className:l().section,children:(0,r.jsx)("div",{className:"container",children:(0,r.jsx)("div",{className:l().viewingRoomOnRamp,children:(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)("div",{className:"col--xs-12 col--lg-6",children:(0,r.jsxs)("div",{className:l().content,children:[(0,r.jsx)("div",{className:l().iconContainer,children:(0,r.jsx)(s.Icon,{alt:"viewing room icon",description:"viewing room",name:"viewingRoom",titleId:"viewingRoom",className:l().icon})}),(0,r.jsxs)("div",{className:l().textContainer,children:[(0,r.jsx)("h2",{className:l().title,children:"Saatva Viewing Rooms"}),(0,r.jsx)("p",{className:l().description,children:"Experience Saatva comfort in real life in an inviting, pressure-free environment before enjoying your 365-night home trial."})]})]})}),(0,r.jsx)("div",{className:`col--xs-12 col--lg-6 ${l().buttonContainer}`,children:(0,r.jsxs)(n.Button,{kind:"primary",href:"/locations",className:l().button,"data-selector":"vr-onramp-cta",onClick:e=>{(0,i.pushClickEvent)({linkName:"visit_a_store",linkSection:"viewing_room_on_ramp",linkURL:"/locations"}),e?.metaKey||e?.ctrlKey||e?.shiftKey||e?.button===1||(e?.preventDefault(),globalThis.location.assign("/locations"))},children:["Visit a store",(0,r.jsx)(s.Icon,{name:"thick-arrow-right",titleId:"thick-arrow-right",alt:"arrow right icon",description:"arrow pointing right",className:l().buttonIcon})]})})]})})})})}},64485:(e,t,a)=>{"use strict";a.d(t,{Cl:()=>h,t2:()=>p,b8:()=>v,ed:()=>w,_8:()=>f,MS:()=>g,HF:()=>_,Sm:()=>m,$t:()=>y});var r=a(22999),s=a.n(r),n=a(20772),i=a.n(n),o=a(7766),l=a.n(o),c=a(40123),d=a.n(c),u=a(19462);u.Ay.MATTRESSES,u.Ay.BEDDING,u.Ay.FURNITURE,["saatva-classic","signature-mattress-pad","foun
1dation","the-saatva-pillow","graphite-memory-foam-mattress-topper","extend-warranty","adjustable-base-plus","saatva-rx","organic-mattress-pad","saatva-latex-hybrid","saatva-hd","memory-foam-hybrid","cloud-memory-foam-pillow","adjustable-frame","organic-cotton-sheets","down-alternative-pillow","featherbed-mattress-topper","memory-foam-pillow","microcoil-mattress-topper","comfort-adjusting-topper","saatva-contour5","latex-mattress-topper","adjustable-base","zenhaven","solaire","saatva-youth","down-topped-featherbed-mattress-topper","down-alternative-comforter","high-density-foam-mattress-topper","down-chamber-pillow","organic-cotton-pillowcases","foundation-hd","santorini","sateen-cotton-sheet-set","murphy-bed-mattress","bunk-trundle-youth","rhodes","organic-quilted-pillow","percale-sheet-set","down-comforter","dog-bed","basel","valencia","percale-duvet-cover-set","halle-with-storage","sateen-cotton-pillowcases","minori","santorini-platform-bed","lucerne","organic-quilted-mattress-topper","crib-mattress","percale-pillowcases","banded-percale-sheet-set","scented-candles","cologne-wood","essential-sheet-set","siena-leather","halle","silk-eye-mask","waterproof-mattress-protector","cassis","minori-with-storage","organic-velvet-quilt","calais","milan","embroidered-hotel-style-sheets","silk-pillowcase","amalfi","signature-duvet-cover-set","embroidered-sateen-duvet-set","velvet-pick-stitch-quilt","lyon","cassis-with-storage","halle-storage-platform-bed","amalfi-platform-bed","arden-nightstand","lyon-with-storage","copenhagen","dog-bed-cover","serra","madeleine-nightstand","rhone-storage-bench","essential-duvet-cover-set","banded-percale-duvet-set","aero-quilt","arno-cushioned-bench","navi-bedroom-rug","matera-wood","provence","merano","adra-leather","nova-lamp","banded-percale-pillowcases","iris-nightstand","percale-shams","scented-votives","amalfi-with-storage","lena-cushioned-bench","skye-nightstand","waffle-knit-duvet-cover-set","porto","atlas-nightstand","organic-cotton-channel-quilt","organic-sateen-duvet-cover-set","constance-tufted-ottoman","
1noire-nightstand","sweater-knit-blanket","embroidered-pillowcases","provence-with-storage","luna-swivel-chair","hugo-lamp","essential-pillowcases","linen-pillowcases","anais-chair","linen-sheet-set","acadia-nightstand","herringbone-knit-blanket","brienne-channel-ottoman","savile-lamp","hyde-nightstand","velvet-pick-stitch-shams","organic-sateen-shams","cirrus-bedroom-rug","vara-bedroom-rug","leo-nightstand","natural-rug-pad","adamas-bedroom-rug","casanne-bedroom-rug","crete","como-swivel-chair","embroidered-sateen-shams","lucien-lamp","organic-velvet-diamond-quilt-shams","waffle-knit-blanket","sydney","linen-duvet-cover-set","flannel-sheet-set","corso-lamp","logan-chair","banded-percale-shams","VR-mattress-topper","lyse-nightstand","corsica-wood","areos-lamp","kanan-bedroom-rug","sofia-lamp","calan-nightstand","regent-lamp","verdon-nightstand","signature-shams","waffle-knit-shams","weighted-blanket","marseille","waffle-towels"].reduce((e,t,a)=>(e[t]=a+1,e),{}),a(29286);let p={sizes:"sizes",colors:"colors",materials:"materials",features:"features",priceRange:"priceRange"},h={label:"Best Sellers",term:"best sellers",order:"desc"},m=e=>{let t=[];for(let a in e){let{values:r,labels:s}=e[a];r.length&&r.forEach(e=>{let r=s?.[e];t.push({key:a,label:r,value:e})})}return t},g=(e,t="default")=>e.find(({key:e})=>t===e),f=(e,t)=>d()(t)?{pageheader:"Smarter Luxury Sleep"}:1===e.length?g(t,e[0].value)||g(t)||{}:g(t)||{},y=(e,t)=>t.filter(({key:t})=>e===t),v=(e,t)=>{if(t?.term&&t?.order){let a=i()(t.term),r=i()(t.order);return"rating"===a?s()(e,[e=>{if(!e.reviews)return -1;let t=e.reviews.reviewCount||0;var a=e.reviews.rating||0;if(0===t)return -1;let r=a/5;return 5*((r+2.706025/(2*t)-1.645*Math.sqrt((r*(1-r)+2.706025/(4*t))/t))/(1+2.706025/t))}],[r]):s()(e,[a],[r])}return e},_=(e,t)=>{let a=[];return e.forEach(e=>{let r=t.find(t=>t.property==e.property);if(r){let t=[];r.values.forEach(a=>{let r=e.options.find(e=>e.value===a);r&&t.push(...r.matchingValues)}),a.push({property:e.property,matchingValues:t,attributePaths:e.attributePaths})}}),a},w=(e,t,a)=>{let r=[];return e.forEach(e=>{let s=[],n=[],i=[],o=!1,c=[];
1e.variants.forEach(r=>{let d=r.price;if(a&&r.price){let t=[{sku:r.sku,parentSku:r.productCode,quantity:1,category:r.category,price:r.price,subcategory:r.subcategory||null}];r.bundledVariants&&r.bundledVariants.length&&(t=r.bundledVariants.map(t=>{let a=e.bundledProducts.find(e=>e.productCode===t.productCode),r=a&&a.variants.find(e=>e.sku===t.sku);return a&&{sku:t.sku,parentSku:t.productCode,quantity:t.quantity,category:r?.category||a.category,price:r?.price||0}}).filter(Boolean));let{finalPrice:s,labelBreakdown:n}=a(t);d=s,n?.forEach(e=>{i.some(t=>t.label===e.label)||i.push({label:e.label,discountType:e.discountType})})}let u=t.every(e=>((e,t,a=null)=>{if(t.matchingValues&&0===t.matchingValues.length)return!0;if("priceRange"===t.property){var r,s;let n;return r=null!==a?a:e.price,s=t.matchingValues,!isNaN(n=parseFloat(r))&&s.some(e=>{if(e.endsWith("+"))return n>=parseFloat(e.slice(0,-1));let t=e.split("-");if(2===t.length){let e=parseFloat(t[0]),a=parseFloat(t[1]);if(!isNaN(e)&&!isNaN(a))return n>=e&&n<=a}return!1})}return((e,t)=>{let a=[];for(let r of t.attributePaths){let t=l()(e,r);t&&(Array.isArray(t)?a.push(...t):a.push(t))}return Array.isArray(a)?a.filter(e=>!!e):[]})(e,t).some(e=>t.matchingValues.map(e=>e.toString().toLowerCase()).includes(e.toString().toLowerCase()))})(r,e,d));u&&r.price&&(s.push(r.price),a&&n.push(d)),u&&(o=!0,c.push({...r,finalPrice:d}))}),o&&r.push({...e,matchingVariants:c,lowestPrice:Math.min(...s),highestPrice:Math.max(...s),lowerPrice:Math.min(...n)||Math.min(...s),upperPrice:Math.max(...n)||Math.max(...s),discountLabels:i})}),r}},83413:(e,t,a)=>{"use strict";a.d(t,{A:()=>d,H:()=>l});var r=a(37876),s=a(95062),n=a.n(s),i=a(29433),o=a(35645);let l=({dataSelector:e,products:t,isLoading:a,title:s="Recently Viewed",sectionClassname:n,section:o,linkName:l="recently_viewed"})=>{let c=t.length;return(0,r.jsx)(i.A,{products:t,sectionClassName:n,title:s,dataSelector:e,simpleSliderProps:{shownSize:c>3?3:c,infinite:!1,pageDotsAndNumbers:!1,pageDots:!(c<2)},isLoading:a,hideSwatches:!0,hideSliderSideButtons:1===c,section:o,linkName:l})};l.propTypes={dataSelector:n().string,products:n().array.isRequired,isLoading:n().bool,title:n().string,sectionClassname:n().string,section:n().string,linkName:n().string};let c=({productsData:e,title:t,linkName:a,...s})=>{let{recentlyViewedData:n,isLoading:i,isNewProducts:c}=(0,o.A)({productsData:e}),d=t;return null==d&&(d="Recently Viewed",i&&!n.length?d="":c&&(d="New Arrivals")),(0,r.jsx)(l,{...s,title:d,linkName:a??(c?"new_products":"recently_viewed"),products:n,isLoading:i})};c.propTypes={dataSelector:n().string,productsData:n().array,title:n().string,sectionClassname:n().string,section:n().string,linkName:n().string};let d=c},89307:(e,t,a)=>{"use strict";a.d(t,{n:()=>o});var r=a(80057),s=a(14022),n=a(27974);let i=(0,r.storageWrapper)(),o=()=>{try{let e=i.getItem("recentlyViewed","local")||[],t=new Date().getTime()-2592e6;return e=e.filter(e=>{var a;if(!["productCode","timestamp"].every(t=>e[t]))return!1;let r=e.timestamp>t,s=(a=e.productCode,Object.values(n.A).includes(a));return r&&s})}catch(e){return s.default.error({message:"Error getting recently viewed",location:"utils/recentlyViewed.js",error:e}),[]}}},96460:e=>{e.exports={"t-heading2-refined":"styles_t-heading2-refined__FeHtX","t-heading1-refined":"styles_t-heading1-refined__LTLKY","t-heading6-refined":"styles_t-heading6-refined__qtoyt","u-displayBlock":"styles_u-displayBlock__XV__J","t-fontWeight--normal":"styles_t-fontWeight--normal__RexXR","t-fontWeight--light":"styles_t-fontWeight--light__jE9YX","t-light":"styles_t-light__mcv93","t-base":"styles_t-base__vDzPz",toolTip__iconCircle:"styles_toolTip__iconCircle__gNkBh",toolTip__iconClose:"styles_toolTip__iconClose__9zVQk",toolTip__iconInfo:"styles_toolTip__iconInfo__82Oer","lazyload-wrapper":"styles_lazyload-wrapper__LvKpQ",section:"styles_section__dLbcL",viewingRoomOnRamp:"styles_viewingRoomOnRamp__VVcuv",content:"styles_content__OyenA",iconContainer:"styles_iconContainer__5eJ_O",icon:"styles_icon__9I5K6",textContainer:"styles_textContainer__M_PDG",title:"styles_title__5KjZj",description:"styles_description__NMfSV",buttonContainer:"styles_buttonContainer__goBKW",button:"styles_button__nN_6a",buttonIcon:"styles_buttonIcon__iUEyp"}}}]);
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.