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