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