import{X as e,bt as t,vt as n}from"./xY0c-UfG.js";import{d as r,t as i}from"./BXmb29An.js";var a=4e3,o=`sg-connectivity`,s=t(!1),c=null;function l(){r(`Can't reach the server`,{id:o,description:`Your changes may not be saved. Reconnecting…`,duration:1/0,closeButton:!0})}i.addDisconnectHandler(()=>{c!==null||e(s)||(c=setTimeout(()=>{c=null,n(s,!0),l()},a))}),i.addTeardownHandler(()=>{c!==null&&(clearTimeout(c),c=null),e(s)&&(n(s,!1),r.dismiss(o))}),i.addConnectHandler(()=>{c!==null&&(clearTimeout(c),c=null),e(s)&&(n(s,!1),r.success(`Reconnected`,{id:o,description:``,duration:2500,closeButton:!1}))});var u={get offline(){return e(s)},reassert(){return e(s)?(l(),!0):!1}};export{u as t};