(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9190],{64721:function(t,n,e){var o=e(42118),r=e(98612),a=e(47037),i=e(40554),c=e(52628),l=Math.max;t.exports=function(t,n,e,s){t=r(t)?t:c(t),e=e&&!s?i(e):0;var d=t.length;return e<0&&(e=l(d+e,0)),a(t)?e<=d&&t.indexOf(n,e)>-1:!!d&&o(t,n,e)>-1}},54476:function(t,n,e){(window.__NEXT_P=window.__NEXT_P||[]).push(["/cart",function(){return e(2358)}])},84170:function(t,n,e){"use strict";e.d(n,{L:function(){return p},f:function(){return f}});var o=e(85893),r=e(67294),a=e(94901),i=e(22779),c=e(64721),l=e.n(c),s=e(18446),d=e.n(s);let u=(0,r.createContext)({products:null,addToBag:null,addWishlist:()=>{},cart:null,favorited:!1,favorites:null,fetchCollections:()=>{},getPriceDisplay:()=>0,id:null,isAddingToBag:!1,isScript:!1,options:{},price:0,productCollection:null,selected:null,selectedOpt:null,setCart:()=>{},setId:()=>{},setOptions:()=>{},setPrice:()=>{},setSelectedOpt:()=>{},setWishlist:()=>{},wishlist:{productIds:[]}});function f(t){let{children:n}=t,[e,c]=(0,r.useState)(null),[s,f]=(0,r.useState)(null),[p,m]=(0,r.useState)(!1),[h,g]=(0,r.useState)({}),[v,w]=(0,r.useState)([]),[E,x]=(0,r.useState)(null),[y,_]=(0,r.useState)(0),[I,S]=(0,r.useState)({productIds:[]}),[b,j]=(0,r.useState)(!1),[k,C]=(0,r.useState)(null),[O,D]=(0,r.useState)(null),[L,P]=(0,r.useState)(null),M="PSecwid__".concat("25550022","PSfavorites"),[N,T]=(0,r.useState)(!1),[A,B]=(0,r.useState)(0),[z,H]=(0,r.useState)(!1);(0,r.useEffect)(()=>{null!==k&&fetch("/api/ecwid/products/".concat(k)).then(t=>t.json()).then(t=>{t&&f(t.result)}).catch(t=>{})},[k]),(0,r.useMemo)(()=>{let t=null;if(v.length){var n;let e=s&&(null==s?void 0:s.combinations),o=null===(n=e[0])||void 0===n?void 0:n.options.map(t=>t.name),r=null==v?void 0:v.sort((t,n)=>(null==o?void 0:o.indexOf(t.name))-(null==o?void 0:o.indexOf(n.name))),a=r.filter(t=>l()(o,t.name)),i=e.flatMap(t=>{t.options.length;let n=t.options.map(t=>({name:t.name,value:t.value}));if(d()(n,a))return t}).find(t=>t);e.flatMap(t=>{let n=t.options.map(t=>({name:t.name,value:t.value}));if(d()(n,r))return t}).find(t=>t),v.flatMap(t=>e.flatMap(n=>n.options.map(e=>{if(n.options.length<2&&d()({name:e.name,value:e.value},t))return n}))).find(t=>t),i&&x(i),t=v}return t},[v,s]),(0,r.useEffect)(()=>{window.ec=window.ec||{},window.ec.config=window.ec.config||{},window.ec.config.storefrontUrls=window.ec.config.storefrontUrls||{},["/cart"].includes(location.pathname)&&(window.ec.config.storefrontUrls.cleanUrls=!0,window.ec.config.storefrontUrls.queryBasedCleanUrls=!0),window.ec.config.store_main_page_url="".concat("https://www.hickoryhardware.com","/cart"),window.ecwid_script_defer=!0,"/cart"===location.pathname&&(window._xnext_initialization_scripts=[{widgetType:"ProductBrowser",id:"ecwid-shop-store",arg:["id=ecwid-shop-store"]}]),function(){if("undefined"!=typeof Ecwid)try{Ecwid.OnAPILoaded.add(function(){Ecwid.init()})}catch(t){}else B(t=>t+1)}()},[]),(0,r.useEffect)(()=>{if(localStorage.getItem(M)){T(!0);let t=JSON.parse(localStorage.getItem(M));t.productIds.length>0&&(S(n=>({...n,productIds:t.productIds})),j(!!l()(t.productIds,k)))}},[k,N]),(0,r.useEffect)(()=>{(async()=>{let t=JSON.parse(localStorage.getItem(M));if(null==t?void 0:t.productIds)try{let n={ids:null==t?void 0:t.productIds},e=await i.i3.fetch('*[_type=="mainProduct" && ecwidProductId in $ids && !(_id in path("drafts.**"))]',n).then(t=>t),o=await fetch("/api/ecwid/products/search?productIds=".concat(t.productIds)),r=await o.json(),a=null==e?void 0:e.map(t=>{var n;return null===(n=r.items)||void 0===n?void 0:n.map(n=>{if(n.id===t.ecwidProductId)return{...t,...n,ecwidId:n.id,price:n.defaultDisplayedPriceFormatted}}).flat()}).flat().filter(t=>void 0!==t);D(a)}catch(t){}})()},[N]);let W=async t=>{P((await fetch("/api/ecwid/products/search?productIds=".concat(t)).then(t=>t.json())).items)};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(u.Provider,{value:{cart:e,setCart:c,products:s,options:h,setOptions:g,price:y,setPrice:_,addToBag:(t,n)=>{m(!0);let e={...t,callback:function(t){t?a.A.success("Product was successfully added to your cart"):a.A.error("There was an error adding this product to your cart."),m(!1)}};n&&Object.keys(n).length&&(e.options=n),setTimeout(()=>{"undefined"!=typeof Ecwid&&Ecwid.Cart.addProduct(e)},1e3)},isAddingToBag:p,getPriceDisplay:t=>{let n="$".concat(t);return"undefined"!=typeof Ecwid&&Ecwid.OnAPILoaded.add(function(){n=Ecwid.formatCurrency(t)}),n},setWishlist:S,wishlist:I,setId:C,id:k,favorited:b,addWishlist:t=>{let n=null==I?void 0:I.productIds,e=l()(n,t)?n.filter(n=>n!==t):n.concat(t);S(t=>({...t,productIds:e})),j(!l()(n,t)),localStorage.setItem(M,JSON.stringify({productIds:e}))},favorites:O,fetchCollections:W,productCollection:L,setSelectedOpt:w,selectedOpt:v,selected:E,isScript:z},children:n}),(0,o.jsx)("div",{style:{zIndex:1},children:(0,o.jsx)(a.I,{delay:5e3,position:"top-center"})})]})}function p(){return(0,r.useContext)(u)}},22779:function(t,n,e){"use strict";e.d(n,{i3:function(){return i}});var o=e(27688),r=e(58495),a=e(34155);(0,o.e)(r.v);let i=(0,o.e)(r.v);(0,o.e)({...r.v,useCdn:!1,token:"sk7Lc8pj1TjSMTDYKjg7Bv2vIfXizQ4PBMDGZoD6kL4JCPJSSFHsHKgEqzGLed84q0BvzqhgpIrwtg1Zk4D7nvJBoPtXNW7Eh8XiXZclZ2wtfh9BwTj79SP1MZlRdukF6q3DcvEC34dJkoZqrDE12c90MOzzbecQ5xmLqygzu7VrNjXKoCtt"}),(0,o.e)({...r.v,useCdn:!1,token:a.env.SANITY_API_WRITE_TOKEN})},2358:function(t,n,e){"use strict";e.r(n),e.d(n,{__N_SSG:function(){return v},default:function(){return w}});var o=e(85893),r=e(67294),a=e(70386),i=e(72535),c=e(1641),l=e(71146),s=e(33640),d=e(37081),u=e(84170);function f(t){let{data:n}=t,{sections:e}=n,a=(0,r.useContext)(s.z);return(0,o.jsx)(o.Fragment,{children:e&&(null==e?void 0:e.map((t,n)=>{var e,r,i,c;let s=(null==t?void 0:t._type)==="slotCart"?"cartSection":(null==t?void 0:t._type)==="slotWishlist"?"wishlistSection":null==t?void 0:t._type,f=l.z[s],p=(null==t?void 0:t._type)==="slotCollectionInfo"?{id:null==t?void 0:null===(r=t.variants)||void 0===r?void 0:null===(e=r.collections)||void 0===e?void 0:e._id,type:null==t?void 0:null===(c=t.variants)||void 0===c?void 0:null===(i=c.collections)||void 0===i?void 0:i._type}:{id:null==t?void 0:t._id,type:null==t?void 0:t._type};return f?(0,o.jsx)(d.Z,{document:p,showInlineEditor:a,children:(0,o.jsx)(u.f,{children:(0,o.jsx)(f,{template:{bg:"gray",color:"webriq"},data:t})},n)},n):null}))})}var p=e(74975),m=e(47503);function h(t){let{data:n}=t,e=null==n?void 0:n.cartData;return e?(null==n?void 0:n.cartData)&&(0,o.jsx)(f,{data:e}):null}function g(t){var n;let{data:e,token:r=null}=t,a=(0,i.u)(r,c.aT),l=(null==a?void 0:a[0])||a;return l?(0,o.jsxs)(o.Fragment,{children:[(!l||!(null==l?void 0:l.sections)||(null==l?void 0:null===(n=l.sections)||void 0===n?void 0:n.length)===0)&&(0,o.jsx)(p.Y,{}),(null==e?void 0:e.cartData)&&(0,o.jsx)(f,{data:l})]}):null}var v=!0,w=r.memo(function(t){let{data:n,preview:e,token:r,source:i}=t;return e?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(m.a,{}),(0,o.jsx)(a.Dz,{fallback:"Loading",children:(0,o.jsx)(s.Z,{showInlineEditor:"studio"===i,children:(0,o.jsx)(g,{data:n,token:r})})})]}):(0,o.jsx)(h,{data:n})})},94901:function(t,n,e){"use strict";e.d(n,{A:function(){return I},I:function(){return y}});var o,r,a,i=e(67294),c=i.memo(function(){return i.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"},i.createElement("g",{transform:"translate(.077 .077)"},i.createElement("g",null,i.createElement("path",{fill:"none",stroke:"#fff",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",d:"M3.719 7.884L6.235 10.4l3.032-3.032 2.774-2.774"}))))}),l=i.memo(function(){return i.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"},i.createElement("g",{transform:"translate(.077 .077)"},i.createElement("g",null,i.createElement("path",{fill:"#fff",d:"M10.915 9.98l2.853-2.846a.666.666 0 00-.942-.942L9.979 9.044 7.133 6.191a.666.666 0 00-.942.942L9.044 9.98 6.19 12.826a.666.666 0 10.942.942l2.846-2.853 2.846 2.853a.666.666 0 10.942-.942z",transform:"translate(-2.017 -2.018)"}))))}),s=i.memo(function(){return i.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"},i.createElement("g",{transform:"translate(-1533 -39)"},i.createElement("g",{fill:"#fff",transform:"translate(-.358 -1.639)"},i.createElement("circle",{cx:"1.134",cy:"1.134",r:"1.134",transform:"rotate(180 771.246 22.823)"}),i.createElement("path",{d:"M1 0a1 1 0 00-1 1v5a1 1 0 002 0V1a1 1 0 00-1-1z",transform:"rotate(180 771.17 26.882)"}))))}),d=i.memo(function(){return i.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"},i.createElement("g",{transform:"rotate(180 774.5 27.5)"},i.createElement("g",{fill:"#fff",transform:"translate(-.358 -1.639)"},i.createElement("circle",{cx:"1.134",cy:"1.134",r:"1.134",transform:"rotate(180 771.246 22.823)"}),i.createElement("path",{d:"M1 0a1 1 0 00-1 1v5a1 1 0 002 0V1a1 1 0 00-1-1z",transform:"rotate(180 771.17 26.882)"}))))}),u=function(t){switch(t.type){case"error":return i.createElement(l,null);case"info":return i.createElement(s,null);case"warning":return i.createElement(d,null);default:return i.createElement(c,null)}};function f(t,n){void 0===n&&(n={});var e=n.insertAt;if(t&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===e&&o.firstChild?o.insertBefore(r,o.firstChild):o.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}}f(":root {\n --toast-default: #8b1dd0;\n --toast-success: #27d0b2;\n --toast-error: #c52965;\n --toast-info: #004eff;\n --toast-warning: #d0761d;\n --toast-black: #221d26;\n --toast-white: #ffffff;\n}\n\n.toast {\n padding: 15px;\n min-width: 300px;\n max-width: 400px;\n color: var(--toast-white);\n display: flex;\n align-items: flex-start;\n line-height: 1.6;\n font-size: 14px;\n border-radius: 15px;\n}\n\n.toast.default {\n background-color: var(--toast-default);\n}\n\n.toast.success {\n background-color: var(--toast-success);\n}\n\n.toast.error {\n background-color: var(--toast-error);\n}\n\n.toast.info {\n background-color: var(--toast-info);\n}\n\n.toast.warning {\n background-color: var(--toast-warning);\n}\n\n.toast .content {\n flex: 1;\n}\n\n.toast .content p {\n padding: 0;\n margin: 0;\n}\n\n.toast .close {\n margin-left: 10px;\n width: 22px;\n height: 22px;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: rgba(255, 255, 255, 0);\n transition: all 100ms ease-in-out;\n border-radius: 8px;\n cursor: pointer;\n}\n\n.toast .close:hover {\n background-color: rgba(255, 255, 255, 0.2);\n}\n\n.toast .icon {\n margin-right: 10px;\n width: 22px;\n height: 22px;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: rgba(255, 255, 255, 0.2);\n border-radius: 8px;\n}\n");var p=function(t){var n=t.id,e=t.content,o=t.type,r=t.config,a=(r=void 0===r?{}:r).backgroundColor,c=r.color,s=t.onClose;return i.createElement("div",{className:"toast "+o,style:{backgroundColor:a}},i.createElement("div",{className:"icon"},u({type:o})),i.createElement("div",{className:"content"},i.createElement("p",{style:{color:c}},e)),i.createElement("div",{className:"close",onClick:function(){return s(n)}},i.createElement(l,null)))};function m(){return(m=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t}).apply(this,arguments)}var h={toasts:[]},g=function(t,n){switch(n.type){case"ADD":return m({},t,{toasts:[].concat(t.toasts,[n.toast])});case"REMOVE":return m({},t,{toasts:[].concat(t.toasts.filter(function(t){return t.id!==n.id}))});case"REMOVE_ALL":return m({},t,{toasts:[]});default:throw Error()}},v=function(){var t=(0,i.useReducer)(g,h),n=t[0],e=t[1];return m({},n,{dispatch:e})},w=(o=new Map,{on:function(t,n){o.has(t)||o.set(t,[]),o.get(t).push(n)},emit:function(t,n){o.has(t)&&o.get(t).forEach(function(t){return t(n)})},off:function(){o.clear()}}),E=function(t){var n=t.content,e=t.type,o=t.config;return{id:Math.random().toString(36).substr(2,10),content:n,type:e,config:o}};(r=a||(a={})).SHOW="show",r.HIDE="hide",r.HIDE_ALL="hideAll";var x=function(t){var n=t.dispatch,e=t.delay;w.on(a.SHOW,function(t){n({type:"ADD",toast:t}),e&&setTimeout(function(){n({type:"REMOVE",id:t.id})},e)}),w.on(a.HIDE,function(t){return n({type:"REMOVE",id:t})}),w.on(a.HIDE_ALL,function(){return n({type:"REMOVE_ALL"})})};f(".toastContainer {\n overflow: hidden;\n overflow-x: auto;\n display: grid;\n grid-gap: 20px;\n position: fixed;\n user-select: none;\n}\n\n.top-left {\n top: 20px;\n left: 20px;\n}\n\n.top-center {\n top: 20px;\n left: 50%;\n transform: translate(-50%, 0);\n}\n\n.top-right {\n top: 20px;\n right: 20px;\n}\n\n.bottom-left {\n bottom: 20px;\n left: 20px;\n}\n\n.bottom-center {\n bottom: 20px;\n left: 50%;\n transform: translate(-50%, 0);\n}\n\n.bottom-right {\n bottom: 20px;\n right: 20px;\n}\n");var y=function(t){var n=t.position,e=t.delay,o=v(),r=o.toasts,c=o.dispatch;(0,i.useEffect)(function(){return x({dispatch:c,delay:e}),function(){w.off()}},[c,e]);var l=(0,i.useCallback)(function(t){w.emit(a.HIDE,t)},[]);return i.createElement("div",{className:"toastContainer "+(void 0===n?"bottom-left":n)},r.map(function(t){return i.createElement(p,Object.assign({key:t.id},t,{onClose:l}))}))},_=function(t){var n=m({},t);return w.emit(a.SHOW,E(m({},n)))},I=function(t,n){return _({content:t,type:"default",config:n})};I.success=function(t,n){return _({content:t,type:"success",config:n})},I.error=function(t,n){return _({content:t,type:"error",config:n})},I.info=function(t,n){return _({content:t,type:"info",config:n})},I.warn=function(t,n){return _({content:t,type:"warning",config:n})},I.hideAll=function(){return w.emit(a.HIDE_ALL)}}},function(t){t.O(0,[1792,1840,2971,7546,9089,2888,9774,179],function(){return t(t.s=54476)}),_N_E=t.O()}]);