import{bB as u,d as n,j as d,a2 as h}from"./index-Dz5JRQhj.js";import{g as m}from"./formChangeCount-BuqgS6kd.js";const c=({formik:a,baseUrl:s,disabled:o,isYaml:i=!1})=>{const e=m(a);u({when:t=>e>0&&!t.nextLocation.pathname.startsWith(s),message:"Changes you made have not been saved. Leave site?"});const r=t=>{e>0&&(t.returnValue="Changes you made have not been saved.")};return n.useListener(window,r,"beforeunload"),d.jsx(n.ActionButton,{appearance:"positive",loading:a.isSubmitting,disabled:!a.isValid||a.isSubmitting||o||e===0,onClick:()=>{a.submitForm()},children:e===0||i?"Save changes":`Save ${e} ${h("change",e)}`})};export{c as F};
