import{Ct as e,Mt as t,d as n,jt as r,wt as i}from"./BA99CCI5.js";import{a,i as o}from"./DP37y6wO.js";import"./xihTtKlq.js";import"./DGo8yE5j.js";import"./BymfG72d2.js";import{t as s}from"./7yuvYLu22.js";import{c,i as l,r as u,t as d,u as f}from"./BAuEC8Ja2.js";function p(p,m){t(m,!1);let h=()=>i(c,`$isDirty`,_),g=()=>i(f,`$showModal`,_),[_,v]=e(),y=null;o(async e=>{h()&&(e.cancel(),y=e.to?.url.pathname||null,await l()&&y&&a(y),y=null)}),n(),s(p,{get open(){return g()},header:`Unsaved Changes`,bodyMessage:`You have unsaved changes. Are you sure you want to leave this page? Your changes will be lost.`,confirmText:`Discard Changes`,cancelText:`Stay on Page`,confirmDanger:!0,$$events:{confirm:()=>u(),cancel:()=>d()}}),r(),v()}export{p as t};