import{t as e,i as n,n as o,b as a,c as t}from"./index-1da68693.js";import{c as i,j as r,I as s,az as u,o as v}from"./index-4bd11d60.js";function l(e){var n;const o=t(e);return null!=(n=null==o?void 0:o.$el)?n:o}const c=n?window:void 0;function d(...n){let i,s,u,v;if("string"==typeof n[0]||Array.isArray(n[0])?([s,u,v]=n,i=c):[i,s,u,v]=n,!i)return o;Array.isArray(s)||(s=[s]),Array.isArray(u)||(u=[u]);const d=[],f=()=>{d.forEach((e=>e())),d.length=0},p=r((()=>[l(i),t(v)]),(([e,n])=>{if(f(),!e)return;const o=a(n)?{...n}:n;d.push(...s.flatMap((n=>u.map((a=>{return i=n,r=a,s=o,(t=e).addEventListener(i,r,s),()=>t.removeEventListener(i,r,s);var t,i,r,s})))))}),{immediate:!0,flush:"post"}),w=()=>{p(),f()};return e(w),w}function f(e){const n=function(){const e=s(!1);return u()&&v((()=>{e.value=!0})),e}();return i((()=>(n.value,Boolean(e()))))}function p(n,o,a={}){const{window:t=c,...s}=a;let u;const v=f((()=>t&&"ResizeObserver"in t)),d=()=>{u&&(u.disconnect(),u=void 0)},p=i((()=>Array.isArray(n)?n.map((e=>l(e))):[l(n)])),w=r(p,(e=>{if(d(),v.value&&t){u=new ResizeObserver(o);for(const n of e)n&&u.observe(n,s)}}),{immediate:!0,flush:"post",deep:!0}),y=()=>{d(),w()};return e(y),{isSupported:v,stop:y}}function w(e={}){const{window:n=c}=e,o=null==n?void 0:n.navigator,a=f((()=>o&&"connection"in o)),t=s(!0),i=s(!1),r=s(void 0),u=s(void 0),v=s(void 0),l=s(void 0),p=s(void 0),w=s(void 0),y=s("unknown"),m=a.value&&o.connection;function A(){o&&(t.value=o.onLine,r.value=t.value?void 0:Date.now(),u.value=t.value?Date.now():void 0,m&&(v.value=m.downlink,l.value=m.downlinkMax,w.value=m.effectiveType,p.value=m.rtt,i.value=m.saveData,y.value=m.type))}return n&&(d(n,"offline",(()=>{t.value=!1,r.value=Date.now()})),d(n,"online",(()=>{t.value=!0,u.value=Date.now()}))),m&&d(m,"change",A,!1),A(),{isSupported:a,isOnline:t,saveData:i,offlineAt:r,onlineAt:u,downlink:v,downlinkMax:l,effectiveType:w,rtt:p,type:y}}export{p as a,w as u};
