import{a as e,l as t}from"./preact.module-CNakwbc9.js";import{d as n,s as r,t as i}from"./hooks.module-BrXTvcfS.js";import{Dt as a,H as o,it as s}from"./content_renderer-DOj8g78V.js";import{a as c}from"./i18n-BaLR3UdQ.js";import{i as l}from"./toast-C6WyPqyA.js";import{t as u}from"./jsxRuntime.module-Cao1NCKs.js";import{J as d}from"./hooks-ClTXKdUl.js";import{n as f}from"./note_autocomplete-BT55HtG6.js";import{t as p}from"./Modal-hBkTa-Ee.js";import{t as m}from"./Button-Du0dYm4Z.js";import{t as h}from"./NoteList-Oyhm1asf.js";import{t as g}from"./NoteAutocomplete-Cpc7J_0A.js";import{t as _}from"./FormGroup-DqPd4bBP.js";n(),t();function v(){let[t,n]=r(),[s,l]=r(null),[v,b]=r(!1),x=i(null);d(`moveBranchIdsTo`,({branchIds:e})=>{n(e),b(!0)});async function S(){let e=s?.notePath;if(!e){logError(c(`move_to.error_no_path`));return}b(!1);let{noteId:n,parentNoteId:r}=a.getNoteIdAndParentIdFromUrl(e);if(!r)return;let i=await o.getBranchId(r,n);i&&y(t,i)}return u(p,{className:`move-to-dialog`,size:`lg`,maxWidth:1e3,title:c(`move_to.dialog_title`),footer:u(e,{children:[u(m,{text:c(`modal.cancel`),onClick:()=>b(!1)}),u(m,{text:c(`move_to.move_button`),keyboardShortcut:`Enter`})]}),onSubmit:S,onShown:()=>f(x.current),onHidden:()=>b(!1),show:v,children:[u(`h5`,{children:c(`move_to.notes_to_move`)}),u(h,{branchIds:t}),u(_,{name:`parent-note`,label:c(`move_to.target_parent_note`),children:u(g,{onChange:l,inputRef:x})})]})}async function y(e,t){e&&await s.moveToParentNote(e,t);let n=await o.getBranch(t)?.getNote();l.showMessage(`${c(`move_to.move_success_message`)} ${n?.title}`)}export{v as default};