(()=>{"use strict";var e={439:(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},770:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),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="/"){return 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?"\\":"/")}},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(439),r=n(770);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"),c=document.getElementById("use-default-64"),a=document.getElementById("use-custom"),s=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.exe")&&(o.checked=!0,u=!0));const g=n.default64bitPath;let m=!1;g&&(c?.removeAttribute("disabled"),i(""+n.selectedRVersion,g+"/bin/x64/R.exe")&&(c.checked=!0,m=!0));const p=n.rInstalls,v=n.renderingEngine;document.getElementById("rendering-engine").value=v;const f=document.getElementById("select"),b={};p.sort(((e,t)=>t.localeCompare(e)));const k=document.getElementById("select");k.disabled=!(p.length>0&&a.checked),p.forEach((async t=>{if(t=(0,r.normalizeSeparatorsNative)(await e.ipcRenderer.invoke("path_normalize",t)),b[t])return;b[t]=!0;const o=`${t}/bin/x64/R.exe`;if(await e.ipcRenderer.invoke("fs_existsSync",o)){const e=window.document.createElement("option");e.value=o,e.innerText=`[64-bit] ${t}`,f.appendChild(e),i(n.selectedRVersion,o)&&!m&&(document.getElementById("use-custom").checked=!0,f.value=o,k.disabled=!1,k.focus())}const c=`${t}/bin/i386/R.exe`;if(await e.ipcRenderer.invoke("fs_existsSync",c)){const e=window.document.createElement("option");e.value=c,e.innerText=`[32-bit] ${t}`,f.appendChild(e),i(n.selectedRVersion,c)&&!u&&(document.getElementById("use-custom").checked=!0,k.disabled=!1,f.value=c,k.focus())}})),a.checked=!l&&!g&&p.length>0,k.disabled=!a.checked,d.disabled=!(a.checked&&s.value||o.checked||c.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