// @bun
var{defineProperty:x,getOwnPropertyNames:F,getOwnPropertyDescriptor:G}=Object,H=Object.prototype.hasOwnProperty;function I(j){return this[j]}var L=(j)=>{var k=(E??=new WeakMap).get(j),q;if(k)return k;if(k=x({},"__esModule",{value:!0}),j&&typeof j==="object"||typeof j==="function"){for(var w of F(j))if(!H.call(k,w))x(k,w,{get:I.bind(j,w),enumerable:!(q=G(j,w))||q.enumerable})}return E.set(j,k),k},E;var J=(j)=>j;function K(j,k){this[j]=J.bind(null,k)}var M=(j,k)=>{for(var q in k)x(j,q,{get:k[q],enumerable:!0,configurable:!0,set:K.bind(k,q)})};var N=(j,k)=>()=>(j&&(k=j(j=0)),k);var P=import.meta.require;function R(j,k,q){if(typeof window>"u")return{remove:()=>{}};let w=window;if(q?.target)if(typeof q.target==="string"){let C=document.querySelector(q.target);if(!C)return console.warn(`[stx] useEventListener: selector "${q.target}" did not match any element. Listener not attached.`),{remove:()=>{}};w=C}else w=q.target;let z={capture:q?.capture,passive:q?.passive,once:q?.once};w.addEventListener(j,k,z);let B=()=>{w.removeEventListener(j,k,z)};if(typeof globalThis.onDestroy==="function")globalThis.onDestroy(B);return{remove:B}}export{R as useEventListener};
