@nice2dev/ui-video 1.0.11 â 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +47 -47
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("react"),re={id:crypto.randomUUID(),name:"Untitled Project",resolution:{width:1920,height:1080,label:"1080p"},frameRate:30,duration:0,tracks:[{id:"1",type:"video",name:"Video 1",items:[],muted:!1,locked:!1,visible:!0},{id:"2",type:"audio",name:"Audio 1",items:[],muted:!1,locked:!1,visible:!0}],assets:[],settings:{backgroundColor:"#000000",audio:{sampleRate:48e3,channels:2,bitrate:320},video:{codec:"h264",bitrate:8e3,profile:"high"}}},le=[{type:"blur",name:"Blur",icon:"đĩ"},{type:"brightness",name:"Brightness",icon:"âī¸"},{type:"contrast",name:"Contrast",icon:"â"},{type:"saturation",name:"Saturation",icon:"đ¨"},{type:"grayscale",name:"Grayscale",icon:"âŦ"},{type:"sepia",name:"Sepia",icon:"đ¤"},{type:"chromaKey",name:"Chroma Key",icon:"đĸ"},{type:"crop",name:"Crop",icon:"âī¸"},{type:"zoom",name:"Zoom",icon:"đ"}],oe=[{type:"fade",name:"Fade"},{type:"dissolve",name:"Dissolve"},{type:"wipe",name:"Wipe"},{type:"slide",name:"Slide"},{type:"zoom",name:"Zoom"},{type:"push",name:"Push"}],ce=({project:I,onProjectChange:w,onExport:R,onAssetUpload:T,className:A=""})=>{const[o,Y]=d.useState(I||re),[t,Z]=d.useState("timeline"),[v,V]=d.useState(null),[m,y]=d.useState(null),[j,E]=d.useState(0),[b,F]=d.useState(!1),[k,M]=d.useState(1),[W,z]=d.useState(!0),[g,$]=d.useState(null),J=d.useRef(null),ee=d.useRef(null),D=d.useRef(null);d.useEffect(()=>{I&&Y(I)},[I]),d.useEffect(()=>()=>{D.current&&clearInterval(D.current)},[]);const x=d.useCallback(n=>{const i={...o,...n};Y(i),w==null||w(i)},[o,w]),S=async n=>{const i=[];for(const u of Array.from(n)){const s=u.type.startsWith("video/")?"video":u.type.startsWith("audio/")?"audio":"image";let a;T?a=await T(u):a={id:crypto.randomUUID(),type:s,name:u.name,url:URL.createObjectURL(u),size:u.size},i.push(a)}x({assets:[...o.assets,...i]})},h=n=>{const i={id:crypto.randomUUID(),type:n,name:`${n.charAt(0).toUpperCase()+n.slice(1)} ${o.tracks.filter(u=>u.type===n).length+1}`,items:[],muted:!1,locked:!1,visible:!0};x({tracks:[...o.tracks,i]})},O=n=>{x({tracks:o.tracks.filter(i=>i.id!==n)}),v===n&&V(null)},q=n=>{x({tracks:o.tracks.map(i=>i.id===n?{...i,muted:!i.muted}:i)})},P=n=>{x({tracks:o.tracks.map(i=>i.id===n?{...i,locked:!i.locked}:i)})},Q=(n,i)=>{const u=o.tracks.find(c=>c.id===n);if(!u||u.locked)return;const s=u.items[u.items.length-1],a=s?s.startTime+s.duration:0,r={id:crypto.randomUUID(),assetId:i.id,type:i.type,startTime:a,duration:i.duration||5,offset:0,properties:{x:0,y:0,opacity:1,scale:1,volume:1},effects:[],transitions:[]};x({tracks:o.tracks.map(c=>c.id===n?{...c,items:[...c.items,r]}:c)})},N=(n,i,u)=>{const s={id:crypto.randomUUID(),type:u,name:u.charAt(0).toUpperCase()+u.slice(1),parameters:U(u)};x({tracks:o.tracks.map(a=>a.id===n?{...a,items:a.items.map(r=>r.id===i?{...r,effects:[...r.effects,s]}:r)}:a)})},B=(n,i,u,s)=>{const a={id:crypto.randomUUID(),type:u,duration:.5,position:s};x({tracks:o.tracks.map(r=>r.id===n?{...r,items:r.items.map(c=>c.id===i?{...c,transitions:[...c.transitions,a]}:c)}:r)})},U=n=>{switch(n){case"blur":return{radius:5};case"brightness":return{value:100};case"contrast":return{value:100};case"saturation":return{value:100};case"grayscale":return{amount:100};case"sepia":return{amount:100};case"chromaKey":return{color:"#00ff00",threshold:40};case"crop":return{top:0,right:0,bottom:0,left:0};case"zoom":return{scale:1,x:0,y:0};default:return{}}},se=()=>{b?(D.current&&clearInterval(D.current),F(!1)):(D.current=setInterval(()=>{E(n=>{const i=Math.max(...o.tracks.flatMap(u=>u.items.map(s=>s.startTime+s.duration)),0);return n>=i?(clearInterval(D.current),F(!1),0):n+1/o.frameRate})},1e3/o.frameRate),F(!0))},H=n=>{E(Math.max(0,n))},X=async()=>{if(R){$(0);try{const n=setInterval(()=>{$(i=>i!==null&&i<90?i+Math.random()*10:i)},500);await R(o,o.settings.video.codec),clearInterval(n),$(100),setTimeout(()=>$(null),2e3)}catch(n){$(null),console.error("Export failed:",n)}}},G=n=>{const i=Math.floor(n/60),u=Math.floor(n%60),s=Math.floor(n%1*o.frameRate);return`${i.toString().padStart(2,"0")}:${u.toString().padStart(2,"0")}:${s.toString().padStart(2,"0")}`},K=()=>{for(const n of o.tracks){const i=n.items.find(u=>u.id===m);if(i)return{track:n,item:i}}return null};return e.jsxs("div",{className:`nice-video-editor ${A}`,children:[e.jsxs("header",{className:"video-editor__header",children:[e.jsxs("div",{className:"header__project-info",children:[e.jsx("input",{type:"text",value:o.name,onChange:n=>x({name:n.target.value}),className:"project-name-input"}),e.jsxs("span",{className:"project-settings",children:[o.resolution.width,"x",o.resolution.height," âĸ ",o.frameRate,"fps"]})]}),e.jsx("div",{className:"header__tabs",children:["timeline","effects","transitions","export"].map(n=>e.jsx("button",{className:`tab-button ${t===n?"tab-button--active":""}`,onClick:()=>Z(n),children:n.charAt(0).toUpperCase()+n.slice(1)},n))}),e.jsx("div",{className:"header__actions",children:e.jsx("button",{className:"action-button action-button--primary",onClick:X,disabled:g!==null,children:g!==null?`Exporting ${Math.round(g)}%`:"Export"})})]}),e.jsxs("div",{className:"video-editor__main",children:[W&&e.jsxs("aside",{className:"video-editor__asset-library",children:[e.jsxs("div",{className:"asset-library__header",children:[e.jsx("h3",{children:"Assets"}),e.jsx("button",{className:"close-button",onClick:()=>z(!1),children:"Ã"})]}),e.jsx("div",{className:"asset-library__upload",children:e.jsxs("label",{className:"upload-zone",children:[e.jsx("input",{type:"file",multiple:!0,accept:"video/*,audio/*,image/*",onChange:n=>n.target.files&&S(n.target.files),hidden:!0}),e.jsx("span",{className:"upload-icon",children:"+"}),e.jsx("span",{children:"Drop files or click to upload"})]})}),e.jsx("div",{className:"asset-library__list",children:o.assets.map(n=>e.jsxs("div",{className:"asset-item",draggable:!0,onDragStart:i=>i.dataTransfer.setData("assetId",n.id),children:[e.jsx("div",{className:"asset-thumbnail",children:n.thumbnail?e.jsx("img",{src:n.thumbnail,alt:n.name}):e.jsx("span",{className:"asset-type-icon",children:n.type==="video"?"đŦ":n.type==="audio"?"đĩ":"đŧī¸"})}),e.jsxs("div",{className:"asset-info",children:[e.jsx("span",{className:"asset-name",children:n.name}),e.jsxs("span",{className:"asset-meta",children:[(n.size/1024/1024).toFixed(1),"MB"]})]})]},n.id))})]}),e.jsxs("div",{className:"video-editor__preview-area",children:[e.jsxs("div",{className:"preview-container",children:[e.jsxs("div",{className:"preview-canvas",style:{aspectRatio:`${o.resolution.width}/${o.resolution.height}`},children:[e.jsx("video",{ref:ee,className:"preview-video"}),e.jsx("div",{className:"preview-overlay",children:!W&&e.jsx("button",{className:"toggle-library-button",onClick:()=>z(!0),children:"đ"})})]}),e.jsxs("div",{className:"playback-controls",children:[e.jsx("button",{onClick:()=>H(0),children:"âŽī¸"}),e.jsx("button",{onClick:()=>H(j-1/o.frameRate),children:"âĒ"}),e.jsx("button",{onClick:se,className:"play-button",children:b?"â¸ī¸":"âļī¸"}),e.jsx("button",{onClick:()=>H(j+1/o.frameRate),children:"âŠ"}),e.jsx("span",{className:"time-display",children:G(j)})]})]}),m&&t!=="export"&&e.jsx("div",{className:"item-inspector",children:(()=>{const n=K();if(!n)return null;const{track:i,item:u}=n;return e.jsxs(e.Fragment,{children:[e.jsx("h4",{children:"Item Properties"}),e.jsxs("div",{className:"inspector-section",children:[e.jsxs("label",{children:["Start Time",e.jsx("input",{type:"number",step:"0.1",value:u.startTime,onChange:s=>{const a=parseFloat(s.target.value);x({tracks:o.tracks.map(r=>r.id===i.id?{...r,items:r.items.map(c=>c.id===u.id?{...c,startTime:a}:c)}:r)})}})]}),e.jsxs("label",{children:["Duration",e.jsx("input",{type:"number",step:"0.1",value:u.duration,onChange:s=>{const a=parseFloat(s.target.value);x({tracks:o.tracks.map(r=>r.id===i.id?{...r,items:r.items.map(c=>c.id===u.id?{...c,duration:a}:c)}:r)})}})]}),e.jsxs("label",{children:["Opacity",e.jsx("input",{type:"range",min:"0",max:"1",step:"0.1",value:u.properties.opacity??1,onChange:s=>{const a=parseFloat(s.target.value);x({tracks:o.tracks.map(r=>r.id===i.id?{...r,items:r.items.map(c=>c.id===u.id?{...c,properties:{...c.properties,opacity:a}}:c)}:r)})}})]})]}),e.jsxs("h4",{children:["Effects (",u.effects.length,")"]}),e.jsx("div",{className:"effects-list",children:u.effects.map(s=>e.jsx("div",{className:"effect-badge",children:s.name},s.id))})]})})()})]})]}),e.jsxs("div",{className:"video-editor__panel",children:[t==="timeline"&&e.jsxs("div",{className:"timeline-panel",children:[e.jsxs("div",{className:"timeline-toolbar",children:[e.jsxs("div",{className:"track-buttons",children:[e.jsx("button",{onClick:()=>h("video"),children:"+ Video Track"}),e.jsx("button",{onClick:()=>h("audio"),children:"+ Audio Track"}),e.jsx("button",{onClick:()=>h("text"),children:"+ Text Track"})]}),e.jsxs("div",{className:"zoom-controls",children:[e.jsx("button",{onClick:()=>M(Math.max(.25,k-.25)),children:"-"}),e.jsxs("span",{children:[Math.round(k*100),"%"]}),e.jsx("button",{onClick:()=>M(Math.min(4,k+.25)),children:"+"})]})]}),e.jsxs("div",{className:"timeline-container",ref:J,children:[e.jsx("div",{className:"timeline-ruler",children:Array.from({length:Math.ceil(30/k)}).map((n,i)=>e.jsx("div",{className:"ruler-mark",style:{left:`${i*50*k}px`},children:G(i)},i))}),e.jsx("div",{className:"timeline-playhead",style:{left:`${j*50*k}px`}}),e.jsx("div",{className:"timeline-tracks",children:o.tracks.map(n=>e.jsxs("div",{className:`timeline-track ${v===n.id?"timeline-track--selected":""} ${n.locked?"timeline-track--locked":""}`,onClick:()=>V(n.id),onDrop:i=>{i.preventDefault();const u=i.dataTransfer.getData("assetId"),s=o.assets.find(a=>a.id===u);s&&Q(n.id,s)},onDragOver:i=>i.preventDefault(),children:[e.jsxs("div",{className:"track-header",children:[e.jsx("span",{className:"track-name",children:n.name}),e.jsxs("div",{className:"track-controls",children:[e.jsx("button",{className:n.muted?"active":"",onClick:i=>{i.stopPropagation(),q(n.id)},children:n.muted?"đ":"đ"}),e.jsx("button",{className:n.locked?"active":"",onClick:i=>{i.stopPropagation(),P(n.id)},children:n.locked?"đ":"đ"}),e.jsx("button",{onClick:i=>{i.stopPropagation(),O(n.id)},children:"đī¸"})]})]}),e.jsx("div",{className:"track-items",children:n.items.map(i=>{const u=o.assets.find(s=>s.id===i.assetId);return e.jsxs("div",{className:`track-item track-item--${i.type} ${m===i.id?"track-item--selected":""}`,style:{left:`${i.startTime*50*k}px`,width:`${i.duration*50*k}px`},onClick:s=>{s.stopPropagation(),y(i.id)},children:[e.jsx("span",{className:"item-name",children:(u==null?void 0:u.name)||"Untitled"}),i.transitions.length>0&&e.jsx("span",{className:"item-transitions",children:"â¨"}),i.effects.length>0&&e.jsx("span",{className:"item-effects",children:"đ¨"})]},i.id)})})]},n.id))})]})]}),t==="effects"&&e.jsxs("div",{className:"effects-panel",children:[e.jsx("h3",{children:"Video Effects"}),e.jsx("p",{className:"panel-hint",children:"Select a clip to apply effects"}),e.jsx("div",{className:"effects-grid",children:le.map(n=>e.jsxs("button",{className:"effect-preset",disabled:!m,onClick:()=>{const i=K();i&&N(i.track.id,i.item.id,n.type)},children:[e.jsx("span",{className:"effect-icon",children:n.icon}),e.jsx("span",{className:"effect-name",children:n.name})]},n.type))})]}),t==="transitions"&&e.jsxs("div",{className:"transitions-panel",children:[e.jsx("h3",{children:"Transitions"}),e.jsx("p",{className:"panel-hint",children:"Select a clip and add transitions between clips"}),e.jsx("div",{className:"transitions-grid",children:oe.map(n=>e.jsxs("div",{className:"transition-preset",children:[e.jsx("span",{className:"transition-name",children:n.name}),e.jsxs("div",{className:"transition-buttons",children:[e.jsx("button",{disabled:!m,onClick:()=>{const i=K();i&&B(i.track.id,i.item.id,n.type,"start")},children:"In"}),e.jsx("button",{disabled:!m,onClick:()=>{const i=K();i&&B(i.track.id,i.item.id,n.type,"end")},children:"Out"})]})]},n.type))})]}),t==="export"&&e.jsxs("div",{className:"export-panel",children:[e.jsx("h3",{children:"Export Settings"}),e.jsxs("div",{className:"export-settings",children:[e.jsxs("div",{className:"setting-group",children:[e.jsx("label",{children:"Resolution"}),e.jsxs("select",{value:`${o.resolution.width}x${o.resolution.height}`,onChange:n=>{const[i,u]=n.target.value.split("x").map(Number);x({resolution:{width:i,height:u}})},children:[e.jsx("option",{value:"1920x1080",children:"1080p (1920x1080)"}),e.jsx("option",{value:"2560x1440",children:"1440p (2560x1440)"}),e.jsx("option",{value:"3840x2160",children:"4K (3840x2160)"}),e.jsx("option",{value:"1280x720",children:"720p (1280x720)"})]})]}),e.jsxs("div",{className:"setting-group",children:[e.jsx("label",{children:"Frame Rate"}),e.jsxs("select",{value:o.frameRate,onChange:n=>x({frameRate:parseInt(n.target.value)}),children:[e.jsx("option",{value:"24",children:"24 fps"}),e.jsx("option",{value:"30",children:"30 fps"}),e.jsx("option",{value:"60",children:"60 fps"}),e.jsx("option",{value:"120",children:"120 fps"})]})]}),e.jsxs("div",{className:"setting-group",children:[e.jsx("label",{children:"Video Codec"}),e.jsxs("select",{value:o.settings.video.codec,onChange:n=>x({settings:{...o.settings,video:{...o.settings.video,codec:n.target.value}}}),children:[e.jsx("option",{value:"h264",children:"H.264 (Best Compatibility)"}),e.jsx("option",{value:"h265",children:"H.265/HEVC (Smaller Size)"}),e.jsx("option",{value:"vp9",children:"VP9 (Web Optimized)"}),e.jsx("option",{value:"av1",children:"AV1 (Future Standard)"})]})]}),e.jsxs("div",{className:"setting-group",children:[e.jsx("label",{children:"Video Bitrate (Mbps)"}),e.jsx("input",{type:"number",value:o.settings.video.bitrate/1e3,onChange:n=>x({settings:{...o.settings,video:{...o.settings.video,bitrate:parseFloat(n.target.value)*1e3}}}),min:"1",max:"100"})]})]}),e.jsx("button",{className:"export-button",onClick:X,disabled:g!==null,children:g!==null?`Exporting... ${Math.round(g)}%`:"Export Video"}),g!==null&&e.jsx("div",{className:"export-progress",children:e.jsx("div",{className:"export-progress-bar",style:{width:`${g}%`}})})]})]})]})},de={video:{source:"screen",showCursor:!0,frameRate:30,resolution:{width:1920,height:1080}},audio:{enabled:!0,source:"both",echoCancellation:!0,noiseSuppression:!0},output:{format:"webm",quality:"high"}},ue=({options:I,onRecordingStart:w,onRecordingStop:R,onRecordingPause:T,onRecordingResume:A,onError:o,className:Y=""})=>{var c,C;const[t,Z]=d.useState({...de,...I}),[v,V]=d.useState(null),[m,y]=d.useState("idle"),[j,E]=d.useState([]),[b,F]=d.useState(null),[k,M]=d.useState(null),[W,z]=d.useState(!1),[g,$]=d.useState(!1),[J,ee]=d.useState("pen"),[D,x]=d.useState("#ff0000"),S=d.useRef(null),h=d.useRef([]),O=d.useRef(null),q=d.useRef(null),P=d.useRef(null),Q=d.useRef(0);d.useEffect(()=>()=>{b&&b.getTracks().forEach(l=>l.stop()),P.current&&clearInterval(P.current)},[b]);const N=l=>{Z(p=>({...p,...l,video:{...p.video,...l.video},audio:{...p.audio,...l.audio},output:{...p.output,...l.output}}))},B=async()=>{try{y("preparing");const l={video:{cursor:t.video.showCursor?"always":"never",frameRate:t.video.frameRate},audio:t.audio.source==="system"||t.audio.source==="both"},p=await navigator.mediaDevices.getDisplayMedia(l);if(t.audio.enabled&&(t.audio.source==="microphone"||t.audio.source==="both"))try{(await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:t.audio.echoCancellation,noiseSuppression:t.audio.noiseSuppression}})).getAudioTracks().forEach(_=>p.addTrack(_))}catch(f){console.warn("Could not access microphone:",f)}F(p),O.current&&(O.current.srcObject=p,O.current.play()),y("idle")}catch(l){y("error"),o==null||o(l instanceof Error?l:new Error("Failed to start preview"))}},U=async()=>{b||await B();for(let l=3;l>0;l--)M(l),await new Promise(p=>setTimeout(p,1e3));M(null);try{const l=b||await se();if(!l)throw new Error("No stream available");const p=i(t.output.format),f=new MediaRecorder(l,{mimeType:p,videoBitsPerSecond:u(t.output.quality)});h.current=[],f.ondataavailable=L=>{L.data.size>0&&h.current.push(L.data)},f.onstop=()=>{const L=new Blob(h.current,{type:p});v&&(R==null||R({...v,status:"stopped"},L))},S.current=f,f.start(1e3),Q.current=Date.now();const _={id:crypto.randomUUID(),status:"recording",startTime:new Date,duration:0,size:0,options:t,chunks:[]};V(_),y("recording"),w==null||w(_),P.current=setInterval(()=>{V(L=>L?{...L,duration:(Date.now()-Q.current)/1e3,size:h.current.reduce((ne,ie)=>ne+ie.size,0)}:null)},100)}catch(l){y("error"),o==null||o(l instanceof Error?l:new Error("Failed to start recording"))}},se=async()=>(await B(),b),H=()=>{S.current&&m==="recording"&&(S.current.pause(),y("paused"),T==null||T())},X=()=>{S.current&&m==="paused"&&(S.current.resume(),y("recording"),A==null||A())},G=()=>{P.current&&clearInterval(P.current),S.current&&(m==="recording"||m==="paused")&&(S.current.stop(),y("stopped")),b&&(b.getTracks().forEach(l=>l.stop()),F(null))},K=d.useCallback(l=>{if(m!=="recording")return;const p={id:crypto.randomUUID(),time:(v==null?void 0:v.duration)||0,label:l||`Marker ${j.length+1}`,color:s()};E(f=>[...f,p])},[m,v==null?void 0:v.duration,j.length]),n=l=>{E(p=>p.filter(f=>f.id!==l))},i=l=>{switch(l){case"mp4":return"video/mp4";case"mkv":return"video/x-matroska";default:return"video/webm;codecs=vp9"}},u=l=>{switch(l){case"low":return 25e5;case"medium":return 5e6;case"lossless":return 2e7;default:return 8e6}},s=()=>{const l=["#ff4444","#44ff44","#4444ff","#ffff44","#ff44ff","#44ffff"];return l[Math.floor(Math.random()*l.length)]},a=l=>{const p=Math.floor(l/3600),f=Math.floor(l%3600/60),_=Math.floor(l%60),L=Math.floor(l%1*100);return p>0?`${p}:${f.toString().padStart(2,"0")}:${_.toString().padStart(2,"0")}`:`${f.toString().padStart(2,"0")}:${_.toString().padStart(2,"0")}.${L.toString().padStart(2,"0")}`},r=l=>l<1024?`${l} B`:l<1024*1024?`${(l/1024).toFixed(1)} KB`:`${(l/1024/1024).toFixed(1)} MB`;return e.jsxs("div",{className:`nice-screen-recorder ${Y}`,children:[e.jsxs("div",{className:"recorder__preview",children:[k!==null&&e.jsx("div",{className:"countdown-overlay",children:e.jsx("span",{className:"countdown-number",children:k})}),e.jsx("video",{ref:O,className:"preview-video",muted:!0,playsInline:!0}),g&&e.jsx("canvas",{ref:q,className:"annotation-canvas"}),!b&&m==="idle"&&e.jsx("div",{className:"preview-placeholder",children:e.jsxs("button",{className:"start-preview-button",onClick:B,children:[e.jsx("span",{className:"icon",children:"đĨī¸"}),e.jsx("span",{children:"Select Screen to Record"})]})}),m==="recording"&&e.jsxs("div",{className:"recording-indicator",children:[e.jsx("span",{className:"recording-dot"}),e.jsx("span",{children:"REC"})]})]}),e.jsxs("div",{className:"recorder__controls",children:[e.jsxs("div",{className:"controls__main",children:[m==="idle"&&e.jsxs("button",{className:"control-button control-button--record",onClick:U,disabled:!!k,children:[e.jsx("span",{className:"icon",children:"âēī¸"}),e.jsx("span",{children:"Start Recording"})]}),m==="recording"&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"control-button control-button--pause",onClick:H,children:[e.jsx("span",{className:"icon",children:"â¸ī¸"}),e.jsx("span",{children:"Pause"})]}),e.jsxs("button",{className:"control-button control-button--stop",onClick:G,children:[e.jsx("span",{className:"icon",children:"âšī¸"}),e.jsx("span",{children:"Stop"})]})]}),m==="paused"&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"control-button control-button--resume",onClick:X,children:[e.jsx("span",{className:"icon",children:"âļī¸"}),e.jsx("span",{children:"Resume"})]}),e.jsxs("button",{className:"control-button control-button--stop",onClick:G,children:[e.jsx("span",{className:"icon",children:"âšī¸"}),e.jsx("span",{children:"Stop"})]})]}),m==="stopped"&&e.jsxs("button",{className:"control-button control-button--new",onClick:()=>{y("idle"),V(null),E([])},children:[e.jsx("span",{className:"icon",children:"đ"}),e.jsx("span",{children:"New Recording"})]})]}),e.jsxs("div",{className:"controls__secondary",children:[(m==="recording"||m==="paused")&&e.jsxs("button",{className:"control-button control-button--marker",onClick:()=>K(),children:[e.jsx("span",{className:"icon",children:"đŠ"}),e.jsx("span",{children:"Add Marker"})]}),e.jsxs("button",{className:`control-button ${g?"control-button--active":""}`,onClick:()=>$(!g),disabled:m!=="recording",children:[e.jsx("span",{className:"icon",children:"âī¸"}),e.jsx("span",{children:"Annotate"})]}),e.jsx("button",{className:"control-button control-button--settings",onClick:()=>z(!W),disabled:m==="recording",children:e.jsx("span",{className:"icon",children:"âī¸"})})]})]}),e.jsxs("div",{className:"recorder__status",children:[e.jsxs("div",{className:"status__info",children:[e.jsxs("span",{className:"status-item",children:[e.jsx("strong",{children:"Duration:"})," ",a((v==null?void 0:v.duration)||0)]}),e.jsxs("span",{className:"status-item",children:[e.jsx("strong",{children:"Size:"})," ",r((v==null?void 0:v.size)||0)]}),e.jsxs("span",{className:"status-item",children:[e.jsx("strong",{children:"Markers:"})," ",j.length]})]}),e.jsxs("div",{className:"status__quality",children:[t.video.resolution&&e.jsxs("span",{children:[t.video.resolution.width,"x",t.video.resolution.height]}),e.jsxs("span",{children:[t.video.frameRate,"fps"]}),e.jsx("span",{className:t.audio.enabled?"audio-on":"audio-off",children:t.audio.enabled?"đ":"đ"})]})]}),g&&m==="recording"&&e.jsxs("div",{className:"recorder__annotation-tools",children:[e.jsx("div",{className:"tool-group",children:["pen","arrow","rectangle","text"].map(l=>e.jsxs("button",{className:`tool-button ${J===l?"tool-button--active":""}`,onClick:()=>ee(l),children:[l==="pen"&&"âī¸",l==="arrow"&&"âĄī¸",l==="rectangle"&&"âŦ",l==="text"&&"T"]},l))}),e.jsx("div",{className:"color-group",children:["#ff0000","#00ff00","#0000ff","#ffff00","#ffffff","#000000"].map(l=>e.jsx("button",{className:`color-button ${D===l?"color-button--active":""}`,style:{backgroundColor:l},onClick:()=>x(l)},l))})]}),j.length>0&&e.jsxs("div",{className:"recorder__markers",children:[e.jsx("h4",{children:"Markers"}),e.jsx("div",{className:"markers-list",children:j.map(l=>e.jsxs("div",{className:"marker-item",style:{borderLeftColor:l.color},children:[e.jsx("span",{className:"marker-time",children:a(l.time)}),e.jsx("input",{type:"text",value:l.label,onChange:p=>{E(f=>f.map(_=>_.id===l.id?{..._,label:p.target.value}:_))},className:"marker-label"}),e.jsx("button",{className:"marker-remove",onClick:()=>n(l.id),children:"Ã"})]},l.id))})]}),W&&e.jsxs("div",{className:"recorder__settings",children:[e.jsxs("div",{className:"settings-header",children:[e.jsx("h3",{children:"Recording Settings"}),e.jsx("button",{className:"close-button",onClick:()=>z(!1),children:"Ã"})]}),e.jsxs("div",{className:"settings-section",children:[e.jsx("h4",{children:"Video"}),e.jsxs("label",{children:["Source",e.jsxs("select",{value:t.video.source,onChange:l=>N({video:{...t.video,source:l.target.value}}),children:[e.jsx("option",{value:"screen",children:"Entire Screen"}),e.jsx("option",{value:"window",children:"Application Window"}),e.jsx("option",{value:"tab",children:"Browser Tab"}),e.jsx("option",{value:"camera",children:"Camera"})]})]}),e.jsxs("label",{children:["Resolution",e.jsxs("select",{value:`${(c=t.video.resolution)==null?void 0:c.width}x${(C=t.video.resolution)==null?void 0:C.height}`,onChange:l=>{const[p,f]=l.target.value.split("x").map(Number);N({video:{...t.video,resolution:{width:p,height:f}}})},children:[e.jsx("option",{value:"1920x1080",children:"1080p (1920x1080)"}),e.jsx("option",{value:"2560x1440",children:"1440p (2560x1440)"}),e.jsx("option",{value:"3840x2160",children:"4K (3840x2160)"}),e.jsx("option",{value:"1280x720",children:"720p (1280x720)"})]})]}),e.jsxs("label",{children:["Frame Rate",e.jsxs("select",{value:t.video.frameRate,onChange:l=>N({video:{...t.video,frameRate:parseInt(l.target.value)}}),children:[e.jsx("option",{value:"15",children:"15 fps"}),e.jsx("option",{value:"24",children:"24 fps"}),e.jsx("option",{value:"30",children:"30 fps"}),e.jsx("option",{value:"60",children:"60 fps"})]})]}),e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:t.video.showCursor,onChange:l=>N({video:{...t.video,showCursor:l.target.checked}})}),"Show Cursor"]})]}),e.jsxs("div",{className:"settings-section",children:[e.jsx("h4",{children:"Audio"}),e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:t.audio.enabled,onChange:l=>N({audio:{...t.audio,enabled:l.target.checked}})}),"Enable Audio"]}),t.audio.enabled&&e.jsxs(e.Fragment,{children:[e.jsxs("label",{children:["Source",e.jsxs("select",{value:t.audio.source,onChange:l=>N({audio:{...t.audio,source:l.target.value}}),children:[e.jsx("option",{value:"system",children:"System Audio"}),e.jsx("option",{value:"microphone",children:"Microphone"}),e.jsx("option",{value:"both",children:"Both"})]})]}),e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:t.audio.echoCancellation,onChange:l=>N({audio:{...t.audio,echoCancellation:l.target.checked}})}),"Echo Cancellation"]}),e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:t.audio.noiseSuppression,onChange:l=>N({audio:{...t.audio,noiseSuppression:l.target.checked}})}),"Noise Suppression"]})]})]}),e.jsxs("div",{className:"settings-section",children:[e.jsx("h4",{children:"Output"}),e.jsxs("label",{children:["Format",e.jsxs("select",{value:t.output.format,onChange:l=>N({output:{...t.output,format:l.target.value}}),children:[e.jsx("option",{value:"webm",children:"WebM (Best Web)"}),e.jsx("option",{value:"mp4",children:"MP4 (Most Compatible)"}),e.jsx("option",{value:"mkv",children:"MKV (Lossless)"})]})]}),e.jsxs("label",{children:["Quality",e.jsxs("select",{value:t.output.quality,onChange:l=>N({output:{...t.output,quality:l.target.value}}),children:[e.jsx("option",{value:"low",children:"Low (Smaller file)"}),e.jsx("option",{value:"medium",children:"Medium"}),e.jsx("option",{value:"high",children:"High (Recommended)"}),e.jsx("option",{value:"lossless",children:"Lossless (Largest file)"})]})]})]})]})]})},me={id:crypto.randomUUID(),name:"My Stream",protocol:"rtmp",destinations:[],sources:[],layout:{name:"Default",canvas:{width:1920,height:1080,backgroundColor:"#000000"},layers:[]},settings:{video:{resolution:{width:1920,height:1080},frameRate:30,codec:"h264",bitrate:6e3,keyframe:2,profile:"high"},audio:{sampleRate:48e3,bitrate:160,channels:2,codec:"aac"}}},ae=[{platform:"youtube",name:"YouTube",icon:"đē",defaultUrl:"rtmp://a.rtmp.youtube.com/live2"},{platform:"twitch",name:"Twitch",icon:"đŽ",defaultUrl:"rtmp://live.twitch.tv/app"},{platform:"facebook",name:"Facebook",icon:"đ",defaultUrl:"rtmps://live-api-s.facebook.com:443/rtmp"},{platform:"custom-rtmp",name:"Custom RTMP",icon:"đ",defaultUrl:""},{platform:"custom-srt",name:"Custom SRT",icon:"đ",defaultUrl:""}],te=[{type:"camera",name:"Camera",icon:"đˇ"},{type:"screen",name:"Screen Capture",icon:"đĨī¸"},{type:"window",name:"Window Capture",icon:"đĒ"},{type:"browser",name:"Browser Source",icon:"đ"},{type:"image",name:"Image",icon:"đŧī¸"},{type:"video",name:"Video",icon:"đŦ"},{type:"microphone",name:"Microphone",icon:"đ¤"},{type:"system-audio",name:"System Audio",icon:"đ"}],he=({config:I,onConfigChange:w,onStreamStart:R,onStreamStop:T,onStatsUpdate:A,onError:o,className:Y=""})=>{const[t,Z]=d.useState(I||me),[v,V]=d.useState("sources"),[m,y]=d.useState(!1),[j,E]=d.useState({duration:0,viewers:0,peakViewers:0,bitrate:0,fps:0,droppedFrames:0,cpuUsage:0,memoryUsage:0}),[b,F]=d.useState(null),[k,M]=d.useState(!1),[W,z]=d.useState(!1),[g,$]=d.useState([t.layout]),[J,ee]=d.useState(0),D=d.useRef(null),x=d.useRef(null),S=d.useRef(0);d.useEffect(()=>{I&&Z(I)},[I]),d.useEffect(()=>()=>{x.current&&clearInterval(x.current)},[]);const h=d.useCallback(s=>{const a={...t,...s};Z(a),w==null||w(a)},[t,w]),O=s=>{const a=ae.find(c=>c.platform===s),r={id:crypto.randomUUID(),name:(a==null?void 0:a.name)||"Custom",platform:s,url:(a==null?void 0:a.defaultUrl)||"",streamKey:"",enabled:!0,status:"idle"};h({destinations:[...t.destinations,r]}),z(!1)},q=(s,a)=>{h({destinations:t.destinations.map(r=>r.id===s?{...r,...a}:r)})},P=s=>{h({destinations:t.destinations.filter(a=>a.id!==s)})},Q=async s=>{const a=te.find(C=>C.type===s),r={id:crypto.randomUUID(),type:s,name:`${(a==null?void 0:a.name)||s} ${t.sources.filter(C=>C.type===s).length+1}`,settings:{},volume:1,muted:!1};try{if(s==="camera"||s==="microphone"){const C=s==="camera"?{video:!0}:{audio:!0},p=(await navigator.mediaDevices.enumerateDevices()).filter(f=>s==="camera"?f.kind==="videoinput":f.kind==="audioinput");p.length>0&&(r.settings.deviceId=p[0].deviceId)}else(s==="screen"||s==="window")&&await navigator.mediaDevices.getDisplayMedia({video:!0})}catch(C){console.warn(`Could not access ${s}:`,C)}h({sources:[...t.sources,r]});const c={id:crypto.randomUUID(),sourceId:r.id,position:{x:0,y:0},size:{width:t.layout.canvas.width,height:t.layout.canvas.height},visible:!0,opacity:1,zIndex:t.layout.layers.length};h({layout:{...t.layout,layers:[...t.layout.layers,c]}}),M(!1)},N=(s,a)=>{h({sources:t.sources.map(r=>r.id===s?{...r,...a}:r)})},B=s=>{h({sources:t.sources.filter(a=>a.id!==s),layout:{...t.layout,layers:t.layout.layers.filter(a=>a.sourceId!==s)}})},U=(s,a)=>{h({layout:{...t.layout,layers:t.layout.layers.map(r=>r.id===s?{...r,...a}:r)}})},se=s=>{const a=t.layout.layers.findIndex(r=>r.id===s);if(a<t.layout.layers.length-1){const r=[...t.layout.layers];[r[a],r[a+1]]=[r[a+1],r[a]],r.forEach((c,C)=>{c.zIndex=C}),h({layout:{...t.layout,layers:r}})}},H=s=>{const a=t.layout.layers.findIndex(r=>r.id===s);if(a>0){const r=[...t.layout.layers];[r[a],r[a-1]]=[r[a-1],r[a]],r.forEach((c,C)=>{c.zIndex=C}),h({layout:{...t.layout,layers:r}})}},X=()=>{const s={name:`Scene ${g.length+1}`,canvas:{...t.layout.canvas},layers:[]};$([...g,s])},G=s=>{const a=[...g];a[J]=t.layout,$(a),ee(s),h({layout:g[s]})},K=async()=>{try{h({destinations:t.destinations.map(s=>s.enabled?{...s,status:"connecting"}:s)}),await new Promise(s=>setTimeout(s,2e3)),h({destinations:t.destinations.map(s=>s.enabled?{...s,status:"live"}:s)}),y(!0),S.current=Date.now(),R==null||R(),x.current=setInterval(()=>{const s={duration:(Date.now()-S.current)/1e3,viewers:Math.floor(Math.random()*100)+j.viewers,peakViewers:Math.max(j.peakViewers,j.viewers),bitrate:t.settings.video.bitrate+Math.floor(Math.random()*500-250),fps:t.settings.video.frameRate-Math.random()*2,droppedFrames:j.droppedFrames+(Math.random()>.95?1:0),cpuUsage:15+Math.random()*30,memoryUsage:40+Math.random()*20};E(s),A==null||A(s)},1e3)}catch(s){o==null||o(s instanceof Error?s:new Error("Failed to start stream")),h({destinations:t.destinations.map(a=>({...a,status:"error"}))})}},n=()=>{x.current&&clearInterval(x.current),h({destinations:t.destinations.map(s=>({...s,status:"idle"}))}),y(!1),T==null||T()},i=s=>{const a=Math.floor(s/3600),r=Math.floor(s%3600/60),c=Math.floor(s%60);return`${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}:${c.toString().padStart(2,"0")}`},u=s=>{switch(s){case"live":return"#00ff00";case"connecting":return"#ffff00";case"error":return"#ff0000";default:return"#888888"}};return e.jsxs("div",{className:`nice-live-streaming ${Y}`,children:[e.jsxs("header",{className:"streaming__header",children:[e.jsxs("div",{className:"header__title",children:[e.jsx("input",{type:"text",value:t.name,onChange:s=>h({name:s.target.value}),className:"stream-name-input"}),m&&e.jsxs("span",{className:"live-badge",children:[e.jsx("span",{className:"live-dot"})," LIVE"]})]}),e.jsx("div",{className:"header__stats",children:m&&e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"stat-item",children:["âąī¸ ",i(j.duration)]}),e.jsxs("span",{className:"stat-item",children:["đĨ ",j.viewers]}),e.jsxs("span",{className:"stat-item",children:["đ ",Math.round(j.bitrate)," kbps"]}),e.jsxs("span",{className:"stat-item",children:["đŦ ",j.fps.toFixed(1)," fps"]})]})}),e.jsx("div",{className:"header__actions",children:m?e.jsx("button",{className:"action-button action-button--stop",onClick:n,children:"End Stream"}):e.jsx("button",{className:"action-button action-button--go-live",onClick:K,disabled:t.destinations.filter(s=>s.enabled).length===0,children:"Go Live"})})]}),e.jsxs("div",{className:"streaming__main",children:[e.jsxs("div",{className:"streaming__preview",children:[e.jsxs("div",{className:"scenes-bar",children:[g.map((s,a)=>e.jsx("button",{className:`scene-button ${J===a?"scene-button--active":""}`,onClick:()=>G(a),children:s.name},a)),e.jsx("button",{className:"scene-button scene-button--add",onClick:X,children:"+"})]}),e.jsx("div",{ref:D,className:"preview-canvas",style:{aspectRatio:`${t.layout.canvas.width}/${t.layout.canvas.height}`,backgroundColor:t.layout.canvas.backgroundColor},children:t.layout.layers.sort((s,a)=>s.zIndex-a.zIndex).map(s=>{var r;const a=t.sources.find(c=>c.id===s.sourceId);return!s.visible||!a?null:e.jsx("div",{className:`canvas-layer ${b===s.id?"canvas-layer--selected":""}`,style:{left:`${s.position.x/t.layout.canvas.width*100}%`,top:`${s.position.y/t.layout.canvas.height*100}%`,width:`${s.size.width/t.layout.canvas.width*100}%`,height:`${s.size.height/t.layout.canvas.height*100}%`,opacity:s.opacity,zIndex:s.zIndex},onClick:()=>F(s.id),children:e.jsxs("div",{className:"layer-content",children:[e.jsx("span",{className:"layer-icon",children:((r=te.find(c=>c.type===a.type))==null?void 0:r.icon)||"đĻ"}),e.jsx("span",{className:"layer-name",children:a.name})]})},s.id)})})]}),e.jsxs("aside",{className:"streaming__panel",children:[e.jsx("div",{className:"panel-tabs",children:["sources","audio","destinations","settings"].map(s=>e.jsx("button",{className:`panel-tab ${v===s?"panel-tab--active":""}`,onClick:()=>V(s),children:s.charAt(0).toUpperCase()+s.slice(1)},s))}),e.jsxs("div",{className:"panel-content",children:[v==="sources"&&e.jsxs("div",{className:"sources-panel",children:[e.jsxs("div",{className:"panel-header",children:[e.jsx("h3",{children:"Sources"}),e.jsx("button",{className:"add-button",onClick:()=>M(!0),disabled:m,children:"+ Add"})]}),e.jsx("div",{className:"sources-list",children:t.sources.filter(s=>s.type!=="microphone"&&s.type!=="system-audio").map(s=>{var r;const a=t.layout.layers.find(c=>c.sourceId===s.id);return e.jsxs("div",{className:`source-item ${b===(a==null?void 0:a.id)?"source-item--selected":""}`,onClick:()=>a&&F(a.id),children:[e.jsx("span",{className:"source-icon",children:(r=te.find(c=>c.type===s.type))==null?void 0:r.icon}),e.jsx("span",{className:"source-name",children:s.name}),e.jsxs("div",{className:"source-controls",children:[e.jsx("button",{className:a!=null&&a.visible?"":"inactive",onClick:c=>{c.stopPropagation(),a&&U(a.id,{visible:!a.visible})},children:a!=null&&a.visible?"đī¸":"đī¸âđ¨ī¸"}),e.jsx("button",{onClick:c=>{c.stopPropagation(),a&&se(a.id)},children:"âŦī¸"}),e.jsx("button",{onClick:c=>{c.stopPropagation(),a&&H(a.id)},children:"âŦī¸"}),e.jsx("button",{onClick:c=>{c.stopPropagation(),B(s.id)},disabled:m,children:"đī¸"})]})]},s.id)})}),b&&e.jsxs("div",{className:"layer-properties",children:[e.jsx("h4",{children:"Properties"}),(()=>{const s=t.layout.layers.find(a=>a.id===b);return s?e.jsxs(e.Fragment,{children:[e.jsxs("label",{children:["X Position",e.jsx("input",{type:"number",value:s.position.x,onChange:a=>U(s.id,{position:{...s.position,x:parseInt(a.target.value)||0}})})]}),e.jsxs("label",{children:["Y Position",e.jsx("input",{type:"number",value:s.position.y,onChange:a=>U(s.id,{position:{...s.position,y:parseInt(a.target.value)||0}})})]}),e.jsxs("label",{children:["Width",e.jsx("input",{type:"number",value:s.size.width,onChange:a=>U(s.id,{size:{...s.size,width:parseInt(a.target.value)||100}})})]}),e.jsxs("label",{children:["Height",e.jsx("input",{type:"number",value:s.size.height,onChange:a=>U(s.id,{size:{...s.size,height:parseInt(a.target.value)||100}})})]}),e.jsxs("label",{children:["Opacity",e.jsx("input",{type:"range",min:"0",max:"1",step:"0.1",value:s.opacity,onChange:a=>U(s.id,{opacity:parseFloat(a.target.value)})})]})]}):null})()]})]}),v==="audio"&&e.jsxs("div",{className:"audio-panel",children:[e.jsxs("div",{className:"panel-header",children:[e.jsx("h3",{children:"Audio Mixer"}),e.jsx("button",{className:"add-button",onClick:()=>{M(!0)},disabled:m,children:"+ Add"})]}),e.jsxs("div",{className:"audio-sources",children:[t.sources.filter(s=>s.type==="microphone"||s.type==="system-audio"||s.type==="video").map(s=>{var a;return e.jsxs("div",{className:"audio-source",children:[e.jsxs("div",{className:"audio-header",children:[e.jsx("span",{className:"audio-icon",children:(a=te.find(r=>r.type===s.type))==null?void 0:a.icon}),e.jsx("span",{className:"audio-name",children:s.name}),e.jsx("button",{className:s.muted?"muted":"",onClick:()=>N(s.id,{muted:!s.muted}),children:s.muted?"đ":"đ"})]}),e.jsxs("div",{className:"audio-slider",children:[e.jsx("input",{type:"range",min:"0",max:"1",step:"0.01",value:s.volume??1,onChange:r=>N(s.id,{volume:parseFloat(r.target.value)}),disabled:s.muted}),e.jsxs("span",{className:"volume-value",children:[Math.round((s.volume??1)*100),"%"]})]}),e.jsx("div",{className:"audio-meter",children:e.jsx("div",{className:"meter-fill",style:{width:`${(s.volume??1)*70+Math.random()*30}%`}})})]},s.id)}),t.sources.filter(s=>s.type==="microphone"||s.type==="system-audio").length===0&&e.jsx("p",{className:"empty-message",children:"No audio sources added"})]})]}),v==="destinations"&&e.jsxs("div",{className:"destinations-panel",children:[e.jsxs("div",{className:"panel-header",children:[e.jsx("h3",{children:"Destinations"}),e.jsx("button",{className:"add-button",onClick:()=>z(!0),disabled:m,children:"+ Add"})]}),e.jsxs("div",{className:"destinations-list",children:[t.destinations.map(s=>{var a;return e.jsxs("div",{className:"destination-item",children:[e.jsxs("div",{className:"destination-header",children:[e.jsx("span",{className:"status-indicator",style:{backgroundColor:u(s.status)}}),e.jsx("span",{className:"destination-icon",children:(a=ae.find(r=>r.platform===s.platform))==null?void 0:a.icon}),e.jsx("span",{className:"destination-name",children:s.name}),e.jsxs("label",{className:"toggle",children:[e.jsx("input",{type:"checkbox",checked:s.enabled,onChange:r=>q(s.id,{enabled:r.target.checked}),disabled:m}),e.jsx("span",{className:"toggle-slider"})]})]}),e.jsxs("div",{className:"destination-config",children:[e.jsxs("label",{children:["Server URL",e.jsx("input",{type:"text",value:s.url,onChange:r=>q(s.id,{url:r.target.value}),placeholder:"rtmp://...",disabled:m})]}),e.jsxs("label",{children:["Stream Key",e.jsx("input",{type:"password",value:s.streamKey||"",onChange:r=>q(s.id,{streamKey:r.target.value}),placeholder:"Enter stream key",disabled:m})]})]}),e.jsx("button",{className:"remove-button",onClick:()=>P(s.id),disabled:m,children:"Remove"})]},s.id)}),t.destinations.length===0&&e.jsx("p",{className:"empty-message",children:"No destinations configured"})]})]}),v==="settings"&&e.jsxs("div",{className:"settings-panel",children:[e.jsxs("div",{className:"setting-section",children:[e.jsx("h4",{children:"Video"}),e.jsxs("label",{children:["Resolution",e.jsxs("select",{value:`${t.settings.video.resolution.width}x${t.settings.video.resolution.height}`,onChange:s=>{const[a,r]=s.target.value.split("x").map(Number);h({settings:{...t.settings,video:{...t.settings.video,resolution:{width:a,height:r}}},layout:{...t.layout,canvas:{...t.layout.canvas,width:a,height:r}}})},disabled:m,children:[e.jsx("option",{value:"1920x1080",children:"1080p (1920x1080)"}),e.jsx("option",{value:"1280x720",children:"720p (1280x720)"}),e.jsx("option",{value:"2560x1440",children:"1440p (2560x1440)"})]})]}),e.jsxs("label",{children:["Frame Rate",e.jsxs("select",{value:t.settings.video.frameRate,onChange:s=>h({settings:{...t.settings,video:{...t.settings.video,frameRate:parseInt(s.target.value)}}}),disabled:m,children:[e.jsx("option",{value:"24",children:"24 fps"}),e.jsx("option",{value:"30",children:"30 fps"}),e.jsx("option",{value:"60",children:"60 fps"})]})]}),e.jsxs("label",{children:["Bitrate (kbps)",e.jsx("input",{type:"number",value:t.settings.video.bitrate,onChange:s=>h({settings:{...t.settings,video:{...t.settings.video,bitrate:parseInt(s.target.value)||6e3}}}),min:"1000",max:"50000",disabled:m})]}),e.jsxs("label",{children:["Keyframe Interval (sec)",e.jsx("input",{type:"number",value:t.settings.video.keyframe,onChange:s=>h({settings:{...t.settings,video:{...t.settings.video,keyframe:parseInt(s.target.value)||2}}}),min:"1",max:"10",disabled:m})]})]}),e.jsxs("div",{className:"setting-section",children:[e.jsx("h4",{children:"Audio"}),e.jsxs("label",{children:["Sample Rate",e.jsxs("select",{value:t.settings.audio.sampleRate,onChange:s=>h({settings:{...t.settings,audio:{...t.settings.audio,sampleRate:parseInt(s.target.value)}}}),disabled:m,children:[e.jsx("option",{value:"44100",children:"44.1 kHz"}),e.jsx("option",{value:"48000",children:"48 kHz"})]})]}),e.jsxs("label",{children:["Audio Bitrate (kbps)",e.jsxs("select",{value:t.settings.audio.bitrate,onChange:s=>h({settings:{...t.settings,audio:{...t.settings.audio,bitrate:parseInt(s.target.value)}}}),disabled:m,children:[e.jsx("option",{value:"96",children:"96 kbps"}),e.jsx("option",{value:"128",children:"128 kbps"}),e.jsx("option",{value:"160",children:"160 kbps"}),e.jsx("option",{value:"320",children:"320 kbps"})]})]})]})]})]})]})]}),m&&e.jsx("footer",{className:"streaming__footer",children:e.jsxs("div",{className:"footer-stats",children:[e.jsxs("span",{className:"stat",children:[e.jsx("label",{children:"CPU"}),e.jsxs("span",{className:"value",children:[j.cpuUsage.toFixed(1),"%"]})]}),e.jsxs("span",{className:"stat",children:[e.jsx("label",{children:"Memory"}),e.jsxs("span",{className:"value",children:[j.memoryUsage.toFixed(1),"%"]})]}),e.jsxs("span",{className:"stat",children:[e.jsx("label",{children:"Dropped"}),e.jsx("span",{className:"value",children:j.droppedFrames})]}),e.jsxs("span",{className:"stat",children:[e.jsx("label",{children:"Peak Viewers"}),e.jsx("span",{className:"value",children:j.peakViewers})]})]})}),k&&e.jsx("div",{className:"modal-overlay",children:e.jsxs("div",{className:"modal",children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h3",{children:"Add Source"}),e.jsx("button",{className:"close-button",onClick:()=>M(!1),children:"Ã"})]}),e.jsx("div",{className:"modal-content",children:e.jsx("div",{className:"source-type-grid",children:te.map(s=>e.jsxs("button",{className:"source-type-button",onClick:()=>Q(s.type),children:[e.jsx("span",{className:"icon",children:s.icon}),e.jsx("span",{className:"name",children:s.name})]},s.type))})})]})}),W&&e.jsx("div",{className:"modal-overlay",children:e.jsxs("div",{className:"modal",children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h3",{children:"Add Destination"}),e.jsx("button",{className:"close-button",onClick:()=>z(!1),children:"Ã"})]}),e.jsx("div",{className:"modal-content",children:e.jsx("div",{className:"platform-grid",children:ae.map(s=>e.jsxs("button",{className:"platform-button",onClick:()=>O(s.platform),children:[e.jsx("span",{className:"icon",children:s.icon}),e.jsx("span",{className:"name",children:s.name})]},s.platform))})})]})})]})};exports.NiceLiveStreaming=he;exports.NiceScreenRecorder=ue;exports.NiceVideoEditor=ce;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("react"),re={id:crypto.randomUUID(),name:"Untitled Project",resolution:{width:1920,height:1080,label:"1080p"},frameRate:30,duration:0,tracks:[{id:"1",type:"video",name:"Video 1",items:[],muted:!1,locked:!1,visible:!0},{id:"2",type:"audio",name:"Audio 1",items:[],muted:!1,locked:!1,visible:!0}],assets:[],settings:{backgroundColor:"var(--nice-text, #000000)",audio:{sampleRate:48e3,channels:2,bitrate:320},video:{codec:"h264",bitrate:8e3,profile:"high"}}},le=[{type:"blur",name:"Blur",icon:"đĩ"},{type:"brightness",name:"Brightness",icon:"âī¸"},{type:"contrast",name:"Contrast",icon:"â"},{type:"saturation",name:"Saturation",icon:"đ¨"},{type:"grayscale",name:"Grayscale",icon:"âŦ"},{type:"sepia",name:"Sepia",icon:"đ¤"},{type:"chromaKey",name:"Chroma Key",icon:"đĸ"},{type:"crop",name:"Crop",icon:"âī¸"},{type:"zoom",name:"Zoom",icon:"đ"}],oe=[{type:"fade",name:"Fade"},{type:"dissolve",name:"Dissolve"},{type:"wipe",name:"Wipe"},{type:"slide",name:"Slide"},{type:"zoom",name:"Zoom"},{type:"push",name:"Push"}],ce=({project:I,onProjectChange:w,onExport:R,onAssetUpload:T,className:A=""})=>{const[o,Y]=d.useState(I||re),[t,Z]=d.useState("timeline"),[v,V]=d.useState(null),[m,y]=d.useState(null),[j,E]=d.useState(0),[b,F]=d.useState(!1),[k,M]=d.useState(1),[W,z]=d.useState(!0),[g,$]=d.useState(null),J=d.useRef(null),ee=d.useRef(null),D=d.useRef(null);d.useEffect(()=>{I&&Y(I)},[I]),d.useEffect(()=>()=>{D.current&&clearInterval(D.current)},[]);const x=d.useCallback(n=>{const i={...o,...n};Y(i),w==null||w(i)},[o,w]),S=async n=>{const i=[];for(const u of Array.from(n)){const s=u.type.startsWith("video/")?"video":u.type.startsWith("audio/")?"audio":"image";let a;T?a=await T(u):a={id:crypto.randomUUID(),type:s,name:u.name,url:URL.createObjectURL(u),size:u.size},i.push(a)}x({assets:[...o.assets,...i]})},h=n=>{const i={id:crypto.randomUUID(),type:n,name:`${n.charAt(0).toUpperCase()+n.slice(1)} ${o.tracks.filter(u=>u.type===n).length+1}`,items:[],muted:!1,locked:!1,visible:!0};x({tracks:[...o.tracks,i]})},O=n=>{x({tracks:o.tracks.filter(i=>i.id!==n)}),v===n&&V(null)},q=n=>{x({tracks:o.tracks.map(i=>i.id===n?{...i,muted:!i.muted}:i)})},P=n=>{x({tracks:o.tracks.map(i=>i.id===n?{...i,locked:!i.locked}:i)})},Q=(n,i)=>{const u=o.tracks.find(c=>c.id===n);if(!u||u.locked)return;const s=u.items[u.items.length-1],a=s?s.startTime+s.duration:0,r={id:crypto.randomUUID(),assetId:i.id,type:i.type,startTime:a,duration:i.duration||5,offset:0,properties:{x:0,y:0,opacity:1,scale:1,volume:1},effects:[],transitions:[]};x({tracks:o.tracks.map(c=>c.id===n?{...c,items:[...c.items,r]}:c)})},N=(n,i,u)=>{const s={id:crypto.randomUUID(),type:u,name:u.charAt(0).toUpperCase()+u.slice(1),parameters:U(u)};x({tracks:o.tracks.map(a=>a.id===n?{...a,items:a.items.map(r=>r.id===i?{...r,effects:[...r.effects,s]}:r)}:a)})},B=(n,i,u,s)=>{const a={id:crypto.randomUUID(),type:u,duration:.5,position:s};x({tracks:o.tracks.map(r=>r.id===n?{...r,items:r.items.map(c=>c.id===i?{...c,transitions:[...c.transitions,a]}:c)}:r)})},U=n=>{switch(n){case"blur":return{radius:5};case"brightness":return{value:100};case"contrast":return{value:100};case"saturation":return{value:100};case"grayscale":return{amount:100};case"sepia":return{amount:100};case"chromaKey":return{color:"var(--nice-success, #00ff00)",threshold:40};case"crop":return{top:0,right:0,bottom:0,left:0};case"zoom":return{scale:1,x:0,y:0};default:return{}}},se=()=>{b?(D.current&&clearInterval(D.current),F(!1)):(D.current=setInterval(()=>{E(n=>{const i=Math.max(...o.tracks.flatMap(u=>u.items.map(s=>s.startTime+s.duration)),0);return n>=i?(clearInterval(D.current),F(!1),0):n+1/o.frameRate})},1e3/o.frameRate),F(!0))},H=n=>{E(Math.max(0,n))},X=async()=>{if(R){$(0);try{const n=setInterval(()=>{$(i=>i!==null&&i<90?i+Math.random()*10:i)},500);await R(o,o.settings.video.codec),clearInterval(n),$(100),setTimeout(()=>$(null),2e3)}catch(n){$(null),console.error("Export failed:",n)}}},G=n=>{const i=Math.floor(n/60),u=Math.floor(n%60),s=Math.floor(n%1*o.frameRate);return`${i.toString().padStart(2,"0")}:${u.toString().padStart(2,"0")}:${s.toString().padStart(2,"0")}`},K=()=>{for(const n of o.tracks){const i=n.items.find(u=>u.id===m);if(i)return{track:n,item:i}}return null};return e.jsxs("div",{className:`nice-video-editor ${A}`,children:[e.jsxs("header",{className:"video-editor__header",children:[e.jsxs("div",{className:"header__project-info",children:[e.jsx("input",{type:"text",value:o.name,onChange:n=>x({name:n.target.value}),className:"project-name-input"}),e.jsxs("span",{className:"project-settings",children:[o.resolution.width,"x",o.resolution.height," âĸ ",o.frameRate,"fps"]})]}),e.jsx("div",{className:"header__tabs",children:["timeline","effects","transitions","export"].map(n=>e.jsx("button",{className:`tab-button ${t===n?"tab-button--active":""}`,onClick:()=>Z(n),children:n.charAt(0).toUpperCase()+n.slice(1)},n))}),e.jsx("div",{className:"header__actions",children:e.jsx("button",{className:"action-button action-button--primary",onClick:X,disabled:g!==null,children:g!==null?`Exporting ${Math.round(g)}%`:"Export"})})]}),e.jsxs("div",{className:"video-editor__main",children:[W&&e.jsxs("aside",{className:"video-editor__asset-library",children:[e.jsxs("div",{className:"asset-library__header",children:[e.jsx("h3",{children:"Assets"}),e.jsx("button",{className:"close-button",onClick:()=>z(!1),children:"Ã"})]}),e.jsx("div",{className:"asset-library__upload",children:e.jsxs("label",{className:"upload-zone",children:[e.jsx("input",{type:"file",multiple:!0,accept:"video/*,audio/*,image/*",onChange:n=>n.target.files&&S(n.target.files),hidden:!0}),e.jsx("span",{className:"upload-icon",children:"+"}),e.jsx("span",{children:"Drop files or click to upload"})]})}),e.jsx("div",{className:"asset-library__list",children:o.assets.map(n=>e.jsxs("div",{className:"asset-item",draggable:!0,onDragStart:i=>i.dataTransfer.setData("assetId",n.id),children:[e.jsx("div",{className:"asset-thumbnail",children:n.thumbnail?e.jsx("img",{src:n.thumbnail,alt:n.name}):e.jsx("span",{className:"asset-type-icon",children:n.type==="video"?"đŦ":n.type==="audio"?"đĩ":"đŧī¸"})}),e.jsxs("div",{className:"asset-info",children:[e.jsx("span",{className:"asset-name",children:n.name}),e.jsxs("span",{className:"asset-meta",children:[(n.size/1024/1024).toFixed(1),"MB"]})]})]},n.id))})]}),e.jsxs("div",{className:"video-editor__preview-area",children:[e.jsxs("div",{className:"preview-container",children:[e.jsxs("div",{className:"preview-canvas",style:{aspectRatio:`${o.resolution.width}/${o.resolution.height}`},children:[e.jsx("video",{ref:ee,className:"preview-video"}),e.jsx("div",{className:"preview-overlay",children:!W&&e.jsx("button",{className:"toggle-library-button",onClick:()=>z(!0),children:"đ"})})]}),e.jsxs("div",{className:"playback-controls",children:[e.jsx("button",{onClick:()=>H(0),children:"âŽī¸"}),e.jsx("button",{onClick:()=>H(j-1/o.frameRate),children:"âĒ"}),e.jsx("button",{onClick:se,className:"play-button",children:b?"â¸ī¸":"âļī¸"}),e.jsx("button",{onClick:()=>H(j+1/o.frameRate),children:"âŠ"}),e.jsx("span",{className:"time-display",children:G(j)})]})]}),m&&t!=="export"&&e.jsx("div",{className:"item-inspector",children:(()=>{const n=K();if(!n)return null;const{track:i,item:u}=n;return e.jsxs(e.Fragment,{children:[e.jsx("h4",{children:"Item Properties"}),e.jsxs("div",{className:"inspector-section",children:[e.jsxs("label",{children:["Start Time",e.jsx("input",{type:"number",step:"0.1",value:u.startTime,onChange:s=>{const a=parseFloat(s.target.value);x({tracks:o.tracks.map(r=>r.id===i.id?{...r,items:r.items.map(c=>c.id===u.id?{...c,startTime:a}:c)}:r)})}})]}),e.jsxs("label",{children:["Duration",e.jsx("input",{type:"number",step:"0.1",value:u.duration,onChange:s=>{const a=parseFloat(s.target.value);x({tracks:o.tracks.map(r=>r.id===i.id?{...r,items:r.items.map(c=>c.id===u.id?{...c,duration:a}:c)}:r)})}})]}),e.jsxs("label",{children:["Opacity",e.jsx("input",{type:"range",min:"0",max:"1",step:"0.1",value:u.properties.opacity??1,onChange:s=>{const a=parseFloat(s.target.value);x({tracks:o.tracks.map(r=>r.id===i.id?{...r,items:r.items.map(c=>c.id===u.id?{...c,properties:{...c.properties,opacity:a}}:c)}:r)})}})]})]}),e.jsxs("h4",{children:["Effects (",u.effects.length,")"]}),e.jsx("div",{className:"effects-list",children:u.effects.map(s=>e.jsx("div",{className:"effect-badge",children:s.name},s.id))})]})})()})]})]}),e.jsxs("div",{className:"video-editor__panel",children:[t==="timeline"&&e.jsxs("div",{className:"timeline-panel",children:[e.jsxs("div",{className:"timeline-toolbar",children:[e.jsxs("div",{className:"track-buttons",children:[e.jsx("button",{onClick:()=>h("video"),children:"+ Video Track"}),e.jsx("button",{onClick:()=>h("audio"),children:"+ Audio Track"}),e.jsx("button",{onClick:()=>h("text"),children:"+ Text Track"})]}),e.jsxs("div",{className:"zoom-controls",children:[e.jsx("button",{onClick:()=>M(Math.max(.25,k-.25)),children:"-"}),e.jsxs("span",{children:[Math.round(k*100),"%"]}),e.jsx("button",{onClick:()=>M(Math.min(4,k+.25)),children:"+"})]})]}),e.jsxs("div",{className:"timeline-container",ref:J,children:[e.jsx("div",{className:"timeline-ruler",children:Array.from({length:Math.ceil(30/k)}).map((n,i)=>e.jsx("div",{className:"ruler-mark",style:{left:`${i*50*k}px`},children:G(i)},i))}),e.jsx("div",{className:"timeline-playhead",style:{left:`${j*50*k}px`}}),e.jsx("div",{className:"timeline-tracks",children:o.tracks.map(n=>e.jsxs("div",{className:`timeline-track ${v===n.id?"timeline-track--selected":""} ${n.locked?"timeline-track--locked":""}`,onClick:()=>V(n.id),onDrop:i=>{i.preventDefault();const u=i.dataTransfer.getData("assetId"),s=o.assets.find(a=>a.id===u);s&&Q(n.id,s)},onDragOver:i=>i.preventDefault(),children:[e.jsxs("div",{className:"track-header",children:[e.jsx("span",{className:"track-name",children:n.name}),e.jsxs("div",{className:"track-controls",children:[e.jsx("button",{className:n.muted?"active":"",onClick:i=>{i.stopPropagation(),q(n.id)},children:n.muted?"đ":"đ"}),e.jsx("button",{className:n.locked?"active":"",onClick:i=>{i.stopPropagation(),P(n.id)},children:n.locked?"đ":"đ"}),e.jsx("button",{onClick:i=>{i.stopPropagation(),O(n.id)},children:"đī¸"})]})]}),e.jsx("div",{className:"track-items",children:n.items.map(i=>{const u=o.assets.find(s=>s.id===i.assetId);return e.jsxs("div",{className:`track-item track-item--${i.type} ${m===i.id?"track-item--selected":""}`,style:{left:`${i.startTime*50*k}px`,width:`${i.duration*50*k}px`},onClick:s=>{s.stopPropagation(),y(i.id)},children:[e.jsx("span",{className:"item-name",children:(u==null?void 0:u.name)||"Untitled"}),i.transitions.length>0&&e.jsx("span",{className:"item-transitions",children:"â¨"}),i.effects.length>0&&e.jsx("span",{className:"item-effects",children:"đ¨"})]},i.id)})})]},n.id))})]})]}),t==="effects"&&e.jsxs("div",{className:"effects-panel",children:[e.jsx("h3",{children:"Video Effects"}),e.jsx("p",{className:"panel-hint",children:"Select a clip to apply effects"}),e.jsx("div",{className:"effects-grid",children:le.map(n=>e.jsxs("button",{className:"effect-preset",disabled:!m,onClick:()=>{const i=K();i&&N(i.track.id,i.item.id,n.type)},children:[e.jsx("span",{className:"effect-icon",children:n.icon}),e.jsx("span",{className:"effect-name",children:n.name})]},n.type))})]}),t==="transitions"&&e.jsxs("div",{className:"transitions-panel",children:[e.jsx("h3",{children:"Transitions"}),e.jsx("p",{className:"panel-hint",children:"Select a clip and add transitions between clips"}),e.jsx("div",{className:"transitions-grid",children:oe.map(n=>e.jsxs("div",{className:"transition-preset",children:[e.jsx("span",{className:"transition-name",children:n.name}),e.jsxs("div",{className:"transition-buttons",children:[e.jsx("button",{disabled:!m,onClick:()=>{const i=K();i&&B(i.track.id,i.item.id,n.type,"start")},children:"In"}),e.jsx("button",{disabled:!m,onClick:()=>{const i=K();i&&B(i.track.id,i.item.id,n.type,"end")},children:"Out"})]})]},n.type))})]}),t==="export"&&e.jsxs("div",{className:"export-panel",children:[e.jsx("h3",{children:"Export Settings"}),e.jsxs("div",{className:"export-settings",children:[e.jsxs("div",{className:"setting-group",children:[e.jsx("label",{children:"Resolution"}),e.jsxs("select",{value:`${o.resolution.width}x${o.resolution.height}`,onChange:n=>{const[i,u]=n.target.value.split("x").map(Number);x({resolution:{width:i,height:u}})},children:[e.jsx("option",{value:"1920x1080",children:"1080p (1920x1080)"}),e.jsx("option",{value:"2560x1440",children:"1440p (2560x1440)"}),e.jsx("option",{value:"3840x2160",children:"4K (3840x2160)"}),e.jsx("option",{value:"1280x720",children:"720p (1280x720)"})]})]}),e.jsxs("div",{className:"setting-group",children:[e.jsx("label",{children:"Frame Rate"}),e.jsxs("select",{value:o.frameRate,onChange:n=>x({frameRate:parseInt(n.target.value)}),children:[e.jsx("option",{value:"24",children:"24 fps"}),e.jsx("option",{value:"30",children:"30 fps"}),e.jsx("option",{value:"60",children:"60 fps"}),e.jsx("option",{value:"120",children:"120 fps"})]})]}),e.jsxs("div",{className:"setting-group",children:[e.jsx("label",{children:"Video Codec"}),e.jsxs("select",{value:o.settings.video.codec,onChange:n=>x({settings:{...o.settings,video:{...o.settings.video,codec:n.target.value}}}),children:[e.jsx("option",{value:"h264",children:"H.264 (Best Compatibility)"}),e.jsx("option",{value:"h265",children:"H.265/HEVC (Smaller Size)"}),e.jsx("option",{value:"vp9",children:"VP9 (Web Optimized)"}),e.jsx("option",{value:"av1",children:"AV1 (Future Standard)"})]})]}),e.jsxs("div",{className:"setting-group",children:[e.jsx("label",{children:"Video Bitrate (Mbps)"}),e.jsx("input",{type:"number",value:o.settings.video.bitrate/1e3,onChange:n=>x({settings:{...o.settings,video:{...o.settings.video,bitrate:parseFloat(n.target.value)*1e3}}}),min:"1",max:"100"})]})]}),e.jsx("button",{className:"export-button",onClick:X,disabled:g!==null,children:g!==null?`Exporting... ${Math.round(g)}%`:"Export Video"}),g!==null&&e.jsx("div",{className:"export-progress",children:e.jsx("div",{className:"export-progress-bar",style:{width:`${g}%`}})})]})]})]})},de={video:{source:"screen",showCursor:!0,frameRate:30,resolution:{width:1920,height:1080}},audio:{enabled:!0,source:"both",echoCancellation:!0,noiseSuppression:!0},output:{format:"webm",quality:"high"}},ue=({options:I,onRecordingStart:w,onRecordingStop:R,onRecordingPause:T,onRecordingResume:A,onError:o,className:Y=""})=>{var c,C;const[t,Z]=d.useState({...de,...I}),[v,V]=d.useState(null),[m,y]=d.useState("idle"),[j,E]=d.useState([]),[b,F]=d.useState(null),[k,M]=d.useState(null),[W,z]=d.useState(!1),[g,$]=d.useState(!1),[J,ee]=d.useState("pen"),[D,x]=d.useState("var(--nice-danger, #ff0000)"),S=d.useRef(null),h=d.useRef([]),O=d.useRef(null),q=d.useRef(null),P=d.useRef(null),Q=d.useRef(0);d.useEffect(()=>()=>{b&&b.getTracks().forEach(l=>l.stop()),P.current&&clearInterval(P.current)},[b]);const N=l=>{Z(p=>({...p,...l,video:{...p.video,...l.video},audio:{...p.audio,...l.audio},output:{...p.output,...l.output}}))},B=async()=>{try{y("preparing");const l={video:{cursor:t.video.showCursor?"always":"never",frameRate:t.video.frameRate},audio:t.audio.source==="system"||t.audio.source==="both"},p=await navigator.mediaDevices.getDisplayMedia(l);if(t.audio.enabled&&(t.audio.source==="microphone"||t.audio.source==="both"))try{(await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:t.audio.echoCancellation,noiseSuppression:t.audio.noiseSuppression}})).getAudioTracks().forEach(_=>p.addTrack(_))}catch(f){console.warn("Could not access microphone:",f)}F(p),O.current&&(O.current.srcObject=p,O.current.play()),y("idle")}catch(l){y("error"),o==null||o(l instanceof Error?l:new Error("Failed to start preview"))}},U=async()=>{b||await B();for(let l=3;l>0;l--)M(l),await new Promise(p=>setTimeout(p,1e3));M(null);try{const l=b||await se();if(!l)throw new Error("No stream available");const p=i(t.output.format),f=new MediaRecorder(l,{mimeType:p,videoBitsPerSecond:u(t.output.quality)});h.current=[],f.ondataavailable=L=>{L.data.size>0&&h.current.push(L.data)},f.onstop=()=>{const L=new Blob(h.current,{type:p});v&&(R==null||R({...v,status:"stopped"},L))},S.current=f,f.start(1e3),Q.current=Date.now();const _={id:crypto.randomUUID(),status:"recording",startTime:new Date,duration:0,size:0,options:t,chunks:[]};V(_),y("recording"),w==null||w(_),P.current=setInterval(()=>{V(L=>L?{...L,duration:(Date.now()-Q.current)/1e3,size:h.current.reduce((ne,ie)=>ne+ie.size,0)}:null)},100)}catch(l){y("error"),o==null||o(l instanceof Error?l:new Error("Failed to start recording"))}},se=async()=>(await B(),b),H=()=>{S.current&&m==="recording"&&(S.current.pause(),y("paused"),T==null||T())},X=()=>{S.current&&m==="paused"&&(S.current.resume(),y("recording"),A==null||A())},G=()=>{P.current&&clearInterval(P.current),S.current&&(m==="recording"||m==="paused")&&(S.current.stop(),y("stopped")),b&&(b.getTracks().forEach(l=>l.stop()),F(null))},K=d.useCallback(l=>{if(m!=="recording")return;const p={id:crypto.randomUUID(),time:(v==null?void 0:v.duration)||0,label:l||`Marker ${j.length+1}`,color:s()};E(f=>[...f,p])},[m,v==null?void 0:v.duration,j.length]),n=l=>{E(p=>p.filter(f=>f.id!==l))},i=l=>{switch(l){case"mp4":return"video/mp4";case"mkv":return"video/x-matroska";default:return"video/webm;codecs=vp9"}},u=l=>{switch(l){case"low":return 25e5;case"medium":return 5e6;case"lossless":return 2e7;default:return 8e6}},s=()=>{const l=["var(--nice-danger, #ff4444)","#44ff44","#4444ff","#ffff44","#ff44ff","#44ffff"];return l[Math.floor(Math.random()*l.length)]},a=l=>{const p=Math.floor(l/3600),f=Math.floor(l%3600/60),_=Math.floor(l%60),L=Math.floor(l%1*100);return p>0?`${p}:${f.toString().padStart(2,"0")}:${_.toString().padStart(2,"0")}`:`${f.toString().padStart(2,"0")}:${_.toString().padStart(2,"0")}.${L.toString().padStart(2,"0")}`},r=l=>l<1024?`${l} B`:l<1024*1024?`${(l/1024).toFixed(1)} KB`:`${(l/1024/1024).toFixed(1)} MB`;return e.jsxs("div",{className:`nice-screen-recorder ${Y}`,children:[e.jsxs("div",{className:"recorder__preview",children:[k!==null&&e.jsx("div",{className:"countdown-overlay",children:e.jsx("span",{className:"countdown-number",children:k})}),e.jsx("video",{ref:O,className:"preview-video",muted:!0,playsInline:!0}),g&&e.jsx("canvas",{ref:q,className:"annotation-canvas"}),!b&&m==="idle"&&e.jsx("div",{className:"preview-placeholder",children:e.jsxs("button",{className:"start-preview-button",onClick:B,children:[e.jsx("span",{className:"icon",children:"đĨī¸"}),e.jsx("span",{children:"Select Screen to Record"})]})}),m==="recording"&&e.jsxs("div",{className:"recording-indicator",children:[e.jsx("span",{className:"recording-dot"}),e.jsx("span",{children:"REC"})]})]}),e.jsxs("div",{className:"recorder__controls",children:[e.jsxs("div",{className:"controls__main",children:[m==="idle"&&e.jsxs("button",{className:"control-button control-button--record",onClick:U,disabled:!!k,children:[e.jsx("span",{className:"icon",children:"âēī¸"}),e.jsx("span",{children:"Start Recording"})]}),m==="recording"&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"control-button control-button--pause",onClick:H,children:[e.jsx("span",{className:"icon",children:"â¸ī¸"}),e.jsx("span",{children:"Pause"})]}),e.jsxs("button",{className:"control-button control-button--stop",onClick:G,children:[e.jsx("span",{className:"icon",children:"âšī¸"}),e.jsx("span",{children:"Stop"})]})]}),m==="paused"&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"control-button control-button--resume",onClick:X,children:[e.jsx("span",{className:"icon",children:"âļī¸"}),e.jsx("span",{children:"Resume"})]}),e.jsxs("button",{className:"control-button control-button--stop",onClick:G,children:[e.jsx("span",{className:"icon",children:"âšī¸"}),e.jsx("span",{children:"Stop"})]})]}),m==="stopped"&&e.jsxs("button",{className:"control-button control-button--new",onClick:()=>{y("idle"),V(null),E([])},children:[e.jsx("span",{className:"icon",children:"đ"}),e.jsx("span",{children:"New Recording"})]})]}),e.jsxs("div",{className:"controls__secondary",children:[(m==="recording"||m==="paused")&&e.jsxs("button",{className:"control-button control-button--marker",onClick:()=>K(),children:[e.jsx("span",{className:"icon",children:"đŠ"}),e.jsx("span",{children:"Add Marker"})]}),e.jsxs("button",{className:`control-button ${g?"control-button--active":""}`,onClick:()=>$(!g),disabled:m!=="recording",children:[e.jsx("span",{className:"icon",children:"âī¸"}),e.jsx("span",{children:"Annotate"})]}),e.jsx("button",{className:"control-button control-button--settings",onClick:()=>z(!W),disabled:m==="recording",children:e.jsx("span",{className:"icon",children:"âī¸"})})]})]}),e.jsxs("div",{className:"recorder__status",children:[e.jsxs("div",{className:"status__info",children:[e.jsxs("span",{className:"status-item",children:[e.jsx("strong",{children:"Duration:"})," ",a((v==null?void 0:v.duration)||0)]}),e.jsxs("span",{className:"status-item",children:[e.jsx("strong",{children:"Size:"})," ",r((v==null?void 0:v.size)||0)]}),e.jsxs("span",{className:"status-item",children:[e.jsx("strong",{children:"Markers:"})," ",j.length]})]}),e.jsxs("div",{className:"status__quality",children:[t.video.resolution&&e.jsxs("span",{children:[t.video.resolution.width,"x",t.video.resolution.height]}),e.jsxs("span",{children:[t.video.frameRate,"fps"]}),e.jsx("span",{className:t.audio.enabled?"audio-on":"audio-off",children:t.audio.enabled?"đ":"đ"})]})]}),g&&m==="recording"&&e.jsxs("div",{className:"recorder__annotation-tools",children:[e.jsx("div",{className:"tool-group",children:["pen","arrow","rectangle","text"].map(l=>e.jsxs("button",{className:`tool-button ${J===l?"tool-button--active":""}`,onClick:()=>ee(l),children:[l==="pen"&&"âī¸",l==="arrow"&&"âĄī¸",l==="rectangle"&&"âŦ",l==="text"&&"T"]},l))}),e.jsx("div",{className:"color-group",children:["var(--nice-danger, #ff0000)","var(--nice-success, #00ff00)","var(--nice-primary, #0000ff)","var(--nice-warning, #ffff00)","var(--nice-bg, #fff)","var(--nice-text, #000000)"].map(l=>e.jsx("button",{className:`color-button ${D===l?"color-button--active":""}`,style:{backgroundColor:l},onClick:()=>x(l)},l))})]}),j.length>0&&e.jsxs("div",{className:"recorder__markers",children:[e.jsx("h4",{children:"Markers"}),e.jsx("div",{className:"markers-list",children:j.map(l=>e.jsxs("div",{className:"marker-item",style:{borderLeftColor:l.color},children:[e.jsx("span",{className:"marker-time",children:a(l.time)}),e.jsx("input",{type:"text",value:l.label,onChange:p=>{E(f=>f.map(_=>_.id===l.id?{..._,label:p.target.value}:_))},className:"marker-label"}),e.jsx("button",{className:"marker-remove",onClick:()=>n(l.id),children:"Ã"})]},l.id))})]}),W&&e.jsxs("div",{className:"recorder__settings",children:[e.jsxs("div",{className:"settings-header",children:[e.jsx("h3",{children:"Recording Settings"}),e.jsx("button",{className:"close-button",onClick:()=>z(!1),children:"Ã"})]}),e.jsxs("div",{className:"settings-section",children:[e.jsx("h4",{children:"Video"}),e.jsxs("label",{children:["Source",e.jsxs("select",{value:t.video.source,onChange:l=>N({video:{...t.video,source:l.target.value}}),children:[e.jsx("option",{value:"screen",children:"Entire Screen"}),e.jsx("option",{value:"window",children:"Application Window"}),e.jsx("option",{value:"tab",children:"Browser Tab"}),e.jsx("option",{value:"camera",children:"Camera"})]})]}),e.jsxs("label",{children:["Resolution",e.jsxs("select",{value:`${(c=t.video.resolution)==null?void 0:c.width}x${(C=t.video.resolution)==null?void 0:C.height}`,onChange:l=>{const[p,f]=l.target.value.split("x").map(Number);N({video:{...t.video,resolution:{width:p,height:f}}})},children:[e.jsx("option",{value:"1920x1080",children:"1080p (1920x1080)"}),e.jsx("option",{value:"2560x1440",children:"1440p (2560x1440)"}),e.jsx("option",{value:"3840x2160",children:"4K (3840x2160)"}),e.jsx("option",{value:"1280x720",children:"720p (1280x720)"})]})]}),e.jsxs("label",{children:["Frame Rate",e.jsxs("select",{value:t.video.frameRate,onChange:l=>N({video:{...t.video,frameRate:parseInt(l.target.value)}}),children:[e.jsx("option",{value:"15",children:"15 fps"}),e.jsx("option",{value:"24",children:"24 fps"}),e.jsx("option",{value:"30",children:"30 fps"}),e.jsx("option",{value:"60",children:"60 fps"})]})]}),e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:t.video.showCursor,onChange:l=>N({video:{...t.video,showCursor:l.target.checked}})}),"Show Cursor"]})]}),e.jsxs("div",{className:"settings-section",children:[e.jsx("h4",{children:"Audio"}),e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:t.audio.enabled,onChange:l=>N({audio:{...t.audio,enabled:l.target.checked}})}),"Enable Audio"]}),t.audio.enabled&&e.jsxs(e.Fragment,{children:[e.jsxs("label",{children:["Source",e.jsxs("select",{value:t.audio.source,onChange:l=>N({audio:{...t.audio,source:l.target.value}}),children:[e.jsx("option",{value:"system",children:"System Audio"}),e.jsx("option",{value:"microphone",children:"Microphone"}),e.jsx("option",{value:"both",children:"Both"})]})]}),e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:t.audio.echoCancellation,onChange:l=>N({audio:{...t.audio,echoCancellation:l.target.checked}})}),"Echo Cancellation"]}),e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:t.audio.noiseSuppression,onChange:l=>N({audio:{...t.audio,noiseSuppression:l.target.checked}})}),"Noise Suppression"]})]})]}),e.jsxs("div",{className:"settings-section",children:[e.jsx("h4",{children:"Output"}),e.jsxs("label",{children:["Format",e.jsxs("select",{value:t.output.format,onChange:l=>N({output:{...t.output,format:l.target.value}}),children:[e.jsx("option",{value:"webm",children:"WebM (Best Web)"}),e.jsx("option",{value:"mp4",children:"MP4 (Most Compatible)"}),e.jsx("option",{value:"mkv",children:"MKV (Lossless)"})]})]}),e.jsxs("label",{children:["Quality",e.jsxs("select",{value:t.output.quality,onChange:l=>N({output:{...t.output,quality:l.target.value}}),children:[e.jsx("option",{value:"low",children:"Low (Smaller file)"}),e.jsx("option",{value:"medium",children:"Medium"}),e.jsx("option",{value:"high",children:"High (Recommended)"}),e.jsx("option",{value:"lossless",children:"Lossless (Largest file)"})]})]})]})]})]})},me={id:crypto.randomUUID(),name:"My Stream",protocol:"rtmp",destinations:[],sources:[],layout:{name:"Default",canvas:{width:1920,height:1080,backgroundColor:"var(--nice-text, #000000)"},layers:[]},settings:{video:{resolution:{width:1920,height:1080},frameRate:30,codec:"h264",bitrate:6e3,keyframe:2,profile:"high"},audio:{sampleRate:48e3,bitrate:160,channels:2,codec:"aac"}}},ae=[{platform:"youtube",name:"YouTube",icon:"đē",defaultUrl:"rtmp://a.rtmp.youtube.com/live2"},{platform:"twitch",name:"Twitch",icon:"đŽ",defaultUrl:"rtmp://live.twitch.tv/app"},{platform:"facebook",name:"Facebook",icon:"đ",defaultUrl:"rtmps://live-api-s.facebook.com:443/rtmp"},{platform:"custom-rtmp",name:"Custom RTMP",icon:"đ",defaultUrl:""},{platform:"custom-srt",name:"Custom SRT",icon:"đ",defaultUrl:""}],te=[{type:"camera",name:"Camera",icon:"đˇ"},{type:"screen",name:"Screen Capture",icon:"đĨī¸"},{type:"window",name:"Window Capture",icon:"đĒ"},{type:"browser",name:"Browser Source",icon:"đ"},{type:"image",name:"Image",icon:"đŧī¸"},{type:"video",name:"Video",icon:"đŦ"},{type:"microphone",name:"Microphone",icon:"đ¤"},{type:"system-audio",name:"System Audio",icon:"đ"}],he=({config:I,onConfigChange:w,onStreamStart:R,onStreamStop:T,onStatsUpdate:A,onError:o,className:Y=""})=>{const[t,Z]=d.useState(I||me),[v,V]=d.useState("sources"),[m,y]=d.useState(!1),[j,E]=d.useState({duration:0,viewers:0,peakViewers:0,bitrate:0,fps:0,droppedFrames:0,cpuUsage:0,memoryUsage:0}),[b,F]=d.useState(null),[k,M]=d.useState(!1),[W,z]=d.useState(!1),[g,$]=d.useState([t.layout]),[J,ee]=d.useState(0),D=d.useRef(null),x=d.useRef(null),S=d.useRef(0);d.useEffect(()=>{I&&Z(I)},[I]),d.useEffect(()=>()=>{x.current&&clearInterval(x.current)},[]);const h=d.useCallback(s=>{const a={...t,...s};Z(a),w==null||w(a)},[t,w]),O=s=>{const a=ae.find(c=>c.platform===s),r={id:crypto.randomUUID(),name:(a==null?void 0:a.name)||"Custom",platform:s,url:(a==null?void 0:a.defaultUrl)||"",streamKey:"",enabled:!0,status:"idle"};h({destinations:[...t.destinations,r]}),z(!1)},q=(s,a)=>{h({destinations:t.destinations.map(r=>r.id===s?{...r,...a}:r)})},P=s=>{h({destinations:t.destinations.filter(a=>a.id!==s)})},Q=async s=>{const a=te.find(C=>C.type===s),r={id:crypto.randomUUID(),type:s,name:`${(a==null?void 0:a.name)||s} ${t.sources.filter(C=>C.type===s).length+1}`,settings:{},volume:1,muted:!1};try{if(s==="camera"||s==="microphone"){const C=s==="camera"?{video:!0}:{audio:!0},p=(await navigator.mediaDevices.enumerateDevices()).filter(f=>s==="camera"?f.kind==="videoinput":f.kind==="audioinput");p.length>0&&(r.settings.deviceId=p[0].deviceId)}else(s==="screen"||s==="window")&&await navigator.mediaDevices.getDisplayMedia({video:!0})}catch(C){console.warn(`Could not access ${s}:`,C)}h({sources:[...t.sources,r]});const c={id:crypto.randomUUID(),sourceId:r.id,position:{x:0,y:0},size:{width:t.layout.canvas.width,height:t.layout.canvas.height},visible:!0,opacity:1,zIndex:t.layout.layers.length};h({layout:{...t.layout,layers:[...t.layout.layers,c]}}),M(!1)},N=(s,a)=>{h({sources:t.sources.map(r=>r.id===s?{...r,...a}:r)})},B=s=>{h({sources:t.sources.filter(a=>a.id!==s),layout:{...t.layout,layers:t.layout.layers.filter(a=>a.sourceId!==s)}})},U=(s,a)=>{h({layout:{...t.layout,layers:t.layout.layers.map(r=>r.id===s?{...r,...a}:r)}})},se=s=>{const a=t.layout.layers.findIndex(r=>r.id===s);if(a<t.layout.layers.length-1){const r=[...t.layout.layers];[r[a],r[a+1]]=[r[a+1],r[a]],r.forEach((c,C)=>{c.zIndex=C}),h({layout:{...t.layout,layers:r}})}},H=s=>{const a=t.layout.layers.findIndex(r=>r.id===s);if(a>0){const r=[...t.layout.layers];[r[a],r[a-1]]=[r[a-1],r[a]],r.forEach((c,C)=>{c.zIndex=C}),h({layout:{...t.layout,layers:r}})}},X=()=>{const s={name:`Scene ${g.length+1}`,canvas:{...t.layout.canvas},layers:[]};$([...g,s])},G=s=>{const a=[...g];a[J]=t.layout,$(a),ee(s),h({layout:g[s]})},K=async()=>{try{h({destinations:t.destinations.map(s=>s.enabled?{...s,status:"connecting"}:s)}),await new Promise(s=>setTimeout(s,2e3)),h({destinations:t.destinations.map(s=>s.enabled?{...s,status:"live"}:s)}),y(!0),S.current=Date.now(),R==null||R(),x.current=setInterval(()=>{const s={duration:(Date.now()-S.current)/1e3,viewers:Math.floor(Math.random()*100)+j.viewers,peakViewers:Math.max(j.peakViewers,j.viewers),bitrate:t.settings.video.bitrate+Math.floor(Math.random()*500-250),fps:t.settings.video.frameRate-Math.random()*2,droppedFrames:j.droppedFrames+(Math.random()>.95?1:0),cpuUsage:15+Math.random()*30,memoryUsage:40+Math.random()*20};E(s),A==null||A(s)},1e3)}catch(s){o==null||o(s instanceof Error?s:new Error("Failed to start stream")),h({destinations:t.destinations.map(a=>({...a,status:"error"}))})}},n=()=>{x.current&&clearInterval(x.current),h({destinations:t.destinations.map(s=>({...s,status:"idle"}))}),y(!1),T==null||T()},i=s=>{const a=Math.floor(s/3600),r=Math.floor(s%3600/60),c=Math.floor(s%60);return`${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}:${c.toString().padStart(2,"0")}`},u=s=>{switch(s){case"live":return"var(--nice-success, #00ff00)";case"connecting":return"var(--nice-warning, #ffff00)";case"error":return"var(--nice-danger, #ff0000)";default:return"var(--nice-text-secondary, #888888)"}};return e.jsxs("div",{className:`nice-live-streaming ${Y}`,children:[e.jsxs("header",{className:"streaming__header",children:[e.jsxs("div",{className:"header__title",children:[e.jsx("input",{type:"text",value:t.name,onChange:s=>h({name:s.target.value}),className:"stream-name-input"}),m&&e.jsxs("span",{className:"live-badge",children:[e.jsx("span",{className:"live-dot"})," LIVE"]})]}),e.jsx("div",{className:"header__stats",children:m&&e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"stat-item",children:["âąī¸ ",i(j.duration)]}),e.jsxs("span",{className:"stat-item",children:["đĨ ",j.viewers]}),e.jsxs("span",{className:"stat-item",children:["đ ",Math.round(j.bitrate)," kbps"]}),e.jsxs("span",{className:"stat-item",children:["đŦ ",j.fps.toFixed(1)," fps"]})]})}),e.jsx("div",{className:"header__actions",children:m?e.jsx("button",{className:"action-button action-button--stop",onClick:n,children:"End Stream"}):e.jsx("button",{className:"action-button action-button--go-live",onClick:K,disabled:t.destinations.filter(s=>s.enabled).length===0,children:"Go Live"})})]}),e.jsxs("div",{className:"streaming__main",children:[e.jsxs("div",{className:"streaming__preview",children:[e.jsxs("div",{className:"scenes-bar",children:[g.map((s,a)=>e.jsx("button",{className:`scene-button ${J===a?"scene-button--active":""}`,onClick:()=>G(a),children:s.name},a)),e.jsx("button",{className:"scene-button scene-button--add",onClick:X,children:"+"})]}),e.jsx("div",{ref:D,className:"preview-canvas",style:{aspectRatio:`${t.layout.canvas.width}/${t.layout.canvas.height}`,backgroundColor:t.layout.canvas.backgroundColor},children:t.layout.layers.sort((s,a)=>s.zIndex-a.zIndex).map(s=>{var r;const a=t.sources.find(c=>c.id===s.sourceId);return!s.visible||!a?null:e.jsx("div",{className:`canvas-layer ${b===s.id?"canvas-layer--selected":""}`,style:{left:`${s.position.x/t.layout.canvas.width*100}%`,top:`${s.position.y/t.layout.canvas.height*100}%`,width:`${s.size.width/t.layout.canvas.width*100}%`,height:`${s.size.height/t.layout.canvas.height*100}%`,opacity:s.opacity,zIndex:s.zIndex},onClick:()=>F(s.id),children:e.jsxs("div",{className:"layer-content",children:[e.jsx("span",{className:"layer-icon",children:((r=te.find(c=>c.type===a.type))==null?void 0:r.icon)||"đĻ"}),e.jsx("span",{className:"layer-name",children:a.name})]})},s.id)})})]}),e.jsxs("aside",{className:"streaming__panel",children:[e.jsx("div",{className:"panel-tabs",children:["sources","audio","destinations","settings"].map(s=>e.jsx("button",{className:`panel-tab ${v===s?"panel-tab--active":""}`,onClick:()=>V(s),children:s.charAt(0).toUpperCase()+s.slice(1)},s))}),e.jsxs("div",{className:"panel-content",children:[v==="sources"&&e.jsxs("div",{className:"sources-panel",children:[e.jsxs("div",{className:"panel-header",children:[e.jsx("h3",{children:"Sources"}),e.jsx("button",{className:"add-button",onClick:()=>M(!0),disabled:m,children:"+ Add"})]}),e.jsx("div",{className:"sources-list",children:t.sources.filter(s=>s.type!=="microphone"&&s.type!=="system-audio").map(s=>{var r;const a=t.layout.layers.find(c=>c.sourceId===s.id);return e.jsxs("div",{className:`source-item ${b===(a==null?void 0:a.id)?"source-item--selected":""}`,onClick:()=>a&&F(a.id),children:[e.jsx("span",{className:"source-icon",children:(r=te.find(c=>c.type===s.type))==null?void 0:r.icon}),e.jsx("span",{className:"source-name",children:s.name}),e.jsxs("div",{className:"source-controls",children:[e.jsx("button",{className:a!=null&&a.visible?"":"inactive",onClick:c=>{c.stopPropagation(),a&&U(a.id,{visible:!a.visible})},children:a!=null&&a.visible?"đī¸":"đī¸âđ¨ī¸"}),e.jsx("button",{onClick:c=>{c.stopPropagation(),a&&se(a.id)},children:"âŦī¸"}),e.jsx("button",{onClick:c=>{c.stopPropagation(),a&&H(a.id)},children:"âŦī¸"}),e.jsx("button",{onClick:c=>{c.stopPropagation(),B(s.id)},disabled:m,children:"đī¸"})]})]},s.id)})}),b&&e.jsxs("div",{className:"layer-properties",children:[e.jsx("h4",{children:"Properties"}),(()=>{const s=t.layout.layers.find(a=>a.id===b);return s?e.jsxs(e.Fragment,{children:[e.jsxs("label",{children:["X Position",e.jsx("input",{type:"number",value:s.position.x,onChange:a=>U(s.id,{position:{...s.position,x:parseInt(a.target.value)||0}})})]}),e.jsxs("label",{children:["Y Position",e.jsx("input",{type:"number",value:s.position.y,onChange:a=>U(s.id,{position:{...s.position,y:parseInt(a.target.value)||0}})})]}),e.jsxs("label",{children:["Width",e.jsx("input",{type:"number",value:s.size.width,onChange:a=>U(s.id,{size:{...s.size,width:parseInt(a.target.value)||100}})})]}),e.jsxs("label",{children:["Height",e.jsx("input",{type:"number",value:s.size.height,onChange:a=>U(s.id,{size:{...s.size,height:parseInt(a.target.value)||100}})})]}),e.jsxs("label",{children:["Opacity",e.jsx("input",{type:"range",min:"0",max:"1",step:"0.1",value:s.opacity,onChange:a=>U(s.id,{opacity:parseFloat(a.target.value)})})]})]}):null})()]})]}),v==="audio"&&e.jsxs("div",{className:"audio-panel",children:[e.jsxs("div",{className:"panel-header",children:[e.jsx("h3",{children:"Audio Mixer"}),e.jsx("button",{className:"add-button",onClick:()=>{M(!0)},disabled:m,children:"+ Add"})]}),e.jsxs("div",{className:"audio-sources",children:[t.sources.filter(s=>s.type==="microphone"||s.type==="system-audio"||s.type==="video").map(s=>{var a;return e.jsxs("div",{className:"audio-source",children:[e.jsxs("div",{className:"audio-header",children:[e.jsx("span",{className:"audio-icon",children:(a=te.find(r=>r.type===s.type))==null?void 0:a.icon}),e.jsx("span",{className:"audio-name",children:s.name}),e.jsx("button",{className:s.muted?"muted":"",onClick:()=>N(s.id,{muted:!s.muted}),children:s.muted?"đ":"đ"})]}),e.jsxs("div",{className:"audio-slider",children:[e.jsx("input",{type:"range",min:"0",max:"1",step:"0.01",value:s.volume??1,onChange:r=>N(s.id,{volume:parseFloat(r.target.value)}),disabled:s.muted}),e.jsxs("span",{className:"volume-value",children:[Math.round((s.volume??1)*100),"%"]})]}),e.jsx("div",{className:"audio-meter",children:e.jsx("div",{className:"meter-fill",style:{width:`${(s.volume??1)*70+Math.random()*30}%`}})})]},s.id)}),t.sources.filter(s=>s.type==="microphone"||s.type==="system-audio").length===0&&e.jsx("p",{className:"empty-message",children:"No audio sources added"})]})]}),v==="destinations"&&e.jsxs("div",{className:"destinations-panel",children:[e.jsxs("div",{className:"panel-header",children:[e.jsx("h3",{children:"Destinations"}),e.jsx("button",{className:"add-button",onClick:()=>z(!0),disabled:m,children:"+ Add"})]}),e.jsxs("div",{className:"destinations-list",children:[t.destinations.map(s=>{var a;return e.jsxs("div",{className:"destination-item",children:[e.jsxs("div",{className:"destination-header",children:[e.jsx("span",{className:"status-indicator",style:{backgroundColor:u(s.status)}}),e.jsx("span",{className:"destination-icon",children:(a=ae.find(r=>r.platform===s.platform))==null?void 0:a.icon}),e.jsx("span",{className:"destination-name",children:s.name}),e.jsxs("label",{className:"toggle",children:[e.jsx("input",{type:"checkbox",checked:s.enabled,onChange:r=>q(s.id,{enabled:r.target.checked}),disabled:m}),e.jsx("span",{className:"toggle-slider"})]})]}),e.jsxs("div",{className:"destination-config",children:[e.jsxs("label",{children:["Server URL",e.jsx("input",{type:"text",value:s.url,onChange:r=>q(s.id,{url:r.target.value}),placeholder:"rtmp://...",disabled:m})]}),e.jsxs("label",{children:["Stream Key",e.jsx("input",{type:"password",value:s.streamKey||"",onChange:r=>q(s.id,{streamKey:r.target.value}),placeholder:"Enter stream key",disabled:m})]})]}),e.jsx("button",{className:"remove-button",onClick:()=>P(s.id),disabled:m,children:"Remove"})]},s.id)}),t.destinations.length===0&&e.jsx("p",{className:"empty-message",children:"No destinations configured"})]})]}),v==="settings"&&e.jsxs("div",{className:"settings-panel",children:[e.jsxs("div",{className:"setting-section",children:[e.jsx("h4",{children:"Video"}),e.jsxs("label",{children:["Resolution",e.jsxs("select",{value:`${t.settings.video.resolution.width}x${t.settings.video.resolution.height}`,onChange:s=>{const[a,r]=s.target.value.split("x").map(Number);h({settings:{...t.settings,video:{...t.settings.video,resolution:{width:a,height:r}}},layout:{...t.layout,canvas:{...t.layout.canvas,width:a,height:r}}})},disabled:m,children:[e.jsx("option",{value:"1920x1080",children:"1080p (1920x1080)"}),e.jsx("option",{value:"1280x720",children:"720p (1280x720)"}),e.jsx("option",{value:"2560x1440",children:"1440p (2560x1440)"})]})]}),e.jsxs("label",{children:["Frame Rate",e.jsxs("select",{value:t.settings.video.frameRate,onChange:s=>h({settings:{...t.settings,video:{...t.settings.video,frameRate:parseInt(s.target.value)}}}),disabled:m,children:[e.jsx("option",{value:"24",children:"24 fps"}),e.jsx("option",{value:"30",children:"30 fps"}),e.jsx("option",{value:"60",children:"60 fps"})]})]}),e.jsxs("label",{children:["Bitrate (kbps)",e.jsx("input",{type:"number",value:t.settings.video.bitrate,onChange:s=>h({settings:{...t.settings,video:{...t.settings.video,bitrate:parseInt(s.target.value)||6e3}}}),min:"1000",max:"50000",disabled:m})]}),e.jsxs("label",{children:["Keyframe Interval (sec)",e.jsx("input",{type:"number",value:t.settings.video.keyframe,onChange:s=>h({settings:{...t.settings,video:{...t.settings.video,keyframe:parseInt(s.target.value)||2}}}),min:"1",max:"10",disabled:m})]})]}),e.jsxs("div",{className:"setting-section",children:[e.jsx("h4",{children:"Audio"}),e.jsxs("label",{children:["Sample Rate",e.jsxs("select",{value:t.settings.audio.sampleRate,onChange:s=>h({settings:{...t.settings,audio:{...t.settings.audio,sampleRate:parseInt(s.target.value)}}}),disabled:m,children:[e.jsx("option",{value:"44100",children:"44.1 kHz"}),e.jsx("option",{value:"48000",children:"48 kHz"})]})]}),e.jsxs("label",{children:["Audio Bitrate (kbps)",e.jsxs("select",{value:t.settings.audio.bitrate,onChange:s=>h({settings:{...t.settings,audio:{...t.settings.audio,bitrate:parseInt(s.target.value)}}}),disabled:m,children:[e.jsx("option",{value:"96",children:"96 kbps"}),e.jsx("option",{value:"128",children:"128 kbps"}),e.jsx("option",{value:"160",children:"160 kbps"}),e.jsx("option",{value:"320",children:"320 kbps"})]})]})]})]})]})]})]}),m&&e.jsx("footer",{className:"streaming__footer",children:e.jsxs("div",{className:"footer-stats",children:[e.jsxs("span",{className:"stat",children:[e.jsx("label",{children:"CPU"}),e.jsxs("span",{className:"value",children:[j.cpuUsage.toFixed(1),"%"]})]}),e.jsxs("span",{className:"stat",children:[e.jsx("label",{children:"Memory"}),e.jsxs("span",{className:"value",children:[j.memoryUsage.toFixed(1),"%"]})]}),e.jsxs("span",{className:"stat",children:[e.jsx("label",{children:"Dropped"}),e.jsx("span",{className:"value",children:j.droppedFrames})]}),e.jsxs("span",{className:"stat",children:[e.jsx("label",{children:"Peak Viewers"}),e.jsx("span",{className:"value",children:j.peakViewers})]})]})}),k&&e.jsx("div",{className:"modal-overlay",children:e.jsxs("div",{className:"modal",children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h3",{children:"Add Source"}),e.jsx("button",{className:"close-button",onClick:()=>M(!1),children:"Ã"})]}),e.jsx("div",{className:"modal-content",children:e.jsx("div",{className:"source-type-grid",children:te.map(s=>e.jsxs("button",{className:"source-type-button",onClick:()=>Q(s.type),children:[e.jsx("span",{className:"icon",children:s.icon}),e.jsx("span",{className:"name",children:s.name})]},s.type))})})]})}),W&&e.jsx("div",{className:"modal-overlay",children:e.jsxs("div",{className:"modal",children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h3",{children:"Add Destination"}),e.jsx("button",{className:"close-button",onClick:()=>z(!1),children:"Ã"})]}),e.jsx("div",{className:"modal-content",children:e.jsx("div",{className:"platform-grid",children:ae.map(s=>e.jsxs("button",{className:"platform-button",onClick:()=>O(s.platform),children:[e.jsx("span",{className:"icon",children:s.icon}),e.jsx("span",{className:"name",children:s.name})]},s.platform))})})]})})]})};exports.NiceLiveStreaming=he;exports.NiceScreenRecorder=ue;exports.NiceVideoEditor=ce;
|
package/dist/index.mjs
CHANGED
|
@@ -28,7 +28,7 @@ const ue = {
|
|
|
28
28
|
],
|
|
29
29
|
assets: [],
|
|
30
30
|
settings: {
|
|
31
|
-
backgroundColor: "#000000",
|
|
31
|
+
backgroundColor: "var(--nice-text, #000000)",
|
|
32
32
|
audio: { sampleRate: 48e3, channels: 2, bitrate: 320 },
|
|
33
33
|
video: { codec: "h264", bitrate: 8e3, profile: "high" }
|
|
34
34
|
}
|
|
@@ -49,7 +49,7 @@ const ue = {
|
|
|
49
49
|
{ type: "slide", name: "Slide" },
|
|
50
50
|
{ type: "zoom", name: "Zoom" },
|
|
51
51
|
{ type: "push", name: "Push" }
|
|
52
|
-
],
|
|
52
|
+
], be = ({
|
|
53
53
|
project: M,
|
|
54
54
|
onProjectChange: S,
|
|
55
55
|
onExport: D,
|
|
@@ -58,7 +58,7 @@ const ue = {
|
|
|
58
58
|
}) => {
|
|
59
59
|
const [c, J] = p(M || ue), [n, Q] = p(
|
|
60
60
|
"timeline"
|
|
61
|
-
), [
|
|
61
|
+
), [g, K] = p(null), [m, C] = p(null), [b, P] = p(0), [k, L] = p(!1), [x, U] = p(1), [q, V] = p(!0), [y, A] = p(null), X = T(null), ne = T(null), z = T(null);
|
|
62
62
|
re(() => {
|
|
63
63
|
M && J(M);
|
|
64
64
|
}, [M]), re(() => () => {
|
|
@@ -96,7 +96,7 @@ const ue = {
|
|
|
96
96
|
};
|
|
97
97
|
f({ tracks: [...c.tracks, r] });
|
|
98
98
|
}, W = (s) => {
|
|
99
|
-
f({ tracks: c.tracks.filter((r) => r.id !== s) }),
|
|
99
|
+
f({ tracks: c.tracks.filter((r) => r.id !== s) }), g === s && K(null);
|
|
100
100
|
}, G = (s) => {
|
|
101
101
|
f({
|
|
102
102
|
tracks: c.tracks.map((r) => r.id === s ? { ...r, muted: !r.muted } : r)
|
|
@@ -180,7 +180,7 @@ const ue = {
|
|
|
180
180
|
case "sepia":
|
|
181
181
|
return { amount: 100 };
|
|
182
182
|
case "chromaKey":
|
|
183
|
-
return { color: "#00ff00", threshold: 40 };
|
|
183
|
+
return { color: "var(--nice-success, #00ff00)", threshold: 40 };
|
|
184
184
|
case "crop":
|
|
185
185
|
return { top: 0, right: 0, bottom: 0, left: 0 };
|
|
186
186
|
case "zoom":
|
|
@@ -325,10 +325,10 @@ const ue = {
|
|
|
325
325
|
),
|
|
326
326
|
/* @__PURE__ */ a("div", { className: "playback-controls", children: [
|
|
327
327
|
/* @__PURE__ */ e("button", { onClick: () => Y(0), children: "âŽī¸" }),
|
|
328
|
-
/* @__PURE__ */ e("button", { onClick: () => Y(
|
|
328
|
+
/* @__PURE__ */ e("button", { onClick: () => Y(b - 1 / c.frameRate), children: "âĒ" }),
|
|
329
329
|
/* @__PURE__ */ e("button", { onClick: ie, className: "play-button", children: k ? "â¸ī¸" : "âļī¸" }),
|
|
330
|
-
/* @__PURE__ */ e("button", { onClick: () => Y(
|
|
331
|
-
/* @__PURE__ */ e("span", { className: "time-display", children: Z(
|
|
330
|
+
/* @__PURE__ */ e("button", { onClick: () => Y(b + 1 / c.frameRate), children: "âŠ" }),
|
|
331
|
+
/* @__PURE__ */ e("span", { className: "time-display", children: Z(b) })
|
|
332
332
|
] })
|
|
333
333
|
] }),
|
|
334
334
|
m && n !== "export" && /* @__PURE__ */ e("div", { className: "item-inspector", children: (() => {
|
|
@@ -446,11 +446,11 @@ const ue = {
|
|
|
446
446
|
] }),
|
|
447
447
|
/* @__PURE__ */ a("div", { className: "timeline-container", ref: X, children: [
|
|
448
448
|
/* @__PURE__ */ e("div", { className: "timeline-ruler", children: Array.from({ length: Math.ceil(30 / x) }).map((s, r) => /* @__PURE__ */ e("div", { className: "ruler-mark", style: { left: `${r * 50 * x}px` }, children: Z(r) }, r)) }),
|
|
449
|
-
/* @__PURE__ */ e("div", { className: "timeline-playhead", style: { left: `${
|
|
449
|
+
/* @__PURE__ */ e("div", { className: "timeline-playhead", style: { left: `${b * 50 * x}px` } }),
|
|
450
450
|
/* @__PURE__ */ e("div", { className: "timeline-tracks", children: c.tracks.map((s) => /* @__PURE__ */ a(
|
|
451
451
|
"div",
|
|
452
452
|
{
|
|
453
|
-
className: `timeline-track ${
|
|
453
|
+
className: `timeline-track ${g === s.id ? "timeline-track--selected" : ""} ${s.locked ? "timeline-track--locked" : ""}`,
|
|
454
454
|
onClick: () => K(s.id),
|
|
455
455
|
onDrop: (r) => {
|
|
456
456
|
r.preventDefault();
|
|
@@ -704,9 +704,9 @@ const ue = {
|
|
|
704
704
|
const [n, Q] = p({
|
|
705
705
|
...pe,
|
|
706
706
|
...M
|
|
707
|
-
}), [
|
|
707
|
+
}), [g, K] = p(null), [m, C] = p("idle"), [b, P] = p([]), [k, L] = p(null), [x, U] = p(null), [q, V] = p(!1), [y, A] = p(!1), [X, ne] = p(
|
|
708
708
|
"pen"
|
|
709
|
-
), [z, f] = p("#ff0000"), _ = T(null), h = T([]), W = T(null), G = T(null), O = T(null), ee = T(0);
|
|
709
|
+
), [z, f] = p("var(--nice-danger, #ff0000)"), _ = T(null), h = T([]), W = T(null), G = T(null), O = T(null), ee = T(0);
|
|
710
710
|
re(() => () => {
|
|
711
711
|
k && k.getTracks().forEach((l) => l.stop()), O.current && clearInterval(O.current);
|
|
712
712
|
}, [k]);
|
|
@@ -760,7 +760,7 @@ const ue = {
|
|
|
760
760
|
B.data.size > 0 && h.current.push(B.data);
|
|
761
761
|
}, N.onstop = () => {
|
|
762
762
|
const B = new Blob(h.current, { type: v });
|
|
763
|
-
|
|
763
|
+
g && (D == null || D({ ...g, status: "stopped" }, B));
|
|
764
764
|
}, _.current = N, N.start(1e3), ee.current = Date.now();
|
|
765
765
|
const $ = {
|
|
766
766
|
id: crypto.randomUUID(),
|
|
@@ -795,13 +795,13 @@ const ue = {
|
|
|
795
795
|
return;
|
|
796
796
|
const v = {
|
|
797
797
|
id: crypto.randomUUID(),
|
|
798
|
-
time: (
|
|
799
|
-
label: l || `Marker ${
|
|
798
|
+
time: (g == null ? void 0 : g.duration) || 0,
|
|
799
|
+
label: l || `Marker ${b.length + 1}`,
|
|
800
800
|
color: t()
|
|
801
801
|
};
|
|
802
802
|
P((N) => [...N, v]);
|
|
803
803
|
},
|
|
804
|
-
[m,
|
|
804
|
+
[m, g == null ? void 0 : g.duration, b.length]
|
|
805
805
|
), s = (l) => {
|
|
806
806
|
P((v) => v.filter((N) => N.id !== l));
|
|
807
807
|
}, r = (l) => {
|
|
@@ -825,7 +825,7 @@ const ue = {
|
|
|
825
825
|
return 8e6;
|
|
826
826
|
}
|
|
827
827
|
}, t = () => {
|
|
828
|
-
const l = ["#ff4444", "#44ff44", "#4444ff", "#ffff44", "#ff44ff", "#44ffff"];
|
|
828
|
+
const l = ["var(--nice-danger, #ff4444)", "#44ff44", "#4444ff", "#ffff44", "#ff44ff", "#44ffff"];
|
|
829
829
|
return l[Math.floor(Math.random() * l.length)];
|
|
830
830
|
}, i = (l) => {
|
|
831
831
|
const v = Math.floor(l / 3600), N = Math.floor(l % 3600 / 60), $ = Math.floor(l % 60), B = Math.floor(l % 1 * 100);
|
|
@@ -926,17 +926,17 @@ const ue = {
|
|
|
926
926
|
/* @__PURE__ */ a("span", { className: "status-item", children: [
|
|
927
927
|
/* @__PURE__ */ e("strong", { children: "Duration:" }),
|
|
928
928
|
" ",
|
|
929
|
-
i((
|
|
929
|
+
i((g == null ? void 0 : g.duration) || 0)
|
|
930
930
|
] }),
|
|
931
931
|
/* @__PURE__ */ a("span", { className: "status-item", children: [
|
|
932
932
|
/* @__PURE__ */ e("strong", { children: "Size:" }),
|
|
933
933
|
" ",
|
|
934
|
-
o((
|
|
934
|
+
o((g == null ? void 0 : g.size) || 0)
|
|
935
935
|
] }),
|
|
936
936
|
/* @__PURE__ */ a("span", { className: "status-item", children: [
|
|
937
937
|
/* @__PURE__ */ e("strong", { children: "Markers:" }),
|
|
938
938
|
" ",
|
|
939
|
-
|
|
939
|
+
b.length
|
|
940
940
|
] })
|
|
941
941
|
] }),
|
|
942
942
|
/* @__PURE__ */ a("div", { className: "status__quality", children: [
|
|
@@ -967,7 +967,7 @@ const ue = {
|
|
|
967
967
|
},
|
|
968
968
|
l
|
|
969
969
|
)) }),
|
|
970
|
-
/* @__PURE__ */ e("div", { className: "color-group", children: ["#ff0000", "#00ff00", "#0000ff", "#ffff00", "#
|
|
970
|
+
/* @__PURE__ */ e("div", { className: "color-group", children: ["var(--nice-danger, #ff0000)", "var(--nice-success, #00ff00)", "var(--nice-primary, #0000ff)", "var(--nice-warning, #ffff00)", "var(--nice-bg, #fff)", "var(--nice-text, #000000)"].map((l) => /* @__PURE__ */ e(
|
|
971
971
|
"button",
|
|
972
972
|
{
|
|
973
973
|
className: `color-button ${z === l ? "color-button--active" : ""}`,
|
|
@@ -977,9 +977,9 @@ const ue = {
|
|
|
977
977
|
l
|
|
978
978
|
)) })
|
|
979
979
|
] }),
|
|
980
|
-
|
|
980
|
+
b.length > 0 && /* @__PURE__ */ a("div", { className: "recorder__markers", children: [
|
|
981
981
|
/* @__PURE__ */ e("h4", { children: "Markers" }),
|
|
982
|
-
/* @__PURE__ */ e("div", { className: "markers-list", children:
|
|
982
|
+
/* @__PURE__ */ e("div", { className: "markers-list", children: b.map((l) => /* @__PURE__ */ a(
|
|
983
983
|
"div",
|
|
984
984
|
{
|
|
985
985
|
className: "marker-item",
|
|
@@ -1201,7 +1201,7 @@ const ue = {
|
|
|
1201
1201
|
sources: [],
|
|
1202
1202
|
layout: {
|
|
1203
1203
|
name: "Default",
|
|
1204
|
-
canvas: { width: 1920, height: 1080, backgroundColor: "#000000" },
|
|
1204
|
+
canvas: { width: 1920, height: 1080, backgroundColor: "var(--nice-text, #000000)" },
|
|
1205
1205
|
layers: []
|
|
1206
1206
|
},
|
|
1207
1207
|
settings: {
|
|
@@ -1254,9 +1254,9 @@ const ue = {
|
|
|
1254
1254
|
onError: c,
|
|
1255
1255
|
className: J = ""
|
|
1256
1256
|
}) => {
|
|
1257
|
-
const [n, Q] = p(M || ve), [
|
|
1257
|
+
const [n, Q] = p(M || ve), [g, K] = p(
|
|
1258
1258
|
"sources"
|
|
1259
|
-
), [m, C] = p(!1), [
|
|
1259
|
+
), [m, C] = p(!1), [b, P] = p({
|
|
1260
1260
|
duration: 0,
|
|
1261
1261
|
viewers: 0,
|
|
1262
1262
|
peakViewers: 0,
|
|
@@ -1387,11 +1387,11 @@ const ue = {
|
|
|
1387
1387
|
}), C(!0), _.current = Date.now(), D == null || D(), f.current = setInterval(() => {
|
|
1388
1388
|
const t = {
|
|
1389
1389
|
duration: (Date.now() - _.current) / 1e3,
|
|
1390
|
-
viewers: Math.floor(Math.random() * 100) +
|
|
1391
|
-
peakViewers: Math.max(
|
|
1390
|
+
viewers: Math.floor(Math.random() * 100) + b.viewers,
|
|
1391
|
+
peakViewers: Math.max(b.peakViewers, b.viewers),
|
|
1392
1392
|
bitrate: n.settings.video.bitrate + Math.floor(Math.random() * 500 - 250),
|
|
1393
1393
|
fps: n.settings.video.frameRate - Math.random() * 2,
|
|
1394
|
-
droppedFrames:
|
|
1394
|
+
droppedFrames: b.droppedFrames + (Math.random() > 0.95 ? 1 : 0),
|
|
1395
1395
|
cpuUsage: 15 + Math.random() * 30,
|
|
1396
1396
|
memoryUsage: 40 + Math.random() * 20
|
|
1397
1397
|
};
|
|
@@ -1415,13 +1415,13 @@ const ue = {
|
|
|
1415
1415
|
}, u = (t) => {
|
|
1416
1416
|
switch (t) {
|
|
1417
1417
|
case "live":
|
|
1418
|
-
return "#00ff00";
|
|
1418
|
+
return "var(--nice-success, #00ff00)";
|
|
1419
1419
|
case "connecting":
|
|
1420
|
-
return "#ffff00";
|
|
1420
|
+
return "var(--nice-warning, #ffff00)";
|
|
1421
1421
|
case "error":
|
|
1422
|
-
return "#ff0000";
|
|
1422
|
+
return "var(--nice-danger, #ff0000)";
|
|
1423
1423
|
default:
|
|
1424
|
-
return "#888888";
|
|
1424
|
+
return "var(--nice-text-secondary, #888888)";
|
|
1425
1425
|
}
|
|
1426
1426
|
};
|
|
1427
1427
|
return /* @__PURE__ */ a("div", { className: `nice-live-streaming ${J}`, children: [
|
|
@@ -1444,20 +1444,20 @@ const ue = {
|
|
|
1444
1444
|
/* @__PURE__ */ e("div", { className: "header__stats", children: m && /* @__PURE__ */ a(ae, { children: [
|
|
1445
1445
|
/* @__PURE__ */ a("span", { className: "stat-item", children: [
|
|
1446
1446
|
"âąī¸ ",
|
|
1447
|
-
r(
|
|
1447
|
+
r(b.duration)
|
|
1448
1448
|
] }),
|
|
1449
1449
|
/* @__PURE__ */ a("span", { className: "stat-item", children: [
|
|
1450
1450
|
"đĨ ",
|
|
1451
|
-
|
|
1451
|
+
b.viewers
|
|
1452
1452
|
] }),
|
|
1453
1453
|
/* @__PURE__ */ a("span", { className: "stat-item", children: [
|
|
1454
1454
|
"đ ",
|
|
1455
|
-
Math.round(
|
|
1455
|
+
Math.round(b.bitrate),
|
|
1456
1456
|
" kbps"
|
|
1457
1457
|
] }),
|
|
1458
1458
|
/* @__PURE__ */ a("span", { className: "stat-item", children: [
|
|
1459
1459
|
"đŦ ",
|
|
1460
|
-
|
|
1460
|
+
b.fps.toFixed(1),
|
|
1461
1461
|
" fps"
|
|
1462
1462
|
] })
|
|
1463
1463
|
] }) }),
|
|
@@ -1525,14 +1525,14 @@ const ue = {
|
|
|
1525
1525
|
/* @__PURE__ */ e("div", { className: "panel-tabs", children: ["sources", "audio", "destinations", "settings"].map((t) => /* @__PURE__ */ e(
|
|
1526
1526
|
"button",
|
|
1527
1527
|
{
|
|
1528
|
-
className: `panel-tab ${
|
|
1528
|
+
className: `panel-tab ${g === t ? "panel-tab--active" : ""}`,
|
|
1529
1529
|
onClick: () => K(t),
|
|
1530
1530
|
children: t.charAt(0).toUpperCase() + t.slice(1)
|
|
1531
1531
|
},
|
|
1532
1532
|
t
|
|
1533
1533
|
)) }),
|
|
1534
1534
|
/* @__PURE__ */ a("div", { className: "panel-content", children: [
|
|
1535
|
-
|
|
1535
|
+
g === "sources" && /* @__PURE__ */ a("div", { className: "sources-panel", children: [
|
|
1536
1536
|
/* @__PURE__ */ a("div", { className: "panel-header", children: [
|
|
1537
1537
|
/* @__PURE__ */ e("h3", { children: "Sources" }),
|
|
1538
1538
|
/* @__PURE__ */ e(
|
|
@@ -1678,7 +1678,7 @@ const ue = {
|
|
|
1678
1678
|
})()
|
|
1679
1679
|
] })
|
|
1680
1680
|
] }),
|
|
1681
|
-
|
|
1681
|
+
g === "audio" && /* @__PURE__ */ a("div", { className: "audio-panel", children: [
|
|
1682
1682
|
/* @__PURE__ */ a("div", { className: "panel-header", children: [
|
|
1683
1683
|
/* @__PURE__ */ e("h3", { children: "Audio Mixer" }),
|
|
1684
1684
|
/* @__PURE__ */ e(
|
|
@@ -1743,7 +1743,7 @@ const ue = {
|
|
|
1743
1743
|
).length === 0 && /* @__PURE__ */ e("p", { className: "empty-message", children: "No audio sources added" })
|
|
1744
1744
|
] })
|
|
1745
1745
|
] }),
|
|
1746
|
-
|
|
1746
|
+
g === "destinations" && /* @__PURE__ */ a("div", { className: "destinations-panel", children: [
|
|
1747
1747
|
/* @__PURE__ */ a("div", { className: "panel-header", children: [
|
|
1748
1748
|
/* @__PURE__ */ e("h3", { children: "Destinations" }),
|
|
1749
1749
|
/* @__PURE__ */ e(
|
|
@@ -1825,7 +1825,7 @@ const ue = {
|
|
|
1825
1825
|
n.destinations.length === 0 && /* @__PURE__ */ e("p", { className: "empty-message", children: "No destinations configured" })
|
|
1826
1826
|
] })
|
|
1827
1827
|
] }),
|
|
1828
|
-
|
|
1828
|
+
g === "settings" && /* @__PURE__ */ a("div", { className: "settings-panel", children: [
|
|
1829
1829
|
/* @__PURE__ */ a("div", { className: "setting-section", children: [
|
|
1830
1830
|
/* @__PURE__ */ e("h4", { children: "Video" }),
|
|
1831
1831
|
/* @__PURE__ */ a("label", { children: [
|
|
@@ -1981,24 +1981,24 @@ const ue = {
|
|
|
1981
1981
|
/* @__PURE__ */ a("span", { className: "stat", children: [
|
|
1982
1982
|
/* @__PURE__ */ e("label", { children: "CPU" }),
|
|
1983
1983
|
/* @__PURE__ */ a("span", { className: "value", children: [
|
|
1984
|
-
|
|
1984
|
+
b.cpuUsage.toFixed(1),
|
|
1985
1985
|
"%"
|
|
1986
1986
|
] })
|
|
1987
1987
|
] }),
|
|
1988
1988
|
/* @__PURE__ */ a("span", { className: "stat", children: [
|
|
1989
1989
|
/* @__PURE__ */ e("label", { children: "Memory" }),
|
|
1990
1990
|
/* @__PURE__ */ a("span", { className: "value", children: [
|
|
1991
|
-
|
|
1991
|
+
b.memoryUsage.toFixed(1),
|
|
1992
1992
|
"%"
|
|
1993
1993
|
] })
|
|
1994
1994
|
] }),
|
|
1995
1995
|
/* @__PURE__ */ a("span", { className: "stat", children: [
|
|
1996
1996
|
/* @__PURE__ */ e("label", { children: "Dropped" }),
|
|
1997
|
-
/* @__PURE__ */ e("span", { className: "value", children:
|
|
1997
|
+
/* @__PURE__ */ e("span", { className: "value", children: b.droppedFrames })
|
|
1998
1998
|
] }),
|
|
1999
1999
|
/* @__PURE__ */ a("span", { className: "stat", children: [
|
|
2000
2000
|
/* @__PURE__ */ e("label", { children: "Peak Viewers" }),
|
|
2001
|
-
/* @__PURE__ */ e("span", { className: "value", children:
|
|
2001
|
+
/* @__PURE__ */ e("span", { className: "value", children: b.peakViewers })
|
|
2002
2002
|
] })
|
|
2003
2003
|
] }) }),
|
|
2004
2004
|
x && /* @__PURE__ */ e("div", { className: "modal-overlay", children: /* @__PURE__ */ a("div", { className: "modal", children: [
|
|
@@ -2042,5 +2042,5 @@ const ue = {
|
|
|
2042
2042
|
export {
|
|
2043
2043
|
ye as NiceLiveStreaming,
|
|
2044
2044
|
Ne as NiceScreenRecorder,
|
|
2045
|
-
|
|
2045
|
+
be as NiceVideoEditor
|
|
2046
2046
|
};
|