import{bD as E,r as C}from"./main-D6SjkSWq.js";var m,v;function x(){return v||(v=1,m=function(){var a=document.getSelection();if(!a.rangeCount)return function(){};for(var r=document.activeElement,c=[],l=0;l<a.rangeCount;l++)c.push(a.getRangeAt(l));switch(r.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":r.blur();break;default:r=null;break}return a.removeAllRanges(),function(){a.type==="Caret"&&a.removeAllRanges(),a.rangeCount||c.forEach(function(s){a.addRange(s)}),r&&r.focus()}}),m}var g,D;function T(){if(D)return g;D=1;var a=x(),r={"text/plain":"Text","text/html":"Url",default:"Text"},c="Copy to clipboard: #{key}, Enter";function l(o){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return o.replace(/#{\s*key\s*}/g,t)}function s(o,t){var i,y,b,d,u,e,f=!1;t||(t={}),i=t.debug||!1;try{b=a(),d=document.createRange(),u=document.getSelection(),e=document.createElement("span"),e.textContent=o,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(n){if(n.stopPropagation(),t.format)if(n.preventDefault(),typeof n.clipboardData>"u"){i&&console.warn("unable to use e.clipboardData"),i&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var p=r[t.format]||r.default;window.clipboardData.setData(p,o)}else n.clipboardData.clearData(),n.clipboardData.setData(t.format,o);t.onCopy&&(n.preventDefault(),t.onCopy(n.clipboardData))}),document.body.appendChild(e),d.selectNodeContents(e),u.addRange(d);var w=document.execCommand("copy");if(!w)throw new Error("copy command was unsuccessful");f=!0}catch(n){i&&console.error("unable to copy using execCommand: ",n),i&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",o),t.onCopy&&t.onCopy(window.clipboardData),f=!0}catch(p){i&&console.error("unable to copy using clipboardData: ",p),i&&console.error("falling back to prompt"),y=l("message"in t?t.message:c),window.prompt(y,o)}}finally{u&&(typeof u.removeRange=="function"?u.removeRange(d):u.removeAllRanges()),e&&document.body.removeChild(e),b()}return f}return g=s,g}var h=T();const R=E(h);function k(a,r){const[c,l]=C.useState(!1),s=(r==null?void 0:r.successDuration)??2e3;return C.useEffect(()=>{if(c&&s){const o=setTimeout(()=>{l(!1)},s);return()=>{clearTimeout(o)}}},[c,s]),[c,()=>{const o=R(a);l(o)}]}export{k as u};
