'use strict'; const { contextBridge, ipcRenderer } = require('electron'); const on = channel => fn => { const h = (_e, p) => fn(p); ipcRenderer.on(channel, h); return () => ipcRenderer.removeListener(channel, h); }; contextBridge.exposeInMainWorld('ora', { state: () => ipcRenderer.invoke('state'), createProject: name => ipcRenderer.invoke('project:create', name), startImages: job => ipcRenderer.invoke('image:start', job), cancel: () => ipcRenderer.invoke('job:cancel'), onJobUpdate: on('job:update'), onJobEnd: on('job:end'), pickPhoto: purpose => ipcRenderer.invoke('photo:pick', purpose), savePoster: (id, index, bytes, spec) => ipcRenderer.invoke('poster:save', id, index, bytes, spec), deletePicture: id => ipcRenderer.invoke('picture:delete', id), reveal: p => ipcRenderer.invoke('reveal', p), openFolder: which => ipcRenderer.invoke('open:folder', which), onlineStatus: () => ipcRenderer.invoke('online:status'), connectCloudflare: (account, token) => ipcRenderer.invoke('online:cloudflare', account, token), testCloudflare: () => ipcRenderer.invoke('online:cfTest'), disconnectOnline: which => ipcRenderer.invoke('online:disconnect', which), n8nTest: url => ipcRenderer.invoke('n8n:test', url), n8nSend: posts => ipcRenderer.invoke('n8n:send', posts), n8nSetSheet: link => ipcRenderer.invoke('n8n:sheet', link), n8nSetEmail: address => ipcRenderer.invoke('n8n:email', address), n8nRemind: list => ipcRenderer.invoke('n8n:remind', list), n8nAccount: (id, use) => ipcRenderer.invoke('n8n:account', id, use), n8nLinkedIn: list => ipcRenderer.invoke('n8n:linkedin', list), n8nUnlog: ids => ipcRenderer.invoke('n8n:unlog', ids), n8nCancel: links => ipcRenderer.invoke('n8n:cancel', links), n8nWorkflow: label => ipcRenderer.invoke('n8n:workflow', label), openOnline: which => ipcRenderer.invoke('online:open', which), improvePrompt: (text, kind) => ipcRenderer.invoke('prompt:improve', text, kind), planGet: slot => ipcRenderer.invoke('plan:get', slot), planSet: (plan, slot) => ipcRenderer.invoke('plan:set', plan, slot), planAi: (task, facts) => ipcRenderer.invoke('plan:ai', task, facts), planPdf: (name, html, page) => ipcRenderer.invoke('plan:pdf', name, html, page), planExport: (name, bytes, ext) => ipcRenderer.invoke('plan:export', name, bytes, ext), demoInstall: () => ipcRenderer.invoke('demo:install'), demoRemove: () => ipcRenderer.invoke('demo:remove'), writeCaption: (ctx, platform) => ipcRenderer.invoke('caption:write', ctx, platform), checkUpdate: () => ipcRenderer.invoke('update:check'), installUpdate: () => ipcRenderer.invoke('update:install'), onUpdateProgress: on('update:progress'), });