seeder-st2110-components 1.5.9 → 1.6.0

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/dist/index.js CHANGED
@@ -96,12 +96,12 @@ const UsageItem = /*#__PURE__*/react.memo(_ref => {
96
96
  })]
97
97
  }),
98
98
  destroyOnHidden: false,
99
- children: /*#__PURE__*/jsxRuntime.jsxs(antd.Space, {
100
- size: 4,
99
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
100
+ className: "usage-item",
101
101
  children: [/*#__PURE__*/jsxRuntime.jsx("i", {
102
102
  className: "seeder-iconfont ".concat(iconClass, " text-xl")
103
103
  }), /*#__PURE__*/jsxRuntime.jsx("span", {
104
- className: "inline-block w-10 text-center",
104
+ className: "usage-value",
105
105
  children: children
106
106
  })]
107
107
  })
@@ -238,17 +238,15 @@ const useHardwareUsage = socketUrl => {
238
238
  if (!ps_status || typeof ps_status !== 'object') return null;
239
239
  const statusItems = getItems(getDetail(ps_status));
240
240
  return /*#__PURE__*/jsxRuntime.jsx("div", {
241
- className: "flex",
242
- children: statusItems.map((item, index) => /*#__PURE__*/jsxRuntime.jsxs(antd.Flex, {
243
- align: "center",
244
- children: [/*#__PURE__*/jsxRuntime.jsx(UsageItem$1, {
241
+ className: "usage-container",
242
+ children: statusItems.map((item, index) => /*#__PURE__*/jsxRuntime.jsx("div", {
243
+ className: "usage-item-wrapper",
244
+ children: /*#__PURE__*/jsxRuntime.jsx(UsageItem$1, {
245
245
  title: item.title,
246
246
  iconClass: item.iconClass,
247
247
  memTotal: item.memTotal,
248
248
  children: item.valueString
249
- }), index < statusItems.length - 1 && /*#__PURE__*/jsxRuntime.jsx(antd.Divider, {
250
- type: "vertical"
251
- })]
249
+ })
252
250
  }, item.title))
253
251
  });
254
252
  }, [ps_status]);
@@ -712,7 +710,7 @@ const useUpgrade = _ref => {
712
710
  children: /*#__PURE__*/jsxRuntime.jsx("a", {
713
711
  onClick: e => e.preventDefault(),
714
712
  children: /*#__PURE__*/jsxRuntime.jsx("i", {
715
- className: "seeder-iconfont seeder-icon-liebiao2 text-2xl text-neutral-400"
713
+ className: "seeder-iconfont seeder-icon-liebiao2 text-xl text-neutral-400"
716
714
  })
717
715
  })
718
716
  }), /*#__PURE__*/jsxRuntime.jsx("input", {
@@ -794,185 +792,1308 @@ const useSystemOperations = function () {
794
792
  };
795
793
  var useSystemOperations$1 = useSystemOperations;
796
794
 
797
- const _excluded = ["menuItems", "onMenuClick", "downloadFiles", "upgradeExecute", "upgradeStatus", "acceptFileTypes", "uploadCompleteDelay", "statusPollingInterval", "children"];
798
- const UpgradeManager = _ref => {
795
+ const NetworkFieldGroup = _ref => {
796
+ var _fieldConfig$netmask$, _fieldConfig$netmask;
799
797
  let {
800
- menuItems = [],
801
- onMenuClick,
802
- downloadFiles,
803
- upgradeExecute,
804
- upgradeStatus,
805
- acceptFileTypes = "application/octet-stream",
806
- uploadCompleteDelay = 3000,
807
- statusPollingInterval = 1000,
808
- children
809
- } = _ref,
810
- dropdownProps = _objectWithoutProperties(_ref, _excluded);
811
- const [upgradeElement] = useUpgrade$1({
812
- menuItems,
813
- onMenuClick,
814
- downloadFiles,
815
- upgradeExecute,
816
- upgradeStatus,
817
- acceptFileTypes,
818
- uploadCompleteDelay,
819
- statusPollingInterval
798
+ prefix,
799
+ interfaces,
800
+ fieldConfig = {}
801
+ } = _ref;
802
+ // 默认字段配置
803
+ const defaultFieldConfig = {
804
+ name: {
805
+ label: "Name",
806
+ enabled: true
807
+ },
808
+ ip: {
809
+ label: "IP Address",
810
+ enabled: true
811
+ },
812
+ netmask: {
813
+ label: "Netmask",
814
+ enabled: true
815
+ }
816
+ };
817
+ const mergedFieldConfig = _objectSpread2(_objectSpread2(_objectSpread2({}, defaultFieldConfig), fieldConfig), {}, {
818
+ netmask: {
819
+ label: "Netmask",
820
+ enabled: (_fieldConfig$netmask$ = (_fieldConfig$netmask = fieldConfig.netmask) === null || _fieldConfig$netmask === void 0 ? void 0 : _fieldConfig$netmask.enabled) !== null && _fieldConfig$netmask$ !== void 0 ? _fieldConfig$netmask$ : defaultFieldConfig.netmask.enabled // 合并 enabled
821
+ }
822
+ });
823
+ return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
824
+ children: [/*#__PURE__*/jsxRuntime.jsx(antd.Typography.Title, {
825
+ level: 5,
826
+ style: {
827
+ display: 'flex',
828
+ justifyContent: 'space-between',
829
+ alignItems: 'center',
830
+ marginBottom: 16
831
+ },
832
+ children: prefix
833
+ }), interfaces.map((iface, index) => /*#__PURE__*/jsxRuntime.jsxs("div", {
834
+ children: [mergedFieldConfig.name.enabled && /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
835
+ label: mergedFieldConfig.name.label,
836
+ name: [prefix, index, "display_name"],
837
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Input, {
838
+ disabled: true
839
+ })
840
+ }), mergedFieldConfig.ip.enabled && /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
841
+ label: mergedFieldConfig.ip.label,
842
+ name: [prefix, index, "ip_address"],
843
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Input, {})
844
+ }), mergedFieldConfig.netmask.enabled && /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
845
+ label: mergedFieldConfig.netmask.label,
846
+ name: [prefix, index, "netmask"],
847
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Input, {})
848
+ }), index < interfaces.length - 1 && /*#__PURE__*/jsxRuntime.jsx(antd.Divider, {
849
+ style: {
850
+ marginBlock: 16
851
+ }
852
+ })]
853
+ }, iface.id || index))]
820
854
  });
821
- if (children) {
822
- // 提取Dropdown组件和其menu属性
823
- const dropdownElement = upgradeElement.props.children[0];
824
- const otherElements = upgradeElement.props.children.slice(1);
825
- return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
826
- children: [/*#__PURE__*/jsxRuntime.jsx(antd.Dropdown, _objectSpread2(_objectSpread2(_objectSpread2({}, dropdownProps), dropdownElement.props), {}, {
827
- children: children
828
- })), otherElements]
829
- });
830
- }
831
-
832
- // 如果没有children,直接返回完整的升级元素
833
- return upgradeElement;
834
- };
835
- UpgradeManager.defaultProps = {
836
- trigger: ["hover"],
837
- placement: "bottomRight"
838
855
  };
