1import{c as Z,a as ee,r as K,j as t}from"./app-CTaY8UJf.js";import{B}from"./button-DXCKLHtj.js";import{C as te,a as le,b as se,c as ie}from"./card-UxP9oPxk.js";import{I as re}from"./input-7aHhCeCr.js";import{L as M}from"./label-CxCrcTSv.js";import{T as ae}from"./textarea-0W-7qht9.js";import"./app-CNmQMdEi.js";import"./index-fQ3brVpV.js";function ye(R){const e=Z.c(71),{item:i,types:I,isEdit:Q}=R,o=Q===void 0?!1:Q,O=i?.titulo??"",$=i?.url??"",z=i?.type??"youtube",A=o?"put":"post";let w;e[0]!==O||e[1]!==$||e[2]!==z||e[3]!==A?(w={titulo:O,url:$,type:z,file:null,_method:A},e[0]=O,e[1]=$,e[2]=z,e[3]=A,e[4]=w):w=e[4];const{data:l,setData:a,post:S,processing:k,errors:s}=ee(w),W=K.useRef(null),[G,X]=K.useState(void 0);let L,U;e[5]!==l.file?(L=()=>{if(l.file){const r=URL.createObjectURL(l.file);return X(r),()=>URL.revokeObjectURL(r)}X(void 0)},U=[l.file],e[5]=l.file,e[6]=L,e[7]=U):(L=e[6],U=e[7]),K.useEffect(L,U);let E;e[8]!==l.file||e[9]!==l.type||e[10]!==o||e[11]!==i||e[12]!==S?(E=r=>{r.preventDefault();const _=o&&i?.id?`/admin/galeria-videos/${i.id}`:"/admin/galeria-videos";if(l.type==="manual"&&l.file){S(_,{forceFormData:!0});return}S(_)},e[8]=l.file,e[9]=l.type,e[10]=o,e[11]=i,e[12]=S,e[13]=E):E=e[13];const H=E;let F;e[14]===Symbol.for("react.memo_cache_sentinel")?(F=t.jsx(te,{children:t.jsx(le,{children:"Dados do VÃdeo"})}),e[14]=F):F=e[14];let T;e[15]===Symbol.for("react.memo_cache_sentinel")?(T=t.jsx(M,{htmlFor:"titulo",children:"TÃtulo *"}),e[15]=T):T=e[15];let n;e[16]!==a?(n=r=>a("titulo",r.target.value),e[16]=a,e[17]=n):n=e[17];let c;e[18]!==l.titulo||e[19]!==n?(c=t.jsx(re,{id:"titulo",value:l.titulo,onChange:n,placeholder:"TÃtulo do vÃdeo",autoFocus:!0}),e[18]=l.titulo,e[19]=n,e[20]=c):c=e[20];let u;e[21]!==s.titulo?(u=s.titulo&&t.jsx("p",{className:"text-sm text-red-600",children:s.titulo}),e[21]=s.titulo,e[22]=u):u=e[22];let d;e[23]!==c||e[24]!==u?(d=t.jsxs("div",{className:"space-y-2",children:[T,c,u]}),e[23]=c,e[24]=u,e[25]=d):d=e[25];let D;e[26]===Symbol.for("react.memo_cache_sentinel")?(D=t.jsx(M,{htmlFor:"type",children:"Tipo *"}),e[26]=D):D=e[26];const Y=l.type;let f;e[27]!==a?(f=r=>a("type",r.target.value),e[27]=a,e[28]=f):f=e[28];let m;e[29]!==I?(m=I.map(ne),e[29]=I,e[30]=m):m=e[30];let p;e[31]!==l.type||e[32]!==f||e[33]!==m?(p=t.jsx("select",{id:"type",value:Y,onChange:f,className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm",children:m}),e[31]=l.type,e[32]=f,e[33]=m,e[34]=p):p=e[34];let x;e[35]!==s.type?(x=s.type&&t.jsx("p",{className:"text-sm text-red-600",children:s.type}),e[35]=s.type,e[36]=x):x=e[36];let h;e[37]!==p||e[38]!==x?(h=t.jsxs("div",{className:"space-y-2",children:[D,p,x]}),e[37]=p,e[38]=x,e[39]=h):h=e[39];const P=l.type==="manual"?"(ou faça upload do arquivo)":"*";let y;e[40]!==P?(y=t.jsxs(M,{htmlFor:"url",children:["URL / Conteúdo ",P," "]}),e[40]=P,e[41]=y):y=e[41];let j;e[42]!==l.file||e[43]!==l.type||e[44]!==l.url||e[45]!==s.file||e[46]!==o||e[47]!==i||e[48]!==G||e[49]!==a?(j=l.type==="manual"?t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("input",{ref:W,id:"file",name:"file",type:"file",accept:"video/*",className:"hidden",onChange:r=>{const _=r.target.files?r.target.files[0]:null;a("file",_??null),_&&a("url","")}}),t.jsx(B,{type:"button",onClick:()=>W.current?.click(),children:"Escolher ficheiro"}),l.file?t.jsx("span",{className:"max-w-xs truncate text-sm",children:l.file.name}):o&&i?.url?t.jsx("a",{href:i.url??"#",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-[var(--primary)] underline",children:"Ver ficheiro atual"}):null,l.file&&t.jsx(B,{type:"button",variant:"outline",onClick:()=>a("file",null),children:"Remover"})]}),o&&i?.url&&!l.file&&t.jsxs("video",{className:"mt-2 max-h-56 w-full",controls:!0,children:[t.jsx("source",{src:i.url??""}),"Seu navegador não suporta o elemento de vÃdeo."]}),l.file&&t.jsx("video",{className:"mt-2 max-h-56 w-full",controls:!0,src:G}),s.file&&t.jsx("p",{className:"text-sm text-red-600",children:s.file})]}):t.jsx(ae,{id:"url",value:l.url,onChange:r=>a("url",r.target.value),placeholder:"Cole aqui a URL ou o código/trecho do vÃdeo",rows:6}),e[42]=l.file,e[43]=l.type,e[44]=l.url,e[45]=s.file,e[46]=o,e[47]=i,e[48]=G,e[49]=a,e[50]=j):j=e[50];let v;e[51]!==s.url?(v=s.url&&t.jsx("p",{className:"text-sm text-red-600",children:s.url}),e[51]=s.url,e[52]=v):v=e[52];let b;e[53]!==y||e[54]!==j||e[55]!==v?(b=t.jsxs("div",{className:"space-y-2",children:[y,j,v]}),e[53]=y,e[54]=j,e[55]=v,e[56]=b):b=e[56];let g;e[57]!==d||e[58]!==h||e[59]!==b?(g=t.jsxs(se,{children:[F,t.jsxs(ie,{className:"space-y-4",children:[d,h,b]})]}),e[57]=d,e[58]=h,e[59]=b,e[60]=g):g=e[60];const J=k?"Salvando...":o?"Atualizar":"Cadastrar";let N;
1e[61]!==k||e[62]!==J?(N=t.jsx(B,{type:"submit",disabled:k,children:J}),e[61]=k,e[62]=J,e[63]=N):N=e[63];let V;e[64]===Symbol.for("react.memo_cache_sentinel")?(V=t.jsx(B,{type:"button",variant:"outline",onClick:oe,children:"Cancelar"}),e[64]=V):V=e[64];let C;e[65]!==N?(C=t.jsxs("div",{className:"flex gap-3",children:[N,V]}),e[65]=N,e[66]=C):C=e[66];let q;return e[67]!==H||e[68]!==g||e[69]!==C?(q=t.jsxs("form",{onSubmit:H,className:"space-y-6",children:[g,C]}),e[67]=H,e[68]=g,e[69]=C,e[70]=q):q=e[70],q}function oe(){return window.history.back()}function ne(R){return t.jsx("option",{value:R,children:R},R)}export{ye 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.