import{b3 as y,an as x,ao as f,av as n,cc as u,aH as h,x as j,k as v,aD as P,a2 as b,j as t,B as C,T as i,cH as B,a9 as E}from"./main-TIUJvpaR.js";import{D as T}from"./paginated-resources-KKWqbuJW.js";import{A as q}from"./article-editor-page-DS55U5vL.js";import{P as D}from"./page-meta-tags-D0SmNym_.js";import{u as I}from"./use-required-params-DVZ2GK7g.js";import{u as Q}from"./useSuspenseQuery-Bu7JdXWw.js";import{B as S,a as p}from"./breadcrumb-B7oVkzG6.js";import"./Undo-DcjzOemS.js";import"./Code-BpwipxEt.js";import"./color-picker-dialog-glVXBItR.js";import"./Color-BRshhlzf.js";import"./dialog-footer-yCpPZGPO.js";import"./file-upload-provider-B_bRCnuD.js";import"./uploaded-file-CLeM2EFo.js";import"./pretty-bytes-bO14ePu9.js";import"./get-image-size-iUxUXrDd.js";import"./use-active-upload-DYNfvvrt.js";import"./open-upload-window-DllX9uve.js";import"./shallow-CASQY68G.js";import"./MoreVert-CnEfcu2X.js";import"./select-T49HzTXy.js";import"./Link-Bj7RBZ1-.js";import"./datatable-page-with-header-layout-Bbr3vl7W.js";import"./dashboard-layout-context-DA6Q35rI.js";import"./use-toggle-dashboard-left-sidebar-BuzWlDo2.js";import"./ArrowBack-DJrrk_Fu.js";import"./core-DldQ5tJn.js";import"./Edit-_sVfUVPu.js";import"./dashboard-sidenav-B0ig3ukb.js";import"./default-meta-tags-BkUitnZo.js";import"./useEffectEvent-Bgk8rSJ3.js";import"./ChevronRight-BaJkMP9s.js";import"./MoreHoriz-Cm8ZCxuL.js";function F(o){const{pageId:e}=y(),a=`custom-pages/${e}`;return x({mutationFn:s=>K(s,a),onError:s=>f(s),onSuccess:async()=>{await n.invalidateQueries({queryKey:u.customPages.invalidateKey}),await n.invalidateQueries({queryKey:T(a)}),h(j("Page updated"))}})}function K(o,e){return v.put(`${e}`,o).then(a=>a.data)}function lt(){const{pageId:o}=I(["pageId"]),e=Q(u.customPages.get(o)),a=e.data.page,s=P(),m=F(),r=b({defaultValues:{title:a.title,slug:a.slug,body:a.body}}),d=()=>{m.mutate(r.getValues(),{onSuccess:()=>s("../..",{relative:"path"})})},c=t.jsx(C,{variant:"flat",color:"primary",size:"xs",onClick:()=>d(),disabled:m.isPending,children:t.jsx(i,{message:"Save"})}),l=t.jsxs(S,{size:"xl",children:[t.jsx(p,{to:"../..",relative:"path",children:t.jsx(i,{message:"Custom pages"})}),t.jsx(p,{children:t.jsx(i,{message:"Edit"})})]});return t.jsxs(t.Fragment,{children:[t.jsx(D,{query:e}),t.jsx(B,{...r,children:t.jsx(q,{title:l,saveButton:c,imageUploadType:E.articleImages,initialContent:a.body,onChange:g=>{r.setValue("body",g,{shouldDirty:!0})}})})]})}export{lt as Component};