839
- var UpgradeManager$1 = UpgradeManager;
840
-
841
- function getDefaultExportFromCjs (x) {
842
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
843
- }
844
-
845
- var propTypes = {exports: {}};
846
-
847
- var reactIs = {exports: {}};
856
+ const NetworkSettingsModal = _ref2 => {
857
+ let {
858
+ open,
859
+ onClose,
860
+ getLanConfig,
861
+ // 可选 - 单独获取LAN配置的函数
862
+ getSysConfig,
863
+ // 可选 - 单独获取QSFP配置的函数
864
+ getConfig,
865
+ // 可选 - 统一获取配置的函数
866
+ updateLanConfig,
867
+ updateSysConfig,
868
+ restart,
869
+ modalProps = {},
870
+ formProps = {},
871
+ fieldConfig = {},
872
+ sections = ['LAN', 'QSFP'],
873
+ showNetmask = {
874
+ LAN: true,
875
+ QSFP: false
876
+ },
877
+ restartRemark
878
+ } = _ref2;
879
+ const {
880
+ message,
881
+ modal
882
+ } = antd.App.useApp();
883
+ const [form] = antd.Form.useForm();
884
+ const [st2110Interfaces, setSt2110Interfaces] = react.useState([]);
885
+ const [lanConfigs, setLanConfigs] = react.useState([]);
886
+ const [submitLoading, setSubmitLoading] = react.useState(false);
887
+ const [isInitialized, setIsInitialized] = react.useState(false);
888
+ const initializationStatus = react.useRef({
889
+ hasFetched: false,
890
+ hasInitialized: false
891
+ });
892
+ const preparedFieldConfig = react.useMemo(() => {
893
+ const config = _objectSpread2({}, fieldConfig);
848
894
 
849
- var reactIs_production_min = {};
895
+ // 确保LAN和QSFP的配置存在
896
+ config.LAN = config.LAN || {};
897
+ config.QSFP = config.QSFP || {};
898
+ if (sections.includes('LAN')) {
899
+ config.LAN.netmask = _objectSpread2(_objectSpread2({}, config.LAN.netmask || {}), {}, {
900
+ enabled: showNetmask.LAN
901
+ });
902
+ }
903
+ if (sections.includes('QSFP')) {
904
+ config.QSFP.netmask = _objectSpread2(_objectSpread2({}, config.QSFP.netmask || {}), {}, {
905
+ enabled: showNetmask.QSFP
906
+ });
907
+ }
908
+ return config;
909
+ }, [fieldConfig, showNetmask, sections]);
910
+ react.useEffect(() => {
911
+ if (!open) return;
912
+ const fetchData = async () => {
913
+ if (initializationStatus.current.hasFetched) return;
914
+ try {
915
+ initializationStatus.current.hasFetched = true;
916
+ if (getConfig) {
917
+ // 使用统一接口获取数据
918
+ const config = await getConfig();
919
+ if (sections.includes('LAN') && config.lan_interfaces) {
920
+ setLanConfigs(config.lan_interfaces);
921
+ }
922
+ if (sections.includes('QSFP') && config.interfaces) {
923
+ setSt2110Interfaces(config.interfaces);
924
+ }
925
+ } else {
926
+ const promises = [];
927
+ if (sections.includes('LAN')) {
928
+ promises.push(getLanConfig());
929
+ }
930
+ if (sections.includes('QSFP')) {
931
+ promises.push(getSysConfig());
932
+ }
933
+ const results = await Promise.allSettled(promises);
934
+ if (sections.includes('LAN') && getLanConfig) {
935
+ const lanResult = results[0];
936
+ if (lanResult.status === 'fulfilled') {
937
+ setLanConfigs(lanResult.value || []);
938
+ }
939
+ }
940
+ if (sections.includes('QSFP') && getSysConfig) {
941
+ const sysResult = sections.includes('LAN') ? results[1] : results[0];
942
+ if (sysResult.status === 'fulfilled' && sysResult.value) {
943
+ setSt2110Interfaces(sysResult.value.st2110_interfaces || []);
944
+ }
945
+ }
946
+ }
947
+ setIsInitialized(true);
948
+ } catch (error) {
949
+ console.error('Failed to fetch data:', error);
950
+ initializationStatus.current.hasFetched = false; // 出错时重置
951
+ }
952
+ };
953
+ fetchData();
954
+ }, [open, getLanConfig, getSysConfig, sections]);
850
955
 
851
- /** @license React v16.13.1
852
- * react-is.production.min.js
853
- *
854
- * Copyright (c) Facebook, Inc. and its affiliates.
855
- *
856
- * This source code is licensed under the MIT license found in the
857
- * LICENSE file in the root directory of this source tree.
858
- */
956
+ // 当模态框关闭时重置状态
957
+ react.useEffect(() => {
958
+ if (!open) {
959
+ setIsInitialized(false);
960
+ setLanConfigs([]);
961
+ setSt2110Interfaces([]);
962
+ form.resetFields();
963
+ initializationStatus.current = {
964
+ hasFetched: false,
965
+ hasInitialized: false
966
+ };
967
+ }
968
+ }, [open, form]);
859
969
 
860
- var hasRequiredReactIs_production_min;
970
+ // 动态初始值配置
971
+ const initialValues = react.useMemo(() => {
972
+ const values = {};
973
+ if (sections.includes('LAN') && lanConfigs.length > 0) {
974
+ values.LAN = lanConfigs.map(config => _objectSpread2({
975
+ connection_id: config.connection_id,
976
+ display_name: config.display_name,
977
+ ip_address: config.ip_address
978
+ }, showNetmask.LAN ? {
979
+ netmask: config.netmask
980
+ } : {}));
981
+ }
982
+ if (sections.includes('QSFP') && st2110Interfaces.length > 0) {
983
+ values.QSFP = st2110Interfaces.map(iface => _objectSpread2(_objectSpread2({}, iface.id !== undefined && {
984
+ id: iface.id
985
+ }), {}, {
986
+ display_name: iface.display_name,
987
+ ip_address: iface.ip_address || iface.ip
988
+ }, showNetmask.QSFP ? {
989
+ netmask: iface.netmask
990
+ } : {}));
991
+ }
992
+ return values;
993
+ }, [lanConfigs, st2110Interfaces, sections, showNetmask]);
861
994
 
862
- function requireReactIs_production_min () {
863
- if (hasRequiredReactIs_production_min) return reactIs_production_min;
864
- hasRequiredReactIs_production_min = 1;
865
- var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?
866
- Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
867
- function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}reactIs_production_min.AsyncMode=l;reactIs_production_min.ConcurrentMode=m;reactIs_production_min.ContextConsumer=k;reactIs_production_min.ContextProvider=h;reactIs_production_min.Element=c;reactIs_production_min.ForwardRef=n;reactIs_production_min.Fragment=e;reactIs_production_min.Lazy=t;reactIs_production_min.Memo=r;reactIs_production_min.Portal=d;
868
- reactIs_production_min.Profiler=g;reactIs_production_min.StrictMode=f;reactIs_production_min.Suspense=p;reactIs_production_min.isAsyncMode=function(a){return A(a)||z(a)===l};reactIs_production_min.isConcurrentMode=A;reactIs_production_min.isContextConsumer=function(a){return z(a)===k};reactIs_production_min.isContextProvider=function(a){return z(a)===h};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};reactIs_production_min.isForwardRef=function(a){return z(a)===n};reactIs_production_min.isFragment=function(a){return z(a)===e};reactIs_production_min.isLazy=function(a){return z(a)===t};
869
- reactIs_production_min.isMemo=function(a){return z(a)===r};reactIs_production_min.isPortal=function(a){return z(a)===d};reactIs_production_min.isProfiler=function(a){return z(a)===g};reactIs_production_min.isStrictMode=function(a){return z(a)===f};reactIs_production_min.isSuspense=function(a){return z(a)===p};
870
- reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};reactIs_production_min.typeOf=z;
871
- return reactIs_production_min;
872
- }
873
-
874
- var reactIs_development = {};
875
-
876
- /** @license React v16.13.1
877
- * react-is.development.js
878
- *
879
- * Copyright (c) Facebook, Inc. and its affiliates.
880
- *
881
- * This source code is licensed under the MIT license found in the
882
- * LICENSE file in the root directory of this source tree.
883
- */
884
-
885
- var hasRequiredReactIs_development;
886
-
887
- function requireReactIs_development () {
888
- if (hasRequiredReactIs_development) return reactIs_development;
889
- hasRequiredReactIs_development = 1;
890
-
891
-
892
-
893
- if (process.env.NODE_ENV !== "production") {
894
- (function() {
895
-
896
- // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
897
- // nor polyfill, then a plain number is used for performance.
898
- var hasSymbol = typeof Symbol === 'function' && Symbol.for;
899
- var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
900
- var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
901
- var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
902
- var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
903
- var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
904
- var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
905
- var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
906
- // (unstable) APIs that have been removed. Can we remove the symbols?
907
-
908
- var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
909
- var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
910
- var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
911
- var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
912
- var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
913
- var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
914
- var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
915
- var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
916
- var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
917
- var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
918
- var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
919
-
920
- function isValidElementType(type) {
921
- return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
922
- type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
923
- }
924
-
925
- function typeOf(object) {
926
- if (typeof object === 'object' && object !== null) {
927
- var $$typeof = object.$$typeof;
928
-
929
- switch ($$typeof) {
930
- case REACT_ELEMENT_TYPE:
931
- var type = object.type;
995
+ // 当初始值准备好后设置表单值
996
+ react.useEffect(() => {
997
+ if (isInitialized && !initializationStatus.current.hasInitialized) {
998
+ form.setFieldsValue(initialValues);
999
+ initializationStatus.current.hasInitialized = true;
1000
+ }
1001
+ }, [isInitialized, form, initialValues]);
1002
+ const handleSuccess = react.useCallback(async function () {
1003
+ let {
1004
+ messageText = 'Success',
1005
+ isPopup = !!restart,
1006
+ refresh = !restart
1007
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1008
+ message.success(messageText);
1009
+ if (refresh && getConfig) {
1010
+ try {
1011
+ const newConfig = await getConfig();
1012
+ if (sections.includes('LAN') && newConfig.lan_interfaces) {
1013
+ setLanConfigs(newConfig.lan_interfaces);
1014
+ }
1015
+ if (sections.includes('QSFP') && newConfig.interfaces) {
1016
+ setSt2110Interfaces(newConfig.interfaces);
1017
+ }
1018
+ } catch (error) {
1019
+ console.error('Failed to refresh config:', error);
1020
+ }
1021
+ }
932
1022
 
933
- switch (type) {
934
- case REACT_ASYNC_MODE_TYPE:
935
- case REACT_CONCURRENT_MODE_TYPE:
936
- case REACT_FRAGMENT_TYPE:
937
- case REACT_PROFILER_TYPE:
938
- case REACT_STRICT_MODE_TYPE:
939
- case REACT_SUSPENSE_TYPE:
940
- return type;
1023
+ // 如果有restart函数,则显示重启确认框
1024
+ if (isPopup && restart) {
1025
+ try {
1026
+ const updatedConfig = await getSysConfig();
1027
+ if (updatedConfig && updatedConfig.is_restart_required) {
1028
+ modal.confirm({
1029
+ icon: /*#__PURE__*/jsxRuntime.jsx(icons.ExclamationCircleFilled, {}),
1030
+ title: "Configuration modified. Restart to apply changes?",
1031
+ cancelText: "No",
1032
+ okText: "Yes",
1033
+ onOk: () => restart()
1034
+ });
1035
+ }
1036
+ } catch (error) {
1037
+ console.error('Failed to check restart status:', error);
1038
+ }
1039
+ }
1040
+ onClose();
1041
+ }, [message, modal, getSysConfig, restart, getConfig, sections, onClose]);
1042
+ const handleSubmit = react.useCallback(async () => {
1043
+ setSubmitLoading(true);
1044
+ try {
1045
+ const values = await form.validateFields();
1046
+ // console.log("Direct form values:", values);
941
1047
 
942
- default:
943
- var $$typeofType = type && type.$$typeof;
1048
+ const updatePromises = [];
944
1049
 
945
- switch ($$typeofType) {
946
- case REACT_CONTEXT_TYPE:
947
- case REACT_FORWARD_REF_TYPE:
948
- case REACT_LAZY_TYPE:
949
- case REACT_MEMO_TYPE:
950
- case REACT_PROVIDER_TYPE:
951
- return $$typeofType;
1050
+ // 更新LAN配置
1051
+ if (sections.includes('LAN') && values.LAN) {
1052
+ const lanData = values.LAN.map((item, index) => {
1053
+ var _lanConfigs$index;
1054
+ return _objectSpread2({
1055
+ connection_id: (_lanConfigs$index = lanConfigs[index]) === null || _lanConfigs$index === void 0 ? void 0 : _lanConfigs$index.connection_id,
1056
+ ip_address: item.ip_address
1057
+ }, showNetmask.LAN ? {
1058
+ netmask: item.netmask
1059
+ } : {});
1060
+ });
1061
+ updatePromises.push(updateLanConfig(lanData));
1062
+ }
952
1063
 
953
- default:
954
- return $$typeof;
955
- }
1064
+ // 更新QSFP配置
1065
+ if (sections.includes('QSFP') && values.QSFP) {
1066
+ const interfacesData = values.QSFP.map((item, index) => {
1067
+ var _st2110Interfaces$ind, _st2110Interfaces$ind2, _st2110Interfaces$ind3;
1068
+ return _objectSpread2(_objectSpread2(_objectSpread2({}, (st2110Interfaces === null || st2110Interfaces === void 0 || (_st2110Interfaces$ind = st2110Interfaces[index]) === null || _st2110Interfaces$ind === void 0 ? void 0 : _st2110Interfaces$ind.id) !== undefined && {
1069
+ id: st2110Interfaces === null || st2110Interfaces === void 0 || (_st2110Interfaces$ind2 = st2110Interfaces[index]) === null || _st2110Interfaces$ind2 === void 0 ? void 0 : _st2110Interfaces$ind2.id
1070
+ }), (st2110Interfaces === null || st2110Interfaces === void 0 || (_st2110Interfaces$ind3 = st2110Interfaces[index]) === null || _st2110Interfaces$ind3 === void 0 ? void 0 : _st2110Interfaces$ind3.ip) !== undefined ? {
1071
+ ip: item.ip_address
1072
+ } : {
1073
+ ip_address: item.ip_address
1074
+ }), showNetmask.QSFP ? {
1075
+ netmask: item.netmask
1076
+ } : {});
1077
+ });
1078
+ const st2110Data = st2110Interfaces.some(iface => 'id' in iface) ? {
1079
+ st2110_interfaces: interfacesData
1080
+ } : {
1081
+ interfaces: interfacesData
1082
+ };
1083
+ updatePromises.push(updateSysConfig(st2110Data));
1084
+ }
1085
+ const results = await Promise.allSettled(updatePromises);
956
1086
 
957
- }
1087
+ // 检查所有更新是否成功
1088
+ const allSucceeded = results.every(result => result.status === 'fulfilled');
1089
+ if (allSucceeded) {
1090
+ handleSuccess();
1091
+ } else {
1092
+ message.error('Some configurations failed to update');
1093
+ }
1094
+ } catch (error) {
1095
+ console.error('Failed to update configurations: ', error);
1096
+ message.error('Failed to update configurations');
1097
+ } finally {
1098
+ setSubmitLoading(false);
1099
+ }
1100
+ }, [form, sections, lanConfigs, st2110Interfaces, updateLanConfig, updateSysConfig, handleSuccess, message]);
958
1101
 
959
- case REACT_PORTAL_TYPE:
960
- return $$typeof;
961
- }
962
- }
1102
+ // 合并默认模态框属性和传入的属性
1103
+ const mergedModalProps = _objectSpread2({
1104
+ title: "Network Settings",
1105
+ width: 650,
1106
+ open,
1107
+ confirmLoading: submitLoading,
1108
+ onOk: handleSubmit,
1109
+ onCancel: onClose,
1110
+ okText: "Apply",
1111
+ cancelText: "Close",
1112
+ centered: true,
1113
+ destroyOnHidden: true,
1114
+ forceRender: true,
1115
+ styles: _objectSpread2({
1116
+ body: {
1117
+ padding: "16px 24px 8px 24px"
1118
+ }
1119
+ }, restartRemark !== null && {
1120
+ footer: {
1121
+ paddingBottom: 28
1122
+ }
1123
+ })
1124
+ }, modalProps);
963
1125
 
964
- return undefined;
965
- } // AsyncMode is deprecated along with isAsyncMode
1126
+ // 合并默认表单属性和传入的属性
1127
+ const mergedFormProps = _objectSpread2({
1128
+ form: form,
1129
+ labelCol: {
1130
+ span: 6
1131
+ },
1132
+ wrapperCol: {
1133
+ span: 18
1134
+ },
1135
+ autoComplete: "off"
1136
+ }, formProps);
1137
+ return /*#__PURE__*/jsxRuntime.jsxs(antd.Modal, _objectSpread2(_objectSpread2({}, mergedModalProps), {}, {
1138
+ children: [/*#__PURE__*/jsxRuntime.jsxs(antd.Form, _objectSpread2(_objectSpread2({}, mergedFormProps), {}, {
1139
+ children: [sections.includes('LAN') && lanConfigs.length > 0 && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
1140
+ children: [/*#__PURE__*/jsxRuntime.jsx(NetworkFieldGroup, {
1141
+ prefix: "LAN",
1142
+ interfaces: lanConfigs,
1143
+ fieldConfig: preparedFieldConfig.LAN
1144
+ }), sections.includes('QSFP') && st2110Interfaces.length > 0 && /*#__PURE__*/jsxRuntime.jsx(antd.Divider, {})]
1145
+ }), sections.includes('QSFP') && st2110Interfaces.length > 0 && /*#__PURE__*/jsxRuntime.jsx(NetworkFieldGroup, {
1146
+ prefix: "QSFP",
1147
+ interfaces: st2110Interfaces,
1148
+ fieldConfig: preparedFieldConfig.QSFP
1149
+ })]
1150
+ })), restartRemark]
1151
+ }));
1152
+ };
1153
+ var NetworkSettingsModal$1 = /*#__PURE__*/react.memo(NetworkSettingsModal);
966
1154
 
967
- var AsyncMode = REACT_ASYNC_MODE_TYPE;
968
- var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
969
- var ContextConsumer = REACT_CONTEXT_TYPE;
970
- var ContextProvider = REACT_PROVIDER_TYPE;
971
- var Element = REACT_ELEMENT_TYPE;
972
- var ForwardRef = REACT_FORWARD_REF_TYPE;
973
- var Fragment = REACT_FRAGMENT_TYPE;
974
- var Lazy = REACT_LAZY_TYPE;
975
- var Memo = REACT_MEMO_TYPE;
1155
+ const defaultFieldConfigs = {
1156
+ clock_class: {
1157
+ label: 'Clock Class',
1158
+ formType: 'select',
1159
+ options: [{
1160
+ value: 6,
1161
+ label: 'Atomic Clock (6)'
1162
+ }, {
1163
+ value: 7,
1164
+ label: 'GPS (7)'
1165
+ }, {
1166
+ value: 248,
1167
+ label: 'Slave-Only (248)'
1168
+ }],
1169
+ readOnly: true
1170
+ },
1171
+ clock_accuracy: {
1172
+ label: 'Clock Accuracy',
1173
+ formType: 'number',
1174
+ readOnly: true
1175
+ },
1176
+ offset_scaled_log_variance: {
1177
+ label: 'Offset Scaled Log Variance',
1178
+ formType: 'number',
1179
+ readOnly: true
1180
+ },
1181
+ grandmaster_priority1: {
1182
+ label: 'Priority 1',
1183
+ formType: 'number',
1184
+ readOnly: true
1185
+ },
1186
+ grandmaster_priority2: {
1187
+ label: 'Priority 2',
1188
+ formType: 'number',
1189
+ readOnly: true
1190
+ },
1191
+ grandmaster_identity: {
1192
+ label: 'Grandmaster Identity',
1193
+ formType: 'text',
1194
+ readOnly: true
1195
+ },
1196
+ master_port_id: {
1197
+ label: 'Port Identity',
1198
+ formType: 'text',
1199
+ readOnly: true
1200
+ },
1201
+ t1_domain_number: {
1202
+ label: 'Domain',
1203
+ formType: 'number',
1204
+ min: 0,
1205
+ max: 127,
1206
+ readOnly: false
1207
+ },
1208
+ master_utc_offset: {
1209
+ label: 'UTC Offset',
1210
+ formType: 'number',
1211
+ readOnly: true
1212
+ },
1213
+ is_connected: {
1214
+ label: 'Connected Status',
1215
+ formType: 'badge',
1216
+ statusMap: {
1217
+ 0: {
1218
+ text: 'Disconnected',
1219
+ color: 'red'
1220
+ },
1221
+ 1: {
1222
+ text: 'Connected',
1223
+ color: 'green'
1224
+ }
1225
+ }
1226
+ },
1227
+ is_locked: {
1228
+ label: 'Locked Status',
1229
+ formType: 'badge',
1230
+ statusMap: {
1231
+ 0: {
1232
+ text: 'Unlocked',
1233
+ color: 'red'
1234
+ },
1235
+ 1: {
1236
+ text: 'Locked',
1237
+ color: 'green'
1238
+ }
1239
+ }
1240
+ }
1241
+ };
1242
+
1243
+ // 默认字段顺序
1244
+ const defaultFieldOrder = ['t1_domain_number', 'grandmaster_priority1', 'grandmaster_priority2', 'grandmaster_identity', 'master_port_id', 'clock_class', 'clock_accuracy', 'offset_scaled_log_variance', 'master_utc_offset', 'is_connected', 'is_locked'];
1245
+
1246
+ /**
1247
+ * 转换PTP状态为表单字段数组
1248
+ * @param {Object} ptpStatus PTP状态对象
1249
+ * @param {Object} fieldConfigs 字段配置
1250
+ * @param {Array} fieldOrder 字段顺序
1251
+ * @returns {Array} 表单字段数组
1252
+ */
1253
+ function convertPtpStatusToArray(ptpStatus, fieldConfigs, fieldOrder) {
1254
+ return fieldOrder.filter(key => key in ptpStatus).map(key => {
1255
+ const config = fieldConfigs[key] || {
1256
+ label: key,
1257
+ formType: 'text'
1258
+ };
1259
+ const value = ptpStatus[key];
1260
+ return _objectSpread2(_objectSpread2({
1261
+ key,
1262
+ value
1263
+ }, config), {}, {
1264
+ rawData: ptpStatus
1265
+ });
1266
+ });
1267
+ }
1268
+ const PtpModal = _ref => {
1269
+ let {
1270
+ open,
1271
+ onClose,
1272
+ getPtpInfo,
1273
+ updatePtpInfo,
1274
+ fieldConfigs = defaultFieldConfigs,
1275
+ fieldOrder = defaultFieldOrder,
1276
+ modalProps = {},
1277
+ formProps = {}
1278
+ } = _ref;
1279
+ const [ptpStatus, setPtpStatus] = react.useState(null);
1280
+ const [form] = antd.Form.useForm();
1281
+ const {
1282
+ message
1283
+ } = antd.App.useApp();
1284
+ react.useEffect(() => {
1285
+ if (open) {
1286
+ getPtpInfo().then(data => {
1287
+ if (data !== null && data !== void 0 && data[0]) {
1288
+ setPtpStatus(data[0]);
1289
+ form.setFieldsValue(data[0]);
1290
+ }
1291
+ });
1292
+ }
1293
+ }, [open, form, getPtpInfo]);
1294
+ const ptpStatusArray = react.useMemo(() => {
1295
+ if (!ptpStatus) return [];
1296
+ return convertPtpStatusToArray(ptpStatus, fieldConfigs, fieldOrder);
1297
+ }, [ptpStatus]);
1298
+ const handleValueChange = changedValues => {
1299
+ if ('t1_domain_number' in changedValues) {
1300
+ setPtpStatus(prev => _objectSpread2(_objectSpread2({}, prev), {}, {
1301
+ t1_domain_number: changedValues.t1_domain_number
1302
+ }));
1303
+ }
1304
+ };
1305
+ const handleSubmit = async () => {
1306
+ try {
1307
+ const values = await form.validateFields();
1308
+ const response = await updatePtpInfo(values);
1309
+ if (response) {
1310
+ message.success('Success');
1311
+ setTimeout(() => {
1312
+ onClose();
1313
+ }, 1500);
1314
+ }
1315
+ } catch (error) {
1316
+ console.error('Update failed:', error);
1317
+ }
1318
+ };
1319
+ const renderFormItem = item => {
1320
+ var _item$statusMap, _item$min, _item$max;
1321
+ switch (item.formType) {
1322
+ case 'select':
1323
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
1324
+ options: item.options,
1325
+ disabled: item.readOnly
1326
+ });
1327
+ case 'switch':
1328
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Switch, {});
1329
+ case 'badge':
1330
+ const normalizedValue = typeof item.value === 'boolean' ? item.value ? 1 : 0 : item.value;
1331
+ const status = ((_item$statusMap = item.statusMap) === null || _item$statusMap === void 0 ? void 0 : _item$statusMap[normalizedValue]) || {
1332
+ text: 'Unknown',
1333
+ color: 'gray'
1334
+ };
1335
+ return /*#__PURE__*/jsxRuntime.jsx(antd.ConfigProvider, {
1336
+ theme: {
1337
+ components: {
1338
+ Badge: {
1339
+ statusSize: 10
1340
+ }
1341
+ }
1342
+ },
1343
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Badge, {
1344
+ color: status.color,
1345
+ text: status.text
1346
+ })
1347
+ });
1348
+ case 'number':
1349
+ return /*#__PURE__*/jsxRuntime.jsx(antd.InputNumber, {
1350
+ disabled: item.readOnly,
1351
+ controls: false,
1352
+ keyboard: false,
1353
+ min: (_item$min = item.min) !== null && _item$min !== void 0 ? _item$min : Number.MIN_SAFE_INTEGER,
1354
+ max: (_item$max = item.max) !== null && _item$max !== void 0 ? _item$max : Number.MAX_SAFE_INTEGER
1355
+ });
1356
+ default:
1357
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Input, {
1358
+ disabled: item.readOnly
1359
+ });
1360
+ }
1361
+ };
1362
+ if (!open || !ptpStatus) return null;
1363
+
1364
+ // 合并默认模态框属性和传入的属性
1365
+ const mergedModalProps = _objectSpread2({
1366
+ title: "PTP",
1367
+ width: 650,
1368
+ open,
1369
+ okText: "Apply",
1370
+ cancelText: "Close",
1371
+ onCancel: onClose,
1372
+ onOk: handleSubmit
1373
+ }, modalProps);
1374
+
1375
+ // 合并默认表单属性和传入的属性
1376
+ const mergedFormProps = _objectSpread2({
1377
+ form: form,
1378
+ name: "ptpForm",
1379
+ labelCol: {
1380
+ span: 8
1381
+ },
1382
+ wrapperCol: {
1383
+ span: 16
1384
+ },
1385
+ autoComplete: "off",
1386
+ onValuesChange: handleValueChange
1387
+ }, formProps);
1388
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Modal, _objectSpread2(_objectSpread2({}, mergedModalProps), {}, {
1389
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Form, _objectSpread2(_objectSpread2({}, mergedFormProps), {}, {
1390
+ children: ptpStatusArray.map(item => /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
1391
+ label: item.label,
1392
+ name: item.key,
1393
+ initialValue: item.value,
1394
+ children: renderFormItem(item)
1395
+ }, item.key))
1396
+ }))
1397
+ }));
1398
+ };
1399
+ var PtpModal$1 = /*#__PURE__*/react.memo(PtpModal);
1400
+
1401
+ const LeftList = /*#__PURE__*/react.memo(_ref => {
1402
+ let {
1403
+ dataSource,
1404
+ selectedPresetId,
1405
+ onSelectPreset,
1406
+ onAddNew,
1407
+ onRemove,
1408
+ hasPresets = dataSource.length > 0,
1409
+ showDescription = false,
1410
+ texts = {
1411
+ newButton: "New Preset",
1412
+ removeButton: "Remove"
1413
+ }
1414
+ } = _ref;
1415
+ // 动态计算列布局
1416
+ const gridColumns = showDescription ? "grid-cols-3" : "grid-cols-2";
1417
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
1418
+ className: "h-full left-list-wrapper",
1419
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
1420
+ className: "list-container",
1421
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.List, {
1422
+ header: /*#__PURE__*/jsxRuntime.jsxs("div", {
1423
+ className: "grid ".concat(gridColumns, " w-full list-header"),
1424
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
1425
+ children: "Name"
1426
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
1427
+ children: "Create Time"
1428
+ }), showDescription && /*#__PURE__*/jsxRuntime.jsx("div", {
1429
+ children: "Description"
1430
+ })]
1431
+ }),
1432
+ dataSource: dataSource,
1433
+ rowKey: "id",
1434
+ renderItem: item => /*#__PURE__*/jsxRuntime.jsx(antd.List.Item, {
1435
+ className: "list-item ".concat(selectedPresetId === item.id ? 'selected' : ''),
1436
+ style: {
1437
+ padding: "9px 24px"
1438
+ },
1439
+ onClick: () => onSelectPreset(item),
1440
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
1441
+ className: "grid ".concat(gridColumns, " w-full text-text-normal"),
1442
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
1443
+ title: item.name,
1444
+ children: item.name || "Untitled Preset"
1445
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
1446
+ children: item.create_time
1447
+ }), showDescription && /*#__PURE__*/jsxRuntime.jsx("div", {
1448
+ children: item.description
1449
+ })]
1450
+ })
1451
+ }),
1452
+ locale: {
1453
+ emptyText: /*#__PURE__*/jsxRuntime.jsx("div", {
1454
+ className: "p-8",
1455
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Empty, {
1456
+ image: antd.Empty.PRESENTED_IMAGE_SIMPLE,
1457
+ description: /*#__PURE__*/jsxRuntime.jsx("span", {
1458
+ className: "text-gray-400",
1459
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
1460
+ type: "link",
1461
+ onClick: onAddNew,
1462
+ className: "p-0 h-auto",
1463
+ icon: /*#__PURE__*/jsxRuntime.jsx(icons.PlusOutlined, {}),
1464
+ children: "Create new preset"
1465
+ })
1466
+ })
1467
+ })
1468
+ })
1469
+ }
1470
+ })
1471
+ }), hasPresets && /*#__PURE__*/jsxRuntime.jsx("div", {
1472
+ className: "p-4",
1473
+ style: {
1474
+ paddingInline: 24
1475
+ },
1476
+ children: /*#__PURE__*/jsxRuntime.jsxs(antd.Space, {
1477
+ size: "middle",
1478
+ children: [/*#__PURE__*/jsxRuntime.jsx(antd.Button, {
1479
+ type: "default",
1480
+ icon: /*#__PURE__*/jsxRuntime.jsx(icons.PlusOutlined, {}),
1481
+ style: {
1482
+ padding: "20px 12px"
1483
+ },
1484
+ className: "btn-gray",
1485
+ onClick: onAddNew,
1486
+ children: texts.newButton
1487
+ }), /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
1488
+ type: "default",
1489
+ style: {
1490
+ padding: "20px 12px"
1491
+ },
1492
+ className: "btn-gray",
1493
+ onClick: onRemove,
1494
+ children: texts.removeButton
1495
+ })]
1496
+ })
1497
+ })]
1498
+ });
1499
+ });
1500
+ const SubmitButton = _ref2 => {
1501
+ let {
1502
+ loading,
1503
+ action,
1504
+ children,
1505
+ disabled = false
1506
+ } = _ref2;
1507
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
1508
+ className: "submit-btn-wrapper",
1509
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
1510
+ className: "btn-gray",
1511
+ loading: loading,
1512
+ onClick: action,
1513
+ disabled: disabled,
1514
+ children: children
1515
+ })
1516
+ });
1517
+ };
1518
+ const RightDetailForm = /*#__PURE__*/react.memo(_ref3 => {
1519
+ let {
1520
+ form,
1521
+ onSave,
1522
+ onLoad,
1523
+ isLoading,
1524
+ isEditing,
1525
+ originalPresetData,
1526
+ fields = {
1527
+ name: {
1528
+ label: "Preset Name",
1529
+ placeholder: "Enter preset name",
1530
+ required: true
1531
+ }
1532
+ },
1533
+ texts = {
1534
+ loadButton: "Load",
1535
+ saveButton: "Save"
1536
+ },
1537
+ presetChanged
1538
+ } = _ref3;
1539
+ const [initialSelected, setInitialSelected] = react.useState([]);
1540
+ const currentSelected = antd.Form.useWatch('category_list', form) || [];
1541
+
1542
+ // 检查是否包含category_list字段
1543
+ const hasCategoryList = fields.category_list !== null && fields.category_list !== undefined;
1544
+
1545
+ // 初始化 category_list 的选择状态
1546
+ react.useEffect(() => {
1547
+ if (hasCategoryList) {
1548
+ const currentValue = form.getFieldValue('category_list') || [];
1549
+ setInitialSelected(currentValue);
1550
+ }
1551
+ }, [presetChanged, form, hasCategoryList]); // 当presetChanged变化时更新
1552
+
1553
+ // 动态生成 checkbox 选项
1554
+ const checkboxOptions = react.useMemo(() => {
1555
+ if (!hasCategoryList) return [];
1556
+ return fields.category_list.options.map(category => {
1557
+ const isInitiallySelected = initialSelected.includes(category.name);
1558
+ const shouldDisable = isEditing ? !isInitiallySelected : false;
1559
+ return _objectSpread2(_objectSpread2({}, category), {}, {
1560
+ disabled: shouldDisable,
1561
+ initiallySelected: isInitiallySelected
1562
+ });
1563
+ });
1564
+ }, [initialSelected, isEditing, hasCategoryList, fields.category_list]);
1565
+ const handleCheckboxChange = checkedValues => {
1566
+ form.setFieldsValue({
1567
+ category_list: checkedValues
1568
+ });
1569
+ };
1570
+ const handleLoad = async () => {
1571
+ try {
1572
+ const formValues = await form.validateFields();
1573
+ const loadData = {
1574
+ id: form.getFieldValue('id'),
1575
+ // 优先使用表单中的 category_list,如果没有则使用原始数据
1576
+ name: originalPresetData.name,
1577
+ category_list: hasCategoryList ? formValues.category_list || [] : (originalPresetData === null || originalPresetData === void 0 ? void 0 : originalPresetData.category_list) || []
1578
+ };
1579
+ await onLoad(loadData);
1580
+ } catch (error) {
1581
+ console.error('表单验证失败:', error);
1582
+ }
1583
+ };
1584
+ return /*#__PURE__*/jsxRuntime.jsxs(antd.Flex, {
1585
+ vertical: true,
1586
+ className: "h-full",
1587
+ children: [/*#__PURE__*/jsxRuntime.jsxs(antd.Form, {
1588
+ form: form,
1589
+ layout: "vertical",
1590
+ autoComplete: "off",
1591
+ style: {
1592
+ flex: 1,
1593
+ overflowY: 'auto'
1594
+ },
1595
+ children: [/*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
1596
+ name: "name",
1597
+ label: fields.name.label,
1598
+ rules: [{
1599
+ required: fields.name.required,
1600
+ validator: async (_, value) => {
1601
+ if (!value || value.trim() === '') {
1602
+ return Promise.reject(new Error('Preset name cannot be empty or spaces only'));
1603
+ }
1604
+ }
1605
+ }],
1606
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Input, {
1607
+ placeholder: fields.name.placeholder,
1608
+ disabled: isEditing
1609
+ })
1610
+ }), hasCategoryList && /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
1611
+ name: "category_list",
1612
+ label: fields.category_list.label,
1613
+ rules: [{
1614
+ required: fields.category_list.required,
1615
+ message: 'Please select at least one category',
1616
+ validator: (_, value) => {
1617
+ if (value && value.length > 0) {
1618
+ return Promise.resolve();
1619
+ }
1620
+ return Promise.reject(new Error('Please select at least one category'));
1621
+ }
1622
+ }],
1623
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Checkbox.Group, {
1624
+ className: "grid grid-cols-2 gap-2",
1625
+ onChange: handleCheckboxChange,
1626
+ children: checkboxOptions.map(category => /*#__PURE__*/jsxRuntime.jsx(antd.Checkbox, {
1627
+ value: category.name,
1628
+ disabled: category.disabled,
1629
+ children: category.label
1630
+ }, category.name))
1631
+ })
1632
+ }), fields.description && /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
1633
+ name: "description",
1634
+ label: fields.description.label,
1635
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Input.TextArea, {
1636
+ rows: 4,
1637
+ placeholder: fields.description.placeholder,
1638
+ disabled: isEditing
1639
+ })
1640
+ })]
1641
+ }), isEditing ? /*#__PURE__*/jsxRuntime.jsx(SubmitButton, _objectSpread2(_objectSpread2({
1642
+ action: handleLoad
1643
+ }, hasCategoryList && {
1644
+ disabled: !currentSelected.length
1645
+ }), {}, {
1646
+ children: texts.loadButton
1647
+ })) : /*#__PURE__*/jsxRuntime.jsx(SubmitButton, {
1648
+ action: onSave,
1649
+ loading: isLoading,
1650
+ children: texts.saveButton
1651
+ })]
1652
+ });
1653
+ });
1654
+
1655
+ const Preset = _ref => {
1656
+ let {
1657
+ open,
1658
+ onClose,
1659
+ // API 方法通过 props 传入
1660
+ getPresetList,
1661
+ savePreset,
1662
+ removePreset,
1663
+ loadPreset,
1664
+ onLoadSuccess,
1665
+ // 加载成功后的回调
1666
+ onLoadError,
1667
+ // 加载失败后的回调
1668
+ // 字段配置
1669
+ fields = {
1670
+ name: {
1671
+ label: "Preset Name",
1672
+ placeholder: "Enter preset name",
1673
+ required: true
1674
+ }
1675
+ },
1676
+ texts = {
1677
+ title: "Preset Management",
1678
+ emptyText: "Select a preset from the list to view details",
1679
+ deleteConfirm: "Are you sure to delete preset",
1680
+ loadConfirm: "Are you sure you want to load preset",
1681
+ loadText: "Loading...",
1682
+ successText: "Success",
1683
+ newButton: "New Preset",
1684
+ removeButton: "Remove",
1685
+ loadButton: "Load",
1686
+ saveButton: "Save"
1687
+ },
1688
+ // 样式定制
1689
+ width = 1000,
1690
+ height = 680,
1691
+ className = ""
1692
+ } = _ref;
1693
+ const {
1694
+ message: AntdMessage,
1695
+ modal: AntdModal
1696
+ } = antd.App.useApp();
1697
+ const [presetList, setPresetList] = react.useState([]);
1698
+ const [selectedPreset, setSelectedPreset] = react.useState(null);
1699
+ const [loading, setLoading] = react.useState(false);
1700
+ const [presetChanged, setPresetChanged] = react.useState(0);
1701
+ const [form] = antd.Form.useForm();
1702
+
1703
+ // 获取预设列表
1704
+ react.useEffect(() => {
1705
+ fetchPresetList();
1706
+ }, []);
1707
+ const fetchPresetList = react.useCallback(async () => {
1708
+ try {
1709
+ const data = await getPresetList();
1710
+ const presets = (data === null || data === void 0 ? void 0 : data.preset_list) || data || [];
1711
+ setPresetList(presets);
1712
+ } catch (error) {
1713
+ console.error('Failed to fetch preset list:', error);
1714
+ }
1715
+ }, [getPresetList]);
1716
+ const handleSelectPreset = react.useCallback(preset => {
1717
+ setSelectedPreset(preset);
1718
+ form.setFieldsValue(preset);
1719
+ setPresetChanged(prev => prev + 1); // 触发react更新
1720
+ }, [form]);
1721
+ const handleAddNew = react.useCallback(() => {
1722
+ var _fields$category_list;
1723
+ const unsavedPreset = presetList.find(item => !item.id);
1724
+ if (unsavedPreset) {
1725
+ AntdMessage.warning('Existing unsaved preset detected.');
1726
+ return;
1727
+ }
1728
+
1729
+ // 创建新的数据,包含所有配置的字段
1730
+ const newPreset = Object.keys(fields).reduce((acc, fieldName) => {
1731
+ acc[fieldName] = '';
1732
+ return acc;
1733
+ }, {});
1734
+
1735
+ // 特殊处理 category_list
1736
+ if ((_fields$category_list = fields.category_list) !== null && _fields$category_list !== void 0 && _fields$category_list.options) {
1737
+ newPreset.category_list = fields.category_list.options.map(item => item.name);
1738
+ }
1739
+ setPresetList([...presetList, newPreset]);
1740
+ setSelectedPreset(newPreset);
1741
+ form.setFieldsValue(newPreset);
1742
+ }, [form, presetList, AntdMessage]);
1743
+ const handleRemove = react.useCallback(async () => {
1744
+ if (!selectedPreset) return;
1745
+
1746
+ // 检查是否为新建的未保存数据(无id)
1747
+ const isUnsavedPreset = !selectedPreset.id;
1748
+ const presetName = selectedPreset.name || 'Untitled Preset';
1749
+ try {
1750
+ AntdModal.confirm({
1751
+ icon: /*#__PURE__*/jsxRuntime.jsx(icons.ExclamationCircleFilled, {}),
1752
+ title: 'Delete Preset',
1753
+ content: "".concat(texts.deleteConfirm, " \"").concat(presetName, "\"?"),
1754
+ cancelText: 'No',
1755
+ okText: 'Yes',
1756
+ onOk: async () => {
1757
+ if (!isUnsavedPreset) {
1758
+ await removePreset({
1759
+ id: selectedPreset.id
1760
+ });
1761
+ AntdMessage.success(texts.successText);
1762
+ // 刷新列表
1763
+ await fetchPresetList();
1764
+ } else {
1765
+ setPresetList(prev => prev.filter(item => !!item.id));
1766
+ }
1767
+
1768
+ // 重置表单和选择状态
1769
+ setSelectedPreset(null);
1770
+ form.resetFields();
1771
+ }
1772
+ });
1773
+ } catch (error) {
1774
+ console.error('Failed to delete preset:', error);
1775
+ }
1776
+ }, [selectedPreset, form, AntdModal, AntdMessage, fetchPresetList, texts]);
1777
+ const handleLoadPreset = react.useCallback(async loadData => {
1778
+ if (!loadData) return;
1779
+
1780
+ // 显示确认对话框
1781
+ AntdModal.confirm({
1782
+ title: 'Load Preset',
1783
+ content: "".concat(texts.loadConfirm, " \"").concat(loadData.name, "\"?"),
1784
+ cancelText: 'No',
1785
+ okText: 'Yes',
1786
+ onOk: async () => {
1787
+ // 显示加载模态框
1788
+ const modalInstance = antd.Modal.info({
1789
+ title: texts.loadText,
1790
+ content: /*#__PURE__*/jsxRuntime.jsx(antd.Spin, {
1791
+ size: "large",
1792
+ className: "block mx-auto"
1793
+ }),
1794
+ maskClosable: false,
1795
+ okButtonProps: {
1796
+ style: {
1797
+ display: 'none'
1798
+ }
1799
+ }
1800
+ });
1801
+ try {
1802
+ await loadPreset(_objectSpread2({
1803
+ id: loadData.id
1804
+ }, loadData.category_list && {
1805
+ category_list: loadData.category_list
1806
+ }));
1807
+ // 成功时延迟关闭
1808
+ setTimeout(() => {
1809
+ modalInstance.destroy();
1810
+ AntdMessage.success(texts.successText);
1811
+
1812
+ // 加载成功的外部回调
1813
+ if (onLoadSuccess) {
1814
+ onLoadSuccess(loadData);
1815
+ }
1816
+ }, 1000);
1817
+ } catch (error) {
1818
+ console.error('Failed to load preset:', error);
1819
+ modalInstance.destroy();
1820
+
1821
+ // 加载失败的外部回调
1822
+ if (onLoadError) {
1823
+ onLoadError(error, loadData);
1824
+ }
1825
+ }
1826
+ }
1827
+ });
1828
+ }, [loadPreset, texts, AntdMessage, AntdModal, onLoadSuccess, onLoadError]);
1829
+ const handleSave = react.useCallback(async () => {
1830
+ setLoading(true);
1831
+ try {
1832
+ const values = await form.validateFields();
1833
+ console.log('Form values:', values);
1834
+ await savePreset(values);
1835
+ AntdMessage.success(texts.successText);
1836
+ // 刷新列表
1837
+ await fetchPresetList();
1838
+
1839
+ // 重置表单和选择状态
1840
+ setSelectedPreset(null);
1841
+ form.resetFields();
1842
+ } catch (error) {
1843
+ if (error.errorFields) {
1844
+ // 表单验证错误
1845
+ console.error('Form validation failed:', error.errorFields);
1846
+ } else {
1847
+ console.error('Failed to save preset:', error);
1848
+ }
1849
+ } finally {
1850
+ setLoading(false);
1851
+ }
1852
+ }, [form, AntdMessage, fetchPresetList, savePreset, texts]);
1853
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Modal, {
1854
+ title: texts.title,
1855
+ width: width,
1856
+ open: open,
1857
+ wrapClassName: "preset-management ".concat(className),
1858
+ footer: null,
1859
+ onCancel: onClose,
1860
+ centered: true,
1861
+ styles: {
1862
+ body: {
1863
+ height: "".concat(height, "px")
1864
+ }
1865
+ },
1866
+ children: /*#__PURE__*/jsxRuntime.jsxs(antd.Row, {
1867
+ gutter: 0,
1868
+ className: "h-full w-full",
1869
+ children: [/*#__PURE__*/jsxRuntime.jsx(antd.Col, {
1870
+ span: 14,
1871
+ className: "h-full",
1872
+ children: /*#__PURE__*/jsxRuntime.jsx(LeftList, {
1873
+ dataSource: presetList,
1874
+ selectedPresetId: selectedPreset === null || selectedPreset === void 0 ? void 0 : selectedPreset.id,
1875
+ onSelectPreset: handleSelectPreset,
1876
+ onAddNew: handleAddNew,
1877
+ onRemove: handleRemove,
1878
+ showDescription: !!fields.description // 根据 fields 判断是否显示 description
1879
+ ,
1880
+ texts: {
1881
+ newButton: texts.newButton,
1882
+ removeButton: texts.removeButton
1883
+ }
1884
+ })
1885
+ }), /*#__PURE__*/jsxRuntime.jsx(antd.Col, {
1886
+ span: 10,
1887
+ className: "h-full p-6",
1888
+ children: selectedPreset ? /*#__PURE__*/jsxRuntime.jsx(RightDetailForm, {
1889
+ form: form,
1890
+ onSave: handleSave,
1891
+ onLoad: handleLoadPreset,
1892
+ isLoading: loading,
1893
+ isEditing: !!(selectedPreset !== null && selectedPreset !== void 0 && selectedPreset.id),
1894
+ originalPresetData: selectedPreset // 传递原始数据
1895
+ ,
1896
+ fields: fields,
1897
+ texts: {
1898
+ loadButton: texts.loadButton,
1899
+ saveButton: texts.saveButton
1900
+ },
1901
+ presetChanged: presetChanged
1902
+ }) : /*#__PURE__*/jsxRuntime.jsx(antd.Flex, {
1903
+ vertical: true,
1904
+ justify: "center",
1905
+ align: "center",
1906
+ className: "h-full text-gray-400",
1907
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Empty, {
1908
+ image: antd.Empty.PRESENTED_IMAGE_SIMPLE,
1909
+ description: texts.emptyText
1910
+ })
1911
+ })
1912
+ })]
1913
+ })
1914
+ });
1915
+ };
1916
+ var PresetModal = /*#__PURE__*/react.memo(Preset);
1917
+
1918
+ const _excluded = ["menuItems", "onMenuClick", "downloadFiles", "upgradeExecute", "upgradeStatus", "acceptFileTypes", "uploadCompleteDelay", "statusPollingInterval", "children"];
1919
+ const UpgradeManager = _ref => {
1920
+ let {
1921
+ menuItems = [],
1922
+ onMenuClick,
1923
+ downloadFiles,
1924
+ upgradeExecute,
1925
+ upgradeStatus,
1926
+ acceptFileTypes = "application/octet-stream",
1927
+ uploadCompleteDelay = 3000,
1928
+ statusPollingInterval = 1000,
1929
+ children
1930
+ } = _ref,
1931
+ dropdownProps = _objectWithoutProperties(_ref, _excluded);
1932
+ const [upgradeElement] = useUpgrade$1({
1933
+ menuItems,
1934
+ onMenuClick,
1935
+ downloadFiles,
1936
+ upgradeExecute,
1937
+ upgradeStatus,
1938
+ acceptFileTypes,
1939
+ uploadCompleteDelay,
1940
+ statusPollingInterval
1941
+ });
1942
+ if (children) {
1943
+ // 提取Dropdown组件和其menu属性
1944
+ const dropdownElement = upgradeElement.props.children[0];
1945
+ const otherElements = upgradeElement.props.children.slice(1);
1946
+ return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
1947
+ children: [/*#__PURE__*/jsxRuntime.jsx(antd.Dropdown, _objectSpread2(_objectSpread2(_objectSpread2({}, dropdownProps), dropdownElement.props), {}, {
1948
+ children: children
1949
+ })), otherElements]
1950
+ });
1951
+ }
1952
+
1953
+ // 如果没有children,直接返回完整的升级元素
1954
+ return upgradeElement;
1955
+ };
1956
+ UpgradeManager.defaultProps = {
1957
+ trigger: ["hover"],
1958
+ placement: "bottomRight"
1959
+ };
1960
+ var UpgradeManager$1 = UpgradeManager;
1961
+
1962
+ function getDefaultExportFromCjs (x) {
1963
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
1964
+ }
1965
+
1966
+ var propTypes = {exports: {}};
1967
+
1968
+ var reactIs = {exports: {}};
1969
+
1970
+ var reactIs_production_min = {};
1971
+
1972
+ /** @license React v16.13.1
1973
+ * react-is.production.min.js
1974
+ *
1975
+ * Copyright (c) Facebook, Inc. and its affiliates.
1976
+ *
1977
+ * This source code is licensed under the MIT license found in the
1978
+ * LICENSE file in the root directory of this source tree.
1979
+ */
1980
+
1981
+ var hasRequiredReactIs_production_min;
1982
+
1983
+ function requireReactIs_production_min () {
1984
+ if (hasRequiredReactIs_production_min) return reactIs_production_min;
1985
+ hasRequiredReactIs_production_min = 1;
1986
+ var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?
1987
+ Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
1988
+ function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}reactIs_production_min.AsyncMode=l;reactIs_production_min.ConcurrentMode=m;reactIs_production_min.ContextConsumer=k;reactIs_production_min.ContextProvider=h;reactIs_production_min.Element=c;reactIs_production_min.ForwardRef=n;reactIs_production_min.Fragment=e;reactIs_production_min.Lazy=t;reactIs_production_min.Memo=r;reactIs_production_min.Portal=d;
1989
+ reactIs_production_min.Profiler=g;reactIs_production_min.StrictMode=f;reactIs_production_min.Suspense=p;reactIs_production_min.isAsyncMode=function(a){return A(a)||z(a)===l};reactIs_production_min.isConcurrentMode=A;reactIs_production_min.isContextConsumer=function(a){return z(a)===k};reactIs_production_min.isContextProvider=function(a){return z(a)===h};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};reactIs_production_min.isForwardRef=function(a){return z(a)===n};reactIs_production_min.isFragment=function(a){return z(a)===e};reactIs_production_min.isLazy=function(a){return z(a)===t};
1990
+ reactIs_production_min.isMemo=function(a){return z(a)===r};reactIs_production_min.isPortal=function(a){return z(a)===d};reactIs_production_min.isProfiler=function(a){return z(a)===g};reactIs_production_min.isStrictMode=function(a){return z(a)===f};reactIs_production_min.isSuspense=function(a){return z(a)===p};
1991
+ reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};reactIs_production_min.typeOf=z;
1992
+ return reactIs_production_min;
1993
+ }
1994
+
1995
+ var reactIs_development = {};
1996
+
1997
+ /** @license React v16.13.1
1998
+ * react-is.development.js
1999
+ *
2000
+ * Copyright (c) Facebook, Inc. and its affiliates.
2001
+ *
2002
+ * This source code is licensed under the MIT license found in the
2003
+ * LICENSE file in the root directory of this source tree.
2004
+ */
2005
+
2006
+ var hasRequiredReactIs_development;
2007
+
2008
+ function requireReactIs_development () {
2009
+ if (hasRequiredReactIs_development) return reactIs_development;
2010
+ hasRequiredReactIs_development = 1;
2011
+
2012
+
2013
+
2014
+ if (process.env.NODE_ENV !== "production") {
2015
+ (function() {
2016
+
2017
+ // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
2018
+ // nor polyfill, then a plain number is used for performance.
2019
+ var hasSymbol = typeof Symbol === 'function' && Symbol.for;
2020
+ var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
2021
+ var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
2022
+ var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
2023
+ var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
2024
+ var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
2025
+ var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
2026
+ var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
2027
+ // (unstable) APIs that have been removed. Can we remove the symbols?
2028
+
2029
+ var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
2030
+ var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
2031
+ var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
2032
+ var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
2033
+ var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
2034
+ var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
2035
+ var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
2036
+ var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
2037
+ var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
2038
+ var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
2039
+ var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
2040
+
2041
+ function isValidElementType(type) {
2042
+ return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
2043
+ type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
2044
+ }
2045
+
2046
+ function typeOf(object) {
2047
+ if (typeof object === 'object' && object !== null) {
2048
+ var $$typeof = object.$$typeof;
2049
+
2050
+ switch ($$typeof) {
2051
+ case REACT_ELEMENT_TYPE:
2052
+ var type = object.type;
2053
+
2054
+ switch (type) {
2055
+ case REACT_ASYNC_MODE_TYPE:
2056
+ case REACT_CONCURRENT_MODE_TYPE:
2057
+ case REACT_FRAGMENT_TYPE:
2058
+ case REACT_PROFILER_TYPE:
2059
+ case REACT_STRICT_MODE_TYPE:
2060
+ case REACT_SUSPENSE_TYPE:
2061
+ return type;
2062
+
2063
+ default:
2064
+ var $$typeofType = type && type.$$typeof;
2065
+
2066
+ switch ($$typeofType) {
2067
+ case REACT_CONTEXT_TYPE:
2068
+ case REACT_FORWARD_REF_TYPE:
2069
+ case REACT_LAZY_TYPE:
2070
+ case REACT_MEMO_TYPE:
2071
+ case REACT_PROVIDER_TYPE:
2072
+ return $$typeofType;
2073
+
2074
+ default:
2075
+ return $$typeof;
2076
+ }
2077
+
2078
+ }
2079
+
2080
+ case REACT_PORTAL_TYPE:
2081
+ return $$typeof;
2082
+ }
2083
+ }
2084
+
2085
+ return undefined;
2086
+ } // AsyncMode is deprecated along with isAsyncMode
2087
+
2088
+ var AsyncMode = REACT_ASYNC_MODE_TYPE;
2089
+ var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
2090
+ var ContextConsumer = REACT_CONTEXT_TYPE;
2091
+ var ContextProvider = REACT_PROVIDER_TYPE;
2092
+ var Element = REACT_ELEMENT_TYPE;
2093
+ var ForwardRef = REACT_FORWARD_REF_TYPE;
2094
+ var Fragment = REACT_FRAGMENT_TYPE;
2095
+ var Lazy = REACT_LAZY_TYPE;
2096
+ var Memo = REACT_MEMO_TYPE;
976
2097
  var Portal = REACT_PORTAL_TYPE;
977
2098
  var Profiler = REACT_PROFILER_TYPE;
978
2099
  var StrictMode = REACT_STRICT_MODE_TYPE;
@@ -1530,227 +2651,59 @@ function requireFactoryWithTypeCheckers () {
1530
2651
  if (props[propName] == null) {
1531
2652
  if (isRequired) {
1532
2653
  if (props[propName] === null) {
1533
- return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
1534
- }
1535
- return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
1536
- }
1537
- return null;
1538
- } else {
1539
- return validate(props, propName, componentName, location, propFullName);
1540
- }
1541
- }
1542
-
1543
- var chainedCheckType = checkType.bind(null, false);
1544
- chainedCheckType.isRequired = checkType.bind(null, true);
1545
-
1546
- return chainedCheckType;
1547
- }
1548
-
1549
- function createPrimitiveTypeChecker(expectedType) {
1550
- function validate(props, propName, componentName, location, propFullName, secret) {
1551
- var propValue = props[propName];
1552
- var propType = getPropType(propValue);
1553
- if (propType !== expectedType) {
1554
- // `propValue` being instance of, say, date/regexp, pass the 'object'
1555
- // check, but we can offer a more precise error message here rather than
1556
- // 'of type `object`'.
1557
- var preciseType = getPreciseType(propValue);
1558
-
1559
- return new PropTypeError(
1560
- 'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
1561
- {expectedType: expectedType}
1562
- );
1563
- }
1564
- return null;
1565
- }
1566
- return createChainableTypeChecker(validate);
1567
- }
1568
-
1569
- function createAnyTypeChecker() {
1570
- return createChainableTypeChecker(emptyFunctionThatReturnsNull);
1571
- }
1572
-
1573
- function createArrayOfTypeChecker(typeChecker) {
1574
- function validate(props, propName, componentName, location, propFullName) {
1575
- if (typeof typeChecker !== 'function') {
1576
- return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
1577
- }
1578
- var propValue = props[propName];
1579
- if (!Array.isArray(propValue)) {
1580
- var propType = getPropType(propValue);
1581
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
1582
- }
1583
- for (var i = 0; i < propValue.length; i++) {
1584
- var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
1585
- if (error instanceof Error) {
1586
- return error;
1587
- }
1588
- }
1589
- return null;
1590
- }
1591
- return createChainableTypeChecker(validate);
1592
- }
1593
-
1594
- function createElementTypeChecker() {
1595
- function validate(props, propName, componentName, location, propFullName) {
1596
- var propValue = props[propName];
1597
- if (!isValidElement(propValue)) {
1598
- var propType = getPropType(propValue);
1599
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
1600
- }
1601
- return null;
1602
- }
1603
- return createChainableTypeChecker(validate);
1604
- }
1605
-
1606
- function createElementTypeTypeChecker() {
1607
- function validate(props, propName, componentName, location, propFullName) {
1608
- var propValue = props[propName];
1609
- if (!ReactIs.isValidElementType(propValue)) {
1610
- var propType = getPropType(propValue);
1611
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
1612
- }
1613
- return null;
1614
- }
1615
- return createChainableTypeChecker(validate);
1616
- }
1617
-
1618
- function createInstanceTypeChecker(expectedClass) {
1619
- function validate(props, propName, componentName, location, propFullName) {
1620
- if (!(props[propName] instanceof expectedClass)) {
1621
- var expectedClassName = expectedClass.name || ANONYMOUS;
1622
- var actualClassName = getClassName(props[propName]);
1623
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
1624
- }
1625
- return null;
1626
- }
1627
- return createChainableTypeChecker(validate);
1628
- }
1629
-
1630
- function createEnumTypeChecker(expectedValues) {
1631
- if (!Array.isArray(expectedValues)) {
1632
- if (process.env.NODE_ENV !== 'production') {
1633
- if (arguments.length > 1) {
1634
- printWarning(
1635
- 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
1636
- 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
1637
- );
1638
- } else {
1639
- printWarning('Invalid argument supplied to oneOf, expected an array.');
2654
+ return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
2655
+ }
2656
+ return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
1640
2657
  }
2658
+ return null;
2659
+ } else {
2660
+ return validate(props, propName, componentName, location, propFullName);
1641
2661
  }
1642
- return emptyFunctionThatReturnsNull;
1643
2662
  }
1644
2663
 
1645
- function validate(props, propName, componentName, location, propFullName) {
1646
- var propValue = props[propName];
1647
- for (var i = 0; i < expectedValues.length; i++) {
1648
- if (is(propValue, expectedValues[i])) {
1649
- return null;
1650
- }
1651
- }
2664
+ var chainedCheckType = checkType.bind(null, false);
2665
+ chainedCheckType.isRequired = checkType.bind(null, true);
1652
2666
 
1653
- var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
1654
- var type = getPreciseType(value);
1655
- if (type === 'symbol') {
1656
- return String(value);
1657
- }
1658
- return value;
1659
- });
1660
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
1661
- }
1662
- return createChainableTypeChecker(validate);
2667
+ return chainedCheckType;
1663
2668
  }
