{"version":3,"file":"settingsSections.mjs","names":[],"sources":["../../../src/web/lib/settingsSections.ts"],"sourcesContent":["import { t, type SettingsSectionContribution } from '@agimon-ai/po-core/web';\n\nimport { isHostId, qualifyHostId, splitHostId } from './hostIdentity';\nimport { curatedLayerOf } from './pluginMarketplaceApi';\nimport {\n  installedWebPlugins,\n  pluginRepositorySettingsPanels,\n  pluginSettingsPanels,\n  pluginSettingsSections,\n  webPluginRegistryForHost,\n  type InstalledRepositorySettingsPanel,\n  type InstalledSettingsPanel,\n} from './pluginRegistry';\n\n/**\n * The settings menu, as data: the rail's gear and the settings page both\n * need to name a section, and neither feature may import the other.\n *\n * The host's own pages come first and keep fixed positions, because they\n * are about the cockpit itself rather than about a package. Contributed pages\n * sort after them, by their declared order and then their id, so the menu is\n * stable across syncs whatever order plugins install in.\n */\nexport type SettingsWorkspace = 'general' | 'repository';\n\nexport interface SettingsSection {\n  id: string;\n  label: string;\n  detail: string;\n  /** A contributed page's own menu mark; host pages take theirs from the menu. */\n  icon?: SettingsSectionContribution['icon'];\n  workspace: SettingsWorkspace;\n  hostId?: string;\n  readOnly?: boolean;\n  /** The fields a contributed page renders; absent on the host's own pages. */\n  contribution?: SettingsSectionContribution;\n  /** Package panel hosted inside the repository workspace. */\n  repositoryPanel?: InstalledRepositorySettingsPanel;\n  /** A page the contributing package draws itself, rather than fields the host renders. */\n  panel?: InstalledSettingsPanel;\n  /** The curated layer whose Plugins page now holds this page; Settings leaves it out. */\n  movedTo?: string;\n}\n\n/**\n * A curated plugin's settings live on its own Plugins page, on this computer. Another computer's\n * pages stay in Settings: the Plugins page reads this computer's catalog only.\n */\nfunction movedTo(pluginId: string, hostId: string | undefined): string | undefined {\n  if (hostId !== undefined) return undefined;\n  const local = splitHostId(pluginId)?.localId ?? pluginId;\n  const plugin = installedWebPlugins().find((entry) => (splitHostId(entry.id)?.localId ?? entry.id) === local);\n  return curatedLayerOf(plugin?.packageName);\n}\n\n// These built-in sections belong to each host, not to the browser origin. Built per call so the\n// labels follow the current language.\nfunction generalSettingsSections(): readonly SettingsSection[] {\n  return [\n    {\n      id: 'providers',\n      label: t('webDashboard.settings.section.providers.label', 'providers'),\n      detail: t('webDashboard.settings.section.providers.detail', 'sign in to the model providers Pi can use'),\n      workspace: 'general',\n    },\n    {\n      id: 'devices',\n      label: t('webDashboard.settings.section.devices.label', 'devices'),\n      detail: t('webDashboard.settings.section.devices.detail', 'name this device and recognise where voice is active'),\n      workspace: 'general',\n    },\n    {\n      id: 'appearance',\n      label: t('webDashboard.settings.section.appearance.label', 'appearance'),\n      detail: t('webDashboard.settings.section.appearance.detail', 'pick the theme the cockpit renders with'),\n      workspace: 'general',\n    },\n    {\n      id: 'notifications',\n      label: t('webDashboard.settings.section.notifications.label', 'notifications'),\n      detail: t(\n        'webDashboard.settings.section.notifications.detail',\n        'allow live session notifications in this browser',\n      ),\n      workspace: 'general',\n    },\n    {\n      id: 'images',\n      label: t('webDashboard.settings.section.images.label', 'images'),\n      detail: t('webDashboard.settings.section.images.detail', 'how large an image may be when it reaches a model'),\n      workspace: 'general',\n    },\n    {\n      id: 'presets',\n      label: t('webDashboard.settings.section.presets.label', 'presets'),\n      detail: t(\n        'webDashboard.settings.section.presets.detail',\n        'the presets a session can start with, and the default',\n      ),\n      workspace: 'general',\n    },\n  ];\n}\n\n/** The host's account page: Sign in with Po where the host offers it, and account-wide preferences. */\nexport const ACCOUNT_SETTINGS_SECTION = 'account-preferences';\n\n/** Account-wide preferences, separate from the supplying hosts' configuration. */\nfunction accountSection(): SettingsSection {\n  return {\n    id: ACCOUNT_SETTINGS_SECTION,\n    label: t('webDashboard.settings.section.global.label', 'Global'),\n    detail: t('webDashboard.settings.section.global.detail', 'account preferences shared across hosts'),\n    workspace: 'general',\n  };\n}\n/** Signing out of the signed-in shell: about the person's account, so it sits beside Global, not under a host. */\nconst SIGN_OUT_SECTION_ID = 'account';\nfunction signOutSection(): SettingsSection {\n  return {\n    id: SIGN_OUT_SECTION_ID,\n    label: t('webDashboard.settings.section.account.label', 'account'),\n    detail: t('webDashboard.settings.section.account.detail', 'signing out of this browser'),\n    workspace: 'general',\n  };\n}\n/** Pages about the person rather than a host, grouped together after the hosts. */\nconst PERSON_SECTION_IDS: ReadonlySet<string> = new Set([SIGN_OUT_SECTION_ID, ACCOUNT_SETTINGS_SECTION]);\n/** This host's person pages, including a package page that asks to sit under Global. */\nconst isPersonSection = (section: SettingsSection) =>\n  PERSON_SECTION_IDS.has(section.id) || section.panel?.menuGroup === 'global';\nconst REPOSITORY_DEFAULTS_SECTION_ID = 'repositories';\nfunction repositoryDefaultsSection(): SettingsSection {\n  return {\n    id: REPOSITORY_DEFAULTS_SECTION_ID,\n    label: t('webDashboard.settings.section.repositories.label', 'defaults'),\n    detail: t('webDashboard.settings.section.repositories.detail', 'mode, domains, and profile'),\n    workspace: 'repository',\n  };\n}\n\n/** The cockpit's process-local connection table, never a supplying host's configuration. */\nfunction hostsSection(): SettingsSection {\n  return {\n    id: 'hosts',\n    label: t('webDashboard.settings.section.hosts.label', 'hosts'),\n    detail: t('webDashboard.settings.section.hosts.detail', 'connect this app to another host'),\n    workspace: 'general',\n  };\n}\nconst DEFAULT_CONTRIBUTED_ORDER = 1000;\n\n/** Repository-workspace copies need their own route id, since the id is the route param. */\nconst REPOSITORY_SECTION_PREFIX = 'repository-';\n\nexport const DEFAULT_SETTINGS_SECTION = 'providers';\nexport const DEFAULT_REPOSITORY_SETTINGS_SECTION = REPOSITORY_DEFAULTS_SECTION_ID;\n\n/** A language pack can rename a plugin's settings page; the plugin's own label is the English. */\nfunction contributedLabel(contribution: { pluginId: string; id: string; label: string }): string {\n  const pluginId = splitHostId(contribution.pluginId)?.localId ?? contribution.pluginId;\n  return t(`plugin.${pluginId}.settingsSections.${contribution.id}.label`, contribution.label);\n}\n\ninterface MenuOrdered {\n  id: string;\n  order?: number;\n}\n\nfunction byMenuOrder(left: MenuOrdered, right: MenuOrdered): number {\n  return (\n    (left.order ?? DEFAULT_CONTRIBUTED_ORDER) - (right.order ?? DEFAULT_CONTRIBUTED_ORDER) ||\n    left.id.localeCompare(right.id)\n  );\n}\n\n/**\n * Every page the menu offers. Read through a function rather than held in a\n * const: plugins install before the first render, but a module-level array\n * evaluated at import time would freeze the list before that happened.\n */\nexport function settingsSections(\n  workspace?: SettingsWorkspace,\n  options: { hostId?: string; isSignedInWorkerOrigin?: boolean; includeMoved?: boolean; canManageHosts?: boolean } = {},\n): readonly SettingsSection[] {\n  const registry = options.hostId === undefined ? undefined : webPluginRegistryForHost(options.hostId);\n  const contributions = [...(registry?.pluginSettingsSections() ?? pluginSettingsSections())].sort(byMenuOrder);\n  // The same page is offered in both workspaces. Scope comes from the workspace\n  // the reader is in, so the general copy edits the host file and the\n  // repository copy edits whichever repository the workspace picker holds.\n  const moved = (pluginId: string) => {\n    const layer = movedTo(pluginId, options.hostId);\n    return layer === undefined ? {} : { movedTo: layer };\n  };\n  const contributed = contributions.map((contribution) => ({\n    id: contribution.id,\n    label: contributedLabel(contribution),\n    detail: contribution.detail,\n    icon: contribution.icon,\n    workspace: 'general' as const,\n    contribution,\n    ...moved(contribution.pluginId),\n  }));\n  const contributedForRepository = [\n    ...(registry?.pluginSettingsSections('workspace') ?? pluginSettingsSections('workspace')),\n  ]\n    .sort(byMenuOrder)\n    .map((contribution) => ({\n      id: `${REPOSITORY_SECTION_PREFIX}${contribution.id}`,\n      label: contributedLabel(contribution),\n      detail: contribution.detail,\n      icon: contribution.icon,\n      workspace: 'repository' as const,\n      contribution,\n      ...moved(contribution.pluginId),\n    }));\n  // A self-drawn page has no scope to switch: it reports rather than writes,\n  // so it appears once, in the general workspace, and not as a repository copy.\n  const panels = [...(registry?.pluginSettingsPanels() ?? pluginSettingsPanels())].sort(byMenuOrder).map((panel) => ({\n    id: panel.id,\n    label: t(\n      `plugin.${splitHostId(panel.pluginId)?.localId ?? panel.pluginId}.settingsPanels.${panel.id}.label`,\n      panel.label,\n    ),\n    detail: t(\n      `plugin.${splitHostId(panel.pluginId)?.localId ?? panel.pluginId}.settingsPanels.${panel.id}.detail`,\n      panel.detail,\n    ),\n    icon: panel.icon,\n    workspace: 'general' as const,\n    panel,\n    ...moved(panel.pluginId),\n  }));\n  const repositoryPanels = (registry?.pluginRepositorySettingsPanels() ?? pluginRepositorySettingsPanels()).map(\n    (repositoryPanel) => ({\n      id: `${REPOSITORY_SECTION_PREFIX}${repositoryPanel.pluginId}`,\n      label: t(\n        `plugin.${splitHostId(repositoryPanel.pluginId)?.localId ?? repositoryPanel.pluginId}.repositorySettings.panel.label`,\n        repositoryPanel.label,\n      ),\n      detail: t(\n        `plugin.${splitHostId(repositoryPanel.pluginId)?.localId ?? repositoryPanel.pluginId}.repositorySettings.panel.detail`,\n        repositoryPanel.detail,\n      ),\n      icon: repositoryPanel.icon,\n      workspace: 'repository' as const,\n      repositoryPanel,\n      ...moved(repositoryPanel.pluginId),\n    }),\n  );\n  const all = [\n    ...generalSettingsSections(),\n    ...contributed,\n    ...panels,\n    repositoryDefaultsSection(),\n    ...repositoryPanels,\n    ...contributedForRepository,\n  ];\n  const hostSections = all.map((section) =>\n    options.hostId === undefined\n      ? section\n      : {\n          ...section,\n          id: qualifyHostId(options.hostId, section.id),\n          hostId: options.hostId,\n        },\n  );\n  const account = { ...accountSection(), readOnly: options.isSignedInWorkerOrigin !== true };\n  const signOutSections =\n    options.hostId === undefined && options.isSignedInWorkerOrigin === true ? [signOutSection()] : [];\n  const localSections = options.hostId === undefined && options.canManageHosts === true ? [hostsSection()] : [];\n  const sections = [...hostSections, ...localSections, ...signOutSections, account].filter(\n    (section) => options.includeMoved === true || !('movedTo' in section),\n  );\n  return workspace === undefined ? sections : sections.filter((section) => section.workspace === workspace);\n}\n\nexport interface SettingsSectionGroup {\n  id: string;\n  label: string;\n  sections: readonly SettingsSection[];\n}\n\n/** The origin capability is supplied by the signed-in shell, never inferred from a hostname. */\nexport function settingsSectionGroups(\n  hosts: readonly { id: string; name: string }[],\n  isSignedInWorkerOrigin: boolean,\n  workspace: SettingsWorkspace = 'general',\n  options: { canManageHosts?: boolean } = {},\n): readonly SettingsSectionGroup[] {\n  const personSections = settingsSections(workspace, { isSignedInWorkerOrigin }).filter(isPersonSection);\n  const localSections = workspace === 'general' && options.canManageHosts === true ? [hostsSection()] : [];\n  return [\n    ...hosts.map((host) => {\n      // 'local' is this shell's own host. A key that is not a canonical host id (an unpaired\n      // cockpit host) has no settings this shell can address, so its group carries no links.\n      const local = host.id === 'local';\n      return {\n        id: host.id,\n        label: host.name,\n        sections:\n          local || isHostId(host.id)\n            ? settingsSections(workspace, local ? { isSignedInWorkerOrigin } : { hostId: host.id }).filter(\n                // Another host's person page stays with that host: Global shows this host's.\n                (section) => !(local ? isPersonSection(section) : PERSON_SECTION_IDS.has(section.id)),\n              )\n            : [],\n      };\n    }),\n    ...(localSections.length === 0\n      ? []\n      : [{ id: 'cockpit', label: t('webDashboard.settings.menu.thisApp', 'This app'), sections: localSections }]),\n    ...(personSections.length === 0\n      ? []\n      : [\n          {\n            id: ACCOUNT_SETTINGS_SECTION,\n            label: t('webDashboard.settings.section.global.label', 'Global'),\n            sections: personSections,\n          },\n        ]),\n  ];\n}\n\nexport function settingsSection(\n  id: string | undefined,\n  isSignedInWorkerOrigin = false,\n  options: { canManageHosts?: boolean } = {},\n): SettingsSection | undefined {\n  const host = id === undefined ? undefined : splitHostId(id);\n  return settingsSections(undefined, {\n    ...(host === undefined ? {} : { hostId: host.hostId }),\n    isSignedInWorkerOrigin,\n    canManageHosts: options.canManageHosts,\n  }).find((section) => section.id === id);\n}\n\n/** Where an old `/settings/<id>` link for a page that moved to its plugin now points: the layer id. */\nexport function movedSettingsLayer(id: string | undefined): string | undefined {\n  if (id === undefined || splitHostId(id) !== undefined) return undefined;\n  return settingsSections(undefined, { includeMoved: true }).find((section) => section.id === id)?.movedTo;\n}\n"],"mappings":";;;;;;;;;AAgDA,SAAS,QAAQ,UAAkB,QAAgD;CACjF,IAAI,WAAW,KAAA,GAAW,OAAO,KAAA;CACjC,MAAM,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