import{R as b,j as e,a as y,r as a}from"./client-D23vQH2t.js";const f=()=>{const[t,g]=a.useState(!0),[n,j]=a.useState(!1),[r,p]=a.useState([]),[d,u]=a.useState([]),[h,v]=a.useState(""),[x,m]=a.useState("");a.useEffect(()=>{if(typeof navigator>"u"||!navigator.mediaDevices||!navigator.mediaDevices.enumerateDevices){console.warn("navigator.mediaDevices is not available in this context");return}const s=()=>{navigator.mediaDevices.enumerateDevices().then(i=>{const c=i.filter(o=>o.kind==="audioinput"),l=i.filter(o=>o.kind==="videoinput");p(c),u(l),c.length>0&&v(c[0].deviceId),l.length>0&&m(l[0].deviceId)}).catch(i=>{console.error("Error enumerating devices:",i)})};navigator.mediaDevices.getUserMedia?navigator.mediaDevices.getUserMedia({audio:!0,video:!0}).then(i=>{i.getTracks().forEach(c=>c.stop()),s()}).catch(i=>{console.warn("Device permission denied or error:",i),s()}):s()},[]);const N=()=>{chrome.storage.local.set({clipive_config:{micEnabled:t,camEnabled:n,selectedMic:h,selectedCam:x}},()=>{chrome.runtime.sendMessage({action:"OPEN_RECORDER"},()=>{window.close()})})};return e.jsxs("div",{className:"popup-container",children:[e.jsxs("header",{className:"popup-header",children:[e.jsxs("div",{className:"logo-section",children:[e.jsx("img",{src:"/logo.png",alt:"Clipive Logo",className:"logo-img logo-light-only",style:{height:"36px"}}),e.jsx("img",{src:"/logo-dark.png",alt:"Clipive Logo",className:"logo-img logo-dark-only",style:{height:"36px"}})]}),e.jsx("span",{className:"version-badge",children:"v0.0.1"})]}),e.jsxs("main",{className:"popup-main",children:[e.jsxs("div",{className:"capture-option active",children:[e.jsx("div",{className:"option-icon",children:e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),e.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),e.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]})}),e.jsxs("div",{className:"option-details",children:[e.jsx("h3",{children:"Screen Recording"}),e.jsx("p",{children:"Record full screen, tab, or window"})]})]}),e.jsxs("div",{className:`setting-row ${t?"active":""}`,children:[e.jsxs("div",{className:"setting-toggle",children:[e.jsxs("div",{className:"setting-label",children:[e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"icon",children:[e.jsx("path",{d:"M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"}),e.jsx("path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}),e.jsx("line",{x1:"12",y1:"19",x2:"12",y2:"23"}),e.jsx("line",{x1:"8",y1:"23",x2:"16",y2:"23"})]}),e.jsx("span",{children:"Microphone"})]}),e.jsxs("label",{className:"switch",children:[e.jsx("input",{type:"checkbox",checked:t,onChange:s=>g(s.target.checked)}),e.jsx("span",{className:"slider round"})]})]}),t&&r.length>0&&e.jsxs("div",{className:"device-select-container",children:[e.jsx("select",{value:h,onChange:s=>v(s.target.value),className:"device-select",children:r.map(s=>e.jsx("option",{value:s.deviceId,children:s.label||`Microphone ${s.deviceId.slice(0,5)}`},s.deviceId))}),e.jsxs("div",{className:"mic-indicator",children:[e.jsx("div",{className:"mic-bar active"}),e.jsx("div",{className:"mic-bar active"}),e.jsx("div",{className:"mic-bar active"}),e.jsx("div",{className:"mic-bar"}),e.jsx("div",{className:"mic-bar"})]})]})]}),e.jsxs("div",{className:`setting-row ${n?"active":""}`,children:[e.jsxs("div",{className:"setting-toggle",children:[e.jsxs("div",{className:"setting-label",children:[e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"icon",children:[e.jsx("path",{d:"M23 7l-7 5 7 5V7z"}),e.jsx("rect",{x:"1",y:"5",width:"15",height:"14",rx:"2",ry:"2"})]}),e.jsx("span",{children:"Webcam overlay"})]}),e.jsxs("label",{className:"switch",children:[e.jsx("input",{type:"checkbox",checked:n,onChange:s=>j(s.target.checked)}),e.jsx("span",{className:"slider round"})]})]}),n&&d.length>0&&e.jsx("div",{className:"device-select-container",children:e.jsx("select",{value:x,onChange:s=>m(s.target.value),className:"device-select",children:d.map(s=>e.jsx("option",{value:s.deviceId,children:s.label||`Camera ${s.deviceId.slice(0,5)}`},s.deviceId))})})]})]}),e.jsx("footer",{className:"popup-footer",children:e.jsxs("button",{className:"start-btn",onClick:N,children:[e.jsx("span",{children:"Open Recorder Workspace"}),e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:e.jsx("polyline",{points:"9 18 15 12 9 6"})})]})})]})},k=b.createRoot(document.getElementById("root"));k.render(e.jsx(y.StrictMode,{children:e.jsx(f,{})}));