1664
2669
 
1665
- function createObjectOfTypeChecker(typeChecker) {
1666
- function validate(props, propName, componentName, location, propFullName) {
1667
- if (typeof typeChecker !== 'function') {
1668
- return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
1669
- }
2670
+ function createPrimitiveTypeChecker(expectedType) {
2671
+ function validate(props, propName, componentName, location, propFullName, secret) {
1670
2672
  var propValue = props[propName];
1671
2673
  var propType = getPropType(propValue);
1672
- if (propType !== 'object') {
1673
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
1674
- }
1675
- for (var key in propValue) {
1676
- if (has(propValue, key)) {
1677
- var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
1678
- if (error instanceof Error) {
1679
- return error;
1680
- }
1681
- }
1682
- }
1683
- return null;
1684
- }
1685
- return createChainableTypeChecker(validate);
1686
- }
1687
-
1688
- function createUnionTypeChecker(arrayOfTypeCheckers) {
1689
- if (!Array.isArray(arrayOfTypeCheckers)) {
1690
- process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
1691
- return emptyFunctionThatReturnsNull;
1692
- }
2674
+ if (propType !== expectedType) {
2675
+ // `propValue` being instance of, say, date/regexp, pass the 'object'
2676
+ // check, but we can offer a more precise error message here rather than
2677
+ // 'of type `object`'.
2678
+ var preciseType = getPreciseType(propValue);
1693
2679
 
1694
- for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
1695
- var checker = arrayOfTypeCheckers[i];
1696
- if (typeof checker !== 'function') {
1697
- printWarning(
1698
- 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
1699
- 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
2680
+ return new PropTypeError(
2681
+ 'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
2682
+ {expectedType: expectedType}
1700
2683
  );
1701
- return emptyFunctionThatReturnsNull;
1702
- }
1703
- }
1704
-
1705
- function validate(props, propName, componentName, location, propFullName) {
1706
- var expectedTypes = [];
1707
- for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
1708
- var checker = arrayOfTypeCheckers[i];
1709
- var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret);
1710
- if (checkerResult == null) {
1711
- return null;
1712
- }
1713
- if (checkerResult.data && has(checkerResult.data, 'expectedType')) {
1714
- expectedTypes.push(checkerResult.data.expectedType);
1715
- }
1716
- }
1717
- var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';
1718
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
1719
- }
1720
- return createChainableTypeChecker(validate);
1721
- }
1722
-
1723
- function createNodeChecker() {
1724
- function validate(props, propName, componentName, location, propFullName) {
1725
- if (!isNode(props[propName])) {
1726
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
1727
2684
  }
1728
2685
  return null;
1729
2686
  }
1730
2687
  return createChainableTypeChecker(validate);
1731
2688
  }
1732
2689
 
1733
- function invalidValidatorError(componentName, location, propFullName, key, type) {
1734
- return new PropTypeError(
1735
- (componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
1736
- 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
1737
- );
2690
+ function createAnyTypeChecker() {
2691
+ return createChainableTypeChecker(emptyFunctionThatReturnsNull);
1738
2692
  }
1739
2693
 
1740
- function createShapeTypeChecker(shapeTypes) {
2694
+ function createArrayOfTypeChecker(typeChecker) {
1741
2695
  function validate(props, propName, componentName, location, propFullName) {
2696
+ if (typeof typeChecker !== 'function') {
2697
+ return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
2698
+ }
1742
2699
  var propValue = props[propName];
1743
- var propType = getPropType(propValue);
1744
- if (propType !== 'object') {
1745
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
2700
+ if (!Array.isArray(propValue)) {
2701
+ var propType = getPropType(propValue);
2702
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
1746
2703
  }
1747
- for (var key in shapeTypes) {
1748
- var checker = shapeTypes[key];
1749
- if (typeof checker !== 'function') {
1750
- return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
1751
- }
1752
- var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
1753
- if (error) {
2704
+ for (var i = 0; i < propValue.length; i++) {
2705
+ var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
2706
+ if (error instanceof Error) {
1754
2707
  return error;
1755
2708
  }
1756
2709
  }
@@ -1759,1487 +2712,693 @@ function requireFactoryWithTypeCheckers () {
1759
2712
  return createChainableTypeChecker(validate);
1760
2713
  }
1761
2714
 
1762
- function createStrictShapeTypeChecker(shapeTypes) {
2715
+ function createElementTypeChecker() {
1763
2716
  function validate(props, propName, componentName, location, propFullName) {
1764
2717
  var propValue = props[propName];
1765
- var propType = getPropType(propValue);
1766
- if (propType !== 'object') {
1767
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
1768
- }
1769
- // We need to check all keys in case some are required but missing from props.
1770
- var allKeys = assign({}, props[propName], shapeTypes);
1771
- for (var key in allKeys) {
1772
- var checker = shapeTypes[key];
1773
- if (has(shapeTypes, key) && typeof checker !== 'function') {
1774
- return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
1775
- }
1776
- if (!checker) {
1777
- return new PropTypeError(
1778
- 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
1779
- '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
1780
- '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
1781
- );
1782
- }
1783
- var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
1784
- if (error) {
1785
- return error;
1786
- }
1787
- }
1788
- return null;
1789
- }
1790
-
1791
- return createChainableTypeChecker(validate);
1792
- }
1793
-
1794
- function isNode(propValue) {
1795
- switch (typeof propValue) {
1796
- case 'number':
1797
- case 'string':
1798
- case 'undefined':
1799
- return true;
1800
- case 'boolean':
1801
- return !propValue;
1802
- case 'object':
1803
- if (Array.isArray(propValue)) {
1804
- return propValue.every(isNode);
1805
- }
1806
- if (propValue === null || isValidElement(propValue)) {
1807
- return true;
1808
- }
1809
-
1810
- var iteratorFn = getIteratorFn(propValue);
1811
- if (iteratorFn) {
1812
- var iterator = iteratorFn.call(propValue);
1813
- var step;
1814
- if (iteratorFn !== propValue.entries) {
1815
- while (!(step = iterator.next()).done) {
1816
- if (!isNode(step.value)) {
1817
- return false;
1818
- }
1819
- }
1820
- } else {
1821
- // Iterator will provide entry [k,v] tuples rather than values.
1822
- while (!(step = iterator.next()).done) {
1823
- var entry = step.value;
1824
- if (entry) {
1825
- if (!isNode(entry[1])) {
1826
- return false;
1827
- }
1828
- }
1829
- }
1830
- }
1831
- } else {
1832
- return false;
1833
- }
1834
-
1835
- return true;
1836
- default:
1837
- return false;
1838
- }
1839
- }
1840
-
1841
- function isSymbol(propType, propValue) {
1842
- // Native Symbol.
1843
- if (propType === 'symbol') {
1844
- return true;
1845
- }
1846
-
1847
- // falsy value can't be a Symbol
1848
- if (!propValue) {
1849
- return false;
1850
- }
1851
-
1852
- // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
1853
- if (propValue['@@toStringTag'] === 'Symbol') {
1854
- return true;
1855
- }
1856
-
1857
- // Fallback for non-spec compliant Symbols which are polyfilled.
1858
- if (typeof Symbol === 'function' && propValue instanceof Symbol) {
1859
- return true;
1860
- }
1861
-
1862
- return false;
1863
- }
1864
-
1865
- // Equivalent of `typeof` but with special handling for array and regexp.
1866
- function getPropType(propValue) {
1867
- var propType = typeof propValue;
1868
- if (Array.isArray(propValue)) {
1869
- return 'array';
1870
- }
1871
- if (propValue instanceof RegExp) {
1872
- // Old webkits (at least until Android 4.0) return 'function' rather than
1873
- // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
1874
- // passes PropTypes.object.
1875
- return 'object';
1876
- }
1877
- if (isSymbol(propType, propValue)) {
1878
- return 'symbol';
1879
- }
1880
- return propType;
1881
- }
1882
-
1883
- // This handles more types than `getPropType`. Only used for error messages.
1884
- // See `createPrimitiveTypeChecker`.
1885
- function getPreciseType(propValue) {
1886
- if (typeof propValue === 'undefined' || propValue === null) {
1887
- return '' + propValue;
1888
- }
1889
- var propType = getPropType(propValue);
1890
- if (propType === 'object') {
1891
- if (propValue instanceof Date) {
1892
- return 'date';
1893
- } else if (propValue instanceof RegExp) {
1894
- return 'regexp';
2718
+ if (!isValidElement(propValue)) {
2719
+ var propType = getPropType(propValue);
2720
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
1895
2721
  }
2722
+ return null;
1896
2723
  }
1897
- return propType;
2724
+ return createChainableTypeChecker(validate);
1898
2725
  }
1899
2726
 
1900
- // Returns a string that is postfixed to a warning about an invalid type.
1901
- // For example, "undefined" or "of type array"
1902
- function getPostfixForTypeWarning(value) {
1903
- var type = getPreciseType(value);
1904
- switch (type) {
1905
- case 'array':
1906
- case 'object':
1907
- return 'an ' + type;
1908
- case 'boolean':
1909
- case 'date':
1910
- case 'regexp':
1911
- return 'a ' + type;
1912
- default:
1913
- return type;
2727
+ function createElementTypeTypeChecker() {
2728
+ function validate(props, propName, componentName, location, propFullName) {
2729
+ var propValue = props[propName];
2730
+ if (!ReactIs.isValidElementType(propValue)) {
2731
+ var propType = getPropType(propValue);
2732
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
2733
+ }
2734
+ return null;
1914
2735
  }
2736
+ return createChainableTypeChecker(validate);
1915
2737
  }
1916
2738
 
1917
- // Returns class name of the object, if any.
1918
- function getClassName(propValue) {
1919
- if (!propValue.constructor || !propValue.constructor.name) {
1920
- return ANONYMOUS;
2739
+ function createInstanceTypeChecker(expectedClass) {
2740
+ function validate(props, propName, componentName, location, propFullName) {
2741
+ if (!(props[propName] instanceof expectedClass)) {
2742
+ var expectedClassName = expectedClass.name || ANONYMOUS;
2743
+ var actualClassName = getClassName(props[propName]);
2744
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
2745
+ }
2746
+ return null;
1921
2747
  }
1922
- return propValue.constructor.name;
2748
+ return createChainableTypeChecker(validate);
1923
2749
  }
1924
2750
 
1925
- ReactPropTypes.checkPropTypes = checkPropTypes;
1926
- ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
1927
- ReactPropTypes.PropTypes = ReactPropTypes;
1928
-
1929
- return ReactPropTypes;
1930
- };
1931
- return factoryWithTypeCheckers;
1932
- }
1933
-
1934
- /**
1935
- * Copyright (c) 2013-present, Facebook, Inc.
1936
- *
1937
- * This source code is licensed under the MIT license found in the
1938
- * LICENSE file in the root directory of this source tree.
1939
- */
1940
-
1941
- var factoryWithThrowingShims;
1942
- var hasRequiredFactoryWithThrowingShims;
1943
-
1944
- function requireFactoryWithThrowingShims () {
1945
- if (hasRequiredFactoryWithThrowingShims) return factoryWithThrowingShims;
1946
- hasRequiredFactoryWithThrowingShims = 1;
1947
-
1948
- var ReactPropTypesSecret = /*@__PURE__*/ requireReactPropTypesSecret();
1949
-
1950
- function emptyFunction() {}
1951
- function emptyFunctionWithReset() {}
1952
- emptyFunctionWithReset.resetWarningCache = emptyFunction;
1953
-
1954
- factoryWithThrowingShims = function() {
1955
- function shim(props, propName, componentName, location, propFullName, secret) {
1956
- if (secret === ReactPropTypesSecret) {
1957
- // It is still safe when called from React.
1958
- return;
2751
+ function createEnumTypeChecker(expectedValues) {
2752
+ if (!Array.isArray(expectedValues)) {
2753
+ if (process.env.NODE_ENV !== 'production') {
2754
+ if (arguments.length > 1) {
2755
+ printWarning(
2756
+ 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
2757
+ 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
2758
+ );
2759
+ } else {
2760
+ printWarning('Invalid argument supplied to oneOf, expected an array.');
2761
+ }
2762
+ }
2763
+ return emptyFunctionThatReturnsNull;
1959
2764
  }
1960
- var err = new Error(
1961
- 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
1962
- 'Use PropTypes.checkPropTypes() to call them. ' +
1963
- 'Read more at http://fb.me/use-check-prop-types'
1964
- );
1965
- err.name = 'Invariant Violation';
1966
- throw err;
1967
- } shim.isRequired = shim;
1968
- function getShim() {
1969
- return shim;
1970
- } // Important!
1971
- // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
1972
- var ReactPropTypes = {
1973
- array: shim,
1974
- bigint: shim,
1975
- bool: shim,
1976
- func: shim,
1977
- number: shim,
1978
- object: shim,
1979
- string: shim,
1980
- symbol: shim,
1981
-
1982
- any: shim,
1983
- arrayOf: getShim,
1984
- element: shim,
1985
- elementType: shim,
1986
- instanceOf: getShim,
1987
- node: shim,
1988
- objectOf: getShim,
1989
- oneOf: getShim,
1990
- oneOfType: getShim,
1991
- shape: getShim,
1992
- exact: getShim,
1993
-
1994
- checkPropTypes: emptyFunctionWithReset,
1995
- resetWarningCache: emptyFunction
1996
- };
1997
-
1998
- ReactPropTypes.PropTypes = ReactPropTypes;
1999
2765
 
2000
- return ReactPropTypes;
2001
- };
2002
- return factoryWithThrowingShims;
2003
- }
2004
-
2005
- /**
2006
- * Copyright (c) 2013-present, Facebook, Inc.
2007
- *
2008
- * This source code is licensed under the MIT license found in the
2009
- * LICENSE file in the root directory of this source tree.
2010
- */
2011
-
2012
- var hasRequiredPropTypes;
2013
-
2014
- function requirePropTypes () {
2015
- if (hasRequiredPropTypes) return propTypes.exports;
2016
- hasRequiredPropTypes = 1;
2017
- if (process.env.NODE_ENV !== 'production') {
2018
- var ReactIs = requireReactIs();
2019
-
2020
- // By explicitly using `prop-types` you are opting into new development behavior.
2021
- // http://fb.me/prop-types-in-prod
2022
- var throwOnDirectAccess = true;
2023
- propTypes.exports = /*@__PURE__*/ requireFactoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
2024
- } else {
2025
- // By explicitly using `prop-types` you are opting into new production behavior.
2026
- // http://fb.me/prop-types-in-prod
2027
- propTypes.exports = /*@__PURE__*/ requireFactoryWithThrowingShims()();
2028
- }
2029
- return propTypes.exports;
2030
- }
2031
-
2032
- var propTypesExports = /*@__PURE__*/ requirePropTypes();
2033
- var PropTypes = /*@__PURE__*/getDefaultExportFromCjs(propTypesExports);
2034
-
2035
- const SystemOperations = _ref => {
2036
- let {
2037
- onPowerOff,
2038
- onRestart,
2039
- powerOffLabel = "Power Off",
2040
- restartLabel = "Restart",
2041
- iconClassName = "seeder-iconfont seeder-icon-guanji1 text-xl text-neutral-400",
2042
- confirmTitle = "Confirm",
2043
- cancelText = "No",
2044
- okText = "Yes",
2045
- run
2046
- } = _ref;
2047
- const {
2048
- modal: AntdModal
2049
- } = antd.App.useApp();
2050
- const menuItems = [{
2051
- key: "poweroff",
2052
- label: powerOffLabel
2053
- },
2054
- // {
2055
- // key: "reboot",
2056
- // label: rebootLabel, // 硬重启 物理重启
2057
- // },
2058
- {
2059
- key: "restart",
2060
- label: restartLabel // 软重启 服务重启
2061
- }];
2062
- const doAction = action => {
2063
- try {
2064
- AntdModal.confirm({
2065
- icon: /*#__PURE__*/jsxRuntime.jsx(icons.ExclamationCircleFilled, {}),
2066
- title: "".concat(confirmTitle, " ").concat(action, "?"),
2067
- cancelText,
2068
- okText,
2069
- onOk: () => {
2070
- if (action === 'poweroff' && onPowerOff) {
2071
- onPowerOff();
2072
- } else if (action === 'restart' && onRestart) {
2073
- onRestart();
2074
- }
2766
+ function validate(props, propName, componentName, location, propFullName) {
2767
+ var propValue = props[propName];
2768
+ for (var i = 0; i < expectedValues.length; i++) {
2769
+ if (is(propValue, expectedValues[i])) {
2770
+ return null;
2771
+ }
2772
+ }
2075
2773
 
2076
- // Call the run callback after successful operation
2077
- if (typeof run === 'function') {
2078
- run();
2079
- }
2080
- }
2081
- });
2082
- } catch (error) {
2083
- console.error("".concat(action.toUpperCase(), " ERROR: "), error);
2084
- }
2085
- };
2086
- const handleMenuClick = _ref2 => {
2087
- let {
2088
- key
2089
- } = _ref2;
2090
- doAction(key);
2091
- };
2092
- return /*#__PURE__*/jsxRuntime.jsx(antd.Dropdown, {
2093
- menu: {
2094
- items: menuItems,
2095
- onClick: handleMenuClick
2096
- },
2097
- trigger: ["hover"],
2098
- children: /*#__PURE__*/jsxRuntime.jsx("a", {
2099
- onClick: e => e.preventDefault(),
2100
- children: /*#__PURE__*/jsxRuntime.jsx("i", {
2101
- className: iconClassName
2102
- })
2103
- })
2104
- });
2105
- };
2106
- SystemOperations.propTypes = {
2107
- onPowerOff: PropTypes.func,
2108
- onRestart: PropTypes.func,
2109
- powerOffLabel: PropTypes.string,
2110
- restartLabel: PropTypes.string,
2111
- iconClassName: PropTypes.string,
2112
- confirmTitle: PropTypes.string,
2113
- cancelText: PropTypes.string,
2114
- okText: PropTypes.string,
2115
- run: PropTypes.func
2116
- };
2117
- var SystemOperations$1 = SystemOperations;
2774
+ var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
2775
+ var type = getPreciseType(value);
2776
+ if (type === 'symbol') {
2777
+ return String(value);
2778
+ }
2779
+ return value;
2780
+ });
2781
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
2782
+ }
2783
+ return createChainableTypeChecker(validate);
2784
+ }
2118
2785
 
2119
- const defaultFieldConfigs = {
2120
- clock_class: {
2121
- label: 'Clock Class',
2122
- formType: 'select',
2123
- options: [{
2124
- value: 6,
2125
- label: 'Atomic Clock (6)'
2126
- }, {
2127
- value: 7,
2128
- label: 'GPS (7)'
2129
- }, {
2130
- value: 248,
2131
- label: 'Slave-Only (248)'
2132
- }],
2133
- readOnly: true
2134
- },
2135
- clock_accuracy: {
2136
- label: 'Clock Accuracy',
2137
- formType: 'number',
2138
- readOnly: true
2139
- },
2140
- offset_scaled_log_variance: {
2141
- label: 'Offset Scaled Log Variance',
2142
- formType: 'number',
2143
- readOnly: true
2144
- },
2145
- grandmaster_priority1: {
2146
- label: 'Priority 1',
2147
- formType: 'number',
2148
- readOnly: true
2149
- },
2150
- grandmaster_priority2: {
2151
- label: 'Priority 2',
2152
- formType: 'number',
2153
- readOnly: true
2154
- },
2155
- grandmaster_identity: {
2156
- label: 'Grandmaster Identity',
2157
- formType: 'text',
2158
- readOnly: true
2159
- },
2160
- master_port_id: {
2161
- label: 'Port Identity',
2162
- formType: 'text',
2163
- readOnly: true
2164
- },
2165
- t1_domain_number: {
2166
- label: 'Domain',
2167
- formType: 'number',
2168
- min: 0,
2169
- max: 127,
2170
- readOnly: false
2171
- },
2172
- master_utc_offset: {
2173
- label: 'UTC Offset',
2174
- formType: 'number',
2175
- readOnly: true
2176
- },
2177
- is_connected: {
2178
- label: 'Connected Status',
2179
- formType: 'badge',
2180
- statusMap: {
2181
- 0: {
2182
- text: 'Disconnected',
2183
- color: 'red'
2184
- },
2185
- 1: {
2186
- text: 'Connected',
2187
- color: 'green'
2188
- }
2189
- }
2190
- },
2191
- is_locked: {
2192
- label: 'Locked Status',
2193
- formType: 'badge',
2194
- statusMap: {
2195
- 0: {
2196
- text: 'Unlocked',
2197
- color: 'red'
2198
- },
2199
- 1: {
2200
- text: 'Locked',
2201
- color: 'green'
2202
- }
2203
- }
2204
- }
2205
- };
2786
+ function createObjectOfTypeChecker(typeChecker) {
2787
+ function validate(props, propName, componentName, location, propFullName) {
2788
+ if (typeof typeChecker !== 'function') {
2789
+ return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
2790
+ }
2791
+ var propValue = props[propName];
2792
+ var propType = getPropType(propValue);
2793
+ if (propType !== 'object') {
2794
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
2795
+ }
2796
+ for (var key in propValue) {
2797
+ if (has(propValue, key)) {
2798
+ var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
2799
+ if (error instanceof Error) {
2800
+ return error;
2801
+ }
2802
+ }
2803
+ }
2804
+ return null;
2805
+ }
2806
+ return createChainableTypeChecker(validate);
2807
+ }
2206
2808
 
2207
- // 默认字段顺序
2208
- const defaultFieldOrder = ['t1_domain_number', 'grandmaster_priority1', 'grandmaster_priority2', 'grandmaster_identity', 'master_port_id', 'clock_class', 'clock_accuracy', 'offset_scaled_log_variance', 'master_utc_offset', 'is_connected', 'is_locked'];
2809
+ function createUnionTypeChecker(arrayOfTypeCheckers) {
2810
+ if (!Array.isArray(arrayOfTypeCheckers)) {
2811
+ process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
2812
+ return emptyFunctionThatReturnsNull;
2813
+ }
2209
2814
 
2210
- /**
2211
- * 转换PTP状态为表单字段数组
2212
- * @param {Object} ptpStatus PTP状态对象
2213
- * @param {Object} fieldConfigs 字段配置
2214
- * @param {Array} fieldOrder 字段顺序
2215
- * @returns {Array} 表单字段数组
2216
- */
2217
- function convertPtpStatusToArray(ptpStatus, fieldConfigs, fieldOrder) {
2218
- return fieldOrder.filter(key => key in ptpStatus).map(key => {
2219
- const config = fieldConfigs[key] || {
2220
- label: key,
2221
- formType: 'text'
2222
- };
2223
- const value = ptpStatus[key];
2224
- return _objectSpread2(_objectSpread2({
2225
- key,
2226
- value
2227
- }, config), {}, {
2228
- rawData: ptpStatus
2229
- });
2230
- });
2231
- }
2232
- const PtpModal = _ref => {
2233
- let {
2234
- open,
2235
- onClose,
2236
- getPtpInfo,
2237
- updatePtpInfo,
2238
- fieldConfigs = defaultFieldConfigs,
2239
- fieldOrder = defaultFieldOrder,
2240
- modalProps = {},
2241
- formProps = {}
2242
- } = _ref;
2243
- const [ptpStatus, setPtpStatus] = react.useState(null);
2244
- const [form] = antd.Form.useForm();
2245
- const {
2246
- message
2247
- } = antd.App.useApp();
2248
- react.useEffect(() => {
2249
- if (open) {
2250
- getPtpInfo().then(data => {
2251
- if (data !== null && data !== void 0 && data[0]) {
2252
- setPtpStatus(data[0]);
2253
- form.setFieldsValue(data[0]);
2254
- }
2255
- });
2256
- }
2257
- }, [open, form, getPtpInfo]);
2258
- const ptpStatusArray = react.useMemo(() => {
2259
- if (!ptpStatus) return [];
2260
- return convertPtpStatusToArray(ptpStatus, fieldConfigs, fieldOrder);
2261
- }, [ptpStatus]);
2262
- const handleValueChange = changedValues => {
2263
- if ('t1_domain_number' in changedValues) {
2264
- setPtpStatus(prev => _objectSpread2(_objectSpread2({}, prev), {}, {
2265
- t1_domain_number: changedValues.t1_domain_number
2266
- }));
2267
- }
2268
- };
2269
- const handleSubmit = async () => {
2270
- try {
2271
- const values = await form.validateFields();
2272
- const response = await updatePtpInfo(values);
2273
- if (response) {
2274
- message.success('Success');
2275
- setTimeout(() => {
2276
- onClose();
2277
- }, 1500);
2278
- }
2279
- } catch (error) {
2280
- console.error('Update failed:', error);
2281
- }
2282
- };
2283
- const renderFormItem = item => {
2284
- var _item$statusMap, _item$min, _item$max;
2285
- switch (item.formType) {
2286
- case 'select':
2287
- return /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
2288
- options: item.options,
2289
- disabled: item.readOnly
2290
- });
2291
- case 'switch':
2292
- return /*#__PURE__*/jsxRuntime.jsx(antd.Switch, {});
2293
- case 'badge':
2294
- const normalizedValue = typeof item.value === 'boolean' ? item.value ? 1 : 0 : item.value;
2295
- const status = ((_item$statusMap = item.statusMap) === null || _item$statusMap === void 0 ? void 0 : _item$statusMap[normalizedValue]) || {
2296
- text: 'Unknown',
2297
- color: 'gray'
2298
- };
2299
- return /*#__PURE__*/jsxRuntime.jsx(antd.ConfigProvider, {
2300
- theme: {
2301
- components: {
2302
- Badge: {
2303
- statusSize: 10
2304
- }
2305
- }
2306
- },
2307
- children: /*#__PURE__*/jsxRuntime.jsx(antd.Badge, {
2308
- color: status.color,
2309
- text: status.text
2310
- })
2311
- });
2312
- case 'number':
2313
- return /*#__PURE__*/jsxRuntime.jsx(antd.InputNumber, {
2314
- disabled: item.readOnly,
2315
- controls: false,
2316
- keyboard: false,
2317
- min: (_item$min = item.min) !== null && _item$min !== void 0 ? _item$min : Number.MIN_SAFE_INTEGER,
2318
- max: (_item$max = item.max) !== null && _item$max !== void 0 ? _item$max : Number.MAX_SAFE_INTEGER
2319
- });
2320
- default:
2321
- return /*#__PURE__*/jsxRuntime.jsx(antd.Input, {
2322
- disabled: item.readOnly
2323
- });
2324
- }
2325
- };
2326
- if (!open || !ptpStatus) return null;
2815
+ for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
2816
+ var checker = arrayOfTypeCheckers[i];
2817
+ if (typeof checker !== 'function') {
2818
+ printWarning(
2819
+ 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
2820
+ 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
2821
+ );
2822
+ return emptyFunctionThatReturnsNull;
2823
+ }
2824
+ }
2825
+
2826
+ function validate(props, propName, componentName, location, propFullName) {
2827
+ var expectedTypes = [];
2828
+ for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
2829
+ var checker = arrayOfTypeCheckers[i];
2830
+ var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret);
2831
+ if (checkerResult == null) {
2832
+ return null;
2833
+ }
2834
+ if (checkerResult.data && has(checkerResult.data, 'expectedType')) {
2835
+ expectedTypes.push(checkerResult.data.expectedType);
2836
+ }
2837
+ }
2838
+ var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';
2839
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
2840
+ }
2841
+ return createChainableTypeChecker(validate);
2842
+ }
2327
2843
 
2328
- // 合并默认模态框属性和传入的属性
2329
- const mergedModalProps = _objectSpread2({
2330
- title: "PTP",
2331
- width: 650,
2332
- open,
2333
- okText: "Apply",
2334
- cancelText: "Close",
2335
- onCancel: onClose,
2336
- onOk: handleSubmit
2337
- }, modalProps);
2844
+ function createNodeChecker() {
2845
+ function validate(props, propName, componentName, location, propFullName) {
2846
+ if (!isNode(props[propName])) {
2847
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
2848
+ }
2849
+ return null;
2850
+ }
2851
+ return createChainableTypeChecker(validate);
2852
+ }
2338
2853
 
2339
- // 合并默认表单属性和传入的属性
2340
- const mergedFormProps = _objectSpread2({
2341
- form: form,
2342
- name: "ptpForm",
2343
- labelCol: {
2344
- span: 8
2345
- },
2346
- wrapperCol: {
2347
- span: 16
2348
- },
2349
- autoComplete: "off",
2350
- onValuesChange: handleValueChange
2351
- }, formProps);
2352
- return /*#__PURE__*/jsxRuntime.jsx(antd.Modal, _objectSpread2(_objectSpread2({}, mergedModalProps), {}, {
2353
- children: /*#__PURE__*/jsxRuntime.jsx(antd.Form, _objectSpread2(_objectSpread2({}, mergedFormProps), {}, {
2354
- children: ptpStatusArray.map(item => /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
2355
- label: item.label,
2356
- name: item.key,
2357
- initialValue: item.value,
2358
- children: renderFormItem(item)
2359
- }, item.key))
2360
- }))
2361
- }));
2362
- };
2363
- var PtpModal$1 = /*#__PURE__*/react.memo(PtpModal);
2854
+ function invalidValidatorError(componentName, location, propFullName, key, type) {
2855
+ return new PropTypeError(
2856
+ (componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
2857
+ 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
2858
+ );
2859
+ }
2364
2860
 
2365
- const NetworkFieldGroup = _ref => {
2366
- var _fieldConfig$netmask$, _fieldConfig$netmask;
2367
- let {
2368
- prefix,
2369
- interfaces,
2370
- fieldConfig = {}
2371
- } = _ref;
2372
- // 默认字段配置
2373
- const defaultFieldConfig = {
2374
- name: {
2375
- label: "Name",
2376
- enabled: true
2377
- },
2378
- ip: {
2379
- label: "IP Address",
2380
- enabled: true
2381
- },
2382
- netmask: {
2383
- label: "Netmask",
2384
- enabled: true
2385
- }
2386
- };
2387
- const mergedFieldConfig = _objectSpread2(_objectSpread2(_objectSpread2({}, defaultFieldConfig), fieldConfig), {}, {
2388
- netmask: {
2389
- label: "Netmask",
2390
- enabled: (_fieldConfig$netmask$ = (_fieldConfig$netmask = fieldConfig.netmask) === null || _fieldConfig$netmask === void 0 ? void 0 : _fieldConfig$netmask.enabled) !== null && _fieldConfig$netmask$ !== void 0 ? _fieldConfig$netmask$ : defaultFieldConfig.netmask.enabled // 合并 enabled
2391
- }
2392
- });
2393
- return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
2394
- children: [/*#__PURE__*/jsxRuntime.jsx(antd.Typography.Title, {
2395
- level: 5,
2396
- style: {
2397
- display: 'flex',
2398
- justifyContent: 'space-between',
2399
- alignItems: 'center',
2400
- marginBottom: 16
2401
- },
2402
- children: prefix
2403
- }), interfaces.map((iface, index) => /*#__PURE__*/jsxRuntime.jsxs("div", {
2404
- children: [mergedFieldConfig.name.enabled && /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
2405
- label: mergedFieldConfig.name.label,
2406
- name: [prefix, index, "display_name"],
2407
- children: /*#__PURE__*/jsxRuntime.jsx(antd.Input, {
2408
- disabled: true
2409
- })
2410
- }), mergedFieldConfig.ip.enabled && /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
2411
- label: mergedFieldConfig.ip.label,
2412
- name: [prefix, index, "ip_address"],
2413
- children: /*#__PURE__*/jsxRuntime.jsx(antd.Input, {})
2414
- }), mergedFieldConfig.netmask.enabled && /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
2415
- label: mergedFieldConfig.netmask.label,
2416
- name: [prefix, index, "netmask"],
2417
- children: /*#__PURE__*/jsxRuntime.jsx(antd.Input, {})
2418
- }), index < interfaces.length - 1 && /*#__PURE__*/jsxRuntime.jsx(antd.Divider, {
2419
- style: {
2420
- marginBlock: 16
2421
- }
2422
- })]
2423
- }, iface.id || index))]
2424
- });
2425
- };
2426
- const NetworkSettingsModal = _ref2 => {
2427
- let {
2428
- open,
2429
- onClose,
2430
- getLanConfig,
2431
- // 可选 - 单独获取LAN配置的函数
2432
- getSysConfig,
2433
- // 可选 - 单独获取QSFP配置的函数
2434
- getConfig,
2435
- // 可选 - 统一获取配置的函数
2436
- updateLanConfig,
2437
- updateSysConfig,
2438
- restart,
2439
- modalProps = {},
2440
- formProps = {},
2441
- fieldConfig = {},
2442
- sections = ['LAN', 'QSFP'],
2443
- showNetmask = {
2444
- LAN: true,
2445
- QSFP: false
2446
- },
2447
- restartRemark
2448
- } = _ref2;
2449
- const {
2450
- message,
2451
- modal
2452
- } = antd.App.useApp();
2453
- const [form] = antd.Form.useForm();
2454
- const [st2110Interfaces, setSt2110Interfaces] = react.useState([]);
2455
- const [lanConfigs, setLanConfigs] = react.useState([]);
2456
- const [submitLoading, setSubmitLoading] = react.useState(false);
2457
- const [isInitialized, setIsInitialized] = react.useState(false);
2458
- const initializationStatus = react.useRef({
2459
- hasFetched: false,
2460
- hasInitialized: false
2461
- });
2462
- const preparedFieldConfig = react.useMemo(() => {
2463
- const config = _objectSpread2({}, fieldConfig);
2861
+ function createShapeTypeChecker(shapeTypes) {
2862
+ function validate(props, propName, componentName, location, propFullName) {
2863
+ var propValue = props[propName];
2864
+ var propType = getPropType(propValue);
2865
+ if (propType !== 'object') {
2866
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
2867
+ }
2868
+ for (var key in shapeTypes) {
2869
+ var checker = shapeTypes[key];
2870
+ if (typeof checker !== 'function') {
2871
+ return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
2872
+ }
2873
+ var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
2874
+ if (error) {
2875
+ return error;
2876
+ }
2877
+ }
2878
+ return null;
2879
+ }
2880
+ return createChainableTypeChecker(validate);
2881
+ }
2882
+
2883
+ function createStrictShapeTypeChecker(shapeTypes) {
2884
+ function validate(props, propName, componentName, location, propFullName) {
2885
+ var propValue = props[propName];
2886
+ var propType = getPropType(propValue);
2887
+ if (propType !== 'object') {
2888
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
2889
+ }
2890
+ // We need to check all keys in case some are required but missing from props.
2891
+ var allKeys = assign({}, props[propName], shapeTypes);
2892
+ for (var key in allKeys) {
2893
+ var checker = shapeTypes[key];
2894
+ if (has(shapeTypes, key) && typeof checker !== 'function') {
2895
+ return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
2896
+ }
2897
+ if (!checker) {
2898
+ return new PropTypeError(
2899
+ 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
2900
+ '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
2901
+ '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
2902
+ );
2903
+ }
2904
+ var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
2905
+ if (error) {
2906
+ return error;
2907
+ }
2908
+ }
2909
+ return null;
2910
+ }
2911
+
2912
+ return createChainableTypeChecker(validate);
2913
+ }
2914
+
2915
+ function isNode(propValue) {
2916
+ switch (typeof propValue) {
2917
+ case 'number':
2918
+ case 'string':
2919
+ case 'undefined':
2920
+ return true;
2921
+ case 'boolean':
2922
+ return !propValue;
2923
+ case 'object':
2924
+ if (Array.isArray(propValue)) {
2925
+ return propValue.every(isNode);
2926
+ }
2927
+ if (propValue === null || isValidElement(propValue)) {
2928
+ return true;
2929
+ }
2930
+
2931
+ var iteratorFn = getIteratorFn(propValue);
2932
+ if (iteratorFn) {
2933
+ var iterator = iteratorFn.call(propValue);
2934
+ var step;
2935
+ if (iteratorFn !== propValue.entries) {
2936
+ while (!(step = iterator.next()).done) {
2937
+ if (!isNode(step.value)) {
2938
+ return false;
2939
+ }
2940
+ }
2941
+ } else {
2942
+ // Iterator will provide entry [k,v] tuples rather than values.
2943
+ while (!(step = iterator.next()).done) {
2944
+ var entry = step.value;
2945
+ if (entry) {
2946
+ if (!isNode(entry[1])) {
2947
+ return false;
2948
+ }
2949
+ }
2950
+ }
2951
+ }
2952
+ } else {
2953
+ return false;
2954
+ }
2955
+
2956
+ return true;
2957
+ default:
2958
+ return false;
2959
+ }
2960
+ }
2464
2961
 
2465
- // 确保LAN和QSFP的配置存在
2466
- config.LAN = config.LAN || {};
2467
- config.QSFP = config.QSFP || {};
2468
- if (sections.includes('LAN')) {
2469
- config.LAN.netmask = _objectSpread2(_objectSpread2({}, config.LAN.netmask || {}), {}, {
2470
- enabled: showNetmask.LAN
2471
- });
2472
- }
2473
- if (sections.includes('QSFP')) {
2474
- config.QSFP.netmask = _objectSpread2(_objectSpread2({}, config.QSFP.netmask || {}), {}, {
2475
- enabled: showNetmask.QSFP
2476
- });
2477
- }
2478
- return config;
2479
- }, [fieldConfig, showNetmask, sections]);
2480
- react.useEffect(() => {
2481
- if (!open) return;
2482
- const fetchData = async () => {
2483
- if (initializationStatus.current.hasFetched) return;
2484
- try {
2485
- initializationStatus.current.hasFetched = true;
2486
- if (getConfig) {
2487
- // 使用统一接口获取数据
2488
- const config = await getConfig();
2489
- if (sections.includes('LAN') && config.lan_interfaces) {
2490
- setLanConfigs(config.lan_interfaces);
2491
- }
2492
- if (sections.includes('QSFP') && config.interfaces) {
2493
- setSt2110Interfaces(config.interfaces);
2494
- }
2495
- } else {
2496
- const promises = [];
2497
- if (sections.includes('LAN')) {
2498
- promises.push(getLanConfig());
2499
- }
2500
- if (sections.includes('QSFP')) {
2501
- promises.push(getSysConfig());
2502
- }
2503
- const results = await Promise.allSettled(promises);
2504
- if (sections.includes('LAN') && getLanConfig) {
2505
- const lanResult = results[0];
2506
- if (lanResult.status === 'fulfilled') {
2507
- setLanConfigs(lanResult.value || []);
2508
- }
2509
- }
2510
- if (sections.includes('QSFP') && getSysConfig) {
2511
- const sysResult = sections.includes('LAN') ? results[1] : results[0];
2512
- if (sysResult.status === 'fulfilled' && sysResult.value) {
2513
- setSt2110Interfaces(sysResult.value.st2110_interfaces || []);
2514
- }
2515
- }
2516
- }
2517
- setIsInitialized(true);
2518
- } catch (error) {
2519
- console.error('Failed to fetch data:', error);
2520
- initializationStatus.current.hasFetched = false; // 出错时重置
2521
- }
2522
- };
2523
- fetchData();
2524
- }, [open, getLanConfig, getSysConfig, sections]);
2962
+ function isSymbol(propType, propValue) {
2963
+ // Native Symbol.
2964
+ if (propType === 'symbol') {
2965
+ return true;
2966
+ }
2525
2967
 
2526
- // 当模态框关闭时重置状态
2527
- react.useEffect(() => {
2528
- if (!open) {
2529
- setIsInitialized(false);
2530
- setLanConfigs([]);
2531
- setSt2110Interfaces([]);
2532
- form.resetFields();
2533
- initializationStatus.current = {
2534
- hasFetched: false,
2535
- hasInitialized: false
2536
- };
2537
- }
2538
- }, [open, form]);
2968
+ // falsy value can't be a Symbol
2969
+ if (!propValue) {
2970
+ return false;
2971
+ }
2539
2972
 
2540
- // 动态初始值配置
2541
- const initialValues = react.useMemo(() => {
2542
- const values = {};
2543
- if (sections.includes('LAN') && lanConfigs.length > 0) {
2544
- values.LAN = lanConfigs.map(config => _objectSpread2({
2545
- connection_id: config.connection_id,
2546
- display_name: config.display_name,
2547
- ip_address: config.ip_address
2548
- }, showNetmask.LAN ? {
2549
- netmask: config.netmask
2550
- } : {}));
2551
- }
2552
- if (sections.includes('QSFP') && st2110Interfaces.length > 0) {
2553
- values.QSFP = st2110Interfaces.map(iface => _objectSpread2(_objectSpread2({}, iface.id !== undefined && {
2554
- id: iface.id
2555
- }), {}, {
2556
- display_name: iface.display_name,
2557
- ip_address: iface.ip_address || iface.ip
2558
- }, showNetmask.QSFP ? {
2559
- netmask: iface.netmask
2560
- } : {}));
2561
- }
2562
- return values;
2563
- }, [lanConfigs, st2110Interfaces, sections, showNetmask]);
2973
+ // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
2974
+ if (propValue['@@toStringTag'] === 'Symbol') {
2975
+ return true;
2976
+ }
2564
2977
 
2565
- // 当初始值准备好后设置表单值
2566
- react.useEffect(() => {
2567
- if (isInitialized && !initializationStatus.current.hasInitialized) {
2568
- form.setFieldsValue(initialValues);
2569
- initializationStatus.current.hasInitialized = true;
2570
- }
2571
- }, [isInitialized, form, initialValues]);
2572
- const handleSuccess = react.useCallback(async function () {
2573
- let {
2574
- messageText = 'Success',
2575
- isPopup = !!restart,
2576
- refresh = !restart
2577
- } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2578
- message.success(messageText);
2579
- if (refresh && getConfig) {
2580
- try {
2581
- const newConfig = await getConfig();
2582
- if (sections.includes('LAN') && newConfig.lan_interfaces) {
2583
- setLanConfigs(newConfig.lan_interfaces);
2584
- }
2585
- if (sections.includes('QSFP') && newConfig.interfaces) {
2586
- setSt2110Interfaces(newConfig.interfaces);
2587
- }
2588
- } catch (error) {
2589
- console.error('Failed to refresh config:', error);
2590
- }
2591
- }
2978
+ // Fallback for non-spec compliant Symbols which are polyfilled.
2979
+ if (typeof Symbol === 'function' && propValue instanceof Symbol) {
2980
+ return true;
2981
+ }
2592
2982
 
2593
- // 如果有restart函数,则显示重启确认框
2594
- if (isPopup && restart) {
2595
- try {
2596
- const updatedConfig = await getSysConfig();
2597
- if (updatedConfig && updatedConfig.is_restart_required) {
2598
- modal.confirm({
2599
- icon: /*#__PURE__*/jsxRuntime.jsx(icons.ExclamationCircleFilled, {}),
2600
- title: "Configuration modified. Restart to apply changes?",
2601
- cancelText: "No",
2602
- okText: "Yes",
2603
- onOk: () => restart()
2604
- });
2605
- }
2606
- } catch (error) {
2607
- console.error('Failed to check restart status:', error);
2608
- }
2609
- }
2610
- onClose();
2611
- }, [message, modal, getSysConfig, restart, getConfig, sections, onClose]);
2612
- const handleSubmit = react.useCallback(async () => {
2613
- setSubmitLoading(true);
2614
- try {
2615
- const values = await form.validateFields();
2616
- // console.log("Direct form values:", values);
2983
+ return false;
2984
+ }
2617
2985
 
2618
- const updatePromises = [];
2986
+ // Equivalent of `typeof` but with special handling for array and regexp.
2987
+ function getPropType(propValue) {
2988
+ var propType = typeof propValue;
2989
+ if (Array.isArray(propValue)) {
2990
+ return 'array';
2991
+ }
2992
+ if (propValue instanceof RegExp) {
2993
+ // Old webkits (at least until Android 4.0) return 'function' rather than
2994
+ // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
2995
+ // passes PropTypes.object.
2996
+ return 'object';
2997
+ }
2998
+ if (isSymbol(propType, propValue)) {
2999
+ return 'symbol';
3000
+ }
3001
+ return propType;
3002
+ }
2619
3003
 
2620
- // 更新LAN配置
2621
- if (sections.includes('LAN') && values.LAN) {
2622
- const lanData = values.LAN.map((item, index) => {
2623
- var _lanConfigs$index;
2624
- return _objectSpread2({
2625
- connection_id: (_lanConfigs$index = lanConfigs[index]) === null || _lanConfigs$index === void 0 ? void 0 : _lanConfigs$index.connection_id,
2626
- ip_address: item.ip_address
2627
- }, showNetmask.LAN ? {
2628
- netmask: item.netmask
2629
- } : {});
2630
- });
2631
- updatePromises.push(updateLanConfig(lanData));
2632
- }
3004
+ // This handles more types than `getPropType`. Only used for error messages.
3005
+ // See `createPrimitiveTypeChecker`.
3006
+ function getPreciseType(propValue) {
3007
+ if (typeof propValue === 'undefined' || propValue === null) {
3008
+ return '' + propValue;
3009
+ }
3010
+ var propType = getPropType(propValue);
3011
+ if (propType === 'object') {
3012
+ if (propValue instanceof Date) {
3013
+ return 'date';
3014
+ } else if (propValue instanceof RegExp) {
3015
+ return 'regexp';
3016
+ }
3017
+ }
3018
+ return propType;
3019
+ }
3020
+
3021
+ // Returns a string that is postfixed to a warning about an invalid type.
3022
+ // For example, "undefined" or "of type array"
3023
+ function getPostfixForTypeWarning(value) {
3024
+ var type = getPreciseType(value);
3025
+ switch (type) {
3026
+ case 'array':
3027
+ case 'object':
3028
+ return 'an ' + type;
3029
+ case 'boolean':
3030
+ case 'date':
3031
+ case 'regexp':
3032
+ return 'a ' + type;
3033
+ default:
3034
+ return type;
3035
+ }
3036
+ }
3037
+
3038
+ // Returns class name of the object, if any.
3039
+ function getClassName(propValue) {
3040
+ if (!propValue.constructor || !propValue.constructor.name) {
3041
+ return ANONYMOUS;
3042
+ }
3043
+ return propValue.constructor.name;
3044
+ }
3045
+
3046
+ ReactPropTypes.checkPropTypes = checkPropTypes;
3047
+ ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
3048
+ ReactPropTypes.PropTypes = ReactPropTypes;
3049
+
3050
+ return ReactPropTypes;
3051
+ };
3052
+ return factoryWithTypeCheckers;
3053
+ }
3054
+
3055
+ /**
3056
+ * Copyright (c) 2013-present, Facebook, Inc.
3057
+ *
3058
+ * This source code is licensed under the MIT license found in the
3059
+ * LICENSE file in the root directory of this source tree.
3060
+ */
2633
3061
 
2634
- // 更新QSFP配置
2635
- if (sections.includes('QSFP') && values.QSFP) {
2636
- const interfacesData = values.QSFP.map((item, index) => {
2637
- var _st2110Interfaces$ind, _st2110Interfaces$ind2, _st2110Interfaces$ind3;
2638
- return _objectSpread2(_objectSpread2(_objectSpread2({}, (st2110Interfaces === null || st2110Interfaces === void 0 || (_st2110Interfaces$ind = st2110Interfaces[index]) === null || _st2110Interfaces$ind === void 0 ? void 0 : _st2110Interfaces$ind.id) !== undefined && {
2639
- id: st2110Interfaces === null || st2110Interfaces === void 0 || (_st2110Interfaces$ind2 = st2110Interfaces[index]) === null || _st2110Interfaces$ind2 === void 0 ? void 0 : _st2110Interfaces$ind2.id
2640
- }), (st2110Interfaces === null || st2110Interfaces === void 0 || (_st2110Interfaces$ind3 = st2110Interfaces[index]) === null || _st2110Interfaces$ind3 === void 0 ? void 0 : _st2110Interfaces$ind3.ip) !== undefined ? {
2641
- ip: item.ip_address
2642
- } : {
2643
- ip_address: item.ip_address
2644
- }), showNetmask.QSFP ? {
2645
- netmask: item.netmask
2646
- } : {});
2647
- });
2648
- const st2110Data = st2110Interfaces.some(iface => 'id' in iface) ? {
2649
- st2110_interfaces: interfacesData
2650
- } : {
2651
- interfaces: interfacesData
2652
- };
2653
- updatePromises.push(updateSysConfig(st2110Data));
2654
- }
2655
- const results = await Promise.allSettled(updatePromises);
3062
+ var factoryWithThrowingShims;
3063
+ var hasRequiredFactoryWithThrowingShims;
2656
3064
 
2657
- // 检查所有更新是否成功
2658
- const allSucceeded = results.every(result => result.status === 'fulfilled');
2659
- if (allSucceeded) {
2660
- handleSuccess();
2661
- } else {
2662
- message.error('Some configurations failed to update');
2663
- }
2664
- } catch (error) {
2665
- console.error('Failed to update configurations: ', error);
2666
- message.error('Failed to update configurations');
2667
- } finally {
2668
- setSubmitLoading(false);
2669
- }
2670
- }, [form, sections, lanConfigs, st2110Interfaces, updateLanConfig, updateSysConfig, handleSuccess, message]);
3065
+ function requireFactoryWithThrowingShims () {
3066
+ if (hasRequiredFactoryWithThrowingShims) return factoryWithThrowingShims;
3067
+ hasRequiredFactoryWithThrowingShims = 1;
2671
3068
 
2672
- // 合并默认模态框属性和传入的属性
2673
- const mergedModalProps = _objectSpread2({
2674
- title: "Network Settings",
2675
- width: 650,
2676
- open,
2677
- confirmLoading: submitLoading,
2678
- onOk: handleSubmit,
2679
- onCancel: onClose,
2680
- okText: "Apply",
2681
- cancelText: "Close",
2682
- centered: true,
2683
- destroyOnHidden: true,
2684
- forceRender: true,
2685
- styles: _objectSpread2({
2686
- body: {
2687
- padding: "16px 24px 8px 24px"
2688
- }
2689
- }, restartRemark !== null && {
2690
- footer: {
2691
- paddingBottom: 28
2692
- }
2693
- })
2694
- }, modalProps);
3069
+ var ReactPropTypesSecret = /*@__PURE__*/ requireReactPropTypesSecret();
2695
3070
 
2696
- // 合并默认表单属性和传入的属性
2697
- const mergedFormProps = _objectSpread2({
2698
- form: form,
2699
- labelCol: {
2700
- span: 6
2701
- },
2702
- wrapperCol: {
2703
- span: 18
2704
- },
2705
- autoComplete: "off"
2706
- }, formProps);
2707
- return /*#__PURE__*/jsxRuntime.jsxs(antd.Modal, _objectSpread2(_objectSpread2({}, mergedModalProps), {}, {
2708
- children: [/*#__PURE__*/jsxRuntime.jsxs(antd.Form, _objectSpread2(_objectSpread2({}, mergedFormProps), {}, {
2709
- children: [sections.includes('LAN') && lanConfigs.length > 0 && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
2710
- children: [/*#__PURE__*/jsxRuntime.jsx(NetworkFieldGroup, {
2711
- prefix: "LAN",
2712
- interfaces: lanConfigs,
2713
- fieldConfig: preparedFieldConfig.LAN
2714
- }), sections.includes('QSFP') && st2110Interfaces.length > 0 && /*#__PURE__*/jsxRuntime.jsx(antd.Divider, {})]
2715
- }), sections.includes('QSFP') && st2110Interfaces.length > 0 && /*#__PURE__*/jsxRuntime.jsx(NetworkFieldGroup, {
2716
- prefix: "QSFP",
2717
- interfaces: st2110Interfaces,
2718
- fieldConfig: preparedFieldConfig.QSFP
2719
- })]
2720
- })), restartRemark]
2721
- }));
2722
- };
2723
- var NetworkSettingsModal$1 = /*#__PURE__*/react.memo(NetworkSettingsModal);
3071
+ function emptyFunction() {}
3072
+ function emptyFunctionWithReset() {}
3073
+ emptyFunctionWithReset.resetWarningCache = emptyFunction;
2724
3074
 
