PageSourceSearch

https://app.minbarlive.com/_next/static/chunks/1774.3c49a958d1e43578.js

js minbarlive.com collected 2026-09-24 14:16:52 UTC 47,132 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1774],{8803:(e,t,s)=>{s.d(t,{A:()=>a});let a=(0,s(71847).A)("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]])},21397:(e,t,s)=>{s.d(t,{A:()=>a});let a=(0,s(71847).A)("Maximize",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]])},26983:(e,t,s)=>{s.d(t,{A:()=>a});let a=(0,s(71847).A)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]])},31959:(e,t,s)=>{s.d(t,{A:()=>a});let a=(0,s(71847).A)("Minimize",[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]])},37586:(e,t,s)=>{s.d(t,{A:()=>a});let a=(0,s(71847).A)("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]])},57828:(e,t,s)=>{s.d(t,{A:()=>a});let a=(0,s(71847).A)("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},89559:(e,t,s)=>{s.d(t,{A:()=>a});let a=(0,s(71847).A)("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},91774:(e,t,s)=>{s.r(t),s.d(t,{default:()=>J});var a=s(95155),d=s(52619),i=s.n(d),l=s(35299),r=s(35626),o=s(22064),n=s(23876),c=s(7877),p=s(37586),u=s(26983),x=s(57828),m=s(12108),b=s(24033),h=s(89559),g=s(85921),v=s(59e3),f=s(93499),j=s(17181),y=s(54690),N=s(12115),w=s(55490),S=s(2251),F=s(67720);let k=e=>{let{session:t}=e;return(0,a.jsxs)("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4","data-testid":"podcast-detail-stats-grid",children:[(0,a.jsxs)("div",{className:"p-4 bg-[#F8FAFC] rounded-lg","data-testid":"podcast-detail-stat-messages",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsx)("span",{className:"text-xs text-[#475569]","data-testid":"podcast-detail-stat-messages-label",children:"Messages"}),(0,a.jsx)(p.A,{size:14,className:"text-[#0F766E]"})]}),(0,a.jsx)("p",{className:"text-2xl font-semibold text-[#0F172A]","data-testid":"podcast-detail-stat-messages-value",children:t.podcast.message_count||t.messages.length||0})]}),(0,a.jsxs)("div",{className:"p-4 bg-[#F8FAFC] rounded-lg","data-testid":"podcast-detail-stat-status",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsx)("span",{className:"text-xs text-[#475569]","data-testid":"podcast-detail-stat-status-label",children:"Status"}),(0,a.jsx)(u.A,{size:14,className:"text-[#0F766E]"})]}),(0,a.jsx)("p",{className:"text-lg font-semibold text-[#0F172A] capitalize","data-testid":"podcast-detail-stat-status-value",children:t.podcast.status||"draft"})]}),t.streamId&&(0,a.jsxs)("div",{className:"p-4 bg-[#F8FAFC] rounded-lg","data-testid":"podcast-detail-stat-connection",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsx)("span",{className:"text-xs text-[#475569]","data-testid":"podcast-detail-stat-connection-label",children:"Connection"}),(0,a.jsx)(x.A,{size:14,className:"text-[#0F766E]"})]}),(0,a.jsx)("p",{className:"text-sm font-semibold capitalize ".concat("connected"===t.connectionStatus?"text-green-700":"text-yellow-700"),"data-testid":"podcast-detail-stat-connection-value",children:t.connectionStatus})]})]})},C=e=>{let{session:t}=e;return 0===t.messages.length?null:(0,a.jsxs)("div",{className:"bg-white border border-[#CBD5E1] rounded-xl shadow-sm overflow-hidden","data-testid":"podcast-detail-transcript-preview",children:[(0,a.jsxs)("div",{className:"border-b border-[#CBD5E1] px-6 py-3 flex items-center justify-between","data-testid":"podcast-detail-transcript-preview-header",children:[(0,a.jsxs)("h3",{className:"text-sm font-semibold text-[#0F172A]","data-testid":"podcast-detail-transcript-preview-title",children:["Transcript (",t.messages.length," segments)"]}),(0,a.jsx)("span",{className:"text-xs text-[#94A3B8]","data-testid":"podcast-detail-transcript-preview-status",children:t.connectionStatus})]}),(0,a.jsx)("div",{className:"p-4 max-h-[300px] overflow-y-auto space-y-2","data-testid":"podcast-detail-transcript-preview-list",children:t.messages.slice(-10).map(e=>(0,a.jsxs)("div",{className:"p-3 bg-[#F8FAFC] rounded-lg","data-testid":"podcast-detail-transcript-preview-item-".concat(e.id),children:[(0,a.jsx)("p",{className:"text-sm text-[#0F172A]","data-testid":"podcast-detail-transcript-preview-item-".concat(e.id,"-original"),children:e.original||e.text}),e.translated&&e.translated!==e.original&&(0,a.jsx)("p",{className:"text-xs text-[#0F766E] mt-1 italic","data-testid":"podcast-detail-transcript-preview-item-".concat(e.id,"-translated"),children:e.translated})]},e.id))})]})},A={processing:"Processing transcript...",completed:"Transcript ready",error:"Transcript processing failed",empty:"No speech detected"},E=e=>{let{podcast:t,onReprocess:s}=e,[d,i]=(0,N.useState)(!1),[l,r]=(0,N.useState)(!1),o=t.transcript_status,n="completed"===o&&(t.refined_transcript||t.raw_transcript),c=t.refined_transcript||t.raw_transcript||"",p=(0,N.useCallback)(async()=>{r(!0);try{await (0,w.apiRequest)("/api/admin/podcasts/".concat(t.podcast_id,"/reprocess-transcript"),{method:"POST"}),null==s||s()}catch(e){}finally{r(!1)}},[t.podcast_id,s]);return o?(0,a.jsxs)("div",{className:"bg-white border border-[#CBD5E1] rounded-xl shadow-sm overflow-hidden mt-4","data-testid":"podcast-transcript-section",children:[(0,a.jsxs)("div",{className:"border-b border-[#CBD5E1] px-6 py-3 flex items-center justify-between","data-testid":"podcast-transcript-section-header",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-[#0F172A]","data-testid":"podcast-transcript-title",children:"Session Transcript"}),(0,a.jsx)("span",{className:"text-xs px-2 py-0.5 rounded-full font-medium ".concat("completed"===o?"bg-green-100 text-green-700":"processing"===o?"bg-amber-100 text-amber-700":"error"===o?"bg-red-100 text-red-700":"bg-gray-100 text-gray-500"),"data-testid":"podcast-transcript-status",children:A[o]||o})]}),(0,a.jsxs)("div",{className:"p-6 space-y-4","data-testid":"podcast-transcript-body",children:[t.ai_summary&&(0,a.jsxs)("div",{"data-testid":"podcast-transcript-summary",children:[(0,a.jsx)("p",{className:"text-xs font-semibold text-[#475569] uppercase tracking-wide mb-2",children:"AI Summary"}),(0,a.jsx)("p",{className:"text-sm text-[#0F172A] leading-relaxed whitespace-pre-wrap","data-testid":"podcast-transcript-summary-text",children:t.ai_summary})]}),n&&(0,a.jsxs)("div",{"data-testid":"podcast-transcript-full",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>i(e=>!e),className:"flex items-center gap-2 text-xs font-semibold text-[#0F766E] hover:text-[#134E4A] transition-colors","data-testid":"podcast-transcript-toggle",children:[d?(0,a.jsx)(m.A,{size:14}):(0,a.jsx)(b.A,{size:14}),d?"Hide full transcript":"Show full transcript (".concat(t.message_count||0," segments)")]}),d&&(0,a.jsx)("div",{className:"mt-3 max-h-[400px] overflow-y-auto p-4 bg-[#F8FAFC] rounded-lg border border-[#
1E2E8F0]","data-testid":"podcast-transcript-text",children:(0,a.jsx)("pre",{className:"text-xs text-[#334155] leading-relaxed whitespace-pre-wrap font-sans",children:c})})]}),"processing"!==o&&(0,a.jsxs)("button",{type:"button",onClick:p,disabled:l,className:"flex items-center gap-2 px-4 py-2 text-xs font-medium border border-[#CBD5E1] text-[#475569] rounded-lg hover:border-[#0F766E] hover:text-[#0F766E] transition-colors disabled:opacity-50","data-testid":"podcast-transcript-reprocess-btn",children:[(0,a.jsx)(h.A,{size:13,className:l?"animate-spin":""}),l?"Starting reprocess...":"Reprocess transcript"]})]})]}):null},D=e=>{let{session:t}=e,{t:s}=(0,F.s9)(),d="microphone"===t.selectedAudioSource||"mic"===t.selectedAudioSource;return(0,a.jsxs)("div",{className:"space-y-6","data-testid":"podcast-detail-control-panel",children:[(0,a.jsxs)("div",{className:"bg-white border border-[#CBD5E1] rounded-xl shadow-sm overflow-hidden","data-testid":"podcast-detail-control-card",children:[(0,a.jsx)("div",{className:"border-b border-[#CBD5E1] px-6 py-3","data-testid":"podcast-detail-control-card-header",children:(0,a.jsx)("span",{className:"px-3 py-2 text-sm font-medium text-[#0F766E] border-b-2 border-[#0F766E]","data-testid":"podcast-detail-control-card-title",children:"Transcription Control"})}),(0,a.jsxs)("div",{className:"p-6 space-y-5","data-testid":"podcast-detail-control-card-body",children:[(0,a.jsx)(k,{session:t}),!t.isEnded&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.y,{selectedLanguage:t.selectedSourceLang,onSelect:t.setSelectedSourceLang,testIdPrefix:"podcast-detail"}),t.selectedAudioSource||t.isStreaming?(0,a.jsxs)("div",{className:"space-y-3","data-testid":"podcast-detail-capture-state",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2","data-testid":"podcast-detail-capture-state-badge-row",children:[(0,a.jsx)("div",{className:"w-2 h-2 bg-red-500 rounded-full animate-pulse"}),(0,a.jsx)("span",{className:"text-sm font-semibold text-red-600","data-testid":"podcast-detail-capture-state-badge",children:s(t.selectedAudioSource?"podcastDetail.capturingAudio":"podcastDetail.streamActive")})]}),t.selectedAudioSource&&(0,a.jsxs)("p",{className:"text-sm text-[#475569]","data-testid":"podcast-detail-capture-source",children:["Source: ",s(d?"podcastDetail.browserMicrophone":"podcastDetail.browserTabAudio")]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-3","data-testid":"podcast-detail-capture-actions",children:[t.selectedAudioSource&&(0,a.jsxs)("button",{type:"button",onClick:t.handleStopCapture,className:"flex items-center gap-2 px-4 py-2 bg-orange-500 hover:bg-orange-600 text-white text-sm font-semibold rounded-lg transition-colors","data-testid":"podcast-detail-stop-capture-btn",children:[(0,a.jsx)(v.A,{size:14}),(0,a.jsx)("span",{"data-testid":"podcast-detail-stop-capture-btn-label",children:s("podcastDetail.stopCapture")})]}),!t.selectedAudioSource&&t.isStreaming&&(0,a.jsxs)("button",{type:"button",onClick:t.handleStartTranscription,className:"flex items-center gap-2 px-4 py-2 bg-green-600 hover:bg-green-700 text-white text-sm font-semibold rounded-lg transition-colors","data-testid":"podcast-detail-restart-capture-btn",children:[(0,a.jsx)(g.A,{size:14}),(0,a.jsx)("span",{"data-testid":"podcast-detail-restart-capture-btn-label",children:s("podcastDetail.restartCapture")})]}),(0,a.jsxs)("button",{type:"button",onClick:t.handleEndSession,disabled:t.stoppingStream,className:"flex items-center gap-2 px-4 py-2 bg-red-600 hover:bg-red-700 text-white text-sm font-semibold rounded-lg transition-colors disabled:opacity-50","data-testid":"podcast-detail-end-btn",children:[t.stoppingStream?(0,a.jsx)(l.A,{size:14,className:"animate-spin"}):(0,a.jsx)(v.A,{size:14}),(0,a.jsx)("span",{"data-testid":"podcast-detail-end-btn-label",children:s("podcastDetail.endEntireSession")})]})]}),(0,a.jsx)("p",{className:"text-xs text-[#94A3B8]","data-testid":"podcast-detail-capture-help",children:"“Stop capture” pauses audio capture so you can switch source. “End session” stops the stream permanently."}),(0,a.jsxs)("p",{className:"text-xs text-[#94A3B8]","data-testid":"podcast-detail-audio-state",children:["Audio capture state: ",t.audioCaptureState]})]}):(0,a.jsxs)("button",{type:"button",onClick:t.handleStartTranscription,className:"flex items-center gap-2 px-5 py-2.5 bg-green-600 hover:bg-green-700 text-white text-sm font-semibold rounded-lg transition-colors","data-testid":"podcast-detail-start-btn",children:[(0,a.jsx)(g.A,{size:16}),(0,a.jsx)("span",{"data-testid":"podcast-detail-start-btn-label",children:s("podcastDetail.startTranscription")})]})]}),t.isEnded&&(0,a.jsx)("div",{className:"p-4 bg-[#F8FAFC] rounded-lg text-center","data-testid":"podcast-detail-ended-state",children:(0,a.jsx)("p",{className:"text-sm text-[#475569]","data-testid":"podcast-detail-ended-state-label",children:s("podcastDetail.sessionHasEnded")})})]})]}),(0,a.jsx)(C,{session:t}),t.isEnded&&(0,a.jsx)(E,{podcast:t.podcast,onReprocess:()=>{var e;return null==(e=t.fetchPodcast)?void 0:e.call(t)},"data-testid":"podcast-transcript-section-wrapper"}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-3","data-testid":"podcast-detail-action-buttons",children:[(0,a.jsxs)("button",{type:"button",onClick:t.handleOpenLive
1View,className:"flex items-center gap-2 px-4 py-2.5 bg-[#0F766E] hover:bg-[#14B8A6] text-white text-sm font-semibold rounded-lg transition-colors","data-testid":"podcast-detail-open-btn",children:[(0,a.jsx)(f.A,{size:16}),(0,a.jsx)("span",{"data-testid":"podcast-detail-open-btn-label",children:s("podcastDetail.openLiveView")})]}),(0,a.jsxs)("button",{type:"button",onClick:t.handleShare,className:"flex items-center gap-2 px-4 py-2.5 bg-white border border-[#CBD5E1] text-[#475569] text-sm font-medium rounded-lg hover:border-[#0F766E] hover:text-[#0F766E] transition-colors","data-testid":"podcast-detail-share-btn",children:[(0,a.jsx)(j.A,{size:16}),(0,a.jsx)("span",{"data-testid":"podcast-detail-share-btn-label",children:"Share"})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>t.setShowQrModal(!0),className:"flex items-center gap-2 px-4 py-2.5 bg-white border border-[#CBD5E1] text-[#475569] text-sm font-medium rounded-lg hover:border-[#0F766E] hover:text-[#0F766E] transition-colors","data-testid":"podcast-detail-qr-btn",children:[(0,a.jsx)(y.A,{size:16}),(0,a.jsx)("span",{"data-testid":"podcast-detail-qr-btn-label",children:s("podcastSessions.qrCode")})]}),!t.isEnded&&(0,a.jsx)("button",{type:"button",onClick:t.handleSetLive,className:"px-4 py-2.5 bg-white border border-[#CBD5E1] text-[#475569] text-sm font-medium rounded-lg hover:border-[#0F766E] hover:text-[#0F766E] transition-colors","data-testid":"podcast-detail-set-live-btn",children:"Set Live"})]})]})};var z=s(71360);let _=e=>{let{podcast:t,statusLabel:s,isEnded:d,stoppingStream:i,onEndSession:l,onDelete:r}=e,{t:o}=(0,F.s9)();return(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4","data-testid":"podcast-detail-header",children:[(0,a.jsxs)("div",{"data-testid":"podcast-detail-header-main",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 flex-wrap","data-testid":"podcast-detail-title-row",children:[(0,a.jsx)("h1",{className:"text-xl sm:text-2xl font-semibold text-[#0F172A]","data-testid":"podcast-detail-title",children:t.title}),(0,a.jsxs)("span",{className:"px-3 py-1 text-xs font-semibold rounded-full ".concat("Live"===s?"bg-red-100 text-red-700":"Ended"===s?"bg-[#CBD5E1] text-[#475569]":"Draft"===s?"bg-blue-100 text-blue-700":"bg-green-100 text-green-700"),"data-testid":"podcast-detail-status",children:["Live"===s&&(0,a.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-red-600 rounded-full animate-pulse mr-1.5"}),s]})]}),t.speaker_name&&(0,a.jsxs)("p",{className:"text-sm text-[#475569] mt-1","data-testid":"podcast-detail-speaker",children:["Speaker: ",t.speaker_name]}),(0,a.jsxs)("p",{className:"text-xs text-[#94A3B8] mt-1","data-testid":"podcast-detail-created-at",children:["Created ",new Date(t.created_at).toLocaleDateString("bs",{day:"numeric",month:"short",year:"numeric"})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2","data-testid":"podcast-detail-header-actions",children:[!d&&(0,a.jsx)("button",{type:"button",onClick:l,disabled:i,className:"px-4 py-2 bg-[#D4AF37] text-white text-sm font-semibold rounded-lg hover:bg-[#C49B2F] transition-colors disabled:opacity-50","data-testid":"podcast-detail-end-session",children:i?o("podcastDetail.ending"):"End Session"}),(0,a.jsx)("button",{type:"button",onClick:r,className:"p-2 border border-[#CBD5E1] rounded-lg hover:bg-red-50 hover:border-red-300 transition-colors",title:"Delete","data-testid":"podcast-detail-delete",children:(0,a.jsx)(z.A,{size:18,className:"text-[#475569]"})})]})]})};var B=s(39068),T=s(31959),L=s(21397),M=s(8803),q=s(42529);let R=e=>{let{session:t}=e,{t:s}=(0,F.s9)(),d=t.messages.length>0?t.messages[t.messages.length-1]:null,r=d&&t.getTranslatedText(d)||"",o=(0,N.useRef)(null),[n,c]=(0,N.useState)(!0),[p,u]=(0,N.useState)(0),x=(0,N.useRef)(0),m=(0,N.useRef)(null),b=(0,N.useCallback)(()=>{let e=o.current;if(!e)return;u(0);let t=Math.max(0,e.scrollHeight-e.clientHeight);m.current=1>=Math.abs(e.scrollTop-t)?null:t;try{"function"==typeof e.scrollTo?e.scrollTo({top:e.scrollHeight,behavior:"auto"}):e.scrollTop=e.scrollHeight}catch(t){e.scrollTop=e.scrollHeight}null!==m.current&&Math.abs(e.scrollTop-t)>1&&(m.current=null)},[]),h=(0,N.useCallback)(e=>{let t=e.currentTarget,s=null!==m.current&&1>=Math.abs(t.scrollTop-m.current);if(m.current=null,s)return;let a=t.scrollHeight-t.scrollTop-t.clientHeight<=120;c(a),a&&u(0)},[]),g=(0,N.useCallback)(()=>{c(!0),b()},[b]);return(0,N.useEffect)(()=>
1{if(!n){let e=Math.max(0,t.messages.length-x.current);x.current=t.messages.length,e>0&&u(t=>t+e);return}x.current=t.messages.length,b()},[t.messages,n,b]),(0,a.jsxs)("div",{className:"space-y-4","data-testid":"podcast-detail-live",children:[(0,a.jsx)(i(),{href:"/podcast-companion/sessions",className:"inline-flex items-center gap-2 text-xs sm:text-sm text-[#475569] hover:text-[#0F172A]","data-testid":"podcast-detail-live-back-link",children:(0,a.jsx)("span",{"data-testid":"podcast-detail-live-back-link-label",children:s("podcast.back")})}),(0,a.jsxs)("div",{ref:t.fullscreenContainerRef,className:"bg-white border border-[#CBD5E1] rounded-xl shadow-sm overflow-hidden ".concat(t.isFullscreen?"fixed inset-0 z-50 rounded-none border-none":""),"data-testid":"podcast-live-container",children:[(0,a.jsxs)("div",{className:"flex flex-col lg:flex-row lg:items-center justify-between px-4 sm:px-6 py-3 border-b border-[#CBD5E1] bg-gradient-to-r from-[#F0FDFA] to-white gap-2","data-testid":"podcast-detail-live-header",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 min-w-0","data-testid":"podcast-detail-live-title-group",children:[(0,a.jsx)("div",{className:"w-2 h-2 bg-red-500 rounded-full animate-pulse flex-shrink-0"}),(0,a.jsx)("h2",{className:"text-sm sm:text-base font-semibold text-[#0F172A] truncate","data-testid":"podcast-detail-live-title",children:t.podcast.title}),(0,a.jsx)("span",{className:"text-xs font-semibold text-red-600 flex-shrink-0","data-testid":"podcast-detail-live-status",children:s("public.liveNow")})]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2","data-testid":"podcast-detail-live-header-actions",children:[(0,a.jsxs)("span",{className:"flex items-center gap-1.5 px-2.5 py-1 bg-[#F8FAFC] border border-[#CBD5E1] rounded-lg text-xs text-[#475569]","data-testid":"podcast-detail-live-language-pill",children:[(0,a.jsx)(B.A,{size:12}),t.selectedTranslationLang]}),(0,a.jsx)("span",{className:"px-2 py-1 rounded text-xs font-medium ".concat("connected"===t.connectionStatus?"bg-green-100 text-green-700":"bg-yellow-100 text-yellow-700"),"data-testid":"podcast-detail-live-connection-status",children:"connected"===t.connectionStatus?s("podcast.connectionConnected"):s("podcast.connectionConnecting")}),(0,a.jsxs)("button",{type:"button",onClick:t.handleShare,className:"flex items-center gap-1.5 px-2.5 py-1 bg-[#0F766E] text-white rounded-lg text-xs font-medium hover:bg-[#14B8A6] transition-colors","data-testid":"podcast-live-share-btn",children:[(0,a.jsx)(j.A,{size:12}),(0,a.jsx)("span",{"data-testid":"podcast-live-share-btn-label",children:s("podcast.shareLink")})]}),(0,a.jsx)("button",{type:"button",onClick:t.toggleFullscreen,className:"p-1.5 bg-white border border-[#CBD5E1] rounded-lg text-[#475569] hover:border-[#0F766E] transition-colors",title:t.isFullscreen?s("podcast.exitFullscreen"):s("podcast.fullscreen"),"data-testid":"podcast-fullscreen-btn",children:t.isFullscreen?(0,a.jsx)(T.A,{size:14}):(0,a.jsx)(L.A,{size:14})}),(0,a.jsx)("button",{type:"button",onClick:()=>t.setShowSubtitleControls(!t.showSubtitleControls),className:"p-1.5 rounded-lg transition-colors ".concat(t.showSubtitleControls?"bg-[#0F766E] text-white":"bg-white border border-[#CBD5E1] text-[#475569] hover:border-[#0F766E]"),title:s("podcast.subtitleSettings"),"data-testid":"podcast-subtitle-settings-btn",children:(0,a.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,a.jsx)("rect",{x:"1",y:"4",width:"22",height:"16",rx:"2"}),(0,a.jsx)("line",{x1:"1",y1:"14",x2:"23",y2:"14"})]})})]})]}),t.showSubtitleControls&&(0,a.jsxs)("div",{className:"px-4 sm:px-6 py-2.5 border-b border-[#CBD5E1] bg-[#F8FAFC] flex flex-wrap items-center gap-3 text-xs","data-testid":"podcast-subtitle-controls",children:[(0,a.jsx)("span",{className:"text-[#475569] font-medium","data-testid":"podcast-subtitle-controls-size-label",children:s("studio.size")}),[{key:"S",value:14},{key:"M",value:17},{key:"L",value:24}].map(e=>(0,a.jsx)("button",{type:"button",onClick:()=>t.setSubtitleSettings(t=>({...t,fontSize:e.value})),className:"px-2 py-1 rounded-md font-semibold ".concat(t.subtitleSettings.fontSize===e.value?"bg-[#0F766E] text-white":"bg-white border border-[#CBD5E1] text-[#475569]"),"data-testid":"podcast-sub-size-".concat(e.key),children:e.key},e.key)),(0,a.jsx)("span",{className:"text-[#CBD5E1]","data-testid":"podcast-subtitle-control
1s-divider-size-color",children:"|"}),(0,a.jsx)("span",{className:"text-[#475569] font-medium","data-testid":"podcast-subtitle-controls-color-label",children:s("studio.color")}),[{key:"white",value:"#FFFFFF",label:"W"},{key:"yellow",value:"#FFD700",label:"Y"},{key:"cyan",value:"#00FFFF",label:"C"}].map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>t.setSubtitleSettings(t=>({...t,color:e.value})),className:"px-2 py-1 rounded-md font-semibold flex items-center gap-1 ".concat(t.subtitleSettings.color===e.value?"bg-[#0F766E] text-white":"bg-white border border-[#CBD5E1] text-[#475569]"),"data-testid":"podcast-sub-color-".concat(e.key),children:[(0,a.jsx)("span",{className:"w-2.5 h-2.5 rounded-full border border-[#CBD5E1]",style:{background:e.value}}),e.label]},e.key)),(0,a.jsx)("span",{className:"text-[#CBD5E1]","data-testid":"podcast-subtitle-controls-divider-color-bg",children:"|"}),(0,a.jsx)("span",{className:"text-[#475569] font-medium","data-testid":"podcast-subtitle-controls-bg-label",children:s("studio.bg")}),[{key:"none",value:0},{key:"50",value:.5},{key:"90",value:.9}].map(e=>(0,a.jsx)("button",{type:"button",onClick:()=>t.setSubtitleSettings(t=>({...t,bgOpacity:e.value})),className:"px-2 py-1 rounded-md font-semibold ".concat(t.subtitleSettings.bgOpacity===e.value?"bg-[#0F766E] text-white":"bg-white border border-[#CBD5E1] text-[#475569]"),"data-testid":"podcast-sub-bg-".concat(e.key),children:"none"===e.key?s("common.no"):"".concat(e.key,"%")},e.key))]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-0 ".concat(t.isFullscreen?"flex-1 h-[calc(100vh-110px)]":""),"data-testid":"podcast-detail-live-grid",children:[(0,a.jsx)("div",{className:"lg:col-span-2 bg-black relative","data-testid":"podcast-detail-live-video-column",children:(0,a.jsxs)("div",{className:"relative w-full",style:{paddingBottom:t.isFullscreen?"0":"56.25%",height:t.isFullscreen?"100%":void 0},children:[t.podcast.embed_url?(0,a.jsx)("iframe",{src:function(e){let t=function(e){if(!e||!/youtube(-nocookie)?\.com\/embed\//.test(e)||e.includes("origin="))return e;let t=window.location.origin;if(!t)return e;let s=e.includes("?")?"&":"?";return"".concat(e).concat(s,"origin=").concat(encodeURIComponent(t))}(e);if(!t)return"";let s=t.includes("?")?"&":"?";return"".concat(t).concat(s,"autoplay=1")}(t.podcast.embed_url),className:"absolute inset-0 w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",referrerPolicy:"origin",allowFullScreen:!0,title:t.podcast.title,"data-testid":"podcast-detail-live-embed"}):(0,a.jsx)("div",{className:"absolute inset-0 flex items-center justify-center bg-gradient-to-br from-gray-900 to-black","data-testid":"podcast-detail-live-placeholder"}),r&&(0,a.jsx)("div",{className:"absolute bottom-0 left-0 right-0 flex justify-center pb-4 sm:pb-6 pointer-events-none","data-testid":"podcast-subtitle-overlay",children:(0,a.jsx)("span",{style:{background:"rgba(0,0,0,".concat(t.subtitleSettings.bgOpacity,")"),color:t.subtitleSettings.color,fontSize:"".concat(t.isFullscreen?t.subtitleSettings.fontSize+6:t.subtitleSettings.fontSize,"px"),padding:"8px 18px",borderRadius:"10px",fontWeight:700,lineHeight:1.5,maxWidth:"85%",textAlign:"center"},"data-testid":"podcast-detail-live-subtitle-text",children:r})})]})}),(0,a.jsxs)("div",{className:"relative lg:col-span-1 bg-[#F8FAFC] border-l border-[#CBD5E1] flex flex-col ".concat(t.isFullscreen?"h-full":"max-h-[600px]"),"data-testid":"podcast-detail-live-transcript-column",children:[(0,a.jsxs)("div",{className:"sticky top-0 bg-white border-b border-[#CBD5E1] px-4 py-3 flex items-center justify-between flex-shrink-0","data-testid":"podcast-detail-live-transcript-header",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-[#0F172A]","data-testid":"podcast-detail-live-transcript-title",children:s("podcast.liveTranscript")}),(0,a.jsxs)("div",{className:"flex items-center gap-2","data-testid":"podcast-detail-live-transcript-meta",children:[(0,a.jsx)("span",{className:"text-xs text-[#0F766E] font-medium","data-testid":"podcast-detail-live-transcript-language",children:t.selectedTranslationLang}),(0,a.jsx)("span",{className:"text-xs text-[#94A3B8]","data-testid":"podcast-detail-live-transcript-count",children:s("common.messageCount",{count:t.messages.length})})]})]}),(0,a.jsxs)("div",{ref:o,onScroll:h,className:"flex-1 overflow-y-auto p-4 space-y-3","data-testid":"podcast-detail-live-transcript-list",children:[0===t.messages.length?(0,a.jsxs)("div",{className:"text-center py-8 text-[#94A3B8]","data-testid":"podcast-detail-live-transcript-empty",children:[(0,a.jsx)("p",{className:"text-sm","data-testid":"podcast-detail-live-transcript-empty-title",children:s("public.waitingForTranscript")}),(0,a.jsx)("p",{className:"text-xs mt-1","data-testid":"podcast-detail-live-transcript-empty-description",children:s("podcast.messagesWillAppearWhileCapturing")})]}):t.messages.map(e=>{let d=t.getTranslatedText(e);
1return(0,a.jsx)("div",{className:"bg-white border border-[#E2E8F0] rounded-lg p-3 space-y-1.5","data-testid":"podcast-detail-live-transcript-item-".concat(e.id),children:null===d?(0,a.jsxs)("div",{className:"flex items-center gap-2 text-xs text-amber-600",children:[(0,a.jsx)(l.A,{size:12,className:"animate-spin flex-shrink-0"}),(0,a.jsx)("span",{children:s("public.translating")})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{className:"text-sm text-[#0F172A] leading-relaxed","data-testid":"podcast-detail-live-transcript-item-".concat(e.id,"-translated"),children:d}),d!==e.original&&e.original&&(0,a.jsx)("p",{className:"text-xs text-[#94A3B8] italic border-t border-[#E2E8F0] pt-1.5","data-testid":"podcast-detail-live-transcript-item-".concat(e.id,"-original"),children:e.original})]})},e.id)}),(0,a.jsx)("div",{"data-testid":"podcast-detail-live-transcript-end"}),t.streamId&&(0,a.jsxs)("div",{className:"flex items-center justify-center gap-2 py-2","data-testid":"podcast-detail-live-active-indicator",children:[(0,a.jsx)("div",{className:"w-2 h-2 bg-red-500 rounded-full animate-pulse"}),(0,a.jsx)("span",{className:"text-xs text-[#475569]","data-testid":"podcast-detail-live-active-indicator-label",children:s("podcast.liveTranscriptionActive")})]})]}),!n&&t.messages.length>0&&(0,a.jsxs)("button",{type:"button",onClick:g,className:"absolute bottom-3 right-3 z-10 inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-[#0F766E] text-white text-xs font-semibold shadow-md hover:bg-[#134E4A] transition-colors","data-testid":"podcast-detail-jump-to-latest","aria-label":s("hutbaSession.jumpToLatest"),children:[(0,a.jsx)(M.A,{size:13}),p>0?s("hutbaSession.newMessages",{count:p}):s("hutbaSession.jumpToLatest")]})]})]}),(0,a.jsx)("div",{className:"border-t border-[#CBD5E1] px-4 sm:px-6 py-3 bg-white flex-shrink-0","data-testid":"podcast-detail-live-footer",children:(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-2","data-testid":"podcast-detail-live-footer-content",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3","data-testid":"podcast-detail-live-footer-actions",children:[(0,a.jsxs)("button",{type:"button",onClick:t.handleEndSession,disabled:t.stoppingStream,className:"flex items-center gap-2 px-4 py-2 bg-red-600 hover:bg-red-700 text-white text-sm font-semibold rounded-lg transition-colors disabled:opacity-50","data-testid":"podcast-live-end-btn",children:[t.stoppingStream?(0,a.jsx)(l.A,{size:14,className:"animate-spin"}):(0,a.jsx)(v.A,{size:14}),(0,a.jsx)("span",{"data-testid":"podcast-live-end-btn-label",children:s("podcast.endSessionBtn")})]}),(0,a.jsx)("button",{type:"button",onClick:()=>t.setLocalLive(!1),className:"px-4 py-2 bg-white border border-[#CBD5E1] text-[#475569] text-sm font-medium rounded-lg hover:border-[#0F766E] hover:text-[#0F766E] transition-colors","data-testid":"podcast-detail-live-back-to-controls-btn",children:s("podcast.backToControls")})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 text-xs text-[#475569]","data-testid":"podcast-detail-live-footer-meta",children:[(0,a.jsx)(q.A,{size:12,className:"text-green-600"}),(0,a.jsxs)("span",{"data-testid":"podcast-detail-live-footer-audio",children:[s("podcast.audioLabel"),": ","microphone"===t.selectedAudioSource?s("podcast.microphone"):"tab-audio"===t.selectedAudioSource?s("podcast.tabAudio"):s("common.stream")]}),(0,a.jsx)("span",{"data-testid":"podcast-detail-live-footer-divider-audio-lang",children:"|"}),(0,a.jsxs)("span",{"data-testid":"podcast-detail-live-footer-lang",children:[s("podcast.languageLabelShort"),": ",t.selectedTranslationLang]}),(0,a.jsx)("span",{"data-testid":"podcast-detail-live-footer-divider-lang-count",children:"|"}),(0,a.jsx)("span",{"data-testid":"podcast-detail-live-footer-count",children:s("common.segmentCount",{count:t.messages.length})})]})]})})]})]})},P=e=>{let{open:t,podcast:s,copied:d,onCopy:i,onClose:l}=e,{t:r}=(0,F.s9)();return t&&(null==s?void 0:s.slug)?(0,a.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4","data-testid":"podcast-qr-modal",children:[(0,a.jsx)("button",{type:"button",className:"absolute inset-0 bg-black/50",onClick:l,"data-testid":"podcast-qr-modal-overlay","aria-label":r("podcastDetail.closeQrModal1")}),(0,a.jsxs)("div",{className:"relative bg-white rounded-2xl shadow-2xl w-full max-w-sm overflow-hidden",children:[(0,a.jsx)("div",{className:"h-1 bg-gradient-to-r from-[#0F766E] via-[#D4AF37] to-[#0F766E]","data-testid":"podcast-qr-modal-accent"}),(0,a.jsxs)("div",{className:"p-6 text-center","data-testid":"podcast-qr-modal-content",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-[#0F172A] mb-4","data-testid":"podcast-qr-modal-title",children:r("podcastDetail.scanToJoin")}),(0,a.jsx)("div",{className:"bg-white border border-[#CBD5E1] rounded-xl p-4 inline-block","data-testid":"podcast-qr-modal-image-shell",children:(0,a.jsx)("img",{src:"".concat("https://api.minbarlive.com","/api/public/podcasts/").concat(s.slug,"/qr?size=8"),alt:r("podcastSessions.qrCode"),className:"w-48 h-48 mx-auto","data-testid":"podcast-qr-image"})}),(0,a.jsx)("p",{className:"text-sm text-[#475569] mt-4 break-all","data-testid":"podcast-qr-modal-public-url",children:s.public_url}),(0,a.jsxs)("div",{className:"flex items-center gap-3 mt-4","data-testid":"podcast-qr-modal-actions",children:[(0,a.jsx)("button",{type:"button",onClick:i,className:"flex-1 px-3 py-2 bg-[#0F766E] text-white text-sm rounded-lg hover:bg-[#14B8A6] transition-colors","data-testid":"podcast-qr-copy-btn",children:d?"Copied!":r("podcastDetail.copyLink")}),(0,a.jsx)("button",{type:"button",onClick:l,className:"flex-1 px-3 py-2 border border-[#CBD5E1] text-[#475569] text-sm rounded-lg hover:bg-[#F8FAFC] transition-colors","data-testid":"podcast-qr-close-btn",children:"Close"})]})]})]})]}):null};var O=s(75426);let H=e=>{let{session:t}=e,{podcast:s}=t,{t:d}=(0,F.s9)(),l=s.source_url||s.youtube_url||"",r=s.platform_label||s.source_platform||"YouTube";return(0,a.jsxs)("div",{className:"space-y-4","data-testid":"podcast-detail-sidebar",children:[(0,a.jsxs)("div",{className:"bg-white border border-[#CBD5E1] rounded-xl p-5","data-testid":"podcast-detail-info",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-[#0F172A] mb-4","data-testid":"podcast-detail-info-title",children:d("podcast.sessionDetail
1s")}),(0,a.jsxs)("div",{className:"space-y-3 text-sm","data-testid":"podcast-detail-info-list",children:[(0,a.jsxs)("div",{"data-testid":"podcast-detail-platform-row",children:[(0,a.jsx)("p",{className:"text-xs text-[#475569] mb-1",children:d("podcast.platform")}),(0,a.jsx)("p",{className:"text-[#0F172A] font-medium capitalize","data-testid":"podcast-detail-platform-value",children:r})]}),(0,a.jsxs)("div",{"data-testid":"podcast-detail-source-language-row",children:[(0,a.jsx)("p",{className:"text-xs text-[#475569] mb-1",children:d("studio.sourceLanguage")}),(0,a.jsx)("p",{className:"text-[#0F172A]","data-testid":"podcast-detail-source-language-value",children:t.selectedSourceLang})]}),s.speaker_name&&(0,a.jsxs)("div",{"data-testid":"podcast-detail-speaker-row",children:[(0,a.jsx)("p",{className:"text-xs text-[#475569] mb-1",children:d("studio.speaker")}),(0,a.jsx)("p",{className:"text-[#0F172A]","data-testid":"podcast-detail-speaker-value",children:s.speaker_name})]}),s.summary&&(0,a.jsxs)("div",{"data-testid":"podcast-detail-description-row",children:[(0,a.jsx)("p",{className:"text-xs text-[#475569] mb-1",children:d("podcast.description")}),(0,a.jsx)("p",{className:"text-[#0F172A] text-xs","data-testid":"podcast-detail-description-value",children:s.summary})]}),t.streamId&&(0,a.jsxs)("div",{"data-testid":"podcast-detail-stream-id-row",children:[(0,a.jsx)("p",{className:"text-xs text-[#475569] mb-1",children:d("podcast.streamId")}),(0,a.jsx)("p",{className:"text-[#0F172A] text-xs font-mono break-all","data-testid":"podcast-detail-stream-id-value",children:t.streamId})]})]}),s.is_generic_embed?(0,a.jsx)("div",{className:"mt-4 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-700","data-testid":"podcast-detail-generic-embed-warning",children:"Ovaj izvor koristi univerzalni web embed fallback. Prikaz ovisi o tome dopušta li originalna stranica iframe učitavanje."}):null]}),(0,a.jsxs)("div",{className:"bg-white border border-[#CBD5E1] rounded-xl p-5","data-testid":"podcast-detail-access",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-[#0F172A] mb-4","data-testid":"podcast-detail-access-title",children:d("podcast.companionAccess")}),(0,a.jsxs)("div",{className:"space-y-3","data-testid":"podcast-detail-access-content",children:[(0,a.jsxs)("div",{"data-testid":"podcast-detail-public-url-row",children:[(0,a.jsx)("p",{className:"text-xs text-[#475569] mb-2","data-testid":"podcast-detail-public-url-label",children:d("podcast.publicUrl")}),(0,a.jsxs)("div",{className:"flex items-center gap-2","data-testid":"podcast-detail-public-url-group",children:[(0,a.jsx)("input",{type:"text",readOnly:!0,value:s.public_url||"",className:"flex-1 px-2 py-1.5 bg-[#F8FAFC] border border-[#CBD5E1] rounded text-xs font-mono text-[#0F766E]","data-testid":"podcast-detail-url"}),(0,a.jsx)("button",{type:"button",onClick:t.handleCopyUrl,className:"p-1.5 hover:bg-[#F0FDFA] rounded","data-testid":"podcast-detail-copy-url-btn",children:t.copied?(0,a.jsx)(q.A,{size:14,className:"text-green-600"}):(0,a.jsx)(O.A,{size:14,className:"text-[#475569]"})})]})]}),s.public_url&&(0,a.jsx)(i(),{href:s.public_url,target:"_blank",className:"block w-full px-3 py-2 bg-[#0F766E] text-white text-sm rounded-lg text-center hover:bg-[#14B8A6] transition-colors","data-testid":"podcast-detail-public-link",children:d("podcast.openPublicPage")}),(0,a.jsx)("button",{type:"button",onClick:()=>t.setShowQrModal(!0),className:"w-full px-3 py-2 border border-[#CBD5E1] text-[#0F172A] text-sm rounded-lg hover:bg-[#F8FAFC] transition-colors","data-testid":"podcast-detail-sidebar-qr-btn",children:d("podcast.showQrCode")}),(0,a.jsx)("button",{type:"button",onClick:t.handleShare,className:"w-full px-3 py-2 border border-[#CBD5E1] text-[#0F172A] text-sm rounded-lg hover:bg-[#F8FAFC] transition-colors","data-testid":"podcast-detail-sidebar-share-btn",children:d("podcast.shareLink")})]})]}),l&&(0,a.jsxs)("div",{className:"bg-white border border-[#CBD5E1] rounded-xl p-5","data-testid":"podcast-detail-source-episode",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-[#0F172A] mb-4","data-testid":"podcast-detail-source-episode-title",children:d("podcast.sourceEpisode")}),(0,a.jsxs)(i(),{href:l,target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-between p-3 bg-[#F8FAFC] rounded-lg hover:bg-[#F0FDFA] transition-colors","data-testid":"podcast-detail-source-episode-link",children:[(0,a.jsx)("span",{className:"text-sm text-[#0F172A]","data-testid":"podcast-detail-source-episode-link-label",children:d("podcast.openOriginalSource")}),(0,a.jsx)(f.A,{size:14,className:"text-[#475569]"})]})]})]})};var I=s(20063),W=s(59635),Q=s(35352),U=s(13384),V=s(82004);function J(){let{t:e}=(0,F.s9)(),t=function(){let e=(0,I.useRouter)(),t=(0,I.useParams)(),s=(0,I.useSearchParams)(),{t:a}=(0,F.s9)(),d=t.id,i="true"===s.get("autoLive"),l=s.get("sourceLang")||s.get("lang")||"",r=s.get("targetLang")||"",o=(0,N.useRef)(null),n=(0,N.useRef)(null),c=(0,N.useRef)(null),[p,u]=(0,N.useState)(null),[x,m]=(0,N.useState)(!0),[b,h]=(0,N.useState)(""),[g,v]=(0,N.useState)("Auto-detect"),[f,j]=(0,N.useState)(!1),[y,S]=(0,N.useState)(!1),[k,C]=(0,N.useState)(null),[A,E]=(0,N.useState)(null),[D,z]=(0,N.useState)(!1),[_,B]=(0,N.useState)(!1),[T,L]=(0,N.useState)(!1),[M,q]=(0,N.useState)(!1),[R,P]=(0,N.useState)(!1),[O,H]=(0,N.useState)([]),[J,K]=(0,N.useState)("disconnected"),[Y,G]=(0,N.useState)(!1),[X,Z]=(0,N.useState)("idle"),[$,ee]=(0,N.useState)({fontSize:17,color:"#FFFFFF",bgOpacity:.5}),[et,es]=(0,N.useState)(!1),[ea,ed]=(0,N.useState)(!1),[ei,el]=(0,N.useState)(!1),[er,eo]=(0,N.useState)("balanced"),[en,ec]=(0,N.useState)(null),ep=(null==p?void 0:p.stream_id)||null,eu=!!(ep&&(null==p?void 0:p.status)==="live"),ex=(null==p?void 0:p.status)==="ended",em=(0,N.useCallback)(async()=>{try{let e=await (0,w.apiRequest)("/api/admin/podcasts/".concat(d));u(e.item||e)}catch(e){h(e.message||a("podcast.podcastNotFound"))}finally{m(!1)}},[d,a]);(0,N.useEffect)(()=>{em()},[em]),(0,N.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await (0,w.apiRequest)("/api/admin/streaming-stt/config");if(e)return;let s=!!(null==t?void 0:t.available);ed(s),ec(t||null),el(!!s)}catch(t){e||ed(!1)}})(),()=>{e=!0}},[]),(0,N.useEffect)(()=>{let e=(0,U.Rv)(null==p?void 0:p.source_language);e&&v(e)},[null==p?void 0:p.source_language]),(0,N.useEffect)(()=>
1{if(i&&p&&!x){r&&E(r);let e=(0,U.Rv)((0,U.vK)(l))||"";e&&v(e),P(!0);let t=window.__minbarActiveCapture,s=(null==t?void 0:t.handle)||t,a=(null==t?void 0:t.source)||"microphone",d=(0,U.Rv)(null==t?void 0:t.sourceLanguage)||"";s&&!c.current&&(c.current=s,C(a),d&&v(d),delete window.__minbarActiveCapture)}},[i,null==p?void 0:p.podcast_id,x]),(0,N.useEffect)(()=>{if(!ep)return;(0,w.apiRequest)("/api/public/streams/".concat(ep,"/messages")).then(e=>{let t=(null==e?void 0:e.items)||[];t.length>0&&H(e=>(0,W.zM)(e,t))}).catch(()=>{});let e=(0,W.Bo)(ep,{onConnectionChange:K,onSnapshot:e=>H(t=>(0,W.zM)(t,e)),onTranscript:e=>H(t=>(0,W.zM)(t,[e])),onTranslationUpdate:e=>{let t=null==e?void 0:e.id,s=(null==e?void 0:e.translations)||{};t&&0!==Object.keys(s).length&&H(e=>e.map(e=>e.id!==t?e:{...e,translations:{...e.translations||{},...s}}))},onStreamEnded:()=>em(),onError:e=>Q.A.warn("Stream realtime error:",e)});return n.current=e,()=>{e&&e()}},[em,ep]),(0,N.useEffect)(()=>{let e=()=>G(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",e),()=>{var t;document.removeEventListener("fullscreenchange",e),(0,V.x)(c).catch(()=>{}),null==(t=n.current)||t.call(n)}},[]);let eb=(0,N.useMemo)(()=>eu?"Live":ex?"Ended":(null==p?void 0:p.status)==="draft"?"Draft":"Ready",[ex,eu,null==p?void 0:p.status]),eh=(0,N.useCallback)(()=>h(""),[]),eg=(0,N.useCallback)(()=>{var e,t,s;let a=o.current;if(a){if(!document.fullscreenElement){null==(s=a.requestFullscreen)||s.call(a).catch(()=>{});return}null==(e=(t=document).exitFullscreen)||e.call(t).catch(()=>{})}},[]),ev=(0,N.useCallback)(async e=>{C(e),j(!1),z(!0),h("");try{var t;let s=(0,U.vK)(g)||"multi",i=!!(ei&&ea),l=i?(0,U.r1)(s,en):s;if(l!==s){let e=(0,U.Rv)(l);e&&v(e)}let r=await (0,w.apiRequest)("/api/admin/podcasts/".concat(d,"/start-stream"),{method:"POST",body:JSON.stringify({source_language:l,stt_engine:i?"streaming":"batch",live_translation_mode:!!(i&&"low-delay"===er),live_translation_throttle:"low-delay"===er?"max":"economic"})}),o=r.stream_id||(null==(t=r.item)?void 0:t.stream_id),n=r.item||r.podcast||r;n.podcast_id?u(n):await em();let x=o||(null==p?void 0:p.stream_id);if(!x)throw Error("No stream ID returned from server");c.current=await (0,V.r)({source:e,streamId:x,onStateChange:Z,onError:e=>h(e.message||a("podcast.starting"))})}catch(e){h(e.message||a("podcast.starting")),C(null)}finally{z(!1)}},[em,en,null==p?void 0:p.stream_id,d,g,ea,a,er,ei]),ef=(0,N.useCallback)(async()=>{await (0,V.x)(c),C(null),Z("idle")},[]),ej=(0,N.useCallback)(async()=>{B(!0);try{var e;await (0,V.x)(c),await (0,w.apiRequest)("/api/admin/podcasts/".concat(d,"/stop-stream"),{method:"POST",body:JSON.stringify({})}).catch(()=>{}),await (0,w.apiRequest)("/api/admin/podcasts/".concat(d,"/set-status"),{method:"POST",body:JSON.stringify({status:"ended"})}).catch(()=>{}),C(null),Z("idle"),P(!1),null==(e=n.current)||e.call(n),H([]),await em()}finally{B(!1)}},[em,d]),ey=(0,N.useCallback)(async()=>{await (0,w.apiRequest)("/api/admin/podcasts/".concat(d),{method:"DELETE"}).catch(()=>{}),e.push("/podcast-companion/sessions")},[d,e]),eN=(0,N.useCallback)(async()=>{try{await (0,w.apiRequest)("/api/admin/podcasts/".concat(d,"/set-status"),{method:"POST",body:JSON.stringify({status:"live"})}),await em()}catch(e){h(e.message)}},[em,d]),ew=(0,N.useCallback)(e=>{E(e),S(!1),P(!0)},[]),eS=(0,N.useCallback)(()=>{let e=(0,U.L5)(p);e&&(navigator.clipboard.writeText(e),L(!0),setTimeout(()=>L(!1),2e3))},[p]),eF=(0,N.useCallback)(()=>{let e=(0,U.L5)(p);if(e){if(navigator.share)return void navigator.share({title:null==p?void 0:p.title,url:e}).catch(()=>{});eS()}},[eS,p]),ek=(0,N.useCallback)(e=>{var t;if(!A)return e.translated||e.original;let s=(0,U.rb)(A);if(s&&(null==(t=e.translations)?void 0:t[s])){let t=e.translations[s];if(t.trim()&&t!==e.original)return t}return A===(0,U.Rv)(null==p?void 0:p.source_language)||s&&s===(null==p?void 0:p.source_language)?e.translated||e.original:null},[A,null==p?void 0:p.source_language]);return{podcast:p,loading:x,error:b,clearError:eh,fetchPodcast:em,selectedSourceLang:g,setSelectedSourceLang:v,showAudioSourceModal:f,setShowAudioSourceModal:j,showLanguageModal:y,setShowLanguageModal:S,selectedAudioSource:k,selectedTranslationLang:A,startingStream:D,stoppingStream:_,sttAvailable:ea,useStreamingStt:ei,setUseStreamingStt:el,translationProfile:er,setTranslationProfile:eo,mosqueSttConfig:en,copied:T,showQrModal:M,setShowQrModal:q,localLive:R,setLocalLive:P,messages:O,connectionStatus:J,isFullscreen:Y,fullscreenContainerRef:o,streamId:ep,isStreaming:eu,isEnded:ex,statusLabel:eb,audioCaptureState:X,subtitleSettings:$,setSubtitleSettings:ee,showSubtitleControls:et,setShowSubtitleControls:es,toggleFullscreen:eg,handleStartTranscription:()=>j(!0),handleAudioSourceSelect:ev,handleStopCapture:ef,handleEndSession:ej,handleDelete:ey,handleSetLive:eN,handleOpenLive
1View:()=>S(!0),handleLanguageSelect:ew,handleCopyUrl:eS,handleShare:eF,getTranslatedText:ek}}();return t.loading?(0,a.jsx)("div",{className:"flex items-center justify-center py-20","data-testid":"podcast-detail-loading",children:(0,a.jsx)(l.A,{size:24,className:"animate-spin text-[#0F766E]"})}):t.error&&!t.podcast?(0,a.jsxs)("div",{className:"space-y-4","data-testid":"podcast-detail-error-state",children:[(0,a.jsxs)(i(),{href:"/podcast-companion/sessions",className:"inline-flex items-center gap-2 text-sm text-[#475569] hover:text-[#0F172A]","data-testid":"podcast-detail-error-back-link",children:[(0,a.jsx)(r.A,{size:16}),(0,a.jsx)("span",{"data-testid":"podcast-detail-error-back-link-label",children:e("podcastNew.backToSessions")})]}),(0,a.jsx)("div",{className:"p-6 bg-red-50 border border-red-200 rounded-xl text-red-700","data-testid":"podcast-detail-error-message",children:t.error})]}):t.podcast?t.localLive&&t.selectedTranslationLang?(0,a.jsx)(R,{session:t}):(0,a.jsxs)("div",{className:"space-y-4 sm:space-y-6","data-testid":"podcast-detail-page",children:[(0,a.jsxs)(i(),{href:"/podcast-companion/sessions",className:"inline-flex items-center gap-2 text-xs sm:text-sm text-[#475569] hover:text-[#0F172A] transition-colors","data-testid":"podcast-detail-back",children:[(0,a.jsx)(r.A,{size:16}),(0,a.jsx)("span",{"data-testid":"podcast-detail-back-label",children:e("podcastNew.backToSessions")})]}),(0,a.jsx)(n.T,{error:t.error,onDismiss:t.clearError,testId:"podcast-detail-error"}),(0,a.jsx)(_,{podcast:t.podcast,statusLabel:t.statusLabel,isEnded:t.isEnded,stoppingStream:t.stoppingStream,onEndSession:t.handleEndSession,onDelete:t.handleDelete}),(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6","data-testid":"podcast-detail-layout",children:[(0,a.jsx)("div",{className:"lg:col-span-2","data-testid":"podcast-detail-main-column",children:(0,a.jsx)(D,{session:t})}),(0,a.jsx)(H,{session:t})]}),(0,a.jsx)(o.r,{open:t.showAudioSourceModal,onClose:()=>t.setShowAudioSourceModal(!1),onSelect:t.handleAudioSourceSelect,loading:t.startingStream,testIdPrefix:"podcast-detail",sttAvailable:t.sttAvailable,useStreamingStt:t.useStreamingStt,onToggleStreamingStt:t.setUseStreamingStt,translationProfile:t.translationProfile,onTranslationProfileChange:t.setTranslationProfile,mosqueSttConfig:t.mosqueSttConfig}),(0,a.jsx)(c.W,{open:t.showLanguageModal,onClose:()=>t.setShowLanguageModal(!1),onSelect:t.handleLanguageSelect,podcastTitle:t.podcast.title,testIdPrefix:"podcast-detail"}),(0,a.jsx)(P,{open:t.showQrModal,podcast:t.podcast,copied:t.copied,onCopy:t.handleCopyUrl,onClose:()=>t.setShowQrModal(!1)})]}):null}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.