import{X as n,I as s}from"./index-DCLQfd0E.js";import{P as l}from"./vendor-vue-gvI8EVHg.js";const{t:a}=s.global;function p(){return!!(navigator.clipboard&&window.isSecureContext)}function c(t){const e=document.createElement("textarea");e.value=t,e.style.cssText="position:fixed;left:-9999px;top:-9999px",document.body.appendChild(e),e.select();try{return document.execCommand("copy")}finally{document.body.removeChild(e)}}function m(){const t=n(),e=l(!1);return{copied:e,copyToClipboard:async(r,i)=>{if(!r)return!1;let o=!1;if(p())try{await navigator.clipboard.writeText(r),o=!0}catch{o=c(r)}else o=c(r);return o?(e.value=!0,t.showSuccess(i||a("common.copiedToClipboard")),setTimeout(()=>{e.value=!1},2e3)):t.showError(a("common.copyFailed")),o}}}export{m as u};
