1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Box3DViewer-C6P2Y2ew.js","assets/query-Dyum9OBd.js","assets/OrbitControls-RG_F9kw9.js","assets/index-CxMXDIdf.js","assets/react-vendor-jEa6xgcc.js","assets/supabase-DZohnnlO.js","assets/motion-Bl2iohUo.js","assets/index-BizZuj4d.css"])))=>i.map(i=>d[i]); 2import{j as e,a as j,c as $e,e as K,u as P,b as U}from"./query-Dyum9OBd.js";import{c as re,E as Ze,b as se,P as te,B as $,Z as Te,d as et,e as z,u as Ie,U as tt,M as st,C as Ve,f as Ke,S as at,g as ae,X as rt,h as it,D as nt,i as lt,j as ot,k as ct,l as dt,_ as xt,m as ke,n as ht,o as mt,q as De,r as ut,t as pt,v as gt}from"./index-CxMXDIdf.js";import{d as ft,a as bt,c as yt,l as jt,f as Oe,b as ze}from"./userContent-HKWqj0Yj.js";import{f as vt}from"./threeDModels-CSF6CjnX.js";import{L as A,c as wt,f as Nt,u as _t,b as kt}from"./react-vendor-jEa6xgcc.js";import{S as B}from"./skeleton-Di3h_CYL.js";import{B as Y}from"./badge-CWUZIYDq.js";import{S as he}from"./star-B9HUsdAk.js";import{C as Ct}from"./calendar-dbnj5kij.js";import{W as St}from"./wrench-D2BRw7RC.js";import{B as Mt}from"./building-2-BMkbFj1J.js";import{G as $t}from"./globe-DfqBv26q.js";import{E as me}from"./external-link-DDFDg_NV.js";import{M as He}from"./monitor-BD7NW0Ny.js";import{C as ue}from"./chevron-right-CIe66FoS.js";import{C as pe}from"./chevron-left-CehEQ-Me.js";import{I as E}from"./input-BUlNWmcE.js";import{T as We}from"./textarea-CDMyZiYM.js";import{t as V}from"./index-C7Ob4i71.js";import{T as Se}from"./trash-2-CBpuVBjc.js";import{f as Tt}from"./date-fns-DeaJA9Aq.js";import{h as It}from"./he-COcm4ofe.js";import{S as Lt}from"./SeriesGames-_yzfrAvg.js";import{S as Ft}from"./send-D73NTkDG.js";import{H as Pt,g as qt}from"./anonId-DM3nj5Jk.js";import{U as Et}from"./users-D7JdXhjN.js";import{S as Gt}from"./SocialShare-CvlCwoF6.js";import{A as Dt}from"./arrow-right-CwG7hzma.js";import{P as Ot}from"./plus-By02oY97.js";import{P as zt}from"./pencil-B9b4uFvS.js";import{F as At}from"./filter-CBthGBGw.js";import{G as Ut}from"./grid-3x3-LUFZFA4q.js";import{D as Bt}from"./download-DnMWkQwy.js";import{m as Ce,A as xe}from"./motion-Bl2iohUo.js";import{I as Vt}from"./ImageLightbox-CqNhLB3u.js";import{L as M}from"./label-0Kuw_Wfv.js";import{S as J,a as X,b as Z,c as ee,d as S}from"./select-DgzPcgPi.js";import"./supabase-DZohnnlO.js";import"./dropdown-menu-B7bv04Tv.js";import"./index-q-EWB8h4.js";import"./index-CZ3Z0fZL.js";import"./index-Dlvcw1Gf.js";import"./index-BF6_wFRj.js";import"./check-CFI9Sele.js";import"./circle-_OTRu2cP.js";import"./facebook-CbSL9OOI.js";import"./copy-CyQ2qkd5.js";import"./minimize-CWNr6IWK.js";import"./index-DunXhOpl.js";/** 3 * @license lucide-react v0.475.0 - ISC 4 * 5 * This source code is licensed under the ISC license. 6 * See the LICENSE file in the root directory of this source tree. 7 */const Kt=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],Ht=re("ArrowUpDown",Kt);/** 8 * @license lucide-react v0.475.0 - ISC 9 * 10 * This source code is licensed under the ISC license. 11 * See the LICENSE file in the root directory of this source tree. 12 */const Wt=[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]],Qt=re("List",Wt);/** 13 * @license lucide-react v0.475.0 - ISC 14 * 15 * This source code is licensed under the ISC license. 16 * See the LICENSE file in the root directory of this source tree. 17 */const Yt=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],Rt=re("MapPin",Yt);/** 18 * @license lucide-react v0.475.0 - ISC 19 * 20 * This source code is licensed under the ISC license. 21 * See the LICENSE file in the root directory of this source tree. 22 */const Jt=[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}],["circle",{cx:"19",cy:"21",r:"1",key:"13723u"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",ke
22y:"9zh506"}]],Me=re("ShoppingCart",Jt);/** 23 * @license lucide-react v0.475.0 - ISC 24 * 25 * This source code is licensed under the ISC license. 26 * See the LICENSE file in the root directory of this source tree. 27 */const Xt=[["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",key:"wrbu53"}],["path",{d:"M15 18H9",key:"1lyqi6"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14",key:"lysw3i"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}]],Zt=re("Truck",Xt);function es({game:t,settings:r}){var f,_,T,C,G,N,q;const i=parseInt(((f=r.find(l=>l.key==="global_game_background_opacity"))==null?void 0:f.value)||"92"),s=(t==null?void 0:t.background_opacity)??i,a=((_=r.find(l=>l.key==="crt_effect_enabled"))==null?void 0:_.value)!=="false",c=parseInt(((T=r.find(l=>l.key==="crt_effect_intensity"))==null?void 0:T.value)||"50"),x=parseInt(((C=r.find(l=>l.key==="scanlines_intensity"))==null?void 0:C.value)||"25")/100,o=parseInt(((G=r.find(l=>l.key==="pixel_grid_intensity"))==null?void 0:G.value)||"4")/100,u=parseInt(((N=r.find(l=>l.key==="vignette_radial_intensity"))==null?void 0:N.value)||"60")/100,h=parseInt(((q=r.find(l=>l.key==="vignette_sides_intensity"))==null?void 0:q.value)||"50")/100,m=(t==null?void 0:t.scanlines_intensity)!==void 0&&(t==null?void 0:t.scanlines_intensity)!==null?t.scanlines_intensity/100:x,d=(t==null?void 0:t.pixel_grid_intensity)!==void 0&&(t==null?void 0:t.pixel_grid_intensity)!==null?t.pixel_grid_intensity/100:o,g=(t==null?void 0:t.vignette_radial_intensity)!==void 0&&(t==null?void 0:t.vignette_radial_intensity)!==null?t.vignette_radial_intensity/100:u,b=(t==null?void 0:t.vignette_sides_intensity)!==void 0&&(t==null?void 0:t.vignette_sides_intensity)!==null?t.vignette_sides_intensity/100:h,w=Math.min(1,c/100),n=c/100,v=(t==null?void 0:t.background_blur)??0;return e.jsxs("div",{className:"fixed inset-0 z-0",style:{backgroundImage:t!=null&&t.background_image?`url(${t.background_image})`:"url('https://yliswenkhoesjvgnlmts.supabase.co/storage/v1/object/public/site-assets/grunge-wall-texture.jpg')",backgroundSize:"cover",backgroundPosition:"center",backgroundRepeat:"no-repeat",backgroundAttachment:"fixed",imageRendering:"auto",filter:v>0?`blur(${v}px)`:"none"},children:[e.jsx("div",{className:"absolute inset-0 bg-[#1a1a1a]",style:{opacity:s/100}}),a&&e.jsxs("div",{className:"absolute inset-0 pointer-events-none",style:{opacity:w},children:[e.jsx("div",{className:"absolute inset-0",style:{backgroundImage:`repeating-linear-gradient(0deg, rgba(0,0,0,${m*n}) 0px, rgba(0,0,0,${m*n}) 3px, transparent 3px, transparent 6px)`,backgroundSize:"100% 6px"}}),e.jsx("div",{className:"absolute inset-0",style:{backgroundImage:`repeating-linear-gradient(90deg, rgba(255,0,0,${d*n}) 0px, rgba(255,0,0,${d*n}) 2px, rgba(0,255,0,${d*n}) 2px, rgba(0,255,0,${d*n}) 4px, rgba(0,0,255,${d*n}) 4px, rgba(0,0,255,${d*n}) 6px, transparent 6px, transparent 8px)`,backgroundSize:"8px 100%"}}),e.jsx("div",{className:"absolute inset-0",style:{background:` 28 radial-gradient(ellipse at center, transparent 0%, transparent 40%, rgba(0,0,0,${g*n}) 100%), 29 linear-gradient(90deg, rgba(0,0,0,${b*n}) 0%, transparent 15%, transparent 85%, rgba(0,0,0,${b*n}) 100%), 30 linear-gradient(0deg, rgba(0,0,0,${b*.6*n}) 0%, transparent 15%, transparent 85%, rgba(0,0,0,${b*.6*n}) 100%) 31 `,boxShadow:`inset 0 0 ${200*n}px rgba(0,0,0,${g*n})`}})]})]})}function ts({game:t,viewCount:r,averageUserRating:i,allRatings:s}){return e.jsxs("div",{className:"rounded-xl p-4 md:p-6 space-y-6",style:{backgroundColor:"rgba(0,0,0,0.6)",backdropFilter:"blur(12px)"},children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl sm:text-4xl md:text-5xl font-bold text-white",style:{textShadow:"3px 3px 6px rgba(0,0,0,1), -1px -1px 3px rgba(0,0,0,0.8), 0 0 15px rgba(0,0,0,0.9)"},children:t.title}),t.title_english&&t.title_english!==t.title&&e.jsx("p",{className:"text-base sm:text-lg text-gray-300 mt-1",style:{textShadow:"2px 2px 5px rgba(0,0,0,1), -1px -1px 2px rgba(0,0,0,0.8), 0 0 10px rgba(0,0,0,0.9)"},children:t.title_english})]}),r>0&&e.jsxs("div",{className:"flex items-center gap-2 bg-black/20 border border-gray-700/50 rounded-lg px-4 py-2 w-fit",children:[e.jsx(Ze,{className:"w-5 h-5 text-[#f5c518]"}),e.jsxs("span",{className:"text-gray-300 text-sm font-medium",children:[r.toLocaleStr
31ing("he-IL")," צפ××ת"]})]}),(t.rating||i)&&e.jsxs("div",{className:"space-y-3",children:[t.rating&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex items-center gap-1",children:Array.from({length:5},(a,c)=>e.jsx(he,{className:`w-5 h-5 ${c<Math.floor(t.rating)?"fill-[#f5c518] text-[#f5c518]":c<t.rating?"fill-[#f5c518]/20 text-[#f5c518]":"text-gray-600"}`},c))}),e.jsxs("span",{className:"text-gray-300 text-sm",children:[t.rating.toFixed(1),"/5",t.rating_source&&` ⢠${t.rating_source}`]})]}),i&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex items-center gap-1",children:Array.from({length:5},(a,c)=>e.jsx(he,{className:`w-5 h-5 ${c<Math.floor(i)?"fill-blue-500 text-blue-500":c<i?"fill-blue-500/20 text-blue-500":"text-gray-600"}`},c))}),e.jsxs("span",{className:"text-gray-300 text-sm",children:[i.toFixed(1),"/5 ⢠××ר×× ×שת×ש×× (",s.length,")"]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 md:flex md:flex-wrap gap-2 md:gap-3",children:[t.year&&e.jsx(A,{to:se("Games")+`?year=${t.year}`,className:"inline-block",children:e.jsxs(Y,{variant:"secondary",className:"text-[#f5c518] bg-black/30 border-none px-3 py-2 md:px-4 hover:bg-black/50 transition-colors cursor-pointer font-semibold whitespace-nowrap w-full md:w-auto justify-center",children:[e.jsx(Ct,{className:"w-3 h-3 md:w-4 md:h-4 ml-1 md:ml-2"}),e.jsx("span",{className:"text-xs md:text-sm",children:t.year})]})}),t.developer&&e.jsxs(Y,{variant:"secondary",className:"text-[#f5c518] bg-black/30 border-none px-3 py-2 md:px-4 font-semibold whitespace-nowrap w-full md:w-auto justify-center",title:"××¤×ª× ××ש××§",children:[e.jsx(St,{className:"w-3 h-3 md:w-4 md:h-4 ml-1 md:ml-2"}),e.jsx("span",{className:"text-xs md:text-sm truncate",children:t.developer})]}),t.publisher&&e.jsx(A,{to:se("Games")+`?publisher=${encodeURIComponent(t.publisher)}`,className:"inline-block",children:e.jsxs(Y,{variant:"secondary",className:"text-[#f5c518] bg-black/30 border-none px-3 py-2 md:px-4 hover:bg-black/50 transition-colors cursor-pointer font-semibold whitespace-nowrap w-full md:w-auto justify-center",children:[e.jsx(Mt,{className:"w-3 h-3 md:w-4 md:h-4 ml-1 md:ml-2"}),e.jsx("span",{className:"text-xs md:text-sm truncate",children:t.publisher})]})}),t.genre&&e.jsx(Y,{variant:"secondary",className:"text-[#f5c518] bg-black/30 border-none px-3 py-2 md:px-4 font-semibold whitespace-nowrap w-full md:w-auto justify-center",children:e.jsx("span",{className:"text-xs md:text-sm truncate",children:t.genre})})]}),(t.has_hebrew_translation||t.israeli_developed||t.image_source)&&e.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.has_hebrew_translation&&e.jsxs(Y,{className:"bg-gray-700/50 text-gray-300 border-gray-600 px-2 py-1 text-xs font-normal",children:[e.jsx($t,{className:"w-3 h-3 ml-1"}),"ת×ר×× ××¢×ר×ת"]}),t.israeli_developed&&e.jsxs(Y,{className:"bg-gray-700/50 text-gray-300 border-gray-600 px-2 py-1 text-xs font-normal",children:[e.jsx("span",{className:"ml-1",children:"ð®ð±"}),"פ×ת×× ×שר×××"]}),t.image_source&&e.jsxs(Y,{className:"bg-gray-700/50 text-gray-300 border-gray-600 px-2 py-1 text-xs font-normal",children:[e.jsx(me,{className:"w-3 h-3 ml-1"}),"ת××× ×ת ×-",t.image_source]})]}),t.online_play_url&&e.jsxs("div",{className:"hidden md:block",children:[e.jsxs("a",{href:t.online_play_url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 px-6 py-3 rounded-lg font-bold transition-all hover:scale-105 bg-[#f5c518] text-[#1a1a1a]",children:[e.jsx(Me,{className:"w-5 h-5"}),e.jsx("span",{children:"×§× × ×ת ××ש××§"}),e.jsx(me,{className:"w-4 h-4"})]}),e.jsxs("p",{className:"text-xs text-gray-400 mt-2",children:[t.online_play_url.includes("gog.com")&&"×××× ×-GOG.com",t.online_play_url.includes("steampowered.com")&&"×××× ×-Steam",!t.online_play_url.includes("gog.com")&&!t.online_play_url.includes("steampowered.com")&&"×§×ש×ר ×ר××ש×"]})]}),t.description&&e.jsxs("div",{className:"pt-4 border-t border-gray-700/50",children:[e.jsx("h3",{className:"font-semibold text-white mb-3",children:"××××ת ××ש××§"}),e.jsx("p",{className:"text-gray-300 leading-relaxed whitespace-pre-wrap break-words",children:t.description})]})]})}const de=20;
31function Qe({title:t,icon:r,images:i,onOpenLightbox:s}){const[a,c]=j.useState(0),x=Math.ceil(i.length/de),o=i.slice(a*de,(a+1)*de);return e.jsxs("div",{className:"bg-black/20 border border-gray-600 rounded-xl p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("h3",{className:"font-semibold text-white flex items-center gap-2 text-xl",children:[e.jsx(r,{className:"w-6 h-6 text-[#f5c518]"}),t," (",i.length," ת××× ×ת)"]}),x>1&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx($,{variant:"outline",size:"sm",onClick:()=>c(u=>Math.max(0,u-1)),disabled:a===0,children:e.jsx(ue,{className:"w-4 h-4"})}),e.jsxs("span",{className:"text-sm text-gray-400",children:[a+1," / ",x]}),e.jsx($,{variant:"outline",size:"sm",onClick:()=>c(u=>Math.min(x-1,u+1)),disabled:a===x-1,children:e.jsx(pe,{className:"w-4 h-4"})})]})]}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-4",children:o.map((u,h)=>{const m=a*de+h;return e.jsxs("button",{onClick:()=>s(i,m),className:"aspect-[3/4] rounded-lg overflow-hidden bg-[#252525] border border-gray-800 hover:border-[#f5c518] transition-colors group relative",children:[e.jsx("img",{src:u,alt:`ת××× × ${m+1}`,loading:"lazy",decoding:"async",fetchPriority:"low",className:"w-full h-full object-contain"}),e.jsx("div",{className:"absolute inset-0 bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity md:flex items-center justify-center hidden",children:e.jsx(Te,{className:"w-8 h-8 text-white"})})]},h)})})]})}function ss({images:t,gameTitle:r,onOpenLightbox:i}){return!t||t.length===0?null:e.jsx("div",{className:"mt-12",children:e.jsx(Qe,{title:"ת××× ×ת ×§×פס×",icon:te,images:t,onOpenLightbox:i})})}function as({images:t,onOpenLightbox:r}){const i=[...new Set(t||[])];return i.length===0?null:e.jsx("div",{className:"mt-12",children:e.jsx(Qe,{title:"×××× ×ש×× ×ת",icon:He,images:i,onOpenLightbox:r})})}function rs({game:t,contributors:r,gameSubmissions:i}){const s=t.contributor_name?e.jsxs("div",{className:"mt-12 bg-gradient-to-br from-[#f5c518]/10 to-[#f5c518]/5 rounded-xl p-6 border border-[#f5c518]/30",children:[e.jsxs("h2",{className:"text-xl font-bold text-white mb-4 flex items-center gap-2",children:[e.jsx("span",{children:"ð"}),"ת×××ת ××××××ת"]}),e.jsxs("div",{className:"flex items-start gap-3 bg-[#1a1a1a]/50 rounded-lg p-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-[#f5c518] flex items-center justify-center flex-shrink-0 text-[#1a1a1a] font-bold",children:t.contributor_name[0].toUpperCase()}),e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold text-[#f5c518]",children:t.contributor_name}),e.jsx("p",{className:"text-sm text-gray-400",children:"×ª×¨× ×ª××× ×ת ××ש××§ ××"})]})]})]}):null;if(r.length===0)return s;const a=new Map;r.forEach(x=>{a.has(x.user_email)||a.set(x.user_email,[]),a.get(x.user_email).push(x.contribution_type)});const c=Array.from(a.entries()).map(([x,o])=>{const u=i.find(m=>m.submitter_email===x||m.created_by===x);if(u&&u.wants_credit===!1)return null;let h;return(t.title==="Grand Theft Auto"||t.title_english==="Grand Theft Auto")&&(x==null?void 0:x.toLowerCase())==="[email protected]"?h="CableGuy":h=u==null?void 0:u.credit_name,h?e.jsxs("div",{className:"flex items-start gap-3 bg-[#1a1a1a]/50 rounded-lg p-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-[#f5c518] flex items-center justify-center flex-shrink-0 text-[#1a1a1a] font-bold",children:h[0].toUpperCase()}),e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold text-[#f5c518]",children:h}),e.jsxs("p",{className:"text-sm text-gray-400",children:[o.includes("game_added")&&"××ס××£ ×ת ××ש××§",o.includes("images_added")&&" ⢠××ס××£ ת××× ×ת",o.includes("manual_added")&&" ⢠××ס××£ ××ר××"]})]})]},x):null}).filter(Boolean);return c.length===0?s:e.jsxs(e.Fragment,{children:[s,e.jsxs("div",{className:"mt-12 bg-gradient-to-br from-[#f5c518]/10 to-[#f5c518]/5 rounded-xl p-6 border border-[#f5c518]/30",children:[e.jsxs("h2",{className:"text-xl font-bold text-white mb-4 flex items-center gap-2",children:[e.jsx("span",{children:"ð"}),"ת×××ת ××××××ת"]}),e.jsx("div",{className:"space-y-3",children:c})]})]})}function is({gameId:t,user:r,userRating:i,userReview:s}){const[a,c]=j.useState((i==null?void 0:i.rating)||(s==null?void 0:s.rating)||0),[x,o]=j.useState(0),[u,h]=j.useState((s==null?void 0:s.review_text)||""),[m,d]=j.useState(!1),[g,b]=j.useState(""),w=$e(),n=et(),v=K({mutationFn:async N=>
31z("/api/checkAndCreateRating",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gameId:t,rating:N,guestEmail:r?null:g||null,isUpdate:!!i,ratingId:i==null?void 0:i.id})}).then(q=>q.json()),onSuccess:()=>{w.invalidateQueries({queryKey:["userRating",t]}),w.invalidateQueries({queryKey:["ratings",t]}),V.success("ת××× ×©××ר×ת ×ת ××ש××§! ð")},onError:()=>{V.error("ש×××× ×ש××רת ×××ר××"),c((i==null?void 0:i.rating)||0)}}),f=K({mutationFn:async({rating:N,text:q})=>{if(!q||!q.trim())return null;const l=await z("/api/checkAndCreateReview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gameId:t,rating:N,reviewText:q,guestEmail:r?null:g||null,isUpdate:!!s,reviewId:s==null?void 0:s.id})}).then(R=>R.json());if(l!=null&&l.error)throw new Error(l.error);return l},onSuccess:N=>{w.invalidateQueries({queryKey:["userReview",t]}),w.invalidateQueries({queryKey:["reviews",t]}),w.invalidateQueries({queryKey:["ratings",t]}),(N==null?void 0:N.status)==="pending"?V.success("ת××× ×¢× ××××§×רת! ð¬ ××× × ×©××× ×××ש×ר ×ת×פ××¢ ×××ר ×××."):V.success("ת××× ×©×ת×ת ×××§×רת ×¢× ××ש××§! âï¸"),d(!1)},onError:N=>{V.error(N.message||"ש×××× ×ש××רת ××××§×רת")}}),_=K({mutationFn:async()=>s?ft(s.id):null,onSuccess:()=>{w.invalidateQueries({queryKey:["userReview",t]}),w.invalidateQueries({queryKey:["reviews",t]}),h(""),d(!1),V.success("××××§×רת × ×××§×")}}),T=K({mutationFn:async()=>i?bt(i.id):null,onSuccess:()=>{w.invalidateQueries({queryKey:["userRating",t]}),w.invalidateQueries({queryKey:["ratings",t]}),c(0),V.success("×××ר×× × ×××§")}}),C=N=>{if(a===N&&i){T.mutate();return}c(N),m||v.mutate(N)},G=()=>{if(a===0){V.error("× × ××××ר ××ר××");return}u.trim()?f.mutate({rating:a,text:u.trim()}):(v.mutate(a),d(!1))};return e.jsxs("div",{className:"bg-[#252525] rounded-xl p-6 border border-gray-800",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-xl font-semibold text-white",children:i||s?"×××ר×× ×××××§×רת ש××":"××¨× ×ש××§ ××"}),(i||s)&&e.jsxs($,{onClick:async()=>{await n({title:"×××××§ ×ת ×××ר×× ×××××§×רת ש××?",description:"×פע××× ××× × × ××ª× ×ª ××××××.",destructive:!0,confirmText:"×××§"})&&(s&&_.mutate(),i&&T.mutate())},variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:[e.jsx(Se,{className:"w-4 h-4 ml-1"}),"×××§"]})]}),e.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[e.jsx("div",{className:"flex gap-1",children:[1,2,3,4,5].map(N=>e.jsx("button",{onClick:()=>C(N),onMouseEnter:()=>o(N),onMouseLeave:()=>o(0),onTouchStart:()=>o(N),onTouchEnd:()=>o(0),className:"transition-transform active:scale-110 touch-manipulation",children:e.jsx(he,{className:`w-8 h-8 md:w-10 md:h-10 ${N<=(x||a)?"fill-[#f5c518] text-[#f5c518]":"text-gray-600"}`})},N))}),a>0&&e.jsxs("span",{className:"text-gray-400",children:[a===1&&"×ר××¢",a===2&&"×× ×××",a===3&&"×ס×ר",a===4&&"×××",a===5&&"××¢×××"]})]}),!m&&!s&&e.jsx($,{onClick:()=>d(!0),variant:"outline",className:"border-gray-600 bg-gray-200 text-gray-900 hover:bg-gray-300 hover:border-gray-500",children:"×ת×× ×××§×רת"}),(m||s)&&e.jsxs("div",{className:"space-y-4",children:[e.jsx(We,{value:u,onChange:N=>h(N.target.value),placeholder:"שתף ×ת ×××ת ××¢×ª× ×¢× ××ש××§ (××פצ××× ××)...",className:"bg-[#1a1a1a] border-gray-700 text-white min-h-[120px]"}),!r&&e.jsxs("div",{children:[e.jsx(E,{type:"email",value:g,onChange:N=>b(N.target.value),placeholder:"×××××× (××פצ××× ××, ××× ×©× ××× ××××ת ××ת×)",className:"bg-[#1a1a1a] border-gray-700 text-white",dir:"ltr"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"×××§×ר×ת ×©× ××ר××× ×פ×רס××ת ×××ר ××ש×ר ×× ×× ××תר."})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx($,{onClick:G,disabled:f.isPending,className:"bg-[#f5c518] text-[#1a1a1a] hover:bg-[#e0b015] disabled:opacity-50",children:f.isPending?"ש××ר...":s?"×¢××× ×××§×רת":"×¤×¨×¡× ×××§×רת"}),m&&!s&&e.jsx($,{onClick:()=>{d(!1),h("")},variant:"outline",className:"border-gray-600 text-gray-200 hover:bg-gray-700 hover:border-gray-500 hover:text-white",children:"×××××"}),s&&e.jsxs($,{onClick:async()=>{await n({title:"×××××§ ×ת ××××§×רת?",destructive:!0,confirmText:"×××§ ×××§×רת"})&&_.mutate()},variant:"outline",className:"border-red-500/50 text-red-300 hover:bg-red-500/10 hover:border-red-500 hover:text-red-200",disabled:_.isPending,children:[e.jsx(Se,{className:"w-4 h-4 ml-1"}),"×××§ ×××§×רת"]})]})]})]})}function ns({reviews:t}){const{user:r}=Ie();return!t||t.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx("p",{className:"text-gray-400 mb-3",children:"×¢×××× ××× ×××§×ר×ת ×××שר×ת ××ש××§ ××."}),e.jsx("p",{className:"text-sm text-gray-500",children:"×××§×ר×ת ××ש×ת ×××שר×ת ×¢× ××× ×× ×× ××תר ××¤× × ×פרס××. ×ר×× ×ת ××ש××§ ×××¢×× ××× ×××ס××£ ×××§×רת."})]}):e.jsx("div",{className:"space-y-6",children:t.map(i=>{var o;const s=!!i.guest_email,a=!s&&r&&i.created_by===r.email;let c,x=null;return s?c=i.guest_email:a?(c=r.username||r.full_name||((o=r.email)==null?void 0:o.split("@")[0])||"×שת×ש",x=r.profile_image):i.created_by?c=i.created_by.split("@")[0]:c="×שת×ש",e.jsxs("div",{className:"bg-[#252525] rounded-xl p-6 border border-gray-800",children:[e.jsxs("div",{className:"flex items-start justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-[#f5c518]/10 flex items-center justify-center overflow-hidden",children:x?e.jsx("img",{src:x,alt:c,className:"w-full h-full object-cover"}):e.jsx(tt,{className:"w-5 h-5 text-[#f5c518]"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"font-medium text-white flex items-center gap-2",children:[e.jsx("span",{children:c}),s&&e.jsx("span",{className:"text-xs text-gray-500",children:"(××ר×)"}),a&&(r==null?void 0:r.role)==="admin"&&e.jsx("span",{className:"inline-flex items-center gap-1 bg-red-500/20 text-red-400 text-xs font-bold px-2 py-0.5 rounded border border-red-500/30",children:"×××××"})]}),e.jsx("div",{className:"text-sm text-gray-400",children:Tt(new Date(i.created_date),"d MMMM yyyy",{locale:It})})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[[1,2,3,4,5].map(u=>e.jsx(he,{className:`w-4 h-4 ${u<=i.rating?"fill-[#f5c518] text-[#f5c518]":"text-gray-600"}`},u)),e.jsxs("span",{className:"text-white font-medium mr-2",children:[i.rating,"/5"]})]})]}),e.jsx("p",{className:"text-gray-300 leading-relaxed whitespace-pre-wrap",children:i.review_text})]},i.id)})})}function ls({hadIt:t,hadItCount:r,onToggle:i,isLoading:s}){return e.jsxs("div",{className:"flex flex-col items-center gap-3",children:[e.jsxs("button",{onClick:i,disabled:s,className:`relative overflow-hidden flex items-center gap-3 px-10 py-4 rounded-2xl text-xl font-black tracking-wide transition-all duration-500 ${t?"bg-gradient-to-l from-[#f5c518] via-[#ffd54f] to-[#f5c518] text-[#1a1a1a] shadow-[0_0_30px_rgba(245,197,24,0.4)] scale-110":"bg-[#2a2a2a] text-white border-2 border-[#f5c518]/30 hover:border-[#f5c518] hover:shadow-[0_0_20px_rgba(245,197,24,0.2)] hover:scale-105"}`,children:[t&&e.jsx("span",{className:"absolute inset-0 bg-gradient-to-l from-transparent via-white/20 to-transparent animate-pulse"}),e.jsx("span",{className:"text-2xl",children:t?"ð¦":"ð®"}),e.jsx("span",{className:"relative",children:"××× ××!"})]}),e.jsx("span",{className:"text-sm text-gray-400",children:r>0?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-[#f5c518] font-bold text-lg",children:r})," ",r===1?"×××ש":"×××ש××"," צ××× × ×©××× ××× ×ת ××ש××§ ×××"]}):"××× ×× ×ת ××ש××§ ×××? ××צ×!"})]})}const Ae=[{value:5,emoji:"ð¤©",label:"××¢×××"},{value:4,emoji:"ð",label:"×צ××××"},{value:3,emoji:"ð",label:"×××"},{value:2,emoji:"ð",label:"××× ×× ×"},{value:1,emoji:"ð´",label:"×שע××"}];function os({userRating:t,ratings:r,onRate:i}){const s=r.reduce((x,o)=>x+o,0);let a="",c=0;if(s>0){let x=0;r.forEach((u,h)=>{u>r[x]&&(x=h)});const o=Ae.find(u=>u.value===x+1);a=(o==null?void 0:o.label)||"",c=Math.round(r[x]/s*100)}return e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx("h4",{className:"text-base font-bold text-white",children:"××× ××× ××ש××§?"}),e.jsx("div",{className:"flex items-center gap-2",children:Ae.map(({value:x,emoji:o,label:u})=>e.jsx("button",{onClick:()=>i(x),title:u,className:`text-3xl p-2 rounded-xl transition-all duration-300 ${t===x?"bg-[#f5c518]/20 scale-130 ring-2 ring-[#f5c518] shadow-[0_0_12px_rgba(245,197,24,0.3)]":"hover:bg-white/10 hover:scale-125 opacity-60 hover:opacity-100"}`,children:o},x))}),s>0&&a&&e.jsxs("p",{className:"text-sm text-gray-400",children:[e.jsxs("span",{className:"text-[#f5c518] font-bold",children:[c,"%"]})," ×××ר×× ××ש××§ ",a,e.jsxs("span",{className:"text-gray-600",children:[" · ",s," ××ר××××"]})]})]})}function cs(t){const r=Date.now()-new Date(t).getTime(),i=Math.floor(r/6e4);if(i<1)return"×¢×ש××";if(i<60)return`××¤× × ${i} ××§×ת`;const s=Math.floor(i/60);if(s<24)return`××¤× × ${s} שע×ת`;const a=Math.floor(s/24);if(a<7)return`××¤× × ${a} ××××`;const c=Math.floor(a/7);return c<4?`××¤× × ${c} ש×××¢×ת`:`××¤× × ${Math.floor(a/30)} ×××ש××`}const Ue=["××××ר","ש××§×","×ספ×","× ×ס××××","ר×ר×","פ×קס×","×'××ס×××§","×§×× ×¡×××","×§×פס×","××סק×"],Be=["×¤× ××","ש××¢×","×× ×©××£","×רק××","×ת××","×××","× ×ר","×××","××¨× ×","× ×©×¨"];function ds(){try{let t=localStorage.getItem("hakufsa_nickname");if(!t){const r=Ue[Math.floor(Math.random()*Ue.length)],i=Be[Math.floor(Math.random()*Be.length)];t=`${r}-${i}${Math.floor(Math.random()*99)+1}`,localStorage.setItem("hakufsa_nickname",t)}return t}catch{return"×× ×× ×××"}}function xs({comments:t,onSubmit:r,onDelete:i,isSubmitting:s}){const[a,c]=j.useState(""),[x,o]=j.useState(ds),[u,h]=j.useState(!1),{user:m}=Ie(),d=(m==null?void 0:m.role)==="admin",g=n=>{if(n.preventDefault(),!!a.trim()){if(x&&!m)try{localStorage.setItem("hakufsa_nickname",x)}catch{}r(a.trim(),x.trim()||"×× ×× ×××"),c("")}},b=u?t:t.slice(0,5),w=t.length>5;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(st,{className:"w-4 h-4 text-[#f5c518]"}),e.jsx("h4",{className:"text-base font-bold text-white",children:"×××ר×× ×ת ×ס×פ×ר××"}),t.length>0&&e.jsxs("span",{className:"text-xs text-gray-500",children:["(",t.length,")"]})]}),e.jsxs("form",{onSubmit:g,className:"mb-5",children:[e.jsxs("div",{className:"flex gap-2 mb-2",children:[!m&&e.jsx("input",{value:x,onChange:n=>o(n.target.value),placeholder:"×©× (××פצ××× ××)",maxLength:30,className:"bg-[#252525] border border-gray-700 rounded-lg text-white text-sm px-3 py-2 w-28 outline-none focus:border-[#f5c518]/50"}),e.jsx("div",{className:"flex-1",children:e.jsx("textarea",{value:a,onChange:n=>c(n.target.value),placeholder:"×¡×¤×¨× ×¢× ××××ר×× ×©××× ×××ש××§... ×××¤× ×§× ×ת×? ×¢× ×× ×©××קת×? ×× ××ª× ×××ר××?",maxLength:500,rows:a.length>100?3:2,className:"w-full bg-[#252525] border border-gray-700 rounded-lg text-white text-sm px-3 py-2 outline-none focus:border-[#f5c518]/50 resize-none"})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[a.length>0&&e.jsxs("span",{className:"text-[11px] text-gray-600",children:[a.length,"/500"]}),e.jsxs("button",{type:"submit",disabled:!a.trim()||s,className:"mr-auto inline-flex items-center gap-1.5 px-4 py-1.5 bg-[#f5c518] text-[#1a1a1a] rounded-lg text-sm font-bold hover:bg-[#e0b015] disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:[e.jsx(Ft,{className:"w-3.5 h-3.5"}),s?"ש×××...":"שתף"]})]})]}),t.length>0&&e.jsxs("div",{className:"space-y-3",children:[b.map(n=>e.jsx("div",{className:"bg-[#252525] rounded-xl px-4 py-3 group",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-gray-700 flex items-center justify-center text-gray-400 text-sm font-bold flex-shrink-0 mt-0.5",children:(n.nickname||"×").charAt(0)}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"text-sm font-medium text-white",children:n.nickname||"×× ×× ×××"}),e.jsx("span",{className:"text-xs text-gray-600",children:cs(n.created_at)})]}),e.jsx("p",{className:"text-gray-300 text-sm leading-relaxed whitespace-pre-line",children:n.text})]}),d&&e.jsx("button",{onClick:()=>i(n.id),className:"text-gray-600 hover:text-red-400 transition-colors flex-shrink-0",children:e.jsx(Se,{className:"w-3.5 h-3.5"})})]})},n.id)),w&&e.jsx("button",{onClick:()=>h(!u),className:"flex items-center gap-1 text-sm text-[#f5c518] hover:underline mx-auto",children:u?e.jsxs(e.Fragment,{children:[e.jsx(Ve,{className:"w-4 h-4"})," ××¦× ×¤××ת"]}):e.jsxs(e.Fragment,{children:[e.jsx(Ke,{className:"w-4 h-4"})," ××¦× ×¢×× ",t.length-5," ×××ר×× ×ת"]})})]}),t.length===0&&e.jsx("p",{className:"text-center text-gray-600 text-sm py-4",children:"××× ×ר×ש×× ×× ×שתף ×××ר×× ×××ש××§ ×××!"})]})}function Ye(t){const r=$e(),i=qt(),s=["gameMemory",t],{data:a,isLoading:c}=P({queryKey:s,queryFn:async()=>{const h=new URLSearchParams({gameId:t});i&&h.set("anonymousId",i);const m=await fetch(`/api/gameMemory?${h}`);
31if(!m.ok)throw new Error("Failed to fetch");return m.json()},enabled:!!t,staleTime:1e3*60*5}),x=K({mutationFn:async h=>{if(!(await z("/api/gameMemory",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...h,gameId:t,anonymousId:i})})).ok)throw new Error("Failed")},onMutate:async h=>{await r.cancelQueries({queryKey:s});const m=r.getQueryData(s);return r.setQueryData(s,d=>{var b,w,n;if(!d)return d;const g={...d};if(h.hadIt!==void 0){const v=(b=d.userMemory)==null?void 0:b.had_it;g.hadItCount=d.hadItCount+(h.hadIt?1:0)-(v?1:0),g.userMemory={...d.userMemory||{},had_it:h.hadIt}}if(h.rating!==void 0){const v=(w=d.userMemory)==null?void 0:w.rating,f=[...d.ratings];v&&(f[v-1]=Math.max(0,f[v-1]-1)),f[h.rating-1]++,g.ratings=f,g.userMemory={...d.userMemory||{},rating:h.rating}}if(h.liked!==void 0){const v=(n=d.userMemory)==null?void 0:n.liked;g.likeCount=(d.likeCount||0)+(h.liked?1:0)-(v?1:0),g.userMemory={...d.userMemory||{},liked:h.liked}}return g}),{prev:m}},onError:(h,m,d)=>{d!=null&&d.prev&&r.setQueryData(s,d.prev)},onSettled:()=>{r.invalidateQueries({queryKey:s})}}),o=K({mutationFn:async({text:h,nickname:m})=>{const d=await z("/api/gameMemoryComment",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gameId:t,text:h,nickname:m,anonymousId:i})});if(!d.ok){const g=await d.json().catch(()=>({}));throw new Error(g.error||"Failed")}return d.json()},onSuccess:h=>{r.setQueryData(s,m=>m&&{...m,comments:[h.comment,...m.comments]})}}),u=K({mutationFn:async h=>{if(!(await z(`/api/gameMemoryComment?id=${h}`,{method:"DELETE"})).ok)throw new Error("Failed")},onSuccess:(h,m)=>{r.setQueryData(s,d=>d&&{...d,comments:d.comments.filter(g=>g.id!==m)})}});return{data:a,isLoading:c,memoryMutation:x,commentMutation:o,deleteMutation:u}}function hs({gameId:t}){var x,o;const{data:r,isLoading:i,memoryMutation:s}=Ye(t),a=j.useCallback(()=>{var h;const u=((h=r==null?void 0:r.userMemory)==null?void 0:h.had_it)||!1;s.mutate({hadIt:!u})},[r,s]),c=j.useCallback(u=>{s.mutate({rating:u})},[s]);return i||!r?null:e.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-l from-[#1a1500] via-[#1a1a1a] to-[#1a1500] border border-[#f5c518]/20 rounded-2xl px-8 py-8",children:[e.jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 w-96 h-32 bg-[#f5c518]/5 blur-3xl rounded-full"}),e.jsxs("div",{className:"relative flex flex-col items-center gap-6",children:[e.jsx(ls,{hadIt:((x=r.userMemory)==null?void 0:x.had_it)||!1,hadItCount:r.hadItCount,onToggle:a,isLoading:s.isPending}),r.likeCount>0&&e.jsxs("div",{className:"flex items-center gap-1.5 text-sm text-gray-400",children:[e.jsx(Pt,{className:"w-4 h-4 text-[#f5c518] fill-[#f5c518]"}),e.jsx("span",{className:"text-[#f5c518] font-bold",children:r.likeCount.toLocaleString("he-IL")}),"××××§××"]}),e.jsx("div",{className:"w-32 border-t border-[#f5c518]/20"}),e.jsx(os,{userRating:((o=r.userMemory)==null?void 0:o.rating)||null,ratings:r.ratings,onRate:c})]})]})}function ms({gameId:t}){const{data:r,isLoading:i,commentMutation:s,deleteMutation:a}=Ye(t),c=j.useCallback((o,u)=>{s.mutate({text:o,nickname:u})},[s]),x=j.useCallback(o=>{a.mutate(o)},[a]);return i||!r?null:e.jsxs("div",{className:"bg-gradient-to-b from-[#1a1a1a] to-[#1e1e1e] border border-gray-800 rounded-xl p-6",children:[e.jsxs("h3",{className:"text-lg font-bold text-[#f5c518] flex items-center gap-2 mb-4 sr-only",children:[e.jsx(at,{className:"w-5 h-5"}),"×××ר×× ×ת ×××§××××"]}),e.jsx(xs,{comments:r.comments,onSubmit:c,onDelete:x,isSubmitting:s.isPending})]})}function us({gameId:t,allGames:r}){const{data:i=[]}=P({queryKey:["alsoViewed",t],queryFn:async()=>{const a=await z("/api/getAlsoViewed",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({game_id:t})}).then(c=>c.json());return(a==null?void 0:a.game_ids)||[]},enabled:!!t,staleTime:18e5,gcTime:36e5,refetchOnWindowFocus:!1}),s=U.useMemo(()=>{if(!i.length||!r.length)return[];const a=new Map(r.map(c=>[c.id,c]));return i.map(c=>a.get(c)).filter(Boolean)},[i,r]);return s.length===0?null:e.jsxs("div",{className:"mt-12",children:[e.jsxs("h3",{className:"text-xl sm:text-2xl font-bold text-white mb-6 flex items-center gap-2",children:[e.jsx(Et,{className:"w-6 h-6 text-[#f5c518]"}),"×××ש×× ×©×¦×¤× ××ש××§ ××× ×¦×¤× ×× ×..."]}
31),e.jsx("div",{className:"grid grid-cols-3 sm:grid-cols-4 md:grid-cols-6 gap-3 sm:gap-4",children:s.map(a=>{var x,o;const c=((x=a.box_images)==null?void 0:x[0])||a.cover_image;return e.jsxs(A,{to:ae(a),className:"group",children:[e.jsxs("div",{className:"aspect-[3/4] rounded-lg overflow-hidden bg-[#252525] relative",children:[c?e.jsx("img",{src:c,alt:a.title,className:"w-full h-full object-contain group-hover:scale-105 transition-transform duration-300",loading:"lazy"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx("span",{className:"text-3xl font-bold text-gray-700",children:(o=a.title)==null?void 0:o[0]})}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/80 via-transparent to-transparent opacity-0 group-hover:opacity-100 transition-opacity"})]}),e.jsxs("div",{className:"mt-1.5",children:[e.jsx("p",{className:"text-xs sm:text-sm font-medium text-white group-hover:text-[#f5c518] transition-colors line-clamp-1",children:a.title||a.title_english}),e.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] sm:text-xs text-gray-400 mt-0.5",children:[a.year&&e.jsx("span",{children:a.year}),a.year&&a.genre&&e.jsx("span",{children:"·"}),a.genre&&e.jsx("span",{className:"truncate",children:a.genre})]})]})]},a.id)})})]})}function ps({game:t,gameId:r,urlParams:i,previousGame:s,nextGame:a,user:c,isInCollection:x,onOpenAddToCollection:o}){var u;return e.jsxs("div",{className:"mb-8 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs(A,{to:se("Games")+`?page=${i.get("fromPage")||"1"}`,className:"inline-flex items-center gap-2 px-4 py-2 bg-[#252525] border border-gray-700 rounded-lg text-white hover:border-[#f5c518] hover:text-[#f5c518] transition-colors",children:[e.jsx(Dt,{className:"w-5 h-5"}),e.jsx("span",{children:"×××¨× ×××ר××"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[s&&e.jsxs(A,{to:ae(s),className:"inline-flex items-center gap-2 px-4 py-2 bg-[#252525] border border-gray-700 rounded-lg text-white hover:border-[#f5c518] hover:text-[#f5c518] transition-colors max-w-[45%]",children:[e.jsx(ue,{className:"w-5 h-5 flex-shrink-0"}),e.jsxs("div",{className:"text-right min-w-0",children:[e.jsx("div",{className:"text-xs text-gray-400",children:"×ש××§ ×§×××"}),e.jsx("div",{className:"font-semibold text-sm truncate",children:s.title})]})]}),a&&e.jsxs(A,{to:ae(a),className:"inline-flex items-center gap-2 px-4 py-2 bg-[#252525] border border-gray-700 rounded-lg text-white hover:border-[#f5c518] hover:text-[#f5c518] transition-colors max-w-[45%]",children:[e.jsxs("div",{className:"text-left min-w-0",children:[e.jsx("div",{className:"text-xs text-gray-400",children:"×ש××§ ×××"}),e.jsx("div",{className:"font-semibold text-sm truncate",children:a.title})]}),e.jsx(pe,{className:"w-5 h-5 flex-shrink-0"})]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 w-full sm:w-auto",children:[e.jsx(Gt,{title:(t==null?void 0:t.title)||(t==null?void 0:t.title_english),description:(u=t==null?void 0:t.description)==null?void 0:u.substring(0,200),gameId:r,type:"game"}),c&&!x&&e.jsxs($,{onClick:o,size:"sm",className:"bg-green-600 text-white hover:bg-green-700 justify-center w-full sm:w-auto",children:[e.jsx(Ot,{className:"w-4 h-4 ml-2"}),"××סף ×××סף"]}),(c==null?void 0:c.role)==="admin"&&e.jsxs("a",{href:se("AdminGameEdit")+`?id=${r}`,className:"inline-flex items-center justify-center gap-2 bg-[#f5c518] text-[#1a1a1a] px-4 py-2 rounded-lg font-medium hover:bg-[#e0b015] transition-colors w-full sm:w-auto",children:[e.jsx(zt,{className:"w-4 h-4"}),e.jsx("span",{children:"ער××ת ×ש××§"})]})]})]})}const gs=(t,r)=>{const i=new Date().toLocaleDateString("he-IL");return`<!DOCTYPE html> 32<html lang="he" dir="rtl"> 33<head> 34 <meta charset="UTF-8"> 35 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 36 <title>ת×צ××ת eBay - ${r}</title> 37 <link href="https://fonts.googleapis.com/css2?family=Rubik:wght@400;500;600;700&display=swap" rel="stylesheet"> 38 <style> 39 * { box-sizing: border-box; margin: 0; padding: 0; } 40 body { 41 font-family: 'Rubik', sans-serif; 42 background: linear-gradient(135deg, #1a1a1a 0%, #0f0f0f 100%); 43 color: #f5f5f5; 44 min-height: 100vh; 45 padding: 40px 20px; 46 } 47 .container { max-width: 1200px; margin: 0 auto; } 48 .header { 49 text-align: center; 50 margin-bottom: 40px; 51 padding-bottom: 30px; 52 border-bottom: 2px solid #f5c518; 53 } 54 .header h1 { 55 font-size: 2.5rem; 56 color: #f5c518; 57 margin-bottom: 10px; 58 text-shadow: 0 0 20px rgba(245, 197, 24, 0.3); 59 } 60 .header p { color: #a0a0a0; font-size: 0.9rem; } 61 .stats { 62 display: flex; 63 justify-content: center; 64 gap: 30px; 65 margin-top: 20px; 66 } 67 .stat { 68 background: rgba(245, 197, 24, 0.1); 69 border: 1px solid rgba(245, 197, 24, 0.3); 70 padding: 15px 25px; 71 border-radius: 10px; 72 } 73 .stat-value { font-size: 1.5rem; font-weight: 700; color: #f5c518; } 74 .stat-label { font-size: 0.8rem; color: #a0a0a0; } 75 .grid { 76 display: grid; 77 grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); 78 gap: 20px; 79 } 80 .card { 81 background: #252525; 82 border-radius: 12px; 83 overflow: hidden; 84 border: 1px solid #333; 85 transition: all 0.3s ease; 86 } 87 .card:hover { 88 border-color: #f5c518; 89 box-shadow: 0 10px 30px rgba(0,0,0,0.5); 90 transform: translateY(-5px); 91 } 92 .card-image { 93 width: 100%; 94 aspect-ratio: 1; 95 object-fit: contain; 96 background: #1a1a1a; 97 padding: 10px; 98 } 99 .card-content { padding: 15px; } 100 .card-title { 101 font-size: 0.95rem; 102 font-weight: 500; 103 color: #fff; 104 margin-bottom: 10px; 105 line-height: 1.4; 106 display: -webkit-box; 107 -webkit-line-clamp: 2; 108 -webkit-box-orient: vertical; 109 overflow: hidden; 110 } 111 .card-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; } 112 .badge { 113 font-size: 0.7rem; 114 padding: 4px 8px; 115 border-radius: 4px; 116 background: #1a1a1a; 117 color: #a0a0a0; 118 } 119 .badge-buy { background: rgba(59, 130, 246, 0.2); color: #60a5fa; } 120 .badge-shipping { background: rgba(34, 197, 94, 0.2); color: #4ade80; } 121 .card-meta { font-size: 0.75rem; color: #888; margin-bottom: 10px; } 122 .card-meta div { margin-bottom: 3px; } 123 .price-section { 124 border-top: 1px solid #333; 125 padding-top: 12px; 126 margin-top: 10px; 127 } 128 .price { 129 font-size: 1.3rem; 130 font-weight: 700; 131 color: #f5c518; 132 } 133 .shipping { font-size: 0.75rem; color: #888; margin-top: 5px; } 134 .total { 135 font-size: 1rem; 136 font-weight: 600; 137 color: #f5c518; 138 margin-top: 8px; 139 padding-top: 8px; 140 border-top: 1px dashed #444; 141 } 142 .card-link { 143 display: block; 144 text-align: center; 145 padding: 12px; 146 background: #f5c518; 147 color: #1a1a1a; 148 text-decoration: none; 149 font-weight: 600; 150 margin-top: 15px; 151 border-radius: 8px; 152 transition: background 0.3s; 153 } 154 .card-link:hover { background: #e0b015; } 155 .footer { 156 text-align: center; 157 margin-top: 50px; 158 padding-top: 30px; 159 border-top: 1px solid #333; 160 color: #666; 161 font-size: 0.8rem; 162 } 163 .footer a { color: #f5c518; text-decoration: none; } 164 @media print { 165 body { background: #fff; color: #000; } 166 .card { border: 1px solid #ddd; page-break-inside: avoid; } 167 .card-link { background: #ddd; color: #000; } 168 } 169 </style> 170</head> 171<body> 172 <div class="container"> 173 <header class="header"> 174 <h1>ð® ת×צ××ת ××פ×ש eBay</h1> 175 <p>××פ×ש: "${r}" ⢠ת×ר××: ${i}</p> 176 <div class="stats"> 177 <div class="stat"> 178 <div class="stat-value">${t.length}</div> 179 <div class="stat-label">ת×צ××ת</div> 180 </div> 181 <div class="stat"> 182 <div class="stat-value">${t.filter(s=>s.hasGlobalShipping).length}</div> 183 <div class="stat-label">×ש××× ×××××××</div> 184 </div> 185 <div class="stat"> 186 <div class="stat-value">$${t.length>0?Math.min(...t.map(s=>parseFloat(s.price)||9999)).toFixed(2):"0"}</div> 187 <div class="stat-label">××××ר ×× ×××</div> 188 </div> 189 </div> 190 </header> 191 <div class="grid"> 192 ${t.map(s=>` 193 <div class="card"> 194 ${s.imageUrl?`<img src="${s.imageUrl}" alt="${s.title}" class="card-image">`:""} 195 <div class="card-content"> 196 <h3 class="card-title">${s.title}</h3> 197 <div class="card-badges"> 198 ${s.condition?`<span class="badge">${s.condition}</span>`:""} 199 ${s.buyNowAvailable?'<span class="badge badge-buy">Buy It Now</span>':""} 200 ${s.hasGlobalShipping?'<span class="badge badge-shipping">â ×ש××× ×××××××</span>':""} 201 </div> 202 <div class="card-meta"> 203 ${s.location?`<div>ð ${s.location}</div>`:""} 204 ${s.seller?`<div>ð¤ ${s.seller}</div>`:""} 205 </div> 206 <div class="price-section"> 207 <div class="price">$${s.price||"N/A"}</div> 208 ${s.shippingCost!==null?`<div class="shipping">ð ×ש×××: $${s.shippingCost>0?s.shippingCost:"××× ×"}</div>`:""} 209 ${s.shippingCost&&s.shippingCost>0?`<div class="total">ס×"×: $${(parseFloat(s.price)+parseFloat(s.shippingCost)).toFixed(2)}</div>`:""} 210 </div> 211 <a href="${s.itemWebUrl}" target="_blank" class="card-link">×¦×¤× ×-eBay â</a> 212 </div> 213 </div> 214 `).join("")} 215 </div> 216 <footer class="footer"> 217 <p>× ×צר ×¢× ××× <a href="https://www.hakufsa.co.il" target="_blank">××§×פס×</a> - ×ר×××× ×ש××§× ×××©× ×שר×××</p> 218 <p>××××ר×× ×××××× ×ת עש×××× ×××©×ª× ×ת. ×ש ×××××§ ×-eBay ××¤× × ×¨××ש×.</p> 219 </footer> 220 </div> 221</body> 222</html>`},fs=(t,r)=>{const i=gs(t,r),s=new Blob([i],{type:"text/html;charset=utf-8"}),a=URL.createObjectURL(s),c=document.createElement("a");c.href=a,c.download=`ebay-results-${r.replace(/\s+/g,"-")}.html`,document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(a)};function bs({results:t,isLoading:r,error:i,query:s,sortOrder:a,onSortChange:c}){const[x,o]=U.useState("grid"),[u,h]=U.useState(!0);if(r)return e.jsx("div",{className:"space-y-4",children:Array(5).fill(0).map((d,g)=>e.jsxs("div",{className:"flex gap-4 bg-[#252525] rounded-lg p-4 border border-gray-800",children:[e.jsx(B,{className:"w-24 h-24 rounded bg-[#1a1a1a]"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx(B,{className:"h-5 w-3/4 bg-[#1a1a1a]"}),e.jsx(B,{className:"h-4 w-1/2 bg-[#1a1a1a]"}),e.jsx(B,{className:"h-4 w-1/4 bg-[#1a1a1a]"})]})]},g))});if(i)return e.jsx("div",{className:"bg-red-900/20 border border-red-800 rounded-lg p-6 text-center",children:e.jsxs("p",{className:"text-red-400",children:["ש×××× ×××פ×ש ×-eBay: ",i]})});if(!t||t.length===0)return e.jsxs("div",{className:"bg-[#252525] border border-gray-800 rounded-lg p-8 text-center",children:[e.jsx(te,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),e.jsxs("p",{className:"text-gray-400",children:['×× × ×צ×× ×ª×צ××ת ×¢××ר "',s,'"']})]});const m=u?t.filter(d=>d.hasGlobalShipping):t;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"bg-[#1a1a1a] rounded-lg p-3 border border-gray-800 space-y-3",children:[e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer w-full",children:[e.jsx("input",{type:"checkbox",checked:u,onChange:d=>h(d.target.checked),className:"w-4 h-4 rounded border-gray-600 bg-[#252525] text-[#f5c518] focus:ring-[#f5c518] focus:ring-offset-0"}),e.jsxs("span",{className:"text-sm text-gray-300 flex items-center gap-1",children:[e.jsx(At,{className:"w-3 h-3"}),"רק ×ש××× ×××××××"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-gray-400 hidden sm:flex",children:[e.jsx(Ht,{className:"w-4 h-4"}),e.jsx("span",{className:"text-sm whitespace-nowrap",children:"××××
222 ×פ×:"})]}),e.jsxs("div",{className:"flex gap-2 flex-1 overflow-x-auto pb-1",children:[e.jsx($,{variant:a==="BestMatch"?"default":"outline",size:"sm",onClick:()=>c("BestMatch"),className:`whitespace-nowrap ${a==="BestMatch"?"bg-[#f5c518] text-[#1a1a1a] hover:bg-[#e0b015]":"border-gray-700 text-gray-300 hover:bg-[#252525]"}`,children:"××× ××××××§"}),e.jsx($,{variant:a==="price"?"default":"outline",size:"sm",onClick:()=>c("price"),className:`whitespace-nowrap ${a==="price"?"bg-[#f5c518] text-[#1a1a1a] hover:bg-[#e0b015]":"border-gray-700 text-gray-300 hover:bg-[#252525]"}`,children:"××× ×××"}),e.jsx($,{variant:a==="newlyListed"?"default":"outline",size:"sm",onClick:()=>c("newlyListed"),className:`whitespace-nowrap ${a==="newlyListed"?"bg-[#f5c518] text-[#1a1a1a] hover:bg-[#e0b015]":"border-gray-700 text-gray-300 hover:bg-[#252525]"}`,children:"××× ××ש"})]})]}),e.jsxs("div",{className:"hidden md:flex gap-1 border-t border-gray-700 pt-3",children:[e.jsxs($,{variant:x==="grid"?"default":"outline",size:"sm",onClick:()=>o("grid"),className:x==="grid"?"bg-[#f5c518] text-[#1a1a1a] hover:bg-[#e0b015]":"border-gray-700 text-gray-300 hover:bg-[#252525]",children:[e.jsx(Ut,{className:"w-4 h-4 ml-2"}),e.jsx("span",{children:"רשת"})]}),e.jsxs($,{variant:x==="list"?"default":"outline",size:"sm",onClick:()=>o("list"),className:x==="list"?"bg-[#f5c518] text-[#1a1a1a] hover:bg-[#e0b015]":"border-gray-700 text-gray-300 hover:bg-[#252525]",children:[e.jsx(Qt,{className:"w-4 h-4 ml-2"}),e.jsx("span",{children:"רש×××"})]})]})]}),t&&t.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("p",{className:"text-sm text-gray-400",children:["×צ×× ",m.length," ×ת×× ",t.length," ת×צ××ת"]}),e.jsxs($,{variant:"outline",size:"sm",onClick:()=>fs(m,s),className:"border-gray-700 text-gray-300 hover:bg-[#252525] hover:text-[#f5c518]",children:[e.jsx(Bt,{className:"w-4 h-4 ml-2"}),"×××¦× ×-HTML"]})]}),e.jsx("p",{className:"text-xs text-yellow-400/80",children:"ð¡ ש×× ××: ×ש ×××××§ ××¢××× ×××צר ×-eBay ש××ש××§ ××× × ×©×× ××שר××"})]}),e.jsx("div",{className:x==="grid"?"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4":"space-y-4",children:m.map(d=>e.jsxs("a",{href:d.itemWebUrl,target:"_blank",rel:"noopener noreferrer",className:x==="grid"?"flex flex-col bg-[#252525] hover:bg-[#2a2a2a] rounded-lg p-4 border border-gray-800 hover:border-[#f5c518] transition-all group h-full":"flex flex-row gap-4 bg-[#252525] hover:bg-[#2a2a2a] rounded-lg p-4 border border-gray-800 hover:border-[#f5c518] transition-all group",children:[d.imageUrl?e.jsx("img",{src:d.imageUrl,alt:d.title,className:x==="grid"?"w-full aspect-square object-contain rounded mb-3 bg-[#1a1a1a]":"w-24 h-24 md:w-32 md:h-32 object-contain rounded bg-[#1a1a1a] flex-shrink-0",loading:"lazy"}):e.jsx("div",{className:x==="grid"?"w-full aspect-square bg-[#1a1a1a] rounded flex items-center justify-center mb-3":"w-24 h-24 md:w-32 md:h-32 bg-[#1a1a1a] rounded flex items-center justify-center flex-shrink-0",children:e.jsx(te,{className:"w-12 h-12 text-gray-600"})}),e.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[e.jsx("h3",{className:x==="grid"?"text-white font-medium line-clamp-2 group-hover:text-[#f5c518] transition-colors mb-2 text-sm":"text-white font-medium line-clamp-2 group-hover:text-[#f5c518] transition-colors mb-2",children:d.title}),e.jsxs("div",{className:"flex flex-wrap gap-1 mb-2",children:[d.condition&&e.jsx("span",{className:"text-xs px-2 py-0.5 bg-[#1a1a1a] text-gray-400 rounded",children:d.condition}),d.buyNowAvailable&&e.jsx("span",{className:"text-xs px-2 py-0.5 bg-blue-900/30 text-blue-400 rounded",children:"Buy It Now"})]}),e.jsxs("div",{className:"text-xs text-gray-400 space-y-1 mb-3",children:[d.location&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Rt,{className:"w-3 h-3"}),d.location]}),d.seller&&e.jsxs("div",{children:["×××ר: ",d.seller]}),d.hasGlobalShipping!==void 0&&e.jsx("div",{className:`flex items-center gap-1 font-semibold ${d.hasGlobalShipping?"text-green-400":"text-gray-400"}`,children:d.hasGlobalShipping?"â ×ש××× ×××××××":"×ש××× ××§××× ××××"})]}),e.jsx("div",{className:x==="grid"?"mt-auto":"md:mt-auto",children:d.price?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:x==="grid"?"text-base font-bold text-[#f5c518] mb-1":"text-lg md:text-xl font-bold text-[#f5c518] mb-1",children:["$",d.price]}),d.shippingCost!==null&&e.jsxs("div",{className:"text-xs text-gray-400 flex items-center gap-1",children:[e.jsx(Zt,{className:"w-3 h-3"}),"×ש×××: $",d.shippingCost>0?d.shippingCost:"××× ×"]}),d.shippingCost&&d.shippingCost>0&&e.jsxs("div",{className:"text-sm text-[#f5c518] font-semibold mt-1 border-t border-gray-700 pt-1",children:['ס×"×: $',(parseFloat(d.price)+parseFloat(d.shippingCost)).toFixed(2)]})]}):e.jsx("div",{className:"text-gray-500 text-sm",children:"×××ר ×× ××××"})}),x==="grid"&&e.jsxs("div",{className:"flex items-center gap-1 text-blue-400 text-xs mt-2",children:[e.jsx(me,{className:"w-3 h-3"}),e.jsx("span",{children:"×¦×¤× ×-eBay"})]})]}),x==="list"&&e.jsx("div",{className:"flex-shrink-0 self-center",children:e.jsx(me,{className:"w-5 h-5 text-gray-500 group-hover:text-[#f5c518] transition-colors"})})]},d.itemId))})]})}function ys({game:t}){const[r,i]=j.useState(!1),[s,a]=j.useState(!1),[c,x]=j.useState(null),[o,u]=j.useState(!1),[h,m]=j.useState(null),[d,g]=j.useState("newlyListed"),b=async(w="newlyListed")=>{a(!0),i(!0),u(!0),m(null);try{const n=t.title_english||t.title,v=t.year?` ${t.year}`:"",f=await z("/api/searchEbay",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:`${n}${v} pc big box`,sortOrder:w,limit:10})}).then(_=>_.json());f.success?(x(f.results),g(w)):m(f.error||"Failed to search eBay")}catch(n){m(n.message||"Failed to search eBay")}finally{u(!1)}};return e.jsx("div",{className:"mt-12",children:e.jsxs("div",{className:"bg-gradient-to-r from-blue-600/10 to-blue-600/5 border border-blue-600/30 rounded-xl p-4 sm:p-6 md:p-8",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4",children:[e.jsxs("button",{onClick:()=>r&&a(!s),disabled:!r,className:"flex items-start gap-4 text-right w-full hover:opacity-80 transition-opacity disabled:cursor-default disabled:hover:opacity-100",children:[e.jsx("div",{className:"w-12 h-12 bg-blue-600 rounded-lg flex items-center justify-center flex-shrink-0",children:e.jsx(Me,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"text-xl font-bold text-white",children:"×פש ×ת ××ש××§ ×-eBay"}),r&&(s?e.jsx(Ve,{className:"w-5 h-5 text-gray-400"}):e.jsx(Ke,{className:"w-5 h-5 text-gray-400"}))]}),e.jsxs("p",{className:"text-gray-300 text-sm mt-1",children:["××¦× ×צע×ת ×ר×××©× ×©× ",t.title," ××××ר×× ×ר××× ××¢×××"]})]})]}),e.jsxs($,{onClick:()=>b(),disabled:o,className:"bg-blue-600 text-white hover:bg-blue-700 px-4 py-4 md:px-6 md:py-6 text-sm md:text-base font-semibold flex-shrink-0 w-full sm:w-auto",size:"lg",children:[e.jsx(Me,{className:"w-5 h-5 ml-2"}),o?"××פש...":"×פש ×-eBay"]})]}),s&&r&&e.jsx("div",{className:"mt-6",children:e.jsx(bs,{results:c,isLoading:o,error:h,query:t.title_english||t.title,sortOrder:d,onSortChange:w=>b(w)})})]})})}function js({previousGame:t,nextGame:r}){return!t&&!r?null:e.jsxs("div",{className:"mt-12 flex items-center justify-center gap-4",children:[t&&e.jsxs(A,{to:ae(t),className:"inline-flex items-center gap-2 px-6 py-3 bg-[#252525] border border-gray-700 rounded-lg text-white hover:border-[#f5c518] hover:text-[#f5c518] transition-colors max-w-[45%]",children:[e.jsx(ue,{className:"w-5 h-5 flex-shrink-0"}),e.jsxs("div",{className:"text-right min-w-0",children:[e.jsx("div",{className:"text-xs text-gray-400",children:"×ש××§ ×§×××"}),e.jsx("div",{className:"font-semibold truncate",children:t.title})]})]}),r&&e.jsxs(A,{to:ae(r),className:"inline-flex items-center gap-2 px-6 py-3 bg-[#252525] border border-gray-700 rounded-lg text-white hover:border-[#f5c518] hover:text-[#f5c518] transition-colors max-w-[45%]",children:[e.jsxs("div",{className:"text-left min-w-0",children:[e.jsx("div",{className:"text-xs text-gray-400",children:"×ש××§ ×××"}),e.jsx("div",{className:"font-semibold truncate",children:r.title})]}),e.jsx(pe,{className:"w-5 h-5 flex-shrink-0"})]})]})}function vs({images:t,onClose:r,gameName:i}){const[s,a]=j.useState(0),[c,x]=j.useState(null),[o,u]=j.useState(0),[h,m]=j.useState(1),[d,g]=j.useState(null),[b,w]=j.useState(!1),[n,v]=j.useState(null),f=typeof window<"u"&&window.innerWidth<768,_=j.useRef(null),T=()=>{f?s+1<t.length&&(a(s+1),m(1)):s+2<t.length&&(a(s+2),m(1))},C=()=>{f?s>0&&(a(s-1),m(1)):s-2>=0&&(a(s-2),m(1))},G=()=>m(p=>Math.min(p+.5,3)),N=()=>m(p=>Math.max(p-.5,1)),q=p=>{var k,F;h<=1||(p.preventDefault(),w(!0),v({x:p.clientX,y:p.clientY,scrollLeft:((k=_.current)==null?void 0:k.scrollLeft)||0,scrollTop:((F=_.current)==null?void 0:F.scrollTop)||0}
222))},l=p=>{if(!b||!n||!_.current)return;p.preventDefault();const k=p.clientX-n.x,F=p.clientY-n.y;_.current.scrollLeft=n.scrollLeft-k,_.current.scrollTop=n.scrollTop-F},R=()=>{w(!1),v(null)},ie=p=>{const k=p[0].clientX-p[1].clientX,F=p[0].clientY-p[1].clientY;return Math.sqrt(k*k+F*F)},ge=p=>{if(p.touches.length===2){g(ie(p.touches));return}h>1||x({x:p.touches[0].clientX,y:p.touches[0].clientY})},fe=p=>{if(p.touches.length===2&&d){p.preventDefault();const L=ie(p.touches),D=L/d;m(oe=>Math.max(1,Math.min(3,oe*D))),g(L);return}if(!c||h>1)return;p.preventDefault();const F=p.touches[0].clientX-c.x;u(F)},H=p=>{if(g(null),!c||h>1)return;const k=p.changedTouches[0].clientX,F=p.changedTouches[0].clientY,L=c.x-k,D=Math.abs(c.y-F);Math.abs(L)>50&&Math.abs(L)>D&&(L>0?T():C()),u(0),x(null)},W=p=>{p.preventDefault(),p.deltaY<0?m(k=>Math.min(k+.25,3)):m(k=>Math.max(k-.25,1))};j.useEffect(()=>{const p=window.getComputedStyle(document.body).overflow,k=window.getComputedStyle(document.body).position;document.body.style.overflow="hidden",document.body.style.position="fixed",document.body.style.width="100%",document.body.style.top=`-${window.scrollY}px`;const F=L=>{L.key==="ArrowRight"?C():L.key==="ArrowLeft"?T():L.key==="+"||L.key==="="?G():L.key==="-"?N():L.key==="0"&&m(1)};return window.addEventListener("keydown",F),window.addEventListener("wheel",W,{passive:!1}),()=>{const L=document.body.style.top;document.body.style.overflow=p,document.body.style.position=k,document.body.style.width="",document.body.style.top="",window.scrollTo(0,parseInt(L||"0")*-1),window.removeEventListener("keydown",F),window.removeEventListener("wheel",W)}},[s,f]);const ne=t[s],le=f?null:t[s+1];return e.jsxs(Ce.div,{initial:{opacity:0}
222,animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50 bg-black/95 flex items-center justify-center",onClick:r,children:[e.jsx("button",{onClick:r,className:"absolute top-4 right-4 w-12 h-12 rounded-full bg-white/10 hover:bg-white/20 flex items-center justify-center transition-colors z-10",children:e.jsx(rt,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{className:"absolute top-4 left-4 flex gap-2 z-10",onClick:p=>p.stopPropagation(),children:[e.jsx("button",{onClick:G,className:"w-10 h-10 rounded-full bg-white/10 hover:bg-white/20 flex items-center justify-center transition-colors",children:e.jsx(Te,{className:"w-5 h-5 text-white"})}),e.jsx("button",{onClick:N,disabled:h<=1,className:"w-10 h-10 rounded-full bg-white/10 hover:bg-white/20 flex items-center justify-center transition-colors disabled:opacity-30",children:e.jsx(it,{className:"w-5 h-5 text-white"})}),h>1&&e.jsxs("button",{onClick:()=>m(1),className:"h-10 px-3 rounded-full bg-white/10 hover:bg-white/20 flex items-center justify-center transition-colors text-white text-xs font-bold",children:[Math.round(h*100),"%"]})]}),e.jsxs("div",{ref:_,className:`relative ${h>1?"overflow-auto":"overflow-hidden"}`,style:{maxWidth:"90vw",maxHeight:h>1?"85vh":f?"70vh":"80vh",touchAction:h>1?"pan-x pan-y":"none",cursor:h>1?b?"grabbing":"grab":"default",userSelect:"none"},onClick:p=>p.stopPropagation(),onTouchStart:ge,onTouchMove:fe,onTouchEnd:H,onMouseDown:q,onMouseMove:l,onMouseUp:R,onMouseLeave:R,children:[!f&&s>0&&e.jsx("button",{onClick:C,className:"absolute right-[-60px] top-1/2 -translate-y-1/2 w-12 h-12 rounded-full bg-white/10 hover:bg-white/20 flex items-center justify-center transition-colors z-10",children:e.jsx(ue,{className:"w-6 h-6 text-white"})}),e.jsx("div",{className:`flex ${f?"":"gap-1"} items-start justify-center`,style:{perspective:"2000px"},children:e.jsxs(xe,{mode:"wait",children:[ne&&e.jsxs(Ce.div,{initial:{x:100,opacity:0},animate:{x:o,opacity:1},exit:{x:-100,opacity:0},transition:{duration:o!==0?0:.3},className:`relative bg-white ${f?"rounded-lg":"rounded-l-lg"} shadow-2xl overflow-hidden`,style:{maxHeight:f?"80vh":"70vh",maxWidth:f?"95vw":"auto",transform:`scale(${h})`,transformOrigin:"center center"},children:[e.jsx("img",{src:ne,alt:`×¢××× ${s+1}`,className:"h-full w-full object-contain",style:{maxHeight:f?"80vh":"70vh"},loading:"lazy"}),e.jsxs("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 text-gray-600 text-sm font-medium bg-white/80 px-3 py-1 rounded",children:[s+1," / ",t.length]})]},`page-${s}`),!f&&le&&e.jsxs(Ce.div,{initial:{rotateY:20,opacity:0},animate:{rotateY:0,opacity:1},exit:{rotateY:-20,opacity:0},transition:{duration:.5},onClick:T,className:"relative bg-white rounded-r-lg shadow-2xl overflow-hidden cursor-pointer hover:brightness-95 transition-all",style:{maxHeight:"70vh",transformStyle:"preserve-3d",transform:`scale(${h})`,transformOrigin:"center center"},children:[e.jsx("img",{src:le,alt:`×¢××× ${s+2}`,className:"h-full w-auto object-contain",style:{maxHeight:"70vh"},loading:"lazy"}),e.jsx("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 text-gray-600 text-sm font-medium",children:s+2})]},`right-${s}`)]})}),!f&&s+2<t.length&&e.jsx("button",{onClick:T,className:"absolute left-[-60px] top-1/2 -translate-y-1/2 w-12 h-12 rounded-full bg-white/10 hover:bg-white/20 flex items-center justify-center transition-colors z-10",children:e.jsx(pe,{className:"w-6 h-6 text-white"})})]}),!f&&e.jsx("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 max-w-[90vw] overflow-x-auto",onClick:p=>p.stopPropagation(),children:e.jsx("div",{className:"flex gap-2 items-center bg-black/80 backdrop-blur-sm px-4 py-3 rounded-lg",children:Array.from({length:Math.ceil(t.length/2)},(p,k)=>k*2).map(p=>e.jsxs("button",{onClick:k=>{k.stopPropagation(),a(p),m(1)},className:`flex-shrink-0 relative group ${s===p?"ring-2 ring-[#f5c518]":"opacity-60 hover:opacity-100"}`,children:[e.jsxs("div",{className:"flex gap-0.5",children:[e.jsx("img",{src:t[p],alt:`×¢××× ${p+1}`,className:"h-16 w-auto object-cover rounded-r",loading:"lazy"}),t[p+1]&&e.jsx("img",{src:t[p+1],alt:`×¢××× ${p+2}`,className:"h-16 w-auto object-cover rounded-l",loading:"lazy"})]}),e.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/20 transition-colors rounded"}),e.jsxs("div",{className:"absolute -bottom-5 left-1/2 -translate-x-1/2 text-white text-xs opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap",children:[p+1,"-",Math.min(p+2,t.length)]})]},p))})}),!f&&e.jsxs("div",{className:"absolute top-20 left-1/2 -translate-x-1/2 text-white/60 text-sm text-center",children:[i&&e.jsxs("div",{className:"font-semibold text-white/80 mb-1",children:["××ר×× ××ש××§: ",i]}),"×××¥ ×¢× ××צ×× ×× ×שת×ש ×××§××ת (â/â) ×××¢×ר ××× ×¢××××× Â· ××××ת/+/- ××××"]}),f&&h===1&&e.jsx("div",{className:"absolute bottom-6 left-1/2 -translate-x-1/2 text-white/40 text-xs text-center",children:"צ×××× ×××× Â· ××××§ ××פ×××£"})]})}function ws({open:t,onOpenChange:r,game:i}){var w;const s=$e(),[a,c]=j.useState({}),[x,o]=j.useState(!1);j.useEffect(()=>{i&&t&&c({game_id:i.id,custom_title:i.title||i.title_english||"",custom_developer:i.developer||"",custom_publisher:i.publisher||"",custom_year:i.year||"",custom_platform:i.platform||"",custom_description:i.description||"",cover_image:i.cover_image||"",item_photos:[],included_items:"",condition:"",condition_details:[],region:"",box_status:"",manual_status:"",disk_status:"",acquisition_date:"",purchase_price:"",n
222otes:"",quantity:1,status:"×××סף",status_date:new Date().toISOString().split("T")[0],folder:""})},[i,t]);const u=K({mutationFn:n=>yt(n),onSuccess:()=>{s.invalidateQueries({queryKey:["myCollection"]}),s.invalidateQueries({queryKey:["userCollectionItems"]}),r(!1)},onError:n=>{alert("ש×××¨× × ×ש××: "+((n==null?void 0:n.message)||"ש×××× ×× ××××¢×"))}}),h=async n=>{const v=Array.from(n.target.files||[]);if(v.length!==0){o(!0);try{const f=[];for(const _ of v){const T=new FormData;T.append("file",_);const C=await z("/api/uploadImageAsWebp",{method:"POST",body:T}).then(G=>G.json());C.file_url&&f.push(C.file_url)}c(_=>({..._,item_photos:[..._.item_photos||[],...f]}))}catch{}finally{o(!1)}}},m=n=>{c(v=>({...v,item_photos:v.item_photos.filter((f,_)=>_!==n)}))},d=n=>{n.preventDefault(),u.mutate({...a,custom_year:a.custom_year?Number(a.custom_year):void 0,purchase_price:a.purchase_price?Number(a.purchase_price):void 0,acquisition_date:a.acquisition_date||void 0,status_date:a.status_date||void 0})},g=a,b=(n,v)=>c(f=>({...f,[n]:v}));return e.jsx(nt,{open:t,onOpenChange:r,children:e.jsxs(lt,{className:"bg-[#252525] border-gray-800 max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsx(ot,{children:e.jsx(ct,{className:"text-white",children:"××סף ×ש××§ ×××סף"})}),e.jsxs("form",{onSubmit:d,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(M,{className:"text-gray-300",children:"×©× ××ש××§ *"}),e.jsx(E,{value:g.custom_title||"",onChange:n=>b("custom_title",n.target.value),required:!0,className:"bg-[#1a1a1a] border-gray-700 text-white"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(M,{className:"text-gray-300",children:"×פת×"}),e.jsx(E,{value:g.custom_developer||"",onChange:n=>b("custom_developer",n.target.value),className:"bg-[#1a1a1a] border-gray-700 text-white"})]}),e.jsxs("div",{children:[e.jsx(M,{className:"text-gray-300",children:"×פ××¥"}),e.jsx(E,{value:g.custom_publisher||"",onChange:n=>b("custom_publisher",n.target.value),className:"bg-[#1a1a1a] border-gray-700 text-white"})]}),e.jsxs("div",{children:[e.jsx(M,{className:"text-gray-300",children:"×©× ×"}),e.jsx(E,{type:"number",value:g.custom_year||"",onChange:n=>b("custom_year",n.target.value),className:"bg-[#1a1a1a] border-gray-700 text-white"})]}),e.jsxs("div",{children:[e.jsx(M,{className:"text-gray-300",children:"פ××פ×ר××"}),e.jsx(E,{value:g.custom_platform||"",onChange:n=>b("custom_platform",n.target.value),className:"bg-[#1a1a1a] border-gray-700 text-white"})]})]}),e.jsxs("div",{children:[e.jsx(M,{className:"text-gray-300",children:"ת××× ×ת × ×ספ×ת ×©× ×פר××"}),e.jsx(E,{type:"file",accept:"image/*",multiple:!0,onChange:h,disabled:x,className:"bg-[#1a1a1a] border-gray-700 text-white"}),x&&e.jsx("p",{className:"text-sm text-gray-400 mt-1",children:"××¢×× ×ª××× ×ת..."}),((w=g.item_photos)==null?void 0:w.length)>0&&e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:g.item_photos.map((n,v)=>e.jsxs("div",{className:"relative",children:[e.jsx("img",{src:n,alt:`Photo ${v+1}`,className:"w-16 h-16 object-cover rounded"}),e.jsx("button",{type:"button",onClick:()=>m(v),className:"absolute -top-2 -right-2 bg-red-600 text-white rounded-full w-5 h-5 flex items-center justify-center text-xs hover:bg-red-700",children:"Ã"})]},v))})]}),e.jsxs("div",{children:[e.jsx(M,{className:"text-gray-300",children:"×× ×××× ×פר××"}),e.jsx(E,{value:g.included_items||"",onChange:n=>b("included_items",n.target.value),placeholder:"××××××: ×§××¤×¡× ××§×ר×ת, ××ר××, 3 ××סק×××",className:"bg-[#1a1a1a] border-gray-700 text-white"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(M,{className:"text-gray-300",children:"××¦× ××××"}),e.jsxs(J,{value:g.condition||"",onValueChange:n=>b("condition",n),children:[e.jsx(X,{className:"bg-[#1a1a1a] border-gray-700 text-white",children:e.jsx(Z,{placeholder:"××ר..."})}),e.jsxs(ee,{className:"bg-[#252525] border-gray-700",children:[e.jsx(S,{value:"××ש",children:"××ש"}),e.jsx(S,{value:"××× ××ש",children:"××× ××ש"}),e.jsx(S,{value:"×ש××ש",children:"×ש××ש"}),e.jsx(S,{value:"×סר ×××§××",children:"×סר ×××§××"}),e.jsx(S,{value:"פ×××",children:"פ×××"})]})]})]}),e.jsxs("div",{children:[e.jsx(M,{className:"text-gray-300",children:"×××ר"}),e.jsxs(J,{value:g.region||"",onValueChange:n=>b("region",n),children:[e.jsx(X,{className:"bg-[#1a1a1a] border-gray-700 text-white",children:e.jsx(Z,{placeholder:"××ר..."})}),e.jsxs(ee,{className:"bg-[#252525] border-gray-700",children:[e.jsx(S,{value:"PAL",children:"PAL"}),e.jsx(S,{value:"NTSC",children:"NTSC"}),e.jsx(S,{value:"×פ×",children:"×פ×"}),e.jsx(S,{value:"××ר",children:"××ר"})]})]})]}),e.jsxs("div",{children:[e.jsx(M,{className:"text-gray-300",children:"××¦× ×§×פס×"}),e.jsxs(J,{value:g.box_status||"",onValueChange:n=>b("box_status",n),children:[e.jsx(X,{className:"bg-[#1a1a1a] border-gray-700 text-white",children:e.jsx(Z,{placeholder:"××ר..."})}),e.jsxs(ee,{className:"bg-[#252525] border-gray-700",children:[e.jsx(S,{value:"ש×××",children:"ש×××"}),e.jsx(S,{value:"קר××¢×",children:"קר××¢×"}),e.jsx(S,{value:"×סר×",children:"×סר×"})]})]})]}),e.jsxs("div",{children:[e.jsx(M,{className:"text-gray-300",children:"××¦× ××ר××"}),e.jsxs(J,{value:g.manual_status||"",onValueChange:n=>b("manual_status",n),children:[e.jsx(X,{className:"bg-[#1a1a1a] border-gray-700 text-white",children:e.jsx(Z,{placeholder:"××ר..."})}),e.jsxs(ee,{className:"bg-[#252525] border-gray-700",children:[e.jsx(S,{value:"×§×××",children:"×§×××"}),e.jsx(S,{value:"×סר",children:"×סר"}),e.jsx(S,{value:"×××××××",children:"×××××××"}),e.jsx(S,{value:"×××",children:"×××"})]})]})]}),e.jsxs("div",{children:[e.jsx(M,{className:"text-gray-300",children:"××¦× ××××"}),e.jsxs(J,{value:g.disk_status||"",onValueChange:n=>b("disk_status",n),children:[e.jsx(X,{className:"bg-[#1a1a1a] border-gray-700 text-white",children:e.jsx(Z,{placeholder:"××ר..."})}),e.jsxs(ee,{className:"bg-[#252525] border-gray-700",children:[e.jsx(S,{value:"תק×× ×",children:"תק×× ×"}),e.jsx(S,{value:"שר×××",children:"שר×××"}),e.jsx(S,{value:"×סר×",children:"×סר×"}),e.jsx(S,{value:"×××",children:"×××"})]})]})]})]}),e.jsxs("div",{children:[e.jsx(M,{className:"text-gray-300",children:"פר×× ××¦× (××ר ××× ×©×¨×××× ××)"}),e.jsx("div",{className:"grid grid-cols-2 gap-2 mt-2",children:["×××
222 פ××××","××ת××××/שר×××××","××××§×ת","ת×××ת קר××¢×","שר×××ת","×× ×¢×××","×××× ×¨×××"].map(n=>{var v;return e.jsxs("label",{className:"flex items-center gap-2 text-sm text-gray-300",children:[e.jsx("input",{type:"checkbox",checked:(v=g.condition_details)==null?void 0:v.includes(n),onChange:f=>{const _=g.condition_details||[];b("condition_details",f.target.checked?[..._,n]:_.filter(T=>T!==n))},className:"w-4 h-4 rounded border-gray-600 bg-[#1a1a1a] text-[#f5c518]"}),n]},n)})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(M,{className:"text-gray-300",children:"×××ת"}),e.jsx(E,{type:"number",min:"1",value:g.quantity||1,onChange:n=>b("quantity",parseInt(n.target.value)||1),className:"bg-[#1a1a1a] border-gray-700 text-white"})]}),e.jsxs("div",{children:[e.jsx(M,{className:"text-gray-300",children:"ס×××ס"}),e.jsxs(J,{value:g.status||"×××סף",onValueChange:n=>{b("status",n),b("status_date",new Date().toISOString().split("T")[0])},children:[e.jsx(X,{className:"bg-[#1a1a1a] border-gray-700 text-white",children:e.jsx(Z,{})}),e.jsxs(ee,{className:"bg-[#252525] border-gray-700",children:[e.jsx(S,{value:"×××סף",children:"×××סף"}),e.jsx(S,{value:"××××ר×",children:"××××ר×"}),e.jsx(S,{value:"× ××ר",children:"× ××ר"}),e.jsx(S,{value:"×××¦× ××××סף",children:"×××¦× ××××סף"}),e.jsx(S,{value:"×××××£",children:"×××××£"})]})]})]})]}),e.jsxs("div",{children:[e.jsx(M,{className:"text-gray-300",children:"ת××§××× (××ר×××)"}),e.jsx(E,{value:g.folder||"",onChange:n=>b("folder",n.target.value),placeholder:"××××××: ×ש××§× PC, ×ש××§× ×××××...",className:"bg-[#1a1a1a] border-gray-700 text-white"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(M,{className:"text-gray-300",children:"ת×ר×× ×¨××ש×"}),e.jsx(E,{type:"date",value:g.acquisition_date||"",onChange:n=>b("acquisition_date",n.target.value),className:"bg-[#1a1a1a] border-gray-700 text-white"})]}),e.jsxs("div",{children:[e.jsx(M,{className:"text-gray-300",children:"×××ר ר×××©× (âª)"}),e.jsx(E,{type:"number",value:g.purchase_price||"",onChange:n=>b("purchase_price",n.target.value),className:"bg-[#1a1a1a] border-gray-700 text-white"})]})]}),e.jsxs("div",{children:[e.jsx(M,{className:"text-gray-300",children:"×ער×ת"}),e.jsx(We,{value:g.notes||"",onChange:n=>b("notes",n.target.value),className:"bg-[#1a1a1a] border-gray-700 text-white",rows:3})]}),e.jsxs(dt,{children:[e.jsx($,{type:"button",variant:"outline",onClick:()=>r(!1),className:"border-gray-700 text-white",children:"×××××"}),e.jsx($,{type:"submit",disabled:u.isPending,className:"bg-[#f5c518] text-[#1a1a1a] hover:bg-[#e0b015]",children:"××סף ×××סף"})]})]})]})})}const Ns=j.lazy(()=>xt(()=>import("./Box3DViewer-C6P2Y2ew.js"),__vite__mapDeps([0,1,2,3,4,5,6,7])));function _s({game:t,boxModel:r,manualViewerOpen:i,setManualViewerOpen:s,allManualImages:a,lightboxOpen:c,setLightboxOpen:x,lightboxImages:o,lightboxIndex:u,show3DBox:h,setShow3DBox:m,showAddToCollection:d,setShowAddToCollection:g,backgroundOpacity:b,backgroundBlur:w}){return e.jsxs(e.Fragment,{children:[e.jsx(xe,{children:i&&e.jsx(vs,{images:a,onClose:()=>s(!1),gameName:t.title})}),e.jsx(xe,{children:c&&e.jsx(Vt,{images:o,initialIndex:u,onClose:()=>x(!1),title:t.title})}),e.jsx(xe,{children:h&&r&&e.jsx(j.Suspense,{fallback:null,children:e.jsx(Ns,{boxModel:r,gameName:t.title,onClose:()=>m(!1),backgroundSettings:{backgroundImage:(t==null?void 0:t.background_image)||(t==null?void 0:t.cover_image),backgroundOpacity:b,backgroundBlur:w,scanlinesIntensity:(t==null?void 0:t.scanlines_intensity)??25,pixelGridIntensity:(t==null?void 0:t.pixel_grid_intensity)??4,vignetteRadialIntensity:(t==null?void 0:t.vignette_radial_intensity)??60,vignetteSidesIntensity:(t==null?void 0:t.vignette_sides_intensity)??50}})})}),e.jsx(ws,{open:d,onOpenChange:g,game:t})]})}function va(){var qe,Ee,Ge;const t=wt(),{slug:r}=Nt(),i=_t(),s=new URLSearchParams(t.search),a=s.get("id"),{data:c}=P({queryKey:["gameBySlug",r],queryFn:()=>ht(r),enabled:!!r,staleTime:1/0});U.useEffect(()=>{},[a,r]);const x=r?c==null?void 0:c.id:a;U.useEffect(()=>{x&&sessionStorage.setItem("currentGameId",x)},[x]);const o=x||sessionStorage.getItem("currentGameId");U.useEffect(()=>(window.scrollTo(0,0),o&&z("/api/trackGameView",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({game_id:o})}).catch(()=>{}),()=>{sessionStorage.removeItem("currentGameId")}),[o]);const[u,h]=j.useState(!1),[m,d]=j.useState([]),[g,b]=j.useState(0),[w,n]=j.useState(!1),[v,f]=j.useState(!1),[_,T]=j.useState(!1),{user:C,navigateToLogin:G}=Ie(),{data:N=[]}=P({queryKey:["myCollection"],queryFn:()=>jt("-created_date").catch(()=>[]),enabled:!!C,staleTime:6e4,refetchOnWindowFocus:!1}),{data:q=[]}=P({queryKey:["settings"],queryFn:()=>mt(),staleTime:1/0,gcTime:1e3*60*60,refetchOnWindowFocus:!1}),{data:l,isLoading:R,isFetching:ie}=P({queryKey:["game",o],queryFn:async()=>(await De({id:o}))[0]||null,enabled:!!o,staleTime:1e3*60*10,gcTime:1e3*60*30,refetchOnWindowFocus:!1});U.useEffect(()=>{a&&!r&&(l!=null&&l.slug)&&i(ae(l),{replace:!0})},[a,r,l==null?void 0:l.slug,i]);const{data:ge}=P({queryKey:["userRating",o,C==null?void 0:C.id],queryFn:()=>Oe({game_id:o}
222),enabled:!!o&&!!C,staleTime:6e4,refetchOnWindowFocus:!1,select:y=>y[0]}),{data:fe}=P({queryKey:["userReview",o,C==null?void 0:C.id],queryFn:()=>ze({game_id:o}),enabled:!!o&&!!C,staleTime:6e4,refetchOnWindowFocus:!1,select:y=>y[0]}),{data:H=[]}=P({queryKey:["ratings",o],queryFn:()=>Oe({game_id:o}),enabled:!!o,staleTime:1e3*60*10,gcTime:1e3*60*60,refetchOnWindowFocus:!1}),{data:W=[]}=P({queryKey:["reviews",o],queryFn:()=>ze({game_id:o,status:"approved"}),enabled:!!o,staleTime:1e3*60*10,gcTime:1e3*60*60,refetchOnWindowFocus:!1}),{data:ne=[]}=P({queryKey:["game-contributors",o],queryFn:()=>ut({game_id:o}),enabled:!!o,staleTime:1e3*60*60,refetchOnWindowFocus:!1}),{data:le=[]}=P({queryKey:["game-submissions",o],queryFn:()=>pt({game_id:o,status:"approved"}),enabled:!!o,staleTime:1e3*60*60,refetchOnWindowFocus:!1}),{data:p}=P({queryKey:["boxModel",o],queryFn:()=>vt({game_id:o}),enabled:!!o,staleTime:1/0,gcTime:1e3*60*30,refetchOnWindowFocus:!1,select:y=>y[0]}),{data:k=[]}=P({queryKey:["games"],queryFn:()=>gt(),staleTime:1e3*60*10,gcTime:1e3*60*30,refetchOnWindowFocus:!1}),{data:F=[]}=P({queryKey:["seriesGames",l==null?void 0:l.series_name],queryFn:()=>De({series_name:l.series_name}),enabled:!!(l!=null&&l.series_name),staleTime:1/0,refetchOnWindowFocus:!1}),{data:L=0}=P({queryKey:["gameViewCount",o],queryFn:async()=>{const y=await z("/api/getGameViewCount",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({game_id:o})}).then(I=>I.json());return(y==null?void 0:y.count)||0},enabled:!!o,staleTime:1e3*60*5}),D=U.useMemo(()=>!k||k.length===0?[]:[...k].sort((y,I)=>(y.title||"").localeCompare(I.title||"","he")),[k]),{previousGame:oe,nextGame:Le}=U.useMemo(()=>{if(!o||D.length===0)return{previousGame:null,nextGame:null};const y=D.findIndex(Q=>Q.id===o);if(y===-1)return{previousGame:null,nextGame:null};const I=y>0?D[y-1]:null,O=y<D.length-1?D[y+1]:null;return{previousGame:I?{id:I.id,title:I.title,slug:I.slug}:null,nextGame:O?{id:O.id,title:O.title,slug:O.slug}:null}},[o,D]),be=H.length>0?H.reduce((y,I)=>y+I.rating,0)/H.length:null,Fe=N.some(y=>{if(y.game_id===o)return!0;if(!y.game_id&&y.custom_title){const I=y.custom_title.trim().toLowerCase(),O=((l==null?void 0:l.title)||"").trim().toLowerCase(),Q=((l==null?void 0:l.title_english)||"").trim().toLowerCase();return O&&I===O||Q&&I===Q}return!1}),ye=(y,I=0)=>{d(y),b(I),h(!0)},Re=()=>{if(!C){G();return}if(Fe){alert("××ש××§ ××ר ×§××× ×××סף ש××");return}T(!0)},Pe=y=>{var I,O,Q;return y?y.includes("youtu.be/")?(I=y.split("youtu.be/")[1])==null?void 0:I.split(/[?&#]/)[0]:y.includes("youtube.com/watch")?new URLSearchParams(y.split("?")[1]).get("v"):y.includes("youtube.com/embed/")?(O=y.split("youtube.com/embed/")[1])==null?void 0:O.split(/[?&#]/)[0]:y.includes("youtube.com/v/")?(Q=y.split("youtube.com/v/")[1])==null?void 0:Q.split(/[?&#]/)[0]:null:null},je=`https://www.hakufsa.co.il${l!=null&&l.slug?`/game/${l.slug}`:o?`/GameDetails?id=${o}`:"/"}`,Je=(l==null?void 0:l.background_opacity)??parseInt(((qe=q.find(y=>y.key==="global_game_background_opacity"))==null?void 0:qe.value)||"92"),Xe=(l==null?void 0:l.background_blur)??0;if(R||!l&&ie)return e.jsx("div",{className:"min-h-screen py-20",children:e.jsxs("div",{className:"w-full px-4 sm:px-6 lg:px-12 xl:px-16",children:[e.jsx(B,{className:"h-8 w-32 mb-8 bg-[#252525]"}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6 md:gap-12",children:[e.jsx(B,{className:"aspect-[3/4] rounded-xl bg-[#252525]"}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(B,{className:"h-10 w-3/4 bg-[#252525]"}),e.jsx(B,{className:"h-6 w-1/2 bg-[#252525]"}),e.jsx(B,{className:"h-24 w-full bg-[#252525]"})]})]})]})});if(!l)return e.jsx("div",{className:"min-h-screen flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(te,{className:"w-16 h-16 text-gray-600 mx-auto mb-4"}),e.jsx("h2",{className:"text-xl font-semibold text-white mb-2",children:"××ש××§ ×× × ×צ×"}),e.jsx(A,{to:se("Games"),className:"text-[#f5c518]",children:"×××¨× ×××ר××"})]})});const ve=`${l.title} - ××§×פס×`,ce=((Ee=l.description)==null?void 0:Ee.substring(0,200))||"×¦×¤× ××ש××§ ר××¨× ××תר ××§××¤×¡× - ×ר×××× ×ש××§× ×××©× ×שר×××",we=l.cover_image||"https://yliswenkhoesjvgnlmts.supabase.co/storage/v1/object/public/site-assets/logo.png",Ne=l.box_images||[],_e=l.manual_images||[];return e.jsxs("div",{className:"min-h-screen relative overflow-x-hidden",children:[e.jsxs(kt,{children:[e.jsx("title",{children:ve}),e.jsx("meta",{name:"description",content:ce}),e.jsx("link",{rel:"canonical",href:je}),e.jsx("meta",{property:"og:title",content:ve}),e.jsx("meta",{property:"og:description",content:ce}),e.jsx("meta",{property:"og:url",content:je}),e.jsx("meta",{property:"og:image",content:we}
222),e.jsx("meta",{property:"og:image:width",content:"1200"}),e.jsx("meta",{property:"og:image:height",content:"630"}),e.jsx("meta",{property:"og:type",content:"article"}),e.jsx("meta",{property:"og:locale",content:"he_IL"}),e.jsx("meta",{name:"twitter:card",content:"summary_large_image"}),e.jsx("meta",{name:"twitter:title",content:ve}),e.jsx("meta",{name:"twitter:description",content:ce}),e.jsx("meta",{name:"twitter:image",content:we}),e.jsx("script",{type:"application/ld+json",children:JSON.stringify({"@context":"https://schema.org","@type":"VideoGame",name:l.title,...l.title_english&&l.title_english!==l.title&&{alternateName:l.title_english},description:l.description||ce,image:we,url:je,inLanguage:"he",applicationCategory:"Game",...l.developer&&{author:{"@type":"Organization",name:l.developer}},...l.publisher&&{publisher:{"@type":"Organization",name:l.publisher}},...l.year&&{datePublished:String(l.year)},...l.genre&&{genre:l.genre},...l.platform&&{gamePlatform:l.platform},...be&&{aggregateRating:{"@type":"AggregateRating",ratingValue:be.toFixed(1),bestRating:"5",worstRating:"1",ratingCount:H.length}}})}),e.jsx("script",{type:"application/ld+json",children:JSON.stringify({"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:[{"@type":"ListItem",position:1,name:"××£ ×××ת",item:"https://www.hakufsa.co.il/"},{"@type":"ListItem",position:2,name:"×ש××§××",item:"https://www.hakufsa.co.il/Games"},{"@type":"ListItem",position:3,name:l.title}]})})]}),e.jsx(es,{game:l,settings:q}),e.jsx("div",{className:"relative z-10 py-6 md:py-10 max-w-full overflow-x-hidden",children:e.jsxs("div",{className:"max-w-6xl mx-auto px-4 sm:px-6 lg:px-8 w-full",children:[e.jsx(ps,{game:l,gameId:o,urlParams:s,previousGame:oe,nextGame:Le,user:C,isInCollection:Fe,onOpenAddToCollection:Re}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6 lg:gap-12",children:[e.jsx("div",{className:"w-full mx-auto lg:mx-0",children:e.jsx("div",{className:"relative rounded-2xl overflow-hidden cursor-pointer group w-full",style:{backgroundColor:l!=null&&l.background_image?"transparent":"#252525",maxHeight:"800px",display:"flex",alignItems:"center",justifyContent:"center"},onClick:()=>Ne.length>0&&ye(Ne,0),children:l.cover_image?e.jsxs(e.Fragment,{children:[e.jsx("img",{src:l.cover_image,alt:l.title,loading:"eager",decoding:"async",fetchPriority:"high",className:"w-full h-full",style:{imageRendering:"auto",objectFit:"contain",display:"block",width:"100%",maxHeight:"800px"}}),e.jsx("div",{className:"absolute inset-0 bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity md:flex items-center justify-center hidden",children:e.jsx(Te,{className:"w-12 h-12 text-white"})})]}):e.jsx("div",{className:"w-full h-full flex items-center justify-center py-20",children:e.jsx("span",{className:"text-6xl font-bold text-gray-700",children:(Ge=l.title)==null?void 0:Ge[0]})})})}),e.jsx("div",{className:"w-full overflow-visible",children:e.jsx(ts,{game:l,viewCount:L,averageUserRating:be,allRatings:H})})]}),e.jsx("div",{className:"mt-4",children:e.jsx(hs,{gameId:o})}),e.jsx(ss,{images:Ne,gameTitle:l.title,onOpenLightbox:ye}),e.jsx("div",{className:"mt-12",children:_e.length>0?e.jsx("div",{className:"bg-gradient-to-r from-[#f5c518]/10 to-[#f5c518]/5 border border-[#f5c518]/30 rounded-xl p-4 sm:p-6 md:p-8",children:e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-start gap-4 text-right",children:[e.jsx("div",{className:"w-12 h-12 bg-[#f5c518] rounded-lg flex items-center justify-center flex-shrink-0",children:e.jsx(ke,{className:"w-6 h-6 text-[#1a1a1a]"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-xl font-bold text-white mb-2",children:"×¢××× ×××ר×× ××ש××§"}),e.jsxs("p",{className:"text-gray-300 text-sm",children:["×¦×¤× ×××ר×× ×××§××¨× ×תצ××ת ספר ××××××× × ××× - ",_e.length," ×¢×××××"]})]})]}),e.jsxs($,{onClick:()=>n(!0),className:"bg-[#f5c518] text-[#1a1a1a] hover:bg-[#e0b015] px-4 py-4 md:px-6 md:py-6 text-sm md:text-base font-semibold flex-shrink-0 w-full sm:w-auto",size:"lg",children:[e.jsx(ke,{className:"w-5 h-5 ml-2"}),"×¤×ª× ×¢××× ×××ר××"]})]})}):e.jsx("div",{className:"bg-gradient-to-r from-orange-600/10 to-orange-600/5 border border-orange-600/30 rounded-xl p-4 sm:p-6 md:p-8",children:e.jsx("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4",children:e.jsxs("div",{className:"flex items-start gap-4 text-right",children:[e.jsx("div",{className:"w-12 h-12 bg-orange-600 rounded-lg flex items-center justify-center flex-shrink-0",children:e.jsx(ke,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-xl font-bold text-white mb-2",children:"××× ××! ××× ×××רת ××ר××ת..."}),e.jsxs("p",{className:"text-gray-300 text-sm",children:["××× ×× ××××, ×ס××£ × ×צ×. ××× ×ש ×× ×תר×× ×¡×¨××§×ת ×©× ×××רת ×××ר××ת פש××"," ",e.jsx(A,{to:se("SubmitGame")+`?mode=add_images&gameId=${l.id}`,className:"text-[#f5c518] hover:text-[#e0b015] font-semibold underline",children:"×××¦× ×××"})]})]})]})})})}),p&&e.jsx("div",{className:"mt-12",children:e.jsx("div",{className:"bg-gradient-to-r from-[#f5c518]/10 to-[#f5c518]/5 border border-[#f5c518]/30 rounded-xl p-4 sm:p-6 md:p-8",children:e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-start gap-4 text-right",children:[e.jsx("div",{className:"w-12 h-12 bg-[#f5c518] rounded-lg flex items-center justify-center flex-shrink-0",children:e.jsx(te,{className:"w-6 h-6 text-[#1a1a1a]"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-xl font-bold text-white mb-2",children:"×¦×¤× ××§××¤×¡× ×ת×ת-×××××ת"}),e.jsx("p",{className:"text-gray-300 text-sm",children:"ס××× ××¦×¤× ××§×פסת ××ש××§ ×ת×ת ×××× ×¢× ×קס××ר×ת ××§×ר××ת"})]})]}),e.jsxs($,{onClick:()=>f(!0),className:"bg-[#f5c518] text-[#1a1a1a] hover:bg-[#e0b015] px-4 py-4 md:px-6 md:py-6 text-sm md:text-base font-semibold flex-shrink-0 w-full sm:w-auto",size:"lg",children:[e.jsx(te,{className:"w-5 h-5 ml-2"}),"×¤×ª× ×ª×¦××× ×ª×ת-×××××ת"]})]})})}),l.youtube_gameplay_url&&Pe(l.youtube_gameplay_url)&&e.jsxs("div",{className:"mt-12",children:[e.jsxs("h3",{className:"font-semibold text-white mb-6 flex items-center gap-2 text-xl",children:[e.jsx(He,{className:"w-6 h-6 text-[#f5c518]"}),"צפ××× ××ש××§"]}),e.jsx("div",{className:"relative aspect-video rounded-xl overflow-hidden bg-[#252525] border border-gray-800",children:e.jsx("iframe",{width:"100%",height:"100%",src:`https://www.youtube.com/embed/${Pe(l.youtube_gameplay_url)}`,title:"YouTube video player",frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",allowFullScreen:!0,className:"w-full h-full relative z-10"})})]}),e.jsx(as,{images:l.diskette_images,onOpenLightbox:ye}),e.jsx(ys,{game:l}),e.jsx(rs,{game:l,contributors:ne,gameSubmissions:le}),e.jsx("div",{className:"mt-8",children:e.jsx(ms,{gameId:o})}),e.jsx("div",{className:"mt-12",children:e.jsx(is,{gameId:o,user:C,userRating:ge,userReview:fe})}),e.jsxs("div",{className:"mt-12 mb-12",children:[e.jsxs("h3",{className:"text-2xl font-bold text-white mb-6",children:["×××§×ר×ת ×שת×ש×× ",W.length>0&&`(${W.length})`]}),W.length>0?e.jsx(ns,{reviews:W}):e.jsx("div",{className:"bg-[#252525] rounded-xl p-8 border border-gray-800 text-center",children:e.jsx("p",{className:"text-gray-400",children:C?"×¢×××× ××× ×××§×ר×ת ××ש××§ ××. ××× ×ר×ש×× ××ת×× ×××§×רת!":"×¢×××× ××× ×××§×ר×ת ××ש××§ ××. ×ת××ר ××× ××××ת ×ר×ש×× ××ת×× ×××§×רת!"})})]}),(l==null?void 0:l.series_name)&&e.jsx(Lt,{games:F,currentGameId:o}),e.jsx(us,{gameId:o,allGames:k}),e.jsx(js,{previousGame:oe,nextGame:Le})]})}
222),e.jsx(_s,{game:l,boxModel:p,manualViewerOpen:w,setManualViewerOpen:n,allManualImages:_e,lightboxOpen:u,setLightboxOpen:h,lightboxImages:m,lightboxIndex:g,show3DBox:v,setShow3DBox:f,showAddToCollection:_,setShowAddToCollection:T,backgroundOpacity:Je,backgroundBlur:Xe})]})}export{va as default};
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.