mirror of
https://github.com/mediacms-io/mediacms.git
synced 2024-11-28 11:13:36 +01:00
1 line
148 KiB
JavaScript
1 line
148 KiB
JavaScript
!function(){var e,t={5122:function(e,t,n){"use strict";var a=n(2541),r=(n(2322),n(9268),n(9006),n(5090),n(5101),n(3080),n(2004),n(8407),n(6394),n(8288),n(5677),n(2129),n(4655),n(5466)),i=n(3613),o=n(8578);function l(){return r.createElement("div",{className:"player-container viewer-attachment-container"},r.createElement("div",{className:"player-container-inner"},r.createElement("span",null,r.createElement("span",null,r.createElement("i",{className:"material-icons"},"insert_drive_file")))))}var s=n(3074),u=n.n(s),c=n(8009),d=n.n(c),m=n(473),p=n(541),f=n(9722);function y(e){var t=null,n=e.split(".");if(n.length)switch(n=n[n.length-1]){case"webm":t="audio/webm";break;case"flac":t="audio/flac";break;case"wave":t="audio/wave";break;case"wav":t="audio/wav";break;case"ogg":case"ogg":t="audio/ogg";break;case"mp3":case"mpeg":t="audio/mpeg"}return t}var h=n(1283);function g(e){return(g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function v(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function b(e,t){return(b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function S(e,t){return!t||"object"!==g(t)&&"function"!=typeof t?w(e):t}function w(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function E(e){return(E=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var P=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&b(e,t)}(u,e);var t,n,a,l,s=(a=u,l=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=E(a);if(l){var n=E(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return S(this,e)});function u(e){var t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),t=s.call(this,e);var n=o.MediaPageStore.get("media-data");t.AudioPlayerData={},t.audioStartedPlaying=!1;var a=(0,m.formatInnerLink)(n.original_media_url,i.SiteContext._currentValue.url);t.videoSources=[{src:a,type:y(a)}],t.videoPoster=n.poster_url,t.videoPoster=t.videoPoster?t.videoPoster:n.thumbnail_url,t.videoPoster=t.videoPoster?(0,m.formatInnerLink)(t.videoPoster,i.SiteContext._currentValue.url):"",t.updatePlayerVolume=t.updatePlayerVolume.bind(w(t)),t.onAudioEnd=t.onAudioEnd.bind(w(t)),t.onAudioRestart=t.onAudioRestart.bind(w(t)),o.PageStore.on("switched_media_auto_play",t.onUpdateMediaAutoPlay.bind(w(t))),t.wrapperClick=t.wrapperClick.bind(w(t));var r=new f.MediaDurationInfo;return r.update(o.MediaPageStore.get("media-data").duration),t.durationISO8601=r.ISO8601(),t}return t=u,(n=[{key:"componentDidMount",value:function(){this.videoSources.length||h.warn("Audio DEBUG:","Audio file doesn't exist"),this.recommendedMedia=o.MediaPageStore.get("media-data").related_media.length?new f.PlayerRecommendedMedia(o.MediaPageStore.get("media-data").related_media,this.refs.AudioElem.parentNode,this.props.inEmbed):null,this.upNextLoaderView=!this.props.inEmbed&&o.MediaPageStore.get("media-data").related_media.length?new f.UpNextLoaderView(o.MediaPageStore.get("media-data").related_media[0]):null,document.hasFocus()||"visible"===document.visibilityState?this.initPlayerInstance():(this.initPlayerInstance=this.initPlayerInstance.bind(this),window.addEventListener("focus",this.initPlayerInstance),document.addEventListener("visibilitychange",this.initPlayerInstance))}},{key:"componentWillUnmount",value:function(){this.recommendedMedia&&(this.AudioPlayerData.instance.player.off("fullscreenchange",this.recommendedMedia.onResize),o.PageStore.removeListener("window_resize",this.recommendedMedia.onResize),o.VideoViewerStore.removeListener("changed_viewer_mode",this.recommendedMedia.onResize),this.recommendedMedia.destroy()),videojs(this.refs.AudioElem).dispose(),this.AudioPlayerData.instance=null,delete this.AudioPlayerData.instance}},{key:"initPlayerInstance",value:function(){window.removeEventListener("focus",this.initPlayerInstance),document.removeEventListener("visibilitychange",this.initPlayerInstance),this.refs.AudioElem.focus(),this.initPlayerInstance=null,setTimeout(function(){if(!this.AudioPlayerData.instance){var e=this.props.inEmbed?document.createElement("a"):null,t=this.props.inEmbed?document.createElement("a"):null;e&&(e.setAttribute("class","title-link"),e.setAttribute("href",o.MediaPageStore.get("media-data").url),e.setAttribute("title",o.MediaPageStore.get("media-data").title),e.setAttribute("target","_blank"),e.innerHTML=o.MediaPageStore.get("media-data").title),t&&(t.setAttribute("class","user-thumb-link"),t.setAttribute("href",o.MediaPageStore.get("media-data").author_profile),t.setAttribute("title",o.MediaPageStore.get("media-data").author_name),t.setAttribute("target","_blank"),t.innerHTML='<img src="'+o.MediaPageStore.get("media-author-thumbnail-url")+'" alt="" />');var n=null,a=null;!this.props.inEmbed&&o.MediaPageStore.get("playlist-id")?(n=o.MediaPageStore.get("playlist-next-media-url"),a=o.MediaPageStore.get("playlist-previous-media-url")):n=o.MediaPageStore.get("media-data").related_media.length&&!this.props.inEmbed?o.MediaPageStore.get("media-data").related_media[0].url:null,this.AudioPlayerData.instance=new(d())(this.refs.AudioElem,{sources:this.videoSources,poster:this.videoPoster,autoplay:!this.props.inEmbed,bigPlayButton:!0,controlBar:{fullscreen:!1,theaterMode:!1,next:!!n,previous:!!a},cornerLayers:{topLeft:e,topRight:this.upNextLoaderView?this.upNextLoaderView.html():null,bottomLeft:this.recommendedMedia?this.recommendedMedia.html():null,bottomRight:t}},{volume:o.VideoViewerStore.get("player-volume"),soundMuted:o.VideoViewerStore.get("player-sound-muted")},null,null,this.onAudioPlayerStateUpdate.bind(this),this.onClickNextButton.bind(this),this.onClickPreviousButton.bind(this)),this.upNextLoaderView&&(this.upNextLoaderView.setVideoJsPlayerElem(this.AudioPlayerData.instance.player.el_),this.onUpdateMediaAutoPlay()),this.refs.AudioElem.parentNode.focus(),this.AudioPlayerData.instance.player.one("play",function(){this.audioStartedPlaying=!0}.bind(this)),this.recommendedMedia&&(this.recommendedMedia.initWrappers(this.AudioPlayerData.instance.player.el_),this.AudioPlayerData.instance.player.one("pause",this.recommendedMedia.init),this.AudioPlayerData.instance.player.on("fullscreenchange",this.recommendedMedia.onResize),o.PageStore.on("window_resize",this.recommendedMedia.onResize),o.VideoViewerStore.on("changed_viewer_mode",this.recommendedMedia.onResize)),this.AudioPlayerData.instance.player.one("ended",this.onAudioEnd)}}.bind(this),50)}},{key:"initialDocumentFocus",value:function(){this.refs.AudioElem.parentNode&&(this.refs.AudioElem.parentNode.focus(),setTimeout(function(){this.AudioPlayerData.instance.player.play()}.bind(this),50)),window.removeEventListener("focus",this.initialDocumentFocus),this.initialDocumentFocus=null}},{key:"onClickNextButton",value:function(){var e;o.MediaPageStore.get("playlist-id")?null===(e=o.MediaPageStore.get("playlist-next-media-url"))&&(e=o.MediaPageStore.get("media-data").related_media[0].url):this.props.inEmbed||(e=o.MediaPageStore.get("media-data").related_media[0].url),window.location.href=e}},{key:"onClickPreviousButton",value:function(){var e;o.MediaPageStore.get("playlist-id")?null===(e=o.MediaPageStore.get("playlist-previous-media-url"))&&(e=o.MediaPageStore.get("media-data").related_media[0].url):this.props.inEmbed||(e=o.MediaPageStore.get("media-data").related_media[0].url),window.location.href=e}},{key:"onUpdateMediaAutoPlay",value:function(){this.upNextLoaderView&&(o.PageStore.get("media-auto-play")?this.upNextLoaderView.showTimerView(this.AudioPlayerData.instance.isEnded()):this.upNextLoaderView.hideTimerView())}},{key:"onAudioPlayerStateUpdate",value:function(e){this.updatePlayerVolume(e.volume,e.soundMuted)}},{key:"onAudioRestart",value:function(){this.recommendedMedia&&(this.recommendedMedia.updateDisplayType("inline"),this.AudioPlayerData.instance.player.one("pause",this.recommendedMedia.init),this.AudioPlayerData.instance.player.one("ended",this.onAudioEnd))}},{key:"onAudioEnd",value:function(){if(this.recommendedMedia&&(this.recommendedMedia.updateDisplayType("full"),this.AudioPlayerData.instance.player.one("playing",this.onAudioRestart)),!this.props.inEmbed&&o.MediaPageStore.get("playlist-id")){var e=document.querySelector(".video-player .more-media"),t=document.querySelector(".video-player .vjs-actions-anim");this.upNextLoaderView.cancelTimer();var n=o.MediaPageStore.get("playlist-next-media-url");return n&&(e&&(e.style.display="none"),t&&(t.style.display="none"),window.location.href=n),void this.upNextLoaderView.hideTimerView()}this.upNextLoaderView&&(o.PageStore.get("media-auto-play")?(this.upNextLoaderView.startTimer(),this.AudioPlayerData.instance.player.one("play",function(){this.upNextLoaderView.cancelTimer()}.bind(this))):this.upNextLoaderView.cancelTimer())}},{key:"updatePlayerVolume",value:function(e,t){o.VideoViewerStore.get("player-volume")!==e&&p.VideoViewerActions.set_player_volume(e),o.VideoViewerStore.get("player-sound-muted")!==t&&p.VideoViewerActions.set_player_sound_muted(t)}},{key:"wrapperClick",value:function(e){e.target.parentNode===this.refs.videoPlayerWrap&&(this.AudioPlayerData.instance.player.ended()||(!this.AudioPlayerData.instance.player.hasStarted_||this.AudioPlayerData.instance.player.paused()?this.AudioPlayerData.instance.player.play():this.AudioPlayerData.instance.player.pause()))}},{key:"render",value:function(){return r.createElement("div",{className:"player-container audio-player-container"},r.createElement("div",{className:"player-container-inner"},r.createElement("div",{className:"video-player",ref:"videoPlayerWrap",onClick:this.wrapperClick},r.createElement("audio",{tabIndex:"1",ref:"AudioElem",className:"video-js vjs-mediacms native-dimensions"}))))}}])&&v(t.prototype,n),u}(r.PureComponent);function _(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 M(e){var t=(0,r.useContext)(i.SiteContext),n=m();n=(n=n||o.MediaPageStore.get("media-data").thumbnail_url)||"";var a,l,s=(a=(0,r.useState)(n),l=2,function(e){if(Array.isArray(e))return e}(a)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,i=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(a=n.next()).done)&&(i.push(a.value),!t||i.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return i}}(a,l)||function(e,t){if(e){if("string"==typeof e)return _(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)?_(e,t):void 0}}(a,l)||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.")}()),u=s[0],c=s[1];function d(){c(m())}function m(){var e=o.MediaPageStore.get("media-data"),n="string"==typeof e.poster_url?e.poster_url.trim():"";return""===n&&(n="string"==typeof e.thumbnail_url?e.thumbnail_url.trim():""),""===n&&(n="string"==typeof o.MediaPageStore.get("media-original-url")?o.MediaPageStore.get("media-original-url").trim():""),""===n?"#":t.url+"/"+n.replace(/^\//g,"")}return(0,r.useEffect)((function(){return o.MediaPageStore.on("loaded_image_data",d),function(){return o.MediaPageStore.removeListener("loaded_image_data",d)}}),[]),u?r.createElement("div",{className:"viewer-image-container"},r.createElement("img",{src:u,alt:o.MediaPageStore.get("media-data").title||null})):null}function k(){return r.createElement("div",{className:"player-container viewer-pdf-container"},r.createElement("div",{className:"player-container-inner"},r.createElement("span",null,r.createElement("span",null,r.createElement("i",{className:"material-icons"},"insert_drive_file")))))}P.defaultProps={inEmbed:!1},P.propTypes={inEmbed:u().bool},n(3233),n(3296),n(288),n(4458),n(3675),n(9751);var A=n(9905),C=n(8727),N=n(1283);function x(e){return(x="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function O(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function I(e,t){return(I=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function V(e,t){return!t||"object"!==x(t)&&"function"!=typeof t?R(e):t}function R(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function L(e){return(L=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var j=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&I(e,t)}(u,e);var t,n,a,l,s=(a=u,l=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=L(a);if(l){var n=L(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return V(this,e)});function u(e){var t;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),(t=s.call(this,e)).state={displayPlayer:!1},t.videoSources=[],function(e){switch(e){case"running":o.MediaPageStore.set("media-load-error-type","encodingRunning"),o.MediaPageStore.set("media-load-error-message","Media encoding is currently running. Try again in few minutes.");break;case"pending":o.MediaPageStore.set("media-load-error-type","encodingPending"),o.MediaPageStore.set("media-load-error-message","Media encoding is pending");break;case"fail":o.MediaPageStore.set("media-load-error-type","encodingFailed"),o.MediaPageStore.set("media-load-error-message","Media encoding failed")}}(t.props.data.encoding_status),null!==o.MediaPageStore.get("media-load-error-type"))return t.state.displayPlayer=!0,V(t);if("string"==typeof t.props.data.poster_url?t.videoPoster=(0,m.formatInnerLink)(t.props.data.poster_url,t.props.siteUrl):"string"==typeof t.props.data.thumbnail_url&&(t.videoPoster=(0,m.formatInnerLink)(t.props.data.thumbnail_url,t.props.siteUrl)),t.videoInfo=(0,A.RA)(t.props.data.encodings_info,t.props.data.hls_info),Object.keys(t.videoInfo).length){var n=o.VideoViewerStore.get("video-quality");(null===n||"Auto"===n&&void 0===t.videoInfo.Auto)&&(n=720);var a=(0,A.$e)(n,t.videoInfo);"Auto"===n&&void 0!==t.videoInfo.Auto&&t.videoSources.push({src:t.videoInfo.Auto.url[0]});var r,l,c=(0,A.KC)();for(l=0;l<t.videoInfo[a].format.length;){if("hls"===t.videoInfo[a].format[l]){t.videoSources.push({src:t.videoInfo[a].url[l]});break}l+=1}for(l in t.props.data.encodings_info[a])t.props.data.encodings_info[a].hasOwnProperty(l)&&c.support[l]&&(r=t.props.data.encodings_info[a][l].url)&&(r=(0,m.formatInnerLink)(r,t.props.siteUrl),t.videoSources.push({src:r,encodings_status:t.props.data.encodings_info[a][l].status}))}else t.videoInfo=null;if(t.videoSources.length){if(!t.props.inEmbed&&1===t.videoSources.length&&"running"===t.videoSources[0].encodings_status)return o.MediaPageStore.set("media-load-error-type","encodingRunning"),o.MediaPageStore.set("media-load-error-message","Media encoding is currently running. Try again in few minutes."),V(t)}else switch(o.MediaPageStore.get("media-load-error-type")){case"encodingRunning":case"encodingPending":case"encodingFailed":break;default:N.warn("VIDEO DEBUG:","Video files don't exist")}o.PageStore.on("switched_media_auto_play",t.onUpdateMediaAutoPlay.bind(R(t))),t.browserCache=new f.BrowserCache(i.SiteContext._currentValue.id,86400);var d=new f.MediaDurationInfo;return d.update(t.props.data.duration),t.durationISO8601=d.ISO8601(),t.playerElem=null,t.playerInstance=null,t.onPlayerInit=t.onPlayerInit.bind(R(t)),t.onClickNext=t.onClickNext.bind(R(t)),t.onClickPrevious=t.onClickPrevious.bind(R(t)),t.onStateUpdate=t.onStateUpdate.bind(R(t)),t.onVideoEnd=t.onVideoEnd.bind(R(t)),t.onVideoRestart=t.onVideoRestart.bind(R(t)),t}return t=u,(n=[{key:"componentDidMount",value:function(){if(this.videoSources.length){this.recommendedMedia=this.props.data.related_media.length?new f.PlayerRecommendedMedia(this.props.data.related_media,this.props.inEmbed,!o.PageStore.get("config-media-item").displayViews):null,this.upNextLoaderView=!this.props.inEmbed&&this.props.data.related_media.length?new f.UpNextLoaderView(this.props.data.related_media[0]):null;var e=null;if(this.props.inEmbed){var t=document.createElement("a"),n=document.createElement("a");(e=document.createElement("div")).setAttribute("class","media-links-top-left"),t&&(t.setAttribute("class","title-link"),t.setAttribute("href",this.props.data.url),t.setAttribute("title",this.props.data.title),t.setAttribute("target","_blank"),t.innerHTML=this.props.data.title),n&&(n.setAttribute("class","user-thumb-link"),n.setAttribute("href",(0,m.formatInnerLink)(this.props.data.author_profile,this.props.siteUrl)),n.setAttribute("title",this.props.data.author_name),n.setAttribute("target","_blank"),n.setAttribute("style","background-image:url("+(0,m.formatInnerLink)(o.MediaPageStore.get("media-author-thumbnail-url"),this.props.siteUrl)+")")),e.appendChild(n),e.appendChild(t)}var a=o.MediaPageStore.get("media-url"),r='<button class="share-video-btn"><i class="material-icons">share</i><span>Share</span></button>';r+='<div class="share-options-wrapper">\t\t\t\t\t\t\t\t\t<div class="share-options">\t\t\t\t\t\t\t\t\t\t<div class="share-options-inner">\t\t\t\t\t\t\t\t\t\t\t<div class="sh-option share-email">\t\t\t\t\t\t\t\t\t\t\t\t<a href="mailto:?body='+a+'" title=""><span><i class="material-icons">email</i></span><span>Email</span></a>\t\t\t\t\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\t\t\t\t\t<div class="sh-option share-fb">\t\t\t\t\t\t\t\t\t\t\t\t<a href="https://www.facebook.com/sharer.php?u='+a+'" title="" target="_blank"><span></span><span>Facebook</span></a>\t\t\t\t\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\t\t\t\t\t<div class="sh-option share-tw">\t\t\t\t\t\t\t\t\t\t\t\t<a href="https://twitter.com/intent/tweet?url='+a+'" title="" target="_blank"><span></span><span>Twitter</span></a>\t\t\t\t\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\t\t\t\t\t<div class="sh-option share-whatsapp">\t\t\t\t\t\t\t\t\t\t\t\t<a href="whatsapp://send?text='+a+'" title="" target="_blank" data-action="share/whatsapp/share"><span></span><span>WhatsApp</span></a>\t\t\t\t\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\t\t\t\t\t<div class="sh-option share-telegram">\t\t\t\t\t\t\t\t\t\t\t\t<a href="https://t.me/share/url?url='+a+"&text="+this.props.data.title+'" title="" target="_blank"><span></span><span>Telegram</span></a>\t\t\t\t\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\t\t\t\t\t<div class="sh-option share-linkedin">\t\t\t\t\t\t\t\t\t\t\t\t\t<a href="https://www.linkedin.com/shareArticle?mini=true&url='+a+'" title="" target="_blank"><span></span><span>LinkedIn</span></a>\t\t\t\t\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\t\t\t\t\t<div class="sh-option share-reddit">\t\t\t\t\t\t\t\t\t\t\t\t<a href="https://reddit.com/submit?url='+a+"&title="+this.props.data.title+'" title="" target="_blank"><span></span><span>reddit</span></a>\t\t\t\t\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\t\t\t\t\t<div class="sh-option share-tumblr">\t\t\t\t\t\t\t\t\t\t\t\t<a href="https://www.tumblr.com/widgets/share/tool?canonicalUrl='+a+"&title="+this.props.data.title+'" title="" target="_blank"><span></span><span>Tumblr</span></a>\t\t\t\t\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\t\t\t\t\t<div class="sh-option share-pinterest">\t\t\t\t\t\t\t\t\t\t\t\t<a href="http://pinterest.com/pin/create/link/?url='+a+'" title="" target="_blank"><span></span><span>Pinterest</span></a>\t\t\t\t\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\t\t\t\t\t<div class="sh-option share-more">\t\t\t\t\t\t\t\t\t\t\t\t<a href="'+a+'" title="More" target="_blank"><span><i class="material-icons">more_horiz</i></span><span></span></a>\t\t\t\t\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\t\t</div>',this.cornerLayers={topLeft:e,topRight:this.upNextLoaderView?this.upNextLoaderView.html():null,bottomLeft:this.recommendedMedia?this.recommendedMedia.html():null,bottomRight:this.props.inEmbed?r:null},this.setState({displayPlayer:!0},(function(){setTimeout((function(){var e=document.querySelector(".share-video-btn"),t=document.querySelector(".share-options-wrapper"),n=document.querySelector(".share-options-inner");e&&e.addEventListener("click",(function(e){(0,m.addClassname)(document.querySelector(".video-js.vjs-mediacms"),"vjs-visible-share-options")})),t&&t.addEventListener("click",(function(e){e.target!==n&&e.target!==t||(0,m.removeClassname)(document.querySelector(".video-js.vjs-mediacms"),"vjs-visible-share-options")}))}),1e3)}))}}},{key:"componentWillUnmount",value:function(){this.unsetRecommendedMedia()}},{key:"initRecommendedMedia",value:function(){null!==this.recommendedMedia&&(this.props.inEmbed||this.recommendedMedia.init(),this.playerInstance.player.on("fullscreenchange",this.recommendedMedia.onResize),o.PageStore.on("window_resize",this.recommendedMedia.onResize),o.VideoViewerStore.on("changed_viewer_mode",this.recommendedMedia.onResize))}},{key:"unsetRecommendedMedia",value:function(){null!==this.recommendedMedia&&(this.playerInstance.player.off("fullscreenchange",this.recommendedMedia.onResize),o.PageStore.removeListener("window_resize",this.recommendedMedia.onResize),o.VideoViewerStore.removeListener("changed_viewer_mode",this.recommendedMedia.onResize),this.recommendedMedia.destroy())}},{key:"onClickNext",value:function(){var e;o.MediaPageStore.get("playlist-id")?null===(e=o.MediaPageStore.get("playlist-next-media-url"))&&(e=this.props.data.related_media[0].url):this.props.inEmbed||(e=this.props.data.related_media[0].url),window.location.href=e}},{key:"onClickPrevious",value:function(){var e;o.MediaPageStore.get("playlist-id")?null===(e=o.MediaPageStore.get("playlist-previous-media-url"))&&(e=this.props.data.related_media[0].url):this.props.inEmbed||(e=this.props.data.related_media[0].url),window.location.href=e}},{key:"onStateUpdate",value:function(e){o.VideoViewerStore.get("in-theater-mode")!==e.theaterMode&&p.VideoViewerActions.set_viewer_mode(e.theaterMode),o.VideoViewerStore.get("player-volume")!==e.volume&&p.VideoViewerActions.set_player_volume(e.volume),o.VideoViewerStore.get("player-sound-muted")!==e.soundMuted&&p.VideoViewerActions.set_player_sound_muted(e.soundMuted),o.VideoViewerStore.get("video-quality")!==e.quality&&p.VideoViewerActions.set_video_quality(e.quality),o.VideoViewerStore.get("video-playback-speed")!==e.playbackSpeed&&p.VideoViewerActions.set_video_playback_speed(e.playbackSpeed)}},{key:"onPlayerInit",value:function(e,t){this.playerElem=t,this.playerInstance=e,this.upNextLoaderView&&(this.upNextLoaderView.setVideoJsPlayerElem(this.playerInstance.player.el_),this.onUpdateMediaAutoPlay()),this.props.inEmbed||this.playerElem.parentNode.focus(),null!==this.recommendedMedia&&(this.recommendedMedia.initWrappers(this.playerElem.parentNode),this.props.inEmbed&&(this.playerInstance.player.one("pause",this.recommendedMedia.init),this.initRecommendedMedia())),this.playerInstance.player.one("ended",this.onVideoEnd)}},{key:"onVideoRestart",value:function(){null!==this.recommendedMedia&&(this.recommendedMedia.updateDisplayType("inline"),this.props.inEmbed&&this.playerInstance.player.one("pause",this.recommendedMedia.init),this.playerInstance.player.one("ended",this.onVideoEnd))}},{key:"onVideoEnd",value:function(){if(null!==this.recommendedMedia&&(this.props.inEmbed||this.initRecommendedMedia(),this.recommendedMedia.updateDisplayType("full"),this.playerInstance.player.one("playing",this.onVideoRestart)),!this.props.inEmbed&&o.MediaPageStore.get("playlist-id")){var e=document.querySelector(".video-player .more-media"),t=document.querySelector(".video-player .vjs-actions-anim");this.upNextLoaderView.cancelTimer();var n=o.MediaPageStore.get("playlist-next-media-url");return n&&(e&&(e.style.display="none"),t&&(t.style.display="none"),window.location.href=n),void this.upNextLoaderView.hideTimerView()}this.upNextLoaderView&&(o.PageStore.get("media-auto-play")?(this.upNextLoaderView.startTimer(),this.playerInstance.player.one("play",function(){this.upNextLoaderView.cancelTimer()}.bind(this))):this.upNextLoaderView.cancelTimer())}},{key:"onUpdateMediaAutoPlay",value:function(){this.upNextLoaderView&&(o.PageStore.get("media-auto-play")?this.upNextLoaderView.showTimerView(this.playerInstance.isEnded()):this.upNextLoaderView.hideTimerView())}},{key:"render",value:function(){var e=this,t=null,n=null;!this.props.inEmbed&&o.MediaPageStore.get("playlist-id")?(t=o.MediaPageStore.get("playlist-next-media-url"),n=o.MediaPageStore.get("playlist-previous-media-url")):t=this.props.data.related_media.length&&!this.props.inEmbed?this.props.data.related_media[0].url:null;var a=this.props.data.sprites_url?{url:this.props.siteUrl+"/"+this.props.data.sprites_url.replace(/^\//g,""),frame:{width:160,height:90,seconds:10}}:null;return r.createElement("div",{key:(this.props.inEmbed?"embed-":"")+"player-container",className:"player-container"+(this.videoSources.length?"":" player-container-error"),style:this.props.containerStyles,ref:"playerContainer"},r.createElement("div",{className:"player-container-inner",ref:"playerContainerInner",style:this.props.containerStyles},this.state.displayPlayer&&null!==o.MediaPageStore.get("media-load-error-type")?r.createElement(C.hJ,{errorMessage:o.MediaPageStore.get("media-load-error-message")}):null,this.state.displayPlayer&&null==o.MediaPageStore.get("media-load-error-type")?r.createElement("div",{className:"video-player",ref:"videoPlayerWrapper",key:"videoPlayerWrapper"},r.createElement(i.SiteConsumer,null,(function(i){return r.createElement(C.Y7,{playerVolume:e.browserCache.get("player-volume"),playerSoundMuted:e.browserCache.get("player-sound-muted"),videoQuality:e.browserCache.get("video-quality"),videoPlaybackSpeed:parseInt(e.browserCache.get("video-playback-speed"),10),inTheaterMode:e.browserCache.get("in-theater-mode"),siteId:i.id,siteUrl:i.url,info:e.videoInfo,cornerLayers:e.cornerLayers,sources:e.videoSources,poster:e.videoPoster,previewSprite:a,subtitlesInfo:e.props.data.subtitles_info,enableAutoplay:!e.props.inEmbed,inEmbed:e.props.inEmbed,hasTheaterMode:!e.props.inEmbed,hasNextLink:!!t,hasPreviousLink:!!n,errorMessage:o.MediaPageStore.get("media-load-error-message"),onClickNextCallback:e.onClickNext,onClickPreviousCallback:e.onClickPrevious,onStateUpdateCallback:e.onStateUpdate,onPlayerInitCallback:e.onPlayerInit})}))):null))}}])&&O(t.prototype,n),u}(r.PureComponent);function T(e){for(var t=null,n=[],a=location.search.substr(1).split("&"),r=0;r<a.length;r++)(n=a[r].split("="))[0]===e&&(t=decodeURIComponent(n[1]));return t}j.defaultProps={inEmbed:!0,siteUrl:u().string.isRequired},j.propTypes={inEmbed:u().bool},new MutationObserver((function(e,t){var n,a=document.querySelector(".video-js.vjs-mediacms video");if(a)return(n=videojs(a)).playsinline(!0),1==T("muted")&&n.muted(!0),T("time")>=0&&n.currentTime(T("time")),1==T("autoplay")&&n.play(),void t.disconnect()})).observe(document,{childList:!0,subtree:!0}),n(9808);var D=n(2546),U=n(4234),B=(n(6453),n(7390),n(4669),n(2070),n(3064));function F(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,i=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(a=n.next()).done)&&(i.push(a.value),!t||i.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return i}}(e,t)||q(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 q(e,t){if(e){if("string"==typeof e)return z(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)?z(e,t):void 0}}function z(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}var H="comment",W="Comment",$="SUBMIT";function Q(e){var t=(0,r.useRef)(null),n=F((0,r.useState)(""),2),a=n[0],l=n[1],s=F((0,r.useState)(!1),2),u=s[0],c=s[1],d=F((0,r.useState)(!1),2),m=d[0],f=d[1],y=F((0,r.useState)(-1),2),h=y[0],g=y[1],v=F((0,r.useState)(i.MemberContext._currentValue.is.anonymous?i.LinksContext._currentValue.signin+"?next=/"+window.location.href.replace(i.SiteContext._currentValue.url,"").replace(/^\//g,""):null),1)[0];function b(){t.current.style.height="";var e=t.current.scrollHeight,n=0<h?h:parseFloat(window.getComputedStyle(t.current).lineHeight);l(""),c(!1),g(n),t.current.style.height=Math.max(20,h*Math.ceil(e/n))+"px"}function S(){c(!1)}return(0,r.useEffect)((function(){return o.MediaPageStore.on("comment_submit",b),o.MediaPageStore.on("comment_submit_fail",S),function(){o.MediaPageStore.removeListener("comment_submit",b),o.MediaPageStore.removeListener("comment_submit_fail",S)}})),i.MemberContext._currentValue.is.anonymous?r.createElement("div",{className:"comments-form"},r.createElement("div",{className:"comments-form-inner"},r.createElement(U.UserThumbnail,null),r.createElement("div",{className:"form"},r.createElement("a",{href:v,rel:"noffolow",className:"form-textarea-wrap",title:"Add a comment..."},r.createElement("span",{className:"form-textarea"},"Add a comment...")),r.createElement("div",{className:"form-buttons"},r.createElement("a",{href:v,rel:"noffolow",className:"disabled"},$))))):r.createElement("div",{className:"comments-form"},r.createElement("div",{className:"comments-form-inner"},r.createElement(U.UserThumbnail,null),r.createElement("div",{className:"form"},r.createElement("div",{className:"form-textarea-wrap"+(m?" focused":"")},r.createElement("textarea",{ref:t,className:"form-textarea",rows:"1",placeholder:"Add a comment...",value:a,onChange:function(e){t.current.style.height="";var n=t.current.scrollHeight,a=0<h?h:parseFloat(window.getComputedStyle(t.current).lineHeight);l(t.current.value),c(!0),g(a),t.current.style.height=Math.max(20,h*Math.ceil(n/a))+"px"},onFocus:function(){f(!0)},onBlur:function(){f(!1)}})),r.createElement("div",{className:"form-buttons"},r.createElement("button",{className:""===a.trim()?"disabled":"",onClick:function(){if(u){var e=t.current.value.trim();""!==e&&p.MediaPageActions.submitComment(e)}}},$)))))}Q.propTypes={comment_type:u().oneOf(["new","reply"]),media_id:u().oneOfType([u().string,u().number]).isRequired,reply_comment_id:u().oneOfType([u().string,u().number])},Q.defaultProps={comment_type:"new"};function Y(e){var t=F((0,D.usePopup)(),3),n=t[0],a=t[1],o=t[2];return r.createElement("div",{className:"comment-actions"},i.MemberContext._currentValue.can.deleteComment?r.createElement("div",{className:"comment-action remove-comment"},r.createElement(o,{contentRef:n},r.createElement("button",null,"DELETE ","COMMENT")),r.createElement(a,{contentRef:n},r.createElement(U.PopupMain,null,r.createElement("div",{className:"popup-message"},r.createElement("span",{className:"popup-message-title"},W," removal"),r.createElement("span",{className:"popup-message-main"},"You're willing to remove ",H," permanently?")),r.createElement("hr",null),r.createElement("span",{className:"popup-message-bottom"},r.createElement("button",{className:"button-link cancel-comment-removal",onClick:function(){n.current.toggle()}},"CANCEL"),r.createElement("button",{className:"button-link proceed-comment-removal",onClick:function(){n.current.toggle(),p.MediaPageActions.deleteComment(e.comment_id)}},"PROCEED"))))):null)}function Z(e){var t=(0,r.useRef)(null),n=(0,r.useRef)(null),a=F((0,r.useState)(!0),2),o=a[0],l=a[1],s=F((0,r.useState)(!1),2),u=s[0];return s[1],(0,r.useEffect)((function(){return function(){}}),[]),r.createElement("div",{className:"comment"},r.createElement("div",{className:"comment-inner"},r.createElement("a",{className:"comment-author-thumb",href:e.author_link,title:e.author_name},r.createElement("img",{src:e.author_thumb,alt:e.author_name})),r.createElement("div",{className:"comment-content"},r.createElement("div",{className:"comment-meta"},r.createElement("div",{className:"comment-author"},r.createElement("a",{href:e.author_link,title:e.author_name},e.author_name)),r.createElement("div",{className:"comment-date"},(0,B.WU)(new Date(e.publish_date)))),r.createElement("div",{ref:t,className:"comment-text"+(o?" show-all":"")},r.createElement("div",{ref:n,className:"comment-text-inner",dangerouslySetInnerHTML:{__html:e.text}})),u?r.createElement("button",{className:"toggle-more",onClick:function(){l(!o)}},o?"Show less":"Read more"):null,i.MemberContext._currentValue.can.deleteComment?r.createElement(Y,{comment_id:e.comment_id}):null)))}Z.propTypes={comment_id:u().oneOfType([u().string,u().number]).isRequired,media_id:u().oneOfType([u().string,u().number]).isRequired,text:u().string,author_name:u().string,author_link:u().string,author_thumb:u().string,publish_date:u().oneOfType([u().string,u().number]),likes:u().number,dislikes:u().number},Z.defaultProps={author_name:"",author_link:"#",publish_date:0,likes:0,dislikes:0};var G=function(e){var t=e.commentsLength;return r.createElement(r.Fragment,null,!i.MemberContext._currentValue.can.readComment||o.MediaPageStore.get("media-data").enable_comments?null:r.createElement("span",{className:"disabled-comments-msg"},"Comments are disabled"),i.MemberContext._currentValue.can.readComment&&(o.MediaPageStore.get("media-data").enable_comments||i.MemberContext._currentValue.can.editMedia)?r.createElement("h2",null,t?1<t?t+" Comments":t+" "+W:o.MediaPageStore.get("media-data").enable_comments?"No comment yet":""):null)};function J(e){var t=F((0,r.useState)(o.MediaPageStore.get("media-id")),2),n=t[0],a=(t[1],F((0,r.useState)(i.MemberContext._currentValue.can.readComment?o.MediaPageStore.get("media-comments"):[]),2)),l=a[0],s=a[1],u=F((0,r.useState)(!1),2),c=u[0],d=u[1];function m(){var e,t=function(e){if(Array.isArray(e))return z(e)}(e=o.MediaPageStore.get("media-comments"))||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||q(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();t.forEach((function(e){var t,n;e.text=(t=e.text,n=new RegExp("((\\d)?\\d:)?(\\d)?\\d:\\d\\d","g"),t.replace(n,(function(e,t){for(var n=e.split(":"),a=0,r=1,i=new URLSearchParams(window.location.search);n.length>0;)a+=r*parseInt(n.pop(),10),r*=60;return i.set("t",a),'<a href="'+o.MediaPageStore.get("media-url").split("?")[0]+"?"+i+'">'+e+"</a>"})))})),function(){var e=document.querySelector(".page-main"),t=e.querySelector(".no-comment"),n=o.PageStore.get("config-contents").uploader.postUploadMessage;if(""===n)t&&0===comm.length&&t.parentNode.removeChild(t);else if(0===comm.length&&"unlisted"===o.MediaPageStore.get("media-data").state){if(-1<i.LinksContext._currentValue.profile.media.indexOf(o.MediaPageStore.get("media-data").author_profile)&&!t){var a=document.createElement("div");a.setAttribute("role","alert"),a.setAttribute("class","alert info alert-dismissible no-comment"),a.innerHTML='<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>'+n,e.firstChild?e.insertBefore(a,e.firstChild):e.appendChild(a),a.querySelector("button.close").addEventListener("click",(function(e){return a.setAttribute("class","alert info alert-dismissible hiding"),setTimeout((function(){a.parentNode.removeChild(a)}),400),e.preventDefault(),e.stopPropagation(),!1}))}}else t&&0<comm.length&&t.parentNode.removeChild(t)}(),s(t)}function f(e){m(),setTimeout((function(){return p.PageActions.addNotification("Comment added","commentSubmit")}),100)}function y(){setTimeout((function(){return p.PageActions.addNotification("Comment submition failed","commentSubmitFail")}),100)}function h(e){m(),setTimeout((function(){return p.PageActions.addNotification("Comment removed","commentDelete")}),100)}function g(e){setTimeout((function(){return p.PageActions.addNotification("Comment removal failed","commentDeleteFail")}),100)}return(0,r.useEffect)((function(){d(l.length&&i.MemberContext._currentValue.can.readComment&&(o.MediaPageStore.get("media-data").enable_comments||i.MemberContext._currentValue.can.editMedia))}),[l]),(0,r.useEffect)((function(){return o.MediaPageStore.on("comments_load",m),o.MediaPageStore.on("comment_submit",f),o.MediaPageStore.on("comment_submit_fail",y),o.MediaPageStore.on("comment_delete",h),o.MediaPageStore.on("comment_delete_fail",g),function(){o.MediaPageStore.removeListener("comments_load",m),o.MediaPageStore.removeListener("comment_submit",f),o.MediaPageStore.removeListener("comment_submit_fail",y),o.MediaPageStore.removeListener("comment_delete",h),o.MediaPageStore.removeListener("comment_delete_fail",g)}}),[]),r.createElement("div",{className:"comments-list"},r.createElement("div",{className:"comments-list-inner"},r.createElement(G,{commentsLength:l.length}),o.MediaPageStore.get("media-data").enable_comments?r.createElement(Q,{media_id:n}):null,c?l.map((function(e){return r.createElement(Z,{key:e.uid,comment_id:e.uid,media_id:n,text:e.text,author_name:e.author_name,author_link:e.author_profile,author_thumb:i.SiteContext._currentValue.url+"/"+e.author_thumbnail_url.replace(/^\//g,""),publish_date:e.add_date,likes:0,dislikes:0})})):null))}var K=n(1283);function X(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,i=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(a=n.next()).done)&&(i.push(a.value),!t||i.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ee(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)?ee(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 ee(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 te(e){var t,n,a=[];if(e.length)for(t=0,n=1<e.length?", ":"";t<e.length;)a[t]=r.createElement("div",{key:t},r.createElement("a",{href:e[t].url,title:e[t].title},e[t].title),t<e.length-1?n:""),t+=1;return a}function ne(e){return r.createElement("div",{className:"media-author-banner"},r.createElement("div",null,r.createElement("a",{className:"author-banner-thumb",href:e.link||null,title:e.name},r.createElement("span",{style:{backgroundImage:"url("+e.thumb+")"}},r.createElement("img",{src:e.thumb,loading:"lazy",alt:e.name,title:e.name})))),r.createElement("div",null,r.createElement("span",null,r.createElement("a",{href:e.link,className:"author-banner-name",title:e.name},r.createElement("span",null,e.name))),o.PageStore.get("config-media-item").displayPublishDate&&e.published?r.createElement("span",{className:"author-banner-date"},"Published on ",(0,m.publishedOnDate)(new Date(e.published))):null))}function ae(e){return r.createElement("div",{className:e.id.trim()?"media-content-"+e.id.trim():null},r.createElement("div",{className:"media-content-field"},r.createElement("div",{className:"media-content-field-label"},r.createElement("h4",null,e.title)),r.createElement("div",{className:"media-content-field-content"},e.value)))}function re(e){var t=e.link;return window.MediaCMS.site.devEnv&&(t="/edit-media.html"),r.createElement("a",{href:t,rel:"nofollow",title:"Edit media",className:"edit-media"},"EDIT MEDIA")}function ie(e){var t=e.link;return window.MediaCMS.site.devEnv&&(t="#"),r.createElement("a",{href:t,rel:"nofollow",title:"Edit subtitle",className:"edit-subtitle"},"EDIT SUBTITLE")}function oe(e){var t=(0,D.useUser)().userCan,n=e.description.trim(),a=!o.PageStore.get("config-enabled").taxonomies.tags||o.PageStore.get("config-enabled").taxonomies.tags.enabled?te(o.MediaPageStore.get("media-tags")):[],l=o.PageStore.get("config-options").pages.media.categoriesWithTitle?[]:!o.PageStore.get("config-enabled").taxonomies.categories||o.PageStore.get("config-enabled").taxonomies.categories.enabled?te(o.MediaPageStore.get("media-categories")):[],s=o.MediaPageStore.get("media-summary");s=s?s.trim():"";var u=X((0,D.usePopup)(),3),c=u[0],d=u[1],f=u[2],y=X((0,r.useState)(""!==s),2),h=y[0],g=(y[1],X((0,r.useState)(""==s),2)),v=g[0],b=g[1];function S(e){setTimeout((function(){p.PageActions.addNotification("Media removed. Redirecting...","mediaDelete"),setTimeout((function(){window.location.href=i.SiteContext._currentValue.url+"/"+o.MediaPageStore.get("media-data").author_profile.replace(/^\//g,"")}),2e3)}),100),void 0!==e&&K.info("Removed media '"+e+'"')}function w(e){setTimeout((function(){p.PageActions.addNotification("Media removal failed","mediaDeleteFail")}),100),void 0!==e&&K.info('Media "'+e+'" removal failed')}(0,r.useEffect)((function(){return o.MediaPageStore.on("media_delete",S),o.MediaPageStore.on("media_delete_fail",w),function(){o.MediaPageStore.removeListener("media_delete",S),o.MediaPageStore.removeListener("media_delete_fail",w)}}),[]);var E=(0,m.formatInnerLink)(e.author.url,i.SiteContext._currentValue.url),P=(0,m.formatInnerLink)(e.author.thumb,i.SiteContext._currentValue.url);return r.createElement("div",{className:"media-info-content"},void 0===o.PageStore.get("config-media-item").displayAuthor||null===o.PageStore.get("config-media-item").displayAuthor||o.PageStore.get("config-media-item").displayAuthor?r.createElement(ne,{link:E,thumb:P,name:e.author.name,published:e.published}):null,r.createElement("div",{className:"media-content-banner"},r.createElement("div",{className:"media-content-banner-inner"},h?r.createElement("div",{className:"media-content-summary"},s):null,h&&!v||!n?null:o.PageStore.get("config-options").pages.media.htmlInDescription?r.createElement("div",{className:"media-content-description",dangerouslySetInnerHTML:{__html:n}}):r.createElement("div",{className:"media-content-description"},n),h?r.createElement("button",{className:"load-more",onClick:function(){b(!v)}},v?"SHOW LESS":"SHOW MORE"):null,a.length?r.createElement(ae,{value:a,title:1<a.length?"Tags":"Tag",id:"tags"}):null,l.length?r.createElement(ae,{value:l,title:1<l.length?"Categories":"Category",id:"categories"}):null,t.editMedia||t.editSubtitle||t.deleteMedia?r.createElement("div",{className:"media-author-actions"},t.editMedia?r.createElement(re,{link:o.MediaPageStore.get("media-data").edit_url}):null,t.editSubtitle&&"video"===o.MediaPageStore.get("media-data").media_type?r.createElement(ie,{link:o.MediaPageStore.get("media-data").edit_url.replace("edit?","add_subtitle?")}):null,r.createElement(f,{contentRef:c},r.createElement("button",{className:"remove-media"},"DELETE MEDIA")),r.createElement(d,{contentRef:c},r.createElement(U.PopupMain,null,r.createElement("div",{className:"popup-message"},r.createElement("span",{className:"popup-message-title"},"Media removal"),r.createElement("span",{className:"popup-message-main"},"You're willing to remove media permanently?")),r.createElement("hr",null),r.createElement("span",{className:"popup-message-bottom"},r.createElement("button",{className:"button-link cancel-comment-removal",onClick:function(){c.current.toggle()}},"CANCEL"),r.createElement("button",{className:"button-link proceed-comment-removal",onClick:function(){p.MediaPageActions.removeMedia(),c.current.toggle()}},"PROCEED"))))):null)),r.createElement(J,null))}function le(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,i=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(a=n.next()).done)&&(i.push(a.value),!t||i.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return se(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)?se(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 se(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 ue(){var e=le((0,r.useState)(o.MediaPageStore.get("user-disliked-media")),2),t=e[0],n=e[1],a=le((0,r.useState)((0,m.formatViewsNumber)(o.MediaPageStore.get("media-dislikes"),!1)),2),l=a[0],s=a[1];function u(){n(o.MediaPageStore.get("user-disliked-media")),s((0,m.formatViewsNumber)(o.MediaPageStore.get("media-dislikes"),!1))}function c(){u(),p.PageActions.addNotification(i.TextsContext._currentValue.messages.addToDisliked,"mediaDislike")}function d(){u(),p.PageActions.addNotification(i.TextsContext._currentValue.messages.removeFromDisliked,"cancelMediaDislike")}function f(){p.PageActions.addNotification("Action failed","mediaDislikeRequestFail")}return(0,r.useEffect)((function(){return o.MediaPageStore.on("disliked_media",c),o.MediaPageStore.on("undisliked_media",d),o.MediaPageStore.on("disliked_media_failed_request",f),function(){o.MediaPageStore.removeListener("disliked_media",c),o.MediaPageStore.removeListener("undisliked_media",d),o.MediaPageStore.removeListener("disliked_media_failed_request",f)}}),[]),r.createElement("div",{className:"like"},r.createElement("button",{onClick:function(e){e.preventDefault(),e.stopPropagation(),p.MediaPageActions[t?"undislikeMedia":"dislikeMedia"]()}},r.createElement(U.CircleIconButton,{type:"span"},r.createElement(U.MaterialIcon,{type:"thumb_down"})),r.createElement("span",{className:"dislikes-counter"},l)))}function ce(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,i=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(a=n.next()).done)&&(i.push(a.value),!t||i.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return de(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)?de(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 de(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 me(){var e=ce((0,r.useState)(o.MediaPageStore.get("user-liked-media")),2),t=e[0],n=e[1],a=ce((0,r.useState)((0,m.formatViewsNumber)(o.MediaPageStore.get("media-likes"),!1)),2),l=a[0],s=a[1];function u(){n(o.MediaPageStore.get("user-liked-media")),s((0,m.formatViewsNumber)(o.MediaPageStore.get("media-likes"),!1))}function c(){u(),p.PageActions.addNotification(i.TextsContext._currentValue.addToLiked,"likedMedia")}function d(){u(),p.PageActions.addNotification(i.TextsContext._currentValue.removeFromLiked,"unlikedMedia")}function f(){p.PageActions.addNotification("Action failed","likedMediaRequestFail")}return(0,r.useEffect)((function(){return o.MediaPageStore.on("liked_media",c),o.MediaPageStore.on("unliked_media",d),o.MediaPageStore.on("liked_media_failed_request",f),function(){o.MediaPageStore.removeListener("liked_media",c),o.MediaPageStore.removeListener("unliked_media",d),o.MediaPageStore.removeListener("liked_media_failed_request",f)}}),[]),r.createElement("div",{className:"like"},r.createElement("button",{onClick:function(e){e.preventDefault(),e.stopPropagation(),p.MediaPageActions[t?"unlikeMedia":"likeMedia"]()}},r.createElement(U.CircleIconButton,{type:"span"},r.createElement(U.MaterialIcon,{type:"thumb_up"})),r.createElement("span",{className:"likes-counter"},l)))}function pe(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 fe(e){var t,n,a=(0,r.useRef)(null),i=(0,r.useRef)(null),l=(t=(0,r.useState)(null),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,i=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(a=n.next()).done)&&(i.push(a.value),!t||i.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return i}}(t,n)||function(e,t){if(e){if("string"==typeof e)return pe(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)?pe(e,t):void 0}}(t,n)||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.")}()),s=l[0],u=l[1];function c(){u(window.innerHeight-(104+a.current.offsetHeight))}return(0,r.useEffect)((function(){return c(),o.PageStore.on("window_resize",c),function(){o.PageStore.removeListener("window_resize",c)}}),[]),r.createElement("form",null,r.createElement("div",{className:"report-form",style:null!==s?{maxHeight:s+"px"}:null},r.createElement("div",{className:"form-title"},"Report media"),r.createElement("div",{className:"form-field"},r.createElement("span",{className:"label"},"URL"),r.createElement("input",{type:"text",readOnly:!0,value:e.mediaUrl})),r.createElement("div",{className:"form-field"},r.createElement("span",{className:"label"},"Description"),r.createElement("textarea",{ref:i,required:!0})),r.createElement("div",{className:"form-field form-help-text"},"Reported media is reviewed")),r.createElement("div",{ref:a,className:"form-actions-bottom"},r.createElement("button",{className:"cancel",onClick:function(t){t.preventDefault(),void 0!==e.cancelReportForm&&e.cancelReportForm()}},"CANCEL"),r.createElement("button",{onClick:function(t){var n=i.current.value.trim();""!==n&&(t.preventDefault(),void 0!==e.submitReportForm&&e.submitReportForm(n))}},"SUBMIT")))}function ye(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,i=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(a=n.next()).done)&&(i.push(a.value),!t||i.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return he(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)?he(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 he(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 ge(e,t){var n,a,r=i.SiteContext._currentValue,o=e.encodings_info,l={};for(n in o)if(o.hasOwnProperty(n)&&Object.keys(o[n]).length)for(a in o[n])o[n].hasOwnProperty(a)&&"success"===o[n][a].status&&100===o[n][a].progress&&(l[o[n][a].title]={text:n+" - "+a.toUpperCase()+" ("+o[n][a].size+")",link:(0,m.formatInnerLink)(o[n][a].url,r.url),linkAttr:{target:"_blank",download:e.title+"_"+n+"_"+a.toUpperCase()}});return l.original_media_url={text:"Original file ("+e.size+")",link:(0,m.formatInnerLink)(e.original_media_url,r.url),linkAttr:{target:"_blank",download:e.title}},Object.values(l)}function ve(e,t,n,a,i,o,l){var s=t.url,u=t.media_type,c=t.state||"N/A",d=t.encoding_status||"N/A",m=t.reported_times,p=t.is_reviewed,f="video"===u,y=function(e,t,n,a,r){var i=[],o="video"===t.media_type,l=t.reported_times;return n&&e.downloadMedia&&(o?i.push({itemType:"open-subpage",text:"Download",icon:"arrow_downward",itemAttr:{className:"visible-only-in-small"},buttonAttr:{className:"change-page","data-page-id":"videoDownloadOptions"}}):a&&i.push({itemType:"link",link:a,text:"Download",icon:"arrow_downward",itemAttr:{className:"visible-only-in-small"},linkAttr:{target:"_blank",download:t.title}})),o&&e.editMedia&&i.push({itemType:"open-subpage",text:"Status info",icon:"info",buttonAttr:{className:"change-page","data-page-id":"mediaStatusInfo"}}),e.reportMedia&&(r?i.push({itemType:"div",text:"Reported",icon:"flag",divAttr:{className:"reported-label loggedin-media-reported"}}):i.push({itemType:"open-subpage",text:"Report",icon:"flag",buttonAttr:{className:"change-page"+(l?" loggedin-media-reported":""),"data-page-id":"loggedInReportMedia"}})),i}(e,t,n,a,i),h={};return y.length&&(h.main=r.createElement("div",{className:"main-options"},r.createElement(U.PopupMain,null,r.createElement(U.NavigationMenuList,{items:y})))),e.reportMedia&&(h.loggedInReportMedia=i?null:r.createElement("div",{className:"popup-fullscreen"},r.createElement(U.PopupMain,null,r.createElement("span",{className:"popup-fullscreen-overlay"}),r.createElement("div",null,r.createElement(fe,{mediaUrl:s,submitReportForm:o,cancelReportForm:l}))))),e.editMedia&&(h.mediaStatusInfo=r.createElement("div",{className:"main-options"},r.createElement(U.PopupMain,null,r.createElement("ul",{className:"media-status-info"},r.createElement("li",null,"Media type: ",r.createElement("span",null,u)),r.createElement("li",null,"State: ",r.createElement("span",null,c)),r.createElement("li",null,"Review state: ",r.createElement("span",null,p?"Is reviewed":"Pending review")),f?r.createElement("li",null,"Encoding Status: ",r.createElement("span",null,d)):null,m?r.createElement("li",{className:"reports"},"Reports: ",r.createElement("span",null,m)):null)))),n&&e.downloadMedia&&f&&(h.videoDownloadOptions=r.createElement("div",{className:"video-download-options"},r.createElement(U.PopupMain,null,r.createElement(U.NavigationMenuList,{items:ge(t)})))),h}n(9628),fe.propTypes={mediaUrl:u().string.isRequired,cancelReportForm:u().func,submitReportForm:u().func};var be="more-options active-options";function Se(e){var t=(0,D.useUser)().userCan,n=i.SiteContext._currentValue,a=(0,m.formatInnerLink)(o.MediaPageStore.get("media-original-url"),n.url),l=o.MediaPageStore.get("media-data"),s="video"===l.media_type,u=ye((0,D.usePopup)(),3),c=u[0],d=u[1],f=u[2],y=ye((0,r.useState)(!1),2),h=y[0],g=y[1],v=ye((0,r.useState)(!1),2),b=v[0],S=v[1],w=ye((0,r.useState)({}),2),E=w[0],P=w[1],_=ye((0,r.useState)("main"),2),M=_[0],k=_[1],A=ye((0,r.useState)(be),2),C=A[0],N=A[1];function x(e){p.MediaPageActions.reportMedia(e)}function O(){c.current.toggle()}function I(){c.current.tryToHide(),setTimeout((function(){p.PageActions.addNotification("Media Reported","reportedMedia"),S(!0),o.MediaPageStore.removeListener("reported_media",I)}),100)}return(0,r.useEffect)((function(){b||(h?o.MediaPageStore.on("reported_media",I):o.MediaPageStore.removeListener("reported_media",I))}),[h]),(0,r.useEffect)((function(){g(Object.keys(E).length&&e.allowDownload&&t.downloadMedia)}),[E]),(0,r.useEffect)((function(){var n=be;e.allowDownload&&t.downloadMedia&&"videoDownloadOptions"===M&&(n+=" video-downloads"),1===Object.keys(E).length&&e.allowDownload&&t.downloadMedia&&(s||a)&&(n+=" visible-only-in-small"),N(n)}),[M]),(0,r.useEffect)((function(){P(ve(t,l,e.allowDownload,a,b,x,O))}),[b]),(0,r.useEffect)((function(){return P(ve(t,l,e.allowDownload,a,b,x,O)),function(){h&&!b&&o.MediaPageStore.removeListener("reported_media",I)}}),[]),h?r.createElement("div",{className:C},r.createElement(f,{contentRef:c},r.createElement("span",null,r.createElement(U.CircleIconButton,{type:"button"},r.createElement(U.MaterialIcon,{type:"more_horiz"})))),r.createElement("div",{className:"nav-page-"+M},r.createElement(d,{contentRef:c,hideCallback:function(){k("main")}},r.createElement(U.NavigationContentApp,{pageChangeCallback:function(e){k(e)},initPage:M,focusFirstItemOnPageChange:!1,pages:E,pageChangeSelector:".change-page",pageIdSelectorAttr:"data-page-id"})))):null}Se.propTypes={allowDownload:u().bool.isRequired},Se.defaultProps={allowDownload:!1};var we=n(7642);function Ee(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,i=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(a=n.next()).done)&&(i.push(a.value),!t||i.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Pe(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)?Pe(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 Pe(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(e){return e.renderDate?r.createElement("label",null,r.createElement("input",{type:"checkbox",checked:e.isChecked,onChange:function(t){t.persist(),e.isChecked?p.MediaPageActions.removeMediaFromPlaylist(e.playlistId,o.MediaPageStore.get("media-id")):p.MediaPageActions.addMediaToPlaylist(e.playlistId,o.MediaPageStore.get("media-id"))}}),r.createElement("span",null,e.title)):null}function Me(e){var t=(0,r.useRef)(null),n=(0,r.useRef)(null),a=Ee((0,r.useState)(new Date),2),i=a[0],l=a[1],s=Ee((0,r.useState)(o.MediaPageStore.get("playlists")),2),u=s[0],c=s[1],d=Ee((0,r.useState)(!1),2),m=d[0],f=d[1];function y(){w()}function h(){c(o.MediaPageStore.get("playlists")),l(new Date)}function g(){c(o.MediaPageStore.get("playlists")),l(new Date),setTimeout((function(){p.PageActions.addNotification("Media added to playlist","playlistMediaAdditionComplete")}),100)}function v(){setTimeout((function(){p.PageActions.addNotification("Media's addition to playlist failed","playlistMediaAdditionFail")}),100)}function b(){c(o.MediaPageStore.get("playlists")),l(new Date),setTimeout((function(){p.PageActions.addNotification("Media removed from playlist","playlistMediaRemovalComplete")}),100)}function S(){setTimeout((function(){p.PageActions.addNotification("Media's removal from playlist failed","playlistMediaaRemovalFail")}),100)}function w(){null!==n.current&&(n.current.style.maxHeight=window.innerHeight-74-(t.current.offsetHeight-n.current.offsetHeight)+"px")}function E(){f(!m),w()}return(0,r.useEffect)((function(){w()})),(0,r.useEffect)((function(){return o.PageStore.on("window_resize",y),o.MediaPageStore.on("playlists_load",h),o.MediaPageStore.on("media_playlist_addition_completed",g),o.MediaPageStore.on("media_playlist_addition_failed",v),o.MediaPageStore.on("media_playlist_removal_completed",b),o.MediaPageStore.on("media_playlist_removal_failed",S),function(){o.PageStore.removeListener("window_resize",y),o.MediaPageStore.removeListener("playlists_load",h),o.MediaPageStore.removeListener("media_playlist_addition_completed",g),o.MediaPageStore.removeListener("media_playlist_addition_failed",v),o.MediaPageStore.removeListener("media_playlist_removal_completed",b),o.MediaPageStore.removeListener("media_playlist_removal_failed",S)}}),[]),r.createElement("div",{ref:t,className:"saveto-popup"},r.createElement("div",{className:"saveto-title"},"Save to...",r.createElement(U.CircleIconButton,{type:"button",onClick:function(){f(!1),void 0!==e.triggerPopupClose&&e.triggerPopupClose()}},r.createElement(U.MaterialIcon,{type:"close"}))),u.length?r.createElement("div",{ref:n,className:"saveto-select"},function(){for(var e=o.MediaPageStore.get("media-id"),t=[],n=0;n<u.length;)t.push(r.createElement("div",{key:"playlist_"+u[n].playlist_id},r.createElement(_e,{renderDate:i,title:u[n].title,privacy:u[n].status,isChecked:-1<u[n].media_list.indexOf(e),playlistId:u[n].playlist_id}))),n+=1;return t}()):null,m?r.createElement("div",{className:"saveto-new-playlist"},r.createElement(we.A,{onCancel:E,onPlaylistSave:function(e){p.MediaPageActions.addNewPlaylist(e),E()}})):r.createElement(U.CircleIconButton,{className:"saveto-create",type:"button",onClick:E},r.createElement(U.MaterialIcon,{type:"add"}),"Create a new playlist"))}function ke(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,i=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(a=n.next()).done)&&(i.push(a.value),!t||i.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ae(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)?Ae(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 Ae(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 Ce(e){var t,n=ke((0,D.usePopup)(),3),a=n[0],i=n[1],o=n[2],l=ke((0,r.useState)("selectPlaylist"),2),s=l[0],u=l[1];return r.createElement("div",{className:"save"},r.createElement(o,{contentRef:a},r.createElement("button",null,r.createElement(U.CircleIconButton,{type:"span"},r.createElement(U.MaterialIcon,{type:"playlist_add"})),r.createElement("span",null,"SAVE"))),r.createElement(i,{contentRef:a},r.createElement(U.NavigationContentApp,{initPage:s,pageChangeSelector:".change-page",pageIdSelectorAttr:"data-page-id",pages:(t=function(){a.current.toggle()},{selectPlaylist:r.createElement("div",{className:"popup-fullscreen"},r.createElement(U.PopupMain,null,r.createElement("span",{className:"popup-fullscreen-overlay"}),r.createElement(Me,{triggerPopupClose:t}))),createPlaylist:r.createElement("div",{className:"popup-fullscreen"},r.createElement(U.PopupMain,null,r.createElement("span",{className:"popup-fullscreen-overlay"})))}),focusFirstItemOnPageChange:!1,pageChangeCallback:u})))}function Ne(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,i=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(a=n.next()).done)&&(i.push(a.value),!t||i.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return xe(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)?xe(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 xe(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 Oe(e){var t=o.PageStore.get("config-options").embedded.video.dimensions,n=(0,r.useContext)(i.LinksContext),a=(0,r.useRef)(null),l=(0,r.useRef)(null),s=(0,r.useRef)(null),u=(0,r.useRef)(null),c=(0,r.useRef)(null),d=Ne((0,r.useState)(window.innerHeight-144+56),2),m=d[0],f=d[1],y=Ne((0,r.useState)(!1),2),h=y[0],g=y[1],v=Ne((0,r.useState)("16:9"),2),b=v[0],S=v[1],w=Ne((0,r.useState)(t.width),2),E=w[0],P=w[1],_=Ne((0,r.useState)(t.widthUnit),2),M=_[0],k=_[1],A=Ne((0,r.useState)(t.height),2),C=A[0],N=A[1],x=Ne((0,r.useState)(t.heightUnit),2),O=x[0],I=x[1],V=Ne((0,r.useState)(60),2),R=V[0],L=V[1],T=Ne((0,r.useState)(60),2),D=T[0],B=T[1],F=Ne((0,r.useState)([{key:"px",label:"px"},{key:"percent",label:"%"}]),2),q=F[0],z=F[1];function H(){f(window.innerHeight-144+56),L(s.current.offsetHeight),B(c.current.offsetHeight)}function W(){setTimeout((function(){p.PageActions.addNotification("Embed media code copied to clipboard","clipboardEmbedMediaCodeCopy")}),100)}return(0,r.useEffect)((function(){f(window.innerHeight-144+56),L(s.current.offsetHeight),B(c.current.offsetHeight)})),(0,r.useEffect)((function(){return o.PageStore.on("window_resize",H),o.MediaPageStore.on("copied_embed_media_code",W),function(){o.PageStore.removeListener("window_resize",H),o.MediaPageStore.removeListener("copied_embed_media_code",W)}}),[]),r.createElement("div",{className:"share-embed",style:{maxHeight:m+"px"}},r.createElement("div",{className:"share-embed-inner"},r.createElement("div",{className:"on-left"},r.createElement("div",{className:"media-embed-wrap"},r.createElement(j,{data:o.MediaPageStore.get("media-data"),inEmbed:!0}))),r.createElement("div",{ref:l,className:"on-right"},r.createElement("div",{ref:s,className:"on-right-top"},r.createElement("div",{className:"on-right-top-inner"},r.createElement("span",{className:"ttl"},"Embed Video"),r.createElement(U.CircleIconButton,{type:"button",onClick:function(){void 0!==e.triggerPopupClose&&e.triggerPopupClose()}},r.createElement(U.MaterialIcon,{type:"close"})))),r.createElement("div",{ref:u,className:"on-right-middle",style:{top:R+"px",bottom:D+"px"}},r.createElement("textarea",{readOnly:!0,value:'<iframe width="'+("percent"===M?E+"%":E)+'" height="'+("percent"===O?C+"%":C)+'" src="'+n.embed+o.MediaPageStore.get("media-id")+'" frameborder="0" allowfullscreen></iframe>'}),r.createElement("div",{className:"iframe-config"},r.createElement("div",{className:"iframe-config-options-title"},"Embed options"),r.createElement("div",{className:"iframe-config-option"},r.createElement("div",{className:"option-content"},r.createElement("div",{className:"ratio-options"},r.createElement("div",{className:"options-group"},r.createElement("label",{style:{minHeight:"36px"}},r.createElement("input",{type:"checkbox",checked:h,onChange:function(){var e=!h,t=b.split(":"),n=t[0],a=t[1];g(e),k(e?"px":M),I(e?"px":O),N(e?parseInt(E*a/n,10):C),z(e?[{key:"px",label:"px"}]:[{key:"px",label:"px"},{key:"percent",label:"%"}])}}),"Keep aspect ratio")),h?r.createElement("div",{className:"options-group"},r.createElement("select",{ref:a,onChange:function(){var e=a.current.value,t=e.split(":"),n=t[0],r=t[1];S(e),N(h?parseInt(E*r/n,10):C)},value:b},r.createElement("optgroup",{label:"Horizontal orientation"},r.createElement("option",{value:"16:9"},"16:9"),r.createElement("option",{value:"4:3"},"4:3"),r.createElement("option",{value:"3:2"},"3:2")),r.createElement("optgroup",{label:"Vertical orientation"},r.createElement("option",{value:"9:16"},"9:16"),r.createElement("option",{value:"3:4"},"3:4"),r.createElement("option",{value:"2:3"},"2:3")))):null),r.createElement("br",null),r.createElement("div",{className:"options-group"},r.createElement(U.NumericInputWithUnit,{valueCallback:function(e){e=""===e?0:e;var t=b.split(":"),n=t[0],a=t[1];P(e),N(h?parseInt(e*a/n,10):C)},unitCallback:function(e){k(e)},label:"Width",defaultValue:parseInt(E,10),defaultUnit:M,minValue:1,maxValue:99999,units:q})),r.createElement("div",{className:"options-group"},r.createElement(U.NumericInputWithUnit,{valueCallback:function(e){e=""===e?0:e;var t=b.split(":"),n=t[0],a=t[1];N(e),P(h?parseInt(e*n/a,10):E)},unitCallback:function(e){I(e)},label:"Height",defaultValue:parseInt(C,10),defaultUnit:O,minValue:1,maxValue:99999,units:q})))))),r.createElement("div",{ref:c,className:"on-right-bottom"},r.createElement("button",{onClick:function(){p.MediaPageActions.copyEmbedMediaCode(u.current.querySelector("textarea"))}},"COPY")))))}_e.propTypes={playlistId:u().string,isChecked:u().bool,title:u().string},_e.defaultProps={isChecked:!1,title:""},Me.propTypes={triggerPopupClose:u().func},n(8833),n(815),n(9174),Oe.propTypes={triggerPopupClose:u().func},n(5777);var Ie=n(3458);function Ve(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,i=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(a=n.next()).done)&&(i.push(a.value),!t||i.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Re(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)?Re(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 Re(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 Le(e){var t=e.onClick;return r.createElement("span",{className:"next-slide"},r.createElement(U.CircleIconButton,{buttonShadow:!0,onClick:t},r.createElement("i",{className:"material-icons"},"keyboard_arrow_right")))}function je(e){var t=e.onClick;return r.createElement("span",{className:"previous-slide"},r.createElement(U.CircleIconButton,{buttonShadow:!0,onClick:t},r.createElement("i",{className:"material-icons"},"keyboard_arrow_left")))}function Te(){return{maxFormContentHeight:window.innerHeight-196,maxPopupWidth:518>window.innerWidth-80?window.innerWidth-80:null}}function De(e){var t=(0,r.useRef)(null),n=(0,r.useRef)(null),a=o.MediaPageStore.get("media-url"),l=Ve((0,r.useState)(null),2),s=l[0],u=l[1],c=Ve((0,r.useState)({prev:!1,next:!1}),2),d=c[0],m=c[1],f=Ve((0,r.useState)(Te()),2),y=f[0],h=f[1],g=Ve((0,r.useState)(function(){var e=function(){for(var e=i.ShareOptionsContext._currentValue,t=o.MediaPageStore.get("media-url"),n=o.MediaPageStore.get("media-data").title,a={},r=0;r<e.length;){switch(e[r]){case"embed":"video"===o.MediaPageStore.get("media-data").media_type&&(a[e[r]]={});break;case"email":a[e[r]]={title:"Email",shareUrl:"mailto:?body="+t};break;case"fb":a[e[r]]={title:"Facebook",shareUrl:"https://www.facebook.com/sharer.php?u="+t};break;case"tw":a[e[r]]={title:"Twitter",shareUrl:"https://twitter.com/intent/tweet?url="+t};break;case"reddit":a[e[r]]={title:"reddit",shareUrl:"https://reddit.com/submit?url="+t+"&title="+n};break;case"tumblr":a[e[r]]={title:"Tumblr",shareUrl:"https://www.tumblr.com/widgets/share/tool?canonicalUrl="+t+"&title="+n};break;case"pinterest":a[e[r]]={title:"Pinterest",shareUrl:"http://pinterest.com/pin/create/link/?url="+t};break;case"vk":a[e[r]]={title:"ВКонтакте",shareUrl:"http://vk.com/share.php?url="+t+"&title="+n};break;case"linkedin":a[e[r]]={title:"LinkedIn",shareUrl:"https://www.linkedin.com/shareArticle?mini=true&url="+t};break;case"mix":a[e[r]]={title:"Mix",shareUrl:"https://mix.com/add?url="+t};break;case"whatsapp":a[e[r]]={title:"WhatsApp",shareUrl:"whatsapp://send?text="+t};break;case"telegram":a[e[r]]={title:"Telegram",shareUrl:"https://t.me/share/url?url="+t+"&text="+n}}r+=1}return a}(),t=[];for(var n in e)e.hasOwnProperty(n)&&("embed"===n?t.push(r.createElement("div",{key:"share-"+n,className:"sh-option share-"+n+"-opt"},r.createElement("button",{className:"sh-option change-page","data-page-id":"shareEmbed"},r.createElement("span",null,r.createElement("i",{className:"material-icons"},"code")),r.createElement("span",null,"Embed")))):"whatsapp"===n?t.push(r.createElement("div",{key:"share-"+n,className:"sh-option share-"+n},r.createElement("a",{href:e[n].shareUrl,title:"",target:"_blank","data-action":"share/whatsapp/share",rel:"noreferrer"},r.createElement("span",null),r.createElement("span",null,e[n].title)))):"email"===n?t.push(r.createElement("div",{key:"share-email",className:"sh-option share-email"},r.createElement("a",{href:e[n].shareUrl,title:""},r.createElement("span",null,r.createElement("i",{className:"material-icons"},"email")),r.createElement("span",null,e[n].title)))):t.push(r.createElement("div",{key:"share-"+n,className:"sh-option share-"+n},r.createElement("a",{href:e[n].shareUrl,title:"",target:"_blank",rel:"noreferrer"},r.createElement("span",null),r.createElement("span",null,e[n].title)))));return t}()),1)[0],v=Ve((0,r.useState)(0),2),b=v[0],S=v[1],w=Ve((0,r.useState)(0),2),E=w[0],P=w[1],_=Ve((0,r.useState)(!1),2),M=_[0],k=_[1],A=Ve((0,r.useState)(a),2),C=A[0],N=A[1];function x(){h(Te())}function O(){setTimeout((function(){p.PageActions.addNotification("Link copied to clipboard","clipboardLinkCopy")}),100)}function I(){s.scrollToCurrentSlide(),m({prev:s.hasPreviousSlide(),next:s.hasNextSlide()})}return(0,r.useEffect)((function(){u(new Ie.Z(n.current,".sh-option"))}),[g]),(0,r.useEffect)((function(){s&&(s.updateDataStateOnResize(g.length,!0,!0),I())}),[y,s]),(0,r.useEffect)((function(){o.PageStore.on("window_resize",x),o.MediaPageStore.on("copied_media_link",O);var e,t,n,a,r,i=null===(e=document.getElementsByTagName("video")[0])||void 0===e?void 0:e.currentTime;return S(i),P((r=(t=parseInt(i,10))-3600*(n=Math.floor(t/3600))-60*(a=Math.floor((t-3600*n)/60)),n<10&&(n="0"+n),a<10&&(a="0"+a),r<10&&(r="0"+r),n>=1?n+":"+a+":"+r:a+":"+r)),function(){o.PageStore.removeListener("window_resize",x),o.MediaPageStore.removeListener("copied_media_link",O),u(null)}}),[]),r.createElement("div",{ref:t,style:null!==y.maxPopupWidth?{maxWidth:y.maxPopupWidth+"px"}:null},r.createElement("div",{className:"scrollable-content",style:null!==y.maxFormContentHeight?{maxHeight:y.maxFormContentHeight+"px"}:null},r.createElement("div",{className:"share-popup-title"},"Share media"),g.length?r.createElement("div",{className:"share-options"},d.prev?r.createElement(je,{onClick:function(){s.previousSlide(),I()}}):null,r.createElement("div",{ref:n,className:"share-options-inner"},g),d.next?r.createElement(Le,{onClick:function(){s.nextSlide(),I()}}):null):null),r.createElement("div",{className:"copy-field"},r.createElement("div",null,r.createElement("input",{type:"text",readOnly:!0,value:C}),r.createElement("button",{onClick:function(){p.MediaPageActions.copyShareLink(t.current.querySelector(".copy-field input"))}},"COPY"))),r.createElement("div",{className:"start-at"},r.createElement("label",null,r.createElement("input",{type:"checkbox",name:"start-at-checkbox",id:"id-start-at-checkbox",checked:M,onChange:function(){var e;k(!M),e=M?a:a+"&t="+Math.trunc(b),N(e)}}),"Start at ",E)))}function Ue(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,i=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(a=n.next()).done)&&(i.push(a.value),!t||i.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Be(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)?Be(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 Be(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 Fe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function qe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fe(Object(n),!0).forEach((function(t){ze(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fe(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ze(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function He(){return{shareOptions:r.createElement("div",{className:"popup-fullscreen"},r.createElement(U.PopupMain,null,r.createElement("span",{className:"popup-fullscreen-overlay"}),r.createElement(De,null)))}}function We(e){var t,n=Ue((0,D.usePopup)(),3),a=n[0],i=n[1],o=n[2],l=Ue((0,r.useState)("shareOptions"),2),s=l[0],u=l[1];return r.createElement("div",{className:"share"},r.createElement(o,{contentRef:a},r.createElement("button",null,r.createElement(U.CircleIconButton,{type:"span"},r.createElement(U.MaterialIcon,{type:"share"})),r.createElement("span",null,"SHARE"))),r.createElement(i,{contentRef:a,hideCallback:function(){u("shareOptions")}},r.createElement(U.NavigationContentApp,{initPage:s,pageChangeSelector:".change-page",pageIdSelectorAttr:"data-page-id",pages:e.isVideo?(t=function(){a.current.toggle()},qe(qe({},He()),{},{shareEmbed:r.createElement("div",{className:"popup-fullscreen share-embed-popup"},r.createElement(U.PopupMain,null,r.createElement("span",{className:"popup-fullscreen-overlay"}),r.createElement(Oe,{triggerPopupClose:t})))})):He(),focusFirstItemOnPageChange:!1,pageChangeCallback:function(e){u(e)}})))}function $e(e){return r.createElement("div",{className:"download hidden-only-in-small"},r.createElement("a",{href:e.link,target:"_blank",download:e.title,title:"Download",rel:"noreferrer"},r.createElement(U.CircleIconButton,{type:"span"},r.createElement(U.MaterialIcon,{type:"arrow_downward"})),r.createElement("span",null,"DOWNLOAD")))}function Qe(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,i=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(a=n.next()).done)&&(i.push(a.value),!t||i.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ye(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)?Ye(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 Ye(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 Ze(){var e,t,n=o.MediaPageStore.get("media-data"),a=(n.title,n.encodings_info),r={};for(e in a)if(a.hasOwnProperty(e)&&Object.keys(a[e]).length)for(t in a[e])a[e].hasOwnProperty(t)&&"success"===a[e][t].status&&100===a[e][t].progress&&(r[a[e][t].title]={text:e+" - "+t.toUpperCase()+" ("+a[e][t].size+")",link:(0,m.formatInnerLink)(a[e][t].url,i.SiteContext._currentValue.url),linkAttr:{target:"_blank",download:n.title+"_"+e+"_"+t.toUpperCase()}});return r.original_media_url={text:"Original file ("+n.size+")",link:(0,m.formatInnerLink)(n.original_media_url,i.SiteContext._currentValue.url),linkAttr:{target:"_blank",download:n.title}},Object.values(r)}function Ge(e){var t=Qe((0,D.usePopup)(),3),n=t[0],a=t[1],i=t[2],o=Qe((0,r.useState)("main"),2),l=o[0];return o[1],r.createElement("div",{className:"video-downloads hidden-only-in-small"},r.createElement(i,{contentRef:n},r.createElement("button",null,r.createElement(U.CircleIconButton,{type:"span"},r.createElement(U.MaterialIcon,{type:"arrow_downward"})),r.createElement("span",null,"DOWNLOAD"))),r.createElement("div",{className:"nav-page-"+l},r.createElement(a,{contentRef:n},r.createElement(U.NavigationContentApp,{pageChangeCallback:null,initPage:"main",focusFirstItemOnPageChange:!1,pages:{main:r.createElement("div",{className:"main-options"},r.createElement(U.PopupMain,null,r.createElement(U.NavigationMenuList,{items:Ze()})))},pageChangeSelector:".change-page",pageIdSelectorAttr:"data-page-id"}))))}function Je(e){return(Je="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ke(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function Xe(e,t){return(Xe=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function et(e,t){return!t||"object"!==Je(t)&&"function"!=typeof t?tt(e):t}function tt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function nt(e){return(nt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}$e.propTypes={link:u().string.isRequired,title:u().string.isRequired};var at=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Xe(e,t)}(u,e);var t,n,a,l,s=(a=u,l=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=nt(a);if(l){var n=nt(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return et(this,e)});function u(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),(t=s.call(this,e)).state={likedMedia:o.MediaPageStore.get("user-liked-media"),dislikedMedia:o.MediaPageStore.get("user-disliked-media")},t.downloadLink="video"!==o.MediaPageStore.get("media-type")?(0,m.formatInnerLink)(o.MediaPageStore.get("media-original-url"),i.SiteContext._currentValue.url):null,t.updateStateValues=t.updateStateValues.bind(tt(t)),t}return t=u,(n=[{key:"componentDidMount",value:function(){o.MediaPageStore.on("liked_media",this.updateStateValues),o.MediaPageStore.on("unliked_media",this.updateStateValues),o.MediaPageStore.on("disliked_media",this.updateStateValues),o.MediaPageStore.on("undisliked_media",this.updateStateValues);var e=document.querySelectorAll("[data-tooltip]");e.length&&e.forEach((function(e){return function(e){var t=document.body,n=document.createElement("span");function a(){var t=e.getBoundingClientRect();n.style.top=t.top-(0+n.offsetHeight)+"px",n.style.left=t.left+"px"}n.innerText=e.getAttribute("data-tooltip"),n.setAttribute("class","tooltip"),e.removeAttribute("data-tooltip"),e.addEventListener("mouseenter",(function(){var r=e.getBoundingClientRect();t.appendChild(n),n.style.top=r.top-(0+n.offsetHeight)+"px",n.style.left=r.left+"px",document.addEventListener("scroll",a)})),e.addEventListener("mouseleave",(function(){t.removeChild(n),n.style.top="",n.style.left="",document.removeEventListener("scroll",a)}))}(e)}))}},{key:"updateStateValues",value:function(){this.setState({likedMedia:o.MediaPageStore.get("user-liked-media"),dislikedMedia:o.MediaPageStore.get("user-disliked-media")})}},{key:"mediaCategories",value:function(e){if(void 0===this.props.categories||null===this.props.categories||!this.props.categories.length)return null;for(var t=0,n=[];t<this.props.categories.length;)n.push(r.createElement("span",{key:t},r.createElement("a",{href:(0,m.formatInnerLink)(this.props.categories[t].url,i.SiteContext._currentValue.url),title:this.props.categories[t].title},this.props.categories[t].title))),t+=1;return r.createElement("div",{className:"media-under-title-categories"+(e?" over-title":"")},n)}},{key:"render",value:function(){var e=o.PageStore.get("config-options").pages.media.displayViews&&void 0!==this.props.views,t=o.MediaPageStore.get("media-data").state,n="";switch(t){case"private":n="The site admins have to make its access public";break;case"unlisted":n="The site admins have to make it appear on listings"}return r.createElement("div",{className:"media-title-banner"},e&&o.PageStore.get("config-options").pages.media.categoriesWithTitle?this.mediaCategories(!0):null,void 0!==this.props.title?r.createElement("h1",null,this.props.title):null,"public"!==t?r.createElement("div",{className:"media-labels-area"},r.createElement("div",{className:"media-labels-area-inner"},r.createElement("span",{className:"media-label-state"},r.createElement("span",null,t)),r.createElement("span",{className:"helper-icon","data-tooltip":n},r.createElement("i",{className:"material-icons"},"help_outline")))):null,r.createElement("div",{className:"media-views-actions"+(this.state.likedMedia?" liked-media":"")+(this.state.dislikedMedia?" disliked-media":"")},!e&&o.PageStore.get("config-options").pages.media.categoriesWithTitle?this.mediaCategories():null,e?r.createElement("div",{className:"media-views"},(0,m.formatViewsNumber)(this.props.views,!0)," ",1>=this.props.views?"view":"views"):null,r.createElement("div",{className:"media-actions"},r.createElement("div",null,i.MemberContext._currentValue.can.likeMedia?r.createElement(me,null):null,i.MemberContext._currentValue.can.dislikeMedia?r.createElement(ue,null):null,i.MemberContext._currentValue.can.shareMedia?r.createElement(We,{isVideo:!1}):null,!i.MemberContext._currentValue.is.anonymous&&i.MemberContext._currentValue.can.saveMedia&&-1<i.PlaylistsContext._currentValue.mediaTypes.indexOf(o.MediaPageStore.get("media-type"))?r.createElement(Ce,null):null,this.props.allowDownload&&i.MemberContext._currentValue.can.downloadMedia?this.downloadLink?r.createElement($e,{link:this.downloadLink,title:this.props.title}):r.createElement(Ge,null):null,r.createElement(Se,{allowDownload:this.props.allowDownload})))))}}])&&Ke(t.prototype,n),u}(r.PureComponent);function rt(e){return(rt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function it(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ot(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function lt(e,t){return(lt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function st(e,t){return!t||"object"!==rt(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function ut(e){return(ut=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}at.propTypes={allowDownload:u().bool.isRequired},at.defaultProps={allowDownload:!1};var ct=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&<(e,t)}(u,e);var t,n,a,l,s=(a=u,l=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=ut(a);if(l){var n=ut(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return st(this,e)});function u(){return it(this,u),s.apply(this,arguments)}return t=u,(n=[{key:"render",value:function(){var e=o.PageStore.get("config-options").pages.media.displayViews&&void 0!==this.props.views,t=o.MediaPageStore.get("media-data").state,n="";switch(t){case"private":n="The site admins have to make its access public";break;case"unlisted":n="The site admins have to make it appear on listings"}return r.createElement("div",{className:"media-title-banner"},e&&o.PageStore.get("config-options").pages.media.categoriesWithTitle?this.mediaCategories(!0):null,void 0!==this.props.title?r.createElement("h1",null,this.props.title):null,"public"!==t?r.createElement("div",{className:"media-labels-area"},r.createElement("div",{className:"media-labels-area-inner"},r.createElement("span",{className:"media-label-state"},r.createElement("span",null,t)),r.createElement("span",{className:"helper-icon","data-tooltip":n},r.createElement("i",{className:"material-icons"},"help_outline")))):null,r.createElement("div",{className:"media-views-actions"+(this.state.likedMedia?" liked-media":"")+(this.state.dislikedMedia?" disliked-media":"")},!e&&o.PageStore.get("config-options").pages.media.categoriesWithTitle?this.mediaCategories():null,e?r.createElement("div",{className:"media-views"},(0,m.formatViewsNumber)(this.props.views,!0)," ",1>=this.props.views?"view":"views"):null,r.createElement("div",{className:"media-actions"},r.createElement("div",null,i.MemberContext._currentValue.can.likeMedia?r.createElement(me,null):null,i.MemberContext._currentValue.can.dislikeMedia?r.createElement(ue,null):null,i.MemberContext._currentValue.can.shareMedia?r.createElement(We,{isVideo:!0}):null,!i.MemberContext._currentValue.is.anonymous&&i.MemberContext._currentValue.can.saveMedia&&-1<i.PlaylistsContext._currentValue.mediaTypes.indexOf(o.MediaPageStore.get("media-type"))?r.createElement(Ce,null):null,this.props.allowDownload&&i.MemberContext._currentValue.can.downloadMedia?this.downloadLink?r.createElement($e,{link:this.downloadLink,title:this.props.title}):r.createElement(Ge,null):null,r.createElement(Se,{allowDownload:this.props.allowDownload})))))}}])&&ot(t.prototype,n),u}(at);function dt(e){return(dt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function mt(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function pt(e,t){return(pt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ft(e,t){return!t||"object"!==dt(t)&&"function"!=typeof t?yt(e):t}function yt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ht(e){return(ht=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function gt(e){return(gt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function vt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function bt(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function St(e,t){return(St=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function wt(e,t){return!t||"object"!==gt(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Et(e){return(Et=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Pt=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&St(e,t)}(s,e);var t,n,a,i,l=(a=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=Et(a);if(i){var n=Et(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return wt(this,e)});function s(){return vt(this,s),l.apply(this,arguments)}return t=s,(n=[{key:"render",value:function(){var e,t,n,a,i,l,s=!1;return this.state.videoLoaded&&(s=void 0===(s=o.MediaPageStore.get("media-data").allow_download)||!!s,e=o.MediaPageStore.get("media-data").views,t=o.MediaPageStore.get("media-data").categories_info,n=o.MediaPageStore.get("media-data").title,a={name:o.MediaPageStore.get("media-data").author_name,url:o.MediaPageStore.get("media-data").author_profile,thumb:o.MediaPageStore.get("media-author-thumbnail-url")},i=o.MediaPageStore.get("media-data").add_date,l=o.MediaPageStore.get("media-data").description),this.state.videoLoaded?r.createElement("div",{className:"viewer-info"},r.createElement("div",{className:"viewer-info-inner"},r.createElement(ct,{title:n,views:e,categories:t,allowDownload:s}),r.createElement(oe,{author:a,published:i,description:l}))):null}}])&&bt(t.prototype,n),s}(function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&pt(e,t)}(s,e);var t,n,a,i,l=(a=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=ht(a);if(i){var n=ht(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return ft(this,e)});function s(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),(t=l.call(this,e)).state={videoLoaded:!1},t.onVideoLoad=t.onVideoLoad.bind(yt(t)),o.MediaPageStore.on("loaded_media_data",t.onVideoLoad),t}return t=s,(n=[{key:"onVideoLoad",value:function(){this.setState({videoLoaded:!0})}},{key:"render",value:function(){var e,t,n,a,i,l,s=!1;return this.state.videoLoaded&&(s=void 0===(s=o.MediaPageStore.get("media-data").allow_download)||!!s,e=o.MediaPageStore.get("media-data").views,t=o.MediaPageStore.get("media-data").categories_info,n=o.MediaPageStore.get("media-data").title,a={name:o.MediaPageStore.get("media-data").author_name,url:o.MediaPageStore.get("media-data").author_profile,thumb:o.MediaPageStore.get("media-author-thumbnail-url")},i=o.MediaPageStore.get("media-data").add_date,l=o.MediaPageStore.get("media-data").description),this.state.videoLoaded?r.createElement("div",{className:"viewer-info"},r.createElement("div",{className:"viewer-info-inner"},r.createElement(at,{title:n,views:e,categories:t,allowDownload:s}),r.createElement(oe,{author:a,published:i,description:l}))):null}}])&&mt(t.prototype,n),s}(r.PureComponent));function _t(e){return(_t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Mt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function kt(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function At(e,t){return(At=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ct(e,t){return!t||"object"!==_t(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Nt(e){return(Nt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var xt=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&At(e,t)}(s,e);var t,n,a,i,l=(a=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=Nt(a);if(i){var n=Nt(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return Ct(this,e)});function s(){return Mt(this,s),l.apply(this,arguments)}return t=s,(n=[{key:"render",value:function(){return r.createElement("div",{className:"viewer-container",key:"viewer-container-error"},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"},o.MediaPageStore.get("media-load-error-message")))))))}}])&&kt(t.prototype,n),s}(r.PureComponent),Ot=n(7777);function It(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,i=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(a=n.next()).done)&&(i.push(a.value),!t||i.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Vt(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)?Vt(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 Vt(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 Rt(){var e=o.MediaPageStore.get("media-data");return e&&e.related_media&&e.related_media.length?e.related_media[0]:null}function Lt(e){var t=It((0,r.useState)(Rt()),2),n=t[0],a=t[1],i=It((0,r.useState)(o.PageStore.get("media-auto-play")),2),l=i[0],s=i[1];function u(){s(o.PageStore.get("media-auto-play"))}function c(){a(Rt())}return(0,r.useEffect)((function(){return o.MediaPageStore.on("loaded_media_data",c),o.PageStore.on("switched_media_auto_play",u),function(){o.MediaPageStore.removeListener("loaded_media_data",c),o.PageStore.removeListener("switched_media_auto_play",u)}}),[]),n?r.createElement("div",{className:"auto-play"},r.createElement("div",{className:"auto-play-header"},r.createElement("div",{className:"next-label"},"Up next"),r.createElement("div",{className:"auto-play-option"},r.createElement("label",{className:"checkbox-label right-selectbox",tabIndex:0,onKeyPress:function(e){0===e.keyCode&&p.PageActions.toggleMediaAutoPlay()}},"AUTOPLAY",r.createElement("span",{className:"checkbox-switcher-wrap"},r.createElement("span",{className:"checkbox-switcher"},r.createElement("input",{type:"checkbox",tabIndex:-1,checked:l,onChange:p.PageActions.toggleMediaAutoPlay})))))),r.createElement(Ot.s,{className:"items-list-hor",items:[n],pageItems:1,maxItems:1,singleLinkContent:!0,horizontalItemsOrientation:!0,hideDate:!0,hideViews:!o.PageStore.get("config-media-item").displayViews,hideAuthor:!o.PageStore.get("config-media-item").displayAuthor})):null}function jt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,i=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(a=n.next()).done)&&(i.push(a.value),!t||i.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Tt(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)?Tt(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 Tt(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 Dt(e){var t=jt((0,r.useState)(c()),2),n=t[0],a=t[1],i=jt((0,r.useState)(null),2),l=i[0],s=i[1];function u(){s(o.MediaPageStore.get("media-type")),a(c())}function c(){var e=o.MediaPageStore.get("media-data");return null!=e&&void 0!==e.related_media&&e.related_media.length?e.related_media:null}return(0,r.useEffect)((function(){return o.MediaPageStore.on("loaded_media_data",u),function(){return o.MediaPageStore.removeListener("loaded_media_data",u)}}),[]),n&&n.length?r.createElement(Ot.s,{className:"items-list-hor",items:!e.hideFirst||"video"!==l&&"audio"!==l?n:n.slice(1),pageItems:o.PageStore.get("config-options").pages.media.related.initialSize,singleLinkContent:!0,horizontalItemsOrientation:!0,hideDate:!0,hideViews:!o.PageStore.get("config-media-item").displayViews,hideAuthor:!o.PageStore.get("config-media-item").displayAuthor}):null}function Ut(e){return r.createElement(Ot.s,{className:"items-list-hor",pageItems:9999,maxItems:9999,items:e.items,hideDate:!0,hideViews:!0,hidePlaylistOrderNumber:!1,horizontalItemsOrientation:!0,inPlaylistView:!0,singleLinkContent:!0,playlistActiveItem:e.playlistActiveItem})}function Bt(e){return(Bt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ft(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function qt(e,t){return(qt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function zt(e,t){return!t||"object"!==Bt(t)&&"function"!=typeof t?Ht(e):t}function Ht(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Wt(e){return(Wt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}Dt.propTypes={hideFirst:u().bool},Dt.defaultProps={hideFirst:!0},Ut.propTypes={items:u().array.isRequired,playlistActiveItem:m.PositiveIntegerOrZero},Ut.defaultProps={playlistActiveItem:1};var $t=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&qt(e,t)}(u,e);var t,n,a,l,s=(a=u,l=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=Wt(a);if(l){var n=Wt(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return zt(this,e)});function u(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),(t=s.call(this,e)).state={expanded:!0,loopRepeat:o.PlaylistViewStore.get("enabled-loop"),shuffle:o.PlaylistViewStore.get("enabled-shuffle"),savedPlaylist:o.PlaylistViewStore.get("saved-playlist-loop"),title:e.playlistData.title,link:e.playlistData.url,authorName:e.playlistData.user,authorLink:i.LinksContext._currentValue.home+"/user/"+e.playlistData.user,activeItem:e.activeItem,totalMedia:e.playlistData.media_count,items:e.playlistData.playlist_media},t.onHeaderClick=t.onHeaderClick.bind(Ht(t)),t.onLoopClick=t.onLoopClick.bind(Ht(t)),t.onShuffleClick=t.onShuffleClick.bind(Ht(t)),t.onSaveClick=t.onSaveClick.bind(Ht(t)),t.onLoopRepeatUpdate=t.onLoopRepeatUpdate.bind(Ht(t)),t.onShuffleUpdate=t.onShuffleUpdate.bind(Ht(t)),t.onPlaylistSaveUpdate=t.onPlaylistSaveUpdate.bind(Ht(t)),o.PlaylistViewStore.on("loop-repeat-updated",t.onLoopRepeatUpdate),o.PlaylistViewStore.on("shuffle-updated",t.onShuffleUpdate),o.PlaylistViewStore.on("saved-updated",t.onPlaylistSaveUpdate),t}return t=u,(n=[{key:"onHeaderClick",value:function(e){this.setState({expanded:!this.state.expanded})}},{key:"onLoopClick",value:function(){p.PlaylistViewActions.toggleLoop()}},{key:"onShuffleClick",value:function(){p.PlaylistViewActions.toggleShuffle()}},{key:"onSaveClick",value:function(){p.PlaylistViewActions.toggleSave()}},{key:"onShuffleUpdate",value:function(){var e=this;this.setState({shuffle:o.PlaylistViewStore.get("enabled-shuffle")},(function(){e.state.shuffle?p.PageActions.addNotification("Playlist shuffle is on","shuffle-on"):p.PageActions.addNotification("Playlist shuffle is off","shuffle-off")}))}},{key:"onLoopRepeatUpdate",value:function(){var e=this;this.setState({loopRepeat:o.PlaylistViewStore.get("enabled-loop")},(function(){e.state.loopRepeat?p.PageActions.addNotification("Playlist loop is on","loop-on"):p.PageActions.addNotification("Playlist loop is off","loop-off")}))}},{key:"onPlaylistSaveUpdate",value:function(){var e=this;this.setState({savedPlaylist:o.PlaylistViewStore.get("saved-playlist")},(function(){e.state.savedPlaylist?p.PageActions.addNotification("Added to playlists library","added-to-playlists-lib"):p.PageActions.addNotification("Removed from playlists library","removed-from-playlists-lib")}))}},{key:"render",value:function(){return r.createElement("div",{className:"playlist-view-wrap"},r.createElement("div",{className:"playlist-view"+(this.state.expanded?" playlist-expanded-view":"")},r.createElement("div",{className:"playlist-header"},r.createElement("div",{className:"playlist-title"},r.createElement("a",{href:this.state.link,title:this.state.title},this.state.title)),r.createElement("div",{className:"playlist-meta"},r.createElement("span",null,r.createElement("a",{href:this.state.authorLink,title:this.state.authorName},this.state.authorName))," - ",r.createElement("span",{className:"counter"},this.state.activeItem," / ",this.state.totalMedia)),r.createElement(U.CircleIconButton,{className:"toggle-playlist-view",onClick:this.onHeaderClick},this.state.expanded?r.createElement("i",{className:"material-icons"},"keyboard_arrow_up"):r.createElement("i",{className:"material-icons"},"keyboard_arrow_down"))),this.state.expanded?r.createElement("div",{className:"playlist-actions"},r.createElement(U.CircleIconButton,{className:this.state.loopRepeat?"active":"",onClick:this.onLoopClick,title:"Loop playlist"},r.createElement("i",{className:"material-icons"},"repeat"))):null,this.state.expanded&&this.state.items.length?r.createElement("div",{className:"playlist-media"},r.createElement(Ut,{items:this.state.items,playlistActiveItem:this.state.activeItem})):null))}}])&&Ft(t.prototype,n),u}(r.PureComponent);function Qt(e){return(Qt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Yt(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function Zt(e,t){return(Zt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Gt(e,t){return!t||"object"!==Qt(t)&&"function"!=typeof t?Jt(e):t}function Jt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Kt(e){return(Kt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}$t.propTypes={playlistData:u().object.isRequired,activeItem:m.PositiveIntegerOrZero},$t.defaultProps={};var Xt=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Zt(e,t)}(s,e);var t,n,a,i,l=(a=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=Kt(a);if(i){var n=Kt(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return Gt(this,e)});function s(e){var t;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),(t=l.call(this,e)).state={playlistData:e.playlistData,isPlaylistPage:!!e.playlistData,activeItem:0,mediaType:o.MediaPageStore.get("media-type")},e.playlistData)for(var n=0;n<e.playlistData.playlist_media.length;){if(e.mediaId===e.playlistData.playlist_media[n].friendly_token){t.state.activeItem=n+1;break}n+=1}return t.onMediaLoad=t.onMediaLoad.bind(Jt(t)),t}return t=s,(n=[{key:"componentDidMount",value:function(){o.MediaPageStore.on("loaded_media_data",this.onMediaLoad)}},{key:"onMediaLoad",value:function(){this.setState({mediaType:o.MediaPageStore.get("media-type")})}},{key:"render",value:function(){return r.createElement("div",{className:"viewer-sidebar"},this.state.isPlaylistPage?r.createElement($t,{activeItem:this.state.activeItem,playlistData:this.props.playlistData}):"video"===this.state.mediaType||"audio"===this.state.mediaType?r.createElement(Lt,null):null,r.createElement(Dt,{hideFirst:!this.state.isPlaylistPage}))}}])&&Yt(t.prototype,n),s}(r.PureComponent);function en(e){return(en="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function tn(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function nn(e,t){return(nn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function an(e,t){return!t||"object"!==en(t)&&"function"!=typeof t?rn(e):t}function rn(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function on(e){return(on=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var ln=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&nn(e,t)}(s,e);var t,n,a,i,l=(a=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=on(a);if(i){var n=on(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return an(this,e)});function s(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),(t=l.call(this,e,"media")).state={wideLayout:1216<=window.innerWidth,mediaLoaded:!1,mediaLoadFailed:!1,isVideoMedia:!1,theaterMode:!1,pagePlaylistLoaded:!1,pagePlaylistData:o.MediaPageStore.get("playlist-data")},t.onWindowResize=t.onWindowResize.bind(rn(t)),t.onMediaLoad=t.onMediaLoad.bind(rn(t)),t.onMediaLoadError=t.onMediaLoadError.bind(rn(t)),t.onPagePlaylistLoad=t.onPagePlaylistLoad.bind(rn(t)),o.MediaPageStore.on("loaded_media_data",t.onMediaLoad),o.MediaPageStore.on("loaded_media_error",t.onMediaLoadError),o.MediaPageStore.on("loaded_page_playlist_data",t.onPagePlaylistLoad),t}return t=s,(n=[{key:"componentDidMount",value:function(){p.MediaPageActions.loadMediaData(),o.PageStore.on("window_resize",this.onWindowResize)}},{key:"onWindowResize",value:function(){this.setState({wideLayout:1216<=window.innerWidth})}},{key:"onPagePlaylistLoad",value:function(){this.setState({pagePlaylistLoaded:!0,pagePlaylistData:o.MediaPageStore.get("playlist-data")})}},{key:"onMediaLoad",value:function(){var e="video"===o.MediaPageStore.get("media-type");e?(this.onViewerModeChange=this.onViewerModeChange.bind(this),o.VideoViewerStore.on("changed_viewer_mode",this.onViewerModeChange),this.setState({mediaLoaded:!0,isVideoMedia:e,theaterMode:o.VideoViewerStore.get("in-theater-mode")})):this.setState({mediaLoaded:!0,isVideoMedia:e})}},{key:"onViewerModeChange",value:function(){this.setState({theaterMode:o.VideoViewerStore.get("in-theater-mode")})}},{key:"onMediaLoadError",value:function(e){this.setState({mediaLoadFailed:!0})}},{key:"pageContent",value:function(){var e="cf viewer-section"+(this.state.theaterMode?" theater-mode":" viewer-wide"),t="viewer-section-nested"+(this.state.theaterMode?" viewer-section":"");return this.state.mediaLoadFailed?r.createElement("div",{className:e},r.createElement(xt,null)):r.createElement("div",{className:e},[r.createElement("div",{className:"viewer-container",key:"viewer-container"},this.state.mediaLoaded&&this.state.pagePlaylistLoaded?this.viewerContainerContent(o.MediaPageStore.get("media-data")):null),r.createElement("div",{key:"viewer-section-nested",className:t},!this.state.wideLayout||this.state.isVideoMedia&&this.state.theaterMode?[r.createElement(Pt,{key:"viewer-info"}),this.state.pagePlaylistLoaded?r.createElement(Xt,{key:"viewer-sidebar",mediaId:o.MediaPageStore.get("media-id"),playlistData:o.MediaPageStore.get("playlist-data")}):null]:[this.state.pagePlaylistLoaded?r.createElement(Xt,{key:"viewer-sidebar",mediaId:o.MediaPageStore.get("media-id"),playlistData:o.MediaPageStore.get("playlist-data")}):null,r.createElement(Pt,{key:"viewer-info"})])])}}])&&tn(t.prototype,n),s}(n(8204).T);function sn(e){return(sn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function un(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function cn(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function dn(e,t){return(dn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function mn(e,t){return!t||"object"!==sn(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function pn(e){return(pn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}if(window.MediaCMS.site.devEnv){var fn=function(){var e=null,t=null,n=window.location.search.split("?")[1];return n&&n.split("&").forEach((function(n){0===n.indexOf("m=")?e=n.split("m=")[1]:0===n.indexOf("pl=")&&(t=n.split("pl=")[1])})),{mediaId:e,playlistId:t}}(),yn=fn.mediaId,hn=fn.playlistId;yn&&(window.MediaCMS.mediaId=yn),hn&&(window.MediaCMS.playlistId=hn)}var gn=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&dn(e,t)}(c,e);var t,n,a,s,u=(a=c,s=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=pn(a);if(s){var n=pn(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return mn(this,e)});function c(){return un(this,c),u.apply(this,arguments)}return t=c,(n=[{key:"viewerContainerContent",value:function(e){switch(o.MediaPageStore.get("media-type")){case"video":return r.createElement(i.SiteConsumer,null,(function(t){return r.createElement(j,{data:e,siteUrl:t.url,inEmbed:!1})}));case"audio":return r.createElement(P,null);case"image":return r.createElement(M,null);case"pdf":return r.createElement(k,null)}return r.createElement(l,null)}}])&&cn(t.prototype,n),c}(ln);(0,a.X)("page-media",gn)},4234:function(e,t,n){"use strict";n.d(t,{CircleIconButton:function(){return a.M},MaterialIcon:function(){return r.O},NavigationContentApp:function(){return i.o},NavigationMenuList:function(){return o.S},Notifications:function(){return l.T},NumericInputWithUnit:function(){return s.O},PopupMain:function(){return u.W8},PopupTop:function(){return u.HF},SpinnerLoader:function(){return c.i},UserThumbnail:function(){return d.q}});var a=n(7714),r=(n(7446),n(2915),n(2299)),i=n(2917),o=n(5671),l=n(2436),s=n(5517),u=n(940),c=n(6309),d=n(6142)},2436:function(e,t,n){"use strict";n.d(t,{T:function(){return d}}),n(2070),n(1646),n(2004),n(8407),n(6394),n(8288),n(5677),n(2129),n(4655),n(288),n(4458),n(3675);var a=n(5466),r=n(7959);function i(e){return function(e){if(Array.isArray(e))return s(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||l(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,i=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(a=n.next()).done)&&(i.push(a.value),!t||i.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return i}}(e,t)||l(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 l(e,t){if(e){if("string"==typeof e)return s(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)?s(e,t):void 0}}function s(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}var u=[];function c(e){var t=o((0,a.useState)(!1),2),n=t[0],r=t[1],i=o((0,a.useState)(!0),2),l=i[0],s=i[1],u=null,c=null;return(0,a.useEffect)((function(){return u=setTimeout((function(){c=setTimeout((function(){s(!1),c=null}),1e3),u=null,r(!0),e.onHide(e.id)}),5e3),function(){u&&clearTimeout(u),c&&clearTimeout(c)}}),[]),l?a.createElement("div",{className:"notification-item"+(n?" hidden":"")},a.createElement("div",null,e.children||null)):null}function d(){var e,t,n,l=o((0,a.useState)(u.length),2),s=l[0],d=l[1];function m(){d(r.default.get("notifications-size")+u.length)}function p(e){var t=[];u.map((function(n){n[0]!==e&&t.push(n)})),u=t}return(0,a.useEffect)((function(){return m(),r.default.on("added_notification",m),function(){return r.default.removeListener("added_notification",m)}}),[]),s?a.createElement("div",{className:"notifications"},a.createElement("div",null,(e=r.default.get("notifications"),t=u.map((function(e){return a.createElement(c,{key:e[0],id:e[0],onHide:p},e[1])})),n=e.map((function(e){return u.push(e),a.createElement(c,{key:e[0],id:e[0],onHide:p},e[1])})),[].concat(i(t),i(n))))," "):null}},5517:function(e,t,n){"use strict";n.d(t,{O:function(){return s}}),n(2004),n(8407),n(6394),n(8288),n(5677),n(2129),n(4655),n(288),n(4458),n(3675);var a=n(5466),r=n(3074),i=n.n(r);function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,i=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(a=n.next()).done)&&(i.push(a.value),!t||i.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return l(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)?l(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 l(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 s(e){var t=(0,a.useRef)(null),n=(0,a.useRef)(null),r=o((0,a.useState)(null),2),i=r[0],l=r[1],s=o((0,a.useState)(null),2),u=s[0],c=s[1];return(0,a.useEffect)((function(){l(function(e,t,n){if(void 0!==e){var a;return a=void 0!==t&&t>e?t:e,void 0!==n&&n<a?n:a}return void 0!==t?t:void 0!==n?n:void 0}(0+e.defaultValue,e.minValue,e.maxValue)),c(function(e,t){if(!t||!t.length)return null;for(var n=0;n<t.length;){if(void 0!==t[n].key&&e===t[n].key)return t[n].key;n+=1}return t[0].key}(e.defaultUnit,e.units))})),a.createElement("div",{className:"num-value-unit"},void 0!==e.label?a.createElement("span",{className:"label"},e.label):null,a.createElement("input",{ref:t,className:"value-input",type:"number",value:null!==i?i:"",min:void 0!==e.minValue?e.minValue:null,max:void 0!==e.maxValue?e.maxValue:null,onChange:function(){l(t.current.value),void 0!==e.valueCallback&&e.valueCallback(t.current.value)}}),a.createElement("select",{ref:n,className:"value-unit",onChange:function(){c(n.current.value),void 0!==e.unitCallback&&e.unitCallback(n.current.value)},value:null!==u?u:""},function(){if(!e.units.length)return null;for(var t=[],n=0;n<e.units.length;)void 0!==e.units[n].key&&t.push(a.createElement("option",{key:e.units[n].key,value:e.units[n].key},void 0!==e.units[n].label?e.units[n].label:e.units[n].key)),n+=1;return t}()))}s.propTypes={label:i().string,units:i().array.isRequired,defaultUnit:i().string,defaultValue:i().number,minValue:i().number,maxValue:i().number,valueCallback:i().func,unitCallback:i().func}},6309:function(e,t,n){"use strict";n.d(t,{i:function(){return o}});var a=n(5466),r=n(3074),i=n.n(r);function o(e){var t="spinner-loader";switch(e.size){case"tiny":case"x-small":case"small":case"large":case"x-large":t+=" "+e.size}return a.createElement("div",{className:t},a.createElement("svg",{className:"circular",viewBox:"25 25 50 50"},a.createElement("circle",{className:"path",cx:"50",cy:"50",r:"20",fill:"none",strokeWidth:"1.5",strokeMiterlimit:"10"})))}o.propTypes={size:i().oneOf(["tiny","x-small","small","medium","large","x-large"])},o.defaultProps={size:"medium"}},6142:function(e,t,n){"use strict";n.d(t,{q:function(){return u}});var a=n(5466),r=n(3074),i=n.n(r),o=n(9747),l=n(7714),s=n(2299);function u(e){var t=(0,o.useUser)().thumbnail,n={"aria-label":"Account profile photo that opens list of options and settings pages links",className:"thumbnail"};switch(e.isButton?void 0!==e.onClick&&(n.onClick=e.onClick):n.type="span",e.size){case"small":case"large":n.className+=" "+e.size+"-thumb"}return a.createElement(l.M,n,t?a.createElement("img",{src:t,alt:""}):a.createElement(s.O,{type:"person"}))}u.propTypes={isButton:i().bool,size:i().oneOf(["small","medium","large"]),onClick:i().func},u.defaultProps={isButton:!1,size:"medium"}},6191:function(e,t,n){"use strict";n.d(t,{PageHeader:function(){return a.m},PageMain:function(){return r.r},PageSidebar:function(){return i.$}});var a=n(6006),r=n(9198),i=n(2947);n(1542)},8727:function(e,t,n){"use strict";n.d(t,{hJ:function(){return c},Y7:function(){return d}}),n(2322),n(3296),n(6394),n(4669),n(717),n(5677),n(2129),n(4655),n(6453),n(9006);var a=n(5466),r=n(3074),i=n.n(r),o=n(137),l=n.n(o),s=n(8009),u=n.n(s);function c(e){return 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)))}function d(e){var t=(0,a.useRef)(null),n=null,r={playerVolume:e.playerVolume,playerSoundMuted:e.playerSoundMuted,videoQuality:e.videoQuality,videoPlaybackSpeed:e.videoPlaybackSpeed,inTheaterMode:e.inTheaterMode};function i(){void 0!==e.onClickNextCallback&&e.onClickNextCallback()}function o(){void 0!==e.onClickPreviousCallback&&e.onClickPreviousCallback()}function s(t){r.playerVolume!==t.volume&&(r.playerVolume=t.volume),r.playerSoundMuted!==t.soundMuted&&(r.playerSoundMuted=t.soundMuted),r.videoQuality!==t.quality&&(r.videoQuality=t.quality),r.videoPlaybackSpeed!==t.playbackSpeed&&(r.videoPlaybackSpeed=t.playbackSpeed),r.inTheaterMode!==t.theaterMode&&(r.inTheaterMode=t.theaterMode),void 0!==e.onStateUpdateCallback&&e.onStateUpdateCallback(t)}function c(){if(null===n&&null===e.errorMessage&&(e.inEmbed||(window.removeEventListener("focus",c),document.removeEventListener("visibilitychange",c)),t.current)){e.inEmbed||t.current.focus();var a,d,m,p={on:!1};if(void 0!==e.subtitlesInfo&&null!==e.subtitlesInfo&&e.subtitlesInfo.length){p.languages=[];for(var f=0;f<e.subtitlesInfo.length;)void 0!==e.subtitlesInfo[f].src&&void 0!==e.subtitlesInfo[f].srclang&&void 0!==e.subtitlesInfo[f].label&&p.languages.push({src:(a=e.subtitlesInfo[f].src,d=e.siteUrl,m=void 0,m=l()(a,{}),""!==m.origin&&"null"!==m.origin&&m.origin||(m=l()(d+"/"+a.replace(/^\//g,""),{})),m.toString()),srclang:e.subtitlesInfo[f].srclang,label:e.subtitlesInfo[f].label}),f+=1;p.languages.length&&(p.on=!0)}n=new(u())(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:p,cornerLayers:e.cornerLayers,videoPreviewThumb:e.previewSprite},{volume:r.playerVolume,soundMuted:r.playerSoundMuted,theaterMode:r.inTheaterMode,theSelectedQuality:void 0,theSelectedPlaybackSpeed:r.videoPlaybackSpeed||1},e.info,[.25,.5,.75,1,1.25,1.5,1.75,2],s,i,o),void 0!==e.onPlayerInitCallback&&e.onPlayerInitCallback(n,t.current)}}return r.playerVolume=null===r.playerVolume?1:Math.max(Math.min(Number(r.playerVolume),1),0),r.playerSoundMuted=null!==r.playerSoundMuted&&r.playerSoundMuted,r.videoQuality=null!==r.videoQuality?r.videoQuality:"Auto",r.videoPlaybackSpeed=null!==r.videoPlaybackSpeed&&r.videoPlaybackSpeed,r.inTheaterMode=null!==r.inTheaterMode&&r.inTheaterMode,(0,a.useEffect)((function(){return e.inEmbed||document.hasFocus()||"visible"===document.visibilityState?c():(window.addEventListener("focus",c),document.addEventListener("visibilitychange",c)),n.player.one("loadedmetadata",(function(){var e=new URLSearchParams(window.location.search),t=Number(e.get("t")),a=isNaN(t)?0:t;n.player.currentTime(a)})),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)))}c.propTypes={errorMessage:i().string.isRequired},d.propTypes={playerVolume:i().string,playerSoundMuted:i().bool,videoQuality:i().string,videoPlaybackSpeed:i().number,inTheaterMode:i().bool,siteId:i().string.isRequired,siteUrl:i().string.isRequired,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:{}}},160:function(e,t,n){"use strict";n.d(t,{R:function(){return h}}),n(2322),n(9268),n(9751),n(2004),n(8407),n(6394),n(8288),n(5677),n(2129),n(4655),n(288),n(4458),n(3675);var a=n(5466),r=n(3074),i=n.n(r),o=n(137),l=n.n(o),s=n(3613),u=n(473),c=n(9722),d=n(9905),m=n(8727),p=n(1283);function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,i=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(a=n.next()).done)&&(i.push(a.value),!t||i.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return y(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)?y(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 y(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 h(e){var t=(0,a.useContext)(s.ApiUrlContext),n=(0,a.useContext)(s.SiteContext),r=f((0,a.useState)(null),2),i=(r[0],r[1]),o=f((0,a.useState)(null),2),y=o[0],h=o[1],g=f((0,a.useState)(null),2),v=g[0],b=g[1],S=f((0,a.useState)([]),2),w=S[0],E=S[1],P=f((0,a.useState)({}),2),_=P[0],M=P[1],k=f((0,a.useState)([]),2),A=k[0],C=k[1],N=f((0,a.useState)({}),2),x=N[0],O=N[1],I={videoQuality:new c.BrowserCache(n.id,86400).get("video-quality")};I.videoQuality=null!==I.videoQuality?I.videoQuality:"Auto";var V,R=null,L=null,j=null,T=((V=new(l())(e.pageLink).query)?((V=V.substring(1)).split("&"),V=V.length?V.split("="):[]):V=[],V);if(T.length)for(var D=0;D<T.length;)"m"===T[D]&&(j=T[D+1]),D+=2;function U(e){if(void 0!==e&&e&&void 0!==e.data&&e.data){var t,a;L=e.data;var r=[],o=null,l=(0,d.RA)(L.encodings_info,L.hls_info),s=null,c=null;if("string"==typeof L.poster_url?o=(0,u.formatInnerLink)(L.poster_url,n.url):"string"==typeof L.thumbnail_url&&(o=(0,u.formatInnerLink)(L.thumbnail_url,n.url)),Object.keys(l).length){var m=(0,d.KC)(),f=I.videoQuality;(null===f||"Auto"===f&&void 0===l.Auto)&&(f=720);var y=(0,d.$e)(f,l);for("Auto"===f&&void 0!==l.Auto&&r.push({src:l.Auto.url[0]}),a=0;a<l[y].format.length;){if("hls"===l[y].format[a]){r.push({src:l[y].url[a]});break}a+=1}for(a in L.encodings_info[y])L.encodings_info[y].hasOwnProperty(a)&&m.support[a]&&(t=L.encodings_info[y][a].url)&&(t=(0,u.formatInnerLink)(t,n.url),r.push({src:t,encodings_status:L.encodings_info[y][a].status}))}else l=null;if(1===r.length&&"running"===r[0].encodings_status&&(s="encodingRunning",c="Media encoding is currently running. Try again in few minutes."),null!==s)switch(s){case"encodingRunning":case"encodingPending":case"encodingFailed":break;default:p.warn("VIDEO DEBUG:","Video files don't exist")}i(s),h(c),b(o),E(r),M(l),C(L.subtitles_info),O(L.sprites_url?{url:(0,u.formatInnerLink)(L.sprites_url,n.url),frame:{width:160,height:90,seconds:10}}:null);var g=document.querySelector(".feat-first-item .item .item-description > div");g&&(g.innerHTML=L.summary)}}function B(e){if(void 0!==e&&void 0!==e.type)switch(e.type){case"network":case"private":case"unavailable":i(e.type),h(void 0!==e.message?e.message:"Αn error occurred while loading the media's data")}}return null!==j&&(R=t.media+"/"+j),(0,a.useEffect)((function(){null!==R&&(0,u.getRequest)(R,!1,U,B)}),[]),w.length?a.createElement("div",{className:"video-player"},a.createElement(m.Y7,{siteId:n.id,siteUrl:n.url,info:_,sources:w,poster:v,previewSprite:x,subtitlesInfo:A,enableAutoplay:!1,inEmbed:!1,hasTheaterMode:!1,hasNextLink:!1,hasPreviousLink:!1,errorMessage:y})):null}h.propTypes={pageLink:i().string.isRequired}},8204:function(e,t,n){"use strict";n.d(t,{T:function(){return m}}),n(5101),n(3080),n(2004),n(8407),n(6394),n(8288),n(5677),n(2129),n(4655);var a=n(5466),r=n(541),i=n(6191),o=n(4234);function l(e){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e,t){return!t||"object"!==l(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var m=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&u(e,t)}(f,e);var t,n,l,m,p=(l=f,m=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=d(l);if(m){var n=d(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return c(this,e)});function f(e,t){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,f),n=p.call(this,e),void 0!==t&&r.PageActions.initPage(t),n}return t=f,(n=[{key:"render",value:function(){return a.createElement(a.Fragment,null,a.createElement(i.PageMain,null,this.pageContent()),a.createElement(o.Notifications,null))}}])&&s(t.prototype,n),f}(a.PureComponent)},2083:function(e,t,n){var a=n(4835).Dispatcher;e.exports=new a},1450:function(e,t,n){"use strict";function a(){var e,t,n,a=null;if(document.cookie&&""!==document.cookie)for(t=document.cookie.split(";"),e=0;e<t.length;){if("csrftoken="===(n=t[e].trim()).substring(0,10)){a=decodeURIComponent(n.substring(10));break}e+=1}return a}n.d(t,{o:function(){return a}}),n(2322),n(9268),n(3233)},9039:function(e,t,n){"use strict";n.d(t,{O:function(){return o},a:function(){return l}}),n(1646),n(288),n(2004),n(8407),n(6394),n(8288),n(5677),n(2129),n(4655),n(3675),n(4458);var a=n(4646);function r(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 i(e,t,n){var a,i;switch(n){case TypeError:case RangeError:case SyntaxError:case ReferenceError:a=new n(t[0]);break;default:a=new Error(t[0])}return e.apply(void 0,[a.message].concat(function(e){if(Array.isArray(e))return r(e)}(i=t.slice(1))||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(i)||function(e,t){if(e){if("string"==typeof e)return r(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)?r(e,t):void 0}}(i)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())),a}function o(e,t){return i(a.v,e,t)}function l(e,t){return i(a.Z,e,t)}},9264:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});var a=n(2083);function r(e,t){return a.register(e[t].bind(e)),e}},1397:function(e,t,n){"use strict";n.d(t,{U:function(){return i}}),n(2322),n(3296),n(6394),n(4669);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()}},705:function(e,t,n){"use strict";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)},4646:function(e,t,n){"use strict";n.d(t,{Z:function(){return l},v:function(){return s}}),n(288),n(1646),n(2004),n(8407),n(6394),n(8288),n(5677),n(2129),n(4655),n(3675),n(4458);var a=n(1283);function r(e){return function(e){if(Array.isArray(e))return i(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return i(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)?i(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(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}var o=function(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return(e=a)[n[0]].apply(e,r(n.slice(1)))},l=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return o.apply(void 0,["warn"].concat(t))},s=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return o.apply(void 0,["error"].concat(t))}},408:function(e,t,n){"use strict";n.d(t,{aP:function(){return i},ZU:function(){return o},$A:function(){return l}}),n(5777);var a=function(e){return e===Math.trunc(e)},r=function(e){return function(e,t){return e>0}(e)},i=function(e){return a(e)&&r(e)},o=function(e){return a(e)&&(r(e)||function(e){return 0===e}(e))},l=function e(t,n){return n?e(n,t%n):t}},447:function(e,t,n){"use strict";n.d(t,{A_:function(){return l},j0:function(){return u},GH:function(){return d},Jl:function(){return p}}),n(7588),n(6394),n(5334);var a=n(4559),r=n.n(a);function i(e,t,n,a,r,i,o){try{var l=e[i](o),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(a,r)}function o(e){return function(){var t=this,n=arguments;return new Promise((function(a,r){var o=e.apply(t,n);function l(e){i(o,a,r,l,s,"next",e)}function s(e){i(o,a,r,l,s,"throw",e)}l(void 0)}))}}function l(e,t,n,a){return s.apply(this,arguments)}function s(){return(s=o(regeneratorRuntime.mark((function e(t,n,r,i){var o,l,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=function(e){if(i instanceof Function){var t=e;if(void 0===e.response)t={type:"network",error:e};else if(void 0!==e.response.status)switch(e.response.status){case 401:t={type:"private",error:e,message:"Media is private"};break;case 400:t={type:"unavailable",error:e,message:"Media is unavailable"}}i(t)}},l=function(e){r instanceof Function&&r(e)},o={timeout:null,maxContentLength:null},!n){e.next=8;break}return e.next=6,(0,a.get)(t,o).then(l).catch(s||null);case 6:e.next=9;break;case 8:(0,a.get)(t,o).then(l).catch(s||null);case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function u(e,t,n,a,r,i){return c.apply(this,arguments)}function c(){return(c=o(regeneratorRuntime.mark((function e(t,n,r,i,o,l){var s,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(u=function(e){l instanceof Function&&l(e)},s=function(e){o instanceof Function&&o(e)},n=n||{},!i){e.next=8;break}return e.next=6,(0,a.post)(t,n,r||null).then(s).catch(u||null);case 6:e.next=9;break;case 8:(0,a.post)(t,n,r||null).then(s).catch(u||null);case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function d(e,t,n,a,r,i){return m.apply(this,arguments)}function m(){return(m=o(regeneratorRuntime.mark((function e(t,n,r,i,o,l){var s,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(u=function(e){l instanceof Function&&l(e)},s=function(e){o instanceof Function&&o(e)},n=n||{},!i){e.next=8;break}return e.next=6,(0,a.put)(t,n,r||null).then(s).catch(u||null);case 6:e.next=9;break;case 8:(0,a.put)(t,n,r||null).then(s).catch(u||null);case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function p(e,t,n,a,r){return f.apply(this,arguments)}function f(){return(f=o(regeneratorRuntime.mark((function e(t,n,a,i,o){var l,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=function(e){o instanceof Function&&o(e)},l=function(e){i instanceof Function&&i(e)},n=n||{},!a){e.next=8;break}return e.next=6,r().delete(t,n||null).then(l).catch(s||null);case 6:e.next=9;break;case 8:r().delete(t,n||null).then(l).catch(s||null);case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}},7959:function(e,t,n){"use strict";n.r(t),n(5677),n(6394),n(506),n(3224),n(597),n(3543),n(5210),n(5785),n(91),n(9595),n(3357),n(1816),n(5292),n(7445),n(4875),n(1608),n(2994),n(284),n(601),n(9494),n(6229),n(9149),n(9503),n(9617),n(1962),n(8097),n(2322),n(3296),n(4669),n(7441),n(2070),n(3675),n(2129),n(9268),n(2004),n(8407),n(8288),n(4655),n(288),n(4458),n(5101),n(3080);var a,r=n(1590),i=n.n(r),o=n(9722),l=n(473),s=n(9479);function u(e){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function c(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function m(e,t){return!t||"object"!==u(t)&&"function"!=typeof t?p(e):t}function p(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function y(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}var h=null,g=null,v=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&d(e,t)}(v,e);var t,n,r,i,u=(r=v,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=f(r);if(i){var n=f(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return m(this,e)});function v(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,v),t=u.call(this),g=(0,s.v)(window.MediaCMS),a=new o.BrowserCache(g.site.id,86400),(h={mediaAutoPlay:a.get("media-auto-play")}).mediaAutoPlay=null===h.mediaAutoPlay||h.mediaAutoPlay,t.browserEvents=(0,l.BrowserEvents)(),t.browserEvents.doc(t.onDocumentVisibilityChange.bind(p(t))),t.browserEvents.win(t.onWindowResize.bind(p(t)),t.onWindowScroll.bind(p(t))),t.notifications=function(e){var t=[];function n(e){var n;"string"==typeof e&&t.push([(n=new Uint32Array(3),window.crypto.getRandomValues(n),(performance.now().toString(36)+Array.from(n).map((function(e){return e.toString(36)})).join("")).replace(/./g,""+Math.random()+Intl.DateTimeFormat().resolvedOptions().timeZone+Date.now())),e])}return e.map(n),{size:function(){return t.length},push:n,clear:function(){t=[]},messages:function(){return function(e){if(Array.isArray(e))return y(e)}(e=t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return y(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)?y(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();var e}}}(void 0!==window.MediaCMS&&void 0!==window.MediaCMS.notifications?window.MediaCMS.notifications:[]),t}return t=v,(n=[{key:"onDocumentVisibilityChange",value:function(){this.emit("document_visibility_change")}},{key:"onWindowScroll",value:function(){this.emit("window_scroll")}},{key:"onWindowResize",value:function(){this.emit("window_resize")}},{key:"initPage",value:function(e){h.currentPage=e}},{key:"get",value:function(e){var t,n;switch(e){case"browser-cache":t=a;break;case"media-auto-play":t=h.mediaAutoPlay;break;case"config-contents":t=g.contents;break;case"config-enabled":t=g.enabled;break;case"config-media-item":t=g.media.item;break;case"config-options":t=g.options;break;case"config-site":t=g.site;break;case"api-playlists":n=e.split("-")[1],t=g.api[n]||null;break;case"notifications-size":t=this.notifications.size();break;case"notifications":t=this.notifications.messages(),this.notifications.clear();break;case"current-page":t=h.currentPage}return t}},{key:"actions_handler",value:function(e){switch(e.type){case"INIT_PAGE":this.initPage(e.page),this.emit("page_init");break;case"TOGGLE_AUTO_PLAY":h.mediaAutoPlay=!h.mediaAutoPlay,a.set("media-auto-play",h.mediaAutoPlay),this.emit("switched_media_auto_play");break;case"ADD_NOTIFICATION":this.notifications.push(e.notification),this.emit("added_notification")}}}])&&c(t.prototype,n),v}(i());t.default=(0,l.exportStore)(new v,"actions_handler")},541:function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&a(t,e,n);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.VideoViewerActions=t.SearchFieldActions=t.ProfilePageActions=t.PlaylistViewActions=t.PlaylistPageActions=t.PageActions=t.MediaPageActions=void 0,t.MediaPageActions=i(n(979)),t.PageActions=i(n(6613)),t.PlaylistPageActions=i(n(5880)),t.PlaylistViewActions=i(n(9660)),t.ProfilePageActions=i(n(2472)),t.SearchFieldActions=i(n(2600)),t.VideoViewerActions=i(n(5464))},8578:function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.VideoViewerStore=t.SearchFieldStore=t.ProfilePageStore=t.PlaylistViewStore=t.PlaylistPageStore=t.PageStore=t.MediaPageStore=void 0;var r=a(n(337));t.MediaPageStore=r.default;var i=a(n(7959));t.PageStore=i.default;var o=a(n(1566));t.PlaylistPageStore=o.default;var l=a(n(1439));t.PlaylistViewStore=l.default;var s=a(n(8024));t.ProfilePageStore=s.default;var u=a(n(7359));t.SearchFieldStore=u.default;var c=a(n(5641));t.VideoViewerStore=c.default}},n={};function a(e){var r=n[e];if(void 0!==r)return r.exports;var i=n[e]={exports:{}};return t[e].call(i.exports,i,i.exports,a),i.exports}a.m=t,e=[],a.O=function(t,n,r,i){if(!n){var o=1/0;for(u=0;u<e.length;u++){n=e[u][0],r=e[u][1],i=e[u][2];for(var l=!0,s=0;s<n.length;s++)(!1&i||o>=i)&&Object.keys(a.O).every((function(e){return a.O[e](n[s])}))?n.splice(s--,1):(l=!1,i<o&&(o=i));l&&(e.splice(u--,1),t=r())}return t}i=i||0;for(var u=e.length;u>0&&e[u-1][2]>i;u--)e[u]=e[u-1];e[u]=[n,r,i]},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,{a:t}),t},a.d=function(e,t){for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.j=411,function(){var e={411:0};a.O.j=function(t){return 0===e[t]};var t=function(t,n){var r,i,o=n[0],l=n[1],s=n[2],u=0;for(r in l)a.o(l,r)&&(a.m[r]=l[r]);if(s)var c=s(a);for(t&&t(n);u<o.length;u++)i=o[u],a.o(e,i)&&e[i]&&e[i][0](),e[o[u]]=0;return a.O(c)},n=self.webpackChunkmediacms_frontend=self.webpackChunkmediacms_frontend||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))}();var r=a.O(void 0,[431],(function(){return a(5122)}));r=a.O(r)}(); |