@huaqiu/dsh-hardware-ui 0.7.14 → 0.7.16

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/lib/client.js CHANGED
@@ -5,7 +5,293 @@ window.__ModuleLoader__.load({
5
5
  var exports = module.exports;
6
6
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
7
7
  let react = require("react");
8
+ //#region src/client/copy.ts
9
+ const COPY = {
10
+ /** Product name — tab title, settings section label, wizard title. */
11
+ product: { name: "硬件工程" },
12
+ /** The five persistent destinations, in `DESTINATIONS` order. */
13
+ destinations: {
14
+ schematic: "原理图",
15
+ pcb: "PCB",
16
+ bom: "BOM",
17
+ "3d": "3D 模型",
18
+ order: "下单"
19
+ },
20
+ /** Navigation row + viewer strip. */
21
+ viewer: {
22
+ discoveryFailed: (detail) => `产物扫描失败:${detail}`,
23
+ installationFailed: (detail) => `安装检查失败:${detail}`,
24
+ noArtifact: "未选择产物",
25
+ kicadMissing: "未找到 KiCad",
26
+ kicadVersion: (version) => `KiCad ${version}`,
27
+ openInKicad: "用 KiCad 打开",
28
+ openInKicadTitle: (path) => `在 KiCad 中打开 ${path}`,
29
+ selectArtifactFirst: "请先选择一个产物",
30
+ configureKicad: "请在「设置 → 硬件工程」中配置 KiCad",
31
+ selectProject: "选择工程…",
32
+ projectField: "工程",
33
+ schematicSheetField: "原理图页",
34
+ boardField: "板文件"
35
+ },
36
+ /**
37
+ * Empty viewers. A placeholder names what is missing and then says how to get
38
+ * it: the agent creates hardware, so the copy points there instead of stopping
39
+ * at "not available". BOM is the one destination nobody creates directly — it
40
+ * follows the schematic.
41
+ */
42
+ placeholder: {
43
+ title: {
44
+ schematic: "暂无原理图",
45
+ pcb: "暂无 PCB",
46
+ bom: "暂无 BOM",
47
+ "3d": "暂无 3D 模型",
48
+ order: "暂无可下单的板"
49
+ },
50
+ /** One sentence: what the agent can create for this destination. */
51
+ guide: {
52
+ schematic: "可以让智能体在当前工程中创建原理图(.kicad_sch),创建后会直接在这里显示。",
53
+ pcb: "可以让智能体创建 PCB 并完成布局(.kicad_pcb),保存后会直接在这里显示。",
54
+ bom: "BOM 由原理图自动生成:让智能体先创建原理图,BOM 会自动更新。",
55
+ "3d": "3D 模型由 PCB 生成:让智能体创建 PCB 后,这里会自动出现三维预览。",
56
+ order: "制板与贴片都需要 PCB:让智能体创建 PCB 后即可在这里报价下单。"
57
+ },
58
+ /** Shown instead of a destination guide when no project was discovered. */
59
+ noProject: "可以让智能体在当前工作区创建 KiCad 工程(.kicad_pro),工程出现后这里会自动刷新。",
60
+ /** The ask, phrased so the user can paste it into the conversation. */
61
+ askAgent: "对智能体说:「为当前工程创建原理图」/「创建 PCB」/「导出 3D 模型」即可。"
62
+ },
63
+ /**
64
+ * Discovery outcomes. These are the panel's OWN sentences for a host state —
65
+ * the host also sends a `message`, but re-deriving it here keeps the copy in
66
+ * one place and lets the count/cwd be woven in. {@link issueText} bridges the
67
+ * two: known codes get translated, unknown ones fall back to the host text.
68
+ */
69
+ discovery: {
70
+ selectionRequiredCount: (count) => `发现 ${count} 个硬件工程,请明确选择一个。`,
71
+ selectionRequiredArtifact: "该工程包含多个可选产物,请明确选择一个。",
72
+ noProjectSelected: "尚未选择硬件工程。请打开或选择一个硬件工程。",
73
+ noSchematic: "该工程没有可用的根原理图。",
74
+ noBoard: "该工程没有可用的 .kicad_pcb 板文件。",
75
+ noBoardToOrder: "请先选择板文件,再报价或下单制板。",
76
+ noProject: (cwd) => cwd === "" ? "未找到 .kicad_pro 工程文件" : `${cwd} 下未找到 .kicad_pro 工程文件`,
77
+ missingProject: (path) => `工程文件不存在:${path}`,
78
+ badManifest: (detail) => `配置文件 .hardware-engineering.json 无效:${detail}`
79
+ },
80
+ /** schematic / pcb / 3d / bom stages. */
81
+ preview: {
82
+ loading: "正在加载已保存的产物…",
83
+ kindSchematic: "原理图",
84
+ kindBoard: "PCB",
85
+ revision: (revision) => `版本 ${revision}`,
86
+ ecadHint: "仅预览已保存的文件;文件必须存在且可解析。",
87
+ ecadKindMismatch: (expected, actual) => `宿主返回的产物类型(${actual})与预览类型(${expected})不一致。`,
88
+ ecadOverlay: "已保存文件 · 滚轮缩放,拖拽平移",
89
+ kicadNotConfigured: "KiCad 尚未配置。",
90
+ glbExporting: "正在用 kicad-cli 导出 PCB 的 GLB…",
91
+ glbLoading: "正在加载 3D 模型…",
92
+ glbCached: "缓存",
93
+ glbGenerated: "已生成",
94
+ glbOverlay: "拖拽旋转 · 滚轮缩放",
95
+ bomHint: "BOM 行来自 kicad-cli sch export bom。请在「设置 → 硬件工程」中配置 KiCad。",
96
+ bomTitle: (lines) => `物料清单 · ${String(lines)} 行`,
97
+ bomPlacements: (count) => `${String(count)} 个元件位`,
98
+ bomColumns: [
99
+ "位号",
100
+ "数量",
101
+ "值",
102
+ "封装",
103
+ "备注"
104
+ ]
105
+ },
106
+ /** Order Placing destination. */
107
+ order: {
108
+ title: "制板与贴片",
109
+ packaging: "打包中…",
110
+ packageReady: "打包完成",
111
+ packagePending: "尚未打包",
112
+ packageRunning: "正在运行 kicad-cli 导出 Gerber 与钻孔…",
113
+ packageNotPrepared: "尚未打包。",
114
+ packageCard: "制板文件包",
115
+ packageFiles: (files, size) => `${String(files)} 个文件 · ${size}`,
116
+ pcbTitle: "裸板制板",
117
+ pcbSubtitle: "通过华秋制板服务对选中的板文件报价并下单。",
118
+ pcbSummary: (zip, files, size) => `${zip} · ${String(files)} 个 Gerber/钻孔文件 · ${size}`,
119
+ pcbAction: "提交 PCB 订单",
120
+ smtTitle: "整包贴片",
121
+ smtSubtitle: "需要工程根原理图以生成 BOM 与元件坐标。",
122
+ smtSummary: (placements, lines, size) => `${String(placements)} 个贴片点位 · ${String(lines)} 行 BOM · ${size}`,
123
+ smtAction: "提交贴片订单",
124
+ boardFile: "板文件",
125
+ placements: "贴片点位",
126
+ bomLines: "BOM 行数",
127
+ credential: "登录凭据",
128
+ signedIn: "华秋登录",
129
+ signedOut: "未登录",
130
+ signInToOrder: "请先登录华秋账号再下单——订单页将以你的账号打开。",
131
+ signInToOrderSmt: "请先登录华秋账号再下单贴片——订单页将以你的账号打开。",
132
+ waitingForPackage: "正在等待制板文件包。",
133
+ configureToPackage: "请配置 KiCad 以打包板文件。",
134
+ selectRootSchematic: "请选择根原理图,以便生成 BOM 与坐标。",
135
+ layers: "层数",
136
+ layersValue: (layers) => `${String(layers)} 层`,
137
+ outline: "外形尺寸",
138
+ thickness: "板厚",
139
+ minTrace: "最小线宽",
140
+ minDrill: "最小钻孔",
141
+ outerCopper: "外层铜厚",
142
+ defaultValue: "默认",
143
+ copperValue: (oz) => `${String(oz)} oz`,
144
+ agentEntryPoints: "Agent 入口",
145
+ submitting: "提交中…",
146
+ resultTitlePcb: "PCB 订单已创建",
147
+ resultTitleSmt: "贴片订单已创建",
148
+ resultLaunched: "已在浏览器打开",
149
+ resultReady: "待打开",
150
+ resultNote: "与 KiCad 在下单窗口中展示的是同一个页面,已在你的默认浏览器中打开。",
151
+ resultLaunchedMessage: (kind) => `已在默认浏览器中打开「${kind}」订单页。`,
152
+ resultReadyMessage: (kind) => `「${kind}」订单页已就绪,打开链接即可继续。`,
153
+ openInBrowser: "在浏览器打开",
154
+ opening: "正在打开…",
155
+ copyUrl: "复制链接",
156
+ copied: "已复制",
157
+ confirmAria: "确认下单上传",
158
+ confirmTitlePcb: "上传板文件并创建 PCB 订单?",
159
+ confirmTitleSmt: "上传贴片文件包?",
160
+ confirmBody: "以下文件将发送到华秋下单服务。订单在那里创建,其页面会在你的默认浏览器中打开;付款仍在该页面完成。",
161
+ confirmZip: (zip, size) => `${zip} — Gerber 与钻孔文件(${size})`,
162
+ confirmPositions: (size) => `元件坐标(${size})`,
163
+ confirmBom: (size) => `贴片 BOM(${size})`,
164
+ confirmHost: (baseUrl) => baseUrl ?? "已配置的下单服务",
165
+ confirmAck: "我了解这些板文件将离开本机。",
166
+ cancel: "取消",
167
+ uploadAndOpen: "上传并打开订单页",
168
+ uploading: "正在上传…",
169
+ batch: "生产数量",
170
+ batchUnits: (count) => `${String(count)} 片`,
171
+ quoteBasis: (count) => `报价基准 · ${String(count)} 片`
172
+ },
173
+ /** First-run setup wizard. */
174
+ wizard: {
175
+ steps: [
176
+ "欢迎",
177
+ "KiCad",
178
+ "SolidCraft"
179
+ ],
180
+ stepCounter: (index, total, label) => `${String(index)}/${String(total)} · ${label}`,
181
+ aria: "硬件工程初始化",
182
+ welcomeTitle: "配置你的硬件工具链",
183
+ welcomeKicker: "仅需一次 · 可跳过",
184
+ welcomeLead: "硬件工程可预览 KiCad 工程、导出 PCB 三维模型、打包制板文件并调用本地程序打开文件。只需指定一次本地安装位置。",
185
+ welcomeUsesTitle: "使用到的组件",
186
+ welcomeUses: "kicad-cli 负责预览、BOM、GLB 与 Gerber/钻孔打包。SolidCraft 仅作为环境上下文提供给 Agent。",
187
+ welcomeLocal: "只使用本机的可执行文件。不会上传任何内容,也不会替你安装任何东西。",
188
+ kicadTitle: "KiCad 安装位置",
189
+ kicadOptional: "可选",
190
+ kicadLead: "填写 KiCad 安装目录或 kicad-cli 路径。它用于 .kicad_sch / .kicad_pcb 预览、PCB 的 GLB 导出、制板文件打包,以及「用 KiCad 打开」。",
191
+ kicadPlaceholder: "C:\\Program Files\\KiCad\\8.0\\ 或 /usr/bin/kicad-cli",
192
+ kicadSkipHint: "留空即跳过。之后可在「设置 → 硬件工程」中配置。",
193
+ solidcraftTitle: "SolidCraft 安装位置",
194
+ solidcraftLead: "本 POC 中 SolidCraft 仅作为环境上下文提供给 Agent——不启动本地程序,也不做结构预览。",
195
+ solidcraftPlaceholder: "C:\\Program Files\\SolidCraft\\bin\\SolidCraft.exe",
196
+ skip: "跳过设置",
197
+ back: "上一步",
198
+ next: "下一步",
199
+ finish: "完成",
200
+ saving: "保存中…",
201
+ footerNote: "随时可在「设置 → 硬件工程」中修改。"
202
+ },
203
+ /** Settings section (the two CAD installation roots). */
204
+ settings: {
205
+ title: "硬件工程",
206
+ lead: "用于预览、制板打包、一键调用本地程序以及 Agent 环境上下文的本地 EDA / MCAD 可执行文件。",
207
+ kicadTitle: "KiCad EDA 套件",
208
+ kicadBlurb: "可填 KiCad 安装目录或 kicad-cli 路径。用于 .kicad_sch / .kicad_pcb 预览、GLB 导出、BOM、Gerber 打包与本地打开。",
209
+ kicadPlaceholder: "C:\\Program Files\\KiCad\\8.0\\ 或 /usr/bin/kicad-cli",
210
+ solidcraftTitle: "SolidCraft 三维 CAD",
211
+ solidcraftBlurb: "本 POC 中仅用于 Agent 环境上下文。不启动本地程序,也不做结构预览;「3D 模型」页签渲染的是所选 PCB。",
212
+ solidcraftPlaceholder: "C:\\Program Files\\SolidCraft\\bin\\SolidCraft.exe",
213
+ pathField: (title) => `${title}路径`,
214
+ validate: "校验并保存",
215
+ validating: "校验中…",
216
+ configured: "已配置",
217
+ notConfigured: "未配置",
218
+ notDetected: "未检测到",
219
+ savedAndValidated: (application) => `${application} 校验通过并已保存。`,
220
+ savedButInvalid: (application, detail) => `${application} 已保存,但校验失败:${detail}`,
221
+ hostSettingsUnavailable: "宿主未提供设置服务,无法保存。",
222
+ hostRejected: (application) => `宿主拒绝了${application}的设置。`
223
+ },
224
+ /**
225
+ * Host error sentences, keyed by the stable `code` in the route envelope
226
+ * (`packages/hardware-artifacts/src/routes.ts`). A code missing here is not a
227
+ * bug in the UI: the host detail is then shown verbatim, which is the right
228
+ * answer for an unmodelled failure.
229
+ */
230
+ errors: {
231
+ unauthorized: "没有权限访问该产物:它不在当前会话的工作区授权范围内。",
232
+ forbidden: "没有权限执行该操作。",
233
+ "missing-artifact": "该产物不存在。",
234
+ "unsupported-artifact": "不支持该产物类型。",
235
+ "invalid-identity": "产物路径无效。",
236
+ "missing-executable": "已配置的 KiCad 中没有可打开该产物的程序。",
237
+ "not-configured": "尚未配置 KiCad。请在「设置 → 硬件工程」中填写安装位置。",
238
+ "too-large": "产物超过可预览的大小上限。",
239
+ "export-timeout": "kicad-cli 执行超时。",
240
+ "export-failed": "kicad-cli 导出失败。",
241
+ "stale-revision": "文件已变化,请刷新后重试。",
242
+ "invalid-request": "请求参数不完整。",
243
+ "invalid-application": "不支持该本地程序。",
244
+ "confirmation-required": "下单需要先在上传确认框中确认。",
245
+ "invalid-order-url": "订单链接无效,已拒绝打开。",
246
+ "order-unreachable": "无法连接下单服务。",
247
+ "order-rejected": "下单服务未能返回可用的订单页。",
248
+ "not-found": "未找到该接口。",
249
+ internal: "服务内部错误。"
250
+ }
251
+ };
252
+ /**
253
+ * Codes whose host detail is a technical tail worth keeping next to the
254
+ * translated sentence: kicad-cli stderr, an HTTP failure, a backend payload.
255
+ * For the rest the detail merely restates the sentence in English.
256
+ */
257
+ const KEEPS_DETAIL = /* @__PURE__ */ new Set([
258
+ "export-failed",
259
+ "order-unreachable",
260
+ "order-rejected",
261
+ "invalid-order-url",
262
+ "internal"
263
+ ]);
264
+ /**
265
+ * One host error → one zh_CN sentence.
266
+ *
267
+ * `detail` is the host's own message. Unknown codes keep it untouched, so an
268
+ * unmodelled failure still says something specific instead of collapsing into
269
+ * a generic "出错了".
270
+ */
271
+ function describeHostError(code, detail) {
272
+ if (code === void 0) return detail;
273
+ const sentence = COPY.errors[code];
274
+ if (sentence === void 0) return detail;
275
+ return KEEPS_DETAIL.has(code) && detail !== "" ? `${sentence}(${detail})` : sentence;
276
+ }
277
+ /**
278
+ * Translate one discovery `issue` without losing the host's specifics.
279
+ *
280
+ * The count and the workspace come from the discovery result, not from the
281
+ * host sentence, so the wording does not depend on how the host phrased it.
282
+ */
283
+ function issueText(issue, context = {}) {
284
+ switch (issue.code) {
285
+ case "selection-required": return context.count !== void 0 && context.count > 1 ? COPY.discovery.selectionRequiredCount(context.count) : COPY.discovery.selectionRequiredArtifact;
286
+ case "no-project": return COPY.discovery.noProject(context.cwd ?? "");
287
+ case "missing-project": return COPY.discovery.missingProject(issue.message.replace(/\s+does not exist\s*$/u, ""));
288
+ case "bad-manifest": return COPY.discovery.badManifest(issue.message.replace(/^invalid \.hardware-engineering\.json:\s*/u, ""));
289
+ default: return issue.message;
290
+ }
291
+ }
292
+ //#endregion
8
293
  //#region src/client/model.ts
294
+ /** Product-owned navigation and artifact identity. No shadow project database. */
9
295
  const DESTINATIONS = Object.freeze([
10
296
  "schematic",
11
297
  "pcb",
@@ -13,12 +299,20 @@ window.__ModuleLoader__.load({
13
299
  "3d",
14
300
  "order"
15
301
  ]);
302
+ /**
303
+ * Visible destination labels, in `DESTINATIONS` order.
304
+ *
305
+ * Read from the copy module rather than written here: the same strings are
306
+ * rendered from the navigation row and the viewer strip, and the two must never
307
+ * disagree. Keys stay in destination order because the navigation maps over
308
+ * `DESTINATIONS`, not over this object.
309
+ */
16
310
  const DESTINATION_LABELS = Object.freeze({
17
- schematic: "Schematic",
18
- pcb: "PCB",
19
- bom: "BOM",
20
- "3d": "3D CAD",
21
- order: "Order Placing"
311
+ schematic: COPY.destinations.schematic,
312
+ pcb: COPY.destinations.pcb,
313
+ bom: COPY.destinations.bom,
314
+ "3d": COPY.destinations["3d"],
315
+ order: COPY.destinations.order
22
316
  });
23
317
  /** Which native application a destination can open, if any. */
24
318
  function applicationFor(destination) {
@@ -105943,16 +106237,37 @@ while (n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3]
105943
106237
  */
105944
106238
  //#endregion
105945
106239
  //#region src/client/transport.ts
106240
+ /** Same-origin calls to the `@huaqiu/hardware-artifacts` Host routes. */
105946
106241
  const PREFIX = "/api/v1/hardware";
106242
+ /**
106243
+ * One failed call → one `Error` whose message is already user-facing zh_CN.
106244
+ *
106245
+ * The route envelope carries a stable `code`, so the sentence is chosen here
106246
+ * instead of at every render site (the panel, the stages and the settings
106247
+ * section all show `error.message`). The code stays on the error object for
106248
+ * callers that branch on it. Host detail survives inside the message only when
106249
+ * {@link describeHostError} judges it technical rather than prose.
106250
+ */
105947
106251
  async function request(path, init) {
105948
106252
  const response = await fetch(`${PREFIX}${path}`, init);
105949
106253
  const body = await response.json().catch(() => void 0);
105950
106254
  if (!response.ok || body?.ok === false) {
106255
+ const code = body?.error?.code;
105951
106256
  const detail = body?.error?.message ?? `HTTP ${response.status}`;
105952
- throw new Error(body?.error?.code === void 0 ? detail : `${body.error.code}: ${detail}`);
106257
+ const error = new Error(describeHostError(code, detail));
106258
+ throw code === void 0 ? error : Object.assign(error, { code });
105953
106259
  }
105954
106260
  return body;
105955
106261
  }
106262
+ /**
106263
+ * Readable text of a thrown value.
106264
+ *
106265
+ * `String(new Error('x'))` is `"Error: x"`, which is why every message the UI
106266
+ * renders goes through here instead of `String(error)`.
106267
+ */
106268
+ function messageOf(error) {
106269
+ return error instanceof Error ? error.message : String(error);
106270
+ }
105956
106271
  function query(cwd, project, session) {
105957
106272
  const params = new URLSearchParams();
105958
106273
  if (cwd !== void 0 && cwd !== "") params.set("cwd", cwd);
@@ -106079,7 +106394,7 @@ while (n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3]
106079
106394
  ...options.session === void 0 ? {} : { session: options.session }
106080
106395
  });
106081
106396
  if (options.signal.aborted) throw aborted$1(options.signal);
106082
- if (source.kind !== void 0 && source.kind !== kind) throw new Error(`host returned a ${source.kind} artifact for a ${kind} preview`);
106397
+ if (source.kind !== void 0 && source.kind !== kind) throw new Error(COPY.preview.ecadKindMismatch(kind, source.kind));
106083
106398
  const canvas = document.createElement("canvas");
106084
106399
  canvas.style.cssText = "position:absolute;inset:0;display:block;width:100%;height:100%;outline:none";
106085
106400
  container.append(canvas);
@@ -143508,34 +143823,31 @@ void main() {
143508
143823
  if (bytes < 1048576) return `${(bytes / 1024).toFixed(1)} KB`;
143509
143824
  return `${(bytes / 1048576).toFixed(2)} MB`;
143510
143825
  }
143511
- function describe$1(error) {
143512
- return error instanceof Error ? error.message : String(error);
143513
- }
143514
143826
  function specRows(facts) {
143515
143827
  return [
143516
143828
  {
143517
- label: "Layers",
143518
- value: `${String(facts.layers)} Cu`
143829
+ label: COPY.order.layers,
143830
+ value: COPY.order.layersValue(facts.layers)
143519
143831
  },
143520
143832
  {
143521
- label: "Outline",
143833
+ label: COPY.order.outline,
143522
143834
  value: `${facts.widthMm.toFixed(1)} × ${facts.heightMm.toFixed(1)} mm`
143523
143835
  },
143524
143836
  {
143525
- label: "Thickness",
143837
+ label: COPY.order.thickness,
143526
143838
  value: `${facts.thicknessMm.toFixed(2)} mm`
143527
143839
  },
143528
143840
  {
143529
- label: "Min trace",
143530
- value: facts.minTrackMm === void 0 ? "default" : `${facts.minTrackMm.toFixed(2)} mm`
143841
+ label: COPY.order.minTrace,
143842
+ value: facts.minTrackMm === void 0 ? COPY.order.defaultValue : `${facts.minTrackMm.toFixed(2)} mm`
143531
143843
  },
143532
143844
  {
143533
- label: "Min drill",
143534
- value: facts.minViaDrillMm === void 0 ? "default" : `${facts.minViaDrillMm.toFixed(2)} mm`
143845
+ label: COPY.order.minDrill,
143846
+ value: facts.minViaDrillMm === void 0 ? COPY.order.defaultValue : `${facts.minViaDrillMm.toFixed(2)} mm`
143535
143847
  },
143536
143848
  {
143537
- label: "Outer Cu",
143538
- value: `${String(facts.outerOz ?? 1)} oz`
143849
+ label: COPY.order.outerCopper,
143850
+ value: COPY.order.copperValue(facts.outerOz ?? 1)
143539
143851
  }
143540
143852
  ];
143541
143853
  }
@@ -143656,7 +143968,7 @@ void main() {
143656
143968
  disabled: blocked || input.busy,
143657
143969
  "data-hardware-order-action": input.tag.toLowerCase(),
143658
143970
  onClick: input.onAction
143659
- }, input.busy ? "Submitting…" : input.action));
143971
+ }, input.busy ? COPY.order.submitting : input.action));
143660
143972
  }
