var f=Object.create;var u=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var g=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;var C=(e,n,t,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of h(n))!b.call(e,r)&&r!==t&&u(e,r,{get:()=>n[r],enumerable:!(o=E(n,r))||o.enumerable});return e};var w=(e,n,t)=>(t=e!=null?f(g(e)):{},C(n||!e||!e.__esModule?u(t,"default",{value:e,enumerable:!0}):t,e));var c=require("electron/renderer"),d=w(require("../../common/modules/l10n"));function p(e){const n=new d.default().client.dialog.screenShare.source;return e.replace("Entire Screen",n.entire).replace("Screen",n.screen)}function S(e){const n=document.getElementById("capturer-list");if(n===null)throw new Error("Element of ID: 'capturer-list' does not exists!");for(const t of e){const o=document.createElement("li");o.className="capturer-item";const r=document.createElement("button");r.className="capturer-button",r.setAttribute("data-id",t.id),r.setAttribute("title",p(t.name));const a=document.createElement("img");a.className="capturer-thumbnail",a.src=t.thumbnail.toDataURL(),r.appendChild(a);const i=document.createElement("div");if(i.className="capturer-label-container",t.appIcon){const s=document.createElement("img");s.className="capturer-label-icon",s.src=t.appIcon.toDataURL(),i.appendChild(s)}const l=document.createElement("span");l.className="capturer-label",l.innerText=p(t.name),i.appendChild(l),r.appendChild(i),o.appendChild(r),n.appendChild(o)}}const m=process.platform==="win32"||process.platform!=="darwin"&&Number(process.versions.electron.split(".")[0])>=29;window.addEventListener("DOMContentLoaded",()=>{const e=document.getElementById("capturer-sound");c.ipcRenderer.invoke("getDesktopCapturerSources").then(n=>{if(n===null)c.ipcRenderer.send("closeCapturerView",null);else{{const t=new d.default().client.dialog.screenShare,o=document.getElementById("capturer-close");m&&e?(e.disabled=!1,e.title=t.sound.system,c.ipcRenderer.invoke("capturer-get-settings").then(r=>{e.checked=r.audio}),e.addEventListener("click",()=>c.ipcRenderer.send("settings-config-modified",{screenShareStore:{audio:e.checked}}))):e&&(e.title=t.sound.unavailable,e.disabled=!0),o&&(o.title=t.close)}try{S(n),[...document.querySelectorAll(".capturer-button")].map(t=>t.addEventListener("click",()=>{const o=t.getAttribute("data-id"),{id:r,name:a}=n.find(i=>i.id===o)??{};if(r===void 0||a===void 0)throw new Error('Source with id: "'+(r??"[null]")+'" does not exist!');c.ipcRenderer.send("closeCapturerView",{video:{id:r,name:a},...(e?.checked??!1)&&m?{audio:"loopbackWithMute"}:{}})})),document.getElementById("capturer-close")?.addEventListener("click",()=>c.ipcRenderer.send("closeCapturerView",null))}catch{c.ipcRenderer.send("closeCapturerView",null)}}}).catch(()=>c.ipcRenderer.send("closeCapturerView",null))});
