const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DQkqZEIk.js","assets/react-WWJ_A68P.js","assets/call-bind-oCmkau44.js","assets/get-intrinsic-BKEvijrG.js","assets/es-errors-DzOT6E3C.js","assets/has-symbols-eVqrYdw7.js","assets/has-proto-JnoBQRdH.js","assets/function-bind-BbkWVFrm.js","assets/hasown-DYqjtFKE.js","assets/set-function-length-B5OANX0j.js","assets/define-data-property-DO9o5wXF.js","assets/es-define-property-tzmkNPou.js","assets/gopd-CEkvUycD.js","assets/has-property-descriptors-DphFXkuo.js","assets/dayjs-CZ9ViMNG.js","assets/styled-components-BHeWolSk.js","assets/@emotion-DwO3GsBP.js","assets/hoist-non-react-statics-Buxaj0Kl.js","assets/react-is-8JwjhRSi.js","assets/stylis-YPZU7XtI.js","assets/index-BPJ5U2d6.js","assets/react-dom-CvjNlBjt.js","assets/scheduler-CzFDRTuY.js","assets/@tanstack-BR86rpua.js","assets/react-helmet-async-jeYtsOp6.js","assets/react-fast-compare-Dxyd5FYM.js","assets/invariant-Bm-uj-iG.js","assets/shallowequal-F1vAqOm6.js","assets/react-redux-DlpFpBQ0.js","assets/use-sync-external-store-KK8Bpy9o.js","assets/react-router-dom-B4YB8MrN.js","assets/react-router-BOGNRwMt.js","assets/@remix-run-DhIrJP8L.js","assets/redux-persist-Cbb21slr.js","assets/redux-DITMfSWq.js","assets/usehooks-ts-CCkIaz9n.js","assets/lodash.debounce-CDHjgjOA.js","assets/@fxts-cXD7MMns.js","assets/framer-motion-DbOul5S8.js","assets/axios-Da_2YOEl.js","assets/crypto-js-C0tVhymU.js","assets/universal-cookie-Cmu-M0pA.js","assets/react-error-boundary-DEyRbsfJ.js","assets/dompurify-CqxHTgmJ.js","assets/react-device-detect-BAEcyX2V.js","assets/ua-parser-js-BBZA8f28.js","assets/qs-LNWgR29u.js","assets/side-channel-CpYS7sho.js","assets/object-inspect-CL2AiSqO.js","assets/@reduxjs-DYPsSoVN.js","assets/immer-DqxjFn0G.js","assets/redux-thunk-ClJT1hhx.js","assets/redux-logger-B8JP_rc7.js","assets/qrcode.react-CJWQPexu.js","assets/swiper-DLv7ejQn.js","assets/swiper-Be9b3THL.css","assets/@hookform-Dc6jS12O.js","assets/react-hook-form-BJXGuiwr.js","assets/@marsidev-F19kFZ1X.js","assets/currency.js-9OAR_aOO.js","assets/react-select-CI241hL_.js","assets/@babel-CabbEptY.js","assets/@floating-ui-NvD4EidW.js","assets/use-isomorphic-layout-effect-MPmsYcaj.js","assets/memoize-one-BdPwpGay.js","assets/styled-reset-B7ZXsPC1.js","assets/pretendard-D6ja04b6.css","assets/index-CS0fGNGK.js","assets/index-CeqtG6b7.js","assets/index-BImpVMX0.js","assets/useCouponMutation-D3YiMlPc.js","assets/download-completed-uzvw385i.js"])))=>i.map(i=>d[i]); import{_ as B,a as Et,u as jt}from"./@tanstack-BR86rpua.js";import{r as i,j as o}from"./react-WWJ_A68P.js";import{p as D,t as tt,e as w,L as Ct,c as Lt,b as Nt,i as Pt}from"./@fxts-cXD7MMns.js";import{i as wt}from"./axios-Da_2YOEl.js";import{d as b}from"./dayjs-CZ9ViMNG.js";import{u as Mt}from"./react-router-dom-B4YB8MrN.js";import{u as Bt,b as Ot,b5 as _t,b6 as Yt,c as Rt,aT as At,b7 as n,aN as Ht,aS as vt,b8 as kt,r as Vt,aP as $t,P as M,i as Ut,aU as qt,b9 as Ft,b0 as Kt}from"./index-BPJ5U2d6.js";import{u as zt}from"./useCouponMutation-D3YiMlPc.js";import{u as Gt}from"./useDeactivateCheck-DSrGULYL.js";import{a as Qt,i as Wt}from"./react-router-BOGNRwMt.js";import"./call-bind-oCmkau44.js";import"./get-intrinsic-BKEvijrG.js";import"./es-errors-DzOT6E3C.js";import"./has-symbols-eVqrYdw7.js";import"./has-proto-JnoBQRdH.js";import"./function-bind-BbkWVFrm.js";import"./hasown-DYqjtFKE.js";import"./set-function-length-B5OANX0j.js";import"./define-data-property-DO9o5wXF.js";import"./es-define-property-tzmkNPou.js";import"./gopd-CEkvUycD.js";import"./has-property-descriptors-DphFXkuo.js";import"./react-dom-CvjNlBjt.js";import"./scheduler-CzFDRTuY.js";import"./@remix-run-DhIrJP8L.js";import"./react-helmet-async-jeYtsOp6.js";import"./react-fast-compare-Dxyd5FYM.js";import"./invariant-Bm-uj-iG.js";import"./shallowequal-F1vAqOm6.js";import"./react-redux-DlpFpBQ0.js";import"./use-sync-external-store-KK8Bpy9o.js";import"./redux-persist-Cbb21slr.js";import"./redux-DITMfSWq.js";import"./styled-components-BHeWolSk.js";import"./@emotion-DwO3GsBP.js";import"./hoist-non-react-statics-Buxaj0Kl.js";import"./react-is-8JwjhRSi.js";import"./stylis-YPZU7XtI.js";import"./usehooks-ts-CCkIaz9n.js";import"./lodash.debounce-CDHjgjOA.js";import"./framer-motion-DbOul5S8.js";import"./crypto-js-C0tVhymU.js";import"./universal-cookie-Cmu-M0pA.js";import"./react-error-boundary-DEyRbsfJ.js";import"./dompurify-CqxHTgmJ.js";import"./react-device-detect-BAEcyX2V.js";import"./ua-parser-js-BBZA8f28.js";import"./qs-LNWgR29u.js";import"./side-channel-CpYS7sho.js";import"./object-inspect-CL2AiSqO.js";import"./@reduxjs-DYPsSoVN.js";import"./immer-DqxjFn0G.js";import"./redux-thunk-ClJT1hhx.js";import"./redux-logger-B8JP_rc7.js";import"./qrcode.react-CJWQPexu.js";import"./swiper-DLv7ejQn.js";import"./@hookform-Dc6jS12O.js";import"./react-hook-form-BJXGuiwr.js";import"./@marsidev-F19kFZ1X.js";import"./currency.js-9OAR_aOO.js";import"./react-select-CI241hL_.js";import"./@babel-CabbEptY.js";import"./@floating-ui-NvD4EidW.js";import"./use-isomorphic-layout-effect-MPmsYcaj.js";import"./memoize-one-BdPwpGay.js";import"./styled-reset-B7ZXsPC1.js";/* empty css */const Jt=i.lazy(()=>B(()=>import("./index-DQkqZEIk.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67]))),Xt=i.lazy(()=>B(()=>import("./index-CeqtG6b7.js"),__vite__mapDeps([68,1,2,3,4,5,6,7,8,9,10,11,12,13,44,45,30,21,22,31,32,20,23,24,25,26,27,28,29,33,34,15,16,17,18,19,35,36,37,38,39,14,40,41,42,43,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66]))),Zt=i.lazy(()=>B(()=>import("./index-BImpVMX0.js"),__vite__mapDeps([69,1,2,3,4,5,6,7,8,9,10,11,12,13,37,23,39,14,30,21,22,31,32,15,16,17,18,19,20,24,25,26,27,28,29,33,34,35,36,38,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,70,71]))),ho=()=>{Gt();const et=Et(),{isLogin:ot}=Bt(),{openDialog:y}=Ot(),T=Qt(),{eventNo:I}=Wt(),[O]=Mt(),_=O.get("preview");if(O.get("debug")==="skeleton")return o.jsx(_t,{});const{data:f}=jt({queryKey:Ft.config(),queryFn:async()=>{const{data:e}=await Kt.getConfig();return e},staleTime:60*60*1e3,gcTime:2*60*60*1e3}),{data:t}=Yt({eventNo:Number(I),searchParams:_?{order:"ADMIN_SETTING",soldout:!0,saleStatus:"ONSALE",preview:!!_}:{order:"ADMIN_SETTING",soldout:!0,saleStatus:"ONSALE"}}),{startYmdt:st,endYmdt:Y,dDay:R,isEvent:E,eventCouponData:rt,processedMobileHtml:it}=i.useMemo(()=>{var m,c,u,d;const e=b(t==null?void 0:t.startYmdt).format("YYYY.MM.DD"),s=b(t==null?void 0:t.endYmdt).format("YYYY.MM.DD"),r=b().format("YYYY.MM.DD");let l=((c=(m=t==null?void 0:t.top)==null?void 0:m.mobile)==null?void 0:c.url)||"";return((d=(u=t==null?void 0:t.top)==null?void 0:u.mobile)==null?void 0:d.type)==="HTML"&&l&&(l=l.replace(/{if(!ot){y("로그인이 필요합니다."),T(`${M.AUTH.LOGIN}?returnUrl=${window.location.pathname}`,{replace:!0});return}nt({couponNo:e},{onSuccess:async()=>{await y("쿠폰이 발급되었습니다."),await et.invalidateQueries({predicate:s=>Nt(s.queryKey[0],[...Ut.all]),refetchType:"all"}),T(M.MAIN)},onError:async s=>{var r;await y(wt(s)?((r=s.response)==null?void 0:r.data.message)??"쿠폰 다운로드에 실패했습니다.":"쿠폰 다운로드에 실패했습니다."),T(M.MAIN)}})},[ut,j]=i.useState(!1),C=i.useRef(null),A=i.useRef(null),S=i.useRef(null),h=i.useRef(56);i.useEffect(()=>{var s;const e=(s=document.getElementById("header"))==null?void 0:s.clientHeight;e&&(h.current=e)},[]);const g=i.useRef([]),[lt,H]=i.useState(""),[x,v]=i.useState(2),k=i.useRef(null),V=i.useCallback(()=>{if(!t)return;const e=t.section.reduce((s,r)=>s+r.products.length,0);xs+6)},[t,x]);i.useEffect(()=>{const e=k.current;if(!e)return;const s=new IntersectionObserver(r=>{r[0].isIntersecting&&V()},{root:null,rootMargin:"800px",threshold:.1});return s.observe(e),()=>{s.unobserve(e)}},[V]),i.useEffect(()=>{t!=null&&t.section[0]&&H(t.section[0].label)},[t]),i.useEffect(()=>{let e=null;const s=()=>{e===null&&(e=requestAnimationFrame(()=>{var d,G,Q,W;e=null;const r=h.current,l=((d=A.current)==null?void 0:d.offsetTop)||0,m=window.scrollY+r,c=((G=C.current)==null?void 0:G.clientHeight)||0;if((((Q=C.current)==null?void 0:Q.offsetTop)||0)+c-100<=m?j(!1):m>=l?j(!0):j(!1),!!g.current&&!Pt(g.current)){const P=((W=S.current)==null?void 0:W.clientHeight)||0,J=g.current.findIndex((St,yt)=>{const X=St,Z=g.current[yt+1];if(X){const Tt=X.getBoundingClientRect().top+window.scrollY-(r+P),It=Z?Z.getBoundingClientRect().top+window.scrollY-(r+P)-70:1/0;return m+r+P>=Tt&&m{window.removeEventListener("scroll",s),e!==null&&cancelAnimationFrame(e)}},[t]);const mt=e=>{var m;const r=t.section.slice(0,t.section.findIndex(c=>c.label===e)).reduce((c,u)=>c+u.products.length,0)+1;if(r>x){v(r+6),setTimeout(()=>{var u;const c=document.getElementById(e);c&&window.scrollTo({behavior:"smooth",top:c.offsetTop-h.current-(((u=S.current)==null?void 0:u.clientHeight)||0)-100})},100);return}const l=document.getElementById(e);l&&window.scrollTo({behavior:"smooth",top:l.offsetTop-h.current-(((m=S.current)==null?void 0:m.clientHeight)||0)-100})},[pt,$]=i.useState(!1),at=()=>{$(e=>!e)},[dt,U]=i.useState(!1),ft=()=>{U(e=>!e)},q=i.useMemo(()=>D(t.coupon.coupons,w(e=>b().isBefore(e.dateInfo.issueEndYmdt)),w(e=>E?!!e.imageUrl:Ct),tt),[t.coupon.coupons,E]),F=i.useMemo(()=>t?D(t,Lt("section"),w(e=>e.label.trim()!==""),tt):[],[t]),ht=I==="61796",{data:L}=Rt(),K=qt.COMMENT,p=i.useMemo(()=>t.tag.split(",").map(e=>e.trim()).filter(e=>/^\d+$/.test(e)).map(Number),[t.tag]),a=i.useMemo(()=>f!=null&&f.boardConfigs?f.boardConfigs.find(e=>e.boardId===K):null,[f,K]),z=a!=null&&a.boardNo?a.boardNo.toString():"",{data:N}=At({boardNo:z,articleNo:Number(p??0),memberNo:L==null?void 0:L.memberNo,options:{enabled:Array.isArray(p)&&p.length!==0}}),gt=(a==null?void 0:a.replyUsed)===!0&&(p==null?void 0:p.length),xt=i.useMemo(()=>{const e=t.orders.indexOf("TOP"),s=t.orders.indexOf("COUPONS"),r=e!==-1?e+1:s!==-1?s:0;return[...t.orders.slice(0,r),"REPLY",...t.orders.slice(r)]},[t.orders]),bt=Y.startsWith("2099.12.31")?"상시":`${st} - ${Y} ${R>0?`D-${R}`:""}`;return o.jsxs(n.Container,{children:[o.jsxs(n.TitleBox,{children:[o.jsxs(n.TextBox,{children:[o.jsx(n.Title,{children:t.label||""}),o.jsx(n.SubTitle,{dangerouslySetInnerHTML:{__html:bt}})]}),!ht&&o.jsx(n.ShareButton,{onClick:at,children:o.jsx(Ht,{})})]}),o.jsx(n.ContentsBox,{ref:C,children:xt.map(e=>{if(e==="REPLY"&>)return o.jsx(Jt,{boardNo:z,articleNo:Number(p),categoryNo:(N==null?void 0:N.categoryNo)??void 0},"reply");if(e==="TOP")return o.jsxs(o.Fragment,{children:[o.jsxs(n.ImageSection,{children:[(t==null?void 0:t.top)&&(t==null?void 0:t.top.mobile.type)==="FILE"&&t.top.mobile.url&&o.jsx("img",{src:vt(t.top.mobile.url),alt:t.label}),(t==null?void 0:t.top)&&(t==null?void 0:t.top.mobile.type)==="HTML"&&t.top.mobile.url&&o.jsx("div",{dangerouslySetInnerHTML:{__html:it}})]},"TOP"),(t==null?void 0:t.top)&&(t==null?void 0:t.top.pc.type)==="HTML"&&t.top.pc.url&&o.jsx(n.VideoSection,{children:o.jsx("div",{dangerouslySetInnerHTML:{__html:t.top.pc.url}})})]});if(e==="COUPONS")return q.length>0&&o.jsx(n.CouponSection,{children:E?o.jsx(n.CouponList,{children:q.map(({couponNo:s,imageUrl:r,couponName:l})=>o.jsx(n.CouponListItem,{children:o.jsx("button",{onClick:()=>ct(s),children:o.jsx("img",{src:r,alt:l})})},s))}):o.jsxs(n.CouponDownloadButton,{onClick:ft,children:[o.jsx(kt,{}),o.jsx("span",{children:"쿠폰 받기"})]})},"COUPONS");if(e==="SECTIONS"){let s=0;return o.jsxs(n.ProductSection,{ref:A,children:[F.length>0&&o.jsx(n.TagList,{ref:S,$isSticky:ut,$headerHeight:h.current,$isApp:Vt,children:F.map(({label:r})=>o.jsx(n.TagListItem,{children:o.jsx(n.TagLabel,{$isActive:lt===r,onClick:()=>mt(r),children:r})},r))}),t.section.map((r,l)=>{if(s>=x)return null;const m=x-s,c=r.products.slice(0,m);return s+=c.length,c.length===0?null:o.jsxs(n.ProductListContainer,{id:r.label,ref:u=>{u&&(g.current[l]=u)},children:[o.jsx(n.ProductListTitleBox,{children:o.jsx(n.ProductListTitle,{children:r.label})}),o.jsx(n.ProductList,{children:c.map((u,d)=>o.jsx(n.ProductListItem,{children:o.jsx($t,{products:u,index:d})},u.productNo))})]},r.label)}),o.jsx("div",{ref:k,style:{height:"10px"}})]},"SECTIONS")}})}),o.jsx(Xt,{isVisible:pt,setIsVisible:$,isEventBoard:!1}),o.jsx(Zt,{isVisible:dt,setIsVisible:U,couponData:rt,eventNo:Number(I)})]})};export{ho as default};