2725
- const LeftList = /*#__PURE__*/react.memo(_ref => {
2726
- let {
2727
- dataSource,
2728
- selectedPresetId,
2729
- onSelectPreset,
2730
- onAddNew,
2731
- onRemove,
2732
- hasPresets = dataSource.length > 0,
2733
- showDescription = false,
2734
- texts = {
2735
- newButton: "New Preset",
2736
- removeButton: "Remove"
2737
- }
2738
- } = _ref;
2739
- // 动态计算列布局
2740
- const gridColumns = showDescription ? "grid-cols-3" : "grid-cols-2";
2741
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
2742
- className: "h-full left-list-wrapper",
2743
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
2744
- className: "list-container",
2745
- children: /*#__PURE__*/jsxRuntime.jsx(antd.List, {
2746
- header: /*#__PURE__*/jsxRuntime.jsxs("div", {
2747
- className: "grid ".concat(gridColumns, " w-full list-header"),
2748
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
2749
- children: "Name"
2750
- }), /*#__PURE__*/jsxRuntime.jsx("div", {
2751
- children: "Create Time"
2752
- }), showDescription && /*#__PURE__*/jsxRuntime.jsx("div", {
2753
- children: "Description"
2754
- })]
2755
- }),
2756
- dataSource: dataSource,
2757
- rowKey: "id",
2758
- renderItem: item => /*#__PURE__*/jsxRuntime.jsx(antd.List.Item, {
2759
- className: "list-item ".concat(selectedPresetId === item.id ? 'selected' : ''),
2760
- style: {
2761
- padding: "9px 24px"
2762
- },
2763
- onClick: () => onSelectPreset(item),
2764
- children: /*#__PURE__*/jsxRuntime.jsxs("div", {
2765
- className: "grid ".concat(gridColumns, " w-full text-text-normal"),
2766
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
2767
- title: item.name,
2768
- children: item.name || "Untitled Preset"
2769
- }), /*#__PURE__*/jsxRuntime.jsx("div", {
2770
- children: item.create_time
2771
- }), showDescription && /*#__PURE__*/jsxRuntime.jsx("div", {
2772
- children: item.description
2773
- })]
2774
- })
2775
- }),
2776
- locale: {
2777
- emptyText: /*#__PURE__*/jsxRuntime.jsx("div", {
2778
- className: "p-8",
2779
- children: /*#__PURE__*/jsxRuntime.jsx(antd.Empty, {
2780
- image: antd.Empty.PRESENTED_IMAGE_SIMPLE,
2781
- description: /*#__PURE__*/jsxRuntime.jsx("span", {
2782
- className: "text-gray-400",
2783
- children: /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
2784
- type: "link",
2785
- onClick: onAddNew,
2786
- className: "p-0 h-auto",
2787
- icon: /*#__PURE__*/jsxRuntime.jsx(icons.PlusOutlined, {}),
2788
- children: "Create new preset"
2789
- })
2790
- })
2791
- })
2792
- })
2793
- }
2794
- })
2795
- }), hasPresets && /*#__PURE__*/jsxRuntime.jsx("div", {
2796
- className: "p-4",
2797
- style: {
2798
- paddingInline: 24
2799
- },
2800
- children: /*#__PURE__*/jsxRuntime.jsxs(antd.Space, {
2801
- size: "middle",
2802
- children: [/*#__PURE__*/jsxRuntime.jsx(antd.Button, {
2803
- type: "default",
2804
- icon: /*#__PURE__*/jsxRuntime.jsx(icons.PlusOutlined, {}),
2805
- style: {
2806
- padding: "20px 12px"
2807
- },
2808
- className: "btn-gray",
2809
- onClick: onAddNew,
2810
- children: texts.newButton
2811
- }), /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
2812
- type: "default",
2813
- style: {
2814
- padding: "20px 12px"
2815
- },
2816
- className: "btn-gray",
2817
- onClick: onRemove,
2818
- children: texts.removeButton
2819
- })]
2820
- })
2821
- })]
2822
- });
2823
- });
2824
- const SubmitButton = _ref2 => {
2825
- let {
2826
- loading,
2827
- action,
2828
- children,
2829
- disabled = false
2830
- } = _ref2;
2831
- return /*#__PURE__*/jsxRuntime.jsx("div", {
2832
- className: "submit-btn-wrapper",
2833
- children: /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
2834
- className: "btn-gray",
2835
- loading: loading,
2836
- onClick: action,
2837
- disabled: disabled,
2838
- children: children
2839
- })
2840
- });
2841
- };
2842
- const RightDetailForm = /*#__PURE__*/react.memo(_ref3 => {
2843
- let {
2844
- form,
2845
- onSave,
2846
- onLoad,
2847
- isLoading,
2848
- isEditing,
2849
- originalPresetData,
2850
- fields = {
2851
- name: {
2852
- label: "Preset Name",
2853
- placeholder: "Enter preset name",
2854
- required: true
2855
- }
2856
- },
2857
- texts = {
2858
- loadButton: "Load",
2859
- saveButton: "Save"
2860
- },
2861
- presetChanged
2862
- } = _ref3;
2863
- const [initialSelected, setInitialSelected] = react.useState([]);
2864
- const currentSelected = antd.Form.useWatch('category_list', form) || [];
3075
+ factoryWithThrowingShims = function() {
3076
+ function shim(props, propName, componentName, location, propFullName, secret) {
3077
+ if (secret === ReactPropTypesSecret) {
3078
+ // It is still safe when called from React.
3079
+ return;
3080
+ }
3081
+ var err = new Error(
3082
+ 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
3083
+ 'Use PropTypes.checkPropTypes() to call them. ' +
3084
+ 'Read more at http://fb.me/use-check-prop-types'
3085
+ );
3086
+ err.name = 'Invariant Violation';
3087
+ throw err;
3088
+ } shim.isRequired = shim;
3089
+ function getShim() {
3090
+ return shim;
3091
+ } // Important!
3092
+ // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
3093
+ var ReactPropTypes = {
3094
+ array: shim,
3095
+ bigint: shim,
3096
+ bool: shim,
3097
+ func: shim,
3098
+ number: shim,
3099
+ object: shim,
3100
+ string: shim,
3101
+ symbol: shim,
2865
3102
 
2866
- // 检查是否包含category_list字段
2867
- const hasCategoryList = fields.category_list !== null && fields.category_list !== undefined;
3103
+ any: shim,
3104
+ arrayOf: getShim,
3105
+ element: shim,
3106
+ elementType: shim,
3107
+ instanceOf: getShim,
3108
+ node: shim,
3109
+ objectOf: getShim,
3110
+ oneOf: getShim,
3111
+ oneOfType: getShim,
3112
+ shape: getShim,
3113
+ exact: getShim,
2868
3114
 
2869
- // 初始化 category_list 的选择状态
2870
- react.useEffect(() => {
2871
- if (hasCategoryList) {
2872
- const currentValue = form.getFieldValue('category_list') || [];
2873
- setInitialSelected(currentValue);
2874
- }
2875
- }, [presetChanged, form, hasCategoryList]); // 当presetChanged变化时更新
3115
+ checkPropTypes: emptyFunctionWithReset,
3116
+ resetWarningCache: emptyFunction
3117
+ };
2876
3118
 
2877
- // 动态生成 checkbox 选项
2878
- const checkboxOptions = react.useMemo(() => {
2879
- if (!hasCategoryList) return [];
2880
- return fields.category_list.options.map(category => {
2881
- const isInitiallySelected = initialSelected.includes(category.name);
2882
- const shouldDisable = isEditing ? !isInitiallySelected : false;
2883
- return _objectSpread2(_objectSpread2({}, category), {}, {
2884
- disabled: shouldDisable,
2885
- initiallySelected: isInitiallySelected
2886
- });
2887
- });
2888
- }, [initialSelected, isEditing, hasCategoryList, fields.category_list]);
2889
- const handleCheckboxChange = checkedValues => {
2890
- form.setFieldsValue({
2891
- category_list: checkedValues
2892
- });
2893
- };
2894
- const handleLoad = async () => {
2895
- try {
2896
- const formValues = await form.validateFields();
2897
- const loadData = {
2898
- id: form.getFieldValue('id'),
2899
- // 优先使用表单中的 category_list,如果没有则使用原始数据
2900
- name: originalPresetData.name,
2901
- category_list: hasCategoryList ? formValues.category_list || [] : (originalPresetData === null || originalPresetData === void 0 ? void 0 : originalPresetData.category_list) || []
2902
- };
2903
- await onLoad(loadData);
2904
- } catch (error) {
2905
- console.error('表单验证失败:', error);
2906
- }
2907
- };
2908
- return /*#__PURE__*/jsxRuntime.jsxs(antd.Flex, {
2909
- vertical: true,
2910
- className: "h-full",
2911
- children: [/*#__PURE__*/jsxRuntime.jsxs(antd.Form, {
2912
- form: form,
2913
- layout: "vertical",
2914
- autoComplete: "off",
2915
- style: {
2916
- flex: 1,
2917
- overflowY: 'auto'
2918
- },
2919
- children: [/*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
2920
- name: "name",
2921
- label: fields.name.label,
2922
- rules: [{
2923
- required: fields.name.required,
2924
- validator: async (_, value) => {
2925
- if (!value || value.trim() === '') {
2926
- return Promise.reject(new Error('Preset name cannot be empty or spaces only'));
2927
- }
2928
- }
2929
- }],
2930
- children: /*#__PURE__*/jsxRuntime.jsx(antd.Input, {
2931
- placeholder: fields.name.placeholder,
2932
- disabled: isEditing
2933
- })
2934
- }), hasCategoryList && /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
2935
- name: "category_list",
2936
- label: fields.category_list.label,
2937
- rules: [{
2938
- required: fields.category_list.required,
2939
- message: 'Please select at least one category',
2940
- validator: (_, value) => {
2941
- if (value && value.length > 0) {
2942
- return Promise.resolve();
2943
- }
2944
- return Promise.reject(new Error('Please select at least one category'));
2945
- }
2946
- }],
2947
- children: /*#__PURE__*/jsxRuntime.jsx(antd.Checkbox.Group, {
2948
- className: "grid grid-cols-2 gap-2",
2949
- onChange: handleCheckboxChange,
2950
- children: checkboxOptions.map(category => /*#__PURE__*/jsxRuntime.jsx(antd.Checkbox, {
2951
- value: category.name,
2952
- disabled: category.disabled,
2953
- children: category.label
2954
- }, category.name))
2955
- })
2956
- }), fields.description && /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
2957
- name: "description",
2958
- label: fields.description.label,
2959
- children: /*#__PURE__*/jsxRuntime.jsx(antd.Input.TextArea, {
2960
- rows: 4,
2961
- placeholder: fields.description.placeholder,
2962
- disabled: isEditing
2963
- })
2964
- })]
2965
- }), isEditing ? /*#__PURE__*/jsxRuntime.jsx(SubmitButton, _objectSpread2(_objectSpread2({
2966
- action: handleLoad
2967
- }, hasCategoryList && {
2968
- disabled: !currentSelected.length
2969
- }), {}, {
2970
- children: texts.loadButton
2971
- })) : /*#__PURE__*/jsxRuntime.jsx(SubmitButton, {
2972
- action: onSave,
2973
- loading: isLoading,
2974
- children: texts.saveButton
2975
- })]
2976
- });
2977
- });
3119
+ ReactPropTypes.PropTypes = ReactPropTypes;
2978
3120
 
