// @bun
var{defineProperty:B,getOwnPropertyNames:G,getOwnPropertyDescriptor:H}=Object,J=Object.prototype.hasOwnProperty;function K(d){return this[d]}var Q=(d)=>{var h=(D??=new WeakMap).get(d),q;if(h)return h;if(h=B({},"__esModule",{value:!0}),d&&typeof d==="object"||typeof d==="function"){for(var x of G(d))if(!J.call(h,x))B(h,x,{get:K.bind(d,x),enumerable:!(q=H(d,x))||q.enumerable})}return D.set(d,h),h},D;var L=(d)=>d;function M(d,h){this[d]=L.bind(null,h)}var R=(d,h)=>{for(var q in h)B(d,q,{get:h[q],enumerable:!0,configurable:!0,set:M.bind(h,q)})};var U=(d,h)=>()=>(d&&(h=d(d=0)),h);var V=import.meta.require;function O(){let d=new Set,h=typeof window<"u",q=()=>{if(!h)return null;return navigator.connection||null},x=()=>{if(!h)return{isOnline:!0,isOffline:!1,type:null,effectiveType:null,downlink:null,rtt:null,saveData:!1};let j=q();return{isOnline:navigator.onLine,isOffline:!navigator.onLine,type:j?.type||null,effectiveType:j?.effectiveType||null,downlink:j?.downlink||null,rtt:j?.rtt||null,saveData:j?.saveData||!1}},v=x(),z=()=>{let j=x();v=j;for(let E of d)try{E(j)}catch(F){console.error("[useNetwork] Subscriber error:",F)}};if(h){window.addEventListener("online",z),window.addEventListener("offline",z);let j=q();if(j)j.addEventListener("change",z)}return{get isOnline(){return v.isOnline},get isOffline(){return v.isOffline},get type(){return v.type},get effectiveType(){return v.effectiveType},get downlink(){return v.downlink},get rtt(){return v.rtt},get saveData(){return v.saveData},subscribe:(j)=>{return d.add(j),j(v),()=>d.delete(j)}}}function X(){let d=O();return{get isOnline(){return d.isOnline},subscribe:(h)=>{return d.subscribe((q)=>h(q.isOnline))}}}export{X as useOnline,O as useNetwork};
