@huaqiu/dsh-hardware-ui 0.7.19 → 0.7.21

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
@@ -162,21 +162,35 @@ window.__ModuleLoader__.load({
162
162
  "order.opening": "正在打开…",
163
163
  "order.copyUrl": "复制链接",
164
164
  "order.copied": "已复制",
165
- "order.confirmAria": "确认下单上传",
166
- "order.confirmTitlePcb": "上传板文件并创建 PCB 订单?",
167
- "order.confirmTitleSmt": "上传贴片文件包?",
168
- "order.confirmBody": "以下文件将发送到华秋下单服务。订单在那里创建,其页面会在右侧面板中打开;付款仍在该页面完成。",
169
- "order.confirmZip": "{zip} — Gerber 与钻孔文件({size})",
170
- "order.confirmPositions": "元件坐标({size})",
171
- "order.confirmBom": "贴片 BOM({size})",
172
- "order.confirmHostFallback": "已配置的下单服务",
173
- "order.confirmAck": "我了解这些板文件将离开本机。",
174
- "order.cancel": "取消",
175
- "order.uploadAndOpen": "上传并打开订单页",
176
- "order.uploading": "正在上传…",
165
+ "order.uploadHint": "点击「提交订单」即上传上面列出的文件到华秋并创建订单,订单页随后在右侧页签打开;付款在华秋页面完成。",
177
166
  "order.batch": "生产数量",
178
167
  "order.batchUnits": "{count} 片",
179
168
  "order.quoteBasis": "报价基准 · {count} 片",
169
+ "order.placeOrder.title": "下单",
170
+ "order.placeOrder.lead": "从当前工作目录中选择一个 KiCad 工程,直接进入 PCB 或 PCBA 下单流程。",
171
+ "order.placeOrder.workspace": "工作目录",
172
+ "order.placeOrder.workspaceUnknown": "尚未确定工作目录",
173
+ "order.placeOrder.refresh": "重新扫描",
174
+ "order.placeOrder.refreshing": "正在扫描…",
175
+ "order.placeOrder.loading": "正在扫描工作目录中的 KiCad 工程…",
176
+ "order.placeOrder.noProjects": "这个工作目录里没有找到 KiCad 工程",
177
+ "order.placeOrder.noProjectsHint": "工程需要包含 .kicad_pro 文件。保存工程后点「重新扫描」。",
178
+ "order.placeOrder.discoveryFailed": "工程扫描失败:{detail}",
179
+ "order.placeOrder.colProject": "工程",
180
+ "order.placeOrder.colArtifacts": "工程文件",
181
+ "order.placeOrder.colActions": "下单",
182
+ "order.placeOrder.pcbAction": "下 PCB",
183
+ "order.placeOrder.pcbaAction": "下 PCBA",
184
+ "order.placeOrder.boardCount": "{count} 个 PCB",
185
+ "order.placeOrder.noSchematic": "缺少工程原理图,无法生成贴片 BOM 与坐标",
186
+ "order.placeOrder.noBoard": "缺少 .kicad_pcb,无法打包制板文件",
187
+ "order.placeOrder.needsKicad": "未配置 KiCad,无法打包 Gerber",
188
+ "order.placeOrder.kicadReady": "KiCad 已就绪",
189
+ "order.placeOrder.checking": "检测中…",
190
+ "order.placeOrder.needsSignIn": "未登录华秋账号,订单页将无法带登录态打开",
191
+ "order.placeOrder.signInReady": "已登录华秋",
192
+ "order.placeOrder.selectedProject": "当前工程",
193
+ "order.placeOrder.multipleProjects": "{count} 个工程",
180
194
  "settings.title": "硬件工程",
181
195
  "settings.lead": "用于预览、制板打包、一键调用本地程序以及 Agent 环境上下文的本地 EDA / MCAD 可执行文件。",
182
196
  "settings.kicadTitle": "KiCad EDA 套件",
@@ -206,7 +220,7 @@ window.__ModuleLoader__.load({
206
220
  "errors.stale-revision": "文件已变化,请刷新后重试。",
207
221
  "errors.invalid-request": "请求参数不完整。",
208
222
  "errors.invalid-application": "不支持该本地程序。",
209
- "errors.confirmation-required": "下单需要先在上传确认框中确认。",
223
+ "errors.confirmation-required": "下单请求缺少确认标志,已被拒绝。",
210
224
  "errors.invalid-order-url": "订单链接无效,已拒绝打开。",
211
225
  "errors.order-unreachable": "无法连接下单服务。",
212
226
  "errors.order-rejected": "下单服务未能返回可用的订单页。",
@@ -288,6 +302,8 @@ window.__ModuleLoader__.load({
288
302
  "wizard.solidcraftChip": "可选 · MCAD",
289
303
  "wizard.solidcraftBlurb": "提供结构外壳上下文与 3D CAD 互操作能力。",
290
304
  "wizard.selectFile": "选择本地文件…",
305
+ "wizard.ready": "✓ 就绪(v{label})",
306
+ "wizard.readyDetected": "✓ 就绪(已检测)",
291
307
  "wizard.dontHave": "还没有 {name}?",
292
308
  "wizard.serverDownload": "从 HuaQiu 服务器下载",
293
309
  "wizard.footer": "你随时可以在「设置 → 硬件工程」中配置或更新这些路径",
@@ -298,6 +314,8 @@ window.__ModuleLoader__.load({
298
314
  "settings.statusVerified": "已验证可执行文件",
299
315
  "settings.statusAwaiting": "等待可执行文件路径",
300
316
  "settings.statusUnsaved": "未保存 · 点「校验并保存」",
317
+ "settings.statusSavedBadge": "已保存 v{version}",
318
+ "settings.statusSavedPlain": "已保存",
301
319
  "settings.downloadKicad": "下载 KiCad(v{version})",
302
320
  "settings.downloadSolidCraft": "下载 SolidCraft(v{version})",
303
321
  "toolchain.downloading": "正在从 down.eda.cn 下载…",
@@ -434,21 +452,35 @@ window.__ModuleLoader__.load({
434
452
  "order.opening": "Opening…",
435
453
  "order.copyUrl": "Copy link",
436
454
  "order.copied": "Copied",
437
- "order.confirmAria": "Confirm order upload",
438
- "order.confirmTitlePcb": "Upload board files and create a PCB order?",
439
- "order.confirmTitleSmt": "Upload the assembly package?",
440
- "order.confirmBody": "The following files will be sent to the Huaqiu ordering service. The order is created there and its page opens in the right panel; payment is completed on that page.",
441
- "order.confirmZip": "{zip} — Gerber and drill files ({size})",
442
- "order.confirmPositions": "Component positions ({size})",
443
- "order.confirmBom": "Assembly BOM ({size})",
444
- "order.confirmHostFallback": "the configured ordering service",
445
- "order.confirmAck": "I understand these board files will leave this machine.",
446
- "order.cancel": "Cancel",
447
- "order.uploadAndOpen": "Upload and open order page",
448
- "order.uploading": "Uploading…",
455
+ "order.uploadHint": "Clicking the order button uploads the files listed above to Huaqiu and creates the order; the order page then opens in a tab on the right, where payment is completed.",
449
456
  "order.batch": "Quantity",
450
457
  "order.batchUnits": "{count} boards",
451
458
  "order.quoteBasis": "Quote basis · {count} boards",
459
+ "order.placeOrder.title": "Place Order",
460
+ "order.placeOrder.lead": "Pick one KiCad project from the current workspace and go straight to a PCB or PCBA order.",
461
+ "order.placeOrder.workspace": "Workspace",
462
+ "order.placeOrder.workspaceUnknown": "No workspace resolved yet",
463
+ "order.placeOrder.refresh": "Scan again",
464
+ "order.placeOrder.refreshing": "Scanning...",
465
+ "order.placeOrder.loading": "Scanning the workspace for KiCad projects...",
466
+ "order.placeOrder.noProjects": "No KiCad project in this workspace",
467
+ "order.placeOrder.noProjectsHint": "A project needs a .kicad_pro file. Save it, then scan again.",
468
+ "order.placeOrder.discoveryFailed": "Project scan failed: {detail}",
469
+ "order.placeOrder.colProject": "Project",
470
+ "order.placeOrder.colArtifacts": "Files",
471
+ "order.placeOrder.colActions": "Order",
472
+ "order.placeOrder.pcbAction": "Order PCB",
473
+ "order.placeOrder.pcbaAction": "Order PCBA",
474
+ "order.placeOrder.boardCount": "{count} PCB",
475
+ "order.placeOrder.noSchematic": "No project schematic, so no positions or assembly BOM",
476
+ "order.placeOrder.noBoard": "No .kicad_pcb, so no fabrication package",
477
+ "order.placeOrder.needsKicad": "KiCad is not configured, so Gerbers cannot be packaged",
478
+ "order.placeOrder.kicadReady": "KiCad ready",
479
+ "order.placeOrder.checking": "Checking…",
480
+ "order.placeOrder.needsSignIn": "Not signed in to Huaqiu, so the order page cannot open signed in",
481
+ "order.placeOrder.signInReady": "Signed in to Huaqiu",
482
+ "order.placeOrder.selectedProject": "Current project",
483
+ "order.placeOrder.multipleProjects": "{count} projects",
452
484
  "settings.title": "Hardware Engineering",
453
485
  "settings.lead": "Local EDA / MCAD executables used for previews, fabrication packaging, one-click local open and agent environment context.",
454
486
  "settings.kicadTitle": "KiCad EDA suite",
@@ -478,7 +510,7 @@ window.__ModuleLoader__.load({
478
510
  "errors.stale-revision": "The file changed; refresh and try again.",
479
511
  "errors.invalid-request": "The request parameters are incomplete.",
480
512
  "errors.invalid-application": "This local application is not supported.",
481
- "errors.confirmation-required": "Confirm the upload dialog before placing an order.",
513
+ "errors.confirmation-required": "The order request carried no confirmation flag, so it was refused.",
482
514
  "errors.invalid-order-url": "The order link is invalid and was refused.",
483
515
  "errors.order-unreachable": "Could not connect to the ordering service.",
484
516
  "errors.order-rejected": "The ordering service did not return a usable order page.",
@@ -559,6 +591,8 @@ window.__ModuleLoader__.load({
559
591
  "wizard.solidcraftChip": "Optional • MCAD",
560
592
  "wizard.solidcraftBlurb": "Provides structural enclosure context and 3D CAD interoperability.",
561
593
  "wizard.selectFile": "Select Local File...",
594
+ "wizard.ready": "✓ Ready (v{label})",
595
+ "wizard.readyDetected": "✓ Ready (Detected)",
562
596
  "wizard.dontHave": "Don't have {name}?",
563
597
  "wizard.serverDownload": "Download from HuaQiu Server",
564
598
  "wizard.footer": "You can configure or update these anytime in Settings → Hardware Engineering",
@@ -569,6 +603,8 @@ window.__ModuleLoader__.load({
569
603
  "settings.statusVerified": "Verified executable",
570
604
  "settings.statusAwaiting": "Awaiting executable path",
571
605
  "settings.statusUnsaved": "Not saved · click Validate and save",
606
+ "settings.statusSavedBadge": "Saved v{version}",
607
+ "settings.statusSavedPlain": "Saved",
572
608
  "settings.downloadKicad": "Download KiCad (v{version})",
573
609
  "settings.downloadSolidCraft": "Download SolidCraft (v{version})",
574
610
  "toolchain.downloading": "Downloading from down.eda.cn...",
@@ -1006,41 +1042,99 @@ window.__ModuleLoader__.load({
1006
1042
  get copied() {
1007
1043
  return translateCopy("order.copied");
1008
1044
  },
1009
- get confirmAria() {
1010
- return translateCopy("order.confirmAria");
1011
- },
1012
- get confirmTitlePcb() {
1013
- return translateCopy("order.confirmTitlePcb");
1014
- },
1015
- get confirmTitleSmt() {
1016
- return translateCopy("order.confirmTitleSmt");
1017
- },
1018
- get confirmBody() {
1019
- return translateCopy("order.confirmBody");
1020
- },
1021
- confirmZip: (zip, size) => translateCopy("order.confirmZip", {
1022
- zip,
1023
- size
1024
- }),
1025
- confirmPositions: (size) => translateCopy("order.confirmPositions", { size }),
1026
- confirmBom: (size) => translateCopy("order.confirmBom", { size }),
1027
- confirmHost: (baseUrl) => baseUrl ?? translateCopy("order.confirmHostFallback"),
1028
- get confirmAck() {
1029
- return translateCopy("order.confirmAck");
1030
- },
1031
- get cancel() {
1032
- return translateCopy("order.cancel");
1033
- },
1034
- get uploadAndOpen() {
1035
- return translateCopy("order.uploadAndOpen");
1036
- },
1037
- get uploading() {
1038
- return translateCopy("order.uploading");
1045
+ /**
1046
+ * The one-click contract, stated once where the click happens.
1047
+ *
1048
+ * There is no confirmation dialog: the button uploads, so the panel says
1049
+ * that plainly instead of asking afterwards.
1050
+ */
1051
+ get uploadHint() {
1052
+ return translateCopy("order.uploadHint");
1039
1053
  },
1040
1054
  get batch() {
1041
1055
  return translateCopy("order.batch");
1042
1056
  },
1043
1057
  batchUnits: (count) => translateCopy("order.batchUnits", { count }),
1058
+ /**
1059
+ * The project-selection view in front of this destination.
1060
+ *
1061
+ * It only chooses *what* to order; the package, the price, the token and the
1062
+ * page stay where they already were, so this block is deliberately short.
1063
+ */
1064
+ placeOrder: {
1065
+ get title() {
1066
+ return translateCopy("order.placeOrder.title");
1067
+ },
1068
+ get lead() {
1069
+ return translateCopy("order.placeOrder.lead");
1070
+ },
1071
+ get workspace() {
1072
+ return translateCopy("order.placeOrder.workspace");
1073
+ },
1074
+ get workspaceUnknown() {
1075
+ return translateCopy("order.placeOrder.workspaceUnknown");
1076
+ },
1077
+ get refresh() {
1078
+ return translateCopy("order.placeOrder.refresh");
1079
+ },
1080
+ get refreshing() {
1081
+ return translateCopy("order.placeOrder.refreshing");
1082
+ },
1083
+ get loading() {
1084
+ return translateCopy("order.placeOrder.loading");
1085
+ },
1086
+ get noProjects() {
1087
+ return translateCopy("order.placeOrder.noProjects");
1088
+ },
1089
+ get noProjectsHint() {
1090
+ return translateCopy("order.placeOrder.noProjectsHint");
1091
+ },
1092
+ discoveryFailed: (detail) => translateCopy("order.placeOrder.discoveryFailed", { detail }),
1093
+ get colProject() {
1094
+ return translateCopy("order.placeOrder.colProject");
1095
+ },
1096
+ get colArtifacts() {
1097
+ return translateCopy("order.placeOrder.colArtifacts");
1098
+ },
1099
+ get colActions() {
1100
+ return translateCopy("order.placeOrder.colActions");
1101
+ },
1102
+ get pcbAction() {
1103
+ return translateCopy("order.placeOrder.pcbAction");
1104
+ },
1105
+ get pcbaAction() {
1106
+ return translateCopy("order.placeOrder.pcbaAction");
1107
+ },
1108
+ boardCount: (count) => translateCopy("order.placeOrder.boardCount", { count }),
1109
+ get noSchematic() {
1110
+ return translateCopy("order.placeOrder.noSchematic");
1111
+ },
1112
+ get noBoard() {
1113
+ return translateCopy("order.placeOrder.noBoard");
1114
+ },
1115
+ get needsKicad() {
1116
+ return translateCopy("order.placeOrder.needsKicad");
1117
+ },
1118
+ get kicadReady() {
1119
+ return translateCopy("order.placeOrder.kicadReady");
1120
+ },
1121
+ /** Emitted while the readiness probes are still in flight, never as a claim. */
1122
+ get checking() {
1123
+ return translateCopy("order.placeOrder.checking");
1124
+ },
1125
+ get needsSignIn() {
1126
+ return translateCopy("order.placeOrder.needsSignIn");
1127
+ },
1128
+ get signInReady() {
1129
+ return translateCopy("order.placeOrder.signInReady");
1130
+ },
1131
+ get selectedProject() {
1132
+ return translateCopy("order.placeOrder.selectedProject");
1133
+ },
1134
+ get multipleProjects() {
1135
+ return translateCopy("order.placeOrder.multipleProjects");
1136
+ }
1137
+ },
1044
1138
  quoteBasis: (count) => translateCopy("order.quoteBasis", { count })
1045
1139
  },
1046
1140
  /**
@@ -1089,6 +1183,15 @@ window.__ModuleLoader__.load({
1089
1183
  get selectFile() {
1090
1184
  return translateCopy("wizard.selectFile");
1091
1185
  },
1186
+ /**
1187
+ * The prototype's wizard badge once a tool is usable: `✓ Ready (v10.0.7)`.
1188
+ * It says "ready", not "configured", because the wizard is about what the user
1189
+ * can start using now — a path the Host just validated counts, saved or not.
1190
+ */
1191
+ ready: (label) => translateCopy("wizard.ready", { label }),
1192
+ get readyDetected() {
1193
+ return translateCopy("wizard.readyDetected");
1194
+ },
1092
1195
  dontHave: (name) => translateCopy("wizard.dontHave", { name }),
1093
1196
  get serverDownload() {
1094
1197
  return translateCopy("wizard.serverDownload");
@@ -1163,6 +1266,11 @@ window.__ModuleLoader__.load({
1163
1266
  get statusUnsaved() {
1164
1267
  return translateCopy("settings.statusUnsaved");
1165
1268
  },
1269
+ /** The fading success badge that replaces the (no longer printed) path line. */
1270
+ statusSavedBadge: (version) => translateCopy("settings.statusSavedBadge", { version }),
1271
+ get statusSavedPlain() {
1272
+ return translateCopy("settings.statusSavedPlain");
1273
+ },
1166
1274
  download: (tool, version) => tool === "kicad" ? translateCopy("settings.downloadKicad", { version }) : translateCopy("settings.downloadSolidCraft", { version })
1167
1275
  },
1168
1276
  /**
@@ -107532,9 +107640,10 @@ while (n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3]
107532
107640
  });
107533
107641
  }
107534
107642
  /**
107535
- * Submit one order. `confirm` is what the host requires; the panel sets it only
107536
- * after the user confirms the upload in the dialog. The host never opens the
107537
- * page by itself — the client shows `orderUrl` in its own Browser tab.
107643
+ * Submit one order. The upload is the user's click on the order card, so there
107644
+ * is no confirmation flag to pass and no second dialog to satisfy: the panel
107645
+ * shows the exact package first, then posts it. The host never opens the page
107646
+ * by itself — the client shows `orderUrl` in its own Browser tab.
107538
107647
  */
107539
107648
  async function placeOrder(kind, requestBody, signal) {
107540
107649
  return request(`/order/${kind}`, {
@@ -145393,8 +145502,9 @@ void main() {
145393
145502
  *
145394
145503
  * The panel never prices anything and never keeps its own order backend. It
145395
145504
  * prepares the fabrication package with `kicad-cli` through the host, shows
145396
- * exactly what would be uploaded, and submits only after the user confirms in
145397
- * a dialog. The URL shown afterwards is the backend's own URL, passed through.
145505
+ * exactly which files and which board facts the upload carries, and then
145506
+ * uploads on the click itself — one click, one real order. The URL shown
145507
+ * afterwards is the backend's own URL, passed through.
145398
145508
  */
145399
145509
  const QUANTITIES = [
145400
145510
  5,
@@ -145462,7 +145572,7 @@ void main() {
145462
145572
  overflow: "hidden",
145463
145573
  textOverflow: "ellipsis"
145464
145574
  };
145465
- const ROW$1 = {
145575
+ const ROW$2 = {
145466
145576
  display: "flex",
145467
145577
  alignItems: "center",
145468
145578
  gap: 6,
@@ -145470,7 +145580,7 @@ void main() {
145470
145580
  minWidth: 0
145471
145581
  };
145472
145582
  const SPREAD = {
145473
- ...ROW$1,
145583
+ ...ROW$2,
145474
145584
  justifyContent: "space-between"
145475
145585
  };
145476
145586
  const TAG = {
@@ -145490,39 +145600,15 @@ void main() {
145490
145600
  textDecoration: "underline",
145491
145601
  textUnderlineOffset: 2
145492
145602
  };
145493
- const DIALOG_BACKDROP = {
145494
- position: "absolute",
145495
- inset: 0,
145496
- background: "rgba(0,0,0,0.55)",
145497
- backdropFilter: "blur(2px)",
145498
- display: "flex",
145499
- alignItems: "center",
145500
- justifyContent: "center",
145501
- padding: 14,
145502
- zIndex: 20
145503
- };
145504
- const DIALOG = {
145505
- width: "100%",
145506
- maxWidth: 420,
145507
- maxHeight: "90%",
145508
- overflow: "auto",
145509
- background: C.card,
145510
- border: `1px solid ${C.border}`,
145511
- borderRadius: R.lg,
145512
- boxShadow: "0 24px 60px rgba(0,0,0,0.45)",
145513
- padding: 14,
145514
- display: "flex",
145515
- flexDirection: "column",
145516
- gap: 10
145517
- };
145518
145603
  /** One workflow card: what it will do, what it needs, and its action. */
145519
145604
  function workflowCard(input) {
145520
145605
  const blocked = input.blocked !== void 0;
145606
+ const off = blocked || input.busy || input.locked === true;
145521
145607
  return (0, react.createElement)("div", {
145522
145608
  style: cardStyle({ gap: 9 }),
145523
145609
  "data-hardware-order-card": input.tag.toLowerCase()
145524
145610
  }, (0, react.createElement)("div", { style: {
145525
- ...ROW$1,
145611
+ ...ROW$2,
145526
145612
  gap: 7
145527
145613
  } }, (0, react.createElement)("span", { style: {
145528
145614
  ...TAG,
@@ -145546,33 +145632,71 @@ void main() {
145546
145632
  style: {
145547
145633
  ...buttonStyle("primary"),
145548
145634
  width: "100%",
145549
- ...disabled(blocked || input.busy)
145635
+ ...disabled(off)
145550
145636
  },
145551
- disabled: blocked || input.busy,
145637
+ disabled: off,
145552
145638
  "data-hardware-order-action": input.tag.toLowerCase(),
145553
145639
  onClick: input.onAction
145554
145640
  }, input.busy ? COPY.order.submitting : input.action));
145555
145641
  }
145556
145642
  function OrderPanel(props) {
145557
- const { boardPath, boardTitle, schematicPath, workspaceRoot, session, configured } = props;
145643
+ const { boardPath, boardTitle, schematicPath, workspaceRoot, session, configured, focus } = props;
145558
145644
  const [config, setConfig] = (0, react.useState)();
145559
145645
  const [prepared, setPrepared] = (0, react.useState)();
145560
145646
  const [preparing, setPreparing] = (0, react.useState)(false);
145561
145647
  const [message, setMessage] = (0, react.useState)();
145562
145648
  const [quantity, setQuantity] = (0, react.useState)(20);
145563
- const [confirming, setConfirming] = (0, react.useState)();
145564
- const [acknowledged, setAcknowledged] = (0, react.useState)(false);
145565
145649
  const [placing, setPlacing] = (0, react.useState)();
145566
145650
  const [placed, setPlaced] = (0, react.useState)();
145567
145651
  const [copied, setCopied] = (0, react.useState)(false);
145568
145652
  const [reopening, setReopening] = (0, react.useState)(false);
145569
145653
  const live = (0, react.useRef)(true);
145654
+ /** One in-flight upload at a time, checked before React can re-render. */
145655
+ const uploading = (0, react.useRef)(false);
145656
+ /** `${boardPath}:${kind}` already auto-placed, so a requote cannot upload twice. */
145657
+ const autoPlaced = (0, react.useRef)();
145570
145658
  (0, react.useEffect)(() => {
145571
145659
  live.current = true;
145572
145660
  return () => {
145573
145661
  live.current = false;
145574
145662
  };
145575
145663
  }, []);
145664
+ const submit = async (kind) => {
145665
+ if (uploading.current) return;
145666
+ uploading.current = true;
145667
+ setPlacing(kind);
145668
+ setMessage(void 0);
145669
+ try {
145670
+ const result = await placeOrder(kind, {
145671
+ path: boardPath,
145672
+ ...schematicPath === void 0 ? {} : { schematic: schematicPath },
145673
+ ...workspaceRoot === void 0 ? {} : { cwd: workspaceRoot },
145674
+ ...session === void 0 ? {} : { session },
145675
+ quantity
145676
+ }, void 0);
145677
+ setPlaced(result);
145678
+ openOrderPage(result.orderUrl);
145679
+ } catch (error) {
145680
+ setMessage(messageOf$2(error));
145681
+ } finally {
145682
+ uploading.current = false;
145683
+ setPlacing(void 0);
145684
+ }
145685
+ };
145686
+ (0, react.useEffect)(() => {
145687
+ if (focus === void 0 || prepared === void 0 || !live.current) return;
145688
+ if (config?.hasToken !== true || placing !== void 0) return;
145689
+ const key = `${boardPath}:${focus}`;
145690
+ if (autoPlaced.current === key) return;
145691
+ autoPlaced.current = key;
145692
+ submit(focus);
145693
+ }, [
145694
+ focus,
145695
+ prepared,
145696
+ config,
145697
+ boardPath,
145698
+ placing
145699
+ ]);
145576
145700
  (0, react.useEffect)(() => {
145577
145701
  loadOrderConfig().then((value) => {
145578
145702
  if (live.current) setConfig(value);
@@ -145609,28 +145733,6 @@ void main() {
145609
145733
  ]);
145610
145734
  const facts = prepared?.facts;
145611
145735
  const specs = (0, react.useMemo)(() => facts === void 0 ? [] : specRows(facts), [facts]);
145612
- const submit = async (kind) => {
145613
- setPlacing(kind);
145614
- setMessage(void 0);
145615
- try {
145616
- const result = await placeOrder(kind, {
145617
- path: boardPath,
145618
- ...schematicPath === void 0 ? {} : { schematic: schematicPath },
145619
- ...workspaceRoot === void 0 ? {} : { cwd: workspaceRoot },
145620
- ...session === void 0 ? {} : { session },
145621
- quantity,
145622
- confirm: true
145623
- }, void 0);
145624
- setPlaced(result);
145625
- setConfirming(void 0);
145626
- setAcknowledged(false);
145627
- openOrderPage(result.orderUrl);
145628
- } catch (error) {
145629
- setMessage(messageOf$2(error));
145630
- } finally {
145631
- setPlacing(void 0);
145632
- }
145633
- };
145634
145736
  const copy = async () => {
145635
145737
  if (placed === void 0) return;
145636
145738
  try {
@@ -145710,10 +145812,10 @@ void main() {
145710
145812
  }] : specs,
145711
145813
  action: COPY.order.pcbAction,
145712
145814
  onAction: () => {
145713
- setAcknowledged(false);
145714
- setConfirming("pcb");
145815
+ submit("pcb");
145715
145816
  },
145716
145817
  busy: placing === "pcb",
145818
+ locked: placing !== void 0 && placing !== "pcb",
145717
145819
  ...configured && prepared !== void 0 ? tokenReady ? {} : { blocked: COPY.order.signInToOrder } : { blocked: configured ? COPY.order.waitingForPackage : COPY.order.configureToPackage }
145718
145820
  });
145719
145821
  const smtCard = workflowCard({
@@ -145737,14 +145839,14 @@ void main() {
145737
145839
  ],
145738
145840
  action: COPY.order.smtAction,
145739
145841
  onAction: () => {
145740
- setAcknowledged(false);
145741
- setConfirming("smt");
145842
+ submit("smt");
145742
145843
  },
145743
145844
  busy: placing === "smt",
145845
+ locked: placing !== void 0 && placing !== "smt",
145744
145846
  ...assembly === void 0 ? { blocked: COPY.order.selectRootSchematic } : tokenReady ? {} : { blocked: COPY.order.signInToOrderSmt }
145745
145847
  });
145746
145848
  const agentHint = (0, react.createElement)("div", { style: {
145747
- ...ROW$1,
145849
+ ...ROW$2,
145748
145850
  gap: 4,
145749
145851
  paddingTop: 2
145750
145852
  } }, (0, react.createElement)("span", { style: {
@@ -145774,7 +145876,7 @@ void main() {
145774
145876
  }, placed.orderUrl), (0, react.createElement)("p", { style: {
145775
145877
  ...MUTED,
145776
145878
  fontSize: 10
145777
- } }, COPY.order.resultNote), (0, react.createElement)("div", { style: ROW$1 }, (0, react.createElement)("button", {
145879
+ } }, COPY.order.resultNote), (0, react.createElement)("div", { style: ROW$2 }, (0, react.createElement)("button", {
145778
145880
  type: "button",
145779
145881
  style: {
145780
145882
  ...buttonStyle("primary"),
@@ -145796,65 +145898,6 @@ void main() {
145796
145898
  ...MONO_TEXT,
145797
145899
  fontSize: 10
145798
145900
  } }, `${placed.archive.zipName} · ${formatBytes(placed.archive.zipBytes)}`)));
145799
- const dialog = confirming === void 0 ? null : (0, react.createElement)("div", {
145800
- style: DIALOG_BACKDROP,
145801
- role: "dialog",
145802
- "aria-modal": true,
145803
- "aria-label": COPY.order.confirmAria,
145804
- "data-hardware-order-confirm": confirming
145805
- }, (0, react.createElement)("div", { style: DIALOG }, (0, react.createElement)("div", { style: {
145806
- display: "flex",
145807
- flexDirection: "column",
145808
- gap: 3
145809
- } }, (0, react.createElement)("h4", { style: {
145810
- margin: 0,
145811
- fontSize: 13,
145812
- fontWeight: 600
145813
- } }, confirming === "pcb" ? COPY.order.confirmTitlePcb : COPY.order.confirmTitleSmt), (0, react.createElement)("p", { style: MUTED }, COPY.order.confirmBody)), (0, react.createElement)("ul", { style: {
145814
- margin: 0,
145815
- paddingLeft: 16,
145816
- fontSize: 11,
145817
- color: C.text2,
145818
- lineHeight: 1.7
145819
- } }, (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: {
145820
- ...ROW$1,
145821
- alignItems: "flex-start",
145822
- fontSize: 11,
145823
- color: C.text2,
145824
- cursor: "pointer"
145825
- } }, (0, react.createElement)("input", {
145826
- type: "checkbox",
145827
- checked: acknowledged,
145828
- style: {
145829
- marginTop: 2,
145830
- accentColor: C.accent
145831
- },
145832
- onChange: (event) => {
145833
- setAcknowledged(event.currentTarget.checked);
145834
- },
145835
- "data-hardware-order-ack": true
145836
- }), COPY.order.confirmAck), (0, react.createElement)("div", { style: {
145837
- ...ROW$1,
145838
- justifyContent: "flex-end"
145839
- } }, (0, react.createElement)("button", {
145840
- type: "button",
145841
- style: buttonStyle("quiet"),
145842
- onClick: () => {
145843
- setConfirming(void 0);
145844
- setAcknowledged(false);
145845
- }
145846
- }, COPY.order.cancel), (0, react.createElement)("button", {
145847
- type: "button",
145848
- style: {
145849
- ...buttonStyle("primary"),
145850
- ...disabled(!acknowledged || placing !== void 0)
145851
- },
145852
- disabled: !acknowledged || placing !== void 0,
145853
- "data-hardware-order-confirm-submit": true,
145854
- onClick: () => {
145855
- submit(confirming);
145856
- }
145857
- }, placing === void 0 ? COPY.order.uploadAndOpen : COPY.order.uploading))));
145858
145901
  return (0, react.createElement)("div", {
145859
145902
  style: {
145860
145903
  position: "relative",
@@ -145903,7 +145946,13 @@ void main() {
145903
145946
  ...MUTED,
145904
145947
  ...MONO_TEXT,
145905
145948
  fontSize: 10
145906
- } }, COPY.order.quoteBasis(quantity))), packageCard, resultCard, agentHint, dialog);
145949
+ } }, COPY.order.quoteBasis(quantity))), packageCard, resultCard, (0, react.createElement)("p", {
145950
+ style: {
145951
+ ...MUTED,
145952
+ fontSize: 10
145953
+ },
145954
+ "data-hardware-order-hint": true
145955
+ }, COPY.order.uploadHint), agentHint);
145907
145956
  }
145908
145957
  //#endregion
145909
145958
  //#region src/client/preview.tsx
@@ -146316,7 +146365,7 @@ void main() {
146316
146365
  } }, [row.dnp ? "DNP" : "", ...Object.entries(row.fields).map(([key, value]) => `${key}=${value}`)].filter(Boolean).join(" · "))))))));
146317
146366
  }
146318
146367
  /** Destination → preview dispatcher. */
146319
- function HardwarePreview({ destination, artifact, schematicPath, workspaceRoot, session, revision, configured = false }) {
146368
+ function HardwarePreview({ destination, artifact, schematicPath, workspaceRoot, session, revision, configured = false, orderKind }) {
146320
146369
  if (artifact === void 0) return null;
146321
146370
  const key = `${destination}:${artifact.path}:${String(revision)}`;
146322
146371
  if (destination === "schematic" || destination === "pcb") return (0, react.createElement)(EcadStage, {
@@ -146348,7 +146397,8 @@ void main() {
146348
146397
  ...schematicPath === void 0 ? {} : { schematicPath },
146349
146398
  ...workspaceRoot === void 0 ? {} : { workspaceRoot },
146350
146399
  ...session === void 0 ? {} : { session },
146351
- configured
146400
+ configured,
146401
+ ...orderKind === void 0 ? {} : { focus: orderKind }
146352
146402
  });
146353
146403
  }
146354
146404
  //#endregion
@@ -146388,6 +146438,10 @@ void main() {
146388
146438
  const TOAST_MS = 7e3;
146389
146439
  /** Poll cadence while a job or a discovery run is live. */
146390
146440
  const POLL_MS = 700;
146441
+ /** How long a typed path must settle before its validity is asked of the Host. */
146442
+ const CHECK_MS = 500;
146443
+ /** How long the "saved" badge stays on a card after the Host accepted the write. */
146444
+ const CONFIRM_MS = 6e3;
146391
146445
  const EMPTY_DRAFTS = {
146392
146446
  kicad: "",
146393
146447
  solidcraft: ""
@@ -146447,6 +146501,8 @@ void main() {
146447
146501
  loading: true,
146448
146502
  jobs: {},
146449
146503
  drafts: EMPTY_DRAFTS,
146504
+ checks: {},
146505
+ confirmed: {},
146450
146506
  toasts: []
146451
146507
  };
146452
146508
  listeners = /* @__PURE__ */ new Set();
@@ -146459,6 +146515,12 @@ void main() {
146459
146515
  phases = /* @__PURE__ */ new Map();
146460
146516
  /** The job id each tool's card is watching; the poll asks for all of them at once. */
146461
146517
  watched = /* @__PURE__ */ new Map();
146518
+ /** Debounce timers for the input's own validity check, one per tool. */
146519
+ checkTimers = /* @__PURE__ */ new Map();
146520
+ /** Per-tool sequence so a late answer cannot overwrite a newer verdict. */
146521
+ checkSeq = /* @__PURE__ */ new Map();
146522
+ /** Timers that retract the "saved" badge after {@link CONFIRM_MS}. */
146523
+ confirmTimers = /* @__PURE__ */ new Map();
146462
146524
  constructor(transport = HOST_TRANSPORT, pollMs = POLL_MS) {
146463
146525
  this.transport = transport;
146464
146526
  this.pollMs = pollMs;
@@ -146495,6 +146557,10 @@ void main() {
146495
146557
  this.timer = void 0;
146496
146558
  for (const timer of this.timers.values()) clearTimeout(timer);
146497
146559
  this.timers.clear();
146560
+ for (const timer of this.checkTimers.values()) clearTimeout(timer);
146561
+ this.checkTimers.clear();
146562
+ for (const timer of this.confirmTimers.values()) clearTimeout(timer);
146563
+ this.confirmTimers.clear();
146498
146564
  this.listeners.clear();
146499
146565
  }
146500
146566
  /** Read the Host status, asking about every job a card is watching. */
@@ -146516,12 +146582,24 @@ void main() {
146516
146582
  solidcraft
146517
146583
  };
146518
146584
  const jobs = collectJobs(status, this.snapshot.jobs);
146585
+ const checks = { ...this.snapshot.checks };
146586
+ if ((kicad ?? solidcraft) !== void 0) {
146587
+ if (kicad !== void 0) checks.kicad = {
146588
+ state: "valid",
146589
+ installPath: kicad
146590
+ };
146591
+ if (solidcraft !== void 0) checks.solidcraft = {
146592
+ state: "valid",
146593
+ installPath: solidcraft
146594
+ };
146595
+ }
146519
146596
  this.set({
146520
146597
  status,
146521
146598
  loading: false,
146522
146599
  error: void 0,
146523
146600
  drafts,
146524
- jobs
146601
+ jobs,
146602
+ checks
146525
146603
  });
146526
146604
  for (const job of Object.values(jobs)) if (job !== void 0) this.noteJob(job);
146527
146605
  for (const [tool, id] of this.watched) {
@@ -146746,18 +146824,146 @@ void main() {
146746
146824
  nativePending: false
146747
146825
  } : void 0 });
146748
146826
  }
146749
- /** Type a path without persisting it. */
146827
+ /**
146828
+ * Type a path without persisting it, and ask the Host whether it is usable.
146829
+ *
146830
+ * The verdict is not cosmetic: the wizard's primary button is enabled only
146831
+ * when a tool is configured or one input has been verified, so this check is
146832
+ * what keeps "greyed out" honest instead of guessing from the text.
146833
+ */
146750
146834
  setDraft(tool, value) {
146751
146835
  this.set({ drafts: this.withDraft(tool, value) });
146836
+ this.scheduleCheck(tool, value);
146837
+ }
146838
+ /** Debounce a validity check for the text that just changed. */
146839
+ scheduleCheck(tool, value) {
146840
+ const pending = this.checkTimers.get(tool);
146841
+ if (pending !== void 0) {
146842
+ clearTimeout(pending);
146843
+ this.checkTimers.delete(tool);
146844
+ }
146845
+ const text = value.trim();
146846
+ if (text === "") {
146847
+ this.patchCheck(tool, void 0);
146848
+ return;
146849
+ }
146850
+ const root = this.roots[tool];
146851
+ if (root !== "" && text === root) {
146852
+ this.patchCheck(tool, {
146853
+ state: "valid",
146854
+ installPath: root
146855
+ });
146856
+ return;
146857
+ }
146858
+ const known = this.knownVersion(tool, text);
146859
+ if (known !== void 0) {
146860
+ this.patchCheck(tool, {
146861
+ state: "valid",
146862
+ version: known
146863
+ });
146864
+ return;
146865
+ }
146866
+ this.patchCheck(tool, { state: "pending" });
146867
+ const timer = setTimeout(() => {
146868
+ this.checkTimers.delete(tool);
146869
+ this.runCheck(tool, text);
146870
+ }, CHECK_MS);
146871
+ this.checkTimers.set(tool, timer);
146872
+ }
146873
+ /** A discovered, already-validated executable: no process needs to run again. */
146874
+ knownVersion(tool, text) {
146875
+ const match = (this.snapshot.status?.[tool].discovery.candidates ?? []).find((candidate) => candidate.valid && candidate.path === text);
146876
+ return match?.version ?? (match === void 0 ? void 0 : "?");
146877
+ }
146878
+ /** Ask the Host about one path and record the verdict if it is still current. */
146879
+ async runCheck(tool, text) {
146880
+ if (this.stopped) return;
146881
+ const seq = (this.checkSeq.get(tool) ?? 0) + 1;
146882
+ this.checkSeq.set(tool, seq);
146883
+ let outcome;
146884
+ try {
146885
+ outcome = await this.transport.validate(tool, text);
146886
+ } catch (error) {
146887
+ outcome = {
146888
+ ok: false,
146889
+ error: messageOf$2(error)
146890
+ };
146891
+ }
146892
+ if (this.stopped || this.checkSeq.get(tool) !== seq) return;
146893
+ if (this.snapshot.drafts[tool].trim() !== text) return;
146894
+ this.patchCheck(tool, outcome.ok ? {
146895
+ state: "valid",
146896
+ ...outcome.installPath === void 0 ? {} : { installPath: outcome.installPath },
146897
+ ...outcome.version === void 0 ? {} : { version: outcome.version }
146898
+ } : {
146899
+ state: "invalid",
146900
+ ...outcome.error === void 0 ? {} : { error: outcome.error }
146901
+ });
146902
+ }
146903
+ /** Replace (or drop, with `undefined`) one tool's verdict. */
146904
+ patchCheck(tool, check) {
146905
+ const next = { ...this.snapshot.checks };
146906
+ if (check === void 0) delete next[tool];
146907
+ else next[tool] = check;
146908
+ this.set({ checks: next });
146909
+ }
146910
+ /**
146911
+ * Show the success badge for a write the Host accepted, then retract it.
146912
+ *
146913
+ * The badge replaces the verdict line, so the card stops shouting the full
146914
+ * executable path (or "not saved") about a path that is in fact saved.
146915
+ */
146916
+ confirm(tool, version) {
146917
+ this.clearConfirm(tool);
146918
+ this.set({ confirmed: {
146919
+ ...this.snapshot.confirmed,
146920
+ [tool]: {
146921
+ at: Date.now(),
146922
+ ...version === void 0 ? {} : { version }
146923
+ }
146924
+ } });
146925
+ const timer = setTimeout(() => {
146926
+ this.confirmTimers.delete(tool);
146927
+ this.clearConfirm(tool);
146928
+ }, CONFIRM_MS);
146929
+ this.confirmTimers.set(tool, timer);
146930
+ }
146931
+ clearConfirm(tool) {
146932
+ const timer = this.confirmTimers.get(tool);
146933
+ if (timer !== void 0) {
146934
+ clearTimeout(timer);
146935
+ this.confirmTimers.delete(tool);
146936
+ }
146937
+ if (this.snapshot.confirmed[tool] === void 0) return;
146938
+ const next = { ...this.snapshot.confirmed };
146939
+ delete next[tool];
146940
+ this.set({ confirmed: next });
146752
146941
  }
146753
146942
  /** Validate and persist one path through the Host (§6.3). */
146754
146943
  async save(tool, path, source = "manual") {
146755
146944
  const name = tool === "kicad" ? "KiCad" : "SolidCraft";
146756
146945
  this.set({ saving: tool });
146946
+ this.clearConfirm(tool);
146757
146947
  try {
146758
146948
  const outcome = await this.transport.save(tool, path, source);
146759
- if (outcome.ok) this.toast("ok", COPY.toolchain.toastSaved(name, outcome.version ?? "?"));
146760
- else this.toast("warn", COPY.toolchain.toastInvalid(name, outcome.error ?? COPY.toolchain.notDetected));
146949
+ if (outcome.ok) {
146950
+ const accepted = outcome.installPath ?? path.trim();
146951
+ this.roots[tool] = accepted;
146952
+ if (this.snapshot.drafts[tool].trim() !== accepted) this.set({ drafts: this.withDraft(tool, accepted) });
146953
+ this.patchCheck(tool, {
146954
+ state: "valid",
146955
+ installPath: accepted,
146956
+ ...outcome.version === void 0 ? {} : { version: outcome.version }
146957
+ });
146958
+ this.confirm(tool, outcome.version);
146959
+ this.toast("ok", COPY.toolchain.toastSaved(name, outcome.version ?? "?"));
146960
+ } else {
146961
+ this.patchCheck(tool, {
146962
+ state: "invalid",
146963
+ ...outcome.error === void 0 ? {} : { error: outcome.error }
146964
+ });
146965
+ this.toast("warn", COPY.toolchain.toastInvalid(name, outcome.error ?? COPY.toolchain.notDetected));
146966
+ }
146761
146967
  await this.refresh();
146762
146968
  return outcome;
146763
146969
  } catch (error) {
@@ -146951,6 +147157,43 @@ void main() {
146951
147157
  };
146952
147158
  }
146953
147159
  }
147160
+ /**
147161
+ * The wizard's badge, which is about **readiness**, not configuration.
147162
+ *
147163
+ * The prototype reads `✓ Ready (v10.0.7)`. The wizard is the first-run surface,
147164
+ * so it must light up as soon as the user has a tool it can actually use —
147165
+ * whether that came from a saved root, a path the Host just validated, or an
147166
+ * executable discovery already checked. Only when none of those hold does it fall
147167
+ * back to the state pill (`Not configured`, a running download, a failure), which
147168
+ * is also what it shows while a job is in flight.
147169
+ */
147170
+ function wizardPill(tool, job, check) {
147171
+ const statePill = statusPill(tool, job);
147172
+ if (job !== void 0 && job.tool === tool.tool && (jobRunning(job) || job.phase === "failed")) return statePill;
147173
+ const detected = tool.discovery?.selected;
147174
+ const saved = tool.installPath !== void 0 && tool.version !== void 0 && tool.state !== "invalid";
147175
+ if (!(tool.state === "configured" || saved || check?.state === "valid" || detected?.valid === true)) return statePill;
147176
+ const version = tool.state === "configured" || saved ? tool.version : check?.state === "valid" ? check.version : detected?.version;
147177
+ return {
147178
+ text: version === void 0 ? COPY.wizard.readyDetected : COPY.wizard.ready(version),
147179
+ tone: "ok"
147180
+ };
147181
+ }
147182
+ /** One line of verdict text beside the validate button; never a filesystem path. */
147183
+ function textVerdict(text, color) {
147184
+ return (0, react.createElement)("span", {
147185
+ style: {
147186
+ ...MONO_TEXT,
147187
+ fontSize: 11,
147188
+ color,
147189
+ maxWidth: 260,
147190
+ overflow: "hidden",
147191
+ textOverflow: "ellipsis",
147192
+ whiteSpace: "nowrap"
147193
+ },
147194
+ title: text
147195
+ }, text);
147196
+ }
146954
147197
  /** One line describing what discovery found, or that it is still looking. */
146955
147198
  function discoveryLine(tool) {
146956
147199
  const discovery = tool.discovery;
@@ -147044,10 +147287,11 @@ void main() {
147044
147287
  const draft = snapshot.drafts[id];
147045
147288
  const saving = snapshot.saving === id;
147046
147289
  const running = jobRunning(job);
147290
+ const check = snapshot.checks[id];
147047
147291
  const pill = tool === void 0 ? {
147048
147292
  text: COPY.toolchain.statusValidating,
147049
147293
  tone: "muted"
147050
- } : statusPill(tool, job);
147294
+ } : variant === "wizard" ? wizardPill(tool, job, check) : statusPill(tool, job);
147051
147295
  const entry = tool?.download;
147052
147296
  const busy = running || saving;
147053
147297
  const onSave = () => {
@@ -147092,7 +147336,10 @@ void main() {
147092
147336
  }, `(${meta.code})`)], variant === "wizard" ? (0, react.createElement)(Chip, { text: id === "kicad" ? COPY.wizard.kicadChip : COPY.wizard.solidcraftChip }) : null), variant === "wizard" ? (0, react.createElement)("span", { style: {
147093
147337
  fontSize: 11,
147094
147338
  color: C.text3
147095
- } }, id === "kicad" ? COPY.wizard.kicadBlurb : COPY.wizard.solidcraftBlurb) : null)), (0, react.createElement)("span", { style: pillStyle(pill.tone) }, pill.text));
147339
+ } }, id === "kicad" ? COPY.wizard.kicadBlurb : COPY.wizard.solidcraftBlurb) : null)), (0, react.createElement)("span", {
147340
+ style: pillStyle(pill.tone),
147341
+ "data-hardware-toolchain-pill": id
147342
+ }, pill.text));
147096
147343
  const description = variant === "settings" ? (0, react.createElement)("p", { style: {
147097
147344
  ...MUTED,
147098
147345
  lineHeight: 1.6
@@ -147139,7 +147386,26 @@ void main() {
147139
147386
  color: "#FBBF24"
147140
147387
  }), variant === "wizard" ? COPY.wizard.selectFile : COPY.toolchain.browse));
147141
147388
  const savedRoot = tool?.installPath ?? "";
147142
- const statusText = draft.trim() !== "" && draft.trim() !== savedRoot ? COPY.settings.statusUnsaved : tool?.state === "configured" ? tool.cliPath ?? COPY.settings.statusVerified : tool?.error ?? COPY.settings.statusAwaiting;
147389
+ const dirty = draft.trim() !== "" && draft.trim() !== savedRoot;
147390
+ const confirmation = snapshot.confirmed[id];
147391
+ const verdict = (() => {
147392
+ if (confirmation !== void 0) return (0, react.createElement)("span", {
147393
+ style: {
147394
+ ...pillStyle("ok"),
147395
+ display: "inline-flex",
147396
+ alignItems: "center",
147397
+ gap: 6,
147398
+ whiteSpace: "nowrap"
147399
+ },
147400
+ role: "status",
147401
+ "data-hardware-toolchain-confirmed": id
147402
+ }, (0, react.createElement)("span", { style: dotStyle(C.ok, 6) }), confirmation.version === void 0 ? COPY.settings.statusSavedPlain : COPY.settings.statusSavedBadge(confirmation.version));
147403
+ if (dirty && check?.state === "invalid") return textVerdict(check.error ?? COPY.toolchain.statusInvalid, C.warn);
147404
+ if (dirty && check?.state === "pending") return textVerdict(COPY.toolchain.statusValidating, C.text3);
147405
+ if (dirty) return textVerdict(COPY.settings.statusUnsaved, C.text3);
147406
+ if (tool?.state === "configured") return null;
147407
+ return textVerdict(tool?.error ?? COPY.settings.statusAwaiting, tool?.error === void 0 ? C.text3 : C.warn);
147408
+ })();
147143
147409
  const validateRow = (0, react.createElement)("div", { style: {
147144
147410
  display: "flex",
147145
147411
  alignItems: "center",
@@ -147154,17 +147420,7 @@ void main() {
147154
147420
  },
147155
147421
  disabled: busy,
147156
147422
  onClick: onSave
147157
- }, saving ? COPY.settings.validating : COPY.settings.validate), variant === "settings" ? (0, react.createElement)("span", {
147158
- style: {
147159
- ...MONO_TEXT,
147160
- fontSize: 11,
147161
- maxWidth: 260,
147162
- overflow: "hidden",
147163
- textOverflow: "ellipsis",
147164
- whiteSpace: "nowrap"
147165
- },
147166
- title: statusText
147167
- }, statusText) : null);
147423
+ }, saving ? COPY.settings.validating : COPY.settings.validate), variant === "settings" ? verdict : null);
147168
147424
  /** Download affordance: a plugin job first, the vendor page as the honest fallback. */
147169
147425
  const download = entry === void 0 && tool !== void 0 ? officialFallback(id, snapshot) : (0, react.createElement)("a", {
147170
147426
  href: entry?.url ?? snapshot.status?.official[id] ?? "#",
@@ -147232,7 +147488,8 @@ void main() {
147232
147488
  padding: variant === "wizard" ? 14 : 16
147233
147489
  }),
147234
147490
  "data-hardware-toolchain-card": id,
147235
- "data-variant": variant
147491
+ "data-variant": variant,
147492
+ "data-hardware-toolchain-check": check?.state ?? "none"
147236
147493
  }, header, ...description === null ? [] : [description], pathRow, ...actionRow === null ? [] : [actionRow], ...downloadBar === null ? [] : [downloadBar], ...running && job !== void 0 ? [Progress({
147237
147494
  job,
147238
147495
  color: meta.bar
@@ -147246,7 +147503,7 @@ void main() {
147246
147503
  /** §9.2: no in-app build for this platform means the vendor page, never a fake button. */
147247
147504
  function officialFallback(tool, snapshot) {
147248
147505
  return (0, react.createElement)("a", {
147249
- href: snapshot.status?.official[tool] ?? "#",
147506
+ href: snapshot.status?.official?.[tool] ?? "#",
147250
147507
  target: "_blank",
147251
147508
  rel: "noreferrer noopener",
147252
147509
  style: {
@@ -147396,7 +147653,7 @@ void main() {
147396
147653
  alignItems: "center",
147397
147654
  justifyContent: "center",
147398
147655
  padding: 16,
147399
- background: "rgba(0,0,0,0.75)",
147656
+ background: "rgba(0,0,0,0.32)",
147400
147657
  pointerEvents: "auto"
147401
147658
  },
147402
147659
  role: "dialog",
@@ -147567,7 +147824,7 @@ void main() {
147567
147824
  style: {
147568
147825
  position: "fixed",
147569
147826
  inset: 0,
147570
- zIndex: 2100,
147827
+ zIndex: 2400,
147571
147828
  pointerEvents: "none"
147572
147829
  },
147573
147830
  "data-hardware-toolchain-toasts": true
@@ -147668,7 +147925,7 @@ void main() {
147668
147925
  navigation: {}
147669
147926
  } };
147670
147927
  const useEmptyTab = () => EMPTY_TAB;
147671
- const ROW = {
147928
+ const ROW$1 = {
147672
147929
  display: "flex",
147673
147930
  alignItems: "center",
147674
147931
  gap: 4,
@@ -147729,7 +147986,7 @@ void main() {
147729
147986
  minWidth: 0
147730
147987
  };
147731
147988
  const STRIP_GROUP = {
147732
- ...ROW,
147989
+ ...ROW$1,
147733
147990
  gap: 2,
147734
147991
  flexWrap: "nowrap",
147735
147992
  overflowX: "auto",
@@ -147757,7 +148014,7 @@ void main() {
147757
148014
  whiteSpace: "nowrap",
147758
148015
  minWidth: 0
147759
148016
  };
147760
- const BODY = {
148017
+ const BODY$1 = {
147761
148018
  flex: "1 1 0",
147762
148019
  minHeight: 0,
147763
148020
  display: "flex",
@@ -147895,6 +148152,8 @@ void main() {
147895
148152
  const artifact = useStore((state) => selectedArtifact(state, active));
147896
148153
  const missing = useStore((state) => missingState(state, active));
147897
148154
  const workspaceRoot = useStore((state) => state.workspaceRoot);
148155
+ /** Operation the Place Order view picked, if this navigation came from it. */
148156
+ const orderKind = params?.orderKind;
147898
148157
  const cwd = useSessions?.((state) => {
147899
148158
  if (sessionId === void 0) return void 0;
147900
148159
  return state.byId[sessionId]?.cwd;
@@ -148029,7 +148288,7 @@ void main() {
148029
148288
  }, ...(selectedProject.boards ?? []).map((board) => option(board.path, board.title || board.path))));
148030
148289
  }
148031
148290
  const banner = (0, react.createElement)("div", { style: {
148032
- ...ROW,
148291
+ ...ROW$1,
148033
148292
  gap: 6,
148034
148293
  padding: "0 2px",
148035
148294
  flex: "0 0 auto"
@@ -148052,7 +148311,7 @@ void main() {
148052
148311
  style: PANEL_ROOT,
148053
148312
  "data-hardware-destination": active
148054
148313
  }, (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: {
148055
- ...BODY,
148314
+ ...BODY$1,
148056
148315
  overflow: active === "order" || active === "bom" ? "auto" : "hidden"
148057
148316
  } }, ...missing === void 0 ? [(0, react.createElement)(HardwarePreview, {
148058
148317
  key: `preview:${info.tab.id}:${String(navRevision)}:${active}:${artifact?.path ?? ""}`,
@@ -148062,7 +148321,8 @@ void main() {
148062
148321
  ...workspaceRoot === void 0 ? {} : { workspaceRoot },
148063
148322
  ...sessionId === void 0 ? {} : { session: sessionId },
148064
148323
  revision: navRevision,
148065
- configured: kicadConfigured
148324
+ configured: kicadConfigured,
148325
+ ...orderKind === void 0 ? {} : { orderKind }
148066
148326
  })] : [(0, react.createElement)("div", {
148067
148327
  key: "missing",
148068
148328
  style: cardStyle({
@@ -148140,6 +148400,316 @@ void main() {
148140
148400
  }
148141
148401
  }, snapshot.error)]);
148142
148402
  }
148403
+ //#endregion
148404
+ //#region src/client/place-order.tsx
148405
+ /**
148406
+ * The Place Order view: pick a KiCad project, then pick the operation.
148407
+ *
148408
+ * This is the plugin-owned entry point the desktop menu and the user both reach
148409
+ * without an agent message. It does exactly two things — list what the Host
148410
+ * discovered in the current workspace, and hand one project to the existing
148411
+ * order destination — because the manufacturing work already exists: packaging,
148412
+ * validation, the upload, the token and the page are the same code the agent's
148413
+ * tools and the order panel use. Nothing here prices, packages or scans on its
148414
+ * own; `discover()` is the Host's deterministic scan and every row is rendered
148415
+ * from its answer.
148416
+ *
148417
+ * Readiness is shown, not guessed: PCB needs a saved board, PCBA additionally
148418
+ * needs the project schematic the positions and BOM are exported from, and both
148419
+ * need a configured KiCad and a signed-in account. An unavailable operation keeps
148420
+ * its button visible but disabled with the reason next to it.
148421
+ */
148422
+ const ROOT = {
148423
+ display: "flex",
148424
+ flexDirection: "column",
148425
+ height: "100%",
148426
+ minHeight: 0,
148427
+ minWidth: 0,
148428
+ boxSizing: "border-box",
148429
+ background: C.base,
148430
+ color: C.text
148431
+ };
148432
+ const HEAD = {
148433
+ display: "flex",
148434
+ alignItems: "center",
148435
+ gap: 8,
148436
+ flexWrap: "wrap",
148437
+ padding: "8px 12px",
148438
+ borderBottom: `1px solid ${C.borderSoft}`,
148439
+ flex: "0 0 auto"
148440
+ };
148441
+ const BODY = {
148442
+ flex: "1 1 0",
148443
+ minHeight: 0,
148444
+ overflow: "auto",
148445
+ padding: 12,
148446
+ display: "flex",
148447
+ flexDirection: "column",
148448
+ gap: 8
148449
+ };
148450
+ const ROW = {
148451
+ display: "flex",
148452
+ alignItems: "center",
148453
+ gap: 8,
148454
+ minWidth: 0
148455
+ };
148456
+ const NAME = {
148457
+ fontSize: 12.5,
148458
+ fontWeight: 600,
148459
+ color: C.text,
148460
+ minWidth: 0
148461
+ };
148462
+ const SUB = {
148463
+ ...MUTED,
148464
+ fontFamily: MONO,
148465
+ fontSize: 10.5,
148466
+ wordBreak: "break-all"
148467
+ };
148468
+ const CHIP = {
148469
+ ...pillStyle("muted"),
148470
+ fontSize: 9.5,
148471
+ padding: "0 5px",
148472
+ whiteSpace: "nowrap"
148473
+ };
148474
+ const REASON = {
148475
+ ...MUTED,
148476
+ fontSize: 10,
148477
+ maxWidth: 190,
148478
+ lineHeight: 1.45
148479
+ };
148480
+ /** Boardless-safe artifact summary for one row. */
148481
+ function artifactsLine(project) {
148482
+ const boards = project.boards?.length ?? 0;
148483
+ const board = boards === 0 ? void 0 : project.defaultBoard ?? project.boards?.[0]?.path;
148484
+ const boardName = board === void 0 ? void 0 : board.slice(Math.max(board.lastIndexOf("\\"), board.lastIndexOf("/")) + 1);
148485
+ const schematic = project.schematic?.path;
148486
+ const schematicName = schematic === void 0 ? void 0 : schematic.slice(Math.max(schematic.lastIndexOf("\\"), schematic.lastIndexOf("/")) + 1);
148487
+ return [
148488
+ COPY.order.placeOrder.boardCount(boards),
148489
+ boardName ?? COPY.order.placeOrder.noBoard,
148490
+ schematicName ?? COPY.order.placeOrder.noSchematic
148491
+ ].join(" · ");
148492
+ }
148493
+ /** Path of the project directory relative to the scanned workspace. */
148494
+ function relativePath(root, path) {
148495
+ const normalizedRoot = root.replace(/[\\/]+$/u, "");
148496
+ if (!path.startsWith(normalizedRoot)) return path;
148497
+ return path.slice(normalizedRoot.length).replace(/^[\\/]+/u, "") || ".";
148498
+ }
148499
+ function PlaceOrderBody(props) {
148500
+ const { discover, installations, orderProject, sessionId, useSessions } = props;
148501
+ const cwd = useSessions?.((state) => {
148502
+ if (sessionId === void 0) return void 0;
148503
+ return state.byId[sessionId]?.cwd;
148504
+ });
148505
+ const [root, setRoot] = (0, react.useState)();
148506
+ const [projects, setProjects] = (0, react.useState)();
148507
+ const [issue, setIssue] = (0, react.useState)();
148508
+ const [error, setError] = (0, react.useState)();
148509
+ const [scanning, setScanning] = (0, react.useState)(false);
148510
+ const [kicadReady, setKicadReady] = (0, react.useState)();
148511
+ const [config, setConfig] = (0, react.useState)();
148512
+ const [revision, setRevision] = (0, react.useState)(0);
148513
+ (0, react.useEffect)(() => {
148514
+ let live = true;
148515
+ setScanning(true);
148516
+ setError(void 0);
148517
+ discover(cwd, void 0, sessionId).then((result) => {
148518
+ if (!live) return;
148519
+ setRoot(result.cwd);
148520
+ setProjects(result.projects ?? []);
148521
+ setIssue(result.issue);
148522
+ }).catch((failure) => {
148523
+ if (!live) return;
148524
+ setProjects([]);
148525
+ setError(messageOf$2(failure));
148526
+ }).finally(() => {
148527
+ if (live) setScanning(false);
148528
+ });
148529
+ return () => {
148530
+ live = false;
148531
+ };
148532
+ }, [
148533
+ cwd,
148534
+ sessionId,
148535
+ discover,
148536
+ revision
148537
+ ]);
148538
+ (0, react.useEffect)(() => {
148539
+ let live = true;
148540
+ installations().then((result) => {
148541
+ if (live) setKicadReady(result.kicad?.configured === true);
148542
+ }).catch(() => {
148543
+ if (live) setKicadReady(false);
148544
+ });
148545
+ loadOrderConfig().then((value) => {
148546
+ if (live) setConfig(value);
148547
+ }).catch(() => {
148548
+ if (live) setConfig(void 0);
148549
+ });
148550
+ return () => {
148551
+ live = false;
148552
+ };
148553
+ }, [installations]);
148554
+ const signedIn = config?.hasToken;
148555
+ const scanningNow = scanning;
148556
+ /** Why one operation is unavailable for this row, in priority order. */
148557
+ const blockedReason = (kind, project) => {
148558
+ if (kind === "pcb") {
148559
+ if ((project.boards?.length ?? 0) === 0) return COPY.order.placeOrder.noBoard;
148560
+ } else {
148561
+ if ((project.boards?.length ?? 0) === 0) return COPY.order.placeOrder.noBoard;
148562
+ if (project.schematic === void 0) return COPY.order.placeOrder.noSchematic;
148563
+ }
148564
+ if (kicadReady === false) return COPY.order.placeOrder.needsKicad;
148565
+ if (signedIn === false) return COPY.order.placeOrder.needsSignIn;
148566
+ };
148567
+ const order = (kind, project) => {
148568
+ const boards = project.boards ?? [];
148569
+ const board = project.defaultBoard === void 0 ? boards[0] : boards.find((candidate) => candidate.path === project.defaultBoard) ?? boards[0];
148570
+ if (board === void 0) return;
148571
+ orderProject({
148572
+ projectPath: project.path,
148573
+ boardPath: board.path,
148574
+ ...project.schematic === void 0 ? {} : { schematicPath: project.schematic.path },
148575
+ kind: kind === "pcb" ? "pcb" : "smt"
148576
+ });
148577
+ };
148578
+ const row = (project) => {
148579
+ const pcbReason = blockedReason("pcb", project);
148580
+ const pcbaReason = blockedReason("pcba", project);
148581
+ return (0, react.createElement)("div", {
148582
+ key: project.path,
148583
+ style: cardStyle({
148584
+ gap: 6,
148585
+ padding: 10
148586
+ }),
148587
+ "data-hardware-place-order-project": project.path,
148588
+ "data-hardware-place-order-pcb": pcbReason === void 0 ? "ready" : "blocked",
148589
+ "data-hardware-place-order-pcba": pcbaReason === void 0 ? "ready" : "blocked"
148590
+ }, (0, react.createElement)("div", { style: {
148591
+ ...ROW,
148592
+ justifyContent: "space-between",
148593
+ alignItems: "flex-start"
148594
+ } }, (0, react.createElement)("div", { style: {
148595
+ display: "flex",
148596
+ flexDirection: "column",
148597
+ gap: 2,
148598
+ minWidth: 0
148599
+ } }, (0, react.createElement)("span", { style: NAME }, project.name), (0, react.createElement)("span", {
148600
+ style: SUB,
148601
+ title: project.path
148602
+ }, relativePath(root ?? "", project.path))), (0, react.createElement)("span", { style: CHIP }, artifactsLine(project))), (0, react.createElement)("div", { style: {
148603
+ ...ROW,
148604
+ alignItems: "flex-start",
148605
+ flexWrap: "wrap"
148606
+ } }, (0, react.createElement)("div", { style: {
148607
+ display: "flex",
148608
+ flexDirection: "column",
148609
+ gap: 2,
148610
+ minWidth: 0
148611
+ } }, (0, react.createElement)("button", {
148612
+ type: "button",
148613
+ style: {
148614
+ ...buttonStyle("primary", {
148615
+ padding: "4px 10px",
148616
+ fontSize: 11
148617
+ }),
148618
+ ...disabled(pcbReason !== void 0 || scanningNow)
148619
+ },
148620
+ disabled: pcbReason !== void 0 || scanningNow,
148621
+ "data-hardware-place-order-action": "pcb",
148622
+ onClick: () => {
148623
+ order("pcb", project);
148624
+ }
148625
+ }, COPY.order.placeOrder.pcbAction), ...pcbReason === void 0 ? [] : [(0, react.createElement)("span", {
148626
+ key: "pcb-why",
148627
+ style: REASON
148628
+ }, pcbReason)]), (0, react.createElement)("div", { style: {
148629
+ display: "flex",
148630
+ flexDirection: "column",
148631
+ gap: 2,
148632
+ minWidth: 0
148633
+ } }, (0, react.createElement)("button", {
148634
+ type: "button",
148635
+ style: {
148636
+ ...buttonStyle("secondary", {
148637
+ padding: "4px 10px",
148638
+ fontSize: 11
148639
+ }),
148640
+ ...disabled(pcbaReason !== void 0 || scanningNow)
148641
+ },
148642
+ disabled: pcbaReason !== void 0 || scanningNow,
148643
+ "data-hardware-place-order-action": "pcba",
148644
+ onClick: () => {
148645
+ order("pcba", project);
148646
+ }
148647
+ }, COPY.order.placeOrder.pcbaAction), ...pcbaReason === void 0 ? [] : [(0, react.createElement)("span", {
148648
+ key: "pcba-why",
148649
+ style: REASON
148650
+ }, pcbaReason)])));
148651
+ };
148652
+ const header = (0, react.createElement)("div", { style: HEAD }, (0, react.createElement)("span", { style: {
148653
+ ...SECTION_TITLE,
148654
+ marginRight: 2
148655
+ } }, COPY.order.placeOrder.title), (0, react.createElement)("span", {
148656
+ style: {
148657
+ fontFamily: MONO,
148658
+ fontSize: 10.5,
148659
+ color: C.text3,
148660
+ minWidth: 0,
148661
+ overflow: "hidden",
148662
+ textOverflow: "ellipsis",
148663
+ whiteSpace: "nowrap",
148664
+ flex: "1 1 120px"
148665
+ },
148666
+ title: root ?? ""
148667
+ }, root ?? COPY.order.placeOrder.workspaceUnknown), (0, react.createElement)("span", {
148668
+ style: pillStyle(kicadReady === false ? "warn" : "muted"),
148669
+ "data-hardware-place-order-kicad": kicadReady === false ? "missing" : kicadReady === true ? "ok" : "checking"
148670
+ }, (0, react.createElement)("span", { style: dotStyle(kicadReady === false ? C.warn : kicadReady === true ? C.ok : C.text3, 6) }), kicadReady === false ? COPY.order.placeOrder.needsKicad : kicadReady === true ? COPY.order.placeOrder.kicadReady : COPY.order.placeOrder.checking), (0, react.createElement)("span", {
148671
+ style: pillStyle(signedIn === false ? "warn" : "muted"),
148672
+ "data-hardware-place-order-signin": signedIn === false ? "missing" : signedIn === true ? "ok" : "checking"
148673
+ }, (0, react.createElement)("span", { style: dotStyle(signedIn === false ? C.warn : signedIn === true ? C.ok : C.text3, 6) }), signedIn === false ? COPY.order.placeOrder.needsSignIn : signedIn === true ? COPY.order.placeOrder.signInReady : COPY.order.placeOrder.checking), (0, react.createElement)("button", {
148674
+ type: "button",
148675
+ style: {
148676
+ ...buttonStyle("quiet", {
148677
+ padding: "3px 8px",
148678
+ fontSize: 10.5
148679
+ }),
148680
+ ...disabled(scanningNow)
148681
+ },
148682
+ disabled: scanningNow,
148683
+ "data-hardware-place-order-refresh": true,
148684
+ onClick: () => {
148685
+ setRevision((value) => value + 1);
148686
+ }
148687
+ }, scanningNow ? COPY.order.placeOrder.refreshing : COPY.order.placeOrder.refresh));
148688
+ const body = (0, react.createElement)("div", { style: BODY }, (0, react.createElement)("p", { style: MUTED }, COPY.order.placeOrder.lead), ...error === void 0 ? [] : [(0, react.createElement)("p", {
148689
+ key: "error",
148690
+ role: "status",
148691
+ style: {
148692
+ ...MUTED,
148693
+ color: C.warn,
148694
+ borderLeft: `2px solid ${C.warn}`,
148695
+ paddingLeft: 8
148696
+ }
148697
+ }, COPY.order.placeOrder.discoveryFailed(error))], ...scanningNow && projects === void 0 ? [(0, react.createElement)("p", {
148698
+ key: "loading",
148699
+ style: MUTED
148700
+ }, COPY.order.placeOrder.loading)] : [], ...projects === void 0 || scanningNow || error !== void 0 || projects.length > 0 ? [] : [(0, react.createElement)("div", {
148701
+ key: "empty",
148702
+ style: cardStyle({
148703
+ alignItems: "flex-start",
148704
+ gap: 4
148705
+ }),
148706
+ "data-hardware-place-order-empty": issue?.code ?? "none"
148707
+ }, (0, react.createElement)("span", { style: pillStyle("warn") }, COPY.order.placeOrder.noProjects), (0, react.createElement)("p", { style: MUTED }, COPY.order.placeOrder.noProjectsHint))], ...projects === void 0 ? [] : projects.map(row));
148708
+ return (0, react.createElement)("div", {
148709
+ style: ROOT,
148710
+ "data-hardware-place-order": true
148711
+ }, header, body);
148712
+ }
148143
148713
  /** The mark as an `<img src>`; carries its own viewBox, so it scales to any size. */
148144
148714
  const HUAQIU_LOGO_SRC = `data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI1LjAuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IuWbvuWxgl8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCIKCSB2aWV3Qm94PSIwIDAgNTAgNTAiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDUwIDUwOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+Cgkuc3Qwe2ZpbGw6I0NDMDAwMDt9Cjwvc3R5bGU+CjxnPgoJPHBhdGggY2xhc3M9InN0MCIgZD0iTTM4LjMsMEgxMS45QzUuNSwwLDAuMSw1LjMsMC4xLDExLjh2MjYuM0MwLjEsNDQuNiw1LjQsNTAsMTEuOSw1MGgyNi4zYzAuMSwwLDAuMywwLDAuNiwwCgkJYy0xLjUtMS41LTIuMi0zLjMtMi4yLTUuNWMwLTAuNiwwLTEuMiwwLjEtMS43SDEyLjFjLTIuNSwwLTQuNC0yLTQuNC00LjRWMTEuOGMwLTIuNSwyLTQuNCw0LjQtNC40aDI2LjNjMi41LDAsNC40LDIsNC40LDQuNHYyNC43CgkJYzAuNi0wLjEsMS4yLTAuMSwxLjctMC4xYzIuMiwwLDQuMSwwLjksNS41LDIuMmMwLTAuMSwwLTAuMywwLTAuNFYxMS44QzUwLDUuMyw0NC44LDAsMzguMywweiIvPgoJPHBhdGggY2xhc3M9InN0MCIgZD0iTTQ0LjUsMzguOWMtMy4xLDAtNS41LDIuNS01LjUsNS41czIuNSw1LjUsNS41LDUuNWMzLjEsMCw1LjUtMi41LDUuNS01LjVDNDkuOSw0MS4yLDQ3LjYsMzguOSw0NC41LDM4Ljl6Ii8+Cgk8cG9seWdvbiBjbGFzcz0ic3QwIiBwb2ludHM9IjM3LjgsMzcuNyAzNy44LDEyLjMgMzAuNSwxMi4zIDMwLjUsMjEuMyAxOS44LDIxLjMgMTkuOCwxMi4zIDEyLjMsMTIuMyAxMi4zLDM3LjcgMTkuOCwzNy43IAoJCTE5LjgsMjguNiAzMC41LDI4LjYgMzAuNSwzNy43IAkiLz4KPC9nPgo8L3N2Zz4K`;
148145
148715
  //#endregion
@@ -148196,16 +148766,21 @@ void main() {
148196
148766
  /**
148197
148767
  * May the footer's primary button submit?
148198
148768
  *
148199
- * The prototype's wizard card carries no per-card validate control, so this
148200
- * button is the step's *only* way to persist a typed path. Gating it on "both
148201
- * tools already configured" made a clean first launch a dead end: nothing could
148202
- * be configured because the button that configures was disabled. Readiness is
148203
- * therefore "there is something to save".
148769
+ * Two gates, both asked for after the first-run walk:
148770
+ * - **No run in flight.** While a toolchain is downloading or extracting, the
148771
+ * step must not hand itself back: the install owns the profile, and
148772
+ * "Get Started" would dismiss the modal out from under the bar it shows.
148773
+ * - **Something usable.** At least one tool is already configured, or the text
148774
+ * in an input has been verified against the Host (`checks`). A merely
148775
+ * non-empty input is not enough: the button used to be pressed with garbage
148776
+ * paths and then reported the Host's rejection, which is a worse first run
148777
+ * than a disabled button that lights up the moment a path checks out.
148204
148778
  */
148205
148779
  function saveReady(snapshot) {
148206
148780
  if (snapshot.saving !== void 0) return false;
148207
- if (TOOLCHAIN_IDS.some((id) => (snapshot.drafts[id] ?? "").trim() !== "")) return true;
148208
- return snapshot.status === void 0 ? false : TOOLCHAIN_IDS.some((id) => snapshot.status[id].state === "configured");
148781
+ if (TOOLCHAIN_IDS.some((id) => jobRunning(snapshot.jobs[id]))) return false;
148782
+ if (TOOLCHAIN_IDS.some((id) => snapshot.status?.[id].state === "configured")) return true;
148783
+ return TOOLCHAIN_IDS.some((id) => snapshot.checks[id]?.state === "valid");
148209
148784
  }
148210
148785
  /** Fields of the stored configuration this step reacts to. */ function sameConfig(left, right) {
148211
148786
  if (left === right) return true;
@@ -148315,6 +148890,8 @@ void main() {
148315
148890
  kicad: "",
148316
148891
  solidcraft: ""
148317
148892
  },
148893
+ checks: {},
148894
+ confirmed: {},
148318
148895
  toasts: []
148319
148896
  };
148320
148897
  const emptySnapshot = () => EMPTY$1;
@@ -148549,6 +149126,7 @@ void main() {
148549
149126
  applyNavigation(draft, params) {
148550
149127
  draft.activeDestination = params.destination;
148551
149128
  if (params.projectPath !== void 0) draft.projectPath = params.projectPath;
149129
+ if (params.schematicPath !== void 0) draft.schematicPath = params.schematicPath;
148552
149130
  if (params.path !== void 0) {
148553
149131
  if (params.destination === "schematic" || params.destination === "bom") {
148554
149132
  draft.schematicPath = params.path;
@@ -154673,6 +155251,9 @@ void main() {
154673
155251
  const HARDWARE_SETTINGS_ID = "hardware-engineering";
154674
155252
  const HARDWARE_TAB_ID = "@huaqiu/dsh-hardware-ui";
154675
155253
  const HARDWARE_TAB_KIND = "hardware-engineering";
155254
+ /** The project-selection view that fronts the order destination. */
155255
+ const PLACE_ORDER_TAB_ID = "@huaqiu/dsh-hardware-ui/place-order";
155256
+ const PLACE_ORDER_TAB_KIND = "hardware-place-order";
154676
155257
  /** Host plugin row id whose volatile config backs the product settings page. */
154677
155258
  const HARDWARE_CONFIG_ENTRY = "hardware-artifacts";
154678
155259
  /**
@@ -154755,6 +155336,33 @@ void main() {
154755
155336
  revealIfOpened: true
154756
155337
  });
154757
155338
  },
155339
+ placeOrder() {
155340
+ const tabs = ctx.sidebarRight;
155341
+ if (tabs === void 0) return false;
155342
+ tabs.openTab(PLACE_ORDER_TAB_KIND, { revealIfOpened: true });
155343
+ return true;
155344
+ },
155345
+ /**
155346
+ * Hand the chosen project to the existing order destination. The path and
155347
+ * the project travel in the navigation params, so the viewer discovers that
155348
+ * project and the order panel packages the board — no second packaging path.
155349
+ */
155350
+ orderProject(request) {
155351
+ navigation += 1;
155352
+ const params = {
155353
+ destination: "order",
155354
+ path: request.boardPath,
155355
+ kind: "pcb",
155356
+ projectPath: request.projectPath,
155357
+ ...request.schematicPath === void 0 ? {} : { schematicPath: request.schematicPath },
155358
+ orderKind: request.kind,
155359
+ navigationRevision: navigation
155360
+ };
155361
+ ctx.sidebarRight?.openTab(HARDWARE_TAB_KIND, {
155362
+ params,
155363
+ revealIfOpened: true
155364
+ });
155365
+ },
154758
155366
  async openNative(request) {
154759
155367
  await openArtifact({
154760
155368
  application: request.application,
@@ -154787,6 +155395,18 @@ void main() {
154787
155395
  default: true,
154788
155396
  title: () => COPY.product.name
154789
155397
  }) ?? (() => {}), "hardware-ui: right-panel tab type");
155398
+ effect(() => ctx.sidebarRightTabs?.register({
155399
+ id: "@huaqiu/dsh-hardware-ui/place-order",
155400
+ kind: "hardware-place-order",
155401
+ title: () => COPY.order.placeOrder.title
155402
+ }) ?? (() => {}), "hardware-ui: place order tab type");
155403
+ if (typeof window !== "undefined") effect(() => {
155404
+ const handle = { placeOrder: () => controller.placeOrder() };
155405
+ window.huaqiu = handle;
155406
+ return () => {
155407
+ if (window.huaqiu === handle) delete window.huaqiu;
155408
+ };
155409
+ }, "hardware-ui: place order handle");
154790
155410
  const slots = ctx.slots;
154791
155411
  if (slots === void 0) return;
154792
155412
  effect(() => slots.inject("sidebar.right.pane.tab", () => slots.register({
@@ -154797,6 +155417,16 @@ void main() {
154797
155417
  inject: () => face
154798
155418
  }, HardwareViewerBody)), "hardware-ui: viewer body");
154799
155419
  effect(() => slots.inject("sidebar.right.pane.tab", () => slots.register(orderTabRegistration(), OrderTabBody)), "hardware-ui: order page body");
155420
+ effect(() => slots.inject("sidebar.right.pane.tab", () => slots.register({
155421
+ name: "sidebar.right.pane.tab",
155422
+ key: PLACE_ORDER_TAB_ID,
155423
+ locale: HARDWARE_UI_NS,
155424
+ inject: () => ({
155425
+ discover: controller.discover,
155426
+ installations: controller.installations,
155427
+ orderProject: controller.orderProject
155428
+ })
155429
+ }, PlaceOrderBody)), "hardware-ui: place order body");
154800
155430
  effect(() => slots.inject("settings.section", () => slots.register({
154801
155431
  name: "settings.section",
154802
155432
  id: HARDWARE_SETTINGS_ID,
@@ -154861,6 +155491,8 @@ void main() {
154861
155491
  exports.HARDWARE_SETTINGS_ID = HARDWARE_SETTINGS_ID;
154862
155492
  exports.HARDWARE_TAB_ID = HARDWARE_TAB_ID;
154863
155493
  exports.HARDWARE_TAB_KIND = HARDWARE_TAB_KIND;
155494
+ exports.PLACE_ORDER_TAB_ID = PLACE_ORDER_TAB_ID;
155495
+ exports.PLACE_ORDER_TAB_KIND = PLACE_ORDER_TAB_KIND;
154864
155496
  exports.apply = apply;
154865
155497
  exports.inject = inject;
154866
155498
  exports.kindForPath = kindForPath;