1import{o as e}from"./chunk-CMxvf4Kt.js";import{n as t,t as n}from"./jsx-runtime-SsSjplwM.js";import{a as r,c as i,s as a}from"./react-intl-Cop388b4.js";import{nt as o}from"./poll-quu7nqu0.js";import{Ct as s,la as c}from"./render-CHiIZYnD.js";import{o as l,s as u}from"./typed_functions-CyAHd4bl.js";import"./modal_container-DwVE3VSX.js";import{T as d}from"./compose_form_container-Dhanlzat.js";import{t as f}from"./callout-Ct9Pfvc6.js";import{p}from"./form_fields-D59m7r6R.js";import{t as m}from"./styles.module-BoFKCCUL.js";var h=e(t()),g=n(),_=a({newTitle:{id:`account.node_modal.title`,defaultMessage:`Add a personal note`},editTitle:{id:`account.node_modal.edit_title`,defaultMessage:`Edit personal note`},save:{id:`account.node_modal.save`,defaultMessage:`Save`},fieldLabel:{id:`account.node_modal.field_label`,defaultMessage:`Personal Note`},errorUnknown:{id:`account.node_modal.error_unknown`,defaultMessage:`Could not save the note`}}),v=({accountId:e,onClose:t})=>{let n=u(t=>t.relationships.get(e)),r=l();return(0,h.useEffect)(()=>{n||r(c([e]))},[e,r,n]),n?(0,g.jsx)(y,{relationship:n,accountId:e,onClose:t}):(0,g.jsx)(o,{})},y=({relationship:e,accountId:t,onClose:n})=>{let a=e.note,[o,c]=(0,h.useState)(a),[u,v]=(0,h.useState)(``),[y,b]=(0,h.useState)(`idle`),x=o!==a,S=(0,h.useCallback)(e=>{y!==`saving`&&c(e.target.value)},[y]),C=i(),w=(0,h.useRef)(new AbortController),T=l(),E=(0,h.useCallback)(()=>{y===`saving`||!x||(b(`saving`),T(s({accountId:t,note:o},{signal:w.current.signal})).then(()=>{b(`idle`),n()}).catch(e=>{b(`error`),e instanceof Error?v(e.message):v(C.formatMessage(_.errorUnknown))}))},[t,T,C,x,o,n,y]),D=(0,h.useCallback)(()=>{w.current.abort(),n()},[n]);return(0,g.jsx)(d,{title:a?C.formatMessage(_.editTitle):C.formatMessage(_.newTitle),extraContent:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(f,{className:m.noteCallout,children:(0,g.jsx)(r,{id:`account.node_modal.callout`,defaultMessage:`Personal notes are visible only to you.`})}),(0,g.jsx)(p,{value:o,onChange:S,label:C.formatMessage(_.fieldLabel),className:m.noteInput,status:y===`error`?{variant:`error`,message:u}:void 0,autoFocus:!0})]}),onClose:D,confirm:C.formatMessage(_.save),onConfirm:E,updating:y===`saving`,disabled:!x,noCloseOnConfirm:!0,noFocusButton:!0})};export{v as AccountNoteModal}; 2//# sourceMappingURL=note_modal-DwMyLwUp.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.