1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[343],{51969:function(e,t,n){n.r(t),n.d(t,{default:function(){return v}});var r=n(20567),i=n(14932),l=n(85893),a=n(67294),o=n(68466),s=n(88695),u=n(41664),c=n.n(u),d=n(11163),f=n(79177),m=n(850),p=n(33453),h=n(92365),g=n(52857),y=n(40110),b=n(95639);function w(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=String(e).trim().toLowerCase();return"bayshore"===(t=(t=t.replace(/\./g,"").replace(/\s+/g," ")).replace(/^mt /,"mount ").replace(/^st /,"saint "))&&(t="bay shore"),"port jeff station"===t&&(t="port jefferson station"),("n babylon"===t||"n. babylon"===t)&&(t="north babylon"),"seldon"===t&&(t="selden"),t}function v(e){let{mode:t="popular",city:n="",state:u="",filterCities:v=[],label:x="",max:S=12,minItems:_=3,className:k="",initialData:j=null}=e,R=(0,d.useRouter)(),[N,A]=(0,a.useState)([]),[C,E]=(0,a.useState)(!1),[L,P]=(0,a.useState)(!1),[U,T]=(0,a.useState)(""),[I,V]=(0,a.useState)(""),W=(0,a.useRef)(new Set),Z=(0,a.useRef)(null);(0,a.useEffect)(()=>{Z.current=(0,o.L)()},[]),(0,a.useEffect)(()=>{if(j&&Array.isArray(j)&&j.length>0&&"popular"===t){A(j.slice(0,S)),E(j.length>=Math.min(_,S));return}let e=new AbortController;Z.current||(Z.current=(0,o.L)());let l="personal"===t?Z.current:"POPULAR",a=new URLSearchParams((0,i._)((0,r._)({anonId:l,mode:t},n?{city:n}:{},u?{state:u}:{}),{max:String(S)})),s="/api/recommend?".concat(a.toString());return E(!1),W.current.clear(),(async()=>{try{let t=await fetch(s,{signal:e.signal});if(!t.ok)throw Error("recommend fetch failed");let r=await t.json(),i=Array.isArray(null==r?void 0:r.items)?r.items:[];if(null==v?void 0:v.length){let e=new Set(v.map(e=>w(e)));i=i.filter(t=>{let n=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=String(e).trim().toLowerCase();return"ny"===t||"new york"===t?"NY":String(e||"").trim().toUpperCase()}(t.state||t.venue_state),r=w(t.city||t.venue_city||"");if("NY"!==n)return!1;if(e.has(r))return!0;let i=function(e){if(!e)return null;if("number"==typeof e.latitude&&"number"==typeof e.longitude)return{latitude:e.latitude,longitude:e.longitude};if(null!=e._latitude&&null!=e._longitude)return{latitude:+e._latitude,longitude:+e._longitude};if("number"==typeof e.lat&&"number"==typeof e.lng)return{latitude:e.lat,longitude:e.lng};if("string"==typeof e.lat&&"string"==typeof e.lng){let t=parseFloat(e.lat),n=parseFloat(e.lng);if(!Number.isNaN(t)&&!Number.isNaN(n))return{latitude:t,longitude:n}}return null}(t.geopoint||{lat:t.lat,lng:t.lng});return!!i&&function(e){if(!e)return!1;let{latitude:t,longitude:n}=e;return"number"==typeof t&&"number"==typeof n&&t>=40.5&&t<=41.2&&n>=-73.75&&n<=-71.8}(i)})}i.sort((e,t)=>{let n=(0,f.P9)(e.main_date),r=(0,f.P9)(t.main_date);return n&&r?n-r:0});let l=(e=>{let t=new Set,n=[];for(let r of e){let e=r.id||r.internallink;!e||t.has(e)||(t.add(e),n.push(r))}return n})(i);if(l.length<S)try{let t=new URLSearchParams({limit:"500"});u&&t.set("state",u),n&&t.set("city",n);let r=u||n?"/api/admin/events/upcoming?".concat(t):"/api/admin/events/li-upcoming?limit=500",i=await fetch(r,{signal:e.signal});if(i.ok){let e=await i.json(),t=Array.isArray(null==e?void 0:e.events)?e.events:[],n=Math.max(0,S-l.length),a=e=>e.id||e.internallink||e.slug||e._id,o=new Set(l.map(a)),s=[];for(let e of t){let t=a(e);if(!(!t||o.has(t))&&(o.add(t),s.push(e),s.length>=n))break}l=l.concat(s),console.debug("Backfill",{endpoint:r,pool:t.length,filtered:t.length,needed:n,added:s.length,final:l.length})}else console.warn("backfill fetch failed",await i.text())}catch(e){"AbortError"!==e.name&&console.warn("backfill error",e)}l=l.slice(0,S),A(l),E(l.length>=Math.min(_,S))}catch(e){"AbortError"!==e.name&&(console.error(e),A([]),E(!1))}})(),()=>e.abort()},[t,n,u,S,_,JSON.stringify(v),j]),(0,a.useEffect)(()=>{if(!N.length)return;let e=new IntersectionObserver(e=>{e.forEach(e=>{if(!e.isIntersecting)return;let t=e.target.getAttribute("data-id"),n=N[Number(e.target.getAttribute("data-idx")||0)];t&&n&&!W.current.has(t)&&(W.current.add(t),(0,s._b)(n,"view",1,{source:"RecommendedRow"}))})},{threshold:.5});return document.querySelectorAll(".rec-card[data-id]").forEach(t=>e.observe(t)),()=>e.disconnect()},[N]);let O=(0,a.useMemo)(()=>x?"Recommended for you in ".concat(x):n?"Recommended for you in ".concat(n):"Recommended for you",[x,n]);return C?(0,l.jsxs)("section",{className:k,children:[(0,l.jsx)("h3",{style:{marginBottom:8},children:O}),(0,l.jsx)("ul",{style:{display:"grid",gap:12,gridTemplateColumns:"repeat(auto-fit, minmax(240px, 1fr))"},children:N.map((e,t)=>{let n=(0,f.vX)(e.main_date),r=e.city||e.venue_city;return(0,l.jsxs)("li",{className:"rec-card","data-id":e.id||e.internallink,"data-id
1x":t,style:{padding:12,border:"1px solid #e5e7eb",borderRadius:8,background:"#fff"},children:[(0,l.jsx)("div",{style:{fontSize:12,color:"#6b7280"},children:n}),(0,l.jsx)("div",{style:{fontWeight:600,marginTop:4},children:e.title}),(0,l.jsxs)("div",{style:{fontSize:14,color:"#374151",marginTop:2},children:[e.venue_name,r?" ⢠".concat(r):""]}),(0,l.jsxs)("div",{style:{marginTop:8,display:"flex",alignItems:"center",gap:8},children:[(0,l.jsx)(c(),{href:{pathname:"/events/".concat(e.id||e.internallink),query:{from:R.asPath}},onClick:()=>(0,s._b)(e,"details",1,{source:"RecommendedRow"}),style:{textDecoration:"underline"},children:"Details"}),e.sampleVideoUrl&&(0,l.jsx)("button",{onClick:t=>{t.stopPropagation(),T(e.sampleVideoUrl),V(e.title),P(!0),(0,s._b)(e,"video",2,{source:"RecommendedRow",url:e.sampleVideoUrl})},style:{display:"inline-flex",alignItems:"center",background:"none",border:"none",padding:0,cursor:"pointer",color:"#ff0000"},title:"Watch Video",children:(0,l.jsx)(m.Z,{style:{fontSize:24}})})]})]},e.id||e.internallink)})}),(0,l.jsxs)(p.Z,{open:L,onClose:()=>P(!1),maxWidth:"md",fullWidth:!0,children:[(0,l.jsxs)(h.Z,{children:["Watch Video",I?" - ".concat(I):"",(0,l.jsx)(g.Z,{"aria-label":"close",onClick:()=>P(!1),sx:{position:"absolute",right:8,top:8,color:e=>e.palette.grey[500]},children:(0,l.jsx)(b.Z,{})})]}),(0,l.jsx)(y.Z,{dividers:!0,children:(0,l.jsx)("iframe",{width:"100%",height:"450",src:U?(e=>{if(!e)return"";try{let t=new URL(e);if("youtu.be"===t.hostname)return"https://www.youtube.com/embed/".concat(t.pathname.slice(1),"?autoplay=1");if(t.pathname.startsWith("/shorts/")){let e=t.pathname.split("/")[2];return"https://www.youtube.com/embed/".concat(e,"?autoplay=1")}let n=t.searchParams.get("v");if(n)return"https://www.youtube.com/embed/".concat(n,"?autoplay=1");return""}catch(e){return""}})(U):"",title:"Sample Video",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})]})]}):null}},88695:function(e,t,n){n.d(t,{Xv:function(){return o},_b:function(){return a}});var r=n(20567),i=n(68466);async function l(e){try{await fetch("/api/log-interaction",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),keepalive:!0})}catch(e){}}function a(){let{type:e,entityType:t="event",entityId:n,weight:r=1,meta:a={}}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=(0,i.L)();if(e&&o)return l({anonId:o,type:e,entityType:t,entityId:n,weight:r,meta:a})}function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=(0,i.L)();if(!n||!e)return;let a=e.slug||e.id;return l({anonId:n,type:"click",entityType:"venue",entityId:a,weight:1,meta:(0,r._)({ident:a,venueId:e.id,city:e.venue_city,state:e.venue_state},t)})}}}]); 2//# sourceMappingURL=343.99d5daf263641641.js.map
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.