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