(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5172],{61418:function(e,t,r){Promise.resolve().then(r.bind(r,30358)),Promise.resolve().then(r.bind(r,30748)),Promise.resolve().then(r.t.bind(r,17540,23)),Promise.resolve().then(r.bind(r,31173)),Promise.resolve().then(r.bind(r,5318)),Promise.resolve().then(r.bind(r,31752))},16333:function(e,t,r){"use strict";r.r(t),r.d(t,{BackButton:function(){return i},default:function(){return o}});var n=r(57437),l=r(2265),a=r(50151),c=r.n(a),s=r(75470);function o(e){let{images:t,productId:r}=e,a=(0,l.useRef)(null),[o,i]=(0,l.useState)(0),u=(0,l.useCallback)(()=>{let e=a.current;if(!e||!e.clientWidth)return;let t=Math.round(e.scrollLeft/e.clientWidth);i(e=>e===t?e:t)},[]),d=e=>{let t=a.current;t&&t.scrollTo({left:e*t.clientWidth,behavior:"smooth"})},[h,_]=(0,l.useState)(null);(0,l.useEffect)(()=>{if(!r)return;let e=!0;return(0,s.Nh)([r]).then(t=>{var n;let l=null===(n=t[r])||void 0===n?void 0:n.status;e&&_("available"===l||"discontinued"===l?l:null)}),()=>{e=!1}},[r]);let p=e=>{let t=a.current;t&&t.scrollBy({left:e*t.clientWidth,behavior:"smooth"})};return t.length?(0,n.jsxs)("div",{className:c().gal,children:[(0,n.jsx)("div",{className:c().galTrack,ref:a,onScroll:u,children:t.map((e,t)=>(0,n.jsx)("div",{className:c().galSlide,children:(0,n.jsx)("img",{src:e.src,alt:e.alt,width:800,height:800,loading:0===t?"eager":"lazy",...0===t?{fetchPriority:"high"}:{},draggable:!1})},e.src+t))}),"discontinued"===h?(0,n.jsx)("span",{className:"".concat(c().galStock," ").concat(c().galGone),children:"단종\xb7재고확인"}):"available"===h?(0,n.jsx)("span",{className:c().galStock,children:"즉시 출고 가능"}):null,t.length>1&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:c().galDots,children:t.map((e,t)=>(0,n.jsx)("button",{type:"button",className:t===o?c().galDotOn:void 0,"aria-label":"".concat(t+1,"번째 사진"),"aria-current":t===o,onClick:()=>d(t)},e.src+t))}),(0,n.jsxs)("span",{className:c().galCount,"aria-live":"polite",children:[(0,n.jsx)("b",{children:o+1})," / ",t.length]}),o>0&&(0,n.jsx)("button",{type:"button",className:"".concat(c().galNav," ").concat(c().galPrev),"aria-label":"이전 사진",onClick:()=>p(-1),children:"‹"}),op(1),children:"›"})]})]}):(0,n.jsx)("div",{className:c().galEmpty,"aria-hidden":!0})}function i(){return(0,n.jsx)("button",{type:"button",className:c().icBtn,"aria-label":"뒤로",onClick:()=>{document.referrer&&new URL(document.referrer).host===window.location.host&&window.history.length>1?window.history.back():window.location.href="/shop/"},children:(0,n.jsx)("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:(0,n.jsx)("path",{d:"M19 12H5M12 19l-7-7 7-7"})})})}},30358:function(e,t,r){"use strict";r.d(t,{RememberSearch:function(){return _},default:function(){return p},x:function(){return u}});var n=r(57437),l=r(2265),a=r(78960),c=r.n(a),s=r(75470);let o="mcd_shop_recent",i=()=>{try{let e=JSON.parse(localStorage.getItem(o)||"[]");return Array.isArray(e)?e.filter(e=>e&&"string"==typeof e.q).slice(0,10):[]}catch(e){return[]}},u=e=>{let t=e.trim();if(t)try{let e=[{q:t,at:Date.now()},...i().filter(e=>e.q!==t)].slice(0,10);localStorage.setItem(o,JSON.stringify(e))}catch(e){}},d=e=>{let t=new Date(e);return"".concat(t.getMonth()+1,".").concat(t.getDate(),".")},h=e=>{let t=e.trim();t&&(u(t),window.location.href="/shop/search/?q=".concat(encodeURIComponent(t)))};function _(e){let{q:t}=e;return(0,l.useEffect)(()=>u(t),[t]),null}function p(e){let{initial:t=""}=e,[r,a]=(0,l.useState)(t),[u,_]=(0,l.useState)([]),[p,f]=(0,l.useState)([]),[m,x]=(0,l.useState)([]),g=(0,l.useRef)(null),b=(0,l.useRef)(0);(0,l.useEffect)(()=>{_(i()),(0,s.qB)().then(f);let e=g.current;e&&(e.focus(),e.setSelectionRange(e.value.length,e.value.length))},[]),(0,l.useEffect)(()=>{let e=r.trim(),t=++b.current;if(!e){x([]);return}let n=setTimeout(()=>(0,s.Mh)(e).then(e=>t===b.current&&x(e)),150);return()=>clearTimeout(n)},[r]);let j=e=>{let t=i().filter(t=>t.q!==e);try{localStorage.setItem(o,JSON.stringify(t))}catch(e){}_(t)},v=e=>{var t;a(e),null===(t=g.current)||void 0===t||t.focus()},k=r.trim().length>0,y=e=>{let t=r.trim(),l=t?e.toLowerCase().indexOf(t.toLowerCase()):-1;return l<0?e:(0,n.jsxs)(n.Fragment,{children:[e.slice(0,l),(0,n.jsx)("b",{children:e.slice(l,l+t.length)}),e.slice(l+t.length)]})};return(0,n.jsxs)("div",{className:c().page,children:[(0,n.jsxs)("form",{className:c().bar,role:"search",onSubmit:e=>{e.preventDefault(),h(r)},children:[(0,n.jsx)("button",{type:"button",className:c().ic,onClick:()=>window.history.length>1?window.history.back():window.location.href="/shop/","aria-label":"뒤로",children:(0,n.jsx)("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:(0,n.jsx)("path",{d:"M19 12H5M11 6l-6 6 6 6"})})}),(0,n.jsx)("input",{ref:g,value:r,onChange:e=>a(e.target.value.slice(0,50)),placeholder:"자재\xb7브랜드\xb7제품명 검색",enterKeyHint:"search",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-label":"자재 검색"}),k?(0,n.jsx)("button",{type:"button",className:c().clear,onClick:()=>v(""),"aria-label":"입력 지우기",children:"✕"}):null,(0,n.jsx)("button",{type:"submit",className:c().ic,"aria-label":"검색",children:(0,n.jsxs)("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":!0,children:[(0,n.jsx)("circle",{cx:"11",cy:"11",r:"7"}),(0,n.jsx)("path",{d:"M20 20l-3.5-3.5"})]})})]}),k?(0,n.jsxs)("ul",{className:c().list,"aria-label":"자동완성",children:[m.map(e=>(0,n.jsxs)("li",{children:[(0,n.jsxs)("button",{type:"button",className:c().item,onClick:()=>h(e.text),children:[(0,n.jsxs)("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":!0,children:[(0,n.jsx)("circle",{cx:"11",cy:"11",r:"7"}),(0,n.jsx)("path",{d:"M20 20l-3.5-3.5"})]}),(0,n.jsx)("span",{children:y(e.text)}),(0,n.jsxs)("em",{children:[e.type,e.count?" \xb7 ".concat(e.count.toLocaleString("ko-KR")):""]})]}),(0,n.jsx)("button",{type:"button",className:c().fill,onClick:()=>v(e.text),"aria-label":"".concat(e.text," 입력창에 넣기"),children:"↖"})]},"".concat(e.type,":").concat(e.text))),(0,n.jsx)("li",{children:(0,n.jsxs)("button",{type:"button",className:c().item,onClick:()=>h(r),children:[(0,n.jsxs)("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":!0,children:[(0,n.jsx)("circle",{cx:"11",cy:"11",r:"7"}),(0,n.jsx)("path",{d:"M20 20l-3.5-3.5"})]}),(0,n.jsxs)("span",{children:[(0,n.jsx)("b",{children:r.trim()})," 검색"]})]})})]}):(0,n.jsxs)(n.Fragment,{children:[u.length?(0,n.jsxs)("section",{className:c().sec,children:[(0,n.jsxs)("h2",{children:["최근 검색어",(0,n.jsx)("button",{type:"button",onClick:()=>{try{localStorage.removeItem(o)}catch(e){}_([])},children:"전체 삭제"})]}),(0,n.jsx)("ul",{className:c().list,children:u.map(e=>(0,n.jsxs)("li",{children:[(0,n.jsxs)("button",{type:"button",className:c().item,onClick:()=>h(e.q),children:[(0,n.jsxs)("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":!0,children:[(0,n.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,n.jsx)("path",{d:"M12 7v5l3 2"})]}),(0,n.jsx)("span",{children:e.q}),(0,n.jsx)("em",{children:d(e.at)})]}),(0,n.jsx)("button",{type:"button",className:c().fill,onClick:()=>j(e.q),"aria-label":"".concat(e.q," 삭제"),children:"✕"})]},e.q))})]}):null,p.length?(0,n.jsxs)("section",{className:c().sec,children:[(0,n.jsx)("h2",{children:"인기 검색어"}),(0,n.jsx)("ol",{className:c().pop,children:p.map((e,t)=>(0,n.jsx)("li",{children:(0,n.jsxs)("button",{type:"button",onClick:()=>h(e),children:[(0,n.jsx)("i",{className:t<3?c().top:void 0,children:t+1}),e]})},e))})]}):null]})]})}},30748:function(e,t,r){"use strict";r.d(t,{default:function(){return u}});var n=r(57437),l=r(2265),a=r(67050),c=r.n(a),s=r(16333),o=r(36892),i=r(30358);function u(e){let{q:t}=e,[r,a]=(0,l.useState)(t),[u,d]=(0,l.useState)(!1),h=(0,l.useRef)(null),_=(0,l.useRef)(null);return(0,l.useEffect)(()=>a(t),[t]),(0,l.useEffect)(()=>{let e=h.current;if(!e||"undefined"==typeof IntersectionObserver)return;let t=new IntersectionObserver(e=>{let[t]=e;return d(!t.isIntersecting)},{threshold:0});return t.observe(e),()=>t.disconnect()},[]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{ref:h,className:c().mark,"aria-hidden":!0}),(0,n.jsxs)("div",{className:"".concat(c().bar," ").concat(u?c().stuck:""),children:[(0,n.jsx)(s.BackButton,{}),(0,n.jsxs)("form",{className:c().box,role:"search",onSubmit:e=>{e.preventDefault();let n=r.trim();if(!n){window.location.href="/shop/search/";return}if(n===t){var l;null===(l=_.current)||void 0===l||l.blur();return}(0,i.x)(n),window.location.href="/shop/search/?q=".concat(encodeURIComponent(n))},children:[(0,n.jsx)("input",{ref:_,value:r,onChange:e=>a(e.target.value.slice(0,50)),placeholder:"자재\xb7브랜드\xb7제품명 검색",enterKeyHint:"search",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-label":"자재 검색"}),r?(0,n.jsx)("button",{type:"button",className:c().clear,onClick:()=>{var e;a(""),null===(e=_.current)||void 0===e||e.focus()},"aria-label":"검색어 지우기",children:"✕"}):null]}),u?(0,n.jsx)(o.s,{}):null]})]})}},50151:function(e){e.exports={page:"product_page___c3yj",top:"product_top__ybSEC",icBtn:"product_icBtn__DVdwL",brandName:"product_brandName__ubB0L",gal:"product_gal__jjCsf",galEmpty:"product_galEmpty__3fcOr",galTrack:"product_galTrack__sP1g8",galSlide:"product_galSlide__ylYk_",galCount:"product_galCount__coAQv",galDots:"product_galDots__yMXae",galDotOn:"product_galDotOn__7ec_m",galStock:"product_galStock__fwNOl",galGone:"product_galGone__gawHu",galNav:"product_galNav__GP2qi",galPrev:"product_galPrev__JxRyH",galNext:"product_galNext__Xw_wd",info:"product_info__hT6QI",bc:"product_bc__jfABU",name:"product_name__Ysc2g",price:"product_price__7643Y",priceSub:"product_priceSub__qR_0U",ship:"product_ship__plF0M",sec:"product_sec__oU3l_",sum:"product_sum__Lqihe",feature:"product_feature__w9mdW",spec:"product_spec__W7ivO",tags:"product_tags__w_ZV2",divider:"product_divider__lbtwX",more:"product_more__NBjCV",foot:"product_foot__XBzfW",cols:"product_cols__aVOFY",wide:"product_wide__QNGWG"}},78960:function(e){e.exports={page:"searchLayer_page__Sl_V4",bar:"searchLayer_bar__yRQJ7",ic:"searchLayer_ic__q6Nbu",clear:"searchLayer_clear__SzMyd",fill:"searchLayer_fill__knaTT",sec:"searchLayer_sec__am5cK",list:"searchLayer_list__BVSmY",item:"searchLayer_item__Cwrm7",pop:"searchLayer_pop__dfI28",top:"searchLayer_top__zMZsF"}},67050:function(e){e.exports={mark:"searchResultBar_mark__A5IUf",bar:"searchResultBar_bar___PLts",stuck:"searchResultBar_stuck__HXbQI",box:"searchResultBar_box__PsnxE",clear:"searchResultBar_clear__cGapw"}}},function(e){e.O(0,[996,691,156,9759,6484,7648,6816,3823,2739,8839,4159,4838,1752,2971,2117,1744],function(){return e(e.s=61418)}),_N_E=e.O()}]);