@rfkit/charts 1.4.2 → 1.5.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.
Files changed (41) hide show
  1. package/README.md +2 -0
  2. package/components/AxisY/heatmap/index.d.ts +1 -1
  3. package/components/AxisY/spectrum/index.d.ts +1 -1
  4. package/components/AxisY/spectrum/presenters/TicksPanel/index.d.ts +1 -1
  5. package/components/AxisY/spectrum/tools.d.ts +1 -1
  6. package/components/AxisY/spectrum/useRanging/index.d.ts +1 -1
  7. package/components/AxisY/spectrum/useRanging/ranging.d.ts +3 -3
  8. package/components/Cursor/tools.d.ts +3 -1
  9. package/components/EventBus/useKeyEvent.d.ts +1 -1
  10. package/components/ui/button.d.ts +8 -8
  11. package/components/ui/dialog.d.ts +1 -1
  12. package/components/ui/dropdown-menu.d.ts +1 -1
  13. package/components/ui/panel.d.ts +4 -4
  14. package/components/ui/tooltip.d.ts +1 -1
  15. package/components/ui/useChartsPortalContainer.d.ts +1 -1
  16. package/hooks/publish/usePublish.d.ts +1 -1
  17. package/hooks/spectrum/useSpectrumRule.d.ts +1 -1
  18. package/hooks/useChart/index.d.ts +1 -1
  19. package/hooks/useDragSelect.d.ts +1 -1
  20. package/hooks/useLevelStreamAnalyzer.d.ts +1 -1
  21. package/index.js +326 -219
  22. package/modules/Spectrum/AxisYCanvas/index.d.ts +2 -2
  23. package/modules/Spectrum/AxisYCanvas/useCanvasAxisY.d.ts +4 -4
  24. package/modules/Spectrum/FrequencyAllocation/model/useAllocationAtCursor.d.ts +1 -1
  25. package/modules/Spectrum/Markers/hooks/useMarkerEvents.d.ts +2 -2
  26. package/modules/Spectrum/Markers/hooks/useMarkers.d.ts +2 -2
  27. package/modules/Spectrum/Markers/tools.d.ts +3 -3
  28. package/modules/Spectrum/Signal/model/useStationInfoAtCursor.d.ts +1 -1
  29. package/modules/base/BaseRenderer.d.ts +2 -2
  30. package/modules/base/GradientRenderer.d.ts +4 -4
  31. package/package.json +1 -1
  32. package/store/Params.d.ts +1 -1
  33. package/store/context.d.ts +1 -1
  34. package/store/globalState.d.ts +2 -1
  35. package/theme/style-scope.d.ts +1 -1
  36. package/theme/theme-contract.d.ts +1 -1
  37. package/types/publish.d.ts +1 -0
  38. package/utils/converter.d.ts +1 -1
  39. package/utils/series/events.d.ts +4 -4
  40. package/utils/series/subscription.d.ts +1 -1
  41. package/utils/subscription.d.ts +1 -1