143661
143973
  function OrderPanel(props) {
143662
143974
  const { boardPath, boardTitle, schematicPath, workspaceRoot, session, configured } = props;
@@ -143682,7 +143994,7 @@ void main() {
143682
143994
  loadOrderConfig().then((value) => {
143683
143995
  if (live.current) setConfig(value);
143684
143996
  }).catch((error) => {
143685
- if (live.current) setMessage(describe$1(error));
143997
+ if (live.current) setMessage(messageOf(error));
143686
143998
  });
143687
143999
  }, []);
143688
144000
  (0, react.useEffect)(() => {
@@ -143698,7 +144010,7 @@ void main() {
143698
144010
  if (!controller.signal.aborted) setPrepared(value);
143699
144011
  }).catch((error) => {
143700
144012
  if (controller.signal.aborted || isAbortError(error)) return;
143701
- setMessage(describe$1(error));
144013
+ setMessage(messageOf(error));
143702
144014
  }).finally(() => {
143703
144015
  if (!controller.signal.aborted) setPreparing(false);
143704
144016
  });
@@ -143730,7 +144042,7 @@ void main() {
143730
144042
  setConfirming(void 0);
143731
144043
  setAcknowledged(false);
143732
144044
  } catch (error) {
143733
- setMessage(describe$1(error));
144045
+ setMessage(messageOf(error));
143734
144046
  } finally {
143735
144047
  setPlacing(void 0);
143736
144048
  }
@@ -143759,7 +144071,7 @@ void main() {
143759
144071
  status: "launched"
143760
144072
  });
