import{S as pt}from"./index.c93dfeeb.js";import{e as ct,q as dt,_ as mt}from"./index.43ad98d3.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import{d as _t,r as ft,o as gt,bp as wt,bY as bt,bU as yt,aU as Ft,bB as xt,bN as ht,bC as St,C as g,D as x,aI as s,aH as r,u as Ct,aM as m,aN as h,G as at,aK as C,aJ as D,aE as A,n as et,ba as Dt,bX as At,aZ as Bt,b8 as Et,bZ as Vt,bD as vt,bM as Tt}from"./arco.beabb834.js";import{e as U,g as ot,h as i,f as c,s as Pt}from"./serial.b70f48dc.js";import{u as It}from"./loading.04079284.js";import"./chart.83b8c11b.js";import"./vue.30c84055.js";const Ut={class:"container"},kt=["innerHTML"],Ot={name:"Sat"},Nt=_t({...Ot,setup(Mt){const{loading:nt,setLoading:f}=It(!0),a=ct(),t=ft({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});gt(()=>{t.timer=setInterval(()=>{t.dt=new Date().toLocaleString("zh-CN",{timeZone:"Asia/Shanghai"})},1e3)}),wt(()=>{try{clearInterval(t.timer)}catch{}});const st=async()=>{if(a.connectState!=!0){alert("\u8BF7\u5148\u8FDE\u63A5\u624B\u53F0\uFF01");return}f(!0),await U(a.connectPort),await k(),await ot(a.connectPort),f(!1)},k=async()=>{var n;const l=t.dtCustom?new Date(t.dtCustom):new Date,e=[...i(parseInt(l.getFullYear().toString().substring(2,4)).toString(16)),...i((l.getMonth()+1).toString(16)),...i(l.getDate().toString(16)),...i(l.getHours().toString(16)),...i(l.getMinutes().toString(16)),...i(l.getSeconds().toString(16))];await c(a.connectPort,11200,new Uint8Array(e),6,(n=a.configuration)==null?void 0:n.uart)},ut=async l=>{const e=t.satData.find(n=>n.name==l);e&&e.path&&(t.status+="
\u536B\u661F\u53C2\u6570\uFF1A
",e.path.map(n=>{t.status+=n+"
"})),et(()=>{const n=document==null?void 0:document.getElementById("statusArea");n&&(n.scrollTop=n==null?void 0:n.scrollHeight)})};(async()=>{f(!0);const e=(await(await fetch("https://celestrak.org/NORAD/elements/amateur.txt")).text()).split(/\r?\n/),n=[];let u={};for(let d=0;d{f(!0),navigator.geolocation.getCurrentPosition(l=>{l.coords&&(t.lat=l.coords.latitude,t.lng=l.coords.longitude,l.coords.altitude&&(t.alt=l.coords.altitude))}),f(!1)};O();const rt=async(l=0,e)=>{var n;await U(a.connectPort);for(let u=l;u",et(()=>{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%
"},lt=async()=>{if(!t.sat){alert("\u8BF7\u9009\u62E9\u536B\u661F\uFF01");return}f(!0);const l=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?u=[l.pass_times[n],l.departure_times[n]]:u=[l.pass_times[n],l.departure_times[n+1]],e.push(u)}catch{}e.length>0?t.pass=e[0][0]+"|"+e[0][1]:t.pass=void 0,t.passOption=e,f(!1)},it=async()=>{var N,M,H,Y,L,R,j,$,z,J,Z,q,G,K,X,Q,W;if(a.connectState!=!0){alert("\u8BF7\u5148\u8FDE\u63A5\u624B\u53F0\uFF01");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}f(!0);const l=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(y=>y.name==t.sat).path[0],sat_line_2:t.satData.find(y=>y.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],u=n.split("-")[0].substring(2,4),d=n.split("-")[1],B=n.split("-")[2].split(" ")[0],w=n.split(" ")[1].split(":")[0],F=n.split(" ")[1].split(":")[1],b=n.split(" ")[1].split(":")[2],_=t.pass.split("|")[1],E=_.split("-")[0].substring(2,4),V=_.split("-")[1],v=_.split("-")[2].split(" ")[0],T=_.split(" ")[1].split(":")[0],P=_.split(" ")[1].split(":")[1],I=_.split(" ")[1].split(":")[2];await U(a.connectPort);let p=new Uint8Array(10);p.set(Pt(e.trim()).subarray(0,9)),await c(a.connectPort,11168,p,10,(N=a.configuration)==null?void 0:N.uart),await c(a.connectPort,11178,i(parseInt(u).toString(16)).subarray(0,1),1,(M=a.configuration)==null?void 0:M.uart),await c(a.connectPort,11179,i(parseInt(d).toString(16)).subarray(0,1),1,(H=a.configuration)==null?void 0:H.uart),await c(a.connectPort,11180,i(parseInt(B).toString(16)).subarray(0,1),1,(Y=a.configuration)==null?void 0:Y.uart),await c(a.connectPort,11181,i(parseInt(w).toString(16)).subarray(0,1),1,(L=a.configuration)==null?void 0:L.uart),await c(a.connectPort,11182,i(parseInt(F).toString(16)).subarray(0,1),1,(R=a.configuration)==null?void 0:R.uart),await c(a.connectPort,11183,i(parseInt(b).toString(16)).subarray(0,1),1,(j=a.configuration)==null?void 0:j.uart),await c(a.connectPort,11184,i(parseInt(E).toString(16)).subarray(0,1),1,($=a.configuration)==null?void 0:$.uart),await c(a.connectPort,11185,i(parseInt(V).toString(16)).subarray(0,1),1,(z=a.configuration)==null?void 0:z.uart),await c(a.connectPort,11186,i(parseInt(v).toString(16)).subarray(0,1),1,(J=a.configuration)==null?void 0:J.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,(q=a.configuration)==null?void 0:q.uart),await c(a.connectPort,11189,i(parseInt(I).toString(16)).subarray(0,1),1,(G=a.configuration)==null?void 0:G.uart),p=new Uint8Array(2),p.set(i(((Date.parse(_)-Date.parse(n))/1e3).toString(16)).subarray(0,2)),await c(a.connectPort,11190,p,2,(K=a.configuration)==null?void 0:K.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,(X=a.configuration)==null?void 0:X.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,(Q=a.configuration)==null?void 0:Q.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,(W=a.configuration)==null?void 0:W.uart);const o=[];l.shift_array.filter((y,S)=>S%2===0).map(y=>{const S=new Uint8Array(4),tt=new Uint8Array(4);S.set(i(parseInt(((t.tx*1e6+y[0])/10).toFixed(0)).toString(16))),tt.set(i(parseInt(((t.rx*1e6+y[1])/10).toFixed(0)).toString(16))),o.push(...S,...tt)}),p=new Uint8Array(7680),p.set(new Uint8Array(o).subarray(0,7680)),await rt(123392,p),await k(),await ot(a.connectPort),f(!1)};return(l,e)=>{const n=dt,u=Dt,d=bt,B=pt,w=At,F=yt,b=Ft,_=Bt,E=Et,V=Vt,v=xt,T=ht,P=St,I=vt,p=Tt;return g(),x("div",Ut,[s(n,{items:["\u5C0F\u5DE5\u5177","\u536B\u661F\u5199\u5165"]}),s(p,{gutter:20,align:"stretch"},{default:r(()=>[s(I,{span:24},{default:r(()=>[s(P,{class:"general-card",title:"\u536B\u661F\u5199\u5165"},{default:r(()=>[s(T,{loading:Ct(nt),style:{width:"100%"},tip:"\u6B63\u5728\u5904\u7406 ..."},{default:r(()=>[s(u,{"label-col-style":{width:"25%"},field:"dt",label:"\u6D4F\u89C8\u5668\u65F6\u95F4"},{default:r(()=>[m(h(t.dt),1)]),_:1}),s(u,{"label-col-style":{width:"25%"},field:"dtCustom",label:"\u81EA\u5B9A\u4E49\u65F6\u95F4"},{default:r(()=>[at("div",null,[s(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]=o=>t.dtCustom=o)},null,8,["modelValue"]),m(" \xA0\xA0"),s(B,{size:"small",theme:"success",onClick:st},{default:r(()=>[m("\u5199\u5165\u65F6\u95F4\u5230\u53F0\u7AD9")]),_:1})])]),_:1}),s(u,{"label-col-style":{width:"25%"},field:"sat",label:"\u9009\u62E9\u536B\u661F"},{default:r(()=>[s(F,{modelValue:t.sat,"onUpdate:modelValue":e[1]||(e[1]=o=>t.sat=o),onChange:ut,placeholder:"\u9009\u62E9\u536B\u661F ...","allow-search":"","allow-clear":""},{default:r(()=>[(g(!0),x(C,null,D(t.satData,o=>(g(),A(w,{key:o.name,value:o.name},{default:r(()=>[m(h(o.name),1)]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"])]),_:1}),s(u,{"label-col-style":{width:"25%"},field:"lng",label:"\u53F0\u7AD9\u7ECF\u5EA6"},{default:r(()=>[s(b,{precision:6,modelValue:t.lng,"onUpdate:modelValue":e[2]||(e[2]=o=>t.lng=o)},null,8,["modelValue"])]),_:1}),s(u,{"label-col-style":{width:"25%"},field:"lat",label:"\u53F0\u7AD9\u7EAC\u5EA6"},{default:r(()=>[s(b,{precision:6,modelValue:t.lat,"onUpdate:modelValue":e[3]||(e[3]=o=>t.lat=o)},null,8,["modelValue"])]),_:1}),s(u,{"label-col-style":{width:"25%"},field:"alt",label:"\u53F0\u7AD9\u6D77\u62D4"},{default:r(()=>[s(b,{precision:0,modelValue:t.alt,"onUpdate:modelValue":e[4]||(e[4]=o=>t.alt=o)},null,8,["modelValue"])]),_:1}),s(u,{"label-col-style":{width:"25%"},label:""},{default:r(()=>[s(E,null,{default:r(()=>[s(_,{onClick:O},{default:r(()=>[m("\u6D4F\u89C8\u5668\u83B7\u53D6\u7ECF\u7EAC\u5EA6")]),_:1}),s(_,{onClick:lt},{default:r(()=>[m("\u83B7\u53D6\u536B\u661F\u8FC7\u5883\u65F6\u95F4")]),_:1})]),_:1})]),_:1}),s(u,{"label-col-style":{width:"25%"},field:"pass",label:"\u9009\u62E9\u8FC7\u5883\u65F6\u95F4"},{default:r(()=>[s(F,{modelValue:t.pass,"onUpdate:modelValue":e[5]||(e[5]=o=>t.pass=o),"allow-search":"","allow-clear":""},{default:r(()=>[(g(!0),x(C,null,D(t.passOption,o=>(g(),A(w,{key:o[0]+"|"+o[1],value:o[0]+"|"+o[1]},{default:r(()=>[m(h(o[0]+" - "+o[1]),1)]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"])]),_:1}),s(u,{"label-col-style":{width:"25%"},field:"passCustom",label:"\u81EA\u5B9A\u4E49\u8FC7\u5883\u65F6\u95F4"},{default:r(()=>[s(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]=o=>t.passCustom=o)},null,8,["modelValue"])]),_:1}),s(u,{"label-col-style":{width:"25%"},field:"tx",label:"\u4E0A\u884C\u9891\u7387"},{default:r(()=>[s(b,{precision:5,modelValue:t.tx,"onUpdate:modelValue":e[7]||(e[7]=o=>t.tx=o)},null,8,["modelValue"])]),_:1}),s(u,{"label-col-style":{width:"25%"},field:"txTone",label:"\u4E0A\u884C\u4E9A\u97F3"},{default:r(()=>[s(F,{modelValue:t.txTone,"onUpdate:modelValue":e[8]||(e[8]=o=>t.txTone=o),"allow-search":"","allow-clear":""},{default:r(()=>[s(w,{value:0},{default:r(()=>[m("\u5173\u95ED")]),_:1}),(g(!0),x(C,null,D(t.CTCSSOption,o=>(g(),A(w,{key:o,value:o},{default:r(()=>[m(h(o.toFixed(1)),1)]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"])]),_:1}),s(u,{"label-col-style":{width:"25%"},field:"rx",label:"\u4E0B\u884C\u9891\u7387"},{default:r(()=>[s(b,{precision:5,modelValue:t.rx,"onUpdate:modelValue":e[9]||(e[9]=o=>t.rx=o)},null,8,["modelValue"])]),_:1}),s(u,{"label-col-style":{width:"25%"},field:"rxTone",label:"\u4E0B\u884C\u4E9A\u97F3"},{default:r(()=>[s(F,{modelValue:t.rxTone,"onUpdate:modelValue":e[10]||(e[10]=o=>t.rxTone=o),"allow-search":"","allow-clear":""},{default:r(()=>[s(w,{value:0},{default:r(()=>[m("\u5173\u95ED")]),_:1}),(g(!0),x(C,null,D(t.CTCSSOption,o=>(g(),A(w,{key:o,value:o},{default:r(()=>[m(h(o.toFixed(1)),1)]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"])]),_:1}),s(u,{"label-col-style":{width:"25%"},label:""},{default:r(()=>[s(_,{onClick:it},{default:r(()=>[m("\u5199\u5165\u6570\u636E")]),_:1})]),_:1}),s(v),at("div",{id:"statusArea",style:{height:"20em","background-color":"azure",color:"silver",overflow:"auto",padding:"20px"},innerHTML:t.status},null,8,kt)]),_:1},8,["loading"])]),_:1})]),_:1})]),_:1})])}}});const oa=mt(Nt,[["__scopeId","data-v-1c17ea39"]]);export{oa as default};