PageSourceSearch

https://master.euleinstitute.com/_next/static/chunks/4200.d15f4843c488fa83.js

js euleinstitute.com collected 2026-10-09 22:25:54 UTC 33,625 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4200],{21651:function(e,t,a){a.d(t,{x:function(){return d}});var r=a(42620),n=a(40740),l=a(29012);function d(e){let{lessonId:t,slotIndex:a,report:d,altHtmlUrl:s,onRemediated:i}=e,o=(0,l.T)("builderMain"),[c,u]=(0,n.useState)(null),[m,x]=(0,n.useState)(null),[v,p]=(0,n.useState)(null);if(!d)return null;let f="pdf"===d.kind&&d.findings.some(e=>"image_only_pdf"===e.code)&&!s,b="docx"===d.kind,h=d.score>=85?"success":d.score>=50?"warning":"danger",g=async e=>{u(e),x(null);try{let n=await fetch("/api/lessons/".concat(t,"/attachments/").concat(a,"/remediate"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:e})}),l=await n.json().catch(()=>null);if(!n.ok||!(null==l?void 0:l.data)){var r;x(null!==(r=null==l?void 0:l.error)&&void 0!==r?r:o("a11yDocError"));return}let d={action:e,...l.data};p(d),i(d)}catch(e){x(o("a11yDocError"))}finally{u(null)}};return(0,r.jsxs)("section",{"aria-labelledby":"a11y-doc-".concat(t,"-").concat(a),className:"mt-3 rounded-md border border-[rgb(var(--border-default))] bg-[rgb(var(--surface-raised))] p-3 text-sm",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,r.jsx)("h3",{id:"a11y-doc-".concat(t,"-").concat(a),className:"font-medium",children:o("a11yDocTitle")}),(0,r.jsx)("span",{className:"mono-badge text-[rgb(var(--".concat(h,"))]"),children:o("a11yDocScore",{score:d.score})})]}),0===d.findings.length?(0,r.jsx)("p",{className:"mt-2 text-[rgb(var(--success))]",children:o("a11yDocClean")}):(0,r.jsx)("ul",{role:"list",className:"mt-2 space-y-2",children:d.findings.map(e=>{var t,a;return(0,r.jsxs)("li",{className:"flex gap-2",children:[(0,r.jsx)("span",{"aria-hidden":"true",children:"error"===e.severity?"✕":"warning"===e.severity?"⚠":"ℹ"}),(0,r.jsxs)("span",{children:[(0,r.jsx)("span",{className:"font-medium",children:(t=e.code,a=e.count,o("docFinding_".concat(t),{count:null!=a?a:0}))}),(0,r.jsx)("span",{className:"block text-xs text-[rgb(var(--text-muted))]",children:o("docFix_".concat(e.code))})]})]},e.code)})}),s?(0,r.jsx)("p",{className:"mt-3",children:(0,r.jsx)("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"font-medium text-[rgb(var(--brand))] underline underline-offset-2",children:o("a11yDocAltHtmlLabel")})}):null,(f||b)&&!v?(0,r.jsxs)("div",{className:"mt-3 flex flex-wrap gap-3",children:[f?(0,r.jsx)("button",{type:"button",disabled:null!==c,onClick:()=>g("ocr"),className:"rounded-md bg-[rgb(var(--brand))] px-3 py-1.5 text-xs font-semibold text-[rgb(var(--brand-foreground))] disabled:opacity-60",children:"ocr"===c?o("a11yDocOcrBusy"):o("a11yDocOcrCta")}):null,b?(0,r.jsx)("button",{type:"button",disabled:null!==c,onClick:()=>g("convert_to_text_lesson"),className:"rounded-md border border-[rgb(var(--brand))] px-3 py-1.5 text-xs font-semibold text-[rgb(var(--brand))] disabled:opacity-60",children:"convert_to_text_lesson"===c?o("a11yDocConvertBusy"):o("a11yDocConvertCta")}):null]}):null,(null==v?void 0:v.action)==="convert_to_text_lesson"?(0,r.jsx)("p",{role:"status",className:"mt-3 text-[rgb(var(--success))]",children:o("a11yDocConvertDone")}):null,(null==v?void 0:v.action)==="ocr"?(0,r.jsx)("p",{role:"status",className:"mt-3 text-[rgb(var(--success))]",children:v.truncated?o("a11yDocOcrDoneTruncated",{done:v.pagesProcessed,total:v.pagesTotal}):o("a11yDocOcrDone")}):null,m?(0,r.jsx)("p",{role:"alert",className:"mt-3 text-[rgb(var(--danger))]",children:m}):null]})}},23732:function(e,t,a){a.d(t,{z:function(){return i}});var r=a(42620),n=a(40740),l=a(29012),d=a(21651);async function s(e){if(!/\.pdf$/i.test(e.name)&&"application/pdf"!==e.type)return!1;try{let t=await e.text();return!/\/MarkInfo|\/Marked\s*\/?true|\/StructTreeRoot/.test(t)}catch(e){return!1}}function i(e){let{lessonId:t,url:a,name:i,a11y:o=null,altHtmlUrl:c=null,onChange:u}
1=e,m=(0,l.T)("builderMain"),[x,v]=(0,n.useState)(!1),[p,f]=(0,n.useState)(!1),b=async e=>{v(!0);try{var a,r;let n=new FormData;n.append("file",e);let l=await fetch("/api/lessons/".concat(t,"/template"),{method:"POST",body:n}),d=await l.json().catch(()=>null);if(l.ok&&(null==d?void 0:null===(a=d.data)||void 0===a?void 0:a.url)){let t=null!==(r=d.data.a11y)&&void 0!==r?r:null;f(!t&&await s(e)),u(d.data.url,d.data.name,{a11y:t,altHtmlUrl:null})}}finally{v(!1)}};return(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-medium",children:m("attachmentLabel")}),(0,r.jsx)("p",{className:"mt-0.5 text-xs text-[rgb(var(--text-muted))]",children:m("attachmentHint")}),(0,r.jsx)("div",{className:"mt-2",children:a?(0,r.jsxs)("div",{className:"flex items-center gap-3 rounded-lg border border-[rgb(var(--border-default))] bg-[rgb(var(--surface-base))] p-3",children:[(0,r.jsx)("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-md bg-[rgb(var(--brand))]/10 text-[rgb(var(--text-primary))]","aria-hidden":"true",children:(0,r.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8l-6-6z"}),(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14 2v6h6"})]})}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsx)("a",{href:a,target:"_blank",rel:"noopener noreferrer",className:"block truncate text-sm font-semibold text-[rgb(var(--text-primary))] hover:text-[rgb(var(--brand))] hover:underline",children:i||m("attachmentFallbackName")}),(0,r.jsx)("p",{className:"text-xs text-[rgb(var(--text-muted))]",children:m("attachmentDownloadable")})]}),(0,r.jsxs)("label",{className:"shrink-0 cursor-pointer text-sm font-medium text-[rgb(var(--brand))] hover:underline",children:[m(x?"uploading":"replace"),(0,r.jsx)("input",{type:"file",className:"sr-only",disabled:x,onChange:e=>{var t;let a=null===(t=e.target.files)||void 0===t?void 0:t[0];a&&b(a),e.currentTarget.value=""}})]}),(0,r.jsx)("button",{type:"button",onClick:()=>u(null,null,{a11y:null,altHtmlUrl:null}),className:"shrink-0 text-sm font-medium text-[rgb(var(--danger))] hover:underline",children:m("remove")})]}):(0,r.jsxs)("label",{className:"flex cursor-pointer items-center gap-3 rounded-lg border border-dashed border-[rgb(var(--border-default))] bg-[rgb(var(--surface-base))] p-4 hover:border-[rgb(var(--brand))] hover:bg-[rgb(var(--surface-raised))]",children:[(0,r.jsx)("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-md bg-[rgb(var(--surface-raised))] text-[rgb(var(--text-muted))]","aria-hidden":"true",children:(0,r.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3v12m0 0l-4-4m4 4l4-4M5 21h14"})})}),(0,r.jsx)("span",{className:"text-sm font-medium text-[rgb(var(--text-primary))]",children:m(x?"uploading":"attachmentUploadCta")}),(0,r.jsx)("input",{type:"file",className:"sr-only",disabled:x,onChange:e=>{var t;let a=null===(t=e.target.files)||void 0===t?void 0:t[0];a&&b(a),e.currentTarget.value=""}})]})}),p?(0,r.jsxs)("p",{role:"status",className:"mt-2 flex items-start gap-1.5 text-xs text-[rgb(var(--warning))]",children:[(0,r.jsx)("span",{"aria-hidden":"true",children:"⚠"}),(0,r.jsx)("span",{children:m("pdfUntaggedWarning")})]}):null,a?(0,r.jsx)(d.x,{lessonId:t,slotIndex:0,report:o,altHtmlUrl:c,onRemediated:e=>{"ocr"===e.action&&u(a,i,{a11y:o,altHtmlUrl:e.altHtmlUrl})}}):null]})}},4200:function(e,t,a){a.r(t),a.d(t,{VideoLessonEditor:function(){return y}});var r=a(42620),n=a(40740),l=a(29012),d=a(51212),s=a(25634),i=a(98869),o=a(60650),c=a(23732),u=a(3050);let m="[extended]";function x(e){let t=Math.max(0,e),a=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return String(e).padStart(t,"0")};return"".concat(a(Math.floor(t/3600)),":").concat(a(Math.floor(t%3600/60)),":").concat(a(Math.floor(t%60)),".").concat(a(Math.round((t-Math.floor(t))*1e3),3))}let v="w-full rounded-md border border-[rgb(var(--border-default))] bg-[rgb(var(--surface-base))] px-2 py-1.5 text-sm focus:border-[rgb(var(--focus-ring))] focus:outline-none focus:ring-2 focus:ring-[rgb(var(--focus-ring))]/30",p=0,f=()=>"cue-".concat(Date.now(),"-").concat(p++);function b(e){let t=e.trim();if(/^\d+(\.\d+)?$/.test(t))return Number(t);let a=t.match(/^(?:(\d{1,2}):)?(\d{1,2}):(\d{2})(?:[.,](\d{1,3}))?$/);if(!a)return null;let[,r,n,l,d]=a;return(r?3600*Number(r):0)+60*Number(n)+Number(l)+(d?Number(d.padEnd(3,"0"))/1e3:0)}function h(e){var t;let{lessonId:a,ad:d,onCommit:o}=e,c=(0,l.T)("builderMain"),{announce:p}
1=(0,i.t)(),h=(0,n.useId)(),[g,y]=(0,n.useState)(null),[j,N]=(0,n.useState)(null),[w,C]=(0,n.useState)(null),k=null!==(t=null==d?void 0:d.draftVttPath)&&void 0!==t?t:null,D=(0,n.useCallback)(async()=>{let e=(0,u.GV)(k);if(e){N("load"),C(null);try{var t;let a=await fetch("".concat(e,"?t=").concat(Date.now()),{cache:"no-store"});if(!a.ok)throw Error();y((t=await a.text(),(0,u.Kk)(t).map(e=>{let t=e.text.startsWith(m);return{start:e.start,end:e.end,text:t?e.text.slice(m.length).trim():e.text,extended:t}})).map(e=>({...e,key:f(),reviewed:!1})))}catch(e){C(c("adDraftLoadFailed"))}finally{N(null)}}},[k,c]);(0,n.useEffect)(()=>{k?D():y(null)},[k,D]);let S=async()=>{N("generate"),C(null),p(c("adDraftGenerating"));try{let e=await fetch("/api/admin/videos/".concat(a,"/audio-description/generate"),{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"}),t=await e.json().catch(()=>null);if(!e.ok)throw Error((null==t?void 0:t.error)||c("adDraftFailed"));let r=t.data,n=new Date().toISOString();await o({...d,draftVttPath:r.draftVttPath,draftStatus:"needs_review",draftCueCount:r.cueCount,draftGeneratedAt:n,updatedAt:n}),p(c("adDraftReady",{count:r.cueCount,extended:r.extendedCount}))}catch(e){C(e instanceof Error?e.message:c("adDraftFailed"))}finally{N(null)}},T=(e,t)=>y(a=>(null!=a?a:[]).map(a=>a.key===e?{...a,...t}:a)),I=e=>y(t=>(null!=t?t:[]).filter(t=>t.key!==e)),P=e=>fetch("/api/upload/audio-description?lessonId=".concat(encodeURIComponent(a),"&path=").concat(encodeURIComponent(e)),{method:"DELETE"}).catch(()=>null),E=async()=>{if(k&&confirm(c("adDraftDiscardConfirm"))){N("discard");try{let e={...d,draftVttPath:null,draftStatus:null,draftCueCount:null,draftGeneratedAt:null,updatedAt:new Date().toISOString()};await o(e.vttPath||e.audioPath?e:null),P(k),y(null),p(c("adDraftDiscarded"))}finally{N(null)}}},U=!!(g&&g.length>0&&g.every(e=>e.reviewed&&e.text.trim()&&e.end>e.start)),F=async()=>{if(g&&U){N("save"),C(null);try{var e,t;let r=[...g].sort((e,t)=>e.start-t.start).map(e=>{let{start:t,end:a,text:r,extended:n}=e;return{start:t,end:a,text:r.trim(),extended:n}}),n=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=["WEBVTT","Kind: descriptions",...t.note?["","NOTE ".concat(t.note)]:[],""],r=e.map((e,t)=>{let a=e.extended?"".concat(m," ").concat(e.text):e.text;return["".concat(t+1),"".concat(x(e.start)," --> ").concat(x(e.end)),a].join("\n")});return"".concat(a.join("\n"),"\n").concat(r.join("\n\n"),"\n")}(r),l=new FormData;l.append("lessonId",a),l.append("kind","vtt"),l.append("file",new File([n],"descriptions.vtt",{type:"text/vtt"}));let s=await fetch("/api/upload/audio-description",{method:"POST",body:l}),i=await s.json().catch(()=>null),u=null==i?void 0:i.data;if(!s.ok||!(null==u?void 0:u.path))throw Error("string"==typeof(null==i?void 0:i.error)?i.error:c("adUploadFailed"));let v=null!==(e=null==d?void 0:d.vttPath)&&void 0!==e?e:null;await o({...d,vttPath:u.path,vttName:"descriptions.vtt",vttCueCount:null!==(t=u.cueCount)&&void 0!==t?t:r.length,draftVttPath:null,draftStatus:null,draftCueCount:null,draftGeneratedAt:null,updatedAt:new Date().toISOString()}),k&&P(k),v&&v!==u.path&&P(v),y(null),p(c("adDraftSaved",{count:r.length}))}catch(e){C(e instanceof Error?e.message:c("adUploadFailed"))}finally{N(null)}}};return(0,r.jsxs)("div",{className:"rounded-md border border-dashed border-[rgb(var(--border-default))] p-3",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium text-[rgb(var(--text-secondary))]",children:c("adDraftTitle")}),(0,r.jsx)("p",{className:"text-xs text-[rgb(var(--text-muted))]",children:c("adDraftHint")})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[k?(0,r.jsx)(s.z,{type:"button",variant:"secondary",size:"sm",onClick:()=>void E(),loading:"discard"===j,disabled:null!==j,children:c("adDraftDiscard")}):null,(0,r.jsx)(s.z,{type:"button",variant:"secondary",size:"sm",onClick:()=>void S(),loading:"generate"===j,disabled:null!==j,children:k?c("adDraftRegenerate"):c("adDraftGenerate")})]})]}),w?(0,r.jsx)("p",{role:"alert",className:"mt-2 text-sm text-[rgb(var(--danger))]",children:w}):null,"generate"===j?(0,r.jsx)("p",{className:"mt-2 text-xs text-[rgb(var(--text-muted))]",children:c("ad
1DraftGeneratingHint")}):null,k&&g?(0,r.jsxs)("form",{className:"mt-3 space-y-3",onSubmit:e=>{e.preventDefault(),F()},children:[(0,r.jsx)("p",{className:"text-xs text-[rgb(var(--text-muted))]",children:c("adDraftReviewHint",{count:g.length})}),0===g.length?(0,r.jsx)("p",{className:"text-sm text-[rgb(var(--text-muted))]",children:c("adDraftEmpty")}):null,(0,r.jsx)("ol",{className:"space-y-2",children:g.map((e,t)=>(0,r.jsx)("li",{children:(0,r.jsxs)("fieldset",{className:"rounded-md border p-2 ".concat(e.reviewed?"border-[rgb(var(--success))]/60":"border-[rgb(var(--border-default))]"),children:[(0,r.jsxs)("legend",{className:"px-1 text-xs font-medium text-[rgb(var(--text-secondary))]",children:[c("adCueLegend",{index:t+1}),e.extended?" \xb7 ".concat(c("adCueExtended")):""]}),(0,r.jsxs)("div",{className:"grid gap-2 sm:grid-cols-[7rem_7rem_1fr]",children:[(0,r.jsxs)("label",{className:"block text-xs",children:[(0,r.jsx)("span",{className:"sr-only",children:c("adCueStart")}),(0,r.jsx)("input",{id:"".concat(h,"-").concat(e.key,"-start"),"aria-label":c("adCueStart"),defaultValue:x(e.start),onBlur:t=>{let a=b(t.target.value);null!==a&&T(e.key,{start:a})},className:v})]}),(0,r.jsxs)("label",{className:"block text-xs",children:[(0,r.jsx)("span",{className:"sr-only",children:c("adCueEnd")}),(0,r.jsx)("input",{"aria-label":c("adCueEnd"),defaultValue:x(e.end),onBlur:t=>{let a=b(t.target.value);null!==a&&T(e.key,{end:a})},className:v})]}),(0,r.jsxs)("label",{className:"block text-xs",children:[(0,r.jsx)("span",{className:"sr-only",children:c("adCueText")}),(0,r.jsx)("input",{"aria-label":c("adCueText"),value:e.text,onChange:t=>T(e.key,{text:t.target.value}),className:v,required:!0})]})]}),(0,r.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-4 text-xs",children:[(0,r.jsxs)("label",{className:"flex items-center gap-1",children:[(0,r.jsx)("input",{type:"checkbox",checked:e.extended,onChange:t=>T(e.key,{extended:t.target.checked})}),c("adCueExtendedToggle")]}),(0,r.jsxs)("label",{className:"flex items-center gap-1 font-medium",children:[(0,r.jsx)("input",{type:"checkbox",checked:e.reviewed,onChange:t=>T(e.key,{reviewed:t.target.checked})}),c("adCueReviewed")]}),(0,r.jsx)("button",{type:"button",onClick:()=>I(e.key),className:"ml-auto text-[rgb(var(--danger))] hover:underline",children:c("adCueRemove")})]})]})},e.key))}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)(s.z,{type:"button",variant:"secondary",size:"sm",onClick:()=>y(e=>{let t=null==e?void 0:e[e.length-1],a=t?t.end+1:0;return[...null!=e?e:[],{key:f(),start:a,end:a+2.5,text:"",extended:!1,reviewed:!1}]}),disabled:null!==j,children:c("adCueAdd")}),(0,r.jsx)(s.z,{type:"submit",size:"sm",loading:"save"===j,disabled:!U||null!==j,children:c("adDraftSave")}),!U&&g.length>0?(0,r.jsx)("span",{className:"text-xs text-[rgb(var(--text-muted))]",children:c("adDraftSaveHint")}):null]})]}):k&&"load"===j?(0,r.jsx)("p",{className:"mt-2 text-xs text-[rgb(var(--text-muted))]",children:c("adDraftLoading")}):null]})}var g=a(98643);function y(e){var t,a;let{lessonId:o,status:u,content:m,onContentChange:x}=e,v=(0,l.T)("builderMain"),{announce:p}=(0,i.t)(),f=(0,n.useRef)(null),[b,h]=(0,n.useState)(()=>m.streamId&&"ready"===u?"ready":m.streamId&&"processing"===u?"processing":"idle"),[g,y]=(0,n.useState)(0),[N,w]=(0,n.useState)(null),C=(0,n.useRef)(null);(0,n.useEffect)(()=>{if("processing"!==b)return;let e=setInterval(async()=>{try{let e=await fetch("/api/lessons/".concat(o,"/video-status"));if(!e.ok)return;let t=await e.json();"ready"===t.data.status&&(h("ready"),x(t.data.content,"ready"),p(v("announceVideoReady")))}catch(e){}},5e3);return()=>clearInterval(e)},[b,o,x,p,v]);let k=(0,n.useCallback)(async e=>{var t,a;let r;if(e.size>5368709120){w(v("videoTooLarge"));return}if(!e.type.startsWith("video/")){w(v("videoOnlyVideoFiles"));return}w(null),h("starting"),y(0);try{let e=await fetch("/api/upload/video",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lessonId:o})}),a=await e.json();if(!e.ok){w(null!==(t=a.error)&&void 0!==t?t:v("videoUploadStartFailed")),h("error");return}r=a.data}catch(e){w(v("videoNetworkError")),h("error");return}let n=new d.gq(e,{endpoint:r.endpoint,...r.uploadUrl?{uploadUrl:r.uploadUrl}:{},...r.headers?{headers:r.headers}:{},chunkSize:52428800,metadata:{name:e.name,filetype:e.type,lessonId:o,...null!==(a=r.metadata)&&void 0!==a?a:{}},onError:e=>{console.error("[tus]",e),w(v("videoUploadFailed")),h("error")},onProgress:(e,t)=>{y(t>0?Math.round(e/t*100):0),h("uploading")},onSuccess:()=>{y(100),h("processing"),x({...m,provider:r.provider,streamId:r.uid,library
1Id:r.libraryId,captionsStatus:"pending"},"processing"),p(v("announceUploadComplete"))}});f.current=n,n.start()},[o,m,x,p,v]),D=(0,n.useCallback)(()=>{var e;null===(e=f.current)||void 0===e||e.abort(),f.current=null,h("idle"),y(0)},[]);return(0,r.jsxs)("div",{className:"rounded-md border border-[rgb(var(--border-default))] bg-[rgb(var(--surface-base))] p-6",children:["idle"===b||"error"===b?(0,r.jsxs)("div",{className:"flex flex-col items-center gap-4 rounded-lg border-2 border-dashed border-[rgb(var(--border-default))] bg-[rgb(var(--surface-raised))] p-10 text-center",onDragOver:e=>e.preventDefault(),onDrop:e=>{var t;e.preventDefault();let a=null===(t=e.dataTransfer.files)||void 0===t?void 0:t[0];a&&k(a)},children:[(0,r.jsx)("p",{className:"text-base font-medium",children:v("videoDropTitle")}),(0,r.jsx)("p",{className:"text-sm text-[rgb(var(--text-muted))]",children:v("videoDropHint")}),(0,r.jsx)("input",{ref:C,type:"file",accept:"video/mp4,video/quicktime,video/webm",className:"sr-only",onChange:e=>{var t;let a=null===(t=e.target.files)||void 0===t?void 0:t[0];a&&k(a),e.currentTarget.value=""}}),(0,r.jsx)(s.z,{type:"button",onClick:()=>{var e;return null===(e=C.current)||void 0===e?void 0:e.click()},children:v("videoChooseCta")}),N?(0,r.jsx)("p",{role:"alert",className:"text-sm text-[rgb(var(--danger))]",children:N}):null]}):null,"starting"===b||"uploading"===b?(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium",children:v("uploadingProgress")}),(0,r.jsx)("div",{role:"progressbar","aria-valuenow":g,"aria-valuemin":0,"aria-valuemax":100,"aria-label":v("uploadProgressLabel"),className:"mt-3 h-2 w-full overflow-hidden rounded-full bg-[rgb(var(--surface-raised))]",children:(0,r.jsx)("div",{className:"h-full rounded-full bg-[rgb(var(--brand))] transition-[width] motion-reduce:transition-none",style:{width:"".concat(g,"%")}})}),(0,r.jsxs)("div",{className:"mt-2 flex items-center justify-between text-xs text-[rgb(var(--text-muted))]",children:[(0,r.jsxs)("span",{children:[g,"%"]}),(0,r.jsx)("button",{type:"button",onClick:D,className:"rounded-md px-2 py-1 hover:bg-[rgb(var(--surface-raised))]",children:v("cancel")})]})]}):null,"processing"===b?(0,r.jsxs)("div",{className:"flex items-center gap-3 rounded-md bg-[rgb(var(--surface-raised))] p-4 text-sm",children:[(0,r.jsx)("span",{"aria-hidden":"true",className:"inline-block h-5 w-5 animate-spin rounded-full border-2 border-[rgb(var(--brand))] border-r-transparent motion-reduce:animate-none"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"font-medium",children:v("generatingCaptions")}),(0,r.jsx)("p",{className:"text-[rgb(var(--text-muted))]",children:v("processingHint")})]})]}):null,"ready"===b&&m.streamId?(0,r.jsx)(j,{lessonId:o,content:m,onReset:()=>{h("idle"),x({...m,streamId:null,captionsStatus:"missing"},"draft")}}):null,(0,r.jsx)("div",{className:"mt-6 border-t border-[rgb(var(--border-default))] pt-6",children:(0,r.jsx)(c.z,{lessonId:o,url:null!==(t=m.attachmentUrl)&&void 0!==t?t:null,name:null!==(a=m.attachmentName)&&void 0!==a?a:null,onChange:(e,t)=>
1x({...m,attachmentUrl:e,attachmentName:t},u)})})]})}function j(e){var t,a;let{lessonId:d,content:s,onReset:i}=e,c=(0,l.T)("builderMain"),u=(0,n.useRef)(s),m=e=>(u.current={...u.current,...e},fetch("/api/lessons/".concat(d),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:u.current})})),[x,v]=(0,n.useState)(null!==(t=s.description)&&void 0!==t?t:""),p=(0,n.useRef)(null),f=e=>{v(e),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{m({description:e})},1200)};(0,n.useEffect)(()=>()=>{p.current&&clearTimeout(p.current)},[]);let b=null!==(a=s.captionsStatus)&&void 0!==a?a:"missing",h={ready:{label:c("captionsReady"),className:"bg-[rgb(var(--success))]/15 text-[rgb(var(--text-primary))]"},pending:{label:c("captionsPending"),className:"bg-[rgb(var(--warning))]/15 text-[rgb(var(--text-primary))]"},missing:{label:c("captionsMissing"),className:"bg-[rgb(var(--danger))]/10 text-[rgb(var(--text-primary))]"}}[b];return(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,r.jsx)("span",{className:"rounded-full px-3 py-1 text-xs font-medium ".concat(h.className),children:h.label}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("a",{href:"/courses/videos/".concat(d),className:"rounded-md border border-[rgb(var(--border-default))] px-3 py-1 text-sm text-[rgb(var(--text-secondary))] hover:bg-[rgb(var(--surface-raised))]",children:c("manageCaptions")}),(0,r.jsx)("button",{type:"button",onClick:i,className:"rounded-md border border-[rgb(var(--border-default))] px-3 py-1 text-sm text-[rgb(var(--text-secondary))] hover:bg-[rgb(var(--surface-raised))]",children:c("replaceVideo")})]})]}),(0,r.jsx)("div",{className:"aspect-video overflow-hidden rounded-lg bg-black",children:(0,r.jsx)("iframe",{src:(0,o.L)(s),loading:"lazy",allow:"accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture",allowFullScreen:!0,className:"h-full w-full",title:c("videoIframeTitle",{lessonId:d})})}),s.transcript?(0,r.jsxs)("details",{className:"rounded-md border border-[rgb(var(--border-default))] bg-[rgb(var(--surface-base))]",children:[(0,r.jsx)("summary",{className:"cursor-pointer select-none px-4 py-3 text-sm font-medium",children:c("transcript")}),(0,r.jsx)("p",{className:"whitespace-pre-wrap px-4 pb-4 text-sm text-[rgb(var(--text-secondary))]",children:s.transcript})]}):null,(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"desc-".concat(d),className:"block text-sm font-medium text-[rgb(var(--text-secondary))]",children:c("videoDescription")}),(0,r.jsx)("textarea",{id:"desc-".concat(d),value:x,onChange:e=>f(e.target.value),rows:3,placeholder:c("videoDescriptionPlaceholder"),className:"mt-1 w-full rounded-md border border-[rgb(var(--border-default))] bg-[rgb(var(--surface-base))] px-3 py-2 text-sm focus:border-[rgb(var(--focus-ring))] focus:outline-none focus:ring-2 focus:ring-[rgb(var(--focus-ring))]/30"}),(0,r.jsx)("p",{className:"mt-1 text-xs text-[rgb(var(--text-muted))]",children:c("videoDescriptionHint")})]}),(0,r.jsx)(N,{lessonId:d,content:s,persist:m})]})}function N(e){var t,a,d,s,o,c;let{lessonId:m,content:x,persist:v}=e,p=(0,l.T)("builderMain"),f=(0,g.W)(),{announce:b}=(0,i.t)(),[y,j]=(0,n.useState)(null!==(t=x.audioDescription)&&void 0!==t?t:null),N=(0,n.useRef)(y),[C,k]=(0,n.useState)(null!==(a=x.audioDescriptionUrl)&&void 0!==a?a:null),[D,S]=(0,n.useState)(null),[T,I]=(0,n.useState)(null),P=(0,u.GV)(null==y?void 0:y.vttPath),E=null!==(d=(0,u.GV)(null==y?void 0:y.audioPath))&&void 0!==d?d:C,U=(null==y?void 0:y.audioPath)?null!==(s=y.audioName)&&void 0!==s?s:null:null!==(o=x.audioDescriptionName)&&void 0!==o?o:null,F=async(e,t)=>{let a=(0,u.kZ)(t.name);return"vtt"===e?"vtt"!==a?p("adVttInvalidType"):t.size>u.uI?p("adVttTooLarge"):(0,u.y4)(await t.text())?null:p("adVttInvalidSignature"):u.Il[a]?t.size>u.eV?p("adAudioTooLarge"):null:p("adAudioInvalidType")},L=e=>(N.current=e,j(e),v({audioDescription:e})),M=e=>fetch("/api/upload/audio-description?lessonId=".concat(encodeURIComponent(m),"&path=").concat(encodeURIComponent(e)),{method:"DELETE"}).catch(()=>null),V=async(e,t)=>{I(null);let a=await F(e,t);if(a){I(a);return}S(e);try{var r,n,l,d;let a=new FormData;a.append("lessonId",m),a.append("kind",e),a.append("file",t);let s=await fetch("/api/upload/audio-description",{method:"POST",body:a}),i=await s.json().catch(()=>null),o=null==i?void 0:i.data;if(!s.ok||!(null==o?void 0:o.path)){I("string"==typeof(null==i?void 0:i.error)?i.error:p("adUploadFailed"));return}let c=N.current,u="vtt"===e?null==c?void 0:c.vttPath:null==c?void 0:c.audioPath,x=new Date().toISOString(),v="vtt"===e?{...c,vttPath:o.path,vttName:null!==(r=o.name)&&void 0!==r?r:t.name,vttCueCount:null!==(n=o.cueCount)&&void 0!==n?n:null,updatedAt:x}:{...c,audioPath:o.path,audioName:null!==(l=o.name)&&void 0!==l?l:t.name,updatedAt:x};await L(v),u&&M(u),b("vtt"===e?p("adVttUploaded",{count:null!==(d=o.cueCount)&&void 0!==d?d:0}):p("adAudioUploaded"))}catch(e){I(p("adUploadFailed"))}finally{S(null)}},_=async e=>{I(null);let t=N.current;if("audio"===e&&!(null==t?void 0:t.audioPath)&&C){k(null),await v({audioDescriptionUrl:null,audioDescriptionName:null});return}let a="vtt"===e?null==t?void 0:t.vttPath:null==t?void 0:t.audioPath,r={...t,updatedAt:new Date().toISOString(),..."vtt"===e?{vttPath:null,vttName:null,vttCueCount:null}:{audioPath:null,audioName:null}};await L(r.vttPath||r.audioPath?r:null),a&&M(a)},O=e=>
1"vtt"===e?p("adRemoveVtt"):p("adRemoveAudio");return(0,r.jsxs)("section",{"aria-labelledby":"ad-heading-".concat(m),className:"space-y-4 rounded-md border border-[rgb(var(--border-default))] p-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{id:"ad-heading-".concat(m),className:"text-sm font-semibold",children:p("audioDescription")}),(0,r.jsx)("p",{className:"mt-1 text-xs text-[rgb(var(--text-muted))]",children:p("adSectionHint")})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium text-[rgb(var(--text-secondary))]",children:p("adVttLabel")}),P?(0,r.jsxs)("div",{className:"mt-1 flex flex-wrap items-center gap-3 text-sm",children:[(0,r.jsx)("a",{href:P,target:"_blank",rel:"noreferrer",className:"rounded-sm underline underline-offset-2",children:null!==(c=null==y?void 0:y.vttName)&&void 0!==c?c:"descriptions.vtt"}),"number"==typeof(null==y?void 0:y.vttCueCount)?(0,r.jsx)("span",{className:"text-xs text-[rgb(var(--text-muted))]",children:p("adCueCount",{count:y.vttCueCount})}):null,(0,r.jsx)("button",{type:"button",onClick:()=>void _("vtt"),"aria-label":O("vtt"),className:"shrink-0 rounded-sm text-sm font-medium text-[rgb(var(--danger))] hover:underline",children:p("remove")})]}):(0,r.jsx)(w,{busy:"vtt"===D,disabled:null!==D,accept:".vtt,text/vtt",label:p("adVttUploadCta"),onFile:e=>void V("vtt",e)}),(0,r.jsx)("p",{className:"mt-1 text-xs text-[rgb(var(--text-muted))]",children:p("adVttHint")})]}),(0,r.jsx)(h,{lessonId:m,ad:y,onCommit:L}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium text-[rgb(var(--text-secondary))]",children:p("adAudioLabel")}),E?(0,r.jsxs)("div",{className:"mt-1 flex flex-wrap items-center gap-3",children:[(0,r.jsx)("audio",{controls:!0,src:E,className:"h-9 max-w-full","aria-label":null!=U?U:p("adAudioLabel")}),U?(0,r.jsx)("span",{className:"text-xs text-[rgb(var(--text-muted))]",children:U}):null,(0,r.jsx)("button",{type:"button",onClick:()=>void _("audio"),"aria-label":O("audio"),className:"shrink-0 rounded-sm text-sm font-medium text-[rgb(var(--danger))] hover:underline",children:p("remove")})]}):(0,r.jsx)(w,{busy:"audio"===D,disabled:null!==D,accept:".mp3,.m4a,audio/mpeg,audio/mp4",label:p("adAudioUploadCta"),onFile:e=>void V("audio",e)}),(0,r.jsx)("p",{className:"mt-1 text-xs text-[rgb(var(--text-muted))]",children:p("adAudioHint")})]}),T?(0,r.jsx)("p",{role:"alert",className:"text-sm text-[rgb(var(--danger))]",children:T}):null,(null==y?void 0:y.updatedAt)?(0,r.jsx)("p",{className:"text-xs text-[rgb(var(--text-muted))]",children:p("adUpdatedAt",{date:f.dateTime(y.updatedAt)})}):null]})}function w(e){let{busy:t,disabled:a,accept:n,label:d,onFile:s}=e,i=(0,l.T)("builderMain");return(0,r.jsxs)("label",{className:"mt-1 inline-flex cursor-pointer items-center gap-2 rounded-md border border-dashed border-[rgb(var(--border-default))] px-3 py-2 text-sm text-[rgb(var(--text-secondary))] hover:border-[rgb(var(--brand))] hover:bg-[rgb(var(--surface-raised))] focus-within:ring-2 focus-within:ring-[rgb(var(--focus-ring))]/40",children:[(0,r.jsx)("span",{"aria-hidden":"true",children:"\uD83C\uDF99"}),t?i("uploading"):d,(0,r.jsx)("input",{type:"file",accept:n,className:"sr-only",disabled:a,onChange:e=>{var t;let a=null===(t=e.target.files)||void 0===t?void 0:t[0];a&&s(a),e.currentTarget.value=""}})]})}},98643:function(e,t,a){a.d(t,{W:function(){return l}});var r=a(40740),n=a(90623);function l(){var e;let t=(0,n.bU)(),a=null!==(e=(0,n.a4)())&&void 0!==e?e:"UTC";return(0,r.useMemo)(()=>{let e=new Intl.DateTimeFormat(t,{dateStyle:"medium",timeZone:a}),r=new Intl.DateTimeFormat(t,{dateStyle:"medium",timeStyle:"short",timeZone:a}),n=new Intl.DateTimeFormat(t,{timeStyle:"short",timeZone:a}),l=new Intl.DateTimeFormat(t,{dateStyle:"medium",timeStyle:"medium",timeZone:a}),d=e=>t=>{let a=function(e){if(null==e||""===e)return null;let t=e instanceof Date?e:new Date(e);return Number.isNaN(t.getTime())?null:t}(t);return a?e.format(a):"—"};return{date:d(e),dateTime:d(r),time:d(n),precise:d(l),timeZone:a}},[t,a])}},3050:function(e,t,a){a.d(t,{GV:function(){return s},Il:function(){return l},Kk:function(){return c},QG:function(){return x},S$:function(){return u},eV:function(){return n},kZ:function(){return d},uI:function(){return r},wn:function(){return m},y4:function(){return i}});let r=2097152,n=52428800,l={mp3:"audio/mpeg",m4a:"audio/mp4"};function d(e){let t=e.lastIndexOf(".");return -1===t?"":e.slice(t+1).toLowerCase()}function s(e){if(!e)return null;let t="https://ssbowokwnmtviaacndrg.supabase.co";return t?"".concat(t,"/storage/v1/object/public/").concat("lesson-content","/").concat(e):null}function i(e){return/^WEBVTT(?:[ \t\r\n]|$)/.test(e.replace(/^\uFEFF/,""))}function o(e){let t=e.trim().match(/^(?:(\d{1,2}):)?(\d{1,2}):(\d{2})[.,](\d{1,3})$/);if(!t)return null;let[,a,r,n,l]=t;return(a?3600*Number(a):0)+60*Number(r)+Number(n)+Number(l.padEnd(3,"0"))/1e3}function c(e){let t=e.replace(/^\uFEFF/,"").replace(/\r\n?/g,"\n");if(!i(t))return[];let a=t.split(/\n{2,}/).slice(1),r=[];for(let e of a){var n;let t=e.split("\n").filter(e=>e.length>0);if(0===t.length||/^(NOTE|STYLE|REGION)\b/.test(t[0]))continue;let a=t.findIndex(e=>e.includes("-->"));if(-1===a)continue;let[l,d]=t[a].split("-->"),s=o(l),i=o(null!==(n=(null!=d?d:"").trim().split(/\s+/)[0])&&void 0!==n?n:"");if(null===s||null===i||i<s)continue;let c=t.slice(a+1).join("\n").replace(/<[^>]*>/g,"").replace(/[ \t]+/g," ").trim();if(!c)continue;let u=a>0?t[a-1].trim():void 0;
1r.push({...u?{id:u}:{},start:s,end:i,text:c})}return[...r].sort((e,t)=>e.start-t.start)}function u(e,t){return e.findIndex(e=>t>=e.start&&t<e.end)}function m(e){let t=Math.max(0,Math.floor(e)),a=Math.floor(t/3600),r=Math.floor(t%3600/60),n=a>0?String(r).padStart(2,"0"):String(r);return"".concat(a>0?"".concat(a,":"):"").concat(n,":").concat(String(t%60).padStart(2,"0"))}function x(e){var t,a,r,n;let l=function(e){let t=null==e?void 0:e.audioDescription;return t&&"object"==typeof t?t:null}(e),d=null!=e?e:{},i=null!==(a=null!==(t=s(null==l?void 0:l.audioPath))&&void 0!==t?t:d.audioDescriptionUrl)&&void 0!==a?a:null,o=(null==l?void 0:l.audioPath)?null!==(r=l.audioName)&&void 0!==r?r:null:null!==(n=d.audioDescriptionName)&&void 0!==n?n:null;return{vttUrl:s(null==l?void 0:l.vttPath),audioUrl:i,audioName:o}}},60650:function(e,t,a){a.d(t,{H:function(){return n},L:function(){return l}});var r=a(17952);function n(e){var t;return null!==(t=e.provider)&&void 0!==t?t:"cloudflare"}function l(e){var t,a,l,d;let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n(e),o=e.streamId;if(!o)return"";let c=s.startTime&&s.startTime>0?Math.floor(s.startTime):0,u=null!==(a=null!==(t=s.captionLanguage)&&void 0!==t?t:e.captionLanguage)&&void 0!==a?a:"en";if("bunny"===i){let t=null!==(d=null!==(l=e.libraryId)&&void 0!==l?l:"678821")&&void 0!==d?d:"",a="https://iframe.mediadelivery.net/embed/".concat(t,"/").concat(o),r=new URLSearchParams;return r.set("captions",u),c>0&&r.set("t",String(c)),"".concat(a,"?").concat(r.toString())}let m=r.env.NEXT_PUBLIC_CLOUDFLARE_STREAM_CUSTOMER_CODE||"g3sspiyueny94419",x="https://customer-".concat(m,".cloudflarestream.com/").concat(o,"/iframe"),v=new URLSearchParams;return v.set("defaultTextTrack",u),c>0&&v.set("startTime",String(c)),"".concat(x,"?").concat(v.toString())}}}]);

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.