import{r as e}from"./chunk-QTnfLwEv.js";import{n as t}from"./index-7yDgay5u.js";import{o as n,t as r}from"./jsx-runtime-DHSfUA5-.js";import{P as i,h as a}from"./test.id-DxQrYxPk.js";import{t as o}from"./diaryService-CNt2_Lb5.js";import{t as s}from"./navigationService-BNBSAd9W.js";import{f as c,o as l}from"./route-CPr17rXr.js";import{m as u}from"./selectors-DZWoTA9D.js";import{t as d}from"./useDiaryModel-BQGj9xs8.js";import{t as f}from"./HeaderPage-CPQpvQQw.js";import{t as p}from"./CellList-UkuVgkhN.js";import{n as m}from"./useMembershipStatus-CuwuZX56.js";import{t as h}from"./usePickNotebookImageFromAlbum-DN3QeK7W.js";var g=e(n(),1),_=r();function v(){let{notebookId:e}=c(),n=d(),r=i(o),v=i(s),{status:y,isLoading:b}=m(),x=e?u(n,e):void 0,S=h({notebookId:e,onSuccess:(0,g.useCallback)((e,t)=>{r.updateNotebookChatBackground(t,e.id),v.goBack({fallbackPath:`/diary/${t}/settings`})},[r,v])});return!x||!e?(0,_.jsx)(l,{to:`/diaries`,replace:!0}):y.active?(0,_.jsx)(f,{pageTestId:a.chatBackgroundPage,contentTestId:a.chatBackgroundContent,header:{title:t(`diary.chatBackground`,`Chat background`),showBack:!0},children:(0,_.jsx)(p,{items:[{type:`action`,label:t(`diary.chatBackground.selectFromAlbum`,`Choose from album`),testId:a.chatBackgroundSelectAlbum,disabled:S.uploading,onClick:()=>void S.pick()},{type:`action`,label:t(`diary.chatBackground.clear`,`Clear background`),testId:a.chatBackgroundClear,danger:!0,onClick:()=>{e&&(r.updateNotebookChatBackground(e,void 0),v.goBack({fallbackPath:`/diary/${e}/settings`}))}}]})}):b?null:(0,_.jsx)(l,{to:`/diary/${e}/settings`,replace:!0})}export{v as DiaryChatBackgroundPage};
//# sourceMappingURL=background-Cm7v5uLb.js.map