1import{z as ie,Y as ne,Z as X,u as F,r as C,a4 as _,j as e,w as V,I as v,L as Q,J as W,_ as T,a0 as P,as as le,a2 as q,a$ as d,a1 as h,a5 as J,a6 as I,a7 as M,aX as oe,D as de,X as H,au as ce}from"./index-CsgrPEHw.js";import{S as z}from"./switch-DZBgzg-c.js";import{C as me}from"./checkbox-BnxTtuMH.js";import{S as ue,a as ge,b as he,c as xe,d as A}from"./select-Bhmbqbi8.js";import pe from"./MediaBrowser-DUHCZRbZ.js";import{s as $}from"./slugify-Bet0icri.js";import{S as fe}from"./save-D-xz8kOW.js";import{W as je}from"./wand-sparkles-jNIKMhH3.js";import{T as be}from"./trash-2-CLjm4PD-.js";import{U as ve}from"./upload-VLbOCe8y.js";import{F as ye}from"./folder-open-DJ8SUlBG.js";import{P as Y}from"./plus-CGK8IarF.js";import"./index-DzNbZwYq.js";import"./index-BdQq_4o_.js";import"./shield-alert-D4TVOFRS.js";function Ne(b){if(!b||!b.trim())return[];try{const y=JSON.parse(b);return Array.isArray(y)?y.map(n=>({title:String(n.title||""),year:String(n.year||""),type:String(n.type||"Ãlbum")})):[]}catch{return[]}}function we({value:b,onChange:y}){const n=Ne(b),m=t=>{y(t.length>0?JSON.stringify(t):"")},k=()=>m([...n,{title:"",year:"",type:"Ãlbum"}]),u=t=>m(n.filter((a,x)=>x!==t)),N=(t,a,x)=>{m(n.map((w,p)=>p===t?{...w,[a]:x}:w))};return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs(d,{className:"flex items-center gap-1.5 text-base",children:[e.jsx(de,{className:"h-4 w-4"}),"DiscografÃa"]}),e.jsxs(v,{type:"button",variant:"outline",size:"sm",onClick:k,className:"h-8","data-testid":"button-add-disc-item",children:[e.jsx(Y,{className:"h-3.5 w-3.5 mr-1"})," Agregar"]})]}),n.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground text-center py-4 border border-dashed rounded-md",children:'Sin álbumes. Haz clic en "Agregar" para añadir uno.'}),e.jsx("div",{className:"space-y-2",children:n.map((t,a)=>e.jsxs("div",{className:"flex items-center gap-2 p-2 bg-muted/40 rounded-md border","data-testid":`disc-item-${a}`,children:[e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx(h,{value:t.title,onChange:x=>N(a,"title",x.target.value),placeholder:"Nombre del álbum",className:"h-9 text-sm","data-testid":`input-disc-title-${a}`})}),e.jsx(h,{value:t.year,onChange:x=>N(a,"year",x.target.value),placeholder:"Año",className:"h-9 text-sm w-24","data-testid":`input-disc-year-${a}`}),e.jsxs(ue,{value:t.type,onValueChange:x=>N(a,"type",x),children:[e.jsx(ge,{className:"h-9 text-sm w-32","data-testid":`select-disc-type-${a}`,children:e.jsx(he,{})}),e.jsxs(xe,{children:[e.jsx(A,{value:"Ãlbum",children:"Ãlbum"}),e.jsx(A,{value:"EP",children:"EP"}),e.jsx(A,{value:"Sencillo",children:"Sencillo"}),e.jsx(A,{value:"En Vivo",children:"En Vivo"}),e.jsx(A,{value:"Compilación",children:"Compilación"}),e.jsx(A,{value:"Colaboración",children:"Colaboración"})]})]}),e.jsx(v,{type:"button",variant:"ghost",size:"sm",onClick:()=>u(a),className:"h-9 w-9 p-0 text-muted-foreground hover:text-destructive","data-testid":`button-remove-disc-${a}`,children:e.jsx(H,{className:"h-4 w-4"})})]},a))})]})}function ke({value:b,onChange:y}){const{toast:n}=X(),[m,k]=C.useState(""),[u,N]=C.useState(""),{data:t=[]}=F({queryKey:["/api/genres"]}),a=(b||"").split(",").map(r=>r.trim()).filter(Boolean),x=new Set(a.map(r=>r.toLowerCase())),w=_({mutationFn:async r=>(await M("POST","/api/admin/genres",{name:r})).json(),onSuccess:r=>{I.invalidateQueries({queryKey:["/api/genres"]}),I.invalidateQueries({queryKey:["/api/admin/genres"]});const f=[...a,r.name].filter((S,D,U)=>U.findIndex(O=>O.toLowerCase()===S.toLowerCase())===D);y(f.join(", ")),N(""),n({title:"Género añadido"})},onError:r=>n({variant:"destructive",title:"Error",description:r.message})}),p=r=>{const f=r.toLowerCase();x.has(f)?y(a.filter(S=>S.toLowerCase()!==f).join(", ")):y([...a,r].join(", "))},L=t.filter(r=>r.name.toLowerCase().includes(m.trim().toLowerCase())),E=()=>{const r=u.trim();if(!r)return;const f=t.find(S=>S.name.toLowerCase()===r.toLowerCase());if(f){x.has(r.toLowerCase())||p(f.name),N("");return}w.mutate(r)};return e.jsxs("div",{className:"space-y-2","data-testid":"genres-picker",children:[a.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:a.map(r=>e.jsxs(ce,{variant:"secondary",className:"gap-1","data-testid":`badge-selected-genre-${r}`,children:[r,e.jsx("button",{type:"button",onClick:()=>p(r),className:"hover:text-destructive ml-0.5","data-testid":`button-remove-selected-${r}`,children:e.jsx(H,{className:"h-3 w-3"})})]},r))}),e.jsxs("div",{className:"border rounded-md p-2 max-h-64 overflow-y-auto bg-background",children:[e.jsx(h,{value:m,onChange:r=>k(r.target.value),placeholder:"Buscar género...",className:"h-8 mb-2 text-sm","data-testid":"input-filter-genres"}),L.length===0?e.jsx("p",{className:"text-xs text-muted-foreground text-center py-2",children:t.length===0?"N
1o hay géneros. Añade uno abajo.":"Sin resultados."}):e.jsx("div",{className:"grid grid-cols-1 gap-1",children:L.map(r=>{const f=x.has(r.name.toLowerCase());return e.jsxs("label",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-sm cursor-pointer hover:bg-muted/50 ${f?"bg-muted/40":""}`,"data-testid":`label-genre-option-${r.id}`,children:[e.jsx(me,{checked:f,onCheckedChange:()=>p(r.name),"data-testid":`checkbox-genre-option-${r.id}`}),e.jsx("span",{className:"truncate",children:r.name})]},r.id)})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(h,{value:u,onChange:r=>N(r.target.value),onKeyDown:r=>{r.key==="Enter"&&(r.preventDefault(),E())},placeholder:"Añadir nuevo género...",className:"h-9 text-sm","data-testid":"input-new-artist-genre"}),e.jsx(v,{type:"button",size:"sm",variant:"outline",onClick:E,disabled:w.isPending||!u.trim(),"data-testid":"button-add-artist-genre",children:w.isPending?e.jsx(q,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(Y,{className:"h-3.5 w-3.5"})})]})]})}function Me(){const b=ie(),[,y]=ne(),{toast:n}=X(),m=!b.id,k=b.id?parseInt(b.id,10):null,{data:u,isLoading:N}=F({queryKey:["/api/admin/artists"],enabled:!m}),t=C.useMemo(()=>m?null:u?.find(s=>s.id===k)??null,[u,k,m]),[a,x]=C.useState({}),[w,p]=C.useState(!1),[L,E]=C.useState(!1),[r,f]=C.useState(!1),[S,D]=C.useState([]),[U,O]=C.useState(null),[K,R]=C.useState(!1),i={name:a.name??t?.name??"",slug:a.slug??t?.slug??"",shortBio:a.shortBio??t?.shortBio??"",bio:a.bio??t?.bio??"",imageUrl:a.imageUrl??t?.imageUrl??"",origin:a.origin??t?.origin??"",genres:a.genres??t?.genres??"",spotifyUrl:a.spotifyUrl??t?.spotifyUrl??"",spotifyArtistId:a.spotifyArtistId??t?.spotifyArtistId??"",youtubeUrl:a.youtubeUrl??t?.youtubeUrl??"",instagramUrl:a.instagramUrl??t?.instagramUrl??"",facebookUrl:a.facebookUrl??t?.facebookUrl??"",twitterUrl:a.twitterUrl??t?.twitterUrl??"",websiteUrl:a.websiteUrl??t?.websiteUrl??"",discography:a.discography??t?.discography??"",metaTitle:a.metaTitle??t?.metaTitle??"",metaDescription:a.metaDescription??t?.metaDescription??"",keywords:a.keywords??t?.keywords??"",language:a.language??t?.language??"es",languages:a.languages??t?.languages??t?.language??"es",exactMatchOnly:a.exactMatchOnly??t?.exactMatchOnly??!1,isSoloArtist:a.isSoloArtist??t?.isSoloArtist??null,published:a.published??t?.published??!0},l=(s,o)=>{x(c=>{const g={...c,[s]:o};return s==="name"&&m&&(g.slug=$(o)),g})},B=_({mutationFn:async s=>{if(s.id){const{id:o,...c}=s,g=await M("PATCH",`/api/admin/artists/${o}`,c);try{return await g.json()}catch{return{id:o}}}else{const o=await M("POST","/api/admin/artists",s);try{return await o.json()}catch{return null}}},onSuccess:s=>{I.invalidateQueries({queryKey:["/api/admin/artists"]}),I.invalidateQueries({queryKey:["/api/artists"]}),n({title:"Artista guardado"}),m&&s?.id&&y(`/a7dmin/artists/${s.id}/edit`)},onError:()=>n({variant:"destructive",title:"Error al guardar"})}),Z=async()=>{const s=i.name;if(!s.trim()||s.trim().length<2){n({variant:"destructive",title:"Escribe el nombre del artista primero"});return}f(!0);try{const o=await fetch("/api/admin/artists/autofill",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({name:s.trim()})}),c=await o.json().catch(()=>({}));if(!o.ok){const j=c?.error||(c?.notFound?"No se encontró información sobre este artista":"No se pudo obtener información");n({variant:"destructive",title:j,description:"Intenta con el nombre completo del artista"});return}const g={},G=j=>!j||typeof j=="string"&&!j.trim(),ae=["bio","shortBio","origin","genres","spotifyUrl","spotifyArtistId","youtubeUrl","instagramUrl","facebookUrl","twitterUrl","websiteUrl","discography","metaTitle","metaDescription","keywords"];for(const j of ae)c[j]&&G(i[j])&&(g[j]=c[j]);if(c.language&&!a.language&&!t?.language&&(g.language=c.language),typeof c.isSoloArtist=="boolean"&&i.isSoloArtist===null&&(g.isSoloArtist=c.isSoloArtist),D(Array.isArray(c.sources)?c.sources:[]),O(typeof c.suggestedImageUrl=="string"&&!i.imageUrl?c.suggestedImageUrl:null),Object.keys(g).length===0)n({title:"No se encontró información nueva",description:"Todos los campos ya tienen datos"});else{x(re=>({...re,...g}));const j=Object.keys(g).length;n({title:`${j} campo${j>1?"s":""} completado${j>1?"s":""} con Grok`,description:"Revisa la información y las fuentes antes de guardar"})}}catch(o){n({variant:"destructive",title:"No se pudo obtener información",description:o?.message||"Intenta de nuevo"})}finally{f(!1)}},ee=()=>{if(!i.name.trim())return;const s={...i};t&&(s.id=t.id),s.slug||(s.slug=$(s.name)),B.mutate(s)},se=async()=>
1{if(U){R(!0);try{const s=await fetch("/api/admin/artists/import-image",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({url:U})}),o=await s.json().catch(()=>({}));if(!s.ok){n({variant:"destructive",title:o?.error||"No se pudo importar la imagen"});return}l("imageUrl",o.url),O(null),I.invalidateQueries({queryKey:["/api/media"]}),n({title:"Imagen importada de Wikipedia"})}catch(s){n({variant:"destructive",title:"Error al importar imagen",description:s?.message})}finally{R(!1)}}},te=()=>{const s=document.createElement("input");s.type="file",s.accept="image/*",s.onchange=async o=>{const c=o.target.files?.[0];if(c){E(!0);try{const g=await oe(c);if(!g.ok)throw new Error("Upload failed");const G=await g.json();l("imageUrl",G.url),I.invalidateQueries({queryKey:["/api/media"]}),n({title:"Imagen subida"})}catch{n({variant:"destructive",title:"Error al subir imagen"})}finally{E(!1)}}},s.click()};return!m&&N?e.jsxs("div",{className:"space-y-4",children:[e.jsx(V,{className:"h-10 w-64"}),e.jsx(V,{className:"h-96 w-full"})]}):!m&&!t?e.jsxs("div",{className:"space-y-4","data-testid":"artist-not-found",children:[e.jsx(v,{variant:"ghost",asChild:!0,children:e.jsxs(Q,{href:"/a7dmin/artists",children:[e.jsx(W,{className:"h-4 w-4 mr-1"})," Volver"]})}),e.jsx(T,{children:e.jsx(P,{className:"py-10 text-center text-muted-foreground",children:"Artista no encontrado."})})]}):e.jsxs("div",{className:"space-y-4 max-w-5xl mx-auto","data-testid":"artist-edit-page",children:[e.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-3 sticky top-0 z-10 bg-background py-3 -mt-3 border-b",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx(v,{variant:"ghost",size:"sm",asChild:!0,"data-testid":"button-back-to-artists",children:e.jsxs(Q,{href:"/a7dmin/artists",children:[e.jsx(W,{className:"h-4 w-4 mr-1"})," Volver"]})}),e.jsx("h2",{className:"text-xl md:text-2xl font-bold truncate","data-testid":"text-artist-edit-title",children:m?"Nuevo Artista":`Editar: ${t.name}`})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[!m&&t?.slug&&e.jsx(v,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs("a",{href:`/artista/${t.slug}`,target:"_blank",rel:"noopener noreferrer","data-testid":"button-view-artist-public",children:[e.jsx(le,{className:"h-4 w-4 mr-1"})," Ver público"]})}),e.jsxs(v,{onClick:ee,disabled:B.isPending||!i.name.trim(),"data-testid":"button-save-artist",children:[B.isPending?e.jsx(q,{className:"h-4 w-4 mr-1 animate-spin"}):e.jsx(fe,{className:"h-4 w-4 mr-1"}),B.isPending?"Guardando...":"Guardar"]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[e.jsx(T,{className:"lg:col-span-2",children:e.jsxs(P,{className:"pt-6 space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(d,{children:"Nombre *"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(h,{value:i.name,onChange:s=>l("name",s.target.value),"data-testid":"input-artist-name",className:"flex-1"}),e.jsxs(v,{type:"button",variant:"outline",size:"sm",onClick:Z,disabled:r||!i.name.trim(),className:"shrink-0 h-10 px-3 border-[#ffb023]/50 text-[#ffb023] hover:bg-[#ffb023]/10 hover:text-[#e69f1a]","data-testid":"button-autofill-artist",children:[r?e.jsx(q,{className:"h-4 w-4 animate-spin"}):e.jsx(je,{className:"h-4 w-4"}),e.jsx("span",{className:"ml-1.5 text-xs",children:r?"Buscando con Grok...":"Generar con Grok"})]})]}),S.length>0&&e.jsxs("div",{className:"mt-2 p-2 rounded-md border border-[#ffb023]/30 bg-[#ffb023]/[0.04]","data-testid":"grok-sources",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-[#ffb023] mb-1",children:"Fuentes consultadas por Grok"}),e.jsx("ul",{className:"space-y-0.5 max-h-28 overflow-y-auto",children:S.map((s,o)=>e.jsx("li",{className:"text-[11px] truncate",children:e.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-[#ffb023] hover:underline","data-testid":`link-grok-source-${o}`,children:s})},o))}),e.jsx("p",{className:"text-[10px] text-muted-foreground mt-1.5 italic",children:"Verifica los datos antes de guardar â Grok puede equivocarse."})]})]}),e.jsxs("div",{children:[e.jsx(d,{children:"Slug"}),e.jsx(h,{value:i.slug,onChange:s=>l("slug",s.target.value),onBlur:s=>{const o=$(s.target.value||""),c=$(i.name||""),g=o||c;g&&g!==i.slug&&l("slug",g)},"data-testid":"input-artist-slug"}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1","data-testid":"text-artist-slug-preview",children:["URL: ",e.jsxs("span",{className:"font-mono",children:["altar7.com/artista/",i.slug||"tu-slug"]})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(d,{children:"Origen"}),e.jsx(h,{value:i.origin,onChange:s=>l("origin",s.target.value),placeholder:"Ej: Colombia, Estados Unidos"})]}),e.jsxs("div",{children:[e.jsx(d,{children:"Idiomas"}),e.jsx(Ce,{value:i.languages||"",onChange:(s,o)=>
1{l("languages",s),l("language",o[0]||"es")}}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1.5",children:"Selecciona uno o más idiomas en los que canta este artista. Gestiona los idiomas disponibles desde la página de Artistas."})]})]}),e.jsxs("div",{children:[e.jsx(d,{children:"Bio corta"}),e.jsx(J,{value:i.shortBio,onChange:s=>l("shortBio",s.target.value),rows:2,placeholder:"Una o dos frases de presentación"})]}),e.jsxs("div",{children:[e.jsx(d,{children:"BiografÃa completa"}),e.jsx(J,{value:i.bio,onChange:s=>l("bio",s.target.value),rows:10,placeholder:"BiografÃa detallada..."})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(d,{children:"Spotify URL"}),e.jsx(h,{value:i.spotifyUrl,onChange:s=>l("spotifyUrl",s.target.value),placeholder:"https://open.spotify.com/artist/..."})]}),e.jsxs("div",{children:[e.jsx(d,{children:"Spotify Artist ID"}),e.jsx(h,{value:i.spotifyArtistId,onChange:s=>l("spotifyArtistId",s.target.value),placeholder:"Ej: 4q3ewBCX7sLwd24euuV69X"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(d,{children:"YouTube URL"}),e.jsx(h,{value:i.youtubeUrl,onChange:s=>l("youtubeUrl",s.target.value)})]}),e.jsxs("div",{children:[e.jsx(d,{children:"Instagram URL"}),e.jsx(h,{value:i.instagramUrl,onChange:s=>l("instagramUrl",s.target.value)})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(d,{children:"Facebook URL"}),e.jsx(h,{value:i.facebookUrl,onChange:s=>l("facebookUrl",s.target.value)})]}),e.jsxs("div",{children:[e.jsx(d,{children:"X (Twitter) URL"}),e.jsx(h,{value:i.twitterUrl,onChange:s=>l("twitterUrl",s.target.value)})]})]}),e.jsxs("div",{children:[e.jsx(d,{children:"Sitio Web URL"}),e.jsx(h,{value:i.websiteUrl,onChange:s=>l("websiteUrl",s.target.value)})]}),e.jsx(we,{value:i.discography,onChange:s=>l("discography",s)}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 pt-2 border-t",children:[e.jsxs("div",{children:[e.jsx(d,{children:"Meta Title (SEO)"}),e.jsx(h,{value:i.metaTitle,onChange:s=>l("metaTitle",s.target.value)})]}),e.jsxs("div",{children:[e.jsx(d,{children:"Meta Description (SEO)"}),e.jsx(h,{value:i.metaDescription,onChange:s=>l("metaDescription",s.target.value)})]})]}),e.jsxs("div",{children:[e.jsx(d,{children:"Keywords (SEO)"}),e.jsx(h,{value:i.keywords,onChange:s=>l("keywords",s.target.value),placeholder:"palabra1, palabra2, palabra3"})]})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(T,{children:e.jsxs(P,{className:"pt-6 space-y-3",children:[e.jsx(d,{className:"text-base",children:"Imagen"}),i.imageUrl?e.jsxs("div",{className:"relative w-full aspect-square rounded-lg overflow-hidden border border-zinc-700 bg-muted",children:[e.jsx("img",{src:i.imageUrl,alt:"Preview",className:"w-full h-full object-cover"}),e.jsx(v,{variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-7 w-7",onClick:()=>l("imageUrl",""),"data-testid":"button-remove-artist-image",children:e.jsx(be,{className:"h-3.5 w-3.5"})})]}):e.jsx("div",{className:"w-full aspect-square rounded-lg border border-dashed bg-muted/40 flex items-center justify-center text-muted-foreground text-sm",children:"Sin imagen"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(v,{type:"button",variant:"outline",size:"sm",onClick:te,disabled:L,className:"flex-1","data-testid":"button-upload-artist-image",children:[e.jsx(ve,{className:"h-4 w-4 mr-1"}),L?"Subiendo...":"Subir"]}),e.jsxs(v,{type:"button",variant:"outline",size:"sm",onClick:()=>p(!0),className:"flex-1","data-testid":"button-browse-artist-image",children:[e.jsx(ye,{className:"h-4 w-4 mr-1"}),"Biblioteca"]})]}),e.jsx(h,{value:i.imageUrl,onChange:s=>l("imageUrl",s.target.value),placeholder:"https://...",className:"text-xs"}),U&&!i.imageUrl&&e.jsxs("div",{className:"rounded-md border border-[#ffb023]/40 bg-[#ffb023]/[0.04] p-2 space-y-2","data-testid":"grok-suggested-image",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-[#ffb023]",children:"Imagen sugerida (Wikipedia)"}
1),e.jsx("img",{src:U,alt:"Sugerencia de Wikipedia",className:"w-full aspect-square object-cover rounded border border-zinc-700"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{type:"button",size:"sm",onClick:se,disabled:K,className:"flex-1 bg-[#ffb023] text-zinc-900 hover:bg-[#e69f1a]","data-testid":"button-use-suggested-image",children:K?e.jsx(q,{className:"h-4 w-4 animate-spin"}):"Usar esta imagen"}),e.jsx(v,{type:"button",variant:"ghost",size:"sm",onClick:()=>O(null),"data-testid":"button-dismiss-suggested-image",children:"Descartar"})]}),e.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"Verifica los derechos de uso antes de publicar."})]}),e.jsx(pe,{open:w,onClose:()=>p(!1),onSelect:s=>{l("imageUrl",s),p(!1)}})]})}),e.jsx(T,{children:e.jsxs(P,{className:"pt-6 space-y-2",children:[e.jsx(d,{className:"text-base",children:"Géneros"}),e.jsx(ke,{value:i.genres,onChange:s=>l("genres",s)})]})}),e.jsx(T,{children:e.jsxs(P,{className:"pt-6 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(d,{htmlFor:"published-switch",children:"Publicado"}),e.jsx(z,{id:"published-switch",checked:i.published,onCheckedChange:s=>l("published",s)})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(d,{htmlFor:"exact-match-switch",children:"Solo coincidencia exacta"}),e.jsx(z,{id:"exact-match-switch",checked:i.exactMatchOnly,onCheckedChange:s=>l("exactMatchOnly",s),"data-testid":"switch-exact-match"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Activar si el nombre es genérico o común. Solo mostrará menciones cuando el nombre completo coincida exactamente."})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(d,{htmlFor:"solo-artist-switch",children:"Artista solista (Person)"}),e.jsx(z,{id:"solo-artist-switch",checked:i.isSoloArtist===!0,onCheckedChange:s=>l("isSoloArtist",!!s),"data-testid":"switch-solo-artist"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Activar para personas individuales (schema.org/Person). Si está desactivado, se publica como banda o grupo (schema.org/MusicGroup) â el valor por defecto."})]})]})})]})]})]})}function Ce({value:b,onChange:y}){const{data:n=[],isLoading:m}=F({queryKey:["/api/artist-languages"]}),k=(b||"").split(",").map(u=>u.trim().toLowerCase()).filter(Boolean);return m?e.jsx("p",{className:"text-xs text-muted-foreground mt-1.5",children:"Cargando idiomasâ¦"}):n.length===0?e.jsx("p",{className:"text-xs text-muted-foreground mt-1.5",children:"No hay idiomas configurados. Agrega idiomas desde la página de Artistas (botón âIdiomasâ) para poder asignarlos aquÃ."}):e.jsx("div",{className:"flex flex-wrap gap-2 mt-1.5",children:n.map(u=>{const N=k.includes(u.code);return e.jsxs("label",{className:`inline-flex items-center gap-2 px-3 h-10 rounded-md border text-sm cursor-pointer select-none ${N?"bg-[#ffb023]/10 border-[#ffb023] text-[#7a5310] dark:text-[#ffd07a]":"bg-background border-input hover:bg-muted"}`,"data-testid":`toggle-artist-language-${u.code}`,children:[e.jsx("input",{type:"checkbox",className:"h-4 w-4 accent-[#ffb023]",checked:N,onChange:t=>{const a=t.target.checked?[...k.filter(p=>p!==u.code),u.code]:k.filter(p=>p!==u.code),w=n.map(p=>p.code).filter(p=>a.includes(p));y(w.join(","),w)}}),u.label]},u.code)})})}export{Me 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.