@flowplayer/player
Version:
video player for the future
1 lines • 744 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).flowplayer=e()}(this,function(){"use strict";const t=[],e=[];function s(){const t="undefined"!=typeof document&&"undefined"!=typeof window,e=t?navigator.userAgent:"",s=/iP(hone|od)/i.test(e)&&!/iPad/.test(e)&&!/IEMobile/i.test(e),i=/Android/.test(e)&&!/Firefox/.test(e),r=/^((?!chrome|android).)*safari/i.test(e),n=/chrome|crios/i.test(e)&&!/opr|opera|chromium|edg|ucbrowser|googlebot/i.test(e),a=/firefox|fxios/i.test(e)&&!/seamonkey/i.test(e),o=/edg/i.test(e),l=/opr|opera/i.test(e),d=/SamsungBrowser/.test(e),c=d&&/SMART-TV/.test(e);return{controls:!s,video:function(e){return t&&document.createElement("video").canPlayType(e)},lang:t&&window.navigator.language,android:i,iphone:s,safari:r,edge:o,opera:l,chrome:n,firefox:a,ios:t&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,samsung:d,samsung_tv:d&&c,touch:"ontouchstart"in window,tizen:"tizen"in window,webOS:"webos"in window}}const i="mount",r="retry",n="error",a="click",o="dblclick",l="mouseleave",d="mouseup",c="mousedown",u="mousemove",h="touchstart",f="touchmove",g="touchend",p="touchcancel",m="resize",v="fullscreenenter",y="fullscreenexit",E="loadedmetadata",T="loadeddata",S="progress",A="timeupdate",_="loadstart",b="volumechange",L="pause",R="playing",I="play",k="waiting",w="canplay",P="ended",D="seeked",C="seeking",O="durationchange",M="viewenter",x="viewleave",F="src",N="reap",U="qualities",B="qualitychange",$="quality:set",G="tracks:video:select",H="landscape",K="portrait",V="dvr",j="live",q="recover",W="seek:queued",Y="seek:cancel",z="remotesession:started",Q="remotesession:ended",X="intersectionchange",Z="renderplugin",J="audioonlysource",tt="error:fatal",et="config",st="state",it="beforeplay",rt="beforepause",nt="content:loadstart",at="flowplayer:error";var ot=Object.freeze({__proto__:null,MOUNT:i,RETRY:r,ERROR:n,CONTEXT_MENU:"contextmenu",CLICK:a,DBL_CLICK:o,KEYUP:"keyup",KEYDOWN:"keydown",LOAD:"load",MOUSE_ENTER:"mouseenter",MOUSE_LEAVE:l,MOUSE_UP:d,MOUSE_DOWN:c,MOUSE_MOVE:u,TOUCH_START:h,TOUCH_MOVE:f,TOUCH_END:g,TOUCH_CANCEL:p,RESIZE:m,SCROLL:"scroll",FULLSCREEN_ENTER:v,FULLSCREEN_EXIT:y,FULLSCREEN_CHANGE:"fullscreenchange",METADATA:E,DATA:T,PROGRESS:S,TIME_UPDATE:A,LOAD_START:_,VOLUME_CHANGE:b,PAUSE:L,PLAYING:R,PLAY:I,WAITING:k,CAN_PLAY:w,ENDED:P,SEEKED:D,SEEKING:C,DURATION_CHANGE:O,VIEW_ENTER:M,VIEW_LEAVE:x,SOURCE:F,REAP:N,QUALITIES:U,QUALITY_CHANGE:B,VIDEO_TRACKS:"videoTracks",SET_QUALITY:$,VIDEO_TRACK_SELECT:G,RECOMMENDATIONS_READY:"recommendationsready",LANDSCAPE:H,PORTRAIT:K,DVR:V,LIVE:j,RECOVER:q,SEEK_QUEUED:W,SEEK_CANCEL:Y,PLUGIN_REGISTERED:"plugin:registered",REMOTE_SESSION_STARTED:z,REMOTE_SESSION_ENDED:Q,INTERSECTIONCHANGE:X,WEBKIT_NEEDKEY:"webkitneedkey",RENDER_PLUGIN:Z,AUDIO_ONLY_SOURCE:J,NON_RECOVERABLE_ERROR:tt,CONFIG:et,STATE:st,BEFORE_PLAY:it,BEFORE_PAUSE:rt,CONTENT_REAL_LOAD_START:nt,CUEPOINTS:"cuepoints",CUEPOINT_START:"cuepointstart",CUEPOINT_END:"cuepointend",STANDARD_ERROR:at});const lt="flowplayer-ui",dt="flowplayer-logo",ct="flowplayer-control",ut="flowplayer-control-buttons",ht="flowplayer-live-status",ft="flowplayer-elapsed-time",gt="flowplayer-timeline-bar",pt="flowplayer-control-duration",mt="flowplayer-volume-control",vt="flowplayer-volume-bar",yt="flowplayer-header",Et="flowplayer-header-left-zone",Tt="flowplayer-header-right-zone",St="flowplayer-header-duration",At="flowplayer-middle",_t="flowplayer-middle-zone",bt="flowplayer-wait",Lt="flowplayer-middle-buttons",Rt="flowplayer-middle-left-zone",It="flowplayer-middle-right-zone",kt="flowplayer-small-play-icon",wt="flowplayer-small-pause-icon",Pt="flowplayer-play-icon",Dt="flowplayer-pause-icon",Ct="flowplayer-fullscreen-enter-icon",Ot="flowplayer-fullscreen-exit-icon",Mt="flowplayer-fast-forward-icon",xt="flowplayer-rewind-icon",Ft="flowplayer-volume-icon",Nt="flowplayer-live-countdown",Ut="flowplayer-error";var Bt=Object.freeze({__proto__:null,SUBTITLES_MENU:"flowplayer-subtitles-menu",SHARE_MENU:"flowplayer-share-menu",SPEED_MENU:"flowplayer-speed-menu",QUALITY_MENU:"flowplayer-quality-menu",AUDIO_MENU:"flowplayer-audio-menu",VIDEO_MENU:"flowplayer-video-menu",UI:lt,LOGO:dt,CONTROL:ct,CONTROL_BUTTONS:ut,LIVE_STATUS:ht,ELAPSED:ft,TIMELINE:gt,CHAPTERS_TIMELINE:"flowplayer-chapters-timeline-bar",CONTROL_DURATION:pt,VOLUME_CONTROL:mt,VOLUME_BAR:vt,HEADER:yt,HEADER_LEFT_ZONE:Et,HEADER_RIGHT_ZONE:Tt,HEADER_DURATION:St,MIDDLE:At,MIDDLE_ZONE:_t,WAIT:bt,MIDDLE_BUTTONS:Lt,MIDDLE_LEFT_ZONE:Rt,MIDDLE_RIGHT_ZONE:It,ENDSCREEN_INTERSTITIAL:"flowplayer-endscreen-interstitial",ENDSCREEN_UP_NEXT:"flowplayer-endscreen-up-next",ENDSCREEN_GRID:"flowplayer-endscreen-grid",PLAYLIST_INTERSTITIAL:"flowplayer-playlist-interstitial",AIRPLAY_ICON:"flowplayer-airplay-icon",CHROMECAST_ICON:"flowplayer-chromecast-icon",SMALL_PLAY_ICON:kt,SMALL_PAUSE_ICON:wt,PLAY_ICON:Pt,PAUSE_ICON:Dt,FULLSCREEN_ENTER_ICON:Ct,FULLSCREEN_EXIT_ICON:Ot,SKIP_NEXT_ICON:"flowplayer-skip-next-icon",SKIP_PREVIOUS_ICON:"flowplayer-skip-previous-icon",FAST_FORWARD_ICON:Mt,REWIND_ICON:xt,SHARE_ICON:"flowplayer-share-icon",SUBTITLES_MENU_ICON:"flowplayer-subs-menu-icon",MENU_BACK_ICON:"flowplayer-menu-back",VOLUME_ICON:Ft,MUTE_ICON:"flowplayer-mute-icon",UNMUTE_ICON:"flowplayer-unmute-icon",CLOSE_ICON:"flowplayer-close-icon",FACEBOOK_ICON:"flowplayer-facebook-icon",TWITTER_ICON:"flowplayer-twitter-icon",LINK_ICON:"flowplayer-link-icon",EMBED_ICON:"flowplayer-embed-icon",LIVE_COUNTDOWN:Nt,PLAYLIST_CONTROLS:"flowplayer-playlist-controls",THUMBNAILS_CAROUSEL:"flowplayer-thumbnails-carousel",ERROR_COMPONENT:Ut,TV_MENU:"flowplayer-tv-menu",CUE_COMPONENT:"flowplayer-cue",SSAI_UI:"flowplayer-ssai-ui",SSAI_CONTROLS:"flowplayer-ssai-controls",SSAI_TIMELINE:"flowplayer-ssai-timeline",SSAI_INDICATOR:"flowplayer-ssai-indicator"});const $t="is-playing",Gt="is-fullscreen",Ht="is-paused",Kt="is-muted",Vt="is-loaded",jt="is-loading",qt="is-starting",Wt="is-seeking",Yt="is-disabled",zt="is-small",Qt="is-tiny",Xt="is-rtl",Zt="is-ended",Jt="is-live",te="is-error",ee="is-waiting",se="is-autoplay",ie="is-toggling",re="is-live-seeked",ne="no-timeline",ae="has-poster",oe="will-play",le="will-pause",de="has-menu-opened",ce="is-touched",ue="is-hovered",he="is-touch-device",fe="will-seek",ge="is-seekable",pe="is-in-viewport",me="no-controls",ve="is-destroyed",ye="is-source-processing";var Ee=Object.freeze({__proto__:null,PLAYING:$t,FULLSCREEN:Gt,PAUSED:Ht,MUTED:Kt,LOADED:Vt,LOADING:jt,STARTING:qt,SEEKING:Wt,GRABBING:"is-grabbing",DISABLED:Yt,SMALL:zt,TINY:Qt,RTL:Xt,TV:"is-tv",ENDED:Zt,LIVE:Jt,ERRORED:te,WAITING:ee,AUTOPLAY:se,SEAMLESS:"is-seamless",TOGGLING:ie,LIVE_SEEKED:re,NO_DVR:ne,HAS_POSTER:ae,WILL_PLAY:oe,WILL_PAUSE:le,MENU_OPENED:de,TOUCHED:ce,HOVERED:ue,TOUCH_DEVICE:he,WILL_SEEK:fe,SEEKABLE:ge,IN_VIEWPORT:pe,NO_CONTROLS:me,DESTROYED:ve,IS_SOURCE_PROCESSING:ye});function Te(t){this.message=t}Te.prototype=new Error,Te.prototype.name="InvalidCharacterError";var Se="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(t){var e=String(t).replace(/=+$/,"");if(e.length%4==1)throw new Te("'atob' failed: The string to be decoded is not correctly encoded.");for(var s,i,r=0,n=0,a="";i=e.charAt(n++);~i&&(s=r%4?64*s+i:i,r++%4)?a+=String.fromCharCode(255&s>>(-2*r&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return a};var Ae=function(t){var e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw"Illegal base64url string!"}try{return function(t){return decodeURIComponent(Se(t).replace(/(.)/g,function(t,e){var s=e.charCodeAt(0).toString(16).toUpperCase();return s.length<2&&(s="0"+s),"%"+s}))}(e)}catch(t){return Se(e)}};function _e(t){this.message=t}_e.prototype=new Error,_e.prototype.name="InvalidTokenError";var be=function(t,e){if("string"!=typeof t)throw new _e("Invalid token specified");var s=!0===(e=e||{}).header?0:1;try{return JSON.parse(Ae(t.split(".")[s]))}catch(t){throw new _e("Invalid token specified: "+t.message)}};be.InvalidTokenError=_e;const Le=new Map,Re=(t,e)=>new(((t,e)=>{const s=t.get(e);if(!s)throw new Error(`no flowplayer component with the name ${e} exists`);const i=window.customElements.get(e);if(!i)throw new Error(`no default flowplayer component with the name ${e} exists`);const r=window.customElements.get(s);return"function"!=typeof r?i:r})(t._customElements,e))(t),Ie=(t,e,s)=>{window.customElements.get(e)||window.customElements.define(e,s),t.customElements.get(e)||t.customElements.set(e,e)},ke=(t,e)=>{const s=t.customElements.get(e),i=s&&s===e,r=Object.values(t.defaultElements).includes(e);return Boolean(r||i)};var we,Pe;function De(t){return!0===t?Pe.ON:!1===t?Pe.OFF:t}!function(t){t[t.LOW=1]="LOW",t[t.MEDIUM=2]="MEDIUM",t[t.HIGH=4]="HIGH"}(we||(we={})),function(t){t[t.OFF=0]="OFF",t[t.ON=1]="ON",t[t.AUDIO_REQUIRED=2]="AUDIO_REQUIRED"}(Pe||(Pe={}));const Ce={Unknown:"00-00",MediaUnknown:"01-00",MediaUnavailable:"01-01",MediaUnsupportedVideoFormat:"01-02",MediaUnsupportedAudioFormat:"01-03",MediaBitrateExceeded:"01-04",MediaBufferOverread:"01-05",MediaIntegerOverflow:"01-06",MediaQuotaExceeded:"01-07",MediaInvalidCompositionDuration:"01-08",MediaInvalidCompositionSourceDuration:"01-09",MediaInvalidCompositionSourceStartTime:"01-10",MediaMalformedDepth:"01-11",PlaybackUnknown:"02-00",PlaybackVideoBufferUnderRun:"02-01",PlaybackAudioBufferUnderRun:"02-02",PlaybackVideoBufferingTimeout:"02-03",PlaybackAudioBufferingTimeout:"02-04",PlaybackManifestParseError:"02-05",PlaybackVideoDecodeError:"02-06",PlaybackAudioDecodeError:"02-07",PlaybackDroppedFramesExceeded:"02-08",PlaybackPlayheadExceedsDuration:"02-09",PlaybackUnsupportedDevice:"02-10",PlaybackManifestLoadError:"02-11",PlaybackManifestLoadTimeout:"02-12",PlaybackManifestParsingError:"02-13",PlaybackManifestIncompatibleCodecs:"02-14",PlaybackLevelEmptyError:"02-15",PlaybackLevelLoadError:"02-16",PlaybackLevelLoadTimeout:"02-17",PlaybackLevelSwitchError:"02-18",PlaybackAudioTrackLoadError:"02-19",PlaybackAudioTrackLoadTimeout:"02-20",PlaybackFragLoadError:"02-21",PlaybackFragLoadTimeout:"02-22",PlaybackFragDecryptError:"02-23",PlaybackFragParsingError:"02-24",PlaybackFragGap:"02-25",PlaybackRemuxAllocError:"02-26",PlaybackBufferAddCodecError:"02-27",PlaybackBufferIncompatibleCodecs:"02-28",PlaybackBufferAppendError:"02-29",PlaybackBufferStalledError:"02-30",PlaybackBufferFullError:"02-31",PlaybackBufferSeekOverHole:"02-32",PlaybackBufferNudgeOnStall:"02-33",PlaybackInternalException:"02-34",PlaybackInternalAborted:"02-35",PlaybackManifestLoaderFailure:"02-36",PlaybackSegmentBaseLoaderError:"02-37",PlaybackTimeSyncFailed:"02-38",PlaybackFragmentLoaderFailure:"02-39",PlaybackAppendError:"02-40",PlaybackRemoveError:"02-41",PlaybackDataUpdateFailed:"02-42",PlaybackManifestNoStreams:"02-43",PlaybackUnknownManifestType:"02-44",PlaybackDashInsufficientSegmentInfo:"02-45",PlaybackDashNoRepresentations:"02-46",PlaybackDashNoAdaptationSets:"02-47",PlaybackDashNoInitSegment:"02-48",PlaybackDashUnsupportedContainerFormat:"02-49",PlaybackDashKeySystemMismatch:"02-50",PlaybackMultipleKeyIDs:"02-51",PlaybackDashConflictingKeyIDs:"02-52",PlaybackRestrictedStreams:"02-53",PlaybackHlsMasterAndMediaTags:"02-54",PlaybackRepresentationIdConflict:"02-55",PlaybackHlsUnsupportedKeyFormats:"02-56",PlaybackManifestNoVariants:"02-57",PlaybackHlsUndeclaredVariables:"02-58",PlaybackAes128InvalidKeyLength:"02-59",PlaybackDashConflictingAes128Keys:"02-60",PlaybackDashUnsupportedAes128Encryption:"02-61",PlaybackManifestPatchMismatch:"02-62",PlaybackEmptyMediaPlaylist:"02-63",PlaybackNonContiguousCompositionTrack:"02-64",PlaybackDecoderNotFound:"02-65",PlaybackDecoderTemporarilyUnavailable:"02-66",PlaybackIncompatibleAsset:"02-67",PlaybackNoCompatibleExternalDisplay:"02-69",PlaybackOutOfMemory:"02-70",PlaybackToneMappingFailed:"02-71",PlaybackVideoCompositorFailed:"02-72",NetworkUnknown:"03-00",NetworkNoInternet:"03-01",NetworkRequestTimeout:"03-02",NetworkUnableToResolveHost:"03-03",NetworkResourceNotFound:"03-04",NetworkExpiredUrl:"03-05",NetworkUrlResolutionFailed:"03-06",NetworkDownloadErrorIdManifest:"03-07",NetworkDownloadErrorIdSidx:"03-08",NetworkDownloadErrorIdContent:"03-09",NetworkDownloadErrorIdInitialization:"03-10",NetworkDownloadErrorIdXlink:"03-11",NetworkHttpRequestFailed:"03-12",NetworkMaxRetriesExceeded:"03-13",NetworkSegmentMissing:"03-14",NetworkHttp400BadRequest:"03-400",NetworkHttp401Unauthorized:"03-401",NetworkHttp402PaymentRequired:"03-402",NetworkHttp403Forbidden:"03-403",NetworkHttp404NotFound:"03-404",NetworkHttp405MethodNotAllowed:"03-405",NetworkHttp406NotAcceptable:"03-406",NetworkHttp407ProxyAuthenticationRequired:"03-407",NetworkHttp408RequestTimeout:"03-408",NetworkHttp409Conflict:"03-409",NetworkHttp410Gone:"03-410",NetworkHttp411LengthRequired:"03-411",NetworkHttp412PreconditionFailed:"03-412",NetworkHttp413PayloadTooLarge:"03-413",NetworkHttp414URITooLong:"03-414",NetworkHttp415UnsupportedMediaType:"03-415",NetworkHttp416RangeNotSatisfiable:"03-416",NetworkHttp417ExpectationFailed:"03-417",NetworkHttp418ImATeapot:"03-418",NetworkHttp421MisdirectedRequest:"03-421",NetworkHttp422UnprocessableEntity:"03-422",NetworkHttp423Locked:"03-423",NetworkHttp424FailedDependency:"03-424",NetworkHttp425TooEarly:"03-425",NetworkHttp426UpgradeRequired:"03-426",NetworkHttp428PreconditionRequired:"03-428",NetworkHttp429TooManyRequests:"03-429",NetworkHttp431RequestHeaderFieldsTooLarge:"03-431",NetworkHttp451UnavailableForLegalReasons:"03-451",NetworkHttp500InternalServerError:"03-500",NetworkHttp501NotImplemented:"03-501",NetworkHttp502BadGateway:"03-502",NetworkHttp503ServiceUnavailable:"03-503",NetworkHttp504GatewayTimeout:"03-504",NetworkHttp505HTTPVersionNotSupported:"03-505",NetworkHttp506VariantAlsoNegotiates:"03-506",NetworkHttp507InsufficientStorage:"03-507",NetworkHttp508LoopDetected:"03-508",NetworkHttp510NotExtended:"03-510",NetworkHttp511NetworkAuthenticationRequired:"03-511",ContentProtectionUnknown:"04-00",ContentProtectionConcurrentStreamLimitExceeded:"04-01",ContentProtectionEntitlementRefused:"04-02",ContentProtectionLicenseExpired:"04-03",ContentProtectionBadLicenseRequest:"04-04",ContentProtectionLicenseServerTimeout:"04-05",ContentProtectionInsufficientHDCPSupport:"04-06",ContentProtectionGeoRestricted:"04-07",ContentProtectionParentalControlRestricted:"04-08",ContentProtectionCDNUnauthorized:"04-09",ContentProtectionInvalidAccessToken:"04-10",ContentProtectionKeySystemNoKeys:"04-11",ContentProtectionKeySystemNoAccess:"04-12",ContentProtectionKeySystemNoSession:"04-13",ContentProtectionKeySystemNoConfiguredLicense:"04-14",ContentProtectionKeySystemCertificateRequestFailed:"04-15",ContentProtectionKeySystemCertificateUpdateFailed:"04-16",ContentProtectionKeySystemSessionUpdateFailed:"04-17",ContentProtectionKeySystemStatusOutputRestricted:"04-18",ContentProtectionKeySystemStatusInternalError:"04-19",ContentProtectionKeyLoadError:"04-20",ContentProtectionKeyLoadTimeout:"04-21",ContentProtectionCapabilityMediaKeysError:"04-22",ContentProtectionManifestKeySystemUnknown:"04-23",ContentProtectionKeySystemUnavailable:"04-24",ContentProtectionCDMCreationFailed:"04-25",ContentProtectionCDMAttachFailed:"04-26",ContentProtectionCDMServerCertificateRejected:"04-27",ContentProtectionCDMSessionCreationFailed:"04-28",ContentProtectionCDMLicenseRequestFailed:"04-29",ContentProtectionCDMLicenseResponseRejected:"04-30",ContentProtectionManifestMissingDRMInfo:"04-31",ContentProtectionLicenseServerMissing:"04-32",ContentProtectionOfflineSessionRemoved:"04-33",ContentProtectionInitDataTransformationError:"04-34",ContentProtectionServerCertificateRequestFailed:"04-35",ContentProtectionInsufficientHDCPVersion:"04-36",ContentProtectionHDCPVersionCheckFailed:"04-37",AdsUnknown:"08-00",AdsVastParseError:"08-100",AdsInvalidVastSchema:"08-101",AdsVastVersionNotSupported:"08-102",AdsUnexpectedAdType:"08-200",AdsCreativeLinearityMismatch:"08-201",AdsCreativeDurationMismatch:"08-202",AdsCreativeSizeMismatch:"08-203",AdsWrapperVastError:"08-300",AdsVastResponseRedirectTimeout:"08-301",AdsWrapperLimitReached:"08-302",AdsVastResponseEmpty:"08-303",AdsLinearAdDisplayError:"08-400",AdsMediaFileNotFound:"08-401",AdsMediaFileUnavailable:"08-402",AdsUnsupportedMimeType:"08-403",AdsUnableToDisplayMediaFile:"08-405",AdsMezzanineFileMissing:"08-406",AdsMezzanineFileDownloaded:"08-407",AdsRejectedAd:"08-408",AdsInteractiveCreativeError:"08-409",AdsVerificationNodeExecutionError:"08-410",AdsNonLinearAdDisplayError:"08-500",AdsNonLinearAdSizeMismatch:"08-501",AdsNonLinearAdFetchError:"08-502",AdsNonLinearUnsupportedType:"08-503",AdsCompanionAdDisplayError:"08-600",AdsCompanionAdSizeMismatch:"08-601",AdsRequiredCompanionAdError:"08-602",AdsCompanionAdFetchError:"08-603",AdsUndefinedVastError:"08-900",AdsUnknownVpaidError:"08-901",AdsVastDocumentEmpty:"08-999"},Oe=Object.fromEntries(Object.entries(Ce).map(([t,e])=>[e,t]));function Me(t,e,s){const i="boolean"==typeof s;if("boolean"!=typeof s&&(s=!!t.hasState(le)||t.paused),function(t,e,s){const i=t.poll(e?it:rt,{forced:s});return i&&i.defaultPrevented}(t,s,i))return Promise.resolve();if(!s)return t.hasState(oe)?(t.setState(le,!0),t.setState(oe,!1),Promise.resolve()):Promise.resolve(t.pause());if(0==t.reaper)return Promise.resolve();const r=t.reaper.get("__pending_play");return t.paused||r?r?(r.src!==Fe(t.original_src)&&xe(t),r):(function(t){return(0==t.networkState||0==t.readyState)&&t.currentSrc==Fe(t.original_src)}(t)&&xe(t),function(t){const e=t.hasState(se),s=e&&(t=>t.autoplay&&Pe.AUDIO_REQUIRED&De(t.autoplay))(t.opts);s&&(t.muted&&t.toggleMute(!1),0==t.volume&&(t.volume=1));e&&t.setState(se,!1);return t.play().then(()=>{t.hasState(le)&&t.togglePlay(!1)}).catch(i=>{if(console.warn(e?s?"[flowplayer/play] autoplay audio required\n%s":"[flowplayer/play] attempting muted autoplay\n%s":"",i.message,"\ninstance:",t),e&&!s)return t.muted=!0,t.play()})}(t)):(t.setState(le,!1),!t.hasState($t)&&t.setState(oe,!0),Promise.resolve())}function xe(t){t.opts.is_native&&(t.hasState(Vt)||(t.hasState(jt)||t.emit(nt),t.setState(jt,!0),t.load()))}function Fe(t){const e=document.createElement("a");return e.href=t,e.href}function Ne(t,e){var s={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(s[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(s[i[r]]=t[i[r]])}return s}function Ue(t){const e=document.createElement("a");e.href=t;const s=e.pathname&&e.pathname.split(".");return s.length>1&&s[s.length-1]}function Be(t){switch(t){case"video/mpd":return"application/dash+xml";case"video/m3u8":return"application/x-mpegurl";default:return t}}const $e=t=>{var{src:e}=t,s=Ne(t,["src"]);return[Object.assign({src:e,type:e?Be("video/"+Ue(e)):""},s)]};function Ge(t){return $e({src:t})}function He(t){var{src:e,type:s}=t,i=Ne(t,["src","type"]);return e&&s?[Object.assign({src:e,type:s},i)]:s&&!e?[Object.assign({type:s},i)]:$e(Object.assign({src:e},i))}const Ke="health:record",Ve="rebuffer",je="rebuffer:ended",qe="display",We="insights:ttff",Ye="insights:time_to_first_frag_loaded",ze="insights:watched_interval",Qe="flowplayer:feature",Xe="health:ready";var Ze=Object.freeze({__proto__:null,RECORD:Ke,REBUFFER:Ve,REBUFFER_ENDED:je,DISPLAY:qe,TIME_TO_FIRST_FRAME:We,TIME_TO_FIRST_FRAGMENT_LOADED:Ye,WATCHED_INTERVAL:ze,FEATURE_USAGE:Qe,HEALTH_SERVICE_READY:Xe});const Je={All:1,High:.1,Medium:.01,Low:.001,None:0};function ts(t,{feature_name:e,behavior:s,sample_rate:i}){e&&(i||(i=Je.All),t.emit(Qe,{feature_name:e,behavior:s,sample_rate:i}))}var es;function ss(t,e,s,i={safari:!1}){const r=is(s);return function(t){[Wt,le,oe,$t,Ht,jt,Vt,re].forEach(e=>t.setState(e,!1)),t.setState(qt,!0)}(t),Array(...Array(r.length)).map((t,e)=>e).some(s=>{const n=r[s];if(es.Ok==function(t,e,s){t.emit(F,s),e.playback_token&&"string"==typeof s.src&&s.src.startsWith("https://")&&(s.src=function(t,e){const s=new URL(t);return s.pathname=`/pt:${e}${s.pathname}`,s.toString()}(s.src,e.playback_token),ts(t,{feature_name:"signed-urls",behavior:"used",sample_rate:.1}));"string"==typeof s.src&&(t.original_src=s.src);const i=function(t,e,s){return t.plugins.filter(t=>{return(e=t)&&"wants"in e;var e}).find(t=>t.wants(s.src||"",s,e))}(t,e,s);return t.setOpts({is_native:!i}),i?(i.onload(e,t.root,t,s),es.Ok):es.Err}(t,e,n)||es.Ok==function(t,e,s,i={safari:!1}){var r;/^audio\//.test(s.type||"")&&t.emit(J);e.start_time&&(s.src=s.src+"#t="+e.start_time);if(""==t.canPlayType(s.type||""))return es.Err;if(s.drm&&(!s.drm["com.apple.fps.1_0"]||!i.safari))return es.Err;"string"==typeof s.src&&(t.preload=null!==(r=e.preload)&&void 0!==r?r:"auto",t.src=s.src);return es.Ok}(t,e,n,i))return!0;s==r.length-1&&"string"==typeof n.src&&(t.src=n.src)}),t}function is(t){return"string"==typeof t?Ge(t):Array.isArray(t)||"object"!=typeof t?t.reduce(function(t,e){return"string"==typeof e&&(e=Ge(e)),"object"!=typeof e||Array.isArray(e)||(e=He(e)),t.concat(e)},[]):He(t)}!function(t){t[t.Err=0]="Err",t[t.Ok=1]="Ok"}(es||(es={}));const rs=[N,C,F,Y];var ns;function as(t,e,s){return isNaN(t.duration)||isNaN(t.currentTime)?{}:(e.offset+=s,0==e.offset?os(t,e):(e.timer&&clearTimeout(e.timer),e.timer=setTimeout(function(){0!=t.reaper&&(t.currentTime=function(t,e,s=0){return Math.max(Math.min(e,t),s)}(t.currentTime+e.offset,t.duration),e.timer=0,os(t,e))},1e3),function(t,e){t.setState(fe,!0),t.setState(ns.BACKWARD,e.offset<0),t.setState(ns.FORWARD,e.offset>0)}(t,e),t.emit(W,e),e))}function os(t,e){e.timer&&clearTimeout(e.timer),e.timer=e.offset=0,function(t){t.setState(ns.FORWARD,!1),t.setState(ns.BACKWARD,!1),t.setState(fe,!1)}(t)}function ls(t,e){const s=t._customElements.get(e);return s&&t.root.querySelector(s)||void 0}function ds(){if("undefined"==typeof document)return!1;const t=document.documentElement;return t&&"rtl"==t.getAttribute("dir")}function cs(...t){const e=document.createElement("div");return 0==t.length||e.classList.add(...t),e}function us(t,e,s){const i=function(t){return Array.isArray(t)?t.slice(0):t.split(".")}(e);for(;i.length;){if(null==t)return s;const e=i.shift();if("string"!=typeof e)return s;t=t[e]}return null==t?s:t}function hs(t){const e="number"==typeof t?t:parseInt(t,10);return(e>9?"":"0")+e}function fs(t){if(isNaN(t)||t>=Number.MAX_SAFE_INTEGER)return"";const e=t<0?"-":"";t=Math.round(Math.abs(t));const s=Math.floor(t/3600);let i=Math.floor(t/60);return t-=60*i,s>=1?(i-=60*s,e+s+":"+hs(i)+":"+hs(t)):e+hs(i)+":"+hs(t)}!function(t){t.FORWARD="forward",t.BACKWARD="backward"}(ns||(ns={}));const gs=navigator.languages||[navigator.language];function ps(t,e,s,i){if((i=i||0)>=t.length)return s;return us(t[i],e,ps(t,e,s,i+1))}function ms(t,e,s){const i=new Map,r=e.lang;return r&&t[r]&&i.set(r,t[r]),function(){try{return gs.reduce((t,e)=>~e.indexOf("-")?t.concat(e,e.split("-")[0]):t.concat(e),[])}catch(t){return[]}}().forEach(function(e){t[e]&&!i.has(e)&&i.set(e,t[e])}),t[s]&&!i.has(s)&&i.set(s,t[s]),Array.from(i.values())}const vs=[1e7]+""+-1e3+-4e3+-8e3+-1e11,ys=()=>"undefined"==typeof crypto?"":vs.replace(/[018]/g,t=>(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16)),Es="flowplayer/uuid";let Ts="";!function(){let t=!1;try{const e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("testPassive",null,e),window.removeEventListener("testPassive",null,e)}catch(t){}}();const Ss=["touchstart","touchmove"];function As(t,e){const s=new CustomEvent(t,{detail:e,cancelable:!0});return e&&Object.defineProperty(s,"data",{get:()=>e}),s}function _s(t,e,s){const i=As(e,s);return t.dispatchEvent(i),t}function bs(t,e,s){const i=As(e,s);return t.dispatchEvent(i),i}function Ls(t,e,s,i){Array.isArray(e)?e.forEach(e=>Rs(t,e,s,i)):Rs(t,e,s,i)}function Rs(t,e,s,i){if(r=e,!~Ss.indexOf(r))return t.addEventListener(e,s,i),t;var r;const n=Object.assign(i||{},{passive:!0});return t.addEventListener(e,s,n),t}function Is(t,e,s,i){return Ls(t,e,s,Object.assign(i||{},{once:!0}))}class PlayerStorage{constructor(t,e){this.implementation=t,e&&e.keys().forEach(t=>{"string"==typeof e.implementation[t]&&this.implementation.setItem(t,e.implementation[t])})}keys(){var t;const e=[];for(var s=0;s<this.implementation.length;s++)(null===(t=this.implementation.key(s))||void 0===t?void 0:t.startsWith("flowplayer/"))&&e.push(this.implementation.key(s));return e}removeItem(t){try{this.implementation.removeItem(`flowplayer/${t}`)}catch(t){}}getItem(t){try{return this.implementation.getItem(`flowplayer/${t}`)}catch(t){return null}}setItem(t,e){try{this.implementation.setItem(`flowplayer/${t}`,e)}catch(t){}}clear(){try{this.keys().forEach(t=>this.implementation.removeItem(t))}catch(t){}}get length(){try{return this.keys().length}catch(t){return 0}}key(t){try{return this.implementation.key(t)}catch(t){return null}}}class InMemoryStorage{constructor(){this.pairs=[]}get length(){return this.pairs.length}clear(){this.pairs=[]}getItem(t){var e;return(null===(e=this.pairs.find(e=>e[0]===t))||void 0===e?void 0:e[1])||null}key(t){return this.pairs[t][0]||null}removeItem(t){this.pairs=this.pairs.filter(e=>e[0]!==t)}setItem(t,e){this.removeItem(t),this.pairs.push([t,e])}}const ks={preload:"auto",rtl:!1,controls:!0},ws=["muted","preload"];function Ps(t,i,r){let n;r.live_state={dvr_window:void 0,get dvr(){return n},set dvr(e){n=e;const s=!(!t.live||e);r.hasState(ne)!=s&&r.setState(ne,s)}},r._storage=new PlayerStorage(["localStorage","sessionStorage"].map(t=>{try{const e=window[t];return e.getItem(""),e}catch(e){return console.debug(`Access to window.${t} denied, trying next option`),null}}).find(t=>!!t)||new InMemoryStorage),r.toJSON=function(){return{duration:r.duration,volume:r.volume,currentTime:r.currentTime,states:r.root.className}},r.setSrc=function(e){return ss(r,t,e,s())},r.playerState=r.playerState||{},r.setState=function(t,e){if(r.playerState[t]===!!e)return r;const s=Object.assign({},r.playerState,{[t]:e});return r.playerState=s,_s(r,st,r.playerState),r},r.createComponents=function(...t){return Array.from({length:t.length}).map((e,s)=>Re(this,t[s]))},r.hasState=function(t){return!!r.playerState[t]},r.transitionState=function(t,e,s){!r.hasState(t)&&r.hasState(e)||(s=0),s&&r.setState(ie,!0),r.setState(e,!1),r.setState(t,!0),s&&setTimeout(function(){r.setState(ie,!1)},s)},r.emit=(t,e)=>(_s(r,t,e),r),r.on=(t,e)=>(Ls(r,t,e),r),r.once=(t,e)=>(Is(r,t,e),r),r.off=(t,e)=>{var s,i;return s=t,i=e,r.removeEventListener(s,i),r},r.poll=(t,e)=>bs(r,t,e),r.togglePlay=function(t){return r.hasState(te)?Promise.reject():Me(r,0,t)},r.toggleMute=function(t){t=null==t?!r.muted:!!t,r.muted=t,r.muted||r.volume||(r.volume=1),_s(r,b)},r.toggleDisable=function(t){t=null==t?!r.disabled:!!t,r.setState(Yt,t),r.disabled=t},r.destroy=function(){r.pause();const t=e.indexOf(r);~t&&e.splice(t,1),setTimeout(function(){r.setSrc([]),r.reaper&&r.reaper.clear(),_s(r,N),r.setState(ve,!0)},0)},r.setAttrs=function(t){return ws.forEach(e=>{if(!(e in t))return;const s=t[e];s?r.setAttribute(e,s.toString()):r.removeAttribute(e)}),r},r.opt=function(e,s){return s=void 0===s?us(ks,e):s,us(t,e,s)},r.i18n=function(t,e){if(!r.reaper)return"";const s=r.reaper.get("translations");return s?ps(s,t,e||""):e||""},r.setOpts=function(e){Object.assign(t,e),t.live&&!r.hasState(Jt)&&(r.setState(ne,!0),_s(r,j)),"disabled"in e&&void 0!==e.disabled&&r.toggleDisable(e.disabled),"muted"in e&&void 0!==e.muted&&r.toggleMute(e.muted),"dvr"in t&&(r.live_state.dvr=r.opt("dvr")),r.setState(Xt,r.opt("rtl",function(t){if(!t)return ds();const e=t.getAttribute("dir");return e?"rtl"==e:ds()}(i))),r.setState(Jt,!!t.live),r.setState(ae,"string"==typeof t.poster&&t.poster.length>0),r.setState(ge,!!t.seekable),r.setState(me,0==t.controls),i.style.backgroundImage=r.hasState(ae)?"url('"+t.poster+"')":"",_s(r,et,t)},r.renderPlugin=function(t){bs(r,Z,t).defaultPrevented||r.root.appendChild(t)};const a={offset:0,timer:0};var o,l;l=a,(o=r).on(rs,function(){os(o,l)}),r.enqueueSeek=function(t){if(0!=r.opts.seekable&&!(1==r.opts.disabled&&t>0))return as(r,a,t)},r.deviceId=function(){return function(t){if(Ts)return Ts;try{const e=t.getItem(Es);if(e)return e;const s=ys();return t.setItem(Es,s),s}catch(t){return Ts=ys()}}(r._storage)}}var Ds="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function Cs(t,e){if("object"==typeof exports&&"undefined"!=typeof module)return e;if(null===document.currentScript)return e;"flowplayer"in t||(t.flowplayer={extensions:[]});const s=t.flowplayer;return"function"==typeof s?(s(e),e):(Array.isArray(s.extensions)||(s.extensions=[]),~s.extensions.indexOf(e)||s.extensions.push(e),e)}function Os(){return"undefined"!=typeof window?window:void 0!==Ds?Ds:{}}const Ms=["localhost","127.0.0.1","0.0.0.0","s.codepen.io","cdpn.io","try.flowplayer.com"];function xs(t,e){return!!~Ms.indexOf(t)||t.indexOf(e)===t.length-e.length}xs.check_whitelist=function(t){return!!~Ms.indexOf(t)};const Fs="production";function Ns(t,e){const s={valid_jwt:!1,raw:"",data:{acl:0},exp:0};let i={c:"{}",exp:0};e=e||{};try{i=be(t),s.valid_jwt=!0}catch(t){}return s.raw=t,s.data=JSON.parse(i.c),s.exp=i.exp,e.require_valid_token&&Ns.validate(s),s}var Us;function Bs(t){return{grant:t,is_granted:e=>(t&e)===e}}Ns.validate=function(t){if("string"==typeof t&&(t=Ns(t)),!t||!t.raw){if(xs.check_whitelist(window.location.hostname)||"dev"===Fs.toString())return!0;throw new Error("No token provided in configuration")}if(!t.valid_jwt)throw new Error("Invalid token provided");const e=window.location.hostname,s=xs.bind(null,e);if("dev"!==Fs.toString()&&t.data.domain&&t.data.domain.length&&!t.data.domain.some(s))throw new Error("Domain not allowed");if("dev"!==Fs.toString()&&1e3*t.exp-Date.now()<0)throw new Error("Expired token");return!0},Ns.id=function(t){if(t)return"string"==typeof t&&(t=Ns(t)),t.data.id},function(t){t[t.ADS=2]="ADS",t[t.ANALYTICS=4]="ANALYTICS",t[t.NO_METERING=8]="NO_METERING",t[t.DEVELOPER_PLAN=16]="DEVELOPER_PLAN",t[t.WOWZA_VIDEO=32]="WOWZA_VIDEO"}(Us||(Us={})),Bs.of=Bs,Bs.from_token=function(t){const e=Ns(t,{require_valid_token:!0});return Bs.of(e.data.acl)},Bs.permissions=Us;const $s=["Expired token","No token provided in configuration","Invalid token provided","Domain not allowed"];function Gs({root:t,video:e,data:s}){e&&e.destroy(),console.error(new Error(s.details||s.reason)),t.innerHTML="",t.classList.remove("flowplayer"),t.classList.add("flowplayer-fatal"),t.style.removeProperty("background-image");const i=!!(r=s.details)&&$s.some(t=>r.includes(t));var r;const n=document.createElement("h2");n.textContent=i?"No Valid Token":"Playback Error";const a=document.createElement("p");a.textContent="Are you the site owner?";const o=document.createElement("a");o.classList.add("troubleshoot"),o.target="_blank",i?(o.href="https://form.typeform.com/to/YKJpmJSy",o.textContent="Get Trial Token (Beta)"):(o.href="https://docs.flowplayer.com/troubleshooting/player#"+s.reason,o.textContent="Troubleshoot?");const l=document.createElement("img");l.src="https://flowplayer.com/user/pages/images/logo-white.png",l.alt="Flowplayer Logo",t.append(n,a,o,l)}function Hs(t){return e=>{setTimeout(function(){if(!e.defaultPrevented&&!e.prevented)return t(e)},0)}}const Ks="is-casting";function Vs(t,e){if(!t.parentElement)return;const s=t.clientWidth/t.parentElement.clientWidth*100/2;t.style.left=e-s+"%",t.style.display="block"}function js(t,e){if(isNaN(t.duration))return;const s=t.buffered;s.length&&(e.style.width=Math.min(s.end(s.length-1)/t.duration*100,100)+"%")}function qs(t,e){t.style.width="0",e.style.display="none"}function Ws(t,e){const s=t.seekable;if("object"!=typeof t.opts||0==s.length)return{head:0,tail:0};const i=Qs(t),r=e||t.live_state.dvr_window;return{head:i,tail:"number"!=typeof r||i-r<0?s.start(0):i-r}}function Ys(t){return t.opt("live",!1)||t.duration>=Number.MAX_SAFE_INTEGER}function zs(t){return isFinite(t.duration)?t.duration:0==t.seekable.length?0:Ws(t).head}function Qs(t){var e;const s=t.seekable;return s.length?t.hasState("is-chromecast-playing")||!(null===(e=t.hls)||void 0===e?void 0:e.liveSyncPosition)?s.end(s.length-1):t.hls.liveSyncPosition:0}function Xs(t){const e=t.currentTime,s=Ws(t);return{progress:Math.min(100,Math.max(0,(e-s.tail)/(s.head-s.tail)*100)),is_live:e-s.head>=-10}}function Zs(t,e,s){if(!e.seekable||0==e.seekable.length)return;Vs(s,t);const i=Ws(e),r=(100-Math.max(0,Math.min(t,100)))/100*(i.head-i.tail);s.innerText="-"+fs(r)}function Js(t){t.currentTime=Ws(t).tail}function ti(t){try{t.dvr_offset=0,t.currentTime=Qs(t)}catch(t){console.warn("failed to seek to now: %j",t)}}function ei(t,e){t/=100,e.currentTime=function(t,e){if(e>1||e<0)return console.warn("cannot calculate a percent outside of range(0..1)"),0;const s=Ws(t);return s.tail+e*(s.head-s.tail)}(e,t)}function si(t,e){t.style.width="0",e.style.display="none"}function ii(t,e){const s=e.clientWidth;e.classList.toggle(zt,s<600),e.classList.toggle(Qt,s<400)}function ri(t,e){if(!t.hasState(Jt)||![void 0,0,-1].includes(e)||!t.seekable.length||t.hasState("has-casted"))return t.setState(qt,!1);t.once(D,()=>t.setState(qt,!1)),0===e?Js(t):ti(t)}const ni=[0].concat(Array.from({length:100}).map((t,e)=>(e+1)/100));function ai(){return e.find(t=>t.hasState(Ks))}const oi=.5625;function li(t){if("number"==typeof t&&!isNaN(t))return Number(t);if("string"==typeof t){const e=t.split(":");return Number(e[1])/Number(e[0])}return t}class ExplorerPlan{constructor(){this.cleanUp=this.cleanUp.bind(this),this.render=this.render.bind(this),this.wireUp=this.wireUp.bind(this)}init(t,e,s){this.root=e,this.player=s,this.wireUp()}wireUp(){var t,e;this.cleanUp(),null===(t=this.player)||void 0===t||t.once(R,this.render),null===(e=this.player)||void 0===e||e.once(P,this.wireUp)}cleanUp(){var t,e,s,i;null===(e=null===(t=this._logo)||void 0===t?void 0:t.parentElement)||void 0===e||e.removeChild(this._logo),null===(s=this.player)||void 0===s||s.off(R,this.render),null===(i=this.player)||void 0===i||i.off(P,this.wireUp)}render(){var t,e,s;null===(e=null===(t=this._logo)||void 0===t?void 0:t.parentElement)||void 0===e||e.removeChild(this._logo);const i=(null===(s=this.root)||void 0===s?void 0:s.querySelector(".fp-ui"))||this.root;if(!i)return;const r=this._logo=document.createElement("a");r.href="https://developer.wowza.com/docs/wowza-flowplayer",r.target="_blank",r.className="fp-explorer-logo",i.appendChild(r)}}ExplorerPlan.pluginName="explorer-plan";const di="flowplayer/"+R;function ci(t,e){const s=[];t.addEventListener("contextmenu",i=>{const r=i.timeStamp;for(s.push(r);s.length>3;)s.shift();s.length>=3&&s.every(t=>t-r<3e3)&&(console.debug("flowplayer/debug rendering info"),function(t,e){var s;!function(t){const e=t.querySelector(".debug-info");null==e||e.remove()}(t);const i=document.createElement("div");i.classList.add("debug-info");const r=ui("flowplayer.version","3.35.0");i.append(r);const n=null===(s=null==e?void 0:e.hls)||void 0===s?void 0:s.constructor;if(n&&n.version){const t=ui("hls.version",n.version);i.append(t)}t.appendChild(i)}(t,e))})}const ui=(t,e)=>{const s=document.createElement("div");s.classList.add("row",t);const i=document.createElement("span");i.classList.add("attr"),i.textContent=t;const r=document.createElement("span");return r.textContent=e,r.classList.add("value"),s.append(i,r),s};function hi(t,e){const s=function(){try{return localStorage.getItem("flowplayer/debug")}catch(t){return""}}(),i=(i,...r)=>{try{const n=(null==e?void 0:e.debug)||s;n&&t.match(n)&&console.log(`flowplayer/${t} -- ${i}`,...r)}catch(t){console.warn(t)}};return i.log=i,i}const fi="on",gi="without_recovery",pi="off";class FlowplayerError extends Error{static getErrorKey(t){return t in Oe?Oe[t]:Oe["00-00"]}constructor(t,e,s={}){super(t),this.message=t,this.flowplayerErrorCode=e,this.config=s,this.id=ys(),this.isFatal=!!s.isFatal,this.errorKey=FlowplayerError.getErrorKey(this.flowplayerErrorCode)||"unknown"}toJSON(){return{message:this.message,flowplayer_error_code:this.flowplayerErrorCode,id:this.id,root_error_id:this.config.rootErrorId,resource:this.config.resource,is_fatal:this.isFatal,is_retry:!!this.config.isRetry}}}const mi=hi("core/retry");function vi(t,e){const s={pending:void 0,count:0};t.on(at,i=>{var n,a,o,l,d;const c=null===(n=i.detail)||void 0===n?void 0:n.error;c.config.isRetry=!!s.count,void 0===s.pending&&(null===(o=null===(a=c.config)||void 0===a?void 0:a.retryOpts)||void 0===o?void 0:o.retry)!==pi&&(e.retry||(null===(d=null===(l=c.config)||void 0===l?void 0:l.retryOpts)||void 0===d?void 0:d.retry))&&(++s.count,s.pending=function(t,e,s){var i,n;return setTimeout(()=>{var i;t.hasState(ve)||(e.pending=void 0,(null===(i=s.config.retryOpts)||void 0===i?void 0:i.retry)!==gi&&t.emit(q),t.emit(r,{error:s}),mi("%s try",e.count))},null!==(n=null===(i=s.config.retryOpts)||void 0===i?void 0:i.retryTimeout)&&void 0!==n?n:3e3*e.count)}(t,s,c))}),t.on(R,()=>{s.count=0}),t.on([F,q],t=>{t.type===F&&(s.count=0),clearTimeout(s.pending),s.pending=void 0}),t.on(r,Hs(()=>{t.load()}))}const yi=[nt,n,F];function Ei(t){const e=document.createElement("a");return e.href=t,e}function Ti(t){try{return!!new URL(t)}catch(t){return!1}}function Si(){try{return window.location.hostname!==window.parent.location.hostname?Ei(document.referrer).hostname:document.location.hostname}catch(t){return window.location.hostname}}const Ai=navigator;function _i(t){var e,s;const i=null===(e=t.hls)||void 0===e?void 0:e.bandwidthEstimate;return i?1e-6*i:(null===(s=Ai.connection)||void 0===s?void 0:s.downlink)||-1}function bi(t,e){return async function(t,e){try{await fetch(t,{body:e,method:"POST",mode:"no-cors"})}catch(t){}}(t,JSON.stringify({events:e}))}const Li=t=>{switch(t){case!0:return Pe.ON;case!1:return Pe.OFF;default:return t}};function Ri(){try{const t=window.location!==window.parent.location?document.referrer:document.location.href;return"string"==typeof t&&t.slice(0,200)}catch(t){return!1}}const Ii=[],ki="https://ihi.flowplayer.com/v1/health/events";function wi(t){if(t.suspended)return;const e=Ii.slice(0);Ii.length=0,0!=e.length&&(t.logger.log(`:dispatch events={${e.length}}`),bi(function(){try{return"undefined"==typeof window?ki:window.__FLOWPLAYER_INSIGHTS_URL?window.__FLOWPLAYER_INSIGHTS_URL:ki}catch(t){return ki}}(),e))}async function Pi(t,e,s){const i=await Ci();Ii.push(Object.assign(e,i)),t.logger.log(":enqueue",e.event,e),Ii.length<10&&!s||wi(t)}const Di=()=>{var t,e;try{const s=window;return null===(e=null===(t=null==s?void 0:s.google)||void 0===t?void 0:t.ima)||void 0===e?void 0:e.VERSION}catch(t){return}},Ci=async()=>({client_time:Date.now()}),Oi=(t,e)=>Object.assign(t,{detail:e}),Mi=(t,{event:e,media_session_id:s,session_id:i,play_range_id:r})=>({event:e,media_session_id:s,session_id:i,play_range_id:r,device_id:t.deviceId(),version:"3.35.0",commit:"ab60ba08943a5f3fd421bbff388071c3087b146c",ima_sdk_version:Di(),preload:t.opt("preload"),autoplay:Li(t.opt("autoplay")),live:t.opt("live"),dvr:!!t.live_state.dvr,source:t.original_src,downlink_mbs:_i(t),page_url:Ri(),player_id:t.opt("metadata.player_id"),media_id:t.opt("metadata.media_id")||t.opt("metadata.stream_target_id"),site_id:t.opt("metadata.site_id"),category_id:t.opt("metadata.category_id"),sitegroup_id:t.opt("metadata.sitegroup_id"),token:t.token,plugins:t.plugins.map(t=>t.constructor.name).sort((t,e)=>t.localeCompare(e)),current_time:t.currentTime,external_media_id:t.opt("external_media_id")}),xi=t=>({bitrate:null==t?void 0:t.bitrate,resolution:null==t?void 0:t.attrs.RESOLUTION,frame_rate:null==t?void 0:t.attrs["FRAME-RATE"]});const Fi=(t,e)=>{let s=null;return(...i)=>{null!==s&&(clearTimeout(s),s=null),s=setTimeout(()=>e(...i),t)}};const Ni="ad-initialized",Ui="ad-playback-error",Bi="ad-teardown",$i="ad-videotag-attached",Gi="ad-request-error",Hi="ad-requested",Ki="ad-request-completed",Vi="ad-pause-content",ji="ad-started",qi="ad-completed",Wi="ad-paused",Yi="ad-resumed",zi="ad-progress",Qi="ad-skipped",Xi="ad-muted",Zi="ad-volume-changed",Ji="ad-timeout",tr="ad-break-completed",er="ad-postroll-finished",sr="ad-preroll-finished",ir="vpaid-init",rr="ad-ima-adapter-init",nr="ad-ima-before-ads-request",ar="ad-ima-rendering-settings",or="ad-adapter-init-failed",lr="ad-play-requested",dr="reload-ad-requested",cr="ad-error",ur="request/ad/pause",hr="request/ad/play",fr="request/ad/muteunmute",gr="ad/show-first-frame",pr="ad/resize",mr="ad/set-ui-flags",vr="ad/pbjs";var yr,Er=Object.freeze({__proto__:null,AD_INIT:Ni,AD_PLAYBACK_ERROR:Ui,AD_TEARDOWN:Bi,AD_VIDEOTAG_ATTACHED:$i,AD_BLOCKED:"ad-blocked",AD_REQUEST_ERROR:Gi,AD_REQUESTED:Hi,AD_REQUEST_COMPLETED:Ki,AD_PAUSE_CONTENT:Vi,AD_STARTED:ji,AD_COMPLETED:qi,AD_PAUSED:Wi,AD_RESUMED:Yi,AD_WAITING:"ad-waiting",AD_PROGRESS:zi,AD_SKIPPED:Qi,AD_MUTED:Xi,AD_VOLUME_CHANGED:Zi,AD_FULLSCREEN:"ad-fullscreen",AD_TIMEOUT:Ji,AD_BREAK_COMPLETED:tr,AD_POSTROLL_FINISHED:er,AD_PREROLL_FINSIHED:sr,AD_MIDROLL_FINISHED:"ad-midroll-finished",VPAID_INIT:ir,IMA_ADAPTER_INIT:rr,IMA_BEFORE_ADS_REQUEST:nr,IMA_ADS_RENDERING_SETTINGS:ar,ADAPTER_INIT_FAILED:or,AD_PLAY_REQUESTED:lr,RELOAD_AD_REQUESTED:dr,AD_ERROR:cr,REQUEST_AD_PAUSE:ur,REQUEST_AD_PLAY:hr,REQUEST_AD_MUTE_UNMUTE:fr,AD_SHOW_FIRST_FRAME:gr,AD_RESIZE:pr,AD_SET_UI_FLAGS:mr,PBJS_AVAILABLE:vr});!function(t){t[t.Starting=0]="Starting",t[t.ConfigFinalized=1]="ConfigFinalized",t[t.TimerStartedWithAutoplay=2]="TimerStartedWithAutoplay",t[t.TimerStartedWithUserGesture=3]="TimerStartedWithUserGesture",t[t.MetricReported=4]="MetricReported"}(yr||(yr={}));const Tr=[a,g];class TimeToFirstFrame{constructor(t=yr.Starting,e=!1){this.state=t,this.loadedAd=e}reset(){this.state=yr.Starting,this.loadedAd=!1,this.start=void 0,this.end=void 0,this.adDetails=void 0}adInfo(){const{ad_tag_id:t,vast_ad_id:e}=this.adDetails||{};return{ad_tag_id:t,vast_ad_id:e}}toJSON(){return Object.assign({ad_was_requested:this.loadedAd,ms_to_first_frame:Math.round(this.end&&this.start?this.end-this.start:-1)},this.adInfo())}startTimer(t){this.state==yr.ConfigFinalized&&(this.state=t,this.start=performance.now())}hasStarted(){return[yr.TimerStartedWithAutoplay,yr.TimerStartedWithUserGesture].includes(this.state)}stopTimer(t){this.hasStarted()&&(this.end||(this.end=performance.now()),this.state=yr.MetricReported,t())}}function Sr(t){return Math.round(1e3*t)/1e3}class EWMA$1{constructor(t){this.tickInterval=t,this.ewma=0,this.startTime=Date.now()}decay(){const t=Date.now()-this.startTime;return Math.pow(2,-t/(4*this.tickInterval))}update(t){const e=this.decay();return this.ewma=e*this.ewma+(1-e)*t,this.ewma}toJSON(){return this.ewma}}const Ar={skipUnreliableSegments:!0};class WatchedState{constructor(t){this.player=t,this.marchingInterval=void 0,this.lastWatchedPoint=void 0,this.watchedSum=0,this.lastReportedSum=0,this.ewmaTickWatched=new EWMA$1(WatchedState.AccuracyMilliseconds)}reset(){this.onNotWatching(),this.watchedSum=0,this.lastReportedSum=0,this.lastWatchedPoint=void 0}onNotWatching(){this.marchingInterval&&(this.updateWatched(),this.marchingInterval=clearInterval(this.marchingInterval))}onWatching(){this.marchingInterval||(this.lastWatchedPoint=this.createWatchedPoint(),this.marchingInterval=setInterval(()=>{this.updateWatched()},WatchedState.AccuracyMilliseconds))}createWatchedPoint(){return{currentTime:this.player.currentTime,paused:this.player.paused}}updateWatched(){const t=this.createWatchedPoint();this.lastWatchedPoint&&this.calculateTimeWatched(this.lastWatchedPoint,t),this.lastWatchedPoint=t}calculateTimeWatched(t,e){var s,i;const r=e.currentTime-t.currentTime,n=this.ewmaTickWatched.update(r);if(!(r<0)&&!(!1!==(null===(i=null===(s=this.player.opts)||void 0===s?void 0:s.health)||void 0===i?void 0:i.skipUnreliableSegments)&&1e3*r>1.3*WatchedState.AccuracyMilliseconds)&&(this.watchedSum+=r,this.watchedSum!=this.lastReportedSum&&(this.watchedSum>this.lastReportedSum+WatchedState.ReportingIntervalSeconds||this.player.ended))){const t=Sr(n),e={total_watched_seconds:Sr(this.watchedSum),tick_watched_seconds:t,batch_watched_seconds:Sr(this.watchedSum-this.lastReportedSum)};this.lastReportedSum=this.watchedSum,this.player.emit(ze,e)}}}WatchedState.ReportingIntervalSeconds=5,WatchedState.AccuracyMilliseconds=160;const _r=ys();class Health{constructor(t,e){let s;this.session_id=_r,this.suspended=!1,this.logger=hi("health",e.opts),this.media_session_id=ys(),this.play_range_id=ys(),this.analyticsLoop=setInterval(()=>wi(this),2e3),e.on(N,()=>clearInterval(this.analyticsLoop)),e.on(R,()=>{s!==this.media_session_id&&(s=this.media_session_id,this.first_playing_event_timestamp=Date.now()),this.play_range_id=ys()});let i=Date.now()-1e3;e.on(A,t=>{if(s!==this.media_session_id)return;const r=Date.now();if(r<i)return;i=Date.now()+5e3;const n=Mi(e,this.eventInfo(t.type)),a=Oi(n,{duration:(o=e.duration,Number.isFinite(o)?o:o===1/0?-1:void 0)});var o;this.first_playing_event_timestamp&&(Object.assign(a,{ms_since_first_playing:r-this.first_playing_event_timestamp}),this.first_playing_event_timestamp=void 0),Pi(this,a)});const r=this;if(e.health={get media_session_id(){return r.media_session_id},set media_session_id(t){r.media_session_id=t},get session_id(){return r.session_id},set session_id(t){r.session_id=t},toggle(t){t?r.resume():r.suspend()}},!Health._UNLOAD_SUBSCRIBED){Health._UNLOAD_SUBSCRIBED=!0;const e=e=>t.instances.forEach(t=>t.emit(e.type));document.addEventListener("visibilitychange",t=>{"hidden"==document.visibilityState&&e(t)}),window.addEventListener("pagehide",e)}}eventInfo(t){return{event:t,media_session_id:this.media_session_id,session_id:this.session_id,play_range_id:this.play_range_id}}suspend(){this.suspended=!0,clearInterval(this.analyticsLoop)}resume(){this.suspended=!1,this.analyticsLoop=setInterval(()=>wi(this),2e3)}init(t,e,s){if(Ri().toString().startsWith("data:"))return this.suspend();!function(t){let e=null;const s=()=>{e=null};t.on(k,function(e){t.seeking||t.networkState===t.NETWORK_LOADING&&(t.readyState<HTMLMediaElement.HAVE_CURRENT_DATA||t.emit(Ve))}),t.on(Ve,t=>{e=t}),t.on(w,i=>{if(e){const r=i.timeStamp-e.timeStamp;if(s(),r<31)return;if(r>3e5)return;t.emit(je,{rebuffer_duration:r/1e3})}}),yi.forEach(e=>t.on(e,s))}(s),function(t){let e;[w,nt].forEach(s=>{t.on(s,s=>{const i=Date.now();switch(s.type){case nt:return e=i;case w:if(e)return t.emit(Ye,{ms_since_loading_started:i-e}),e=null}})})}(s),function(t){if(void 0===window.performance)return;const e=new TimeToFirstFrame;t.on(F,()=>{if(!t.opt("metadata.media_id"))return e.reset();e.reset(),e.state=yr.ConfigFinalized}),t.on(nt,()=>{(t.root.classList.contains("ad-hide-first-frame")||t.opt("autoplay"))&&e.startTimer(yr.TimerStartedWithAutoplay)}),Tr.forEach(s=>{t.on(s,()=>{t.opt("autoplay")||e.startTimer(yr.TimerStartedWithUserGesture)})}),t.on(Hi,()=>{e.loadedAd=!0}),t.on(A,()=>{if(!(t.readyState<HTMLMediaElement.HAVE_CURRENT_DATA)){if(t.root.classList.contains("ad-hide-first-frame"))return!e.end&&(e.end=performance.now());switch(e.state){case yr.TimerStartedWithAutoplay:case yr.TimerStartedWithUserGesture:return e.stopTimer(()=>t.emit(We,e.toJSON()))}}}),t.on(ji,s=>{switch(e.end=void 0,e.adDetails=s.detail,e.state){case yr.TimerStartedWithAutoplay:case yr.TimerStartedWithUserGesture:return e.stopTimer(()=>t.emit(We,e.toJSON()))}})}(s),function(t){const e=new WatchedState(t);t.on(nt,()=>e.reset()),t.on(R,()=>e.onWatching()),t.on(je,()=>!t.paused&&e.onWatching()),t.on(Ve,()=>e.onNotWatching()),t.on(L,()=>e.onNotWatching()),t.on(C,()=>{t.currentTime>1&&e.updateWatched(),e.onNotWatching()}),t.on(D,()=>{t.paused||e.onWatching()}),t.on(P,()=>e.updateWatched()),t.on("visibilitychange",()=>e.updateWatched())}(s),s.on(qe,t=>{Pi(this,Mi(s,this.eventInfo(t.type)),!0)}),s.on(Ke,({detail:t})=>{const e=Mi(s,this.eventInfo(t.event));Object.assign(e,t.detail||{}),Pi(this,e)}),s.on(Qe,t=>{if(e=t.detail.sample_rate,!Object.values(Je).includes(e))return console.debug(`sample_rate=${t.detail.sample_rate} is invalid`);var e,i;if(!(0!==(i=t.detail).sample_rate&&Math.random()<=i.sample_rate))return;const r=Mi(s,this.eventInfo(t.type));Pi(this,Oi(r,t.detail))}),s.on(F,()=>{s.opt("metadata.media_id")&&s.emit(Xe)}),[_,E,T,S,k,Ve].forEach(t=>{s.on(t,t=>{Pi(this,Mi(s,this.eventInfo(t.type)))})}),[je,We,Ye,ze].forEach(t=>{s.on(t,t=>{const e=Mi(s,this.eventInfo(t.type));Pi(this,Object.assign(e,t.detail))})}),[R,L,C,D,P,v,y,w,nt].forEach(t=>{s.on(t,t=>{Pi(this,Mi(s,this.eventInfo(t.type)))})}),s.on(b,Fi(800,t=>{const e=Mi(s,this.eventInfo(t.type));Pi(this,Oi(e,{volume:parseFloat(s.volume.toFixed(2)),muted:s.muted}))})),s.on(m,Fi(800,t=>{const i=Mi(s,this.eventInfo(t.type));Pi(this,Oi(i,{height:e.clientHeight,width:e.clientWidth}))})),s.on("hls/failover",t=>{const e=Mi(s,this.eventInfo(t.type)),i=t.detail,{reason:r,from:n}=i;Pi(this,Oi(e,{reason:r,from:n}))}),s.on(B,({type:t,detail:e})=>{if("hls"===e.plugin)return function(t,e,s,i){const r=Mi(e,t.eventInfo(s)),n=Object.assign({before:xi(i.before),after:xi(i.after),automatic:i.automatic,downscale:i.downscale},i.before?{}:{start_quality:e.opts.start_quality});Pi(t,Object.assign(Object.assign({},r),{state:n}))}(this,s,t,e)}),s.on(at,t=>{const e=Mi(s,this.eventInfo(t.type)),i=t.detail.error;if(!i)return Pi(this,e,!0);return Pi(this,Oi(e,i.toJSON()),!0)}),s.on(F,t=>{var e;const i=null===(e=t.detail)||void 0===e?void 0:e.src;if("string"!=typeof i)return;if(!Ti(s.original_src))return;if(!Ti(i))return;if(i==s.original_src)return;this.media_session_id=ys();Pi(this,Mi(s,this.eventInfo(t.type))),wi(this),s.setOpts({health:Object.assign(Object.assign({},s.opts.health),Ar)})}),s.on("visibilitychange",t=>{Pi(this,Mi(s,this.eventInfo(t.type))),wi(this)})}}function br(t,e){return function(t){return t.extensions.reduce((t,e)=>t.find(t=>t.pluginName===e.pluginName)?(console.warn("flowplayer: duplicate plugin %s detected, plugin names should be uni