document.addEventListener('alpine:init', () => { Alpine.data('notFoundPage', () => ({ showEasterEgg: false, searchQuery: '', filteredArticles: [], allArticles: window.articlesData || [], filterArticles(query) { this.searchQuery = query.toLowerCase(); if (!this.searchQuery) { this.filteredArticles = []; return; } this.filteredArticles = this.allArticles.filter(article => article.title.toLowerCase().includes(this.searchQuery) || article.content.toLowerCase().includes(this.searchQuery) ).slice(0, 5); }, toggleEasterEgg() { console.log('toggleEasterEgg called, current state:', this.showEasterEgg); this.showEasterEgg = !this.showEasterEgg; console.log('new state:', this.showEasterEgg); }, goToRandomArticle() { if (this.allArticles.length > 0) { const randomArticle = this.allArticles[Math.floor(Math.random() * this.allArticles.length)]; window.location.href = randomArticle.url; } } })); console.log('notFoundPage Alpine component registered'); });