import{d as D,g as h,W as g,J as C,ae as p,l as e,c as w,i as c,a as x,j as P,u as E,o as I,k as s,cv as N,cw as S,Y as T,cr as U,cp as V,P as b,bk as W}from"./index-BBlvj0M_.js";import{u as j}from"./usePageTitle-lBdMRcrQ.js";const J=D({__name:"BlockEdit",async setup(A){let t,l;const n=h(),u=E(),r=g("blockDocumentId"),o=([t,l]=C(()=>n.blockDocuments.getBlockDocument(r.value)),t=await t,l(),t),{blockType:i,blockSchema:_}=o,d=p(o.data),m=p(o.name);function f(k){n.blockDocuments.updateBlockDocument(o.id,k).then(()=>{b("Block updated successfully","success"),u.push(W.block(r.value))}).catch(a=>{b("Failed to update block","error"),console.error(a)})}function y(){u.back()}return j(`Edit Block: ${m.value}`),(k,a)=>{const v=P("p-layout-default");return e(o)?(I(),w(v,{key:0,class:"block-edit"},{header:c(()=>[s(e(N),{"block-document":e(o)},null,8,["block-document"])]),default:c(()=>[s(e(V),{"block-type":e(i)},{default:c(()=>[s(e(S),T({data:d.value,"onUpdate:data":a[0]||(a[0]=B=>d.value=B)},{name:m.value,blockSchema:e(_)},U({submit:f,cancel:y})),null,16,["data"])]),_:1},8,["block-type"])]),_:1})):x("",!0)}}});export{J as default};
//# sourceMappingURL=BlockEdit-D5ruZlNG.js.map
