@jnrs/lingshu-smart 3.1.11 → 3.1.12

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.
@@ -1,7 +1,7 @@
1
1
  import { defineStore as qe } from "pinia";
2
2
  import { ref as de, computed as N, watch as le } from "vue";
3
- import { v as Wi, w as Ki, x as At, y as Yi, e as R, a as H, b as L, M as ue, g as _, z as ne, o as Y, j as Ai, i as zi, u as ji, k as Xi, q as Ji, m as z, B as qi, A as $, C as se, F as Ve, G as Se, S as Zi, H as di, I as _i, J as $i, s as Dt, t as X, D as Ie } from "./index-CQO74KdA.js";
4
- import { Box as M, Star as es, Text as ts, PointerEvent as We, DragEvent as Mt, Rect as is, Ellipse as Re, Flow as Be, Path as Ce, Group as ui, App as ss, LeaferEvent as os, EditorEvent as Tt, EditorMoveEvent as Gt, EditorRotateEvent as Lt, EditorScaleEvent as Ft } from "leafer";
3
+ import { v as Wi, w as Ki, x as At, y as Yi, e as R, a as H, b as L, M as ue, g as _, z as ne, o as Y, j as Ai, i as zi, u as ji, k as Xi, q as Ji, m as z, B as qi, A as $, C as se, F as Pe, G as Se, S as Zi, H as di, I as _i, J as $i, s as Dt, t as X, D as Ie } from "./index-CQbsL_m9.js";
4
+ import { Box as M, Star as es, Text as ts, PointerEvent as Be, DragEvent as Mt, Rect as is, Ellipse as De, Flow as xe, Path as Ce, Group as ui, App as ss, LeaferEvent as os, EditorEvent as Tt, EditorMoveEvent as Gt, EditorRotateEvent as Lt, EditorScaleEvent as Ft } from "leafer";
5
5
  import { Ruler as rs } from "leafer-x-ruler";
6
6
  import { DotMatrix as ns } from "leafer-x-dot-matrix";
7
7
  import { ElMessage as st } from "element-plus";
