import tailwindcss from '@tailwindcss/vite'
import { isUndefined } from 'lodash-es'
import { defineConfig } from 'vitepress'
import { groupIconMdPlugin, groupIconVitePlugin, localIconLoader } from 'vitepress-plugin-group-icons'
import llmstxt from 'vitepress-plugin-llms'
import pkg from '../../../packages/protocol-launcher/package.json' with { type: 'json' }

const isGithubPages = isUndefined(process.env.VERCEL)
const base = isGithubPages ? '/protocol-launcher/' : '/'

// https://vitepress.dev/reference/site-config
export default defineConfig({
  title: 'Protocol Launcher',
  description: 'One-click launch URL generator for protocol-based apps.',
  srcExclude: ['AGENTS.md', 'CLAUDE.md'],
  rewrites: {
    'en/:rest*': ':rest*',
    'en/index.md': 'index.md',
    'en/guide/what-is-it.md': 'guide/what-is-it.md',
    'en/guide/getting-started.md': 'guide/getting-started.md',
    'en/extra/examples.md': 'extra/examples.md',
    'en/apps/affine.md': 'apps/affine.md',
    'en/apps/agenda.md': 'apps/agenda.md',
    'en/apps/alfred.md': 'apps/alfred.md',
    'en/apps/antigravity.md': 'apps/antigravity.md',
    'en/apps/anybox.md': 'apps/anybox.md',
    'en/apps/app-store.md': 'apps/app-store.md',
    'en/apps/appflowy.md': 'apps/appflowy.md',
    'en/apps/appigo-todo.md': 'apps/appigo-todo.md',
    'en/apps/apple-map.md': 'apps/apple-map.md',
    'en/apps/apple-script.md': 'apps/apple-script.md',
    'en/apps/atom.md': 'apps/atom.md',
    'en/apps/1writer.md': 'apps/1writer.md',
    'en/apps/bbedit.md': 'apps/bbedit.md',
    'en/apps/bear.md': 'apps/bear.md',
    'en/apps/beorg.md': 'apps/beorg.md',
    'en/apps/bettertouchtool.md': 'apps/bettertouchtool.md',
    'en/apps/bunch.md': 'apps/bunch.md',
    'en/apps/cal2todo.md': 'apps/cal2todo.md',
    'en/apps/calca.md': 'apps/calca.md',
    'en/apps/capacities.md': 'apps/capacities.md',
    'en/apps/cherry-studio.md': 'apps/cherry-studio.md',
    'en/apps/coda.md': 'apps/coda.md',
    'en/apps/code-buddy.md': 'apps/code-buddy.md',
    'en/apps/code-buddy-cn.md': 'apps/code-buddy-cn.md',
    'en/apps/codelite.md': 'apps/codelite.md',
    'en/apps/code-runner.md': 'apps/code-runner.md',
    'en/apps/codehub.md': 'apps/codehub.md',
    'en/apps/codex.md': 'apps/codex.md',
    'en/apps/craft.md': 'apps/craft.md',
    'en/apps/cubox.md': 'apps/cubox.md',
    'en/apps/cursor.md': 'apps/cursor.md',
    'en/apps/2do.md': 'apps/2do.md',
    'en/apps/day-one.md': 'apps/day-one.md',
    'en/apps/devonthink.md': 'apps/devonthink.md',
    'en/apps/dict-cc.md': 'apps/dict-cc.md',
    'en/apps/drafts.md': 'apps/drafts.md',
    'en/apps/editorial.md': 'apps/editorial.md',
    'en/apps/equipd-bible.md': 'apps/equipd-bible.md',
    'en/apps/due.md': 'apps/due.md',
    'en/apps/evernote.md': 'apps/evernote.md',
    'en/apps/fantastical.md': 'apps/fantastical.md',
    'en/apps/fsnotes.md': 'apps/fsnotes.md',
    'en/apps/ftstreets.md': 'apps/ftstreets.md',
    'en/apps/github-desktop.md': 'apps/github-desktop.md',
    'en/apps/gladys.md': 'apps/gladys.md',
    'en/apps/goodlinks.md': 'apps/goodlinks.md',
    'en/apps/goodtask.md': 'apps/goodtask.md',
    'en/apps/goland.md': 'apps/goland.md',
    'en/apps/google-maps.md': 'apps/google-maps.md',
    'en/apps/hbuilderx.md': 'apps/hbuilderx.md',
    'en/apps/hammerspoon.md': 'apps/hammerspoon.md',
    'en/apps/hookmark.md': 'apps/hookmark.md',
    'en/apps/ia-writer.md': 'apps/ia-writer.md',
    'en/apps/icab-mobile.md': 'apps/icab-mobile.md',
    'en/apps/idea.md': 'apps/idea.md',
    'en/apps/instapaper.md': 'apps/instapaper.md',
    'en/apps/interact.md': 'apps/interact.md',
    'en/apps/ipgmail.md': 'apps/ipgmail.md',
    'en/apps/itsycal.md': 'apps/itsycal.md',
    'en/apps/jump-desktop.md': 'apps/jump-desktop.md',
    'en/apps/keyboard-maestro.md': 'apps/keyboard-maestro.md',
    'en/apps/kaleidoscope.md': 'apps/kaleidoscope.md',
    'en/apps/kiro.md': 'apps/kiro.md',
    'en/apps/lingma.md': 'apps/lingma.md',
    'en/apps/longshot.md': 'apps/longshot.md',
    'en/apps/macos.md': 'apps/macos.md',
    'en/apps/macvim.md': 'apps/macvim.md',
    'en/apps/mail-assistant.md': 'apps/mail-assistant.md',
    'en/apps/mical.md': 'apps/mical.md',
    'en/apps/microsoft-edge.md': 'apps/microsoft-edge.md',
    'en/apps/microsoft-teams.md': 'apps/microsoft-teams.md',
    'en/apps/motrix.md': 'apps/motrix.md',
    'en/apps/multi-timer.md': 'apps/multi-timer.md',
    'en/apps/navicat.md': 'apps/navicat.md',
    'en/apps/noteplan.md': 'apps/noteplan.md',
    'en/apps/nozbe.md': 'apps/nozbe.md',
    'en/apps/nova.md': 'apps/nova.md',
    'en/apps/obsidian.md': 'apps/obsidian.md',
    'en/apps/omnifocus.md': 'apps/omnifocus.md',
    'en/apps/opencode.md': 'apps/opencode.md',
    'en/apps/opener.md': 'apps/opener.md',
    'en/apps/orchids.md': 'apps/orchids.md',
    'en/apps/overcast.md': 'apps/overcast.md',
    'en/apps/pearai.md': 'apps/pearai.md',
    'en/apps/pika.md': 'apps/pika.md',
    'en/apps/pleco.md': 'apps/pleco.md',
    'en/apps/prizmo.md': 'apps/prizmo.md',
    'en/apps/phpstorm.md': 'apps/phpstorm.md',
    'en/apps/pycharm.md': 'apps/pycharm.md',
    'en/apps/pythonista.md': 'apps/pythonista.md',
    'en/apps/pyto.md': 'apps/pyto.md',
    'en/apps/qoder.md': 'apps/qoder.md',
    'en/apps/quark.md': 'apps/quark.md',
    'en/apps/raycast.md': 'apps/raycast.md',
    'en/apps/rustrover.md': 'apps/rustrover.md',
    'en/apps/scriptable.md': 'apps/scriptable.md',
    'en/apps/shopi.md': 'apps/shopi.md',
    'en/apps/shortcuts.md': 'apps/shortcuts.md',
    'en/apps/simple-scan.md': 'apps/simple-scan.md',
    'en/apps/sketch.md': 'apps/sketch.md',
    'en/apps/slack.md': 'apps/slack.md',
    'en/apps/soulver.md': 'apps/soulver.md',
    'en/apps/sourcetree.md': 'apps/sourcetree.md',
    'en/apps/steam.md': 'apps/steam.md',
    'en/apps/story-planner.md': 'apps/story-planner.md',
    'en/apps/tally.md': 'apps/tally.md',
    'en/apps/telegram.md': 'apps/telegram.md',
    'en/apps/terminology.md': 'apps/terminology.md',
    'en/apps/termius.md': 'apps/termius.md',
    'en/apps/textastic.md': 'apps/textastic.md',
    'en/apps/textmate.md': 'apps/textmate.md',
    'en/apps/theia.md': 'apps/theia.md',
    'en/apps/things.md': 'apps/things.md',
    'en/apps/thunder.md': 'apps/thunder.md',
    'en/apps/todoist.md': 'apps/todoist.md',
    'en/apps/tower.md': 'apps/tower.md',
    'en/apps/trae.md': 'apps/trae.md',
    'en/apps/trae-cn.md': 'apps/trae-cn.md',
    'en/apps/trello.md': 'apps/trello.md',
    'en/apps/ulysses.md': 'apps/ulysses.md',
    'en/apps/upic.md': 'apps/upic.md',
    'en/apps/verdent.md': 'apps/verdent.md',
    'en/apps/vscode.md': 'apps/vscode.md',
    'en/apps/vscode-insiders.md': 'apps/vscode-insiders.md',
    'en/apps/vscodium.md': 'apps/vscodium.md',
    'en/apps/waterminder.md': 'apps/waterminder.md',
    'en/apps/waze.md': 'apps/waze.md',
    'en/apps/webstorm.md': 'apps/webstorm.md',
    'en/apps/wemeet.md': 'apps/wemeet.md',
    'en/apps/whereto.md': 'apps/whereto.md',
    'en/apps/windsurf.md': 'apps/windsurf.md',
    'en/apps/working-copy.md': 'apps/working-copy.md',
    'en/apps/xcode.md': 'apps/xcode.md',
    'en/apps/zed.md': 'apps/zed.md',
  },
  base,
  head: [
    ['link', { rel: 'shortcut icon', href: `${base}logo.svg` }],
    ['link', { rel: 'apple-touch-icon', sizes: '180x180', href: `${base}logo.svg` }],
    ['meta', { name: 'baidu-site-verification', content: 'codeva-hoImtNdY4x' }],
  ],
  locales: {
    root: { label: 'English', lang: 'en-US', dir: 'ltr' },
    zh: { label: '简体中文', lang: 'zh-Hans', dir: 'ltr' },
  },
  themeConfig: {
    logo: '/logo.svg',
    socialLinks: [{ icon: 'github', link: 'https://github.com/zhensherlock/protocol-launcher' }],
    nav: [
      { text: 'Home', link: '/' },
      { text: 'Guide', link: '/guide/getting-started', activeMatch: '/guide/' },
      {
        text: pkg.version,
        items: [
          {
            text: 'Changelog',
            link: 'https://github.com/zhensherlock/protocol-launcher/blob/main/packages/protocol-launcher/CHANGELOG.md',
          },
        ],
      },
    ],

    outline: {
      level: [2, 6],
    },

    sidebar: [
      {
        text: 'Introduction',
        items: [
          { text: 'What is Protocol Launcher?', link: '/guide/what-is-it' },
          { text: 'Getting Started', link: '/guide/getting-started' },
        ],
      },
      {
        text: 'Applications',
        items: [
          { text: 'AFFiNE', link: '/apps/affine' },
          { text: 'Agenda', link: '/apps/agenda' },
          { text: 'Alfred', link: '/apps/alfred' },
          { text: 'Antigravity', link: '/apps/antigravity' },
          { text: 'Anybox', link: '/apps/anybox' },
          { text: 'App Store', link: '/apps/app-store' },
          { text: 'AppFlowy', link: '/apps/appflowy' },
          { text: 'Appigo Todo', link: '/apps/appigo-todo' },
          { text: 'Apple Maps', link: '/apps/apple-map' },
          { text: 'Apple Script Editor', link: '/apps/apple-script' },
          { text: 'Atom', link: '/apps/atom' },
          { text: '1Writer', link: '/apps/1writer' },
          { text: 'BBEdit', link: '/apps/bbedit' },
          { text: 'Bear', link: '/apps/bear' },
          { text: 'Beorg', link: '/apps/beorg' },
          { text: 'BetterTouchTool', link: '/apps/bettertouchtool' },
          { text: 'Bunch', link: '/apps/bunch' },
          { text: 'Cal2Todo', link: '/apps/cal2todo' },
          { text: 'Calca', link: '/apps/calca' },
          { text: 'Capacities', link: '/apps/capacities' },
          { text: 'Cherry Studio', link: '/apps/cherry-studio' },
          { text: 'Coda', link: '/apps/coda' },
          { text: 'CodeBuddy', link: '/apps/code-buddy' },
          { text: 'CodeBuddy China', link: '/apps/code-buddy-cn' },
          { text: 'CodeLite', link: '/apps/codelite' },
          { text: 'CodeRunner', link: '/apps/code-runner' },
          { text: 'CodeHub', link: '/apps/codehub' },
          { text: 'Codex', link: '/apps/codex' },
          { text: 'Craft', link: '/apps/craft' },
          { text: 'Cubox', link: '/apps/cubox' },
          { text: 'Cursor', link: '/apps/cursor' },
          { text: '2Do', link: '/apps/2do' },
          { text: 'Day One', link: '/apps/day-one' },
          { text: 'DEVONthink', link: '/apps/devonthink' },
          { text: 'dict.cc', link: '/apps/dict-cc' },
          { text: 'Drafts', link: '/apps/drafts' },
          { text: 'Editorial', link: '/apps/editorial' },
          { text: 'Equipd Bible', link: '/apps/equipd-bible' },
          { text: 'Due', link: '/apps/due' },
          { text: 'Evernote', link: '/apps/evernote' },
          { text: 'Fantastical', link: '/apps/fantastical' },
          { text: 'FSNotes', link: '/apps/fsnotes' },
          { text: 'Streets', link: '/apps/ftstreets' },
          { text: 'GitHub Desktop', link: '/apps/github-desktop' },
          { text: 'Gladys', link: '/apps/gladys' },
          { text: 'GoodLinks', link: '/apps/goodlinks' },
          { text: 'GoodTask', link: '/apps/goodtask' },
          { text: 'GoLand', link: '/apps/goland' },
          { text: 'Google Maps', link: '/apps/google-maps' },
          { text: 'HBuilderX', link: '/apps/hbuilderx' },
          { text: 'Hammerspoon', link: '/apps/hammerspoon' },
          { text: 'Hookmark', link: '/apps/hookmark' },
          { text: 'iA Writer', link: '/apps/ia-writer' },
          { text: 'iCab Mobile', link: '/apps/icab-mobile' },
          { text: 'IntelliJ IDEA', link: '/apps/idea' },
          { text: 'Instapaper', link: '/apps/instapaper' },
          { text: 'Interact Scratchpad', link: '/apps/interact' },
          { text: 'iPGMail', link: '/apps/ipgmail' },
          { text: 'Itsycal', link: '/apps/itsycal' },
          { text: 'Jump Desktop', link: '/apps/jump-desktop' },
          { text: 'Keyboard Maestro', link: '/apps/keyboard-maestro' },
          { text: 'Kaleidoscope', link: '/apps/kaleidoscope' },
          { text: 'Kiro', link: '/apps/kiro' },
          { text: 'Lingma', link: '/apps/lingma' },
          { text: 'Longshot', link: '/apps/longshot' },
          { text: 'macOS', link: '/apps/macos' },
          { text: 'MacVim', link: '/apps/macvim' },
          { text: 'Mail Assistant', link: '/apps/mail-assistant' },
          { text: 'miCal', link: '/apps/mical' },
          { text: 'Microsoft Edge', link: '/apps/microsoft-edge' },
          { text: 'Microsoft Teams', link: '/apps/microsoft-teams' },
          { text: 'Motrix', link: '/apps/motrix' },
          { text: 'MultiTimer', link: '/apps/multi-timer' },
          { text: 'Navicat', link: '/apps/navicat' },
          { text: 'NotePlan', link: '/apps/noteplan' },
          { text: 'Nozbe', link: '/apps/nozbe' },
          { text: 'Nova', link: '/apps/nova' },
          { text: 'Obsidian', link: '/apps/obsidian' },
          { text: 'OmniFocus', link: '/apps/omnifocus' },
          { text: 'OpenCode', link: '/apps/opencode' },
          { text: 'Opener', link: '/apps/opener' },
          { text: 'Orchids', link: '/apps/orchids' },
          { text: 'Overcast', link: '/apps/overcast' },
          { text: 'PearAI', link: '/apps/pearai' },
          { text: 'Pika', link: '/apps/pika' },
          { text: 'Pleco', link: '/apps/pleco' },
          { text: 'Prizmo', link: '/apps/prizmo' },
          { text: 'PhpStorm', link: '/apps/phpstorm' },
          { text: 'PyCharm', link: '/apps/pycharm' },
          { text: 'Pythonista', link: '/apps/pythonista' },
          { text: 'Pyto', link: '/apps/pyto' },
          { text: 'Qoder', link: '/apps/qoder' },
          { text: 'Quark', link: '/apps/quark' },
          { text: 'Raycast', link: '/apps/raycast' },
          { text: 'RustRover', link: '/apps/rustrover' },
          { text: 'Scriptable', link: '/apps/scriptable' },
          { text: 'Shopi', link: '/apps/shopi' },
          { text: 'Shortcuts', link: '/apps/shortcuts' },
          { text: 'Simple Scan', link: '/apps/simple-scan' },
          { text: 'Sketch', link: '/apps/sketch' },
          { text: 'Slack', link: '/apps/slack' },
          { text: 'Soulver', link: '/apps/soulver' },
          { text: 'SourceTree', link: '/apps/sourcetree' },
          { text: 'Steam', link: '/apps/steam' },
          { text: 'Story Planner', link: '/apps/story-planner' },
          { text: 'Tally', link: '/apps/tally' },
          { text: 'Telegram', link: '/apps/telegram' },
          { text: 'Terminology', link: '/apps/terminology' },
          { text: 'Termius', link: '/apps/termius' },
          { text: 'Textastic', link: '/apps/textastic' },
          { text: 'TextMate', link: '/apps/textmate' },
          { text: 'Theia', link: '/apps/theia' },
          { text: 'Things', link: '/apps/things' },
          { text: 'Thunder', link: '/apps/thunder' },
          { text: 'Todoist', link: '/apps/todoist' },
          { text: 'Tower', link: '/apps/tower' },
          { text: 'Trae', link: '/apps/trae' },
          { text: 'Trae China', link: '/apps/trae-cn' },
          { text: 'Trello', link: '/apps/trello' },
          { text: 'Ulysses', link: '/apps/ulysses' },
          { text: 'uPic', link: '/apps/upic' },
          { text: 'Verdent', link: '/apps/verdent' },
          { text: 'VS Code', link: '/apps/vscode' },
          { text: 'VS Code Insiders', link: '/apps/vscode-insiders' },
          { text: 'VSCodium', link: '/apps/vscodium' },
          { text: 'WaterMinder', link: '/apps/waterminder' },
          { text: 'Waze', link: '/apps/waze' },
          { text: 'WebStorm', link: '/apps/webstorm' },
          { text: 'WeMeet', link: '/apps/wemeet' },
          { text: 'Where To', link: '/apps/whereto' },
          { text: 'Windsurf', link: '/apps/windsurf' },
          { text: 'Working Copy', link: '/apps/working-copy' },
          { text: 'Xcode', link: '/apps/xcode' },
          { text: 'Zed', link: '/apps/zed' },
        ],
      },
      {
        text: 'Extra',
        items: [{ text: 'Examples', link: '/extra/examples' }],
      },
    ],

    search: {
      provider: 'local',
      // provider: 'algolia',
      // options: {
      //   appId: 'V6CF28P0PS',
      //   apiKey: '692752b7b3c6f794997d8ae22aed79fa',
      //   indexName: 'protocol-launcher',
      //   searchParameters: {
      //     facetFilters: [`tags:${isGithubPages ? 'gh' : 'vercel'}`],
      //   },
      // },
    },
  },
  markdown: {
    config(md) {
      md.use(groupIconMdPlugin)
    },
  },
  vite: {
    server: {
      open: true,
    },
    plugins: [
      tailwindcss(),
      llmstxt({
        ignoreFiles: ['en/index.md', 'zh/index.md', 'CHANGELOG.md', 'AGENTS.md', 'CLAUDE.md'],
        description:
          'TypeScript library for generating Quick Launch (deep link) URLs to trigger app actions with one click, e.g., installing plugins, configuring servers, or setting API keys.',
        sidebar: [
          {
            text: 'Introduction',
            base: '',
            items: [
              { text: 'What is Protocol Launcher?', link: '/guide/what-is-it' },
              { text: 'Getting Started', link: '/guide/getting-started' },
            ],
          },
          {
            text: 'Applications',
            base: '',
            items: [
              { text: 'AFFiNE', link: '/apps/affine' },
              { text: 'Agenda', link: '/apps/agenda' },
              { text: 'Alfred', link: '/apps/alfred' },
              { text: 'Antigravity', link: '/apps/antigravity' },
              { text: 'Anybox', link: '/apps/anybox' },
              { text: 'App Store', link: '/apps/app-store' },
              { text: 'AppFlowy', link: '/apps/appflowy' },
              { text: 'Appigo Todo', link: '/apps/appigo-todo' },
              { text: 'Apple Maps', link: '/apps/apple-map' },
              { text: 'Apple Script Editor', link: '/apps/apple-script' },
              { text: 'Atom', link: '/apps/atom' },
              { text: '1Writer', link: '/apps/1writer' },
              { text: 'BBEdit', link: '/apps/bbedit' },
              { text: 'Bear', link: '/apps/bear' },
              { text: 'Beorg', link: '/apps/beorg' },
              { text: 'BetterTouchTool', link: '/apps/bettertouchtool' },
              { text: 'Bunch', link: '/apps/bunch' },
              { text: 'Cal2Todo', link: '/apps/cal2todo' },
              { text: 'Calca', link: '/apps/calca' },
              { text: 'Capacities', link: '/apps/capacities' },
              { text: 'Cherry Studio', link: '/apps/cherry-studio' },
              { text: 'Coda', link: '/apps/coda' },
              { text: 'CodeBuddy', link: '/apps/code-buddy' },
              { text: 'CodeBuddy China', link: '/apps/code-buddy-cn' },
              { text: 'CodeLite', link: '/apps/codelite' },
              { text: 'CodeRunner', link: '/apps/code-runner' },
              { text: 'CodeHub', link: '/apps/codehub' },
              { text: 'Codex', link: '/apps/codex' },
              { text: 'Craft', link: '/apps/craft' },
              { text: 'Cubox', link: '/apps/cubox' },
              { text: 'Cursor', link: '/apps/cursor' },
              { text: '2Do', link: '/apps/2do' },
              { text: 'Day One', link: '/apps/day-one' },
              { text: 'DEVONthink', link: '/apps/devonthink' },
              { text: 'dict.cc', link: '/apps/dict-cc' },
              { text: 'Drafts', link: '/apps/drafts' },
              { text: 'Editorial', link: '/apps/editorial' },
              { text: 'Equipd Bible', link: '/apps/equipd-bible' },
              { text: 'Due', link: '/apps/due' },
              { text: 'Evernote', link: '/apps/evernote' },
              { text: 'Fantastical', link: '/apps/fantastical' },
              { text: 'FSNotes', link: '/apps/fsnotes' },
              { text: 'Streets', link: '/apps/ftstreets' },
              { text: 'GitHub Desktop', link: '/apps/github-desktop' },
              { text: 'Gladys', link: '/apps/gladys' },
              { text: 'GoodLinks', link: '/apps/goodlinks' },
              { text: 'GoodTask', link: '/apps/goodtask' },
              { text: 'GoLand', link: '/apps/goland' },
              { text: 'Google Maps', link: '/apps/google-maps' },
              { text: 'HBuilderX', link: '/apps/hbuilderx' },
              { text: 'Hammerspoon', link: '/apps/hammerspoon' },
              { text: 'Hookmark', link: '/apps/hookmark' },
              { text: 'iA Writer', link: '/apps/ia-writer' },
              { text: 'iCab Mobile', link: '/apps/icab-mobile' },
              { text: 'IntelliJ IDEA', link: '/apps/idea' },
              { text: 'Instapaper', link: '/apps/instapaper' },
              { text: 'Interact Scratchpad', link: '/apps/interact' },
              { text: 'iPGMail', link: '/apps/ipgmail' },
              { text: 'Itsycal', link: '/apps/itsycal' },
              { text: 'Jump Desktop', link: '/apps/jump-desktop' },
              { text: 'Keyboard Maestro', link: '/apps/keyboard-maestro' },
              { text: 'Kaleidoscope', link: '/apps/kaleidoscope' },
              { text: 'Kiro', link: '/apps/kiro' },
              { text: 'Lingma', link: '/apps/lingma' },
              { text: 'Longshot', link: '/apps/longshot' },
              { text: 'macOS', link: '/apps/macos' },
              { text: 'MacVim', link: '/apps/macvim' },
              { text: 'Mail Assistant', link: '/apps/mail-assistant' },
              { text: 'miCal', link: '/apps/mical' },
              { text: 'Microsoft Edge', link: '/apps/microsoft-edge' },
              { text: 'Microsoft Teams', link: '/apps/microsoft-teams' },
              { text: 'Motrix', link: '/apps/motrix' },
              { text: 'MultiTimer', link: '/apps/multi-timer' },
              { text: 'Navicat', link: '/apps/navicat' },
              { text: 'NotePlan', link: '/apps/noteplan' },
              { text: 'Nozbe', link: '/apps/nozbe' },
              { text: 'Nova', link: '/apps/nova' },
              { text: 'Obsidian', link: '/apps/obsidian' },
              { text: 'OmniFocus', link: '/apps/omnifocus' },
              { text: 'OpenCode', link: '/apps/opencode' },
              { text: 'Opener', link: '/apps/opener' },
              { text: 'Orchids', link: '/apps/orchids' },
              { text: 'Overcast', link: '/apps/overcast' },
              { text: 'PearAI', link: '/apps/pearai' },
              { text: 'Pika', link: '/apps/pika' },
              { text: 'Pleco', link: '/apps/pleco' },
              { text: 'Prizmo', link: '/apps/prizmo' },
              { text: 'PhpStorm', link: '/apps/phpstorm' },
              { text: 'PyCharm', link: '/apps/pycharm' },
              { text: 'Pythonista', link: '/apps/pythonista' },
              { text: 'Pyto', link: '/apps/pyto' },
              { text: 'Qoder', link: '/apps/qoder' },
              { text: 'Quark', link: '/apps/quark' },
              { text: 'Raycast', link: '/apps/raycast' },
              { text: 'RustRover', link: '/apps/rustrover' },
              { text: 'Scriptable', link: '/apps/scriptable' },
              { text: 'Shopi', link: '/apps/shopi' },
              { text: 'Shortcuts', link: '/apps/shortcuts' },
              { text: 'Simple Scan', link: '/apps/simple-scan' },
              { text: 'Sketch', link: '/apps/sketch' },
              { text: 'Slack', link: '/apps/slack' },
              { text: 'Soulver', link: '/apps/soulver' },
              { text: 'SourceTree', link: '/apps/sourcetree' },
              { text: 'Steam', link: '/apps/steam' },
              { text: 'Story Planner', link: '/apps/story-planner' },
              { text: 'Tally', link: '/apps/tally' },
              { text: 'Telegram', link: '/apps/telegram' },
              { text: 'Terminology', link: '/apps/terminology' },
              { text: 'Termius', link: '/apps/termius' },
              { text: 'Textastic', link: '/apps/textastic' },
              { text: 'TextMate', link: '/apps/textmate' },
              { text: 'Theia', link: '/apps/theia' },
              { text: 'Things', link: '/apps/things' },
              { text: 'Thunder', link: '/apps/thunder' },
              { text: 'Todoist', link: '/apps/todoist' },
              { text: 'Tower', link: '/apps/tower' },
              { text: 'Trae', link: '/apps/trae' },
              { text: 'Trae China', link: '/apps/trae-cn' },
              { text: 'Trello', link: '/apps/trello' },
              { text: 'Ulysses', link: '/apps/ulysses' },
              { text: 'uPic', link: '/apps/upic' },
              { text: 'Verdent', link: '/apps/verdent' },
              { text: 'VS Code', link: '/apps/vscode' },
              { text: 'VS Code Insiders', link: '/apps/vscode-insiders' },
              { text: 'VSCodium', link: '/apps/vscodium' },
              { text: 'WaterMinder', link: '/apps/waterminder' },
              { text: 'Waze', link: '/apps/waze' },
              { text: 'WebStorm', link: '/apps/webstorm' },
              { text: 'WeMeet', link: '/apps/wemeet' },
              { text: 'Where To', link: '/apps/whereto' },
              { text: 'Windsurf', link: '/apps/windsurf' },
              { text: 'Working Copy', link: '/apps/working-copy' },
              { text: 'Xcode', link: '/apps/xcode' },
              { text: 'Zed', link: '/apps/zed' },
            ],
          },
          {
            text: '简介',
            base: '',
            items: [
              { text: '什么是 Protocol Launcher？', link: '/zh/guide/what-is-it' },
              { text: '快速开始', link: '/zh/guide/getting-started' },
            ],
          },
          {
            text: '应用程序',
            base: '',
            items: [
              { text: 'AFFiNE', link: '/zh/apps/affine' },
              { text: 'Agenda', link: '/zh/apps/agenda' },
              { text: 'Alfred', link: '/zh/apps/alfred' },
              { text: 'Antigravity', link: '/zh/apps/antigravity' },
              { text: 'Anybox', link: '/zh/apps/anybox' },
              { text: 'App Store', link: '/zh/apps/app-store' },
              { text: 'AppFlowy', link: '/zh/apps/appflowy' },
              { text: 'Appigo Todo', link: '/zh/apps/appigo-todo' },
              { text: 'Apple 地图', link: '/zh/apps/apple-map' },
              { text: 'Apple Script Editor', link: '/zh/apps/apple-script' },
              { text: 'Atom', link: '/zh/apps/atom' },
              { text: '1Writer', link: '/zh/apps/1writer' },
              { text: 'BBEdit', link: '/zh/apps/bbedit' },
              { text: 'Bear', link: '/zh/apps/bear' },
              { text: 'Beorg', link: '/zh/apps/beorg' },
              { text: 'BetterTouchTool', link: '/zh/apps/bettertouchtool' },
              { text: 'Bunch', link: '/zh/apps/bunch' },
              { text: 'Cal2Todo', link: '/zh/apps/cal2todo' },
              { text: 'Calca', link: '/zh/apps/calca' },
              { text: 'Capacities', link: '/zh/apps/capacities' },
              { text: 'Cherry Studio', link: '/zh/apps/cherry-studio' },
              { text: 'Coda', link: '/zh/apps/coda' },
              { text: 'CodeBuddy', link: '/zh/apps/code-buddy' },
              { text: 'CodeBuddy China', link: '/zh/apps/code-buddy-cn' },
              { text: 'CodeLite', link: '/zh/apps/codelite' },
              { text: 'CodeRunner', link: '/zh/apps/code-runner' },
              { text: 'CodeHub', link: '/zh/apps/codehub' },
              { text: 'Codex', link: '/zh/apps/codex' },
              { text: 'Craft', link: '/zh/apps/craft' },
              { text: 'Cubox', link: '/zh/apps/cubox' },
              { text: 'Cursor', link: '/zh/apps/cursor' },
              { text: '2Do', link: '/zh/apps/2do' },
              { text: 'Day One', link: '/zh/apps/day-one' },
              { text: 'DEVONthink', link: '/zh/apps/devonthink' },
              { text: 'dict.cc', link: '/zh/apps/dict-cc' },
              { text: 'Drafts', link: '/zh/apps/drafts' },
              { text: 'Editorial', link: '/zh/apps/editorial' },
              { text: 'Equipd Bible', link: '/zh/apps/equipd-bible' },
              { text: 'Due', link: '/zh/apps/due' },
              { text: 'Evernote', link: '/zh/apps/evernote' },
              { text: 'Fantastical', link: '/zh/apps/fantastical' },
              { text: 'FSNotes', link: '/zh/apps/fsnotes' },
              { text: 'Streets', link: '/zh/apps/ftstreets' },
              { text: 'GitHub Desktop', link: '/zh/apps/github-desktop' },
              { text: 'Gladys', link: '/zh/apps/gladys' },
              { text: 'GoodLinks', link: '/zh/apps/goodlinks' },
              { text: 'GoodTask', link: '/zh/apps/goodtask' },
              { text: 'GoLand', link: '/zh/apps/goland' },
              { text: 'Google Maps', link: '/zh/apps/google-maps' },
              { text: 'HBuilderX', link: '/zh/apps/hbuilderx' },
              { text: 'Hammerspoon', link: '/zh/apps/hammerspoon' },
              { text: 'Hookmark', link: '/zh/apps/hookmark' },
              { text: 'iA Writer', link: '/zh/apps/ia-writer' },
              { text: 'iCab Mobile', link: '/zh/apps/icab-mobile' },
              { text: 'IntelliJ IDEA', link: '/zh/apps/idea' },
              { text: 'Instapaper', link: '/zh/apps/instapaper' },
              { text: 'Interact Scratchpad', link: '/zh/apps/interact' },
              { text: 'iPGMail', link: '/zh/apps/ipgmail' },
              { text: 'Itsycal', link: '/zh/apps/itsycal' },
              { text: 'Jump Desktop', link: '/zh/apps/jump-desktop' },
              { text: 'Keyboard Maestro', link: '/zh/apps/keyboard-maestro' },
              { text: 'Kaleidoscope', link: '/zh/apps/kaleidoscope' },
              { text: 'Kiro', link: '/zh/apps/kiro' },
              { text: 'Lingma', link: '/zh/apps/lingma' },
              { text: 'Longshot', link: '/zh/apps/longshot' },
              { text: 'macOS', link: '/zh/apps/macos' },
              { text: 'MacVim', link: '/zh/apps/macvim' },
              { text: 'Mail Assistant', link: '/zh/apps/mail-assistant' },
              { text: 'miCal', link: '/zh/apps/mical' },
              { text: 'Microsoft Edge', link: '/zh/apps/microsoft-edge' },
              { text: 'Microsoft Teams', link: '/zh/apps/microsoft-teams' },
              { text: 'Motrix', link: '/zh/apps/motrix' },
              { text: 'MultiTimer', link: '/zh/apps/multi-timer' },
              { text: 'Navicat', link: '/zh/apps/navicat' },
              { text: 'NotePlan', link: '/zh/apps/noteplan' },
              { text: 'Nozbe', link: '/zh/apps/nozbe' },
              { text: 'Nova', link: '/zh/apps/nova' },
              { text: 'Obsidian', link: '/zh/apps/obsidian' },
              { text: 'OmniFocus', link: '/zh/apps/omnifocus' },
              { text: 'OpenCode', link: '/zh/apps/opencode' },
              { text: 'Opener', link: '/zh/apps/opener' },
              { text: 'Orchids', link: '/zh/apps/orchids' },
              { text: 'Overcast', link: '/zh/apps/overcast' },
              { text: 'PearAI', link: '/zh/apps/pearai' },
              { text: 'Pika', link: '/zh/apps/pika' },
              { text: 'Pleco', link: '/zh/apps/pleco' },
              { text: 'Prizmo', link: '/zh/apps/prizmo' },
              { text: 'PhpStorm', link: '/zh/apps/phpstorm' },
              { text: 'PyCharm', link: '/zh/apps/pycharm' },
              { text: 'Pythonista', link: '/zh/apps/pythonista' },
              { text: 'Pyto', link: '/zh/apps/pyto' },
              { text: 'Qoder', link: '/zh/apps/qoder' },
              { text: 'Quark', link: '/zh/apps/quark' },
              { text: 'Raycast', link: '/zh/apps/raycast' },
              { text: 'RustRover', link: '/zh/apps/rustrover' },
              { text: 'Scriptable', link: '/zh/apps/scriptable' },
              { text: 'Shopi', link: '/zh/apps/shopi' },
              { text: 'Shortcuts', link: '/zh/apps/shortcuts' },
              { text: 'Simple Scan', link: '/zh/apps/simple-scan' },
              { text: 'Sketch', link: '/zh/apps/sketch' },
              { text: 'Slack', link: '/zh/apps/slack' },
              { text: 'Soulver', link: '/zh/apps/soulver' },
              { text: 'SourceTree', link: '/zh/apps/sourcetree' },
              { text: 'Steam', link: '/zh/apps/steam' },
              { text: 'Story Planner', link: '/zh/apps/story-planner' },
              { text: 'Tally', link: '/zh/apps/tally' },
              { text: 'Telegram', link: '/zh/apps/telegram' },
              { text: 'Terminology', link: '/zh/apps/terminology' },
              { text: 'Termius', link: '/zh/apps/termius' },
              { text: 'Textastic', link: '/zh/apps/textastic' },
              { text: 'TextMate', link: '/zh/apps/textmate' },
              { text: 'Theia', link: '/zh/apps/theia' },
              { text: 'Things', link: '/zh/apps/things' },
              { text: 'Thunder', link: '/zh/apps/thunder' },
              { text: 'Todoist', link: '/zh/apps/todoist' },
              { text: 'Tower', link: '/zh/apps/tower' },
              { text: 'Trae', link: '/zh/apps/trae' },
              { text: 'Trae China', link: '/zh/apps/trae-cn' },
              { text: 'Trello', link: '/zh/apps/trello' },
              { text: 'Ulysses', link: '/zh/apps/ulysses' },
              { text: 'uPic', link: '/zh/apps/upic' },
              { text: 'Verdent', link: '/zh/apps/verdent' },
              { text: 'VS Code', link: '/zh/apps/vscode' },
              { text: 'VS Code Insiders', link: '/zh/apps/vscode-insiders' },
              { text: 'VSCodium', link: '/zh/apps/vscodium' },
              { text: 'WaterMinder', link: '/zh/apps/waterminder' },
              { text: 'Waze', link: '/zh/apps/waze' },
              { text: 'WebStorm', link: '/zh/apps/webstorm' },
              { text: 'WeMeet', link: '/zh/apps/wemeet' },
              { text: 'Where To', link: '/zh/apps/whereto' },
              { text: 'Windsurf', link: '/zh/apps/windsurf' },
              { text: 'Working Copy', link: '/zh/apps/working-copy' },
              { text: 'Xcode', link: '/zh/apps/xcode' },
              { text: 'Zed', link: '/zh/apps/zed' },
            ],
          },
          {
            text: '扩展',
            base: '',
            items: [{ text: '示例', link: '/zh/extra/examples' }],
          },
        ],
        details: `\
- 🛡️ Type-Safe
- 🧩 Multi-App Ready
- 🔬 On-Demand / Tree-shakable
- 🔐 Secure Encoding (safe configs, Unicode)
- ⚙️ Zero Runtime Dependencies
- 📦 ESM First
- 🚀 One-click deep links to trigger app actions
`,
      }),
      // https://icon-sets.iconify.design/logos/?keyword=logos
      // https://icon-sets.iconify.design/vscode-icons/?keyword=vscode-icons
      groupIconVitePlugin({
        customIcon: {
          'cherry studio': localIconLoader(import.meta.url, '../assets/cherry-studio.svg'),
          codebuddy: localIconLoader(import.meta.url, '../assets/codebuddy.svg'),
          cursor: localIconLoader(import.meta.url, '../assets/cursor.svg'),
          'github desktop': 'logos:github-octocat',
          goland: 'logos:goland',
          idea: 'logos:intellij-idea',
          phpstorm: 'logos:phpstorm',
          pycharm: 'logos:pycharm',
          rustrover: 'logos:rust',
          telegram: 'logos:telegram',
          thunder: localIconLoader(import.meta.url, '../assets/thunder.svg'),
          vscode: 'vscode-icons:file-type-vscode',
          webstorm: 'logos:webstorm',
          xcode: 'logos:xcode',
        },
      }),
    ],
  },
})
