import{S as _t}from"./index.c93dfeeb.js";import{e as ft,q as gt,_ as wt}from"./index.aa463bbb.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 yt,o as Ft,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 h,aI as s,aH as r,u as Bt,aM as m,aN as x,bw as et,G as ot,bx as nt,aK as C,aJ as D,aE as A,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 p,s as Ot}from"./serial.b70f48dc.js";import{u as Nt}from"./loading.04079284.js";import"./chart.83b8c11b.js";import"./vue.30c84055.js";const Ht={class:"container"},Mt=["innerHTML"],Yt={name:"Sat"},Lt=bt({...Yt,setup(Rt){const{loading:rt,setLoading:f}=Nt(!0),a=ft(),t=yt({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});Ft(()=>{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}f(!0),await U(a.connectPort),await k(),await ut(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 p(a.connectPort,11200,new Uint8Array(e),6,(n=a.configuration)==null?void 0:n.uart)},ct=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+"
"})),st(()=>{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 pt=async(l=0,e)=>{var n;await U(a.connectPort);for(let u=l;u",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}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)},mt=async()=>{var N,H,M,Y,L,R,j,$,z,J,Z,q,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}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],E=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],B=_.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 c=new Uint8Array(10);c.set(Ot(e.trim()).subarray(0,9)),await p(a.connectPort,11168,c,10,(H=a.configuration)==null?void 0:H.uart),await p(a.connectPort,11178,i(parseInt(u).toString(16)).subarray(0,1),1,(M=a.configuration)==null?void 0:M.uart),await p(a.connectPort,11179,i(parseInt(d).toString(16)).subarray(0,1),1,(Y=a.configuration)==null?void 0:Y.uart),await p(a.connectPort,11180,i(parseInt(E).toString(16)).subarray(0,1),1,(L=a.configuration)==null?void 0:L.uart),await p(a.connectPort,11181,i(parseInt(w).toString(16)).subarray(0,1),1,(R=a.configuration)==null?void 0:R.uart),await p(a.connectPort,11182,i(parseInt(F).toString(16)).subarray(0,1),1,(j=a.configuration)==null?void 0:j.uart),await p(a.connectPort,11183,i(parseInt(b).toString(16)).subarray(0,1),1,($=a.configuration)==null?void 0:$.uart),await p(a.connectPort,11184,i(parseInt(B).toString(16)).subarray(0,1),1,(z=a.configuration)==null?void 0:z.uart),await p(a.connectPort,11185,i(parseInt(V).toString(16)).subarray(0,1),1,(J=a.configuration)==null?void 0:J.uart),await p(a.connectPort,11186,i(parseInt(v).toString(16)).subarray(0,1),1,(Z=a.configuration)==null?void 0:Z.uart),await p(a.connectPort,11187,i(parseInt(T).toString(16)).subarray(0,1),1,(q=a.configuration)==null?void 0:q.uart),await p(a.connectPort,11188,i(parseInt(P).toString(16)).subarray(0,1),1,(G=a.configuration)==null?void 0:G.uart),await p(a.connectPort,11189,i(parseInt(I).toString(16)).subarray(0,1),1,(K=a.configuration)==null?void 0:K.uart),c=new Uint8Array(2),c.set(i(((Date.parse(_)-Date.parse(n))/1e3).toString(16)).subarray(0,2)),await p(a.connectPort,11190,c,2,(X=a.configuration)==null?void 0:X.uart),c=new Uint8Array(2),t.txTone&&t.txTone>0&&c.set(i(parseInt((t.txTone*10).toFixed(0)).toString(16)).subarray(0,2)),await p(a.connectPort,11192,c,2,(Q=a.configuration)==null?void 0:Q.uart),c=new Uint8Array(2),t.rxTone&&t.rxTone>0&&c.set(i(parseInt((t.rxTone*10).toFixed(0)).toString(16)).subarray(0,2)),await p(a.connectPort,11194,c,2,(W=a.configuration)==null?void 0:W.uart),c=new Uint8Array(4),c.set(i(((Date.parse(n)-Date.parse("2000-01-01 00:00:00"))/1e3).toString(16)).subarray(0,4)),await p(a.connectPort,11196,c,4,(tt=a.configuration)==null?void 0:tt.uart);const o=[];l.shift_array.filter((y,S)=>S%2===0).map(y=>{const S=new Uint8Array(4),at=new Uint8Array(4);S.set(i(parseInt(((t.tx*1e6+y[0])/10).toFixed(0)).toString(16))),at.set(i(parseInt(((t.rx*1e6+y[1])/10).toFixed(0)).toString(16))),o.push(...S,...at)}),c=new Uint8Array(7680),c.set(new Uint8Array(o).subarray(0,7680)),await pt(123392,c),await k(),await ut(a.connectPort),f(!1)};return(l,e)=>{const n=gt,u=Vt,d=xt,E=_t,w=vt,F=St,b=Ct,_=Tt,B=Pt,V=It,v=Dt,T=At,P=Et,I=Ut,c=kt;return g(),h("div",Ht,[s(n,{items:["\u5C0F\u5DE5\u5177","\u536B\u661F\u5199\u5165"]}),s(c,{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:Bt(rt),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",onClick:lt},{default:r(()=>[m(x(t.dt),1)]),_:1}),et(s(u,{"label-col-style":{width:"25%"},field:"dtCustom",label:"\u81EA\u5B9A\u4E49\u65F6\u95F4"},{default:r(()=>[ot("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(E,{size:"small",theme:"success",onClick:it},{default:r(()=>[m("\u5199\u5165\u65F6\u95F4\u5230\u53F0\u7AD9")]),_:1})])]),_:1},512),[[nt,t.showh>=5]]),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:ct,placeholder:"\u9009\u62E9\u536B\u661F ...","allow-search":"","allow-clear":""},{default:r(()=>[(g(!0),h(C,null,D(t.satData,o=>(g(),A(w,{key:o.name,value:o.name},{default:r(()=>[m(x(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(B,null,{default:r(()=>[s(_,{onClick:O},{default:r(()=>[m("\u6D4F\u89C8\u5668\u83B7\u53D6\u7ECF\u7EAC\u5EA6")]),_:1}),s(_,{onClick:dt},{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),h(C,null,D(t.passOption,o=>(g(),A(w,{key:o[0]+"|"+o[1],value:o[0]+"|"+o[1]},{default:r(()=>[m(x(o[0]+" - "+o[1]),1)]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"])]),_:1}),et(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},512),[[nt,t.showh>=5]]),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),h(C,null,D(t.CTCSSOption,o=>(g(),A(w,{key:o,value:o},{default:r(()=>[m(x(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),h(C,null,D(t.CTCSSOption,o=>(g(),A(w,{key:o,value:o},{default:r(()=>[m(x(o.toFixed(1)),1)]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"])]),_:1}),s(u,{"label-col-style":{width:"25%"},label:""},{default:r(()=>[s(_,{onClick:mt},{default:r(()=>[m("\u5199\u5165\u6570\u636E")]),_:1})]),_:1}),s(v),ot("div",{id:"statusArea",style:{height:"20em","background-color":"azure",color:"silver",overflow:"auto",padding:"20px"},innerHTML:t.status},null,8,Mt)]),_:1},8,["loading"])]),_:1})]),_:1})]),_:1})])}}});const ra=wt(Lt,[["__scopeId","data-v-cfb16247"]]);export{ra as default};