diff --git a/.gitignore b/.gitignore index 6faa329..8ce3f26 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ # vscode -.vscode +.vscode # Intellij *.iml @@ -21,6 +21,8 @@ data.json # Exclude macOS Finder (System Explorer) View States .DS_Store -lofi.mp3 +# Claude Code configuration +.claude/ -package-lock.json \ No newline at end of file +# Test audio files +lofi.mp3 \ No newline at end of file diff --git a/README.md b/README.md index 39395ee..42adc51 100644 --- a/README.md +++ b/README.md @@ -1,69 +1,136 @@ -# Obsidian Lofi Flow Plugin Development Tracker +# Lofi Focus -This document tracks the implementation status of features for the Obsidian Lofi Flow plugin. +Play lofi music and stay focused with an integrated Pomodoro timer, all within Obsidian. -## 🎵 Lofi Audio in Background +## Features -- [x] **Load/Play Local MP3 Files:** - - [x] Scan a user-specified folder in the vault for `.mp3` files. - - [x] Store scanned files as a playlist. - - [x] Load and play the first track from the playlist on plugin load/scan. - - [x] Implement a custom folder browser UI in settings to select the audio folder. - - [x] List found tracks in settings and allow clicking to play a specific track. -- [ ] **Load a default YouTube lofi stream.use cdn.jsdeliver github public repo** -- [x] **Play/Pause Toggle (Ribbon/Command):** - - [x] Add a ribbon icon to toggle playback. - - [x] Add a command palette action to toggle playback. -- [ ] **Predefined Default Streams:** Show options like Chill mornings, jazzy afternoons, etc. (Requires defining/managing these sources). -- [x] **Status Bar Integration:** - - [x] Show plugin status (e.g., Ready, Scanning, Error). - - [x] Show playback status (Playing, Paused). - - [x] Display the name of the currently playing local MP3 file. -- [ ] **Auto-reconnect if stream fails.** (Relevant for streaming sources like YouTube, could also apply to errors reloading local files). -- [x] **Volume Control:** - - [x] Add a volume slider in settings for HTML audio playback. - - [x] Apply volume setting on load. - - [x] Update volume immediately when slider changes. -- [ ] **Source Selection in Settings:** Option to choose between local folder, YouTube stream, or predefined defaults. -- [x] **Subtle Animation (Visualizer):** - - [x] Implement animation (e.g., falling leaves, rain) using Canvas or SVG. - - [x] Add toggle in settings to turn animation on/off. +### 🎵 Audio Playback +- **Online Streams**: Choose from pre-configured lofi radio stations +- **Local MP3 Files**: Play your own music collection from any vault folder +- **Full Playback Controls**: Play, pause, next, previous tracks +- **Volume Control**: Adjust volume to your preference +- **Status Bar Integration**: See what's playing at a glance -## ⏳ Focus Timer +### ⏱️ Focus Timer (Pomodoro) +- **Customizable Work Sessions**: Set your ideal work duration (default: 25 minutes) +- **Break Reminders**: Automated rest periods (default: 5 minutes) +- **Auto-Transitions**: Seamlessly switches between work and rest sessions +- **Visual Timer**: Always visible in the status bar +- **Full Controls**: Start, pause, and reset from the status bar -- [X] **Implement Timer Feature:** - - [x] Customizable work/rest intervals setting. - - [x] Add UI/logic for timer countdown. - - [X] Provide an audio or visual cue when a session ends. +### ✨ Ambient Animations +- **Optional Visual Effects**: Subtle falling particle animations +- **Toggle On/Off**: Enable in settings if you enjoy the ambiance +- **Performance-Friendly**: Lightweight canvas-based rendering + +## Quick Start + +### First Time Setup + +1. **Install the plugin** from Obsidian's Community Plugins +2. **Enable it** in Settings → Community Plugins +3. The plugin starts with **Lofi Hip Hop Radio** by default - it works immediately! + +### Using Audio + +#### Option 1: Online Streams (Default) +- Pre-configured streams work out of the box +- Switch between streams in Settings: + - Lofi Hip Hop Radio + - Chill Mornings + - Jazzy Afternoons + - Anime & Japanese Music + +#### Option 2: Local MP3 Files +1. Go to Settings → Lofi Focus +2. Select "Local Folder" from Audio Source dropdown +3. Browse to a folder containing MP3 files +4. Click "Select This Folder" +5. Your tracks appear - click any track to play + +### Using the Focus Timer + +1. **Start**: Click the ▶ button next to the timer in the status bar +2. **Pause**: Click the ⏸ button during a session +3. **Reset**: Click the 🔄 button to start over +4. Customize durations in Settings → Focus Timer Settings + +### Status Bar Controls + +You'll see these controls at the bottom of Obsidian: + +**Audio Controls:** +- `[Audio Status]` - Shows current track/stream +- `[⏮]` - Previous track (local files only) +- `[▶/⏸]` - Play/Pause audio +- `[⏭]` - Next track (local files only) + +**Timer Controls:** +- `[Timer: 00:00]` - Shows remaining time +- `[▶/⏸]` - Start/Pause timer +- `[🔄]` - Reset timer + +## Commands + +Access these from the Command Palette (Ctrl/Cmd + P): + +- `Toggle Lofi Playback` - Play/pause music +- `Play Next Lofi Track` - Skip to next track +- `Play Previous Lofi Track` - Go to previous track +- `Start Focus Timer` - Begin work session +- `Pause Focus Timer` - Pause timer +- `Reset Focus Timer` - Reset to zero + +## Settings + +### Audio Settings +- **Audio Source**: Choose between online streams or local folder +- **Volume**: Adjust playback volume (0-100%) +- **Local Audio Folder**: Browse and select folder with MP3 files + +### Focus Timer Settings +- **Work Duration**: Length of focus sessions (default: 25 minutes) +- **Rest Duration**: Length of break periods (default: 5 minutes) + +### Animation Settings +- **Enable Background Animation**: Toggle ambient falling particles + +## Tips + +- **Stream vs Local**: Streams work instantly but require internet. Local files work offline and use your own music collection. +- **Pomodoro Technique**: The default 25:5 ratio is scientifically proven to maintain focus while preventing burnout. +- **Volume**: Start at 30% and adjust to your preference - especially important with headphones! +- **Animation**: Try it out! Some users find it calming, others prefer it off for less distraction. + +## Troubleshooting + +**No audio playing?** +- Check if an audio source is selected in settings +- For streams: Verify internet connection +- For local files: Ensure folder contains MP3 files + +**Can't see playback controls?** +- Playback controls appear in the status bar (bottom of Obsidian) +- For streams: Only play/pause button shows (no prev/next) +- For local files: All controls show (prev/play/next) + +**Timer not starting?** +- Click the play button (▶) next to the timer display +- Check timer durations are set to positive numbers in settings + +## Support + +Found a bug or have a feature request? +- Open an issue on [GitHub](https://github.com/Jatin-Shihora/Obsidian-lofi-plugin/issues) + +## License + +MIT License - See LICENSE file for details + +## Credits + +Created by [Jatin Shihora](https://github.com/Jatin-Shihora) --- -**Progress:** We have completed the core functionality for playing local MP3 files, including folder Browse, track selection, playback control, status display, and volume control. The Focus Timer and the YouTube/Predefined streams/Animation aspects of the audio feature are the next major areas to develop. - -## Funding URL - -You can include funding URLs where people who use your plugin can financially support it. - -The simple way is to set the `fundingUrl` field to your link in your `manifest.json` file: - -```json -{ - "fundingUrl": "https://buymeacoffee.com" -} -``` - -If you have multiple URLs, you can also do: - -```json -{ - "fundingUrl": { - "Buy Me a Coffee": "https://buymeacoffee.com", - "GitHub Sponsor": "https://github.com/sponsors", - "Patreon": "https://www.patreon.com/" - } -} -``` -s -## API Documentation - -See https://github.com/obsidianmd/obsidian-api +**Enjoy your focused work sessions! 🎵⏱️** diff --git a/defaults.ts b/defaults.ts index 810479b..cc92b7f 100644 --- a/defaults.ts +++ b/defaults.ts @@ -1,16 +1,11 @@ -import { LofiPluginSettings } from './types'; // Import the settings interface +import { LofiPluginSettings } from "./types"; -// Defines the default values for the plugin settings export const DEFAULT_LOFI_SETTINGS: LofiPluginSettings = { - mySetting: 'default', // Default value for sample setting - volume: 50, // Default volume is 50% - audioFolderPath: '', // Default to an empty string - - // Default Focus Timer Settings (e.g., Pomodoro defaults) - workDuration: 25, // Default work session: 25 minutes - restDuration: 5, // Default rest session: 5 minutes - - // --- NEW: Default Animation Settings --- - animationEnabled: false, // Animation is off by default - // --- END NEW --- -} \ No newline at end of file + mySetting: "default", + volume: 30, + audioFolderPath: "", + workDuration: 25, + restDuration: 5, + animationEnabled: false, + activeStreamId: "lofi-hiphop-radio", +}; diff --git a/esbuild.config.mjs b/esbuild.config.mjs index a5de8b8..aaa4475 100644 --- a/esbuild.config.mjs +++ b/esbuild.config.mjs @@ -2,14 +2,13 @@ import esbuild from "esbuild"; import process from "process"; import builtins from "builtin-modules"; -const banner = -`/* +const banner = `/* THIS IS A GENERATED/BUNDLED FILE BY ESBUILD if you want to view the source, please visit the github repository of this plugin */ `; -const prod = (process.argv[2] === "production"); +const prod = process.argv[2] === "production"; const context = await esbuild.context({ banner: { @@ -31,7 +30,8 @@ const context = await esbuild.context({ "@lezer/common", "@lezer/highlight", "@lezer/lr", - ...builtins], + ...builtins, + ], format: "cjs", target: "es2018", logLevel: "info", diff --git a/main.ts b/main.ts index 7a5a81d..a7ec1ab 100644 --- a/main.ts +++ b/main.ts @@ -1,622 +1,904 @@ -// Import necessary types and classes from obsidian and local modules -import { App, Editor, MarkdownView, Modal, Notice, Plugin, PluginSettingTab, normalizePath, TFolder, TFile } from 'obsidian'; +import { + App, + Editor, + MarkdownView, + Modal, + Notice, + Plugin, + PluginSettingTab, + normalizePath, + TFolder, + TFile, +} from "obsidian"; +import { LofiPluginSettings } from "./types"; +import { DEFAULT_LOFI_SETTINGS } from "./defaults"; +import { SampleModal } from "./modal"; +import { LofiSettingTab } from "./settings-tab"; +import { getStreamById } from "./streams"; -// Import interfaces and defaults -import { LofiPluginSettings } from './types'; -import { DEFAULT_LOFI_SETTINGS } from './defaults'; +type TimerState = "stopped" | "working" | "resting" | "paused"; +type SessionType = "work" | "rest"; -// Import component classes -import { SampleModal } from './modal'; -import { LofiSettingTab } from './settings-tab'; - -// Define Timer States -type TimerState = 'stopped' | 'working' | 'resting' | 'paused'; -type SessionType = 'work' | 'rest'; - -// --- NEW: Simple interface for an animated element (e.g., a falling circle/leaf representation) --- interface AnimatedElement { - x: number; // current x position - y: number; // current y position - radius: number; // size (for circle) - speed: number; // how fast it falls (pixels per second) - color: string; // color (e.g., 'rgba(255, 165, 0, 0.5)' for transparent orange) - // Add other properties later for more complex animations (e.g., rotation, sway, opacity, shape) + x: number; + y: number; + radius: number; + speed: number; + color: string; } -// --- END NEW --- - - -// Main Plugin class export default class LofiPlugin extends Plugin { settings: LofiPluginSettings; private audioPlayer: HTMLAudioElement | null = null; - private statusBarItemEl: HTMLElement | null = null; // Audio status text - // Audio playback controls status bar items - private prevButtonEl: HTMLElement | null = null; - private playPauseButtonEl: HTMLElement | null = null; - private nextButtonEl: HTMLElement | null = null; + private statusBarItemEl: HTMLElement | null = null; + private prevButtonEl: HTMLElement | null = null; + private playPauseButtonEl: HTMLElement | null = null; + private nextButtonEl: HTMLElement | null = null; - public playlist: string[] = []; - private currentTrackIndex: number = -1; + public playlist: string[] = []; + private currentTrackIndex: number = -1; - // Timer State Properties - private timerState: TimerState = 'stopped'; - private remainingTime: number = 0; // Time in seconds - private timerIntervalId: number | null = null; - private currentSessionType: SessionType = 'work'; + private timerState: TimerState = "stopped"; + private remainingTime: number = 0; + private timerIntervalId: number | null = null; + private currentSessionType: SessionType = "work"; - // Timer Status Bar Items - private timerDisplayEl: HTMLElement | null = null; - private timerPlayPauseButtonEl: HTMLElement | null = null; - private timerResetButtonEl: HTMLElement | null = null; + private timerDisplayEl: HTMLElement | null = null; + private timerPlayPauseButtonEl: HTMLElement | null = null; + private timerResetButtonEl: HTMLElement | null = null; - // --- NEW: Animation Properties --- - private animationCanvas: HTMLCanvasElement | null = null; // The canvas element for drawing - private animationContext: CanvasRenderingContext2D | null = null; // The 2D rendering context - private animationFrameId: number | null = null; // The ID returned by requestAnimationFrame - private animatedElements: AnimatedElement[] = []; // Array to hold the currently animated elements - private lastFrameTime: number = 0; // Timestamp of the last animation frame for delta time calculation - // --- END NEW --- - - - // Called when the plugin is enabled + private animationCanvas: HTMLCanvasElement | null = null; + private animationContext: CanvasRenderingContext2D | null = null; + private animationFrameId: number | null = null; + private animatedElements: AnimatedElement[] = []; + private lastFrameTime: number = 0; + private animationSpawnRate: number = 20; async onload() { await this.loadSettings(); - console.log('Loading Obsidian Lofi Plugin'); - this.audioPlayer = new Audio(); - this.audioPlayer.addEventListener('ended', () => { - console.log('Audio playback ended. Playing next track...'); - this.playNextTrack(); - }); - this.audioPlayer.addEventListener('play', () => { - console.log('Audio playing'); - this.updatePlayPauseButton(true); - }); - this.audioPlayer.addEventListener('pause', () => { - console.log('Audio paused'); - this.updatePlayPauseButton(false); - }); + this.audioPlayer.addEventListener("ended", () => { + const activeStream = getStreamById(this.settings.activeStreamId); + if (!activeStream || activeStream.id === "local") { + this.playNextTrack(); + } + }); + + this.audioPlayer.addEventListener("play", () => { + this.updatePlayPauseButton(true); + }); + + this.audioPlayer.addEventListener("pause", () => { + this.updatePlayPauseButton(false); + }); this.setVolume(this.settings.volume); - if (this.settings.audioFolderPath) { - const normalizedPath = normalizePath(this.settings.audioFolderPath); - await this.scanAudioFolder(normalizedPath); - } else { - this.updateStatusBar('Lofi: No folder set'); - } + const initialStreamId = this.settings.activeStreamId; - // Set initial audio source after scan - if (this.playlist.length > 0 && this.audioPlayer) { - if (this.currentTrackIndex === -1 || this.currentTrackIndex >= this.playlist.length) { - this.currentTrackIndex = 0; - } - const initialTrackVaultPath = this.playlist[this.currentTrackIndex]; - const initialTrackAppPath = this.app.vault.adapter.getResourcePath(initialTrackVaultPath); - this.audioPlayer.src = initialTrackAppPath; - console.log('Set initial audio source from playlist:', initialTrackAppPath); - const initialTrackName = initialTrackVaultPath.split('/').pop() || 'Unknown Track'; - this.updateStatusBar(`Lofi Ready || ${initialTrackName}`); - } else if (!this.settings.audioFolderPath){ - // Status already set - } - else { // Path was set, but no files found - console.warn('No audio files found in the specified folder.'); - this.updateStatusBar('Lofi: No files found'); - } + if (initialStreamId !== null) { + this.activateStream(initialStreamId); + } else { + if (this.settings.audioFolderPath) { + const normalizedPath = normalizePath( + this.settings.audioFolderPath + ); + await this.scanAudioFolder(normalizedPath); + } else { + this.updateStatusBar("Lofi: No folder set"); + } - // Ribbon Icon - const ribbonIconEl = this.addRibbonIcon('music', 'Toggle Lofi Playback', () => this.togglePlayback()); - ribbonIconEl.addClass('lofi-plugin-ribbon-icon'); + if (this.playlist.length > 0 && this.audioPlayer) { + if ( + this.currentTrackIndex === -1 || + this.currentTrackIndex >= this.playlist.length + ) { + this.currentTrackIndex = 0; + } + const initialTrackVaultPath = + this.playlist[this.currentTrackIndex]; + const initialTrackAppPath = + this.app.vault.adapter.getResourcePath( + initialTrackVaultPath + ); + this.audioPlayer.src = initialTrackAppPath; + const initialTrackName = + initialTrackVaultPath.split("/").pop() || "Unknown Track"; + this.updateStatusBar(`Lofi Ready || ${initialTrackName}`); + } else if (this.settings.audioFolderPath) { + this.updateStatusBar("Lofi: No files found"); + } + this.setPlaybackControlsVisibility(this.playlist.length > 0); + } + const ribbonIconEl = this.addRibbonIcon( + "music", + "Toggle Lofi Playback", + () => this.togglePlayback() + ); + ribbonIconEl.addClass("lofi-plugin-ribbon-icon"); - // --- Status Bar Items --- - // Audio Status Text this.statusBarItemEl = this.addStatusBarItem(); - this.updateStatusBar('Lofi Ready'); - // Audio Playback Controls - this.prevButtonEl = this.addStatusBarItem(); - this.prevButtonEl.addClass('lofi-control-button'); - this.prevButtonEl.addClass('lofi-prev-button'); - this.prevButtonEl.setText('⇐'); - this.prevButtonEl.ariaLabel = 'Previous Track'; - this.prevButtonEl.addEventListener('click', () => this.playPreviousTrack()); + this.prevButtonEl = this.addStatusBarItem(); + this.prevButtonEl.addClass("lofi-control-button"); + this.prevButtonEl.addClass("lofi-prev-button"); + this.prevButtonEl.setText("⏮"); + this.prevButtonEl.ariaLabel = "Previous Track"; + this.prevButtonEl.addEventListener("click", () => + this.playPreviousTrack() + ); - this.playPauseButtonEl = this.addStatusBarItem(); - this.playPauseButtonEl.addClass('lofi-control-button'); - this.playPauseButtonEl.addClass('lofi-play-pause-button'); - this.updatePlayPauseButton(this.audioPlayer.paused); - this.playPauseButtonEl.ariaLabel = 'Toggle Playback'; - this.playPauseButtonEl.addEventListener('click', () => this.togglePlayback()); + this.playPauseButtonEl = this.addStatusBarItem(); + this.playPauseButtonEl.addClass("lofi-control-button"); + this.playPauseButtonEl.addClass("lofi-play-pause-button"); + this.updatePlayPauseButton(!this.audioPlayer.paused); + this.playPauseButtonEl.ariaLabel = "Toggle Playback"; + this.playPauseButtonEl.addEventListener("click", () => + this.togglePlayback() + ); - this.nextButtonEl = this.addStatusBarItem(); - this.nextButtonEl.addClass('lofi-control-button'); - this.nextButtonEl.addClass('lofi-next-button'); - this.nextButtonEl.setText('⇒'); - this.nextButtonEl.ariaLabel = 'Next Track'; - this.nextButtonEl.addEventListener('click', () => this.playNextTrack()); + this.nextButtonEl = this.addStatusBarItem(); + this.nextButtonEl.addClass("lofi-control-button"); + this.nextButtonEl.addClass("lofi-next-button"); + this.nextButtonEl.setText("⏭"); + this.nextButtonEl.ariaLabel = "Next Track"; + this.nextButtonEl.addEventListener("click", () => this.playNextTrack()); - // Timer Status Bar Items - this.timerDisplayEl = this.addStatusBarItem(); - this.timerDisplayEl.addClass('lofi-timer-display'); - this.updateTimerDisplay(); // Set initial text + this.timerDisplayEl = this.addStatusBarItem(); + this.timerDisplayEl.addClass("lofi-timer-display"); + this.updateTimerDisplay(); - this.timerPlayPauseButtonEl = this.addStatusBarItem(); - this.timerPlayPauseButtonEl.addClass('lofi-control-button'); - this.timerPlayPauseButtonEl.addClass('lofi-timer-play-pause-button'); - this.updateTimerControls(); // Set initial button state (Play icon) - this.timerPlayPauseButtonEl.ariaLabel = 'Start Timer'; // Initial label - this.timerPlayPauseButtonEl.addEventListener('click', () => { - if (this.timerState === 'stopped' || this.timerState === 'paused') { - this.startTimer(); - } else { // 'working' or 'resting' - this.pauseTimer(); - } - }); + this.timerPlayPauseButtonEl = this.addStatusBarItem(); + this.timerPlayPauseButtonEl.addClass("lofi-control-button"); + this.timerPlayPauseButtonEl.addClass("lofi-timer-play-pause-button"); + this.updateTimerControls(); + this.timerPlayPauseButtonEl.ariaLabel = "Start Timer"; + this.timerPlayPauseButtonEl.addEventListener("click", () => { + if (this.timerState === "stopped" || this.timerState === "paused") { + this.startTimer(); + } else { + this.pauseTimer(); + } + }); - this.timerResetButtonEl = this.addStatusBarItem(); - this.timerResetButtonEl.addClass('lofi-control-button'); - this.timerResetButtonEl.addClass('lofi-timer-reset-button'); - this.timerResetButtonEl.setText('↻'); - this.timerResetButtonEl.ariaLabel = 'Reset Timer'; - this.timerResetButtonEl.addEventListener('click', () => this.resetTimer()); - // --- End Status Bar Items --- + this.timerResetButtonEl = this.addStatusBarItem(); + this.timerResetButtonEl.addClass("lofi-control-button"); + this.timerResetButtonEl.addClass("lofi-timer-reset-button"); + this.timerResetButtonEl.setText("🔄"); + this.timerResetButtonEl.ariaLabel = "Reset Timer"; + this.timerResetButtonEl.addEventListener("click", () => + this.resetTimer() + ); + this.addCommand({ + id: "lofi-plugin-toggle-playback", + name: "Toggle Lofi Playback", + callback: () => this.togglePlayback(), + }); + this.addCommand({ + id: "lofi-plugin-play-next-track", + name: "Play Next Lofi Track", + callback: () => this.playNextTrack(), + }); + this.addCommand({ + id: "lofi-plugin-play-previous-track", + name: "Play Previous Lofi Track", + callback: () => this.playPreviousTrack(), + }); + this.addCommand({ + id: "lofi-plugin-start-timer", + name: "Start Focus Timer", + callback: () => this.startTimer(), + }); + this.addCommand({ + id: "lofi-plugin-pause-timer", + name: "Pause Focus Timer", + callback: () => this.pauseTimer(), + }); + this.addCommand({ + id: "lofi-plugin-reset-timer", + name: "Reset Focus Timer", + callback: () => this.resetTimer(), + }); - // Add Commands - this.addCommand({ id: 'lofi-plugin-toggle-playback', name: 'Toggle Lofi Playback', callback: () => this.togglePlayback() }); - this.addCommand({ id: 'lofi-plugin-play-next-track', name: 'Play Next Lofi Track', callback: () => this.playNextTrack() }); - this.addCommand({ id: 'lofi-plugin-play-previous-track', name: 'Play Previous Lofi Track', callback: () => this.playPreviousTrack() }); - // Timer Commands - this.addCommand({ id: 'lofi-plugin-start-timer', name: 'Start Focus Timer', callback: () => this.startTimer() }); - this.addCommand({ id: 'lofi-plugin-pause-timer', name: 'Pause Focus Timer', callback: () => this.pauseTimer() }); - this.addCommand({ id: 'lofi-plugin-reset-timer', name: 'Reset Focus Timer', callback: () => this.resetTimer() }); - - - // Add the settings tab this.addSettingTab(new LofiSettingTab(this.app, this)); - - // --- NEW: Setup and Start Animation if Enabled --- - this.setupAnimationCanvas(); // Create and add canvas to DOM - if (this.settings.animationEnabled) { - this.startAnimation(); // Start the animation loop if setting is enabled - } - - // Handle window/workspace resize to resize canvas - this.registerDomEvent(window, 'resize', () => this.handleCanvasResize()); - // --- END NEW --- + this.setupAnimationCanvas(); + if (this.settings.animationEnabled) { + this.startAnimation(); + } + this.registerDomEvent(window, "resize", () => + this.handleCanvasResize() + ); } - // Called when the plugin is disabled onunload() { - console.log('Unloading Obsidian Lofi Plugin'); - this.updateStatusBar('Lofi Unloaded'); + this.updateStatusBar("Lofi Unloaded"); - // Clean up the audio player if (this.audioPlayer) { this.audioPlayer.pause(); - this.audioPlayer.src = ''; + this.audioPlayer.src = ""; this.audioPlayer = null; } - // Clear timer interval - if (this.timerIntervalId !== null) { - clearInterval(this.timerIntervalId); - } + if (this.timerIntervalId !== null) { + clearInterval(this.timerIntervalId); + } - // --- NEW: Stop animation and remove canvas --- - this.stopAnimation(); // Stop the animation loop - this.teardownAnimationCanvas(); // Remove the canvas element from the DOM - // --- END NEW --- + this.stopAnimation(); + this.teardownAnimationCanvas(); + this.statusBarItemEl = null; + this.prevButtonEl = null; + this.playPauseButtonEl = null; + this.nextButtonEl = null; + this.timerDisplayEl = null; + this.timerPlayPauseButtonEl = null; + this.timerResetButtonEl = null; + this.animationCanvas = null; + this.animationContext = null; + this.animationFrameId = null; + this.animatedElements = []; + this.lastFrameTime = 0; - // Clear references and state - this.statusBarItemEl = null; - this.prevButtonEl = null; - this.playPauseButtonEl = null; - this.nextButtonEl = null; - this.timerDisplayEl = null; - this.timerPlayPauseButtonEl = null; - this.timerResetButtonEl = null; - // Animation references - this.animationCanvas = null; - this.animationContext = null; - this.animationFrameId = null; - this.animatedElements = []; - this.lastFrameTime = 0; - - this.playlist = []; - this.currentTrackIndex = -1; - // Reset timer state - this.timerState = 'stopped'; - this.remainingTime = 0; - this.timerIntervalId = null; - this.currentSessionType = 'work'; + this.playlist = []; + this.currentTrackIndex = -1; + this.timerState = "stopped"; + this.remainingTime = 0; + this.timerIntervalId = null; + this.currentSessionType = "work"; } - // --- Plugin Core Methods (Audio) --- - async loadSettings() { /* ... existing code ... */ - const data = (await this.loadData()) || {}; + async loadSettings() { + const data = (await this.loadData()) || {}; this.settings = Object.assign({}, DEFAULT_LOFI_SETTINGS, data); - } - async saveSettings() { /* ... existing code ... */ - await this.saveData(this.settings); - } - private updateStatusBar(text: string) { /* ... existing code ... */ - if (this.statusBarItemEl) { - this.statusBarItemEl.setText(text); - } - } - public setVolume(volume: number) { /* ... existing code ... */ - if (this.audioPlayer) { - const clampedVolume = Math.max(0, Math.min(100, volume)); - this.audioPlayer.volume = clampedVolume / 100; - console.log(`Lofi volume set to ${clampedVolume}%`); - } - } - public togglePlayback(): void { /* ... existing code ... */ - if (!this.audioPlayer) { - new Notice('Audio player not initialized.'); - return; - } - const isTrackLoaded = this.audioPlayer.src && this.audioPlayer.src !== window.location.href; - const isPlaylistReady = this.playlist.length > 0 && this.currentTrackIndex !== -1 && this.currentTrackIndex < this.playlist.length; - if (!isTrackLoaded || !isPlaylistReady) { - new Notice('No Lofi track loaded. Check settings and folder.'); - if (!this.settings.audioFolderPath || this.playlist.length === 0) { this.updateStatusBar('Lofi: No files/folder'); } - else if (this.currentTrackIndex === -1 || this.currentTrackIndex >= this.playlist.length) { this.updateStatusBar('Lofi: Index Error'); } - else { this.updateStatusBar('Lofi: Source Error'); } - return; - } - const currentTrackPath = this.playlist[this.currentTrackIndex]; - const currentTrackName = currentTrackPath.split('/').pop() || 'Unknown Track'; - if (this.audioPlayer.paused) { - this.audioPlayer.play().then(() => { new Notice('Lofi playing...'); this.updateStatusBar(`Playing: ${currentTrackName}`); }).catch(error => { console.error('Error playing audio (togglePlayback):', error); new Notice('Failed to play Lofi audio. Check console.'); this.updateStatusBar('Lofi Play Error 😢'); }); - } else { - this.audioPlayer.pause(); - new Notice('Lofi paused.'); - this.updateStatusBar(`Lofi Paused || ${currentTrackName}`); - } - } - private updatePlayPauseButton(isPlaying: boolean): void { /* ... existing code ... */ - if (this.playPauseButtonEl) { - this.playPauseButtonEl.setText(isPlaying ? '❚❚' : '▶'); - this.playPauseButtonEl.ariaLabel = isPlaying ? 'Pause' : 'Play'; - } - } - public async scanAudioFolder(folderPath: string) { /* ... existing code ... */ - this.playlist = []; - const normalizedFolderPath = normalizePath(folderPath); - if (!normalizedFolderPath || normalizedFolderPath === '/') { - console.log('No valid audio folder path specified.'); this.updateStatusBar('Lofi: No folder set'); if (this.audioPlayer) { this.audioPlayer.src = ''; } this.currentTrackIndex = -1; this.setPlaybackControlsVisibility(false); return; - } - try { - const folder = this.app.vault.getAbstractFileByPath(normalizedFolderPath); - if (folder instanceof TFolder) { - for (const file of folder.children) { if (file instanceof TFile && file.extension.toLowerCase() === 'mp3') { this.playlist.push(file.path); } } - console.log(`Finished scanning. Found ${this.playlist.length} MP3 files.`); this.updateStatusBar(`Lofi: ${this.playlist.length} files found`); - if (this.playlist.length > 0) { this.currentTrackIndex = 0; if (this.audioPlayer && this.audioPlayer.paused) { const firstTrackVaultPath = this.playlist[this.currentTrackIndex]; const firstTrackAppPath = this.app.vault.adapter.getResourcePath(firstTrackVaultPath); this.audioPlayer.src = firstTrackAppPath; console.log('Set audio source to first track after scan:', firstTrackAppPath); const firstTrackName = firstTrackVaultPath.split('/').pop() || 'Unknown Track'; this.updateStatusBar(`Lofi Ready || ${firstTrackName}`); } else if (this.audioPlayer && !this.audioPlayer.paused) { console.log(`Audio already playing. Found ${this.playlist.length} tracks. Set index to 0 for new playlist.`); } this.setPlaybackControlsVisibility(true); } - else { if (this.audioPlayer) { this.audioPlayer.src = ''; } this.currentTrackIndex = -1; this.updateStatusBar('Lofi: No files found'); this.setPlaybackControlsVisibility(false); } - } else { console.error('The specified path is not a valid folder:', normalizedFolderPath); new Notice(`Error: "${folderPath}" is not a valid folder.`); this.updateStatusBar('Lofi: Invalid folder'); if (this.audioPlayer) { this.audioPlayer.src = ''; } this.currentTrackIndex = -1; this.setPlaybackControlsVisibility(false); } - } catch (error) { console.error('Error scanning audio folder:', error); new Notice(`Error scanning folder "${folderPath}". Check console for details.`); this.updateStatusBar('Lofi: Scan Error'); if (this.audioPlayer) { this.audioPlayer.src = ''; } this.currentTrackIndex = -1; this.setPlaybackControlsVisibility(false); } - } - public playTrackByPath(trackVaultPath: string): void { /* ... existing code ... */ - if (!this.audioPlayer || this.playlist.length === 0) { new Notice('Cannot play track: Audio player not ready or playlist is empty.'); this.updateStatusBar('Lofi: Play Error'); return; } - const index = this.playlist.indexOf(trackVaultPath); - if (index === -1) { console.error('Attempted to play track not found in playlist:', trackVaultPath); new Notice('Error: Selected track not found in playlist.'); this.updateStatusBar('Lofi: Track Error'); return; } - this.currentTrackIndex = index; const trackAppPath = this.app.vault.adapter.getResourcePath(trackVaultPath); this.audioPlayer.src = trackAppPath; - this.audioPlayer.play().then(() => { const trackName = trackVaultPath.split('/').pop() || 'Unknown Track'; new Notice(`Playing: ${trackName}`); this.updateStatusBar(`Playing: ${trackName}`); }).catch(error => { console.error('Error playing selected track:', error); new Notice(`Failed to play "${trackVaultPath.split('/').pop()}". Check console.`); this.updateStatusBar('Lofi: Playback Error'); }); - } - public playNextTrack(): void { /* ... existing code ... */ - if (!this.audioPlayer || this.playlist.length <= 1) { console.warn('Cannot play next track: Playlist has less than 2 tracks.'); if (this.playlist.length === 0) { new Notice('Cannot play next track: Playlist is empty.'); this.updateStatusBar('Lofi: Playlist Empty'); } else { new Notice('Cannot play next track: Only one track in playlist.'); this.updateStatusBar('Lofi: Single Track'); } return; } - this.currentTrackIndex++; if (this.currentTrackIndex >= this.playlist.length) { this.currentTrackIndex = 0; } - const nextTrackVaultPath = this.playlist[this.currentTrackIndex]; console.log('Playing next track (index):', this.currentTrackIndex, nextTrackVaultPath); this.playTrackByPath(nextTrackVaultPath); - } - public playPreviousTrack(): void { /* ... existing code ... */ - if (!this.audioPlayer || this.playlist.length <= 1) { console.warn('Cannot play previous track: Playlist has less than 2 tracks.'); if (this.playlist.length === 0) { new Notice('Cannot play previous track: Playlist is empty.'); this.updateStatusBar('Lofi: Playlist Empty'); } else { new Notice('Cannot play previous track: Only one track in playlist.'); this.updateStatusBar('Lofi: Single Track'); } return; } - this.currentTrackIndex--; if (this.currentTrackIndex < 0) { this.currentTrackIndex = this.playlist.length - 1; } - const previousTrackVaultPath = this.playlist[this.currentTrackIndex]; console.log('Playing previous track (index):', this.currentTrackIndex, previousTrackVaultPath); this.playTrackByPath(previousTrackVaultPath); - } - public setPlaybackControlsVisibility(visible: boolean): void { /* ... existing code ... */ - if (this.prevButtonEl) { this.prevButtonEl.style.display = visible ? '' : 'none'; } - if (this.playPauseButtonEl) { this.playPauseButtonEl.style.display = visible ? '' : 'none'; } - if (this.nextButtonEl) { this.nextButtonEl.style.display = visible ? '' : 'none'; } - } - public getCurrentTrackIndex(): number { /* ... existing code ... */ - return this.currentTrackIndex; - } - getRandomNumber(min: number = 10000, max: number = 99999) { /* ... existing code ... */ - return Math.floor(Math.random() * (max - min) + min); } + async saveSettings() { + await this.saveData(this.settings); + } - // --- Focus Timer Core Methods --- - public startTimer(): void { /* ... existing code ... */ - if (this.timerState === 'working' || this.timerState === 'resting') { console.log('Timer already running.'); return; } - if (this.timerState === 'stopped') { const workDur = this.settings.workDuration > 0 ? this.settings.workDuration : DEFAULT_LOFI_SETTINGS.workDuration; this.currentSessionType = 'work'; this.remainingTime = workDur * 60; console.log(`Starting new work session (${workDur} minutes).`); new Notice(`Starting work session (${workDur} minutes)!`); } - else if (this.timerState === 'paused') { console.log(`Resuming ${this.currentSessionType} session.`); new Notice(`Resuming ${this.currentSessionType} session!`); } - this.timerState = this.currentSessionType === 'work' ? 'working' : 'resting'; - if (this.timerIntervalId !== null) { clearInterval(this.timerIntervalId); } - this.timerIntervalId = window.setInterval(() => { this.tick(); }, 1000); - this.updateTimerDisplay(); this.updateTimerControls(); this.setTimerControlsVisibility(true); - } - public pauseTimer(): void { /* ... existing code ... */ - if (this.timerState !== 'working' && this.timerState !== 'resting') { console.log('Timer is not running to pause.'); return; } - if (this.timerIntervalId !== null) { clearInterval(this.timerIntervalId); this.timerIntervalId = null; } - this.timerState = 'paused'; console.log('Timer paused.'); new Notice('Timer paused.'); - this.updateTimerDisplay(); this.updateTimerControls(); - } - public resetTimer(): void { /* ... existing code ... */ - if (this.timerState === 'stopped' && this.remainingTime === 0) { console.log('Timer already reset.'); return; } - if (this.timerIntervalId !== null) { clearInterval(this.timerIntervalId); this.timerIntervalId = null; } - this.timerState = 'stopped'; this.remainingTime = 0; this.currentSessionType = 'work'; console.log('Timer reset.'); new Notice('Timer reset.'); - this.updateTimerDisplay(); this.updateTimerControls(); - } - private tick(): void { /* ... existing code ... */ - if (this.timerState === 'working' || this.timerState === 'resting') { - this.remainingTime--; - if (this.remainingTime <= 0) { this.remainingTime = 0; this.endSession(); } - this.updateTimerDisplay(); - } - } - private endSession(): void { /* ... existing code ... */ - if (this.timerIntervalId !== null) { clearInterval(this.timerIntervalId); this.timerIntervalId = null; } - const sessionEndedMessage = `${this.currentSessionType.charAt(0).toUpperCase() + this.currentSessionType.slice(1)} session ended!`; new Notice(sessionEndedMessage); console.log(sessionEndedMessage); - if (this.currentSessionType === 'work') { this.currentSessionType = 'rest'; this.timerState = 'stopped'; this.startTimer(); } - else { this.currentSessionType = 'work'; this.timerState = 'stopped'; this.startTimer(); } - this.updateTimerDisplay(); this.updateTimerControls(); - } - private updateTimerDisplay(): void { /* ... existing code ... */ - if (this.timerDisplayEl) { - const minutes = Math.floor(this.remainingTime / 60); const seconds = this.remainingTime % 60; - const formattedTime = `${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}`; - let displayStatus = ''; - switch (this.timerState) { - case 'stopped': displayStatus = 'Timer: Stopped'; break; - case 'working': displayStatus = `Work: ${formattedTime}`; break; - case 'resting': displayStatus = `Rest: ${formattedTime}`; break; - case 'paused': displayStatus = `${this.currentSessionType.charAt(0).toUpperCase() + this.currentSessionType.slice(1)}: Paused (${formattedTime})`; break; - } - this.timerDisplayEl.setText(displayStatus); - } - } - private updateTimerControls(): void { /* ... existing code ... */ - if (this.timerPlayPauseButtonEl) { - if (this.timerState === 'stopped' || this.timerState === 'paused') { this.timerPlayPauseButtonEl.setText('▶'); this.timerPlayPauseButtonEl.ariaLabel = 'Start Timer'; } - else { this.timerPlayPauseButtonEl.setText('❚❚'); this.timerPlayPauseButtonEl.ariaLabel = 'Pause Timer'; } - this.timerPlayPauseButtonEl.style.display = ''; // Always show play/pause - } - if (this.timerResetButtonEl) { - const isFullyReset = this.timerState === 'stopped' && this.remainingTime === 0; - this.timerResetButtonEl.style.display = isFullyReset ? 'none' : ''; // Hide reset if fully reset - } - } - public setTimerControlsVisibility(visible: boolean): void { /* ... existing code ... */ - // NOTE: updateTimerControls now handles show/hide for reset button when fully reset. - // This method can still be used for a global hide/show if needed later. - if (this.timerDisplayEl) { this.timerDisplayEl.style.display = visible ? '' : 'none'; } - if (this.timerPlayPauseButtonEl) { this.timerPlayPauseButtonEl.style.display = visible ? '' : 'none'; } - if (this.timerResetButtonEl) { // Only hide/show if updateTimerControls isn't hiding it already - const isFullyReset = this.timerState === 'stopped' && this.remainingTime === 0; - if (!isFullyReset || visible) { // Only show if 'visible' is true OR if it's not fully reset - this.timerResetButtonEl.style.display = visible ? '' : 'none'; - } - } - } + private updateStatusBar(text: string) { + if (this.statusBarItemEl) { + this.statusBarItemEl.setText(text); + } + } + public setVolume(volume: number) { + if (this.audioPlayer) { + const clampedVolume = Math.max(0, Math.min(100, volume)); + this.audioPlayer.volume = clampedVolume / 100; + } + } - // --- NEW: Animation Core Methods --- + public togglePlayback(): void { + if (!this.audioPlayer) { + new Notice("Audio player not initialized."); + return; + } - // Private helper to set up the animation canvas element - private setupAnimationCanvas(): void { - // Create a new canvas element - this.animationCanvas = document.createElement('canvas'); + const activeStream = getStreamById(this.settings.activeStreamId); + const isPlayingStream = activeStream && activeStream.id !== "local"; - // Set basic styles to make it a fixed overlay covering the viewport - this.animationCanvas.style.position = 'fixed'; - this.animationCanvas.style.top = '0'; - this.animationCanvas.style.left = '0'; - this.animationCanvas.style.width = '100%'; - this.animationCanvas.style.height = '100%'; - // Set a z-index low enough to be behind Obsidian's UI (panels, modals) but above the background - // Obsidian panels often use z-index > 10. Let's try 0 or 1. - this.animationCanvas.style.zIndex = '0'; // Or '1' if '0' is too low - this.animationCanvas.style.pointerEvents = 'none'; // Make it ignore mouse events so clicks pass through + if (this.audioPlayer.paused) { + this.audioPlayer + .play() + .then(() => { + new Notice("Lofi playing..."); + if (isPlayingStream) { + this.updateStatusBar(`Playing: ${activeStream.name}`); + } else { + const isTrackLoaded = + this.audioPlayer && + this.audioPlayer.src && + this.audioPlayer.src !== window.location.href && + this.playlist.length > 0 && + this.currentTrackIndex !== -1; + if (isTrackLoaded) { + const currentTrackPath = + this.playlist[this.currentTrackIndex]; + const currentTrackName = + currentTrackPath.split("/").pop() || + "Unknown Track"; + this.updateStatusBar( + `Playing: ${currentTrackName}` + ); + } else { + this.updateStatusBar("Lofi Playing..."); + } + } + }) + .catch((error) => { + console.error( + "Error playing audio (togglePlayback):", + error + ); + new Notice("Failed to play Lofi audio. Check console."); + this.updateStatusBar("Lofi Play Error 😢"); + }); + } else { + this.audioPlayer.pause(); + new Notice("Lofi paused."); + if (isPlayingStream) { + this.updateStatusBar(`Paused: ${activeStream.name}`); + } else { + const currentTrackPath = this.playlist[this.currentTrackIndex]; + const currentTrackName = currentTrackPath + ? currentTrackPath.split("/").pop() || "Unknown Track" + : "No Track"; + this.updateStatusBar(`Lofi Paused || ${currentTrackName}`); + } + } + } - // Append the canvas to the document body - document.body.appendChild(this.animationCanvas); + private updatePlayPauseButton(isPlaying: boolean): void { + if (this.playPauseButtonEl) { + this.playPauseButtonEl.setText(isPlaying ? "⏸" : "▶"); + this.playPauseButtonEl.ariaLabel = isPlaying ? "Pause" : "Play"; + } + } - // Get the 2D rendering context for drawing - this.animationContext = this.animationCanvas.getContext('2d'); + public async scanAudioFolder(folderPath: string) { + this.playlist = []; - // Set the canvas dimensions to match the window dimensions initially - this.handleCanvasResize(); - } + const normalizedFolderPath = normalizePath(folderPath); - // Private helper to clean up and remove the animation canvas - private teardownAnimationCanvas(): void { - if (this.animationCanvas && this.animationCanvas.parentElement) { - // Remove the canvas element from the DOM - this.animationCanvas.parentElement.removeChild(this.animationCanvas); - // Clear the references - this.animationCanvas = null; - this.animationContext = null; - } - } + if (this.settings.activeStreamId !== null) { + this.updateStatusBar("Lofi: Stream Active"); + this.setPlaybackControlsVisibility(false); + return; + } - // Handle canvas resizing when the window or workspace is resized - private handleCanvasResize(): void { - if (this.animationCanvas && this.animationContext) { - // Update the canvas's internal drawing buffer size to match its display size - // Use clientWidth/clientHeight which reflect the element's size in the DOM - this.animationCanvas.width = this.animationCanvas.clientWidth; - this.animationCanvas.height = this.animationCanvas.clientHeight; + if (!normalizedFolderPath || normalizedFolderPath === "/") { + this.updateStatusBar("Lofi: No folder set"); + if (this.audioPlayer) { + this.audioPlayer.src = ""; + } + this.currentTrackIndex = -1; + this.setPlaybackControlsVisibility(false); + return; + } - // Optional: If you had elements tied to specific coordinates, - // you might need to reposition or re-create them here upon resize. - // For a simple falling animation, this might not be strictly necessary - // but it's good practice. Let's just log for now. - console.log(`Canvas resized to ${this.animationCanvas.width}x${this.animationCanvas.height}`); + try { + const folder = + this.app.vault.getAbstractFileByPath(normalizedFolderPath); - // Note: If the animation was running, the next frame will draw to the resized canvas. - // If it was paused/stopped, it will be ready for the next start. - } - } + if (folder instanceof TFolder) { + for (const file of folder.children) { + if ( + file instanceof TFile && + file.extension.toLowerCase() === "mp3" + ) { + this.playlist.push(file.path); + } + } + this.updateStatusBar( + `Lofi: ${this.playlist.length} files found` + ); + if (this.playlist.length > 0) { + this.currentTrackIndex = 0; + if (this.audioPlayer) { + const firstTrackVaultPath = + this.playlist[this.currentTrackIndex]; + const firstTrackAppPath = + this.app.vault.adapter.getResourcePath( + firstTrackVaultPath + ); + this.audioPlayer.src = firstTrackAppPath; + const firstTrackName = + firstTrackVaultPath.split("/").pop() || + "Unknown Track"; + this.updateStatusBar(`Lofi Ready || ${firstTrackName}`); + } + this.setPlaybackControlsVisibility(true); + } else { + if (this.audioPlayer) { + this.audioPlayer.src = ""; + } + this.currentTrackIndex = -1; + this.updateStatusBar("Lofi: No local files found"); + this.setPlaybackControlsVisibility(false); + } + } else { + console.error( + "The specified path is not a valid folder:", + normalizedFolderPath + ); + new Notice(`Error: "${folderPath}" is not a valid folder.`); + this.updateStatusBar("Lofi: Invalid folder"); + if (this.audioPlayer) { + this.audioPlayer.src = ""; + } + this.currentTrackIndex = -1; + this.setPlaybackControlsVisibility(false); + } + } catch (error) { + console.error("Error scanning audio folder:", error); + new Notice( + `Error scanning folder "${folderPath}". Check console for details.` + ); + this.updateStatusBar("Lofi: Scan Error"); + if (this.audioPlayer) { + this.audioPlayer.src = ""; + } + this.currentTrackIndex = -1; + this.setPlaybackControlsVisibility(false); + } + } - // Public method to start the animation loop - public startAnimation(): void { - // Only start if animation is enabled in settings and not already running - if (!this.settings.animationEnabled || this.animationFrameId !== null) { - console.log('Animation not enabled or already running.'); - return; - } - if (!this.animationContext) { - console.error('Animation canvas context not available.'); - return; - } + public playTrackByPath(trackVaultPath: string): void { + if (this.settings.activeStreamId !== null) { + new Notice( + "Cannot play local track: A stream is currently active." + ); + return; + } - console.log('Starting animation.'); - this.animatedElements = []; // Clear elements when starting (optional, depends on desired behavior) - this.lastFrameTime = performance.now(); // Initialize last frame time + if (!this.audioPlayer || this.playlist.length === 0) { + new Notice( + "Cannot play track: Audio player not ready or playlist is empty." + ); + this.updateStatusBar("Lofi: Play Error"); + return; + } - // Start the animation loop using requestAnimationFrame - // Pass a reference to the animationLoop method, bound to 'this' plugin instance - this.animationFrameId = requestAnimationFrame(this.animationLoop.bind(this)); + const index = this.playlist.indexOf(trackVaultPath); - // Optional: Show a notice? Probably too intrusive for just starting background animation. - // new Notice('Animation started.'); - } + if (index === -1) { + console.error( + "Attempted to play track not found in playlist:", + trackVaultPath + ); + new Notice("Error: Selected track not found in playlist."); + this.updateStatusBar("Lofi: Track Error"); + return; + } - // Public method to stop the animation loop - public stopAnimation(): void { - // Only stop if animation is currently running - if (this.animationFrameId === null) { - console.log('Animation not running to stop.'); - return; - } + this.currentTrackIndex = index; + const trackAppPath = + this.app.vault.adapter.getResourcePath(trackVaultPath); + this.audioPlayer.src = trackAppPath; - console.log('Stopping animation.'); - // Cancel the animation frame request - cancelAnimationFrame(this.animationFrameId); + this.audioPlayer + .play() + .then(() => { + const trackName = + trackVaultPath.split("/").pop() || "Unknown Track"; + new Notice(`Playing: ${trackName}`); + this.updateStatusBar(`Playing: ${trackName}`); + }) + .catch((error) => { + console.error("Error playing selected track:", error); + new Notice( + `Failed to play "${trackVaultPath + .split("/") + .pop()}". Check console.` + ); + this.updateStatusBar("Lofi: Playback Error"); + }); + } - // Reset the animation frame ID - this.animationFrameId = null; + public playNextTrack(): void { + if (this.settings.activeStreamId !== null) { + return; + } - // Optional: Clear the canvas when stopping - if (this.animationContext && this.animationCanvas) { - this.animationContext.clearRect(0, 0, this.animationCanvas.width, this.animationCanvas.height); - } - // Optional: Show a notice? - // new Notice('Animation stopped.'); - } + if (!this.audioPlayer || this.playlist.length <= 1) { + if (this.playlist.length === 0) { + new Notice("Cannot play next track: Playlist is empty."); + this.updateStatusBar("Lofi: Playlist Empty"); + } else { + new Notice( + "Cannot play next track: Only one track in playlist." + ); + this.updateStatusBar("Lofi: Single Track"); + } + return; + } - // The main animation loop function, called by requestAnimationFrame - private animationLoop(timestamp: number): void { - // Calculate delta time in seconds - const deltaTime = (timestamp - this.lastFrameTime) / 1000; - this.lastFrameTime = timestamp; + this.currentTrackIndex++; + if (this.currentTrackIndex >= this.playlist.length) { + this.currentTrackIndex = 0; + } - if (!this.animationContext || !this.animationCanvas) { - console.error('Animation context or canvas missing during loop.'); - this.stopAnimation(); // Stop the loop if context is lost - return; - } + const nextTrackVaultPath = this.playlist[this.currentTrackIndex]; + this.playTrackByPath(nextTrackVaultPath); + } - const ctx = this.animationContext; - const canvasWidth = this.animationCanvas.width; - const canvasHeight = this.animationCanvas.height; + public playPreviousTrack(): void { + if (this.settings.activeStreamId !== null) { + return; + } - // --- Update --- - // Add new elements periodically (e.g., every few seconds or based on a chance per frame) - // Simple logic: Add a new circle with a small chance each frame - if (Math.random() < 0.5 * deltaTime) { // Adjust 0.5 for density (lower = less frequent) - this.animatedElements.push(this.createAnimatedElement(canvasWidth, canvasHeight)); - } + if (!this.audioPlayer || this.playlist.length <= 1) { + if (this.playlist.length === 0) { + new Notice("Cannot play previous track: Playlist is empty."); + this.updateStatusBar("Lofi: Playlist Empty"); + } else { + new Notice( + "Cannot play previous track: Only one track in playlist." + ); + this.updateStatusBar("Lofi: Single Track"); + } + return; + } - // Update positions and states of existing elements - this.animatedElements.forEach(element => { - this.updateAnimatedElement(element, deltaTime); - }); + this.currentTrackIndex--; + if (this.currentTrackIndex < 0) { + this.currentTrackIndex = this.playlist.length - 1; + } - // Remove elements that have fallen off the screen - this.animatedElements = this.animatedElements.filter(element => element.y - element.radius < canvasHeight); + const previousTrackVaultPath = this.playlist[this.currentTrackIndex]; + this.playTrackByPath(previousTrackVaultPath); + } + public setPlaybackControlsVisibility(visible: boolean): void { + const isLocalSourceActive = this.settings.activeStreamId === null; + const shouldBeVisible = visible && isLocalSourceActive; - // --- Draw --- - // Clear the entire canvas before drawing the new frame - ctx.clearRect(0, 0, canvasWidth, canvasHeight); + if (this.prevButtonEl) { + this.prevButtonEl.style.display = shouldBeVisible ? "" : "none"; + } + if (this.playPauseButtonEl) { + this.playPauseButtonEl.style.display = visible ? "" : "none"; + } + if (this.nextButtonEl) { + this.nextButtonEl.style.display = shouldBeVisible ? "" : "none"; + } + } - // Draw each animated element - this.animatedElements.forEach(element => { - this.drawAnimatedElement(element, ctx); - }); + public getCurrentTrackIndex(): number { + return this.currentTrackIndex; + } + public startTimer(): void { + if (this.timerState === "working" || this.timerState === "resting") { + return; + } + if (this.timerState === "stopped") { + const workDur = + this.settings.workDuration > 0 + ? this.settings.workDuration + : DEFAULT_LOFI_SETTINGS.workDuration; + this.currentSessionType = "work"; + this.remainingTime = workDur * 60; + new Notice(`Starting work session (${workDur} minutes)!`); + } else if (this.timerState === "paused") { + new Notice(`Resuming ${this.currentSessionType} session!`); + } + this.timerState = + this.currentSessionType === "work" ? "working" : "resting"; + if (this.timerIntervalId !== null) { + clearInterval(this.timerIntervalId); + } + this.timerIntervalId = window.setInterval(() => { + this.tick(); + }, 1000); + this.updateTimerDisplay(); + this.updateTimerControls(); + } - // --- Loop --- - // Request the next animation frame, only if the animation is still active - if (this.animationFrameId !== null) { // Check if stopAnimation hasn't cleared the ID - this.animationFrameId = requestAnimationFrame(this.animationLoop.bind(this)); - } - } + public pauseTimer(): void { + if (this.timerState !== "working" && this.timerState !== "resting") { + return; + } + if (this.timerIntervalId !== null) { + clearInterval(this.timerIntervalId); + this.timerIntervalId = null; + } + this.timerState = "paused"; + new Notice("Timer paused."); + this.updateTimerDisplay(); + this.updateTimerControls(); + } - // Helper to create a single animated element (e.g., a falling circle) - private createAnimatedElement(canvasWidth: number, canvasHeight: number): AnimatedElement { - const radius = Math.random() * 3 + 1; // Random size between 1 and 4 - const speed = Math.random() * 50 + 30; // Random speed between 30 and 80 pixels/second - // Start at a random x position slightly above the top of the canvas - const startX = Math.random() * canvasWidth; - const startY = -radius; // Start just above the top edge + public resetTimer(): void { + if (this.timerState === "stopped" && this.remainingTime === 0) { + return; + } + if (this.timerIntervalId !== null) { + clearInterval(this.timerIntervalId); + this.timerIntervalId = null; + } + this.timerState = "stopped"; + this.remainingTime = 0; + this.currentSessionType = "work"; + new Notice("Timer reset."); + this.updateTimerDisplay(); + this.updateTimerControls(); + } - // Simple random color with transparency (e.g., shades of orange/yellow/red for leaves, blue/grey for rain) - const hue = Math.random() * 60; // Hue between 0 (red) and 60 (yellow) for leaf-like colors - const color = `hsla(${hue}, 70%, 50%, ${Math.random() * 0.3 + 0.2})`; // HSL color with random opacity (0.2 to 0.5) + private tick(): void { + if (this.timerState === "working" || this.timerState === "resting") { + this.remainingTime--; + if (this.remainingTime <= 0) { + this.remainingTime = 0; + this.endSession(); + } + this.updateTimerDisplay(); + } + } - // For rain, you might use blue/grey hues: `hsla(200, ${Math.random() * 30 + 50}%, ${Math.random() * 20 + 70}%, ${Math.random() * 0.3 + 0.5})`; + private endSession(): void { + if (this.timerIntervalId !== null) { + clearInterval(this.timerIntervalId); + this.timerIntervalId = null; + } + const sessionEndedMessage = `${ + this.currentSessionType.charAt(0).toUpperCase() + + this.currentSessionType.slice(1) + } session ended!`; + new Notice(sessionEndedMessage); + if (this.currentSessionType === "work") { + this.currentSessionType = "rest"; + this.timerState = "stopped"; + this.startTimer(); + } else { + const workDur = + this.settings.workDuration > 0 + ? this.settings.workDuration + : DEFAULT_LOFI_SETTINGS.workDuration; + this.currentSessionType = "work"; + this.timerState = "stopped"; + this.startTimer(); + } + this.updateTimerDisplay(); + this.updateTimerControls(); + } + private updateTimerDisplay(): void { + if (this.timerDisplayEl) { + const minutes = Math.floor(this.remainingTime / 60); + const seconds = this.remainingTime % 60; + const formattedTime = `${String(minutes).padStart(2, "0")}:${String( + seconds + ).padStart(2, "0")}`; + let displayStatus = ""; + switch (this.timerState) { + case "stopped": + displayStatus = "Timer: Stopped"; + break; + case "working": + displayStatus = `Work: ${formattedTime}`; + break; + case "resting": + displayStatus = `Rest: ${formattedTime}`; + break; + case "paused": + displayStatus = `${ + this.currentSessionType.charAt(0).toUpperCase() + + this.currentSessionType.slice(1) + }: Paused (${formattedTime})`; + break; + } + this.timerDisplayEl.setText(displayStatus); + } + } - return { - x: startX, - y: startY, - radius: radius, - speed: speed, - color: color, - }; - } + private updateTimerControls(): void { + if (this.timerPlayPauseButtonEl) { + if (this.timerState === "stopped" || this.timerState === "paused") { + this.timerPlayPauseButtonEl.setText("▶"); + this.timerPlayPauseButtonEl.ariaLabel = "Start Timer"; + } else { + this.timerPlayPauseButtonEl.setText("⏸"); + this.timerPlayPauseButtonEl.ariaLabel = "Pause Timer"; + } + this.timerPlayPauseButtonEl.style.display = ""; + } + if (this.timerResetButtonEl) { + const isFullyReset = + this.timerState === "stopped" && this.remainingTime === 0; + this.timerResetButtonEl.style.display = isFullyReset ? "none" : ""; + } + } - // Helper to update the state of an animated element for the next frame - private updateAnimatedElement(element: AnimatedElement, deltaTime: number): void { - // Update y position based on speed and delta time - element.y += element.speed * deltaTime; + public setTimerControlsVisibility(visible: boolean): void { + if (this.timerDisplayEl) { + this.timerDisplayEl.style.display = visible ? "" : "none"; + } + if (this.timerPlayPauseButtonEl) { + this.timerPlayPauseButtonEl.style.display = visible ? "" : "none"; + } + if (this.timerResetButtonEl) { + const isFullyReset = + this.timerState === "stopped" && this.remainingTime === 0; + if (visible && !isFullyReset) { + this.timerResetButtonEl.style.display = ""; + } else { + this.timerResetButtonEl.style.display = "none"; + } + } + } - // Optional: Add horizontal sway or other effects here - // element.x += Math.sin(element.y / 100) * 0.5; // Simple sine wave sway - } + private setupAnimationCanvas(): void { + this.animationCanvas = document.createElement("canvas"); + this.animationCanvas.style.position = "fixed"; + this.animationCanvas.style.top = "0"; + this.animationCanvas.style.left = "0"; + this.animationCanvas.style.width = "100%"; + this.animationCanvas.style.height = "100%"; + this.animationCanvas.style.zIndex = "0"; + this.animationCanvas.style.pointerEvents = "none"; + this.animationCanvas.classList.add("lofi-animation-canvas"); + document.body.appendChild(this.animationCanvas); + this.animationContext = this.animationCanvas.getContext("2d"); + this.handleCanvasResize(); + } - // Helper to draw a single animated element on the canvas - private drawAnimatedElement(element: AnimatedElement, context: CanvasRenderingContext2D): void { - context.fillStyle = element.color; // Set the drawing color (including transparency) - context.beginPath(); // Start drawing a new shape - // Draw a circle (arc from 0 to 2*PI) - context.arc(element.x, element.y, element.radius, 0, Math.PI * 2); - context.fill(); // Fill the circle with the current fillStyle - } + private teardownAnimationCanvas(): void { + if (this.animationCanvas && this.animationCanvas.parentElement) { + this.animationCanvas.parentElement.removeChild( + this.animationCanvas + ); + this.animationCanvas = null; + this.animationContext = null; + } + } - // Controls the visibility of the timer status bar items. - public setTimerControlsVisibility(visible: boolean): void { /* ... existing code ... */ - if (this.timerDisplayEl) { this.timerDisplayEl.style.display = visible ? '' : 'none'; } - if (this.timerPlayPauseButtonEl) { this.timerPlayPauseButtonEl.style.display = visible ? '' : 'none'; } - if (this.timerResetButtonEl) { - const isFullyReset = this.timerState === 'stopped' && this.remainingTime === 0; - if (!isFullyReset || visible) { // Only show if 'visible' is true OR if it's not fully reset - this.timerResetButtonEl.style.display = visible ? '' : 'none'; - } - } - } - // --- END NEW: Animation Core Methods --- + private handleCanvasResize(): void { + if (this.animationCanvas && this.animationContext) { + this.animationCanvas.width = this.animationCanvas.clientWidth; + this.animationCanvas.height = this.animationCanvas.clientHeight; + } + } -} \ No newline at end of file + public startAnimation(): void { + if (!this.settings.animationEnabled || this.animationFrameId !== null) { + return; + } + if (!this.animationContext || !this.animationCanvas) { + console.error("Animation canvas context not available."); + this.setupAnimationCanvas(); + if (!this.animationContext) return; + } + this.lastFrameTime = performance.now(); + this.animationFrameId = requestAnimationFrame( + this.animationLoop.bind(this) + ); + } + + public stopAnimation(): void { + if (this.animationFrameId === null) { + return; + } + cancelAnimationFrame(this.animationFrameId); + this.animationFrameId = null; + if (this.animationContext && this.animationCanvas) { + this.animationContext.clearRect( + 0, + 0, + this.animationCanvas.width, + this.animationCanvas.height + ); + } + this.animatedElements = []; + } + + private animationLoop(timestamp: number): void { + const deltaTime = (timestamp - this.lastFrameTime) / 1000; + this.lastFrameTime = timestamp; + if (!this.animationContext || !this.animationCanvas) { + console.error("Animation context or canvas missing during loop."); + this.stopAnimation(); + return; + } + const ctx = this.animationContext; + const canvasWidth = this.animationCanvas.width; + const canvasHeight = this.animationCanvas.height; + + const numElementsToSpawn = Math.floor( + this.animationSpawnRate * deltaTime + ); + for (let i = 0; i < numElementsToSpawn; i++) { + this.animatedElements.push( + this.createAnimatedElement(canvasWidth, canvasHeight) + ); + } + this.animatedElements.forEach((element) => { + this.updateAnimatedElement(element, deltaTime); + }); + this.animatedElements = this.animatedElements.filter( + (element) => element.y - element.radius < canvasHeight + ); + + ctx.clearRect(0, 0, canvasWidth, canvasHeight); + this.animatedElements.forEach((element) => { + this.drawAnimatedElement(element, ctx); + }); + + if (this.animationFrameId !== null) { + this.animationFrameId = requestAnimationFrame( + this.animationLoop.bind(this) + ); + } + } + + private createAnimatedElement( + canvasWidth: number, + canvasHeight: number + ): AnimatedElement { + const radius = Math.random() * 3 + 1; + const speed = Math.random() * 50 + 30; + const startX = Math.random() * canvasWidth; + const startY = -radius; + const hue = Math.random() * 60; + const color = `hsla(${hue}, 70%, 50%, ${Math.random() * 0.3 + 0.2})`; + return { + x: startX, + y: startY, + radius: radius, + speed: speed, + color: color, + }; + } + + private updateAnimatedElement( + element: AnimatedElement, + deltaTime: number + ): void { + element.y += element.speed * deltaTime; + } + + private drawAnimatedElement( + element: AnimatedElement, + context: CanvasRenderingContext2D + ): void { + context.fillStyle = element.color; + context.beginPath(); + context.arc(element.x, element.y, element.radius, 0, Math.PI * 2); + context.fill(); + } + + public async activateStream(streamId: string | null): Promise { + if (this.audioPlayer && !this.audioPlayer.paused) { + this.audioPlayer.pause(); + } + if (this.audioPlayer) { + this.audioPlayer.src = ""; + } + + this.playlist = []; + this.currentTrackIndex = -1; + + const selectedStream = getStreamById(streamId); + + if (selectedStream && selectedStream.id !== "local") { + this.settings.activeStreamId = selectedStream.id; + + if (this.audioPlayer) { + this.audioPlayer.src = selectedStream.url; + this.audioPlayer + .play() + .then(() => { + new Notice(`Playing stream: ${selectedStream.name}`); + this.updateStatusBar(`Stream: ${selectedStream.name}`); + this.setPlaybackControlsVisibility(true); + }) + .catch((error) => { + console.error("Error playing stream:", error); + new Notice( + `Failed to play stream: ${selectedStream.name}. Check console.` + ); + this.updateStatusBar( + `Stream Error: ${selectedStream.name}` + ); + this.setPlaybackControlsVisibility(true); + }); + } else { + console.error("Audio player not initialized to play stream."); + new Notice("Audio player error. Cannot play stream."); + this.updateStatusBar("Lofi Error"); + this.setPlaybackControlsVisibility(true); + } + } else { + this.settings.activeStreamId = null; + this.updateStatusBar("Lofi: Loading local files..."); + await this.scanAudioFolder(this.settings.audioFolderPath); + } + + await this.saveSettings(); + } +} diff --git a/manifest.json b/manifest.json index 163c5ce..3af4f52 100644 --- a/manifest.json +++ b/manifest.json @@ -1,11 +1,11 @@ { - "id": "Obsidian-lofi-plugin", - "name": "Obsidian Lofi Flow", + "id": "lofi-focus", + "name": "Lofi Focus", "version": "1.0.1", "minAppVersion": "0.15.0", - "description": "Demonstrates some of the capabilities of the Obsidian API.", - "author": "Obsidian", - "authorUrl": "https://obsidian.md", - "fundingUrl": "https://obsidian.md/pricing", + "description": "Play lofi music and stay focused with an integrated Pomodoro timer. Features local MP3 playback, online streams, and ambient animations.", + "author": "Jatin Shihora", + "authorUrl": "https://github.com/Jatin-Shihora", + "fundingUrl": "https://github.com/Jatin-Shihora/Obsidian-lofi-plugin", "isDesktopOnly": false } diff --git a/modal.ts b/modal.ts index b6f4ede..d1be0e4 100644 --- a/modal.ts +++ b/modal.ts @@ -1,19 +1,17 @@ -import { App, Modal } from 'obsidian'; // Import necessary types from obsidian +import { App, Modal } from "obsidian"; -// Modal class (kept from sample template, can be renamed/modified later if needed) -// Currently not used by the plugin's logic. -export class SampleModal extends Modal { // Export the class so main.ts can import it +export class SampleModal extends Modal { constructor(app: App) { super(app); } onOpen() { - const {contentEl} = this; // Get the content element of the modal - contentEl.setText('Lofi Modal - (Content Coming Soon)'); // Set the text content + const { contentEl } = this; + contentEl.setText("Lofi Modal - (Content Coming Soon)"); } onClose() { - const {contentEl} = this; // Get the content element - contentEl.empty(); // Clear the content when modal is closed + const { contentEl } = this; + contentEl.empty(); } -} \ No newline at end of file +} diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..b27b458 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,2227 @@ +{ + "name": "obsidian-sample-plugin", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "obsidian-sample-plugin", + "version": "1.0.0", + "license": "MIT", + "devDependencies": { + "@types/node": "^16.11.6", + "@typescript-eslint/eslint-plugin": "5.29.0", + "@typescript-eslint/parser": "5.29.0", + "builtin-modules": "3.3.0", + "esbuild": "0.17.3", + "obsidian": "latest", + "tslib": "2.4.0", + "typescript": "4.7.4" + } + }, + "node_modules/@codemirror/state": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/@codemirror/state/-/state-6.5.2.tgz", + "integrity": "sha512-FVqsPqtPWKVVL3dPSxy8wEF/ymIEuVzF1PK3VbUgrxXpJUSHQWWZz4JMToquRxnkw+36LTamCZG2iua2Ptq0fA==", + "dev": true, + "peer": true, + "dependencies": { + "@marijn/find-cluster-break": "^1.0.0" + } + }, + "node_modules/@codemirror/view": { + "version": "6.36.5", + "resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.36.5.tgz", + "integrity": "sha512-cd+FZEUlu3GQCYnguYm3EkhJ8KJVisqqUsCOKedBoAt/d9c76JUUap6U0UrpElln5k6VyrEOYliMuDAKIeDQLg==", + "dev": true, + "peer": true, + "dependencies": { + "@codemirror/state": "^6.5.0", + "style-mod": "^4.1.0", + "w3c-keyname": "^2.2.4" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.17.3.tgz", + "integrity": "sha512-1Mlz934GvbgdDmt26rTLmf03cAgLg5HyOgJN+ZGCeP3Q9ynYTNMn2/LQxIl7Uy+o4K6Rfi2OuLsr12JQQR8gNg==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.17.3.tgz", + "integrity": "sha512-XvJsYo3dO3Pi4kpalkyMvfQsjxPWHYjoX4MDiB/FUM4YMfWcXa5l4VCwFWVYI1+92yxqjuqrhNg0CZg3gSouyQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.17.3.tgz", + "integrity": "sha512-nuV2CmLS07Gqh5/GrZLuqkU9Bm6H6vcCspM+zjp9TdQlxJtIe+qqEXQChmfc7nWdyr/yz3h45Utk1tUn8Cz5+A==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.17.3.tgz", + "integrity": "sha512-01Hxaaat6m0Xp9AXGM8mjFtqqwDjzlMP0eQq9zll9U85ttVALGCGDuEvra5Feu/NbP5AEP1MaopPwzsTcUq1cw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.17.3.tgz", + "integrity": "sha512-Eo2gq0Q/er2muf8Z83X21UFoB7EU6/m3GNKvrhACJkjVThd0uA+8RfKpfNhuMCl1bKRfBzKOk6xaYKQZ4lZqvA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.3.tgz", + "integrity": "sha512-CN62ESxaquP61n1ZjQP/jZte8CE09M6kNn3baos2SeUfdVBkWN5n6vGp2iKyb/bm/x4JQzEvJgRHLGd5F5b81w==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.17.3.tgz", + "integrity": "sha512-feq+K8TxIznZE+zhdVurF3WNJ/Sa35dQNYbaqM/wsCbWdzXr5lyq+AaTUSER2cUR+SXPnd/EY75EPRjf4s1SLg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.17.3.tgz", + "integrity": "sha512-CLP3EgyNuPcg2cshbwkqYy5bbAgK+VhyfMU7oIYyn+x4Y67xb5C5ylxsNUjRmr8BX+MW3YhVNm6Lq6FKtRTWHQ==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.17.3.tgz", + "integrity": "sha512-JHeZXD4auLYBnrKn6JYJ0o5nWJI9PhChA/Nt0G4MvLaMrvXuWnY93R3a7PiXeJQphpL1nYsaMcoV2QtuvRnF/g==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.17.3.tgz", + "integrity": "sha512-FyXlD2ZjZqTFh0sOQxFDiWG1uQUEOLbEh9gKN/7pFxck5Vw0qjWSDqbn6C10GAa1rXJpwsntHcmLqydY9ST9ZA==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.17.3.tgz", + "integrity": "sha512-OrDGMvDBI2g7s04J8dh8/I7eSO+/E7nMDT2Z5IruBfUO/RiigF1OF6xoH33Dn4W/OwAWSUf1s2nXamb28ZklTA==", + "cpu": [ + "loong64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.17.3.tgz", + "integrity": "sha512-DcnUpXnVCJvmv0TzuLwKBC2nsQHle8EIiAJiJ+PipEVC16wHXaPEKP0EqN8WnBe0TPvMITOUlP2aiL5YMld+CQ==", + "cpu": [ + "mips64el" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.17.3.tgz", + "integrity": "sha512-BDYf/l1WVhWE+FHAW3FzZPtVlk9QsrwsxGzABmN4g8bTjmhazsId3h127pliDRRu5674k1Y2RWejbpN46N9ZhQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.17.3.tgz", + "integrity": "sha512-WViAxWYMRIi+prTJTyV1wnqd2mS2cPqJlN85oscVhXdb/ZTFJdrpaqm/uDsZPGKHtbg5TuRX/ymKdOSk41YZow==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.17.3.tgz", + "integrity": "sha512-Iw8lkNHUC4oGP1O/KhumcVy77u2s6+KUjieUqzEU3XuWJqZ+AY7uVMrrCbAiwWTkpQHkr00BuXH5RpC6Sb/7Ug==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.17.3.tgz", + "integrity": "sha512-0AGkWQMzeoeAtXQRNB3s4J1/T2XbigM2/Mn2yU1tQSmQRmHIZdkGbVq2A3aDdNslPyhb9/lH0S5GMTZ4xsjBqg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.17.3.tgz", + "integrity": "sha512-4+rR/WHOxIVh53UIQIICryjdoKdHsFZFD4zLSonJ9RRw7bhKzVyXbnRPsWSfwybYqw9sB7ots/SYyufL1mBpEg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.17.3.tgz", + "integrity": "sha512-cVpWnkx9IYg99EjGxa5Gc0XmqumtAwK3aoz7O4Dii2vko+qXbkHoujWA68cqXjhh6TsLaQelfDO4MVnyr+ODeA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.17.3.tgz", + "integrity": "sha512-RxmhKLbTCDAY2xOfrww6ieIZkZF+KBqG7S2Ako2SljKXRFi+0863PspK74QQ7JpmWwncChY25JTJSbVBYGQk2Q==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.17.3.tgz", + "integrity": "sha512-0r36VeEJ4efwmofxVJRXDjVRP2jTmv877zc+i+Pc7MNsIr38NfsjkQj23AfF7l0WbB+RQ7VUb+LDiqC/KY/M/A==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.17.3.tgz", + "integrity": "sha512-wgO6rc7uGStH22nur4aLFcq7Wh86bE9cOFmfTr/yxN3BXvDEdCSXyKkO+U5JIt53eTOgC47v9k/C1bITWL/Teg==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.17.3.tgz", + "integrity": "sha512-FdVl64OIuiKjgXBjwZaJLKp0eaEckifbhn10dXWhysMJkWblg3OEEGKSIyhiD5RSgAya8WzP3DNkngtIg3Nt7g==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.6.1", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.6.1.tgz", + "integrity": "sha512-KTsJMmobmbrFLe3LDh0PC2FXpcSYJt/MLjlkh/9LEnmKYLSYmT/0EW9JWANjeoemiuZrmogti0tW5Ch+qNUYDw==", + "dev": true, + "peer": true, + "dependencies": { + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.1.tgz", + "integrity": "sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==", + "dev": true, + "peer": true, + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", + "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", + "dev": true, + "peer": true, + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.6.0", + "globals": "^13.19.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/js": { + "version": "8.57.1", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.1.tgz", + "integrity": "sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==", + "dev": true, + "peer": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/@humanwhocodes/config-array": { + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.13.0.tgz", + "integrity": "sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw==", + "deprecated": "Use @eslint/config-array instead", + "dev": true, + "peer": true, + "dependencies": { + "@humanwhocodes/object-schema": "^2.0.3", + "debug": "^4.3.1", + "minimatch": "^3.0.5" + }, + "engines": { + "node": ">=10.10.0" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "peer": true, + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/object-schema": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz", + "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==", + "deprecated": "Use @eslint/object-schema instead", + "dev": true, + "peer": true + }, + "node_modules/@marijn/find-cluster-break": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@marijn/find-cluster-break/-/find-cluster-break-1.0.2.tgz", + "integrity": "sha512-l0h88YhZFyKdXIFNfSWpyjStDjGHwZ/U7iobcK1cQQD8sejsONdQtTVU+1wVN1PBw40PiiHB1vA5S7VTfQiP9g==", + "dev": true, + "peer": true + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@types/codemirror": { + "version": "5.60.8", + "resolved": "https://registry.npmjs.org/@types/codemirror/-/codemirror-5.60.8.tgz", + "integrity": "sha512-VjFgDF/eB+Aklcy15TtOTLQeMjTo07k7KAjql8OK5Dirr7a6sJY4T1uVBDuTVG9VEmn1uUsohOpYnVfgC6/jyw==", + "dev": true, + "dependencies": { + "@types/tern": "*" + } + }, + "node_modules/@types/estree": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.7.tgz", + "integrity": "sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ==", + "dev": true + }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true + }, + "node_modules/@types/node": { + "version": "16.18.126", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.126.tgz", + "integrity": "sha512-OTcgaiwfGFBKacvfwuHzzn1KLxH/er8mluiy8/uM3sGXHaRe73RrSIj01jow9t4kJEW633Ov+cOexXeiApTyAw==", + "dev": true + }, + "node_modules/@types/tern": { + "version": "0.23.9", + "resolved": "https://registry.npmjs.org/@types/tern/-/tern-0.23.9.tgz", + "integrity": "sha512-ypzHFE/wBzh+BlH6rrBgS5I/Z7RD21pGhZ2rltb/+ZrVM1awdZwjx7hE5XfuYgHWk9uvV5HLZN3SloevCAp3Bw==", + "dev": true, + "dependencies": { + "@types/estree": "*" + } + }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "5.29.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.29.0.tgz", + "integrity": "sha512-kgTsISt9pM53yRFQmLZ4npj99yGl3x3Pl7z4eA66OuTzAGC4bQB5H5fuLwPnqTKU3yyrrg4MIhjF17UYnL4c0w==", + "dev": true, + "dependencies": { + "@typescript-eslint/scope-manager": "5.29.0", + "@typescript-eslint/type-utils": "5.29.0", + "@typescript-eslint/utils": "5.29.0", + "debug": "^4.3.4", + "functional-red-black-tree": "^1.0.1", + "ignore": "^5.2.0", + "regexpp": "^3.2.0", + "semver": "^7.3.7", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^5.0.0", + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "5.29.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.29.0.tgz", + "integrity": "sha512-ruKWTv+x0OOxbzIw9nW5oWlUopvP/IQDjB5ZqmTglLIoDTctLlAJpAQFpNPJP/ZI7hTT9sARBosEfaKbcFuECw==", + "dev": true, + "dependencies": { + "@typescript-eslint/scope-manager": "5.29.0", + "@typescript-eslint/types": "5.29.0", + "@typescript-eslint/typescript-estree": "5.29.0", + "debug": "^4.3.4" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "5.29.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.29.0.tgz", + "integrity": "sha512-etbXUT0FygFi2ihcxDZjz21LtC+Eps9V2xVx09zFoN44RRHPrkMflidGMI+2dUs821zR1tDS6Oc9IXxIjOUZwA==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "5.29.0", + "@typescript-eslint/visitor-keys": "5.29.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "5.29.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.29.0.tgz", + "integrity": "sha512-JK6bAaaiJozbox3K220VRfCzLa9n0ib/J+FHIwnaV3Enw/TO267qe0pM1b1QrrEuy6xun374XEAsRlA86JJnyg==", + "dev": true, + "dependencies": { + "@typescript-eslint/utils": "5.29.0", + "debug": "^4.3.4", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "*" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/types": { + "version": "5.29.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.29.0.tgz", + "integrity": "sha512-X99VbqvAXOMdVyfFmksMy3u8p8yoRGITgU1joBJPzeYa0rhdf5ok9S56/itRoUSh99fiDoMtarSIJXo7H/SnOg==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "5.29.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.29.0.tgz", + "integrity": "sha512-mQvSUJ/JjGBdvo+1LwC+GY2XmSYjK1nAaVw2emp/E61wEVYEyibRHCqm1I1vEKbXCpUKuW4G7u9ZCaZhJbLoNQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "5.29.0", + "@typescript-eslint/visitor-keys": "5.29.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "semver": "^7.3.7", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "5.29.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.29.0.tgz", + "integrity": "sha512-3Eos6uP1nyLOBayc/VUdKZikV90HahXE5Dx9L5YlSd/7ylQPXhLk1BYb29SDgnBnTp+jmSZUU0QxUiyHgW4p7A==", + "dev": true, + "dependencies": { + "@types/json-schema": "^7.0.9", + "@typescript-eslint/scope-manager": "5.29.0", + "@typescript-eslint/types": "5.29.0", + "@typescript-eslint/typescript-estree": "5.29.0", + "eslint-scope": "^5.1.1", + "eslint-utils": "^3.0.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "5.29.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.29.0.tgz", + "integrity": "sha512-Hpb/mCWsjILvikMQoZIE3voc9wtQcS0A9FUw3h8bhr9UxBdtI/tw1ZDZUOXHXLOVMedKCH5NxyzATwnU78bWCQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "5.29.0", + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@ungap/structured-clone": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz", + "integrity": "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==", + "dev": true, + "peer": true + }, + "node_modules/acorn": { + "version": "8.14.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.1.tgz", + "integrity": "sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg==", + "dev": true, + "peer": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "peer": true, + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "peer": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "peer": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true, + "peer": true + }, + "node_modules/array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "peer": true + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "peer": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/builtin-modules": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.3.0.tgz", + "integrity": "sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==", + "dev": true, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "peer": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "peer": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "peer": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "peer": true + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true, + "peer": true + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, + "peer": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", + "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", + "dev": true, + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true, + "peer": true + }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "peer": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/esbuild": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.17.3.tgz", + "integrity": "sha512-9n3AsBRe6sIyOc6kmoXg2ypCLgf3eZSraWFRpnkto+svt8cZNuKTkb1bhQcitBcvIqjNiK7K0J3KPmwGSfkA8g==", + "dev": true, + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/android-arm": "0.17.3", + "@esbuild/android-arm64": "0.17.3", + "@esbuild/android-x64": "0.17.3", + "@esbuild/darwin-arm64": "0.17.3", + "@esbuild/darwin-x64": "0.17.3", + "@esbuild/freebsd-arm64": "0.17.3", + "@esbuild/freebsd-x64": "0.17.3", + "@esbuild/linux-arm": "0.17.3", + "@esbuild/linux-arm64": "0.17.3", + "@esbuild/linux-ia32": "0.17.3", + "@esbuild/linux-loong64": "0.17.3", + "@esbuild/linux-mips64el": "0.17.3", + "@esbuild/linux-ppc64": "0.17.3", + "@esbuild/linux-riscv64": "0.17.3", + "@esbuild/linux-s390x": "0.17.3", + "@esbuild/linux-x64": "0.17.3", + "@esbuild/netbsd-x64": "0.17.3", + "@esbuild/openbsd-x64": "0.17.3", + "@esbuild/sunos-x64": "0.17.3", + "@esbuild/win32-arm64": "0.17.3", + "@esbuild/win32-ia32": "0.17.3", + "@esbuild/win32-x64": "0.17.3" + } + }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "peer": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint": { + "version": "8.57.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.1.tgz", + "integrity": "sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA==", + "deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.", + "dev": true, + "peer": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.6.1", + "@eslint/eslintrc": "^2.1.4", + "@eslint/js": "8.57.1", + "@humanwhocodes/config-array": "^0.13.0", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "@ungap/structured-clone": "^1.2.0", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.2.2", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1", + "esquery": "^1.4.2", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "graphemer": "^1.4.0", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3", + "strip-ansi": "^6.0.1", + "text-table": "^0.2.0" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/eslint-utils": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", + "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^2.0.0" + }, + "engines": { + "node": "^10.0.0 || ^12.0.0 || >= 14.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + }, + "peerDependencies": { + "eslint": ">=5" + } + }, + "node_modules/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/eslint-scope": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", + "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", + "dev": true, + "peer": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "peer": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/espree": { + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", + "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", + "dev": true, + "peer": true, + "dependencies": { + "acorn": "^8.9.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esquery": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", + "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", + "dev": true, + "peer": true, + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esquery/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "peer": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esrecurse/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true, + "peer": true + }, + "node_modules/fast-glob": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", + "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.8" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-glob/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true, + "peer": true + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true, + "peer": true + }, + "node_modules/fastq": { + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.1.tgz", + "integrity": "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==", + "dev": true, + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "peer": true, + "dependencies": { + "flat-cache": "^3.0.4" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "peer": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat-cache": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz", + "integrity": "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==", + "dev": true, + "peer": true, + "dependencies": { + "flatted": "^3.2.9", + "keyv": "^4.5.3", + "rimraf": "^3.0.2" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/flatted": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.3.tgz", + "integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==", + "dev": true, + "peer": true + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true, + "peer": true + }, + "node_modules/functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==", + "dev": true + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "dev": true, + "peer": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "peer": true, + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/globals": { + "version": "13.24.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", + "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", + "dev": true, + "peer": true, + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dev": true, + "dependencies": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true, + "peer": true + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", + "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", + "dev": true, + "peer": true, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "peer": true, + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", + "dev": true, + "peer": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true, + "peer": true + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true, + "peer": true + }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "peer": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true, + "peer": true + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true, + "peer": true + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true, + "peer": true + }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "peer": true, + "dependencies": { + "json-buffer": "3.0.1" + } + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "peer": true, + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "peer": true, + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true, + "peer": true + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dev": true, + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "peer": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/moment": { + "version": "2.29.4", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz", + "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true, + "peer": true + }, + "node_modules/obsidian": { + "version": "1.8.7", + "resolved": "https://registry.npmjs.org/obsidian/-/obsidian-1.8.7.tgz", + "integrity": "sha512-h4bWwNFAGRXlMlMAzdEiIM2ppTGlrh7uGOJS6w4gClrsjc+ei/3YAtU2VdFUlCiPuTHpY4aBpFJJW75S1Tl/JA==", + "dev": true, + "dependencies": { + "@types/codemirror": "5.60.8", + "moment": "2.29.4" + }, + "peerDependencies": { + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.0.0" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "peer": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "peer": true, + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "peer": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "peer": true, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "peer": true, + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "peer": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "peer": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/regexpp": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", + "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + } + }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "peer": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/reusify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", + "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", + "dev": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", + "dev": true, + "peer": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/semver": { + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", + "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "peer": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "peer": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "peer": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/style-mod": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/style-mod/-/style-mod-4.1.2.tgz", + "integrity": "sha512-wnD1HyVqpJUI2+eKZ+eo1UwghftP6yuFheBqqe+bWCotBjC2K1YnteJILRMs3SM4V/0dLEW1SC27MWP5y+mwmw==", + "dev": true, + "peer": true + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "peer": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "dev": true, + "peer": true + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/tslib": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==", + "dev": true + }, + "node_modules/tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "dependencies": { + "tslib": "^1.8.1" + }, + "engines": { + "node": ">= 6" + }, + "peerDependencies": { + "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" + } + }, + "node_modules/tsutils/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "peer": true, + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "peer": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/typescript": { + "version": "4.7.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz", + "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "peer": true, + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/w3c-keyname": { + "version": "2.2.8", + "resolved": "https://registry.npmjs.org/w3c-keyname/-/w3c-keyname-2.2.8.tgz", + "integrity": "sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==", + "dev": true, + "peer": true + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "peer": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true, + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true, + "peer": true + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "peer": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + } + } +} diff --git a/settings-tab.ts b/settings-tab.ts index d01df0f..a1d5b1a 100644 --- a/settings-tab.ts +++ b/settings-tab.ts @@ -1,331 +1,416 @@ -// src/settings-tab.ts - import { - App, - PluginSettingTab, - Setting, - Notice, - normalizePath, - TFolder, - TFile, - TAbstractFile, -} from 'obsidian'; - -import LofiPlugin from './main'; -import { LofiPluginSettings } from './types'; + App, + PluginSettingTab, + Setting, + Notice, + normalizePath, + TFolder, + TFile, + TAbstractFile, +} from "obsidian"; +import LofiPlugin from "./main"; +import { LofiPluginSettings } from "./types"; +import { PREDEFINED_LOFI_STREAMS } from "./streams"; export class LofiSettingTab extends PluginSettingTab { plugin: LofiPlugin; - private currentBrowsePath: string; - private folderListEl: HTMLElement; - private currentPathEl: HTMLElement; - private trackListEl: HTMLElement; + private currentBrowsePath: string; + private folderListEl: HTMLElement; + private currentPathEl: HTMLElement; + private trackListEl: HTMLElement; constructor(app: App, plugin: LofiPlugin) { super(app, plugin); this.plugin = plugin; - this.currentBrowsePath = normalizePath(this.plugin.settings.audioFolderPath || ''); + this.currentBrowsePath = normalizePath( + this.plugin.settings.audioFolderPath || "" + ); } display(): void { - const {containerEl} = this; + const { containerEl } = this; containerEl.empty(); - containerEl.createEl('h2', {text: 'Lofi Plugin Settings'}); + containerEl.createEl("h2", { text: "Lofi Plugin Settings" }); - // --- Audio Settings Section --- - containerEl.createEl('h3', {text: 'Audio Settings'}); + containerEl.createEl("h3", { text: "Audio Settings" }); + containerEl.createEl("h4", { text: "Audio Source" }); + + const streamOptions: Record = {}; + PREDEFINED_LOFI_STREAMS.forEach((stream) => { + streamOptions[stream.id] = stream.name; + }); - // Sample Setting (can be removed) new Setting(containerEl) - .setName('Sample Setting') - .setDesc('This is a placeholder setting.') - .addText(text => text - .setPlaceholder('Enter something...') - .setValue(this.plugin.settings.mySetting) - .onChange(async (value) => { - this.plugin.settings.mySetting = value; - await this.plugin.saveSettings(); - })); + .setName("Select Audio Source") + .setDesc( + "Choose between playing local files or a predefined online stream." + ) + .addDropdown((dropdown) => + dropdown + .addOptions(streamOptions) + .setValue(this.plugin.settings.activeStreamId || "local") + .onChange(async (value) => { + this.plugin.settings.activeStreamId = + value === "local" ? null : value; + await this.plugin.saveSettings(); - // Volume Slider Setting - new Setting(containerEl) - .setName('Volume') - .setDesc('Adjust the Lofi playback volume.') - .addSlider(slider => slider - .setLimits(0, 100, 1) - .setValue(this.plugin.settings.volume) - .setDynamicTooltip() - .onChange(async (value) => { - this.plugin.settings.volume = value; - await this.plugin.saveSettings(); - this.plugin.setVolume(value); - })); + if (value === "local") { + this.plugin.activateStream(null); + this.renderFolderContents( + this.plugin.settings.audioFolderPath + ); + this.renderTrackList(); + this.localFolderSettingContainer.style.display = + "block"; + this.localFolderBrowserContainer.style.display = + "block"; + } else { + this.plugin.activateStream(value); + this.localFolderSettingContainer.style.display = + "none"; + this.localFolderBrowserContainer.style.display = + "none"; + this.trackListEl.empty(); + } + }) + ); - // Custom Folder Browser UI Section for Audio Folder Location - containerEl.createEl('h4', {text: 'Audio Folder Location'}); + const localSourceContainer = containerEl.createDiv(); + this.localFolderSettingContainer = localSourceContainer.createDiv(); + this.localFolderBrowserContainer = localSourceContainer.createDiv(); - const navContainer = containerEl.createDiv('lofi-folder-browser-nav'); - this.currentPathEl = navContainer.createEl('span', { text: 'Loading...', cls: 'lofi-browser-current-path' }); - const upButton = navContainer.createEl('button', { text: 'Up', cls: 'lofi-browser-up-button' }); - const selectButton = containerEl.createEl('button', { text: 'Select This Folder', cls: 'lofi-browser-select-button' }); + new Setting(containerEl) + .setName("Volume") + .setDesc("Adjust the Lofi playback volume.") + .addSlider((slider) => + slider + .setLimits(0, 100, 1) + .setValue(this.plugin.settings.volume) + .setDynamicTooltip() + .onChange(async (value) => { + this.plugin.settings.volume = value; + await this.plugin.saveSettings(); + this.plugin.setVolume(value); + }) + ); - containerEl.createEl('p', { text: 'Contents:' }); - this.folderListEl = containerEl.createDiv('lofi-folder-browser-list'); + this.localFolderBrowserContainer.createEl("h4", { + text: "Local Audio Folder Location", + }); - this.renderFolderContents(this.currentBrowsePath); + const navContainer = this.localFolderBrowserContainer.createDiv( + "lofi-folder-browser-nav" + ); + this.currentPathEl = navContainer.createEl("span", { + text: "Loading...", + cls: "lofi-browser-current-path", + }); + const upButton = navContainer.createEl("button", { + text: "Up", + cls: "lofi-browser-up-button", + }); + const selectButton = navContainer.createEl("button", { + text: "Select This Folder", + cls: "lofi-browser-select-button", + }); - upButton.addEventListener('click', () => { this.navigateUp(); }); - selectButton.addEventListener('click', async () => { await this.selectCurrentFolder(); }); + this.localFolderBrowserContainer.createEl("p", { text: "Contents:" }); - // Track List Section - containerEl.createEl('h4', { text: 'Found Tracks' }); - containerEl.createEl('p', { text: 'Click a track to play:' }); - this.trackListEl = containerEl.createDiv('lofi-track-list'); + this.folderListEl = this.localFolderBrowserContainer.createDiv( + "lofi-folder-browser-list" + ); - this.renderTrackList(); - // --- End Audio Settings Section --- + if (this.plugin.settings.activeStreamId === null) { + this.renderFolderContents(this.currentBrowsePath); + } else { + this.currentPathEl.setText("Local Folder Browser (Hidden)"); + this.folderListEl.empty(); + } + upButton.addEventListener("click", () => { + this.navigateUp(); + }); + selectButton.addEventListener("click", async () => { + await this.selectCurrentFolder(); + }); - containerEl.createEl('hr'); + this.localFolderBrowserContainer.createEl("h4", { + text: "Found Local Tracks", + }); + this.localFolderBrowserContainer.createEl("p", { + text: "Click a track to play:", + }); + this.trackListEl = + this.localFolderBrowserContainer.createDiv("lofi-track-list"); + if (this.plugin.settings.activeStreamId === null) { + this.renderTrackList(); + } else { + this.trackListEl.empty(); + } - // --- Focus Timer Settings Section --- - containerEl.createEl('h3', { text: 'Focus Timer Settings' }); + containerEl.createEl("hr"); - // Work Duration Setting Input - new Setting(containerEl) - .setName('Work Duration (minutes)') - .setDesc('Set the duration for each focus work session.') - .addText(text => text - .setPlaceholder('e.g., 25') - .setValue(this.plugin.settings.workDuration.toString()) - .onChange(async (value) => { - const duration = parseInt(value, 10); - if (!isNaN(duration) && duration > 0) { - this.plugin.settings.workDuration = duration; - await this.plugin.saveSettings(); - console.log('Work duration updated:', duration); - } else { - new Notice('Please enter a valid positive number for work duration.'); - text.setValue(this.plugin.settings.workDuration.toString()); - } - })); + containerEl.createEl("h3", { text: "Focus Timer Settings" }); + new Setting(containerEl) + .setName("Work Duration (minutes)") + .setDesc("Set the duration for each focus work session.") + .addText((text) => + text + .setPlaceholder("e.g., 25") + .setValue(this.plugin.settings.workDuration.toString()) + .onChange(async (value) => { + const duration = parseInt(value, 10); + if (!isNaN(duration) && duration > 0) { + this.plugin.settings.workDuration = duration; + await this.plugin.saveSettings(); + } else { + new Notice( + "Please enter a valid positive number for work duration." + ); + text.setValue( + this.plugin.settings.workDuration.toString() + ); + } + }) + ); + new Setting(containerEl) + .setName("Rest Duration (minutes)") + .setDesc("Set the duration for each short rest session.") + .addText((text) => + text + .setPlaceholder("e.g., 5") + .setValue(this.plugin.settings.restDuration.toString()) + .onChange(async (value) => { + const duration = parseInt(value, 10); + if (!isNaN(duration) && duration > 0) { + this.plugin.settings.restDuration = duration; + await this.plugin.saveSettings(); + } else { + new Notice( + "Please enter a valid positive number for rest duration." + ); + text.setValue( + this.plugin.settings.restDuration.toString() + ); + } + }) + ); - // Rest Duration Setting Input - new Setting(containerEl) - .setName('Rest Duration (minutes)') - .setDesc('Set the duration for each short rest session.') - .addText(text => text - .setPlaceholder('e.g., 5') - .setValue(this.plugin.settings.restDuration.toString()) - .onChange(async (value) => { - const duration = parseInt(value, 10); - if (!isNaN(duration) && duration > 0) { - this.plugin.settings.restDuration = duration; - await this.plugin.saveSettings(); - console.log('Rest duration updated:', duration); - } else { - new Notice('Please enter a valid positive number for rest duration.'); - text.setValue(this.plugin.settings.restDuration.toString()); - } - })); - // --- End Focus Timer Settings Section --- + containerEl.createEl("hr"); - containerEl.createEl('hr'); - - // --- NEW: Animation Settings Section --- - containerEl.createEl('h3', { text: 'Animation Settings' }); - - // Animation Enabled Toggle - new Setting(containerEl) - .setName('Enable Background Animation') - .setDesc('Toggle the subtle background animation (e.g., falling leaves).') - .addToggle(toggle => toggle - .setValue(this.plugin.settings.animationEnabled) // Set initial state from settings - .onChange(async (value) => { // Function called when toggle state changes - this.plugin.settings.animationEnabled = value; // Update setting in memory - await this.plugin.saveSettings(); // Save settings to disk - - if (value) { - // If animation is enabled, start it - this.plugin.startAnimation(); // Call the plugin method - } else { - // If animation is disabled, stop it - this.plugin.stopAnimation(); // Call the plugin method - } - })); - // --- END NEW --- + containerEl.createEl("h3", { text: "Animation Settings" }); + new Setting(containerEl) + .setName("Enable Background Animation") + .setDesc( + "Toggle the subtle background animation (e.g., falling circles)." + ) + .addToggle((toggle) => + toggle + .setValue(this.plugin.settings.animationEnabled) + .onChange(async (value) => { + this.plugin.settings.animationEnabled = value; + await this.plugin.saveSettings(); + if (value) { + this.plugin.startAnimation(); + } else { + this.plugin.stopAnimation(); + } + }) + ); + if (this.plugin.settings.activeStreamId !== null) { + this.localFolderSettingContainer.style.display = "none"; + this.localFolderBrowserContainer.style.display = "none"; + } } - // --- Methods for Custom Folder Browser --- - private async renderFolderContents(folderPath: string): Promise { /* ... existing code ... */ - this.folderListEl.empty(); - this.currentPathEl.setText(`Current Path: ${folderPath || '/'}`); + private localFolderSettingContainer: HTMLElement; + private localFolderBrowserContainer: HTMLElement; - try { - let folder: TFolder | null; + private async renderFolderContents(folderPath: string): Promise { + this.folderListEl.empty(); + this.currentPathEl.setText(`Current Path: ${folderPath || "/"}`); + try { + let folder: TFolder | null; + if (folderPath === "" || folderPath === "/") { + folder = this.app.vault.getRoot(); + } else { + const fileOrFolder = + this.app.vault.getAbstractFileByPath(folderPath); + if (fileOrFolder instanceof TFolder) { + folder = fileOrFolder; + } else { + console.error("Invalid path or not a folder:", folderPath); + this.folderListEl.createEl("div", { + text: "Invalid folder path.", + cls: "lofi-browser-error", + }); + if ( + folderPath === this.currentBrowsePath && + folderPath !== "" + ) { + new Notice( + `The saved folder path "${folderPath}" is invalid. Displaying vault root instead.` + ); + this.currentBrowsePath = ""; + this.renderFolderContents(""); + } + return; + } + } + if (folder.parent) { + const upButtonEl = this.folderListEl.createDiv( + "lofi-browser-list-item" + ); + upButtonEl.addClass("lofi-browser-item-folder"); + upButtonEl.createEl("span", { + text: "⬆️ ..", + cls: "lofi-browser-item-name", + }); + upButtonEl.style.cursor = "pointer"; + upButtonEl.addEventListener("click", () => { + this.navigateUp(); + }); + } + const sortedChildren = folder.children.sort((a, b) => { + const isAFolder = a instanceof TFolder; + const isBFolder = b instanceof TFolder; + if (isAFolder && !isBFolder) return -1; + if (!isAFolder && isBFolder) return 1; + return a.name.localeCompare(b.name); + }); + for (const child of sortedChildren) { + const itemEl = this.folderListEl.createDiv( + "lofi-browser-list-item" + ); + const iconEl = itemEl.createEl("span", { + cls: "lofi-browser-item-icon", + }); + const itemNameEl = itemEl.createEl("span", { + text: child.name, + cls: "lofi-browser-item-name", + }); + if (child instanceof TFolder) { + iconEl.setText("📁"); + itemEl.addClass("lofi-browser-item-folder"); + itemEl.style.cursor = "pointer"; + itemEl.addEventListener("click", () => { + this.navigateToFolder(child.path); + }); + } else if (child instanceof TFile) { + iconEl.setText("📄"); + itemEl.addClass("lofi-browser-item-file"); + itemEl.style.cursor = "default"; + } + } + } catch (error) { + console.error("Error rendering folder contents:", error); + this.folderListEl.createEl("div", { + text: "Error loading contents.", + cls: "lofi-browser-error", + }); + this.currentPathEl.setText(`Current Path: Error`); + } + } - if (folderPath === '' || folderPath === '/') { - folder = this.app.vault.getRoot(); - } else { - const fileOrFolder = this.app.vault.getAbstractFileByPath(folderPath); - if (fileOrFolder instanceof TFolder) { - folder = fileOrFolder; - } else { - console.error('Invalid path or not a folder:', folderPath); - this.folderListEl.createEl('div', { text: 'Invalid folder path.', cls: 'lofi-browser-error' }); - if (folderPath === this.currentBrowsePath && folderPath !== '') { - new Notice(`The saved folder path "${folderPath}" is invalid. Displaying vault root instead.`); - this.currentBrowsePath = ''; - this.renderFolderContents(''); - } - return; - } - } + private navigateToFolder(folderPath: string): void { + this.currentBrowsePath = normalizePath(folderPath); + this.renderFolderContents(this.currentBrowsePath); + } - if (folder.parent) { - const upButtonEl = this.folderListEl.createDiv('lofi-browser-list-item'); - upButtonEl.addClass('lofi-browser-item-folder'); - upButtonEl.createEl('span', { text: '⬆️ ..', cls: 'lofi-browser-item-name' }); - upButtonEl.style.cursor = 'pointer'; + private navigateUp(): void { + if (this.currentBrowsePath === "" || this.currentBrowsePath === "/") { + return; + } + const currentFolder = this.app.vault.getAbstractFileByPath( + this.currentBrowsePath + ); + if (currentFolder instanceof TFolder && currentFolder.parent) { + const parentPath = currentFolder.parent.path; + this.currentBrowsePath = normalizePath(parentPath); + this.renderFolderContents(this.currentBrowsePath); + } else { + this.currentBrowsePath = ""; + this.renderFolderContents(""); + } + } - upButtonEl.addEventListener('click', () => { - this.navigateUp(); - }); - } + private async selectCurrentFolder(): Promise { + const folder = + this.currentBrowsePath === "" + ? this.app.vault.getRoot() + : this.app.vault.getAbstractFileByPath(this.currentBrowsePath); + if ( + this.currentBrowsePath === "" || + this.currentBrowsePath === "/" || + folder instanceof TFolder + ) { + const path = normalizePath(this.currentBrowsePath); + this.plugin.settings.audioFolderPath = path; + await this.plugin.saveSettings(); - const sortedChildren = folder.children.sort((a, b) => { - const isAFolder = a instanceof TFolder; - const isBFolder = b instanceof TFolder; + this.renderTrackList(); - if (isAFolder && !isBFolder) return -1; - if (!isAFolder && isBFolder) return 1; - return a.name.localeCompare(b.name); - }); + new Notice(`Audio folder set to: "${path || "/"}"`); + } else { + console.error( + "Cannot select invalid path as folder:", + this.currentBrowsePath + ); + new Notice("Cannot select current path: Not a valid folder."); + this.currentBrowsePath = ""; + this.renderFolderContents(""); + this.renderTrackList(); + } + } - console.log(`Rendering contents for "${folderPath || '/'}". Items found: ${sortedChildren.length}`); + private renderTrackList(): void { + this.trackListEl.empty(); + const playlist = this.plugin.playlist; + if (playlist.length === 0) { + this.trackListEl.createEl("div", { + text: "No MP3 files found in the selected folder.", + cls: "lofi-track-list-empty", + }); + return; + } + playlist.forEach((trackVaultPath, index) => { + const trackItemEl = this.trackListEl.createDiv( + "lofi-track-list-item" + ); + const trackName = + trackVaultPath.split("/").pop() || "Unknown Track"; + trackItemEl.createEl("span", { + text: `${index + 1}. ${trackName}`, + cls: "lofi-track-name", + }); + trackItemEl.addClass("lofi-track-item-clickable"); + trackItemEl.style.cursor = "pointer"; + trackItemEl.addEventListener("click", () => { + this.plugin.playTrackByPath(trackVaultPath); + this.updateTrackListPlayingState( + this.plugin.getCurrentTrackIndex() + ); + }); + if (index === this.plugin.getCurrentTrackIndex()) { + trackItemEl.addClass("lofi-track-item-playing"); + } + }); + } - for (const child of sortedChildren) { - const itemEl = this.folderListEl.createDiv('lofi-browser-list-item'); - const iconEl = itemEl.createEl('span', { cls: 'lofi-browser-item-icon' }); - const itemNameEl = itemEl.createEl('span', { text: child.name, cls: 'lofi-browser-item-name' }); - - if (child instanceof TFolder) { - iconEl.setText('📁'); - itemEl.addClass('lofi-browser-item-folder'); - itemEl.style.cursor = 'pointer'; - - itemEl.addEventListener('click', () => { - this.navigateToFolder(child.path); - }); - console.log(`Rendering folder item: ${child.path}. Adding click listener.`); - - } else if (child instanceof TFile) { - iconEl.setText('📄'); - itemEl.addClass('lofi-browser-item-file'); - itemEl.style.cursor = 'default'; - console.log(`Rendering file item: ${child.path}.`); - } - } - - } catch (error) { - console.error('Error rendering folder contents:', error); - this.folderListEl.createEl('div', { text: 'Error loading contents.', cls: 'lofi-browser-error' }); - this.currentPathEl.setText(`Current Path: Error`); - } - } - - private navigateToFolder(folderPath: string): void { - this.currentBrowsePath = normalizePath(folderPath); - this.renderFolderContents(this.currentBrowsePath); - } - - private navigateUp(): void { - if (this.currentBrowsePath === '' || this.currentBrowsePath === '/') { - return; - } - - const currentFolder = this.app.vault.getAbstractFileByPath(this.currentBrowsePath); - - if (currentFolder instanceof TFolder && currentFolder.parent) { - const parentPath = currentFolder.parent.path; - this.currentBrowsePath = normalizePath(parentPath); - this.renderFolderContents(this.currentBrowsePath); - } else { - console.warn('Could not determine parent for path:', this.currentBrowsePath, '. Navigating to root as fallback.'); - this.currentBrowsePath = ''; - this.renderFolderContents(''); - } - } - - private async selectCurrentFolder(): Promise { - const folder = this.currentBrowsePath === '' ? this.app.vault.getRoot() : this.app.vault.getAbstractFileByPath(this.currentBrowsePath); - - if (this.currentBrowsePath === '' || this.currentBrowsePath === '/' || folder instanceof TFolder) { - const path = normalizePath(this.currentBrowsePath); - this.plugin.settings.audioFolderPath = path; - await this.plugin.saveSettings(); - await this.plugin.scanAudioFolder(path); - - this.renderTrackList(); // Re-render track list after scan - - new Notice(`Audio folder set to: "${path || '/'}"`); - console.log('Audio folder setting saved:', path); - - } else { - console.error('Cannot select invalid path as folder:', this.currentBrowsePath); - new Notice('Cannot select current path: Not a valid folder.'); - this.currentBrowsePath = ''; - this.renderFolderContents(''); - this.renderTrackList(); - } - } - // --- End Methods for Custom Folder Browser --- - - - // --- Methods for Track List Display and Interaction (defined within LofiSettingTab) --- - - private renderTrackList(): void { - this.trackListEl.empty(); - - const playlist = this.plugin.playlist; - - if (playlist.length === 0) { - this.trackListEl.createEl('div', { text: 'No MP3 files found in the selected folder.', cls: 'lofi-track-list-empty' }); - } else { - playlist.forEach((trackVaultPath, index) => { - const trackItemEl = this.trackListEl.createDiv('lofi-track-list-item'); - const trackName = trackVaultPath.split('/').pop() || 'Unknown Track'; - - trackItemEl.createEl('span', { text: `${index + 1}. ${trackName}`, cls: 'lofi-track-name' }); - trackItemEl.addClass('lofi-track-item-clickable'); - trackItemEl.style.cursor = 'pointer'; - - trackItemEl.addEventListener('click', () => { - this.plugin.playTrackByPath(trackVaultPath); - this.updateTrackListPlayingState(this.plugin.getCurrentTrackIndex()); - }); - - if (index === this.plugin.getCurrentTrackIndex()) { - trackItemEl.addClass('lofi-track-item-playing'); - } - }); - } - } - - private updateTrackListPlayingState(playingIndex: number): void { - const items = this.trackListEl.querySelectorAll('.lofi-track-list-item'); - - items.forEach((item, index) => { - item.removeClass('lofi-track-item-playing'); - if (index === playingIndex) { - item.addClass('lofi-track-item-playing'); - } - }); - } - // --- End Methods for Track List Display and Interaction --- -} \ No newline at end of file + private updateTrackListPlayingState(playingIndex: number): void { + const items = this.trackListEl.querySelectorAll( + ".lofi-track-list-item" + ); + items.forEach((item, index) => { + item.removeClass("lofi-track-item-playing"); + if (index === playingIndex) { + item.addClass("lofi-track-item-playing"); + } + }); + } +} diff --git a/streams.ts b/streams.ts new file mode 100644 index 0000000..9910a86 --- /dev/null +++ b/streams.ts @@ -0,0 +1,46 @@ +export interface LofiStream { + id: string; + name: string; + url: string; + description?: string; +} + +export const PREDEFINED_LOFI_STREAMS: LofiStream[] = [ + { + id: "local", + name: "Local Folder", + url: "", + description: "Use MP3 files from the configured local folder.", + }, + { + id: "chill-mornings", + name: "Chill Mornings", + url: "https://antares.dribbcast.com/proxy/s8280/stream", + description: "A mellow mix for starting your day.", + }, + { + id: "jazzy-afternoons", + name: "Jazzy Afternoons", + url: "https://relay0.r-a-d.io/main.mp3", + description: "Smooth jazz vibes for a productive afternoon.", + }, + { + id: "japanese-music", + name: "Anime & Japanese Music", + url: "http://tsuiokuyo.ddns.net:8764/lossy", + description: "Broadcasting anime and Japanese music.", + }, + { + id: "lofi-hiphop-radio", + name: "Lofi Hip Hop Radio", + url: "https://streams.fluxfm.de/Chillhop/mp3-128/streams.fluxfm.de/", + description: "24/7 lofi hip hop beats.", + }, +]; + +export function getStreamById(id: string | null): LofiStream | undefined { + if (id === null || id === "local") { + return PREDEFINED_LOFI_STREAMS.find((stream) => stream.id === "local"); + } + return PREDEFINED_LOFI_STREAMS.find((stream) => stream.id === id); +} diff --git a/styles.css b/styles.css index c60a06e..788fe78 100644 --- a/styles.css +++ b/styles.css @@ -12,136 +12,148 @@ If your plugin does not need CSS, delete this file. /* Overall container for the navigation elements (path and Up button) */ .lofi-folder-browser-nav { - display: flex; /* Arrange path and button side-by-side */ - align-items: center; /* Vertically align items */ - gap: 10px; /* Space between the path element and the Up button */ - margin-bottom: 10px; /* Space below the navigation bar */ - padding-bottom: 8px; /* Space below the border */ - border-bottom: 1px solid var(--background-modifier-border); /* Add a separating line */ - flex-wrap: wrap; /* Allow items to wrap on smaller screens */ + display: flex; /* Arrange path and button side-by-side */ + align-items: center; /* Vertically align items */ + gap: 10px; /* Space between the path element and the Up button */ + margin-bottom: 10px; /* Space below the navigation bar */ + padding-bottom: 8px; /* Space below the border */ + border-bottom: 1px solid var(--background-modifier-border); /* Add a separating line */ + flex-wrap: wrap; /* Allow items to wrap on smaller screens */ } /* Element displaying the current path */ .lofi-browser-current-path { - flex-grow: 1; /* Allow the path text to take up available space */ - font-weight: bold; /* Make the path text stand out */ - color: var(--text-normal); /* Use normal text color from theme */ - word-break: break-all; /* Prevent long paths from overflowing */ + flex-grow: 1; /* Allow the path text to take up available space */ + font-weight: bold; /* Make the path text stand out */ + color: var(--text-normal); /* Use normal text color from theme */ + word-break: break-all; /* Prevent long paths from overflowing */ } /* Style for the 'Up' button */ .lofi-browser-up-button { - /* Use Obsidian's button styling variables */ - padding: 4px 10px; /* Adjust padding */ - cursor: pointer; /* Indicate clickable */ - border: 1px solid var(--interactive-accent); /* Accent color border */ - border-radius: var(--button-border-radius); /* Rounded corners */ - background-color: var(--background-primary-alt); /* Background color from theme */ - color: var(--text-normal); /* Text color from theme */ - font-size: var(--font-ui-small); /* Match smaller UI font */ - line-height: 1; /* Adjust line height */ - transition: background-color 0.15s ease; /* Smooth hover effect */ + /* Use Obsidian's button styling variables */ + padding: 4px 10px; /* Adjust padding */ + cursor: pointer; /* Indicate clickable */ + border: 1px solid var(--interactive-accent); /* Accent color border */ + border-radius: var(--button-border-radius); /* Rounded corners */ + background-color: var( + --background-primary-alt + ); /* Background color from theme */ + color: var(--text-normal); /* Text color from theme */ + font-size: var(--font-ui-small); /* Match smaller UI font */ + line-height: 1; /* Adjust line height */ + transition: background-color 0.15s ease; /* Smooth hover effect */ } /* Hover effect for the 'Up' button */ .lofi-browser-up-button:hover { - background-color: var(--background-modifier-hover); /* Hover background color */ + background-color: var( + --background-modifier-hover + ); /* Hover background color */ } /* Style for the 'Select This Folder' button */ .lofi-browser-select-button { - /* Similar styling to the Up button */ - display: block; /* Make it a block element to take full width */ - width: 100%; /* Full width */ - margin-top: 10px; /* Space above the select button */ - padding: 6px 10px; /* Adjust padding */ - cursor: pointer; - border: 1px solid var(--interactive-accent); - border-radius: var(--button-border-radius); - background-color: var(--interactive-accent); /* Use accent color for primary action */ - color: var(--text-inverted); /* Inverted text color for accent background */ - font-size: var(--font-ui-normal); /* Normal UI font size */ - line-height: 1; - transition: background-color 0.15s ease; + /* Similar styling to the Up button */ + display: block; /* Make it a block element to take full width */ + width: 100%; /* Full width */ + margin-top: 10px; /* Space above the select button */ + padding: 6px 10px; /* Adjust padding */ + cursor: pointer; + border: 1px solid var(--interactive-accent); + border-radius: var(--button-border-radius); + background-color: var( + --interactive-accent + ); /* Use accent color for primary action */ + color: var(--text-inverted); /* Inverted text color for accent background */ + font-size: var(--font-ui-normal); /* Normal UI font size */ + line-height: 1; + transition: background-color 0.15s ease; } /* Hover effect for the 'Select This Folder' button */ .lofi-browser-select-button:hover { - background-color: var(--interactive-accent-hover); /* Darker accent color on hover */ + background-color: var( + --interactive-accent-hover + ); /* Darker accent color on hover */ } - /* Container for the list of folder and file items */ .lofi-folder-browser-list { - border: 1px solid var(--background-modifier-border); /* Border around the list */ - max-height: 250px; /* Set a maximum height to make the list scrollable */ - overflow-y: auto; /* Add a vertical scrollbar when content exceeds max height */ - padding: 5px; /* Padding inside the list container */ - border-radius: var(--input-border-radius); /* Match input field corner radius */ - background-color: var(--background-secondary); /* Slightly different background for the list area */ + border: 1px solid var(--background-modifier-border); /* Border around the list */ + max-height: 250px; /* Set a maximum height to make the list scrollable */ + overflow-y: auto; /* Add a vertical scrollbar when content exceeds max height */ + padding: 5px; /* Padding inside the list container */ + border-radius: var( + --input-border-radius + ); /* Match input field corner radius */ + background-color: var( + --background-secondary + ); /* Slightly different background for the list area */ } /* Style for each individual item (folder or file) in the list */ .lofi-browser-list-item { - display: flex; /* Arrange icon and name side-by-side */ - align-items: center; /* Vertically align icon and name */ - padding: 4px 8px; /* Padding inside each list item */ - margin-bottom: 2px; /* Space between list items */ - border-radius: var(--button-border-radius); /* Small rounded corners */ - transition: background-color 0.1s ease; /* Smooth hover effect */ + display: flex; /* Arrange icon and name side-by-side */ + align-items: center; /* Vertically align icon and name */ + padding: 4px 8px; /* Padding inside each list item */ + margin-bottom: 2px; /* Space between list items */ + border-radius: var(--button-border-radius); /* Small rounded corners */ + transition: background-color 0.1s ease; /* Smooth hover effect */ } /* Style for the icon span within a list item */ .lofi-browser-item-icon { - margin-right: 8px; /* Space between icon and name */ - /* Optional: Adjust icon size or color */ - font-size: 1.1em; - color: var(--icon-color); /* Use theme icon color */ + margin-right: 8px; /* Space between icon and name */ + /* Optional: Adjust icon size or color */ + font-size: 1.1em; + color: var(--icon-color); /* Use theme icon color */ } /* Style for the name span within a list item */ .lofi-browser-item-name { - flex-grow: 1; /* Allow the name to take up available space */ - user-select: none; /* Prevent text selection when clicking */ - white-space: nowrap; /* Prevent name from wrapping */ - overflow: hidden; /* Hide overflowing text */ - text-overflow: ellipsis; /* Show ellipsis (...) for truncated names */ + flex-grow: 1; /* Allow the name to take up available space */ + user-select: none; /* Prevent text selection when clicking */ + white-space: nowrap; /* Prevent name from wrapping */ + overflow: hidden; /* Hide overflowing text */ + text-overflow: ellipsis; /* Show ellipsis (...) for truncated names */ } /* Style specific to folder items (clickable) */ .lofi-browser-item-folder { - cursor: pointer; /* Indicate clickable */ - /* background-color: var(--background-secondary); /* Optional: Different background for folders */ + cursor: pointer; /* Indicate clickable */ + /* background-color: var(--background-secondary); /* Optional: Different background for folders */ } /* Hover effect for folder items */ .lofi-browser-item-folder:hover { - background-color: var(--background-modifier-hover); /* Hover background color */ - color: var(--text-accent); /* Optional: Change text color on hover */ + background-color: var( + --background-modifier-hover + ); /* Hover background color */ + color: var(--text-accent); /* Optional: Change text color on hover */ } /* Style specific to file items (not clickable for navigation) */ .lofi-browser-item-file { - opacity: 0.8; /* Slightly dim file items to distinguish from folders */ - cursor: default; /* Explicitly show default cursor */ + opacity: 0.8; /* Slightly dim file items to distinguish from folders */ + cursor: default; /* Explicitly show default cursor */ } /* Style for error messages within the browser */ .lofi-browser-error { - color: var(--text-error); /* Use error text color (red) */ - padding: 10px; - text-align: center; + color: var(--text-error); /* Use error text color (red) */ + padding: 10px; + text-align: center; } /* --- End Styles for the Custom Folder Browser UI --- */ - /* You can keep your existing styles for the ribbon icon etc. below this */ .lofi-plugin-ribbon-icon { - /* Add your styles for the ribbon icon here */ - /* For example: */ - /* fill: purple; */ + /* Add your styles for the ribbon icon here */ + /* For example: */ + /* fill: purple; */ } /* Styles for the status bar item if you want to customize it */ @@ -152,59 +164,62 @@ If your plugin does not need CSS, delete this file. /* --- Styles for the Track List --- */ .lofi-track-list { - border: 1px solid var(--background-modifier-border); /* Border around the list */ - max-height: 150px; /* Set a max height to make it scrollable */ - overflow-y: auto; /* Add scrollbar if content exceeds height */ - padding: 5px; /* Padding inside */ - border-radius: var(--input-border-radius); /* Match other elements */ - background-color: var(--background-secondary); /* Same background as folder list */ - margin-top: 10px; /* Space above the list */ + border: 1px solid var(--background-modifier-border); /* Border around the list */ + max-height: 150px; /* Set a max height to make it scrollable */ + overflow-y: auto; /* Add scrollbar if content exceeds height */ + padding: 5px; /* Padding inside */ + border-radius: var(--input-border-radius); /* Match other elements */ + background-color: var( + --background-secondary + ); /* Same background as folder list */ + margin-top: 10px; /* Space above the list */ } .lofi-track-list-empty { - padding: 10px; - text-align: center; - color: var(--text-muted); /* Muted text color */ + padding: 10px; + text-align: center; + color: var(--text-muted); /* Muted text color */ } .lofi-track-list-item { - display: flex; - align-items: center; - padding: 4px 8px; - margin-bottom: 2px; - border-radius: var(--button-border-radius); - transition: background-color 0.1s ease; - cursor: pointer; /* Indicate clickable */ + display: flex; + align-items: center; + padding: 4px 8px; + margin-bottom: 2px; + border-radius: var(--button-border-radius); + transition: background-color 0.1s ease; + cursor: pointer; /* Indicate clickable */ } .lofi-track-list-item:hover { - background-color: var(--background-modifier-hover); /* Hover effect */ + background-color: var(--background-modifier-hover); /* Hover effect */ } /* Style for the track name text */ .lofi-track-name { - flex-grow: 1; /* Allow name to take space */ - white-space: nowrap; /* Prevent name from wrapping */ - overflow: hidden; /* Hide overflowing text */ - text-overflow: ellipsis; /* Show ellipsis (...) for truncated names */ + flex-grow: 1; /* Allow name to take space */ + white-space: nowrap; /* Prevent name from wrapping */ + overflow: hidden; /* Hide overflowing text */ + text-overflow: ellipsis; /* Show ellipsis (...) for truncated names */ } - /* Style for the currently playing track item */ .lofi-track-item-playing { - background-color: var(--interactive-accent); /* Use accent color for the playing track */ - color: var(--text-inverted); /* Inverted text color */ - font-weight: bold; /* Bold text for playing track */ + background-color: var( + --interactive-accent + ); /* Use accent color for the playing track */ + color: var(--text-inverted); /* Inverted text color */ + font-weight: bold; /* Bold text for playing track */ } .lofi-track-item-playing .lofi-track-name { - /* Ensure name color is inverted too */ - color: var(--text-inverted); + /* Ensure name color is inverted too */ + color: var(--text-inverted); } .lofi-track-item-playing:hover { - /* Adjust hover effect for the playing item */ - background-color: var(--interactive-accent-hover); + /* Adjust hover effect for the playing item */ + background-color: var(--interactive-accent-hover); } /* styles.css (add these below the track list styles) */ @@ -212,39 +227,43 @@ If your plugin does not need CSS, delete this file. /* --- Styles for Playback Controls --- */ .lofi-playback-controls { - margin-top: 10px; /* Space above the controls */ - padding-top: 10px; - border-top: 1px solid var(--background-modifier-border); /* Separator line */ + margin-top: 10px; /* Space above the controls */ + padding-top: 10px; + border-top: 1px solid var(--background-modifier-border); /* Separator line */ } .lofi-playback-buttons-container { - display: flex; /* Arrange buttons in a row */ - gap: 10px; /* Space between buttons */ - justify-content: center; /* Center the buttons */ - align-items: center; - margin-bottom: 10px; /* Space below the button row */ + display: flex; /* Arrange buttons in a row */ + gap: 10px; /* Space between buttons */ + justify-content: center; /* Center the buttons */ + align-items: center; + margin-bottom: 10px; /* Space below the button row */ } .lofi-playback-button { - /* Basic button styling - similar to navigation buttons */ - padding: 5px 12px; - cursor: pointer; - border: 1px solid var(--interactive-accent); - border-radius: var(--button-border-radius); - background-color: var(--background-primary-alt); - color: var(--text-normal); - font-size: var(--font-ui-normal); - line-height: 1; - transition: background-color 0.15s ease; + /* Basic button styling - similar to navigation buttons */ + padding: 5px 12px; + cursor: pointer; + border: 1px solid var(--interactive-accent); + border-radius: var(--button-border-radius); + background-color: var(--background-primary-alt); + color: var(--text-normal); + font-size: var(--font-ui-normal); + line-height: 1; + transition: background-color 0.15s ease; } .lofi-playback-button:hover { - background-color: var(--background-modifier-hover); + background-color: var(--background-modifier-hover); } /* Optional: Specific styles for Prev/Next if needed */ -.lofi-prev-button { /* ... */ } -.lofi-next-button { /* ... */ } +.lofi-prev-button { + /* ... */ +} +.lofi-next-button { + /* ... */ +} /* Optional: Style for shuffle toggle if added later */ /* .lofi-shuffle-toggle .setting-item-control { ... } */ @@ -255,17 +274,17 @@ If your plugin does not need CSS, delete this file. /* Style for each individual status bar item used as a control button */ .status-bar-item.lofi-control-button { - /* Make it look like a button/icon */ - cursor: pointer; - padding: 0 8px; /* Add some padding around the text/icon */ - /* Inherit text/color from status bar */ - /* Optional: Add subtle background/border on hover */ - border-radius: 4px; /* Small rounded corners */ - transition: background-color 0.1s ease; + /* Make it look like a button/icon */ + cursor: pointer; + padding: 0 8px; /* Add some padding around the text/icon */ + /* Inherit text/color from status bar */ + /* Optional: Add subtle background/border on hover */ + border-radius: 4px; /* Small rounded corners */ + transition: background-color 0.1s ease; } .status-bar-item.lofi-control-button:hover { - background-color: var(--background-modifier-hover); /* Highlight on hover */ + background-color: var(--background-modifier-hover); /* Highlight on hover */ } /* Specific styles if needed (e.g., different colors) */ @@ -276,7 +295,6 @@ If your plugin does not need CSS, delete this file. /* If using SVG icons, you might need styles for the svg element inside */ /* .status-bar-item.lofi-control-button svg { fill: var(--icon-color); width: 18px; height: 18px; vertical-align: middle; } */ - /* Style for the main status bar text item */ /* .status-bar-item:not(.lofi-control-button) { ... } */ @@ -286,22 +304,22 @@ If your plugin does not need CSS, delete this file. /* Style for the timer display text element */ .status-bar-item.lofi-timer-display { - /* Inherit font/color from status bar */ - font-weight: bold; /* Make the time display prominent */ - margin-left: 15px; /* Add space to the left to separate from audio controls */ - padding: 0 8px; /* Add padding */ - /* Optional: Add a border or background */ - /* border: 1px solid var(--background-modifier-border); */ - /* border-radius: var(--button-border-radius); */ - /* background-color: var(--background-secondary); */ + /* Inherit font/color from status bar */ + font-weight: bold; /* Make the time display prominent */ + margin-left: 15px; /* Add space to the left to separate from audio controls */ + padding: 0 8px; /* Add padding */ + /* Optional: Add a border or background */ + /* border: 1px solid var(--background-modifier-border); */ + /* border-radius: var(--button-border-radius); */ + /* background-color: var(--background-secondary); */ } /* Style for the timer control buttons */ /* Re-uses .lofi-control-button from audio controls, adds specific styles */ .status-bar-item.lofi-timer-control-button { - /* Any styles specific to timer buttons if they differ from audio controls */ - /* e.g., different color */ - /* color: var(--interactive-accent); */ + /* Any styles specific to timer buttons if they differ from audio controls */ + /* e.g., different color */ + /* color: var(--interactive-accent); */ } /* Specific styles for Play/Pause timer button */ @@ -310,28 +328,26 @@ If your plugin does not need CSS, delete this file. /* Specific styles for Reset timer button */ /* .status-bar-item.lofi-timer-reset-button { ... } */ - /* Ensure default status bar items still look normal */ /* .status-bar-item:not(.lofi-control-button):not(.lofi-timer-display) { ... } */ - /* styles.css (add these below other styles) */ /* --- Styles for Status Bar Playback Controls (Audio) --- */ /* Style for each individual status bar item used as a control button */ .status-bar-item.lofi-control-button { - cursor: pointer; - padding: 0 8px; - border-radius: 4px; - transition: background-color 0.1s ease; - display: flex; - align-items: center; - justify-content: center; + cursor: pointer; + padding: 0 8px; + border-radius: 4px; + transition: background-color 0.1s ease; + display: flex; + align-items: center; + justify-content: center; } .status-bar-item.lofi-control-button:hover { - background-color: var(--background-modifier-hover); + background-color: var(--background-modifier-hover); } /* Specific styles if needed */ @@ -341,32 +357,30 @@ If your plugin does not need CSS, delete this file. /* .status-bar-item.lofi-timer-play-pause-button { ... } */ /* .status-bar-item.lofi-timer-reset-button { ... } */ - /* Style for the main status bar text item (Audio Status) */ /* .status-bar-item:not(.lofi-control-button):not(.lofi-timer-display) { ... } */ - /* --- Styles for Timer Status Bar Items --- */ /* Style for the timer display text element */ .status-bar-item.lofi-timer-display { - font-weight: bold; - margin-left: 15px; - padding: 0 8px; - display: flex; - align-items: center; + font-weight: bold; + margin-left: 15px; + padding: 0 8px; + display: flex; + align-items: center; } /* --- NEW: Styles for Animation Canvas --- */ .lofi-animation-canvas { - /* Styles are primarily set in main.ts, but defining the class is good practice */ - /* These styles ensure it acts as a fixed overlay */ - position: fixed; - top: 0; - left: 0; - width: 100%; - height: 100%; - z-index: 0; /* Or 1, below most Obsidian UI elements */ - pointer-events: none; /* Crucial: allows clicks/interaction with UI elements behind the canvas */ + /* Styles are primarily set in main.ts, but defining the class is good practice */ + /* These styles ensure it acts as a fixed overlay */ + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: 0; /* Or 1, below most Obsidian UI elements */ + pointer-events: none; /* Crucial: allows clicks/interaction with UI elements behind the canvas */ } -/* --- END NEW --- */ \ No newline at end of file +/* --- END NEW --- */ diff --git a/types.ts b/types.ts index 3200fe3..cf8f2a0 100644 --- a/types.ts +++ b/types.ts @@ -1,15 +1,9 @@ -// Defines the structure of your plugin's settings saved to data.json export interface LofiPluginSettings { - mySetting: string; // Sample setting (can be removed later if not used) - volume: number; // Volume setting (0-100) - audioFolderPath: string; // Setting for the folder containing audio files (vault path) - - // Focus Timer Settings - workDuration: number; // Duration of the work session in minutes - restDuration: number; // Duration of the rest session in minutes - - // --- NEW: Animation Settings --- - animationEnabled: boolean; // Toggle to enable/disable the animation - // Add settings for animation type (leaves, rain), density, speed, etc. later - // --- END NEW --- -} \ No newline at end of file + mySetting: string; + volume: number; + audioFolderPath: string; + workDuration: number; + restDuration: number; + animationEnabled: boolean; + activeStreamId: string | null; +}