UNPKG

cloudinary-video-player

Version:

Cloudinary Video Player

2 lines 460 kB
/*! For license information please see cld-video-player.light.min.js.LICENSE.txt */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["cloudinary-video-player"]=t():e["cloudinary-video-player"]=t()}(self,(()=>(()=>{var e,t,i,s={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)=>{"use strict";i.d(t,{A:()=>a});var s=i(6673),n=i.n(s);const r=e=>{const t=e.loop(),i=e.paused(),s=e.muted(),n=e.isFullscreen(),r={class:"player-version",label:"Cloudinary Player v2.3.5"};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]};var o=i(608);const a={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,preload:o.Am.AUTO,textTrackSettings:!1,loop:!1,muted:!1,posterOptions:{},sourceTypes:["auto"],contextMenu:{content:r},floatingWhenNotVisible:o.rT.NONE,hideContextMenu:!1,analytics:!1,cloudinaryAnalytics:!0,allowUsageReport:!0,playedEventPercents:[25,50,75,100],html5:{handlePartialData:!1,nativeTextTracks:!1,vhs:{overrideNative:!n()?.browser||!n().browser.IS_IOS&&!n().browser.IS_SAFARI}},disableSeekWhileScrubbingOnMobile:!0}},6190:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>Ht,player:()=>Dt,players:()=>Ft,videoPlayer:()=>Mt,videoPlayers:()=>Rt});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));function d(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()}const p=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 d(s)};var f=i(5685),g=i.n(f),m=i(2832),y=i.n(m),v=i(8446),_=i.n(v),b=i(8953),w=i.n(b),T=i(7571),C=i.n(T);const k=o().getComponent("ClickableComponent");class E 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-plus vjs-icon-forward-10 vjs-button",ariaLabel:"Jump forward 10 seconds"})}}o().registerComponent("JumpForwardButton",E);const x=o().getComponent("ClickableComponent");class S extends x{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"})}}o().registerComponent("JumpBackButton",S);const j=o().getComponent("ClickableComponent");class A extends j{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"})}}o().registerComponent("logoButton",A);const P=o().getComponent("Component");class O extends P{constructor(e){super(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{})}createEl(){return super.createEl("div",{className:"vjs-progress-control-events-blocker"})}}o().registerComponent("progressControlEventsBlocker",O);var I=i(7878),L=i.n(I);const M=o().dom||o(),R=o().getComponent("Component");class D extends R{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.setSubtitle("");const t=e.info();this.setTitle(t.title),this.setSubtitle(t.subtitle)}setTitle(e){return L().setText(this.titleEl,e),this.refresh(),e}setSubtitle(e){return L().setText(this.subtitleEl,e),this.refresh(),e}refresh(){(()=>this.titleEl.innerText)()||(()=>this.subtitleEl.innerText)()?this.show():this.hide()}createEl(){this.titleEl=M.createEl("div",{className:"vjs-title-bar-title"}),this.subtitleEl=M.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.subtitleEl),e}}o().registerComponent("titleBar",D);var N="3.0.1";const F=o().getTech("Html5"),B=o().registerPlugin||o().plugin,H=["abort","emptied","loadstart","play"],$=["abort","emptied"],V=["ad-playback","ads-ready?","postroll?","preroll?"],z=(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,V.indexOf(i)>-1));var i};let U=0;const W=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-"+ ++U,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:N},this.onPerSrc=r(),this.onePerSrc=r(!0),this.on("dispose",(()=>{e.length=0})),this.on(H,(s=>{if(this.perSourceBehaviors.disabled()||i||z(this,s))return;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(F.Events,o),i=this.setTimeout((()=>{const s=this.currentSrc();n=!0,i=null,this.off(F.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)}))};W.VERSION=N,B("perSourceBehaviors",W);let q={};const Y=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}(),X=function(e){this.ready((()=>{!function(e,t){e.addClass("vjs-ai-highlights-graph"),e.aiHighlightsGraph=new Y(e,t)}(this,o().obj.merge(q,e))}))};var K=i(5871),G=i(6827),J=i.n(G),Z=i(1104);const Q={percentsplayed:{percents:[25,50,75,100]}},ee={events:[Z.f.PERCENTS_PLAYED,Z.f.PAUSE_NO_SEEK,Z.f.SEEK,Z.f.MUTE,Z.f.UNMUTE,Z.f.QUALITY_CHANGED]};class te extends(J()){constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),this.player=e;const i=o().obj.merge(ee,t);let s={lastState:void 0},n=0,r=0,a=!1,l=[],c=[],h=null,u=!1;const d=e=>{this.player.muted()&&"muted"!==s.lastState?(s.lastState="muted",this.emit(Z.f.MUTE,e)):this.player.muted()||"unmuted"===s.lastState||(s.lastState="unmuted",this.emit(Z.f.UNMUTE,e))},p=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=>{se(t,i,e)&&-1===l.indexOf(e)&&(l.push(e),s(Z.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=>{ne(t,e)&&-1===c.indexOf(e)&&(c.push(e),s(Z.f.TIME_PLAYED,{time:e}))}))}this.events.seek&&(n=r,r=t,Math.abs(n-r)>1&&(a=!0,m(),s(Z.f.SEEK,{seekStart:n,seekEnd:r})))},f=e=>{Math.round(this.player.currentTime())===Math.round(this.player.duration())||a||this.emit(Z.f.PAUSE_NO_SEEK,e)},g=()=>{a=!1},m=()=>{l=[],c=[]};this.events=ie(i.events,Q),s={lastState:void 0},n=r=0,a=!1,m(),this.player.on(Z.f.PLAY,(()=>{u&&(this.player.trigger("replay"),u=!1)}).bind(this)),this.player.on(Z.f.ENDED,(()=>{u=!0}).bind(this)),(this.events.percentsplayed||this.events.timeplayed||this.events.seek||this.events.totaltimeplayed)&&this.player.on(Z.f.TIME_UPDATE,p.bind(this)),(this.events.mute||this.events.unmute)&&this.player.on(Z.f.VOLUME_CHANGE,d.bind(this)),this.events.pausenoseek&&(this.player.on(Z.f.PAUSE,f.bind(this)),this.player.on(Z.f.PLAY,g.bind(this))),this.player.on(Z.f.LOADED_METADATA,(()=>{this.player.currentSource().src!==h&&(m(),h=this.player.currentSource().src)}).bind(this)),this.player.on(Z.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(Z.f.QUALITY_CHANGED,e,i)}n=s}}))}).bind(this))}}const ie=(e,t)=>{let i=e;return"Array"===e.constructor.name&&(i=e.reduce(((e,i)=>{const s=t[i]||{};return w()(i)?e[i.type]=Object.assign({},s,i):e[i]=s,e}),{})),i},se=function(e,t,i){return ne(e,t*i/100,arguments.length>3&&void 0!==arguments[3]?arguments[3]:.5)},ne=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.5;return e<=t+i&&e>=t-i},re=te,oe=[Z.f.PLAY,Z.f.PAUSE,Z.f.ENDED,Z.f.VOLUME_CHANGE,Z.f.RESIZE,Z.f.ERROR,Z.f.FULL_SCREEN_CHANGE,Z.f.START,Z.f.VIDEO_LOAD,Z.f.PERCENTS_PLAYED,Z.f.SEEK,Z.f.PLAYER_LOAD],ae={percentsplayed:{percents:[25,50,75,100]}},le={events:oe,category:"Video",defaultLabel:e=>e.cloudinary&&e.cloudinary.currentPublicId()||e.currentSource().src};class ce{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.player=e,this.options=o().obj.merge(le,t),this.events=ie(this.options.events,ae);const i=(0,K.sliceProperties)(this.events,Z.f.PERCENTS_PLAYED,Z.f.TIME_PLAYED,Z.f.PAUSE,Z.f.SEEK);i.pause&&(delete i.pause,i.pausenoseek={}),this._extendedEvents=new re(e,{events:i}),this._currentSource=null,this._startTracked=null,this._endTracked=null,this.resetState()}init(){const e=()=>{this.track({action:"Player Load",label:window.location.href,nonInteraction:!0})},t=()=>{this.track({action:"Play"})},i=()=>{this._startTracked&&(this.track({action:"Start"}),this._startTracked=!0)},s=()=>{this.track({action:"Pause"})},n=()=>{this._endTracked||(this.track({action:"Ended",nonInteraction:!0}),this._endTracked=!0)},r=()=>{this.track({action:"Error",nonInteraction:!0})},o=()=>{const e=this.player.muted()?0:this.player.volume();this.track({action:"Volume Change",value:e})},a=()=>{const e=`Resize - ${this.player.width()}x${this.player.height()}}`;this.track({action:e})},l=()=>{const e=this.player.isFullscreen()?"Enter Fullscreen":"Exit Fullscreen";this.track({action:e})},c=(e,t)=>{const{percent:i}=t;this.track({action:`${i} Percents Played`,nonInteraction:!0})},h=(e,t)=>{const{time:i}=t;this.track({action:`${i} Seconds Played`,value:i,nonInteraction:!0})},u=(e,t)=>{const{seekStart:i,seekEnd:s}=t;this.track({action:"Seek Start",value:i}),this.track({action:"Seek End",value:s})},d=(e,t)=>{this.track({action:"productHover",label:t.productName})},p=(e,t)=>{this.track({action:"productClick",label:t.productName})},f=()=>{this.track({action:"shoppableBar",label:"opened"})},g=()=>{this.track({action:"shoppableBar",label:"closed"})},m=()=>{this.track({action:"replay"})},y=(e,t)=>{this.track({action:"productClickPostPlay",label:t.productName})},v=(e,t)=>{this.track({action:"productHoverPostPlay",label:t.productName})};this.events.shoppable&&(this.player.on("productHover",d.bind(this)),this.player.on("productClick",p.bind(this)),this.player.on("productHoverPost",v.bind(this)),this.player.on("productClickPost",y.bind(this)),this.player.on("productBarMin",g.bind(this)),this.player.on("productBarMax",f.bind(this)),this.player.on("replay",m.bind(this))),this.events.play&&this.player.on(Z.f.PLAY,t.bind(this)),this.events.ended&&this.player.on(Z.f.ENDED,n.bind(this)),this.events.volumechange&&this.player.on(Z.f.VOLUME_CHANGE,o.bind(this)),this.events.resize&&this.player.on(Z.f.RESIZE,a.bind(this)),this.events.error&&this.player.on(Z.f.ERROR,r.bind(this)),this.events.start&&this.player.on(Z.f.PLAYING,i.bind(this)),this.events.fullscreenchange&&this.player.on(Z.f.FULL_SCREEN_CHANGE,l.bind(this)),this.events.percentsplayed&&this._extendedEvents.on(Z.f.PERCENTS_PLAYED,c.bind(this)),this.events.timeplayed&&this._extendedEvents.on(Z.f.TIME_PLAYED,h.bind(this)),this.events.pause&&this._extendedEvents.on(Z.f.PAUSE_NO_SEEK,s.bind(this)),this.events.seek&&this._extendedEvents.on(Z.f.SEEK,u.bind(this)),this.events.playerload&&e(),this.player.on(Z.f.LOADED_METADATA,this.loadedmetadata.bind(this))}track(e){let{action:t,label:i,value:s=null,nonInteraction:n=!1}=e;const r={eventCategory:this.options.category,eventAction:t,eventLabel:i||this.options.defaultLabel(this.player),eventValue:s||Math.round(this.player.currentTime()),nonInteraction:n};window.ga("send","event",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 he=i(3171);const ue={fraction:.5,isMuted:!0};class de{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t=Object.assign({},ue,t),this.player=e;let i=(0,K.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,he.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 pe=i(5004),fe=i(9388),ge=i(5381);const me=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 ye=i(4650),ve=i(7311);const _e={format:"jpg",resource_type:"video",transformation:{flags:"waveform"}},be=RegExp(`\\.(${["mp3","ogg","wav","mp4"].join("|")})$$`),we={resource_type:"video",type:"upload",transformation:[]};class Te extends ge.A{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};({publicId:e,options:t}=(0,fe.a5)(e,t)),e=e.replace(be,""),t=Object.assign({},we,t);const{poster:i}=(0,K.sliceAndUnsetProperties)(t,"poster");super(e,t),this._poster=null,this._type=Z.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 ye.A?(this._poster=e,this):(({publicId:e,options:t}=(0,fe.a5)(e,t,{tolerateMissingId:!0})),e||(e=this.publicId(),t=Object.assign({},t,_e)),t.cloudinaryConfig=t.cloudinaryConfig||this.cloudinaryConfig(),this._poster=new ye.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,ve.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 Ce=Te;const ke={transformation:{},sourceTypes:[],sourceTransformation:[],posterOptions:{}},Ee=["cloudinaryConfig","transformation","sourceTypes","sourceTransformation","posterOptions","autoShowRecommendations"];class xe{constructor(e){var t=this;let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(0,fe.M6)(),this.player=e,s=Object.assign({},ke,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 ge.A)o=s;else{let{publicId:e,options:i}=(0,fe.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,K.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 v();n=o;return r.sourceTypes&&r.sourceTypes.some((e=>e.includes("dash")))?i.e(367).then(i.bind(i,6604)).then((()=>{b()})):r.skipRefresh||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,fe.a5)(e,i)),i.cloudinaryConfig=(0,fe.lP)(t.cloudinaryConfig(),i.cloudinaryConfig||{}),i.transformation=(0,fe.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.usageReport?{_s:"vp-2.3.5"}:{}),s=i.sourceTypes.indexOf("audio")>-1?new Ce(e,i):new ge.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(),v(),n=void 0,f.removeAllListeners()};const y=(e,t)=>{let{disableAutoShow:i=!1,itemBuilder:s=null}=t;if(v(),!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 ge.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};_()(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)},v=()=>{g&&(this.off("cldsourcechanged",g.sourceChangedHandler),this.off("ended",g.endedHandler),delete g.endedHandler,delete g.sourceChangedHandler),g=null},b=()=>{const e=this.source(),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]||null)&&"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,pe.isKeyInTransformation)(e.transformation,"width")&&!(0,pe.isKeyInTransformation)(e.transformation,"height")){const i=e=>100*Math.ceil(e/100);e.transformation=(0,fe.N7)(e.transformation,{width:i(t.clientWidth),height:i(t.clientHeight),crop:"limit"})}return e};f=new me(this.player);const C=(0,K.sliceAndUnsetProperties)(s,...Ee);var k,E;k=this,E=C,Object.entries(E).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 Se=i(4679),je=i.n(Se),Ae=i(4138);class Pe{constructor(e,t){this.player=e,this.shouldUseCustomEvents=o().browser.IS_IOS,this.cloudinaryAnalytics=(0,Ae.connectCloudinaryAnalytics)(this.player.videoElement,{customEvents:this.shouldUseCustomEvents}),this.currentVideMetadata={cloudName:null,publicId:null},this.analyticsOptions=t}getMetadata=()=>({cloudName:this.player.cloudinary.cloudinaryConfig().cloud_name,publicId:this.player.cloudinary.currentPublicId()});sourceChanged=()=>{const e=this.getMetadata();e.cloudName&&e.publicId?(this.currentVideMetadata=e,this.cloudinaryAnalytics.startManualTracking(e,{...je()(this.analyticsOptions)?this.analyticsOptions:{},videoPlayerType:"cloudinary video player",videoPlayerVersion:"2.3.5"})):this.currentVideMetadata.cloudName===e.cloudName&&this.currentVideMetadata.publicId===e.publicId||this.cloudinaryAnalytics.stopManualTracking()};dispatchCustomEventOnVideoPlayer=(()=>{var e=this;return function(t){const i=new CustomEvent(`cld-custom-${t}`,{detail:arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}});e.player.videoElement.dispatchEvent(i)}})();connectCustomEvents=()=>{this.player.on(Z.f.PLAY,(()=>this.dispatchCustomEventOnVideoPlayer("play"))),this.player.on(Z.f.PAUSE,(()=>this.dispatchCustomEventOnVideoPlayer("pause"))),this.player.on(Z.f.EMPTIED,(()=>this.dispatchCustomEventOnVideoPlayer("emptied"))),this.player.on(Z.f.LOADED_METADATA,(()=>{const e=this.player.videoElement.duration||null;this.dispatchCustomEventOnVideoPlayer("loadedmetadata",{videoDuration:e})}))};init(){this.shouldUseCustomEvents&&this.connectCustomEvents(),this.player.on(Z.f.CLD_SOURCE_CHANGED,this.sourceChanged)}}var Oe=i(4500),Ie=i(7134);const Le=o().getComponent("MenuItem");const Me=class extends Le{handleClick(){super.handleClick(),this.options_.listener()}createEl(){const e=(0,Ie.n)("span",{class:"vjs-menu-item-text"+(this.options_.class?` ${this.options_.class}`:"")});e.appendChild(document.createTextNode(this.localize(this.options_.label)));return(0,Ie.n)("li",{class:"vjs-menu-item",tabIndex:-1},e)}},Re=o().getComponent("Menu");const De=class extends Re{constructor(e,t){var i;super(e,t),i=this,t.content.forEach((t=>{let s=null;s=_()(t.listener)?t.listener:"string"==typeof t.href?()=>window.open(t.href):()=>!0,this.addItem(new Me(e,{label:t.label,class:t.class,listener:function(){s(...arguments),i.dispose()}}))}))}setPosition(e,t){(0,he.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}},Ne={cancel:!0,sensitivity:10,wait:500,disabled:!1},Fe="vjs-contextmenu";function Be(e,t){if(e.contextmenu.options.disabled)return e;const i={target:e,type:Fe};return["clientX","clientY","pageX","pageY","screenX","screenY"].forEach((e=>{i[e]=t[e]})),e.trigger(i)}function He(e){const t=this.contextmenu.current;if(!t)return;const i=this.contextmenu.options.wait;"touchend"===e.type&&(new Date).getTime()-t.time>=i&&Be(this,e),this.contextmenu.current=null}function $e(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 Ve(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 ze(e){this.contextmenu.options.cancel&&!this.contextmenu.options.disabled&&e.preventDefault(),Be(this,e),this.off(["touchcancel","touchend"],He),this.off("touchmove",$e),this.off("touchstart",Ve)}function Ue(e){this.contextmenu.options=o().obj.merge(Ne,e),this.on("contextmenu",ze),this.on(["touchcancel","touchend"],He),this.on("touchmove",$e),this.on("touchstart",Ve),this.ready((()=>this.addClass(Fe)))}o().registerPlugin("contextmenu",Ue);const We={showNativeOnRecurringEvent:!1};class qe{constructor(e,t){if(!Array.isArray(t.content)&&!_()(t.content))throw new Error('"content" required');const i=Object.assign({},We,t);this.player=e;const s=(0,K.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,he.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;if(r+i.height>n.height){a=r+i.height-n.height>i.height/2?r-i.height-1:n.height-i.height}if(o+i.width>n.width){l=o+i.width-n.width>i.width/2?o-i.width-1:n.width-i.width}return 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;_()(t)&&(t=t(this.player)),this.menu=new De(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 Ye=i(608);const Xe={fraction:.5,collapsedWidth:300,floatTo:"right"};class Ke{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t=Object.assign({},Xe,t),t.floatTo&&t.floatTo!==Ye.rT.LEFT&&t.floatTo!==Ye.rT.RIGHT&&(t.floatTo=Xe.floatTo),this.player=e;const i=this.player.el();let s=(0,K.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",m,!1),window.removeEventListener("load",m,!1),window.removeEventListener("scroll",m,!1),window.removeEventListener("resize",m,!1)},c=()=>{window.addEventListener("DOMContentLoaded",m,!1),window.addEventListener("load",m,!1),window.addEventListener("scroll",m,!1),window.addEventListener("resize",m,!1)},h=()=>{this.player.on("play",m),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=()=>{f(),g()},n.appendChild(s)},d=()=>{const{ima:e}=this.player;if(e&&e.adsActive){e.getAdsManager().resize(r?n.clientWidth:i.clientWidth,r?n.clientHeight:i.clientHeight)}},p=()=>{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()}))},f=()=>{n.classList.remove("cld-video-player-floating"),r=!1,d()},g=()=>{l(),this.player.off("play",m),this.player.off("play",c)},m=()=>{(0,he.isElementInViewport)(this.player.el(),{fraction:s.fraction})?r&&f():r||p()}}}const Ge=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 Ge(t)}};const Je=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=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};t.one("loadedmetadata",(()=>{(async()=>{let e;if(i.src)e=await Ge(i.src);else{const s=t.cloudinary.source(),n=(0,fe.KA)(s.publicId(),(0,fe.lP)(t.cloudinary.cloudinaryConfig(),{resource_type:"raw"}));e=i.srclang?await Ge(`${n}.${i.srclang}.transcript`,`${n}.transcript`):await Ge(`${n}.transcript`)}if(!e?.ok)return;const n=await e.json(),r=s(n),o=t.addRemoteTextTrack({kind:i.kind,label:i.label,srclang:i.srclang,default:i.default,mode:i.default?"showing":"disabled"});r.forEach((e=>{o.track.addCue(new VTTCue(e.startTime,e.endTime,e.text))}))})()}))};const Ze=class{seperator=",";timestampToSeconds(e){const[t,i]=e.split(","),s=parseInt(i),[n,r,o]=t.split(":").map((e=>parseInt(e))),a=.001*s+o+60*r+3600*n;return Math.round(1e3*a)/1e3}correctFormat(e){let t=e.replace(".",",");var i,[s,n]=t.split(",");i=this.fixed_str_digit(3,n);var[r,o,a]=s.split(":");return`${this.fixed_str_digit(2,r,!1)}:${this.fixed_str_digit(2,o,!1)}:${this.fixed_str_digit(2,a,!1)},${i}`}fixed_str_digit(e,t,i=!0){return t.length==e?t:t.length>e?t.slice(0,e):t.length<e?i?t.padEnd(e,"0"):t.padStart(e,"0"):void 0}tryComma(e){let t=(e=e.replace(/\r/g,"")).split(/(\d+)\n(\d{1,2}:\d{2}:\d{2},\d{1,3}) --> (\d{1,2}:\d{2}:\d{2},\d{1,3})/g);return t.shift(),t}tryDot(e){let t=(e=e.replace(/\r/g,"")).split(/(\d+)\n(\d{1,2}:\d{2}:\d{2}\.\d{1,3}) --> (\d{1,2}:\d{2}:\d{2}\.\d{1,3})/g);return t.shift(),this.seperator=".",t}fromSrt(e){var t=e,i=this.tryComma(t);0==i.length&&(i=this.tryDot(t));for(var s=[],n=0;n<i.length;n+=4){const e=this.correctFormat(i[n+1].trim()),t=this.correctFormat(i[n+2].trim());var r={id:i[n].trim(),startTime:e,startSeconds:this.timestampToSeconds(e),endTime:t,endSeconds:this.timestampToSeconds(t),text:i[n+3].trim()};s.push(r)}return s}toSrt(e){var t="";const i="\r\n";for(var s=0;s<e.length;s++){var n=e[s];t+=n.id+i,t+=n.startTime+" --\x3e "+n.endTime+i,t+=n.text.replace("\n",i)+i+i}return t}};const Qe=e=>(new Ze).fromSrt(e).map((e=>({startTime:e.startSeconds,endTime:e.endSeconds,text:e.text}))),et=function(e,t){t.one("loadedmetadata",(()=>{(async()=>{let i;if(e.src)try{if(i=await fetch(e.src),!i.ok)throw new Error(`Failed fetching from ${e.src} with status code ${i.status}`)}catch(e){console.error(e)}if(!i.ok)return;const s=await i.text(),n=Qe(s),r=t.addRemoteTextTrack({kind:e.kind||"subtitles",label:e.label||"Subtitles",srclang:e.srclang,default:e.default,mode:e.default?"showing":"disabled"});n.forEach((e=>{e&&r.track.addCue(new VTTCue(e.startTime,e.endTime,e.text))}))})()}))};var tt=i(7588),it=i(3066);const st=(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,it.playerClassPrefix)(t)} .vjs-text-track-cue > div,\n .${(0,it.playerClassPrefix)(t)} ::cue\n `;r(e,i)};if(i.fontFace&&((0,tt.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,it.playerClassPrefix)(t)} .vjs-text-track-display.cld-styled-text-tracks,\n .${(0,it.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,it.playerClassPrefix)(t)} .cld-paced-text-tracks .vjs-text-track-cue b`),r(i.wordHighlightStyle,"video::cue(b)"))};let nt={},rt={};const ot=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&&!rt[i.css.url]){let e=new Image;e.src=i.css.url,rt[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}(),at=function(e){this.ready((()=>{!function(e,t){e.addClass("vjs-vtt-thumbnails"),e.vttThumbnails=new ot(e,t)}(this,o().obj.merge(nt,e))}))};const lt={aiHighlightsGraph:X,analytics:function(){new ce(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).init()},autoplayOnScroll:function(){new de(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 xe(this,e)},cloudinaryAnalytics:function(){new Pe(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).init()},colors:Oe.A,contextMenu:function(){new qe(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).init()},floatingPlayer:function(){new Ke(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).init()},pacedTranscript:Je,vttThumbnails:at,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)}},imaPlugin:async function(e,t){await Promise.all([i.e(869),i.e(330)]).then(i.bind(i,2650));const s=_()(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(Z.f.SOURCE_CHANGED,(()=>{e.ima.playAdBreak()})):e.on(Z.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{t.ready((()=>et(e,t)))}catch(e){console.error("Failed to load plugin:",e)}},styledTextTracks:async function(e){const t=this;try{t.ready((()=>st(e,t)))}catch(e){console.error("Failed to load 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)}}},ct=lt;var ht=i(5104),ut=i(7668);const dt=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 pt=i(8838),ft=i(5779);const gt=e=>!g()(e)||null,mt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{sourceTypes:e.sourceTypes,autoShowRecommendations:e.autoShowRecommendations,fontFace:e.fontFace,posterOptions:gt(e.posterOptions),posterOptionsPublicId:e.posterOptions&&gt(e.posterOptions.publicId)}},yt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=[e.captions,...e.subtitles||[]];return{textTracks:gt(e),textTracksLength:t.length,textTracksOptions:gt(e.options)&&Object.keys(e.options).join(","),pacedTextTracks:gt(e)&&JSON.stringify(e||{}).includes('"maxWords":')||null,wordHighlight:gt(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}},vt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{chapters:e.chapters&&(e.chapters.url?"url":"inline-chapters"),recommendations:e.recommendations&&e.recommendations.length,shoppable:gt(e.shoppable),shoppableProductsLength:e.shoppable&&e.shoppable.products&&e.shoppable.products.length,...e.info?{sourceInfoTitle:e.info.title,sourceInfoSubtitle:e.info.subtitle,sourceInfoDescription:e.info.description}:{},...e.textTracks?{...gt(e.textTracks)&&yt(e.textTracks),...e.textTracks.options?{styledTextTracksTheme:e.textTracks.options.theme,styledTextTracksFont:e.textTracks.options.fontFace,styledTextTracksFontSize:e.textTracks.options.fontSize,styledTextTracksGravity:e.textTracks.options.gravity,styledTextTracksBox:gt(e.textTracks.options.box),styledTextTracksStyle:gt(e.textTracks.options.style),styledTextTracksWordHighlightStyle:gt(e.textTracks.options.wordHighlightStyle)}:{}}:{}}},_t=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}},bt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{playlistWidgetDirection:e.direction,playlistWidgetTotal:e.total}},wt=e=>{return t={aiHighlightsGraph:e.aiHighlightsGraph,analytics:gt(e.analytics),autoplay:e.autoplay,autoplayMode:e.autoplayMode,bigPlayButton:e.bigPlayButton,className:e.class,cloudinaryAnalytics:!!e.cloudinaryAnalytics,cloudinaryAnalyticsOptions:w()(e.cloudinaryAnalytics),controls:e.controls,floatingWhenNotVisible:e.floatingWhenNotVisible,fluid:e.fluid,height:e.height,hideContextMenu:e.hideContextMenu,logoImageUrl:e.logoImageUrl,logoOnclickUrl:e.logoOnclickUrl,loop:e.loop,maxTries:e.maxTries,muted:e.muted,playbackRates:e.playbackRates,playedEventPercents:e.playedEventPercents,playedEventTimes:e.playedEventTimes,playsinline:e.playsinline,preload:e.preload,videoTimeout:e.videoTimeout,seekThumbnails:e.seekThumbnails,showJumpControls:e.showJumpControls,chaptersButton:e.chaptersButton,pictureInPictureToggle:e.pictureInPictureToggle,showLogo:e.showLogo,skin:e.skin,videoJS:gt(e.videoJS),width:e.width,withCredentials:e.withCredentials,debug:e.debug,type:e.type,colors:e.colors&&JSON.stringify(e.colors),controlBar:JSON.stringify(e.controlBar)!==JSON.stringify(ut.A.controlBar)&&JSON.stringify(e.controlBar),...mt(e.cloudinary),...vt(e.sourceOptions),..._t(e.ads),...bt(e.playlistWidget)},Object.entries(t).reduce(((e,t)=>{let[i,s]=t;return s!==ut.A[i]&&null!=s&&(e[i]=s),e}),{});var t};Object.keys(ct).forEach((e=>{o().registerPlugin(e,ct[e])})),(0,pt.go)();class Tt extends(ht.A.mixin(dt)){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 Tt(e,...i)))}get playerOptions(){return this.options.playerOptions}constructor(e,t,i){super(),this.videoElement=(0,pt.iG)(e),this.options=(0,pt.Wi)(this.videoElement,t),this._videojsOptions=this.options.videojsOptions,this.videoElement.classList.add("video-js"),ht.A.fontFace(this.videoElement,this.playerOptions.cloudinary.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,ft.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=p()),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??{},i=wt(t),s=new URLSearchParams(i).toString(),n=new URLSearchParams({vpVersion:"2.3.5",vpInstanceId:this.getVPInstanceId(),vpLightBuild:!0,cloudName:t.cloudinary.cloudinaryConfig.cloud_name,...e}).toString();fetch(`https://analytics-api-s.cloudinary.com/video_player_source?${s}&${n}`)}catch(e){console.warn(e)}}_resetReTryVideoState=()=>{this.reTryVideoStateRetriesCount=0,this.videojs.clearTimeout(this.reTryVideoStateTimeoutId)};_setVideoJsListeners(e){this.videojs.on(Z.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)&&[Z.x.AUDIO,Z.x.VIDEO].includes(t)?this.isLiveStream?(this.videojs.error({code:fe.bo.CUSTOM,message:"Live Stream not started"}),this.reloadVideoUntilAvailable()):(this.videojs.error(null),ht.A.handleCldError(this,this.playerOptions)):this._resetReTryVideoState()}})),this.videojs.tech_.on(Z.f.RETRY_PLAYLIST,(()=>{y()(this.videojs,"hls.stats.mediaRequestsErrored",0)>0&&(this._resetReTryVideoState(),ht.A.handleCldError(this,this.playerOptions))})