import{r as C,J as B,I as z,j as n,g as r,Y as l,p as _,D as k,c as D,ad as S,F as E,Q as I,a1 as N,i as h,P as u,e as b,M as o,h as V}from"./vendor-vue-gvI8EVHg.js";import{b as y,h as x,S as F,a as M}from"./index-DCLQfd0E.js";import{u as O}from"./vendor-i18n-DnQQ95F5.js";/* empty css                                                                       */const R=["disabled","title"],U={class:"text-base"},$={class:"hidden sm:inline"},j={key:0,class:"absolute right-0 z-50 mt-1 w-32 overflow-hidden rounded-lg border border-gray-200 bg-white shadow-lg dark:border-dark-700 dark:bg-dark-800"},J=["disabled","onClick"],P={class:"text-base"},Q=C({__name:"LocaleSwitcher",setup(T){const{locale:m}=O(),e=u(!1),c=u(null),s=u(!1),i=b(()=>m.value),d=b(()=>x.find(a=>a.code===m.value));function w(){e.value=!e.value}async function L(a){if(s.value||a===i.value){e.value=!1;return}s.value=!0;try{await F(a),e.value=!1}finally{s.value=!1}}function f(a){c.value&&!c.value.contains(a.target)&&(e.value=!1)}return B(()=>{document.addEventListener("click",f)}),z(()=>{document.removeEventListener("click",f)}),(a,Y)=>{var p,v,g;return o(),n("div",{class:"relative",ref_key:"dropdownRef",ref:c},[r("button",{onClick:w,disabled:s.value,class:"flex items-center gap-1.5 rounded-lg px-2 py-1.5 text-sm font-medium text-gray-600 transition-colors hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-dark-700",title:(p=d.value)==null?void 0:p.name},[r("span",U,l((v=d.value)==null?void 0:v.flag),1),r("span",$,l((g=d.value)==null?void 0:g.code.toUpperCase()),1),_(y,{name:"chevronDown",size:"xs",class:k(["text-gray-400 transition-transform duration-200",{"rotate-180":e.value}])},null,8,["class"])],8,R),_(D,{name:"dropdown"},{default:S(()=>[e.value?(o(),n("div",j,[(o(!0),n(E,null,I(N(x),t=>(o(),n("button",{key:t.code,disabled:s.value,onClick:q=>L(t.code),class:k(["flex w-full items-center gap-2 px-3 py-2 text-sm text-gray-700 transition-colors hover:bg-gray-100 dark:text-gray-200 dark:hover:bg-dark-700",{"bg-primary-50 text-primary-600 dark:bg-primary-900/20 dark:text-primary-400":t.code===i.value}])},[r("span",P,l(t.flag),1),r("span",null,l(t.name),1),t.code===i.value?(o(),V(y,{key:0,name:"check",size:"sm",class:"ml-auto text-primary-500"})):h("",!0)],10,J))),128))])):h("",!0)]),_:1})],512)}}}),W=M(Q,[["__scopeId","data-v-62fd3b7c"]]);export{W as L};
