import{g as o}from"./useEventListener-C0195JsF.js";async function r(t,a){if(navigator.clipboard===void 0){o.warn("navigator.clipboard is not supported"),window.prompt("Copy to clipboard: Ctrl+C, Enter",t);return}if(a&&navigator.clipboard.write)try{let i=new ClipboardItem({"text/html":new Blob([a],{type:"text/html"}),"text/plain":new Blob([t],{type:"text/plain"})});await navigator.clipboard.write([i]);return}catch{o.warn("Failed to write rich text, falling back to plain text")}await navigator.clipboard.writeText(t).catch(()=>{o.warn("Failed to copy to clipboard using navigator.clipboard"),window.prompt("Copy to clipboard: Ctrl+C, Enter",t)})}function e(){let t=navigator.userAgent;return/safari/i.test(t)&&!/chrome|chromium|crios|fxios|edgios|opios/i.test(t)}async function n(t){let a;if(e())a=new ClipboardItem({"image/png":fetch(t).then(i=>i.blob())});else{let i=await(await fetch(t)).blob();a=new ClipboardItem({[i.type]:i})}await navigator.clipboard.write([a])}export{r as n,n as t};
