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,S 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{f 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"./TextInputRow-DqOYjq7o.js";var m=e(n(),1),h=r();function g(){let{identityId:e}=c(),n=i(s),r=i(o),g=d(),_=e?u(g,e):void 0,[v,y]=(0,m.useState)(_?.name??``),b=v.trim(),x=b.length>0;return!_||!e?(0,h.jsx)(l,{to:`/identities`,replace:!0}):(0,h.jsx)(f,{pageTestId:a.page,contentTestId:a.content,header:{title:t(`identity.name`,`Nickname`),showBack:!0,right:{type:`button`,label:t(`common.save`,`Save`),disabled:!x,testId:a.save,onClick:()=>{r.updateIdentityName(e,b),n.goBack({fallbackPath:`/identity/${e}`})}}},children:(0,h.jsx)(p,{id:`identityName`,testId:a.nameInput,autoFocus:!0,placeholder:t(`identity.namePlaceholder`,`Enter a nickname`),value:v,onChange:y})})}export{g as IdentityNamePage};
//# sourceMappingURL=name-wuC_yFPW.js.map