import{d as u,eH as l,O as b,o as h,R as _,b as g,c as p,w as v,u as m,dv as y,A as w,co as C,f as k,E}from"./outputWidgets.f7b80e9f.js";import{E as U}from"./ExclamationCircleOutlined.7d0f10bf.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]="f3ecfbbd-2e53-4a2b-a0cd-e89b3eb6b0ff",n._sentryDebugIdIdentifier="sentry-dbid-f3ecfbbd-2e53-4a2b-a0cd-e89b3eb6b0ff")}catch{}})();const c="You have unsaved changes. Are you sure you want to leave?",I=u({__name:"UnsavedChangesHandler",props:{hasChanges:{type:Boolean}},setup(n){const a=n,o=e=>(e=e||window.event,e&&(e.returnValue=c),c),f=()=>{window.addEventListener("beforeunload",o)};l(async(e,i,s)=>{if(!a.hasChanges)return s();await new Promise(d=>{C.confirm({title:"You have unsaved changes.",icon:k(U),content:"Are you sure you want to discard them?",okText:"Discard Changes",okType:"danger",cancelText:"Cancel",onOk(){d(!0)},onCancel(){d(!1)}})})?s():s(!1)});const t=()=>window.removeEventListener("beforeunload",o),r=e=>e?f():t();return b(()=>a.hasChanges,r),h(()=>r(a.hasChanges)),_(t),(e,i)=>(g(),p(m(w),{theme:{token:{colorPrimary:"#d14056"}}},{default:v(()=>[y(e.$slots,"default",{},void 0,!0)]),_:3}))}});const A=E(I,[["__scopeId","data-v-b13f3978"]]);export{A as U};
//# sourceMappingURL=UnsavedChangesHandler.016666b4.js.map
