import{s as e,k as t,l as n,g as o,o as a,w as i,c as l,p as u,q as r,u as c,v,t as s}from"./vendor-BXdGExd0.js";function d(e,t){return!!o()&&(a(e,t),!0)}const p="undefined"!=typeof window&&"undefined"!=typeof document;"undefined"!=typeof WorkerGlobalScope&&(globalThis,WorkerGlobalScope);const f=Object.prototype.toString;function m(e){return Array.isArray(e)?e:[e]}const y=p?window:void 0,g=p?window.navigator:void 0;function b(...e){const t=[],o=()=>{t.forEach(e=>e()),t.length=0},a=l(()=>{const t=m(n(e[0])).filter(e=>null!=e);return t.every(e=>"string"!=typeof e)?t:void 0}),u=(r=([e,n,a,i])=>{if(o(),!(null==e?void 0:e.length)||!(null==n?void 0:n.length)||!(null==a?void 0:a.length))return;const l=(u=i,"[object Object]"===f.call(u)?{...i}:i);var u;t.push(...e.flatMap(e=>n.flatMap(t=>a.map(n=>((e,t,n,o)=>(e.addEventListener(t,n,o),()=>e.removeEventListener(t,n,o)))(e,t,n,l)))))},c={flush:"post"},i(()=>{var t,o;return[null!==(t=null===(o=a.value)||void 0===o?void 0:o.map(e=>function(e){var t;const o=n(e);return null!==(t=null==o?void 0:o.$el)&&void 0!==t?t:o}(e)))&&void 0!==t?t:[y].filter(e=>null!=e),m(n(a.value?e[1]:e[0])),m(v(a.value?e[2]:e[1])),n(a.value?e[3]:e[2])]},r,{...c,immediate:!0}));var r,c;return d(o),()=>{u(),o()}}function h(){const t=e(!1),n=c();return n&&r(()=>{t.value=!0},n),t}function w(e){const t=h();return l(()=>(t.value,Boolean(e())))}function S(t,n={}){const{controls:o=!1,navigator:a=g}=n,i=w(()=>a&&"permissions"in a),l=e(),u="string"==typeof t?{name:t}:t,r=e(),c=()=>{var e,t;r.value=null!==(e=null===(t=l.value)||void 0===t?void 0:t.state)&&void 0!==e?e:"prompt"};b(l,"change",c,{passive:!0});const v=function(e){let t;function n(){return t||(t=e()),t}return n.reset=async()=>{const e=t;t=void 0,e&&await e},n}(async()=>{if(i.value){if(!l.value)try{l.value=await a.permissions.query(u)}catch(e){l.value=void 0}finally{c()}return o?s(l.value):void 0}});return v(),o?{state:r,isSupported:i,query:v}:r}function x(o={}){const{navigator:a=g,read:i=!1,source:r,copiedDuring:c=1500,legacy:v=!1}=o,s=w(()=>a&&"clipboard"in a),f=S("clipboard-read"),m=S("clipboard-write"),y=l(()=>s.value||v),h=e(""),x=e(!1),T=function(o,a,i={}){const{immediate:l=!0,immediateCallback:u=!1}=i,r=e(!1);let c;function v(){c&&(clearTimeout(c),c=void 0)}function s(){r.value=!1,v()}function f(...e){u&&o(),v(),r.value=!0,c=setTimeout(()=>{r.value=!1,c=void 0,o(...e)},n(a))}return l&&(r.value=!0,p&&f()),d(s),{isPending:t(r),start:f,stop:s}}(()=>x.value=!1,c,{immediate:!1});function j(e){return"granted"===e||"prompt"===e}return y.value&&i&&b(["copy","cut"],async function(){let e=!(s.value&&j(f.value));if(!e)try{h.value=await a.clipboard.readText()}catch(i){e=!0}var t,n,o;e&&(h.value=null!==(t=null===(n=document)||void 0===n||null===(o=n.getSelection)||void 0===o||null===(o=o.call(n))||void 0===o?void 0:o.toString())&&void 0!==t?t:"")},{passive:!0}),{isSupported:y,text:u(h),copied:u(x),copy:async function(e=n(r)){if(y.value&&null!=e){let n=!(s.value&&j(m.value));if(!n)try{await a.clipboard.writeText(e)}catch(t){n=!0}n&&function(e){const t=document.createElement("textarea");t.value=e,t.style.position="absolute",t.style.opacity="0",document.body.appendChild(t),t.select(),document.execCommand("copy"),t.remove()}(e),h.value=e,x.value=!0,T.start()}}}}export{x as u};
