1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2165],{6467:function(e,t,a){a.d(t,{Z:function(){return k}});var l=a(57437),s=a(66648),r=a(41942),i=a(11444),o=a(16463),n=a(58312),c=a(33820),d=a(2265),u=a(71575),h=a(69842),p=a(44638),m=a(96545),x=a(87961),g=a(94008),v=a(11590),b=a(42111),y=a(71366),f=a(89826),j=a(15080),w=a(35978),k=(0,d.memo)(function(e){var t,a,k,N;let{post:T,currentUser:I,isTrophyPost:C}=e,[S,E]=(0,d.useState)(!1),[P,U]=(0,d.useState)(!1),[A,V]=(0,d.useState)(null),[O,F]=(0,d.useState)(0),[M,L]=(0,d.useState)(null),W=(0,i.I0)(),{users:B}=(0,i.v9)(e=>e.user),D=(0,o.useRouter)(),[z,Z]=(0,d.useState)(!1),[G,R]=(0,d.useState)(!1);(0,d.useRef)(null);let[q,H]=(0,d.useState)(!1),[Y,J]=(0,d.useState)(!1),X=()=>(null==T?void 0:T.postType)==="Trophy"?"/feed/trophyposts/".concat(null==T?void 0:T.id):"/feed/checkins/".concat(null==T?void 0:T.id);(0,d.useEffect)(()=>{(async()=>{if(null==T?void 0:T.userId)try{let e=(0,h.JU)(p.db,"users",T.userId),t=await (0,h.QT)(e);t.exists()?L({...t.data(),id:t.id}):console.error("No such document!")}catch(e){console.error("Error fetching author:",e)}else console.error("post.userId is not defined")})()},[null==T?void 0:T.userId]);let _=(0,d.useMemo)(()=>T?Array.isArray(T.imageUrls)&&T.imageUrls.length>0?T.imageUrls:T.imageUrl&&"string"==typeof T.imageUrl?[T.imageUrl]:[]:[],[T]),K=null==T?void 0:T.hasVideo,Q=K&&(null==T?void 0:T.videoPlaybackId),$=(K?1:0)+_.length,[ee,et]=(0,d.useState)(Q&&0===O);(0,d.useEffect)(()=>{et(Q&&0===O)},[Q,O]);let ea=()=>K?O-1:O,el=async e=>{if(e.preventDefault(),e.stopPropagation(),(null==I?void 0:I.isAdmin)&&(null==T?void 0:T.id)){J(!0);try{await (0,w._S)(T.id,!T.isGraphic,I.id),W((0,n.CP)({...T,isGraphic:!T.isGraphic})),(0,u.XA)(T.isGraphic?(0,x.ZP)("feed.unmarkAsGraphic"):(0,x.ZP)("feed.markAsGraphic"))}catch(e){console.error("Error toggling graphic:",e),(0,u.Eo)("Failed to update graphic flag")}finally{J(!1)}}},es=(0,d.useMemo)(()=>!!T&&!!T.likes&&Array.isArray(T.likes)&&T.likes.includes(null==I?void 0:I.id),[null==T?void 0:T.likes,null==I?void 0:I.id]),er=async e=>{if(e.stopPropagation(),!I){W((0,b.h7)({modalType:"login"})),(0,u.Eo)("Please log in to like this check-in");return}null==T||T.postType;try{let e=T.likes&&T.likes.includes(I.id)?T.likes.filter(e=>e!==I.id):[...T.likes||[],I.id],t=(0,h.JU)(p.db,"posts",T.id);await (0,h.i3)(p.db,async a=>{let l=await (null==a?void 0:a.get(t));if(!(null==l?void 0:l.exists()))throw Error("Post does not exist!");let s=null==l?void 0:l.data(),r=(null==s?void 0:s.likes)||[];(null==r?void 0:r.includes(null==I?void 0:I.id))?null==a||a.update(t,{likes:(0,h.Ab)(null==I?void 0:I.id)}):null==a||a.update(t,{likes:(0,h.vr)(null==I?void 0:I.id)}),W((0,n.sJ)({postId:T.id,likes:e}))})}catch(e){console.error("Error updating like:",e),(0,u.Eo)("Failed to update like. Please try again.")}},ei=(0,d.useMemo)(()=>0===_.length||0>ea()||ea()>=_.length?null:_[ea()],[_,ea]);return(0,l.jsxs)(l.Fragment,{children:[S&&(0,l.jsx)(c.Z,{isOpen:S,onClose:()=>E(!1),postToEdit:T,currentUser:I}),P&&(0,l.jsx)(f.Z,{isOpen:P,onClose:()=>U(!1),postToEdit:T,currentUser:I}),(0,l.jsxs)("div",{className:"post-card bg-white rounded-xl overflow-hidden shadow-md cursor-pointer transition-all duration-300 ease-out h-[500px] flex flex-col transform hover:scale-[1.02] hover:shadow-lg",children:[(0,l.jsxs)("div",{className:"relative w-full h-3/4 overflow-hidden",children:[ee?(0,l.jsx)("div",{className:"h-full w-full bg-black flex items-center justify-center",children:(0,l.jsxs)("div",{className:"relative w-full h-full",onClick:e=>{e.target===e.currentTarget&&D.push(X())},children:[(0,l.jsx)(y.Z,{playbackId:T.videoPlaybackId,thumbnailUrl:T.videoThumbnail,onHoverPlay:!0,preventNavigation:!0}),T.videoProcessing&&(0,l.jsx)("div",{className:"absolute top-0 left-0 right-0 bg-black bg-opacity-70 text-white text-sm py-1 px-2 text-center",children:"Video processing... It will appear automatically when ready"})]})}):ei?(0,l.jsx)("div",{className:"relative w-full h-full",children:(0,l.jsx)(s.default,{alt:null==T?void 0:T.caption,fill:!0,sizes:"100%",priority:!0,onClick:()=>D.push(X()),className:"transition-transform duration-300 ease-out hover:scale-110 object-cover",src:ei},"".concat(null==T?void 0:T.id,"-").concat(O))}):(0,l.jsx)("div",{onClick:()=>D.push(X()),className:"w-full h-full bg-gray-200 flex items-center justify-center",children:(null==T?void 0:T.hasVideo)&&(null==T?void 0:T.videoProcessing)?(0,l.jsxs)("div",{className:"text-gray-600 flex flex-col items-center",children:[(0,l.jsx)(r.KoQ,{className:"mb-2 text-2xl"}),(0,l.jsx)("span",{children:"Video processing..."})]}):(0,l.jsx)("span",{className:"text-gray-400",children:"No image available"})}),$>1&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("button",{onClick:e=>{e.stopPropagation(),$<=1||F(e=>(e-1+$)%$)},className:"absolute left-2 top-1/2 transform -translate-y-1/2 bg-black bg-opacity-50 text-white rounded-full p-2 z-10",children:(0,l.jsx)(r.bUI,{})}),(0,l.jsx)("button",{onClick:e=>{e.stopPropagation(),$<=1||F(e=>(e+1)%$)},className:"absolute right-2 top-1/2 transform -translate-y-1/2 bg-black bg-opacity-50 text-white rounded-full p-2 z-10",children:(0,l.jsx)(r.Dli,{})}),(0,l.jsx)("div",{className:"absolute bottom-2 left-1/2 transform -translate-x-1/2 flex space-x-1 z-10",children:Array.from({length:$}).map((e,t)=>(0,l.jsx)("div",{className:"w-2 h-2 rounded-full ".concat(O===t?"bg-white":"bg-gray-400 bg-opacity-60")},t))})]}),((null==T?void 0:T.scoreText)||"number"==typeof(null==T?void 0:T.scoreValue)&&!isNaN(null==T?void 0:T.scoreValue))&&(0,l.jsxs)("div",{className:"absolute bottom-2 right-2 z-10",style:{background:"rgba(255, 255, 255, 0.95)",color:"black",padding:"8px 12px",fontSize:"14px",fontWeight:"900",textShadow:"1px 1px 0px rgba(0,0,0,0.3)",WebkitTextStroke:"0.5px black",clipPath:"pol
1ygon(10% 0%, 20% 5%, 30% 0%, 40% 5%, 50% 0%, 60% 5%, 70% 0%, 80% 5%, 90% 0%, 95% 5%, 100% 15%, 95% 25%, 100% 35%, 95% 45%, 100% 55%, 95% 65%, 100% 75%, 95% 85%, 90% 100%, 80% 95%, 70% 100%, 60% 95%, 50% 100%, 40% 95%, 30% 100%, 20% 95%, 10% 100%, 5% 95%, 0% 85%, 5% 75%, 0% 65%, 5% 55%, 0% 45%, 5% 35%, 0% 25%, 5% 15%)",filter:"drop-shadow(0 2px 4px rgba(0,0,0,0.3))"},children:[((null==T?void 0:T.scoreType)||"self").toUpperCase()," SCORE:"," ",(null==T?void 0:T.scoreText)||(null==T?void 0:T.scoreValue),"â³"]}),(0,l.jsxs)("div",{className:"absolute top-2 right-2 flex gap-2 z-10",children:[(null==I?void 0:I.id)===(null==T?void 0:T.userId)&&(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)("button",{onClick:e=>{e.stopPropagation(),(null==T?void 0:T.postType)==="Trophy"?U(!0):E(!0)},className:"bg-blue-500 text-white rounded-full p-2 hover:bg-blue-600 transition",children:(0,l.jsx)(r.fmQ,{})}),(0,l.jsx)("button",{onClick:e=>{e.stopPropagation(),H(!0)},className:"bg-red-500 text-white rounded-full p-2 hover:bg-red-600 transition",children:(0,l.jsx)(r.Xm5,{})})]}),(null==I?void 0:I.isAdmin)&&(0,l.jsx)("button",{onClick:e=>{e.preventDefault(),W((0,n.b1)(null==T?void 0:T.id))},className:"text-white rounded-full p-2 transition ".concat((null==T?void 0:T.featured)?"bg-yellow-500 hover:bg-yellow-600":"bg-gray-500 hover:bg-gray-600"),children:(0,l.jsx)(r.QJe,{})}),(null==I?void 0:I.isAdmin)&&((null==T?void 0:null===(t=T.imageUrls)||void 0===t?void 0:t.length)||(null==T?void 0:T.hasVideo))&&(0,l.jsx)("button",{onClick:el,disabled:Y,className:"text-white rounded-full p-2 transition ".concat((null==T?void 0:T.isGraphic)?"bg-amber-600 hover:bg-amber-700":"bg-gray-500 hover:bg-gray-600"),title:(null==T?void 0:T.isGraphic)?(0,x.ZP)("feed.unmarkAsGraphic"):(0,x.ZP)("feed.markAsGraphic"),children:(0,l.jsx)(r.H3h,{className:"w-3 h-3 md:w-3.5 md:h-3.5"})}),I&&(null==I?void 0:I.id)!==(null==T?void 0:T.userId)&&(0,l.jsx)("button",{onClick:e=>{e.stopPropagation(),Z(!0)},className:"bg-black bg-opacity-50 text-white rounded-full p-1.5 md:p-2 hover:bg-opacity-70 transition",title:"Report post",children:(0,l.jsx)(r.wQ2,{className:"w-2.5 h-2.5 md:w-3 md:h-3"})})]})]}),(0,l.jsxs)("div",{className:"p-4 flex-grow flex flex-col justify-between transition-colors duration-300 ease-out hover:bg-gray-50",onClick:()=>D.push(X()),children:[(0,l.jsxs)("div",{className:"flex justify-between",children:[(0,l.jsxs)("span",{title:(null==T?void 0:T.county)||(null==T?void 0:T.bodyOfWater),className:"font-bold line-clamp-1",children:[(null==T?void 0:T.county)||(null==T?void 0:T.bodyOfWater),", ",(null==T?void 0:T.state)||"VA"]}),(0,l.jsx)("span",{className:"font-bold",children:(null==T?void 0:T.postType)==="Trophy"?(()=>{let e=null==T?void 0:T.year;return e&&!isNaN(e)&&e>=1900&&e<=2100?e:new Date().getFullYear()})():(0,m.Po)(null==T?void 0:T.createdAt)})]}),(0,l.jsx)("div",{className:"mb-4 mt-2",children:(0,l.jsx)("p",{className:"text-gray-800",children:(null==T?void 0:T.caption)&&T.caption.length>80?"".concat(T.caption.substring(0,80),"..."):(null==T?void 0:T.caption)||""})}),(0,l.jsxs)("div",{className:"flex justify-between",children:[(0,l.jsx)(v.Z,{author:M,currentUser:I}),(0,l.jsx)("div",{className:"flex items-center text-sm text-gray-500",children:(0,l.jsxs)("div",{children:[(0,l.jsxs)("span",{className:"mr-4",children:[(0,l.jsx)(r.DCG,{className:"inline mr-1 h-5 w-5 ".concat((null==T?void 0:null===(a=T.comments)||void 0===a?void 0:a.length)>0?"text-accent":"")}),(null==T?void 0:T.comments)?null==T?void 0:null===(k=T.comments)||void 0===k?void 0:k.length:0]}),(0,l.jsxs)("span",{children:[(0,l.jsx)(r.spm,{onClick:er,className:"inline h-5 w-5 mr-1 cursor-pointer hover:scale-125 transition-transform ".concat(es?"text-accent":"")}),(null==T?void 0:null===(N=T.likes)||void 0===N?void 0:N.length)||0]})]})})]})]})]}),(0,l.jsx)(g.Z,{isOpen:q,onClose:()=>H(!1),onConfirm:()=>{W((0,n.M8)(null==T?void 0:T.id)).then(()=>{(0,u.XA)("Check-in deleted successfully")}).catch(e=>{(0,u.Eo)("Failed to delete check-in: ".concat(e.message))})},title:(null==T?void 0:T.postType)==="Trophy"?"Delete Trophy Post":"Delete Check-in",description:"Are you sure you want to delete this ".concat((null==T?void 0:T.postType)==="Trophy"?"trophy post":"check-in","? This action cannot be undone.")}),(0,l.jsx)(j.Z,{isOpen:z,onClose:()=>Z(!1),targetType:(null==T?void 0:T.postType)==="Trophy"?"trophy":"check-in",targetId:null==T?void 0:T.id,reporterId:null==I?void 0:I.id})]})})},33820:function(e,t,a){a.d(t,{Z:function(){return j}});
1var l=a(57437),s=a(2265),r=a(16463),i=a(66648),o=a(34877),n=a(11444),c=a(58312),d=a(57323);a(6880);var u=a(71575),h=a(3825),p=a(31716),m=a(69842),x=a(44638),g=a(71366),v=a(96545),b=a(41367),y=a(87280);let f=e=>{if(e instanceof m.EK)return e.toDate().toISOString();if(Array.isArray(e))return e.map(e=>"string"==typeof e?e:f(e));if(e&&"object"==typeof e&&!(e instanceof Date)&&!(e instanceof m.EK)){let t={};for(let a in e)Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=f(e[a]));return t}return e};function j(e){var t;let{isOpen:a,onClose:j,postToEdit:w,currentUser:k}=e;(0,r.useRouter)();let N=(0,n.I0)(),T=(0,s.useRef)(null),[I,C]=(0,s.useState)({postType:"",gameType:"",weapon:"",scoreType:"",scoreText:"",scoreValue:null,officialScoreSheetUrl:"",county:"",unit:"",bodyOfWater:"",caption:"",state:"",stateId:"",year:new Date().getFullYear()}),[S,E]=(0,s.useState)([]),[P,U]=(0,s.useState)([]),[A,V]=(0,s.useState)(!1),[O,F]=(0,s.useState)(null),[M,L]=(0,s.useState)(0),[W,B]=(0,s.useState)(!1),[D,z]=(0,s.useState)(null),[Z,G]=(0,s.useState)(null),R=(0,s.useRef)(null),q=(0,s.useRef)(0),[H,Y]=(0,s.useState)(!1),[J,X]=(0,s.useState)([]),[_,K]=(0,s.useState)([]),[Q,$]=(0,s.useState)([]),[ee,et]=(0,s.useState)([]),[ea,el]=(0,s.useState)(null),[es,er]=(0,s.useState)(!1),[ei,eo]=(0,s.useState)(null),[en,ec]=(0,s.useState)(!1);(0,s.useEffect)(()=>{ed()},[]),(0,s.useEffect)(()=>{I.stateId&&eu()},[I.stateId]),(0,s.useEffect)(()=>{if(w){var e,t,a;C({postType:w.postType||"",gameType:w.gameType||"",weapon:w.weapon||"",scoreType:w.scoreType||"",scoreText:w.scoreText||"",scoreValue:null!==(a=w.scoreValue)&&void 0!==a?a:null,officialScoreSheetUrl:w.officialScoreSheetUrl||"",county:w.county||"",unit:w.unit||"",bodyOfWater:w.bodyOfWater||"",caption:w.caption||"",state:w.state||"",stateId:w.stateId||"",year:w.year||(w.createdAt?new Date("number"==typeof w.createdAt?w.createdAt:(null===(e=(t=w.createdAt).toDate)||void 0===e?void 0:e.call(t))||w.createdAt).getFullYear():new Date().getFullYear())}),U(w.imageUrls||[]),w.hasVideo&&w.videoPlaybackId&&z({playbackId:w.videoPlaybackId,assetId:w.videoAssetId,thumbnailUrl:w.videoThumbnail,duration:w.videoDuration})}},[w]),(0,s.useEffect)(()=>{let e=e=>{let t=Date.now();es||t<q.current||!T.current||T.current.contains(e.target)||j()};return a&&document.addEventListener("mousedown",e,!0),()=>{document.removeEventListener("mousedown",e,!0)}},[a,j,es]);let ed=async()=>{try{let e=await (0,b.Vd)();X(e)}catch(e){console.error("Error loading states:",e),(0,u.Eo)("Failed to load states")}},eu=async()=>{if(I.stateId)try{let e=J.find(e=>e.id===I.stateId);if(el(e),null==e?void 0:e.usesUnits){let e=await (0,b.nL)(I.stateId);$(e),K([])}else{let e=await (0,b.Jb)(I.stateId);K(e),$([])}let t=await (0,b.bv)(I.stateId);et(t)}catch(e){console.error("Error loading location data:",e),(0,u.Eo)("Failed to load location data")}},eh=async e=>{if(e.preventDefault(),(null==k?void 0:k.accountStatus)==="deactivated"){(0,u.Eo)("Your account is deactivated. Please reactivate your account to post.");return}if(0===P.length&&!D&&0===M){(0,u.Eo)("Please select at least one image or video");return}try{if("official"===I.scoreType&&!I.officialScoreSheetUrl&&!ei){(0,u.Eo)("Please upload the official score sheet image");return}let e=(e=>{if(!e||"string"!=typeof e)return null;let t=e.trim().replace(/["ââ³]/g,"").replace(/[^0-9\s./]/g," ").replace(/\s+/g," ").trim(),a=Number(t);if(Number.isFinite(a))return a;let l=t.match(/^(\d+)\s+(\d+)\s*\/\s*(\d+)$/);if(l){let e=parseInt(l[1],10),t=parseInt(l[2],10),a=parseInt(l[3],10)||1;return 0===a?e:e+t/a}if(l=t.match(/^(\d+)$/))return parseInt(l[1],10);if(l=t.match(/^(\d+)\s*\/\s*(\d+)$/)){let e=parseInt(l[1],10),t=parseInt(l[2],10)||1;return 0===t?0:e/t}return null})(I.scoreText),t=I.officialScoreSheetUrl||"";if("official"===I.scoreType&&ei)try{t=await (0,v._Q)("scoreSheets",ei)}catch(e){console.error("Failed to upload score sheet",e),(0,u.Eo)("Failed to upload score sheet");return}let a={userId:k.id,userName:k.name||"",userAvatar:k.avatar||"",title:I.title||"",state:I.state||"",stateId:I.stateId||"",county:I.county||"",unit:I.unit||"",postType:I.postType||"",gameType:I.gameType||"",bodyOfWater:I.bodyOfWater||"",caption:I.caption||"",imageUrls:P||[],comments:w&&w.comments||[],likes:w&&w.likes||[],createdAt:w?w.createdAt:(0,m.Bt)(),featured:!!w&&(w.featured||!1),weapon:I.weapon||"",scoreType:I.scoreType||"",scoreText:I.scoreText||"",scoreValue:e,officialScoreSheetUrl:t,year:I.year||new Date().getFullYear()};D?(a.hasVideo=!0,a.videoPlaybackId=D.playbackId,a.videoAssetId=D.assetId,a.videoThumbnail=D.thumbnailUrl):100===M&&(a.hasVideo=!0,a.videoProcessing=!0);let l=null;R.current&&(l=JSON.parse(JSON.stringify(R.current)));let s=100===M&&!D;j(),(0,u.XA)("Processing your check-in in the background..."),w?(a.id=w.id,em(a,s,l)):ep(a,s,l)}catch(e){console.error("Error preparing post:",e),(0,u.Eo)("Error preparing check-in. Please try again.")}},ep=async(e,t,a)=>{try{let l=await (0,p.eR)(e);N((0,c.q2)(l)),t&&a&&ex(l.id,a),(0,u.XA)("Check in submitted successfully!")}catch(e){console.error("Error creating post:",e),(0,u.Eo)("Error with check-in. Your post might be incomplete.")}},em=async(e,t,a)=>{try{let l=await (0,p.Vg)(e),s=f(l);N((0,c.CP)(s)),t&&a&&ex(l.id,a),(0,u.XA)("Check in updated successfully!")}catch(e){console.error("Error updating post:",e),(0,u.Eo)("Error updating check-in. Your post might be incomplete.")}},ex=async(e,t)=>{if(!t||!t.uploadId){console.error("No upload data available for background processing");return}let a=t.uploadId,l=0,s=async()=>{try{l++;let t=await (0,h.z8)(a);if(t.ready)try{let a=(0,m.JU)(x.db,"posts",e),l=await (0,m.QT)(a);if(!l.exists()){console.error("Post not found when updating video data");return}let s=l.data();await (0,m.r7)(a,{videoPlaybackId:t.playbackId,videoAssetId:t.assetId,videoThumbnail:t.thumbnailUrl,videoProcessing:!1,hasVideo:!0,updatedAt:(0,m.Bt)()});let r={...s,id:e,videoPlaybackId:t.playbackId,videoAssetId:t.assetId,videoThumbnail:t.thumbnailUrl,videoProcessing:!1,hasVideo:!0,imageUrls:s.imageUrls||[],likes:Array.isArray(s.likes)?s.likes:[]},i=f(r);N((0,c.CP)(i))}catch(e){console.error("Error updating post with video data:",e),(0,u.Eo)("Error updating video data. Please try refreshing.")}else l<30?setTimeout(s,2e3):(console.error("Max attempts reached for video processing"),(0,u.Eo)("Video processing took too long. Please try refreshing."))}catch(e){var t;console.error("Error checking asset status in background:",e),(null===(t=e.message)||void 0===t?void 0:t.includes("invalid_parameters"))&&l<30?setTimeout(s,3e3):(0,u.Eo)("Error processing video. Your post was saved but the video may be missing.")}};s()},eg=e=>{let{name:t,value:a}=e.target;C(e=>{let l={...e,[t]:a};if("postType"===t&&("Catch"===a?(l.gameType="Fish",l.county="",l.unit=""):(l.gameType="",l.bodyOfWater=""),l.weapon="",l.scoreType="",l.scoreText="",l.scoreValue=null,l.officialScoreSheetUrl=""),"stateId"===t){var s;l.county="",l.unit="",l.bodyOfWater="",l.state=(null===(s=J.find(e=>e.id===a))||void 0===s?void 0:s.abbreviation)||""}return"gameType"===t&&("Fish"===a?(l.county="",l.unit="",l.weapon="",l.scoreType="",l.scoreText="",l.scoreValue=null,l.officialScoreSheetUrl=""):l.bodyOfWater=""),l})},ev=e=>{let t=[...S],a=[...P];t.splice(e,1),a.splice(e,1),E(t),U(a)},eb=async e=>{let t=e.target.files[0];if(t){if(t.size>104857600){(0,u.Eo)("Video file size must be less than 100MB");return}F(t),B(!0),L(0);try{let e=await (0,h.K9)();R.current=e,await (0,h.o3)(t,e.uploadUrl,e=>{L(e)}),M>=100&&(0,u.XA)("Video uploaded. Processing will continue in the background."),ey(e.uploadId)}catch(e){console.error("Error uploading video:",e),(0,u.Eo)("Failed to upload video. Please try again."),B(!1)}}},ey=async e=>{try{let t=await (0,h.z8)(e);t.ready?(z({playbackId:t.playbackId,assetId:t.assetId,thumbnailUrl:t.thumbnailUrl,duration:t.duration}),B(!1),(0,u.XA)("Video processing completed")):setTimeout(()=>ey(e),2e3)}catch(a){var t;console.error("Error checking asset status:",a),(null===(t=a.message)||void 0===t?void 0:t.includes("invalid_parameters"))?setTimeout(()=>ey(e),3e3):((0,u.Eo)("Error processing video. Please try again."),B(!1))}};return a?(0,l.jsxs)("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex justify-center items-center z-50",children:[(0,l.jsxs)("div",{ref:T,className:"bg-white p-6 rounded-lg max-w-md w-full max-h-[90vh] overflow-y-auto text-black",children:[(0,l.jsx)("h2",{className:"text-2xl font-bold mb-4",children:w?"Edit Check In":"Check In"}),(0,l.jsxs)("form",{onSubmit:eh,children:[(0,l.jsxs)("div",{className:"mb-4",children:[(0,l.jsx)("label",{className:"block mb-2",children:"State"}),(0,l.jsxs)("select",{name:"stateId",value:I.stateId,onChange:eg,className:"w-full border p-2",required:!0,children:[(0,l.jsx)("option",{value:"",children:"Select a state"}),J.map(e=>(0,l.jsxs)("option",{value:e.id,children:[e.name," (",e.abbreviation,")"]},e.id))]})]}),I.stateId&&(0,l.jsxs)("div",{className:"mb-4",children:[(0,l.jsx)("label",{className:"block mb-2",children:"Post Type"}
1),(0,l.jsxs)("select",{name:"postType",value:I.postType,onChange:eg,className:"w-full border p-2",required:!0,children:[(0,l.jsx)("option",{value:"",children:"Select a type"}),(0,l.jsx)("option",{value:"Harvest",children:"Harvest"}),(0,l.jsx)("option",{value:"Catch",children:"Catch"}),(0,l.jsx)("option",{value:"Trail Cam",children:"Trail Cam"}),(0,l.jsx)("option",{value:"In the Field",children:"In the Field"})]})]}),I.stateId&&"Catch"===I.postType&&(0,l.jsxs)("div",{className:"mb-4",children:[(0,l.jsx)("label",{className:"block mb-2",children:"Body of Water"}),(0,l.jsxs)("select",{name:"bodyOfWater",value:I.bodyOfWater,onChange:eg,className:"w-full border p-2",required:!0,children:[(0,l.jsx)("option",{value:"",children:"Select a body of water"}),ee.map(e=>(0,l.jsx)("option",{value:e.name,children:e.name},e.id))]})]}),I.stateId&&"Catch"!==I.postType&&(0,l.jsxs)("div",{className:"mb-4",children:[(0,l.jsx)("label",{className:"block mb-2",children:(null==ea?void 0:ea.usesUnits)?"Hunt Unit":"County"}),(null==ea?void 0:ea.usesUnits)?(0,l.jsxs)("select",{name:"unit",value:I.unit,onChange:eg,className:"w-full border p-2",required:!0,children:[(0,l.jsx)("option",{value:"",children:"Select a hunt unit"}),Q.map(e=>(0,l.jsx)("option",{value:e.name,children:e.name},e.id))]}):(0,l.jsxs)("select",{name:"county",value:I.county,onChange:eg,className:"w-full border p-2",required:!0,children:[(0,l.jsx)("option",{value:"",children:"Select a county"}),_.map(e=>(0,l.jsx)("option",{value:e.name,children:e.name},e.id))]})]}),"Catch"!==I.postType&&(0,l.jsxs)("div",{className:"mb-4",children:[(0,l.jsx)("label",{className:"block mb-2",children:"Game Type"}),(0,l.jsxs)("select",{name:"gameType",value:I.gameType,onChange:eg,className:"w-full border p-2",required:!0,children:[(0,l.jsx)("option",{value:"",children:"Select a game type"}),null===(t=d.cC[I.postType])||void 0===t?void 0:t.map(e=>(0,l.jsx)("option",{value:e,children:e},e))]})]}),"Harvest"===I.postType&&(0,l.jsxs)("div",{className:"mb-4",children:[(0,l.jsx)("label",{className:"block mb-2",children:"Weapon"}),(0,l.jsxs)("select",{name:"weapon",value:I.weapon,onChange:eg,className:"w-full border p-2",children:[(0,l.jsx)("option",{value:"",children:"Select a weapon"}),(0,l.jsx)("option",{value:"Archery",children:"Archery"}),(0,l.jsx)("option",{value:"Firearm",children:"Firearm"})]})]}),"Harvest"===I.postType&&"Deer"===I.gameType&&(0,l.jsxs)("div",{className:"mb-4 border rounded p-3",children:[(0,l.jsxs)("div",{className:"flex items-center gap-4 mb-2",children:[(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)("button",{type:"button",className:"px-3 py-1.5 rounded-full border text-sm ".concat("self"===I.scoreType?"bg-primary text-white border-primary":"bg-white text-gray-700 hover:bg-gray-50"),onClick:()=>{C(e=>({...e,scoreType:"self"})),en||(er(!0),ec(!0))},children:"Self Score"}),(0,l.jsx)("button",{type:"button",className:"px-3 py-1.5 rounded-full border text-sm ".concat("official"===I.scoreType?"bg-primary text-white border-primary":"bg-white text-gray-700 hover:bg-gray-50"),onClick:()=>{C(e=>({...e,scoreType:"official"})),en||(er(!0),ec(!0))},children:"Official Score"})]}),(0,l.jsx)("span",{className:"ml-auto text-xs text-gray-500",children:"Optional"})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-3",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"block mb-1",children:"Score (inches, eighths allowed)"}),(0,l.jsx)("input",{type:"text",name:"scoreText",placeholder:"e.g., 145 7/8",value:I.scoreText,onChange:eg,className:"w-full border p-2"})]}),"official"===I.scoreType&&(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"block mb-1",children:"Official Score Sheet (required)"}),(0,l.jsx)("input",{type:"file",accept:"image/*",onChange:e=>{var t;return eo((null===(t=e.target.files)||void 0===t?void 0:t[0])||null)},className:"w-full"}),(ei||I.officialScoreSheetUrl)&&(0,l.jsx)("div",{className:"text-xs text-gray-600 mt-1",children:ei?ei.name:"Existing score sheet attached"})]})]})]}),(0,l.jsxs)("div",{className:"mb-4",children:[(0,l.jsx)("label",{className:"block mb-2",children:"Caption"}),(0,l.jsx)("textarea",{name:"caption",value:I.caption,onChange:eg,className:"w-full border p-2",required:!0})]}),(0,l.jsxs)("div",{className:"mb-4",children:[(0,l.jsx)("label",{className:"block mb-1 text-base font-medium",children:"Images (up to 10)"}),(0,l.jsx)("div",{className:"w-full h-20 flex flex-col items-center justify-center border-2 border-dashed border-gray-300 rounded-lg cursor-pointer hover:border-primary transition-colors hover:bg-gray-50",onClick:()=>document.getElementById("imageUploadInput").click(),children:(0,l.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,l.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})}),(0,l.jsxs)("p",{className:"text-gray-500 text-sm",children:["Drop images here, or click to select",(0,l.jsx)("span",{className:"text-xs block text-gray-400",children:"JPG, PNG, GIF (max 10)"})]})]})}),(0,l.jsx)("input",{id:"imageUploadInput",type:"file",accept:"image/*",onChange:e=>{let t=Array.from(e.target.files);if(t.length+S.length>10){alert("You can only upload up to 10 images");return}E([...S,...t]),U([...P,...t.map(e=>URL.createObjectURL(e))])},className:"hidden",multiple:!0})]}),P.length>0&&(0,l.jsxs)("div",{className:"mb-4",children:[(0,l.jsxs)("div",{className:"flex justify-between items-center mb-2",children:[(0,l.jsxs)("span",{className:"text-xs text-gray-600",children:[P.length," ",1===P.length?"image":"images"," selected"]}),(0,l.jsx)("button",{type:"button",onClick:()=>U([]),className:"text-xs text-red-500 hover:text-red-700",children:"Clear all"})]}),(0,l.jsxs)("div",{className:"grid grid-cols-3 sm:grid-cols-4 gap-2",children:[P.map((e,t)=>(0,l.jsx)("div",{className:"relative group rounded-lg overflow-hidden shadow-sm hover:shadow-md transform hover:-translate-y-1 transition-all duration-200",children:(0,l.jsxs)("div",{className:"aspect-square w-full relative bg-gray-100",children:[(0,l.jsx)(i.default,{src:e,alt:"Preview ".concat(t+1),layout:"fill",objectFit:"cover",className:"transition-all duration-300 ease-in-out group-hover:scale-105"}),(0,l.jsx)("div",{className:"absolute inset-0 bg-black bg-opacity-0 group-hover:bg-opacity-20 transition-all duration-200"}),(0,l.jsx)("div",{className:"absolute top-1 right-1 flex",children:(0,l.jsx)("button",{type:"button",onClick:()=>ev(t),className:"bg-black bg-opacity-70 text-white rounded-full p-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200 hover:bg-opacity-80 hover:bg-red-600","aria-label":"Remove image",children:(0,l.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})}),(0,l.jsx)("div",{className:"absolute bottom-0 left-0 right-0 p-1 bg-gradient-to-t from-black to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-200",children:(0,l.jsxs)("p",{className:"text-xs text-white truncate text-center",children:["Image ",t+1]})})]})},t)),P.length<10&&(0,l.jsxs)("div",{className:"aspect-square relative border-2 border-dashed border-gray-300 rounded-lg flex flex-col items-center justify-center cursor-pointer hover:border-primary transition-colors hover:bg-gray-50",onClick:()=>document.getElementById("imageUploadInput").click(),children:[(0,l.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 4v16m8-8H4"})}),(0,l.jsx)("span",{className:"text-xs text-gray-500 mt-1",children:"Add more"})]})]})]}),(0,l.jsxs)("div",{className:"mb-4",children:[(0,l.jsx)("label",{className:"block mb-1 text-base font-medium",children:"Video (max 100MB)"}),D?(0,l.jsxs)("div",{className:"relative",children:[(0,l.jsx)("div",{className:"aspect-video bg-gray-200 rounded-lg overflow-hidden",children:H?(0,l.jsxs)("div",{className:"w-full h-full",children:[(0,l.jsx)(g.Z,{playbackId:D.playbackId,thumbnailUrl:D.thumbnailUrl,autoPlay:!0,onHoverPlay:!1,show
1FullScreenButton:!0}),(0,l.jsx)("button",{type:"button",onClick:()=>Y(!1),className:"absolute top-2 left-2 bg-black bg-opacity-70 text-white rounded-full p-2 z-10 hover:bg-opacity-80","aria-label":"Exit playback",children:(0,l.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}):(0,l.jsx)("div",{className:"w-full h-full relative group cursor-pointer",onClick:()=>Y(!0),children:D.thumbnailUrl?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(i.default,{src:D.thumbnailUrl,alt:"Video thumbnail",width:320,height:180,layout:"responsive",objectFit:"cover",className:"w-full h-full transition-transform duration-300 group-hover:scale-105"}),(0,l.jsx)("div",{className:"absolute inset-0 flex items-center justify-center bg-black bg-opacity-0 group-hover:bg-opacity-30 transition-all duration-300",children:(0,l.jsx)("div",{className:"w-12 h-12 flex items-center justify-center rounded-full bg-black bg-opacity-60 group-hover:bg-opacity-70 transition-all transform group-hover:scale-110",children:(0,l.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"white",children:(0,l.jsx)("polygon",{points:"5,3 19,12 5,21"})})})})]}):(0,l.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,l.jsx)("span",{className:"text-gray-500",children:"Video ready to play"})})})}),(0,l.jsxs)("div",{className:"flex justify-between items-center mt-1",children:[(0,l.jsx)("span",{className:"text-xs text-gray-600",children:H?"Now playing":"Click thumbnail to play"}),(0,l.jsx)("button",{type:"button",onClick:()=>{F(null),z(null),L(0),R.current=null},className:"bg-red-500 text-white rounded-full p-1 hover:bg-red-600 transition-colors","aria-label":"Remove video",children:(0,l.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]}):W?(0,l.jsxs)("div",{className:"w-full border rounded-lg p-3 mb-3",children:[(0,l.jsx)("div",{className:"w-full bg-gray-200 h-3 rounded-full overflow-hidden",children:(0,l.jsx)("div",{className:"bg-primary h-full",style:{width:"".concat(M,"%")}})}),(0,l.jsx)("p",{className:"text-center text-sm mt-2",children:M<100?"Uploading: ".concat(M,"%"):"Processing video..."}),100===M&&(0,l.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"You can continue filling out the form and submit. The video will be processed in the background."})]}):(0,l.jsxs)("div",{className:"w-full h-20 flex items-center justify-center border-2 border-dashed border-gray-300 rounded-lg cursor-pointer hover:border-primary transition",onClick:()=>document.getElementById("videoUploadInput").click(),children:[(0,l.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,l.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z"})}),(0,l.jsxs)("p",{className:"text-gray-500 text-sm",children:["Click to upload a video",(0,l.jsx)("span",{className:"text-xs block text-gray-400",children:"MP4, MOV (max 100MB)"})]})]}),(0,l.jsx)("input",{id:"videoUploadInput",type:"file",accept:"video/*",onChange:eb,className:"hidden"})]})]}),(0,l.jsxs)("div",{className:"flex justify-end",children:[(0,l.jsx)(o.Z,{type:"button",onClick:j,variant:"outline",className:"mr-2 px-4 py-2 bg-gray-200 rounded",children:"Cancel"}),(0,l.jsx)(o.Z,{type:"submit",variant:"outline",className:"px-4 py-2 hover:bg-primary text-primary hover:text-white rounded",disabled:W&&M<100,children:w?"Update Check In":"Check In"})]})]})]}),es&&(0,l.jsx)(y.Vq,{open:es,onOpenChange:e=>{er(e),e||(q.current=Date.now()+250)},children:(0,l.jsxs)(y.cZ,{children:[(0,l.jsxs)(y.fK,{children:[(0,l.jsx)(y.$N,{children:"Scoring guidelines"}),(0,l.jsx)(y.Be,{children:(0,l.jsxs)("div",{className:"text-sm text-black space-y-2 mt-2",children:[(0,l.jsxs)("p",{children:[(0,l.jsx)("strong",{children:"Self Score"}),": Enter the gross score using standard Boone & Crockett system."]}),(0,l.jsxs)("p",{children:[(0,l.jsx)("strong",{children:"Official Score"}),": Enter the gross score and upload a picture of your official score sheet."]}),(0,l.jsx)("p",{className:"font-semibold mt-2",children:"The 4 standard B&C measurements:"}),(0,l.jsxs)("ol",{className:"list-decimal ml-5 space-y-1",children:[(0,l.jsx)("li",{children:"Main beam length: Measure each main beam from burr to tip, following curvature along the outer edge."}),(0,l.jsx)("li",{children:"Tine lengths: Measure each tine from base on the main beam to the tip. A point must be at least one inch and longer than its base width."}),(0,l.jsx)("li",{children:"Four circumference measurements per side between specified points on the main beam."}),(0,l.jsx)("li",{children:"Inside spread: Widest point between main beams, perpendicular to the skull."})]}),(0,l.jsx)("p",{className:"mt-2",children:"Any trophies/prizes awarded by The Check Station require an official score by a certified B&C measurer."})]})})]}),(0,l.jsx)("div",{className:"flex justify-end",children:(0,l.jsx)(o.Z,{type:"button",variant:"default",size:"sm",onClick:()=>er(!1),className:"px-4 py-2 font-semibold text-white",children:"Got it"})})]})})]}):null}},70255:function(e,t,a){a.d(t,{O$:function(){return n},kK:function(){return r}});var l=a(66862),s=a(47743);let r=(0,l.hg)("platformVisibility/fetch",async(e,t)=>{let{rejectWithValue:a}=t;
1try{return await (0,s.kK)()}catch(e){return a((null==e?void 0:e.message)||"Failed to load platform visibility")}}),i=Object.freeze({hiddenPostTypes:[],hiddenGameTypes:[]}),o=(0,l.oM)({name:"platformVisibility",initialState:{config:null,loaded:!1,error:null},extraReducers:e=>{e.addCase(r.fulfilled,(e,t)=>{e.config=t.payload,e.loaded=!0,e.error=null}).addCase(r.rejected,(e,t)=>{e.error=t.payload||"Failed to load",e.loaded=!0})}}),n=e=>{var t,a,l;return null!==(l=null===(a=e.platformVisibility)||void 0===a?void 0:null===(t=a.config)||void 0===t?void 0:t.web)&&void 0!==l?l:i};t.ZP=o.reducer}}]);
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.