import{F as e,Q as t,ct as n,yt as r}from"./content_renderer-CoENEE63.js";import{n as i,s as a}from"./options-CDt8ZGCW.js";var o=class{treeWidget;node;constructor(e,t){this.treeWidget=e,this.node=t}async show(e){t.show({x:e.pageX??0,y:e.pageY??0,items:await this.getMenuItems(),selectMenuItemHandler:(e,t)=>this.selectMenuItemHandler(e)})}async getMenuItems(){let t=this.node.data.noteId?await e.getNote(this.node.data.noteId):null,n=this.node.getParent().data.noteId,r=t?.noteId===`_lbVisibleLaunchers`||t?.noteId===`_lbMobileVisibleLaunchers`,i=t?.noteId===`_lbAvailableLaunchers`||t?.noteId===`_lbMobileAvailableLaunchers`,o=n===`_lbVisibleLaunchers`||n===`_lbMobileVisibleLaunchers`,s=n===`_lbAvailableLaunchers`||n===`_lbMobileAvailableLaunchers`,c=o||s,l=!t?.noteId.startsWith(`_`),u=!l&&t?.isLaunchBarConfig();return[r||i?{title:a(`launcher_context_menu.add-note-launcher`),command:`addNoteLauncher`,uiIcon:`bx bx-note`}:null,r||i?{title:a(`launcher_context_menu.add-script-launcher`),command:`addScriptLauncher`,uiIcon:`bx bx-code-curly`}:null,r||i?{title:a(`launcher_context_menu.add-custom-widget`),command:`addWidgetLauncher`,uiIcon:`bx bx-customize`}:null,r||i?{title:a(`launcher_context_menu.add-spacer`),command:`addSpacerLauncher`,uiIcon:`bx bx-dots-horizontal`}:null,r||i?{kind:`separator`}:null,s?{title:a(`launcher_context_menu.move-to-visible-launchers`),command:`moveLauncherToVisible`,uiIcon:`bx bx-show`,enabled:!0}:null,o?{title:a(`launcher_context_menu.move-to-available-launchers`),command:`moveLauncherToAvailable`,uiIcon:`bx bx-hide`,enabled:!0}:null,o||s?{kind:`separator`}:null,{title:`${a(`launcher_context_menu.duplicate-launcher`)}`,command:`duplicateSubtree`,uiIcon:`bx bx-outline`,enabled:c},{title:`${a(`launcher_context_menu.delete`)}`,command:`deleteNotes`,uiIcon:`bx bx-trash destructive-action-icon`,enabled:l},{kind:`separator`},{title:a(`launcher_context_menu.reset`),command:`resetLauncher`,uiIcon:`bx bx-reset destructive-action-icon`,enabled:u}].filter(e=>e!==null)}async selectMenuItemHandler({command:e}){if(e){if(e===`resetLauncher`){await r.confirm(a(`launcher_context_menu.reset_launcher_confirm`,{title:this.node.title}))&&await i.post(`special-notes/launchers/${this.node.data.noteId}/reset`);return}this.treeWidget.triggerCommand(e,{node:this.node,notePath:n.getNotePath(this.node),selectedOrActiveBranchIds:this.treeWidget.getSelectedOrActiveBranchIds(this.node),selectedOrActiveNoteIds:this.treeWidget.getSelectedOrActiveNoteIds(this.node)})}}};export{o as default};