PageSourceSearch

https://bell.careers/recruiter/assets/VideoLibrary-DYPcaHxB.js

js bell.careers collected 2026-10-02 01:21:08 UTC 11,371 bytes, 1 lines download raw bytes

1import{j as e}from"./chunk-editor-BoEejyrU.js";import{r as a}from"./router-BpnsrfSX.js";import{J as Z,y as n,ak as U,e as ee,v as se,X as I,T as O,b2 as re,b3 as ae}from"./index-ChzAEmuP.js";import{g as K,F as M,u as te,a as le,d as oe}from"./VideoLibrary-BNRNqFho.js";import{C as ie}from"./ConformationModal-5pBaRcTY.js";import{U as ne}from"./upload-DRbKXlwq.js";import{P as de}from"./play-CLP-DpK8.js";import{P as ce}from"./pencil-CwFax8d7.js";const xe=c=>async()=>{var y;const d=await K();return(y=(Array.isArray(d)?d:(d==null?void 0:d.results)||[]).find(f=>f.id===c))==null?void 0:y.thumbnail_url},ve=()=>{const c=a.useRef(null),[d,m]=a.useState([]),[y,f]=a.useState(!0),[E,j]=a.useState(""),[N,b]=a.useState(""),[L,w]=a.useState(!1),[t,u]=a.useState(null),[$,k]=a.useState(null),[h,T]=a.useState(""),[D,S]=a.useState(null),[o,p]=a.useState(null),[C,z]=a.useState(!1),[i,F]=a.useState(null),[x,v]=a.useState(null);a.useEffect(()=>{q()},[]),a.useEffect(()=>{if(!o)return;const s=r=>{r.key==="Escape"&&p(null)};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[o]),a.useEffect(()=>()=>{i!=null&&i.previewUrl&&URL.revokeObjectURL(i.previewUrl)},[i]);const q=async()=>{try{f(!0);const s=await K();m(Array.isArray(s)?s:s.results||[])}catch(s){Z(s)||n.error("Failed to load video library")}finally{f(!1)}},V=s=>{if(!s||!s.type.startsWith("video/")){n.error("Please select a valid video file");return}G(s)},G=async s=>{const r=s.name.split(".").pop();u({step:1,progress:0});try{const{upload_url:l,file_path:g}=await re(r);u({step:2,progress:0}),await ae(l,s,Y=>u({step:2,progress:Y})),u({step:3,progress:100}),F({file_path:g,previewUrl:URL.createObjectURL(s)}),j(""),b("")}catch{n.error("Upload failed. Please try again.")}finally{u(null),c.current&&(c.current.value=null)}},_=()=>{F(null),j(""),b("")},P=async()=>{const s=E.trim();if(!s){b("Tag / label is required");return}if(i)try{z(!0);const r=await te(i.file_path,s);m(l=>[r,...l]),_(),n.success("Video uploaded to library")}catch{n.error("Failed to add video to library")}finally{z(!1)}},H=s=>{s.preventDefault(),w(!0)},W=()=>w(!1),B=s=>{var l;s.preventDefault(),w(!1);const r=(l=s.dataTransfer.files)==null?void 0:l[0];r&&V(r)},J=s=>{k(s.id),T(s.tag)},R=()=>k(null),A=async s=>{if(!h||!h.trim()){n.error("Tag / label cannot be empty");return}try{const r=h.trim();await le(s,r),m(l=>l.map(g=>g.id===s?{...g,tag:r}:g)),k(null)}catch{n.error("Failed to update tag")}},X=async()=>{if(!x)return;const s=x.id;v(null),S(s);try{await oe(s),m(r=>r.filter(l=>l.id!==s)),(o==null?void 0:o.id)===s&&p(null),n.success("Video deleted")}catch{n.error("Failed to delete video")}finally{S(null)}},Q=(t==null?void 0:t.step)===2?`Uploading… ${t.progress}%`:(t==null?void 0:t.step)===1?"Getting upload URL…":"Finalizing…";return e.jsxs("div",{className:"min-h-screen",style:{background:"var(--bg-primary)",color:"var(--text-primary)"},children:[e.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 py-6 sm:py-8",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold",children:"Video Library"}),e.jsx("p",{className:"text-sm mt-1",style:{color:"var(--text-secondary)"},children:"Upload and manage reusable videos for your job posts."})]}),e.jsxs("div",{className:"rounded-2xl border p-5 sm:p-6 mb-8",style:{background:"var(--bg-primary)",borderColor:"var(--border)"},children:[e.jsx("h2",{className:"text-xs font-semibold uppercase tracking-widest mb-4",style:{color:"var(--primary)"},children:"Upload New Video"}),i?e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:"rounded-2xl overflow-hidden bg-black",children:e.jsx("video",{src:i.previewUrl,className:"w-full",style:{maxHeight:"60vh"},controls:!0})}),e.jsxs("div",{children:[e.jsx("input",{type:"text",placeholder:"Tag / label (e.g. Company Overview)",value:E,onChange:s=>{j(s.target.value),N&&b("")},onKeyDown:s=>{s.key==="Enter"&&P()},className:"input w-full",autoFocus:!0}),N&&e.jsx("p",{className:"text-xs mt-1.5",style:{color:"var(--error, #ef4444)"},children:N})]}),e.jsxs("div",{className:"flex gap-3 justify-end",children:[e.jsx("button",{onClick:_,disabled:C,className:"px-4 py-2 border rounded-xl text-sm font-medium transition hover:bg-[var(--bg-secondary)] disabled:opacity-50",style:{borderColor:"var(--border)"},type:"button",children:"Cancel"}),e.jsxs("button",{onClick:P,disabled:C,className:"px-4 py-2 rounded-xl text-sm font-semibold transition inline-flex items-center gap-2 disabled:opacity-50",style:{background:"var(--primary)",color:"#fff"},type:"button",children:[C&&e.jsx(U,{size:14,className:"animate-spin"}
1),"Upload to Library"]})]})]}):e.jsxs("div",{onDragOver:H,onDragLeave:W,onDrop:B,onClick:()=>{var s;return!t&&((s=c.current)==null?void 0:s.click())},className:"relative flex flex-col items-center justify-center gap-4 border-2 border-dashed rounded-2xl py-12 sm:py-16 transition-all",style:{cursor:t?"default":"pointer",pointerEvents:t?"none":"auto",borderColor:L?"var(--primary)":"var(--border)",background:L?"rgba(36,211,102,0.05)":"transparent"},children:[e.jsx("input",{ref:c,type:"file",accept:"video/*",className:"hidden",onChange:s=>{var r;return V((r=s.target.files)==null?void 0:r[0])}}),t?e.jsxs("div",{className:"flex flex-col items-center gap-4 w-full max-w-xs text-center px-4",children:[e.jsx(U,{className:"animate-spin h-8 w-8",style:{color:"var(--primary)"}}),e.jsx("p",{className:"text-sm font-medium",children:Q}),t.step===2&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-full h-2 rounded-full overflow-hidden",style:{background:"var(--border)"},children:e.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${t.progress}%`,background:"var(--primary)"}})}),e.jsxs("p",{className:"text-xs",style:{color:"var(--text-secondary)"},children:[t.progress,"% uploaded"]})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"p-4 rounded-2xl",style:{background:"var(--bg-secondary)"},children:e.jsx(ne,{size:28,style:{color:"var(--primary)"}})}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-sm font-semibold",children:"Click to upload or drag & drop"}),e.jsx("p",{className:"text-xs mt-1",style:{color:"var(--text-secondary)"},children:"MP4, MOV, WebM, AVI — max 100 MB"})]})]})]})]}),y?e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4 sm:gap-5 animate-pulse",children:[...Array(4)].map((s,r)=>e.jsxs("div",{className:"rounded-2xl border border-[var(--border)] overflow-hidden flex flex-col shadow-sm",children:[e.jsx("div",{className:"w-full bg-[var(--bg-secondary)]",style:{height:300}}),e.jsxs("div",{className:"p-3.5 flex flex-col gap-3 flex-1",children:[e.jsx("div",{className:"h-4 w-2/3 bg-[var(--bg-secondary)] rounded"}),e.jsxs("div",{className:"flex gap-2 mt-auto",children:[e.jsx("div",{className:"h-8 flex-1 bg-[var(--primary)]/10 border border-[var(--primary)]/20 rounded-lg"}),e.jsx("div",{className:"h-8 flex-1 bg-[var(--bg-secondary)] rounded-lg"})]})]})]},r))}):d.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-24 rounded-2xl border border-dashed",style:{borderColor:"var(--border)",color:"var(--text-secondary)"},children:[e.jsx(M,{size:48,className:"mb-4 opacity-30"}),e.jsx("p",{className:"text-base font-medium",children:"No videos yet"}),e.jsx("p",{className:"text-sm mt-1",style:{color:"var(--text-secondary)"},children:"Upload your first video above to get started."})]}):e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4 sm:gap-5",children:d.map(s=>e.jsxs("div",{className:"rounded-2xl border overflow-hidden flex flex-col shadow-sm transition-shadow hover:shadow-md",style:{background:"var(--bg-primary)",borderColor:"var(--border)"},children:[e.jsxs("div",{className:"relative w-full overflow-hidden bg-black group cursor-pointer",style:{height:300},onClick:()=>p(s),children:[s.thumbnail_url?e.jsx(ee,{src:s.thumbnail_url,refresh:xe(s.id),refreshKey:`library-video:${s.id}`,fallback:null,alt:s.tag,className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-105"}):e.jsx("div",{className:"w-full h-full flex flex-col items-center justify-center gap-2",children:e.jsx(M,{size:32,style:{color:"var(--text-secondary)"}})}),e.jsx("div",{className:"absolute inset-0 bg-black/40 opacity-0 group-hover:opacity-100 flex items-center justify-center transition-opacity duration-200",children:e.jsx("div",{className:"bg-white/95 rounded-full p-3 shadow-xl",children:e.jsx(de,{size:20,className:"text-gray-900 fill-gray-900 ml-0.5"})})})]}),e.jsxs("div",{className:"p-3.5 flex flex-col gap-3 flex-1",children:[$===s.id?e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("input",{autoFocus:!0,t
1ype:"text",value:h,onChange:r=>T(r.target.value),onKeyDown:r=>{r.key==="Enter"&&A(s.id),r.key==="Escape"&&R()},className:"input flex-1 text-sm py-1.5"}),e.jsx("button",{onClick:()=>A(s.id),className:"p-1.5 rounded-lg transition",style:{color:"var(--primary)"},children:e.jsx(se,{size:14})}),e.jsx("button",{onClick:R,className:"p-1.5 rounded-lg transition",style:{color:"var(--text-secondary)"},children:e.jsx(I,{size:14})})]}):e.jsx("p",{className:"text-sm font-semibold truncate",style:{color:"var(--text-primary)"},title:s.tag,children:s.tag}),e.jsxs("div",{className:"flex gap-2 mt-auto",children:[e.jsxs("button",{onClick:()=>J(s),className:"action-btn flex-1 flex items-center justify-center gap-1.5 text-xs",children:[e.jsx(ce,{size:12})," Edit tag"]}),s.is_created_by_me&&e.jsxs("button",{onClick:()=>v(s),disabled:D===s.id,className:"action-btn error flex-1 flex items-center justify-center gap-1.5 text-xs disabled:opacity-50",children:[D===s.id?e.jsx(U,{size:12,className:"animate-spin"}):e.jsx(O,{size:12}),"Delete"]})]})]})]},s.id))})]}),o&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",style:{background:"rgba(0,0,0,0.85)",backdropFilter:"blur(4px)"},onClick:()=>p(null),children:e.jsxs("div",{className:"relative w-full max-w-4xl",onClick:s=>s.stopPropagation(),children:[e.jsxs("button",{onClick:()=>p(null),className:"absolute -top-11 right-0 flex items-center gap-1.5 text-sm transition",style:{color:"rgba(255,255,255,0.7)"},children:[e.jsx(I,{size:18})," Close"]}),e.jsx("div",{className:"rounded-2xl overflow-hidden bg-black shadow-2xl",children:e.jsx("video",{src:o.video_url,className:"w-full",style:{maxHeight:"75vh"},controls:!0,autoPlay:!0},o.id)}),e.jsx("p",{className:"text-sm text-center mt-3 font-medium",style:{color:"rgba(255,255,255,0.7)"},children:o.tag})]})}),e.jsxs(ie,{isOpen:!!x,onClose:()=>v(null),title:"Delete video",icon:O,children:[e.jsxs("div",{className:"text-sm mb-6",style:{color:"var(--text-secondary)"},children:['Are you sure you want to delete "',x==null?void 0:x.tag,'"? This action cannot be undone.']}),e.jsxs("div",{className:"flex gap-3 justify-end",children:[e.jsx("button",{onClick:()=>v(null),className:"px-4 py-2 border rounded-xl text-sm font-medium transition hover:bg-[var(--bg-secondary)]",style:{borderColor:"var(--border)"},type:"button",children:"Cancel"}),e.jsx("button",{onClick:X,className:"px-4 py-2 rounded-xl text-sm font-semibold transition text-white bg-red-600 hover:bg-red-700",type:"button",children:"Delete"})]})]})]})};export{ve as default};

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.