PageSourceSearch

https://trains.fyi/_next/static/chunks/pages/merch/[handle]-bebc869544fca8b8.js

js trains.fyi collected 2026-10-01 12:16:37 UTC 3,847 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9186],{41005:(e,a,l)=>{"use strict";l.r(a),l.d(a,{__N_SSG:()=>u,default:()=>x});var t=l(37876),r=l(89099),s=l(14232),i=l(49915),d=l(96972),n=l(81946),c=l(73865),m=l(75458);function o({product:e}){let a,l,{t:r}=(0,c.B)(),{addItem:d}=(0,n.v)(),[m,u]=(0,s.useState)(e.variants[0]?.id),[x,h]=(0,s.useState)(e.image?.url),[g,b]=(0,s.useState)(1),[p,v]=(0,s.useState)(!1),f=e.variants.find(e=>e.id===m)??e.variants[0],N=e.options.some(e=>"Title"!==e.name),j=x||f?.image?.url||e.image?.url,y=e.images.length>0?e.images:[e.image].filter(Boolean);return(0,t.jsxs)("div",{className:"mx-auto max-w-7xl px-6 lg:px-8 py-10",children:[(0,t.jsx)("div",{className:"mb-6",children:(0,t.jsx)(i.A,{pages:[{name:r("merchNavLabel"),href:"/merch"},{name:e.title,href:`/merch/${e.handle}`,current:!0}]})}),(0,t.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-10",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"aspect-square bg-gray-50 rounded-lg overflow-hidden",children:j&&(0,t.jsx)("img",{src:j,alt:e.title,className:"h-full w-full object-cover object-center"})}),y.length>1&&(0,t.jsx)("div",{className:"mt-3 grid grid-cols-5 gap-2",children:y.map(a=>(0,t.jsx)("button",{onClick:()=>h(a.url),className:`aspect-square rounded-md overflow-hidden border-2 ${j===a.url?"border-blue-600":"border-transparent"}`,children:(0,t.jsx)("img",{src:a.url,alt:a.altText||e.title,className:"h-full w-full object-cover"})},a.url))})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h1",{className:"text-2xl font-bold text-gray-900",children:e.title}),(0,t.jsx)("p",{className:"mt-2 text-xl font-semibold text-gray-900",children:f?(a=f.price.amount,l=f.price.currencyCode,new Intl.NumberFormat("en-US",{style:"currency",currency:l||"USD"}).format(Number(a))):""}),N&&(0,t.jsx)("div",{className:"mt-6 flex flex-wrap gap-2",children:e.variants.map(e=>(0,t.jsx)("button",{onClick:()=>u(e.id),disabled:!e.availableForSale,className:`rounded-md border px-3 py-1.5 text-sm font-medium ${e.id===m?"border-blue-600 bg-blue-50 text-blue-700":"border-gray-300 text-gray-700 hover:bg-gray-50"} ${!e.availableForSale?"opacity-40 cursor-not-allowed":""}`,children:e.title},e.id))}),(0,t.jsxs)("div",{className:"mt-6 flex items-center gap-3",children:[(0,t.jsx)("label",{className:"text-sm text-gray-700",children:r("merchQuantity")}),(0,t.jsx)("input",{type:"number",min:"1",value:g,onChange:e=>b(Math.max(1,Number(e.target.value))),className:"w-20 rounded-md border-gray-300 text-sm"})]}),(0,t.jsx)("button",{onClick:()=>{f?.availableForSale&&(d(f.id,g,{title:e.title,variantTitle:f.title,price:f.price,image:f.image||e.image}),v(!0),setTimeout(()=>v(!1),1500))},disabled:!f?.availableForSale,className:"mt-4 w-full sm:w-auto rounded-md bg-blue-800 px-6 py-2.5 text-sm font-medium text-white hover:bg-blue-700 disabled:cursor-not-allowed disabled:bg-gray-300",children:r(f?.availableForSale?p?"merchAdded":"merchAddToCart":"merchOutOfStock")}),e.descriptionHtml&&(0,t.jsx)("div",{className:"prose prose-sm mt-8 max-w-none text-gray-600",dangerouslySetInnerHTML:{__html:e.descriptionHtml}})]})]})]})}var u=!0;function x({product:e}){let a=(0,r.useRouter)(),{t:l}=(0,c.B)(),{product:s}=(0,m.MO)(a.query.handle,{fallbackData:e});return a.isFallback||!s?(0,t.jsx)(d.A,{children:(0,t.jsx)("div",{className:"mx-auto max-w-7xl px-6 lg:px-8 py-10",children:(0,t.jsx)("p",{className:"text-sm text-gray-500",children:l("merchLoading")})})}):(0,t.jsx)(d.A,{head:{title:s.title,description:`${s.title} — official trains.fyi merch.`,canonical:`/merch/${s.handle}/`,image:s.image?.url},children:(0,t.jsx)(o,{product:s})})}},60548:(e,a,l)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/merch/[handle]",function(){return l(41005)}])}},e=>{e.O(0,[6701,3927,2325,3990,8447,5392,5225,636,6593,8792],()=>e(e.s=60548)),_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.