import{t as e}from"./chunk-CNMia1zD.js";import{k as t}from"./utils-BakkG8Vx.js";import{F as n,Y as r,_t as i,dt as a}from"./content_renderer-CoENEE63.js";import{s as o}from"./options-CDt8ZGCW.js";import{t as s}from"./__vite-browser-external-yQedxin0.js";import{n as c}from"./NoteColorPicker-CYfpTnSK.js";var l=e(((e,t)=>{var n=s(),r=s(),i=r.join(__dirname,`path.txt`);function a(){let e;if(n.existsSync(i)&&(e=n.readFileSync(i,`utf-8`)),{}.ELECTRON_OVERRIDE_DIST_PATH)return r.join({}.ELECTRON_OVERRIDE_DIST_PATH,e||`electron`);if(e)return r.join(__dirname,`dist`,e);throw Error(`Electron failed to install correctly, please delete node_modules/electron and try installing again`)}t.exports=a()})),u=[],d=null;async function f(e){if(!g())if(d===`cut`)await c.moveAfterBranch(u,e),u=[],d=null;else if(d===`copy`){let t=u.map(e=>n.getBranch(e));for(let n of t){if(!n)continue;let t=await n.getNote();t&&await c.cloneNoteAfter(t.noteId,e)}}else a(`Unrecognized clipboard mode=${d}`)}async function p(e){if(!g())if(d===`cut`)await c.moveToParentNote(u,e),u=[],d=null;else if(d===`copy`){let t=u.map(e=>n.getBranch(e));for(let n of t){if(!n)continue;let t=await n.getNote();t&&await c.cloneNoteToBranch(t.noteId,e)}}else a(`Unrecognized clipboard mode=${d}`)}async function m(e){if(u=e,d=`copy`,t.isElectron()){let{clipboard:e}=l(),t=[];for(let e of n.getBranches(u)){let n=await r.createLink(`${e.parentNoteId}/${e.noteId}`,{referenceLink:!0});t.push(n[0].outerHTML)}e.writeHTML(t.join(`, `))}i.showMessage(o(`clipboard.copied`))}function h(e){u=e,u.length>0&&(d=`cut`,i.showMessage(o(`clipboard.cut`)))}function g(){return u=u.filter(e=>!!n.getBranch(e)),u.length===0}var _={pasteAfter:f,pasteInto:p,cut:h,copy:m,isClipboardEmpty:g};export{_ as t};