import{d as u,eL as f,J as l,o as _,N as h,f as p,v as b}from"./outputWidgets.be3472c2.js";import{E as g}from"./ExclamationCircleOutlined.85892480.js";import{M as m}from"./Modal.304207b8.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]="d8f01349-3b4b-4abb-8c0d-2a27a5d85d17",n._sentryDebugIdIdentifier="sentry-dbid-d8f01349-3b4b-4abb-8c0d-2a27a5d85d17")}catch{}})();const c="You have unsaved changes. Are you sure you want to leave?",v=u({__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)};f(async(e,y,s)=>{if(!a.hasChanges)return s();await new Promise(r=>{m.confirm({title:"You have unsaved changes.",icon:p(g),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 I=b(v,[["__scopeId","data-v-0a2660df"]]);export{I as U};
//# sourceMappingURL=UnsavedChangesHandler.080c92ef.js.map
