@rfkit/charts 1.18.2 → 1.18.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +1 -5
- package/modules/Spectrum/Limit/Item.d.ts +3 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -927,10 +927,6 @@ let e;import{Fragment as t,jsx as r,jsxs as n}from"react/jsx-runtime";import a,{
|
|
|
927
927
|
width: 14%;
|
|
928
928
|
}
|
|
929
929
|
|
|
930
|
-
[data-rfkit-charts-root] .w-\\[30\\%\\] {
|
|
931
|
-
width: 30%;
|
|
932
|
-
}
|
|
933
|
-
|
|
934
930
|
[data-rfkit-charts-root] .w-\\[30px\\] {
|
|
935
931
|
width: 30px;
|
|
936
932
|
}
|
|
@@ -3781,4 +3777,4 @@ ${ta(` ${t.systemDark}`,n)}
|
|
|
3781
3777
|
*
|
|
3782
3778
|
* This source code is licensed under the ISC license.
|
|
3783
3779
|
* See the LICENSE file in the root directory of this source tree.
|
|
3784
|
-
*/let CU={name:"minus",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}]]};CU.node;let CX=Mo(CU),CK={name:"check",size:24,node:[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]};CK.node;let CV=Mo(CK),CQ=/*#__PURE__*/$.forwardRef(({className:e,...t},n)=>/*#__PURE__*/r(C$,{ref:n,"data-slot":"checkbox",className:iX("peer inline-flex size-4 shrink-0 items-center justify-center rounded-[var(--radius-micro)] border border-border bg-background text-primary shadow-xs transition-colors outline-none","focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50","data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground","data-[state=indeterminate]:border-primary data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground",e),...t,children:/*#__PURE__*/r(Cj,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current",children:"indeterminate"===t.checked?/*#__PURE__*/r(CX,{className:"size-3.5"}):/*#__PURE__*/r(CV,{className:"size-3.5"})})}));CQ.displayName=C$.displayName;let CZ=e=>"checked"===e||"indeterminate"===e&&"indeterminate",CJ=({count:e,show:t,testId:r})=>t?/*#__PURE__*/n("span",{className:"shrink-0 tabular-nums text-[11px] font-normal text-muted-foreground","data-testid":r,children:["(",e,")"]}):null,C0=({source:e,type:t,leafKeysWithData:a,hiddenKeys:i,showCount:o,expanded:l,onToggleExpanded:s,onToggleNode:c})=>{let u=kO(a,i,t.leafKeys),d=`signal-tree-type-checkbox-${e.source}-${t.signalType}`,h=t.levels.length>0,p=h?void 0:t.color??kv[t.signalType].color;return /*#__PURE__*/n("div",{children:[/*#__PURE__*/n("div",{className:"group flex items-center gap-1.5 rounded-[var(--radius-control)] px-[var(--size-gap-base)] py-[calc(var(--size-gap-base)/2)] transition-colors hover:bg-accent/80","data-testid":`signal-tree-type-${e.source}-${t.signalType}`,children:[h?/*#__PURE__*/r("button",{type:"button","aria-label":l?"折叠信号类型":"展开信号类型",className:"flex size-4 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",onClick:s,children:l?/*#__PURE__*/r(CC,{className:"size-3.5"}):/*#__PURE__*/r(Cz,{className:"size-3.5"})}):/*#__PURE__*/r("span",{"aria-hidden":"true",className:"size-4 shrink-0"}),/*#__PURE__*/n("label",{htmlFor:d,className:iX("flex min-w-0 flex-1 items-center gap-1.5","disabled"===u?"cursor-not-allowed":"cursor-pointer"),children:[/*#__PURE__*/r(CQ,{id:d,"aria-label":`${e.label} ${t.label}`,checked:CZ(u),disabled:"disabled"===u,onCheckedChange:()=>c(t.leafKeys)}),/*#__PURE__*/r("span",{className:iX("min-w-0 truncate text-xs font-medium","disabled"===u?"text-muted-foreground":"text-foreground/90"),"data-testid":`signal-tree-type-color-${e.source}-${t.signalType}`,style:"disabled"===u||null==p?void 0:{color:oi(p)},children:t.label}),/*#__PURE__*/r(CJ,{count:t.count,show:o,testId:`signal-tree-type-count-${e.source}-${t.signalType}`})]})]}),l&&h?/*#__PURE__*/r("div",{className:"relative ml-6 border-l border-border/60 pl-1",children:t.levels.map(n=>/*#__PURE__*/r(C1,{source:e.source,signalType:t.signalType,level:n,leafKeysWithData:a,hiddenKeys:i,showCount:o,onToggleNode:c},n.leafKey))}):null]},t.signalType)},C1=({source:e,signalType:t,level:a,leafKeysWithData:i,hiddenKeys:o,showCount:l,onToggleNode:s})=>{let c=kO(i,o,[a.leafKey]),u=`signal-tree-level-checkbox-${e}-${t}-${a.level}`;return /*#__PURE__*/r("div",{className:"group flex items-center gap-1.5 rounded-[var(--radius-control)] px-[var(--size-gap-base)] py-[calc(var(--size-gap-base)/2)] transition-colors hover:bg-accent/80","data-testid":`signal-tree-level-${e}-${t}-${a.level}`,children:/*#__PURE__*/n("label",{htmlFor:u,className:iX("flex min-w-0 flex-1 items-center gap-1.5","disabled"===c?"cursor-not-allowed":"cursor-pointer"),children:[/*#__PURE__*/r(CQ,{id:u,"aria-label":`${t} ${a.label}`,checked:CZ(c),disabled:"disabled"===c,onCheckedChange:()=>s([a.leafKey])}),/*#__PURE__*/r("span",{className:iX("text-xs font-medium","disabled"===c?"text-muted-foreground":"text-foreground/80"),"data-testid":`signal-tree-level-color-${e}-${t}-${a.level}`,style:"disabled"===c?void 0:{color:oi(a.color??kD[a.level].color)},children:a.label}),/*#__PURE__*/r(CJ,{count:a.count,show:l,testId:`signal-tree-level-count-${e}-${t}-${a.level}`})]})})},C2=({tree:e,leafKeysWithData:t,hiddenKeys:a,showCount:i,onToggleNode:o})=>{let[l,s]=b(()=>new Set),[c,d]=b(()=>new Set),h=u(e=>{s(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},[]),p=u(e=>{d(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},[]);return /*#__PURE__*/r(g6,{viewportClassName:"h-auto max-h-[var(--radix-dropdown-menu-content-available-height)]",children:/*#__PURE__*/r("div",{className:"p-[calc(var(--size-gap-base)/2)]",children:e.sources.map((e,s)=>{let u=kO(t,a,e.leafKeys),d=`signal-tree-source-checkbox-${e.source}`;return /*#__PURE__*/n("div",{className:iX(s>0&&"mt-[calc(var(--size-gap-base)/2)] border-t border-border/60 pt-[calc(var(--size-gap-base)/2)]"),"data-testid":`signal-tree-source-${e.source}`,children:[/*#__PURE__*/n("div",{className:"flex items-center gap-1.5 rounded-[var(--radius-control)] px-[var(--size-gap-base)] py-[calc(var(--size-gap-base)/2)] transition-colors hover:bg-accent/80","data-testid":`signal-tree-source-row-${e.source}`,children:[e.types.length>0?/*#__PURE__*/r("button",{type:"button","aria-label":c.has(e.source)?"展开数据来源":"折叠数据来源",className:"flex size-4 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",onClick:()=>p(e.source),children:c.has(e.source)?/*#__PURE__*/r(Cz,{className:"size-3.5"}):/*#__PURE__*/r(CC,{className:"size-3.5"})}):/*#__PURE__*/r("span",{"aria-hidden":"true",className:"size-4 shrink-0"}),/*#__PURE__*/n("label",{htmlFor:d,className:iX("flex min-w-0 flex-1 items-center gap-1.5","disabled"===u?"cursor-not-allowed":"cursor-pointer"),children:[/*#__PURE__*/r(CQ,{id:d,"aria-label":`${e.label}筛选`,checked:CZ(u),disabled:"disabled"===u,onCheckedChange:()=>o(e.leafKeys)}),/*#__PURE__*/r("span",{className:"text-xs font-medium text-foreground",children:e.label}),/*#__PURE__*/r(CJ,{count:e.count,show:i,testId:`signal-tree-source-count-${e.source}`})]})]}),c.has(e.source)?null:/*#__PURE__*/r("div",{className:"ml-4 divide-y divide-border/40 border-l border-border/60 pl-1",children:e.types.map(n=>/*#__PURE__*/r(C0,{source:e,type:n,leafKeysWithData:t,hiddenKeys:a,showCount:i,expanded:!l.has(`${e.source}:${n.signalType}`),onToggleExpanded:()=>h(`${e.source}:${n.signalType}`),onToggleNode:o},n.signalType))})]},e.source)})})})},C5=()=>{let{state:{signal:e},dispatch:t}=ae(),n=e.display,a=e.show,i=St({respectVisibility:!1,filterHidden:!1}),o=m(()=>kL(i),[i]),l=m(()=>new Set(o.sources.flatMap(e=>e.dataLeafKeys)),[o]),s=m(()=>new Set(e.hiddenCategoryKeys??[]),[e.hiddenCategoryKeys]),c=(e.hiddenCategoryKeys?.length??0)>0,d=u(r=>{t({payload:{signal:{...e,display:r}}})},[e,t]),h=u(r=>{let n=kq(e.hiddenCategoryKeys??[],r,l);t({payload:{signal:{...e,hiddenCategoryKeys:n}}})},[e,l,t]);return a?/*#__PURE__*/r(vE,{leading:/*#__PURE__*/r(vT,{active:n,tone:"primary",onClick:()=>{d(!n)},title:`全部信号标注:${n?"显示":"隐藏"}`,children:/*#__PURE__*/r("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",children:/*#__PURE__*/r("path",{fill:"currentColor",d:"M563.072 376.48a79.456 79.456 0 0 0 28.928-61.12 80 80 0 1 0-160 0c0 24.672 11.392 46.432 28.928 61.12l-202.88 540.256a32 32 0 1 0 59.904 22.496l49.28-131.264h289.504l49.28 131.264a32.064 32.064 0 0 0 41.248 18.752c16.544-6.208 24.896-24.672 18.72-41.216l-202.912-540.288z m-1.312 178.624h-99.552L512 422.56l49.76 132.544z m-170.464 188.896l46.912-124.896h147.616l46.912 124.896h-241.44zM662.464 417.408a32 32 0 1 0 53.12 35.648 254.72 254.72 0 0 0 43.136-142.304 255.04 255.04 0 0 0-43.136-142.304 32 32 0 1 0-53.12 35.68 190.944 190.944 0 0 1 32.288 106.624 190.816 190.816 0 0 1-32.288 106.656zM289.888 453.024a32 32 0 1 0 53.184-35.616 191.36 191.36 0 0 1-32.32-106.656 191.328 191.328 0 0 1 32.32-106.656 32.064 32.064 0 0 0-8.768-44.416 32.096 32.096 0 0 0-44.416 8.768 254.976 254.976 0 0 0-43.136 142.304 254.976 254.976 0 0 0 43.136 142.272zM210.656 117.12A32 32 0 1 0 157.44 81.536a420.032 420.032 0 0 0-70.848 233.824 419.744 419.744 0 0 0 70.88 233.856 31.936 31.936 0 0 0 44.416 8.768 32 32 0 0 0 8.768-44.416 355.168 355.168 0 0 1-60.032-198.24A355.36 355.36 0 0 1 210.656 117.12zM896.224 154.304a416.96 416.96 0 0 0-38.912-72.768 32 32 0 1 0-53.184 35.584 354.912 354.912 0 0 1 60.064 198.24 355.2 355.2 0 0 1-60.064 198.208 32.032 32.032 0 0 0 53.184 35.648 418.816 418.816 0 0 0 70.88-233.856c0-55.68-10.752-109.856-31.968-161.056z"})})}),value:null,options:[],triggerTitle:`筛选信号标注类别${c?"(已应用筛选)":""}`,triggerTestId:"signal-tree-trigger",triggerContent:/*#__PURE__*/r("span",{className:"sr-only",children:c?"信号标注类别筛选(已应用)":"信号标注类别筛选"}),customContent:/*#__PURE__*/r("div",{"data-testid":"signal-tree-popover",children:/*#__PURE__*/r(C2,{tree:o,leafKeysWithData:l,hiddenKeys:s,showCount:!1!==e.showCount,onToggleNode:h})}),contentClassName:"w-max max-w-[calc(100vw-1rem)] p-0",triggerClassName:iX("justify-center [&>span:last-child]:ml-0",c&&"bg-accent/72 shadow-[inset_0_0_0_1px_var(--mix-primary-28)] [&>span:last-child]:text-primary")}):null},C4=C5,C3=[{component:yL,toolType:rs.AutorangingSwitch,supportedCharts:[],excludedCharts:[rt.Heatmap,rt.ScanDF360,rt.LevelStream,rt.LiteNormalized]},{component:yB,toolType:rs.UnitSwitch,supportedCharts:[],excludedCharts:[rt.ScanDF360,rt.LevelStream]},{component:v$,toolType:rs.GradientRibbon,supportedCharts:[rt.Heatmap]},{component:v_,toolType:rs.SpacerLine,supportedCharts:[],excludedCharts:[rt.ScanDF360,rt.LevelStream]},{component:Fq,toolType:rs.Reset,supportedCharts:[],excludedCharts:[rt.LiteNormalized]},{component:C5,toolType:rs.StationAllocationSwitch,supportedCharts:[rt.SingleFrequency,rt.Scan,rt.MScan,rt.DDC]},{component:FH,toolType:rs.SeriesControl,supportedCharts:[rt.SingleFrequency,rt.Scan,rt.MScan],props:{type:"dynamic"}},{component:F8,toolType:rs.FrequencyAllocationSwitch,supportedCharts:[rt.SingleFrequency,rt.Scan,rt.MScan,rt.LiteNormalized]},{component:FY,toolType:rs.ZoomSwitch,supportedCharts:[rt.SingleFrequency,rt.Scan,rt.MScan,rt.LiteNormalized]},{component:Ce,toolType:rs.LimitSwitch,supportedCharts:[rt.SingleFrequency,rt.Scan,rt.MScan]},{component:CS,toolType:rs.MarkersSwitch,supportedCharts:[rt.SingleFrequency,rt.Scan,rt.MScan]},{component:F_,toolType:rs.SegmentsDisplayControl,supportedCharts:[rt.Scan]},{component:FJ,toolType:rs.HeatmapCaptureSwitch,supportedCharts:[rt.Heatmap]},{component:F4,toolType:rs.TimeRangeSwitch,supportedCharts:[rt.Heatmap]},{component:FW,toolType:rs.SeriesDisplayControl,supportedCharts:[rt.SingleFrequency,rt.Scan,rt.LiteNormalized,rt.MScan]},{component:FX,toolType:rs.FluorescenceSwitch,supportedCharts:[rt.SingleFrequency]},{component:F3,toolType:rs.DeltaMeasurementSwitch,supportedCharts:[rt.SingleFrequency,rt.Scan]}],C6=(e,t,r=[])=>!new Set(r).has(e.toolType)&&(e.supportedCharts.length>0?!!t&&e.supportedCharts.includes(t):!e.excludedCharts||!(e.excludedCharts.length>0)||!t||!e.excludedCharts.includes(t)),C8=(e,t)=>e.props?"dynamic"===e.props.type?{...e.props,type:t}:e.props:{},C9=({type:e})=>{let t=at(e=>e.toolbar.show),n=at(e=>e.toolbar.hiddenTools??[]),{width:a,pluginBoxWidth:i}=yn(),o=m(()=>({marginLeft:a,width:i,...o_}),[a,i]),l=m(()=>C3.filter(t=>C6(t,e,n)).map(t=>/*#__PURE__*/r(t.component,{...C8(t,e)},t.toolType)),[n,e]);return e!==rt.Occupancy&&t?/*#__PURE__*/r("div",{className:"relative flex h-10 min-w-0 w-full items-center justify-between pl-[var(--size-gap-base)] text-xs text-foreground",style:o,children:/*#__PURE__*/r("div",{className:"min-w-0 flex-1 overflow-x-auto overflow-y-hidden",children:/*#__PURE__*/r("div",{className:"flex h-full w-max min-w-full items-center gap-[var(--size-gap-base)]",children:l})})}):null},C7=/*#__PURE__*/c(C9);function De(){let{state:{globalID:e,axisY:t,levelStream:r}}=ae(),n=t.range??ns,{cacheTime:a=2e4,granularity:i=1,maxPoints:o=500}=r??{},l=g(null),s=g(e),c=u(e=>{((e,t,r="0")=>tI(e,t,void 0,r))(s.current,rr.Spectrum)({pstype:rn.Render,data:{[t3]:e.spectrumData}}),((e,t,r="0")=>tI(e,t,void 0,r))(s.current,rr.LevelStream)({pstype:rn.Render,data:e.probabilityRangeData})},[]),d=u(e=>{let{probabilityRangeData:t,spectrumData:r}=e;tO(s.current).getAllRawData=t=>({...tL().getAllRawData(t),levelStreamData:e}),c({probabilityRangeData:t,spectrumData:r})},[c]);if(h(()=>{s.current=e},[e]),!l.current&&e){l.current=new P({range:n,cacheTime:a,granularity:i,maxPoints:o,onLevelStreamUpdate:d});let{line:t}=t0("levelStream");((e,t,r="0")=>tI(e,t,void 0,r))(e,rr.Spectrum)({pstype:rn.Series,name:t3,color:t})}return h(()=>{l.current?.setConfig({range:n})},[n]),h(()=>{l.current?.setConfig({cacheTime:a})},[a]),h(()=>{l.current?.setConfig({granularity:i})},[i]),h(()=>{l.current?.setConfig({onLevelStreamUpdate:d})},[d]),{analyzer:l.current,updateLevelStreamData:c}}class Dt extends of{constructor(e){super({id:e.id,chart:null,orientation:e.orientation??z.Vertical})}init(){let{id:e,orientation:t}=this.state,r=[...t2()].reverse().map(e=>E(e));this.state.chart=new N({id:e,series:[{name:"bar",type:M.Bar,display:!0,color:t0("bar"),orientation:t}],range:[0,100],barValue2Color:!0,colors:r})}updateSeries(e){this.state.chart?.render({name:"bar",data:e})}}let Dr=e=>{let{opacity:t}=e,{chart:n,Chart:a}=iV({Render:Dt,params:{orientation:z.Horizontal}});return i3({moduleType:rr.LevelStream,chart:n,extractData:e=>e.data}),/*#__PURE__*/r(a,{style:m(()=>({opacity:t,zIndex:1}),[t])})},Dn=Dr,Da=(e,t)=>{!0===t.batch?e.processBatch(t.data,t.timestamps):e.process(t.data,rK(t.timestamp))},Di=6,Do=4,Dl=8,Ds=({axisLineWidth:e,inside:t,width:r})=>t?{axisX:e,majorTickEndX:6,majorTickStartX:0,minorTickEndX:4,minorTickStartX:0,textAlign:"left",textX:8}:{axisX:r-e,majorTickEndX:r,majorTickStartX:r-6,minorTickEndX:r,minorTickStartX:r-4,textAlign:"right",textX:r-8},Dc=.5,Du=2,Dd=4,Dh=100,Dp=1,Df=.5,Dm=.5;function Dg(e){let{ranging:t}=e,{range:r,disabled:n,placement:a,show:i}=at(e=>e.axisY),o="inside"===a,l=g(null),s=g(null),[c,d]=b(0),[p,f]=b(window.devicePixelRatio||1),[v,y]=b(!1),[w,x]=b(0),k=u((e,t)=>{let r=.5*(Math.max(1,Math.round(t*p))%2!=0);return(Math.round(e*p-r)+r)/p},[p]),S=u((e,t,r)=>{let n=r/2;return Math.min(t-n,Math.max(n,e))},[]),M=m(()=>{let[e,t]=r;return{min:e,max:t}},[r]);h(()=>{let e=window.matchMedia(`(resolution: ${p}dppx)`),t=()=>f(window.devicePixelRatio||1);return e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[p]),h(()=>{let e=s.current;if(!e)return;let t=new ResizeObserver(e=>{let t=e[0];t&&d(t.contentRect.height)});return t.observe(e),()=>t.disconnect()},[i]);let F=u((e,t)=>{if(t.useScientific)return e.toExponential(1);if(t.useKFormat){let r=e/1e3;return t.useDecimals?`${r.toFixed(1)}k`:`${Math.round(r)}k`}return t.useDecimals?e.toFixed(1):Math.round(e).toString()},[]),C=m(()=>{if(0===c)return{majorTicks:[],minorTicks:[]};let e=M.max-M.min,{interval:t,majorTickValues:r}=Fv([M.min,M.max]);if(!t||0===r.length)return{majorTicks:[],minorTicks:[]};let n=r.some(e=>Math.abs(e)>=1e3),a=r.some(e=>.01>Math.abs(e)&&0!==e),i={useScientific:a,useKFormat:n&&!a,useDecimals:r.some(e=>e%1!=0)},o=[];for(let t of r){let r=(M.max-t)/e*c,n=r,a=!0,l=!1,s=c-6,u=.3*c;r<-u||r>c+u?a=!1:r<6?(n=6,l=!0):r>s&&(n=s,l=!0),a&&o.push({value:t,position:r,textPosition:n,label:F(t,i),isAdjusted:l})}let l=[],s=t/2,u=s/e*c,d=e<1;if(u>=(d?8:4)&&c>100&&!d){let r=Math.ceil(M.min/s)*s;for(let n=r;n<=M.max;n+=s){if(Math.abs(n%t)<.1*s)continue;let r=(M.max-n)/e*c;r>=0&&r<=c&&l.push({value:n,position:r,textPosition:r,label:""})}}return{majorTicks:o,minorTicks:l}},[M,c,F]),D=u(()=>{let e=l.current;if(!e||0===c)return;let t=e.getContext("2d");if(!t)return;let r=e.getBoundingClientRect().width,n=Ds({axisLineWidth:.5,inside:o,width:r});e.width=r*p,e.height=c*p,e.style.width=`${r}px`,e.style.height=`${c}px`,t.setTransform(p,0,0,p,0,0),t.imageSmoothingEnabled=!0,t.imageSmoothingQuality="high",t.clearRect(0,0,r,c),t.font="12px -apple-system, BlinkMacSystemFont, sans-serif",t.textAlign=n.textAlign,t.textBaseline="middle",t.lineWidth=Dp;let a=ol("--foreground",.5,s.current);C.majorTicks.forEach(e=>{t.fillStyle=a,t.strokeStyle=a,t.fillText(e.label,n.textX,e.textPosition),t.beginPath();let r=k(S(e.position,c,Dp),Dp);t.moveTo(n.majorTickStartX,r),t.lineTo(n.majorTickEndX,r),t.stroke()}),t.strokeStyle=a,t.lineWidth=.5,C.minorTicks.forEach(e=>{t.beginPath();let r=k(S(e.position,c,.5),.5);t.moveTo(n.minorTickStartX,r),t.lineTo(n.minorTickEndX,r),t.stroke()}),t.strokeStyle=a,t.lineWidth=.5,t.beginPath();let i=k(n.axisX,.5);t.moveTo(i,0),t.lineTo(i,c),t.stroke()},[C,c,p,o,k,S]);h(()=>{!1!==i&&D()},[D,i]),h(()=>oh(()=>{D()}),[D]);let z=u(e=>{n||(y(!0),x(e.clientY))},[n]),N=u(e=>{n||t.moveWheel?.(e)},[t,n]),E=u(e=>{if(n||!v||!s.current)return;let r=(e.clientY-w)/s.current.offsetHeight;Math.abs(r)>(M.max-M.min<1?.005:.01)&&(t.move?.(r),x(e.clientY))},[n,v,w,t,M]);return{canvasRef:l,containerRef:s,isDragging:v,range:M,handleMouseDown:z,handleMouseMove:E,handleMouseUp:u(()=>{n||y(!1)},[n]),handleMouseLeave:u(()=>{n||y(!1)},[n]),handleWheel:N,ticksData:C}}function Db(e){let{chart:t}=e,{state:{axisY:n,globalID:a}}=ae(),{show:i}=n,o=nY({chart:t}),{axisYWidth:l,inside:s,marginLeft:c}=yn(),{canvasRef:u,containerRef:d,isDragging:h,handleMouseDown:p,handleMouseMove:f,handleMouseUp:m,handleMouseLeave:g,handleWheel:b}=Dg({ranging:o});return!1===i?null:/*#__PURE__*/r("div",{ref:d,className:iX("h-full select-none",s?"absolute left-0 top-0 z-[7]":"relative",h?"cursor-grabbing":"cursor-ns-resize"),style:{width:l,marginLeft:c},onMouseDown:p,onMouseMove:f,onMouseUp:m,onMouseLeave:g,onWheel:b,onDoubleClick:()=>{let{realRange:e}=nA({range:n.defaultRange??ns,unit:n.unit,step:n.step,globalID:a}),t=yR(n.restrict,e);o.setAxisY?.({realRange:t}),o.onChange?.()},children:/*#__PURE__*/r("canvas",{ref:u,className:"pointer-events-none absolute left-0 top-0 h-full w-full"})})}let Dv=(e,t,r)=>{let[n,a]=r;return e<=0||t.end<t.start||!Number.isFinite(n)||!Number.isFinite(a)||a<=n?null:{x:[100*t.start/e,(t.end+1)*100/e],y:[n,a]}},Dy=(e,t)=>{let r=t.x[1]-t.x[0],n=t.y[1]-t.y[0],a=e=>Math.max(0,Math.min(100,t.x[0]+e*r/100));return{x:[a(e.leftPosition),a(e.leftPosition+e.width)],y:[t.y[1]-(e.position+e.height)*n/100,t.y[1]-e.position*n/100]}},Dw=(e,t)=>{let r=t.x[1]-t.x[0],n=t.y[1]-t.y[0];return{leftPosition:(e.x[0]-t.x[0])*100/r,width:(e.x[1]-e.x[0])*100/r,position:(t.y[1]-e.y[1])*100/n,height:(e.y[1]-e.y[0])*100/n}},Dx=(e,t)=>{let r=t.x[1]-t.x[0];return{left:-(100*t.x[0])/r,right:(100-t.x[0])*100/r,top:Math.min(0,100-e.height,e.position),bottom:Math.max(100,e.height,e.position+e.height)}},Dk=(e,t,r=0)=>{let n=t(e.x[0]),a=t(e.x[1]),i=Number(n),o=Number(a);return n&&a&&Number.isFinite(i)&&Number.isFinite(o)?{deltaX:Math.abs(o-i),deltaY:Math.abs(e.y[1]-e.y[0]),centerFrequency:(i+o)/2,startFrequency:i,endFrequency:o,startAmplitude:e.y[0]+r,endAmplitude:e.y[1]+r}:null},DS=1e-9,DM=(e,t,r,n,a)=>{for(let i=n;i<=a;i+=1)if(r(e,i)!==r(t,i))return i;return a},DF={position:40,height:20,leftPosition:40,width:20},DC=()=>{let{state:{deltaMeasurement:{show:e,display:t,onChange:a},axisX:{frequencyFormat:i},axisY:{unit:o,range:l,renderRange:s},segments:c,zoom:{interval:d}}}=ae(),p=e&&t,[f,v]=b(null),y=g(null),w=g(a);w.current=a;let x=s??l??[-120,0],k=(l?.[0]??x[0])-x[0],S=m(()=>Dv(c.totalPoints??0,d,x),[c.totalPoints,d.start,d.end,x[0],x[1]]),M=m(()=>f&&S?Dw(f,S):null,[f,S]),F=m(()=>f&&i&&c.length?Dk(f,i,k):null,[f,i,c,k]);h(()=>{p&&S&&v(e=>e??Dy(DF,S))},[p,S]),h(()=>{p||(y.current=null,v(null),w.current?.(null))},[p]);let C=u(e=>{let t=y.current??S;t&&v(Dy(e,t))},[S]),D=u(e=>{let t=y.current??S;if(y.current=null,!t||!i||!c.length)return;let r=Dy(e,t);v(r);let n=Dk(r,i,k);n&&a?.(n)},[S,i,c,k,a]),z=(e,t=3)=>rD(e,t).formatted,N=(e,t=2)=>{let r=Number.parseFloat(e.toFixed(t));return`${r} ${o}`},E=m(()=>{if(!F)return{labels:void 0,middleContent:null};let e=F.deltaX<=1e-9,t=F.deltaY<=1e-9,a=e?3:DM(F.startFrequency,F.endFrequency,z,3,6),i=t?2:DM(F.startAmplitude,F.endAmplitude,N,2,4),l=z(F.startFrequency,a),s=z(F.endFrequency,a),c=N(F.endAmplitude,i),u=N(F.startAmplitude,i),d=z(F.deltaX,a),h=`${Number.parseFloat(F.deltaY.toFixed(i))} ${o}`,p=z(F.centerFrequency,a);return{labels:{left:e?void 0:l,right:e?void 0:s,top:t?void 0:c,bottom:t?void 0:u},middleContent:/*#__PURE__*/n("div",{className:"grid gap-0.5",children:[/*#__PURE__*/r("div",{children:e?`频点: ${l}`:`ΔX: ${d}`}),/*#__PURE__*/r("div",{children:t?`幅度: ${u}`:`ΔY: ${h}`}),!e&&/*#__PURE__*/n("div",{children:["中心: ",p]})]})}},[F,o]);if(!M||!S)return null;let T=y.current??S,R=f?Dw(f,T):M;return /*#__PURE__*/r(ME,{enabled:p,defaultRect:M,minSize:0,minWidth:0,minHeight:0,variant:"projected",interactionBounds:Dx(R,T),onDragStart:()=>{y.current=S},onChange:C,onDragEnd:D,zIndex:7,labels:E.labels,children:E.middleContent})},DD=DC,Dz=({frequencyLeft:e,segments:t})=>ry(t)(e),DN=({e,zoom:t,segments:r,onChange:n,globalID:a})=>{let{realData:i}=tO(a).getAllRawData();if(!i)return;let o=i.length,{interval:{start:l,end:s}}=t,{left:c}=e,u=e.left+e.width,d=w_({coord:e,segments:r,zoom:t}),h=w_({coord:{left:u},segments:r,zoom:t}),p=Math.max(0,Math.ceil(o*d/100)-1),f=Math.ceil(o*h/100),{maxIndex:m}=tU(Array.from(i.slice(p,f)));n({frequency:(({frequencyLeft:e,segments:t})=>ry(t)(e))({frequencyLeft:(l+(p+m+1)/o*(s-l))*100/r.totalPoints,segments:r}),bandwidth:Math.round(1e3*rk({segments:r,endLeft:u,startLeft:c})),left:d,right:h})},DE=rl.DragFrame,DT=({id:e})=>{let{state:{zoom:a,segments:i,signalAnalysis:o,globalID:l},dispatch:s}=ae(),[c,d]=b(null),p=u((e,t=!1)=>{o.show&&o.display&&t?DN({e,zoom:a,segments:i,onChange:o.onChange,globalID:l}):s({payload:{zoom:{...a,interval:e.interval,isScanSegmentsUpdateMagnify:e.isScanSegmentsUpdateMagnify}}})},[o,a,i,l]),f=u((e,t,r,n)=>{if(e&&t&&n){let r=e.left,n=t.left,a=n-r;d({diffX:a,left:a>0?r:n,width:Math.abs(a),isScanSegmentsUpdateMagnify:a>0})}},[]),m=u(()=>{if(!c)return;let{left:e,width:t,isScanSegmentsUpdateMagnify:r,diffX:n}=c,{totalPoints:a}=i;if(r&&n>0){let n=SO({startPercent:e,endPercent:e+t,totalPoints:a}),i=n?n.end-n.start+1:0;n&&i>tV.ZOOM_MIN_RANGE&&p({interval:n,isScanSegmentsUpdateMagnify:r,left:e,width:t},!0)}n<0&&p({interval:{start:0,end:a-1},isScanSegmentsUpdateMagnify:r,left:e,width:t})},[c,i,a.interval.end,p]);return(h(()=>{if(a.show){let t=()=>{d(null),xt(e,DE)};wU(e,DE,t),wK(e,DE,()=>{m(),t()}),wV(e,DE,t),wJ(e,DE,(...t)=>{w7(e,DE)&&f(t[0],t[1],t[2],t[3])})}},[a.show,e,m,f]),h(()=>{c||xt(e,DE)},[c,e]),a.show)?/*#__PURE__*/r(yi,{className:"z-[3]",children:/*#__PURE__*/r("div",{className:"absolute left-[-100%] top-0 h-full w-0 box-border border-2 border-dashed border-chart-grid-strong bg-chart-surface opacity-40",style:c?{left:`${c.left}%`,width:`${c.width}%`}:{},children:c&&!c.isScanSegmentsUpdateMagnify&&/*#__PURE__*/n(t,{children:[/*#__PURE__*/r("div",{className:"pointer-events-none absolute inset-0 opacity-20",style:{background:"linear-gradient(to top right, transparent, transparent calc(50% - 1px), var(--chart-grid-strong), transparent calc(50% + 1px), transparent)"}}),/*#__PURE__*/r("div",{className:"pointer-events-none absolute inset-0 opacity-20",style:{background:"linear-gradient(to bottom right, transparent, transparent calc(50% - 1px), var(--chart-grid-strong), transparent calc(50% + 1px), transparent)"}})]})})}):null},DR=/*#__PURE__*/c(DT),DA=14,DI=5,DP=4,DL=({density:e="auto",channelCount:t})=>{let r="compact"===e||"auto"===e&&t>4;return{compact:r,laneHeight:r?5:14,showLabels:!r}},DO=null,Dq=["#B22222","#CD5C5C","#FF6347","#FA8072","#F08080","#A0522D","#FF4500","#FF7F50","#B8860B","#FFA500","#808000","#9ACD32","#32CD32","#8FBC8F","#2E8B57","#3CB371","#00FA9A","#66CDAA","#7FFFD4","#2F4F4F","#008080","#00CED1","#20B2AA","#48D1CC","#4682B4","#778899","#87CEFA","#4169E1","#4169E1","#6495ED","#483D8B","#6A5ACD","#7B68EE","#9370DB","#9370DB","#9932CC","#8A2BE2","#BA55D3","#800080","#DDA0DD","#C71585","#DC143C"];function D$(e){let t=parseInt(e.slice(1,3),16)/255,r=parseInt(e.slice(3,5),16)/255,n=parseInt(e.slice(5,7),16)/255,a=Math.max(t,r,n),i=Math.min(t,r,n),o=0,l=0,s=(a+i)/2;if(a!==i){let e=a-i;switch(l=s>.5?e/(2-a-i):e/(a+i),a){case t:o=(r-n)/e+6*(r<n);break;case r:o=(n-t)/e+2;break;case n:o=(t-r)/e+4}o/=6}return{h:360*o,s:100*l,l:100*s}}let D_=[...Dq].map(e=>({color:e,hsl:D$(e)})).sort((e,t)=>Math.abs(e.hsl.h-t.hsl.h)>10?e.hsl.h-t.hsl.h:e.hsl.l-t.hsl.l).map(e=>e.color);function Dj(e){let t=[...e].sort((e,t)=>Number(e.startFrequency)-Number(t.startFrequency));return t.map((e,r)=>{let n=t.length,a=D_.length,i=Math.floor(r/n*a),o=Math.floor((r+1)/n*a),l=D_[Math.min(i,a-1)],s=D_[Math.min(o,a-1)],c=r===n-1?D_[a-1]:s;return{...e,color:l,gradientColors:[l,c]}})}let DH=[{startFrequency:87,stopFrequency:108,stepFrequency:100,bandwidth:150,modulation:"AM",demodulation:"不解调",status:"合法",title:"FM广播",description:"FM调频广播频段,用于音频广播服务"},{startFrequency:108,stopFrequency:118,stepFrequency:50,bandwidth:100,modulation:"FM",demodulation:"解调",status:"合法",title:"航空导航",description:"航空无线电导航频段,用于仪表着陆系统等"},{startFrequency:118,stopFrequency:137,stepFrequency:25,bandwidth:50,modulation:"AM",demodulation:"解调",status:"合法",title:"航空语音通信",description:"民用航空语音通信频段"},{startFrequency:121,stopFrequency:122,stepFrequency:25,bandwidth:50,modulation:"FM",demodulation:"解调",status:"合法",title:"紧急通信",description:"紧急情况通信专用频段"},{startFrequency:136,stopFrequency:174,stepFrequency:25,bandwidth:50,modulation:"FM",demodulation:"解调",status:"合法",title:"对讲通信",description:"专业无线对讲通信频段"},{startFrequency:161,stopFrequency:162,stepFrequency:25,bandwidth:50,modulation:"GMSK",demodulation:"解调",status:"合法",title:"AIS船舶通信",description:"船舶自动识别系统(AIS)专用频段"},{startFrequency:351,stopFrequency:400,stepFrequency:25,bandwidth:50,modulation:"FM",demodulation:"解调",status:"合法",title:"集群通信",description:"专业集群通信系统频段"},{startFrequency:400,stopFrequency:470,stepFrequency:25,bandwidth:50,modulation:"FM",demodulation:"解调",status:"合法",title:"专业对讲",description:"专业无线对讲通信频段"},{startFrequency:534,stopFrequency:542,stepFrequency:100,bandwidth:8e3,modulation:"OFDM",demodulation:"解调",status:"合法",title:"数字电视",description:"数字电视广播频段"},{startFrequency:622,stopFrequency:630,stepFrequency:100,bandwidth:8e3,modulation:"OFDM",demodulation:"解调",status:"合法",title:"数字电视",description:"数字电视广播频段"},{startFrequency:703,stopFrequency:733,stepFrequency:100,bandwidth:3e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"5G上行(广电/移动)",description:"广电和移动5G网络上行频段"},{startFrequency:758,stopFrequency:788,stepFrequency:100,bandwidth:3e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"5G下行(广电/移动)",description:"广电和移动5G网络下行频段"},{startFrequency:806,stopFrequency:821,stepFrequency:25,bandwidth:50,modulation:"π/4DQPSK",demodulation:"解调",status:"合法",title:"数字集群上行",description:"数字集群通信系统(TETRA)上行频段"},{startFrequency:824,stopFrequency:835,stepFrequency:100,bandwidth:5e3,modulation:"QPSK",demodulation:"解调",status:"合法",title:"电信3G/4G/5G上行",description:"中国电信3G/4G/5G网络上行频段"},{startFrequency:851,stopFrequency:866,stepFrequency:25,bandwidth:50,modulation:"π/4DQPSK",demodulation:"解调",status:"合法",title:"数字集群下行",description:"数字集群通信系统(TETRA)下行频段"},{startFrequency:869,stopFrequency:880,stepFrequency:100,bandwidth:5e3,modulation:"QPSK",demodulation:"解调",status:"合法",title:"电信3G/4G/5G下行",description:"中国电信3G/4G/5G网络下行频段"},{startFrequency:885,stopFrequency:889,stepFrequency:200,bandwidth:200,modulation:"GMSK",demodulation:"解调",status:"合法",title:"GSM-R上行",description:"铁路专用GSM-R网络上行频段"},{startFrequency:889,stopFrequency:904,stepFrequency:200,bandwidth:200,modulation:"GMSK",demodulation:"解调",status:"合法",title:"移动2G/4G上行",description:"中国移动2G/4G网络上行频段"},{startFrequency:904,stopFrequency:915,stepFrequency:200,bandwidth:200,modulation:"QPSK",demodulation:"解调",status:"合法",title:"联通2/3/4/5G上行",description:"中国联通2G/3G/4G/5G网络上行频段"},{startFrequency:930,stopFrequency:934,stepFrequency:200,bandwidth:200,modulation:"GMSK",demodulation:"解调",status:"合法",title:"GSM-R下行",description:"铁路专用GSM-R网络下行频段"},{startFrequency:934,stopFrequency:949,stepFrequency:200,bandwidth:200,modulation:"GMSK",demodulation:"解调",status:"合法",title:"移动2G/4G下行",description:"中国移动2G/4G网络下行频段"},{startFrequency:949,stopFrequency:960,stepFrequency:200,bandwidth:200,modulation:"QPSK",demodulation:"解调",status:"合法",title:"联通2/3/4/5G下行",description:"中国联通2G/3G/4G/5G网络下行频段"},{startFrequency:1164,stopFrequency:1189,stepFrequency:1e3,bandwidth:1e4,modulation:"BPSK",demodulation:"解调",status:"合法",title:"GPS L5频段",description:"全球定位系统GPS L5频段"},{startFrequency:1215,stopFrequency:1234,stepFrequency:1e3,bandwidth:1e4,modulation:"BPSK",demodulation:"解调",status:"合法",title:"GPS L2频段",description:"全球定位系统GPS L2频段"},{startFrequency:1447,stopFrequency:1467,stepFrequency:100,bandwidth:1e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"政务公安专网",description:"政务和公安专用LTE网络频段"},{startFrequency:1563,stopFrequency:1587,stepFrequency:1e3,bandwidth:1e4,modulation:"BPSK",demodulation:"解调",status:"合法",title:"GPS L1频段",description:"全球定位系统GPS L1频段"},{startFrequency:1710,stopFrequency:1735,stepFrequency:200,bandwidth:5e3,modulation:"QPSK",demodulation:"解调",status:"合法",title:"移动2G/4G上行",description:"中国移动2G/4G网络上行频段"},{startFrequency:1735,stopFrequency:1765,stepFrequency:200,bandwidth:5e3,modulation:"QPSK",demodulation:"解调",status:"合法",title:"联通2/4G上行",description:"中国联通2G/4G网络上行频段"},{startFrequency:1805,stopFrequency:1830,stepFrequency:200,bandwidth:5e3,modulation:"QPSK",demodulation:"解调",status:"合法",title:"移动2G/4G下行",description:"中国移动2G/4G网络下行频段"},{startFrequency:1830,stopFrequency:1860,stepFrequency:200,bandwidth:5e3,modulation:"QPSK",demodulation:"解调",status:"合法",title:"联通2/4G下行",description:"中国联通2G/4G网络下行频段"},{startFrequency:1885,stopFrequency:1915,stepFrequency:100,bandwidth:1e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"移动4G",description:"中国移动4G网络频段"},{startFrequency:1920,stopFrequency:1940,stepFrequency:100,bandwidth:1e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"电信/联通5G上行",description:"中国电信/联通5G网络上行频段"},{startFrequency:1940,stopFrequency:1965,stepFrequency:100,bandwidth:1e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"联通3/4/5G上行",description:"中国联通3G/4G/5G网络上行频段"},{startFrequency:2110,stopFrequency:2130,stepFrequency:100,bandwidth:1e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"电信/联通5G下行",description:"中国电信/联通5G网络下行频段"},{startFrequency:2300,stopFrequency:2320,stepFrequency:100,bandwidth:1e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"联通4G",description:"中国联通4G网络频段"},{startFrequency:2320,stopFrequency:2370,stepFrequency:100,bandwidth:1e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"移动4G",description:"中国移动4G网络频段"},{startFrequency:2400,stopFrequency:2500,stepFrequency:1,bandwidth:20,modulation:"OFDM",demodulation:"解调",status:"合法",title:"ISM 2.4GHz",description:"WIFI、蓝牙、无人机等使用频段"},{startFrequency:2515,stopFrequency:2675,stepFrequency:100,bandwidth:1e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"移动5G/4G",description:"中国移动5G和4G网络频段"},{startFrequency:3300,stopFrequency:3600,stepFrequency:100,bandwidth:1e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"5G频段",description:"电信、联通、广电5G网络频段"},{startFrequency:4800,stopFrequency:4900,stepFrequency:100,bandwidth:1e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"移动5G",description:"中国移动5G网络频段"},{startFrequency:4900,stopFrequency:4960,stepFrequency:100,bandwidth:1e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"广电5G",description:"中国广电5G网络频段"},{startFrequency:5725,stopFrequency:5875.5,stepFrequency:5,bandwidth:20,modulation:"OFDM",demodulation:"解调",status:"合法",title:"ISM 5GHz",description:"WIFI、无人机等使用频段"}],DB="rfkit-charts-frequency-allocation",DW=e=>!!e&&"object"==typeof e&&2===e.version&&Array.isArray(e.channels),DG=()=>{let e=localStorage.getItem(DB);if(!e)return null;let t=JSON.parse(e);return Array.isArray(t)||DW(t)?t:null},DY=()=>{let e=DG();return Array.isArray(e)?e:null},DU=()=>{let e=DG();return DW(e)?e.channels:null},DX=e=>{localStorage.setItem(DB,JSON.stringify(e))},DK=e=>{localStorage.setItem(DB,JSON.stringify({version:2,channels:e}))},DV=()=>{localStorage.removeItem(DB)},DQ=()=>null!==localStorage.getItem(DB),DZ="default",DJ=(e,t)=>e.id||e.title||`${DZ}-${t}`,D0=e=>e.id?`channel:id:${e.id}`:e.title?`channel:title:${e.title}`:"channel:anonymous",D1=(e,t,r)=>{let n=t.get(e)??0,a=0===n?e:`${e}#${n+1}`;for(;r.has(a);)n+=1,a=`${e}#${n+1}`;return t.set(e,n+1),r.add(a),a},D2=(e,t)=>{let r=new Map,n=new Set;return e.map((e,r)=>({id:DJ(e,r),renderKeyBase:D0(e),title:e.title,data:t(e.data??[])})).filter(e=>e.data.length>0).map(({renderKeyBase:e,...t})=>({...t,renderKey:D1(e,r,n)}))},D5=(e,t)=>[{id:DZ,renderKey:`channel:id:${DZ}`,data:t(e)}];function D4({data:e,channels:t,cachedData:r,cachedChannels:n,presetData:a,normalizeData:i}){if(t)return t.length?D2(t,i):D5(e?.length?e:a,i);if(n?.length)return D2(n,i);let o=e??[];return D5(r&&r.length>0?r:o.length>0?o:a,i)}function D3({data:e,channels:t}){return D4({data:e,channels:t,cachedData:DY(),cachedChannels:DU(),presetData:DH,normalizeData:Dj})}function D6(e){return D3({data:e})[0]?.data??[]}let D8=e=>{if(null!=e.startFrequency&&null!=e.stopFrequency){let t=rT({startFrequency:Number(e.startFrequency),stopFrequency:Number(e.stopFrequency)});if(t)return{start:t.startFreq,stop:t.stopFreq,type:"range"}}return null},D9=e=>JSON.stringify([e.title,e.startFrequency,e.stopFrequency,e.centerFrequency,e.bandwidth,e.stepFrequency,e.modulation,e.description,e.demodulation,e.status]),D7=e=>e.id?`band:id:${e.id}`:`band:fingerprint:${D9(e)}`,ze=(e,t,r)=>{let n=t.get(e)??0,a=0===n?e:`${e}#${n+1}`;for(;r.has(a);)n+=1,a=`${e}#${n+1}`;return t.set(e,n+1),r.add(a),a},zt=({segments:e,allocations:t,channelIndex:r,channelTitle:n})=>{if(!e.length||!t.length)return[];let a=e.reduce((e,t)=>e+t.point,0),i=new Map,o=new Set,l=t.map(e=>({band:e,renderKey:ze(D7(e),i,o)}));return e.map((t,i)=>{let o=l.map(({band:e,renderKey:a})=>{let i=D8(e);if(!i||i.stop<t.start||i.start>t.stop)return null;let{left:o,width:l}=rP({startFreq:i.start,stopFreq:i.stop},t);return{band:e,renderKey:a,range:i,channelIndex:r??0,channelTitle:n,position:{left:`${o}%`,width:`${l}%`}}}).filter(e=>null!==e),s=t.point/a*100,c=e.slice(0,i).reduce((e,t)=>e+t.point/a*100,0);return{segment:t,segmentIndex:i,bandPositions:o,style:{left:`${c}%`,width:`${s}%`}}})},zr=({segments:e,channels:t})=>t.map((t,r)=>({channel:t,channelIndex:r,segmentData:zt({segments:e,allocations:t.data,channelIndex:r,channelTitle:t.title})})).filter(e=>e.segmentData.some(e=>e.bandPositions.length>0)),zn=e=>e.map(e=>{let t=calculateFrequencyRange(null!=e.startFrequency&&null!=e.stopFrequency?{startFrequency:Number(e.startFrequency),stopFrequency:Number(e.stopFrequency)}:{frequency:null!=e.centerFrequency?Number(e.centerFrequency):void 0,bandwidth:null!=e.bandwidth?Number(e.bandwidth):void 0});return t?{item:e,range:t,width:Math.abs(t.stopFreq-t.startFreq),center:(t.startFreq+t.stopFreq)/2,title:String(e.title??"")}:null}).filter(e=>null!==e),za=({rangeIndex:e,frequency:t})=>{let r;if(Number.isFinite(t)&&e.length){for(let n of e){let{range:e}=n;if(t<e.startFreq||t>e.stopFreq)continue;if(!r){r=n;continue}let a=n.width-r.width;if(a<0){r=n;continue}if(a>0)continue;let i=Math.abs(n.center-t)-Math.abs(r.center-t);if(i<0){r=n;continue}!(i>0)&&0>n.title.localeCompare(r.title)&&(r=n)}return r?.item}},zi=({allocations:e,frequency:t})=>za({rangeIndex:zn(e),frequency:t});function zo(){let e=useSelector(e=>e.frequencyAllocation.data);return useMemo(()=>resolveFrequencyAllocationData(e),[e])}function zl(){let e=at(e=>e.frequencyAllocation.data),t=at(e=>e.frequencyAllocation.channels);return m(()=>D3({data:e,channels:t}),[e,t])}function zs({frequency:e,cursorSample:t}){let r=useSelector(e=>e.cursor),n=useSelector(e=>e.segments),a=useSelector(e=>e.frequencyAllocation.display),i=useSelector(e=>e.frequencyAllocation.show),o=t?.coord.left??r.coord.left,l=useFrequencyAllocationData(),s=useMemo(()=>createFrequencyAllocationRangeIndex(l),[l]),c=useMemo(()=>!!t||hasActiveSpectrumCursor(r),[r,t]),u=useMemo(()=>c&&"number"==typeof o?calculateCursorPosition(o,n):{segmentIndex:-1,pointIndex:-1},[c,o,n]);return useMemo(()=>{if(!i||!a||!e||!n?.length||!c||!n[u.segmentIndex])return;let t=getCursorFrequencyAtPosition(n,u),r=Number.isFinite(t)?t:Number(e);if(Number.isFinite(r))return findFrequencyAllocationInRangeIndex({rangeIndex:s,frequency:r})},[s,u.segmentIndex,a,e,c,n,i])}let zc=null,zu=({allocationInfo:e,variant:t="default"})=>{if(!e)return null;let{title:r,description:a,startFrequency:i,stopFrequency:o,bandwidth:l,modulation:s,channelTitle:c}=e;return /*#__PURE__*/n("div",{className:iX("text-xs leading-5 text-popover-foreground","board"===t&&"mt-[calc(var(--size-gap-base)/2)] border-t border-dashed border-border pt-[calc(var(--size-gap-base)/2)]"),children:[r?/*#__PURE__*/n("div",{className:"mb-1 font-bold",children:["业务类型:",r]}):null,/*#__PURE__*/n("div",{className:"mb-1 text-primary",children:[c?/*#__PURE__*/n("div",{children:["通道:",c]}):null,null!=i&&null!=o&&/*#__PURE__*/n("div",{children:["频率范围:",i," - ",o]}),null!=l&&""!==l?/*#__PURE__*/n("div",{children:["信号带宽:",l," kHz"]}):null,s?/*#__PURE__*/n("div",{children:["调制方式:",s]}):null]}),a?.trim()?/*#__PURE__*/n("div",{className:"whitespace-pre-line break-words leading-5 opacity-85",children:["备注信息:",a]}):null]})},zd=/*#__PURE__*/a.memo(zu),zh=/*#__PURE__*/c(({style:e,bandPositions:t,showLabels:n,onMouseEnter:a,onMouseMove:i,onMouseLeave:o})=>/*#__PURE__*/r("div",{className:"absolute top-0 h-full [contain:layout]",style:e,children:t.map(e=>{let{band:t,position:l,renderKey:s}=e;return /*#__PURE__*/r("div",{className:"pointer-events-auto absolute flex h-full items-center justify-center overflow-hidden px-1 text-xs text-foreground/90 opacity-60 backdrop-blur-sm transition-[opacity,box-shadow] duration-200 hover:z-[1] hover:opacity-100 hover:shadow-lg",style:{...t.gradientColors?{backgroundImage:`linear-gradient(to right, ${t.gradientColors[0]}, ${t.gradientColors[1]})`}:{backgroundColor:t.color||"var(--primary)"},left:l.left,width:l.width},onMouseEnter:a(e),onMouseMove:i,onMouseLeave:o,children:n?/*#__PURE__*/r("span",{className:"truncate",children:t.title}):null},s)})})),zp=zh,zf=({title:e,description:t,visible:n,x:a,y:i,startFrequency:o,stopFrequency:l,centerFrequency:s,stepFrequency:c,bandwidth:d,modulation:p,channelTitle:f,positionRef:m,scheduleRef:b})=>{let v=g(null),y=g(null),w=gi("tooltip"),x=u(()=>{if(!n||!v.current)return;let e=v.current,t=e.offsetWidth,r=e.offsetHeight,o=window.innerWidth,l=window.innerHeight,s=m.current??{x:a,y:i},c=s.x,u=s.y,d=Math.max(12,Math.min(c+t>o-12?c-t-10:c,o-t-12)),h=Math.max(12,Math.min(u+r>l-12?u-r-10:u,l-r-12));e.style.transform=`translate3d(${d}px, ${h}px, 0)`},[m,n,a,i]),k=u(()=>{n&&null===y.current&&(y.current=requestAnimationFrame(()=>{y.current=null,x()}))},[x,n]);return(h(()=>(b.current=k,()=>{b.current===k&&(b.current=null)}),[k,b]),h(()=>{if(n)return k(),()=>{null!==y.current&&(cancelAnimationFrame(y.current),y.current=null)}},[w,k,n]),n&&w)?/*#__PURE__*/R(/*#__PURE__*/r("div",{ref:v,"data-rfkit-frequency-allocation-tooltip":"true",className:"pointer-events-none fixed z-[1] max-w-[300px] rounded-[var(--radius-surface)] border border-border/70 bg-chart-panel/95 p-[var(--size-gap-base)] text-chart-panel-foreground shadow-lg backdrop-blur-md",style:{left:0,top:0,transform:`translate3d(${a}px, ${i}px, 0)`},children:/*#__PURE__*/r(zd,{allocationInfo:{title:e,description:t,startFrequency:o,stopFrequency:l,centerFrequency:s,stepFrequency:c,bandwidth:d,modulation:p,channelTitle:f}})}),w):null},zm=zf,zg=()=>{let e=at(e=>e.axisX.unit),t=at(e=>e.segments),a=at(e=>e.frequencyAllocation.display),i=at(e=>e.frequencyAllocation.show),o=at(e=>e.frequencyAllocation.density),l=at(e=>e.zoom.style),s=zl(),[c,d]=b({visible:!1,x:0,y:0}),h=g({x:0,y:0}),p=g(null),f=u(e=>{h.current={x:e.clientX+10,y:e.clientY+10},p.current?.()},[]),v=m(()=>zr({segments:t,channels:s}),[t,s]),{laneHeight:y,showLabels:w}=DL({density:o,channelCount:v.length}),x=Math.max(y,v.length*y),k=u(e=>{d(t=>({...t,...e}))},[]),S=u(({band:t,channelTitle:r,range:n})=>a=>{f(a);let i={...t,visible:!0,x:h.current.x,y:h.current.y,channelTitle:r,startFrequency:`${n.start}${e}`,stopFrequency:`${n.stop}${e}`};"centerBandwidth"===n.type&&null!=n.frequency&&null!=n.bandwidth&&(i.centerFrequency=`${n.frequency}${e}`),k(i)},[e,k,f]),M=u(e=>{f(e)},[f]),F=u(()=>{k({visible:!1})},[k]);return i&&a&&0!==v.length?/*#__PURE__*/n("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 z-[5] flex w-full select-none items-center overflow-hidden",style:{height:x,backgroundColor:"var(--mix-chart-surface-12)"},children:[/*#__PURE__*/r("div",{className:"absolute right-0 top-0 h-full w-full will-change-transform",style:l??void 0,children:v.map(({channel:e,channelIndex:t,segmentData:n})=>/*#__PURE__*/r("div",{className:"absolute left-0 w-full",style:{bottom:t*y,height:y},children:n.map(({segmentIndex:t,bandPositions:n,style:a})=>/*#__PURE__*/r(zh,{style:a,bandPositions:n,showLabels:w,onMouseEnter:S,onMouseMove:M,onMouseLeave:F},`${e.renderKey}-segment-${t}`))},e.renderKey))}),/*#__PURE__*/r(zf,{...c,positionRef:h,scheduleRef:p})]}):null},zb=zg,zv=e=>{let[t,r]=b(0);return h(()=>{if(!e)return;let t=tq(e,"FrequencyTagLineBoard",()=>{r(e=>e+1)});return()=>{t?.()}},[e]),t},zy=({id:e})=>{let{state:{frequencyTagLine:t,cursor:n}}=ae(),{show:a,display:i,left:o,onChange:l}=t,s=zv(e),c=n.show&&n.active&&n.event?.sourceType===rr.Spectrum,d=u(e=>{if(!e)return;let{index:t,frequency:r}=e;tY(r)&&l({index:t,frequency:r})},[l]);return a&&i&&!c?/*#__PURE__*/r("div",{className:"absolute bottom-5 right-[34px] z-[6] h-auto w-auto",children:/*#__PURE__*/r(Sh,{left:o,updateKey:s,onChange:d,showSignalInfo:!1})}):null},zw=/*#__PURE__*/a.memo(zy),zx=()=>{let{state:{frequencyTagLine:e},dispatch:t}=useStore(),{display:r,show:n}=e,a=useCallback(r=>{t({payload:{frequencyTagLine:{...e,display:!!r}}})},[e]),i=useMemo(()=>/*#__PURE__*/_jsx("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",children:/*#__PURE__*/_jsx("path",{d:"M288 128H896l-120 256L896 640H288v320H192v-896h96V128z",fillOpacity:".65",fill:"currentColor",style:{transition:"fill 0.2s ease"}})}),[r]);return n?/*#__PURE__*/_jsx(IconBox,{active:r,tone:"primary",onClick:()=>a(!r),title:"频率标记线显示控制",children:i}):null},zk=/*#__PURE__*/null,zS=rl.FrequencyTagLine,zM=e=>{let{state:{frequencyTagLine:t},dispatch:n}=ae(),{show:a,display:i,left:o,onChange:l}=t,{id:s}=e,c=g(t);return(h(()=>{c.current=t},[t]),h(()=>{let e=wK(s,zS,()=>{a&&i&&xt(s,zS)}),t=wV(s,zS,()=>{a&&i&&xt(s,zS)});return()=>{e?.(),t?.()}},[s,a,i,l]),h(()=>{let e=wU(s,zS,e=>{a&&i&&n({payload:{frequencyTagLine:{...c.current,...e,id:s}}})}),t=wJ(s,zS,(e,t)=>{a&&i&&(w7(s,zS),n({payload:{frequencyTagLine:{...c.current,...t,id:s}}}))});return()=>{e?.(),t?.()}},[s,a,i,n]),h(()=>{n({payload:{frequencyTagLine:{...t,left:-100}}})},[a]),a&&i)?/*#__PURE__*/r(yi,{className:"z-[3]",children:/*#__PURE__*/r("div",{className:"relative flex h-full w-px border-l border-dashed border-chart-highlight/80 opacity-80",style:{left:`${o}%`}})}):null},zF=/*#__PURE__*/a.memo(zM),zC={color:tQ},zD={borderColor:tQ},zz=28,zN=e=>{let t=Math.round(100*e)/100;return 0===t?0:t},zE=({value:e,onChange:t,dragging:a})=>{let{state:{axisY:i,limit:o,system:l}}=ae(),{label:s,disabled:c}=o,{unit:d="",range:p=ns}=i,[f,v]=p,y=Math.min(f,v),w=Math.max(f,v),x=m(()=>rg(d)?ny(0):0,[d]),k=m(()=>{let t=v-f;return Number.isFinite(e)&&Number.isFinite(t)&&0!==t?(v-e-x)/t*100:0},[v,x,f,e]),S=m(()=>Number.isFinite(e)?zN(x+e):0/0,[x,e]),M=Number.isFinite(S)?String(S):"",[F,C]=b(!1),D=g(null),z=g(null),N=g(""),E=g(!1),T=D.current?.clientHeight||l.height,R=(T>0?k/100*T<28:k<15)?"top-[4px]":"top-[-28px]";h(()=>{c&&(E.current=!0,C(!1))},[c]),h(()=>{F&&(z.current?.focus(),z.current?.select())},[F]);let A=u(()=>{!c&&Number.isFinite(S)&&(N.current=M,E.current=!1,C(!0))},[c,M,S]),I=u(()=>{let e=z.current;if(c||!e||e.validity.badInput)return void C(!1);let r=e.value.trim();if(!r||r===N.current)return void C(!1);let n=Number(r);if(Number.isFinite(n)){let e=Math.min(w,Math.max(y,zN(n)));t?.(zN(e-x))}C(!1)},[x,c,t,w,y]),P=u(e=>{"Enter"===e.key?(e.preventDefault(),E.current=!0,I()):"Escape"===e.key&&(e.preventDefault(),E.current=!0,C(!1))},[I]),L=u(()=>{if(E.current){E.current=!1;return}I()},[I]);return /*#__PURE__*/r("div",{ref:D,className:"relative h-full w-full",children:/*#__PURE__*/n("div",{className:"absolute right-0 h-0 w-full",style:{top:`${k}%`},children:[!F||c?/*#__PURE__*/n("button",{type:"button",disabled:c||!Number.isFinite(e),className:`${a?"pointer-events-none":"pointer-events-auto"} absolute right-7 ${R} z-[8] flex h-6 appearance-none items-center justify-center rounded-[var(--radius-control)] border-0 bg-secondary px-2 text-xs text-foreground`,style:zC,onClick:A,children:[s," ",M,d]}):/*#__PURE__*/n("div",{className:`pointer-events-auto absolute right-7 ${R} z-[8] flex h-6 items-center justify-between bg-secondary px-2 text-xs text-foreground`,style:zC,children:[s," ",/*#__PURE__*/r("input",{ref:z,type:"number","aria-label":`${s}${d}门限值`,defaultValue:M,min:y,max:w,step:"any",className:"h-auto w-14 border-none bg-transparent p-0 text-center outline-none [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none",style:zC,onKeyDown:P,onBlur:L}),/*#__PURE__*/r("div",{className:"flex items-center",children:d})]}),/*#__PURE__*/r("div",{className:"absolute right-0 top-[-0.5px] z-[8] h-0 w-full border-b border-dashed",style:zD})]})})},zT=zE,zR=rl.Limit,zA=10,zI=e=>{let t=Math.round(100*e)/100;return 0===t?0:t},zP=({id:e})=>{let{state:{limit:t,segments:n,axisY:a,system:i},dispatch:o}=ae(),{show:l,active:s,disabled:c,value:d,onChange:p,unified:f}=t,[v,y]=a.range??ns,{totalPoints:w}=n,x=m(()=>l&&s,[l,s]),[k,S]=b(!1),M=g(null),F=g(null),C=g(null),D=g(!1),z=g(t);z.current=t;let N=u(e=>{p?.(f?Array.from({length:Math.max(1,n.length)},()=>e[0]):[...e])},[p,f,n.length]),E=u((e,t,r=!1)=>{let n;if(!Number.isFinite(t))return;let a=zI(t),i=f?0:e;if(z.current.value[i]===a)return;let l=f?[a]:((n=[...z.current.value])[i]=a,n),s={...z.current,value:l};z.current=s,o({payload:{limit:s}}),r&&N(l)},[o,N,f]),T=u(()=>{M.current=null,F.current=null,C.current=null,D.current=!1,S(!1),xt(e,zR)},[e]);if(h(()=>{(!x||c)&&T()},[x,c,T]),h(()=>{let t=()=>{if(x&&!c){if(D.current){let e=M.current,t=null!==e?z.current.value[e]:void 0;"number"==typeof t&&Number.isFinite(t)&&t!==C.current&&N(z.current.value)}T()}},r=wU(e,zR,t=>{if(!x||c||"number"!=typeof t?.left||!Number.isFinite(t.left)||"number"!=typeof t?.top||!Number.isFinite(t.top))return;let r=t.left,o=f?0:n.findIndex(e=>e.progress[0]<=r&&r<e.progress[1]);if(!Number.isFinite(o)||o<0)return void T();let l=y-v;if(!Number.isFinite(l)||0===l)return;let s=rg(a.unit)?ny(0):0,u=z.current.value[o];if("number"!=typeof u||!Number.isFinite(u))return void T();let d=(y-u-s)/l*100,h=Math.max(1.2,10/Math.max(1,i.height||1)*100);Math.abs(t.top-d)>h||!w7(e,zR)?T():(M.current=o,F.current=u,C.current=u,D.current=!0,S(!0))}),o=wV(e,zR,t),l=wK(e,zR,t),s=wJ(e,zR,(t,r,n)=>{if(!x||c)return;let i=M.current;if(null!==i&&w7(e,zR)&&"number"==typeof n?.top&&Number.isFinite(n.top)&&0!==n.top){let e=y-v;if(!Number.isFinite(e)||0===e)return;let t=F.current??z.current.value[i];if(!Number.isFinite(t))return;let r=t-n.top*e;F.current=r;let o=rg(a.unit)?ny(0):0,l=Math.min(v,y),s=Math.max(v,y),c=Math.min(s,Math.max(l,r+o));E(i,Math.min(s,Math.max(l,Math.round(c)))-o,!1)}});return()=>{r?.(),o?.(),l?.(),s?.()}},[x,c,n,e,E,N,T,f,v,y,a.unit,i.height]),!x)return null;if(f){let t=d[0];return /*#__PURE__*/r(yi,{className:"z-[7]",children:/*#__PURE__*/r("div",{className:"h-full w-full",children:"number"==typeof t&&Number.isFinite(t)?/*#__PURE__*/r(zE,{id:e,value:t,onChange:e=>E(0,e,!0),dragging:k}):null})})}return /*#__PURE__*/r(yi,{className:"z-[7]",children:n?.map((t,n)=>{let a=d[n],i="number"==typeof a&&Number.isFinite(a);return /*#__PURE__*/r("div",{style:{width:`${100*t.point/w}%`},className:"h-full w-[30%]",children:i?/*#__PURE__*/r(zE,{id:e,value:a,onChange:e=>E(n,e,!0),dragging:k},t.index):null},t.index)})})},zL=zP,zO=rl.Markers,zq=6,z$=8,z_=e=>{let{id:t,markers:r,display:n,fixed:a,readonly:i,onCreateMarker:o,onDeleteMarker:l,onUpdateMarker:s,onToggleSelect:c,onHover:d,onResetHover:p}=e,f=g({isDown:null,dragStart:null,isHover:"",hoverId:null}),m=u(()=>document.getElementById(wW(t))??document.getElementById(t),[t]),b=u(e=>{if(!e||!r||0===r.length)return null;let{left:t}=e;if(void 0===t)return null;let n=m();if(!n)return null;let{width:a}=n.getBoundingClientRect();for(let e=0;e<r.length;e+=1){let n=r[e];if(n&&Math.abs(t-n.left)*a/100<=6)return{...n,index:e}}return null},[m,r]),v=u(e=>{let t=m();if(!t)return"";let n=t.getBoundingClientRect().width,a="";for(let t=0;t<r.length;t+=1){let i=r[t];if(i&&Math.abs(e.left-i.left)*n/100<=8){a={...i,index:t};break}}return a},[m,r]);return h(()=>{if(i)return;let e=wY(t,zO,(e,t)=>{if(n&&void 0!==t.left){let e=v({left:t.left}),r="object"==typeof e?e.id:null;if(f.current.hoverId===r){f.current.isHover=e;return}f.current.isHover=e,f.current.hoverId=r,d({left:t.left})}}),r=wJ(t,zO,(e,r)=>{let{isDown:i}=f.current;n&&i&&w7(t,zO)&&!a&&s(i.id,{left:r.left,top:r.top})}),u=wU(t,zO,e=>{if(!n)return;let t=b(e)||("object"==typeof f.current.isHover?f.current.isHover:null);t&&!a&&(f.current.isDown=t)}),h=wK(t,zO,()=>{n&&(f.current.isDown=null,xt(t,zO))}),m=wV(t,zO,()=>{if(!n)return;let e=null!==f.current.hoverId;f.current.isDown=null,f.current.isHover="",f.current.hoverId=null,xt(t,zO),e&&p()}),g=w1(t,zO,(e,r)=>{if(!n||!w7(t,zO))return;let a=b(r)||("object"==typeof f.current.isHover?f.current.isHover:null);a?.id&&c(a.id)}),y=wX(t,zO,(e,r)=>{if(!n||!w7(t,zO)||void 0===r.left)return!1;let a=v({left:r.left});return a&&"object"==typeof a&&a.id?l(a.id):o({left:r.left}),!0});return()=>{e?.(),r?.(),u?.(),h?.(),m?.(),g?.(),y?.()}},[t,n,r,a,i,o,l,s,c,d,p,b,v]),{isDown:f.current.isDown}},zj=t0("marker"),zH=e=>Cn(e);function zB(e,t,r){let{needsMaxPeak:n=!1,needsTopPeaks:a=!1}=r||{},i=null,o=null;try{let t=tO(e).getAllRawData()[t3];if(t?.peaks?.peaks&&Array.isArray(t.peaks.peaks)){let e=t.peaks.peaks;return n&&e.length>0&&(i=e[0]),a&&(o=e),{maxPeak:i,topPeaks:o}}}catch(e){console.warn("[useMarkers] Failed to get precomputed peaks:",e)}return n&&(i=Cf(t)),a&&(o=Cg(t,2)),{maxPeak:i,topPeaks:o}}let zW=e=>{let{id:t,globalID:r,onChange:n}=e,[a,i]=b({markers:[],colorIndex:0,isDown:null,isHover:"",peak:null,hasPeak:!1}),o=g(new Float32Array),l=u((e,t)=>{let{axisY:{unit:n},axisX:{frequencyFormat:a}}=Cn(r),i=e.left,{peak:l}=e,s=t?.data??o.current;s&&0!==s.length||(s=tO(r).getAllRawData()[t3]),o.current=s;let c=Cp({left:i,globalID:r}),{outsideLeft:u,multiple:d}=c,{insideLeft:h}=c,p=s.length,f=Math.floor(p*h/100);if(100===h&&(f=p-1),"mainSecondary"===e.peakTracking&&"number"==typeof e.peakRank){let n=t?.topPeaks;n||(n=zB(r,s,{needsTopPeaks:!0}).topPeaks);let a=n?.[e.peakRank];a&&(h=((f=a.index)+.5)*100/p)}else if(l){let e=t?.maxPeak;e||(e=zB(r,s,{needsMaxPeak:!0}).maxPeak),e&&(h=((f=e.index)+.5)*100/p)}let m=parseFloat(a(i=u+h/d)),g=s[f];return void 0===g||Number.isNaN(g)||(e.level=parseFloat(nI(n,g).toFixed(1))),{...e,left:i,frequency:m}},[r]),s=u((e,t=!1)=>{0!==o.current.length&&i(a=>{let{marker:{maxCount:i,fifo:o}}=Cn(r),s=Ci(a.markers,[e],i,o);if(!s.allowed)return a;let c=rV(),u=zj[a.colorIndex%20],d={...l({...e,id:c,color:u,select:!1,peak:!1,frequency:0,hover:!1}),id:c,color:u,select:!t,peak:!1,hover:!1},h=[...t?s.keptMarkers:s.keptMarkers.map(e=>({...e,select:!1})),d];return t||setTimeout(()=>{n?.(ro.Add,h)},0),{...a,markers:h,colorIndex:a.colorIndex+1}})},[l,n]),c=u(({event:e,marker:t,frequencies:a,silent:s=!1})=>{i(i=>{let c=[...i.markers],u=ro.Update,{id:d,peak:h,select:p,frequency:f,left:m,top:g}=t||{},b=m;if(e===ro.Update&&void 0!==f){let e=Cn(r),t=(e?.segments||{totalPoints:0})[0];if(t&&d){let{start:e,stop:r}=t,n=r-e;if(void 0!==n&&f<r&&f>e)b=(f-e)*100/n;else{let e=c.findIndex(e=>e.id===d);-1!==e&&(c.splice(e,1),u=ro.Del)}}}if(e===ro.Add&&a?.length){let e=Cn(r),t=(e?.segments||{totalPoints:0})[0];if(t){let{start:e,stop:r}=t,n=r-e;if(void 0!==n){let t=[];for(let i=0;i<a.length;i+=1){let o=a[i];o>=e&&o<=r&&t.push((o-e)*100/n)}t.length>0&&(a=t)}}}if(e===ro.Add&&a?.length){let{marker:{maxCount:e,fifo:t}}=Cn(r),n=Ci(c,a,e,t);if(n.allowed&&n.itemsToAdd.length>0){c=n.keptMarkers.map(e=>({...e,select:!1}));let e=n.itemsToAdd;for(let t=0;t<e.length;t+=1){let r=rV(),n=zj[(i.colorIndex+t)%20],a=!1;if(o.current&&o.current.length>0){let r=-1/0,n=0;for(let e=0;e<o.current.length;e++)o.current[e]>r&&(r=o.current[e],n=e);Math.abs(Math.floor(o.current.length*e[t]/100)-n)<=Math.max(1,Math.floor(.01*o.current.length))&&(a=!0)}let s=l({left:e[t],id:r,color:n,select:!1,peak:a,frequency:0,hover:!1});c.push({...s,id:r,color:n,select:t===e.length-1,peak:a,hover:!1})}u=ro.Add}}if(e===ro.Del){let e=c.findIndex(e=>e.id===d);-1!==e&&(c.splice(e,1),u=ro.Del)}return e===ro.Clear&&(c=[],u=ro.Clear),e===ro.Update&&(u=ro.Update,c=c.map(e=>(void 0!==h&&(e.peak=!1),void 0!==p&&e.id!==d&&(e.select=!1),e.id===d&&(void 0!==b&&(e=l({...e,left:b,top:g||e.top})),void 0!==p&&(e.select=p),void 0!==h&&(e.peak=h,h&&void 0===p&&(e.select=!0))),e.peak,e))),s||setTimeout(()=>{n?.(u,c)},0),{...i,markers:c,colorIndex:e===ro.Clear?0:i.colorIndex}})},[l,n]),d=u(()=>{i(e=>({...e,markers:[],colorIndex:0})),setTimeout(()=>{n?.(ro.Clear,[])},0)},[n]),h=u(e=>{e&&(o.current=e),i(t=>{if(0===t.markers.length)return t;let a=t.markers.some(e=>e.peak&&"mainSecondary"!==e.peakTracking),i=t.markers.some(e=>"mainSecondary"===e.peakTracking&&"number"==typeof e.peakRank),s=e??o.current??new Float32Array,{maxPeak:c,topPeaks:u}=zB(r,s,{needsMaxPeak:a,needsTopPeaks:i}),d=t.markers.map(e=>l(e,{data:s,maxPeak:c,topPeaks:u}));return d.some((e,r)=>{let n=t.markers[r];return n&&(Math.abs(e.frequency-n.frequency)>.001||Math.abs(e.level-n.level)>.001)})&&setTimeout(()=>{n?.(ro.Update,d)},0),{...t,markers:d}})},[l,n]),p=u(e=>{let a=document.getElementById(t);if(!a)return"";let o=a.getBoundingClientRect(),{zoom:{interval:{start:l,end:s}},segments:c}=Cn(r),u=c.totalPoints/(s-l+1),d=o.width*u/100,h="",p=!1;return i(t=>{let r=t.markers.map((t,r)=>{let n=Math.abs(e.left-t.left)*d<=16;return t.hover!==n&&(p=!0),n&&(h={...t,index:r}),{...t,hover:n}});return p&&setTimeout(()=>{n?.(ro.Update,r)},0),{...t,markers:r,isHover:h}}),h},[t,r,n]),f=u(()=>{i(e=>{let t=!1,r=e.markers.map(e=>(e.hover&&(t=!0),{...e,hover:!1}));return t&&setTimeout(()=>{n?.(ro.Update,r)},0),{...e,markers:r,isHover:""}})},[n]),m=g(null),v=g(null),y=u(()=>{i(e=>{if(e.markers.some(e=>"mainSecondary"===e.peakTracking)){let t=e.markers.filter(e=>"mainSecondary"!==e.peakTracking),r=m.current;if(r){let e=t.findIndex(e=>e.id===r);-1!==e&&(t[e]={...t[e],select:!0})}return m.current=null,setTimeout(()=>{n?.(ro.Update,t)},0),{...e,markers:t}}let{marker:t}=Cn(r),a=t.maxCount,i=t.fifo,s=Ci(e.markers,[0,1],a,i);if(!s.allowed||s.itemsToAdd.length<2)return e;m.current=e.markers.find(e=>e.select)?.id??null;let c=[],u=e.colorIndex,d=e=>{let t=rV(),r=zj[u%20];u+=1;let n=l({left:50,id:t,color:r,select:!1,peak:!0,peakTracking:"mainSecondary",peakRank:e,frequency:0,hover:!1});c.push({...n,id:t,color:r,select:!1,peak:!0,peakTracking:"mainSecondary",peakRank:e,hover:!1})};d(0),d(1);let h=[...s.keptMarkers,...c.map(e=>({...e,select:!1}))].map(e=>l(e,{data:o.current}));return setTimeout(()=>{n?.(ro.Update,h)},0),{...e,markers:h,colorIndex:u}})},[l,r,n]),w=u(()=>{i(e=>{if(e.markers.some(e=>"mainSecondary"===e.peakTracking&&0===e.peakRank)){let t=e.markers.filter(e=>"mainSecondary"!==e.peakTracking||0!==e.peakRank),r=v.current;if(r){let e=t.findIndex(e=>e.id===r);-1!==e&&(t[e]={...t[e],select:!0})}return v.current=null,setTimeout(()=>{n?.(ro.Update,t)},0),{...e,markers:t}}let{marker:t}=Cn(r),a=t.maxCount,i=t.fifo,s=Ci(e.markers,[0],a,i);if(!s.allowed||s.itemsToAdd.length<1)return e;v.current=e.markers.find(e=>e.select)?.id??null;let c=rV(),u=zj[e.colorIndex%20],d={...l({left:50,id:c,color:u,select:!1,peak:!0,peakTracking:"mainSecondary",peakRank:0,frequency:0,hover:!1}),id:c,color:u,select:!1,peak:!0,peakTracking:"mainSecondary",peakRank:0,hover:!1},h=[...s.keptMarkers,d].map(e=>l(e,{data:o.current}));return setTimeout(()=>{n?.(ro.Update,h)},0),{...e,markers:h,colorIndex:e.colorIndex+1}})},[l,r,n]),x=u((e,t)=>{i(a=>{let i=a.markers.find(e=>e.id===t);if(!i)return a;let s=tO(r).getAllRawData()[t3];if(!s||s.length<3)return a;o.current=s;let{zoom:c,segments:u}=Cn(r),d=s.length,h=u.totalPoints||d,p=c.interval.end-c.interval.start+1,f=(i.left*h/100-c.interval.start)*100/p,m=Math.floor(d*f/100);100===f&&(m=d-1);let g=-1;if(s.peaks?.peaks&&Array.isArray(s.peaks.peaks)){let t=s.peaks.peaks;if("left"===e){let e=1/0;for(let r of t)if(r.index<m){let t=m-r.index;t<e&&(e=t,g=r.index)}}else{let e=1/0;for(let r of t)if(r.index>m){let t=r.index-m;t<e&&(e=t,g=r.index)}}}if(-1===g){let t=e=>{if(e<=0||e>=d-1)return!1;let t=s[e];return t>s[e-1]&&t>s[e+1]};if("left"===e){for(let e=m-1;e>0;e-=1)if(t(e)){g=e;break}}else for(let e=m+1;e<d-1;e+=1)if(t(e)){g=e;break}}if(-1===g)return a;let b=((g+.5)*100/d*p/100+c.interval.start)*(100/h),v=a.markers.map(e=>{if(e.id!==t)return{...e,select:!1};let{peakTracking:r,peakRank:n,...a}=e;return l({...a,left:b,select:!0,peak:!1},{data:s})});return setTimeout(()=>{n?.(ro.Update,v)},0),{...a,markers:v}})},[l,r,n]),k=u(e=>{i(t=>{if(!t.markers.find(t=>t.id===e))return t;let a=tO(r).getAllRawData()[t3];if(!a||a.length<1)return t;o.current=a;let{zoom:i,segments:s}=Cn(r),c=a.length,u=s.totalPoints||c,d=0,h=a[0];for(let e=1;e<c;e+=1)a[e]>h&&(h=a[e],d=e);let p=(100*d/(c-1)*(i.interval.end-i.interval.start+1)/100+i.interval.start)*(100/u),f=t.markers.map(t=>{if(t.id!==e)return{...t,select:!1};let{peakTracking:r,peakRank:n,...i}=t;return l({...i,left:p,select:!0,peak:!1},{data:a})});return setTimeout(()=>{n?.(ro.Update,f)},0),{...t,markers:f}})},[l,r,n]),S=u(e=>{i(t=>{if(!t.markers.find(t=>t.id===e))return t;let a=tO(r).getAllRawData()[t3];if(!a||a.length<3)return t;o.current=a;let{zoom:i,segments:s}=Cn(r),c=a.length,u=s.totalPoints||c,d=0,h=a[0];for(let e=1;e<c;e+=1)a[e]>h&&(h=a[e],d=e);let p=Math.max(2,Math.floor(.1*c)),f=-1,m=-1/0;for(let e=1;e<c-1;e+=1){if(Math.abs(e-d)<p)continue;let t=a[e],r=a[e-1],n=a[e+1];t>r&&t>n&&t>m&&(m=t,f=e)}if(-1===f)return t;let g=(100*f/(c-1)*(i.interval.end-i.interval.start+1)/100+i.interval.start)*(100/u),b=t.markers.map(t=>{if(t.id!==e)return{...t,select:!1};let{peakTracking:r,peakRank:n,...i}=t;return l({...i,left:g,select:!0,peak:!1},{data:a})});return setTimeout(()=>{n?.(ro.Update,b)},0),{...t,markers:b}})},[l,r,n]),M=u((e,t)=>{i(a=>{let i,s=a.markers.find(e=>e.id===t);if(!s)return a;let c=tO(r).getAllRawData()[t3];if(!c||c.length<2)return a;o.current=c;let{zoom:u,segments:d}=Cn(r),h=c.length,p=d.totalPoints||h,f=u.interval.end-u.interval.start+1,m=Math.round((h-1)*((s.left*p/100-u.interval.start)*100/f)/100);if((i="left"===e?Math.max(0,m-1):Math.min(h-1,m+1))===m)return a;let g=(100*i/(h-1)*f/100+u.interval.start)*(100/p),b=a.markers.map(e=>{if(e.id!==t)return{...e,select:!1};let{peakTracking:r,peakRank:n,...a}=e;return l({...a,left:g,select:!0,peak:!1},{data:c})});return setTimeout(()=>{n?.(ro.Update,b)},0),{...a,markers:b}})},[l,r,n]),F="#F98116",C="#AA74E8",D=u(()=>{i(e=>{let t,a=tO(r).getAllRawData()[t3];if(!a||a.length<1)return e;o.current=a;let{zoom:i,segments:s}=Cn(r),c=a.length,u=s.totalPoints||c,d=0,h=a[0];for(let e=1;e<c;e+=1)a[e]>h&&(h=a[e],d=e);let p=(100*d/(c-1)*(i.interval.end-i.interval.start+1)/100+i.interval.start)*(100/u),f=e.markers.find(e=>e.color===F);if(f)t=e.markers.map(e=>e.id===f.id?l({...e,left:p},{data:a}):e);else{let{marker:n}=Cn(r),i=n.maxCount,o=n.fifo,s=Ci(e.markers,[p],i,o);if(!s.allowed)return e;let c=l({left:p,id:rV(),color:F,select:!1,peak:!1,hover:!1},{data:a});t=[...s.keptMarkers,c]}return setTimeout(()=>{n?.(ro.Update,t)},0),{...e,markers:t}})},[l,r,n]),z=u(()=>{i(e=>{let t,a=tO(r).getAllRawData()[t3];if(!a||a.length<3)return e;o.current=a;let{zoom:i,segments:s}=Cn(r),c=a.length,u=s.totalPoints||c,d=0,h=a[0];for(let e=1;e<c;e+=1)a[e]>h&&(h=a[e],d=e);let p=Math.max(2,Math.floor(.1*c)),f=-1,m=-1/0;for(let e=1;e<c-1;e+=1){if(Math.abs(e-d)<p)continue;let t=a[e],r=a[e-1],n=a[e+1];t>r&&t>n&&t>m&&(m=t,f=e)}if(-1===f)return e;let g=(100*f/(c-1)*(i.interval.end-i.interval.start+1)/100+i.interval.start)*(100/u),b=e.markers.find(e=>e.color===C);if(b)t=e.markers.map(e=>e.id===b.id?l({...e,left:g},{data:a}):e);else{let{marker:n}=Cn(r),i=n.maxCount,o=n.fifo,s=Ci(e.markers,[g],i,o);if(!s.allowed)return e;let c=l({left:g,id:rV(),color:C,select:!1,peak:!1,hover:!1},{data:a});t=[...s.keptMarkers,c]}return setTimeout(()=>{n?.(ro.Update,t)},0),{...e,markers:t}})},[l,r,n]);return{markers:a.markers,isDown:a.isDown,isHover:a.isHover,createMarker:s,updateMarkerAttribute:c,resetMarkers:d,updateByData:h,handleHover:p,resetHover:f,toggleMainSecondaryPeaks:y,toggleMainPeak:w,moveToAdjacentPeak:x,findMainPeak:k,findSecondaryPeak:S,moveToStep:M,createMainPeakMarker:D,createSecondaryPeakMarker:z,setState:i}},zG=e=>{let{top:a,left:i,color:o="transparent",x:l=!0,y:s=!0,lineWidth:c=1}=e;return /*#__PURE__*/n(t,{children:[l&&/*#__PURE__*/r("div",{className:"absolute left-0 top-[-200%] z-[5] w-full border-t border-dashed",style:{top:a,borderColor:o,borderTopWidth:`${c}px`}}),s&&/*#__PURE__*/r("div",{className:"absolute left-[-200%] top-0 z-[5] h-full border-l border-dashed",style:{left:i,borderColor:o,borderLeftWidth:`${c}px`}})]})},zY=zG,zU=({marker:e})=>{let{state:{axisX:t,axisY:a}}=ae(),i=g(null),o=g(null),[l,s]=b(0),[c,u]=b(0);h(()=>{let e=()=>{i.current&&s(i.current.offsetWidth),o.current&&u(o.current.offsetWidth)};e();let t=new ResizeObserver(()=>{e()});return i.current&&t.observe(i.current),o.current&&t.observe(o.current),()=>{t.disconnect()}},[e.frequency,e.level]);let d=m(()=>{let t=e.left/100*l,r=l>0&&c>0&&t+c+10>l-20;return{left:`${e.left}%`,color:e.color,opacity:e.hover?1:.68,fontWeight:e.hover?500:"normal",transform:r?"translateX(-100%)":"translateX(0)",marginLeft:r?"-10px":"10px"}},[e.left,e.hover,e.color,l,c]);return /*#__PURE__*/n("div",{ref:i,className:"absolute left-0 top-0 h-full w-full",id:e.id,title:`${e.frequency}${t.unit} / ${e.level}${a.unit}`,children:[/*#__PURE__*/n("div",{ref:o,className:"absolute top-[10px] z-[5] whitespace-nowrap text-[12px] leading-4 transition-[opacity,font-weight,transform,margin-left,color]",style:d,children:[/*#__PURE__*/n("div",{children:[e.frequency,t.unit]}),void 0!==e.level&&/*#__PURE__*/n("div",{children:[e.level,a.unit]})]}),/*#__PURE__*/r(zG,{x:!1,left:`${e.left}%`,top:`${e.top}%`,color:e.color,lineWidth:e.select?2:1})]},e.id)},zX=/*#__PURE__*/a.memo(zU),zK=({id:e})=>{let{state:{marker:t,globalID:n}}=ae(),{enabled:a,visible:i,fixed:o,readonly:l,maxCount:s,onChange:c}=t,d=u((e,t)=>{c?.(e,t),Cs(n)({count:t.length,maxCount:s});let r=t.find(e=>e.select)?.id??null;Cc(n)({selectedId:r})},[c,n,s]),p=m(()=>a&&i,[a,i,t.enabled,t.visible]),f=m(()=>wW(e),[e]),{markers:b,createMarker:v,updateMarkerAttribute:y,resetMarkers:w,updateByData:x,handleHover:k,resetHover:S,toggleMainSecondaryPeaks:M,toggleMainPeak:F,moveToAdjacentPeak:C,findMainPeak:D,findSecondaryPeak:z,createMainPeakMarker:N,createSecondaryPeakMarker:E}=zW({id:e,globalID:n,display:i,onChange:d});h(()=>{if(!n||!f||!p||l)return;let e=nP(n,f,e=>{let t=e.key.toLowerCase();if(!["a","d","w","s"].includes(t))return;if("w"===t){if(e.repeat)return;e.preventDefault(),N();return}if("s"===t){if(e.repeat)return;e.preventDefault(),E();return}let r=b.find(e=>e.select)?.id;r&&(e.preventDefault(),C("a"===t?"left":"right",r))});return()=>{e?.()}},[f,n,b,C,p,l,N,E]);let T=u(e=>{let t=b.find(t=>t.id===e),r=!t?.select;y({event:ro.Update,marker:{id:e,select:r}})},[b,y]),R=u((e,t)=>{y({event:ro.Update,marker:{id:e,left:t.left,top:t.top}})},[y]);z_({id:e,markers:b,display:p,fixed:o,readonly:l,onCreateMarker:v,onDeleteMarker:u(e=>{y({event:ro.Del,marker:{id:e}})},[y]),onUpdateMarker:R,onToggleSelect:T,onHover:k,onResetHover:S});let A=g(null);return(h(()=>{n&&e&&tq(e,"Marker",()=>{let{realData:e}=tO(n).getAllRawData();A.current=e??null,x(e)})},[n,e,x]),h(()=>{n&&e&&Co(n,e=>{y(e)})},[n,e,y,w]),h(()=>{n&&e&&Cu(n,e=>{if(e?.type){if("main-secondary-peaks"===e.type)return void M();if("main-peak"===e.type)return void F();if("left-peak"===e.type)return void C("left",e.selectedId);if("right-peak"===e.type)return void C("right",e.selectedId);if("find-main-peak"===e.type)return void D(e.selectedId);if("find-secondary-peak"===e.type)return void z(e.selectedId);if("create-main-peak"===e.type)return void N();if("create-secondary-peak"===e.type)return void E();if("clear-all"===e.type)return void w()}})},[n,e,C,M,F,D,z,N,E,w]),p)?/*#__PURE__*/r(yi,{className:"z-[5]",children:b.map(e=>/*#__PURE__*/r(zX,{marker:e},e.id))}):null},zV=zK,zQ=({segments:e,index:t,frequency:r,bandwidth:n})=>{if(!r||!n||!e||!e[t])return{left:0,width:0};let a=e[t],i=e.reduce((e,t)=>e+t.point,0),{left:o,width:l}=rP({startFreq:r-n/2e3,stopFreq:r+n/2e3},a),s=e.slice(0,t).reduce((e,t)=>e+t.point/i*100,0),c=a.point/i*100;return{left:s+o/100*c,width:l/100*c}};function zZ(){let{state:{scope:e,segments:t},dispatch:r}=ae();return u(n=>{let{frequency:a,bandwidth:i,index:o=0}=n,{left:l,width:s}=zQ({segments:t,index:o,frequency:a,bandwidth:i});r({payload:{scope:{...e,left:l,width:s}}})},[t,e])}let zJ=()=>{let{state:{scope:{show:e,left:t,width:n}}}=ae();return e?/*#__PURE__*/r(yi,{children:/*#__PURE__*/r("div",{className:"relative flex h-full w-0 box-border border-y border-dashed border-chart-grid bg-chart-surface opacity-50",style:{width:`${n}%`,left:`${t}%`}})}):null},z0=zJ,z1=/*#__PURE__*/c(({style:e,signalPositions:t,activeSignalKey:n,segmentIndex:a})=>/*#__PURE__*/r("div",{className:"absolute h-full box-border",style:e,children:t.map(({item:e,key:t,position:i,color:o,tooltip:l})=>{let s=n===t,c={left:i.left,width:i.width,minWidth:"1px",backgroundColor:o,height:s?"100%":"8px",opacity:s?.5:1};return /*#__PURE__*/r("div",{className:"pointer-events-none absolute top-0 flex min-w-px items-center justify-center overflow-hidden text-ellipsis whitespace-nowrap text-center text-xs text-foreground","data-signal-active":s?"true":"false","data-signal-key":t,"data-signal-source":kA(e),"data-testid":"signal-annotation",style:c,title:l},`segment-${a}-signal-${t}`)})})),z2=z1;function z5(){let{state:e,dispatch:t}=ae(),r=g(e.globalID),n=g(e.signal),a=g({});return h(()=>{r.current=e.globalID,n.current=e.signal},[e.globalID,e.signal]),h(()=>{if(!e.globalID)return;let r=a.current.station,i=a.current.simple;void 0!==r&&(Se(e.globalID,r),a.current.station=void 0),void 0!==i&&(t({payload:{signal:{...n.current,data:i}}}),a.current.simple=void 0)},[t,e.globalID]),{updateSignalData:u(e=>{let{type:i,data:o}=e;if(Array.isArray(o)){if("station"===i){if(!r.current){a.current.station=o;return}Se(r.current,o)}else if("simple"===i){if(!r.current){a.current.simple=o;return}t({payload:{signal:{...n.current,data:o}}})}}},[t])}}let z4=({id:e,show:t=!0,display:n=!0})=>{let a=at(e=>e.segments),i=at(e=>e.zoom.style),o=at(e=>e.signal),l=xo(e),s=l?.coord.left,c=St({respectVisibility:!0}),u=o.show&&o.display&&n,d=!!l,h=m(()=>d&&"number"==typeof s?rL(s,a):{segmentIndex:-1,pointIndex:-1},[d,a,s]),p=m(()=>d?rO(a,h):0/0,[h,d,a]),f=m(()=>k1({segments:a,signalItems:c}),[a,c]),g=m(()=>k2({segmentData:f,isCursorActive:d,currentFrequency:p,currentPosition:h}),[p,h,d,f]);return t&&u?/*#__PURE__*/r("div",{className:"pointer-events-none absolute inset-0 z-[4] flex h-full w-full select-none items-center overflow-hidden bg-transparent",children:/*#__PURE__*/r("div",{className:"absolute right-0 top-0 flex h-full w-full",style:i??void 0,children:f.map(({segmentIndex:e,signalPositions:t,style:n})=>/*#__PURE__*/r(z1,{style:n,signalPositions:t,activeSignalKey:h.segmentIndex===e?g:void 0,segmentIndex:e},`segment-${e}`))})}):null},z3=z4,z6=()=>{let{state:{stripe:e},dispatch:t}=useStore(),{display:r,show:n}=e,a=useCallback(r=>{t({payload:{stripe:{...e,display:!!r}}})},[e]);return n?/*#__PURE__*/_jsx(IconBox,{active:r,tone:"primary",onClick:()=>{a(!r)},title:"频谱框选",children:/*#__PURE__*/_jsxs("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",children:[/*#__PURE__*/_jsx("path",{d:"M835.4 757.7h-69.9v-51h18.9v-18.8h51zM713.1 757.7h-83.9v-51h83.9v51z m-136.4 0h-83.9v-51h83.9v51z m-136.4 0h-83.9v-51h83.9v51z m-136.4 0H220v-51h83.9v51zM167.5 757.7H97.6v-69.8h51v18.8h18.9zM148.6 637.5h-51V557h51v80.5z m0-130.7h-51v-80.5h51v80.5z m0-130.8h-51v-80.5h51V376zM148.6 245.2h-51v-69.9h69.9v51h-18.9zM713.1 226.3h-83.9v-51h83.9v51z m-136.4 0h-83.9v-51h83.9v51z m-136.4 0h-83.9v-51h83.9v51z m-136.4 0H220v-51h83.9v51zM835.4 245.2h-51v-18.9h-18.9v-51h69.9zM835.4 637.5h-51V557h51v80.5z m0-130.7h-51v-80.5h51v80.5z m0-130.8h-51v-80.5h51V376z",fill:"currentColor"}),/*#__PURE__*/_jsx("path",{d:"M784.4 615.7h51v233h-51z",fill:"currentColor"}),/*#__PURE__*/_jsx("path",{d:"M693.4 706.7h233v51h-233z",fill:"currentColor"})]})}):null},z8=null,z9=rl.Stripe,z7=1.5,Ne=e=>Math.max(0,Math.min(100,e)),Nt=({cursor:e,left:t,right:r})=>{let n=Math.abs(e-t),a=Math.abs(e-r);return n<=1.5?"left":a<=1.5?"right":e>t&&e<r?"move":n<=a?"left":"right"},Nr=({id:e})=>{let{state:{stripe:t,axisX:{frequencyFormat:n,unit:a}},dispatch:i}=ae(),{show:o,display:l,left:s,right:c,defaultLeft:d,defaultRight:p,onChange:f}=t,m=g(t),b=g(null),v=g(n),y=g(a),w=g(f);h(()=>{m.current=t,v.current=n,y.current=a,w.current=f},[t,n,a,f]),h(()=>{i({payload:{stripe:{...t,left:d,right:p}}})},[d,p]);let x=u(e=>{let t=b.current;if(!t||!Number.isFinite(e?.left))return;let r=Ne(e.left),n=m.current,{mode:a,startCursor:o,startLeft:l,startRight:s}=t,c=l,u=s;if("move"===a){let e=s-l;(u=(c=Ne(l+(r-o)))+e)>100&&(c=Math.max(0,(u=100)-e))}"left"===a&&(c=Math.min(r,s)),"right"===a&&(u=Math.max(r,l)),i({payload:{stripe:{...n,left:c,right:u}}})},[i]),k=u(()=>{let{left:e,right:t}=m.current,r=Math.round(10*e)/10,n=Math.round(10*t)/10,a=v.current?.(r)??"",i=v.current?.(n)??"",o=n-r,l=Number(i)-Number(a);w.current({left:r,right:n,width:o,start:a,end:i,bandwidth:l,unit:y.current})},[]);return(h(()=>{wU(e,z9,t=>{if(!o||!l||!Number.isFinite(t?.left))return;let r=m.current,n=Ne(t.left);b.current={mode:Nt({cursor:n,left:r.left,right:r.right}),startCursor:n,startLeft:r.left,startRight:r.right},w7(e,z9)}),wK(e,z9,()=>{o&&l&&b.current&&(b.current=null,xt(e,z9),k())}),wV(e,z9,()=>{o&&l&&b.current&&(b.current=null,xt(e,z9),k())}),wY(e,z9,(e,t)=>{o&&l&&b.current&&x(t)})},[e,o,l,x,k]),o&&s-c!=0&&l)?/*#__PURE__*/r(yi,{className:"z-[3]",children:/*#__PURE__*/r("div",{className:"relative flex h-full w-px box-border border-x-2 border-dashed border-y-0 border-chart-grid-strong bg-chart-surface opacity-40",style:{left:`${s}%`,width:`${c-s}%`}})}):null},Nn=Nr;function Na(){let{dispatch:e,store:t}=ar();return u(r=>{let n=t.getState().band,a=r9(r,n,"replace");a!==n&&e({payload:{band:a}})},[e,t])}let Ni=()=>{let e=at(e=>e.band),t=at(e=>e.segments),n=m(()=>kp(e,t),[e,t]);return n.length?/*#__PURE__*/r(yi,{children:n.map(t=>/*#__PURE__*/r("div",{"data-testid":"spectrum-band","data-band-kind":e.kind,"data-band-key":t.key,className:"absolute flex h-full w-0 box-border border-y border-dashed opacity-50",style:{left:`${t.left}%`,width:`${t.width}%`,backgroundColor:e.color?`${e.color}40`:void 0,borderColor:e.color}},t.key))}):null},No=Ni,Nl=10,Ns=300,Nc=300,Nu=30,Nd=60,Nh=()=>({mode:"idle",startX:0,startY:0,startTime:0,lastX:0,lastY:0,startCoord:null,pinchBase:null}),Np=(e,t,r)=>Math.max(t,Math.min(e,r)),Nf=({id:e})=>{let{state:{zoom:t,segments:n,axisY:a,globalID:i},dispatch:o}=ae(),l=wW(e),s=g(null),c=g(Nh()),d=g(t),p=g(n.totalPoints),f=g(a),m=g(null);h(()=>{d.current=t},[t]),h(()=>{p.current=n.totalPoints},[n]),h(()=>{f.current=a},[a]);let b=u((e,t,r)=>({currentTarget:e,clientX:t,clientY:r}),[]),v=u(e=>{let t=Array.from(e.touches).map(e=>({x:e.clientX,y:e.clientY})),r=t.length,n=0,a=0,i=0;if(2===r){let[e,r]=t;n=Math.hypot(r.x-e.x,r.y-e.y),a=(e.x+r.x)/2,i=(e.y+r.y)/2}else 1===r&&(a=t[0].x,i=t[0].y);return{count:r,points:t,distance:n,midX:a,midY:i}},[]),y=u((e,t,r)=>{let n=b(e,t,r),a=wB(n);wQ(l)(),wY(l)(n,a)},[l,b]),w=u(e=>{let t=c.current.pinchBase,r=p.current;if(!t||t.distance<=0||e<=0)return;let n=e/t.distance;if(("x"===t.axisMode||"xy"===t.axisMode)&&d.current.show&&r){let e=SP({anchorPercent:t.anchorPercent,interval:t.interval,scale:1/n,totalPoints:r});o({payload:t=>t.zoom.interval.start===e.start&&t.zoom.interval.end===e.end?null:{zoom:{...t.zoom,interval:e,isScanSegmentsUpdateMagnify:!1}}})}("y"===t.axisMode||"xy"===t.axisMode)&&i&&(nB(i)(t.lastScale/n,t.yAnchorValue),t.lastScale=n)},[o,i]),x=g(w);x.current=w;let k=u(e=>{let t=s.current,r=c.current;if(t&&0!==e.touches.length){if(1===e.touches.length){let{clientX:n,clientY:a}=e.touches[0];r.mode="pending",r.startX=n,r.startY=a,r.startTime=Date.now(),r.lastX=n,r.lastY=a,r.startCoord=wB(b(t,n,a));return}if(2===e.touches.length){m.current?.flush(),r.mode="pinch",r.startTime=Date.now();let n=d.current,a=v(e),[i,o]=a.points,l=Math.abs(o.x-i.x),s=180*Math.atan2(Math.abs(o.y-i.y),l)/Math.PI,{start:c,end:u}=n.interval,h=wB(b(t,a.midX,a.midY)).left??0,p=t.getBoundingClientRect();if(p.height<=0||a.distance<=0){r.pinchBase=null;return}let[g,y]=f.current.realRange??[0,1],w=Np((a.midY-p.top)/p.height,0,1);r.pinchBase={distance:a.distance,lastScale:1,interval:{start:c,end:u},anchorPercent:Np(h,0,100),axisMode:s<30?"x":s>60?"y":"xy",yAnchorValue:y-w*(y-g),startPoints:a.points,pinchMoved:!1}}}},[v,b]),S=g(rW(e=>{if(!e||!("count"in e))return;let t=s.current,r=c.current;if(!t)return;let{count:n,points:a,distance:i}=e;if(2===n){if("pinch"===r.mode&&r.pinchBase){let e=r.pinchBase;if(!e.pinchMoved){let t={x:(a[0].x+a[1].x)/2,y:(a[0].y+a[1].y)/2},r={x:(e.startPoints[0].x+e.startPoints[1].x)/2,y:(e.startPoints[0].y+e.startPoints[1].y)/2};(Math.abs(i-e.distance)>10||Math.hypot(t.x-r.x,t.y-r.y)>10)&&(e.pinchMoved=!0)}x.current(i)}return}if(1!==n)return;let o=a[0];if("pending"===r.mode){let e=o.x-r.startX,t=o.y-r.startY;if(e*e+t*t<=100)return;r.mode="drag"}if("drag"!==r.mode)return;let u=t.getBoundingClientRect(),d={left:(o.x-r.lastX)/u.width,top:(o.y-r.lastY)/u.height},h=b(t,o.x,o.y),p=wB(h);wY(l)(h,p),wJ(l)(r.startCoord,p,d,!1),r.lastX=o.x,r.lastY=o.y})).current;m.current=S;let M=u(e=>{S(v(e))},[v,S]),F=u(e=>{S.flush();let t=s.current,r=c.current;if(!t)return;let n=e.changedTouches[0],a=n?.clientX??r.lastX,i=n?.clientY??r.lastY;if("pending"===r.mode){let e=Date.now()-r.startTime,n=a-r.startX,o=i-r.startY;n*n+o*o<=100&&e<=300&&y(t,a,i)}if(1===e.touches.length){let n=e.touches[0],a="pinch"===r.mode&&null!==r.pinchBase&&!r.pinchBase.pinchMoved&&Date.now()-r.startTime<=300;r.mode=a?"pinch":"drag",r.startX=n.clientX,r.startY=n.clientY,r.lastX=n.clientX,r.lastY=n.clientY,a||(r.pinchBase=null),r.startCoord=wB(b(t,n.clientX,n.clientY))}else 0===e.touches.length&&("pinch"===r.mode&&r.pinchBase&&!r.pinchBase.pinchMoved&&Date.now()-r.startTime<=300&&wV(l)(),r.mode="idle",r.pinchBase=null,wK(l)())},[l,y,b,S]),C=u(()=>{S.cancel();let e=c.current;e.mode="idle",e.pinchBase=null,wV(l)()},[l,S]),D=u(e=>{e.preventDefault()},[]);return h(()=>()=>{S.cancel(),wV(l)()},[l,S]),h(()=>{s.current&&(s.current.id=l)},[l]),/*#__PURE__*/r(yi,{className:"z-[5] pointer-events-auto",children:/*#__PURE__*/r("button",{ref:s,type:"button",className:iX("absolute right-0 top-0 h-full w-full appearance-none border-0 bg-transparent p-0 outline-none","touch-none select-none"),"aria-label":"Touch bus",onContextMenu:D,onTouchStart:k,onTouchMove:M,onTouchEnd:F,onTouchCancel:C})})},Nm=Nf,Ng=e=>{let{children:t,touch:a}=e,{state:{axisY:{autoranging:i},series:{enableLengthSyncFastMode:o},globalID:l}}=ae(),{id:s,chart:c,Chart:u}=iV({Render:FC,params:{autoranging:i,enableLengthSyncFastMode:o}});S$(s,rr.Spectrum);let d=Na(),p=zZ(),f=wx();return h(()=>{if(l&&c)return t$(l,e=>{c?.setDisabledClearRect(e)})},[l,c]),i3({moduleType:rr.Spectrum,chart:c,handleRender:(e,t)=>{t.updateSeries?.({data:e.data,extraData:e.extraData}),tq(s)()},eventHandlers:{autoranging:(e,t)=>{t.useRangeAutoFocus?.()},points:e=>{f(e.data)},[rn.Series]:(e,t)=>{t.setSeries?.(e)},band:e=>{d(e)},scope:e=>{p(e)}}}),/*#__PURE__*/n(yE,{children:[/*#__PURE__*/r(Db,{chart:c}),/*#__PURE__*/n(ST,{children:[/*#__PURE__*/r(FF,{}),/*#__PURE__*/r(u,{}),t,/*#__PURE__*/r(zw,{id:s}),/*#__PURE__*/r(zK,{id:s}),a?/*#__PURE__*/r(Nf,{id:s}):/*#__PURE__*/r(SC,{id:s}),/*#__PURE__*/r(zP,{id:s}),/*#__PURE__*/r(Sk,{id:s,type:rr.Spectrum}),/*#__PURE__*/r(z4,{id:s}),/*#__PURE__*/r(DR,{id:s}),/*#__PURE__*/r(Ni,{}),/*#__PURE__*/r(zJ,{}),/*#__PURE__*/r(Nr,{id:s}),/*#__PURE__*/r(zF,{id:s}),/*#__PURE__*/r(zg,{}),/*#__PURE__*/r(DC,{})]})]})},Nb=Ng,Nv=e=>{let{state:{cursor:t},dispatch:a}=ae(),{publish:i}=e,{analyzer:o}=De();return ac({publish:i,subscribe:e=>{let{pstype:t}=e;t===rn.Reset&&o?.reset(),t===rn.LevelStream&&o&&Da(o,e)}}),h(()=>{t.mode!==rr.LevelStream&&a({payload:{cursor:{...t,mode:rr.LevelStream}}})},[t,a]),/*#__PURE__*/n(am,{children:[/*#__PURE__*/r(C7,{type:rt.LevelStream}),/*#__PURE__*/r(yE,{children:/*#__PURE__*/r(Ng,{children:/*#__PURE__*/r(ST,{children:/*#__PURE__*/r(Dr,{opacity:.5})})})})]})},Ny=Nv,Nw=e=>/*#__PURE__*/r(aa,{...e,cursor:{show:!0},zoom:{show:!1},signal:{show:!1},children:/*#__PURE__*/r(Nv,{...e})}),Nx=tB(Nw,"LevelStream"),Nk=Nx,NS=["100%","75%","50%","25%","0%"],NM=e=>{let{inside:t=!1}=e;return /*#__PURE__*/r("div",{className:"pointer-events-none relative z-[2] flex h-full w-full flex-col justify-between text-xs text-foreground opacity-50",style:{alignItems:t?"flex-start":"flex-end"},children:NS.map(e=>/*#__PURE__*/r("div",{className:iX("flex justify-start box-border",t?"pl-0.5 pr-0":"pr-0.5"),children:e},e))})},NF=NM,NC=e=>{let{inside:t=!1}=e,{axisYWidth:n,marginLeft:a}=yn();return /*#__PURE__*/r("div",{className:"relative flex h-full w-auto",style:{width:n,marginLeft:a,justifyContent:t?"flex-start":"flex-end"},children:/*#__PURE__*/r(NM,{inside:t})})},ND=/*#__PURE__*/a.memo(NC),Nz=e=>{let{disabled:t,inside:n}=e,{state:{axisY:a}}=ae(),{show:i}=a;return!1===i||t?null:/*#__PURE__*/r(ND,{inside:n})},NN=Nz,NE=()=>/*#__PURE__*/r("div",{className:"h-0 w-full flex-1 border-t [border-color:var(--chart-grid)] first:border-t-0"}),NT=()=>{let{state:{gridLines:e}}=ae();return e&&/*#__PURE__*/n("div",{className:"pointer-events-none absolute right-0 top-0 z-[1] flex h-full w-full select-none flex-col border [border-color:var(--chart-grid)] bg-transparent",children:[/*#__PURE__*/r(NE,{}),/*#__PURE__*/r(NE,{}),/*#__PURE__*/r(NE,{}),/*#__PURE__*/r(NE,{})]})},NR=NT,NA=-200,NI=e=>`occupancy-total-line-${e}`,NP=(e,t,r=0)=>{e&&t&&(e.style.bottom=`${r||-200}%`,t.textContent=String(r))},NL=(e,t,r)=>tF(NI(e),t,r,e),NO=(e,t=0)=>{NL(e)(t)},Nq=({id:e})=>{let t=g(null),a=g(null),i=g(`OccupancyTotalLine-${Math.random().toString(36).slice(2)}`);return h(()=>(NP(t.current,a.current),NL(e,i.current,e=>{NP(t.current,a.current,e)})),[e]),/*#__PURE__*/r("div",{className:"pointer-events-none absolute z-[4] h-full w-full",children:/*#__PURE__*/n("div",{ref:t,className:"absolute left-0 w-full opacity-50",style:{bottom:"-200%"},children:[/*#__PURE__*/r("div",{className:"absolute h-0 w-full border-b border-dashed border-foreground/80",style:{marginTop:"-0.5px"}}),/*#__PURE__*/r("div",{ref:a,className:"absolute right-7 -mt-7 flex h-6 items-center justify-center rounded-[var(--radius-control)] bg-secondary px-2 text-xs text-foreground",children:"0"})]})})},N$=Nq,N_=e=>{let{occupancyAxisYDisabled:t}=e,{id:a,chart:i,Chart:o}=iV({Render:Dt});return(i3({moduleType:rr.Occupancy,chart:i,handleRender:(e,t)=>{let{data:r,totalOccupancy:n}=e;r&&t.updateSeries?.(r),void 0!==n&&NO(a,n)},eventHandlers:{[rn.Reset]:(e,t)=>{t.reset(),NO(a)}}}),S$(a,rr.Occupancy),t)?/*#__PURE__*/r("div",{className:"h-full w-full",style:{...eA},[ez]:"true",children:/*#__PURE__*/n("div",{className:"relative z-[0] h-full w-full",children:[/*#__PURE__*/r(o,{}),/*#__PURE__*/r(SC,{id:a}),/*#__PURE__*/r(Nq,{id:a})]})}):/*#__PURE__*/n(yE,{children:[/*#__PURE__*/r(Nz,{disabled:t}),/*#__PURE__*/n(ST,{children:[/*#__PURE__*/r(NT,{}),/*#__PURE__*/r(o,{}),/*#__PURE__*/r(SC,{id:a}),/*#__PURE__*/r(Nq,{id:a}),/*#__PURE__*/r(Sk,{id:a,type:rr.Occupancy})]})]})},Nj=N_,NH=e=>{let{publish:t}=e,{state:{globalID:a}}=ae(),i=wM(rt.Scan);return ac({publish:t,subscribe:e=>{i(e),e.pstype===rn.Occupancy&&(e.data&&(tO(a).getAllRawData=t=>({...tL().getAllRawData(t),occupancyData:e.data})),((e,t,r="0")=>tI(e,t,void 0,r))(a,rr.Occupancy)({...e,pstype:rn.Render}))}}),/*#__PURE__*/n(am,{children:[/*#__PURE__*/r(yE,{children:/*#__PURE__*/r(N_,{})}),/*#__PURE__*/r(yN,{type:rt.Scan,allowScanCenterBandwidth:!1})]})},NB=NH,NW=e=>/*#__PURE__*/r(aa,{...e,zoom:{show:!1},children:/*#__PURE__*/r(NH,{...e})}),NG=tB(NW,"Occupancy"),NY=NG,NU=()=>{let e=an(),t=at(e=>e.zoom),r=at(e=>e.segments.totalPoints)??0,n=at(e=>e.axisX.frequencyFormat),{interval:{start:a,end:i},onChange:o}=t,l=m(()=>r&&n?[n((100*a+1)/r),n((100*i+1)/r)]:["",""],[a,i,r,n]);return h(()=>{r&&void 0!==l[0]&&void 0!==l[1]&&o(l,{start:a,end:i})},[l,o,r]),h(()=>{if(!r)return;let t=i-a+1,n=r/t,o=`-${a/t*100}%`,l=`${100*n}%`;e({payload:e=>({zoom:{...e.zoom,style:{left:o,width:l}}})})},[e,i,a,r]),null},NX=NU;class NK extends vH{constructor(e){super({id:e.id,globalID:e.globalID,chart:null,renderer:e.renderer,renderMode:e.renderMode})}init(){let{id:e,renderer:t,renderMode:r}=this.state;e&&(this.state.chart=new x({id:e,colors:this.getInitialColors(),ignoreValue:0,renderer:t,fluorescenceRenderMode:r}),this.subscribeToColor("Fluorescence-Render"))}updateProps(e){void 0!==e.renderMode&&(this.state.renderMode=e.renderMode),this.state.chart?.updateProps(e)}updateSeries(e){this.state.chart&&e&&this.state.chart.render(e)}setRenderMode(e){this.state.renderMode=e,this.state.chart?.setRenderMode(e)}}let NV=()=>{let{state:{axisY:{range:e},fluorescence:{display:t,renderer:n,renderMode:a}}}=ae(),{chart:i,Chart:o}=iV({Render:NK,params:{renderer:n,renderMode:a}});h(()=>{i?.updateProps({range:e})},[i,e]),h(()=>{i&&i.setRenderMode(a)},[a]),i3({moduleType:rr.Fluorescence,chart:i,renderPSTypes:[rn.Fluorescence],extractData:e=>e.data});let l=m(()=>({height:"100%",width:"100%",display:"flex",visibility:t?"visible":"hidden"}),[t]);return h(()=>{i&&i.updateProps({display:t})},[i,t]),/*#__PURE__*/r("div",{style:l,children:/*#__PURE__*/r(yE,{children:/*#__PURE__*/r(o,{})})})},NQ=NV,NZ=e=>{let{type:t,heatmapElementID:a,renderer:i}=e;return /*#__PURE__*/r(vo,{id:a,children:/*#__PURE__*/n(al,{children:[/*#__PURE__*/r(C7,{type:rt.Heatmap}),/*#__PURE__*/r(M6,{renderer:i,zoomMode:"linked-x"}),/*#__PURE__*/r(yN,{type:t})]})})},NJ=NZ,N0=e=>{let{occupancyElementID:a,occupancyAxisYElementID:i,type:o}=e;return /*#__PURE__*/n(t,{children:[/*#__PURE__*/r(vo,{id:a,children:i?/*#__PURE__*/r(N_,{occupancyAxisYDisabled:!0}):/*#__PURE__*/n(al,{children:[/*#__PURE__*/r(C7,{type:rt.Occupancy}),/*#__PURE__*/r(N_,{}),/*#__PURE__*/r(yN,{type:o})]})}),/*#__PURE__*/r(vo,{id:i,children:/*#__PURE__*/r(Nz,{inside:!0})})]})},N1=N0,N2=(e,t)=>tF(`BLAZE_PROGRESS-${e}`,"0",t,e),N5=()=>{let{state:{blaze:{show:e},segments:t,globalID:a}}=ae(),[i,o]=b(""),l=m(()=>{let e=[];for(let r=0;r<t.length;r++){let n=t[r];n.progress&&e.push(...n.progress)}return e},[t]);return(h(()=>{e&&a&&N2(a,e=>{o(l.includes(e)?void 0:`${100*e}%`)})},[e,a]),e)?/*#__PURE__*/r(yi,{children:/*#__PURE__*/n("div",{className:"absolute left-[-100%] top-0 flex h-full w-0 opacity-50",style:{left:i},children:[/*#__PURE__*/r("div",{className:"ml-[-0.5px] opacity-50",style:{borderRight:"0.5px solid var(--chart-grid-strong)"}}),/*#__PURE__*/r("div",{className:"ml-[-31px] w-[30px] opacity-20",style:{background:"linear-gradient(90deg, transparent, var(--chart-grid-strong))"}})]})}):null},N4=/*#__PURE__*/a.memo(N5),N3=()=>{let{state:{legend:{children:e}}}=ae();return /*#__PURE__*/r("div",{className:"absolute left-5 top-5 z-[6] flex h-auto w-auto items-center",children:e})},N6=N3,N8=()=>{let{state:{segments:e}}=ae(),t=e.totalPoints??0;return /*#__PURE__*/r(yi,{className:"z-[0]",children:e.map((e,n)=>/*#__PURE__*/r("div",{className:"h-full border-x",style:{width:t>0?`${100*e.point/t}%`:0,borderColor:n%2==1?"var(--chart-grid)":"transparent",background:n%2==1?"var(--chart-surface)":"transparent",opacity:n%2==1?.4:1}},`${e.start}_${e.stop}_${e.index}`))})},N9=N8,N7=({globalID:e})=>({handleMarkerPublish:u(t=>{if(e)switch(t.pstype){case rn.Marker:Co(e)(t);break;case rn.Reset:Co(e)({type:ro.Clear})}},[e])}),Ee=N7;function Et(){let e=an();return u(()=>{e({payload:e=>e.axisY.fieldStrengthUnitAvailable?null:{axisY:{...e.axisY,fieldStrengthUnitAvailable:!0}}})},[e])}function Er({segmentOffset:e,offset:t}){let r={};return void 0!==e&&(r.segmentOffset=e),void 0!==t&&(r.offset=t),void 0!==r.segmentOffset||void 0!==r.offset?r:void 0}function En(e,t){"thresholdData"in t&&e.setThresholdData(t.thresholdData,Er(t))}function Ea(){let e=at(e=>e.signal.onChange),t=g(e);return f(()=>{t.current=e},[e]),u(e=>{let r=t.current;r&&r(e.regions.map(t=>({...t,frequency:t.centerFrequency,timestamp:e.timestamp})),e)},[])}function Ei(e){let{state:{globalID:t,series:{enableMetrics:r,enableWaterfall:n},fluorescence:{show:a},axisY:{unit:i},zoom:{interval:o},heatmapCapture:{display:l},system:{width:s},marker:c,signal:d}}=ae(),p=g(null),f=g(t),m=g(o),b=g(0),v=Ea(),y=d.templateDetection??e?.processing?.enableTemplateDetection??!1;h(()=>{p.current?.updateProcessing({enableTemplateDetection:y})},[y]);let w=g(null),{updateSignalData:x}=z5(),k=Et(),S=g(l);h(()=>{S.current=l},[l]);let M=u(e=>{((e,t,r="0")=>tI(e,t,void 0,r))(f.current,rr.Spectrum)({pstype:rn.Render,data:e})},[]),F=u(e=>{((e,t,r="0")=>tI(e,t,void 0,r))(f.current,rr.Heatmap)({pstype:rn.Render,data:e})},[]),C=u(e=>{N2(f.current)?.(e)},[]),D=u(e=>{(e.realData||e.templateData||e.backgroundNoiseData||"thresholdData"in e)&&M({minData:e.minData,maxData:e.maxData,avgData:e.avgData,thresholdData:e.thresholdData,backgroundNoiseData:e.backgroundNoiseData,realData:e.realData,templateData:e.templateData}),e.scanProgress&&C(e.scanProgress),e.templateDetection&&v(e.templateDetection),e.waterfallData&&F(e.waterfallData),e.fluorescenceData&&((e,t,r="0")=>tI(e,t,void 0,r))(f.current,rr.Fluorescence)({pstype:rn.Fluorescence,data:{fluorescenceData:e.fluorescenceData,fluorescenceMaxCount:e.fluorescenceMaxCount}}),e.occupancyData&&((e,t,r="0")=>tI(e,t,void 0,r))(f.current,rr.Occupancy)({pstype:rn.Render,data:e.occupancyData,totalOccupancy:b.current}),e.extraData&&((e,t,r="0")=>tI(e,t,void 0,r))(f.current,rr.Spectrum)({pstype:rn.Render,extraData:e.extraData})},[M,F,C,v]);h(()=>{f.current=t},[t]);let z=(e,t)=>!1!==e&&(t??!0);if(!p.current&&t){let i=Math.min(1|Math.floor(2*s),1001);p.current=new O({...e,outputPoints:i,processing:{...e?.processing,enableMetrics:z(r,e?.processing?.enableMetrics),enableWaterfall:z(n,e?.processing?.enableWaterfall),enableTemplateDetection:y,enableFluorescence:a,enablePeakStats:!!c?.enabled},onSpectrumUpdate:D});let o=tO(t),l=p.current;o.getAllRawData=e=>l.getAllRawData(e),t_(t,p.current)}h(()=>{let e=Math.floor(o.start),t=Math.ceil(o.end),r=Math.floor(m.current.start),n=Math.ceil(m.current.end);(e!==r||t!==n)&&p.current&&(m.current=o,p.current.updateSamplingRange(e,t+1))},[o]);let N=u(async(e=!1)=>{setTimeout(()=>{((e,t,r="0")=>tI(e,t,void 0,r))(f.current,rr.Heatmap)({pstype:rn.Reset}),((e,t,r="0")=>tI(e,t,void 0,r))(f.current,rr.Spectrum)({pstype:rn.Reset}),((e,t,r="0")=>tI(e,t,void 0,r))(f.current,rr.Occupancy)({pstype:rn.Reset}),e&&wh(f.current)},1)},[]),E=u(async e=>{if(p.current)switch(e.pstype){case rn.AntennaFactor:p.current.setAntennaFactor(e.data),e.data.length>0&&k();break;case rn.Signal:x({type:e.type,data:e.data});break;case rn.Spectrum:e.data&&p.current.process(e),En(p.current,e),e.maxData&&p.current.setMaxData(e.maxData),e.minData&&p.current.setMinData(e.minData),e.avgData&&p.current.setAvgData(e.avgData),e.templateData&&p.current.setTemplateData(e.templateData,e.templateTolerance),e.backgroundNoiseData&&p.current.setBackgroundNoiseData(e.backgroundNoiseData),e.extraData&&p.current.setExtraData(e.extraData,I.MERGE,e.segmentedExtraData?{segmentOffset:e.segmentOffset,offset:e.offset}:void 0);break;case rn.Fluorescence:e.data&&p.current&&p.current.setFluorescenceData(e.data.fluorescenceData,e.data.fluorescenceMaxCount);break;case rn.Heatmap:if(e.data){let{data:t,timestamps:r}=e,n=rJ(t,r);p.current.setWaterfallData(n)}break;case rn.Occupancy:p.current?.setOccupancyData(e.data),b.current=e.totalOccupancy;break;case rn.Segments:p.current.initializeSegments(e.data),await N(),e.onFinally?.();break;case rn.SpectrumBandwidth:p.current.reset();break;case rn.Series:wd(f.current,e);break;case rn.Reset:p.current.reset(),await N(!0),e.onFinally?.();break;case rn.Clear:p.current.reset(),await N(!1),e.onFinally?.()}},[k,x,wd,N]);return h(()=>{let e=i.includes("/m");p.current?.setAntennaFactorSwitch(e)},[i]),h(()=>{if(!p.current)return;let t=z(r,e?.processing?.enableMetrics);t!==w.current&&(p.current.updateProcessing({enableMetrics:t}),w.current=t)},[r,e?.processing?.enableMetrics]),E}let Eo=e=>{let{state:{globalID:a}}=ae(),i=g([]),o=g(""),{type:l=rt.SingleFrequency,publish:s,heatmapElementID:c,occupancyElementID:u,occupancyAxisYElementID:d,touch:h,children:p,processing:f,renderer:m}=e,{enableMetrics:b,enableWaterfall:v}=wy({type:l,heatmapElementID:c}),y=Ei({processing:{enableWaterfall:v,enableMetrics:b,...f}}),w=wM(l);wF(h);let{handleMarkerPublish:x}=N7({globalID:a});return ac({publish:s,subscribe:e=>{if(y(e),x(e),w(e),e.pstype===rn.Heatmap){let{data:t,timestamps:r}=e;if(i.current=rJ(t,r),o.current!==a){let e=tO(a),t=e.getAllRawData;e.getAllRawData=e=>({...t(e),waterfallData:i.current}),o.current=a}}((e,t,r="0")=>tI(e,t,void 0,r))(a,rr.Spectrum)(e),((e,t,r="0")=>tI(e,t,void 0,r))(a,rr.Heatmap)(e),((e,t,r="0")=>tI(e,t,void 0,r))(a,rr.Occupancy)(e),e.pstype!==rn.Fluorescence&&((e,t,r="0")=>tI(e,t,void 0,r))(a,rr.Fluorescence)(e)}}),/*#__PURE__*/n(am,{children:[/*#__PURE__*/r(C7,{type:l}),/*#__PURE__*/n(yE,{children:[/*#__PURE__*/r(Ng,{touch:h,children:p||/*#__PURE__*/r(NV,{})}),/*#__PURE__*/r(NZ,{type:l,heatmapElementID:c,renderer:m}),/*#__PURE__*/r(N0,{type:l,occupancyElementID:u,occupancyAxisYElementID:d}),/*#__PURE__*/n(ST,{children:[/*#__PURE__*/r(NU,{}),l===rt.Scan&&/*#__PURE__*/n(t,{children:[/*#__PURE__*/r(N8,{}),/*#__PURE__*/r(N4,{})]}),/*#__PURE__*/r(N3,{})]})]}),/*#__PURE__*/r(yN,{type:l})]})},El=Eo,Es="singleFrequency",Ec="slider",Eu=e=>"slider"===e?"deltaMeasurement":"default",Ed=e=>{let t=e.type??Es;if(!e.heatmapElementID||t!==Es&&"scan"!==t&&"mscan"!==t)return e;let r=e.heatmapCapture?.type??"slider",n=e.heatmapCapture?.toolbarVariant??Eu(r);return{...e,heatmapCapture:{show:!0,display:!1,...e.heatmapCapture,type:r,toolbarVariant:n}}},Eh=e=>{let t=Ed(e);return /*#__PURE__*/r(aa,{...t,children:/*#__PURE__*/r(Eo,{...t})})},Ep=tB(Eh,"Spectrum"),Ef=Ep;function Em(e={}){let{onChange:t,sizes:r,tokens:n}=e;th({sizes:r,tokens:n});let a=od();return{cleanup:t?oh(e=>t(e)):void 0,...a}}var Eg=/*#__PURE__*/function(e){return e.Station="station",e.Simple="simple",e}({});th();export{w as DialDirectionLabelMode,oR as AudioWaveform,vZ as Dial,ye as Gauge,Fh as Heatmap,FL as IQ,Nk as LevelStream,NY as Occupancy,Ef as Spectrum,t7 as AxisPlacement,re as AxisXLabelMode,rt as ChartType,t9 as FrequencyUnit,ro as MarkerEventType,rr as ModuleType,ra as OptionKey,rn as PSType,ri as SegmentsEvent,rc as SeriesType,rl as ToolType,rs as ToolbarItemType,rC as formatFrequencyUnit,rz as formatFrequencyUnitFromHz,rD as formatFrequencyUnitFromMHz,od as getChartsThemeState,nn as HeatmapCaptureType,Em as initChartsTheme,nt as MarkerMode,DK as setFrequencyAllocationChannelsToCache,DX as setFrequencyAllocationToCache,Eg as SignalDataType,oh as subscribeChartsThemeChange,ad as useSafePublish,tB as withChartPublisher};
|
|
3780
|
+
*/let CU={name:"minus",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}]]};CU.node;let CX=Mo(CU),CK={name:"check",size:24,node:[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]};CK.node;let CV=Mo(CK),CQ=/*#__PURE__*/$.forwardRef(({className:e,...t},n)=>/*#__PURE__*/r(C$,{ref:n,"data-slot":"checkbox",className:iX("peer inline-flex size-4 shrink-0 items-center justify-center rounded-[var(--radius-micro)] border border-border bg-background text-primary shadow-xs transition-colors outline-none","focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50","data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground","data-[state=indeterminate]:border-primary data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground",e),...t,children:/*#__PURE__*/r(Cj,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current",children:"indeterminate"===t.checked?/*#__PURE__*/r(CX,{className:"size-3.5"}):/*#__PURE__*/r(CV,{className:"size-3.5"})})}));CQ.displayName=C$.displayName;let CZ=e=>"checked"===e||"indeterminate"===e&&"indeterminate",CJ=({count:e,show:t,testId:r})=>t?/*#__PURE__*/n("span",{className:"shrink-0 tabular-nums text-[11px] font-normal text-muted-foreground","data-testid":r,children:["(",e,")"]}):null,C0=({source:e,type:t,leafKeysWithData:a,hiddenKeys:i,showCount:o,expanded:l,onToggleExpanded:s,onToggleNode:c})=>{let u=kO(a,i,t.leafKeys),d=`signal-tree-type-checkbox-${e.source}-${t.signalType}`,h=t.levels.length>0,p=h?void 0:t.color??kv[t.signalType].color;return /*#__PURE__*/n("div",{children:[/*#__PURE__*/n("div",{className:"group flex items-center gap-1.5 rounded-[var(--radius-control)] px-[var(--size-gap-base)] py-[calc(var(--size-gap-base)/2)] transition-colors hover:bg-accent/80","data-testid":`signal-tree-type-${e.source}-${t.signalType}`,children:[h?/*#__PURE__*/r("button",{type:"button","aria-label":l?"折叠信号类型":"展开信号类型",className:"flex size-4 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",onClick:s,children:l?/*#__PURE__*/r(CC,{className:"size-3.5"}):/*#__PURE__*/r(Cz,{className:"size-3.5"})}):/*#__PURE__*/r("span",{"aria-hidden":"true",className:"size-4 shrink-0"}),/*#__PURE__*/n("label",{htmlFor:d,className:iX("flex min-w-0 flex-1 items-center gap-1.5","disabled"===u?"cursor-not-allowed":"cursor-pointer"),children:[/*#__PURE__*/r(CQ,{id:d,"aria-label":`${e.label} ${t.label}`,checked:CZ(u),disabled:"disabled"===u,onCheckedChange:()=>c(t.leafKeys)}),/*#__PURE__*/r("span",{className:iX("min-w-0 truncate text-xs font-medium","disabled"===u?"text-muted-foreground":"text-foreground/90"),"data-testid":`signal-tree-type-color-${e.source}-${t.signalType}`,style:"disabled"===u||null==p?void 0:{color:oi(p)},children:t.label}),/*#__PURE__*/r(CJ,{count:t.count,show:o,testId:`signal-tree-type-count-${e.source}-${t.signalType}`})]})]}),l&&h?/*#__PURE__*/r("div",{className:"relative ml-6 border-l border-border/60 pl-1",children:t.levels.map(n=>/*#__PURE__*/r(C1,{source:e.source,signalType:t.signalType,level:n,leafKeysWithData:a,hiddenKeys:i,showCount:o,onToggleNode:c},n.leafKey))}):null]},t.signalType)},C1=({source:e,signalType:t,level:a,leafKeysWithData:i,hiddenKeys:o,showCount:l,onToggleNode:s})=>{let c=kO(i,o,[a.leafKey]),u=`signal-tree-level-checkbox-${e}-${t}-${a.level}`;return /*#__PURE__*/r("div",{className:"group flex items-center gap-1.5 rounded-[var(--radius-control)] px-[var(--size-gap-base)] py-[calc(var(--size-gap-base)/2)] transition-colors hover:bg-accent/80","data-testid":`signal-tree-level-${e}-${t}-${a.level}`,children:/*#__PURE__*/n("label",{htmlFor:u,className:iX("flex min-w-0 flex-1 items-center gap-1.5","disabled"===c?"cursor-not-allowed":"cursor-pointer"),children:[/*#__PURE__*/r(CQ,{id:u,"aria-label":`${t} ${a.label}`,checked:CZ(c),disabled:"disabled"===c,onCheckedChange:()=>s([a.leafKey])}),/*#__PURE__*/r("span",{className:iX("text-xs font-medium","disabled"===c?"text-muted-foreground":"text-foreground/80"),"data-testid":`signal-tree-level-color-${e}-${t}-${a.level}`,style:"disabled"===c?void 0:{color:oi(a.color??kD[a.level].color)},children:a.label}),/*#__PURE__*/r(CJ,{count:a.count,show:l,testId:`signal-tree-level-count-${e}-${t}-${a.level}`})]})})},C2=({tree:e,leafKeysWithData:t,hiddenKeys:a,showCount:i,onToggleNode:o})=>{let[l,s]=b(()=>new Set),[c,d]=b(()=>new Set),h=u(e=>{s(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},[]),p=u(e=>{d(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},[]);return /*#__PURE__*/r(g6,{viewportClassName:"h-auto max-h-[var(--radix-dropdown-menu-content-available-height)]",children:/*#__PURE__*/r("div",{className:"p-[calc(var(--size-gap-base)/2)]",children:e.sources.map((e,s)=>{let u=kO(t,a,e.leafKeys),d=`signal-tree-source-checkbox-${e.source}`;return /*#__PURE__*/n("div",{className:iX(s>0&&"mt-[calc(var(--size-gap-base)/2)] border-t border-border/60 pt-[calc(var(--size-gap-base)/2)]"),"data-testid":`signal-tree-source-${e.source}`,children:[/*#__PURE__*/n("div",{className:"flex items-center gap-1.5 rounded-[var(--radius-control)] px-[var(--size-gap-base)] py-[calc(var(--size-gap-base)/2)] transition-colors hover:bg-accent/80","data-testid":`signal-tree-source-row-${e.source}`,children:[e.types.length>0?/*#__PURE__*/r("button",{type:"button","aria-label":c.has(e.source)?"展开数据来源":"折叠数据来源",className:"flex size-4 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",onClick:()=>p(e.source),children:c.has(e.source)?/*#__PURE__*/r(Cz,{className:"size-3.5"}):/*#__PURE__*/r(CC,{className:"size-3.5"})}):/*#__PURE__*/r("span",{"aria-hidden":"true",className:"size-4 shrink-0"}),/*#__PURE__*/n("label",{htmlFor:d,className:iX("flex min-w-0 flex-1 items-center gap-1.5","disabled"===u?"cursor-not-allowed":"cursor-pointer"),children:[/*#__PURE__*/r(CQ,{id:d,"aria-label":`${e.label}筛选`,checked:CZ(u),disabled:"disabled"===u,onCheckedChange:()=>o(e.leafKeys)}),/*#__PURE__*/r("span",{className:"text-xs font-medium text-foreground",children:e.label}),/*#__PURE__*/r(CJ,{count:e.count,show:i,testId:`signal-tree-source-count-${e.source}`})]})]}),c.has(e.source)?null:/*#__PURE__*/r("div",{className:"ml-4 divide-y divide-border/40 border-l border-border/60 pl-1",children:e.types.map(n=>/*#__PURE__*/r(C0,{source:e,type:n,leafKeysWithData:t,hiddenKeys:a,showCount:i,expanded:!l.has(`${e.source}:${n.signalType}`),onToggleExpanded:()=>h(`${e.source}:${n.signalType}`),onToggleNode:o},n.signalType))})]},e.source)})})})},C5=()=>{let{state:{signal:e},dispatch:t}=ae(),n=e.display,a=e.show,i=St({respectVisibility:!1,filterHidden:!1}),o=m(()=>kL(i),[i]),l=m(()=>new Set(o.sources.flatMap(e=>e.dataLeafKeys)),[o]),s=m(()=>new Set(e.hiddenCategoryKeys??[]),[e.hiddenCategoryKeys]),c=(e.hiddenCategoryKeys?.length??0)>0,d=u(r=>{t({payload:{signal:{...e,display:r}}})},[e,t]),h=u(r=>{let n=kq(e.hiddenCategoryKeys??[],r,l);t({payload:{signal:{...e,hiddenCategoryKeys:n}}})},[e,l,t]);return a?/*#__PURE__*/r(vE,{leading:/*#__PURE__*/r(vT,{active:n,tone:"primary",onClick:()=>{d(!n)},title:`全部信号标注:${n?"显示":"隐藏"}`,children:/*#__PURE__*/r("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",children:/*#__PURE__*/r("path",{fill:"currentColor",d:"M563.072 376.48a79.456 79.456 0 0 0 28.928-61.12 80 80 0 1 0-160 0c0 24.672 11.392 46.432 28.928 61.12l-202.88 540.256a32 32 0 1 0 59.904 22.496l49.28-131.264h289.504l49.28 131.264a32.064 32.064 0 0 0 41.248 18.752c16.544-6.208 24.896-24.672 18.72-41.216l-202.912-540.288z m-1.312 178.624h-99.552L512 422.56l49.76 132.544z m-170.464 188.896l46.912-124.896h147.616l46.912 124.896h-241.44zM662.464 417.408a32 32 0 1 0 53.12 35.648 254.72 254.72 0 0 0 43.136-142.304 255.04 255.04 0 0 0-43.136-142.304 32 32 0 1 0-53.12 35.68 190.944 190.944 0 0 1 32.288 106.624 190.816 190.816 0 0 1-32.288 106.656zM289.888 453.024a32 32 0 1 0 53.184-35.616 191.36 191.36 0 0 1-32.32-106.656 191.328 191.328 0 0 1 32.32-106.656 32.064 32.064 0 0 0-8.768-44.416 32.096 32.096 0 0 0-44.416 8.768 254.976 254.976 0 0 0-43.136 142.304 254.976 254.976 0 0 0 43.136 142.272zM210.656 117.12A32 32 0 1 0 157.44 81.536a420.032 420.032 0 0 0-70.848 233.824 419.744 419.744 0 0 0 70.88 233.856 31.936 31.936 0 0 0 44.416 8.768 32 32 0 0 0 8.768-44.416 355.168 355.168 0 0 1-60.032-198.24A355.36 355.36 0 0 1 210.656 117.12zM896.224 154.304a416.96 416.96 0 0 0-38.912-72.768 32 32 0 1 0-53.184 35.584 354.912 354.912 0 0 1 60.064 198.24 355.2 355.2 0 0 1-60.064 198.208 32.032 32.032 0 0 0 53.184 35.648 418.816 418.816 0 0 0 70.88-233.856c0-55.68-10.752-109.856-31.968-161.056z"})})}),value:null,options:[],triggerTitle:`筛选信号标注类别${c?"(已应用筛选)":""}`,triggerTestId:"signal-tree-trigger",triggerContent:/*#__PURE__*/r("span",{className:"sr-only",children:c?"信号标注类别筛选(已应用)":"信号标注类别筛选"}),customContent:/*#__PURE__*/r("div",{"data-testid":"signal-tree-popover",children:/*#__PURE__*/r(C2,{tree:o,leafKeysWithData:l,hiddenKeys:s,showCount:!1!==e.showCount,onToggleNode:h})}),contentClassName:"w-max max-w-[calc(100vw-1rem)] p-0",triggerClassName:iX("justify-center [&>span:last-child]:ml-0",c&&"bg-accent/72 shadow-[inset_0_0_0_1px_var(--mix-primary-28)] [&>span:last-child]:text-primary")}):null},C4=C5,C3=[{component:yL,toolType:rs.AutorangingSwitch,supportedCharts:[],excludedCharts:[rt.Heatmap,rt.ScanDF360,rt.LevelStream,rt.LiteNormalized]},{component:yB,toolType:rs.UnitSwitch,supportedCharts:[],excludedCharts:[rt.ScanDF360,rt.LevelStream]},{component:v$,toolType:rs.GradientRibbon,supportedCharts:[rt.Heatmap]},{component:v_,toolType:rs.SpacerLine,supportedCharts:[],excludedCharts:[rt.ScanDF360,rt.LevelStream]},{component:Fq,toolType:rs.Reset,supportedCharts:[],excludedCharts:[rt.LiteNormalized]},{component:C5,toolType:rs.StationAllocationSwitch,supportedCharts:[rt.SingleFrequency,rt.Scan,rt.MScan,rt.DDC]},{component:FH,toolType:rs.SeriesControl,supportedCharts:[rt.SingleFrequency,rt.Scan,rt.MScan],props:{type:"dynamic"}},{component:F8,toolType:rs.FrequencyAllocationSwitch,supportedCharts:[rt.SingleFrequency,rt.Scan,rt.MScan,rt.LiteNormalized]},{component:FY,toolType:rs.ZoomSwitch,supportedCharts:[rt.SingleFrequency,rt.Scan,rt.MScan,rt.LiteNormalized]},{component:Ce,toolType:rs.LimitSwitch,supportedCharts:[rt.SingleFrequency,rt.Scan,rt.MScan]},{component:CS,toolType:rs.MarkersSwitch,supportedCharts:[rt.SingleFrequency,rt.Scan,rt.MScan]},{component:F_,toolType:rs.SegmentsDisplayControl,supportedCharts:[rt.Scan]},{component:FJ,toolType:rs.HeatmapCaptureSwitch,supportedCharts:[rt.Heatmap]},{component:F4,toolType:rs.TimeRangeSwitch,supportedCharts:[rt.Heatmap]},{component:FW,toolType:rs.SeriesDisplayControl,supportedCharts:[rt.SingleFrequency,rt.Scan,rt.LiteNormalized,rt.MScan]},{component:FX,toolType:rs.FluorescenceSwitch,supportedCharts:[rt.SingleFrequency]},{component:F3,toolType:rs.DeltaMeasurementSwitch,supportedCharts:[rt.SingleFrequency,rt.Scan]}],C6=(e,t,r=[])=>!new Set(r).has(e.toolType)&&(e.supportedCharts.length>0?!!t&&e.supportedCharts.includes(t):!e.excludedCharts||!(e.excludedCharts.length>0)||!t||!e.excludedCharts.includes(t)),C8=(e,t)=>e.props?"dynamic"===e.props.type?{...e.props,type:t}:e.props:{},C9=({type:e})=>{let t=at(e=>e.toolbar.show),n=at(e=>e.toolbar.hiddenTools??[]),{width:a,pluginBoxWidth:i}=yn(),o=m(()=>({marginLeft:a,width:i,...o_}),[a,i]),l=m(()=>C3.filter(t=>C6(t,e,n)).map(t=>/*#__PURE__*/r(t.component,{...C8(t,e)},t.toolType)),[n,e]);return e!==rt.Occupancy&&t?/*#__PURE__*/r("div",{className:"relative flex h-10 min-w-0 w-full items-center justify-between pl-[var(--size-gap-base)] text-xs text-foreground",style:o,children:/*#__PURE__*/r("div",{className:"min-w-0 flex-1 overflow-x-auto overflow-y-hidden",children:/*#__PURE__*/r("div",{className:"flex h-full w-max min-w-full items-center gap-[var(--size-gap-base)]",children:l})})}):null},C7=/*#__PURE__*/c(C9);function De(){let{state:{globalID:e,axisY:t,levelStream:r}}=ae(),n=t.range??ns,{cacheTime:a=2e4,granularity:i=1,maxPoints:o=500}=r??{},l=g(null),s=g(e),c=u(e=>{((e,t,r="0")=>tI(e,t,void 0,r))(s.current,rr.Spectrum)({pstype:rn.Render,data:{[t3]:e.spectrumData}}),((e,t,r="0")=>tI(e,t,void 0,r))(s.current,rr.LevelStream)({pstype:rn.Render,data:e.probabilityRangeData})},[]),d=u(e=>{let{probabilityRangeData:t,spectrumData:r}=e;tO(s.current).getAllRawData=t=>({...tL().getAllRawData(t),levelStreamData:e}),c({probabilityRangeData:t,spectrumData:r})},[c]);if(h(()=>{s.current=e},[e]),!l.current&&e){l.current=new P({range:n,cacheTime:a,granularity:i,maxPoints:o,onLevelStreamUpdate:d});let{line:t}=t0("levelStream");((e,t,r="0")=>tI(e,t,void 0,r))(e,rr.Spectrum)({pstype:rn.Series,name:t3,color:t})}return h(()=>{l.current?.setConfig({range:n})},[n]),h(()=>{l.current?.setConfig({cacheTime:a})},[a]),h(()=>{l.current?.setConfig({granularity:i})},[i]),h(()=>{l.current?.setConfig({onLevelStreamUpdate:d})},[d]),{analyzer:l.current,updateLevelStreamData:c}}class Dt extends of{constructor(e){super({id:e.id,chart:null,orientation:e.orientation??z.Vertical})}init(){let{id:e,orientation:t}=this.state,r=[...t2()].reverse().map(e=>E(e));this.state.chart=new N({id:e,series:[{name:"bar",type:M.Bar,display:!0,color:t0("bar"),orientation:t}],range:[0,100],barValue2Color:!0,colors:r})}updateSeries(e){this.state.chart?.render({name:"bar",data:e})}}let Dr=e=>{let{opacity:t}=e,{chart:n,Chart:a}=iV({Render:Dt,params:{orientation:z.Horizontal}});return i3({moduleType:rr.LevelStream,chart:n,extractData:e=>e.data}),/*#__PURE__*/r(a,{style:m(()=>({opacity:t,zIndex:1}),[t])})},Dn=Dr,Da=(e,t)=>{!0===t.batch?e.processBatch(t.data,t.timestamps):e.process(t.data,rK(t.timestamp))},Di=6,Do=4,Dl=8,Ds=({axisLineWidth:e,inside:t,width:r})=>t?{axisX:e,majorTickEndX:6,majorTickStartX:0,minorTickEndX:4,minorTickStartX:0,textAlign:"left",textX:8}:{axisX:r-e,majorTickEndX:r,majorTickStartX:r-6,minorTickEndX:r,minorTickStartX:r-4,textAlign:"right",textX:r-8},Dc=.5,Du=2,Dd=4,Dh=100,Dp=1,Df=.5,Dm=.5;function Dg(e){let{ranging:t}=e,{range:r,disabled:n,placement:a,show:i}=at(e=>e.axisY),o="inside"===a,l=g(null),s=g(null),[c,d]=b(0),[p,f]=b(window.devicePixelRatio||1),[v,y]=b(!1),[w,x]=b(0),k=u((e,t)=>{let r=.5*(Math.max(1,Math.round(t*p))%2!=0);return(Math.round(e*p-r)+r)/p},[p]),S=u((e,t,r)=>{let n=r/2;return Math.min(t-n,Math.max(n,e))},[]),M=m(()=>{let[e,t]=r;return{min:e,max:t}},[r]);h(()=>{let e=window.matchMedia(`(resolution: ${p}dppx)`),t=()=>f(window.devicePixelRatio||1);return e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[p]),h(()=>{let e=s.current;if(!e)return;let t=new ResizeObserver(e=>{let t=e[0];t&&d(t.contentRect.height)});return t.observe(e),()=>t.disconnect()},[i]);let F=u((e,t)=>{if(t.useScientific)return e.toExponential(1);if(t.useKFormat){let r=e/1e3;return t.useDecimals?`${r.toFixed(1)}k`:`${Math.round(r)}k`}return t.useDecimals?e.toFixed(1):Math.round(e).toString()},[]),C=m(()=>{if(0===c)return{majorTicks:[],minorTicks:[]};let e=M.max-M.min,{interval:t,majorTickValues:r}=Fv([M.min,M.max]);if(!t||0===r.length)return{majorTicks:[],minorTicks:[]};let n=r.some(e=>Math.abs(e)>=1e3),a=r.some(e=>.01>Math.abs(e)&&0!==e),i={useScientific:a,useKFormat:n&&!a,useDecimals:r.some(e=>e%1!=0)},o=[];for(let t of r){let r=(M.max-t)/e*c,n=r,a=!0,l=!1,s=c-6,u=.3*c;r<-u||r>c+u?a=!1:r<6?(n=6,l=!0):r>s&&(n=s,l=!0),a&&o.push({value:t,position:r,textPosition:n,label:F(t,i),isAdjusted:l})}let l=[],s=t/2,u=s/e*c,d=e<1;if(u>=(d?8:4)&&c>100&&!d){let r=Math.ceil(M.min/s)*s;for(let n=r;n<=M.max;n+=s){if(Math.abs(n%t)<.1*s)continue;let r=(M.max-n)/e*c;r>=0&&r<=c&&l.push({value:n,position:r,textPosition:r,label:""})}}return{majorTicks:o,minorTicks:l}},[M,c,F]),D=u(()=>{let e=l.current;if(!e||0===c)return;let t=e.getContext("2d");if(!t)return;let r=e.getBoundingClientRect().width,n=Ds({axisLineWidth:.5,inside:o,width:r});e.width=r*p,e.height=c*p,e.style.width=`${r}px`,e.style.height=`${c}px`,t.setTransform(p,0,0,p,0,0),t.imageSmoothingEnabled=!0,t.imageSmoothingQuality="high",t.clearRect(0,0,r,c),t.font="12px -apple-system, BlinkMacSystemFont, sans-serif",t.textAlign=n.textAlign,t.textBaseline="middle",t.lineWidth=Dp;let a=ol("--foreground",.5,s.current);C.majorTicks.forEach(e=>{t.fillStyle=a,t.strokeStyle=a,t.fillText(e.label,n.textX,e.textPosition),t.beginPath();let r=k(S(e.position,c,Dp),Dp);t.moveTo(n.majorTickStartX,r),t.lineTo(n.majorTickEndX,r),t.stroke()}),t.strokeStyle=a,t.lineWidth=.5,C.minorTicks.forEach(e=>{t.beginPath();let r=k(S(e.position,c,.5),.5);t.moveTo(n.minorTickStartX,r),t.lineTo(n.minorTickEndX,r),t.stroke()}),t.strokeStyle=a,t.lineWidth=.5,t.beginPath();let i=k(n.axisX,.5);t.moveTo(i,0),t.lineTo(i,c),t.stroke()},[C,c,p,o,k,S]);h(()=>{!1!==i&&D()},[D,i]),h(()=>oh(()=>{D()}),[D]);let z=u(e=>{n||(y(!0),x(e.clientY))},[n]),N=u(e=>{n||t.moveWheel?.(e)},[t,n]),E=u(e=>{if(n||!v||!s.current)return;let r=(e.clientY-w)/s.current.offsetHeight;Math.abs(r)>(M.max-M.min<1?.005:.01)&&(t.move?.(r),x(e.clientY))},[n,v,w,t,M]);return{canvasRef:l,containerRef:s,isDragging:v,range:M,handleMouseDown:z,handleMouseMove:E,handleMouseUp:u(()=>{n||y(!1)},[n]),handleMouseLeave:u(()=>{n||y(!1)},[n]),handleWheel:N,ticksData:C}}function Db(e){let{chart:t}=e,{state:{axisY:n,globalID:a}}=ae(),{show:i}=n,o=nY({chart:t}),{axisYWidth:l,inside:s,marginLeft:c}=yn(),{canvasRef:u,containerRef:d,isDragging:h,handleMouseDown:p,handleMouseMove:f,handleMouseUp:m,handleMouseLeave:g,handleWheel:b}=Dg({ranging:o});return!1===i?null:/*#__PURE__*/r("div",{ref:d,className:iX("h-full select-none",s?"absolute left-0 top-0 z-[7]":"relative",h?"cursor-grabbing":"cursor-ns-resize"),style:{width:l,marginLeft:c},onMouseDown:p,onMouseMove:f,onMouseUp:m,onMouseLeave:g,onWheel:b,onDoubleClick:()=>{let{realRange:e}=nA({range:n.defaultRange??ns,unit:n.unit,step:n.step,globalID:a}),t=yR(n.restrict,e);o.setAxisY?.({realRange:t}),o.onChange?.()},children:/*#__PURE__*/r("canvas",{ref:u,className:"pointer-events-none absolute left-0 top-0 h-full w-full"})})}let Dv=(e,t,r)=>{let[n,a]=r;return e<=0||t.end<t.start||!Number.isFinite(n)||!Number.isFinite(a)||a<=n?null:{x:[100*t.start/e,(t.end+1)*100/e],y:[n,a]}},Dy=(e,t)=>{let r=t.x[1]-t.x[0],n=t.y[1]-t.y[0],a=e=>Math.max(0,Math.min(100,t.x[0]+e*r/100));return{x:[a(e.leftPosition),a(e.leftPosition+e.width)],y:[t.y[1]-(e.position+e.height)*n/100,t.y[1]-e.position*n/100]}},Dw=(e,t)=>{let r=t.x[1]-t.x[0],n=t.y[1]-t.y[0];return{leftPosition:(e.x[0]-t.x[0])*100/r,width:(e.x[1]-e.x[0])*100/r,position:(t.y[1]-e.y[1])*100/n,height:(e.y[1]-e.y[0])*100/n}},Dx=(e,t)=>{let r=t.x[1]-t.x[0];return{left:-(100*t.x[0])/r,right:(100-t.x[0])*100/r,top:Math.min(0,100-e.height,e.position),bottom:Math.max(100,e.height,e.position+e.height)}},Dk=(e,t,r=0)=>{let n=t(e.x[0]),a=t(e.x[1]),i=Number(n),o=Number(a);return n&&a&&Number.isFinite(i)&&Number.isFinite(o)?{deltaX:Math.abs(o-i),deltaY:Math.abs(e.y[1]-e.y[0]),centerFrequency:(i+o)/2,startFrequency:i,endFrequency:o,startAmplitude:e.y[0]+r,endAmplitude:e.y[1]+r}:null},DS=1e-9,DM=(e,t,r,n,a)=>{for(let i=n;i<=a;i+=1)if(r(e,i)!==r(t,i))return i;return a},DF={position:40,height:20,leftPosition:40,width:20},DC=()=>{let{state:{deltaMeasurement:{show:e,display:t,onChange:a},axisX:{frequencyFormat:i},axisY:{unit:o,range:l,renderRange:s},segments:c,zoom:{interval:d}}}=ae(),p=e&&t,[f,v]=b(null),y=g(null),w=g(a);w.current=a;let x=s??l??[-120,0],k=(l?.[0]??x[0])-x[0],S=m(()=>Dv(c.totalPoints??0,d,x),[c.totalPoints,d.start,d.end,x[0],x[1]]),M=m(()=>f&&S?Dw(f,S):null,[f,S]),F=m(()=>f&&i&&c.length?Dk(f,i,k):null,[f,i,c,k]);h(()=>{p&&S&&v(e=>e??Dy(DF,S))},[p,S]),h(()=>{p||(y.current=null,v(null),w.current?.(null))},[p]);let C=u(e=>{let t=y.current??S;t&&v(Dy(e,t))},[S]),D=u(e=>{let t=y.current??S;if(y.current=null,!t||!i||!c.length)return;let r=Dy(e,t);v(r);let n=Dk(r,i,k);n&&a?.(n)},[S,i,c,k,a]),z=(e,t=3)=>rD(e,t).formatted,N=(e,t=2)=>{let r=Number.parseFloat(e.toFixed(t));return`${r} ${o}`},E=m(()=>{if(!F)return{labels:void 0,middleContent:null};let e=F.deltaX<=1e-9,t=F.deltaY<=1e-9,a=e?3:DM(F.startFrequency,F.endFrequency,z,3,6),i=t?2:DM(F.startAmplitude,F.endAmplitude,N,2,4),l=z(F.startFrequency,a),s=z(F.endFrequency,a),c=N(F.endAmplitude,i),u=N(F.startAmplitude,i),d=z(F.deltaX,a),h=`${Number.parseFloat(F.deltaY.toFixed(i))} ${o}`,p=z(F.centerFrequency,a);return{labels:{left:e?void 0:l,right:e?void 0:s,top:t?void 0:c,bottom:t?void 0:u},middleContent:/*#__PURE__*/n("div",{className:"grid gap-0.5",children:[/*#__PURE__*/r("div",{children:e?`频点: ${l}`:`ΔX: ${d}`}),/*#__PURE__*/r("div",{children:t?`幅度: ${u}`:`ΔY: ${h}`}),!e&&/*#__PURE__*/n("div",{children:["中心: ",p]})]})}},[F,o]);if(!M||!S)return null;let T=y.current??S,R=f?Dw(f,T):M;return /*#__PURE__*/r(ME,{enabled:p,defaultRect:M,minSize:0,minWidth:0,minHeight:0,variant:"projected",interactionBounds:Dx(R,T),onDragStart:()=>{y.current=S},onChange:C,onDragEnd:D,zIndex:7,labels:E.labels,children:E.middleContent})},DD=DC,Dz=({frequencyLeft:e,segments:t})=>ry(t)(e),DN=({e,zoom:t,segments:r,onChange:n,globalID:a})=>{let{realData:i}=tO(a).getAllRawData();if(!i)return;let o=i.length,{interval:{start:l,end:s}}=t,{left:c}=e,u=e.left+e.width,d=w_({coord:e,segments:r,zoom:t}),h=w_({coord:{left:u},segments:r,zoom:t}),p=Math.max(0,Math.ceil(o*d/100)-1),f=Math.ceil(o*h/100),{maxIndex:m}=tU(Array.from(i.slice(p,f)));n({frequency:(({frequencyLeft:e,segments:t})=>ry(t)(e))({frequencyLeft:(l+(p+m+1)/o*(s-l))*100/r.totalPoints,segments:r}),bandwidth:Math.round(1e3*rk({segments:r,endLeft:u,startLeft:c})),left:d,right:h})},DE=rl.DragFrame,DT=({id:e})=>{let{state:{zoom:a,segments:i,signalAnalysis:o,globalID:l},dispatch:s}=ae(),[c,d]=b(null),p=u((e,t=!1)=>{o.show&&o.display&&t?DN({e,zoom:a,segments:i,onChange:o.onChange,globalID:l}):s({payload:{zoom:{...a,interval:e.interval,isScanSegmentsUpdateMagnify:e.isScanSegmentsUpdateMagnify}}})},[o,a,i,l]),f=u((e,t,r,n)=>{if(e&&t&&n){let r=e.left,n=t.left,a=n-r;d({diffX:a,left:a>0?r:n,width:Math.abs(a),isScanSegmentsUpdateMagnify:a>0})}},[]),m=u(()=>{if(!c)return;let{left:e,width:t,isScanSegmentsUpdateMagnify:r,diffX:n}=c,{totalPoints:a}=i;if(r&&n>0){let n=SO({startPercent:e,endPercent:e+t,totalPoints:a}),i=n?n.end-n.start+1:0;n&&i>tV.ZOOM_MIN_RANGE&&p({interval:n,isScanSegmentsUpdateMagnify:r,left:e,width:t},!0)}n<0&&p({interval:{start:0,end:a-1},isScanSegmentsUpdateMagnify:r,left:e,width:t})},[c,i,a.interval.end,p]);return(h(()=>{if(a.show){let t=()=>{d(null),xt(e,DE)};wU(e,DE,t),wK(e,DE,()=>{m(),t()}),wV(e,DE,t),wJ(e,DE,(...t)=>{w7(e,DE)&&f(t[0],t[1],t[2],t[3])})}},[a.show,e,m,f]),h(()=>{c||xt(e,DE)},[c,e]),a.show)?/*#__PURE__*/r(yi,{className:"z-[3]",children:/*#__PURE__*/r("div",{className:"absolute left-[-100%] top-0 h-full w-0 box-border border-2 border-dashed border-chart-grid-strong bg-chart-surface opacity-40",style:c?{left:`${c.left}%`,width:`${c.width}%`}:{},children:c&&!c.isScanSegmentsUpdateMagnify&&/*#__PURE__*/n(t,{children:[/*#__PURE__*/r("div",{className:"pointer-events-none absolute inset-0 opacity-20",style:{background:"linear-gradient(to top right, transparent, transparent calc(50% - 1px), var(--chart-grid-strong), transparent calc(50% + 1px), transparent)"}}),/*#__PURE__*/r("div",{className:"pointer-events-none absolute inset-0 opacity-20",style:{background:"linear-gradient(to bottom right, transparent, transparent calc(50% - 1px), var(--chart-grid-strong), transparent calc(50% + 1px), transparent)"}})]})})}):null},DR=/*#__PURE__*/c(DT),DA=14,DI=5,DP=4,DL=({density:e="auto",channelCount:t})=>{let r="compact"===e||"auto"===e&&t>4;return{compact:r,laneHeight:r?5:14,showLabels:!r}},DO=null,Dq=["#B22222","#CD5C5C","#FF6347","#FA8072","#F08080","#A0522D","#FF4500","#FF7F50","#B8860B","#FFA500","#808000","#9ACD32","#32CD32","#8FBC8F","#2E8B57","#3CB371","#00FA9A","#66CDAA","#7FFFD4","#2F4F4F","#008080","#00CED1","#20B2AA","#48D1CC","#4682B4","#778899","#87CEFA","#4169E1","#4169E1","#6495ED","#483D8B","#6A5ACD","#7B68EE","#9370DB","#9370DB","#9932CC","#8A2BE2","#BA55D3","#800080","#DDA0DD","#C71585","#DC143C"];function D$(e){let t=parseInt(e.slice(1,3),16)/255,r=parseInt(e.slice(3,5),16)/255,n=parseInt(e.slice(5,7),16)/255,a=Math.max(t,r,n),i=Math.min(t,r,n),o=0,l=0,s=(a+i)/2;if(a!==i){let e=a-i;switch(l=s>.5?e/(2-a-i):e/(a+i),a){case t:o=(r-n)/e+6*(r<n);break;case r:o=(n-t)/e+2;break;case n:o=(t-r)/e+4}o/=6}return{h:360*o,s:100*l,l:100*s}}let D_=[...Dq].map(e=>({color:e,hsl:D$(e)})).sort((e,t)=>Math.abs(e.hsl.h-t.hsl.h)>10?e.hsl.h-t.hsl.h:e.hsl.l-t.hsl.l).map(e=>e.color);function Dj(e){let t=[...e].sort((e,t)=>Number(e.startFrequency)-Number(t.startFrequency));return t.map((e,r)=>{let n=t.length,a=D_.length,i=Math.floor(r/n*a),o=Math.floor((r+1)/n*a),l=D_[Math.min(i,a-1)],s=D_[Math.min(o,a-1)],c=r===n-1?D_[a-1]:s;return{...e,color:l,gradientColors:[l,c]}})}let DH=[{startFrequency:87,stopFrequency:108,stepFrequency:100,bandwidth:150,modulation:"AM",demodulation:"不解调",status:"合法",title:"FM广播",description:"FM调频广播频段,用于音频广播服务"},{startFrequency:108,stopFrequency:118,stepFrequency:50,bandwidth:100,modulation:"FM",demodulation:"解调",status:"合法",title:"航空导航",description:"航空无线电导航频段,用于仪表着陆系统等"},{startFrequency:118,stopFrequency:137,stepFrequency:25,bandwidth:50,modulation:"AM",demodulation:"解调",status:"合法",title:"航空语音通信",description:"民用航空语音通信频段"},{startFrequency:121,stopFrequency:122,stepFrequency:25,bandwidth:50,modulation:"FM",demodulation:"解调",status:"合法",title:"紧急通信",description:"紧急情况通信专用频段"},{startFrequency:136,stopFrequency:174,stepFrequency:25,bandwidth:50,modulation:"FM",demodulation:"解调",status:"合法",title:"对讲通信",description:"专业无线对讲通信频段"},{startFrequency:161,stopFrequency:162,stepFrequency:25,bandwidth:50,modulation:"GMSK",demodulation:"解调",status:"合法",title:"AIS船舶通信",description:"船舶自动识别系统(AIS)专用频段"},{startFrequency:351,stopFrequency:400,stepFrequency:25,bandwidth:50,modulation:"FM",demodulation:"解调",status:"合法",title:"集群通信",description:"专业集群通信系统频段"},{startFrequency:400,stopFrequency:470,stepFrequency:25,bandwidth:50,modulation:"FM",demodulation:"解调",status:"合法",title:"专业对讲",description:"专业无线对讲通信频段"},{startFrequency:534,stopFrequency:542,stepFrequency:100,bandwidth:8e3,modulation:"OFDM",demodulation:"解调",status:"合法",title:"数字电视",description:"数字电视广播频段"},{startFrequency:622,stopFrequency:630,stepFrequency:100,bandwidth:8e3,modulation:"OFDM",demodulation:"解调",status:"合法",title:"数字电视",description:"数字电视广播频段"},{startFrequency:703,stopFrequency:733,stepFrequency:100,bandwidth:3e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"5G上行(广电/移动)",description:"广电和移动5G网络上行频段"},{startFrequency:758,stopFrequency:788,stepFrequency:100,bandwidth:3e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"5G下行(广电/移动)",description:"广电和移动5G网络下行频段"},{startFrequency:806,stopFrequency:821,stepFrequency:25,bandwidth:50,modulation:"π/4DQPSK",demodulation:"解调",status:"合法",title:"数字集群上行",description:"数字集群通信系统(TETRA)上行频段"},{startFrequency:824,stopFrequency:835,stepFrequency:100,bandwidth:5e3,modulation:"QPSK",demodulation:"解调",status:"合法",title:"电信3G/4G/5G上行",description:"中国电信3G/4G/5G网络上行频段"},{startFrequency:851,stopFrequency:866,stepFrequency:25,bandwidth:50,modulation:"π/4DQPSK",demodulation:"解调",status:"合法",title:"数字集群下行",description:"数字集群通信系统(TETRA)下行频段"},{startFrequency:869,stopFrequency:880,stepFrequency:100,bandwidth:5e3,modulation:"QPSK",demodulation:"解调",status:"合法",title:"电信3G/4G/5G下行",description:"中国电信3G/4G/5G网络下行频段"},{startFrequency:885,stopFrequency:889,stepFrequency:200,bandwidth:200,modulation:"GMSK",demodulation:"解调",status:"合法",title:"GSM-R上行",description:"铁路专用GSM-R网络上行频段"},{startFrequency:889,stopFrequency:904,stepFrequency:200,bandwidth:200,modulation:"GMSK",demodulation:"解调",status:"合法",title:"移动2G/4G上行",description:"中国移动2G/4G网络上行频段"},{startFrequency:904,stopFrequency:915,stepFrequency:200,bandwidth:200,modulation:"QPSK",demodulation:"解调",status:"合法",title:"联通2/3/4/5G上行",description:"中国联通2G/3G/4G/5G网络上行频段"},{startFrequency:930,stopFrequency:934,stepFrequency:200,bandwidth:200,modulation:"GMSK",demodulation:"解调",status:"合法",title:"GSM-R下行",description:"铁路专用GSM-R网络下行频段"},{startFrequency:934,stopFrequency:949,stepFrequency:200,bandwidth:200,modulation:"GMSK",demodulation:"解调",status:"合法",title:"移动2G/4G下行",description:"中国移动2G/4G网络下行频段"},{startFrequency:949,stopFrequency:960,stepFrequency:200,bandwidth:200,modulation:"QPSK",demodulation:"解调",status:"合法",title:"联通2/3/4/5G下行",description:"中国联通2G/3G/4G/5G网络下行频段"},{startFrequency:1164,stopFrequency:1189,stepFrequency:1e3,bandwidth:1e4,modulation:"BPSK",demodulation:"解调",status:"合法",title:"GPS L5频段",description:"全球定位系统GPS L5频段"},{startFrequency:1215,stopFrequency:1234,stepFrequency:1e3,bandwidth:1e4,modulation:"BPSK",demodulation:"解调",status:"合法",title:"GPS L2频段",description:"全球定位系统GPS L2频段"},{startFrequency:1447,stopFrequency:1467,stepFrequency:100,bandwidth:1e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"政务公安专网",description:"政务和公安专用LTE网络频段"},{startFrequency:1563,stopFrequency:1587,stepFrequency:1e3,bandwidth:1e4,modulation:"BPSK",demodulation:"解调",status:"合法",title:"GPS L1频段",description:"全球定位系统GPS L1频段"},{startFrequency:1710,stopFrequency:1735,stepFrequency:200,bandwidth:5e3,modulation:"QPSK",demodulation:"解调",status:"合法",title:"移动2G/4G上行",description:"中国移动2G/4G网络上行频段"},{startFrequency:1735,stopFrequency:1765,stepFrequency:200,bandwidth:5e3,modulation:"QPSK",demodulation:"解调",status:"合法",title:"联通2/4G上行",description:"中国联通2G/4G网络上行频段"},{startFrequency:1805,stopFrequency:1830,stepFrequency:200,bandwidth:5e3,modulation:"QPSK",demodulation:"解调",status:"合法",title:"移动2G/4G下行",description:"中国移动2G/4G网络下行频段"},{startFrequency:1830,stopFrequency:1860,stepFrequency:200,bandwidth:5e3,modulation:"QPSK",demodulation:"解调",status:"合法",title:"联通2/4G下行",description:"中国联通2G/4G网络下行频段"},{startFrequency:1885,stopFrequency:1915,stepFrequency:100,bandwidth:1e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"移动4G",description:"中国移动4G网络频段"},{startFrequency:1920,stopFrequency:1940,stepFrequency:100,bandwidth:1e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"电信/联通5G上行",description:"中国电信/联通5G网络上行频段"},{startFrequency:1940,stopFrequency:1965,stepFrequency:100,bandwidth:1e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"联通3/4/5G上行",description:"中国联通3G/4G/5G网络上行频段"},{startFrequency:2110,stopFrequency:2130,stepFrequency:100,bandwidth:1e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"电信/联通5G下行",description:"中国电信/联通5G网络下行频段"},{startFrequency:2300,stopFrequency:2320,stepFrequency:100,bandwidth:1e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"联通4G",description:"中国联通4G网络频段"},{startFrequency:2320,stopFrequency:2370,stepFrequency:100,bandwidth:1e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"移动4G",description:"中国移动4G网络频段"},{startFrequency:2400,stopFrequency:2500,stepFrequency:1,bandwidth:20,modulation:"OFDM",demodulation:"解调",status:"合法",title:"ISM 2.4GHz",description:"WIFI、蓝牙、无人机等使用频段"},{startFrequency:2515,stopFrequency:2675,stepFrequency:100,bandwidth:1e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"移动5G/4G",description:"中国移动5G和4G网络频段"},{startFrequency:3300,stopFrequency:3600,stepFrequency:100,bandwidth:1e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"5G频段",description:"电信、联通、广电5G网络频段"},{startFrequency:4800,stopFrequency:4900,stepFrequency:100,bandwidth:1e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"移动5G",description:"中国移动5G网络频段"},{startFrequency:4900,stopFrequency:4960,stepFrequency:100,bandwidth:1e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"广电5G",description:"中国广电5G网络频段"},{startFrequency:5725,stopFrequency:5875.5,stepFrequency:5,bandwidth:20,modulation:"OFDM",demodulation:"解调",status:"合法",title:"ISM 5GHz",description:"WIFI、无人机等使用频段"}],DB="rfkit-charts-frequency-allocation",DW=e=>!!e&&"object"==typeof e&&2===e.version&&Array.isArray(e.channels),DG=()=>{let e=localStorage.getItem(DB);if(!e)return null;let t=JSON.parse(e);return Array.isArray(t)||DW(t)?t:null},DY=()=>{let e=DG();return Array.isArray(e)?e:null},DU=()=>{let e=DG();return DW(e)?e.channels:null},DX=e=>{localStorage.setItem(DB,JSON.stringify(e))},DK=e=>{localStorage.setItem(DB,JSON.stringify({version:2,channels:e}))},DV=()=>{localStorage.removeItem(DB)},DQ=()=>null!==localStorage.getItem(DB),DZ="default",DJ=(e,t)=>e.id||e.title||`${DZ}-${t}`,D0=e=>e.id?`channel:id:${e.id}`:e.title?`channel:title:${e.title}`:"channel:anonymous",D1=(e,t,r)=>{let n=t.get(e)??0,a=0===n?e:`${e}#${n+1}`;for(;r.has(a);)n+=1,a=`${e}#${n+1}`;return t.set(e,n+1),r.add(a),a},D2=(e,t)=>{let r=new Map,n=new Set;return e.map((e,r)=>({id:DJ(e,r),renderKeyBase:D0(e),title:e.title,data:t(e.data??[])})).filter(e=>e.data.length>0).map(({renderKeyBase:e,...t})=>({...t,renderKey:D1(e,r,n)}))},D5=(e,t)=>[{id:DZ,renderKey:`channel:id:${DZ}`,data:t(e)}];function D4({data:e,channels:t,cachedData:r,cachedChannels:n,presetData:a,normalizeData:i}){if(t)return t.length?D2(t,i):D5(e?.length?e:a,i);if(n?.length)return D2(n,i);let o=e??[];return D5(r&&r.length>0?r:o.length>0?o:a,i)}function D3({data:e,channels:t}){return D4({data:e,channels:t,cachedData:DY(),cachedChannels:DU(),presetData:DH,normalizeData:Dj})}function D6(e){return D3({data:e})[0]?.data??[]}let D8=e=>{if(null!=e.startFrequency&&null!=e.stopFrequency){let t=rT({startFrequency:Number(e.startFrequency),stopFrequency:Number(e.stopFrequency)});if(t)return{start:t.startFreq,stop:t.stopFreq,type:"range"}}return null},D9=e=>JSON.stringify([e.title,e.startFrequency,e.stopFrequency,e.centerFrequency,e.bandwidth,e.stepFrequency,e.modulation,e.description,e.demodulation,e.status]),D7=e=>e.id?`band:id:${e.id}`:`band:fingerprint:${D9(e)}`,ze=(e,t,r)=>{let n=t.get(e)??0,a=0===n?e:`${e}#${n+1}`;for(;r.has(a);)n+=1,a=`${e}#${n+1}`;return t.set(e,n+1),r.add(a),a},zt=({segments:e,allocations:t,channelIndex:r,channelTitle:n})=>{if(!e.length||!t.length)return[];let a=e.reduce((e,t)=>e+t.point,0),i=new Map,o=new Set,l=t.map(e=>({band:e,renderKey:ze(D7(e),i,o)}));return e.map((t,i)=>{let o=l.map(({band:e,renderKey:a})=>{let i=D8(e);if(!i||i.stop<t.start||i.start>t.stop)return null;let{left:o,width:l}=rP({startFreq:i.start,stopFreq:i.stop},t);return{band:e,renderKey:a,range:i,channelIndex:r??0,channelTitle:n,position:{left:`${o}%`,width:`${l}%`}}}).filter(e=>null!==e),s=t.point/a*100,c=e.slice(0,i).reduce((e,t)=>e+t.point/a*100,0);return{segment:t,segmentIndex:i,bandPositions:o,style:{left:`${c}%`,width:`${s}%`}}})},zr=({segments:e,channels:t})=>t.map((t,r)=>({channel:t,channelIndex:r,segmentData:zt({segments:e,allocations:t.data,channelIndex:r,channelTitle:t.title})})).filter(e=>e.segmentData.some(e=>e.bandPositions.length>0)),zn=e=>e.map(e=>{let t=calculateFrequencyRange(null!=e.startFrequency&&null!=e.stopFrequency?{startFrequency:Number(e.startFrequency),stopFrequency:Number(e.stopFrequency)}:{frequency:null!=e.centerFrequency?Number(e.centerFrequency):void 0,bandwidth:null!=e.bandwidth?Number(e.bandwidth):void 0});return t?{item:e,range:t,width:Math.abs(t.stopFreq-t.startFreq),center:(t.startFreq+t.stopFreq)/2,title:String(e.title??"")}:null}).filter(e=>null!==e),za=({rangeIndex:e,frequency:t})=>{let r;if(Number.isFinite(t)&&e.length){for(let n of e){let{range:e}=n;if(t<e.startFreq||t>e.stopFreq)continue;if(!r){r=n;continue}let a=n.width-r.width;if(a<0){r=n;continue}if(a>0)continue;let i=Math.abs(n.center-t)-Math.abs(r.center-t);if(i<0){r=n;continue}!(i>0)&&0>n.title.localeCompare(r.title)&&(r=n)}return r?.item}},zi=({allocations:e,frequency:t})=>za({rangeIndex:zn(e),frequency:t});function zo(){let e=useSelector(e=>e.frequencyAllocation.data);return useMemo(()=>resolveFrequencyAllocationData(e),[e])}function zl(){let e=at(e=>e.frequencyAllocation.data),t=at(e=>e.frequencyAllocation.channels);return m(()=>D3({data:e,channels:t}),[e,t])}function zs({frequency:e,cursorSample:t}){let r=useSelector(e=>e.cursor),n=useSelector(e=>e.segments),a=useSelector(e=>e.frequencyAllocation.display),i=useSelector(e=>e.frequencyAllocation.show),o=t?.coord.left??r.coord.left,l=useFrequencyAllocationData(),s=useMemo(()=>createFrequencyAllocationRangeIndex(l),[l]),c=useMemo(()=>!!t||hasActiveSpectrumCursor(r),[r,t]),u=useMemo(()=>c&&"number"==typeof o?calculateCursorPosition(o,n):{segmentIndex:-1,pointIndex:-1},[c,o,n]);return useMemo(()=>{if(!i||!a||!e||!n?.length||!c||!n[u.segmentIndex])return;let t=getCursorFrequencyAtPosition(n,u),r=Number.isFinite(t)?t:Number(e);if(Number.isFinite(r))return findFrequencyAllocationInRangeIndex({rangeIndex:s,frequency:r})},[s,u.segmentIndex,a,e,c,n,i])}let zc=null,zu=({allocationInfo:e,variant:t="default"})=>{if(!e)return null;let{title:r,description:a,startFrequency:i,stopFrequency:o,bandwidth:l,modulation:s,channelTitle:c}=e;return /*#__PURE__*/n("div",{className:iX("text-xs leading-5 text-popover-foreground","board"===t&&"mt-[calc(var(--size-gap-base)/2)] border-t border-dashed border-border pt-[calc(var(--size-gap-base)/2)]"),children:[r?/*#__PURE__*/n("div",{className:"mb-1 font-bold",children:["业务类型:",r]}):null,/*#__PURE__*/n("div",{className:"mb-1 text-primary",children:[c?/*#__PURE__*/n("div",{children:["通道:",c]}):null,null!=i&&null!=o&&/*#__PURE__*/n("div",{children:["频率范围:",i," - ",o]}),null!=l&&""!==l?/*#__PURE__*/n("div",{children:["信号带宽:",l," kHz"]}):null,s?/*#__PURE__*/n("div",{children:["调制方式:",s]}):null]}),a?.trim()?/*#__PURE__*/n("div",{className:"whitespace-pre-line break-words leading-5 opacity-85",children:["备注信息:",a]}):null]})},zd=/*#__PURE__*/a.memo(zu),zh=/*#__PURE__*/c(({style:e,bandPositions:t,showLabels:n,onMouseEnter:a,onMouseMove:i,onMouseLeave:o})=>/*#__PURE__*/r("div",{className:"absolute top-0 h-full [contain:layout]",style:e,children:t.map(e=>{let{band:t,position:l,renderKey:s}=e;return /*#__PURE__*/r("div",{className:"pointer-events-auto absolute flex h-full items-center justify-center overflow-hidden px-1 text-xs text-foreground/90 opacity-60 backdrop-blur-sm transition-[opacity,box-shadow] duration-200 hover:z-[1] hover:opacity-100 hover:shadow-lg",style:{...t.gradientColors?{backgroundImage:`linear-gradient(to right, ${t.gradientColors[0]}, ${t.gradientColors[1]})`}:{backgroundColor:t.color||"var(--primary)"},left:l.left,width:l.width},onMouseEnter:a(e),onMouseMove:i,onMouseLeave:o,children:n?/*#__PURE__*/r("span",{className:"truncate",children:t.title}):null},s)})})),zp=zh,zf=({title:e,description:t,visible:n,x:a,y:i,startFrequency:o,stopFrequency:l,centerFrequency:s,stepFrequency:c,bandwidth:d,modulation:p,channelTitle:f,positionRef:m,scheduleRef:b})=>{let v=g(null),y=g(null),w=gi("tooltip"),x=u(()=>{if(!n||!v.current)return;let e=v.current,t=e.offsetWidth,r=e.offsetHeight,o=window.innerWidth,l=window.innerHeight,s=m.current??{x:a,y:i},c=s.x,u=s.y,d=Math.max(12,Math.min(c+t>o-12?c-t-10:c,o-t-12)),h=Math.max(12,Math.min(u+r>l-12?u-r-10:u,l-r-12));e.style.transform=`translate3d(${d}px, ${h}px, 0)`},[m,n,a,i]),k=u(()=>{n&&null===y.current&&(y.current=requestAnimationFrame(()=>{y.current=null,x()}))},[x,n]);return(h(()=>(b.current=k,()=>{b.current===k&&(b.current=null)}),[k,b]),h(()=>{if(n)return k(),()=>{null!==y.current&&(cancelAnimationFrame(y.current),y.current=null)}},[w,k,n]),n&&w)?/*#__PURE__*/R(/*#__PURE__*/r("div",{ref:v,"data-rfkit-frequency-allocation-tooltip":"true",className:"pointer-events-none fixed z-[1] max-w-[300px] rounded-[var(--radius-surface)] border border-border/70 bg-chart-panel/95 p-[var(--size-gap-base)] text-chart-panel-foreground shadow-lg backdrop-blur-md",style:{left:0,top:0,transform:`translate3d(${a}px, ${i}px, 0)`},children:/*#__PURE__*/r(zd,{allocationInfo:{title:e,description:t,startFrequency:o,stopFrequency:l,centerFrequency:s,stepFrequency:c,bandwidth:d,modulation:p,channelTitle:f}})}),w):null},zm=zf,zg=()=>{let e=at(e=>e.axisX.unit),t=at(e=>e.segments),a=at(e=>e.frequencyAllocation.display),i=at(e=>e.frequencyAllocation.show),o=at(e=>e.frequencyAllocation.density),l=at(e=>e.zoom.style),s=zl(),[c,d]=b({visible:!1,x:0,y:0}),h=g({x:0,y:0}),p=g(null),f=u(e=>{h.current={x:e.clientX+10,y:e.clientY+10},p.current?.()},[]),v=m(()=>zr({segments:t,channels:s}),[t,s]),{laneHeight:y,showLabels:w}=DL({density:o,channelCount:v.length}),x=Math.max(y,v.length*y),k=u(e=>{d(t=>({...t,...e}))},[]),S=u(({band:t,channelTitle:r,range:n})=>a=>{f(a);let i={...t,visible:!0,x:h.current.x,y:h.current.y,channelTitle:r,startFrequency:`${n.start}${e}`,stopFrequency:`${n.stop}${e}`};"centerBandwidth"===n.type&&null!=n.frequency&&null!=n.bandwidth&&(i.centerFrequency=`${n.frequency}${e}`),k(i)},[e,k,f]),M=u(e=>{f(e)},[f]),F=u(()=>{k({visible:!1})},[k]);return i&&a&&0!==v.length?/*#__PURE__*/n("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 z-[5] flex w-full select-none items-center overflow-hidden",style:{height:x,backgroundColor:"var(--mix-chart-surface-12)"},children:[/*#__PURE__*/r("div",{className:"absolute right-0 top-0 h-full w-full will-change-transform",style:l??void 0,children:v.map(({channel:e,channelIndex:t,segmentData:n})=>/*#__PURE__*/r("div",{className:"absolute left-0 w-full",style:{bottom:t*y,height:y},children:n.map(({segmentIndex:t,bandPositions:n,style:a})=>/*#__PURE__*/r(zh,{style:a,bandPositions:n,showLabels:w,onMouseEnter:S,onMouseMove:M,onMouseLeave:F},`${e.renderKey}-segment-${t}`))},e.renderKey))}),/*#__PURE__*/r(zf,{...c,positionRef:h,scheduleRef:p})]}):null},zb=zg,zv=e=>{let[t,r]=b(0);return h(()=>{if(!e)return;let t=tq(e,"FrequencyTagLineBoard",()=>{r(e=>e+1)});return()=>{t?.()}},[e]),t},zy=({id:e})=>{let{state:{frequencyTagLine:t,cursor:n}}=ae(),{show:a,display:i,left:o,onChange:l}=t,s=zv(e),c=n.show&&n.active&&n.event?.sourceType===rr.Spectrum,d=u(e=>{if(!e)return;let{index:t,frequency:r}=e;tY(r)&&l({index:t,frequency:r})},[l]);return a&&i&&!c?/*#__PURE__*/r("div",{className:"absolute bottom-5 right-[34px] z-[6] h-auto w-auto",children:/*#__PURE__*/r(Sh,{left:o,updateKey:s,onChange:d,showSignalInfo:!1})}):null},zw=/*#__PURE__*/a.memo(zy),zx=()=>{let{state:{frequencyTagLine:e},dispatch:t}=useStore(),{display:r,show:n}=e,a=useCallback(r=>{t({payload:{frequencyTagLine:{...e,display:!!r}}})},[e]),i=useMemo(()=>/*#__PURE__*/_jsx("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",children:/*#__PURE__*/_jsx("path",{d:"M288 128H896l-120 256L896 640H288v320H192v-896h96V128z",fillOpacity:".65",fill:"currentColor",style:{transition:"fill 0.2s ease"}})}),[r]);return n?/*#__PURE__*/_jsx(IconBox,{active:r,tone:"primary",onClick:()=>a(!r),title:"频率标记线显示控制",children:i}):null},zk=/*#__PURE__*/null,zS=rl.FrequencyTagLine,zM=e=>{let{state:{frequencyTagLine:t},dispatch:n}=ae(),{show:a,display:i,left:o,onChange:l}=t,{id:s}=e,c=g(t);return(h(()=>{c.current=t},[t]),h(()=>{let e=wK(s,zS,()=>{a&&i&&xt(s,zS)}),t=wV(s,zS,()=>{a&&i&&xt(s,zS)});return()=>{e?.(),t?.()}},[s,a,i,l]),h(()=>{let e=wU(s,zS,e=>{a&&i&&n({payload:{frequencyTagLine:{...c.current,...e,id:s}}})}),t=wJ(s,zS,(e,t)=>{a&&i&&(w7(s,zS),n({payload:{frequencyTagLine:{...c.current,...t,id:s}}}))});return()=>{e?.(),t?.()}},[s,a,i,n]),h(()=>{n({payload:{frequencyTagLine:{...t,left:-100}}})},[a]),a&&i)?/*#__PURE__*/r(yi,{className:"z-[3]",children:/*#__PURE__*/r("div",{className:"relative flex h-full w-px border-l border-dashed border-chart-highlight/80 opacity-80",style:{left:`${o}%`}})}):null},zF=/*#__PURE__*/a.memo(zM),zC={color:tQ},zD={borderColor:tQ},zz=28,zN=28,zE=4,zT=e=>{let t=Math.round(100*e)/100;return 0===t?0:t},zR=({viewportWidth:e,visibleLeftPct:t,visibleWidthPct:r,badgeWidth:n})=>{if(e<=0)return{right:"28px"};let a=t/100*e,i=r/100*e,o=Math.max(4,Math.min(28,i-n-4));return a+i-o-n<4?{left:`${4-a}px`}:{right:`${o}px`}},zA=({value:e,onChange:t,dragging:a,viewportWidth:i=0,visibleLeftPct:o=0,visibleWidthPct:l=100})=>{let{state:{axisY:s,limit:c,system:d}}=ae(),{label:p,disabled:v}=c,{unit:y="",range:w=ns}=s,[x,k]=w,S=Math.min(x,k),M=Math.max(x,k),F=m(()=>rg(y)?ny(0):0,[y]),C=m(()=>{let t=k-x;return Number.isFinite(e)&&Number.isFinite(t)&&0!==t?(k-e-F)/t*100:0},[k,F,x,e]),D=m(()=>Number.isFinite(e)?zT(F+e):0/0,[F,e]),z=Number.isFinite(D)?String(D):"",[N,E]=b(!1),[T,R]=b(0),A=g(null),I=g(null),P=g(null),L=g(""),O=g(!1),q=A.current?.clientHeight||d.height,$=(q>0?C/100*q<28:C<15)?"top-[4px]":"top-[-28px]";f(()=>{let e=I.current?.offsetWidth??0;e>0&&e!==T&&R(e)},[T,z,N,p,y]);let _=m(()=>zR({viewportWidth:i,visibleLeftPct:o,visibleWidthPct:l,badgeWidth:T||(N?120:72)}),[T,N,i,o,l]),j=u(e=>{I.current=e},[]);h(()=>{v&&(O.current=!0,E(!1))},[v]),h(()=>{N&&(P.current?.focus(),P.current?.select())},[N]);let H=u(()=>{!v&&Number.isFinite(D)&&(L.current=z,O.current=!1,E(!0))},[v,z,D]),B=u(()=>{let e=P.current;if(v||!e||e.validity.badInput)return void E(!1);let r=e.value.trim();if(!r||r===L.current)return void E(!1);let n=Number(r);if(Number.isFinite(n)){let e=Math.min(M,Math.max(S,zT(n)));t?.(zT(e-F))}E(!1)},[F,v,t,M,S]),W=u(e=>{"Enter"===e.key?(e.preventDefault(),O.current=!0,B()):"Escape"===e.key&&(e.preventDefault(),O.current=!0,E(!1))},[B]),G=u(()=>{if(O.current){O.current=!1;return}B()},[B]);return /*#__PURE__*/r("div",{ref:A,className:"relative h-full w-full",children:/*#__PURE__*/n("div",{className:"absolute right-0 h-0 w-full",style:{top:`${C}%`},children:[!N||v?/*#__PURE__*/n("button",{ref:j,type:"button",disabled:v||!Number.isFinite(e),className:`${a?"pointer-events-none":"pointer-events-auto"} absolute ${$} z-[8] flex h-6 appearance-none items-center justify-center whitespace-nowrap rounded-[var(--radius-control)] border-0 bg-secondary px-2 text-xs text-foreground`,style:{...zC,..._},onClick:H,children:[p," ",z,y]}):/*#__PURE__*/n("div",{ref:j,className:`pointer-events-auto absolute ${$} z-[8] flex h-6 items-center justify-between whitespace-nowrap bg-secondary px-2 text-xs text-foreground`,style:{...zC,..._},children:[p," ",/*#__PURE__*/r("input",{ref:P,type:"number","aria-label":`${p}${y}门限值`,defaultValue:z,min:S,max:M,step:"any",className:"h-auto w-14 border-none bg-transparent p-0 text-center outline-none [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none",style:zC,onKeyDown:W,onBlur:G}),/*#__PURE__*/r("div",{className:"flex items-center",children:y})]}),/*#__PURE__*/r("div",{className:"absolute right-0 top-[-0.5px] z-[8] h-0 w-full border-b border-dashed",style:zD})]})})},zI=zA,zP=rl.Limit,zL=10,zO=e=>{let t=Math.round(100*e)/100;return 0===t?0:t},zq=({id:e})=>{let{state:{limit:t,segments:n,axisY:a,system:i,zoom:o},dispatch:l}=ae(),{show:s,active:c,disabled:d,value:p,onChange:f,unified:v}=t,[y,w]=a.range??ns,{totalPoints:x}=n,k=m(()=>s&&c,[s,c]),S=g(null),[M,F]=b(0),[C,D]=b(!1),z=g(null),N=g(null),E=g(null),T=g(!1),R=g(t);R.current=t;let A=u(e=>{f?.(v?Array.from({length:Math.max(1,n.length)},()=>e[0]):[...e])},[f,v,n.length]),I=u((e,t,r=!1)=>{let n;if(!Number.isFinite(t))return;let a=zO(t),i=v?0:e;if(R.current.value[i]===a)return;let o=v?[a]:((n=[...R.current.value])[i]=a,n),s={...R.current,value:o};R.current=s,l({payload:{limit:s}}),r&&A(o)},[l,A,v]),P=u(()=>{z.current=null,N.current=null,E.current=null,T.current=!1,D(!1),xt(e,zP)},[e]);h(()=>{(!k||d)&&P()},[k,d,P]),h(()=>{if(!k)return;let e=S.current;if(!e)return;let t=()=>{let t=Math.round(e.clientWidth);F(e=>e===t?e:t)};if(t(),"u"<typeof ResizeObserver)return;let r=new ResizeObserver(t);return r.observe(e),()=>r.disconnect()},[k]),h(()=>{let t=()=>{if(k&&!d){if(T.current){let e=z.current,t=null!==e?R.current.value[e]:void 0;"number"==typeof t&&Number.isFinite(t)&&t!==E.current&&A(R.current.value)}P()}},r=wU(e,zP,t=>{if(!k||d||"number"!=typeof t?.left||!Number.isFinite(t.left)||"number"!=typeof t?.top||!Number.isFinite(t.top))return;let r=t.left,o=v?0:n.findIndex(e=>e.progress[0]<=r&&r<e.progress[1]);if(!Number.isFinite(o)||o<0)return void P();let l=w-y;if(!Number.isFinite(l)||0===l)return;let s=rg(a.unit)?ny(0):0,c=R.current.value[o];if("number"!=typeof c||!Number.isFinite(c))return void P();let u=(w-c-s)/l*100,h=Math.max(1.2,10/Math.max(1,i.height||1)*100);Math.abs(t.top-u)>h||!w7(e,zP)?P():(z.current=o,N.current=c,E.current=c,T.current=!0,D(!0))}),o=wV(e,zP,t),l=wK(e,zP,t),s=wJ(e,zP,(t,r,n)=>{if(!k||d)return;let i=z.current;if(null!==i&&w7(e,zP)&&"number"==typeof n?.top&&Number.isFinite(n.top)&&0!==n.top){let e=w-y;if(!Number.isFinite(e)||0===e)return;let t=N.current??R.current.value[i];if(!Number.isFinite(t))return;let r=t-n.top*e;N.current=r;let o=rg(a.unit)?ny(0):0,l=Math.min(y,w),s=Math.max(y,w),c=Math.min(s,Math.max(l,r+o));I(i,Math.min(s,Math.max(l,Math.round(c)))-o,!1)}});return()=>{r?.(),o?.(),l?.(),s?.()}},[k,d,n,e,I,A,P,v,y,w,a.unit,i.height]);let L=m(()=>{if(v||!n?.length||!x)return[];let{start:e,end:t}=SI(o.interval,x),r=t+1,a=Math.max(1,r-e),i=[];return n.forEach((t,n)=>{let o=p[n];if("number"!=typeof o||!Number.isFinite(o))return;let l=t.index,s=t.index+t.point,c=Math.max(l,e),u=Math.min(s,r);u<=c||i.push({segIndex:n,key:t.index,value:o,leftPct:(c-e)/a*100,widthPct:(u-c)/a*100})}),i},[n,x,v,p,o.interval]);if(!k)return null;let O=M||i.width,q=p[0],$="number"==typeof q&&Number.isFinite(q);return /*#__PURE__*/r("div",{ref:S,className:"pointer-events-none absolute inset-0 z-[7] select-none overflow-hidden bg-transparent",children:v?/*#__PURE__*/r("div",{className:"absolute inset-0",children:$?/*#__PURE__*/r(zA,{id:e,value:q,onChange:e=>I(0,e,!0),dragging:C,viewportWidth:O,visibleLeftPct:0,visibleWidthPct:100}):null}):L.map(t=>/*#__PURE__*/r("div",{style:{left:`${t.leftPct}%`,width:`${t.widthPct}%`},className:"absolute top-0 h-full",children:/*#__PURE__*/r(zA,{id:e,value:t.value,onChange:e=>I(t.segIndex,e,!0),dragging:C,viewportWidth:O,visibleLeftPct:t.leftPct,visibleWidthPct:t.widthPct})},t.key))})},z$=zq,z_=rl.Markers,zj=6,zH=8,zB=e=>{let{id:t,markers:r,display:n,fixed:a,readonly:i,onCreateMarker:o,onDeleteMarker:l,onUpdateMarker:s,onToggleSelect:c,onHover:d,onResetHover:p}=e,f=g({isDown:null,dragStart:null,isHover:"",hoverId:null}),m=u(()=>document.getElementById(wW(t))??document.getElementById(t),[t]),b=u(e=>{if(!e||!r||0===r.length)return null;let{left:t}=e;if(void 0===t)return null;let n=m();if(!n)return null;let{width:a}=n.getBoundingClientRect();for(let e=0;e<r.length;e+=1){let n=r[e];if(n&&Math.abs(t-n.left)*a/100<=6)return{...n,index:e}}return null},[m,r]),v=u(e=>{let t=m();if(!t)return"";let n=t.getBoundingClientRect().width,a="";for(let t=0;t<r.length;t+=1){let i=r[t];if(i&&Math.abs(e.left-i.left)*n/100<=8){a={...i,index:t};break}}return a},[m,r]);return h(()=>{if(i)return;let e=wY(t,z_,(e,t)=>{if(n&&void 0!==t.left){let e=v({left:t.left}),r="object"==typeof e?e.id:null;if(f.current.hoverId===r){f.current.isHover=e;return}f.current.isHover=e,f.current.hoverId=r,d({left:t.left})}}),r=wJ(t,z_,(e,r)=>{let{isDown:i}=f.current;n&&i&&w7(t,z_)&&!a&&s(i.id,{left:r.left,top:r.top})}),u=wU(t,z_,e=>{if(!n)return;let t=b(e)||("object"==typeof f.current.isHover?f.current.isHover:null);t&&!a&&(f.current.isDown=t)}),h=wK(t,z_,()=>{n&&(f.current.isDown=null,xt(t,z_))}),m=wV(t,z_,()=>{if(!n)return;let e=null!==f.current.hoverId;f.current.isDown=null,f.current.isHover="",f.current.hoverId=null,xt(t,z_),e&&p()}),g=w1(t,z_,(e,r)=>{if(!n||!w7(t,z_))return;let a=b(r)||("object"==typeof f.current.isHover?f.current.isHover:null);a?.id&&c(a.id)}),y=wX(t,z_,(e,r)=>{if(!n||!w7(t,z_)||void 0===r.left)return!1;let a=v({left:r.left});return a&&"object"==typeof a&&a.id?l(a.id):o({left:r.left}),!0});return()=>{e?.(),r?.(),u?.(),h?.(),m?.(),g?.(),y?.()}},[t,n,r,a,i,o,l,s,c,d,p,b,v]),{isDown:f.current.isDown}},zW=t0("marker"),zG=e=>Cn(e);function zY(e,t,r){let{needsMaxPeak:n=!1,needsTopPeaks:a=!1}=r||{},i=null,o=null;try{let t=tO(e).getAllRawData()[t3];if(t?.peaks?.peaks&&Array.isArray(t.peaks.peaks)){let e=t.peaks.peaks;return n&&e.length>0&&(i=e[0]),a&&(o=e),{maxPeak:i,topPeaks:o}}}catch(e){console.warn("[useMarkers] Failed to get precomputed peaks:",e)}return n&&(i=Cf(t)),a&&(o=Cg(t,2)),{maxPeak:i,topPeaks:o}}let zU=e=>{let{id:t,globalID:r,onChange:n}=e,[a,i]=b({markers:[],colorIndex:0,isDown:null,isHover:"",peak:null,hasPeak:!1}),o=g(new Float32Array),l=u((e,t)=>{let{axisY:{unit:n},axisX:{frequencyFormat:a}}=Cn(r),i=e.left,{peak:l}=e,s=t?.data??o.current;s&&0!==s.length||(s=tO(r).getAllRawData()[t3]),o.current=s;let c=Cp({left:i,globalID:r}),{outsideLeft:u,multiple:d}=c,{insideLeft:h}=c,p=s.length,f=Math.floor(p*h/100);if(100===h&&(f=p-1),"mainSecondary"===e.peakTracking&&"number"==typeof e.peakRank){let n=t?.topPeaks;n||(n=zY(r,s,{needsTopPeaks:!0}).topPeaks);let a=n?.[e.peakRank];a&&(h=((f=a.index)+.5)*100/p)}else if(l){let e=t?.maxPeak;e||(e=zY(r,s,{needsMaxPeak:!0}).maxPeak),e&&(h=((f=e.index)+.5)*100/p)}let m=parseFloat(a(i=u+h/d)),g=s[f];return void 0===g||Number.isNaN(g)||(e.level=parseFloat(nI(n,g).toFixed(1))),{...e,left:i,frequency:m}},[r]),s=u((e,t=!1)=>{0!==o.current.length&&i(a=>{let{marker:{maxCount:i,fifo:o}}=Cn(r),s=Ci(a.markers,[e],i,o);if(!s.allowed)return a;let c=rV(),u=zW[a.colorIndex%20],d={...l({...e,id:c,color:u,select:!1,peak:!1,frequency:0,hover:!1}),id:c,color:u,select:!t,peak:!1,hover:!1},h=[...t?s.keptMarkers:s.keptMarkers.map(e=>({...e,select:!1})),d];return t||setTimeout(()=>{n?.(ro.Add,h)},0),{...a,markers:h,colorIndex:a.colorIndex+1}})},[l,n]),c=u(({event:e,marker:t,frequencies:a,silent:s=!1})=>{i(i=>{let c=[...i.markers],u=ro.Update,{id:d,peak:h,select:p,frequency:f,left:m,top:g}=t||{},b=m;if(e===ro.Update&&void 0!==f){let e=Cn(r),t=(e?.segments||{totalPoints:0})[0];if(t&&d){let{start:e,stop:r}=t,n=r-e;if(void 0!==n&&f<r&&f>e)b=(f-e)*100/n;else{let e=c.findIndex(e=>e.id===d);-1!==e&&(c.splice(e,1),u=ro.Del)}}}if(e===ro.Add&&a?.length){let e=Cn(r),t=(e?.segments||{totalPoints:0})[0];if(t){let{start:e,stop:r}=t,n=r-e;if(void 0!==n){let t=[];for(let i=0;i<a.length;i+=1){let o=a[i];o>=e&&o<=r&&t.push((o-e)*100/n)}t.length>0&&(a=t)}}}if(e===ro.Add&&a?.length){let{marker:{maxCount:e,fifo:t}}=Cn(r),n=Ci(c,a,e,t);if(n.allowed&&n.itemsToAdd.length>0){c=n.keptMarkers.map(e=>({...e,select:!1}));let e=n.itemsToAdd;for(let t=0;t<e.length;t+=1){let r=rV(),n=zW[(i.colorIndex+t)%20],a=!1;if(o.current&&o.current.length>0){let r=-1/0,n=0;for(let e=0;e<o.current.length;e++)o.current[e]>r&&(r=o.current[e],n=e);Math.abs(Math.floor(o.current.length*e[t]/100)-n)<=Math.max(1,Math.floor(.01*o.current.length))&&(a=!0)}let s=l({left:e[t],id:r,color:n,select:!1,peak:a,frequency:0,hover:!1});c.push({...s,id:r,color:n,select:t===e.length-1,peak:a,hover:!1})}u=ro.Add}}if(e===ro.Del){let e=c.findIndex(e=>e.id===d);-1!==e&&(c.splice(e,1),u=ro.Del)}return e===ro.Clear&&(c=[],u=ro.Clear),e===ro.Update&&(u=ro.Update,c=c.map(e=>(void 0!==h&&(e.peak=!1),void 0!==p&&e.id!==d&&(e.select=!1),e.id===d&&(void 0!==b&&(e=l({...e,left:b,top:g||e.top})),void 0!==p&&(e.select=p),void 0!==h&&(e.peak=h,h&&void 0===p&&(e.select=!0))),e.peak,e))),s||setTimeout(()=>{n?.(u,c)},0),{...i,markers:c,colorIndex:e===ro.Clear?0:i.colorIndex}})},[l,n]),d=u(()=>{i(e=>({...e,markers:[],colorIndex:0})),setTimeout(()=>{n?.(ro.Clear,[])},0)},[n]),h=u(e=>{e&&(o.current=e),i(t=>{if(0===t.markers.length)return t;let a=t.markers.some(e=>e.peak&&"mainSecondary"!==e.peakTracking),i=t.markers.some(e=>"mainSecondary"===e.peakTracking&&"number"==typeof e.peakRank),s=e??o.current??new Float32Array,{maxPeak:c,topPeaks:u}=zY(r,s,{needsMaxPeak:a,needsTopPeaks:i}),d=t.markers.map(e=>l(e,{data:s,maxPeak:c,topPeaks:u}));return d.some((e,r)=>{let n=t.markers[r];return n&&(Math.abs(e.frequency-n.frequency)>.001||Math.abs(e.level-n.level)>.001)})&&setTimeout(()=>{n?.(ro.Update,d)},0),{...t,markers:d}})},[l,n]),p=u(e=>{let a=document.getElementById(t);if(!a)return"";let o=a.getBoundingClientRect(),{zoom:{interval:{start:l,end:s}},segments:c}=Cn(r),u=c.totalPoints/(s-l+1),d=o.width*u/100,h="",p=!1;return i(t=>{let r=t.markers.map((t,r)=>{let n=Math.abs(e.left-t.left)*d<=16;return t.hover!==n&&(p=!0),n&&(h={...t,index:r}),{...t,hover:n}});return p&&setTimeout(()=>{n?.(ro.Update,r)},0),{...t,markers:r,isHover:h}}),h},[t,r,n]),f=u(()=>{i(e=>{let t=!1,r=e.markers.map(e=>(e.hover&&(t=!0),{...e,hover:!1}));return t&&setTimeout(()=>{n?.(ro.Update,r)},0),{...e,markers:r,isHover:""}})},[n]),m=g(null),v=g(null),y=u(()=>{i(e=>{if(e.markers.some(e=>"mainSecondary"===e.peakTracking)){let t=e.markers.filter(e=>"mainSecondary"!==e.peakTracking),r=m.current;if(r){let e=t.findIndex(e=>e.id===r);-1!==e&&(t[e]={...t[e],select:!0})}return m.current=null,setTimeout(()=>{n?.(ro.Update,t)},0),{...e,markers:t}}let{marker:t}=Cn(r),a=t.maxCount,i=t.fifo,s=Ci(e.markers,[0,1],a,i);if(!s.allowed||s.itemsToAdd.length<2)return e;m.current=e.markers.find(e=>e.select)?.id??null;let c=[],u=e.colorIndex,d=e=>{let t=rV(),r=zW[u%20];u+=1;let n=l({left:50,id:t,color:r,select:!1,peak:!0,peakTracking:"mainSecondary",peakRank:e,frequency:0,hover:!1});c.push({...n,id:t,color:r,select:!1,peak:!0,peakTracking:"mainSecondary",peakRank:e,hover:!1})};d(0),d(1);let h=[...s.keptMarkers,...c.map(e=>({...e,select:!1}))].map(e=>l(e,{data:o.current}));return setTimeout(()=>{n?.(ro.Update,h)},0),{...e,markers:h,colorIndex:u}})},[l,r,n]),w=u(()=>{i(e=>{if(e.markers.some(e=>"mainSecondary"===e.peakTracking&&0===e.peakRank)){let t=e.markers.filter(e=>"mainSecondary"!==e.peakTracking||0!==e.peakRank),r=v.current;if(r){let e=t.findIndex(e=>e.id===r);-1!==e&&(t[e]={...t[e],select:!0})}return v.current=null,setTimeout(()=>{n?.(ro.Update,t)},0),{...e,markers:t}}let{marker:t}=Cn(r),a=t.maxCount,i=t.fifo,s=Ci(e.markers,[0],a,i);if(!s.allowed||s.itemsToAdd.length<1)return e;v.current=e.markers.find(e=>e.select)?.id??null;let c=rV(),u=zW[e.colorIndex%20],d={...l({left:50,id:c,color:u,select:!1,peak:!0,peakTracking:"mainSecondary",peakRank:0,frequency:0,hover:!1}),id:c,color:u,select:!1,peak:!0,peakTracking:"mainSecondary",peakRank:0,hover:!1},h=[...s.keptMarkers,d].map(e=>l(e,{data:o.current}));return setTimeout(()=>{n?.(ro.Update,h)},0),{...e,markers:h,colorIndex:e.colorIndex+1}})},[l,r,n]),x=u((e,t)=>{i(a=>{let i=a.markers.find(e=>e.id===t);if(!i)return a;let s=tO(r).getAllRawData()[t3];if(!s||s.length<3)return a;o.current=s;let{zoom:c,segments:u}=Cn(r),d=s.length,h=u.totalPoints||d,p=c.interval.end-c.interval.start+1,f=(i.left*h/100-c.interval.start)*100/p,m=Math.floor(d*f/100);100===f&&(m=d-1);let g=-1;if(s.peaks?.peaks&&Array.isArray(s.peaks.peaks)){let t=s.peaks.peaks;if("left"===e){let e=1/0;for(let r of t)if(r.index<m){let t=m-r.index;t<e&&(e=t,g=r.index)}}else{let e=1/0;for(let r of t)if(r.index>m){let t=r.index-m;t<e&&(e=t,g=r.index)}}}if(-1===g){let t=e=>{if(e<=0||e>=d-1)return!1;let t=s[e];return t>s[e-1]&&t>s[e+1]};if("left"===e){for(let e=m-1;e>0;e-=1)if(t(e)){g=e;break}}else for(let e=m+1;e<d-1;e+=1)if(t(e)){g=e;break}}if(-1===g)return a;let b=((g+.5)*100/d*p/100+c.interval.start)*(100/h),v=a.markers.map(e=>{if(e.id!==t)return{...e,select:!1};let{peakTracking:r,peakRank:n,...a}=e;return l({...a,left:b,select:!0,peak:!1},{data:s})});return setTimeout(()=>{n?.(ro.Update,v)},0),{...a,markers:v}})},[l,r,n]),k=u(e=>{i(t=>{if(!t.markers.find(t=>t.id===e))return t;let a=tO(r).getAllRawData()[t3];if(!a||a.length<1)return t;o.current=a;let{zoom:i,segments:s}=Cn(r),c=a.length,u=s.totalPoints||c,d=0,h=a[0];for(let e=1;e<c;e+=1)a[e]>h&&(h=a[e],d=e);let p=(100*d/(c-1)*(i.interval.end-i.interval.start+1)/100+i.interval.start)*(100/u),f=t.markers.map(t=>{if(t.id!==e)return{...t,select:!1};let{peakTracking:r,peakRank:n,...i}=t;return l({...i,left:p,select:!0,peak:!1},{data:a})});return setTimeout(()=>{n?.(ro.Update,f)},0),{...t,markers:f}})},[l,r,n]),S=u(e=>{i(t=>{if(!t.markers.find(t=>t.id===e))return t;let a=tO(r).getAllRawData()[t3];if(!a||a.length<3)return t;o.current=a;let{zoom:i,segments:s}=Cn(r),c=a.length,u=s.totalPoints||c,d=0,h=a[0];for(let e=1;e<c;e+=1)a[e]>h&&(h=a[e],d=e);let p=Math.max(2,Math.floor(.1*c)),f=-1,m=-1/0;for(let e=1;e<c-1;e+=1){if(Math.abs(e-d)<p)continue;let t=a[e],r=a[e-1],n=a[e+1];t>r&&t>n&&t>m&&(m=t,f=e)}if(-1===f)return t;let g=(100*f/(c-1)*(i.interval.end-i.interval.start+1)/100+i.interval.start)*(100/u),b=t.markers.map(t=>{if(t.id!==e)return{...t,select:!1};let{peakTracking:r,peakRank:n,...i}=t;return l({...i,left:g,select:!0,peak:!1},{data:a})});return setTimeout(()=>{n?.(ro.Update,b)},0),{...t,markers:b}})},[l,r,n]),M=u((e,t)=>{i(a=>{let i,s=a.markers.find(e=>e.id===t);if(!s)return a;let c=tO(r).getAllRawData()[t3];if(!c||c.length<2)return a;o.current=c;let{zoom:u,segments:d}=Cn(r),h=c.length,p=d.totalPoints||h,f=u.interval.end-u.interval.start+1,m=Math.round((h-1)*((s.left*p/100-u.interval.start)*100/f)/100);if((i="left"===e?Math.max(0,m-1):Math.min(h-1,m+1))===m)return a;let g=(100*i/(h-1)*f/100+u.interval.start)*(100/p),b=a.markers.map(e=>{if(e.id!==t)return{...e,select:!1};let{peakTracking:r,peakRank:n,...a}=e;return l({...a,left:g,select:!0,peak:!1},{data:c})});return setTimeout(()=>{n?.(ro.Update,b)},0),{...a,markers:b}})},[l,r,n]),F="#F98116",C="#AA74E8",D=u(()=>{i(e=>{let t,a=tO(r).getAllRawData()[t3];if(!a||a.length<1)return e;o.current=a;let{zoom:i,segments:s}=Cn(r),c=a.length,u=s.totalPoints||c,d=0,h=a[0];for(let e=1;e<c;e+=1)a[e]>h&&(h=a[e],d=e);let p=(100*d/(c-1)*(i.interval.end-i.interval.start+1)/100+i.interval.start)*(100/u),f=e.markers.find(e=>e.color===F);if(f)t=e.markers.map(e=>e.id===f.id?l({...e,left:p},{data:a}):e);else{let{marker:n}=Cn(r),i=n.maxCount,o=n.fifo,s=Ci(e.markers,[p],i,o);if(!s.allowed)return e;let c=l({left:p,id:rV(),color:F,select:!1,peak:!1,hover:!1},{data:a});t=[...s.keptMarkers,c]}return setTimeout(()=>{n?.(ro.Update,t)},0),{...e,markers:t}})},[l,r,n]),z=u(()=>{i(e=>{let t,a=tO(r).getAllRawData()[t3];if(!a||a.length<3)return e;o.current=a;let{zoom:i,segments:s}=Cn(r),c=a.length,u=s.totalPoints||c,d=0,h=a[0];for(let e=1;e<c;e+=1)a[e]>h&&(h=a[e],d=e);let p=Math.max(2,Math.floor(.1*c)),f=-1,m=-1/0;for(let e=1;e<c-1;e+=1){if(Math.abs(e-d)<p)continue;let t=a[e],r=a[e-1],n=a[e+1];t>r&&t>n&&t>m&&(m=t,f=e)}if(-1===f)return e;let g=(100*f/(c-1)*(i.interval.end-i.interval.start+1)/100+i.interval.start)*(100/u),b=e.markers.find(e=>e.color===C);if(b)t=e.markers.map(e=>e.id===b.id?l({...e,left:g},{data:a}):e);else{let{marker:n}=Cn(r),i=n.maxCount,o=n.fifo,s=Ci(e.markers,[g],i,o);if(!s.allowed)return e;let c=l({left:g,id:rV(),color:C,select:!1,peak:!1,hover:!1},{data:a});t=[...s.keptMarkers,c]}return setTimeout(()=>{n?.(ro.Update,t)},0),{...e,markers:t}})},[l,r,n]);return{markers:a.markers,isDown:a.isDown,isHover:a.isHover,createMarker:s,updateMarkerAttribute:c,resetMarkers:d,updateByData:h,handleHover:p,resetHover:f,toggleMainSecondaryPeaks:y,toggleMainPeak:w,moveToAdjacentPeak:x,findMainPeak:k,findSecondaryPeak:S,moveToStep:M,createMainPeakMarker:D,createSecondaryPeakMarker:z,setState:i}},zX=e=>{let{top:a,left:i,color:o="transparent",x:l=!0,y:s=!0,lineWidth:c=1}=e;return /*#__PURE__*/n(t,{children:[l&&/*#__PURE__*/r("div",{className:"absolute left-0 top-[-200%] z-[5] w-full border-t border-dashed",style:{top:a,borderColor:o,borderTopWidth:`${c}px`}}),s&&/*#__PURE__*/r("div",{className:"absolute left-[-200%] top-0 z-[5] h-full border-l border-dashed",style:{left:i,borderColor:o,borderLeftWidth:`${c}px`}})]})},zK=zX,zV=({marker:e})=>{let{state:{axisX:t,axisY:a}}=ae(),i=g(null),o=g(null),[l,s]=b(0),[c,u]=b(0);h(()=>{let e=()=>{i.current&&s(i.current.offsetWidth),o.current&&u(o.current.offsetWidth)};e();let t=new ResizeObserver(()=>{e()});return i.current&&t.observe(i.current),o.current&&t.observe(o.current),()=>{t.disconnect()}},[e.frequency,e.level]);let d=m(()=>{let t=e.left/100*l,r=l>0&&c>0&&t+c+10>l-20;return{left:`${e.left}%`,color:e.color,opacity:e.hover?1:.68,fontWeight:e.hover?500:"normal",transform:r?"translateX(-100%)":"translateX(0)",marginLeft:r?"-10px":"10px"}},[e.left,e.hover,e.color,l,c]);return /*#__PURE__*/n("div",{ref:i,className:"absolute left-0 top-0 h-full w-full",id:e.id,title:`${e.frequency}${t.unit} / ${e.level}${a.unit}`,children:[/*#__PURE__*/n("div",{ref:o,className:"absolute top-[10px] z-[5] whitespace-nowrap text-[12px] leading-4 transition-[opacity,font-weight,transform,margin-left,color]",style:d,children:[/*#__PURE__*/n("div",{children:[e.frequency,t.unit]}),void 0!==e.level&&/*#__PURE__*/n("div",{children:[e.level,a.unit]})]}),/*#__PURE__*/r(zX,{x:!1,left:`${e.left}%`,top:`${e.top}%`,color:e.color,lineWidth:e.select?2:1})]},e.id)},zQ=/*#__PURE__*/a.memo(zV),zZ=({id:e})=>{let{state:{marker:t,globalID:n}}=ae(),{enabled:a,visible:i,fixed:o,readonly:l,maxCount:s,onChange:c}=t,d=u((e,t)=>{c?.(e,t),Cs(n)({count:t.length,maxCount:s});let r=t.find(e=>e.select)?.id??null;Cc(n)({selectedId:r})},[c,n,s]),p=m(()=>a&&i,[a,i,t.enabled,t.visible]),f=m(()=>wW(e),[e]),{markers:b,createMarker:v,updateMarkerAttribute:y,resetMarkers:w,updateByData:x,handleHover:k,resetHover:S,toggleMainSecondaryPeaks:M,toggleMainPeak:F,moveToAdjacentPeak:C,findMainPeak:D,findSecondaryPeak:z,createMainPeakMarker:N,createSecondaryPeakMarker:E}=zU({id:e,globalID:n,display:i,onChange:d});h(()=>{if(!n||!f||!p||l)return;let e=nP(n,f,e=>{let t=e.key.toLowerCase();if(!["a","d","w","s"].includes(t))return;if("w"===t){if(e.repeat)return;e.preventDefault(),N();return}if("s"===t){if(e.repeat)return;e.preventDefault(),E();return}let r=b.find(e=>e.select)?.id;r&&(e.preventDefault(),C("a"===t?"left":"right",r))});return()=>{e?.()}},[f,n,b,C,p,l,N,E]);let T=u(e=>{let t=b.find(t=>t.id===e),r=!t?.select;y({event:ro.Update,marker:{id:e,select:r}})},[b,y]),R=u((e,t)=>{y({event:ro.Update,marker:{id:e,left:t.left,top:t.top}})},[y]);zB({id:e,markers:b,display:p,fixed:o,readonly:l,onCreateMarker:v,onDeleteMarker:u(e=>{y({event:ro.Del,marker:{id:e}})},[y]),onUpdateMarker:R,onToggleSelect:T,onHover:k,onResetHover:S});let A=g(null);return(h(()=>{n&&e&&tq(e,"Marker",()=>{let{realData:e}=tO(n).getAllRawData();A.current=e??null,x(e)})},[n,e,x]),h(()=>{n&&e&&Co(n,e=>{y(e)})},[n,e,y,w]),h(()=>{n&&e&&Cu(n,e=>{if(e?.type){if("main-secondary-peaks"===e.type)return void M();if("main-peak"===e.type)return void F();if("left-peak"===e.type)return void C("left",e.selectedId);if("right-peak"===e.type)return void C("right",e.selectedId);if("find-main-peak"===e.type)return void D(e.selectedId);if("find-secondary-peak"===e.type)return void z(e.selectedId);if("create-main-peak"===e.type)return void N();if("create-secondary-peak"===e.type)return void E();if("clear-all"===e.type)return void w()}})},[n,e,C,M,F,D,z,N,E,w]),p)?/*#__PURE__*/r(yi,{className:"z-[5]",children:b.map(e=>/*#__PURE__*/r(zQ,{marker:e},e.id))}):null},zJ=zZ,z0=({segments:e,index:t,frequency:r,bandwidth:n})=>{if(!r||!n||!e||!e[t])return{left:0,width:0};let a=e[t],i=e.reduce((e,t)=>e+t.point,0),{left:o,width:l}=rP({startFreq:r-n/2e3,stopFreq:r+n/2e3},a),s=e.slice(0,t).reduce((e,t)=>e+t.point/i*100,0),c=a.point/i*100;return{left:s+o/100*c,width:l/100*c}};function z1(){let{state:{scope:e,segments:t},dispatch:r}=ae();return u(n=>{let{frequency:a,bandwidth:i,index:o=0}=n,{left:l,width:s}=z0({segments:t,index:o,frequency:a,bandwidth:i});r({payload:{scope:{...e,left:l,width:s}}})},[t,e])}let z2=()=>{let{state:{scope:{show:e,left:t,width:n}}}=ae();return e?/*#__PURE__*/r(yi,{children:/*#__PURE__*/r("div",{className:"relative flex h-full w-0 box-border border-y border-dashed border-chart-grid bg-chart-surface opacity-50",style:{width:`${n}%`,left:`${t}%`}})}):null},z5=z2,z4=/*#__PURE__*/c(({style:e,signalPositions:t,activeSignalKey:n,segmentIndex:a})=>/*#__PURE__*/r("div",{className:"absolute h-full box-border",style:e,children:t.map(({item:e,key:t,position:i,color:o,tooltip:l})=>{let s=n===t,c={left:i.left,width:i.width,minWidth:"1px",backgroundColor:o,height:s?"100%":"8px",opacity:s?.5:1};return /*#__PURE__*/r("div",{className:"pointer-events-none absolute top-0 flex min-w-px items-center justify-center overflow-hidden text-ellipsis whitespace-nowrap text-center text-xs text-foreground","data-signal-active":s?"true":"false","data-signal-key":t,"data-signal-source":kA(e),"data-testid":"signal-annotation",style:c,title:l},`segment-${a}-signal-${t}`)})})),z3=z4;function z6(){let{state:e,dispatch:t}=ae(),r=g(e.globalID),n=g(e.signal),a=g({});return h(()=>{r.current=e.globalID,n.current=e.signal},[e.globalID,e.signal]),h(()=>{if(!e.globalID)return;let r=a.current.station,i=a.current.simple;void 0!==r&&(Se(e.globalID,r),a.current.station=void 0),void 0!==i&&(t({payload:{signal:{...n.current,data:i}}}),a.current.simple=void 0)},[t,e.globalID]),{updateSignalData:u(e=>{let{type:i,data:o}=e;if(Array.isArray(o)){if("station"===i){if(!r.current){a.current.station=o;return}Se(r.current,o)}else if("simple"===i){if(!r.current){a.current.simple=o;return}t({payload:{signal:{...n.current,data:o}}})}}},[t])}}let z8=({id:e,show:t=!0,display:n=!0})=>{let a=at(e=>e.segments),i=at(e=>e.zoom.style),o=at(e=>e.signal),l=xo(e),s=l?.coord.left,c=St({respectVisibility:!0}),u=o.show&&o.display&&n,d=!!l,h=m(()=>d&&"number"==typeof s?rL(s,a):{segmentIndex:-1,pointIndex:-1},[d,a,s]),p=m(()=>d?rO(a,h):0/0,[h,d,a]),f=m(()=>k1({segments:a,signalItems:c}),[a,c]),g=m(()=>k2({segmentData:f,isCursorActive:d,currentFrequency:p,currentPosition:h}),[p,h,d,f]);return t&&u?/*#__PURE__*/r("div",{className:"pointer-events-none absolute inset-0 z-[4] flex h-full w-full select-none items-center overflow-hidden bg-transparent",children:/*#__PURE__*/r("div",{className:"absolute right-0 top-0 flex h-full w-full",style:i??void 0,children:f.map(({segmentIndex:e,signalPositions:t,style:n})=>/*#__PURE__*/r(z4,{style:n,signalPositions:t,activeSignalKey:h.segmentIndex===e?g:void 0,segmentIndex:e},`segment-${e}`))})}):null},z9=z8,z7=()=>{let{state:{stripe:e},dispatch:t}=useStore(),{display:r,show:n}=e,a=useCallback(r=>{t({payload:{stripe:{...e,display:!!r}}})},[e]);return n?/*#__PURE__*/_jsx(IconBox,{active:r,tone:"primary",onClick:()=>{a(!r)},title:"频谱框选",children:/*#__PURE__*/_jsxs("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",children:[/*#__PURE__*/_jsx("path",{d:"M835.4 757.7h-69.9v-51h18.9v-18.8h51zM713.1 757.7h-83.9v-51h83.9v51z m-136.4 0h-83.9v-51h83.9v51z m-136.4 0h-83.9v-51h83.9v51z m-136.4 0H220v-51h83.9v51zM167.5 757.7H97.6v-69.8h51v18.8h18.9zM148.6 637.5h-51V557h51v80.5z m0-130.7h-51v-80.5h51v80.5z m0-130.8h-51v-80.5h51V376zM148.6 245.2h-51v-69.9h69.9v51h-18.9zM713.1 226.3h-83.9v-51h83.9v51z m-136.4 0h-83.9v-51h83.9v51z m-136.4 0h-83.9v-51h83.9v51z m-136.4 0H220v-51h83.9v51zM835.4 245.2h-51v-18.9h-18.9v-51h69.9zM835.4 637.5h-51V557h51v80.5z m0-130.7h-51v-80.5h51v80.5z m0-130.8h-51v-80.5h51V376z",fill:"currentColor"}),/*#__PURE__*/_jsx("path",{d:"M784.4 615.7h51v233h-51z",fill:"currentColor"}),/*#__PURE__*/_jsx("path",{d:"M693.4 706.7h233v51h-233z",fill:"currentColor"})]})}):null},Ne=null,Nt=rl.Stripe,Nr=1.5,Nn=e=>Math.max(0,Math.min(100,e)),Na=({cursor:e,left:t,right:r})=>{let n=Math.abs(e-t),a=Math.abs(e-r);return n<=1.5?"left":a<=1.5?"right":e>t&&e<r?"move":n<=a?"left":"right"},Ni=({id:e})=>{let{state:{stripe:t,axisX:{frequencyFormat:n,unit:a}},dispatch:i}=ae(),{show:o,display:l,left:s,right:c,defaultLeft:d,defaultRight:p,onChange:f}=t,m=g(t),b=g(null),v=g(n),y=g(a),w=g(f);h(()=>{m.current=t,v.current=n,y.current=a,w.current=f},[t,n,a,f]),h(()=>{i({payload:{stripe:{...t,left:d,right:p}}})},[d,p]);let x=u(e=>{let t=b.current;if(!t||!Number.isFinite(e?.left))return;let r=Nn(e.left),n=m.current,{mode:a,startCursor:o,startLeft:l,startRight:s}=t,c=l,u=s;if("move"===a){let e=s-l;(u=(c=Nn(l+(r-o)))+e)>100&&(c=Math.max(0,(u=100)-e))}"left"===a&&(c=Math.min(r,s)),"right"===a&&(u=Math.max(r,l)),i({payload:{stripe:{...n,left:c,right:u}}})},[i]),k=u(()=>{let{left:e,right:t}=m.current,r=Math.round(10*e)/10,n=Math.round(10*t)/10,a=v.current?.(r)??"",i=v.current?.(n)??"",o=n-r,l=Number(i)-Number(a);w.current({left:r,right:n,width:o,start:a,end:i,bandwidth:l,unit:y.current})},[]);return(h(()=>{wU(e,Nt,t=>{if(!o||!l||!Number.isFinite(t?.left))return;let r=m.current,n=Nn(t.left);b.current={mode:Na({cursor:n,left:r.left,right:r.right}),startCursor:n,startLeft:r.left,startRight:r.right},w7(e,Nt)}),wK(e,Nt,()=>{o&&l&&b.current&&(b.current=null,xt(e,Nt),k())}),wV(e,Nt,()=>{o&&l&&b.current&&(b.current=null,xt(e,Nt),k())}),wY(e,Nt,(e,t)=>{o&&l&&b.current&&x(t)})},[e,o,l,x,k]),o&&s-c!=0&&l)?/*#__PURE__*/r(yi,{className:"z-[3]",children:/*#__PURE__*/r("div",{className:"relative flex h-full w-px box-border border-x-2 border-dashed border-y-0 border-chart-grid-strong bg-chart-surface opacity-40",style:{left:`${s}%`,width:`${c-s}%`}})}):null},No=Ni;function Nl(){let{dispatch:e,store:t}=ar();return u(r=>{let n=t.getState().band,a=r9(r,n,"replace");a!==n&&e({payload:{band:a}})},[e,t])}let Ns=()=>{let e=at(e=>e.band),t=at(e=>e.segments),n=m(()=>kp(e,t),[e,t]);return n.length?/*#__PURE__*/r(yi,{children:n.map(t=>/*#__PURE__*/r("div",{"data-testid":"spectrum-band","data-band-kind":e.kind,"data-band-key":t.key,className:"absolute flex h-full w-0 box-border border-y border-dashed opacity-50",style:{left:`${t.left}%`,width:`${t.width}%`,backgroundColor:e.color?`${e.color}40`:void 0,borderColor:e.color}},t.key))}):null},Nc=Ns,Nu=10,Nd=300,Nh=300,Np=30,Nf=60,Nm=()=>({mode:"idle",startX:0,startY:0,startTime:0,lastX:0,lastY:0,startCoord:null,pinchBase:null}),Ng=(e,t,r)=>Math.max(t,Math.min(e,r)),Nb=({id:e})=>{let{state:{zoom:t,segments:n,axisY:a,globalID:i},dispatch:o}=ae(),l=wW(e),s=g(null),c=g(Nm()),d=g(t),p=g(n.totalPoints),f=g(a),m=g(null);h(()=>{d.current=t},[t]),h(()=>{p.current=n.totalPoints},[n]),h(()=>{f.current=a},[a]);let b=u((e,t,r)=>({currentTarget:e,clientX:t,clientY:r}),[]),v=u(e=>{let t=Array.from(e.touches).map(e=>({x:e.clientX,y:e.clientY})),r=t.length,n=0,a=0,i=0;if(2===r){let[e,r]=t;n=Math.hypot(r.x-e.x,r.y-e.y),a=(e.x+r.x)/2,i=(e.y+r.y)/2}else 1===r&&(a=t[0].x,i=t[0].y);return{count:r,points:t,distance:n,midX:a,midY:i}},[]),y=u((e,t,r)=>{let n=b(e,t,r),a=wB(n);wQ(l)(),wY(l)(n,a)},[l,b]),w=u(e=>{let t=c.current.pinchBase,r=p.current;if(!t||t.distance<=0||e<=0)return;let n=e/t.distance;if(("x"===t.axisMode||"xy"===t.axisMode)&&d.current.show&&r){let e=SP({anchorPercent:t.anchorPercent,interval:t.interval,scale:1/n,totalPoints:r});o({payload:t=>t.zoom.interval.start===e.start&&t.zoom.interval.end===e.end?null:{zoom:{...t.zoom,interval:e,isScanSegmentsUpdateMagnify:!1}}})}("y"===t.axisMode||"xy"===t.axisMode)&&i&&(nB(i)(t.lastScale/n,t.yAnchorValue),t.lastScale=n)},[o,i]),x=g(w);x.current=w;let k=u(e=>{let t=s.current,r=c.current;if(t&&0!==e.touches.length){if(1===e.touches.length){let{clientX:n,clientY:a}=e.touches[0];r.mode="pending",r.startX=n,r.startY=a,r.startTime=Date.now(),r.lastX=n,r.lastY=a,r.startCoord=wB(b(t,n,a));return}if(2===e.touches.length){m.current?.flush(),r.mode="pinch",r.startTime=Date.now();let n=d.current,a=v(e),[i,o]=a.points,l=Math.abs(o.x-i.x),s=180*Math.atan2(Math.abs(o.y-i.y),l)/Math.PI,{start:c,end:u}=n.interval,h=wB(b(t,a.midX,a.midY)).left??0,p=t.getBoundingClientRect();if(p.height<=0||a.distance<=0){r.pinchBase=null;return}let[g,y]=f.current.realRange??[0,1],w=Ng((a.midY-p.top)/p.height,0,1);r.pinchBase={distance:a.distance,lastScale:1,interval:{start:c,end:u},anchorPercent:Ng(h,0,100),axisMode:s<30?"x":s>60?"y":"xy",yAnchorValue:y-w*(y-g),startPoints:a.points,pinchMoved:!1}}}},[v,b]),S=g(rW(e=>{if(!e||!("count"in e))return;let t=s.current,r=c.current;if(!t)return;let{count:n,points:a,distance:i}=e;if(2===n){if("pinch"===r.mode&&r.pinchBase){let e=r.pinchBase;if(!e.pinchMoved){let t={x:(a[0].x+a[1].x)/2,y:(a[0].y+a[1].y)/2},r={x:(e.startPoints[0].x+e.startPoints[1].x)/2,y:(e.startPoints[0].y+e.startPoints[1].y)/2};(Math.abs(i-e.distance)>10||Math.hypot(t.x-r.x,t.y-r.y)>10)&&(e.pinchMoved=!0)}x.current(i)}return}if(1!==n)return;let o=a[0];if("pending"===r.mode){let e=o.x-r.startX,t=o.y-r.startY;if(e*e+t*t<=100)return;r.mode="drag"}if("drag"!==r.mode)return;let u=t.getBoundingClientRect(),d={left:(o.x-r.lastX)/u.width,top:(o.y-r.lastY)/u.height},h=b(t,o.x,o.y),p=wB(h);wY(l)(h,p),wJ(l)(r.startCoord,p,d,!1),r.lastX=o.x,r.lastY=o.y})).current;m.current=S;let M=u(e=>{S(v(e))},[v,S]),F=u(e=>{S.flush();let t=s.current,r=c.current;if(!t)return;let n=e.changedTouches[0],a=n?.clientX??r.lastX,i=n?.clientY??r.lastY;if("pending"===r.mode){let e=Date.now()-r.startTime,n=a-r.startX,o=i-r.startY;n*n+o*o<=100&&e<=300&&y(t,a,i)}if(1===e.touches.length){let n=e.touches[0],a="pinch"===r.mode&&null!==r.pinchBase&&!r.pinchBase.pinchMoved&&Date.now()-r.startTime<=300;r.mode=a?"pinch":"drag",r.startX=n.clientX,r.startY=n.clientY,r.lastX=n.clientX,r.lastY=n.clientY,a||(r.pinchBase=null),r.startCoord=wB(b(t,n.clientX,n.clientY))}else 0===e.touches.length&&("pinch"===r.mode&&r.pinchBase&&!r.pinchBase.pinchMoved&&Date.now()-r.startTime<=300&&wV(l)(),r.mode="idle",r.pinchBase=null,wK(l)())},[l,y,b,S]),C=u(()=>{S.cancel();let e=c.current;e.mode="idle",e.pinchBase=null,wV(l)()},[l,S]),D=u(e=>{e.preventDefault()},[]);return h(()=>()=>{S.cancel(),wV(l)()},[l,S]),h(()=>{s.current&&(s.current.id=l)},[l]),/*#__PURE__*/r(yi,{className:"z-[5] pointer-events-auto",children:/*#__PURE__*/r("button",{ref:s,type:"button",className:iX("absolute right-0 top-0 h-full w-full appearance-none border-0 bg-transparent p-0 outline-none","touch-none select-none"),"aria-label":"Touch bus",onContextMenu:D,onTouchStart:k,onTouchMove:M,onTouchEnd:F,onTouchCancel:C})})},Nv=Nb,Ny=e=>{let{children:t,touch:a}=e,{state:{axisY:{autoranging:i},series:{enableLengthSyncFastMode:o},globalID:l}}=ae(),{id:s,chart:c,Chart:u}=iV({Render:FC,params:{autoranging:i,enableLengthSyncFastMode:o}});S$(s,rr.Spectrum);let d=Nl(),p=z1(),f=wx();return h(()=>{if(l&&c)return t$(l,e=>{c?.setDisabledClearRect(e)})},[l,c]),i3({moduleType:rr.Spectrum,chart:c,handleRender:(e,t)=>{t.updateSeries?.({data:e.data,extraData:e.extraData}),tq(s)()},eventHandlers:{autoranging:(e,t)=>{t.useRangeAutoFocus?.()},points:e=>{f(e.data)},[rn.Series]:(e,t)=>{t.setSeries?.(e)},band:e=>{d(e)},scope:e=>{p(e)}}}),/*#__PURE__*/n(yE,{children:[/*#__PURE__*/r(Db,{chart:c}),/*#__PURE__*/n(ST,{children:[/*#__PURE__*/r(FF,{}),/*#__PURE__*/r(u,{}),t,/*#__PURE__*/r(zw,{id:s}),/*#__PURE__*/r(zZ,{id:s}),a?/*#__PURE__*/r(Nb,{id:s}):/*#__PURE__*/r(SC,{id:s}),/*#__PURE__*/r(zq,{id:s}),/*#__PURE__*/r(Sk,{id:s,type:rr.Spectrum}),/*#__PURE__*/r(z8,{id:s}),/*#__PURE__*/r(DR,{id:s}),/*#__PURE__*/r(Ns,{}),/*#__PURE__*/r(z2,{}),/*#__PURE__*/r(Ni,{id:s}),/*#__PURE__*/r(zF,{id:s}),/*#__PURE__*/r(zg,{}),/*#__PURE__*/r(DC,{})]})]})},Nw=Ny,Nx=e=>{let{state:{cursor:t},dispatch:a}=ae(),{publish:i}=e,{analyzer:o}=De();return ac({publish:i,subscribe:e=>{let{pstype:t}=e;t===rn.Reset&&o?.reset(),t===rn.LevelStream&&o&&Da(o,e)}}),h(()=>{t.mode!==rr.LevelStream&&a({payload:{cursor:{...t,mode:rr.LevelStream}}})},[t,a]),/*#__PURE__*/n(am,{children:[/*#__PURE__*/r(C7,{type:rt.LevelStream}),/*#__PURE__*/r(yE,{children:/*#__PURE__*/r(Ny,{children:/*#__PURE__*/r(ST,{children:/*#__PURE__*/r(Dr,{opacity:.5})})})})]})},Nk=Nx,NS=e=>/*#__PURE__*/r(aa,{...e,cursor:{show:!0},zoom:{show:!1},signal:{show:!1},children:/*#__PURE__*/r(Nx,{...e})}),NM=tB(NS,"LevelStream"),NF=NM,NC=["100%","75%","50%","25%","0%"],ND=e=>{let{inside:t=!1}=e;return /*#__PURE__*/r("div",{className:"pointer-events-none relative z-[2] flex h-full w-full flex-col justify-between text-xs text-foreground opacity-50",style:{alignItems:t?"flex-start":"flex-end"},children:NC.map(e=>/*#__PURE__*/r("div",{className:iX("flex justify-start box-border",t?"pl-0.5 pr-0":"pr-0.5"),children:e},e))})},Nz=ND,NN=e=>{let{inside:t=!1}=e,{axisYWidth:n,marginLeft:a}=yn();return /*#__PURE__*/r("div",{className:"relative flex h-full w-auto",style:{width:n,marginLeft:a,justifyContent:t?"flex-start":"flex-end"},children:/*#__PURE__*/r(ND,{inside:t})})},NE=/*#__PURE__*/a.memo(NN),NT=e=>{let{disabled:t,inside:n}=e,{state:{axisY:a}}=ae(),{show:i}=a;return!1===i||t?null:/*#__PURE__*/r(NE,{inside:n})},NR=NT,NA=()=>/*#__PURE__*/r("div",{className:"h-0 w-full flex-1 border-t [border-color:var(--chart-grid)] first:border-t-0"}),NI=()=>{let{state:{gridLines:e}}=ae();return e&&/*#__PURE__*/n("div",{className:"pointer-events-none absolute right-0 top-0 z-[1] flex h-full w-full select-none flex-col border [border-color:var(--chart-grid)] bg-transparent",children:[/*#__PURE__*/r(NA,{}),/*#__PURE__*/r(NA,{}),/*#__PURE__*/r(NA,{}),/*#__PURE__*/r(NA,{})]})},NP=NI,NL=-200,NO=e=>`occupancy-total-line-${e}`,Nq=(e,t,r=0)=>{e&&t&&(e.style.bottom=`${r||-200}%`,t.textContent=String(r))},N$=(e,t,r)=>tF(NO(e),t,r,e),N_=(e,t=0)=>{N$(e)(t)},Nj=({id:e})=>{let t=g(null),a=g(null),i=g(`OccupancyTotalLine-${Math.random().toString(36).slice(2)}`);return h(()=>(Nq(t.current,a.current),N$(e,i.current,e=>{Nq(t.current,a.current,e)})),[e]),/*#__PURE__*/r("div",{className:"pointer-events-none absolute z-[4] h-full w-full",children:/*#__PURE__*/n("div",{ref:t,className:"absolute left-0 w-full opacity-50",style:{bottom:"-200%"},children:[/*#__PURE__*/r("div",{className:"absolute h-0 w-full border-b border-dashed border-foreground/80",style:{marginTop:"-0.5px"}}),/*#__PURE__*/r("div",{ref:a,className:"absolute right-7 -mt-7 flex h-6 items-center justify-center rounded-[var(--radius-control)] bg-secondary px-2 text-xs text-foreground",children:"0"})]})})},NH=Nj,NB=e=>{let{occupancyAxisYDisabled:t}=e,{id:a,chart:i,Chart:o}=iV({Render:Dt});return(i3({moduleType:rr.Occupancy,chart:i,handleRender:(e,t)=>{let{data:r,totalOccupancy:n}=e;r&&t.updateSeries?.(r),void 0!==n&&N_(a,n)},eventHandlers:{[rn.Reset]:(e,t)=>{t.reset(),N_(a)}}}),S$(a,rr.Occupancy),t)?/*#__PURE__*/r("div",{className:"h-full w-full",style:{...eA},[ez]:"true",children:/*#__PURE__*/n("div",{className:"relative z-[0] h-full w-full",children:[/*#__PURE__*/r(o,{}),/*#__PURE__*/r(SC,{id:a}),/*#__PURE__*/r(Nj,{id:a})]})}):/*#__PURE__*/n(yE,{children:[/*#__PURE__*/r(NT,{disabled:t}),/*#__PURE__*/n(ST,{children:[/*#__PURE__*/r(NI,{}),/*#__PURE__*/r(o,{}),/*#__PURE__*/r(SC,{id:a}),/*#__PURE__*/r(Nj,{id:a}),/*#__PURE__*/r(Sk,{id:a,type:rr.Occupancy})]})]})},NW=NB,NG=e=>{let{publish:t}=e,{state:{globalID:a}}=ae(),i=wM(rt.Scan);return ac({publish:t,subscribe:e=>{i(e),e.pstype===rn.Occupancy&&(e.data&&(tO(a).getAllRawData=t=>({...tL().getAllRawData(t),occupancyData:e.data})),((e,t,r="0")=>tI(e,t,void 0,r))(a,rr.Occupancy)({...e,pstype:rn.Render}))}}),/*#__PURE__*/n(am,{children:[/*#__PURE__*/r(yE,{children:/*#__PURE__*/r(NB,{})}),/*#__PURE__*/r(yN,{type:rt.Scan,allowScanCenterBandwidth:!1})]})},NY=NG,NU=e=>/*#__PURE__*/r(aa,{...e,zoom:{show:!1},children:/*#__PURE__*/r(NG,{...e})}),NX=tB(NU,"Occupancy"),NK=NX,NV=()=>{let e=an(),t=at(e=>e.zoom),r=at(e=>e.segments.totalPoints)??0,n=at(e=>e.axisX.frequencyFormat),{interval:{start:a,end:i},onChange:o}=t,l=m(()=>r&&n?[n((100*a+1)/r),n((100*i+1)/r)]:["",""],[a,i,r,n]);return h(()=>{r&&void 0!==l[0]&&void 0!==l[1]&&o(l,{start:a,end:i})},[l,o,r]),h(()=>{if(!r)return;let t=i-a+1,n=r/t,o=`-${a/t*100}%`,l=`${100*n}%`;e({payload:e=>({zoom:{...e.zoom,style:{left:o,width:l}}})})},[e,i,a,r]),null},NQ=NV;class NZ extends vH{constructor(e){super({id:e.id,globalID:e.globalID,chart:null,renderer:e.renderer,renderMode:e.renderMode})}init(){let{id:e,renderer:t,renderMode:r}=this.state;e&&(this.state.chart=new x({id:e,colors:this.getInitialColors(),ignoreValue:0,renderer:t,fluorescenceRenderMode:r}),this.subscribeToColor("Fluorescence-Render"))}updateProps(e){void 0!==e.renderMode&&(this.state.renderMode=e.renderMode),this.state.chart?.updateProps(e)}updateSeries(e){this.state.chart&&e&&this.state.chart.render(e)}setRenderMode(e){this.state.renderMode=e,this.state.chart?.setRenderMode(e)}}let NJ=()=>{let{state:{axisY:{range:e},fluorescence:{display:t,renderer:n,renderMode:a}}}=ae(),{chart:i,Chart:o}=iV({Render:NZ,params:{renderer:n,renderMode:a}});h(()=>{i?.updateProps({range:e})},[i,e]),h(()=>{i&&i.setRenderMode(a)},[a]),i3({moduleType:rr.Fluorescence,chart:i,renderPSTypes:[rn.Fluorescence],extractData:e=>e.data});let l=m(()=>({height:"100%",width:"100%",display:"flex",visibility:t?"visible":"hidden"}),[t]);return h(()=>{i&&i.updateProps({display:t})},[i,t]),/*#__PURE__*/r("div",{style:l,children:/*#__PURE__*/r(yE,{children:/*#__PURE__*/r(o,{})})})},N0=NJ,N1=e=>{let{type:t,heatmapElementID:a,renderer:i}=e;return /*#__PURE__*/r(vo,{id:a,children:/*#__PURE__*/n(al,{children:[/*#__PURE__*/r(C7,{type:rt.Heatmap}),/*#__PURE__*/r(M6,{renderer:i,zoomMode:"linked-x"}),/*#__PURE__*/r(yN,{type:t})]})})},N2=N1,N5=e=>{let{occupancyElementID:a,occupancyAxisYElementID:i,type:o}=e;return /*#__PURE__*/n(t,{children:[/*#__PURE__*/r(vo,{id:a,children:i?/*#__PURE__*/r(NB,{occupancyAxisYDisabled:!0}):/*#__PURE__*/n(al,{children:[/*#__PURE__*/r(C7,{type:rt.Occupancy}),/*#__PURE__*/r(NB,{}),/*#__PURE__*/r(yN,{type:o})]})}),/*#__PURE__*/r(vo,{id:i,children:/*#__PURE__*/r(NT,{inside:!0})})]})},N4=N5,N3=(e,t)=>tF(`BLAZE_PROGRESS-${e}`,"0",t,e),N6=()=>{let{state:{blaze:{show:e},segments:t,globalID:a}}=ae(),[i,o]=b(""),l=m(()=>{let e=[];for(let r=0;r<t.length;r++){let n=t[r];n.progress&&e.push(...n.progress)}return e},[t]);return(h(()=>{e&&a&&N3(a,e=>{o(l.includes(e)?void 0:`${100*e}%`)})},[e,a]),e)?/*#__PURE__*/r(yi,{children:/*#__PURE__*/n("div",{className:"absolute left-[-100%] top-0 flex h-full w-0 opacity-50",style:{left:i},children:[/*#__PURE__*/r("div",{className:"ml-[-0.5px] opacity-50",style:{borderRight:"0.5px solid var(--chart-grid-strong)"}}),/*#__PURE__*/r("div",{className:"ml-[-31px] w-[30px] opacity-20",style:{background:"linear-gradient(90deg, transparent, var(--chart-grid-strong))"}})]})}):null},N8=/*#__PURE__*/a.memo(N6),N9=()=>{let{state:{legend:{children:e}}}=ae();return /*#__PURE__*/r("div",{className:"absolute left-5 top-5 z-[6] flex h-auto w-auto items-center",children:e})},N7=N9,Ee=()=>{let{state:{segments:e}}=ae(),t=e.totalPoints??0;return /*#__PURE__*/r(yi,{className:"z-[0]",children:e.map((e,n)=>/*#__PURE__*/r("div",{className:"h-full border-x",style:{width:t>0?`${100*e.point/t}%`:0,borderColor:n%2==1?"var(--chart-grid)":"transparent",background:n%2==1?"var(--chart-surface)":"transparent",opacity:n%2==1?.4:1}},`${e.start}_${e.stop}_${e.index}`))})},Et=Ee,Er=({globalID:e})=>({handleMarkerPublish:u(t=>{if(e)switch(t.pstype){case rn.Marker:Co(e)(t);break;case rn.Reset:Co(e)({type:ro.Clear})}},[e])}),En=Er;function Ea(){let e=an();return u(()=>{e({payload:e=>e.axisY.fieldStrengthUnitAvailable?null:{axisY:{...e.axisY,fieldStrengthUnitAvailable:!0}}})},[e])}function Ei({segmentOffset:e,offset:t}){let r={};return void 0!==e&&(r.segmentOffset=e),void 0!==t&&(r.offset=t),void 0!==r.segmentOffset||void 0!==r.offset?r:void 0}function Eo(e,t){"thresholdData"in t&&e.setThresholdData(t.thresholdData,Ei(t))}function El(){let e=at(e=>e.signal.onChange),t=g(e);return f(()=>{t.current=e},[e]),u(e=>{let r=t.current;r&&r(e.regions.map(t=>({...t,frequency:t.centerFrequency,timestamp:e.timestamp})),e)},[])}function Es(e){let{state:{globalID:t,series:{enableMetrics:r,enableWaterfall:n},fluorescence:{show:a},axisY:{unit:i},zoom:{interval:o},heatmapCapture:{display:l},system:{width:s},marker:c,signal:d}}=ae(),p=g(null),f=g(t),m=g(o),b=g(0),v=El(),y=d.templateDetection??e?.processing?.enableTemplateDetection??!1;h(()=>{p.current?.updateProcessing({enableTemplateDetection:y})},[y]);let w=g(null),{updateSignalData:x}=z6(),k=Ea(),S=g(l);h(()=>{S.current=l},[l]);let M=u(e=>{((e,t,r="0")=>tI(e,t,void 0,r))(f.current,rr.Spectrum)({pstype:rn.Render,data:e})},[]),F=u(e=>{((e,t,r="0")=>tI(e,t,void 0,r))(f.current,rr.Heatmap)({pstype:rn.Render,data:e})},[]),C=u(e=>{N3(f.current)?.(e)},[]),D=u(e=>{(e.realData||e.templateData||e.backgroundNoiseData||"thresholdData"in e)&&M({minData:e.minData,maxData:e.maxData,avgData:e.avgData,thresholdData:e.thresholdData,backgroundNoiseData:e.backgroundNoiseData,realData:e.realData,templateData:e.templateData}),e.scanProgress&&C(e.scanProgress),e.templateDetection&&v(e.templateDetection),e.waterfallData&&F(e.waterfallData),e.fluorescenceData&&((e,t,r="0")=>tI(e,t,void 0,r))(f.current,rr.Fluorescence)({pstype:rn.Fluorescence,data:{fluorescenceData:e.fluorescenceData,fluorescenceMaxCount:e.fluorescenceMaxCount}}),e.occupancyData&&((e,t,r="0")=>tI(e,t,void 0,r))(f.current,rr.Occupancy)({pstype:rn.Render,data:e.occupancyData,totalOccupancy:b.current}),e.extraData&&((e,t,r="0")=>tI(e,t,void 0,r))(f.current,rr.Spectrum)({pstype:rn.Render,extraData:e.extraData})},[M,F,C,v]);h(()=>{f.current=t},[t]);let z=(e,t)=>!1!==e&&(t??!0);if(!p.current&&t){let i=Math.min(1|Math.floor(2*s),1001);p.current=new O({...e,outputPoints:i,processing:{...e?.processing,enableMetrics:z(r,e?.processing?.enableMetrics),enableWaterfall:z(n,e?.processing?.enableWaterfall),enableTemplateDetection:y,enableFluorescence:a,enablePeakStats:!!c?.enabled},onSpectrumUpdate:D});let o=tO(t),l=p.current;o.getAllRawData=e=>l.getAllRawData(e),t_(t,p.current)}h(()=>{let e=Math.floor(o.start),t=Math.ceil(o.end),r=Math.floor(m.current.start),n=Math.ceil(m.current.end);(e!==r||t!==n)&&p.current&&(m.current=o,p.current.updateSamplingRange(e,t+1))},[o]);let N=u(async(e=!1)=>{setTimeout(()=>{((e,t,r="0")=>tI(e,t,void 0,r))(f.current,rr.Heatmap)({pstype:rn.Reset}),((e,t,r="0")=>tI(e,t,void 0,r))(f.current,rr.Spectrum)({pstype:rn.Reset}),((e,t,r="0")=>tI(e,t,void 0,r))(f.current,rr.Occupancy)({pstype:rn.Reset}),e&&wh(f.current)},1)},[]),E=u(async e=>{if(p.current)switch(e.pstype){case rn.AntennaFactor:p.current.setAntennaFactor(e.data),e.data.length>0&&k();break;case rn.Signal:x({type:e.type,data:e.data});break;case rn.Spectrum:e.data&&p.current.process(e),Eo(p.current,e),e.maxData&&p.current.setMaxData(e.maxData),e.minData&&p.current.setMinData(e.minData),e.avgData&&p.current.setAvgData(e.avgData),e.templateData&&p.current.setTemplateData(e.templateData,e.templateTolerance),e.backgroundNoiseData&&p.current.setBackgroundNoiseData(e.backgroundNoiseData),e.extraData&&p.current.setExtraData(e.extraData,I.MERGE,e.segmentedExtraData?{segmentOffset:e.segmentOffset,offset:e.offset}:void 0);break;case rn.Fluorescence:e.data&&p.current&&p.current.setFluorescenceData(e.data.fluorescenceData,e.data.fluorescenceMaxCount);break;case rn.Heatmap:if(e.data){let{data:t,timestamps:r}=e,n=rJ(t,r);p.current.setWaterfallData(n)}break;case rn.Occupancy:p.current?.setOccupancyData(e.data),b.current=e.totalOccupancy;break;case rn.Segments:p.current.initializeSegments(e.data),await N(),e.onFinally?.();break;case rn.SpectrumBandwidth:p.current.reset();break;case rn.Series:wd(f.current,e);break;case rn.Reset:p.current.reset(),await N(!0),e.onFinally?.();break;case rn.Clear:p.current.reset(),await N(!1),e.onFinally?.()}},[k,x,wd,N]);return h(()=>{let e=i.includes("/m");p.current?.setAntennaFactorSwitch(e)},[i]),h(()=>{if(!p.current)return;let t=z(r,e?.processing?.enableMetrics);t!==w.current&&(p.current.updateProcessing({enableMetrics:t}),w.current=t)},[r,e?.processing?.enableMetrics]),E}let Ec=e=>{let{state:{globalID:a}}=ae(),i=g([]),o=g(""),{type:l=rt.SingleFrequency,publish:s,heatmapElementID:c,occupancyElementID:u,occupancyAxisYElementID:d,touch:h,children:p,processing:f,renderer:m}=e,{enableMetrics:b,enableWaterfall:v}=wy({type:l,heatmapElementID:c}),y=Es({processing:{enableWaterfall:v,enableMetrics:b,...f}}),w=wM(l);wF(h);let{handleMarkerPublish:x}=Er({globalID:a});return ac({publish:s,subscribe:e=>{if(y(e),x(e),w(e),e.pstype===rn.Heatmap){let{data:t,timestamps:r}=e;if(i.current=rJ(t,r),o.current!==a){let e=tO(a),t=e.getAllRawData;e.getAllRawData=e=>({...t(e),waterfallData:i.current}),o.current=a}}((e,t,r="0")=>tI(e,t,void 0,r))(a,rr.Spectrum)(e),((e,t,r="0")=>tI(e,t,void 0,r))(a,rr.Heatmap)(e),((e,t,r="0")=>tI(e,t,void 0,r))(a,rr.Occupancy)(e),e.pstype!==rn.Fluorescence&&((e,t,r="0")=>tI(e,t,void 0,r))(a,rr.Fluorescence)(e)}}),/*#__PURE__*/n(am,{children:[/*#__PURE__*/r(C7,{type:l}),/*#__PURE__*/n(yE,{children:[/*#__PURE__*/r(Ny,{touch:h,children:p||/*#__PURE__*/r(NJ,{})}),/*#__PURE__*/r(N1,{type:l,heatmapElementID:c,renderer:m}),/*#__PURE__*/r(N5,{type:l,occupancyElementID:u,occupancyAxisYElementID:d}),/*#__PURE__*/n(ST,{children:[/*#__PURE__*/r(NV,{}),l===rt.Scan&&/*#__PURE__*/n(t,{children:[/*#__PURE__*/r(Ee,{}),/*#__PURE__*/r(N8,{})]}),/*#__PURE__*/r(N9,{})]})]}),/*#__PURE__*/r(yN,{type:l})]})},Eu=Ec,Ed="singleFrequency",Eh="slider",Ep=e=>"slider"===e?"deltaMeasurement":"default",Ef=e=>{let t=e.type??Ed;if(!e.heatmapElementID||t!==Ed&&"scan"!==t&&"mscan"!==t)return e;let r=e.heatmapCapture?.type??"slider",n=e.heatmapCapture?.toolbarVariant??Ep(r);return{...e,heatmapCapture:{show:!0,display:!1,...e.heatmapCapture,type:r,toolbarVariant:n}}},Em=e=>{let t=Ef(e);return /*#__PURE__*/r(aa,{...t,children:/*#__PURE__*/r(Ec,{...t})})},Eg=tB(Em,"Spectrum"),Eb=Eg;function Ev(e={}){let{onChange:t,sizes:r,tokens:n}=e;th({sizes:r,tokens:n});let a=od();return{cleanup:t?oh(e=>t(e)):void 0,...a}}var Ey=/*#__PURE__*/function(e){return e.Station="station",e.Simple="simple",e}({});th();export{w as DialDirectionLabelMode,oR as AudioWaveform,vZ as Dial,ye as Gauge,Fh as Heatmap,FL as IQ,NF as LevelStream,NK as Occupancy,Eb as Spectrum,t7 as AxisPlacement,re as AxisXLabelMode,rt as ChartType,t9 as FrequencyUnit,ro as MarkerEventType,rr as ModuleType,ra as OptionKey,rn as PSType,ri as SegmentsEvent,rc as SeriesType,rl as ToolType,rs as ToolbarItemType,rC as formatFrequencyUnit,rz as formatFrequencyUnitFromHz,rD as formatFrequencyUnitFromMHz,od as getChartsThemeState,nn as HeatmapCaptureType,Ev as initChartsTheme,nt as MarkerMode,DK as setFrequencyAllocationChannelsToCache,DX as setFrequencyAllocationToCache,Ey as SignalDataType,oh as subscribeChartsThemeChange,ad as useSafePublish,tB as withChartPublisher};
|