@@ -40,11 +40,11 @@ function Ut(r) {
40
40
  var ot = function() {
41
41
  return Yi.Date.now();
42
42
  }, Es = "Expected a function", Ss = Math.max, Cs = Math.min;
43
- function ke(r, e, t) {
44
- var i, s, o, n, a, l, c = 0, h = !1, A = !1, d = !0;
43
+ function Ue(r, e, t) {
44
+ var i, s, o, n, a, l, c = 0, h = !1, d = !1, A = !0;
45
45
  if (typeof r != "function")
46
46
  throw new TypeError(Es);
47
- e = Ut(e) || 0, At(t) && (h = !!t.leading, A = "maxWait" in t, o = A ? Ss(Ut(t.maxWait) || 0, e) : o, d = "trailing" in t ? !!t.trailing : d);
47
+ e = Ut(e) || 0, At(t) && (h = !!t.leading, d = "maxWait" in t, o = d ? Ss(Ut(t.maxWait) || 0, e) : o, A = "trailing" in t ? !!t.trailing : A);
48
48
  function u(S) {
49
49
  var G = i, T = s;
50
50
  return i = s = void 0, c = S, n = r.apply(T, G), n;
@@ -54,11 +54,11 @@ function ke(r, e, t) {
54
54
  }
55
55
  function p(S) {
56
56
  var G = S - l, T = S - c, B = e - G;
57
- return A ? Cs(B, o - T) : B;
57
+ return d ? Cs(B, o - T) : B;
58
58
  }
59
59
  function C(S) {
60
60
  var G = S - l, T = S - c;
61
- return l === void 0 || G >= e || G < 0 || A && T >= o;
61
+ return l === void 0 || G >= e || G < 0 || d && T >= o;
62
62
  }
63
63
  function D() {
64
64
  var S = ot();
@@ -67,7 +67,7 @@ function ke(r, e, t) {
67
67
  a = setTimeout(D, p(S));
68
68
  }
69
69
  function g(S) {
70
- return a = void 0, d && i ? u(S) : (i = s = void 0, n);
70
+ return a = void 0, A && i ? u(S) : (i = s = void 0, n);
71
71
  }
72
72
  function m() {
73
73
  a !== void 0 && clearTimeout(a), c = 0, i = l = s = a = void 0;
@@ -80,7 +80,7 @@ function ke(r, e, t) {
80
80
  if (i = arguments, s = this, l = S, G) {
81
81
  if (a === void 0)
82
82
  return f(l);
83
- if (A)
83
+ if (d)
84
84
  return clearTimeout(a), a = setTimeout(D, e), u(l);
85
85
  }
86
86
  return a === void 0 && (a = setTimeout(D, e)), n;
@@ -109,20 +109,20 @@ function Is(r) {
109
109
  return Array.isArray(r) ? r.every((e) => fi(e)) : (console.error("isICaseArray: data must be an array"), !1);
110
110
  }
111
111
  const bs = 1704038400000n, gt = 5n, Bs = 5n, Ze = 12n, xs = (1n << gt) - 1n, Rs = (1n << Ze) - 1n, Ds = Ze, Ms = Ze + gt, Ts = Ze + gt + Bs, Gs = BigInt(Math.floor(Math.random() * (Number(xs) + 1))), Ls = 0n;
112
- let Te = -1n, Ge = 0n;
112
+ let Ge = -1n, Le = 0n;
113
113
  function Fs() {
114
114
  let r = BigInt(Date.now());
115
- if (r < Te && (r = Te), r === Te) {
116
- if (Ge = Ge + 1n & Rs, Ge === 0n) {
117
- for (; BigInt(Date.now()) <= Te; )
115
+ if (r < Ge && (r = Ge), r === Ge) {
116
+ if (Le = Le + 1n & Rs, Le === 0n) {
117
+ for (; BigInt(Date.now()) <= Ge; )
118
118
  ;
119
119
  r = BigInt(Date.now());
120
120
  }
121
121
  } else
122
- Ge = 0n;
123
- return Te = r, r - bs << Ts | Ls << Ms | Gs << Ds | Ge;
122
+ Le = 0n;
123
+ return Ge = r, r - bs << Ts | Ls << Ms | Gs << Ds | Le;
124
124
  }
125
- function He() {
125
+ function Oe() {
126
126
  return Fs().toString();
127
127
  }
128
128
  const ks = {
@@ -739,16 +739,16 @@ function yi(r, e, t, i, s) {
739
739
  if (o && typeof o == "object" && !Array.isArray(o)) {
740
740
  const a = o, l = {};
741
741
  for (const c of Object.keys(a)) {
742
- const h = a[c], A = typeof h == "string" || typeof h == "number" ? h : void 0;
742
+ const h = a[c], d = typeof h == "string" || typeof h == "number" ? h : void 0;
743
743
  if (i)
744
744
  try {
745
- l[c] = i(n, A, "color");
746
- } catch (d) {
745
+ l[c] = i(n, d, "color");
746
+ } catch (A) {
747
747
  Y.error(
748
748
  "WsProxy: 字典批量转换「%s」键 %s 调用 dictFn 异常, 保留源值: %s",
749
749
  n,
750
750
  c,
751
- d instanceof Error ? d.message : String(d)
751
+ A instanceof Error ? A.message : String(A)
752
752
  ), l[c] = String(h);
753
753
  }
754
754
  else
@@ -762,13 +762,13 @@ function yi(r, e, t, i, s) {
762
762
  for (const l of Object.keys(n)) {
763
763
  const c = n[l];
764
764
  let h = c;
765
- const A = String(c);
766
- if (e.valueMap && A in e.valueMap)
767
- h = e.valueMap[A];
765
+ const d = String(c);
766
+ if (e.valueMap && d in e.valueMap)
767
+ h = e.valueMap[d];
768
768
  else if (i && e.dictName) {
769
- const d = typeof c == "string" || typeof c == "number" ? c : void 0;
769
+ const A = typeof c == "string" || typeof c == "number" ? c : void 0;
770
770
  try {
771
- h = i(e.dictName, d, "color");
771
+ h = i(e.dictName, A, "color");
772
772
  } catch (u) {
773
773
  Y.error(
774
774
  "WsProxy: 对象映射「%s」键 %s 调用 dictFn 异常, 保留源值: %s",
@@ -862,9 +862,9 @@ function Ps(r, e) {
862
862
  return !1;
863
863
  }
864
864
  }
865
- function De(r, e) {
865
+ function Me(r, e) {
866
866
  return {
867
- id: He(),
867
+ id: Oe(),
868
868
  type: r,
869
869
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
870
870
  ...e?.caseId ? { case_id: e.caseId } : {}
@@ -892,7 +892,7 @@ function Ws(r, e, t, i, s, o) {
892
892
  device_type: e.deviceType?.trim() || ue[e.className] || e.className
893
893
  };
894
894
  return ce(a, r, e.mappings, i, s, o), a.device_id === void 0 || a.device_id === null || a.device_id === "" ? null : {
895
- envelope: De(_.DeviceCommand, t),
895
+ envelope: Me(_.DeviceCommand, t),
896
896
  payload: a
897
897
  };
898
898
  }
@@ -902,7 +902,7 @@ function mi(r, e, t, i, s, o, n, a, l) {
902
902
  if (f?.length) return f;
903
903
  switch (u) {
904
904
  case "add":
905
- return Pe;
905
+ return We;
906
906
  case "batch_add":
907
907
  return yt;
908
908
  case "transfer":
@@ -912,8 +912,8 @@ function mi(r, e, t, i, s, o, n, a, l) {
912
912
  case "batch_remove":
913
913
  return mt;
914
914
  }
915
- }, A = [], d = (u) => {
916
- A.push({ envelope: De(_.ResourceCommand, o), payload: u });
915
+ }, d = [], A = (u) => {
916
+ d.push({ envelope: Me(_.ResourceCommand, o), payload: u });
917
917
  };
918
918
  switch (r) {
919
919
  case "add": {
@@ -922,7 +922,7 @@ function mi(r, e, t, i, s, o, n, a, l) {
922
922
  const u = { operation: "add" };
923
923
  ce(u, t, h("add"), n, a, l);
924
924
  const f = u.to || {};
925
- return u.resource_id && f.device_id ? d(u) : U("资源 add 消息缺少 resource_id / to.device_id,跳过", { payload: t }), A;
925
+ return u.resource_id && f.device_id ? A(u) : U("资源 add 消息缺少 resource_id / to.device_id,跳过", { payload: t }), d;
926
926
  }
927
927
  case "batch_add": {
928
928
  const u = c?.batchAddItems || s, f = we(e, u);
@@ -936,7 +936,7 @@ function mi(r, e, t, i, s, o, n, a, l) {
936
936
  const g = D.to || {};
937
937
  D.resource_id && g.device_id ? p.push(D) : Y.warn("WsProxy: batch_add 项缺少 resource_id / to.device_id,已跳过: %o", C);
938
938
  }
939
- return p.length === 0 ? (U("batch_add 无有效资源项,跳过", { itemsPath: u, total: f.length }), []) : (d({ operation: "batch_add", resources: p }), A);
939
+ return p.length === 0 ? (U("batch_add 无有效资源项,跳过", { itemsPath: u, total: f.length }), []) : (A({ operation: "batch_add", resources: p }), d);
940
940
  }
941
941
  case "transfer": {
942
942
  if (Array.isArray(t))
@@ -944,19 +944,19 @@ function mi(r, e, t, i, s, o, n, a, l) {
944
944
  const u = { operation: "transfer" };
945
945
  ce(u, t, h("transfer"), n, a, l);
946
946
  const f = u.to || {};
947
- return u.resource_id && f.device_id ? d(u) : U("资源 transfer 消息缺少 resource_id / to.device_id,跳过", { payload: t }), A;
947
+ return u.resource_id && f.device_id ? A(u) : U("资源 transfer 消息缺少 resource_id / to.device_id,跳过", { payload: t }), d;
948
948
  }
949
949
  case "remove": {
950
950
  if (Array.isArray(t))
951
951
  return U("资源 remove 源 payload 为数组,无法按对象映射,跳过"), [];
952
952
  const u = { operation: "remove" };
953
- return ce(u, t, h("remove"), n, a, l), u.resource_id && d(u), A;
953
+ return ce(u, t, h("remove"), n, a, l), u.resource_id && A(u), d;
954
954
  }
955
955
  case "batch_remove": {
956
956
  if (Array.isArray(t))
957
- return t.length === 0 ? (U("batch_remove 源 payload 数组为空,跳过"), []) : (d({ operation: "batch_remove", resource_ids: t.map((f) => String(f)) }), A);
957
+ return t.length === 0 ? (U("batch_remove 源 payload 数组为空,跳过"), []) : (A({ operation: "batch_remove", resource_ids: t.map((f) => String(f)) }), d);
958
958
  const u = { operation: "batch_remove" };
959
- return ce(u, t, h("batch_remove"), n, a, l), Array.isArray(u.resource_ids) && u.resource_ids.length > 0 ? d(u) : U("batch_remove 消息缺少 resource_ids 数组,跳过", { payload: t }), A;
959
+ return ce(u, t, h("batch_remove"), n, a, l), Array.isArray(u.resource_ids) && u.resource_ids.length > 0 ? A(u) : U("batch_remove 消息缺少 resource_ids 数组,跳过", { payload: t }), d;
960
960
  }
961
961
  }
962
962
  }
@@ -969,13 +969,13 @@ function Ks(r, e, t, i) {
969
969
  (u) => String(u.enumValue) === l.deviceType && String(u.number) === l.number
970
970
  ), h = c ? i.find((u) => u.layerId === c.layerId) : void 0;
971
971
  if (!h) return;
972
- const A = c?.enumValue && c?.number ? `${c.enumValue}_${c.number}` : "", d = (A && A === h.bizId ? A : "") || h.bizId || h.layerId;
973
- if (!d) {
972
+ const d = c?.enumValue && c?.number ? `${c.enumValue}_${c.number}` : "", A = (d && d === h.bizId ? d : "") || h.bizId || h.layerId;
973
+ if (!A) {
974
974
  U(`画布设备(${h.name})缺少可用于定位的标识,资源消息无法定位目标设备`);
975
975
  return;
976
976
  }
977
977
  return {
978
- deviceId: d,
978
+ deviceId: A,
979
979
  deviceType: ue[h.className] || h.className
980
980
  };
981
981
  }, o = (a, l) => {
@@ -1018,8 +1018,8 @@ function Ks(r, e, t, i) {
1018
1018
  return n;
1019
1019
  }
1020
1020
  function Ys(r, e, t, i, s, o, n, a) {
1021
- const l = t.resourceFields, c = t.resourceMappings?.add?.length ? t.resourceMappings.add : Pe, h = t.resourceMappings?.remove?.length ? t.resourceMappings.remove : _e, A = [], d = (u) => {
1022
- A.push({ envelope: De(_.ResourceCommand, s), payload: u });
1021
+ const l = t.resourceFields, c = t.resourceMappings?.add?.length ? t.resourceMappings.add : We, h = t.resourceMappings?.remove?.length ? t.resourceMappings.remove : _e, d = [], A = (u) => {
1022
+ d.push({ envelope: Me(_.ResourceCommand, s), payload: u });
1023
1023
  };
1024
1024
  if (l?.operationField) {
1025
1025
  const u = String(we(r, l.operationField) ?? "").trim().toLowerCase(), f = pi.includes(u) ? u : void 0;
@@ -1043,28 +1043,28 @@ function Ys(r, e, t, i, s, o, n, a) {
1043
1043
  const u = { operation: "add" };
1044
1044
  ce(u, e, c, o, n, a);
1045
1045
  const f = u.to || {};
1046
- u.resource_id && f.device_id ? d(u) : U("资源 add 消息缺少 resource_id / to.device_id,跳过", { payload: e });
1046
+ u.resource_id && f.device_id ? A(u) : U("资源 add 消息缺少 resource_id / to.device_id,跳过", { payload: e });
1047
1047
  }
1048
1048
  if (!Array.isArray(e)) {
1049
1049
  const u = { operation: "remove" };
1050
- ce(u, e, h, o, n, a), u.resource_id && d(u);
1050
+ ce(u, e, h, o, n, a), u.resource_id && A(u);
1051
1051
  }
1052
- return A;
1052
+ return d;
1053
1053
  }
1054
1054
  function zs(r, e, t, i, s) {
1055
1055
  const o = String(r.envelope?.type ?? "");
1056
1056
  if (o !== _.ResourceCommand) return;
1057
1057
  const n = e.find(
1058
- (d) => d.enabled && d.operate === "resource" && String(d.sourceType ?? _.ResourceCommand) === o
1058
+ (A) => A.enabled && A.operate === "resource" && String(A.sourceType ?? _.ResourceCommand) === o
1059
1059
  );
1060
1060
  if (!n) return;
1061
1061
  const a = r.payload;
1062
1062
  if (!a || typeof a != "object") return;
1063
- const l = (d) => {
1063
+ const l = (A) => {
1064
1064
  const u = n.resourceMappings;
1065
- switch (d) {
1065
+ switch (A) {
1066
1066
  case "add":
1067
- return u?.add?.length ? u.add : Pe;
1067
+ return u?.add?.length ? u.add : We;
1068
1068
  case "batch_add":
1069
1069
  return u?.batch_add?.length ? u.batch_add : yt;
1070
1070
  case "transfer":
@@ -1076,12 +1076,12 @@ function zs(r, e, t, i, s) {
1076
1076
  default:
1077
1077
  return [];
1078
1078
  }
1079
- }, c = (d, u) => {
1079
+ }, c = (A, u) => {
1080
1080
  const f = [];
1081
1081
  for (const p of u)
1082
1082
  if (p.enabled !== !1)
1083
1083
  try {
1084
- const C = yi(d, p, t, i, s);
1084
+ const C = yi(A, p, t, i, s);
1085
1085
  C !== void 0 && f.push([p.target, C]);
1086
1086
  } catch (C) {
1087
1087
  Y.error(
@@ -1090,16 +1090,16 @@ function zs(r, e, t, i, s) {
1090
1090
  C instanceof Error ? C.message : String(C)
1091
1091
  );
1092
1092
  }
1093
- for (const [p, C] of f) wi(d, p, C);
1093
+ for (const [p, C] of f) wi(A, p, C);
1094
1094
  }, h = String(a.operation ?? "");
1095
1095
  if (h === "batch_add") {
1096
1096
  if (!Array.isArray(a.resources)) return;
1097
- for (const d of a.resources)
1098
- d && typeof d == "object" && !Array.isArray(d) && c(d, l("batch_add"));
1097
+ for (const A of a.resources)
1098
+ A && typeof A == "object" && !Array.isArray(A) && c(A, l("batch_add"));
1099
1099
  return;
1100
1100
  }
1101
- const A = l(h);
1102
- A.length > 0 && c(a, A);
1101
+ const d = l(h);
1102
+ d.length > 0 && c(a, d);
1103
1103
  }
1104
1104
  function js(r, e, t, i, s) {
1105
1105
  const o = String(r.envelope?.type ?? "");
@@ -1129,12 +1129,12 @@ function Xs(r, e, t, i, s = "data", o = "type", n, a) {
1129
1129
  const f = e.filter((p) => p.enabled && p.sourceType != null).map((p) => p.sourceType);
1130
1130
  return U(`sourceType=${String(c)} 在 rules 中无对应规则`, { availableSourceTypes: f }, "info"), { messages: [] };
1131
1131
  }
1132
- const A = l[s] ?? l.payload ?? {};
1132
+ const d = l[s] ?? l.payload ?? {};
1133
1133
  if (h.operate === "resetAll")
1134
1134
  return {
1135
1135
  messages: [
1136
1136
  {
1137
- envelope: De(_.SceneReset, t),
1137
+ envelope: Me(_.SceneReset, t),
1138
1138
  payload: {}
1139
1139
  }
1140
1140
  ]
@@ -1143,7 +1143,7 @@ function Xs(r, e, t, i, s = "data", o = "type", n, a) {
1143
1143
  return {
1144
1144
  messages: Ys(
1145
1145
  l,
1146
- A,
1146
+ d,
1147
1147
  h,
1148
1148
  s,
1149
1149
  t,
@@ -1152,12 +1152,12 @@ function Xs(r, e, t, i, s = "data", o = "type", n, a) {
1152
1152
  a
1153
1153
  )
1154
1154
  };
1155
- if (Array.isArray(A))
1155
+ if (Array.isArray(d))
1156
1156
  return U(`payload(${s}) 为数组(非标准数据),已通过 @raw 事件透出由父组件处理`, void 0, "info"), { messages: [] };
1157
- const d = A, u = Ws(d, h, t, i, n, a);
1157
+ const A = d, u = Ws(A, h, t, i, n, a);
1158
1158
  return u ? { messages: [u] } : (U("buildSocketMessage 返回 null(payload 缺少 device_id 字段)", {
1159
1159
  sourceType: String(c),
1160
- payload: d
1160
+ payload: A
1161
1161
  }), { messages: [] });
1162
1162
  }
1163
1163
  function rr(r) {
@@ -1171,7 +1171,7 @@ function rr(r) {
1171
1171
  }
1172
1172
  function nr(r, e) {
1173
1173
  const t = (to(e)?.mappings || []).filter((i) => i.target !== "device_type" && i.target !== "device_id").map((i) => ({ ...i }));
1174
- return { uid: He(), layerId: r, className: e, enumValue: "", number: "", mappings: t };
1174
+ return { uid: Oe(), layerId: r, className: e, enumValue: "", number: "", mappings: t };
1175
1175
  }
1176
1176
  function Js(r) {
1177
1177
  if (Array.isArray(r)) return r;
@@ -1218,19 +1218,19 @@ function lr(r) {
1218
1218
  }
1219
1219
  return e;
1220
1220
  }
1221
- function cr(r, e, t, i, s, o, n, a, l = "data", c = "type", h = [], A = []) {
1222
- const d = r;
1223
- if (!d || typeof d != "object" || Array.isArray(d))
1221
+ function cr(r, e, t, i, s, o, n, a, l = "data", c = "type", h = [], d = []) {
1222
+ const A = r;
1223
+ if (!A || typeof A != "object" || Array.isArray(A))
1224
1224
  return U("注册表模式源消息非对象,跳过", void 0, "info"), { messages: [] };
1225
- if (d.envelope && typeof d.envelope == "object" && "payload" in d)
1225
+ if (A.envelope && typeof A.envelope == "object" && "payload" in A)
1226
1226
  return Xs(r, e, s, o, l, c, n, a);
1227
- const u = d[l], f = u && typeof u == "object" && !Array.isArray(u) ? u : d, p = we(d, c);
1227
+ const u = A[l], f = u && typeof u == "object" && !Array.isArray(u) ? u : A, p = we(A, c);
1228
1228
  if (p != null && p !== "") {
1229
1229
  if (e.find(
1230
1230
  (O) => O.enabled && O.operate === "resetAll" && O.sourceType != null && String(O.sourceType) === String(p)
1231
1231
  ))
1232
1232
  return {
1233
- messages: [{ envelope: De(_.SceneReset, s), payload: {} }]
1233
+ messages: [{ envelope: Me(_.SceneReset, s), payload: {} }]
1234
1234
  };
1235
1235
  const Q = e.find((O) => O.enabled && O.operate === "resource"), W = Q ? pi.find((O) => {
1236
1236
  const me = Q.resourceFields?.typeValues?.[O];
@@ -1241,7 +1241,7 @@ function cr(r, e, t, i, s, o, n, a, l = "data", c = "type", h = [], A = []) {
1241
1241
  messages: Ks(
1242
1242
  mi(
1243
1243
  W,
1244
- d,
1244
+ A,
1245
1245
  f,
1246
1246
  Q,
1247
1247
  l,
@@ -1252,7 +1252,7 @@ function cr(r, e, t, i, s, o, n, a, l = "data", c = "type", h = [], A = []) {
1252
1252
  ),
1253
1253
  t,
1254
1254
  h,
1255
- A
1255
+ d
1256
1256
  )
1257
1257
  };
1258
1258
  }
@@ -1262,11 +1262,11 @@ function cr(r, e, t, i, s, o, n, a, l = "data", c = "type", h = [], A = []) {
1262
1262
  if (!C.length)
1263
1263
  return U(
1264
1264
  p == null || p === "" ? `注册表模式源消息未提取到消息类型值(消息类型字段:${c}),跳过` : `注册表模式源消息的消息类型值 ${p} 未匹配到任何设备(须在「设备状态配置」中为设备配置消息类型值),跳过`,
1265
- { payload: d },
1265
+ { payload: A },
1266
1266
  "info"
1267
1267
  ), { messages: [] };
1268
1268
  const D = (x) => {
1269
- const Q = x.idField?.trim() || i.trim() || "deviceId", W = we(f, Q) ?? we(d, Q), O = W != null && W !== "" ? t.get(String(W)) : void 0;
1269
+ const Q = x.idField?.trim() || i.trim() || "deviceId", W = we(f, Q) ?? we(A, Q), O = W != null && W !== "" ? t.get(String(W)) : void 0;
1270
1270
  return { idField: Q, device: O };
1271
1271
  }, g = C.length === 1 ? C[0] : C.find((x) => {
1272
1272
  if (!x.enumValue || !x.number) return !1;
@@ -1276,29 +1276,29 @@ function cr(r, e, t, i, s, o, n, a, l = "data", c = "type", h = [], A = []) {
1276
1276
  if (!g)
1277
1277
  return U(
1278
1278
  `消息类型值 ${p} 对应 ${C.length} 台设备,且均未配置「设备类型标识」或与注册表 deviceType / number 不匹配,无法区分具体设备,丢弃`,
1279
- { payload: d }
1279
+ { payload: A }
1280
1280
  ), { messages: [] };
1281
1281
  const { idField: m, device: E } = D(g);
1282
1282
  if (!E)
1283
1283
  return U(
1284
1284
  `消息类型值 ${p} 命中设备绑定,但按「设备主键字段名」(${m})未在注册表中匹配到设备,丢弃`,
1285
- { payload: d }
1285
+ { payload: A }
1286
1286
  ), { messages: [] };
1287
- const y = A.find((x) => x.layerId === g.layerId);
1287
+ const y = d.find((x) => x.layerId === g.layerId);
1288
1288
  if (!y)
1289
1289
  return U(`消息类型值 ${p} 命中的设备绑定对应画布设备已不在当前方案中,跳过`, void 0, "info"), { messages: [] };
1290
1290
  const S = g, G = S.enumValue && S.number ? `${S.enumValue}_${S.number}` : "", T = (G && G === y.bizId ? G : "") || y.bizId || y.layerId;
1291
1291
  if (!T)
1292
- return U(`画布设备(${y.name})缺少可用于定位的标识,跳过`, { payload: d }), { messages: [] };
1292
+ return U(`画布设备(${y.name})缺少可用于定位的标识,跳过`, { payload: A }), { messages: [] };
1293
1293
  const B = {
1294
1294
  device_type: ue[y.className] || y.className,
1295
1295
  device_id: T
1296
1296
  };
1297
1297
  return ce(B, f, S.mappings, o, n, a), {
1298
- messages: [{ envelope: De(_.DeviceCommand, s), payload: B }]
1298
+ messages: [{ envelope: Me(_.DeviceCommand, s), payload: B }]
1299
1299
  };
1300
1300
  }
1301
- const Pe = [
1301
+ const We = [
1302
1302
  { target: "resource_id", source: "resource_id" },
1303
1303
  { target: "resource_type", source: "resource_type" },
1304
1304
  { target: "resource_name", source: "resource_name" },
@@ -1325,7 +1325,7 @@ const Pe = [
1325
1325
  { target: "to.device_id", source: "to.device_id" },
1326
1326
  { target: "to.device_layer", source: "to.device_layer" },
1327
1327
  { target: "to.device_station", source: "to.device_station" }
1328
- ], yt = Pe.map((r) => ({ ...r })), mt = [
1328
+ ], yt = We.map((r) => ({ ...r })), mt = [
1329
1329
  { target: "resource_ids", source: "resource_ids" },
1330
1330
  { target: "resource_type", source: "resource_type" }
1331
1331
  ];
@@ -1351,7 +1351,7 @@ const Et = Zs(), he = [
1351
1351
  { target: "passage.out", source: "passage.out", defaultValue: !1, transformTargetType: "boolean" }
1352
1352
  ], Ot = [
1353
1353
  { target: "is_working", source: "is_working", defaultValue: !1, transformTargetType: "boolean" }
1354
- ], _s = [{ target: "station_rotation", source: "station_rotation" }], te = [{ target: "device_state", source: "device_state" }], Le = { target: "position.x", source: "position.x" }, nt = { target: "position.y", source: "position.y" };
1354
+ ], _s = [{ target: "station_rotation", source: "station_rotation" }], te = [{ target: "device_state", source: "device_state" }], Fe = { target: "position.x", source: "position.x" }, nt = { target: "position.y", source: "position.y" };
1355
1355
  function Ei(r, e) {
1356
1356
  return {
1357
1357
  // 信封类型 = device_command(标准信封源 envelope.type);设备类型 = socket 协议 device_type(snake_case),与规则 className(内部模型)解耦
@@ -1386,7 +1386,7 @@ const Si = {
1386
1386
  // 单关节机器人:light / position / current_fixture / device_state
1387
1387
  SingleJointRobot: [
1388
1388
  ...he,
1389
- Le,
1389
+ Fe,
1390
1390
  nt,
1391
1391
  { target: "position.j1", source: "position.j1" },
1392
1392
  { target: "current_fixture", source: "current_fixture" },
@@ -1395,7 +1395,7 @@ const Si = {
1395
1395
  // 双关节机器人:light / position / current_fixture / device_state
1396
1396
  DoubleJointRobot: [
1397
1397
  ...he,
1398
- Le,
1398
+ Fe,
1399
1399
  nt,
1400
1400
  { target: "position.j1", source: "position.j1" },
1401
1401
  { target: "position.j2", source: "position.j2" },
@@ -1403,9 +1403,9 @@ const Si = {
1403
1403
  ...te
1404
1404
  ],
1405
1405
  // 资源库:light / position(工位槽资源操作走 Resource 规则)/ device_state
1406
- ResourceStore: [...he, Le, ...te],
1406
+ ResourceStore: [...he, Fe, ...te],
1407
1407
  // 托盘:light / position(工位槽资源操作走 Resource 规则)/ device_state
1408
- Pallet: [...he, Le, nt, ...te],
1408
+ Pallet: [...he, Fe, nt, ...te],
1409
1409
  // 料道:light / layer_visible / device_state
1410
1410
  MaterialTrack: [
1411
1411
  ...rt,
@@ -1433,7 +1433,7 @@ const Si = {
1433
1433
  // RGV:light / position(含 x / j1 / fork_xy / fork_z)/ device_state
1434
1434
  Rgv: [
1435
1435
  ...he,
1436
- Le,
1436
+ Fe,
1437
1437
  { target: "position.j1", source: "position.j1" },
1438
1438
  { target: "position.fork_xy", source: "position.fork_xy" },
1439
1439
  { target: "position.fork_z", source: "position.fork_z" },
@@ -1455,7 +1455,7 @@ function $s() {
1455
1455
  sourceType: _.ResourceCommand,
1456
1456
  // 资源操作字段映射:target 为协议 payload 路径,源字段名取自业务 Resource 消息的标准 payload 字段
1457
1457
  resourceMappings: {
1458
- add: Pe.map((r) => ({ ...r })),
1458
+ add: We.map((r) => ({ ...r })),
1459
1459
  batch_add: yt.map((r) => ({ ...r })),
1460
1460
  transfer: wt.map((r) => ({ ...r })),
1461
1461
  remove: _e.map((r) => ({ ...r })),
@@ -1715,7 +1715,7 @@ const ze = (r) => {
1715
1715
  a(g).looping = m;
1716
1716
  }, h = (g) => {
1717
1717
  o.value = ne(g);
1718
- }, A = de(ne(at)), d = (g) => {
1718
+ }, d = de(ne(at)), A = (g) => {
1719
1719
  if (!g) {
1720
1720
  e.value = [];
1721
1721
  return;
@@ -1737,13 +1737,13 @@ const ze = (r) => {
1737
1737
  equipmentsMenu: r,
1738
1738
  cases: e,
1739
1739
  wsProxyConfig: i,
1740
- globalSetting: A,
1740
+ globalSetting: d,
1741
1741
  scriptsConfig: o,
1742
1742
  // actions
1743
- updateCases: d,
1743
+ updateCases: A,
1744
1744
  selectCase: u,
1745
1745
  addCase: (g) => {
1746
- const m = He();
1746
+ const m = Oe();
1747
1747
  let E;
1748
1748
  if (g)
1749
1749
  if (fi(g))
@@ -1764,7 +1764,7 @@ const ze = (r) => {
1764
1764
  e.value = [];
1765
1765
  },
1766
1766
  resetAll: () => {
1767
- e.value = [], i.value = [], A.value = ne(at), o.value = [];
1767
+ e.value = [], i.value = [], d.value = ne(at), o.value = [];
1768
1768
  },
1769
1769
  setWsProxyConfig: s,
1770
1770
  getScriptCase: n,
@@ -2081,7 +2081,7 @@ class ee extends qi {
2081
2081
  return !(!this.config.hitSelf && i || i && !t);
2082
2082
  }
2083
2083
  // 点击事件回调
2084
- tapCallback = ke((e) => {
2084
+ tapCallback = Ue((e) => {
2085
2085
  this.shouldHandleInteraction(e, this.config.clickable) && this.emitTap(e.target.data);
2086
2086
  }, Yt);
2087
2087
  /**
@@ -2092,7 +2092,7 @@ class ee extends qi {
2092
2092
  this.eventHandler?.onTap?.(this.config, e);
2093
2093
  }
2094
2094
  // 右键点击事件回调
2095
- menuTapCallback = ke((e) => {
2095
+ menuTapCallback = Ue((e) => {
2096
2096
  this.shouldHandleInteraction(e, this.config.menuClickable) && this.eventHandler?.onMenuTap?.(this.config, e.target.data);
2097
2097
  }, Yt);
2098
2098
  // 拖拽事件回调
@@ -2101,7 +2101,7 @@ class ee extends qi {
2101
2101
  };
2102
2102
  // 注册事件(事件委托模式)
2103
2103
  setEventHandler(e) {
2104
- this.interactionHittable && (this.eventHandler = e, Object.hasOwn(e, "onTap") && this.ui.on(We.TAP, this.tapCallback), Object.hasOwn(e, "onMenuTap") && this.ui.on(We.MENU_TAP, this.menuTapCallback), Object.hasOwn(e, "onDragEnd") && this.ui.on(Mt.END, this.dragCallback));
2104
+ this.interactionHittable && (this.eventHandler = e, Object.hasOwn(e, "onTap") && this.ui.on(Be.TAP, this.tapCallback), Object.hasOwn(e, "onMenuTap") && this.ui.on(Be.MENU_TAP, this.menuTapCallback), Object.hasOwn(e, "onDragEnd") && this.ui.on(Mt.END, this.dragCallback));
2105
2105
  }
2106
2106
  /**
2107
2107
  * 判断模型是否包含指定工位号
@@ -2162,7 +2162,7 @@ class ee extends qi {
2162
2162
  }
2163
2163
  // 销毁 UI 和事件绑定
2164
2164
  destroyUI() {
2165
- this.initialized && (this.ui.off(We.TAP, this.tapCallback), this.ui.off(We.MENU_TAP, this.menuTapCallback), this.ui.off(Mt.END, this.dragCallback), super.destroyUI());
2165
+ this.initialized && (this.ui.off(Be.TAP, this.tapCallback), this.ui.off(Be.MENU_TAP, this.menuTapCallback), this.ui.off(Mt.END, this.dragCallback), super.destroyUI());
2166
2166
  }
2167
2167
  /**
2168
2168
  * 复位:销毁当前 UI 并按初始配置重建(编辑器设置值优先,未设置的字段取模型类默认值)
@@ -2242,8 +2242,8 @@ class bt extends ee {
2242
2242
  offsetY: l,
2243
2243
  zIndex: c,
2244
2244
  rotation: h,
2245
- scale: A,
2246
- visible: d,
2245
+ scale: d,
2246
+ visible: A,
2247
2247
  editable: u,
2248
2248
  draggable: f
2249
2249
  } = this.config, p = new M({
@@ -2258,8 +2258,8 @@ class bt extends ee {
2258
2258
  height: s,
2259
2259
  zIndex: c,
2260
2260
  rotation: h,
2261
- scale: A,
2262
- visible: d,
2261
+ scale: d,
2262
+ visible: A,
2263
2263
  editable: u,
2264
2264
  draggable: f,
2265
2265
  around: "center",
@@ -2344,7 +2344,7 @@ class bt extends ee {
2344
2344
  }
2345
2345
  }
2346
2346
  }
2347
- class $e extends Ve {
2347
+ class $e extends Pe {
2348
2348
  // 缓存上次操作值,避免重复 set 触发不必要的重绘
2349
2349
  lastColor;
2350
2350
  lastBlinking;
@@ -2382,7 +2382,7 @@ class $e extends Ve {
2382
2382
  blur: 2,
2383
2383
  color: "rgba(0,0,0,0.4)"
2384
2384
  } : null
2385
- }), A = new Re({
2385
+ }), d = new De({
2386
2386
  className: "mid",
2387
2387
  x: this.width_05,
2388
2388
  y: this.width_05,
@@ -2392,7 +2392,7 @@ class $e extends Ve {
2392
2392
  stroke: "rgba(255,255,255,0.5)",
2393
2393
  strokeWidth: 1,
2394
2394
  fill: o
2395
- }), d = new Re({
2395
+ }), A = new De({
2396
2396
  className: "rotateLight",
2397
2397
  x: this.width_05,
2398
2398
  y: this.width_05,
@@ -2402,20 +2402,20 @@ class $e extends Ve {
2402
2402
  cornerRadius: this.width_05,
2403
2403
  fill: "rgba(66,66,66,1)"
2404
2404
  });
2405
- return h.add([d, A]), h;
2405
+ return h.add([A, d]), h;
2406
2406
  }
2407
2407
  // 操作:灯颜色变化 & 灯旋转 & 灯闪烁(字段缺失即跳过:未传 color 沿用当前颜色;旋转与闪烁可同时生效)
2408
2408
  operating(e) {
2409
- const t = e.blinking === !0, i = e.rotating === !0, s = e.color, n = s !== void 0 && this.lastColor !== s, a = this.lastBlinking !== t, l = this.lastRotating !== i, c = Object.hasOwn(e, "rotating") && i, h = Object.hasOwn(e, "blinking") && t, A = a || l || (h || c) && n;
2409
+ const t = e.blinking === !0, i = e.rotating === !0, s = e.color, n = s !== void 0 && this.lastColor !== s, a = this.lastBlinking !== t, l = this.lastRotating !== i, c = Object.hasOwn(e, "rotating") && i, h = Object.hasOwn(e, "blinking") && t, d = a || l || (h || c) && n;
2410
2410
  if (n && (this.lastColor = s), a && (this.lastBlinking = t), l && (this.lastRotating = i), n && (this.config.isRingShape || this.ui.findOne(".mid")?.set({
2411
2411
  fill: {
2412
2412
  color: s
2413
2413
  }
2414
2414
  }), this.ui.findOne(".rotateLight")?.set({
2415
2415
  fill: s
2416
- })), A) {
2417
- const d = Se(), u = this.ui.findOne(".rotateLight"), f = s ?? this.lastColor ?? this.config.color ?? "#424242";
2418
- if (d && c) {
2416
+ })), d) {
2417
+ const A = Se(), u = this.ui.findOne(".rotateLight"), f = s ?? this.lastColor ?? this.config.color ?? "#424242";
2418
+ if (A && c) {
2419
2419
  const p = h ? [
2420
2420
  { rotation: 0, opacity: 1 },
2421
2421
  { rotation: 180, opacity: 0.25 },
@@ -2438,7 +2438,7 @@ class $e extends Ve {
2438
2438
  ]
2439
2439
  }
2440
2440
  });
2441
- } else if (d && h) {
2441
+ } else if (A && h) {
2442
2442
  const p = this.config.color;
2443
2443
  u?.set({
2444
2444
  animation: {
@@ -2458,7 +2458,7 @@ class $e extends Ve {
2458
2458
  }
2459
2459
  }
2460
2460
  }
2461
- class ie extends Ve {
2461
+ class ie extends Pe {
2462
2462
  // 缓存上次操作值
2463
2463
  lastColor;
2464
2464
  lastBlinking;
@@ -2479,7 +2479,7 @@ class ie extends Ve {
2479
2479
  super({ ...t, ...e });
2480
2480
  }
2481
2481
  createUi() {
2482
- const { x: e, y: t, rotation: i, width: s, height: o, color: n, strokeColor: a, strokeWidth: l, cornerRadius: c, showShadow: h, inFlow: A } = this.config;
2482
+ const { x: e, y: t, rotation: i, width: s, height: o, color: n, strokeColor: a, strokeWidth: l, cornerRadius: c, showShadow: h, inFlow: d } = this.config;
2483
2483
  return new M({
2484
2484
  hittable: !1,
2485
2485
  className: "RectLight",
@@ -2493,7 +2493,7 @@ class ie extends Ve {
2493
2493
  strokeWidth: l,
2494
2494
  around: "center",
2495
2495
  fill: n,
2496
- inFlow: A,
2496
+ inFlow: d,
2497
2497
  shadow: h ? {
2498
2498
  spread: 1,
2499
2499
  blur: 2,
@@ -2520,7 +2520,7 @@ class ie extends Ve {
2520
2520
  l?.set({ animation: void 0 }), l?.set({ fill: c });
2521
2521
  }
2522
2522
  }
2523
- class et extends Ve {
2523
+ class et extends Pe {
2524
2524
  constructor(e) {
2525
2525
  const t = {
2526
2526
  x: 0,
@@ -2591,7 +2591,7 @@ class et extends Ve {
2591
2591
  }
2592
2592
  }
2593
2593
  }
2594
- class tt extends Ve {
2594
+ class tt extends Pe {
2595
2595
  constructor(e) {
2596
2596
  const t = {
2597
2597
  x: 0,
@@ -2670,11 +2670,11 @@ class tt extends Ve {
2670
2670
  });
2671
2671
  }
2672
2672
  }
2673
- const Fe = z("StationSlotGroup");
2673
+ const ke = z("StationSlotGroup");
2674
2674
  function xo(r) {
2675
2675
  return r === void 0 ? void 0 : r.trim() || void 0;
2676
2676
  }
2677
- class re extends Ve {
2677
+ class re extends Pe {
2678
2678
  parentRotation;
2679
2679
  stationSlotInstances;
2680
2680
  // 存储 StationSlot 实例的 Map,key 为 IStationSlotConfig.index
@@ -2692,16 +2692,16 @@ class re extends Ve {
2692
2692
  const { flowOptions: e, stationSlots: t } = this.config, i = e.width, s = e.height, o = e.flow, n = e.flowWrap, a = e.oneDirectionMaxQuantity, l = e.gap ?? 0;
2693
2693
  if (t.length === 0)
2694
2694
  return { width: i, height: s };
2695
- const c = Math.max(...t.map((A) => A.width ?? 0)), h = Math.max(...t.map((A) => A.height ?? 0));
2695
+ const c = Math.max(...t.map((d) => d.width ?? 0)), h = Math.max(...t.map((d) => d.height ?? 0));
2696
2696
  if (n === !1)
2697
2697
  return { width: i, height: s };
2698
2698
  if (o === "x" || o === "x-reverse") {
2699
- const A = c * a + l * (a - 1), d = i > 0 ? i : A, u = i > 0 ? Math.max(1, Math.floor((i + l) / (c + l))) : Math.max(1, a), f = Math.ceil(t.length / u), p = h * f + l * (f - 1);
2700
- return { width: d, height: p };
2699
+ const d = c * a + l * (a - 1), A = i > 0 ? i : d, u = i > 0 ? Math.max(1, Math.floor((i + l) / (c + l))) : Math.max(1, a), f = Math.ceil(t.length / u), p = h * f + l * (f - 1);
2700
+ return { width: A, height: p };
2701
2701
  }
2702
2702
  if (o === "y" || o === "y-reverse") {
2703
- const A = h * a + l * (a - 1), d = s > 0 ? s : A, u = s > 0 ? Math.max(1, Math.floor((s + l) / (h + l))) : Math.max(1, a), f = Math.ceil(t.length / u);
2704
- return { width: c * f + l * (f - 1), height: d };
2703
+ const d = h * a + l * (a - 1), A = s > 0 ? s : d, u = s > 0 ? Math.max(1, Math.floor((s + l) / (h + l))) : Math.max(1, a), f = Math.ceil(t.length / u);
2704
+ return { width: c * f + l * (f - 1), height: A };
2705
2705
  }
2706
2706
  return { width: i, height: s };
2707
2707
  }
@@ -2718,12 +2718,12 @@ class re extends Ve {
2718
2718
  visible: l = !0,
2719
2719
  origin: c = "center",
2720
2720
  around: h = "center",
2721
- hideBounds: A = !0
2722
- } = this.config, d = [];
2721
+ hideBounds: d = !0
2722
+ } = this.config, A = [];
2723
2723
  for (let f = 0; f < o.length; f++) {
2724
2724
  const p = o[f];
2725
2725
  if (typeof p.index != "number") {
2726
- Fe.warn("StationSlot 缺少有效的 index 字段:", p);
2726
+ ke.warn("StationSlot 缺少有效的 index 字段:", p);
2727
2727
  continue;
2728
2728
  }
2729
2729
  const C = new Zi({
@@ -2731,9 +2731,9 @@ class re extends Ve {
2731
2731
  parentRotation: this.parentRotation,
2732
2732
  sourceSlot: this.sourceSlots[f]
2733
2733
  }).init();
2734
- this.stationSlotInstances.set(p.index, C), d.push(C.ui);
2734
+ this.stationSlotInstances.set(p.index, C), A.push(C.ui);
2735
2735
  }
2736
- return new Be({
2736
+ return new xe({
2737
2737
  ...n,
2738
2738
  flowAlign: "center",
2739
2739
  className: "StationSlotGroup",
@@ -2748,9 +2748,9 @@ class re extends Ve {
2748
2748
  origin: c,
2749
2749
  around: h,
2750
2750
  // hideBounds 为 false 时显示 1px 工业黄边框,方便查看容器轮廓
2751
- stroke: A === !1 ? "#FFD700" : void 0,
2752
- strokeWidth: A === !1 ? 1 : 0,
2753
- children: d
2751
+ stroke: d === !1 ? "#FFD700" : void 0,
2752
+ strokeWidth: d === !1 ? 1 : 0,
2753
+ children: A
2754
2754
  });
2755
2755
  }
2756
2756
  // 切换 ui 的 visible
@@ -2762,18 +2762,18 @@ class re extends Ve {
2762
2762
  */
2763
2763
  operating(e) {
2764
2764
  if (typeof e.device_station != "number") {
2765
- Fe.warn("IResourceOperating 缺少有效的 device_station 字段:", e);
2765
+ ke.warn("IResourceOperating 缺少有效的 device_station 字段:", e);
2766
2766
  return;
2767
2767
  }
2768
2768
  const t = this.stationSlotInstances.get(e.device_station);
2769
2769
  if (!t) {
2770
- Fe.warn(
2770
+ ke.warn(
2771
2771
  `处理资源失败:未找到 device_station=${e.device_station} 的工位槽,rawData:`,
2772
2772
  e.raw_data
2773
2773
  );
2774
2774
  return;
2775
2775
  }
2776
- e.handle_type === "add" ? t.addPallet(e) : e.handle_type === "remove" ? t.removeAllPallet() : Fe.warn("处理资源失败:handle_type 参数错误,请传入 add 或 remove,rawData:", e.raw_data);
2776
+ e.handle_type === "add" ? t.addPallet(e) : e.handle_type === "remove" ? t.removeAllPallet() : ke.warn("处理资源失败:handle_type 参数错误,请传入 add 或 remove,rawData:", e.raw_data);
2777
2777
  }
2778
2778
  /**
2779
2779
  * 按 resourceId 遍历所有工位槽,精确移除匹配的资源
@@ -2793,7 +2793,7 @@ class re extends Ve {
2793
2793
  setSiteWorkingColor(e, t) {
2794
2794
  const i = this.stationSlotInstances.get(e);
2795
2795
  if (!i) {
2796
- Fe.warn(`修改工位颜色失败:未找到 index=${e} 的工位槽`);
2796
+ ke.warn(`修改工位颜色失败:未找到 index=${e} 的工位槽`);
2797
2797
  return;
2798
2798
  }
2799
2799
  i.setSiteWorkingColor(xo(t));
@@ -2897,7 +2897,7 @@ function ge(r) {
2897
2897
  }, i = r.stationSlotGroup, s = r.stationSlotGroupPallet, o = r.stationSlotGroupTool;
2898
2898
  return i ? t(i) : (t(s), t(o)), { layers: e, migrated: e.length > 0 };
2899
2899
  }
2900
- function Oe(r) {
2900
+ function Ve(r) {
2901
2901
  return r?.stationSlots?.some((e) => e.resourceType === R.TOOL) ?? !1;
2902
2902
  }
2903
2903
  class je extends ee {
@@ -2928,8 +2928,8 @@ class je extends ee {
2928
2928
  width: l,
2929
2929
  height: c,
2930
2930
  x: h,
2931
- y: A,
2932
- offsetX: d,
2931
+ y: d,
2932
+ offsetX: A,
2933
2933
  offsetY: u,
2934
2934
  zIndex: f,
2935
2935
  rotation: p,
@@ -2984,8 +2984,8 @@ class je extends ee {
2984
2984
  width: l,
2985
2985
  height: c,
2986
2986
  x: h,
2987
- y: A,
2988
- offsetX: d,
2987
+ y: d,
2988
+ offsetX: A,
2989
2989
  offsetY: u,
2990
2990
  rotation: p,
2991
2991
  scale: C,
@@ -3093,8 +3093,8 @@ class Xe extends ee {
3093
3093
  height: l,
3094
3094
  x: c,
3095
3095
  y: h,
3096
- offsetX: A,
3097
- offsetY: d,
3096
+ offsetX: d,
3097
+ offsetY: A,
3098
3098
  zIndex: u,
3099
3099
  rotation: f,
3100
3100
  scale: p,
@@ -3144,8 +3144,8 @@ class Xe extends ee {
3144
3144
  className: t,
3145
3145
  x: c,
3146
3146
  y: h,
3147
- offsetX: A,
3148
- offsetY: d,
3147
+ offsetX: d,
3148
+ offsetY: A,
3149
3149
  width: a,
3150
3150
  height: l,
3151
3151
  zIndex: u,
@@ -3188,7 +3188,7 @@ class Xe extends ee {
3188
3188
  x: this.width_05,
3189
3189
  around: "top"
3190
3190
  }),
3191
- new Re({
3191
+ new De({
3192
3192
  hittable: !1,
3193
3193
  fill: "#D5DAE3",
3194
3194
  x: this.width_05,
@@ -3269,8 +3269,8 @@ class k extends ee {
3269
3269
  ].join(" ");
3270
3270
  }
3271
3271
  buildLayers(e, t, i) {
3272
- const s = k.WALL_THICKNESS, o = k.BASE_HEIGHT, n = s, l = t - o - n, c = k.LAYER_GAP, h = (l - c * (i.length - 1)) / i.length, A = [];
3273
- return i.forEach((d, u) => {
3272
+ const s = k.WALL_THICKNESS, o = k.BASE_HEIGHT, n = s, l = t - o - n, c = k.LAYER_GAP, h = (l - c * (i.length - 1)) / i.length, d = [];
3273
+ return i.forEach((A, u) => {
3274
3274
  const f = n + u * (h + c), p = new M({
3275
3275
  // 层容器可命中自身(不可设 hitSelf: false):overflow hidden 的裁剪 Box 在 Leafer pick 时
3276
3276
  // 要求自身先命中(__clipAfterFill),hitSelf: false 会导致整棵子树(工位槽)无法被命中测试。
@@ -3297,19 +3297,19 @@ class k extends ee {
3297
3297
  ]
3298
3298
  }), C = new re(
3299
3299
  {
3300
- ...d.stationSlotGroup,
3300
+ ...A.stationSlotGroup,
3301
3301
  around: "center",
3302
3302
  origin: "center",
3303
3303
  x: (e - s * 2) / 2,
3304
3304
  y: h / 2,
3305
3305
  hittable: this.interactionHittable,
3306
3306
  // 工位(BaseAbs 构造函数会对 config 整体 cloneDeep,无需此处浅拷贝)
3307
- stationSlots: d.stationSlotGroup.stationSlots || []
3307
+ stationSlots: A.stationSlotGroup.stationSlots || []
3308
3308
  },
3309
3309
  this.config.rotation
3310
3310
  ).init();
3311
- if (this.layerGroups.set(d.index, C), p.add(C.ui), d.lightEnabled !== !1) {
3312
- const g = d.lightColor || "#666", m = new ie({
3311
+ if (this.layerGroups.set(A.index, C), p.add(C.ui), A.lightEnabled !== !1) {
3312
+ const g = A.lightColor || "#666", m = new ie({
3313
3313
  x: (e - s * 2) / 2,
3314
3314
  y: h - 4,
3315
3315
  width: (e - s * 2) / 2,
@@ -3317,10 +3317,10 @@ class k extends ee {
3317
3317
  color: g,
3318
3318
  cornerRadius: 2
3319
3319
  }).init();
3320
- this.layerLights.set(d.index, m), p.add(m.ui);
3320
+ this.layerLights.set(A.index, m), p.add(m.ui);
3321
3321
  }
3322
- A.push(p);
3323
- }), A;
3322
+ d.push(p);
3323
+ }), d;
3324
3324
  }
3325
3325
  buildBaseAndWheels(e, t) {
3326
3326
  const i = e + k.BASE_EXTEND * 2, s = new M({
@@ -3336,7 +3336,7 @@ class k extends ee {
3336
3336
  cornerRadius: [0, 0, 4, 4],
3337
3337
  stroke: "#C8CCD4",
3338
3338
  strokeWidth: 0.5
3339
- }), o = t + k.BASE_THICKNESS - k.WHEEL_SIZE * k.WHEEL_COVER_RATIO, n = -4 + k.WHEEL_INSET, a = e + k.BASE_EXTEND - k.WHEEL_INSET, l = new Re({
3339
+ }), o = t + k.BASE_THICKNESS - k.WHEEL_SIZE * k.WHEEL_COVER_RATIO, n = -4 + k.WHEEL_INSET, a = e + k.BASE_EXTEND - k.WHEEL_INSET, l = new De({
3340
3340
  editable: !1,
3341
3341
  hittable: !1,
3342
3342
  className: "WheelLeft",
@@ -3347,7 +3347,7 @@ class k extends ee {
3347
3347
  fill: "#111",
3348
3348
  stroke: "#999",
3349
3349
  strokeWidth: 1
3350
- }), c = new Re({
3350
+ }), c = new De({
3351
3351
  editable: !1,
3352
3352
  hittable: !1,
3353
3353
  className: "WheelRight",
@@ -3374,8 +3374,8 @@ class k extends ee {
3374
3374
  offsetX: l,
3375
3375
  offsetY: c,
3376
3376
  zIndex: h,
3377
- rotation: A,
3378
- scale: d,
3377
+ rotation: d,
3378
+ scale: A,
3379
3379
  visible: u,
3380
3380
  editable: f,
3381
3381
  draggable: p,
@@ -3432,8 +3432,8 @@ class k extends ee {
3432
3432
  width: s,
3433
3433
  height: m + k.BASE_THICKNESS + k.WHEEL_SIZE / 3,
3434
3434
  zIndex: h,
3435
- rotation: A,
3436
- scale: d,
3435
+ rotation: d,
3436
+ scale: A,
3437
3437
  visible: u,
3438
3438
  editable: f,
3439
3439
  draggable: p,
@@ -3544,8 +3544,8 @@ class J extends ee {
3544
3544
  ].join(" ");
3545
3545
  }
3546
3546
  buildLayers(e, t, i) {
3547
- const s = J.WALL_THICKNESS, o = J.BASE_HEIGHT, n = s, l = t - o - n, c = J.LAYER_GAP, h = (l - c * (i.length - 1)) / i.length, A = [];
3548
- return i.forEach((d, u) => {
3547
+ const s = J.WALL_THICKNESS, o = J.BASE_HEIGHT, n = s, l = t - o - n, c = J.LAYER_GAP, h = (l - c * (i.length - 1)) / i.length, d = [];
3548
+ return i.forEach((A, u) => {
3549
3549
  const f = n + u * (h + c), p = new M({
3550
3550
  // 层容器可命中自身(不可设 hitSelf: false):overflow hidden 裁剪 Box 在 pick 时要求自身先命中(__clipAfterFill),
3551
3551
  // hitSelf: false 会导致整棵子树(工位槽)无法被命中测试。挂载模型 config 保证点击层内空白区时 data 仍为料道信息
@@ -3571,7 +3571,7 @@ class J extends ee {
3571
3571
  ]
3572
3572
  }), C = new re(
3573
3573
  {
3574
- ...d.stationSlotGroup,
3574
+ ...A.stationSlotGroup,
3575
3575
  around: "center",
3576
3576
  origin: "center",
3577
3577
  x: (e - s * 2) / 2,
@@ -3580,8 +3580,8 @@ class J extends ee {
3580
3580
  },
3581
3581
  this.config.rotation
3582
3582
  ).init();
3583
- this.layerGroups.set(d.index, C), p.add(C.ui), A.push(p);
3584
- }), A;
3583
+ this.layerGroups.set(A.index, C), p.add(C.ui), d.push(p);
3584
+ }), d;
3585
3585
  }
3586
3586
  createUi() {
3587
3587
  const {
@@ -3595,8 +3595,8 @@ class J extends ee {
3595
3595
  offsetX: l,
3596
3596
  offsetY: c,
3597
3597
  zIndex: h,
3598
- rotation: A,
3599
- scale: d,
3598
+ rotation: d,
3599
+ scale: A,
3600
3600
  visible: u,
3601
3601
  editable: f,
3602
3602
  draggable: p,
@@ -3651,8 +3651,8 @@ class J extends ee {
3651
3651
  width: s,
3652
3652
  height: o,
3653
3653
  zIndex: h,
3654
- rotation: A,
3655
- scale: d,
3654
+ rotation: d,
3655
+ scale: A,
3656
3656
  visible: u,
3657
3657
  editable: f,
3658
3658
  draggable: p,
@@ -3726,8 +3726,8 @@ class xt extends ee {
3726
3726
  height: l,
3727
3727
  x: c,
3728
3728
  y: h,
3729
- offsetX: A,
3730
- offsetY: d,
3729
+ offsetX: d,
3730
+ offsetY: A,
3731
3731
  zIndex: u,
3732
3732
  rotation: f,
3733
3733
  scale: p,
@@ -3774,8 +3774,8 @@ class xt extends ee {
3774
3774
  className: t,
3775
3775
  x: c,
3776
3776
  y: h,
3777
- offsetX: A,
3778
- offsetY: d,
3777
+ offsetX: d,
3778
+ offsetY: A,
3779
3779
  width: a,
3780
3780
  height: l,
3781
3781
  zIndex: u,
@@ -3931,8 +3931,8 @@ class Do extends ee {
3931
3931
  height: l,
3932
3932
  x: c,
3933
3933
  y: h,
3934
- offsetX: A,
3935
- offsetY: d,
3934
+ offsetX: d,
3935
+ offsetY: A,
3936
3936
  zIndex: u,
3937
3937
  rotation: f,
3938
3938
  scale: p,
@@ -3986,8 +3986,8 @@ class Do extends ee {
3986
3986
  className: t,
3987
3987
  x: c,
3988
3988
  y: h,
3989
- offsetX: A,
3990
- offsetY: d,
3989
+ offsetX: d,
3990
+ offsetY: A,
3991
3991
  width: a,
3992
3992
  height: l,
3993
3993
  zIndex: u,
@@ -4060,13 +4060,13 @@ class Do extends ee {
4060
4060
  }
4061
4061
  }
4062
4062
  const zt = z("SingleJointRobot"), jt = [15, 0, 0, 15], Xt = 4, Jt = 0.66, qt = 0.5, Zt = 12.5, _t = 7;
4063
- class Ue extends ee {
4063
+ class Qe extends ee {
4064
4064
  static DEFAULT_WIDTH = 90;
4065
4065
  static DEFAULT_HEIGHT = 76;
4066
4066
  static DEFAULT_LIGHT_COLOR = "#424242";
4067
4067
  light1 = null;
4068
4068
  light2 = null;
4069
- defaultLightColor = Ue.DEFAULT_LIGHT_COLOR;
4069
+ defaultLightColor = Qe.DEFAULT_LIGHT_COLOR;
4070
4070
  /** 全部工位层工位组(一层=一组),挂载于唯一容器 #slotLayers,与夹具无关 */
4071
4071
  slotGroups = [];
4072
4072
  /** 与 slotGroups 平行的层 index(1-based),用于夹具绑定层的显隐与资源层索引映射 */
@@ -4085,16 +4085,16 @@ class Ue extends ee {
4085
4085
  const {
4086
4086
  id: e,
4087
4087
  className: t,
4088
- width: i = Ue.DEFAULT_WIDTH,
4089
- height: s = Ue.DEFAULT_HEIGHT,
4088
+ width: i = Qe.DEFAULT_WIDTH,
4089
+ height: s = Qe.DEFAULT_HEIGHT,
4090
4090
  offsetX: o,
4091
4091
  offsetY: n,
4092
4092
  x: a,
4093
4093
  y: l,
4094
4094
  zIndex: c,
4095
4095
  rotation: h,
4096
- scale: A,
4097
- visible: d,
4096
+ scale: d,
4097
+ visible: A,
4098
4098
  editable: u,
4099
4099
  draggable: f,
4100
4100
  lightEnabled: p,
@@ -4109,8 +4109,8 @@ class Ue extends ee {
4109
4109
  {
4110
4110
  ...x,
4111
4111
  // 兼容旧数据:无 x/y 时按组内槽位类型给默认定位(tool 组居刀具杆端,其余居托盘中部),仅影响摆放
4112
- x: x.x ?? (Oe(x) ? 44 : 40),
4113
- y: x.y ?? (Oe(x) ? 24.5 : 25),
4112
+ x: x.x ?? (Ve(x) ? 44 : 40),
4113
+ y: x.y ?? (Ve(x) ? 24.5 : 25),
4114
4114
  hittable: this.interactionHittable
4115
4115
  },
4116
4116
  this.config.rotation
@@ -4359,8 +4359,8 @@ class Ue extends ee {
4359
4359
  cornerRadius: 10,
4360
4360
  zIndex: c,
4361
4361
  rotation: h,
4362
- scale: A,
4363
- visible: d,
4362
+ scale: d,
4363
+ visible: A,
4364
4364
  editable: u,
4365
4365
  draggable: f
4366
4366
  });
@@ -4520,13 +4520,13 @@ class Ue extends ee {
4520
4520
  // }
4521
4521
  }
4522
4522
  const $t = z("DoubleJointRobot"), ei = [15, 0, 0, 15], ti = 4, ii = 0.66, si = 0.5, oi = 12.5, ri = 7;
4523
- class Qe extends ee {
4523
+ class Ne extends ee {
4524
4524
  static DEFAULT_WIDTH = 90;
4525
4525
  static DEFAULT_HEIGHT = 76;
4526
4526
  static DEFAULT_LIGHT_COLOR = "#424242";
4527
4527
  light1 = null;
4528
4528
  light2 = null;
4529
- defaultLightColor = Qe.DEFAULT_LIGHT_COLOR;
4529
+ defaultLightColor = Ne.DEFAULT_LIGHT_COLOR;
4530
4530
  /** 全部工位层工位组(一层=一组),挂载于唯一容器 #slotLayers,与夹具无关 */
4531
4531
  slotGroups = [];
4532
4532
  /** 与 slotGroups 平行的层 index(1-based),用于夹具绑定层的显隐与资源层索引映射 */
@@ -4545,16 +4545,16 @@ class Qe extends ee {
4545
4545
  const {
4546
4546
  id: e,
4547
4547
  className: t,
4548
- width: i = Qe.DEFAULT_WIDTH,
4549
- height: s = Qe.DEFAULT_HEIGHT,
4548
+ width: i = Ne.DEFAULT_WIDTH,
4549
+ height: s = Ne.DEFAULT_HEIGHT,
4550
4550
  offsetX: o,
4551
4551
  offsetY: n,
4552
4552
  x: a,
4553
4553
  y: l,
4554
4554
  zIndex: c,
4555
4555
  rotation: h,
4556
- scale: A,
4557
- visible: d,
4556
+ scale: d,
4557
+ visible: A,
4558
4558
  editable: u,
4559
4559
  draggable: f,
4560
4560
  lightEnabled: p,
@@ -4569,8 +4569,8 @@ class Qe extends ee {
4569
4569
  {
4570
4570
  ...x,
4571
4571
  // 兼容旧数据:无 x/y 时按组内槽位类型给默认定位(tool 组居刀具杆端,其余居托盘中部),仅影响摆放
4572
- x: x.x ?? (Oe(x) ? 44 : 40),
4573
- y: x.y ?? (Oe(x) ? 24.5 : 25),
4572
+ x: x.x ?? (Ve(x) ? 44 : 40),
4573
+ y: x.y ?? (Ve(x) ? 24.5 : 25),
4574
4574
  hittable: this.interactionHittable
4575
4575
  },
4576
4576
  this.config.rotation
@@ -4827,8 +4827,8 @@ class Qe extends ee {
4827
4827
  cornerRadius: 10,
4828
4828
  zIndex: c,
4829
4829
  rotation: h,
4830
- scale: A,
4831
- visible: d,
4830
+ scale: d,
4831
+ visible: A,
4832
4832
  editable: u,
4833
4833
  draggable: f
4834
4834
  });
@@ -4991,29 +4991,29 @@ class Qe extends ee {
4991
4991
  // }
4992
4992
  }
4993
4993
  const ht = z("Rgv");
4994
- class Ne extends ee {
4994
+ class He extends ee {
4995
4995
  static DEFAULT_WIDTH = 90;
4996
4996
  static DEFAULT_HEIGHT = 120;
4997
4997
  static DEFAULT_LIGHT_COLOR = "#424242";
4998
4998
  light1 = null;
4999
4999
  light2 = null;
5000
- defaultLightColor = Ne.DEFAULT_LIGHT_COLOR;
5000
+ defaultLightColor = He.DEFAULT_LIGHT_COLOR;
5001
5001
  /** 全部工位层工位组(一层=一组),挂载于唯一容器 #slotLayers,不区分托盘/刀具工位组 */
5002
5002
  slotGroups = [];
5003
5003
  createUi() {
5004
5004
  const {
5005
5005
  id: e,
5006
5006
  className: t,
5007
- width: i = Ne.DEFAULT_WIDTH,
5008
- height: s = Ne.DEFAULT_HEIGHT,
5007
+ width: i = He.DEFAULT_WIDTH,
5008
+ height: s = He.DEFAULT_HEIGHT,
5009
5009
  offsetX: o,
5010
5010
  offsetY: n,
5011
5011
  x: a,
5012
5012
  y: l,
5013
5013
  zIndex: c,
5014
5014
  rotation: h,
5015
- scale: A,
5016
- visible: d,
5015
+ scale: d,
5016
+ visible: A,
5017
5017
  editable: u,
5018
5018
  draggable: f,
5019
5019
  lightEnabled: p,
@@ -5029,7 +5029,7 @@ class Ne extends ee {
5029
5029
  x: x.x ?? E * 0.94 * 0.5,
5030
5030
  y: x.y ?? this.height_05 * 0.5,
5031
5031
  hittable: this.interactionHittable,
5032
- ...Oe(x) ? {} : { zIndex: 10 }
5032
+ ...Ve(x) ? {} : { zIndex: 10 }
5033
5033
  },
5034
5034
  this.config.rotation
5035
5035
  ).init() : null;
@@ -5050,7 +5050,7 @@ class Ne extends ee {
5050
5050
  inFlow: !1,
5051
5051
  color: this.defaultLightColor
5052
5052
  }).init());
5053
- const S = new Be({
5053
+ const S = new xe({
5054
5054
  hitSelf: !1,
5055
5055
  id: "rgv_fork",
5056
5056
  inFlow: !1,
@@ -5149,7 +5149,7 @@ class Ne extends ee {
5149
5149
  ]
5150
5150
  }
5151
5151
  ]
5152
- }), G = new Be({
5152
+ }), G = new xe({
5153
5153
  hitSelf: !1,
5154
5154
  x: this.width_05,
5155
5155
  y: this.height_05,
@@ -5209,8 +5209,8 @@ class Ne extends ee {
5209
5209
  fill: "rgba(0,0,0,0)",
5210
5210
  zIndex: c,
5211
5211
  rotation: h,
5212
- scale: A,
5213
- visible: d,
5212
+ scale: d,
5213
+ visible: A,
5214
5214
  editable: u,
5215
5215
  draggable: f,
5216
5216
  children: [
@@ -5225,7 +5225,7 @@ class Ne extends ee {
5225
5225
  around: "center",
5226
5226
  children: [
5227
5227
  // 左侧支撑臂
5228
- new Be({
5228
+ new xe({
5229
5229
  hittable: !1,
5230
5230
  width: 17,
5231
5231
  height: s,
@@ -5285,7 +5285,7 @@ class Ne extends ee {
5285
5285
  }),
5286
5286
  G,
5287
5287
  // 右侧支撑臂
5288
- new Be({
5288
+ new xe({
5289
5289
  hittable: !1,
5290
5290
  x: i,
5291
5291
  around: "top-right",
@@ -5470,8 +5470,8 @@ class Je extends ee {
5470
5470
  width: l,
5471
5471
  height: c,
5472
5472
  offsetX: h,
5473
- offsetY: A,
5474
- x: d,
5473
+ offsetY: d,
5474
+ x: A,
5475
5475
  y: u,
5476
5476
  zIndex: f,
5477
5477
  rotation: p,
@@ -5479,7 +5479,7 @@ class Je extends ee {
5479
5479
  visible: D,
5480
5480
  editable: g,
5481
5481
  draggable: m
5482
- } = this.config, E = n && n.width > 0 ? n.width : void 0, y = n && n.height > 0 ? n.height : void 0, S = new Be({
5482
+ } = this.config, E = n && n.width > 0 ? n.width : void 0, y = n && n.height > 0 ? n.height : void 0, S = new xe({
5483
5483
  ...n,
5484
5484
  flowAlign: "center",
5485
5485
  x: 0,
@@ -5517,8 +5517,8 @@ class Je extends ee {
5517
5517
  id: e,
5518
5518
  className: t,
5519
5519
  offsetX: h,
5520
- offsetY: A,
5521
- x: d,
5520
+ offsetY: d,
5521
+ x: A,
5522
5522
  y: u,
5523
5523
  width: l,
5524
5524
  height: c,
@@ -5629,7 +5629,7 @@ const ni = z("Pallet"), To = {
5629
5629
  VerticalBar: { scale: 0.2, opacity: 0.3 }
5630
5630
  // 竖条纹
5631
5631
  };
5632
- class xe extends ee {
5632
+ class Re extends ee {
5633
5633
  static CORNER_RADIUS = 0;
5634
5634
  static LAYER_PADDING = 0;
5635
5635
  static LAYER_GAP = 4;
@@ -5644,9 +5644,9 @@ class xe extends ee {
5644
5644
  }
5645
5645
  // 构建多层工位组容器(参考 ShuttleStation.buildLayers:纵向均分内腔,工位组水平垂直居中)
5646
5646
  buildLayers(e, t, i) {
5647
- const s = xe.LAYER_PADDING, o = xe.LAYER_GAP, n = s, c = (t - s - n - o * (i.length - 1)) / i.length, h = [];
5648
- return i.forEach((A, d) => {
5649
- const u = n + d * (c + o), f = new M({
5647
+ const s = Re.LAYER_PADDING, o = Re.LAYER_GAP, n = s, c = (t - s - n - o * (i.length - 1)) / i.length, h = [];
5648
+ return i.forEach((d, A) => {
5649
+ const u = n + A * (c + o), f = new M({
5650
5650
  // 层容器可命中自身(不可设 hitSelf: false):overflow hidden 的裁剪 Box 在 Leafer pick 时
5651
5651
  // 要求自身先命中(__clipAfterFill),hitSelf: false 会导致整棵子树(工位槽)无法被命中测试。
5652
5652
  // 挂载模型 config 使点击层内空白区时 data 与点击主体一致(均为托盘信息)
@@ -5662,18 +5662,18 @@ class xe extends ee {
5662
5662
  overflow: "hidden"
5663
5663
  }), p = new re(
5664
5664
  {
5665
- ...A.stationSlotGroup,
5665
+ ...d.stationSlotGroup,
5666
5666
  around: "center",
5667
5667
  origin: "center",
5668
5668
  x: (e - s * 2) / 2,
5669
5669
  y: c / 2,
5670
5670
  hittable: this.interactionHittable,
5671
5671
  // 工位(BaseAbs 构造函数会对 config 整体 cloneDeep,无需此处浅拷贝)
5672
- stationSlots: A.stationSlotGroup.stationSlots || []
5672
+ stationSlots: d.stationSlotGroup.stationSlots || []
5673
5673
  },
5674
5674
  this.config.rotation
5675
5675
  ).init();
5676
- this.layerGroups.set(A.index, p), f.add(p.ui), h.push(f);
5676
+ this.layerGroups.set(d.index, p), f.add(p.ui), h.push(f);
5677
5677
  }), h;
5678
5678
  }
5679
5679
  createUi() {
@@ -5689,8 +5689,8 @@ class xe extends ee {
5689
5689
  height: l,
5690
5690
  offsetX: c,
5691
5691
  offsetY: h,
5692
- x: A,
5693
- y: d,
5692
+ x: d,
5693
+ y: A,
5694
5694
  zIndex: u,
5695
5695
  rotation: f,
5696
5696
  scale: p,
@@ -5708,7 +5708,7 @@ class xe extends ee {
5708
5708
  effect: E,
5709
5709
  scale: T,
5710
5710
  opacity: B,
5711
- cornerRadius: xe.CORNER_RADIUS
5711
+ cornerRadius: Re.CORNER_RADIUS
5712
5712
  })
5713
5713
  );
5714
5714
  }
@@ -5726,8 +5726,8 @@ class xe extends ee {
5726
5726
  className: t,
5727
5727
  offsetX: c,
5728
5728
  offsetY: h,
5729
- x: A,
5730
- y: d,
5729
+ x: d,
5730
+ y: A,
5731
5731
  width: a,
5732
5732
  height: l,
5733
5733
  zIndex: u,
@@ -5738,7 +5738,7 @@ class xe extends ee {
5738
5738
  draggable: g,
5739
5739
  origin: "center",
5740
5740
  around: "center",
5741
- cornerRadius: xe.CORNER_RADIUS,
5741
+ cornerRadius: Re.CORNER_RADIUS,
5742
5742
  fill: n,
5743
5743
  overflow: "hidden",
5744
5744
  children: m
@@ -5861,8 +5861,8 @@ class ae extends ee {
5861
5861
  offsetX: l,
5862
5862
  offsetY: c,
5863
5863
  zIndex: h,
5864
- rotation: A,
5865
- scale: d,
5864
+ rotation: d,
5865
+ scale: A,
5866
5866
  visible: u,
5867
5867
  editable: f,
5868
5868
  draggable: p,
@@ -5921,7 +5921,7 @@ class ae extends ee {
5921
5921
  y: (o - y * 2) / 2,
5922
5922
  hittable: this.interactionHittable
5923
5923
  },
5924
- A
5924
+ d
5925
5925
  ).init(), T.add(this.stationSlotGroup.ui)), C !== !1 && (this.light = new ie({
5926
5926
  x: s / 2,
5927
5927
  y: ae.LIGHT_Y_OFFSET,
@@ -5949,8 +5949,8 @@ class ae extends ee {
5949
5949
  width: s,
5950
5950
  height: o,
5951
5951
  zIndex: h,
5952
- rotation: A,
5953
- scale: d,
5952
+ rotation: d,
5953
+ scale: A,
5954
5954
  visible: u,
5955
5955
  editable: f,
5956
5956
  draggable: p,
@@ -5988,12 +5988,12 @@ const Lo = {
5988
5988
  [L.MATERIAL_TRACK]: J,
5989
5989
  [L.MARKING_MACHINE]: xt,
5990
5990
  [L.CLEANING_MACHINE]: Do,
5991
- [L.SINGLE_JOINT_ROBOT]: Ue,
5992
- [L.DOUBLE_JOINT_ROBOT]: Qe,
5993
- [L.RGV]: Ne,
5991
+ [L.SINGLE_JOINT_ROBOT]: Qe,
5992
+ [L.DOUBLE_JOINT_ROBOT]: Ne,
5993
+ [L.RGV]: He,
5994
5994
  [L.RAIL]: bt,
5995
5995
  [L.RESOURCE_STORE]: Je,
5996
- [L.PALLET]: xe,
5996
+ [L.PALLET]: Re,
5997
5997
  [L.RESOURCE_OPERATION_WINDOW]: ae
5998
5998
  };
5999
5999
  function Fo(r) {
@@ -6080,6 +6080,10 @@ class Ui {
6080
6080
  }
6081
6081
  }), this.app.on(os.READY, () => {
6082
6082
  V.log("Leafer 引擎 READY");
6083
+ }), this.actions.onCanvasTap && this.app.on(Be.TAP, (d) => {
6084
+ this.actions.onCanvasTap?.({ x: d.x ?? 0, y: d.y ?? 0 });
6085
+ }), this.actions.onCanvasMenuTap && this.app.on(Be.MENU_TAP, (d) => {
6086
+ this.actions.onCanvasMenuTap?.({ x: d.x ?? 0, y: d.y ?? 0 });
6083
6087
  });
6084
6088
  const h = new M({
6085
6089
  ...ai,
@@ -6345,16 +6349,16 @@ class Ui {
6345
6349
  return;
6346
6350
  }
6347
6351
  const l = n.ui?.x ?? n.config.x, c = n.ui?.y ?? n.config.y;
6348
- this.palletLinks.forEach((h, A) => {
6352
+ this.palletLinks.forEach((h, d) => {
6349
6353
  if (h.equipId !== e) return;
6350
- const d = this.modelsMap.get(A);
6351
- d?.ui && (d.ui.x = l + h.offsetX, d.ui.y = c + h.offsetY);
6354
+ const A = this.modelsMap.get(d);
6355
+ A?.ui && (A.ui.x = l + h.offsetX, A.ui.y = c + h.offsetY);
6352
6356
  }), s && this.modelsMap.forEach((h) => {
6353
6357
  if (h.config.className !== L.RAIL) return;
6354
- const A = h.config;
6355
- if (!A.linkEquipIdArray?.includes(s)) return;
6356
- const { along: d } = Di(Ri(A), l, c);
6357
- h.followChain(s, d);
6358
+ const d = h.config;
6359
+ if (!d.linkEquipIdArray?.includes(s)) return;
6360
+ const { along: A } = Di(Ri(d), l, c);
6361
+ h.followChain(s, A);
6358
6362
  }), performance.now() >= a ? (this.followingSet.delete(e), this.followDeadlines.delete(e)) : this.followRafId = requestAnimationFrame(o);
6359
6363
  };
6360
6364
  this.followRafId = requestAnimationFrame(o);
@@ -6514,7 +6518,7 @@ class Ui {
6514
6518
  n.set({ stroke: li[s] });
6515
6519
  return;
6516
6520
  }
6517
- const l = Math.max(a.config.width || 100, a.config.height || 100) * 1.05, c = new Re({
6521
+ const l = Math.max(a.config.width || 100, a.config.height || 100) * 1.05, c = new De({
6518
6522
  className: "AlarmHighlight",
6519
6523
  x: a.ui.x,
6520
6524
  y: a.ui.y,
@@ -6794,12 +6798,12 @@ const hi = as({
6794
6798
  set: (b) => {
6795
6799
  e().wsProxyManualModified = b;
6796
6800
  }
6797
- }), A = N({
6801
+ }), d = N({
6798
6802
  get: () => e().perfStatsCollapsed,
6799
6803
  set: (b) => {
6800
6804
  e().perfStatsCollapsed = b;
6801
6805
  }
6802
- }), d = (b) => {
6806
+ }), A = (b) => {
6803
6807
  e().perfStatsCollapsed = b;
6804
6808
  }, u = N({
6805
6809
  get: () => e().wsProxyActiveCaseId ?? "",
@@ -6866,8 +6870,8 @@ const hi = as({
6866
6870
  setWsProxyActiveCaseId: W,
6867
6871
  wsProxyManualModified: h,
6868
6872
  setWsProxyManualModified: O,
6869
- perfStatsCollapsed: A,
6870
- setPerfStatsCollapsed: d,
6873
+ perfStatsCollapsed: d,
6874
+ setPerfStatsCollapsed: A,
6871
6875
  setLogLevel: m,
6872
6876
  setShadowsEnabled: E,
6873
6877
  setAnimationsEnabled: y,
@@ -6884,7 +6888,7 @@ const hi = as({
6884
6888
  let t = null, i = null, s = !1, o = null;
6885
6889
  const n = de([]);
6886
6890
  let a = null, l = null, c = null;
6887
- const h = N(() => r.cases?.find((w) => w.isActive) || null), A = N(() => h.value ? h.value.scene : null), d = N(() => h.value ? h.value.layers : []), u = N(() => n.value.length > 1), f = N(() => n.value.length), p = N(() => !h.value || u.value ? null : d.value.find((w) => w.selected) || null), C = (w) => {
6891
+ const h = N(() => r.cases?.find((w) => w.isActive) || null), d = N(() => h.value ? h.value.scene : null), A = N(() => h.value ? h.value.layers : []), u = N(() => n.value.length > 1), f = N(() => n.value.length), p = N(() => !h.value || u.value ? null : A.value.find((w) => w.selected) || null), C = (w) => {
6888
6892
  if (t) {
6889
6893
  K.warn("Container already initialized");
6890
6894
  return;
@@ -6907,20 +6911,20 @@ const hi = as({
6907
6911
  () => e.fpsMode,
6908
6912
  (w) => m(w)
6909
6913
  );
6910
- const E = ke(() => {
6914
+ const E = Ue(() => {
6911
6915
  if (!t) {
6912
6916
  K.warn("updateScene failed: AppController not initialized");
6913
6917
  return;
6914
6918
  }
6915
- A.value && (K.log("updateScene..."), t.setTree(A.value)), y();
6916
- }, 300), y = ke(() => {
6919
+ d.value && (K.log("updateScene..."), t.setTree(d.value)), y();
6920
+ }, 300), y = Ue(() => {
6917
6921
  if (!t) {
6918
6922
  K.warn("renderLayers failed: AppController not initialized");
6919
6923
  return;
6920
6924
  }
6921
6925
  if (t.clearAll(), h.value) {
6922
6926
  const w = p.value?.id;
6923
- for (const v of d.value)
6927
+ for (const v of A.value)
6924
6928
  t.addModel(v), i && v.id === w && i.selectEquipment(`#${w}`);
6925
6929
  } else
6926
6930
  t.setTree(void 0);
@@ -6941,7 +6945,7 @@ const hi = as({
6941
6945
  i = new Po({
6942
6946
  container: t,
6943
6947
  onSelected: (w) => {
6944
- n.value = w, d.value.forEach((v) => {
6948
+ n.value = w, A.value.forEach((v) => {
6945
6949
  v.selected = w.includes(v.id);
6946
6950
  }), x();
6947
6951
  },
@@ -6959,7 +6963,7 @@ const hi = as({
6959
6963
  const F = l;
6960
6964
  if (l = null, !F) return;
6961
6965
  const I = p.value;
6962
- I && I.width && I.height && (I.x = F.x, I.y = F.y, I.percentX = X(F.x, A.value?.width, 3, !0), I.percentY = X(F.y, A.value?.height, 3, !0));
6966
+ I && I.width && I.height && (I.x = F.x, I.y = F.y, I.percentX = X(F.x, d.value?.width, 3, !0), I.percentY = X(F.y, d.value?.height, 3, !0));
6963
6967
  }));
6964
6968
  },
6965
6969
  onDragStart: () => {
@@ -6970,15 +6974,15 @@ const hi = as({
6970
6974
  const w = i?.getSelectedIds() ?? [];
6971
6975
  if (w.length > 1) {
6972
6976
  w.forEach((F) => {
6973
- const I = d.value.find((Me) => Me.id === F), j = I ? t?.findOne(`#${F}`) : null;
6974
- !I || !j || (I.x = Math.round(j.x ?? 0), I.y = Math.round(j.y ?? 0), I.percentX = X(I.x ?? 0, A.value?.width, 3, !0), I.percentY = X(I.y ?? 0, A.value?.height, 3, !0));
6977
+ const I = A.value.find((Te) => Te.id === F), j = I ? t?.findOne(`#${F}`) : null;
6978
+ !I || !j || (I.x = Math.round(j.x ?? 0), I.y = Math.round(j.y ?? 0), I.percentX = X(I.x ?? 0, d.value?.width, 3, !0), I.percentY = X(I.y ?? 0, d.value?.height, 3, !0));
6975
6979
  }), x();
6976
6980
  return;
6977
6981
  }
6978
6982
  const v = p.value;
6979
6983
  if (v) {
6980
6984
  const F = t?.findOne(`#${v.id}`);
6981
- F && (v.x = Math.round(F.x ?? 0), v.y = Math.round(F.y ?? 0), v.rotation = Math.round(F.rotation ?? 0), v.percentX = X(v.x ?? 0, A.value?.width, 3, !0), v.percentY = X(v.y ?? 0, A.value?.height, 3, !0)), W(v), O(v);
6985
+ F && (v.x = Math.round(F.x ?? 0), v.y = Math.round(F.y ?? 0), v.rotation = Math.round(F.rotation ?? 0), v.percentX = X(v.x ?? 0, d.value?.width, 3, !0), v.percentY = X(v.y ?? 0, d.value?.height, 3, !0)), W(v), O(v);
6982
6986
  } else o && O(o);
6983
6987
  o = null;
6984
6988
  }
@@ -7000,17 +7004,17 @@ const hi = as({
7000
7004
  B.value = null;
7001
7005
  return;
7002
7006
  }
7003
- const j = Math.round((w + F) / 2), Me = Math.round((v + I) / 2);
7007
+ const j = Math.round((w + F) / 2), Te = Math.round((v + I) / 2);
7004
7008
  B.value = {
7005
7009
  x: j,
7006
- y: Me,
7007
- percentX: X(j, A.value?.width, 3, !0),
7008
- percentY: X(Me, A.value?.height, 3, !0)
7010
+ y: Te,
7011
+ percentX: X(j, d.value?.width, 3, !0),
7012
+ percentY: X(Te, d.value?.height, 3, !0)
7009
7013
  };
7010
7014
  }, Q = (w, v) => {
7011
7015
  n.value.length <= 1 || !t || w === 0 && v === 0 || (n.value.forEach((F) => {
7012
- const I = d.value.find((j) => j.id === F);
7013
- I && (I.x = (Number(I.x) || 0) + w, I.y = (Number(I.y) || 0) + v, I.percentX = X(I.x ?? 0, A.value?.width, 3, !0), I.percentY = X(I.y ?? 0, A.value?.height, 3, !0), W(I));
7016
+ const I = A.value.find((j) => j.id === F);
7017
+ I && (I.x = (Number(I.x) || 0) + w, I.y = (Number(I.y) || 0) + v, I.percentX = X(I.x ?? 0, d.value?.width, 3, !0), I.percentY = X(I.y ?? 0, d.value?.height, 3, !0), W(I));
7014
7018
  }), x());
7015
7019
  }, W = (w) => {
7016
7020
  if (!t) return;
@@ -7020,7 +7024,7 @@ const hi = as({
7020
7024
  hittable: F,
7021
7025
  hitSelf: I,
7022
7026
  clickable: j,
7023
- menuClickable: Me,
7027
+ menuClickable: Te,
7024
7028
  draggable: Rt,
7025
7029
  ...ve
7026
7030
  } = w;
@@ -7030,7 +7034,7 @@ const hi = as({
7030
7034
  } else
7031
7035
  v.set(ve);
7032
7036
  }
7033
- }, O = ke((w) => {
7037
+ }, O = Ue((w) => {
7034
7038
  if (!(!w.selected || n.value.length > 1)) {
7035
7039
  if (s) {
7036
7040
  o = w;
@@ -7043,7 +7047,7 @@ const hi = as({
7043
7047
  K.warn("addLayer failed: currentCase not initialized");
7044
7048
  return;
7045
7049
  }
7046
- const v = w.id || He(), F = d.value.length + 1, I = {
7050
+ const v = w.id || Oe(), F = A.value.length + 1, I = {
7047
7051
  ...ne(Us),
7048
7052
  // 使用cloneDeep防止展开运算符的浅拷贝无法处理嵌套对象,导致污染初始值
7049
7053
  ...ne(w),
@@ -7064,28 +7068,28 @@ const hi = as({
7064
7068
  return;
7065
7069
  }
7066
7070
  const I = t.worldToLocalPoint(v, F);
7067
- I && (w.x = I.x, w.y = I.y, w.percentX = X(I.x, A.value?.width, 3, !0), w.percentY = X(I.y, A.value?.height, 3, !0)), me(w);
7071
+ I && (w.x = I.x, w.y = I.y, w.percentX = X(I.x, d.value?.width, 3, !0), w.percentY = X(I.y, d.value?.height, 3, !0)), me(w);
7068
7072
  }, b = () => {
7069
7073
  if (!h.value || n.value.length === 0) return;
7070
7074
  const w = [];
7071
7075
  n.value.forEach((v) => {
7072
- const F = d.value.find((j) => j.id === v);
7076
+ const F = A.value.find((j) => j.id === v);
7073
7077
  if (!F) return;
7074
7078
  const I = ne(F);
7075
- if (I.id = He(), I.rawData && typeof I.rawData == "object") {
7079
+ if (I.id = Oe(), I.rawData && typeof I.rawData == "object") {
7076
7080
  const j = { ...I.rawData };
7077
7081
  delete j.id, I.rawData = { id: I.id, ...j };
7078
7082
  } else
7079
7083
  I.rawData = { id: I.id };
7080
- I.x = (Number(I.x) || 0) + 20, I.y = (Number(I.y) || 0) + 20, I.percentX = X(I.x, A.value?.width, 3, !0), I.percentY = X(I.y, A.value?.height, 3, !0), I.zIndex = d.value.length + w.length + 1, I.selected = !0, w.push(I);
7081
- }), w.length && (h.value.layers.push(...w), d.value.forEach((v) => {
7084
+ I.x = (Number(I.x) || 0) + 20, I.y = (Number(I.y) || 0) + 20, I.percentX = X(I.x, d.value?.width, 3, !0), I.percentY = X(I.y, d.value?.height, 3, !0), I.zIndex = A.value.length + w.length + 1, I.selected = !0, w.push(I);
7085
+ }), w.length && (h.value.layers.push(...w), A.value.forEach((v) => {
7082
7086
  v.selected = w.some((F) => F.id === v.id);
7083
7087
  }), n.value = w.map((v) => v.id), y(), window.setTimeout(() => {
7084
7088
  i?.selectEquipments(w.map((v) => v.id));
7085
7089
  }, 400));
7086
7090
  }, Ni = () => {
7087
7091
  !h.value || n.value.length <= 1 || (n.value.forEach((w) => {
7088
- const v = d.value.find((F) => F.id === w);
7092
+ const v = A.value.find((F) => F.id === w);
7089
7093
  v && (v.visible = !1, W(v));
7090
7094
  }), i?.selectEquipment());
7091
7095
  }, Hi = () => {
@@ -7101,7 +7105,7 @@ const hi = as({
7101
7105
  }
7102
7106
  };
7103
7107
  return le(
7104
- A,
7108
+ d,
7105
7109
  () => {
7106
7110
  t && E();
7107
7111
  },
@@ -7115,8 +7119,8 @@ const hi = as({
7115
7119
  ), {
7116
7120
  // Getters
7117
7121
  currentCase: h,
7118
- scene: A,
7119
- layers: d,
7122
+ scene: d,
7123
+ layers: A,
7120
7124
  currentLayer: p,
7121
7125
  isMultiSelect: u,
7122
7126
  selectedIds: n,
@@ -7167,6 +7171,11 @@ class zo {
7167
7171
  const i = this.entities.get(e);
7168
7172
  i && (i.location = t);
7169
7173
  }
7174
+ /** 按需合并更新实体属性(transfer 后随消息刷新 location / resource_state / resource_color,避免池中残留旧值) */
7175
+ update(e, t) {
7176
+ const i = this.entities.get(e);
7177
+ i && (t.location !== void 0 && (i.location = t.location), t.resource_state !== void 0 && (i.resource_state = t.resource_state), t.resource_color !== void 0 && (i.resource_color = t.resource_color));
7178
+ }
7170
7179
  remove(e) {
7171
7180
  const t = this.entities.get(e);
7172
7181
  return t && this.entities.delete(e), t;
@@ -7196,54 +7205,55 @@ class jo {
7196
7205
  /**
7197
7206
  * 分发一条完整业务消息(envelope + payload)
7198
7207
  * @param msg 原始消息
7208
+ * @param source 触发本消息的源 socket 消息(WsProxy 翻译前原始报文;仅用于资源实体 rawData 溯源,可缺省)
7199
7209
  */
7200
- dispatch(e) {
7201
- const t = e;
7202
- if (t && typeof t == "object" && (t.type === "ping" || t.type === "pong")) {
7203
- P.info("传输层心跳消息,不进业务流程: %s", t.type);
7210
+ dispatch(e, t) {
7211
+ const i = e;
7212
+ if (i && typeof i == "object" && (i.type === "ping" || i.type === "pong")) {
7213
+ P.info("传输层心跳消息,不进业务流程: %s", i.type);
7204
7214
  return;
7205
7215
  }
7206
- if (!t || typeof t != "object" || !t.envelope || typeof t.envelope != "object") {
7207
- P.warn("消息信封缺失,丢弃:", t);
7216
+ if (!i || typeof i != "object" || !i.envelope || typeof i.envelope != "object") {
7217
+ P.warn("消息信封缺失,丢弃:", i);
7208
7218
  return;
7209
7219
  }
7210
- const { envelope: i, payload: s } = t;
7211
- if (!i.id || !i.type || s === void 0) {
7212
- P.warn("信封必备字段缺失(id/type/payload),丢弃:", i);
7220
+ const { envelope: s, payload: o } = i;
7221
+ if (!s.id || !s.type || o === void 0) {
7222
+ P.warn("信封必备字段缺失(id/type/payload),丢弃:", s);
7213
7223
  return;
7214
7224
  }
7215
- if (this.seenIds.has(i.id)) {
7216
- P.warn("重复的 envelope.id=%s,丢弃", i.id);
7225
+ if (this.seenIds.has(s.id)) {
7226
+ P.warn("重复的 envelope.id=%s,丢弃", s.id);
7217
7227
  return;
7218
7228
  }
7219
- if (this.seenIds.add(i.id), this.seenQueue.push(i.id), this.seenQueue.length > Yo) {
7220
- const o = this.seenQueue.shift();
7221
- o !== void 0 && this.seenIds.delete(o);
7229
+ if (this.seenIds.add(s.id), this.seenQueue.push(s.id), this.seenQueue.length > Yo) {
7230
+ const n = this.seenQueue.shift();
7231
+ n !== void 0 && this.seenIds.delete(n);
7222
7232
  }
7223
- switch (i.type) {
7233
+ switch (s.type) {
7224
7234
  case "device_command":
7225
- this.handleDeviceCommand(i.id, s);
7235
+ this.handleDeviceCommand(s.id, o);
7226
7236
  break;
7227
7237
  case "resource_command":
7228
- this.handleResourceCommand(i.id, s);
7238
+ this.handleResourceCommand(s.id, o, t);
7229
7239
  break;
7230
7240
  case "device_init":
7231
- this.handleDeviceInit(i.id, s);
7241
+ this.handleDeviceInit(s.id, o, t);
7232
7242
  break;
7233
7243
  case "scene_reset":
7234
- this.appController.resetAllModels(), this.appController.clearAlarmHighlights(), this.pool.clear(), this.ack(i.id, 0, "scene_reset");
7244
+ this.appController.resetAllModels(), this.appController.clearAlarmHighlights(), this.pool.clear(), this.ack(s.id, 0, "scene_reset");
7235
7245
  break;
7236
7246
  case "command_ack":
7237
- P.info("收到 command_ack(画布不应接收), envelope_id=%s", s?.envelope_id);
7247
+ P.info("收到 command_ack(画布不应接收), envelope_id=%s", o?.envelope_id);
7238
7248
  break;
7239
7249
  case "alarm_push":
7240
- this.handleAlarmPush(s), this.onRaw?.(t);
7250
+ this.handleAlarmPush(o), this.onRaw?.(i);
7241
7251
  break;
7242
7252
  case "runtime_status_push":
7243
- this.onRaw?.(t);
7253
+ this.onRaw?.(i);
7244
7254
  break;
7245
7255
  default:
7246
- P.warn("未识别的 envelope.type=%s,丢弃", i.type), this.ack(i.id, 400, `未知消息类型: ${i.type}`);
7256
+ P.warn("未识别的 envelope.type=%s,丢弃", s.type), this.ack(s.id, 400, `未知消息类型: ${s.type}`);
7247
7257
  }
7248
7258
  }
7249
7259
  /* ========== device_command ========== */
@@ -7280,132 +7290,138 @@ class jo {
7280
7290
  return e.x !== void 0 && (i.x = s(e.x, "width"), i.rawX = e.x), e.y !== void 0 && (i.y = s(e.y, "height")), e.z !== void 0 && (i.z = s(e.z, "height")), e.j1 !== void 0 && (i.j1 = e.j1), e.j2 !== void 0 && (i.j2 = e.j2), e.fork_xy !== void 0 && (i.fork_xy = e.fork_xy), e.fork_z !== void 0 && (i.fork_z = e.fork_z), Object.keys(i).length > 0 ? i : void 0;
7281
7291
  }
7282
7292
  /* ========== device_init(全量覆盖语义,见文档第七章) ========== */
7283
- handleDeviceInit(e, t) {
7293
+ handleDeviceInit(e, t, i) {
7284
7294
  if (!t || !Array.isArray(t.devices)) {
7285
7295
  this.ack(e, 400, "device_init 缺少 devices 数组");
7286
7296
  return;
7287
7297
  }
7288
- let i = 0;
7289
- for (const s of t.devices) {
7290
- const o = Ie[s.device_type];
7291
- if (!o) {
7292
- P.warn("device_init 未知设备类型: %s,跳过", s.device_type);
7298
+ let s = 0;
7299
+ for (const o of t.devices) {
7300
+ const n = Ie[o.device_type];
7301
+ if (!n) {
7302
+ P.warn("device_init 未知设备类型: %s,跳过", o.device_type);
7293
7303
  continue;
7294
7304
  }
7295
- if (!this.appController.resetModel(o, s.device_id, s.device_station) && !this.appController.hasDevice(o, s.device_id)) {
7296
- P.warn("device_init 设备未匹配到: %s/%s,跳过", s.device_type, s.device_id);
7305
+ if (!this.appController.resetModel(n, o.device_id, o.device_station) && !this.appController.hasDevice(n, o.device_id)) {
7306
+ P.warn("device_init 设备未匹配到: %s/%s,跳过", o.device_type, o.device_id);
7297
7307
  continue;
7298
7308
  }
7299
- i++;
7300
- const a = this.buildDeviceOperating(s);
7301
- if (a && this.appController.operating(a), this.pool.removeByDevice(s.device_id), Array.isArray(s.resources))
7302
- for (const l of s.resources) {
7303
- const c = {
7304
- device_type: s.device_type,
7305
- device_id: s.device_id,
7306
- device_layer: l.device_layer,
7307
- device_station: l.device_station
7308
- }, h = this.resolvePlacement(c, l.resource_type);
7309
- if (h.code !== 0) {
7310
- P.warn("device_init 资源 %s 放置失败(code=%d): %s", l.resource_id, h.code, h.message);
7309
+ s++;
7310
+ const l = this.buildDeviceOperating(o);
7311
+ if (l && this.appController.operating(l), this.pool.removeByDevice(o.device_id), Array.isArray(o.resources))
7312
+ for (const c of o.resources) {
7313
+ const h = {
7314
+ device_type: o.device_type,
7315
+ device_id: o.device_id,
7316
+ device_layer: c.device_layer,
7317
+ device_station: c.device_station
7318
+ }, d = this.resolvePlacement(h, c.resource_type);
7319
+ if (d.code !== 0) {
7320
+ P.warn("device_init 资源 %s 放置失败(code=%d): %s", c.resource_id, d.code, d.message);
7311
7321
  continue;
7312
7322
  }
7313
- const A = this.toResolvedLocation(c, h);
7323
+ const A = this.toResolvedLocation(h, d);
7314
7324
  this.pool.add({
7315
- resource_id: l.resource_id,
7316
- resource_type: l.resource_type,
7317
- resource_name: l.resource_name,
7318
- resource_state: l.resource_state,
7319
- resource_color: Ee(l),
7325
+ resource_id: c.resource_id,
7326
+ resource_type: c.resource_type,
7327
+ resource_name: c.resource_name,
7328
+ resource_state: c.resource_state,
7329
+ resource_color: Ee(c),
7320
7330
  to: A
7321
- }), this.placeResource("add", A, l.resource_id, l.resource_type, l.resource_name, Ee(l));
7331
+ }), this.placeResource("add", A, c.resource_id, c.resource_type, c.resource_name, Ee(c), i);
7322
7332
  }
7323
7333
  }
7324
- this.ack(e, 0, `device_init: ${i}/${t.devices.length} 台设备已初始化`);
7334
+ this.ack(e, 0, `device_init: ${s}/${t.devices.length} 台设备已初始化`);
7325
7335
  }
7326
7336
  /* ========== resource_command(见文档第八章) ========== */
7327
- handleResourceCommand(e, t) {
7337
+ handleResourceCommand(e, t, i) {
7328
7338
  if (!t || typeof t != "object" || !t.operation) {
7329
7339
  this.ack(e, 400, "resource_command 缺少 operation");
7330
7340
  return;
7331
7341
  }
7332
7342
  switch (t.operation) {
7333
7343
  case "add": {
7334
- const i = this.resolvePlacement(t.to, t.resource_type);
7335
- if (i.code !== 0) {
7336
- this.ack(e, i.code, i.message);
7344
+ const s = this.resolvePlacement(t.to, t.resource_type);
7345
+ if (s.code !== 0) {
7346
+ this.ack(e, s.code, s.message);
7337
7347
  return;
7338
7348
  }
7339
- const s = this.toResolvedLocation(t.to, i);
7349
+ const o = this.toResolvedLocation(t.to, s);
7340
7350
  this.pool.add({
7341
7351
  resource_id: t.resource_id,
7342
7352
  resource_type: t.resource_type,
7343
7353
  resource_name: t.resource_name,
7344
7354
  resource_state: t.resource_state,
7345
7355
  resource_color: Ee(t),
7346
- to: s
7356
+ to: o
7347
7357
  }), this.placeResource(
7348
7358
  "add",
7349
- s,
7359
+ o,
7350
7360
  t.resource_id,
7351
7361
  t.resource_type,
7352
7362
  t.resource_name,
7353
- Ee(t)
7363
+ Ee(t),
7364
+ i
7354
7365
  ), this.ack(e, 0);
7355
7366
  break;
7356
7367
  }
7357
7368
  case "batch_add": {
7358
- const i = Array.isArray(t.resources) ? t.resources : [];
7359
- let s = 0;
7360
- for (const o of i) {
7361
- const n = this.resolvePlacement(o.to, o.resource_type);
7362
- if (n.code !== 0) {
7363
- P.warn("batch_add 资源 %s 放置失败(code=%d): %s", o.resource_id, n.code, n.message);
7369
+ const s = Array.isArray(t.resources) ? t.resources : [];
7370
+ let o = 0;
7371
+ for (const n of s) {
7372
+ const a = this.resolvePlacement(n.to, n.resource_type);
7373
+ if (a.code !== 0) {
7374
+ P.warn("batch_add 资源 %s 放置失败(code=%d): %s", n.resource_id, a.code, a.message);
7364
7375
  continue;
7365
7376
  }
7366
- const a = this.toResolvedLocation(o.to, n);
7367
- this.pool.add({ ...o, resource_color: Ee(o), to: a }), this.placeResource("add", a, o.resource_id, o.resource_type, o.resource_name, Ee(o)), s++;
7377
+ const l = this.toResolvedLocation(n.to, a);
7378
+ this.pool.add({ ...n, resource_color: Ee(n), to: l }), this.placeResource("add", l, n.resource_id, n.resource_type, n.resource_name, Ee(n), i), o++;
7368
7379
  }
7369
- this.ack(e, s > 0 ? 0 : 404, `batch_add: ${s}/${i.length} 项成功`);
7380
+ this.ack(e, o > 0 ? 0 : 404, `batch_add: ${o}/${s.length} 项成功`);
7370
7381
  break;
7371
7382
  }
7372
7383
  case "transfer": {
7373
- const i = this.pool.get(t.resource_id), o = !!t.from && !!t.from.device_id ? this.resolveSourceLocation(t.from, t.resource_type) : i?.location || null, n = this.resolvePlacement(t.to, t.resource_type);
7374
- if (n.code !== 0) {
7375
- this.ack(e, n.code, n.message);
7384
+ const s = this.pool.get(t.resource_id), n = !!t.from && !!t.from.device_id ? this.resolveSourceLocation(t.from, t.resource_type) : s?.location || null, a = this.resolvePlacement(t.to, t.resource_type);
7385
+ if (a.code !== 0) {
7386
+ this.ack(e, a.code, a.message);
7376
7387
  return;
7377
7388
  }
7378
- const a = this.toResolvedLocation(t.to, n), l = i?.resource_name ?? t.resource_name, c = i?.resource_color ?? Ee(t);
7379
- if (!o) {
7389
+ const l = this.toResolvedLocation(t.to, a), c = t.resource_name ?? s?.resource_name, h = Ee(t) ?? s?.resource_color;
7390
+ if (!n) {
7380
7391
  this.pool.add({
7381
7392
  resource_id: t.resource_id,
7382
7393
  resource_type: t.resource_type,
7383
- resource_name: l,
7394
+ resource_name: c,
7384
7395
  resource_state: t.resource_state,
7385
- resource_color: c,
7386
- to: a
7387
- }), this.placeResource("add", a, t.resource_id, t.resource_type, l, c), this.ack(e, 0);
7396
+ resource_color: h,
7397
+ to: l
7398
+ }), this.placeResource("add", l, t.resource_id, t.resource_type, c, h, i), this.ack(e, 0);
7388
7399
  return;
7389
7400
  }
7390
- i ? this.pool.updateLocation(t.resource_id, a) : this.pool.add({
7401
+ s ? this.pool.update(t.resource_id, {
7402
+ resource_state: t.resource_state,
7403
+ resource_color: h,
7404
+ location: l
7405
+ }) : this.pool.add({
7391
7406
  resource_id: t.resource_id,
7392
7407
  resource_type: t.resource_type,
7393
- resource_name: l,
7408
+ resource_name: c,
7394
7409
  resource_state: t.resource_state,
7395
- resource_color: c,
7396
- to: a
7397
- }), this.placeResource("remove", o, t.resource_id, t.resource_type, l, c), this.placeResource("add", a, t.resource_id, t.resource_type, l, c), this.ack(e, 0);
7410
+ resource_color: h,
7411
+ to: l
7412
+ }), this.placeResource("remove", n, t.resource_id, t.resource_type, c, h, i), this.placeResource("add", l, t.resource_id, t.resource_type, c, h, i), this.ack(e, 0);
7398
7413
  break;
7399
7414
  }
7400
7415
  case "remove": {
7401
- const i = this.pool.remove(t.resource_id), s = i?.location;
7402
- s ? this.placeResource(
7416
+ const s = this.pool.remove(t.resource_id), o = s?.location;
7417
+ o ? this.placeResource(
7403
7418
  "remove",
7404
- s,
7419
+ o,
7405
7420
  t.resource_id,
7406
- t.resource_type ?? i.resource_type,
7407
- i.resource_name,
7408
- i.resource_color
7421
+ t.resource_type ?? s.resource_type,
7422
+ s.resource_name,
7423
+ s.resource_color,
7424
+ i
7409
7425
  ) : this.appController.operating({
7410
7426
  operatingType: "resource",
7411
7427
  handleType: "batchRemove",
@@ -7415,48 +7431,49 @@ class jo {
7415
7431
  break;
7416
7432
  }
7417
7433
  case "batch_remove": {
7418
- const i = Array.isArray(t.resource_ids) ? t.resource_ids : [], s = t.resource_type, o = [], n = /* @__PURE__ */ new Map();
7419
- let a = 0;
7420
- for (const c of i) {
7421
- const h = this.pool.get(c);
7422
- if (s && h && h.resource_type !== s) {
7423
- n.set(c, h.resource_type);
7434
+ const s = Array.isArray(t.resource_ids) ? t.resource_ids : [], o = t.resource_type, n = [], a = /* @__PURE__ */ new Map();
7435
+ let l = 0;
7436
+ for (const h of s) {
7437
+ const d = this.pool.get(h);
7438
+ if (o && d && d.resource_type !== o) {
7439
+ a.set(h, d.resource_type);
7424
7440
  continue;
7425
7441
  }
7426
- o.push(c);
7427
- const A = this.pool.remove(c);
7442
+ n.push(h);
7443
+ const A = this.pool.remove(h);
7428
7444
  A?.location && (this.placeResource(
7429
7445
  "remove",
7430
7446
  A.location,
7431
- c,
7432
- s ?? A.resource_type,
7447
+ h,
7448
+ o ?? A.resource_type,
7433
7449
  A.resource_name,
7434
- A.resource_color
7435
- ), a++);
7450
+ A.resource_color,
7451
+ i
7452
+ ), l++);
7436
7453
  }
7437
- if (n.size > 0) {
7438
- const c = [...n.entries()].map(([h, A]) => `${h}[${A}]`).join(", ");
7454
+ if (a.size > 0) {
7455
+ const h = [...a.entries()].map(([d, A]) => `${d}[${A}]`).join(", ");
7439
7456
  P.warn(
7440
7457
  "SocketDispatcher: batch_remove resource_type 过滤 type=%o → 跳过 %d 项: %s",
7441
- s,
7442
- n.size,
7443
- c
7458
+ o,
7459
+ a.size,
7460
+ h
7444
7461
  );
7445
7462
  }
7446
7463
  P.info(
7447
7464
  "SocketDispatcher: batch_remove ids=%o filterType=%o → idsToRemove=%o removed=%d",
7448
- i,
7449
7465
  s,
7450
7466
  o,
7451
- a
7452
- ), o.length > 0 && this.appController.operating({
7467
+ n,
7468
+ l
7469
+ ), n.length > 0 && this.appController.operating({
7453
7470
  operatingType: "resource",
7454
7471
  handleType: "batchRemove",
7455
- resourceIds: o,
7472
+ resourceIds: n,
7456
7473
  raw_data: {}
7457
7474
  });
7458
- const l = n.size > 0 ? `,跳过 ${n.size} 项类型不匹配 (${[...n.keys()].join(",")})` : "";
7459
- this.ack(e, 0, `batch_remove: ${a}/${i.length} 项成功${l}`);
7475
+ const c = a.size > 0 ? `,跳过 ${a.size} 项类型不匹配 (${[...a.keys()].join(",")})` : "";
7476
+ this.ack(e, 0, `batch_remove: ${l}/${s.length} 项成功${c}`);
7460
7477
  break;
7461
7478
  }
7462
7479
  default:
@@ -7551,31 +7568,25 @@ class jo {
7551
7568
  };
7552
7569
  }
7553
7570
  /** 将资源实体放置/移除到目标工位(device_type + device_id + layer + device_station 定位) */
7554
- placeResource(e, t, i, s, o, n) {
7571
+ placeResource(e, t, i, s, o, n, a) {
7555
7572
  if (!t || !t.device_id) {
7556
7573
  P.warn(`placeResource 缺少 device_id,跳过 ${e} 执行`);
7557
7574
  return;
7558
7575
  }
7559
- const a = t.device_type ? Ie[t.device_type] : void 0;
7560
- if (!a) {
7576
+ const l = t.device_type ? Ie[t.device_type] : void 0;
7577
+ if (!l) {
7561
7578
  P.warn("placeResource 缺少/未知 device_type,无法定位设备:", t);
7562
7579
  return;
7563
7580
  }
7564
- const l = {
7581
+ const c = {
7565
7582
  id: String(i),
7566
- resource_type: s,
7567
- resource_name: o ?? "",
7568
- resource_color: n ?? "",
7569
- device_type: t.device_type ?? "",
7570
- device_id: t.device_id,
7571
- device_station: t.device_station ?? 1,
7572
- device_layer: t.device_layer
7583
+ ...a !== void 0 ? { socket: a } : {}
7573
7584
  };
7574
7585
  this.appController.operating({
7575
7586
  operatingType: "model",
7576
- className: a,
7587
+ className: l,
7577
7588
  id: t.device_id,
7578
- raw_data: l,
7589
+ raw_data: c,
7579
7590
  resource: {
7580
7591
  handle_type: e,
7581
7592
  resource_type: s,
@@ -7584,7 +7595,7 @@ class jo {
7584
7595
  resource_color: n,
7585
7596
  device_station: t.device_station ?? 1,
7586
7597
  device_layer: t.device_layer,
7587
- raw_data: l
7598
+ raw_data: c
7588
7599
  }
7589
7600
  });
7590
7601
  }
@@ -7654,13 +7665,13 @@ const pe = z("AppStore"), pr = qe("@jnrs/lingshu-smart/app", () => {
7654
7665
  () => e.fpsMode,
7655
7666
  (g) => h(g)
7656
7667
  );
7657
- const A = () => {
7668
+ const d = () => {
7658
7669
  if (!i) {
7659
7670
  pe.warn("resizeContainer failed: AppController not initialized");
7660
7671
  return;
7661
7672
  }
7662
7673
  i.setZoom();
7663
- }, d = () => {
7674
+ }, A = () => {
7664
7675
  if (!i) {
7665
7676
  pe.warn("destroyContainer failed: AppController not initialized");
7666
7677
  return;
@@ -7678,12 +7689,12 @@ const pe = z("AppStore"), pr = qe("@jnrs/lingshu-smart/app", () => {
7678
7689
  i.operating(g);
7679
7690
  }, f = (g) => {
7680
7691
  o = g;
7681
- }, p = (g) => {
7692
+ }, p = (g, m) => {
7682
7693
  if (!s) {
7683
7694
  pe.warn("feedSocketMessage failed: SocketDispatcher not initialized");
7684
7695
  return;
7685
7696
  }
7686
- s.dispatch(g);
7697
+ s.dispatch(g, m);
7687
7698
  }, C = () => {
7688
7699
  if (!i) {
7689
7700
  pe.warn("resetModels failed: AppController not initialized"), st.warning("画布未初始化,无法复位");
@@ -7695,8 +7706,8 @@ const pe = z("AppStore"), pr = qe("@jnrs/lingshu-smart/app", () => {
7695
7706
  return {
7696
7707
  currentCase: t,
7697
7708
  initContainer: a,
7698
- resizeContainer: A,
7699
- destroyContainer: d,
7709
+ resizeContainer: d,
7710
+ destroyContainer: A,
7700
7711
  operating: u,
7701
7712
  feedSocketMessage: p,
7702
7713
  setSocketHandlers: f,
@@ -7730,7 +7741,7 @@ export {
7730
7741
  fr as a,
7731
7742
  pr as b,
7732
7743
  Qi as c,
7733
- ke as d,
7744
+ Ue as d,
7734
7745
  Li as e,
7735
7746
  Fi as f,
7736
7747
  Co as g,
@@ -7739,13 +7750,13 @@ export {
7739
7750
  Io as j,
7740
7751
  bo as k,
7741
7752
  or as l,
7742
- Pe as m,
7753
+ We as m,
7743
7754
  yt as n,
7744
7755
  wt as o,
7745
7756
  _e as p,
7746
7757
  mt as q,
7747
7758
  ge as r,
7748
- He as s,
7759
+ Oe as s,
7749
7760
  nr as t,
7750
7761
  vt as u,
7751
7762
  pt as v,