PageSourceSearch

https://drophighlight.com/assets/VideoPlayer-B7NWFJpy.js

js drophighlight.com collected 2026-09-30 06:37:27 UTC 18,295 bytes, 29 lines download raw bytes

1import{p as b,m as $e,f as Fe,n as He,a as Ue,q as Be,r as o,s as g,j as t,B as m,t as Y,X as Oe,S as Xe,o as Ge,C as We,l as Je,T as Ze,v as p}from"./index-P0N1Je5T.js";import{I as Ke}from"./input-1tKBwIjz.js";import{u as Qe,a as Ye,b as et,c as tt,L as at,S as st}from"./useVideoPlaybackLogger-tNk5b0nL.js";import{a as rt}from"./internationalization-ClDqWLdo.js";import{P as ee}from"./pause-DHdaaDAk.js";import{P as te}from"./play-B168p-g_.js";import{H as nt}from"./heart-Bg-oQPy7.js";import{S as ot}from"./share-2-D2yJBwlq.js";import{D as it}from"./download-JbV5bimG.js";import{S as ae}from"./star-D5Er7kP8.js";import"./useFanSession-CbNndObm.js";import"./label-CoHN_xq2.js";import"./checkbox-wSZ1kz90.js";import"./user-CvuxPiRQ.js";import"./eye-BxqX1t91.js";import"./proxy-D6BoR0p8.js";import"./frame-D7tGqiwN.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const lt=b("Maximize",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]);/**
7 * @license lucide-react v0.462.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const ct=b("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/**
12 * @license lucide-react v0.462.0 - ISC
13 *
14 * This source code is licensed under the ISC license.
15 * See the LICENSE file in the root directory of this source tree.
16 */const dt=b("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/**
17 * @license lucide-react v0.462.0 - ISC
18 *
19 * This source code is licensed under the ISC license.
20 * See the LICENSE file in the root directory of this source tree.
21 */const mt=b("VolumeX",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]);function Mt(){const{contentId:c}=$e(),_=Fe(),{toast:h}=He(),{invalidateDownloads:se}=Qe(),{t:i,language:re}=Ue(),{company:f}=Be(),l=o.useRef(null),j=o.useRef(),[a,ne]=o.useState(null),[oe,ie]=o.useState(!0),[u,k]=o.useState(!1),[y,M]=o.useState(!1),[le,ce]=o.useState(1),[L,I]=o.useState(0),[T,de]=o.useState(0),[me,q]=o.useState(!0),[N,V]=o.useState(!1),[ue,C]=o.useState(0),[S,he]=o.useState([]),[z,ge]=o.useState(!1),[D,A]=o.useState(!1),[x,R]=o.useState(""),[$,F]=o.useState(""),[pe,H]=o.useState(0),[U,B]=o.useState(!1),[O,P]=o.useState(!1),[X,G]=o.useState(!1),{session:v,saveSession:fe,isSessionValid:ye}=Ye(a==null?void 0:a.company_id),{trackView:xe}=et(),{logPlaybackError:ve,logPlaybackSuccess:we,checkVideoSupport:ut}=tt(),[W]=o.useState(()=>localStorage.getItem("video_session")||Math.random().toString(36).substring(2,15));o.useEffect(()=>{localStorage.setItem("video_session",W)},[W]),o.useEffect(()=>{var d;if(!a)return;const e=`${a.title} | Drop Highlight`;document.title=e;const n=(((d=a.description)==null?void 0:d.trim())||`Watch "${a.title}" on Drop Highlight — own the moment with high quality video content.`).slice(0,300),s=(ze,De,Ae,Re)=>{let w=document.querySelector(ze);w||(w=document.createElement("meta"),w.setAttribute(De,Ae),document.head.appendChild(w)),w.setAttribute("content",Re)};s('meta[name="description"]',"name","description",n),s('meta[property="og:title"]',"property","og:title",e),s('meta[property="og:description"]',"property","og:description",n),s('meta[property="og:url"]',"property","og:url",window.location.href),s('meta[name="twitter:title"]',"name","twitter:title",e),s('meta[name="twitter:description"]',"name","twitter:description",n);let r=document.querySelector('link[rel="canonical"]');r||(r=document.createElement("link"),r.rel="canonical",document.head.appendChild(r)),r.href=window.location.href.split("?")[0]},[a]),o.useEffect(()=>{c&&(be(),_e(),J())},[c]),o.useEffect(()=>{a&&(Z("view"),xe(a.id,a.company_id,"video"))},[a]),o.useEffect(()=>{if(!u||!a)return;const e=setInterval(()=>{l.current&&je(10,l.current.duration)},1e4);return()=>clearInterval(e)},[u,a]);const be=async()=>{var e,n;if(c)try{console.log("VideoPlayer: Fetching content with ID:",c);const{data:s,error:r}=await g.from("content").select(`
22          *,
23          events(
24            id,
25            name,
26            allow_public_access,
27            status
28          )
29        `).eq("id",c).eq("status","published").maybeSingle();if(console.log("VideoPlayer: Content query result:",{data:s,error:r}),r)throw console.error("VideoPlayer: Error details:",{message:r.message,code:r.code,details:r.details,hint:r.hint}),r.code==="PGRST116"||(e=r.message)!=null&&e.includes("row-level security")?new Error(i("videoPlayer.contentNotAvailable")):r;if(!s)throw new Error(i("videoPlayer.contentNotFound"));const d=!s.event_id||s.events&&s.events.allow_public_access;console.log("VideoPlayer: Content access check:",{title:s.title,hasEvent:!!s.event_id,isPublicEvent:(n=s.events)==null?void 0:n.allow_public_access,isPublicContent:d}),console.log("VideoPlayer: Content loaded successfully:",s.title),ne(s)}catch(s){console.error("VideoPlayer: Error fetching content:",s);let r=i("videoPlayer.loadErrorDescription");s.message?r=s.message:s.code==="PGRST116"&&(r=i("videoPlayer.contentNotPublic")),h({title:i("videoPlayer.loadError"),description:r,variant:"destructive"})}finally{ie(!1)}},_e=async()=>
29{if(c)try{const{count:e}=await g.from("video_interactions").select("*",{count:"exact",head:!0}).eq("content_id",c).eq("interaction_type","like");C(e||0)}catch(e){console.error("Error fetching interactions:",e)}},J=async()=>{if(c)try{const{data:e,error:n}=await g.from("video_comments").select("*").eq("content_id",c).eq("status","approved").order("created_at",{ascending:!1});if(n)throw n;he((e||[]).map(s=>({id:s.id,user_name:s.user_name,comment:s.comment||s.comment_text||"",rating:s.rating,created_at:s.created_at})))}catch(e){console.error("Error fetching comments:",e)}},Z=async e=>{if(!(!c||!a))try{const n={content_id:c,company_id:a.company_id,interaction_type:e};await g.from("video_interactions").insert(n)}catch(n){console.error("Error tracking interaction:",n)}},je=async(e,n)=>{if(!(!c||!e||!a))try{const s={content_id:c,company_id:a.company_id,interaction_type:"watch_time",watch_time_seconds:e};await g.from("video_interactions").insert(s)}catch(s){console.error("Error tracking watch time:",s)}},ke=async()=>{if(!(!c||!a))try{if(N)V(!1),C(e=>e-1);else{const e={content_id:c,company_id:a.company_id,interaction_type:"like"};await g.from("video_interactions").insert(e),V(!0),C(n=>n+1)}}catch(e){console.error("Error handling like:",e),h({title:i("videoPlayer.likeError"),description:i("videoPlayer.likeErrorDescription"),variant:"destructive"})}},Ne=async()=>{var e,n,s;if(!(!c||!x.trim()||!a)){if(x.trim().length>500){h({title:i("videoPlayer.commentError"),description:"Comment too long (max 500 characters)",variant:"destructive"});return}if($.trim().length>50){h({title:i("videoPlayer.commentError"),description:"Name too long (max 50 characters)",variant:"destructive"});return}B(!0);try{const{error:r}=await g.from("video_comments").insert({content_id:c,comment:x.trim(),status:"pending"});if(r)throw r;R(""),F(""),H(0),J(),h({title:i("videoPlayer.commentSuccess"),description:i("videoPlayer.commentSuccessDescription")})}catch(r){console.error("Error submitting comment:",r);let d=i("videoPlayer.commentErrorDescription");(e=r.message)!=null&&e.includes("Rate limit exceeded")?d="Too many comments. Please wait before posting again.":(n=r.message)!=null&&n.includes("Invalid characters")?d="Comment contains invalid characters. Please remove any HTML or script tags.":(s=r.message)!=null&&s.includes("too long")&&(d=r.message),h({title:i("videoPlayer.commentError"),description:d,variant:"destructive"})}finally{B(!1)}}},Ce=()=>{A(!0)},Se=async()=>{a!=null&&a.file_url&&(await p.logDownloadStart(a.id),!a.require_lead||ye()?await K():(await p.logLeadCaptureStart(a.id),P(!0)))},K=async e=>{if(a){console.log("🔄 Starting download process for:",a.title),console.log("📋 Content details:",{id:a.id,file_url:a.file_url,require_lead:a.require_lead,company_id:a.company_id,event_id:a.event_id}),G(!0);try{const n=e||v&&{email:v.email,first_name:v.first_name,last_name:v.last_name,marketing_consent:v.marketing_consent};
29if(a.require_lead&&n){const s={contentId:a.id,companyId:a.company_id,eventId:a.event_id||null,email:n.email,first_name:n.first_name,last_name:n.last_name,consent_given:e?!!e.consent_given:void 0,privacy_policy_accepted:e?!!e.privacy_policy_accepted:void 0,marketing_consent:e?!!e.marketing_consent:n.marketing_consent,fan_session_id:(()=>{try{const r=localStorage.getItem("fan_session");return r?JSON.parse(r).id:null}catch{return null}})()};console.log("📡 Calling capture-lead function with:",{...s,email:"***"});try{const{data:r,error:d}=await g.functions.invoke("capture-lead",{body:s});if(console.log("📥 Capture-lead response:",{data:r,error:d}),d)throw console.error("❌ Error calling capture-lead function:",d),await p.logLeadCaptureError(a.id,d.message),d;if(!(r!=null&&r.success))throw console.error("❌ Lead capture not authorized:",r),await p.logLeadCaptureError(a.id,(r==null?void 0:r.error)||"Erro na captura de lead"),new Error((r==null?void 0:r.error)||"Erro na captura de lead");await p.logLeadCaptureSuccess(a.id),e&&fe(e.email,{first_name:e.first_name,last_name:e.last_name,marketing_consent:!!e.marketing_consent})}catch(r){throw await p.logLeadCaptureError(a.id,r.message),r}}if(a.file_url){const s=document.createElement("a");s.href=a.file_url,s.download=a.file_name||"download",s.target="_blank",document.body.appendChild(s),s.click(),document.body.removeChild(s),Z("download"),h({title:i("videoPlayer.downloadSuccess"),description:i("videoPlayer.downloadSuccessDescription")}),await p.logDownloadSuccess(a.id),se()}}catch(n){console.error("❌ Download error:",n),await p.logDownloadError(a.id,n.message),h({title:i("videoPlayer.downloadError"),description:n.message||i("videoPlayer.downloadErrorDescription"),variant:"destructive"})}finally{G(!1)}}},Pe=async e=>{P(!1),await K(e)},E=o.useCallback(()=>{l.current&&(u?l.current.pause():l.current.play(),k(!u))},[u]),Ee=o.useCallback(()=>{l.current&&(l.current.muted=!y,M(!y))},[y]),Me=o.useCallback(e=>{l.current&&(l.current.volume=e,ce(e),M(e===0))},[]),Le=o.useCallback(e=>{l.current&&(l.current.currentTime=e,I(e))},[]),Ie=o.useCallback(()=>{l.current&&(document.fullscreenElement?document.exitFullscreen():l.current.requestFullscreen())},[]),Te=o.useCallback(()=>{l.current&&I(l.current.currentTime)},[]),qe=o.useCallback(()=>{l.current&&de(l.current.duration)},[]),Ve=o.useCallback(()=>{q(!0),j.current&&clearTimeout(j.current),j.current=setTimeout(()=>{u&&q(!1)},3e3)},[u]),Q=e=>{const n=Math.floor(e/60),s=Math.floor(e%60);return`${n}:${s.toString().padStart(2,"0")}`};return oe?t.jsx("div",{className:"min-h-screen bg-black flex items-center justify-center",children:t.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-white"})}):a?t.jsxs("div",{className:"min-h-screen bg-black relative",children:[t.jsx(m,{variant:"ghost",size:"icon",className:"fixed top-4 right-4 z-50 text-white/70 hover:text-white hover:bg-white/20 bg-black/40 backdrop-blur-sm rounded-full h-10 w-10",onClick:()=>_(-1),"aria-label":i("common.back"),children:t.jsx(Oe,{className:"h-5 w-5"})}),t.jsxs("div",{className:"relative w-full max-w-6xl mx-auto aspect-video bg-black",onMouseMove:Ve,onClick:E,children:[t.jsx("video",{ref:l,src:a.file_url,poster:a.thumbnail_url,className:"w-full h-full object-contain",onTimeUpdate:Te,onLoadedMetadata:qe,onPlay:()=>k(!0),onPause:()=>k(!1),onError:e=>{const n=e.currentTarget,s=n.error;s&&ve({code:s.code,message:s.message},n)},onCanPlay:()=>{we(a.file_name,a.category)}}),t.jsxs("div",{className:`absolute inset-0 bg-gradient-to-t from-black/80 via-transparent to-black/40 transition-opacity duration-300 ${me?"opacity-100":"opacity-0"}`,onClick:e=>e.stopPropagation(),children:[t.jsxs("div",{className:"absolute top-0 left-0 right-0 p-4 flex items-center justify-between",children:[t.jsx(m,{variant:"ghost",size:"icon",className:"text-white hover:bg-white/20",onClick:()=>_(-1),"aria-label":i("common.back"),children:t.jsx(Y,{className:"h-6 w-6"})}),t.jsx("div",{className:"text-white text-lg font-medium truncate max-w-md",children:a.title}),t.jsx(m,{variant:"ghost",size:"icon",className:"text-white hover:bg-white/20","aria-label":"Settings",children:t.jsx(Xe,{className:"h-6 w-6"})})]}),t.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:t.jsx(m,{variant:"ghost",size:"icon",className:"w-20 h-20 rounded-full bg-white/20 hover:bg-white/30 text-white",onClick:E,"aria-label":u?"Pause":"Play",children:u?t.jsx(ee,{className:"h-10 w-10"}):t.jsx(te,{className:"h-10 w-10 ml-1"})})}),t.jsxs("div",{className:"absolute bottom-0 left-0 right-0 p-4 space-y-2",children:[t.jsxs("div",{className:"flex items-center gap-2 text-white text-sm",children:[t.jsx("span",{children:Q(L)}),t.jsx("input",{type:"range",min:0,max:T||100,value:L,onChange:e=>Le(parseFloat(e.target.value)),className:"flex-1 h-1 bg-white/30 rounded-full appearance-none cursor-pointer"}),t.jsx("span",{children:Q(T)})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(m,{variant:"ghost",size:"icon",className:"text-white hover:bg-white/20",onClick:E,"aria-label":u?"Pause":"Play",children:u?t.jsx(ee,{className:"h-5 w-5"}):t.jsx(te,{className:"h-5 w-5"})}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(m,{variant:"ghost",size:"icon",className:"text-white hover:bg-white/20",onClick:Ee,"aria-label":y?"Unmute":"Mute",children:y?t.jsx(mt,{className:"h-5 w-5"}):t.jsx(dt,{className:"h-5 w-5"})}),t.jsx("input",{type:"range",min:0,max:1,step:.1,value:y?0:le,onChange:e=>Me(parseFloat(e.target.value)),className:"w-20 h-1 bg-white/30 rounded-full appearance-none cursor-pointer","aria-label":"Volume"})]})]}),t.jsx("div",{className:"flex items-center gap-2",children:t.jsx(m,{variant:"ghost",size:"icon",className:"text-white hover:bg-white/20",onClick:Ie,"aria-label":"Toggle fullscreen",children:t.jsx(lt,{className:"h-5 w-5"})})})]})]})]})]}),t.jsxs("div",{className:"max-w-6xl mx-auto p-4 space-y-4",children:[t.jsx("div",{className:"flex items-start justify-between",children:t.jsxs("div",{children:[t.jsx("h1",{className:"text-2xl font-bold text-white",children:a.title}),a.description&&t.jsx("p",{className:"text-gray-400 mt-2",children:a.description}),a.category&&t.jsx(Ge,{variant:"secondary",className:"mt-2",children:a.category})]})}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs(m,{variant:N?"default":"outline",onClick:ke,className:"flex items-center gap-2",children:[t.jsx(nt,{className:`h-5 w-5 ${N?"fill-current":""}`}),t.jsx("span",{children:ue})]}),t.jsxs(m,{variant:"outline",onClick:()=>ge(!z),className:"flex items-center gap-2",children:[t.jsx(ct,{className:"h-5 w-5"}),t.jsx("span",{children:S.length})]}),t.jsxs(m,{variant:"outline",onClick:Ce,className:"flex items-center gap-2",children:[t.jsx(ot,{className:"h-5 w-5"}),i("common.share")]}),t.jsxs(m,{onClick:Se,disabled:X,className:"flex items-center gap-2",children:[t.jsx(it,{className:"h-5 w-5"}),i(X?"common.processing":"common.download")]})]}),z&&t.jsx(We,{className:"bg-gray-900 border-gray-800",children:t.jsxs(Je,{className:"p-4 space-y-4",children:[t.jsx("h2",{className:"text-lg font-medium text-white",children:i("videoPlayer.comments")}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Ke,{placeholder:i("videoPlayer.yourName"),value:$,onChange:e=>F(e.target.value),className:"bg-gray-800 border-gray-700 text-white"}),t.jsx(Ze,{placeholder:i("videoPlayer.writeComment"),value:x,onChange:e=>R(e.target.value),className:"bg-gray-800 border-gray-700 text-white"}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("span",{className:"text-sm text-gray-400",children:[i("videoPlayer.rating"),":"]}),[1,2,3,4,5].map(e=>t.jsx(m,{variant:"ghost",size:"icon",onClick:()=>H(e),className:e<=pe?"text-yellow-500":"text-gray-600","aria-label":`Rate ${e} star${e>1?"s":""}`,children:t.jsx(ae,{className:"h-5 w-5"})},e))]}),t.jsx(m,{onClick:Ne,disabled:U||!x.trim(),children:i(U?"common.sending":"videoPlayer.postComment")})]}),t.jsxs("div",{className:"space-y-3",children:[S.map(e=>t.jsxs("div",{className:"bg-gray-800 p-3 rounded-lg",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[t.jsx("span",{className:"font-medium text-white",children:e.user_name||"Anônimo"}),e.rating&&t.jsx("div",{className:"flex",children:[1,2,3,4,5].map(n=>t.jsx(ae,{className:`h-3 w-3 ${n<=e.rating?"text-yellow-500 fill-current":"text-gray-600"}`},n))}),t.jsx("span",{className:"text-xs text-gray-500",children:rt(e.created_at,re)})]}),t.jsx("p",{className:"text-gray-300",children:e.comment})]},e.id)),S.length===0&&t.jsx("p",{className:"text-gray-500 text-center py-4",children:i("videoPlayer.noComments")})]})]})})]}),O&&a&&t.jsx(at,{isOpen:O,onClose:()=>P(!1),contentTitle:a.title,onSubmit:async e=>{await Pe(e)},companyName:f==null?void 0:f.name,companySlug:f==null?void 0:f.slug}),D&&a&&t.jsx(st,{isOpen:D,onClose:()=>A(!1),url:window.location.href,title:a.title,contentId:a.id,companyId:a.c
29ompany_id})]}):t.jsx("div",{className:"min-h-screen bg-black flex items-center justify-center",children:t.jsxs("div",{className:"text-center text-white",children:[t.jsx("h2",{className:"text-2xl font-bold mb-4",children:i("videoPlayer.contentNotFound")}),t.jsxs(m,{onClick:()=>_(-1),variant:"outline",children:[t.jsx(Y,{className:"mr-2 h-4 w-4"}),i("common.back")]})]})})}export{Mt 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.