2979
- const Preset = _ref => {
2980
- let {
2981
- open,
2982
- onClose,
2983
- // API 方法通过 props 传入
2984
- getPresetList,
2985
- savePreset,
2986
- removePreset,
2987
- loadPreset,
2988
- onLoadSuccess,
2989
- // 加载成功后的回调
2990
- onLoadError,
2991
- // 加载失败后的回调
2992
- // 字段配置
2993
- fields = {
2994
- name: {
2995
- label: "Preset Name",
2996
- placeholder: "Enter preset name",
2997
- required: true
2998
- }
2999
- },
3000
- texts = {
3001
- title: "Preset Management",
3002
- emptyText: "Select a preset from the list to view details",
3003
- deleteConfirm: "Are you sure to delete preset",
3004
- loadConfirm: "Are you sure you want to load preset",
3005
- loadText: "Loading...",
3006
- successText: "Success",
3007
- newButton: "New Preset",
3008
- removeButton: "Remove",
3009
- loadButton: "Load",
3010
- saveButton: "Save"
3011
- },
3012
- // 样式定制
3013
- width = 1000,
3014
- height = 680,
3015
- className = ""
3016
- } = _ref;
3017
- const {
3018
- message: AntdMessage,
3019
- modal: AntdModal
3020
- } = antd.App.useApp();
3021
- const [presetList, setPresetList] = react.useState([]);
3022
- const [selectedPreset, setSelectedPreset] = react.useState(null);
3023
- const [loading, setLoading] = react.useState(false);
3024
- const [presetChanged, setPresetChanged] = react.useState(0);
3025
- const [form] = antd.Form.useForm();
3121
+ return ReactPropTypes;
3122
+ };
3123
+ return factoryWithThrowingShims;
3124
+ }
3026
3125
 
