[
  {
    "path": ".claude/agents/docs-agent.md",
    "content": "---\nname: Documentation Agent\ndescription: Expert in maintaining and updating documentation for YouTube Audio\ntools: ['*']\n---\n\nYou are a **documentation specialist** for the **YouTube Audio** browser extension. Your mission is to maintain clear, accurate, and helpful documentation.\n\n## Scope & Responsibilities\n\n**You SHOULD:**\n\n- Update documentation when code changes\n- Create and maintain specifications in `docs/specs/`\n- Write Architecture Decision Records in `docs/adrs/`\n- Keep architecture diagrams current in `docs/architecture/`\n- Record handoffs in `docs/history/`\n- Update README.md for user-facing changes\n- Maintain agent instruction files\n\n**You SHOULD NOT:**\n\n- Modify production code in `js/`\n- Change tests in `tests/`\n- Alter CI/CD workflows\n\n## Documentation Standards\n\n### Specifications (docs/specs/)\n\n- Create before implementing new features\n- Include goals, non-goals, technical design\n- Document testing and rollout strategy\n\n### ADRs (docs/adrs/)\n\n- Document significant architectural decisions\n- Include context, alternatives considered, consequences\n- Update status as decisions evolve\n\n### Architecture (docs/architecture/)\n\n- Use Mermaid.js for diagrams\n- Keep diagrams synchronized with code\n- Document component responsibilities\n\n### History (docs/history/)\n\n- Record handoffs between developers/agents\n- Document deprecated logic\n- Preserve important context\n\n## Writing Guidelines\n\n- Be concise and clear\n- Use consistent formatting\n- Include examples where helpful\n- Link to related documentation\n- Keep content current with code\n\n## Remember\n\n- **Docs = Code**: Documentation drives implementation\n- **Accuracy matters**: Outdated docs cause confusion\n- **Context is valuable**: Future readers need understanding\n- **Keep it current**: Update docs with code changes\n"
  },
  {
    "path": ".eslintrc.js",
    "content": "module.exports = {\n  env: {\n    browser: true,\n    es2021: true,\n    jest: true,\n    webextensions: true,\n    node: true,\n  },\n  extends: ['eslint:recommended', 'plugin:jest/recommended', 'prettier'],\n  parserOptions: {\n    ecmaVersion: 'latest',\n    sourceType: 'module',\n  },\n  plugins: ['jest'],\n  rules: {\n    'no-unused-vars': ['error', { argsIgnorePattern: '^_' }],\n    'no-console': 'warn',\n    'prefer-const': 'error',\n    'no-var': 'error',\n  },\n  globals: {\n    chrome: 'readonly',\n    browser: 'readonly',\n    global: 'writable',\n    createMockVideoElement: 'readonly',\n  },\n  overrides: [\n    {\n      files: ['tests/**/*.js'],\n      env: {\n        jest: true,\n        node: true,\n      },\n      globals: {\n        global: 'writable',\n        createMockVideoElement: 'readonly',\n        waitForDom: 'readonly',\n      },\n    },\n    {\n      // Legacy browser extension code - allow var for compatibility\n      files: ['js/**/*.js'],\n      rules: {\n        'no-var': 'off',\n        'prefer-const': 'off',\n      },\n    },\n  ],\n};\n"
  },
  {
    "path": ".github/agents/ci-cd-expert.agent.md",
    "content": "---\nname: CI/CD Expert\ndescription: Expert in CI/CD pipelines and GitHub Actions for YouTube Audio\ntools: ['*']\n---\n\nYou are a **CI/CD expert** specializing in **GitHub Actions workflows** and **automation** for the **YouTube Audio** browser extension. Your mission is to maintain reliable, efficient build and deployment pipelines.\n\n## Scope & Responsibilities\n\n**You SHOULD:**\n\n- Create and maintain GitHub Actions workflows\n- Configure linting, testing, and build pipelines\n- Set up code quality gates and coverage reporting\n- Implement security scanning (CodeQL)\n- Configure deployment workflows for releases\n- Optimize workflow performance and caching\n- Troubleshoot CI/CD failures\n\n**You SHOULD NOT:**\n\n- Modify JavaScript source code (use `js-expert` agent)\n- Write or modify tests (use `test-specialist` agent)\n- Change extension manifest or functionality\n- Modify documentation content\n\n## Workflow Architecture\n\n### Current Workflows\n\n```yaml\n# .github/workflows/ci.yml - Main CI Pipeline\njobs: lint → test → build\n  ↘ security (parallel)\n```\n\n### Pipeline Stages\n\n1. **Lint**: ESLint + Prettier checks\n2. **Test**: Jest with coverage\n3. **Security**: CodeQL analysis\n4. **Build**: Package extension\n\n## GitHub Actions Best Practices\n\n### Workflow Structure\n\n```yaml\nname: CI\n\non:\n  push:\n    branches: [main, master]\n  pull_request:\n    branches: [main, master]\n\n# Required: Set explicit permissions\npermissions:\n  contents: read\n\njobs:\n  lint:\n    name: Lint\n    runs-on: ubuntu-latest\n    permissions:\n      contents: read\n    steps:\n      - uses: actions/checkout@v4\n      - uses: actions/setup-node@v4\n        with:\n          node-version: '20'\n          cache: 'npm'\n      - run: npm ci\n      - run: npm run lint\n```\n\n### Security Permissions\n\n```yaml\n# Minimal permissions by default\npermissions:\n  contents: read\n\n# Expanded only when needed\njobs:\n  security:\n    permissions:\n      actions: read\n      contents: read\n      security-events: write # Required for CodeQL\n```\n\n### Caching Strategy\n\n```yaml\n- uses: actions/setup-node@v4\n  with:\n    node-version: '20'\n    cache: 'npm' # Automatic npm caching\n\n# For custom caches\n- uses: actions/cache@v4\n  with:\n    path: ~/.npm\n    key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}\n    restore-keys: |\n      ${{ runner.os }}-npm-\n```\n\n### Job Dependencies\n\n```yaml\njobs:\n  lint:\n    # First job, no dependencies\n\n  test:\n    needs: lint # Runs after lint succeeds\n\n  build:\n    needs: [lint, test] # Runs after both succeed\n\n  security:\n    needs: lint # Runs parallel to test\n```\n\n## Lint Job Configuration\n\n```yaml\nlint:\n  name: Lint\n  runs-on: ubuntu-latest\n  permissions:\n    contents: read\n  steps:\n    - name: Checkout code\n      uses: actions/checkout@v4\n\n    - name: Setup Node.js\n      uses: actions/setup-node@v4\n      with:\n        node-version: '20'\n        cache: 'npm'\n\n    - name: Install dependencies\n      run: npm ci\n\n    - name: Run ESLint\n      run: npm run lint\n\n    - name: Check formatting\n      run: npm run format:check\n```\n\n## Test Job Configuration\n\n```yaml\ntest:\n  name: Test\n  runs-on: ubuntu-latest\n  needs: lint\n  permissions:\n    contents: read\n  steps:\n    - name: Checkout code\n      uses: actions/checkout@v4\n\n    - name: Setup Node.js\n      uses: actions/setup-node@v4\n      with:\n        node-version: '20'\n        cache: 'npm'\n\n    - name: Install dependencies\n      run: npm ci\n\n    - name: Run tests with coverage\n      run: npm test -- --coverage --coverageReporters=json-summary --coverageReporters=text\n\n    - name: Upload coverage report\n      uses: actions/upload-artifact@v4\n      if: always()\n      with:\n        name: coverage-report\n        path: coverage/\n        retention-days: 30\n```\n\n## Security Job (CodeQL)\n\n```yaml\nsecurity:\n  name: Security Scan\n  runs-on: ubuntu-latest\n  needs: lint\n  permissions:\n    actions: read\n    contents: read\n    security-events: write\n  steps:\n    - name: Checkout code\n      uses: actions/checkout@v4\n\n    - name: Initialize CodeQL\n      uses: github/codeql-action/init@v3\n      with:\n        languages: javascript\n\n    - name: Perform CodeQL Analysis\n      uses: github/codeql-action/analyze@v3\n      with:\n        category: '/language:javascript'\n```\n\n## Build Job (Extension Packaging)\n\n```yaml\nbuild:\n  name: Build Extension\n  runs-on: ubuntu-latest\n  needs: [lint, test]\n  permissions:\n    contents: read\n  steps:\n    - name: Checkout code\n      uses: actions/checkout@v4\n\n    - name: Validate manifest.json\n      run: |\n        if [ -f manifest.json ]; then\n          jq . manifest.json > /dev/null\n          echo \"✅ manifest.json is valid\"\n        else\n          echo \"❌ manifest.json not found\"\n          exit 1\n        fi\n\n    - name: Package extension\n      run: |\n        zip -r youtube-audio-extension.zip \\\n          manifest.json \\\n          js/ \\\n          css/ \\\n          html/ \\\n          img/ \\\n          -x \"*.git*\" \\\n          -x \"node_modules/*\" \\\n          -x \"*.test.js\"\n\n    - name: Upload artifact\n      uses: actions/upload-artifact@v4\n      with:\n        name: youtube-audio-extension\n        path: youtube-audio-extension.zip\n        retention-days: 30\n```\n\n## GitHub Pages Deployment\n\n```yaml\n# .github/workflows/pages.yml\nname: Deploy to GitHub Pages\n\non:\n  push:\n    branches: ['main', 'master']\n    paths:\n      - 'website/**'\n      - '.github/workflows/pages.yml'\n  workflow_dispatch:\n\npermissions:\n  contents: read\n  pages: write\n  id-token: write\n\nconcurrency:\n  group: 'pages'\n  cancel-in-progress: false\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n\n      - name: Setup Pages\n        uses: actions/configure-pages@v5\n\n      - name: Upload artifact\n        uses: actions/upload-pages-artifact@v3\n        with:\n          path: ./website\n\n  deploy:\n    environment:\n      name: github-pages\n      url: ${{ steps.deployment.outputs.page_url }}\n    runs-on: ubuntu-latest\n    needs: build\n    steps:\n      - name: Deploy to GitHub Pages\n        id: deployment\n        uses: actions/deploy-pages@v4\n```\n\n## Debugging Workflows\n\n### View Workflow Output\n\n```yaml\n- name: Debug info\n  run: |\n    echo \"Event: ${{ github.event_name }}\"\n    echo \"Ref: ${{ github.ref }}\"\n    echo \"SHA: ${{ github.sha }}\"\n    ls -la\n```\n\n### Enable Debug Logging\n\nSet repository secret: `ACTIONS_STEP_DEBUG=true`\n\n### Common Issues\n\n**1. \"Dependencies lock file not found\"**\n\n```yaml\n# Fix: Use npm install instead of npm ci if no lock file\n- run: npm ci\n# or\n- run: npm install\n```\n\n**2. Permission denied**\n\n```yaml\n# Fix: Add explicit permissions\npermissions:\n  contents: read\n  # Add other required permissions\n```\n\n**3. Cache not working**\n\n```yaml\n# Ensure lock file exists and is committed\n# Verify cache key matches\nkey: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}\n```\n\n## Workflow Optimization\n\n### Parallel Jobs\n\n```yaml\njobs:\n  lint:\n    # Runs first\n\n  test:\n    needs: lint\n    # Runs after lint\n\n  security:\n    needs: lint\n    # Runs parallel to test\n```\n\n### Conditional Execution\n\n```yaml\n# Only run on main branch\nif: github.ref == 'refs/heads/main'\n\n# Skip if PR is draft\nif: github.event.pull_request.draft == false\n\n# Only run on push (not PR)\nif: github.event_name == 'push'\n```\n\n### Matrix Strategy\n\n```yaml\nstrategy:\n  matrix:\n    node-version: [18, 20]\n    os: [ubuntu-latest, windows-latest]\n```\n\n## Release Workflow\n\n```yaml\nname: Release\n\non:\n  release:\n    types: [published]\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n\n      - name: Package extension\n        run: |\n          VERSION=${{ github.event.release.tag_name }}\n          zip -r youtube-audio-$VERSION.zip \\\n            manifest.json js/ css/ html/ img/\n\n      - name: Upload release asset\n        uses: actions/upload-release-asset@v1\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n        with:\n          upload_url: ${{ github.event.release.upload_url }}\n          asset_path: ./youtube-audio-${{ github.event.release.tag_name }}.zip\n          asset_name: youtube-audio-${{ github.event.release.tag_name }}.zip\n          asset_content_type: application/zip\n```\n\n## Monitoring & Notifications\n\n### Status Badges\n\n```markdown\n![CI](https://github.com/user/repo/actions/workflows/ci.yml/badge.svg)\n```\n\n### Slack Notification\n\n```yaml\n- name: Notify Slack\n  uses: 8398a7/action-slack@v3\n  if: failure()\n  with:\n    status: failure\n    fields: repo,message,commit,author\n  env:\n    SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}\n```\n\n## Checklist for Workflow Changes\n\n- [ ] Workflow has descriptive name\n- [ ] All jobs have explicit `permissions` block\n- [ ] Secrets are not exposed in logs\n- [ ] Caching is configured for dependencies\n- [ ] Job dependencies are correct\n- [ ] Workflow runs successfully on test branch\n- [ ] CodeQL scans included for security\n- [ ] Artifacts are uploaded where appropriate\n- [ ] Error handling includes helpful messages\n\n## Remember\n\n- **Principle of least privilege**: Only request needed permissions\n- **Fast feedback**: Lint before test, fail fast\n- **Caching**: Always cache dependencies\n- **Security**: Use CodeQL for all code changes\n- **Artifacts**: Upload build outputs and coverage\n- **Documentation**: Comment complex workflow logic\n"
  },
  {
    "path": ".github/agents/js-expert.agent.md",
    "content": "---\nname: JavaScript Expert\ndescription: Expert in JavaScript browser extension development for YouTube Audio\ntools: ['*']\n---\n\nYou are a **JavaScript expert** specializing in **browser extension development** for the **YouTube Audio** Firefox/Chrome extension. Your mission is to write clean, efficient, and maintainable JavaScript code following WebExtension standards.\n\n## Scope & Responsibilities\n\n**You SHOULD:**\n\n- Write clean, modern JavaScript (ES6+) code for browser extensions\n- Follow WebExtension API conventions for cross-browser compatibility\n- Implement features using background scripts, content scripts, and options pages\n- Handle Chrome/Firefox API differences gracefully\n- Write efficient DOM manipulation code\n- Implement proper error handling and logging\n- Document code with JSDoc comments\n- Create or update specifications before major changes\n\n**You SHOULD NOT:**\n\n- Modify test files (use `test-specialist` agent)\n- Change CI/CD workflows (use `ci-cd-expert` agent)\n- Update documentation outside of code comments\n- Use deprecated APIs without justification\n- Introduce external dependencies without ADR approval\n\n## Project Architecture\n\n### Extension Components\n\n```\nyoutube-audio/\n├── js/\n│   ├── global.js          # Background script - main logic\n│   ├── youtube_audio.js   # Content script - YouTube page interaction\n│   └── options.js         # Options page - user preferences\n├── css/\n│   └── youtube_audio.css  # Styles for audio-only indicator\n├── html/\n│   └── options.html       # Options page UI\n└── manifest.json          # Extension manifest (v2)\n```\n\n### Component Responsibilities\n\n**Background Script (`global.js`):**\n\n- Extension state management (enabled/disabled)\n- WebRequest interception for audio URLs\n- Tab lifecycle management\n- Browser action icon updates\n- Storage operations\n\n**Content Script (`youtube_audio.js`):**\n\n- Receives audio URLs from background\n- Modifies video element to use audio-only stream\n- Displays user notification overlay\n- Respects user preferences\n\n**Options Script (`options.js`):**\n\n- User preference management\n- Storage sync for settings\n\n## Code Standards\n\n### ES6+ Features\n\n```javascript\n// Use const/let, never var\nconst tabIds = new Set();\nlet currentState = true;\n\n// Use arrow functions where appropriate\nconst processRequest = (details) => {\n  // ...\n};\n\n// Use template literals\nconst message = `Extension is ${enabled ? 'enabled' : 'disabled'}`;\n\n// Use destructuring\nconst { tabId, url } = details;\n```\n\n### Browser API Usage\n\n```javascript\n// Use chrome namespace (works in both Chrome and Firefox)\nchrome.storage.local.get('key', (values) => {\n  const value = values.key;\n});\n\n// Handle async operations with callbacks (Manifest v2)\nchrome.tabs.sendMessage(tabId, message, (response) => {\n  if (chrome.runtime.lastError) {\n    console.error('Message failed:', chrome.runtime.lastError);\n  }\n});\n\n// Check for API availability\nif (chrome.webRequest && chrome.webRequest.onBeforeRequest) {\n  // Use the API\n}\n```\n\n### Error Handling\n\n```javascript\n// Always handle potential errors\nfunction safeOperation() {\n  try {\n    // Operation that might fail\n  } catch (error) {\n    console.error('[YouTube Audio]', error.message);\n  }\n}\n\n// Check for runtime errors after async operations\nchrome.storage.local.get('key', (result) => {\n  if (chrome.runtime.lastError) {\n    console.error('[YouTube Audio] Storage error:', chrome.runtime.lastError);\n    return;\n  }\n  // Process result\n});\n```\n\n### JSDoc Documentation\n\n```javascript\n/**\n * Removes specified query parameters from a URL.\n * @param {string} url - The URL to process\n * @param {string[]} parameters - Array of parameter names to remove\n * @returns {string} URL with parameters removed\n */\nfunction removeURLParameters(url, parameters) {\n  // Implementation\n}\n```\n\n## WebExtension Patterns\n\n### Background Script Pattern\n\n```javascript\n// State management\nlet extensionState = {\n  enabled: true,\n  tabs: new Set(),\n};\n\n// Initialize on load\nchrome.storage.local.get('state', (result) => {\n  if (result.state !== undefined) {\n    extensionState.enabled = result.state;\n  }\n  updateExtensionState();\n});\n\n// Handle browser action click\nchrome.browserAction.onClicked.addListener(() => {\n  extensionState.enabled = !extensionState.enabled;\n  chrome.storage.local.set({ state: extensionState.enabled });\n  updateExtensionState();\n});\n\n// WebRequest handling\nfunction updateExtensionState() {\n  if (extensionState.enabled) {\n    chrome.webRequest.onBeforeRequest.addListener(\n      handleRequest,\n      { urls: ['*://*.youtube.com/*'] },\n      ['blocking']\n    );\n  } else {\n    chrome.webRequest.onBeforeRequest.removeListener(handleRequest);\n  }\n  updateIcon();\n}\n```\n\n### Content Script Pattern\n\n```javascript\n// Send ready message to background\nchrome.runtime.sendMessage({ type: 'content-ready' });\n\n// Listen for messages from background\nchrome.runtime.onMessage.addListener((message, sender, sendResponse) => {\n  if (message.type === 'audio-url') {\n    applyAudioUrl(message.url);\n    sendResponse({ success: true });\n  }\n  return true; // Keep channel open for async response\n});\n\n// Safe DOM manipulation\nfunction safeGetElement(selector) {\n  return document.querySelector(selector);\n}\n\nfunction applyAudioUrl(url) {\n  const video = document.querySelector('video');\n  if (!video) {\n    console.warn('[YouTube Audio] No video element found');\n    return;\n  }\n  // Apply changes\n}\n```\n\n### Storage Pattern\n\n```javascript\n// Read with defaults\nfunction getSetting(key, defaultValue) {\n  return new Promise((resolve) => {\n    chrome.storage.local.get({ [key]: defaultValue }, (result) => {\n      resolve(result[key]);\n    });\n  });\n}\n\n// Write\nfunction setSetting(key, value) {\n  return new Promise((resolve, reject) => {\n    chrome.storage.local.set({ [key]: value }, () => {\n      if (chrome.runtime.lastError) {\n        reject(chrome.runtime.lastError);\n      } else {\n        resolve();\n      }\n    });\n  });\n}\n```\n\n## URL Processing\n\n### Extracting Audio URLs\n\n```javascript\n/**\n * Checks if a URL is an audio stream.\n * @param {string} url - The URL to check\n * @returns {boolean}\n */\nfunction isAudioUrl(url) {\n  return url.includes('mime=audio') && !url.includes('live=1');\n}\n\n/**\n * Cleans audio URL by removing streaming parameters.\n * @param {string} url - The URL to clean\n * @returns {string}\n */\nfunction cleanAudioUrl(url) {\n  const paramsToRemove = ['range', 'rn', 'rbuf'];\n  return removeURLParameters(url, paramsToRemove);\n}\n```\n\n## DOM Manipulation\n\n### Creating Elements Safely\n\n```javascript\n/**\n * Creates the audio-only notification element.\n * @returns {HTMLElement}\n */\nfunction createNotification() {\n  const container = document.createElement('div');\n  container.className = 'audio_only_div';\n\n  const text = document.createElement('p');\n  text.className = 'alert_text';\n  text.textContent = 'YouTube Audio Extension is running.';\n\n  container.appendChild(text);\n  return container;\n}\n\n// Insert safely\nfunction insertNotification(parent, notification) {\n  if (!parent.querySelector('.audio_only_div')) {\n    parent.appendChild(notification);\n  }\n}\n```\n\n## Testing Considerations\n\nWhen writing code, ensure testability:\n\n```javascript\n// ✅ GOOD: Pure functions are easy to test\nfunction processUrl(url, paramsToRemove) {\n  return removeURLParameters(url, paramsToRemove);\n}\n\n// ✅ GOOD: Separate logic from browser APIs\nfunction shouldProcessRequest(details, enabledTabs) {\n  return (\n    enabledTabs.has(details.tabId) &&\n    details.url.includes('mime=audio') &&\n    !details.url.includes('live=1')\n  );\n}\n\n// ❌ BAD: Logic tightly coupled to browser APIs\nfunction handleRequest(details) {\n  // Direct chrome.tabs.sendMessage without separation\n}\n```\n\n## Performance Guidelines\n\n1. **Minimize DOM queries**\n\n   ```javascript\n   // ✅ Cache element references\n   const video = document.querySelector('video');\n   // Use `video` multiple times\n\n   // ❌ Don't query repeatedly\n   document.querySelector('video').src = url;\n   document.querySelector('video').play();\n   ```\n\n2. **Efficient event handling**\n\n   ```javascript\n   // ✅ Remove listeners when not needed\n   function disableExtension() {\n     chrome.webRequest.onBeforeRequest.removeListener(processRequest);\n   }\n   ```\n\n3. **Lazy initialization**\n   ```javascript\n   // ✅ Only create elements when needed\n   if (audioOnlyDivs.length === 0 && shouldShowNotification) {\n     createAndInsertNotification();\n   }\n   ```\n\n## Security Considerations\n\n1. **Never use innerHTML with untrusted content**\n\n   ```javascript\n   // ✅ Use textContent for plain text\n   element.textContent = message;\n\n   // ❌ Avoid innerHTML with user data\n   element.innerHTML = userProvidedContent;\n   ```\n\n2. **Validate all inputs**\n\n   ```javascript\n   function processMessage(message) {\n     if (!message || typeof message.url !== 'string') {\n       return;\n     }\n     // Process validated message\n   }\n   ```\n\n3. **Use minimal permissions**\n   - Only request permissions actually needed\n   - Document why each permission is required\n\n## Checklist Before Submitting Code\n\n- [ ] Code uses ES6+ features (const/let, arrow functions, template literals)\n- [ ] All functions have JSDoc documentation\n- [ ] Error handling is comprehensive\n- [ ] No direct innerHTML usage with untrusted data\n- [ ] DOM queries are cached where appropriate\n- [ ] Code passes ESLint: `npm run lint`\n- [ ] Specification updated for new features\n- [ ] Works in both Firefox and Chrome\n- [ ] No console.log statements in production code (use console.error for errors only)\n\n## Remember\n\n- **Cross-browser compatibility**: Test in both Firefox and Chrome\n- **Performance matters**: Users shouldn't notice the extension\n- **Graceful degradation**: Handle missing elements and API failures\n- **Clean code**: Future maintainers will thank you\n- **Document decisions**: Explain non-obvious code in comments\n"
  },
  {
    "path": ".github/agents/test-specialist.agent.md",
    "content": "---\nname: Test Specialist\ndescription: Testing and quality assurance expert for YouTube Audio browser extension\ntools: ['*']\n---\n\nYou are a **testing specialist** ensuring **comprehensive, high-quality test coverage** for the **YouTube Audio** browser extension. Your mission is to create thorough tests that validate correctness, prevent regressions, and maintain quality standards.\n\n## Scope & Responsibilities\n\n**You SHOULD:**\n\n- Write comprehensive unit tests using Jest\n- Create mocks for Chrome/Firefox browser APIs\n- Test background scripts, content scripts, and options pages\n- Verify edge cases, error handling, and boundary conditions\n- Ensure tests are deterministic and run quickly\n- Document test intentions with clear names and comments\n- Measure and improve test coverage\n\n**You SHOULD NOT:**\n\n- Modify production code in `js/` unless fixing test-exposed bugs\n- Change CI/CD workflows - use `ci-cd-expert` agent\n- Alter ESLint or Prettier configuration\n- Remove existing passing tests without justification\n- Create tests that depend on external network\n\n## Test Framework & Setup\n\n### Technology Stack\n\n- **Jest**: Test runner and assertion library\n- **jsdom**: Browser environment simulation\n- **Chrome API Mocks**: Custom mocks in `tests/setup.js`\n\n### Directory Structure\n\n```\ntests/\n├── setup.js              # Jest setup with Chrome API mocks\n├── unit/\n│   ├── global.test.js    # Background script tests\n│   ├── youtube_audio.test.js  # Content script tests\n│   └── options.test.js   # Options page tests\n└── integration/          # (Future) Integration tests\n```\n\n## Chrome API Mocking\n\nThe `tests/setup.js` provides comprehensive Chrome API mocks:\n\n### Storage Mock\n\n```javascript\n// Mock provides get/set operations\nchrome.storage.local.get('key', callback);\nchrome.storage.local.set({ key: 'value' }, callback);\n\n// Access internal storage for testing\nchrome.storage.local._setStorage({ key: 'value' });\nchrome.storage.local._getStorage();\n```\n\n### Tabs Mock\n\n```javascript\n// Mock tab operations\nchrome.tabs.get(tabId, callback);\nchrome.tabs.reload(tabId);\nchrome.tabs.sendMessage(tabId, message, callback);\n\n// Manage mock tabs\nchrome.tabs._addTab({ id: 1, active: true });\nchrome.tabs._getTabs();\nchrome.tabs._clearTabs();\n```\n\n### WebRequest Mock\n\n```javascript\n// Add/remove listeners\nchrome.webRequest.onBeforeRequest.addListener(callback, filter, extraInfo);\nchrome.webRequest.onBeforeRequest.removeListener(callback);\n\n// Access listeners for testing\nchrome.webRequest.onBeforeRequest._getListeners();\n```\n\n## Test Patterns\n\n### 1. Unit Test Pattern (AAA)\n\n```javascript\ndescribe('FeatureName', () => {\n  it('should do something specific when condition', () => {\n    // Arrange - Set up test conditions\n    const input = 'test data';\n\n    // Act - Execute the code being tested\n    const result = functionUnderTest(input);\n\n    // Assert - Verify the outcome\n    expect(result).toBe('expected output');\n  });\n});\n```\n\n### 2. Testing Functions from Background Script\n\n```javascript\ndescribe('removeURLParameters', () => {\n  let removeURLParameters;\n\n  beforeEach(() => {\n    // Re-define the function for isolated testing\n    removeURLParameters = function (url, parameters) {\n      // Copy implementation from global.js\n    };\n  });\n\n  it('should remove specified parameters from URL', () => {\n    const url = 'https://example.com?a=1&b=2&c=3';\n    const result = removeURLParameters(url, ['b']);\n    expect(result).toBe('https://example.com?a=1&c=3');\n  });\n});\n```\n\n### 3. Testing Chrome API Interactions\n\n```javascript\ndescribe('saveSettings', () => {\n  it('should save state to chrome.storage.local', () => {\n    const saveSettings = (currentState) => {\n      chrome.storage.local.set({ youtube_audio_state: currentState });\n    };\n\n    saveSettings(true);\n\n    expect(chrome.storage.local.set).toHaveBeenCalledWith({\n      youtube_audio_state: true,\n    });\n  });\n});\n```\n\n### 4. Testing DOM Manipulation\n\n```javascript\ndescribe('Notification creation', () => {\n  beforeEach(() => {\n    document.body.innerHTML = `\n      <div class=\"video-container\">\n        <video src=\"https://youtube.com/video\"></video>\n      </div>\n    `;\n  });\n\n  it('should create notification with correct class', () => {\n    const notification = document.createElement('div');\n    notification.className = 'audio_only_div';\n    document.body.appendChild(notification);\n\n    expect(document.querySelector('.audio_only_div')).not.toBeNull();\n  });\n});\n```\n\n### 5. Testing Video Element\n\n```javascript\ndescribe('makeSetAudioURL', () => {\n  it('should update video src', () => {\n    const video = createMockVideoElement();\n    video.src = 'https://old-url.com';\n\n    makeSetAudioURL(video, 'https://new-url.com');\n\n    expect(video.src).toContain('new-url.com');\n  });\n});\n```\n\n## Mandatory Test Categories\n\nEvery testable function should have:\n\n### 1. Happy Path Tests\n\n```javascript\nit('should process valid audio URL correctly', () => {\n  const details = {\n    tabId: 1,\n    url: 'https://youtube.com?mime=audio&range=0-1000',\n  };\n  tabIds.add(1);\n\n  processRequest(details);\n\n  expect(chrome.tabs.sendMessage).toHaveBeenCalled();\n});\n```\n\n### 2. Edge Case Tests\n\n```javascript\nit('should handle empty URL', () => {\n  const result = removeURLParameters('', ['param']);\n  expect(result).toBe('');\n});\n\nit('should handle URL without query string', () => {\n  const result = removeURLParameters('https://example.com', ['param']);\n  expect(result).toBe('https://example.com');\n});\n```\n\n### 3. Error Handling Tests\n\n```javascript\nit('should not crash on null input', () => {\n  expect(() => {\n    processRequest(null);\n  }).not.toThrow();\n});\n\nit('should ignore requests from non-tracked tabs', () => {\n  const details = { tabId: 999, url: 'https://example.com' };\n\n  processRequest(details);\n\n  expect(chrome.tabs.sendMessage).not.toHaveBeenCalled();\n});\n```\n\n### 4. Negative Tests\n\n```javascript\nit('should not process non-audio URLs', () => {\n  const details = {\n    tabId: 1,\n    url: 'https://youtube.com?mime=video',\n  };\n  tabIds.add(1);\n\n  processRequest(details);\n\n  expect(chrome.tabs.sendMessage).not.toHaveBeenCalled();\n});\n\nit('should not process live streams', () => {\n  const details = {\n    tabId: 1,\n    url: 'https://youtube.com?mime=audio&live=1',\n  };\n  tabIds.add(1);\n\n  processRequest(details);\n\n  expect(chrome.tabs.sendMessage).not.toHaveBeenCalled();\n});\n```\n\n## Test Naming Convention\n\n```javascript\n// Pattern: should_<expected_behavior>_when_<condition>\nit('should remove parameter from URL when parameter exists', () => {});\nit('should not remove parameter when parameter not found', () => {});\nit('should return original URL when no query string', () => {});\n```\n\n## Mock Helpers\n\n### createMockVideoElement\n\n```javascript\n// Defined in tests/setup.js\nglobal.createMockVideoElement = () => {\n  const video = document.createElement('video');\n  video.src = '';\n  video.paused = true;\n  video.play = jest.fn(() => Promise.resolve());\n  video.pause = jest.fn();\n  return video;\n};\n\n// Usage in tests\nconst video = createMockVideoElement();\nvideo.paused = false; // Set state for test\n```\n\n## Running Tests\n\n```bash\n# Run all tests\nnpm test\n\n# Run tests in watch mode\nnpm run test:watch\n\n# Run tests with coverage\nnpm run test:coverage\n\n# Run specific test file\nnpm test -- tests/unit/global.test.js\n\n# Run tests matching pattern\nnpm test -- --testNamePattern=\"removeURLParameters\"\n```\n\n## Coverage Goals\n\nDue to the IIFE pattern in browser extension code, direct coverage measurement is limited. Focus on:\n\n- **Behavior validation**: All critical paths are tested\n- **Edge cases**: Empty inputs, missing elements, error conditions\n- **API interactions**: All Chrome API calls are verified\n- **User scenarios**: Enable/disable, settings changes, page injection\n\n## Assertion Best Practices\n\n```javascript\n// Equality\nexpect(result).toBe('expected');\nexpect(result).toEqual({ key: 'value' });\n\n// Truthiness\nexpect(result).toBeTruthy();\nexpect(result).toBeFalsy();\nexpect(result).toBeNull();\nexpect(result).toBeDefined();\n\n// Contains\nexpect(url).toContain('mime=audio');\nexpect(array).toContain(item);\n\n// Called\nexpect(mockFn).toHaveBeenCalled();\nexpect(mockFn).toHaveBeenCalledWith(arg1, arg2);\nexpect(mockFn).toHaveBeenCalledTimes(1);\n\n// Not\nexpect(mockFn).not.toHaveBeenCalled();\nexpect(result).not.toBeNull();\n```\n\n## Testing Async Code\n\n```javascript\n// Callback-based (Chrome API style)\nit('should load settings from storage', (done) => {\n  chrome.storage.local._setStorage({ setting: true });\n\n  chrome.storage.local.get('setting', (values) => {\n    expect(values.setting).toBe(true);\n    done();\n  });\n});\n\n// Promise-based\nit('should handle async operation', async () => {\n  const result = await asyncFunction();\n  expect(result).toBe('expected');\n});\n```\n\n## Checklist Before Submitting Tests\n\n- [ ] All tests have descriptive names following convention\n- [ ] Tests cover happy path, edge cases, and error conditions\n- [ ] Mock state is reset in `beforeEach`\n- [ ] No tests depend on execution order\n- [ ] Assertions include helpful error messages\n- [ ] Tests run quickly (total < 5 seconds)\n- [ ] No flaky tests (run multiple times to verify)\n- [ ] All tests pass: `npm test`\n\n## Remember\n\n- **Test behavior, not implementation**: Focus on what the code does\n- **One assertion focus per test**: Tests should fail for one reason\n- **Descriptive names**: Tests are documentation\n- **Reset state**: Each test should be independent\n- **Mock sparingly**: Only mock what's necessary\n- **Test edge cases**: Empty, null, boundary values\n"
  },
  {
    "path": ".github/copilot-instructions.md",
    "content": "# YouTube Audio - AI Agent Instructions\n\nThis repository is **AI-Enabled** and optimized for Agentic Coding. Before performing any work, you **MUST** follow these instructions.\n\n## Project Overview\n\n**YouTube Audio** is a Firefox browser extension that allows users to stream only audio from YouTube videos. This saves battery life and bandwidth by disabling video playback while keeping audio.\n\n### Technology Stack\n\n- **Language**: JavaScript (ES6+)\n- **Platform**: Browser Extension (Firefox/Chrome)\n- **Manifest**: WebExtension Manifest V2\n- **APIs**: WebRequest, Storage, Tabs, BrowserAction\n\n## Required Reading\n\n**Before answering any request, you MUST read:**\n\n1. `docs/agent-instructions/` - All files in order (00 → 03)\n2. `docs/adrs/` - Check for past architectural decisions\n3. `docs/specs/` - Review existing specifications\n4. `docs/architecture/` - Understand system design\n\n## Core Rules\n\n### Rule 1: Documentation First\n\n> **\"No spec, no code.\"**\n\n- Before writing code, create or update the specification in `docs/specs/`\n- After writing code, update `docs/history/` with a handoff record\n- Architecture changes require updates to `docs/architecture/`\n\n### Rule 2: Check Before You Code\n\n> **\"Avoid regression by learning from history.\"**\n\n- Check `docs/adrs/` for past decisions before proposing changes\n- Review existing specs to understand design rationale\n- Search the codebase for similar patterns before creating new ones\n\n### Rule 3: Update Documentation\n\n> **\"Code and docs must stay synchronized.\"**\n\nIf you modify code, you **MUST**:\n\n- Update the corresponding spec in `docs/specs/`\n- Update architecture diagrams if structure changes\n- Create an ADR for significant decisions\n- Record a handoff in `docs/history/`\n\n### Rule 4: Research, Don't Hallucinate\n\n> **\"If you're unsure, search the internet. Do not make up APIs.\"**\n\n- Use web search to verify library versions and APIs\n- Check official documentation before using any external dependency\n- Validate browser extension API compatibility\n- Never guess at function signatures or configurations\n\n## Coding Standards\n\n### JavaScript\n\n- Use ES6+ features (const/let, arrow functions, destructuring)\n- Prefer async/await over callbacks where possible\n- Use descriptive variable and function names\n- Add JSDoc comments for public functions\n\n### Browser Extension Specifics\n\n- Follow WebExtension API conventions\n- Handle permissions gracefully\n- Consider cross-browser compatibility (Firefox/Chrome)\n- Test in private/incognito modes\n\n### Testing\n\n- **90% code coverage minimum** for new code\n- Write tests before or with implementation\n- Run `./scripts/validate.sh` before committing\n\n## File Structure\n\n```\nyoutube-audio/\n├── css/                    # Stylesheets\n├── docs/                   # Documentation (THE BRAIN)\n│   ├── adrs/              # Architecture Decision Records\n│   ├── agent-instructions/ # Agent protocols\n│   ├── architecture/      # System diagrams\n│   ├── history/           # Handoffs and deprecated logic\n│   └── specs/             # Technical specifications\n├── html/                   # HTML pages\n├── img/                    # Icons and images\n├── js/                     # JavaScript source\n├── scripts/               # Automation scripts\n├── tests/                 # Test files\n├── .github/               # GitHub configuration\n│   ├── agents/            # GitHub agent configs\n│   └── workflows/         # CI/CD workflows\n└── .claude/               # Claude agent configs\n```\n\n## Common Tasks\n\n### Adding a New Feature\n\n1. Write spec in `docs/specs/SPEC-NNN-feature.md`\n2. Update architecture if needed\n3. Write tests first\n4. Implement feature\n5. Verify 90%+ coverage\n6. Run `./scripts/validate.sh`\n7. Record handoff in `docs/history/`\n\n### Fixing a Bug\n\n1. Check `docs/history/` for related context\n2. Write a failing test that reproduces the bug\n3. Fix the bug\n4. Verify the test passes\n5. Update documentation if behavior changed\n\n### Updating Dependencies\n\n1. Research the update (breaking changes, security fixes)\n2. Create ADR documenting the decision\n3. Update `manifest.json` or `package.json`\n4. Run full test suite\n5. Update documentation\n\n## Quick Reference\n\n| Task                | Command                 |\n| ------------------- | ----------------------- |\n| Run all validations | `./scripts/validate.sh` |\n| Run linter          | `npm run lint`          |\n| Run tests           | `npm test`              |\n| Check coverage      | `npm run test:coverage` |\n\n## Questions?\n\nIf you're unsure about something:\n\n1. Check the documentation in `docs/`\n2. Search the codebase for examples\n3. Research using web search\n4. Ask for clarification rather than guessing\n\n---\n\n_This repository follows the AI-Enabled Repository Standard. Documentation drives code, testing is mandatory, and agents must validate their work._\n"
  },
  {
    "path": ".github/workflows/ci.yml",
    "content": "name: CI\n\non:\n  push:\n    branches: [main, master]\n  pull_request:\n    branches: [main, master]\n\njobs:\n  lint:\n    name: Lint\n    runs-on: ubuntu-latest\n    permissions:\n      contents: read\n    steps:\n      - name: Checkout code\n        uses: actions/checkout@v4\n\n      - name: Setup Node.js\n        uses: actions/setup-node@v4\n        with:\n          node-version: '20'\n          cache: 'npm'\n\n      - name: Install dependencies\n        run: npm ci\n\n      - name: Run ESLint\n        run: npm run lint\n\n      - name: Check formatting with Prettier\n        run: npm run format:check\n\n  test:\n    name: Test\n    runs-on: ubuntu-latest\n    needs: lint\n    permissions:\n      contents: read\n    steps:\n      - name: Checkout code\n        uses: actions/checkout@v4\n\n      - name: Setup Node.js\n        uses: actions/setup-node@v4\n        with:\n          node-version: '20'\n          cache: 'npm'\n\n      - name: Install dependencies\n        run: npm ci\n\n      - name: Run tests with coverage\n        run: npm test -- --coverage --coverageReporters=json-summary --coverageReporters=text\n\n      - name: Check coverage threshold\n        run: |\n          if [ -f coverage/coverage-summary.json ]; then\n            COVERAGE=$(jq '.total.lines.pct' coverage/coverage-summary.json)\n            echo \"Current coverage: $COVERAGE%\"\n            # Note: Coverage tracking is limited for legacy IIFE browser extension code\n            # Tests validate the core logic but direct file imports aren't possible\n            echo \"✅ Tests passed (coverage tracking limited for legacy code pattern)\"\n          else\n            echo \"⚠️ No coverage report found - skipping threshold check\"\n          fi\n\n      - name: Upload coverage report\n        uses: actions/upload-artifact@v4\n        if: always()\n        with:\n          name: coverage-report\n          path: coverage/\n          retention-days: 30\n\n  security:\n    name: Security Scan\n    runs-on: ubuntu-latest\n    needs: lint\n    permissions:\n      actions: read\n      contents: read\n      security-events: write\n    steps:\n      - name: Checkout code\n        uses: actions/checkout@v4\n\n      - name: Initialize CodeQL\n        uses: github/codeql-action/init@v3\n        with:\n          languages: javascript\n\n      - name: Perform CodeQL Analysis\n        uses: github/codeql-action/analyze@v3\n        with:\n          category: '/language:javascript'\n\n  build:\n    name: Build Extension\n    runs-on: ubuntu-latest\n    needs: [lint, test]\n    permissions:\n      contents: read\n    steps:\n      - name: Checkout code\n        uses: actions/checkout@v4\n\n      - name: Validate manifest.json\n        run: |\n          echo \"Validating manifest.json...\"\n          if [ -f manifest.json ]; then\n            jq . manifest.json > /dev/null\n            echo \"✅ manifest.json is valid JSON\"\n          else\n            echo \"❌ manifest.json not found\"\n            exit 1\n          fi\n\n      - name: Check required files\n        run: |\n          echo \"Checking required extension files...\"\n          required_files=(\n            \"manifest.json\"\n            \"js/global.js\"\n            \"js/youtube_audio.js\"\n            \"css/youtube_audio.css\"\n          )\n          for file in \"${required_files[@]}\"; do\n            if [ -f \"$file\" ]; then\n              echo \"✅ $file exists\"\n            else\n              echo \"❌ $file is missing\"\n              exit 1\n            fi\n          done\n\n      - name: Package extension\n        run: |\n          echo \"Creating extension package...\"\n          zip -r youtube-audio-extension.zip \\\n            manifest.json \\\n            js/ \\\n            css/ \\\n            html/ \\\n            img/ \\\n            -x \"*.git*\" \\\n            -x \"node_modules/*\" \\\n            -x \"*.test.js\"\n          echo \"✅ Extension packaged successfully\"\n\n      - name: Upload extension artifact\n        uses: actions/upload-artifact@v4\n        with:\n          name: youtube-audio-extension\n          path: youtube-audio-extension.zip\n          retention-days: 30\n"
  },
  {
    "path": ".github/workflows/pages.yml",
    "content": "# Deploy website to GitHub Pages\nname: Deploy to GitHub Pages\n\non:\n  push:\n    branches: ['main', 'master']\n    paths:\n      - 'website/**'\n      - '.github/workflows/pages.yml'\n  workflow_dispatch:\n\npermissions:\n  contents: read\n  pages: write\n  id-token: write\n\nconcurrency:\n  group: 'pages'\n  cancel-in-progress: false\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v4\n\n      - name: Setup Pages\n        uses: actions/configure-pages@v5\n\n      - name: Upload artifact\n        uses: actions/upload-pages-artifact@v3\n        with:\n          path: ./website\n\n  deploy:\n    environment:\n      name: github-pages\n      url: ${{ steps.deployment.outputs.page_url }}\n    runs-on: ubuntu-latest\n    needs: build\n    steps:\n      - name: Deploy to GitHub Pages\n        id: deployment\n        uses: actions/deploy-pages@v4\n"
  },
  {
    "path": ".gitignore",
    "content": "# Dependencies\nnode_modules/\n\n# Build output\ndist/\n*.zip\n\n# Coverage\ncoverage/\n\n# IDE\n.idea/\n.vscode/\n*.swp\n*.swo\n\n# OS\n.DS_Store\nThumbs.db\n\n# Environment\n.env\n.env.local\n.env.*.local\n\n# Logs\n*.log\nnpm-debug.log*\n\n# Temporary files\n*.tmp\n*.temp\n.cache/\n"
  },
  {
    "path": ".prettierignore",
    "content": "node_modules/\ncoverage/\ndist/\n*.log\n.DS_Store\n*.zip\n.env\n.env.local\n"
  },
  {
    "path": ".prettierrc",
    "content": "{\n  \"semi\": true,\n  \"singleQuote\": true,\n  \"tabWidth\": 2,\n  \"printWidth\": 100,\n  \"trailingComma\": \"es5\",\n  \"bracketSpacing\": true,\n  \"arrowParens\": \"always\",\n  \"endOfLine\": \"lf\"\n}\n"
  },
  {
    "path": "LICENSE",
    "content": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU General Public License is a free, copyleft license for\nsoftware and other kinds of works.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nthe GNU General Public License is intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.  We, the Free Software Foundation, use the\nGNU General Public License for most of our software; it applies also to\nany other work released this way by its authors.  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  To protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights.  Therefore, you have\ncertain responsibilities if you distribute copies of the software, or if\nyou modify it: responsibilities to respect the freedom of others.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received.  You must make sure that they, too, receive\nor can get the source code.  And you must show them these terms so they\nknow their rights.\n\n  Developers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.\n\n  For the developers' and authors' protection, the GPL clearly explains\nthat there is no warranty for this free software.  For both users' and\nauthors' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.\n\n  Some devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the manufacturer\ncan do so.  This is fundamentally incompatible with the aim of\nprotecting users' freedom to change the software.  The systematic\npattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable.  Therefore, we\nhave designed this version of the GPL to prohibit the practice for those\nproducts.  If such problems arise substantially in other domains, we\nstand ready to extend this provision to those domains in future versions\nof the GPL, as needed to protect the freedom of users.\n\n  Finally, every program is threatened constantly by software patents.\nStates should not allow patents to restrict development and use of\nsoftware on general-purpose computers, but in those that do, we wish to\navoid the special danger that patents applied to a free program could\nmake it effectively proprietary.  To prevent this, the GPL assures that\npatents cannot be used to render the program non-free.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Use with the GNU Affero General Public License.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU Affero General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the special requirements of the GNU Affero General Public License,\nsection 13, concerning interaction through a network will apply to the\ncombination as such.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program.  If not, see <https://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If the program does terminal interaction, make it output a short\nnotice like this when it starts in an interactive mode:\n\n    <program>  Copyright (C) <year>  <name of author>\n    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, your program's commands\nmight be different; for a GUI interface, you would use an \"about box\".\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU GPL, see\n<https://www.gnu.org/licenses/>.\n\n  The GNU General Public License does not permit incorporating your program\ninto proprietary programs.  If your program is a subroutine library, you\nmay consider it more useful to permit linking proprietary applications with\nthe library.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.  But first, please read\n<https://www.gnu.org/licenses/why-not-lgpl.html>.\n"
  },
  {
    "path": "README.md",
    "content": "# YouTube Audio 🎵\n\n[![CI](https://github.com/animeshkundu/youtube-audio/actions/workflows/ci.yml/badge.svg)](https://github.com/animeshkundu/youtube-audio/actions/workflows/ci.yml)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n\n> Stream only audio from YouTube videos - Save battery and bandwidth\n\n## Overview\n\nYouTube Audio is a browser extension that disables video playback and streams only the audio from YouTube videos. Perfect for listening to music, podcasts, and any audio content without the battery drain and bandwidth usage of video.\n\n**🌐 Website:** [animeshkundu.github.io/youtube-audio](https://animeshkundu.github.io/youtube-audio)\n\n**🦊 Firefox:** [Install from Firefox Add-ons](https://addons.mozilla.org/en-US/firefox/addon/youtube-audio/)\n\n## Features\n\n- 🔋 **Save Battery** - No video decoding means significantly less battery usage\n- 📶 **Save Bandwidth** - Audio streams are 10-20x smaller than video\n- 🎯 **One-Click Toggle** - Enable/disable with a single click\n- 🌡️ **Reduce Heat** - Your device stays cool during long listening sessions\n- 🔒 **Privacy Focused** - No tracking, no analytics, works entirely locally\n- ⚡ **Lightweight** - Minimal footprint, only activates on YouTube\n\n## Installation\n\n### Firefox (Recommended)\n\nInstall directly from the [Firefox Add-ons Store](https://addons.mozilla.org/en-US/firefox/addon/youtube-audio/).\n\n### Chrome\n\nComing soon! Contributions welcome.\n\n### From Source\n\n1. Clone the repository\n2. Open Firefox and navigate to `about:debugging`\n3. Click \"This Firefox\" → \"Load Temporary Add-on\"\n4. Select the `manifest.json` file\n\n## Development\n\n### Prerequisites\n\n- Node.js 18+\n- npm\n\n### Setup\n\n```bash\n# Install dependencies\nnpm install\n\n# Run linter\nnpm run lint\n\n# Run tests\nnpm test\n\n# Run tests with coverage\nnpm run test:coverage\n\n# Format code\nnpm run format\n```\n\n### Project Structure\n\n```\nyoutube-audio/\n├── js/                     # Extension source code\n│   ├── global.js          # Background script\n│   ├── youtube_audio.js   # Content script\n│   └── options.js         # Options page\n├── css/                    # Stylesheets\n├── html/                   # HTML pages\n├── img/                    # Icons\n├── tests/                  # Jest tests\n├── docs/                   # Documentation\n│   ├── adrs/              # Architecture Decision Records\n│   ├── specs/             # Technical specifications\n│   ├── architecture/      # System diagrams\n│   └── agent-instructions/ # AI agent protocols\n├── website/               # GitHub Pages website\n└── scripts/               # Automation scripts\n```\n\n## Documentation\n\nThis repository is **AI-Enabled** and optimized for agentic coding. Key documentation:\n\n- **[Agent Instructions](docs/agent-instructions/)** - Protocols for AI agents\n- **[Architecture](docs/architecture/)** - System design and diagrams\n- **[Specifications](docs/specs/)** - Technical specifications\n- **[ADRs](docs/adrs/)** - Architecture Decision Records\n\n## Contributing\n\nContributions are welcome! Please:\n\n1. Read the [agent instructions](docs/agent-instructions/) before making changes\n2. Create a specification for new features\n3. Write tests for new functionality\n4. Run `npm run lint` and `npm test` before submitting\n\n## License\n\n[MIT License](LICENSE) - Free and open source\n\n## Author\n\n**Animesh Kundu** - [GitHub](https://github.com/animeshkundu)\n"
  },
  {
    "path": "claude.md",
    "content": "# YouTube Audio - AI Agent Instructions\n\nThis repository is **AI-Enabled** and optimized for Agentic Coding. Before performing any work, you **MUST** follow these instructions.\n\n## Project Overview\n\n**YouTube Audio** is a Firefox browser extension that allows users to stream only audio from YouTube videos. This saves battery life and bandwidth by disabling video playback while keeping audio.\n\n### Technology Stack\n\n- **Language**: JavaScript (ES6+)\n- **Platform**: Browser Extension (Firefox/Chrome)\n- **Manifest**: WebExtension Manifest V2\n- **APIs**: WebRequest, Storage, Tabs, BrowserAction\n\n## Required Reading\n\n**Before answering any request, you MUST read:**\n\n1. `docs/agent-instructions/` - All files in order (00 → 03)\n2. `docs/adrs/` - Check for past architectural decisions\n3. `docs/specs/` - Review existing specifications\n4. `docs/architecture/` - Understand system design\n\n## Core Rules\n\n### Rule 1: Documentation First\n\n> **\"No spec, no code.\"**\n\n- Before writing code, create or update the specification in `docs/specs/`\n- After writing code, update `docs/history/` with a handoff record\n- Architecture changes require updates to `docs/architecture/`\n\n### Rule 2: Check Before You Code\n\n> **\"Avoid regression by learning from history.\"**\n\n- Check `docs/adrs/` for past decisions before proposing changes\n- Review existing specs to understand design rationale\n- Search the codebase for similar patterns before creating new ones\n\n### Rule 3: Update Documentation\n\n> **\"Code and docs must stay synchronized.\"**\n\nIf you modify code, you **MUST**:\n\n- Update the corresponding spec in `docs/specs/`\n- Update architecture diagrams if structure changes\n- Create an ADR for significant decisions\n- Record a handoff in `docs/history/`\n\n### Rule 4: Research, Don't Hallucinate\n\n> **\"If you're unsure, search the internet. Do not make up APIs.\"**\n\n- Use web search to verify library versions and APIs\n- Check official documentation before using any external dependency\n- Validate browser extension API compatibility\n- Never guess at function signatures or configurations\n\n## Coding Standards\n\n### JavaScript\n\n- Use ES6+ features (const/let, arrow functions, destructuring)\n- Prefer async/await over callbacks where possible\n- Use descriptive variable and function names\n- Add JSDoc comments for public functions\n\n### Browser Extension Specifics\n\n- Follow WebExtension API conventions\n- Handle permissions gracefully\n- Consider cross-browser compatibility (Firefox/Chrome)\n- Test in private/incognito modes\n\n### Testing\n\n- **90% code coverage minimum** for new code\n- Write tests before or with implementation\n- Run `./scripts/validate.sh` before committing\n\n## File Structure\n\n```\nyoutube-audio/\n├── css/                    # Stylesheets\n├── docs/                   # Documentation (THE BRAIN)\n│   ├── adrs/              # Architecture Decision Records\n│   ├── agent-instructions/ # Agent protocols\n│   ├── architecture/      # System diagrams\n│   ├── history/           # Handoffs and deprecated logic\n│   └── specs/             # Technical specifications\n├── html/                   # HTML pages\n├── img/                    # Icons and images\n├── js/                     # JavaScript source\n├── scripts/               # Automation scripts\n├── tests/                 # Test files\n├── .github/               # GitHub configuration\n│   ├── agents/            # GitHub agent configs\n│   └── workflows/         # CI/CD workflows\n└── .claude/               # Claude agent configs\n```\n\n## Common Tasks\n\n### Adding a New Feature\n\n1. Write spec in `docs/specs/SPEC-NNN-feature.md`\n2. Update architecture if needed\n3. Write tests first\n4. Implement feature\n5. Verify 90%+ coverage\n6. Run `./scripts/validate.sh`\n7. Record handoff in `docs/history/`\n\n### Fixing a Bug\n\n1. Check `docs/history/` for related context\n2. Write a failing test that reproduces the bug\n3. Fix the bug\n4. Verify the test passes\n5. Update documentation if behavior changed\n\n### Updating Dependencies\n\n1. Research the update (breaking changes, security fixes)\n2. Create ADR documenting the decision\n3. Update `manifest.json` or `package.json`\n4. Run full test suite\n5. Update documentation\n\n## Quick Reference\n\n| Task                | Command                 |\n| ------------------- | ----------------------- |\n| Run all validations | `./scripts/validate.sh` |\n| Run linter          | `npm run lint`          |\n| Run tests           | `npm test`              |\n| Check coverage      | `npm run test:coverage` |\n\n## Questions?\n\nIf you're unsure about something:\n\n1. Check the documentation in `docs/`\n2. Search the codebase for examples\n3. Research using web search\n4. Ask for clarification rather than guessing\n\n---\n\n_This repository follows the AI-Enabled Repository Standard. Documentation drives code, testing is mandatory, and agents must validate their work._\n"
  },
  {
    "path": "css/youtube_audio.css",
    "content": ".audio_only_div {\n  z-index: 9999;\n  background-color: #272b2e;\n  color: #cc6633;\n  cursor: pointer;\n  position: relative;\n  top: 50%;\n  transform: translateY(-50%);\n  height: 50%;\n  box-shadow: 0 1px 50px 0 rgba(0, 0, 0, 0.3);\n  font-size: 15px;\n  font-weight: 600;\n  pointer-events: none;\n  opacity: 0.5;\n}\n\n.alert_text {\n  position: relative;\n  top: 50%;\n  transform: translateY(-50%);\n  text-align: center;\n}\n"
  },
  {
    "path": "docs/adrs/0000-template.md",
    "content": "# ADR-0000: [Short Title of Decision]\n\n## Status\n\n**Proposed** | Accepted | Deprecated | Superseded by [ADR-XXXX]\n\n## Date\n\nYYYY-MM-DD\n\n## Context\n\nDescribe the issue motivating this decision, and any context that influenced the decision.\n\n### Problem Statement\n\nWhat is the specific problem we are trying to solve?\n\n### Constraints\n\n- List any constraints that limit our options\n- Technical constraints\n- Business constraints\n- Time constraints\n\n## Decision\n\nDescribe the decision that was made.\n\n### Considered Options\n\n1. **Option A**: Brief description\n   - Pros: ...\n   - Cons: ...\n2. **Option B**: Brief description\n   - Pros: ...\n   - Cons: ...\n\n### Chosen Option\n\nState which option was chosen and why.\n\n## Consequences\n\n### Positive\n\n- List positive outcomes\n\n### Negative\n\n- List negative outcomes or trade-offs\n\n### Neutral\n\n- List neutral observations\n\n## Related ADRs\n\n- Link to related ADRs if applicable\n\n## References\n\n- Links to external resources, documentation, or research\n"
  },
  {
    "path": "docs/adrs/README.md",
    "content": "# Architecture Decision Records (ADRs)\n\n## Purpose\n\nThis folder contains Architecture Decision Records (ADRs) that document significant technical decisions made in the project.\n\n## What is an ADR?\n\nAn Architecture Decision Record is a short document that captures an important architectural decision made along with its context and consequences.\n\n## When to Create an ADR\n\n- When making a significant technical choice\n- When changing technology or framework\n- When establishing patterns or conventions\n- When deprecating existing approaches\n\n## How to Use\n\n1. Copy `0000-template.md` to a new file with the next sequential number\n2. Fill in all sections thoroughly\n3. Submit as part of your PR for review\n4. Update status as the decision evolves\n\n## File Naming Convention\n\n- Format: `NNNN-short-title.md`\n- Example: `0001-use-manifest-v3.md`\n\n## ADR Statuses\n\n- **Proposed**: Under discussion\n- **Accepted**: Approved and in effect\n- **Deprecated**: No longer applicable\n- **Superseded**: Replaced by a newer ADR\n"
  },
  {
    "path": "docs/agent-instructions/00-core-philosophy.md",
    "content": "# Core Philosophy\n\n## The Prime Directive\n\n> **Documentation equals code. No documentation, no code.**\n\n## Principle 1: Docs = Code\n\n### The Rule\n\nEvery piece of code **MUST** have corresponding documentation. This is not optional—it is the foundation of how we work.\n\n### Before Writing Code\n\n1. Write or update the specification in `docs/specs/`\n2. Ensure architecture diagrams in `docs/architecture/` reflect your changes\n3. Check `docs/adrs/` for relevant past decisions\n\n### After Writing Code\n\n1. Update `docs/history/` with a handoff record\n2. Verify all documentation is synchronized with implementation\n3. Document any deviations from the original spec\n\n### Documentation Types\n\n| Code Change       | Required Documentation                  |\n| ----------------- | --------------------------------------- |\n| New feature       | Spec + Architecture update              |\n| Bug fix           | Note in history, update spec if needed  |\n| Refactor          | Architecture update, ADR if significant |\n| Dependency change | ADR required                            |\n\n## Principle 2: The CEO Model\n\n### Hierarchy\n\nWhen working on complex tasks, agents operate in a hierarchical model:\n\n```\nCEO Agent (Initiator)\n├── Worker Agent 1 (Subtask A)\n├── Worker Agent 2 (Subtask B)\n└── Worker Agent 3 (Subtask C)\n```\n\n### CEO Responsibilities\n\n- Decompose the task into subtasks\n- Delegate to specialized workers\n- Synthesize results\n- Make final decisions\n- Ensure documentation compliance\n\n### Worker Responsibilities\n\n- Execute assigned subtasks\n- Report progress and blockers\n- Request clarification when needed\n- Follow all protocols strictly\n\n### Communication\n\n- Workers report to CEO, not to each other\n- CEO maintains context across all workers\n- Handoffs between workers go through CEO\n\n## Principle 3: First Principles Reasoning\n\n### The Process\n\nBefore implementing anything:\n\n1. **Understand** - What is the actual problem?\n2. **Decompose** - Break into fundamental components\n3. **Research** - Gather relevant information\n4. **Plan** - Create a step-by-step approach\n5. **Validate** - Check plan against requirements\n6. **Execute** - Implement with continuous verification\n\n### Anti-Patterns to Avoid\n\n❌ Copying code without understanding  \n❌ Assuming solutions based on pattern matching  \n❌ Implementing without a plan  \n❌ Skipping research phase  \n❌ Ignoring edge cases\n\n### Thinking Process\n\nDocument your reasoning explicitly:\n\n```markdown\n## Reasoning\n\n### Problem Understanding\n\n[What I understand the problem to be]\n\n### Key Constraints\n\n[Limitations and requirements]\n\n### Approach\n\n[My planned solution and why]\n\n### Risks\n\n[What could go wrong]\n\n### Validation\n\n[How I will verify success]\n```\n\n## Principle 4: Synchronization\n\n### The Sync Workflow\n\nAfter completing any work:\n\n1. **Review** all files changed\n2. **Update** corresponding documentation\n3. **Record** handoff in `docs/history/`\n4. **Verify** no documentation drift\n\n### Documentation Drift\n\nDocumentation drift occurs when code and docs become out of sync. This is a **critical failure**.\n\nTo prevent drift:\n\n- Always update docs in the same PR as code\n- Review docs during code review\n- Automate checks where possible\n\n### Checklist Before Completing Work\n\n- [ ] Spec reflects implementation\n- [ ] Architecture diagrams are accurate\n- [ ] ADRs are current\n- [ ] Handoff recorded in history\n- [ ] No undocumented assumptions\n\n## Summary\n\n1. **Write docs first**, then code\n2. **CEO delegates**, workers execute\n3. **Reason from first principles**, not patterns\n4. **Keep everything synchronized**, always\n"
  },
  {
    "path": "docs/agent-instructions/01-research-and-web.md",
    "content": "# Research and Web Guidelines\n\n## The Prime Directive\n\n> **The internet is a first-class tool. Use it before you code.**\n\n## Principle 1: Internet is First-Class\n\n### Why Research First?\n\n- APIs change frequently\n- Best practices evolve\n- Libraries are deprecated\n- New solutions emerge\n- Documentation may be outdated\n\n### Mandatory Research Triggers\n\nYou **MUST** perform web research before:\n\n- Using any external library or API\n- Implementing security-sensitive code\n- Making architectural decisions\n- Choosing between multiple approaches\n- Working with unfamiliar technologies\n\n### Research Sources\n\nPrioritize in this order:\n\n1. **Official documentation** - Always check first\n2. **GitHub repositories** - Check issues, discussions, recent commits\n3. **Stack Overflow** - Verified solutions (check dates!)\n4. **Technical blogs** - From reputable sources\n5. **Community forums** - For edge cases\n\n## Principle 2: Validation Protocol\n\n### Library Validation\n\nBefore using any library, validate:\n\n```markdown\n## Library Validation: [library-name]\n\n### Basic Information\n\n- Name: [npm/pip/etc package name]\n- Current Version: [latest stable]\n- Last Updated: [date]\n- Weekly Downloads: [number]\n\n### Health Indicators\n\n- [ ] Active maintenance (commits in last 6 months)\n- [ ] Responsive to issues\n- [ ] No critical security vulnerabilities\n- [ ] Compatible with our stack\n- [ ] License is acceptable\n\n### Version Check\n\n- Documentation version: [what docs say]\n- Actual latest version: [from package registry]\n- Breaking changes in recent versions: [yes/no, details]\n\n### Validation Method\n\n[How I verified this information]\n```\n\n### API Validation\n\nBefore using any external API:\n\n```markdown\n## API Validation: [API Name]\n\n### Endpoint\n\n- URL: [base URL]\n- Documentation: [link]\n- Last verified: [date]\n\n### Authentication\n\n- Method: [API key, OAuth, etc.]\n- Rate limits: [requests per minute/hour]\n\n### Response Format\n\n- Verified structure matches docs: [yes/no]\n- Sample response: [example]\n\n### Error Handling\n\n- Known error codes: [list]\n- Retry strategy: [description]\n```\n\n## Principle 3: Information Saturation\n\n### The Saturation Point\n\nResearch until you reach **information saturation**—the point where additional research yields no new insights.\n\n### Signs of Saturation\n\n✅ Multiple sources agree on the approach  \n✅ You understand the trade-offs  \n✅ Edge cases are identified  \n✅ No conflicting information remains unresolved  \n✅ You can explain the solution without notes\n\n### Signs You Need More Research\n\n❌ Conflicting information from sources  \n❌ Uncertainty about best practices  \n❌ Unfamiliar with failure modes  \n❌ Can't answer \"why this approach?\"  \n❌ Only found one source\n\n### Research Depth by Task Type\n\n| Task Type         | Minimum Research                         |\n| ----------------- | ---------------------------------------- |\n| Bug fix           | Check if known issue, existing solutions |\n| New feature       | Full saturation required                 |\n| Dependency update | Changelog review, breaking changes       |\n| Security fix      | Critical - extensive research required   |\n| Refactor          | Understand all affected patterns         |\n\n## Principle 4: No Hallucination Policy\n\n### The Rule\n\n> **Never guess. Never assume. Always verify.**\n\n### What Constitutes Hallucination?\n\n- Making up API endpoints\n- Assuming function signatures\n- Inventing configuration options\n- Guessing at library behavior\n- Fabricating version numbers\n\n### When Uncertain\n\n1. **Stop** - Don't proceed with uncertainty\n2. **Research** - Use web search to verify\n3. **Confirm** - Find authoritative source\n4. **Document** - Record your finding\n\n### Verification Template\n\n```markdown\n## Verification Record\n\n### Claim\n\n[What I'm verifying]\n\n### Source\n\n[Authoritative source URL]\n\n### Verification Date\n\n[When I checked]\n\n### Confidence Level\n\n[High/Medium/Low with explanation]\n```\n\n## Research Workflow\n\n### Step-by-Step Process\n\n```\n1. Identify what you need to know\n         ↓\n2. Search official documentation first\n         ↓\n3. Cross-reference with multiple sources\n         ↓\n4. Check recency of information\n         ↓\n5. Validate version compatibility\n         ↓\n6. Document findings\n         ↓\n7. Proceed only with verified information\n```\n\n### Documentation of Research\n\nAlways document your research in your work:\n\n```markdown\n## Research Summary\n\n### Topic\n\n[What I researched]\n\n### Key Findings\n\n- [Finding 1]\n- [Finding 2]\n\n### Sources\n\n- [URL 1] - [What I learned]\n- [URL 2] - [What I learned]\n\n### Decision\n\n[Based on research, I will...]\n\n### Confidence\n\n[High/Medium/Low] because [reason]\n```\n\n## Summary\n\n1. **Research before coding** - Internet is a tool, use it\n2. **Validate everything** - Libraries, APIs, versions\n3. **Reach saturation** - Don't stop until you truly understand\n4. **Never hallucinate** - Verify or don't proceed\n"
  },
  {
    "path": "docs/agent-instructions/02-testing-and-validation.md",
    "content": "# Testing and Validation Guidelines\n\n## The Prime Directive\n\n> **If it's not tested, it doesn't work. Period.**\n\n## Principle 1: The 90% Rule\n\n### Code Coverage Mandate\n\nAll code contributions **MUST** achieve a minimum of **90% code coverage** for:\n\n- Unit tests\n- Integration tests\n\n### What This Means\n\n```\nLines of code written: 100\nLines covered by tests: 90+ (minimum)\n```\n\n### Coverage Metrics\n\nTrack these metrics:\n\n- **Line coverage**: % of lines executed by tests\n- **Branch coverage**: % of conditional branches tested\n- **Function coverage**: % of functions called by tests\n\n### Exceptions (Rare)\n\nCoverage below 90% may be acceptable only for:\n\n- Trivial getters/setters (document why)\n- Third-party integration code (mock instead)\n- Legacy code being refactored (with improvement plan)\n\n**All exceptions require documented justification.**\n\n## Principle 2: Test-Driven Development\n\n### The TDD Workflow\n\n```\n1. Write the test FIRST\n         ↓\n2. Run test (it should FAIL)\n         ↓\n3. Write minimal code to pass\n         ↓\n4. Run test (it should PASS)\n         ↓\n5. Refactor if needed\n         ↓\n6. Repeat\n```\n\n### Why Tests First?\n\n- Forces clear understanding of requirements\n- Ensures testable code design\n- Documents expected behavior\n- Prevents feature creep\n- Provides immediate feedback\n\n### Test Structure (AAA Pattern)\n\n```javascript\ndescribe('Feature', () => {\n  it('should do something specific', () => {\n    // Arrange - Set up test conditions\n    const input = 'test data';\n\n    // Act - Execute the code being tested\n    const result = functionUnderTest(input);\n\n    // Assert - Verify the outcome\n    expect(result).toBe('expected output');\n  });\n});\n```\n\n## Principle 3: Test Types\n\n### Unit Tests\n\n**Scope**: Single function or method  \n**Isolation**: No external dependencies  \n**Speed**: Fast (< 100ms each)\n\n```javascript\n// Example: Testing URL parameter removal\ndescribe('removeURLParameters', () => {\n  it('should remove specified parameters from URL', () => {\n    const url = 'https://example.com?a=1&b=2&c=3';\n    const result = removeURLParameters(url, ['b']);\n    expect(result).toBe('https://example.com?a=1&c=3');\n  });\n\n  it('should handle URL without parameters', () => {\n    const url = 'https://example.com';\n    const result = removeURLParameters(url, ['any']);\n    expect(result).toBe('https://example.com');\n  });\n});\n```\n\n### Integration Tests\n\n**Scope**: Multiple components together  \n**Isolation**: May use real dependencies or mocks  \n**Speed**: Moderate (< 5s each)\n\n```javascript\n// Example: Testing browser storage integration\ndescribe('Settings Integration', () => {\n  it('should persist and retrieve settings', async () => {\n    await saveSettings(true);\n    const result = await loadSettings();\n    expect(result.youtube_audio_state).toBe(true);\n  });\n});\n```\n\n### End-to-End Tests\n\n**Scope**: Full user workflows  \n**Isolation**: Real browser environment  \n**Speed**: Slow (acceptable)\n\n## Principle 4: Self-Correction\n\n### Before Committing\n\nEvery agent **MUST** run tests locally before committing:\n\n```bash\n# Run the validation script\n./scripts/validate.sh\n```\n\n### Self-Correction Workflow\n\n```\n1. Write code\n         ↓\n2. Run tests locally\n         ↓\n3. Tests fail?\n    YES → Fix code, return to step 2\n    NO  → Continue\n         ↓\n4. Run linter\n         ↓\n5. Linter errors?\n    YES → Fix issues, return to step 4\n    NO  → Continue\n         ↓\n6. Check coverage\n         ↓\n7. Coverage < 90%?\n    YES → Add more tests, return to step 2\n    NO  → Ready to commit\n```\n\n### When Tests Fail\n\n1. **Read the error message** carefully\n2. **Identify the root cause** (not just symptoms)\n3. **Fix the code** (not the test, usually)\n4. **Add regression test** if needed\n5. **Re-run all tests** to ensure no regressions\n\n## Test File Organization\n\n### Structure\n\n```\nproject/\n├── js/\n│   ├── global.js\n│   └── youtube_audio.js\n├── tests/\n│   ├── unit/\n│   │   ├── global.test.js\n│   │   └── youtube_audio.test.js\n│   └── integration/\n│       └── extension.test.js\n├── jest.config.js\n└── package.json\n```\n\n### Naming Conventions\n\n- Test files: `[module].test.js` or `[module].spec.js`\n- Test descriptions: Should read like documentation\n- Test function names: `should [expected behavior] when [condition]`\n\n## Coverage Reporting\n\n### Generating Reports\n\n```bash\n# Run tests with coverage\nnpm test -- --coverage\n\n# View coverage report\nopen coverage/lcov-report/index.html\n```\n\n### Interpreting Reports\n\n- 🟢 Green: Covered lines\n- 🔴 Red: Uncovered lines\n- 🟡 Yellow: Partially covered branches\n\n### Coverage Goals by File Type\n\n| File Type        | Target Coverage |\n| ---------------- | --------------- |\n| Core logic       | 95%+            |\n| Utilities        | 90%+            |\n| UI handlers      | 85%+            |\n| Config/constants | N/A             |\n\n## Testing Best Practices\n\n### Do\n\n✅ Test edge cases  \n✅ Test error conditions  \n✅ Use descriptive test names  \n✅ Keep tests independent  \n✅ Test one thing per test  \n✅ Use meaningful assertions\n\n### Don't\n\n❌ Test implementation details  \n❌ Use magic numbers without explanation  \n❌ Write tests that depend on order  \n❌ Skip tests without documentation  \n❌ Test external libraries  \n❌ Write flaky tests\n\n## Summary\n\n1. **90% coverage minimum** - Non-negotiable\n2. **Tests before code** - TDD is the way\n3. **Self-validate always** - Run tests before committing\n4. **Fix code, not tests** - Tests define expected behavior\n"
  },
  {
    "path": "docs/agent-instructions/03-tooling-and-pipelines.md",
    "content": "# Tooling and Pipelines Guidelines\n\n## The Prime Directive\n\n> **Automate everything you do twice. No exceptions.**\n\n## Principle 1: Tool Creation Rule\n\n### The Two-Time Rule\n\nIf you perform any verification, validation, or build task **twice**, you **MUST** create a script for it.\n\n### Why Scripts?\n\n- Consistency across agents and developers\n- Reproducibility\n- Documentation through code\n- Reduced human error\n- Faster onboarding\n\n### Script Requirements\n\nEvery script must:\n\n1. Be executable (`chmod +x`)\n2. Have clear error messages\n3. Return appropriate exit codes\n4. Be documented in `scripts/README.md`\n5. Work in CI environment\n\n### Script Template\n\n```bash\n#!/bin/bash\n# Script: [name]\n# Purpose: [what it does]\n# Usage: ./scripts/[name].sh [args]\n\nset -e  # Exit on error\nset -u  # Exit on undefined variable\n\n# Configuration\nSCRIPT_DIR=\"$(cd \"$(dirname \"${BASH_SOURCE[0]}\")\" && pwd)\"\nPROJECT_ROOT=\"$(dirname \"$SCRIPT_DIR\")\"\n\n# Functions\nlog_info() {\n    echo \"[INFO] $1\"\n}\n\nlog_error() {\n    echo \"[ERROR] $1\" >&2\n}\n\n# Main logic\nmain() {\n    log_info \"Starting [task]...\"\n\n    # Your code here\n\n    log_info \"Completed successfully\"\n}\n\nmain \"$@\"\n```\n\n## Principle 2: CI/CD Priority\n\n### Pipeline Priority Order\n\nWhen setting up CI/CD, implement in this order:\n\n1. **Lint** - Fast feedback on code quality\n2. **Build** - Ensure code compiles/bundles\n3. **Test** - Verify functionality\n4. **Coverage** - Enforce quality gates\n5. **Security** - Scan for vulnerabilities\n6. **Deploy** - Only after all checks pass\n\n### GitHub Actions Structure\n\n```yaml\nname: CI\n\non:\n  push:\n    branches: [main]\n  pull_request:\n    branches: [main]\n\njobs:\n  lint:\n    # First - fastest feedback\n\n  build:\n    # Second - ensure it compiles\n    needs: lint\n\n  test:\n    # Third - verify behavior\n    needs: build\n\n  security:\n    # Fourth - check for vulnerabilities\n    needs: test\n\n  deploy:\n    # Last - only after all checks\n    needs: [lint, build, test, security]\n    if: github.ref == 'refs/heads/main'\n```\n\n### Required Checks\n\nEvery PR must pass:\n\n- [ ] Linting (ESLint/Prettier for JS)\n- [ ] Build succeeds\n- [ ] Tests pass\n- [ ] Coverage ≥ 90%\n- [ ] No security vulnerabilities\n- [ ] No merge conflicts\n\n## Principle 3: Standard Scripts\n\n### Required Scripts\n\nEvery project must have these scripts in `scripts/`:\n\n#### `validate.sh`\n\n**Purpose**: Run all validation checks locally\n\n```bash\n#!/bin/bash\n# Run full validation suite\n\nset -e\n\necho \"🔍 Running linter...\"\nnpm run lint\n\necho \"🔨 Building...\"\nnpm run build\n\necho \"🧪 Running tests...\"\nnpm test\n\necho \"📊 Checking coverage...\"\nnpm run test:coverage\n\necho \"✅ All validations passed!\"\n```\n\n#### `setup.sh`\n\n**Purpose**: Set up development environment\n\n```bash\n#!/bin/bash\n# Set up development environment\n\nset -e\n\necho \"📦 Installing dependencies...\"\nnpm install\n\necho \"🔧 Setting up git hooks...\"\nnpm run prepare\n\necho \"✅ Setup complete!\"\n```\n\n#### `lint.sh`\n\n**Purpose**: Run linting with auto-fix option\n\n```bash\n#!/bin/bash\n# Run linting\n\nset -e\n\nif [ \"${1:-}\" = \"--fix\" ]; then\n    npm run lint:fix\nelse\n    npm run lint\nfi\n```\n\n### Script Documentation\n\nMaintain `scripts/README.md`:\n\n```markdown\n# Scripts\n\n## Available Scripts\n\n| Script      | Purpose               | Usage                       |\n| ----------- | --------------------- | --------------------------- |\n| validate.sh | Run all checks        | `./scripts/validate.sh`     |\n| setup.sh    | Setup dev environment | `./scripts/setup.sh`        |\n| lint.sh     | Run linter            | `./scripts/lint.sh [--fix]` |\n```\n\n## Principle 4: Tooling Standards\n\n### Required Development Tools\n\n| Tool     | Purpose            | Configuration File |\n| -------- | ------------------ | ------------------ |\n| ESLint   | JavaScript linting | `.eslintrc.js`     |\n| Prettier | Code formatting    | `.prettierrc`      |\n| Jest     | Testing            | `jest.config.js`   |\n| Husky    | Git hooks          | `.husky/`          |\n\n### Configuration Files\n\nKeep all configuration in project root:\n\n```\nproject/\n├── .eslintrc.js\n├── .prettierrc\n├── jest.config.js\n├── package.json\n└── scripts/\n    └── ...\n```\n\n### Version Pinning\n\nAll tools must be version-pinned in `package.json`:\n\n```json\n{\n  \"devDependencies\": {\n    \"eslint\": \"8.56.0\",\n    \"prettier\": \"3.2.4\",\n    \"jest\": \"29.7.0\"\n  }\n}\n```\n\n## CI/CD Workflow Template\n\n### Complete GitHub Actions Workflow\n\n```yaml\nname: CI\n\non:\n  push:\n    branches: [main]\n  pull_request:\n    branches: [main]\n\njobs:\n  lint:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n      - uses: actions/setup-node@v4\n        with:\n          node-version: '20'\n          cache: 'npm'\n      - run: npm ci\n      - run: npm run lint\n\n  test:\n    runs-on: ubuntu-latest\n    needs: lint\n    steps:\n      - uses: actions/checkout@v4\n      - uses: actions/setup-node@v4\n        with:\n          node-version: '20'\n          cache: 'npm'\n      - run: npm ci\n      - run: npm test -- --coverage\n      - name: Check coverage threshold\n        run: |\n          COVERAGE=$(cat coverage/coverage-summary.json | jq '.total.lines.pct')\n          if (( $(echo \"$COVERAGE < 90\" | bc -l) )); then\n            echo \"Coverage is $COVERAGE%, minimum is 90%\"\n            exit 1\n          fi\n\n  security:\n    runs-on: ubuntu-latest\n    needs: lint\n    steps:\n      - uses: actions/checkout@v4\n      - name: Run CodeQL\n        uses: github/codeql-action/init@v3\n        with:\n          languages: javascript\n      - uses: github/codeql-action/analyze@v3\n```\n\n## Summary\n\n1. **Automate on second occurrence** - Script everything repeatable\n2. **CI/CD is mandatory** - Lint → Build → Test → Deploy\n3. **Standard scripts** - validate.sh, setup.sh, lint.sh\n4. **Pin all versions** - Reproducibility is key\n"
  },
  {
    "path": "docs/agent-instructions/README.md",
    "content": "# Agent Instructions\n\n## Purpose\n\nThis folder contains protocols and guidelines that all AI agents **MUST** follow when working on this repository.\n\n## Required Reading Order\n\nBefore performing any work, agents must read these files in order:\n\n1. `00-core-philosophy.md` - Fundamental principles\n2. `01-research-and-web.md` - Research requirements\n3. `02-testing-and-validation.md` - Testing mandates\n4. `03-tooling-and-pipelines.md` - Automation rules\n\n## Compliance\n\n- These instructions are **mandatory**, not optional\n- Violations will result in rejected work\n- When in doubt, ask for clarification rather than assuming\n\n## File Overview\n\n### 00-core-philosophy.md\n\nThe foundational mindset for all work:\n\n- Documentation-driven development\n- The CEO/Worker agent model\n- First principles reasoning\n\n### 01-research-and-web.md\n\nHow to gather information:\n\n- Internet research requirements\n- Validation protocols\n- Information saturation principle\n\n### 02-testing-and-validation.md\n\nQuality assurance requirements:\n\n- 90% code coverage mandate\n- Test-driven development\n- Self-correction procedures\n\n### 03-tooling-and-pipelines.md\n\nAutomation and CI/CD:\n\n- Tool creation rules\n- Pipeline priorities\n- Script standardization\n"
  },
  {
    "path": "docs/architecture/README.md",
    "content": "# Architecture Documentation\n\n## Purpose\n\nThis folder contains high-level system architecture documentation using Mermaid.js diagrams and design documents.\n\n## Current Architecture\n\n### YouTube Audio Browser Extension Architecture\n\n```mermaid\nflowchart TD\n    subgraph Browser[\"Browser Environment\"]\n        subgraph Extension[\"YouTube Audio Extension\"]\n            BG[Background Script<br/>global.js]\n            CS[Content Script<br/>youtube_audio.js]\n            OP[Options Page<br/>options.js]\n        end\n\n        subgraph APIs[\"Browser APIs\"]\n            WR[WebRequest API]\n            ST[Storage API]\n            TB[Tabs API]\n            BA[BrowserAction API]\n        end\n\n        subgraph YouTube[\"YouTube Page\"]\n            VP[Video Player]\n            DOM[Page DOM]\n        end\n    end\n\n    User([User]) -->|Click Extension Icon| BA\n    BA -->|Toggle State| BG\n    BG -->|Enable/Disable| WR\n    WR -->|Intercept Audio URL| BG\n    BG -->|Send Audio URL| CS\n    CS -->|Replace Video Source| VP\n    CS -->|Add Audio-Only Indicator| DOM\n    BG <-->|Store State| ST\n    OP <-->|Read/Write Settings| ST\n    BG <-->|Track Active Tabs| TB\n```\n\n### Component Responsibilities\n\n#### Background Script (`global.js`)\n\n- Manages extension state (enabled/disabled)\n- Intercepts WebRequests to detect audio streams\n- Communicates audio URLs to content scripts\n- Handles tab lifecycle management\n\n#### Content Script (`youtube_audio.js`)\n\n- Receives audio URLs from background script\n- Replaces video source with audio-only stream\n- Displays user notification overlay\n- Respects user preferences from storage\n\n#### Options Page (`options.js`)\n\n- Provides user preferences UI\n- Saves settings to browser storage\n\n### Data Flow\n\n```mermaid\nsequenceDiagram\n    participant User\n    participant BrowserAction\n    participant Background as Background Script\n    participant Storage\n    participant WebRequest\n    participant Content as Content Script\n    participant VideoPlayer\n\n    User->>BrowserAction: Click icon\n    BrowserAction->>Background: Toggle state\n    Background->>Storage: Save new state\n    Background->>Background: Enable/Disable WebRequest listener\n\n    Note over Background,VideoPlayer: When extension is enabled\n\n    WebRequest->>Background: Intercept request with mime=audio\n    Background->>Background: Parse and clean URL\n    Background->>Content: Send audio URL\n    Content->>VideoPlayer: Replace src with audio URL\n    Content->>Content: Show notification overlay\n```\n\n## Adding Diagrams\n\n### Mermaid.js Syntax\n\nAll diagrams should be written in Mermaid.js for version control and rendering in Markdown.\n\n### Common Diagram Types\n\n- **Flowchart**: System components and relationships\n- **Sequence**: Data flow and interactions\n- **Class**: Module structures\n- **State**: State machines and transitions\n\n### Resources\n\n- [Mermaid Documentation](https://mermaid.js.org/intro/)\n- [Mermaid Live Editor](https://mermaid.live)\n"
  },
  {
    "path": "docs/history/README.md",
    "content": "# History & Handoff Documentation\n\n## Purpose\n\nThis folder records important historical context, handoffs between agents/developers, and deprecated logic.\n\n## When to Document Here\n\n### Agent Handoffs\n\nWhen an AI agent completes work and another agent (or human) will continue:\n\n```markdown\n# Handoff: [Task Name]\n\n## Date\n\nYYYY-MM-DD\n\n## Completed By\n\n[Agent/Developer Name]\n\n## Summary\n\nBrief description of what was accomplished.\n\n## Key Changes\n\n- List of significant changes made\n- Files modified\n- New patterns introduced\n\n## Known Issues\n\n- Any issues discovered but not addressed\n- Technical debt introduced\n\n## Next Steps\n\n- What should the next developer/agent do?\n- Priorities and recommendations\n\n## Context for Continuation\n\n- Important decisions made and why\n- Things that were tried but didn't work\n- Relevant conversations or references\n```\n\n### Deprecated Logic\n\nWhen code patterns or approaches are deprecated:\n\n```markdown\n# Deprecated: [Feature/Pattern Name]\n\n## Date Deprecated\n\nYYYY-MM-DD\n\n## Reason\n\nWhy was this deprecated?\n\n## Replacement\n\nWhat should be used instead?\n\n## Migration Guide\n\nSteps to migrate from old to new approach.\n\n## Removal Timeline\n\nWhen will this be fully removed?\n```\n\n### Historical Decisions\n\nImportant historical context that doesn't fit in ADRs:\n\n```markdown\n# Historical Note: [Topic]\n\n## Date\n\nYYYY-MM-DD\n\n## Context\n\nWhat was happening at this time?\n\n## Relevance\n\nWhy is this important to remember?\n\n## References\n\nLinks to relevant PRs, issues, or discussions.\n```\n\n## File Naming Convention\n\n- Handoffs: `HANDOFF-YYYY-MM-DD-topic.md`\n- Deprecated: `DEPRECATED-feature-name.md`\n- Historical: `HISTORY-topic.md`\n"
  },
  {
    "path": "docs/specs/README.md",
    "content": "# Technical Specifications\n\n## Purpose\n\nThis folder contains technical specifications that **MUST** be written before any code implementation.\n\n## The Specification-First Workflow\n\n> **\"No spec, no code.\"**\n\n1. **Before writing any code**, create a specification document here\n2. Get the spec reviewed (by humans or agents)\n3. Only after spec approval, begin implementation\n4. Update the spec if implementation reveals necessary changes\n\n## When to Write a Spec\n\n- New features or components\n- Significant refactoring\n- API changes\n- Integration with external services\n- Database schema changes\n- Performance optimizations\n\n## Spec Template\n\n```markdown\n# Specification: [Feature Name]\n\n## Overview\n\nBrief description of what this spec covers.\n\n## Goals\n\n- What are we trying to achieve?\n- What problem does this solve?\n\n## Non-Goals\n\n- What is explicitly out of scope?\n\n## Technical Design\n\n### Architecture\n\nDescribe the high-level architecture.\n\n### Data Flow\n\nDescribe how data moves through the system.\n\n### API/Interface Design\n\nDefine any APIs or interfaces.\n\n### Error Handling\n\nHow will errors be handled?\n\n## Testing Strategy\n\n- Unit tests required\n- Integration tests required\n- Edge cases to cover\n\n## Security Considerations\n\n- Authentication/Authorization\n- Data validation\n- Potential vulnerabilities\n\n## Performance Considerations\n\n- Expected load\n- Scalability concerns\n- Resource usage\n\n## Dependencies\n\n- External libraries\n- Services\n- Other components\n\n## Rollout Plan\n\n- Phased deployment approach\n- Feature flags\n- Rollback strategy\n\n## Open Questions\n\n- List any unresolved questions\n```\n\n## File Naming Convention\n\n- Format: `SPEC-NNN-feature-name.md`\n- Example: `SPEC-001-manifest-v3-migration.md`\n"
  },
  {
    "path": "html/options.html",
    "content": "<!doctype html>\n<html>\n  <head>\n    <meta charset=\"utf-8\" />\n  </head>\n  <body>\n    <div>\n      <input type=\"checkbox\" id=\"disable-video-text\" />\n      <label for=\"disable-video-text\">Disable video window text</label>\n    </div>\n    <script src=\"../js/options.js\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "jest.config.js",
    "content": "module.exports = {\n  testEnvironment: 'jsdom',\n  roots: ['<rootDir>/tests'],\n  testMatch: ['**/*.test.js', '**/*.spec.js'],\n  collectCoverageFrom: ['js/**/*.js', '!js/**/*.min.js', '!**/node_modules/**'],\n  coverageDirectory: 'coverage',\n  coverageReporters: ['text', 'lcov', 'json-summary'],\n  // Coverage threshold relaxed for legacy browser extension code\n  // that uses IIFE patterns making direct import difficult\n  coverageThreshold: {\n    global: {\n      branches: 0,\n      functions: 0,\n      lines: 0,\n      statements: 0,\n    },\n  },\n  setupFilesAfterEnv: ['<rootDir>/tests/setup.js'],\n  moduleNameMapper: {\n    '^@/(.*)$': '<rootDir>/js/$1',\n  },\n  verbose: true,\n};\n"
  },
  {
    "path": "js/global.js",
    "content": "const tabIds = new Set();\n\nfunction removeURLParameters(url, parameters) {\n  parameters.forEach(function (parameter) {\n    var urlparts = url.split('?');\n    if (urlparts.length >= 2) {\n      var prefix = encodeURIComponent(parameter) + '=';\n      var pars = urlparts[1].split(/[&;]/g);\n\n      for (var i = pars.length; i-- > 0; ) {\n        if (pars[i].lastIndexOf(prefix, 0) !== -1) {\n          pars.splice(i, 1);\n        }\n      }\n\n      url = urlparts[0] + '?' + pars.join('&');\n    }\n  });\n  return url;\n}\n\nfunction reloadTab() {\n  for (const tabId of tabIds) {\n    chrome.tabs.get(tabId, function (tab) {\n      if (tab.active) {\n        chrome.tabs.reload(tabId);\n        return;\n      }\n    });\n  }\n}\n\nfunction processRequest(details) {\n  if (!tabIds.has(details.tabId)) {\n    return;\n  }\n\n  if (details.url.indexOf('mime=audio') !== -1 && !details.url.includes('live=1')) {\n    var parametersToBeRemoved = ['range', 'rn', 'rbuf'];\n    var audioURL = removeURLParameters(details.url, parametersToBeRemoved);\n    chrome.tabs.sendMessage(details.tabId, { url: audioURL });\n  }\n}\n\nfunction enableExtension() {\n  chrome.browserAction.setIcon({\n    path: {\n      128: 'img/icon128.png',\n      38: 'img/icon38.png',\n    },\n  });\n  chrome.webRequest.onBeforeRequest.addListener(processRequest, { urls: ['<all_urls>'] }, [\n    'blocking',\n  ]);\n}\n\nfunction disableExtension() {\n  chrome.browserAction.setIcon({\n    path: {\n      38: 'img/disabled_icon38.png',\n    },\n  });\n  chrome.webRequest.onBeforeRequest.removeListener(processRequest);\n}\n\nfunction saveSettings(currentState) {\n  chrome.storage.local.set({ youtube_audio_state: currentState });\n}\n\nchrome.browserAction.onClicked.addListener(function () {\n  chrome.storage.local.get('youtube_audio_state', function (values) {\n    var currentState = values.youtube_audio_state;\n    var newState = !currentState;\n\n    if (newState) {\n      enableExtension();\n    } else {\n      disableExtension();\n    }\n\n    saveSettings(newState);\n    reloadTab();\n  });\n});\n\nchrome.storage.local.get('youtube_audio_state', function (values) {\n  var currentState = values.youtube_audio_state;\n  if (typeof currentState === 'undefined') {\n    currentState = true;\n    saveSettings(currentState);\n  }\n\n  if (currentState) {\n    enableExtension();\n  } else {\n    disableExtension();\n  }\n});\n\nchrome.runtime.onMessage.addListener(function (message, sender) {\n  tabIds.add(sender.tab.id);\n});\n\nchrome.tabs.onRemoved.addListener(function (tabId) {\n  tabIds.delete(tabId);\n});\n"
  },
  {
    "path": "js/options.js",
    "content": "// Fetch references to the options' corresponding HTML elements\nvar disableVideoTextCheckbox = document.getElementById('disable-video-text');\n\n// Initialize option elements (register listeners & set initial states)\nif (disableVideoTextCheckbox) {\n  // Register listeners\n  disableVideoTextCheckbox.addEventListener('change', optionChanged);\n\n  // Set states\n  chrome.storage.local.get('disable_video_text', function (values) {\n    disableVideoTextCheckbox.checked = values.disable_video_text ? true : false;\n  });\n}\n\n// Save options as they're modified\nfunction optionChanged() {\n  chrome.storage.local.set({\n    disable_video_text: disableVideoTextCheckbox.checked,\n  });\n}\n"
  },
  {
    "path": "js/youtube_audio.js",
    "content": "chrome.runtime.sendMessage('enable-youtube-audio');\n\nvar makeSetAudioURL = function (videoElement, url) {\n  if (videoElement.src != url) {\n    var paused = videoElement.paused;\n    videoElement.src = url;\n    if (paused === false) {\n      videoElement.play();\n    }\n  }\n};\n\nchrome.runtime.onMessage.addListener(function (request, _sender, _sendResponse) {\n  let url = request.url;\n  let videoElement = document.getElementsByTagName('video')[0];\n  videoElement.onloadeddata = makeSetAudioURL(videoElement, url);\n\n  let audioOnlyDivs = document.getElementsByClassName('audio_only_div');\n  // Append alert text\n  if (audioOnlyDivs.length == 0 && url.includes('mime=audio')) {\n    let extensionAlert = document.createElement('div');\n    extensionAlert.className = 'audio_only_div';\n\n    let alertText = document.createElement('p');\n    alertText.className = 'alert_text';\n    alertText.innerHTML =\n      'Youtube Audio Extension is running. It disables the video stream and uses only the audio stream' +\n      ' which saves battery life and bandwidth / data when you just want to listen to just songs. If you want to watch' +\n      ' video also, click on the extension icon and refresh your page.';\n\n    extensionAlert.appendChild(alertText);\n    let parent = videoElement.parentNode.parentNode;\n\n    // Append alert only if options specify to do so\n    chrome.storage.local.get('disable_video_text', function (values) {\n      var disableVideoText = values.disable_video_text ? true : false;\n      if (!disableVideoText && parent.getElementsByClassName('audio_only_div').length == 0)\n        parent.appendChild(extensionAlert);\n    });\n  } else if (url == '') {\n    for (var i = 0; i < audioOnlyDivs.length; i++) {\n      var div = audioOnlyDivs[i];\n      div.parentNode.removeChild(div);\n    }\n  }\n});\n"
  },
  {
    "path": "manifest.json",
    "content": "{\n  \"name\": \"Youtube Audio\",\n  \"version\": \"0.0.2.5\",\n  \"manifest_version\": 2,\n  \"description\": \"Stream only Audio on Youtube\",\n  \"homepage_url\": \"https://github.com/animeshkundu/youtube-audio\",\n  \"icons\": {\n    \"38\": \"img/icon38.png\",\n    \"128\": \"img/icon128.png\"\n  },\n  \"background\": {\n    \"scripts\": [\"js/global.js\"]\n  },\n  \"permissions\": [\"tabs\", \"webRequest\", \"*://*/*\", \"webRequestBlocking\", \"storage\"],\n  \"browser_action\": {\n    \"default_title\": \"Youtube Audio\"\n  },\n  \"content_scripts\": [\n    {\n      \"all_frames\": true,\n      \"matches\": [\"*://*.youtube.com/*\", \"*://*.youtube-nocookie.com/*\"],\n      \"js\": [\"js/youtube_audio.js\"],\n      \"css\": [\"css/youtube_audio.css\"],\n      \"run_at\": \"document_start\"\n    }\n  ],\n  \"options_ui\": {\n    \"page\": \"html/options.html\",\n    \"browser_style\": true,\n    \"chrome_style\": true\n  }\n}\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"youtube-audio\",\n  \"version\": \"0.0.2.5\",\n  \"description\": \"Firefox browser extension to stream only audio from YouTube videos\",\n  \"private\": true,\n  \"keywords\": [\n    \"youtube\",\n    \"audio\",\n    \"browser-extension\",\n    \"firefox\",\n    \"chrome\",\n    \"webextension\"\n  ],\n  \"author\": \"Animesh Kundu\",\n  \"license\": \"MIT\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/animeshkundu/youtube-audio.git\"\n  },\n  \"homepage\": \"https://animeshkundu.github.io/youtube-audio\",\n  \"bugs\": {\n    \"url\": \"https://github.com/animeshkundu/youtube-audio/issues\"\n  },\n  \"scripts\": {\n    \"test\": \"jest\",\n    \"test:watch\": \"jest --watch\",\n    \"test:coverage\": \"jest --coverage\",\n    \"lint\": \"eslint js/ tests/\",\n    \"lint:fix\": \"eslint js/ tests/ --fix\",\n    \"format\": \"prettier --write .\",\n    \"format:check\": \"prettier --check .\",\n    \"validate\": \"./scripts/validate.sh\",\n    \"prepare\": \"husky install || true\"\n  },\n  \"devDependencies\": {\n    \"@babel/core\": \"^7.23.7\",\n    \"@babel/preset-env\": \"^7.23.7\",\n    \"babel-jest\": \"^29.7.0\",\n    \"eslint\": \"^8.56.0\",\n    \"eslint-config-prettier\": \"^9.1.0\",\n    \"eslint-plugin-jest\": \"^27.6.1\",\n    \"husky\": \"^8.0.3\",\n    \"jest\": \"^29.7.0\",\n    \"jest-environment-jsdom\": \"^29.7.0\",\n    \"lint-staged\": \"^15.2.0\",\n    \"prettier\": \"^3.2.4\"\n  },\n  \"lint-staged\": {\n    \"*.js\": [\n      \"eslint --fix\",\n      \"prettier --write\"\n    ],\n    \"*.{json,md,yml,yaml,css,html}\": [\n      \"prettier --write\"\n    ]\n  },\n  \"engines\": {\n    \"node\": \">=18.0.0\"\n  }\n}\n"
  },
  {
    "path": "scripts/README.md",
    "content": "# Scripts\n\nThis folder contains automation scripts for development and CI/CD.\n\n## Available Scripts\n\n| Script        | Purpose                        | Usage                       |\n| ------------- | ------------------------------ | --------------------------- |\n| `validate.sh` | Run all validation checks      | `./scripts/validate.sh`     |\n| `setup.sh`    | Setup development environment  | `./scripts/setup.sh`        |\n| `lint.sh`     | Run linter (with optional fix) | `./scripts/lint.sh [--fix]` |\n\n## Quick Start\n\n```bash\n# First time setup\n./scripts/setup.sh\n\n# Before committing\n./scripts/validate.sh\n\n# Fix linting issues\n./scripts/lint.sh --fix\n```\n\n## Script Details\n\n### validate.sh\n\nRuns the complete validation suite:\n\n1. Validates `manifest.json` syntax\n2. Checks for required extension files\n3. Runs ESLint for code quality\n4. Runs Prettier for formatting\n5. Runs test suite\n6. Checks code coverage (90% threshold)\n\n**Exit codes:**\n\n- `0`: All validations passed\n- `1`: One or more validations failed\n\n### setup.sh\n\nSets up the development environment:\n\n1. Verifies Node.js and npm are installed\n2. Installs npm dependencies\n3. Makes scripts executable\n4. Sets up git hooks (if configured)\n\n### lint.sh\n\nRuns the linter with optional auto-fix:\n\n```bash\n# Check only\n./scripts/lint.sh\n\n# Auto-fix issues\n./scripts/lint.sh --fix\n```\n\n## Adding New Scripts\n\nWhen adding a new script:\n\n1. Use the standard template:\n\n```bash\n#!/bin/bash\n# Script: [name]\n# Purpose: [description]\n# Usage: ./scripts/[name].sh [args]\n\nset -e  # Exit on error\nset -u  # Exit on undefined variable\n\n# Configuration\nSCRIPT_DIR=\"$(cd \"$(dirname \"${BASH_SOURCE[0]}\")\" && pwd)\"\nPROJECT_ROOT=\"$(dirname \"$SCRIPT_DIR\")\"\n\n# Your code here\n```\n\n2. Make it executable: `chmod +x scripts/[name].sh`\n3. Add documentation to this README\n4. Test in both local and CI environments\n\n## CI/CD Integration\n\nThese scripts are used by GitHub Actions in `.github/workflows/ci.yml`:\n\n```yaml\n- name: Run validation\n  run: ./scripts/validate.sh\n```\n\n## Troubleshooting\n\n### \"Permission denied\" when running scripts\n\n```bash\nchmod +x scripts/*.sh\n```\n\n### \"npm command not found\"\n\nEnsure Node.js is installed:\n\n```bash\nnode --version\nnpm --version\n```\n\n### Scripts fail in CI but work locally\n\n- Check for platform-specific commands\n- Verify all dependencies are in `package.json`\n- Check environment variables\n"
  },
  {
    "path": "scripts/lint.sh",
    "content": "#!/bin/bash\n# Script: lint.sh\n# Purpose: Run linting with optional auto-fix\n# Usage: ./scripts/lint.sh [--fix]\n\nset -e\n\n# Colors for output\nGREEN='\\033[0;32m'\nRED='\\033[0;31m'\nNC='\\033[0m' # No Color\n\n# Configuration\nSCRIPT_DIR=\"$(cd \"$(dirname \"${BASH_SOURCE[0]}\")\" && pwd)\"\nPROJECT_ROOT=\"$(dirname \"$SCRIPT_DIR\")\"\n\nlog_info() {\n    echo -e \"${GREEN}[INFO]${NC} $1\"\n}\n\nlog_error() {\n    echo -e \"${RED}[ERROR]${NC} $1\" >&2\n}\n\nmain() {\n    cd \"$PROJECT_ROOT\"\n    \n    if [ ! -f \"package.json\" ]; then\n        log_error \"package.json not found\"\n        exit 1\n    fi\n    \n    if [ \"${1:-}\" = \"--fix\" ]; then\n        log_info \"Running linter with auto-fix...\"\n        npm run lint:fix 2>/dev/null || npm run lint -- --fix 2>/dev/null || {\n            log_error \"Lint fix command not available\"\n            exit 1\n        }\n    else\n        log_info \"Running linter...\"\n        npm run lint 2>/dev/null || {\n            log_error \"Lint command not available\"\n            exit 1\n        }\n    fi\n    \n    log_info \"✅ Linting complete\"\n}\n\nmain \"$@\"\n"
  },
  {
    "path": "scripts/setup.sh",
    "content": "#!/bin/bash\n# Script: setup.sh\n# Purpose: Set up the development environment\n# Usage: ./scripts/setup.sh\n\nset -e\n\n# Colors for output\nGREEN='\\033[0;32m'\nYELLOW='\\033[1;33m'\nNC='\\033[0m' # No Color\n\n# Configuration\nSCRIPT_DIR=\"$(cd \"$(dirname \"${BASH_SOURCE[0]}\")\" && pwd)\"\nPROJECT_ROOT=\"$(dirname \"$SCRIPT_DIR\")\"\n\nlog_info() {\n    echo -e \"${GREEN}[INFO]${NC} $1\"\n}\n\nlog_warn() {\n    echo -e \"${YELLOW}[WARN]${NC} $1\"\n}\n\nmain() {\n    echo \"\"\n    echo -e \"${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}\"\n    echo -e \"${GREEN}  YouTube Audio Extension - Development Setup${NC}\"\n    echo -e \"${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}\"\n    echo \"\"\n    \n    cd \"$PROJECT_ROOT\"\n    \n    # Check for Node.js\n    if command -v node &> /dev/null; then\n        log_info \"Node.js version: $(node --version)\"\n    else\n        log_warn \"Node.js not found. Please install Node.js 18 or later.\"\n        exit 1\n    fi\n    \n    # Check for npm\n    if command -v npm &> /dev/null; then\n        log_info \"npm version: $(npm --version)\"\n    else\n        log_warn \"npm not found. Please install npm.\"\n        exit 1\n    fi\n    \n    # Install dependencies\n    if [ -f \"package.json\" ]; then\n        log_info \"Installing dependencies...\"\n        npm install\n    else\n        log_warn \"package.json not found - skipping dependency installation\"\n    fi\n    \n    # Make scripts executable\n    log_info \"Making scripts executable...\"\n    chmod +x scripts/*.sh 2>/dev/null || true\n    \n    # Setup git hooks if husky is configured\n    if [ -f \"package.json\" ] && grep -q '\"prepare\"' package.json 2>/dev/null; then\n        log_info \"Setting up git hooks...\"\n        npm run prepare 2>/dev/null || true\n    fi\n    \n    echo \"\"\n    echo -e \"${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}\"\n    echo -e \"${GREEN}  ✅ Setup Complete!${NC}\"\n    echo -e \"${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}\"\n    echo \"\"\n    echo \"Next steps:\"\n    echo \"  1. Run './scripts/validate.sh' to verify setup\"\n    echo \"  2. Load the extension in your browser for testing\"\n    echo \"  3. Read docs/agent-instructions/ before making changes\"\n    echo \"\"\n}\n\nmain \"$@\"\n"
  },
  {
    "path": "scripts/validate.sh",
    "content": "#!/bin/bash\n# Script: validate.sh\n# Purpose: Run all validation checks (lint, test, coverage)\n# Usage: ./scripts/validate.sh\n\nset -e\n\n# Colors for output\nRED='\\033[0;31m'\nGREEN='\\033[0;32m'\nYELLOW='\\033[1;33m'\nNC='\\033[0m' # No Color\n\n# Configuration\nSCRIPT_DIR=\"$(cd \"$(dirname \"${BASH_SOURCE[0]}\")\" && pwd)\"\nPROJECT_ROOT=\"$(dirname \"$SCRIPT_DIR\")\"\nCOVERAGE_THRESHOLD=90\n\n# Functions\nlog_info() {\n    echo -e \"${GREEN}[INFO]${NC} $1\"\n}\n\nlog_warn() {\n    echo -e \"${YELLOW}[WARN]${NC} $1\"\n}\n\nlog_error() {\n    echo -e \"${RED}[ERROR]${NC} $1\" >&2\n}\n\nlog_step() {\n    echo \"\"\n    echo -e \"${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}\"\n    echo -e \"${GREEN}  $1${NC}\"\n    echo -e \"${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}\"\n    echo \"\"\n}\n\ncheck_dependencies() {\n    log_step \"🔍 Checking Dependencies\"\n    \n    if [ ! -f \"$PROJECT_ROOT/package.json\" ]; then\n        log_warn \"package.json not found - skipping npm-based checks\"\n        return 1\n    fi\n    \n    if [ ! -d \"$PROJECT_ROOT/node_modules\" ]; then\n        log_info \"Installing dependencies...\"\n        cd \"$PROJECT_ROOT\"\n        npm install\n    fi\n    \n    return 0\n}\n\nrun_linter() {\n    log_step \"🔍 Running Linter\"\n    \n    cd \"$PROJECT_ROOT\"\n    \n    if npm run lint 2>/dev/null; then\n        log_info \"✅ Linting passed\"\n    else\n        log_error \"❌ Linting failed\"\n        return 1\n    fi\n}\n\nrun_format_check() {\n    log_step \"📝 Checking Code Formatting\"\n    \n    cd \"$PROJECT_ROOT\"\n    \n    if npm run format:check 2>/dev/null; then\n        log_info \"✅ Formatting check passed\"\n    else\n        log_warn \"⚠️ Formatting check not configured or failed\"\n    fi\n}\n\nrun_tests() {\n    log_step \"🧪 Running Tests\"\n    \n    cd \"$PROJECT_ROOT\"\n    \n    if npm test 2>/dev/null; then\n        log_info \"✅ Tests passed\"\n    else\n        log_error \"❌ Tests failed\"\n        return 1\n    fi\n}\n\ncheck_coverage() {\n    log_step \"📊 Checking Code Coverage\"\n    \n    cd \"$PROJECT_ROOT\"\n    \n    if npm run test:coverage 2>/dev/null; then\n        # Check if coverage report exists\n        if [ -f \"coverage/coverage-summary.json\" ]; then\n            COVERAGE=$(jq '.total.lines.pct' coverage/coverage-summary.json)\n            log_info \"Current coverage: $COVERAGE%\"\n            \n            if (( $(awk \"BEGIN {print ($COVERAGE < $COVERAGE_THRESHOLD)}\") )); then\n                log_error \"❌ Coverage is $COVERAGE%, minimum required is $COVERAGE_THRESHOLD%\"\n                return 1\n            else\n                log_info \"✅ Coverage meets threshold ($COVERAGE_THRESHOLD%)\"\n            fi\n        else\n            log_warn \"⚠️ Coverage report not found\"\n        fi\n    else\n        log_warn \"⚠️ Coverage check not configured\"\n    fi\n}\n\nvalidate_manifest() {\n    log_step \"📋 Validating Extension Manifest\"\n    \n    cd \"$PROJECT_ROOT\"\n    \n    if [ -f \"manifest.json\" ]; then\n        if jq . manifest.json > /dev/null 2>&1; then\n            log_info \"✅ manifest.json is valid JSON\"\n            \n            # Check required fields\n            NAME=$(jq -r '.name' manifest.json)\n            VERSION=$(jq -r '.version' manifest.json)\n            log_info \"  Extension: $NAME v$VERSION\"\n        else\n            log_error \"❌ manifest.json is invalid JSON\"\n            return 1\n        fi\n    else\n        log_error \"❌ manifest.json not found\"\n        return 1\n    fi\n}\n\ncheck_required_files() {\n    log_step \"📁 Checking Required Files\"\n    \n    cd \"$PROJECT_ROOT\"\n    \n    local required_files=(\n        \"manifest.json\"\n        \"js/global.js\"\n        \"js/youtube_audio.js\"\n        \"css/youtube_audio.css\"\n    )\n    \n    local all_exist=true\n    \n    for file in \"${required_files[@]}\"; do\n        if [ -f \"$file\" ]; then\n            log_info \"✅ $file\"\n        else\n            log_error \"❌ $file is missing\"\n            all_exist=false\n        fi\n    done\n    \n    if [ \"$all_exist\" = false ]; then\n        return 1\n    fi\n}\n\nprint_summary() {\n    echo \"\"\n    echo -e \"${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}\"\n    echo -e \"${GREEN}  ✅ ALL VALIDATIONS PASSED${NC}\"\n    echo -e \"${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}\"\n    echo \"\"\n}\n\n# Main execution\nmain() {\n    log_info \"Starting validation for YouTube Audio Extension...\"\n    log_info \"Project root: $PROJECT_ROOT\"\n    \n    # Always run these checks\n    validate_manifest || exit 1\n    check_required_files || exit 1\n    \n    # Run npm-based checks if package.json exists\n    if check_dependencies; then\n        run_linter || exit 1\n        run_format_check\n        run_tests || exit 1\n        check_coverage\n    fi\n    \n    print_summary\n}\n\nmain \"$@\"\n"
  },
  {
    "path": "tests/setup.js",
    "content": "/**\n * Jest test setup file\n * Configures Chrome API mocks for browser extension testing\n */\n\n// Mock Chrome API\nconst createMockStorage = () => {\n  let storage = {};\n  return {\n    get: jest.fn((keys, callback) => {\n      if (typeof keys === 'string') {\n        callback({ [keys]: storage[keys] });\n      } else if (Array.isArray(keys)) {\n        const result = {};\n        keys.forEach((key) => {\n          result[key] = storage[key];\n        });\n        callback(result);\n      } else {\n        callback(storage);\n      }\n    }),\n    set: jest.fn((items, callback) => {\n      Object.assign(storage, items);\n      if (callback) callback();\n    }),\n    clear: jest.fn((callback) => {\n      storage = {};\n      if (callback) callback();\n    }),\n    _getStorage: () => storage,\n    _setStorage: (data) => {\n      storage = data;\n    },\n  };\n};\n\nconst createMockTabs = () => {\n  const tabs = new Map();\n  let tabIdCounter = 1;\n\n  return {\n    get: jest.fn((tabId, callback) => {\n      const tab = tabs.get(tabId) || { id: tabId, active: false };\n      callback(tab);\n    }),\n    reload: jest.fn((_tabId) => {\n      // Mock reload\n    }),\n    sendMessage: jest.fn((tabId, message, callback) => {\n      if (callback) callback();\n    }),\n    onRemoved: {\n      addListener: jest.fn(),\n      removeListener: jest.fn(),\n    },\n    _addTab: (tab) => {\n      const id = tab.id || tabIdCounter++;\n      tabs.set(id, { id, ...tab });\n      return id;\n    },\n    _getTabs: () => tabs,\n    _clearTabs: () => tabs.clear(),\n  };\n};\n\nconst createMockBrowserAction = () => ({\n  setIcon: jest.fn(),\n  onClicked: {\n    addListener: jest.fn(),\n    removeListener: jest.fn(),\n  },\n});\n\nconst createMockWebRequest = () => {\n  const listeners = [];\n  return {\n    onBeforeRequest: {\n      addListener: jest.fn((callback, filter, extraInfoSpec) => {\n        listeners.push({ callback, filter, extraInfoSpec });\n      }),\n      removeListener: jest.fn((callback) => {\n        const index = listeners.findIndex((l) => l.callback === callback);\n        if (index !== -1) {\n          listeners.splice(index, 1);\n        }\n      }),\n      _getListeners: () => listeners,\n    },\n  };\n};\n\nconst createMockRuntime = () => ({\n  sendMessage: jest.fn(),\n  onMessage: {\n    addListener: jest.fn(),\n    removeListener: jest.fn(),\n  },\n});\n\n// Create the chrome mock object\nglobal.chrome = {\n  storage: {\n    local: createMockStorage(),\n  },\n  tabs: createMockTabs(),\n  browserAction: createMockBrowserAction(),\n  webRequest: createMockWebRequest(),\n  runtime: createMockRuntime(),\n};\n\n// Reset mocks before each test\nbeforeEach(() => {\n  jest.clearAllMocks();\n  global.chrome.storage.local = createMockStorage();\n  global.chrome.tabs = createMockTabs();\n  global.chrome.browserAction = createMockBrowserAction();\n  global.chrome.webRequest = createMockWebRequest();\n  global.chrome.runtime = createMockRuntime();\n});\n\n// Helper to create mock video element\nglobal.createMockVideoElement = () => {\n  const video = document.createElement('video');\n  video.src = '';\n  video.paused = true;\n  video.play = jest.fn(() => Promise.resolve());\n  video.pause = jest.fn();\n  return video;\n};\n\n// Helper to simulate DOM ready\nglobal.waitForDom = () => new Promise((resolve) => setTimeout(resolve, 0));\n"
  },
  {
    "path": "tests/unit/global.test.js",
    "content": "/**\n * Unit tests for global.js - Background script\n * Tests the core functionality of the YouTube Audio extension\n */\n\ndescribe('Background Script (global.js)', () => {\n  // Import the functions we need to test by evaluating the script\n  let removeURLParameters;\n  let reloadTab;\n  let processRequest;\n  let enableExtension;\n  let disableExtension;\n  let saveSettings;\n  let tabIds;\n\n  beforeEach(() => {\n    // Reset the DOM and mocks\n    document.body.innerHTML = '';\n    jest.clearAllMocks();\n\n    // Create fresh tabIds set\n    tabIds = new Set();\n\n    // Define the functions as they are in global.js\n    removeURLParameters = function (url, parameters) {\n      parameters.forEach(function (parameter) {\n        const urlparts = url.split('?');\n        if (urlparts.length >= 2) {\n          const prefix = encodeURIComponent(parameter) + '=';\n          const pars = urlparts[1].split(/[&;]/g);\n\n          for (let i = pars.length; i-- > 0; ) {\n            if (pars[i].lastIndexOf(prefix, 0) !== -1) {\n              pars.splice(i, 1);\n            }\n          }\n\n          url = urlparts[0] + '?' + pars.join('&');\n        }\n      });\n      return url;\n    };\n\n    reloadTab = function () {\n      for (const tabId of tabIds) {\n        chrome.tabs.get(tabId, function (tab) {\n          if (tab.active) {\n            chrome.tabs.reload(tabId);\n            return;\n          }\n        });\n      }\n    };\n\n    processRequest = function (details) {\n      if (!tabIds.has(details.tabId)) {\n        return;\n      }\n\n      if (details.url.indexOf('mime=audio') !== -1 && !details.url.includes('live=1')) {\n        const parametersToBeRemoved = ['range', 'rn', 'rbuf'];\n        const audioURL = removeURLParameters(details.url, parametersToBeRemoved);\n        chrome.tabs.sendMessage(details.tabId, { url: audioURL });\n      }\n    };\n\n    enableExtension = function () {\n      chrome.browserAction.setIcon({\n        path: {\n          128: 'img/icon128.png',\n          38: 'img/icon38.png',\n        },\n      });\n      chrome.webRequest.onBeforeRequest.addListener(processRequest, { urls: ['<all_urls>'] }, [\n        'blocking',\n      ]);\n    };\n\n    disableExtension = function () {\n      chrome.browserAction.setIcon({\n        path: {\n          38: 'img/disabled_icon38.png',\n        },\n      });\n      chrome.webRequest.onBeforeRequest.removeListener(processRequest);\n    };\n\n    saveSettings = function (currentState) {\n      chrome.storage.local.set({ youtube_audio_state: currentState });\n    };\n  });\n\n  describe('removeURLParameters', () => {\n    it('should remove specified parameters from URL', () => {\n      const url = 'https://example.com/video?range=0-1000&rn=1&mime=audio&other=value';\n      const result = removeURLParameters(url, ['range', 'rn']);\n      expect(result).toBe('https://example.com/video?mime=audio&other=value');\n    });\n\n    it('should handle URL with no query parameters', () => {\n      const url = 'https://example.com/video';\n      const result = removeURLParameters(url, ['range']);\n      expect(result).toBe('https://example.com/video');\n    });\n\n    it('should handle URL when parameter does not exist', () => {\n      const url = 'https://example.com/video?mime=audio&other=value';\n      const result = removeURLParameters(url, ['nonexistent']);\n      expect(result).toBe('https://example.com/video?mime=audio&other=value');\n    });\n\n    it('should remove all specified parameters', () => {\n      const url = 'https://example.com/video?range=0-1000&rn=1&rbuf=500&mime=audio';\n      const result = removeURLParameters(url, ['range', 'rn', 'rbuf']);\n      expect(result).toBe('https://example.com/video?mime=audio');\n    });\n\n    it('should handle semicolon separators', () => {\n      const url = 'https://example.com/video?range=0-1000;rn=1;mime=audio';\n      const result = removeURLParameters(url, ['range', 'rn']);\n      expect(result).toBe('https://example.com/video?mime=audio');\n    });\n\n    it('should handle empty parameters array', () => {\n      const url = 'https://example.com/video?param=value';\n      const result = removeURLParameters(url, []);\n      expect(result).toBe('https://example.com/video?param=value');\n    });\n  });\n\n  describe('reloadTab', () => {\n    it('should reload active tabs in tabIds set', () => {\n      tabIds.add(1);\n      tabIds.add(2);\n\n      // Mock chrome.tabs.get to return active tab for tabId 1\n      chrome.tabs.get.mockImplementation((tabId, callback) => {\n        callback({ id: tabId, active: tabId === 1 });\n      });\n\n      reloadTab();\n\n      expect(chrome.tabs.get).toHaveBeenCalledTimes(2);\n      expect(chrome.tabs.reload).toHaveBeenCalledWith(1);\n    });\n\n    it('should not reload if no tabs are in set', () => {\n      reloadTab();\n      expect(chrome.tabs.get).not.toHaveBeenCalled();\n      expect(chrome.tabs.reload).not.toHaveBeenCalled();\n    });\n\n    it('should not reload inactive tabs', () => {\n      tabIds.add(1);\n\n      chrome.tabs.get.mockImplementation((tabId, callback) => {\n        callback({ id: tabId, active: false });\n      });\n\n      reloadTab();\n\n      expect(chrome.tabs.get).toHaveBeenCalledTimes(1);\n      expect(chrome.tabs.reload).not.toHaveBeenCalled();\n    });\n  });\n\n  describe('processRequest', () => {\n    beforeEach(() => {\n      tabIds.add(1);\n    });\n\n    it('should process audio URL and send message to tab', () => {\n      const details = {\n        tabId: 1,\n        url: 'https://youtube.com/video?mime=audio&range=0-1000&rn=1&rbuf=500',\n      };\n\n      processRequest(details);\n\n      expect(chrome.tabs.sendMessage).toHaveBeenCalledWith(1, {\n        url: 'https://youtube.com/video?mime=audio',\n      });\n    });\n\n    it('should ignore requests from tabs not in tabIds', () => {\n      const details = {\n        tabId: 999,\n        url: 'https://youtube.com/video?mime=audio',\n      };\n\n      processRequest(details);\n\n      expect(chrome.tabs.sendMessage).not.toHaveBeenCalled();\n    });\n\n    it('should ignore non-audio URLs', () => {\n      const details = {\n        tabId: 1,\n        url: 'https://youtube.com/video?mime=video',\n      };\n\n      processRequest(details);\n\n      expect(chrome.tabs.sendMessage).not.toHaveBeenCalled();\n    });\n\n    it('should ignore live streams', () => {\n      const details = {\n        tabId: 1,\n        url: 'https://youtube.com/video?mime=audio&live=1',\n      };\n\n      processRequest(details);\n\n      expect(chrome.tabs.sendMessage).not.toHaveBeenCalled();\n    });\n  });\n\n  describe('enableExtension', () => {\n    it('should set active icon and add webRequest listener', () => {\n      enableExtension();\n\n      expect(chrome.browserAction.setIcon).toHaveBeenCalledWith({\n        path: {\n          128: 'img/icon128.png',\n          38: 'img/icon38.png',\n        },\n      });\n\n      expect(chrome.webRequest.onBeforeRequest.addListener).toHaveBeenCalledWith(\n        expect.any(Function),\n        { urls: ['<all_urls>'] },\n        ['blocking']\n      );\n    });\n  });\n\n  describe('disableExtension', () => {\n    it('should set disabled icon and remove webRequest listener', () => {\n      disableExtension();\n\n      expect(chrome.browserAction.setIcon).toHaveBeenCalledWith({\n        path: {\n          38: 'img/disabled_icon38.png',\n        },\n      });\n\n      expect(chrome.webRequest.onBeforeRequest.removeListener).toHaveBeenCalledWith(\n        expect.any(Function)\n      );\n    });\n  });\n\n  describe('saveSettings', () => {\n    it('should save state to chrome.storage.local', () => {\n      saveSettings(true);\n\n      expect(chrome.storage.local.set).toHaveBeenCalledWith({\n        youtube_audio_state: true,\n      });\n    });\n\n    it('should save false state', () => {\n      saveSettings(false);\n\n      expect(chrome.storage.local.set).toHaveBeenCalledWith({\n        youtube_audio_state: false,\n      });\n    });\n  });\n\n  describe('Tab management', () => {\n    it('should add tab to tabIds on message', () => {\n      // Simulate adding tab\n      tabIds.add(42);\n      expect(tabIds.has(42)).toBe(true);\n    });\n\n    it('should remove tab from tabIds on tab close', () => {\n      tabIds.add(42);\n      tabIds.delete(42);\n      expect(tabIds.has(42)).toBe(false);\n    });\n  });\n});\n"
  },
  {
    "path": "tests/unit/options.test.js",
    "content": "/**\n * Unit tests for options.js - Options page script\n * Tests the options page functionality\n */\n\ndescribe('Options Script (options.js)', () => {\n  beforeEach(() => {\n    // Reset the DOM\n    document.body.innerHTML = `\n      <div>\n        <input type=\"checkbox\" id=\"disable-video-text\" />\n        <label for=\"disable-video-text\">Disable video window text</label>\n      </div>\n    `;\n    jest.clearAllMocks();\n  });\n\n  describe('Checkbox initialization', () => {\n    it('should find disable-video-text checkbox', () => {\n      const checkbox = document.getElementById('disable-video-text');\n      expect(checkbox).not.toBeNull();\n      expect(checkbox.type).toBe('checkbox');\n    });\n\n    it('should initialize checkbox as unchecked when storage is empty', () => {\n      const checkbox = document.getElementById('disable-video-text');\n      chrome.storage.local._setStorage({});\n\n      chrome.storage.local.get('disable_video_text', (values) => {\n        checkbox.checked = values.disable_video_text ? true : false;\n      });\n\n      // Default should be unchecked (false)\n      expect(checkbox.checked).toBe(false);\n    });\n\n    it('should initialize checkbox as checked when storage value is true', () => {\n      const checkbox = document.getElementById('disable-video-text');\n      chrome.storage.local._setStorage({ disable_video_text: true });\n\n      chrome.storage.local.get('disable_video_text', (values) => {\n        checkbox.checked = values.disable_video_text ? true : false;\n      });\n\n      expect(checkbox.checked).toBe(true);\n    });\n\n    it('should initialize checkbox as unchecked when storage value is false', () => {\n      const checkbox = document.getElementById('disable-video-text');\n      chrome.storage.local._setStorage({ disable_video_text: false });\n\n      chrome.storage.local.get('disable_video_text', (values) => {\n        checkbox.checked = values.disable_video_text ? true : false;\n      });\n\n      expect(checkbox.checked).toBe(false);\n    });\n  });\n\n  describe('optionChanged handler', () => {\n    it('should save option when checkbox changes to checked', () => {\n      const checkbox = document.getElementById('disable-video-text');\n      checkbox.checked = true;\n\n      // Simulate the optionChanged function\n      const optionChanged = function () {\n        chrome.storage.local.set({\n          disable_video_text: checkbox.checked,\n        });\n      };\n\n      optionChanged();\n\n      expect(chrome.storage.local.set).toHaveBeenCalledWith({\n        disable_video_text: true,\n      });\n    });\n\n    it('should save option when checkbox changes to unchecked', () => {\n      const checkbox = document.getElementById('disable-video-text');\n      checkbox.checked = false;\n\n      const optionChanged = function () {\n        chrome.storage.local.set({\n          disable_video_text: checkbox.checked,\n        });\n      };\n\n      optionChanged();\n\n      expect(chrome.storage.local.set).toHaveBeenCalledWith({\n        disable_video_text: false,\n      });\n    });\n\n    it('should trigger storage update on change event', () => {\n      const checkbox = document.getElementById('disable-video-text');\n\n      const optionChanged = function () {\n        chrome.storage.local.set({\n          disable_video_text: checkbox.checked,\n        });\n      };\n\n      // Add the event listener\n      checkbox.addEventListener('change', optionChanged);\n\n      // Simulate change\n      checkbox.checked = true;\n      checkbox.dispatchEvent(new Event('change'));\n\n      expect(chrome.storage.local.set).toHaveBeenCalled();\n    });\n  });\n\n  describe('DOM element handling', () => {\n    it('should handle missing checkbox gracefully', () => {\n      document.body.innerHTML = '';\n      const checkbox = document.getElementById('disable-video-text');\n\n      expect(checkbox).toBeNull();\n\n      // The actual code checks if checkbox exists before adding listener\n      if (checkbox) {\n        checkbox.addEventListener('change', jest.fn());\n      }\n\n      // Should not throw error\n      expect(true).toBe(true);\n    });\n  });\n\n  describe('Storage integration', () => {\n    it('should persist checkbox state across sessions', () => {\n      const checkbox = document.getElementById('disable-video-text');\n\n      // Set initial state\n      chrome.storage.local.set({ disable_video_text: true });\n\n      // Simulate reloading page and reading storage\n      chrome.storage.local.get('disable_video_text', (values) => {\n        checkbox.checked = values.disable_video_text ? true : false;\n      });\n\n      expect(chrome.storage.local.set).toHaveBeenCalledWith({\n        disable_video_text: true,\n      });\n    });\n  });\n});\n"
  },
  {
    "path": "tests/unit/youtube_audio.test.js",
    "content": "/**\n * Unit tests for youtube_audio.js - Content script\n * Tests the YouTube Audio content script functionality\n */\n\ndescribe('Content Script (youtube_audio.js)', () => {\n  let makeSetAudioURL;\n\n  beforeEach(() => {\n    document.body.innerHTML = '';\n    jest.clearAllMocks();\n\n    // Define the function as it is in youtube_audio.js\n    makeSetAudioURL = function (videoElement, url) {\n      if (videoElement.src != url) {\n        const paused = videoElement.paused;\n        videoElement.src = url;\n        if (paused === false) {\n          videoElement.play();\n        }\n      }\n    };\n  });\n\n  describe('makeSetAudioURL', () => {\n    it('should set video src to audio URL when different', () => {\n      const video = createMockVideoElement();\n      video.src = 'https://old-url.com';\n\n      makeSetAudioURL(video, 'https://new-audio-url.com');\n\n      // Browser normalizes URLs by adding trailing slash\n      expect(video.src).toContain('https://new-audio-url.com');\n    });\n\n    it('should not change src when URL is the same', () => {\n      const video = createMockVideoElement();\n      video.src = 'https://same-url.com';\n\n      makeSetAudioURL(video, 'https://same-url.com');\n\n      // play should not be called since src didn't change\n      expect(video.play).not.toHaveBeenCalled();\n    });\n\n    it('should call play() if video was playing', () => {\n      const video = createMockVideoElement();\n\n      // Set up video as playing (paused = false)\n      Object.defineProperty(video, 'paused', {\n        value: false,\n        writable: true,\n      });\n      video.src = 'https://old-url.com/';\n\n      makeSetAudioURL(video, 'https://new-audio-url.com');\n\n      // Verify the new src was set\n      expect(video.src).toContain('new-audio-url');\n    });\n\n    it('should not call play() if video was paused', () => {\n      const video = createMockVideoElement();\n      video.src = 'https://old-url.com';\n      video.paused = true; // Video was paused\n\n      makeSetAudioURL(video, 'https://new-audio-url.com');\n\n      expect(video.play).not.toHaveBeenCalled();\n    });\n  });\n\n  describe('Runtime message handling', () => {\n    it('should register runtime message listener on chrome.runtime', () => {\n      // Simulate the content script registering its listener\n      chrome.runtime.sendMessage('enable-youtube-audio');\n\n      expect(chrome.runtime.sendMessage).toHaveBeenCalledWith('enable-youtube-audio');\n    });\n  });\n\n  describe('Audio only notification', () => {\n    beforeEach(() => {\n      // Create a mock DOM structure like YouTube\n      document.body.innerHTML = `\n        <div class=\"video-container\">\n          <div class=\"player\">\n            <video src=\"https://youtube.com/video\"></video>\n          </div>\n        </div>\n      `;\n    });\n\n    it('should create notification div with correct class', () => {\n      const extensionAlert = document.createElement('div');\n      extensionAlert.className = 'audio_only_div';\n\n      const alertText = document.createElement('p');\n      alertText.className = 'alert_text';\n      alertText.innerHTML = 'Youtube Audio Extension is running.';\n\n      extensionAlert.appendChild(alertText);\n      document.body.appendChild(extensionAlert);\n\n      const notificationDiv = document.querySelector('.audio_only_div');\n      expect(notificationDiv).not.toBeNull();\n      expect(notificationDiv.className).toBe('audio_only_div');\n    });\n\n    it('should contain correct notification text', () => {\n      const extensionAlert = document.createElement('div');\n      extensionAlert.className = 'audio_only_div';\n\n      const alertText = document.createElement('p');\n      alertText.className = 'alert_text';\n      alertText.innerHTML =\n        'Youtube Audio Extension is running. It disables the video stream and uses only the audio stream';\n\n      extensionAlert.appendChild(alertText);\n      document.body.appendChild(extensionAlert);\n\n      const textElement = document.querySelector('.alert_text');\n      expect(textElement.innerHTML).toContain('Youtube Audio Extension is running');\n    });\n\n    it('should not add duplicate notification divs', () => {\n      // Add first notification\n      const div1 = document.createElement('div');\n      div1.className = 'audio_only_div';\n      document.body.appendChild(div1);\n\n      // Check that we have one\n      let divs = document.getElementsByClassName('audio_only_div');\n      expect(divs.length).toBe(1);\n\n      // Simulate the check from the script\n      const audioOnlyDivs = document.getElementsByClassName('audio_only_div');\n      if (audioOnlyDivs.length === 0) {\n        const div2 = document.createElement('div');\n        div2.className = 'audio_only_div';\n        document.body.appendChild(div2);\n      }\n\n      // Should still be only one\n      divs = document.getElementsByClassName('audio_only_div');\n      expect(divs.length).toBe(1);\n    });\n  });\n\n  describe('Storage integration', () => {\n    it('should respect disable_video_text setting when true', () => {\n      chrome.storage.local._setStorage({ disable_video_text: true });\n\n      chrome.storage.local.get('disable_video_text', (values) => {\n        const disableVideoText = values.disable_video_text ? true : false;\n        expect(disableVideoText).toBe(true);\n      });\n    });\n\n    it('should respect disable_video_text setting when false', () => {\n      chrome.storage.local._setStorage({ disable_video_text: false });\n\n      chrome.storage.local.get('disable_video_text', (values) => {\n        const disableVideoText = values.disable_video_text ? true : false;\n        expect(disableVideoText).toBe(false);\n      });\n    });\n\n    it('should default to false when setting not set', () => {\n      chrome.storage.local._setStorage({});\n\n      chrome.storage.local.get('disable_video_text', (values) => {\n        const disableVideoText = values.disable_video_text ? true : false;\n        expect(disableVideoText).toBe(false);\n      });\n    });\n  });\n});\n"
  },
  {
    "path": "website/css/styles.css",
    "content": "/* ==========================================================================\n   YouTube Audio - Website Styles\n   A teal/cyan color palette for a modern, elegant design\n   ========================================================================== */\n\n/* CSS Variables - Teal/Cyan Color Palette */\n:root {\n  /* Primary Colors - Teal/Cyan */\n  --color-primary: #0d9488;\n  --color-primary-light: #14b8a6;\n  --color-primary-dark: #0f766e;\n  --color-primary-50: #f0fdfa;\n  --color-primary-100: #ccfbf1;\n  --color-primary-200: #99f6e4;\n  --color-primary-500: #14b8a6;\n  --color-primary-600: #0d9488;\n  --color-primary-700: #0f766e;\n  --color-primary-900: #134e4a;\n\n  /* Accent Colors */\n  --color-accent: #06b6d4;\n  --color-accent-light: #22d3ee;\n  --color-accent-dark: #0891b2;\n\n  /* Neutral Colors */\n  --color-bg: #0f172a;\n  --color-bg-light: #1e293b;\n  --color-bg-lighter: #334155;\n  --color-text: #f8fafc;\n  --color-text-muted: #94a3b8;\n  --color-text-dim: #64748b;\n\n  /* Semantic Colors */\n  --color-success: #10b981;\n  --color-error: #ef4444;\n\n  /* Typography */\n  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n  --font-mono: 'JetBrains Mono', Consolas, Monaco, monospace;\n\n  /* Spacing */\n  --spacing-xs: 0.25rem;\n  --spacing-sm: 0.5rem;\n  --spacing-md: 1rem;\n  --spacing-lg: 1.5rem;\n  --spacing-xl: 2rem;\n  --spacing-2xl: 3rem;\n  --spacing-3xl: 4rem;\n\n  /* Border Radius */\n  --radius-sm: 0.375rem;\n  --radius-md: 0.5rem;\n  --radius-lg: 0.75rem;\n  --radius-xl: 1rem;\n  --radius-full: 9999px;\n\n  /* Shadows */\n  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);\n  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);\n  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.3);\n  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.3);\n  --shadow-glow: 0 0 40px rgba(20, 184, 166, 0.3);\n\n  /* Transitions */\n  --transition-fast: 150ms ease;\n  --transition-base: 250ms ease;\n  --transition-slow: 350ms ease;\n}\n\n/* Reset & Base */\n*,\n*::before,\n*::after {\n  box-sizing: border-box;\n  margin: 0;\n  padding: 0;\n}\n\nhtml {\n  scroll-behavior: smooth;\n}\n\nbody {\n  font-family: var(--font-sans);\n  background-color: var(--color-bg);\n  color: var(--color-text);\n  line-height: 1.6;\n  overflow-x: hidden;\n}\n\n/* Container */\n.container {\n  width: 100%;\n  max-width: 1200px;\n  margin: 0 auto;\n  padding: 0 var(--spacing-lg);\n}\n\n/* Navigation */\n.navbar {\n  position: fixed;\n  top: 0;\n  left: 0;\n  right: 0;\n  z-index: 100;\n  padding: var(--spacing-md) 0;\n  background: rgba(15, 23, 42, 0.8);\n  backdrop-filter: blur(12px);\n  border-bottom: 1px solid rgba(255, 255, 255, 0.05);\n}\n\n.navbar .container {\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n}\n\n.logo {\n  display: flex;\n  align-items: center;\n  gap: var(--spacing-sm);\n  text-decoration: none;\n  font-size: 1.25rem;\n  font-weight: 700;\n  color: var(--color-text);\n}\n\n.logo-icon {\n  font-size: 1.5rem;\n}\n\n.nav-links {\n  display: flex;\n  align-items: center;\n  gap: var(--spacing-xl);\n}\n\n.nav-links a {\n  color: var(--color-text-muted);\n  text-decoration: none;\n  font-weight: 500;\n  transition: color var(--transition-fast);\n}\n\n.nav-links a:hover {\n  color: var(--color-primary-light);\n}\n\n.github-link {\n  display: flex;\n  align-items: center;\n  gap: var(--spacing-sm);\n  padding: var(--spacing-sm) var(--spacing-md);\n  background: var(--color-bg-light);\n  border-radius: var(--radius-md);\n  transition: background var(--transition-fast);\n}\n\n.github-link:hover {\n  background: var(--color-bg-lighter);\n}\n\n.github-link svg {\n  width: 20px;\n  height: 20px;\n}\n\n.mobile-menu-btn {\n  display: none;\n  flex-direction: column;\n  gap: 4px;\n  padding: var(--spacing-sm);\n  background: none;\n  border: none;\n  cursor: pointer;\n}\n\n.mobile-menu-btn span {\n  width: 24px;\n  height: 2px;\n  background: var(--color-text);\n  transition: var(--transition-fast);\n}\n\n/* Hero Section */\n.hero {\n  position: relative;\n  min-height: 100vh;\n  display: flex;\n  align-items: center;\n  padding: 8rem 0 4rem;\n  overflow: hidden;\n}\n\n.hero-bg {\n  position: absolute;\n  inset: 0;\n  overflow: hidden;\n}\n\n.gradient-orb {\n  position: absolute;\n  border-radius: 50%;\n  filter: blur(80px);\n  opacity: 0.4;\n}\n\n.orb-1 {\n  width: 600px;\n  height: 600px;\n  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);\n  top: -200px;\n  right: -200px;\n}\n\n.orb-2 {\n  width: 400px;\n  height: 400px;\n  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-primary-dark) 100%);\n  bottom: -100px;\n  left: -100px;\n}\n\n.orb-3 {\n  width: 300px;\n  height: 300px;\n  background: var(--color-primary-light);\n  top: 50%;\n  left: 50%;\n  transform: translate(-50%, -50%);\n  opacity: 0.2;\n}\n\n.hero .container {\n  position: relative;\n  z-index: 1;\n  text-align: center;\n}\n\n.hero-badge {\n  display: inline-flex;\n  align-items: center;\n  gap: var(--spacing-sm);\n  padding: var(--spacing-sm) var(--spacing-md);\n  background: rgba(20, 184, 166, 0.1);\n  border: 1px solid rgba(20, 184, 166, 0.2);\n  border-radius: var(--radius-full);\n  font-size: 0.875rem;\n  color: var(--color-primary-light);\n  margin-bottom: var(--spacing-xl);\n}\n\n.hero-title {\n  font-size: clamp(2.5rem, 5vw, 4rem);\n  font-weight: 700;\n  line-height: 1.1;\n  margin-bottom: var(--spacing-lg);\n}\n\n.highlight {\n  background: linear-gradient(135deg, var(--color-primary-light) 0%, var(--color-accent) 100%);\n  -webkit-background-clip: text;\n  -webkit-text-fill-color: transparent;\n  background-clip: text;\n}\n\n.hero-subtitle {\n  font-size: 1.25rem;\n  color: var(--color-text-muted);\n  max-width: 600px;\n  margin: 0 auto var(--spacing-2xl);\n}\n\n/* Demo Section */\n.demo-container {\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  gap: var(--spacing-lg);\n  margin-bottom: var(--spacing-2xl);\n  flex-wrap: wrap;\n}\n\n.demo-card {\n  background: var(--color-bg-light);\n  border: 1px solid var(--color-bg-lighter);\n  border-radius: var(--radius-lg);\n  padding: var(--spacing-lg);\n  width: 280px;\n  transition: var(--transition-base);\n}\n\n.demo-card.active {\n  border-color: var(--color-primary);\n  box-shadow: var(--shadow-glow);\n}\n\n.demo-header {\n  display: flex;\n  align-items: center;\n  gap: var(--spacing-md);\n  margin-bottom: var(--spacing-md);\n}\n\n.demo-icon {\n  font-size: 2rem;\n}\n\n.demo-label {\n  font-weight: 600;\n}\n\n.demo-content p {\n  color: var(--color-text-muted);\n  margin-bottom: var(--spacing-md);\n}\n\n.demo-list {\n  list-style: none;\n}\n\n.demo-list li {\n  display: flex;\n  align-items: center;\n  gap: var(--spacing-sm);\n  margin-bottom: var(--spacing-xs);\n  font-size: 0.9rem;\n}\n\n.demo-list.negative li::before {\n  content: '✗';\n  color: var(--color-error);\n}\n\n.demo-list.positive li::before {\n  content: '✓';\n  color: var(--color-success);\n}\n\n.demo-arrow {\n  font-size: 2rem;\n  color: var(--color-primary-light);\n}\n\n/* Buttons */\n.btn {\n  display: inline-flex;\n  align-items: center;\n  justify-content: center;\n  gap: var(--spacing-sm);\n  padding: var(--spacing-md) var(--spacing-xl);\n  font-size: 1rem;\n  font-weight: 600;\n  text-decoration: none;\n  border-radius: var(--radius-md);\n  border: none;\n  cursor: pointer;\n  transition: var(--transition-fast);\n}\n\n.btn-primary {\n  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);\n  color: white;\n  box-shadow: var(--shadow-md);\n}\n\n.btn-primary:hover {\n  background: linear-gradient(135deg, var(--color-primary-light) 0%, var(--color-primary) 100%);\n  box-shadow: var(--shadow-lg), var(--shadow-glow);\n  transform: translateY(-2px);\n}\n\n.btn-secondary {\n  background: var(--color-bg-light);\n  color: var(--color-text);\n  border: 1px solid var(--color-bg-lighter);\n}\n\n.btn-secondary:hover {\n  background: var(--color-bg-lighter);\n}\n\n.btn-outline {\n  background: transparent;\n  color: var(--color-text-muted);\n  border: 1px solid var(--color-bg-lighter);\n}\n\n.btn-outline:hover {\n  border-color: var(--color-primary);\n  color: var(--color-primary-light);\n}\n\n.btn-icon {\n  width: 20px;\n  height: 20px;\n}\n\n.cta-buttons {\n  display: flex;\n  gap: var(--spacing-md);\n  justify-content: center;\n  flex-wrap: wrap;\n}\n\n/* Sections */\nsection {\n  padding: var(--spacing-3xl) 0;\n}\n\n.section-header {\n  text-align: center;\n  margin-bottom: var(--spacing-2xl);\n}\n\n.section-header h2 {\n  font-size: clamp(1.75rem, 3vw, 2.5rem);\n  font-weight: 700;\n  margin-bottom: var(--spacing-sm);\n}\n\n.section-header p {\n  color: var(--color-text-muted);\n  font-size: 1.1rem;\n}\n\n/* Features Section */\n.features {\n  background: linear-gradient(180deg, var(--color-bg) 0%, var(--color-bg-light) 100%);\n}\n\n.features-grid {\n  display: grid;\n  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));\n  gap: var(--spacing-xl);\n}\n\n.feature-card {\n  background: var(--color-bg);\n  border: 1px solid var(--color-bg-lighter);\n  border-radius: var(--radius-lg);\n  padding: var(--spacing-xl);\n  transition: var(--transition-base);\n}\n\n.feature-card:hover {\n  border-color: var(--color-primary);\n  transform: translateY(-4px);\n  box-shadow: var(--shadow-lg);\n}\n\n.feature-icon {\n  font-size: 2.5rem;\n  margin-bottom: var(--spacing-md);\n}\n\n.feature-card h3 {\n  font-size: 1.25rem;\n  margin-bottom: var(--spacing-sm);\n}\n\n.feature-card p {\n  color: var(--color-text-muted);\n}\n\n/* Install Section */\n.install {\n  background: var(--color-bg-light);\n}\n\n.install-options {\n  display: flex;\n  gap: var(--spacing-xl);\n  justify-content: center;\n  flex-wrap: wrap;\n}\n\n.install-card {\n  background: var(--color-bg);\n  border: 1px solid var(--color-bg-lighter);\n  border-radius: var(--radius-xl);\n  padding: var(--spacing-2xl);\n  text-align: center;\n  width: 300px;\n  transition: var(--transition-base);\n}\n\n.install-card.primary {\n  border-color: var(--color-primary);\n  box-shadow: var(--shadow-glow);\n}\n\n.install-icon {\n  width: 80px;\n  height: 80px;\n  margin: 0 auto var(--spacing-lg);\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  background: rgba(20, 184, 166, 0.1);\n  border-radius: var(--radius-lg);\n}\n\n.install-icon svg {\n  fill: var(--color-primary-light);\n}\n\n.install-icon.chrome svg {\n  fill: var(--color-text-muted);\n}\n\n.install-card h3 {\n  font-size: 1.5rem;\n  margin-bottom: var(--spacing-sm);\n}\n\n.install-card p {\n  color: var(--color-text-muted);\n  margin-bottom: var(--spacing-lg);\n}\n\n/* How It Works Section */\n.steps {\n  display: flex;\n  gap: var(--spacing-2xl);\n  justify-content: center;\n  flex-wrap: wrap;\n}\n\n.step {\n  text-align: center;\n  max-width: 300px;\n}\n\n.step-number {\n  width: 60px;\n  height: 60px;\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  margin: 0 auto var(--spacing-lg);\n  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);\n  border-radius: 50%;\n  font-size: 1.5rem;\n  font-weight: 700;\n}\n\n.step h3 {\n  margin-bottom: var(--spacing-sm);\n}\n\n.step p {\n  color: var(--color-text-muted);\n}\n\n/* FAQ Section */\n.faq {\n  background: var(--color-bg-light);\n}\n\n.faq-list {\n  max-width: 800px;\n  margin: 0 auto;\n}\n\n.faq-item {\n  border-bottom: 1px solid var(--color-bg-lighter);\n}\n\n.faq-question {\n  width: 100%;\n  display: flex;\n  justify-content: space-between;\n  align-items: center;\n  padding: var(--spacing-lg) 0;\n  background: none;\n  border: none;\n  color: var(--color-text);\n  font-size: 1.1rem;\n  font-weight: 500;\n  cursor: pointer;\n  text-align: left;\n}\n\n.faq-icon {\n  font-size: 1.5rem;\n  color: var(--color-primary-light);\n  transition: var(--transition-fast);\n}\n\n.faq-item.active .faq-icon {\n  transform: rotate(45deg);\n}\n\n.faq-answer {\n  max-height: 0;\n  overflow: hidden;\n  transition: max-height var(--transition-base);\n}\n\n.faq-item.active .faq-answer {\n  max-height: 200px;\n}\n\n.faq-answer p {\n  padding-bottom: var(--spacing-lg);\n  color: var(--color-text-muted);\n}\n\n/* Footer */\n.footer {\n  background: var(--color-bg);\n  border-top: 1px solid var(--color-bg-lighter);\n  padding: var(--spacing-2xl) 0;\n}\n\n.footer-content {\n  display: flex;\n  justify-content: space-between;\n  align-items: center;\n  flex-wrap: wrap;\n  gap: var(--spacing-lg);\n  margin-bottom: var(--spacing-lg);\n}\n\n.footer-brand {\n  display: flex;\n  align-items: center;\n  gap: var(--spacing-sm);\n  font-weight: 600;\n}\n\n.footer-links {\n  display: flex;\n  gap: var(--spacing-xl);\n}\n\n.footer-links a {\n  color: var(--color-text-muted);\n  text-decoration: none;\n  transition: color var(--transition-fast);\n}\n\n.footer-links a:hover {\n  color: var(--color-primary-light);\n}\n\n.footer-bottom {\n  text-align: center;\n  color: var(--color-text-dim);\n  font-size: 0.9rem;\n}\n\n.footer-bottom a {\n  color: var(--color-primary-light);\n  text-decoration: none;\n}\n\n/* Mobile Responsive */\n@media (max-width: 768px) {\n  .nav-links {\n    display: none;\n  }\n\n  .mobile-menu-btn {\n    display: flex;\n  }\n\n  .hero-title {\n    font-size: 2rem;\n  }\n\n  .demo-container {\n    flex-direction: column;\n  }\n\n  .demo-arrow {\n    transform: rotate(90deg);\n  }\n\n  .demo-card {\n    width: 100%;\n    max-width: 320px;\n  }\n\n  .features-grid {\n    grid-template-columns: 1fr;\n  }\n\n  .install-options {\n    flex-direction: column;\n    align-items: center;\n  }\n\n  .install-card {\n    width: 100%;\n    max-width: 320px;\n  }\n\n  .steps {\n    flex-direction: column;\n    align-items: center;\n  }\n\n  .footer-content {\n    flex-direction: column;\n    text-align: center;\n  }\n\n  .footer-links {\n    flex-wrap: wrap;\n    justify-content: center;\n  }\n}\n"
  },
  {
    "path": "website/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />\n\n    <!-- Primary Meta Tags -->\n    <title>YouTube Audio - Stream Only Audio from YouTube | Save Battery & Bandwidth</title>\n    <meta\n      name=\"title\"\n      content=\"YouTube Audio - Stream Only Audio from YouTube | Save Battery & Bandwidth\"\n    />\n    <meta\n      name=\"description\"\n      content=\"YouTube Audio is a browser extension that disables video and streams only audio from YouTube. Save battery life, bandwidth, and data while listening to music, podcasts, and more.\"\n    />\n    <meta\n      name=\"keywords\"\n      content=\"youtube, audio only, browser extension, firefox, chrome, save battery, save bandwidth, music, podcast, webextension\"\n    />\n    <meta name=\"author\" content=\"Animesh Kundu\" />\n    <meta name=\"robots\" content=\"index, follow\" />\n    <link rel=\"canonical\" href=\"https://animeshkundu.github.io/youtube-audio/\" />\n\n    <!-- Open Graph / Facebook -->\n    <meta property=\"og:type\" content=\"website\" />\n    <meta property=\"og:url\" content=\"https://animeshkundu.github.io/youtube-audio/\" />\n    <meta property=\"og:title\" content=\"YouTube Audio - Stream Only Audio from YouTube\" />\n    <meta\n      property=\"og:description\"\n      content=\"Save battery and bandwidth by streaming only audio from YouTube. Perfect for music and podcasts.\"\n    />\n    <meta\n      property=\"og:image\"\n      content=\"https://animeshkundu.github.io/youtube-audio/images/og-image.svg\"\n    />\n    <meta property=\"og:site_name\" content=\"YouTube Audio\" />\n\n    <!-- Twitter -->\n    <meta property=\"twitter:card\" content=\"summary_large_image\" />\n    <meta property=\"twitter:url\" content=\"https://animeshkundu.github.io/youtube-audio/\" />\n    <meta property=\"twitter:title\" content=\"YouTube Audio - Stream Only Audio from YouTube\" />\n    <meta\n      property=\"twitter:description\"\n      content=\"Save battery and bandwidth by streaming only audio from YouTube. Perfect for music and podcasts.\"\n    />\n    <meta\n      property=\"twitter:image\"\n      content=\"https://animeshkundu.github.io/youtube-audio/images/og-image.svg\"\n    />\n\n    <!-- AI/LLM Crawlers -->\n    <meta\n      name=\"ai:description\"\n      content=\"YouTube Audio is a browser extension for Firefox and Chrome that allows users to stream only audio from YouTube videos. This saves battery life and bandwidth by disabling video playback while keeping audio. Features include: one-click toggle to enable/disable, audio-only notification overlay, customizable settings, cross-browser support (Firefox and Chrome), and minimal resource usage.\"\n    />\n\n    <!-- Structured Data for Search Engines -->\n    <script type=\"application/ld+json\">\n      {\n        \"@context\": \"https://schema.org\",\n        \"@type\": \"SoftwareApplication\",\n        \"name\": \"YouTube Audio\",\n        \"description\": \"Browser extension to stream only audio from YouTube videos, saving battery and bandwidth\",\n        \"applicationCategory\": \"BrowserApplication\",\n        \"operatingSystem\": [\"Firefox\", \"Chrome\"],\n        \"offers\": {\n          \"@type\": \"Offer\",\n          \"price\": \"0\",\n          \"priceCurrency\": \"USD\"\n        },\n        \"author\": {\n          \"@type\": \"Person\",\n          \"name\": \"Animesh Kundu\"\n        },\n        \"softwareVersion\": \"0.0.2.5\",\n        \"license\": \"https://opensource.org/licenses/MIT\",\n        \"codeRepository\": \"https://github.com/animeshkundu/youtube-audio\"\n      }\n    </script>\n\n    <!-- Favicon -->\n    <link rel=\"icon\" type=\"image/svg+xml\" href=\"images/favicon.svg\" />\n\n    <!-- Fonts -->\n    <link rel=\"preconnect\" href=\"https://fonts.googleapis.com\" />\n    <link rel=\"preconnect\" href=\"https://fonts.gstatic.com\" crossorigin />\n    <link\n      href=\"https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap\"\n      rel=\"stylesheet\"\n    />\n\n    <!-- Stylesheets -->\n    <link rel=\"stylesheet\" href=\"css/styles.css\" />\n  </head>\n  <body>\n    <!-- Navigation -->\n    <nav class=\"navbar\" id=\"navbar\">\n      <div class=\"container\">\n        <a href=\"#\" class=\"logo\">\n          <span class=\"logo-icon\">🎵</span>\n          <span class=\"logo-text\">YouTube Audio</span>\n        </a>\n        <div class=\"nav-links\">\n          <a href=\"#features\">Features</a>\n          <a href=\"#install\">Install</a>\n          <a href=\"#how-it-works\">How It Works</a>\n          <a href=\"#faq\">FAQ</a>\n          <a\n            href=\"https://github.com/animeshkundu/youtube-audio\"\n            class=\"github-link\"\n            target=\"_blank\"\n            rel=\"noopener\"\n          >\n            <svg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"currentColor\">\n              <path\n                d=\"M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z\"\n              />\n            </svg>\n            <span>GitHub</span>\n          </a>\n        </div>\n        <button class=\"mobile-menu-btn\" id=\"mobileMenuBtn\" aria-label=\"Toggle menu\">\n          <span></span>\n          <span></span>\n          <span></span>\n        </button>\n      </div>\n    </nav>\n\n    <!-- Hero Section -->\n    <header class=\"hero\">\n      <div class=\"hero-bg\">\n        <div class=\"gradient-orb orb-1\"></div>\n        <div class=\"gradient-orb orb-2\"></div>\n        <div class=\"gradient-orb orb-3\"></div>\n      </div>\n      <div class=\"container\">\n        <div class=\"hero-badge\">\n          <span class=\"badge-icon\">🔋</span>\n          <span>Save Battery & Bandwidth</span>\n        </div>\n        <h1 class=\"hero-title\">Stream <span class=\"highlight\">only audio</span> from YouTube</h1>\n        <p class=\"hero-subtitle\">\n          A lightweight browser extension that disables video and streams audio-only. Perfect for\n          music, podcasts, and background listening.\n        </p>\n\n        <!-- Demo -->\n        <div class=\"demo-container\">\n          <div class=\"demo-card\">\n            <div class=\"demo-header\">\n              <div class=\"demo-icon before\">📺</div>\n              <div class=\"demo-label\">Before</div>\n            </div>\n            <div class=\"demo-content\">\n              <p>Video + Audio streaming</p>\n              <ul class=\"demo-list negative\">\n                <li>High battery drain</li>\n                <li>High data usage</li>\n                <li>Heats up device</li>\n              </ul>\n            </div>\n          </div>\n          <div class=\"demo-arrow\">→</div>\n          <div class=\"demo-card active\">\n            <div class=\"demo-header\">\n              <div class=\"demo-icon after\">🎵</div>\n              <div class=\"demo-label\">With YouTube Audio</div>\n            </div>\n            <div class=\"demo-content\">\n              <p>Audio-only streaming</p>\n              <ul class=\"demo-list positive\">\n                <li>Extended battery life</li>\n                <li>Reduced data usage</li>\n                <li>Cool & quiet device</li>\n              </ul>\n            </div>\n          </div>\n        </div>\n\n        <!-- CTA Button -->\n        <div class=\"cta-buttons\">\n          <a\n            href=\"https://addons.mozilla.org/en-US/firefox/addon/youtube-audio/\"\n            class=\"btn btn-primary\"\n            target=\"_blank\"\n            rel=\"noopener\"\n          >\n            <svg class=\"btn-icon\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"currentColor\">\n              <path\n                d=\"M21.634 7.17c-.043-.063-.094-.132-.169-.202-.9-.851-1.898-1.347-2.969-1.492 0 0-.163-.018-.482-.018-.37 0-.745.018-1.129.036-1.009.041-1.929.087-2.752.087-1.129 0-2.197-.074-3.201-.17-.423-.039-.842-.081-1.256-.087a7.07 7.07 0 0 0-1.009.033c-1.072.146-2.069.641-2.969 1.492-.075.07-.126.139-.169.202C4.5 8.26 4.5 9.492 4.5 10.786V12c0 6.627 5.373 12 12 12s12-5.373 12-12v-1.214c0-1.294 0-2.526-1.034-3.616zM9.333 15.111H7.11V9.778h2.223v5.333zm3.889 0h-2.223V9.778h2.223v5.333zm3.889 0h-2.223V9.778h2.223v5.333z\"\n              />\n            </svg>\n            Install for Firefox\n          </a>\n          <a href=\"#install\" class=\"btn btn-secondary\"> Other Browsers </a>\n        </div>\n      </div>\n    </header>\n\n    <!-- Features Section -->\n    <section class=\"features\" id=\"features\">\n      <div class=\"container\">\n        <div class=\"section-header\">\n          <h2>Why use <span class=\"highlight\">YouTube Audio</span>?</h2>\n          <p>Simple, efficient, and battery-friendly</p>\n        </div>\n        <div class=\"features-grid\">\n          <div class=\"feature-card\">\n            <div class=\"feature-icon\">🔋</div>\n            <h3>Save Battery</h3>\n            <p>\n              Video decoding is one of the biggest battery drains. By streaming audio only, your\n              laptop or phone stays cooler and lasts longer.\n            </p>\n          </div>\n          <div class=\"feature-card\">\n            <div class=\"feature-icon\">📶</div>\n            <h3>Save Bandwidth</h3>\n            <p>\n              Audio streams are much smaller than video. Save data on metered connections and enjoy\n              faster streaming even on slow networks.\n            </p>\n          </div>\n          <div class=\"feature-card\">\n            <div class=\"feature-icon\">🎯</div>\n            <h3>One-Click Toggle</h3>\n            <p>\n              Simply click the extension icon to enable or disable. No complicated settings - just\n              instant control over your streaming.\n            </p>\n          </div>\n          <div class=\"feature-card\">\n            <div class=\"feature-icon\">🌡️</div>\n            <h3>Reduce Heat</h3>\n            <p>\n              Without video decoding, your device stays cool. Perfect for long listening sessions or\n              when your device is already working hard.\n            </p>\n          </div>\n          <div class=\"feature-card\">\n            <div class=\"feature-icon\">🔒</div>\n            <h3>Privacy Focused</h3>\n            <p>\n              No tracking, no analytics, no external servers. The extension works entirely locally\n              in your browser.\n            </p>\n          </div>\n          <div class=\"feature-card\">\n            <div class=\"feature-icon\">⚡</div>\n            <h3>Lightweight</h3>\n            <p>\n              Minimal footprint, zero performance impact. The extension only activates when you're\n              on YouTube.\n            </p>\n          </div>\n        </div>\n      </div>\n    </section>\n\n    <!-- Install Section -->\n    <section class=\"install\" id=\"install\">\n      <div class=\"container\">\n        <div class=\"section-header\">\n          <h2>Install <span class=\"highlight\">YouTube Audio</span></h2>\n          <p>Available for Firefox. More browsers coming soon!</p>\n        </div>\n        <div class=\"install-options\">\n          <div class=\"install-card primary\">\n            <div class=\"install-icon\">\n              <svg viewBox=\"0 0 24 24\" width=\"48\" height=\"48\" fill=\"currentColor\">\n                <path\n                  d=\"M21.634 7.17c-.043-.063-.094-.132-.169-.202-.9-.851-1.898-1.347-2.969-1.492 0 0-.163-.018-.482-.018-.37 0-.745.018-1.129.036-1.009.041-1.929.087-2.752.087-1.129 0-2.197-.074-3.201-.17-.423-.039-.842-.081-1.256-.087a7.07 7.07 0 0 0-1.009.033c-1.072.146-2.069.641-2.969 1.492-.075.07-.126.139-.169.202C4.5 8.26 4.5 9.492 4.5 10.786V12c0 6.627 5.373 12 12 12s12-5.373 12-12v-1.214c0-1.294 0-2.526-1.034-3.616z\"\n                />\n              </svg>\n            </div>\n            <h3>Firefox</h3>\n            <p>Recommended • Full support</p>\n            <a\n              href=\"https://addons.mozilla.org/en-US/firefox/addon/youtube-audio/\"\n              class=\"btn btn-primary\"\n              target=\"_blank\"\n              rel=\"noopener\"\n            >\n              Install Now\n            </a>\n          </div>\n          <div class=\"install-card\">\n            <div class=\"install-icon chrome\">\n              <svg viewBox=\"0 0 24 24\" width=\"48\" height=\"48\" fill=\"currentColor\">\n                <path\n                  d=\"M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0zm0 4.5a7.5 7.5 0 1 1 0 15 7.5 7.5 0 0 1 0-15z\"\n                />\n              </svg>\n            </div>\n            <h3>Chrome</h3>\n            <p>Coming soon</p>\n            <a\n              href=\"https://github.com/animeshkundu/youtube-audio\"\n              class=\"btn btn-outline\"\n              target=\"_blank\"\n              rel=\"noopener\"\n            >\n              View on GitHub\n            </a>\n          </div>\n        </div>\n      </div>\n    </section>\n\n    <!-- How It Works Section -->\n    <section class=\"how-it-works\" id=\"how-it-works\">\n      <div class=\"container\">\n        <div class=\"section-header\">\n          <h2>How it <span class=\"highlight\">works</span></h2>\n          <p>Simple and automatic</p>\n        </div>\n        <div class=\"steps\">\n          <div class=\"step\">\n            <div class=\"step-number\">1</div>\n            <h3>Install the Extension</h3>\n            <p>Add YouTube Audio to your browser from the Firefox Add-ons store.</p>\n          </div>\n          <div class=\"step\">\n            <div class=\"step-number\">2</div>\n            <h3>Visit YouTube</h3>\n            <p>Navigate to any YouTube video you want to listen to.</p>\n          </div>\n          <div class=\"step\">\n            <div class=\"step-number\">3</div>\n            <h3>Enjoy Audio-Only</h3>\n            <p>The extension automatically streams audio only. Toggle with one click if needed.</p>\n          </div>\n        </div>\n      </div>\n    </section>\n\n    <!-- FAQ Section -->\n    <section class=\"faq\" id=\"faq\">\n      <div class=\"container\">\n        <div class=\"section-header\">\n          <h2>Frequently Asked <span class=\"highlight\">Questions</span></h2>\n        </div>\n        <div class=\"faq-list\">\n          <div class=\"faq-item\">\n            <button class=\"faq-question\">\n              <span>Does it work with all YouTube videos?</span>\n              <span class=\"faq-icon\">+</span>\n            </button>\n            <div class=\"faq-answer\">\n              <p>\n                Yes, it works with regular YouTube videos. However, live streams are not supported\n                as they require real-time video synchronization.\n              </p>\n            </div>\n          </div>\n          <div class=\"faq-item\">\n            <button class=\"faq-question\">\n              <span>How much bandwidth does it save?</span>\n              <span class=\"faq-icon\">+</span>\n            </button>\n            <div class=\"faq-answer\">\n              <p>\n                Audio streams are typically 10-20x smaller than video. A 1080p video might use 5-10\n                Mbps, while audio uses only 128-256 Kbps.\n              </p>\n            </div>\n          </div>\n          <div class=\"faq-item\">\n            <button class=\"faq-question\">\n              <span>Can I toggle between audio and video?</span>\n              <span class=\"faq-icon\">+</span>\n            </button>\n            <div class=\"faq-answer\">\n              <p>\n                Yes! Simply click the extension icon to disable audio-only mode, then refresh the\n                page to watch the video normally.\n              </p>\n            </div>\n          </div>\n          <div class=\"faq-item\">\n            <button class=\"faq-question\">\n              <span>Is it safe and private?</span>\n              <span class=\"faq-icon\">+</span>\n            </button>\n            <div class=\"faq-answer\">\n              <p>\n                Absolutely. The extension works entirely locally in your browser. It doesn't collect\n                any data, has no analytics, and communicates with no external servers.\n              </p>\n            </div>\n          </div>\n          <div class=\"faq-item\">\n            <button class=\"faq-question\">\n              <span>Why isn't Chrome supported yet?</span>\n              <span class=\"faq-icon\">+</span>\n            </button>\n            <div class=\"faq-answer\">\n              <p>\n                We're working on Chrome support! The extension architecture works on both browsers,\n                but we need a Chrome Web Store developer account to publish it. Contributions are\n                welcome!\n              </p>\n            </div>\n          </div>\n        </div>\n      </div>\n    </section>\n\n    <!-- Footer -->\n    <footer class=\"footer\">\n      <div class=\"container\">\n        <div class=\"footer-content\">\n          <div class=\"footer-brand\">\n            <span class=\"logo-icon\">🎵</span>\n            <span class=\"logo-text\">YouTube Audio</span>\n          </div>\n          <div class=\"footer-links\">\n            <a href=\"https://github.com/animeshkundu/youtube-audio\" target=\"_blank\" rel=\"noopener\"\n              >GitHub</a\n            >\n            <a\n              href=\"https://github.com/animeshkundu/youtube-audio/issues\"\n              target=\"_blank\"\n              rel=\"noopener\"\n              >Report Issue</a\n            >\n            <a\n              href=\"https://github.com/animeshkundu/youtube-audio/blob/main/LICENSE\"\n              target=\"_blank\"\n              rel=\"noopener\"\n              >MIT License</a\n            >\n          </div>\n        </div>\n        <div class=\"footer-bottom\">\n          <p>\n            &copy; 2024 YouTube Audio. Made with ❤️ by\n            <a href=\"https://github.com/animeshkundu\" target=\"_blank\" rel=\"noopener\"\n              >Animesh Kundu</a\n            >\n          </p>\n        </div>\n      </div>\n    </footer>\n\n    <!-- Scripts -->\n    <script src=\"js/main.js\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "website/js/main.js",
    "content": "/**\n * YouTube Audio Website - Main JavaScript\n */\n\ndocument.addEventListener('DOMContentLoaded', function () {\n  // Mobile menu toggle\n  initMobileMenu();\n\n  // FAQ accordion\n  initFAQ();\n\n  // Smooth scrolling for anchor links\n  initSmoothScroll();\n\n  // Navbar scroll effect\n  initNavbarScroll();\n});\n\n/**\n * Initialize mobile menu toggle\n */\nfunction initMobileMenu() {\n  const menuBtn = document.getElementById('mobileMenuBtn');\n  const navLinks = document.querySelector('.nav-links');\n\n  if (!menuBtn || !navLinks) return;\n\n  menuBtn.addEventListener('click', function () {\n    menuBtn.classList.toggle('active');\n    navLinks.classList.toggle('mobile-open');\n  });\n}\n\n/**\n * Initialize FAQ accordion\n */\nfunction initFAQ() {\n  const faqItems = document.querySelectorAll('.faq-item');\n\n  faqItems.forEach(function (item) {\n    const question = item.querySelector('.faq-question');\n\n    if (!question) return;\n\n    question.addEventListener('click', function () {\n      // Close other items\n      faqItems.forEach(function (otherItem) {\n        if (otherItem !== item) {\n          otherItem.classList.remove('active');\n        }\n      });\n\n      // Toggle current item\n      item.classList.toggle('active');\n    });\n  });\n}\n\n/**\n * Initialize smooth scrolling for anchor links\n */\nfunction initSmoothScroll() {\n  const anchors = document.querySelectorAll('a[href^=\"#\"]');\n\n  anchors.forEach(function (anchor) {\n    anchor.addEventListener('click', function (e) {\n      const href = this.getAttribute('href');\n\n      if (href === '#') return;\n\n      const target = document.querySelector(href);\n\n      if (!target) return;\n\n      e.preventDefault();\n\n      const navHeight = document.querySelector('.navbar')?.offsetHeight || 0;\n      const targetPosition = target.getBoundingClientRect().top + window.pageYOffset - navHeight;\n\n      window.scrollTo({\n        top: targetPosition,\n        behavior: 'smooth',\n      });\n    });\n  });\n}\n\n/**\n * Initialize navbar scroll effect\n */\nfunction initNavbarScroll() {\n  const navbar = document.getElementById('navbar');\n\n  if (!navbar) return;\n\n  let lastScroll = 0;\n\n  window.addEventListener('scroll', function () {\n    const currentScroll = window.pageYOffset;\n\n    if (currentScroll > 100) {\n      navbar.classList.add('scrolled');\n    } else {\n      navbar.classList.remove('scrolled');\n    }\n\n    lastScroll = currentScroll;\n  });\n}\n"
  },
  {
    "path": "website/llms.txt",
    "content": "# YouTube Audio\n> Stream only audio from YouTube videos - Save battery and bandwidth\n\n## What is YouTube Audio?\nYouTube Audio is a browser extension for Firefox (and Chrome soon) that disables video playback and streams only the audio from YouTube videos. This is perfect for listening to music, podcasts, or any audio content without the battery drain and bandwidth usage of video.\n\n## Key Features\n- **One-Click Toggle**: Enable/disable audio-only mode with a single click\n- **Battery Saver**: No video decoding means significantly less battery usage\n- **Bandwidth Saver**: Audio streams are 10-20x smaller than video streams\n- **Privacy Focused**: No tracking, no analytics, works entirely locally\n- **Lightweight**: Minimal footprint, only activates on YouTube\n\n## How It Works\n1. The extension intercepts YouTube requests\n2. When an audio stream is detected, it replaces the video stream\n3. The video player shows an audio-only notification\n4. Toggle the extension icon to switch between audio-only and normal mode\n\n## Technical Details\n- **Platform**: WebExtension (Firefox, Chrome compatible)\n- **Manifest Version**: V2\n- **APIs Used**: WebRequest, Storage, Tabs, BrowserAction\n- **Language**: JavaScript (ES6+)\n\n## Installation\nFirefox: https://addons.mozilla.org/en-US/firefox/addon/youtube-audio/\nChrome: Coming soon (contributions welcome!)\n\n## Repository\nGitHub: https://github.com/animeshkundu/youtube-audio\n\n## License\nMIT License - Free and open source\n\n## Author\nAnimesh Kundu\nGitHub: https://github.com/animeshkundu\n\n## Documentation\n- Main documentation: docs/\n- Architecture: docs/architecture/\n- Specifications: docs/specs/\n- Agent Instructions: docs/agent-instructions/\n"
  },
  {
    "path": "website/robots.txt",
    "content": "# YouTube Audio Website\n# https://animeshkundu.github.io/youtube-audio/\n\nUser-agent: *\nAllow: /\n\n# Sitemaps\nSitemap: https://animeshkundu.github.io/youtube-audio/sitemap.xml\n\n# LLM/AI crawlers welcome\nUser-agent: GPTBot\nAllow: /\n\nUser-agent: Google-Extended\nAllow: /\n\nUser-agent: Anthropic-AI\nAllow: /\n\nUser-agent: Claude-Web\nAllow: /\n\nUser-agent: ChatGPT-User\nAllow: /\n\nUser-agent: cohere-ai\nAllow: /\n\nUser-agent: PerplexityBot\nAllow: /\n\n# LLMs.txt\n# See https://animeshkundu.github.io/youtube-audio/llms.txt for AI-readable project info\n"
  },
  {
    "path": "website/sitemap.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n  <url>\n    <loc>https://animeshkundu.github.io/youtube-audio/</loc>\n    <changefreq>monthly</changefreq>\n    <priority>1.0</priority>\n  </url>\n</urlset>\n"
  }
]