"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8116],{57643:function(e,t,n){n.d(t,{Z:function(){return $}});var i=n(57437),r=n(2265),l=n(54887),o=n(88862),a=n(29918),s=n(71924),d=(e,t)=>{let n=!!(null==t?void 0:t.isSeamless),[i,l]=(0,r.useState)([]),[o,d]=(0,r.useState)(!1),[c,u]=(0,r.useState)(!0),h=(0,r.useRef)(0),p=(0,r.useRef)(!1),f=(0,r.useRef)(new Set),g=(0,r.useRef)(1),m=(0,r.useCallback)(async(t,i)=>{if(t===h.current&&null!=e)try{let r=await a.Wg.post("product/similar",{productId:e,page:i,limit:12},{headers:{"Content-Type":"application/json"}});if(t!==h.current)return;let o=r.data,d=(Array.isArray(o)?o:Array.isArray(null==o?void 0:o.data)?o.data:[]).map(e=>({id:e.id,categoryId:e.categoryId,category:e.category,subCategory:e.subCategory,img:e.img,name:e.name,manufacturer:e.manufacturer,series:e.series,brand:e.brand,price:e.price,purchase:e.purchase,isNew:"number"==typeof e.isNew?e.isNew:Number(e.isNew||0),isContract:!0===e.isContract,isHighQuality:!0===e.isHighQuality,isSeamless:!0===e.isSeamless,hasSeamless:!0===e.hasSeamless})).filter(t=>t.id!==e).filter(e=>!f.current.has(e.id)),c=d.map(e=>e.id).filter(e=>Number.isFinite(e));if(c.length>0)try{let e=await a.Wg.post("product/seamless-map",{ids:c}).catch(()=>({data:{}}));if(t!==h.current)return;let n=(null==e?void 0:e.data)&&"object"==typeof e.data?e.data:{};d=d.map(e=>{let t={...e},i=n[e.id];return i&&(t={...t,img:i.img||t.img,hasSeamless:i.hasSeamless||t.hasSeamless,hasPBR:i.hasPBR||t.hasPBR,isHighQuality:i.isHighQuality||t.isHighQuality},null!=i.brand&&(t.brand=i.brand),null!=i.series&&(t.series=i.series),null!=i.price&&(t.price=i.price),null!=i.purchase&&(t.purchase=i.purchase)),t})}catch(e){}d.forEach(e=>f.current.add(e.id));let p=n?d.filter(e=>(0,s.j_)(e)):d;l(e=>[...e,...p]),0===d.length?u(!1):g.current=i+1}catch(e){u(!1)}},[e,n]);(0,r.useEffect)(()=>{h.current+=1;let t=h.current;if(f.current=new Set(null!=e?[e]:[]),g.current=1,p.current=!1,l([]),u(null!=e),null==e){d(!1);return}p.current=!0,d(!0),(async()=>{try{await m(t,1)}finally{t===h.current&&(p.current=!1,d(!1))}})()},[e,m]);let x=(0,r.useCallback)(()=>{if(!c||p.current)return;let e=h.current;p.current=!0,d(!0),(async()=>{try{await m(e,g.current)}finally{e===h.current&&(p.current=!1,d(!1))}})()},[c,m]);return{similarItems:i,isLoading:o,hasMore:c,loadMore:x}},c=n(96483),u=n(48626),h=n(55161),p=n(79577),f=n(91410),g=n(35775),m=n(43618),x=n(99376),w=n(89723),b=n(50194),v=n(76904),y=n(48615),j=n(9217),C=n(24159),k=n(33905),I=n(96776),P=n(7669),M=n(45310),Z=n(60162),S=n(53094),A=n(18380),z=n(86465),E=n(92332),L=n(20874),R=n(41659),N=n(68292),W=n(7261),F=n(58889),B=n(33990),$=e=>{var t,n,o,a,$,T,U;let{detail:D,onClose:eC,onSimilarClick:eE,layerTop:eL=0,filterSnapshot:eR,injectedItems:eN,injectedHasMore:eW,injectedLoadMore:eF,injectedLoading:eB}=e,e$=(0,r.useMemo)(()=>{var e,t,n,i,r,l,o,a;return{...D,brand:null!==(e=D.brand)&&void 0!==e?e:null,series:null!==(t=D.series)&&void 0!==t?t:null,partnerPrice:null!==(n=D.partnerPrice)&&void 0!==n?n:null,partnerRate:null!==(i=D.partnerRate)&&void 0!==i?i:null,packUnit:null!==(r=D.packUnit)&&void 0!==r?r:null,piecesPerBox:null!==(l=D.piecesPerBox)&&void 0!==l?l:null,unitAreaM2:null!==(o=D.unitAreaM2)&&void 0!==o?o:null,url:null!==(a=D.url)&&void 0!==a?a:null}},[D]),eT=String(null!==(a=null==D?void 0:D.detailImg)&&void 0!==a?a:"").trim(),eU=e$.image||eT,eH=(0,r.useMemo)(()=>{var e;let t=D.image||D.libThumb,n=D.detailImg,i=Array.from(new Set([...!0===D.isPBR?[n,t]:[t,n],...null!==(e=D.cases)&&void 0!==e?e:[]].filter(Boolean)));return i.length>1?i:[]},[D]),eq=(0,r.useRef)(null),eO=(0,r.useRef)(null);(0,r.useEffect)(()=>{let e=document.documentElement,t=()=>{var t;let n=null===(t=eO.current)||void 0===t?void 0:t.getBoundingClientRect();n&&(e.style.setProperty("--mcd-mip-thumb-center","".concat(n.top+n.height/2,"px")),e.dataset.mip="1")};t();let n=setTimeout(t,400);return window.addEventListener("resize",t),()=>{clearTimeout(n),window.removeEventListener("resize",t),delete e.dataset.mip,e.style.removeProperty("--mcd-mip-thumb-center")}},[D.id,eL]),(0,r.useEffect)(()=>{eH.slice(1).forEach(e=>{e&&(new window.Image().src=e)})},[eH.join("|")]);let[eQ,e_]=(0,r.useState)(0),eD=(0,r.useCallback)(()=>{let e=eq.current;if(!e)return;let t=e.clientWidth||1;e_(Math.round(e.scrollLeft/t))},[]),eY=(0,r.useCallback)(function(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=eq.current;n&&(n.scrollTo({left:e*(n.clientWidth||1),behavior:t?"smooth":"auto"}),e_(e))},[]);(0,r.useEffect)(()=>{let e=(0,N.I)(Number(D.id)),t=e?eH.indexOf(e):-1,n=t>0?t:0,i=setTimeout(()=>eY(n,!1),0);return e_(n),()=>clearTimeout(i)},[D.id,eH.join("|")]);let eV=(0,m.sJ)(w.Z),eJ=(0,x.useRouter)(),eK=!!(null!==($=null==eV?void 0:eV.isLogin)&&void 0!==$?$:null==eV?void 0:eV.islogin),eX=(0,g.Z)(),eG=void 0!==eN,{similarItems:e0,isLoading:e1,hasMore:e2,loadMore:e3}=d(eG?null:null!==(T=D.id)&&void 0!==T?T:null,eR),e4=(0,r.useMemo)(()=>(null!=eN?eN:[]).filter(e=>e.id!==D.id),[eN,D.id]),e6=eG?e4:e0,e8=eG?!!eB:e1,e5=eG?!!eW:e2,e9=(0,r.useCallback)(()=>{eG?null==eF||eF():e3()},[eG,eF,e3]);(0,r.useEffect)(()=>{let e=document.body.style.overflow;document.body.style.overflow="hidden";let t=e=>{"Escape"===e.key&&tz()};return document.addEventListener("keydown",t),()=>{document.body.style.overflow=e,document.removeEventListener("keydown",t)}},[]);let e7=(0,r.useRef)([]),te=(0,r.useRef)(null);(0,r.useEffect)(()=>{te.current&&(te.current.scrollTop=0)},[D.id]);let tt=(0,r.useRef)(null);(0,r.useEffect)(()=>{var e;let t=tt.current;if(!t)return;let n=new IntersectionObserver(e=>{e[0].isIntersecting&&e9()},{root:null!==(e=te.current)&&void 0!==e?e:null,rootMargin:"200px",threshold:0});return n.observe(t),()=>n.disconnect()},[e9,e5]);let[tn,ti]=(0,r.useState)(!1),tr=(0,m.sJ)(Z.Z),[tl,to]=(0,r.useState)(Number(null==D?void 0:D.price)>0),[ta,ts]=(0,r.useState)(!1),[td,tc]=(0,r.useState)(null),tu=(null==D?void 0:null===(t=D.purchase)||void 0===t?void 0:t.saleUnit)==="EA"||(null==td?void 0:td.unitLabel)==="개",[th,tp]=(0,r.useState)(!1),[tf,tg]=(0,r.useState)((null==D?void 0:null===(n=D.stock)||void 0===n?void 0:n.status)==="discontinued");(0,r.useEffect)(()=>{var e;if(tg((null==D?void 0:null===(e=D.stock)||void 0===e?void 0:e.status)==="discontinued"||(null==D?void 0:D.discontinued)===!0),to(Number(null==D?void 0:D.price)>0),tc(null),tp(!1),!D.id){tp(!0);return}let t=!0;return(0,I.jV)({productId:Number(D.id)}).then(e=>{t&&(tp(!0),e.discontinued&&tg(!0),to("BUY"===e.mode),"BUY"===e.mode&&(tc({unitPrice:e.unitPrice,unitLabel:e.unitLabel,priceUnitLabel:e.priceUnitLabel,unitAreaM2:e.unitAreaM2}),(0,I.Fl)({kind:"VIEW",productId:Number(D.id)})))}).catch(()=>{t&&tp(!0)}),()=>{t=!1}},[D.id]);let tm=(0,m.Zl)(b.Z),tx=(0,m.sJ)(v.Z).some(e=>Number(null==e?void 0:e.productId)===Number(null==D?void 0:D.id)),tw=(0,r.useCallback)(()=>{eC(),tm(!0)},[eC,tm]),{addCart:tb}=(0,y.Z)({onError:()=>W.Am.error("샘플 담기에 실패했습니다. 잠시 후 다시 시도해 주세요.",{position:"bottom-center",autoClose:2e3}),onSuccess:tw}),tv=(0,r.useCallback)(()=>{let e=Number(null==D?void 0:D.id);if(!e)return;let t=!1;try{t=!!localStorage.getItem("TOKEN")}catch(e){t=!1}if(!t){eJ.push((0,j.S)("/home/?pid=".concat(e)));return}if(tx){tw();return}tb(e)},[null==D?void 0:D.id,null==D?void 0:D.name,null==D?void 0:D.image,eJ,tb,tx,tw]);(0,r.useEffect)(()=>{(0,P.K$)(),(0,P.cS)(I.I4)},[]);let ty=(0,r.useRef)(!1);(0,r.useEffect)(()=>{if(ty.current)return;let e=new URLSearchParams(window.location.search),t="1"===e.get("inquiry"),n="1"===e.get("buy"),i="1"===e.get("sample");if(!t&&!n&&!i||n&&!th)return;ty.current=!0,i?tf||tv():t?ti(!0):tl&&!tf&&ts(!0),e.delete("inquiry"),e.delete("buy"),e.delete("sample");let r=e.toString();window.history.replaceState(null,"",window.location.pathname+(r?"?".concat(r):""))},[tl,th,tv,tf]);let tj=(0,F.ZP)(),tC=(0,r.useCallback)(async()=>{let e="".concat(window.location.origin,"/home/?pid=").concat(D.id),t=navigator;if("function"==typeof t.share&&window.isSecureContext)try{var n;let i=(0,p.zb)(e$);await t.share({title:"".concat(D.name," | 마코디"),text:i?"".concat(i," ").concat(D.name):String(null!==(n=D.name)&&void 0!==n?n:""),url:e});return}catch(e){if((null==e?void 0:e.name)==="AbortError")return}let i=()=>W.Am.success("링크가 복사되었습니다.",{position:"bottom-center",autoClose:1500});try{if(navigator.clipboard&&window.isSecureContext){await navigator.clipboard.writeText(e),i();return}}catch(e){}try{let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t),i()}catch(e){W.Am.error("복사에 실패했습니다.",{position:"bottom-center",autoClose:1500})}},[D.id,D.name,e$]),tk=()=>{let e=e$.url;if(e){if(!(0,p.T)(eX)){eJ.push(p.Sv);return}window.open(e,"_blank")}},{run:tI,state:tP}=(0,E.Z)(),[tM,tZ]=(0,r.useState)(null),tS=e=>{tZ(e),tI({productId:D.id,isSeamless:"seamless"===e,isPBR:"pbr"===e,source:"grid",owned:"pbr"===e?!!(null==D?void 0:D.ownedPbr):"seamless"===e&&!!(null==D?void 0:D.ownedSeamless)})},tA=(0,r.useCallback)(e=>{eE&&(e7.current.push(D.id),eE(e))},[D.id,eE]),tz=(0,r.useCallback)(()=>{if(e7.current.length>0){let e=e7.current.pop();null==eE||eE(e)}else eC()},[eC,eE]),tE=e8&&0===e6.length,tL=e8&&e6.length>0,tR=document.getElementById("modal-root")||document.body,tN=(0,i.jsxs)(H,{$top:eL,children:[(0,i.jsx)(q,{ref:te,children:(0,i.jsxs)(X,{children:[(0,i.jsxs)(G,{ref:eO,children:[(0,i.jsx)(ee,{type:"button",onClick:eC,"aria-label":"닫기",children:(0,i.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.2,strokeLinecap:"round",strokeLinejoin:"round",children:(0,i.jsx)("path",{d:"M15 18l-6-6 6-6"})})}),(0,i.jsx)(ei,{}),tf?(0,i.jsx)(B.QR,{$size:"lg",children:(0,B.pM)(D)}):null,eH.length>1?(0,i.jsx)(el,{ref:eq,onScroll:eD,children:eH.map((e,t)=>(0,i.jsx)(eo,{src:e,alt:"".concat(e$.name,"-").concat(t)},t))}):(0,i.jsx)(er,{src:eU,alt:e$.name}),(()=>{let e=!!(null==D?void 0:D.isPBR)||!!e$.hasPBR,t=!!(null==D?void 0:D.hasSeamless)||!!e$.hasSeamless,n=e=>tM===e?tP:"idle",r=[],l=()=>{let e="".concat(8+39*r.length,"px");return{$bottom:e,$bottomMobile:e}};(0,p.T)(eX)&&e$.url&&r.push((0,i.jsx)(c.o6,{alwaysExpanded:!0,compact:!0,label:"링크",icon:L.Z,iconAlt:"링크",onClick:tk,...l()},"link"));let o=()=>(0,i.jsx)(c.o6,{alwaysExpanded:!0,compact:!0,label:"심리스",onClick:()=>tS("seamless"),state:n("seamless"),...l(),premium:!0,owned:!!(null==D?void 0:D.ownedSeamless)},"seamless");return e?(t&&r.push(o()),r.push((0,i.jsx)(c.o6,{alwaysExpanded:!0,compact:!0,label:"PBR",onClick:()=>tS("pbr"),state:n("pbr"),...l(),premium:!0,owned:!!(null==D?void 0:D.ownedPbr)},"pbr"))):(r.push((0,i.jsx)(c.o6,{alwaysExpanded:!0,compact:!0,label:"이미지",onClick:()=>tS("jpg"),state:n("jpg"),...l()},"jpg")),t&&r.push(o())),null})()]}),eH.length>1?(0,i.jsx)(et,{role:"tablist","aria-label":"제품 이미지",children:eH.map((e,t)=>(0,i.jsx)(en,{type:"button",role:"tab","aria-selected":t===eQ,"aria-label":"이미지 ".concat(t+1),$active:t===eQ,onClick:()=>eY(t),style:{backgroundImage:'url("'.concat((0,R.U)(e,200),'")')}},e))}):null,(0,i.jsxs)(ea,{children:[(0,i.jsxs)(eg,{children:[(()=>{let e=(0,p.zb)(e$);return e?(0,i.jsx)(ex,{children:e}):null})(),(0,i.jsx)(em,{children:D.name})]}),(0,i.jsx)(es,{type:"button",onClick:tC,"aria-label":"공유",children:(0,i.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#413d7d",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,i.jsx)("circle",{cx:"18",cy:"5",r:"3"}),(0,i.jsx)("circle",{cx:"6",cy:"12",r:"3"}),(0,i.jsx)("circle",{cx:"18",cy:"19",r:"3"}),(0,i.jsx)("line",{x1:"8.59",y1:"13.51",x2:"15.42",y2:"17.49"}),(0,i.jsx)("line",{x1:"15.41",y1:"6.51",x2:"8.59",y2:"10.49"})]})})]}),(()=>{var e;let t=(0,M.fL)(e$.sizeOptions,(0,M.N5)(e$.size,tr[Number(D.id)])),n=t&&Number(t.unitPrice)>0?t:td,r=(0,p.no)(null==n?void 0:n.unitPrice),l=(0,p.WV)(Number(e$.price));return r>0||l>0?(0,i.jsxs)(ed,{children:[(0,i.jsxs)(ec,{children:[(0,i.jsx)(eu,{children:(0,f.Z)(String(r>0?r:l))}),r>0&&(0,i.jsx)(eh,{children:(0,p.fq)(null!==(e=null==n?void 0:n.priceUnitLabel)&&void 0!==e?e:null==n?void 0:n.unitLabel)}),(0,i.jsx)(ef,{children:"(부가세 포함)"})]}),r>0&&l>0&&r!==l&&(0,i.jsxs)(ep,{children:["㎡당 ",(0,f.Z)(String(l))]})]}):(0,i.jsx)(ed,{children:(0,i.jsx)(eu,{children:"별도문의"})})})(),(0,i.jsxs)(ew,{children:[e$.code&&(0,i.jsxs)(eb,{children:[(0,i.jsx)(ev,{children:"상품코드"}),(0,i.jsx)(ey,{children:e$.code})]}),e$.category&&(0,i.jsxs)(eb,{children:[(0,i.jsx)(ev,{children:"구분"}),(0,i.jsx)(ey,{children:e$.category})]}),e$.subCategory&&(0,i.jsxs)(eb,{children:[(0,i.jsx)(ev,{children:"종류"}),(0,i.jsx)(ey,{children:e$.subCategory})]}),e$.size&&(0,i.jsxs)(eb,{children:[(0,i.jsx)(ev,{children:"사이즈(mm)"}),(0,i.jsx)(ey,{children:(0,h.cs)(String(e$.size)).join(", ")||e$.size})]}),e$.country&&(0,i.jsxs)(eb,{children:[(0,i.jsx)(ev,{children:"원산지"}),(0,i.jsx)(ey,{children:e$.country})]}),e$.glossiness&&(0,i.jsxs)(eb,{children:[(0,i.jsx)(ev,{children:"광택도"}),(0,i.jsx)(ey,{children:e$.glossiness})]}),!tu&&(0,i.jsxs)(eb,{children:[(0,i.jsx)(ev,{children:"판매단가(m\xb2)"}),(0,i.jsx)(ey,{children:(()=>{let e=Number(e$.price);return Number.isFinite(e)&&e>0?(0,f.Z)(String((0,p.WV)(e))):"별도문의"})()})]}),(0,p.T)(eX)&&(0,i.jsxs)(eb,{children:[(0,i.jsx)(ev,{children:tu?"제휴단가(1개)":"제휴단가(m\xb2)"}),(0,i.jsx)(ey,{children:(()=>{let e=(0,p.E$)(e$.price,e$.partnerRate);return e>0?"\uD83D\uDC51 ".concat((0,f.Z)(String(e))):"별도문의"})()})]}),(0,i.jsxs)(eb,{children:[(0,i.jsx)(ev,{children:"배송비"}),(0,i.jsx)(ey,{children:(0,p.MA)(e$)})]}),(()=>{let e=(0,u.l)(e$,e$.feature||"");return e&&"특징 정보가 없습니다"!==e?(0,i.jsxs)(eb,{children:[(0,i.jsx)(ev,{children:"상세정보"}),(0,i.jsx)(ey,{children:e})]}):null})()]}),(0,i.jsxs)(ej,{children:[tE?Array.from({length:6}).map((e,t)=>(0,i.jsxs)(ek,{as:"div",children:[(0,i.jsx)(eI,{children:(0,i.jsx)(eS,{})}),(0,i.jsx)(eA,{$width:"80%",$height:12}),(0,i.jsx)(eA,{$width:"60%",$height:10})]},"sk-".concat(t))):e6.map(e=>{var t,n,r,l;return(0,i.jsxs)(ek,{type:"button",onClick:()=>tA(e.id),children:[(0,i.jsxs)(eI,{children:[(0,i.jsx)(eZ,{src:e.img,alt:e.name,loading:"lazy"}),(0,i.jsx)(eP,{children:"both"===(0,s.l)(e)?(0,i.jsx)(S.vW,{size:30}):"pbr"===(0,s.l)(e)?(0,i.jsx)(S.YC,{size:30}):"seamless"===(0,s.l)(e)?(0,i.jsx)(S.BD,{size:30}):"model3d"===(0,s.l)(e)?(0,i.jsx)(S.ie,{size:30,free:!!e.model3dFree}):e.isSeamless?(0,i.jsx)(eM,{children:"심리스"}):null}),(0,z.y9)(e)?(0,i.jsx)(z.tB,{children:(0,z.tc)(e)}):(0,A.Yq)(e)?(0,i.jsx)(A.gl,{}):null]}),(0,i.jsx)(k.Z,{name:e.name,brand:(0,p.zb)(e)||e.store||"",price:e.price,unitPrice:null===(t=e.purchase)||void 0===t?void 0:t.unitPrice,unitLabel:null!==(l=null===(n=e.purchase)||void 0===n?void 0:n.priceUnitLabel)&&void 0!==l?l:null===(r=e.purchase)||void 0===r?void 0:r.unitLabel})]},e.id)}),tL&&Array.from({length:6}).map((e,t)=>(0,i.jsxs)(ek,{as:"div",children:[(0,i.jsx)(eI,{children:(0,i.jsx)(eS,{})}),(0,i.jsx)(eA,{$width:"80%",$height:12}),(0,i.jsx)(eA,{$width:"60%",$height:10})]},"more-sk-".concat(t)))]}),e5&&(0,i.jsx)(ez,{ref:tt})]},D.id)}),(0,i.jsxs)(O,{children:[(0,i.jsxs)(J,{children:[(0,i.jsx)(K,{as:"a",href:"tel:+821093191508",onClick:()=>(0,F.p8)("TEL_MOBILE","detail_bar",Number(D.id)),"aria-label":"전화 문의",children:(0,i.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#413d7d",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:(0,i.jsx)("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72c.13.96.36 1.9.7 2.81a2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45c.91.34 1.85.57 2.81.7A2 2 0 0 1 22 16.92z"})})}),(0,i.jsx)(K,{type:"button",onClick:()=>tj({surface:"detail_bar",productId:Number(D.id)}),"aria-label":"채팅 문의",children:(0,i.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#413d7d",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:(0,i.jsx)("path",{d:"M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"})})})]}),(0,i.jsxs)(Q,{children:[(0,i.jsxs)(_,{children:[(0,i.jsx)(Y,{type:"button",disabled:tf,"aria-disabled":tf,style:tf?{opacity:.5,color:"#9ca3af",borderColor:"#d1d5db"}:void 0,onClick:()=>!tf&&tv(),children:tx&&!tf?"장바구니 이동":"샘플 담기"}),(0,i.jsx)(Y,{type:"button",onClick:()=>{ti(!0)},children:"자재\xb7시공 문의"})]}),tl&&(0,i.jsx)(V,{type:"button",disabled:tf,"aria-disabled":tf,style:tf?{background:"#d1d5db",color:"#6b7280"}:void 0,onClick:()=>!tf&&ts(!0),children:tf?"단종\xb7재고확인 — 전화\xb7카톡 문의":eK?"구매하기":"비회원 구매하기"})]})]})]});return(0,i.jsxs)(i.Fragment,{children:[(0,l.createPortal)(tN,tR),tl&&ta&&(0,i.jsx)(C.Z,{isOpen:!0,onClose:()=>ts(!1),productId:Number(D.id),productName:D.name,image:null!=eU?eU:null,size:tr[Number(D.id)]&&null!==(U=null===(o=(0,M.fL)(e$.sizeOptions,(0,M.N5)(e$.size,tr[Number(D.id)])))||void 0===o?void 0:o.size)&&void 0!==U?U:null}),(0,i.jsx)(c.c4,{open:tn,onClose:()=>ti(!1),productId:D.id,productName:D.name,productImage:D.image,productCategory:D.category,productSubCategory:D.subCategory})]})};let T=(0,o.F4)(["from{transform:translateY(24px);opacity:0;}to{transform:translateY(0);opacity:1;}"]),U=(0,o.F4)(["from{transform:translateY(100%);}to{transform:translateY(0);}"]),H=o.ZP.div.withConfig({componentId:"sc-16d04308-0"})(["position:fixed;top:","px;left:0;right:0;bottom:0;z-index:13000;background:#ffffff;animation:"," 0.32s cubic-bezier(0.2,0.8,0.2,1);"],e=>{let{$top:t}=e;return t},U),q=o.ZP.div.withConfig({componentId:"sc-16d04308-1"})(["position:absolute;inset:0;overflow-y:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;padding-bottom:calc(68px + env(safe-area-inset-bottom));"]),O=o.ZP.div.withConfig({componentId:"sc-16d04308-2"})(["position:absolute;left:0;right:0;bottom:0;z-index:5;display:flex;align-items:stretch;gap:8px;padding:8px 12px calc(8px + env(safe-area-inset-bottom));background:#fff;border-top:1px solid #e5e2dc;"]),Q=o.ZP.div.withConfig({componentId:"sc-16d04308-3"})(["flex:1 1 0;min-width:0;display:flex;flex-direction:column;justify-content:center;gap:8px;"]),_=o.ZP.div.withConfig({componentId:"sc-16d04308-4"})(["display:flex;gap:8px;"]),D="\n flex: 1 1 0;\n min-width: 0;\n border-radius: 8px;\n font-size: 14px;\n font-weight: 700;\n cursor: pointer;\n white-space: nowrap;\n",Y=o.ZP.button.withConfig({componentId:"sc-16d04308-5"})([""," height:36px;border-radius:8px;border:1px solid #413d7d;background:#fff;color:#413d7d;&:active{background:#eef0fa;}"],D),V=o.ZP.button.withConfig({componentId:"sc-16d04308-6"})([""," flex:0 0 auto;height:36px;border:0;background:#413d7d;color:#fff;&:active{background:#2e2b5e;}"],D),J=o.ZP.div.withConfig({componentId:"sc-16d04308-7"})(["flex:0 0 auto;display:flex;flex-direction:column;gap:8px;"]),K=o.ZP.button.withConfig({componentId:"sc-16d04308-8"})(["flex:0 0 auto;height:36px;width:44px;display:inline-flex;align-items:center;justify-content:center;border:1px solid #d8d5cf;border-radius:8px;background:#fff;cursor:pointer;&:active{background:#f4f2ee;}"]),X=o.ZP.section.withConfig({componentId:"sc-16d04308-9"})(["display:flex;flex-direction:column;gap:14px;padding:12px 12px 24px;animation:"," 0.24s ease-out;"],T),G=o.ZP.div.withConfig({componentId:"sc-16d04308-10"})(["position:relative;width:100%;aspect-ratio:1 / 1;border-radius:16px;overflow:hidden;background:#f4f2ee;"]),ee=o.ZP.button.withConfig({componentId:"sc-16d04308-11"})(["position:absolute;top:8px;left:6px;z-index:2;width:36px;height:36px;display:inline-flex;align-items:center;justify-content:center;padding:0;border:0;background:transparent;color:#1b2c33;filter:drop-shadow(0 0 2px rgba(255,255,255,0.95));cursor:pointer;&:active{opacity:0.6;}"]),et=o.ZP.div.withConfig({componentId:"sc-16d04308-12"})(["display:flex;gap:8px;margin-top:-6px;overflow-x:auto;scrollbar-width:none;&::-webkit-scrollbar{display:none;}"]),en=o.ZP.button.withConfig({componentId:"sc-16d04308-13"})(["flex:0 0 auto;width:54px;height:54px;padding:0;border-radius:8px;border:2px solid ",";background:#f4f2ee center / cover no-repeat;opacity:",";cursor:pointer;transition:opacity 0.15s ease,border-color 0.15s ease;"],e=>{let{$active:t}=e;return t?"#413d7d":"transparent"},e=>{let{$active:t}=e;return t?1:.7}),ei=o.ZP.div.withConfig({componentId:"sc-16d04308-14"})(["position:absolute;top:8px;left:8px;display:flex;flex-direction:column;gap:4px;z-index:2;pointer-events:none;"]),er=o.ZP.img.withConfig({componentId:"sc-16d04308-15"})(["width:100%;height:100%;object-fit:cover;display:block;"]),el=o.ZP.div.withConfig({componentId:"sc-16d04308-16"})(["width:100%;height:100%;display:flex;overflow-x:auto;scroll-snap-type:x mandatory;-webkit-overflow-scrolling:touch;scrollbar-width:none;&::-webkit-scrollbar{display:none;}"]),eo=o.ZP.img.withConfig({componentId:"sc-16d04308-17"})(["flex:0 0 100%;width:100%;height:100%;object-fit:cover;scroll-snap-align:center;display:block;"]),ea=o.ZP.div.withConfig({componentId:"sc-16d04308-18"})(["display:flex;align-items:flex-start;justify-content:space-between;gap:8px;padding:4px 4px 0;"]),es=o.ZP.button.withConfig({componentId:"sc-16d04308-19"})(["flex:0 0 auto;align-self:flex-start;margin-top:2px;width:34px;height:34px;display:inline-flex;align-items:center;justify-content:center;border:0;background:transparent;cursor:pointer;border-radius:8px;&:active{background:#f4f2ee;}"]),ed=o.ZP.div.withConfig({componentId:"sc-16d04308-20"})(["display:flex;flex-direction:column;gap:2px;padding:6px 4px 2px;"]),ec=o.ZP.div.withConfig({componentId:"sc-16d04308-21"})(["display:flex;align-items:center;gap:6px;flex-wrap:wrap;"]),eu=o.ZP.span.withConfig({componentId:"sc-16d04308-22"})(["font-size:24px;font-weight:800;line-height:1.2;color:#111;letter-spacing:-0.02em;"]),eh=o.ZP.span.withConfig({componentId:"sc-16d04308-23"})(["font-size:14px;font-weight:700;color:#6e6e73;"]),ep=o.ZP.div.withConfig({componentId:"sc-16d04308-24"})(["font-size:12.5px;color:#8a8780;"]),ef=o.ZP.span.withConfig({componentId:"sc-16d04308-25"})(["color:#9a9790;font-size:12px;"]),eg=o.ZP.div.withConfig({componentId:"sc-16d04308-26"})(["flex:1;min-width:0;"]),em=o.ZP.h3.withConfig({componentId:"sc-16d04308-27"})(["margin:0;font-size:16px;font-weight:400;line-height:1.4;color:#6b6b6b;letter-spacing:-0.02em;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;word-break:keep-all;"]),ex=o.ZP.p.withConfig({componentId:"sc-16d04308-28"})(["margin:0 0 3px;font-size:13px;font-weight:700;line-height:1.3;color:#2f2f2f;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;"]),ew=o.ZP.div.withConfig({componentId:"sc-16d04308-29"})(["display:grid;gap:4px;padding:4px 4px 6px;border-bottom:1px solid #e5e2dc;"]),eb=o.ZP.div.withConfig({componentId:"sc-16d04308-30"})(["display:grid;grid-template-columns:80px 1fr;gap:12px;font-size:13px;"]),ev=o.ZP.span.withConfig({componentId:"sc-16d04308-31"})(["color:#888381;font-weight:500;"]),ey=o.ZP.span.withConfig({componentId:"sc-16d04308-32"})(["color:#111;font-weight:500;"]),ej=o.ZP.div.withConfig({componentId:"sc-16d04308-33"})(["display:grid;grid-template-columns:repeat(2,1fr);gap:12px;padding:8px 4px 4px;"]),eC=(0,o.F4)(["0%,100%{opacity:0.55;}50%{opacity:1;}"]),ek=o.ZP.button.withConfig({componentId:"sc-16d04308-34"})(["display:flex;flex-direction:column;background:transparent;border:0;padding:6px 0;text-align:left;cursor:pointer;min-width:0;"]),eI=o.ZP.div.withConfig({componentId:"sc-16d04308-35"})(["position:relative;width:100%;padding-bottom:75%;border-radius:12px;overflow:hidden;background:#efece6;"]),eP=o.ZP.div.withConfig({componentId:"sc-16d04308-36"})(["position:absolute;top:6px;left:6px;z-index:2;display:flex;flex-direction:column;align-items:center;gap:4px;pointer-events:none;"]),eM=o.ZP.div.withConfig({componentId:"sc-16d04308-37"})(["padding:2px 7px;border-radius:999px;background:#413d7d;color:#fff;font-size:10px;font-weight:700;line-height:1;white-space:nowrap;"]),eZ=o.ZP.img.withConfig({componentId:"sc-16d04308-38"})(["position:absolute;inset:0;width:100%;height:100%;object-fit:cover;display:block;"]),eS=o.ZP.div.withConfig({componentId:"sc-16d04308-39"})(["position:absolute;inset:0;background:#e8e4dc;animation:"," 1.2s ease-in-out infinite;"],eC),eA=o.ZP.div.withConfig({componentId:"sc-16d04308-40"})(["width:",";height:","px;background:#efece6;border-radius:4px;animation:"," 1.2s ease-in-out infinite;"],e=>{let{$width:t}=e;return t},e=>{let{$height:t}=e;return t},eC),ez=o.ZP.div.withConfig({componentId:"sc-16d04308-41"})(["width:100%;height:1px;"])},33905:function(e,t,n){var i=n(57437),r=n(2265),l=n(88862),o=n(91410),a=n(77370),s=n(79577);let d="undefined"!=typeof WeakMap?new WeakMap:null,c=null;function u(e){let t=(0,r.useRef)(null),n=(0,r.useRef)(null),[i,l]=(0,r.useState)(0);return(0,r.useEffect)(()=>{let e=t.current,i=n.current;if(!e||!i)return;let r=()=>{let t=i.scrollWidth-e.clientWidth,n=t>2?t:0;l(e=>e===n?e:n)},o="undefined"==typeof ResizeObserver?null:(c||(c=new ResizeObserver(e=>{var t;for(let n of e)null==d||null===(t=d.get(n.target))||void 0===t||t()})),c);if(!o||!d){r();return}return d.set(e,r),o.observe(e),()=>{o.unobserve(e),d.delete(e)}},[e]),{wrapRef:t,innerRef:n,overflow:i}}let h=e=>{let{text:t,hl:n}=e,{wrapRef:r,innerRef:l,overflow:o}=u(t);return(0,i.jsx)(v,{ref:r,title:t,$hasOverflow:o>0,children:(0,i.jsx)(y,{ref:l,$distance:o,style:{"--marquee-d":"-".concat(o,"px")},children:(0,a.LA)(t,n)})})},p=e=>{let{text:t,hl:n}=e,{wrapRef:r,innerRef:l,overflow:o}=u(t);return(0,i.jsx)(j,{ref:r,title:t,$hasOverflow:o>0,children:(0,i.jsx)(C,{ref:l,style:{"--marquee-d":"-".concat(o,"px")},children:(0,a.LA)(t,n)})})},f=l.ZP.div.withConfig({componentId:"sc-5d996efe-0"})(["display:flex;align-items:baseline;gap:4px;margin-top:4px;min-width:0;overflow:hidden;flex-wrap:nowrap;"]),g=l.ZP.span.withConfig({componentId:"sc-5d996efe-1"})(["flex:0 0 auto;font-size:14px;font-weight:800;line-height:1.2;letter-spacing:-0.02em;color:",";white-space:nowrap;"],e=>e.$muted?"#9a9a9a":"#111"),m=l.ZP.span.withConfig({componentId:"sc-5d996efe-2"})(["flex:0 0 auto;font-size:9.5px;font-weight:600;color:#6e6e73;white-space:nowrap;@media (min-width:769px){font-size:14px;}"]),x=l.ZP.span.withConfig({componentId:"sc-5d996efe-3"})(["flex:0 0 auto;font-size:9.5px;font-weight:600;color:#c3c0b8;white-space:nowrap;@media (min-width:769px){font-size:14px;}"]),w=l.ZP.span.withConfig({componentId:"sc-5d996efe-4"})(["min-width:0;font-size:9.5px;font-weight:600;color:#8a8780;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;@media (min-width:769px){font-size:14px;}"]);t.Z=e=>{let{name:t,brand:n,price:r,unitPrice:l,unitLabel:a,highlight:d}=e,c=(0,s.no)(l),u=(0,s.WV)(r);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(p,{text:null!=n?n:"",hl:d}),(0,i.jsx)(h,{text:t,hl:d}),c>0||u>0?(0,i.jsxs)(f,{children:[(0,i.jsx)(g,{children:(0,o.Z)(String(c>0?c:u))}),(0,i.jsx)(m,{children:c>0?(0,s.fq)(a):"㎡당"}),c>0&&u>0&&c!==u?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(x,{"aria-hidden":!0,children:"/"}),(0,i.jsxs)(w,{children:[Number(u).toLocaleString("ko-KR")," ㎡당"]})]}):null]}):(0,i.jsx)(f,{children:(0,i.jsx)(g,{$muted:!0,children:"별도문의"})})]})};let b=(0,l.F4)(["0%,12%{transform:translateX(0);}88%,100%{transform:translateX(var(--marquee-d,0px));}"]),v=l.ZP.div.withConfig({componentId:"sc-5d996efe-5"})(["width:100%;margin-top:1px;overflow:hidden;white-space:nowrap;font-size:10px;font-weight:400;color:#6b6b6b;line-height:1.35;",""],e=>{let{$hasOverflow:t}=e;return t&&(0,l.iv)(["mask-image:linear-gradient( to right,#000 calc(100% - 16px),transparent 100% );-webkit-mask-image:linear-gradient( to right,#000 calc(100% - 16px),transparent 100% );[data-product-card]:hover & span{will-change:transform;animation:"," 2.5s ease-in-out infinite;}"],b)}),y=l.ZP.span.withConfig({componentId:"sc-5d996efe-6"})(["display:inline-block;white-space:nowrap;line-height:inherit;"]),j=l.ZP.span.withConfig({componentId:"sc-5d996efe-7"})(["margin-top:3px;font-size:10px;font-weight:700;line-height:1.35;color:#2f2f2f;display:block;width:100%;max-width:100%;overflow:hidden;white-space:nowrap;min-width:0;",""],e=>{let{$hasOverflow:t}=e;return t?(0,l.iv)(["mask-image:linear-gradient( to right,#000 calc(100% - 16px),transparent 100% );-webkit-mask-image:linear-gradient( to right,#000 calc(100% - 16px),transparent 100% );[data-product-card]:hover & span{will-change:transform;animation:"," 2.5s ease-in-out infinite;}"],b):(0,l.iv)(["text-overflow:ellipsis;"])}),C=l.ZP.span.withConfig({componentId:"sc-5d996efe-8"})(["display:inline-block;white-space:nowrap;line-height:inherit;"])},60331:function(e,t,n){var i=n(29918),r=n(41659);t.Z=(e,t)=>{let{onSuccess:n,onError:l}=t,o={...e,txtSearch:e.txtSearch.trim()};i.es.post("productai",o).then(e=>{let t=null==e?void 0:e.data;if("string"==typeof t&&/errcode/i.test(t)||t&&"object"==typeof t&&"errcode"in t){n([]);return}let l=Array.isArray(t)?t:Array.isArray(null==t?void 0:t.data)?t.data:Array.isArray(null==t?void 0:t.products)?t.products:Array.isArray(null==t?void 0:t.results)?t.results:null;if(!l)throw Error("Unexpected response shape: ".concat(JSON.stringify(t).slice(0,200)));let o=new Set,a=l.map(e=>({...e,isNew:e.isNew,img:(0,r.U)(e.img,400),storeLogo:(0,r.U)(e.storeLogo,96)})).filter(e=>"number"!=typeof e.id||!o.has(e.id)&&(o.add(e.id),!0)),s=a.map(e=>e.id).filter(e=>"number"==typeof e&&Number.isFinite(e)),d=e=>{n(e)};if(0===s.length){d(a);return}let c=s.filter(e=>e>0);(c.length?i.Wg.post("product/seamless-map",{ids:c}).then(e=>(null==e?void 0:e.data)&&"object"==typeof e.data?e.data:{}).catch(()=>({})):Promise.resolve({})).then(e=>{d(a.map(t=>{let n={...t},i=e[t.id];return i&&(i.img&&(n.img=i.img),i.hasSeamless&&(n.hasSeamless=!0),i.hasPBR&&(n.hasPBR=!0),i.isHighQuality&&(n.isHighQuality=!0),null!=i.brand&&(n.brand=i.brand),null!=i.series&&(n.series=i.series),null!=i.code&&(n.code=i.code),null!=i.price&&(n.price=i.price),null!=i.purchase&&(n.purchase=i.purchase)),n}))})}).catch(e=>{var t;console.error("[useImgSearch] error",null==e?void 0:null===(t=e.response)||void 0===t?void 0:t.status,e),l([e.message||"An unexpected error occurred."])})}},77370:function(e,t,n){n.d(t,{Fr:function(){return a},LA:function(){return d},jl:function(){return o}});var i=n(57437);n(2265);var r=n(43618),l=n(26163);let o=(0,r.nZ)({key:"searchHighlightQuery",get:e=>{var t,n;let{get:i}=e;return String(null!==(n=null===(t=i(l.Tq).activeId)||void 0===t?void 0:t.txtSearch)&&void 0!==n?n:"").trim()}});function a(e){return Array.from(new Set(String(null!=e?e:"").replace(/["“”]/g," ").split(/\s+/).filter(e=>e&&!/^-[^\d]/.test(e)).map(e=>e.toLowerCase()))).sort((e,t)=>t.length-e.length)}let s=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function d(e,t){if(!e||!t||!t.length)return e;let n=RegExp("(".concat(t.map(s).join("|"),")"),"gi"),r=e.split(n);return 1===r.length?e:r.map((e,t)=>t%2?(0,i.jsx)("b",{style:{fontWeight:700,color:"#111"},children:e},t):e)}},93080:function(e,t,n){n.d(t,{Sr:function(){return g},G9:function(){return w},Ab:function(){return x}});var i=n(29918);let r=e=>{let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},l=function(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5,l=t*n,o=new Float32Array(l),a=new Float32Array(l),s=new Float32Array(l);for(let t=0;t{let i=new Float32Array(l),r=new Float32Array(l);for(let r=0;r{let n=(u[e]-u[t])*.45,i=h[e]-h[t],r=p[e]-p[t];return Math.sqrt(n*n+i*i+r*r)},g=4*l,m=new Int32Array(g),x=new Int32Array(g),w=new Float32Array(g),b=0;for(let e=0;e0&&ew[e]-w[t]);let y=new Int32Array(l),j=new Int32Array(l).fill(1),C=new Float32Array(l);for(let e=0;e{for(;y[e]!==e;)y[e]=y[y[e]],e=y[e];return e},I=Math.max(1,Math.min(10,i)),P=l/6e4*6*Math.pow(.62,I-1);for(let e=0;e=j[i]?[n,i]:[i,n];y[t]=e,j[e]+=j[t],C[e]=Math.max(C[e],C[t],r)}}let M=Math.max(20,Math.round(.004*l));for(let e=0;e=j[i]?[n,i]:[i,n];y[t]=e,j[e]+=j[t]}}let Z=new Int32Array(l).fill(-1),S=new Int32Array(l),A=0;for(let e=0;e{let t=new Int32Array(A),n=new Float64Array(3*A),i=new Float64Array(3*A);for(let r=0;r{for(;r[e]!==e;)r[e]=r[r[e]],e=r[e];return e},a=new Map;for(let e=0;e{let n=Math.floor(t/A),r=t%A;if(e<4)return;let l=(i[3*n]-i[3*r])*.2,o=i[3*n+1]-i[3*r+1],a=i[3*n+2]-i[3*r+2],d=Math.sqrt(l*l+o*o+a*a);de[0]-t[0]),s)){let n=o(e),i=o(t);n!==i&&(r[i]=n)}let d=new Int32Array(A).fill(-1),c=0;for(let e=0;e{let n=new Uint8Array(e.W*e.H);for(let i=0;i{let i=(i,r)=>i>=0&&r>=0&&in*(t+1)+e,o=(e,t,n,i)=>{let o=l(e,t),a=r.get(o);a?a.push(l(n,i)):r.set(o,[l(n,i)])};for(let e=0;e=4&&a.push(s(i))}return a},s=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1.1;if(e.length<5)return e;let n=new Uint8Array(e.length);n[0]=n[e.length-1]=1;let i=[[0,e.length-1]];for(;i.length;){let[r,l]=i.pop(),[o,a]=e[r],[s,d]=e[l],c=Math.hypot(s-o,d-a)||1,u=0,h=-1;for(let t=r+1;tu&&(u=n,h=t)}u>t&&h>0&&(n[h]=1,i.push([r,h],[h,l]))}return e.filter((e,t)=>n[t])},d=e=>{let t=320/Math.max(e.naturalWidth,e.naturalHeight),n=Math.max(8,Math.round(e.naturalWidth*t)),i=Math.max(8,Math.round(e.naturalHeight*t)),r=document.createElement("canvas");r.width=n,r.height=i;let l=r.getContext("2d",{willReadFrequently:!0});return l.imageSmoothingQuality="high",l.drawImage(e,0,0,n,i),{rgba:l.getImageData(0,0,n,i).data,W:n,H:i}},c=(e,t)=>{let{rgba:n,W:i,H:r}=d(e),a=l(n,i,r,8),s=i*r,c=t?t(i,r):null,h=0;for(let e=1;ea.area[h]&&(h=e);let p=-1,f=-1/0;for(let e=0;e.7)continue;let n=0,l=0,o=0;for(let t=0;tf&&(f=m,p=e)}let g=(p<0?[]:o(a,p).sort((e,t)=>t.length-e.length))[0];if(!g||g.length<3)return c?null:u();let m=0,x=[];for(let e=0;e{let[t,n]=e;w+=t,b+=n}),w/=g.length,b/=g.length;let v=[],y=0,j=0;for(let e=0;e<90;e++){let t=e/90*m;for(;j+x[y]{let e=[];for(let t=0;t<90;t++){let n=t/90*Math.PI*2-Math.PI/2,i=1+.04*Math.sin(.45*t);e.push([.5+.17*Math.cos(n)*i,.5+.24*Math.sin(n)*i])}return e},h=["floor","wall","ceiling"],p=(e,t)=>{if((t.frame||0)>=.6)return!1;let n={};for(let t of e)n[t.purpose]=(n[t.purpose]||0)+t.area;let i=Object.values(n).filter(e=>e>=.1).length,r=(t.ceiling||0)>=.1&&i>=2,l=(t.building||0)>=.3&&((t.sky||0)>=.05||(n.floor||0)>=.1);return r||l},f=null,g=e=>{let t=e.currentSrc||e.src;if((null==f?void 0:f.key)===t)return f.list;let n=async()=>{var t;let n=Math.min(1,640/Math.max(e.naturalWidth,e.naturalHeight)),r=document.createElement("canvas");r.width=Math.max(1,Math.round(e.naturalWidth*n)),r.height=Math.max(1,Math.round(e.naturalHeight*n)),null===(t=r.getContext("2d"))||void 0===t||t.drawImage(e,0,0,r.width,r.height);let l=await i.es.post("productai/regions",{image:r.toDataURL("image/jpeg",.9)}),o=(null==l?void 0:l.data)||{},a=(Array.isArray(o.regions)?o.regions:[]).filter(e=>{var t;return h.includes(e.purpose)&&e.box&&(null===(t=e.polygon)||void 0===t?void 0:t.length)>2}),s=p(a,o);return console.info("[AI 영역] 공간 사진",s,{regions:a.length,ceiling:o.ceiling,sky:o.sky,building:o.building,frame:o.frame}),s?a:[]},r=new Promise(e=>setTimeout(()=>e([]),8e3)),l=Promise.race([n(),r]).catch(e=>(console.info("[AI 영역] 영역 분석 실패 — 기본 박스",(null==e?void 0:e.message)||e),[]));return f={key:t,list:l},l},m=e=>(t,n)=>{let i=document.createElement("canvas");i.width=t,i.height=n;let r=i.getContext("2d",{willReadFrequently:!0});for(let i of(r.fillStyle="#000",e))r.beginPath(),i.polygon.forEach((e,i)=>{let[l,o]=e;return i?r.lineTo(l*t,o*n):r.moveTo(l*t,o*n)}),r.closePath(),r.fill();let l=r.getImageData(0,0,t,n).data,o=new Uint8Array(t*n);for(let e=0;e0?1:0;return o},x=(e,t)=>{if(!t.length)return null;let n=null;try{n=c(e,m(t))}catch(e){return console.info("[AI 영역] 그림을 읽지 못해 기본 박스",e),null}if(!n)return null;let i=1,r=1,l=0,o=0;for(let[e,t]of n)i=Math.min(i,e),r=Math.min(r,t),l=Math.max(l,e),o=Math.max(o,t);return i=Math.max(0,i),r=Math.max(0,r),l=Math.min(1,l),o=Math.min(1,o),l-i>.02&&o-r>.02?{x:i,y:r,w:l-i,h:o-r,stroke:n}:null},w=(e,t)=>{if(!e.length)return"";let n=document.createElement("canvas");n.width=200,n.height=200;let i=n.getContext("2d",{willReadFrequently:!0}),r=Math.max(0,Math.floor(200*t.x)),l=Math.max(0,Math.floor(200*t.y)),o=Math.max(1,Math.min(200-r,Math.ceil(200*t.w))),a=Math.max(1,Math.min(200-l,Math.ceil(200*t.h))),s="",d=0;for(let t of h){let n=e.filter(e=>e.purpose===t);if(!n.length)continue;for(let e of(i.clearRect(0,0,200,200),i.fillStyle="#000",n))i.beginPath(),e.polygon.forEach((e,t)=>{let[n,r]=e;return t?i.lineTo(200*n,200*r):i.moveTo(200*n,200*r)}),i.closePath(),i.fill();let c=i.getImageData(r,l,o,a).data,u=0;for(let e=3;e0&&u++;let h=u/(o*a);h>d&&(d=h,s=t)}return d>=.35?s:""}},15312:function(e,t,n){n.d(t,{_:function(){return i}});function i(e){return new Promise((t,n)=>{let i=new Image;i.crossOrigin="Anonymous",i.onload=()=>{try{let e=document.createElement("canvas"),r=e.width=Math.min(64,i.naturalWidth||64),l=e.height=Math.min(64,i.naturalHeight||64),o=e.getContext("2d");if(!o){n(Error("canvas 2d context unavailable"));return}o.drawImage(i,0,0,r,l);let{data:a}=o.getImageData(0,0,r,l),s=0,d=0,c=0,u=0;for(let e=0;e{n(e)},i.src=e})}}}]);