(() => {
    if (!window.uitools._origShowPlaylistEditor)
        window.uitools._origShowPlaylistEditor = window.uitools.showPlaylistEditor;

    window.uitools.showPlaylistEditor = function (plst, isNew, origin) {
        if (!plst.isAutoPlaylist && window.uitools.getCanEdit()) {
            if (origin == 'sendToMenu' && !isNew) {
                //if called from sent to menu then do not show the editor and just show a toast message that an operation was performed in the background.
                //	Cannot include "Undo", because the actual playlist editing operation is done elsewhere in the code
                uitools.toastMessage.show('Playlist edited in the background.', {
                    disableUndo: true,
                    disableClose: true,
                    delay: 3000
                });
            } else {
                window.uitools._origShowPlaylistEditor.apply(this, arguments);
            }
        }
    }
})();
