import{p,g as d,d as n,u as a,F as m,q as b,n as f,f as V,i as g,a as _,k as P}from"./init-Ck7wRxmZ.js";import{N as y}from"./Navbar-CshJBn-L.js";import{_ as C}from"./_plugin-vue_export-helper-DlAUqK2U.js";import{R as w}from"./ResourceCard-CGnskTaT.js";import"./theme-BfDtj5yE.js";const R={class:"card p-2"},k={class:"card-body"},A={class:"card-group p-4 align-items-center"},N=["href","onClick"],O={class:"platform-text"},S={__name:"ClientCard",setup(i){const e=[{platform:"Android",icon:"fa-brands fa-android",name:"Artemis",link:"https://github.com/ClassicOldSong/moonlight-android"},{platform:"iOS",icon:"fa-brands fa-apple",name:"Coming soon...",link:""},{platform:"Desktop",icon:"fa-solid fa-desktop",name:"Coming soon...",link:""}],r=(s,t)=>{t||s.preventDefault()};return(s,t)=>(p(),d("div",R,[n("div",k,[n("h2",null,a(s.$t("client_card.clients")),1),t[1]||(t[1]=n("br",null,null,-1)),n("p",null,a(s.$t("client_card.clients_desc")),1),n("div",A,[(p(),d(m,null,b(e,({platform:c,icon:o,name:u,link:l})=>n("a",{class:f(["btn m-1",[l&&"btn-success"||"btn-secondary"]]),href:l,target:"_blank",onClick:v=>r(v,l)},[o?(p(),d("i",{key:0,class:f(o)},null,2)):V("",!0),t[0]||(t[0]=g()),n("span",O,a(c),1),g(" [ "+a(u)+" ] ",1)],10,N)),64))]),n("i",null,"* "+a(s.$t("client_card.generic_moonlight_clients_desc")),1)])]))}},x=C(S,[["__scopeId","data-v-b4e2589e"]]);class h{constructor(e=null,r=null){if(e)this.release=e,this.version=e.tag_name,this.versionName=e.name,this.versionTag=e.tag_tag;else if(r)this.release=null,this.version=r,this.versionName=null,this.versionTag=null;else throw new Error("Either release or version must be provided");this.versionParts=this.parseVersion(this.version),this.versionMajor=this.versionParts?this.versionParts[0]:null,this.versionMinor=this.versionParts?this.versionParts[1]:null,this.versionPatch=this.versionParts?this.versionParts[2]:null,this.versionIncremental=this.versionParts?this.versionParts[3]:null}parseVersion(e){if(!e)return null;let r=e;r.indexOf("v")===0&&(r=r.substring(1));const[s,t]=r.split("-"),c=s.split(".").map(o=>parseInt(o,10));if(t){const[o,u]=t.split(".");let l=parseInt(u,10);o==="beta"&&(l<<=16),c.push(l)}return c}isGreater(e,r){let s;if(e instanceof h)s=e.versionParts;else if(typeof e=="string")s=this.parseVersion(e);else throw new Error("Invalid argument: otherVersion must be a ApolloVersion object or a version string");if(!this.versionParts||!s)return!1;for(let t=0;t<Math.min(r&&4||3,this.versionParts.length,s.length);t++){if(this.versionParts[t]>s[t])return!0;if(this.versionParts[t]<s[t])return!1}return!1}}console.log("Hello, Apollo!");let G=_({components:{Navbar:y,ClientCard:x,ResourceCard:w},data(){return{version:null,githubVersion:null,notifyPreReleases:!1,preReleaseVersion:null,loading:!0,logs:null}},async created(){try{let i=await fetch("./api/config").then(e=>e.json());this.notifyPreReleases=i.notify_pre_releases,this.version=new h(null,i.version),console.log("Version: ",this.version.version),this.githubVersion=new h(await fetch("https://api.github.com/repos/ClassicOldSong/Apollo/releases/latest").then(e=>e.json()),null),console.log("GitHub Version: ",this.githubVersion.version),this.githubVersion&&(this.preReleaseVersion=new h((await fetch("https://api.github.com/repos/ClassicOldSong/Apollo/releases").then(e=>e.json())).find(e=>e.prerelease),null),console.log("Pre-Release Version: ",this.preReleaseVersion.version))}catch(i){console.error(i)}try{this.logs=await fetch("./api/logs").then(i=>i.text())}catch(i){console.error(i)}this.loading=!1},computed:{installedVersionNotStable(){return!this.githubVersion||!this.version?!1:this.version.isGreater(this.githubVersion)},stableBuildAvailable(){return!this.githubVersion||!this.version?!1:this.githubVersion.isGreater(this.version)},preReleaseBuildAvailable(){return!this.preReleaseVersion||!this.githubVersion||!this.version?!1:this.preReleaseVersion.isGreater(this.version,!0)&&this.preReleaseVersion.isGreater(this.githubVersion,!0)},buildVersionIsDirty(){var i;return((i=this.version.version)==null?void 0:i.split(".").length)===5&&this.version.version.indexOf("dirty")!==-1},fancyLogs(){if(!this.logs)return[];let i=/(\[\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{3}]):\s/g,e=this.logs.split(i).splice(1),r=[];for(let s=0;s<e.length;s+=2)r.push({timestamp:e[s],level:e[s+1].split(":")[0],value:e[s+1]});return r}}});P(G);
