import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{r as t,t as n}from"./react-vendor-CTSggWdF.js";var r=e(t(),1),i=n();function a({text:e,className:t=``}){let[n,a]=(0,r.useState)(!1);return(0,i.jsx)(`button`,{onClick:async t=>{t.stopPropagation(),await navigator.clipboard.writeText(e),a(!0),setTimeout(()=>a(!1),2e3)},className:`absolute right-3 top-3 px-3 py-1.5 text-xs font-medium 
                 text-stone-600 hover:text-stone-900 bg-white hover:bg-stone-50 
                 rounded border border-stone-300 hover:border-stone-400 transition-colors shadow-sm
                 opacity-0 group-hover:opacity-100 ${t}`,children:n?`Copied!`:`Copy`})}function o({lang:e,onChange:t,className:n=``}){let[a,o]=(0,r.useState)(!1);return(0,i.jsxs)(`div`,{className:`relative ${n}`,children:[(0,i.jsxs)(`button`,{onClick:()=>o(!a),onBlur:()=>setTimeout(()=>o(!1),150),className:`text-stone-500 hover:text-stone-900 transition-colors text-sm flex items-center gap-0.5 whitespace-nowrap`,children:[e===`en`?`EN`:`中文`,(0,i.jsx)(`svg`,{className:`w-3 h-3 ml-0.5 transition-transform ${a?`rotate-180`:``}`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,strokeWidth:2,children:(0,i.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M19 9l-7 7-7-7`})})]}),a&&(0,i.jsxs)(`div`,{className:`absolute top-full left-0 mt-1 bg-white rounded shadow-lg py-1 z-50 min-w-[60px]`,children:[(0,i.jsx)(`button`,{onClick:()=>{t(`en`),o(!1)},className:`block w-full text-left px-3 py-1.5 text-sm hover:bg-stone-50 whitespace-nowrap ${e===`en`?`text-stone-900 font-medium`:`text-stone-500`}`,children:`EN`}),(0,i.jsx)(`button`,{onClick:()=>{t(`zh`),o(!1)},className:`block w-full text-left px-3 py-1.5 text-sm hover:bg-stone-50 whitespace-nowrap ${e===`zh`?`text-stone-900 font-medium`:`text-stone-500`}`,children:`中文`})]})]})}export{a as n,o as t};