import{c as r}from"./_plugin-vue_export-helper-63b51ba4.js";import{N as d}from"./Navbar-4fa05ff0.js";const l=r({components:{Navbar:d},data(){return{platform:"",saved:!1,restarted:!1,config:null,fps:[],resolutions:[],currentTab:"general",resIn:"",fpsIn:"",global_prep_cmd:[],tabs:[{id:"general",name:"General",options:{sunshine_name:"",min_log_level:2,global_prep_cmd:"[]"}},{id:"input",name:"Input",options:{controller:"enabled",gamepad:"auto",ds4_back_as_touchpad_click:"enabled",motion_as_ds4:"enabled",touchpad_as_ds4:"enabled",back_button_timeout:-1,keyboard:"enabled",key_repeat_delay:500,key_repeat_frequency:24.9,always_send_scancodes:"enabled",key_rightalt_to_key_win:"disabled",mouse:"enabled",high_resolution_scrolling:"enabled",native_pen_touch:"enabled",keybindings:"[0x10,0xA0,0x11,0xA2,0x12,0xA4]"}},{id:"av",name:"Audio/Video",options:{audio_sink:"",virtual_sink:"",install_steam_audio_drivers:"enabled",adapter_name:"",output_name:"",resolutions:"[352x240,480x360,858x480,1280x720,1920x1080,2560x1080,2560x1440,3440x1440,1920x1200,3840x2160,3840x1600]",fps:"[10,30,60,90,120]"}},{id:"network",name:"Network",options:{upnp:"disabled",address_family:"ipv4",port:47989,origin_web_ui_allowed:"lan",external_ip:"",lan_encryption_mode:0,wan_encryption_mode:1,ping_timeout:1e4}},{id:"files",name:"Config Files",options:{file_apps:"",credentials_file:"",log_path:"",pkey:"",cert:"",file_state:""}},{id:"advanced",name:"Advanced",options:{channels:1,fec_percentage:20,qp:28,min_threads:2,hevc_mode:0,av1_mode:0,capture:"",encoder:""}},{id:"nv",name:"NVIDIA NVENC Encoder",options:{nvenc_preset:1,nvenc_twopass:"quarter_res",nvenc_spatial_aq:"disabled",nvenc_vbv_increase:0,nvenc_realtime_hags:"enabled",nvenc_latency_over_power:"enabled",nvenc_opengl_vulkan_on_dxgi:"enabled",nvenc_h264_cavlc:"disabled"}},{id:"qsv",name:"Intel QuickSync Encoder",options:{qsv_preset:"medium",qsv_coder:"auto",qsv_slow_hevc:"disabled"}},{id:"amd",name:"AMD AMF Encoder",options:{amd_quality:"balanced",amd_rc:"vbr_latency",amd_usage:"ultralowlatency",amd_preanalysis:"disabled",amd_vbaq:"enabled",amd_coder:"auto"}},{id:"vt",name:"VideoToolbox Encoder",options:{vt_coder:"auto",vt_software:"auto",vt_realtime:"enabled"}},{id:"sw",name:"Software Encoder",options:{sw_preset:"superfast",sw_tune:"zerolatency"}}]}},created(){fetch("/api/config").then(e=>e.json()).then(e=>{this.config=e,this.platform=this.config.platform,document.getElementById("app"),this.platform==="windows"&&(this.tabs=this.tabs.filter(t=>t.id!=="vt")),this.platform==="linux"&&(this.tabs=this.tabs.filter(t=>t.id!=="amd"&&t.id!=="qsv"&&t.id!=="vt")),this.platform==="macos"&&(this.tabs=this.tabs.filter(t=>t.id!=="amd"&&t.id!=="nv"&&t.id!=="qsv")),delete this.config.platform,delete this.config.status,delete this.config.version,this.tabs.forEach(t=>{Object.keys(t.options).forEach(a=>{this.config[a]===void 0&&(this.config[a]=t.options[a])})}),this.fps=JSON.parse(this.config.fps);let s=this.config.resolutions.substring(1,this.config.resolutions.length-1),i=[];s.split(",").forEach(t=>i.push(t.trim())),this.resolutions=i,this.config.global_prep_cmd=this.config.global_prep_cmd||[],this.global_prep_cmd=JSON.parse(this.config.global_prep_cmd)})},methods:{forceUpdate(){this.$forceUpdate()},serialize(){let e=this.config==="windows"?`\r
`:`
`;this.config.resolutions="["+e+"    "+this.resolutions.join(","+e+"    ")+e+"]",this.config.fps=JSON.stringify(this.fps).replace(/"/g,""),this.config.global_prep_cmd=JSON.stringify(this.global_prep_cmd)},save(){this.saved=!1,this.restarted=!1,this.serialize();let e=JSON.parse(JSON.stringify(this.config));return this.tabs.forEach(s=>{Object.keys(s.options).forEach(i=>{let t=!1;if(["resolutions","fps","global_prep_cmd"].includes(i)){let a,n;if(i==="resolutions"){let o=/([\d]+x[\d]+)/g;a=JSON.parse(e[i].replace(o,'"$1"')).toString(),n=JSON.parse(s.options[i].replace(o,'"$1"')).toString()}else a=JSON.parse(e[i]),n=JSON.parse(s.options[i]);a===n&&(t=!0)}String(e[i])===String(s.options[i])&&(t=!0),t&&delete e[i]})}),fetch("/api/config",{method:"POST",body:JSON.stringify(e)}).then(s=>s.status===200?(this.saved=!0,this.saved):!1)},apply(){this.saved=this.restarted=!1,this.save().then(s=>{s===!0&&(this.restarted=!0,setTimeout(()=>{this.saved=this.restarted=!1},5e3),fetch("/api/restart",{method:"POST"}))})},add_global_prep_cmd(){let e={do:"",undo:""};this.platform==="windows"&&(e={...e,elevated:!1}),this.global_prep_cmd.push(e)}},computed:{effectivePort(){var s;const e=+((s=this.config)==null?void 0:s.port);return e||47989}},mounted(){const e=()=>{let s=window.location.hash;if(s){let i=s.substring(1);this.tabs.forEach(t=>{Object.keys(t.options).forEach(a=>{if((t.id===i||a===i)&&(this.currentTab=t.id),a===i&&setTimeout(()=>{document.getElementById(i)&&(window.location.hash=s)},2e3),this.currentTab===t.id)return!0})})}};e(),window.addEventListener("hashchange",e)}});l.mount("#app");
