import{S as ft}from"./index.c93dfeeb.js";import{e as _t,q as gt,_ as wt}from"./index.bc35d8cd.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import{d as bt,r as Ft,o as yt,bp as ht,bY as xt,bU as St,aU as Ct,bB as Dt,bN as At,bC as Et,C as g,D as x,aI as u,aH as l,u as Bt,aM as m,aN as S,bw as et,G as ot,bx as nt,aK as D,aJ as A,aE as E,n as st,ba as Vt,bX as vt,aZ as Tt,b8 as Pt,bZ as It,bD as Ut,bM as kt}from"./arco.beabb834.js";import{e as U,g as ut,h as i,f as c,s as Ot}from"./serial.b70f48dc.js";import{u as Nt}from"./loading.04079284.js";import"./chart.83b8c11b.js";import"./vue.30c84055.js";const Mt={class:"container"},Ht=["innerHTML"],Yt={name:"Sat"},Lt=bt({...Yt,setup(qt){const{loading:rt,setLoading:_}=Nt(!0),a=_t(),t=Ft({showh:0,status:"\u70B9\u51FB\u5199\u5165\u6309\u94AE\u5199\u5165\u536B\u661F\u6570\u636E\u5230\u8BBE\u5907

",sat:"",satData:[],lng:0,lat:0,alt:0,tx:0,rx:0,txTone:0,rxTone:0,CTCSSOption:[67,69.3,71.9,74.4,77,79.7,82.5,85.4,88.5,91.5,94.8,97.4,100,103.5,107.2,110.9,114.8,118.8,123,127.3,131.8,136.5,141.3,146.2,151.4,156.7,159.8,162.2,165.5,167.9,171.3,173.8,177.3,179.9,183.5,186.2,189.9,192.8,196.6,199.5,203.5,206.5,210.7,218.1,225.7,229.1,233.6,241.8,250.3,254.1],pass:void 0,passOption:[],dt:"",timer:void 0,passCustom:void 0,dtCustom:void 0,freqDb:[]});yt(async()=>{const r=await(await fetch("https://mirror.ghproxy.com/https://raw.githubusercontent.com/palewire/ham-satellite-database/main/data/amsat-active-frequencies.json")).text();t.freqDb=JSON.parse(r),t.timer=setInterval(()=>{t.dt=new Date().toLocaleString("zh-CN",{timeZone:"Asia/Shanghai"})},1e3)}),ht(()=>{try{clearInterval(t.timer)}catch{}});const lt=()=>{t.showh+=1},it=async()=>{if(a.connectState!=!0){alert("\u8BF7\u5148\u8FDE\u63A5\u624B\u53F0\uFF01");return}_(!0),await U(a.connectPort),await k(),await ut(a.connectPort),_(!1)},k=async()=>{var n;const r=t.dtCustom?new Date(t.dtCustom):new Date,e=[...i(parseInt(r.getFullYear().toString().substring(2,4)).toString(16)),...i((r.getMonth()+1).toString(16)),...i(r.getDate().toString(16)),...i(r.getHours().toString(16)),...i(r.getMinutes().toString(16)),...i(r.getSeconds().toString(16))];await c(a.connectPort,11200,new Uint8Array(e),6,(n=a.configuration)==null?void 0:n.uart)},pt=async r=>{const e=t.satData.find(n=>n.name==r);if(e&&e.path){t.status+="
\u536B\u661F\u53C2\u6570\uFF1A
",e.path.map(o=>{t.status+=o+"
"});let n=!1;t.freqDb.map(o=>{e.path[1].split(" ")[1]==o.norad_id&&o.mode.indexOf("FM")!=-1&&(n=!0,t.tx=parseFloat(o.uplink),t.rx=parseFloat(o.downlink),t.txTone=parseFloat(t.CTCSSOption.reduce((d,y)=>o.mode.indexOf(y)!=-1?y:d)))}),n||(t.tx=0,t.rx=0,t.txTone=0,t.rxTone=0)}st(()=>{const n=document==null?void 0:document.getElementById("statusArea");n&&(n.scrollTop=n==null?void 0:n.scrollHeight)})};(async()=>{_(!0);const e=(await(await fetch("https://celestrak.org/NORAD/elements/amateur.txt")).text()).split(/\r?\n/),n=[];let o={};for(let d=0;d{_(!0),navigator.geolocation.getCurrentPosition(r=>{r.coords&&(t.lat=r.coords.latitude,t.lng=r.coords.longitude,r.coords.altitude&&(t.alt=r.coords.altitude))}),_(!1)};O();const ct=async(r=0,e)=>{var n;await U(a.connectPort);for(let o=r;o",st(()=>{const d=document==null?void 0:document.getElementById("statusArea");d&&(d.scrollTop=d==null?void 0:d.scrollHeight)});t.status=t.status+"\u5199\u5165\u8FDB\u5EA6\uFF1A100.0%
"},dt=async()=>{if(!t.sat){alert("\u8BF7\u9009\u62E9\u536B\u661F\uFF01");return}_(!0);const r=await(await fetch("https://k5.vicicode.com/api/pass",{method:"POST",mode:"cors",headers:{"Content-Type":"application/json"},body:JSON.stringify({sat:t.sat,sat_line_1:t.satData.find(n=>n.name==t.sat).path[0],sat_line_2:t.satData.find(n=>n.name==t.sat).path[1],lat:t.lat,lng:t.lng,alt:t.alt})})).json(),e=[];for(let n=0;n0?o=[r.pass_times[n],r.departure_times[n]]:o=[r.pass_times[n],r.departure_times[n+1]],e.push(o)}catch{}e.length>0?t.pass=e[0][0]+"|"+e[0][1]:t.pass=void 0,t.passOption=e,_(!1)},mt=async()=>{var N,M,H,Y,L,q,j,R,J,$,z,Z,G,K,X,Q,W,tt;if(a.connectState!=!0){alert("\u8BF7\u5148\u8FDE\u63A5\u624B\u53F0\uFF01");return}if(((N=a.configuration)==null?void 0:N.sat)!=!0){alert("\u56FA\u4EF6\u7248\u672C\u4E0D\u5339\u914D");return}if(!t.sat){alert("\u8BF7\u9009\u62E9\u536B\u661F\uFF01");return}if(t.passCustom&&(t.pass=t.passCustom[0]+"|"+t.passCustom[1]),!t.pass){alert("\u8BF7\u9009\u62E9\u8FC7\u5883\u65F6\u95F4\uFF01");return}_(!0);const r=await(await fetch("https://k5.vicicode.com/api/doppler",{method:"POST",mode:"cors",headers:{"Content-Type":"application/json"},body:JSON.stringify({sat:t.sat,sat_line_1:t.satData.find(F=>F.name==t.sat).path[0],sat_line_2:t.satData.find(F=>F.name==t.sat).path[1],lat:t.lat,lng:t.lng,alt:t.alt,tx:t.tx,rx:t.rx,pass_time:t.pass.split("|")[0],departure_time:t.pass.split("|")[1]})})).json(),e=t.sat,n=t.pass.split("|")[0],o=n.split("-")[0].substring(2,4),d=n.split("-")[1],y=n.split("-")[2].split(" ")[0],w=n.split(" ")[1].split(":")[0],h=n.split(" ")[1].split(":")[1],b=n.split(" ")[1].split(":")[2],f=t.pass.split("|")[1],B=f.split("-")[0].substring(2,4),V=f.split("-")[1],v=f.split("-")[2].split(" ")[0],T=f.split(" ")[1].split(":")[0],P=f.split(" ")[1].split(":")[1],I=f.split(" ")[1].split(":")[2];await U(a.connectPort);let p=new Uint8Array(10);p.set(Ot(e.trim()).subarray(0,9)),await c(a.connectPort,11168,p,10,(M=a.configuration)==null?void 0:M.uart),await c(a.connectPort,11178,i(parseInt(o).toString(16)).subarray(0,1),1,(H=a.configuration)==null?void 0:H.uart),await c(a.connectPort,11179,i(parseInt(d).toString(16)).subarray(0,1),1,(Y=a.configuration)==null?void 0:Y.uart),await c(a.connectPort,11180,i(parseInt(y).toString(16)).subarray(0,1),1,(L=a.configuration)==null?void 0:L.uart),await c(a.connectPort,11181,i(parseInt(w).toString(16)).subarray(0,1),1,(q=a.configuration)==null?void 0:q.uart),await c(a.connectPort,11182,i(parseInt(h).toString(16)).subarray(0,1),1,(j=a.configuration)==null?void 0:j.uart),await c(a.connectPort,11183,i(parseInt(b).toString(16)).subarray(0,1),1,(R=a.configuration)==null?void 0:R.uart),await c(a.connectPort,11184,i(parseInt(B).toString(16)).subarray(0,1),1,(J=a.configuration)==null?void 0:J.uart),await c(a.connectPort,11185,i(parseInt(V).toString(16)).subarray(0,1),1,($=a.configuration)==null?void 0:$.uart),await c(a.connectPort,11186,i(parseInt(v).toString(16)).subarray(0,1),1,(z=a.configuration)==null?void 0:z.uart),await c(a.connectPort,11187,i(parseInt(T).toString(16)).subarray(0,1),1,(Z=a.configuration)==null?void 0:Z.uart),await c(a.connectPort,11188,i(parseInt(P).toString(16)).subarray(0,1),1,(G=a.configuration)==null?void 0:G.uart),await c(a.connectPort,11189,i(parseInt(I).toString(16)).subarray(0,1),1,(K=a.configuration)==null?void 0:K.uart),p=new Uint8Array(2),p.set(i(((Date.parse(f)-Date.parse(n))/1e3).toString(16)).subarray(0,2)),await c(a.connectPort,11190,p,2,(X=a.configuration)==null?void 0:X.uart),p=new Uint8Array(2),t.txTone&&t.txTone>0&&p.set(i(parseInt((t.txTone*10).toFixed(0)).toString(16)).subarray(0,2)),await c(a.connectPort,11192,p,2,(Q=a.configuration)==null?void 0:Q.uart),p=new Uint8Array(2),t.rxTone&&t.rxTone>0&&p.set(i(parseInt((t.rxTone*10).toFixed(0)).toString(16)).subarray(0,2)),await c(a.connectPort,11194,p,2,(W=a.configuration)==null?void 0:W.uart),p=new Uint8Array(4),p.set(i(((Date.parse(n)-Date.parse("2000-01-01 00:00:00"))/1e3).toString(16)).subarray(0,4)),await c(a.connectPort,11196,p,4,(tt=a.configuration)==null?void 0:tt.uart);const s=[];r.shift_array.filter((F,C)=>C%2===0).map(F=>{const C=new Uint8Array(4),at=new Uint8Array(4);C.set(i(parseInt(((t.tx*1e6+F[0])/10).toFixed(0)).toString(16))),at.set(i(parseInt(((t.rx*1e6+F[1])/10).toFixed(0)).toString(16))),s.push(...C,...at)}),p=new Uint8Array(7680),p.set(new Uint8Array(s).subarray(0,7680)),await ct(123392,p),await k(),await ut(a.connectPort),_(!1)};return(r,e)=>{const n=gt,o=Vt,d=xt,y=ft,w=vt,h=St,b=Ct,f=Tt,B=Pt,V=It,v=Dt,T=At,P=Et,I=Ut,p=kt;return g(),x("div",Mt,[u(n,{items:["\u5C0F\u5DE5\u5177","\u536B\u661F\u5199\u5165"]}),u(p,{gutter:20,align:"stretch"},{default:l(()=>[u(I,{span:24},{default:l(()=>[u(P,{class:"general-card",title:"\u536B\u661F\u5199\u5165"},{default:l(()=>[u(T,{loading:Bt(rt),style:{width:"100%"},tip:"\u6B63\u5728\u5904\u7406 ..."},{default:l(()=>[u(o,{"label-col-style":{width:"25%"},field:"dt",label:"\u6D4F\u89C8\u5668\u65F6\u95F4",onClick:lt},{default:l(()=>[m(S(t.dt),1)]),_:1}),et(u(o,{"label-col-style":{width:"25%"},field:"dtCustom",label:"\u81EA\u5B9A\u4E49\u65F6\u95F4"},{default:l(()=>[ot("div",null,[u(d,{style:{width:"220px",margin:"0 24px 24px 0"},"show-time":"","time-picker-props":{defaultValue:"00:00:00"},format:"YYYY-MM-DD HH:mm:ss",modelValue:t.dtCustom,"onUpdate:modelValue":e[0]||(e[0]=s=>t.dtCustom=s)},null,8,["modelValue"]),m(" \xA0\xA0"),u(y,{size:"small",theme:"success",onClick:it},{default:l(()=>[m("\u5199\u5165\u65F6\u95F4\u5230\u53F0\u7AD9")]),_:1})])]),_:1},512),[[nt,t.showh>=5]]),u(o,{"label-col-style":{width:"25%"},field:"sat",label:"\u9009\u62E9\u536B\u661F"},{default:l(()=>[u(h,{modelValue:t.sat,"onUpdate:modelValue":e[1]||(e[1]=s=>t.sat=s),onChange:pt,placeholder:"\u9009\u62E9\u536B\u661F ...","allow-search":"","allow-clear":""},{default:l(()=>[(g(!0),x(D,null,A(t.satData,s=>(g(),E(w,{key:s.name,value:s.name},{default:l(()=>[m(S(s.name),1)]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"])]),_:1}),u(o,{"label-col-style":{width:"25%"},field:"lng",label:"\u53F0\u7AD9\u7ECF\u5EA6"},{default:l(()=>[u(b,{precision:6,modelValue:t.lng,"onUpdate:modelValue":e[2]||(e[2]=s=>t.lng=s)},null,8,["modelValue"])]),_:1}),u(o,{"label-col-style":{width:"25%"},field:"lat",label:"\u53F0\u7AD9\u7EAC\u5EA6"},{default:l(()=>[u(b,{precision:6,modelValue:t.lat,"onUpdate:modelValue":e[3]||(e[3]=s=>t.lat=s)},null,8,["modelValue"])]),_:1}),u(o,{"label-col-style":{width:"25%"},field:"alt",label:"\u53F0\u7AD9\u6D77\u62D4"},{default:l(()=>[u(b,{precision:0,modelValue:t.alt,"onUpdate:modelValue":e[4]||(e[4]=s=>t.alt=s)},null,8,["modelValue"])]),_:1}),u(o,{"label-col-style":{width:"25%"},label:""},{default:l(()=>[u(B,null,{default:l(()=>[u(f,{onClick:O},{default:l(()=>[m("\u6D4F\u89C8\u5668\u83B7\u53D6\u7ECF\u7EAC\u5EA6")]),_:1}),u(f,{onClick:dt},{default:l(()=>[m("\u83B7\u53D6\u536B\u661F\u8FC7\u5883\u65F6\u95F4")]),_:1})]),_:1})]),_:1}),u(o,{"label-col-style":{width:"25%"},field:"pass",label:"\u9009\u62E9\u8FC7\u5883\u65F6\u95F4"},{default:l(()=>[u(h,{modelValue:t.pass,"onUpdate:modelValue":e[5]||(e[5]=s=>t.pass=s),"allow-search":"","allow-clear":""},{default:l(()=>[(g(!0),x(D,null,A(t.passOption,s=>(g(),E(w,{key:s[0]+"|"+s[1],value:s[0]+"|"+s[1]},{default:l(()=>[m(S(s[0]+" - "+s[1]),1)]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"])]),_:1}),et(u(o,{"label-col-style":{width:"25%"},field:"passCustom",label:"\u81EA\u5B9A\u4E49\u8FC7\u5883\u65F6\u95F4"},{default:l(()=>[u(V,{style:{width:"360px",margin:"0 24px 24px 0"},"show-time":"","time-picker-props":{defaultValue:["00:00:00","00:00:00"]},format:"YYYY-MM-DD HH:mm:ss",modelValue:t.passCustom,"onUpdate:modelValue":e[6]||(e[6]=s=>t.passCustom=s)},null,8,["modelValue"])]),_:1},512),[[nt,t.showh>=5]]),u(o,{"label-col-style":{width:"25%"},field:"tx",label:"\u4E0A\u884C\u9891\u7387"},{default:l(()=>[u(b,{precision:5,modelValue:t.tx,"onUpdate:modelValue":e[7]||(e[7]=s=>t.tx=s)},null,8,["modelValue"])]),_:1}),u(o,{"label-col-style":{width:"25%"},field:"txTone",label:"\u4E0A\u884C\u4E9A\u97F3"},{default:l(()=>[u(h,{modelValue:t.txTone,"onUpdate:modelValue":e[8]||(e[8]=s=>t.txTone=s),"allow-search":"","allow-clear":""},{default:l(()=>[u(w,{value:0},{default:l(()=>[m("\u5173\u95ED")]),_:1}),(g(!0),x(D,null,A(t.CTCSSOption,s=>(g(),E(w,{key:s,value:s},{default:l(()=>[m(S(s.toFixed(1)),1)]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"])]),_:1}),u(o,{"label-col-style":{width:"25%"},field:"rx",label:"\u4E0B\u884C\u9891\u7387"},{default:l(()=>[u(b,{precision:5,modelValue:t.rx,"onUpdate:modelValue":e[9]||(e[9]=s=>t.rx=s)},null,8,["modelValue"])]),_:1}),u(o,{"label-col-style":{width:"25%"},field:"rxTone",label:"\u4E0B\u884C\u4E9A\u97F3"},{default:l(()=>[u(h,{modelValue:t.rxTone,"onUpdate:modelValue":e[10]||(e[10]=s=>t.rxTone=s),"allow-search":"","allow-clear":""},{default:l(()=>[u(w,{value:0},{default:l(()=>[m("\u5173\u95ED")]),_:1}),(g(!0),x(D,null,A(t.CTCSSOption,s=>(g(),E(w,{key:s,value:s},{default:l(()=>[m(S(s.toFixed(1)),1)]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"])]),_:1}),u(o,{"label-col-style":{width:"25%"},label:""},{default:l(()=>[u(f,{onClick:mt},{default:l(()=>[m("\u5199\u5165\u6570\u636E")]),_:1})]),_:1}),u(v),ot("div",{id:"statusArea",style:{height:"20em","background-color":"azure",color:"silver",overflow:"auto",padding:"20px"},innerHTML:t.status},null,8,Ht)]),_:1},8,["loading"])]),_:1})]),_:1})]),_:1})])}}});const ra=wt(Lt,[["__scopeId","data-v-3ba8c8cd"]]);export{ra as default};