import{t as p}from"./toggle-selection-93f4ad84.js";var C=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function y(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var m=p,f={"text/plain":"Text","text/html":"Url",default:"Text"},g="Copy to clipboard: #{key}, Enter";function b(a){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return a.replace(/#{\s*key\s*}/g,t)}function w(a,t){var r,d,i,n,l,e,c=!1;t||(t={}),r=t.debug||!1;try{i=m(),n=document.createRange(),l=document.getSelection(),e=document.createElement("span"),e.textContent=a,e.ariaHidden="true",e.style.all="unset",e.style.position="fixed",e.style.top=0,e.style.clip="rect(0, 0, 0, 0)",e.style.whiteSpace="pre",e.style.webkitUserSelect="text",e.style.MozUserSelect="text",e.style.msUserSelect="text",e.style.userSelect="text",e.addEventListener("copy",function(o){if(o.stopPropagation(),t.format)if(o.preventDefault(),typeof o.clipboardData>"u"){r&&console.warn("unable to use e.clipboardData"),r&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var s=f[t.format]||f.default;window.clipboardData.setData(s,a)}else o.clipboardData.clearData(),o.clipboardData.setData(t.format,a);t.onCopy&&(o.preventDefault(),t.onCopy(o.clipboardData))}),document.body.appendChild(e),n.selectNodeContents(e),l.addRange(n);var u=document.execCommand("copy");if(!u)throw new Error("copy command was unsuccessful");c=!0}catch(o){r&&console.error("unable to copy using execCommand: ",o),r&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",a),t.onCopy&&t.onCopy(window.clipboardData),c=!0}catch(s){r&&console.error("unable to copy using clipboardData: ",s),r&&console.error("falling back to prompt"),d=b("message"in t?t.message:g),window.prompt(d,a)}}finally{l&&(typeof l.removeRange=="function"?l.removeRange(n):l.removeAllRanges()),e&&document.body.removeChild(e),i()}return c}var v=w;const h=y(v);export{h as a,C as c};