(()=>{"use strict";var e={88:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.logError=t.logString=t.getDesktopLoggerBridge=void 0;const r=n(298);function o(e,t){r.ipcRenderer.send("desktop_log_message",e,t)}function i(e){e instanceof Error?o("err",e.message):o("err","unknown error type in logger bridge")}t.getDesktopLoggerBridge=function(){return{logString:(e,t)=>{o(e,t)},logError:e=>{i(e)}}},t.logString=o,t.logError=i},468:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.kWindowsRExe=t.normalizeSeparatorsNative=t.normalizeSeparators=t.checkForNewLanguage=void 0;const n=e=>{if("undefined"!=typeof window){const t=window.localStorage.getItem(e);return{isSet:""!==t&&!!t,value:t}}return{isSet:!1,value:""}};function r(e,t="/"){let n="";return e.startsWith("\\\\")&&(n=`${t}${t}`,e=e.substring(2)),`${n}${e.replace(/[\\/]+/g,t)}`}t.checkForNewLanguage=async()=>new Promise((e=>{const t=(new Date).getTime(),r=setInterval((()=>{if((new Date).getTime()>t+5e3)clearInterval(r),e("en");else{const o=n("LAST_TIME");if(o.isSet){const i=n("LOCALE");i.isSet&&t<=parseInt(""+o.value,10)+3e3&&(clearInterval(r),e(""+i.value))}}}),100)})),t.normalizeSeparators=r,t.normalizeSeparatorsNative=function(e){return r(e,"win32"===process.platform?"\\":"/")},t.kWindowsRExe="Rterm.exe"},298:e=>{e.exports=require("electron")}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}(()=>{const e=n(298),t=n(88),r=n(468);e.contextBridge.exposeInMainWorld("desktopLogger",(0,t.getDesktopLoggerBridge)()),e.ipcRenderer.on("css",((e,t)=>{const n=document.createElement("style");n.setAttribute("language","text/css"),n.innerText=t,document.head.appendChild(n)})),e.ipcRenderer.on("initialize",((t,n)=>{const o=document.getElementById("use-default-32"),s=document.getElementById("use-default-64"),c=document.getElementById("use-custom"),a=document.getElementById("select"),d=document.getElementById("button-ok"),l=n.default32bitPath;let u=!1;l&&(o?.removeAttribute("disabled"),i(""+n.selectedRVersion,l+`/bin/i386/${r.kWindowsRExe}`)&&(o.checked=!0,u=!0));const g=n.default64bitPath;let m=!1;g&&(s?.removeAttribute("disabled"),i(""+n.selectedRVersion,g+`/bin/x64/${r.kWindowsRExe}`)&&(s.checked=!0,m=!0));const p=n.rInstalls,f=n.renderingEngine;document.getElementById("rendering-engine").value=f;const k=document.getElementById("select"),v={};p.sort(((e,t)=>t.localeCompare(e)));const b=document.getElementById("select");b.disabled=!(p.length>0&&c.checked),p.forEach((async t=>{if(t=(0,r.normalizeSeparatorsNative)(await e.ipcRenderer.invoke("path_normalize",t)),v[t])return;v[t]=!0;const o=`${t}/bin/x64/${r.kWindowsRExe}`;if(await e.ipcRenderer.invoke("fs_existsSync",o)){const e=window.document.createElement("option");e.value=o,e.innerText=`[64-bit] ${t}`,k.appendChild(e),i(n.selectedRVersion,o)&&!m&&(document.getElementById("use-custom").checked=!0,b.disabled=!1,b.focus())}const s=`${t}/bin/i386/${r.kWindowsRExe}`;if(await e.ipcRenderer.invoke("fs_existsSync",s)){const e=window.document.createElement("option");e.value=s,e.innerText=`[32-bit] ${t}`,k.appendChild(e),i(n.selectedRVersion,s)&&!u&&(document.getElementById("use-custom").checked=!0,b.disabled=!1,b.focus())}})),c.checked=!l&&!g&&p.length>0,b.disabled=!c.checked,d.disabled=!(c.checked&&a.value||o.checked||s.checked)}));const o={useDefault32bit:async t=>await e.ipcRenderer.invoke("use-default-32bit",t),useDefault64bit:async t=>await e.ipcRenderer.invoke("use-default-64bit",t),use:async t=>await e.ipcRenderer.invoke("use-custom",t),browse:async t=>await e.ipcRenderer.invoke("browse-r-exe",t),cancel:()=>{e.ipcRenderer.send("cancel")}};function i(e,t){return(0,r.normalizeSeparatorsNative)(e)===(0,r.normalizeSeparatorsNative)(t)}e.contextBridge.exposeInMainWorld("callbacks",o)})()})();
//# sourceMappingURL=preload.js.map