PageSourceSearch

https://parksnet.com.br/assets/AdminAcademy-Df2d-NRR.js

js parksnet.com.br collected 2026-09-29 00:12:52 UTC 21,436 bytes, 6 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/upload-video-resumable-DFTyZ9P2.js","assets/charts-ytYDs0Yq.js","assets/index-Ck3jlJIO.js","assets/index-B9wVwvqz.css"])))=>i.map(i=>d[i]);
2import{ca as be,_ as Ne,s as h,bd as F,eV as C,Z as m,i1 as X,i2 as Ce,j as e,B as c,P as J,o as Z,i3 as ke,i4 as ee,aM as Ee,W as Ie,fJ as ae,fK as te,f7 as se,aA as ie,i5 as re,g8 as ne,du as De,dp as Te,dv as Ae,z as oe,A as de,F as le,G as ce,aQ as x,aR as _,eS as ue,aT as Se,aU as Fe,aV as Re,aW as ze,i6 as Ve,aX as Pe,es as R,N as me,fT as qe,bq as z,f9 as V}from"./index-Ck3jlJIO.js";import{b as v}from"./charts-ytYDs0Yq.js";import{A as Ue}from"./AdminLayout-A-6FoqBw.js";import"./collapsible-B7wC1fNx.js";import"./categorias-de-parceiro-hIbo3PEn.js";const k={title:"",subtitle:"",description:"",icon:"GraduationCap",is_primary:!1,is_active:!0},E={title:"",description:"",youtube_url:"",thumbnail_url:"",duration_seconds:0,is_active:!0,learn_items:[],support_pdf_url:null,video_path:null};function Ge(){const pe=be(),[he,xe]=v.useState({}),[f,g]=v.useState({open:!1,data:k}),[u,p]=v.useState({open:!1,moduleId:"",data:E}),[P,q]=v.useState(""),[U,L]=v.useState(!1),[$,O]=v.useState(!1),[A,M]=v.useState(!1),[B,S]=v.useState(0),I=v.useRef(null),D=v.useRef(null),j=v.useRef(null),y=v.useRef(crypto.randomUUID()),{data:l,isLoading:G}=Ne({queryKey:["admin-academy"],queryFn:async()=>{const[{data:a,error:t},{data:i,error:o}]=await Promise.all([h.from("academy_modules").select("*").order("display_order"),h.from("academy_lessons").select("*").order("display_order")]);if(t)throw t;if(o)throw o;return{modules:(a??[]).map(r=>({...r,subtitle:r.subtitle??null,icon:r.icon??null,is_primary:!!r.is_primary})),lessons:(i??[]).map(r=>({...r,learn_items:Array.isArray(r.learn_items)?r.learn_items:[],support_pdf_url:r.support_pdf_url??null,video_path:r.video_path??null,views_count:Number(r.views_count??0),likes_count:Number(r.likes_count??0),rating_avg:Number(r.rating_avg??0),rating_count:Number(r.rating_count??0)}))}}}),H=v.useRef(!1);v.useEffect(()=>{!l||H.current||(H.current=!0,(async()=>{try{const{data:a}=await h.storage.from("academia-videos").list("",{limit:1e3});if(!(a!=null&&a.length))return;const t=[];for(const n of a){if(n.id){t.push({caminho:n.name,criadoEm:n.created_at??null});continue}const{data:s}=await h.storage.from("academia-videos").list(n.name,{limit:1e3});for(const d of s??[])d.id&&t.push({caminho:`${n.name}/${d.name}`,criadoEm:d.created_at??null})}const{decidirAFaxina:i}=await F(async()=>{const{decidirAFaxina:n}=await import("./faxina-dos-videos-CvRwiNUB.js");return{decidirAFaxina:n}},[]),{apagar:o}=i(t,(l.lessons??[]).map(n=>n.video_path));if(!o.length)return;const{error:r}=await h.storage.from("academia-videos").remove(o);if(r)throw r;console.info(`[academia] faxina removeu ${o.length} vídeo(s) sem dono`)}catch(a){console.warn("[academia] faxina de vídeos não rodou:",a)}})())},[l]);const w=()=>pe.invalidateQueries({queryKey:["admin-academy"]}),Y=C({mutationFn:async a=>{var i;if(!((i=a.title)!=null&&i.trim()))throw new Error("Título é obrigatório");const t={title:a.title,subtitle:a.subtitle??null,description:a.description??null,icon:a.icon??null,is_primary:a.is_primary??!1,is_active:a.is_active??!0};if(a.id){const{error:o}=await h.from("academy_modules").update(t).eq("id",a.id);if(o)throw o}else{const o=((l==null?void 0:l.modules.length)??0)+1,{error:r}=await h.from("academy_modules").insert({...t,display_order:o});if(r)throw r}},onSuccess:()=>{w(),g({open:!1,data:k}),m({title:"Categoria salva"})},onError:a=>m({title:"Erro",description:a.message,variant:"destructive"})}),ve=C({mutationFn:async a=>{const{error:t}=await h.from("academy_modules").delete().eq("id",a);if(t)throw t},onSuccess:()=>{w(),m({title:"Categoria removida"})},onError:a=>m({title:"Erro",description:a.message,variant:"destructive"})}),Q=C({mutationFn:async a=>{var n;if(!((n=a.title)!=null&&n.trim()))throw new Error("Título é obrigatório");const t=X(a.youtube_url);if(a.youtube_url&&!t)throw new Error("URL do YouTube inválida");const i=a.thumbnail_url||Ce(a.youtube_url)||null,o=(P||"").split(`
3`).map(s=>
3s.trim()).filter(Boolean),r={title:a.title,description:a.description,youtube_url:a.youtube_url||null,thumbnail_url:i,duration_seconds:a.duration_seconds??null,is_active:a.is_active??!0,learn_items:o,support_pdf_url:a.support_pdf_url??null,video_path:a.video_path??null};if(a.id){const{error:s}=await h.from("academy_lessons").update(r).eq("id",a.id);if(s)throw s}else{const d=((l==null?void 0:l.lessons)??[]).filter(N=>N.module_id===a.module_id).length+1,{error:b}=await h.from("academy_lessons").insert({id:y.current,...r,module_id:a.module_id,display_order:d});if(b)throw b}},onSuccess:()=>{w(),p({open:!1,moduleId:"",data:E}),m({title:"Aula salva"})},onError:a=>m({title:"Erro",description:a.message,variant:"destructive"})}),ge=C({mutationFn:async a=>{const{error:t}=await h.from("academy_lessons").delete().eq("id",a);if(t)throw t},onSuccess:()=>{w(),m({title:"Aula removida"})},onError:a=>m({title:"Erro",description:a.message,variant:"destructive"})}),fe=C({mutationFn:async({table:a,id:t,currentOrder:i,siblingId:o,siblingOrder:r})=>{const{error:n}=await h.from(a).update({display_order:r}).eq("id",t);if(n)throw n;const{error:s}=await h.from(a).update({display_order:i}).eq("id",o);if(s)throw s},onSuccess:()=>w()}),T=(a,t,i,o)=>{const r=[...a].sort((N,we)=>N.display_order-we.display_order),n=r.findIndex(N=>N.id===t),s=i==="up"?n-1:n+1;if(s<0||s>=r.length)return;const d=r[n],b=r[s];fe.mutate({table:o,id:d.id,currentOrder:d.display_order,siblingId:b.id,siblingOrder:b.display_order})},W=(a,t)=>{var i;q(((i=t==null?void 0:t.learn_items)==null?void 0:i.join(`
4`))??""),t||(y.current=crypto.randomUUID()),p({open:!0,moduleId:a,data:t??E})},je=async a=>{L(!0);try{const t=`${u.data.id??y.current}/${Date.now()}-${a.name.replace(/[^a-z0-9.\-_]/gi,"_")}`,{error:i}=await h.storage.from("academy-materials").upload(t,a,{contentType:a.type||"application/pdf",upsert:!0});if(i)throw i;p(o=>({...o,data:{...o.data,support_pdf_url:t}})),m({title:"PDF enviado"})}catch(t){m({title:"Erro",description:(t==null?void 0:t.message)??"Falha no upload",variant:"destructive"})}finally{L(!1),I.current&&(I.current.value="")}},_e=async a=>{const t=a.name.toLowerCase(),i=/\.(mp4|mov|webm|m4v|avi|mkv)$/.test(t);if(!a.type.startsWith("video/")&&!i){m({title:"Arquivo inválido",description:"Envie um vídeo (mp4, mov, webm).",variant:"destructive"});return}if(a.size>2*1024*1024*1024){m({title:"Vídeo muito grande",description:"Tamanho máximo: 2GB.",variant:"destructive"});return}const{codecDoVideo:o,AVISO_DE_HEVC:r}=await F(async()=>{const{codecDoVideo:n,AVISO_DE_HEVC:s}=await import("./codec-do-video-BGrvLpAr.js");return{codecDoVideo:n,AVISO_DE_HEVC:s}},[]);if(await o(a)==="hevc"){m({title:"Formato não suportado",description:r,variant:"destructive"}),j.current&&(j.current.value="");return}M(!0),S(0);try{const n=`${u.data.id??y.current}/${Date.now()}-${a.name.replace(/[^a-z0-9.\-_]/gi,"_")}`,{uploadVideoResumable:s}=await F(async()=>{const{uploadVideoResumable:d}=await import("./upload-video-resumable-DFTyZ9P2.js");return{uploadVideoResumable:d}},__vite__mapDeps([0,1,2,3]));await s({bucket:"academia-videos",path:n,file:a,onProgress:S}),p(d=>({...d,data:{...d.data,video_path:n}})),m({title:"Vídeo enviado",description:"Clique em Salvar para concluir a aula."})}catch(n){m({title:"Erro",description:(n==null?void 0:n.message)??"Falha no upload",variant:"destructive"})}finally{M(!1),S(0),j.current&&(j.current.value="")}},ye=async a=>{var t;if(!a.type.startsWith("image/")){m({title:"Arquivo inválido",description:"Envie uma imagem (jpg, png, webp).",variant:"destructive"});return}if(a.size>5*1024*1024){m({title:"Imagem muito grande",description:"Tamanho máximo: 5MB.",variant:"destructive"});return}O(!0);try{const i=((t=a.name.split(".").pop())==null?void 0:t.toLowerCase())||"jpg",o=`thumbnails/${u.data.id??y.current}-${Date.now()}.${i}`,{error:r}=await h.storage.from("academy-materials").upload(o,a,{contentType:a.type,upsert:!0});if(r)throw r;const{data:n,error:s}=await h.storage.from("academy-materials").createSignedUrl(o,3600*24*365*10);if(s||!(n!=null&&n.signedUrl))throw s??new Error("Falha ao gerar URL");p(d=>({...d,data:{...d.data,thumbnail_url:n.signedUrl}})),m({title:"Imagem enviada"})}catch(i){m({title:"Erro",description:(i==null?void 0:i.message)??"Falha no upload",variant:"destructive"})}finally{O(!1),D.current&&(D.current.value="")}},K=v.useMemo(()=>{var a;return((a=l==null?void 0:l.modules.find(t=>t.is_primary))==null?void 0:a.id)??null},[l]);return e.jsxs(Ue,{title:"Academia",children:[e.jsxs("div",{className:"space-y-4 max-w-4xl",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Crie categorias e aulas. Marque uma categoria como ",e.jsx("strong",{children:"Trilha inicial"})," para exigir que o afiliado a conclua antes de liberar as demais."]}),e.jsxs(c,{onClick:()=>g({open:!0,data:k}),className:"gap-2",children:[e.jsx(J,{className:"h-4 w-4"})," Nova categoria"]})]}),G&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"Carregando..."}),(l==null?void 0:l.modules.length)===0&&!G&&e.jsxs(Z,{className:"p-8 text-center text-muted-foreground",children:[e.jsx(ke,{className:"h-10 w-10 mx-auto mb-2 opacity-50"}),"Nenhuma categoria cadastrada ainda."]}),l==null?void 0:l.modules.map((a,t,i)=>{const o=(l.lessons??[]).filter(s=>s.module_id===a.id).sort((s,d)=>s.display_order-d.display_order),r=he[a.id]??!0,n=ee(a.icon);return e.jsxs(Z,{className:"overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 p-4 border-b bg-muted/30",children:[e.jsx("button",{onClick:()=>xe(s=>({...s,[a.id]:!r})),className:"p-1 hover:bg-muted rounded","aria-label":"Expandir",children:r?e.jsx(Ee,{className:"h-4 w-4"}):e.jsx(Ie,{className:"h-4 w-4"})}),e.jsx(n,{className:"h-5 w-5 text-[#1d3e21] shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("span",{className:"text-xs font-mono text-muted-foreground",children:["#",a.display_order]}),e.jsx("h3",{className:"font-semibold truncate",children:a.title}),a.is_primary&&e.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded-full bg-[#1d3e21] text-white font-bold",children:"Trilha inicial"}),!a.is_active&&e.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground",children:"Inativo"}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",o.length," aulas)"]})]}),a.subtitle&&e.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:a.subtitle})]}),e.jsx(c,{size:"icon",variant:"ghost",onClick:()=>T(i,a.id,"up","academy_modules"),disabled:t===0,children:e.jsx(ae,{className:"h-4 w-4"})}),e.jsx(c,{size:"icon",variant:"ghost",onClick:()=>T(i,a.id,"down","academy_modules"),disabled:t===i.length-1,children:e.jsx(te,{className:"h-4 w-4"})}),e.jsx(c,{size:"icon",variant:"ghost",onClick:()=>g({open:!0,data:a}),children:e.jsx(se,{className:"h-4 w-4"})}),e.jsx(c,{size:"icon",variant:"ghost",onClick:()=>{confirm(`Remover a categoria "${a.title}" e todas as suas aulas?`)&&ve.mutate(a.id)},children:e.jsx(ie,{className:"h-4 w-4 text-destructive-ink"})})]}),r&&e.jsxs("div",{className:"p-3 space-y-2",children:[o.length===0&&e.jsx("p",{className:"text-xs text-muted-foreground italic px-2 py-3",children:"Nenhuma aula nesta categoria."}),o.map((s,d)=>e.jsxs("div",{className:"flex items-center gap-2 p-2 rounded border bg-card",children:[e.jsx(re,{className:"h-4 w-4 text-deep shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("span",{className:"text-xs font-mono text-muted-foreground",children:["#",s.display_order]}),e.jsx("span",{className:"text-sm font-medium truncate",children:s.title}),!s.is_active&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:"Inativo"}),!X(s.youtube_url)&&!s.video_path&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-destructive/10 text-destructive-ink",children:"Sem vídeo"}),s.support_pdf_url&&e.jsxs("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-success-soft text-success-ink inline-flex items-center gap-1",children:[e.jsx(ne,{className:"h-3 w-3"})," PDF"]})]}),e.jsxs("div",{className:"flex items-center gap-3 mt-1 text-[11px] text-muted-foreground",children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(De,{className:"h-3 w-3"})," ",s.likes_count]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(Te,{className:"h-3 w-3"})," ",s.views_count]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(Ae,{className:"h-3 w-3"}),s.rating_count>0?`${s.rating_avg.toFixed(1)} (${s.rating_count})`:"—"]})]})]}),e.jsx(c,{size:"icon",variant:"ghost",onClick:()=>T(o,s.id,"up","academy_lessons"),disabled:d===0,children:e.jsx(ae,{className:"h-3.5 w-3.5"})}),e.jsx(c,{size:"icon",variant:"ghost",onClick:()=>T(o,s.id,"down","academy_lessons"),disabled:d===o.length-1,children:e.jsx(te,{className:"h-3.5 w-3.5"})}),e.jsx(c,{size:"icon",variant:"ghost",onClick:()=>W(a.id,s),children:e.jsx(se,{className:"h-4 w-4"})}),e.jsx(c,{size:"icon",variant:"ghost",onClick:()=>{confirm(`Remover a aula "${s.title}"?`)&&ge.mutate(s.id)},children:e.jsx(ie,{className:"h-4 w-4 text-destructive-ink"})})]},s.id)),e.jsxs(c,{variant:"outline",size:"sm",className:"w-full gap-2",onClick:()=>W(a.id),children:[e.jsx(J,{className:"h-4 w-4"})," Adicionar aula"]})]})]},a.id)})]}),e.jsx(oe,{open:f.open,onOpenChange:a=>!a&&g({open:!1,data:k}),children:e.jsxs(de,{className:"max-w-md",children:[e.jsx(le,{children:e.jsx(ce,{children:f.data.id?"Editar categoria":"Nova categoria"})}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx(x,{children:"Título *"}),e.jsx(_,{value:f.data.title??"",onChange:a=>g(t=>({...t,data:{...t.data,title:a.target.value}}))})]}),e.jsxs("div",{children:[e.jsx(x,{children:"Subtítulo curto"}),e.jsx(_,{placeholder:"Aparece abaixo do título na home",value:f.data.subtitle??"",onChange:a=>g(t=>({...t,data:{...t.data,subtitle:a.target.value}}))})]}),e.jsxs("div",{children:[e.jsx(x,{children:"Descrição interna"}),e.jsx(ue,{rows:2,value:f.data.description??"",onChange:a=>g(t=>({...t,data:{...t.data,description:a.target.value}}))})]}),e.jsxs("div",{children:[e.jsx(x,{children:"Ícone"}),e.jsxs(Se,{value:f.data.icon??"GraduationCap",onValueChange:a=>g(t=>({...t,data:{...t.data,icon:a}})),children:[e.jsx(Fe,{children:e.jsx(Re,{})}),e.jsx(ze,{className:"max-h-72",children:Ve.map(a=>{const t=ee(a);return e.jsx(Pe,{value:a,children:e.jsxs("span",{className:"inline-flex items-center gap-2",children:[e.jsx(t,{className:"h-4 w-4"}),a]})},a)})})]})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{className:"min-w-0 pr-3",children:[e.jsx(x,{className:"font-semibold",children:"Categoria principal (trilha inicial)"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Só pode existir uma. As demais ficam bloqueadas até o afiliado concluir todas as aulas desta.",K&&K!==f.data.id&&e.jsx(e.Fragment,{children:" Ativar aqui desmarca a categoria atual."})]})]}),e.jsx(R,{checked:f.data.is_primary??!1,onCheckedChange:a=>g(t=>({...t,data:{...t.data,is_primary:a}}))})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(R,{checked:f.data.is_active??!0,onCheckedChange:a=>g(t=>({...t,data:{...t.data,is_active:a}}))}),e.jsx(x,{children:"Ativa"})]})]}),e.jsxs(me,{children:[e.jsx(c,{variant:"outline",onClick:()=>g({open:!1,data:k}),children:"Cancelar"}),e.jsx(c,{onClick:()=>Y.mutate(f.data),disabled:Y.isPending,children:"Salvar"})]})]})}),e.jsx(oe,{open:u.open,onOpenChange:a=>!a&&p({open:!1,moduleId:"",data:E}),children:e.jsxs(de,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[e.jsx(le,{children:e.jsx(ce,{children:u.data.id?"Editar aula":"Nova aula"})}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx(x,{children:"Título *"}),e.jsx(_,{value:u.data.title??"",onChange:a=>p(t=>({...t,data:{...t.data,title:a.target.value}}))})]}),e.jsxs("div",{children:[e.jsx(x,{children:"Descrição / Material de Apoio"}),e.jsx(qe,{variant:"basic",minHeight:180,maxLength:8e3,value:u.data.description??"",onChange:a=>p(t=>({...t,data:{...t.data,description:a}})),placeholder:"Formate o conteúdo do material de apoio: negrito, itálico, listas, títulos, links..."})]}),e.jsxs("div",{children:[e.jsx(x,{children:"O que você vai aprender (um item por linha)"}),e.jsx(ue,{rows:4,placeholder:`Como cadastrar um cliente
5Como emitir o voucher
6Como consultar a comissão`,value:P,onChange:a=>q(a.target.value)})]}),e.jsxs("div",{children:[e.jsx(x,{children:"URL do YouTube"}),e.jsx(_,{placeholder:"https://www.youtube.com/watch?v=...",value:u.data.youtube_url??"",onChange:a=>p(t=>({...t,data:{...t.data,youtube_url:a.target.value}}))}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Opcional. Usado apenas se não houver vídeo enviado abaixo."})]}),e.jsxs("div",{children:[e.jsx(x,{children:"Vídeo da aula (arquivo)"}),e.jsx("input",{ref:j,type:"file",accept:"video/*",className:"hidden",onChange:a=>{var i;const t=(i=a.target.files)==null?void 0:i[0];t&&_e(t)}}
6),u.data.video_path?e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-lg border p-2 mt-1",children:[e.jsxs("span",{className:"inline-flex items-center gap-2 text-sm text-foreground truncate",children:[e.jsx(re,{className:"h-4 w-4 text-success-ink shrink-0"}),e.jsx("span",{className:"truncate",children:u.data.video_path})]}),e.jsx(c,{size:"sm",variant:"ghost",onClick:()=>p(a=>({...a,data:{...a.data,video_path:null}})),children:e.jsx(z,{className:"h-4 w-4"})})]}):e.jsxs(c,{type:"button",variant:"outline",size:"sm",className:"mt-1 gap-2",disabled:A,onClick:()=>{var a;return(a=j.current)==null?void 0:a.click()},children:[e.jsx(V,{className:"h-4 w-4"}),A?`Enviando... ${B}%`:"Enviar vídeo"]}),A&&e.jsx("div",{className:"mt-2 h-2 w-full overflow-hidden rounded-full bg-muted",children:e.jsx("div",{className:"h-full bg-primary transition-all",style:{width:`${B}%`}})}),e.jsx("p",{className:"text-[11px] text-muted-foreground mt-1",children:"O vídeo fica privado no nosso armazenamento e só abre para parceiros logados. Máx. 2GB (mp4, mov, webm)."})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(x,{children:"Duração (segundos)"}),e.jsx(_,{type:"number",min:0,value:u.data.duration_seconds??0,onChange:a=>p(t=>({...t,data:{...t.data,duration_seconds:parseInt(a.target.value)||0}}))})]}),e.jsxs("div",{children:[e.jsx(x,{children:"Thumbnail customizado"}),e.jsx(_,{placeholder:"Cole uma URL ou envie uma imagem",value:u.data.thumbnail_url??"",onChange:a=>p(t=>({...t,data:{...t.data,thumbnail_url:a.target.value}}))}),e.jsx("input",{ref:D,type:"file",accept:"image/*",className:"hidden",onChange:a=>{var i;const t=(i=a.target.files)==null?void 0:i[0];t&&ye(t)}}),e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[u.data.thumbnail_url?e.jsxs(e.Fragment,{children:[e.jsx("img",{src:u.data.thumbnail_url,alt:"Prévia",className:"h-14 w-24 object-cover rounded-md border"}),e.jsxs(c,{type:"button",variant:"ghost",size:"sm",onClick:()=>p(a=>({...a,data:{...a.data,thumbnail_url:""}})),children:[e.jsx(z,{className:"h-4 w-4"})," Remover"]})]}):null,e.jsxs(c,{type:"button",variant:"outline",size:"sm",className:"gap-2",disabled:$,onClick:()=>{var a;return(a=D.current)==null?void 0:a.click()},children:[e.jsx(V,{className:"h-4 w-4"}),$?"Enviando...":"Enviar imagem"]})]}),e.jsx("p",{className:"text-[11px] text-muted-foreground mt-1",children:"Opcional. Se vazio, usamos a miniatura do YouTube. Máx. 5MB (jpg/png/webp)."})]})]}),e.jsxs("div",{children:[e.jsx(x,{children:"Material de apoio (PDF)"}),e.jsx("input",{ref:I,type:"file",accept:"application/pdf",className:"hidden",onChange:a=>{var i;const t=(i=a.target.files)==null?void 0:i[0];t&&je(t)}}),u.data.support_pdf_url?e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-lg border p-2 mt-1",children:[e.jsxs("span",{className:"inline-flex items-center gap-2 text-sm text-foreground truncate",children:[e.jsx(ne,{className:"h-4 w-4 text-success-ink shrink-0"}),e.jsx("span",{className:"truncate",children:u.data.support_pdf_url})]}),e.jsx(c,{size:"sm",variant:"ghost",onClick:()=>p(a=>({...a,data:{...a.data,support_pdf_url:null}})),children:e.jsx(z,{className:"h-4 w-4"})})]}):e.jsxs(c,{type:"button",variant:"outline",size:"sm",className:"mt-1 gap-2",disabled:U,onClick:()=>{var a;return(a=I.current)==null?void 0:a.click()},children:[e.jsx(V,{className:"h-4 w-4"}),U?"Enviando...":"Enviar PDF"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(R,{checked:u.data.is_active??!0,onCheckedChange:a=>p(t=>({...t,data:{...t.data,is_active:a}}))}),e.jsx(x,{children:"Ativa"})]})]}),e.jsxs(me,{children:[e.jsx(c,{variant:"outline",onClick:()=>p({open:!1,moduleId:"",data:E}),children:"Cancelar"}),e.jsx(c,{onClick:()=>Q.mutate({...u.data,module_id:u.moduleId}),disabled:Q.isPending,children:"Salvar"})]})]})})]})}export{Ge 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.