12 lines
70 KiB
JavaScript
12 lines
70 KiB
JavaScript
var ql=Object.defineProperty;var xl=(e,l,s)=>l in e?ql(e,l,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[l]=s;var Wt=(e,l,s)=>xl(e,typeof l!="symbol"?l+"":l,s);(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const r of o)if(r.type==="childList")for(const f of r.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&i(f)}).observe(document,{childList:!0,subtree:!0});function s(o){const r={};return o.integrity&&(r.integrity=o.integrity),o.referrerPolicy&&(r.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?r.credentials="include":o.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(o){if(o.ep)return;o.ep=!0;const r=s(o);fetch(o.href,r)}})();function ge(){}function Xl(e){return e()}function fl(){return Object.create(null)}function nt(e){e.forEach(Xl)}function Yl(e){return typeof e=="function"}function ot(e,l){return e!=e?l==l:e!==l||e&&typeof e=="object"||typeof e=="function"}function $l(e){return Object.keys(e).length===0}function n(e,l){e.appendChild(l)}function L(e,l,s){e.insertBefore(l,s||null)}function E(e){e.parentNode&&e.parentNode.removeChild(e)}function Dt(e,l){for(let s=0;s<e.length;s+=1)e[s]&&e[s].d(l)}function a(e){return document.createElement(e)}function D(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function T(e){return document.createTextNode(e)}function b(){return T(" ")}function At(){return T("")}function Ce(e,l,s,i){return e.addEventListener(l,s,i),()=>e.removeEventListener(l,s,i)}function t(e,l,s){s==null?e.removeAttribute(l):e.getAttribute(l)!==s&&e.setAttribute(l,s)}function en(e){return Array.from(e.childNodes)}function R(e,l){l=""+l,e.data!==l&&(e.data=l)}function Pt(e,l){e.value=l??""}function ce(e,l,s,i){s==null?e.style.removeProperty(l):e.style.setProperty(l,s,"")}function It(e,l,s){for(let i=0;i<e.options.length;i+=1){const o=e.options[i];if(o.__value===l){o.selected=!0;return}}(!s||l!==void 0)&&(e.selectedIndex=-1)}function tn(e){const l=e.querySelector(":checked");return l&&l.__value}function W(e,l,s){e.classList.toggle(l,!!s)}let zt;function St(e){zt=e}function Vl(){if(!zt)throw new Error("Function called outside component initialization");return zt}function Zl(e){Vl().$$.on_mount.push(e)}function Kl(e){Vl().$$.on_destroy.push(e)}const yt=[],ul=[];let kt=[];const vl=[],ln=Promise.resolve();let Gt=!1;function nn(){Gt||(Gt=!0,ln.then(Hl))}function Nt(e){kt.push(e)}const Bt=new Set;let wt=0;function Hl(){if(wt!==0)return;const e=zt;do{try{for(;wt<yt.length;){const l=yt[wt];wt++,St(l),sn(l.$$)}}catch(l){throw yt.length=0,wt=0,l}for(St(null),yt.length=0,wt=0;ul.length;)ul.pop()();for(let l=0;l<kt.length;l+=1){const s=kt[l];Bt.has(s)||(Bt.add(s),s())}kt.length=0}while(yt.length);for(;vl.length;)vl.pop()();Gt=!1,Bt.clear(),St(e)}function sn(e){if(e.fragment!==null){e.update(),nt(e.before_update);const l=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,l),e.after_update.forEach(Nt)}}function an(e){const l=[],s=[];kt.forEach(i=>e.indexOf(i)===-1?l.push(i):s.push(i)),s.forEach(i=>i()),kt=l}const Ot=new Set;let on;function ct(e,l){e&&e.i&&(Ot.delete(e),e.i(l))}function mt(e,l,s,i){if(e&&e.o){if(Ot.has(e))return;Ot.add(e),on.c.push(()=>{Ot.delete(e)}),e.o(l)}}function ut(e){return(e==null?void 0:e.length)!==void 0?e:Array.from(e)}function bt(e){e&&e.c()}function dt(e,l,s){const{fragment:i,after_update:o}=e.$$;i&&i.m(l,s),Nt(()=>{const r=e.$$.on_mount.map(Xl).filter(Yl);e.$$.on_destroy?e.$$.on_destroy.push(...r):nt(r),e.$$.on_mount=[]}),o.forEach(Nt)}function ft(e,l){const s=e.$$;s.fragment!==null&&(an(s.after_update),nt(s.on_destroy),s.fragment&&s.fragment.d(l),s.on_destroy=s.fragment=null,s.ctx=[])}function rn(e,l){e.$$.dirty[0]===-1&&(yt.push(e),nn(),e.$$.dirty.fill(0)),e.$$.dirty[l/31|0]|=1<<l%31}function vt(e,l,s,i,o,r,f=null,d=[-1]){const v=zt;St(e);const c=e.$$={fragment:null,ctx:[],props:r,update:ge,not_equal:o,bound:fl(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(l.context||(v?v.$$.context:[])),callbacks:fl(),dirty:d,skip_bound:!1,root:l.target||v.$$.root};f&&f(c.root);let h=!1;if(c.ctx=s?s(e,l.props||{},(u,w,...g)=>{const p=g.length?g[0]:w;return c.ctx&&o(c.ctx[u],c.ctx[u]=p)&&(!c.skip_bound&&c.bound[u]&&c.bound[u](p),h&&rn(e,u)),w}):[],c.update(),h=!0,nt(c.before_update),c.fragment=i?i(c.ctx):!1,l.target){if(l.hydrate){const u=en(l.target);c.fragment&&c.fragment.l(u),u.forEach(E)}else c.fragment&&c.fragment.c();l.intro&&ct(e.$$.fragment),dt(e,l.target,l.anchor),Hl()}St(v)}class pt{constructor(){Wt(this,"$$");Wt(this,"$$set")}$destroy(){ft(this,1),this.$destroy=ge}$on(l,s){if(!Yl(s))return ge;const i=this.$$.callbacks[l]||(this.$$.callbacks[l]=[]);return i.push(s),()=>{const o=i.indexOf(s);o!==-1&&i.splice(o,1)}}$set(l){this.$$set&&!$l(l)&&(this.$$.skip_bound=!0,this.$$set(l),this.$$.skip_bound=!1)}}const cn="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(cn);const _t=[];function Ut(e,l=ge){let s;const i=new Set;function o(d){if(ot(e,d)&&(e=d,s)){const v=!_t.length;for(const c of i)c[1](),_t.push(c,e);if(v){for(let c=0;c<_t.length;c+=2)_t[c][0](_t[c+1]);_t.length=0}}}function r(d){o(d(e))}function f(d,v=ge){const c=[d,v];return i.add(c),i.size===1&&(s=l(o,r)||ge),d(e),()=>{i.delete(c),i.size===0&&s&&(s(),s=null)}}return{set:o,update:r,subscribe:f}}const jt=Ut(!1),Ql=Ut(null),dn=Ut(null);class fn{constructor(){this.ws=null,this.reconnectTimeout=null,this.reconnectDelay=3e3}connect(){const s=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`;try{this.ws=new WebSocket(s),this.ws.onopen=()=>{console.log("WebSocket connected"),jt.set(!0)},this.ws.onmessage=i=>{try{const o=JSON.parse(i.data);o.type==="update"&&(console.log("System status updated:",o.data),Ql.set(o.data),dn.set(new Date(o.timestamp)))}catch(o){console.error("Error parsing message:",o)}},this.ws.onerror=i=>{console.error("WebSocket error:",i)},this.ws.onclose=()=>{console.log("WebSocket disconnected"),jt.set(!1),this.scheduleReconnect()}}catch(i){console.error("Error creating WebSocket:",i),this.scheduleReconnect()}}scheduleReconnect(){this.reconnectTimeout&&clearTimeout(this.reconnectTimeout),this.reconnectTimeout=setTimeout(()=>{console.log("Attempting to reconnect..."),this.connect()},this.reconnectDelay)}send(l){this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify(l))}disconnect(){this.reconnectTimeout&&clearTimeout(this.reconnectTimeout),this.ws&&this.ws.close()}}const pl=new fn,un="/api";async function ke(e,l={}){try{const s=await fetch(`${un}${e}`,{...l,headers:{"Content-Type":"application/json",...l.headers}});if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);return await s.json()}catch(s){throw console.error("API request failed:",s),s}}const Oe={getStatus:()=>ke("/status"),getConfig:()=>ke("/config"),webswitch:{relayOn:e=>ke(`/webswitch/relay/on?relay=${e}`,{method:"POST"}),relayOff:e=>ke(`/webswitch/relay/off?relay=${e}`,{method:"POST"}),allOn:()=>ke("/webswitch/all/on",{method:"POST"}),allOff:()=>ke("/webswitch/all/off",{method:"POST"})},rotator:{move:(e,l)=>ke("/rotator/move",{method:"POST",body:JSON.stringify({rotator:e,azimuth:l})}),cw:e=>ke(`/rotator/cw?rotator=${e}`,{method:"POST"}),ccw:e=>ke(`/rotator/ccw?rotator=${e}`,{method:"POST"}),stop:()=>ke("/rotator/stop",{method:"POST"})},tuner:{setOperate:e=>ke("/tuner/operate",{method:"POST",body:JSON.stringify({value:e})}),setBypass:e=>ke("/tuner/bypass",{method:"POST",body:JSON.stringify({value:e})}),autoTune:()=>ke("/tuner/autotune",{method:"POST"})},antenna:{selectAntenna:(e,l)=>ke("/antenna/select",{method:"POST",body:JSON.stringify({port:e,antenna:l})}),deselectAntenna:(e,l)=>ke("/antenna/deselect",{method:"POST",body:JSON.stringify({port:e,antenna:l})}),reboot:()=>ke("/antenna/reboot",{method:"POST"})},power:{setFanMode:e=>ke("/power/fanmode",{method:"POST",body:JSON.stringify({mode:e})}),setOperate:e=>ke("/power/operate",{method:"POST",body:JSON.stringify({value:e})})},rotator:{setHeading:e=>ke("/rotator/heading",{method:"POST",body:JSON.stringify({heading:e})}),rotateCW:()=>ke("/rotator/cw",{method:"POST"}),rotateCCW:()=>ke("/rotator/ccw",{method:"POST"}),stop:()=>ke("/rotator/stop",{method:"POST"})},ultrabeam:{setFrequency:(e,l)=>ke("/ultrabeam/frequency",{method:"POST",body:JSON.stringify({frequency:e,direction:l})}),retract:()=>ke("/ultrabeam/retract",{method:"POST"}),setAutoTrack:(e,l)=>ke("/ultrabeam/autotrack",{method:"POST",body:JSON.stringify({enabled:e,threshold:l})}),setDirection:e=>ke("/ultrabeam/direction",{method:"POST",body:JSON.stringify({direction:e})})}};function vn(e){let l;return{c(){l=a("span"),l.textContent="Checking FlexRadio...",t(l,"class","no-signal svelte-c1uwa5")},m(s,i){L(s,l,i)},p:ge,d(s){s&&E(l)}}}function pn(e){let l;return{c(){l=a("span"),l.textContent="FlexRadio not connected",t(l,"class","no-signal svelte-c1uwa5")},m(s,i){L(s,l,i)},p:ge,d(s){s&&E(l)}}}function hn(e){let l;return{c(){l=a("div"),l.innerHTML='<span class="radio-off-indicator svelte-c1uwa5">○</span> <span class="radio-status-text svelte-c1uwa5">TCP connected, radio off</span>',t(l,"class","radio-status svelte-c1uwa5")},m(s,i){L(s,l,i)},p:ge,d(s){s&&E(l)}}}function mn(e){let l,s,i,o,r=(e[11]||"Radio is on")+"",f,d,v,c=e[9]&&hl(e),h=e[10]&&ml(e);return{c(){l=a("div"),s=a("span"),s.textContent="●",i=b(),o=a("span"),f=T(r),d=b(),c&&c.c(),v=b(),h&&h.c(),t(s,"class","radio-on-indicator svelte-c1uwa5"),t(o,"class","radio-status-text svelte-c1uwa5"),t(l,"class","radio-status svelte-c1uwa5")},m(u,w){L(u,l,w),n(l,s),n(l,i),n(l,o),n(o,f),n(l,d),c&&c.m(l,null),n(l,v),h&&h.m(l,null)},p(u,w){w[0]&2048&&r!==(r=(u[11]||"Radio is on")+"")&&R(f,r),u[9]?c?c.p(u,w):(c=hl(u),c.c(),c.m(l,v)):c&&(c.d(1),c=null),u[10]?h?h.p(u,w):(h=ml(u),h.c(),h.m(l,null)):h&&(h.d(1),h=null)},d(u){u&&E(l),c&&c.d(),h&&h.d()}}}function bn(e){let l,s,i,o,r,f,d=e[9]&&bl(e),v=e[10]&&gl(e);return{c(){l=a("div"),s=a("span"),s.textContent="●",i=b(),o=a("span"),o.textContent="Slice active, waiting for frequency...",r=b(),d&&d.c(),f=b(),v&&v.c(),t(s,"class","radio-on-indicator svelte-c1uwa5"),t(o,"class","radio-status-text svelte-c1uwa5"),t(l,"class","radio-status svelte-c1uwa5")},m(c,h){L(c,l,h),n(l,s),n(l,i),n(l,o),n(l,r),d&&d.m(l,null),n(l,f),v&&v.m(l,null)},p(c,h){c[9]?d?d.p(c,h):(d=bl(c),d.c(),d.m(l,f)):d&&(d.d(1),d=null),c[10]?v?v.p(c,h):(v=gl(c),v.c(),v.m(l,null)):v&&(v.d(1),v=null)},d(c){c&&E(l),d&&d.d(),v&&v.d()}}}function gn(e){let l,s,i=Sl(e[3])+"",o,r,f,d,v,c,h,u=e[4]&&wl(e),w=e[25]&&_l(e),g=e[24]&&yl();return{c(){l=a("div"),s=a("span"),o=T(i),r=b(),f=a("span"),f.textContent="MHz",d=b(),u&&u.c(),v=b(),w&&w.c(),c=b(),g&&g.c(),h=At(),t(s,"class","frequency svelte-c1uwa5"),ce(s,"--band-color",e[22]),t(f,"class","unit svelte-c1uwa5"),t(l,"class","frequency-display svelte-c1uwa5")},m(p,k){L(p,l,k),n(l,s),n(s,o),n(l,r),n(l,f),L(p,d,k),u&&u.m(p,k),L(p,v,k),w&&w.m(p,k),L(p,c,k),g&&g.m(p,k),L(p,h,k)},p(p,k){k[0]&8&&i!==(i=Sl(p[3])+"")&&R(o,i),k[0]&4194304&&ce(s,"--band-color",p[22]),p[4]?u?u.p(p,k):(u=wl(p),u.c(),u.m(v.parentNode,v)):u&&(u.d(1),u=null),p[25]?w?w.p(p,k):(w=_l(p),w.c(),w.m(c.parentNode,c)):w&&(w.d(1),w=null),p[24]?g||(g=yl(),g.c(),g.m(h.parentNode,h)):g&&(g.d(1),g=null)},d(p){p&&(E(l),E(d),E(v),E(c),E(h)),u&&u.d(p),w&&w.d(p),g&&g.d(p)}}}function hl(e){let l,s;return{c(){l=a("span"),s=T(e[9]),t(l,"class","model-badge svelte-c1uwa5")},m(i,o){L(i,l,o),n(l,s)},p(i,o){o[0]&512&&R(s,i[9])},d(i){i&&E(l)}}}function ml(e){let l,s;return{c(){l=a("span"),s=T(e[10]),t(l,"class","callsign-badge svelte-c1uwa5")},m(i,o){L(i,l,o),n(l,s)},p(i,o){o[0]&1024&&R(s,i[10])},d(i){i&&E(l)}}}function bl(e){let l,s;return{c(){l=a("span"),s=T(e[9]),t(l,"class","model-badge svelte-c1uwa5")},m(i,o){L(i,l,o),n(l,s)},p(i,o){o[0]&512&&R(s,i[9])},d(i){i&&E(l)}}}function gl(e){let l,s;return{c(){l=a("span"),s=T(e[10]),t(l,"class","callsign-badge svelte-c1uwa5")},m(i,o){L(i,l,o),n(l,s)},p(i,o){o[0]&1024&&R(s,i[10])},d(i){i&&E(l)}}}function wl(e){let l,s;return{c(){l=a("span"),s=T(e[4]),t(l,"class","band-badge svelte-c1uwa5"),ce(l,"background-color",e[22])},m(i,o){L(i,l,o),n(l,s)},p(i,o){o[0]&16&&R(s,i[4]),o[0]&4194304&&ce(l,"background-color",i[22])},d(i){i&&E(l)}}}function _l(e){let l,s;return{c(){l=a("span"),s=T(e[25]),t(l,"class","mode-badge svelte-c1uwa5")},m(i,o){L(i,l,o),n(l,s)},p(i,o){o[0]&33554432&&R(s,i[25])},d(i){i&&E(l)}}}function yl(e){let l;return{c(){l=a("span"),l.textContent="TX",t(l,"class","tx-indicator svelte-c1uwa5")},m(s,i){L(s,l,i)},d(s){s&&E(l)}}}function wn(e){let l;return{c(){l=a("span"),l.textContent="📍 Position not set",t(l,"class","no-location svelte-c1uwa5")},m(s,i){L(s,l,i)},p:ge,d(s){s&&E(l)}}}function _n(e){let l,s,i,o,r,f,d,v,c=Ft(e[12])+"",h,u,w,g,p,k,y,M,C,m=Ft(e[13])+"",F,O,z;function P(I,J){if(I[14])return kn;if(I[16])return yn}let _=P(e),A=_&&_(e);return{c(){l=a("div"),s=a("span"),i=D("svg"),o=D("line"),r=D("path"),f=D("path"),d=D("path"),v=b(),h=T(c),u=b(),w=a("span"),g=D("svg"),p=D("line"),k=D("path"),y=D("path"),M=D("path"),C=b(),F=T(m),O=b(),A&&A.c(),z=At(),t(o,"x1","2"),t(o,"y1","18"),t(o,"x2","22"),t(o,"y2","18"),t(o,"stroke","currentColor"),t(o,"stroke-width","1.5"),t(o,"opacity","0.5"),t(r,"d","M12 18 A6 6 0 0 1 12 6 A6 6 0 0 1 12 18"),t(r,"fill","#fbbf24"),t(f,"d","M12 2v3M5.6 5.6l2.1 2.1M2 12h3M19 12h3M18.4 5.6l-2.1 2.1"),t(f,"stroke","#fbbf24"),t(f,"stroke-width","2"),t(f,"stroke-linecap","round"),t(d,"d","M12 14l-3 3M12 14l3 3M12 14v5"),t(d,"stroke","#22c55e"),t(d,"stroke-width","2"),t(d,"stroke-linecap","round"),t(d,"fill","none"),t(i,"class","sun-icon sunrise-icon svelte-c1uwa5"),t(i,"width","18"),t(i,"height","18"),t(i,"viewBox","0 0 24 24"),t(s,"class","sun-item svelte-c1uwa5"),t(s,"title","Sunrise"),t(p,"x1","2"),t(p,"y1","18"),t(p,"x2","22"),t(p,"y2","18"),t(p,"stroke","currentColor"),t(p,"stroke-width","1.5"),t(p,"opacity","0.5"),t(k,"d","M12 18 A6 6 0 0 1 12 6 A6 6 0 0 1 12 18"),t(k,"fill","#f97316"),t(y,"d","M12 2v3M5.6 5.6l2.1 2.1M2 12h3M19 12h3M18.4 5.6l-2.1 2.1"),t(y,"stroke","#f97316"),t(y,"stroke-width","2"),t(y,"stroke-linecap","round"),t(y,"opacity","0.7"),t(M,"d","M12 22l-3-3M12 22l3-3M12 22v-5"),t(M,"stroke","#ef4444"),t(M,"stroke-width","2"),t(M,"stroke-linecap","round"),t(M,"fill","none"),t(g,"class","sun-icon sunset-icon svelte-c1uwa5"),t(g,"width","18"),t(g,"height","18"),t(g,"viewBox","0 0 24 24"),t(w,"class","sun-item svelte-c1uwa5"),t(w,"title","Sunset"),t(l,"class","sun-times svelte-c1uwa5")},m(I,J){L(I,l,J),n(l,s),n(s,i),n(i,o),n(i,r),n(i,f),n(i,d),n(s,v),n(s,h),n(l,u),n(l,w),n(w,g),n(g,p),n(g,k),n(g,y),n(g,M),n(w,C),n(w,F),L(I,O,J),A&&A.m(I,J),L(I,z,J)},p(I,J){J[0]&4096&&c!==(c=Ft(I[12])+"")&&R(h,c),J[0]&8192&&m!==(m=Ft(I[13])+"")&&R(F,m),_===(_=P(I))&&A?A.p(I,J):(A&&A.d(1),A=_&&_(I),A&&(A.c(),A.m(z.parentNode,z)))},d(I){I&&(E(l),E(O),E(z)),A&&A.d(I)}}}function yn(e){let l,s;return{c(){l=a("span"),s=T(e[16]),t(l,"class","next-event svelte-c1uwa5")},m(i,o){L(i,l,o),n(l,s)},p(i,o){o[0]&65536&&R(s,i[16])},d(i){i&&E(l)}}}function kn(e){let l;return{c(){l=a("span"),l.textContent="✨ Grayline",t(l,"class","grayline-badge svelte-c1uwa5"),W(l,"sunrise",e[15]==="sunrise"),W(l,"sunset",e[15]==="sunset")},m(s,i){L(s,l,i)},p(s,i){i[0]&32768&&W(l,"sunrise",s[15]==="sunrise"),i[0]&32768&&W(l,"sunset",s[15]==="sunset")},d(s){s&&E(l)}}}function kl(e){let l,s,i,o,r,f,d=e[8].toFixed(0)+"",v,c;return{c(){l=a("div"),s=a("span"),s.textContent="⚠️",i=b(),o=a("span"),r=T("Vent: "),f=a("strong"),v=T(d),c=T(" km/h"),t(s,"class","alert-icon svelte-c1uwa5"),t(f,"class","svelte-c1uwa5"),t(o,"class","alert-text svelte-c1uwa5"),t(l,"class","alert wind-alert svelte-c1uwa5")},m(h,u){L(h,l,u),n(l,s),n(l,i),n(l,o),n(o,r),n(o,f),n(f,v),n(f,c)},p(h,u){u[0]&256&&d!==(d=h[8].toFixed(0)+"")&&R(v,d)},d(h){h&&E(l)}}}function Ml(e){let l,s,i,o,r,f,d=e[7].toFixed(0)+"",v,c;return{c(){l=a("div"),s=a("span"),s.textContent="🌪️",i=b(),o=a("span"),r=T("Rafales: "),f=a("strong"),v=T(d),c=T(" km/h"),t(s,"class","alert-icon svelte-c1uwa5"),t(f,"class","svelte-c1uwa5"),t(o,"class","alert-text svelte-c1uwa5"),t(l,"class","alert gust-alert svelte-c1uwa5")},m(h,u){L(h,l,u),n(l,s),n(l,i),n(l,o),n(o,r),n(o,f),n(f,v),n(f,c)},p(h,u){u[0]&128&&d!==(d=h[7].toFixed(0)+"")&&R(v,d)},d(h){h&&E(l)}}}function Tl(e){let l;return{c(){l=a("div"),l.innerHTML='<span class="ok-icon svelte-c1uwa5">✓</span> <span class="ok-text svelte-c1uwa5">Weather OK</span>',t(l,"class","status-ok svelte-c1uwa5")},m(s,i){L(s,l,i)},d(s){s&&E(l)}}}function Mn(e){let l,s,i,o,r,f,d,v,c,h,u,w,g,p;function k(_,A){return _[21]?gn:_[19]?bn:_[20]?mn:_[17]?hn:_[18]?pn:vn}let y=k(e),M=y(e);function C(_,A){return _[0]&&_[1]?_n:wn}let m=C(e),F=m(e),O=e[6]&&kl(e),z=e[5]&&Ml(e),P=!e[23]&&Tl();return{c(){l=a("div"),s=a("div"),i=a("div"),i.textContent="📻",o=b(),M.c(),r=b(),f=a("div"),d=b(),v=a("div"),F.c(),c=b(),h=a("div"),u=b(),w=a("div"),O&&O.c(),g=b(),z&&z.c(),p=b(),P&&P.c(),t(i,"class","flex-icon svelte-c1uwa5"),W(i,"connected",e[2]),W(i,"disconnected",!e[2]),t(s,"class","flex-section svelte-c1uwa5"),t(f,"class","separator svelte-c1uwa5"),t(v,"class","grayline-section svelte-c1uwa5"),t(h,"class","separator svelte-c1uwa5"),t(w,"class","weather-section svelte-c1uwa5"),t(l,"class","status-banner svelte-c1uwa5"),W(l,"has-warning",e[23])},m(_,A){L(_,l,A),n(l,s),n(s,i),n(s,o),M.m(s,null),n(l,r),n(l,f),n(l,d),n(l,v),F.m(v,null),n(l,c),n(l,h),n(l,u),n(l,w),O&&O.m(w,null),n(w,g),z&&z.m(w,null),n(w,p),P&&P.m(w,null)},p(_,A){A[0]&4&&W(i,"connected",_[2]),A[0]&4&&W(i,"disconnected",!_[2]),y===(y=k(_))&&M?M.p(_,A):(M.d(1),M=y(_),M&&(M.c(),M.m(s,null))),m===(m=C(_))&&F?F.p(_,A):(F.d(1),F=m(_),F&&(F.c(),F.m(v,null))),_[6]?O?O.p(_,A):(O=kl(_),O.c(),O.m(w,g)):O&&(O.d(1),O=null),_[5]?z?z.p(_,A):(z=Ml(_),z.c(),z.m(w,p)):z&&(z.d(1),z=null),_[23]?P&&(P.d(1),P=null):P||(P=Tl(),P.c(),P.m(w,null)),A[0]&8388608&&W(l,"has-warning",_[23])},i:ge,o:ge,d(_){_&&E(l),M.d(),F.d(),O&&O.d(),z&&z.d(),P&&P.d()}}}function Cl(e,l,s){const i=Math.PI/180,o=Tn(e),r=2*Math.PI/365*(o-1+(e.getHours()-12)/24),f=229.18*(75e-6+.001868*Math.cos(r)-.032077*Math.sin(r)-.014615*Math.cos(2*r)-.040849*Math.sin(2*r)),d=.006918-.399912*Math.cos(r)+.070257*Math.sin(r)-.006758*Math.cos(2*r)+907e-6*Math.sin(2*r)-.002697*Math.cos(3*r)+.00148*Math.sin(3*r),v=l*i,c=90.833*i,h=Math.cos(c)/(Math.cos(v)*Math.cos(d))-Math.tan(v)*Math.tan(d);if(h>1||h<-1)return{sunrise:null,sunset:null};const u=Math.acos(h)/i,w=720-4*(s+u)-f,g=720-4*(s-u)-f,p=new Date(e);p.setUTCHours(0,0,0,0),p.setUTCMinutes(w);const k=new Date(e);return k.setUTCHours(0,0,0,0),k.setUTCMinutes(g),{sunrise:p,sunset:k}}function Tn(e){const l=new Date(e.getFullYear(),0,0),s=e-l,i=1e3*60*60*24;return Math.floor(s/i)}function Ft(e){return e?e.toLocaleTimeString("fr-FR",{hour:"2-digit",minute:"2-digit"}):"--:--"}function Sl(e){return!e||e===0?"---":e<10?e.toFixed(4):e<100?e.toFixed(3):e.toFixed(2)}function Cn(e){return!e||e===0?"":e>=1.8&&e<=2?"160M":e>=3.5&&e<=4?"80M":e>=5.3&&e<=5.4?"60M":e>=7&&e<=7.3?"40M":e>=10.1&&e<=10.15?"30M":e>=14&&e<=14.35?"20M":e>=18.068&&e<=18.168?"17M":e>=21&&e<=21.45?"15M":e>=24.89&&e<=24.99?"12M":e>=28&&e<=29.7?"10M":e>=50&&e<=54?"6M":e>=144&&e<=148?"2M":e>=430&&e<=440?"70CM":""}function Sn(e){return{"160M":"#9c27b0","80M":"#673ab7","60M":"#3f51b5","40M":"#2196f3","30M":"#00bcd4","20M":"#009688","17M":"#4caf50","15M":"#8bc34a","12M":"#cddc39","10M":"#ffeb3b","6M":"#ff9800","2M":"#ff5722","70CM":"#f44336"}[e]||"#4fc3f7"}function zn(e,l,s){let i,o,r,f,d,v,c,h,u,w,g,p,k,y,M,C,m,F,O,z,P,{flexradio:_=null}=l,{weather:A=null}=l,{latitude:I=null}=l,{longitude:J=null}=l,{windWarningThreshold:H=30}=l,{gustWarningThreshold:de=50}=l,{graylineWindow:ie=30}=l,S=null,te=null,V=!1,N="",B="",Q=new Date,q;Zl(()=>{fe(),q=setInterval(()=>{Q=new Date,Pe(),le()},1e4)}),Kl(()=>{q&&clearInterval(q)});function fe(){if(!I||!J)return;const ae=Cl(new Date,I,J);s(12,S=ae.sunrise),s(13,te=ae.sunset),Pe(),le()}function Pe(){if(!S||!te){s(14,V=!1);return}const X=Q.getTime(),ae=ie*60*1e3,Z=Math.abs(X-S.getTime())<=ae,we=Math.abs(X-te.getTime())<=ae;s(14,V=Z||we),s(15,N=Z?"sunrise":we?"sunset":"")}function le(){if(!S||!te){s(16,B="");return}const X=Q.getTime();let ae=null,Z="";if(X<S.getTime())ae=S,Z="Sunrise";else if(X<te.getTime())ae=te,Z="Sunset";else{const we=new Date(Q);we.setDate(we.getDate()+1),ae=Cl(we,I,J).sunrise,Z="Sunrise"}if(ae){const we=ae.getTime()-X,oe=Math.floor(we/(1e3*60*60)),re=Math.floor(we%(1e3*60*60)/(1e3*60));oe>0?s(16,B=`${Z} in ${oe}h${re.toString().padStart(2,"0")}m`):s(16,B=`${Z} in ${re}m`)}}return e.$$set=X=>{"flexradio"in X&&s(26,_=X.flexradio),"weather"in X&&s(27,A=X.weather),"latitude"in X&&s(0,I=X.latitude),"longitude"in X&&s(1,J=X.longitude),"windWarningThreshold"in X&&s(28,H=X.windWarningThreshold),"gustWarningThreshold"in X&&s(29,de=X.gustWarningThreshold),"graylineWindow"in X&&s(30,ie=X.graylineWindow)},e.$$.update=()=>{e.$$.dirty[0]&67108864&&s(3,i=(_==null?void 0:_.frequency)||0),e.$$.dirty[0]&67108864&&s(25,o=(_==null?void 0:_.mode)||""),e.$$.dirty[0]&67108864&&s(24,r=(_==null?void 0:_.tx)||!1),e.$$.dirty[0]&67108864&&s(2,f=(_==null?void 0:_.connected)||!1),e.$$.dirty[0]&67108864&&s(31,d=(_==null?void 0:_.radio_on)||!1),e.$$.dirty[0]&67108864&&s(11,v=(_==null?void 0:_.radio_info)||""),e.$$.dirty[0]&67108864&&s(10,c=(_==null?void 0:_.callsign)||""),e.$$.dirty[0]&67108864&&s(9,h=(_==null?void 0:_.model)||""),e.$$.dirty[0]&67108864&&s(32,u=(_==null?void 0:_.active_slices)||0),e.$$.dirty[0]&3&&I&&J&&fe(),e.$$.dirty[0]&3596|e.$$.dirty[1]&3&&console.log("FlexRadio status:",{connected:f,radioOn:d,frequency:i,activeSlices:u,radioInfo:v,callsign:c,model:h}),e.$$.dirty[0]&134217728&&s(8,w=(A==null?void 0:A.wind_speed)||0),e.$$.dirty[0]&134217728&&s(7,g=(A==null?void 0:A.wind_gust)||0),e.$$.dirty[0]&268435712&&s(6,p=w>=H),e.$$.dirty[0]&536871040&&s(5,k=g>=de),e.$$.dirty[0]&96&&s(23,y=p||k),e.$$.dirty[0]&8&&s(4,M=Cn(i)),e.$$.dirty[0]&16&&s(22,C=Sn(M)),e.$$.dirty[0]&8|e.$$.dirty[1]&1&&s(21,m=d&&i>0),e.$$.dirty[0]&8|e.$$.dirty[1]&3&&s(20,F=d&&i===0&&u===0),e.$$.dirty[0]&8|e.$$.dirty[1]&3&&s(19,O=d&&i===0&&u>0),e.$$.dirty[0]&4&&s(18,z=!f),e.$$.dirty[0]&4|e.$$.dirty[1]&1&&s(17,P=f&&!d)},[I,J,f,i,M,k,p,g,w,h,c,v,S,te,V,N,B,P,z,O,F,m,C,y,r,o,_,A,H,de,ie,d,u]}class Fn extends pt{constructor(l){super(),vt(this,l,zn,Mn,ot,{flexradio:26,weather:27,latitude:0,longitude:1,windWarningThreshold:28,gustWarningThreshold:29,graylineWindow:30},null,[-1,-1])}}function zl(e,l,s){var f;const i=e.slice();i[10]=l[s];const o=i[1].find(function(...v){return e[9](i[10],...v)});i[11]=o;const r=((f=i[11])==null?void 0:f.state)||!1;return i[12]=r,i}function Fl(e){let l,s,i,o,r,f,d=e[12]?"ON":"OFF",v,c,h,u,w,g,p,k;function y(){return e[8](e[10])}return{c(){l=a("div"),s=a("div"),i=a("div"),o=a("div"),o.textContent=`${e[3][e[10]]}`,r=b(),f=a("div"),v=T(d),c=b(),h=a("button"),u=a("div"),u.innerHTML='<div class="toggle-thumb svelte-z2csmj"></div>',g=b(),t(o,"class","relay-name svelte-z2csmj"),t(f,"class","relay-status svelte-z2csmj"),t(i,"class","relay-details svelte-z2csmj"),t(s,"class","relay-info svelte-z2csmj"),t(u,"class","toggle-track svelte-z2csmj"),t(h,"class","relay-toggle svelte-z2csmj"),h.disabled=w=e[0][e[10]],W(h,"active",e[12]),W(h,"loading",e[0][e[10]]),t(l,"class","relay-card svelte-z2csmj"),W(l,"relay-on",e[12])},m(M,C){L(M,l,C),n(l,s),n(s,i),n(i,o),n(i,r),n(i,f),n(f,v),n(l,c),n(l,h),n(h,u),n(l,g),p||(k=Ce(h,"click",y),p=!0)},p(M,C){e=M,C&2&&d!==(d=e[12]?"ON":"OFF")&&R(v,d),C&1&&w!==(w=e[0][e[10]])&&(h.disabled=w),C&2&&W(h,"active",e[12]),C&1&&W(h,"loading",e[0][e[10]]),C&2&&W(l,"relay-on",e[12])},d(M){M&&E(l),p=!1,k()}}}function Pn(e){let l,s,i,o,r,f,d,v,c,h,u,w,g,p,k,y=ut([1,2,3,4,5]),M=[];for(let C=0;C<5;C+=1)M[C]=Fl(zl(e,y,C));return{c(){l=a("div"),s=a("div"),i=a("h2"),i.textContent="WebSwitch",o=b(),r=a("span"),f=b(),d=a("div"),v=a("div");for(let C=0;C<5;C+=1)M[C].c();c=b(),h=a("div"),u=a("button"),u.innerHTML=`<span class="btn-icon svelte-z2csmj">⚡</span>
|
|
ALL ON`,w=b(),g=a("button"),g.innerHTML=`<span class="btn-icon svelte-z2csmj">⏻</span>
|
|
ALL OFF`,t(i,"class","svelte-z2csmj"),t(r,"class","status-dot svelte-z2csmj"),W(r,"disconnected",!e[2]),t(s,"class","card-header svelte-z2csmj"),t(v,"class","relays svelte-z2csmj"),t(u,"class","control-btn all-on svelte-z2csmj"),t(g,"class","control-btn all-off svelte-z2csmj"),t(h,"class","controls svelte-z2csmj"),t(d,"class","metrics svelte-z2csmj"),t(l,"class","card svelte-z2csmj")},m(C,m){L(C,l,m),n(l,s),n(s,i),n(s,o),n(s,r),n(l,f),n(l,d),n(d,v);for(let F=0;F<5;F+=1)M[F]&&M[F].m(v,null);n(d,c),n(d,h),n(h,u),n(h,w),n(h,g),p||(k=[Ce(u,"click",e[5]),Ce(g,"click",e[6])],p=!0)},p(C,[m]){if(m&4&&W(r,"disconnected",!C[2]),m&27){y=ut([1,2,3,4,5]);let F;for(F=0;F<5;F+=1){const O=zl(C,y,F);M[F]?M[F].p(O,m):(M[F]=Fl(O),M[F].c(),M[F].m(v,null))}for(;F<5;F+=1)M[F].d(1)}},i:ge,o:ge,d(C){C&&E(l),Dt(M,C),p=!1,nt(k)}}}function On(e,l,s){let i,o,{status:r}=l;const f={1:"Power Supply",2:"PGXL",3:"TGXL",4:"Flex Radio Start",5:"Reserve"};let d={};async function v(g){const p=i.find(y=>y.number===g),k=(p==null?void 0:p.state)||!1;s(0,d[g]=!0,d);try{k?await Oe.webswitch.relayOff(g):await Oe.webswitch.relayOn(g)}catch(y){console.error("Failed to toggle relay:",y),alert("Failed to control relay")}finally{s(0,d[g]=!1,d)}}async function c(){try{await Oe.webswitch.allOn()}catch(g){console.error("Failed to turn all on:",g)}}async function h(){try{await Oe.webswitch.allOff()}catch(g){console.error("Failed to turn all off:",g)}}const u=g=>v(g),w=(g,p)=>p.number===g;return e.$$set=g=>{"status"in g&&s(7,r=g.status)},e.$$.update=()=>{e.$$.dirty&128&&s(1,i=(r==null?void 0:r.relays)||[]),e.$$.dirty&128&&s(2,o=(r==null?void 0:r.connected)||!1)},[d,i,o,f,v,c,h,r,u,w]}class An extends pt{constructor(l){super(),vt(this,l,On,Pn,ot,{status:7})}}function In(e){let l,s,i,o,r,f,d,v,c,h,u,w,g,p,k,y,M,C=e[1].toFixed(0)+"",m,F,O,z,P,_,A,I,J,H=e[2].toFixed(2)+"",de,ie,S,te,V,N,B,Q=e[3].toFixed(1)+"",q,fe,Pe,le,X,ae,Z,we,oe,re,ue=e[12].toFixed(1)+"",Me,Ie,Se,Ne,Ae,Fe,$,_e,ne,se,K,ee,j,x=e[15].toFixed(0)+"",Y,G,me,ve,Ee,Ve,Ze=e[14].toFixed(1)+"",We,Xe,Be,Le,$e,De,qe=e[13].toFixed(1)+"",Ke,xe,Ge,pe,Te,et,ht,rt,st,Re,He,Mt,Qe,gt,tt,it,je,lt,Ye,Ue,at,Je,ze,Tt;return{c(){l=a("div"),s=a("div"),i=a("h2"),i.textContent="Power Genius XL",o=b(),r=a("div"),f=a("button"),d=T(e[7]),v=b(),c=a("span"),h=b(),u=a("div"),w=a("div"),g=a("div"),p=a("div"),k=a("span"),k.textContent="Power",y=b(),M=a("span"),m=T(C),F=T(" W"),O=b(),z=a("div"),P=a("div"),_=a("div"),A=b(),I=a("div"),J=a("div"),de=T(H),ie=b(),S=a("div"),S.textContent="SWR",te=b(),V=a("div"),N=a("div"),B=a("div"),q=T(Q),fe=T("°"),Pe=b(),le=a("div"),le.textContent="PA Temp",X=b(),ae=a("div"),Z=a("div"),we=b(),oe=a("div"),re=a("div"),Me=T(ue),Ie=T("°"),Se=b(),Ne=a("div"),Ne.textContent="HL Temp",Ae=b(),Fe=a("div"),$=a("div"),_e=b(),ne=a("div"),se=a("div"),K=a("div"),K.textContent="VAC",ee=b(),j=a("div"),Y=T(x),G=b(),me=a("div"),ve=a("div"),ve.textContent="VDD",Ee=b(),Ve=a("div"),We=T(Ze),Xe=b(),Be=a("div"),Le=a("div"),Le.textContent="ID Peak",$e=b(),De=a("div"),Ke=T(qe),xe=b(),Ge=a("div"),pe=a("div"),Te=a("span"),Te.textContent="Band A",et=b(),ht=a("span"),rt=T(e[10]),st=b(),Re=a("div"),He=a("span"),He.textContent="Band B",Mt=b(),Qe=a("span"),gt=T(e[9]),tt=b(),it=a("div"),je=a("label"),je.textContent="Fan Mode",lt=b(),Ye=a("select"),Ue=a("option"),Ue.textContent="Standard",at=a("option"),at.textContent="Contest",Je=a("option"),Je.textContent="Broadcast",t(i,"class","svelte-vwcbgz"),t(f,"class","state-badge svelte-vwcbgz"),W(f,"idle",e[0]==="IDLE"),W(f,"transmit",e[0].includes("TRANSMIT")),t(c,"class","status-dot svelte-vwcbgz"),W(c,"disconnected",!e[8]),t(r,"class","header-right svelte-vwcbgz"),t(s,"class","card-header svelte-vwcbgz"),t(k,"class","power-label-inline svelte-vwcbgz"),t(M,"class","power-value-inline svelte-vwcbgz"),t(p,"class","power-header svelte-vwcbgz"),t(_,"class","power-bar-fill svelte-vwcbgz"),ce(_,"width",e[4]+"%"),t(P,"class","power-bar-bg svelte-vwcbgz"),t(z,"class","power-bar-container svelte-vwcbgz"),t(g,"class","power-section svelte-vwcbgz"),t(J,"class","swr-value-compact svelte-vwcbgz"),t(S,"class","swr-label-compact svelte-vwcbgz"),t(I,"class","swr-circle-compact svelte-vwcbgz"),ce(I,"--swr-color",e[5]),t(w,"class","power-swr-row svelte-vwcbgz"),t(B,"class","temp-value svelte-vwcbgz"),ce(B,"color",e[6]),t(le,"class","temp-label svelte-vwcbgz"),t(Z,"class","temp-mini-fill svelte-vwcbgz"),ce(Z,"width",e[3]/80*100+"%"),ce(Z,"background",e[6]),t(ae,"class","temp-mini-bar svelte-vwcbgz"),t(N,"class","temp-item svelte-vwcbgz"),t(re,"class","temp-value svelte-vwcbgz"),ce(re,"color",e[6]),t(Ne,"class","temp-label svelte-vwcbgz"),t($,"class","temp-mini-fill svelte-vwcbgz"),ce($,"width",e[12]/80*100+"%"),ce($,"background",e[6]),t(Fe,"class","temp-mini-bar svelte-vwcbgz"),t(oe,"class","temp-item svelte-vwcbgz"),t(V,"class","temp-group svelte-vwcbgz"),t(K,"class","param-label svelte-vwcbgz"),t(j,"class","param-value svelte-vwcbgz"),t(se,"class","param-box svelte-vwcbgz"),t(ve,"class","param-label svelte-vwcbgz"),t(Ve,"class","param-value svelte-vwcbgz"),t(me,"class","param-box svelte-vwcbgz"),t(Le,"class","param-label svelte-vwcbgz"),t(De,"class","param-value svelte-vwcbgz"),t(Be,"class","param-box svelte-vwcbgz"),t(ne,"class","params-grid svelte-vwcbgz"),t(Te,"class","band-label svelte-vwcbgz"),t(ht,"class","band-value svelte-vwcbgz"),t(pe,"class","band-item svelte-vwcbgz"),t(He,"class","band-label svelte-vwcbgz"),t(Qe,"class","band-value svelte-vwcbgz"),t(Re,"class","band-item svelte-vwcbgz"),t(Ge,"class","band-display svelte-vwcbgz"),t(je,"for","fan-mode-select"),t(je,"class","control-label svelte-vwcbgz"),Ue.__value="STANDARD",Pt(Ue,Ue.__value),at.__value="CONTEST",Pt(at,at.__value),Je.__value="BROADCAST",Pt(Je,Je.__value),t(Ye,"id","fan-mode-select"),t(Ye,"class","svelte-vwcbgz"),t(it,"class","fan-control svelte-vwcbgz"),t(u,"class","metrics svelte-vwcbgz"),t(l,"class","card svelte-vwcbgz")},m(be,ye){L(be,l,ye),n(l,s),n(s,i),n(s,o),n(s,r),n(r,f),n(f,d),n(r,v),n(r,c),n(l,h),n(l,u),n(u,w),n(w,g),n(g,p),n(p,k),n(p,y),n(p,M),n(M,m),n(M,F),n(g,O),n(g,z),n(z,P),n(P,_),n(w,A),n(w,I),n(I,J),n(J,de),n(I,ie),n(I,S),n(u,te),n(u,V),n(V,N),n(N,B),n(B,q),n(B,fe),n(N,Pe),n(N,le),n(N,X),n(N,ae),n(ae,Z),n(V,we),n(V,oe),n(oe,re),n(re,Me),n(re,Ie),n(oe,Se),n(oe,Ne),n(oe,Ae),n(oe,Fe),n(Fe,$),n(u,_e),n(u,ne),n(ne,se),n(se,K),n(se,ee),n(se,j),n(j,Y),n(ne,G),n(ne,me),n(me,ve),n(me,Ee),n(me,Ve),n(Ve,We),n(ne,Xe),n(ne,Be),n(Be,Le),n(Be,$e),n(Be,De),n(De,Ke),n(u,xe),n(u,Ge),n(Ge,pe),n(pe,Te),n(pe,et),n(pe,ht),n(ht,rt),n(Ge,st),n(Ge,Re),n(Re,He),n(Re,Mt),n(Re,Qe),n(Qe,gt),n(u,tt),n(u,it),n(it,je),n(it,lt),n(it,Ye),n(Ye,Ue),n(Ye,at),n(Ye,Je),It(Ye,e[11]),ze||(Tt=[Ce(f,"click",e[17]),Ce(Ye,"change",e[19])],ze=!0)},p(be,[ye]){ye&128&&R(d,be[7]),ye&1&&W(f,"idle",be[0]==="IDLE"),ye&1&&W(f,"transmit",be[0].includes("TRANSMIT")),ye&256&&W(c,"disconnected",!be[8]),ye&2&&C!==(C=be[1].toFixed(0)+"")&&R(m,C),ye&16&&ce(_,"width",be[4]+"%"),ye&4&&H!==(H=be[2].toFixed(2)+"")&&R(de,H),ye&32&&ce(I,"--swr-color",be[5]),ye&8&&Q!==(Q=be[3].toFixed(1)+"")&&R(q,Q),ye&64&&ce(B,"color",be[6]),ye&8&&ce(Z,"width",be[3]/80*100+"%"),ye&64&&ce(Z,"background",be[6]),ye&4096&&ue!==(ue=be[12].toFixed(1)+"")&&R(Me,ue),ye&64&&ce(re,"color",be[6]),ye&4096&&ce($,"width",be[12]/80*100+"%"),ye&64&&ce($,"background",be[6]),ye&32768&&x!==(x=be[15].toFixed(0)+"")&&R(Y,x),ye&16384&&Ze!==(Ze=be[14].toFixed(1)+"")&&R(We,Ze),ye&8192&&qe!==(qe=be[13].toFixed(1)+"")&&R(Ke,qe),ye&1024&&R(rt,be[10]),ye&512&&R(gt,be[9]),ye&2048&&It(Ye,be[11])},i:ge,o:ge,d(be){be&&E(l),ze=!1,nt(Tt)}}}function Nn(e,l,s){let i,o,r,f,d,v,c,h,u,w,g,p,k,y,M,C,{status:m}=l;async function F(P){try{await Oe.power.setFanMode(P)}catch(_){console.error("Failed to set fan mode:",_)}}async function O(){try{const P=u==="IDLE"?0:1;await Oe.power.setOperate(P)}catch(P){console.error("Failed to toggle operate:",P)}}const z=P=>F(P.target.value);return e.$$set=P=>{"status"in P&&s(18,m=P.status)},e.$$.update=()=>{e.$$.dirty&262144&&s(1,i=(m==null?void 0:m.power_forward)||0),e.$$.dirty&262144&&m!=null&&m.power_reflected,e.$$.dirty&262144&&s(2,o=(m==null?void 0:m.swr)||1),e.$$.dirty&262144&&s(15,r=(m==null?void 0:m.voltage)||0),e.$$.dirty&262144&&s(14,f=(m==null?void 0:m.vdd)||0),e.$$.dirty&262144&&m!=null&&m.current,e.$$.dirty&262144&&s(13,d=(m==null?void 0:m.peak_current)||0),e.$$.dirty&262144&&s(3,v=(m==null?void 0:m.temperature)||0),e.$$.dirty&262144&&s(12,c=(m==null?void 0:m.harmonic_load_temp)||0),e.$$.dirty&262144&&s(11,h=(m==null?void 0:m.fan_mode)||"CONTEST"),e.$$.dirty&262144&&s(0,u=(m==null?void 0:m.state)||"IDLE"),e.$$.dirty&262144&&s(10,w=(m==null?void 0:m.band_a)||"0"),e.$$.dirty&262144&&s(9,g=(m==null?void 0:m.band_b)||"0"),e.$$.dirty&262144&&s(8,p=(m==null?void 0:m.connected)||!1),e.$$.dirty&1&&s(7,k=u.replace("TRANSMIT_A","TRANSMIT").replace("TRANSMIT_B","TRANSMIT")),e.$$.dirty&8&&s(6,y=v<40?"#4caf50":v<60?"#ffc107":v<75?"#ff9800":"#f44336"),e.$$.dirty&4&&s(5,M=o<1.5?"#4caf50":o<2?"#ffc107":o<3?"#ff9800":"#f44336"),e.$$.dirty&2&&s(4,C=Math.min(i/2e3*100,100))},[u,i,o,v,C,M,y,k,p,g,w,h,c,d,f,r,F,O,m,z]}class Dn extends pt{constructor(l){super(),vt(this,l,Nn,In,ot,{status:18})}}function En(e){let l,s,i,o,r,f,d,v,c,h,u,w,g,p,k,y,M,C=e[0].toFixed(0)+"",m,F,O,z,P,_,A,I,J,H=e[1].toFixed(2)+"",de,ie,S,te,V,N,B,Q,q,fe,Pe,le,X,ae,Z,we,oe,re,ue,Me,Ie,Se,Ne,Ae,Fe,$,_e,ne,se=(e[11]/1e3).toFixed(3)+"",K,ee,j,x,Y,G,me,ve=(e[10]/1e3).toFixed(3)+"",Ee,Ve,Ze,We,Xe,Be=e[8]===1?"OPERATE":"STANDBY",Le,$e,De,qe,Ke,xe,Ge;return{c(){l=a("div"),s=a("div"),i=a("h2"),i.textContent="Tuner Genius XL",o=b(),r=a("div"),f=a("span"),d=T(e[12]),v=b(),c=a("span"),h=b(),u=a("div"),w=a("div"),g=a("div"),p=a("div"),k=a("span"),k.textContent="Power",y=b(),M=a("span"),m=T(C),F=T(" W"),O=b(),z=a("div"),P=a("div"),_=a("div"),A=b(),I=a("div"),J=a("div"),de=T(H),ie=b(),S=a("div"),S.textContent="SWR",te=b(),V=a("div"),N=a("div"),B=a("div"),Q=T(e[7]),q=b(),fe=a("div"),fe.textContent="C1",Pe=b(),le=a("div"),X=a("div"),ae=T(e[6]),Z=b(),we=a("div"),we.textContent="L",oe=b(),re=a("div"),ue=a("div"),Me=T(e[5]),Ie=b(),Se=a("div"),Se.textContent="C2",Ne=b(),Ae=a("div"),Fe=a("div"),$=a("div"),$.textContent="Freq A",_e=b(),ne=a("div"),K=T(se),ee=a("span"),ee.textContent="MHz",j=b(),x=a("div"),Y=a("div"),Y.textContent="Freq B",G=b(),me=a("div"),Ee=T(ve),Ve=a("span"),Ve.textContent="MHz",Ze=b(),We=a("div"),Xe=a("button"),Le=T(Be),$e=b(),De=a("button"),De.textContent="BYPASS",qe=b(),Ke=a("button"),Ke.innerHTML=`<span class="tune-icon svelte-zuda7">⚡</span>
|
|
AUTO TUNE`,t(i,"class","svelte-zuda7"),t(f,"class","tuning-badge svelte-zuda7"),W(f,"tuning",e[12]==="TUNING"),t(c,"class","status-dot svelte-zuda7"),W(c,"disconnected",!e[4]),t(r,"class","header-right svelte-zuda7"),t(s,"class","card-header svelte-zuda7"),t(k,"class","power-label-inline svelte-zuda7"),t(M,"class","power-value-inline svelte-zuda7"),t(p,"class","power-header svelte-zuda7"),t(_,"class","power-bar-fill svelte-zuda7"),ce(_,"width",e[2]+"%"),t(P,"class","power-bar-bg svelte-zuda7"),t(z,"class","power-bar-container svelte-zuda7"),t(g,"class","power-section svelte-zuda7"),t(J,"class","swr-value-compact svelte-zuda7"),t(S,"class","swr-label-compact svelte-zuda7"),t(I,"class","swr-circle-compact svelte-zuda7"),ce(I,"--swr-color",e[3]),t(w,"class","power-swr-row svelte-zuda7"),t(B,"class","cap-value svelte-zuda7"),t(fe,"class","cap-label svelte-zuda7"),t(N,"class","cap-item svelte-zuda7"),t(X,"class","cap-value svelte-zuda7"),t(we,"class","cap-label svelte-zuda7"),t(le,"class","cap-item svelte-zuda7"),t(ue,"class","cap-value svelte-zuda7"),t(Se,"class","cap-label svelte-zuda7"),t(re,"class","cap-item svelte-zuda7"),t(V,"class","capacitors svelte-zuda7"),t($,"class","freq-label svelte-zuda7"),t(ee,"class","freq-unit svelte-zuda7"),t(ne,"class","freq-value svelte-zuda7"),t(Fe,"class","freq-item svelte-zuda7"),t(Y,"class","freq-label svelte-zuda7"),t(Ve,"class","freq-unit svelte-zuda7"),t(me,"class","freq-value svelte-zuda7"),t(x,"class","freq-item svelte-zuda7"),t(Ae,"class","freq-display svelte-zuda7"),t(Xe,"class","control-btn operate svelte-zuda7"),W(Xe,"active",e[8]===1),t(De,"class","control-btn bypass svelte-zuda7"),W(De,"active",e[9]),t(We,"class","controls svelte-zuda7"),t(Ke,"class","tune-btn svelte-zuda7"),t(u,"class","metrics svelte-zuda7"),t(l,"class","card svelte-zuda7")},m(pe,Te){L(pe,l,Te),n(l,s),n(s,i),n(s,o),n(s,r),n(r,f),n(f,d),n(r,v),n(r,c),n(l,h),n(l,u),n(u,w),n(w,g),n(g,p),n(p,k),n(p,y),n(p,M),n(M,m),n(M,F),n(g,O),n(g,z),n(z,P),n(P,_),n(w,A),n(w,I),n(I,J),n(J,de),n(I,ie),n(I,S),n(u,te),n(u,V),n(V,N),n(N,B),n(B,Q),n(N,q),n(N,fe),n(V,Pe),n(V,le),n(le,X),n(X,ae),n(le,Z),n(le,we),n(V,oe),n(V,re),n(re,ue),n(ue,Me),n(re,Ie),n(re,Se),n(u,Ne),n(u,Ae),n(Ae,Fe),n(Fe,$),n(Fe,_e),n(Fe,ne),n(ne,K),n(ne,ee),n(Ae,j),n(Ae,x),n(x,Y),n(x,G),n(x,me),n(me,Ee),n(me,Ve),n(u,Ze),n(u,We),n(We,Xe),n(Xe,Le),n(We,$e),n(We,De),n(u,qe),n(u,Ke),xe||(Ge=[Ce(Xe,"click",e[17]),Ce(De,"click",e[18]),Ce(Ke,"click",e[13])],xe=!0)},p(pe,[Te]){Te&4096&&R(d,pe[12]),Te&4096&&W(f,"tuning",pe[12]==="TUNING"),Te&16&&W(c,"disconnected",!pe[4]),Te&1&&C!==(C=pe[0].toFixed(0)+"")&&R(m,C),Te&4&&ce(_,"width",pe[2]+"%"),Te&2&&H!==(H=pe[1].toFixed(2)+"")&&R(de,H),Te&8&&ce(I,"--swr-color",pe[3]),Te&128&&R(Q,pe[7]),Te&64&&R(ae,pe[6]),Te&32&&R(Me,pe[5]),Te&2048&&se!==(se=(pe[11]/1e3).toFixed(3)+"")&&R(K,se),Te&1024&&ve!==(ve=(pe[10]/1e3).toFixed(3)+"")&&R(Ee,ve),Te&256&&Be!==(Be=pe[8]===1?"OPERATE":"STANDBY")&&R(Le,Be),Te&256&&W(Xe,"active",pe[8]===1),Te&512&&W(De,"active",pe[9])},i:ge,o:ge,d(pe){pe&&E(l),xe=!1,nt(Ge)}}}function Ln(e,l,s){let i,o,r,f,d,v,c,h,u,w,g,p,k,{status:y}=l;async function M(){try{await Oe.tuner.autoTune()}catch(z){console.error("Failed to tune:",z)}}async function C(z){try{await Oe.tuner.setBypass(z)}catch(P){console.error("Failed to set bypass:",P)}}async function m(z){try{await Oe.tuner.setOperate(z)}catch(P){console.error("Failed to set operate:",P)}}const F=()=>m(c===1?0:1),O=()=>C(v?0:1);return e.$$set=z=>{"status"in z&&s(16,y=z.status)},e.$$.update=()=>{e.$$.dirty&65536&&s(0,i=(y==null?void 0:y.power_forward)||0),e.$$.dirty&65536&&s(1,o=(y==null?void 0:y.swr)||1),e.$$.dirty&65536&&s(12,r=(y==null?void 0:y.tuning_status)||"READY"),e.$$.dirty&65536&&s(11,f=(y==null?void 0:y.frequency_a)||0),e.$$.dirty&65536&&s(10,d=(y==null?void 0:y.frequency_b)||0),e.$$.dirty&65536&&s(9,v=(y==null?void 0:y.bypass)||!1),e.$$.dirty&65536&&s(8,c=(y==null?void 0:y.state)||0),e.$$.dirty&65536&&s(7,h=(y==null?void 0:y.c1)||0),e.$$.dirty&65536&&s(6,u=(y==null?void 0:y.l)||0),e.$$.dirty&65536&&s(5,w=(y==null?void 0:y.c2)||0),e.$$.dirty&65536&&s(4,g=(y==null?void 0:y.connected)||!1),e.$$.dirty&2&&s(3,p=o<1.5?"#4caf50":o<2?"#ffc107":o<3?"#ff9800":"#f44336"),e.$$.dirty&1&&s(2,k=Math.min(i/2e3*100,100))},[i,o,k,p,g,w,u,h,c,v,d,f,r,M,C,m,y,F,O]}class Rn extends pt{constructor(l){super(),vt(this,l,Ln,En,ot,{status:16})}}function Pl(e,l,s){const i=e.slice();i[14]=l[s];const o=i[1].tx&&i[1].tx_ant===i[14].number;i[15]=o;const r=i[0].tx&&i[0].tx_ant===i[14].number;i[16]=r;const f=!i[1].tx&&i[1].rx_ant===i[14].number;i[17]=f;const d=!i[0].tx&&i[0].rx_ant===i[14].number;i[18]=d;const v=i[15]||i[16];i[19]=v;const c=i[17]||i[15];i[20]=c;const h=i[18]||i[16];return i[21]=h,i}function Ol(e){let l,s,i=e[14].name+"",o,r,f,d,v,c,h,u,w;function g(){return e[11](e[14])}function p(){return e[12](e[14])}return{c(){l=a("div"),s=a("div"),o=T(i),r=b(),f=a("div"),d=a("button"),d.textContent="A",v=b(),c=a("button"),c.textContent="B",h=b(),t(s,"class","antenna-name svelte-vlabwb"),t(d,"class","port-btn svelte-vlabwb"),W(d,"active",e[20]),t(c,"class","port-btn svelte-vlabwb"),W(c,"active",e[21]),t(f,"class","antenna-ports svelte-vlabwb"),t(l,"class","antenna-card svelte-vlabwb"),W(l,"tx",e[19]),W(l,"active-a",e[20]),W(l,"active-b",e[21])},m(k,y){L(k,l,y),n(l,s),n(s,o),n(l,r),n(l,f),n(f,d),n(f,v),n(f,c),n(l,h),u||(w=[Ce(d,"click",g),Ce(c,"click",p)],u=!0)},p(k,y){e=k,y&16&&i!==(i=e[14].name+"")&&R(o,i),y&18&&W(d,"active",e[20]),y&17&&W(c,"active",e[21]),y&19&&W(l,"tx",e[19]),y&18&&W(l,"active-a",e[20]),y&17&&W(l,"active-b",e[21])},d(k){k&&E(l),u=!1,nt(w)}}}function Wn(e){let l,s,i,o,r,f,d,v,c,h,u=(e[1].source||"FLEX")+"",w,g,p,k,y=(e[0].source||"FLEX")+"",M,C,m,F,O,z,P,_,A,I,J,H,de,ie,S,te,V=ut(e[4]),N=[];for(let B=0;B<V.length;B+=1)N[B]=Ol(Pl(e,V,B));return{c(){l=a("div"),s=a("div"),i=a("h2"),i.textContent="Antenna Genius",o=b(),r=a("span"),f=b(),d=a("div"),v=a("div"),c=a("div"),h=a("div"),w=T(u),g=b(),p=a("div"),k=a("div"),M=T(y),C=b(),m=a("div"),F=a("div"),O=a("div"),z=T(e[3]),P=b(),_=a("div"),A=a("div"),I=T(e[2]),J=b(),H=a("div");for(let B=0;B<N.length;B+=1)N[B].c();de=b(),ie=a("button"),ie.innerHTML=`<span class="reboot-icon svelte-vlabwb">🔄</span>
|
|
REBOOT`,t(i,"class","svelte-vlabwb"),t(r,"class","status-dot svelte-vlabwb"),W(r,"disconnected",!e[5]),t(s,"class","card-header svelte-vlabwb"),t(h,"class","source-label svelte-vlabwb"),t(c,"class","source-item svelte-vlabwb"),t(k,"class","source-label svelte-vlabwb"),t(p,"class","source-item svelte-vlabwb"),t(v,"class","sources svelte-vlabwb"),t(O,"class","band-value svelte-vlabwb"),t(F,"class","band-item svelte-vlabwb"),t(A,"class","band-value svelte-vlabwb"),t(_,"class","band-item svelte-vlabwb"),t(m,"class","bands svelte-vlabwb"),t(H,"class","antennas svelte-vlabwb"),t(ie,"class","reboot-btn svelte-vlabwb"),t(d,"class","metrics svelte-vlabwb"),t(l,"class","card svelte-vlabwb")},m(B,Q){L(B,l,Q),n(l,s),n(s,i),n(s,o),n(s,r),n(l,f),n(l,d),n(d,v),n(v,c),n(c,h),n(h,w),n(v,g),n(v,p),n(p,k),n(k,M),n(d,C),n(d,m),n(m,F),n(F,O),n(O,z),n(m,P),n(m,_),n(_,A),n(A,I),n(d,J),n(d,H);for(let q=0;q<N.length;q+=1)N[q]&&N[q].m(H,null);n(d,de),n(d,ie),S||(te=Ce(ie,"click",e[7]),S=!0)},p(B,[Q]){if(Q&32&&W(r,"disconnected",!B[5]),Q&2&&u!==(u=(B[1].source||"FLEX")+"")&&R(w,u),Q&1&&y!==(y=(B[0].source||"FLEX")+"")&&R(M,y),Q&8&&R(z,B[3]),Q&4&&R(I,B[2]),Q&83){V=ut(B[4]);let q;for(q=0;q<V.length;q+=1){const fe=Pl(B,V,q);N[q]?N[q].p(fe,Q):(N[q]=Ol(fe),N[q].c(),N[q].m(H,null))}for(;q<N.length;q+=1)N[q].d(1);N.length=V.length}},i:ge,o:ge,d(B){B&&E(l),Dt(N,B),S=!1,te()}}}function Bn(e,l,s){let i,o,r,f,d,v,{status:c}=l;const h={0:"160M",1:"80M",2:"60M",3:"40M",4:"30M",5:"20M",6:"17M",7:"15M",8:"12M",9:"10M",10:"6M",11:"4M",12:"2M",13:"1.25M",14:"70CM",15:"GEN"};async function u(M,C){try{M===1&&o.rx_ant===C||M===2&&r.rx_ant===C?(console.log(`Deselecting antenna ${C} from port ${M}`),await Oe.antenna.deselectAntenna(M,C)):(console.log(`Selecting antenna ${C} on port ${M}`),await Oe.antenna.selectAntenna(M,C))}catch(m){console.error("Failed to select/deselect antenna:",m)}}let w=!1,g=!1;async function p(){if(confirm("Are you sure you want to reboot the Antenna Genius?"))try{await Oe.antenna.reboot(),console.log("Antenna Genius reboot command sent")}catch(M){console.error("Failed to reboot:",M)}}const k=M=>u(1,M.number),y=M=>u(2,M.number);return e.$$set=M=>{"status"in M&&s(8,c=M.status)},e.$$.update=()=>{e.$$.dirty&256&&s(5,i=(c==null?void 0:c.connected)||!1),e.$$.dirty&256&&s(1,o=(c==null?void 0:c.port_a)||{}),e.$$.dirty&256&&s(0,r=(c==null?void 0:c.port_b)||{}),e.$$.dirty&256&&s(4,f=(c==null?void 0:c.antennas)||[]),e.$$.dirty&2&&s(3,d=h[o.band]||"None"),e.$$.dirty&1&&s(2,v=h[r.band]||"None"),e.$$.dirty&1795&&c&&(o.tx!==w||r.tx!==g)&&(console.log("AntennaGenius TX state changed:",{portA_tx:o.tx,portB_tx:r.tx,portA_tx_ant:o.tx_ant,portB_tx_ant:r.tx_ant}),s(9,w=o.tx),s(10,g=r.tx))},[r,o,v,d,f,i,u,p,c,w,g,k,y]}class Gn extends pt{constructor(l){super(),vt(this,l,Bn,Wn,ot,{status:8})}}function Al(e,l,s){const i=e.slice();i[16]=l[s];const o=150+125*Math.sin(i[16]*Math.PI/180);i[17]=o;const r=150-125*Math.cos(i[16]*Math.PI/180);return i[18]=r,i}function Il(e){let l,s,i,o;return{c(){l=a("span"),s=T("→ "),i=T(e[0]),o=T("°"),t(l,"class","target-indicator svelte-3omzwr")},m(r,f){L(r,l,f),n(l,s),n(l,i),n(l,o)},p(r,f){f&1&&R(i,r[0])},d(r){r&&E(l)}}}function Nl(e){let l,s,i,o,r;return{c(){l=D("g"),s=D("line"),i=D("g"),o=D("polygon"),t(s,"x1","0"),t(s,"y1","0"),t(s,"x2","0"),t(s,"y2","-125"),t(s,"stroke","rgba(255, 255, 255, 0.3)"),t(s,"stroke-width","2"),t(s,"stroke-dasharray","5,5"),t(s,"opacity","0.6"),t(o,"points","0,-8 -5,5 5,5"),t(o,"fill","rgba(255, 255, 255, 0.4)"),t(o,"stroke","rgba(255, 255, 255, 0.5)"),t(o,"stroke-width","1"),t(i,"transform","translate(0, -125)"),t(l,"transform",r="rotate("+e[3]+")")},m(f,d){L(f,l,d),n(l,s),n(l,i),n(i,o)},p(f,d){d&8&&r!==(r="rotate("+f[3]+")")&&t(l,"transform",r)},d(f){f&&E(l)}}}function Dl(e){let l,s,i,o,r;return{c(){l=D("path"),s=D("line"),i=D("line"),o=D("g"),r=D("polygon"),t(l,"d","M 0,0 L "+-Math.sin(15*Math.PI/180)*130+","+-Math.cos(15*Math.PI/180)*130+` \r
|
|
A 130,130 0 0,1 `+Math.sin(15*Math.PI/180)*130+","+-Math.cos(15*Math.PI/180)*130+" Z"),t(l,"fill","url(#beamGradient)"),t(l,"opacity","0.85"),t(s,"x1","0"),t(s,"y1","0"),t(s,"x2",-Math.sin(15*Math.PI/180)*130),t(s,"y2",-Math.cos(15*Math.PI/180)*130),t(s,"stroke","#4fc3f7"),t(s,"stroke-width","2"),t(s,"opacity","0.9"),t(i,"x1","0"),t(i,"y1","0"),t(i,"x2",Math.sin(15*Math.PI/180)*130),t(i,"y2",-Math.cos(15*Math.PI/180)*130),t(i,"stroke","#4fc3f7"),t(i,"stroke-width","2"),t(i,"opacity","0.9"),t(r,"points","0,-20 -8,5 0,0 8,5"),t(r,"fill","#4fc3f7"),t(r,"stroke","#0288d1"),t(r,"stroke-width","2"),ce(r,"filter","drop-shadow(0 0 10px rgba(79, 195, 247, 1))"),t(o,"transform","translate(0, -110)")},m(f,d){L(f,l,d),L(f,s,d),L(f,i,d),L(f,o,d),n(o,r)},p:ge,d(f){f&&(E(l),E(s),E(i),E(o))}}}function El(e){let l,s,i,o,r;return{c(){l=D("path"),s=D("line"),i=D("line"),o=D("g"),r=D("polygon"),t(l,"d","M 0,0 L "+-Math.sin(15*Math.PI/180)*130+","+Math.cos(15*Math.PI/180)*130+` \r
|
|
A 130,130 0 0,0 `+Math.sin(15*Math.PI/180)*130+","+Math.cos(15*Math.PI/180)*130+" Z"),t(l,"fill","url(#beamGradient)"),t(l,"opacity","0.85"),t(s,"x1","0"),t(s,"y1","0"),t(s,"x2",-Math.sin(15*Math.PI/180)*130),t(s,"y2",Math.cos(15*Math.PI/180)*130),t(s,"stroke","#4fc3f7"),t(s,"stroke-width","2"),t(s,"opacity","0.9"),t(i,"x1","0"),t(i,"y1","0"),t(i,"x2",Math.sin(15*Math.PI/180)*130),t(i,"y2",Math.cos(15*Math.PI/180)*130),t(i,"stroke","#4fc3f7"),t(i,"stroke-width","2"),t(i,"opacity","0.9"),t(r,"points","0,20 -8,-5 0,0 8,-5"),t(r,"fill","#4fc3f7"),t(r,"stroke","#0288d1"),t(r,"stroke-width","2"),ce(r,"filter","drop-shadow(0 0 10px rgba(79, 195, 247, 1))"),t(o,"transform","translate(0, 110)")},m(f,d){L(f,l,d),L(f,s,d),L(f,i,d),L(f,o,d),n(o,r)},p:ge,d(f){f&&(E(l),E(s),E(i),E(o))}}}function Ll(e){let l,s,i,o,r,f,d,v,c,h;return{c(){l=D("path"),s=D("path"),i=D("line"),o=D("line"),r=D("line"),f=D("line"),d=D("g"),v=D("polygon"),c=D("g"),h=D("polygon"),t(l,"d","M 0,0 L "+-Math.sin(15*Math.PI/180)*130+","+-Math.cos(15*Math.PI/180)*130+` \r
|
|
A 130,130 0 0,1 `+Math.sin(15*Math.PI/180)*130+","+-Math.cos(15*Math.PI/180)*130+" Z"),t(l,"fill","url(#beamGradient)"),t(l,"opacity","0.7"),t(s,"d","M 0,0 L "+-Math.sin(15*Math.PI/180)*130+","+Math.cos(15*Math.PI/180)*130+` \r
|
|
A 130,130 0 0,0 `+Math.sin(15*Math.PI/180)*130+","+Math.cos(15*Math.PI/180)*130+" Z"),t(s,"fill","url(#beamGradient)"),t(s,"opacity","0.7"),t(i,"x1","0"),t(i,"y1","0"),t(i,"x2",-Math.sin(15*Math.PI/180)*130),t(i,"y2",-Math.cos(15*Math.PI/180)*130),t(i,"stroke","#4fc3f7"),t(i,"stroke-width","2"),t(i,"opacity","0.8"),t(o,"x1","0"),t(o,"y1","0"),t(o,"x2",Math.sin(15*Math.PI/180)*130),t(o,"y2",-Math.cos(15*Math.PI/180)*130),t(o,"stroke","#4fc3f7"),t(o,"stroke-width","2"),t(o,"opacity","0.8"),t(r,"x1","0"),t(r,"y1","0"),t(r,"x2",-Math.sin(15*Math.PI/180)*130),t(r,"y2",Math.cos(15*Math.PI/180)*130),t(r,"stroke","#4fc3f7"),t(r,"stroke-width","2"),t(r,"opacity","0.8"),t(f,"x1","0"),t(f,"y1","0"),t(f,"x2",Math.sin(15*Math.PI/180)*130),t(f,"y2",Math.cos(15*Math.PI/180)*130),t(f,"stroke","#4fc3f7"),t(f,"stroke-width","2"),t(f,"opacity","0.8"),t(v,"points","0,-20 -8,5 0,0 8,5"),t(v,"fill","#4fc3f7"),t(v,"stroke","#0288d1"),t(v,"stroke-width","2"),ce(v,"filter","drop-shadow(0 0 10px rgba(79, 195, 247, 1))"),t(d,"transform","translate(0, -110)"),t(h,"points","0,20 -8,-5 0,0 8,-5"),t(h,"fill","#4fc3f7"),t(h,"stroke","#0288d1"),t(h,"stroke-width","2"),ce(h,"filter","drop-shadow(0 0 10px rgba(79, 195, 247, 1))"),t(c,"transform","translate(0, 110)")},m(u,w){L(u,l,w),L(u,s,w),L(u,i,w),L(u,o,w),L(u,r,w),L(u,f,w),L(u,d,w),n(d,v),L(u,c,w),n(c,h)},p:ge,d(u){u&&(E(l),E(s),E(i),E(o),E(r),E(f),E(d),E(c))}}}function Rl(e){let l,s,i,o,r,f;return{c(){l=D("g"),s=D("line"),i=D("g"),o=D("polygon"),r=D("animate"),t(s,"x1","0"),t(s,"y1","0"),t(s,"x2","0"),t(s,"y2","-135"),t(s,"stroke","#ffc107"),t(s,"stroke-width","3"),t(s,"stroke-dasharray","8,4"),t(s,"opacity","0.9"),t(r,"attributeName","opacity"),t(r,"values","0.8;1;0.8"),t(r,"dur","1s"),t(r,"repeatCount","indefinite"),t(o,"points","0,-12 -8,6 0,2 8,6"),t(o,"fill","#ffc107"),t(o,"stroke","#ff9800"),t(o,"stroke-width","1.5"),ce(o,"filter","drop-shadow(0 0 10px rgba(255, 193, 7, 0.8))"),t(i,"transform","translate(0, -135)"),t(l,"transform",f="rotate("+e[0]+")")},m(d,v){L(d,l,v),n(l,s),n(l,i),n(i,o),n(o,r)},p(d,v){v&1&&f!==(f="rotate("+d[0]+")")&&t(l,"transform",f)},d(d){d&&E(l)}}}function Wl(e){let l,s,i;return{c(){l=D("text"),s=T(e[16]),i=T("°"),t(l,"x",e[17]),t(l,"y",e[18]),t(l,"text-anchor","middle"),t(l,"dominant-baseline","middle"),t(l,"class","degree-label svelte-3omzwr")},m(o,r){L(o,l,r),n(l,s),n(l,i)},p:ge,d(o){o&&E(l)}}}function Bl(e){let l;return{c(){l=a("div"),l.innerHTML='<div class="legend-item svelte-3omzwr"><svg width="30" height="20" viewBox="0 0 30 20"><line x1="5" y1="10" x2="25" y2="10" stroke="rgba(255,255,255,0.3)" stroke-width="2" stroke-dasharray="3,3"></line></svg> <span>Physical antenna</span></div> <div class="legend-item svelte-3omzwr"><svg width="30" height="20" viewBox="0 0 30 20"><line x1="5" y1="10" x2="25" y2="10" stroke="#4fc3f7" stroke-width="2"></line></svg> <span>Radiation pattern</span></div>',t(l,"class","map-legend svelte-3omzwr")},m(s,i){L(s,l,i)},d(s){s&&E(l)}}}function jn(e){let l,s,i,o,r,f,d,v,c,h,u,w,g,p,k,y,M,C,m,F,O,z,P,_,A,I,J,H,de,ie,S,te,V,N,B,Q,q,fe,Pe,le,X,ae,Z,we,oe,re,ue,Me,Ie,Se,Ne,Ae,Fe,$=e[2]&&e[0]!==null&&Il(e),_e=(e[4]===1||e[4]===2)&&Nl(e),ne=e[4]===0&&Dl(),se=e[4]===1&&El(),K=e[4]===2&&Ll(),ee=e[2]&&e[0]!==null&&Rl(e),j=ut([45,135,225,315]),x=[];for(let G=0;G<4;G+=1)x[G]=Wl(Al(e,j,G));let Y=(e[4]===1||e[4]===2)&&Bl();return{c(){l=a("div"),s=a("div"),i=a("h2"),i.textContent="Rotator Genius",o=b(),r=a("span"),f=b(),d=a("div"),v=a("div"),c=a("div"),h=a("div"),h.textContent="CURRENT HEADING",u=b(),w=a("div"),g=T(e[3]),p=T(`°\r
|
|
`),$&&$.c(),k=b(),y=a("div"),M=a("button"),M.textContent="↺",C=b(),m=a("button"),m.textContent="■",F=b(),O=a("button"),O.textContent="↻",z=b(),P=a("div"),_=D("svg"),A=D("defs"),I=D("radialGradient"),J=D("stop"),H=D("stop"),de=D("circle"),ie=D("circle"),S=D("circle"),te=D("circle"),V=D("g"),_e&&_e.c(),N=D("g"),ne&&ne.c(),B=At(),se&&se.c(),Q=At(),K&&K.c(),ee&&ee.c(),fe=D("circle"),Pe=D("animate"),le=D("circle"),X=D("animate"),ae=D("animate"),Z=D("text"),we=T("N"),oe=D("text"),re=T("E"),ue=D("text"),Me=T("S"),Ie=D("text"),Se=T("W");for(let G=0;G<4;G+=1)x[G].c();Ne=b(),Y&&Y.c(),t(i,"class","svelte-3omzwr"),t(r,"class","status-dot svelte-3omzwr"),W(r,"disconnected",!e[1]),t(s,"class","card-header svelte-3omzwr"),t(h,"class","heading-label svelte-3omzwr"),t(w,"class","heading-value svelte-3omzwr"),t(c,"class","heading-display-compact svelte-3omzwr"),t(M,"class","btn-mini ccw svelte-3omzwr"),t(M,"title","Rotate Counter-Clockwise"),t(m,"class","btn-mini stop svelte-3omzwr"),t(m,"title","Stop Rotation"),t(O,"class","btn-mini cw svelte-3omzwr"),t(O,"title","Rotate Clockwise"),t(y,"class","controls-compact svelte-3omzwr"),t(v,"class","heading-controls-row svelte-3omzwr"),t(J,"offset","0%"),ce(J,"stop-color","rgba(79, 195, 247, 0.7)"),ce(J,"stop-opacity","1"),t(H,"offset","100%"),ce(H,"stop-color","rgba(79, 195, 247, 0)"),ce(H,"stop-opacity","0"),t(I,"id","beamGradient"),t(de,"cx","150"),t(de,"cy","150"),t(de,"r","140"),t(de,"fill","rgba(30, 64, 175, 0.15)"),t(de,"stroke","rgba(79, 195, 247, 0.4)"),t(de,"stroke-width","2"),t(ie,"cx","150"),t(ie,"cy","150"),t(ie,"r","105"),t(ie,"fill","none"),t(ie,"stroke","rgba(79,195,247,0.2)"),t(ie,"stroke-width","1"),t(ie,"stroke-dasharray","3,3"),t(S,"cx","150"),t(S,"cy","150"),t(S,"r","70"),t(S,"fill","none"),t(S,"stroke","rgba(79,195,247,0.2)"),t(S,"stroke-width","1"),t(S,"stroke-dasharray","3,3"),t(te,"cx","150"),t(te,"cy","150"),t(te,"r","35"),t(te,"fill","none"),t(te,"stroke","rgba(79,195,247,0.2)"),t(te,"stroke-width","1"),t(te,"stroke-dasharray","3,3"),t(N,"transform",q="rotate("+e[3]+")"),t(Pe,"attributeName","r"),t(Pe,"values","5;7;5"),t(Pe,"dur","2s"),t(Pe,"repeatCount","indefinite"),t(fe,"cx","0"),t(fe,"cy","0"),t(fe,"r","5"),t(fe,"fill","#f44336"),t(fe,"stroke","#fff"),t(fe,"stroke-width","2"),t(X,"attributeName","r"),t(X,"values","10;16;10"),t(X,"dur","2s"),t(X,"repeatCount","indefinite"),t(ae,"attributeName","opacity"),t(ae,"values","0.5;0;0.5"),t(ae,"dur","2s"),t(ae,"repeatCount","indefinite"),t(le,"cx","0"),t(le,"cy","0"),t(le,"r","10"),t(le,"fill","none"),t(le,"stroke","#f44336"),t(le,"stroke-width","1.5"),t(le,"opacity","0.5"),t(V,"transform","translate(150, 150)"),t(Z,"x","150"),t(Z,"y","20"),t(Z,"text-anchor","middle"),t(Z,"class","cardinal svelte-3omzwr"),t(oe,"x","280"),t(oe,"y","155"),t(oe,"text-anchor","middle"),t(oe,"class","cardinal svelte-3omzwr"),t(ue,"x","150"),t(ue,"y","285"),t(ue,"text-anchor","middle"),t(ue,"class","cardinal svelte-3omzwr"),t(Ie,"x","20"),t(Ie,"y","155"),t(Ie,"text-anchor","middle"),t(Ie,"class","cardinal svelte-3omzwr"),t(_,"viewBox","0 0 300 300"),t(_,"class","map-svg clickable-compass svelte-3omzwr"),t(_,"role","button"),t(_,"tabindex","0"),t(_,"aria-label","Click to rotate antenna to direction"),t(P,"class","map-container svelte-3omzwr"),t(d,"class","metrics svelte-3omzwr"),t(l,"class","card svelte-3omzwr")},m(G,me){L(G,l,me),n(l,s),n(s,i),n(s,o),n(s,r),n(l,f),n(l,d),n(d,v),n(v,c),n(c,h),n(c,u),n(c,w),n(w,g),n(w,p),$&&$.m(w,null),n(v,k),n(v,y),n(y,M),n(y,C),n(y,m),n(y,F),n(y,O),n(d,z),n(d,P),n(P,_),n(_,A),n(A,I),n(I,J),n(I,H),n(_,de),n(_,ie),n(_,S),n(_,te),n(_,V),_e&&_e.m(V,null),n(V,N),ne&&ne.m(N,null),n(N,B),se&&se.m(N,null),n(N,Q),K&&K.m(N,null),ee&&ee.m(V,null),n(V,fe),n(fe,Pe),n(V,le),n(le,X),n(le,ae),n(_,Z),n(Z,we),n(_,oe),n(oe,re),n(_,ue),n(ue,Me),n(_,Ie),n(Ie,Se);for(let ve=0;ve<4;ve+=1)x[ve]&&x[ve].m(_,null);n(d,Ne),Y&&Y.m(d,null),Ae||(Fe=[Ce(M,"click",e[6]),Ce(m,"click",e[7]),Ce(O,"click",e[5]),Ce(_,"click",e[8]),Ce(_,"keydown",e[15])],Ae=!0)},p(G,[me]){if(me&2&&W(r,"disconnected",!G[1]),me&8&&R(g,G[3]),G[2]&&G[0]!==null?$?$.p(G,me):($=Il(G),$.c(),$.m(w,null)):$&&($.d(1),$=null),G[4]===1||G[4]===2?_e?_e.p(G,me):(_e=Nl(G),_e.c(),_e.m(V,N)):_e&&(_e.d(1),_e=null),G[4]===0?ne?ne.p(G,me):(ne=Dl(),ne.c(),ne.m(N,B)):ne&&(ne.d(1),ne=null),G[4]===1?se?se.p(G,me):(se=El(),se.c(),se.m(N,Q)):se&&(se.d(1),se=null),G[4]===2?K?K.p(G,me):(K=Ll(),K.c(),K.m(N,null)):K&&(K.d(1),K=null),me&8&&q!==(q="rotate("+G[3]+")")&&t(N,"transform",q),G[2]&&G[0]!==null?ee?ee.p(G,me):(ee=Rl(G),ee.c(),ee.m(V,fe)):ee&&(ee.d(1),ee=null),me&0){j=ut([45,135,225,315]);let ve;for(ve=0;ve<4;ve+=1){const Ee=Al(G,j,ve);x[ve]?x[ve].p(Ee,me):(x[ve]=Wl(Ee),x[ve].c(),x[ve].m(_,null))}for(;ve<4;ve+=1)x[ve].d(1)}G[4]===1||G[4]===2?Y||(Y=Bl(),Y.c(),Y.m(d,null)):Y&&(Y.d(1),Y=null)},i:ge,o:ge,d(G){G&&E(l),$&&$.d(),_e&&_e.d(),ne&&ne.d(),se&&se.d(),K&&K.d(),ee&&ee.d(),Dt(x,G),Y&&Y.d(),Ae=!1,nt(Fe)}}}function Un(e,l,s){let i,o,r,f,d,v,{status:c}=l,{ultrabeam:h=null}=l,u=null,w=!1,g=null;async function p(){try{await Oe.rotator.rotateCW()}catch(m){console.error("Failed to rotate CW:",m)}}async function k(){try{await Oe.rotator.rotateCCW()}catch(m){console.error("Failed to rotate CCW:",m)}}async function y(){try{s(12,g=null),await Oe.rotator.stop()}catch(m){console.error("Failed to stop:",m)}}async function M(m){const O=m.currentTarget.getBoundingClientRect(),z=O.width/2,P=O.height/2,_=m.clientX-O.left-z,A=m.clientY-O.top-P;let I=Math.atan2(_,-A)*(180/Math.PI);I<0&&(I+=360);const H=(Math.round(I/5)*5+360)%360;try{await Oe.rotator.setHeading(H),s(12,g=H)}catch(de){console.error("Failed to set heading:",de)}}const C=m=>m.key==="Enter"&&M(m);return e.$$set=m=>{"status"in m&&s(9,c=m.status),"ultrabeam"in m&&s(10,h=m.ultrabeam)},e.$$.update=()=>{if(e.$$.dirty&1024&&s(4,i=(h==null?void 0:h.direction)??0),e.$$.dirty&2560&&(c==null?void 0:c.heading)!==void 0&&(c==null?void 0:c.heading)!==null){const m=c.heading;u===null?(s(11,u=m),console.log(` ✓ First load, set to ${u}°`)):m===0&&u>10&&u<350?console.log(` ✗ IGNORED glitch jump from ${u}° to 0°`):s(11,u=m)}if(e.$$.dirty&2048&&s(3,o=u!==null?u:0),e.$$.dirty&512&&s(1,w=(c==null?void 0:c.connected)||!1),e.$$.dirty&512&&s(13,r=(c==null?void 0:c.target_heading)??null),e.$$.dirty&10240&&s(14,f=r!==null&&u!==null&&(()=>{const m=Math.abs(r-u);return Math.min(m,360-m)>2})()),e.$$.dirty&6144&&g!==null&&u!==null){const m=Math.abs(u-g);Math.min(m,360-m)<3&&s(12,g=null)}e.$$.dirty&28672&&s(0,d=g??(f?r:null)),e.$$.dirty&2049&&s(2,v=d!==null&&u!==null&&(()=>{const m=Math.abs(d-u);return Math.min(m,360-m)>2})())},[d,w,v,o,i,p,k,y,M,c,h,u,g,r,f,C]}class Jn extends pt{constructor(l){super(),vt(this,l,Un,jn,ot,{status:9,ultrabeam:10})}}function Gl(e,l,s){const i=e.slice();return i[35]=l[s],i}function jl(e){let l,s=e[35].label+"",i;return{c(){l=a("option"),i=T(s),l.__value=e[35].value,Pt(l,l.__value)},m(o,r){L(o,l,r),n(l,i)},p:ge,d(o){o&&E(l)}}}function Ul(e){let l,s,i,o,r,f,d,v,c,h=e[6].toFixed(0)+"",u,w;return{c(){l=a("div"),s=a("h3"),s.textContent="Motors Moving...",i=b(),o=a("div"),r=a("div"),f=b(),d=a("div"),v=T(e[0]),c=T(" / 60 ("),u=T(h),w=T("%)"),t(s,"class","svelte-f1lt87"),t(r,"class","progress-fill svelte-f1lt87"),ce(r,"width",e[6]+"%"),t(o,"class","progress-bar svelte-f1lt87"),t(d,"class","progress-text svelte-f1lt87"),t(l,"class","progress-section svelte-f1lt87")},m(g,p){L(g,l,p),n(l,s),n(l,i),n(l,o),n(o,r),n(l,f),n(l,d),n(d,v),n(d,c),n(d,u),n(d,w)},p(g,p){p[0]&64&&ce(r,"width",g[6]+"%"),p[0]&1&&R(v,g[0]),p[0]&64&&h!==(h=g[6].toFixed(0)+"")&&R(u,h)},d(g){g&&E(l)}}}function Xn(e){let l,s,i,o,r,f,d,v,c,h,u,w,g,p=(e[1]/1e3).toFixed(3)+"",k,y,M,C,m,F,O,z,P,_,A,I,J,H=e[10][e[2]]+"",de,ie,S,te,V,N,B,Q,q,fe,Pe,le,X,ae,Z,we,oe,re,ue,Me,Ie,Se,Ne,Ae,Fe,$,_e,ne,se=ut(e[11]),K=[];for(let j=0;j<se.length;j+=1)K[j]=jl(Gl(e,se,j));let ee=e[8]>0&&Ul(e);return{c(){l=a("div"),s=a("div"),i=a("h2"),i.textContent="Ultrabeam VL2.3",o=b(),r=a("div"),f=a("span"),d=b(),v=a("div"),c=a("div"),h=a("div"),u=a("div"),u.textContent="Frequency",w=b(),g=a("div"),k=T(p),y=T(" MHz"),M=b(),C=a("div"),m=a("div"),m.textContent="Band",F=b(),O=a("div"),z=T(e[7]),P=b(),_=a("div"),A=a("div"),A.textContent="Direction",I=b(),J=a("div"),de=T(H),ie=b(),S=a("div"),te=a("h3"),te.textContent="Auto Tracking",V=b(),N=a("div"),B=a("label"),Q=a("input"),q=b(),fe=a("span"),fe.textContent="Enable Auto-Track from Tuner",Pe=b(),le=a("div"),X=a("label"),X.textContent="Threshold:",ae=b(),Z=a("select");for(let j=0;j<K.length;j+=1)K[j].c();we=b(),oe=a("div"),re=a("button"),re.textContent="Normal",ue=b(),Me=a("button"),Me.textContent="180°",Ie=b(),Se=a("button"),Se.textContent="Bi-Dir",Ne=b(),ee&&ee.c(),Ae=b(),Fe=a("div"),$=a("button"),$.innerHTML=`<span class="icon">↓</span>
|
|
Retract Elements`,t(i,"class","svelte-f1lt87"),t(f,"class","status-dot svelte-f1lt87"),W(f,"disconnected",!e[9]),t(r,"class","header-right svelte-f1lt87"),t(s,"class","card-header svelte-f1lt87"),t(u,"class","status-label svelte-f1lt87"),t(g,"class","status-value freq svelte-f1lt87"),t(h,"class","status-item svelte-f1lt87"),t(m,"class","status-label svelte-f1lt87"),t(O,"class","status-value band svelte-f1lt87"),t(C,"class","status-item svelte-f1lt87"),t(A,"class","status-label svelte-f1lt87"),t(J,"class","status-value direction svelte-f1lt87"),t(_,"class","status-item svelte-f1lt87"),t(c,"class","status-grid svelte-f1lt87"),t(te,"class","svelte-f1lt87"),t(Q,"type","checkbox"),t(Q,"class","svelte-f1lt87"),t(B,"class","toggle-label svelte-f1lt87"),t(X,"for","threshold-select"),t(X,"class","svelte-f1lt87"),t(Z,"id","threshold-select"),e[4]===void 0&&Nt(()=>e[22].call(Z)),t(le,"class","threshold-group svelte-f1lt87"),t(N,"class","auto-track-controls svelte-f1lt87"),t(re,"class","dir-btn svelte-f1lt87"),W(re,"active",e[5]===0),t(Me,"class","dir-btn svelte-f1lt87"),W(Me,"active",e[5]===1),t(Se,"class","dir-btn svelte-f1lt87"),W(Se,"active",e[5]===2),t(oe,"class","direction-buttons svelte-f1lt87"),t(S,"class","control-section compact svelte-f1lt87"),t($,"class","btn-danger"),t(Fe,"class","actions svelte-f1lt87"),t(v,"class","metrics svelte-f1lt87"),t(l,"class","card svelte-f1lt87")},m(j,x){L(j,l,x),n(l,s),n(s,i),n(s,o),n(s,r),n(r,f),n(l,d),n(l,v),n(v,c),n(c,h),n(h,u),n(h,w),n(h,g),n(g,k),n(g,y),n(c,M),n(c,C),n(C,m),n(C,F),n(C,O),n(O,z),n(c,P),n(c,_),n(_,A),n(_,I),n(_,J),n(J,de),n(v,ie),n(v,S),n(S,te),n(S,V),n(S,N),n(N,B),n(B,Q),Q.checked=e[3],n(B,q),n(B,fe),n(N,Pe),n(N,le),n(le,X),n(le,ae),n(le,Z);for(let Y=0;Y<K.length;Y+=1)K[Y]&&K[Y].m(Z,null);It(Z,e[4],!0),n(S,we),n(S,oe),n(oe,re),n(oe,ue),n(oe,Me),n(oe,Ie),n(oe,Se),n(v,Ne),ee&&ee.m(v,null),n(v,Ae),n(v,Fe),n(Fe,$),_e||(ne=[Ce(Q,"change",e[21]),Ce(Q,"change",e[13]),Ce(Z,"change",e[22]),Ce(Z,"change",e[13]),Ce(re,"click",e[23]),Ce(Me,"click",e[24]),Ce(Se,"click",e[25]),Ce($,"click",e[14])],_e=!0)},p(j,x){if(x[0]&512&&W(f,"disconnected",!j[9]),x[0]&2&&p!==(p=(j[1]/1e3).toFixed(3)+"")&&R(k,p),x[0]&128&&R(z,j[7]),x[0]&4&&H!==(H=j[10][j[2]]+"")&&R(de,H),x[0]&8&&(Q.checked=j[3]),x[0]&2048){se=ut(j[11]);let Y;for(Y=0;Y<se.length;Y+=1){const G=Gl(j,se,Y);K[Y]?K[Y].p(G,x):(K[Y]=jl(G),K[Y].c(),K[Y].m(Z,null))}for(;Y<K.length;Y+=1)K[Y].d(1);K.length=se.length}x[0]&2064&&It(Z,j[4]),x[0]&32&&W(re,"active",j[5]===0),x[0]&32&&W(Me,"active",j[5]===1),x[0]&32&&W(Se,"active",j[5]===2),j[8]>0?ee?ee.p(j,x):(ee=Ul(j),ee.c(),ee.m(v,Ae)):ee&&(ee.d(1),ee=null)},i:ge,o:ge,d(j){j&&E(l),Dt(K,j),ee&&ee.d(),_e=!1,nt(ne)}}}function Yn(e,l,s){let i,o,r,f,d,v,c,h,u,w,g,{status:p}=l,{flexradio:k=null}=l;const y=["6M","10M","12M","15M","17M","20M","30M","40M"];function M(S,te){return te>=0&&te<=7?y[te]:S>=7e3&&S<=7300?"40M":S>=10100&&S<=10150?"30M":S>=14e3&&S<=14350?"20M":S>=18068&&S<=18168?"17M":S>=21e3&&S<=21450?"15M":S>=24890&&S<=24990?"12M":S>=28e3&&S<=29700?"10M":S>=5e4&&S<=54e3?"6M":"Unknown"}const C=["Normal","180°","Bi-Dir"],m=[{value:25,label:"25 kHz"},{value:50,label:"50 kHz"},{value:100,label:"100 kHz"}];let F=!0,O=25,z=0;async function P(){if(o!==0)try{await Oe.ultrabeam.setFrequency(o,z),await Oe.ultrabeam.setDirection(z)}catch(S){console.log("Direction change sent (may show code 30 if busy):",S)}}async function _(){try{await Oe.ultrabeam.setAutoTrack(F,O)}catch(S){console.error("Failed to update auto-track:",S)}}async function A(){if(confirm("Retract all antenna elements?"))try{await Oe.ultrabeam.retract()}catch(S){console.error("Failed to retract:",S)}}function I(){F=this.checked,s(3,F)}function J(){O=tn(this),s(4,O),s(11,m)}const H=()=>{s(5,z=0),P()},de=()=>{s(5,z=1),P()},ie=()=>{s(5,z=2),P()};return e.$$set=S=>{"status"in S&&s(15,p=S.status),"flexradio"in S&&s(16,k=S.flexradio)},e.$$.update=()=>{e.$$.dirty[0]&32768&&s(9,i=(p==null?void 0:p.connected)||!1),e.$$.dirty[0]&32768&&s(1,o=(p==null?void 0:p.frequency)||0),e.$$.dirty[0]&32768&&s(18,r=(p==null?void 0:p.band)||0),e.$$.dirty[0]&32768&&s(2,f=(p==null?void 0:p.direction)||0),e.$$.dirty[0]&32768&&s(8,d=(p==null?void 0:p.motors_moving)||0),e.$$.dirty[0]&32768&&s(17,v=(p==null?void 0:p.progress_total)||0),e.$$.dirty[0]&32768&&s(0,c=(p==null?void 0:p.progress_current)||0),e.$$.dirty[0]&32768&&p!=null&&p.element_lengths,e.$$.dirty[0]&32768&&p&&`${p.firmware_major}${p.firmware_minor}`,e.$$.dirty[0]&65536&&s(20,h=(k==null?void 0:k.connected)||!1),e.$$.dirty[0]&65536&&s(19,u=(k==null?void 0:k.interlock_state)||null),e.$$.dirty[0]&524288,e.$$.dirty[0]&1638400&&k&&console.log("FlexRadio data:",{connected:k.connected,interlock_state:k.interlock_state,interlockConnected:h,interlockState:u}),e.$$.dirty[0]&262146&&s(7,w=M(o,r)),e.$$.dirty[0]&4&&s(5,z=f),e.$$.dirty[0]&262144,e.$$.dirty[0]&131073&&s(6,g=v>0?c/60*100:0)},[c,o,f,F,O,z,g,w,d,i,C,m,P,_,A,p,k,v,r,u,h,I,J,H,de,ie]}class Vn extends pt{constructor(l){super(),vt(this,l,Yn,Xn,ot,{status:15,flexradio:16},null,[-1,-1])}}function Zn(e){var Tt,be,ye,Jt,Xt,Yt,Vt,Zt,Kt,Ht,Qt;let l,s,i,o,r,f,d,v,c,h,u=e[1]?"Connected":"Disconnected",w,g,p,k,y,M,C,m=e[7].sfi+"",F,O,z,P,_,A=e[7].sunspots+"",I,J,H,de,ie,S=e[7].a_index+"",te,V,N,B,Q,q=e[7].k_index+"",fe,Pe,le,X,ae,Z=e[7].geomag+"",we,oe,re,ue,Me,Ie,Se=e[6].wind_speed.toFixed(1)+"",Ne,Ae,Fe,$,_e,ne=e[6].wind_gust.toFixed(1)+"",se,K,ee,j,x,Y=e[6].temp.toFixed(1)+"",G,me,ve,Ee,Ve,Ze=e[6].feels_like.toFixed(1)+"",We,Xe,Be,Le,$e,De=Jl(e[2])+"",qe,Ke,xe,Ge=e[2].toLocaleDateString()+"",pe,Te,et,ht,rt,st,Re,He,Mt,Qe,gt,tt,it,je,lt,Ye,Ue,at,Je,ze;return et=new Fn({props:{flexradio:(Tt=e[0])==null?void 0:Tt.flexradio,weather:(be=e[0])==null?void 0:be.weather,latitude:e[4],longitude:e[5],windWarningThreshold:30,gustWarningThreshold:50}}),He=new An({props:{status:(ye=e[0])==null?void 0:ye.webswitch}}),Qe=new Dn({props:{status:(Jt=e[0])==null?void 0:Jt.power_genius}}),tt=new Rn({props:{status:(Xt=e[0])==null?void 0:Xt.tuner_genius,flexradio:(Yt=e[0])==null?void 0:Yt.flexradio}}),lt=new Gn({props:{status:(Vt=e[0])==null?void 0:Vt.antenna_genius}}),Ue=new Vn({props:{status:(Zt=e[0])==null?void 0:Zt.ultrabeam,flexradio:(Kt=e[0])==null?void 0:Kt.flexradio}}),Je=new Jn({props:{status:(Ht=e[0])==null?void 0:Ht.rotator_genius,ultrabeam:(Qt=e[0])==null?void 0:Qt.ultrabeam}}),{c(){l=a("div"),s=a("header"),i=a("div"),o=a("h1"),r=T(e[3]),f=T(" Shack"),d=b(),v=a("div"),c=a("span"),h=b(),w=T(u),g=b(),p=a("div"),k=a("div"),y=a("span"),M=T("SFI "),C=a("span"),F=T(m),O=b(),z=a("span"),P=T("Spots "),_=a("span"),I=T(A),J=b(),H=a("span"),de=T("A "),ie=a("span"),te=T(S),V=b(),N=a("span"),B=T("K "),Q=a("span"),fe=T(q),Pe=b(),le=a("span"),X=T("G "),ae=a("span"),we=T(Z),oe=b(),re=a("div"),ue=a("div"),Me=a("span"),Ie=T("🌬️ "),Ne=T(Se),Ae=T(" km/h"),Fe=b(),$=a("span"),_e=T("💨 "),se=T(ne),K=T(" km/h"),ee=b(),j=a("span"),x=T("🌡️ "),G=T(Y),me=T(" °C"),ve=b(),Ee=a("span"),Ve=T("→ "),We=T(Ze),Xe=T(" °C"),Be=b(),Le=a("div"),$e=a("span"),qe=T(De),Ke=b(),xe=a("span"),pe=T(Ge),Te=b(),bt(et.$$.fragment),ht=b(),rt=a("main"),st=a("div"),Re=a("div"),bt(He.$$.fragment),Mt=b(),bt(Qe.$$.fragment),gt=b(),bt(tt.$$.fragment),it=b(),je=a("div"),bt(lt.$$.fragment),Ye=b(),bt(Ue.$$.fragment),at=b(),bt(Je.$$.fragment),t(o,"class","svelte-a5dfm6"),t(c,"class","status-indicator"),W(c,"status-online",e[1]),W(c,"status-offline",!e[1]),t(v,"class","connection-status svelte-a5dfm6"),t(i,"class","header-left svelte-a5dfm6"),t(C,"class","value svelte-a5dfm6"),t(y,"class","solar-item svelte-a5dfm6"),t(_,"class","value svelte-a5dfm6"),t(z,"class","solar-item svelte-a5dfm6"),t(ie,"class","value svelte-a5dfm6"),t(H,"class","solar-item svelte-a5dfm6"),t(Q,"class","value svelte-a5dfm6"),t(N,"class","solar-item svelte-a5dfm6"),t(ae,"class","value svelte-a5dfm6"),t(le,"class","solar-item svelte-a5dfm6"),t(k,"class","solar-info svelte-a5dfm6"),t(p,"class","header-center svelte-a5dfm6"),t(Me,"title","Wind"),t($,"title","Gust"),t(j,"title","Temperature"),t(Ee,"title","Feels like"),t(ue,"class","weather-info svelte-a5dfm6"),t($e,"class","time svelte-a5dfm6"),t(xe,"class","date svelte-a5dfm6"),t(Le,"class","clock svelte-a5dfm6"),t(re,"class","header-right svelte-a5dfm6"),t(s,"class","svelte-a5dfm6"),t(Re,"class","row svelte-a5dfm6"),t(je,"class","row svelte-a5dfm6"),t(st,"class","dashboard-grid svelte-a5dfm6"),t(rt,"class","svelte-a5dfm6"),t(l,"class","app svelte-a5dfm6")},m(U,he){L(U,l,he),n(l,s),n(s,i),n(i,o),n(o,r),n(o,f),n(i,d),n(i,v),n(v,c),n(v,h),n(v,w),n(s,g),n(s,p),n(p,k),n(k,y),n(y,M),n(y,C),n(C,F),n(k,O),n(k,z),n(z,P),n(z,_),n(_,I),n(k,J),n(k,H),n(H,de),n(H,ie),n(ie,te),n(k,V),n(k,N),n(N,B),n(N,Q),n(Q,fe),n(k,Pe),n(k,le),n(le,X),n(le,ae),n(ae,we),n(s,oe),n(s,re),n(re,ue),n(ue,Me),n(Me,Ie),n(Me,Ne),n(Me,Ae),n(ue,Fe),n(ue,$),n($,_e),n($,se),n($,K),n(ue,ee),n(ue,j),n(j,x),n(j,G),n(j,me),n(ue,ve),n(ue,Ee),n(Ee,Ve),n(Ee,We),n(Ee,Xe),n(re,Be),n(re,Le),n(Le,$e),n($e,qe),n(Le,Ke),n(Le,xe),n(xe,pe),n(l,Te),dt(et,l,null),n(l,ht),n(l,rt),n(rt,st),n(st,Re),dt(He,Re,null),n(Re,Mt),dt(Qe,Re,null),n(Re,gt),dt(tt,Re,null),n(st,it),n(st,je),dt(lt,je,null),n(je,Ye),dt(Ue,je,null),n(je,at),dt(Je,je,null),ze=!0},p(U,[he]){var el,tl,ll,nl,sl,il,al,ol,rl,cl,dl;(!ze||he&8)&&R(r,U[3]),(!ze||he&2)&&W(c,"status-online",U[1]),(!ze||he&2)&&W(c,"status-offline",!U[1]),(!ze||he&2)&&u!==(u=U[1]?"Connected":"Disconnected")&&R(w,u),(!ze||he&128)&&m!==(m=U[7].sfi+"")&&R(F,m),(!ze||he&128)&&A!==(A=U[7].sunspots+"")&&R(I,A),(!ze||he&128)&&S!==(S=U[7].a_index+"")&&R(te,S),(!ze||he&128)&&q!==(q=U[7].k_index+"")&&R(fe,q),(!ze||he&128)&&Z!==(Z=U[7].geomag+"")&&R(we,Z),(!ze||he&64)&&Se!==(Se=U[6].wind_speed.toFixed(1)+"")&&R(Ne,Se),(!ze||he&64)&&ne!==(ne=U[6].wind_gust.toFixed(1)+"")&&R(se,ne),(!ze||he&64)&&Y!==(Y=U[6].temp.toFixed(1)+"")&&R(G,Y),(!ze||he&64)&&Ze!==(Ze=U[6].feels_like.toFixed(1)+"")&&R(We,Ze),(!ze||he&4)&&De!==(De=Jl(U[2])+"")&&R(qe,De),(!ze||he&4)&&Ge!==(Ge=U[2].toLocaleDateString()+"")&&R(pe,Ge);const Ct={};he&1&&(Ct.flexradio=(el=U[0])==null?void 0:el.flexradio),he&1&&(Ct.weather=(tl=U[0])==null?void 0:tl.weather),he&16&&(Ct.latitude=U[4]),he&32&&(Ct.longitude=U[5]),et.$set(Ct);const qt={};he&1&&(qt.status=(ll=U[0])==null?void 0:ll.webswitch),He.$set(qt);const xt={};he&1&&(xt.status=(nl=U[0])==null?void 0:nl.power_genius),Qe.$set(xt);const Et={};he&1&&(Et.status=(sl=U[0])==null?void 0:sl.tuner_genius),he&1&&(Et.flexradio=(il=U[0])==null?void 0:il.flexradio),tt.$set(Et);const $t={};he&1&&($t.status=(al=U[0])==null?void 0:al.antenna_genius),lt.$set($t);const Lt={};he&1&&(Lt.status=(ol=U[0])==null?void 0:ol.ultrabeam),he&1&&(Lt.flexradio=(rl=U[0])==null?void 0:rl.flexradio),Ue.$set(Lt);const Rt={};he&1&&(Rt.status=(cl=U[0])==null?void 0:cl.rotator_genius),he&1&&(Rt.ultrabeam=(dl=U[0])==null?void 0:dl.ultrabeam),Je.$set(Rt)},i(U){ze||(ct(et.$$.fragment,U),ct(He.$$.fragment,U),ct(Qe.$$.fragment,U),ct(tt.$$.fragment,U),ct(lt.$$.fragment,U),ct(Ue.$$.fragment,U),ct(Je.$$.fragment,U),ze=!0)},o(U){mt(et.$$.fragment,U),mt(He.$$.fragment,U),mt(Qe.$$.fragment,U),mt(tt.$$.fragment,U),mt(lt.$$.fragment,U),mt(Ue.$$.fragment,U),mt(Je.$$.fragment,U),ze=!1},d(U){U&&E(l),ft(et),ft(He),ft(Qe),ft(tt),ft(lt),ft(Ue),ft(Je)}}}function Jl(e){return e.toTimeString().slice(0,8)}function Kn(e,l,s){let i,o,r=null,f=!1,d=new Date,v="F4BPO",c=null,h=null;const u=Ql.subscribe(g=>{s(0,r=g)}),w=jt.subscribe(g=>{s(1,f=g)});return Zl(async()=>{pl.connect();try{const p=await Oe.getConfig();p.callsign&&s(3,v=p.callsign),p.location&&(s(4,c=p.location.latitude),s(5,h=p.location.longitude))}catch(p){console.error("Failed to fetch config:",p)}const g=setInterval(()=>{s(2,d=new Date)},1e3);return()=>{clearInterval(g)}}),Kl(()=>{pl.disconnect(),u(),w()}),e.$$.update=()=>{e.$$.dirty&1&&s(7,i=(r==null?void 0:r.solar)||{sfi:0,sunspots:0,a_index:0,k_index:0,geomag:"Unknown"}),e.$$.dirty&1&&s(6,o=(r==null?void 0:r.weather)||{wind_speed:0,wind_gust:0,temp:0,feels_like:0})},[r,f,d,v,c,h,o,i]}class Hn extends pt{constructor(l){super(),vt(this,l,Kn,Zn,ot,{})}}new Hn({target:document.getElementById("app")});
|