import{d as f,eM as u,I as l,o as _,K as h,f as p,v as g}from"./outputWidgets.260a3c99.js";import{E as m}from"./ExclamationCircleOutlined.e45bcfce.js";import{M as v}from"./Modal.6a26a016.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},a=new Error().stack;a&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[a]="97a410ca-3f36-4ec3-899f-452c94a7047b",n._sentryDebugIdIdentifier="sentry-dbid-97a410ca-3f36-4ec3-899f-452c94a7047b")}catch{}})();const c="You have unsaved changes. Are you sure you want to leave?",y=f({__name:"UnsavedChangesHandler",props:{hasChanges:{type:Boolean}},setup(n){const a=n,o=e=>(e=e||window.event,e&&(e.returnValue=c),c),i=()=>{window.addEventListener("beforeunload",o)};u(async(e,w,s)=>{if(!a.hasChanges)return s();await new Promise(r=>{v.confirm({title:"You have unsaved changes.",icon:p(m),content:"Are you sure you want to discard them?",okText:"Discard Changes",okType:"danger",cancelText:"Cancel",onOk(){r(!0)},onCancel(){r(!1)}})})?s():s(!1)});const t=()=>window.removeEventListener("beforeunload",o),d=e=>e?i():t();return l(()=>a.hasChanges,d),_(()=>d(a.hasChanges)),h(t),()=>{}}});const E=g(y,[["__scopeId","data-v-0a2660df"]]);export{E as U};
//# sourceMappingURL=UnsavedChangesHandler.76a1ee3f.js.map
