@nice2dev/ui-video 1.0.21 → 1.0.22

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 CHANGED
@@ -1 +1,27 @@
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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("react"),ve=(l,m)=>m,xe=d.createContext(ve);function ge(){return{t:d.useContext(xe)}}d.createContext({dir:"ltr",isRTL:!1,flip:l=>l,value:l=>l.ltr});d.createContext(null);d.createContext(null);const je={radius:"md",shadow:"md",fill:"solid",buttonStyle:"flat",inputStyle:"bordered",cardStyle:"elevated",badgeStyle:"solid",tabStyle:"underline",toggleStyle:"default",tooltipStyle:"dark",modalStyle:"default",tableStyle:"default",menuStyle:"default",animation:"normal",density:"normal"};d.createContext({displayStyle:"default",variantConfig:je,setDisplayStyle:()=>{}});d.createContext({});d.createContext({direction:"ltr",isRTL:!1,flip:l=>l,flipStyle:(l,m)=>({[l]:m})});d.createContext({permissions:{},getAccessMode:()=>"full"});d.createContext(null);const we=process.env.NODE_ENV==="development";let de={enabled:we,slowRenderThreshold:16};const le=[],oe=new Map,fe=new Map;function Ne(){le.length=0,oe.clear(),fe.clear()}function ke(l){const m=de.slowRenderThreshold;return le.filter(f=>f.actualDuration>m)}function Y(l){return l<1?`${(l*1e3).toFixed(0)}Îŧs`:l<1e3?`${l.toFixed(2)}ms`:`${(l/1e3).toFixed(2)}s`}function Ce(){const l=Array.from(oe.values()),m=ke(),f=l.reduce((H,u)=>H+u.renderCount,0),N=l.length>0?l.reduce((H,u)=>H+u.avgRenderTime,0)/l.length:0,S=Array.from(fe.values());return{stats:l,slowRenders:m,totalRenders:f,avgRenderTime:N,marks:S}}function Se(){const l=Ce();console.group("%c[Nice2Dev Performance Report]","color: var(--nice-info, #6366f1); font-weight: bold; font-size: 14px"),console.log(`Total renders: ${l.totalRenders}`),console.log(`Average render time: ${Y(l.avgRenderTime)}`),console.log(`Slow renders: ${l.slowRenders.length}`),console.group("Component Stats"),console.table(l.stats.sort((m,f)=>f.totalRenderTime-m.totalRenderTime).map(m=>({Name:m.componentName,Renders:m.renderCount,"Avg Time":Y(m.avgRenderTime),"Max Time":Y(m.maxRenderTime),"Total Time":Y(m.totalRenderTime),"Slow Renders":m.slowRenderCount}))),console.groupEnd(),l.slowRenders.length>0&&(console.group("Slow Renders (last 10)"),console.table(l.slowRenders.slice(-10).map(m=>({Component:m.componentName,Phase:m.phase,Duration:Y(m.actualDuration),Time:new Date(m.timestamp).toLocaleTimeString()}))),console.groupEnd()),l.marks.length>0&&(console.group("Custom Marks"),console.table(l.marks.filter(m=>m.duration).map(m=>({Name:m.name,Duration:Y(m.duration)}))),console.groupEnd()),console.groupEnd()}const He=d.memo(({position:l="bottom-right",defaultCollapsed:m=!0})=>{const[f,N]=d.useState(m),[S,H]=d.useState([]),[u,s]=d.useState({used:0,total:0});if(d.useEffect(()=>{const b=()=>{const y=Array.from(oe.values());H(y.sort((k,$)=>$.totalRenderTime-k.totalRenderTime).slice(0,10));const j=window.performance;j.memory&&s({used:j.memory.usedJSHeapSize/1024/1024,total:j.memory.totalJSHeapSize/1024/1024})};b();const _=setInterval(b,2e3);return()=>clearInterval(_)},[]),!de.enabled)return null;const I={position:"fixed",zIndex:99999,...l.includes("top")?{top:8}:{bottom:8},...l.includes("left")?{left:8}:{right:8}};return e.jsxs("div",{style:{...I,background:"var(--nice-overlay-85, rgba(0, 0, 0, 0.85))",color:"var(--bg-primary, #fff)",borderRadius:8,fontSize:11,fontFamily:"Monaco, Consolas, monospace",padding:f?"4px 8px":8,maxWidth:f?"auto":300,maxHeight:f?"auto":400,overflow:"auto"},children:[e.jsxs("div",{style:{cursor:"pointer",display:"flex",alignItems:"center",gap:8},onClick:()=>N(b=>!b),children:[e.jsx("span",{style:{color:"var(--color-success, #22c55e)"},children:"●"}),e.jsx("span",{children:"Profiler"}),u.used>0&&e.jsxs("span",{style:{color:u.used>100?"var(--color-warning, #f59e0b)":"var(--text-muted, #64748b)"},children:[u.used.toFixed(0),"MB"]}),e.jsx("span",{style:{marginLeft:"auto",opacity:.5},children:f?"â–ŧ":"▲"})]}),!f&&e.jsxs("div",{style:{marginTop:8},children:[e.jsx("div",{style:{borderBottom:"1px solid var(--border-color, #333)",paddingBottom:4,marginBottom:8},children:e.jsx("strong",{children:"Top Components"})}),S.map(b=>e.jsxs("div",{style:{marginBottom:4,display:"flex",gap:8},children:[e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis"},children:b.componentName}),e.jsx("span",{style:{color:b.avgRenderTime>16?"var(--color-warning, #f59e0b)":"var(--color-success, #22c55e)"},children:Y(b.avgRenderTime)}),e.jsxs("span",{style:{color:"var(--text-muted, #64748b)",minWidth:30,textAlign:"right"},children:["x",b.renderCount]})]},b.componentName)),e.jsxs("div",{style:{marginTop:8,display:"flex",gap:8},children:[e.jsx("button",{onClick:Se,style:{flex:1,padding:"4px 8px",background:"var(--bg-tertiary, #333)",border:"none",borderRadius:4,color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:10},children:"Print Report"}),e.jsx("button",{onClick:Ne,style:{flex:1,padding:"4px 8px",background:"var(--bg-tertiary, #333)",border:"none",borderRadius:4,color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:10},children:"Clear"})]})]})]})});He.displayName="ProfilerOverlay";process.env.NODE_ENV;d.createContext(null);const Re=d.createContext({enabled:!0,active:!1,run:()=>{}});function Te(){return d.useContext(Re)}function Ie(l,m){if(!l)return null;if(l===!0)return m&&m.length>0?m:null;if(Array.isArray(l))return l.length>0?l:null;const f=l.steps??m;return f&&f.length>0?f:null}function Me(l,m){return l.map(f=>({target:f.target,title:f.titleKey?m(f.titleKey,f.title??""):f.title??"",content:f.contentKey?m(f.contentKey,f.content??""):f.content??"",placement:f.placement,highlightPadding:f.highlightPadding,showArrow:f.showArrow,scrollIntoView:f.scrollIntoView,disableInteraction:f.disableInteraction}))}const De=({steps:l,autoStart:m,label:f,size:N="md",className:S,style:H,"data-testid":u})=>{const{enabled:s,run:I}=Te(),{t:b}=ge();if(!s||!l||l.length===0)return null;const _=f??b("tutorial.startAria","Start tutorial");return e.jsx("button",{type:"button",className:`nice-tutorial-button nice-tutorial-button--${N}`+(S?` ${S}`:""),style:H,"data-testid":u,"aria-label":_,title:_,onClick:()=>I(Me(l,b),{autoStart:m}),children:"?"})},ce="nice-tutorial-button-styles";if(typeof document<"u"&&!document.getElementById(ce)){const l=document.createElement("style");l.id=ce,l.textContent=`
2
+ .nice-tutorial-button {
3
+ display: inline-flex;
4
+ align-items: center;
5
+ justify-content: center;
6
+ border: 1px solid var(--nice-border, #cbd5e1);
7
+ background: var(--nice-bg, #fff);
8
+ color: var(--nice-text-secondary, #475569);
9
+ border-radius: var(--nice-radius-full, 9999px);
10
+ cursor: help;
11
+ font-weight: 700;
12
+ line-height: 1;
13
+ padding: 0;
14
+ transition: background var(--nice-transition, 200ms ease), color var(--nice-transition, 200ms ease), border-color var(--nice-transition, 200ms ease);
15
+ }
16
+ .nice-tutorial-button:hover {
17
+ background: var(--nice-primary, #2563eb);
18
+ border-color: var(--nice-primary, #2563eb);
19
+ color: var(--nice-text-inverse, #fff);
20
+ }
21
+ .nice-tutorial-button:focus-visible {
22
+ outline: none;
23
+ box-shadow: 0 0 0 2px var(--nice-bg, #fff), 0 0 0 4px var(--nice-primary, #2563eb);
24
+ }
25
+ .nice-tutorial-button--sm { width: 16px; height: 16px; font-size: 11px; }
26
+ .nice-tutorial-button--md { width: 20px; height: 20px; font-size: 12px; }
27
+ `,document.head.appendChild(l)}d.createContext(null);d.createContext(null);d.createContext(null);const me={space1:"4px",space2:"8px",space3:"12px",space4:"16px",space5:"20px",space6:"24px",space8:"32px"},ue={fontFamily:"'Inter', system-ui, -apple-system, sans-serif",fontSizeXs:"0.75rem",fontSizeSm:"0.8125rem",fontSizeMd:"0.875rem",fontSizeLg:"1rem",fontSizeXl:"1.125rem",fontWeightNormal:400,fontWeightMedium:500,fontWeightSemibold:600,fontWeightBold:700,lineHeight:1.5},pe={fast:"120ms ease",normal:"200ms ease",slow:"300ms ease"},ye=l=>({color:l,radiusSm:"4px",radiusMd:"6px",radiusLg:"8px",radiusXl:"12px",radiusFull:"9999px"}),_e={sm:"0 1px 2px rgba(0,0,0,0.05)",md:"0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1)",lg:"0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1)",xl:"0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1)"},$e={sm:"0 1px 2px rgba(0,0,0,0.3)",md:"0 4px 6px -1px rgba(0,0,0,0.4)",lg:"0 10px 15px -3px rgba(0,0,0,0.4)",xl:"0 20px 25px -5px rgba(0,0,0,0.4)"};function c(l,m,f,N,S){return{name:l,darkMode:"light",colors:{...m,surface:m.surface??f.primary,surfaceHover:m.surfaceHover??f.secondary},backgrounds:{...f,elevated:f.elevated??f.primary,inset:f.inset??f.tertiary,canvas:f.canvas??f.primary},text:{...N,inverse:N.inverse??"#ffffff"},borders:ye(S),shadows:_e,spacing:me,typography:ue,transitions:pe}}function w(l,m,f,N,S){return{name:l,darkMode:"dark",colors:{...m,surface:m.surface??f.secondary,surfaceHover:m.surfaceHover??f.tertiary},backgrounds:{...f,elevated:f.elevated??f.secondary,inset:f.inset??f.primary,canvas:f.canvas??f.primary},text:{...N,inverse:N.inverse??"#0f172a"},borders:ye(S),shadows:$e,spacing:me,typography:ue,transitions:pe}}c("Slate",{primary:"#64748b",primaryHover:"#475569",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#06b6d4"},{primary:"#f8fafc",secondary:"#f1f5f9",tertiary:"#e2e8f0",hover:"#e2e8f0"},{primary:"#1e293b",secondary:"#475569",muted:"#94a3b8"},"#cbd5e1");c("Zinc",{primary:"#71717a",primaryHover:"#52525b",success:"#22c55e",warning:"#eab308",error:"#ef4444",info:"#06b6d4"},{primary:"#fafafa",secondary:"#f4f4f5",tertiary:"#e4e4e7",hover:"#e4e4e7"},{primary:"#18181b",secondary:"#3f3f46",muted:"#a1a1aa"},"#d4d4d8");c("Stone",{primary:"#78716c",primaryHover:"#57534e",success:"#16a34a",warning:"#ca8a04",error:"#dc2626",info:"#0891b2"},{primary:"#fafaf9",secondary:"#f5f5f4",tertiary:"#e7e5e4",hover:"#e7e5e4"},{primary:"#1c1917",secondary:"#44403c",muted:"#a8a29e"},"#d6d3d1");c("Cool Gray",{primary:"#6b7280",primaryHover:"#4b5563",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6"},{primary:"#f9fafb",secondary:"#f3f4f6",tertiary:"#e5e7eb",hover:"#e5e7eb"},{primary:"#111827",secondary:"#374151",muted:"#9ca3af"},"#d1d5db");c("Warm Gray",{primary:"#7c7568",primaryHover:"#5c564c",success:"#4d7c0f",warning:"#a16207",error:"#b91c1c",info:"#0e7490"},{primary:"#faf9f7",secondary:"#f5f4f0",tertiary:"#e8e6e1",hover:"#e8e6e1"},{primary:"#1f1d19",secondary:"#4a463d",muted:"#a09888"},"#d4d0c8");c("Silver",{primary:"#94a3b8",primaryHover:"#64748b",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#38bdf8"},{primary:"#f8fafc",secondary:"#f1f5f9",tertiary:"#e2e8f0",hover:"#e2e8f0"},{primary:"#334155",secondary:"#64748b",muted:"#94a3b8"},"#cbd5e1");c("Charcoal",{primary:"#374151",primaryHover:"#1f2937",success:"#059669",warning:"#d97706",error:"#dc2626",info:"#0284c7"},{primary:"#f9fafb",secondary:"#f3f4f6",tertiary:"#e5e7eb",hover:"#e5e7eb"},{primary:"#111827",secondary:"#374151",muted:"#6b7280"},"#d1d5db");c("Ivory",{primary:"#92876d",primaryHover:"#7a6f55",success:"#4d7c0f",warning:"#a16207",error:"#b91c1c",info:"#0e7490"},{primary:"#fffef7",secondary:"#faf6eb",tertiary:"#f0ead6",hover:"#f0ead6"},{primary:"#2b2517",secondary:"#5c5340",muted:"#9c9280"},"#ddd8c4");c("Rose",{primary:"#e11d48",primaryHover:"#be123c",success:"#16a34a",warning:"#ea580c",error:"#dc2626",info:"#0891b2"},{primary:"#fff1f2",secondary:"#ffe4e6",tertiary:"#fecdd3",hover:"#ffe4e6"},{primary:"#4c0519",secondary:"#881337",muted:"#f43f5e"},"#fda4af");c("Emerald",{primary:"#059669",primaryHover:"#047857",success:"#16a34a",warning:"#d97706",error:"#dc2626",info:"#0891b2"},{primary:"#ecfdf5",secondary:"#d1fae5",tertiary:"#a7f3d0",hover:"#d1fae5"},{primary:"#064e3b",secondary:"#065f46",muted:"#34d399"},"#6ee7b7");c("Amber",{primary:"#d97706",primaryHover:"#b45309",success:"#16a34a",warning:"#ca8a04",error:"#dc2626",info:"#0284c7"},{primary:"#fffbeb",secondary:"#fef3c7",tertiary:"#fde68a",hover:"#fef3c7"},{primary:"#451a03",secondary:"#78350f",muted:"#f59e0b"},"#fcd34d");c("Violet",{primary:"#7c3aed",primaryHover:"#6d28d9",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#06b6d4"},{primary:"#f5f3ff",secondary:"#ede9fe",tertiary:"#ddd6fe",hover:"#ede9fe"},{primary:"#2e1065",secondary:"#4c1d95",muted:"#a78bfa"},"#c4b5fd");c("Teal",{primary:"#0d9488",primaryHover:"#0f766e",success:"#16a34a",warning:"#d97706",error:"#dc2626",info:"#0284c7"},{primary:"#f0fdfa",secondary:"#ccfbf1",tertiary:"#99f6e4",hover:"#ccfbf1"},{primary:"#134e4a",secondary:"#115e59",muted:"#2dd4bf"},"#5eead4");c("Indigo",{primary:"#4f46e5",primaryHover:"#4338ca",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#06b6d4"},{primary:"#eef2ff",secondary:"#e0e7ff",tertiary:"#c7d2fe",hover:"#e0e7ff"},{primary:"#1e1b4b",secondary:"#312e81",muted:"#818cf8"},"#a5b4fc");c("Cyan",{primary:"#0891b2",primaryHover:"#0e7490",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#0284c7"},{primary:"#ecfeff",secondary:"#cffafe",tertiary:"#a5f3fc",hover:"#cffafe"},{primary:"#164e63",secondary:"#155e75",muted:"#22d3ee"},"#67e8f9");c("Lime",{primary:"#65a30d",primaryHover:"#4d7c0f",success:"#16a34a",warning:"#ca8a04",error:"#dc2626",info:"#0891b2"},{primary:"#f7fee7",secondary:"#ecfccb",tertiary:"#d9f99d",hover:"#ecfccb"},{primary:"#1a2e05",secondary:"#365314",muted:"#84cc16"},"#bef264");c("Pink",{primary:"#db2777",primaryHover:"#be185d",success:"#10b981",warning:"#f59e0b",error:"#dc2626",info:"#06b6d4"},{primary:"#fdf2f8",secondary:"#fce7f3",tertiary:"#fbcfe8",hover:"#fce7f3"},{primary:"#500724",secondary:"#831843",muted:"#f472b6"},"#f9a8d4");c("Orange",{primary:"#ea580c",primaryHover:"#c2410c",success:"#16a34a",warning:"#ca8a04",error:"#dc2626",info:"#0891b2"},{primary:"#fff7ed",secondary:"#ffedd5",tertiary:"#fed7aa",hover:"#ffedd5"},{primary:"#431407",secondary:"#7c2d12",muted:"#fb923c"},"#fdba74");c("Fuchsia",{primary:"#c026d3",primaryHover:"#a21caf",success:"#10b981",warning:"#eab308",error:"#ef4444",info:"#06b6d4"},{primary:"#fdf4ff",secondary:"#fae8ff",tertiary:"#f5d0fe",hover:"#fae8ff"},{primary:"#4a044e",secondary:"#701a75",muted:"#d946ef"},"#e879f9");c("Sky",{primary:"#0284c7",primaryHover:"#0369a1",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#06b6d4"},{primary:"#f0f9ff",secondary:"#e0f2fe",tertiary:"#bae6fd",hover:"#e0f2fe"},{primary:"#0c4a6e",secondary:"#075985",muted:"#38bdf8"},"#7dd3fc");c("Ruby",{primary:"#be123c",primaryHover:"#9f1239",success:"#059669",warning:"#d97706",error:"#dc2626",info:"#0284c7"},{primary:"#fff1f2",secondary:"#ffe4e6",tertiary:"#fecdd3",hover:"#ffe4e6"},{primary:"#4c0519",secondary:"#881337",muted:"#fb7185"},"#fda4af");c("Coral",{primary:"#f97316",primaryHover:"#ea580c",success:"#10b981",warning:"#eab308",error:"#ef4444",info:"#06b6d4"},{primary:"#fff7ed",secondary:"#ffedd5",tertiary:"#fed7aa",hover:"#ffedd5"},{primary:"#431407",secondary:"#9a3412",muted:"#fb923c"},"#fdba74");w("Midnight",{primary:"#818cf8",primaryHover:"#6366f1",success:"#34d399",warning:"#fbbf24",error:"#f87171",info:"#22d3ee"},{primary:"#020617",secondary:"#0f172a",tertiary:"#1e293b",hover:"#1e293b"},{primary:"#f1f5f9",secondary:"#94a3b8",muted:"#475569"},"#1e293b");w("Obsidian",{primary:"#a78bfa",primaryHover:"#8b5cf6",success:"#4ade80",warning:"#facc15",error:"#fb7185",info:"#38bdf8"},{primary:"#09090b",secondary:"#18181b",tertiary:"#27272a",hover:"#27272a"},{primary:"#fafafa",secondary:"#a1a1aa",muted:"#52525b"},"#3f3f46");w("Eclipse",{primary:"#c084fc",primaryHover:"#a855f7",success:"#34d399",warning:"#fbbf24",error:"#f87171",info:"#67e8f9"},{primary:"#0c0a1d",secondary:"#1a1533",tertiary:"#2a2248",hover:"#2a2248"},{primary:"#f5f3ff",secondary:"#a78bfa",muted:"#6d5eac"},"#3b3266");w("Onyx",{primary:"#60a5fa",primaryHover:"#3b82f6",success:"#4ade80",warning:"#fbbf24",error:"#f87171",info:"#22d3ee"},{primary:"#000000",secondary:"#0a0a0a",tertiary:"#171717",hover:"#171717"},{primary:"#ffffff",secondary:"#a3a3a3",muted:"#525252"},"#262626");w("Carbon",{primary:"#38bdf8",primaryHover:"#0ea5e9",success:"#4ade80",warning:"#facc15",error:"#f87171",info:"#67e8f9"},{primary:"#161616",secondary:"#262626",tertiary:"#393939",hover:"#393939"},{primary:"#f4f4f4",secondary:"#c6c6c6",muted:"#6f6f6f"},"#525252");w("Cosmos",{primary:"#6366f1",primaryHover:"#4f46e5",success:"#34d399",warning:"#fbbf24",error:"#f87171",info:"#22d3ee"},{primary:"#030712",secondary:"#111827",tertiary:"#1f2937",hover:"#1f2937"},{primary:"#e5e7eb",secondary:"#9ca3af",muted:"#4b5563"},"#374151");w("Nebula",{primary:"#e879f9",primaryHover:"#d946ef",success:"#4ade80",warning:"#fbbf24",error:"#fb7185",info:"#67e8f9"},{primary:"#0d0117",secondary:"#1a0533",tertiary:"#2d0a52",hover:"#2d0a52"},{primary:"#fae8ff",secondary:"#d8b4fe",muted:"#7c3aed"},"#581c87");w("Abyss",{primary:"#22d3ee",primaryHover:"#06b6d4",success:"#34d399",warning:"#fbbf24",error:"#f87171",info:"#38bdf8"},{primary:"#001219",secondary:"#002a3a",tertiary:"#003e54",hover:"#003e54"},{primary:"#e0f2fe",secondary:"#7dd3fc",muted:"#0369a1"},"#075985");w("Shadow",{primary:"#a3a3a3",primaryHover:"#737373",success:"#4ade80",warning:"#facc15",error:"#f87171",info:"#38bdf8"},{primary:"#171717",secondary:"#1f1f1f",tertiary:"#2a2a2a",hover:"#2a2a2a"},{primary:"#e5e5e5",secondary:"#a3a3a3",muted:"#525252"},"#404040");w("Emerald Dark",{primary:"#34d399",primaryHover:"#10b981",success:"#4ade80",warning:"#fbbf24",error:"#f87171",info:"#22d3ee"},{primary:"#022c22",secondary:"#064e3b",tertiary:"#065f46",hover:"#065f46"},{primary:"#ecfdf5",secondary:"#6ee7b7",muted:"#047857"},"#047857");c("Forest",{primary:"#166534",primaryHover:"#14532d",success:"#22c55e",warning:"#ca8a04",error:"#dc2626",info:"#0891b2"},{primary:"#f0fdf4",secondary:"#dcfce7",tertiary:"#bbf7d0",hover:"#dcfce7"},{primary:"#052e16",secondary:"#166534",muted:"#4ade80"},"#86efac");c("Ocean",{primary:"#0369a1",primaryHover:"#075985",success:"#059669",warning:"#d97706",error:"#dc2626",info:"#0284c7"},{primary:"#f0f9ff",secondary:"#e0f2fe",tertiary:"#bae6fd",hover:"#e0f2fe"},{primary:"#0c4a6e",secondary:"#0369a1",muted:"#38bdf8"},"#7dd3fc");c("Desert",{primary:"#b45309",primaryHover:"#92400e",success:"#4d7c0f",warning:"#a16207",error:"#b91c1c",info:"#0e7490"},{primary:"#fefce8",secondary:"#fef9c3",tertiary:"#fef08a",hover:"#fef9c3"},{primary:"#422006",secondary:"#713f12",muted:"#ca8a04"},"#fde047");c("Sunset",{primary:"#ea580c",primaryHover:"#c2410c",success:"#16a34a",warning:"#d97706",error:"#dc2626",info:"#0891b2"},{primary:"#fff7ed",secondary:"#ffedd5",tertiary:"#fed7aa",hover:"#ffedd5"},{primary:"#431407",secondary:"#9a3412",muted:"#f97316"},"#fdba74");c("Aurora",{primary:"#0d9488",primaryHover:"#0f766e",success:"#22c55e",warning:"#eab308",error:"#ef4444",info:"#06b6d4"},{primary:"#f0fdfa",secondary:"#ccfbf1",tertiary:"#99f6e4",hover:"#ccfbf1"},{primary:"#134e4a",secondary:"#115e59",muted:"#2dd4bf"},"#5eead4");c("Lavender",{primary:"#7e22ce",primaryHover:"#6b21a8",success:"#16a34a",warning:"#d97706",error:"#dc2626",info:"#0891b2"},{primary:"#faf5ff",secondary:"#f3e8ff",tertiary:"#e9d5ff",hover:"#f3e8ff"},{primary:"#3b0764",secondary:"#581c87",muted:"#a855f7"},"#d8b4fe");c("Autumn",{primary:"#c2410c",primaryHover:"#9a3412",success:"#4d7c0f",warning:"#a16207",error:"#b91c1c",info:"#0e7490"},{primary:"#fef2f2",secondary:"#fee2e2",tertiary:"#fecaca",hover:"#fee2e2"},{primary:"#450a0a",secondary:"#7f1d1d",muted:"#f87171"},"#fca5a5");c("Spring",{primary:"#16a34a",primaryHover:"#15803d",success:"#22c55e",warning:"#eab308",error:"#ef4444",info:"#06b6d4"},{primary:"#f0fdf4",secondary:"#dcfce7",tertiary:"#bbf7d0",hover:"#dcfce7"},{primary:"#14532d",secondary:"#166534",muted:"#4ade80"},"#86efac");c("Arctic",{primary:"#0ea5e9",primaryHover:"#0284c7",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#06b6d4"},{primary:"#f0f9ff",secondary:"#e0f2fe",tertiary:"#bae6fd",hover:"#e0f2fe"},{primary:"#0c4a6e",secondary:"#0369a1",muted:"#7dd3fc"},"#bae6fd");c("Tropical",{primary:"#0d9488",primaryHover:"#0f766e",success:"#16a34a",warning:"#f59e0b",error:"#ef4444",info:"#06b6d4"},{primary:"#ecfdf5",secondary:"#d1fae5",tertiary:"#a7f3d0",hover:"#d1fae5"},{primary:"#064e3b",secondary:"#065f46",muted:"#6ee7b7"},"#a7f3d0");c("Pastel Rose",{primary:"#f472b6",primaryHover:"#ec4899",success:"#4ade80",warning:"#fcd34d",error:"#fb7185",info:"#67e8f9"},{primary:"#fdf2f8",secondary:"#fce7f3",tertiary:"#fbcfe8",hover:"#fce7f3"},{primary:"#831843",secondary:"#9d174d",muted:"#f9a8d4"},"#f9a8d4");c("Pastel Sky",{primary:"#38bdf8",primaryHover:"#0ea5e9",success:"#4ade80",warning:"#fcd34d",error:"#fb7185",info:"#67e8f9"},{primary:"#f0f9ff",secondary:"#e0f2fe",tertiary:"#bae6fd",hover:"#e0f2fe"},{primary:"#075985",secondary:"#0369a1",muted:"#7dd3fc"},"#bae6fd");c("Pastel Mint",{primary:"#34d399",primaryHover:"#10b981",success:"#4ade80",warning:"#fcd34d",error:"#fb7185",info:"#67e8f9"},{primary:"#ecfdf5",secondary:"#d1fae5",tertiary:"#a7f3d0",hover:"#d1fae5"},{primary:"#065f46",secondary:"#047857",muted:"#6ee7b7"},"#a7f3d0");c("Pastel Peach",{primary:"#fb923c",primaryHover:"#f97316",success:"#4ade80",warning:"#fcd34d",error:"#fb7185",info:"#67e8f9"},{primary:"#fff7ed",secondary:"#ffedd5",tertiary:"#fed7aa",hover:"#ffedd5"},{primary:"#7c2d12",secondary:"#9a3412",muted:"#fdba74"},"#fed7aa");c("Pastel Lavender",{primary:"#a78bfa",primaryHover:"#8b5cf6",success:"#4ade80",warning:"#fcd34d",error:"#fb7185",info:"#67e8f9"},{primary:"#f5f3ff",secondary:"#ede9fe",tertiary:"#ddd6fe",hover:"#ede9fe"},{primary:"#4c1d95",secondary:"#5b21b6",muted:"#c4b5fd"},"#ddd6fe");c("Pastel Lemon",{primary:"#facc15",primaryHover:"#eab308",success:"#4ade80",warning:"#fcd34d",error:"#fb7185",info:"#67e8f9"},{primary:"#fefce8",secondary:"#fef9c3",tertiary:"#fef08a",hover:"#fef9c3"},{primary:"#713f12",secondary:"#854d0e",muted:"#fde047"},"#fef08a");c("Pastel Sage",{primary:"#86efac",primaryHover:"#4ade80",success:"#22c55e",warning:"#fcd34d",error:"#fb7185",info:"#67e8f9"},{primary:"#f0fdf4",secondary:"#dcfce7",tertiary:"#bbf7d0",hover:"#dcfce7"},{primary:"#166534",secondary:"#15803d",muted:"#86efac"},"#bbf7d0");c("Pastel Coral",{primary:"#fb7185",primaryHover:"#f43f5e",success:"#4ade80",warning:"#fcd34d",error:"#ef4444",info:"#67e8f9"},{primary:"#fff1f2",secondary:"#ffe4e6",tertiary:"#fecdd3",hover:"#ffe4e6"},{primary:"#881337",secondary:"#9f1239",muted:"#fda4af"},"#fecdd3");c("Banking",{primary:"#1e3a5f",primaryHover:"#152c4a",success:"#059669",warning:"#d97706",error:"#dc2626",info:"#0891b2"},{primary:"#f8fafc",secondary:"#f1f5f9",tertiary:"#e2e8f0",hover:"#e2e8f0"},{primary:"#0f172a",secondary:"#334155",muted:"#94a3b8"},"#cbd5e1");c("Healthcare",{primary:"#0891b2",primaryHover:"#0e7490",success:"#059669",warning:"#d97706",error:"#dc2626",info:"#0284c7"},{primary:"#f0fdfa",secondary:"#e0f7fa",tertiary:"#b2ebf2",hover:"#e0f7fa"},{primary:"#134e4a",secondary:"#1a6b6a",muted:"#80cbc4"},"#b2dfdb");c("Legal",{primary:"#1e293b",primaryHover:"#0f172a",success:"#059669",warning:"#d97706",error:"#dc2626",info:"#0284c7"},{primary:"#fafaf9",secondary:"#f5f5f4",tertiary:"#e7e5e4",hover:"#e7e5e4"},{primary:"#0f172a",secondary:"#44403c",muted:"#a8a29e"},"#d6d3d1");c("Tech Startup",{primary:"#7c3aed",primaryHover:"#6d28d9",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#06b6d4"},{primary:"#faf5ff",secondary:"#f3e8ff",tertiary:"#e9d5ff",hover:"#f3e8ff"},{primary:"#1e1b4b",secondary:"#4c1d95",muted:"#a78bfa"},"#c4b5fd");c("Enterprise",{primary:"#1e40af",primaryHover:"#1e3a8a",success:"#059669",warning:"#d97706",error:"#dc2626",info:"#0891b2"},{primary:"#eff6ff",secondary:"#dbeafe",tertiary:"#bfdbfe",hover:"#dbeafe"},{primary:"#1e3a5f",secondary:"#1e40af",muted:"#60a5fa"},"#93c5fd");c("Government",{primary:"#1d4ed8",primaryHover:"#1e40af",success:"#059669",warning:"#d97706",error:"#dc2626",info:"#0891b2"},{primary:"#f8fafc",secondary:"#f1f5f9",tertiary:"#e2e8f0",hover:"#e2e8f0"},{primary:"#0f172a",secondary:"#1e293b",muted:"#64748b"},"#cbd5e1");c("Education",{primary:"#059669",primaryHover:"#047857",success:"#16a34a",warning:"#f59e0b",error:"#ef4444",info:"#0891b2"},{primary:"#f0fdf9",secondary:"#d1fae5",tertiary:"#a7f3d0",hover:"#d1fae5"},{primary:"#064e3b",secondary:"#065f46",muted:"#6ee7b7"},"#a7f3d0");c("Real Estate",{primary:"#92400e",primaryHover:"#78350f",success:"#059669",warning:"#b45309",error:"#dc2626",info:"#0891b2"},{primary:"#fffbeb",secondary:"#fef3c7",tertiary:"#fde68a",hover:"#fef3c7"},{primary:"#422006",secondary:"#713f12",muted:"#d97706"},"#fcd34d");c("Nord",{primary:"#5e81ac",primaryHover:"#4c6b90",success:"#a3be8c",warning:"#ebcb8b",error:"#bf616a",info:"#88c0d0"},{primary:"#eceff4",secondary:"#e5e9f0",tertiary:"#d8dee9",hover:"#d8dee9"},{primary:"#2e3440",secondary:"#3b4252",muted:"#4c566a"},"#d8dee9");w("Dracula",{primary:"#bd93f9",primaryHover:"#9d79d9",success:"#50fa7b",warning:"#f1fa8c",error:"#ff5555",info:"#8be9fd"},{primary:"#282a36",secondary:"#343746",tertiary:"#44475a",hover:"#44475a"},{primary:"#f8f8f2",secondary:"#c0c0c0",muted:"#6272a4"},"#44475a");c("Solarized Light",{primary:"#268bd2",primaryHover:"#1a6da0",success:"#859900",warning:"#b58900",error:"#dc322f",info:"#2aa198"},{primary:"#fdf6e3",secondary:"#eee8d5",tertiary:"#e0dbc7",hover:"#eee8d5"},{primary:"#073642",secondary:"#586e75",muted:"#93a1a1"},"#eee8d5");w("Solarized Dark",{primary:"#268bd2",primaryHover:"#3d98db",success:"#859900",warning:"#b58900",error:"#dc322f",info:"#2aa198"},{primary:"#002b36",secondary:"#073642",tertiary:"#0a4858",hover:"#073642"},{primary:"#eee8d5",secondary:"#93a1a1",muted:"#586e75"},"#073642");w("Monokai",{primary:"#66d9ef",primaryHover:"#45c0d6",success:"#a6e22e",warning:"#e6db74",error:"#f92672",info:"#66d9ef"},{primary:"#272822",secondary:"#34352e",tertiary:"#3e3d32",hover:"#3e3d32"},{primary:"#f8f8f2",secondary:"#cfcfc2",muted:"#75715e"},"#3e3d32");w("One Dark",{primary:"#61afef",primaryHover:"#4b9ee0",success:"#98c379",warning:"#e5c07b",error:"#e06c75",info:"#56b6c2"},{primary:"#282c34",secondary:"#2c313a",tertiary:"#353b45",hover:"#353b45"},{primary:"#abb2bf",secondary:"#828997",muted:"#545862"},"#3e4452");w("Synthwave",{primary:"#ff7edb",primaryHover:"#e660c2",success:"#72f1b8",warning:"#fede5d",error:"#fe4450",info:"#36f9f6"},{primary:"#241b2f",secondary:"#2d2140",tertiary:"#362a50",hover:"#362a50"},{primary:"#f0e4fc",secondary:"#b4a0cc",muted:"#6c5c84"},"#4a3866");c("Vaporwave",{primary:"#ff71ce",primaryHover:"#e655b5",success:"#78dcca",warning:"#ffb86c",error:"#ff5555",info:"#76e8fc"},{primary:"#fce4f7",secondary:"#e8d0f4",tertiary:"#d4bcf0",hover:"#e8d0f4"},{primary:"#4a1a4e",secondary:"#7b3f7d",muted:"#c080c0"},"#d8a8e8");w("Terminal Green",{primary:"#00ff41",primaryHover:"#00cc34",success:"#00ff41",warning:"#ffff00",error:"#ff0000",info:"#00ffff"},{primary:"#0a0a0a",secondary:"#0d1a0d",tertiary:"#1a2e1a",hover:"#1a2e1a"},{primary:"#00ff41",secondary:"#00cc33",muted:"#008822"},"#003300");c("Sepia",{primary:"#8b6914",primaryHover:"#704f10",success:"#6b8e23",warning:"#cd853f",error:"#b22222",info:"#5f9ea0"},{primary:"#faf0e6",secondary:"#f5e6d3",tertiary:"#eddcc7",hover:"#f5e6d3"},{primary:"#3e2723",secondary:"#5d4037",muted:"#a1887f"},"#d7ccc8");c("Vintage",{primary:"#8d6e63",primaryHover:"#6d4c41",success:"#66bb6a",warning:"#ffb300",error:"#e53935",info:"#29b6f6"},{primary:"#efebe9",secondary:"#d7ccc8",tertiary:"#bcaaa4",hover:"#d7ccc8"},{primary:"#3e2723",secondary:"#5d4037",muted:"#a1887f"},"#bcaaa4");w("Cyberpunk",{primary:"#00f0ff",primaryHover:"#00c8d4",success:"#39ff14",warning:"#ffff00",error:"#ff003c",info:"#bf00ff"},{primary:"#0a0e17",secondary:"#131824",tertiary:"#1c2333",hover:"#1c2333"},{primary:"#e0fbfc",secondary:"#80d4dd",muted:"#3a6b72"},"#1c3a44");w("Neon",{primary:"#ff00ff",primaryHover:"#cc00cc",success:"#00ff00",warning:"#ffff00",error:"#ff0000",info:"#00ffff"},{primary:"#0d0d0d",secondary:"#1a1a1a",tertiary:"#262626",hover:"#262626"},{primary:"#ffffff",secondary:"#cccccc",muted:"#666666"},"#333333");w("Retrowave",{primary:"#f77fbe",primaryHover:"#e462a3",success:"#72f1b8",warning:"#ffe261",error:"#ff4444",info:"#79e8fb"},{primary:"#1b0a2e",secondary:"#261440",tertiary:"#321e52",hover:"#321e52"},{primary:"#ffe6f7",secondary:"#c9a0c9",muted:"#6b4c7a"},"#4a2d66");c("Christmas",{primary:"#c41e3a",primaryHover:"#a01830",success:"#228b22",warning:"#ffd700",error:"#dc2626",info:"#0891b2"},{primary:"#fef2f2",secondary:"#fde8e8",tertiary:"#f8d0d0",hover:"#fde8e8"},{primary:"#3b0a0a",secondary:"#7f1d1d",muted:"#dc6868"},"#e8a0a0");w("Halloween",{primary:"#ff6600",primaryHover:"#e05500",success:"#4ade80",warning:"#fbbf24",error:"#ff0000",info:"#9333ea"},{primary:"#1a0a00",secondary:"#2d1500",tertiary:"#402000",hover:"#402000"},{primary:"#ffedd5",secondary:"#fdba74",muted:"#9a5c28"},"#5c3400");c("Valentine",{primary:"#e11d48",primaryHover:"#be123c",success:"#10b981",warning:"#f59e0b",error:"#dc2626",info:"#ec4899"},{primary:"#fff1f2",secondary:"#ffe4e6",tertiary:"#fecdd3",hover:"#ffe4e6"},{primary:"#4c0519",secondary:"#881337",muted:"#f9a8d4"},"#fda4af");c("Easter",{primary:"#a78bfa",primaryHover:"#8b5cf6",success:"#4ade80",warning:"#fcd34d",error:"#fb7185",info:"#67e8f9"},{primary:"#fef9ff",secondary:"#f3e8ff",tertiary:"#e8d5ff",hover:"#f3e8ff"},{primary:"#581c87",secondary:"#6d28d9",muted:"#c4b5fd"},"#ddd6fe");c("Summer Beach",{primary:"#0ea5e9",primaryHover:"#0284c7",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#06b6d4"},{primary:"#fffbeb",secondary:"#fef3c7",tertiary:"#fde68a",hover:"#fef3c7"},{primary:"#0c4a6e",secondary:"#0369a1",muted:"#7dd3fc"},"#fcd34d");c("Winter Frost",{primary:"#3b82f6",primaryHover:"#2563eb",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#06b6d4"},{primary:"#f0f9ff",secondary:"#e0f2fe",tertiary:"#bae6fd",hover:"#e0f2fe"},{primary:"#1e3a5f",secondary:"#1e40af",muted:"#93c5fd"},"#bfdbfe");c("Cherry Blossom",{primary:"#ec4899",primaryHover:"#db2777",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#06b6d4"},{primary:"#fdf2f8",secondary:"#fce7f3",tertiary:"#fbcfe8",hover:"#fce7f3"},{primary:"#831843",secondary:"#9d174d",muted:"#f9a8d4"},"#fbcfe8");c("Harvest",{primary:"#b45309",primaryHover:"#92400e",success:"#4d7c0f",warning:"#a16207",error:"#b91c1c",info:"#0e7490"},{primary:"#fffbeb",secondary:"#fef3c7",tertiary:"#fde68a",hover:"#fef3c7"},{primary:"#451a03",secondary:"#78350f",muted:"#d97706"},"#fcd34d");c("Japanese Zen",{primary:"#6b7280",primaryHover:"#4b5563",success:"#6b8e23",warning:"#d4a017",error:"#c0392b",info:"#5f9ea0"},{primary:"#faf9f6",secondary:"#f0ece3",tertiary:"#e6e0d4",hover:"#f0ece3"},{primary:"#2c2c2c",secondary:"#5c5c5c",muted:"#a0998a"},"#d5cec0");c("Moroccan",{primary:"#c2410c",primaryHover:"#9a3412",success:"#15803d",warning:"#ca8a04",error:"#b91c1c",info:"#0e7490"},{primary:"#fffbf0",secondary:"#fef3e0",tertiary:"#fde6c4",hover:"#fef3e0"},{primary:"#3a1a00",secondary:"#7c2d12",muted:"#d97706"},"#f5d0a0");c("Scandinavian",{primary:"#4b5563",primaryHover:"#374151",success:"#059669",warning:"#d97706",error:"#dc2626",info:"#0891b2"},{primary:"#ffffff",secondary:"#f9fafb",tertiary:"#f3f4f6",hover:"#f3f4f6"},{primary:"#111827",secondary:"#374151",muted:"#9ca3af"},"#e5e7eb");c("Mediterranean",{primary:"#1e40af",primaryHover:"#1e3a8a",success:"#059669",warning:"#d97706",error:"#dc2626",info:"#0891b2"},{primary:"#eff6ff",secondary:"#dbeafe",tertiary:"#bfdbfe",hover:"#dbeafe"},{primary:"#1e3a5f",secondary:"#2563eb",muted:"#93c5fd"},"#bfdbfe");c("Chinese New Year",{primary:"#dc2626",primaryHover:"#b91c1c",success:"#16a34a",warning:"#d4a017",error:"#ef4444",info:"#0891b2"},{primary:"#fef2f2",secondary:"#fee2e2",tertiary:"#fecaca",hover:"#fee2e2"},{primary:"#450a0a",secondary:"#991b1b",muted:"#f87171"},"#fca5a5");c("Indian Festive",{primary:"#d97706",primaryHover:"#b45309",success:"#16a34a",warning:"#ca8a04",error:"#dc2626",info:"#7c3aed"},{primary:"#fffbeb",secondary:"#fef3c7",tertiary:"#fde68a",hover:"#fef3c7"},{primary:"#451a03",secondary:"#92400e",muted:"#f59e0b"},"#fcd34d");c("Brazilian Carnival",{primary:"#16a34a",primaryHover:"#15803d",success:"#22c55e",warning:"#facc15",error:"#ef4444",info:"#0ea5e9"},{primary:"#f0fdf4",secondary:"#dcfce7",tertiary:"#bbf7d0",hover:"#dcfce7"},{primary:"#052e16",secondary:"#166534",muted:"#4ade80"},"#86efac");c("African Earth",{primary:"#92400e",primaryHover:"#78350f",success:"#4d7c0f",warning:"#a16207",error:"#b91c1c",info:"#0e7490"},{primary:"#faf5f0",secondary:"#f0e6d6",tertiary:"#e6d5bb",hover:"#f0e6d6"},{primary:"#2b1a0e",secondary:"#5c3d1e",muted:"#a08060"},"#d4b896");w("High Contrast Dark",{primary:"#ffff00",primaryHover:"#cccc00",success:"#00ff00",warning:"#ff8c00",error:"#ff0000",info:"#00ffff"},{primary:"#000000",secondary:"#1a1a1a",tertiary:"#333333",hover:"#333333"},{primary:"#ffffff",secondary:"#ffffff",muted:"#cccccc"},"#ffffff");c("Monochrome",{primary:"#404040",primaryHover:"#262626",success:"#4d7c0f",warning:"#a16207",error:"#b91c1c",info:"#0e7490"},{primary:"#fafafa",secondary:"#f0f0f0",tertiary:"#e0e0e0",hover:"#e0e0e0"},{primary:"#1a1a1a",secondary:"#404040",muted:"#808080"},"#c0c0c0");c("Enhanced Contrast",{primary:"#0050b3",primaryHover:"#003d8c",success:"#006400",warning:"#cc7000",error:"#cc0000",info:"#006680"},{primary:"#ffffff",secondary:"#f5f5f5",tertiary:"#ebebeb",hover:"#ebebeb"},{primary:"#000000",secondary:"#1a1a1a",muted:"#595959"},"#8c8c8c");c("Minimalist",{primary:"#18181b",primaryHover:"#27272a",success:"#22c55e",warning:"#eab308",error:"#ef4444",info:"#3b82f6"},{primary:"#ffffff",secondary:"#fafafa",tertiary:"#f5f5f5",hover:"#f5f5f5"},{primary:"#0a0a0a",secondary:"#404040",muted:"#a3a3a3"},"#e5e5e5");w("Warm Dark",{primary:"#f59e0b",primaryHover:"#d97706",success:"#10b981",warning:"#fbbf24",error:"#f87171",info:"#38bdf8"},{primary:"#1c1917",secondary:"#292524",tertiary:"#44403c",hover:"#44403c"},{primary:"#fafaf9",secondary:"#d6d3d1",muted:"#78716c"},"#57534e");w("Soft Dark",{primary:"#a78bfa",primaryHover:"#8b5cf6",success:"#34d399",warning:"#fcd34d",error:"#fb7185",info:"#67e8f9"},{primary:"#1e1e2e",secondary:"#262637",tertiary:"#313147",hover:"#313147"},{primary:"#e8e8f0",secondary:"#a0a0b8",muted:"#5c5c74"},"#3e3e58");c("Coffee",{primary:"#6f4e37",primaryHover:"#5c3d28",success:"#4d7c0f",warning:"#a16207",error:"#b91c1c",info:"#0e7490"},{primary:"#faf6f1",secondary:"#f0e8dc",tertiary:"#e6d8c6",hover:"#f0e8dc"},{primary:"#2c1a0e",secondary:"#5c3d28",muted:"#a08868"},"#d4c4a8");c("Wine",{primary:"#7f1d1d",primaryHover:"#641717",success:"#059669",warning:"#d97706",error:"#dc2626",info:"#0891b2"},{primary:"#fef2f2",secondary:"#fde8e8",tertiary:"#f8d0d0",hover:"#fde8e8"},{primary:"#3b0a0a",secondary:"#7f1d1d",muted:"#dc6868"},"#e8a0a0");d.createContext(null);const Ae={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"}}},Ee=[{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:"🔍"}],ze=[{type:"fade",name:"Fade"},{type:"dissolve",name:"Dissolve"},{type:"wipe",name:"Wipe"},{type:"slide",name:"Slide"},{type:"zoom",name:"Zoom"},{type:"push",name:"Push"}],Pe=[{target:".nice-video-editor",titleKey:"tutorial.videoEditorPro.intro.title",title:"Video editor",contentKey:"tutorial.videoEditorPro.intro.content",content:"Add media to the timeline, arrange and trim clips, apply effects and transitions, then configure and run the export.",placement:"auto"}],Fe=({project:l,onProjectChange:m,onExport:f,onAssetUpload:N,className:S="",tutorial:H})=>{const[u,s]=d.useState(l||Ae),[I,b]=d.useState("timeline"),[_,y]=d.useState(null),[j,k]=d.useState(null),[$,R]=d.useState(0),[W,L]=d.useState(!1),[T,G]=d.useState(1),[V,A]=d.useState(!0),[E,F]=d.useState(null),ae=d.useRef(null),re=d.useRef(null),D=d.useRef(null);d.useEffect(()=>{l&&s(l)},[l]),d.useEffect(()=>()=>{D.current&&clearInterval(D.current)},[]);const x=d.useCallback(t=>{const i={...u,...t};s(i),m==null||m(i)},[u,m]),v=async t=>{const i=[];for(const a of Array.from(t)){const r=a.type.startsWith("video/")?"video":a.type.startsWith("audio/")?"audio":"image";let o;N?o=await N(a):o={id:crypto.randomUUID(),type:r,name:a.name,url:URL.createObjectURL(a),size:a.size},i.push(o)}x({assets:[...u.assets,...i]})},U=t=>{const i={id:crypto.randomUUID(),type:t,name:`${t.charAt(0).toUpperCase()+t.slice(1)} ${u.tracks.filter(a=>a.type===t).length+1}`,items:[],muted:!1,locked:!1,visible:!0};x({tracks:[...u.tracks,i]})},q=t=>{x({tracks:u.tracks.filter(i=>i.id!==t)}),_===t&&y(null)},O=t=>{x({tracks:u.tracks.map(i=>i.id===t?{...i,muted:!i.muted}:i)})},Q=t=>{x({tracks:u.tracks.map(i=>i.id===t?{...i,locked:!i.locked}:i)})},M=(t,i)=>{const a=u.tracks.find(h=>h.id===t);if(!a||a.locked)return;const r=a.items[a.items.length-1],o=r?r.startTime+r.duration:0,p={id:crypto.randomUUID(),assetId:i.id,type:i.type,startTime:o,duration:i.duration||5,offset:0,properties:{x:0,y:0,opacity:1,scale:1,volume:1},effects:[],transitions:[]};x({tracks:u.tracks.map(h=>h.id===t?{...h,items:[...h.items,p]}:h)})},Z=(t,i,a)=>{const r={id:crypto.randomUUID(),type:a,name:a.charAt(0).toUpperCase()+a.slice(1),parameters:se(a)};x({tracks:u.tracks.map(o=>o.id===t?{...o,items:o.items.map(p=>p.id===i?{...p,effects:[...p.effects,r]}:p)}:o)})},z=(t,i,a,r)=>{const o={id:crypto.randomUUID(),type:a,duration:.5,position:r};x({tracks:u.tracks.map(p=>p.id===t?{...p,items:p.items.map(h=>h.id===i?{...h,transitions:[...h.transitions,o]}:h)}:p)})},se=t=>{switch(t){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{}}},te=()=>{W?(D.current&&clearInterval(D.current),L(!1)):(D.current=setInterval(()=>{R(t=>{const i=Math.max(...u.tracks.flatMap(a=>a.items.map(r=>r.startTime+r.duration)),0);return t>=i?(clearInterval(D.current),L(!1),0):t+1/u.frameRate})},1e3/u.frameRate),L(!0))},J=t=>{R(Math.max(0,t))},X=async()=>{if(f){F(0);try{const t=setInterval(()=>{F(i=>i!==null&&i<90?i+Math.random()*10:i)},500);await f(u,u.settings.video.codec),clearInterval(t),F(100),setTimeout(()=>F(null),2e3)}catch(t){F(null),console.error("Export failed:",t)}}},ee=t=>{const i=Math.floor(t/60),a=Math.floor(t%60),r=Math.floor(t%1*u.frameRate);return`${i.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`},K=()=>{for(const t of u.tracks){const i=t.items.find(a=>a.id===j);if(i)return{track:t,item:i}}return null};return e.jsxs("div",{className:`nice-video-editor ${S}`,style:{position:"relative"},children:[e.jsx("span",{style:{position:"absolute",top:6,right:6,zIndex:30},children:e.jsx(De,{steps:Ie(H,Pe)})}),e.jsxs("header",{className:"video-editor__header",children:[e.jsxs("div",{className:"header__project-info",children:[e.jsx("input",{type:"text",value:u.name,onChange:t=>x({name:t.target.value}),className:"project-name-input"}),e.jsxs("span",{className:"project-settings",children:[u.resolution.width,"x",u.resolution.height," â€ĸ ",u.frameRate,"fps"]})]}),e.jsx("div",{className:"header__tabs",children:["timeline","effects","transitions","export"].map(t=>e.jsx("button",{className:`tab-button ${I===t?"tab-button--active":""}`,onClick:()=>b(t),children:t.charAt(0).toUpperCase()+t.slice(1)},t))}),e.jsx("div",{className:"header__actions",children:e.jsx("button",{className:"action-button action-button--primary",onClick:X,disabled:E!==null,children:E!==null?`Exporting ${Math.round(E)}%`:"Export"})})]}),e.jsxs("div",{className:"video-editor__main",children:[V&&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:()=>A(!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:t=>t.target.files&&v(t.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:u.assets.map(t=>e.jsxs("div",{className:"asset-item",draggable:!0,onDragStart:i=>i.dataTransfer.setData("assetId",t.id),children:[e.jsx("div",{className:"asset-thumbnail",children:t.thumbnail?e.jsx("img",{src:t.thumbnail,alt:t.name}):e.jsx("span",{className:"asset-type-icon",children:t.type==="video"?"đŸŽŦ":t.type==="audio"?"đŸŽĩ":"đŸ–ŧī¸"})}),e.jsxs("div",{className:"asset-info",children:[e.jsx("span",{className:"asset-name",children:t.name}),e.jsxs("span",{className:"asset-meta",children:[(t.size/1024/1024).toFixed(1),"MB"]})]})]},t.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:`${u.resolution.width}/${u.resolution.height}`},children:[e.jsx("video",{ref:re,className:"preview-video"}),e.jsx("div",{className:"preview-overlay",children:!V&&e.jsx("button",{className:"toggle-library-button",onClick:()=>A(!0),children:"📁"})})]}),e.jsxs("div",{className:"playback-controls",children:[e.jsx("button",{onClick:()=>J(0),children:"âŽī¸"}),e.jsx("button",{onClick:()=>J($-1/u.frameRate),children:"âĒ"}),e.jsx("button",{onClick:te,className:"play-button",children:W?"â¸ī¸":"â–ļī¸"}),e.jsx("button",{onClick:()=>J($+1/u.frameRate),children:"⏊"}),e.jsx("span",{className:"time-display",children:ee($)})]})]}),j&&I!=="export"&&e.jsx("div",{className:"item-inspector",children:(()=>{const t=K();if(!t)return null;const{track:i,item:a}=t;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:a.startTime,onChange:r=>{const o=parseFloat(r.target.value);x({tracks:u.tracks.map(p=>p.id===i.id?{...p,items:p.items.map(h=>h.id===a.id?{...h,startTime:o}:h)}:p)})}})]}),e.jsxs("label",{children:["Duration",e.jsx("input",{type:"number",step:"0.1",value:a.duration,onChange:r=>{const o=parseFloat(r.target.value);x({tracks:u.tracks.map(p=>p.id===i.id?{...p,items:p.items.map(h=>h.id===a.id?{...h,duration:o}:h)}:p)})}})]}),e.jsxs("label",{children:["Opacity",e.jsx("input",{type:"range",min:"0",max:"1",step:"0.1",value:a.properties.opacity??1,onChange:r=>{const o=parseFloat(r.target.value);x({tracks:u.tracks.map(p=>p.id===i.id?{...p,items:p.items.map(h=>h.id===a.id?{...h,properties:{...h.properties,opacity:o}}:h)}:p)})}})]})]}),e.jsxs("h4",{children:["Effects (",a.effects.length,")"]}),e.jsx("div",{className:"effects-list",children:a.effects.map(r=>e.jsx("div",{className:"effect-badge",children:r.name},r.id))})]})})()})]})]}),e.jsxs("div",{className:"video-editor__panel",children:[I==="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:()=>U("video"),children:"+ Video Track"}),e.jsx("button",{onClick:()=>U("audio"),children:"+ Audio Track"}),e.jsx("button",{onClick:()=>U("text"),children:"+ Text Track"})]}),e.jsxs("div",{className:"zoom-controls",children:[e.jsx("button",{onClick:()=>G(Math.max(.25,T-.25)),children:"-"}),e.jsxs("span",{children:[Math.round(T*100),"%"]}),e.jsx("button",{onClick:()=>G(Math.min(4,T+.25)),children:"+"})]})]}),e.jsxs("div",{className:"timeline-container",ref:ae,children:[e.jsx("div",{className:"timeline-ruler",children:Array.from({length:Math.ceil(30/T)}).map((t,i)=>e.jsx("div",{className:"ruler-mark",style:{left:`${i*50*T}px`},children:ee(i)},i))}),e.jsx("div",{className:"timeline-playhead",style:{left:`${$*50*T}px`}}),e.jsx("div",{className:"timeline-tracks",children:u.tracks.map(t=>e.jsxs("div",{className:`timeline-track ${_===t.id?"timeline-track--selected":""} ${t.locked?"timeline-track--locked":""}`,onClick:()=>y(t.id),onDrop:i=>{i.preventDefault();const a=i.dataTransfer.getData("assetId"),r=u.assets.find(o=>o.id===a);r&&M(t.id,r)},onDragOver:i=>i.preventDefault(),children:[e.jsxs("div",{className:"track-header",children:[e.jsx("span",{className:"track-name",children:t.name}),e.jsxs("div",{className:"track-controls",children:[e.jsx("button",{className:t.muted?"active":"",onClick:i=>{i.stopPropagation(),O(t.id)},children:t.muted?"🔇":"🔊"}),e.jsx("button",{className:t.locked?"active":"",onClick:i=>{i.stopPropagation(),Q(t.id)},children:t.locked?"🔒":"🔓"}),e.jsx("button",{onClick:i=>{i.stopPropagation(),q(t.id)},children:"đŸ—‘ī¸"})]})]}),e.jsx("div",{className:"track-items",children:t.items.map(i=>{const a=u.assets.find(r=>r.id===i.assetId);return e.jsxs("div",{className:`track-item track-item--${i.type} ${j===i.id?"track-item--selected":""}`,style:{left:`${i.startTime*50*T}px`,width:`${i.duration*50*T}px`},onClick:r=>{r.stopPropagation(),k(i.id)},children:[e.jsx("span",{className:"item-name",children:(a==null?void 0:a.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)})})]},t.id))})]})]}),I==="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:Ee.map(t=>e.jsxs("button",{className:"effect-preset",disabled:!j,onClick:()=>{const i=K();i&&Z(i.track.id,i.item.id,t.type)},children:[e.jsx("span",{className:"effect-icon",children:t.icon}),e.jsx("span",{className:"effect-name",children:t.name})]},t.type))})]}),I==="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:ze.map(t=>e.jsxs("div",{className:"transition-preset",children:[e.jsx("span",{className:"transition-name",children:t.name}),e.jsxs("div",{className:"transition-buttons",children:[e.jsx("button",{disabled:!j,onClick:()=>{const i=K();i&&z(i.track.id,i.item.id,t.type,"start")},children:"In"}),e.jsx("button",{disabled:!j,onClick:()=>{const i=K();i&&z(i.track.id,i.item.id,t.type,"end")},children:"Out"})]})]},t.type))})]}),I==="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:`${u.resolution.width}x${u.resolution.height}`,onChange:t=>{const[i,a]=t.target.value.split("x").map(Number);x({resolution:{width:i,height:a}})},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:u.frameRate,onChange:t=>x({frameRate:parseInt(t.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:u.settings.video.codec,onChange:t=>x({settings:{...u.settings,video:{...u.settings.video,codec:t.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:u.settings.video.bitrate/1e3,onChange:t=>x({settings:{...u.settings,video:{...u.settings.video,bitrate:parseFloat(t.target.value)*1e3}}}),min:"1",max:"100"})]})]}),e.jsx("button",{className:"export-button",onClick:X,disabled:E!==null,children:E!==null?`Exporting... ${Math.round(E)}%`:"Export Video"}),E!==null&&e.jsx("div",{className:"export-progress",children:e.jsx("div",{className:"export-progress-bar",style:{width:`${E}%`}})})]})]})]})},Ue={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"}},Le=({options:l,onRecordingStart:m,onRecordingStop:f,onRecordingPause:N,onRecordingResume:S,onError:H,className:u=""})=>{var p,h;const[s,I]=d.useState({...Ue,...l}),[b,_]=d.useState(null),[y,j]=d.useState("idle"),[k,$]=d.useState([]),[R,W]=d.useState(null),[L,T]=d.useState(null),[G,V]=d.useState(!1),[A,E]=d.useState(!1),[F,ae]=d.useState("pen"),[re,D]=d.useState("var(--nice-danger, #ff0000)"),x=d.useRef(null),v=d.useRef([]),U=d.useRef(null),q=d.useRef(null),O=d.useRef(null),Q=d.useRef(0);d.useEffect(()=>()=>{R&&R.getTracks().forEach(n=>n.stop()),O.current&&clearInterval(O.current)},[R]);const M=n=>{I(g=>({...g,...n,video:{...g.video,...n.video},audio:{...g.audio,...n.audio},output:{...g.output,...n.output}}))},Z=async()=>{try{j("preparing");const n={video:{cursor:s.video.showCursor?"always":"never",frameRate:s.video.frameRate},audio:s.audio.source==="system"||s.audio.source==="both"},g=await navigator.mediaDevices.getDisplayMedia(n);if(s.audio.enabled&&(s.audio.source==="microphone"||s.audio.source==="both"))try{(await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:s.audio.echoCancellation,noiseSuppression:s.audio.noiseSuppression}})).getAudioTracks().forEach(P=>g.addTrack(P))}catch(C){console.warn("Could not access microphone:",C)}W(g),U.current&&(U.current.srcObject=g,U.current.play()),j("idle")}catch(n){j("error"),H==null||H(n instanceof Error?n:new Error("Failed to start preview"))}},z=async()=>{R||await Z();for(let n=3;n>0;n--)T(n),await new Promise(g=>setTimeout(g,1e3));T(null);try{const n=R||await se();if(!n)throw new Error("No stream available");const g=t(s.output.format),C=new MediaRecorder(n,{mimeType:g,videoBitsPerSecond:i(s.output.quality)});v.current=[],C.ondataavailable=B=>{B.data.size>0&&v.current.push(B.data)},C.onstop=()=>{const B=new Blob(v.current,{type:g});b&&(f==null||f({...b,status:"stopped"},B))},x.current=C,C.start(1e3),Q.current=Date.now();const P={id:crypto.randomUUID(),status:"recording",startTime:new Date,duration:0,size:0,options:s,chunks:[]};_(P),j("recording"),m==null||m(P),O.current=setInterval(()=>{_(B=>B?{...B,duration:(Date.now()-Q.current)/1e3,size:v.current.reduce((he,be)=>he+be.size,0)}:null)},100)}catch(n){j("error"),H==null||H(n instanceof Error?n:new Error("Failed to start recording"))}},se=async()=>(await Z(),R),te=()=>{x.current&&y==="recording"&&(x.current.pause(),j("paused"),N==null||N())},J=()=>{x.current&&y==="paused"&&(x.current.resume(),j("recording"),S==null||S())},X=()=>{O.current&&clearInterval(O.current),x.current&&(y==="recording"||y==="paused")&&(x.current.stop(),j("stopped")),R&&(R.getTracks().forEach(n=>n.stop()),W(null))},ee=d.useCallback(n=>{if(y!=="recording")return;const g={id:crypto.randomUUID(),time:(b==null?void 0:b.duration)||0,label:n||`Marker ${k.length+1}`,color:a()};$(C=>[...C,g])},[y,b==null?void 0:b.duration,k.length]),K=n=>{$(g=>g.filter(C=>C.id!==n))},t=n=>{switch(n){case"mp4":return"video/mp4";case"mkv":return"video/x-matroska";default:return"video/webm;codecs=vp9"}},i=n=>{switch(n){case"low":return 25e5;case"medium":return 5e6;case"lossless":return 2e7;default:return 8e6}},a=()=>{const n=["var(--nice-danger, #ff4444)","#44ff44","#4444ff","#ffff44","#ff44ff","#44ffff"];return n[Math.floor(Math.random()*n.length)]},r=n=>{const g=Math.floor(n/3600),C=Math.floor(n%3600/60),P=Math.floor(n%60),B=Math.floor(n%1*100);return g>0?`${g}:${C.toString().padStart(2,"0")}:${P.toString().padStart(2,"0")}`:`${C.toString().padStart(2,"0")}:${P.toString().padStart(2,"0")}.${B.toString().padStart(2,"0")}`},o=n=>n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/1024/1024).toFixed(1)} MB`;return e.jsxs("div",{className:`nice-screen-recorder ${u}`,children:[e.jsxs("div",{className:"recorder__preview",children:[L!==null&&e.jsx("div",{className:"countdown-overlay",children:e.jsx("span",{className:"countdown-number",children:L})}),e.jsx("video",{ref:U,className:"preview-video",muted:!0,playsInline:!0}),A&&e.jsx("canvas",{ref:q,className:"annotation-canvas"}),!R&&y==="idle"&&e.jsx("div",{className:"preview-placeholder",children:e.jsxs("button",{className:"start-preview-button",onClick:Z,children:[e.jsx("span",{className:"icon",children:"đŸ–Ĩī¸"}),e.jsx("span",{children:"Select Screen to Record"})]})}),y==="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:[y==="idle"&&e.jsxs("button",{className:"control-button control-button--record",onClick:z,disabled:!!L,children:[e.jsx("span",{className:"icon",children:"âēī¸"}),e.jsx("span",{children:"Start Recording"})]}),y==="recording"&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"control-button control-button--pause",onClick:te,children:[e.jsx("span",{className:"icon",children:"â¸ī¸"}),e.jsx("span",{children:"Pause"})]}),e.jsxs("button",{className:"control-button control-button--stop",onClick:X,children:[e.jsx("span",{className:"icon",children:"âšī¸"}),e.jsx("span",{children:"Stop"})]})]}),y==="paused"&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"control-button control-button--resume",onClick:J,children:[e.jsx("span",{className:"icon",children:"â–ļī¸"}),e.jsx("span",{children:"Resume"})]}),e.jsxs("button",{className:"control-button control-button--stop",onClick:X,children:[e.jsx("span",{className:"icon",children:"âšī¸"}),e.jsx("span",{children:"Stop"})]})]}),y==="stopped"&&e.jsxs("button",{className:"control-button control-button--new",onClick:()=>{j("idle"),_(null),$([])},children:[e.jsx("span",{className:"icon",children:"🔄"}),e.jsx("span",{children:"New Recording"})]})]}),e.jsxs("div",{className:"controls__secondary",children:[(y==="recording"||y==="paused")&&e.jsxs("button",{className:"control-button control-button--marker",onClick:()=>ee(),children:[e.jsx("span",{className:"icon",children:"🚩"}),e.jsx("span",{children:"Add Marker"})]}),e.jsxs("button",{className:`control-button ${A?"control-button--active":""}`,onClick:()=>E(!A),disabled:y!=="recording",children:[e.jsx("span",{className:"icon",children:"âœī¸"}),e.jsx("span",{children:"Annotate"})]}),e.jsx("button",{className:"control-button control-button--settings",onClick:()=>V(!G),disabled:y==="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:"})," ",r((b==null?void 0:b.duration)||0)]}),e.jsxs("span",{className:"status-item",children:[e.jsx("strong",{children:"Size:"})," ",o((b==null?void 0:b.size)||0)]}),e.jsxs("span",{className:"status-item",children:[e.jsx("strong",{children:"Markers:"})," ",k.length]})]}),e.jsxs("div",{className:"status__quality",children:[s.video.resolution&&e.jsxs("span",{children:[s.video.resolution.width,"x",s.video.resolution.height]}),e.jsxs("span",{children:[s.video.frameRate,"fps"]}),e.jsx("span",{className:s.audio.enabled?"audio-on":"audio-off",children:s.audio.enabled?"🔊":"🔇"})]})]}),A&&y==="recording"&&e.jsxs("div",{className:"recorder__annotation-tools",children:[e.jsx("div",{className:"tool-group",children:["pen","arrow","rectangle","text"].map(n=>e.jsxs("button",{className:`tool-button ${F===n?"tool-button--active":""}`,onClick:()=>ae(n),children:[n==="pen"&&"âœī¸",n==="arrow"&&"âžĄī¸",n==="rectangle"&&"âŦœ",n==="text"&&"T"]},n))}),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(n=>e.jsx("button",{className:`color-button ${re===n?"color-button--active":""}`,style:{backgroundColor:n},onClick:()=>D(n)},n))})]}),k.length>0&&e.jsxs("div",{className:"recorder__markers",children:[e.jsx("h4",{children:"Markers"}),e.jsx("div",{className:"markers-list",children:k.map(n=>e.jsxs("div",{className:"marker-item",style:{borderLeftColor:n.color},children:[e.jsx("span",{className:"marker-time",children:r(n.time)}),e.jsx("input",{type:"text",value:n.label,onChange:g=>{$(C=>C.map(P=>P.id===n.id?{...P,label:g.target.value}:P))},className:"marker-label"}),e.jsx("button",{className:"marker-remove",onClick:()=>K(n.id),children:"×"})]},n.id))})]}),G&&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:()=>V(!1),children:"×"})]}),e.jsxs("div",{className:"settings-section",children:[e.jsx("h4",{children:"Video"}),e.jsxs("label",{children:["Source",e.jsxs("select",{value:s.video.source,onChange:n=>M({video:{...s.video,source:n.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:`${(p=s.video.resolution)==null?void 0:p.width}x${(h=s.video.resolution)==null?void 0:h.height}`,onChange:n=>{const[g,C]=n.target.value.split("x").map(Number);M({video:{...s.video,resolution:{width:g,height:C}}})},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:s.video.frameRate,onChange:n=>M({video:{...s.video,frameRate:parseInt(n.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:s.video.showCursor,onChange:n=>M({video:{...s.video,showCursor:n.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:s.audio.enabled,onChange:n=>M({audio:{...s.audio,enabled:n.target.checked}})}),"Enable Audio"]}),s.audio.enabled&&e.jsxs(e.Fragment,{children:[e.jsxs("label",{children:["Source",e.jsxs("select",{value:s.audio.source,onChange:n=>M({audio:{...s.audio,source:n.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:s.audio.echoCancellation,onChange:n=>M({audio:{...s.audio,echoCancellation:n.target.checked}})}),"Echo Cancellation"]}),e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:s.audio.noiseSuppression,onChange:n=>M({audio:{...s.audio,noiseSuppression:n.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:s.output.format,onChange:n=>M({output:{...s.output,format:n.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:s.output.quality,onChange:n=>M({output:{...s.output,quality:n.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)"})]})]})]})]})]})},Ve={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"}}},ne=[{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:""}],ie=[{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:"🔊"}],Oe=({config:l,onConfigChange:m,onStreamStart:f,onStreamStop:N,onStatsUpdate:S,onError:H,className:u=""})=>{const[s,I]=d.useState(l||Ve),[b,_]=d.useState("sources"),[y,j]=d.useState(!1),[k,$]=d.useState({duration:0,viewers:0,peakViewers:0,bitrate:0,fps:0,droppedFrames:0,cpuUsage:0,memoryUsage:0}),[R,W]=d.useState(null),[L,T]=d.useState(!1),[G,V]=d.useState(!1),[A,E]=d.useState([s.layout]),[F,ae]=d.useState(0),re=d.useRef(null),D=d.useRef(null),x=d.useRef(0);d.useEffect(()=>{l&&I(l)},[l]),d.useEffect(()=>()=>{D.current&&clearInterval(D.current)},[]);const v=d.useCallback(a=>{const r={...s,...a};I(r),m==null||m(r)},[s,m]),U=a=>{const r=ne.find(p=>p.platform===a),o={id:crypto.randomUUID(),name:(r==null?void 0:r.name)||"Custom",platform:a,url:(r==null?void 0:r.defaultUrl)||"",streamKey:"",enabled:!0,status:"idle"};v({destinations:[...s.destinations,o]}),V(!1)},q=(a,r)=>{v({destinations:s.destinations.map(o=>o.id===a?{...o,...r}:o)})},O=a=>{v({destinations:s.destinations.filter(r=>r.id!==a)})},Q=async a=>{const r=ie.find(h=>h.type===a),o={id:crypto.randomUUID(),type:a,name:`${(r==null?void 0:r.name)||a} ${s.sources.filter(h=>h.type===a).length+1}`,settings:{},volume:1,muted:!1};try{if(a==="camera"||a==="microphone"){const h=a==="camera"?{video:!0}:{audio:!0},g=(await navigator.mediaDevices.enumerateDevices()).filter(C=>a==="camera"?C.kind==="videoinput":C.kind==="audioinput");g.length>0&&(o.settings.deviceId=g[0].deviceId)}else(a==="screen"||a==="window")&&await navigator.mediaDevices.getDisplayMedia({video:!0})}catch(h){console.warn(`Could not access ${a}:`,h)}v({sources:[...s.sources,o]});const p={id:crypto.randomUUID(),sourceId:o.id,position:{x:0,y:0},size:{width:s.layout.canvas.width,height:s.layout.canvas.height},visible:!0,opacity:1,zIndex:s.layout.layers.length};v({layout:{...s.layout,layers:[...s.layout.layers,p]}}),T(!1)},M=(a,r)=>{v({sources:s.sources.map(o=>o.id===a?{...o,...r}:o)})},Z=a=>{v({sources:s.sources.filter(r=>r.id!==a),layout:{...s.layout,layers:s.layout.layers.filter(r=>r.sourceId!==a)}})},z=(a,r)=>{v({layout:{...s.layout,layers:s.layout.layers.map(o=>o.id===a?{...o,...r}:o)}})},se=a=>{const r=s.layout.layers.findIndex(o=>o.id===a);if(r<s.layout.layers.length-1){const o=[...s.layout.layers];[o[r],o[r+1]]=[o[r+1],o[r]],o.forEach((p,h)=>{p.zIndex=h}),v({layout:{...s.layout,layers:o}})}},te=a=>{const r=s.layout.layers.findIndex(o=>o.id===a);if(r>0){const o=[...s.layout.layers];[o[r],o[r-1]]=[o[r-1],o[r]],o.forEach((p,h)=>{p.zIndex=h}),v({layout:{...s.layout,layers:o}})}},J=()=>{const a={name:`Scene ${A.length+1}`,canvas:{...s.layout.canvas},layers:[]};E([...A,a])},X=a=>{const r=[...A];r[F]=s.layout,E(r),ae(a),v({layout:A[a]})},ee=async()=>{try{v({destinations:s.destinations.map(a=>a.enabled?{...a,status:"connecting"}:a)}),await new Promise(a=>setTimeout(a,2e3)),v({destinations:s.destinations.map(a=>a.enabled?{...a,status:"live"}:a)}),j(!0),x.current=Date.now(),f==null||f(),D.current=setInterval(()=>{const a={duration:(Date.now()-x.current)/1e3,viewers:Math.floor(Math.random()*100)+k.viewers,peakViewers:Math.max(k.peakViewers,k.viewers),bitrate:s.settings.video.bitrate+Math.floor(Math.random()*500-250),fps:s.settings.video.frameRate-Math.random()*2,droppedFrames:k.droppedFrames+(Math.random()>.95?1:0),cpuUsage:15+Math.random()*30,memoryUsage:40+Math.random()*20};$(a),S==null||S(a)},1e3)}catch(a){H==null||H(a instanceof Error?a:new Error("Failed to start stream")),v({destinations:s.destinations.map(r=>({...r,status:"error"}))})}},K=()=>{D.current&&clearInterval(D.current),v({destinations:s.destinations.map(a=>({...a,status:"idle"}))}),j(!1),N==null||N()},t=a=>{const r=Math.floor(a/3600),o=Math.floor(a%3600/60),p=Math.floor(a%60);return`${r.toString().padStart(2,"0")}:${o.toString().padStart(2,"0")}:${p.toString().padStart(2,"0")}`},i=a=>{switch(a){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 ${u}`,children:[e.jsxs("header",{className:"streaming__header",children:[e.jsxs("div",{className:"header__title",children:[e.jsx("input",{type:"text",value:s.name,onChange:a=>v({name:a.target.value}),className:"stream-name-input"}),y&&e.jsxs("span",{className:"live-badge",children:[e.jsx("span",{className:"live-dot"})," LIVE"]})]}),e.jsx("div",{className:"header__stats",children:y&&e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"stat-item",children:["âąī¸ ",t(k.duration)]}),e.jsxs("span",{className:"stat-item",children:["đŸ‘Ĩ ",k.viewers]}),e.jsxs("span",{className:"stat-item",children:["📊 ",Math.round(k.bitrate)," kbps"]}),e.jsxs("span",{className:"stat-item",children:["đŸŽŦ ",k.fps.toFixed(1)," fps"]})]})}),e.jsx("div",{className:"header__actions",children:y?e.jsx("button",{className:"action-button action-button--stop",onClick:K,children:"End Stream"}):e.jsx("button",{className:"action-button action-button--go-live",onClick:ee,disabled:s.destinations.filter(a=>a.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:[A.map((a,r)=>e.jsx("button",{className:`scene-button ${F===r?"scene-button--active":""}`,onClick:()=>X(r),children:a.name},r)),e.jsx("button",{className:"scene-button scene-button--add",onClick:J,children:"+"})]}),e.jsx("div",{ref:re,className:"preview-canvas",style:{aspectRatio:`${s.layout.canvas.width}/${s.layout.canvas.height}`,backgroundColor:s.layout.canvas.backgroundColor},children:s.layout.layers.sort((a,r)=>a.zIndex-r.zIndex).map(a=>{var o;const r=s.sources.find(p=>p.id===a.sourceId);return!a.visible||!r?null:e.jsx("div",{className:`canvas-layer ${R===a.id?"canvas-layer--selected":""}`,style:{left:`${a.position.x/s.layout.canvas.width*100}%`,top:`${a.position.y/s.layout.canvas.height*100}%`,width:`${a.size.width/s.layout.canvas.width*100}%`,height:`${a.size.height/s.layout.canvas.height*100}%`,opacity:a.opacity,zIndex:a.zIndex},onClick:()=>W(a.id),children:e.jsxs("div",{className:"layer-content",children:[e.jsx("span",{className:"layer-icon",children:((o=ie.find(p=>p.type===r.type))==null?void 0:o.icon)||"đŸ“Ļ"}),e.jsx("span",{className:"layer-name",children:r.name})]})},a.id)})})]}),e.jsxs("aside",{className:"streaming__panel",children:[e.jsx("div",{className:"panel-tabs",children:["sources","audio","destinations","settings"].map(a=>e.jsx("button",{className:`panel-tab ${b===a?"panel-tab--active":""}`,onClick:()=>_(a),children:a.charAt(0).toUpperCase()+a.slice(1)},a))}),e.jsxs("div",{className:"panel-content",children:[b==="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:()=>T(!0),disabled:y,children:"+ Add"})]}),e.jsx("div",{className:"sources-list",children:s.sources.filter(a=>a.type!=="microphone"&&a.type!=="system-audio").map(a=>{var o;const r=s.layout.layers.find(p=>p.sourceId===a.id);return e.jsxs("div",{className:`source-item ${R===(r==null?void 0:r.id)?"source-item--selected":""}`,onClick:()=>r&&W(r.id),children:[e.jsx("span",{className:"source-icon",children:(o=ie.find(p=>p.type===a.type))==null?void 0:o.icon}),e.jsx("span",{className:"source-name",children:a.name}),e.jsxs("div",{className:"source-controls",children:[e.jsx("button",{className:r!=null&&r.visible?"":"inactive",onClick:p=>{p.stopPropagation(),r&&z(r.id,{visible:!r.visible})},children:r!=null&&r.visible?"đŸ‘ī¸":"đŸ‘ī¸â€đŸ—¨ī¸"}),e.jsx("button",{onClick:p=>{p.stopPropagation(),r&&se(r.id)},children:"âŦ†ī¸"}),e.jsx("button",{onClick:p=>{p.stopPropagation(),r&&te(r.id)},children:"âŦ‡ī¸"}),e.jsx("button",{onClick:p=>{p.stopPropagation(),Z(a.id)},disabled:y,children:"đŸ—‘ī¸"})]})]},a.id)})}),R&&e.jsxs("div",{className:"layer-properties",children:[e.jsx("h4",{children:"Properties"}),(()=>{const a=s.layout.layers.find(r=>r.id===R);return a?e.jsxs(e.Fragment,{children:[e.jsxs("label",{children:["X Position",e.jsx("input",{type:"number",value:a.position.x,onChange:r=>z(a.id,{position:{...a.position,x:parseInt(r.target.value)||0}})})]}),e.jsxs("label",{children:["Y Position",e.jsx("input",{type:"number",value:a.position.y,onChange:r=>z(a.id,{position:{...a.position,y:parseInt(r.target.value)||0}})})]}),e.jsxs("label",{children:["Width",e.jsx("input",{type:"number",value:a.size.width,onChange:r=>z(a.id,{size:{...a.size,width:parseInt(r.target.value)||100}})})]}),e.jsxs("label",{children:["Height",e.jsx("input",{type:"number",value:a.size.height,onChange:r=>z(a.id,{size:{...a.size,height:parseInt(r.target.value)||100}})})]}),e.jsxs("label",{children:["Opacity",e.jsx("input",{type:"range",min:"0",max:"1",step:"0.1",value:a.opacity,onChange:r=>z(a.id,{opacity:parseFloat(r.target.value)})})]})]}):null})()]})]}),b==="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:()=>{T(!0)},disabled:y,children:"+ Add"})]}),e.jsxs("div",{className:"audio-sources",children:[s.sources.filter(a=>a.type==="microphone"||a.type==="system-audio"||a.type==="video").map(a=>{var r;return e.jsxs("div",{className:"audio-source",children:[e.jsxs("div",{className:"audio-header",children:[e.jsx("span",{className:"audio-icon",children:(r=ie.find(o=>o.type===a.type))==null?void 0:r.icon}),e.jsx("span",{className:"audio-name",children:a.name}),e.jsx("button",{className:a.muted?"muted":"",onClick:()=>M(a.id,{muted:!a.muted}),children:a.muted?"🔇":"🔊"})]}),e.jsxs("div",{className:"audio-slider",children:[e.jsx("input",{type:"range",min:"0",max:"1",step:"0.01",value:a.volume??1,onChange:o=>M(a.id,{volume:parseFloat(o.target.value)}),disabled:a.muted}),e.jsxs("span",{className:"volume-value",children:[Math.round((a.volume??1)*100),"%"]})]}),e.jsx("div",{className:"audio-meter",children:e.jsx("div",{className:"meter-fill",style:{width:`${(a.volume??1)*70+Math.random()*30}%`}})})]},a.id)}),s.sources.filter(a=>a.type==="microphone"||a.type==="system-audio").length===0&&e.jsx("p",{className:"empty-message",children:"No audio sources added"})]})]}),b==="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:()=>V(!0),disabled:y,children:"+ Add"})]}),e.jsxs("div",{className:"destinations-list",children:[s.destinations.map(a=>{var r;return e.jsxs("div",{className:"destination-item",children:[e.jsxs("div",{className:"destination-header",children:[e.jsx("span",{className:"status-indicator",style:{backgroundColor:i(a.status)}}),e.jsx("span",{className:"destination-icon",children:(r=ne.find(o=>o.platform===a.platform))==null?void 0:r.icon}),e.jsx("span",{className:"destination-name",children:a.name}),e.jsxs("label",{className:"toggle",children:[e.jsx("input",{type:"checkbox",checked:a.enabled,onChange:o=>q(a.id,{enabled:o.target.checked}),disabled:y}),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:a.url,onChange:o=>q(a.id,{url:o.target.value}),placeholder:"rtmp://...",disabled:y})]}),e.jsxs("label",{children:["Stream Key",e.jsx("input",{type:"password",value:a.streamKey||"",onChange:o=>q(a.id,{streamKey:o.target.value}),placeholder:"Enter stream key",disabled:y})]})]}),e.jsx("button",{className:"remove-button",onClick:()=>O(a.id),disabled:y,children:"Remove"})]},a.id)}),s.destinations.length===0&&e.jsx("p",{className:"empty-message",children:"No destinations configured"})]})]}),b==="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:`${s.settings.video.resolution.width}x${s.settings.video.resolution.height}`,onChange:a=>{const[r,o]=a.target.value.split("x").map(Number);v({settings:{...s.settings,video:{...s.settings.video,resolution:{width:r,height:o}}},layout:{...s.layout,canvas:{...s.layout.canvas,width:r,height:o}}})},disabled:y,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:s.settings.video.frameRate,onChange:a=>v({settings:{...s.settings,video:{...s.settings.video,frameRate:parseInt(a.target.value)}}}),disabled:y,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:s.settings.video.bitrate,onChange:a=>v({settings:{...s.settings,video:{...s.settings.video,bitrate:parseInt(a.target.value)||6e3}}}),min:"1000",max:"50000",disabled:y})]}),e.jsxs("label",{children:["Keyframe Interval (sec)",e.jsx("input",{type:"number",value:s.settings.video.keyframe,onChange:a=>v({settings:{...s.settings,video:{...s.settings.video,keyframe:parseInt(a.target.value)||2}}}),min:"1",max:"10",disabled:y})]})]}),e.jsxs("div",{className:"setting-section",children:[e.jsx("h4",{children:"Audio"}),e.jsxs("label",{children:["Sample Rate",e.jsxs("select",{value:s.settings.audio.sampleRate,onChange:a=>v({settings:{...s.settings,audio:{...s.settings.audio,sampleRate:parseInt(a.target.value)}}}),disabled:y,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:s.settings.audio.bitrate,onChange:a=>v({settings:{...s.settings,audio:{...s.settings.audio,bitrate:parseInt(a.target.value)}}}),disabled:y,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"})]})]})]})]})]})]})]}),y&&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:[k.cpuUsage.toFixed(1),"%"]})]}),e.jsxs("span",{className:"stat",children:[e.jsx("label",{children:"Memory"}),e.jsxs("span",{className:"value",children:[k.memoryUsage.toFixed(1),"%"]})]}),e.jsxs("span",{className:"stat",children:[e.jsx("label",{children:"Dropped"}),e.jsx("span",{className:"value",children:k.droppedFrames})]}),e.jsxs("span",{className:"stat",children:[e.jsx("label",{children:"Peak Viewers"}),e.jsx("span",{className:"value",children:k.peakViewers})]})]})}),L&&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:()=>T(!1),children:"×"})]}),e.jsx("div",{className:"modal-content",children:e.jsx("div",{className:"source-type-grid",children:ie.map(a=>e.jsxs("button",{className:"source-type-button",onClick:()=>Q(a.type),children:[e.jsx("span",{className:"icon",children:a.icon}),e.jsx("span",{className:"name",children:a.name})]},a.type))})})]})}),G&&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:()=>V(!1),children:"×"})]}),e.jsx("div",{className:"modal-content",children:e.jsx("div",{className:"platform-grid",children:ne.map(a=>e.jsxs("button",{className:"platform-button",onClick:()=>U(a.platform),children:[e.jsx("span",{className:"icon",children:a.icon}),e.jsx("span",{className:"name",children:a.name})]},a.platform))})})]})})]})};exports.NiceLiveStreaming=Oe;exports.NiceScreenRecorder=Le;exports.NiceVideoEditor=Fe;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { default as default_2 } from 'react';
2
+ import { NiceComponentTutorial } from '@nice2dev/ui-core';
2
3
 
3
4
  export declare type DestinationStatus = 'idle' | 'connecting' | 'live' | 'error' | 'disconnected';
4
5
 
@@ -65,6 +66,8 @@ export declare interface NiceVideoEditorProps {
65
66
  onExport?: (project: VideoProject, format: string) => Promise<Blob>;
66
67
  onAssetUpload?: (file: File) => Promise<MediaAsset>;
67
68
  className?: string;
69
+ /** Optional "?" guided tour. Off by default; `true` uses the built-in tour. */
70
+ tutorial?: NiceComponentTutorial;
68
71
  }
69
72
 
70
73
  export declare interface NiceVideoPlayerProps {
@@ -293,10 +296,6 @@ export declare interface Transition {
293
296
 
294
297
  export declare type TransitionType = 'fade' | 'dissolve' | 'wipe' | 'slide' | 'zoom' | 'push' | 'reveal' | 'barn' | 'iris';
295
298
 
296
- /**
297
- * @package @nice2dev/ui-video
298
- * Video Components Type Definitions
299
- */
300
299
  export declare interface VideoProject {
301
300
  id: string;
302
301
  name: string;