PageSourceSearch

https://portal-path-pro-beta-1-7735.taskade.app/chunks/chunk-3NGYNRZE.js

js portal-path-pro-beta-1-7735.taskade.app collected 2026-10-03 15:05:41 UTC 19,172 bytes, 11 lines download raw bytes

1var __IMPORT_META_ENV={};var __PROCESS_ENV={NODE_ENV:"production"};
2import{b as G}from"/chunks/chunk-H2F7S7VI.js";import{a as F,b as N}from"/chunks/chunk-I7B43NG3.js";import{a as g}from"/chunks/chunk-QZYIXIG6.js";import{Ia as D,L as U,N as z,Ra as I,_ as H,_b as j,d as P,e as J,f as O,pb as B,xa as X}from"/chunks/chunk-S3UOBGPZ.js";var d=P(J());var C=P(J());var t=P(O());function Q({agentId:u,conversationId:h,isConnected:p,error:y,onClose:$}){let[S,E]=(0,C.useState)([]),[s,L]=(0,C.useState)(!1),[x,f]=(0,C.useState)(!1);(0,C.useEffect)(()=>{r("info","Diagnostic panel opened",{agentId:u,conversationId:h,isConnected:p,hasError:!!y})},[]),(0,C.useEffect)(()=>{h&&r("success","Conversation ID set",{conversationId:h}),p&&r("success","Stream connected!",{}),y&&r("error","Error detected",{message:y.message,stack:y.stack})},[h,p,y]);let r=(o,n,w)=>{E(m=>[...m,{timestamp:new Date().toLocaleTimeString(),level:o,message:n,details:w}])},A=async()=>{f(!0),r("info","Starting connection test...",{});try{r("info","Step 1: Creating conversation...",{});let o=`/api/taskade/agents/${u}/public-conversations`;r("info",`Calling: POST ${o}`,{});let n=await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"}});if(r("info",`Response status: ${n.status} ${n.statusText}`,{}),!n.ok){let c=await n.text();r("error","Failed to create conversation",{status:n.status,statusText:n.statusText,body:c}),f(!1);return}let{conversationId:w}=await n.json();r("success","Conversation created!",{conversationId:w}),r("info","Step 2: Verifying SSE endpoint...",{});let m=`/api/taskade/agents/${u}/public-conversations/${w}/stream`;r("info",`SSE URL: ${m}`,{});let b=new EventSource(m),T=setTimeout(()=>{r("error","SSE connection timeout (10s)",{url:m}),b.close(),f(!1)},1e4);b.onopen=()=>{clearTimeout(T),r("success","SSE stream connected!",{url:m}),r("info","Step 3: Sending test message...",{});let c=`/api/taskade/agents/${u}/public-conversations/${w}/messages`;fetch(c,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:"Test message from diagnostic panel"})}).then(i=>i.json()).then(i=>{r("success","Message sent successfully",i)}).catch(i=>{r("error","Failed to send message",{error:i.message})})},b.onerror=()=>{clearTimeout(T),r("error","SSE stream error",{readyState:b.readyState,url:m}),b.close(),f(!1)},b.onmessage=c=>{try{let i=JSON.parse(c.data);r("success",`Received event: ${i.type}`,i),i.type==="finish"&&(b.close(),f(!1),r("success","\u2705 All tests passed!",{}))}catch(i){r("error","Failed to parse event",{data:c.data,error:i.message})}}}catch(o){r("error","Test failed with exception",{message:o.message,stack:o.stack}),f(!1)}},v=()=>{let o=S.map(n=>`[${n.timestamp}] ${n.level.toUpperCase()}: ${n.message}${n.details?`
3`+JSON.stringify(n.details,null,2):""}`).join(`
4
5`);navigator.clipboard.writeText(o),L(!0),setTimeout(()=>L(!1),2e3)},R=o=>{switch(o){case"success":return(0,t.jsx)(z,{className:"w-4 h-4 text-green-500"});case"error":return(0,t.jsx)(U,{className:"w-4 h-4 text-red-500"});case"warn":return(0,t.jsx)(U,{className:"w-4 h-4 text-yellow-500"});default:return(0,t.jsx)(X,{className:"w-4 h-4 text-blue-500"})}};return(0,t.jsx)("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-[100] flex items-center justify-center p-4",children:(0,t.jsxs)("div",{className:"bg-white dark:bg-gray-900 rounded-2xl shadow-2xl w-full max-w-3xl max-h-[80vh] flex flex-col",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{className:"text-xl font-bold text-gray-900 dark:text-white",children:"Chat 
5Connection Diagnostic"}),(0,t.jsx)("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:"Real-time debugging for agent chat connection"})]}),(0,t.jsx)("button",{onClick:$,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-colors",children:(0,t.jsx)(j,{className:"w-5 h-5 text-gray-500"})})]}),(0,t.jsxs)("div",{className:"grid grid-cols-3 gap-4 p-6 bg-gray-50 dark:bg-gray-800/50",children:[(0,t.jsxs)("div",{className:"bg-white dark:bg-gray-900 p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:[(0,t.jsx)("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Agent ID"}),(0,t.jsxs)("div",{className:"text-sm font-mono text-gray-900 dark:text-white truncate",children:[u.slice(0,12),"..."]})]}),(0,t.jsxs)("div",{className:"bg-white dark:bg-gray-900 p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:[(0,t.jsx)("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Conversation"}),(0,t.jsx)("div",{className:"text-sm font-mono text-gray-900 dark:text-white truncate",children:h?h.slice(0,12)+"...":"Not created"})]}),(0,t.jsxs)("div",{className:"bg-white dark:bg-gray-900 p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:[(0,t.jsx)("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Connection"}),(0,t.jsxs)("div",{className:g("text-sm font-semibold flex items-center gap-2",p?"text-green-600 dark:text-green-400":"text-gray-400"),children:[(0,t.jsx)("div",{className:g("w-2 h-2 rounded-full",p?"bg-green-500":"bg-gray-300")}),p?"Connected":"Disconnected"]})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3 px-6 py-3 border-b border-gray-200 dark:border-gray-700",children:[(0,t.jsx)("button",{onClick:A,disabled:x,className:g("px-4 py-2 rounded-lg font-medium text-sm transition-colors flex items-center gap-2",x?"bg-gray-300 dark:bg-gray-700 text-gray-500 cursor-not-allowed":"bg-blue-600 hover:bg-blue-700 text-white"),children:x?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(D,{className:"w-4 h-4 animate-spin"}),"Running Test..."]}):"Run Full Connection Test"}),(0,t.jsx)("button",{onClick:v,className:"px-4 py-2 rounded-lg font-medium text-sm bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300 transition-colors flex items-center gap-2",children:s?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(z,{className:"w-4 h-4 text-green-500"}),"Copied!"]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(H,{className:"w-4 h-4"}),"Copy Logs"]})})]}),(0,t.jsx)("div",{className:"flex-1 overflow-y-auto p-6 space-y-3 font-mono text-xs",children:S.length===0?(0,t.jsx)("div",{className:"text-center py-12 text-gray-400",children:'No logs yet. Click "Run Full Connection Test" to start.'}):S.map((o,n)=>(0,t.jsx)("div",{className:g("p-3 rounded-lg border",o.level==="success"&&"bg-green-50 dark:bg-green-900/10 border-green-200 dark:border-green-800",o.level==="error"&&"bg-red-50 dark:bg-red-900/10 border-red-200 dark:border-red-800",o.level==="warn"&&"bg-yellow-50 dark:bg-yellow-900/10 border-yellow-200 dark:border-yellow-800",o.level==="info"&&"bg-blue-50 dark:bg-blue-900/10 border-blue-200 dark:border-blue-800"),children:(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[R(o.level),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,t.jsx)("span",{className:"text-gray-500 dark:text-gray-400",children:o.timestamp}),(0,t.jsx)("span",{className:g("font-semibold",o.level==="success"&&"text-green-700 dark:text-green-300",o.level==="error"&&"text-red-700 dark:text-red-300",o.level==="warn"&&"text-yellow-700 dark:text-yellow-300",o.level==="info"&&"text-blue-700 dark:text-blue-300"),children:o.message})]}),o.details&&(0,t.jsx)("pre",{className:"text-xs bg-gray-900 dark:bg-black text-gray-100 p-2 rounded overflow-x-auto mt-2",children:JSON.stringify(o.details,null,2)})]})]})},n))})]})})}var e=P(O());function q({schoolName:u,schoolSlug:h,conference:p,division:y}){let $="01KG6BQ0N7KX1AQNHDCNRC0VSB",[S,E]=(0,d.useState)(!1),[s,L]=(0,d.useState)(()=>sessionStorage.getItem("school-chat-convo-id")),[x,f]=(0,d.useState)(""),[r,A]=(0,d.useState)(!1),[v,R]=(0,d.useState)(!1),[o,n]=(0,d.useState)(!1),w=(0,d.useRef)(null),m=(0,d.useRef)(!1),b=(0,d.useRef)(!1),{sendMessage:T,messages:c,isConnected:i,createConversation:W,error:k}=G($,s,{autoConnect:!!s});(0,d.useEffect)(()=>
5{console.log("[SchoolProfileChat] State:",{agentId:$,conversationId:s,isConnected:i,messageCount:c.length,error:k?.message})},[s,i,c.length,k]),(0,d.useEffect)(()=>{let a=l=>{l.ctrlKey&&l.shiftKey&&l.key==="D"&&(l.preventDefault(),n(V=>!V))};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[]),(0,d.useEffect)(()=>{s&&sessionStorage.setItem("school-chat-convo-id",s)},[s]),(0,d.useEffect)(()=>{w.current?.scrollIntoView({behavior:"smooth"})},[c]),(0,d.useEffect)(()=>{s&&u&&!b.current&&i&&c.length===0&&(b.current=!0,setTimeout(async()=>{if(!s){console.warn("[SchoolProfileChat] Conversation lost before sending context"),b.current=!1;return}let a=`User is viewing the profile page for ${u}.
6School: ${u}
7${h?`Slug: ${h}`:""}
8${p?`Conference: ${p}`:""}
9${y?`Division: ${y}`:""}
10
11Please provide information specific to this school when answering questions.`;try{await T(a)}catch(l){console.error("[SchoolProfileChat] Failed to send context:",l),b.current=!1}},500))},[s,u,h,p,y,i,c.length,T]);let K=async()=>{if(console.log("[SchoolProfileChat] Opening chat...",{conversationId:s,isInitializing:r,hasInitialized:m.current}),E(!0),!s&&!r&&!m.current){console.log("[SchoolProfileChat] Creating new conversation..."),A(!0),m.current=!0;try{let a=await W();console.log("[SchoolProfileChat] Created conversation:",a),L(a),setTimeout(()=>{i||console.warn("[SchoolProfileChat] Stream not connected after 3s")},3e3)}catch(a){console.error("[SchoolProfileChat] Failed to initialize chat:",a);let l=a?.message||"Unknown error";l.includes("404")?console.error("Agent API endpoint not found - check if agent is properly configured"):l.includes("403")&&console.error("Agent not accessible - check if agent has public visibility"),m.current=!1}finally{A(!1)}}else console.log("[SchoolProfileChat] Using existing conversation:",s)},M=async()=>{if(!x.trim()||!s||v)return;let a=x.trim();f(""),R(!0);try{await T(a)}catch(l){console.error("Failed to send message:",l),f(a)}finally{R(!1)}},Y=a=>{a.key==="Enter"&&!a.shiftKey&&(a.preventDefault(),M())};return(0,e.jsxs)(e.Fragment,{children:[o&&(0,e.jsx)(Q,{agentId:$,conversationId:s,isConnected:i,error:k,onClose:()=>n(!1)}),(0,e.jsx)(F,{children:!S&&(0,e.jsx)(N.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},onClick:K,className:g("fixed bottom-6 right-6 z-50","w-14 h-14 rounded-full","bg-gradient-to-br from-blue-500 to-purple-600","shadow-lg shadow-blue-500/50","flex items-center justify-center","text-white","hover:shadow-xl hover:shadow-blue-500/60","transition-shadow duration-300"),children:(0,e.jsx)(I,{className:"w-6 h-6"})})}),(0,e.jsx)(F,{children:S&&(0,e.jsxs)(N.div,{initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:20,scale:.95},transition:{duration:.2},className:g("fixed bottom-6 right-6 z-50","w-full max-w-md h-[600px]","bg-white dark:bg-gray-900","border border-gray-200 dark:border-gray-700","rounded-2xl shadow-2xl","flex flex-col overflow-hidden","backdrop-blur-xl bg-white/95 dark:bg-gray-900/95"),children:[(0,e.jsxs)("div",{className:g("flex items-center justify-between","px-6 py-4","bg-gradient-to-r from-blue-500 to-purple-600","text-white"),children:[(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsx)("div",{className:"w-10 h-10 rounded-full bg-white/20 backdrop-blur-sm flex items-center justify-center",children:(0,e.jsx)(I,{className:"w-5 h-5"})}),i&&(0,e.jsx)("div",{className:"absolute -bottom-1 -right-1 w-3.5 h-3.5 bg-green-400 rounded-full border-2 border-white shadow-lg shadow-green-400/60 animate-pulse"}),!i&&s&&(0,e.jsx)("div",{className:"absolute -bottom-1 -right-1 w-3.5 h-3.5 bg-yellow-400 rounded-full border-2 border-white shadow-lg shadow-yellow-400/60 animate-pulse"})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("h3",{className:"font-bold text-xl",children:"School Assistant"}),(0,e.jsx)("p",{className:"text-sm text-white/90 font-medium",children:i?"Online":s?"Connecting...":"Ready"})]})]}),(0,e.jsx)("div",{className:"flex items-center gap-2",children:(0,e.jsx)("button",{onClick:()=>E(!1),className:"p-2 hover:bg-white/20 rounded-lg transition-colors",children:(0,e.jsx)(j,{className:"w-5 h-5"})})})]}),(0,e.jsx)("div",{className:"flex-1 overflow-y-auto p-6 space-y-4 bg-gradient-to-b from-gray-50/50 to-transparent dark:from-gray-800/50",children:k&&!s?(0,e.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,e.jsxs)("div",{className:"text-center space-y-4 max-w-sm",children:[(0,e.jsx)("div",{className:"w-16 h-16 rounded-full bg-red-100 dark:bg-red-900/20 flex items-center justify-center mx-auto",children:(0,e.jsx)(j,{className:"w-8 h-8 text-red-500"})}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("h4",{className:"font-semibold text-gray-900 dark:text-white",children:"Connection 
11Error"}),(0,e.jsx)("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:k.message.includes("404")?"Chat service is not available for this school yet.":k.message.includes("403")?"Chat access is restricted. Please try again later.":"Unable to start chat. Please try again."})]}),(0,e.jsx)("button",{onClick:()=>{m.current=!1,K()},className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg text-sm font-medium transition-colors",children:"Try Again"})]})}):r?(0,e.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,e.jsxs)("div",{className:"text-center space-y-3",children:[(0,e.jsx)(D,{className:"w-8 h-8 animate-spin mx-auto text-blue-500"}),(0,e.jsx)("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Initializing chat..."})]})}):c.length===0?(0,e.jsxs)("div",{className:"flex flex-col items-center justify-center h-full space-y-5",children:[(0,e.jsx)("div",{className:"w-20 h-20 rounded-full bg-gradient-to-br from-blue-500/20 to-purple-600/20 flex items-center justify-center",children:(0,e.jsx)(I,{className:"w-10 h-10 text-blue-500"})}),(0,e.jsxs)("div",{className:"text-center space-y-3",children:[(0,e.jsx)("h4",{className:"font-bold text-xl text-gray-900 dark:text-white",children:s&&sessionStorage.getItem("school-chat-convo-id")===s?`Welcome back to ${u||"School Profile"}!`:`Welcome to ${u||"School Profile"}!`}),(0,e.jsx)("p",{className:"text-base text-gray-600 dark:text-gray-300 max-w-xs font-medium leading-relaxed",children:s&&sessionStorage.getItem("school-chat-convo-id")===s?"Your previous conversation has been restored. Continue where you left off or start a new topic!":"Ask me anything about programs, facilities, NIL opportunities, or the recruiting process."})]}),(0,e.jsx)("div",{className:"grid grid-cols-2 gap-2 w-full max-w-sm",children:["Tell me about programs","NIL opportunities","Transfer portal info","Campus facilities"].map(a=>(0,e.jsx)("button",{onClick:()=>{f(a)},className:g("px-4 py-3 rounded-lg min-h-[48px]","bg-white dark:bg-gray-800","border-2 border-gray-200 dark:border-gray-700","text-base font-semibold text-gray-700 dark:text-gray-200","hover:border-blue-500 hover:text-blue-500 hover:bg-blue-50 dark:hover:bg-blue-900/20","transition-all duration-200 hover:scale-105"),children:a},a))})]}):(0,e.jsxs)(e.Fragment,{children:[c.map(a=>{let l=a.role==="user";return c.indexOf(a)===0&&l&&a.content.includes("User is viewing")?null:(0,e.jsxs)(N.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.2},className:g("flex gap-3",l?"justify-end":"justify-start"),children:[!l&&(0,e.jsx)("div",{className:"w-8 h-8 rounded-full bg-gradient-to-br from-blue-500 to-purple-600 flex items-center justify-center flex-shrink-0",children:(0,e.jsx)(I,{className:"w-4 h-4 text-white"})}),(0,e.jsxs)("div",{className:g("max-w-[75%] rounded-2xl px-5 py-4",l?"bg-gradient-to-br from-blue-600 to-purple-600 text-white shadow-lg":"bg-white dark:bg-gray-800 text-gray-900 dark:text-white border border-gray-200 dark:border-gray-700 shadow-md"),children:[(0,e.jsx)("p",{className:"text-base whitespace-pre-wrap leading-relaxed font-medium",children:a.content}),a.toolCalls&&a.toolCalls.length>0&&(0,e.jsx)("div",{className:"mt-2 pt-2 border-t border-white/20 dark:border-gray-700",children:(0,e.jsxs)("p",{className:"text-sm opacity-80 font-medium",children:["\u{1F527} Using tools: ",a.toolCalls.length]})})]}),l&&(0,e.jsx)("div",{className:"w-8 h-8 rounded-full bg-gray-200 dark:bg-gray-700 flex items-center justify-center flex-shrink-0",children:(0,e.jsx)("span",{className:"text-sm font-semibold text-gray-600 dark:text-gray-300",children:"You"})})]},a.id)}),v&&(0,e.jsxs)(N.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"flex gap-3 justify-start",children:[(0,e.jsx)("div",{className:"w-8 h-8 rounded-full bg-gradient-to-br from-blue-500 to-purple-600 flex items-center justify-center flex-shrink-0",children:(0,e.jsx)(I,{className:"w-4 h-4 text-white"})}),(0,e.jsx)("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-2xl px-4 py-3",children:(0,e.jsxs)("div",{className:"flex gap-1",children:[(0,e.jsx)(N.div,{animate:{y:[0,-8,0]},transition:{duration:.6,repeat:1/0,delay:0},className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,e.jsx)(N.div,{animate:{y:[0,-8,0]},transition:{duration:.6,repeat:1/0,delay:.2},className:"w-2 h-2 bg-purple-500 rounded-full"}),(0,e.jsx)(N.div,{animate:{y:[0,-8,0]},transition:{duration:.6,repeat:1/0,delay:.4},className:"w-2 h-2 bg-blue-500 rounded-full"})]})})]}
11),k&&(0,e.jsx)("div",{className:"p-4 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg",children:(0,e.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:k})}),(0,e.jsx)("div",{ref:w})]})}),(0,e.jsx)("div",{className:"p-4 border-t border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900",children:(0,e.jsxs)("div",{className:"flex gap-3",children:[(0,e.jsx)("input",{type:"text",value:x,onChange:a=>f(a.target.value),onKeyPress:Y,placeholder:v?"Sending...":s?"Ask about this school...":"Initializing chat...",disabled:!s||r||v,className:g("flex-1 px-5 py-4 rounded-xl text-base font-medium min-h-[56px]","bg-gray-100 dark:bg-gray-800","border-2 border-gray-300 dark:border-gray-600","text-gray-900 dark:text-white","placeholder-gray-500 dark:placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500","disabled:opacity-50 disabled:cursor-not-allowed","transition-all duration-200")}),(0,e.jsx)("button",{onClick:M,disabled:!x.trim()||!s||r||v,className:g("px-5 py-4 rounded-xl min-h-[56px] min-w-[56px]","bg-gradient-to-br from-blue-600 to-purple-600","text-white font-semibold shadow-lg","hover:shadow-xl hover:shadow-blue-500/50 hover:scale-105","disabled:opacity-50 disabled:cursor-not-allowed","transition-all duration-200","flex items-center justify-center"),children:v?(0,e.jsx)(D,{className:"w-6 h-6 animate-spin"}):(0,e.jsx)(B,{className:"w-6 h-6"})})]})})]})})]})}export{q 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.