package/index.js CHANGED
@@ -4183,6 +4183,7 @@ const getDefaultData = ()=>({
4183
4183
  maxData: new Float32Array(),
4184
4184
  minData: new Float32Array(),
4185
4185
  avgData: new Float32Array(),
4186
+ thresholdData: new Float32Array(),
4186
4187
  templateData: new Float32Array(),
4187
4188
  backgroundNoiseData: new Float32Array(),
4188
4189
  waterfallData: [],
@@ -4354,7 +4355,7 @@ const UI_CONFIG = {
4354
4355
  ZOOM_MIN_RANGE: 10,
4355
4356
  POPOVER_MARGIN: 16
4356
4357
  };
4357
- const defaultConfig = {
4358
+ const setting_defaultConfig = {
4358
4359
  line: {
4359
4360
  realData: {
4360
4361
  name: 'realData',
@@ -4389,7 +4390,7 @@ const defaultConfig = {
4389
4390
  color: '#FF4C2A',
4390
4391
  thickness: 1,
4391
4392
  label: "\u95E8\u9650\u503C",
4392
- display: false
4393
+ display: true
4393
4394
  },
4394
4395
  templateData: {
4395
4396
  name: 'templateData',
@@ -4493,17 +4494,17 @@ const defaultConfig = {
4493
4494
  const setConfig = (c = {})=>{
4494
4495
  const currentConfig = JSON.parse(localStorage.getItem(KEY) || '{}');
4495
4496
  const newConfig = {
4496
- ...defaultConfig,
4497
+ ...setting_defaultConfig,
4497
4498
  ...currentConfig,
4498
4499
  ...c
4499
4500
  };
4500
4501
  localStorage.setItem(KEY, JSON.stringify(newConfig));
4501
4502
  };
4502
4503
  function getConfig(name) {
4503
- let config = defaultConfig ?? JSON.parse(localStorage.getItem(KEY) || 'null');
4504
+ let config = setting_defaultConfig ?? JSON.parse(localStorage.getItem(KEY) || 'null');
4504
4505
  if (!config) {
4505
4506
  setConfig();
4506
- config = defaultConfig;
4507
+ config = setting_defaultConfig;
4507
4508
  }
4508
4509
  return name ? config[name] : config;
4509
4510
  }
@@ -4750,9 +4751,10 @@ const generateFrequencyCache = (config)=>{
4750
4751
  };
4751
4752
  const leftSegments2frequency = (segments)=>{
4752
4753
  if (!segments?.length) return ()=>'';
4753
- const { totalPoints } = segments;
4754
+ const totalPoints = segments.totalPoints;
4754
4755
  const segmentInfo = segments.map((segment, index)=>{
4755
- const { point, frequencyCache } = segment;
4756
+ const { point } = segment;
4757
+ const frequencyCache = segment.frequencyCache;
4756
4758
  const ll = 100 * point / totalPoints;
4757
4759
  return {
4758
4760
  ll,
@@ -4798,7 +4800,7 @@ const scopeLeftSegments2bandwidth = (e)=>{
4798
4800
  if (!e) return 0;
4799
4801
  const { segments } = e;
4800
4802
  if (!segments) return 0;
4801
- const { totalPoints } = segments;
4803
+ const totalPoints = segments.totalPoints;
4802
4804
  let { endLeft, startLeft } = e;
4803
4805
  const diff = endLeft - startLeft;
4804
4806
  const diffabs = Math.abs(diff);
@@ -4977,17 +4979,18 @@ function calculateRoughIndexRange(range, segment) {
4977
4979
  function findPreciseIndexRange(range, segment, searchRange = SEARCH_RANGE) {
4978
4980
  const rough = calculateRoughIndexRange(range, segment);
4979
4981
  let { startIndex, stopIndex } = rough;
4982
+ const frequencyCache = segment.frequencyCache;
4980
4983
  let bestStartIndex = startIndex;
4981
4984
  let bestStopIndex = stopIndex;
4982
4985
  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);
4986
+ const freq = Number(frequencyCache[i]?.frequency);
4984
4987
  if (freq >= range.startFreq) {
4985
4988
  bestStartIndex = i;
4986
4989
  break;
4987
4990
  }
4988
4991
  }
4989
4992
  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);
4993
+ const freq = Number(frequencyCache[i]?.frequency);
4991
4994
  if (freq <= range.stopFreq) bestStopIndex = i;
4992
4995
  if (freq > range.stopFreq) break;
4993
4996
  }
@@ -5192,7 +5195,7 @@ var signal_SignalDataType = /*#__PURE__*/ function(SignalDataType) {
5192
5195
  SignalDataType["Simple"] = "simple";
5193
5196
  return SignalDataType;
5194
5197
  }({});
5195
- const restrictList = {
5198
+ const constants_restrictList = {
5196
5199
  dBm: [
5197
5200
  -300,
5198
5201
  300
@@ -5208,7 +5211,7 @@ const constants_stepList = [
5208
5211
  20,
5209
5212
  30
5210
5213
  ];
5211
- const stepDefault = constants_stepList[2];
5214
+ const constants_stepDefault = constants_stepList[2];
5212
5215
  const constants_unitList = [
5213
5216
  "dB\u03BCV",
5214
5217
  "dB\u03BCV/m",
@@ -5252,9 +5255,9 @@ function createParams() {
5252
5255
  realRange: constants_RANGE_DEFAULT,
5253
5256
  range: constants_RANGE_DEFAULT,
5254
5257
  renderRange: constants_RANGE_DEFAULT,
5255
- restrict: restrictList["dBμV"],
5258
+ restrict: constants_restrictList["dBμV"],
5256
5259
  autoranging: false,
5257
- step: stepDefault,
5260
+ step: constants_stepDefault,
5258
5261
  unit: constants_unitList["0"],
5259
5262
  unitList: constants_unitList,
5260
5263
  unitDisabled: false,
@@ -5271,7 +5274,7 @@ function createParams() {
5271
5274
  ticks: true,
5272
5275
  children: null,
5273
5276
  onChange: ()=>{},
5274
- frequencyFormat: ()=>null
5277
+ frequencyFormat: ()=>''
5275
5278
  },
5276
5279
  toolbar: {
5277
5280
  show: true,
@@ -5308,7 +5311,7 @@ function createParams() {
5308
5311
  value: [
5309
5312
  20
5310
5313
  ],
5311
- range: restrictList["dBμV"],
5314
+ range: constants_restrictList["dBμV"],
5312
5315
  label: '',
5313
5316
  onChange: ()=>{}
5314
5317
  },
@@ -5553,9 +5556,9 @@ const info2step = (info)=>{
5553
5556
  class RangeController {
5554
5557
  state = {
5555
5558
  axisY: {
5556
- step: stepDefault,
5559
+ step: constants_stepDefault,
5557
5560
  realRange: constants_RANGE_DEFAULT,
5558
- restrict: restrictList["dBμV"]
5561
+ restrict: constants_restrictList["dBμV"]
5559
5562
  },
5560
5563
  onChange: ()=>{}
5561
5564
  };
@@ -5598,7 +5601,7 @@ class RangeController {
5598
5601
  if (void 0 === avg) avg = 10;
5599
5602
  let step = propsStep || axisY.step;
5600
5603
  const allInFormat = info2step(allInfo);
5601
- const { min, max } = allInfo;
5604
+ const { min = 0, max = 0 } = allInfo;
5602
5605
  const [oldMin, oldMax] = realRange;
5603
5606
  const { middle } = allInFormat;
5604
5607
  const overflow = min < oldMin || oldMax < max;
@@ -5674,9 +5677,10 @@ class RangeController {
5674
5677
  max: mouseValue + (max - mouseValue) * zoomFactor
5675
5678
  };
5676
5679
  const [restrictMin, restrictMax] = restrict;
5680
+ const restrictSpan = Math.abs(restrictMax - restrictMin);
5677
5681
  let finalMin = Math.max(restrictMin, newRange.min);
5678
5682
  let finalMax = Math.min(restrictMax, newRange.max);
5679
- const minRange = step / 100;
5683
+ const minRange = Math.max(Number.EPSILON, Math.min(step / 100, restrictSpan / 100));
5680
5684
  if (finalMax - finalMin < minRange) {
5681
5685
  const center = (finalMin + finalMax) / 2;
5682
5686
  finalMin = Math.max(restrictMin, center - minRange / 2);
@@ -5779,14 +5783,16 @@ const useRange = ({ chart })=>{
5779
5783
  ...i,
5780
5784
  globalID
5781
5785
  });
5782
- axisY.realRange = i.realRange;
5783
- axisY.step = i.step;
5784
- axisY.range = v.range;
5785
- axisY.renderRange = v.renderRange;
5786
5786
  dispatch({
5787
- payload: {
5788
- axisY
5789
- }
5787
+ payload: (state)=>({
5788
+ axisY: {
5789
+ ...state.axisY,
5790
+ realRange: i.realRange,
5791
+ step: i.step,
5792
+ range: v.range,
5793
+ renderRange: v.renderRange
5794
+ }
5795
+ })
5790
5796
  });
5791
5797
  onChange?.({
5792
5798
  range: v.range,
@@ -5794,10 +5800,10 @@ const useRange = ({ chart })=>{
5794
5800
  });
5795
5801
  }
5796
5802
  }, [
5797
- axisY,
5798
5803
  unit,
5799
5804
  onChange,
5800
- globalID
5805
+ globalID,
5806
+ dispatch
5801
5807
  ]);
5802
5808
  (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
5803
5809
  ranging.state.onChange = (i)=>{
@@ -5819,8 +5825,9 @@ const useRange = ({ chart })=>{
5819
5825
  unit
5820
5826
  ]);
5821
5827
  (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
5822
- chart?.setRange(renderRange);
5828
+ if (renderRange) chart?.setRange?.(renderRange);
5823
5829
  }, [
5830
+ chart,
5824
5831
  renderRange
5825
5832
  ]);
5826
5833
  (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
@@ -5972,7 +5979,9 @@ const Params_Params = (props)=>{
5972
5979
  if (axisY && globalID) {
5973
5980
  const currentState = store.getState();
5974
5981
  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))) {
5982
+ const currentRange = currentState.axisY.range;
5983
+ const currentUnit = currentState.axisY.unit;
5984
+ if (range?.[0] !== void 0 && (unit && isdBm(unit) && currentUnit !== unit || range[0] !== currentRange[0] && isdBm(currentUnit))) {
5976
5985
  const { realRange, renderRange } = range2realRange({
5977
5986
  range,
5978
5987
  unit,
@@ -17542,7 +17551,10 @@ const gradientItems = [
17542
17551
  ];
17543
17552
  const GradientRibbon = ()=>{
17544
17553
  const { state: { axisY: { range }, globalID } } = useStore_useStore();
17545
- const [minValue, maxValue] = range;
17554
+ const [minValue, maxValue] = range ?? [
17555
+ 0,
17556
+ 0
17557
+ ];
17546
17558
  const [currentIndex, setCurrentIndex] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(initialIndex);
17547
17559
  const currentColors = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>[
17548
17560
  ...gradientItems[currentIndex]
@@ -17735,7 +17747,8 @@ const DialChart = (props)=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx
17735
17747
  const Dial_Dial = withChartPublisher(DialChart, 'Dial');
17736
17748
  const charts_Dial = Dial_Dial;
17737
17749
  const InteractionSurface = ({ children, padding, limit, step, setLimit, onChange })=>{
17738
- const { state: { axisY: { range: [min, max] } } } = useStore_useStore();
17750
+ const { state: { axisY: { range = constants_RANGE_DEFAULT } } } = useStore_useStore();
17751
+ const [min, max] = range;
17739
17752
  const ref = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(null);
17740
17753
  const [down, setDown] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
17741
17754
  const toLimit = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((e)=>{
@@ -17815,7 +17828,6 @@ class GaugeRender extends BaseRenderer {
17815
17828
  const { id, props } = this.state;
17816
17829
  if (!id) return;
17817
17830
  this.state.chart = new __WEBPACK_EXTERNAL_MODULE__rfkit_renderer_d3372451__.Gauge({
17818
- id,
17819
17831
  ...getThemeFillStyle(document.getElementById(id)),
17820
17832
  ...props
17821
17833
  });
@@ -17994,7 +18006,7 @@ const ZoomViewportLayer = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.fo
17994
18006
  style: customStyle,
17995
18007
  children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
17996
18008
  className: "absolute right-0 top-0 flex h-full w-full self-center",
17997
- style: zoomStyle,
18009
+ style: zoomStyle ?? void 0,
17998
18010
  children: children
17999
18011
  })
18000
18012
  });
@@ -18004,9 +18016,9 @@ const AXIS_X_TICKS_LAYER_CLASS_NAME = 'absolute right-0 top-0 flex h-full w-full
18004
18016
  const AXIS_X_TICKS_SHELL_CLASS_NAME = 'relative h-6 w-full select-none overflow-hidden text-xs leading-6';
18005
18017
  const MSCAN_SEGMENT_CLASS_NAME = 'flex flex-1 items-center justify-center';
18006
18018
  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;
18019
+ const { state: { zoom: { interval: { start: intervalStart, end: intervalEnd } }, axisX: { unit = '', unitKHz = '' }, segments } } = useStore_useStore();
18020
+ const totalPoints = segments.totalPoints ?? 0;
18021
+ const endIndex = Math.max(totalPoints - 1, 0);
18010
18022
  const { start, bandwidth = 0 } = segments[0] ?? {};
18011
18023
  const center = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
18012
18024
  if (!endIndex || !bandwidth || void 0 === start) return 0;
@@ -18076,11 +18088,12 @@ const FrequencyTick = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.memo)(
18076
18088
  });
18077
18089
  const TICK_COUNT = 5;
18078
18090
  const DataNFixedTicks = ()=>{
18079
- const { state: { segments: { totalPoints }, zoom: { interval: { start: intervalStart, end: intervalEnd } }, axisX: { frequencyFormat } } } = useStore_useStore();
18091
+ const { state: { segments, zoom: { interval: { start: intervalStart, end: intervalEnd } }, axisX: { frequencyFormat } } } = useStore_useStore();
18092
+ const totalPoints = segments.totalPoints ?? 0;
18080
18093
  const getFrequencyByIndex = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((index)=>{
18081
18094
  if (!totalPoints) return 0;
18082
18095
  const percentage = Math.min(100 * index / totalPoints, 100);
18083
- return frequencyFormat(percentage);
18096
+ return frequencyFormat?.(percentage) ?? '';
18084
18097
  }, [
18085
18098
  totalPoints,
18086
18099
  frequencyFormat
@@ -18195,8 +18208,8 @@ const FlexBox = (props)=>{
18195
18208
  };
18196
18209
  const components_FlexBox = FlexBox;
18197
18210
  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"];
18211
+ const [restrictMin, restrictMax] = restrict ?? constants_restrictList["dBμV"];
18212
+ const isDefaultRestrict = restrictMin === constants_restrictList["dBμV"]["0"] && restrictMax === constants_restrictList["dBμV"]["1"];
18200
18213
  return isDefaultRestrict ? constants_RANGE_DEFAULT : [
18201
18214
  restrictMin,
18202
18215
  restrictMax
@@ -18478,7 +18491,7 @@ const resolveCursorIndexByLeft = (left, outputLength, maxPoints)=>{
18478
18491
  globalIndex: spectrum_analyzer_leftToIndex(safeLeft, maxPoints)
18479
18492
  };
18480
18493
  };
18481
- const resampleMultiple = ({ antennaFactorData, antennaFactorSwitch = false, outputPoints, realData, maxData, minData, avgData, templateData, backgroundNoiseData, fluorescenceData, occupancyData, enablePeakStats = false, maxPeaks = 2, outputRangeStart = 0 })=>{
18494
+ const resampleMultiple = ({ antennaFactorData, antennaFactorSwitch = false, outputPoints, realData, maxData, minData, avgData, templateData, backgroundNoiseData, thresholdData, fluorescenceData, occupancyData, enablePeakStats = false, maxPeaks = 2, outputRangeStart = 0 })=>{
18482
18495
  const realDataLength = realData.length;
18483
18496
  const isLessThanDataLength = realDataLength <= outputPoints;
18484
18497
  const outputLength = isLessThanDataLength ? realDataLength : outputPoints;
@@ -18488,6 +18501,7 @@ const resampleMultiple = ({ antennaFactorData, antennaFactorSwitch = false, outp
18488
18501
  const hasTemplateData = templateData && templateData.length > 0;
18489
18502
  const hasOccupancyData = occupancyData && occupancyData.length > 0;
18490
18503
  const hasBackgroundNoiseData = backgroundNoiseData && backgroundNoiseData.length > 0;
18504
+ const hasThresholdData = thresholdData && thresholdData.length > 0;
18491
18505
  const hasFluorescenceStats = fluorescenceData && fluorescenceData.length > 0;
18492
18506
  const candidatePeaks = [];
18493
18507
  const applyAntennaFactor = antennaFactorSwitch ? (value1, index)=>value1 + antennaFactorData[index] : (value1)=>value1;
@@ -18499,6 +18513,7 @@ const resampleMultiple = ({ antennaFactorData, antennaFactorSwitch = false, outp
18499
18513
  const templateOutputData = new Float32Array(hasTemplateData ? outputLength : 0);
18500
18514
  const occupancyOutputData = new Float32Array(hasOccupancyData ? outputLength : 0);
18501
18515
  const backgroundNoiseOutputData = new Float32Array(hasBackgroundNoiseData ? outputLength : 0);
18516
+ const thresholdOutputData = new Float32Array(hasThresholdData ? outputLength : 0);
18502
18517
  let fluorescenceOutputData = new Array(hasFluorescenceStats ? outputLength : 0).fill(null);
18503
18518
  const srcIndexCache = new Uint32Array(outputLength);
18504
18519
  if (isLessThanDataLength) {
@@ -18512,6 +18527,7 @@ const resampleMultiple = ({ antennaFactorData, antennaFactorSwitch = false, outp
18512
18527
  if (hasTemplateData) templateOutputData[i] = templateData[i] + antennaFactor;
18513
18528
  if (hasOccupancyData) occupancyOutputData[i] = occupancyData[i];
18514
18529
  if (hasBackgroundNoiseData) backgroundNoiseOutputData[i] = backgroundNoiseData[i] + antennaFactor;
18530
+ if (hasThresholdData) thresholdOutputData[i] = thresholdData[i] + antennaFactor;
18515
18531
  if (hasFluorescenceStats) {
18516
18532
  const fluorescence = fluorescenceData[i];
18517
18533
  const newFluorescence = new Map;
@@ -18527,6 +18543,7 @@ const resampleMultiple = ({ antennaFactorData, antennaFactorSwitch = false, outp
18527
18543
  if (hasTemplateData) templateOutputData.set(templateData);
18528
18544
  if (hasOccupancyData) occupancyOutputData.set(occupancyData);
18529
18545
  if (hasBackgroundNoiseData) backgroundNoiseOutputData.set(backgroundNoiseData);
18546
+ if (hasThresholdData) thresholdOutputData.set(thresholdData);
18530
18547
  if (hasFluorescenceStats) fluorescenceOutputData = fluorescenceData;
18531
18548
  }
18532
18549
  if (enablePeakStats) for(let i = 0; i < realDataLength; i++){
@@ -18588,6 +18605,10 @@ const resampleMultiple = ({ antennaFactorData, antennaFactorSwitch = false, outp
18588
18605
  const backgroundNoiseValue = backgroundNoiseData[realMaxIdx];
18589
18606
  backgroundNoiseOutputData[i] = applyAntennaFactor(backgroundNoiseValue, realMaxIdx);
18590
18607
  }
18608
+ if (hasThresholdData) {
18609
+ const thresholdValue = thresholdData[realMaxIdx];
18610
+ thresholdOutputData[i] = applyAntennaFactor(thresholdValue, realMaxIdx);
18611
+ }
18591
18612
  if (hasFluorescenceStats) {
18592
18613
  const fluorescence = fluorescenceData[realMaxIdx];
18593
18614
  const newFluorescence = new Map;
@@ -18613,6 +18634,7 @@ const resampleMultiple = ({ antennaFactorData, antennaFactorSwitch = false, outp
18613
18634
  templateOutputData,
18614
18635
  occupancyOutputData,
18615
18636
  backgroundNoiseOutputData,
18637
+ thresholdOutputData,
18616
18638
  srcIndexCache,
18617
18639
  fluorescenceOutputData
18618
18640
  };
@@ -18765,6 +18787,7 @@ class SpectrumAnalyzer {
18765
18787
  templateData;
18766
18788
  occupancyData;
18767
18789
  backgroundNoiseData;
18790
+ thresholdData;
18768
18791
  waterfallData;
18769
18792
  srcIndexCache;
18770
18793
  realOutputData;
@@ -18774,6 +18797,7 @@ class SpectrumAnalyzer {
18774
18797
  templateOutputData;
18775
18798
  occupancyOutputData;
18776
18799
  backgroundNoiseOutputData;
18800
+ thresholdOutputData;
18777
18801
  waterfallOutputData;
18778
18802
  scanProgress;
18779
18803
  lastIndex;
@@ -18789,6 +18813,7 @@ class SpectrumAnalyzer {
18789
18813
  ["occupancy"]: false,
18790
18814
  ["template"]: false,
18791
18815
  ["backgroundNoise"]: false,
18816
+ ["threshold"]: false,
18792
18817
  ["extra"]: false
18793
18818
  };
18794
18819
  hasPendingData = false;
@@ -19109,6 +19134,7 @@ class SpectrumAnalyzer {
19109
19134
  this.clearMetricsBuffers();
19110
19135
  this.templateData = new Float32Array;
19111
19136
  this.backgroundNoiseData = new Float32Array;
19137
+ this.thresholdData = new Float32Array;
19112
19138
  this.waterfallData = Array.from({
19113
19139
  length: waterfallMaxFrames
19114
19140
  }, ()=>{
@@ -19130,6 +19156,7 @@ class SpectrumAnalyzer {
19130
19156
  this.templateOutputData = new Float32Array;
19131
19157
  this.occupancyOutputData = new Float32Array;
19132
19158
  this.backgroundNoiseOutputData = new Float32Array;
19159
+ this.thresholdOutputData = new Float32Array;
19133
19160
  this.fluorescenceData = enableFluorescence ? new Uint32Array(maxPoints * FLUORESCENCE.LEVEL_RANGE) : new Uint32Array(0);
19134
19161
  this.fluorescenceMaxCount = 0;
19135
19162
  this.fluorescenceUpdateCounter = 0;
@@ -19145,6 +19172,7 @@ class SpectrumAnalyzer {
19145
19172
  ["occupancy"]: false,
19146
19173
  ["template"]: false,
19147
19174
  ["backgroundNoise"]: false,
19175
+ ["threshold"]: false,
19148
19176
  ["extra"]: false
19149
19177
  };
19150
19178
  this.hasPendingData = false;
@@ -19156,6 +19184,7 @@ class SpectrumAnalyzer {
19156
19184
  avgData: this.avgData,
19157
19185
  templateData: this.templateData,
19158
19186
  backgroundNoiseData: this.backgroundNoiseData,
19187
+ thresholdData: this.thresholdData,
19159
19188
  extraData: this.extraData,
19160
19189
  srcIndexCache: this.srcIndexCache,
19161
19190
  processTimes: 0,
@@ -19224,6 +19253,19 @@ class SpectrumAnalyzer {
19224
19253
  });
19225
19254
  this.setPendingFlag("backgroundNoise", false);
19226
19255
  }
19256
+ setThresholdData(data) {
19257
+ if (!data || 0 === data.length) {
19258
+ this.thresholdData = new Float32Array(0);
19259
+ this.setPendingFlag("threshold", false);
19260
+ return;
19261
+ }
19262
+ this.thresholdData = new Float32Array(data);
19263
+ if (!this.hasProcessedData || this.isProcessing) return void this.setPendingFlag("threshold", true);
19264
+ this.notifySpectrumUpdate({
19265
+ thresholdData: this.resampleSingleData(this.thresholdData)
19266
+ });
19267
+ this.setPendingFlag("threshold", false);
19268
+ }
19227
19269
  updateTemplateOverData(forceFullCalculation = false, incrementalRange) {
19228
19270
  if (!this.templateData || 0 === this.templateData.length) {
19229
19271
  this.cachedExceedingDatas = [];
@@ -19255,9 +19297,9 @@ class SpectrumAnalyzer {
19255
19297
  return templateOverData;
19256
19298
  }
19257
19299
  resampleDataSeries() {
19258
- const { antennaFactorData, antennaFactorSwitch, maxData, minData, avgData, templateData, occupancyData, backgroundNoiseData, config: { maxPoints, outputPoints } } = this;
19300
+ const { antennaFactorData, antennaFactorSwitch, maxData, minData, avgData, templateData, occupancyData, backgroundNoiseData, thresholdData, config: { maxPoints, outputPoints } } = this;
19259
19301
  const activeAntennaFactorData = antennaFactorSwitch ? antennaFactorData : new Float32Array(maxPoints);
19260
- const { realOutputData, srcIndexCache, maxOutputData, minOutputData, avgOutputData, templateOutputData, occupancyOutputData, backgroundNoiseOutputData } = resampleMultiple({
19302
+ const { realOutputData, srcIndexCache, maxOutputData, minOutputData, avgOutputData, templateOutputData, occupancyOutputData, backgroundNoiseOutputData, thresholdOutputData } = resampleMultiple({
19261
19303
  antennaFactorData: activeAntennaFactorData,
19262
19304
  antennaFactorSwitch,
19263
19305
  outputPoints,
@@ -19268,6 +19310,7 @@ class SpectrumAnalyzer {
19268
19310
  templateData: templateData && templateData.length > 0 ? this.getOutputData(templateData) : void 0,
19269
19311
  occupancyData: occupancyData && occupancyData.length > 0 ? this.getOutputData(occupancyData) : void 0,
19270
19312
  backgroundNoiseData: backgroundNoiseData && backgroundNoiseData.length > 0 ? this.getOutputData(backgroundNoiseData) : void 0,
19313
+ thresholdData: thresholdData && thresholdData.length > 0 ? this.getOutputData(thresholdData) : void 0,
19271
19314
  enablePeakStats: this.config.processing.enablePeakStats,
19272
19315
  maxPeaks: this.config.peakDetection.maxPeaks,
19273
19316
  outputRangeStart: this.config.outputRange.start
@@ -19280,6 +19323,7 @@ class SpectrumAnalyzer {
19280
19323
  this.templateOutputData = templateOutputData || new Float32Array;
19281
19324
  this.occupancyOutputData = occupancyOutputData || new Float32Array;
19282
19325
  this.backgroundNoiseOutputData = backgroundNoiseOutputData || new Float32Array;
19326
+ this.thresholdOutputData = thresholdOutputData || new Float32Array;
19283
19327
  const fluorescenceOutput = this.getFluorescenceOutputData(realOutputData.length);
19284
19328
  return {
19285
19329
  realData: realOutputData,
@@ -19289,6 +19333,7 @@ class SpectrumAnalyzer {
19289
19333
  templateData: templateOutputData,
19290
19334
  occupancyData: occupancyOutputData,
19291
19335
  backgroundNoiseData: backgroundNoiseOutputData,
19336
+ thresholdData: thresholdOutputData,
19292
19337
  fluorescenceData: fluorescenceOutput,
19293
19338
  fluorescenceMaxCount: this.fluorescenceMaxCount,
19294
19339
  extraData: this.extraOutputData,
@@ -19378,7 +19423,7 @@ class SpectrumAnalyzer {
19378
19423
  }
19379
19424
  setPendingFlag(type, value1) {
19380
19425
  this.pendingDataFlags[type] = value1;
19381
- this.hasPendingData = this.pendingDataFlags["occupancy"] || this.pendingDataFlags["template"] || this.pendingDataFlags["backgroundNoise"] || this.pendingDataFlags["extra"];
19426
+ this.hasPendingData = this.pendingDataFlags["occupancy"] || this.pendingDataFlags["template"] || this.pendingDataFlags["backgroundNoise"] || this.pendingDataFlags["threshold"] || this.pendingDataFlags["extra"];
19382
19427
  }
19383
19428
  resampleSingleData(sourceData) {
19384
19429
  const { srcIndexCache } = this;
@@ -19406,6 +19451,10 @@ class SpectrumAnalyzer {
19406
19451
  pendingOutput.backgroundNoiseData = this.resampleSingleData(this.backgroundNoiseData);
19407
19452
  this.setPendingFlag("backgroundNoise", false);
19408
19453
  }
19454
+ if (this.pendingDataFlags["threshold"] && this.thresholdData.length > 0) {
19455
+ pendingOutput.thresholdData = this.resampleSingleData(this.thresholdData);
19456
+ this.setPendingFlag("threshold", false);
19457
+ }
19409
19458
  if (this.pendingDataFlags["extra"] && Object.keys(this.extraData).length > 0) {
19410
19459
  this.extraOutputData = resampleExtraData(this.extraData, this.antennaFactorData, this.antennaFactorSwitch, this.srcIndexCache, this.getOutputData.bind(this));
19411
19460
  pendingOutput.extraData = this.extraOutputData;
@@ -19446,7 +19495,7 @@ class SpectrumAnalyzer {
19446
19495
  return outputData;
19447
19496
  }
19448
19497
  getAllRawData(left) {
19449
- const { realOutputData, maxOutputData, minOutputData, avgOutputData, templateOutputData, occupancyOutputData, backgroundNoiseOutputData, waterfallOutputData, extraOutputData, srcIndexCache } = this;
19498
+ const { realOutputData, maxOutputData, minOutputData, avgOutputData, templateOutputData, occupancyOutputData, backgroundNoiseOutputData, thresholdOutputData, waterfallOutputData, extraOutputData, srcIndexCache } = this;
19450
19499
  realOutputData.timestamp = this.realData.timestamp;
19451
19500
  const rawData = {
19452
19501
  realData: this.realData,
@@ -19456,6 +19505,7 @@ class SpectrumAnalyzer {
19456
19505
  templateData: this.templateData,
19457
19506
  occupancyData: this.occupancyData,
19458
19507
  backgroundNoiseData: this.backgroundNoiseData,
19508
+ thresholdData: this.thresholdData,
19459
19509
  waterfallData: this.waterfallData,
19460
19510
  extraData: this.extraData
19461
19511
  };
@@ -19468,6 +19518,7 @@ class SpectrumAnalyzer {
19468
19518
  templateData: templateOutputData,
19469
19519
  occupancyData: occupancyOutputData,
19470
19520
  backgroundNoiseData: backgroundNoiseOutputData,
19521
+ thresholdData: thresholdOutputData,
19471
19522
  fluorescenceData: this.getFluorescenceOutputData(realOutputData.length),
19472
19523
  waterfallData: waterfallOutputData,
19473
19524
  extraData: extraOutputData,
@@ -19626,7 +19677,7 @@ class SeriesManager {
19626
19677
  return true;
19627
19678
  }
19628
19679
  }
19629
- const events_SeriesEventName = {
19680
+ const SeriesEventName = {
19630
19681
  UPDATED: 'series:updated',
19631
19682
  ADDED: 'series:added',
19632
19683
  REMOVED: 'series:removed',
@@ -19677,7 +19728,7 @@ function subscribeToSeries(globalID, event, listener) {
19677
19728
  if (data.globalID === globalID) listener(data);
19678
19729
  });
19679
19730
  }
19680
- function events_emitSeriesEvent(event, data) {
19731
+ function emitSeriesEvent(event, data) {
19681
19732
  seriesEvents.emit(event, data);
19682
19733
  }
19683
19734
  var modes_SeriesMode = /*#__PURE__*/ function(SeriesMode) {
@@ -19738,7 +19789,7 @@ function getNextMode(currentMode) {
19738
19789
  function setSeriesMode(globalID, mode) {
19739
19790
  seriesModes.set(globalID, mode);
19740
19791
  const modeConfig = SERIES_MODES[mode];
19741
- events_emitSeriesEvent(events_SeriesEventName.MODE_CHANGED, {
19792
+ emitSeriesEvent(SeriesEventName.MODE_CHANGED, {
19742
19793
  globalID,
19743
19794
  mode,
19744
19795
  config: modeConfig
@@ -19756,7 +19807,7 @@ function initSeriesSubscription(renderer) {
19756
19807
  return null;
19757
19808
  }
19758
19809
  const subscriptions = [];
19759
- subscriptions.push(subscribeToSeries(globalID, events_SeriesEventName.UPDATED, (data)=>{
19810
+ subscriptions.push(subscribeToSeries(globalID, SeriesEventName.UPDATED, (data)=>{
19760
19811
  const correctType = getCorrectSeriesType(globalID, data.seriesName);
19761
19812
  const configWithCorrectType = {
19762
19813
  ...data.config,
@@ -19765,13 +19816,13 @@ function initSeriesSubscription(renderer) {
19765
19816
  renderer.setSeries(configWithCorrectType, true);
19766
19817
  renderer.state.chart?.draw();
19767
19818
  }));
19768
- subscriptions.push(subscribeToSeries(globalID, events_SeriesEventName.MODE_CHANGED, ()=>{
19819
+ subscriptions.push(subscribeToSeries(globalID, SeriesEventName.MODE_CHANGED, ()=>{
19769
19820
  renderer.initSeries();
19770
19821
  }));
19771
- subscriptions.push(subscribeToSeries(globalID, events_SeriesEventName.TYPE_OVERRIDE_CHANGED, ()=>{
19822
+ subscriptions.push(subscribeToSeries(globalID, SeriesEventName.TYPE_OVERRIDE_CHANGED, ()=>{
19772
19823
  renderer.initSeries();
19773
19824
  }));
19774
- subscriptions.push(subscribeToSeries(globalID, events_SeriesEventName.BATCH_UPDATED, (data)=>{
19825
+ subscriptions.push(subscribeToSeries(globalID, SeriesEventName.BATCH_UPDATED, (data)=>{
19775
19826
  data.configs.forEach((config)=>{
19776
19827
  const correctType = getCorrectSeriesType(globalID, config.name);
19777
19828
  const configWithCorrectType = {
@@ -19782,7 +19833,7 @@ function initSeriesSubscription(renderer) {
19782
19833
  });
19783
19834
  renderer.state.chart?.draw();
19784
19835
  }));
19785
- subscriptions.push(subscribeToSeries(globalID, events_SeriesEventName.RESET, ()=>{
19836
+ subscriptions.push(subscribeToSeries(globalID, SeriesEventName.RESET, ()=>{
19786
19837
  if (renderer.state.series) renderer.state.series = {};
19787
19838
  renderer.initSeries();
19788
19839
  }));
@@ -19794,7 +19845,7 @@ const chartTypeSeriesOverrides = new Map();
19794
19845
  function setChartTypeSeriesOverride(globalID, seriesName, type) {
19795
19846
  if (!chartTypeSeriesOverrides.has(globalID)) chartTypeSeriesOverrides.set(globalID, new Map());
19796
19847
  chartTypeSeriesOverrides.get(globalID)?.set(seriesName, type);
19797
- events_emitSeriesEvent(events_SeriesEventName.TYPE_OVERRIDE_CHANGED, {
19848
+ emitSeriesEvent(SeriesEventName.TYPE_OVERRIDE_CHANGED, {
19798
19849
  globalID,
19799
19850
  seriesName,
19800
19851
  type
@@ -19803,7 +19854,7 @@ function setChartTypeSeriesOverride(globalID, seriesName, type) {
19803
19854
  function clearChartTypeSeriesOverrides(globalID) {
19804
19855
  const hadOverrides = chartTypeSeriesOverrides.has(globalID);
19805
19856
  chartTypeSeriesOverrides.delete(globalID);
19806
- if (hadOverrides) events_emitSeriesEvent(events_SeriesEventName.TYPE_OVERRIDE_CHANGED, {
19857
+ if (hadOverrides) emitSeriesEvent(SeriesEventName.TYPE_OVERRIDE_CHANGED, {
19807
19858
  globalID
19808
19859
  });
19809
19860
  }
@@ -19867,16 +19918,18 @@ function getSeriesMap(globalID) {
19867
19918
  return seriesMap;
19868
19919
  }
19869
19920
  function mergeSeriesConfig(config, existing) {
19921
+ const defaultConfig = getSeriesConfig()[config.name];
19870
19922
  const defaults = {
19871
- label: '',
19872
- display: true,
19923
+ label: defaultConfig?.label ?? '',
19924
+ color: defaultConfig?.color,
19925
+ display: defaultConfig?.display ?? true,
19873
19926
  type: __WEBPACK_EXTERNAL_MODULE__rfkit_renderer_d3372451__.GraphicType.Line,
19874
- thickness: 1
19927
+ thickness: defaultConfig?.thickness ?? 1
19875
19928
  };
19876
19929
  return {
19877
19930
  name: config.name,
19878
19931
  label: config.label ?? existing?.label ?? defaults.label,
19879
- color: config.color ?? existing?.color ?? (()=>{
19932
+ color: config.color ?? existing?.color ?? defaults.color ?? (()=>{
19880
19933
  throw new Error(`Series "${config.name}" does not exist and must have a color defined`);
19881
19934
  })(),
19882
19935
  display: config.display ?? existing?.display ?? defaults.display,
@@ -19884,14 +19937,21 @@ function mergeSeriesConfig(config, existing) {
19884
19937
  thickness: config.thickness ?? existing?.thickness ?? defaults.thickness
19885
19938
  };
19886
19939
  }
19940
+ function upsertSeriesConfig(manager, finalConfig, existing) {
19941
+ if (!existing) return void manager.addSeries(finalConfig);
19942
+ manager.setSeriesProperty(finalConfig.name, 'label', finalConfig.label);
19943
+ manager.setSeriesProperty(finalConfig.name, 'color', finalConfig.color);
19944
+ manager.setSeriesProperty(finalConfig.name, 'thickness', finalConfig.thickness);
19945
+ manager.setSeriesProperty(finalConfig.name, 'display', finalConfig.display);
19946
+ manager.setSeriesProperty(finalConfig.name, 'type', finalConfig.type);
19947
+ }
19887
19948
  function updateSeries(globalID, config) {
19888
19949
  if (!config?.name) return;
19889
19950
  const manager = getSeriesManager(globalID);
19890
19951
  const existing = manager.getSeries(config.name);
19891
19952
  const finalConfig = mergeSeriesConfig(config, existing);
19892
- if (existing) manager.removeSeries(config.name);
19893
- manager.addSeries(finalConfig);
19894
- events_emitSeriesEvent(events_SeriesEventName.UPDATED, {
19953
+ upsertSeriesConfig(manager, finalConfig, existing);
19954
+ emitSeriesEvent(SeriesEventName.UPDATED, {
19895
19955
  globalID,
19896
19956
  seriesName: config.name,
19897
19957
  config: {
@@ -19918,10 +19978,32 @@ function resetSeries(globalID) {
19918
19978
  thickness: config.thickness
19919
19979
  });
19920
19980
  });
19921
- events_emitSeriesEvent(events_SeriesEventName.RESET, {
19981
+ emitSeriesEvent(SeriesEventName.RESET, {
19922
19982
  globalID
19923
19983
  });
19924
19984
  }
19985
+ function batchUpdateSeries(globalID, configs) {
19986
+ const manager = getSeriesManager(globalID);
19987
+ const updatedConfigs = [];
19988
+ configs.forEach((config)=>{
19989
+ if (!config?.name) return;
19990
+ const existing = manager.getSeries(config.name);
19991
+ const finalConfig = mergeSeriesConfig(config, existing);
19992
+ upsertSeriesConfig(manager, finalConfig, existing);
19993
+ updatedConfigs.push({
19994
+ name: finalConfig.name,
19995
+ label: finalConfig.label,
19996
+ color: finalConfig.color,
19997
+ thickness: finalConfig.thickness,
19998
+ display: finalConfig.display,
19999
+ type: finalConfig.type
20000
+ });
20001
+ });
20002
+ if (updatedConfigs.length > 0) emitSeriesEvent(SeriesEventName.BATCH_UPDATED, {
20003
+ globalID,
20004
+ configs: updatedConfigs
20005
+ });
20006
+ }
19925
20007
  function getSeriesWithGraphicType(globalID) {
19926
20008
  const seriesMap = getSeriesMap(globalID);
19927
20009
  const result = new Map();
@@ -19993,6 +20075,10 @@ function useSpectrumChartType({ type, heatmapElementID }) {
19993
20075
  };
19994
20076
  }
19995
20077
  if (type === constants_ChartType.LiteNormalized) {
20078
+ const nextRestrict = nextAxisY.restrict ?? [
20079
+ 0,
20080
+ 1
20081
+ ];
19996
20082
  if (false !== nextLimit.show) nextLimit = {
19997
20083
  ...nextLimit,
19998
20084
  show: false
@@ -20001,7 +20087,7 @@ function useSpectrumChartType({ type, heatmapElementID }) {
20001
20087
  ...nextSignal,
20002
20088
  show: false
20003
20089
  };
20004
- if (0 !== nextAxisY.restrict[0] || 1 !== nextAxisY.restrict[1]) nextAxisY = {
20090
+ if (0 !== nextRestrict[0] || 1 !== nextRestrict[1]) nextAxisY = {
20005
20091
  ...nextAxisY,
20006
20092
  restrict: [
20007
20093
  0,
@@ -20028,6 +20114,10 @@ function useSpectrumChartType({ type, heatmapElementID }) {
20028
20114
  };
20029
20115
  }
20030
20116
  if (type === constants_ChartType.ScanDF360) {
20117
+ const nextRestrict = nextAxisY.restrict ?? [
20118
+ 0,
20119
+ 360
20120
+ ];
20031
20121
  if (false !== nextLimit.show) nextLimit = {
20032
20122
  ...nextLimit,
20033
20123
  show: false
@@ -20052,7 +20142,7 @@ function useSpectrumChartType({ type, heatmapElementID }) {
20052
20142
  ...nextFrequencyAllocation,
20053
20143
  show: false
20054
20144
  };
20055
- nextAxisY = "\xb0" !== nextAxisY.unit || 36 !== nextAxisY.step || 0 !== nextAxisY.restrict[0] || 360 !== nextAxisY.restrict[1] ? {
20145
+ nextAxisY = "\xb0" !== nextAxisY.unit || 36 !== nextAxisY.step || 0 !== nextRestrict[0] || 360 !== nextRestrict[1] ? {
20056
20146
  ...applyAxisYRange(nextAxisY, [
20057
20147
  0,
20058
20148
  360
@@ -20092,7 +20182,8 @@ function useSpectrumChartType({ type, heatmapElementID }) {
20092
20182
  ]);
20093
20183
  (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
20094
20184
  if (type === constants_ChartType.LiteNormalized && globalID) {
20095
- if (axisY.range[0] < 0 || axisY.range[1] > 1) {
20185
+ const currentRange = axisY.range ?? constants_RANGE_DEFAULT;
20186
+ if (currentRange[0] < 0 || currentRange[1] > 1) {
20096
20187
  const nextAxisY = applyAxisYRange(axisY, [
20097
20188
  0,
20098
20189
  1
@@ -20102,7 +20193,10 @@ function useSpectrumChartType({ type, heatmapElementID }) {
20102
20193
  axisY: nextAxisY
20103
20194
  }
20104
20195
  });
20105
- useRangeSet(globalID)(nextAxisY.range);
20196
+ useRangeSet(globalID)(nextAxisY.range ?? [
20197
+ 0,
20198
+ 1
20199
+ ]);
20106
20200
  }
20107
20201
  }
20108
20202
  }, [
@@ -20205,7 +20299,7 @@ function useSpectrumRule(type) {
20205
20299
  let isScanSegmentsUpdateMagnify = false;
20206
20300
  if (event === constants_SegmentsEvent.Focus && totalPoints) {
20207
20301
  const endIndex = totalPoints - 1;
20208
- if (index < segments.length) {
20302
+ if ('number' == typeof index && index < segments.length) {
20209
20303
  for(let i = 0; i < index; i += 1)start += segments[i].point + 1;
20210
20304
  const { point } = segments[index];
20211
20305
  end = start + point;
@@ -20226,7 +20320,7 @@ function useSpectrumRule(type) {
20226
20320
  zoom
20227
20321
  }
20228
20322
  });
20229
- if (event === constants_SegmentsEvent.Cover) setSegments(generateGreatSegments(e.data));
20323
+ if (event === constants_SegmentsEvent.Cover && e.data) setSegments(generateGreatSegments(e.data));
20230
20324
  }, [
20231
20325
  segments
20232
20326
  ]);
@@ -20313,7 +20407,7 @@ const Ticks_Ticks = (props)=>{
20313
20407
  }, []);
20314
20408
  (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
20315
20409
  if (id && globalID) withUpdateData(id, COMPONENT_KEY, ()=>{
20316
- const { waterfallData } = withDatabase(globalID).getAllRawData();
20410
+ const waterfallData = withDatabase(globalID).getAllRawData().waterfallData ?? [];
20317
20411
  const values = [];
20318
20412
  const dataLength = waterfallData.length;
20319
20413
  for(let i = 0; i < HEATMAP_FULL_TICKS; i++){
@@ -20360,7 +20454,7 @@ const AxisYHeatmap = (props)=>{
20360
20454
  const { state: { axisY } } = useStore_useStore();
20361
20455
  const { linkage, renderRange, show } = axisY;
20362
20456
  (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
20363
- if (linkage) chart?.setRange(renderRange);
20457
+ if (linkage && renderRange) chart?.setRange?.(renderRange);
20364
20458
  }, [
20365
20459
  renderRange
20366
20460
  ]);
@@ -20397,16 +20491,14 @@ const createWheelEventManager = (id, name, func)=>subscription_createSubscriptio
20397
20491
  const createDragEventManager = (id, name, func)=>subscription_createSubscriptionManager(`${generateRecursiveId(id, func)}-drag`, name, func, id);
20398
20492
  const createLongPressEventManager = (id, name, func)=>subscription_createSubscriptionManager(`${generateRecursiveId(id, func)}-long-press`, name, func, id);
20399
20493
  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
- }
20494
+ const { target, clientX, clientY } = e;
20495
+ const { left, top, width, height } = target.getBoundingClientRect();
20496
+ const x = (clientX - left) / width * 100;
20497
+ const y = (clientY - top) / height * 100;
20498
+ return {
20499
+ left: x,
20500
+ top: y
20501
+ };
20410
20502
  };
20411
20503
  const EVENT_PRIORITY_LEVEL_DEFAULT = 'void';
20412
20504
  const EVENT_PRIORITY_LEVELS = {
@@ -20500,32 +20592,32 @@ function useSeriesManager(globalID, options = {}) {
20500
20592
  const unsubscribers = [];
20501
20593
  if (subscribeToMode) {
20502
20594
  setMode(getSeriesMode(globalID));
20503
- const unsubscribeMode = subscribeToSeries(globalID, events_SeriesEventName.MODE_CHANGED, (data)=>{
20595
+ const unsubscribeMode = subscribeToSeries(globalID, SeriesEventName.MODE_CHANGED, (data)=>{
20504
20596
  setMode(data.mode);
20505
20597
  });
20506
20598
  unsubscribers.push(unsubscribeMode);
20507
20599
  }
20508
20600
  if (subscribeToData) {
20509
- const unsubscribeUpdated = subscribeToSeries(globalID, events_SeriesEventName.UPDATED, (data)=>{
20601
+ const unsubscribeUpdated = subscribeToSeries(globalID, SeriesEventName.UPDATED, (data)=>{
20510
20602
  if (watchSeries && !watchSeries.includes(data.seriesName)) return;
20511
20603
  forceUpdate();
20512
20604
  });
20513
20605
  unsubscribers.push(unsubscribeUpdated);
20514
- const unsubscribeAdded = subscribeToSeries(globalID, events_SeriesEventName.ADDED, (data)=>{
20606
+ const unsubscribeAdded = subscribeToSeries(globalID, SeriesEventName.ADDED, (data)=>{
20515
20607
  if (watchSeries && !watchSeries.includes(data.seriesName)) return;
20516
20608
  forceUpdate();
20517
20609
  });
20518
20610
  unsubscribers.push(unsubscribeAdded);
20519
- const unsubscribeRemoved = subscribeToSeries(globalID, events_SeriesEventName.REMOVED, (data)=>{
20611
+ const unsubscribeRemoved = subscribeToSeries(globalID, SeriesEventName.REMOVED, (data)=>{
20520
20612
  if (watchSeries && !watchSeries.includes(data.seriesName)) return;
20521
20613
  forceUpdate();
20522
20614
  });
20523
20615
  unsubscribers.push(unsubscribeRemoved);
20524
- const unsubscribeBatchUpdated = subscribeToSeries(globalID, events_SeriesEventName.BATCH_UPDATED, ()=>{
20616
+ const unsubscribeBatchUpdated = subscribeToSeries(globalID, SeriesEventName.BATCH_UPDATED, ()=>{
20525
20617
  forceUpdate();
20526
20618
  });
20527
20619
  unsubscribers.push(unsubscribeBatchUpdated);
20528
- const unsubscribeReset = subscribeToSeries(globalID, events_SeriesEventName.RESET, ()=>{
20620
+ const unsubscribeReset = subscribeToSeries(globalID, SeriesEventName.RESET, ()=>{
20529
20621
  forceUpdate();
20530
20622
  });
20531
20623
  unsubscribers.push(unsubscribeReset);
@@ -20554,21 +20646,14 @@ function useSeriesForComponent(globalID) {
20554
20646
  subscribeToData: true
20555
20647
  });
20556
20648
  }
20557
- const stableOrderMap = new Map();
20558
- function getStableOrder(globalID, currentNames) {
20559
- const stored = stableOrderMap.get(globalID) || [];
20560
- const needsUpdate = 0 === stored.length || currentNames.some((name)=>!stored.includes(name)) || stored.some((name)=>!currentNames.includes(name));
20561
- if (needsUpdate) {
20562
- const newOrder = [
20563
- ...stored.filter((name)=>currentNames.includes(name)),
20564
- ...currentNames.filter((name)=>!stored.includes(name))
20565
- ];
20566
- stableOrderMap.set(globalID, newOrder);
20567
- return newOrder;
20568
- }
20569
- return stored;
20649
+ const DEFAULT_SERIES_ORDER = Object.values(getSeriesConfig()).map((config)=>config.name);
20650
+ function getStableOrder(currentNames) {
20651
+ return [
20652
+ ...DEFAULT_SERIES_ORDER.filter((name)=>currentNames.includes(name)),
20653
+ ...currentNames.filter((name)=>!DEFAULT_SERIES_ORDER.includes(name))
20654
+ ];
20570
20655
  }
20571
- function useFilteredSeries(globalID, filter) {
20656
+ function useFilteredSeries_useFilteredSeries(globalID, filter) {
20572
20657
  const { series } = useSeriesManager(globalID);
20573
20658
  const { state: { series: { legendExternal } } } = useStore_useStore();
20574
20659
  const filteredData = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
@@ -20577,12 +20662,8 @@ function useFilteredSeries(globalID, filter) {
20577
20662
  if (config.name === constants_SeriesType.TemplateData) return false;
20578
20663
  return filter ? filter(config) : true;
20579
20664
  });
20580
- if (!globalID) return filtered.map((config, index)=>({
20581
- ...config,
20582
- originalIndex: index
20583
- }));
20584
20665
  const currentNames = filtered.map((s)=>s.name);
20585
- const stableOrder = getStableOrder(globalID, currentNames);
20666
+ const stableOrder = getStableOrder(currentNames);
20586
20667
  const orderMap = new Map(stableOrder.map((name, i)=>[
20587
20668
  name,
20588
20669
  i
@@ -20598,20 +20679,19 @@ function useFilteredSeries(globalID, filter) {
20598
20679
  }, [
20599
20680
  series,
20600
20681
  legendExternal,
20601
- filter,
20602
- globalID
20682
+ filter
20603
20683
  ]);
20604
20684
  return filteredData;
20605
20685
  }
20606
20686
  const HeatmapCursorPopover = ({ id })=>{
20607
- const { state: { cursor: { coord }, axisX: { frequencyFormat, unit: axisXUnit }, globalID, axisY: { unit: axisYUnit } } } = useStore_useStore();
20687
+ const { state: { cursor: { coord }, axisX: { frequencyFormat, unit: axisXUnit = '' }, globalID, axisY: { unit: axisYUnit } } } = useStore_useStore();
20608
20688
  const { left, top } = coord;
20609
20689
  const updateKey = useCursorPopoverUpdateKey('HeatmapPopover', id);
20610
20690
  const [value1, setValue] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)('');
20611
20691
  const [timestamp, setTimestamp] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)('');
20612
20692
  const { getSeries } = useSeriesForComponent(globalID);
20613
20693
  (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
20614
- if (!globalID || !Number.isFinite(left) || !Number.isFinite(top)) {
20694
+ if (!globalID || 'number' != typeof left || 'number' != typeof top || !Number.isFinite(left) || !Number.isFinite(top)) {
20615
20695
  setValue('');
20616
20696
  setTimestamp('');
20617
20697
  return;
@@ -20628,12 +20708,12 @@ const HeatmapCursorPopover = ({ id })=>{
20628
20708
  if (!outputFrame || 0 === outputFrame.length) return void setValue('');
20629
20709
  const rawFrame = snapshot.rawData?.waterfallData?.[yIndex];
20630
20710
  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;
20711
+ 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
20712
  const exactRawValue = void 0 !== rawXIndex && rawFrame ? rawFrame[rawXIndex] : void 0;
20633
20713
  const sampledXIndex = leftToIndex(left, outputFrame.length);
20634
20714
  const sampledValue = outputFrame[sampledXIndex];
20635
20715
  const nextValue = Number.isFinite(exactRawValue) ? exactRawValue : sampledValue;
20636
- setValue(Number.isFinite(nextValue) ? nextValue.toFixed(1) : '');
20716
+ setValue('number' == typeof nextValue && Number.isFinite(nextValue) ? nextValue.toFixed(1) : '');
20637
20717
  const frameTimestamp = outputFrame.timestamp;
20638
20718
  setTimestamp(frameTimestamp ? String(frameTimestamp) : '');
20639
20719
  }, [
@@ -20642,7 +20722,7 @@ const HeatmapCursorPopover = ({ id })=>{
20642
20722
  top,
20643
20723
  updateKey
20644
20724
  ]);
20645
- const frequency = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>frequencyFormat(left), [
20725
+ const frequency = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>'number' == typeof left ? frequencyFormat?.(left) ?? '' : '', [
20646
20726
  left,
20647
20727
  frequencyFormat
20648
20728
  ]);
@@ -20694,7 +20774,7 @@ const LevelCursorPopover = ({ id })=>{
20694
20774
  const [value1, setValue] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)('');
20695
20775
  const [timestamp, setTimestamp] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)('');
20696
20776
  (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
20697
- if (!globalID || !Number.isFinite(left)) {
20777
+ if (!globalID || 'number' != typeof left || !Number.isFinite(left)) {
20698
20778
  setValue('');
20699
20779
  setTimestamp('');
20700
20780
  return;
@@ -20707,7 +20787,7 @@ const LevelCursorPopover = ({ id })=>{
20707
20787
  }
20708
20788
  const clampedIndex = leftToIndex(left, levelStreamData.spectrumData.length);
20709
20789
  const dataValue = levelStreamData.spectrumData[clampedIndex];
20710
- setValue(Number.isFinite(dataValue) ? dataValue.toFixed(1) : '');
20790
+ setValue('number' == typeof dataValue && Number.isFinite(dataValue) ? dataValue.toFixed(1) : '');
20711
20791
  if (levelStreamData.timestampData.length > clampedIndex) {
20712
20792
  const timestampValue = Number(levelStreamData.timestampData[clampedIndex]);
20713
20793
  if (Number.isFinite(timestampValue)) return void setTimestamp(formatTimestamp(timestampValue));
@@ -20750,16 +20830,16 @@ const LevelCursorPopover = ({ id })=>{
20750
20830
  };
20751
20831
  const Level_CursorPopover = LevelCursorPopover;
20752
20832
  const OccupancyCursorPopover = ()=>{
20753
- const { state: { cursor: { coord }, axisX: { frequencyFormat, unit: axisXUnit }, globalID } } = useStore_useStore();
20833
+ const { state: { cursor: { coord }, axisX: { frequencyFormat, unit: axisXUnit = '' }, globalID } } = useStore_useStore();
20754
20834
  const { left } = coord;
20755
20835
  const value1 = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
20756
- if (!globalID || !Number.isFinite(left)) return '';
20836
+ if (!globalID || 'number' != typeof left || !Number.isFinite(left)) return '';
20757
20837
  const snapshot = withDatabase(globalID).getAllRawData(left);
20758
20838
  const { occupancyData } = snapshot;
20759
20839
  if (occupancyData && occupancyData.length > 0) {
20760
20840
  const globalIndex = snapshot.cursorIndex?.globalIndex;
20761
20841
  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;
20842
+ 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
20843
  const sampledValue = occupancyData[leftToIndex(left, occupancyData.length)];
20764
20844
  const targetValue = Number.isFinite(exactRawValue) ? exactRawValue : sampledValue;
20765
20845
  return Number.parseFloat(Number(targetValue).toFixed(1));
@@ -20769,7 +20849,7 @@ const OccupancyCursorPopover = ()=>{
20769
20849
  globalID,
20770
20850
  left
20771
20851
  ]);
20772
- const frequency = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>frequencyFormat(left), [
20852
+ const frequency = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>'number' == typeof left ? frequencyFormat?.(left) ?? '' : '', [
20773
20853
  left,
20774
20854
  frequencyFormat
20775
20855
  ]);
@@ -21025,7 +21105,7 @@ function useStationInfoAtCursor({ frequency, enabled = true }) {
21025
21105
  cursor,
21026
21106
  enabled
21027
21107
  ]);
21028
- const currentPosition = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>isCursorActive ? frequencyCalculation_calculateCursorPosition(left, segments) : {
21108
+ const currentPosition = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>isCursorActive && 'number' == typeof left ? frequencyCalculation_calculateCursorPosition(left, segments) : {
21029
21109
  segmentIndex: -1,
21030
21110
  pointIndex: -1
21031
21111
  }, [
@@ -21034,7 +21114,7 @@ function useStationInfoAtCursor({ frequency, enabled = true }) {
21034
21114
  segments
21035
21115
  ]);
21036
21116
  return (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
21037
- if (!enabled || !Number.isFinite(left) || left < 0 || !signalItems.length || !segments?.length) return;
21117
+ if (!enabled || 'number' != typeof left || !Number.isFinite(left) || left < 0 || !signalItems.length || !segments?.length) return;
21038
21118
  if (!isCursorActive) return;
21039
21119
  const currentFrequency = frequencyCalculation_getCursorFrequencyAtPosition(segments, currentPosition);
21040
21120
  if (!Number.isFinite(currentFrequency)) {
@@ -21131,12 +21211,14 @@ const StationInfoPanel = ({ stationInfo })=>{
21131
21211
  const panels_StationInfoPanel = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].memo(StationInfoPanel);
21132
21212
  const FrequencyDataBoard = ({ left, updateKey, onChange, showStationInfo = true })=>{
21133
21213
  const { state: { axisY, axisX: { frequencyFormat, unit }, globalID } } = useStore_useStore();
21134
- const filteredSeries = useFilteredSeries(globalID, (config)=>false !== config.display);
21214
+ const filteredSeries = useFilteredSeries_useFilteredSeries(globalID, (config)=>false !== config.display);
21135
21215
  const calculateIndex = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((values, series, sampledIndex, rawValue)=>{
21136
21216
  if (!values || 0 === values.length) return null;
21137
21217
  const safeSampledIndex = Math.max(0, Math.min(values.length - 1, Math.floor(sampledIndex)));
21138
21218
  const displayValue = Number.isFinite(rawValue) ? rawValue : values[safeSampledIndex];
21139
- const level = getVirtualLevel(axisY.unit, displayValue)?.toFixed(1);
21219
+ if ('number' != typeof displayValue) return null;
21220
+ const unit = axisY.unit ?? '';
21221
+ const level = getVirtualLevel(unit, displayValue)?.toFixed(1);
21140
21222
  if (!(0, utils_array.Ri)(level)) return null;
21141
21223
  return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("div", {
21142
21224
  className: "grid max-w-[220px] grid-cols-[minmax(0,1fr)_auto] items-center gap-x-1 text-xs",
@@ -21156,7 +21238,7 @@ const FrequencyDataBoard = ({ left, updateKey, onChange, showStationInfo = true
21156
21238
  children: level
21157
21239
  }),
21158
21240
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
21159
- children: axisY.unit
21241
+ children: unit
21160
21242
  })
21161
21243
  ]
21162
21244
  })
@@ -21183,6 +21265,7 @@ const FrequencyDataBoard = ({ left, updateKey, onChange, showStationInfo = true
21183
21265
  maxData: snapshot.maxData,
21184
21266
  minData: snapshot.minData,
21185
21267
  avgData: snapshot.avgData,
21268
+ thresholdData: snapshot.thresholdData,
21186
21269
  templateData: snapshot.templateData,
21187
21270
  occupancyData: snapshot.occupancyData,
21188
21271
  backgroundNoiseData: snapshot.backgroundNoiseData,
@@ -21193,6 +21276,7 @@ const FrequencyDataBoard = ({ left, updateKey, onChange, showStationInfo = true
21193
21276
  maxData: snapshot.rawData?.maxData,
21194
21277
  minData: snapshot.rawData?.minData,
21195
21278
  avgData: snapshot.rawData?.avgData,
21279
+ thresholdData: snapshot.rawData?.thresholdData,
21196
21280
  templateData: snapshot.rawData?.templateData,
21197
21281
  occupancyData: snapshot.rawData?.occupancyData,
21198
21282
  backgroundNoiseData: snapshot.rawData?.backgroundNoiseData,
@@ -21204,12 +21288,12 @@ const FrequencyDataBoard = ({ left, updateKey, onChange, showStationInfo = true
21204
21288
  value: null,
21205
21289
  currentIndex: Number.NaN
21206
21290
  };
21207
- const currentIndex = Number.isFinite(cursorSampledIndex) ? Math.max(0, Math.min(referenceLength - 1, Math.floor(cursorSampledIndex))) : leftToIndex(left, referenceLength);
21291
+ const currentIndex = 'number' == typeof cursorSampledIndex && Number.isFinite(cursorSampledIndex) ? Math.max(0, Math.min(referenceLength - 1, Math.floor(cursorSampledIndex))) : leftToIndex(left, referenceLength);
21208
21292
  const globalIndex = Number.isFinite(snapshot.cursorIndex?.globalIndex) ? Math.floor(snapshot.cursorIndex?.globalIndex ?? 0) : void 0;
21209
21293
  const rawRealData = snapshot.rawData?.realData;
21210
21294
  const exactRawValue = void 0 !== globalIndex && rawRealData && rawRealData.length > 0 && globalIndex >= 0 && globalIndex < rawRealData.length ? rawRealData[globalIndex] : void 0;
21211
21295
  const getRawValueBySeries = (seriesName)=>{
21212
- if (!Number.isFinite(cursorGlobalIndex)) return;
21296
+ if ('number' != typeof cursorGlobalIndex || !Number.isFinite(cursorGlobalIndex)) return;
21213
21297
  const sourceData = rawSeriesMap[seriesName];
21214
21298
  if (!sourceData || 0 === sourceData.length) return;
21215
21299
  const clampedIndex = Math.max(0, Math.min(sourceData.length - 1, Math.floor(cursorGlobalIndex)));
@@ -21232,7 +21316,7 @@ const FrequencyDataBoard = ({ left, updateKey, onChange, showStationInfo = true
21232
21316
  updateKey,
21233
21317
  left
21234
21318
  ]);
21235
- const frequency = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>frequencyFormat(left), [
21319
+ const frequency = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>frequencyFormat?.(left) ?? '', [
21236
21320
  left,
21237
21321
  frequencyFormat
21238
21322
  ]);
@@ -21457,7 +21541,7 @@ function useEventBusCallback(id) {
21457
21541
  const cleanupDoubleClick = createDoubleClickEventManager(id, useEventBusCallback_COMPONENT_KEY, (_, e)=>{
21458
21542
  if (!compareEventPriority(id, useEventBusCallback_COMPONENT_KEY)) return;
21459
21543
  const { left } = e;
21460
- const frequency = frequencyFormat(left);
21544
+ const frequency = frequencyFormat?.(left) ?? '';
21461
21545
  onDoubleClick(frequency, e);
21462
21546
  });
21463
21547
  const cleanupMouseUp = createMouseUpEventManager(id, useEventBusCallback_COMPONENT_KEY, ()=>{
@@ -21544,7 +21628,8 @@ const EventBus_EventBus = ({ id })=>{
21544
21628
  }, [
21545
21629
  EID
21546
21630
  ]);
21547
- const handleMouseMove = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)(throttleRequestAnimationFrame((e)=>{
21631
+ const handleMouseMove = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)(throttleRequestAnimationFrame((event)=>{
21632
+ const e = event;
21548
21633
  if (!e.currentTarget) return;
21549
21634
  createMoveEventManager(EID)(e, calculateEventRelativePosition(e));
21550
21635
  updateCursor();
@@ -21836,9 +21921,10 @@ function calculateAreaInfo({ endLeft, startLeft, startTop, endTop, frequencyForm
21836
21921
  start: Math.max(0, Math.min(colCount - 1, Math.ceil(colCount * startLeft / PERCENTAGE) - 1)),
21837
21922
  end: Math.max(0, Math.min(colCount - 1, Math.ceil(colCount * endLeft / PERCENTAGE) - 1))
21838
21923
  };
21924
+ const formatFrequency = frequencyFormat;
21839
21925
  const frequencies = {
21840
- start: Math.round(Number(frequencyFormat(startLeft)) * tools_PRECISION) / tools_PRECISION,
21841
- end: Math.round(Number(frequencyFormat(endLeft)) * tools_PRECISION) / tools_PRECISION
21926
+ start: Math.round(Number(formatFrequency(startLeft)) * tools_PRECISION) / tools_PRECISION,
21927
+ end: Math.round(Number(formatFrequency(endLeft)) * tools_PRECISION) / tools_PRECISION
21842
21928
  };
21843
21929
  const bandwidth = Math.abs(frequencies.end - frequencies.start);
21844
21930
  const startTimestamp = waterfallData[indices.top]?.timestamp || '';
@@ -21883,6 +21969,7 @@ const Area = (props)=>{
21883
21969
  if (compareEventPriority(id, Area_COMPONENT_KEY) && start && end) {
21884
21970
  const { left: startLeft, top: startTop } = start;
21885
21971
  const { left: endLeft, top: endTop } = end;
21972
+ if (void 0 === startLeft || void 0 === startTop || void 0 === endLeft || void 0 === endTop) return;
21886
21973
  const diffX = endLeft - startLeft;
21887
21974
  const diffY = endTop - startTop;
21888
21975
  const width = Math.abs(diffX);
@@ -22833,7 +22920,7 @@ const Slider = ({ id })=>{
22833
22920
  const frequencyFormatRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(frequencyFormat);
22834
22921
  frequencyFormatRef.current = frequencyFormat;
22835
22922
  const getHeatmapData = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)(()=>{
22836
- const { waterfallData } = withDatabase(globalID).getAllRawData();
22923
+ const waterfallData = withDatabase(globalID).getAllRawData().waterfallData ?? [];
22837
22924
  return [
22838
22925
  waterfallData,
22839
22926
  waterfallData.length
@@ -23315,6 +23402,7 @@ const GridLines = ()=>{
23315
23402
  col: 0
23316
23403
  });
23317
23404
  (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
23405
+ if (!restrict || !range || !step) return;
23318
23406
  const [restrictMin, restrictMax] = restrict;
23319
23407
  const restrictRange = restrictMax - restrictMin;
23320
23408
  const [min, max] = range;
@@ -23455,7 +23543,7 @@ class Spectrum extends BaseRenderer {
23455
23543
  const { color = SERIES[name]?.color, thickness = 1, display = false } = merged;
23456
23544
  const nextSeriesConfig = {
23457
23545
  name,
23458
- label: config.label,
23546
+ label: merged.label,
23459
23547
  type: resolvedType || __WEBPACK_EXTERNAL_MODULE__rfkit_renderer_d3372451__.GraphicType.Line,
23460
23548
  color,
23461
23549
  thickness,
@@ -23469,7 +23557,7 @@ class Spectrum extends BaseRenderer {
23469
23557
  if (!skipEventEmit && globalID) try {
23470
23558
  updateSeries(globalID, {
23471
23559
  name,
23472
- label: config.label || name,
23560
+ label: nextSeriesConfig.label || name,
23473
23561
  color,
23474
23562
  thickness,
23475
23563
  display,
@@ -23693,7 +23781,7 @@ const Reset_modes = Object.values(constants_ModuleType);
23693
23781
  const Reset = ()=>{
23694
23782
  const { state: { globalID, publish } } = useStore_useStore();
23695
23783
  const handleReset = ()=>{
23696
- publish({
23784
+ publish?.({
23697
23785
  pstype: constants_PSType.Reset
23698
23786
  });
23699
23787
  Reset_modes.forEach((mode)=>{
@@ -23722,13 +23810,15 @@ const SegmentsDisplayControl_SegmentsDisplayControl = ()=>{
23722
23810
  const { state: { segments, globalID } } = useStore_useStore();
23723
23811
  const [display, setDisplay] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)([]);
23724
23812
  const [selectedIndex, setSelectedIndex] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(null);
23813
+ const totalPoints = segments.totalPoints ?? 0;
23725
23814
  (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
23726
23815
  setDisplay(segments.map((s)=>({
23727
23816
  display: false,
23728
- ratio: s.point / segments.totalPoints
23817
+ ratio: totalPoints > 0 ? s.point / totalPoints : 0
23729
23818
  })));
23730
23819
  }, [
23731
- segments
23820
+ segments,
23821
+ totalPoints
23732
23822
  ]);
23733
23823
  const handleSelect = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((value1)=>{
23734
23824
  const index = 'number' == typeof value1 ? value1 : null;
@@ -23885,36 +23975,24 @@ const SeriesControl_SeriesControl = ({ type })=>{
23885
23975
  const SeriesControl = SeriesControl_SeriesControl;
23886
23976
  const SeriesDisplayControl = ()=>{
23887
23977
  const { state: { globalID, series: seriesConfig } } = useStore_useStore();
23888
- const filteredSeries = useFilteredSeries(globalID);
23889
- const { forceUpdate } = useSeriesForComponent(globalID);
23978
+ const filteredSeries = useFilteredSeries_useFilteredSeries(globalID);
23890
23979
  (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
23891
23980
  if (!globalID || !seriesConfig?.forceDisplay) return;
23892
23981
  const hiddenSeries = filteredSeries.filter((item)=>!item.display);
23893
- if (hiddenSeries.length > 0) {
23894
- hiddenSeries.forEach(({ name })=>{
23895
- updateSeries(globalID, {
23896
- name,
23897
- display: true
23898
- });
23899
- });
23900
- forceUpdate();
23901
- }
23982
+ if (hiddenSeries.length > 0) batchUpdateSeries(globalID, hiddenSeries.map(({ name })=>({
23983
+ name,
23984
+ display: true
23985
+ })));
23902
23986
  }, [
23903
23987
  globalID,
23904
23988
  seriesConfig?.forceDisplay,
23905
23989
  filteredSeries.length
23906
23990
  ]);
23907
23991
  const updateSeriesDisplay = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((updates)=>{
23908
- updates.forEach(({ name, display })=>{
23909
- updateSeries(globalID, {
23910
- name,
23911
- display
23912
- });
23913
- });
23914
- forceUpdate();
23992
+ if (!globalID || 0 === updates.length) return;
23993
+ batchUpdateSeries(globalID, updates);
23915
23994
  }, [
23916
- globalID,
23917
- forceUpdate
23995
+ globalID
23918
23996
  ]);
23919
23997
  const handleSeriesToggle = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((seriesName, display)=>{
23920
23998
  updateSeriesDisplay([
@@ -24012,9 +24090,10 @@ const SeriesDisplayControl = ()=>{
24012
24090
  };
24013
24091
  const controls_SeriesDisplayControl = SeriesDisplayControl;
24014
24092
  const ZoomSwitch = ()=>{
24015
- const { state: { zoom, segments: { totalPoints } }, dispatch } = useStore_useStore();
24093
+ const { state: { zoom, segments }, dispatch } = useStore_useStore();
24016
24094
  const { show, autoCloseTimeout, interval: { start, end } } = zoom;
24017
- const endIndex = totalPoints - 1;
24095
+ const totalPoints = segments.totalPoints ?? 0;
24096
+ const endIndex = Math.max(totalPoints - 1, 0);
24018
24097
  const [hidden, setHidden] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(true);
24019
24098
  const autoRecoveryTimer = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(null);
24020
24099
  (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>()=>{
@@ -24051,14 +24130,19 @@ const ZoomSwitch = ()=>{
24051
24130
  endIndex,
24052
24131
  dispatch
24053
24132
  ]);
24054
- const gradientStyle = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>({
24133
+ const gradientStyle = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
24134
+ if (!totalPoints) return {
24135
+ background: 'transparent'
24136
+ };
24137
+ return {
24055
24138
  background: `linear-gradient(to right,
24056
24139
  transparent ${(start + 1) / totalPoints * 100}%,
24057
24140
  var(--chart-grid-strong) ${(start + 1) / totalPoints * 100}%,
24058
24141
  var(--chart-grid-strong) ${(end + 1) / totalPoints * 100}%,
24059
24142
  transparent ${(end + 1) / totalPoints * 100}%
24060
24143
  )`
24061
- }), [
24144
+ };
24145
+ }, [
24062
24146
  start,
24063
24147
  end,
24064
24148
  totalPoints
@@ -24535,10 +24619,10 @@ const MARKER_COUNT_CHANGE = (id, func)=>subscription_createSubscriptionManager(`
24535
24619
  const MARKER_SELECTION_CHANGE = (id, func)=>subscription_createSubscriptionManager(`MARKER_SELECTION_CHANGE-${id}`, '0', func, id);
24536
24620
  const MARKER_COMMAND = (id, func)=>subscription_createSubscriptionManager(`MARKER_COMMAND-${id}`, '0', func, id);
24537
24621
  function splitZoomLeft({ left, globalID }) {
24622
+ const safeLeft = left;
24538
24623
  const { zoom, segments } = getGlobalStoreState(globalID);
24539
24624
  const { start, end } = zoom.interval;
24540
- const { totalPoints } = segments;
24541
- const safeLeft = left;
24625
+ const totalPoints = segments.totalPoints;
24542
24626
  const intervalWidth = end - start + 1;
24543
24627
  const rawInsideLeft = (safeLeft * totalPoints / 100 - start) * 100 / intervalWidth;
24544
24628
  const insideLeft = rawInsideLeft;
@@ -25108,7 +25192,9 @@ const Toolbar = ({ type })=>{
25108
25192
  };
25109
25193
  const components_Toolbar = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.memo)(Toolbar);
25110
25194
  function useLevelStreamAnalyzer() {
25111
- const { state: { globalID, axisY: { range }, levelStream: { cacheTime, granularity, maxPoints } } } = useStore_useStore();
25195
+ const { state: { globalID, axisY, levelStream } } = useStore_useStore();
25196
+ const range = axisY.range ?? constants_RANGE_DEFAULT;
25197
+ const { cacheTime = 20000, granularity = 1, maxPoints = 500 } = levelStream ?? {};
25112
25198
  const analyzer = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(null);
25113
25199
  const globalIDRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(globalID);
25114
25200
  const updateLevelStreamData = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((renderData)=>{
@@ -25266,7 +25352,7 @@ const MIN_RANGE_SPAN = 0.5;
25266
25352
  const MAJOR_TICK_LINE_WIDTH = 2 * LINE_WIDTH_BASE;
25267
25353
  const MINOR_TICK_LINE_WIDTH = LINE_WIDTH_BASE;
25268
25354
  const AXIS_LINE_WIDTH = LINE_WIDTH_BASE;
25269
- function useCanvasAxisY(options = {}) {
25355
+ function useCanvasAxisY(options) {
25270
25356
  const { ranging } = options;
25271
25357
  const axisY = useSelector((state)=>state.axisY);
25272
25358
  const { range: axisYRange, disabled } = axisY;
@@ -25476,15 +25562,10 @@ function useCanvasAxisY(options = {}) {
25476
25562
  ]);
25477
25563
  const handleWheel = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((e)=>{
25478
25564
  if (disabled) return;
25479
- if (e.deltaY < 0) {
25480
- const currentRange = range.max - range.min;
25481
- if (currentRange <= MIN_RANGE_SPAN) return;
25482
- }
25483
25565
  ranging.moveWheel?.(e);
25484
25566
  }, [
25485
25567
  ranging,
25486
- disabled,
25487
- range
25568
+ disabled
25488
25569
  ]);
25489
25570
  const handleMouseMove = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((e)=>{
25490
25571
  if (disabled || !isDragging || !containerRef.current) return;
@@ -25782,10 +25863,12 @@ const DragFrame = ({ id })=>{
25782
25863
  ]);
25783
25864
  const filterFrameState = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((startCoords, endCoords, _, isEventButtonsRight)=>{
25784
25865
  if (startCoords && endCoords && isEventButtonsRight) {
25785
- const diffX = endCoords.left - startCoords.left;
25866
+ const startLeft = startCoords.left;
25867
+ const endLeft = endCoords.left;
25868
+ const diffX = endLeft - startLeft;
25786
25869
  setFrameState({
25787
25870
  diffX,
25788
- left: diffX > 0 ? startCoords.left : endCoords.left,
25871
+ left: diffX > 0 ? startLeft : endLeft,
25789
25872
  width: Math.abs(diffX),
25790
25873
  isScanSegmentsUpdateMagnify: diffX > 0
25791
25874
  });
@@ -25795,9 +25878,10 @@ const DragFrame = ({ id })=>{
25795
25878
  if (!frameState) return;
25796
25879
  const { left, width, isScanSegmentsUpdateMagnify, diffX } = frameState;
25797
25880
  const { totalPoints } = segments;
25881
+ const totalPointCount = totalPoints;
25798
25882
  if (isScanSegmentsUpdateMagnify && diffX > 0) {
25799
- const nextPoint = 2 * Math.ceil(width / 100 * totalPoints / 2);
25800
- const start = Math.round(totalPoints * left / 100) - 1;
25883
+ const nextPoint = 2 * Math.ceil(width / 100 * totalPointCount / 2);
25884
+ const start = Math.round(totalPointCount * left / 100) - 1;
25801
25885
  const end = nextPoint + start - 1;
25802
25886
  if (nextPoint > 10) onChange({
25803
25887
  interval: {
@@ -25812,7 +25896,7 @@ const DragFrame = ({ id })=>{
25812
25896
  if (diffX < 0) onChange({
25813
25897
  interval: {
25814
25898
  start: 0,
25815
- end: totalPoints - 1
25899
+ end: totalPointCount - 1
25816
25900
  },
25817
25901
  isScanSegmentsUpdateMagnify,
25818
25902
  left,
@@ -26462,8 +26546,9 @@ const setFrequencyAllocationToCache = (data)=>{
26462
26546
  localStorage.setItem(STORAGE_KEY, JSON.stringify(data));
26463
26547
  };
26464
26548
  function resolveFrequencyAllocationData(data) {
26465
- const cachedData = getFrequencyAllocationFromCache();
26466
- return sortAndRecolorFrequencyAllocationData(cachedData?.length > 0 ? cachedData : data?.length > 0 ? data : FrequencyAllocation_data);
26549
+ const cachedData = getFrequencyAllocationFromCache() ?? [];
26550
+ const inputData = data ?? [];
26551
+ return sortAndRecolorFrequencyAllocationData(cachedData.length > 0 ? cachedData : inputData.length > 0 ? inputData : FrequencyAllocation_data);
26467
26552
  }
26468
26553
  const resolveFrequencyAllocationRange = (band)=>{
26469
26554
  if (null != band.startFrequency && null != band.stopFrequency) {
@@ -26716,7 +26801,7 @@ const FrequencyAllocation = ()=>{
26716
26801
  children: [
26717
26802
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
26718
26803
  className: "absolute right-0 top-0 flex h-full w-full items-end will-change-transform",
26719
- style: zoomOffStyle,
26804
+ style: zoomOffStyle ?? void 0,
26720
26805
  children: segmentData.map(({ segmentIndex, bandPositions, style })=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(AllocationSegments, {
26721
26806
  style: style,
26722
26807
  bandPositions: bandPositions,
@@ -26868,7 +26953,7 @@ const FrequencyTagLine = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["defaul
26868
26953
  const Item_Item = ({ value: value1, onChange })=>{
26869
26954
  const { state: { axisY, limit } } = useStore_useStore();
26870
26955
  const { label, disabled } = limit;
26871
- const { unit, range, step } = axisY;
26956
+ const { unit = '', range = constants_RANGE_DEFAULT, step = constants_stepDefault } = axisY;
26872
26957
  const [min, max] = range;
26873
26958
  const diff = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>isdBm(unit) ? dBuV2dBm(0) : 0, [
26874
26959
  unit
@@ -26893,6 +26978,10 @@ const Item_Item = ({ value: value1, onChange })=>{
26893
26978
  switch(keyCode){
26894
26979
  case 'Enter':
26895
26980
  {
26981
+ if (!input.current) {
26982
+ setIsEdit(false);
26983
+ break;
26984
+ }
26896
26985
  const v = Number(input.current.value);
26897
26986
  if (!Number.isNaN(v) && v >= min && v <= max) {
26898
26987
  onChange?.(Math.floor(v - diff));
@@ -26968,6 +27057,8 @@ const Limit_Limit = ({ id })=>{
26968
27057
  const { state: { limit, segments, axisY, system }, dispatch } = useStore_useStore();
26969
27058
  const { show, active, disabled, value: value1, onChange } = limit;
26970
27059
  const [axisYMin, axisYMax] = axisY.range;
27060
+ const { totalPoints } = segments;
27061
+ const totalPointCount = totalPoints;
26971
27062
  const canRender = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>show && active, [
26972
27063
  show,
26973
27064
  active
@@ -27001,7 +27092,8 @@ const Limit_Limit = ({ id })=>{
27001
27092
  createMouseDownEventManager(id, COMPONENT_NAME, (e)=>{
27002
27093
  if (!canRender || disabled) return;
27003
27094
  if (!e?.left || !e?.top) return;
27004
- const index = segments.findIndex((i)=>i.progress[0] <= e.left && e.left < i.progress[1]);
27095
+ const left = e.left;
27096
+ const index = segments.findIndex((i)=>i.progress[0] <= left && left < i.progress[1]);
27005
27097
  if (!Number.isFinite(index) || index < 0) {
27006
27098
  setIndex(Number.NaN);
27007
27099
  dragValueRef.current = null;
@@ -27072,7 +27164,7 @@ const Limit_Limit = ({ id })=>{
27072
27164
  className: "z-[2]",
27073
27165
  children: segments?.map((i, index)=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
27074
27166
  style: {
27075
- width: `${100 * i.point / segments.totalPoints}%`,
27167
+ width: `${100 * i.point / totalPointCount}%`,
27076
27168
  opacity: (0, utils_array.Ri)(value1[index]) ? 1 : 0
27077
27169
  },
27078
27170
  className: "h-full w-[30%]",
@@ -27217,6 +27309,7 @@ const useMarkerEvents = (props)=>{
27217
27309
  };
27218
27310
  };
27219
27311
  const markerColors = getConfig('marker');
27312
+ const getRequiredGlobalStoreState = (globalID)=>getGlobalStoreState(globalID);
27220
27313
  function getPeaksFromDatabase(globalID, data, options) {
27221
27314
  const { needsMaxPeak = false, needsTopPeaks = false } = options || {};
27222
27315
  let maxPeak = null;
@@ -27255,8 +27348,8 @@ const useMarkers = (props)=>{
27255
27348
  });
27256
27349
  const dataRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(new Float32Array());
27257
27350
  const formatMarker = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((e, ctx)=>{
27258
- const { axisY: { unit }, axisX: { frequencyFormat } } = getGlobalStoreState(globalID);
27259
- let { left } = e;
27351
+ const { axisY: { unit }, axisX: { frequencyFormat } } = getRequiredGlobalStoreState(globalID);
27352
+ let left = e.left;
27260
27353
  const { peak } = e;
27261
27354
  let data = ctx?.data ?? dataRef.current;
27262
27355
  if (!data || 0 === data.length) {
@@ -27304,7 +27397,7 @@ const useMarkers = (props)=>{
27304
27397
  const frequency = parseFloat(frequencyStr);
27305
27398
  const level = data[xIndex];
27306
27399
  if (void 0 !== level && !Number.isNaN(level)) {
27307
- const virtualLevel = getVirtualLevel(unit, level)?.toFixed?.(1);
27400
+ const virtualLevel = getVirtualLevel(unit, level).toFixed(1);
27308
27401
  e.level = parseFloat(virtualLevel);
27309
27402
  }
27310
27403
  return {
@@ -27318,7 +27411,7 @@ const useMarkers = (props)=>{
27318
27411
  const createMarker = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((e, isBatchAdd = false)=>{
27319
27412
  if (0 === dataRef.current.length) return;
27320
27413
  setState((prevState)=>{
27321
- const { marker: { maxCount } } = getGlobalStoreState(globalID);
27414
+ const { marker: { maxCount } } = getRequiredGlobalStoreState(globalID);
27322
27415
  if (prevState.markers.length >= maxCount) return prevState;
27323
27416
  const markerId = createGUID();
27324
27417
  const colorIndex = prevState.colorIndex % 20;
@@ -27410,7 +27503,7 @@ const useMarkers = (props)=>{
27410
27503
  }
27411
27504
  if (event === constants_MarkerEventType.Add) {
27412
27505
  if (frequencies?.length) {
27413
- const { marker: { maxCount } } = getGlobalStoreState(globalID);
27506
+ const { marker: { maxCount } } = getRequiredGlobalStoreState(globalID);
27414
27507
  const availableSlots = maxCount - newMarkers.length;
27415
27508
  const itemsToAdd = Math.min(frequencies.length, availableSlots);
27416
27509
  newMarkers = newMarkers.map((m)=>({
@@ -27547,7 +27640,7 @@ const useMarkers = (props)=>{
27547
27640
  const container = document.getElementById(id);
27548
27641
  if (!container) return '';
27549
27642
  const info = container.getBoundingClientRect();
27550
- const { zoom: { interval: { start, end } }, segments } = getGlobalStoreState(globalID);
27643
+ const { zoom: { interval: { start, end } }, segments } = getRequiredGlobalStoreState(globalID);
27551
27644
  const multiple = segments.totalPoints / (end - start + 1);
27552
27645
  const width = info.width * multiple / 100;
27553
27646
  let isHover = '';
@@ -27626,8 +27719,8 @@ const useMarkers = (props)=>{
27626
27719
  markers: nextMarkers
27627
27720
  };
27628
27721
  }
27629
- const globalState = getGlobalStoreState(globalID);
27630
- const maxCount = globalState.marker.maxCount;
27722
+ const { marker } = getRequiredGlobalStoreState(globalID);
27723
+ const maxCount = marker.maxCount;
27631
27724
  const availableSlots = maxCount - prevState.markers.length;
27632
27725
  if (availableSlots < 2) return prevState;
27633
27726
  mainSecondaryPrevSelectedRef.current = prevState.markers.find((m)=>m.select)?.id ?? null;
@@ -27706,8 +27799,8 @@ const useMarkers = (props)=>{
27706
27799
  markers: nextMarkers
27707
27800
  };
27708
27801
  }
27709
- const globalState = getGlobalStoreState(globalID);
27710
- const maxCount = globalState.marker.maxCount;
27802
+ const { marker } = getRequiredGlobalStoreState(globalID);
27803
+ const maxCount = marker.maxCount;
27711
27804
  const availableSlots = maxCount - prevState.markers.length;
27712
27805
  if (availableSlots < 1) return prevState;
27713
27806
  mainPeakPrevSelectedRef.current = prevState.markers.find((m)=>m.select)?.id ?? null;
@@ -27762,7 +27855,7 @@ const useMarkers = (props)=>{
27762
27855
  const data = rawData[REAL_DATA_NAME];
27763
27856
  if (!data || data.length < 3) return prevState;
27764
27857
  dataRef.current = data;
27765
- const { zoom, segments } = getGlobalStoreState(globalID);
27858
+ const { zoom, segments } = getRequiredGlobalStoreState(globalID);
27766
27859
  const dataLength = data.length;
27767
27860
  const totalPoints = segments.totalPoints || dataLength;
27768
27861
  const intervalWidth = zoom.interval.end - zoom.interval.start + 1;
@@ -27847,7 +27940,7 @@ const useMarkers = (props)=>{
27847
27940
  const data = rawData[REAL_DATA_NAME];
27848
27941
  if (!data || data.length < 1) return prevState;
27849
27942
  dataRef.current = data;
27850
- const { zoom, segments } = getGlobalStoreState(globalID);
27943
+ const { zoom, segments } = getRequiredGlobalStoreState(globalID);
27851
27944
  const dataLength = data.length;
27852
27945
  const totalPoints = segments.totalPoints || dataLength;
27853
27946
  let maxIndex = 0;
@@ -27895,7 +27988,7 @@ const useMarkers = (props)=>{
27895
27988
  const data = rawData[REAL_DATA_NAME];
27896
27989
  if (!data || data.length < 3) return prevState;
27897
27990
  dataRef.current = data;
27898
- const { zoom, segments } = getGlobalStoreState(globalID);
27991
+ const { zoom, segments } = getRequiredGlobalStoreState(globalID);
27899
27992
  const dataLength = data.length;
27900
27993
  const totalPoints = segments.totalPoints || dataLength;
27901
27994
  let maxIndex = 0;
@@ -27957,7 +28050,7 @@ const useMarkers = (props)=>{
27957
28050
  const data = rawData[REAL_DATA_NAME];
27958
28051
  if (!data || data.length < 2) return prevState;
27959
28052
  dataRef.current = data;
27960
- const { zoom, segments } = getGlobalStoreState(globalID);
28053
+ const { zoom, segments } = getRequiredGlobalStoreState(globalID);
27961
28054
  const dataLength = data.length;
27962
28055
  const totalPoints = segments.totalPoints || dataLength;
27963
28056
  const intervalWidth = zoom.interval.end - zoom.interval.start + 1;
@@ -28004,7 +28097,7 @@ const useMarkers = (props)=>{
28004
28097
  const data = rawData[REAL_DATA_NAME];
28005
28098
  if (!data || data.length < 1) return prevState;
28006
28099
  dataRef.current = data;
28007
- const { zoom, segments } = getGlobalStoreState(globalID);
28100
+ const { zoom, segments } = getRequiredGlobalStoreState(globalID);
28008
28101
  const dataLength = data.length;
28009
28102
  const totalPoints = segments.totalPoints || dataLength;
28010
28103
  let maxIndex = 0;
@@ -28028,8 +28121,8 @@ const useMarkers = (props)=>{
28028
28121
  return m;
28029
28122
  });
28030
28123
  else {
28031
- const globalState = getGlobalStoreState(globalID);
28032
- const maxMarkerCount = globalState.marker.maxCount;
28124
+ const { marker } = getRequiredGlobalStoreState(globalID);
28125
+ const maxMarkerCount = marker.maxCount;
28033
28126
  if (prevState.markers.length >= maxMarkerCount) return prevState;
28034
28127
  const markerId = createGUID();
28035
28128
  const newMarker = formatMarker({
@@ -28066,7 +28159,7 @@ const useMarkers = (props)=>{
28066
28159
  const data = rawData[REAL_DATA_NAME];
28067
28160
  if (!data || data.length < 3) return prevState;
28068
28161
  dataRef.current = data;
28069
- const { zoom, segments } = getGlobalStoreState(globalID);
28162
+ const { zoom, segments } = getRequiredGlobalStoreState(globalID);
28070
28163
  const dataLength = data.length;
28071
28164
  const totalPoints = segments.totalPoints || dataLength;
28072
28165
  let maxIndex = 0;
@@ -28104,8 +28197,8 @@ const useMarkers = (props)=>{
28104
28197
  return m;
28105
28198
  });
28106
28199
  else {
28107
- const globalState = getGlobalStoreState(globalID);
28108
- const maxMarkerCount = globalState.marker.maxCount;
28200
+ const { marker } = getRequiredGlobalStoreState(globalID);
28201
+ const maxMarkerCount = marker.maxCount;
28109
28202
  if (prevState.markers.length >= maxMarkerCount) return prevState;
28110
28203
  const markerId = createGUID();
28111
28204
  const newMarker = formatMarker({
@@ -28377,7 +28470,7 @@ const Markers = ({ id })=>{
28377
28470
  id,
28378
28471
  markers,
28379
28472
  display: show,
28380
- fixed,
28473
+ fixed: fixed,
28381
28474
  onCreateMarker: createMarker,
28382
28475
  onDeleteMarker: handleDeleteMarker,
28383
28476
  onUpdateMarker: handleUpdateMarker,
@@ -28600,7 +28693,7 @@ const Signal = ({ show = true, display = true })=>{
28600
28693
  const isCursorActive = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>cursor_hasActiveSpectrumCursor(cursor), [
28601
28694
  cursor
28602
28695
  ]);
28603
- const currentPosition = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>isCursorActive ? frequencyCalculation_calculateCursorPosition(left, segments) : {
28696
+ const currentPosition = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>isCursorActive && 'number' == typeof left ? frequencyCalculation_calculateCursorPosition(left, segments) : {
28604
28697
  segmentIndex: -1,
28605
28698
  pointIndex: -1
28606
28699
  }, [
@@ -28631,7 +28724,7 @@ const Signal = ({ show = true, display = true })=>{
28631
28724
  className: "pointer-events-none absolute inset-0 z-[4] flex h-full w-full select-none items-center overflow-hidden bg-transparent",
28632
28725
  children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
28633
28726
  className: "absolute right-0 top-0 flex h-full w-full",
28634
- style: zoomOffStyle,
28727
+ style: zoomOffStyle ?? void 0,
28635
28728
  children: segmentData.map(({ segmentIndex, signalPositions, activeSignalKey, style })=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(SignalSegments, {
28636
28729
  style: style,
28637
28730
  signalPositions: signalPositions,
@@ -28723,8 +28816,8 @@ const Stripe_Stripe = ({ id })=>{
28723
28816
  const { left, right } = currentStripe;
28724
28817
  const l = Math.round(10 * left) / 10;
28725
28818
  const r = Math.round(10 * right) / 10;
28726
- const start = frequencyFormatRef.current(l);
28727
- const end = frequencyFormatRef.current(r);
28819
+ const start = frequencyFormatRef.current?.(l) ?? '';
28820
+ const end = frequencyFormatRef.current?.(r) ?? '';
28728
28821
  const width = r - l;
28729
28822
  const bandwidth = Number(end) - Number(start);
28730
28823
  onChangeRef.current({
@@ -29209,27 +29302,37 @@ const charts_Occupancy = charts_Occupancy_Occupancy;
29209
29302
  const Zoom_Zoom = ()=>{
29210
29303
  const dispatch = useStoreDispatch();
29211
29304
  const zoom = useSelector((state)=>state.zoom);
29212
- const totalPoints = useSelector((state)=>state.segments.totalPoints);
29305
+ const totalPoints = useSelector((state)=>state.segments.totalPoints) ?? 0;
29213
29306
  const frequencyFormat = useSelector((state)=>state.axisX.frequencyFormat);
29214
29307
  const { interval: { start, end }, onChange } = zoom;
29215
- const ticks = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>[
29308
+ const ticks = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
29309
+ if (!totalPoints || !frequencyFormat) return [
29310
+ '',
29311
+ ''
29312
+ ];
29313
+ return [
29216
29314
  frequencyFormat((100 * start + 1) / totalPoints),
29217
29315
  frequencyFormat((100 * end + 1) / totalPoints)
29218
- ], [
29316
+ ];
29317
+ }, [
29219
29318
  start,
29220
29319
  end,
29221
- totalPoints
29320
+ totalPoints,
29321
+ frequencyFormat
29222
29322
  ]);
29223
29323
  (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
29324
+ if (!totalPoints) return;
29224
29325
  if (void 0 !== ticks[0] && void 0 !== ticks[1]) onChange(ticks, {
29225
29326
  start,
29226
29327
  end
29227
29328
  });
29228
29329
  }, [
29229
29330
  ticks,
29230
- onChange
29331
+ onChange,
29332
+ totalPoints
29231
29333
  ]);
29232
29334
  (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
29335
+ if (!totalPoints) return;
29233
29336
  const widthRange = end - start + 1;
29234
29337
  const multiple = totalPoints / widthRange;
29235
29338
  const left = `-${start / widthRange * 100}%`;
@@ -29446,12 +29549,13 @@ const Legend = ()=>{
29446
29549
  const Spectrum_Legend = Legend;
29447
29550
  const SegmentsZebra = ()=>{
29448
29551
  const { state: { segments } } = useStore_useStore();
29552
+ const totalPoints = segments.totalPoints ?? 0;
29449
29553
  return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Zoom_ZoomViewportLayer, {
29450
29554
  className: "z-[0]",
29451
29555
  children: segments.map((i, key)=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
29452
29556
  className: "h-full border-x",
29453
29557
  style: {
29454
- width: `${100 * i.point / segments.totalPoints}%`,
29558
+ width: totalPoints > 0 ? `${100 * i.point / totalPoints}%` : 0,
29455
29559
  borderColor: key % 2 === 1 ? 'var(--chart-grid)' : 'transparent',
29456
29560
  background: key % 2 === 1 ? 'var(--chart-surface)' : 'transparent',
29457
29561
  opacity: key % 2 === 1 ? 0.4 : 1
@@ -29500,14 +29604,15 @@ function useTemplateComparison() {
29500
29604
  const segments = [];
29501
29605
  const timestamp = Date.now();
29502
29606
  templateOverData.forEach((overData)=>{
29607
+ const formatFrequency = frequencyFormatRef.current;
29503
29608
  const { startIndex, endIndex } = overData;
29504
29609
  const totalLength = templateOverData.length;
29505
29610
  const startPercent = (startIndex + 0.5) * 100 / totalLength;
29506
29611
  const endPercent = (endIndex + 0.5) * 100 / totalLength;
29507
29612
  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);
29613
+ const startFreq = formatFrequency(startPercent);
29614
+ const stopFreq = formatFrequency(endPercent);
29615
+ const centerFreq = formatFrequency(centerPercent);
29511
29616
  if (startFreq !== stopFreq) segments.push({
29512
29617
  ...overData,
29513
29618
  frequency: centerFreq,
@@ -29560,10 +29665,11 @@ function useSpectrumAnalyzer(props) {
29560
29665
  }, []);
29561
29666
  const { updateTemplateOverData } = useTemplateComparison();
29562
29667
  const handleSpectrumUpdate = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((data)=>{
29563
- if (data.realData || data.templateData || data.backgroundNoiseData) updateSpectrum({
29668
+ if (data.realData || data.templateData || data.backgroundNoiseData || 'thresholdData' in data) updateSpectrum({
29564
29669
  minData: data.minData,
29565
29670
  maxData: data.maxData,
29566
29671
  avgData: data.avgData,
29672
+ thresholdData: data.thresholdData,
29567
29673
  backgroundNoiseData: data.backgroundNoiseData,
29568
29674
  realData: data.realData,
29569
29675
  templateData: data.templateData
@@ -29658,6 +29764,7 @@ function useSpectrumAnalyzer(props) {
29658
29764
  break;
29659
29765
  case constants_PSType.Spectrum:
29660
29766
  if (e.data) analyzer.current.process(e);
29767
+ if ('thresholdData' in e) analyzer.current.setThresholdData(e.thresholdData);
29661
29768
  if (e.maxData) analyzer.current.setMaxData(e.maxData);
29662
29769
  if (e.minData) analyzer.current.setMinData(e.minData);
29663
29770
  if (e.avgData) analyzer.current.setAvgData(e.avgData);