UNPKG

cloudinary-video-player

Version:

Cloudinary Video Player

2 lines 454 kB
/*! For license information please see player.js.LICENSE.txt */ var e,t,i={7878:e=>{const t=e=>{e.style.display="none"},i=e=>{e.style.display=""};e.exports={hide:t,show:i,setText:(e,s)=>{if(!s||s.length<=0)return e.innerText="",void t(e);e.innerText=s,i(e)}}},7668:(e,t,i)=>{i.d(t,{A:()=>o});var s=i(6673),n=i.n(s);var r=i(608);const o={logoOnclickUrl:"https://cloudinary.com/",showLogo:!0,showJumpControls:!1,playsinline:n().browser.IS_IOS,skin:"dark",controls:!1,chaptersButton:!1,pictureInPictureToggle:!1,seekThumbnails:!0,aiHighlightsGraph:!1,visualSearch:!1,download:!1,preload:r.Am.AUTO,textTrackSettings:!1,loop:!1,muted:!1,posterOptions:{},sourceTypes:["auto"],contextMenu:{content:e=>{const t=e.loop(),i=e.paused(),s=e.muted(),n=e.isFullscreen(),r={class:"player-version",label:"Cloudinary Player v3.2.1"};return e.controls()?[{label:t?"Unloop":"Loop",listener:()=>{e.loop(!t)}},{label:i?"Play":"Pause",listener:()=>{i?e.play():e.pause()}},{label:s?"Unmute":"Mute",listener:()=>{e.muted(!s)}},{label:n?"Exit Fullscreen":"Fullscreen",listener:()=>{n?e.exitFullscreen():e.requestFullscreen()}},r]:[r]}},floatingWhenNotVisible:r.rT.NONE,hideContextMenu:!1,analytics:!1,cloudinaryAnalytics:!0,allowUsageReport:!0,playedEventPercents:[25,50,75,100],adaptiveStreaming:{strategy:"balanced"},html5:{handlePartialData:!1,nativeTextTracks:!1},disableSeekWhileScrubbingOnMobile:!0}},6752:(e,t,i)=>{i.d(t,{A:()=>yt});var s=i(7171),n=i.n(s),r=i(6673),o=i.n(r);const a={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let l;const c=new Uint8Array(16);function h(){if(!l){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");l=crypto.getRandomValues.bind(crypto)}return l(c)}const u=[];for(let e=0;e<256;++e)u.push((e+256).toString(16).slice(1));const d=function(e,t,i){if(a.randomUUID&&!t&&!e)return a.randomUUID();const s=(e=e||{}).random||(e.rng||h)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t){i=i||0;for(let e=0;e<16;++e)t[i+e]=s[e];return t}return function(e,t=0){return(u[e[t+0]]+u[e[t+1]]+u[e[t+2]]+u[e[t+3]]+"-"+u[e[t+4]]+u[e[t+5]]+"-"+u[e[t+6]]+u[e[t+7]]+"-"+u[e[t+8]]+u[e[t+9]]+"-"+u[e[t+10]]+u[e[t+11]]+u[e[t+12]]+u[e[t+13]]+u[e[t+14]]+u[e[t+15]]).toLowerCase()}(s)};var p=i(5685),f=i.n(p),g=i(2832),m=i.n(g),y=i(8446),v=i.n(y),_=i(8953),b=i.n(_),w=i(7571),T=i.n(w);const C=o().getComponent("ClickableComponent");o().registerComponent("JumpForwardButton",class extends C{handleClick(e){super.handleClick(e),this.player().currentTime(this.player().currentTime()+10)}createEl(){return o().dom.createEl("button",{className:"vjs-control vjs-icon-skip-10-plus vjs-icon-forward-10 vjs-button",ariaLabel:"Jump forward 10 seconds"})}});const k=o().getComponent("ClickableComponent");o().registerComponent("JumpBackButton",class extends k{handleClick(e){super.handleClick(e),this.player().currentTime(this.player().currentTime()-10)}createEl(){return o().dom.createEl("button",{className:"vjs-control vjs-icon-skip-10-min vjs-icon-replay-10 vjs-button",ariaLabel:"Jump back 10 seconds"})}});const S=o().getComponent("ClickableComponent");o().registerComponent("logoButton",class extends S{createEl(){const e=this.options_.playerOptions,t=e.showLogo?"block":"none",i=e.logoImageUrl?`background-image: url(${e.logoImageUrl})`:"";return o().dom.createEl("a",{},{class:"vjs-control vjs-cloudinary-button vjs-button",href:e.logoOnclickUrl,target:"_blank",style:`display: ${t}; ${i}`,"aria-label":"Logo link"})}});const x=o().getComponent("Component");o().registerComponent("progressControlEventsBlocker",class extends x{constructor(e){super(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{})}createEl(){return super.createEl("div",{className:"vjs-progress-control-events-blocker"})}});var E=i(7878),j=i.n(E),A=i(8033);const P=o().dom||o(),O=o().getComponent("Component");o().registerComponent("titleBar",class extends O{constructor(e){super(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}),this.on(e,"cldsourcechanged",((e,t)=>{let{source:i}=t;return this.setItem(i)}))}setItem(e){if(!e)return this.setTitle(""),void this.setDescription("");const t=e.info();this.setTitle(t.title),this.setDescription(t.subtitle);const i=e.title&&!0===e.title(),s=e.description&&!0===e.description();(i||s)&&this.fetchAutoMetadata(e,i,s)}fetchAutoMetadata(e,t,i){if(e.isRawUrl)return;const s=e.cloudinaryConfig(),n=e.publicId();if(!s?.cloud_name||!n)return;const r=(0,A.k$)(s),o=e.getInitOptions().type||"upload";fetch(`${r}/_applet_/video_service/video_metadata/${o}/${n}.json`).then((e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()})).then((e=>{t&&e.title&&this.setTitle(e.title),i&&e.description&&this.setDescription(e.description)})).catch((e=>{console.warn(`Failed to fetch metadata for ${n}:`,e)}))}setTitle(e){const t="string"==typeof e?e:"";return j().setText(this.titleEl,t),this.refresh(),t}setDescription(e){const t="string"==typeof e?e:"";return j().setText(this.descriptionEl,t),this.refresh(),t}refresh(){(()=>this.titleEl.innerText)()||(()=>this.descriptionEl.innerText)()?this.show():this.hide()}createEl(){this.titleEl=P.createEl("div",{className:"vjs-title-bar-title"}),this.descriptionEl=P.createEl("div",{className:"vjs-title-bar-subtitle"});const e=super.createEl("div",{append:this.titleEl,className:"vjs-title-bar"});return e.appendChild(this.titleEl),e.appendChild(this.descriptionEl),e}});var I="3.0.1";const M=o().getTech("Html5"),L=o().registerPlugin||o().plugin,D=["abort","emptied","loadstart","play"],N=["abort","emptied"],R=["ad-playback","ads-ready?","postroll?","preroll?"];let F=0;const B=function(){const e=[];let t,i,s=!1,n=!0;const r=t=>function(i,s){if(this.perSourceBehaviors.disabled())return;const n=2===arguments.length,r=this.currentSrc(),o=[i],a=arguments[arguments.length-1],l=n?this:i,c=a.bind(l),h=(...e)=>{const i=this.currentSrc()!==r;this.perSourceBehaviors.disabled()||((i||t)&&this.off(...o),i||c(...e))};return h.guid=c.guid=a.guid="psb-"+ ++F,n||o.push(s),o.push(h),e.push(o),this.on(...o)};this.perSourceBehaviors={disable:function(){return this.clearTimeout(i),i=null,s=!0,s}.bind(this),disabled:()=>s,enable:()=>(s=!1,s),enabled:()=>!s,isSrcStable:()=>n,VERSION:I},this.onPerSrc=r(),this.onePerSrc=r(!0),this.on("dispose",(()=>{e.length=0})),this.on(D,(s=>{if(this.perSourceBehaviors.disabled()||i||((e,t)=>{return!!e.usingPlugin("ads")&&((e=>e.usingPlugin("ads")&&"function"==typeof e.ads.inAdBreak)(e)?e.ads.isInAdMode()&&"loadstart"!==t.type:(i=e.ads.state,R.indexOf(i)>-1));var i})(this,s))return;n&&N.indexOf(s.type)>-1&&(n=!1,this.trigger("sourceunstable"));const r=[],o=e=>r.push({time:Date.now(),event:e});o(s),this.on(M.Events,o),i=this.setTimeout((()=>{const s=this.currentSrc();n=!0,i=null,this.off(M.Events,o),s&&s!==t&&(e.forEach((e=>this.off(...e))),e.length=0,this.trigger("sourcechanged",{interimEvents:r,from:t,to:s}),t=s)}),1)}))};B.VERSION=I,L("perSourceBehaviors",B);let H={};const V=function(){function e(e,t){return this.player=e,this.options=t,this.initializeHighlightsGraph(),this}return e.prototype.src=function(e){this.resetPlugin(),this.options.src=e,this.initializeHighlightsGraph()},e.prototype.detach=function(){this.resetPlugin()},e.prototype.resetPlugin=function(){this.graphHolder&&this.graphHolder.parentNode.removeChild(this.graphHolder),delete this.progressBar,delete this.graphHolder,delete this.lastStyle},e.prototype.initializeHighlightsGraph=function(){this.options.src&&fetch(this.options.src,{credentials:this.player.cloudinary.source?.().withCredentials?"include":"omit"}).then((e=>e.json())).then((e=>{this.setupHighlightsGraphElement(),this.graphHolder&&this.createHighlightsGraph(e)}))},e.prototype.setupHighlightsGraphElement=function(){if(this.progressBar=this.player.$(".vjs-progress-control"),!this.progressBar)return;const e=this.player.$(".vjs-highlights-graph-display")||document.createElement("div");e.setAttribute("class","vjs-highlights-graph-display"),this.progressBar.appendChild(e),this.graphHolder=e},e.prototype.createPath=function(e,t,i){const s=t/(e.length-1),n=e.map(((e,t)=>({x:t*s,y:i-e*i}))),r=document.createElementNS("http://www.w3.org/2000/svg","path");r.setAttribute("fill","lightblue");let o=`M ${n[0].x},${n[0].y}`;for(let e=0;e<n.length-1;e++){const t=(n[e].x+n[e+1].x)/2,i=(n[e].y+n[e+1].y)/2;o+=` Q ${n[e].x},${n[e].y} ${t},${i}`}return o+=` Q ${n[n.length-1].x},${n[n.length-1].y} ${n[n.length-1].x},${n[n.length-1].y}`,o+=` L ${n[n.length-1].x},${i} L ${n[0].x},${i} Z`,r.setAttribute("d",o),r},e.prototype.createHighlightsGraph=function(e){const t=e.data,i=this.player.$(".vjs-highlights-graph-display > svg")||document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("viewBox","0 0 600 20"),i.setAttribute("preserveAspectRatio","none"),i.setAttribute("width",600),i.setAttribute("height",20),i.innerHTML="";const s=this.createPath(t,600,20);i.appendChild(s),this.graphHolder.appendChild(i)},e}();var $=i(5871),z=i(6827),U=i.n(z),W=i(1104);const q={percentsplayed:{percents:[25,50,75,100]}},K={events:[W.f.PERCENTS_PLAYED,W.f.PAUSE_NO_SEEK,W.f.SEEK,W.f.MUTE,W.f.UNMUTE,W.f.QUALITY_CHANGED]};class G extends(U()){constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),this.player=e;const i=o().obj.merge(K,t);let s={lastState:void 0},n=0,r=0,a=!1,l=[],c=[],h=null,u=!1;const d=()=>{l=[],c=[]};this.events=Y(i.events,q),s={lastState:void 0},n=r=0,a=!1,d(),this.player.on(W.f.PLAY,(()=>{u&&(this.player.trigger("replay"),u=!1)}).bind(this)),this.player.on(W.f.ENDED,(()=>{u=!0}).bind(this)),(this.events.percentsplayed||this.events.timeplayed||this.events.seek||this.events.totaltimeplayed)&&this.player.on(W.f.TIME_UPDATE,(e=>{const t=this.player.currentTime(),i=this.player.duration(),s=(t,i)=>{i.originalType="timeupdate",this.emit(t,e,i)};if(this.events.percentsplayed&&this.events.percentsplayed.percents.forEach((e=>{X(t,i,e)&&-1===l.indexOf(e)&&(l.push(e),s(W.f.PERCENTS_PLAYED,{percent:e}))})),this.events.timeplayed){const e=this.events.timeplayed;(e.interval?[Math.floor(t/e.interval)*e.interval]:e.times).forEach((e=>{J(t,e)&&-1===c.indexOf(e)&&(c.push(e),s(W.f.TIME_PLAYED,{time:e}))}))}this.events.seek&&(n=r,r=t,Math.abs(n-r)>1&&(a=!0,d(),s(W.f.SEEK,{seekStart:n,seekEnd:r})))}).bind(this)),(this.events.mute||this.events.unmute)&&this.player.on(W.f.VOLUME_CHANGE,(e=>{this.player.muted()&&"muted"!==s.lastState?(s.lastState="muted",this.emit(W.f.MUTE,e)):this.player.muted()||"unmuted"===s.lastState||(s.lastState="unmuted",this.emit(W.f.UNMUTE,e))}).bind(this)),this.events.pausenoseek&&(this.player.on(W.f.PAUSE,(e=>{Math.round(this.player.currentTime())===Math.round(this.player.duration())||a||this.emit(W.f.PAUSE_NO_SEEK,e)}).bind(this)),this.player.on(W.f.PLAY,(()=>{a=!1}).bind(this))),this.player.on(W.f.LOADED_METADATA,(()=>{this.player.currentSource().src!==h&&(d(),h=this.player.currentSource().src)}).bind(this)),this.player.on(W.f.LOADED_DATA,(e=>{let t=this,i=this.player.textTracks(),s=null;for(let e=0;e<i.length;e++)"segment-metadata"===i[e].label&&(s=i[e]);let n=null;s&&s.on("cuechange",(function(){let i=s.activeCues[0];if(i){let s=i.value.resolution;if(n!==s){let i={from:n,to:s};t.emit(W.f.QUALITY_CHANGED,e,i)}n=s}}))}).bind(this))}}const Y=(e,t)=>{let i=e;return"Array"===e.constructor.name&&(i=e.reduce(((e,i)=>{const s=t[i]||{};return b()(i)?e[i.type]=Object.assign({},s,i):e[i]=s,e}),{})),i},X=function(e,t,i){return J(e,t*i/100,arguments.length>3&&void 0!==arguments[3]?arguments[3]:.5)},J=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.5;return e<=t+i&&e>=t-i},Z=G,Q=[W.f.PLAY,W.f.PAUSE,W.f.ENDED,W.f.VOLUME_CHANGE,W.f.RESIZE,W.f.ERROR,W.f.FULL_SCREEN_CHANGE,W.f.START,W.f.VIDEO_LOAD,W.f.PERCENTS_PLAYED,W.f.SEEK,W.f.PLAYER_LOAD],ee={percentsplayed:{percents:[25,50,75,100]}},te={events:Q,category:"Video",defaultLabel:e=>e.cloudinary?.currentPublicId()||e.currentSource().src};class ie{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.player=e,this.options=o().obj.merge(te,t),this.events=Y(this.options.events,ee);const i=(0,$.sliceProperties)(this.events,W.f.PERCENTS_PLAYED,W.f.TIME_PLAYED,W.f.PAUSE,W.f.SEEK);i.pause&&(delete i.pause,i.pausenoseek={}),this._extendedEvents=new Z(e,{events:i}),this._currentSource=null,this._startTracked=null,this._endTracked=null,this.resetState()}init(){this.events.shoppable&&(this.player.on("productHover",((e,t)=>{this.track({action:"productHover",label:t.productName})}).bind(this)),this.player.on("productClick",((e,t)=>{this.track({action:"productClick",label:t.productName})}).bind(this)),this.player.on("productHoverPost",((e,t)=>{this.track({action:"productHoverPostPlay",label:t.productName})}).bind(this)),this.player.on("productClickPost",((e,t)=>{this.track({action:"productClickPostPlay",label:t.productName})}).bind(this)),this.player.on("productBarMin",(()=>{this.track({action:"shoppableBar",label:"closed"})}).bind(this)),this.player.on("productBarMax",(()=>{this.track({action:"shoppableBar",label:"opened"})}).bind(this)),this.player.on("replay",(()=>{this.track({action:"replay"})}).bind(this))),this.events.play&&this.player.on(W.f.PLAY,(()=>{this.track({action:"Play"})}).bind(this)),this.events.ended&&this.player.on(W.f.ENDED,(()=>{this._endTracked||(this.track({action:"Ended",nonInteraction:!0}),this._endTracked=!0)}).bind(this)),this.events.volumechange&&this.player.on(W.f.VOLUME_CHANGE,(()=>{const e=this.player.muted()?0:this.player.volume();this.track({action:"Volume Change",value:e})}).bind(this)),this.events.resize&&this.player.on(W.f.RESIZE,(()=>{const e=`Resize - ${this.player.width()}x${this.player.height()}}`;this.track({action:e})}).bind(this)),this.events.error&&this.player.on(W.f.ERROR,(()=>{this.track({action:"Error",nonInteraction:!0})}).bind(this)),this.events.start&&this.player.on(W.f.PLAYING,(()=>{this._startTracked&&(this.track({action:"Start"}),this._startTracked=!0)}).bind(this)),this.events.fullscreenchange&&this.player.on(W.f.FULL_SCREEN_CHANGE,(()=>{const e=this.player.isFullscreen()?"Enter Fullscreen":"Exit Fullscreen";this.track({action:e})}).bind(this)),this.events.percentsplayed&&this._extendedEvents.on(W.f.PERCENTS_PLAYED,((e,t)=>{const{percent:i}=t;this.track({action:`${i} Percents Played`,nonInteraction:!0})}).bind(this)),this.events.timeplayed&&this._extendedEvents.on(W.f.TIME_PLAYED,((e,t)=>{const{time:i}=t;this.track({action:`${i} Seconds Played`,value:i,nonInteraction:!0})}).bind(this)),this.events.pause&&this._extendedEvents.on(W.f.PAUSE_NO_SEEK,(()=>{this.track({action:"Pause"})}).bind(this)),this.events.seek&&this._extendedEvents.on(W.f.SEEK,((e,t)=>{const{seekStart:i,seekEnd:s}=t;this.track({action:"Seek Start",value:i}),this.track({action:"Seek End",value:s})}).bind(this)),this.events.playerload&&(()=>{this.track({action:"Player Load",label:window.location.href,nonInteraction:!0})})(),this.player.on(W.f.LOADED_METADATA,this.loadedmetadata.bind(this))}track(e){let{action:t,label:i,value:s=null,nonInteraction:n=!1}=e;const r={event_category:this.options.category,event_label:i||this.options.defaultLabel(this.player),value:s||Math.round(this.player.currentTime()),non_interaction:n};window.gtag("event",t,r)}videoload(){this.track({action:"Video Load",nonInteraction:!0})}resetState(){this._currentSource="",this._startTracked=!1,this._endTracked=!1}loadedmetadata(){const e=this.player.currentSource().src;e!==this._currentSource&&(this.resetState(),this._currentSource=e,this.events.videoload&&this.videoload())}}var se=i(3171);const ne={fraction:.5,isMuted:!0};class re{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t=Object.assign({},ne,t),this.player=e;let i=(0,$.sliceProperties)(t,"fraction"),s=!1,n=!1,r=null,o=null;this.init=()=>{u(),h()};const a=()=>{window.removeEventListener("DOMContentLoaded",h,!1),window.removeEventListener("load",h,!1),window.removeEventListener("scroll",h,!1),window.removeEventListener("resize",h,!1),this.player.off("pause",r),this.player.off("play",o)},l=()=>{s=!0,n=!1,this.player.pause()},c=()=>{s=!1,n=!0,this.player.play()},h=()=>{(0,se.isElementInViewport)(this.player.el(),{fraction:i.fraction})?this.player.paused()&&c():this.player.paused()||this.player.activePlugins_.floatingPlayer||l()},u=()=>{r=()=>{this.player.waiting||s||a()},o=()=>{n||a()},window.addEventListener("DOMContentLoaded",h,!1),window.addEventListener("load",h,!1),window.addEventListener("scroll",h,!1),window.addEventListener("resize",h,!1),this.player.on("pause",r),this.player.on("play",o)}}}var oe=i(5004),ae=i(5381);const le=class{constructor(e){this._emitter=e,this._eventHandlers=[]}on(e,t){this._eventHandlers.push({type:e,handler:t}),this._emitter.on(e,t)}one(e,t){var i=this;this._eventHandlers.push({type:e,handler:t,wrapper:function(){t(...arguments),i.off(e,t)}}),this._emitter.one(e,t)}off(e,t){const i=this._eventHandlers?.findIndex((i=>i.type===e&&i.handler===t));if(-1===i)return;const s=this._eventHandlers[i];this._emitter.off(e,s.wrapper||s.handler),this._eventHandlers.splice(i,1)}removeAllListeners(){this._eventHandlers.forEach((e=>{this.off(e)}))}};var ce=i(4650),he=i(7311);const ue={format:"jpg",resource_type:"video",transformation:{flags:"waveform"}},de=RegExp(`\\.(${["mp3","ogg","wav","mp4"].join("|")})$$`),pe={resource_type:"video",type:"upload",transformation:[]};class fe extends ae.A{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};({publicId:e,options:t}=(0,A.a5)(e,t)),e=e.replace(de,""),t=Object.assign({},pe,t);const{poster:i}=(0,$.sliceAndUnsetProperties)(t,"poster");super(e,t),this._poster=null,this._type=W.x.AUDIO,this.poster(i)}getPoster(){return this._poster}poster(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e?e instanceof ce.A?(this._poster=e,this):(({publicId:e,options:t}=(0,A.a5)(e,t,{tolerateMissingId:!0})),e||(e=this.publicId(),t=Object.assign({},t,ue)),t.cloudinaryConfig=t.cloudinaryConfig||this.cloudinaryConfig(),this._poster=new ce.A(e,t),this):this._poster}generateSources(){return this.sourceTypes().map((e=>{if("audio"===e){const t="mp3",i={},s=this.sourceTransformation()[e]||[this.transformation()];s&&(i.transformation=s),Object.assign(i,{resource_type:"video",format:t});const n=this.queryParams()?(0,he.y)(this.queryParams()):"";return{type:"video/mp4",src:`${this.config().url(this.publicId(),i)}${n}`,cldSrc:this,poster:this.getPoster().url()}}return null}),this)}}const ge=fe,me={transformation:{},sourceTypes:[],sourceTransformation:[],posterOptions:{}},ye=["cloudinaryConfig","transformation","sourceTypes","sourceTransformation","posterOptions","autoShowRecommendations"];class ve{constructor(e){var t=this;let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(0,A.M6)(),this.player=e,s=Object.assign({},me,s);let n=null,r=null,o=null,a=null,l=null,c=null,h=null,u=null,d=null,p=s.chainTarget,f=null,g=null,m=!1;this.source=function(s){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(r=Object.assign({},r),!s)return n;let o=null;if(s instanceof ae.A)o=s;else{let{publicId:e,options:i}=(0,A.a5)(s,r);o=t.buildSource(e,i)}const a=o.recommendations();if(a&&a.length){let t=null,s=!1;r.recommendationOptions&&({disableAutoShow:s,itemBuilder:t}=(0,$.sliceAndUnsetProperties)(r.recommendationOptions,"disableAutoShow","itemBuilder")),async function(e){try{return e.getChild("recommendationsOverlay")||(await Promise.all([i.e(869),i.e(410)]).then(i.bind(i,7604)),e.addChild("recommendationsOverlay")),e}catch(e){console.error("Failed to load plugin:",e)}}(e).then((()=>{y(a,{disableAutoShow:s,itemBuilder:t})}))}else _();n=o,h=o.transformation();const l=r.sourceTypes&&r.sourceTypes.some((e=>e.includes("dash")))||"string"==typeof s&&s.endsWith(".mpd"),c=r.sourceTypes&&r.sourceTypes.some((e=>e.includes("hls")))||"string"==typeof s&&s.endsWith(".m3u8");return!l&&!c||t.player.adaptiveStreamingLoaded?r.skipRefresh||b():i.e(26).then(i.bind(i,7707)).then((()=>{t.player.adaptiveStreaming({...r.adaptiveStreaming,isDash:l,debug:r.debug}).then((()=>{b()}))})).catch((e=>{console.error("Failed to load adaptive streaming plugin:",e),b()})),t.player.trigger("cldsourcechanged",{source:o,sourceOptions:r}),p},this.buildSource=function(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=null;return({publicId:e,options:i}=(0,A.a5)(e,i)),i.cloudinaryConfig=(0,A.lP)(t.cloudinaryConfig(),i.cloudinaryConfig||{}),i.transformation=(0,A.N7)(t.transformation(),i.transformation||{}),i.sourceTransformation=i.sourceTransformation||t.sourceTransformation(),i.sourceTypes=i.sourceTypes||t.sourceTypes(),i.poster=i.poster||T(),i.queryParams=Object.assign(i.queryParams||{},i.allowUsageReport?{_s:"vp-3.2.1"}:{}),s=i.sourceTypes.indexOf("audio")>-1?new ge(e,i):new ae.A(e,i),s},this.posterOptions=e=>e?(l=e,p):l,this.disablePoster=e=>{this.player.poster(" "),this.player.posterImage.el().style.backgroundColor=e},this.cloudinaryConfig=e=>e?(c=e,p):c,this.transformation=e=>e?(h=e,p):h,this.sourceTypes=e=>e?(u=e,p):u,this.getCurrentSources=()=>r,this.sourceTransformation=e=>e?(d=e,p):d,this.on=function(){return f.on(...arguments)},this.one=function(){return f.one(...arguments)},this.off=function(){return f.off(...arguments)},this.autoShowRecommendations=e=>void 0===e?m:(m=e,p),this.dispose=()=>{this.playlist&&this.playlist()&&this.disposePlaylist(),_(),n=void 0,f.removeAllListeners()};const y=(e,t)=>{let{disableAutoShow:i=!1,itemBuilder:s=null}=t;if(_(),!Array.isArray(e)&&"function"!=typeof e&&!e.then)throw new Error('"recommendations" must be either an array or a function');g={},s=s||(e=>({source:e instanceof ae.A?e:this.buildSource(e),action:()=>this.source(e)})),g.sourceChangedHandler=()=>{const t=e=>{if(void 0!==e&&e.length>0){const t=e.map((e=>s(e)));this.player.trigger("recommendationschanged",{items:t})}else this.player.trigger("recommendationsnoshow");g.sources=e};v()(e)?t(e()):e.then?e.then(t):t(e)},g.sourceChangedHandler(),g.endedHandler=()=>{!i&&this.autoShowRecommendations()&&this.player.trigger("recommendationsshow")},this.on("ended",g.endedHandler)},_=()=>{g&&(this.off("cldsourcechanged",g.sourceChangedHandler),this.off("ended",g.endedHandler),delete g.endedHandler,delete g.sourceChangedHandler),g=null},b=()=>{const e=this.source();if(!e)return;const t=Object.assign({},this.player.cloudinary.posterOptions(),e.getInitOptions().poster);t.posterColor?this.disablePoster(t.posterColor):e.poster()&&this.player.poster(e.poster().url()),r=e.generateSources().reduce(((e,t)=>{if(t.isAdaptive)if(t.type.split("; ")[1]&&"MediaSource"in window){let i=`video/mp4; ${t.type.split("; ")[1]||""}`;w(i)&&e.push(t)}else e.push(t);else e.push(t);return e}),[]),this.player.src(r),o=e,this.playlist&&(a=this.playlist())},w=e=>document.createElement("video").canPlayType(e)||"MediaSource"in window&&MediaSource.isTypeSupported(e),T=()=>{const e=Object.assign({},this.posterOptions());e.transformation=e.transformation||{},!e.transformation.width&&!e.transformation.height||e.transformation.crop||(e.transformation.crop="scale");const t=this.player.el();if(t&&t.clientWidth&&t.clientHeight&&!(0,oe.isKeyInTransformation)(e.transformation,"width")&&!(0,oe.isKeyInTransformation)(e.transformation,"height")){const i=e=>100*Math.ceil(e/100);e.transformation=(0,A.N7)(e.transformation,{width:i(t.clientWidth),height:i(t.clientHeight),crop:"limit"})}return e};f=new le(this.player);const C=(0,$.sliceAndUnsetProperties)(s,...ye);var k,S;k=this,S=C,Object.entries(S).forEach((e=>{let[t,i]=e;k[t]&&"function"==typeof k[t]&&k[t](i)})),this.on("sourcechanged",((e,t)=>{let i=t.to;o&&o.contains(i)?this.source()||(this.playlist&&a&&this.playlist(a),this.source(o,{skipRefresh:!0})):(this.player.trigger("cldsourcechanged",{}),this.dispose())}))}currentSourceType(){return this.source().getType()}currentPublicId(){return this.source()&&this.source().publicId()}currentPoster(){return this.source()&&this.source().poster()}}var _e=i(4679),be=i.n(_e),we=i(4138);class Te{constructor(e,t){this.player=e,this.cloudinaryAnalytics=(0,we.connectCloudinaryAnalytics)(this.player.videoElement,{playerAdapter:this.getCloudinaryVideoPlayerAdapter()}),this.currentVideoMetadata={cloudName:null,publicId:null},this.analyticsOptions=t}getMetadata=()=>({cloudName:this.player.cloudinary.cloudinaryConfig().cloud_name,publicId:this.player.cloudinary.currentPublicId()});sourceChanged=(e,t)=>{let{source:i}=t;const s=this.getMetadata();if(s.cloudName&&s.publicId){const e="live"===i?.resourceConfig().type;this.currentVideoMetadata=s,this.cloudinaryAnalytics.startManualTracking({...s,...e?{type:"live"}:{}},{...be()(this.analyticsOptions)?this.analyticsOptions:{},videoPlayerType:"cloudinary video player",videoPlayerVersion:"3.2.1"})}else this.currentVideoMetadata.cloudName===s.cloudName&&this.currentVideoMetadata.publicId===s.publicId||this.cloudinaryAnalytics.stopManualTracking()};getCloudinaryVideoPlayerAdapter=()=>{const e=(e,t)=>(this.player.on(e,t),()=>{this.player.off(e,t)});return{onCanPlay:t=>e("canplay",t),onCanPlayThrough:t=>e("canplaythrough",t),onComplete:t=>e("complete",t),onDurationChange:t=>e("durationchange",t),onEmptied:t=>e("emptied",t),onEnded:t=>e("ended",t),onError:t=>e("error",t),onLoadedData:t=>e("loadeddata",t),onLoadedMetadata:t=>e("loadedmetadata",t),onLoadStart:t=>e("loadstart",t),onPause:t=>e("pause",t),onPlay:t=>e("play",t),onPlaying:t=>e("playing",t),onProgress:t=>e("progress",t),onRateChange:t=>e("ratechange",t),onSeeked:t=>e("seeked",t),onSeeking:t=>e("seeking",t),onStalled:t=>e("stalled",t),onSuspend:t=>e("suspend",t),onTimeUpdate:t=>e("timeupdate",t),onVolumeChange:t=>e("volumechange",t),onWaiting:t=>e("waiting",t),getCurrentSrc:()=>this.player.videoElement.currentSrc,getCurrentTime:()=>this.player.currentTime(),getReadyState:()=>this.player.videoElement.readyState,getDuration:()=>this.player.duration()}};init(){this.player.on(W.f.CLD_SOURCE_CHANGED,this.sourceChanged)}}var Ce=i(7134);const ke=o().getComponent("MenuItem"),Se=class extends ke{handleClick(){super.handleClick(),this.options_.listener()}createEl(){const e=(0,Ce.n)("span",{class:"vjs-menu-item-text"+(this.options_.class?` ${this.options_.class}`:"")});return e.appendChild(document.createTextNode(this.localize(this.options_.label))),(0,Ce.n)("li",{class:"vjs-menu-item",tabIndex:-1},e)}},xe=o().getComponent("Menu"),Ee=class extends xe{constructor(e,t){var i;super(e,t),i=this,t.content.forEach((t=>{let s=null;s=v()(t.listener)?t.listener:"string"==typeof t.href?()=>window.open(t.href):()=>!0,this.addItem(new Se(e,{label:t.label,class:t.class,listener:function(){s(...arguments),i.dispose()}}))}))}setPosition(e,t){(0,se.setPosition)(this.el(),e,t)}createEl(){const e=super.createEl();if(o().dom.addClass(e,"vjs-context-menu-ui"),this.options_.position){const{left:e,top:t}=this.options_.position;this.setPosition(e,t)}return e}},je={cancel:!0,sensitivity:10,wait:500,disabled:!1},Ae="vjs-contextmenu";function Pe(e,t){if(e.contextmenu.options.disabled)return e;const i={target:e,type:Ae};return["clientX","clientY","pageX","pageY","screenX","screenY"].forEach((e=>{i[e]=t[e]})),e.trigger(i)}function Oe(e){const t=this.contextmenu.current;if(!t)return;const i=this.contextmenu.options.wait;"touchend"===e.type&&(new Date).getTime()-t.time>=i&&Pe(this,e),this.contextmenu.current=null}function Ie(e){const t=this.contextmenu.current;if(!t)return;const i=e.touches[0],s=this.contextmenu.options.sensitivity;(i.screenX-t.screenX>s||i.screenY-t.screenY>s)&&(this.contextmenu.current=null)}function Me(e){if(this.contextmenu.current)return;const t=e.touches[0];this.contextmenu.current={screenX:t.screenX,screenY:t.screenY,time:(new Date).getTime()}}function Le(e){this.contextmenu.options.cancel&&!this.contextmenu.options.disabled&&e.preventDefault(),Pe(this,e),this.off(["touchcancel","touchend"],Oe),this.off("touchmove",Ie),this.off("touchstart",Me)}o().registerPlugin("contextmenu",(function(e){this.contextmenu.options=o().obj.merge(je,e),this.on("contextmenu",Le),this.on(["touchcancel","touchend"],Oe),this.on("touchmove",Ie),this.on("touchstart",Me),this.ready((()=>this.addClass(Ae)))}));const De={showNativeOnRecurringEvent:!1};class Ne{constructor(e,t){if(!Array.isArray(t.content)&&!v()(t.content))throw new Error('"content" required');const i=Object.assign({},De,t);this.player=e;const s=(0,$.sliceProperties)(i,"content","showNativeOnRecurringEvent");this.init=()=>{this.player.contextmenu(),this.player.on("vjs-contextmenu",r),this.player.ready((()=>this.player.addClass("vjs-context-menu")))};const n=e=>{const t=this.menu.el();t.style.visibility="hidden",this.player.el().appendChild(t);const i=t.getBoundingClientRect();this.player.el().removeChild(t),t.style.visibility="visible";const s=(0,se.getPointerPosition)(this.player.el(),e),n=this.player.el().getBoundingClientRect();let r=n.height-n.height*s.y+1,o=Math.round(n.width*s.x)+1,a=r,l=o;return r+i.height>n.height&&(a=r+i.height-n.height>i.height/2?r-i.height-1:n.height-i.height),o+i.width>n.width&&(l=o+i.width-n.width>i.width/2?o-i.width-1:n.width-i.width),a<r&&l<o&&(a=r-i.height-1,l=o-i.width-1),a=Math.max(0,a),l=Math.max(0,l),{left:l,top:a}},r=e=>{if(this.menu&&(this.menu.dispose(),s.showNativeOnRecurringEvent))return;s.showNativeOnRecurringEvent&&(this.player.contextmenu.options.cancel=!1),e.preventDefault();let t=s.content;v()(t)&&(t=t(this.player)),this.menu=new Ee(this.player,{content:t});const{left:i,top:r}=n(e);this.menu.setPosition(i,r);const a=e=>{("click"!==e.type||3!==e.which&&2!==e.button)&&this.menu.dispose()};this.menu.on("dispose",(()=>{this.player.contextmenu.options.cancel=!0,this.player.removeChild(this.menu),o().off(document,["click","tap"],a),delete this.menu})),this.player.addChild(this.menu),o().on(document,["click","tap"],a)}}}var Re=i(608);const Fe={fraction:.5,collapsedWidth:300,floatTo:"right"};class Be{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t=Object.assign({},Fe,t),t.floatTo&&t.floatTo!==Re.rT.LEFT&&t.floatTo!==Re.rT.RIGHT&&(t.floatTo=Fe.floatTo),this.player=e;const i=this.player.el();let s=(0,$.sliceProperties)(t,"fraction"),n=null,r=!1,o=!1;this.init=()=>{h(),"object"==typeof this.player.ima&&u()};const a=e=>{const t=document.createElement("div");for(e.appendChild(t);e.firstChild!==t;)t.appendChild(e.firstChild);return t},l=()=>{window.removeEventListener("DOMContentLoaded",g,!1),window.removeEventListener("load",g,!1),window.removeEventListener("scroll",g,!1),window.removeEventListener("resize",g,!1)},c=()=>{window.addEventListener("DOMContentLoaded",g,!1),window.addEventListener("load",g,!1),window.addEventListener("scroll",g,!1),window.addEventListener("resize",g,!1)},h=()=>{this.player.on("play",g),this.player.on("play",c),this.player.on("dispose",l)},u=()=>{const e=i.getBoundingClientRect();n=a(i);const t=a(n);t.setAttribute("class","cld-video-player-floater-inner"),t.setAttribute("style","padding-bottom: "+100*e.height/e.width+"%;");const s=document.createElement("button");s.setAttribute("class","cld-video-player-floater-close"),s.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12"><polygon fill-rule="evenodd" points="370 7.41 368.59 6 364 10.59 359.41 6 358 7.41 362.59 12 358 16.59 359.41 18 364 13.41 368.59 18 370 16.59 365.41 12" transform="translate(-358 -6)"/></svg>',s.onclick=()=>{p(),f()},n.appendChild(s)},d=()=>{const{ima:e}=this.player;e&&e.adsActive&&e.getAdsManager().resize(r?n.clientWidth:i.clientWidth,r?n.clientHeight:i.clientHeight)},p=()=>{n.classList.remove("cld-video-player-floating"),r=!1,d()},f=()=>{l(),this.player.off("play",g),this.player.off("play",c)},g=()=>{(0,se.isElementInViewport)(this.player.el(),{fraction:s.fraction})?r&&p():r||(n||u(),o||(()=>{const e=i.getBoundingClientRect();n.setAttribute("class",`cld-video-player-floater cld-video-player-floater-bottom-${t.floatTo}`),n.setAttribute("style",["width: "+t.collapsedWidth+"px;","top: "+e.top+"px;","left: "+e.left+"px;","right: "+(document.documentElement.clientWidth-e.right)+"px;","bottom: "+(document.documentElement.clientHeight-e.bottom)+"px;"].join("")),o=!0})(),r=!0,setTimeout((()=>{n.classList.add("cld-video-player-floating"),d()})))}}}var He=i(2415);const Ve=async(e,t)=>{try{const t=await fetch(e);if(!t.ok)throw new Error(`Failed fetching from ${e} with status code ${t.status}`);return t}catch(e){if(console.error(e),t)return Ve(t)}};var $e=i(7588),ze=i(3066);let Ue={},We={};const qe=function(){function e(e,t){return this.player=e,this.options=t,this.initializeThumbnails(),this}return e.prototype.src=function(e){this.resetPlugin(),this.options.src=e,this.initializeThumbnails()},e.prototype.detach=function(){this.resetPlugin()},e.prototype.resetPlugin=function(){this.thumbnailHolder&&this.thumbnailHolder.parentNode.removeChild(this.thumbnailHolder),delete this.vttData,delete this.thumbnailHolder,delete this.lastStyle},e.prototype.initializeThumbnails=function(){this.options.src&&fetch(this.options.src,{credentials:this.player.cloudinary.source?.().withCredentials?"include":"omit"}).then((e=>e.text())).then((e=>{this.vttData=this.processVtt(e),this.setupThumbnailElement()}))},e.prototype.setupThumbnailElement=function(){if(!this.vttData[0])return;const e=this.player.$(".vjs-progress-holder .vjs-mouse-display");this.thumbnailHolder=this.player.$(".vjs-vtt-thumbnail-display")||o().dom.createEl("div",void 0,{class:"vjs-vtt-thumbnail-display",style:`width: ${this.vttData[0].css.width}`}),this.thumbnailHolder.innerHTML="",this.thumbnailHolder.setAttribute("class","vjs-vtt-thumbnail-display"),e.appendChild(this.thumbnailHolder);const t=parseInt(this.vttData[0].css.width,10)/2,i=this.updateThumbnailStyle.bind(this);this.player.getDescendant(["controlBar","progressControl","seekBar","mouseTimeDisplay"]).update=function(e,s){const n=s*this.player_.duration(),r=e.width;i(n),this.getChild("timeTooltip").updateTime(e,s,n,(()=>{e.width*s<t?this.el_.style.left=`${t}px`:e.width*s+t>r?this.el_.style.left=e.width-t+"px":this.el_.style.left=e.width*s+"px"})),this.getChild("timeTooltip").write(o().time.formatTime(n))}},e.prototype.getStyleForTime=function(e){for(let t=0;t<this.vttData.length;++t){let i=this.vttData[t];if(e>=i.start&&e<i.end){if(i.css.url&&!We[i.css.url]){let e=new Image;e.src=i.css.url,We[i.css.url]=e}return i.css}}},e.prototype.updateThumbnailStyle=function(e){let t=this.getStyleForTime(e);if(t){if(this.thumbnailHolder.style.opacity="1",!this.lastStyle||this.lastStyle!==t){this.lastStyle=t;for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(this.thumbnailHolder.style[e]=t[e])}}else this.thumbnailHolder.style.opacity="0"},e.prototype.processVtt=function(e){let t=[];return e.split(/[\r\n][\r\n]/i).forEach((e=>{if(e.match(/([0-9]{2}:)?([0-9]{2}:)?[0-9]{2}(.[0-9]{3})?( ?--> ?)([0-9]{2}:)?([0-9]{2}:)?[0-9]{2}(.[0-9]{3})?[\r\n]{1}.*/gi)){let i=e.split(/[\r\n]/i),s=i[0].split(/ ?--> ?/i),n=s[0],r=s[1],o=i[1].split("/").pop(),a=this.getVttCss(o);t.push({start:this.getSecondsFromTimestamp(n),end:this.getSecondsFromTimestamp(r),css:a})}})),t},e.prototype.getPropsFromDef=function(e){let t=e.split(/#xywh=/i),i=t[0],s=t[1].match(/[0-9]+/gi);return{x:s[0],y:s[1],w:s[2],h:s[3],image:i}},e.prototype.getVttCss=function(e){let t={};e=[this.options.src.split(/([^\/]*)$/gi).shift().trim(),e.trim()].join("/");let i=this.getPropsFromDef(e);return t.background='url("'+i.image+'") no-repeat -'+i.x+"px -"+i.y+"px",t.width=i.w+"px",t.height=i.h+"px",t.url=i.image,t},e.prototype.getSecondsFromTimestamp=function(e){const[t,i,s]=e.split(":").map(parseFloat);return 60*t*60+60*i+s},e}(),Ke={aiHighlightsGraph:function(e){this.ready((()=>{!function(e,t){e.addClass("vjs-ai-highlights-graph"),e.aiHighlightsGraph=new V(e,t)}(this,o().obj.merge(H,e))}))},analytics:function(){new ie(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).init()},autoplayOnScroll:function(){new re(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).init()},cloudinary:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.chainTarget=e.chainTarget||this,this.cloudinary=new ve(this,e)},cloudinaryAnalytics:function(){new Te(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).init()},contextMenu:function(){new Ne(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).init()},floatingPlayer:function(){new Be(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).init()},pacedTranscript:function(e){const t=this,i={kind:e.kind||"captions",label:e.label||"Captions",default:e.default,srclang:e.srclang,src:e.src,maxWords:e.maxWords,wordHighlight:e.wordHighlight,timeOffset:e.timeOffset||0};t.textTrackDisplay.el().classList.add("cld-paced-text-tracks");const s=function(e,t,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return`${e}/_applet_/video_service/transcription/${t}/${s?`${s}/`:""}${(0,He.G)(i)}.transcript`};t.one("loadedmetadata",(()=>{(async()=>{let e;if(i.src)e=await Ve(i.src);else{const n=t.cloudinary.source(),r=n.publicId(),o=n.resourceConfig().type,a=(0,A.k$)(t.cloudinary.cloudinaryConfig()),l=s(a,o,r);if(i.srclang){const t=s(a,o,r,i.srclang);e=await Ve(t,l)}else e=await Ve(l)}if(!e?.ok)return;const n=(e=>{const t=[],s=e=>{let{startTime:s,endTime:n,text:r}=e;t.push({startTime:s+i.timeOffset,endTime:n+i.timeOffset,text:r})};return e.forEach((e=>{const n=e.words;if(n){const e=i.maxWords||n.length;for(let r=0;r<n.length;r+=e)i.wordHighlight?n.slice(r,Math.min(r+e,n.length)).forEach(((t,i)=>{s({startTime:t.start_time,endTime:t.end_time,text:n.slice(r,r+e).map((e=>e===t?`<b>${e.word}</b>`:e.word)).join(" ")}),n[i+1]&&t.end_time<n[i+1].start_time&&s({startTime:t.end_time,endTime:n[i+1].start_time,text:n.slice(r,r+e).map((e=>e.word)).join(" ")})})):t.push({startTime:n[r].start_time,endTime:n[Math.min(r+e-1,n.length-1)].end_time,text:n.slice(r,r+e).map((e=>e.word)).join(" ")})}else s({startTime:e.start_time,endTime:e.end_time,text:e.transcript})})),t})(await e.json()),r=t.addRemoteTextTrack({kind:i.kind,label:i.label,srclang:i.srclang,default:i.default,mode:i.default?"showing":"disabled"});n.forEach((e=>{r.track.addCue(new VTTCue(e.startTime,e.endTime,e.text))}))})()}))},styledTextTracks:async function(e){const t=this;try{t.ready((()=>((e,t)=>{const i={theme:e.theme||"default",fontFace:e.fontFace,fontSize:e.fontSize,gravity:e.gravity||"bottom",box:e.box,style:e.style,wordHighlightStyle:e.wordHighlightStyle},s=document.createElement("style");t.el_.appendChild(s);const n=t.textTrackDisplay.el().classList;n.forEach((e=>{e.startsWith("cld-styled-text-tracks")&&n.remove(e)})),n.add("cld-styled-text-tracks"),n.add(`cld-styled-text-tracks-theme-${i.theme}`),i.gravity.split("-").forEach((e=>{n.add(`cld-styled-text-tracks-gravity-${e}`)}));const r=(e,t)=>{if(Object.entries(e)){const i=Object.entries(e).reduce(((e,t)=>{let[i,s]=t;return e+`${i}: ${s} !important; `}),"");s.innerHTML+=`${t} { ${i} } `}},o=e=>{const i=`\n .${(0,ze.playerClassPrefix)(t)} .vjs-text-track-cue > div,\n .${(0,ze.playerClassPrefix)(t)} ::cue\n `;r(e,i)};if(i.fontFace&&((0,$e.fontFace)(t.textTrackDisplay.el(),i.fontFace),o({"font-family":i.fontFace})),i.box){const{x:e,y:s,width:n,height:o}=i.box;(e=>{const i=`\n .${(0,ze.playerClassPrefix)(t)} .vjs-text-track-display.cld-styled-text-tracks,\n .${(0,ze.playerClassPrefix)(t)} ::-webkit-media-text-track-display\n `;r(e,i)})({translate:`${e||0} ${s||0}`,...n?{width:n}:void 0,...o?{height:o}:void 0})}i.fontSize&&o({"font-size":i.fontSize}),i.style&&o(i.style),i.wordHighlightStyle&&(r(i.wordHighlightStyle,`.${(0,ze.playerClassPrefix)(t)} .cld-paced-text-tracks .vjs-text-track-cue b`),r(i.wordHighlightStyle,"video::cue(b)"))})(e,t)))}catch(e){console.error("Failed to load plugin:",e)}},vttThumbnails:function(e){this.ready((()=>{!function(e,t){e.addClass("vjs-vtt-thumbnails"),e.vttThumbnails=new qe(e,t)}(this,o().obj.merge(Ue,e))}))},chapters:async function(e){const t=this;try{const{default:s}=await Promise.all([i.e(869),i.e(625)]).then(i.bind(i,9234));t.ready((()=>s(e,t)))}catch(e){console.error("Failed to load plugin:",e)}},colors:async function(e){const t=this;try{const{default:s}=await Promise.all([i.e(869),i.e(691)]).then(i.bind(i,9454)),n=s(t,e);return t.cloudinary.colors=n,n}catch(e){console.error("Failed to load colors plugin:",e)}},imaPlugin:async function(e,t){await Promise.all([i.e(869),i.e(330)]).then(i.bind(i,2650));const s=v()(e.ads),n="object"==typeof google&&"object"==typeof google.ima;if(t.ads&&(!s||!n))return s||console.warn("contribAds is not loaded"),n||console.warn("imaSdk is not loaded"),!1;e.ima({id:e.el().id,adTagUrl:t.ads.adTagUrl,disableFlashAds:!0,prerollTimeout:t.ads.prerollTimeout||5e3,postrollTimeout:t.ads.postrollTimeout||5e3,showCountdown:!1!==t.ads.showCountdown,adLabel:t.ads.adLabel||"Advertisement",locale:t.ads.locale||"en",autoPlayAdBreaks:!1!==t.ads.autoPlayAdBreaks,debug:t.ads.denug}),Object.keys(t.ads).length>0&&"object"==typeof e.ima&&("first-video"===t.ads.adsInPlaylist?e.one(W.f.SOURCE_CHANGED,(()=>{e.ima.playAdBreak()})):e.on(W.f.SOURCE_CHANGED,(()=>{e.ima.playAdBreak()})))},playlist:async function(e){const t=this;try{const{default:s}=await Promise.all([i.e(869),i.e(33)]).then(i.bind(i,5826)),n=s(t,e);return t.cloudinary.playlist=n,n}catch(e){console.error("Failed to load plugin:",e)}},shoppable:async function(e,t){const{default:s}=await Promise.all([i.e(869),i.e(525)]).then(i.bind(i,9987));new s(e,t.shoppable).init()},srtTextTracks:async function(e){const t=this;try{const{default:s}=await i.e(6).then(i.bind(i,3565));t.ready((()=>s(e,t)))}catch(e){console.error("Failed to load srt-text-tracks plugin:",e)}},interactionAreas:async function(e,t,s){try{const{interactionAreasService:n}=await Promise.all([i.e(869),i.e(404)]).then(i.bind(i,1066));n(e,t,s)}catch(e){console.error("Failed to load plugin:",e)}},visualSearch:async function(e){const t=this;try{const{default:s}=await Promise.all([i.e(869),i.e(728)]).then(i.bind(i,9148));t.ready((()=>s(e,t)))}catch(e){console.error("Failed to load plugin:",e)}},share:async function(e){const t=this;try{const{default:s}=await Promise.all([i.e(869),i.e(976)]).then(i.bind(i,2130));t.ready((()=>s(e,t)))}catch(e){console.error("Failed to load share plugin:",e)}},adaptiveStreaming:i(7707).default},Ge=Ke;var Ye=i(5104),Xe=i(7668);const Je=e=>class extends e{constructor(){var e;super(),e=this;const t={data:{},handlers:{}};this.on=function(){for(var i=arguments.length,s=new Array(i),n=0;n<i;n++)s[n]=arguments[n];const r=s.length-1,o=s[r];return t.handlers[o]=function(t){t.Player=e;for(var i=arguments.length,s=new Array(i>1?i-1:0),n=1;n<i;n++)s[n-1]=arguments[n];o(t,...s)},s[r]=t.handlers[o],e.videojs.on(...s)},this.one=function(){for(var i=arguments.length,s=new Array(i),n=0;n<i;n++)s[n]=arguments[n];const r=s.length-1,o=s[r];return t.handlers[o]=function(i){i.Player=e;for(var s=arguments.length,n=new Array(s>1?s-1:0),r=1;r<s;r++)n[r-1]=arguments[r];o(i,...n),delete t.handlers[o]},s[r]=t.handlers[o],e.videojs.one(...s)},this.off=function(){for(var i=arguments.length,s=new Array(i),n=0;n<i;n++)s[n]=arguments[n];const r=s.length-1,o=s[r];s[r]=t.handlers[o];const a=e.videojs.off(...s);return delete t.handlers[o],a},this.trigger=function(){e.videojs.trigger(...arguments)}}};var Ze=i(8838),Qe=i(5779);const et=e=>!f()(e)||null,tt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{posterOptions:et(e.posterOptions),posterOptionsPublicId:e.posterOptions&&et(e.posterOptions.publicId),autoShowRecommendations:e.autoShowRecommendations,fontFace:e.fontFace,sourceTypes:e.sourceTypes,chapters:!0===e.chapters?"auto":e.chapters&&e.chapters.url?"url":e.chapters?"inline-chapters":void 0,visualSearch:e.visualSearch,download:et(e.download),recommendations:e.recommendations&&e.recommendations.length,...et(e.adaptiveStreaming)?{abrStrategy:e?.adaptiveStreaming?.strategy===Xe.A.adaptiveStreaming.strategy?void 0:e?.adaptiveStreaming?.strategy}:{},shoppable:et(e.shoppable),shoppableProductsLength:e.shoppable&&e.shoppable.products&&e.shoppable.products.length,...e.title||e.description||e.info?{sourceInfo:et(e.info),sourceTitle:"string"==typeof e.title?e.title:e.info?.title,sourceDescription:"string"==typeof e.description?e.description:e.info?.subtitle||e.info?.description}:{},...et(e.textTracks)?it(e.textTracks):{}}},it=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=[e.captions,...e.subtitles||[]];return{textTracks:et(e),textTracksLength:t.length,textTracksOptions:et(e.options)&&Object.keys(e.options).join(","),pacedTextTracks:et(e)&&JSON.stringify(e||{}).includes('"maxWords":')||null,wordHighlight:et(e)&&JSON.stringify(e||{}).includes('"wordHighlight":')||null,transcriptLanguages:t.filter((e=>!e.url)).map((e=>e.language||"")).join(",")||null,transcriptAutoLoaded:t.some((e=>!e.url))||null,transcriptFromURl:t.some((e=>e.url?.endsWith(".transcript")))||null,vttFromUrl:t.some((e=>e.url?.endsWith(".vtt")))||null,srtFromUrl:t.some((e=>e.url?.endsWith(".srt")))||null,...e.options?{styledTextTracksTheme:e.options.theme,styledTextTracksFont:e.options.fontFace,styledTextTracksFontSize:e.options.fontSize,styledTextTracksGravity:e.options.gravity,styledTextTracksBox:et(e.options.box),styledTextTracksStyle:et(e.options.style),styledTextTracksWordHighlightStyle:et(e.options.wordHighlightStyle)}:{}}},st=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{adsAdTagUrl:e.adTagUrl,adsShowCountdown:e.showCountdown,adsAdLabel:e.adLabel,adsLocale:e.locale,adsPrerollTimeout:e.prerollTimeout,adsPostrollTimeout:e.postrollTimeout,adsAdsInPlaylist:e.adsInPlaylist}},nt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{playlist:e.playlist,playlistByTag:e.playlistByTag,playlistWidgetDirection:e.direction,playlistWidgetTotal:e.total}};Object.keys(Ge).forEach((e=>{o().registerPlugin(e,Ge[e])})),(0,Ze.go)();class rt extends(Ye.A.mixin(Je)){static all(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;s<t;s++)i[s-1]=arguments[s];return[...document.querySelectorAll(e)].map((e=>new rt(e,...i)))}get playerOptions(){return this.options.playerOptions}constructor(e,t,i){super(),this.videoElement=(0,Ze.iG)(e),this.options=(0,Ze.Wi)(this.videoElement,t),this._videojsOptions=this.options.videojsOptions,this.videoElement.classList.add("video-js"),Ye.A.fontFace(this.videoElement,this.playerOptions.fontFace),"init"===this._videojsOptions.bigPlayButton&&(this.videoElement.classList.add("vjs-big-play-button-init-only"),this._videojsOptions.bigPlayButton=!0),this.videojs=o()(this.videoElement,this._videojsOptions),this._isPlayerConfigValid=!0,this.playerOptions.debug&&(0,Qe.I6)(this.options).then((e=>{if(!e)return this._isPlayerConfigValid=!1,void this.videojs.error("invalid player configuration")})),this._videojsOptions.muted&&this.videojs.volume(.4),this.playerOptions.fluid&&this.fluid(this.playerOptions.fluid),this._setCssClasses(),this._initPlugins(),this._initJumpButtons(),this._initPictureInPicture(),this._setVideoJsListeners(i)}getVPInstanceId(){return this.vpInstanceId||(this.vpInstanceId=d()),this.vpInstanceId}_sendInternalAnalytics(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=Object.assign({},this.playerOptions,this.options.videojsOptions,e);if(t.allowUsageReport)try{const e=t._internalAnalyticsMetadata??{},n=(s={aiHighlightsGraph:(i=t).aiHighlightsGraph,analytics:et(i.analytics),autoplay:i.autoplay,autoplayMode:i.autoplayMode,bigPlayButton:i.bigPlayButton,className:i.class,cloudinaryAnalytics:!!i.cloudinaryAnalytics,cloudinaryAnalyticsOptions:b()(i.cloudinaryAnalytics),controls:i.controls,floatingWhenNotVisible:i.floatingWhenNotVisible,fluid:i.fluid,height:i.height,hideContextMenu:i.hideContextMenu,logoImageUrl:i.logoImageUrl,logoOnclickUrl:i.logoOnclickUrl,loop:i.loop,maxTries:i.maxTries,muted:i.muted,playbackRates:i.playbackRates,playedEventPercents:i.playedEventPercents,playedEventTimes:i.playedEventTimes,playsinline:i.playsinline,preload:i.preload,videoTimeout:i.videoTimeout,seekThumbnails:i.seekThumbnails,showJumpControls:i.showJumpControls,chaptersButton:i.chaptersButton,pictureInPictureToggle:i.pictureInPictureToggle,showLogo:i.showLogo,skin:i.skin,videoJS:et(i.videoJS),width:i.width,withCredentials:i.withCredentials,debug:i.debug,type:i.type,colors:i.colors&&JSON.stringify(i.colors),controlBar:JSON.stringify(i.controlBar)!==JSON.stringify(Xe.A.controlBar)&&JSON.stringify(i.controlBar),...tt(i.sourceOptions||{}),...st(i.ads),...nt(i.playlistWidget)},Object.entries(s).reduce(((e,t)=>{let[i,s]=t;return s!==Xe.A[i]&&null!=s&&(e[i]=s),e}),{})),r=new URLSearchParams(n).toString(),o=new URLSearchParams({vpVersion:"3.2.1",vpInstanceId:this.getVPInstanceId(),cloudName:t.cloudinary.cloud_name,...e}).toString();fetch(`https://analytics-api-s.cloudinary.com/video_player_source?${r}&${o}`)}catch(e){console.warn(e)}var i,s}_resetReTryVideoState=()=>{this.reTryVideoStateRetriesCount=0,this.videojs.clearTimeout(this.reTryVideoStateTimeoutId)};_setVideoJsListeners(e){this.videojs.on(W.f.ERROR,(()=>{const e=this.videojs.error();if(e){const t=this._isPlayerConfigValid&&this.videojs.cloudinary.currentSourceType();[3===e.code&&o().browser.IS_SAFARI,4===e.code].includes(!0)&&[W.x.AUDIO,W.x.VIDEO].includes(t)?this.isLiveStream?(this.videojs.error({code:A.bo.CUSTOM,message:"Live Stream not started"}),this.reloadVideoUntilAvailable()):(this.videojs.error(null),Ye.A.handleCldError(this,this.playerOptions)):this._resetReTryVideoState()}})),this.videojs.tech_.on(W.f.RETRY_PLAYLIST,(()=>{m()(this.videojs,"hls.stats.mediaRequestsErrored",0)>0&&(this._resetReTryVideoState(),Ye.A.handleCldError(this,this.playerOptions))})),this.videojs.on(W.f.PLAY,this._resetReTryVideoState),this.videojs.on(W.f.CAN_PLAY_THROUGH,this._resetReTryVideoState),this.videojs.on(W.f.CLD_SOURCE_CHA