import{u as F,Q as f,ay as k,W as b,j as e,c as h,k as u,a5 as v,R as B,a7 as g,T as d,a8 as p,a as T,az as w,aA as A,aB as N,aC as m,aD as l,aE as I,b as y,aF as P,V as R,w as q,n as Q,Z as W,a6 as E,G as x,aq as M,a0 as G}from"../index.Crez7j-Y.bundle.js";import{B as L}from"./BoardAPIs.CPUVoL2H.bundle.js";import{u as S}from"./useFetchFaqList.BTWKzy9v.bundle.js";import{E as C}from"./EmptyContent.BRQ9JwMr.bundle.js";const _=t=>{const{getBoardCategoryListAPI:a}=L();return F({queryKey:f.faqCategoryList(),queryFn:()=>a(k.enum.faq),...t})};function $({categoryList:t}){var i;const[a,r]=b(),s=Number((i=a.get("categoryNo"))!=null?i:0),n=(o,j)=>{const c=new URLSearchParams;j?(c.set("categoryNo","".concat(j)),c.set("pageNumber","1")):c.delete("categoryNo"),r(c)};return e.jsx(h,{borderBottom:"1px solid ".concat(u),children:e.jsxs(v,{value:s,onChange:n,sx:{"& .MuiTabs-indicator":{backgroundColor:B}},children:[e.jsx(g,{label:e.jsx(d,{variant:"subtitle1",children:"전체"}),value:void 0,sx:{px:0,width:"25%","&.Mui-selected":{color:p}}}),t.map(o=>e.jsx(g,{sx:{px:0,width:"25%","&.Mui-selected":{color:p}},label:e.jsx(d,{variant:"subtitle1",children:o.label}),value:o.categoryNo},o.categoryNo))]})})}function D({faqList:t,isPending:a}){const{isDesktop:r,isMobile:s}=T();return e.jsxs(e.Fragment,{children:[r&&e.jsx(U,{faqList:t,isPending:a}),s&&e.jsx(z,{faqList:t,isPending:a})]})}function U(t){const{faqList:a,isPending:r}=t;return e.jsx(h,{id:"faq-content-wrapper",mt:"1px solid ".concat(u),my:3,children:e.jsxs(w,{size:"small",sx:{"& th":{backgroundColor:A}},children:[e.jsx(N,{children:e.jsxs(m,{children:[e.jsx(l,{align:"center",width:70,children:e.jsx(d,{variant:"body",fontWeight:500,children:"번호"})}),e.jsx(l,{align:"center",width:100,children:e.jsx(d,{variant:"body",fontWeight:500,children:"분류"})}),e.jsx(l,{align:"center",width:830,children:e.jsx(d,{variant:"body",fontWeight:500,children:"내용"})})]})}),e.jsxs(I,{children:[r&&Array.from({length:5}).map((s,n)=>e.jsx(m,{children:Array.from({length:3}).map((i,o)=>e.jsx(l,{children:e.jsx(y,{variant:"rectangular"})},o))},n)),a&&a.items.length===0&&e.jsx(m,{children:e.jsx(l,{colSpan:3,children:e.jsx(C,{height:"40dvh",text:"조회된 FAQ가 없습니다."})})}),a==null?void 0:a.items.map((s,n,i)=>e.jsx(P,{faq:s,index:i.length-n},s.articleNo))]})]})})}function z(t){const{faqList:a,isPending:r}=t;return e.jsxs(R,{disablePadding:!0,children:[r&&e.jsx(e.Fragment,{children:Array.from({length:5}).map((s,n)=>e.jsx(q,{sx:{py:1,borderBottom:"1px solid ".concat(u)},children:e.jsx(y,{variant:"rounded",width:"100%",height:40})},n))}),a&&a.items.length===0&&e.jsx(h,{children:e.jsx(C,{text:"조회된 FAQ가 없습니다."})}),a==null?void 0:a.items.map((s,n)=>e.jsx(P,{faq:s,index:n+1},s.articleNo))]})}function J(){const[t]=b(),{data:a,isPending:r}=S(t),{data:s}=_();return e.jsx(h,{component:"main",bgcolor:Q,py:{desktop:8,mobile:0},children:e.jsxs(W,{bgcolor:E,borderRadius:2,p:{desktop:4,mobile:0},gap:2,children:[e.jsx(x,{item:!0,desktop:12,mobile:12,children:e.jsx(M,{title:"FAQ"})}),e.jsx(x,{item:!0,desktop:12,mobile:12,children:s&&e.jsx($,{categoryList:s})}),e.jsx(x,{item:!0,desktop:12,mobile:11,mx:"auto",children:e.jsx(D,{faqList:a,isPending:r})}),e.jsx(x,{item:!0,desktop:12,mobile:11,mx:"auto",children:e.jsx(G,{itemTotalCount:a==null?void 0:a.totalCount})})]})})}export{J as default};