import{d as B,S as D,u as x,v as C,I as g,ae as p,h as w,c as S,a as I,m as e,o as P,i as c,k as s,cp as E,cw as J,Z as N,cr as T,cx as V,J as b,bg as A}from"./index-CWv_Pcr2.js";import{u as F}from"./usePageTitle-DY9DP8zZ.js";const X=B({__name:"BlockEdit",async setup(H){let t,l;const n=D(),u=x(),r=C("blockDocumentId"),o=([t,l]=g(()=>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(A.block(r.value))}).catch(a=>{b("Failed to update block","error"),console.error(a)})}function h(){u.back()}return F(`Edit Block: ${m.value}`),(k,a)=>{const v=w("p-layout-default");return e(o)?(P(),S(v,{key:0,class:"block-edit"},{header:c(()=>[s(e(V),{"block-document":e(o)},null,8,["block-document"])]),default:c(()=>[s(e(E),{"block-type":e(i)},{default:c(()=>[s(e(J),N({data:d.value,"onUpdate:data":a[0]||(a[0]=y=>d.value=y)},{name:m.value,blockSchema:e(_)},T({submit:f,cancel:h})),null,16,["data"])]),_:1},8,["block-type"])]),_:1})):I("",!0)}}});export{X as default};
//# sourceMappingURL=BlockEdit-B-NeDHAU.js.map
