1import{S as e,d as r,j as t,N as a,E as s,b as n,a as o}from"./landing-components-BfBhyDN0.js";import{d as l,r as i}from"./react-vendor-AGczziCo.js";const d=Object.freeze(Object.defineProperty({__proto__:null,default:()=>{const d=l(),[c,x]=i.useState(""),[u,m]=i.useState([]),[g,h]=i.useState(!0),[p,b]=i.useState(!1),[y,f]=i.useState(null),[k,v]=i.useState(!1);e((c?`Resultados: ${c}`:"Buscar Profesores")+" | ip",c?`Encuentra información sobre "${c}" en nuestra base de datos de profesores del IPN. Calificaciones, opiniones y recomendaciones de estudiantes.`:"Busca y compara profesores del IPN. Encuentra los mejores docentes según evaluaciones de estudiantes reales de ESCOM, UPIICSA, ESIME y más.","buscar profesores IPN, calificaciones docentes, opiniones estudiantes, mejores profesores");const[j,N]=i.useState(1),w=i.useMemo(()=>u.slice(0,20*j),[u,j]),C=w.length<u.length,L=e=>{if(!e)return"text-gray-400 dark:text-gray-500";const r="string"==typeof e?parseFloat(e):e;return isNaN(r)?"text-gray-400 dark:text-gray-500":r>=7?"text-ipn-guinda-900 dark:text-ipn-guinda-300":r>=5?"text-ipn-guinda-500 dark:text-ipn-guinda-400":"text-ipn-guinda-300 dark:text-ipn-guinda-600"},M=async()=>{h(!0),f(null);const e=await s(60);e.success?m(Array.isArray(e.data)?e.data:[]):f(e.error),h(!1)};i.useEffect(()=>{const e=c.trim();let t=!1;if(e.length<2){return(async()=>{h(!0),b(!1),f(null);const e=await s(60);t||(e.success?m(Array.isArray(e.data)?e.data:[]):f(e.error),N(1),h(!1))})(),()=>{t=!0}}const a=setTimeout(async()=>{b(!0),f(null);const a=await r(e);t||(a.success?m(a.data||[]):f(a.error),b(!1),h(!1),N(1))},400);return()=>{t=!0,clearTimeout(a)}},[c]);return t.jsxs("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900 flex flex-col transition-colors duration-200",children:[t.jsx(a,{}),t.jsxs("main",{className:"flex-1",children:[t.jsxs("section",{className:"relative overflow-hidden bg-white dark:bg-gray-900 border-b border-gray-200 dark:border-gray-700",children:[t.jsx("div",{className:"absolute inset-0 opacity-[0.03] dark:opacity-[0.05]",style:{backgroundImage:"radial-gradient(circle at 1px 1px, currentColor 1px, transparent 0)",backgroundSize:"32px 32px"}}),t.jsxs("div",{className:"relative max-w-3xl mx-auto px-4 sm:px-6 lg:px-8 pt-10 pb-8 sm:pt-14 sm:pb-10",children:[t.jsxs("div",{className:"text-center mb-8",children:[t.jsx("p",{className:"text-sm font-semibold text-ipn-guinda-900 dark:text-ipn-guinda-400 uppercase tracking-widest mb-3",children:"Buscador"}),t.jsxs("h1",{className:"text-3xl sm:text-4xl font-extrabold text-gray-900 dark:text-white tracking-tight",children:["Encuentra a tu"," ",t.jsx("span",{className:"text-ipn-guinda-900 dark:text-ipn-guinda-400",children:"profesor"})]})]}),t.jsxs("div",{className:"relative",children:[t.jsx("div",{className:"absolute inset-y-0 left-0 pl-4 flex items-center pointer-events-none",children:t.jsx("svg",{className:"h-5 w-5 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})}),t.jsx("input",{type:"text",value:c,onChange:e=>x(e.target.value),placeholder:"Nombre del profesor...",className:"w-full pl-12 pr-12 py-4 border-2 border-gray-200 dark:border-gray-600 rounded-2xl text-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-ipn-guinda-900/20 dark:focus:ring-ipn-guinda-400/20 focus:border-ipn-guinda-900 dark:focus:border-ipn-guinda-400 transition-all shadow-sm placeholder:text-gray-400"}),c&&t.jsx("button",{onClick:()=>x(""),className:"absolute inset-y-0 right-0 pr-5 flex items-center text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",children:t.jsx("svg",{className:"h-5 w-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.jsxs("div",{className:"mt-5 flex items-center justify-between",children:[t.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:g?"Cargando...":p?t.jsx("span",{className:"font-semibold text-ipn-guinda-900 dark:text-ipn-guinda-400",children:"Buscando..."}):t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"font-semibold text-gray-900 dark:text-white",children:u.length})," ",1===u.length?"resultado":"resultados",c&&` para "${c}"`]})}),t.jsxs("button",{onClick:async()=>{v(!0),n.remove(o.PROFESORES_POPULARES+"_top60"),Object.keys(localStorage).forEach(e
1=>{e.startsWith(o.SEARCH_QUERY)&&localStorage.removeItem(e)}),await M(),v(!1)},disabled:k,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-gray-500 dark:text-gray-400 hover:text-ipn-guinda-900 dark:hover:text-ipn-guinda-400 transition-colors disabled:opacity-50",children:[t.jsx("svg",{className:"w-3.5 h-3.5 "+(k?"animate-spin":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),k?"Actualizando...":"Actualizar"]})]})]})]}),t.jsx("section",{className:"py-6 sm:py-10",children:t.jsxs("div",{className:"max-w-6xl mx-auto px-4 sm:px-6 lg:px-8",children:[g?t.jsx("div",{className:"flex justify-center items-center py-12",children:t.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-gray-900"})}):y?t.jsxs("div",{className:"text-center py-12 bg-red-50 dark:bg-red-900/20 rounded-lg border border-red-200 dark:border-red-800",children:[t.jsx("p",{className:"text-red-600 font-medium",children:"Error al cargar profesores"}),t.jsx("p",{className:"text-sm text-red-500 mt-2",children:y}),t.jsx("button",{onClick:M,className:"mt-4 px-4 py-2 bg-red-600 text-white rounded-md hover:bg-red-700",children:"Reintentar"})]}):0===u.length?t.jsxs("div",{className:"text-center py-12",children:[t.jsx("svg",{className:"mx-auto h-12 w-12 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.172 16.172a4 4 0 015.656 0M9 10h.01M15 10h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),t.jsx("h3",{className:"mt-4 text-lg font-medium text-gray-900 dark:text-white",children:"No se encontraron resultados"}),t.jsx("p",{className:"mt-2 text-sm text-gray-600 dark:text-gray-300",children:"Intenta con otro término de búsqueda"}),c.trim()&&t.jsxs("div",{className:"mt-6 p-4 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-700 rounded-lg max-w-md mx-auto",children:[t.jsxs("div",{className:"flex items-start gap-3 mb-3",children:[t.jsx("svg",{className:"w-5 h-5 text-blue-600 dark:text-blue-400 flex-shrink-0 mt-0.5",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})}),t.jsxs("div",{className:"flex-1",children:[t.jsx("p",{className:"text-sm font-medium text-blue-900 dark:text-blue-200 mb-1",children:"¿El profesor no está registrado?"}),t.jsxs("p",{className:"text-xs text-blue-800 dark:text-blue-300",children:["Agrégalo ahora. ",t.jsx("span",{className:"font-semibold",children:"Recuerda:"})," escribe apellidos primero para mejor búsqueda (Ej: PÃREZ GARCÃA JUAN)."]})]})]}),t.jsxs("button",{onClick:()=>d(`/evaluar?nombre=${encodeURIComponent(c.trim().toUpperCase())}`),className:"inline-flex items-center gap-2 px-4 py-2 bg-ipn-guinda-900 dark:bg-ipn-guinda-700 text-white text-sm font-medium rounded-md hover:bg-ipn-guinda-800 dark:hover:bg-ipn-guinda-600 transition-colors shadow-sm hover:shadow-md",children:[t.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),"Agregar y evaluar profesor"]})]})]}):t.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3",children:w.map(e=>t.jsxs("div",{onClick:()=>(e=>{d(`/profesor/${e.slug}`)})(e),className:"bg-white dark:bg-gray-800 p-4 sm:p-6 rounded-2xl border border-gray-200 dark:border-gray-700 hover:border-ipn-guinda-200 dark:hover:border-ipn-guinda-700 hover:shadow-lg hover:-translate-y-0.5 transition-all duration-200 cursor-pointer overflow-hidden active:scale-[0.98]",children:[t.jsxs("div",{className:"flex items-start justify-between mb-4",children:[t.jsx("div",{className:"flex-1 min-w-0 mr-3 sm:mr-4",children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white line-clamp-2 break-words",children:e.nombre_completo}),e.total_evaluaciones>=3&&t.jsx("div",{className:"flex-shrink-0",title:"Profesor con múltiples evaluaciones",children:t.jsx("div",{className:"w-5 h-5 rounded-full bg-gradient-to-r from-ipn-guinda-700 via-ipn-guinda-400 to-i
1pn-guinda-700 animate-badge-shimmer flex items-center justify-center",children:t.jsx("svg",{className:"w-3 h-3 text-white",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})})})]})}),t.jsxs("div",{className:"flex flex-col items-end ml-3 sm:ml-4",children:[t.jsx("span",{className:`text-2xl sm:text-3xl font-bold ${L(e.calificacion_promedio)}`,children:e.calificacion_promedio||"N/A"}),t.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:"/10"})]})]}),t.jsxs("div",{className:"flex items-center gap-3 text-xs text-gray-500 dark:text-gray-400 pt-3 mt-3 border-t border-gray-100 dark:border-gray-700/50",children:[t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),e.total_evaluaciones||0," eval."]}),t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z"})}),e.total_evaluadores||0]}),null!=e.porcentaje_recomendacion&&e.total_evaluaciones>0&&t.jsxs("span",{className:"flex items-center gap-1 ml-auto font-medium text-ipn-guinda-900 dark:text-ipn-guinda-400",children:[t.jsx("svg",{className:"w-3.5 h-3.5",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{d:"M2 10.5a1.5 1.5 0 113 0v6a1.5 1.5 0 01-3 0v-6zM6 10.333v5.43a2 2 0 001.106 1.79l.05.025A4 4 0 008.943 18h5.416a2 2 0 001.962-1.608l1.2-6A2 2 0 0015.56 8H12V4a2 2 0 00-2-2 1 1 0 00-1 1v.667a4 4 0 01-.8 2.4L6.8 7.933a4 4 0 00-.8 2.4z"})}),Math.round(e.porcentaje_recomendacion),"%"]})]})]},e.id))}),!g&&!p&&C&&w.length>0&&t.jsx("div",{className:"mt-8 flex justify-center",children:t.jsxs("button",{onClick:()=>{N(e=>e+1)},className:"px-8 py-3 bg-ipn-guinda-900 dark:bg-ipn-guinda-700 text-white rounded-xl hover:bg-ipn-guinda-800 dark:hover:bg-ipn-guinda-600 transition-all font-semibold flex items-center gap-2 shadow-md shadow-ipn-guinda-900/20 hover:shadow-lg hover:-translate-y-0.5",children:[t.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),"Cargar más profesores (",u.length-w.length," restantes)"]})}),!g&&!p&&!C&&u.length>20&&t.jsx("div",{className:"mt-8 text-center",children:t.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:["â Has visto todos los resultados (",u.length," profesores)"]})})]})})]})]})}},Symbol.toStringTag,{value:"Module"})),c=({options:e=[],value:r,onChange:a,placeholder:s="Seleccionar...",searchPlaceholder:n="Buscar...",label:o,error:l,disabled:d=!1,className:c="",valueKey:x="id",labelKey:u="nombre",secondaryKey:m=null})=>{const[g,h]=i.useState(!1),[p,b]=i.useState(""),[y,f]=i.useState(0),k=i.useRef(null),v=i.useRef(null),j=i.useMemo(()=>e.filter(e=>{const r=p.toLowerCase(),t=e[u]?.toLowerCase()||"",a=m&&e[m]?.toLowerCase()||"";return t.includes(r)||a.includes(r)}),[e,p,u,m]),N=e.find(e=>e[x]===r),w=i.useCallback(e=>{a(e[x]),h(!1),b("")},[a,x]);i.useEffect(()=>{const e=e=>{k.current&&!k.current.contains(e.target)&&(h(!1),b(""))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),i.useEffect(()=>{g&&v.current&&v.current.focus()},[g]),i.useEffect(()=>{if(!g)return;const e=e=>{switch(e.key){case"ArrowDown":e.preventDefault(),f(e=>e<j.length-1?e+1:e);break;case"ArrowUp":e.preventDefault(),f(e=>e>0?e-1:0);break;case"Enter":e.preventDefault(),j[y]&&w(j[y]);break;case"Escape":e.preventDefault(),h(!1),b("")}};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[g,y,j,w]);return t.jsxs("div",{className:`relative ${c}`,ref:k,children:[o&&t.jsx("label",{className:"block text-sm font-medium text-gray-900 mb-2",children:o}),t.jsx("button",{type:"button",onClick:()=>{d||h(!g)},disabled:d,className:`w-full px-3 py-2 text-left border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-gray-900 focus:border-transparent transition-colors ${l?"border-red-500":"border-gray-300"} ${d?"bg-gray-100 cursor-not-allowed dark:bg-gray-800":"bg-white hover:border-gray-400 dark:bg-gray-700 dark:hover:border-gray-600"}`,children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:N?"text-gray-900 dark:text-white":"text-gray-500 dark:text-gray-400",children:N?t.jsxs(t.Fragment,{children:[N[u],m&&N[m]&&t.jsxs("span",{className:"ml-2 text-gray-500 text-xs",children:["(",N[m],")"]})]}):s}),t.jsx("svg",{className:"w-5 h-5 text-gray-400 dark:text-gray-300 transition-transform "+(g?"transform rotate-180":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})}),l&&t.jsx("p",{className:"mt-1 text-xs text-red-600",children:l}),g&&t.jsxs("div",{className:"absolute z-50 w-full mt-1 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-700 rounded-md shadow-lg max-h-80 overflow-hidden",children:[t.jsx("div",{className:"p-2 border-b border-gray-200 dark:border-gray-700 sticky top-0 bg-white dark:bg-gray-800",children:t.jsxs("div",{className:"relative",children:[t.jsx("svg",{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400 dark:text-gray-300",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),t.jsx("input",{ref:v,type:"text",value:p,onChange:e=>{b(e.target.value),f(0)},placeholder:n,className:"w-full pl-9 pr-3 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-gray-900 dark:focus:ring-gray-400 focus:border-transparent"}),p&&t.jsx("button",{onClick:()=>b(""),className:"absolute right-2 top-1/2 transform -translate-y-1/2 text-gray-400 dark:text-gray-300 hover:text-gray-600 dark:hover:text-gray-100",children:t.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})}),t.jsx("div",{className:"overflow-y-auto max-h-64",children:j.length>0?j.map((e,a)=>t.jsx("button",{type:"button",onClick:()=>w(e),className:`w-full px-3 py-2 text-left text-sm transition-colors ${a===y?"bg-gray-50 dark:bg-gray-700":""} ${e[x]===r?"bg-blue-50 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300 font-medium":"text-gray-900 dark:text-white hover:bg-gray-100 dark:hover:bg-gray-700"}`,children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{children:e[u]}),m&&e[m]&&t.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 ml-2",children:e[m]})]})},e[x])):t.jsxs("div",{className:"px-3 py-8 text-center text-sm text-gray-500 dark:text-gray-400",children:[t.jsx("svg",{className:"mx-auto h-12 w-12 text-gray-400 dark:text-gray-500 mb-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.172 16.172a4 4 0 015.656 0M9 10h.01M15 10h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),t.jsx("p",{children:"No se encontraron resultados"}),p&&t.jsxs("p",{className:"mt-1 text-xs",children:['para "',p,'"']}
1)]})}),j.length>0&&t.jsxs("div",{className:"px-3 py-1.5 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 text-xs text-gray-600 dark:text-gray-400 sticky bottom-0",children:[j.length," de ",e.length," ",1===j.length?"resultado":"resultados"]})]})]})};export{d as S,c as a};
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.