143761
144073
  } catch (error) {
143762
- setMessage(describe$1(error));
144074
+ setMessage(messageOf(error));
143763
144075
  } finally {
143764
144076
  setReopening(false);
143765
144077
  }
@@ -143779,12 +144091,12 @@ void main() {
143779
144091
  display: "flex",
143780
144092
  alignItems: "center",
143781
144093
  gap: 6
143782
- } }, (0, react.createElement)("span", { style: dotStyle(C.accent) }), "Fabrication & assembly"), preparing ? (0, react.createElement)("span", { style: pillStyle("info") }, "packaging…") : prepared !== void 0 ? (0, react.createElement)("span", { style: pillStyle("ok") }, "package ready") : (0, react.createElement)("span", { style: pillStyle(configured ? "muted" : "warn") }, configured ? "not prepared" : "KiCad missing")), (0, react.createElement)("p", { style: {
144094
+ } }, (0, react.createElement)("span", { style: dotStyle(C.accent) }), COPY.order.title), preparing ? (0, react.createElement)("span", { style: pillStyle("info") }, COPY.order.packaging) : prepared !== void 0 ? (0, react.createElement)("span", { style: pillStyle("ok") }, COPY.order.packageReady) : (0, react.createElement)("span", { style: pillStyle(configured ? "muted" : "warn") }, configured ? COPY.order.packagePending : COPY.viewer.kicadMissing)), (0, react.createElement)("p", { style: {
143783
144095
  ...MUTED,
143784
144096
  ...MONO_TEXT,
143785
144097
  fontSize: 10.5
143786
144098
  } }, boardTitle));
