PageSourceSearch

https://danielspears.vercel.app/_next/static/chunks/pages/spanishinterpreter-ff80a3c2bd5ac26a.js

js danielspears.vercel.app collected 2026-10-03 06:32:06 UTC 3,505 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2674],{4512:(e,s,a)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/spanishinterpreter",function(){return a(9546)}])},9546:(e,s,a)=>{"use strict";a.r(s),a.d(s,{default:()=>d});var t=a(7876),r=a(4232),n=a(38),i=a.n(n),l=a(4704),o=a(1895),c=a(6107);let d=()=>{let[e,s]=(0,r.useState)([]),[a,n]=(0,r.useState)(""),[d,m]=(0,r.useState)(!1),[h,u]=(0,r.useState)(!0),g=(0,r.useRef)(null),p=(0,r.useRef)(null);(0,r.useEffect)(()=>{"light"===localStorage.getItem("darkMode")?(u(!1),document.documentElement.classList.remove("dark-mode")):(u(!0),document.documentElement.classList.add("dark-mode"))},[]),(0,r.useEffect)(()=>{p.current&&p.current.scrollIntoView({behavior:"smooth"})},[e]);let x=async a=>{m(!0);let t=[...e,{role:"user",content:a}];s(t);try{let e=await fetch("/api/generate-spanish",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:t})});if(!e.ok)throw Error(`Failed to send message: ${e.status}`);let a=await e.text();s(e=>[...e,{role:"assistant",content:a}])}catch(e){console.error("Error sending message:",e),s(e=>[...e,{role:"assistant",content:"Sorry, there was an error."}])}finally{m(!1)}},j=e.reduceRight((e,s,a)=>-1===e&&"user"===s.role?a:e,-1);return(0,t.jsxs)("div",{className:`${i().themeContainer} ${h?i().darkMode:i().lightMode} ${i().transitionAll}`,children:[(0,t.jsx)(o.A,{children:(0,t.jsx)("title",{children:"Spanish Interpreter"})}),(0,t.jsx)(l.A,{}),(0,t.jsx)("button",{className:i().themeToggleFixed,onClick:()=>{let e=!h;u(e),localStorage.setItem("darkMode",e?"dark":"light"),e?document.documentElement.classList.add("dark-mode"):document.documentElement.classList.remove("dark-mode")},"aria-label":h?"Switch to light mode":"Switch to dark mode",children:h?"Light":"Dark"}),(0,t.jsxs)("section",{className:i().hero,children:[(0,t.jsx)("p",{className:i().kicker,children:"Translation"}),(0,t.jsx)("h1",{className:i().title,children:"Spanish Interpreter"}),(0,t.jsx)("p",{className:i().subtitle,children:"Translate to Spanish and back — try elpais.com/america/"})]}),(0,t.jsxs)("div",{className:i().chat1container,children:[(0,t.jsxs)("div",{className:i().message1List,ref:g,children:[e.map((s,a)=>(0,t.jsxs)("div",{className:`${i().message1} ${"user"===s.role?i().user:i().assistant} ${a===j&&d?i().userGradient:""}`,children:[(0,t.jsx)("div",{className:i().avatar,children:"user"===s.role?(0,t.jsx)("img",{src:"/you.png",alt:"User Avatar",className:i().avatarImage}):(0,t.jsx)("img",{src:"/avrob.gif",alt:"Translator Avatar",className:i().avatarImage})}),(0,t.jsxs)("div",{className:i().messageContent,children:[s.content,a===e.length-1&&(0,t.jsx)("div",{ref:p})]})]},a)),d&&(0,t.jsxs)("div",{className:i().typingIndicator,children:[(0,t.jsx)("div",{className:i().typingDot}),(0,t.jsx)("div",{className:i().typingDot}),(0,t.jsx)("div",{className:i().typingDot})]})]}),(0,t.jsx)("div",{className:i().message1FormContainer,children:(0,t.jsx)("form",{onSubmit:e=>{e.preventDefault(),a.trim()&&(x(a),n(""))},className:i().message1Form,children:(0,t.jsxs)("div",{className:i().inputContainer1,children:[(0,t.jsx)("input",{type:"text",value:a,onChange:e=>n(e.target.value),placeholder:"Type in English or Spanish…",className:i().message1FormInput,disabled:d}),(0,t.jsx)("button",{type:"submit",className:i().sendButton,disabled:d||!a.trim(),children:d?"Sending...":"Send"})]})})})]}),(0,t.jsx)(c.default,{})]})}}},e=>{e.O(0,[5695,1737,636,6593,8792],()=>e(e.s=4512)),_N_E=e.O()}]);

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.