Files
cloud-mail/mail-worker/dist/assets/clipboard-utils-CzPXxZBC.js

2 lines
696 B
JavaScript

async function d(o){const a=o==null?"":String(o);return typeof navigator<"u"&&typeof navigator.clipboard?.writeText=="function"?await navigator.clipboard.writeText(a):new Promise((c,n)=>{try{const t=document.createElement("textarea");t.value=a,t.setAttribute("readonly","");const e=t.style;e.position="fixed",e.top="0",e.left="0",e.width="1px",e.height="1px",e.padding="0",e.border="0",e.outline="none",e.boxShadow="none",e.background="transparent",e.opacity="0",document.body.appendChild(t),t.focus(),t.select();let r=!1;try{r=document.execCommand("copy")}catch(i){return n(i)}finally{document.body.removeChild(t)}r?c():n(new Error("Copy command unsuccessful"))}catch(t){n(t)}})}export{d as c};