import{j as i}from"./icons.d4e872e2.js";import{d as u,r as v,b as d,c as p,e as f,y as m,R as _,L as h,E as y,a as g,p as b}from"./registerWidgets.4cc86716.js";const S=u({__name:"SaveButton",props:{model:null},setup(a){const n=a,t=v(!1);async function s(){t.value=!0;try{await n.model.save()}finally{t.value=!1}}return addEventListener("keydown",e=>{(e.metaKey||e.ctrlKey)&&e.key==="s"&&(e.preventDefault(),s())}),addEventListener("beforeunload",e=>{n.model.hasChanges()&&(e.preventDefault(),e.returnValue="")}),(e,o)=>{var l,r;const c=g("icon");return d(),p("button",{class:y(["save-button",{changes:(l=a.model)==null?void 0:l.hasChanges()}]),onClick:o[0]||(o[0]=C=>s())},[f(c,{class:"icon",path:m(i),width:"20",height:"20",fill:"#5A677A"},null,8,["path"]),_(" "+h(t.value?"Saving ...":(r=a.model)!=null&&r.hasChanges()?"Save":"Saved"),1)],2)}}});const B=b(S,[["__scopeId","data-v-64b5b2e8"]]);export{B as S};
//# sourceMappingURL=SaveButton.cb05a4c6.js.map
