PageSourceSearch

https://alex.study/_app/immutable/nodes/13.AVojFuaB.js

js alex.study collected 2026-10-02 02:09:56 UTC 3,075 bytes, 1 lines download raw bytes

1import"../chunks/DdzqiOd3.js";import{p as R,e as O,f as S,d as n,t as D,g as a,h as I,b as _,c as Y,i as y,s as b,r as i}from"../chunks/DBEM9BYQ.js";import{s as k}from"../chunks/BlzBSWvw.js";import{i as $}from"../chunks/CUm3oPxc.js";import{e as q,i as B}from"../chunks/DEnSLci4.js";import{r as H}from"../chunks/selx_ane.js";import{c as J,s as K}from"../chunks/Dh1KWED9.js";import{d as L,e as P}from"../chunks/CHNrY4uO.js";import{b as U}from"../chunks/DY3u0D9H.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};r.SENTRY_RELEASE={id:"a6e0e66fc41ae73869b88ce81a80e68a0784d769"}}catch{}})();try{(function(){var r=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},d=new r.Error().stack;d&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[d]="ae99fecd-089f-4078-95e6-721c8e65d18a",r._sentryDebugIdIdentifier="sentry-dbid-ae99fecd-089f-4078-95e6-721c8e65d18a")})()}catch{}var W=S('<p class="text-sm text-muted-foreground">Try asking: <code>Hi! What is CARS on the MCAT?</code></p>'),z=S('<div><strong class="mb-1 block text-xs uppercase tracking-wide"> </strong> </div>'),F=S('<div class="mx-auto flex h-[80vh] max-w-3xl flex-col gap-4 roun
1ded-lg border p-4"><div class="flex-1 space-y-2 overflow-y-auto"><!> <!></div> <form class="flex gap-2"><input class="flex-1 rounded-md border px-3 py-2 text-sm" placeholder="Ask a question about your MCAT or study plan..."/> <button type="submit" class="rounded-md border px-4 py-2 text-sm font-medium disabled:opacity-50"> </button></form></div>');function oe(r,d){R(d,!0);let g=O([]),l=I(""),f=I(!1);function c(e,t){g.push({role:e,content:t})}async function T(){const e=a(l).trim();if(!(!e||a(f))){c("user",e),y(l,""),y(f,!0);try{const t=await fetch("/api/chat",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({message:e})});if(!t.ok){let m="Sorry, something went wrong.";try{const s=await t.json();s!=null&&s.error&&(m=`Error: ${s.error}`)}catch{}c("assistant",m);return}const o=await t.json(),p=o.reply&&o.reply.trim().length>0?o.reply:"[No reply]";c("assistant",p)}catch(t){console.error("Chat UI error",t),c("assistant","Network error while talking to the chatbot.")}finally{y(f,!1)}}}function A(e){e.preventDefault(),T()}var v=F(),h=n(v),E=n(h);{var j=e=>{var t=W();_(e,t)};$(E,e=>{g.length===0&&e(j)})}var C=b(E,2);q(C,17,()=>g,B,(e,t)=>{var o=z(),p=n(o),m=n(p,!0);i(p);var s=b(p);i(o),D(N=>{K(o,1,N),k(m,a(t).role==="user"?"You":"Bot"),k(s,` ${a(t).content??""}`)},[()=>J(["max-w-[80%] whitespace-pre-wrap rounded-md px-3 py-2 text-sm",a(t).role==="user"?"self-end bg-muted":"",a(t).role==="assistant"?"bg-primary/10":""].join(" "))]),_(e,o)}),i(h);var x=b(h,2),u=n(x);H(u),u.__keydown=e=>{e.key==="Enter"&&!e.shiftKey&&(e.preventDefault(),T())};var w=b(u,2),M=n(w,!0);i(w),i(x),i(v),D(e=>{w.disabled=e,k(M,a(f)?"Sending…":"Send")},[()=>a(f)||!a(l).trim()]),P("submit",x,A),U(u,()=>a(l),e=>y(l,e)),_(r,v),Y()}L(["keydown"]);export{oe as component};

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.