dsh-model-groups 0.3.4 → 0.3.6
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.
- package/README.md +148 -66
- package/lib/client.js +294 -4
- package/native/pi-ai.patch.json +507 -4
- package/native/settings-models.patch.json +408 -1
- package/package.json +6 -3
- package/scripts/build.mjs +6 -1
- package/scripts/doctor.mjs +22 -23
- package/scripts/native-patches.mjs +78 -13
- package/src/auto-patch.js +8 -3
- package/src/client.js +8 -4
- package/src/compatibility.js +22 -0
- package/src/index.js +26 -22
- package/src/maintenance-fallback.js +160 -0
- package/src/maintenance-host.js +250 -0
- package/src/maintenance-state.js +186 -0
- package/src/maintenance.js +188 -0
- package/src/settings-page.css +21 -0
- package/src/settings-page.js +64 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"packageName": "@deepseek-ai/dsh-client-ui-settings-models",
|
|
4
4
|
"target": "node_modules/@deepseek-ai/dsh-client-ui-settings-models/lib/client.js",
|
|
5
5
|
"baseSha256": "e111ecefea8262e0426f528864b9681d818068042e93d053bcb0b6884b317278",
|
|
6
|
-
"resultSha256": "
|
|
6
|
+
"resultSha256": "334a4011920fab3d196ded7dd945cea7d375e806b9d843a47ef6d307c00c59ca",
|
|
7
7
|
"replacements": [
|
|
8
8
|
{
|
|
9
9
|
"before": "\t\t//#region lib/types/client/CustomProviderCard.js",
|
|
@@ -144,6 +144,413 @@
|
|
|
144
144
|
{
|
|
145
145
|
"before": "\t\tconst zh = {",
|
|
146
146
|
"after": "\t\tconst zh = {\n\t\t\tmultiKey: \"多密钥配置\",\n\t\t\tmultiKeyHelp: \"各配置共享 Provider ID、API 地址与协议,分别管理名称、API 密钥和模型。关闭后恢复原单密钥配置,已保存的配置与密钥不会删除。\",\n\t\t\tmultiKeySharedSettings: \"公共设置\",\n\t\t\tmultiKeyAdd: \"添加密钥配置\",\n\t\t\tmultiKeyRemove: \"移除\",\n\t\t\tmultiKeyEntryName: \"配置名称\",\n\t\t\tmultiKeyDefaultName: \"密钥配置\",\n\t\t\tmultiKeyDisableTitle: \"关闭多密钥配置?\",\n\t\t\tmultiKeyDisableDescription: \"应用后,此供应商将使用原单密钥配置,已保存的密钥配置与凭据不会删除。正在使用密钥配置的会话需要重新开启,或手动选择单密钥模型;不会自动换用其他密钥。\",\n\t\t\tmultiKeyKeepEnabled: \"保持开启\",\n\t\t\tmultiKeyDisableConfirm: \"确认关闭(待应用)\",\n\t\t\tmultiKeyUnsavedTitle: \"请先保存新输入的密钥\",\n\t\t\tmultiKeyUnsavedKeys: \"当前有尚未保存的 API 密钥输入。关闭后直接应用不会保存这些输入,因此开关将保持开启。请返回密钥配置并应用保存,再重新打开此卡片关闭;当前输入与已存储的密钥均未删除。\",\n\t\t\tmultiKeyReturnToEdit: \"返回密钥配置\",\n\t\t\tmultiKeyRef: \"密钥引用:{ref}\",\n\t\t\tmultiKeySaved: \"引用已保存,尚未检查密钥状态;输入留空可保留原密钥。\",\n\t\t\tmultiKeyNew: \"尚未保存;输入留空不会创建密钥。\",\n\t\t\tmultiKeyConfigured: \"已确认密钥已配置;留空可保留。\",\n\t\t\tmultiKeyMissing: \"已确认此引用缺少密钥,请输入或在环境中配置。\",\n\t\t\tmultiKeyKeepCredentials: \"移除密钥配置不会删除已存储的密钥。\",\n\t\t\tmultiKeyNeedsEntries: \"请至少添加一个密钥配置。\",\n\t\t\tmultiKeyInvalidId: \"密钥配置 ID 无效,请重新打开此卡片或修正配置。\",\n\t\t\tmultiKeyInvalidName: \"每个配置名称须为 1–120 个字符。\",\n\t\t\tmultiKeyInvalidRef: \"密钥引用无效。\",\n\t\t\tmultiKeyDuplicateRef: \"多个密钥配置使用了相同的密钥引用;每个配置必须使用独立引用。\",\n\t\t\tmultiKeyNeedsModels: \"每个密钥配置至少需要一个模型。\",\n\t\t\tmultiKeyReplaceConfirm: \"确认替换 {ref} 的密钥;共用此引用的其他配置也会受到影响。\",\n\t\t\tmultiKeyConfirmRequired: \"请先确认替换已引用的密钥,再应用。\",\n\t\t\tmultiKeyProbeNeedsKey: \"保存前请先输入此配置的 API 密钥再获取模型;不会使用供应商原来的密钥。\",\n\t\t\tmultiKeySaveFailed: \"保存尚未完成。请保留此卡片并重试;已成功写入的密钥不会重复写入。\","
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"before": "const MULTI_KEY_ENTRY_ID =",
|
|
150
|
+
"after": "const MULTI_KEY_PROTOCOLS = new Set([\"openai-completions\", \"openai-responses\", \"anthropic-messages\"]);\n\t\tconst MULTI_KEY_ENTRY_ID ="
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"before": "name: source.name ?? \"\",",
|
|
154
|
+
"after": "name: source.name ?? \"\",\n\t\t\t\t...(source.api === void 0 ? {} : { api: source.api }),"
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"before": "return Object.fromEntries(Object.entries(entries).map(([id, entry]) => [id, {\n\t\t\t\t...entry,\n\t\t\t\tname: typeof entry?.name === \"string\" ? entry.name.trim() : \"\",\n\t\t\t\tapiKeyEnv: typeof entry?.apiKeyEnv === \"string\" && entry.apiKeyEnv.length > 0 ? entry.apiKeyEnv : multiKeyRef(route, id),\n\t\t\t\tmodels: modelDrafts(entry?.models).map((model) => structuredClone(model))\n\t\t\t}]));",
|
|
158
|
+
"after": "return Object.fromEntries(Object.entries(entries).map(([id, entry]) => {\n\t\t\t\tconst { api, ...rest } = entry;\n\t\t\t\treturn [id, {\n\t\t\t\t\t...rest,\n\t\t\t\t\t...(api === void 0 || api === \"\" ? {} : { api }),\n\t\t\t\t\tname: typeof entry?.name === \"string\" ? entry.name.trim() : \"\",\n\t\t\t\t\tapiKeyEnv: typeof entry?.apiKeyEnv === \"string\" && entry.apiKeyEnv.length > 0 ? entry.apiKeyEnv : multiKeyRef(route, id),\n\t\t\t\t\tmodels: modelDrafts(entry?.models).map((model) => structuredClone(model))\n\t\t\t\t}];\n\t\t\t}));"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"before": "return t(\"multiKeyInvalidName\");\n\t\t\t\tconst ref = entry.apiKeyEnv ?? multiKeyRef(route, id);",
|
|
162
|
+
"after": "return t(\"multiKeyInvalidName\");\n\t\t\t\tif (entry.api !== void 0 && !MULTI_KEY_PROTOCOLS.has(entry.api)) return t(\"multiKeyInvalidProtocol\");\n\t\t\t\tconst ref = entry.apiKeyEnv ?? multiKeyRef(route, id);"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"before": "...(canUseStored ? { keyEntryId: id } : {}),",
|
|
166
|
+
"after": "...(canUseStored ? { keyEntryId: id } : {}),\n\t\t\t\t\t\t...(entry.api === void 0 ? {} : { api: entry.api }),"
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"before": "\t\tfunction MultiKeyEntriesEditor(props) {",
|
|
170
|
+
"after": "\t\tfunction multiKeyEntryDirty(entry, saved, draft) {\n\t\t\treturn saved === void 0 || JSON.stringify(entry) !== JSON.stringify(saved) || (draft ?? \"\").length > 0;\n\t\t}\n\t\tfunction MultiKeyEntriesEditor(props) {"
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"before": "const [busyEntries, setBusyEntries] = (0, react.useState)({});",
|
|
174
|
+
"after": "const [busyEntries, setBusyEntries] = (0, react.useState)({});\n\t\t\tconst [expandedEntries, setExpandedEntries] = (0, react.useState)({});\n\t\t\tconst [removeTarget, setRemoveTarget] = (0, react.useState)(void 0);\n\t\t\tconst detailsPrefix = (0, react.useId)();\n\t\t\tconst previousSave = (0, react.useRef)(props.saveState);\n\t\t\t(0, react.useEffect)(() => {\n\t\t\t\tconst save = props.saveState;\n\t\t\t\tif (save === previousSave.current) return;\n\t\t\t\tpreviousSave.current = save;\n\t\t\t\tif (!save) return;\n\t\t\t\tsetExpandedEntries((current) => {\n\t\t\t\t\tconst next = { ...current };\n\t\t\t\t\tfor (const id of Object.keys(save.entries)) {\n\t\t\t\t\t\t// Only collapse the exact snapshot acknowledged by this save.\n\t\t\t\t\t\tif (!save.ok || !multiKeyEntryDirty(entries[id], save.entries[id], keyDrafts[id])) next[id] = !save.ok;\n\t\t\t\t\t}\n\t\t\t\t\treturn next;\n\t\t\t\t});\n\t\t\t}, [props.saveState, entries, keyDrafts]);\n\t\t\tconst invalidRows = Object.keys(entries).filter((id) => multiKeyFailure(route, { [id]: entries[id] }, keyDrafts, confirmations, t) !== void 0);\n\t\t\tconst invalidEntries = invalidRows.length > 0 ? invalidRows : multiKeyFailure(route, entries, keyDrafts, confirmations, t) !== void 0 ? Object.keys(entries) : [];\n\t\t\tconst invalidSignature = JSON.stringify(invalidEntries);\n\t\t\t(0, react.useEffect)(() => {\n\t\t\t\tif (invalidEntries.length > 0) setExpandedEntries((current) => ({ ...current, ...Object.fromEntries(invalidEntries.map((id) => [id, true])) }));\n\t\t\t}, [invalidSignature]);"
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"before": "const anyBusy = Object.values(busyEntries).some(Boolean);",
|
|
178
|
+
"after": "const anyBusy = Object.values(busyEntries).some(Boolean);\n\t\t\t(0, react.useEffect)(() => {\n\t\t\t\tif (disabled || anyBusy || removeTarget !== void 0 && !Object.hasOwn(entries, removeTarget)) setRemoveTarget(void 0);\n\t\t\t}, [disabled, anyBusy, removeTarget, entries]);\n\t\t\tconst removeName = typeof entries[removeTarget]?.name === \"string\" && entries[removeTarget].name.trim() ? entries[removeTarget].name.trim() : t(\"multiKeyDefaultName\");"
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"before": "const remove = (id) => {",
|
|
182
|
+
"after": "const remove = (id) => {\n\t\t\t\tif (disabled || anyBusy || !Object.hasOwn(entries, id)) return;"
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"before": "const heading = typeof entry.name === \"string\"",
|
|
186
|
+
"after": "const dirty = multiKeyEntryDirty(entry, props.savedEntries?.[id] ?? props.persistedEntries?.[id], draft);\n\t\t\t\t\tconst expanded = expandedEntries[id] ?? !Object.hasOwn(props.persistedEntries ?? {}, id);\n\t\t\t\t\tconst detailsId = detailsPrefix + \"-\" + id;\n\t\t\t\t\tconst heading = typeof entry.name === \"string\""
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"before": "\"data-key-entry-id\": id, role: \"group\", \"aria-label\": heading,",
|
|
190
|
+
"after": "\"data-key-entry-id\": id, \"data-key-entry-expanded\": expanded, \"data-key-entry-dirty\": dirty, role: \"group\", \"aria-label\": heading,"
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"before": "\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\t\t\"data-key-entry-heading\": true,\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"rowHead\"],\n\t\t\t\t\t\t\tstyle: { flexWrap: \"wrap\" },\n\t\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"rowName\"],\n\t\t\t\t\t\t\t\tstyle: { minWidth: 0, overflowWrap: \"anywhere\", flex: \"1 1 120px\" }, children: heading\n\t\t\t\t\t\t\t}), (0, react_jsx_runtime.jsx)(\"div\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"rowActions\"],\n\t\t\t\t\t\t\t\tchildren: (0, react_jsx_runtime.jsx)(\"button\", {\n\t\t\t\t\t\t\t\t\ttype: \"button\", className: ModelsSection_module_css_default[\"secondaryButton\"], disabled,\n\t\t\t\t\t\t\t\t\tonClick: () => remove(id), children: t(\"multiKeyRemove\")\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t})]\n\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t(0, react_jsx_runtime.jsxs)(\"label\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", { className: ModelsSection_module_css_default[\"fieldLabel\"], children: t(\"multiKeyEntryName\") }),\n\t\t\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(\"input\", {\n\t\t\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"input\"], type: \"text\", value: entry.name ?? \"\", maxLength: 120,\n\t\t\t\t\t\t\t\t\t\t\"aria-label\": `${t(\"multiKeyEntryName\")} ${String(index + 1)}`, disabled,\n\t\t\t\t\t\t\t\t\t\tonChange: (event) => update(id, { name: event.target.value })\n\t\t\t\t\t\t\t\t\t})]\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t(0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", { className: ModelsSection_module_css_default[\"fieldLabel\"], children: t(\"keyInput\") }),\n\t\t\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(ApiKeyInput, {\n\t\t\t\t\t\t\t\t\t\tt, value: draft, placeholder: t(persisted ? \"keyPlaceholderSaved\" : \"keyPlaceholder\"),\n\t\t\t\t\t\t\t\t\t\t\"aria-label\": `${t(\"keyInput\")} ${String(index + 1)}`, \"aria-invalid\": keyFailure !== void 0,\n\t\t\t\t\t\t\t\t\t\tdisabled: props.keyDisabled ?? disabled,\n\t\t\t\t\t\t\t\t\t\tonChange: (event) => {\n\t\t\t\t\t\t\t\t\t\t\tconst value = event.target.value;\n\t\t\t\t\t\t\t\t\t\t\tonKeyDraftsChange((current) => ({ ...current, [id]: value }));\n\t\t\t\t\t\t\t\t\t\t\tonConfirmationsChange((current) => ({ ...current, [id]: false }));\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(\"p\", { className: ModelsSection_module_css_default[\"advancedHint\"], children: t(status) }),\n\t\t\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(\"p\", { className: ModelsSection_module_css_default[\"advancedHint\"], style: { overflowWrap: \"anywhere\" }, children: t(\"multiKeyRef\").replace(\"{ref}\", () => ref) }),\n\t\t\t\t\t\t\t\t\tkeyFailure === void 0 ? null : (0, react_jsx_runtime.jsx)(\"p\", { className: ModelsSection_module_css_default[\"error\"], children: t(keyFailure) })]\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tneedsConfirmation ? (0, react_jsx_runtime.jsxs)(\"label\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\t\tstyle: { display: \"flex\", alignItems: \"flex-start\", gap: 8, overflowWrap: \"anywhere\" },\n\t\t\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"input\", {\n\t\t\t\t\t\t\t\t\ttype: \"checkbox\", \"data-confirm-entry\": id, \"aria-label\": t(\"multiKeyReplaceConfirm\").replace(\"{ref}\", () => ref),\n\t\t\t\t\t\t\t\t\tchecked: confirmations[id] === true, disabled: props.keyDisabled ?? disabled,\n\t\t\t\t\t\t\t\t\tonChange: (event) => onConfirmationsChange((current) => ({ ...current, [id]: event.target.checked }))\n\t\t\t\t\t\t\t\t}), (0, react_jsx_runtime.jsx)(\"span\", { children: t(\"multiKeyReplaceConfirm\").replace(\"{ref}\", () => ref) })]\n\t\t\t\t\t\t\t}) : null,\n\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(ModelListEditor, {\n\t\t\t\t\t\t\t\tmodels: modelDrafts(entry.models), onChange: (models) => update(id, { models }),\n\t\t\t\t\t\t\t\treasoningLevels: props.reasoningLevels, probe,\n\t\t\t\t\t\t\t\tprobeBlocked: keyFailure ?? props.probeBlocked ?? (!canUseStored && draft.trim().length === 0 ? \"multiKeyProbeNeedsKey\" : void 0),\n\t\t\t\t\t\t\t\toperations, t, disabled,\n\t\t\t\t\t\t\t\tonBusyChange: (value) => setBusyEntries((current) => current[id] === value ? current : { ...current, [id]: value })\n\t\t\t\t\t\t\t})]",
|
|
194
|
+
"after": "\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\t\t\"data-key-entry-heading\": true,\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"rowHead\"], style: { flexWrap: \"wrap\" },\n\t\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"rowName\"],\n\t\t\t\t\t\t\t\tstyle: { minWidth: 0, overflowWrap: \"anywhere\", flex: \"1 1 120px\" }, children: heading\n\t\t\t\t\t\t\t}), (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"rowActions\"],\n\t\t\t\t\t\t\t\tchildren: [dirty ? (0, react_jsx_runtime.jsx)(\"span\", { className: ModelsSection_module_css_default[\"rowTag\"], \"data-key-entry-unsaved\": true, children: t(\"multiKeyUnsaved\") }) : null,\n\t\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(\"button\", {\n\t\t\t\t\t\t\t\t\ttype: \"button\", className: ModelsSection_module_css_default[\"secondaryButton\"],\n\t\t\t\t\t\t\t\t\t\"aria-expanded\": expanded, \"aria-controls\": detailsId,\n\t\t\t\t\t\t\t\t\tonClick: () => setExpandedEntries((current) => ({ ...current, [id]: !expanded })),\n\t\t\t\t\t\t\t\t\tchildren: t(expanded ? \"multiKeyCollapse\" : \"multiKeyExpand\")\n\t\t\t\t\t\t\t\t})]\n\t\t\t\t\t\t\t})]\n\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t(0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", { className: ModelsSection_module_css_default[\"fieldLabel\"], children: t(\"keyInput\") }),\n\t\t\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(ApiKeyInput, {\n\t\t\t\t\t\t\t\t\t\tt, value: draft, placeholder: t(persisted ? \"keyPlaceholderSaved\" : \"keyPlaceholder\"),\n\t\t\t\t\t\t\t\t\t\t\"aria-label\": `${t(\"keyInput\")} ${String(index + 1)}`, \"aria-invalid\": keyFailure !== void 0,\n\t\t\t\t\t\t\t\t\t\tdisabled: props.keyDisabled ?? disabled,\n\t\t\t\t\t\t\t\t\t\tonChange: (event) => {\n\t\t\t\t\t\t\t\t\t\t\tconst value = event.target.value;\n\t\t\t\t\t\t\t\t\t\t\tonKeyDraftsChange((current) => ({ ...current, [id]: value }));\n\t\t\t\t\t\t\t\t\t\t\tonConfirmationsChange((current) => ({ ...current, [id]: false }));\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(\"p\", { className: ModelsSection_module_css_default[\"advancedHint\"], children: t(status) }),\n\t\t\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(\"p\", { className: ModelsSection_module_css_default[\"advancedHint\"], style: { overflowWrap: \"anywhere\" }, children: t(\"multiKeyRef\").replace(\"{ref}\", () => ref) }),\n\t\t\t\t\t\t\t\t\tkeyFailure === void 0 ? null : (0, react_jsx_runtime.jsx)(\"p\", { className: ModelsSection_module_css_default[\"error\"], children: t(keyFailure) })]\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tneedsConfirmation ? (0, react_jsx_runtime.jsxs)(\"label\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\t\tstyle: { display: \"flex\", alignItems: \"flex-start\", gap: 8, overflowWrap: \"anywhere\" },\n\t\t\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"input\", {\n\t\t\t\t\t\t\t\t\ttype: \"checkbox\", \"data-confirm-entry\": id, \"aria-label\": t(\"multiKeyReplaceConfirm\").replace(\"{ref}\", () => ref),\n\t\t\t\t\t\t\t\t\tchecked: confirmations[id] === true, disabled: props.keyDisabled ?? disabled,\n\t\t\t\t\t\t\t\t\tonChange: (event) => onConfirmationsChange((current) => ({ ...current, [id]: event.target.checked }))\n\t\t\t\t\t\t\t\t}), (0, react_jsx_runtime.jsx)(\"span\", { children: t(\"multiKeyReplaceConfirm\").replace(\"{ref}\", () => ref) })]\n\t\t\t\t\t\t\t}) : null,\n\t\t\t\t\t\t(0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\t\tid: detailsId, \"data-key-entry-details\": true, hidden: !expanded,\n\t\t\t\t\t\t\tstyle: { display: expanded ? \"flex\" : \"none\", flexDirection: \"column\", gap: 12, minWidth: 0, borderTop: \"0.5px solid var(--dsw-alias-settings-card-stroke)\", paddingTop: 12 },\n\t\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\t\t\t\"data-key-entry-fields\": true, style: { display: \"grid\", gridTemplateColumns: \"repeat(auto-fit, minmax(min(100%, 220px), 1fr))\", gap: 12, minWidth: 0 }, children: [\n\t\t\t\t\t\t\t(0, react_jsx_runtime.jsxs)(\"label\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", { className: ModelsSection_module_css_default[\"fieldLabel\"], children: t(\"multiKeyEntryName\") }),\n\t\t\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(\"input\", {\n\t\t\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"input\"], type: \"text\", value: entry.name ?? \"\", maxLength: 120,\n\t\t\t\t\t\t\t\t\t\t\"aria-label\": `${t(\"multiKeyEntryName\")} ${String(index + 1)}`, disabled,\n\t\t\t\t\t\t\t\t\t\tonChange: (event) => update(id, { name: event.target.value })\n\t\t\t\t\t\t\t\t\t})]\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t(0, react_jsx_runtime.jsxs)(\"label\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", { className: ModelsSection_module_css_default[\"fieldLabel\"], children: t(\"multiKeyProtocol\") }),\n\t\t\t\t\t\t\t\t(0, react_jsx_runtime.jsxs)(\"select\", {\n\t\t\t\t\t\t\t\t\t\"data-key-entry-protocol\": id, \"aria-label\": t(\"multiKeyProtocol\") + \" \" + heading,\n\t\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"input\"] + \" \" + ModelsSection_module_css_default[\"selectInput\"],\n\t\t\t\t\t\t\t\t\tstyle: { maxWidth: \"none\" }, value: entry.api ?? \"\", disabled: disabled || anyBusy,\n\t\t\t\t\t\t\t\t\tonChange: (event) => {\n\t\t\t\t\t\t\t\t\t\tconst value = event.target.value;\n\t\t\t\t\t\t\t\t\t\tif (disabled || anyBusy || value !== \"\" && !MULTI_KEY_PROTOCOLS.has(value)) return;\n\t\t\t\t\t\t\t\t\t\tconst { api, ...inherited } = entries[id];\n\t\t\t\t\t\t\t\t\t\tonChange({ ...entries, [id]: value === \"\" ? inherited : { ...inherited, api: value } });\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"option\", { value: \"\", children: t(\"multiKeyProtocolInherit\").replace(\"{protocol}\", () => props.probe.api ? protocolLabel(t, props.probe.api) : t(\"multiKeyProtocolDefault\")) }),\n\t\t\t\t\t\t\t\t\t...(props.protocols ?? [...MULTI_KEY_PROTOCOLS]).map((choice) => (0, react_jsx_runtime.jsx)(\"option\", { value: choice, children: protocolLabel(t, choice) }, choice))]\n\t\t\t\t\t\t\t\t}), (0, react_jsx_runtime.jsx)(\"span\", { className: ModelsSection_module_css_default[\"advancedHint\"], children: t(\"multiKeyProtocolHelp\") })]\n\t\t\t\t\t\t\t})]\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(ModelListEditor, {\n\t\t\t\t\t\t\t\tmodels: modelDrafts(entry.models), onChange: (models) => update(id, { models }),\n\t\t\t\t\t\t\t\treasoningLevels: props.reasoningLevels, probe,\n\t\t\t\t\t\t\t\tprobeBlocked: keyFailure ?? props.probeBlocked ?? (!canUseStored && draft.trim().length === 0 ? \"multiKeyProbeNeedsKey\" : void 0),\n\t\t\t\t\t\t\t\toperations, t, disabled,\n\t\t\t\t\t\t\t\tonBusyChange: (value) => setBusyEntries((current) => current[id] === value ? current : { ...current, [id]: value })\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t(0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\t\t\t\"data-key-entry-danger-zone\": true,\n\t\t\t\t\t\t\t\tstyle: { display: \"flex\", flexDirection: \"column\", gap: 6, borderTop: \"0.5px solid var(--dsw-alias-settings-card-stroke)\", paddingTop: 12 },\n\t\t\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"p\", { className: ModelsSection_module_css_default[\"advancedHint\"], children: t(\"multiKeyRemoveHelp\") }),\n\t\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(\"button\", {\n\t\t\t\t\t\t\t\t\ttype: \"button\", \"data-key-entry-remove\": id,\n\t\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"dangerButton\"], style: { alignSelf: \"flex-start\" }, disabled: disabled || anyBusy,\n\t\t\t\t\t\t\t\t\tonClick: () => { if (!disabled && !anyBusy) setRemoveTarget(id); }, children: t(\"multiKeyRemoveGroup\")\n\t\t\t\t\t\t\t\t})]\n\t\t\t\t\t\t\t})]\n\t\t\t\t\t\t})]"
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
"before": "}), (0, react_jsx_runtime.jsx)(\"p\", { className: ModelsSection_module_css_default[\"advancedHint\"], children: t(\"multiKeyKeepCredentials\") })]",
|
|
198
|
+
"after": "}), (0, react_jsx_runtime.jsx)(\"p\", { className: ModelsSection_module_css_default[\"advancedHint\"], children: t(\"multiKeyKeepCredentials\") }),\n\t\t\t\t(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Modal, {\n\t\t\t\t\topen: removeTarget !== void 0 && Object.hasOwn(entries, removeTarget) && !disabled && !anyBusy,\n\t\t\t\t\t\"data-key-entry-remove-dialog\": true, onClose: () => setRemoveTarget(void 0),\n\t\t\t\t\ttitle: t(\"multiKeyRemoveTitle\").replace(\"{name}\", () => removeName), closeLabel: t(\"close\"),\n\t\t\t\t\tdescription: t(\"multiKeyRemoveDescription\"), className: ModelsSection_module_css_default[\"deleteDialog\"],\n\t\t\t\t\tfooter: (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [\n\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, { variant: \"outline\", \"data-modal-autofocus\": true, onClick: () => setRemoveTarget(void 0), children: t(\"cancel\") }),\n\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {\n\t\t\t\t\t\t\tvariant: \"outline\", className: ModelsSection_module_css_default[\"deleteConfirm\"], disabled: disabled || anyBusy,\n\t\t\t\t\t\t\tonClick: () => { if (removeTarget === void 0 || disabled || anyBusy) return; remove(removeTarget); setRemoveTarget(void 0); }, children: t(\"multiKeyRemoveGroup\")\n\t\t\t\t\t\t})]\n\t\t\t\t\t})\n\t\t\t\t})]"
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
"before": "function CustomProviderCard(props) {\n\t\t\tconst { taken, protocols, reasoningLevels, operations, t, onBusyChange } = props;\n\t\t\tconst supportsMultiKey = supportsMultiKeySchema(props.namespace, props.schema, [\"providers\", PROBE_ROUTE]);\n\t\t\tconst [openedAt] = (0, react.useState)(() => props.revision);\n\t\t\tconst [route, setRoute] = (0, react.useState)(\"\");\n\t\t\tconst [displayName, setDisplayName] = (0, react.useState)(\"\");\n\t\t\tconst [baseURL, setBaseURL] = (0, react.useState)(\"\");\n\t\t\tconst [protocol, setProtocol] = (0, react.useState)(protocols[0] ?? \"\");\n\t\t\tconst [keyDraft, setKeyDraft] = (0, react.useState)(\"\");\n\t\t\tconst [models, setModels] = (0, react.useState)([]);\n\t\t\tconst [multiKey, setMultiKey] = (0, react.useState)(false);\n\t\t\tconst [keyEntries, setKeyEntries] = (0, react.useState)({});\n\t\t\tconst [entryKeyDrafts, setEntryKeyDrafts] = (0, react.useState)({});\n\t\t\tconst [entryConfirmations, setEntryConfirmations] = (0, react.useState)({});\n\t\t\tconst saving = (0, react.useRef)(false);\n\t\t\tconst [busy, setBusy] = (0, react.useState)(false);\n\t\t\tconst [listBusy, setListBusy] = (0, react.useState)(false);\n\t\t\t(0, react.useEffect)(() => {\n\t\t\t\tonBusyChange?.(busy || listBusy);\n\t\t\t}, [\n\t\t\t\tbusy,\n\t\t\t\tlistBusy,\n\t\t\t\tonBusyChange\n\t\t\t]);\n\t\t\tconst [failure, setFailure] = (0, react.useState)(void 0);\n\t\t\t/**\n\t\t\t* The profile write landed. Only the key write can still be outstanding, so\n\t\t\t* the fields that describe the provider are settled and the retry path is\n\t\t\t* the credential alone.\n\t\t\t*/\n\t\t\tconst [committed, setCommitted] = (0, react.useState)(false);\n\t\t\tconst disabled = props.readOnly || busy;\n\t\t\t/** Everything but the key stops being editable once the provider exists. */\n\t\t\tconst profileDisabled = disabled || committed;\n\t\t\tconst routeInvalid = route.length > 0 && !ROUTE_PATTERN.test(route);\n\t\t\tconst routeTaken = taken.includes(route);\n\t\t\tconst normalizedBaseURL = baseURL.trim();\n\t\t\tconst baseUrlInvalid = baseURL.length > 0 && !isHttpUrl(normalizedBaseURL);\n\t\t\tconst modelFailure = multiKey ? void 0 : validateDeepSeekModels(models) ?? validateReasoningEfforts(models);\n\t\t\tconst entryFailure = multiKey ? multiKeyFailure(route, keyEntries, entryKeyDrafts, entryConfirmations, t) : void 0;\n\t\t\tconst keyFailure = multiKey ? void 0 : apiKeyFailure(keyDraft);\n\t\t\tconst keyValue = keyDraft.trim();\n\t\t\tconst ready = (committed || route.length > 0 && !routeInvalid && !routeTaken) && normalizedBaseURL.length > 0 && !baseUrlInvalid && (multiKey ? entryFailure === void 0 : models.length > 0 && modelFailure === void 0 && keyFailure === void 0);\n\t\t\tconst hint = entryFailure ?? (failure !== void 0 || ready || keyFailure !== void 0 || route.length === 0 || routeInvalid || routeTaken || baseUrlInvalid ? void 0 : normalizedBaseURL.length === 0 ? t(\"customNeedsBaseUrl\") : modelFailure !== void 0 ? `${t(\"model\")} ${String(modelFailure.index + 1)}: ${t(modelFailure.key)}` : t(\"customNeedsModels\"));\n\t\t\t/** Perform the create, returning a failure message or undefined. */\n\t\t\tconst createOnce = async () => {\n\t\t\t\tconst entries = normalizedMultiKeyEntries(route, keyEntries);\n\t\t\t\tconst firstEntry = Object.values(entries)[0];\n\t\t\t\tconst keyRef = multiKey ? firstEntry?.apiKeyEnv : deriveKeyRef(route);\n\t\t\t\tconst storesKey = !multiKey && keyValue.length > 0;\n\t\t\t\tif (multiKey && entryFailure !== void 0) return entryFailure;\n\t\t\t\tif (!committed) {\n\t\t\t\t\tconst profile = {\n\t\t\t\t\t\t...displayName.length === 0 ? {} : { displayName },\n\t\t\t\t\t\t...storesKey || multiKey ? { apiKeyEnv: keyRef } : {},\n\t\t\t\t\t\tapi: protocol,\n\t\t\t\t\t\tbaseURL: normalizedBaseURL,\n\t\t\t\t\t\tmodels: (multiKey ? firstEntry.models : models).map((model) => ({ ...model })),\n\t\t\t\t\t\t...(multiKey || Object.keys(keyEntries).length > 0 ? { multiKey, keyEntries: entries } : {})\n\t\t\t\t\t};\n\t\t\t\t\tconst written = await operations.writeSettings(NS$1, [{\n\t\t\t\t\t\top: \"set\",\n\t\t\t\t\t\tpath: [\"providers\", route],\n\t\t\t\t\t\tvalue: profile\n\t\t\t\t\t}], openedAt);\n\t\t\t\t\tif (written.kind !== \"written\") return written.kind === \"conflict\" ? t(\"conflict\") : written.message;\n\t\t\t\t\tsetCommitted(true);\n\t\t\t\t}\n\t\t\t\tif (multiKey) return storeMultiKeyDrafts(operations, entries, entryKeyDrafts, setEntryKeyDrafts);\n\t\t\t\tif (storesKey) {\n\t\t\t\t\tconst stored = await operations.storeCredential(keyRef, keyValue);\n\t\t\t\t\tif (stored !== void 0) return stored;\n\t\t\t\t\tsetKeyDraft(\"\");\n\t\t\t\t}\n\t\t\t};\n\t\t\tconst create = async () => {\n\t\t\t\tif (saving.current || !ready || props.readOnly || listBusy) return;\n\t\t\t\tsaving.current = true;\n\t\t\t\tsetBusy(true);\n\t\t\t\tsetFailure(void 0);\n\t\t\t\ttry {\n\t\t\t\t\tconst outcome = await createOnce();\n\t\t\t\t\tif (outcome !== void 0) {\n\t\t\t\t\t\tsetFailure(outcome);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tprops.onClose(true);\n\t\t\t\t} catch {\n\t\t\t\t\tsetFailure(t(\"multiKeySaveFailed\"));\n\t\t\t\t} finally {\n\t\t\t\t\tsaving.current = false;\n\t\t\t\t\tsetBusy(false);\n\t\t\t\t}\n\t\t\t};\n\t\t\treturn (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\tclassName: ModelsSection_module_css_default[\"editor\"],\n\t\t\t\tchildren: [\n\t\t\t\t\t(0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\tchildren: t(\"customRoute\")\n\t\t\t\t\t\t}), (0, react_jsx_runtime.jsx)(\"input\", {\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"input\"],\n\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\tvalue: route,\n\t\t\t\t\t\t\tplaceholder: \"acme-gateway\",\n\t\t\t\t\t\t\t\"aria-label\": t(\"customRoute\"),\n\t\t\t\t\t\t\tdisabled: profileDisabled,\n\t\t\t\t\t\t\tonChange: (event) => {\n\t\t\t\t\t\t\t\tsetRoute(event.target.value);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})]\n\t\t\t\t\t}),\n\t\t\t\t\trouteInvalid || routeTaken ? (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"error\"],\n\t\t\t\t\t\tchildren: t(routeInvalid ? \"customRouteInvalid\" : \"customRouteTaken\")\n\t\t\t\t\t}) : (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"advancedHint\"],\n\t\t\t\t\t\tchildren: t(\"customRouteHint\")\n\t\t\t\t\t}),\n\t\t\t\t\t(0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\tchildren: t(\"customDisplayName\")\n\t\t\t\t\t\t}), (0, react_jsx_runtime.jsx)(\"input\", {\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"input\"],\n\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\tvalue: displayName,\n\t\t\t\t\t\t\tplaceholder: route.length === 0 ? t(\"customDisplayName\") : route,\n\t\t\t\t\t\t\t\"aria-label\": t(\"customDisplayName\"),\n\t\t\t\t\t\t\tdisabled: profileDisabled,\n\t\t\t\t\t\t\tonChange: (event) => {\n\t\t\t\t\t\t\t\tsetDisplayName(event.target.value);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})]\n\t\t\t\t\t}),\n\t\t\t\t\t(0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\tchildren: t(\"baseUrl\")\n\t\t\t\t\t\t}), (0, react_jsx_runtime.jsx)(\"input\", {\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"input\"],\n\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\tvalue: baseURL,\n\t\t\t\t\t\t\tplaceholder: t(protocol === \"anthropic-messages\" ? \"customAnthropicBaseUrlPlaceholder\" : \"customBaseUrlPlaceholder\"),\n\t\t\t\t\t\t\t\"aria-label\": t(\"baseUrl\"),\n\t\t\t\t\t\t\t\"aria-invalid\": baseUrlInvalid,\n\t\t\t\t\t\t\tdisabled: profileDisabled,\n\t\t\t\t\t\t\tonChange: (event) => {\n\t\t\t\t\t\t\t\tsetBaseURL(event.target.value);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})]\n\t\t\t\t\t}),\n\t\t\t\t\tbaseUrlInvalid ? (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"error\"],\n\t\t\t\t\t\tchildren: t(\"customBaseUrlInvalid\")\n\t\t\t\t\t}) : null,\n\t\t\t\t\t(0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\tchildren: t(\"customApi\")\n\t\t\t\t\t\t}), (0, react_jsx_runtime.jsx)(\"select\", {\n\t\t\t\t\t\t\tclassName: `${ModelsSection_module_css_default[\"input\"]} ${ModelsSection_module_css_default[\"selectInput\"]}`,\n\t\t\t\t\t\t\tvalue: protocol,\n\t\t\t\t\t\t\t\"aria-label\": t(\"customApi\"),\n\t\t\t\t\t\t\tdisabled: profileDisabled,\n\t\t\t\t\t\t\tonChange: (event) => {\n\t\t\t\t\t\t\t\tsetProtocol(event.target.value);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tchildren: protocols.map((choice) => (0, react_jsx_runtime.jsx)(\"option\", {\n\t\t\t\t\t\t\t\tvalue: choice,\n\t\t\t\t\t\t\t\tchildren: protocolLabel(t, choice)\n\t\t\t\t\t\t\t}, choice))\n\t\t\t\t\t\t})]\n\t\t\t\t\t}),\n\t\t\t\t\tsupportsMultiKey ? (0, react_jsx_runtime.jsx)(MultiKeyToggle, {\n\t\t\t\t\t\tt, checked: multiKey, disabled: profileDisabled || listBusy, hasUnsavedKeys: hasMultiKeyDrafts(entryKeyDrafts),\n\t\t\t\t\t\tonChange: (enabled) => {\n\t\t\t\t\t\t\tif (enabled && Object.keys(keyEntries).length === 0) {\n\t\t\t\t\t\t\t\tconst [id, entry] = newMultiKeyEntry(route, { name: displayName || route || t(\"multiKeyDefaultName\"), models });\n\t\t\t\t\t\t\t\tsetKeyEntries({ [id]: entry });\n\t\t\t\t\t\t\t\tif (keyDraft.length > 0) setEntryKeyDrafts({ [id]: keyDraft });\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsetMultiKey(enabled);\n\t\t\t\t\t\t}\n\t\t\t\t\t}) : null,\n\t\t\t\t\tmultiKey ? (0, react_jsx_runtime.jsx)(MultiKeyEntriesEditor, {\n\t\t\t\t\t\troute, entries: keyEntries, onChange: setKeyEntries,\n\t\t\t\t\t\tkeyDrafts: entryKeyDrafts, onKeyDraftsChange: setEntryKeyDrafts,\n\t\t\t\t\t\tconfirmations: entryConfirmations, onConfirmationsChange: setEntryConfirmations,\n\t\t\t\t\t\tpersistedEntries: committed ? normalizedMultiKeyEntries(route, keyEntries) : {},\n\t\t\t\t\t\tprobe: { settingsNs: NS$1, ...(committed ? { provider: route } : {}), baseURL: normalizedBaseURL, api: protocol },\n\t\t\t\t\t\tprobeBlocked: baseUrlInvalid ? \"customBaseUrlInvalid\" : normalizedBaseURL.length === 0 ? \"customNeedsBaseUrl\" : void 0,\n\t\t\t\t\t\treasoningLevels, operations, t, disabled: profileDisabled || listBusy, keyDisabled: disabled || listBusy, onBusyChange: setListBusy\n\t\t\t\t\t}) : null,\n\t\t\t\t\tmultiKey ? null : (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\tchildren: [\n\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\t\tchildren: t(\"keyInput\")\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(ApiKeyInput, {\n\t\t\t\t\t\t\t\tt,\n\t\t\t\t\t\t\t\tvalue: keyDraft,\n\t\t\t\t\t\t\t\tplaceholder: t(\"keyPlaceholder\"),\n\t\t\t\t\t\t\t\t\"aria-label\": t(\"keyInput\"),\n\t\t\t\t\t\t\t\tdisabled,\n\t\t\t\t\t\t\t\tonChange: (event) => {\n\t\t\t\t\t\t\t\t\tsetKeyDraft(event.target.value);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tkeyFailure === void 0 ? null : (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"error\"],\n\t\t\t\t\t\t\t\tchildren: t(keyFailure === \"keyBlank\" ? \"keyBlankNew\" : keyFailure)\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t]\n\t\t\t\t\t}),\n\t\t\t\t\t!multiKey ? (0, react_jsx_runtime.jsx)(ModelListEditor, {\n\t\t\t\t\t\tmodels,\n\t\t\t\t\t\tonChange: setModels,\n\t\t\t\t\t\treasoningLevels,\n\t\t\t\t\t\tprobe: {\n\t\t\t\t\t\t\tsettingsNs: NS$1,\n\t\t\t\t\t\t\tbaseURL: normalizedBaseURL,\n\t\t\t\t\t\t\tapi: protocol,\n\t\t\t\t\t\t\t...keyValue.length === 0 ? {} : { apiKey: keyValue }\n\t\t\t\t\t\t},\n\t\t\t\t\t\tprobeBlocked: baseUrlInvalid ? \"customBaseUrlInvalid\" : keyFailure === \"keyBlank\" ? \"keyBlankNew\" : keyFailure,\n\t\t\t\t\t\toperations,\n\t\t\t\t\t\tt,\n\t\t\t\t\t\tdisabled: profileDisabled,\n\t\t\t\t\t\tonBusyChange: setListBusy\n\t\t\t\t\t}) : null,\n\t\t\t\t\tfailure !== void 0 ? (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"error\"],\n\t\t\t\t\t\tchildren: failure\n\t\t\t\t\t}) : null,\n\t\t\t\t\thint === void 0 ? null : (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"advancedHint\"],\n\t\t\t\t\t\tchildren: hint\n\t\t\t\t\t}),\n\t\t\t\t\t(0, react_jsx_runtime.jsx)(EditorFooter, {\n\t\t\t\t\t\tt,\n\t\t\t\t\t\tbusy,\n\t\t\t\t\t\tsubmitDisabled: disabled || listBusy || !ready,\n\t\t\t\t\t\tsubmitLabelKey: \"create\",\n\t\t\t\t\t\tsubmitBusyLabelKey: \"creating\",\n\t\t\t\t\t\tonCancel: () => {\n\t\t\t\t\t\t\tprops.onClose(committed);\n\t\t\t\t\t\t},\n\t\t\t\t\t\tonSubmit: () => {\n\t\t\t\t\t\t\tcreate();\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t]\n\t\t\t});\n\t\t}",
|
|
202
|
+
"after": "function CustomProviderCard(props) {\n\t\t\tconst { taken, protocols, reasoningLevels, operations, t, onBusyChange } = props;\n\t\t\tconst supportsMultiKey = supportsMultiKeySchema(props.namespace, props.schema, [\"providers\", PROBE_ROUTE]);\n\t\t\tconst [openedAt] = (0, react.useState)(() => props.revision);\n\t\t\tconst [route, setRoute] = (0, react.useState)(\"\");\n\t\t\tconst [displayName, setDisplayName] = (0, react.useState)(\"\");\n\t\t\tconst [baseURL, setBaseURL] = (0, react.useState)(\"\");\n\t\t\tconst [protocol, setProtocol] = (0, react.useState)(protocols[0] ?? \"\");\n\t\t\tconst [keyDraft, setKeyDraft] = (0, react.useState)(\"\");\n\t\t\tconst [models, setModels] = (0, react.useState)([]);\n\t\t\tconst [multiKey, setMultiKey] = (0, react.useState)(false);\n\t\t\tconst [keyEntries, setKeyEntries] = (0, react.useState)({});\n\t\t\tconst [entryKeyDrafts, setEntryKeyDrafts] = (0, react.useState)({});\n\t\t\tconst [entryConfirmations, setEntryConfirmations] = (0, react.useState)({});\n\t\t\tconst [entrySaveState, setEntrySaveState] = (0, react.useState)(void 0);\n\t\t\tconst saving = (0, react.useRef)(false);\n\t\t\tconst [busy, setBusy] = (0, react.useState)(false);\n\t\t\tconst [listBusy, setListBusy] = (0, react.useState)(false);\n\t\t\t(0, react.useEffect)(() => {\n\t\t\t\tonBusyChange?.(busy || listBusy);\n\t\t\t}, [\n\t\t\t\tbusy,\n\t\t\t\tlistBusy,\n\t\t\t\tonBusyChange\n\t\t\t]);\n\t\t\tconst [failure, setFailure] = (0, react.useState)(void 0);\n\t\t\t/**\n\t\t\t* The profile write landed. Only the key write can still be outstanding, so\n\t\t\t* the fields that describe the provider are settled and the retry path is\n\t\t\t* the credential alone.\n\t\t\t*/\n\t\t\tconst [committed, setCommitted] = (0, react.useState)(false);\n\t\t\tconst disabled = props.readOnly || busy;\n\t\t\t/** Everything but the key stops being editable once the provider exists. */\n\t\t\tconst profileDisabled = disabled || committed;\n\t\t\tconst routeInvalid = route.length > 0 && !ROUTE_PATTERN.test(route);\n\t\t\tconst routeTaken = taken.includes(route);\n\t\t\tconst normalizedBaseURL = baseURL.trim();\n\t\t\tconst baseUrlInvalid = baseURL.length > 0 && !isHttpUrl(normalizedBaseURL);\n\t\t\tconst modelFailure = multiKey ? void 0 : validateDeepSeekModels(models) ?? validateReasoningEfforts(models);\n\t\t\tconst entryFailure = multiKey ? multiKeyFailure(route, keyEntries, entryKeyDrafts, entryConfirmations, t) : void 0;\n\t\t\tconst keyFailure = multiKey ? void 0 : apiKeyFailure(keyDraft);\n\t\t\tconst keyValue = keyDraft.trim();\n\t\t\tconst ready = (committed || route.length > 0 && !routeInvalid && !routeTaken) && normalizedBaseURL.length > 0 && !baseUrlInvalid && (multiKey ? entryFailure === void 0 : models.length > 0 && modelFailure === void 0 && keyFailure === void 0);\n\t\t\tconst hint = entryFailure ?? (failure !== void 0 || ready || keyFailure !== void 0 || route.length === 0 || routeInvalid || routeTaken || baseUrlInvalid ? void 0 : normalizedBaseURL.length === 0 ? t(\"customNeedsBaseUrl\") : modelFailure !== void 0 ? `${t(\"model\")} ${String(modelFailure.index + 1)}: ${t(modelFailure.key)}` : t(\"customNeedsModels\"));\n\t\t\t/** Perform the create, returning a failure message or undefined. */\n\t\t\tconst createOnce = async () => {\n\t\t\t\tconst entries = normalizedMultiKeyEntries(route, keyEntries);\n\t\t\t\tconst firstEntry = Object.values(entries)[0];\n\t\t\t\tconst keyRef = multiKey ? firstEntry?.apiKeyEnv : deriveKeyRef(route);\n\t\t\t\tconst storesKey = !multiKey && keyValue.length > 0;\n\t\t\t\tif (multiKey && entryFailure !== void 0) return entryFailure;\n\t\t\t\tif (!committed) {\n\t\t\t\t\tconst profile = {\n\t\t\t\t\t\t...displayName.length === 0 ? {} : { displayName },\n\t\t\t\t\t\t...storesKey || multiKey ? { apiKeyEnv: keyRef } : {},\n\t\t\t\t\t\tapi: protocol,\n\t\t\t\t\t\tbaseURL: normalizedBaseURL,\n\t\t\t\t\t\tmodels: (multiKey ? firstEntry.models : models).map((model) => ({ ...model })),\n\t\t\t\t\t\t...(multiKey || Object.keys(keyEntries).length > 0 ? { multiKey, keyEntries: entries } : {})\n\t\t\t\t\t};\n\t\t\t\t\tconst written = await operations.writeSettings(NS$1, [{\n\t\t\t\t\t\top: \"set\",\n\t\t\t\t\t\tpath: [\"providers\", route],\n\t\t\t\t\t\tvalue: profile\n\t\t\t\t\t}], openedAt);\n\t\t\t\t\tif (written.kind !== \"written\") return written.kind === \"conflict\" ? t(\"conflict\") : written.message;\n\t\t\t\t\tsetCommitted(true);\n\t\t\t\t}\n\t\t\t\tif (multiKey) return storeMultiKeyDrafts(operations, entries, entryKeyDrafts, setEntryKeyDrafts);\n\t\t\t\tif (storesKey) {\n\t\t\t\t\tconst stored = await operations.storeCredential(keyRef, keyValue);\n\t\t\t\t\tif (stored !== void 0) return stored;\n\t\t\t\t\tsetKeyDraft(\"\");\n\t\t\t\t}\n\t\t\t};\n\t\t\tconst create = async () => {\n\t\t\t\tif (saving.current || !ready || props.readOnly || listBusy) return;\n\t\t\t\tsaving.current = true;\n\t\t\t\tsetBusy(true);\n\t\t\t\tsetFailure(void 0);\n\t\t\t\ttry {\n\t\t\t\t\tconst outcome = await createOnce();\n\t\t\t\t\tif (multiKey) setEntrySaveState({ ok: outcome === void 0, entries: structuredClone(outcome === void 0 ? normalizedMultiKeyEntries(route, keyEntries) : keyEntries) });\n\t\t\t\t\tif (outcome !== void 0) {\n\t\t\t\t\t\tsetFailure(outcome);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tprops.onClose(true);\n\t\t\t\t} catch {\n\t\t\t\t\tif (multiKey) setEntrySaveState({ ok: false, entries: structuredClone(keyEntries) });\n\t\t\t\t\tsetFailure(t(\"multiKeySaveFailed\"));\n\t\t\t\t} finally {\n\t\t\t\t\tsaving.current = false;\n\t\t\t\t\tsetBusy(false);\n\t\t\t\t}\n\t\t\t};\n\t\t\treturn (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\tclassName: ModelsSection_module_css_default[\"editor\"],\n\t\t\t\tchildren: [\n\t\t\t\t\t(0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\tchildren: t(\"customRoute\")\n\t\t\t\t\t\t}), (0, react_jsx_runtime.jsx)(\"input\", {\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"input\"],\n\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\tvalue: route,\n\t\t\t\t\t\t\tplaceholder: \"acme-gateway\",\n\t\t\t\t\t\t\t\"aria-label\": t(\"customRoute\"),\n\t\t\t\t\t\t\tdisabled: profileDisabled,\n\t\t\t\t\t\t\tonChange: (event) => {\n\t\t\t\t\t\t\t\tsetRoute(event.target.value);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})]\n\t\t\t\t\t}),\n\t\t\t\t\trouteInvalid || routeTaken ? (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"error\"],\n\t\t\t\t\t\tchildren: t(routeInvalid ? \"customRouteInvalid\" : \"customRouteTaken\")\n\t\t\t\t\t}) : (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"advancedHint\"],\n\t\t\t\t\t\tchildren: t(\"customRouteHint\")\n\t\t\t\t\t}),\n\t\t\t\t\t(0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\tchildren: t(\"customDisplayName\")\n\t\t\t\t\t\t}), (0, react_jsx_runtime.jsx)(\"input\", {\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"input\"],\n\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\tvalue: displayName,\n\t\t\t\t\t\t\tplaceholder: route.length === 0 ? t(\"customDisplayName\") : route,\n\t\t\t\t\t\t\t\"aria-label\": t(\"customDisplayName\"),\n\t\t\t\t\t\t\tdisabled: profileDisabled,\n\t\t\t\t\t\t\tonChange: (event) => {\n\t\t\t\t\t\t\t\tsetDisplayName(event.target.value);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})]\n\t\t\t\t\t}),\n\t\t\t\t\t(0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\tchildren: t(\"baseUrl\")\n\t\t\t\t\t\t}), (0, react_jsx_runtime.jsx)(\"input\", {\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"input\"],\n\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\tvalue: baseURL,\n\t\t\t\t\t\t\tplaceholder: t(protocol === \"anthropic-messages\" ? \"customAnthropicBaseUrlPlaceholder\" : \"customBaseUrlPlaceholder\"),\n\t\t\t\t\t\t\t\"aria-label\": t(\"baseUrl\"),\n\t\t\t\t\t\t\t\"aria-invalid\": baseUrlInvalid,\n\t\t\t\t\t\t\tdisabled: profileDisabled,\n\t\t\t\t\t\t\tonChange: (event) => {\n\t\t\t\t\t\t\t\tsetBaseURL(event.target.value);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})]\n\t\t\t\t\t}),\n\t\t\t\t\tbaseUrlInvalid ? (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"error\"],\n\t\t\t\t\t\tchildren: t(\"customBaseUrlInvalid\")\n\t\t\t\t\t}) : null,\n\t\t\t\t\t(0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\tchildren: t(\"customApi\")\n\t\t\t\t\t\t}), (0, react_jsx_runtime.jsx)(\"select\", {\n\t\t\t\t\t\t\tclassName: `${ModelsSection_module_css_default[\"input\"]} ${ModelsSection_module_css_default[\"selectInput\"]}`,\n\t\t\t\t\t\t\tvalue: protocol,\n\t\t\t\t\t\t\t\"aria-label\": t(\"customApi\"),\n\t\t\t\t\t\t\tdisabled: profileDisabled,\n\t\t\t\t\t\t\tonChange: (event) => {\n\t\t\t\t\t\t\t\tsetProtocol(event.target.value);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tchildren: protocols.map((choice) => (0, react_jsx_runtime.jsx)(\"option\", {\n\t\t\t\t\t\t\t\tvalue: choice,\n\t\t\t\t\t\t\t\tchildren: protocolLabel(t, choice)\n\t\t\t\t\t\t\t}, choice))\n\t\t\t\t\t\t})]\n\t\t\t\t\t}),\n\t\t\t\t\tsupportsMultiKey ? (0, react_jsx_runtime.jsx)(MultiKeyToggle, {\n\t\t\t\t\t\tt, checked: multiKey, disabled: profileDisabled || listBusy, hasUnsavedKeys: hasMultiKeyDrafts(entryKeyDrafts),\n\t\t\t\t\t\tonChange: (enabled) => {\n\t\t\t\t\t\t\tif (enabled && Object.keys(keyEntries).length === 0) {\n\t\t\t\t\t\t\t\tconst [id, entry] = newMultiKeyEntry(route, { name: displayName || route || t(\"multiKeyDefaultName\"), models });\n\t\t\t\t\t\t\t\tsetKeyEntries({ [id]: entry });\n\t\t\t\t\t\t\t\tif (keyDraft.length > 0) setEntryKeyDrafts({ [id]: keyDraft });\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsetMultiKey(enabled);\n\t\t\t\t\t\t}\n\t\t\t\t\t}) : null,\n\t\t\t\t\tmultiKey ? (0, react_jsx_runtime.jsx)(MultiKeyEntriesEditor, {\n\t\t\t\t\t\troute, entries: keyEntries, protocols, saveState: entrySaveState, savedEntries: entrySaveState?.ok ? entrySaveState.entries : void 0, onChange: setKeyEntries,\n\t\t\t\t\t\tkeyDrafts: entryKeyDrafts, onKeyDraftsChange: setEntryKeyDrafts,\n\t\t\t\t\t\tconfirmations: entryConfirmations, onConfirmationsChange: setEntryConfirmations,\n\t\t\t\t\t\tpersistedEntries: committed ? normalizedMultiKeyEntries(route, keyEntries) : {},\n\t\t\t\t\t\tprobe: { settingsNs: NS$1, ...(committed ? { provider: route } : {}), baseURL: normalizedBaseURL, api: protocol },\n\t\t\t\t\t\tprobeBlocked: baseUrlInvalid ? \"customBaseUrlInvalid\" : normalizedBaseURL.length === 0 ? \"customNeedsBaseUrl\" : void 0,\n\t\t\t\t\t\treasoningLevels, operations, t, disabled: profileDisabled || listBusy, keyDisabled: disabled || listBusy, onBusyChange: setListBusy\n\t\t\t\t\t}) : null,\n\t\t\t\t\tmultiKey ? null : (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\tchildren: [\n\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\t\tchildren: t(\"keyInput\")\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(ApiKeyInput, {\n\t\t\t\t\t\t\t\tt,\n\t\t\t\t\t\t\t\tvalue: keyDraft,\n\t\t\t\t\t\t\t\tplaceholder: t(\"keyPlaceholder\"),\n\t\t\t\t\t\t\t\t\"aria-label\": t(\"keyInput\"),\n\t\t\t\t\t\t\t\tdisabled,\n\t\t\t\t\t\t\t\tonChange: (event) => {\n\t\t\t\t\t\t\t\t\tsetKeyDraft(event.target.value);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tkeyFailure === void 0 ? null : (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"error\"],\n\t\t\t\t\t\t\t\tchildren: t(keyFailure === \"keyBlank\" ? \"keyBlankNew\" : keyFailure)\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t]\n\t\t\t\t\t}),\n\t\t\t\t\t!multiKey ? (0, react_jsx_runtime.jsx)(ModelListEditor, {\n\t\t\t\t\t\tmodels,\n\t\t\t\t\t\tonChange: setModels,\n\t\t\t\t\t\treasoningLevels,\n\t\t\t\t\t\tprobe: {\n\t\t\t\t\t\t\tsettingsNs: NS$1,\n\t\t\t\t\t\t\tbaseURL: normalizedBaseURL,\n\t\t\t\t\t\t\tapi: protocol,\n\t\t\t\t\t\t\t...keyValue.length === 0 ? {} : { apiKey: keyValue }\n\t\t\t\t\t\t},\n\t\t\t\t\t\tprobeBlocked: baseUrlInvalid ? \"customBaseUrlInvalid\" : keyFailure === \"keyBlank\" ? \"keyBlankNew\" : keyFailure,\n\t\t\t\t\t\toperations,\n\t\t\t\t\t\tt,\n\t\t\t\t\t\tdisabled: profileDisabled,\n\t\t\t\t\t\tonBusyChange: setListBusy\n\t\t\t\t\t}) : null,\n\t\t\t\t\tfailure !== void 0 ? (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"error\"],\n\t\t\t\t\t\tchildren: failure\n\t\t\t\t\t}) : null,\n\t\t\t\t\thint === void 0 ? null : (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"advancedHint\"],\n\t\t\t\t\t\tchildren: hint\n\t\t\t\t\t}),\n\t\t\t\t\t(0, react_jsx_runtime.jsx)(EditorFooter, {\n\t\t\t\t\t\tt,\n\t\t\t\t\t\tbusy,\n\t\t\t\t\t\tsubmitDisabled: disabled || listBusy || !ready,\n\t\t\t\t\t\tsubmitLabelKey: \"create\",\n\t\t\t\t\t\tsubmitBusyLabelKey: \"creating\",\n\t\t\t\t\t\tonCancel: () => {\n\t\t\t\t\t\t\tprops.onClose(committed);\n\t\t\t\t\t\t},\n\t\t\t\t\t\tonSubmit: () => {\n\t\t\t\t\t\t\tcreate();\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t]\n\t\t\t});\n\t\t}"
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"before": "function ProviderEditor(props) {\n\t\t\tconst { namespace, schema, settingsPath, operations, t } = props;\n\t\t\tconst [draft, setDraft] = (0, react.useState)(() => draftAt(schema, namespace, settingsPath));\n\t\t\tconst [entryKeyDrafts, setEntryKeyDrafts] = (0, react.useState)({});\n\t\t\tconst [entryConfirmations, setEntryConfirmations] = (0, react.useState)({});\n\t\t\tconst saving = (0, react.useRef)(false);\n\t\t\tconst [keyDraft, setKeyDraft] = (0, react.useState)(\"\");\n\t\t\tconst [busy, setBusy] = (0, react.useState)(false);\n\t\t\tconst [listBusy, setListBusy] = (0, react.useState)(false);\n\t\t\tconst { onBusyChange } = props;\n\t\t\t(0, react.useEffect)(() => {\n\t\t\t\tonBusyChange?.(busy || listBusy);\n\t\t\t}, [\n\t\t\t\tbusy,\n\t\t\t\tlistBusy,\n\t\t\t\tonBusyChange\n\t\t\t]);\n\t\t\tconst [failure, setFailure] = (0, react.useState)(void 0);\n\t\t\tconst [committedOriginal, setCommittedOriginal] = (0, react.useState)(() => schema.getPath(namespace.user, settingsPath));\n\t\t\tconst [expectedRevision, setExpectedRevision] = (0, react.useState)(() => namespace.revision);\n\t\t\tconst root = (0, react.useMemo)(() => schema.rehydrate(namespace.schema), [namespace.schema, schema]);\n\t\t\tconst node = (0, react.useMemo)(() => schema.nodeAtPath(root, settingsPath), [\n\t\t\t\troot,\n\t\t\t\tschema,\n\t\t\t\tsettingsPath\n\t\t\t]);\n\t\t\tconst fallback = schema.getPath(namespace.value, settingsPath);\n\t\t\tconst disabled = props.readOnly || busy;\n\t\t\tconst layout = layoutOf(namespace.ns);\n\t\t\tconst keyRef = refFor(schema, namespace, settingsPath, props.provider);\n\t\t\tconst supportsMultiKey = layout === \"pi-ai\" && props.declared === true && props.credentialOnly !== true && supportsMultiKeySchema(namespace, schema, settingsPath);\n\t\t\tconst multiKey = supportsMultiKey && (draft.multiKey ?? fallback?.multiKey) === true;\n\t\t\tconst keyEntries = draft.keyEntries ?? fallback?.keyEntries ?? {};\n\t\t\tconst entryFailure = multiKey ? multiKeyFailure(props.provider, keyEntries, entryKeyDrafts, entryConfirmations, t) : void 0;\n\t\t\tconst protocols = (0, react.useMemo)(() => layout === \"pi-ai\" ? protocolChoices(namespace, schema) : [], [\n\t\t\t\tlayout,\n\t\t\t\tnamespace,\n\t\t\t\tschema\n\t\t\t]);\n\t\t\tconst stringAt = (source, key) => {\n\t\t\t\tconst value = schema.getPath(source, [key]);\n\t\t\t\treturn typeof value === \"string\" && value.trim().length > 0 ? value : void 0;\n\t\t\t};\n\t\t\tconst setField = (key, next) => {\n\t\t\t\tconst value = next === void 0 || next.trim().length === 0 ? void 0 : next;\n\t\t\t\tsetDraft((current) => value === void 0 ? schema.deletePath(current, [key]) : schema.setPath(current, [key], value));\n\t\t\t};\n\t\t\tconst reasoningLevels = (0, react.useMemo)(() => layout === \"pi-ai\" && props.declared === true ? reasoningLevelChoices(namespace, schema) : [], [\n\t\t\t\tlayout,\n\t\t\t\tprops.declared,\n\t\t\t\tnamespace,\n\t\t\t\tschema\n\t\t\t]);\n\t\t\tconst editsReasoning = reasoningLevels.length > 0;\n\t\t\tconst validateModels = (value) => validateDeepSeekModels(value) ?? (editsReasoning ? validateReasoningEfforts(value) : void 0);\n\t\t\tconst modelFailure = multiKey ? void 0 : validateModels(schema.getPath(draft, [\"models\"]));\n\t\t\tconst keyFailure = multiKey ? void 0 : apiKeyFailure(keyDraft);\n\t\t\tconst keyValue = keyDraft.trim();\n\t\t\tconst shownKeyFailure = (props.credentialRequired === true && keyDraft.length > 0 && keyValue.length === 0 ? \"keyRequired\" : void 0) ?? keyFailure;\n\t\t\tconst probeApi = stringAt(draft, \"api\") ?? stringAt(fallback, \"api\");\n\t\t\tconst probeBaseURL = stringAt(draft, \"baseURL\") ?? stringAt(fallback, \"baseURL\");\n\t\t\tconst probe = {\n\t\t\t\tsettingsNs: namespace.ns,\n\t\t\t\tprovider: props.provider,\n\t\t\t\t...probeBaseURL === void 0 ? {} : { baseURL: probeBaseURL },\n\t\t\t\t...probeApi === void 0 ? {} : { api: probeApi },\n\t\t\t\t...keyValue.length === 0 ? {} : { apiKey: keyValue }\n\t\t\t};\n\t\t\t/**\n\t\t\t* The write for this card, or a failure message. Every edit travels as\n\t\t\t* path ops against the STORED section: the draft comes from the redacted\n\t\t\t* descriptor, so a wholesale replace rebuilt from it could delete fields\n\t\t\t* outside the card. Ops name only the fields this card can see.\n\t\t\t*/\n\t\t\tconst applyOnce = async () => {\n\t\t\t\tconst ns = namespace.ns;\n\t\t\t\tconst normalizedDraft = supportsMultiKey && schema.hasPath(draft, [\"keyEntries\"]) ? schema.setPath(draft, [\"keyEntries\"], normalizedMultiKeyEntries(props.provider, keyEntries)) : draft;\n\t\t\t\tconst next = multiKey ? schema.setPath(normalizedDraft, [\"keyEntries\"], normalizedMultiKeyEntries(props.provider, keyEntries)) : layout === \"pi-ai\" && stringAt(draft, \"apiKeyEnv\") === void 0 && stringAt(fallback, \"apiKeyEnv\") === void 0 && keyValue.length > 0 ? schema.setPath(normalizedDraft, [\"apiKeyEnv\"], keyRef) : normalizedDraft;\n\t\t\t\tif (entryFailure !== void 0) return entryFailure;\n\t\t\t\tif (props.credentialOnly !== true && !multiKey) {\n\t\t\t\t\tconst failure = validateModels(schema.getPath(next, [\"models\"]));\n\t\t\t\t\t/* v8 ignore next 3 -- unreachable from the card: the same failure disables submit */\n\t\t\t\t\tif (failure !== void 0) return `${t(\"model\")} ${String(failure.index + 1)}: ${t(failure.key)}`;\n\t\t\t\t}\n\t\t\t\t/* v8 ignore next -- apply is only reachable from the rendered card, which required a resolved node */\n\t\t\t\tif (props.credentialOnly !== true && node !== void 0 && settingsPath.length === 0) {\n\t\t\t\t\tconst sectionError = schema.validate(node, next);\n\t\t\t\t\tif (sectionError !== void 0) return sectionError;\n\t\t\t\t}\n\t\t\t\tconst materializesNativeProfile = layout === \"pi-ai\" && fallback === void 0 && committedOriginal === void 0 && Object.keys(next).length === 0;\n\t\t\t\tconst ops = props.credentialOnly === true ? [] : materializesNativeProfile ? [{\n\t\t\t\t\top: \"set\",\n\t\t\t\t\tpath: [...settingsPath],\n\t\t\t\t\tvalue: {}\n\t\t\t\t}] : pathOps(settingsPath, committedOriginal, next);\n\t\t\t\tif (ops.length > 0) {\n\t\t\t\t\tconst written = await operations.writeSettings(ns, ops, expectedRevision);\n\t\t\t\t\tif (written.kind !== \"written\") return written.kind === \"conflict\" ? t(\"conflict\") : written.message;\n\t\t\t\t\tsetCommittedOriginal(schema.getPath(written.view.user, settingsPath));\n\t\t\t\t\tsetExpectedRevision(written.view.revision);\n\t\t\t\t\tsetDraft(next);\n\t\t\t\t}\n\t\t\t\tif (multiKey) return storeMultiKeyDrafts(operations, next.keyEntries, entryKeyDrafts, setEntryKeyDrafts);\n\t\t\t\tif (keyValue.length > 0) {\n\t\t\t\t\tconst stored = await operations.storeCredential(keyRef, keyValue);\n\t\t\t\t\tif (stored !== void 0) return stored;\n\t\t\t\t}\n\t\t\t\tsetKeyDraft(\"\");\n\t\t\t};\n\t\t\tconst apply = async () => {\n\t\t\t\tif (saving.current || props.readOnly || listBusy || entryFailure !== void 0) return;\n\t\t\t\tsaving.current = true;\n\t\t\t\tsetBusy(true);\n\t\t\t\tsetFailure(void 0);\n\t\t\t\ttry {\n\t\t\t\t\tconst failure = await applyOnce();\n\t\t\t\t\tif (failure !== void 0) {\n\t\t\t\t\t\tsetFailure(failure);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tprops.onClose(true);\n\t\t\t\t} catch {\n\t\t\t\t\tsetFailure(t(\"multiKeySaveFailed\"));\n\t\t\t\t} finally {\n\t\t\t\t\tsaving.current = false;\n\t\t\t\t\tsetBusy(false);\n\t\t\t\t}\n\t\t\t};\n\t\t\tif (node === void 0) return (0, react_jsx_runtime.jsxs)(\"p\", {\n\t\t\t\tclassName: ModelsSection_module_css_default[\"error\"],\n\t\t\t\tchildren: [\n\t\t\t\t\tprops.provider,\n\t\t\t\t\t\": \",\n\t\t\t\t\tprops.t(\"settingsPathUnresolvable\")\n\t\t\t\t]\n\t\t\t});\n\t\t\t/**\n\t\t\t* The catalog beneath the user layer: what the composition entry pinned, or\n\t\t\t* else the schema default that `resolve` would supply. The effective value\n\t\t\t* cannot answer this — it still carries the stored override until the unset\n\t\t\t* is applied, so reading it would echo that override straight back the\n\t\t\t* moment reset drops it, leaving the rows unchanged until a reload.\n\t\t\t*/\n\t\t\tconst inheritedModels = () => {\n\t\t\t\treturn schema.getPath(namespace.base, [...settingsPath, \"models\"]) ?? schema.nodeAtPath(root, [...settingsPath, \"models\"])?.meta.default;\n\t\t\t};\n\t\t\t/**\n\t\t\t* The curated fields of one known adapter family. The family arrives\n\t\t\t* narrowed so the per-family branches below are total: an unknown namespace\n\t\t\t* renders the hint instead and never reaches this body.\n\t\t\t*/\n\t\t\tconst curatedFields = (family) => {\n\t\t\t\tconst ownsIdentity = family === \"pi-ai\" && props.declared === true;\n\t\t\t\tconst customModels = schema.getPath(draft, [\"models\"]);\n\t\t\t\tconst modelsOverridden = schema.hasPath(draft, [\"models\"]);\n\t\t\t\tconst models = modelDrafts(modelsOverridden ? customModels : inheritedModels());\n\t\t\t\tconst defaultContextWindow = schema.getPath(fallback, [\"defaultContextWindow\"]);\n\t\t\t\tconst defaultMaxTokens = schema.getPath(fallback, [\"maxTokens\"]);\n\t\t\t\tconst defaultInput = schema.getPath(fallback, [\"defaultInput\"]);\n\t\t\t\tconst baseURL = stringAt(fallback, \"baseURL\") ?? props.defaultBaseURL;\n\t\t\t\tconst endpointEnv = props.baseURLEnv ?? [];\n\t\t\t\tconst endpointHint = family === \"deepseek\" ? t(\"deepSeekEndpointHint\") : baseURL === void 0 && endpointEnv.length > 0 ? t(\"baseUrlEnvironment\").replace(\"{env}\", () => endpointEnv.join(\", \")) : void 0;\n\t\t\t\tconst namedRef = stringAt(fallback, \"apiKeyEnv\");\n\t\t\t\tconst nativeAuth = namedRef === void 0 ? props.nativeAuth : void 0;\n\t\t\t\tconst authRefs = namedRef === void 0 ? (nativeAuth?.env ?? []).filter((ref) => !endpointEnv.includes(ref)) : [namedRef];\n\t\t\t\tconst visibleRefs = authRefs.filter((ref) => !ref.toLowerCase().includes(\"oauth\"));\n\t\t\t\tconst keyHint = visibleRefs[0];\n\t\t\t\tconst checkedRefs = authRefs.map((ref) => [ref, props.credentialChecks?.[ref] ?? (ref === namedRef ? props.credential : void 0)]);\n\t\t\t\tconst detected = checkedRefs.find(([, info]) => info?.configured === true);\n\t\t\t\tconst detectedRef = detected?.[0];\n\t\t\t\tconst detectedVisibleRef = detectedRef === void 0 || !visibleRefs.includes(detectedRef) ? void 0 : detectedRef;\n\t\t\t\tconst missingRefs = checkedRefs.length > 0 && checkedRefs.every(([, info]) => info?.configured === false);\n\t\t\t\tconst savedCredential = detected?.[1]?.source === \"file\";\n\t\t\t\tconst credentialHint = keyDraft.length > 0 || savedCredential || keyHint === void 0 || props.credentialRequired === true ? void 0 : t(detectedRef === void 0 ? missingRefs ? \"keyFallbackMissing\" : \"keyFallbackUnchecked\" : detectedVisibleRef === void 0 ? \"keyFallbackDetectedHidden\" : \"keyFallbackDetected\").replace(\"{hint}\", () => detectedVisibleRef ?? keyHint);\n\t\t\t\tconst keyHelp = visibleRefs.length === 0 ? void 0 : t(\"keyHelp\").replace(\"{env}\", () => visibleRefs.join(\" / \"));\n\t\t\t\tconst authHelp = keyHelp === void 0 ? null : (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {\n\t\t\t\t\tlabel: keyHelp,\n\t\t\t\t\tside: \"right\",\n\t\t\t\t\tdelayMs: 0,\n\t\t\t\t\tfocusDelayMs: 0,\n\t\t\t\t\tportal: true,\n\t\t\t\t\topenOnClick: true,\n\t\t\t\t\tchildren: (0, react_jsx_runtime.jsx)(\"button\", {\n\t\t\t\t\t\ttype: \"button\",\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"helpButton\"],\n\t\t\t\t\t\t\"aria-label\": t(\"authHelp\"),\n\t\t\t\t\t\tchildren: \"?\"\n\t\t\t\t\t})\n\t\t\t\t});\n\t\t\t\tconst keylessNativeAuth = nativeAuth?.env.length === 0 && nativeAuth.oauth;\n\t\t\t\tconst keyPlaceholder = keyHint === void 0 || props.credentialRequired === true ? t(\"keyPlaceholder\") : t(savedCredential ? \"keyPlaceholderSaved\" : \"keyPlaceholderFallback\").replace(\"{hint}\", () => keyHint);\n\t\t\t\t/** What both family editors take: the rows, whose layer owns them, and the two writes. */\n\t\t\t\tconst catalogProps = {\n\t\t\t\t\tmodels,\n\t\t\t\t\toverridden: modelsOverridden,\n\t\t\t\t\tt,\n\t\t\t\t\tdisabled,\n\t\t\t\t\tonChange: (next) => {\n\t\t\t\t\t\tsetDraft((current) => schema.setPath(current, [\"models\"], next));\n\t\t\t\t\t},\n\t\t\t\t\tonReset: () => {\n\t\t\t\t\t\tsetDraft((current) => schema.deletePath(current, [\"models\"]));\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tconst credentials = (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [supportsMultiKey ? (0, react_jsx_runtime.jsx)(MultiKeyToggle, {\n\t\t\t\t\tt, checked: multiKey, disabled: disabled || listBusy, hasUnsavedKeys: hasMultiKeyDrafts(entryKeyDrafts),\n\t\t\t\t\tonChange: (enabled) => {\n\t\t\t\t\t\tlet updated = schema.setPath(draft, [\"multiKey\"], enabled);\n\t\t\t\t\t\tif (enabled && Object.keys(keyEntries).length === 0) {\n\t\t\t\t\t\t\tconst namedRef = stringAt(draft, \"apiKeyEnv\") ?? stringAt(fallback, \"apiKeyEnv\");\n\t\t\t\t\t\t\tconst [id, entry] = newMultiKeyEntry(props.provider, {\n\t\t\t\t\t\t\t\tname: stringAt(draft, \"displayName\") ?? stringAt(fallback, \"displayName\") ?? props.displayName ?? props.provider,\n\t\t\t\t\t\t\t\tapiKeyEnv: namedRef,\n\t\t\t\t\t\t\t\tmodels: draft.models ?? fallback?.models ?? inheritedModels()\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (keyDraft.length > 0) {\n\t\t\t\t\t\t\t\tsetEntryKeyDrafts({ [id]: keyDraft });\n\t\t\t\t\t\t\t\tif (namedRef === void 0) updated = schema.setPath(updated, [\"apiKeyEnv\"], multiKeyRef(props.provider, id));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tupdated = schema.setPath(updated, [\"keyEntries\"], { [id]: entry });\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetDraft(updated);\n\t\t\t\t\t}\n\t\t\t\t}) : null, multiKey ? (0, react_jsx_runtime.jsx)(MultiKeyEntriesEditor, {\n\t\t\t\t\troute: props.provider, entries: keyEntries,\n\t\t\t\t\tonChange: (entries) => setDraft((current) => schema.setPath(current, [\"keyEntries\"], entries)),\n\t\t\t\t\tkeyDrafts: entryKeyDrafts, onKeyDraftsChange: setEntryKeyDrafts,\n\t\t\t\t\tconfirmations: entryConfirmations, onConfirmationsChange: setEntryConfirmations,\n\t\t\t\t\tpersistedEntries: schema.getPath(committedOriginal, [\"keyEntries\"]) ?? fallback?.keyEntries ?? {},\n\t\t\t\t\tcredentialChecks: props.credentialChecks,\n\t\t\t\t\tprobe: { settingsNs: namespace.ns, provider: props.provider, ...(probeBaseURL === void 0 ? {} : { baseURL: probeBaseURL }), ...(probeApi === void 0 ? {} : { api: probeApi }) },\n\t\t\t\t\treasoningLevels, operations, t, disabled: disabled || listBusy, onBusyChange: setListBusy\n\t\t\t\t}) : null, multiKey || keylessNativeAuth ? null : (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\tchildren: [\n\t\t\t\t\t\t(0, react_jsx_runtime.jsxs)(\"span\", {\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\tchildren: [t(\"keyInput\"), authHelp]\n\t\t\t\t\t\t}),\n\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(ApiKeyInput, {\n\t\t\t\t\t\t\tt,\n\t\t\t\t\t\t\tvalue: keyDraft,\n\t\t\t\t\t\t\tplaceholder: keyPlaceholder,\n\t\t\t\t\t\t\t\"aria-label\": t(\"keyInput\"),\n\t\t\t\t\t\t\t\"aria-invalid\": shownKeyFailure !== void 0,\n\t\t\t\t\t\t\t\"aria-describedby\": credentialHint === void 0 ? void 0 : `${props.provider}-credential-hint`,\n\t\t\t\t\t\t\trequired: props.credentialRequired === true,\n\t\t\t\t\t\t\tautoFocus: props.autoFocusCredential === true,\n\t\t\t\t\t\t\tdisabled,\n\t\t\t\t\t\t\tonChange: (event) => {\n\t\t\t\t\t\t\t\tsetKeyDraft(event.target.value);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tcredentialHint === void 0 ? null : (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\t\tid: `${props.provider}-credential-hint`,\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[missingRefs ? \"notice\" : detectedRef === void 0 ? \"advancedHint\" : \"savedNotice\"],\n\t\t\t\t\t\t\tchildren: credentialHint\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tshownKeyFailure === void 0 ? null : (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"error\"],\n\t\t\t\t\t\t\tchildren: t(shownKeyFailure)\n\t\t\t\t\t\t})\n\t\t\t\t\t]\n\t\t\t\t})] });\n\t\t\t\tconst customization = props.credentialOnly === true ? null : (0, react_jsx_runtime.jsxs)(\"details\", {\n\t\t\t\t\tclassName: ModelsSection_module_css_default[\"customized\"],\n\t\t\t\t\topen: supportsMultiKey ? true : void 0,\n\t\t\t\t\t\"data-multi-key-shared-settings\": supportsMultiKey ? true : void 0,\n\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"summary\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"customizedSummary\"],\n\t\t\t\t\t\tchildren: t(supportsMultiKey ? \"multiKeySharedSettings\" : \"customized\")\n\t\t\t\t\t}), (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"customizedBody\"],\n\t\t\t\t\t\tchildren: [\n\t\t\t\t\t\t\townsIdentity ? (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\t\t\tchildren: t(\"customDisplayName\")\n\t\t\t\t\t\t\t\t}), (0, react_jsx_runtime.jsx)(\"input\", {\n\t\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"input\"],\n\t\t\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\t\t\tvalue: stringAt(draft, \"displayName\") ?? \"\",\n\t\t\t\t\t\t\t\t\tplaceholder: stringAt(schema.getPath(namespace.base, settingsPath), \"displayName\") ?? props.provider,\n\t\t\t\t\t\t\t\t\t\"aria-label\": t(\"customDisplayName\"),\n\t\t\t\t\t\t\t\t\tdisabled,\n\t\t\t\t\t\t\t\t\tonChange: (event) => {\n\t\t\t\t\t\t\t\t\t\tsetField(\"displayName\", event.target.value);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t})]\n\t\t\t\t\t\t\t}) : null,\n\t\t\t\t\t\t\t(0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\t\t\tchildren: [\n\t\t\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\t\t\t\tchildren: t(\"baseUrl\")\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(\"input\", {\n\t\t\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"input\"],\n\t\t\t\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\t\t\t\tvalue: stringAt(draft, \"baseURL\") ?? \"\",\n\t\t\t\t\t\t\t\t\t\tplaceholder: family === \"deepseek\" ? t(\"deepSeekBaseUrl\") : baseURL === void 0 ? t(endpointEnv.length > 0 ? \"baseUrlConfigured\" : \"baseUrlDefault\") : t(\"baseUrlPlaceholder\").replace(\"{url}\", () => baseURL),\n\t\t\t\t\t\t\t\t\t\t\"aria-describedby\": endpointHint === void 0 ? void 0 : `${props.provider}-endpoint-hint`,\n\t\t\t\t\t\t\t\t\t\t\"aria-label\": t(\"baseUrl\"),\n\t\t\t\t\t\t\t\t\t\tdisabled,\n\t\t\t\t\t\t\t\t\t\tonChange: (event) => {\n\t\t\t\t\t\t\t\t\t\t\tsetField(\"baseURL\", event.target.value === \"\" ? void 0 : event.target.value);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\tendpointHint === void 0 ? null : (0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\t\t\t\tid: `${props.provider}-endpoint-hint`,\n\t\t\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"advancedHint\"],\n\t\t\t\t\t\t\t\t\t\tchildren: endpointHint\n\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\townsIdentity ? (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\t\t\tchildren: t(\"customApi\")\n\t\t\t\t\t\t\t\t}), (0, react_jsx_runtime.jsxs)(\"select\", {\n\t\t\t\t\t\t\t\t\tclassName: `${ModelsSection_module_css_default[\"input\"]} ${ModelsSection_module_css_default[\"selectInput\"]}`,\n\t\t\t\t\t\t\t\t\tvalue: probeApi ?? \"\",\n\t\t\t\t\t\t\t\t\t\"aria-label\": t(\"customApi\"),\n\t\t\t\t\t\t\t\t\tdisabled,\n\t\t\t\t\t\t\t\t\tonChange: (event) => {\n\t\t\t\t\t\t\t\t\t\tsetField(\"api\", event.target.value);\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tchildren: [probeApi === void 0 ? (0, react_jsx_runtime.jsx)(\"option\", {\n\t\t\t\t\t\t\t\t\t\tvalue: \"\",\n\t\t\t\t\t\t\t\t\t\tchildren: t(\"customApiUnset\")\n\t\t\t\t\t\t\t\t\t}) : null, protocols.map((choice) => (0, react_jsx_runtime.jsx)(\"option\", {\n\t\t\t\t\t\t\t\t\t\tvalue: choice,\n\t\t\t\t\t\t\t\t\t\tchildren: protocolLabel(t, choice)\n\t\t\t\t\t\t\t\t\t}, choice))]\n\t\t\t\t\t\t\t\t})]\n\t\t\t\t\t\t\t}) : null,\n\t\t\t\t\t\t\tmultiKey ? null : family === \"deepseek\" ? (0, react_jsx_runtime.jsx)(DeepSeekModelsEditor, {\n\t\t\t\t\t\t\t\t...catalogProps,\n\t\t\t\t\t\t\t\tdefaultContextWindow: typeof defaultContextWindow === \"number\" ? defaultContextWindow : void 0,\n\t\t\t\t\t\t\t\tdefaultMaxTokens: typeof defaultMaxTokens === \"number\" ? defaultMaxTokens : void 0\n\t\t\t\t\t\t\t}) : (0, react_jsx_runtime.jsx)(ModelListEditor, {\n\t\t\t\t\t\t\t\t...catalogProps,\n\t\t\t\t\t\t\t\tcatalogProvider: props.declared === true ? void 0 : props.provider,\n\t\t\t\t\t\t\t\treasoningLevels,\n\t\t\t\t\t\t\t\tdefaultInput: Array.isArray(defaultInput) ? defaultInput : void 0,\n\t\t\t\t\t\t\t\tprobe,\n\t\t\t\t\t\t\t\tprobeBlocked: keyFailure,\n\t\t\t\t\t\t\t\toperations,\n\t\t\t\t\t\t\t\tonBusyChange: setListBusy\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t]\n\t\t\t\t\t})]\n\t\t\t\t});\n\t\t\t\treturn (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: supportsMultiKey ? [customization, credentials] : [credentials, customization] });\n\t\t\t};\n\t\t\treturn (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\tclassName: props.credentialOnly === true ? ModelsSection_module_css_default[\"addBlock\"] : ModelsSection_module_css_default[\"editor\"],\n\t\t\t\tchildren: [\n\t\t\t\t\tprops.hideTitle === true ? null : (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"editorHeader\"],\n\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"editorTitle\"],\n\t\t\t\t\t\t\tchildren: props.displayName\n\t\t\t\t\t\t}), props.provider !== props.displayName ? (0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"editorRoute\"],\n\t\t\t\t\t\t\tchildren: props.provider\n\t\t\t\t\t\t}) : null]\n\t\t\t\t\t}),\n\t\t\t\t\tlayout === \"unknown\" ? (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"advancedHint\"],\n\t\t\t\t\t\tchildren: `${t(\"advancedHint\")} (${namespace.ns})`\n\t\t\t\t\t}) : curatedFields(layout),\n\t\t\t\t\t(failure ?? entryFailure) !== void 0 ? (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"error\"],\n\t\t\t\t\t\tchildren: failure ?? entryFailure\n\t\t\t\t\t}) : null,\n\t\t\t\t\tprops.credentialOnly === true || modelFailure === void 0 ? null : (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"advancedHint\"],\n\t\t\t\t\t\tchildren: `${t(\"model\")} ${String(modelFailure.index + 1)}: ${t(modelFailure.key)}`\n\t\t\t\t\t}),\n\t\t\t\t\t(0, react_jsx_runtime.jsx)(EditorFooter, {\n\t\t\t\t\t\tt,\n\t\t\t\t\t\tbusy,\n\t\t\t\t\t\tsubmitDisabled: disabled || listBusy || layout === \"unknown\" || entryFailure !== void 0 || props.credentialOnly !== true && modelFailure !== void 0 || !multiKey && (shownKeyFailure !== void 0 || props.credentialRequired === true && keyValue.length === 0),\n\t\t\t\t\t\tsubmitLabelKey: props.submitLabelKey ?? \"apply\",\n\t\t\t\t\t\tsubmitBusyLabelKey: props.submitBusyLabelKey ?? \"applying\",\n\t\t\t\t\t\t...props.cancelLabelKey === void 0 ? {} : { cancelLabelKey: props.cancelLabelKey },\n\t\t\t\t\t\tonCancel: () => {\n\t\t\t\t\t\t\tprops.onClose(false);\n\t\t\t\t\t\t},\n\t\t\t\t\t\tonSubmit: () => {\n\t\t\t\t\t\t\tprops.onSubmitCredential?.();\n\t\t\t\t\t\t\tapply();\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t]\n\t\t\t});\n\t\t}",
|
|
206
|
+
"after": "function ProviderEditor(props) {\n\t\t\tconst { namespace, schema, settingsPath, operations, t } = props;\n\t\t\tconst [draft, setDraft] = (0, react.useState)(() => draftAt(schema, namespace, settingsPath));\n\t\t\tconst [entryKeyDrafts, setEntryKeyDrafts] = (0, react.useState)({});\n\t\t\tconst [entryConfirmations, setEntryConfirmations] = (0, react.useState)({});\n\t\t\tconst [entrySaveState, setEntrySaveState] = (0, react.useState)(void 0);\n\t\t\tconst saving = (0, react.useRef)(false);\n\t\t\tconst [keyDraft, setKeyDraft] = (0, react.useState)(\"\");\n\t\t\tconst [busy, setBusy] = (0, react.useState)(false);\n\t\t\tconst [listBusy, setListBusy] = (0, react.useState)(false);\n\t\t\tconst { onBusyChange } = props;\n\t\t\t(0, react.useEffect)(() => {\n\t\t\t\tonBusyChange?.(busy || listBusy);\n\t\t\t}, [\n\t\t\t\tbusy,\n\t\t\t\tlistBusy,\n\t\t\t\tonBusyChange\n\t\t\t]);\n\t\t\tconst [failure, setFailure] = (0, react.useState)(void 0);\n\t\t\tconst [committedOriginal, setCommittedOriginal] = (0, react.useState)(() => schema.getPath(namespace.user, settingsPath));\n\t\t\tconst [expectedRevision, setExpectedRevision] = (0, react.useState)(() => namespace.revision);\n\t\t\tconst root = (0, react.useMemo)(() => schema.rehydrate(namespace.schema), [namespace.schema, schema]);\n\t\t\tconst node = (0, react.useMemo)(() => schema.nodeAtPath(root, settingsPath), [\n\t\t\t\troot,\n\t\t\t\tschema,\n\t\t\t\tsettingsPath\n\t\t\t]);\n\t\t\tconst fallback = schema.getPath(namespace.value, settingsPath);\n\t\t\tconst disabled = props.readOnly || busy;\n\t\t\tconst layout = layoutOf(namespace.ns);\n\t\t\tconst keyRef = refFor(schema, namespace, settingsPath, props.provider);\n\t\t\tconst supportsMultiKey = layout === \"pi-ai\" && props.declared === true && props.credentialOnly !== true && supportsMultiKeySchema(namespace, schema, settingsPath);\n\t\t\tconst multiKey = supportsMultiKey && (draft.multiKey ?? fallback?.multiKey) === true;\n\t\t\tconst keyEntries = draft.keyEntries ?? fallback?.keyEntries ?? {};\n\t\t\tconst entryFailure = multiKey ? multiKeyFailure(props.provider, keyEntries, entryKeyDrafts, entryConfirmations, t) : void 0;\n\t\t\tconst protocols = (0, react.useMemo)(() => layout === \"pi-ai\" ? protocolChoices(namespace, schema) : [], [\n\t\t\t\tlayout,\n\t\t\t\tnamespace,\n\t\t\t\tschema\n\t\t\t]);\n\t\t\tconst stringAt = (source, key) => {\n\t\t\t\tconst value = schema.getPath(source, [key]);\n\t\t\t\treturn typeof value === \"string\" && value.trim().length > 0 ? value : void 0;\n\t\t\t};\n\t\t\tconst setField = (key, next) => {\n\t\t\t\tconst value = next === void 0 || next.trim().length === 0 ? void 0 : next;\n\t\t\t\tsetDraft((current) => value === void 0 ? schema.deletePath(current, [key]) : schema.setPath(current, [key], value));\n\t\t\t};\n\t\t\tconst reasoningLevels = (0, react.useMemo)(() => layout === \"pi-ai\" && props.declared === true ? reasoningLevelChoices(namespace, schema) : [], [\n\t\t\t\tlayout,\n\t\t\t\tprops.declared,\n\t\t\t\tnamespace,\n\t\t\t\tschema\n\t\t\t]);\n\t\t\tconst editsReasoning = reasoningLevels.length > 0;\n\t\t\tconst validateModels = (value) => validateDeepSeekModels(value) ?? (editsReasoning ? validateReasoningEfforts(value) : void 0);\n\t\t\tconst modelFailure = multiKey ? void 0 : validateModels(schema.getPath(draft, [\"models\"]));\n\t\t\tconst keyFailure = multiKey ? void 0 : apiKeyFailure(keyDraft);\n\t\t\tconst keyValue = keyDraft.trim();\n\t\t\tconst shownKeyFailure = (props.credentialRequired === true && keyDraft.length > 0 && keyValue.length === 0 ? \"keyRequired\" : void 0) ?? keyFailure;\n\t\t\tconst probeApi = stringAt(draft, \"api\") ?? stringAt(fallback, \"api\");\n\t\t\tconst probeBaseURL = stringAt(draft, \"baseURL\") ?? stringAt(fallback, \"baseURL\");\n\t\t\tconst probe = {\n\t\t\t\tsettingsNs: namespace.ns,\n\t\t\t\tprovider: props.provider,\n\t\t\t\t...probeBaseURL === void 0 ? {} : { baseURL: probeBaseURL },\n\t\t\t\t...probeApi === void 0 ? {} : { api: probeApi },\n\t\t\t\t...keyValue.length === 0 ? {} : { apiKey: keyValue }\n\t\t\t};\n\t\t\t/**\n\t\t\t* The write for this card, or a failure message. Every edit travels as\n\t\t\t* path ops against the STORED section: the draft comes from the redacted\n\t\t\t* descriptor, so a wholesale replace rebuilt from it could delete fields\n\t\t\t* outside the card. Ops name only the fields this card can see.\n\t\t\t*/\n\t\t\tconst applyOnce = async () => {\n\t\t\t\tconst ns = namespace.ns;\n\t\t\t\tconst normalizedDraft = supportsMultiKey && schema.hasPath(draft, [\"keyEntries\"]) ? schema.setPath(draft, [\"keyEntries\"], normalizedMultiKeyEntries(props.provider, keyEntries)) : draft;\n\t\t\t\tconst next = multiKey ? schema.setPath(normalizedDraft, [\"keyEntries\"], normalizedMultiKeyEntries(props.provider, keyEntries)) : layout === \"pi-ai\" && stringAt(draft, \"apiKeyEnv\") === void 0 && stringAt(fallback, \"apiKeyEnv\") === void 0 && keyValue.length > 0 ? schema.setPath(normalizedDraft, [\"apiKeyEnv\"], keyRef) : normalizedDraft;\n\t\t\t\tif (entryFailure !== void 0) return entryFailure;\n\t\t\t\tif (props.credentialOnly !== true && !multiKey) {\n\t\t\t\t\tconst failure = validateModels(schema.getPath(next, [\"models\"]));\n\t\t\t\t\t/* v8 ignore next 3 -- unreachable from the card: the same failure disables submit */\n\t\t\t\t\tif (failure !== void 0) return `${t(\"model\")} ${String(failure.index + 1)}: ${t(failure.key)}`;\n\t\t\t\t}\n\t\t\t\t/* v8 ignore next -- apply is only reachable from the rendered card, which required a resolved node */\n\t\t\t\tif (props.credentialOnly !== true && node !== void 0 && settingsPath.length === 0) {\n\t\t\t\t\tconst sectionError = schema.validate(node, next);\n\t\t\t\t\tif (sectionError !== void 0) return sectionError;\n\t\t\t\t}\n\t\t\t\tconst materializesNativeProfile = layout === \"pi-ai\" && fallback === void 0 && committedOriginal === void 0 && Object.keys(next).length === 0;\n\t\t\t\tconst ops = props.credentialOnly === true ? [] : materializesNativeProfile ? [{\n\t\t\t\t\top: \"set\",\n\t\t\t\t\tpath: [...settingsPath],\n\t\t\t\t\tvalue: {}\n\t\t\t\t}] : pathOps(settingsPath, committedOriginal, next);\n\t\t\t\tif (ops.length > 0) {\n\t\t\t\t\tconst written = await operations.writeSettings(ns, ops, expectedRevision);\n\t\t\t\t\tif (written.kind !== \"written\") return written.kind === \"conflict\" ? t(\"conflict\") : written.message;\n\t\t\t\t\tsetCommittedOriginal(schema.getPath(written.view.user, settingsPath));\n\t\t\t\t\tsetExpectedRevision(written.view.revision);\n\t\t\t\t\tsetDraft(next);\n\t\t\t\t}\n\t\t\t\tif (multiKey) return storeMultiKeyDrafts(operations, next.keyEntries, entryKeyDrafts, setEntryKeyDrafts);\n\t\t\t\tif (keyValue.length > 0) {\n\t\t\t\t\tconst stored = await operations.storeCredential(keyRef, keyValue);\n\t\t\t\t\tif (stored !== void 0) return stored;\n\t\t\t\t}\n\t\t\t\tsetKeyDraft(\"\");\n\t\t\t};\n\t\t\tconst apply = async () => {\n\t\t\t\tif (saving.current || props.readOnly || listBusy || entryFailure !== void 0) return;\n\t\t\t\tsaving.current = true;\n\t\t\t\tsetBusy(true);\n\t\t\t\tsetFailure(void 0);\n\t\t\t\ttry {\n\t\t\t\t\tconst failure = await applyOnce();\n\t\t\t\t\tif (multiKey) setEntrySaveState({ ok: failure === void 0, entries: structuredClone(failure === void 0 ? normalizedMultiKeyEntries(props.provider, keyEntries) : keyEntries) });\n\t\t\t\t\tif (failure !== void 0) {\n\t\t\t\t\t\tsetFailure(failure);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tif (!multiKey) props.onClose(true);\n\t\t\t\t} catch {\n\t\t\t\t\tif (multiKey) setEntrySaveState({ ok: false, entries: structuredClone(keyEntries) });\n\t\t\t\t\tsetFailure(t(\"multiKeySaveFailed\"));\n\t\t\t\t} finally {\n\t\t\t\t\tsaving.current = false;\n\t\t\t\t\tsetBusy(false);\n\t\t\t\t}\n\t\t\t};\n\t\t\tif (node === void 0) return (0, react_jsx_runtime.jsxs)(\"p\", {\n\t\t\t\tclassName: ModelsSection_module_css_default[\"error\"],\n\t\t\t\tchildren: [\n\t\t\t\t\tprops.provider,\n\t\t\t\t\t\": \",\n\t\t\t\t\tprops.t(\"settingsPathUnresolvable\")\n\t\t\t\t]\n\t\t\t});\n\t\t\t/**\n\t\t\t* The catalog beneath the user layer: what the composition entry pinned, or\n\t\t\t* else the schema default that `resolve` would supply. The effective value\n\t\t\t* cannot answer this — it still carries the stored override until the unset\n\t\t\t* is applied, so reading it would echo that override straight back the\n\t\t\t* moment reset drops it, leaving the rows unchanged until a reload.\n\t\t\t*/\n\t\t\tconst inheritedModels = () => {\n\t\t\t\treturn schema.getPath(namespace.base, [...settingsPath, \"models\"]) ?? schema.nodeAtPath(root, [...settingsPath, \"models\"])?.meta.default;\n\t\t\t};\n\t\t\t/**\n\t\t\t* The curated fields of one known adapter family. The family arrives\n\t\t\t* narrowed so the per-family branches below are total: an unknown namespace\n\t\t\t* renders the hint instead and never reaches this body.\n\t\t\t*/\n\t\t\tconst curatedFields = (family) => {\n\t\t\t\tconst ownsIdentity = family === \"pi-ai\" && props.declared === true;\n\t\t\t\tconst customModels = schema.getPath(draft, [\"models\"]);\n\t\t\t\tconst modelsOverridden = schema.hasPath(draft, [\"models\"]);\n\t\t\t\tconst models = modelDrafts(modelsOverridden ? customModels : inheritedModels());\n\t\t\t\tconst defaultContextWindow = schema.getPath(fallback, [\"defaultContextWindow\"]);\n\t\t\t\tconst defaultMaxTokens = schema.getPath(fallback, [\"maxTokens\"]);\n\t\t\t\tconst defaultInput = schema.getPath(fallback, [\"defaultInput\"]);\n\t\t\t\tconst baseURL = stringAt(fallback, \"baseURL\") ?? props.defaultBaseURL;\n\t\t\t\tconst endpointEnv = props.baseURLEnv ?? [];\n\t\t\t\tconst endpointHint = family === \"deepseek\" ? t(\"deepSeekEndpointHint\") : baseURL === void 0 && endpointEnv.length > 0 ? t(\"baseUrlEnvironment\").replace(\"{env}\", () => endpointEnv.join(\", \")) : void 0;\n\t\t\t\tconst namedRef = stringAt(fallback, \"apiKeyEnv\");\n\t\t\t\tconst nativeAuth = namedRef === void 0 ? props.nativeAuth : void 0;\n\t\t\t\tconst authRefs = namedRef === void 0 ? (nativeAuth?.env ?? []).filter((ref) => !endpointEnv.includes(ref)) : [namedRef];\n\t\t\t\tconst visibleRefs = authRefs.filter((ref) => !ref.toLowerCase().includes(\"oauth\"));\n\t\t\t\tconst keyHint = visibleRefs[0];\n\t\t\t\tconst checkedRefs = authRefs.map((ref) => [ref, props.credentialChecks?.[ref] ?? (ref === namedRef ? props.credential : void 0)]);\n\t\t\t\tconst detected = checkedRefs.find(([, info]) => info?.configured === true);\n\t\t\t\tconst detectedRef = detected?.[0];\n\t\t\t\tconst detectedVisibleRef = detectedRef === void 0 || !visibleRefs.includes(detectedRef) ? void 0 : detectedRef;\n\t\t\t\tconst missingRefs = checkedRefs.length > 0 && checkedRefs.every(([, info]) => info?.configured === false);\n\t\t\t\tconst savedCredential = detected?.[1]?.source === \"file\";\n\t\t\t\tconst credentialHint = keyDraft.length > 0 || savedCredential || keyHint === void 0 || props.credentialRequired === true ? void 0 : t(detectedRef === void 0 ? missingRefs ? \"keyFallbackMissing\" : \"keyFallbackUnchecked\" : detectedVisibleRef === void 0 ? \"keyFallbackDetectedHidden\" : \"keyFallbackDetected\").replace(\"{hint}\", () => detectedVisibleRef ?? keyHint);\n\t\t\t\tconst keyHelp = visibleRefs.length === 0 ? void 0 : t(\"keyHelp\").replace(\"{env}\", () => visibleRefs.join(\" / \"));\n\t\t\t\tconst authHelp = keyHelp === void 0 ? null : (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {\n\t\t\t\t\tlabel: keyHelp,\n\t\t\t\t\tside: \"right\",\n\t\t\t\t\tdelayMs: 0,\n\t\t\t\t\tfocusDelayMs: 0,\n\t\t\t\t\tportal: true,\n\t\t\t\t\topenOnClick: true,\n\t\t\t\t\tchildren: (0, react_jsx_runtime.jsx)(\"button\", {\n\t\t\t\t\t\ttype: \"button\",\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"helpButton\"],\n\t\t\t\t\t\t\"aria-label\": t(\"authHelp\"),\n\t\t\t\t\t\tchildren: \"?\"\n\t\t\t\t\t})\n\t\t\t\t});\n\t\t\t\tconst keylessNativeAuth = nativeAuth?.env.length === 0 && nativeAuth.oauth;\n\t\t\t\tconst keyPlaceholder = keyHint === void 0 || props.credentialRequired === true ? t(\"keyPlaceholder\") : t(savedCredential ? \"keyPlaceholderSaved\" : \"keyPlaceholderFallback\").replace(\"{hint}\", () => keyHint);\n\t\t\t\t/** What both family editors take: the rows, whose layer owns them, and the two writes. */\n\t\t\t\tconst catalogProps = {\n\t\t\t\t\tmodels,\n\t\t\t\t\toverridden: modelsOverridden,\n\t\t\t\t\tt,\n\t\t\t\t\tdisabled,\n\t\t\t\t\tonChange: (next) => {\n\t\t\t\t\t\tsetDraft((current) => schema.setPath(current, [\"models\"], next));\n\t\t\t\t\t},\n\t\t\t\t\tonReset: () => {\n\t\t\t\t\t\tsetDraft((current) => schema.deletePath(current, [\"models\"]));\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tconst credentials = (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [supportsMultiKey ? (0, react_jsx_runtime.jsx)(MultiKeyToggle, {\n\t\t\t\t\tt, checked: multiKey, disabled: disabled || listBusy, hasUnsavedKeys: hasMultiKeyDrafts(entryKeyDrafts),\n\t\t\t\t\tonChange: (enabled) => {\n\t\t\t\t\t\tlet updated = schema.setPath(draft, [\"multiKey\"], enabled);\n\t\t\t\t\t\tif (enabled && Object.keys(keyEntries).length === 0) {\n\t\t\t\t\t\t\tconst namedRef = stringAt(draft, \"apiKeyEnv\") ?? stringAt(fallback, \"apiKeyEnv\");\n\t\t\t\t\t\t\tconst [id, entry] = newMultiKeyEntry(props.provider, {\n\t\t\t\t\t\t\t\tname: stringAt(draft, \"displayName\") ?? stringAt(fallback, \"displayName\") ?? props.displayName ?? props.provider,\n\t\t\t\t\t\t\t\tapiKeyEnv: namedRef,\n\t\t\t\t\t\t\t\tmodels: draft.models ?? fallback?.models ?? inheritedModels()\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (keyDraft.length > 0) {\n\t\t\t\t\t\t\t\tsetEntryKeyDrafts({ [id]: keyDraft });\n\t\t\t\t\t\t\t\tif (namedRef === void 0) updated = schema.setPath(updated, [\"apiKeyEnv\"], multiKeyRef(props.provider, id));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tupdated = schema.setPath(updated, [\"keyEntries\"], { [id]: entry });\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetDraft(updated);\n\t\t\t\t\t}\n\t\t\t\t}) : null, multiKey ? (0, react_jsx_runtime.jsx)(MultiKeyEntriesEditor, {\n\t\t\t\t\troute: props.provider, entries: keyEntries, protocols, saveState: entrySaveState, savedEntries: entrySaveState?.ok ? entrySaveState.entries : void 0,\n\t\t\t\t\tonChange: (entries) => setDraft((current) => schema.setPath(current, [\"keyEntries\"], entries)),\n\t\t\t\t\tkeyDrafts: entryKeyDrafts, onKeyDraftsChange: setEntryKeyDrafts,\n\t\t\t\t\tconfirmations: entryConfirmations, onConfirmationsChange: setEntryConfirmations,\n\t\t\t\t\tpersistedEntries: schema.getPath(committedOriginal, [\"keyEntries\"]) ?? fallback?.keyEntries ?? {},\n\t\t\t\t\tcredentialChecks: props.credentialChecks,\n\t\t\t\t\tprobe: { settingsNs: namespace.ns, provider: props.provider, ...(probeBaseURL === void 0 ? {} : { baseURL: probeBaseURL }), ...(probeApi === void 0 ? {} : { api: probeApi }) },\n\t\t\t\t\treasoningLevels, operations, t, disabled: disabled || listBusy, onBusyChange: setListBusy\n\t\t\t\t}) : null, multiKey || keylessNativeAuth ? null : (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\tchildren: [\n\t\t\t\t\t\t(0, react_jsx_runtime.jsxs)(\"span\", {\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\tchildren: [t(\"keyInput\"), authHelp]\n\t\t\t\t\t\t}),\n\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(ApiKeyInput, {\n\t\t\t\t\t\t\tt,\n\t\t\t\t\t\t\tvalue: keyDraft,\n\t\t\t\t\t\t\tplaceholder: keyPlaceholder,\n\t\t\t\t\t\t\t\"aria-label\": t(\"keyInput\"),\n\t\t\t\t\t\t\t\"aria-invalid\": shownKeyFailure !== void 0,\n\t\t\t\t\t\t\t\"aria-describedby\": credentialHint === void 0 ? void 0 : `${props.provider}-credential-hint`,\n\t\t\t\t\t\t\trequired: props.credentialRequired === true,\n\t\t\t\t\t\t\tautoFocus: props.autoFocusCredential === true,\n\t\t\t\t\t\t\tdisabled,\n\t\t\t\t\t\t\tonChange: (event) => {\n\t\t\t\t\t\t\t\tsetKeyDraft(event.target.value);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tcredentialHint === void 0 ? null : (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\t\tid: `${props.provider}-credential-hint`,\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[missingRefs ? \"notice\" : detectedRef === void 0 ? \"advancedHint\" : \"savedNotice\"],\n\t\t\t\t\t\t\tchildren: credentialHint\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tshownKeyFailure === void 0 ? null : (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"error\"],\n\t\t\t\t\t\t\tchildren: t(shownKeyFailure)\n\t\t\t\t\t\t})\n\t\t\t\t\t]\n\t\t\t\t})] });\n\t\t\t\tconst customization = props.credentialOnly === true ? null : (0, react_jsx_runtime.jsxs)(\"details\", {\n\t\t\t\t\tclassName: ModelsSection_module_css_default[\"customized\"],\n\t\t\t\t\topen: supportsMultiKey ? true : void 0,\n\t\t\t\t\t\"data-multi-key-shared-settings\": supportsMultiKey ? true : void 0,\n\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"summary\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"customizedSummary\"],\n\t\t\t\t\t\tchildren: t(supportsMultiKey ? \"multiKeySharedSettings\" : \"customized\")\n\t\t\t\t\t}), (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"customizedBody\"],\n\t\t\t\t\t\tchildren: [\n\t\t\t\t\t\t\townsIdentity ? (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\t\t\tchildren: t(\"customDisplayName\")\n\t\t\t\t\t\t\t\t}), (0, react_jsx_runtime.jsx)(\"input\", {\n\t\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"input\"],\n\t\t\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\t\t\tvalue: stringAt(draft, \"displayName\") ?? \"\",\n\t\t\t\t\t\t\t\t\tplaceholder: stringAt(schema.getPath(namespace.base, settingsPath), \"displayName\") ?? props.provider,\n\t\t\t\t\t\t\t\t\t\"aria-label\": t(\"customDisplayName\"),\n\t\t\t\t\t\t\t\t\tdisabled,\n\t\t\t\t\t\t\t\t\tonChange: (event) => {\n\t\t\t\t\t\t\t\t\t\tsetField(\"displayName\", event.target.value);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t})]\n\t\t\t\t\t\t\t}) : null,\n\t\t\t\t\t\t\t(0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\t\t\tchildren: [\n\t\t\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\t\t\t\tchildren: t(\"baseUrl\")\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(\"input\", {\n\t\t\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"input\"],\n\t\t\t\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\t\t\t\tvalue: stringAt(draft, \"baseURL\") ?? \"\",\n\t\t\t\t\t\t\t\t\t\tplaceholder: family === \"deepseek\" ? t(\"deepSeekBaseUrl\") : baseURL === void 0 ? t(endpointEnv.length > 0 ? \"baseUrlConfigured\" : \"baseUrlDefault\") : t(\"baseUrlPlaceholder\").replace(\"{url}\", () => baseURL),\n\t\t\t\t\t\t\t\t\t\t\"aria-describedby\": endpointHint === void 0 ? void 0 : `${props.provider}-endpoint-hint`,\n\t\t\t\t\t\t\t\t\t\t\"aria-label\": t(\"baseUrl\"),\n\t\t\t\t\t\t\t\t\t\tdisabled,\n\t\t\t\t\t\t\t\t\t\tonChange: (event) => {\n\t\t\t\t\t\t\t\t\t\t\tsetField(\"baseURL\", event.target.value === \"\" ? void 0 : event.target.value);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\tendpointHint === void 0 ? null : (0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\t\t\t\tid: `${props.provider}-endpoint-hint`,\n\t\t\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"advancedHint\"],\n\t\t\t\t\t\t\t\t\t\tchildren: endpointHint\n\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\townsIdentity ? (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\t\t\tchildren: t(\"customApi\")\n\t\t\t\t\t\t\t\t}), (0, react_jsx_runtime.jsxs)(\"select\", {\n\t\t\t\t\t\t\t\t\tclassName: `${ModelsSection_module_css_default[\"input\"]} ${ModelsSection_module_css_default[\"selectInput\"]}`,\n\t\t\t\t\t\t\t\t\tvalue: probeApi ?? \"\",\n\t\t\t\t\t\t\t\t\t\"aria-label\": t(\"customApi\"),\n\t\t\t\t\t\t\t\t\tdisabled,\n\t\t\t\t\t\t\t\t\tonChange: (event) => {\n\t\t\t\t\t\t\t\t\t\tsetField(\"api\", event.target.value);\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tchildren: [probeApi === void 0 ? (0, react_jsx_runtime.jsx)(\"option\", {\n\t\t\t\t\t\t\t\t\t\tvalue: \"\",\n\t\t\t\t\t\t\t\t\t\tchildren: t(\"customApiUnset\")\n\t\t\t\t\t\t\t\t\t}) : null, protocols.map((choice) => (0, react_jsx_runtime.jsx)(\"option\", {\n\t\t\t\t\t\t\t\t\t\tvalue: choice,\n\t\t\t\t\t\t\t\t\t\tchildren: protocolLabel(t, choice)\n\t\t\t\t\t\t\t\t\t}, choice))]\n\t\t\t\t\t\t\t\t})]\n\t\t\t\t\t\t\t}) : null,\n\t\t\t\t\t\t\tmultiKey ? null : family === \"deepseek\" ? (0, react_jsx_runtime.jsx)(DeepSeekModelsEditor, {\n\t\t\t\t\t\t\t\t...catalogProps,\n\t\t\t\t\t\t\t\tdefaultContextWindow: typeof defaultContextWindow === \"number\" ? defaultContextWindow : void 0,\n\t\t\t\t\t\t\t\tdefaultMaxTokens: typeof defaultMaxTokens === \"number\" ? defaultMaxTokens : void 0\n\t\t\t\t\t\t\t}) : (0, react_jsx_runtime.jsx)(ModelListEditor, {\n\t\t\t\t\t\t\t\t...catalogProps,\n\t\t\t\t\t\t\t\tcatalogProvider: props.declared === true ? void 0 : props.provider,\n\t\t\t\t\t\t\t\treasoningLevels,\n\t\t\t\t\t\t\t\tdefaultInput: Array.isArray(defaultInput) ? defaultInput : void 0,\n\t\t\t\t\t\t\t\tprobe,\n\t\t\t\t\t\t\t\tprobeBlocked: keyFailure,\n\t\t\t\t\t\t\t\toperations,\n\t\t\t\t\t\t\t\tonBusyChange: setListBusy\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t]\n\t\t\t\t\t})]\n\t\t\t\t});\n\t\t\t\treturn (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: supportsMultiKey ? [customization, credentials] : [credentials, customization] });\n\t\t\t};\n\t\t\treturn (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\tclassName: props.credentialOnly === true ? ModelsSection_module_css_default[\"addBlock\"] : ModelsSection_module_css_default[\"editor\"],\n\t\t\t\tchildren: [\n\t\t\t\t\tprops.hideTitle === true ? null : (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"editorHeader\"],\n\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"editorTitle\"],\n\t\t\t\t\t\t\tchildren: props.displayName\n\t\t\t\t\t\t}), props.provider !== props.displayName ? (0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"editorRoute\"],\n\t\t\t\t\t\t\tchildren: props.provider\n\t\t\t\t\t\t}) : null]\n\t\t\t\t\t}),\n\t\t\t\t\tlayout === \"unknown\" ? (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"advancedHint\"],\n\t\t\t\t\t\tchildren: `${t(\"advancedHint\")} (${namespace.ns})`\n\t\t\t\t\t}) : curatedFields(layout),\n\t\t\t\t\t(failure ?? entryFailure) !== void 0 ? (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"error\"],\n\t\t\t\t\t\tchildren: failure ?? entryFailure\n\t\t\t\t\t}) : null,\n\t\t\t\t\tprops.credentialOnly === true || modelFailure === void 0 ? null : (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"advancedHint\"],\n\t\t\t\t\t\tchildren: `${t(\"model\")} ${String(modelFailure.index + 1)}: ${t(modelFailure.key)}`\n\t\t\t\t\t}),\n\t\t\t\t\t(0, react_jsx_runtime.jsx)(EditorFooter, {\n\t\t\t\t\t\tt,\n\t\t\t\t\t\tbusy,\n\t\t\t\t\t\tsubmitDisabled: disabled || listBusy || layout === \"unknown\" || entryFailure !== void 0 || props.credentialOnly !== true && modelFailure !== void 0 || !multiKey && (shownKeyFailure !== void 0 || props.credentialRequired === true && keyValue.length === 0),\n\t\t\t\t\t\tsubmitLabelKey: props.submitLabelKey ?? \"apply\",\n\t\t\t\t\t\tsubmitBusyLabelKey: props.submitBusyLabelKey ?? \"applying\",\n\t\t\t\t\t\t...props.cancelLabelKey === void 0 ? {} : { cancelLabelKey: props.cancelLabelKey },\n\t\t\t\t\t\tonCancel: () => {\n\t\t\t\t\t\t\tprops.onClose(false);\n\t\t\t\t\t\t},\n\t\t\t\t\t\tonSubmit: () => {\n\t\t\t\t\t\t\tprops.onSubmitCredential?.();\n\t\t\t\t\t\t\tapply();\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t]\n\t\t\t});\n\t\t}"
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
"before": "className: ModelsSection_module_css_default[\"editorActions\"],",
|
|
210
|
+
"after": "className: ModelsSection_module_css_default[\"editorActions\"],\n\t\t\t\t\"data-model-save-actions\": true,\n\t\t\t\tstyle: { position: \"sticky\", bottom: \"calc(var(--dsh-model-save-offset, 0px) + env(safe-area-inset-bottom, 0px))\", zIndex: 2, padding: \"10px 0\", background: \"var(--dsw-alias-bg-module-platform)\", flexWrap: \"wrap\" },"
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"before": "const en = {\n",
|
|
214
|
+
"after": "const en = {\n\t\t\tmultiKeyExpand: \"Expand details\",\n\t\t\tmultiKeyCollapse: \"Collapse details\",\n\t\t\tmultiKeyUnsaved: \"Not saved\",\n\t\t\tmultiKeyProtocol: \"Group API protocol\",\n\t\t\tmultiKeyProtocolInherit: \"Inherit provider ({protocol})\",\n\t\t\tmultiKeyProtocolDefault: \"default protocol\",\n\t\t\tmultiKeyProtocolHelp: \"Only this key group is affected. Choose the protocol supported by your relay, not just the model name.\",\n\t\t\tmultiKeyInvalidProtocol: \"Unsupported key-group protocol.\",\n\t\t\tmultiKeyRemoveGroup: \"Remove this key group\",\n\t\t\tmultiKeyRemoveTitle: \"Remove key group “{name}”?\",\n\t\t\tmultiKeyRemoveHelp: \"Removes the entire key group and its model list, not just one model above. Stored credentials are retained.\",\n\t\t\tmultiKeyRemoveDescription: \"This removes the selected group and all of its model entries from the draft. Other groups and stored credentials are retained. Existing conversations are not switched automatically. Changes take effect after Apply; Cancel editing to discard them.\",\n"
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
"before": "const zh = {\n",
|
|
218
|
+
"after": "const zh = {\n\t\t\tmultiKeyExpand: \"展开详情\",\n\t\t\tmultiKeyCollapse: \"收起详情\",\n\t\t\tmultiKeyUnsaved: \"未保存\",\n\t\t\tmultiKeyProtocol: \"分组 API 协议\",\n\t\t\tmultiKeyProtocolInherit: \"跟随供应商({protocol})\",\n\t\t\tmultiKeyProtocolDefault: \"默认协议\",\n\t\t\tmultiKeyProtocolHelp: \"仅影响此密钥分组,请按中转站支持的协议选择,不按模型名称自动切换。\",\n\t\t\tmultiKeyInvalidProtocol: \"不支持此密钥分组协议。\",\n\t\t\tmultiKeyRemoveGroup: \"移除此密钥分组\",\n\t\t\tmultiKeyRemoveTitle: \"移除密钥分组“{name}”?\",\n\t\t\tmultiKeyRemoveHelp: \"移除整个密钥分组及其模型列表,不是仅移除上方一个模型。已保存的密钥凭据会保留。\",\n\t\t\tmultiKeyRemoveDescription: \"此操作从编辑草稿移除该分组及其全部模型条目,其他分组和已保存的密钥凭据不变,不会自动切换现有会话。点击“应用”后才生效;取消编辑可放弃更改。\",\n"
|
|
219
|
+
}
|
|
220
|
+
],
|
|
221
|
+
"current": true,
|
|
222
|
+
"variants": [
|
|
223
|
+
{
|
|
224
|
+
"baseSha256": "e111ecefea8262e0426f528864b9681d818068042e93d053bcb0b6884b317278",
|
|
225
|
+
"resultSha256": "6834aeb8fc479533782b326b2810416e70cb4b1f9587dcc09388c8c9e299df43",
|
|
226
|
+
"replacements": [
|
|
227
|
+
{
|
|
228
|
+
"before": "\t\t//#region lib/types/client/CustomProviderCard.js",
|
|
229
|
+
"after": "\t\t//#region dsh-model-groups/native/multikey\n\t\t// Entries live under one native provider. Secrets exist only in local drafts\n\t\t// and credentials/set; profile mutations contain credential references only.\n\t\tconst MULTI_KEY_ENTRY_ID = /^[A-Za-z0-9][A-Za-z0-9_-]{0,79}$/;\n\t\tconst MULTI_KEY_REF = /^[A-Za-z_][A-Za-z0-9_]*$/;\n\t\tconst MULTI_KEY_UNSAFE_IDS = new Set([\"__proto__\", \"prototype\", \"constructor\"]);\n\t\tfunction supportsMultiKeySchema(namespace, schema, path) {\n\t\t\tif (!namespace || !schema) return false;\n\t\t\tconst root = schema.rehydrate(namespace.schema);\n\t\t\tconst profile = schema.nodeAtPath(root, path);\n\t\t\treturn profile?.dict?.multiKey !== void 0 && profile?.dict?.keyEntries !== void 0;\n\t\t}\n\t\tfunction multiKeyRef(route, id) {\n\t\t\tconst normalized = route.toUpperCase().replace(/[^A-Z0-9]+/g, \"_\");\n\t\t\tconst stem = /^[A-Z_]/.test(normalized) ? normalized : `DSH_${normalized}`;\n\t\t\treturn `${stem}_MULTKEY_${id.toUpperCase().replace(/[^A-Z0-9]+/g, \"_\")}_API_KEY`;\n\t\t}\n\t\tfunction newMultiKeyEntry(route, source = {}) {\n\t\t\tconst id = `k${crypto.randomUUID()}`;\n\t\t\treturn [id, {\n\t\t\t\tname: source.name ?? \"\",\n\t\t\t\t...(typeof source.apiKeyEnv === \"string\" && source.apiKeyEnv.length > 0 ? { apiKeyEnv: source.apiKeyEnv } : {}),\n\t\t\t\tmodels: modelDrafts(source.models).map((model) => structuredClone(model))\n\t\t\t}];\n\t\t}\n\t\tfunction normalizedMultiKeyEntries(route, entries) {\n\t\t\treturn Object.fromEntries(Object.entries(entries).map(([id, entry]) => [id, {\n\t\t\t\t...entry,\n\t\t\t\tname: typeof entry?.name === \"string\" ? entry.name.trim() : \"\",\n\t\t\t\tapiKeyEnv: typeof entry?.apiKeyEnv === \"string\" && entry.apiKeyEnv.length > 0 ? entry.apiKeyEnv : multiKeyRef(route, id),\n\t\t\t\tmodels: modelDrafts(entry?.models).map((model) => structuredClone(model))\n\t\t\t}]));\n\t\t}\n\t\tfunction multiKeyFailure(route, entries, drafts, confirmations, t) {\n\t\t\tif (!entries || typeof entries !== \"object\" || Array.isArray(entries) || Object.keys(entries).length === 0) return t(\"multiKeyNeedsEntries\");\n\t\t\tconst refs = new Set();\n\t\t\tfor (const [id, entry] of Object.entries(entries)) {\n\t\t\t\tif (!MULTI_KEY_ENTRY_ID.test(id) || MULTI_KEY_UNSAFE_IDS.has(id)) return t(\"multiKeyInvalidId\");\n\t\t\t\tif (!entry || typeof entry.name !== \"string\" || entry.name.trim().length === 0 || entry.name.trim().length > 120) return t(\"multiKeyInvalidName\");\n\t\t\t\tconst ref = entry.apiKeyEnv ?? multiKeyRef(route, id);\n\t\t\t\tif (typeof ref !== \"string\" || !MULTI_KEY_REF.test(ref)) return t(\"multiKeyInvalidRef\");\n\t\t\t\tif (refs.has(ref)) return t(\"multiKeyDuplicateRef\");\n\t\t\t\trefs.add(ref);\n\t\t\t\tconst keyFailure = apiKeyFailure(drafts[id] ?? \"\");\n\t\t\t\tif (keyFailure !== void 0) return `${entry.name}: ${t(keyFailure)}`;\n\t\t\t\tif ((drafts[id] ?? \"\").trim().length > 0 && ref !== multiKeyRef(route, id) && confirmations[id] !== true) return `${entry.name}: ${t(\"multiKeyConfirmRequired\")}`;\n\t\t\t\tif (!Array.isArray(entry.models) || entry.models.length === 0) return `${entry.name}: ${t(\"multiKeyNeedsModels\")}`;\n\t\t\t\tconst modelFailure = validateDeepSeekModels(entry.models) ?? validateReasoningEfforts(entry.models);\n\t\t\t\tif (modelFailure !== void 0) return `${entry.name}: ${t(\"model\")} ${String(modelFailure.index + 1)}: ${t(modelFailure.key)}`;\n\t\t\t}\n\t\t}\n\t\tasync function storeMultiKeyDrafts(operations, entries, drafts, setDrafts) {\n\t\t\tfor (const [id, entry] of Object.entries(entries)) {\n\t\t\t\tconst draft = Object.hasOwn(drafts, id) ? drafts[id] : \"\";\n\t\t\t\tif (draft.trim().length === 0) continue;\n\t\t\t\tconst failure = await operations.storeCredential(entry.apiKeyEnv, draft.trim());\n\t\t\t\tif (failure !== void 0) return failure;\n\t\t\t\t// Clear only successful, unchanged drafts: partial failures retry just\n\t\t\t\t// the unfinished credentials without rewriting the provider profile.\n\t\t\t\tsetDrafts((current) => current[id] === draft ? { ...current, [id]: \"\" } : current);\n\t\t\t}\n\t\t}\n\t\tfunction hasMultiKeyDrafts(drafts) {\n\t\t\treturn Object.values(drafts).some((value) => typeof value === \"string\" && value.length > 0);\n\t\t}\n\t\tfunction MultiKeyToggle({ t, checked, disabled, onChange, hasUnsavedKeys = false }) {\n\t\t\tconst [confirmOff, setConfirmOff] = (0, react.useState)(false);\n\t\t\t(0, react.useEffect)(() => {\n\t\t\t\tif (!checked || disabled) setConfirmOff(false);\n\t\t\t}, [checked, disabled]);\n\t\t\tconst close = () => setConfirmOff(false);\n\t\t\treturn (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\"data-multi-key-toggle\": true,\n\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\tchildren: [(0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\tclassName: ModelsSection_module_css_default[\"modelReasoningHead\"],\n\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"], children: t(\"multiKey\")\n\t\t\t\t\t}), (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Switch, {\n\t\t\t\t\t\tchecked, label: t(\"multiKey\"), disabled,\n\t\t\t\t\t\tonChange: (enabled) => {\n\t\t\t\t\t\t\tif (disabled || enabled === checked) return;\n\t\t\t\t\t\t\tif (!enabled) setConfirmOff(true);\n\t\t\t\t\t\t\telse onChange(true);\n\t\t\t\t\t\t}\n\t\t\t\t\t})]\n\t\t\t\t}), (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\tclassName: ModelsSection_module_css_default[\"advancedHint\"], children: t(\"multiKeyHelp\")\n\t\t\t\t}), (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Modal, {\n\t\t\t\t\topen: confirmOff && checked && !disabled, onClose: close,\n\t\t\t\t\ttitle: t(hasUnsavedKeys ? \"multiKeyUnsavedTitle\" : \"multiKeyDisableTitle\"),\n\t\t\t\t\tcloseLabel: t(\"close\"),\n\t\t\t\t\tdescription: t(hasUnsavedKeys ? \"multiKeyUnsavedKeys\" : \"multiKeyDisableDescription\"),\n\t\t\t\t\tclassName: ModelsSection_module_css_default[\"deleteDialog\"],\n\t\t\t\t\tfooter: (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [\n\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {\n\t\t\t\t\t\t\tvariant: \"outline\", \"data-modal-autofocus\": true, onClick: close,\n\t\t\t\t\t\t\tchildren: t(hasUnsavedKeys ? \"multiKeyReturnToEdit\" : \"multiKeyKeepEnabled\")\n\t\t\t\t\t\t}), hasUnsavedKeys ? null : (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {\n\t\t\t\t\t\t\tvariant: \"outline\", disabled,\n\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\tif (disabled || !checked || hasUnsavedKeys) return;\n\t\t\t\t\t\t\t\tclose(); onChange(false);\n\t\t\t\t\t\t\t}, children: t(\"multiKeyDisableConfirm\")\n\t\t\t\t\t\t})\n\t\t\t\t\t] })\n\t\t\t\t})]\n\t\t\t});\n\t\t}\n\t\tfunction MultiKeyEntriesEditor(props) {\n\t\t\tconst { route, entries, keyDrafts, confirmations, onChange, onKeyDraftsChange, onConfirmationsChange, operations, t, disabled } = props;\n\t\t\tconst [busyEntries, setBusyEntries] = (0, react.useState)({});\n\t\t\tconst anyBusy = Object.values(busyEntries).some(Boolean);\n\t\t\tconst { onBusyChange } = props;\n\t\t\t(0, react.useEffect)(() => {\n\t\t\t\tonBusyChange?.(anyBusy);\n\t\t\t}, [anyBusy, onBusyChange]);\n\t\t\t(0, react.useEffect)(() => () => onBusyChange?.(false), [onBusyChange]);\n\t\t\tconst update = (id, patch) => onChange({ ...entries, [id]: { ...entries[id], ...patch } });\n\t\t\tconst remove = (id) => {\n\t\t\t\tconst { [id]: removed, ...remaining } = entries;\n\t\t\t\tonChange(remaining);\n\t\t\t\tonKeyDraftsChange((current) => { const { [id]: removed, ...rest } = current; return rest; });\n\t\t\t\tonConfirmationsChange((current) => { const { [id]: removed, ...rest } = current; return rest; });\n\t\t\t\tsetBusyEntries((current) => { const { [id]: removed, ...rest } = current; return rest; });\n\t\t\t};\n\t\t\treturn (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\"data-multi-key-entries\": true,\n\t\t\t\tclassName: ModelsSection_module_css_default[\"modelList\"],\n\t\t\t\tchildren: [Object.entries(entries).map(([id, candidate], index) => {\n\t\t\t\t\tconst entry = candidate && typeof candidate === \"object\" && !Array.isArray(candidate) ? candidate : {};\n\t\t\t\t\tconst ref = entry.apiKeyEnv ?? multiKeyRef(route, id);\n\t\t\t\t\tconst draft = Object.hasOwn(keyDrafts, id) ? keyDrafts[id] : \"\";\n\t\t\t\t\tconst keyFailure = apiKeyFailure(draft);\n\t\t\t\t\tconst persisted = Object.hasOwn(props.persistedEntries ?? {}, id) && props.persistedEntries[id]?.apiKeyEnv === ref;\n\t\t\t\t\tconst info = props.credentialChecks?.[ref];\n\t\t\t\t\tconst status = info?.configured === true ? \"multiKeyConfigured\" : info?.configured === false ? \"multiKeyMissing\" : persisted ? \"multiKeySaved\" : \"multiKeyNew\";\n\t\t\t\t\tconst needsConfirmation = draft.trim().length > 0 && ref !== multiKeyRef(route, id);\n\t\t\t\t\tconst canUseStored = persisted && props.probe.provider !== void 0;\n\t\t\t\t\tconst probe = {\n\t\t\t\t\t\t...props.probe,\n\t\t\t\t\t\t...(canUseStored ? { keyEntryId: id } : {}),\n\t\t\t\t\t\t...(draft.trim().length > 0 ? { apiKey: draft.trim() } : {})\n\t\t\t\t\t};\n\t\t\t\t\tconst heading = typeof entry.name === \"string\" && entry.name.trim().length > 0 ? entry.name.trim() : `${t(\"multiKeyDefaultName\")} ${String(index + 1)}`;\n\t\t\t\t\treturn (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\t\"data-key-entry-id\": id, role: \"group\", \"aria-label\": heading,\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"rowCard\"],\n\t\t\t\t\t\tstyle: { minWidth: 0 },\n\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\t\t\"data-key-entry-heading\": true,\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"rowHead\"],\n\t\t\t\t\t\t\tstyle: { flexWrap: \"wrap\" },\n\t\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"rowName\"],\n\t\t\t\t\t\t\t\tstyle: { minWidth: 0, overflowWrap: \"anywhere\", flex: \"1 1 120px\" }, children: heading\n\t\t\t\t\t\t\t}), (0, react_jsx_runtime.jsx)(\"div\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"rowActions\"],\n\t\t\t\t\t\t\t\tchildren: (0, react_jsx_runtime.jsx)(\"button\", {\n\t\t\t\t\t\t\t\t\ttype: \"button\", className: ModelsSection_module_css_default[\"secondaryButton\"], disabled,\n\t\t\t\t\t\t\t\t\tonClick: () => remove(id), children: t(\"multiKeyRemove\")\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t})]\n\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t(0, react_jsx_runtime.jsxs)(\"label\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", { className: ModelsSection_module_css_default[\"fieldLabel\"], children: t(\"multiKeyEntryName\") }),\n\t\t\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(\"input\", {\n\t\t\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"input\"], type: \"text\", value: entry.name ?? \"\", maxLength: 120,\n\t\t\t\t\t\t\t\t\t\t\"aria-label\": `${t(\"multiKeyEntryName\")} ${String(index + 1)}`, disabled,\n\t\t\t\t\t\t\t\t\t\tonChange: (event) => update(id, { name: event.target.value })\n\t\t\t\t\t\t\t\t\t})]\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t(0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", { className: ModelsSection_module_css_default[\"fieldLabel\"], children: t(\"keyInput\") }),\n\t\t\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(ApiKeyInput, {\n\t\t\t\t\t\t\t\t\t\tt, value: draft, placeholder: t(persisted ? \"keyPlaceholderSaved\" : \"keyPlaceholder\"),\n\t\t\t\t\t\t\t\t\t\t\"aria-label\": `${t(\"keyInput\")} ${String(index + 1)}`, \"aria-invalid\": keyFailure !== void 0,\n\t\t\t\t\t\t\t\t\t\tdisabled: props.keyDisabled ?? disabled,\n\t\t\t\t\t\t\t\t\t\tonChange: (event) => {\n\t\t\t\t\t\t\t\t\t\t\tconst value = event.target.value;\n\t\t\t\t\t\t\t\t\t\t\tonKeyDraftsChange((current) => ({ ...current, [id]: value }));\n\t\t\t\t\t\t\t\t\t\t\tonConfirmationsChange((current) => ({ ...current, [id]: false }));\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(\"p\", { className: ModelsSection_module_css_default[\"advancedHint\"], children: t(status) }),\n\t\t\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(\"p\", { className: ModelsSection_module_css_default[\"advancedHint\"], style: { overflowWrap: \"anywhere\" }, children: t(\"multiKeyRef\").replace(\"{ref}\", () => ref) }),\n\t\t\t\t\t\t\t\t\tkeyFailure === void 0 ? null : (0, react_jsx_runtime.jsx)(\"p\", { className: ModelsSection_module_css_default[\"error\"], children: t(keyFailure) })]\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tneedsConfirmation ? (0, react_jsx_runtime.jsxs)(\"label\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\t\tstyle: { display: \"flex\", alignItems: \"flex-start\", gap: 8, overflowWrap: \"anywhere\" },\n\t\t\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"input\", {\n\t\t\t\t\t\t\t\t\ttype: \"checkbox\", \"data-confirm-entry\": id, \"aria-label\": t(\"multiKeyReplaceConfirm\").replace(\"{ref}\", () => ref),\n\t\t\t\t\t\t\t\t\tchecked: confirmations[id] === true, disabled: props.keyDisabled ?? disabled,\n\t\t\t\t\t\t\t\t\tonChange: (event) => onConfirmationsChange((current) => ({ ...current, [id]: event.target.checked }))\n\t\t\t\t\t\t\t\t}), (0, react_jsx_runtime.jsx)(\"span\", { children: t(\"multiKeyReplaceConfirm\").replace(\"{ref}\", () => ref) })]\n\t\t\t\t\t\t\t}) : null,\n\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(ModelListEditor, {\n\t\t\t\t\t\t\t\tmodels: modelDrafts(entry.models), onChange: (models) => update(id, { models }),\n\t\t\t\t\t\t\t\treasoningLevels: props.reasoningLevels, probe,\n\t\t\t\t\t\t\t\tprobeBlocked: keyFailure ?? props.probeBlocked ?? (!canUseStored && draft.trim().length === 0 ? \"multiKeyProbeNeedsKey\" : void 0),\n\t\t\t\t\t\t\t\toperations, t, disabled,\n\t\t\t\t\t\t\t\tonBusyChange: (value) => setBusyEntries((current) => current[id] === value ? current : { ...current, [id]: value })\n\t\t\t\t\t\t\t})]\n\t\t\t\t\t}, id);\n\t\t\t\t}), (0, react_jsx_runtime.jsx)(\"button\", {\n\t\t\t\t\ttype: \"button\", className: ModelsSection_module_css_default[\"addModelButton\"], disabled,\n\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\tlet id, entry;\n\t\t\t\t\t\tdo { [id, entry] = newMultiKeyEntry(route, { name: `${t(\"multiKeyDefaultName\")} ${String(Object.keys(entries).length + 1)}` }); } while (Object.hasOwn(entries, id) || Object.values(entries).some((other) => other.apiKeyEnv === multiKeyRef(route, id)));\n\t\t\t\t\t\tonChange({ ...entries, [id]: entry });\n\t\t\t\t\t}, children: t(\"multiKeyAdd\")\n\t\t\t\t}), (0, react_jsx_runtime.jsx)(\"p\", { className: ModelsSection_module_css_default[\"advancedHint\"], children: t(\"multiKeyKeepCredentials\") })]\n\t\t\t});\n\t\t}\n\t\t//#endregion\n\n\t\t//#region lib/types/client/CustomProviderCard.js"
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
"before": "\t\t\t\t\t...probe.provider === void 0 ? {} : { provider: probe.provider },",
|
|
233
|
+
"after": "\t\t\t\t\t...probe.provider === void 0 ? {} : { provider: probe.provider },\n\t\t\t\t\t...probe.keyEntryId === void 0 ? {} : { keyEntryId: probe.keyEntryId },"
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
"before": "const { taken, protocols, reasoningLevels, operations, t, onBusyChange } = props;",
|
|
237
|
+
"after": "const { taken, protocols, reasoningLevels, operations, t, onBusyChange } = props;\n\t\t\tconst supportsMultiKey = supportsMultiKeySchema(props.namespace, props.schema, [\"providers\", PROBE_ROUTE]);"
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
"before": "const [models, setModels] = (0, react.useState)([]);\n\t\t\tconst [busy, setBusy]",
|
|
241
|
+
"after": "const [models, setModels] = (0, react.useState)([]);\n\t\t\tconst [multiKey, setMultiKey] = (0, react.useState)(false);\n\t\t\tconst [keyEntries, setKeyEntries] = (0, react.useState)({});\n\t\t\tconst [entryKeyDrafts, setEntryKeyDrafts] = (0, react.useState)({});\n\t\t\tconst [entryConfirmations, setEntryConfirmations] = (0, react.useState)({});\n\t\t\tconst saving = (0, react.useRef)(false);\n\t\t\tconst [busy, setBusy]"
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
"before": "const modelFailure = validateDeepSeekModels(models) ?? validateReasoningEfforts(models);\n\t\t\tconst keyFailure = apiKeyFailure(keyDraft);",
|
|
245
|
+
"after": "const modelFailure = multiKey ? void 0 : validateDeepSeekModels(models) ?? validateReasoningEfforts(models);\n\t\t\tconst entryFailure = multiKey ? multiKeyFailure(route, keyEntries, entryKeyDrafts, entryConfirmations, t) : void 0;\n\t\t\tconst keyFailure = multiKey ? void 0 : apiKeyFailure(keyDraft);"
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
"before": "const ready = route.length > 0 && !routeInvalid && !routeTaken && normalizedBaseURL.length > 0 && !baseUrlInvalid && models.length > 0 && modelFailure === void 0 && keyFailure === void 0;",
|
|
249
|
+
"after": "const ready = (committed || route.length > 0 && !routeInvalid && !routeTaken) && normalizedBaseURL.length > 0 && !baseUrlInvalid && (multiKey ? entryFailure === void 0 : models.length > 0 && modelFailure === void 0 && keyFailure === void 0);"
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
"before": "const hint = failure !== void 0 || ready || keyFailure !== void 0 || route.length === 0 || routeInvalid || routeTaken || baseUrlInvalid ? void 0 : normalizedBaseURL.length === 0 ? t(\"customNeedsBaseUrl\") : modelFailure !== void 0 ? `${t(\"model\")} ${String(modelFailure.index + 1)}: ${t(modelFailure.key)}` : t(\"customNeedsModels\");",
|
|
253
|
+
"after": "const hint = entryFailure ?? (failure !== void 0 || ready || keyFailure !== void 0 || route.length === 0 || routeInvalid || routeTaken || baseUrlInvalid ? void 0 : normalizedBaseURL.length === 0 ? t(\"customNeedsBaseUrl\") : modelFailure !== void 0 ? `${t(\"model\")} ${String(modelFailure.index + 1)}: ${t(modelFailure.key)}` : t(\"customNeedsModels\"));"
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
"before": "const keyRef = deriveKeyRef(route);\n\t\t\t\tconst storesKey = keyValue.length > 0;",
|
|
257
|
+
"after": "const entries = normalizedMultiKeyEntries(route, keyEntries);\n\t\t\t\tconst firstEntry = Object.values(entries)[0];\n\t\t\t\tconst keyRef = multiKey ? firstEntry?.apiKeyEnv : deriveKeyRef(route);\n\t\t\t\tconst storesKey = !multiKey && keyValue.length > 0;\n\t\t\t\tif (multiKey && entryFailure !== void 0) return entryFailure;"
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
"before": "...storesKey ? { apiKeyEnv: keyRef } : {},\n\t\t\t\t\t\tapi: protocol,\n\t\t\t\t\t\tbaseURL: normalizedBaseURL,\n\t\t\t\t\t\tmodels: models.map((model) => ({ ...model }))",
|
|
261
|
+
"after": "...storesKey || multiKey ? { apiKeyEnv: keyRef } : {},\n\t\t\t\t\t\tapi: protocol,\n\t\t\t\t\t\tbaseURL: normalizedBaseURL,\n\t\t\t\t\t\tmodels: (multiKey ? firstEntry.models : models).map((model) => ({ ...model })),\n\t\t\t\t\t\t...(multiKey || Object.keys(keyEntries).length > 0 ? { multiKey, keyEntries: entries } : {})"
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
"before": "\t\t\t\tif (storesKey) {\n\t\t\t\t\tconst stored = await operations.storeCredential(keyRef, keyValue);\n\t\t\t\t\tif (stored !== void 0) return stored;\n\t\t\t\t}\n\t\t\t};",
|
|
265
|
+
"after": "\t\t\t\tif (multiKey) return storeMultiKeyDrafts(operations, entries, entryKeyDrafts, setEntryKeyDrafts);\n\t\t\t\tif (storesKey) {\n\t\t\t\t\tconst stored = await operations.storeCredential(keyRef, keyValue);\n\t\t\t\t\tif (stored !== void 0) return stored;\n\t\t\t\t\tsetKeyDraft(\"\");\n\t\t\t\t}\n\t\t\t};"
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
"before": "const create = async () => {\n\t\t\t\tsetBusy(true);",
|
|
269
|
+
"after": "const create = async () => {\n\t\t\t\tif (saving.current || !ready || props.readOnly || listBusy) return;\n\t\t\t\tsaving.current = true;\n\t\t\t\tsetBusy(true);"
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
"before": "props.onClose(true);\n\t\t\t\t} finally {\n\t\t\t\t\tsetBusy(false);\n\t\t\t\t}\n\t\t\t};\n\t\t\treturn (0, react_jsx_runtime.jsxs)(\"div\", {",
|
|
273
|
+
"after": "props.onClose(true);\n\t\t\t\t} catch {\n\t\t\t\t\tsetFailure(t(\"multiKeySaveFailed\"));\n\t\t\t\t} finally {\n\t\t\t\t\tsaving.current = false;\n\t\t\t\t\tsetBusy(false);\n\t\t\t\t}\n\t\t\t};\n\t\t\treturn (0, react_jsx_runtime.jsxs)(\"div\", {"
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
"before": "\t\t\t\t\t(0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\tchildren: [\n\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\t\tchildren: t(\"keyInput\")",
|
|
277
|
+
"after": "\t\t\t\t\tsupportsMultiKey ? (0, react_jsx_runtime.jsx)(MultiKeyToggle, {\n\t\t\t\t\t\tt, checked: multiKey, disabled: profileDisabled || listBusy, hasUnsavedKeys: hasMultiKeyDrafts(entryKeyDrafts),\n\t\t\t\t\t\tonChange: (enabled) => {\n\t\t\t\t\t\t\tif (enabled && Object.keys(keyEntries).length === 0) {\n\t\t\t\t\t\t\t\tconst [id, entry] = newMultiKeyEntry(route, { name: displayName || route || t(\"multiKeyDefaultName\"), models });\n\t\t\t\t\t\t\t\tsetKeyEntries({ [id]: entry });\n\t\t\t\t\t\t\t\tif (keyDraft.length > 0) setEntryKeyDrafts({ [id]: keyDraft });\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsetMultiKey(enabled);\n\t\t\t\t\t\t}\n\t\t\t\t\t}) : null,\n\t\t\t\t\tmultiKey ? (0, react_jsx_runtime.jsx)(MultiKeyEntriesEditor, {\n\t\t\t\t\t\troute, entries: keyEntries, onChange: setKeyEntries,\n\t\t\t\t\t\tkeyDrafts: entryKeyDrafts, onKeyDraftsChange: setEntryKeyDrafts,\n\t\t\t\t\t\tconfirmations: entryConfirmations, onConfirmationsChange: setEntryConfirmations,\n\t\t\t\t\t\tpersistedEntries: committed ? normalizedMultiKeyEntries(route, keyEntries) : {},\n\t\t\t\t\t\tprobe: { settingsNs: NS$1, ...(committed ? { provider: route } : {}), baseURL: normalizedBaseURL, api: protocol },\n\t\t\t\t\t\tprobeBlocked: baseUrlInvalid ? \"customBaseUrlInvalid\" : normalizedBaseURL.length === 0 ? \"customNeedsBaseUrl\" : void 0,\n\t\t\t\t\t\treasoningLevels, operations, t, disabled: profileDisabled || listBusy, keyDisabled: disabled || listBusy, onBusyChange: setListBusy\n\t\t\t\t\t}) : null,\n\t\t\t\t\tmultiKey ? null : (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\tchildren: [\n\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\t\tchildren: t(\"keyInput\")"
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
"before": "\t\t\t\t\t(0, react_jsx_runtime.jsx)(ModelListEditor, {\n\t\t\t\t\t\tmodels,\n\t\t\t\t\t\tonChange: setModels,",
|
|
281
|
+
"after": "\t\t\t\t\t!multiKey ? (0, react_jsx_runtime.jsx)(ModelListEditor, {\n\t\t\t\t\t\tmodels,\n\t\t\t\t\t\tonChange: setModels,"
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
"before": "\t\t\t\t\t\tonBusyChange: setListBusy\n\t\t\t\t\t}),\n\t\t\t\t\tfailure !== void 0",
|
|
285
|
+
"after": "\t\t\t\t\t\tonBusyChange: setListBusy\n\t\t\t\t\t}) : null,\n\t\t\t\t\tfailure !== void 0"
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
"before": "submitDisabled: disabled || !ready,",
|
|
289
|
+
"after": "submitDisabled: disabled || listBusy || !ready,"
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
"before": "taken: state.rows.map((row) => row.entry.provider),\n\t\t\t\t\t\t\t\t\t\tprotocols,",
|
|
293
|
+
"after": "taken: state.rows.map((row) => row.entry.provider),\n\t\t\t\t\t\t\t\t\t\tnamespace: piAi,\n\t\t\t\t\t\t\t\t\t\tschema,\n\t\t\t\t\t\t\t\t\t\tprotocols,"
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
"before": "const [draft, setDraft] = (0, react.useState)(() => draftAt(schema, namespace, settingsPath));",
|
|
297
|
+
"after": "const [draft, setDraft] = (0, react.useState)(() => draftAt(schema, namespace, settingsPath));\n\t\t\tconst [entryKeyDrafts, setEntryKeyDrafts] = (0, react.useState)({});\n\t\t\tconst [entryConfirmations, setEntryConfirmations] = (0, react.useState)({});\n\t\t\tconst saving = (0, react.useRef)(false);"
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
"before": "const keyRef = refFor(schema, namespace, settingsPath, props.provider);",
|
|
301
|
+
"after": "const keyRef = refFor(schema, namespace, settingsPath, props.provider);\n\t\t\tconst supportsMultiKey = layout === \"pi-ai\" && props.declared === true && props.credentialOnly !== true && supportsMultiKeySchema(namespace, schema, settingsPath);\n\t\t\tconst multiKey = supportsMultiKey && (draft.multiKey ?? fallback?.multiKey) === true;\n\t\t\tconst keyEntries = draft.keyEntries ?? fallback?.keyEntries ?? {};\n\t\t\tconst entryFailure = multiKey ? multiKeyFailure(props.provider, keyEntries, entryKeyDrafts, entryConfirmations, t) : void 0;"
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
"before": "const modelFailure = validateModels(schema.getPath(draft, [\"models\"]));\n\t\t\tconst keyFailure = apiKeyFailure(keyDraft);",
|
|
305
|
+
"after": "const modelFailure = multiKey ? void 0 : validateModels(schema.getPath(draft, [\"models\"]));\n\t\t\tconst keyFailure = multiKey ? void 0 : apiKeyFailure(keyDraft);"
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
"before": "const next = layout === \"pi-ai\" && stringAt(draft, \"apiKeyEnv\") === void 0 && stringAt(fallback, \"apiKeyEnv\") === void 0 && keyValue.length > 0 ? schema.setPath(draft, [\"apiKeyEnv\"], keyRef) : draft;",
|
|
309
|
+
"after": "const normalizedDraft = supportsMultiKey && schema.hasPath(draft, [\"keyEntries\"]) ? schema.setPath(draft, [\"keyEntries\"], normalizedMultiKeyEntries(props.provider, keyEntries)) : draft;\n\t\t\t\tconst next = multiKey ? schema.setPath(normalizedDraft, [\"keyEntries\"], normalizedMultiKeyEntries(props.provider, keyEntries)) : layout === \"pi-ai\" && stringAt(draft, \"apiKeyEnv\") === void 0 && stringAt(fallback, \"apiKeyEnv\") === void 0 && keyValue.length > 0 ? schema.setPath(normalizedDraft, [\"apiKeyEnv\"], keyRef) : normalizedDraft;\n\t\t\t\tif (entryFailure !== void 0) return entryFailure;"
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
"before": "if (props.credentialOnly !== true) {\n\t\t\t\t\tconst failure = validateModels",
|
|
313
|
+
"after": "if (props.credentialOnly !== true && !multiKey) {\n\t\t\t\t\tconst failure = validateModels"
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
"before": "\t\t\t\tif (keyValue.length > 0) {\n\t\t\t\t\tconst stored = await operations.storeCredential(keyRef, keyValue);",
|
|
317
|
+
"after": "\t\t\t\tif (multiKey) return storeMultiKeyDrafts(operations, next.keyEntries, entryKeyDrafts, setEntryKeyDrafts);\n\t\t\t\tif (keyValue.length > 0) {\n\t\t\t\t\tconst stored = await operations.storeCredential(keyRef, keyValue);"
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
"before": "const apply = async () => {\n\t\t\t\tsetBusy(true);",
|
|
321
|
+
"after": "const apply = async () => {\n\t\t\t\tif (saving.current || props.readOnly || listBusy || entryFailure !== void 0) return;\n\t\t\t\tsaving.current = true;\n\t\t\t\tsetBusy(true);"
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
"before": "props.onClose(true);\n\t\t\t\t} finally {\n\t\t\t\t\tsetBusy(false);\n\t\t\t\t}\n\t\t\t};\n\t\t\tif (node === void 0)",
|
|
325
|
+
"after": "props.onClose(true);\n\t\t\t\t} catch {\n\t\t\t\t\tsetFailure(t(\"multiKeySaveFailed\"));\n\t\t\t\t} finally {\n\t\t\t\t\tsaving.current = false;\n\t\t\t\t\tsetBusy(false);\n\t\t\t\t}\n\t\t\t};\n\t\t\tif (node === void 0)"
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
"before": "return (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [keylessNativeAuth ? null :",
|
|
329
|
+
"after": "return (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [supportsMultiKey ? (0, react_jsx_runtime.jsx)(MultiKeyToggle, {\n\t\t\t\t\tt, checked: multiKey, disabled: disabled || listBusy, hasUnsavedKeys: hasMultiKeyDrafts(entryKeyDrafts),\n\t\t\t\t\tonChange: (enabled) => {\n\t\t\t\t\t\tlet updated = schema.setPath(draft, [\"multiKey\"], enabled);\n\t\t\t\t\t\tif (enabled && Object.keys(keyEntries).length === 0) {\n\t\t\t\t\t\t\tconst namedRef = stringAt(draft, \"apiKeyEnv\") ?? stringAt(fallback, \"apiKeyEnv\");\n\t\t\t\t\t\t\tconst [id, entry] = newMultiKeyEntry(props.provider, {\n\t\t\t\t\t\t\t\tname: stringAt(draft, \"displayName\") ?? stringAt(fallback, \"displayName\") ?? props.displayName ?? props.provider,\n\t\t\t\t\t\t\t\tapiKeyEnv: namedRef,\n\t\t\t\t\t\t\t\tmodels: draft.models ?? fallback?.models ?? inheritedModels()\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (keyDraft.length > 0) {\n\t\t\t\t\t\t\t\tsetEntryKeyDrafts({ [id]: keyDraft });\n\t\t\t\t\t\t\t\tif (namedRef === void 0) updated = schema.setPath(updated, [\"apiKeyEnv\"], multiKeyRef(props.provider, id));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tupdated = schema.setPath(updated, [\"keyEntries\"], { [id]: entry });\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetDraft(updated);\n\t\t\t\t\t}\n\t\t\t\t}) : null, multiKey ? (0, react_jsx_runtime.jsx)(MultiKeyEntriesEditor, {\n\t\t\t\t\troute: props.provider, entries: keyEntries,\n\t\t\t\t\tonChange: (entries) => setDraft((current) => schema.setPath(current, [\"keyEntries\"], entries)),\n\t\t\t\t\tkeyDrafts: entryKeyDrafts, onKeyDraftsChange: setEntryKeyDrafts,\n\t\t\t\t\tconfirmations: entryConfirmations, onConfirmationsChange: setEntryConfirmations,\n\t\t\t\t\tpersistedEntries: schema.getPath(committedOriginal, [\"keyEntries\"]) ?? fallback?.keyEntries ?? {},\n\t\t\t\t\tcredentialChecks: props.credentialChecks,\n\t\t\t\t\tprobe: { settingsNs: namespace.ns, provider: props.provider, ...(probeBaseURL === void 0 ? {} : { baseURL: probeBaseURL }), ...(probeApi === void 0 ? {} : { api: probeApi }) },\n\t\t\t\t\treasoningLevels, operations, t, disabled: disabled || listBusy, onBusyChange: setListBusy\n\t\t\t\t}) : null, multiKey || keylessNativeAuth ? null :"
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
"before": "family === \"deepseek\" ? (0, react_jsx_runtime.jsx)(DeepSeekModelsEditor, {",
|
|
333
|
+
"after": "multiKey ? null : family === \"deepseek\" ? (0, react_jsx_runtime.jsx)(DeepSeekModelsEditor, {"
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
"before": "\t\t\t\t\tfailure !== void 0 ? (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"error\"],\n\t\t\t\t\t\tchildren: failure\n\t\t\t\t\t}) : null,\n\t\t\t\t\tprops.credentialOnly",
|
|
337
|
+
"after": "\t\t\t\t\t(failure ?? entryFailure) !== void 0 ? (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"error\"],\n\t\t\t\t\t\tchildren: failure ?? entryFailure\n\t\t\t\t\t}) : null,\n\t\t\t\t\tprops.credentialOnly"
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
"before": "submitDisabled: disabled || layout === \"unknown\" || props.credentialOnly !== true && modelFailure !== void 0 || shownKeyFailure !== void 0 || props.credentialRequired === true && keyValue.length === 0,",
|
|
341
|
+
"after": "submitDisabled: disabled || listBusy || layout === \"unknown\" || entryFailure !== void 0 || props.credentialOnly !== true && modelFailure !== void 0 || !multiKey && (shownKeyFailure !== void 0 || props.credentialRequired === true && keyValue.length === 0),"
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
"before": "return (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [supportsMultiKey ? (0, react_jsx_runtime.jsx)(MultiKeyToggle, {",
|
|
345
|
+
"after": "const credentials = (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [supportsMultiKey ? (0, react_jsx_runtime.jsx)(MultiKeyToggle, {"
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
"before": "\t\t\t\t}), props.credentialOnly === true ? null : (0, react_jsx_runtime.jsxs)(\"details\", {\n\t\t\t\t\tclassName: ModelsSection_module_css_default[\"customized\"],",
|
|
349
|
+
"after": "\t\t\t\t})] });\n\t\t\t\tconst customization = props.credentialOnly === true ? null : (0, react_jsx_runtime.jsxs)(\"details\", {\n\t\t\t\t\tclassName: ModelsSection_module_css_default[\"customized\"],\n\t\t\t\t\topen: supportsMultiKey ? true : void 0,\n\t\t\t\t\t\"data-multi-key-shared-settings\": supportsMultiKey ? true : void 0,"
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
"before": "children: t(\"customized\")\n\t\t\t\t\t}), (0, react_jsx_runtime.jsxs)(\"div\", {",
|
|
353
|
+
"after": "children: t(supportsMultiKey ? \"multiKeySharedSettings\" : \"customized\")\n\t\t\t\t\t}), (0, react_jsx_runtime.jsxs)(\"div\", {"
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
"before": "\t\t\t\t})] });\n\t\t\t};\n\t\t\treturn (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\tclassName: props.credentialOnly",
|
|
357
|
+
"after": "\t\t\t\t});\n\t\t\t\treturn (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: supportsMultiKey ? [customization, credentials] : [credentials, customization] });\n\t\t\t};\n\t\t\treturn (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\tclassName: props.credentialOnly"
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
"before": "\t\tconst en = {",
|
|
361
|
+
"after": "\t\tconst en = {\n\t\t\tmultiKey: \"Multiple key configurations\",\n\t\t\tmultiKeyHelp: \"Configurations share one provider ID, endpoint and protocol; each has its own name, API key and models. Turning this off restores the original single-key configuration without deleting entries or credentials.\",\n\t\t\tmultiKeySharedSettings: \"Shared settings\",\n\t\t\tmultiKeyAdd: \"Add key configuration\",\n\t\t\tmultiKeyRemove: \"Remove\",\n\t\t\tmultiKeyEntryName: \"Configuration name\",\n\t\t\tmultiKeyDefaultName: \"Key configuration\",\n\t\t\tmultiKeyDisableTitle: \"Turn off multiple key configurations?\",\n\t\t\tmultiKeyDisableDescription: \"After applying, this provider will use its original single-key configuration. Saved configurations and credentials will not be deleted. Sessions using a key configuration will need you to re-enable it or select a single-key model; no other key will be chosen automatically.\",\n\t\t\tmultiKeyKeepEnabled: \"Keep enabled\",\n\t\t\tmultiKeyDisableConfirm: \"Turn off in draft\",\n\t\t\tmultiKeyUnsavedTitle: \"Save the API keys before turning this off\",\n\t\t\tmultiKeyUnsavedKeys: \"Some API keys have been typed but not saved. Turning this off and applying would not store those inputs, so the switch will stay on. Return to the configurations and apply to save them, then reopen this card to turn it off. Nothing has been deleted.\",\n\t\t\tmultiKeyReturnToEdit: \"Return to configurations\",\n\t\t\tmultiKeyRef: \"Credential reference: {ref}\",\n\t\t\tmultiKeySaved: \"Saved reference; credential status not checked. Leave the key blank to keep it.\",\n\t\t\tmultiKeyNew: \"Not saved yet. An empty key does not create a credential.\",\n\t\t\tmultiKeyConfigured: \"Credential confirmed configured; leave blank to keep it.\",\n\t\t\tmultiKeyMissing: \"Credential confirmed missing. Enter a key or configure this reference.\",\n\t\t\tmultiKeyKeepCredentials: \"Removing a key configuration does not delete its stored credential.\",\n\t\t\tmultiKeyNeedsEntries: \"Add at least one key configuration.\",\n\t\t\tmultiKeyInvalidId: \"Invalid key-configuration ID; reopen this card or fix the profile.\",\n\t\t\tmultiKeyInvalidName: \"Each key configuration needs a name of 1–120 characters.\",\n\t\t\tmultiKeyInvalidRef: \"Invalid credential reference.\",\n\t\t\tmultiKeyDuplicateRef: \"Two configurations use the same credential reference. Each configuration must have its own reference.\",\n\t\t\tmultiKeyNeedsModels: \"Each key configuration needs at least one model.\",\n\t\t\tmultiKeyReplaceConfirm: \"Replace the key at {ref}. Other configurations sharing this reference will also be affected.\",\n\t\t\tmultiKeyConfirmRequired: \"Confirm the credential replacement before applying.\",\n\t\t\tmultiKeyProbeNeedsKey: \"Enter this configuration’s API key to discover models before saving. The provider’s original key will not be used.\",\n\t\t\tmultiKeySaveFailed: \"Saving did not complete. Keep this card open and retry; successful credential writes will not be repeated.\","
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
"before": "\t\tconst zh = {",
|
|
365
|
+
"after": "\t\tconst zh = {\n\t\t\tmultiKey: \"多密钥配置\",\n\t\t\tmultiKeyHelp: \"各配置共享 Provider ID、API 地址与协议,分别管理名称、API 密钥和模型。关闭后恢复原单密钥配置,已保存的配置与密钥不会删除。\",\n\t\t\tmultiKeySharedSettings: \"公共设置\",\n\t\t\tmultiKeyAdd: \"添加密钥配置\",\n\t\t\tmultiKeyRemove: \"移除\",\n\t\t\tmultiKeyEntryName: \"配置名称\",\n\t\t\tmultiKeyDefaultName: \"密钥配置\",\n\t\t\tmultiKeyDisableTitle: \"关闭多密钥配置?\",\n\t\t\tmultiKeyDisableDescription: \"应用后,此供应商将使用原单密钥配置,已保存的密钥配置与凭据不会删除。正在使用密钥配置的会话需要重新开启,或手动选择单密钥模型;不会自动换用其他密钥。\",\n\t\t\tmultiKeyKeepEnabled: \"保持开启\",\n\t\t\tmultiKeyDisableConfirm: \"确认关闭(待应用)\",\n\t\t\tmultiKeyUnsavedTitle: \"请先保存新输入的密钥\",\n\t\t\tmultiKeyUnsavedKeys: \"当前有尚未保存的 API 密钥输入。关闭后直接应用不会保存这些输入,因此开关将保持开启。请返回密钥配置并应用保存,再重新打开此卡片关闭;当前输入与已存储的密钥均未删除。\",\n\t\t\tmultiKeyReturnToEdit: \"返回密钥配置\",\n\t\t\tmultiKeyRef: \"密钥引用:{ref}\",\n\t\t\tmultiKeySaved: \"引用已保存,尚未检查密钥状态;输入留空可保留原密钥。\",\n\t\t\tmultiKeyNew: \"尚未保存;输入留空不会创建密钥。\",\n\t\t\tmultiKeyConfigured: \"已确认密钥已配置;留空可保留。\",\n\t\t\tmultiKeyMissing: \"已确认此引用缺少密钥,请输入或在环境中配置。\",\n\t\t\tmultiKeyKeepCredentials: \"移除密钥配置不会删除已存储的密钥。\",\n\t\t\tmultiKeyNeedsEntries: \"请至少添加一个密钥配置。\",\n\t\t\tmultiKeyInvalidId: \"密钥配置 ID 无效,请重新打开此卡片或修正配置。\",\n\t\t\tmultiKeyInvalidName: \"每个配置名称须为 1–120 个字符。\",\n\t\t\tmultiKeyInvalidRef: \"密钥引用无效。\",\n\t\t\tmultiKeyDuplicateRef: \"多个密钥配置使用了相同的密钥引用;每个配置必须使用独立引用。\",\n\t\t\tmultiKeyNeedsModels: \"每个密钥配置至少需要一个模型。\",\n\t\t\tmultiKeyReplaceConfirm: \"确认替换 {ref} 的密钥;共用此引用的其他配置也会受到影响。\",\n\t\t\tmultiKeyConfirmRequired: \"请先确认替换已引用的密钥,再应用。\",\n\t\t\tmultiKeyProbeNeedsKey: \"保存前请先输入此配置的 API 密钥再获取模型;不会使用供应商原来的密钥。\",\n\t\t\tmultiKeySaveFailed: \"保存尚未完成。请保留此卡片并重试;已成功写入的密钥不会重复写入。\","
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
"before": "\t\tfunction MultiKeyEntriesEditor(props) {",
|
|
369
|
+
"after": "\t\tfunction multiKeyEntryDirty(entry, saved, draft) {\n\t\t\treturn saved === void 0 || JSON.stringify(entry) !== JSON.stringify(saved) || (draft ?? \"\").length > 0;\n\t\t}\n\t\tfunction MultiKeyEntriesEditor(props) {"
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
"before": "const [busyEntries, setBusyEntries] = (0, react.useState)({});",
|
|
373
|
+
"after": "const [busyEntries, setBusyEntries] = (0, react.useState)({});\n\t\t\tconst [expandedEntries, setExpandedEntries] = (0, react.useState)({});\n\t\t\tconst detailsPrefix = (0, react.useId)();\n\t\t\tconst previousSave = (0, react.useRef)(props.saveState);\n\t\t\t(0, react.useEffect)(() => {\n\t\t\t\tconst save = props.saveState;\n\t\t\t\tif (save === previousSave.current) return;\n\t\t\t\tpreviousSave.current = save;\n\t\t\t\tif (!save) return;\n\t\t\t\tsetExpandedEntries((current) => {\n\t\t\t\t\tconst next = { ...current };\n\t\t\t\t\tfor (const id of Object.keys(save.entries)) {\n\t\t\t\t\t\t// Only collapse the exact snapshot acknowledged by this save.\n\t\t\t\t\t\tif (!save.ok || !multiKeyEntryDirty(entries[id], save.entries[id], keyDrafts[id])) next[id] = !save.ok;\n\t\t\t\t\t}\n\t\t\t\t\treturn next;\n\t\t\t\t});\n\t\t\t}, [props.saveState, entries, keyDrafts]);\n\t\t\tconst invalidRows = Object.keys(entries).filter((id) => multiKeyFailure(route, { [id]: entries[id] }, keyDrafts, confirmations, t) !== void 0);\n\t\t\tconst invalidEntries = invalidRows.length > 0 ? invalidRows : multiKeyFailure(route, entries, keyDrafts, confirmations, t) !== void 0 ? Object.keys(entries) : [];\n\t\t\tconst invalidSignature = JSON.stringify(invalidEntries);\n\t\t\t(0, react.useEffect)(() => {\n\t\t\t\tif (invalidEntries.length > 0) setExpandedEntries((current) => ({ ...current, ...Object.fromEntries(invalidEntries.map((id) => [id, true])) }));\n\t\t\t}, [invalidSignature]);"
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
"before": "const heading = typeof entry.name === \"string\"",
|
|
377
|
+
"after": "const dirty = multiKeyEntryDirty(entry, props.savedEntries?.[id] ?? props.persistedEntries?.[id], draft);\n\t\t\t\t\tconst expanded = expandedEntries[id] ?? !Object.hasOwn(props.persistedEntries ?? {}, id);\n\t\t\t\t\tconst detailsId = detailsPrefix + \"-\" + id;\n\t\t\t\t\tconst heading = typeof entry.name === \"string\""
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
"before": "\"data-key-entry-id\": id, role: \"group\", \"aria-label\": heading,",
|
|
381
|
+
"after": "\"data-key-entry-id\": id, \"data-key-entry-expanded\": expanded, \"data-key-entry-dirty\": dirty, role: \"group\", \"aria-label\": heading,"
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
"before": "\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\t\t\"data-key-entry-heading\": true,\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"rowHead\"],\n\t\t\t\t\t\t\tstyle: { flexWrap: \"wrap\" },\n\t\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"rowName\"],\n\t\t\t\t\t\t\t\tstyle: { minWidth: 0, overflowWrap: \"anywhere\", flex: \"1 1 120px\" }, children: heading\n\t\t\t\t\t\t\t}), (0, react_jsx_runtime.jsx)(\"div\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"rowActions\"],\n\t\t\t\t\t\t\t\tchildren: (0, react_jsx_runtime.jsx)(\"button\", {\n\t\t\t\t\t\t\t\t\ttype: \"button\", className: ModelsSection_module_css_default[\"secondaryButton\"], disabled,\n\t\t\t\t\t\t\t\t\tonClick: () => remove(id), children: t(\"multiKeyRemove\")\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t})]\n\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t(0, react_jsx_runtime.jsxs)(\"label\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", { className: ModelsSection_module_css_default[\"fieldLabel\"], children: t(\"multiKeyEntryName\") }),\n\t\t\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(\"input\", {\n\t\t\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"input\"], type: \"text\", value: entry.name ?? \"\", maxLength: 120,\n\t\t\t\t\t\t\t\t\t\t\"aria-label\": `${t(\"multiKeyEntryName\")} ${String(index + 1)}`, disabled,\n\t\t\t\t\t\t\t\t\t\tonChange: (event) => update(id, { name: event.target.value })\n\t\t\t\t\t\t\t\t\t})]\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t(0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", { className: ModelsSection_module_css_default[\"fieldLabel\"], children: t(\"keyInput\") }),\n\t\t\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(ApiKeyInput, {\n\t\t\t\t\t\t\t\t\t\tt, value: draft, placeholder: t(persisted ? \"keyPlaceholderSaved\" : \"keyPlaceholder\"),\n\t\t\t\t\t\t\t\t\t\t\"aria-label\": `${t(\"keyInput\")} ${String(index + 1)}`, \"aria-invalid\": keyFailure !== void 0,\n\t\t\t\t\t\t\t\t\t\tdisabled: props.keyDisabled ?? disabled,\n\t\t\t\t\t\t\t\t\t\tonChange: (event) => {\n\t\t\t\t\t\t\t\t\t\t\tconst value = event.target.value;\n\t\t\t\t\t\t\t\t\t\t\tonKeyDraftsChange((current) => ({ ...current, [id]: value }));\n\t\t\t\t\t\t\t\t\t\t\tonConfirmationsChange((current) => ({ ...current, [id]: false }));\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(\"p\", { className: ModelsSection_module_css_default[\"advancedHint\"], children: t(status) }),\n\t\t\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(\"p\", { className: ModelsSection_module_css_default[\"advancedHint\"], style: { overflowWrap: \"anywhere\" }, children: t(\"multiKeyRef\").replace(\"{ref}\", () => ref) }),\n\t\t\t\t\t\t\t\t\tkeyFailure === void 0 ? null : (0, react_jsx_runtime.jsx)(\"p\", { className: ModelsSection_module_css_default[\"error\"], children: t(keyFailure) })]\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tneedsConfirmation ? (0, react_jsx_runtime.jsxs)(\"label\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\t\tstyle: { display: \"flex\", alignItems: \"flex-start\", gap: 8, overflowWrap: \"anywhere\" },\n\t\t\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"input\", {\n\t\t\t\t\t\t\t\t\ttype: \"checkbox\", \"data-confirm-entry\": id, \"aria-label\": t(\"multiKeyReplaceConfirm\").replace(\"{ref}\", () => ref),\n\t\t\t\t\t\t\t\t\tchecked: confirmations[id] === true, disabled: props.keyDisabled ?? disabled,\n\t\t\t\t\t\t\t\t\tonChange: (event) => onConfirmationsChange((current) => ({ ...current, [id]: event.target.checked }))\n\t\t\t\t\t\t\t\t}), (0, react_jsx_runtime.jsx)(\"span\", { children: t(\"multiKeyReplaceConfirm\").replace(\"{ref}\", () => ref) })]\n\t\t\t\t\t\t\t}) : null,\n\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(ModelListEditor, {\n\t\t\t\t\t\t\t\tmodels: modelDrafts(entry.models), onChange: (models) => update(id, { models }),\n\t\t\t\t\t\t\t\treasoningLevels: props.reasoningLevels, probe,\n\t\t\t\t\t\t\t\tprobeBlocked: keyFailure ?? props.probeBlocked ?? (!canUseStored && draft.trim().length === 0 ? \"multiKeyProbeNeedsKey\" : void 0),\n\t\t\t\t\t\t\t\toperations, t, disabled,\n\t\t\t\t\t\t\t\tonBusyChange: (value) => setBusyEntries((current) => current[id] === value ? current : { ...current, [id]: value })\n\t\t\t\t\t\t\t})]",
|
|
385
|
+
"after": "\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\t\t\"data-key-entry-heading\": true,\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"rowHead\"], style: { flexWrap: \"wrap\" },\n\t\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"rowName\"],\n\t\t\t\t\t\t\t\tstyle: { minWidth: 0, overflowWrap: \"anywhere\", flex: \"1 1 120px\" }, children: heading\n\t\t\t\t\t\t\t}), dirty ? (0, react_jsx_runtime.jsx)(\"span\", { \"data-key-entry-unsaved\": true, children: t(\"multiKeyUnsaved\") }) : null,\n\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(\"button\", {\n\t\t\t\t\t\t\t\ttype: \"button\", className: ModelsSection_module_css_default[\"secondaryButton\"],\n\t\t\t\t\t\t\t\t\"aria-expanded\": expanded, \"aria-controls\": detailsId,\n\t\t\t\t\t\t\t\tonClick: () => setExpandedEntries((current) => ({ ...current, [id]: !expanded })),\n\t\t\t\t\t\t\t\tchildren: t(expanded ? \"multiKeyCollapse\" : \"multiKeyExpand\")\n\t\t\t\t\t\t\t})]\n\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t(0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", { className: ModelsSection_module_css_default[\"fieldLabel\"], children: t(\"keyInput\") }),\n\t\t\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(ApiKeyInput, {\n\t\t\t\t\t\t\t\t\t\tt, value: draft, placeholder: t(persisted ? \"keyPlaceholderSaved\" : \"keyPlaceholder\"),\n\t\t\t\t\t\t\t\t\t\t\"aria-label\": `${t(\"keyInput\")} ${String(index + 1)}`, \"aria-invalid\": keyFailure !== void 0,\n\t\t\t\t\t\t\t\t\t\tdisabled: props.keyDisabled ?? disabled,\n\t\t\t\t\t\t\t\t\t\tonChange: (event) => {\n\t\t\t\t\t\t\t\t\t\t\tconst value = event.target.value;\n\t\t\t\t\t\t\t\t\t\t\tonKeyDraftsChange((current) => ({ ...current, [id]: value }));\n\t\t\t\t\t\t\t\t\t\t\tonConfirmationsChange((current) => ({ ...current, [id]: false }));\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(\"p\", { className: ModelsSection_module_css_default[\"advancedHint\"], children: t(status) }),\n\t\t\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(\"p\", { className: ModelsSection_module_css_default[\"advancedHint\"], style: { overflowWrap: \"anywhere\" }, children: t(\"multiKeyRef\").replace(\"{ref}\", () => ref) }),\n\t\t\t\t\t\t\t\t\tkeyFailure === void 0 ? null : (0, react_jsx_runtime.jsx)(\"p\", { className: ModelsSection_module_css_default[\"error\"], children: t(keyFailure) })]\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tneedsConfirmation ? (0, react_jsx_runtime.jsxs)(\"label\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\t\tstyle: { display: \"flex\", alignItems: \"flex-start\", gap: 8, overflowWrap: \"anywhere\" },\n\t\t\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"input\", {\n\t\t\t\t\t\t\t\t\ttype: \"checkbox\", \"data-confirm-entry\": id, \"aria-label\": t(\"multiKeyReplaceConfirm\").replace(\"{ref}\", () => ref),\n\t\t\t\t\t\t\t\t\tchecked: confirmations[id] === true, disabled: props.keyDisabled ?? disabled,\n\t\t\t\t\t\t\t\t\tonChange: (event) => onConfirmationsChange((current) => ({ ...current, [id]: event.target.checked }))\n\t\t\t\t\t\t\t\t}), (0, react_jsx_runtime.jsx)(\"span\", { children: t(\"multiKeyReplaceConfirm\").replace(\"{ref}\", () => ref) })]\n\t\t\t\t\t\t\t}) : null,\n\t\t\t\t\t\t(0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\t\tid: detailsId, \"data-key-entry-details\": true, hidden: !expanded,\n\t\t\t\t\t\t\tstyle: { display: expanded ? \"contents\" : \"none\" }, children: [\n\t\t\t\t\t\t\t(0, react_jsx_runtime.jsxs)(\"label\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", { className: ModelsSection_module_css_default[\"fieldLabel\"], children: t(\"multiKeyEntryName\") }),\n\t\t\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(\"input\", {\n\t\t\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"input\"], type: \"text\", value: entry.name ?? \"\", maxLength: 120,\n\t\t\t\t\t\t\t\t\t\t\"aria-label\": `${t(\"multiKeyEntryName\")} ${String(index + 1)}`, disabled,\n\t\t\t\t\t\t\t\t\t\tonChange: (event) => update(id, { name: event.target.value })\n\t\t\t\t\t\t\t\t\t})]\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(ModelListEditor, {\n\t\t\t\t\t\t\t\tmodels: modelDrafts(entry.models), onChange: (models) => update(id, { models }),\n\t\t\t\t\t\t\t\treasoningLevels: props.reasoningLevels, probe,\n\t\t\t\t\t\t\t\tprobeBlocked: keyFailure ?? props.probeBlocked ?? (!canUseStored && draft.trim().length === 0 ? \"multiKeyProbeNeedsKey\" : void 0),\n\t\t\t\t\t\t\t\toperations, t, disabled,\n\t\t\t\t\t\t\t\tonBusyChange: (value) => setBusyEntries((current) => current[id] === value ? current : { ...current, [id]: value })\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(\"button\", {\n\t\t\t\t\t\t\t\ttype: \"button\", className: ModelsSection_module_css_default[\"secondaryButton\"], disabled,\n\t\t\t\t\t\t\t\tonClick: () => remove(id), children: t(\"multiKeyRemove\")\n\t\t\t\t\t\t\t})]\n\t\t\t\t\t\t})]"
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
"before": "function CustomProviderCard(props) {\n\t\t\tconst { taken, protocols, reasoningLevels, operations, t, onBusyChange } = props;\n\t\t\tconst supportsMultiKey = supportsMultiKeySchema(props.namespace, props.schema, [\"providers\", PROBE_ROUTE]);\n\t\t\tconst [openedAt] = (0, react.useState)(() => props.revision);\n\t\t\tconst [route, setRoute] = (0, react.useState)(\"\");\n\t\t\tconst [displayName, setDisplayName] = (0, react.useState)(\"\");\n\t\t\tconst [baseURL, setBaseURL] = (0, react.useState)(\"\");\n\t\t\tconst [protocol, setProtocol] = (0, react.useState)(protocols[0] ?? \"\");\n\t\t\tconst [keyDraft, setKeyDraft] = (0, react.useState)(\"\");\n\t\t\tconst [models, setModels] = (0, react.useState)([]);\n\t\t\tconst [multiKey, setMultiKey] = (0, react.useState)(false);\n\t\t\tconst [keyEntries, setKeyEntries] = (0, react.useState)({});\n\t\t\tconst [entryKeyDrafts, setEntryKeyDrafts] = (0, react.useState)({});\n\t\t\tconst [entryConfirmations, setEntryConfirmations] = (0, react.useState)({});\n\t\t\tconst saving = (0, react.useRef)(false);\n\t\t\tconst [busy, setBusy] = (0, react.useState)(false);\n\t\t\tconst [listBusy, setListBusy] = (0, react.useState)(false);\n\t\t\t(0, react.useEffect)(() => {\n\t\t\t\tonBusyChange?.(busy || listBusy);\n\t\t\t}, [\n\t\t\t\tbusy,\n\t\t\t\tlistBusy,\n\t\t\t\tonBusyChange\n\t\t\t]);\n\t\t\tconst [failure, setFailure] = (0, react.useState)(void 0);\n\t\t\t/**\n\t\t\t* The profile write landed. Only the key write can still be outstanding, so\n\t\t\t* the fields that describe the provider are settled and the retry path is\n\t\t\t* the credential alone.\n\t\t\t*/\n\t\t\tconst [committed, setCommitted] = (0, react.useState)(false);\n\t\t\tconst disabled = props.readOnly || busy;\n\t\t\t/** Everything but the key stops being editable once the provider exists. */\n\t\t\tconst profileDisabled = disabled || committed;\n\t\t\tconst routeInvalid = route.length > 0 && !ROUTE_PATTERN.test(route);\n\t\t\tconst routeTaken = taken.includes(route);\n\t\t\tconst normalizedBaseURL = baseURL.trim();\n\t\t\tconst baseUrlInvalid = baseURL.length > 0 && !isHttpUrl(normalizedBaseURL);\n\t\t\tconst modelFailure = multiKey ? void 0 : validateDeepSeekModels(models) ?? validateReasoningEfforts(models);\n\t\t\tconst entryFailure = multiKey ? multiKeyFailure(route, keyEntries, entryKeyDrafts, entryConfirmations, t) : void 0;\n\t\t\tconst keyFailure = multiKey ? void 0 : apiKeyFailure(keyDraft);\n\t\t\tconst keyValue = keyDraft.trim();\n\t\t\tconst ready = (committed || route.length > 0 && !routeInvalid && !routeTaken) && normalizedBaseURL.length > 0 && !baseUrlInvalid && (multiKey ? entryFailure === void 0 : models.length > 0 && modelFailure === void 0 && keyFailure === void 0);\n\t\t\tconst hint = entryFailure ?? (failure !== void 0 || ready || keyFailure !== void 0 || route.length === 0 || routeInvalid || routeTaken || baseUrlInvalid ? void 0 : normalizedBaseURL.length === 0 ? t(\"customNeedsBaseUrl\") : modelFailure !== void 0 ? `${t(\"model\")} ${String(modelFailure.index + 1)}: ${t(modelFailure.key)}` : t(\"customNeedsModels\"));\n\t\t\t/** Perform the create, returning a failure message or undefined. */\n\t\t\tconst createOnce = async () => {\n\t\t\t\tconst entries = normalizedMultiKeyEntries(route, keyEntries);\n\t\t\t\tconst firstEntry = Object.values(entries)[0];\n\t\t\t\tconst keyRef = multiKey ? firstEntry?.apiKeyEnv : deriveKeyRef(route);\n\t\t\t\tconst storesKey = !multiKey && keyValue.length > 0;\n\t\t\t\tif (multiKey && entryFailure !== void 0) return entryFailure;\n\t\t\t\tif (!committed) {\n\t\t\t\t\tconst profile = {\n\t\t\t\t\t\t...displayName.length === 0 ? {} : { displayName },\n\t\t\t\t\t\t...storesKey || multiKey ? { apiKeyEnv: keyRef } : {},\n\t\t\t\t\t\tapi: protocol,\n\t\t\t\t\t\tbaseURL: normalizedBaseURL,\n\t\t\t\t\t\tmodels: (multiKey ? firstEntry.models : models).map((model) => ({ ...model })),\n\t\t\t\t\t\t...(multiKey || Object.keys(keyEntries).length > 0 ? { multiKey, keyEntries: entries } : {})\n\t\t\t\t\t};\n\t\t\t\t\tconst written = await operations.writeSettings(NS$1, [{\n\t\t\t\t\t\top: \"set\",\n\t\t\t\t\t\tpath: [\"providers\", route],\n\t\t\t\t\t\tvalue: profile\n\t\t\t\t\t}], openedAt);\n\t\t\t\t\tif (written.kind !== \"written\") return written.kind === \"conflict\" ? t(\"conflict\") : written.message;\n\t\t\t\t\tsetCommitted(true);\n\t\t\t\t}\n\t\t\t\tif (multiKey) return storeMultiKeyDrafts(operations, entries, entryKeyDrafts, setEntryKeyDrafts);\n\t\t\t\tif (storesKey) {\n\t\t\t\t\tconst stored = await operations.storeCredential(keyRef, keyValue);\n\t\t\t\t\tif (stored !== void 0) return stored;\n\t\t\t\t\tsetKeyDraft(\"\");\n\t\t\t\t}\n\t\t\t};\n\t\t\tconst create = async () => {\n\t\t\t\tif (saving.current || !ready || props.readOnly || listBusy) return;\n\t\t\t\tsaving.current = true;\n\t\t\t\tsetBusy(true);\n\t\t\t\tsetFailure(void 0);\n\t\t\t\ttry {\n\t\t\t\t\tconst outcome = await createOnce();\n\t\t\t\t\tif (outcome !== void 0) {\n\t\t\t\t\t\tsetFailure(outcome);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tprops.onClose(true);\n\t\t\t\t} catch {\n\t\t\t\t\tsetFailure(t(\"multiKeySaveFailed\"));\n\t\t\t\t} finally {\n\t\t\t\t\tsaving.current = false;\n\t\t\t\t\tsetBusy(false);\n\t\t\t\t}\n\t\t\t};\n\t\t\treturn (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\tclassName: ModelsSection_module_css_default[\"editor\"],\n\t\t\t\tchildren: [\n\t\t\t\t\t(0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\tchildren: t(\"customRoute\")\n\t\t\t\t\t\t}), (0, react_jsx_runtime.jsx)(\"input\", {\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"input\"],\n\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\tvalue: route,\n\t\t\t\t\t\t\tplaceholder: \"acme-gateway\",\n\t\t\t\t\t\t\t\"aria-label\": t(\"customRoute\"),\n\t\t\t\t\t\t\tdisabled: profileDisabled,\n\t\t\t\t\t\t\tonChange: (event) => {\n\t\t\t\t\t\t\t\tsetRoute(event.target.value);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})]\n\t\t\t\t\t}),\n\t\t\t\t\trouteInvalid || routeTaken ? (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"error\"],\n\t\t\t\t\t\tchildren: t(routeInvalid ? \"customRouteInvalid\" : \"customRouteTaken\")\n\t\t\t\t\t}) : (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"advancedHint\"],\n\t\t\t\t\t\tchildren: t(\"customRouteHint\")\n\t\t\t\t\t}),\n\t\t\t\t\t(0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\tchildren: t(\"customDisplayName\")\n\t\t\t\t\t\t}), (0, react_jsx_runtime.jsx)(\"input\", {\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"input\"],\n\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\tvalue: displayName,\n\t\t\t\t\t\t\tplaceholder: route.length === 0 ? t(\"customDisplayName\") : route,\n\t\t\t\t\t\t\t\"aria-label\": t(\"customDisplayName\"),\n\t\t\t\t\t\t\tdisabled: profileDisabled,\n\t\t\t\t\t\t\tonChange: (event) => {\n\t\t\t\t\t\t\t\tsetDisplayName(event.target.value);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})]\n\t\t\t\t\t}),\n\t\t\t\t\t(0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\tchildren: t(\"baseUrl\")\n\t\t\t\t\t\t}), (0, react_jsx_runtime.jsx)(\"input\", {\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"input\"],\n\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\tvalue: baseURL,\n\t\t\t\t\t\t\tplaceholder: t(protocol === \"anthropic-messages\" ? \"customAnthropicBaseUrlPlaceholder\" : \"customBaseUrlPlaceholder\"),\n\t\t\t\t\t\t\t\"aria-label\": t(\"baseUrl\"),\n\t\t\t\t\t\t\t\"aria-invalid\": baseUrlInvalid,\n\t\t\t\t\t\t\tdisabled: profileDisabled,\n\t\t\t\t\t\t\tonChange: (event) => {\n\t\t\t\t\t\t\t\tsetBaseURL(event.target.value);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})]\n\t\t\t\t\t}),\n\t\t\t\t\tbaseUrlInvalid ? (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"error\"],\n\t\t\t\t\t\tchildren: t(\"customBaseUrlInvalid\")\n\t\t\t\t\t}) : null,\n\t\t\t\t\t(0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\tchildren: t(\"customApi\")\n\t\t\t\t\t\t}), (0, react_jsx_runtime.jsx)(\"select\", {\n\t\t\t\t\t\t\tclassName: `${ModelsSection_module_css_default[\"input\"]} ${ModelsSection_module_css_default[\"selectInput\"]}`,\n\t\t\t\t\t\t\tvalue: protocol,\n\t\t\t\t\t\t\t\"aria-label\": t(\"customApi\"),\n\t\t\t\t\t\t\tdisabled: profileDisabled,\n\t\t\t\t\t\t\tonChange: (event) => {\n\t\t\t\t\t\t\t\tsetProtocol(event.target.value);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tchildren: protocols.map((choice) => (0, react_jsx_runtime.jsx)(\"option\", {\n\t\t\t\t\t\t\t\tvalue: choice,\n\t\t\t\t\t\t\t\tchildren: protocolLabel(t, choice)\n\t\t\t\t\t\t\t}, choice))\n\t\t\t\t\t\t})]\n\t\t\t\t\t}),\n\t\t\t\t\tsupportsMultiKey ? (0, react_jsx_runtime.jsx)(MultiKeyToggle, {\n\t\t\t\t\t\tt, checked: multiKey, disabled: profileDisabled || listBusy, hasUnsavedKeys: hasMultiKeyDrafts(entryKeyDrafts),\n\t\t\t\t\t\tonChange: (enabled) => {\n\t\t\t\t\t\t\tif (enabled && Object.keys(keyEntries).length === 0) {\n\t\t\t\t\t\t\t\tconst [id, entry] = newMultiKeyEntry(route, { name: displayName || route || t(\"multiKeyDefaultName\"), models });\n\t\t\t\t\t\t\t\tsetKeyEntries({ [id]: entry });\n\t\t\t\t\t\t\t\tif (keyDraft.length > 0) setEntryKeyDrafts({ [id]: keyDraft });\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsetMultiKey(enabled);\n\t\t\t\t\t\t}\n\t\t\t\t\t}) : null,\n\t\t\t\t\tmultiKey ? (0, react_jsx_runtime.jsx)(MultiKeyEntriesEditor, {\n\t\t\t\t\t\troute, entries: keyEntries, onChange: setKeyEntries,\n\t\t\t\t\t\tkeyDrafts: entryKeyDrafts, onKeyDraftsChange: setEntryKeyDrafts,\n\t\t\t\t\t\tconfirmations: entryConfirmations, onConfirmationsChange: setEntryConfirmations,\n\t\t\t\t\t\tpersistedEntries: committed ? normalizedMultiKeyEntries(route, keyEntries) : {},\n\t\t\t\t\t\tprobe: { settingsNs: NS$1, ...(committed ? { provider: route } : {}), baseURL: normalizedBaseURL, api: protocol },\n\t\t\t\t\t\tprobeBlocked: baseUrlInvalid ? \"customBaseUrlInvalid\" : normalizedBaseURL.length === 0 ? \"customNeedsBaseUrl\" : void 0,\n\t\t\t\t\t\treasoningLevels, operations, t, disabled: profileDisabled || listBusy, keyDisabled: disabled || listBusy, onBusyChange: setListBusy\n\t\t\t\t\t}) : null,\n\t\t\t\t\tmultiKey ? null : (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\tchildren: [\n\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\t\tchildren: t(\"keyInput\")\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(ApiKeyInput, {\n\t\t\t\t\t\t\t\tt,\n\t\t\t\t\t\t\t\tvalue: keyDraft,\n\t\t\t\t\t\t\t\tplaceholder: t(\"keyPlaceholder\"),\n\t\t\t\t\t\t\t\t\"aria-label\": t(\"keyInput\"),\n\t\t\t\t\t\t\t\tdisabled,\n\t\t\t\t\t\t\t\tonChange: (event) => {\n\t\t\t\t\t\t\t\t\tsetKeyDraft(event.target.value);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tkeyFailure === void 0 ? null : (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"error\"],\n\t\t\t\t\t\t\t\tchildren: t(keyFailure === \"keyBlank\" ? \"keyBlankNew\" : keyFailure)\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t]\n\t\t\t\t\t}),\n\t\t\t\t\t!multiKey ? (0, react_jsx_runtime.jsx)(ModelListEditor, {\n\t\t\t\t\t\tmodels,\n\t\t\t\t\t\tonChange: setModels,\n\t\t\t\t\t\treasoningLevels,\n\t\t\t\t\t\tprobe: {\n\t\t\t\t\t\t\tsettingsNs: NS$1,\n\t\t\t\t\t\t\tbaseURL: normalizedBaseURL,\n\t\t\t\t\t\t\tapi: protocol,\n\t\t\t\t\t\t\t...keyValue.length === 0 ? {} : { apiKey: keyValue }\n\t\t\t\t\t\t},\n\t\t\t\t\t\tprobeBlocked: baseUrlInvalid ? \"customBaseUrlInvalid\" : keyFailure === \"keyBlank\" ? \"keyBlankNew\" : keyFailure,\n\t\t\t\t\t\toperations,\n\t\t\t\t\t\tt,\n\t\t\t\t\t\tdisabled: profileDisabled,\n\t\t\t\t\t\tonBusyChange: setListBusy\n\t\t\t\t\t}) : null,\n\t\t\t\t\tfailure !== void 0 ? (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"error\"],\n\t\t\t\t\t\tchildren: failure\n\t\t\t\t\t}) : null,\n\t\t\t\t\thint === void 0 ? null : (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"advancedHint\"],\n\t\t\t\t\t\tchildren: hint\n\t\t\t\t\t}),\n\t\t\t\t\t(0, react_jsx_runtime.jsx)(EditorFooter, {\n\t\t\t\t\t\tt,\n\t\t\t\t\t\tbusy,\n\t\t\t\t\t\tsubmitDisabled: disabled || listBusy || !ready,\n\t\t\t\t\t\tsubmitLabelKey: \"create\",\n\t\t\t\t\t\tsubmitBusyLabelKey: \"creating\",\n\t\t\t\t\t\tonCancel: () => {\n\t\t\t\t\t\t\tprops.onClose(committed);\n\t\t\t\t\t\t},\n\t\t\t\t\t\tonSubmit: () => {\n\t\t\t\t\t\t\tcreate();\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t]\n\t\t\t});\n\t\t}",
|
|
389
|
+
"after": "function CustomProviderCard(props) {\n\t\t\tconst { taken, protocols, reasoningLevels, operations, t, onBusyChange } = props;\n\t\t\tconst supportsMultiKey = supportsMultiKeySchema(props.namespace, props.schema, [\"providers\", PROBE_ROUTE]);\n\t\t\tconst [openedAt] = (0, react.useState)(() => props.revision);\n\t\t\tconst [route, setRoute] = (0, react.useState)(\"\");\n\t\t\tconst [displayName, setDisplayName] = (0, react.useState)(\"\");\n\t\t\tconst [baseURL, setBaseURL] = (0, react.useState)(\"\");\n\t\t\tconst [protocol, setProtocol] = (0, react.useState)(protocols[0] ?? \"\");\n\t\t\tconst [keyDraft, setKeyDraft] = (0, react.useState)(\"\");\n\t\t\tconst [models, setModels] = (0, react.useState)([]);\n\t\t\tconst [multiKey, setMultiKey] = (0, react.useState)(false);\n\t\t\tconst [keyEntries, setKeyEntries] = (0, react.useState)({});\n\t\t\tconst [entryKeyDrafts, setEntryKeyDrafts] = (0, react.useState)({});\n\t\t\tconst [entryConfirmations, setEntryConfirmations] = (0, react.useState)({});\n\t\t\tconst [entrySaveState, setEntrySaveState] = (0, react.useState)(void 0);\n\t\t\tconst saving = (0, react.useRef)(false);\n\t\t\tconst [busy, setBusy] = (0, react.useState)(false);\n\t\t\tconst [listBusy, setListBusy] = (0, react.useState)(false);\n\t\t\t(0, react.useEffect)(() => {\n\t\t\t\tonBusyChange?.(busy || listBusy);\n\t\t\t}, [\n\t\t\t\tbusy,\n\t\t\t\tlistBusy,\n\t\t\t\tonBusyChange\n\t\t\t]);\n\t\t\tconst [failure, setFailure] = (0, react.useState)(void 0);\n\t\t\t/**\n\t\t\t* The profile write landed. Only the key write can still be outstanding, so\n\t\t\t* the fields that describe the provider are settled and the retry path is\n\t\t\t* the credential alone.\n\t\t\t*/\n\t\t\tconst [committed, setCommitted] = (0, react.useState)(false);\n\t\t\tconst disabled = props.readOnly || busy;\n\t\t\t/** Everything but the key stops being editable once the provider exists. */\n\t\t\tconst profileDisabled = disabled || committed;\n\t\t\tconst routeInvalid = route.length > 0 && !ROUTE_PATTERN.test(route);\n\t\t\tconst routeTaken = taken.includes(route);\n\t\t\tconst normalizedBaseURL = baseURL.trim();\n\t\t\tconst baseUrlInvalid = baseURL.length > 0 && !isHttpUrl(normalizedBaseURL);\n\t\t\tconst modelFailure = multiKey ? void 0 : validateDeepSeekModels(models) ?? validateReasoningEfforts(models);\n\t\t\tconst entryFailure = multiKey ? multiKeyFailure(route, keyEntries, entryKeyDrafts, entryConfirmations, t) : void 0;\n\t\t\tconst keyFailure = multiKey ? void 0 : apiKeyFailure(keyDraft);\n\t\t\tconst keyValue = keyDraft.trim();\n\t\t\tconst ready = (committed || route.length > 0 && !routeInvalid && !routeTaken) && normalizedBaseURL.length > 0 && !baseUrlInvalid && (multiKey ? entryFailure === void 0 : models.length > 0 && modelFailure === void 0 && keyFailure === void 0);\n\t\t\tconst hint = entryFailure ?? (failure !== void 0 || ready || keyFailure !== void 0 || route.length === 0 || routeInvalid || routeTaken || baseUrlInvalid ? void 0 : normalizedBaseURL.length === 0 ? t(\"customNeedsBaseUrl\") : modelFailure !== void 0 ? `${t(\"model\")} ${String(modelFailure.index + 1)}: ${t(modelFailure.key)}` : t(\"customNeedsModels\"));\n\t\t\t/** Perform the create, returning a failure message or undefined. */\n\t\t\tconst createOnce = async () => {\n\t\t\t\tconst entries = normalizedMultiKeyEntries(route, keyEntries);\n\t\t\t\tconst firstEntry = Object.values(entries)[0];\n\t\t\t\tconst keyRef = multiKey ? firstEntry?.apiKeyEnv : deriveKeyRef(route);\n\t\t\t\tconst storesKey = !multiKey && keyValue.length > 0;\n\t\t\t\tif (multiKey && entryFailure !== void 0) return entryFailure;\n\t\t\t\tif (!committed) {\n\t\t\t\t\tconst profile = {\n\t\t\t\t\t\t...displayName.length === 0 ? {} : { displayName },\n\t\t\t\t\t\t...storesKey || multiKey ? { apiKeyEnv: keyRef } : {},\n\t\t\t\t\t\tapi: protocol,\n\t\t\t\t\t\tbaseURL: normalizedBaseURL,\n\t\t\t\t\t\tmodels: (multiKey ? firstEntry.models : models).map((model) => ({ ...model })),\n\t\t\t\t\t\t...(multiKey || Object.keys(keyEntries).length > 0 ? { multiKey, keyEntries: entries } : {})\n\t\t\t\t\t};\n\t\t\t\t\tconst written = await operations.writeSettings(NS$1, [{\n\t\t\t\t\t\top: \"set\",\n\t\t\t\t\t\tpath: [\"providers\", route],\n\t\t\t\t\t\tvalue: profile\n\t\t\t\t\t}], openedAt);\n\t\t\t\t\tif (written.kind !== \"written\") return written.kind === \"conflict\" ? t(\"conflict\") : written.message;\n\t\t\t\t\tsetCommitted(true);\n\t\t\t\t}\n\t\t\t\tif (multiKey) return storeMultiKeyDrafts(operations, entries, entryKeyDrafts, setEntryKeyDrafts);\n\t\t\t\tif (storesKey) {\n\t\t\t\t\tconst stored = await operations.storeCredential(keyRef, keyValue);\n\t\t\t\t\tif (stored !== void 0) return stored;\n\t\t\t\t\tsetKeyDraft(\"\");\n\t\t\t\t}\n\t\t\t};\n\t\t\tconst create = async () => {\n\t\t\t\tif (saving.current || !ready || props.readOnly || listBusy) return;\n\t\t\t\tsaving.current = true;\n\t\t\t\tsetBusy(true);\n\t\t\t\tsetFailure(void 0);\n\t\t\t\ttry {\n\t\t\t\t\tconst outcome = await createOnce();\n\t\t\t\t\tif (multiKey) setEntrySaveState({ ok: outcome === void 0, entries: structuredClone(outcome === void 0 ? normalizedMultiKeyEntries(route, keyEntries) : keyEntries) });\n\t\t\t\t\tif (outcome !== void 0) {\n\t\t\t\t\t\tsetFailure(outcome);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tprops.onClose(true);\n\t\t\t\t} catch {\n\t\t\t\t\tif (multiKey) setEntrySaveState({ ok: false, entries: structuredClone(keyEntries) });\n\t\t\t\t\tsetFailure(t(\"multiKeySaveFailed\"));\n\t\t\t\t} finally {\n\t\t\t\t\tsaving.current = false;\n\t\t\t\t\tsetBusy(false);\n\t\t\t\t}\n\t\t\t};\n\t\t\treturn (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\tclassName: ModelsSection_module_css_default[\"editor\"],\n\t\t\t\tchildren: [\n\t\t\t\t\t(0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\tchildren: t(\"customRoute\")\n\t\t\t\t\t\t}), (0, react_jsx_runtime.jsx)(\"input\", {\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"input\"],\n\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\tvalue: route,\n\t\t\t\t\t\t\tplaceholder: \"acme-gateway\",\n\t\t\t\t\t\t\t\"aria-label\": t(\"customRoute\"),\n\t\t\t\t\t\t\tdisabled: profileDisabled,\n\t\t\t\t\t\t\tonChange: (event) => {\n\t\t\t\t\t\t\t\tsetRoute(event.target.value);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})]\n\t\t\t\t\t}),\n\t\t\t\t\trouteInvalid || routeTaken ? (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"error\"],\n\t\t\t\t\t\tchildren: t(routeInvalid ? \"customRouteInvalid\" : \"customRouteTaken\")\n\t\t\t\t\t}) : (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"advancedHint\"],\n\t\t\t\t\t\tchildren: t(\"customRouteHint\")\n\t\t\t\t\t}),\n\t\t\t\t\t(0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\tchildren: t(\"customDisplayName\")\n\t\t\t\t\t\t}), (0, react_jsx_runtime.jsx)(\"input\", {\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"input\"],\n\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\tvalue: displayName,\n\t\t\t\t\t\t\tplaceholder: route.length === 0 ? t(\"customDisplayName\") : route,\n\t\t\t\t\t\t\t\"aria-label\": t(\"customDisplayName\"),\n\t\t\t\t\t\t\tdisabled: profileDisabled,\n\t\t\t\t\t\t\tonChange: (event) => {\n\t\t\t\t\t\t\t\tsetDisplayName(event.target.value);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})]\n\t\t\t\t\t}),\n\t\t\t\t\t(0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\tchildren: t(\"baseUrl\")\n\t\t\t\t\t\t}), (0, react_jsx_runtime.jsx)(\"input\", {\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"input\"],\n\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\tvalue: baseURL,\n\t\t\t\t\t\t\tplaceholder: t(protocol === \"anthropic-messages\" ? \"customAnthropicBaseUrlPlaceholder\" : \"customBaseUrlPlaceholder\"),\n\t\t\t\t\t\t\t\"aria-label\": t(\"baseUrl\"),\n\t\t\t\t\t\t\t\"aria-invalid\": baseUrlInvalid,\n\t\t\t\t\t\t\tdisabled: profileDisabled,\n\t\t\t\t\t\t\tonChange: (event) => {\n\t\t\t\t\t\t\t\tsetBaseURL(event.target.value);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})]\n\t\t\t\t\t}),\n\t\t\t\t\tbaseUrlInvalid ? (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"error\"],\n\t\t\t\t\t\tchildren: t(\"customBaseUrlInvalid\")\n\t\t\t\t\t}) : null,\n\t\t\t\t\t(0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\tchildren: t(\"customApi\")\n\t\t\t\t\t\t}), (0, react_jsx_runtime.jsx)(\"select\", {\n\t\t\t\t\t\t\tclassName: `${ModelsSection_module_css_default[\"input\"]} ${ModelsSection_module_css_default[\"selectInput\"]}`,\n\t\t\t\t\t\t\tvalue: protocol,\n\t\t\t\t\t\t\t\"aria-label\": t(\"customApi\"),\n\t\t\t\t\t\t\tdisabled: profileDisabled,\n\t\t\t\t\t\t\tonChange: (event) => {\n\t\t\t\t\t\t\t\tsetProtocol(event.target.value);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tchildren: protocols.map((choice) => (0, react_jsx_runtime.jsx)(\"option\", {\n\t\t\t\t\t\t\t\tvalue: choice,\n\t\t\t\t\t\t\t\tchildren: protocolLabel(t, choice)\n\t\t\t\t\t\t\t}, choice))\n\t\t\t\t\t\t})]\n\t\t\t\t\t}),\n\t\t\t\t\tsupportsMultiKey ? (0, react_jsx_runtime.jsx)(MultiKeyToggle, {\n\t\t\t\t\t\tt, checked: multiKey, disabled: profileDisabled || listBusy, hasUnsavedKeys: hasMultiKeyDrafts(entryKeyDrafts),\n\t\t\t\t\t\tonChange: (enabled) => {\n\t\t\t\t\t\t\tif (enabled && Object.keys(keyEntries).length === 0) {\n\t\t\t\t\t\t\t\tconst [id, entry] = newMultiKeyEntry(route, { name: displayName || route || t(\"multiKeyDefaultName\"), models });\n\t\t\t\t\t\t\t\tsetKeyEntries({ [id]: entry });\n\t\t\t\t\t\t\t\tif (keyDraft.length > 0) setEntryKeyDrafts({ [id]: keyDraft });\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsetMultiKey(enabled);\n\t\t\t\t\t\t}\n\t\t\t\t\t}) : null,\n\t\t\t\t\tmultiKey ? (0, react_jsx_runtime.jsx)(MultiKeyEntriesEditor, {\n\t\t\t\t\t\troute, entries: keyEntries, saveState: entrySaveState, savedEntries: entrySaveState?.ok ? entrySaveState.entries : void 0, onChange: setKeyEntries,\n\t\t\t\t\t\tkeyDrafts: entryKeyDrafts, onKeyDraftsChange: setEntryKeyDrafts,\n\t\t\t\t\t\tconfirmations: entryConfirmations, onConfirmationsChange: setEntryConfirmations,\n\t\t\t\t\t\tpersistedEntries: committed ? normalizedMultiKeyEntries(route, keyEntries) : {},\n\t\t\t\t\t\tprobe: { settingsNs: NS$1, ...(committed ? { provider: route } : {}), baseURL: normalizedBaseURL, api: protocol },\n\t\t\t\t\t\tprobeBlocked: baseUrlInvalid ? \"customBaseUrlInvalid\" : normalizedBaseURL.length === 0 ? \"customNeedsBaseUrl\" : void 0,\n\t\t\t\t\t\treasoningLevels, operations, t, disabled: profileDisabled || listBusy, keyDisabled: disabled || listBusy, onBusyChange: setListBusy\n\t\t\t\t\t}) : null,\n\t\t\t\t\tmultiKey ? null : (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\tchildren: [\n\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\t\tchildren: t(\"keyInput\")\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(ApiKeyInput, {\n\t\t\t\t\t\t\t\tt,\n\t\t\t\t\t\t\t\tvalue: keyDraft,\n\t\t\t\t\t\t\t\tplaceholder: t(\"keyPlaceholder\"),\n\t\t\t\t\t\t\t\t\"aria-label\": t(\"keyInput\"),\n\t\t\t\t\t\t\t\tdisabled,\n\t\t\t\t\t\t\t\tonChange: (event) => {\n\t\t\t\t\t\t\t\t\tsetKeyDraft(event.target.value);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tkeyFailure === void 0 ? null : (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"error\"],\n\t\t\t\t\t\t\t\tchildren: t(keyFailure === \"keyBlank\" ? \"keyBlankNew\" : keyFailure)\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t]\n\t\t\t\t\t}),\n\t\t\t\t\t!multiKey ? (0, react_jsx_runtime.jsx)(ModelListEditor, {\n\t\t\t\t\t\tmodels,\n\t\t\t\t\t\tonChange: setModels,\n\t\t\t\t\t\treasoningLevels,\n\t\t\t\t\t\tprobe: {\n\t\t\t\t\t\t\tsettingsNs: NS$1,\n\t\t\t\t\t\t\tbaseURL: normalizedBaseURL,\n\t\t\t\t\t\t\tapi: protocol,\n\t\t\t\t\t\t\t...keyValue.length === 0 ? {} : { apiKey: keyValue }\n\t\t\t\t\t\t},\n\t\t\t\t\t\tprobeBlocked: baseUrlInvalid ? \"customBaseUrlInvalid\" : keyFailure === \"keyBlank\" ? \"keyBlankNew\" : keyFailure,\n\t\t\t\t\t\toperations,\n\t\t\t\t\t\tt,\n\t\t\t\t\t\tdisabled: profileDisabled,\n\t\t\t\t\t\tonBusyChange: setListBusy\n\t\t\t\t\t}) : null,\n\t\t\t\t\tfailure !== void 0 ? (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"error\"],\n\t\t\t\t\t\tchildren: failure\n\t\t\t\t\t}) : null,\n\t\t\t\t\thint === void 0 ? null : (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"advancedHint\"],\n\t\t\t\t\t\tchildren: hint\n\t\t\t\t\t}),\n\t\t\t\t\t(0, react_jsx_runtime.jsx)(EditorFooter, {\n\t\t\t\t\t\tt,\n\t\t\t\t\t\tbusy,\n\t\t\t\t\t\tsubmitDisabled: disabled || listBusy || !ready,\n\t\t\t\t\t\tsubmitLabelKey: \"create\",\n\t\t\t\t\t\tsubmitBusyLabelKey: \"creating\",\n\t\t\t\t\t\tonCancel: () => {\n\t\t\t\t\t\t\tprops.onClose(committed);\n\t\t\t\t\t\t},\n\t\t\t\t\t\tonSubmit: () => {\n\t\t\t\t\t\t\tcreate();\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t]\n\t\t\t});\n\t\t}"
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
"before": "function ProviderEditor(props) {\n\t\t\tconst { namespace, schema, settingsPath, operations, t } = props;\n\t\t\tconst [draft, setDraft] = (0, react.useState)(() => draftAt(schema, namespace, settingsPath));\n\t\t\tconst [entryKeyDrafts, setEntryKeyDrafts] = (0, react.useState)({});\n\t\t\tconst [entryConfirmations, setEntryConfirmations] = (0, react.useState)({});\n\t\t\tconst saving = (0, react.useRef)(false);\n\t\t\tconst [keyDraft, setKeyDraft] = (0, react.useState)(\"\");\n\t\t\tconst [busy, setBusy] = (0, react.useState)(false);\n\t\t\tconst [listBusy, setListBusy] = (0, react.useState)(false);\n\t\t\tconst { onBusyChange } = props;\n\t\t\t(0, react.useEffect)(() => {\n\t\t\t\tonBusyChange?.(busy || listBusy);\n\t\t\t}, [\n\t\t\t\tbusy,\n\t\t\t\tlistBusy,\n\t\t\t\tonBusyChange\n\t\t\t]);\n\t\t\tconst [failure, setFailure] = (0, react.useState)(void 0);\n\t\t\tconst [committedOriginal, setCommittedOriginal] = (0, react.useState)(() => schema.getPath(namespace.user, settingsPath));\n\t\t\tconst [expectedRevision, setExpectedRevision] = (0, react.useState)(() => namespace.revision);\n\t\t\tconst root = (0, react.useMemo)(() => schema.rehydrate(namespace.schema), [namespace.schema, schema]);\n\t\t\tconst node = (0, react.useMemo)(() => schema.nodeAtPath(root, settingsPath), [\n\t\t\t\troot,\n\t\t\t\tschema,\n\t\t\t\tsettingsPath\n\t\t\t]);\n\t\t\tconst fallback = schema.getPath(namespace.value, settingsPath);\n\t\t\tconst disabled = props.readOnly || busy;\n\t\t\tconst layout = layoutOf(namespace.ns);\n\t\t\tconst keyRef = refFor(schema, namespace, settingsPath, props.provider);\n\t\t\tconst supportsMultiKey = layout === \"pi-ai\" && props.declared === true && props.credentialOnly !== true && supportsMultiKeySchema(namespace, schema, settingsPath);\n\t\t\tconst multiKey = supportsMultiKey && (draft.multiKey ?? fallback?.multiKey) === true;\n\t\t\tconst keyEntries = draft.keyEntries ?? fallback?.keyEntries ?? {};\n\t\t\tconst entryFailure = multiKey ? multiKeyFailure(props.provider, keyEntries, entryKeyDrafts, entryConfirmations, t) : void 0;\n\t\t\tconst protocols = (0, react.useMemo)(() => layout === \"pi-ai\" ? protocolChoices(namespace, schema) : [], [\n\t\t\t\tlayout,\n\t\t\t\tnamespace,\n\t\t\t\tschema\n\t\t\t]);\n\t\t\tconst stringAt = (source, key) => {\n\t\t\t\tconst value = schema.getPath(source, [key]);\n\t\t\t\treturn typeof value === \"string\" && value.trim().length > 0 ? value : void 0;\n\t\t\t};\n\t\t\tconst setField = (key, next) => {\n\t\t\t\tconst value = next === void 0 || next.trim().length === 0 ? void 0 : next;\n\t\t\t\tsetDraft((current) => value === void 0 ? schema.deletePath(current, [key]) : schema.setPath(current, [key], value));\n\t\t\t};\n\t\t\tconst reasoningLevels = (0, react.useMemo)(() => layout === \"pi-ai\" && props.declared === true ? reasoningLevelChoices(namespace, schema) : [], [\n\t\t\t\tlayout,\n\t\t\t\tprops.declared,\n\t\t\t\tnamespace,\n\t\t\t\tschema\n\t\t\t]);\n\t\t\tconst editsReasoning = reasoningLevels.length > 0;\n\t\t\tconst validateModels = (value) => validateDeepSeekModels(value) ?? (editsReasoning ? validateReasoningEfforts(value) : void 0);\n\t\t\tconst modelFailure = multiKey ? void 0 : validateModels(schema.getPath(draft, [\"models\"]));\n\t\t\tconst keyFailure = multiKey ? void 0 : apiKeyFailure(keyDraft);\n\t\t\tconst keyValue = keyDraft.trim();\n\t\t\tconst shownKeyFailure = (props.credentialRequired === true && keyDraft.length > 0 && keyValue.length === 0 ? \"keyRequired\" : void 0) ?? keyFailure;\n\t\t\tconst probeApi = stringAt(draft, \"api\") ?? stringAt(fallback, \"api\");\n\t\t\tconst probeBaseURL = stringAt(draft, \"baseURL\") ?? stringAt(fallback, \"baseURL\");\n\t\t\tconst probe = {\n\t\t\t\tsettingsNs: namespace.ns,\n\t\t\t\tprovider: props.provider,\n\t\t\t\t...probeBaseURL === void 0 ? {} : { baseURL: probeBaseURL },\n\t\t\t\t...probeApi === void 0 ? {} : { api: probeApi },\n\t\t\t\t...keyValue.length === 0 ? {} : { apiKey: keyValue }\n\t\t\t};\n\t\t\t/**\n\t\t\t* The write for this card, or a failure message. Every edit travels as\n\t\t\t* path ops against the STORED section: the draft comes from the redacted\n\t\t\t* descriptor, so a wholesale replace rebuilt from it could delete fields\n\t\t\t* outside the card. Ops name only the fields this card can see.\n\t\t\t*/\n\t\t\tconst applyOnce = async () => {\n\t\t\t\tconst ns = namespace.ns;\n\t\t\t\tconst normalizedDraft = supportsMultiKey && schema.hasPath(draft, [\"keyEntries\"]) ? schema.setPath(draft, [\"keyEntries\"], normalizedMultiKeyEntries(props.provider, keyEntries)) : draft;\n\t\t\t\tconst next = multiKey ? schema.setPath(normalizedDraft, [\"keyEntries\"], normalizedMultiKeyEntries(props.provider, keyEntries)) : layout === \"pi-ai\" && stringAt(draft, \"apiKeyEnv\") === void 0 && stringAt(fallback, \"apiKeyEnv\") === void 0 && keyValue.length > 0 ? schema.setPath(normalizedDraft, [\"apiKeyEnv\"], keyRef) : normalizedDraft;\n\t\t\t\tif (entryFailure !== void 0) return entryFailure;\n\t\t\t\tif (props.credentialOnly !== true && !multiKey) {\n\t\t\t\t\tconst failure = validateModels(schema.getPath(next, [\"models\"]));\n\t\t\t\t\t/* v8 ignore next 3 -- unreachable from the card: the same failure disables submit */\n\t\t\t\t\tif (failure !== void 0) return `${t(\"model\")} ${String(failure.index + 1)}: ${t(failure.key)}`;\n\t\t\t\t}\n\t\t\t\t/* v8 ignore next -- apply is only reachable from the rendered card, which required a resolved node */\n\t\t\t\tif (props.credentialOnly !== true && node !== void 0 && settingsPath.length === 0) {\n\t\t\t\t\tconst sectionError = schema.validate(node, next);\n\t\t\t\t\tif (sectionError !== void 0) return sectionError;\n\t\t\t\t}\n\t\t\t\tconst materializesNativeProfile = layout === \"pi-ai\" && fallback === void 0 && committedOriginal === void 0 && Object.keys(next).length === 0;\n\t\t\t\tconst ops = props.credentialOnly === true ? [] : materializesNativeProfile ? [{\n\t\t\t\t\top: \"set\",\n\t\t\t\t\tpath: [...settingsPath],\n\t\t\t\t\tvalue: {}\n\t\t\t\t}] : pathOps(settingsPath, committedOriginal, next);\n\t\t\t\tif (ops.length > 0) {\n\t\t\t\t\tconst written = await operations.writeSettings(ns, ops, expectedRevision);\n\t\t\t\t\tif (written.kind !== \"written\") return written.kind === \"conflict\" ? t(\"conflict\") : written.message;\n\t\t\t\t\tsetCommittedOriginal(schema.getPath(written.view.user, settingsPath));\n\t\t\t\t\tsetExpectedRevision(written.view.revision);\n\t\t\t\t\tsetDraft(next);\n\t\t\t\t}\n\t\t\t\tif (multiKey) return storeMultiKeyDrafts(operations, next.keyEntries, entryKeyDrafts, setEntryKeyDrafts);\n\t\t\t\tif (keyValue.length > 0) {\n\t\t\t\t\tconst stored = await operations.storeCredential(keyRef, keyValue);\n\t\t\t\t\tif (stored !== void 0) return stored;\n\t\t\t\t}\n\t\t\t\tsetKeyDraft(\"\");\n\t\t\t};\n\t\t\tconst apply = async () => {\n\t\t\t\tif (saving.current || props.readOnly || listBusy || entryFailure !== void 0) return;\n\t\t\t\tsaving.current = true;\n\t\t\t\tsetBusy(true);\n\t\t\t\tsetFailure(void 0);\n\t\t\t\ttry {\n\t\t\t\t\tconst failure = await applyOnce();\n\t\t\t\t\tif (failure !== void 0) {\n\t\t\t\t\t\tsetFailure(failure);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tprops.onClose(true);\n\t\t\t\t} catch {\n\t\t\t\t\tsetFailure(t(\"multiKeySaveFailed\"));\n\t\t\t\t} finally {\n\t\t\t\t\tsaving.current = false;\n\t\t\t\t\tsetBusy(false);\n\t\t\t\t}\n\t\t\t};\n\t\t\tif (node === void 0) return (0, react_jsx_runtime.jsxs)(\"p\", {\n\t\t\t\tclassName: ModelsSection_module_css_default[\"error\"],\n\t\t\t\tchildren: [\n\t\t\t\t\tprops.provider,\n\t\t\t\t\t\": \",\n\t\t\t\t\tprops.t(\"settingsPathUnresolvable\")\n\t\t\t\t]\n\t\t\t});\n\t\t\t/**\n\t\t\t* The catalog beneath the user layer: what the composition entry pinned, or\n\t\t\t* else the schema default that `resolve` would supply. The effective value\n\t\t\t* cannot answer this — it still carries the stored override until the unset\n\t\t\t* is applied, so reading it would echo that override straight back the\n\t\t\t* moment reset drops it, leaving the rows unchanged until a reload.\n\t\t\t*/\n\t\t\tconst inheritedModels = () => {\n\t\t\t\treturn schema.getPath(namespace.base, [...settingsPath, \"models\"]) ?? schema.nodeAtPath(root, [...settingsPath, \"models\"])?.meta.default;\n\t\t\t};\n\t\t\t/**\n\t\t\t* The curated fields of one known adapter family. The family arrives\n\t\t\t* narrowed so the per-family branches below are total: an unknown namespace\n\t\t\t* renders the hint instead and never reaches this body.\n\t\t\t*/\n\t\t\tconst curatedFields = (family) => {\n\t\t\t\tconst ownsIdentity = family === \"pi-ai\" && props.declared === true;\n\t\t\t\tconst customModels = schema.getPath(draft, [\"models\"]);\n\t\t\t\tconst modelsOverridden = schema.hasPath(draft, [\"models\"]);\n\t\t\t\tconst models = modelDrafts(modelsOverridden ? customModels : inheritedModels());\n\t\t\t\tconst defaultContextWindow = schema.getPath(fallback, [\"defaultContextWindow\"]);\n\t\t\t\tconst defaultMaxTokens = schema.getPath(fallback, [\"maxTokens\"]);\n\t\t\t\tconst defaultInput = schema.getPath(fallback, [\"defaultInput\"]);\n\t\t\t\tconst baseURL = stringAt(fallback, \"baseURL\") ?? props.defaultBaseURL;\n\t\t\t\tconst endpointEnv = props.baseURLEnv ?? [];\n\t\t\t\tconst endpointHint = family === \"deepseek\" ? t(\"deepSeekEndpointHint\") : baseURL === void 0 && endpointEnv.length > 0 ? t(\"baseUrlEnvironment\").replace(\"{env}\", () => endpointEnv.join(\", \")) : void 0;\n\t\t\t\tconst namedRef = stringAt(fallback, \"apiKeyEnv\");\n\t\t\t\tconst nativeAuth = namedRef === void 0 ? props.nativeAuth : void 0;\n\t\t\t\tconst authRefs = namedRef === void 0 ? (nativeAuth?.env ?? []).filter((ref) => !endpointEnv.includes(ref)) : [namedRef];\n\t\t\t\tconst visibleRefs = authRefs.filter((ref) => !ref.toLowerCase().includes(\"oauth\"));\n\t\t\t\tconst keyHint = visibleRefs[0];\n\t\t\t\tconst checkedRefs = authRefs.map((ref) => [ref, props.credentialChecks?.[ref] ?? (ref === namedRef ? props.credential : void 0)]);\n\t\t\t\tconst detected = checkedRefs.find(([, info]) => info?.configured === true);\n\t\t\t\tconst detectedRef = detected?.[0];\n\t\t\t\tconst detectedVisibleRef = detectedRef === void 0 || !visibleRefs.includes(detectedRef) ? void 0 : detectedRef;\n\t\t\t\tconst missingRefs = checkedRefs.length > 0 && checkedRefs.every(([, info]) => info?.configured === false);\n\t\t\t\tconst savedCredential = detected?.[1]?.source === \"file\";\n\t\t\t\tconst credentialHint = keyDraft.length > 0 || savedCredential || keyHint === void 0 || props.credentialRequired === true ? void 0 : t(detectedRef === void 0 ? missingRefs ? \"keyFallbackMissing\" : \"keyFallbackUnchecked\" : detectedVisibleRef === void 0 ? \"keyFallbackDetectedHidden\" : \"keyFallbackDetected\").replace(\"{hint}\", () => detectedVisibleRef ?? keyHint);\n\t\t\t\tconst keyHelp = visibleRefs.length === 0 ? void 0 : t(\"keyHelp\").replace(\"{env}\", () => visibleRefs.join(\" / \"));\n\t\t\t\tconst authHelp = keyHelp === void 0 ? null : (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {\n\t\t\t\t\tlabel: keyHelp,\n\t\t\t\t\tside: \"right\",\n\t\t\t\t\tdelayMs: 0,\n\t\t\t\t\tfocusDelayMs: 0,\n\t\t\t\t\tportal: true,\n\t\t\t\t\topenOnClick: true,\n\t\t\t\t\tchildren: (0, react_jsx_runtime.jsx)(\"button\", {\n\t\t\t\t\t\ttype: \"button\",\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"helpButton\"],\n\t\t\t\t\t\t\"aria-label\": t(\"authHelp\"),\n\t\t\t\t\t\tchildren: \"?\"\n\t\t\t\t\t})\n\t\t\t\t});\n\t\t\t\tconst keylessNativeAuth = nativeAuth?.env.length === 0 && nativeAuth.oauth;\n\t\t\t\tconst keyPlaceholder = keyHint === void 0 || props.credentialRequired === true ? t(\"keyPlaceholder\") : t(savedCredential ? \"keyPlaceholderSaved\" : \"keyPlaceholderFallback\").replace(\"{hint}\", () => keyHint);\n\t\t\t\t/** What both family editors take: the rows, whose layer owns them, and the two writes. */\n\t\t\t\tconst catalogProps = {\n\t\t\t\t\tmodels,\n\t\t\t\t\toverridden: modelsOverridden,\n\t\t\t\t\tt,\n\t\t\t\t\tdisabled,\n\t\t\t\t\tonChange: (next) => {\n\t\t\t\t\t\tsetDraft((current) => schema.setPath(current, [\"models\"], next));\n\t\t\t\t\t},\n\t\t\t\t\tonReset: () => {\n\t\t\t\t\t\tsetDraft((current) => schema.deletePath(current, [\"models\"]));\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tconst credentials = (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [supportsMultiKey ? (0, react_jsx_runtime.jsx)(MultiKeyToggle, {\n\t\t\t\t\tt, checked: multiKey, disabled: disabled || listBusy, hasUnsavedKeys: hasMultiKeyDrafts(entryKeyDrafts),\n\t\t\t\t\tonChange: (enabled) => {\n\t\t\t\t\t\tlet updated = schema.setPath(draft, [\"multiKey\"], enabled);\n\t\t\t\t\t\tif (enabled && Object.keys(keyEntries).length === 0) {\n\t\t\t\t\t\t\tconst namedRef = stringAt(draft, \"apiKeyEnv\") ?? stringAt(fallback, \"apiKeyEnv\");\n\t\t\t\t\t\t\tconst [id, entry] = newMultiKeyEntry(props.provider, {\n\t\t\t\t\t\t\t\tname: stringAt(draft, \"displayName\") ?? stringAt(fallback, \"displayName\") ?? props.displayName ?? props.provider,\n\t\t\t\t\t\t\t\tapiKeyEnv: namedRef,\n\t\t\t\t\t\t\t\tmodels: draft.models ?? fallback?.models ?? inheritedModels()\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (keyDraft.length > 0) {\n\t\t\t\t\t\t\t\tsetEntryKeyDrafts({ [id]: keyDraft });\n\t\t\t\t\t\t\t\tif (namedRef === void 0) updated = schema.setPath(updated, [\"apiKeyEnv\"], multiKeyRef(props.provider, id));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tupdated = schema.setPath(updated, [\"keyEntries\"], { [id]: entry });\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetDraft(updated);\n\t\t\t\t\t}\n\t\t\t\t}) : null, multiKey ? (0, react_jsx_runtime.jsx)(MultiKeyEntriesEditor, {\n\t\t\t\t\troute: props.provider, entries: keyEntries,\n\t\t\t\t\tonChange: (entries) => setDraft((current) => schema.setPath(current, [\"keyEntries\"], entries)),\n\t\t\t\t\tkeyDrafts: entryKeyDrafts, onKeyDraftsChange: setEntryKeyDrafts,\n\t\t\t\t\tconfirmations: entryConfirmations, onConfirmationsChange: setEntryConfirmations,\n\t\t\t\t\tpersistedEntries: schema.getPath(committedOriginal, [\"keyEntries\"]) ?? fallback?.keyEntries ?? {},\n\t\t\t\t\tcredentialChecks: props.credentialChecks,\n\t\t\t\t\tprobe: { settingsNs: namespace.ns, provider: props.provider, ...(probeBaseURL === void 0 ? {} : { baseURL: probeBaseURL }), ...(probeApi === void 0 ? {} : { api: probeApi }) },\n\t\t\t\t\treasoningLevels, operations, t, disabled: disabled || listBusy, onBusyChange: setListBusy\n\t\t\t\t}) : null, multiKey || keylessNativeAuth ? null : (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\tchildren: [\n\t\t\t\t\t\t(0, react_jsx_runtime.jsxs)(\"span\", {\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\tchildren: [t(\"keyInput\"), authHelp]\n\t\t\t\t\t\t}),\n\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(ApiKeyInput, {\n\t\t\t\t\t\t\tt,\n\t\t\t\t\t\t\tvalue: keyDraft,\n\t\t\t\t\t\t\tplaceholder: keyPlaceholder,\n\t\t\t\t\t\t\t\"aria-label\": t(\"keyInput\"),\n\t\t\t\t\t\t\t\"aria-invalid\": shownKeyFailure !== void 0,\n\t\t\t\t\t\t\t\"aria-describedby\": credentialHint === void 0 ? void 0 : `${props.provider}-credential-hint`,\n\t\t\t\t\t\t\trequired: props.credentialRequired === true,\n\t\t\t\t\t\t\tautoFocus: props.autoFocusCredential === true,\n\t\t\t\t\t\t\tdisabled,\n\t\t\t\t\t\t\tonChange: (event) => {\n\t\t\t\t\t\t\t\tsetKeyDraft(event.target.value);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tcredentialHint === void 0 ? null : (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\t\tid: `${props.provider}-credential-hint`,\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[missingRefs ? \"notice\" : detectedRef === void 0 ? \"advancedHint\" : \"savedNotice\"],\n\t\t\t\t\t\t\tchildren: credentialHint\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tshownKeyFailure === void 0 ? null : (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"error\"],\n\t\t\t\t\t\t\tchildren: t(shownKeyFailure)\n\t\t\t\t\t\t})\n\t\t\t\t\t]\n\t\t\t\t})] });\n\t\t\t\tconst customization = props.credentialOnly === true ? null : (0, react_jsx_runtime.jsxs)(\"details\", {\n\t\t\t\t\tclassName: ModelsSection_module_css_default[\"customized\"],\n\t\t\t\t\topen: supportsMultiKey ? true : void 0,\n\t\t\t\t\t\"data-multi-key-shared-settings\": supportsMultiKey ? true : void 0,\n\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"summary\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"customizedSummary\"],\n\t\t\t\t\t\tchildren: t(supportsMultiKey ? \"multiKeySharedSettings\" : \"customized\")\n\t\t\t\t\t}), (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"customizedBody\"],\n\t\t\t\t\t\tchildren: [\n\t\t\t\t\t\t\townsIdentity ? (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\t\t\tchildren: t(\"customDisplayName\")\n\t\t\t\t\t\t\t\t}), (0, react_jsx_runtime.jsx)(\"input\", {\n\t\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"input\"],\n\t\t\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\t\t\tvalue: stringAt(draft, \"displayName\") ?? \"\",\n\t\t\t\t\t\t\t\t\tplaceholder: stringAt(schema.getPath(namespace.base, settingsPath), \"displayName\") ?? props.provider,\n\t\t\t\t\t\t\t\t\t\"aria-label\": t(\"customDisplayName\"),\n\t\t\t\t\t\t\t\t\tdisabled,\n\t\t\t\t\t\t\t\t\tonChange: (event) => {\n\t\t\t\t\t\t\t\t\t\tsetField(\"displayName\", event.target.value);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t})]\n\t\t\t\t\t\t\t}) : null,\n\t\t\t\t\t\t\t(0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\t\t\tchildren: [\n\t\t\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\t\t\t\tchildren: t(\"baseUrl\")\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(\"input\", {\n\t\t\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"input\"],\n\t\t\t\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\t\t\t\tvalue: stringAt(draft, \"baseURL\") ?? \"\",\n\t\t\t\t\t\t\t\t\t\tplaceholder: family === \"deepseek\" ? t(\"deepSeekBaseUrl\") : baseURL === void 0 ? t(endpointEnv.length > 0 ? \"baseUrlConfigured\" : \"baseUrlDefault\") : t(\"baseUrlPlaceholder\").replace(\"{url}\", () => baseURL),\n\t\t\t\t\t\t\t\t\t\t\"aria-describedby\": endpointHint === void 0 ? void 0 : `${props.provider}-endpoint-hint`,\n\t\t\t\t\t\t\t\t\t\t\"aria-label\": t(\"baseUrl\"),\n\t\t\t\t\t\t\t\t\t\tdisabled,\n\t\t\t\t\t\t\t\t\t\tonChange: (event) => {\n\t\t\t\t\t\t\t\t\t\t\tsetField(\"baseURL\", event.target.value === \"\" ? void 0 : event.target.value);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\tendpointHint === void 0 ? null : (0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\t\t\t\tid: `${props.provider}-endpoint-hint`,\n\t\t\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"advancedHint\"],\n\t\t\t\t\t\t\t\t\t\tchildren: endpointHint\n\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\townsIdentity ? (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\t\t\tchildren: t(\"customApi\")\n\t\t\t\t\t\t\t\t}), (0, react_jsx_runtime.jsxs)(\"select\", {\n\t\t\t\t\t\t\t\t\tclassName: `${ModelsSection_module_css_default[\"input\"]} ${ModelsSection_module_css_default[\"selectInput\"]}`,\n\t\t\t\t\t\t\t\t\tvalue: probeApi ?? \"\",\n\t\t\t\t\t\t\t\t\t\"aria-label\": t(\"customApi\"),\n\t\t\t\t\t\t\t\t\tdisabled,\n\t\t\t\t\t\t\t\t\tonChange: (event) => {\n\t\t\t\t\t\t\t\t\t\tsetField(\"api\", event.target.value);\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tchildren: [probeApi === void 0 ? (0, react_jsx_runtime.jsx)(\"option\", {\n\t\t\t\t\t\t\t\t\t\tvalue: \"\",\n\t\t\t\t\t\t\t\t\t\tchildren: t(\"customApiUnset\")\n\t\t\t\t\t\t\t\t\t}) : null, protocols.map((choice) => (0, react_jsx_runtime.jsx)(\"option\", {\n\t\t\t\t\t\t\t\t\t\tvalue: choice,\n\t\t\t\t\t\t\t\t\t\tchildren: protocolLabel(t, choice)\n\t\t\t\t\t\t\t\t\t}, choice))]\n\t\t\t\t\t\t\t\t})]\n\t\t\t\t\t\t\t}) : null,\n\t\t\t\t\t\t\tmultiKey ? null : family === \"deepseek\" ? (0, react_jsx_runtime.jsx)(DeepSeekModelsEditor, {\n\t\t\t\t\t\t\t\t...catalogProps,\n\t\t\t\t\t\t\t\tdefaultContextWindow: typeof defaultContextWindow === \"number\" ? defaultContextWindow : void 0,\n\t\t\t\t\t\t\t\tdefaultMaxTokens: typeof defaultMaxTokens === \"number\" ? defaultMaxTokens : void 0\n\t\t\t\t\t\t\t}) : (0, react_jsx_runtime.jsx)(ModelListEditor, {\n\t\t\t\t\t\t\t\t...catalogProps,\n\t\t\t\t\t\t\t\tcatalogProvider: props.declared === true ? void 0 : props.provider,\n\t\t\t\t\t\t\t\treasoningLevels,\n\t\t\t\t\t\t\t\tdefaultInput: Array.isArray(defaultInput) ? defaultInput : void 0,\n\t\t\t\t\t\t\t\tprobe,\n\t\t\t\t\t\t\t\tprobeBlocked: keyFailure,\n\t\t\t\t\t\t\t\toperations,\n\t\t\t\t\t\t\t\tonBusyChange: setListBusy\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t]\n\t\t\t\t\t})]\n\t\t\t\t});\n\t\t\t\treturn (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: supportsMultiKey ? [customization, credentials] : [credentials, customization] });\n\t\t\t};\n\t\t\treturn (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\tclassName: props.credentialOnly === true ? ModelsSection_module_css_default[\"addBlock\"] : ModelsSection_module_css_default[\"editor\"],\n\t\t\t\tchildren: [\n\t\t\t\t\tprops.hideTitle === true ? null : (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"editorHeader\"],\n\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"editorTitle\"],\n\t\t\t\t\t\t\tchildren: props.displayName\n\t\t\t\t\t\t}), props.provider !== props.displayName ? (0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"editorRoute\"],\n\t\t\t\t\t\t\tchildren: props.provider\n\t\t\t\t\t\t}) : null]\n\t\t\t\t\t}),\n\t\t\t\t\tlayout === \"unknown\" ? (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"advancedHint\"],\n\t\t\t\t\t\tchildren: `${t(\"advancedHint\")} (${namespace.ns})`\n\t\t\t\t\t}) : curatedFields(layout),\n\t\t\t\t\t(failure ?? entryFailure) !== void 0 ? (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"error\"],\n\t\t\t\t\t\tchildren: failure ?? entryFailure\n\t\t\t\t\t}) : null,\n\t\t\t\t\tprops.credentialOnly === true || modelFailure === void 0 ? null : (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"advancedHint\"],\n\t\t\t\t\t\tchildren: `${t(\"model\")} ${String(modelFailure.index + 1)}: ${t(modelFailure.key)}`\n\t\t\t\t\t}),\n\t\t\t\t\t(0, react_jsx_runtime.jsx)(EditorFooter, {\n\t\t\t\t\t\tt,\n\t\t\t\t\t\tbusy,\n\t\t\t\t\t\tsubmitDisabled: disabled || listBusy || layout === \"unknown\" || entryFailure !== void 0 || props.credentialOnly !== true && modelFailure !== void 0 || !multiKey && (shownKeyFailure !== void 0 || props.credentialRequired === true && keyValue.length === 0),\n\t\t\t\t\t\tsubmitLabelKey: props.submitLabelKey ?? \"apply\",\n\t\t\t\t\t\tsubmitBusyLabelKey: props.submitBusyLabelKey ?? \"applying\",\n\t\t\t\t\t\t...props.cancelLabelKey === void 0 ? {} : { cancelLabelKey: props.cancelLabelKey },\n\t\t\t\t\t\tonCancel: () => {\n\t\t\t\t\t\t\tprops.onClose(false);\n\t\t\t\t\t\t},\n\t\t\t\t\t\tonSubmit: () => {\n\t\t\t\t\t\t\tprops.onSubmitCredential?.();\n\t\t\t\t\t\t\tapply();\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t]\n\t\t\t});\n\t\t}",
|
|
393
|
+
"after": "function ProviderEditor(props) {\n\t\t\tconst { namespace, schema, settingsPath, operations, t } = props;\n\t\t\tconst [draft, setDraft] = (0, react.useState)(() => draftAt(schema, namespace, settingsPath));\n\t\t\tconst [entryKeyDrafts, setEntryKeyDrafts] = (0, react.useState)({});\n\t\t\tconst [entryConfirmations, setEntryConfirmations] = (0, react.useState)({});\n\t\t\tconst [entrySaveState, setEntrySaveState] = (0, react.useState)(void 0);\n\t\t\tconst saving = (0, react.useRef)(false);\n\t\t\tconst [keyDraft, setKeyDraft] = (0, react.useState)(\"\");\n\t\t\tconst [busy, setBusy] = (0, react.useState)(false);\n\t\t\tconst [listBusy, setListBusy] = (0, react.useState)(false);\n\t\t\tconst { onBusyChange } = props;\n\t\t\t(0, react.useEffect)(() => {\n\t\t\t\tonBusyChange?.(busy || listBusy);\n\t\t\t}, [\n\t\t\t\tbusy,\n\t\t\t\tlistBusy,\n\t\t\t\tonBusyChange\n\t\t\t]);\n\t\t\tconst [failure, setFailure] = (0, react.useState)(void 0);\n\t\t\tconst [committedOriginal, setCommittedOriginal] = (0, react.useState)(() => schema.getPath(namespace.user, settingsPath));\n\t\t\tconst [expectedRevision, setExpectedRevision] = (0, react.useState)(() => namespace.revision);\n\t\t\tconst root = (0, react.useMemo)(() => schema.rehydrate(namespace.schema), [namespace.schema, schema]);\n\t\t\tconst node = (0, react.useMemo)(() => schema.nodeAtPath(root, settingsPath), [\n\t\t\t\troot,\n\t\t\t\tschema,\n\t\t\t\tsettingsPath\n\t\t\t]);\n\t\t\tconst fallback = schema.getPath(namespace.value, settingsPath);\n\t\t\tconst disabled = props.readOnly || busy;\n\t\t\tconst layout = layoutOf(namespace.ns);\n\t\t\tconst keyRef = refFor(schema, namespace, settingsPath, props.provider);\n\t\t\tconst supportsMultiKey = layout === \"pi-ai\" && props.declared === true && props.credentialOnly !== true && supportsMultiKeySchema(namespace, schema, settingsPath);\n\t\t\tconst multiKey = supportsMultiKey && (draft.multiKey ?? fallback?.multiKey) === true;\n\t\t\tconst keyEntries = draft.keyEntries ?? fallback?.keyEntries ?? {};\n\t\t\tconst entryFailure = multiKey ? multiKeyFailure(props.provider, keyEntries, entryKeyDrafts, entryConfirmations, t) : void 0;\n\t\t\tconst protocols = (0, react.useMemo)(() => layout === \"pi-ai\" ? protocolChoices(namespace, schema) : [], [\n\t\t\t\tlayout,\n\t\t\t\tnamespace,\n\t\t\t\tschema\n\t\t\t]);\n\t\t\tconst stringAt = (source, key) => {\n\t\t\t\tconst value = schema.getPath(source, [key]);\n\t\t\t\treturn typeof value === \"string\" && value.trim().length > 0 ? value : void 0;\n\t\t\t};\n\t\t\tconst setField = (key, next) => {\n\t\t\t\tconst value = next === void 0 || next.trim().length === 0 ? void 0 : next;\n\t\t\t\tsetDraft((current) => value === void 0 ? schema.deletePath(current, [key]) : schema.setPath(current, [key], value));\n\t\t\t};\n\t\t\tconst reasoningLevels = (0, react.useMemo)(() => layout === \"pi-ai\" && props.declared === true ? reasoningLevelChoices(namespace, schema) : [], [\n\t\t\t\tlayout,\n\t\t\t\tprops.declared,\n\t\t\t\tnamespace,\n\t\t\t\tschema\n\t\t\t]);\n\t\t\tconst editsReasoning = reasoningLevels.length > 0;\n\t\t\tconst validateModels = (value) => validateDeepSeekModels(value) ?? (editsReasoning ? validateReasoningEfforts(value) : void 0);\n\t\t\tconst modelFailure = multiKey ? void 0 : validateModels(schema.getPath(draft, [\"models\"]));\n\t\t\tconst keyFailure = multiKey ? void 0 : apiKeyFailure(keyDraft);\n\t\t\tconst keyValue = keyDraft.trim();\n\t\t\tconst shownKeyFailure = (props.credentialRequired === true && keyDraft.length > 0 && keyValue.length === 0 ? \"keyRequired\" : void 0) ?? keyFailure;\n\t\t\tconst probeApi = stringAt(draft, \"api\") ?? stringAt(fallback, \"api\");\n\t\t\tconst probeBaseURL = stringAt(draft, \"baseURL\") ?? stringAt(fallback, \"baseURL\");\n\t\t\tconst probe = {\n\t\t\t\tsettingsNs: namespace.ns,\n\t\t\t\tprovider: props.provider,\n\t\t\t\t...probeBaseURL === void 0 ? {} : { baseURL: probeBaseURL },\n\t\t\t\t...probeApi === void 0 ? {} : { api: probeApi },\n\t\t\t\t...keyValue.length === 0 ? {} : { apiKey: keyValue }\n\t\t\t};\n\t\t\t/**\n\t\t\t* The write for this card, or a failure message. Every edit travels as\n\t\t\t* path ops against the STORED section: the draft comes from the redacted\n\t\t\t* descriptor, so a wholesale replace rebuilt from it could delete fields\n\t\t\t* outside the card. Ops name only the fields this card can see.\n\t\t\t*/\n\t\t\tconst applyOnce = async () => {\n\t\t\t\tconst ns = namespace.ns;\n\t\t\t\tconst normalizedDraft = supportsMultiKey && schema.hasPath(draft, [\"keyEntries\"]) ? schema.setPath(draft, [\"keyEntries\"], normalizedMultiKeyEntries(props.provider, keyEntries)) : draft;\n\t\t\t\tconst next = multiKey ? schema.setPath(normalizedDraft, [\"keyEntries\"], normalizedMultiKeyEntries(props.provider, keyEntries)) : layout === \"pi-ai\" && stringAt(draft, \"apiKeyEnv\") === void 0 && stringAt(fallback, \"apiKeyEnv\") === void 0 && keyValue.length > 0 ? schema.setPath(normalizedDraft, [\"apiKeyEnv\"], keyRef) : normalizedDraft;\n\t\t\t\tif (entryFailure !== void 0) return entryFailure;\n\t\t\t\tif (props.credentialOnly !== true && !multiKey) {\n\t\t\t\t\tconst failure = validateModels(schema.getPath(next, [\"models\"]));\n\t\t\t\t\t/* v8 ignore next 3 -- unreachable from the card: the same failure disables submit */\n\t\t\t\t\tif (failure !== void 0) return `${t(\"model\")} ${String(failure.index + 1)}: ${t(failure.key)}`;\n\t\t\t\t}\n\t\t\t\t/* v8 ignore next -- apply is only reachable from the rendered card, which required a resolved node */\n\t\t\t\tif (props.credentialOnly !== true && node !== void 0 && settingsPath.length === 0) {\n\t\t\t\t\tconst sectionError = schema.validate(node, next);\n\t\t\t\t\tif (sectionError !== void 0) return sectionError;\n\t\t\t\t}\n\t\t\t\tconst materializesNativeProfile = layout === \"pi-ai\" && fallback === void 0 && committedOriginal === void 0 && Object.keys(next).length === 0;\n\t\t\t\tconst ops = props.credentialOnly === true ? [] : materializesNativeProfile ? [{\n\t\t\t\t\top: \"set\",\n\t\t\t\t\tpath: [...settingsPath],\n\t\t\t\t\tvalue: {}\n\t\t\t\t}] : pathOps(settingsPath, committedOriginal, next);\n\t\t\t\tif (ops.length > 0) {\n\t\t\t\t\tconst written = await operations.writeSettings(ns, ops, expectedRevision);\n\t\t\t\t\tif (written.kind !== \"written\") return written.kind === \"conflict\" ? t(\"conflict\") : written.message;\n\t\t\t\t\tsetCommittedOriginal(schema.getPath(written.view.user, settingsPath));\n\t\t\t\t\tsetExpectedRevision(written.view.revision);\n\t\t\t\t\tsetDraft(next);\n\t\t\t\t}\n\t\t\t\tif (multiKey) return storeMultiKeyDrafts(operations, next.keyEntries, entryKeyDrafts, setEntryKeyDrafts);\n\t\t\t\tif (keyValue.length > 0) {\n\t\t\t\t\tconst stored = await operations.storeCredential(keyRef, keyValue);\n\t\t\t\t\tif (stored !== void 0) return stored;\n\t\t\t\t}\n\t\t\t\tsetKeyDraft(\"\");\n\t\t\t};\n\t\t\tconst apply = async () => {\n\t\t\t\tif (saving.current || props.readOnly || listBusy || entryFailure !== void 0) return;\n\t\t\t\tsaving.current = true;\n\t\t\t\tsetBusy(true);\n\t\t\t\tsetFailure(void 0);\n\t\t\t\ttry {\n\t\t\t\t\tconst failure = await applyOnce();\n\t\t\t\t\tif (multiKey) setEntrySaveState({ ok: failure === void 0, entries: structuredClone(failure === void 0 ? normalizedMultiKeyEntries(props.provider, keyEntries) : keyEntries) });\n\t\t\t\t\tif (failure !== void 0) {\n\t\t\t\t\t\tsetFailure(failure);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tif (!multiKey) props.onClose(true);\n\t\t\t\t} catch {\n\t\t\t\t\tif (multiKey) setEntrySaveState({ ok: false, entries: structuredClone(keyEntries) });\n\t\t\t\t\tsetFailure(t(\"multiKeySaveFailed\"));\n\t\t\t\t} finally {\n\t\t\t\t\tsaving.current = false;\n\t\t\t\t\tsetBusy(false);\n\t\t\t\t}\n\t\t\t};\n\t\t\tif (node === void 0) return (0, react_jsx_runtime.jsxs)(\"p\", {\n\t\t\t\tclassName: ModelsSection_module_css_default[\"error\"],\n\t\t\t\tchildren: [\n\t\t\t\t\tprops.provider,\n\t\t\t\t\t\": \",\n\t\t\t\t\tprops.t(\"settingsPathUnresolvable\")\n\t\t\t\t]\n\t\t\t});\n\t\t\t/**\n\t\t\t* The catalog beneath the user layer: what the composition entry pinned, or\n\t\t\t* else the schema default that `resolve` would supply. The effective value\n\t\t\t* cannot answer this — it still carries the stored override until the unset\n\t\t\t* is applied, so reading it would echo that override straight back the\n\t\t\t* moment reset drops it, leaving the rows unchanged until a reload.\n\t\t\t*/\n\t\t\tconst inheritedModels = () => {\n\t\t\t\treturn schema.getPath(namespace.base, [...settingsPath, \"models\"]) ?? schema.nodeAtPath(root, [...settingsPath, \"models\"])?.meta.default;\n\t\t\t};\n\t\t\t/**\n\t\t\t* The curated fields of one known adapter family. The family arrives\n\t\t\t* narrowed so the per-family branches below are total: an unknown namespace\n\t\t\t* renders the hint instead and never reaches this body.\n\t\t\t*/\n\t\t\tconst curatedFields = (family) => {\n\t\t\t\tconst ownsIdentity = family === \"pi-ai\" && props.declared === true;\n\t\t\t\tconst customModels = schema.getPath(draft, [\"models\"]);\n\t\t\t\tconst modelsOverridden = schema.hasPath(draft, [\"models\"]);\n\t\t\t\tconst models = modelDrafts(modelsOverridden ? customModels : inheritedModels());\n\t\t\t\tconst defaultContextWindow = schema.getPath(fallback, [\"defaultContextWindow\"]);\n\t\t\t\tconst defaultMaxTokens = schema.getPath(fallback, [\"maxTokens\"]);\n\t\t\t\tconst defaultInput = schema.getPath(fallback, [\"defaultInput\"]);\n\t\t\t\tconst baseURL = stringAt(fallback, \"baseURL\") ?? props.defaultBaseURL;\n\t\t\t\tconst endpointEnv = props.baseURLEnv ?? [];\n\t\t\t\tconst endpointHint = family === \"deepseek\" ? t(\"deepSeekEndpointHint\") : baseURL === void 0 && endpointEnv.length > 0 ? t(\"baseUrlEnvironment\").replace(\"{env}\", () => endpointEnv.join(\", \")) : void 0;\n\t\t\t\tconst namedRef = stringAt(fallback, \"apiKeyEnv\");\n\t\t\t\tconst nativeAuth = namedRef === void 0 ? props.nativeAuth : void 0;\n\t\t\t\tconst authRefs = namedRef === void 0 ? (nativeAuth?.env ?? []).filter((ref) => !endpointEnv.includes(ref)) : [namedRef];\n\t\t\t\tconst visibleRefs = authRefs.filter((ref) => !ref.toLowerCase().includes(\"oauth\"));\n\t\t\t\tconst keyHint = visibleRefs[0];\n\t\t\t\tconst checkedRefs = authRefs.map((ref) => [ref, props.credentialChecks?.[ref] ?? (ref === namedRef ? props.credential : void 0)]);\n\t\t\t\tconst detected = checkedRefs.find(([, info]) => info?.configured === true);\n\t\t\t\tconst detectedRef = detected?.[0];\n\t\t\t\tconst detectedVisibleRef = detectedRef === void 0 || !visibleRefs.includes(detectedRef) ? void 0 : detectedRef;\n\t\t\t\tconst missingRefs = checkedRefs.length > 0 && checkedRefs.every(([, info]) => info?.configured === false);\n\t\t\t\tconst savedCredential = detected?.[1]?.source === \"file\";\n\t\t\t\tconst credentialHint = keyDraft.length > 0 || savedCredential || keyHint === void 0 || props.credentialRequired === true ? void 0 : t(detectedRef === void 0 ? missingRefs ? \"keyFallbackMissing\" : \"keyFallbackUnchecked\" : detectedVisibleRef === void 0 ? \"keyFallbackDetectedHidden\" : \"keyFallbackDetected\").replace(\"{hint}\", () => detectedVisibleRef ?? keyHint);\n\t\t\t\tconst keyHelp = visibleRefs.length === 0 ? void 0 : t(\"keyHelp\").replace(\"{env}\", () => visibleRefs.join(\" / \"));\n\t\t\t\tconst authHelp = keyHelp === void 0 ? null : (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {\n\t\t\t\t\tlabel: keyHelp,\n\t\t\t\t\tside: \"right\",\n\t\t\t\t\tdelayMs: 0,\n\t\t\t\t\tfocusDelayMs: 0,\n\t\t\t\t\tportal: true,\n\t\t\t\t\topenOnClick: true,\n\t\t\t\t\tchildren: (0, react_jsx_runtime.jsx)(\"button\", {\n\t\t\t\t\t\ttype: \"button\",\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"helpButton\"],\n\t\t\t\t\t\t\"aria-label\": t(\"authHelp\"),\n\t\t\t\t\t\tchildren: \"?\"\n\t\t\t\t\t})\n\t\t\t\t});\n\t\t\t\tconst keylessNativeAuth = nativeAuth?.env.length === 0 && nativeAuth.oauth;\n\t\t\t\tconst keyPlaceholder = keyHint === void 0 || props.credentialRequired === true ? t(\"keyPlaceholder\") : t(savedCredential ? \"keyPlaceholderSaved\" : \"keyPlaceholderFallback\").replace(\"{hint}\", () => keyHint);\n\t\t\t\t/** What both family editors take: the rows, whose layer owns them, and the two writes. */\n\t\t\t\tconst catalogProps = {\n\t\t\t\t\tmodels,\n\t\t\t\t\toverridden: modelsOverridden,\n\t\t\t\t\tt,\n\t\t\t\t\tdisabled,\n\t\t\t\t\tonChange: (next) => {\n\t\t\t\t\t\tsetDraft((current) => schema.setPath(current, [\"models\"], next));\n\t\t\t\t\t},\n\t\t\t\t\tonReset: () => {\n\t\t\t\t\t\tsetDraft((current) => schema.deletePath(current, [\"models\"]));\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tconst credentials = (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [supportsMultiKey ? (0, react_jsx_runtime.jsx)(MultiKeyToggle, {\n\t\t\t\t\tt, checked: multiKey, disabled: disabled || listBusy, hasUnsavedKeys: hasMultiKeyDrafts(entryKeyDrafts),\n\t\t\t\t\tonChange: (enabled) => {\n\t\t\t\t\t\tlet updated = schema.setPath(draft, [\"multiKey\"], enabled);\n\t\t\t\t\t\tif (enabled && Object.keys(keyEntries).length === 0) {\n\t\t\t\t\t\t\tconst namedRef = stringAt(draft, \"apiKeyEnv\") ?? stringAt(fallback, \"apiKeyEnv\");\n\t\t\t\t\t\t\tconst [id, entry] = newMultiKeyEntry(props.provider, {\n\t\t\t\t\t\t\t\tname: stringAt(draft, \"displayName\") ?? stringAt(fallback, \"displayName\") ?? props.displayName ?? props.provider,\n\t\t\t\t\t\t\t\tapiKeyEnv: namedRef,\n\t\t\t\t\t\t\t\tmodels: draft.models ?? fallback?.models ?? inheritedModels()\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (keyDraft.length > 0) {\n\t\t\t\t\t\t\t\tsetEntryKeyDrafts({ [id]: keyDraft });\n\t\t\t\t\t\t\t\tif (namedRef === void 0) updated = schema.setPath(updated, [\"apiKeyEnv\"], multiKeyRef(props.provider, id));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tupdated = schema.setPath(updated, [\"keyEntries\"], { [id]: entry });\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetDraft(updated);\n\t\t\t\t\t}\n\t\t\t\t}) : null, multiKey ? (0, react_jsx_runtime.jsx)(MultiKeyEntriesEditor, {\n\t\t\t\t\troute: props.provider, entries: keyEntries, saveState: entrySaveState, savedEntries: entrySaveState?.ok ? entrySaveState.entries : void 0,\n\t\t\t\t\tonChange: (entries) => setDraft((current) => schema.setPath(current, [\"keyEntries\"], entries)),\n\t\t\t\t\tkeyDrafts: entryKeyDrafts, onKeyDraftsChange: setEntryKeyDrafts,\n\t\t\t\t\tconfirmations: entryConfirmations, onConfirmationsChange: setEntryConfirmations,\n\t\t\t\t\tpersistedEntries: schema.getPath(committedOriginal, [\"keyEntries\"]) ?? fallback?.keyEntries ?? {},\n\t\t\t\t\tcredentialChecks: props.credentialChecks,\n\t\t\t\t\tprobe: { settingsNs: namespace.ns, provider: props.provider, ...(probeBaseURL === void 0 ? {} : { baseURL: probeBaseURL }), ...(probeApi === void 0 ? {} : { api: probeApi }) },\n\t\t\t\t\treasoningLevels, operations, t, disabled: disabled || listBusy, onBusyChange: setListBusy\n\t\t\t\t}) : null, multiKey || keylessNativeAuth ? null : (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\tchildren: [\n\t\t\t\t\t\t(0, react_jsx_runtime.jsxs)(\"span\", {\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\tchildren: [t(\"keyInput\"), authHelp]\n\t\t\t\t\t\t}),\n\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(ApiKeyInput, {\n\t\t\t\t\t\t\tt,\n\t\t\t\t\t\t\tvalue: keyDraft,\n\t\t\t\t\t\t\tplaceholder: keyPlaceholder,\n\t\t\t\t\t\t\t\"aria-label\": t(\"keyInput\"),\n\t\t\t\t\t\t\t\"aria-invalid\": shownKeyFailure !== void 0,\n\t\t\t\t\t\t\t\"aria-describedby\": credentialHint === void 0 ? void 0 : `${props.provider}-credential-hint`,\n\t\t\t\t\t\t\trequired: props.credentialRequired === true,\n\t\t\t\t\t\t\tautoFocus: props.autoFocusCredential === true,\n\t\t\t\t\t\t\tdisabled,\n\t\t\t\t\t\t\tonChange: (event) => {\n\t\t\t\t\t\t\t\tsetKeyDraft(event.target.value);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tcredentialHint === void 0 ? null : (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\t\tid: `${props.provider}-credential-hint`,\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[missingRefs ? \"notice\" : detectedRef === void 0 ? \"advancedHint\" : \"savedNotice\"],\n\t\t\t\t\t\t\tchildren: credentialHint\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tshownKeyFailure === void 0 ? null : (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"error\"],\n\t\t\t\t\t\t\tchildren: t(shownKeyFailure)\n\t\t\t\t\t\t})\n\t\t\t\t\t]\n\t\t\t\t})] });\n\t\t\t\tconst customization = props.credentialOnly === true ? null : (0, react_jsx_runtime.jsxs)(\"details\", {\n\t\t\t\t\tclassName: ModelsSection_module_css_default[\"customized\"],\n\t\t\t\t\topen: supportsMultiKey ? true : void 0,\n\t\t\t\t\t\"data-multi-key-shared-settings\": supportsMultiKey ? true : void 0,\n\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"summary\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"customizedSummary\"],\n\t\t\t\t\t\tchildren: t(supportsMultiKey ? \"multiKeySharedSettings\" : \"customized\")\n\t\t\t\t\t}), (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"customizedBody\"],\n\t\t\t\t\t\tchildren: [\n\t\t\t\t\t\t\townsIdentity ? (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\t\t\tchildren: t(\"customDisplayName\")\n\t\t\t\t\t\t\t\t}), (0, react_jsx_runtime.jsx)(\"input\", {\n\t\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"input\"],\n\t\t\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\t\t\tvalue: stringAt(draft, \"displayName\") ?? \"\",\n\t\t\t\t\t\t\t\t\tplaceholder: stringAt(schema.getPath(namespace.base, settingsPath), \"displayName\") ?? props.provider,\n\t\t\t\t\t\t\t\t\t\"aria-label\": t(\"customDisplayName\"),\n\t\t\t\t\t\t\t\t\tdisabled,\n\t\t\t\t\t\t\t\t\tonChange: (event) => {\n\t\t\t\t\t\t\t\t\t\tsetField(\"displayName\", event.target.value);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t})]\n\t\t\t\t\t\t\t}) : null,\n\t\t\t\t\t\t\t(0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\t\t\tchildren: [\n\t\t\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\t\t\t\tchildren: t(\"baseUrl\")\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(\"input\", {\n\t\t\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"input\"],\n\t\t\t\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\t\t\t\tvalue: stringAt(draft, \"baseURL\") ?? \"\",\n\t\t\t\t\t\t\t\t\t\tplaceholder: family === \"deepseek\" ? t(\"deepSeekBaseUrl\") : baseURL === void 0 ? t(endpointEnv.length > 0 ? \"baseUrlConfigured\" : \"baseUrlDefault\") : t(\"baseUrlPlaceholder\").replace(\"{url}\", () => baseURL),\n\t\t\t\t\t\t\t\t\t\t\"aria-describedby\": endpointHint === void 0 ? void 0 : `${props.provider}-endpoint-hint`,\n\t\t\t\t\t\t\t\t\t\t\"aria-label\": t(\"baseUrl\"),\n\t\t\t\t\t\t\t\t\t\tdisabled,\n\t\t\t\t\t\t\t\t\t\tonChange: (event) => {\n\t\t\t\t\t\t\t\t\t\t\tsetField(\"baseURL\", event.target.value === \"\" ? void 0 : event.target.value);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\tendpointHint === void 0 ? null : (0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\t\t\t\tid: `${props.provider}-endpoint-hint`,\n\t\t\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"advancedHint\"],\n\t\t\t\t\t\t\t\t\t\tchildren: endpointHint\n\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\townsIdentity ? (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\t\t\tchildren: t(\"customApi\")\n\t\t\t\t\t\t\t\t}), (0, react_jsx_runtime.jsxs)(\"select\", {\n\t\t\t\t\t\t\t\t\tclassName: `${ModelsSection_module_css_default[\"input\"]} ${ModelsSection_module_css_default[\"selectInput\"]}`,\n\t\t\t\t\t\t\t\t\tvalue: probeApi ?? \"\",\n\t\t\t\t\t\t\t\t\t\"aria-label\": t(\"customApi\"),\n\t\t\t\t\t\t\t\t\tdisabled,\n\t\t\t\t\t\t\t\t\tonChange: (event) => {\n\t\t\t\t\t\t\t\t\t\tsetField(\"api\", event.target.value);\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tchildren: [probeApi === void 0 ? (0, react_jsx_runtime.jsx)(\"option\", {\n\t\t\t\t\t\t\t\t\t\tvalue: \"\",\n\t\t\t\t\t\t\t\t\t\tchildren: t(\"customApiUnset\")\n\t\t\t\t\t\t\t\t\t}) : null, protocols.map((choice) => (0, react_jsx_runtime.jsx)(\"option\", {\n\t\t\t\t\t\t\t\t\t\tvalue: choice,\n\t\t\t\t\t\t\t\t\t\tchildren: protocolLabel(t, choice)\n\t\t\t\t\t\t\t\t\t}, choice))]\n\t\t\t\t\t\t\t\t})]\n\t\t\t\t\t\t\t}) : null,\n\t\t\t\t\t\t\tmultiKey ? null : family === \"deepseek\" ? (0, react_jsx_runtime.jsx)(DeepSeekModelsEditor, {\n\t\t\t\t\t\t\t\t...catalogProps,\n\t\t\t\t\t\t\t\tdefaultContextWindow: typeof defaultContextWindow === \"number\" ? defaultContextWindow : void 0,\n\t\t\t\t\t\t\t\tdefaultMaxTokens: typeof defaultMaxTokens === \"number\" ? defaultMaxTokens : void 0\n\t\t\t\t\t\t\t}) : (0, react_jsx_runtime.jsx)(ModelListEditor, {\n\t\t\t\t\t\t\t\t...catalogProps,\n\t\t\t\t\t\t\t\tcatalogProvider: props.declared === true ? void 0 : props.provider,\n\t\t\t\t\t\t\t\treasoningLevels,\n\t\t\t\t\t\t\t\tdefaultInput: Array.isArray(defaultInput) ? defaultInput : void 0,\n\t\t\t\t\t\t\t\tprobe,\n\t\t\t\t\t\t\t\tprobeBlocked: keyFailure,\n\t\t\t\t\t\t\t\toperations,\n\t\t\t\t\t\t\t\tonBusyChange: setListBusy\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t]\n\t\t\t\t\t})]\n\t\t\t\t});\n\t\t\t\treturn (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: supportsMultiKey ? [customization, credentials] : [credentials, customization] });\n\t\t\t};\n\t\t\treturn (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\tclassName: props.credentialOnly === true ? ModelsSection_module_css_default[\"addBlock\"] : ModelsSection_module_css_default[\"editor\"],\n\t\t\t\tchildren: [\n\t\t\t\t\tprops.hideTitle === true ? null : (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"editorHeader\"],\n\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"editorTitle\"],\n\t\t\t\t\t\t\tchildren: props.displayName\n\t\t\t\t\t\t}), props.provider !== props.displayName ? (0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"editorRoute\"],\n\t\t\t\t\t\t\tchildren: props.provider\n\t\t\t\t\t\t}) : null]\n\t\t\t\t\t}),\n\t\t\t\t\tlayout === \"unknown\" ? (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"advancedHint\"],\n\t\t\t\t\t\tchildren: `${t(\"advancedHint\")} (${namespace.ns})`\n\t\t\t\t\t}) : curatedFields(layout),\n\t\t\t\t\t(failure ?? entryFailure) !== void 0 ? (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"error\"],\n\t\t\t\t\t\tchildren: failure ?? entryFailure\n\t\t\t\t\t}) : null,\n\t\t\t\t\tprops.credentialOnly === true || modelFailure === void 0 ? null : (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"advancedHint\"],\n\t\t\t\t\t\tchildren: `${t(\"model\")} ${String(modelFailure.index + 1)}: ${t(modelFailure.key)}`\n\t\t\t\t\t}),\n\t\t\t\t\t(0, react_jsx_runtime.jsx)(EditorFooter, {\n\t\t\t\t\t\tt,\n\t\t\t\t\t\tbusy,\n\t\t\t\t\t\tsubmitDisabled: disabled || listBusy || layout === \"unknown\" || entryFailure !== void 0 || props.credentialOnly !== true && modelFailure !== void 0 || !multiKey && (shownKeyFailure !== void 0 || props.credentialRequired === true && keyValue.length === 0),\n\t\t\t\t\t\tsubmitLabelKey: props.submitLabelKey ?? \"apply\",\n\t\t\t\t\t\tsubmitBusyLabelKey: props.submitBusyLabelKey ?? \"applying\",\n\t\t\t\t\t\t...props.cancelLabelKey === void 0 ? {} : { cancelLabelKey: props.cancelLabelKey },\n\t\t\t\t\t\tonCancel: () => {\n\t\t\t\t\t\t\tprops.onClose(false);\n\t\t\t\t\t\t},\n\t\t\t\t\t\tonSubmit: () => {\n\t\t\t\t\t\t\tprops.onSubmitCredential?.();\n\t\t\t\t\t\t\tapply();\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t]\n\t\t\t});\n\t\t}"
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
"before": "className: ModelsSection_module_css_default[\"editorActions\"],",
|
|
397
|
+
"after": "className: ModelsSection_module_css_default[\"editorActions\"],\n\t\t\t\t\"data-model-save-actions\": true,\n\t\t\t\tstyle: { position: \"sticky\", bottom: \"calc(var(--dsh-model-save-offset, 0px) + env(safe-area-inset-bottom, 0px))\", zIndex: 2, padding: \"10px 0\", background: \"var(--dsw-alias-bg-module-platform)\", flexWrap: \"wrap\" },"
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
"before": "const en = {\n",
|
|
401
|
+
"after": "const en = {\n\t\t\tmultiKeyExpand: \"Expand details\",\n\t\t\tmultiKeyCollapse: \"Collapse details\",\n\t\t\tmultiKeyUnsaved: \"Not saved\",\n"
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
"before": "const zh = {\n",
|
|
405
|
+
"after": "const zh = {\n\t\t\tmultiKeyExpand: \"展开详情\",\n\t\t\tmultiKeyCollapse: \"收起详情\",\n\t\t\tmultiKeyUnsaved: \"未保存\",\n"
|
|
406
|
+
}
|
|
407
|
+
]
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
"baseSha256": "e111ecefea8262e0426f528864b9681d818068042e93d053bcb0b6884b317278",
|
|
411
|
+
"resultSha256": "651052eccf0bdba6a8dd1624bfc25ce9215268cdd6a9a08b80e1095329c1ea5a",
|
|
412
|
+
"replacements": [
|
|
413
|
+
{
|
|
414
|
+
"before": "\t\t//#region lib/types/client/CustomProviderCard.js",
|
|
415
|
+
"after": "\t\t//#region dsh-model-groups/native/multikey\n\t\t// Entries live under one native provider. Secrets exist only in local drafts\n\t\t// and credentials/set; profile mutations contain credential references only.\n\t\tconst MULTI_KEY_ENTRY_ID = /^[A-Za-z0-9][A-Za-z0-9_-]{0,79}$/;\n\t\tconst MULTI_KEY_REF = /^[A-Za-z_][A-Za-z0-9_]*$/;\n\t\tconst MULTI_KEY_UNSAFE_IDS = new Set([\"__proto__\", \"prototype\", \"constructor\"]);\n\t\tfunction supportsMultiKeySchema(namespace, schema, path) {\n\t\t\tif (!namespace || !schema) return false;\n\t\t\tconst root = schema.rehydrate(namespace.schema);\n\t\t\tconst profile = schema.nodeAtPath(root, path);\n\t\t\treturn profile?.dict?.multiKey !== void 0 && profile?.dict?.keyEntries !== void 0;\n\t\t}\n\t\tfunction multiKeyRef(route, id) {\n\t\t\tconst normalized = route.toUpperCase().replace(/[^A-Z0-9]+/g, \"_\");\n\t\t\tconst stem = /^[A-Z_]/.test(normalized) ? normalized : `DSH_${normalized}`;\n\t\t\treturn `${stem}_MULTKEY_${id.toUpperCase().replace(/[^A-Z0-9]+/g, \"_\")}_API_KEY`;\n\t\t}\n\t\tfunction newMultiKeyEntry(route, source = {}) {\n\t\t\tconst id = `k${crypto.randomUUID()}`;\n\t\t\treturn [id, {\n\t\t\t\tname: source.name ?? \"\",\n\t\t\t\t...(typeof source.apiKeyEnv === \"string\" && source.apiKeyEnv.length > 0 ? { apiKeyEnv: source.apiKeyEnv } : {}),\n\t\t\t\tmodels: modelDrafts(source.models).map((model) => structuredClone(model))\n\t\t\t}];\n\t\t}\n\t\tfunction normalizedMultiKeyEntries(route, entries) {\n\t\t\treturn Object.fromEntries(Object.entries(entries).map(([id, entry]) => [id, {\n\t\t\t\t...entry,\n\t\t\t\tname: typeof entry?.name === \"string\" ? entry.name.trim() : \"\",\n\t\t\t\tapiKeyEnv: typeof entry?.apiKeyEnv === \"string\" && entry.apiKeyEnv.length > 0 ? entry.apiKeyEnv : multiKeyRef(route, id),\n\t\t\t\tmodels: modelDrafts(entry?.models).map((model) => structuredClone(model))\n\t\t\t}]));\n\t\t}\n\t\tfunction multiKeyFailure(route, entries, drafts, confirmations, t) {\n\t\t\tif (!entries || typeof entries !== \"object\" || Array.isArray(entries) || Object.keys(entries).length === 0) return t(\"multiKeyNeedsEntries\");\n\t\t\tconst refs = new Set();\n\t\t\tfor (const [id, entry] of Object.entries(entries)) {\n\t\t\t\tif (!MULTI_KEY_ENTRY_ID.test(id) || MULTI_KEY_UNSAFE_IDS.has(id)) return t(\"multiKeyInvalidId\");\n\t\t\t\tif (!entry || typeof entry.name !== \"string\" || entry.name.trim().length === 0 || entry.name.trim().length > 120) return t(\"multiKeyInvalidName\");\n\t\t\t\tconst ref = entry.apiKeyEnv ?? multiKeyRef(route, id);\n\t\t\t\tif (typeof ref !== \"string\" || !MULTI_KEY_REF.test(ref)) return t(\"multiKeyInvalidRef\");\n\t\t\t\tif (refs.has(ref)) return t(\"multiKeyDuplicateRef\");\n\t\t\t\trefs.add(ref);\n\t\t\t\tconst keyFailure = apiKeyFailure(drafts[id] ?? \"\");\n\t\t\t\tif (keyFailure !== void 0) return `${entry.name}: ${t(keyFailure)}`;\n\t\t\t\tif ((drafts[id] ?? \"\").trim().length > 0 && ref !== multiKeyRef(route, id) && confirmations[id] !== true) return `${entry.name}: ${t(\"multiKeyConfirmRequired\")}`;\n\t\t\t\tif (!Array.isArray(entry.models) || entry.models.length === 0) return `${entry.name}: ${t(\"multiKeyNeedsModels\")}`;\n\t\t\t\tconst modelFailure = validateDeepSeekModels(entry.models) ?? validateReasoningEfforts(entry.models);\n\t\t\t\tif (modelFailure !== void 0) return `${entry.name}: ${t(\"model\")} ${String(modelFailure.index + 1)}: ${t(modelFailure.key)}`;\n\t\t\t}\n\t\t}\n\t\tasync function storeMultiKeyDrafts(operations, entries, drafts, setDrafts) {\n\t\t\tfor (const [id, entry] of Object.entries(entries)) {\n\t\t\t\tconst draft = Object.hasOwn(drafts, id) ? drafts[id] : \"\";\n\t\t\t\tif (draft.trim().length === 0) continue;\n\t\t\t\tconst failure = await operations.storeCredential(entry.apiKeyEnv, draft.trim());\n\t\t\t\tif (failure !== void 0) return failure;\n\t\t\t\t// Clear only successful, unchanged drafts: partial failures retry just\n\t\t\t\t// the unfinished credentials without rewriting the provider profile.\n\t\t\t\tsetDrafts((current) => current[id] === draft ? { ...current, [id]: \"\" } : current);\n\t\t\t}\n\t\t}\n\t\tfunction hasMultiKeyDrafts(drafts) {\n\t\t\treturn Object.values(drafts).some((value) => typeof value === \"string\" && value.length > 0);\n\t\t}\n\t\tfunction MultiKeyToggle({ t, checked, disabled, onChange, hasUnsavedKeys = false }) {\n\t\t\tconst [confirmOff, setConfirmOff] = (0, react.useState)(false);\n\t\t\t(0, react.useEffect)(() => {\n\t\t\t\tif (!checked || disabled) setConfirmOff(false);\n\t\t\t}, [checked, disabled]);\n\t\t\tconst close = () => setConfirmOff(false);\n\t\t\treturn (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\"data-multi-key-toggle\": true,\n\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\tchildren: [(0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\tclassName: ModelsSection_module_css_default[\"modelReasoningHead\"],\n\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"], children: t(\"multiKey\")\n\t\t\t\t\t}), (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Switch, {\n\t\t\t\t\t\tchecked, label: t(\"multiKey\"), disabled,\n\t\t\t\t\t\tonChange: (enabled) => {\n\t\t\t\t\t\t\tif (disabled || enabled === checked) return;\n\t\t\t\t\t\t\tif (!enabled) setConfirmOff(true);\n\t\t\t\t\t\t\telse onChange(true);\n\t\t\t\t\t\t}\n\t\t\t\t\t})]\n\t\t\t\t}), (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\tclassName: ModelsSection_module_css_default[\"advancedHint\"], children: t(\"multiKeyHelp\")\n\t\t\t\t}), (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Modal, {\n\t\t\t\t\topen: confirmOff && checked && !disabled, onClose: close,\n\t\t\t\t\ttitle: t(hasUnsavedKeys ? \"multiKeyUnsavedTitle\" : \"multiKeyDisableTitle\"),\n\t\t\t\t\tcloseLabel: t(\"close\"),\n\t\t\t\t\tdescription: t(hasUnsavedKeys ? \"multiKeyUnsavedKeys\" : \"multiKeyDisableDescription\"),\n\t\t\t\t\tclassName: ModelsSection_module_css_default[\"deleteDialog\"],\n\t\t\t\t\tfooter: (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [\n\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {\n\t\t\t\t\t\t\tvariant: \"outline\", \"data-modal-autofocus\": true, onClick: close,\n\t\t\t\t\t\t\tchildren: t(hasUnsavedKeys ? \"multiKeyReturnToEdit\" : \"multiKeyKeepEnabled\")\n\t\t\t\t\t\t}), hasUnsavedKeys ? null : (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {\n\t\t\t\t\t\t\tvariant: \"outline\", disabled,\n\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\tif (disabled || !checked || hasUnsavedKeys) return;\n\t\t\t\t\t\t\t\tclose(); onChange(false);\n\t\t\t\t\t\t\t}, children: t(\"multiKeyDisableConfirm\")\n\t\t\t\t\t\t})\n\t\t\t\t\t] })\n\t\t\t\t})]\n\t\t\t});\n\t\t}\n\t\tfunction MultiKeyEntriesEditor(props) {\n\t\t\tconst { route, entries, keyDrafts, confirmations, onChange, onKeyDraftsChange, onConfirmationsChange, operations, t, disabled } = props;\n\t\t\tconst [busyEntries, setBusyEntries] = (0, react.useState)({});\n\t\t\tconst anyBusy = Object.values(busyEntries).some(Boolean);\n\t\t\tconst { onBusyChange } = props;\n\t\t\t(0, react.useEffect)(() => {\n\t\t\t\tonBusyChange?.(anyBusy);\n\t\t\t}, [anyBusy, onBusyChange]);\n\t\t\t(0, react.useEffect)(() => () => onBusyChange?.(false), [onBusyChange]);\n\t\t\tconst update = (id, patch) => onChange({ ...entries, [id]: { ...entries[id], ...patch } });\n\t\t\tconst remove = (id) => {\n\t\t\t\tconst { [id]: removed, ...remaining } = entries;\n\t\t\t\tonChange(remaining);\n\t\t\t\tonKeyDraftsChange((current) => { const { [id]: removed, ...rest } = current; return rest; });\n\t\t\t\tonConfirmationsChange((current) => { const { [id]: removed, ...rest } = current; return rest; });\n\t\t\t\tsetBusyEntries((current) => { const { [id]: removed, ...rest } = current; return rest; });\n\t\t\t};\n\t\t\treturn (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\"data-multi-key-entries\": true,\n\t\t\t\tclassName: ModelsSection_module_css_default[\"modelList\"],\n\t\t\t\tchildren: [Object.entries(entries).map(([id, candidate], index) => {\n\t\t\t\t\tconst entry = candidate && typeof candidate === \"object\" && !Array.isArray(candidate) ? candidate : {};\n\t\t\t\t\tconst ref = entry.apiKeyEnv ?? multiKeyRef(route, id);\n\t\t\t\t\tconst draft = Object.hasOwn(keyDrafts, id) ? keyDrafts[id] : \"\";\n\t\t\t\t\tconst keyFailure = apiKeyFailure(draft);\n\t\t\t\t\tconst persisted = Object.hasOwn(props.persistedEntries ?? {}, id) && props.persistedEntries[id]?.apiKeyEnv === ref;\n\t\t\t\t\tconst info = props.credentialChecks?.[ref];\n\t\t\t\t\tconst status = info?.configured === true ? \"multiKeyConfigured\" : info?.configured === false ? \"multiKeyMissing\" : persisted ? \"multiKeySaved\" : \"multiKeyNew\";\n\t\t\t\t\tconst needsConfirmation = draft.trim().length > 0 && ref !== multiKeyRef(route, id);\n\t\t\t\t\tconst canUseStored = persisted && props.probe.provider !== void 0;\n\t\t\t\t\tconst probe = {\n\t\t\t\t\t\t...props.probe,\n\t\t\t\t\t\t...(canUseStored ? { keyEntryId: id } : {}),\n\t\t\t\t\t\t...(draft.trim().length > 0 ? { apiKey: draft.trim() } : {})\n\t\t\t\t\t};\n\t\t\t\t\tconst heading = typeof entry.name === \"string\" && entry.name.trim().length > 0 ? entry.name.trim() : `${t(\"multiKeyDefaultName\")} ${String(index + 1)}`;\n\t\t\t\t\treturn (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\t\"data-key-entry-id\": id, role: \"group\", \"aria-label\": heading,\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"rowCard\"],\n\t\t\t\t\t\tstyle: { minWidth: 0 },\n\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\t\t\"data-key-entry-heading\": true,\n\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"rowHead\"],\n\t\t\t\t\t\t\tstyle: { flexWrap: \"wrap\" },\n\t\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"rowName\"],\n\t\t\t\t\t\t\t\tstyle: { minWidth: 0, overflowWrap: \"anywhere\", flex: \"1 1 120px\" }, children: heading\n\t\t\t\t\t\t\t}), (0, react_jsx_runtime.jsx)(\"div\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"rowActions\"],\n\t\t\t\t\t\t\t\tchildren: (0, react_jsx_runtime.jsx)(\"button\", {\n\t\t\t\t\t\t\t\t\ttype: \"button\", className: ModelsSection_module_css_default[\"secondaryButton\"], disabled,\n\t\t\t\t\t\t\t\t\tonClick: () => remove(id), children: t(\"multiKeyRemove\")\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t})]\n\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t(0, react_jsx_runtime.jsxs)(\"label\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", { className: ModelsSection_module_css_default[\"fieldLabel\"], children: t(\"multiKeyEntryName\") }),\n\t\t\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(\"input\", {\n\t\t\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"input\"], type: \"text\", value: entry.name ?? \"\", maxLength: 120,\n\t\t\t\t\t\t\t\t\t\t\"aria-label\": `${t(\"multiKeyEntryName\")} ${String(index + 1)}`, disabled,\n\t\t\t\t\t\t\t\t\t\tonChange: (event) => update(id, { name: event.target.value })\n\t\t\t\t\t\t\t\t\t})]\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t(0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"span\", { className: ModelsSection_module_css_default[\"fieldLabel\"], children: t(\"keyInput\") }),\n\t\t\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(ApiKeyInput, {\n\t\t\t\t\t\t\t\t\t\tt, value: draft, placeholder: t(persisted ? \"keyPlaceholderSaved\" : \"keyPlaceholder\"),\n\t\t\t\t\t\t\t\t\t\t\"aria-label\": `${t(\"keyInput\")} ${String(index + 1)}`, \"aria-invalid\": keyFailure !== void 0,\n\t\t\t\t\t\t\t\t\t\tdisabled: props.keyDisabled ?? disabled,\n\t\t\t\t\t\t\t\t\t\tonChange: (event) => {\n\t\t\t\t\t\t\t\t\t\t\tconst value = event.target.value;\n\t\t\t\t\t\t\t\t\t\t\tonKeyDraftsChange((current) => ({ ...current, [id]: value }));\n\t\t\t\t\t\t\t\t\t\t\tonConfirmationsChange((current) => ({ ...current, [id]: false }));\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(\"p\", { className: ModelsSection_module_css_default[\"advancedHint\"], children: t(status) }),\n\t\t\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(\"p\", { className: ModelsSection_module_css_default[\"advancedHint\"], style: { overflowWrap: \"anywhere\" }, children: t(\"multiKeyRef\").replace(\"{ref}\", () => ref) }),\n\t\t\t\t\t\t\t\t\tkeyFailure === void 0 ? null : (0, react_jsx_runtime.jsx)(\"p\", { className: ModelsSection_module_css_default[\"error\"], children: t(keyFailure) })]\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tneedsConfirmation ? (0, react_jsx_runtime.jsxs)(\"label\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\t\tstyle: { display: \"flex\", alignItems: \"flex-start\", gap: 8, overflowWrap: \"anywhere\" },\n\t\t\t\t\t\t\t\tchildren: [(0, react_jsx_runtime.jsx)(\"input\", {\n\t\t\t\t\t\t\t\t\ttype: \"checkbox\", \"data-confirm-entry\": id, \"aria-label\": t(\"multiKeyReplaceConfirm\").replace(\"{ref}\", () => ref),\n\t\t\t\t\t\t\t\t\tchecked: confirmations[id] === true, disabled: props.keyDisabled ?? disabled,\n\t\t\t\t\t\t\t\t\tonChange: (event) => onConfirmationsChange((current) => ({ ...current, [id]: event.target.checked }))\n\t\t\t\t\t\t\t\t}), (0, react_jsx_runtime.jsx)(\"span\", { children: t(\"multiKeyReplaceConfirm\").replace(\"{ref}\", () => ref) })]\n\t\t\t\t\t\t\t}) : null,\n\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(ModelListEditor, {\n\t\t\t\t\t\t\t\tmodels: modelDrafts(entry.models), onChange: (models) => update(id, { models }),\n\t\t\t\t\t\t\t\treasoningLevels: props.reasoningLevels, probe,\n\t\t\t\t\t\t\t\tprobeBlocked: keyFailure ?? props.probeBlocked ?? (!canUseStored && draft.trim().length === 0 ? \"multiKeyProbeNeedsKey\" : void 0),\n\t\t\t\t\t\t\t\toperations, t, disabled,\n\t\t\t\t\t\t\t\tonBusyChange: (value) => setBusyEntries((current) => current[id] === value ? current : { ...current, [id]: value })\n\t\t\t\t\t\t\t})]\n\t\t\t\t\t}, id);\n\t\t\t\t}), (0, react_jsx_runtime.jsx)(\"button\", {\n\t\t\t\t\ttype: \"button\", className: ModelsSection_module_css_default[\"addModelButton\"], disabled,\n\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\tlet id, entry;\n\t\t\t\t\t\tdo { [id, entry] = newMultiKeyEntry(route, { name: `${t(\"multiKeyDefaultName\")} ${String(Object.keys(entries).length + 1)}` }); } while (Object.hasOwn(entries, id) || Object.values(entries).some((other) => other.apiKeyEnv === multiKeyRef(route, id)));\n\t\t\t\t\t\tonChange({ ...entries, [id]: entry });\n\t\t\t\t\t}, children: t(\"multiKeyAdd\")\n\t\t\t\t}), (0, react_jsx_runtime.jsx)(\"p\", { className: ModelsSection_module_css_default[\"advancedHint\"], children: t(\"multiKeyKeepCredentials\") })]\n\t\t\t});\n\t\t}\n\t\t//#endregion\n\n\t\t//#region lib/types/client/CustomProviderCard.js"
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
"before": "\t\t\t\t\t...probe.provider === void 0 ? {} : { provider: probe.provider },",
|
|
419
|
+
"after": "\t\t\t\t\t...probe.provider === void 0 ? {} : { provider: probe.provider },\n\t\t\t\t\t...probe.keyEntryId === void 0 ? {} : { keyEntryId: probe.keyEntryId },"
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
"before": "const { taken, protocols, reasoningLevels, operations, t, onBusyChange } = props;",
|
|
423
|
+
"after": "const { taken, protocols, reasoningLevels, operations, t, onBusyChange } = props;\n\t\t\tconst supportsMultiKey = supportsMultiKeySchema(props.namespace, props.schema, [\"providers\", PROBE_ROUTE]);"
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
"before": "const [models, setModels] = (0, react.useState)([]);\n\t\t\tconst [busy, setBusy]",
|
|
427
|
+
"after": "const [models, setModels] = (0, react.useState)([]);\n\t\t\tconst [multiKey, setMultiKey] = (0, react.useState)(false);\n\t\t\tconst [keyEntries, setKeyEntries] = (0, react.useState)({});\n\t\t\tconst [entryKeyDrafts, setEntryKeyDrafts] = (0, react.useState)({});\n\t\t\tconst [entryConfirmations, setEntryConfirmations] = (0, react.useState)({});\n\t\t\tconst saving = (0, react.useRef)(false);\n\t\t\tconst [busy, setBusy]"
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
"before": "const modelFailure = validateDeepSeekModels(models) ?? validateReasoningEfforts(models);\n\t\t\tconst keyFailure = apiKeyFailure(keyDraft);",
|
|
431
|
+
"after": "const modelFailure = multiKey ? void 0 : validateDeepSeekModels(models) ?? validateReasoningEfforts(models);\n\t\t\tconst entryFailure = multiKey ? multiKeyFailure(route, keyEntries, entryKeyDrafts, entryConfirmations, t) : void 0;\n\t\t\tconst keyFailure = multiKey ? void 0 : apiKeyFailure(keyDraft);"
|
|
432
|
+
},
|
|
433
|
+
{
|
|
434
|
+
"before": "const ready = route.length > 0 && !routeInvalid && !routeTaken && normalizedBaseURL.length > 0 && !baseUrlInvalid && models.length > 0 && modelFailure === void 0 && keyFailure === void 0;",
|
|
435
|
+
"after": "const ready = (committed || route.length > 0 && !routeInvalid && !routeTaken) && normalizedBaseURL.length > 0 && !baseUrlInvalid && (multiKey ? entryFailure === void 0 : models.length > 0 && modelFailure === void 0 && keyFailure === void 0);"
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
"before": "const hint = failure !== void 0 || ready || keyFailure !== void 0 || route.length === 0 || routeInvalid || routeTaken || baseUrlInvalid ? void 0 : normalizedBaseURL.length === 0 ? t(\"customNeedsBaseUrl\") : modelFailure !== void 0 ? `${t(\"model\")} ${String(modelFailure.index + 1)}: ${t(modelFailure.key)}` : t(\"customNeedsModels\");",
|
|
439
|
+
"after": "const hint = entryFailure ?? (failure !== void 0 || ready || keyFailure !== void 0 || route.length === 0 || routeInvalid || routeTaken || baseUrlInvalid ? void 0 : normalizedBaseURL.length === 0 ? t(\"customNeedsBaseUrl\") : modelFailure !== void 0 ? `${t(\"model\")} ${String(modelFailure.index + 1)}: ${t(modelFailure.key)}` : t(\"customNeedsModels\"));"
|
|
440
|
+
},
|
|
441
|
+
{
|
|
442
|
+
"before": "const keyRef = deriveKeyRef(route);\n\t\t\t\tconst storesKey = keyValue.length > 0;",
|
|
443
|
+
"after": "const entries = normalizedMultiKeyEntries(route, keyEntries);\n\t\t\t\tconst firstEntry = Object.values(entries)[0];\n\t\t\t\tconst keyRef = multiKey ? firstEntry?.apiKeyEnv : deriveKeyRef(route);\n\t\t\t\tconst storesKey = !multiKey && keyValue.length > 0;\n\t\t\t\tif (multiKey && entryFailure !== void 0) return entryFailure;"
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
"before": "...storesKey ? { apiKeyEnv: keyRef } : {},\n\t\t\t\t\t\tapi: protocol,\n\t\t\t\t\t\tbaseURL: normalizedBaseURL,\n\t\t\t\t\t\tmodels: models.map((model) => ({ ...model }))",
|
|
447
|
+
"after": "...storesKey || multiKey ? { apiKeyEnv: keyRef } : {},\n\t\t\t\t\t\tapi: protocol,\n\t\t\t\t\t\tbaseURL: normalizedBaseURL,\n\t\t\t\t\t\tmodels: (multiKey ? firstEntry.models : models).map((model) => ({ ...model })),\n\t\t\t\t\t\t...(multiKey || Object.keys(keyEntries).length > 0 ? { multiKey, keyEntries: entries } : {})"
|
|
448
|
+
},
|
|
449
|
+
{
|
|
450
|
+
"before": "\t\t\t\tif (storesKey) {\n\t\t\t\t\tconst stored = await operations.storeCredential(keyRef, keyValue);\n\t\t\t\t\tif (stored !== void 0) return stored;\n\t\t\t\t}\n\t\t\t};",
|
|
451
|
+
"after": "\t\t\t\tif (multiKey) return storeMultiKeyDrafts(operations, entries, entryKeyDrafts, setEntryKeyDrafts);\n\t\t\t\tif (storesKey) {\n\t\t\t\t\tconst stored = await operations.storeCredential(keyRef, keyValue);\n\t\t\t\t\tif (stored !== void 0) return stored;\n\t\t\t\t\tsetKeyDraft(\"\");\n\t\t\t\t}\n\t\t\t};"
|
|
452
|
+
},
|
|
453
|
+
{
|
|
454
|
+
"before": "const create = async () => {\n\t\t\t\tsetBusy(true);",
|
|
455
|
+
"after": "const create = async () => {\n\t\t\t\tif (saving.current || !ready || props.readOnly || listBusy) return;\n\t\t\t\tsaving.current = true;\n\t\t\t\tsetBusy(true);"
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
"before": "props.onClose(true);\n\t\t\t\t} finally {\n\t\t\t\t\tsetBusy(false);\n\t\t\t\t}\n\t\t\t};\n\t\t\treturn (0, react_jsx_runtime.jsxs)(\"div\", {",
|
|
459
|
+
"after": "props.onClose(true);\n\t\t\t\t} catch {\n\t\t\t\t\tsetFailure(t(\"multiKeySaveFailed\"));\n\t\t\t\t} finally {\n\t\t\t\t\tsaving.current = false;\n\t\t\t\t\tsetBusy(false);\n\t\t\t\t}\n\t\t\t};\n\t\t\treturn (0, react_jsx_runtime.jsxs)(\"div\", {"
|
|
460
|
+
},
|
|
461
|
+
{
|
|
462
|
+
"before": "\t\t\t\t\t(0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\tchildren: [\n\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\t\tchildren: t(\"keyInput\")",
|
|
463
|
+
"after": "\t\t\t\t\tsupportsMultiKey ? (0, react_jsx_runtime.jsx)(MultiKeyToggle, {\n\t\t\t\t\t\tt, checked: multiKey, disabled: profileDisabled || listBusy, hasUnsavedKeys: hasMultiKeyDrafts(entryKeyDrafts),\n\t\t\t\t\t\tonChange: (enabled) => {\n\t\t\t\t\t\t\tif (enabled && Object.keys(keyEntries).length === 0) {\n\t\t\t\t\t\t\t\tconst [id, entry] = newMultiKeyEntry(route, { name: displayName || route || t(\"multiKeyDefaultName\"), models });\n\t\t\t\t\t\t\t\tsetKeyEntries({ [id]: entry });\n\t\t\t\t\t\t\t\tif (keyDraft.length > 0) setEntryKeyDrafts({ [id]: keyDraft });\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsetMultiKey(enabled);\n\t\t\t\t\t\t}\n\t\t\t\t\t}) : null,\n\t\t\t\t\tmultiKey ? (0, react_jsx_runtime.jsx)(MultiKeyEntriesEditor, {\n\t\t\t\t\t\troute, entries: keyEntries, onChange: setKeyEntries,\n\t\t\t\t\t\tkeyDrafts: entryKeyDrafts, onKeyDraftsChange: setEntryKeyDrafts,\n\t\t\t\t\t\tconfirmations: entryConfirmations, onConfirmationsChange: setEntryConfirmations,\n\t\t\t\t\t\tpersistedEntries: committed ? normalizedMultiKeyEntries(route, keyEntries) : {},\n\t\t\t\t\t\tprobe: { settingsNs: NS$1, ...(committed ? { provider: route } : {}), baseURL: normalizedBaseURL, api: protocol },\n\t\t\t\t\t\tprobeBlocked: baseUrlInvalid ? \"customBaseUrlInvalid\" : normalizedBaseURL.length === 0 ? \"customNeedsBaseUrl\" : void 0,\n\t\t\t\t\t\treasoningLevels, operations, t, disabled: profileDisabled || listBusy, keyDisabled: disabled || listBusy, onBusyChange: setListBusy\n\t\t\t\t\t}) : null,\n\t\t\t\t\tmultiKey ? null : (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"field\"],\n\t\t\t\t\t\tchildren: [\n\t\t\t\t\t\t\t(0, react_jsx_runtime.jsx)(\"span\", {\n\t\t\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"fieldLabel\"],\n\t\t\t\t\t\t\t\tchildren: t(\"keyInput\")"
|
|
464
|
+
},
|
|
465
|
+
{
|
|
466
|
+
"before": "\t\t\t\t\t(0, react_jsx_runtime.jsx)(ModelListEditor, {\n\t\t\t\t\t\tmodels,\n\t\t\t\t\t\tonChange: setModels,",
|
|
467
|
+
"after": "\t\t\t\t\t!multiKey ? (0, react_jsx_runtime.jsx)(ModelListEditor, {\n\t\t\t\t\t\tmodels,\n\t\t\t\t\t\tonChange: setModels,"
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
"before": "\t\t\t\t\t\tonBusyChange: setListBusy\n\t\t\t\t\t}),\n\t\t\t\t\tfailure !== void 0",
|
|
471
|
+
"after": "\t\t\t\t\t\tonBusyChange: setListBusy\n\t\t\t\t\t}) : null,\n\t\t\t\t\tfailure !== void 0"
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
"before": "submitDisabled: disabled || !ready,",
|
|
475
|
+
"after": "submitDisabled: disabled || listBusy || !ready,"
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
"before": "taken: state.rows.map((row) => row.entry.provider),\n\t\t\t\t\t\t\t\t\t\tprotocols,",
|
|
479
|
+
"after": "taken: state.rows.map((row) => row.entry.provider),\n\t\t\t\t\t\t\t\t\t\tnamespace: piAi,\n\t\t\t\t\t\t\t\t\t\tschema,\n\t\t\t\t\t\t\t\t\t\tprotocols,"
|
|
480
|
+
},
|
|
481
|
+
{
|
|
482
|
+
"before": "const [draft, setDraft] = (0, react.useState)(() => draftAt(schema, namespace, settingsPath));",
|
|
483
|
+
"after": "const [draft, setDraft] = (0, react.useState)(() => draftAt(schema, namespace, settingsPath));\n\t\t\tconst [entryKeyDrafts, setEntryKeyDrafts] = (0, react.useState)({});\n\t\t\tconst [entryConfirmations, setEntryConfirmations] = (0, react.useState)({});\n\t\t\tconst saving = (0, react.useRef)(false);"
|
|
484
|
+
},
|
|
485
|
+
{
|
|
486
|
+
"before": "const keyRef = refFor(schema, namespace, settingsPath, props.provider);",
|
|
487
|
+
"after": "const keyRef = refFor(schema, namespace, settingsPath, props.provider);\n\t\t\tconst supportsMultiKey = layout === \"pi-ai\" && props.declared === true && props.credentialOnly !== true && supportsMultiKeySchema(namespace, schema, settingsPath);\n\t\t\tconst multiKey = supportsMultiKey && (draft.multiKey ?? fallback?.multiKey) === true;\n\t\t\tconst keyEntries = draft.keyEntries ?? fallback?.keyEntries ?? {};\n\t\t\tconst entryFailure = multiKey ? multiKeyFailure(props.provider, keyEntries, entryKeyDrafts, entryConfirmations, t) : void 0;"
|
|
488
|
+
},
|
|
489
|
+
{
|
|
490
|
+
"before": "const modelFailure = validateModels(schema.getPath(draft, [\"models\"]));\n\t\t\tconst keyFailure = apiKeyFailure(keyDraft);",
|
|
491
|
+
"after": "const modelFailure = multiKey ? void 0 : validateModels(schema.getPath(draft, [\"models\"]));\n\t\t\tconst keyFailure = multiKey ? void 0 : apiKeyFailure(keyDraft);"
|
|
492
|
+
},
|
|
493
|
+
{
|
|
494
|
+
"before": "const next = layout === \"pi-ai\" && stringAt(draft, \"apiKeyEnv\") === void 0 && stringAt(fallback, \"apiKeyEnv\") === void 0 && keyValue.length > 0 ? schema.setPath(draft, [\"apiKeyEnv\"], keyRef) : draft;",
|
|
495
|
+
"after": "const normalizedDraft = supportsMultiKey && schema.hasPath(draft, [\"keyEntries\"]) ? schema.setPath(draft, [\"keyEntries\"], normalizedMultiKeyEntries(props.provider, keyEntries)) : draft;\n\t\t\t\tconst next = multiKey ? schema.setPath(normalizedDraft, [\"keyEntries\"], normalizedMultiKeyEntries(props.provider, keyEntries)) : layout === \"pi-ai\" && stringAt(draft, \"apiKeyEnv\") === void 0 && stringAt(fallback, \"apiKeyEnv\") === void 0 && keyValue.length > 0 ? schema.setPath(normalizedDraft, [\"apiKeyEnv\"], keyRef) : normalizedDraft;\n\t\t\t\tif (entryFailure !== void 0) return entryFailure;"
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
"before": "if (props.credentialOnly !== true) {\n\t\t\t\t\tconst failure = validateModels",
|
|
499
|
+
"after": "if (props.credentialOnly !== true && !multiKey) {\n\t\t\t\t\tconst failure = validateModels"
|
|
500
|
+
},
|
|
501
|
+
{
|
|
502
|
+
"before": "\t\t\t\tif (keyValue.length > 0) {\n\t\t\t\t\tconst stored = await operations.storeCredential(keyRef, keyValue);",
|
|
503
|
+
"after": "\t\t\t\tif (multiKey) return storeMultiKeyDrafts(operations, next.keyEntries, entryKeyDrafts, setEntryKeyDrafts);\n\t\t\t\tif (keyValue.length > 0) {\n\t\t\t\t\tconst stored = await operations.storeCredential(keyRef, keyValue);"
|
|
504
|
+
},
|
|
505
|
+
{
|
|
506
|
+
"before": "const apply = async () => {\n\t\t\t\tsetBusy(true);",
|
|
507
|
+
"after": "const apply = async () => {\n\t\t\t\tif (saving.current || props.readOnly || listBusy || entryFailure !== void 0) return;\n\t\t\t\tsaving.current = true;\n\t\t\t\tsetBusy(true);"
|
|
508
|
+
},
|
|
509
|
+
{
|
|
510
|
+
"before": "props.onClose(true);\n\t\t\t\t} finally {\n\t\t\t\t\tsetBusy(false);\n\t\t\t\t}\n\t\t\t};\n\t\t\tif (node === void 0)",
|
|
511
|
+
"after": "props.onClose(true);\n\t\t\t\t} catch {\n\t\t\t\t\tsetFailure(t(\"multiKeySaveFailed\"));\n\t\t\t\t} finally {\n\t\t\t\t\tsaving.current = false;\n\t\t\t\t\tsetBusy(false);\n\t\t\t\t}\n\t\t\t};\n\t\t\tif (node === void 0)"
|
|
512
|
+
},
|
|
513
|
+
{
|
|
514
|
+
"before": "return (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [keylessNativeAuth ? null :",
|
|
515
|
+
"after": "return (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [supportsMultiKey ? (0, react_jsx_runtime.jsx)(MultiKeyToggle, {\n\t\t\t\t\tt, checked: multiKey, disabled: disabled || listBusy, hasUnsavedKeys: hasMultiKeyDrafts(entryKeyDrafts),\n\t\t\t\t\tonChange: (enabled) => {\n\t\t\t\t\t\tlet updated = schema.setPath(draft, [\"multiKey\"], enabled);\n\t\t\t\t\t\tif (enabled && Object.keys(keyEntries).length === 0) {\n\t\t\t\t\t\t\tconst namedRef = stringAt(draft, \"apiKeyEnv\") ?? stringAt(fallback, \"apiKeyEnv\");\n\t\t\t\t\t\t\tconst [id, entry] = newMultiKeyEntry(props.provider, {\n\t\t\t\t\t\t\t\tname: stringAt(draft, \"displayName\") ?? stringAt(fallback, \"displayName\") ?? props.displayName ?? props.provider,\n\t\t\t\t\t\t\t\tapiKeyEnv: namedRef,\n\t\t\t\t\t\t\t\tmodels: draft.models ?? fallback?.models ?? inheritedModels()\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (keyDraft.length > 0) {\n\t\t\t\t\t\t\t\tsetEntryKeyDrafts({ [id]: keyDraft });\n\t\t\t\t\t\t\t\tif (namedRef === void 0) updated = schema.setPath(updated, [\"apiKeyEnv\"], multiKeyRef(props.provider, id));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tupdated = schema.setPath(updated, [\"keyEntries\"], { [id]: entry });\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetDraft(updated);\n\t\t\t\t\t}\n\t\t\t\t}) : null, multiKey ? (0, react_jsx_runtime.jsx)(MultiKeyEntriesEditor, {\n\t\t\t\t\troute: props.provider, entries: keyEntries,\n\t\t\t\t\tonChange: (entries) => setDraft((current) => schema.setPath(current, [\"keyEntries\"], entries)),\n\t\t\t\t\tkeyDrafts: entryKeyDrafts, onKeyDraftsChange: setEntryKeyDrafts,\n\t\t\t\t\tconfirmations: entryConfirmations, onConfirmationsChange: setEntryConfirmations,\n\t\t\t\t\tpersistedEntries: schema.getPath(committedOriginal, [\"keyEntries\"]) ?? fallback?.keyEntries ?? {},\n\t\t\t\t\tcredentialChecks: props.credentialChecks,\n\t\t\t\t\tprobe: { settingsNs: namespace.ns, provider: props.provider, ...(probeBaseURL === void 0 ? {} : { baseURL: probeBaseURL }), ...(probeApi === void 0 ? {} : { api: probeApi }) },\n\t\t\t\t\treasoningLevels, operations, t, disabled: disabled || listBusy, onBusyChange: setListBusy\n\t\t\t\t}) : null, multiKey || keylessNativeAuth ? null :"
|
|
516
|
+
},
|
|
517
|
+
{
|
|
518
|
+
"before": "family === \"deepseek\" ? (0, react_jsx_runtime.jsx)(DeepSeekModelsEditor, {",
|
|
519
|
+
"after": "multiKey ? null : family === \"deepseek\" ? (0, react_jsx_runtime.jsx)(DeepSeekModelsEditor, {"
|
|
520
|
+
},
|
|
521
|
+
{
|
|
522
|
+
"before": "\t\t\t\t\tfailure !== void 0 ? (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"error\"],\n\t\t\t\t\t\tchildren: failure\n\t\t\t\t\t}) : null,\n\t\t\t\t\tprops.credentialOnly",
|
|
523
|
+
"after": "\t\t\t\t\t(failure ?? entryFailure) !== void 0 ? (0, react_jsx_runtime.jsx)(\"p\", {\n\t\t\t\t\t\tclassName: ModelsSection_module_css_default[\"error\"],\n\t\t\t\t\t\tchildren: failure ?? entryFailure\n\t\t\t\t\t}) : null,\n\t\t\t\t\tprops.credentialOnly"
|
|
524
|
+
},
|
|
525
|
+
{
|
|
526
|
+
"before": "submitDisabled: disabled || layout === \"unknown\" || props.credentialOnly !== true && modelFailure !== void 0 || shownKeyFailure !== void 0 || props.credentialRequired === true && keyValue.length === 0,",
|
|
527
|
+
"after": "submitDisabled: disabled || listBusy || layout === \"unknown\" || entryFailure !== void 0 || props.credentialOnly !== true && modelFailure !== void 0 || !multiKey && (shownKeyFailure !== void 0 || props.credentialRequired === true && keyValue.length === 0),"
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
"before": "return (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [supportsMultiKey ? (0, react_jsx_runtime.jsx)(MultiKeyToggle, {",
|
|
531
|
+
"after": "const credentials = (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [supportsMultiKey ? (0, react_jsx_runtime.jsx)(MultiKeyToggle, {"
|
|
532
|
+
},
|
|
533
|
+
{
|
|
534
|
+
"before": "\t\t\t\t}), props.credentialOnly === true ? null : (0, react_jsx_runtime.jsxs)(\"details\", {\n\t\t\t\t\tclassName: ModelsSection_module_css_default[\"customized\"],",
|
|
535
|
+
"after": "\t\t\t\t})] });\n\t\t\t\tconst customization = props.credentialOnly === true ? null : (0, react_jsx_runtime.jsxs)(\"details\", {\n\t\t\t\t\tclassName: ModelsSection_module_css_default[\"customized\"],\n\t\t\t\t\topen: supportsMultiKey ? true : void 0,\n\t\t\t\t\t\"data-multi-key-shared-settings\": supportsMultiKey ? true : void 0,"
|
|
536
|
+
},
|
|
537
|
+
{
|
|
538
|
+
"before": "children: t(\"customized\")\n\t\t\t\t\t}), (0, react_jsx_runtime.jsxs)(\"div\", {",
|
|
539
|
+
"after": "children: t(supportsMultiKey ? \"multiKeySharedSettings\" : \"customized\")\n\t\t\t\t\t}), (0, react_jsx_runtime.jsxs)(\"div\", {"
|
|
540
|
+
},
|
|
541
|
+
{
|
|
542
|
+
"before": "\t\t\t\t})] });\n\t\t\t};\n\t\t\treturn (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\tclassName: props.credentialOnly",
|
|
543
|
+
"after": "\t\t\t\t});\n\t\t\t\treturn (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: supportsMultiKey ? [customization, credentials] : [credentials, customization] });\n\t\t\t};\n\t\t\treturn (0, react_jsx_runtime.jsxs)(\"div\", {\n\t\t\t\tclassName: props.credentialOnly"
|
|
544
|
+
},
|
|
545
|
+
{
|
|
546
|
+
"before": "\t\tconst en = {",
|
|
547
|
+
"after": "\t\tconst en = {\n\t\t\tmultiKey: \"Multiple key configurations\",\n\t\t\tmultiKeyHelp: \"Configurations share one provider ID, endpoint and protocol; each has its own name, API key and models. Turning this off restores the original single-key configuration without deleting entries or credentials.\",\n\t\t\tmultiKeySharedSettings: \"Shared settings\",\n\t\t\tmultiKeyAdd: \"Add key configuration\",\n\t\t\tmultiKeyRemove: \"Remove\",\n\t\t\tmultiKeyEntryName: \"Configuration name\",\n\t\t\tmultiKeyDefaultName: \"Key configuration\",\n\t\t\tmultiKeyDisableTitle: \"Turn off multiple key configurations?\",\n\t\t\tmultiKeyDisableDescription: \"After applying, this provider will use its original single-key configuration. Saved configurations and credentials will not be deleted. Sessions using a key configuration will need you to re-enable it or select a single-key model; no other key will be chosen automatically.\",\n\t\t\tmultiKeyKeepEnabled: \"Keep enabled\",\n\t\t\tmultiKeyDisableConfirm: \"Turn off in draft\",\n\t\t\tmultiKeyUnsavedTitle: \"Save the API keys before turning this off\",\n\t\t\tmultiKeyUnsavedKeys: \"Some API keys have been typed but not saved. Turning this off and applying would not store those inputs, so the switch will stay on. Return to the configurations and apply to save them, then reopen this card to turn it off. Nothing has been deleted.\",\n\t\t\tmultiKeyReturnToEdit: \"Return to configurations\",\n\t\t\tmultiKeyRef: \"Credential reference: {ref}\",\n\t\t\tmultiKeySaved: \"Saved reference; credential status not checked. Leave the key blank to keep it.\",\n\t\t\tmultiKeyNew: \"Not saved yet. An empty key does not create a credential.\",\n\t\t\tmultiKeyConfigured: \"Credential confirmed configured; leave blank to keep it.\",\n\t\t\tmultiKeyMissing: \"Credential confirmed missing. Enter a key or configure this reference.\",\n\t\t\tmultiKeyKeepCredentials: \"Removing a key configuration does not delete its stored credential.\",\n\t\t\tmultiKeyNeedsEntries: \"Add at least one key configuration.\",\n\t\t\tmultiKeyInvalidId: \"Invalid key-configuration ID; reopen this card or fix the profile.\",\n\t\t\tmultiKeyInvalidName: \"Each key configuration needs a name of 1–120 characters.\",\n\t\t\tmultiKeyInvalidRef: \"Invalid credential reference.\",\n\t\t\tmultiKeyDuplicateRef: \"Two configurations use the same credential reference. Each configuration must have its own reference.\",\n\t\t\tmultiKeyNeedsModels: \"Each key configuration needs at least one model.\",\n\t\t\tmultiKeyReplaceConfirm: \"Replace the key at {ref}. Other configurations sharing this reference will also be affected.\",\n\t\t\tmultiKeyConfirmRequired: \"Confirm the credential replacement before applying.\",\n\t\t\tmultiKeyProbeNeedsKey: \"Enter this configuration’s API key to discover models before saving. The provider’s original key will not be used.\",\n\t\t\tmultiKeySaveFailed: \"Saving did not complete. Keep this card open and retry; successful credential writes will not be repeated.\","
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
"before": "\t\tconst zh = {",
|
|
551
|
+
"after": "\t\tconst zh = {\n\t\t\tmultiKey: \"多密钥配置\",\n\t\t\tmultiKeyHelp: \"各配置共享 Provider ID、API 地址与协议,分别管理名称、API 密钥和模型。关闭后恢复原单密钥配置,已保存的配置与密钥不会删除。\",\n\t\t\tmultiKeySharedSettings: \"公共设置\",\n\t\t\tmultiKeyAdd: \"添加密钥配置\",\n\t\t\tmultiKeyRemove: \"移除\",\n\t\t\tmultiKeyEntryName: \"配置名称\",\n\t\t\tmultiKeyDefaultName: \"密钥配置\",\n\t\t\tmultiKeyDisableTitle: \"关闭多密钥配置?\",\n\t\t\tmultiKeyDisableDescription: \"应用后,此供应商将使用原单密钥配置,已保存的密钥配置与凭据不会删除。正在使用密钥配置的会话需要重新开启,或手动选择单密钥模型;不会自动换用其他密钥。\",\n\t\t\tmultiKeyKeepEnabled: \"保持开启\",\n\t\t\tmultiKeyDisableConfirm: \"确认关闭(待应用)\",\n\t\t\tmultiKeyUnsavedTitle: \"请先保存新输入的密钥\",\n\t\t\tmultiKeyUnsavedKeys: \"当前有尚未保存的 API 密钥输入。关闭后直接应用不会保存这些输入,因此开关将保持开启。请返回密钥配置并应用保存,再重新打开此卡片关闭;当前输入与已存储的密钥均未删除。\",\n\t\t\tmultiKeyReturnToEdit: \"返回密钥配置\",\n\t\t\tmultiKeyRef: \"密钥引用:{ref}\",\n\t\t\tmultiKeySaved: \"引用已保存,尚未检查密钥状态;输入留空可保留原密钥。\",\n\t\t\tmultiKeyNew: \"尚未保存;输入留空不会创建密钥。\",\n\t\t\tmultiKeyConfigured: \"已确认密钥已配置;留空可保留。\",\n\t\t\tmultiKeyMissing: \"已确认此引用缺少密钥,请输入或在环境中配置。\",\n\t\t\tmultiKeyKeepCredentials: \"移除密钥配置不会删除已存储的密钥。\",\n\t\t\tmultiKeyNeedsEntries: \"请至少添加一个密钥配置。\",\n\t\t\tmultiKeyInvalidId: \"密钥配置 ID 无效,请重新打开此卡片或修正配置。\",\n\t\t\tmultiKeyInvalidName: \"每个配置名称须为 1–120 个字符。\",\n\t\t\tmultiKeyInvalidRef: \"密钥引用无效。\",\n\t\t\tmultiKeyDuplicateRef: \"多个密钥配置使用了相同的密钥引用;每个配置必须使用独立引用。\",\n\t\t\tmultiKeyNeedsModels: \"每个密钥配置至少需要一个模型。\",\n\t\t\tmultiKeyReplaceConfirm: \"确认替换 {ref} 的密钥;共用此引用的其他配置也会受到影响。\",\n\t\t\tmultiKeyConfirmRequired: \"请先确认替换已引用的密钥,再应用。\",\n\t\t\tmultiKeyProbeNeedsKey: \"保存前请先输入此配置的 API 密钥再获取模型;不会使用供应商原来的密钥。\",\n\t\t\tmultiKeySaveFailed: \"保存尚未完成。请保留此卡片并重试;已成功写入的密钥不会重复写入。\","
|
|
552
|
+
}
|
|
553
|
+
]
|
|
147
554
|
}
|
|
148
555
|
]
|
|
149
556
|
}
|