import{a as u,g as d,v as E}from"/build/_shared/chunk-SYLZIOTS.js";import{b,d as c}from"/build/_shared/chunk-G5WX4PPA.js";var k=b((me,U)=>{U.exports=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,r=[],a=0;a<e.rangeCount;a++)r.push(e.getRangeAt(a));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null;break}return e.removeAllRanges(),function(){e.type==="Caret"&&e.removeAllRanges(),e.rangeCount||r.forEach(function(n){e.addRange(n)}),t&&t.focus()}}});var I=b((de,W)=>{"use strict";var _=k(),P={"text/plain":"Text","text/html":"Url",default:"Text"},K="Copy to clipboard: #{key}, Enter";function X(e){var t=(/mac os x/i.test(navigator.userAgent)?"\u2318":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function $(e,t){var r,a,n,i,s,o,w=!1;t||(t={}),r=t.debug||!1;try{n=_(),i=document.createRange(),s=document.getSelection(),o=document.createElement("span"),o.textContent=e,o.ariaHidden="true",o.style.all="unset",o.style.position="fixed",o.style.top=0,o.style.clip="rect(0, 0, 0, 0)",o.style.whiteSpace="pre",o.style.webkitUserSelect="text",o.style.MozUserSelect="text",o.style.msUserSelect="text",o.style.userSelect="text",o.addEventListener("copy",function(f){if(f.stopPropagation(),t.format)if(f.preventDefault(),typeof f.clipboardData>"u"){r&&console.warn("unable to use e.clipboardData"),r&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var g=P[t.format]||P.default;window.clipboardData.setData(g,e)}else f.clipboardData.clearData(),f.clipboardData.setData(t.format,e);t.onCopy&&(f.preventDefault(),t.onCopy(f.clipboardData))}),document.body.appendChild(o),i.selectNodeContents(o),s.addRange(i);var N=document.execCommand("copy");if(!N)throw new Error("copy command was unsuccessful");w=!0}catch(f){r&&console.error("unable to copy using execCommand: ",f),r&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),w=!0}catch(g){r&&console.error("unable to copy using clipboardData: ",g),r&&console.error("falling back to prompt"),a=X("message"in t?t.message:K),window.prompt(a,e)}}finally{s&&(typeof s.removeRange=="function"?s.removeRange(i):s.removeAllRanges()),o&&document.body.removeChild(o),n()}return w}W.exports=$});var x=c(u(),1),V=()=>{let{revalidate:e}=d();(0,x.useEffect)(()=>(window.addEventListener("online",e),()=>{window.removeEventListener("online",e)}),[e])};var S=c(u(),1),q=()=>{let{revalidate:e}=d();(0,S.useEffect)(()=>(window.addEventListener("focus",e),()=>{window.removeEventListener("focus",e)}),[e]),(0,S.useEffect)(()=>{let t=()=>{document.visibilityState==="visible"&&e()};return window.addEventListener("visibilitychange",t),()=>{window.removeEventListener("visibilitychange",t)}},[e])};var A=c(u(),1);function h(e,...t){e&&e.addEventListener&&e.addEventListener(...t)}function C(e,...t){e&&e.removeEventListener&&e.removeEventListener(...t)}var p=typeof window<"u";var l=c(u(),1);var D=c(u(),1);var T=c(u(),1),R=e=>{(0,T.useEffect)(e,[])};var F=e=>{let t=(0,D.useRef)(e);t.current=e,R(()=>()=>t.current())};var L=e=>{let t=(0,l.useRef)(0),[r,a]=(0,l.useState)(e),n=(0,l.useCallback)(i=>{cancelAnimationFrame(t.current),t.current=requestAnimationFrame(()=>{a(i)})},[]);return F(()=>{cancelAnimationFrame(t.current)}),[r,n]};var B=(e=1/0,t=1/0)=>{let[r,a]=L({width:p?window.innerWidth:e,height:p?window.innerHeight:t});return(0,A.useEffect)(()=>{if(p){let n=()=>{a({width:window.innerWidth,height:window.innerHeight})};return h(window,"resize",n),()=>{C(window,"resize",n)}}},[]),r};var z=c(I(),1),H=c(u(),1);var m=c(u(),1),M=()=>{let e=(0,m.useRef)(!1),t=(0,m.useCallback)(()=>e.current,[]);return(0,m.useEffect)(()=>(e.current=!0,()=>{e.current=!1}),[]),t};var v=c(u(),1),O=(e={})=>{let[t,r]=(0,v.useState)(e),a=(0,v.useCallback)(n=>{r(i=>Object.assign({},i,n instanceof Function?n(i):n))},[]);return[t,a]};var G=()=>{let e=M(),[t,r]=O({value:void 0,error:void 0,noUserInteraction:!0}),a=(0,H.useCallback)(n=>{if(!e())return;let i,s;try{if(typeof n!="string"&&typeof n!="number"){let o=new Error(`Cannot copy typeof ${typeof n} to clipboard, must be a string`);r({value:n,error:o,noUserInteraction:!0});return}else if(n===""){let o=new Error("Cannot copy empty string to clipboard.");r({value:n,error:o,noUserInteraction:!0});return}s=n.toString(),i=(0,z.default)(s),r({value:s,error:void 0,noUserInteraction:i})}catch(o){r({value:s,error:o,noUserInteraction:i})}},[]);return[t,a]};var y=c(u(),1);function J(e){let t=E(e),[r,a]=(0,y.useState)(t.data);return(0,y.useEffect)(()=>{t.state==="idle"&&a(t.data)},[t.state,t.data]),{...t,data:r,reset:()=>a(void 0)}}export{G as a,J as b,V as c,q as d,B as e};
