@rfkit/charts 1.4.1 → 1.4.3

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.
Files changed (39) hide show
  1. package/components/AxisY/heatmap/index.d.ts +1 -1
  2. package/components/AxisY/spectrum/index.d.ts +1 -1
  3. package/components/AxisY/spectrum/presenters/TicksPanel/index.d.ts +1 -1
  4. package/components/AxisY/spectrum/tools.d.ts +1 -1
  5. package/components/AxisY/spectrum/useRanging/index.d.ts +1 -1
  6. package/components/AxisY/spectrum/useRanging/ranging.d.ts +3 -3
  7. package/components/Cursor/tools.d.ts +3 -1
  8. package/components/EventBus/useKeyEvent.d.ts +1 -1
  9. package/components/ui/button.d.ts +8 -8
  10. package/components/ui/dialog.d.ts +1 -1
  11. package/components/ui/dropdown-menu.d.ts +1 -1
  12. package/components/ui/panel.d.ts +4 -4
  13. package/components/ui/tooltip.d.ts +1 -1
  14. package/components/ui/useChartsPortalContainer.d.ts +1 -1
  15. package/hooks/publish/usePublish.d.ts +1 -1
  16. package/hooks/spectrum/useSpectrumRule.d.ts +1 -1
  17. package/hooks/useChart/index.d.ts +1 -1
  18. package/hooks/useDragSelect.d.ts +1 -1
  19. package/hooks/useLevelStreamAnalyzer.d.ts +1 -1
  20. package/index.js +197 -140
  21. package/modules/Spectrum/AxisYCanvas/index.d.ts +2 -2
  22. package/modules/Spectrum/AxisYCanvas/useCanvasAxisY.d.ts +4 -4
  23. package/modules/Spectrum/FrequencyAllocation/model/useAllocationAtCursor.d.ts +1 -1
  24. package/modules/Spectrum/Markers/hooks/useMarkerEvents.d.ts +2 -2
  25. package/modules/Spectrum/Markers/hooks/useMarkers.d.ts +2 -2
  26. package/modules/Spectrum/Markers/tools.d.ts +3 -3
  27. package/modules/Spectrum/Signal/model/useStationInfoAtCursor.d.ts +1 -1
  28. package/modules/base/BaseRenderer.d.ts +2 -2
  29. package/modules/base/GradientRenderer.d.ts +4 -4
  30. package/package.json +1 -1
  31. package/store/Params.d.ts +1 -1
  32. package/store/context.d.ts +1 -1
  33. package/store/globalState.d.ts +2 -1
  34. package/theme/style-scope.d.ts +1 -1
  35. package/theme/theme-contract.d.ts +1 -1
  36. package/utils/converter.d.ts +1 -1
  37. package/utils/series/events.d.ts +4 -4
  38. package/utils/series/subscription.d.ts +1 -1
  39. package/utils/subscription.d.ts +1 -1
package/index.js CHANGED
@@ -4750,9 +4750,10 @@ const generateFrequencyCache = (config)=>{
4750
4750
  };
