import{j as s,r as o}from"./vendor-react-C630P38J.js";import{P as _}from"./vendor-overlay-B61Jbn6n.js";import{S as B,b as M}from"./vendor-swiper-CwUwDtZu.js";import{aJ as O,aU as P,u as T,c as u,ac as h,aV as k,aW as N,aX as C,aY as L,aZ as A,a_ as U,a$ as g,b0 as V,b1 as W,b2 as Y,b3 as z,b4 as q,F,q as J,b5 as K,b6 as Q,b7 as X,b8 as Z}from"./feature-order-C2we0F5o.js";import"./vendor-utils-Cb1MAKRV.js";var $="jwn7fs0",y={selected:"jwn7fs2 jwn7fs1",default:"jwn7fs3 jwn7fs1"},G="jwn7fs4";const H=({ariaLabel:n,close:m,onChange:d,options:t,selectedOption:i,...c})=>s.jsx(O,{...c,close:m,children:s.jsx("ul",{className:$,"aria-label":n,children:t.map(r=>{const a=(i==null?void 0:i.id)===r.id;return s.jsx("li",{className:a?y.selected:y.default,children:s.jsxs("button",{type:"button",onClick:()=>{d(r),m()},children:[a&&s.jsx(P,{"aria-hidden":!0,className:G}),r.name]})},r.id)})})}),ie=({ariaLabel:n,desktopVariant:m,onChange:d,options:t,selectedOption:i,type:c})=>{var E;const{isMobile:r}=T(),a=o.useMemo(()=>c==="state"?t.find(e=>e.isSelected):i,[t,i,c]),j=(a==null?void 0:a.name)??(c==="query"?(E=t[0])==null?void 0:E.name:"")??"",[f,S]=o.useState(!1),[l,p]=o.useState(!1),[D,v]=o.useState(!1),x=o.useRef(null);o.useEffect(()=>{const e=w=>{x.current&&!x.current.contains(w.target)&&p(!1)};return l&&document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[l]);const R=()=>{S(!0),_.open(e=>s.jsx(H,{...e,close:()=>{S(!1),e.close()},unmount:()=>{S(!1),e.unmount()},options:t,selectedOption:a,onChange:d,ariaLabel:n}),{overlayId:Z.QUERY_SELECTOR})},b=e=>{const w=e.allowSlideNext&&!e.isEnd;v(w)},I={slidesPerView:"auto",spaceBetween:15,touchMoveStopPropagation:!0,onSwiper:b,onSlideChange:b,onResize:b};return r?s.jsxs("button",{className:u(N,f&&k),type:"button","aria-label":n,"aria-expanded":f,onClick:R,children:[s.jsx(h,{"aria-hidden":!0,size:20}),j]}):m==="expanded"?s.jsx("div",{className:C,role:"group","aria-label":n,children:s.jsxs("div",{className:L,children:[s.jsx(B,{className:A,...I,children:t.map(e=>s.jsx(M,{className:U,children:s.jsx("button",{className:u(N,(a==null?void 0:a.id)===e.id&&g),type:"button",onClick:()=>d(e),children:e.name})},e.id))}),D&&s.jsx("div",{className:V})]})}):s.jsx("div",{className:C,children:s.jsxs("div",{className:W,ref:x,children:[s.jsxs("button",{className:u(q,l&&z),type:"button","aria-label":n,"aria-expanded":l,onClick:()=>p(e=>!e),children:[j,s.jsx("span",{className:Y,children:s.jsx(h,{"aria-hidden":!0})})]}),s.jsx(F,{children:l&&s.jsx(J.div,{className:K,initial:{opacity:0,y:-6,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-6,scale:.97},transition:{duration:.18,ease:[.16,1,.3,1]},children:t.map(e=>s.jsx("button",{className:u(X,(a==null?void 0:a.id)===e.id&&Q),type:"button",onClick:()=>{d(e),p(!1)},children:e.name},e.id))})})]})})},re=[{id:"newest",name:"신상품순",by:"RECENT_PRODUCT",direction:"DESC"},{id:"recommend",name:"추천순",by:"MD_RECOMMEND",direction:"DESC"},{id:"price_low",name:"낮은가격순",by:"DISCOUNTED_PRICE",direction:"ASC"},{id:"price_high",name:"높은가격순",by:"DISCOUNTED_PRICE",direction:"DESC"},{id:"like_count",name:"좋아요순",by:"LIKE_CNT",direction:"DESC"},{id:"sale_count",name:"총판매량순",by:"SALE_CNT",direction:"DESC"},{id:"popular",name:"판매인기순",by:"POPULAR",direction:"DESC"},{id:"review",name:"후기순",by:"REVIEW",direction:"DESC"}];export{re as S,ie as a};