import{R as b,j as c,b as j,r as m,L as C}from"./vendor-react-C630P38J.js";import{q as P,p as T,t as B,m as R,d as E}from"./vendor-fxts-IS4CCBC4.js";import{S as M,b as N}from"./vendor-swiper-CwUwDtZu.js";import{a1 as _,c as y,a2 as v}from"./feature-order-C2we0F5o.js";import{f as q}from"./vendor-query-BjC2S-sR.js";import{c as A,g as $,a as D}from"./index-nim7WYfB.js";const O=({categoryNo:r,searchParams:a,options:o})=>q({queryKey:_.detail(r,a),queryFn:async()=>{const{data:n}=await A.getCategory(r,a);return n},...o});var U="fcvhf00",S="fcvhf01",w="fcvhf02",x="fcvhf03",L="fcvhf04";const F=({categoryNo:r,selectedCategoryNo:a,isAllButtonVisible:o,onClickCategory:n})=>{const e=r||$(),[f]=j(),{data:d=[]}=O({categoryNo:Number(e)||0,options:{select:t=>{var s,g;return((g=(s=D(e??"",t.multiLevelCategories).find(l=>l.categoryNo===Number(e)))==null?void 0:s.children)==null?void 0:g.map(l=>({categoryNo:l.categoryNo,label:l.label})))??[]}}}),u=m.useMemo(()=>({slidesPerView:"auto",spaceBetween:10,watchOverflow:!0}),[]),i=()=>{const t=new URLSearchParams(f);return t.delete("selectedCategoryNo"),t.delete("pageNumber"),{pathname:`/categories/${e}`,search:t.toString()}},h=t=>{const s=new URLSearchParams(f);return s.delete("selectedCategoryNo"),s.delete("pageNumber"),{pathname:`/categories/${t}`,search:s.toString()}};return P(d)?null:c.jsxs(M,{className:U,...u,children:[o&&c.jsx(N,{className:S,children:c.jsx(C,{className:y(v,w,a?L:x),to:i(),onClick:t=>{n&&(t.preventDefault(),n==null||n())},style:{textDecoration:"none"},children:"ALL"})}),d.map(t=>c.jsx(N,{className:S,children:c.jsx(C,{className:y(v,w,a===t.categoryNo?x:L),to:h(t.categoryNo),onClick:s=>{n&&(s.preventDefault(),n==null||n(t.categoryNo))},style:{textDecoration:"none"},children:t.label})},t.categoryNo))]})},K=({categoryNo:r,isAllButtonVisible:a=!0,selectedCategoryNo:o,onClickCategory:n})=>c.jsx(F,{categoryNo:r,selectedCategoryNo:o,isAllButtonVisible:a,onClickCategory:n}),X=b.memo(K);var G="_1k3go3u0",H="_1k3go3u1";const p="


",I=({categoryData:r})=>{const a=m.useMemo(()=>T(r,E("flatCategories"),R(e=>({...e,depth1Content:e.depth1Content===p?"":e.depth1Content,depth2Content:e.depth2Content===p?"":e.depth2Content,depth3Content:e.depth3Content===p?"":e.depth3Content,depth4Content:e.depth4Content===p?"":e.depth4Content,depth5Content:e.depth5Content===p?"":e.depth5Content})),B),[r]),o=m.useMemo(()=>{function e(d,u,i){var h;for(const t of d){if(t.categoryNo===u)return i;if((h=t.children)!=null&&h.length){const s=e(t.children,u,i+1);if(s)return s}}return 0}return e(r.multiLevelCategories,r.requestedCategoryNo,1)},[r.multiLevelCategories,r.requestedCategoryNo]),n=m.useMemo(()=>{const e=a[0];return e?o===1?e.depth1Content:o===2?e.depth2Content||e.depth1Content:o===3?e.depth3Content||e.depth2Content||e.depth1Content:o===4?e.depth4Content||e.depth3Content||e.depth2Content||e.depth1Content:o===5?e.depth5Content||e.depth4Content||e.depth3Content||e.depth2Content||e.depth1Content:"":""},[a,o]);return!n||n===p?null:c.jsx("section",{className:G,children:c.jsx("div",{className:H,dangerouslySetInnerHTML:{__html:n}})})},Z=b.memo(I);export{X as C,Z as P,O as u};