143787
- const packageCard = (0, react.createElement)("div", { style: cardStyle() }, (0, react.createElement)("div", { style: SPREAD$1 }, (0, react.createElement)("span", { style: SECTION_TITLE }, "Fabrication package"), prepared === void 0 ? null : (0, react.createElement)("span", { style: pillStyle("muted") }, `${String(prepared.archive.files.length)} files · ${zipSize}`)), prepared === void 0 ? (0, react.createElement)("p", { style: MUTED }, preparing ? "Running kicad-cli pcb export gerbers and drill…" : "Not prepared yet.") : (0, react.createElement)("div", { style: {
144099
+ const packageCard = (0, react.createElement)("div", { style: cardStyle() }, (0, react.createElement)("div", { style: SPREAD$1 }, (0, react.createElement)("span", { style: SECTION_TITLE }, COPY.order.packageCard), prepared === void 0 ? null : (0, react.createElement)("span", { style: pillStyle("muted") }, COPY.order.packageFiles(prepared.archive.files.length, zipSize ?? ""))), prepared === void 0 ? (0, react.createElement)("p", { style: MUTED }, preparing ? COPY.order.packageRunning : COPY.order.packageNotPrepared) : (0, react.createElement)("div", { style: {
143788
144100
  display: "flex",
143789
144101
  flexWrap: "wrap",
143790
144102
  gap: 4,
@@ -143806,46 +144118,46 @@ void main() {
143806
144118
  const pcbCard = workflowCard({
143807
144119
  tag: "PCB",
143808
144120
  tagColor: C.ok,
143809
- title: "Bare board fabrication",
143810
- subtitle: prepared === void 0 ? "Quotes and orders the selected board through the Huaqiu fabrication service." : `${prepared.archive.zipName} · ${String(prepared.archive.files.length)} gerber/drill files · ${zipSize}`,
144121
+ title: COPY.order.pcbTitle,
144122
+ subtitle: prepared === void 0 ? COPY.order.pcbSubtitle : COPY.order.pcbSummary(prepared.archive.zipName, prepared.archive.files.length, zipSize ?? ""),
143811
144123
  details: specs.length === 0 ? [{
143812
- label: "Board",
144124
+ label: COPY.order.boardFile,
143813
144125
  value: boardTitle
143814
144126
  }] : specs,
143815
- action: "Submit PCB order",
144127
+ action: COPY.order.pcbAction,
143816
144128
  onAction: () => {
143817
144129
  setAcknowledged(false);
143818
144130
  setConfirming("pcb");
143819
144131
  },
143820
144132
  busy: placing === "pcb",
143821
- ...configured && prepared !== void 0 ? tokenReady ? {} : { blocked: "Sign in to Huaqiu to place an order — the order page opens under your account." } : { blocked: configured ? "Waiting for the fabrication package." : "Configure KiCad to package the board files." }
144133
+ ...configured && prepared !== void 0 ? tokenReady ? {} : { blocked: COPY.order.signInToOrder } : { blocked: configured ? COPY.order.waitingForPackage : COPY.order.configureToPackage }
143822
144134
  });
143823
144135
  const smtCard = workflowCard({
143824
144136
  tag: "PCBA",
143825
144137
  tagColor: C.info,
143826
- title: "Turnkey assembly",
143827
- subtitle: assembly === void 0 ? "Needs the project root schematic for the BOM and component positions." : `${String(assembly.positions)} placements · ${String(assembly.bomLines)} BOM lines · ${formatBytes(assembly.bomBytes + assembly.positionsBytes)}`,
144138
+ title: COPY.order.smtTitle,
144139
+ subtitle: assembly === void 0 ? COPY.order.smtSubtitle : COPY.order.smtSummary(assembly.positions, assembly.bomLines, formatBytes(assembly.bomBytes + assembly.positionsBytes)),
143828
144140
  details: [
143829
144141
  {
143830
- label: "Placements",
144142
+ label: COPY.order.placements,
143831
144143
  value: assembly === void 0 ? "—" : String(assembly.positions)
143832
144144
  },
143833
144145
  {
143834
- label: "BOM lines",
144146
+ label: COPY.order.bomLines,
143835
144147
  value: assembly === void 0 ? "—" : String(assembly.bomLines)
143836
144148
  },
143837
144149
  {
143838
- label: "Token",
143839
- value: tokenReady ? "Huaqiu login" : "signed out"
144150
+ label: COPY.order.credential,
144151
+ value: tokenReady ? COPY.order.signedIn : COPY.order.signedOut
143840
144152
  }
143841
144153
  ],
143842
- action: "Submit assembly order",
144154
+ action: COPY.order.smtAction,
143843
144155
  onAction: () => {
143844
144156
  setAcknowledged(false);
143845
144157
  setConfirming("smt");
143846
144158
  },
143847
144159
  busy: placing === "smt",
143848
- ...assembly === void 0 ? { blocked: "Select a root schematic so the BOM and positions can be built." } : tokenReady ? {} : { blocked: "Sign in to Huaqiu to order assembly — the page opens under your account." }
144160
+ ...assembly === void 0 ? { blocked: COPY.order.selectRootSchematic } : tokenReady ? {} : { blocked: COPY.order.signInToOrderSmt }
143849
144161
  });
143850
144162
  const agentHint = (0, react.createElement)("div", { style: {
143851
144163
  ...ROW$2,
@@ -143854,7 +144166,7 @@ void main() {
143854
144166
  } }, (0, react.createElement)("span", { style: {
143855
144167
  fontSize: 10,
143856
144168
  color: C.text3
143857
- } }, "Agent entry points"), ...[
144169
+ } }, COPY.order.agentEntryPoints), ...[
143858
144170
  "quote_pcb",
143859
144171
  "place_pcb_order",
143860
144172
  "quote_smt",
@@ -143869,7 +144181,7 @@ void main() {
143869
144181
  const resultCard = placed === void 0 ? null : (0, react.createElement)("div", {
143870
144182
  style: cardStyle({ borderColor: "rgba(52,211,153,0.4)" }),
143871
144183
  "data-hardware-order-result": placed.kind
143872
- }, (0, react.createElement)("div", { style: SPREAD$1 }, (0, react.createElement)("span", { style: SECTION_TITLE }, `${placed.kind === "pcb" ? "PCB" : "Assembly"} order created`), (0, react.createElement)("span", { style: pillStyle(placed.launched ? "ok" : "muted") }, placed.launched ? "opened in browser" : "ready to open")), (0, react.createElement)("p", { style: MUTED }, placed.message), (0, react.createElement)("a", {
144184
+ }, (0, react.createElement)("div", { style: SPREAD$1 }, (0, react.createElement)("span", { style: SECTION_TITLE }, placed.kind === "pcb" ? COPY.order.resultTitlePcb : COPY.order.resultTitleSmt), (0, react.createElement)("span", { style: pillStyle(placed.launched ? "ok" : "muted") }, placed.launched ? COPY.order.resultLaunched : COPY.order.resultReady)), (0, react.createElement)("p", { style: MUTED }, placed.launched ? COPY.order.resultLaunchedMessage(placed.kind === "pcb" ? "PCB" : "贴片") : COPY.order.resultReadyMessage(placed.kind === "pcb" ? "PCB" : "贴片")), (0, react.createElement)("a", {
143873
144185
  style: LINK,
143874
144186
  href: placed.orderUrl,
143875
144187
  target: "_blank",
@@ -143878,7 +144190,7 @@ void main() {
143878
144190
  }, placed.orderUrl), (0, react.createElement)("p", { style: {
143879
144191
  ...MUTED,
143880
144192
  fontSize: 10
143881
- } }, "Same page KiCad shows in its order webview, opened in your default browser."), (0, react.createElement)("div", { style: ROW$2 }, (0, react.createElement)("button", {
144193
+ } }, COPY.order.resultNote), (0, react.createElement)("div", { style: ROW$2 }, (0, react.createElement)("button", {
143882
144194
  type: "button",
143883
144195
  style: {
143884
144196
  ...buttonStyle("primary"),
@@ -143889,13 +144201,13 @@ void main() {
143889
144201
  onClick: () => {
143890
144202
  reopen();
143891
144203
  }
143892
- }, reopening ? "Opening…" : "Open in browser"), (0, react.createElement)("button", {
144204
+ }, reopening ? COPY.order.opening : COPY.order.openInBrowser), (0, react.createElement)("button", {
143893
144205
  type: "button",
143894
144206
  style: buttonStyle("secondary"),
143895
144207
  onClick: () => {
143896
144208
  copy();
143897
144209
  }
143898
- }, copied ? "Copied" : "Copy URL"), (0, react.createElement)("span", { style: {
144210
+ }, copied ? COPY.order.copied : COPY.order.copyUrl), (0, react.createElement)("span", { style: {
143899
144211
  ...MUTED,
143900
144212
  ...MONO_TEXT,
143901
144213
  fontSize: 10
@@ -143904,7 +144216,7 @@ void main() {
143904
144216
  style: DIALOG_BACKDROP,
143905
144217
  role: "dialog",
143906
144218
  "aria-modal": true,
143907
- "aria-label": "Confirm order upload",
144219
+ "aria-label": COPY.order.confirmAria,
143908
144220
  "data-hardware-order-confirm": confirming
143909
144221
  }, (0, react.createElement)("div", { style: DIALOG }, (0, react.createElement)("div", { style: {
143910
144222
  display: "flex",
@@ -143914,13 +144226,13 @@ void main() {
143914
144226
  margin: 0,
143915
144227
  fontSize: 13,
143916
144228
  fontWeight: 600
143917
- } }, confirming === "pcb" ? "Upload board files and create the PCB order?" : "Upload the assembly package?"), (0, react.createElement)("p", { style: MUTED }, "This sends the files below to the Huaqiu order service. The order is created there and its page opens in your default browser; payment still happens on that page.")), (0, react.createElement)("ul", { style: {
144229
+ } }, confirming === "pcb" ? COPY.order.confirmTitlePcb : COPY.order.confirmTitleSmt), (0, react.createElement)("p", { style: MUTED }, COPY.order.confirmBody)), (0, react.createElement)("ul", { style: {
143918
144230
  margin: 0,
143919
144231
  paddingLeft: 16,
143920
144232
  fontSize: 11,
143921
144233
  color: C.text2,
143922
144234
  lineHeight: 1.7
143923
- } }, (0, react.createElement)("li", null, `${prepared?.archive.zipName ?? "board.zip"} — gerbers and drill files (${zipSize ?? "—"})`), ...confirming === "smt" ? [(0, react.createElement)("li", { key: "pos" }, `Component positions (${assembly === void 0 ? "—" : formatBytes(assembly.positionsBytes)})`), (0, react.createElement)("li", { key: "bom" }, `Assembly BOM (${assembly === void 0 ? "—" : formatBytes(assembly.bomBytes)})`)] : [], (0, react.createElement)("li", { key: "host" }, (0, react.createElement)("span", { style: MONO_TEXT }, config?.baseUrl ?? "the configured order service"))), (0, react.createElement)("label", { style: {
144235
+ } }, (0, react.createElement)("li", null, COPY.order.confirmZip(prepared?.archive.zipName ?? "board.zip", zipSize ?? "—")), ...confirming === "smt" ? [(0, react.createElement)("li", { key: "pos" }, COPY.order.confirmPositions(assembly === void 0 ? "—" : formatBytes(assembly.positionsBytes))), (0, react.createElement)("li", { key: "bom" }, COPY.order.confirmBom(assembly === void 0 ? "—" : formatBytes(assembly.bomBytes)))] : [], (0, react.createElement)("li", { key: "host" }, (0, react.createElement)("span", { style: MONO_TEXT }, COPY.order.confirmHost(config?.baseUrl)))), (0, react.createElement)("label", { style: {
143924
144236
  ...ROW$2,
143925
144237
  alignItems: "flex-start",
143926
144238
  fontSize: 11,
@@ -143937,7 +144249,7 @@ void main() {
143937
144249
  setAcknowledged(event.currentTarget.checked);
143938
144250
  },
143939
144251
  "data-hardware-order-ack": true
143940
- }), "I understand these board files leave this machine."), (0, react.createElement)("div", { style: {
144252
+ }), COPY.order.confirmAck), (0, react.createElement)("div", { style: {
143941
144253
  ...ROW$2,
143942
144254
  justifyContent: "flex-end"
143943
144255
  } }, (0, react.createElement)("button", {
@@ -143947,7 +144259,7 @@ void main() {
143947
144259
  setConfirming(void 0);
143948
144260
  setAcknowledged(false);
143949
144261
  }
143950
- }, "Cancel"), (0, react.createElement)("button", {
144262
+ }, COPY.order.cancel), (0, react.createElement)("button", {
143951
144263
  type: "button",
143952
144264
  style: {
143953
144265
  ...buttonStyle("primary"),
@@ -143958,7 +144270,7 @@ void main() {
143958
144270
  onClick: () => {
143959
144271
  submit(confirming);
143960
144272
  }
143961
- }, placing === void 0 ? "Upload and open order page" : "Uploading…"))));
144273
+ }, placing === void 0 ? COPY.order.uploadAndOpen : COPY.order.uploading))));
143962
144274
  return (0, react.createElement)("div", {
143963
144275
  style: {
143964
144276
  position: "relative",
@@ -143990,7 +144302,7 @@ void main() {
143990
144302
  } }, (0, react.createElement)("span", { style: {
143991
144303
  fontSize: 11,
143992
144304
  color: C.text2
143993
- } }, "Production batch"), (0, react.createElement)("select", {
144305
+ } }, COPY.order.batch), (0, react.createElement)("select", {
143994
144306
  style: {
143995
144307
  ...SELECT,
143996
144308
  width: "auto"
@@ -144003,11 +144315,11 @@ void main() {
144003
144315
  }, ...QUANTITIES.map((count) => (0, react.createElement)("option", {
144004
144316
  key: count,
144005
144317
  value: count
144006
- }, `${String(count)} units`))), (0, react.createElement)("span", { style: {
144318
+ }, COPY.order.batchUnits(count)))), (0, react.createElement)("span", { style: {
144007
144319
  ...MUTED,
144008
144320
  ...MONO_TEXT,
144009
144321
  fontSize: 10
144010
- } }, `quote basis · ${String(quantity)} pcs`)), packageCard, resultCard, agentHint, dialog);
144322
+ } }, COPY.order.quoteBasis(quantity))), packageCard, resultCard, agentHint, dialog);
144011
144323
  }
144012
144324
  //#endregion
144013
144325
  //#region src/client/preview.tsx
@@ -144061,6 +144373,9 @@ void main() {
144061
144373
  flexDirection: "column",
144062
144374
  alignItems: "center",
144063
144375
  justifyContent: "center",
144376
+ flex: "1 1 auto",
144377
+ width: "100%",
144378
+ boxSizing: "border-box",
144064
144379
  height: "100%",
144065
144380
  gap: 6,
144066
144381
  padding: 20,
@@ -144098,14 +144413,19 @@ void main() {
144098
144413
  color: C.text
144099
144414
  };
144100
144415
  R.md, C.base, C.text2;
144101
- function describe(error) {
144102
- return error instanceof Error ? error.message : String(error);
144103
- }
144104
144416
  function shortRevision(revision) {
144105
144417
  return revision === void 0 ? "" : revision.slice(0, 10);
144106
144418
  }
144107
- function statusLine(status, message, hint) {
144108
- const text = message ?? (status === "loading" ? "Loading saved artifact…" : "");
144419
+ /**
144420
+ * The stage's placeholder: what is missing, why, and what to do about it.
144421
+ *
144422
+ * Every variant is one centred column, so an empty schematic, an empty BOM and a
144423
+ * failed export sit in the same place. A placeholder never stops at "not
144424
+ * available": the last line always says how the artifact can exist — normally by
144425
+ * asking the agent to create it.
144426
+ */
144427
+ function statusLine(status, input) {
144428
+ const text = input.message ?? (status === "loading" ? COPY.preview.loading : "");
144109
144429
  return (0, react.createElement)("div", {
144110
144430
  style: CENTER,
144111
144431
  role: "status",
@@ -144120,11 +144440,17 @@ void main() {
144120
144440
  } }) : (0, react.createElement)("span", { style: {
144121
144441
  ...pillStyle("warn"),
144122
144442
  fontFamily: MONO
144123
- } }, "unavailable"), (0, react.createElement)("p", { style: CENTER_TEXT }, text), hint === void 0 ? null : (0, react.createElement)("p", { style: {
144443
+ } }, input.title), text === "" ? null : (0, react.createElement)("p", { style: CENTER_TEXT }, text), input.hint === void 0 ? null : (0, react.createElement)("p", { style: {
144124
144444
  ...CENTER_TEXT,
144125
- fontSize: 10,
144126
- color: C.text3
144127
- } }, hint));
144445
+ fontSize: 10
144446
+ } }, input.hint), input.guidance === void 0 ? null : (0, react.createElement)("p", {
144447
+ style: {
144448
+ ...CENTER_TEXT,
144449
+ fontSize: 10.5,
144450
+ color: C.text2
144451
+ },
144452
+ "data-hardware-guidance": true
144453
+ }, input.guidance));
144128
144454
  }
144129
144455
  function Stage(props) {
144130
144456
  return (0, react.createElement)("div", {
@@ -144166,7 +144492,7 @@ void main() {
144166
144492
  }).catch((error) => {
144167
144493
  if (!live || isAbortError(error)) return;
144168
144494
  setStatus("error");
144169
- setMessage(describe(error));
144495
+ setMessage(messageOf(error));
144170
144496
  });
144171
144497
  return () => {
144172
144498
  live = false;
@@ -144190,22 +144516,29 @@ void main() {
144190
144516
  ...pillStyle("muted"),
144191
144517
  fontSize: 9.5
144192
144518
  }
144193
- }, kind === "schematic" ? "sheet" : "board"), sourceRevision === void 0 ? null : (0, react.createElement)("span", {
144519
+ }, kind === "schematic" ? COPY.preview.kindSchematic : COPY.preview.kindBoard), sourceRevision === void 0 ? null : (0, react.createElement)("span", {
144194
144520
  key: "rev",
144195
144521
  style: {
144196
144522
  ...pillStyle("muted"),
144197
144523
  fontSize: 9.5
144198
144524
  }
144199
- }, `rev ${shortRevision(sourceRevision)}`)] : void 0,
144525
+ }, COPY.preview.revision(shortRevision(sourceRevision)))] : void 0,
144200
144526
  overlay: status === "ready" ? [(0, react.createElement)("span", {
144201
144527
  key: "dot",
144202
144528
  style: dotStyle(kind === "schematic" ? C.info : C.ok, 6)
144203
- }), "saved file · scroll to zoom, drag to pan"] : void 0
144529
+ }), COPY.preview.ecadOverlay] : void 0
144204
144530
  }, (0, react.createElement)("div", { style: {
144205
144531
  position: "relative",
144206
144532
  flex: "1 1 0",
144207
144533
  minHeight: 160
144208
- } }, ...status === "ready" ? [] : [statusLine(status, message, status === "error" ? "Saved-file preview only; the file must exist and parse." : void 0)], (0, react.createElement)("div", {
144534
+ } }, ...status === "ready" ? [] : [statusLine(status, {
144535
+ title: COPY.placeholder.title[kind],
144536
+ ...message === void 0 ? {} : { message },
144537
+ ...status === "error" ? {
144538
+ hint: COPY.preview.ecadHint,
144539
+ guidance: COPY.placeholder.guide[kind]
144540
+ } : {}
144541
+ })], (0, react.createElement)("div", {
144209
144542
  key: "canvas",
144210
144543
  ref: container,
144211
144544
  style: {
@@ -144225,21 +144558,21 @@ void main() {
144225
144558
  if (element === null) return;
144226
144559
  if (!configured) {
144227
144560
  setStatus("error");
144228
- setMessage("KiCad is not configured.");
144561
+ setMessage(COPY.preview.kicadNotConfigured);
144229
144562
  return;
144230
144563
  }
144231
144564
  const controller = new AbortController();
144232
144565
  let live = true;
144233
144566
  let mounted;
144234
144567
  setStatus("loading");
144235
- setMessage("Exporting the PCB to GLB with kicad-cli…");
144568
+ setMessage(COPY.preview.glbExporting);
144236
144569
  element.replaceChildren();
144237
144570
  const run = async () => {
144238
144571
  const glb = await prepareBoardGlb(boardPath, cwd, controller.signal, session);
144239
144572
  if (!live) return;
144240
144573
  setRevision(glb.revision);
144241
144574
  setCached(glb.cached);
144242
- setMessage("Loading the 3D model…");
144575
+ setMessage(COPY.preview.glbLoading);
144243
144576
  mounted = await mountGlb(glb.url, element, { signal: controller.signal });
144244
144577
  if (!live) {
144245
144578
  mounted.dispose();
@@ -144251,7 +144584,7 @@ void main() {
144251
144584
  run().catch((error) => {
144252
144585
  if (!live || isAbortError(error)) return;
144253
144586
  setStatus("error");
144254
- setMessage(describe(error));
144587
+ setMessage(messageOf(error));
144255
144588
  });
144256
144589
  return () => {
144257
144590
  live = false;
@@ -144271,16 +144604,20 @@ void main() {
144271
144604
  topRight: status === "ready" ? [(0, react.createElement)("span", {
144272
144605
  key: "mode",
144273
144606
  style: pillStyle("muted", { fontSize: 9.5 })
144274
- }, cached ? "cached" : "generated"), (0, react.createElement)("span", {
144607
+ }, cached ? COPY.preview.glbCached : COPY.preview.glbGenerated), (0, react.createElement)("span", {
144275
144608
  key: "rev",
144276
144609
  style: pillStyle("muted", { fontSize: 9.5 })
144277
- }, `rev ${shortRevision(revision)}`)] : void 0,
144278
- overlay: status === "ready" ? "drag to orbit · wheel to zoom" : "kicad-cli pcb export glb"
144610
+ }, COPY.preview.revision(shortRevision(revision)))] : void 0,
144611
+ overlay: status === "ready" ? COPY.preview.glbOverlay : "kicad-cli pcb export glb"
144279
144612
  }, (0, react.createElement)("div", { style: {
144280
144613
  position: "relative",
144281
144614
  flex: "1 1 0",
144282
144615
  minHeight: 160
144283
- } }, ...status === "ready" ? [] : [statusLine(status, message)], (0, react.createElement)("div", {
144616
+ } }, ...status === "ready" ? [] : [statusLine(status, {
144617
+ title: COPY.placeholder.title["3d"],
144618
+ ...message === void 0 ? {} : { message },
144619
+ ...status === "error" && configured ? { guidance: COPY.placeholder.guide["3d"] } : {}
144620
+ })], (0, react.createElement)("div", {
144284
144621
  key: "canvas",
144285
144622
  ref: container,
144286
144623
  style: {
@@ -144303,7 +144640,7 @@ void main() {
144303
144640
  (0, react.useEffect)(() => {
144304
144641
  if (!configured) {
144305
144642
  setStatus("error");
144306
- setMessage("KiCad is not configured.");
144643
+ setMessage(COPY.preview.kicadNotConfigured);
144307
144644
  return;
144308
144645
  }
144309
144646
  const controller = new AbortController();
@@ -144320,7 +144657,7 @@ void main() {
144320
144657
  }).catch((error) => {
144321
144658
  if (!live || isAbortError(error)) return;
144322
144659
  setStatus("error");
144323
- setMessage(describe(error));
144660
+ setMessage(messageOf(error));
144324
144661
  });
144325
144662
  return () => {
144326
144663
  live = false;
@@ -144338,8 +144675,14 @@ void main() {
144338
144675
  overlay: "kicad-cli sch export bom"
144339
144676
  }, (0, react.createElement)("div", { style: {
144340
144677
  flex: "1 1 0",
144678
+ minWidth: 0,
144341
144679
  display: "flex"
144342
- } }, statusLine(status, message, status === "error" && !configured ? "BOM rows come from kicad-cli sch export bom. Configure KiCad in Settings → Hardware Engineering." : void 0)));
144680
+ } }, statusLine(status, {
144681
+ title: COPY.placeholder.title.bom,
144682
+ ...message === void 0 ? {} : { message },
144683
+ ...status === "error" && !configured ? { hint: COPY.preview.bomHint } : {},
144684
+ ...status === "error" && configured ? { guidance: COPY.placeholder.guide.bom } : {}
144685
+ })));
144343
144686
  const total = bom.rows.reduce((sum, row) => sum + row.quantity, 0);
144344
144687
  return (0, react.createElement)("div", {
144345
144688
  style: cardStyle({
@@ -144356,21 +144699,15 @@ void main() {
144356
144699
  gap: 8,
144357
144700
  padding: "8px 10px",
144358
144701
  borderBottom: `1px solid ${C.border}`
144359
- } }, (0, react.createElement)("span", { style: SECTION_TITLE }, `Bill of materials · ${String(bom.rows.length)} lines`), (0, react.createElement)("div", { style: {
144702
+ } }, (0, react.createElement)("span", { style: SECTION_TITLE }, COPY.preview.bomTitle(bom.rows.length)), (0, react.createElement)("div", { style: {
144360
144703
  display: "flex",
144361
144704
  gap: 4,
144362
144705
  alignItems: "center"
144363
- } }, (0, react.createElement)("span", { style: pillStyle("muted") }, `${String(total)} placements`), (0, react.createElement)("span", { style: pillStyle("muted") }, `rev ${shortRevision(bom.revision)}`))), (0, react.createElement)("div", { style: {
144706
+ } }, (0, react.createElement)("span", { style: pillStyle("muted") }, COPY.preview.bomPlacements(total)), (0, react.createElement)("span", { style: pillStyle("muted") }, COPY.preview.revision(shortRevision(bom.revision))))), (0, react.createElement)("div", { style: {
144364
144707
  flex: "1 1 0",
144365
144708
  minHeight: 0,
144366
144709
  overflow: "auto"
144367
- } }, (0, react.createElement)("table", { style: TABLE }, (0, react.createElement)("thead", {}, (0, react.createElement)("tr", {}, ...[
144368
- "Refs",
144369
- "Qty",
144370
- "Value",
144371
- "Footprint",
144372
- "Notes"
144373
- ].map((label) => (0, react.createElement)("th", {
144710
+ } }, (0, react.createElement)("table", { style: TABLE }, (0, react.createElement)("thead", {}, (0, react.createElement)("tr", {}, ...COPY.preview.bomColumns.map((label) => (0, react.createElement)("th", {
144374
144711
  key: label,
144375
144712
  style: TH
144376
144713
  }, label)))), (0, react.createElement)("tbody", {}, ...bom.rows.map((row, index) => (0, react.createElement)("tr", {
@@ -144524,11 +144861,8 @@ void main() {
144524
144861
  flexDirection: "column",
144525
144862
  gap: 6
144526
144863
  };
144527
- const STEPS = [
144528
- "Welcome",
144529
- "KiCad",
144530
- "SolidCraft"
144531
- ];
144864
+ /** Step titles, in order (also the dot-strip tooltips and the counter label). */
144865
+ const STEPS = COPY.wizard.steps;
144532
144866
  /**
144533
144867
  * Dismissal remembered for the life of this client bundle, not one mount.
144534
144868
  *
@@ -144612,7 +144946,7 @@ void main() {
144612
144946
  if (kicadRoot !== "") await saveInstallation("kicad", kicadRoot);
144613
144947
  if (solidcraftRoot !== "") await saveInstallation("solidcraft", solidcraftRoot);
144614
144948
  } catch (error) {
144615
- setMessage(String(error));
144949
+ setMessage(messageOf(error));
144616
144950
  setBusy(false);
144617
144951
  return;
144618
144952
  }
@@ -144640,41 +144974,41 @@ void main() {
144640
144974
  display: "flex",
144641
144975
  flexDirection: "column",
144642
144976
  gap: 1
144643
- } }, (0, react.createElement)("h2", { style: TITLE }, "Set up your hardware toolchain"), (0, react.createElement)("span", { style: STEP_LABEL }, "one-time · skippable"))), (0, react.createElement)("p", { style: LEAD }, "Hardware Engineering previews KiCad projects, exports PCB 3D models, packages fabrication files and opens native files. Point it at your local installations once."), (0, react.createElement)("div", { style: FIELD_CARD }, (0, react.createElement)("span", { style: {
144977
+ } }, (0, react.createElement)("h2", { style: TITLE }, COPY.wizard.welcomeTitle), (0, react.createElement)("span", { style: STEP_LABEL }, COPY.wizard.welcomeKicker))), (0, react.createElement)("p", { style: LEAD }, COPY.wizard.welcomeLead), (0, react.createElement)("div", { style: FIELD_CARD }, (0, react.createElement)("span", { style: {
144644
144978
  fontSize: 11,
144645
144979
  fontWeight: 600
144646
- } }, "What it uses"), (0, react.createElement)("p", { style: {
144980
+ } }, COPY.wizard.welcomeUsesTitle), (0, react.createElement)("p", { style: {
144647
144981
  ...MUTED,
144648
144982
  color: C.text3
144649
- } }, "kicad-cli for previews, BOM, GLB and gerber/drill packaging. SolidCraft is shared with the agent as environment context only.")), (0, react.createElement)("p", { style: {
144983
+ } }, COPY.wizard.welcomeUses)), (0, react.createElement)("p", { style: {
144650
144984
  ...MUTED,
144651
144985
  color: C.text3
144652
- } }, "Only local executables are used. Nothing is uploaded, and nothing is installed for you."));
144986
+ } }, COPY.wizard.welcomeLocal));
144653
144987
  if (step === 1) return (0, react.createElement)("div", { style: {
144654
144988
  display: "flex",
144655
144989
  flexDirection: "column",
144656
144990
  gap: 8
144657
- } }, (0, react.createElement)("div", { style: SPREAD }, (0, react.createElement)("h2", { style: TITLE }, "KiCad installation"), (0, react.createElement)("span", { style: facts?.kicad?.configured === true ? pillStyle("ok") : pillStyle("muted") }, facts?.kicad?.configured === true ? `v${facts.kicad.version ?? "?"}` : "optional")), (0, react.createElement)("p", { style: LEAD }, "Enter a KiCad installation folder or a kicad-cli path. It is used for .kicad_sch / .kicad_pcb previews, PCB GLB export, fabrication packaging, and “Open in KiCad”."), (0, react.createElement)("input", {
144991
+ } }, (0, react.createElement)("div", { style: SPREAD }, (0, react.createElement)("h2", { style: TITLE }, COPY.wizard.kicadTitle), (0, react.createElement)("span", { style: facts?.kicad?.configured === true ? pillStyle("ok") : pillStyle("muted") }, facts?.kicad?.configured === true ? `v${facts.kicad.version ?? "?"}` : COPY.wizard.kicadOptional)), (0, react.createElement)("p", { style: LEAD }, COPY.wizard.kicadLead), (0, react.createElement)("input", {
144658
144992
  style: INPUT,
144659
144993
  value: kicadRoot,
144660
144994
  autoFocus: true,
144661
144995
  spellCheck: false,
144662
- placeholder: "C:\\Program Files\\KiCad\\8.0\\ or /usr/bin/kicad-cli",
144996
+ placeholder: COPY.wizard.kicadPlaceholder,
144663
144997
  onChange: (event) => setKicadRoot(event.currentTarget.value)
144664
144998
  }), (0, react.createElement)("p", { style: {
144665
144999
  ...MUTED,
144666
145000
  color: C.text3
144667
- } }, "Leave it empty to skip. You can configure it later in Settings → Hardware Engineering."));
145001
+ } }, COPY.wizard.kicadSkipHint));
144668
145002
  return (0, react.createElement)("div", { style: {
144669
145003
  display: "flex",
144670
145004
  flexDirection: "column",
144671
145005
  gap: 8
144672
- } }, (0, react.createElement)("div", { style: SPREAD }, (0, react.createElement)("h2", { style: TITLE }, "SolidCraft installation"), (0, react.createElement)("span", { style: pillStyle("muted") }, "optional")), (0, react.createElement)("p", { style: LEAD }, "SolidCraft is shared with the agent as environment context only in this POC — no native launch, no mechanical preview."), (0, react.createElement)("input", {
145006
+ } }, (0, react.createElement)("div", { style: SPREAD }, (0, react.createElement)("h2", { style: TITLE }, COPY.wizard.solidcraftTitle), (0, react.createElement)("span", { style: pillStyle("muted") }, COPY.wizard.kicadOptional)), (0, react.createElement)("p", { style: LEAD }, COPY.wizard.solidcraftLead), (0, react.createElement)("input", {
144673
145007
  style: INPUT,
144674
145008
  value: solidcraftRoot,
144675
145009
  autoFocus: true,
144676
145010
  spellCheck: false,
144677
- placeholder: "C:\\Program Files\\SolidCraft\\bin\\SolidCraft.exe",
145011
+ placeholder: COPY.wizard.solidcraftPlaceholder,
144678
145012
  onChange: (event) => setSolidcraftRoot(event.currentTarget.value)
144679
145013
  }));
144680
145014
  };
@@ -144682,7 +145016,7 @@ void main() {
144682
145016
  style: BACKDROP,
144683
145017
  role: "dialog",
144684
145018
  "aria-modal": true,
144685
- "aria-label": "Hardware Engineering setup",
145019
+ "aria-label": COPY.wizard.aria,
144686
145020
  "data-hardware-wizard": true
144687
145021
  }, (0, react.createElement)("div", { style: PANEL }, (0, react.createElement)("div", { style: SPREAD }, (0, react.createElement)("div", { style: {
144688
145022
  ...ROW$1,
@@ -144694,13 +145028,13 @@ void main() {
144694
145028
  })), (0, react.createElement)("span", { style: {
144695
145029
  ...STEP_LABEL,
144696
145030
  ...MONO_TEXT
144697
- } }, `${String(step + 1)}/${String(STEPS.length)} · ${STEPS[step]}`)), (0, react.createElement)("button", {
145031
+ } }, COPY.wizard.stepCounter(step + 1, STEPS.length, STEPS[step] ?? ""))), (0, react.createElement)("button", {
144698
145032
  type: "button",
144699
145033
  style: buttonStyle("quiet", { fontSize: 10.5 }),
144700
145034
  onClick: () => {
144701
145035
  complete();
144702
145036
  }
144703
- }, "Skip setup")), stepBody(), ...message === "" ? [] : [(0, react.createElement)("p", {
145037
+ }, COPY.wizard.skip)), stepBody(), ...message === "" ? [] : [(0, react.createElement)("p", {
144704
145038
  key: "msg",
144705
145039
  style: {
144706
145040
  ...MUTED,
@@ -144715,20 +145049,20 @@ void main() {
144715
145049
  ...MUTED,
144716
145050
  color: C.text3,
144717
145051
  fontSize: 10
144718
- } }, "You can change this any time in Settings → Hardware Engineering."), (0, react.createElement)("span", { style: ROW$1 }, step > 0 ? (0, react.createElement)("button", {
145052
+ } }, COPY.wizard.footerNote), (0, react.createElement)("span", { style: ROW$1 }, step > 0 ? (0, react.createElement)("button", {
144719
145053
  type: "button",
144720
145054
  style: buttonStyle("secondary"),
144721
145055
  onClick: () => {
144722
145056
  setStep(step - 1);
144723
145057
  }
144724
- }, "Back") : null, (0, react.createElement)("button", {
145058
+ }, COPY.wizard.back) : null, (0, react.createElement)("button", {
144725
145059
  type: "button",
144726
145060
  style: buttonStyle("primary"),
144727
145061
  disabled: busy,
144728
145062
  onClick: () => {
144729
145063
  next();
144730
145064
  }
144731
- }, busy ? "Saving…" : step === STEPS.length - 1 ? "Finish" : "Next")))));
145065
+ }, busy ? COPY.wizard.saving : step === STEPS.length - 1 ? COPY.wizard.finish : COPY.wizard.next)))));
144732
145066
  }
144733
145067
  //#endregion
144734
145068
  //#region src/client/components.tsx
@@ -144756,15 +145090,6 @@ void main() {
144756
145090
  flexWrap: "wrap",
144757
145091
  minWidth: 0
144758
145092
  };
144759
- const NAV = {
144760
- display: "flex",
144761
- alignItems: "center",
144762
- gap: 3,
144763
- minWidth: 0,
144764
- fontSize: 12,
144765
- position: "relative",
144766
- flexWrap: "nowrap"
144767
- };
144768
145093
  const NAV_ITEM = {
144769
145094
  display: "inline-flex",
144770
145095
  alignItems: "center",
@@ -144787,20 +145112,6 @@ void main() {
144787
145112
  background: C.card,
144788
145113
  border: `1px solid ${C.border}`
144789
145114
  };
144790
- `${C.border}`;
144791
- R.sm, C.accent;
144792
- C.text;
144793
- const CHIP = {
144794
- minWidth: 0,
144795
- maxWidth: 168,
144796
- overflow: "hidden",
144797
- textOverflow: "ellipsis",
144798
- whiteSpace: "nowrap",
144799
- color: C.text3,
144800
- fontSize: 10,
144801
- fontFamily: MONO,
144802
- flex: "0 1 auto"
144803
- };
144804
145115
  const PANEL_ROOT = {
144805
145116
  display: "flex",
144806
145117
  flexDirection: "column",
@@ -144811,12 +145122,22 @@ void main() {
144811
145122
  background: C.base,
144812
145123
  color: C.text
144813
145124
  };
144814
- const STRIP = {
145125
+ /**
145126
+ * The panel's top edge.
145127
+ *
145128
+ * The tab strip that used to sit here is gone: this page's destination switches
145129
+ * ARE the panel's header. The right padding is the room the host lays its two
145130
+ * panel controls (full screen, collapse) over — both rows are 38px, so the
145131
+ * buttons centre on this row's centre line.
145132
+ */
145133
+ const HEADER = {
144815
145134
  display: "flex",
144816
145135
  alignItems: "center",
144817
145136
  justifyContent: "space-between",
144818
145137
  gap: 6,
144819
- padding: "5px 8px",
145138
+ height: 38,
145139
+ boxSizing: "border-box",
145140
+ padding: "0 76px 0 10px",
144820
145141
  background: C.panel,
144821
145142
  borderBottom: `1px solid ${C.border}`,
144822
145143
  flex: "0 0 auto",
@@ -144876,61 +145197,6 @@ void main() {
144876
145197
  if (!DESTINATIONS.includes(params.destination)) return void 0;
144877
145198
  return params;
144878
145199
  }
144879
- /**
144880
- * One product navigation row: brand, the five persistent destinations, and the
144881
- * selected project. The first-run wizard renders from this root-scope seat
144882
- * because it must be able to run before any session exists.
144883
- */
144884
- function EngineeringNav(props) {
144885
- const { useStore, actions, useSessions, discover, openDestination } = props;
144886
- const active = useStore((state) => state.activeDestination);
144887
- const projectPath = useStore((state) => state.projectPath);
144888
- const selected = useStore((state) => state.discovery?.selected);
144889
- const sessionId = useSessions?.((state) => state.ids[0]);
144890
- const cwd = useSessions?.((state) => {
144891
- const id = state.ids[0];
144892
- return id === void 0 ? void 0 : state.byId[id]?.cwd;
144893
- });
144894
- (0, react.useEffect)(() => {
144895
- let live = true;
144896
- discover(cwd, void 0, sessionId).then((discovery) => {
144897
- if (live) actions.setDiscovery(discovery);
144898
- }).catch((error) => {
144899
- if (live) actions.setNotice(`Artifact discovery failed: ${String(error)}`);
144900
- });
144901
- return () => {
144902
- live = false;
144903
- };
144904
- }, [
144905
- cwd,
144906
- sessionId,
144907
- discover,
144908
- actions
144909
- ]);
144910
- const projectName = selected?.name ?? (projectPath === void 0 ? void 0 : basename(projectPath));
144911
- return (0, react.createElement)("div", {
144912
- style: NAV,
144913
- "data-hardware-nav": true
144914
- }, ...DESTINATIONS.map((destination) => (0, react.createElement)("button", {
144915
- key: destination,
144916
- type: "button",
144917
- style: destination === active ? NAV_ITEM_ACTIVE : NAV_ITEM,
144918
- "aria-pressed": destination === active,
144919
- "data-destination": destination,
144920
- title: DESTINATION_LABELS[destination],
144921
- onClick: () => {
144922
- actions.setActive(destination);
144923
- openDestination(destination);
144924
- }
144925
- }, (0, react.createElement)("span", { style: dotStyle(DOT_COLORS[destination], 6) }), DESTINATION_LABELS[destination])), ...projectName === void 0 ? [] : [(0, react.createElement)("span", {
144926
- key: "project",
144927
- style: {
144928
- ...CHIP,
144929
- paddingLeft: 4
144930
- },
144931
- title: projectPath ?? projectName
144932
- }, projectName)], (0, react.createElement)(OnboardingWizard, props));
144933
- }
144934
145200
  /** The artifact a destination previews, with its canonical identity. */
144935
145201
  function selectedArtifact(state, destination) {
144936
145202
  const project = state.discovery?.selected;
@@ -144949,19 +145215,46 @@ void main() {
144949
145215
  if (destination === "schematic" || destination === "bom") return schematic;
144950
145216
  return board;
144951
145217
  }
144952
- function missingReason(state, destination) {
145218
+ /**
145219
+ * Resolve the placeholder for one destination, or `undefined` while there is
145220
+ * nothing to say (no discovery yet, or an artifact to render).
145221
+ *
145222
+ * The guidance points at the agent: this product's hardware is authored in the
145223
+ * conversation, so "暂无原理图" alone leaves the user with no next step.
145224
+ */
145225
+ function missingState(state, destination) {
144953
145226
  const discovery = state.discovery;
144954
145227
  if (discovery === void 0) return void 0;
144955
- if (discovery.issue?.code === "selection-required" && (discovery.projects?.length ?? 0) > 1) return `${String(discovery.projects?.length)} hardware projects found; choose one explicitly.`;
144956
- if (discovery.selected === void 0) return "No hardware project selected. Open or select a hardware project.";
145228
+ const title = COPY.placeholder.title[destination];
145229
+ if (discovery.issue?.code === "selection-required" && (discovery.projects?.length ?? 0) > 1) return {
145230
+ title,
145231
+ reason: COPY.discovery.selectionRequiredCount(discovery.projects?.length ?? 0)
145232
+ };
145233
+ if (discovery.selected === void 0) return {
145234
+ title,
145235
+ reason: COPY.discovery.noProjectSelected,
145236
+ guidance: COPY.placeholder.noProject
145237
+ };
144957
145238
  if (destination === "schematic" || destination === "bom") {
144958
- if (discovery.selected.schematic === void 0) return "This project has no discoverable root schematic.";
145239
+ if (discovery.selected.schematic === void 0) return {
145240
+ title,
145241
+ reason: COPY.discovery.noSchematic,
145242
+ guidance: COPY.placeholder.guide[destination]
145243
+ };
144959
145244
  }
144960
145245
  if (destination === "pcb" || destination === "3d") {
144961
- if ((discovery.selected.boards?.length ?? 0) === 0) return "This project has no discoverable .kicad_pcb board.";
145246
+ if ((discovery.selected.boards?.length ?? 0) === 0) return {
145247
+ title,
145248
+ reason: COPY.discovery.noBoard,
145249
+ guidance: COPY.placeholder.guide[destination]
145250
+ };
144962
145251
  }
144963
145252
  if (destination === "order") {
144964
- if ((discovery.selected.boards?.length ?? 0) === 0) return "Select a board before quoting or ordering fabrication.";
145253
+ if ((discovery.selected.boards?.length ?? 0) === 0) return {
145254
+ title,
145255
+ reason: COPY.discovery.noBoardToOrder,
145256
+ guidance: COPY.placeholder.guide.order
145257
+ };
144965
145258
  }
144966
145259
  }
144967
145260
  /** Native-open affordance for the artifact currently on screen. */
@@ -144979,7 +145272,7 @@ void main() {
144979
145272
  },
144980
145273
  disabled: !canOpen,
144981
145274
  "data-hardware-native-open": true,
144982
- title: canOpen ? `Open ${artifact.path} in KiCad` : configured ? "Select an artifact first" : "Configure KiCad in Settings → Hardware Engineering",
145275
+ title: canOpen ? COPY.viewer.openInKicadTitle(artifact.path) : configured ? COPY.viewer.selectArtifactFirst : COPY.viewer.configureKicad,
144983
145276
  onClick: () => {
144984
145277
  if (artifact === void 0) return;
144985
145278
  openNative({
@@ -144987,10 +145280,10 @@ void main() {
144987
145280
  artifactPath: artifact.path,
144988
145281
  kind: active === "3d" ? "pcb-3d" : active === "bom" ? "bom" : artifact.kind
144989
145282
  }).catch((error) => {
144990
- notice(String(error));
145283
+ notice(messageOf(error));
144991
145284
  });
144992
145285
  }
144993
- }, (0, react.createElement)("span", { style: dotStyle(configured ? C.ok : C.text3, 6) }), "Open in KiCad");
145286
+ }, (0, react.createElement)("span", { style: dotStyle(configured ? C.ok : C.text3, 6) }), COPY.viewer.openInKicad);
144994
145287
  }
144995
145288
  /** Keyframes the stages reference; rendered once per panel. */
144996
145289
  const PANEL_STYLE = `
@@ -145015,7 +145308,7 @@ void main() {
145015
145308
  const noticeText = useStore((state) => state.notice);
145016
145309
  const installed = useStore((state) => state.installations);
145017
145310
  const artifact = useStore((state) => selectedArtifact(state, active));
145018
- const reason = useStore((state) => missingReason(state, active));
145311
+ const missing = useStore((state) => missingState(state, active));
145019
145312
  const workspaceRoot = useStore((state) => state.workspaceRoot);
145020
145313
  const cwd = useSessions?.((state) => {
145021
145314
  if (sessionId === void 0) return void 0;
@@ -145033,7 +145326,7 @@ void main() {
145033
145326
  discover(cwd, params?.projectPath, sessionId).then((result) => {
145034
145327
  if (live) actions.setDiscovery(result, params?.path !== void 0);
145035
145328
  }).catch((error) => {
145036
- if (live) actions.setNotice(`Artifact discovery failed: ${String(error)}`);
145329
+ if (live) actions.setNotice(COPY.viewer.discoveryFailed(messageOf(error)));
145037
145330
  });
145038
145331
  return () => {
145039
145332
  live = false;
@@ -145050,7 +145343,7 @@ void main() {
145050
145343
  installations().then((result) => {
145051
145344
  if (live) actions.setInstallations(result);
145052
145345
  }).catch((error) => {
145053
- if (live) actions.setNotice(`Installation check failed: ${String(error)}`);
145346
+ if (live) actions.setNotice(COPY.viewer.installationFailed(messageOf(error)));
145054
145347
  });
145055
145348
  return () => {
145056
145349
  live = false;
@@ -145065,8 +145358,9 @@ void main() {
145065
145358
  actions.setActive(destination);
145066
145359
  openDestination(destination, destination === "schematic" || destination === "bom" ? schematicPath : pcbPath);
145067
145360
  };
145068
- const strip = (0, react.createElement)("div", {
145069
- style: STRIP,
145361
+ const header = (0, react.createElement)("div", {
145362
+ style: HEADER,
145363
+ "data-hardware-header": true,
145070
145364
  "data-hardware-destinations": true
145071
145365
  }, (0, react.createElement)("div", { style: STRIP_GROUP }, ...DESTINATIONS.map((destination) => (0, react.createElement)("button", {
145072
145366
  key: destination,
@@ -145079,6 +145373,8 @@ void main() {
145079
145373
  fontSize: 11
145080
145374
  },
145081
145375
  "aria-pressed": destination === active,
145376
+ "data-destination": destination,
145377
+ title: DESTINATION_LABELS[destination],
145082
145378
  onClick: () => {
145083
145379
  go(destination);
145084
145380
  }
@@ -145086,7 +145382,7 @@ void main() {
145086
145382
  const meta = (0, react.createElement)("div", { style: META }, (0, react.createElement)("span", {
145087
145383
  style: META_PATH,
145088
145384
  title: artifact?.path ?? ""
145089
- }, artifact === void 0 ? "no artifact selected" : artifact.path), (0, react.createElement)("span", { style: {
145385
+ }, artifact === void 0 ? COPY.viewer.noArtifact : artifact.path), (0, react.createElement)("span", { style: {
145090
145386
  display: "flex",
145091
145387
  alignItems: "center",
145092
145388
  gap: 4,
@@ -145097,11 +145393,11 @@ void main() {
145097
145393
  }, selectedProject.name)], ...kicadConfigured ? [(0, react.createElement)("span", {
145098
145394
  key: "kicad",
145099
145395
  style: pillStyle("ok")
145100
- }, `KiCad ${installed?.kicad?.version ?? ""}`.trim())] : [(0, react.createElement)("span", {
145396
+ }, COPY.viewer.kicadVersion(installed?.kicad?.version ?? "").trim())] : [(0, react.createElement)("span", {
145101
145397
  key: "kicad",
145102
145398
  style: pillStyle("warn"),
145103
145399
  title: installed?.kicad?.error ?? ""
145104
- }, "KiCad missing")]));
145400
+ }, COPY.viewer.kicadMissing)]));
145105
145401
  const selectors = [];
145106
145402
  const selectStyle = {
145107
145403
  ...INPUT,
@@ -145113,20 +145409,20 @@ void main() {
145113
145409
  key: "project",
145114
145410
  style: selectStyle,
145115
145411
  value: projectPath ?? "",
145116
- "aria-label": "Project",
145412
+ "aria-label": COPY.viewer.projectField,
145117
145413
  onChange: (event) => {
145118
145414
  const path = event.currentTarget.value;
145119
145415
  actions.selectProject(path);
145120
- discover(cwd, path, sessionId).then((result) => actions.setDiscovery(result)).catch((error) => actions.setNotice(String(error)));
145416
+ discover(cwd, path, sessionId).then((result) => actions.setDiscovery(result)).catch((error) => actions.setNotice(messageOf(error)));
145121
145417
  }
145122
- }, option("", "Select a project…"), ...(discovery?.projects ?? []).map((project) => option(project.path, project.name))));
145418
+ }, option("", COPY.viewer.selectProject), ...(discovery?.projects ?? []).map((project) => option(project.path, project.name))));
145123
145419
  if ((active === "schematic" || active === "bom") && selectedProject !== void 0) {
145124
145420
  const candidates = [selectedProject.schematic, ...selectedProject.sheets ?? []].filter((candidate) => candidate !== void 0);
145125
145421
  if (candidates.length > 1) selectors.push((0, react.createElement)("select", {
145126
145422
  key: "sheet",
145127
145423
  style: selectStyle,
145128
145424
  value: schematicPath ?? "",
145129
- "aria-label": "Schematic sheet",
145425
+ "aria-label": COPY.viewer.schematicSheetField,
145130
145426
  onChange: (event) => {
145131
145427
  const path = event.currentTarget.value;
145132
145428
  actions.selectArtifact(path, "schematic");
@@ -145139,7 +145435,7 @@ void main() {
145139
145435
  key: "board",
145140
145436
  style: selectStyle,
145141
145437
  value: pcbPath ?? "",
145142
- "aria-label": "Board",
145438
+ "aria-label": COPY.viewer.boardField,
145143
145439
  onChange: (event) => {
145144
145440
  const path = event.currentTarget.value;
145145
145441
  actions.selectArtifact(path, "pcb");
@@ -145163,14 +145459,17 @@ void main() {
145163
145459
  key: "issue",
145164
145460
  role: "status",
145165
145461
  style: MUTED
145166
- }, discovery.issue.message)]);
145462
+ }, issueText(discovery.issue, {
145463
+ ...discovery.cwd === void 0 ? {} : { cwd: discovery.cwd },
145464
+ ...discovery.projects === void 0 ? {} : { count: discovery.projects.length }
145465
+ }))]);
145167
145466
  return (0, react.createElement)("div", {
145168
145467
  style: PANEL_ROOT,
145169
145468
  "data-hardware-destination": active
145170
- }, (0, react.createElement)("style", null, PANEL_STYLE), strip, meta, selectors.length === 0 && noticeText === void 0 && (discovery?.issue === void 0 || discovery.issue.code === "selection-required") ? null : (0, react.createElement)("div", { style: { padding: "6px 10px 0" } }, banner), (0, react.createElement)("div", { style: {
145469
+ }, (0, react.createElement)("style", null, PANEL_STYLE), header, meta, selectors.length === 0 && noticeText === void 0 && (discovery?.issue === void 0 || discovery.issue.code === "selection-required") ? null : (0, react.createElement)("div", { style: { padding: "6px 10px 0" } }, banner), (0, react.createElement)("div", { style: {
145171
145470
  ...BODY,
145172
145471
  overflow: active === "order" || active === "bom" ? "auto" : "hidden"
145173
- } }, ...reason === void 0 ? [(0, react.createElement)(HardwarePreview, {
145472
+ } }, ...missing === void 0 ? [(0, react.createElement)(HardwarePreview, {
145174
145473
  key: `preview:${info.tab.id}:${String(navRevision)}:${active}:${artifact?.path ?? ""}`,
145175
145474
  destination: active,
145176
145475
  artifact,
@@ -145180,22 +145479,35 @@ void main() {
145180
145479
  revision: navRevision,
145181
145480
  configured: kicadConfigured
145182
145481
  })] : [(0, react.createElement)("div", {
145183
- key: "reason",
145482
+ key: "missing",
145184
145483
  style: cardStyle({
145185
145484
  alignItems: "center",
145186
145485
  justifyContent: "center",
145187
145486
  flex: "1 1 0",
145188
- gap: 6
145487
+ gap: 6,
145488
+ padding: 20
145189
145489
  }),
145190
145490
  "data-hardware-state": "missing"
145191
- }, (0, react.createElement)("span", { style: pillStyle("warn") }, "nothing to show"), (0, react.createElement)("p", {
145491
+ }, (0, react.createElement)("span", { style: pillStyle("warn") }, missing.title), (0, react.createElement)("p", {
145192
145492
  role: "status",
145193
145493
  style: {
145194
145494
  ...MUTED,
145495
+ fontSize: 11.5,
145195
145496
  textAlign: "center",
145196
145497
  maxWidth: 320
145197
145498
  }
145198
- }, reason))]));
145499
+ }, missing.reason), ...missing.guidance === void 0 ? [] : [(0, react.createElement)("p", {
145500
+ key: "guidance",
145501
+ "data-hardware-guidance": true,
145502
+ style: {
145503
+ ...MUTED,
145504
+ color: C.text2,
145505
+ fontSize: 10.5,
145506
+ lineHeight: 1.6,
145507
+ textAlign: "center",
145508
+ maxWidth: 360
145509
+ }
145510
+ }, missing.guidance)])]), (0, react.createElement)(OnboardingWizard, props));
145199
145511
  }
145200
145512
  /** Settings section: the two CAD installation roots, host-validated. */
145201
145513
  function HardwareSettingsSection(props) {
@@ -145230,9 +145542,10 @@ void main() {
145230
145542
  const refreshed = await installations();
145231
145543
  actions.setInstallations(refreshed);
145232
145544
  const state = application === "kicad" ? refreshed.kicad : refreshed.solidcraft;
145233
- setMessage(state?.configured === true ? `${application === "kicad" ? "KiCad" : "SolidCraft"} validated and saved.` : `${application === "kicad" ? "KiCad" : "SolidCraft"} saved, but validation failed: ${state?.error ?? "not detected"}`);
145545
+ const applicationName = application === "kicad" ? "KiCad" : "SolidCraft";
145546
+ setMessage(state?.configured === true ? COPY.settings.savedAndValidated(applicationName) : COPY.settings.savedButInvalid(applicationName, state?.error ?? COPY.settings.notDetected));
145234
145547
  } catch (error) {
145235
- setMessage(String(error));
145548
+ setMessage(messageOf(error));
145236
145549
  } finally {
145237
145550
  setBusy(void 0);
145238
145551
  }
@@ -145270,7 +145583,7 @@ void main() {
145270
145583
  value: input.value,
145271
145584
  placeholder: input.placeholder,
145272
145585
  spellCheck: false,
145273
- "aria-label": `${input.title} path`,
145586
+ "aria-label": COPY.settings.pathField(input.title),
145274
145587
  onChange: (event) => input.onChange(event.currentTarget.value)
145275
145588
  }), (0, react.createElement)("div", { style: {
145276
145589
  ...ROW,
@@ -145285,7 +145598,7 @@ void main() {
145285
145598
  onClick: () => {
145286
145599
  save(input.key, input.value);
145287
145600
  }
145288
- }, busy === input.key ? "Validating…" : "Validate / save"), input.detail === void 0 ? null : (0, react.createElement)("span", { style: {
145601
+ }, busy === input.key ? COPY.settings.validating : COPY.settings.validate), input.detail === void 0 ? null : (0, react.createElement)("span", { style: {
145289
145602
  ...MUTED,
145290
145603
  ...MONO_TEXT,
145291
145604
  fontSize: 10,
@@ -145305,28 +145618,28 @@ void main() {
145305
145618
  margin: 0,
145306
145619
  fontSize: 15,
145307
145620
  fontWeight: 600
145308
- } }, "Hardware Engineering"), (0, react.createElement)("p", { style: MUTED }, "Local EDA and MCAD executables used for previews, fabrication packaging, one-click native open, and the agent environment context."), installationCard({
145621
+ } }, COPY.settings.title), (0, react.createElement)("p", { style: MUTED }, COPY.settings.lead), installationCard({
145309
145622
  key: "kicad",
145310
145623
  letter: "Ki",
145311
145624
  color: C.info,
145312
- title: "KiCad EDA suite",
145313
- blurb: "Accepts a KiCad installation root or a kicad-cli path. Drives .kicad_sch / .kicad_pcb preview, GLB export, BOM, gerber packaging and native open.",
145625
+ title: COPY.settings.kicadTitle,
145626
+ blurb: COPY.settings.kicadBlurb,
145314
145627
  value: kicadRoot,
145315
- placeholder: "C:\\Program Files\\KiCad\\8.0\\ or /usr/bin/kicad-cli",
145628
+ placeholder: COPY.settings.kicadPlaceholder,
145316
145629
  ok: kicad?.configured === true,
145317
- status: kicad?.configured ? `v${kicad.version ?? "?"}` : "not configured",
145630
+ status: kicad?.configured ? `v${kicad.version ?? "?"}` : COPY.settings.notConfigured,
145318
145631
  ...kicad?.cli === void 0 ? {} : { detail: kicad.cli },
145319
145632
  onChange: setKicadRoot
145320
145633
  }), installationCard({
145321
145634
  key: "solidcraft",
145322
145635
  letter: "Sc",
145323
145636
  color: C.warn,
145324
- title: "SolidCraft 3D CAD",
145325
- blurb: "Agent environment context only in this POC. No native launch and no mechanical preview; the 3D destination renders the selected PCB.",
145637
+ title: COPY.settings.solidcraftTitle,
145638
+ blurb: COPY.settings.solidcraftBlurb,
145326
145639
  value: solidcraftRoot,
145327
- placeholder: "C:\\Program Files\\SolidCraft\\bin\\SolidCraft.exe",
145640
+ placeholder: COPY.settings.solidcraftPlaceholder,
145328
145641
  ok: solidcraft?.configured === true,
145329
- status: solidcraft?.configured ? "configured" : "not configured",
145642
+ status: solidcraft?.configured ? COPY.settings.configured : COPY.settings.notConfigured,
145330
145643
  ...solidcraft?.executable === void 0 ? {} : { detail: solidcraft.executable },
145331
145644
  onChange: setSolidcraftRoot
145332
145645
  }), ...message === "" ? [] : [(0, react.createElement)("p", {
@@ -145457,17 +145770,21 @@ void main() {
145457
145770
  /**
145458
145771
  * Browser half of `@huaqiu/dsh-hardware-ui`.
145459
145772
  *
145460
- * Occupies existing DSH seats only: one root navigation occupant, one
145461
- * `keepMounted` right-panel tab body, and one settings section. Native open
145462
- * lives inside the viewer with the resolved artifact in scope, so no
145463
- * conversation-level action is registered.
145773
+ * Occupies existing DSH seats only: one `keepMounted` right-panel tab body and
145774
+ * one settings section. Native open lives inside the viewer with the resolved
145775
+ * artifact in scope, so no conversation-level action is registered — and no
145776
+ * conversation-level navigation either: the panel's own header IS the product's
145777
+ * navigation, so nothing duplicates it above the conversation.
145778
+ *
145779
+ * The tab type declares itself the panel's default page (`default: true`), so
145780
+ * expanding the column opens Hardware Engineering instead of the guide. Inside
145781
+ * the panel there is no tab strip: the page's header is the panel's top edge and
145782
+ * the host lays the two panel controls (full screen, collapse) over its end.
145464
145783
  *
145465
145784
  * Two store handles, not one: DSH pins a handle to a single slot scope, and
145466
- * `conversation.header.leading`/`settings.section` are `root` while
145467
- * `sidebar.right.pane.tab` is `session`. Mounting one handle in both scopes is
145468
- * rejected at load time ("one handle, one scope"). The two halves therefore
145469
- * coordinate the only way the slot contract allows — through the tab
145470
- * parameters and their navigation revision.
145785
+ * `settings.section` is `root` while `sidebar.right.pane.tab` is `session`.
145786
+ * Mounting one handle in both scopes is rejected at load time ("one handle, one
145787
+ * scope").
145471
145788
  */
145472
145789
  /** Real Cordis service names this browser plugin waits for. */
145473
145790
  const inject = [
@@ -145506,9 +145823,9 @@ void main() {
145506
145823
  },
145507
145824
  async saveInstallation(application, root) {
145508
145825
  const form = ctx.configForms?.get(HARDWARE_CONFIG_ENTRY);
145509
- if (form === void 0) throw new Error("host settings are unavailable");
145826
+ if (form === void 0) throw new Error(COPY.settings.hostSettingsUnavailable);
145510
145827
  const field = application === "kicad" ? "kicadRoot" : "solidcraftRoot";
145511
- if (!await form.set(field, root)) throw new Error(`the host rejected the ${field} setting`);
145828
+ if (!await form.set(field, root)) throw new Error(COPY.settings.hostRejected(application === "kicad" ? "KiCad" : "SolidCraft"));
145512
145829
  },
145513
145830
  configForm() {
145514
145831
  return ctx.configForms?.get(HARDWARE_CONFIG_ENTRY);
@@ -145539,15 +145856,11 @@ void main() {
145539
145856
  id: "@huaqiu/dsh-hardware-ui",
145540
145857
  kind: "hardware-engineering",
145541
145858
  keepMounted: true,
145542
- title: () => "Hardware Engineering"
145859
+ default: true,
145860
+ title: () => COPY.product.name
145543
145861
  }) ?? (() => {}), "hardware-ui: right-panel tab type");
145544
145862
  const slots = ctx.slots;
145545
145863
  if (slots === void 0) return;
145546
- effect(() => slots.inject("conversation.header.leading", () => slots.register({
145547
- name: "conversation.header.leading",
145548
- store: rootStore,
145549
- inject: () => controller
145550
- }, EngineeringNav)), "hardware-ui: five-destination navigation");
145551
145864
  effect(() => slots.inject("sidebar.right.pane.tab", () => slots.register({
145552
145865
  name: "sidebar.right.pane.tab",
145553
145866
  key: HARDWARE_TAB_ID,
@@ -145558,7 +145871,7 @@ void main() {
145558
145871
  name: "settings.section",
145559
145872
  id: HARDWARE_SETTINGS_ID,
145560
145873
  order: 85,
145561
- label: () => "Hardware Engineering",
145874
+ label: () => COPY.product.name,
145562
145875
  store: rootStore,
145563
145876
  inject: () => controller
145564
145877
  }, HardwareSettingsSection)), "hardware-ui: CAD installation settings");