4751
4751
  const leftSegments2frequency = (segments)=>{
4752
4752
  if (!segments?.length) return ()=>'';
4753
- const { totalPoints } = segments;
4753
+ const totalPoints = segments.totalPoints;
4754
4754
  const segmentInfo = segments.map((segment, index)=>{
4755
- const { point, frequencyCache } = segment;
4755
+ const { point } = segment;
4756
+ const frequencyCache = segment.frequencyCache;
4756
4757
  const ll = 100 * point / totalPoints;
4757
4758
  return {
4758
4759
  ll,
@@ -4798,7 +4799,7 @@ const scopeLeftSegments2bandwidth = (e)=>{
4798
4799
  if (!e) return 0;
4799
4800
  const { segments } = e;
4800
4801
  if (!segments) return 0;
4801
- const { totalPoints } = segments;
4802
+ const totalPoints = segments.totalPoints;
4802
4803
  let { endLeft, startLeft } = e;
4803
4804
  const diff = endLeft - startLeft;
4804
4805
  const diffabs = Math.abs(diff);
@@ -4977,17 +4978,18 @@ function calculateRoughIndexRange(range, segment) {
4977
4978
  function findPreciseIndexRange(range, segment, searchRange = SEARCH_RANGE) {
4978
4979
  const rough = calculateRoughIndexRange(range, segment);
4979
4980
  let { startIndex, stopIndex } = rough;
4981
+ const frequencyCache = segment.frequencyCache;
4980
4982
  let bestStartIndex = startIndex;
4981
4983
  let bestStopIndex = stopIndex;
4982
4984
  for(let i = Math.max(0, startIndex - searchRange); i <= Math.min(segment.point - 1, startIndex + searchRange); i++){
4983
- const freq = Number(segment.frequencyCache[i]?.frequency);
4985
+ const freq = Number(frequencyCache[i]?.frequency);
4984
4986
  if (freq >= range.startFreq) {
4985
4987
  bestStartIndex = i;
4986
4988
  break;
4987
4989
  }
4988
4990
  }
4989
4991
  for(let i = Math.max(0, stopIndex - searchRange); i <= Math.min(segment.point - 1, stopIndex + searchRange); i++){
4990
- const freq = Number(segment.frequencyCache[i]?.frequency);
4992
+ const freq = Number(frequencyCache[i]?.frequency);
4991
4993
  if (freq <= range.stopFreq) bestStopIndex = i;
4992
4994
  if (freq > range.stopFreq) break;
4993
4995
  }
@@ -5192,7 +5194,7 @@ var signal_SignalDataType = /*#__PURE__*/ function(SignalDataType) {
5192
5194
  SignalDataType["Simple"] = "simple";
5193
5195
  return SignalDataType;
5194
5196
  }({});
5195
- const restrictList = {
5197
+ const constants_restrictList = {
5196
5198
  dBm: [
5197
5199
  -300,
5198
5200
  300
@@ -5208,7 +5210,7 @@ const constants_stepList = [
5208
5210
  20,
5209
5211
  30
5210
5212
  ];
5211
- const stepDefault = constants_stepList[2];
5213
+ const constants_stepDefault = constants_stepList[2];
5212
5214
  const constants_unitList = [
5213
5215
  "dB\u03BCV",
5214
5216
  "dB\u03BCV/m",
@@ -5252,9 +5254,9 @@ function createParams() {
5252
5254
  realRange: constants_RANGE_DEFAULT,
5253
5255
  range: constants_RANGE_DEFAULT,
5254
5256
  renderRange: constants_RANGE_DEFAULT,
5255
- restrict: restrictList["dBμV"],
5257
+ restrict: constants_restrictList["dBμV"],
5256
5258
  autoranging: false,
5257
- step: stepDefault,
5259
+ step: constants_stepDefault,
5258
5260
  unit: constants_unitList["0"],
5259
5261
  unitList: constants_unitList,
5260
5262
  unitDisabled: false,
@@ -5271,7 +5273,7 @@ function createParams() {
5271
5273
  ticks: true,
5272
5274
  children: null,
5273
5275
  onChange: ()=>{},
5274
- frequencyFormat: ()=>null
5276
+ frequencyFormat: ()=>''
5275
5277
  },
5276
5278
  toolbar: {
5277
5279
  show: true,
@@ -5308,7 +5310,7 @@ function createParams() {
5308
5310
  value: [
5309
5311
  20
5310
5312
  ],
5311
- range: restrictList["dBμV"],
5313
+ range: constants_restrictList["dBμV"],
5312
5314
  label: '',
5313
5315
  onChange: ()=>{}
5314
5316
  },
@@ -5553,9 +5555,9 @@ const info2step = (info)=>{
5553
5555
  class RangeController {
5554
5556
  state = {
5555
5557
  axisY: {
5556
- step: stepDefault,
5558
+ step: constants_stepDefault,
5557
5559
  realRange: constants_RANGE_DEFAULT,
5558
- restrict: restrictList["dBμV"]
5560
+ restrict: constants_restrictList["dBμV"]
5559
5561
  },
5560
5562
  onChange: ()=>{}
5561
5563
  };
@@ -5598,7 +5600,7 @@ class RangeController {
5598
5600
  if (void 0 === avg) avg = 10;
5599
5601
  let step = propsStep || axisY.step;
5600
5602
  const allInFormat = info2step(allInfo);
5601
- const { min, max } = allInfo;
5603
+ const { min = 0, max = 0 } = allInfo;
5602
5604
  const [oldMin, oldMax] = realRange;
5603
5605
  const { middle } = allInFormat;
5604
5606
  const overflow = min < oldMin || oldMax < max;
@@ -5674,9 +5676,10 @@ class RangeController {
5674
5676
  max: mouseValue + (max - mouseValue) * zoomFactor
5675
5677
  };
5676
5678
  const [restrictMin, restrictMax] = restrict;
5679
+ const restrictSpan = Math.abs(restrictMax - restrictMin);
5677
5680
  let finalMin = Math.max(restrictMin, newRange.min);
5678
5681
  let finalMax = Math.min(restrictMax, newRange.max);
5679
- const minRange = step / 100;
5682
+ const minRange = Math.max(Number.EPSILON, Math.min(step / 100, restrictSpan / 100));
5680
5683
  if (finalMax - finalMin < minRange) {
5681
5684
  const center = (finalMin + finalMax) / 2;
5682
5685
  finalMin = Math.max(restrictMin, center - minRange / 2);
@@ -5779,14 +5782,16 @@ const useRange = ({ chart })=>{
5779
5782
  ...i,
5780
5783
  globalID
5781
5784
  });
5782
- axisY.realRange = i.realRange;
5783
- axisY.step = i.step;
5784
- axisY.range = v.range;
5785
- axisY.renderRange = v.renderRange;
5786
5785
  dispatch({
5787
- payload: {
5788
- axisY
5789
- }
5786
+ payload: (state)=>({
5787
+ axisY: {
5788
+ ...state.axisY,
5789
+ realRange: i.realRange,
5790
+ step: i.step,
5791
+ range: v.range,
5792
+ renderRange: v.renderRange
5793
+ }
5794
+ })
5790
5795
  });
5791
5796
  onChange?.({
5792
5797
  range: v.range,
@@ -5794,10 +5799,10 @@ const useRange = ({ chart })=>{
5794
5799
  });
5795
5800
  }
5796
5801
  }, [
5797
- axisY,
5798
5802
  unit,
5799
5803
  onChange,
5800
- globalID
5804
+ globalID,
5805
+ dispatch
5801
5806
  ]);
5802
5807
  (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
5803
5808
  ranging.state.onChange = (i)=>{
@@ -5819,8 +5824,9 @@ const useRange = ({ chart })=>{
5819
5824
  unit
5820
5825
  ]);
5821
5826
  (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
5822
- chart?.setRange(renderRange);
5827
+ if (renderRange) chart?.setRange?.(renderRange);
5823
5828
  }, [
5829
+ chart,
5824
5830
  renderRange
5825
5831
  ]);
5826
5832
  (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
@@ -5972,7 +5978,9 @@ const Params_Params = (props)=>{
5972
5978
  if (axisY && globalID) {
5973
5979
  const currentState = store.getState();
5974
5980
  const { range, unit } = axisY;
5975
- if (range?.[0] !== void 0 && (unit && isdBm(unit) && currentState.axisY.unit !== unit || range[0] !== currentState.axisY.range[0] && isdBm(currentState.axisY.unit))) {
5981
+ const currentRange = currentState.axisY.range;
5982
+ const currentUnit = currentState.axisY.unit;
5983
+ if (range?.[0] !== void 0 && (unit && isdBm(unit) && currentUnit !== unit || range[0] !== currentRange[0] && isdBm(currentUnit))) {
5976
5984
  const { realRange, renderRange } = range2realRange({
5977
5985
  range,
5978
5986
  unit,
@@ -17542,7 +17550,10 @@ const gradientItems = [
17542
17550
  ];
17543
17551
  const GradientRibbon = ()=>{
17544
17552
  const { state: { axisY: { range }, globalID } } = useStore_useStore();
17545
- const [minValue, maxValue] = range;
17553
+ const [minValue, maxValue] = range ?? [
17554
+ 0,
17555
+ 0
17556
+ ];
17546
17557
  const [currentIndex, setCurrentIndex] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(initialIndex);
17547
17558
  const currentColors = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>[
17548
17559
  ...gradientItems[currentIndex]
@@ -17735,7 +17746,8 @@ const DialChart = (props)=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx
17735
17746
  const Dial_Dial = withChartPublisher(DialChart, 'Dial');
17736
17747
  const charts_Dial = Dial_Dial;
17737
17748
  const InteractionSurface = ({ children, padding, limit, step, setLimit, onChange })=>{
17738
- const { state: { axisY: { range: [min, max] } } } = useStore_useStore();
17749
+ const { state: { axisY: { range = constants_RANGE_DEFAULT } } } = useStore_useStore();
17750
+ const [min, max] = range;
17739
17751
  const ref = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(null);
17740
17752
  const [down, setDown] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
17741
17753
  const toLimit = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((e)=>{
@@ -17815,7 +17827,6 @@ class GaugeRender extends BaseRenderer {
17815
17827
  const { id, props } = this.state;
17816
17828
  if (!id) return;
17817
17829
  this.state.chart = new __WEBPACK_EXTERNAL_MODULE__rfkit_renderer_d3372451__.Gauge({
17818
- id,
17819
17830
  ...getThemeFillStyle(document.getElementById(id)),
17820
17831
  ...props
17821
17832
  });
@@ -17994,7 +18005,7 @@ const ZoomViewportLayer = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.fo
17994
18005
  style: customStyle,
17995
18006
  children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
17996
18007
  className: "absolute right-0 top-0 flex h-full w-full self-center",
17997
- style: zoomStyle,
18008
+ style: zoomStyle ?? void 0,
17998
18009
  children: children
17999
18010
  })
18000
18011
  });
@@ -18004,9 +18015,9 @@ const AXIS_X_TICKS_LAYER_CLASS_NAME = 'absolute right-0 top-0 flex h-full w-full
18004
18015
  const AXIS_X_TICKS_SHELL_CLASS_NAME = 'relative h-6 w-full select-none overflow-hidden text-xs leading-6';
18005
18016
  const MSCAN_SEGMENT_CLASS_NAME = 'flex flex-1 items-center justify-center';
18006
18017
  const ThreeFixedTicks = ()=>{
18007
- const { state: { zoom: { interval: { start: intervalStart, end: intervalEnd } }, axisX: { unit, unitKHz }, segments } } = useStore_useStore();
18008
- const { totalPoints } = segments;
18009
- const endIndex = totalPoints - 1;
18018
+ const { state: { zoom: { interval: { start: intervalStart, end: intervalEnd } }, axisX: { unit = '', unitKHz = '' }, segments } } = useStore_useStore();
18019
+ const totalPoints = segments.totalPoints ?? 0;
18020
+ const endIndex = Math.max(totalPoints - 1, 0);
18010
18021
  const { start, bandwidth = 0 } = segments[0] ?? {};
18011
18022
  const center = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
18012
18023
  if (!endIndex || !bandwidth || void 0 === start) return 0;
@@ -18076,11 +18087,12 @@ const FrequencyTick = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.memo)(
18076
18087
  });
18077
18088
  const TICK_COUNT = 5;
18078
18089
  const DataNFixedTicks = ()=>{
18079
- const { state: { segments: { totalPoints }, zoom: { interval: { start: intervalStart, end: intervalEnd } }, axisX: { frequencyFormat } } } = useStore_useStore();
18090
+ const { state: { segments, zoom: { interval: { start: intervalStart, end: intervalEnd } }, axisX: { frequencyFormat } } } = useStore_useStore();
18091
+ const totalPoints = segments.totalPoints ?? 0;
18080
18092
  const getFrequencyByIndex = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((index)=>{
18081
18093
  if (!totalPoints) return 0;
18082
18094
  const percentage = Math.min(100 * index / totalPoints, 100);
18083
- return frequencyFormat(percentage);
18095
+ return frequencyFormat?.(percentage) ?? '';
18084
18096
  }, [
18085
18097
  totalPoints,
18086
18098
  frequencyFormat
@@ -18195,8 +18207,8 @@ const FlexBox = (props)=>{
18195
18207
  };
18196
18208
  const components_FlexBox = FlexBox;
18197
18209
  function tools_getAxisYDoubleClickResetRange(restrict) {
18198
- const [restrictMin, restrictMax] = restrict ?? restrictList["dBμV"];
18199
- const isDefaultRestrict = restrictMin === restrictList["dBμV"]["0"] && restrictMax === restrictList["dBμV"]["1"];
18210
+ const [restrictMin, restrictMax] = restrict ?? constants_restrictList["dBμV"];
18211
+ const isDefaultRestrict = restrictMin === constants_restrictList["dBμV"]["0"] && restrictMax === constants_restrictList["dBμV"]["1"];
18200
18212
  return isDefaultRestrict ? constants_RANGE_DEFAULT : [
18201
18213
  restrictMin,
18202
18214
  restrictMax
@@ -19993,6 +20005,10 @@ function useSpectrumChartType({ type, heatmapElementID }) {
19993
20005
  };
19994
20006
  }
19995
20007
  if (type === constants_ChartType.LiteNormalized) {
20008
+ const nextRestrict = nextAxisY.restrict ?? [
20009
+ 0,
20010
+ 1
20011
+ ];
19996
20012
  if (false !== nextLimit.show) nextLimit = {
19997
20013
  ...nextLimit,
19998
20014
  show: false
@@ -20001,7 +20017,7 @@ function useSpectrumChartType({ type, heatmapElementID }) {
20001
20017
  ...nextSignal,
20002
20018
  show: false
20003
20019
  };
20004
- if (0 !== nextAxisY.restrict[0] || 1 !== nextAxisY.restrict[1]) nextAxisY = {
20020
+ if (0 !== nextRestrict[0] || 1 !== nextRestrict[1]) nextAxisY = {
20005
20021
  ...nextAxisY,
20006
20022
  restrict: [
20007
20023
  0,
@@ -20028,6 +20044,10 @@ function useSpectrumChartType({ type, heatmapElementID }) {
20028
20044
  };
20029
20045
  }
20030
20046
  if (type === constants_ChartType.ScanDF360) {
20047
+ const nextRestrict = nextAxisY.restrict ?? [
20048
+ 0,
20049
+ 360
20050
+ ];
20031
20051
  if (false !== nextLimit.show) nextLimit = {
20032
20052
  ...nextLimit,
20033
20053
  show: false
@@ -20052,7 +20072,7 @@ function useSpectrumChartType({ type, heatmapElementID }) {
20052
20072
  ...nextFrequencyAllocation,
20053
20073
  show: false
20054
20074
  };
20055
- nextAxisY = "\xb0" !== nextAxisY.unit || 36 !== nextAxisY.step || 0 !== nextAxisY.restrict[0] || 360 !== nextAxisY.restrict[1] ? {
20075
+ nextAxisY = "\xb0" !== nextAxisY.unit || 36 !== nextAxisY.step || 0 !== nextRestrict[0] || 360 !== nextRestrict[1] ? {
20056
20076
  ...applyAxisYRange(nextAxisY, [
20057
20077
  0,
20058
20078
  360
@@ -20092,7 +20112,8 @@ function useSpectrumChartType({ type, heatmapElementID }) {
20092
20112
  ]);
20093
20113
  (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
20094
20114
  if (type === constants_ChartType.LiteNormalized && globalID) {
20095
- if (axisY.range[0] < 0 || axisY.range[1] > 1) {
20115
+ const currentRange = axisY.range ?? constants_RANGE_DEFAULT;
20116
+ if (currentRange[0] < 0 || currentRange[1] > 1) {
20096
20117
  const nextAxisY = applyAxisYRange(axisY, [
20097
20118
  0,
20098
20119
  1
@@ -20102,7 +20123,10 @@ function useSpectrumChartType({ type, heatmapElementID }) {
20102
20123
  axisY: nextAxisY
20103
20124
  }
20104
20125
  });
20105
- useRangeSet(globalID)(nextAxisY.range);
20126
+ useRangeSet(globalID)(nextAxisY.range ?? [
20127
+ 0,
20128
+ 1
20129
+ ]);
20106
20130
  }
20107
20131
  }
20108
20132
  }, [
@@ -20205,7 +20229,7 @@ function useSpectrumRule(type) {
20205
20229
  let isScanSegmentsUpdateMagnify = false;
20206
20230
  if (event === constants_SegmentsEvent.Focus && totalPoints) {
20207
20231
  const endIndex = totalPoints - 1;
20208
- if (index < segments.length) {
20232
+ if ('number' == typeof index && index < segments.length) {
20209
20233
  for(let i = 0; i < index; i += 1)start += segments[i].point + 1;
20210
20234
  const { point } = segments[index];
20211
20235
  end = start + point;
@@ -20226,7 +20250,7 @@ function useSpectrumRule(type) {
20226
20250
  zoom
20227
20251
  }
20228
20252
  });
20229
- if (event === constants_SegmentsEvent.Cover) setSegments(generateGreatSegments(e.data));
20253
+ if (event === constants_SegmentsEvent.Cover && e.data) setSegments(generateGreatSegments(e.data));
20230
20254
  }, [
20231
20255
  segments
20232
20256
  ]);
@@ -20313,7 +20337,7 @@ const Ticks_Ticks = (props)=>{
20313
20337
  }, []);
20314
20338
  (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
20315
20339
  if (id && globalID) withUpdateData(id, COMPONENT_KEY, ()=>{
20316
- const { waterfallData } = withDatabase(globalID).getAllRawData();
20340
+ const waterfallData = withDatabase(globalID).getAllRawData().waterfallData ?? [];
20317
20341
  const values = [];
20318
20342
  const dataLength = waterfallData.length;
20319
20343
  for(let i = 0; i < HEATMAP_FULL_TICKS; i++){
@@ -20360,7 +20384,7 @@ const AxisYHeatmap = (props)=>{
20360
20384
  const { state: { axisY } } = useStore_useStore();
20361
20385
  const { linkage, renderRange, show } = axisY;
20362
20386
  (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
20363
- if (linkage) chart?.setRange(renderRange);
20387
+ if (linkage && renderRange) chart?.setRange?.(renderRange);
20364
20388
  }, [
20365
20389
  renderRange
20366
20390
  ]);
@@ -20397,16 +20421,14 @@ const createWheelEventManager = (id, name, func)=>subscription_createSubscriptio
20397
20421
  const createDragEventManager = (id, name, func)=>subscription_createSubscriptionManager(`${generateRecursiveId(id, func)}-drag`, name, func, id);
20398
20422
  const createLongPressEventManager = (id, name, func)=>subscription_createSubscriptionManager(`${generateRecursiveId(id, func)}-long-press`, name, func, id);
20399
20423
  const calculateEventRelativePosition = (e)=>{
20400
- if (e) {
20401
- const { target, clientX, clientY } = e;
20402
- const { left, top, width, height } = target.getBoundingClientRect();
20403
- const x = (clientX - left) / width * 100;
20404
- const y = (clientY - top) / height * 100;
20405
- return {
20406
- left: x,
20407
- top: y
20408
- };
20409
- }
20424
+ const { target, clientX, clientY } = e;
20425
+ const { left, top, width, height } = target.getBoundingClientRect();
20426
+ const x = (clientX - left) / width * 100;
20427
+ const y = (clientY - top) / height * 100;
20428
+ return {
20429
+ left: x,
20430
+ top: y
20431
+ };
20410
20432
  };
20411
20433
  const EVENT_PRIORITY_LEVEL_DEFAULT = 'void';
20412
20434
  const EVENT_PRIORITY_LEVELS = {
@@ -20604,14 +20626,14 @@ function useFilteredSeries(globalID, filter) {
20604
20626
  return filteredData;
20605
20627
  }
20606
20628
  const HeatmapCursorPopover = ({ id })=>{
20607
- const { state: { cursor: { coord }, axisX: { frequencyFormat, unit: axisXUnit }, globalID, axisY: { unit: axisYUnit } } } = useStore_useStore();
20629
+ const { state: { cursor: { coord }, axisX: { frequencyFormat, unit: axisXUnit = '' }, globalID, axisY: { unit: axisYUnit } } } = useStore_useStore();
20608
20630
  const { left, top } = coord;
20609
20631
  const updateKey = useCursorPopoverUpdateKey('HeatmapPopover', id);
20610
20632
  const [value1, setValue] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)('');
20611
20633
  const [timestamp, setTimestamp] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)('');
20612
20634
  const { getSeries } = useSeriesForComponent(globalID);
20613
20635
  (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
20614
- if (!globalID || !Number.isFinite(left) || !Number.isFinite(top)) {
20636
+ if (!globalID || 'number' != typeof left || 'number' != typeof top || !Number.isFinite(left) || !Number.isFinite(top)) {
20615
20637
  setValue('');
20616
20638
  setTimestamp('');
20617
20639
  return;
@@ -20628,12 +20650,12 @@ const HeatmapCursorPopover = ({ id })=>{
20628
20650
  if (!outputFrame || 0 === outputFrame.length) return void setValue('');
20629
20651
  const rawFrame = snapshot.rawData?.waterfallData?.[yIndex];
20630
20652
  const globalIndex = snapshot.cursorIndex?.globalIndex;
20631
- const rawXIndex = Number.isFinite(globalIndex) && rawFrame && rawFrame.length > 0 ? Math.max(0, Math.min(rawFrame.length - 1, Math.floor(globalIndex))) : void 0;
20653
+ const rawXIndex = 'number' == typeof globalIndex && Number.isFinite(globalIndex) && rawFrame && rawFrame.length > 0 ? Math.max(0, Math.min(rawFrame.length - 1, Math.floor(globalIndex))) : void 0;
20632
20654
  const exactRawValue = void 0 !== rawXIndex && rawFrame ? rawFrame[rawXIndex] : void 0;
20633
20655
  const sampledXIndex = leftToIndex(left, outputFrame.length);
20634
20656
  const sampledValue = outputFrame[sampledXIndex];
20635
20657
  const nextValue = Number.isFinite(exactRawValue) ? exactRawValue : sampledValue;
20636
- setValue(Number.isFinite(nextValue) ? nextValue.toFixed(1) : '');
20658
+ setValue('number' == typeof nextValue && Number.isFinite(nextValue) ? nextValue.toFixed(1) : '');
20637
20659
  const frameTimestamp = outputFrame.timestamp;
20638
20660
  setTimestamp(frameTimestamp ? String(frameTimestamp) : '');
20639
20661
  }, [
@@ -20642,7 +20664,7 @@ const HeatmapCursorPopover = ({ id })=>{
20642
20664
  top,
20643
20665
  updateKey
20644
20666
  ]);
20645
- const frequency = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>frequencyFormat(left), [
20667
+ const frequency = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>'number' == typeof left ? frequencyFormat?.(left) ?? '' : '', [
20646
20668
  left,
20647
20669
  frequencyFormat
20648
20670
  ]);
@@ -20694,7 +20716,7 @@ const LevelCursorPopover = ({ id })=>{
20694
20716
  const [value1, setValue] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)('');
20695
20717
  const [timestamp, setTimestamp] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)('');
20696
20718
  (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
20697
- if (!globalID || !Number.isFinite(left)) {
20719
+ if (!globalID || 'number' != typeof left || !Number.isFinite(left)) {
20698
20720
  setValue('');
20699
20721
  setTimestamp('');
20700
20722
  return;
@@ -20707,7 +20729,7 @@ const LevelCursorPopover = ({ id })=>{
20707
20729
  }
20708
20730
  const clampedIndex = leftToIndex(left, levelStreamData.spectrumData.length);
20709
20731
  const dataValue = levelStreamData.spectrumData[clampedIndex];
20710
- setValue(Number.isFinite(dataValue) ? dataValue.toFixed(1) : '');
20732
+ setValue('number' == typeof dataValue && Number.isFinite(dataValue) ? dataValue.toFixed(1) : '');
20711
20733
  if (levelStreamData.timestampData.length > clampedIndex) {
20712
20734
  const timestampValue = Number(levelStreamData.timestampData[clampedIndex]);
20713
20735
  if (Number.isFinite(timestampValue)) return void setTimestamp(formatTimestamp(timestampValue));
@@ -20750,16 +20772,16 @@ const LevelCursorPopover = ({ id })=>{
20750
20772
  };
20751
20773
  const Level_CursorPopover = LevelCursorPopover;
20752
20774
  const OccupancyCursorPopover = ()=>{
20753
- const { state: { cursor: { coord }, axisX: { frequencyFormat, unit: axisXUnit }, globalID } } = useStore_useStore();
20775
+ const { state: { cursor: { coord }, axisX: { frequencyFormat, unit: axisXUnit = '' }, globalID } } = useStore_useStore();
20754
20776
  const { left } = coord;
20755
20777
  const value1 = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
20756
- if (!globalID || !Number.isFinite(left)) return '';
20778
+ if (!globalID || 'number' != typeof left || !Number.isFinite(left)) return '';
20757
20779
  const snapshot = withDatabase(globalID).getAllRawData(left);
20758
20780
  const { occupancyData } = snapshot;
20759
20781
  if (occupancyData && occupancyData.length > 0) {
20760
20782
  const globalIndex = snapshot.cursorIndex?.globalIndex;
20761
20783
  const rawOccupancyData = snapshot.rawData?.occupancyData;
20762
- const exactRawValue = Number.isFinite(globalIndex) && rawOccupancyData && rawOccupancyData.length > 0 ? rawOccupancyData[Math.max(0, Math.min(rawOccupancyData.length - 1, Math.floor(globalIndex)))] : void 0;
20784
+ const exactRawValue = 'number' == typeof globalIndex && Number.isFinite(globalIndex) && rawOccupancyData && rawOccupancyData.length > 0 ? rawOccupancyData[Math.max(0, Math.min(rawOccupancyData.length - 1, Math.floor(globalIndex)))] : void 0;
20763
20785
  const sampledValue = occupancyData[leftToIndex(left, occupancyData.length)];
20764
20786
  const targetValue = Number.isFinite(exactRawValue) ? exactRawValue : sampledValue;
20765
20787
  return Number.parseFloat(Number(targetValue).toFixed(1));
@@ -20769,7 +20791,7 @@ const OccupancyCursorPopover = ()=>{
20769
20791
  globalID,
20770
20792
  left
20771
20793
  ]);
20772
- const frequency = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>frequencyFormat(left), [
20794
+ const frequency = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>'number' == typeof left ? frequencyFormat?.(left) ?? '' : '', [
20773
20795
  left,
20774
20796
  frequencyFormat
20775
20797
  ]);
@@ -21025,7 +21047,7 @@ function useStationInfoAtCursor({ frequency, enabled = true }) {
21025
21047
  cursor,
21026
21048
  enabled
21027
21049
  ]);
21028
- const currentPosition = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>isCursorActive ? frequencyCalculation_calculateCursorPosition(left, segments) : {
21050
+ const currentPosition = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>isCursorActive && 'number' == typeof left ? frequencyCalculation_calculateCursorPosition(left, segments) : {
21029
21051
  segmentIndex: -1,
21030
21052
  pointIndex: -1
21031
21053
  }, [
@@ -21034,7 +21056,7 @@ function useStationInfoAtCursor({ frequency, enabled = true }) {
21034
21056
  segments
21035
21057
  ]);
21036
21058
  return (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
21037
- if (!enabled || !Number.isFinite(left) || left < 0 || !signalItems.length || !segments?.length) return;
21059
+ if (!enabled || 'number' != typeof left || !Number.isFinite(left) || left < 0 || !signalItems.length || !segments?.length) return;
21038
21060
  if (!isCursorActive) return;
21039
21061
  const currentFrequency = frequencyCalculation_getCursorFrequencyAtPosition(segments, currentPosition);
21040
21062
  if (!Number.isFinite(currentFrequency)) {
@@ -21136,7 +21158,9 @@ const FrequencyDataBoard = ({ left, updateKey, onChange, showStationInfo = true
21136
21158
  if (!values || 0 === values.length) return null;
21137
21159
  const safeSampledIndex = Math.max(0, Math.min(values.length - 1, Math.floor(sampledIndex)));
21138
21160
  const displayValue = Number.isFinite(rawValue) ? rawValue : values[safeSampledIndex];
21139
- const level = getVirtualLevel(axisY.unit, displayValue)?.toFixed(1);
21161
+ if ('number' != typeof displayValue) return null;
21162
+ const unit = axisY.unit ?? '';
21163
+ const level = getVirtualLevel(unit, displayValue)?.toFixed(1);
21140
21164
  if (!(0, utils_array.Ri)(level)) return null;
21141
21165
  return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("div", {
21142
21166
  className: "grid max-w-[220px] grid-cols-[minmax(0,1fr)_auto] items-center gap-x-1 text-xs",
@@ -21156,7 +21180,7 @@ const FrequencyDataBoard = ({ left, updateKey, onChange, showStationInfo = true
21156
21180
  children: level
21157
21181
  }),
21158
21182
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
21159
- children: axisY.unit
21183
+ children: unit
21160
21184
  })
21161
21185
  ]
21162
21186
  })
@@ -21204,12 +21228,12 @@ const FrequencyDataBoard = ({ left, updateKey, onChange, showStationInfo = true
21204
21228
  value: null,
21205
21229
  currentIndex: Number.NaN
21206
21230
  };
21207
- const currentIndex = Number.isFinite(cursorSampledIndex) ? Math.max(0, Math.min(referenceLength - 1, Math.floor(cursorSampledIndex))) : leftToIndex(left, referenceLength);
21231
+ const currentIndex = 'number' == typeof cursorSampledIndex && Number.isFinite(cursorSampledIndex) ? Math.max(0, Math.min(referenceLength - 1, Math.floor(cursorSampledIndex))) : leftToIndex(left, referenceLength);
21208
21232
  const globalIndex = Number.isFinite(snapshot.cursorIndex?.globalIndex) ? Math.floor(snapshot.cursorIndex?.globalIndex ?? 0) : void 0;
21209
21233
  const rawRealData = snapshot.rawData?.realData;
21210
21234
  const exactRawValue = void 0 !== globalIndex && rawRealData && rawRealData.length > 0 && globalIndex >= 0 && globalIndex < rawRealData.length ? rawRealData[globalIndex] : void 0;
21211
21235
  const getRawValueBySeries = (seriesName)=>{
21212
- if (!Number.isFinite(cursorGlobalIndex)) return;
21236
+ if ('number' != typeof cursorGlobalIndex || !Number.isFinite(cursorGlobalIndex)) return;
21213
21237
  const sourceData = rawSeriesMap[seriesName];
21214
21238
  if (!sourceData || 0 === sourceData.length) return;
21215
21239
  const clampedIndex = Math.max(0, Math.min(sourceData.length - 1, Math.floor(cursorGlobalIndex)));
@@ -21232,7 +21256,7 @@ const FrequencyDataBoard = ({ left, updateKey, onChange, showStationInfo = true
21232
21256
  updateKey,
21233
21257
  left
21234
21258
  ]);
21235
- const frequency = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>frequencyFormat(left), [
21259
+ const frequency = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>frequencyFormat?.(left) ?? '', [
21236
21260
  left,
21237
21261
  frequencyFormat
21238
21262
  ]);
@@ -21457,7 +21481,7 @@ function useEventBusCallback(id) {
21457
21481
  const cleanupDoubleClick = createDoubleClickEventManager(id, useEventBusCallback_COMPONENT_KEY, (_, e)=>{
21458
21482
  if (!compareEventPriority(id, useEventBusCallback_COMPONENT_KEY)) return;
21459
21483
  const { left } = e;
21460
- const frequency = frequencyFormat(left);
21484
+ const frequency = frequencyFormat?.(left) ?? '';
21461
21485
  onDoubleClick(frequency, e);
21462
21486
  });
21463
21487
  const cleanupMouseUp = createMouseUpEventManager(id, useEventBusCallback_COMPONENT_KEY, ()=>{
@@ -21544,7 +21568,8 @@ const EventBus_EventBus = ({ id })=>{
21544
21568
  }, [
21545
21569
  EID
21546
21570
  ]);
21547
- const handleMouseMove = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)(throttleRequestAnimationFrame((e)=>{
21571
+ const handleMouseMove = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)(throttleRequestAnimationFrame((event)=>{
21572
+ const e = event;
21548
21573
  if (!e.currentTarget) return;
21549
21574
  createMoveEventManager(EID)(e, calculateEventRelativePosition(e));
21550
21575
  updateCursor();
@@ -21836,9 +21861,10 @@ function calculateAreaInfo({ endLeft, startLeft, startTop, endTop, frequencyForm
21836
21861
  start: Math.max(0, Math.min(colCount - 1, Math.ceil(colCount * startLeft / PERCENTAGE) - 1)),
21837
21862
  end: Math.max(0, Math.min(colCount - 1, Math.ceil(colCount * endLeft / PERCENTAGE) - 1))
21838
21863
  };
21864
+ const formatFrequency = frequencyFormat;
21839
21865
  const frequencies = {
21840
- start: Math.round(Number(frequencyFormat(startLeft)) * tools_PRECISION) / tools_PRECISION,
21841
- end: Math.round(Number(frequencyFormat(endLeft)) * tools_PRECISION) / tools_PRECISION
21866
+ start: Math.round(Number(formatFrequency(startLeft)) * tools_PRECISION) / tools_PRECISION,
21867
+ end: Math.round(Number(formatFrequency(endLeft)) * tools_PRECISION) / tools_PRECISION
21842
21868
  };
21843
21869
  const bandwidth = Math.abs(frequencies.end - frequencies.start);
21844
21870
  const startTimestamp = waterfallData[indices.top]?.timestamp || '';
@@ -21883,6 +21909,7 @@ const Area = (props)=>{
21883
21909
  if (compareEventPriority(id, Area_COMPONENT_KEY) && start && end) {
21884
21910
  const { left: startLeft, top: startTop } = start;
21885
21911
  const { left: endLeft, top: endTop } = end;
21912
+ if (void 0 === startLeft || void 0 === startTop || void 0 === endLeft || void 0 === endTop) return;
21886
21913
  const diffX = endLeft - startLeft;
21887
21914
  const diffY = endTop - startTop;
21888
21915
  const width = Math.abs(diffX);
@@ -22833,7 +22860,7 @@ const Slider = ({ id })=>{
22833
22860
  const frequencyFormatRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(frequencyFormat);
22834
22861
  frequencyFormatRef.current = frequencyFormat;
22835
22862
  const getHeatmapData = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)(()=>{
22836
- const { waterfallData } = withDatabase(globalID).getAllRawData();
22863
+ const waterfallData = withDatabase(globalID).getAllRawData().waterfallData ?? [];
22837
22864
  return [
22838
22865
  waterfallData,
22839
22866
  waterfallData.length
@@ -23315,6 +23342,7 @@ const GridLines = ()=>{
23315
23342
  col: 0
23316
23343
  });
23317
23344
  (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
23345
+ if (!restrict || !range || !step) return;
23318
23346
  const [restrictMin, restrictMax] = restrict;
23319
23347
  const restrictRange = restrictMax - restrictMin;
23320
23348
  const [min, max] = range;
@@ -23693,7 +23721,7 @@ const Reset_modes = Object.values(constants_ModuleType);
23693
23721
  const Reset = ()=>{
23694
23722
  const { state: { globalID, publish } } = useStore_useStore();
23695
23723
  const handleReset = ()=>{
23696
- publish({
23724
+ publish?.({
23697
23725
  pstype: constants_PSType.Reset
23698
23726
  });
23699
23727
  Reset_modes.forEach((mode)=>{
@@ -23722,13 +23750,15 @@ const SegmentsDisplayControl_SegmentsDisplayControl = ()=>{
23722
23750
  const { state: { segments, globalID } } = useStore_useStore();
23723
23751
  const [display, setDisplay] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)([]);
23724
23752
  const [selectedIndex, setSelectedIndex] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(null);
23753
+ const totalPoints = segments.totalPoints ?? 0;
23725
23754
  (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
23726
23755
  setDisplay(segments.map((s)=>({
23727
23756
  display: false,
23728
- ratio: s.point / segments.totalPoints
23757
+ ratio: totalPoints > 0 ? s.point / totalPoints : 0
23729
23758
  })));
23730
23759
  }, [
23731
- segments
23760
+ segments,
23761
+ totalPoints
23732
23762
  ]);
23733
23763
  const handleSelect = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((value1)=>{
23734
23764
  const index = 'number' == typeof value1 ? value1 : null;
@@ -24012,9 +24042,10 @@ const SeriesDisplayControl = ()=>{
24012
24042
  };
24013
24043
  const controls_SeriesDisplayControl = SeriesDisplayControl;
24014
24044
  const ZoomSwitch = ()=>{
24015
- const { state: { zoom, segments: { totalPoints } }, dispatch } = useStore_useStore();
24045
+ const { state: { zoom, segments }, dispatch } = useStore_useStore();
24016
24046
  const { show, autoCloseTimeout, interval: { start, end } } = zoom;
24017
- const endIndex = totalPoints - 1;
24047
+ const totalPoints = segments.totalPoints ?? 0;
24048
+ const endIndex = Math.max(totalPoints - 1, 0);
24018
24049
  const [hidden, setHidden] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(true);
24019
24050
  const autoRecoveryTimer = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(null);
24020
24051
  (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>()=>{
@@ -24051,14 +24082,19 @@ const ZoomSwitch = ()=>{
24051
24082
  endIndex,
24052
24083
  dispatch
24053
24084
  ]);
24054
- const gradientStyle = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>({
24085
+ const gradientStyle = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
24086
+ if (!totalPoints) return {
24087
+ background: 'transparent'
24088
+ };
24089
+ return {
24055
24090
  background: `linear-gradient(to right,
24056
24091
  transparent ${(start + 1) / totalPoints * 100}%,
24057
24092
  var(--chart-grid-strong) ${(start + 1) / totalPoints * 100}%,
24058
24093
  var(--chart-grid-strong) ${(end + 1) / totalPoints * 100}%,
24059
24094
  transparent ${(end + 1) / totalPoints * 100}%
24060
24095
  )`
24061
- }), [
24096
+ };
24097
+ }, [
24062
24098
  start,
24063
24099
  end,
24064
24100
  totalPoints
@@ -24535,10 +24571,10 @@ const MARKER_COUNT_CHANGE = (id, func)=>subscription_createSubscriptionManager(`
24535
24571
  const MARKER_SELECTION_CHANGE = (id, func)=>subscription_createSubscriptionManager(`MARKER_SELECTION_CHANGE-${id}`, '0', func, id);
24536
24572
  const MARKER_COMMAND = (id, func)=>subscription_createSubscriptionManager(`MARKER_COMMAND-${id}`, '0', func, id);
24537
24573
  function splitZoomLeft({ left, globalID }) {
24574
+ const safeLeft = left;
24538
24575
  const { zoom, segments } = getGlobalStoreState(globalID);
24539
24576
  const { start, end } = zoom.interval;
24540
- const { totalPoints } = segments;
24541
- const safeLeft = left;
24577
+ const totalPoints = segments.totalPoints;
24542
24578
  const intervalWidth = end - start + 1;
24543
24579
  const rawInsideLeft = (safeLeft * totalPoints / 100 - start) * 100 / intervalWidth;
24544
24580
  const insideLeft = rawInsideLeft;
@@ -25108,7 +25144,9 @@ const Toolbar = ({ type })=>{
25108
25144
  };
25109
25145
  const components_Toolbar = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.memo)(Toolbar);
25110
25146
  function useLevelStreamAnalyzer() {
25111
- const { state: { globalID, axisY: { range }, levelStream: { cacheTime, granularity, maxPoints } } } = useStore_useStore();
25147
+ const { state: { globalID, axisY, levelStream } } = useStore_useStore();
25148
+ const range = axisY.range ?? constants_RANGE_DEFAULT;
25149
+ const { cacheTime = 20000, granularity = 1, maxPoints = 500 } = levelStream ?? {};
25112
25150
  const analyzer = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(null);
25113
25151
  const globalIDRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(globalID);
25114
25152
  const updateLevelStreamData = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((renderData)=>{
@@ -25266,7 +25304,7 @@ const MIN_RANGE_SPAN = 0.5;
25266
25304
  const MAJOR_TICK_LINE_WIDTH = 2 * LINE_WIDTH_BASE;
25267
25305
  const MINOR_TICK_LINE_WIDTH = LINE_WIDTH_BASE;
25268
25306
  const AXIS_LINE_WIDTH = LINE_WIDTH_BASE;
25269
- function useCanvasAxisY(options = {}) {
25307
+ function useCanvasAxisY(options) {
25270
25308
  const { ranging } = options;
25271
25309
  const axisY = useSelector((state)=>state.axisY);
25272
25310
  const { range: axisYRange, disabled } = axisY;
@@ -25476,15 +25514,10 @@ function useCanvasAxisY(options = {}) {
25476
25514
  ]);
25477
25515
  const handleWheel = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((e)=>{
25478
25516
  if (disabled) return;
25479
- if (e.deltaY < 0) {
25480
- const currentRange = range.max - range.min;
25481
- if (currentRange <= MIN_RANGE_SPAN) return;
25482
- }
25483
25517
  ranging.moveWheel?.(e);
25484
25518
  }, [
25485
25519
  ranging,
25486
- disabled,
25487
- range
25520
+ disabled
25488
25521
  ]);
25489
25522
  const handleMouseMove = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((e)=>{
25490
25523
  if (disabled || !isDragging || !containerRef.current) return;
@@ -25782,10 +25815,12 @@ const DragFrame = ({ id })=>{
25782
25815
  ]);
25783
25816
  const filterFrameState = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((startCoords, endCoords, _, isEventButtonsRight)=>{
25784
25817
  if (startCoords && endCoords && isEventButtonsRight) {
25785
- const diffX = endCoords.left - startCoords.left;
25818
+ const startLeft = startCoords.left;
25819
+ const endLeft = endCoords.left;
25820
+ const diffX = endLeft - startLeft;
25786
25821
  setFrameState({
25787
25822
  diffX,
25788
- left: diffX > 0 ? startCoords.left : endCoords.left,
25823
+ left: diffX > 0 ? startLeft : endLeft,
25789
25824
  width: Math.abs(diffX),
25790
25825
  isScanSegmentsUpdateMagnify: diffX > 0
25791
25826
  });
@@ -25795,9 +25830,10 @@ const DragFrame = ({ id })=>{
25795
25830
  if (!frameState) return;
25796
25831
  const { left, width, isScanSegmentsUpdateMagnify, diffX } = frameState;
25797
25832
  const { totalPoints } = segments;
25833
+ const totalPointCount = totalPoints;
25798
25834
  if (isScanSegmentsUpdateMagnify && diffX > 0) {
25799
- const nextPoint = 2 * Math.ceil(width / 100 * totalPoints / 2);
25800
- const start = Math.round(totalPoints * left / 100) - 1;
25835
+ const nextPoint = 2 * Math.ceil(width / 100 * totalPointCount / 2);
25836
+ const start = Math.round(totalPointCount * left / 100) - 1;
25801
25837
  const end = nextPoint + start - 1;
25802
25838
  if (nextPoint > 10) onChange({
25803
25839
  interval: {
@@ -25812,7 +25848,7 @@ const DragFrame = ({ id })=>{
25812
25848
  if (diffX < 0) onChange({
25813
25849
  interval: {
25814
25850
  start: 0,
25815
- end: totalPoints - 1
25851
+ end: totalPointCount - 1
25816
25852
  },
25817
25853
  isScanSegmentsUpdateMagnify,
25818
25854
  left,
@@ -26462,8 +26498,9 @@ const setFrequencyAllocationToCache = (data)=>{
26462
26498
  localStorage.setItem(STORAGE_KEY, JSON.stringify(data));
26463
26499
  };
26464
26500
  function resolveFrequencyAllocationData(data) {
26465
- const cachedData = getFrequencyAllocationFromCache();
26466
- return sortAndRecolorFrequencyAllocationData(cachedData?.length > 0 ? cachedData : data?.length > 0 ? data : FrequencyAllocation_data);
26501
+ const cachedData = getFrequencyAllocationFromCache() ?? [];
26502
+ const inputData = data ?? [];
26503
+ return sortAndRecolorFrequencyAllocationData(cachedData.length > 0 ? cachedData : inputData.length > 0 ? inputData : FrequencyAllocation_data);
26467
26504
  }
26468
26505
  const resolveFrequencyAllocationRange = (band)=>{
26469
26506
  if (null != band.startFrequency && null != band.stopFrequency) {
@@ -26716,7 +26753,7 @@ const FrequencyAllocation = ()=>{
26716
26753
  children: [
26717
26754
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
26718
26755
  className: "absolute right-0 top-0 flex h-full w-full items-end will-change-transform",
26719
- style: zoomOffStyle,
26756
+ style: zoomOffStyle ?? void 0,
26720
26757
  children: segmentData.map(({ segmentIndex, bandPositions, style })=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(AllocationSegments, {
26721
26758
  style: style,
26722
26759
  bandPositions: bandPositions,
@@ -26868,7 +26905,7 @@ const FrequencyTagLine = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["defaul
26868
26905
  const Item_Item = ({ value: value1, onChange })=>{
26869
26906
  const { state: { axisY, limit } } = useStore_useStore();
26870
26907
  const { label, disabled } = limit;
26871
- const { unit, range, step } = axisY;
26908
+ const { unit = '', range = constants_RANGE_DEFAULT, step = constants_stepDefault } = axisY;
26872
26909
  const [min, max] = range;
26873
26910
  const diff = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>isdBm(unit) ? dBuV2dBm(0) : 0, [
26874
26911
  unit
@@ -26893,6 +26930,10 @@ const Item_Item = ({ value: value1, onChange })=>{
26893
26930
  switch(keyCode){
26894
26931
  case 'Enter':
26895
26932
  {
26933
+ if (!input.current) {
26934
+ setIsEdit(false);
26935
+ break;
26936
+ }
26896
26937
  const v = Number(input.current.value);
26897
26938
  if (!Number.isNaN(v) && v >= min && v <= max) {
26898
26939
  onChange?.(Math.floor(v - diff));
@@ -26968,6 +27009,8 @@ const Limit_Limit = ({ id })=>{
26968
27009
  const { state: { limit, segments, axisY, system }, dispatch } = useStore_useStore();
26969
27010
  const { show, active, disabled, value: value1, onChange } = limit;
26970
27011
  const [axisYMin, axisYMax] = axisY.range;
27012
+ const { totalPoints } = segments;
27013
+ const totalPointCount = totalPoints;
26971
27014
  const canRender = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>show && active, [
26972
27015
  show,
26973
27016
  active
@@ -27001,7 +27044,8 @@ const Limit_Limit = ({ id })=>{
27001
27044
  createMouseDownEventManager(id, COMPONENT_NAME, (e)=>{
27002
27045
  if (!canRender || disabled) return;
27003
27046
  if (!e?.left || !e?.top) return;
27004
- const index = segments.findIndex((i)=>i.progress[0] <= e.left && e.left < i.progress[1]);
27047
+ const left = e.left;
27048
+ const index = segments.findIndex((i)=>i.progress[0] <= left && left < i.progress[1]);
27005
27049
  if (!Number.isFinite(index) || index < 0) {
27006
27050
  setIndex(Number.NaN);
27007
27051
  dragValueRef.current = null;
@@ -27072,7 +27116,7 @@ const Limit_Limit = ({ id })=>{
27072
27116
  className: "z-[2]",
27073
27117
  children: segments?.map((i, index)=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
27074
27118
  style: {
27075
- width: `${100 * i.point / segments.totalPoints}%`,
27119
+ width: `${100 * i.point / totalPointCount}%`,
27076
27120
  opacity: (0, utils_array.Ri)(value1[index]) ? 1 : 0
27077
27121
  },
27078
27122
  className: "h-full w-[30%]",
@@ -27217,6 +27261,7 @@ const useMarkerEvents = (props)=>{
27217
27261
  };
27218
27262
  };
27219
27263
  const markerColors = getConfig('marker');
27264
+ const getRequiredGlobalStoreState = (globalID)=>getGlobalStoreState(globalID);
27220
27265
  function getPeaksFromDatabase(globalID, data, options) {
27221
27266
  const { needsMaxPeak = false, needsTopPeaks = false } = options || {};
27222
27267
  let maxPeak = null;
@@ -27255,8 +27300,8 @@ const useMarkers = (props)=>{
27255
27300
  });
27256
27301
  const dataRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(new Float32Array());
27257
27302
  const formatMarker = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((e, ctx)=>{
27258
- const { axisY: { unit }, axisX: { frequencyFormat } } = getGlobalStoreState(globalID);
27259
- let { left } = e;
27303
+ const { axisY: { unit }, axisX: { frequencyFormat } } = getRequiredGlobalStoreState(globalID);
27304
+ let left = e.left;
27260
27305
  const { peak } = e;
27261
27306
  let data = ctx?.data ?? dataRef.current;
27262
27307
  if (!data || 0 === data.length) {
@@ -27304,7 +27349,7 @@ const useMarkers = (props)=>{
27304
27349
  const frequency = parseFloat(frequencyStr);
27305
27350
  const level = data[xIndex];
27306
27351
  if (void 0 !== level && !Number.isNaN(level)) {
27307
- const virtualLevel = getVirtualLevel(unit, level)?.toFixed?.(1);
27352
+ const virtualLevel = getVirtualLevel(unit, level).toFixed(1);
27308
27353
  e.level = parseFloat(virtualLevel);
27309
27354
  }
27310
27355
  return {
@@ -27318,7 +27363,7 @@ const useMarkers = (props)=>{
27318
27363
  const createMarker = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((e, isBatchAdd = false)=>{
27319
27364
  if (0 === dataRef.current.length) return;
27320
27365
  setState((prevState)=>{
27321
- const { marker: { maxCount } } = getGlobalStoreState(globalID);
27366
+ const { marker: { maxCount } } = getRequiredGlobalStoreState(globalID);
27322
27367
  if (prevState.markers.length >= maxCount) return prevState;
27323
27368
  const markerId = createGUID();
27324
27369
  const colorIndex = prevState.colorIndex % 20;
@@ -27410,7 +27455,7 @@ const useMarkers = (props)=>{
27410
27455
  }
27411
27456
  if (event === constants_MarkerEventType.Add) {
27412
27457
  if (frequencies?.length) {
27413
- const { marker: { maxCount } } = getGlobalStoreState(globalID);
27458
+ const { marker: { maxCount } } = getRequiredGlobalStoreState(globalID);
27414
27459
  const availableSlots = maxCount - newMarkers.length;
27415
27460
  const itemsToAdd = Math.min(frequencies.length, availableSlots);
27416
27461
  newMarkers = newMarkers.map((m)=>({
@@ -27547,7 +27592,7 @@ const useMarkers = (props)=>{
27547
27592
  const container = document.getElementById(id);
27548
27593
  if (!container) return '';
27549
27594
  const info = container.getBoundingClientRect();
27550
- const { zoom: { interval: { start, end } }, segments } = getGlobalStoreState(globalID);
27595
+ const { zoom: { interval: { start, end } }, segments } = getRequiredGlobalStoreState(globalID);
27551
27596
  const multiple = segments.totalPoints / (end - start + 1);
27552
27597
  const width = info.width * multiple / 100;
27553
27598
  let isHover = '';
@@ -27626,8 +27671,8 @@ const useMarkers = (props)=>{
27626
27671
  markers: nextMarkers
27627
27672
  };
27628
27673
  }
27629
- const globalState = getGlobalStoreState(globalID);
27630
- const maxCount = globalState.marker.maxCount;
27674
+ const { marker } = getRequiredGlobalStoreState(globalID);
27675
+ const maxCount = marker.maxCount;
27631
27676
  const availableSlots = maxCount - prevState.markers.length;
27632
27677
  if (availableSlots < 2) return prevState;
27633
27678
  mainSecondaryPrevSelectedRef.current = prevState.markers.find((m)=>m.select)?.id ?? null;
@@ -27706,8 +27751,8 @@ const useMarkers = (props)=>{
27706
27751
  markers: nextMarkers
27707
27752
  };
27708
27753
  }
27709
- const globalState = getGlobalStoreState(globalID);
27710
- const maxCount = globalState.marker.maxCount;
27754
+ const { marker } = getRequiredGlobalStoreState(globalID);
27755
+ const maxCount = marker.maxCount;
27711
27756
  const availableSlots = maxCount - prevState.markers.length;
27712
27757
  if (availableSlots < 1) return prevState;
27713
27758
  mainPeakPrevSelectedRef.current = prevState.markers.find((m)=>m.select)?.id ?? null;
@@ -27762,7 +27807,7 @@ const useMarkers = (props)=>{
27762
27807
  const data = rawData[REAL_DATA_NAME];
27763
27808
  if (!data || data.length < 3) return prevState;
27764
27809
  dataRef.current = data;
27765
- const { zoom, segments } = getGlobalStoreState(globalID);
27810
+ const { zoom, segments } = getRequiredGlobalStoreState(globalID);
27766
27811
  const dataLength = data.length;
27767
27812
  const totalPoints = segments.totalPoints || dataLength;
27768
27813
  const intervalWidth = zoom.interval.end - zoom.interval.start + 1;
@@ -27847,7 +27892,7 @@ const useMarkers = (props)=>{
27847
27892
  const data = rawData[REAL_DATA_NAME];
27848
27893
  if (!data || data.length < 1) return prevState;
27849
27894
  dataRef.current = data;
27850
- const { zoom, segments } = getGlobalStoreState(globalID);
27895
+ const { zoom, segments } = getRequiredGlobalStoreState(globalID);
27851
27896
  const dataLength = data.length;
27852
27897
  const totalPoints = segments.totalPoints || dataLength;
27853
27898
  let maxIndex = 0;
@@ -27895,7 +27940,7 @@ const useMarkers = (props)=>{
27895
27940
  const data = rawData[REAL_DATA_NAME];
27896
27941
  if (!data || data.length < 3) return prevState;
27897
27942
  dataRef.current = data;
27898
- const { zoom, segments } = getGlobalStoreState(globalID);
27943
+ const { zoom, segments } = getRequiredGlobalStoreState(globalID);
27899
27944
  const dataLength = data.length;
27900
27945
  const totalPoints = segments.totalPoints || dataLength;
27901
27946
  let maxIndex = 0;
@@ -27957,7 +28002,7 @@ const useMarkers = (props)=>{
27957
28002
  const data = rawData[REAL_DATA_NAME];
27958
28003
  if (!data || data.length < 2) return prevState;
27959
28004
  dataRef.current = data;
27960
- const { zoom, segments } = getGlobalStoreState(globalID);
28005
+ const { zoom, segments } = getRequiredGlobalStoreState(globalID);
27961
28006
  const dataLength = data.length;
27962
28007
  const totalPoints = segments.totalPoints || dataLength;
27963
28008
  const intervalWidth = zoom.interval.end - zoom.interval.start + 1;
@@ -28004,7 +28049,7 @@ const useMarkers = (props)=>{
28004
28049
  const data = rawData[REAL_DATA_NAME];
28005
28050
  if (!data || data.length < 1) return prevState;
28006
28051
  dataRef.current = data;
28007
- const { zoom, segments } = getGlobalStoreState(globalID);
28052
+ const { zoom, segments } = getRequiredGlobalStoreState(globalID);
28008
28053
  const dataLength = data.length;
28009
28054
  const totalPoints = segments.totalPoints || dataLength;
28010
28055
  let maxIndex = 0;
@@ -28028,8 +28073,8 @@ const useMarkers = (props)=>{
28028
28073
  return m;
28029
28074
  });
28030
28075
  else {
28031
- const globalState = getGlobalStoreState(globalID);
28032
- const maxMarkerCount = globalState.marker.maxCount;
28076
+ const { marker } = getRequiredGlobalStoreState(globalID);
28077
+ const maxMarkerCount = marker.maxCount;
28033
28078
  if (prevState.markers.length >= maxMarkerCount) return prevState;
28034
28079
  const markerId = createGUID();
28035
28080
  const newMarker = formatMarker({
@@ -28066,7 +28111,7 @@ const useMarkers = (props)=>{
28066
28111
  const data = rawData[REAL_DATA_NAME];
28067
28112
  if (!data || data.length < 3) return prevState;
28068
28113
  dataRef.current = data;
28069
- const { zoom, segments } = getGlobalStoreState(globalID);
28114
+ const { zoom, segments } = getRequiredGlobalStoreState(globalID);
28070
28115
  const dataLength = data.length;
28071
28116
  const totalPoints = segments.totalPoints || dataLength;
28072
28117
  let maxIndex = 0;
@@ -28104,8 +28149,8 @@ const useMarkers = (props)=>{
28104
28149
  return m;
28105
28150
  });
28106
28151
  else {
28107
- const globalState = getGlobalStoreState(globalID);
28108
- const maxMarkerCount = globalState.marker.maxCount;
28152
+ const { marker } = getRequiredGlobalStoreState(globalID);
28153
+ const maxMarkerCount = marker.maxCount;
28109
28154
  if (prevState.markers.length >= maxMarkerCount) return prevState;
28110
28155
  const markerId = createGUID();
28111
28156
  const newMarker = formatMarker({
@@ -28377,7 +28422,7 @@ const Markers = ({ id })=>{
28377
28422
  id,
28378
28423
  markers,
28379
28424
  display: show,
28380
- fixed,
28425
+ fixed: fixed,
28381
28426
  onCreateMarker: createMarker,
28382
28427
  onDeleteMarker: handleDeleteMarker,
28383
28428
  onUpdateMarker: handleUpdateMarker,
@@ -28600,7 +28645,7 @@ const Signal = ({ show = true, display = true })=>{
28600
28645
  const isCursorActive = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>cursor_hasActiveSpectrumCursor(cursor), [
28601
28646
  cursor
28602
28647
  ]);
28603
- const currentPosition = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>isCursorActive ? frequencyCalculation_calculateCursorPosition(left, segments) : {
28648
+ const currentPosition = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>isCursorActive && 'number' == typeof left ? frequencyCalculation_calculateCursorPosition(left, segments) : {
28604
28649
  segmentIndex: -1,
28605
28650
  pointIndex: -1
28606
28651
  }, [
@@ -28631,7 +28676,7 @@ const Signal = ({ show = true, display = true })=>{
28631
28676
  className: "pointer-events-none absolute inset-0 z-[4] flex h-full w-full select-none items-center overflow-hidden bg-transparent",
28632
28677
  children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
28633
28678
  className: "absolute right-0 top-0 flex h-full w-full",
28634
- style: zoomOffStyle,
28679
+ style: zoomOffStyle ?? void 0,
28635
28680
  children: segmentData.map(({ segmentIndex, signalPositions, activeSignalKey, style })=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(SignalSegments, {
28636
28681
  style: style,
28637
28682
  signalPositions: signalPositions,
@@ -28723,8 +28768,8 @@ const Stripe_Stripe = ({ id })=>{
28723
28768
  const { left, right } = currentStripe;
28724
28769
  const l = Math.round(10 * left) / 10;
28725
28770
  const r = Math.round(10 * right) / 10;
28726
- const start = frequencyFormatRef.current(l);
28727
- const end = frequencyFormatRef.current(r);
28771
+ const start = frequencyFormatRef.current?.(l) ?? '';
28772
+ const end = frequencyFormatRef.current?.(r) ?? '';
28728
28773
  const width = r - l;
28729
28774
  const bandwidth = Number(end) - Number(start);
28730
28775
  onChangeRef.current({
@@ -29209,27 +29254,37 @@ const charts_Occupancy = charts_Occupancy_Occupancy;
29209
29254
  const Zoom_Zoom = ()=>{
29210
29255
  const dispatch = useStoreDispatch();
29211
29256
  const zoom = useSelector((state)=>state.zoom);
29212
- const totalPoints = useSelector((state)=>state.segments.totalPoints);
29257
+ const totalPoints = useSelector((state)=>state.segments.totalPoints) ?? 0;
29213
29258
  const frequencyFormat = useSelector((state)=>state.axisX.frequencyFormat);
29214
29259
  const { interval: { start, end }, onChange } = zoom;
29215
- const ticks = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>[
29260
+ const ticks = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
29261
+ if (!totalPoints || !frequencyFormat) return [
29262
+ '',
29263
+ ''
29264
+ ];
29265
+ return [
29216
29266
  frequencyFormat((100 * start + 1) / totalPoints),
29217
29267
  frequencyFormat((100 * end + 1) / totalPoints)
29218
- ], [
29268
+ ];
29269
+ }, [
29219
29270
  start,
29220
29271
  end,
29221
- totalPoints
29272
+ totalPoints,
29273
+ frequencyFormat
29222
29274
  ]);
29223
29275
  (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
29276
+ if (!totalPoints) return;
29224
29277
  if (void 0 !== ticks[0] && void 0 !== ticks[1]) onChange(ticks, {
29225
29278
  start,
29226
29279
  end
29227
29280
  });
29228
29281
  }, [
29229
29282
  ticks,
29230
- onChange
29283
+ onChange,
29284
+ totalPoints
29231
29285
  ]);
29232
29286
  (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
29287
+ if (!totalPoints) return;
29233
29288
  const widthRange = end - start + 1;
29234
29289
  const multiple = totalPoints / widthRange;
29235
29290
  const left = `-${start / widthRange * 100}%`;
@@ -29446,12 +29501,13 @@ const Legend = ()=>{
29446
29501
  const Spectrum_Legend = Legend;
29447
29502
  const SegmentsZebra = ()=>{
29448
29503
  const { state: { segments } } = useStore_useStore();
29504
+ const totalPoints = segments.totalPoints ?? 0;
29449
29505
  return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Zoom_ZoomViewportLayer, {
29450
29506
  className: "z-[0]",
29451
29507
  children: segments.map((i, key)=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
29452
29508
  className: "h-full border-x",
29453
29509
  style: {
29454
- width: `${100 * i.point / segments.totalPoints}%`,
29510
+ width: totalPoints > 0 ? `${100 * i.point / totalPoints}%` : 0,
29455
29511
  borderColor: key % 2 === 1 ? 'var(--chart-grid)' : 'transparent',
29456
29512
  background: key % 2 === 1 ? 'var(--chart-surface)' : 'transparent',
29457
29513
  opacity: key % 2 === 1 ? 0.4 : 1
@@ -29500,14 +29556,15 @@ function useTemplateComparison() {
29500
29556
  const segments = [];
29501
29557
  const timestamp = Date.now();
29502
29558
  templateOverData.forEach((overData)=>{
29559
+ const formatFrequency = frequencyFormatRef.current;
29503
29560
  const { startIndex, endIndex } = overData;
29504
29561
  const totalLength = templateOverData.length;
29505
29562
  const startPercent = (startIndex + 0.5) * 100 / totalLength;
29506
29563
  const endPercent = (endIndex + 0.5) * 100 / totalLength;
29507
29564
  const centerPercent = (startIndex + endIndex) / 2 * 100 / totalLength;
29508
- const startFreq = frequencyFormatRef.current(startPercent);
29509
- const stopFreq = frequencyFormatRef.current(endPercent);
29510
- const centerFreq = frequencyFormatRef.current(centerPercent);
29565
+ const startFreq = formatFrequency(startPercent);
29566
+ const stopFreq = formatFrequency(endPercent);
29567
+ const centerFreq = formatFrequency(centerPercent);
29511
29568
  if (startFreq !== stopFreq) segments.push({
29512
29569
  ...overData,
29513
29570
  frequency: centerFreq,