PageSourceSearch

https://minbarlive.com/_next/static/chunks/1774.167deb994901bdcc.js

js minbarlive.com collected 2026-10-02 00:54:34 UTC 53,502 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1774],{8803:(e,t,a)=>{a.d(t,{A:()=>s});let s=(0,a(71847).A)("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]])},21397:(e,t,a)=>{a.d(t,{A:()=>s});let s=(0,a(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,a)=>{a.d(t,{A:()=>s});let s=(0,a(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,a)=>{a.d(t,{A:()=>s});let s=(0,a(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,a)=>{a.d(t,{A:()=>s});let s=(0,a(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,a)=>{a.d(t,{A:()=>s});let s=(0,a(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,a)=>{a.d(t,{A:()=>s});let s=(0,a(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,a)=>{a.r(t),a.d(t,{default:()=>Z});var s=a(95155),i=a(52619),d=a.n(i),l=a(35299),n=a(35626),o=a(22064),r=a(23876),c=a(7877),p=a(37586),u=a(26983),m=a(57828),x=a(12108),b=a(24033),h=a(89559),g=a(85921),v=a(59e3),f=a(93499),j=a(17181),y=a(54690),w=a(12115),N=a(55490),C=a(2251),S=a(67720);let k=e=>{let{session:t}=e;return(0,s.jsxs)("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4","data-testid":"podcast-detail-stats-grid",children:[(0,s.jsxs)("div",{className:"p-4 bg-[#F8FAFC] rounded-lg","data-testid":"podcast-detail-stat-messages",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,s.jsx)("span",{className:"text-xs text-[#475569]","data-testid":"podcast-detail-stat-messages-label",children:"Messages"}),(0,s.jsx)(p.A,{size:14,className:"text-[#0F766E]"})]}),(0,s.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,s.jsxs)("div",{className:"p-4 bg-[#F8FAFC] rounded-lg","data-testid":"podcast-detail-stat-status",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,s.jsx)("span",{className:"text-xs text-[#475569]","data-testid":"podcast-detail-stat-status-label",children:"Status"}),(0,s.jsx)(u.A,{size:14,className:"text-[#0F766E]"})]}),(0,s.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,s.jsxs)("div",{className:"p-4 bg-[#F8FAFC] rounded-lg","data-testid":"podcast-detail-stat-connection",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,s.jsx)("span",{className:"text-xs text-[#475569]","data-testid":"podcast-detail-stat-connection-label",children:"Connection"}),(0,s.jsx)(m.A,{size:14,className:"text-[#0F766E]"})]}),(0,s.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})]})]})},F=e=>{let{session:t}=e;return 0===t.messages.length?null:(0,s.jsxs)("div",{className:"bg-white border border-[#CBD5E1] rounded-xl shadow-sm overflow-hidden","data-testid":"podcast-detail-transcript-preview",children:[(0,s.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,s.jsxs)("h3",{className:"text-sm font-semibold text-[#0F172A]","data-testid":"podcast-detail-transcript-preview-title",children:["Transcript (",t.messages.length," segments)"]}),(0,s.jsx)("span",{className:"text-xs text-[#94A3B8]","data-testid":"podcast-detail-transcript-preview-status",children:t.connectionStatus})]}),(0,s.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,s.jsxs)("div",{className:"p-3 bg-[#F8FAFC] rounded-lg","data-testid":"podcast-detail-transcript-preview-item-".concat(e.id),children:[(0,s.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,s.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:a}=e,[i,d]=(0,w.useState)(!1),[l,n]=(0,w.useState)(!1),o=t.transcript_status,r="completed"===o&&(t.refined_transcript||t.raw_transcript),c=t.refined_transcript||t.raw_transcript||"",p=(0,w.useCallback)(async()=>{n(!0);try{await (0,N.apiRequest)("/api/admin/podcasts/".concat(t.podcast_id,"/reprocess-transcript"),{method:"POST"}),null==a||a()}catch(e){}finally{n(!1)}},[t.podcast_id,a]);return o?(0,s.jsxs)("div",{className:"bg-white border border-[#CBD5E1] rounded-xl shadow-sm overflow-hidden mt-4","data-testid":"podcast-transcript-section",children:[(0,s.jsxs)("div",{className:"border-b border-[#CBD5E1] px-6 py-3 flex items-center justify-between","data-testid":"podcast-transcript-section-header",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-[#0F172A]","data-testid":"podcast-transcript-title",children:"Session Transcript"}),(0,s.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,s.jsxs)("div",{className:"p-6 space-y-4","data-testid":"podcast-transcript-body",children:[t.ai_summary&&(0,s.jsxs)("div",{"data-testid":"podcast-transcript-summary",children:[(0,s.jsx)("p",{className:"text-xs font-semibold text-[#475569] uppercase tracking-wide mb-2",children:"AI Summary"}),(0,s.jsx)("p",{className:"text-sm text-[#0F172A] leading-relaxed whitespace-pre-wrap","data-testid":"podcast-transcript-summary-text",children:t.ai_summary})]}),r&&(0,s.jsxs)("div",{"data-testid":"podcast-transcript-full",children:[(0,s.jsxs)("button",{type:"button",onClick:()=>d(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:[i?(0,s.jsx)(x.A,{size:14}):(0,s.jsx)(b.A,{size:14}),i?"Hide full transcript":"Show full transcript (".concat(t.message_count||0," segments)")]}),i&&(0,s.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,s.jsx)("pre",{className:"text-xs text-[#334155] leading-relaxed whitespace-pre-wrap font-sans",children:c})})]}),"processing"!==o&&(0,s.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,s.jsx)(h.A,{size:13,className:l?"animate-spin":""}),l?"Starting reprocess...":"Reprocess transcript"]})]})]}):null},_=e=>{let{session:t}=e,{t:a}=(0,S.s9)(),i="microphone"===t.selectedAudioSource||"mic"===t.selectedAudioSource;return(0,s.jsxs)("div",{className:"space-y-6","data-testid":"podcast-detail-control-panel",children:[(0,s.jsxs)("div",{className:"bg-white border border-[#CBD5E1] rounded-xl shadow-sm overflow-hidden","data-testid":"podcast-detail-control-card",children:[(0,s.jsx)("div",{className:"border-b border-[#CBD5E1] px-6 py-3","data-testid":"podcast-detail-control-card-header",children:(0,s.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,s.jsxs)("div",{className:"p-6 space-y-5","data-testid":"podcast-detail-control-card-body",children:[(0,s.jsx)(k,{session:t}),!t.isEnded&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(C.y,{selectedLanguage:t.selectedSourceLang,onSelect:t.setSelectedSourceLang,testIdPrefix:"podcast-detail"}),t.selectedAudioSource||t.isStreaming?(0,s.jsxs)("div",{className:"space-y-3","data-testid":"podcast-detail-capture-state",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2","data-testid":"podcast-detail-capture-state-badge-row",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-red-500 rounded-full animate-pulse"}),(0,s.jsx)("span",{className:"text-sm font-semibold text-red-600","data-testid":"podcast-detail-capture-state-badge",children:a(t.selectedAudioSource?"podcastDetail.capturingAudio":"podcastDetail.streamActive")})]}),t.selectedAudioSource&&(0,s.jsxs)("p",{className:"text-sm text-[#475569]","data-testid":"podcast-detail-capture-source",children:["Source: ",a(i?"podcastDetail.browserMicrophone":"podcastDetail.browserTabAudio")]}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-3","data-testid":"podcast-detail-capture-actions",children:[t.selectedAudioSource&&(0,s.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,s.jsx)(v.A,{size:14}),(0,s.jsx)("span",{"data-testid":"podcast-detail-stop-capture-btn-label",children:a("podcastDetail.stopCapture")})]}),!t.selectedAudioSource&&t.isStreaming&&(0,s.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,s.jsx)(g.A,{size:14}),(0,s.jsx)("span",{"data-testid":"podcast-detail-restart-capture-btn-label",children:a("podcastDetail.restartCapture")})]}),(0,s.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,s.jsx)(l.A,{size:14,className:"animate-spin"}):(0,s.jsx)(v.A,{size:14}),(0,s.jsx)("span",{"data-testid":"podcast-detail-end-btn-label",children:a("podcastDetail.endEntireSession")})]})]}),(0,s.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,s.jsxs)("p",{className:"text-xs text-[#94A3B8]","data-testid":"podcast-detail-audio-state",children:["Audio capture state: ",t.audioCaptureState]})]}):(0,s.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,s.jsx)(g.A,{size:16}),(0,s.jsx)("span",{"data-testid":"podcast-detail-start-btn-label",children:a("podcastDetail.startTranscription")})]})]}),t.isEnded&&(0,s.jsx)("div",{className:"p-4 bg-[#F8FAFC] rounded-lg text-center","data-testid":"podcast-detail-ended-state",children:(0,s.jsx)("p",{className:"text-sm text-[#475569]","data-testid":"podcast-detail-ended-state-label",children:a("podcastDetail.sessionHasEnded")})})]})]}),(0,s.jsx)(F,{session:t}),t.isEnded&&(0,s.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,s.jsxs)("div",{className:"flex flex-wrap items-center gap-3","data-testid":"podcast-detail-action-buttons",children:[(0,s.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,s.jsx)(f.A,{size:16}),(0,s.jsx)("span",{"data-testid":"podcast-detail-open-btn-label",children:a("podcastDetail.openLiveView")})]}),(0,s.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,s.jsx)(j.A,{size:16}),(0,s.jsx)("span",{"data-testid":"podcast-detail-share-btn-label",children:"Share"})]}),(0,s.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,s.jsx)(y.A,{size:16}),(0,s.jsx)("span",{"data-testid":"podcast-detail-qr-btn-label",children:a("podcastSessions.qrCode")})]}),!t.isEnded&&(0,s.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 q=a(71360);let D=e=>{let{podcast:t,statusLabel:a,isEnded:i,stoppingStream:d,onEndSession:l,onDelete:n}=e,{t:o}=(0,S.s9)();return(0,s.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4","data-testid":"podcast-detail-header",children:[(0,s.jsxs)("div",{"data-testid":"podcast-detail-header-main",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 flex-wrap","data-testid":"podcast-detail-title-row",children:[(0,s.jsx)("h1",{className:"text-xl sm:text-2xl font-semibold text-[#0F172A]","data-testid":"podcast-detail-title",children:t.title}),(0,s.jsxs)("span",{className:"px-3 py-1 text-xs font-semibold rounded-full ".concat("Live"===a?"bg-red-100 text-red-700":"Ended"===a?"bg-[#CBD5E1] text-[#475569]":"Draft"===a?"bg-blue-100 text-blue-700":"bg-green-100 text-green-700"),"data-testid":"podcast-detail-status",children:["Live"===a&&(0,s.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-red-600 rounded-full animate-pulse mr-1.5"}),a]})]}),t.speaker_name&&(0,s.jsxs)("p",{className:"text-sm text-[#475569] mt-1","data-testid":"podcast-detail-speaker",children:["Speaker: ",t.speaker_name]}),(0,s.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,s.jsxs)("div",{className:"flex items-center gap-2","data-testid":"podcast-detail-header-actions",children:[!i&&(0,s.jsx)("button",{type:"button",onClick:l,disabled:d,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:d?o("podcastDetail.ending"):"End Session"}),(0,s.jsx)("button",{type:"button",onClick:n,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,s.jsx)(q.A,{size:18,className:"text-[#475569]"})})]})]})};var T=a(39068),z=a(31959),B=a(21397),L=a(8803),M=a(42529),R=a(87712);let P=e=>{var t,a;let{session:i}=e,{t:n}=(0,S.s9)(),o=i.messages.length>0?i.messages[i.messages.length-1]:null,r=o&&i.getTranslatedText(o)||"",c=i.sourceClockStatus||"inactive",p=!!((null==(a=i.podcast)||null==(t=a.quran_companion)?void 0:t.enabled)&&"tab-audio"===i.selectedAudioSource&&"tracking"!==c),u=(0,w.useRef)(null),[m,x]=(0,w.useState)(!0),[b,h]=(0,w.useState)(0),g=(0,w.useRef)(0),f=(0,w.useRef)(null),y=(0,w.useCallback)(()=>{let e=u.current;if(!e)return;h(0);let t=Math.max(0,e.scrollHeight-e.clientHeight);f.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!==f.current&&Math.abs(e.scrollTop-t)>1&&(f.current=null)},[]),N=(0,w.useCallback)(e=>{let t=e.currentTarget,a=null!==f.current&&1>=Math.abs(t.scrollTop-f.current);if(f.current=null,a)return;let s=t.scrollHeight-t.scrollTop-t.clientHeight<=120;x(s),s&&h(0)},[]),C=(0,w.useCallback)(()=>{x(!0),y()},[y]);return(0,w.useEffect)(()=>
1{if(!m){let e=Math.max(0,i.messages.length-g.current);g.current=i.messages.length,e>0&&h(t=>t+e);return}g.current=i.messages.length,y()},[i.messages,m,y]),(0,s.jsxs)("div",{className:"space-y-4","data-testid":"podcast-detail-live",children:[(0,s.jsx)(d(),{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,s.jsx)("span",{"data-testid":"podcast-detail-live-back-link-label",children:n("podcast.back")})}),(0,s.jsxs)("div",{ref:i.fullscreenContainerRef,className:"bg-white border border-[#CBD5E1] rounded-xl shadow-sm overflow-hidden ".concat(i.isFullscreen?"fixed inset-0 z-50 rounded-none border-none":""),"data-testid":"podcast-live-container",children:[(0,s.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,s.jsxs)("div",{className:"flex items-center gap-3 min-w-0","data-testid":"podcast-detail-live-title-group",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-red-500 rounded-full animate-pulse flex-shrink-0"}),(0,s.jsx)("h2",{className:"text-sm sm:text-base font-semibold text-[#0F172A] truncate","data-testid":"podcast-detail-live-title",children:i.podcast.title}),(0,s.jsx)("span",{className:"text-xs font-semibold text-red-600 flex-shrink-0","data-testid":"podcast-detail-live-status",children:n("public.liveNow")})]}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2","data-testid":"podcast-detail-live-header-actions",children:[(0,s.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,s.jsx)(T.A,{size:12}),i.selectedTranslationLang]}),(0,s.jsx)("span",{className:"px-2 py-1 rounded text-xs font-medium ".concat("connected"===i.connectionStatus?"bg-green-100 text-green-700":"bg-yellow-100 text-yellow-700"),"data-testid":"podcast-detail-live-connection-status",children:"connected"===i.connectionStatus?n("podcast.connectionConnected"):n("podcast.connectionConnecting")}),(0,s.jsxs)("button",{type:"button",onClick:i.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,s.jsx)(j.A,{size:12}),(0,s.jsx)("span",{"data-testid":"podcast-live-share-btn-label",children:n("podcast.shareLink")})]}),(0,s.jsx)("button",{type:"button",onClick:i.toggleFullscreen,className:"p-1.5 bg-white border border-[#CBD5E1] rounded-lg text-[#475569] hover:border-[#0F766E] transition-colors",title:i.isFullscreen?n("podcast.exitFullscreen"):n("podcast.fullscreen"),"data-testid":"podcast-fullscreen-btn",children:i.isFullscreen?(0,s.jsx)(z.A,{size:14}):(0,s.jsx)(B.A,{size:14})}),(0,s.jsx)("button",{type:"button",onClick:()=>i.setShowSubtitleControls(!i.showSubtitleControls),className:"p-1.5 rounded-lg transition-colors ".concat(i.showSubtitleControls?"bg-[#0F766E] text-white":"bg-white border border-[#CBD5E1] text-[#475569] hover:border-[#0F766E]"),title:n("podcast.subtitleSettings"),"data-testid":"podcast-subtitle-settings-btn",children:(0,s.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,s.jsx)("rect",{x:"1",y:"4",width:"22",height:"16",rx:"2"}),(0,s.jsx)("line",{x1:"1",y1:"14",x2:"23",y2:"14"})]})})]})]}),p?(0,s.jsx)("div",{className:"border-b border-amber-200 bg-amber-50 px-4 py-2.5 text-xs leading-5 text-amber-950","data-testid":"podcast-detail-quran-clock-warning",children:"stalled"===c?n("podcast.quranClockStalled","The embedded YouTube video is not moving, so its clock is not sent with the Quran audio. Stop capturing, start the video here, then choose “This Podcast tab with audio” again — not a separate YouTube tab."):n("podcast.quranClockWaiting","Checking whether the embedded YouTube video clock is moving. Quran will use video synchronisation only once it starts moving.")}):null,i.showSubtitleControls&&(0,s.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-control
1s",children:[(0,s.jsx)("span",{className:"text-[#475569] font-medium","data-testid":"podcast-subtitle-controls-size-label",children:n("studio.size")}),[{key:"S",value:14},{key:"M",value:17},{key:"L",value:24}].map(e=>(0,s.jsx)("button",{type:"button",onClick:()=>i.setSubtitleSettings(t=>({...t,fontSize:e.value})),className:"px-2 py-1 rounded-md font-semibold ".concat(i.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,s.jsx)("span",{className:"text-[#CBD5E1]","data-testid":"podcast-subtitle-controls-divider-size-color",children:"|"}),(0,s.jsx)("span",{className:"text-[#475569] font-medium","data-testid":"podcast-subtitle-controls-color-label",children:n("studio.color")}),[{key:"white",value:"#FFFFFF",label:"W"},{key:"yellow",value:"#FFD700",label:"Y"},{key:"cyan",value:"#00FFFF",label:"C"}].map(e=>(0,s.jsxs)("button",{type:"button",onClick:()=>i.setSubtitleSettings(t=>({...t,color:e.value})),className:"px-2 py-1 rounded-md font-semibold flex items-center gap-1 ".concat(i.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,s.jsx)("span",{className:"w-2.5 h-2.5 rounded-full border border-[#CBD5E1]",style:{background:e.value}}),e.label]},e.key)),(0,s.jsx)("span",{className:"text-[#CBD5E1]","data-testid":"podcast-subtitle-controls-divider-color-bg",children:"|"}),(0,s.jsx)("span",{className:"text-[#475569] font-medium","data-testid":"podcast-subtitle-controls-bg-label",children:n("studio.bg")}),[{key:"none",value:0},{key:"50",value:.5},{key:"90",value:.9}].map(e=>(0,s.jsx)("button",{type:"button",onClick:()=>i.setSubtitleSettings(t=>({...t,bgOpacity:e.value})),className:"px-2 py-1 rounded-md font-semibold ".concat(i.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?n("common.no"):"".concat(e.key,"%")},e.key))]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-0 ".concat(i.isFullscreen?"flex-1 h-[calc(100vh-110px)]":""),"data-testid":"podcast-detail-live-grid",children:[(0,s.jsx)("div",{className:"lg:col-span-2 bg-black relative","data-testid":"podcast-detail-live-video-column",children:(0,s.jsxs)("div",{className:"relative w-full",style:{paddingBottom:i.isFullscreen?"0":"56.25%",height:i.isFullscreen?"100%":void 0},children:[i.podcast.embed_url?(0,s.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 a=e.includes("?")?"&":"?";return"".concat(e).concat(a,"origin=").concat(encodeURIComponent(t))}(e);if(!t)return"";let a=t.includes("?")?"&":"?",s="".concat(t).concat(a,"autoplay=1");return(0,R.M1)(s,window.location.origin)}(i.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:i.podcast.title,ref:i.sourceVideoIframeRef,"data-testid":"podcast-detail-live-embed"}):(0,s.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,s.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,s.jsx)("span",{style:{background:"rgba(0,0,0,".concat(i.subtitleSettings.bgOpacity,")"),color:i.subtitleSettings.color,fontSize:"".concat(i.isFullscreen?i.subtitleSettings.fontSize+6:i.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,s.jsxs)("div",{className:"relative lg:col-span-1 bg-[#F8FAFC] border-l border-[#CBD5E1] flex flex-col ".concat(i.isFullscreen?"h-full":"max-h-[600px]"),"data-testid":"podcast-detail-live-transcript-column",children:[(0,s.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,s.jsx)("h3",{className:"text-sm font-semibold text-[#0F172A]","data-testid":"podcast-detail-live-transcript-title",children:n("podcast.liveTranscript")}),(0,s.jsxs)("div",{className:"flex items-center gap-2","data-testid":"podcast-detail-live-transcript-meta",children:[(0,s.jsx)("span",{className:"text-xs text-[#0F766E] font-medium","data-testid":"podcast-detail-live-transcript-language",children:i.selectedTranslationLang}),(0,s.jsx)("span",{className:"text-xs text-[#94A3B8]","data-testid":"podcast-detail-live-transcript-count",children:n("common.messageCount",{count:i.messages.length})})]})]}),(0,s.jsxs)("div",{ref:u,onScroll:N,className:"flex-1 overflow-y-auto p-4 space-y-3","data-testid":"podcast-detail-live-transcript-list",children:[0===i.messages.length?(0,s.jsxs)("div",{className:"text-center py-8 text-[#94A3B8]","data-testid":"podcast-detail-live-transcript-empty",children:[(0,s.jsx)("p",{className:"text-sm","data-testid":"podcast-detail-live-transcript-empty-title",children:n("public.waitingForTranscript")}),(0,s.jsx)("p",{className:"text-xs mt-1","data-testid":"podcast-detail-live-transcript-empty-description",children:n("podcast.messagesWillAppearWhileCapturing")})]}):i.messages.map(e=>{let t=i.getTranslatedText(e);
1return(0,s.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===t?(0,s.jsxs)("div",{className:"flex items-center gap-2 text-xs text-amber-600",children:[(0,s.jsx)(l.A,{size:12,className:"animate-spin flex-shrink-0"}),(0,s.jsx)("span",{children:n("public.translating")})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{className:"text-sm text-[#0F172A] leading-relaxed","data-testid":"podcast-detail-live-transcript-item-".concat(e.id,"-translated"),children:t}),t!==e.original&&e.original&&(0,s.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,s.jsx)("div",{"data-testid":"podcast-detail-live-transcript-end"}),i.streamId&&(0,s.jsxs)("div",{className:"flex items-center justify-center gap-2 py-2","data-testid":"podcast-detail-live-active-indicator",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-red-500 rounded-full animate-pulse"}),(0,s.jsx)("span",{className:"text-xs text-[#475569]","data-testid":"podcast-detail-live-active-indicator-label",children:n("podcast.liveTranscriptionActive")})]})]}),!m&&i.messages.length>0&&(0,s.jsxs)("button",{type:"button",onClick:C,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":n("hutbaSession.jumpToLatest"),children:[(0,s.jsx)(L.A,{size:13}),b>0?n("hutbaSession.newMessages",{count:b}):n("hutbaSession.jumpToLatest")]})]})]}),(0,s.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,s.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,s.jsxs)("div",{className:"flex items-center gap-3","data-testid":"podcast-detail-live-footer-actions",children:[(0,s.jsxs)("button",{type:"button",onClick:i.handleEndSession,disabled:i.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:[i.stoppingStream?(0,s.jsx)(l.A,{size:14,className:"animate-spin"}):(0,s.jsx)(v.A,{size:14}),(0,s.jsx)("span",{"data-testid":"podcast-live-end-btn-label",children:n("podcast.endSessionBtn")})]}),(0,s.jsx)("button",{type:"button",onClick:()=>i.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:n("podcast.backToControls")})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2 text-xs text-[#475569]","data-testid":"podcast-detail-live-footer-meta",children:[(0,s.jsx)(M.A,{size:12,className:"text-green-600"}),(0,s.jsxs)("span",{"data-testid":"podcast-detail-live-footer-audio",children:[n("podcast.audioLabel"),": ","microphone"===i.selectedAudioSource?n("podcast.microphone"):"tab-audio"===i.selectedAudioSource?n("podcast.tabAudio"):n("common.stream")]}),(0,s.jsx)("span",{"data-testid":"podcast-detail-live-footer-divider-audio-lang",children:"|"}),(0,s.jsxs)("span",{"data-testid":"podcast-detail-live-footer-lang",children:[n("podcast.languageLabelShort"),": ",i.selectedTranslationLang]}),(0,s.jsx)("span",{"data-testid":"podcast-detail-live-footer-divider-lang-count",children:"|"}),(0,s.jsx)("span",{"data-testid":"podcast-detail-live-footer-count",children:n("common.segmentCount",{count:i.messages.length})})]})]})})]})]})},Q=e=>{let{open:t,podcast:a,copied:i,onCopy:d,onClose:l}=e,{t:n}=(0,S.s9)();return t&&(null==a?void 0:a.slug)?(0,s.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4","data-testid":"podcast-qr-modal",children:[(0,s.jsx)("button",{type:"button",className:"absolute inset-0 bg-black/50",onClick:l,"data-testid":"podcast-qr-modal-overlay","aria-label":n("podcastDetail.closeQrModal1")}),(0,s.jsxs)("div",{className:"relative bg-white rounded-2xl shadow-2xl w-full max-w-sm overflow-hidden",children:[(0,s.jsx)("div",{className:"h-1 bg-gradient-to-r from-[#0F766E] via-[#D4AF37] to-[#0F766E]","data-testid":"podcast-qr-modal-accent"}),(0,s.jsxs)("div",{className:"p-6 text-center","data-testid":"podcast-qr-modal-content",children:[(0,s.jsx)("h3",{className:"text-lg font-semibold text-[#0F172A] mb-4","data-testid":"podcast-qr-modal-title",children:n("podcastDetail.scanToJoin")}),(0,s.jsx)("div",{className:"bg-white border border-[#CBD5E1] rounded-xl p-4 inline-block","data-testid":"podcast-qr-modal-image-shell",children:(0,s.jsx)("img",{src:"".concat("https://api.minbarlive.com","/api/public/podcasts/").concat(a.slug,"/qr?size=8"),alt:n("podcastSessions.qrCode"),className:"w-48 h-48 mx-auto","data-testid":"podcast-qr-image"})}),(0,s.jsx)("p",{className:"text-sm text-[#475569] mt-4 break-all","data-testid":"podcast-qr-modal-public-url",children:a.public_url}),(0,s.jsxs)("div",{className:"flex items-center gap-3 mt-4","data-testid":"podcast-qr-modal-actions",children:[(0,s.jsx)("button",{type:"button",onClick:d,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:i?"Copied!":n("podcastDetail.copyLink")}),(0,s.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 I=a(75426),O=a(39084),H=a(16731);function V(e){let{session:t,t:a}=e,i=t.podcast.quran_runtime,[d,l]=(0,w.useState)(i);(0,w.useEffect)(()=>
1{l(i)},[i]);let n=t.isStreaming,o=!(0,H.KI)(d,i);return(0,s.jsxs)("div",{className:"mt-4 space-y-2 rounded-lg border border-amber-200 bg-amber-50/70 p-3","data-testid":"podcast-detail-quran-runtime-editor",children:[(0,s.jsx)(O.A,{runtime:d,onChange:l,disabled:n||t.savingQuranCompanion,t:a,testIdPrefix:"podcast-detail-quran-runtime"}),n?(0,s.jsx)("p",{className:"text-xs leading-relaxed text-amber-900","data-testid":"podcast-detail-quran-runtime-locked",children:a("podcast.quranRuntimeLockedLive","The tracking mode is applied at Start. Stop the stream to change it.")}):null,!n&&o?(0,s.jsx)("button",{type:"button",onClick:()=>t.saveQuranRuntime(d),disabled:t.savingQuranCompanion,className:"w-full rounded-lg bg-[#0F766E] px-3 py-2 text-sm font-semibold text-white hover:bg-[#14B8A6] disabled:opacity-60","data-testid":"podcast-detail-quran-runtime-save",children:a("podcast.quranRuntimeSave","Save Quran tracking")}):null]})}let W=e=>{var t,a;let{session:i}=e,{podcast:l}=i,{t:n}=(0,S.s9)(),o=l.source_url||l.youtube_url||"",r=l.platform_label||l.source_platform||"YouTube",c=!!(null==(t=l.quran_companion)?void 0:t.enabled),p=i.isStreaming&&c&&!1===l.quran_runtime_active,u=i.isStreaming&&!c;return(0,s.jsxs)("div",{className:"space-y-4","data-testid":"podcast-detail-sidebar",children:[(0,s.jsxs)("div",{className:"bg-white border border-[#CBD5E1] rounded-xl p-5","data-testid":"podcast-detail-info",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-[#0F172A] mb-4","data-testid":"podcast-detail-info-title",children:n("podcast.sessionDetails")}),(0,s.jsxs)("div",{className:"space-y-3 text-sm","data-testid":"podcast-detail-info-list",children:[(0,s.jsxs)("div",{"data-testid":"podcast-detail-platform-row",children:[(0,s.jsx)("p",{className:"text-xs text-[#475569] mb-1",children:n("podcast.platform")}),(0,s.jsx)("p",{className:"text-[#0F172A] font-medium capitalize","data-testid":"podcast-detail-platform-value",children:r})]}),(0,s.jsxs)("div",{"data-testid":"podcast-detail-source-language-row",children:[(0,s.jsx)("p",{className:"text-xs text-[#475569] mb-1",children:n("studio.sourceLanguage")}),(0,s.jsx)("p",{className:"text-[#0F172A]","data-testid":"podcast-detail-source-language-value",children:i.selectedSourceLang})]}),l.speaker_name&&(0,s.jsxs)("div",{"data-testid":"podcast-detail-speaker-row",children:[(0,s.jsx)("p",{className:"text-xs text-[#475569] mb-1",children:n("studio.speaker")}),(0,s.jsx)("p",{className:"text-[#0F172A]","data-testid":"podcast-detail-speaker-value",children:l.speaker_name})]}),l.summary&&(0,s.jsxs)("div",{"data-testid":"podcast-detail-description-row",children:[(0,s.jsx)("p",{className:"text-xs text-[#475569] mb-1",children:n("podcast.description")}),(0,s.jsx)("p",{className:"text-[#0F172A] text-xs","data-testid":"podcast-detail-description-value",children:l.summary})]}),i.streamId&&(0,s.jsxs)("div",{"data-testid":"podcast-detail-stream-id-row",children:[(0,s.jsx)("p",{className:"text-xs text-[#475569] mb-1",children:n("podcast.streamId")}),(0,s.jsx)("p",{className:"text-[#0F172A] text-xs font-mono break-all","data-testid":"podcast-detail-stream-id-value",children:i.streamId})]})]}),l.is_generic_embed?(0,s.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,s.jsxs)("div",{className:"bg-white border border-[#CBD5E1] rounded-xl p-5","data-testid":"podcast-detail-quran-companion",children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-[#0F172A]",children:n("podcast.quranCompanion","Quran Companion")}),(0,s.jsx)("p",{className:"mt-1 text-xs text-[#475569]",children:n("podcast.quranCompanionHint","Enable the public Mushaf and stored Quran translation view for this session.")})]}),(0,s.jsx)("input",{type:"checkbox",checked:c,disabled:i.savingQuranCompanion||u,onChange:e=>i.saveQuranCompanion({enabled:e.target.checked}),"data-testid":"podcast-detail-quran-companion-toggle"})]}),u?(0,s.jsx)("p",{className:"mt-3 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs leading-relaxed text-amber-900","data-testid":"podcast-detail-quran-start-locked",children:n("podcast.quranStartLocked","Quran mode is chosen before starting the session. Stop this 
1stream and start it again to enable it.")}):null,p?(0,s.jsx)("p",{className:"mt-3 rounded-lg border border-rose-200 bg-rose-50 px-3 py-2 text-xs leading-relaxed text-rose-900","data-testid":"podcast-detail-quran-restart-required",children:n("podcast.quranRestartRequired","This stream was started without Quran mode. The public reader can show its initial page, but it cannot follow the recitation until you stop and restart the session with Quran mode enabled.")}):null,c?(0,s.jsx)(V,{session:i,t:n}):null,c?(0,s.jsxs)("label",{className:"mt-4 block text-xs text-[#475569]",children:[n("podcast.quranCompanionDefaultLayout","Default listener layout"),(0,s.jsxs)("select",{value:(null==(a=l.quran_companion)?void 0:a.default_layout_mode)||"overlay",disabled:i.savingQuranCompanion,onChange:e=>i.saveQuranCompanion({default_layout_mode:e.target.value}),className:"mt-1.5 block w-full rounded border border-[#CBD5E1] bg-white px-2 py-1.5 text-sm text-[#0F172A]","data-testid":"podcast-detail-quran-layout",children:[(0,s.jsx)("option",{value:"overlay",children:n("podcast.quranCompanionOverlay","Over video")}),(0,s.jsx)("option",{value:"docked",children:n("podcast.quranCompanionDocked","Beside video")})]})]}):null]}),(0,s.jsxs)("div",{className:"bg-white border border-[#CBD5E1] rounded-xl p-5","data-testid":"podcast-detail-access",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-[#0F172A] mb-4","data-testid":"podcast-detail-access-title",children:n("podcast.companionAccess")}),(0,s.jsxs)("div",{className:"space-y-3","data-testid":"podcast-detail-access-content",children:[(0,s.jsxs)("div",{"data-testid":"podcast-detail-public-url-row",children:[(0,s.jsx)("p",{className:"text-xs text-[#475569] mb-2","data-testid":"podcast-detail-public-url-label",children:n("podcast.publicUrl")}),(0,s.jsxs)("div",{className:"flex items-center gap-2","data-testid":"podcast-detail-public-url-group",children:[(0,s.jsx)("input",{type:"text",readOnly:!0,value:l.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,s.jsx)("button",{type:"button",onClick:i.handleCopyUrl,className:"p-1.5 hover:bg-[#F0FDFA] rounded","data-testid":"podcast-detail-copy-url-btn",children:i.copied?(0,s.jsx)(M.A,{size:14,className:"text-green-600"}):(0,s.jsx)(I.A,{size:14,className:"text-[#475569]"})})]})]}),l.public_url&&(0,s.jsx)(d(),{href:l.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:n("podcast.openPublicPage")}),(0,s.jsx)("button",{type:"button",onClick:()=>i.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:n("podcast.showQrCode")}),(0,s.jsx)("button",{type:"button",onClick:i.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:n("podcast.shareLink")})]})]}),o&&(0,s.jsxs)("div",{className:"bg-white border border-[#CBD5E1] rounded-xl p-5","data-testid":"podcast-detail-source-episode",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-[#0F172A] mb-4","data-testid":"podcast-detail-source-episode-title",children:n("podcast.sourceEpisode")}),(0,s.jsxs)(d(),{href:o,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,s.jsx)("span",{className:"text-sm text-[#0F172A]","data-testid":"podcast-detail-source-episode-link-label",children:n("podcast.openOriginalSource")}),(0,s.jsx)(f.A,{size:14,className:"text-[#475569]"})]})]})]})};var J=a(20063),U=a(59635),Y=a(35352),K=a(13384),G=a(82004),X=a(22033);function Z(){var e,t;let{t:a}=(0,S.s9)(),i=function(){var e,t;let a=(0,J.useRouter)(),s=(0,J.useParams)(),i=(0,J.useSearchParams)(),{t:d}=(0,S.s9)(),l=s.id,n="true"===i.get("autoLive"),o=i.get("sourceLang")||i.get("lang")||"",r=i.get("targetLang")||"",c=(0,w.useRef)(null),p=(0,w.useRef)(null),u=(0,w.useRef)(null),[m,x]=(0,w.useState)(null),[b,h]=(0,w.useState)(!0),[g,v]=(0,w.useState)(""),[f,j]=(0,w.useState)("Auto-detect"),[y,C]=(0,w.useState)(!1),[k,F]=(0,w.useState)(!1),[A,E]=(0,w.useState)(null),[_,q]=(0,w.useState)(null),[D,T]=(0,w.useState)(!1),[z,B]=(0,w.useState)(!1),[L,M]=(0,w.useState)(!1),[R,P]=(0,w.useState)(!1),[Q,I]=(0,w.useState)(!1),[O,V]=(0,w.useState)([]),[W,Z]=(0,w.useState)("disconnected"),[$,ee]=(0,w.useState)(!1),[et,ea]=(0,w.useState)("idle"),[es,ei]=(0,w.useState)({fontSize:17,color:"#FFFFFF",bgOpacity:.5}),[ed,el]=(0,w.useState)(!1),[en,eo]=(0,w.useState)(!1),er=(0,X.fC)({sourceUrl:(null==m?void 0:m.embed_url)||(null==m?void 0:m.source_url)||(null==m?void 0:m.youtube_url)||"",enabled:!!(null==m||null==(e=m.quran_companion)?void 0:e.enabled)}),[ec,ep]=(0,w.useState)(!1),[eu,em]=(0,w.useState)(!1),[ex,eb]=(0,w.useState)("balanced"),[eh,eg]=(0,w.useState)(!1),[ev,ef]=(0,w.useState)("balanced"),[ej,ey]=(0,w.useState)(null),ew=(null==m?void 0:m.stream_id)||null,eN=!!(ew&&(null==m?void 0:m.status)==="live"),eC=(null==m?void 0:m.status)==="ended",eS=(0,w.useCallback)(async()=>{try{let e=await (0,N.apiRequest)("/api/admin/podcasts/".concat(l));x(e.item||e)}catch(e){v(e.message||d("podcast.podcastNotFound"))}finally{h(!1)}},[l,d]);(0,w.useEffect)(()=>{eS()},[eS]),(0,w.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await (0,N.apiRequest)("/api/admin/streaming-stt/config");if(e)return;let a=!!(null==t?void 0:t.available);ep(a),ey(t||null),em(!!a)}catch(t){e||ep(!1)}})(),()=>{e=!0}},[]),(0,w.useEffect)(()=>{let e=(0,K.Rv)(null==m?void 0:m.source_language);e&&j(e)},[null==m?void 0:m.source_language]),(0,w.useEffect)(()=>
1{if(n&&m&&!b){r&&q(r);let t=(0,K.Rv)((0,K.vK)(o))||"";t&&j(t),I(!0);let a=window.__minbarActiveCapture,s=(null==a?void 0:a.handle)||a,i=(null==a?void 0:a.source)||"microphone",d=(0,K.Rv)(null==a?void 0:a.sourceLanguage)||"";if(s&&!u.current){var e;u.current=s,null==(e=s.setMediaClock)||e.call(s,{mediaTimeProvider:er.getMediaTimeMs,mediaClockId:er.sourceClockId}),E(i),d&&j(d),delete window.__minbarActiveCapture}}},[n,null==m?void 0:m.podcast_id,b]),(0,w.useEffect)(()=>{if(!ew)return;(0,N.apiRequest)("/api/public/streams/".concat(ew,"/messages")).then(e=>{let t=(null==e?void 0:e.items)||[];t.length>0&&V(e=>(0,U.zM)(e,t))}).catch(()=>{});let e=(0,U.Bo)(ew,{onConnectionChange:Z,onSnapshot:e=>V(t=>(0,U.zM)(t,e)),onTranscript:e=>V(t=>(0,U.zM)(t,[e])),onTranslationUpdate:e=>{let t=null==e?void 0:e.id,a=(null==e?void 0:e.translations)||{};t&&0!==Object.keys(a).length&&V(e=>e.map(e=>e.id!==t?e:{...e,translations:{...e.translations||{},...a}}))},onStreamEnded:()=>eS(),onError:e=>Y.A.warn("Stream realtime error:",e)});return p.current=e,()=>{e&&e()}},[eS,ew]),(0,w.useEffect)(()=>{let e=()=>ee(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",e),()=>{var t;document.removeEventListener("fullscreenchange",e),(0,G.x)(u).catch(()=>{}),null==(t=p.current)||t.call(p)}},[]);let ek=(0,w.useMemo)(()=>eN?"Live":eC?"Ended":(null==m?void 0:m.status)==="draft"?"Draft":"Ready",[eC,eN,null==m?void 0:m.status]),eF=(0,w.useCallback)(()=>v(""),[]),eA=(0,w.useCallback)(async e=>{if(l&&m){eo(!0),v("");try{var t;let a={quran_companion:{...m.quran_companion||{},...e}};!e.enabled||(null==(t=m.quran_runtime)?void 0:t.quran_mode)||(a.quran_runtime=H.G3);let s=await (0,N.apiRequest)("/api/admin/podcasts/".concat(l),{method:"PATCH",body:JSON.stringify(a)});x(s.item||s)}catch(e){v(e.message||"Could not save Quran Companion settings")}finally{eo(!1)}}},[m,l]),eE=(0,w.useCallback)(async e=>{if(!l||!e)return!1;eo(!0),v("");try{let t=await (0,N.apiRequest)("/api/admin/podcasts/".concat(l),{method:"PATCH",body:JSON.stringify({quran_runtime:e})});return x(t.item||t),!0}catch(e){return v(e.message||"Could not save Quran tracking settings"),!1}finally{eo(!1)}},[l]),e_=(0,w.useCallback)(()=>{var e,t,a;let s=c.current;if(s){if(!document.fullscreenElement){null==(a=s.requestFullscreen)||a.call(s).catch(()=>{});return}null==(e=(t=document).exitFullscreen)||e.call(t).catch(()=>{})}},[]),eq=(0,w.useCallback)(async e=>{E(e),C(!1),T(!0),v("");try{var t,a,s,i,n;let o=(0,K.vK)(f)||"multi",r=!!(eu&&ec),c=r?(0,K.r1)(o,ej):o;if(c!==o){let e=(0,K.Rv)(c);e&&j(e)}let p=await (0,N.apiRequest)("/api/admin/podcasts/".concat(l,"/start-stream"),{method:"POST",body:JSON.stringify({source_language:c,stt_engine:r?"streaming":"batch",live_translation_mode:!!(r&&"low-delay"===ex),live_translation_throttle:"low-delay"===ex?"max":"economic",show_preview_default:!!(r&&eh&&!(null==m||null==(t=m.quran_companion)?void 0:t.enabled)),commit_quality:!r||(null==m||null==(a=m.quran_companion)?void 0:a.enabled)?null:ev})}),b=p.stream_id||(null==(s=p.item)?void 0:s.stream_id),h=p.item||p.podcast||p;h.podcast_id?x(h):await eS();let g=b||(null==m?void 0:m.stream_id);if(!g)throw Error("No stream ID returned from server");u.current=await (0,G.r)({source:e,streamId:g,onStateChange:ea,onError:e=>v(e.message||d("podcast.starting")),mediaTimeProvider:"tab-audio"===e&&(null==m||null==(i=m.quran_companion)?void 0:i.enabled)?er.getMediaTimeMs:null,mediaClockId:"tab-audio"===e&&(null==m||null==(n=m.quran_companion)?void 0:n.enabled)?er.sourceClockId:""})}catch(e){v(e.message||d("podcast.starting")),E(null)}finally{T(!1)}},[eS,ej,null==m||null==(t=m.quran_companion)?void 0:t.enabled,null==m?void 0:m.stream_id,l,f,eh,er.getMediaTimeMs,er.sourceClockId,ec,d,ex,eu,ev]),eD=(0,w.useCallback)(async()=>{await (0,G.x)(u),E(null),ea("idle")},[]),eT=(0,w.useCallback)(async()=>{B(!0);try{var e;await (0,G.x)(u),await (0,N.apiRequest)("/api/admin/podcasts/".concat(l,"/stop-stream"),{method:"POST",body:JSON.stringify({})}).catch(()=>{}),await (0,N.apiRequest)("/api/admin/podcasts/".concat(l,"/set-status"),{method:"POST",body:JSON.stringify({status:"ended"})}).catch(()=>{}),E(null),ea("idle"),I(!1),null==(e=p.current)||e.call(p),V([]),await eS()}finally{B(!1)}},[eS,l]),ez=(0,w.useCallback)(async()=>{await (0,N.apiRequest)("/api/admin/podcasts/".concat(l),{method:"DELETE"}).catch(()=>{}),a.push("/podcast-companion/sessions")},[l,a]),eB=(0,w.useCallback)(async()=>{try{await (0,N.apiRequest)("/api/admin/podcasts/".concat(l,"/set-status"),{method:"POST",body:JSON.stringify({status:"live"})}),await eS()}catch(e){v(e.message)}},[eS,l]),eL=(0,w.useCallback)(e=>{q(e),F(!1),I(!0)},[]),eM=(0,w.useCallback)(()=>{let e=(0,K.L5)(m);e&&(navigator.clipboard.writeText(e),M(!0),setTimeout(()=>M(!1),2e3))},[m]),eR=(0,w.useCallback)(()=>{let e=(0,K.L5)(m);if(e){if(navigator.share)return void navigator.share({title:null==m?void 0:m.title,url:e}).catch(()=>{});eM()}},[eM,m]),eP=(0,w.useCallback)(e=>{var t;if(!_)return e.translated||e.original;let a=(0,K.rb)(_);
1if(a&&(null==(t=e.translations)?void 0:t[a])){let t=e.translations[a];if(t.trim()&&t!==e.original)return t}return _===(0,K.Rv)(null==m?void 0:m.source_language)||a&&a===(null==m?void 0:m.source_language)?e.translated||e.original:null},[_,null==m?void 0:m.source_language]);return{podcast:m,loading:b,error:g,clearError:eF,fetchPodcast:eS,selectedSourceLang:f,setSelectedSourceLang:j,showAudioSourceModal:y,setShowAudioSourceModal:C,showLanguageModal:k,setShowLanguageModal:F,selectedAudioSource:A,selectedTranslationLang:_,startingStream:D,stoppingStream:z,sttAvailable:ec,useStreamingStt:eu,setUseStreamingStt:em,translationProfile:ex,setTranslationProfile:eb,showInterimPreview:eh,commitQuality:ev,setCommitQuality:ef,setShowInterimPreview:eg,mosqueSttConfig:ej,copied:L,showQrModal:R,setShowQrModal:P,localLive:Q,setLocalLive:I,messages:O,connectionStatus:W,isFullscreen:$,fullscreenContainerRef:c,streamId:ew,isStreaming:eN,isEnded:eC,statusLabel:ek,audioCaptureState:et,subtitleSettings:es,setSubtitleSettings:ei,showSubtitleControls:ed,setShowSubtitleControls:el,savingQuranCompanion:en,sourceVideoIframeRef:er.iframeRef,sourceClockStatus:er.status,saveQuranCompanion:eA,saveQuranRuntime:eE,toggleFullscreen:e_,handleStartTranscription:()=>C(!0),handleAudioSourceSelect:eq,handleStopCapture:eD,handleEndSession:eT,handleDelete:ez,handleSetLive:eB,handleOpenLiveView:()=>F(!0),handleLanguageSelect:eL,handleCopyUrl:eM,handleShare:eR,getTranslatedText:eP}}();return i.loading?(0,s.jsx)("div",{className:"flex items-center justify-center py-20","data-testid":"podcast-detail-loading",children:(0,s.jsx)(l.A,{size:24,className:"animate-spin text-[#0F766E]"})}):i.error&&!i.podcast?(0,s.jsxs)("div",{className:"space-y-4","data-testid":"podcast-detail-error-state",children:[(0,s.jsxs)(d(),{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,s.jsx)(n.A,{size:16}),(0,s.jsx)("span",{"data-testid":"podcast-detail-error-back-link-label",children:a("podcastNew.backToSessions")})]}),(0,s.jsx)("div",{className:"p-6 bg-red-50 border border-red-200 rounded-xl text-red-700","data-testid":"podcast-detail-error-message",children:i.error})]}):i.podcast?i.localLive&&i.selectedTranslationLang?(0,s.jsx)(P,{session:i}):(0,s.jsxs)("div",{className:"space-y-4 sm:space-y-6","data-testid":"podcast-detail-page",children:[(0,s.jsxs)(d(),{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,s.jsx)(n.A,{size:16}),(0,s.jsx)("span",{"data-testid":"podcast-detail-back-label",children:a("podcastNew.backToSessions")})]}),(0,s.jsx)(r.T,{error:i.error,onDismiss:i.clearError,testId:"podcast-detail-error"}),(0,s.jsx)(D,{podcast:i.podcast,statusLabel:i.statusLabel,isEnded:i.isEnded,stoppingStream:i.stoppingStream,onEndSession:i.handleEndSession,onDelete:i.handleDelete}),(0,s.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6","data-testid":"podcast-detail-layout",children:[(0,s.jsx)("div",{className:"lg:col-span-2","data-testid":"podcast-detail-main-column",children:(0,s.jsx)(_,{session:i})}),(0,s.jsx)(W,{session:i})]}),(0,s.jsx)(o.r,{open:i.showAudioSourceModal,onClose:()=>i.setShowAudioSourceModal(!1),onSelect:i.handleAudioSourceSelect,loading:i.startingStream,testIdPrefix:"podcast-detail",sttAvailable:i.sttAvailable,useStreamingStt:i.useStreamingStt,onToggleStreamingStt:i.setUseStreamingStt,translationProfile:i.translationProfile,onTranslationProfileChange:i.setTranslationProfile,showInterimPreview:i.showInterimPreview,onShowInterimPreviewChange:i.setShowInterimPreview,commitQuality:i.commitQuality,onCommitQualityChange:i.setCommitQuality,mosqueSttConfig:i.mosqueSttConfig,quranCompanionEnabled:!!(null==(t=i.podcast)||null==(e=t.quran_companion)?void 0:e.enabled)}),(0,s.jsx)(c.W,{open:i.showLanguageModal,onClose:()=>i.setShowLanguageModal(!1),onSelect:i.handleLanguageSelect,podcastTitle:i.podcast.title,testIdPrefix:"podcast-detail"}),(0,s.jsx)(Q,{open:i.showQrModal,podcast:i.podcast,copied:i.copied,onCopy:i.handleCopyUrl,onClose:()=>i.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.