import{r as S,$ as j,ah as P,ai as q,u as F,m as E,G as A,H as G,a1 as M,q as J}from"./app-a39c937f.js";function V(e){return P()?(q(e),!0):!1}function _(e){return typeof e=="function"?e():F(e)}const T=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const L=e=>typeof e<"u",D=Object.prototype.toString,R=e=>D.call(e)==="[object Object]",B=()=>{};function H(e){let t;function n(){return t||(t=e()),t}return n.reset=async()=>{const r=t;t=void 0,r&&await r},n}function I(e,t,n={}){const{immediate:r=!0}=n,a=S(!1);let o=null;function f(){o&&(clearTimeout(o),o=null)}function c(){a.value=!1,f()}function m(...d){f(),a.value=!0,o=setTimeout(()=>{a.value=!1,o=null,e(...d)},_(t))}return r&&(a.value=!0,T&&m()),V(c),{isPending:j(a),start:m,stop:c}}function U(e){var t;const n=_(e);return(t=n==null?void 0:n.$el)!=null?t:n}const z=T?window:void 0,N=T?window.navigator:void 0;function W(...e){let t,n,r,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([n,r,a]=e,t=z):[t,n,r,a]=e,!t)return B;Array.isArray(n)||(n=[n]),Array.isArray(r)||(r=[r]);const o=[],f=()=>{o.forEach(s=>s()),o.length=0},c=(s,p,v,l)=>(s.addEventListener(p,v,l),()=>s.removeEventListener(p,v,l)),m=A(()=>[U(t),_(a)],([s,p])=>{if(f(),!s)return;const v=R(p)?{...p}:p;o.push(...n.flatMap(l=>r.map(y=>c(s,l,y,v))))},{immediate:!0,flush:"post"}),d=()=>{m(),f()};return V(d),d}function K(){const e=S(!1),t=M();return t&&J(()=>{e.value=!0},t),e}function $(e){const t=K();return E(()=>(t.value,!!e()))}function O(e,t={}){const{controls:n=!1,navigator:r=N}=t,a=$(()=>r&&"permissions"in r);let o;const f=typeof e=="string"?{name:e}:e,c=S(),m=()=>{o&&(c.value=o.state)},d=H(async()=>{if(a.value){if(!o)try{o=await r.permissions.query(f),W(o,"change",m),m()}catch{c.value="prompt"}return o}});return d(),n?{state:c,isSupported:a,query:d}:c}function Y(e={}){const{navigator:t=N,read:n=!1,source:r,copiedDuring:a=1500,legacy:o=!1}=e,f=$(()=>t&&"clipboard"in t),c=O("clipboard-read"),m=O("clipboard-write"),d=E(()=>f.value||o),s=S(""),p=S(!1),v=I(()=>p.value=!1,a);function l(){f.value&&w(c.value)?t.clipboard.readText().then(u=>{s.value=u}):s.value=h()}d.value&&n&&W(["copy","cut"],l);async function y(u=_(r)){d.value&&u!=null&&(f.value&&w(m.value)?await t.clipboard.writeText(u):g(u),s.value=u,p.value=!0,v.start())}function g(u){const i=document.createElement("textarea");i.value=u??"",i.style.position="absolute",i.style.opacity="0",document.body.appendChild(i),i.select(),document.execCommand("copy"),i.remove()}function h(){var u,i,b;return(b=(i=(u=document==null?void 0:document.getSelection)==null?void 0:u.call(document))==null?void 0:i.toString())!=null?b:""}function w(u){return u==="granted"||u==="prompt"}return{isSupported:d,text:s,copied:p,copy:y}}function Q(e){return JSON.parse(JSON.stringify(e))}function Z(e,t,n,r={}){var a,o,f;const{clone:c=!1,passive:m=!1,eventName:d,deep:s=!1,defaultValue:p,shouldEmit:v}=r,l=M(),y=n||(l==null?void 0:l.emit)||((a=l==null?void 0:l.$emit)==null?void 0:a.bind(l))||((f=(o=l==null?void 0:l.proxy)==null?void 0:o.$emit)==null?void 0:f.bind(l==null?void 0:l.proxy));let g=d;t||(t="modelValue"),g=g||`update:${t.toString()}`;const h=i=>c?typeof c=="function"?c(i):Q(i):i,w=()=>L(e[t])?h(e[t]):p,u=i=>{v?v(i)&&y(g,i):y(g,i)};if(m){const i=w(),b=S(i);let x=!1;return A(()=>e[t],C=>{x||(x=!0,b.value=h(C),G(()=>x=!1))}),A(b,C=>{!x&&(C!==e[t]||s)&&u(C)},{deep:s}),b}else return E({get(){return w()},set(i){u(i)}})}export{Y as a,Z as u};
