@sparkelf/dsh-bot-agent 0.0.0-stage → 0.2.9-alpha.127

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,34 @@
1
+ # Bilingual-pair consistency record for README.md (docs/i18n/README.md): per heading
2
+ # section, a hash of its English and Chinese blocks outside code blocks and generated regions.
3
+ # After editing either side, bring the other along and re-record with:
4
+ # pnpm run verify-translation-pairing --write packages/plus/bot-agent/README.md
5
+ /:
6
+ en: 6ae25932a99f7244
7
+ zh: 25a1abae292f8f3b
8
+ /sparkelf-dsh-bot-agent:
9
+ en: 26dd52e87fb3dbca
10
+ zh: 62615893ad0abe35
11
+ /sparkelf-dsh-bot-agent/summary:
12
+ en: 97f5ace13d93303b
13
+ zh: 985a74bbe09b9ed4
14
+ /sparkelf-dsh-bot-agent/what-it-does:
15
+ en: 31f054867c7f7e20
16
+ zh: 98d502fd843c9ec4
17
+ /sparkelf-dsh-bot-agent/table-of-contents:
18
+ en: 40668d0fe9b36282
19
+ zh: 8eb1562d738786ab
20
+ /sparkelf-dsh-bot-agent/design:
21
+ en: 82dab6bcc8b22496
22
+ zh: 7b56de3420cb20ec
23
+ /sparkelf-dsh-bot-agent/install:
24
+ en: 871e7b6517154e39
25
+ zh: baa8e0a4de6e13b6
26
+ /sparkelf-dsh-bot-agent/model-experience:
27
+ en: 7d8ef6b68ed58334
28
+ zh: 00e3d8daf3af8a5e
29
+ /sparkelf-dsh-bot-agent/model-experience/kv-cache-effect:
30
+ en: 54c819c1b71c5220
31
+ zh: fa6d9b105da1d293
32
+ /sparkelf-dsh-bot-agent/known-limitations-and-deferred-work:
33
+ en: cf2224b504ba3923
34
+ zh: 5e6976780265b3bb
package/README.md CHANGED
@@ -1,3 +1,69 @@
1
- # Temporary Holding Version
1
+ ---
2
+ description: "Agent (bot) management: durable bot entities, a built-in super assistant, per-bot agent presets, a sidebar Agents page, and the session-row avatar."
3
+ kind: "package-reference"
4
+ ---
2
5
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
6
+ # @sparkelf/dsh-bot-agent
7
+
8
+ English | [中文](README.zh.md)
9
+
10
+ ## Summary
11
+
12
+ Agent (bot) management for the dsh Web client: a sidebar "Agents" destination with grid cards and a detail form, durable bot entities over `storage-domain`, a built-in super assistant, and one agent preset per bot that binds a session's composition and avatar.
13
+
14
+ ## What it does
15
+
16
+ - **Bot entity**: `{id, name, avatar, preset{identity, duties, workStyle, replyStyle}, retrievalSummary, kbScope, skillPolicy, toolPolicy, createdAt, builtin}` stored in the `agents` domain's `bots` table, validated by a zod schema at the durable boundary.
17
+ - **Built-in super assistant**: seeded once, marked `builtin`, configurable but never deletable.
18
+ - **Sidebar Agents page**: registered through the official `sidebar.panellist` slot and the keyed `main` page slot. A grid of cards (avatar, name, duty summary) opens a detail form editing name, avatar, the four persona fields, and the retrieval summary.
19
+ - **Per-bot preset**: each bot registers an agent preset whose composition is the deployment's base preset with the persona prefix replaced by the bot's prose. A new session binds a bot by running its preset; the durable `agentPreset` header records the bot id, so the binding survives resume without a session-format change.
20
+ - **Session-row avatar**: the client registers the `sidebar.session.row.avatar` seat declared by `ui-workspace`. A session whose preset names a bot draws that bot's avatar in the leading cell; live status renders as a bottom-right badge over the avatar rather than replacing it.
21
+ - **Subagent catalog avatar**: the same occupant serves the `subagent.catalog.row.avatar` seat declared by `ui-subagent`. A tool-spawned subagent (its catalog entry carries a source tool call) running a bot preset draws that bot's avatar beside its activity badge in the Session panel's subagent list.
22
+ - **Task→bot routing**: the host half answers the `subagent/preset-proposal` waterfall that `dsh-tool-subagent` emits for a delegation naming no preset. It matches the task text against each custom bot's `retrievalSummary` (token coverage over ASCII words and CJK bigrams) and proposes the best-covering bot whose preset registered. The built-in is excluded; no match inherits the parent's composition.
23
+ - **Policy enforcement**: a bot's `toolPolicy` masks the inherited tool surface on every agent that runs its preset (`tools.restrict`), so a denied tool is neither visible nor callable and an allow-list keeps only its named tools. Its `kbScope` guards the knowledge-base file tools' paths at execution (`tools.guard`). Its `skillPolicy` rides the composition's `tool-skill` row (`excludedSkills` for deny, `includedSkills` for allow). Enforcement applies at agent creation, so a live session keeps the policy it composed from.
24
+ - **`@bot` dispatch**: the client registers an `@` trigger source over the shared bot list. Picking a bot — or typing `@name` and submitting — claims the token and routes the message to a session running that bot's preset (the workspace's reusable blank under the preset, or a new one), then opens it. The built-in super assistant is offered like any other bot.
25
+ - **Avatars**: a self-written SVG catalog (hue + glyph per key), offline-safe with no external image dependency.
26
+
27
+ ## Table of Contents
28
+
29
+ - [What it does](#what-it-does)
30
+ - [Design](#design)
31
+ - [Install](#install)
32
+ - [Model Experience](#model-experience)
33
+ - [Known Limitations and Deferred Work](#known-limitations-and-deferred-work)
34
+
35
+ -----
36
+
37
+ ## Design
38
+
39
+ The host half opens the `agents` domain through `ctx.storageDomain`, seeds the built-in, registers one preset per bot through `ctx.agentPresets.register`, and serves the `/bot-agent/api` CRUD family through `ctx.webServer`. The preset composition is read from the base preset's document (`readDocument`) and parsed in the Loader's own YAML dialect (`parseEntryYaml`), so `!!js` rows and groups round-trip losslessly; only the persona row's prefix is replaced. This is the registry's "duplicate, then edit" authoring path. Preset registration polls for the base declaration rather than awaiting the Loader, so it never deadlocks this plugin's activation.
40
+
41
+ The client half shares one bot store between the management page and every avatar row, so a created or edited bot reaches the session list without a second fetch. New sessions reuse the existing preset navigation (`uiWorkspace.startSession` with `agentPreset`), and bot presets also appear in the official new-session preset chip.
42
+
43
+ Routing lives in `routing.ts`: `matchBotPreset` scores each candidate bot by the fraction of its `retrievalSummary` tokens present in the task, and the host listener offers only non-built-in bots whose preset registration succeeded, so a proposal always names a mountable preset. The minimum coverage is the `routingMinCoverage` config field (default `0.3`).
44
+
45
+ Policy enforcement lives in `policy.ts` and reuses the harness's scoped tool seams rather than a new mechanism. On `agent/created`, the host half reads the agent's composed preset, looks up that bot, and applies `tools.restrict` (the `toolPolicy` mask) and `tools.guard` (the `kbScope` path check) on the agent's own scope; both lift when the agent disposes. `skillPolicy` is composed into the `tool-skill` row by `buildBotPreset`. The `@bot` source (`client/mention.ts`) claims the picked bot's token and dispatches through `uiWorkspace.connectWorkspace` under the bot's preset, then `session.prompt` and `openSession`.
46
+
47
+ Every colour, border, and label weight comes from the shared alias tokens (`--dsw-alias-*`). The avatar tile follows the Plus design reference: 14px-class radius, a hairline, and a top highlight.
48
+
49
+ ## Install
50
+
51
+ The host half mounts through the Plus bundle's `plus-bot-agent` row; the client half is declared by `dsh.client` and loaded by the Web shell. The session-row avatar seat is declared by `ui-workspace`, so shipping the avatar to a release built from published base artifacts requires the corresponding base-client patch.
52
+
53
+ ## Model Experience
54
+
55
+ A bot's preset contributes the `deployment:persona-prefix` system section: the bot's identity, then labelled `Duties`, `Work style`, and `Reply style` sections for the non-empty fields. An empty identity keeps the base composition's own prefix. The preset carries the base composition's prompt sections unchanged; a narrowing `toolPolicy` or `skillPolicy` removes the masked tools or skills from the model's surface, and `kbScope` denies out-of-scope knowledge file calls at execution.
56
+
57
+ #### KV Cache effect
58
+
59
+ The persona prefix is part of the system prompt's cacheable prefix. Editing a bot re-registers its preset; a live session keeps the revision it composed from, and only sessions created after the edit see the new prefix, so an edit never invalidates a running session's cache.
60
+
61
+ ## Known Limitations and Deferred Work
62
+
63
+ No runtime invariant companion is published: the package's durable state is the `agents` domain, and the storage, route, and real-composition tests observe every read and write directly.
64
+
65
+ - **Knowledge scope guards explicit paths only**: `kbScope` denies the knowledge-base file tools (`kb_file_write`/`move`/`delete`/`mkdir`/`extract`) whose path falls outside the scope, and refuses a whole-tree extract under a narrowed scope. Query-based reads (`kb_search`, `kb_chunk_get`, `kb_outline`) carry no path to scope here, and scope-alias normalization stays with the knowledge-base plugin; hit-level filtering needs a per-agent scope seam in that plugin.
66
+ - **The built-in is excluded from routing**: retrieval-summary routing never proposes the super assistant; explicit `@bot` dispatch offers it like any other bot.
67
+ - **The binding rides `agentPreset`**: there is no separate `agentId` header field; the bot id is the preset id, and the avatar derives from it.
68
+ - **Avatars are catalog keys**: custom image upload is not yet offered.
69
+ - **The avatar seats need the base client change**: `ui-workspace` declares `sidebar.session.row.avatar` and `ui-subagent` declares `subagent.catalog.row.avatar`, each with its badge layout; a release consuming published base artifacts needs those patches to render the avatars.
package/README.zh.md ADDED
@@ -0,0 +1,69 @@
1
+ ---
2
+ description: "智能体(bot)管理:持久 bot 实体、内置超级助手、每 bot 一个 agent preset、侧边栏智能体页与会话行头像。"
3
+ kind: "package-reference"
4
+ ---
5
+
6
+ # @sparkelf/dsh-bot-agent
7
+
8
+ [English](README.md) | 中文
9
+
10
+ ## 概述
11
+
12
+ 面向 dsh Web 客户端的智能体(bot)管理:侧边栏「智能体」入口(网格卡片 + 详情表单)、基于 `storage-domain` 的持久 bot 实体、内置超级助手,以及每 bot 一个 agent preset,用于绑定会话的组成与头像。
13
+
14
+ ## 功能
15
+
16
+ - **bot 实体**:`{id, name, avatar, preset{identity, duties, workStyle, replyStyle}, retrievalSummary, kbScope, skillPolicy, toolPolicy, createdAt, builtin}`,存于 `agents` 域的 `bots` 表,在持久边界由 zod schema 校验。
17
+ - **内置超级助手**:仅 seeded 一次,标记 `builtin`,可配置但不可删除。
18
+ - **侧边栏智能体页**:通过官方 `sidebar.panellist` slot 与 keyed `main` 页 slot 注册。网格卡片(头像、名字、职责摘要)打开详情表单,编辑名字、头像、四个预设字段与检索摘要。
19
+ - **每 bot 一个 preset**:每个 bot 注册一个 agent preset,其组成为部署的基础 preset 替换 persona prefix 为该 bot 的文本。新建会话通过运行其 preset 绑定 bot;持久 `agentPreset` header 记录 bot id,绑定因此跨 resume 保留,无需改动会话格式。
20
+ - **会话行头像**:客户端注册 `ui-workspace` 声明的 `sidebar.session.row.avatar` seat。preset 命名了某 bot 的会话在 leading cell 绘制该 bot 头像;运行态以右下角 badge 叠加在头像上,而非替换头像。
21
+ - **子代理目录头像**:同一 occupant 也服务 `ui-subagent` 声明的 `subagent.catalog.row.avatar` seat。工具 spawn 的子代理(其 catalog 条目携带 source tool call)若运行某 bot preset,会在会话面板子代理列表中于活动 badge 旁绘制该 bot 头像。
22
+ - **任务→bot 路由**:host 半应答 `dsh-tool-subagent` 对未命名 preset 的派单所发出的 `subagent/preset-proposal` waterfall。它以任务文本匹配每个自定义 bot 的 `retrievalSummary`(ASCII 词与 CJK 二元组的 token 覆盖率),提议覆盖率最高且 preset 已注册的 bot。内置 bot 被排除;无匹配则继承父级组成。
23
+ - **策略生效**:bot 的 `toolPolicy` 对每个运行其 preset 的 agent 遮蔽继承工具面(`tools.restrict`),被拒工具既不可见也不可调,allow 名单仅保留其命名工具。`kbScope` 在执行期守卫知识库文件工具的 path(`tools.guard`)。`skillPolicy` 承载于组成的 `tool-skill` 行(deny 用 `excludedSkills`,allow 用 `includedSkills`)。生效发生在 agent 创建时,运行中的会话保留其组成时的策略。
24
+ - **`@bot` 派单**:客户端在共享 bot 列表上注册一个 `@` trigger source。选中某 bot——或输入 `@名字` 并提交——会 claim 该 token,并把消息路由到运行该 bot preset 的会话(该工作区在此 preset 下可复用的空白会话,或新建一个),随后打开它。内置超级助手与其他 bot 一样可被选择。
25
+ - **头像**:自写 SVG 目录(每 key 一个色相 + 字形),离线安全,无外部图片依赖。
26
+
27
+ ## 目录
28
+
29
+ - [功能](#功能)
30
+ - [设计](#设计)
31
+ - [安装](#安装)
32
+ - [模型体验](#模型体验)
33
+ - [已知限制与后续工作](#已知限制与后续工作)
34
+
35
+ -----
36
+
37
+ ## 设计
38
+
39
+ Host 半通过 `ctx.storageDomain` 打开 `agents` 域,seed 内置 bot,通过 `ctx.agentPresets.register` 为每个 bot 注册 preset,并通过 `ctx.webServer` 提供 `/bot-agent/api` CRUD 路由族。preset 组成从基础 preset 的文档(`readDocument`)读取,并以 Loader 自身的 YAML 方言(`parseEntryYaml`)解析,因此 `!!js` 行与 group 无损往返;仅替换 persona 行的 prefix。这是 registry 的「复制后编辑」authoring 路径。preset 注册以轮询等待基础声明,而非 await Loader,因此不会与本插件的激活互相死锁。
40
+
41
+ Client 半在管理页与每个头像行之间共享一个 bot store,因此新建或编辑的 bot 无需二次 fetch 即可到达会话列表。新建会话复用现有 preset 导航(`uiWorkspace.startSession` 携带 `agentPreset`),bot preset 也出现在官方新建会话 preset chip 中。
42
+
43
+ 路由位于 `routing.ts`:`matchBotPreset` 以每个候选 bot 的 `retrievalSummary` token 出现在任务中的比例打分;host 监听器仅提议 preset 注册成功的非内置 bot,因此提议总是命名一个可挂载的 preset。最低覆盖率由 `routingMinCoverage` 配置字段决定(默认 `0.3`)。
44
+
45
+ 策略生效位于 `policy.ts`,复用 harness 的作用域工具 seam 而非新造机制。在 `agent/created` 时,host 半读取 agent 组成的 preset、查得该 bot,并在 agent 自身作用域上施加 `tools.restrict`(`toolPolicy` 遮蔽)与 `tools.guard`(`kbScope` path 检查);二者随 agent 释放而 lifted。`skillPolicy` 由 `buildBotPreset` 组合进 `tool-skill` 行。`@bot` source(`client/mention.ts`)claim 所选 bot 的 token,经 `uiWorkspace.connectWorkspace`(该 bot preset 下)派单,再 `session.prompt` 与 `openSession`。
46
+
47
+ 所有颜色、边框与字重均来自共享 alias token(`--dsw-alias-*`)。头像 tile 遵循 Plus 设计参考:14px 级圆角、hairline 与顶部高光。
48
+
49
+ ## 安装
50
+
51
+ Host 半通过 Plus bundle 的 `plus-bot-agent` 行挂载;client 半由 `dsh.client` 声明并由 Web shell 加载。会话行头像 seat 由 `ui-workspace` 声明,因此向基于已发布 base 产物构建的 release 交付头像,需要相应的 base-client patch。
52
+
53
+ ## 模型体验
54
+
55
+ bot 的 preset 贡献 `deployment:persona-prefix` 系统段:bot 的 identity,随后是非空字段的 `Duties`、`Work style`、`Reply style` 标签段。identity 为空时保留基础组成自身的 prefix。preset 不变地携带基础组成的 prompt 段;收窄的 `toolPolicy` 或 `skillPolicy` 会从模型面移除被遮蔽的工具或技能,`kbScope` 则在执行期拒绝范围外的知识文件调用。
56
+
57
+ #### KV Cache 影响
58
+
59
+ persona prefix 是系统提示可缓存前缀的一部分。编辑 bot 会重新注册其 preset;运行中的会话保留其组成时的 revision,仅编辑后创建的会话看到新 prefix,因此编辑绝不会使运行中会话的缓存失效。
60
+
61
+ ## 已知限制与后续工作
62
+
63
+ 不发布 runtime invariant companion:本包的持久状态即 `agents` 域,storage、route 与 real-composition 测试直接观察每次读写。
64
+
65
+ - **知识范围仅守卫显式 path**:`kbScope` 拒绝 path 落在范围外的知识库文件工具(`kb_file_write`/`move`/`delete`/`mkdir`/`extract`),并在收窄范围下拒绝全树 extract。基于查询的读取(`kb_search`、`kb_chunk_get`、`kb_outline`)此处无 path 可收窄,scope 别名归一化仍属 knowledge-base 插件;命中级过滤需要该插件提供一个按 agent 的 scope 消费点。
66
+ - **内置 bot 已从路由排除**:检索摘要路由绝不提议超级助手;显式 `@bot` 派单则与其他 bot 一样提供它。
67
+ - **绑定承载于 `agentPreset`**:没有单独的 `agentId` header 字段;bot id 即 preset id,头像由其派生。
68
+ - **头像是目录 key**:尚未提供自定义图片上传。
69
+ - **头像 seat 需要 base client 改动**:`ui-workspace` 声明 `sidebar.session.row.avatar`、`ui-subagent` 声明 `subagent.catalog.row.avatar`,各带 badge 布局;消费已发布 base 产物的 release 需要这些 patch 才能渲染头像。
package/lib/client.js ADDED
@@ -0,0 +1,3 @@
1
+
2
+ window.__ModuleLoader__.load({id:`@sparkelf/dsh-bot-agent`,factory:require=>{var module={exports:{}};var exports=module.exports;Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let _deepseek_ai_dsh_client_store=require("@deepseek-ai/dsh-client-store");let react=require("react");let _deepseek_ai_dsh_client_ui_primitives_client=require("@deepseek-ai/dsh-client-ui-primitives/client");let react_jsx_runtime=require("react/jsx-runtime");const BOT_API_PREFIX=`/bot-agent/api`;const BOT_API={list:`list`,get:`get`,create:`create`,update:`update`,delete:`delete`};var BotApiError=class extends Error{};function routeUrl(method){const base=typeof document===`undefined`?`http://localhost/`:document.baseURI;const prefix=`/bot-agent/api`.startsWith(`/`)?BOT_API_PREFIX.slice(1):BOT_API_PREFIX;return new URL(`${prefix}/${method}`,base.endsWith(`/`)?base:`${base}/`).href}var BotApi=class{async list(){return(await this.request(BOT_API.list)).bots}async create(draft){return(await this.request(BOT_API.create,draft)).bot}async update(id,draft){return(await this.request(BOT_API.update,{id,...draft})).bot}async remove(id){await this.request(BOT_API.delete,{id})}async request(method,body){const response=await fetch(routeUrl(method),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(body??{})});let parsed;try{parsed=await response.json()}catch{parsed=void 0}if(!response.ok){const reported=typeof parsed===`object`&&parsed!==null&&typeof parsed.error===`string`?parsed.error:``;throw new BotApiError(reported===``?`HTTP ${String(response.status)}`:reported)}return parsed}};function createBotStore(){return(0,_deepseek_ai_dsh_client_store.defineStore)({init:()=>({bots:[],status:`idle`,error:null,selectedId:null,view:`mine`}),actions:{setBots:(draft,bots)=>{draft.bots=bots;draft.status=`ready`;draft.error=null},setLoading:draft=>{draft.status=`loading`},setError:(draft,error)=>{draft.status=`error`;draft.error=error},select:(draft,id)=>{draft.selectedId=id},setView:(draft,view)=>{draft.view=view}}})}const AVATARS=[{key:`super`,hue:222,glyph:`M12 3a1 1 0 0 1 1 1v1h3a2 2 0 0 1 2 2v3h1a1 1 0 1 1 0 2h-1v3a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2v-3H5a1 1 0 1 1 0-2h1V7a2 2 0 0 1 2-2h3V4a1 1 0 0 1 1-1Zm-2.5 8A1.5 1.5 0 1 0 9.5 14a1.5 1.5 0 0 0 0-3Zm5 0a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3ZM9 16.5h6a.75.75 0 0 1 0 1.5H9a.75.75 0 0 1 0-1.5Z`},{key:`spark`,hue:268,glyph:`M13 2 4.5 13.5H11L9.5 22 19 9.5h-6.5L13 2Z`},{key:`orbit`,hue:190,glyph:`M12 7a5 5 0 1 1 0 10 5 5 0 0 1 0-10Zm0-4c5 0 9 1.6 9 3.6S17 10 12 10 3 8.6 3 6.6 7 3 12 3Zm0 18c-5 0-9-1.6-9-3.6S7 14 12 14s9 1.6 9 3.4S17 21 12 21Z`},{key:`leaf`,hue:140,glyph:`M20 4C10 4 4 9 4 16c0 2 .6 3.4 1.4 4.4C7 14 11 10 17 8c-5 3-8.5 7-10 12.6C8 21 9 21.4 10.4 21.4 17 21.4 20 14 20 4Z`},{key:`wave`,hue:205,glyph:`M3 12c2.5-3 5-3 7.5 0s5 3 7.5 0 3.5-2 3-1.5M3 17c2.5-3 5-3 7.5 0s5 3 7.5 0 3.5-2 3-1.5M3 7c2.5-3 5-3 7.5 0s5 3 7.5 0 3.5-2 3-1.5`},{key:`peak`,hue:28,glyph:`M12 4 22 20H2L12 4Zm0 5-4.5 8h9L12 9Z`},{key:`prism`,hue:300,glyph:`M12 2 22 12 12 22 2 12 12 2Zm0 4.5L6.5 12 12 17.5 17.5 12 12 6.5Z`},{key:`comet`,hue:250,glyph:`M17 3a4 4 0 1 1-3.4 6.1L4 20l1.5-9.6A4 4 0 0 1 17 3Zm-9 9-2 5 5-2-3-3Z`},{key:`bloom`,hue:330,glyph:`M12 8a2.5 2.5 0 1 1 0 5 2.5 2.5 0 0 1 0-5Zm0-5c1.7 0 3 1.6 3 3.5S13.7 10 12 10s-3-1.6-3-3.5S10.3 3 12 3Zm0 11c1.7 0 3 1.6 3 3.5S13.7 21 12 21s-3-1.6-3-3.5 1.3-3.5 3-3.5ZM3 12c0-1.7 1.6-3 3.5-3S10 10.3 10 12s-1.6 3-3.5 3S3 13.7 3 12Zm11 0c0-1.7 1.6-3 3.5-3S21 10.3 21 12s-1.6 3-3.5 3-3.5-1.3-3.5-3Z`},{key:`anchor`,hue:175,glyph:`M12 2a2.5 2.5 0 0 1 1 4.8V9h3a1 1 0 1 1 0 2h-3v7.4A7 7 0 0 0 19 13h-1.5a1 1 0 1 1 0-2H21a1 1 0 0 1 1 1 9 9 0 0 1-9 9 9 9 0 0 1-9-9 1 1 0 0 1 1-1h3.5a1 1 0 1 1 0 2H5a7 7 0 0 0 6 5.4V11H8a1 1 0 1 1 0-2h3V6.8A2.5 2.5 0 0 1 12 2Z`},{key:`quill`,hue:45,glyph:`M20 4c-8 0-13 4-14 11l-2 5 5-2c7-1 11-6 11-14ZM8 16c1-4 4-7 8-8-3 2-5 5-6 8H8Z`},{key:`beacon`,hue:0,glyph:`M12 2 15 9h-6l3-7Zm-4 9h8l2 11H6l2-11Zm2 3h4v3h-4v-3Z`}];function hashHue(key){let hash=0;for(let i=0;i<key.length;i+=1)hash=(hash*31+key.charCodeAt(i))%360;return hash}function avatarDef(key){return AVATARS.find(avatar=>avatar.key===key)??{key,hue:hashHue(key),glyph:`M12 4a8 8 0 1 1 0 16 8 8 0 0 1 0-16Zm0 4a4 4 0 1 0 0 8 4 4 0 0 0 0-8Z`}}function HueTile({hue,glyph,size,label}){const gradient=`g${(0,react.useId)().replace(/:/g,``)}`;return(0,react_jsx_runtime.jsxs)(`svg`,{width:size,height:size,viewBox:`0 0 24 24`,role:label===void 0?void 0:`img`,"aria-label":label,"aria-hidden":label===void 0?true:void 0,style:{display:`block`,flex:`none`},children:[(0,react_jsx_runtime.jsx)(`defs`,{children:(0,react_jsx_runtime.jsxs)(`linearGradient`,{id:gradient,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,react_jsx_runtime.jsx)(`stop`,{offset:`0`,stopColor:`hsl(${hue} 72% 64%)`}),(0,react_jsx_runtime.jsx)(`stop`,{offset:`1`,stopColor:`hsl(${hue} 66% 46%)`})]})}),(0,react_jsx_runtime.jsx)(`rect`,{x:`0.5`,y:`0.5`,width:`23`,height:`23`,rx:`7`,fill:`url(#${gradient})`,stroke:`rgba(0,0,0,0.14)`,strokeWidth:`1`}),(0,react_jsx_runtime.jsx)(`path`,{d:`M1 7a6 6 0 0 1 6-6h10a6 6 0 0 1 6 6v3H1V7Z`,fill:`#fff`,fillOpacity:`0.14`}),(0,react_jsx_runtime.jsx)(`path`,{d:glyph,fill:`#fff`,fillOpacity:`0.96`})]})}function BotAvatar({avatar,size,label}){const def=avatarDef(avatar);return(0,react_jsx_runtime.jsx)(HueTile,{hue:def.hue,glyph:def.glyph,size,label})}var BotAvatarPicker_module_css_default={"cell":`CtZ5_a_cell`,"grid":`CtZ5_a_grid`,"selected":`CtZ5_a_selected`};function BotAvatarPicker({value,onChange,t}){return(0,react_jsx_runtime.jsx)(`div`,{className:BotAvatarPicker_module_css_default.grid,role:`radiogroup`,"aria-label":t(`avatarPicker`),children:AVATARS.map(avatar=>(0,react_jsx_runtime.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":value===avatar.key,className:value===avatar.key?`${BotAvatarPicker_module_css_default.cell} ${BotAvatarPicker_module_css_default.selected}`:BotAvatarPicker_module_css_default.cell,onClick:()=>{onChange(avatar.key)},children:(0,react_jsx_runtime.jsx)(BotAvatar,{avatar:avatar.key,size:40})},avatar.key))})}var BotDetail_module_css_default={"actions":`uf6FhW_actions`,"back":`uf6FhW_back`,"badge":`uf6FhW_badge`,"danger":`uf6FhW_danger`,"detail":`uf6FhW_detail`,"error":`uf6FhW_error`,"field":`uf6FhW_field`,"header":`uf6FhW_header`,"heading":`uf6FhW_heading`,"input":`uf6FhW_input`,"label":`uf6FhW_label`,"note":`uf6FhW_note`,"section":`uf6FhW_section`,"textarea":`uf6FhW_textarea`,"title":`uf6FhW_title`};function Field({label,placeholder,value,onChange,rows}){return(0,react_jsx_runtime.jsxs)(`label`,{className:BotDetail_module_css_default.field,children:[(0,react_jsx_runtime.jsx)(`span`,{className:BotDetail_module_css_default.label,children:label}),(0,react_jsx_runtime.jsx)(`textarea`,{className:BotDetail_module_css_default.textarea,rows:rows??2,placeholder,value,onChange:event=>{onChange(event.target.value)}})]})}function BotDetail({bot,t,saving,onSave,onDelete,onStartSession,onBack}){const[name,setName]=(0,react.useState)(bot?.name??``);const[avatar,setAvatar]=(0,react.useState)(bot?.avatar??`super`);const[identity,setIdentity]=(0,react.useState)(bot?.preset.identity??``);const[duties,setDuties]=(0,react.useState)(bot?.preset.duties??``);const[workStyle,setWorkStyle]=(0,react.useState)(bot?.preset.workStyle??``);const[replyStyle,setReplyStyle]=(0,react.useState)(bot?.preset.replyStyle??``);const[retrievalSummary,setRetrievalSummary]=(0,react.useState)(bot?.retrievalSummary??``);const[error,setError]=(0,react.useState)(null);const submit=()=>{if(name.trim()===``){setError(t(`nameRequired`));return}setError(null);onSave({name:name.trim(),avatar,retrievalSummary,preset:{identity,duties,workStyle,replyStyle}})};return(0,react_jsx_runtime.jsxs)(`div`,{className:BotDetail_module_css_default.detail,children:[(0,react_jsx_runtime.jsxs)(`div`,{className:BotDetail_module_css_default.header,children:[(0,react_jsx_runtime.jsx)(`button`,{type:`button`,className:BotDetail_module_css_default.back,onClick:onBack,children:t(`back`)}),(0,react_jsx_runtime.jsx)(BotAvatar,{avatar,size:48}),(0,react_jsx_runtime.jsxs)(`div`,{className:BotDetail_module_css_default.heading,children:[(0,react_jsx_runtime.jsx)(`span`,{className:BotDetail_module_css_default.title,children:name===``?t(`create`):name}),bot?.builtin===true&&(0,react_jsx_runtime.jsx)(`span`,{className:BotDetail_module_css_default.badge,children:t(`builtin`)})]}),bot!==null&&(0,react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives_client.Button,{size:`sm`,onClick:onStartSession,children:t(`startSession`)})]}),(0,react_jsx_runtime.jsxs)(`label`,{className:BotDetail_module_css_default.field,children:[(0,react_jsx_runtime.jsx)(`span`,{className:BotDetail_module_css_default.label,children:t(`fieldName`)}),(0,react_jsx_runtime.jsx)(`input`,{className:BotDetail_module_css_default.input,value:name,placeholder:t(`fieldName`),onChange:event=>{setName(event.target.value)}})]}),(0,react_jsx_runtime.jsxs)(`div`,{className:BotDetail_module_css_default.field,children:[(0,react_jsx_runtime.jsx)(`span`,{className:BotDetail_module_css_default.label,children:t(`fieldAvatar`)}),(0,react_jsx_runtime.jsx)(BotAvatarPicker,{value:avatar,onChange:setAvatar,t})]}),(0,react_jsx_runtime.jsx)(`div`,{className:BotDetail_module_css_default.section,children:t(`presetSection`)}),(0,react_jsx_runtime.jsx)(Field,{label:t(`fieldIdentity`),placeholder:t(`identityPlaceholder`),value:identity,onChange:setIdentity}),(0,react_jsx_runtime.jsx)(Field,{label:t(`fieldDuties`),placeholder:t(`dutiesPlaceholder`),value:duties,onChange:setDuties}),(0,react_jsx_runtime.jsx)(Field,{label:t(`fieldWorkStyle`),placeholder:t(`workStylePlaceholder`),value:workStyle,onChange:setWorkStyle}),(0,react_jsx_runtime.jsx)(Field,{label:t(`fieldReplyStyle`),placeholder:t(`replyStylePlaceholder`),value:replyStyle,onChange:setReplyStyle}),(0,react_jsx_runtime.jsx)(`div`,{className:BotDetail_module_css_default.section,children:t(`retrievalSection`)}),(0,react_jsx_runtime.jsx)(Field,{label:t(`fieldRetrievalSummary`),placeholder:t(`retrievalSummaryPlaceholder`),value:retrievalSummary,onChange:setRetrievalSummary,rows:3}),(0,react_jsx_runtime.jsx)(`p`,{className:BotDetail_module_css_default.note,children:t(`readonlyPolicy`)}),error!==null&&(0,react_jsx_runtime.jsx)(`p`,{className:BotDetail_module_css_default.error,role:`alert`,children:error}),(0,react_jsx_runtime.jsxs)(`div`,{className:BotDetail_module_css_default.actions,children:[(0,react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives_client.Button,{variant:`primary`,disabled:saving,onClick:submit,children:saving?t(`saving`):t(`save`)}),(0,react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives_client.Button,{onClick:onBack,children:t(`cancel`)}),bot!==null&&bot.builtin!==true&&(0,react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives_client.Button,{variant:`outline`,className:BotDetail_module_css_default.danger,onClick:onDelete,children:t(`delete`)})]})]})}function single(search,target){if(!search||!target)return null;let query=getQuery(search);if(!isPrepared(target))target=getPrepared(target);if((query.bitflags&target._bitflags)!==query.bitflags)return null;let result=!query.hasSpace&&query.lowerCodes.length===2?algorithm2(query,target):algorithm(query,target);return result&&materialize(result)}function go(search,targets,options){if(targets instanceof SnapshotTargets)return goSnapshot(search,targets,options);let key=options?.key;let keys=!key&&options?.keys;let firstTarget=targets[0];if(!key&&!keys&&typeof firstTarget===`object`&&firstTarget!==null&&!isPrepared(firstTarget))throw new Error(`fuzzysort: key or keys is required when searching object targets`);if(!search)return all(targets,options);let query=getQuery(search);if(keys)return goKeys(query,targets,options);let searchBitflags=query.bitflags;let twoChar=!query.hasSpace&&query.lowerCodes.length===2;let threshold=denormalizeScore(options?.threshold??.5);let limit=getLimit(options);let scoreFn=options?.scoreFn;let resultCount=0;let limited=0;let getter=key&&makeGetter(key);for(let i=0;i<targets.length;i++){let obj=targets[i];let target=key?getter===null?obj[key]:getter(obj):obj;if(!target)continue;if(!isPrepared(target))target=getPrepared(target);if((searchBitflags&target._bitflags)!==searchBitflags)continue;let result=twoChar?algorithm2(query,target):algorithm(query,target);if(result===null)continue;let resultScore=result._score;if(scoreFn){result=materialize(result,key?obj:void 0);resultScore=scoreFn(result);if(!resultScore)continue;result._score=resultScore=denormalizeScore(resultScore)}if(resultScore<threshold)continue;let room=resultCount<limit;if(room)resultCount++;else{limited++;if(resultScore<=heap.peek()._score)continue}if(!scoreFn)result=materialize(result,key?obj:void 0);room?heap.add(result):heap.replaceTop(result)}return finishResults(resultCount,limited)}function highlight(result,open=`<b>`,close=`</b>`,threshold=.5){let callback=typeof open===`function`?open:null;let target=result.target;if(result._bestKeyScore!==void 0&&normalizeScore(result._score)<normalizeScore(result._bestKeyScore)*threshold)return callback?[target]:target;let raw=result._indexes;let indexes=raw===void 0?result.indexes:raw.slice(0,raw.len??raw.length).sort((a,b)=>a-b);if(!indexes.length)return callback?[target]:target;let output=callback?[]:``;let lastIndex=0;let matchI=0;for(let i=0;i<indexes.length;){let start=indexes[i++];let end=start+1;while(indexes[i]===end){i++;end++}let before=target.slice(lastIndex,start);let match=target.slice(start,end);if(callback)output.push(before,callback(match,matchI++));else output+=before+open+match+close;lastIndex=end}if(callback)output.push(target.slice(lastIndex));else output+=target.slice(lastIndex);return output}function score(result){let value=result.score;return value===void 0?normalizeScore(result._score):value}function remap(mappings){for(let char in mappings){remappings[char]=mappings[char];if(char.charCodeAt(0)<128)customAsciiRemappings=true}cleanup()}function prepare(target){return prepTarget(target)}function snapshot(targets,options){return new SnapshotTargets(targets,options)}function cleanup(){targetCache.clear();searchCache.clear();heap.clear();simpleMatch=[];strictMatch=[];seen=[];seenAt=[];changes=[];partials=[];spaceScores=[];partIndexes=[];winnerIndexes=[];winnerScores=[];winnerKeys=[];keyTargets=[];keyResults=[];candidateBitOffsets=[];seenGeneration=0}function goSnapshotValues(search,snapshot,options,singleChar){let targets=snapshot._targets;let objects=snapshot._objects;let threshold=denormalizeScore(options?.threshold??.5);let limit=getLimit(options);let scoreFn=options?.scoreFn;let searchLen=search.lowerCodes.length;let shortSearch=!search.hasSpace&&searchLen<=3;let twoChar=!search.hasSpace&&searchLen===2;let rows=snapshot._candidateRows;let rowsLength=snapshot._candidateLength;let matchedRows=snapshot._rows;let matchedCount=0;let resultCount=0;let limited=0;for(let n=0;n<rowsLength;n++){let i=rows===null?n:rows[n];let target=targets[i];if(target===noTarget||(search.bitflags&target._bitflags)!==search.bitflags)continue;let targetShort=shortSearch&&target.target.length<65535;let cutoff=!scoreFn&&threshold===-INF&&resultCount>=limit?heap.peek()._score:-INF;let result;if(singleChar&&targetShort)result=algorithm1(search,target,snapshot._first,i);else if(twoChar&&targetShort){let start=snapshot._offsets[i];let end=snapshot._offsets[i+1];result=algorithm2(search,target,snapshot._beginnings,start,end,cutoff)}else if(twoChar)result=algorithm2(search,target,null,0,0,cutoff);else if(targetShort){let start=snapshot._offsets[i];let end=snapshot._offsets[i+1];result=algorithm(search,target,false,false,false,true,snapshot._beginnings,start,end,cutoff)}else result=algorithm(search,target,false,false,false,true,null,0,0,cutoff);if(result===null)continue;matchedRows[matchedCount++]=i;if(result===prunedMatch){limited++;continue}let resultScore=result._score;if(scoreFn){result=materialize(result,objects?.[i]);resultScore=scoreFn(result);if(!resultScore)continue;result._score=resultScore=denormalizeScore(resultScore)}if(resultScore<threshold)continue;let room=resultCount<limit;if(room)resultCount++;else{limited++;if(resultScore<=heap.peek()._score)continue}if(objects&&!scoreFn)result=materialize(result,objects[i]);room?heap.add(result):heap.replaceTop(result)}snapshot._matchedRowsLen=matchedCount;return finishResults(resultCount,limited,!objects&&!scoreFn&&materialize)}function goSnapshot(search,snapshot,options){if(options?.key||options?.keys)throw new Error(`fuzzysort: key/keys must be provided to snapshot(), not go()`);snapshot._finish();if(!search)return allSnapshot(snapshot,options);let query=getQuery(search);let backtrack=snapshot._backtrack(query,options);if(backtrack)return backtrack;snapshot._beginSearch(query);try{let results;if(snapshot._mode<2){let searchLen=query.lowerCodes.length;let code=query.lowerCodes[0];results=goSnapshotValues(query,snapshot,options,searchLen===1&&code>=97&&code<=122)}else results=goKeys(query,snapshot._objects,options,snapshot);snapshot._endSearch(query);snapshot._remember(query,results,options);return results}catch(error){snapshot._resetSearch();throw error}}function goKeys(query,objects,options,snapshot){let indexed=snapshot!==void 0;let keys=indexed?null:options.keys;let getters=indexed?null:keys.map(makeGetter);let targets=indexed?snapshot._targets:null;let keysLength=indexed?snapshot._keysLength:keys.length;let searchBitflags=query.bitflags;let hasSpace=query.hasSpace;let spaceCount=query.parts.length;let threshold=denormalizeScore(options?.threshold??.5);let limit=getLimit(options);let searchLen=query.lowerCodes.length;let short=indexed&&!hasSpace&&searchLen<=3;let twoChar=!hasSpace&&searchLen===2;let code=query.lowerCodes[0];let singleChar=short&&searchLen===1&&code>=97&&code<=122;let scoreFn=options?.scoreFn;let deferMaterialization=indexed&&!scoreFn&&(limit!==INF||threshold>-INF);let rows=indexed?snapshot._candidateRows:null;let rowsLength=indexed?snapshot._candidateLength:objects.length;let matchedRows=indexed?snapshot._rows:null;let matchedCount=0;let resultCount=0;let limited=0;outer:for(let n=0;n<rowsLength;n++){let i=rows===null?n:rows[n];let row=i*keysLength;if(indexed){if((searchBitflags&snapshot._bitflags[i])!==searchBitflags)continue}else{let obj=objects[i];let keysBitflags=0;for(let k=0;k<keysLength;k++){let target=getters[k]===null?obj[keys[k]]:getters[k](obj);if(!target)target=noTarget;else if(!isPrepared(target))target=getPrepared(target);keyTargets[k]=target;keysBitflags|=target._bitflags}if((searchBitflags&keysBitflags)!==searchBitflags)continue}if(hasSpace)for(let s=0;s<spaceCount;s++){spaceScores[s]=winnerScores[s]=-INF;winnerKeys[s]=-1}for(let k=0;k<keysLength;k++){let target=indexed?targets[row+k]:keyTargets[k];if(target===noTarget){keyResults[k]=noTarget;continue}if(hasSpace&&indexed){let possible=false;for(let s=0;s<spaceCount;s++){let partBitflags=query.parts[s].bitflags;if((partBitflags&target._bitflags)===partBitflags){possible=true;break}}if(!possible){keyResults[k]=noTarget;continue}}else if(!hasSpace&&(searchBitflags&target._bitflags)!==searchBitflags){keyResults[k]=noTarget;continue}let match;if(indexed){let valueRow=row+k;let targetShort=short&&target.target.length<65535;if(singleChar&&targetShort)match=algorithm1(query,target,snapshot._first,valueRow);else if(twoChar&&targetShort){let start=snapshot._offsets[valueRow];let end=snapshot._offsets[valueRow+1];match=algorithm2(query,target,snapshot._beginnings,start,end)}else if(twoChar)match=algorithm2(query,target);else if(targetShort){let start=snapshot._offsets[valueRow];let end=snapshot._offsets[valueRow+1];match=algorithm(query,target,false,false,false,true,snapshot._beginnings,start,end)}else match=algorithm(query,target,false,hasSpace)}else match=twoChar?algorithm2(query,target):algorithm(query,target,false,hasSpace);if(match===null){keyResults[k]=noTarget;continue}keyResults[k]=deferMaterialization?match:materialize(match);if(hasSpace){mergePartScores(spaceCount);for(let s=0;s<spaceCount;s++){let partScore=partials[s];if(partScore<=winnerScores[s])continue;winnerScores[s]=partScore;winnerKeys[s]=k;let source=partIndexes[s];let winner=winnerIndexes[s]||=[];winner.length=source.length;for(let j=0;j<source.length;j++)winner[j]=source[j]}}}if(hasSpace){for(let s=0;s<spaceCount;s++)if(winnerKeys[s]!==-1)appendIndexes(keyResults[winnerKeys[s]]._indexes,winnerIndexes[s])}let resultScore;if(hasSpace){resultScore=0;for(let s=0;s<spaceCount;s++){let partScore=spaceScores[s];if(partScore===-INF)continue outer;resultScore+=partScore}}else{resultScore=mergeScores(keyResults,keysLength);if(resultScore===-INF)continue}if(indexed)matchedRows[matchedCount++]=i;let result=deferMaterialization?null:captureKeysResult(keyResults,keysLength,objects[i],resultScore,hasSpace);if(scoreFn){resultScore=scoreFn(result);if(!resultScore)continue;result._score=resultScore=denormalizeScore(resultScore)}if(resultScore<threshold)continue;let room=resultCount<limit;if(room)resultCount++;else{limited++;if(resultScore<=heap.peek()._score)continue}if(result===null)result=captureKeysResult(keyResults,keysLength,objects[i],resultScore,hasSpace);room?heap.add(result):heap.replaceTop(result)}if(indexed)snapshot._matchedRowsLen=matchedCount;return finishResults(resultCount,limited,deferMaterialization&&materializeKeys)}function allSnapshot(snapshot,options){let results=[];let targets=snapshot._targets;let objects=snapshot._objects;let keysLength=snapshot._keysLength;let total=keysLength===void 0?targets.length:objects.length;results.total=total;let limit=getLimit(options);for(let i=0,length=Math.min(total,limit);i<length;i++){if(keysLength===void 0){results.push(newResult(targets[i].target,-INF,objects?.[i]));continue}let row=i*keysLength;for(let k=0;k<keysLength;k++){let target=targets[row+k];keyResults[k]=target===noTarget?noTarget:newResult(target.target,-INF)}results.push(captureKeysResult(keyResults,keysLength,objects[i],-INF))}return results}function all(targets,options){let results=[];results.total=targets.length;let limit=getLimit(options);let key=options?.key;let keys=!key&&options?.keys;if(keys){let getters=keys.map(makeGetter);for(let obj of targets){for(let k=keys.length-1;k>=0;k--){let target=getters[k]===null?obj[keys[k]]:getters[k](obj);if(!target)keyResults[k]=noTarget;else{if(!isPrepared(target))target=getPrepared(target);target._score=-INF;target._indexes.len=0;keyResults[k]=target}}results.push(captureKeysResult(keyResults,keys.length,obj,-INF));if(results.length>=limit)break}return results}let getter=key&&makeGetter(key);for(let obj of targets){let target=key?getter===null?obj[key]:getter(obj):obj;if(target==null)continue;if(!isPrepared(target))target=getPrepared(target);if(key)target=newResult(target.target,-INF,obj);else{target._score=-INF;target._indexes.len=0}results.push(target);if(results.length>=limit)break}return results}function finishResults(length,limited,transform){if(!length)return noResults;let results=new Array(length);for(let i=length-1;i>=0;i--){let result=heap.poll();if(transform)result=transform(result);if(result instanceof KeysResult&&!result._partWinners)markBestKeyScore(result);results[i]=result}results.total=length+limited;return results}function materializeKeys(result){for(let k=0;k<result.length;k++)if(result[k]!==noTarget)result[k]=materialize(result[k]);return result}function algorithm1(search,target,firstTable,row){let matchI=target._targetLower.indexOf(search._lower);if(matchI===-1)return null;let beginning=firstTable[row*26+search.lowerCodes[0]-97];let strict=beginning!==0;if(strict)matchI=beginning-1;let score=matchI===0?0:-matchI*matchI*.2;if(!strict)score*=1e3;else if(target._beginningsLen>24)score*=(target._beginningsLen-24)*10;target._score=score-target._targetLowerCodes.length+1;target._indexes[0]=matchI;target._indexes.len=1;return target}function algorithm2(search,target,beginnings=null,start=0,end=0,cutoff=-INF){let targetCodes=target._targetLowerCodes;let targetLen=targetCodes.length;let firstCode=search.lowerCodes[0];let secondCode=search.lowerCodes[1];let first=0;while(targetCodes[first]!==firstCode)if(++first>=targetLen)return null;let second=first+1;while(targetCodes[second]!==secondCode)if(++second>=targetLen)return null;if(cutoff!==-INF&&scoreCeiling(2,targetLen)<=cutoff)return prunedMatch;if(beginnings===null){beginnings=target._beginnings;if(beginnings===null)target._beginnings=beginnings=makeBeginnings(target);end=beginnings.length}let substringI=target._targetLower.indexOf(search._lower,first);let substring=substringI!==-1;let low=lowerBound(beginnings,start,end,substringI);let substringStart=substring&&low<end&&beginnings[low]===substringI;let strict=substringStart&&substringI===first;if(!strict){let firstBeginning=start;while(firstBeginning<end&&beginnings[firstBeginning]<first)firstBeginning++;for(let backtracks=0;firstBeginning<end;){let strictFirst=beginnings[firstBeginning];if(targetCodes[strictFirst]!==firstCode){firstBeginning++;continue}let consecutive=strictFirst+1;if(targetCodes[consecutive]===secondCode){first=strictFirst;second=consecutive;strict=true;break}let secondBeginning=firstBeginning+1;while(secondBeginning<end&&beginnings[secondBeginning]<=consecutive)secondBeginning++;while(secondBeginning<end&&targetCodes[beginnings[secondBeginning]]!==secondCode)secondBeginning++;if(secondBeginning<end){first=strictFirst;second=beginnings[secondBeginning];strict=true;break}if(++backtracks>200)break;firstBeginning++}}if(substring&&!substringStart){while(low<end&&beginnings[low]<=substringI)low++;for(;low<end;low++){let index=beginnings[low];if(targetCodes[index]===firstCode&&targetCodes[index+1]===secondCode){substringI=index;substringStart=true;break}}}if(substring&&(!strict||substringStart)){first=substringI;second=substringI+1}let resultScore=second-first===1?0:first-second*2-11;if(first)resultScore-=first*first*.2;if(!strict)resultScore*=1e3;else if(end-start>24)resultScore*=(end-start-24)*10;let lengthPenalty=(targetLen-2)/2;resultScore-=lengthPenalty;if(substring)resultScore/=5;if(substringStart)resultScore/=5;resultScore-=lengthPenalty;target._score=substring&&second===first+1&&(second+1===targetLen||isBeginning(beginnings,start,end,second+1))?resultScore+Math.min(4,-resultScore/2):resultScore;target._indexes[0]=first;target._indexes[1]=second;target._indexes.len=2;return target}function algorithm(search,target,spaces=false,partial=false,changed=false,singleMatch=true,beginnings=null,start=0,end=0,cutoff=-INF){if(!spaces&&search.hasSpace)return algorithmSpaces(search,target,partial);let searchCodes=search.lowerCodes;let targetCodes=target._targetLowerCodes;let searchLen=searchCodes.length;let targetLen=targetCodes.length;let searchCode=searchCodes[0];let searchI=0;let targetI=0;for(;;){if(searchCode===targetCodes[targetI]){simpleMatch[searchI]=targetI;if(++searchI===searchLen)break;searchCode=searchCodes[searchI]}if(++targetI>=targetLen)return null}if(cutoff!==-INF&&searchLen>1&&scoreCeiling(searchLen,targetLen)<=cutoff)return prunedMatch;if(searchLen===1&&!changed&&singleMatch){let matchI;let strict;if(target._singleMatchCode===searchCode){matchI=target._singleMatchIndex;strict=target._singleMatchStrict}else if(target._nextBeginningIndexes!==null){let next=target._nextBeginningIndexes;targetI=simpleMatch[0]===0?0:next[simpleMatch[0]-1];while(targetI<targetLen&&searchCode!==targetCodes[targetI])targetI=next[targetI];strict=targetI<targetLen;matchI=strict?targetI:simpleMatch[0]}else{prepareSingleMatch(target,searchCode,simpleMatch[0]);matchI=target._singleMatchIndex;strict=target._singleMatchStrict}let resultScore=matchI===0?0:-matchI*matchI*.2;if(!strict)resultScore*=1e3;else if(target._beginningsLen>24)resultScore*=(target._beginningsLen-24)*10;target._score=resultScore-(targetLen-1);target._indexes[0]=matchI;target._indexes.len=1;return target}searchI=0;let strict=false;let strictLen=0;let next=target._nextBeginningIndexes;if(beginnings===null&&next===null)next=target._nextBeginningIndexes=makeNextBeginnings(target);let beginningLen=beginnings===null?changed?0:target._beginningsLen:end-start;if(!beginningLen){beginningLen=1;for(let i=next[0];i<targetLen;i=next[i])beginningLen++;if(!changed)target._beginningsLen=beginningLen}let substringI=searchLen<=1?-1:target._targetLower.indexOf(search._lower,simpleMatch[0]);let isSubstring=substringI!==-1;let substringStart=isSubstring&&(substringI===0||(beginnings?isBeginning(beginnings,start,end,substringI):next[substringI-1]===substringI));if(substringStart&&substringI===simpleMatch[0])strict=true;else{targetI=simpleMatch[0]===0?0:beginnings?nextBeginning(beginnings,start,end,simpleMatch[0]-1,targetLen):next[simpleMatch[0]-1];let backtracks=0;if(targetI!==targetLen)for(;;)if(targetI>=targetLen){if(searchI<=0||++backtracks>200)break;searchI--;let previous=strictMatch[--strictLen];targetI=beginnings?nextBeginning(beginnings,start,end,previous,targetLen):next[previous]}else if(searchCodes[searchI]===targetCodes[targetI]){strictMatch[strictLen++]=targetI;if(++searchI===searchLen){strict=true;break}targetI++}else targetI=beginnings?nextBeginning(beginnings,start,end,targetI,targetLen):next[targetI]}if(isSubstring&&!substringStart)if(beginnings)for(let b=start;b<end;b++){let i=beginnings[b];if(i<=substringI)continue;let s=0;for(;s<searchLen&&searchCodes[s]===targetCodes[i+s];s++);if(s===searchLen){substringI=i;substringStart=true;break}}else for(let i=0;i<next.length;i=next[i]){if(i<=substringI)continue;let s=0;for(;s<searchLen&&searchCodes[s]===targetCodes[i+s];s++);if(s===searchLen){substringI=i;substringStart=true;break}}let matches;if(!strict){if(isSubstring)for(let i=0;i<searchLen;i++)simpleMatch[i]=substringI+i;matches=simpleMatch}else if(substringStart){for(let i=0;i<searchLen;i++)simpleMatch[i]=substringI+i;matches=simpleMatch}else matches=strictMatch;let matchEnd=matches[searchLen-1]+1;let substringEnd=isSubstring&&matchEnd-matches[0]===searchLen&&(matchEnd===targetLen||(beginnings?isBeginning(beginnings,start,end,matchEnd):next[matchEnd-1]===matchEnd));target._score=calculateScore(matches,searchLen,targetLen,strict,beginningLen,isSubstring,substringStart,substringEnd);for(let i=0;i<searchLen;i++)target._indexes[i]=matches[i];target._indexes.len=searchLen;return target}function mergePartScores(length){for(let i=0;i<length;i++){let partial=partials[i];let best=spaceScores[i];if(partial>-1e3&&best>-INF)best=Math.max(best,(best+partial)/4);spaceScores[i]=Math.max(best,partial)}}function appendIndexes(indexes,additions){let length=indexes.len;outer:for(let i=0;i<additions.length;i++){let index=additions[i];for(let j=0;j<length;j++)if(indexes[j]===index)continue outer;indexes[length++]=index}indexes.len=length}function mergeScores(results,length){let total=-INF;for(let i=0;i<length;i++){let score=results[i]._score;if(score>-1e3&&total>-INF)total=Math.max(total,(total+score)/4);if(score>total)total=score}return total}function calculateScore(matches,searchLen,targetLen,strict,beginningLen,substring,substringStart,substringEnd){let score=0;let groups=0;for(let i=1;i<searchLen;i++)if(matches[i]-matches[i-1]!==1){score-=matches[i];groups++}let unmatchedDistance=matches[searchLen-1]-matches[0]-(searchLen-1);score-=(12+unmatchedDistance)*groups;if(matches[0]!==0)score-=matches[0]*matches[0]*.2;if(!strict)score*=1e3;else if(beginningLen>24)score*=(beginningLen-24)*10;let lengthPenalty=(targetLen-searchLen)/2;score-=lengthPenalty;let substringBonus=1+searchLen*searchLen;if(substring)score/=substringBonus;if(substringStart)score/=substringBonus;score-=lengthPenalty;return substringEnd?score+Math.min(4,-score/2):score}function algorithmSpaces(search,target,partial){let seenLen=0;let generation=++seenGeneration;let score=0;let result=null;let previousFirst=0;let searches=search.parts;let changesLen=0;let matched=false;for(let i=0;i<searches.length;i++){partials[i]=-INF;if(partial)(partIndexes[i]||=[]).length=0;result=algorithm(searches[i],target,false,false,changesLen!==0,false);if(result===null){if(partial)continue;resetBeginnings(target,changesLen);return null}matched=true;if(i<searches.length-1){let indexes=result._indexes;let consecutive=true;for(let j=0;j<indexes.len-1;j++)if(indexes[j+1]-indexes[j]!==1){consecutive=false;break}if(consecutive){let beginning=indexes[indexes.len-1]+1;let previous=target._nextBeginningIndexes[beginning-1];for(let j=beginning-1;j>=0&&target._nextBeginningIndexes[j]===previous;j--){target._nextBeginningIndexes[j]=beginning;changes[changesLen*2]=j;changes[changesLen*2+1]=previous;changesLen++}}}if(partial){let indexes=partIndexes[i];indexes.length=result._indexes.len;for(let j=0;j<indexes.length;j++)indexes[j]=result._indexes[j]}let partScore=result._score/searches.length;score+=partScore;partials[i]=partScore;if(result._indexes[0]<previousFirst)score-=(previousFirst-result._indexes[0])*2;previousFirst=result._indexes[0];if(!partial)for(let j=0;j<result._indexes.len;j++){let index=result._indexes[j];if(seenAt[index]===generation)continue;seenAt[index]=generation;seen[seenLen++]=index}}if(partial&&!matched)return null;resetBeginnings(target,changesLen);if(target._bitflags&SPACE_BIT){let spacedResult=algorithm(search,target,true);if(spacedResult!==null&&spacedResult._score>score){if(partial){let searchFrom=0;for(let i=0;i<searches.length;i++){partials[i]=spacedResult._score/searches.length;let part=searches[i]._lower;let searchI=search._lower.indexOf(part,searchFrom);let indexes=partIndexes[i];indexes.length=part.length;for(let j=0;j<part.length;j++)indexes[j]=spacedResult._indexes[searchI+j];searchFrom=searchI+part.length}if(spacedResult._score<GOOD_PART_SCORE)spacedResult._indexes.len=0}return spacedResult}}if(partial){result=target;let targetLower=target._targetLower;for(let i=1;i<searches.length;i++){let previous=partIndexes[i-1];if(!previous.length||!partIndexes[i].length)continue;let previousEnd=previous[previous.length-1]+1;let at=previousEnd;let code;while((code=targetLower.charCodeAt(at))===32||code>=9&&code<=13)at++;let part=searches[i]._lower;if(!targetLower.startsWith(part,at))continue;for(let j=previousEnd;j<at;j++)previous.push(j);let indexes=partIndexes[i];indexes.length=part.length;for(let j=0;j<part.length;j++)indexes[j]=at+j}result._indexes.len=0;for(let i=0;i<searches.length;i++)if(partials[i]*searches.length>=GOOD_PART_SCORE)appendIndexes(result._indexes,partIndexes[i])}else{for(let i=0;i<seenLen;i++)result._indexes[i]=seen[i];result._indexes.len=seenLen}result._score=score;return result}function resetBeginnings(target,changesLen){for(let i=changesLen-1;i>=0;i--)target._nextBeginningIndexes[changes[i*2]]=changes[i*2+1]}var SnapshotTargets=class{constructor(targets,options){this._mode=options?.keys?2:options?.key?1:0;this._keys=this._mode===2?options.keys.slice():[options?.key];this._input=targets.slice();this._index=0;this._done=false;this._error=null;this._scheduled=null;if(targets.length===0)this._finish();else this._schedule()}_schedule(){if(this._scheduled!==null)return;this._scheduled=scheduleTask(deadline=>{this._scheduled=null;this._run(deadline)})}_cancel(){if(this._scheduled!==null)this._scheduled();this._scheduled=null}_initialize(){if(this._targets)return;let keysLength=this._mode===2?this._keys.length:1;let valueCount=this._input.length*keysLength;let rowCount=this._input.length;this._targets=new Array(valueCount);this._first=new Uint16Array(valueCount*26);this._offsets=new Uint32Array(valueCount+1);this._buildingBeginnings=[];this._rowCount=rowCount;this._rowWords=rowCount+31>>5;this._rowBits=new Uint32Array(this._rowWords*32);this._rows=new Uint32Array(rowCount);this._lastRowsLen=0;this._matchedRowsLen=0;this._lastQuery=null;this._candidateRows=null;this._candidateLength=rowCount;this._history=[];if(this._mode){this._objects=this._input;this._getters=this._keys.map(makeGetter)}if(this._mode===2){this._keysLength=keysLength;this._bitflags=new Int32Array(rowCount)}}_run(deadline){if(this._done||this._error)return;let end=Date.now()+4;let hasTime=()=>deadline&&!deadline.didTimeout?deadline.timeRemaining()>1:Date.now()<end;try{this._initialize();do this._prepareOne();while(this._index<this._input.length&&hasTime());if(this._index===this._input.length)this._complete();else this._schedule()}catch(error){this._error=error;this._done=true}}_indexRow(row,bitflags){let flags=bitflags>>>0;let word=row>>5;let mask=1<<(row&31);let words=this._rowWords;let bits=this._rowBits;while(flags){let lowest=flags&-flags;let bit=31-Math.clz32(lowest);bits[bit*words+word]|=mask;flags=(flags&flags-1)>>>0}}_prepareOne(){let i=this._index++;let mode=this._mode;let obj=this._input[i];let keysLength=mode===2?this._keysLength:1;let bitflags=0;for(let k=0;k<keysLength;k++){let value=mode===0?obj:this._getters[k]===null?obj[this._keys[k]]:this._getters[k](obj);let row=mode===2?i*keysLength+k:i;let prepared=this._targets[row]=value?prepTarget(value):noTarget;if(prepared!==noTarget)indexBeginnings(prepared,this._first,row,this._buildingBeginnings);this._offsets[row+1]=this._buildingBeginnings.length;bitflags|=prepared._bitflags}if(mode===2)this._bitflags[i]=bitflags;this._indexRow(i,bitflags)}_complete(){this._beginnings=Uint16Array.from(this._buildingBeginnings);this._buildingBeginnings=this._input=this._getters=this._keys=null;this._done=true}_bitOffsets(bitflags){let offsetsLen=0;let words=this._rowWords;for(let bit=0;bit<32;bit++)if(bitflags&1<<bit)candidateBitOffsets[offsetsLen++]=bit*words;return offsetsLen}_matchRows(bitflags,fill=false,stop=INF){let offsetsLen=this._bitOffsets(bitflags);if(!offsetsLen){if(fill){this._candidateRows=null;this._candidateLength=this._rowCount}return this._rowCount}let bits=this._rowBits;let words=this._rowWords;let rowsLen=0;for(let word=0;word<words;word++){let matches=bits[candidateBitOffsets[0]+word];for(let i=1;i<offsetsLen&&matches;i++)matches&=bits[candidateBitOffsets[i]+word];if(!fill){rowsLen+=bitCount(matches);if(rowsLen>=stop)return rowsLen;continue}while(matches){let lowest=matches&-matches;this._rows[rowsLen++]=(word<<5)+31-Math.clz32(lowest);matches=(matches&matches-1)>>>0}}if(fill){this._candidateRows=this._rows;this._candidateLength=rowsLen}return rowsLen}_beginSearch(query){this._matchedRowsLen=0;let previousQuery=this._lastQuery;let previousLength=this._lastRowsLen;this._lastQuery=null;let bitflags=query.bitflags>>>0;if(previousQuery!==null&&query._lower.startsWith(previousQuery)){if(previousLength<=this._matchRows(bitflags,false,previousLength)){this._candidateRows=this._rows;this._candidateLength=previousLength;return}}this._matchRows(bitflags,true)}_endSearch(query){this._lastRowsLen=this._matchedRowsLen;this._matchedRowsLen=0;this._lastQuery=query._lower||null;this._candidateRows=null;this._candidateLength=0}_backtrack(query,options){let history=this._history;if(history.length<2||options?.scoreFn||options?.threshold!==void 0)return null;let limit=getLimit(options);if(limit===INF)return null;let current=history[history.length-1];let value=query._lower;if(current.query===value&&current.limit===limit&&current.results)return copyResults(current.results);if(value.length>=current.query.length||!current.query.startsWith(value))return null;let i=history.length-2;while(i>=0&&history[i].query.length>value.length)i--;let entry=history[i];if(!entry||entry.query!==value||entry.limit!==limit)return null;history.length=i+1;if(!entry.results)return null;this._resetSearch();return copyResults(entry.results)}_remember(query,results,options){let history=this._history;let limit=getLimit(options);if(options?.scoreFn||options?.threshold!==void 0||limit===INF||results.length>256){history.length=0;return}let value=query._lower;let last=history[history.length-1];if(last&&!value.startsWith(last.query))history.length=0;else if(last?.query===value&&last.limit===limit)history.pop();history.push({query:value,limit,results:value.length<=32?copyResults(results):null})}_resetSearch(){this._lastQuery=null;this._lastRowsLen=this._matchedRowsLen=this._candidateLength=0;this._candidateRows=null}_finish(){if(this._error)throw this._error;if(this._done)return;this._cancel();try{this._initialize();while(this._index<this._input.length)this._prepareOne();this._complete()}catch(error){this._error=error;this._done=true;throw error}}};function copyResult(result){if(result===noTarget)return noTarget;if(result instanceof KeysResult){let copy=result.map(copyResult);copy.obj=result.obj;copy._score=result._score;if(result._partWinners)copy._partWinners=true;return copy}let copy=materialize(result,result.obj);if(result._bestKeyScore!==void 0)copy._bestKeyScore=result._bestKeyScore;let indexes=result._indexes;copy._indexes=indexes.slice(0,indexes.len??indexes.length);copy._indexes.len=copy._indexes.length;return copy}function copyResults(results){let copies=results.map(copyResult);copies.total=results.total;return copies}function prepTarget(target){if(isPrepared(target))target=target.target;else if(typeof target===`number`)target=``+target;else if(typeof target!==`string`)target=``;let info=lowerInfo(target);return newResult(target,-INF,null,info._lower,info.lowerCodes,info.bitflags)}function prepQuery(search){if(typeof search===`number`)search=``+search;else if(typeof search!==`string`)search=``;search=remapChars(search).trim();let info=lowerInfoRemapped(search);info.bitflags&=~SPACE_BIT;info.parts=info.hasSpace?[...new Set(info._lower.split(/\s+/))].map(prepQuery):[];return info}function getPrepared(target){if(target.length>999)return prepTarget(target);let prepared=targetCache.get(target);if(prepared===void 0)targetCache.set(target,prepared=prepTarget(target));return prepared}function getQuery(search){if(search.length>999)return prepQuery(search);let prepared=searchCache.get(search);if(prepared===void 0){if(searchCache.size>=512)searchCache.clear();searchCache.set(search,prepared=prepQuery(search))}return prepared}function scanBeginnings(prepared,visit){let target=remapChars(prepared.target);let wasUpper=false;let wasAlnum=false;let count=0;for(let i=0;i<target.length;i++){let code=target.charCodeAt(i);let upper=code>=65&&code<=90;let alnum=upper||code>=97&&code<=122||code>=48&&code<=57;let beginning=upper&&!wasUpper||!wasAlnum||!alnum;wasUpper=upper;wasAlnum=alnum;if(beginning){count++;visit(i)}}prepared._beginningsLen=count}function indexBeginnings(prepared,firstTable,row,packed){if(prepared.target.length>=65535)return;let target=remapChars(prepared.target);let lowerCodes=prepared._targetLowerCodes;let offset=row*26;let wasUpper=false;let wasAlnum=false;let count=0;for(let i=0;i<target.length;i++){let code=target.charCodeAt(i);let upper=code>=65&&code<=90;let alnum=upper||code>=97&&code<=122||code>=48&&code<=57;let beginning=upper&&!wasUpper||!wasAlnum||!alnum;wasUpper=upper;wasAlnum=alnum;if(!beginning)continue;count++;packed.push(i);code=lowerCodes[i];if(code>=97&&code<=122){let slot=offset+code-97;if(firstTable[slot]===0)firstTable[slot]=i+1}}prepared._beginningsLen=count}function prepareSingleMatch(prepared,searchCode,fallbackIndex){let matchI=fallbackIndex;let strict=false;scanBeginnings(prepared,i=>{if(!strict&&searchCode===prepared._targetLowerCodes[i]){matchI=i;strict=true}});prepared._singleMatchCode=searchCode;prepared._singleMatchIndex=matchI;prepared._singleMatchStrict=strict}function makeBeginnings(prepared){let beginnings=[];scanBeginnings(prepared,i=>beginnings.push(i));return beginnings}function makeNextBeginnings(prepared){let next=[];let fill=0;scanBeginnings(prepared,i=>{for(;fill<i;fill++)next[fill]=i});for(;fill<prepared.target.length;fill++)next[fill]=prepared.target.length;return next}function remapCharacter(char){let remapped=remappings[char];if(remapped!==void 0)return remapped;if(char.charCodeAt(0)<128)return char;remapped=char.normalize(`NFKD`).replace(/[\u0300-\u036f]/g,``);return remapped.length===1?remapped:char}function remapChars(value){if(customAsciiRemappings)return value.replace(/[\s\S]/g,remapCharacter);return/[^\x00-\x7F]|[\\"`]/.test(value)?value.replace(/[^\x00-\x7F]|[\\"`]/g,remapCharacter):value}function lowerInfo(value){return lowerInfoRemapped(remapChars(value))}function lowerInfoRemapped(value){let lower=value.toLowerCase();let lowerCodes=[];let bitflags=0;let hasSpace=false;for(let i=0;i<lower.length;i++){let code=lowerCodes[i]=lower.charCodeAt(i);if(code===32){hasSpace=true;bitflags|=SPACE_BIT;continue}let bit=code>=97&&code<=122?code-97:code>=48&&code<=57?26:code<=127?30:31;bitflags|=1<<bit}return{lowerCodes,bitflags,hasSpace,_lower:lower}}var Result=class{get["indexes"](){return this._indexes.slice(0,this._indexes.len).sort((a,b)=>a-b)}set["indexes"](value){this._indexes=value}["highlight"](open,close,threshold){return highlight(this,open,close,threshold)}get["score"](){return normalizeScore(this._score)}};var KeysResult=class extends Array{get["score"](){return normalizeScore(this._score)}};function newResult(target,score=-INF,obj=null,lower=``,lowerCodes=null,bitflags=0){let result=new Result;result.target=target;result.obj=obj;result._score=score;result._indexes=[];result._targetLower=lower;result._targetLowerCodes=lowerCodes;result._nextBeginningIndexes=null;result._beginnings=null;result._beginningsLen=0;result._singleMatchCode=result._singleMatchIndex=-1;result._singleMatchStrict=false;result._bitflags=bitflags;return result}function materialize(prepared,obj=null){let result=new Result;result.target=prepared.target;result.obj=obj;result._score=prepared._score;result._indexes=prepared._indexes;return result}function markBestKeyScore(result){let best=-INF;for(let i=0;i<result.length;i++)if(result[i]!==noTarget&&result[i]._score>best)best=result[i]._score;for(let i=0;i<result.length;i++)if(result[i]!==noTarget)result[i]._bestKeyScore=best;return result}function captureKeysResult(matches,keysLength,obj,score,partWinners=false){let result=new KeysResult(keysLength);for(let k=0;k<keysLength;k++)result[k]=matches[k];result.obj=obj;result._score=score;if(partWinners)result._partWinners=true;return result}let normalizeScore=value=>value===-INF?0:value>1?value:Math.E**(((-value+1)**.04307-1)*-2);let denormalizeScore=value=>value===0?-INF:value>1?value:1-Math.pow(Math.log(value)/-2+1,1/.04307);let GOOD_PART_SCORE=denormalizeScore(.5);let isPrepared=value=>typeof value===`object`&&typeof value?._bitflags===`number`;function makeGetter(key){if(typeof key===`function`)return key;let path=Array.isArray(key)?key:typeof key===`string`&&key.includes(`.`)?key.split(`.`):null;if(path===null)return null;return obj=>{if(path!==key){let direct=obj[key];if(direct!==void 0)return direct}for(let i=0;obj&&i<path.length;i++)obj=obj[path[i]];return obj}}function scoreCeiling(searchLen,targetLen){let lengthPenalty=(targetLen-searchLen)/2;let bonus=1+searchLen*searchLen;let score=-lengthPenalty-lengthPenalty/(bonus*bonus);return score+Math.min(4,-score/2)}function bitCount(value){value-=value>>>1&1431655765;value=(value&858993459)+(value>>>2&858993459);return(value+(value>>>4)&252645135)*16843009>>>24}function lowerBound(values,start,end,value){while(start<end){let middle=start+end>>1;if(values[middle]<value)start=middle+1;else end=middle}return start}function nextBeginning(indexes,start,end,index,targetLen){let next=lowerBound(indexes,start,end,index+1);return next<end?indexes[next]:targetLen}function isBeginning(indexes,start,end,index){let found=lowerBound(indexes,start,end,index);return found<end&&indexes[found]===index}function getLimit(options){return(options?.limit??10)||INF}function scheduleTask(run){let id;if(typeof requestIdleCallback===`function`){id=requestIdleCallback(run,{timeout:100});return()=>typeof cancelIdleCallback===`function`&&cancelIdleCallback(id)}if(typeof setImmediate===`function`){id=setImmediate(run);return()=>typeof clearImmediate===`function`&&clearImmediate(id)}id=setTimeout(run);return()=>clearTimeout(id)}function createHeap(){let items=[];let length=0;function down(){let index=0;let item=items[0];for(let child=1;child<length;child=1+index*2){let right=child+1;index=right<length&&items[right]._score<items[child]._score?right:child;items[index-1>>1]=items[index]}for(let parent=index-1>>1;index>0&&item._score<items[parent]._score;parent=(index=parent)-1>>1)items[index]=items[parent];items[index]=item}return{add(item){let index=length++;for(let parent=index-1>>1;index>0&&item._score<items[parent]._score;parent=(index=parent)-1>>1)items[index]=items[parent];items[index]=item},poll(){if(!length)return;let root=items[0];let last=items[--length];items[length]=void 0;if(length){items[0]=last;down()}return root},peek(){return length?items[0]:void 0},replaceTop(item){items[0]=item;down()},clear(){items.length=length=0}}}let INF=Infinity;let SPACE_BIT=1<<27;let noResults=[];noResults.total=0;let targetCache=new Map,searchCache=new Map;let simpleMatch=[],strictMatch=[];let seen=[],seenAt=[];let changes=[],partials=[],spaceScores=[];let partIndexes=[],winnerIndexes=[],winnerScores=[],winnerKeys=[];let keyTargets=[],keyResults=[];let candidateBitOffsets=[];let seenGeneration=0;let remappings={};let remapFrom='\\"`‘’‚‛“”„‟«»‹›‐–—−⁄∕…øØłŁđĐðÐıħĦŧŦ';let remapTo=`/''''''''''''''----//.oOlLdDdDihHtT`;for(let i=0;i<35;i++)remappings[remapFrom[i]]=remapTo[i];let customAsciiRemappings=false;let heap=createHeap();let noTarget=prepTarget(``);let prunedMatch={};var fuzzysort_default={single,go,highlight,score,remap,prepare,snapshot,cleanup};const FUZZY_PREFIX=4;const FUZZY_SUBSTRING=3;const FUZZY_SUBSEQUENCE=2;const SUBSTRING=1;function localizedValues(text){if(text===void 0)return[];return typeof text===`string`?[text]:Object.values(text)}const WORD_CHAR=/[\p{L}\p{N}]/u;const UPPER=/\p{Lu}/u;const LOWER=/\p{Ll}/u;const UNSPACED=/[\p{scx=Han}\p{scx=Hira}\p{scx=Kana}\p{scx=Hang}]/u;function codePointAt(text,index){return String.fromCodePoint(text.codePointAt(index))}function codePointBefore(text,index){const low=text.charCodeAt(index-1);return codePointAt(text,low>=56320&&low<=57343&&index>=2?index-2:index-1)}function wordStart(text,index){if(index===0)return true;const char=codePointAt(text,index);const previous=codePointBefore(text,index);return!WORD_CHAR.test(previous)||UNSPACED.test(char)||UPPER.test(char)&&LOWER.test(previous)}const PRINTABLE_ASCII=/^[\x20-\x7e]*$/;const DIACRITIC=/[\u0300-\u036f]/gu;const STROKED={"ø":`o`,"Ø":`O`,"ł":`l`,"Ł":`L`,"đ":`d`,"Đ":`D`,"ð":`d`,"Ð":`D`,"ı":`i`,"ħ":`h`,"Ħ":`H`,"ŧ":`t`,"Ŧ":`T`};const STROKED_CHAR=/[øØłŁđĐðÐıħĦŧŦ]/gu;function strip(value){if(PRINTABLE_ASCII.test(value))return value;return value.normalize(`NFKD`).replace(DIACRITIC,``).normalize(`NFKC`).replace(STROKED_CHAR,char=>STROKED[char])}function fold(value){return strip(value).toLowerCase()}function prepareKeys(keys,reuse,into){return{fuzzy:(keys.fuzzy??[]).flatMap(value=>{if(value===void 0||value===``)return[];let name=into.fuzzy.get(value)??reuse?.fuzzy.get(value);if(name===void 0){const stripped=strip(value);name={stripped,folded:stripped.toLowerCase(),starts:void 0,tails:new Map}}into.fuzzy.set(value,name);return[name]}),substring:(keys.substring??[]).flatMap(value=>{if(value===void 0||value===``)return[];const folded=into.substring.get(value)??reuse?.substring.get(value)??fold(value);into.substring.set(value,folded);return[folded]})}}function build(items,keys,reuse){const preparations={fuzzy:new Map,substring:new Map};return{keys:items.map(item=>prepareKeys(keys(item),reuse,preparations)),preparations}}function inOrder(term,text){let at=0;for(const char of term){at=text.indexOf(char,at);if(at===-1)return false;at+=char.length}return true}function fuzzyNameScore(term,name){if(!inOrder(term.folded,name.folded))return void 0;if(name.starts===void 0){const starts=[];let index=0;for(const char of name.stripped){if(wordStart(name.stripped,index))starts.push(index);index+=char.length}name.starts=starts}const first=codePointAt(term.stripped,0).toLowerCase();let best;for(const start of name.starts){if(codePointAt(name.stripped,start).toLowerCase()!==first)continue;let tail=name.tails.get(start);if(tail===void 0){tail=fuzzysort_default.prepare(name.stripped.slice(start));name.tails.set(start,tail)}const result=fuzzysort_default.single(term.stripped,tail);if(result!==null&&wordStart(name.stripped,start+result.indexes[0]))best=best===void 0?result.score:Math.max(best,result.score)}return best}function termScore(term,keys){let best;const take=score=>{best=best===void 0?score:Math.max(best,score)};for(const name of keys.fuzzy){const at=name.folded.indexOf(term.folded);if(at===0)take(FUZZY_PREFIX);else if(at>0)take(FUZZY_SUBSTRING);else{const score=fuzzyNameScore(term,name);if(score!==void 0)take(FUZZY_SUBSEQUENCE+Math.min(score,.99))}}for(const text of keys.substring)if(text.includes(term.folded))take(SUBSTRING);return best}var TextSearchIndex=class TextSearchIndex{#items;#keys;#preparations;constructor(items,keys){const built=build(items,keys,void 0);this.#items=items;this.#keys=built.keys;this.#preparations=built.preparations}update(items,keys){const next=new TextSearchIndex([],keys);const built=build(items,keys,this.#preparations);next.#items=items;next.#keys=built.keys;next.#preparations=built.preparations;return next}search(query){const terms=query.trim().split(/\s+/u).map(term=>({stripped:strip(term),folded:fold(term)})).filter(term=>term.folded!==``);if(terms.length===0)return this.#items;const ranked=[];this.#keys.forEach((itemKeys,index)=>{let score=0;for(const term of terms){const hit=termScore(term,itemKeys);if(hit===void 0)return;score+=hit}ranked.push({index,score})});ranked.sort((left,right)=>right.score-left.score||left.index-right.index);return ranked.map(entry=>this.#items[entry.index])}};const CATEGORY_META={coding:{hue:222,glyph:`M9 6 3.5 12 9 18l1.4-1.4L6.2 12l4.2-4.6L9 6Zm6 0-1.4 1.4 4.2 4.6-4.2 4.6L15 18l5.5-6L15 6Z`},design:{hue:300,glyph:`M14.5 3.5a2.12 2.12 0 0 1 3 3L7 17l-4 1 1-4L14.5 3.5Zm1.4 1.4L6 14.8l-.5 1.7 1.7-.5L17.1 6.1a.7.7 0 0 0-1.2-1.2Z`},research:{hue:190,glyph:`M10 3a7 7 0 1 1 0 14 7 7 0 0 1 0-14Zm0 2.5a4.5 4.5 0 1 0 0 9 4.5 4.5 0 0 0 0-9ZM15.6 14.2l4.9 4.9-1.4 1.4-4.9-4.9 1.4-1.4Z`},product:{hue:28,glyph:`M12 2 21 7v10l-9 5-9-5V7l9-5Zm0 2.3L5.5 7.9 12 11.5l6.5-3.6L12 4.3ZM5 9.6l6 3.3v6.8l-6-3.3V9.6Zm14 0v6.8l-6 3.3v-6.8l6-3.3Z`},operations:{hue:140,glyph:`M4 20V10h3v10H4Zm6.5 0V4h3v16h-3ZM17 20v-7h3v7h-3Z`},writing:{hue:45,glyph:`M5 3h14v18l-3-2-2 2-2-2-2 2-2-2-3 2V3Zm3 4h8v1.5H8V7Zm0 4h8v1.5H8V11Z`}};const BOT_TEMPLATES=[{id:`code-reviewer`,category:`coding`,avatar:`prism`,featured:true,name:{zh:`代码审查员`,en:`Code Reviewer`},summary:{zh:`逐行审查改动,指出缺陷、风险与可维护性问题,给出可落地的修复建议。`,en:`Reviews changes line by line, flagging defects, risks, and maintainability issues with actionable fixes.`},retrievalSummary:{zh:`代码审查 代码评审 缺陷 风险 可维护性 pull request diff`,en:`code review pull request diff defect risk maintainability`},preset:{identity:{zh:`你是一名严谨的高级代码审查员。`,en:`You are a rigorous senior code reviewer.`},duties:{zh:`审查代码改动,定位正确性缺陷、边界与并发风险、性能与可维护性问题,并核对是否符合既有约定。`,en:`Review code changes for correctness defects, edge and concurrency risks, performance and maintainability issues, and conformance to existing conventions.`},workStyle:{zh:`先读上下文与相关测试,再按严重程度排序问题;每条结论给出文件位置、原因与具体修复建议,区分必须修复与可选优化。`,en:`Read the surrounding context and tests first, then rank findings by severity; each finding cites a location, a reason, and a concrete fix, separating must-fix from optional.`},replyStyle:{zh:`直接、具体、对事不对人;用简洁列表呈现问题,不堆砌客套。`,en:`Direct, specific, and impersonal; present findings as a concise list without pleasantries.`}}},{id:`refactor-expert`,category:`coding`,avatar:`orbit`,featured:false,name:{zh:`重构专家`,en:`Refactoring Expert`},summary:{zh:`在不改变行为的前提下收敛重复、澄清边界、简化数据流,让代码更易读易改。`,en:`Converges duplication, clarifies boundaries, and simplifies data flow without changing behavior.`},retrievalSummary:{zh:`重构 简化 重复 抽象 边界 数据流 可读性`,en:`refactor simplify duplication abstraction boundary data flow readability`},preset:{identity:{zh:`你是一名专注于结构改善的重构专家。`,en:`You are a refactoring expert focused on structural improvement.`},duties:{zh:`识别重复逻辑、混乱的状态归属与多余的转换层,提出保持行为不变的收敛方案。`,en:`Identify duplicated logic, confused state ownership, and redundant conversion layers, and propose behavior-preserving convergence.`},workStyle:{zh:`先确认现有测试与合同,再小步重构;每步说明动机与不变量,优先删除而非新增抽象。`,en:`Confirm existing tests and contracts first, then refactor in small steps; each step states its motivation and invariants, preferring deletion over new abstraction.`},replyStyle:{zh:`给出前后对比与理由,强调可读性与数据流是否更简单。`,en:`Show before/after with rationale, emphasizing whether readability and data flow became simpler.`}}},{id:`ui-designer`,category:`design`,avatar:`bloom`,featured:true,name:{zh:`UI 设计师`,en:`UI Designer`},summary:{zh:`把需求转成清晰的界面结构与视觉层级,关注一致性、可读性与可达性。`,en:`Turns requirements into clear layout and visual hierarchy with consistency, readability, and accessibility in mind.`},retrievalSummary:{zh:`界面设计 UI 视觉 层级 布局 配色 可达性 组件`,en:`ui design visual hierarchy layout color accessibility component`},preset:{identity:{zh:`你是一名注重细节的 UI 设计师。`,en:`You are a detail-oriented UI designer.`},duties:{zh:`设计界面结构、视觉层级与组件用法,确保配色、间距、圆角与状态反馈一致且可达。`,en:`Design layout, visual hierarchy, and component usage, keeping color, spacing, radius, and state feedback consistent and accessible.`},workStyle:{zh:`先理解用户目标与现有设计语言,再给出结构方案;优先复用既有组件与 token,说明每处取舍。`,en:`Understand the user goal and existing design language first, then propose structure; reuse existing components and tokens, explaining each tradeoff.`},replyStyle:{zh:`用清晰的结构描述界面,必要时给出组件与 token 的具体建议。`,en:`Describe the interface in clear structure, giving concrete component and token suggestions when useful.`}}},{id:`researcher`,category:`research`,avatar:`comet`,featured:true,name:{zh:`研究员`,en:`Researcher`},summary:{zh:`围绕问题检索与核实资料,交叉验证来源,输出有依据、可追溯的结论。`,en:`Gathers and verifies sources around a question, cross-checks them, and delivers grounded, traceable conclusions.`},retrievalSummary:{zh:`研究 调研 检索 核实 来源 证据 综述 分析`,en:`research investigation search verify source evidence survey analysis`},preset:{identity:{zh:`你是一名严谨的研究员。`,en:`You are a rigorous researcher.`},duties:{zh:`拆解研究问题,检索并核实资料,交叉验证来源,区分事实、推断与未知。`,en:`Decompose the research question, gather and verify sources, cross-check them, and separate fact, inference, and unknown.`},workStyle:{zh:`先界定问题与范围,再逐步收集证据;每条结论标注来源与可信度,遇到冲突来源时说明分歧。`,en:`Bound the question and scope first, then collect evidence step by step; cite a source and confidence for each conclusion and surface conflicting sources.`},replyStyle:{zh:`结构化呈现结论与依据,明确不确定之处,不臆断。`,en:`Present conclusions and evidence in structure, flag uncertainty explicitly, and never speculate.`}}},{id:`tech-scout`,category:`research`,avatar:`wave`,featured:false,name:{zh:`技术调研员`,en:`Tech Scout`},summary:{zh:`评估技术方案与工具,比较取舍、成熟度与风险,给出选型建议。`,en:`Evaluates technical options and tools, comparing tradeoffs, maturity, and risk to recommend a choice.`},retrievalSummary:{zh:`技术选型 方案对比 工具 评估 成熟度 风险 依赖`,en:`tech selection option comparison tool evaluation maturity risk dependency`},preset:{identity:{zh:`你是一名技术选型调研员。`,en:`You are a technical option scout.`},duties:{zh:`针对需求比较候选技术、库或方案,评估功能契合、维护状态、许可与兼容风险。`,en:`Compare candidate technologies, libraries, or approaches against the need, assessing fit, maintenance, license, and compatibility risk.`},workStyle:{zh:`先明确评估维度与约束,再逐项对比并给出证据;标注每个方案的未决风险与适用边界。`,en:`Fix evaluation dimensions and constraints first, then compare item by item with evidence; flag each option’s open risks and fit boundary.`},replyStyle:{zh:`用对比表呈现取舍,给出明确推荐与理由。`,en:`Present tradeoffs in a comparison table and give a clear recommendation with reasons.`}}},{id:`product-manager`,category:`product`,avatar:`peak`,featured:true,name:{zh:`产品经理`,en:`Product Manager`},summary:{zh:`澄清需求与用户路径,定义验收标准,拆解可交付的分期方案。`,en:`Clarifies requirements and user paths, defines acceptance criteria, and breaks work into deliverable phases.`},retrievalSummary:{zh:`产品 需求 用户路径 验收标准 分期 优先级 方案`,en:`product requirement user path acceptance criteria phase priority proposal`},preset:{identity:{zh:`你是一名以用户目标为中心的产品经理。`,en:`You are a user-goal-centered product manager.`},duties:{zh:`澄清真实需求与用户阻碍,定义完整用户路径与验收标准,拆解分期并排定优先级。`,en:`Clarify the real need and user friction, define the complete user path and acceptance criteria, and phase the work by priority.`},workStyle:{zh:`先问清目标与约束,再给出可验证的方案;优先删除摩擦而非堆砌功能,明确每期交付与遗留。`,en:`Ask for the goal and constraints first, then propose a verifiable plan; prefer removing friction over adding features, stating each phase’s delivery and leftovers.`},replyStyle:{zh:`结构化、可执行,突出用户价值与验收口径。`,en:`Structured and actionable, foregrounding user value and acceptance criteria.`}}},{id:`ops-copywriter`,category:`operations`,avatar:`leaf`,featured:false,name:{zh:`运营文案`,en:`Ops Copywriter`},summary:{zh:`撰写清晰有吸引力的运营与增长文案,匹配渠道语气与受众。`,en:`Writes clear, engaging operations and growth copy matched to channel tone and audience.`},retrievalSummary:{zh:`运营 文案 增长 活动 渠道 受众 转化 标题`,en:`operations copywriting growth campaign channel audience conversion headline`},preset:{identity:{zh:`你是一名运营文案策划。`,en:`You are an operations copywriter.`},duties:{zh:`为活动、公告与增长场景撰写文案,匹配渠道语气、受众与合规边界。`,en:`Write copy for campaigns, announcements, and growth scenarios, matching channel tone, audience, and compliance bounds.`},workStyle:{zh:`先确认目标受众与行动号召,再产出多个版本并说明适用场景;语言简洁、有重点、可执行。`,en:`Confirm the target audience and call to action first, then produce variants with their fit; keep language concise, focused, and actionable.`},replyStyle:{zh:`直接给出可用文案,必要时附简短说明与备选。`,en:`Deliver ready-to-use copy directly, with brief notes and alternatives when useful.`}}},{id:`tech-writer`,category:`writing`,avatar:`quill`,featured:false,name:{zh:`技术写作`,en:`Technical Writer`},summary:{zh:`把复杂技术内容写成结构清晰、准确易读的文档与说明。`,en:`Turns complex technical content into well-structured, accurate, readable documentation.`},retrievalSummary:{zh:`技术写作 文档 说明 结构 准确 可读 API 指南`,en:`technical writing documentation guide structure accuracy readability api`},preset:{identity:{zh:`你是一名技术文档作者。`,en:`You are a technical documentation author.`},duties:{zh:`撰写与维护文档、指南与说明,确保术语准确、结构清晰、示例可运行。`,en:`Write and maintain docs, guides, and explanations with accurate terms, clear structure, and runnable examples.`},workStyle:{zh:`先理清读者与任务,再按层级组织内容;用具体示例代替空泛描述,核对每处事实与代码一致。`,en:`Identify the reader and task first, then organize by hierarchy; use concrete examples over vague prose and verify every fact against the code.`},replyStyle:{zh:`简洁、准确、层级分明,避免冗余与行话堆砌。`,en:`Concise, accurate, and well-leveled, avoiding redundancy and jargon piles.`}}},{id:`translator`,category:`writing`,avatar:`spark`,featured:false,name:{zh:`翻译助手`,en:`Translator`},summary:{zh:`在保留语气与术语的前提下做中英互译,兼顾准确与流畅。`,en:`Translates between Chinese and English, preserving tone and terminology while staying accurate and fluent.`},retrievalSummary:{zh:`翻译 中英互译 术语 语气 本地化 流畅`,en:`translation chinese english terminology tone localization fluency`},preset:{identity:{zh:`你是一名专业翻译。`,en:`You are a professional translator.`},duties:{zh:`在中英之间翻译文本,保留原意、语气与专有术语,兼顾目标语言的自然流畅。`,en:`Translate between Chinese and English, preserving meaning, tone, and proper terms while keeping the target natural and fluent.`},workStyle:{zh:`先判断文体与受众,再翻译;术语保持一致,遇到歧义或文化负载表达时说明处理选择。`,en:`Judge register and audience first, then translate; keep terms consistent and explain choices for ambiguous or culture-loaded expressions.`},replyStyle:{zh:`直接给出译文,必要时附简短译注。`,en:`Deliver the translation directly, with brief notes when needed.`}}}];function templateToDraft(template,resolve){return{name:resolve(template.name),avatar:template.avatar,retrievalSummary:resolve(template.retrievalSummary),templateId:template.id,preset:{identity:resolve(template.preset.identity),duties:resolve(template.preset.duties),workStyle:resolve(template.preset.workStyle),replyStyle:resolve(template.preset.replyStyle)}}}var BotMarket_module_css_default={"addButton":`kkzyQa_addButton`,"addedTag":`kkzyQa_addedTag`,"card":`kkzyQa_card`,"cardBody":`kkzyQa_cardBody`,"cardMain":`kkzyQa_cardMain`,"cardName":`kkzyQa_cardName`,"cardSummary":`kkzyQa_cardSummary`,"error":`kkzyQa_error`,"featuredRow":`kkzyQa_featuredRow`,"grid":`kkzyQa_grid`,"groupCount":`kkzyQa_groupCount`,"groupHeader":`kkzyQa_groupHeader`,"groupTitle":`kkzyQa_groupTitle`,"market":`kkzyQa_market`,"pills":`kkzyQa_pills`,"preview":`kkzyQa_preview`,"previewCategory":`kkzyQa_previewCategory`,"previewField":`kkzyQa_previewField`,"previewHead":`kkzyQa_previewHead`,"previewHeading":`kkzyQa_previewHeading`,"previewLabel":`kkzyQa_previewLabel`,"previewName":`kkzyQa_previewName`,"previewSection":`kkzyQa_previewSection`,"previewSummary":`kkzyQa_previewSummary`,"previewValue":`kkzyQa_previewValue`,"search":`kkzyQa_search`,"searchClear":`kkzyQa_searchClear`,"section":`kkzyQa_section`,"sectionTitle":`kkzyQa_sectionTitle`,"state":`kkzyQa_state`,"toolbar":`kkzyQa_toolbar`,"viewAll":`kkzyQa_viewAll`};const CATEGORY_LABEL={coding:`categoryCoding`,design:`categoryDesign`,research:`categoryResearch`,product:`categoryProduct`,operations:`categoryOperations`,writing:`categoryWriting`};const GROUPS=Object.keys(CATEGORY_META).map(category=>({category,templates:BOT_TEMPLATES.filter(template=>template.category===category)})).filter(group=>group.templates.length>0).sort((a,b)=>b.templates.length-a.templates.length);function templateKeys(template){return{fuzzy:[template.id,...localizedValues(template.name)],substring:[...localizedValues(template.summary),...localizedValues(template.retrievalSummary)]}}const PREVIEW_LIMIT=6;const FLAT_LIMIT=24;const DEBOUNCE_MS=250;function AddControl({added,adding,t,onAdd}){if(added)return(0,react_jsx_runtime.jsxs)(`span`,{className:BotMarket_module_css_default.addedTag,children:[(0,react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives_client.IconCheckOutlineRegular,{size:12}),t(`added`)]});return(0,react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives_client.Button,{size:`sm`,variant:`outline`,className:BotMarket_module_css_default.addButton,disabled:adding,"aria-label":t(`add`),onClick:onAdd,children:adding?(0,react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives_client.StateDot,{state:`ongoing`}):(0,react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives_client.IconPlusOutlineRegular,{size:14})})}function TemplateCard({template,resolveText,added,adding,t,onAdd,onPreview}){return(0,react_jsx_runtime.jsxs)(`div`,{className:BotMarket_module_css_default.card,children:[(0,react_jsx_runtime.jsxs)(`button`,{type:`button`,className:BotMarket_module_css_default.cardMain,onClick:onPreview,children:[(0,react_jsx_runtime.jsx)(BotAvatar,{avatar:template.avatar,size:48}),(0,react_jsx_runtime.jsxs)(`span`,{className:BotMarket_module_css_default.cardBody,children:[(0,react_jsx_runtime.jsx)(`span`,{className:BotMarket_module_css_default.cardName,children:resolveText(template.name)}),(0,react_jsx_runtime.jsx)(`span`,{className:BotMarket_module_css_default.cardSummary,children:resolveText(template.summary)})]})]}),(0,react_jsx_runtime.jsx)(AddControl,{added,adding,t,onAdd})]})}function BotMarket({t,resolveText,bots,addTemplate,onOpenBot}){const[input,setInput]=(0,react.useState)(``);const[query,setQuery]=(0,react.useState)(``);const[category,setCategory]=(0,react.useState)(`all`);const[addingId,setAddingId]=(0,react.useState)(null);const[preview,setPreview]=(0,react.useState)(null);const[error,setError]=(0,react.useState)(null);(0,react.useEffect)(()=>{const timer=setTimeout(()=>{setQuery(input)},DEBOUNCE_MS);return()=>{clearTimeout(timer)}},[input]);const index=(0,react.useMemo)(()=>new TextSearchIndex(BOT_TEMPLATES,templateKeys),[]);const matches=(0,react.useMemo)(()=>index.search(query),[index,query]);const addedIds=(0,react.useMemo)(()=>new Set(bots.flatMap(bot=>bot.templateId===void 0?[]:[bot.templateId])),[bots]);const visible=category===`all`?matches:matches.filter(template=>template.category===category);const flat=query.trim()!==``||category!==`all`;const featured=BOT_TEMPLATES.filter(template=>template.featured);const add=template=>{if(addingId!==null)return;setAddingId(template.id);setError(null);addTemplate(template).catch(caught=>{console.error(`[dsh-bot-agent] template add failed`,caught);setError(t(`addFailed`))}).finally(()=>{setAddingId(null)})};const card=template=>(0,react_jsx_runtime.jsx)(TemplateCard,{template,resolveText,added:addedIds.has(template.id),adding:addingId===template.id,t,onAdd:()=>{add(template)},onPreview:()=>{setPreview(template)}},template.id);const previewBot=preview===null?void 0:bots.find(bot=>bot.templateId===preview.id);return(0,react_jsx_runtime.jsxs)(`div`,{className:BotMarket_module_css_default.market,children:[(0,react_jsx_runtime.jsxs)(`div`,{className:BotMarket_module_css_default.toolbar,children:[(0,react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives_client.Input,{className:BotMarket_module_css_default.search,type:`search`,icon:(0,react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives_client.IconSearchOutlineRegular,{size:16}),value:input,placeholder:t(`searchPlaceholder`),"aria-label":t(`searchPlaceholder`),onChange:event=>{setInput(event.currentTarget.value)}}),input!==``&&(0,react_jsx_runtime.jsx)(`button`,{type:`button`,className:BotMarket_module_css_default.searchClear,"aria-label":t(`searchClear`),onClick:()=>{setInput(``)},children:(0,react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives_client.IconCloseOutlineRegular,{size:14})})]}),(0,react_jsx_runtime.jsxs)(`div`,{className:BotMarket_module_css_default.pills,children:[(0,react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives_client.Pill,{active:category===`all`,onClick:()=>{setCategory(`all`)},children:t(`filterAll`)}),GROUPS.map(group=>(0,react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives_client.Pill,{active:category===group.category,onClick:()=>{setCategory(group.category)},children:t(CATEGORY_LABEL[group.category])},group.category))]}),error!==null&&(0,react_jsx_runtime.jsx)(`p`,{className:BotMarket_module_css_default.error,role:`alert`,children:error}),flat?(0,react_jsx_runtime.jsx)(`div`,{className:BotMarket_module_css_default.section,children:visible.length===0?(0,react_jsx_runtime.jsx)(`div`,{className:BotMarket_module_css_default.state,children:t(`marketEmpty`)}):(0,react_jsx_runtime.jsx)(`div`,{className:BotMarket_module_css_default.grid,children:visible.slice(0,FLAT_LIMIT).map(card)})}):(0,react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment,{children:[(0,react_jsx_runtime.jsxs)(`section`,{className:BotMarket_module_css_default.section,children:[(0,react_jsx_runtime.jsx)(`h2`,{className:BotMarket_module_css_default.sectionTitle,children:t(`featured`)}),(0,react_jsx_runtime.jsx)(`div`,{className:BotMarket_module_css_default.featuredRow,children:featured.map(card)})]}),GROUPS.map(group=>(0,react_jsx_runtime.jsxs)(`section`,{className:BotMarket_module_css_default.section,children:[(0,react_jsx_runtime.jsxs)(`div`,{className:BotMarket_module_css_default.groupHeader,children:[(0,react_jsx_runtime.jsx)(HueTile,{hue:CATEGORY_META[group.category].hue,glyph:CATEGORY_META[group.category].glyph,size:28}),(0,react_jsx_runtime.jsx)(`span`,{className:BotMarket_module_css_default.groupTitle,children:t(CATEGORY_LABEL[group.category])}),(0,react_jsx_runtime.jsx)(`span`,{className:BotMarket_module_css_default.groupCount,children:group.templates.length}),(0,react_jsx_runtime.jsxs)(`button`,{type:`button`,className:BotMarket_module_css_default.viewAll,onClick:()=>{setCategory(group.category)},children:[t(`viewAll`),(0,react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives_client.IconChevronRightOutlineRegular,{size:14})]})]}),(0,react_jsx_runtime.jsx)(`div`,{className:BotMarket_module_css_default.grid,children:group.templates.slice(0,PREVIEW_LIMIT).map(card)})]},group.category))]}),(0,react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives_client.Modal,{open:preview!==null,onClose:()=>{setPreview(null)},title:preview===null?``:resolveText(preview.name),closeLabel:t(`close`),footer:preview===null?void 0:previewBot!==void 0?(0,react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives_client.Button,{variant:`primary`,onClick:()=>{onOpenBot(previewBot.id);setPreview(null)},children:t(`openInMine`)}):(0,react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives_client.Button,{variant:`primary`,disabled:addingId===preview.id,onClick:()=>{add(preview)},children:addingId===preview.id?t(`adding`):t(`add`)}),children:preview!==null&&(0,react_jsx_runtime.jsxs)(`div`,{className:BotMarket_module_css_default.preview,children:[(0,react_jsx_runtime.jsxs)(`div`,{className:BotMarket_module_css_default.previewHead,children:[(0,react_jsx_runtime.jsx)(BotAvatar,{avatar:preview.avatar,size:48}),(0,react_jsx_runtime.jsxs)(`div`,{className:BotMarket_module_css_default.previewHeading,children:[(0,react_jsx_runtime.jsx)(`span`,{className:BotMarket_module_css_default.previewName,children:resolveText(preview.name)}),(0,react_jsx_runtime.jsxs)(`span`,{className:BotMarket_module_css_default.previewCategory,children:[(0,react_jsx_runtime.jsx)(HueTile,{hue:CATEGORY_META[preview.category].hue,glyph:CATEGORY_META[preview.category].glyph,size:16}),t(CATEGORY_LABEL[preview.category])]})]})]}),(0,react_jsx_runtime.jsx)(`p`,{className:BotMarket_module_css_default.previewSummary,children:resolveText(preview.summary)}),(0,react_jsx_runtime.jsx)(`div`,{className:BotMarket_module_css_default.previewSection,children:t(`presetSection`)}),(0,react_jsx_runtime.jsx)(PreviewField,{label:t(`fieldIdentity`),value:resolveText(preview.preset.identity)}),(0,react_jsx_runtime.jsx)(PreviewField,{label:t(`fieldDuties`),value:resolveText(preview.preset.duties)}),(0,react_jsx_runtime.jsx)(PreviewField,{label:t(`fieldWorkStyle`),value:resolveText(preview.preset.workStyle)}),(0,react_jsx_runtime.jsx)(PreviewField,{label:t(`fieldReplyStyle`),value:resolveText(preview.preset.replyStyle)}),(0,react_jsx_runtime.jsx)(`div`,{className:BotMarket_module_css_default.previewSection,children:t(`retrievalSection`)}),(0,react_jsx_runtime.jsx)(PreviewField,{label:t(`fieldRetrievalSummary`),value:resolveText(preview.retrievalSummary)})]})})]})}function PreviewField({label,value}){return(0,react_jsx_runtime.jsxs)(`div`,{className:BotMarket_module_css_default.previewField,children:[(0,react_jsx_runtime.jsx)(`span`,{className:BotMarket_module_css_default.previewLabel,children:label}),(0,react_jsx_runtime.jsx)(`span`,{className:BotMarket_module_css_default.previewValue,children:value})]})}var BotPanel_module_css_default={"badge":`_2S7_Cq_badge`,"card":`_2S7_Cq_card`,"cardBody":`_2S7_Cq_cardBody`,"cardName":`_2S7_Cq_cardName`,"cardSummary":`_2S7_Cq_cardSummary`,"frame":`_2S7_Cq_frame`,"grid":`_2S7_Cq_grid`,"header":`_2S7_Cq_header`,"state":`_2S7_Cq_state`,"subtitle":`_2S7_Cq_subtitle`,"title":`_2S7_Cq_title`};const NEW_ID=`__new__`;function BotPanel({t,useStore,actions,refresh,createBot,updateBot,removeBot,startSession,resolveText,addTemplate}){const bots=useStore(state=>state.bots);const status=useStore(state=>state.status);const error=useStore(state=>state.error);const selectedId=useStore(state=>state.selectedId);const view=useStore(state=>state.view);const[saving,setSaving]=(0,react.useState)(false);(0,react.useEffect)(()=>{refresh()},[refresh]);const save=draft=>{setSaving(true);(selectedId===NEW_ID?createBot(draft):updateBot(selectedId,draft)).then(bot=>{actions.select(bot.id)}).catch(()=>void 0).finally(()=>{setSaving(false)})};const remove=id=>{removeBot(id).then(()=>{actions.select(null)}).catch(()=>void 0)};const openBot=id=>{actions.select(id);actions.setView(`mine`)};const inDetail=view===`mine`&&selectedId!==null;const switcher=(0,react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives_client.SegmentedControl,{id:`bot-agent-view`,value:view,label:t(`viewSwitcher`),options:[{value:`mine`,label:t(`tabMine`)},{value:`market`,label:t(`tabMarket`)}],onChange:next=>{actions.setView(next)}});if(inDetail){const bot=selectedId===NEW_ID?null:bots.find(candidate=>candidate.id===selectedId)??null;return(0,react_jsx_runtime.jsx)(`div`,{className:BotPanel_module_css_default.frame,children:(0,react_jsx_runtime.jsx)(BotDetail,{bot,t,saving,onSave:save,onDelete:()=>{if(selectedId!==NEW_ID)remove(selectedId)},onStartSession:()=>{if(bot!==null)startSession(bot.id)},onBack:()=>{actions.select(null)}},selectedId)})}if(view===`market`)return(0,react_jsx_runtime.jsxs)(`div`,{className:BotPanel_module_css_default.frame,children:[switcher,(0,react_jsx_runtime.jsx)(BotMarket,{t,resolveText,bots,addTemplate,onOpenBot:openBot})]});return(0,react_jsx_runtime.jsxs)(`div`,{className:BotPanel_module_css_default.frame,children:[switcher,(0,react_jsx_runtime.jsxs)(`div`,{className:BotPanel_module_css_default.header,children:[(0,react_jsx_runtime.jsxs)(`div`,{children:[(0,react_jsx_runtime.jsx)(`h1`,{className:BotPanel_module_css_default.title,children:t(`title`)}),(0,react_jsx_runtime.jsx)(`p`,{className:BotPanel_module_css_default.subtitle,children:t(`subtitle`)})]}),(0,react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives_client.Button,{variant:`primary`,icon:(0,react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives_client.IconPlusOutlineRegular,{size:16}),onClick:()=>{actions.select(NEW_ID)},children:t(`create`)})]}),status===`error`?(0,react_jsx_runtime.jsxs)(`div`,{className:BotPanel_module_css_default.state,children:[(0,react_jsx_runtime.jsxs)(`span`,{children:[t(`error`),error===null?``:`: ${error}`]}),(0,react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives_client.Button,{size:`sm`,onClick:()=>{refresh()},children:t(`retry`)})]}):status===`ready`&&bots.length===0?(0,react_jsx_runtime.jsx)(`div`,{className:BotPanel_module_css_default.state,children:t(`empty`)}):(0,react_jsx_runtime.jsx)(`div`,{className:BotPanel_module_css_default.grid,children:bots.map(bot=>(0,react_jsx_runtime.jsxs)(`button`,{type:`button`,className:BotPanel_module_css_default.card,onClick:()=>{actions.select(bot.id)},children:[(0,react_jsx_runtime.jsx)(BotAvatar,{avatar:bot.avatar,size:48}),(0,react_jsx_runtime.jsxs)(`span`,{className:BotPanel_module_css_default.cardBody,children:[(0,react_jsx_runtime.jsxs)(`span`,{className:BotPanel_module_css_default.cardName,children:[bot.name,bot.builtin&&(0,react_jsx_runtime.jsx)(`span`,{className:BotPanel_module_css_default.badge,children:t(`builtin`)})]}),(0,react_jsx_runtime.jsx)(`span`,{className:BotPanel_module_css_default.cardSummary,children:bot.preset.duties||bot.retrievalSummary||t(`dutiesFallback`)})]})]},bot.id))})]})}function BotPanelIcon({size}){return(0,react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives_client.IconAgentPresetOutlineRegular,{size})}function SessionRowAvatar({agentPreset,useStore}){const bots=useStore(state=>state.bots);if(agentPreset===void 0)return null;const bot=bots.find(candidate=>candidate.id===agentPreset);if(bot===void 0)return null;return(0,react_jsx_runtime.jsx)(BotAvatar,{avatar:bot.avatar,size:20})}function createBotMentionSource(deps){const claimFor=bot=>({name:bot.id,token:`@${bot.name} `,submit:async(args,actx,attachments)=>{if(attachments.length>0)throw new Error(deps.t(`mentionAttachmentsUnsupported`,{name:bot.name}));return deps.dispatch(bot,args,actx)}});const byNameLength=()=>[...deps.bots()].sort((a,b)=>b.name.length-a.name.length);const exactBot=token=>deps.bots().find(bot=>`@${bot.name}`===token);return{trigger:`@`,name:`bot`,label:deps.t(`mentionGroup`),order:-1,candidates(_session,req){const rows=deps.bots().map(bot=>({name:bot.name,label:bot.name,description:bot.retrievalSummary.trim()||bot.preset.duties.trim()||deps.t(`dutiesFallback`),value:bot.id}));return Promise.resolve(req.query===``?rows:new TextSearchIndex(rows,row=>({fuzzy:[row.name,row.label]})).search(req.query))},onPick(pick){const bot=deps.bots().find(item=>item.id===pick.candidate.value);return bot===void 0?void 0:{claim:claimFor(bot)}},matchSpace(_session,token){const bot=exactBot(token);return bot===void 0?void 0:{claim:claimFor(bot)}},async matchEnter(_session,line,_signal,envelope){const trimmed=line.trim();if(!trimmed.startsWith(`@`))return void 0;for(const bot of byNameLength()){const mention=`@${bot.name}`;if(!trimmed.startsWith(mention))continue;const rest=trimmed.slice(mention.length);if(rest!==``&&!/^\s/u.test(rest))continue;if(envelope.attachments>0)throw new Error(deps.t(`mentionAttachmentsUnsupported`,{name:bot.name}));return{claim:claimFor(bot)}}},async matchClaim(_session,token){const bot=exactBot(token);return bot===void 0?void 0:claimFor(bot)}}}const zh={panel:`智能体`,title:`智能体`,subtitle:`为会话配置身份、职责与回复风格`,empty:`还没有智能体`,create:`新建智能体`,builtin:`内置`,fieldName:`名字`,fieldAvatar:`头像`,fieldIdentity:`身份`,fieldDuties:`职责`,fieldWorkStyle:`工作方式`,fieldReplyStyle:`回复风格`,fieldRetrievalSummary:`检索摘要`,presetSection:`预设`,retrievalSection:`检索`,identityPlaceholder:`这个智能体是谁`,dutiesPlaceholder:`它负责什么`,workStylePlaceholder:`它如何工作`,replyStylePlaceholder:`它如何回复`,retrievalSummaryPlaceholder:`用于路由匹配的场景与能力摘要`,save:`保存`,saving:`保存中…`,cancel:`取消`,delete:`删除`,deleteConfirm:`删除该智能体?已有会话保留,但不再显示其头像。`,startSession:`新建会话`,back:`返回`,loading:`加载中…`,error:`加载失败`,retry:`重试`,avatarPicker:`选择头像`,dutiesFallback:`通用助手`,saved:`已保存`,deleted:`已删除`,nameRequired:`名字不能为空`,readonlyPolicy:`知识库、技能与工具范围将在后续版本生效`,mentionGroup:`智能体`,mentionAttachmentsUnsupported:`派单给「{name}」暂不支持附件`,mentionNoWorkspace:`当前没有可用的工作区,无法派单`,tabMine:`我的智能体`,tabMarket:`智能体市场`,viewSwitcher:`智能体视图`,marketSubtitle:`发现预设智能体,一键复制为我的智能体`,searchPlaceholder:`搜索智能体`,searchClear:`清除搜索`,filterAll:`全部`,featured:`精选`,viewAll:`查看全部`,add:`添加`,adding:`添加中…`,added:`已添加`,addFailed:`添加失败`,marketEmpty:`没有匹配的智能体`,openInMine:`去我的智能体配置`,close:`关闭`,categoryCoding:`编程开发`,categoryDesign:`设计`,categoryResearch:`研究调研`,categoryProduct:`产品`,categoryOperations:`运营`,categoryWriting:`写作翻译`};const en={panel:`Agents`,title:`Agents`,subtitle:`Configure identity, duties, and reply style for a session`,empty:`No agents yet`,create:`New agent`,builtin:`Built-in`,fieldName:`Name`,fieldAvatar:`Avatar`,fieldIdentity:`Identity`,fieldDuties:`Duties`,fieldWorkStyle:`Work style`,fieldReplyStyle:`Reply style`,fieldRetrievalSummary:`Retrieval summary`,presetSection:`Preset`,retrievalSection:`Retrieval`,identityPlaceholder:`Who this agent is`,dutiesPlaceholder:`What it is responsible for`,workStylePlaceholder:`How it works`,replyStylePlaceholder:`How it replies`,retrievalSummaryPlaceholder:`Scenario and capability summary used for routing`,save:`Save`,saving:`Saving…`,cancel:`Cancel`,delete:`Delete`,deleteConfirm:`Delete this agent? Existing sessions stay, but no longer show its avatar.`,startSession:`New session`,back:`Back`,loading:`Loading…`,error:`Failed to load`,retry:`Retry`,avatarPicker:`Choose avatar`,dutiesFallback:`General assistant`,saved:`Saved`,deleted:`Deleted`,nameRequired:`Name cannot be empty`,readonlyPolicy:`Knowledge, skill, and tool scope take effect for new sessions`,mentionGroup:`Agents`,mentionAttachmentsUnsupported:`Dispatching to "{name}" does not support attachments yet`,mentionNoWorkspace:`No workspace is available to dispatch into`,tabMine:`My Agents`,tabMarket:`Agent Market`,viewSwitcher:`Agent view`,marketSubtitle:`Discover preset agents and copy one into your own in a click`,searchPlaceholder:`Search agents`,searchClear:`Clear search`,filterAll:`All`,featured:`Featured`,viewAll:`View all`,add:`Add`,adding:`Adding…`,added:`Added`,addFailed:`Could not add`,marketEmpty:`No matching agents`,openInMine:`Configure in My Agents`,close:`Close`,categoryCoding:`Coding`,categoryDesign:`Design`,categoryResearch:`Research`,categoryProduct:`Product`,categoryOperations:`Operations`,categoryWriting:`Writing`};const NS=`botAgent`;const PANEL_ID=`bot-agent`;const inject=[`slots`,`locale`,`uiWorkspace`,`inputTriggers`,`sessions`,`workspaces`];function apply(ctx){ctx.effect(()=>ctx.locale.register(NS,{zh,en}),`bot-agent: dictionaries`);const t=ctx.locale.bind(NS);const api=new BotApi;const handle=createBotStore();const instance=handle.create();const store={...handle,create:()=>instance};const refresh=async()=>{instance.actions.setLoading();try{instance.actions.setBots(await api.list())}catch(error){instance.actions.setError(error instanceof Error?error.message:String(error))}};const createBot=async draft=>{const bot=await api.create(draft);await refresh();return bot};const updateBot=async(id,draft)=>{const bot=await api.update(id,draft);await refresh();return bot};const removeBot=async id=>{await api.remove(id);await refresh()};const startSession=presetId=>{ctx.uiWorkspace.startSession(void 0,{agentPreset:presetId})};const resolveText=text=>ctx.locale.resolveText(text);const addTemplate=async template=>{const bot=await api.create(templateToDraft(template,resolveText));await refresh();return bot};const injected=()=>({refresh,createBot,updateBot,removeBot,startSession,resolveText,addTemplate});ctx.slots.inject(`main`,()=>ctx.slots.register({name:`main`,key:PANEL_ID,locale:NS,store,inject:injected},BotPanel));ctx.slots.inject(`sidebar.panellist`,()=>ctx.slots.register({name:`sidebar.panellist`,id:PANEL_ID,order:12,label:()=>t(`panel`),locale:NS},BotPanelIcon));ctx.slots.inject(`sidebar.session.row.avatar`,()=>ctx.slots.register({name:`sidebar.session.row.avatar`,id:`bot-agent`,store},SessionRowAvatar));ctx.slots.inject(`subagent.catalog.row.avatar`,()=>ctx.slots.register({name:`subagent.catalog.row.avatar`,id:`bot-agent`,store},SessionRowAvatar));const dispatch=async(bot,args,actx)=>{const currentId=ctx.sessions.scopeOf(actx);const workspaces=ctx.workspaces.list.getSnapshot();const workspace=workspaces.items.find(item=>currentId!==void 0&&item.sessionIds.includes(currentId))??workspaces.items[0];if(workspace===void 0)throw new Error(t(`mentionNoWorkspace`));const sessionId=await ctx.uiWorkspace.connectWorkspace(workspace.workspaceId,{agentPreset:bot.id});const text=args.trim();if(text!==``)await ctx.sessions.using(sessionId,{source:`botDispatch`},async reference=>{await reference.ready;const state=reference.binding.session.getSnapshot();if(state.openState!==`open`)throw state.openError??new Error(`session "${sessionId}" is not open`);const result=await reference.binding.session.prompt([{type:`text`,text}],`queue`);if(!result.ok)throw new Error(`${result.error.code}: ${result.error.message}`)});ctx.uiWorkspace.openSession(sessionId);return{kind:`success`}};const inputTriggers=ctx.get(`inputTriggers`);ctx.effect(()=>inputTriggers.registerSource(createBotMentionSource({bots:()=>instance.getSnapshot().bots,dispatch,t})),`bot-agent: @bot source`);refresh();ctx.effect(()=>ctx.on(`connection/reset`,()=>{refresh()}),`bot-agent: reload on reconnect`)}exports.NS=NS;exports.PANEL_ID=PANEL_ID;exports.apply=apply;exports.inject=inject;return module.exports},meta:()=>({stylesheets:{"src/client/BotAvatarPicker.module.css":{text:context=>`.CtZ5_a_grid{grid-template-columns:repeat(auto-fill,minmax(48px,1fr));gap:8px;display:grid}.CtZ5_a_cell{cursor:pointer;background:0 0;border:1px solid #0000;border-radius:14px;justify-content:center;align-items:center;padding:4px;display:inline-flex}.CtZ5_a_cell:hover{background:var(--dsw-alias-interactive-bg-hover)}.CtZ5_a_selected{border-color:var(--dsw-alias-state-business-primary);background:var(--dsw-alias-interactive-bg-hover)}`},"src/client/BotDetail.module.css":{text:context=>`.uf6FhW_detail{flex-direction:column;gap:16px;display:flex}.uf6FhW_header{align-items:center;gap:12px;display:flex}.uf6FhW_back{color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:8px;padding:4px 8px;font-size:13px}.uf6FhW_back:hover{background:var(--dsw-alias-interactive-bg-hover)}.uf6FhW_heading{flex:1;align-items:center;gap:8px;min-width:0;display:flex}.uf6FhW_title{color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;font-size:18px;font-weight:600;overflow:hidden}.uf6FhW_badge{color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-interactive-bg-hover);border-radius:6px;flex:none;padding:1px 6px;font-size:11px;font-weight:500}.uf6FhW_field{flex-direction:column;gap:4px;display:flex}.uf6FhW_label{color:var(--dsw-alias-label-secondary);font-size:13px;font-weight:500}.uf6FhW_input,.uf6FhW_textarea{box-sizing:border-box;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);width:100%;color:var(--dsw-alias-label-primary);border-radius:8px;padding:8px 10px;font-family:inherit;font-size:14px;line-height:20px}.uf6FhW_textarea{resize:vertical}.uf6FhW_input:focus,.uf6FhW_textarea:focus{border-color:var(--dsw-alias-state-business-primary);outline:none}.uf6FhW_section{color:var(--dsw-alias-label-primary);margin-top:8px;font-size:13px;font-weight:600}.uf6FhW_note{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px}.uf6FhW_error{color:var(--dsw-alias-state-error-primary);margin:0;font-size:12px}.uf6FhW_actions{align-items:center;gap:8px;display:flex}.uf6FhW_danger{color:var(--dsw-alias-state-error-primary);border-color:var(--dsw-alias-state-error-secondary)}`},"src/client/BotMarket.module.css":{text:context=>`.kkzyQa_market{flex-direction:column;gap:24px;display:flex}.kkzyQa_toolbar{align-items:center;display:flex;position:relative}.kkzyQa_search{width:100%}.kkzyQa_searchClear{width:24px;height:24px;color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:0;border-radius:6px;place-items:center;display:grid;position:absolute;inset-inline-end:8px}.kkzyQa_searchClear:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}.kkzyQa_pills{flex-wrap:wrap;gap:8px;display:flex}.kkzyQa_section{flex-direction:column;gap:12px;display:flex}.kkzyQa_sectionTitle{color:var(--dsw-alias-label-primary);margin:0;font-size:15px;font-weight:600}.kkzyQa_featuredRow{scroll-snap-type:x proximity;gap:16px;padding-bottom:4px;display:flex;overflow-x:auto}.kkzyQa_featuredRow>.kkzyQa_card{scroll-snap-align:start;flex:0 0 300px}.kkzyQa_grid{grid-template-columns:repeat(auto-fill,minmax(min(100%,320px),1fr));gap:4px 24px;display:grid}.kkzyQa_card{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);border-radius:14px;align-items:center;gap:8px;padding:16px;display:flex}.kkzyQa_card:hover{background:var(--dsw-alias-interactive-bg-hover)}.kkzyQa_cardMain{cursor:pointer;text-align:left;background:0 0;border:0;flex:1;align-items:center;gap:8px;min-width:0;padding:0;display:flex}.kkzyQa_cardBody{flex-direction:column;gap:4px;min-width:0;display:flex}.kkzyQa_cardName{color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;font-size:14px;font-weight:600;overflow:hidden}.kkzyQa_cardSummary{color:var(--dsw-alias-label-tertiary);-webkit-line-clamp:2;-webkit-box-orient:vertical;font-size:13px;display:-webkit-box;overflow:hidden}.kkzyQa_addButton{flex:none}.kkzyQa_addedTag{color:var(--dsw-alias-state-success-primary,var(--dsw-alias-label-secondary));background:var(--dsw-alias-interactive-bg-hover);border-radius:8px;flex:none;align-items:center;gap:4px;padding:2px 8px;font-size:12px;font-weight:500;display:inline-flex}.kkzyQa_groupHeader{align-items:center;gap:8px;display:flex}.kkzyQa_groupTitle{color:var(--dsw-alias-label-primary);font-size:14px;font-weight:600}.kkzyQa_groupCount{min-width:20px;height:20px;color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-interactive-bg-hover);border-radius:6px;place-items:center;padding:0 5px;font-size:12px;display:grid}.kkzyQa_viewAll{color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:0;border-radius:6px;align-items:center;gap:2px;margin-inline-start:auto;padding:2px 4px;font-size:13px;display:inline-flex}.kkzyQa_viewAll:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}.kkzyQa_state{color:var(--dsw-alias-label-tertiary);padding:24px;font-size:13px}.kkzyQa_error{color:var(--dsw-alias-state-error-primary);margin:0;font-size:13px}.kkzyQa_preview{flex-direction:column;gap:12px;display:flex}.kkzyQa_previewHead{align-items:center;gap:12px;display:flex}.kkzyQa_previewHeading{flex-direction:column;gap:4px;min-width:0;display:flex}.kkzyQa_previewName{color:var(--dsw-alias-label-primary);font-size:16px;font-weight:600}.kkzyQa_previewCategory{color:var(--dsw-alias-label-tertiary);align-items:center;gap:6px;font-size:12px;display:inline-flex}.kkzyQa_previewSummary{color:var(--dsw-alias-label-secondary);margin:0;font-size:13px}.kkzyQa_previewSection{color:var(--dsw-alias-label-secondary);margin-top:4px;font-size:13px;font-weight:600}.kkzyQa_previewField{flex-direction:column;gap:2px;display:flex}.kkzyQa_previewLabel{color:var(--dsw-alias-label-tertiary);font-size:12px}.kkzyQa_previewValue{color:var(--dsw-alias-label-primary);white-space:pre-wrap;font-size:13px}`},"src/client/BotPanel.module.css":{text:context=>`._2S7_Cq_frame{flex-direction:column;gap:24px;max-width:880px;margin:0 auto;padding:24px;display:flex}._2S7_Cq_header{justify-content:space-between;align-items:center;gap:16px;display:flex}._2S7_Cq_title{color:var(--dsw-alias-label-primary);margin:0;font-size:20px;font-weight:600}._2S7_Cq_subtitle{color:var(--dsw-alias-label-tertiary);margin:4px 0 0;font-size:13px}._2S7_Cq_grid{grid-template-columns:repeat(auto-fill,minmax(min(100%,320px),1fr));gap:4px 24px;display:grid}._2S7_Cq_card{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);cursor:pointer;text-align:left;border-radius:14px;align-items:center;gap:8px;padding:16px;display:flex}._2S7_Cq_card:hover{background:var(--dsw-alias-interactive-bg-hover)}._2S7_Cq_cardBody{flex-direction:column;gap:4px;min-width:0;display:flex}._2S7_Cq_cardName{color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;align-items:center;gap:8px;font-size:14px;font-weight:600;display:flex;overflow:hidden}._2S7_Cq_cardSummary{color:var(--dsw-alias-label-tertiary);-webkit-line-clamp:2;-webkit-box-orient:vertical;font-size:13px;display:-webkit-box;overflow:hidden}._2S7_Cq_badge{color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-interactive-bg-hover);border-radius:6px;flex:none;padding:1px 6px;font-size:11px;font-weight:500}._2S7_Cq_state{color:var(--dsw-alias-label-tertiary);align-items:center;gap:12px;padding:24px;font-size:13px;display:flex}`}}})});
3
+ //# sourceMappingURL=client.js.map