mediacms/static/js/embed.js

1 line
16 KiB
JavaScript

!function(){"use strict";var e={25:function(e,t,n){var a=n(9087),r=(n(5101),n(5466)),i=(n(6116),n(4426),n(8349));n(6010),n(5666),n(8487),n(8024);r.PureComponent,n(3123).Y;var o=n(9518),s=n(2276),l=n(3699);function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],a=!0,r=!1,i=void 0;try{for(var o,s=e[Symbol.iterator]();!(a=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);a=!0);}catch(e){r=!0,i=e}finally{try{a||null==s.return||s.return()}finally{if(r)throw i}}return n}}(e,t)||function(e,t){if(e){if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}!function(e,t){if(void 0!==t){var n=document.getElementById(e);null!==n&&a.Z.display(n,t,{},e)}}("page-embed",(function(){var e=u((0,r.useState)(!1),2),t=e[0],n=e[1],a=u((0,r.useState)(!1),2),c=a[0],d=a[1];function p(){n(!0)}function h(){d(!0)}return i.df("embed"),(0,r.useEffect)((function(){return s.Z.on("loaded_video_data",p),s.Z.on("loaded_media_error",h),l.loadMediaData(),function(){s.Z.removeListener("loaded_video_data",p),s.Z.removeListener("loaded_media_error",h)}}),[]),r.createElement("div",{className:"embed-wrap"},c?r.createElement("div",{className:"player-container player-container-error"},r.createElement("div",{className:"player-container-inner"},r.createElement("div",{className:"error-container"},r.createElement("div",{className:"error-container-inner"},r.createElement("span",{className:"icon-wrap"},r.createElement("i",{className:"material-icons"},"error_outline")),r.createElement("span",{className:"msg-wrap"},s.Z.get("media-load-error-message")))))):null,t?r.createElement(o.Z,{data:s.Z.get("media-data")}):null)}))},6146:function(e,t,n){n.d(t,{Y:function(){return d}}),n(717);var a=n(5466),r=n(3074),i=n.n(r),o=n(920),s=n.n(o),l=n(4426),u=n(4860),c=n(9688);function d(e){var t=(0,a.useRef)(null),n=null,r=new u.Z(l.Z.get("config-site").id,86400),i={playerVolume:r.get("player-volume"),playerSoundMuted:r.get("player-sound-muted"),videoQuality:r.get("video-quality"),videoPlaybackSpeed:r.get("video-playback-speed"),inTheaterMode:r.get("in-theater-mode")};function o(){void 0!==e.onClickNextCallback&&e.onClickNextCallback()}function d(){void 0!==e.onClickPreviousCallback&&e.onClickPreviousCallback()}function p(t){i.playerVolume!==t.volume&&(i.playerVolume=t.volume),i.playerSoundMuted!==t.soundMuted&&(i.playerSoundMuted=t.soundMuted),i.videoQuality!==t.quality&&(i.videoQuality=t.quality),i.videoPlaybackSpeed!==t.playbackSpeed&&(i.videoPlaybackSpeed=t.playbackSpeed),i.inTheaterMode!==t.theaterMode&&(i.inTheaterMode=t.theaterMode),void 0!==e.onStateUpdateCallback&&e.onStateUpdateCallback(t)}function h(){if(null===n&&null===e.errorMessage&&(e.inEmbed||(window.removeEventListener("focus",h),document.removeEventListener("visibilitychange",h)),t.current)){e.inEmbed||t.current.focus();var a={on:!1};if(void 0!==e.subtitlesInfo&&null!==e.subtitlesInfo&&e.subtitlesInfo.length){a.languages=[];for(var r=0;r<e.subtitlesInfo.length;)void 0!==e.subtitlesInfo[r].src&&void 0!==e.subtitlesInfo[r].srclang&&void 0!==e.subtitlesInfo[r].label&&a.languages.push({src:(0,c.U)(e.subtitlesInfo[r].src,l.Z.get("config-site").url),srclang:e.subtitlesInfo[r].srclang,label:e.subtitlesInfo[r].label}),r+=1;a.languages.length&&(a.on=!0)}n=new(s())(t.current,{enabledTouchControls:!0,sources:e.sources,poster:e.poster,autoplay:e.enableAutoplay,bigPlayButton:!0,controlBar:{theaterMode:e.hasTheaterMode,pictureInPicture:!1,next:!!e.hasNextLink,previous:!!e.hasPreviousLink},subtitles:a,cornerLayers:e.cornerLayers,videoPreviewThumb:e.previewSprite},{volume:i.playerVolume,soundMuted:i.playerSoundMuted,theaterMode:i.inTheaterMode,theSelectedQuality:void 0,theSelectedPlaybackSpeed:i.videoPlaybackSpeed||1},e.info,[.25,.5,.75,1,1.25,1.5,1.75,2],p,o,d),void 0!==e.onPlayerInitCallback&&e.onPlayerInitCallback(n,t.current)}}return i.playerVolume=null===i.playerVolume?1:Math.max(Math.min(Number(i.playerVolume),1),0),i.playerSoundMuted=null!==i.playerSoundMuted&&i.playerSoundMuted,i.videoQuality=null!==i.videoQuality?i.videoQuality:"Auto",i.videoPlaybackSpeed=null!==i.videoPlaybackSpeed&&i.videoPlaybackSpeed,i.inTheaterMode=null!==i.inTheaterMode&&i.inTheaterMode,(0,a.useEffect)((function(){return e.inEmbed||document.hasFocus()||"visible"===document.visibilityState?h():(window.addEventListener("focus",h),document.addEventListener("visibilitychange",h)),function(){null!==n&&(videojs(t.current).dispose(),n=null),void 0!==e.onUnmountCallback&&e.onUnmountCallback()}}),[]),null===e.errorMessage?a.createElement("video",{ref:t,className:"video-js vjs-mediacms native-dimensions"}):a.createElement("div",{className:"error-container"},a.createElement("div",{className:"error-container-inner"},a.createElement("span",{className:"icon-wrap"},a.createElement("i",{className:"material-icons"},"error_outline")),a.createElement("span",{className:"msg-wrap"},e.errorMessage)))}d.propTypes={errorMessage:i().string,cornerLayers:i().object,subtitlesInfo:i().array.isRequired,inEmbed:i().bool.isRequired,sources:i().array.isRequired,info:i().object.isRequired,enableAutoplay:i().bool.isRequired,hasTheaterMode:i().bool.isRequired,hasNextLink:i().bool.isRequired,hasPreviousLink:i().bool.isRequired,poster:i().string,previewSprite:i().object,onClickPreviousCallback:i().func,onClickNextCallback:i().func,onPlayerInitCallback:i().func,onStateUpdateCallback:i().func,onUnmountCallback:i().func},d.defaultProps={errorMessage:null,cornerLayers:{}}},1395:function(e,t,n){function a(e,t,n){return e.scrollLeft?1+Math.ceil(e.scrollLeft/t):n}function r(e,t){void 0!==e&&(this.data={dom:{wrapper:e,firstItem:e.querySelector(t)},item:{width:null}},this.data.item.width=this.data.dom.firstItem.offsetWidth,this.state={initedAllStateValues:!1,currentSlide:1,maxSlideIndex:null,slideItemsFit:null,slideItems:null,totalItems:null,wrapper:{width:null,scrollWidth:null}})}n.d(t,{Z:function(){return r}}),r.prototype.updateDataStateOnResize=function(e,t){this.data.item.width=this.data.dom.firstItem.offsetWidth,this.state.wrapper.width=this.data.dom.wrapper.offsetWidth,this.state.wrapper.scrollWidth=this.data.dom.wrapper.scrollWidth,this.state.slideItemsFit=Math.floor(this.state.wrapper.width/this.data.item.width),this.state.slideItems=Math.max(1,this.state.slideItemsFit),t&&this.state.slideItems<=this.state.slideItems&&(this.state.itemsLengthFit=this.state.slideItems),this.state.totalItems=e,this.state.maxSlideIndex=Math.max(this.state.totalItems-this.state.slideItemsFit+1),this.state.currentSlide=Math.min(this.state.currentSlide,this.state.maxSlideIndex||1)},r.prototype.updateDataState=function(e,t,n){!n&&this.state.initedAllStateValues||(this.state.initedAllStateValues=!0,this.state.wrapper.width=this.data.dom.wrapper.offsetWidth,this.state.wrapper.scrollWidth=this.data.dom.wrapper.scrollWidth,this.state.slideItemsFit=Math.floor(this.state.wrapper.width/this.data.item.width),this.state.slideItems=Math.max(1,this.state.slideItemsFit),t&&this.state.slideItems<=this.state.slideItems&&(this.state.itemsLengthFit=this.state.slideItems)),this.state.totalItems=e,this.state.maxSlideIndex=Math.max(1,this.state.totalItems-this.state.slideItemsFit+1),this.state.currentSlide=Math.min(this.state.currentSlide,this.state.maxSlideIndex)},r.prototype.nextSlide=function(){this.state.currentSlide=Math.min(a(this.data.dom.wrapper,this.data.item.width,this.state.currentSlide)+this.state.slideItems,this.state.maxSlideIndex)},r.prototype.previousSlide=function(){this.state.currentSlide=Math.max(1,a(this.data.dom.wrapper,this.data.item.width,this.state.currentSlide)-this.state.slideItems)},r.prototype.scrollToCurrentSlide=function(){this.data.dom.wrapper.scrollLeft=this.data.item.width*(this.state.currentSlide-1)},r.prototype.hasNextSlide=function(){return this.state.currentSlide<this.state.maxSlideIndex},r.prototype.hasPreviousSlide=function(){return 1<this.state.currentSlide},r.prototype.currentSlide=function(){return this.state.currentSlide},r.prototype.loadItemsToFit=function(){return 2*this.state.slideItemsFit>this.state.totalItems},r.prototype.loadMoreItems=function(){return this.state.currentSlide+this.state.slideItemsFit>=this.state.maxSlideIndex},r.prototype.itemsFit=function(){return this.state.slideItemsFit}},792:function(e,t,n){n.d(t,{KC:function(){return s},RA:function(){return l},$e:function(){return u}}),n(7228),n(9751),n(2322),n(9268);var a=n(4426),r=n(9688),i=["hls","h265","vp9","h264","vp8","mp4","theora"];function o(e,t){var n=null,a=document.createElement("video");if(a.canPlayType)try{switch(e){case"hls":n=!0;break;case"h265":n="probably"===a.canPlayType('video/mp4; codecs="hvc1.1.L0.0"')||"probably"===a.canPlayType('video/mp4; codecs="hev1.1.L0.0"');break;case"h264":n="probably"===a.canPlayType('video/mp4; codecs="avc1.42E01E"')||"probably"===a.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"');break;case"vp9":n="probably"===a.canPlayType('video/webm; codecs="vp9"');break;case"vp8":n="probably"===a.canPlayType('video/webm; codecs="vp8, vorbis"');break;case"theora":n="probably"===a.canPlayType('video/ogg; codecs="theora"');break;case"mp4":n=!0}if(t=(t instanceof Boolean||0===t||1==t)&&t){if("no"===a.canPlayType("video/nonsense")&&console.warn('BUGGY: Codec detection bug in Firefox 3.5.0 - 3.5.1 and Safari 4.0.0 - 4.0.4 that answer "no" to unknown codecs instead of an empty string'),"probably"===a.canPlayType("video/webm")&&console.warn('BUGGY: Codec detection bug that Firefox 27 and earlier always says "probably" when asked about WebM, even when the codecs string is not present'),"maybe"===a.canPlayType('video/mp4; codecs="avc1.42E01E"'))switch(a.canPlayType("video/mp4")){case"probably":console.warn('BUGGY: Codec detection bug in iOS 4.1 and earlier that switches "maybe" and "probably" around');break;case"maybe":console.warn('BUGGY: Codec detection bug in Android where no better answer than "maybe" is given')}"probably"===a.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"')&&"probably"!==a.canPlayType('video/mp4; codecs="avc1.42E01E"')&&console.warn("BUGGY: Codec detection bug in Internet Explorer 9 that requires both audio and video codec on test")}}catch(e){console.warn(e)}return n}function s(e){var t=[],n={},a=document.createElement("video");return a.canPlayType&&(n.hls=!0,t.push("hls"),(a.canPlayType('video/mp4; codecs="hvc1.1.L0.0"')||"probably"===a.canPlayType('video/mp4; codecs="hev1.1.L0.0"'))&&(n.h265=!0,t.push("h265")),"probably"===a.canPlayType('video/mp4; codecs="avc1.42E01E"')&&(n.h264=!0,t.push("h264")),"probably"===a.canPlayType('video/webm; codecs="vp9"')&&(n.vp9=!0,t.push("vp9")),e&&("probably"===a.canPlayType('video/webm; codecs="vp8, vorbis"')&&(n.vp8=!0,t.push("vp8")),"probably"===a.canPlayType('video/ogg; codecs="theora"')&&(n.theora=!0,t.push("theora"))),"probably"===a.canPlayType('video/mp4; codecs="mp4v.20.8"')&&(n.mp4=!0,t.push("mp4"))),{order:t,support:n}}function l(e,t,n){var l,u,c,d={};n=void 0===n?s():n;var p={hls:["m3u8"],h265:["mp4","webm"],h264:["mp4","webm"],vp9:["mp4","webm"],vp8:["mp4","webm"],theora:["ogg"],mp4:["mp4"]};for(l in t)t.hasOwnProperty(l)&&(u=null,null!==(u="master_file"===l?"Auto":2===(u=l.split("_playlist")).length?u[0]:null)&&(d[u]=void 0===d[u]?{format:[],url:[]}:d[u],d[u].format.push("hls"),d[u].url.push((0,r.U)(t[l],a.Z.get("config-site").url))));for(u in e)if(e.hasOwnProperty(u)&&Object.keys(e[u]).length&&(1080>=parseInt(u,10)||1080<window.screen.width&&1080<window.screen.height))for(l=0;l<i.length;)void 0!==e[u][i[l]]&&o(i[l],!1)&&e[u][i[l]]&&e[u][i[l]].url&&(100!==e[u][i[l]].progress&&console.warn("VIDEO DEBUG:","PROGRESS value is",e[u][i[l]].progress),"success"!==e[u][i[l]].status&&console.warn("VIDEO DEBUG:","STATUS value is",e[u][i[l]].status),(c=e[u][i[l]].url.split(".")).length&&0<=p[i[l]].indexOf(c[c.length-1])&&(d[u]=void 0===d[u]?{format:[],url:[]}:d[u],d[u].format.push(i[l]),d[u].url.push((0,r.U)(e[u][i[l]].url,a.Z.get("config-site").url)))),l+=1;return d}function u(e,t){var n,a=Object.keys(t);if(void 0!==t[e])return e;if(parseInt(e,10)>=parseInt(a[a.length-1],10))return a[a.length-1];if(parseInt(e,10)<=parseInt(a[0],10))return a[0];for(n=a.length-1;n>=0;){if(parseInt(e,10)>=parseInt(a[n],10))return a[n+1];n-=1}}},8024:function(e,t,n){function a(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\b)"+t.split(" ").join("|")+"(\\b|$)","gi")," ")}function r(e,t){e.classList?e.classList.add(t):e.className+=" "+t}n.d(t,{dt:function(){return a},Ec:function(){return r}}),n(7441),n(7390),n(2322),n(4669),n(3296),n(9268)},3140:function(e,t,n){n(2322),n(9268)},9688:function(e,t,n){n.d(t,{U:function(){return i}}),n(6394),n(2322),n(4669),n(3296);var a=n(137),r=n.n(a);function i(e,t){var n=r()(e,{});return""!==n.origin&&"null"!==n.origin&&n.origin||(n=r()(t+"/"+e.replace(/^\//g,""),{})),n.toString()}},4135:function(e,t,n){function a(e,t){function n(e,t,n){return Number(parseFloat(e/t).toFixed(e<10*t?1:0))+n}return t?e.toLocaleString():function(e,t,a,r,i,o){for(;t>=r;)i*=a,r*=a,e+=1;return e<o.length?n(t,i,o[e]):n(t*(a*(e-(o.length-1))),i,o[o.length-1])}(0,e,1e3,1e3,1,["","K","M","B","T"])}n.d(t,{Z:function(){return a}}),n(717),n(6660)},8420:function(e,t,n){n.d(t,{A_:function(){return a.Z},j0:function(){return r.Z},GH:function(){return i.Z},Jl:function(){return o.Z},v$:function(){return s.Z},uf:function(){return l.Z},UN:function(){return u.Z},$A:function(){return c.Z},m5:function(){return d.Z},vo:function(){return p.ZP}});var a=n(1712),r=n(9752),i=n(84),o=n(9009),s=n(1438),l=n(4135),u=(n(3140),n(1752),n(7514),n(4582)),c=n(4845),d=(n(1569),n(6203)),p=n(7188)},2186:function(e,t,n){function a(e){return function(e){return e===Math.trunc(e)}(e)&&(function(e){return function(e,t){return e>0}(e)}(e)||function(e){return 0===e}(e))}n.d(t,{ZU:function(){return a}}),n(5777)},3699:function(e,t,n){n.d(t,{loadMediaData:function(){return i}}),n(2322),n(3296);var a=n(8416),r=n.n(a);function i(){r().dispatch({type:"LOAD_MEDIA_DATA"})}},8349:function(e,t,n){n.d(t,{sc:function(){return i},df:function(){return o},Zr:function(){return s},vh:function(){return l},Qb:function(){return u}});var a=n(8416),r=n.n(a);function i(){r().dispatch({type:"TOGGLE_PAGE_SIDEBAR"})}function o(e){r().dispatch({type:"INIT_PAGE",page:e})}function s(e){r().dispatch({type:"INIT_SIDEBAR",page:e})}function l(e){r().dispatch({type:"TOGGLE_MOBILE_SEARCH_FIELD",open:e})}function u(e){r().dispatch({type:"TOGGLE_DARK_THEME"})}}},t={};function n(a){if(t[a])return t[a].exports;var r=t[a]={exports:{}};return e[a].call(r.exports,r,r.exports,n),r.exports}n.m=e,n.x=function(){},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.j=991,function(){var e={991:0},t=[[25,431]],a=function(){},r=function(r,i){for(var o,s,l=i[0],u=i[1],c=i[2],d=i[3],p=0,h=[];p<l.length;p++)s=l[p],n.o(e,s)&&e[s]&&h.push(e[s][0]),e[s]=0;for(o in u)n.o(u,o)&&(n.m[o]=u[o]);for(c&&c(n),r&&r(i);h.length;)h.shift()();return d&&t.push.apply(t,d),a()},i=self.webpackChunk_mediacms_frontend=self.webpackChunk_mediacms_frontend||[];function o(){for(var a,r=0;r<t.length;r++){for(var i=t[r],o=!0,s=1;s<i.length;s++){var l=i[s];0!==e[l]&&(o=!1)}o&&(t.splice(r--,1),a=n(n.s=i[0]))}return 0===t.length&&(n.x(),n.x=function(){}),a}i.forEach(r.bind(null,0)),i.push=r.bind(null,i.push.bind(i));var s=n.x;n.x=function(){return n.x=s||function(){},(a=o)()}}(),n.x()}();