3027
- // 获取预设列表
3028
- react.useEffect(() => {
3029
- fetchPresetList();
3030
- }, []);
3031
- const fetchPresetList = react.useCallback(async () => {
3032
- try {
3033
- const data = await getPresetList();
3034
- const presets = (data === null || data === void 0 ? void 0 : data.preset_list) || data || [];
3035
- setPresetList(presets);
3036
- } catch (error) {
3037
- console.error('Failed to fetch preset list:', error);
3038
- }
3039
- }, [getPresetList]);
3040
- const handleSelectPreset = react.useCallback(preset => {
3041
- setSelectedPreset(preset);
3042
- form.setFieldsValue(preset);
3043
- setPresetChanged(prev => prev + 1); // 触发react更新
3044
- }, [form]);
3045
- const handleAddNew = react.useCallback(() => {
3046
- var _fields$category_list;
3047
- const unsavedPreset = presetList.find(item => !item.id);
3048
- if (unsavedPreset) {
3049
- AntdMessage.warning('Existing unsaved preset detected.');
3050
- return;
3051
- }
3126
+ /**
3127
+ * Copyright (c) 2013-present, Facebook, Inc.
3128
+ *
3129
+ * This source code is licensed under the MIT license found in the
3130
+ * LICENSE file in the root directory of this source tree.
3131
+ */
3052
3132
 
3053
- // 创建新的数据,包含所有配置的字段
3054
- const newPreset = Object.keys(fields).reduce((acc, fieldName) => {
3055
- acc[fieldName] = '';
3056
- return acc;
3057
- }, {});
3133
+ var hasRequiredPropTypes;
3058
3134
 
3059
- // 特殊处理 category_list
3060
- if ((_fields$category_list = fields.category_list) !== null && _fields$category_list !== void 0 && _fields$category_list.options) {
3061
- newPreset.category_list = fields.category_list.options.map(item => item.name);
3062
- }
3063
- setPresetList([...presetList, newPreset]);
3064
- setSelectedPreset(newPreset);
3065
- form.setFieldsValue(newPreset);
3066
- }, [form, presetList, AntdMessage]);
3067
- const handleRemove = react.useCallback(async () => {
3068
- if (!selectedPreset) return;
3135
+ function requirePropTypes () {
3136
+ if (hasRequiredPropTypes) return propTypes.exports;
3137
+ hasRequiredPropTypes = 1;
3138
+ if (process.env.NODE_ENV !== 'production') {
3139
+ var ReactIs = requireReactIs();
3069
3140
 
3070
- // 检查是否为新建的未保存数据(无id)
3071
- const isUnsavedPreset = !selectedPreset.id;
3072
- const presetName = selectedPreset.name || 'Untitled Preset';
3141
+ // By explicitly using `prop-types` you are opting into new development behavior.
3142
+ // http://fb.me/prop-types-in-prod
3143
+ var throwOnDirectAccess = true;
3144
+ propTypes.exports = /*@__PURE__*/ requireFactoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
3145
+ } else {
3146
+ // By explicitly using `prop-types` you are opting into new production behavior.
3147
+ // http://fb.me/prop-types-in-prod
3148
+ propTypes.exports = /*@__PURE__*/ requireFactoryWithThrowingShims()();
3149
+ }
3150
+ return propTypes.exports;
3151
+ }
3152
+
3153
+ var propTypesExports = /*@__PURE__*/ requirePropTypes();
3154
+ var PropTypes = /*@__PURE__*/getDefaultExportFromCjs(propTypesExports);
3155
+
3156
+ const SystemOperations = _ref => {
3157
+ let {
3158
+ onPowerOff,
3159
+ onRestart,
3160
+ powerOffLabel = "Power Off",
3161
+ restartLabel = "Restart",
3162
+ iconClassName = "seeder-iconfont seeder-icon-guanji1 text-xl text-neutral-400",
3163
+ confirmTitle = "Confirm",
3164
+ cancelText = "No",
3165
+ okText = "Yes",
3166
+ run
3167
+ } = _ref;
3168
+ const {
3169
+ modal: AntdModal
3170
+ } = antd.App.useApp();
3171
+ const menuItems = [{
3172
+ key: "poweroff",
3173
+ label: powerOffLabel
3174
+ },
3175
+ // {
3176
+ // key: "reboot",
3177
+ // label: rebootLabel, // 硬重启 物理重启
3178
+ // },
3179
+ {
3180
+ key: "restart",
3181
+ label: restartLabel // 软重启 服务重启
3182
+ }];
3183
+ const doAction = action => {
3073
3184
  try {
3074
3185
  AntdModal.confirm({
3075
3186
  icon: /*#__PURE__*/jsxRuntime.jsx(icons.ExclamationCircleFilled, {}),
3076
- title: 'Delete Preset',
3077
- content: "".concat(texts.deleteConfirm, " \"").concat(presetName, "\"?"),
3078
- cancelText: 'No',
3079
- okText: 'Yes',
3080
- onOk: async () => {
3081
- if (!isUnsavedPreset) {
3082
- await removePreset({
3083
- id: selectedPreset.id
3084
- });
3085
- AntdMessage.success(texts.successText);
3086
- // 刷新列表
3087
- await fetchPresetList();
3088
- } else {
3089
- setPresetList(prev => prev.filter(item => !!item.id));
3187
+ title: "".concat(confirmTitle, " ").concat(action, "?"),
3188
+ cancelText,
3189
+ okText,
3190
+ onOk: () => {
3191
+ if (action === 'poweroff' && onPowerOff) {
3192
+ onPowerOff();
3193
+ } else if (action === 'restart' && onRestart) {
3194
+ onRestart();
3090
3195
  }
3091
3196
 
3092
- // 重置表单和选择状态
3093
- setSelectedPreset(null);
3094
- form.resetFields();
3197
+ // Call the run callback after successful operation
3198
+ if (typeof run === 'function') {
3199
+ run();
3200
+ }
3095
3201
  }
3096
3202
  });
3097
3203
  } catch (error) {
3098
- console.error('Failed to delete preset:', error);
3204
+ console.error("".concat(action.toUpperCase(), " ERROR: "), error);
3099
3205
  }
3100
- }, [selectedPreset, form, AntdModal, AntdMessage, fetchPresetList, texts]);
3101
- const handleLoadPreset = react.useCallback(async loadData => {
3102
- if (!loadData) return;
3103
-
3104
- // 显示确认对话框
3105
- AntdModal.confirm({
3106
- title: 'Load Preset',
3107
- content: "".concat(texts.loadConfirm, " \"").concat(loadData.name, "\"?"),
3108
- cancelText: 'No',
3109
- okText: 'Yes',
3110
- onOk: async () => {
3111
- // 显示加载模态框
3112
- const modalInstance = antd.Modal.info({
3113
- title: texts.loadText,
3114
- content: /*#__PURE__*/jsxRuntime.jsx(antd.Spin, {
3115
- size: "large",
3116
- className: "block mx-auto"
3117
- }),
3118
- maskClosable: false,
3119
- okButtonProps: {
3120
- style: {
3121
- display: 'none'
3122
- }
3123
- }
3124
- });
3125
- try {
3126
- await loadPreset(_objectSpread2({
3127
- id: loadData.id
3128
- }, loadData.category_list && {
3129
- category_list: loadData.category_list
3130
- }));
3131
- // 成功时延迟关闭
3132
- setTimeout(() => {
3133
- modalInstance.destroy();
3134
- AntdMessage.success(texts.successText);
3206
+ };
3207
+ const handleMenuClick = _ref2 => {
3208
+ let {
3209
+ key
3210
+ } = _ref2;
3211
+ doAction(key);
3212
+ };
3213
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Dropdown, {
3214
+ menu: {
3215
+ items: menuItems,
3216
+ onClick: handleMenuClick
3217
+ },
3218
+ trigger: ["hover"],
3219
+ children: /*#__PURE__*/jsxRuntime.jsx("a", {
3220
+ onClick: e => e.preventDefault(),
3221
+ children: /*#__PURE__*/jsxRuntime.jsx("i", {
3222
+ className: iconClassName
3223
+ })
3224
+ })
3225
+ });
3226
+ };
3227
+ SystemOperations.propTypes = {
3228
+ onPowerOff: PropTypes.func,
3229
+ onRestart: PropTypes.func,
3230
+ powerOffLabel: PropTypes.string,
3231
+ restartLabel: PropTypes.string,
3232
+ iconClassName: PropTypes.string,
3233
+ confirmTitle: PropTypes.string,
3234
+ cancelText: PropTypes.string,
3235
+ okText: PropTypes.string,
3236
+ run: PropTypes.func
3237
+ };
3238
+ var SystemOperations$1 = SystemOperations;
3135
3239
 
3136
- // 加载成功的外部回调
3137
- if (onLoadSuccess) {
3138
- onLoadSuccess(loadData);
3139
- }
3140
- }, 1000);
3141
- } catch (error) {
3142
- console.error('Failed to load preset:', error);
3143
- modalInstance.destroy();
3240
+ const logoBase64 = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABLAAAAGaCAYAAAAfLro4AAAACXBIWXMAAA9hAAAPYQGoP6dpAAAGj2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNi4wLWMwMDIgNzkuMTY0NDg4LCAyMDIwLzA3LzEwLTIyOjA2OjUzICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIH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
3242
+ window.location.href = window.location.origin;
3243
+ };
3244
+ const useSpaLogo = function () {
3245
+ let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
3246
+ const {
3247
+ logoUrl = logoBase64,
3248
+ // 使用者传入 logo URL
3249
+ logoWidth = 100,
3250
+ logoAlt = 'logo',
3251
+ onClick = defaultResetRoute,
3252
+ buttonStyle = {
3253
+ padding: 0,
3254
+ lineHeight: 1,
3255
+ height: 'auto',
3256
+ borderStyle: 'none',
3257
+ display: 'inline-block'
3258
+ }
3259
+ } = props;
3144
3260
 
3145
- // 加载失败的外部回调
3146
- if (onLoadError) {
3147
- onLoadError(error, loadData);
3148
- }
3149
- }
3261
+ // 如果没有提供 logoUrl,返回空
3262
+ if (!logoUrl) {
3263
+ return [null];
3264
+ }
3265
+ return [/*#__PURE__*/jsxRuntime.jsx(antd.Button, {
3266
+ type: "link",
3267
+ style: buttonStyle,
3268
+ onClick: onClick,
3269
+ children: /*#__PURE__*/jsxRuntime.jsx("img", {
3270
+ alt: logoAlt,
3271
+ src: logoUrl,
3272
+ style: {
3273
+ width: logoWidth
3150
3274
  }
3151
- });
3152
- }, [loadPreset, texts, AntdMessage, AntdModal, onLoadSuccess, onLoadError]);
3153
- const handleSave = react.useCallback(async () => {
3154
- setLoading(true);
3155
- try {
3156
- const values = await form.validateFields();
3157
- console.log('Form values:', values);
3158
- await savePreset(values);
3159
- AntdMessage.success(texts.successText);
3160
- // 刷新列表
3161
- await fetchPresetList();
3275
+ })
3276
+ }, "logo")];
3277
+ };
3278
+ useSpaLogo.propTypes = {
3279
+ logoUrl: PropTypes.string,
3280
+ logoWidth: PropTypes.number,
3281
+ logoAlt: PropTypes.string,
3282
+ onClick: PropTypes.func
3283
+ };
3284
+ var useSpaLogo$1 = useSpaLogo;
3162
3285
 
3163
- // 重置表单和选择状态
3164
- setSelectedPreset(null);
3165
- form.resetFields();
3166
- } catch (error) {
3167
- if (error.errorFields) {
3168
- // 表单验证错误
3169
- console.error('Form validation failed:', error.errorFields);
3170
- } else {
3171
- console.error('Failed to save preset:', error);
3172
- }
3173
- } finally {
3174
- setLoading(false);
3175
- }
3176
- }, [form, AntdMessage, fetchPresetList, savePreset, texts]);
3177
- return /*#__PURE__*/jsxRuntime.jsx(antd.Modal, {
3178
- title: texts.title,
3179
- width: width,
3180
- open: open,
3181
- wrapClassName: "preset-management ".concat(className),
3182
- footer: null,
3183
- onCancel: onClose,
3184
- centered: true,
3185
- styles: {
3186
- body: {
3187
- height: "".concat(height, "px")
3188
- }
3189
- },
3190
- children: /*#__PURE__*/jsxRuntime.jsxs(antd.Row, {
3191
- gutter: 0,
3192
- className: "h-full w-full",
3193
- children: [/*#__PURE__*/jsxRuntime.jsx(antd.Col, {
3194
- span: 14,
3195
- className: "h-full",
3196
- children: /*#__PURE__*/jsxRuntime.jsx(LeftList, {
3197
- dataSource: presetList,
3198
- selectedPresetId: selectedPreset === null || selectedPreset === void 0 ? void 0 : selectedPreset.id,
3199
- onSelectPreset: handleSelectPreset,
3200
- onAddNew: handleAddNew,
3201
- onRemove: handleRemove,
3202
- showDescription: !!fields.description // 根据 fields 判断是否显示 description
3203
- ,
3204
- texts: {
3205
- newButton: texts.newButton,
3206
- removeButton: texts.removeButton
3207
- }
3208
- })
3209
- }), /*#__PURE__*/jsxRuntime.jsx(antd.Col, {
3210
- span: 10,
3211
- className: "h-full p-6",
3212
- children: selectedPreset ? /*#__PURE__*/jsxRuntime.jsx(RightDetailForm, {
3213
- form: form,
3214
- onSave: handleSave,
3215
- onLoad: handleLoadPreset,
3216
- isLoading: loading,
3217
- isEditing: !!(selectedPreset !== null && selectedPreset !== void 0 && selectedPreset.id),
3218
- originalPresetData: selectedPreset // 传递原始数据
3219
- ,
3220
- fields: fields,
3221
- texts: {
3222
- loadButton: texts.loadButton,
3223
- saveButton: texts.saveButton
3286
+ const defaultGetSocketUrl = url => {
3287
+ if (window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1') {
3288
+ return "ws://127.0.0.1:".concat(window.location.port).concat(url);
3289
+ }
3290
+ return "ws://".concat(window.location.host).concat(url);
3291
+ };
3292
+
3293
+ /**
3294
+ * 通用 Header 组件
3295
+ * @param {Object} props
3296
+ * @param {React.ReactNode} props.menuElement - 菜单元素
3297
+ * @param {Object} props.productInfo - 产品信息 { productName, version }
3298
+ * @param {boolean} props.showLogo - 是否显示Logo
3299
+ * @param {boolean} props.showProductInfo - 是否显示产品信息
3300
+ * @param {boolean} props.showHardwareUsage - 是否显示硬件使用情况
3301
+ * @param {boolean} props.showSystemOperations - 是否显示系统操作
3302
+ * @param {Function} props.onPowerOff - 关机函数
3303
+ * @param {Function} props.onRestart - 重启函数
3304
+ * @param {Function} props.onRun - 运行函数(用于SystemOperations)
3305
+ * @param {string} props.hardwareMonitorUrl - 硬件监控WebSocket地址
3306
+ * @param {Function} props.getSocketUrl - 获取WebSocket URL的函数
3307
+ * @param {Object} props.logoProps - Logo组件属性
3308
+ * @param {string} props.className - 自定义类名
3309
+ * @param {Object} props.style - 自定义样式
3310
+ */
3311
+ const CommonHeader = _ref => {
3312
+ let {
3313
+ menuElement,
3314
+ productInfo = {},
3315
+ showLogo = true,
3316
+ showProductInfo = true,
3317
+ showHardwareUsage = true,
3318
+ showSystemOperations = true,
3319
+ onPowerOff,
3320
+ onRestart,
3321
+ onRun,
3322
+ hardwareMonitorUrl = '/ws/psmonitor/status_update',
3323
+ getSocketUrl = defaultGetSocketUrl,
3324
+ logoProps = {},
3325
+ className = '',
3326
+ style = {}
3327
+ } = _ref;
3328
+ const [logo] = useSpaLogo$1(logoProps);
3329
+
3330
+ // 系统资源使用情况
3331
+ const usageElement = useHardwareUsage$1(getSocketUrl(hardwareMonitorUrl));
3332
+ return /*#__PURE__*/jsxRuntime.jsxs(antd.Flex, {
3333
+ justify: "space-between",
3334
+ align: "center",
3335
+ className: "common-header ".concat(className),
3336
+ style: style,
3337
+ children: [/*#__PURE__*/jsxRuntime.jsxs(antd.Space, {
3338
+ size: 12,
3339
+ children: [showLogo && logo, showProductInfo && /*#__PURE__*/jsxRuntime.jsxs(antd.Flex, {
3340
+ align: "center",
3341
+ gap: 8,
3342
+ children: [productInfo.productName && /*#__PURE__*/jsxRuntime.jsx(antd.Typography.Title, {
3343
+ level: 4,
3344
+ style: {
3345
+ marginBottom: 0
3224
3346
  },
3225
- presetChanged: presetChanged
3226
- }) : /*#__PURE__*/jsxRuntime.jsx(antd.Flex, {
3227
- vertical: true,
3228
- justify: "center",
3229
- align: "center",
3230
- className: "h-full text-gray-400",
3231
- children: /*#__PURE__*/jsxRuntime.jsx(antd.Empty, {
3232
- image: antd.Empty.PRESENTED_IMAGE_SIMPLE,
3233
- description: texts.emptyText
3347
+ children: productInfo.productName
3348
+ }), productInfo.version && /*#__PURE__*/jsxRuntime.jsx(antd.Typography.Text, {
3349
+ style: {
3350
+ position: 'relative',
3351
+ top: 6,
3352
+ left: -6
3353
+ },
3354
+ children: productInfo.version
3355
+ })]
3356
+ })]
3357
+ }), /*#__PURE__*/jsxRuntime.jsxs(antd.Flex, {
3358
+ align: "center",
3359
+ gap: 10,
3360
+ children: [showHardwareUsage && usageElement, /*#__PURE__*/jsxRuntime.jsxs("div", {
3361
+ className: "header-controls",
3362
+ children: [menuElement && /*#__PURE__*/jsxRuntime.jsx("div", {
3363
+ className: "control-icon",
3364
+ children: menuElement
3365
+ }), showSystemOperations && /*#__PURE__*/jsxRuntime.jsx("div", {
3366
+ className: "control-icon",
3367
+ children: /*#__PURE__*/jsxRuntime.jsx(SystemOperations$1, {
3368
+ onPowerOff: onPowerOff,
3369
+ onRestart: onRestart,
3370
+ run: onRun
3234
3371
  })
3235
- })
3372
+ })]
3236
3373
  })]
3237
- })
3374
+ })]
3238
3375
  });
3239
3376
  };
3240
- var PresetModal = /*#__PURE__*/react.memo(Preset);
3377
+
3378
+ // PropTypes 类型检查
3379
+ CommonHeader.propTypes = {
3380
+ menuElement: PropTypes.node,
3381
+ productInfo: PropTypes.shape({
3382
+ productName: PropTypes.string,
3383
+ version: PropTypes.string
3384
+ }),
3385
+ showLogo: PropTypes.bool,
3386
+ showProductInfo: PropTypes.bool,
3387
+ showHardwareUsage: PropTypes.bool,
3388
+ showSystemOperations: PropTypes.bool,
3389
+ onPowerOff: PropTypes.func,
3390
+ onRestart: PropTypes.func,
3391
+ onRun: PropTypes.func,
3392
+ hardwareMonitorUrl: PropTypes.string,
3393
+ getSocketUrl: PropTypes.func,
3394
+ logoProps: PropTypes.object,
3395
+ className: PropTypes.string,
3396
+ style: PropTypes.object
3397
+ };
3398
+ var CommonHeader$1 = CommonHeader;
3241
3399
 
3242
3400
  exports.AuthorizationModal = AuthorizationModal$1;
3401
+ exports.CommonHeader = CommonHeader$1;
3243
3402
  exports.NetworkSettingsModal = NetworkSettingsModal$1;
3244
3403
  exports.PresetModal = PresetModal;
3245
3404
  exports.PtpModal = PtpModal$1;