mirror of
https://github.com/mediacms-io/mediacms.git
synced 2025-01-24 07:09:05 +01:00
1 line
176 KiB
JavaScript
1 line
176 KiB
JavaScript
!function(){var e={2953:function(e,t,n){"use strict";var i=n(2667),a=(n(5101),n(5466)),o=(n(6116),n(9518)),r=n(3074),s=n.n(r),l=n(920),c=n.n(l),u=n(2276),d=n(2787),p=n(4426),m=n(3811);function f(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}n(2322),n(9268);var h=n(9688),y=n(5793),g=n(6983),b=n(9450);function v(e){return(v="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 w(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function E(e,t){return(E=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _(e,t){return!t||"object"!==v(t)&&"function"!=typeof t?k(e):t}function k(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function P(e){return(P=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}new b.Z;var 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&&E(e,t)}(s,e);var t,n,i,o,r=(i=s,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=P(i);if(o){var n=P(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return _(this,e)});function s(e){var t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),t=r.call(this,e);var n=u.Z.get("media-data");t.AudioPlayerData={},t.audioStartedPlaying=!1;var i=(0,h.U)(n.original_media_url,p.Z.get("config-site").url);t.videoSources=[{src:i,type:f(i)}],t.videoPoster=n.poster_url,t.videoPoster=t.videoPoster?t.videoPoster:n.thumbnail_url,t.videoPoster=t.videoPoster?(0,h.U)(t.videoPoster,p.Z.get("config-site").url):"",t.updatePlayerVolume=t.updatePlayerVolume.bind(k(t)),t.onAudioEnd=t.onAudioEnd.bind(k(t)),t.onAudioRestart=t.onAudioRestart.bind(k(t)),p.Z.on("switched_media_auto_play",t.onUpdateMediaAutoPlay.bind(k(t))),t.wrapperClick=t.wrapperClick.bind(k(t));var a=new b.Z;return a.update(u.Z.get("media-data").duration),t.durationISO8601=a.ISO8601(),t}return t=s,(n=[{key:"componentDidMount",value:function(){this.videoSources.length||console.warn("Audio DEBUG:","Audio file doesn't exist"),this.recommendedMedia=u.Z.get("media-data").related_media.length?new g.Z(u.Z.get("media-data").related_media,this.refs.AudioElem.parentNode,this.props.inEmbed):null,this.upNextLoaderView=!this.props.inEmbed&&u.Z.get("media-data").related_media.length?new y.Z(u.Z.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),p.Z.removeListener("window_resize",this.recommendedMedia.onResize),d.Z.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",u.Z.get("media-data").url),e.setAttribute("title",u.Z.get("media-data").title),e.setAttribute("target","_blank"),e.innerHTML=u.Z.get("media-data").title),t&&(t.setAttribute("class","user-thumb-link"),t.setAttribute("href",u.Z.get("media-data").author_profile),t.setAttribute("title",u.Z.get("media-data").author_name),t.setAttribute("target","_blank"),t.innerHTML='<img src="'+u.Z.get("media-author-thumbnail-url")+'" alt="" />'),this.AudioPlayerData.instance=new(c())(this.refs.AudioElem,{sources:this.videoSources,poster:this.videoPoster,autoplay:!this.props.inEmbed,bigPlayButton:!0,controlBar:{fullscreen:!1,theaterMode:!1,next:!this.props.inEmbed&&0<u.Z.get("media-data").related_media.length},cornerLayers:{topLeft:e,topRight:this.upNextLoaderView?this.upNextLoaderView.html():null,bottomLeft:this.recommendedMedia?this.recommendedMedia.html():null,bottomRight:t}},{volume:d.Z.get("player-volume"),soundMuted:d.Z.get("player-sound-muted")},null,null,this.onAudioPlayerStateUpdate.bind(this),this.onClickNextButton.bind(this),null),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),p.Z.on("window_resize",this.recommendedMedia.onResize),d.Z.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(){this.props.inEmbed||(window.location.href=u.Z.get("media-data").related_media[0].url)}},{key:"onUpdateMediaAutoPlay",value:function(){this.upNextLoaderView&&(p.Z.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&&u.Z.get("playlist-id")){var e=document.querySelector(".video-player .more-media"),t=document.querySelector(".video-player .vjs-actions-anim");this.upNextLoaderView.cancelTimer();var n=u.Z.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&&(p.Z.get("media-auto-play")?(this.upNextLoaderView.startTimer(),this.AudioPlayerData.instance.player.one("play",function(){this.upNextLoaderView.cancelTimer()}.bind(this))):this.upNextLoaderView.cancelTimer())}},{key:"onUpdateMediaAutoPlay",value:function(){this.upNextLoaderView&&(p.Z.get("media-auto-play")?this.upNextLoaderView.showTimerView(this.AudioPlayerData.instance.isEnded()):this.upNextLoaderView.hideTimerView())}},{key:"updatePlayerVolume",value:function(e,t){d.Z.get("player-volume")!==e&&m.zZ(e),d.Z.get("player-sound-muted")!==t&&m.Hs(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 a.createElement("div",{className:"player-container audio-player-container"},a.createElement("div",{className:"player-container-inner"},a.createElement("div",{className:"video-player",ref:"videoPlayerWrap",onClick:this.wrapperClick},a.createElement("audio",{tabIndex:"1",ref:"AudioElem",className:"video-js vjs-mediacms native-dimensions"}))))}}])&&w(t.prototype,n),s}(a.PureComponent);function C(e){return(C="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 i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function R(e,t){return(R=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function M(e,t){return!t||"object"!==C(t)&&"function"!=typeof t?N(e):t}function N(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function D(e){return(D=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}S.defaultProps={inEmbed:!1},S.propTypes={inEmbed:s().bool},n(3296),n(3233);var Z=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&&R(e,t)}(s,e);var t,n,i,o,r=(i=s,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=D(i);if(o){var n=D(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return M(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=r.call(this,e)).state={image:t.getImageUrl()},t.state.image=t.state.image?t.state.image:u.Z.get("media-data").thumbnail_url,t.state.image=t.state.image?t.state.image:"",t.onImageLoad=t.onImageLoad.bind(N(t)),u.Z.on("loaded_image_data",t.onImageLoad),t}return t=s,(n=[{key:"getImageUrl",value:function(){var e=u.Z.get("media-data"),t="string"==typeof e.poster_url?e.poster_url.trim():"";return""===t&&(t="string"==typeof e.thumbnail_url?e.thumbnail_url.trim():""),""===t&&(t="string"==typeof u.Z.get("media-original-url")?u.Z.get("media-original-url").trim():""),""===t?"#":p.Z.get("config-site").url+"/"+t.replace(/^\//g,"")}},{key:"onImageLoad",value:function(){this.setState({image:this.getImageUrl()})}},{key:"render",value:function(){return this.state.image?a.createElement("div",{className:"viewer-image-container"},a.createElement("img",{src:this.state.image,alt:u.Z.get("media-data").title||null})):null}}])&&O(t.prototype,n),s}(a.PureComponent);function I(e){return(I="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 T(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function x(e,t){return(x=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function L(e,t){return!t||"object"!==I(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 A(e){return(A=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&&x(e,t)}(s,e);var t,n,i,o,r=(i=s,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=A(i);if(o){var n=A(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return L(this,e)});function s(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),r.call(this,e)}return t=s,(n=[{key:"render",value:function(){return a.createElement("div",{className:"player-container viewer-pdf-container"},a.createElement("div",{className:"player-container-inner"},a.createElement("span",null,a.createElement("span",null,a.createElement("i",{className:"material-icons"},"insert_drive_file")))))}}])&&T(t.prototype,n),s}(a.PureComponent);function F(e){return(F="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 U(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function V(e,t){return(V=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function W(e,t){return!t||"object"!==F(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 H(e){return(H=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var q=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&&V(e,t)}(s,e);var t,n,i,o,r=(i=s,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=H(i);if(o){var n=H(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return W(this,e)});function s(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),r.call(this,e)}return t=s,(n=[{key:"render",value:function(){return a.createElement("div",{className:"player-container viewer-attachment-container"},a.createElement("div",{className:"player-container-inner"},a.createElement("span",null,a.createElement("span",null,a.createElement("i",{className:"material-icons"},"insert_drive_file")))))}}])&&U(t.prototype,n),s}(a.PureComponent),z=n(8204),G=n(3699);function B(e){return(B="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 Y(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function K(e,t){return(K=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function X(e,t){return!t||"object"!==B(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 J(e){return(J=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Q=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&&K(e,t)}(s,e);var t,n,i,o,r=(i=s,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=J(i);if(o){var n=J(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return X(this,e)});function s(){return Y(this,s),r.apply(this,arguments)}return t=s,(n=[{key:"render",value:function(){return a.createElement("div",{className:"viewer-container",key:"viewer-container-error"},a.createElement("div",{className:"player-container player-container-error"},a.createElement("div",{className:"player-container-inner"},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"},u.Z.get("media-load-error-message")))))))}}])&&$(t.prototype,n),s}(a.PureComponent),ee=(n(2004),n(8407),n(4458),n(8349)),te=(n(7228),n(2431)),ne=n(2331),ie=n(8680),ae=n(4067),oe=n(7207),re=n(2836);function se(e){return(se="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 le(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ce(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function ue(e,t,n){return t&&ce(e.prototype,t),n&&ce(e,n),e}function de(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&&pe(e,t)}function pe(e,t){return(pe=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function me(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=ye(e);if(t){var a=ye(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return fe(this,n)}}function fe(e,t){return!t||"object"!==se(t)&&"function"!=typeof t?he(e):t}function he(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ye(e){return(ye=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var ge="comment",be="Comment",ve="SUBMIT",we=function(e){de(n,e);var t=me(n);function n(e){var i;return le(this,n),(i=t.call(this,e)).state={value:"",madeChanges:!1,textareaFocused:!1,textareaLineHeight:-1},i.onChange=i.onChange.bind(he(i)),i.onFocus=i.onFocus.bind(he(i)),i.onBlur=i.onBlur.bind(he(i)),i.submitComment=i.submitComment.bind(he(i)),i.onCommentSubmit=i.onCommentSubmit.bind(he(i)),i.onCommentSubmitFail=i.onCommentSubmitFail.bind(he(i)),u.Z.on("comment_submit",i.onCommentSubmit),u.Z.on("comment_submit_fail",i.onCommentSubmitFail),i}return ue(n,[{key:"onFocus",value:function(){this.setState({textareaFocused:!0})}},{key:"onBlur",value:function(){this.setState({textareaFocused:!1})}},{key:"onCommentSubmit",value:function(){this.refs.FormTextarea.style.height="";var e=this.refs.FormTextarea.scrollHeight,t=0<this.state.textareaLineHeight?this.state.textareaLineHeight:parseFloat(window.getComputedStyle(this.refs.FormTextarea).lineHeight);this.setState({value:"",madeChanges:!1,textareaLineHeight:t},(function(){this.refs.FormTextarea.style.height=Math.max(20,this.state.textareaLineHeight*Math.ceil(e/t))+"px"}))}},{key:"onCommentSubmitFail",value:function(){this.setState({madeChanges:!1})}},{key:"onChange",value:function(e){this.refs.FormTextarea.style.height="";var t=this.refs.FormTextarea.scrollHeight,n=0<this.state.textareaLineHeight?this.state.textareaLineHeight:parseFloat(window.getComputedStyle(this.refs.FormTextarea).lineHeight);this.setState({madeChanges:!0,value:this.refs.FormTextarea.value,textareaLineHeight:n},(function(){this.refs.FormTextarea.style.height=Math.max(20,this.state.textareaLineHeight*Math.ceil(t/n))+"px"}))}},{key:"submitComment",value:function(){if(this.state.madeChanges){var e=this.refs.FormTextarea.value.trim();""!==e&&G.submitComment(e)}}},{key:"render",value:function(){var e;return p.Z.get("config-user").is.anonymous&&(e=window.location.href.replace(p.Z.get("config-site").url,"").replace(/^\//g,""),e=p.Z.get("url-signin")+"?next=/"+e),p.Z.get("config-user").is.anonymous?a.createElement("div",{className:"comments-form"},a.createElement("div",{className:"comments-form-inner"},a.createElement(ie.q,null),a.createElement("div",{className:"form"},a.createElement("a",{href:e,rel:"noffolow",className:"form-textarea-wrap",title:"Add a comment..."},a.createElement("span",{ref:"FormTextarea",className:"form-textarea"},"Add a comment...")),a.createElement("div",{className:"form-buttons"},a.createElement("a",{href:e,rel:"noffolow",className:"disabled"},ve))))):a.createElement("div",{className:"comments-form"},a.createElement("div",{className:"comments-form-inner"},a.createElement(ie.q,null),a.createElement("div",{className:"form"},a.createElement("div",{className:"form-textarea-wrap"+(this.state.textareaFocused?" focused":"")},a.createElement("textarea",{ref:"FormTextarea",className:"form-textarea",rows:"1",placeholder:"Add a comment...",value:this.state.value,onChange:this.onChange,onFocus:this.onFocus,onBlur:this.onBlur})),a.createElement("div",{className:"form-buttons"},a.createElement("button",{className:""===this.state.value.trim()?"disabled":"",onClick:this.submitComment},ve)))))}}]),n}(a.PureComponent);we.propTypes={comment_type:s().oneOf(["new","reply"]),media_id:s().oneOfType([s().string,s().number]).isRequired,reply_comment_id:s().oneOfType([s().string,s().number])},we.defaultProps={comment_type:"new"};var Ee=function(e){de(n,e);var t=me(n);function n(e){var i;return le(this,n),(i=t.call(this,e)).state={viewMoreContent:!0,enabledViewMoreContent:!1,isOpenRemoveCommentPopup:!1},p.Z.get("config-user").can.deleteComment?(i.proceedCommentRemoval=i.proceedCommentRemoval.bind(he(i)),i.cancelCommentRemoval=i.cancelCommentRemoval.bind(he(i)),i.onPopupsDisplayChange=i.onPopupsDisplayChange.bind(he(i)),i.removeCommentPopup=new oe.Z(a.createElement("button",{onClick:i.removeComment},"DELETE ","COMMENT"),a.createElement(re.W8,null,a.createElement("div",{className:"popup-message"},a.createElement("span",{className:"popup-message-title"},be," removal"),a.createElement("span",{className:"popup-message-main"},"You're willing to remove ",ge," permanently?")),a.createElement("hr",null),a.createElement("span",{className:"popup-message-bottom"},a.createElement("button",{className:"button-link cancel-comment-removal",onClick:i.cancelCommentRemoval},"CANCEL"),a.createElement("button",{className:"button-link proceed-comment-removal",onClick:i.proceedCommentRemoval},"PROCEED"))),i.onPopupsDisplayChange)):(i.proceedCommentRemoval=null,i.cancelCommentRemoval=null,i.onPopupsDisplayChange=null),i}return ue(n,[{key:"componentDidMount",value:function(){}},{key:"onWindowResize",value:function(){var e=this.state.enabledViewMoreContent||this.refs.TextInner.offsetHeight>this.refs.Text.offsetHeight;this.setState({enabledViewMoreContent:e,viewMoreContent:!!e&&this.state.viewMoreContent})}},{key:"toggleMore",value:function(){this.setState({viewMoreContent:!this.state.viewMoreContent})}},{key:"onPopupsDisplayChange",value:function(){this.setState({isOpenRemoveCommentPopup:this.removeCommentPopup.isPopupOpen()})}},{key:"cancelCommentRemoval",value:function(){this.removeCommentPopup.setOpenPopupState(!1)}},{key:"proceedCommentRemoval",value:function(){G.deleteComment(this.props.comment_id),this.cancelCommentRemoval()}},{key:"render",value:function(){return a.createElement("div",{key:this.props.comment_id,className:"comment"},a.createElement("div",{className:"comment-inner"},a.createElement("a",{className:"comment-author-thumb",href:this.props.author_link,title:this.props.author_name},a.createElement("img",{src:this.props.author_thumb,alt:this.props.author_name})),a.createElement("div",{className:"comment-content"},a.createElement("div",{className:"comment-meta"},a.createElement("div",{className:"comment-author"},a.createElement("a",{href:this.props.author_link,title:this.props.author_name},this.props.author_name)),a.createElement("div",{className:"comment-date"},(0,ae.WU)(new Date(this.props.publish_date)))),a.createElement("div",{ref:"Text",className:"comment-text"+(this.state.viewMoreContent?" show-all":"")},a.createElement("div",{ref:"TextInner",className:"comment-text-inner",dangerouslySetInnerHTML:{__html:this.props.text}})),this.state.enabledViewMoreContent?a.createElement("button",{className:"toggle-more",onClick:this.toggleMore},this.state.viewMoreContent?"Show less":"Read more"):null,p.Z.get("config-user").can.deleteComment?a.createElement("div",{className:"comment-actions"},p.Z.get("config-user").can.deleteComment?a.createElement("div",{className:"comment-action remove-comment"},this.removeCommentPopup.triggerComponent(),this.state.isOpenRemoveCommentPopup?this.removeCommentPopup.contentComponent():null):null):null)))}}]),n}(a.PureComponent);Ee.propTypes={comment_id:s().oneOfType([s().string,s().number]).isRequired,media_id:s().oneOfType([s().string,s().number]).isRequired,text:s().string,author_name:s().string,author_link:s().string,author_thumb:s().string,publish_date:s().oneOfType([s().string,s().number]),likes:s().number,dislikes:s().number},Ee.defaultProps={author_name:"",author_link:"#",publish_date:0,likes:0,dislikes:0};var _e=function(e){de(n,e);var t=me(n);function n(e){var i;if(le(this,n),(i=t.call(this,e)).state={mediaId:u.Z.get("media-id")},p.Z.get("config-user").can.readComment){var a=u.Z.get("media-comments");i.state.comments=a,i.state.commentsLength=a?a.length:0,i.state.commentsLength||(i.onCommentsLoad=i.onCommentsLoad.bind(he(i)),i.onCommentSubmit=i.onCommentSubmit.bind(he(i)),i.onCommentSubmitFail=i.onCommentSubmitFail.bind(he(i)),i.onCommentDelete=i.onCommentDelete.bind(he(i)),i.onCommentDeleteFail=i.onCommentDeleteFail.bind(he(i)),u.Z.on("comments_load",i.onCommentsLoad),u.Z.on("comment_submit",i.onCommentSubmit),u.Z.on("comment_submit_fail",i.onCommentSubmitFail),u.Z.on("comment_delete",i.onCommentDelete),u.Z.on("comment_delete_fail",i.onCommentDeleteFail))}return i}return ue(n,[{key:"onCommentsLoad",value:function(){var e=u.Z.get("media-comments");this.setState({comments:e,commentsLength:e?e.length:0},(function(){}));var t=document.querySelector(".page-main"),n=t.querySelector(".no-comment");if(0===e.length&&"unlisted"===u.Z.get("media-data").state){if(-1<p.Z.get("url-profile-home").indexOf(u.Z.get("media-data").author_profile)&&!n){var i=document.createElement("div");i.setAttribute("role","alert"),i.setAttribute("class","alert info alert-dismissible no-comment"),i.innerHTML='<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>'+p.Z.get("config-contents").uploader.postUploadMessage,t.firstChild?t.insertBefore(i,t.firstChild):t.appendChild(i),i.querySelector("button.close").addEventListener("click",(function(e){return i.setAttribute("class","alert info alert-dismissible hiding"),setTimeout(function(){i.parentNode.removeChild(i)}.bind(this),400),e.preventDefault(),e.stopPropagation(),!1}))}}else n&&0<e.length&&n.parentNode.removeChild(n)}},{key:"onCommentSubmit",value:function(e){this.onCommentsLoad(),setTimeout((function(){ee.wN("Comment added","commentSubmit")}),100),void 0!==e&&console.info('Added comment "'+e+'"')}},{key:"onCommentSubmitFail",value:function(){setTimeout((function(){ee.wN("Comment submition failed","commentSubmitFail")}),100)}},{key:"onCommentDelete",value:function(e){this.onCommentsLoad(),setTimeout((function(){ee.wN("Comment removed","commentDelete")}),100),void 0!==e&&console.info('Removed comment "'+e+'"')}},{key:"onCommentDeleteFail",value:function(e){setTimeout((function(){ee.wN("Comment removal failed","commentDeleteFail")}),100),void 0!==e&&console.info('Comment "'+e+'" removal failed')}},{key:"commentsContent",value:function(){var e,t=null;if(this.state.comments&&this.state.commentsLength)for(t=[],e=0;e<this.state.commentsLength;)t.push(a.createElement(Ee,{key:this.state.comments[e].uid,comment_id:this.state.comments[e].uid,media_id:this.state.mediaId,text:this.state.comments[e].text,author_name:this.state.comments[e].author_name,author_link:this.state.comments[e].author_profile,author_thumb:p.Z.get("config-site").url+"/"+this.state.comments[e].author_thumbnail_url.replace(/^\//g,""),publish_date:this.state.comments[e].add_date,likes:0,dislikes:0})),e+=1;return t}},{key:"render",value:function(){return a.createElement("div",{className:"comments-list"},a.createElement("div",{className:"comments-list-inner"},!p.Z.get("config-user").can.readComment||u.Z.get("media-data").enable_comments?null:a.createElement("span",{className:"disabled-comments-msg"},"Comments are disabled"),p.Z.get("config-user").can.readComment&&(u.Z.get("media-data").enable_comments||p.Z.get("config-user").can.editMedia)?a.createElement("h2",null,this.state.commentsLength?1<this.state.commentsLength?this.state.commentsLength+" Comments":this.state.commentsLength+" "+be:u.Z.get("media-data").enable_comments?"No comment yet":""):null,p.Z.get("config-user").can.addComment&&u.Z.get("media-data").enable_comments?a.createElement(we,{media_id:this.state.mediaId}):null,p.Z.get("config-user").can.readComment&&(u.Z.get("media-data").enable_comments||p.Z.get("config-user").can.editMedia)&&this.state.commentsLength&&this.state.comments&&this.state.commentsLength?this.commentsContent():null))}}]),n}(a.PureComponent),ke=(a.PureComponent,n(1590)),Pe=n.n(ke),Se=n(4860),Ce=n(8420);function Oe(e){return(Oe="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 Re(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function Me(e,t){return(Me=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ne(e,t){return!t||"object"!==Oe(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 De(e){return(De=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ze=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&&Me(e,t)}(r,e);var t,n,i,a,o=(i=r,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=De(i);if(a){var n=De(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return Ne(this,e)});function r(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,r),(e=o.call(this)).browserCache=new Se.Z(p.Z.get("config-site").id,86400),e.data={media_id:null,extendedRateCategories:e.browserCache.get("extended-rate-categories")},e.data.extendedRateCategories=null===e.data.extendedRateCategories?!p.Z.get("config-user").is.anonymous:!!e.data.extendedRateCategories,e}return t=r,(n=[{key:"requestRate",value:function(e,t){(0,Ce.j0)(p.Z.get("api-media")+"/"+this.data.media_id+"/actions",{type:"rate",extra_info:{score:t,category_id:e}},{headers:{"X-CSRFToken":(0,Ce.m5)()}},!1,this.succeedRateResponse.bind(this,e,t),this.failedRateResponse.bind(this,e,t))}},{key:"succeedRateResponse",value:function(e,t,n){this.emit("succeed_rate_submit["+e+"]",t)}},{key:"failedRateResponse",value:function(e,t,n){this.emit("failed_rate_submit["+e+"]",t)}},{key:"get",value:function(e){switch(e){case"extended-rate-categories":return this.data.extendedRateCategories}return null}},{key:"actions_handler",value:function(e){switch(e.type){case"INIT":this.data.media_id=e.media_id;break;case"EXTEND_RATE_CATEGORIES":this.data.extendedRateCategories=!this.data.extendedRateCategories,this.browserCache.set("extended-rate-categories",this.data.extendedRateCategories?1:0),this.emit("changed_rate_categories_visibility");break;case"RATE_SUBMIT":this.requestRate(e.id,e.score)}}}])&&Re(t.prototype,n),r}(Pe()),Ie=(0,Ce.v$)(new Ze,"actions_handler"),Te=n(8416),xe=n.n(Te),Le=n(2123);function Ae(e){return(Ae="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 je(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Fe(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function Ue(e,t,n){return t&&Fe(e.prototype,t),n&&Fe(e,n),e}function Ve(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&&We(e,t)}function We(e,t){return(We=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function He(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=Ge(e);if(t){var a=Ge(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return qe(this,n)}}function qe(e,t){return!t||"object"!==Ae(t)&&"function"!=typeof t?ze(e):t}function ze(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ge(e){return(Ge=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Be=function(e){Ve(n,e);var t=He(n);function n(e){var i;return je(this,n),(i=t.call(this,e)).initialScore=e.score,i.state={score:e.score,initialScore:e.score,submitingScore:!1,message:null},i.submitRate=i.submitRate.bind(ze(i)),i.closeRateMessage=i.closeRateMessage.bind(ze(i)),i.onSucceedRateSubmit=i.onSucceedRateSubmit.bind(ze(i)),i.onFailedRateSubmit=i.onFailedRateSubmit.bind(ze(i)),Ie.on("succeed_rate_submit["+e.id+"]",i.onSucceedRateSubmit),Ie.on("failed_rate_submit["+e.id+"]",i.onFailedRateSubmit),i}return Ue(n,[{key:"closeRateMessage",value:function(){this.setState({message:null})}},{key:"onSucceedRateSubmit",value:function(e){this.setState({initialScore:e,submitingScore:!1,message:'Thank you for your rating in category of "<strong>'+this.props.title+'</strong>".'})}},{key:"onFailedRateSubmit",value:function(e){this.setState({submitingScore:!1,message:'A problem has occurred when submitting your score for the category of "<strong>'+this.props.title+'</strong>". Please try again.'})}},{key:"onButtonClick",value:function(e){this.setState({score:e})}},{key:"submitRate",value:function(){this.setState({submitingScore:!0},(function(){var e,t;e=this.props.id,t=this.state.score,xe().dispatch({type:"RATE_SUBMIT",id:e,score:t})}))}},{key:"stars",value:function(){for(var e=[],t=1;t<6;)e.push(a.createElement("div",{key:t,className:(t<=this.state.score?"active":"")+(t===this.state.score?" selected":"")},a.createElement(te.M,{onClick:this.onButtonClick.bind(this,t)},a.createElement("i",{className:"material-icons"},"star_rate")))),t+=1;return e}},{key:"render",value:function(){return a.createElement("div",{className:"rating-category"+(this.state.submitingScore||null!==this.state.message?" submit-loading":"")},a.createElement("div",{className:"category-title"},this.props.title),a.createElement("div",{className:"stars"},this.stars()),a.createElement("div",{className:"rate-action"},a.createElement("button",{disabled:this.state.score===this.state.initialScore,onClick:this.state.score===this.state.initialScore?null:this.submitRate},"Submit score")),this.state.submitingScore?a.createElement("div",{className:"submit-loader"},a.createElement(Le.i,null)):null,null!==this.state.message?a.createElement("div",{className:"submit-loader"},a.createElement("div",{className:"submit-msg"},a.createElement("div",{dangerouslySetInnerHTML:{__html:this.state.message}})),a.createElement(te.M,{className:"close-msg",onClick:this.closeRateMessage},a.createElement("i",{className:"material-icons"},"clear"))):null)}}]),n}(a.PureComponent);Be.propTypes={id:s().oneOfType([s().string,s().number]).isRequired,title:s().string.isRequired,score:s().number.isRequired};var Ye=function(e){Ve(n,e);var t=He(n);function n(e){var i;return je(this,n),(i=t.call(this,e)).state={extended:Ie.get("extended-rate-categories")},i.onClickExtend=i.onClickExtend.bind(ze(i)),i.onRateCategoriesToggle=i.onRateCategoriesToggle.bind(ze(i)),Ie.on("changed_rate_categories_visibility",i.onRateCategoriesToggle),i}return Ue(n,[{key:"componentDidMount",value:function(){var e;e=this.props.media_id,xe().dispatch({type:"INIT",media_id:e})}},{key:"onClickExtend",value:function(){xe().dispatch({type:"EXTEND_RATE_CATEGORIES"})}},{key:"onRateCategoriesToggle",value:function(){this.setState({extended:Ie.get("extended-rate-categories")})}},{key:"ratingCategories",value:function(){for(var e=[],t=0;t<this.props.ratings_data.length;)e.push(a.createElement(Be,{key:t,id:this.props.ratings_data[t].category_id,title:this.props.ratings_data[t].category_title,score:this.props.ratings_data[t].score})),t+=1;return e}},{key:"render",value:function(){var e;return p.Z.get("config-user").is.anonymous&&(e=window.location.href.replace(p.Z.get("config-site").url,"").replace(/^\//g,""),e=p.Z.get("url-signin")+"?next=/"+e),a.createElement("div",{className:"ratings-container"+(this.state.extended?" extended":"")},a.createElement("button",{className:"extend-rating-form",onClick:this.onClickExtend},"Rate the film ",a.createElement(te.M,{type:"span"},a.createElement("i",{className:"material-icons"},this.state.extended?"keyboard_arrow_up":"keyboard_arrow_down"))),a.createElement("div",{className:"rating-categories"},p.Z.get("is-logged-in")?this.ratingCategories():a.createElement("div",{className:"rating-category need-login"},a.createElement("div",{className:"category-title"},"Ιn order to be able to rate the film you need to be signed in"),a.createElement("div",{className:"rate-action"},a.createElement("a",{href:e,title:"Sign in"},"SIGN IN")))))}}]),n}(a.PureComponent);function $e(e){return($e="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 i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function Xe(e,t){return(Xe=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Je(e,t){return!t||"object"!==$e(t)&&"function"!=typeof t?Qe(e):t}function Qe(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function et(e){return(et=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function tt(e){var t,n,i=[];if(e.length)for(t=0,n=1<e.length?", ":"";t<e.length;)i[t]=a.createElement("div",{key:t},a.createElement("a",{href:e[t].url,title:e[t].title},e[t].title),t<e.length-1?n:""),t+=1;return i}Ye.propTypes={media_id:s().string.isRequired,ratings_data:s().array.isRequired};var nt=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)}(s,e);var t,n,i,o,r=(i=s,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=et(i);if(o){var n=et(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return Je(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=r.call(this,e)).state={hasSummary:!1,isContentVisible:!0},t.summary=u.Z.get("media-summary"),null!==t.summary&&(t.summary=t.summary.trim(),""!==t.summary&&(t.state.hasSummary=!0,t.state.isContentVisible=!1)),t.description=e.description.trim(),t.productionCompanyContent=u.Z.get("media-production-company"),t.websiteContent=u.Z.get("media-website"),t.licenseContent=u.Z.get("media-license-info"),t.countriesContent=tt(u.Z.get("media-countries")),t.languagesContent=tt(u.Z.get("media-languages")),t.topicsContent=tt(u.Z.get("media-topics")),t.tagsContent=!p.Z.get("config-enabled").taxonomies.tags||p.Z.get("config-enabled").taxonomies.tags.enabled?tt(u.Z.get("media-tags")):[],p.Z.get("config-options").pages.media.categoriesWithTitle?t.categoriesContent=[]:t.categoriesContent=!p.Z.get("config-enabled").taxonomies.categories||p.Z.get("config-enabled").taxonomies.categories.enabled?tt(u.Z.get("media-categories")):[],p.Z.get("config-user").can.deleteMedia?(t.state.isOpenRemoveMediaPopup=!1,t.proceedMediaRemoval=t.proceedMediaRemoval.bind(Qe(t)),t.cancelMediaRemoval=t.cancelMediaRemoval.bind(Qe(t)),t.onPopupsDisplayChange=t.onPopupsDisplayChange.bind(Qe(t)),t.removeMediaPopup=new oe.Z(a.createElement("button",{className:"remove-media"},"DELETE MEDIA"),a.createElement(re.W8,null,a.createElement("div",{className:"popup-message"},a.createElement("span",{className:"popup-message-title"},"Media removal"),a.createElement("span",{className:"popup-message-main"},"You're willing to remove media permanently?")),a.createElement("hr",null),a.createElement("span",{className:"popup-message-bottom"},a.createElement("button",{className:"button-link cancel-comment-removal",onClick:t.cancelMediaRemoval},"CANCEL"),a.createElement("button",{className:"button-link proceed-comment-removal",onClick:t.proceedMediaRemoval},"PROCEED"))),t.onPopupsDisplayChange)):(t.proceedMediaRemoval=null,t.cancelMediaRemoval=null,t.onPopupsDisplayChange=null),t.onClickLoadMore=t.onClickLoadMore.bind(Qe(t)),t.onMediaDelete=t.onMediaDelete.bind(Qe(t)),t.onMediaDeleteFail=t.onMediaDeleteFail.bind(Qe(t)),u.Z.on("media_delete",t.onMediaDelete),u.Z.on("media_delete_fail",t.onMediaDeleteFail),t}return t=s,(n=[{key:"onClickLoadMore",value:function(){this.setState({isContentVisible:!this.state.isContentVisible})}},{key:"onPopupsDisplayChange",value:function(){this.setState({isOpenRemoveMediaPopup:this.removeMediaPopup.isPopupOpen()})}},{key:"cancelMediaRemoval",value:function(){this.removeMediaPopup.setOpenPopupState(!1)}},{key:"proceedMediaRemoval",value:function(){G.removeMedia(),this.cancelMediaRemoval()}},{key:"onMediaDelete",value:function(e){setTimeout((function(){ee.wN("Media removed. Redirecting...","mediaDelete"),setTimeout((function(){window.location.href=p.Z.get("config-site").url+"/"+u.Z.get("media-data").author_profile.replace(/^\//g,"")}),2e3)}),100),void 0!==e&&console.info("Removed media '"+e+'"')}},{key:"onMediaDeleteFail",value:function(e){setTimeout((function(){ee.wN("Media removal failed","mediaDeleteFail")}),100),void 0!==e&&console.info('Media "'+e+'" removal failed')}},{key:"render",value:function(){var e=(0,h.U)(this.props.author.url,p.Z.get("config-site").url),t=(0,h.U)(this.props.author.thumb,p.Z.get("config-site").url),n=u.Z.get("media-data").ratings_info;return void 0!==n&&n.length||(n=null),a.createElement("div",{className:"media-info-content"},void 0===p.Z.get("config-media-item").displayAuthor||null===p.Z.get("config-media-item").displayAuthor||p.Z.get("config-media-item").displayAuthor?a.createElement("div",{className:"media-author-banner"},a.createElement("div",null,this.props.author&&this.props.author.thumb?a.createElement("a",{className:"author-banner-thumb",href:e||null,title:this.props.author.name},a.createElement("span",{style:{backgroundImage:"url("+t+")"}},a.createElement("img",{src:t,loading:"lazy",alt:this.props.author.name,title:this.props.author.name}))):null),a.createElement("div",null,this.props.author?a.createElement("span",null,a.createElement("a",{href:e||null,className:"author-banner-name",title:this.props.author.name},a.createElement("span",null,this.props.author.name))):null,p.Z.get("config-media-item").displayPublishDate&&this.props.published?a.createElement("span",{className:"author-banner-date"},"Published on ",(0,Ce.hm)(new Date(this.props.published))):null)):null,a.createElement("div",{className:"media-content-banner"+(null!==this.productionCompanyContent&&""!==this.productionCompanyContent?" large-fields-title":"")},a.createElement("div",{className:"media-content-banner-inner"},this.state.hasSummary?a.createElement("div",{className:"media-content-summary"},this.summary):null,this.state.hasSummary&&!this.state.isContentVisible||!this.description?null:p.Z.get("config-options").pages.media.htmlInDescription?a.createElement("div",{className:"media-content-description",dangerouslySetInnerHTML:{__html:this.description}}):a.createElement("div",{className:"media-content-description"},this.description),this.state.hasSummary?a.createElement("button",{className:"load-more",onClick:this.onClickLoadMore},this.state.isContentVisible?"SHOW LESS":"SHOW MORE"):null,this.languagesContent.length?a.createElement("div",{className:"media-content-languages"},a.createElement("div",{className:"media-content-field"},a.createElement("div",{className:"media-content-field-label"},a.createElement("h4",null,1<this.languagesContent.length?"Languages":"Language")),a.createElement("div",{className:"media-content-field-content"},this.languagesContent))):null,this.countriesContent.length?a.createElement("div",{className:"media-content-countries"},a.createElement("div",{className:"media-content-field"},a.createElement("div",{className:"media-content-field-label"},a.createElement("h4",null,1<this.countriesContent.length?"Countries":"Country")),a.createElement("div",{className:"media-content-field-content"},this.countriesContent))):null,this.topicsContent.length?a.createElement("div",{className:"media-content-topics"},a.createElement("div",{className:"media-content-field"},a.createElement("div",{className:"media-content-field-label"},a.createElement("h4",null,1<this.topicsContent.length?"Topics":"Topic")),a.createElement("div",{className:"media-content-field-content"},this.topicsContent))):null,this.tagsContent.length?a.createElement("div",{className:"media-content-categories"},a.createElement("div",{className:"media-content-field"},a.createElement("div",{className:"media-content-field-label"},a.createElement("h4",null,1<this.tagsContent.length?"Tags":"Tag")),a.createElement("div",{className:"media-content-field-content"},this.tagsContent))):null,this.categoriesContent.length?a.createElement("div",{className:"media-content-categories"},a.createElement("div",{className:"media-content-field"},a.createElement("div",{className:"media-content-field-label"},a.createElement("h4",null,1<this.categoriesContent.length?"Categories":"Category")),a.createElement("div",{className:"media-content-field-content"},this.categoriesContent))):null,null!==this.productionCompanyContent&&""!==this.productionCompanyContent?a.createElement("div",{className:"media-content-production-company"},a.createElement("div",{className:"media-content-field"},a.createElement("div",{className:"media-content-field-label"},a.createElement("h4",null,"Production company")),a.createElement("div",{className:"media-content-field-content"},this.productionCompanyContent))):null,null!==this.websiteContent&&""!==this.websiteContent?a.createElement("div",{className:"media-content-website"},a.createElement("div",{className:"media-content-field"},a.createElement("div",{className:"media-content-field-label"},a.createElement("h4",null,"Website")),a.createElement("div",{className:"media-content-field-content"},this.websiteContent))):null,u.Z.get("display-media-license-info")?a.createElement("div",{className:"media-content-license"},a.createElement("div",{className:"media-content-field"},a.createElement("div",{className:"media-content-field-label"},a.createElement("h4",null,null!==this.licenseContent&&""!==this.licenseContent?"License":"Copyright")),a.createElement("div",{className:"media-content-field-content"},null!==this.licenseContent&&""!==this.licenseContent?a.createElement("a",{href:this.licenseContent.url,title:this.licenseContent.title,className:"media-license-link",target:"_blank",rel:"nofollow"},a.createElement("span",null,a.createElement("img",{src:this.licenseContent.thumbnail,alt:""})),a.createElement("span",null,this.licenseContent.title)):a.createElement("span",null,"All rights reserved.")))):null,p.Z.get("config-user").can.editMedia||p.Z.get("config-user").can.editSubtitle||p.Z.get("config-user").can.deleteMedia?a.createElement("div",{className:"media-author-actions"},p.Z.get("config-user").can.editMedia?a.createElement("a",{href:u.Z.get("media-data").edit_url,rel:"nofollow",title:"Edit media",className:"edit-media"},"EDIT MEDIA"):null,p.Z.get("config-user").can.editSubtitle&&"video"===u.Z.get("media-data").media_type?a.createElement("a",{href:u.Z.get("media-data").edit_url.replace("edit?","add_subtitle?"),rel:"nofollow",title:"Edit subtitle",className:"edit-subtitle"},"EDIT SUBTITLE"):null,p.Z.get("config-user").can.deleteMedia?this.removeMediaPopup.triggerComponent():null,p.Z.get("config-user").can.deleteMedia&&this.state.isOpenRemoveMediaPopup?this.removeMediaPopup.contentComponent():null):null)),null!==n?a.createElement(Ye,{media_id:u.Z.get("media-id"),ratings_data:n}):null,a.createElement(_e,null))}}])&&Ke(t.prototype,n),s}(a.PureComponent);function it(e){return(it="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 at(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function ot(e,t){return(ot=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function rt(e,t){return!t||"object"!==it(t)&&"function"!=typeof t?st(e):t}function st(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function lt(e){return(lt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}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&&ot(e,t)}(s,e);var t,n,i,o,r=(i=s,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=lt(i);if(o){var n=lt(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return rt(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=r.call(this,e)).state={likesCounter:(0,Ce.uf)(u.Z.get("media-likes"),!1),isOpenLikesPopup:!1,likedMedia:u.Z.get("user-liked-media")},t.openLikeAction=!0,t.openLikeAction&&(t.toggleLike=t.toggleLike.bind(st(t)),t.onCompleteMediaLike=t.onCompleteMediaLike.bind(st(t)),t.onCompleteMediaUnlike=t.onCompleteMediaUnlike.bind(st(t)),t.onFailMediaLikeRequest=t.onFailMediaLikeRequest.bind(st(t))),t.onPopupsDisplayChange=t.onPopupsDisplayChange.bind(st(t)),t.likesPopup=new oe.Z(a.createElement("button",{onClick:t.openLikeAction?t.toggleLike:null},a.createElement(te.M,{type:"span"},a.createElement(ne.O,{type:"thumb_up"})),a.createElement("span",{className:"likes-counter"},t.state.likesCounter)),t.openLikeAction?null:a.createElement(re.W8,null,a.createElement("div",{className:"popup-message"},a.createElement("span",{className:"popup-message-title"},"Like this media?"),a.createElement("span",{className:"popup-message-main"},"Sign in to make your opinion count.")),a.createElement("hr",null),a.createElement("span",{className:"popup-message-bottom"},a.createElement("a",{href:p.Z.get("url-signin"),className:"button-link sign-in",title:"Sign in"},"SIGN IN"))),t.openLikeAction?null:t.onPopupsDisplayChange),t}return t=s,(n=[{key:"componentDidMount",value:function(){u.Z.on("liked_media",this.onCompleteMediaLike),u.Z.on("unliked_media",this.onCompleteMediaUnlike),u.Z.on("liked_media_failed_request",this.onFailMediaLikeRequest)}},{key:"updateStateValues",value:function(){this.setState({likesCounter:(0,Ce.uf)(u.Z.get("media-likes"),!1),likedMedia:u.Z.get("user-liked-media")},(function(){this.refs.LikeWrap.querySelector(".likes-counter").innerHTML=this.state.likesCounter}))}},{key:"toggleLike",value:function(e){e.preventDefault(),e.stopPropagation(),G[this.state.likedMedia?"unlikeMedia":"likeMedia"]()}},{key:"toggleDislike",value:function(e){e.preventDefault(),e.stopPropagation(),G[this.state.dislikedMedia?"undislikeMedia":"dislikeMedia"]()}},{key:"onCompleteMediaLike",value:function(){setTimeout(function(){this.updateStateValues(),ee.wN(p.Z.get("config-notifications").messages.addToLiked,"likedMedia")}.bind(this),100)}},{key:"onCompleteMediaUnlike",value:function(){setTimeout(function(){this.updateStateValues(),ee.wN(p.Z.get("config-notifications").messages.removeFromLiked,"unlikedMedia")}.bind(this),100)}},{key:"onFailMediaLikeRequest",value:function(){setTimeout(function(){this.updateStateValues(),ee.wN("Action failed","likedMediaRequestFail")}.bind(this),100)}},{key:"onPopupsDisplayChange",value:function(){this.setState({isOpenLikesPopup:this.likesPopup.isPopupOpen()})}},{key:"render",value:function(){return a.createElement("div",{ref:"LikeWrap",className:"like"},this.likesPopup.triggerComponent(),this.state.isOpenLikesPopup?this.likesPopup.contentComponent():null)}}])&&at(t.prototype,n),s}(a.PureComponent);function ut(e){return(ut="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 dt(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function pt(e,t){return(pt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function mt(e,t){return!t||"object"!==ut(t)&&"function"!=typeof t?ft(e):t}function ft(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)}var yt=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,i,o,r=(i=s,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=ht(i);if(o){var n=ht(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return mt(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=r.call(this,e)).state={dislikesCounter:(0,Ce.uf)(u.Z.get("media-dislikes"),!1),isOpenDislikesPopup:!1,dislikedMedia:u.Z.get("user-disliked-media")},t.openDislikeAction=p.Z.get("is-logged-in"),t.openDislikeAction=!0,t.openDislikeAction&&(t.toggleDislike=t.toggleDislike.bind(ft(t)),t.onCompleteMediaDislike=t.onCompleteMediaDislike.bind(ft(t)),t.onCompleteMediaUndislike=t.onCompleteMediaUndislike.bind(ft(t)),t.onFailMediaDislikeRequest=t.onFailMediaDislikeRequest.bind(ft(t))),t.onPopupsDisplayChange=t.onPopupsDisplayChange.bind(ft(t)),t.dislikesPopup=t.dislikesPopup||new oe.Z(a.createElement("button",{onClick:t.openDislikeAction?t.toggleDislike:null},a.createElement(te.M,{type:"span"},a.createElement(ne.O,{type:"thumb_down"})),a.createElement("span",{className:"dislikes-counter"},t.state.dislikesCounter)),t.openDislikeAction?null:a.createElement(re.W8,null,a.createElement("span",{className:"popup-message-title"},"Don't like this media?"),a.createElement("span",{className:"popup-message-main"},"Sign in to make your opinion count."),a.createElement("hr",null),a.createElement("span",{className:"popup-message-bottom"},a.createElement("a",{href:p.Z.get("url-signin"),className:"button-link sign-in",title:"Sign in"},"SIGN IN"))),t.openDislikeAction?null:t.onPopupsDisplayChange),t}return t=s,(n=[{key:"componentDidMount",value:function(){u.Z.on("disliked_media",this.onCompleteMediaDislike),u.Z.on("undisliked_media",this.onCompleteMediaUndislike),u.Z.on("disliked_media_failed_request",this.onFailMediaDislikeRequest)}},{key:"updateStateValues",value:function(){this.setState({dislikesCounter:(0,Ce.uf)(u.Z.get("media-dislikes"),!1),dislikedMedia:u.Z.get("user-disliked-media")},(function(){this.refs.DislikeWrap.querySelector(".dislikes-counter").innerHTML=this.state.dislikesCounter}))}},{key:"toggleDislike",value:function(e){e.preventDefault(),e.stopPropagation(),G[this.state.dislikedMedia?"undislikeMedia":"dislikeMedia"]()}},{key:"toggleDislike",value:function(e){e.preventDefault(),e.stopPropagation(),G[this.state.dislikedMedia?"undislikeMedia":"dislikeMedia"]()}},{key:"onCompleteMediaDislike",value:function(){setTimeout(function(){this.updateStateValues(),ee.wN(p.Z.get("config-notifications").messages.addToDisliked,"dislikedMedia")}.bind(this),100)}},{key:"onCompleteMediaUndislike",value:function(){setTimeout(function(){this.updateStateValues(),ee.wN(p.Z.get("config-notifications").messages.removeFromDisliked,"undislikedMedia")}.bind(this),100)}},{key:"onFailMediaDislikeRequest",value:function(){setTimeout(function(){this.updateStateValues(),ee.wN("Action failed","dislikedMediaRequestFail")}.bind(this),100)}},{key:"onPopupsDisplayChange",value:function(){this.setState({isOpenDislikesPopup:this.dislikesPopup.isPopupOpen()})}},{key:"render",value:function(){return a.createElement("div",{ref:"DislikeWrap",className:"dislike"},this.dislikesPopup.triggerComponent(),this.state.isOpenDislikesPopup?this.dislikesPopup.contentComponent():null)}}])&&dt(t.prototype,n),s}(a.PureComponent);function gt(e){return a.createElement("div",{className:"download hidden-only-in-small"},a.createElement("a",{href:e.link,target:"_blank",download:e.title,title:"Download"},a.createElement(te.M,{type:"span"},a.createElement(ne.O,{type:"arrow_downward"})),a.createElement("span",null,"DOWNLOAD")))}n(9808),gt.propTypes={link:s().string.isRequired,title:s().string.isRequired},n(9751),n(9628);var bt=n(8534),vt=n(3562);function wt(e){return(wt="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 Et(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function _t(e,t){return(_t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function kt(e,t){return!t||"object"!==wt(t)&&"function"!=typeof t?Pt(e):t}function Pt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function St(e){return(St=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}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&&_t(e,t)}(s,e);var t,n,i,o,r=(i=s,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=St(i);if(o){var n=St(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return kt(this,e)});function s(e){var t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),t=r.call(this,e);var n,i,o=u.Z.get("media-data"),l=o.encodings_info;for(n in t.state={isOpenDownloadOptionsMenu:!1,downloadOptionsCurrentPage:"main"},t.title=o.title,t.downloadOptionsList={},l)if(l.hasOwnProperty(n)&&Object.keys(l[n]).length)for(i in l[n])l[n].hasOwnProperty(i)&&"success"===l[n][i].status&&100===l[n][i].progress&&(t.downloadOptionsList[l[n][i].title]={text:n+" - "+i.toUpperCase()+" ("+l[n][i].size+")",link:(0,h.U)(l[n][i].url,p.Z.get("config-site").url),linkAttr:{target:"_blank",download:o.title+"_"+n+"_"+i.toUpperCase()}});return t.downloadOptionsList.original_media_url={text:"Original file ("+o.size+")",link:(0,h.U)(o.original_media_url,p.Z.get("config-site").url),linkAttr:{target:"_blank",download:o.title}},t.downloadOptionsPages={main:a.createElement("div",{className:"main-options"},a.createElement(re.W8,null,a.createElement(bt.S,{items:Object.values(t.downloadOptionsList)})))},t.onPopupsDisplayChange=t.onPopupsDisplayChange.bind(Pt(t)),t.initDownloadsPopup(),t}return t=s,(n=[{key:"initDownloadsPopup",value:function(){this.downloadsPopup=Object.keys(this.downloadOptionsPages).length?new oe.Z(a.createElement("button",null,a.createElement(te.M,{type:"span"},a.createElement(ne.O,{type:"arrow_downward"})),a.createElement("span",null,"DOWNLOAD")),a.createElement(vt.o,{pageChangeCallback:null,initPage:"main",focusFirstItemOnPageChange:!1,pages:this.downloadOptionsPages,pageChangeSelector:".change-page",pageIdSelectorAttr:"data-page-id"}),this.onPopupsDisplayChange):null}},{key:"onPopupsDisplayChange",value:function(){this.setState({isOpenDownloadOptionsMenu:this.downloadsPopup.isPopupOpen(),downloadOptionsCurrentPage:this.downloadsPopup.isPopupOpen()?this.state.downloadOptionsCurrentPage:"main"})}},{key:"render",value:function(){return a.createElement("div",{className:"video-downloads hidden-only-in-small"},this.downloadsPopup.triggerComponent(),this.state.isOpenDownloadOptionsMenu?a.createElement("div",{className:"nav-page-"+this.state.downloadOptionsCurrentPage},this.downloadsPopup.contentComponent()):null)}}])&&Et(t.prototype,n),s}(a.PureComponent),Ot=n(6008);function Rt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],i=!0,a=!1,o=void 0;try{for(var r,s=e[Symbol.iterator]();!(i=(r=s.next()).done)&&(n.push(r.value),!t||n.length!==t);i=!0);}catch(e){a=!0,o=e}finally{try{i||null==s.return||s.return()}finally{if(a)throw o}}return n}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Mt(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)?Mt(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 Mt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Nt(e){return e.renderDate?a.createElement("label",null,a.createElement("input",{type:"checkbox",checked:e.isChecked,onChange:function(t){t.persist(),e.isChecked?G.removeMediaFromPlaylist(e.playlistId,u.Z.get("media-id")):G.addMediaToPlaylist(e.playlistId,u.Z.get("media-id"))}}),a.createElement("span",null,e.title)):null}function Dt(e){var t=(0,a.useRef)(null),n=(0,a.useRef)(null),i=Rt((0,a.useState)(new Date),2),o=i[0],r=i[1],s=Rt((0,a.useState)(u.Z.get("playlists")),2),l=s[0],c=s[1],d=Rt((0,a.useState)(!1),2),m=d[0],f=d[1];function h(){E()}function y(){c(u.Z.get("playlists")),r(new Date)}function g(){c(u.Z.get("playlists")),r(new Date),setTimeout((function(){ee.wN("Media added to playlist","playlistMediaAdditionComplete")}),100)}function b(){setTimeout((function(){ee.wN("Media's addition to playlist failed","playlistMediaAdditionFail")}),100)}function v(){c(u.Z.get("playlists")),r(new Date),setTimeout((function(){ee.wN("Media removed from playlist","playlistMediaRemovalComplete")}),100)}function w(){setTimeout((function(){ee.wN("Media's removal from playlist failed","playlistMediaaRemovalFail")}),100)}function E(){null!==n.current&&(n.current.style.maxHeight=window.innerHeight-74-(t.current.offsetHeight-n.current.offsetHeight)+"px")}function _(){f(!m),E()}return(0,a.useEffect)((function(){E()})),(0,a.useEffect)((function(){return p.Z.on("window_resize",h),u.Z.on("playlists_load",y),u.Z.on("media_playlist_addition_completed",g),u.Z.on("media_playlist_addition_failed",b),u.Z.on("media_playlist_removal_completed",v),u.Z.on("media_playlist_removal_failed",w),function(){p.Z.removeListener("window_resize",h),u.Z.removeListener("playlists_load",y),u.Z.removeListener("media_playlist_addition_completed",g),u.Z.removeListener("media_playlist_addition_failed",b),u.Z.removeListener("media_playlist_removal_completed",v),u.Z.removeListener("media_playlist_removal_failed",w)}}),[]),a.createElement("div",{ref:t,className:"saveto-popup"},a.createElement("div",{className:"saveto-title"},"Save to...",a.createElement(te.M,{type:"button",onClick:function(){f(!1),void 0!==e.triggerPopupClose&&e.triggerPopupClose()}},a.createElement(ne.O,{type:"close"}))),l.length?a.createElement("div",{ref:n,className:"saveto-select"},function(){for(var e=u.Z.get("media-id"),t=[],n=0;n<l.length;)t.push(a.createElement("div",{key:"playlist_"+l[n].playlist_id},a.createElement(Nt,{renderDate:o,title:l[n].title,privacy:l[n].status,isChecked:-1<l[n].media_list.indexOf(e),playlistId:l[n].playlist_id}))),n+=1;return t}()):null,m?a.createElement("div",{className:"saveto-new-playlist"},a.createElement(Ot.A,{onCancel:_,onPlaylistSave:function(e){G.addNewPlaylist(e),_()}})):a.createElement(te.M,{className:"saveto-create",type:"button",onClick:_},a.createElement(ne.O,{type:"add"}),"Create a new playlist"))}function Zt(e){return(Zt="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){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function Tt(e,t){return(Tt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function xt(e,t){return!t||"object"!==Zt(t)&&"function"!=typeof t?Lt(e):t}function Lt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function At(e){return(At=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}n(8024),Nt.propTypes={playlistId:s().string,isChecked:s().bool,title:s().string},Nt.defaultProps={isChecked:!1,title:""},Dt.propTypes={triggerPopupClose:s().func};var jt=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&&Tt(e,t)}(s,e);var t,n,i,o,r=(i=s,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=At(i);if(o){var n=At(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return xt(this,e)});function s(e){var t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),(t=r.call(this,e)).state={isOpenPopup:!1,popupCurrentPage:"selectPlaylist"},t.onPopupsDisplayChange=t.onPopupsDisplayChange.bind(Lt(t)),t.onPopupPageChange=t.onPopupPageChange.bind(Lt(t)),t.triggerPopupClose=t.triggerPopupClose.bind(Lt(t));var n={selectPlaylist:a.createElement("div",{className:"popup-fullscreen"},a.createElement(re.W8,null,a.createElement("span",{className:"popup-fullscreen-overlay"}),a.createElement(Dt,{triggerPopupClose:t.triggerPopupClose}))),createPlaylist:a.createElement("div",{className:"popup-fullscreen"},a.createElement(re.W8,null,a.createElement("span",{className:"popup-fullscreen-overlay"})))};return t.sharePopup=new oe.Z(a.createElement("button",null,a.createElement(te.M,{type:"span"},a.createElement(ne.O,{type:"playlist_add"})),a.createElement("span",null,"SAVE")),a.createElement(vt.o,{initPage:t.state.popupCurrentPage,pageChangeSelector:".change-page",pageIdSelectorAttr:"data-page-id",pages:n,focusFirstItemOnPageChange:!1,pageChangeCallback:t.onPopupPageChange}),t.onPopupsDisplayChange),t}return t=s,(n=[{key:"onPopupsDisplayChange",value:function(){this.setState({isOpenPopup:this.sharePopup.isPopupOpen()})}},{key:"onPopupPageChange",value:function(e){this.setState({popupCurrentPage:e})}},{key:"triggerPopupClose",value:function(){this.sharePopup.setOpenPopupState(!1)}},{key:"render",value:function(){return a.createElement("div",{className:"save"},this.sharePopup.triggerComponent(),this.state.isOpenPopup?this.sharePopup.contentComponent():null)}}])&&It(t.prototype,n),s}(a.PureComponent),Ft=n(1395);function Ut(e){return(Ut="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){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function Wt(e,t){return(Wt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ht(e,t){return!t||"object"!==Ut(t)&&"function"!=typeof t?qt(e):t}function qt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function zt(e){return(zt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Gt=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&&Wt(e,t)}(s,e);var t,n,i,o,r=(i=s,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=zt(i);if(o){var n=zt(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return Ht(this,e)});function s(e){var t,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),(t=r.call(this,e)).state={displayNext:!1,displayPrev:!1,maxFormContentHeight:p.Z.get("window-inner-height")-196,maxPopupWidth:518>p.Z.get("window-inner-width")-80?p.Z.get("window-inner-width")-80:null},t.onClickCopyMediaLink=t.onClickCopyMediaLink.bind(qt(t)),t.onCompleteCopyMediaLink=t.onCompleteCopyMediaLink.bind(qt(t)),t.inlineSlider=null,t.nextSlide=t.nextSlide.bind(qt(t)),t.prevSlide=t.prevSlide.bind(qt(t)),t.previousBtn=a.createElement("span",{className:"previous-slide"},a.createElement(te.M,{buttonShadow:!0,onClick:t.prevSlide},a.createElement("i",{className:"material-icons"},"keyboard_arrow_left"))),t.nextBtn=a.createElement("span",{className:"next-slide"},a.createElement(te.M,{buttonShadow:!0,onClick:t.nextSlide},a.createElement("i",{className:"material-icons"},"keyboard_arrow_right")));var i=function(){for(var e=p.Z.get("config-media-share").options,t=u.Z.get("media-url"),n=u.Z.get("media-data").title,i={},a=0;a<e.length;){switch(e[a]){case"embed":"video"===u.Z.get("media-data").media_type&&(i[e[a]]={});break;case"email":i[e[a]]={title:"Email",shareUrl:"mailto:?body="+u.Z.get("media-url")};break;case"fb":i[e[a]]={title:"Facebook",shareUrl:"https://www.facebook.com/sharer.php?u="+t};break;case"tw":i[e[a]]={title:"Twitter",shareUrl:"https://twitter.com/intent/tweet?url="+t};break;case"reddit":i[e[a]]={title:"reddit",shareUrl:"https://reddit.com/submit?url="+t+"&title="+n};break;case"tumblr":i[e[a]]={title:"Tumblr",shareUrl:"https://www.tumblr.com/widgets/share/tool?canonicalUrl="+t+"&title="+n};break;case"pinterest":i[e[a]]={title:"Pinterest",shareUrl:"http://pinterest.com/pin/create/link/?url="+t};break;case"vk":i[e[a]]={title:"ВКонтакте",shareUrl:"http://vk.com/share.php?url="+t+"&title="+n};break;case"linkedin":i[e[a]]={title:"LinkedIn",shareUrl:"https://www.linkedin.com/shareArticle?mini=true&url="+t};break;case"mix":i[e[a]]={title:"Mix",shareUrl:"https://mix.com/add?url="+t};break;case"whatsapp":i[e[a]]={title:"WhatsApp",shareUrl:"whatsapp://send?text="+t};break;case"telegram":i[e[a]]={title:"Telegram",shareUrl:"https://t.me/share/url?url="+t+"&text="+n}}a+=1}return i}();for(n in t.shareOptionsElems=[],i)i.hasOwnProperty(n)&&("embed"===n?t.shareOptionsElems.push(a.createElement("div",{key:"share-"+n,className:"sh-option share-"+n+"-opt"},a.createElement("button",{className:"sh-option change-page","data-page-id":"shareEmbed"},a.createElement("span",null,a.createElement("i",{className:"material-icons"},"code")),a.createElement("span",null,"Embed")))):"whatsapp"===n?t.shareOptionsElems.push(a.createElement("div",{key:"share-"+n,className:"sh-option share-"+n},a.createElement("a",{href:i[n].shareUrl,title:"",target:"_blank","data-action":"share/whatsapp/share"},a.createElement("span",null),a.createElement("span",null,i[n].title)))):"email"===n?t.shareOptionsElems.push(a.createElement("div",{key:"share-email",className:"sh-option share-email"},a.createElement("a",{href:i[n].shareUrl,title:""},a.createElement("span",null,a.createElement("i",{className:"material-icons"},"email")),a.createElement("span",null,i[n].title)))):t.shareOptionsElems.push(a.createElement("div",{key:"share-"+n,className:"sh-option share-"+n},a.createElement("a",{href:i[n].shareUrl,title:"",target:"_blank"},a.createElement("span",null),a.createElement("span",null,i[n].title)))));return t.onWindowResize=t.onWindowResize.bind(qt(t)),t}return t=s,(n=[{key:"componentDidMount",value:function(){this.enableEvents(),this.updateSlider()}},{key:"componentDidUpdate",value:function(){this.updateSlider()}},{key:"componentWillUnmount",value:function(){this.disableEvents(),this.inlineSlider=null}},{key:"onWindowResize",value:function(){this.setState({maxFormContentHeight:p.Z.get("window-inner-height")-212,maxPopupWidth:518>p.Z.get("window-inner-width")-80?p.Z.get("window-inner-width")-80:null},this.updateSlider)}},{key:"updateSlider",value:function(e){if(!this.inlineSlider){var t=this.refs.MediaShareOptionsContent.querySelector(".share-options-inner");t&&(this.inlineSlider=new Ft.Z(t,".sh-option"))}this.inlineSlider&&(this.inlineSlider.updateDataState(this.shareOptionsElems.length,!0,!0),this.updateSliderButtonsView())}},{key:"nextSlide",value:function(){this.inlineSlider.nextSlide(),this.updateSliderButtonsView(),this.inlineSlider.scrollToCurrentSlide()}},{key:"prevSlide",value:function(){this.inlineSlider.previousSlide(),this.updateSliderButtonsView(),this.inlineSlider.scrollToCurrentSlide()}},{key:"updateSliderButtonsView",value:function(){this.setState({displayPrev:this.inlineSlider.hasPreviousSlide(),displayNext:this.inlineSlider.hasNextSlide()})}},{key:"enableEvents",value:function(){p.Z.on("window_resize",this.onWindowResize),u.Z.on("copied_media_link",this.onCompleteCopyMediaLink)}},{key:"disableEvents",value:function(){p.Z.removeListener("window_resize",this.onWindowResize),u.Z.removeListener("copied_media_link",this.onCompleteCopyMediaLink)}},{key:"onClickCopyMediaLink",value:function(){G.copyShareLink(this.refs.MediaShareOptionsContent.querySelector(".copy-field input"))}},{key:"onCompleteCopyMediaLink",value:function(){setTimeout(function(){ee.wN("Link copied to clipboard","clipboardLinkCopy")}.bind(this),100)}},{key:"render",value:function(){return a.createElement("div",{ref:"MediaShareOptionsContent",style:null!==this.state.maxPopupWidth?{maxWidth:this.state.maxPopupWidth+"px"}:null},a.createElement("div",{className:"scrollable-content",style:null!==this.state.maxFormContentHeight?{maxHeight:this.state.maxFormContentHeight+"px"}:null},a.createElement("div",{className:"share-popup-title"},"Share media"),a.createElement("div",{ref:"ShareOptions",className:"share-options"},this.state.displayPrev?this.previousBtn:null,a.createElement("div",{className:"share-options-inner"},this.shareOptionsElems),this.state.displayNext?this.nextBtn:null)),a.createElement("div",{className:"copy-field"},a.createElement("div",null,a.createElement("input",{type:"text",readOnly:!0,value:u.Z.get("media-url")}),a.createElement("button",{onClick:this.onClickCopyMediaLink},"COPY"))))}}])&&Vt(t.prototype,n),s}(a.PureComponent);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 Yt(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function $t(e,t){return($t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Kt(e,t){return!t||"object"!==Bt(t)&&"function"!=typeof t?Xt(e):t}function Xt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Jt(e){return(Jt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Qt=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&&$t(e,t)}(s,e);var t,n,i,o,r=(i=s,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=Jt(i);if(o){var n=Jt(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return Kt(this,e)});function s(e){var t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),(t=r.call(this,e)).state={isOpenPopup:!1,popupCurrentPage:"shareOptions"},t.onPopupsDisplayChange=t.onPopupsDisplayChange.bind(Xt(t)),t.onPopupPageChange=t.onPopupPageChange.bind(Xt(t)),t.triggerPopupClose=t.triggerPopupClose.bind(Xt(t));var n={shareOptions:a.createElement("div",{className:"popup-fullscreen"},a.createElement(re.W8,null,a.createElement("span",{className:"popup-fullscreen-overlay"}),a.createElement(Gt,null)))};return t.sharePopup=new oe.Z(a.createElement("button",null,a.createElement(te.M,{type:"span"},a.createElement(ne.O,{type:"share"})),a.createElement("span",null,"SHARE")),a.createElement(vt.o,{initPage:t.state.popupCurrentPage,pageChangeSelector:".change-page",pageIdSelectorAttr:"data-page-id",pages:n,focusFirstItemOnPageChange:!1,pageChangeCallback:t.onPopupPageChange}),t.onPopupsDisplayChange),t}return t=s,(n=[{key:"onPopupsDisplayChange",value:function(){this.setState({isOpenPopup:this.sharePopup.isPopupOpen()})}},{key:"onPopupPageChange",value:function(e){this.setState({popupCurrentPage:e})}},{key:"triggerPopupClose",value:function(){this.sharePopup.setOpenPopupState(!1)}},{key:"render",value:function(){return a.createElement("div",{className:"share"},this.sharePopup.triggerComponent(),this.state.isOpenPopup?this.sharePopup.contentComponent():null)}}])&&Yt(t.prototype,n),s}(a.PureComponent);function en(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function tn(e){var t,n,i=(0,a.useRef)(null),o=(0,a.useRef)(null),r=(t=(0,a.useState)(null),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],i=!0,a=!1,o=void 0;try{for(var r,s=e[Symbol.iterator]();!(i=(r=s.next()).done)&&(n.push(r.value),!t||n.length!==t);i=!0);}catch(e){a=!0,o=e}finally{try{i||null==s.return||s.return()}finally{if(a)throw o}}return n}}(t,n)||function(e,t){if(e){if("string"==typeof e)return en(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)?en(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=r[0],l=r[1];function c(){l(p.Z.get("window-inner-height")-(104+i.current.offsetHeight))}return(0,a.useEffect)((function(){return c(),p.Z.on("window_resize",c),function(){p.Z.removeListener("window_resize",c)}}),[]),a.createElement("form",null,a.createElement("div",{className:"report-form",style:null!==s?{maxHeight:s+"px"}:null},a.createElement("div",{className:"form-title"},"Report media"),a.createElement("div",{className:"form-field"},a.createElement("span",{className:"label"},"URL"),a.createElement("input",{type:"text",readOnly:!0,value:e.mediaUrl})),a.createElement("div",{className:"form-field"},a.createElement("span",{className:"label"},"Description"),a.createElement("textarea",{ref:o,required:!0})),a.createElement("div",{className:"form-field form-help-text"},"Reported media is reviewed")),a.createElement("div",{ref:i,className:"form-actions-bottom"},a.createElement("button",{className:"cancel",onClick:function(t){t.stopPropagation(),t.preventDefault(),void 0!==e.cancelReportForm&&e.cancelReportForm()}},"CANCEL"),a.createElement("button",{onClick:function(t){var n=o.current.value.trim();t.stopPropagation(),""!==n&&(t.preventDefault(),void 0!==e.submitReportForm&&e.submitReportForm(n))}},"SUBMIT")))}function nn(e){return(nn="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 an(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function on(e,t){return(on=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function rn(e,t){return!t||"object"!==nn(t)&&"function"!=typeof t?sn(e):t}function sn(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ln(e){return(ln=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}tn.propTypes={mediaUrl:s().string.isRequired,cancelReportForm:s().func,submitReportForm:s().func};var cn=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&&on(e,t)}(s,e);var t,n,i,o,r=(i=s,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=ln(i);if(o){var n=ln(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return rn(this,e)});function s(e){var t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),(t=r.call(this,e)).state={isOpenMoreOptionsMenu:!1,moreOptionsCurrentPage:"main"},t.settingOptionsList={},p.Z.get("config-user").can.reportMedia&&(t.settingOptionsList.reportMedia={itemType:"open-subpage",text:"Report",icon:"flag",buttonAttr:{className:"change-page"+(u.Z.get("media-data").reported_times?" loggedin-media-reported":""),"data-page-id":"loggedInReportMedia"}}),p.Z.get("config-user").can.editMedia&&(t.settingOptionsList.mediaStatus={itemType:"open-subpage",text:"Status info",icon:"info",buttonAttr:{className:"change-page","data-page-id":"mediaStatusInfo"}}),t.downloadLink=null;var n=u.Z.get("media-data"),i=n.encodings_info;t.props.allowDownload&&p.Z.get("config-user").can.downloadMedia&&("video"!==u.Z.get("media-type")?(t.downloadLink=(0,h.U)(u.Z.get("media-original-url"),p.Z.get("config-site").url),t.downloadLink&&(t.settingOptionsList.downloadOriginal={itemType:"link",link:t.downloadLink,text:"Download",icon:"arrow_downward",itemAttr:{className:"visible-only-in-small"},linkAttr:{target:"_blank",download:n.title}})):t.settingOptionsList.downloadOriginal={itemType:"open-subpage",text:"Download",icon:"arrow_downward",itemAttr:{className:"visible-only-in-small"},buttonAttr:{className:"change-page","data-page-id":"videoDownloadOptions"}});var o=[];if(void 0!==t.settingOptionsList.downloadOriginal&&o.push(t.settingOptionsList.downloadOriginal),void 0!==t.settingOptionsList.mediaStatus&&o.push(t.settingOptionsList.mediaStatus),void 0!==t.settingOptionsList.reportMedia&&o.push(t.settingOptionsList.reportMedia),t.moreOptionsPages=o.length?{main:a.createElement("div",{className:"main-options"},a.createElement(re.W8,null,a.createElement(bt.S,{key:"main",items:o})))}:{},t.onMoreOptionsPageChangeCallback=t.onMoreOptionsPageChangeCallback.bind(sn(t)),t.onCompleteMediaReport=t.onCompleteMediaReport.bind(sn(t)),t.cancelReportForm=t.cancelReportForm.bind(sn(t)),t.submitReportForm=t.submitReportForm.bind(sn(t)),p.Z.get("config-user").can.reportMedia&&(t.moreOptionsPages.loggedInReportMedia=a.createElement("div",{className:"popup-fullscreen"},a.createElement(re.W8,null,a.createElement("span",{className:"popup-fullscreen-overlay"}),a.createElement("div",null,a.createElement(tn,{mediaUrl:u.Z.get("media-url"),submitReportForm:t.submitReportForm,cancelReportForm:t.cancelReportForm}))))),p.Z.get("config-user").can.editMedia&&(t.moreOptionsPages.mediaStatusInfo=a.createElement("div",{className:"main-options"},a.createElement(re.W8,null,a.createElement("ul",{className:"media-status-info"},a.createElement("li",null,"Media type: ",a.createElement("span",null,u.Z.get("media-data").media_type||"N/A")),a.createElement("li",null,"State: ",a.createElement("span",null,u.Z.get("media-data").state||"N/A")),a.createElement("li",null,"Review state: ",a.createElement("span",null,u.Z.get("media-data").is_reviewed?"Is reviewed":"Pending review")),"video"===u.Z.get("media-data").media_type?a.createElement("li",null,"Encoding Status: ",a.createElement("span",null,u.Z.get("media-data").encoding_status||"N/A")):null,0<u.Z.get("media-data").reported_times?a.createElement("li",{className:"reports"},"Reports: ",a.createElement("span",null,u.Z.get("media-data").reported_times)):null)))),t.props.allowDownload&&p.Z.get("config-user").can.downloadMedia&&"video"===u.Z.get("media-type")){var l,c,d={};for(l in i)if(i.hasOwnProperty(l)&&Object.keys(i[l]).length)for(c in i[l])i[l].hasOwnProperty(c)&&"success"===i[l][c].status&&100===i[l][c].progress&&(d[i[l][c].title]={text:l+" - "+c.toUpperCase()+" ("+i[l][c].size+")",link:(0,h.U)(i[l][c].url,p.Z.get("config-site").url),linkAttr:{target:"_blank",download:n.title+"_"+l+"_"+c.toUpperCase()}});d.original_media_url={text:"Original file ("+n.size+")",link:(0,h.U)(n.original_media_url,p.Z.get("config-site").url),linkAttr:{target:"_blank",download:n.title}},t.moreOptionsPages.videoDownloadOptions=a.createElement("div",{className:"video-download-options"},a.createElement(re.W8,null,a.createElement(bt.S,{key:"video-download-options",items:Object.values(d)})))}return t.onPopupsDisplayChange=t.onPopupsDisplayChange.bind(sn(t)),t.initMoreOptionsPopup(),t}return t=s,(n=[{key:"initMoreOptionsPopup",value:function(){this.moreOptionsPopup=Object.keys(this.moreOptionsPages).length?new oe.Z(a.createElement("span",null,a.createElement(te.M,{type:"button"},a.createElement(ne.O,{type:"more_horiz"}))),a.createElement(vt.o,{pageChangeCallback:this.onMoreOptionsPageChangeCallback,initPage:this.state.moreOptionsCurrentPage,focusFirstItemOnPageChange:!1,pages:this.moreOptionsPages,pageChangeSelector:".change-page",pageIdSelectorAttr:"data-page-id"}),this.onPopupsDisplayChange):null}},{key:"onMoreOptionsPageChangeCallback",value:function(e){this.setState({moreOptionsCurrentPage:e})}},{key:"componentDidMount",value:function(){this.moreOptionsPages&&u.Z.on("reported_media",this.onCompleteMediaReport)}},{key:"onCompleteMediaReport",value:function(){setTimeout(function(){this.moreOptionsPopup.setOpenPopupState(!1),ee.wN("Media Reported","reportedMedia"),u.Z.off("reported_media",this.onCompleteMediaReport),this.moreOptionsPages.loggedInReportMedia=null,this.settingOptionsList.reportMedia.itemType="div",this.settingOptionsList.reportMedia.text="Reported",this.settingOptionsList.reportMedia.divAttr={className:"reported-label loggedin-media-reported"},this.initMoreOptionsPopup(),this.forceUpdate()}.bind(this),100)}},{key:"onPopupsDisplayChange",value:function(){this.setState({isOpenMoreOptionsMenu:this.moreOptionsPopup.isPopupOpen(),moreOptionsCurrentPage:this.moreOptionsPopup.isPopupOpen()?this.state.moreOptionsCurrentPage:"main"})}},{key:"cancelReportForm",value:function(){this.moreOptionsPopup.setOpenPopupState(!1)}},{key:"submitReportForm",value:function(e){G.reportMedia(e)}},{key:"render",value:function(){return this.moreOptionsPopup?a.createElement("div",{className:"more-options active-options"+(this.props.allowDownload&&p.Z.get("config-user").can.downloadMedia&&"videoDownloadOptions"===this.state.moreOptionsCurrentPage?" video-downloads":"")+(1===Object.keys(this.settingOptionsList).length&&void 0!==this.settingOptionsList.downloadOriginal?" visible-only-in-small":"")},this.moreOptionsPopup.triggerComponent(),this.state.isOpenMoreOptionsMenu?a.createElement("div",{className:"nav-page-"+this.state.moreOptionsCurrentPage},this.moreOptionsPopup.contentComponent()):null):null}}])&&an(t.prototype,n),s}(a.PureComponent);function un(e){return(un="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 dn(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function pn(e,t){return(pn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function mn(e,t){return!t||"object"!==un(t)&&"function"!=typeof t?fn(e):t}function fn(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function hn(e){return(hn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}cn.propTypes={allowDownload:s().bool.isRequired},cn.defaultProps={allowDownload:!1};var yn=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&&pn(e,t)}(s,e);var t,n,i,o,r=(i=s,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=hn(i);if(o){var n=hn(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return mn(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=r.call(this,e)).state={likedMedia:u.Z.get("user-liked-media"),dislikedMedia:u.Z.get("user-disliked-media")},t.downloadLink="video"!==u.Z.get("media-type")?(0,h.U)(u.Z.get("media-original-url"),p.Z.get("config-site").url):null,t.updateStateValues=t.updateStateValues.bind(fn(t)),t}return t=s,(n=[{key:"componentDidMount",value:function(){u.Z.on("liked_media",this.updateStateValues),u.Z.on("unliked_media",this.updateStateValues),u.Z.on("disliked_media",this.updateStateValues),u.Z.on("undisliked_media",this.updateStateValues)}},{key:"updateStateValues",value:function(){this.setState({likedMedia:u.Z.get("user-liked-media"),dislikedMedia:u.Z.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(a.createElement("span",{key:t},a.createElement("a",{href:(0,h.U)(this.props.categories[t].url,p.Z.get("config-site").url),title:this.props.categories[t].title},this.props.categories[t].title))),t+=1;return a.createElement("div",{className:"media-under-title-categories"+(e?" over-title":"")},n)}},{key:"render",value:function(){var e=p.Z.get("config-options").pages.media.displayViews&&void 0!==this.props.views;return a.createElement("div",{className:"media-title-banner"},e&&p.Z.get("config-options").pages.media.categoriesWithTitle?this.mediaCategories(!0):null,void 0!==this.props.title?a.createElement("h1",null,this.props.title):null,"public"!==u.Z.get("media-data").state?a.createElement("div",{className:"media-labels-area"},a.createElement("span",null,u.Z.get("media-data").state)):null,a.createElement("div",{className:"media-views-actions"+(this.state.likedMedia?" liked-media":"")+(this.state.dislikedMedia?" disliked-media":"")},!e&&p.Z.get("config-options").pages.media.categoriesWithTitle?this.mediaCategories():null,e?a.createElement("div",{className:"media-views"},(0,Ce.uf)(this.props.views,!0)," ",1>=this.props.views?"view":"views"):null,a.createElement("div",{className:"media-actions"},a.createElement("div",null,p.Z.get("config-user").can.likeMedia?a.createElement(ct,null):null,p.Z.get("config-user").can.dislikeMedia?a.createElement(yt,null):null,p.Z.get("config-user").can.shareMedia?a.createElement(Qt,null):null,p.Z.get("config-user").can.saveMedia&&-1<p.Z.get("config-playlists").mediaTypes.indexOf(u.Z.get("media-type"))?a.createElement(jt,null):null,this.props.allowDownload&&p.Z.get("config-user").can.downloadMedia?this.downloadLink?a.createElement(gt,{link:this.downloadLink,title:this.props.title}):a.createElement(Ct,null):null,a.createElement(cn,{allowDownload:this.props.allowDownload})))))}}])&&dn(t.prototype,n),s}(a.PureComponent);function gn(e){return(gn="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 bn(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function vn(e,t){return(vn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function wn(e,t){return!t||"object"!==gn(t)&&"function"!=typeof t?En(e):t}function En(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _n(e){return(_n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}yn.propTypes={allowDownload:s().bool.isRequired},yn.defaultProps={allowDownload:!1};var kn=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&&vn(e,t)}(s,e);var t,n,i,o,r=(i=s,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=_n(i);if(o){var n=_n(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return wn(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=r.call(this,e)).state={videoLoaded:!1},t.onVideoLoad=t.onVideoLoad.bind(En(t)),u.Z.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,i,o,r,s=!1;return this.state.videoLoaded&&(s=void 0===(s=u.Z.get("media-data").allow_download)||!!s,e=u.Z.get("media-data").views,t=u.Z.get("media-data").categories_info,n=u.Z.get("media-data").title,i={name:u.Z.get("media-data").author_name,url:u.Z.get("media-data").author_profile,thumb:u.Z.get("media-author-thumbnail-url")},o=u.Z.get("media-data").add_date,r=u.Z.get("media-data").description),this.state.videoLoaded?a.createElement("div",{className:"viewer-info"},a.createElement("div",{className:"viewer-info-inner"},a.createElement(yn,{title:n,views:e,categories:t,allowDownload:s}),a.createElement(nt,{author:i,published:o,description:r}))):null}}])&&bn(t.prototype,n),s}(a.PureComponent),Pn=n(1345);function Sn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],i=!0,a=!1,o=void 0;try{for(var r,s=e[Symbol.iterator]();!(i=(r=s.next()).done)&&(n.push(r.value),!t||n.length!==t);i=!0);}catch(e){a=!0,o=e}finally{try{i||null==s.return||s.return()}finally{if(a)throw o}}return n}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Cn(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)?Cn(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 Cn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function On(){var e=u.Z.get("media-data");return e&&e.related_media&&e.related_media.length?e.related_media[0]:null}function Rn(e){var t=Sn((0,a.useState)(On()),2),n=t[0],i=t[1],o=Sn((0,a.useState)(p.Z.get("media-auto-play")),2),r=o[0],s=o[1];function l(){s(p.Z.get("media-auto-play"))}function c(){i(On())}return(0,a.useEffect)((function(){return u.Z.on("loaded_media_data",c),p.Z.on("switched_media_auto_play",l),function(){u.Z.removeListener("loaded_media_data",c),p.Z.removeListener("switched_media_auto_play",l)}}),[]),n?a.createElement("div",{className:"auto-play"},a.createElement("div",{className:"auto-play-header"},a.createElement("div",{className:"next-label"},"Up next"),a.createElement("div",{className:"auto-play-option"},a.createElement("label",{className:"checkbox-label right-selectbox",tabIndex:0,onKeyPress:function(e){0===e.keyCode&&ee.p$()}},"AUTOPLAY",a.createElement("span",{className:"checkbox-switcher-wrap"},a.createElement("span",{className:"checkbox-switcher"},a.createElement("input",{type:"checkbox",tabIndex:-1,checked:r,onChange:ee.p$})))))),a.createElement(Pn.C,{className:"items-list-hor",items:[n],pageItems:1,maxItems:1,singleLinkContent:!0,horizontalItemsOrientation:!0,hideDate:!0,hideViews:!p.Z.get("config-media-item").displayViews,hideAuthor:!p.Z.get("config-media-item").displayAuthor})):null}function Mn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Nn(e){var t,n,i=(t=(0,a.useState)(l()),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],i=!0,a=!1,o=void 0;try{for(var r,s=e[Symbol.iterator]();!(i=(r=s.next()).done)&&(n.push(r.value),!t||n.length!==t);i=!0);}catch(e){a=!0,o=e}finally{try{i||null==s.return||s.return()}finally{if(a)throw o}}return n}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Mn(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)?Mn(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.")}()),o=i[0],r=i[1];function s(){r(l())}function l(){var e=u.Z.get("media-data");return null!=e&&void 0!==e.related_media&&e.related_media.length?e.related_media:null}return(0,a.useEffect)((function(){return u.Z.on("loaded_media_data",s),function(){return u.Z.removeListener("loaded_media_data",s)}}),[]),o&&o.length?a.createElement(Pn.C,{className:"items-list-hor",items:e.hideFirst?o.slice(1):o,pageItems:p.Z.get("config-options").pages.media.related.initialSize,singleLinkContent:!0,horizontalItemsOrientation:!0,hideDate:!0,hideViews:!p.Z.get("config-media-item").displayViews,hideAuthor:!p.Z.get("config-media-item").displayAuthor}):null}function Dn(e){return(Dn="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 Zn(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function In(e,t){return(In=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Tn(e,t){return!t||"object"!==Dn(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 xn(e){return(xn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}n(288),Nn.propTypes={hideFirst:s().bool},Nn.defaultProps={hideFirst:!0};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&&In(e,t)}(r,e);var t,n,i,a,o=(i=r,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=xn(i);if(a){var n=xn(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return Tn(this,e)});function r(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,r),(e=o.call(this)).data={playlistId:null,enabledLoop:null,enabledShuffle:null,savedPlaylist:!1,response:null},e.browserCache=p.Z.get("browser-cache"),e}return t=r,(n=[{key:"get",value:function(e){switch(e){case"logged-in-user-playlist":return!1;case"enabled-loop":return null===this.data.playlistId&&(this.data.playlistId=u.Z.get("playlist-id"),this.data.enabledLoop=this.browserCache.get("loopPlaylist["+this.data.playlistId+"]"),this.data.enabledLoop=null===this.data.enabledLoop||this.data.enabledLoop),this.data.enabledLoop;case"enabled-shuffle":return null===this.data.playlistId&&(this.data.playlistId=u.Z.get("playlist-id"),this.data.enabledShuffle=this.browserCache.get("shufflePlaylist["+this.data.playlistId+"]"),this.data.enabledShuffle=null!==this.data.enabledShuffle&&this.data.enabledShuffle),this.data.enabledShuffle;case"saved-playlist":return this.data.savedPlaylist}return null}},{key:"actions_handler",value:function(e){switch(e.type){case"TOGGLE_LOOP":null===this.data.playlistId&&(this.data.playlistId=u.Z.get("playlist-id"),this.data.enabledLoop=this.browserCache.get("loopPlaylist["+this.data.playlistId+"]"),this.data.enabledLoop=null===this.data.enabledLoop||this.data.enabledLoop),this.data.enabledLoop=!this.data.enabledLoop,this.browserCache.set("loopPlaylist["+this.data.playlistId+"]",this.data.enabledLoop),this.emit("loop-repeat-updated");break;case"TOGGLE_SHUFFLE":null===this.data.playlistId&&(this.data.playlistId=u.Z.get("playlist-id"),this.data.enabledShuffle=this.browserCache.get("shufflePlaylist["+this.data.playlistId+"]"),this.data.enabledShuffle=null!==this.data.enabledShuffle&&this.data.enabledShuffle),this.data.enabledShuffle=!this.data.enabledShuffle,this.browserCache.set("shufflePlaylist["+this.data.playlistId+"]",this.data.enabledShuffle),this.emit("shuffle-updated");break;case"TOGGLE_SAVE":this.data.savedPlaylist=!this.data.savedPlaylist,this.emit("saved-updated")}}}])&&Zn(t.prototype,n),r}(Pe()),An=(0,Ce.v$)(new Ln,"actions_handler"),jn=n(3386);function Fn(e){return a.createElement(Pn.C,{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 Un(e){return(Un="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 Vn(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function Wn(e,t){return(Wn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Hn(e,t){return!t||"object"!==Un(t)&&"function"!=typeof t?qn(e):t}function qn(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function zn(e){return(zn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}Fn.propTypes={items:s().array.isRequired,playlistActiveItem:jn.g},Fn.defaultProps={playlistActiveItem:1};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&&Wn(e,t)}(s,e);var t,n,i,o,r=(i=s,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=zn(i);if(o){var n=zn(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return Hn(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=r.call(this,e)).state={expanded:!0,loopRepeat:An.get("enabled-loop"),shuffle:An.get("enabled-shuffle"),savedPlaylist:An.get("saved-playlist-loop"),title:e.playlistData.title,link:e.playlistData.url,authorName:e.playlistData.user,authorLink:p.Z.get("url-user-prefix")+"/"+e.playlistData.user,activeItem:e.activeItem,totalMedia:e.playlistData.media_count,items:e.playlistData.playlist_media},t.onHeaderClick=t.onHeaderClick.bind(qn(t)),t.onLoopClick=t.onLoopClick.bind(qn(t)),t.onShuffleClick=t.onShuffleClick.bind(qn(t)),t.onSaveClick=t.onSaveClick.bind(qn(t)),t.onLoopRepeatUpdate=t.onLoopRepeatUpdate.bind(qn(t)),t.onShuffleUpdate=t.onShuffleUpdate.bind(qn(t)),t.onPlaylistSaveUpdate=t.onPlaylistSaveUpdate.bind(qn(t)),An.on("loop-repeat-updated",t.onLoopRepeatUpdate),An.on("shuffle-updated",t.onShuffleUpdate),An.on("saved-updated",t.onPlaylistSaveUpdate),t}return t=s,(n=[{key:"onHeaderClick",value:function(e){this.setState({expanded:!this.state.expanded})}},{key:"onLoopClick",value:function(){xe().dispatch({type:"TOGGLE_LOOP"})}},{key:"onShuffleClick",value:function(){xe().dispatch({type:"TOGGLE_SHUFFLE"})}},{key:"onSaveClick",value:function(){xe().dispatch({type:"TOGGLE_SAVE"})}},{key:"onShuffleUpdate",value:function(){var e=this;this.setState({shuffle:An.get("enabled-shuffle")},(function(){e.state.shuffle?ee.wN("Playlist shuffle is on","shuffle-on"):ee.wN("Playlist shuffle is off","shuffle-off")}))}},{key:"onLoopRepeatUpdate",value:function(){var e=this;this.setState({loopRepeat:An.get("enabled-loop")},(function(){e.state.loopRepeat?ee.wN("Playlist loop is on","loop-on"):ee.wN("Playlist loop is off","loop-off")}))}},{key:"onPlaylistSaveUpdate",value:function(){var e=this;this.setState({savedPlaylist:An.get("saved-playlist")},(function(){e.state.savedPlaylist?ee.wN("Added to playlists library","added-to-playlists-lib"):ee.wN("Removed from playlists library","removed-from-playlists-lib")}))}},{key:"render",value:function(){return a.createElement("div",{className:"playlist-view-wrap"},a.createElement("div",{className:"playlist-view"+(this.state.expanded?" playlist-expanded-view":"")},a.createElement("div",{className:"playlist-header"},a.createElement("div",{className:"playlist-title"},a.createElement("a",{href:this.state.link,title:this.state.title},this.state.title)),a.createElement("div",{className:"playlist-meta"},a.createElement("span",null,a.createElement("a",{href:this.state.authorLink,title:this.state.authorName},this.state.authorName))," - ",a.createElement("span",{className:"counter"},this.state.activeItem," / ",this.state.totalMedia)),a.createElement(te.M,{className:"toggle-playlist-view",onClick:this.onHeaderClick},this.state.expanded?a.createElement("i",{className:"material-icons"},"keyboard_arrow_up"):a.createElement("i",{className:"material-icons"},"keyboard_arrow_down"))),this.state.expanded?a.createElement("div",{className:"playlist-actions"},a.createElement(te.M,{className:this.state.loopRepeat?"active":"",onClick:this.onLoopClick,title:"Loop playlist"},a.createElement("i",{className:"material-icons"},"repeat"))):null,this.state.expanded&&this.state.items.length?a.createElement("div",{className:"playlist-media"},a.createElement(Fn,{items:this.state.items,playlistActiveItem:this.state.activeItem})):null))}}])&&Vn(t.prototype,n),s}(a.PureComponent);function Bn(e){return(Bn="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 Yn(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function $n(e,t){return($n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Kn(e,t){return!t||"object"!==Bn(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 Xn(e){return(Xn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}Gn.propTypes={playlistData:s().object.isRequired,activeItem:jn.g},Gn.defaultProps={};var Jn=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&&$n(e,t)}(s,e);var t,n,i,o,r=(i=s,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=Xn(i);if(o){var n=Xn(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return Kn(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=r.call(this,e)).state={playlistData:e.playlistData,isPlaylistPage:!!e.playlistData,activeItem:0},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}return t=s,(n=[{key:"render",value:function(){return a.createElement("div",{className:"viewer-sidebar"},this.state.isPlaylistPage?a.createElement(Gn,{activeItem:this.state.activeItem,playlistData:this.props.playlistData}):a.createElement(Rn,null),a.createElement(Nn,{hideFirst:!this.state.isPlaylistPage}))}}])&&Yn(t.prototype,n),s}(a.PureComponent);function Qn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],i=!0,a=!1,o=void 0;try{for(var r,s=e[Symbol.iterator]();!(i=(r=s.next()).done)&&(n.push(r.value),!t||n.length!==t);i=!0);}catch(e){a=!0,o=e}finally{try{i||null==s.return||s.return()}finally{if(a)throw o}}return n}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ei(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)?ei(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 ei(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function ti(e){var t=(0,a.useRef)(null),n=(0,a.useRef)(null),i=Qn((0,a.useState)(null),2),o=i[0],r=i[1],s=Qn((0,a.useState)(null),2),l=s[0],c=s[1];return(0,a.useEffect)((function(){r(function(e,t,n){if(void 0!==e){var i;return i=void 0!==t&&t>e?t:e,void 0!==n&&n<i?n:i}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!==o?o:"",min:void 0!==e.minValue?e.minValue:null,max:void 0!==e.maxValue?e.maxValue:null,onChange:function(){r(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!==l?l:""},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}()))}function ni(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],i=!0,a=!1,o=void 0;try{for(var r,s=e[Symbol.iterator]();!(i=(r=s.next()).done)&&(n.push(r.value),!t||n.length!==t);i=!0);}catch(e){a=!0,o=e}finally{try{i||null==s.return||s.return()}finally{if(a)throw o}}return n}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ii(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)?ii(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 ii(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function ai(e){var t=p.Z.get("config-options").embedded.video.dimensions,n=(0,a.useRef)(null),i=(0,a.useRef)(null),r=(0,a.useRef)(null),s=(0,a.useRef)(null),l=(0,a.useRef)(null),c=ni((0,a.useState)(window.innerHeight-144+56),2),d=c[0],m=c[1],f=ni((0,a.useState)(!1),2),h=f[0],y=f[1],g=ni((0,a.useState)("16:9"),2),b=g[0],v=g[1],w=ni((0,a.useState)(t.width),2),E=w[0],_=w[1],k=ni((0,a.useState)(t.widthUnit),2),P=k[0],S=k[1],C=ni((0,a.useState)(t.height),2),O=C[0],R=C[1],M=ni((0,a.useState)(t.heightUnit),2),N=M[0],D=M[1],Z=ni((0,a.useState)(60),2),I=Z[0],T=Z[1],x=ni((0,a.useState)(60),2),L=x[0],A=x[1],j=ni((0,a.useState)([{key:"px",label:"px"},{key:"percent",label:"%"}]),2),F=j[0],U=j[1];function V(){m(window.innerHeight-144+56),T(r.current.offsetHeight),A(l.current.offsetHeight)}function W(){setTimeout((function(){ee.wN("Embed media code copied to clipboard","clipboardEmbedMediaCodeCopy")}),100)}return(0,a.useEffect)((function(){m(window.innerHeight-144+56),T(r.current.offsetHeight),A(l.current.offsetHeight)})),(0,a.useEffect)((function(){return p.Z.on("window_resize",V),u.Z.on("copied_embed_media_code",W),function(){p.Z.removeListener("window_resize",V),u.Z.removeListener("copied_embed_media_code",W)}}),[]),a.createElement("div",{className:"share-embed",style:{maxHeight:d+"px"}},a.createElement("div",{className:"share-embed-inner"},a.createElement("div",{className:"on-left"},a.createElement("div",{className:"media-embed-wrap"},a.createElement(o.Z,{data:u.Z.get("media-data"),inEmbed:!0}))),a.createElement("div",{ref:i,className:"on-right"},a.createElement("div",{ref:r,className:"on-right-top"},a.createElement("div",{className:"on-right-top-inner"},a.createElement("span",{className:"ttl"},"Embed Video"),a.createElement(te.M,{type:"button",onClick:function(){void 0!==e.triggerPopupClose&&e.triggerPopupClose()}},a.createElement(ne.O,{type:"close"})))),a.createElement("div",{ref:s,className:"on-right-middle",style:{top:I+"px",bottom:L+"px"}},a.createElement("textarea",{readOnly:!0,value:'<iframe width="'+("percent"===P?E+"%":E)+'" height="'+("percent"===N?O+"%":O)+'" src="'+p.Z.get("url-embed")+u.Z.get("media-id")+'" frameborder="0" allowfullscreen></iframe>'}),a.createElement("div",{className:"iframe-config"},a.createElement("div",{className:"iframe-config-options-title"},"Embed options"),a.createElement("div",{className:"iframe-config-option"},a.createElement("div",{className:"option-content"},a.createElement("div",{className:"ratio-options"},a.createElement("div",{className:"options-group"},a.createElement("label",{style:{minHeight:"36px"}},a.createElement("input",{type:"checkbox",checked:h,onChange:function(){var e=!h,t=b.split(":"),n=t[0],i=t[1];y(e),S(e?"px":P),D(e?"px":N),R(e?parseInt(E*i/n,10):O),U(e?[{key:"px",label:"px"}]:[{key:"px",label:"px"},{key:"percent",label:"%"}])}}),"Keep aspect ratio")),h?a.createElement("div",{className:"options-group"},a.createElement("select",{ref:n,onChange:function(){var e=n.current.value,t=e.split(":"),i=t[0],a=t[1];v(e),R(h?parseInt(E*a/i,10):O)},value:b},a.createElement("optgroup",{label:"Horizontal orientation"},a.createElement("option",{value:"16:9"},"16:9"),a.createElement("option",{value:"4:3"},"4:3"),a.createElement("option",{value:"3:2"},"3:2")),a.createElement("optgroup",{label:"Vertical orientation"},a.createElement("option",{value:"9:16"},"9:16"),a.createElement("option",{value:"3:4"},"3:4"),a.createElement("option",{value:"2:3"},"2:3")))):null),a.createElement("br",null),a.createElement("div",{className:"options-group"},a.createElement(ti,{valueCallback:function(e){e=""===e?0:e;var t=b.split(":"),n=t[0],i=t[1];_(e),R(h?parseInt(e*i/n,10):O)},unitCallback:function(e){S(e)},label:"Width",defaultValue:parseInt(E,10),defaultUnit:P,minValue:1,maxValue:99999,units:F})),a.createElement("div",{className:"options-group"},a.createElement(ti,{valueCallback:function(e){e=""===e?0:e;var t=b.split(":"),n=t[0],i=t[1];R(e),_(h?parseInt(e*n/i,10):E)},unitCallback:function(e){D(e)},label:"Height",defaultValue:parseInt(O,10),defaultUnit:N,minValue:1,maxValue:99999,units:F})))))),a.createElement("div",{ref:l,className:"on-right-bottom"},a.createElement("button",{onClick:function(){G.copyEmbedMediaCode(s.current.querySelector("textarea"))}},"COPY")))))}function oi(e){return(oi="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 ri(e,t){return(ri=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function si(e,t){return!t||"object"!==oi(t)&&"function"!=typeof t?li(e):t}function li(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ci(e){return(ci=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}ti.propTypes={label:s().string,units:s().array.isRequired,defaultUnit:s().string,defaultValue:s().number,minValue:s().number,maxValue:s().number,valueCallback:s().func,unitCallback:s().func},ai.propTypes={triggerPopupClose:s().func};var ui=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&&ri(e,t)}(o,e);var t,n,i=(t=o,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,i=ci(t);if(n){var a=ci(this).constructor;e=Reflect.construct(i,arguments,a)}else e=i.apply(this,arguments);return si(this,e)});function o(e){var t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),(t=i.call(this,e)).state={isOpenPopup:!1,popupCurrentPage:"shareOptions"},t.onPopupsDisplayChange=t.onPopupsDisplayChange.bind(li(t)),t.onPopupPageChange=t.onPopupPageChange.bind(li(t)),t.triggerPopupClose=t.triggerPopupClose.bind(li(t));var n={shareOptions:a.createElement("div",{className:"popup-fullscreen"},a.createElement(re.W8,null,a.createElement("span",{className:"popup-fullscreen-overlay"}),a.createElement(Gt,null))),shareEmbed:a.createElement("div",{className:"popup-fullscreen share-embed-popup"},a.createElement(re.W8,null,a.createElement("span",{className:"popup-fullscreen-overlay"}),a.createElement(ai,{triggerPopupClose:t.triggerPopupClose})))};return t.sharePopup=new oe.Z(a.createElement("button",null,a.createElement(te.M,{type:"span"},a.createElement(ne.O,{type:"share"})),a.createElement("span",null,"SHARE")),a.createElement(vt.o,{initPage:t.state.popupCurrentPage,pageChangeSelector:".change-page",pageIdSelectorAttr:"data-page-id",pages:n,focusFirstItemOnPageChange:!1,pageChangeCallback:t.onPopupPageChange}),t.onPopupsDisplayChange),t}return o}(Qt);function di(e){return(di="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 pi(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function mi(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function fi(e,t){return(fi=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function hi(e,t){return!t||"object"!==di(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 yi(e){return(yi=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var gi=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&&fi(e,t)}(s,e);var t,n,i,o,r=(i=s,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=yi(i);if(o){var n=yi(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return hi(this,e)});function s(){return pi(this,s),r.apply(this,arguments)}return t=s,(n=[{key:"render",value:function(){var e=p.Z.get("config-options").pages.media.displayViews&&void 0!==this.props.views;return a.createElement("div",{className:"media-title-banner"},e&&p.Z.get("config-options").pages.media.categoriesWithTitle?this.mediaCategories(!0):null,void 0!==this.props.title?a.createElement("h1",null,this.props.title):null,"public"!==u.Z.get("media-data").state?a.createElement("div",{className:"media-labels-area"},a.createElement("span",null,u.Z.get("media-data").state)):null,a.createElement("div",{className:"media-views-actions"+(this.state.likedMedia?" liked-media":"")+(this.state.dislikedMedia?" disliked-media":"")},!e&&p.Z.get("config-options").pages.media.categoriesWithTitle?this.mediaCategories():null,e?a.createElement("div",{className:"media-views"},(0,Ce.uf)(this.props.views,!0)," ",1>=this.props.views?"view":"views"):null,a.createElement("div",{className:"media-actions"},a.createElement("div",null,p.Z.get("config-user").can.likeMedia?a.createElement(ct,null):null,p.Z.get("config-user").can.dislikeMedia?a.createElement(yt,null):null,p.Z.get("config-user").can.shareMedia?a.createElement(ui,null):null,p.Z.get("config-user").can.saveMedia&&-1<p.Z.get("config-playlists").mediaTypes.indexOf(u.Z.get("media-type"))?a.createElement(jt,null):null,this.props.allowDownload&&p.Z.get("config-user").can.downloadMedia?this.downloadLink?a.createElement(gt,{link:this.downloadLink,title:this.props.title}):a.createElement(Ct,null):null,a.createElement(cn,{allowDownload:this.props.allowDownload})))))}}])&&mi(t.prototype,n),s}(yn);function bi(e){return(bi="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 vi(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function wi(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function Ei(e,t){return(Ei=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _i(e,t){return!t||"object"!==bi(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 ki(e){return(ki=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Pi=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&&Ei(e,t)}(s,e);var t,n,i,o,r=(i=s,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=ki(i);if(o){var n=ki(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return _i(this,e)});function s(){return vi(this,s),r.apply(this,arguments)}return t=s,(n=[{key:"render",value:function(){var e,t,n,i,o,r,s=!1;return this.state.videoLoaded&&(s=void 0===(s=u.Z.get("media-data").allow_download)||!!s,e=u.Z.get("media-data").views,t=u.Z.get("media-data").categories_info,n=u.Z.get("media-data").title,i={name:u.Z.get("media-data").author_name,url:u.Z.get("media-data").author_profile,thumb:u.Z.get("media-author-thumbnail-url")},o=u.Z.get("media-data").add_date,r=u.Z.get("media-data").description),this.state.videoLoaded?a.createElement("div",{className:"viewer-info"},a.createElement("div",{className:"viewer-info-inner"},a.createElement(gi,{title:n,views:e,categories:t,allowDownload:s}),a.createElement(nt,{author:i,published:o,description:r}))):null}}])&&wi(t.prototype,n),s}(kn);function Si(e){return(Si="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 Ci(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function Oi(e,t){return(Oi=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ri(e,t){return!t||"object"!==Si(t)&&"function"!=typeof t?Mi(e):t}function Mi(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ni(e){return(Ni=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Di(e){return(Di="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 Zi(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ii(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function Ti(e,t){return(Ti=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function xi(e,t){return!t||"object"!==Di(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 Li(e){return(Li=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ai=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&&Ti(e,t)}(l,e);var t,n,i,r,s=(i=l,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=Li(i);if(r){var n=Li(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return xi(this,e)});function l(){return Zi(this,l),s.apply(this,arguments)}return t=l,(n=[{key:"viewerContainerContent",value:function(e){switch(u.Z.get("media-type")){case"video":return a.createElement(o.Z,{data:e,inEmbed:!1});case"audio":return a.createElement(S,null);case"image":return a.createElement(Z,null);case"pdf":return a.createElement(j,null)}return a.createElement(q,null)}}])&&Ii(t.prototype,n),l}(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&&Oi(e,t)}(s,e);var t,n,i,o,r=(i=s,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=Ni(i);if(o){var n=Ni(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return Ri(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=r.call(this,e,"media")).state={wideLayout:1216<=p.Z.get("window-inner-width"),mediaLoaded:!1,mediaLoadFailed:!1,isVideoMedia:!1,theaterMode:!1,pagePlaylistLoaded:!1,pagePlaylistData:u.Z.get("playlist-data")},t.onWindowResize=t.onWindowResize.bind(Mi(t)),t.onMediaLoad=t.onMediaLoad.bind(Mi(t)),t.onMediaLoadError=t.onMediaLoadError.bind(Mi(t)),t.onPagePlaylistLoad=t.onPagePlaylistLoad.bind(Mi(t)),u.Z.on("loaded_media_data",t.onMediaLoad),u.Z.on("loaded_media_error",t.onMediaLoadError),u.Z.on("loaded_page_playlist_data",t.onPagePlaylistLoad),t}return t=s,(n=[{key:"componentDidMount",value:function(){G.loadMediaData(),p.Z.on("window_resize",this.onWindowResize)}},{key:"onWindowResize",value:function(){this.setState({wideLayout:1216<=p.Z.get("window-inner-width")})}},{key:"onPagePlaylistLoad",value:function(){this.setState({pagePlaylistLoaded:!0,pagePlaylistData:u.Z.get("playlist-data")})}},{key:"onMediaLoad",value:function(){var e="video"===u.Z.get("media-type");e?(this.onViewerModeChange=this.onViewerModeChange.bind(this),d.Z.on("changed_viewer_mode",this.onViewerModeChange),this.setState({mediaLoaded:!0,isVideoMedia:e,theaterMode:d.Z.get("in-theater-mode")})):this.setState({mediaLoaded:!0,isVideoMedia:e})}},{key:"onViewerModeChange",value:function(){this.setState({theaterMode:d.Z.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?a.createElement("div",{className:e},a.createElement(Q,null)):a.createElement("div",{className:e},[a.createElement("div",{className:"viewer-container",key:"viewer-container"},this.state.mediaLoaded&&this.state.pagePlaylistLoaded?this.viewerContainerContent(u.Z.get("media-data")):null),a.createElement("div",{key:"viewer-section-nested",className:t},!this.state.wideLayout||this.state.isVideoMedia&&this.state.theaterMode?[a.createElement(Pi,{key:"viewer-info"}),this.state.pagePlaylistLoaded?a.createElement(Jn,{key:"viewer-sidebar",mediaId:u.Z.get("media-id"),playlistData:u.Z.get("playlist-data")}):null]:[this.state.pagePlaylistLoaded?a.createElement(Jn,{key:"viewer-sidebar",mediaId:u.Z.get("media-id"),playlistData:u.Z.get("playlist-data")}):null,a.createElement(Pi,{key:"viewer-info"})])])}}])&&Ci(t.prototype,n),s}(z.T));(0,i.X)("page-media",Ai)},4860:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}}),n(7228),n(9751);var i=n(6228);function a(){var e="test123";try{return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(e){return!1}}function o(e,t){return t=parseInt(t,10)||3600,a||console.warn(["Current browser does not support localStorage."]),e?{prefix:e,seconds:t,set:function(n,o,r,s){if(a){(r=r||t)||(s=(0,i.a)(["Invalid cache expiration value",r]));try{localStorage.setItem(e+"["+n+"]",JSON.stringify({value:o,expire:(new Date).getTime()+1e3*r})),s=!0}catch(e){s=(0,i.a)([e])}}return s},get:function(t,n){return null!==(n=(n=a?localStorage.getItem(e+"["+t+"]"):null)?JSON.parse(n):null)?void 0!==n.expire&&n.expire>(new Date).getTime()?n.value:null:n},clear:function(){var t;if(a&&Object.keys(localStorage).length)for(t in localStorage)localStorage.hasOwnProperty(t)&&0===t.indexOf(e)&&localStorage.removeItem(t);return!0}}:(0,i.O)(["Cache object prefix is required"])}},9450:function(e,t,n){"use strict";n(7441),n(9751),n(6394),n(4669);var i=n(2186);function a(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var o={},r=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),o[Object.defineProperty(this,"id",{value:"MediaDurationInfo_"+Object.keys(o).length}).id]={fn:{infoToString:function(e){return e<10?"0"+e:e}}},(0,i.ZU)(t)&&this.update(t)}var t,n;return t=e,(n=[{key:"update",value:function(e){o[this.id].toString=void 0,o[this.id].ariaLabel=void 0,(0,i.ZU)(e)&&(o[this.id].days=Math.floor(e/86400),o[this.id].seconds=e%86400,o[this.id].date=o[this.id].seconds?new Date(1e3*o[this.id].seconds):null,o[this.id].hours=o[this.id].date?24*o[this.id].days+o[this.id].date.getUTCHours():0,o[this.id].minutes=o[this.id].date?o[this.id].date.getUTCMinutes():0,o[this.id].seconds=o[this.id].date?o[this.id].date.getSeconds():0)}},{key:"toString",value:function(){return void 0===o[this.id].toString&&(o[this.id].toString=(0<o[this.id].hours?o[this.id].hours+":":"")+(0<o[this.id].hours&&10>o[this.id].minutes?"0":"")+o[this.id].minutes+":"+o[this.id].fn.infoToString(o[this.id].seconds)),o[this.id].toString}},{key:"ariaLabel",value:function(){if(void 0===o[this.id].ariaLabel){var e=[];0<o[this.id].hours&&e.push(o[this.id].hours+" hours"),0<o[this.id].minutes&&e.push(o[this.id].minutes+" minutes"),0<o[this.id].seconds&&e.push(o[this.id].seconds+" seconds"),o[this.id].ariaLabel=e.join(", ")}return o[this.id].ariaLabel}},{key:"ISO8601",value:function(){return"P0Y0M0DT"+o[this.id].hours+"H"+o[this.id].minutes+"M"+o[this.id].seconds+"S"}}])&&a(t.prototype,n),e}();t.Z=r},8416:function(e,t,n){var i=n(4835).Dispatcher;e.exports=new i},2431:function(e,t,n){"use strict";n.d(t,{M:function(){return s}}),n(4517);var i=n(5466),a=n(3074),o=n.n(a);function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}).apply(this,arguments)}function s(e){var t=i.createElement("span",null,i.createElement("span",null,e.children)),n={tabIndex:e.tabIndex||null,title:e.title||null,className:"circle-icon-button"+(void 0!==e.className?" "+e.className:"")+(e.buttonShadow?" button-shadow":"")};return void 0!==e["data-page-id"]&&(n["data-page-id"]=e["data-page-id"]),void 0!==e["aria-label"]&&(n["aria-label"]=e["aria-label"]),"link"===e.type?i.createElement("a",r({},n,{href:e.href||null,rel:e.rel||null}),t):"span"===e.type?i.createElement("span",r({},n,{onClick:e.onClick||null}),t):i.createElement("button",r({},n,{onClick:e.onClick||null}),t)}s.propTypes={type:o().oneOf(["button","link","span"]),buttonShadow:o().bool,className:o().string},s.defaultProps={type:"button",buttonShadow:!1}},2331:function(e,t,n){"use strict";n.d(t,{O:function(){return r}});var i=n(5466),a=n(3074),o=n.n(a);function r(e){return e.type&&""!==e.type?i.createElement("i",{className:"material-icons","data-icon":e.type}):null}r.propTypes={type:o().string.isRequired}},8534:function(e,t,n){"use strict";n.d(t,{S:function(){return c}}),n(2070),n(4517),n(9808);var i=n(5466),a=n(3074),o=n.n(a),r=n(2331);function s(){return(s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}).apply(this,arguments)}function l(e){var t=[],n=e.itemAttr||{};void 0===n.className?n.className="":n.className+=" ";var a=e.text?e.icon&&"right"!==e.iconPos?1:0:-1,o=e.icon?e.text&&"right"===e.iconPos?1:0:-1;switch(-1<a&&(t[a]=i.createElement("span",{key:"Text"},e.text)),-1<o&&(t[o]=i.createElement("span",{key:"Icon",className:"right"===e.iconPos?"menu-item-icon-right":"menu-item-icon"},i.createElement(r.O,{type:e.icon}))),e.itemType){case"link":t=i.createElement("a",s({},e.linkAttr||{},{href:e.link,title:e.text||null}),t),n.className+="link-item"+(e.active?" active":"");break;case"button":case"open-subpage":t=i.createElement("button",s({},e.buttonAttr||{},{key:"button"}),t);break;case"label":t=i.createElement("button",s({},e.buttonAttr||{},{key:"button"}),i.createElement("span",null,e.text||null)),n.className="label-item";break;case"div":t=i.createElement("div",s({},e.divAttr||{},{key:"div"}),e.text||null)}return""!==n.className&&(n.className=" "+n.className),i.createElement("li",n,t)}function c(e){var t=e.items.map((function(e,t){return i.createElement(l,s({key:t},e))}));return t.length?i.createElement("div",{className:"nav-menu"+(e.removeVerticalPadding?" pv0":"")},i.createElement("nav",null,i.createElement("ul",null,t))):null}l.propTypes={itemType:o().oneOf(["link","open-subpage","button","label","div"]),link:o().string,icon:o().string,iconPos:o().oneOf(["left","right"]),text:o().string,active:o().bool,divAttr:o().object,buttonAttr:o().object,itemAttr:o().object,linkAttr:o().object},l.defaultProps={itemType:"link",iconPos:"left",active:!1},c.propTypes={removeVerticalPadding:o().bool,items:o().arrayOf(o().shape(l.propTypes)).isRequired},c.defaultProps={removeVerticalPadding:!1}},1395:function(e,t,n){"use strict";function i(e,t,n){return e.scrollLeft?1+Math.ceil(e.scrollLeft/t):n}function a(e,t){void 0!==e&&(this.data={dom:{wrapper:e,firstItem:e.querySelector(t)},item:{width:null}},this.data.item.width=this.data.dom.firstItem.offsetWidth,this.state={initedAllStateValues:!1,currentSlide:1,maxSlideIndex:null,slideItemsFit:null,slideItems:null,totalItems:null,wrapper:{width:null,scrollWidth:null}})}n.d(t,{Z:function(){return a}}),a.prototype.updateDataStateOnResize=function(e,t){this.data.item.width=this.data.dom.firstItem.offsetWidth,this.state.wrapper.width=this.data.dom.wrapper.offsetWidth,this.state.wrapper.scrollWidth=this.data.dom.wrapper.scrollWidth,this.state.slideItemsFit=Math.floor(this.state.wrapper.width/this.data.item.width),this.state.slideItems=Math.max(1,this.state.slideItemsFit),t&&this.state.slideItems<=this.state.slideItems&&(this.state.itemsLengthFit=this.state.slideItems),this.state.totalItems=e,this.state.maxSlideIndex=Math.max(this.state.totalItems-this.state.slideItemsFit+1),this.state.currentSlide=Math.min(this.state.currentSlide,this.state.maxSlideIndex||1)},a.prototype.updateDataState=function(e,t,n){!n&&this.state.initedAllStateValues||(this.state.initedAllStateValues=!0,this.state.wrapper.width=this.data.dom.wrapper.offsetWidth,this.state.wrapper.scrollWidth=this.data.dom.wrapper.scrollWidth,this.state.slideItemsFit=Math.floor(this.state.wrapper.width/this.data.item.width),this.state.slideItems=Math.max(1,this.state.slideItemsFit),t&&this.state.slideItems<=this.state.slideItems&&(this.state.itemsLengthFit=this.state.slideItems)),this.state.totalItems=e,this.state.maxSlideIndex=Math.max(1,this.state.totalItems-this.state.slideItemsFit+1),this.state.currentSlide=Math.min(this.state.currentSlide,this.state.maxSlideIndex)},a.prototype.nextSlide=function(){this.state.currentSlide=Math.min(i(this.data.dom.wrapper,this.data.item.width,this.state.currentSlide)+this.state.slideItems,this.state.maxSlideIndex)},a.prototype.previousSlide=function(){this.state.currentSlide=Math.max(1,i(this.data.dom.wrapper,this.data.item.width,this.state.currentSlide)-this.state.slideItems)},a.prototype.scrollToCurrentSlide=function(){this.data.dom.wrapper.scrollLeft=this.data.item.width*(this.state.currentSlide-1)},a.prototype.hasNextSlide=function(){return this.state.currentSlide<this.state.maxSlideIndex},a.prototype.hasPreviousSlide=function(){return 1<this.state.currentSlide},a.prototype.currentSlide=function(){return this.state.currentSlide},a.prototype.loadItemsToFit=function(){return 2*this.state.slideItemsFit>this.state.totalItems},a.prototype.loadMoreItems=function(){return this.state.currentSlide+this.state.slideItemsFit>=this.state.maxSlideIndex},a.prototype.itemsFit=function(){return this.state.slideItemsFit}},8024:function(e,t,n){"use strict";function i(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\b)"+t.split(" ").join("|")+"(\\b|$)","gi")," ")}function a(e,t){e.classList?e.classList.add(t):e.className+=" "+t}function o(e,t){return e.className&&new RegExp("(\\s|^)"+t+"(\\s|$)").test(e.className)}n.d(t,{dt:function(){return i},Ec:function(){return a},mO:function(){return o}}),n(7441),n(7390),n(2322),n(4669),n(3296),n(9268)},8420:function(e,t,n){"use strict";n.d(t,{A_:function(){return i.Z},j0:function(){return a.Z},GH:function(){return o.Z},Jl:function(){return r.Z},v$:function(){return s.Z},uf:function(){return l.Z},$4:function(){return c.Z},hm:function(){return u.Z},UN:function(){return d.Z},$A:function(){return p.Z},m5:function(){return m.Z},vo:function(){return f.ZP}});var i=n(1712),a=n(9752),o=n(84),r=n(9009),s=n(1438),l=n(4135),c=n(3140),u=(n(1752),n(7514),n(7634)),d=n(4582),p=n(4845),m=(n(1569),n(6203)),f=n(7188)},3699:function(e,t,n){"use strict";n.r(t),n.d(t,{loadMediaData:function(){return o},likeMedia:function(){return r},unlikeMedia:function(){return s},dislikeMedia:function(){return l},undislikeMedia:function(){return c},reportMedia:function(){return u},copyShareLink:function(){return d},copyEmbedMediaCode:function(){return p},removeMedia:function(){return m},submitComment:function(){return f},deleteComment:function(){return h},createPlaylist:function(){return y},addMediaToPlaylist:function(){return g},removeMediaFromPlaylist:function(){return b},addNewPlaylist:function(){return v}}),n(2322),n(3296);var i=n(8416),a=n.n(i);function o(){a().dispatch({type:"LOAD_MEDIA_DATA"})}function r(){a().dispatch({type:"LIKE_MEDIA"})}function s(){a().dispatch({type:"UNLIKE_MEDIA"})}function l(){a().dispatch({type:"DISLIKE_MEDIA"})}function c(){a().dispatch({type:"UNDISLIKE_MEDIA"})}function u(e){a().dispatch({type:"REPORT_MEDIA",reportDescription:e?e.replace(/\s/g,""):""})}function d(e){a().dispatch({type:"COPY_SHARE_LINK",inputElement:e})}function p(e){a().dispatch({type:"COPY_EMBED_MEDIA_CODE",inputElement:e})}function m(){a().dispatch({type:"REMOVE_MEDIA"})}function f(e){a().dispatch({type:"SUBMIT_COMMENT",commentText:e})}function h(e){a().dispatch({type:"DELETE_COMMENT",commentId:e})}function y(e){a().dispatch({type:"CREATE_PLAYLIST",playlist_data:e})}function g(e,t){a().dispatch({type:"ADD_MEDIA_TO_PLAYLIST",playlist_id:e,media_id:t})}function b(e,t){a().dispatch({type:"REMOVE_MEDIA_FROM_PLAYLIST",playlist_id:e,media_id:t})}function v(e){a().dispatch({type:"APPEND_NEW_PLAYLIST",playlist_data:e})}},2276:function(e,t,n){"use strict";n(2004),n(8407),n(5101),n(9751),n(2322),n(3296),n(9006),n(9268),n(3233),n(5466);var i=n(1590),a=n.n(i),o=n(8420),r=(n(4559),n(137)),s=n.n(r),l=n(4426);function c(e){return(c="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 u(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function p(e,t){return!t||"object"!==c(t)&&"function"!=typeof t?m(e):t}function m(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)}var h={},y=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)}(c,e);var t,n,i,a,r=(i=c,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=f(i);if(a){var n=f(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return p(this,e)});function c(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),(e=r.call(this))._MEDIA=null,e.pagePlaylistId=null,e.pagePlaylistData=null,h[Object.defineProperty(m(e),"id",{value:"MediaPageStoreData_"+Object.keys(h).length}).id]={likedMedia:!1,dislikedMedia:!1,reported_times:0,while:{deleteMedia:!1,submitComment:!1,deleteCommentId:null}},e.removeMediaResponse=e.removeMediaResponse.bind(m(e)),e.removeMediaFail=e.removeMediaFail.bind(m(e)),e.submitCommentFail=e.submitCommentFail.bind(m(e)),e.submitCommentResponse=e.submitCommentResponse.bind(m(e)),e.removeCommentFail=e.removeCommentFail.bind(m(e)),e.removeCommentResponse=e.removeCommentResponse.bind(m(e)),e}return t=c,(n=[{key:"loadData",value:function(){if(!h[this.id].mediaId){var e=((n=new(s())(window.location.href).query)?((n=n.substring(1)).split("&"),n=n.length?n.split("="):[]):n=[],n);if(e.length)for(var t=0;t<e.length;)"m"===e[t]&&(h[this.id].mediaId=e[t+1]),t+=2}var n;if(!h[this.id].mediaId)return console.warn("Invalid media id:",h[this.id].mediaId),!1;this.mediaAPIUrl=l.Z.get("api-media")+"/"+h[this.id].mediaId,this.dataResponse=this.dataResponse.bind(this),this.dataErrorResponse=this.dataErrorResponse.bind(this),(0,o.A_)(this.mediaAPIUrl,!1,this.dataResponse,this.dataErrorResponse)}},{key:"loadPlaylistData",value:function(){var e=l.Z.get("api-playlists")+"/"+this.pagePlaylistId;this.playlistDataResponse=this.playlistDataResponse.bind(this),this.playlistDataErrorResponse=this.playlistDataErrorResponse.bind(this),(0,o.A_)(e,!1,this.playlistDataResponse,this.playlistDataErrorResponse)}},{key:"playlistDataResponse",value:function(e){if(e&&e.data){for(var t=!1,n=0;n<e.data.playlist_media.length;){if(h[this.id].mediaId===e.data.playlist_media[n].friendly_token){t=!0;break}n+=1}t?this.pagePlaylistData=e.data:this.pagePlaylistId=null,this.emit("loaded_viewer_playlist_data")}else this.pagePlaylistId=null;this.emit("loaded_page_playlist_data")}},{key:"playlistDataErrorResponse",value:function(e){this.emit("loaded_viewer_playlist_error"),this.emit("loaded_page_playlist_data")}},{key:"loadComments",value:function(){this.commentsAPIUrl=l.Z.get("api-media")+"/"+h[this.id].mediaId+"/comments",this.commentsResponse=this.commentsResponse.bind(this),(0,o.A_)(this.commentsAPIUrl,!1,this.commentsResponse)}},{key:"loadPlaylists",value:function(){l.Z.get("config-user").can.saveMedia&&(this.playlistsAPIUrl=l.Z.get("api-user-playlists")+l.Z.get("user-username"),this.playlistsResponse=this.playlistsResponse.bind(this),(0,o.A_)(this.playlistsAPIUrl,!1,this.playlistsResponse))}},{key:"dataResponse",value:function(e){if(e&&e.data){switch(h[this.id].data=e.data,h[this.id].reported_times=!!h[this.id].data.reported_times,this.get("media-type")){case"video":case"audio":case"image":this.emit("loaded_"+this.get("media-type")+"_data")}this.emit("loaded_media_data")}this.loadPlaylists(),l.Z.get("config-user").can.readComment&&this.loadComments()}},{key:"dataErrorResponse",value:function(e){if(void 0!==e.type)switch(e.type){case"network":case"private":case"unavailable":h[this.id].loadErrorType=e.type,h[this.id].loadErrorMessage=void 0!==e.message?e.message:"Αn error occurred while loading the media's data",this.emit("loaded_media_error")}}},{key:"commentsResponse",value:function(e){e&&e.data&&(h[this.id].comments=e.data.count?e.data.results:[],this.emit("comments_load"))}},{key:"playlistsResponse",value:function(e){var t=this;e&&e.data&&function(){var n=e.data.count?e.data.results:[];h[t.id].playlists=[];for(var i=0,a=0;i<n.length;)(function(e){var t,i,r=this;if(n[e].user===l.Z.get("config-user").username){var s=h[r.id].playlists.length;h[r.id].playlists[s]={playlist_id:(t=n[e].url,i=t.split("/"),1<i.length?i[i.length-1]:null),title:n[e].title,description:n[e].description,add_date:n[e].add_date},(0,o.A_)(l.Z.get("config-site").url+"/"+n[e].api_url.replace(/^\//g,""),!1,(function(e){if(e&&e.data){h[r.id].playlists[s].media_list=[];for(var t,i=0;i<e.data.playlist_media.length;)2===(t=e.data.playlist_media[i].url.split("m=")).length&&h[r.id].playlists[s].media_list.push(t[1]),i+=1}(a+=1)===n.length&&this.emit("playlists_load")}))}}).bind(t)(i),i+=1}()}},{key:"requestMediaLike",value:function(){if(!h[this.id].mediaId)return console.warn("Invalid media id:",h[this.id].mediaId),!1;var e=l.Z.get("api-media")+"/"+h[this.id].mediaId+"/actions";this.likeActionResponse=this.likeActionResponse.bind(this),(0,o.j0)(e,{type:"like"},{headers:{"X-CSRFToken":(0,o.m5)()}},!1,this.likeActionResponse,function(){this.emit("liked_media_failed_request")}.bind(this))}},{key:"likeActionResponse",value:function(e){e&&(e instanceof Error||e.data&&(h[this.id].likedMedia=!0,this.emit("liked_media")))}},{key:"requestMediaDislike",value:function(){if(!h[this.id].mediaId)return console.warn("Invalid media id:",h[this.id].mediaId),!1;var e=l.Z.get("api-media")+"/"+h[this.id].mediaId+"/actions";this.dislikeActionResponse=this.dislikeActionResponse.bind(this),(0,o.j0)(e,{type:"dislike"},{headers:{"X-CSRFToken":(0,o.m5)()}},!1,this.dislikeActionResponse,function(){this.emit("disliked_media_failed_request")}.bind(this))}},{key:"dislikeActionResponse",value:function(e){e&&(e instanceof Error||e.data&&(h[this.id].dislikedMedia=!0,this.emit("disliked_media")))}},{key:"requestMediaReport",value:function(e){if(!h[this.id].mediaId)return console.warn("Invalid media id:",h[this.id].mediaId),!1;var t=l.Z.get("api-media")+"/"+h[this.id].mediaId+"/actions";this.reportActionResponse=this.reportActionResponse.bind(this),(0,o.j0)(t,{type:"report",extra_info:e},{headers:{"X-CSRFToken":(0,o.m5)()}},!1,this.reportActionResponse,this.reportActionResponse)}},{key:"reportActionResponse",value:function(e){e&&(e instanceof Error||e.data&&(h[this.id].reported_times+=1,this.emit("reported_media")))}},{key:"set",value:function(e,t){switch(e){case"media-load-error-type":h[this.id].loadErrorType=t;break;case"media-load-error-message":h[this.id].loadErrorMessage=t}}},{key:"get",value:function(e){var t,n,i,a=null;switch(e){case"playlists":a=h[this.id].playlists||[];break;case"media-load-error-type":a=void 0!==h[this.id].loadErrorType?h[this.id].loadErrorType:null;break;case"media-load-error-message":a=void 0!==h[this.id].loadErrorMessage?h[this.id].loadErrorMessage:null;break;case"media-comments":a=h[this.id].comments||[];break;case"media-data":a=h[this.id].data||null;break;case"media-id":a=h[this.id].mediaId;break;case"media-url":a=void 0!==h[this.id].data&&void 0!==h[this.id].data.url?h[this.id].data.url:"N/A";break;case"media-edit-subtitle-url":a=void 0!==h[this.id].data&&"string"==typeof h[this.id].data.add_subtitle_url?h[this.id].data.add_subtitle_url:null;break;case"media-likes":a=(t=h[this.id].likedMedia?1:0)?void 0!==h[this.id].data&&void 0!==h[this.id].data.likes?h[this.id].data.likes+t:t:void 0!==h[this.id].data&&void 0!==h[this.id].data.likes?h[this.id].data.likes:"N/A";break;case"media-dislikes":a=(t=h[this.id].dislikedMedia?1:0)?void 0!==h[this.id].data&&void 0!==h[this.id].data.dislikes?h[this.id].data.dislikes+t:t:void 0!==h[this.id].data&&void 0!==h[this.id].data.dislikes?h[this.id].data.dislikes:"N/A";break;case"media-summary":a=void 0!==h[this.id].data&&void 0!==h[this.id].data.summary?h[this.id].data.summary:null;break;case"media-production-company":a=void 0!==h[this.id].data&&void 0!==h[this.id].data.company&&null!==h[this.id].data.company?h[this.id].data.company.trim():null;break;case"media-website":a=void 0!==h[this.id].data&&void 0!==h[this.id].data.website&&null!==h[this.id].data.website?h[this.id].data.website.trim():null;break;case"display-media-license-info":a=void 0!==h[this.id].data&&void 0!==h[this.id].data.license_info;break;case"media-license-info":a=void 0!==h[this.id].data&&void 0!==h[this.id].data.license_info&&Object.keys(h[this.id].data.license_info).length?h[this.id].data.license_info:null;break;case"media-countries":a=void 0!==h[this.id].data&&void 0!==h[this.id].data.media_country_info?h[this.id].data.media_country_info:[];break;case"media-languages":a=void 0!==h[this.id].data&&void 0!==h[this.id].data.media_language_info?h[this.id].data.media_language_info:[];break;case"media-categories":a=void 0!==h[this.id].data&&void 0!==h[this.id].data.categories_info?h[this.id].data.categories_info:[];break;case"media-topics":a=void 0!==h[this.id].data&&void 0!==h[this.id].data.topics_info?h[this.id].data.topics_info:[];break;case"media-tags":a=void 0!==h[this.id].data&&void 0!==h[this.id].data.tags_info?h[this.id].data.tags_info:[];break;case"media-type":a=void 0!==h[this.id].data&&void 0!==h[this.id].data.media_type?h[this.id].data.media_type:null;break;case"media-original-url":a=void 0!==h[this.id].data&&void 0!==h[this.id].data.original_media_url?h[this.id].data.original_media_url:null;break;case"media-thumbnail-url":a=void 0!==h[this.id].data&&void 0!==h[this.id].data.thumbnail_url?h[this.id].data.thumbnail_url:null;break;case"user-liked-media":a=h[this.id].likedMedia;break;case"user-disliked-media":a=h[this.id].dislikedMedia;break;case"media-author-thumbnail-url":a=void 0!==h[this.id].data&&void 0!==h[this.id].data.author_thumbnail?l.Z.get("config-site").url+"/"+h[this.id].data.author_thumbnail.replace(/^\//g,""):null;break;case"playlist-data":a=this.pagePlaylistData;break;case"playlist-id":a=this.pagePlaylistId;break;case"playlist-next-media-url":if(!this.pagePlaylistData)break;for(n=0,i=0;i<this.pagePlaylistData.playlist_media.length;){if(h[this.id].mediaId===this.pagePlaylistData.playlist_media[i].friendly_token){n=i+1;break}i+=1}n===this.pagePlaylistData.playlist_media.length&&!0===l.Z.get("browser-cache").get("loopPlaylist["+this.pagePlaylistId+"]")&&(n=0),void 0!==this.pagePlaylistData.playlist_media[n]&&(a=this.pagePlaylistData.playlist_media[n].url+"&pl="+this.pagePlaylistId);break;case"playlist-previous-media-url":if(!this.pagePlaylistData)break;for(n=0,i=0;i<this.pagePlaylistData.playlist_media.length;){if(h[this.id].mediaId===this.pagePlaylistData.playlist_media[i].friendly_token){n=i;break}i+=1}0===n?(n=this.pagePlaylistData.playlist_media.length,!0===l.Z.get("browser-cache").get("loopPlaylist["+this.pagePlaylistId+"]")&&(n-=1)):n-=1,void 0!==this.pagePlaylistData.playlist_media[n]&&(a=this.pagePlaylistData.playlist_media[n].url+"&pl="+this.pagePlaylistId)}return a}},{key:"isVideo",value:function(){return"video"===this.get("media-type")}},{key:"onPlaylistCreationCompleted",value:function(e){e&&e.data&&this.emit("playlist_creation_completed",e.data)}},{key:"onPlaylistCreationFailed",value:function(){this.emit("playlist_creation_failed")}},{key:"onPlaylistMediaAdditionCompleted",value:function(e,t){if(t){for(var n=0;n<h[this.id].playlists.length;){if(e===h[this.id].playlists[n].playlist_id){h[this.id].playlists[n].media_list.push(h[this.id].mediaId);break}n+=1}this.emit("media_playlist_addition_completed",e)}}},{key:"onPlaylistMediaAdditionFailed",value:function(e,t){this.emit("media_playlist_addition_failed")}},{key:"onPlaylistMediaRemovalCompleted",value:function(e,t){if(t){for(var n,i,a=0;a<h[this.id].playlists.length;){if(e===h[this.id].playlists[a].playlist_id){for(i=[],n=0;n<h[this.id].playlists[a].media_list.length;)h[this.id].mediaId!==h[this.id].playlists[a].media_list[n]&&i.push(h[this.id].playlists[a].media_list[n]),n+=1;h[this.id].playlists[a].media_list=i;break}a+=1}this.emit("media_playlist_removal_completed",e)}}},{key:"onPlaylistMediaRemovalFailed",value:function(e,t){this.emit("media_playlist_removal_failed")}},{key:"actions_handler",value:function(e){switch(e.type){case"LOAD_MEDIA_DATA":h[this.id].mediaId=window.MediaCMS.mediaId||h[this.id].mediaId,this.pagePlaylistId=function(){var e=null,t=window.location.search;if(""!==t){var n=t.split("?");if(2===n.length){var i;n=n[1].split("&");for(var a=0;a<n.length;){if("pl"===(i=n[a].split("="))[0]){2===i.length&&(e=i[1]);break}a+=1}}}return e}(),this.pagePlaylistId?(this.loadPlaylistData(),this.loadData()):(this.emit("loaded_page_playlist_data"),this.loadData());break;case"UNLIKE_MEDIA":break;case"LIKE_MEDIA":h[this.id].likedMedia||h[this.id].dislikedMedia||this.requestMediaLike();break;case"DISLIKE_MEDIA":h[this.id].likedMedia||h[this.id].dislikedMedia||this.requestMediaDislike();break;case"UNDISLIKE_MEDIA":break;case"REPORT_MEDIA":h[this.id].reported_times||""!==e.reportDescription&&this.requestMediaReport(e.reportDescription);break;case"COPY_SHARE_LINK":e.inputElement instanceof HTMLElement&&(e.inputElement.select(),document.execCommand("copy"),this.emit("copied_media_link"));break;case"COPY_EMBED_MEDIA_CODE":e.inputElement instanceof HTMLElement&&(e.inputElement.select(),document.execCommand("copy"),this.emit("copied_embed_media_code"));break;case"REMOVE_MEDIA":if(h[this.id].while.deleteMedia)return;h[this.id].while.deleteMedia=!0,(0,o.Jl)(this.mediaAPIUrl,{headers:{"X-CSRFToken":(0,o.m5)()}},!1,this.removeMediaResponse,this.removeMediaFail);break;case"SUBMIT_COMMENT":if(h[this.id].while.submitComment)return;h[this.id].while.submitComment=!0,(0,o.j0)(this.commentsAPIUrl,{text:e.commentText},{headers:{"X-CSRFToken":(0,o.m5)()}},!1,this.submitCommentResponse,this.submitCommentFail);break;case"DELETE_COMMENT":if(null!==h[this.id].while.deleteCommentId)return;h[this.id].while.deleteCommentId=e.commentId,(0,o.Jl)(this.commentsAPIUrl+"/"+e.commentId,{headers:{"X-CSRFToken":(0,o.m5)()}},!1,this.removeCommentResponse,this.removeCommentFail);break;case"CREATE_PLAYLIST":(0,o.j0)(l.Z.get("api-playlists"),{title:e.playlist_data.title,description:e.playlist_data.description},{headers:{"X-CSRFToken":(0,o.m5)()}},!1,this.onPlaylistCreationCompleted.bind(this),this.onPlaylistCreationFailed.bind(this));break;case"ADD_MEDIA_TO_PLAYLIST":(0,o.GH)(l.Z.get("api-playlists")+"/"+e.playlist_id,{type:"add",media_friendly_token:e.media_id},{headers:{"X-CSRFToken":(0,o.m5)()}},!1,this.onPlaylistMediaAdditionCompleted.bind(this,e.playlist_id),this.onPlaylistMediaAdditionFailed.bind(this,e.playlist_id));break;case"REMOVE_MEDIA_FROM_PLAYLIST":(0,o.GH)(l.Z.get("api-playlists")+"/"+e.playlist_id,{type:"remove",media_friendly_token:e.media_id},{headers:{"X-CSRFToken":(0,o.m5)()}},!1,this.onPlaylistMediaRemovalCompleted.bind(this,e.playlist_id),this.onPlaylistMediaRemovalFailed.bind(this,e.playlist_id));break;case"APPEND_NEW_PLAYLIST":h[this.id].playlists.push(e.playlist_data),this.emit("playlists_load")}}},{key:"removeMediaResponse",value:function(e){e&&204===e.status&&this.emit("media_delete",h[this.id].mediaId)}},{key:"removeMediaFail",value:function(){this.emit("media_delete_fail",h[this.id].mediaId),setTimeout((function(e){h[e.id].while.deleteMedia=null}),100,this)}},{key:"removeCommentFail",value:function(e){this.emit("comment_delete_fail",h[this.id].while.deleteCommentId),setTimeout((function(e){h[e.id].while.deleteCommentId=null}),100,this)}},{key:"removeCommentResponse",value:function(e){if(e&&204===e.status){var t,n=[];for(t in h[this.id].comments)h[this.id].comments.hasOwnProperty(t)&&h[this.id].while.deleteCommentId!==h[this.id].comments[t].uid&&n.push(h[this.id].comments[t]);h[this.id].comments=n,n=null,this.emit("comment_delete",h[this.id].while.deleteCommentId)}setTimeout((function(e){h[e.id].while.deleteCommentId=null}),100,this)}},{key:"submitCommentFail",value:function(e){this.emit("comment_submit_fail"),setTimeout((function(e){h[e.id].while.submitComment=!1}),100,this)}},{key:"submitCommentResponse",value:function(e){e&&201===e.status&&e.data&&Object.keys(e.data)&&(h[this.id].comments.push(e.data),this.emit("comment_submit",e.data.uid)),setTimeout((function(e){h[e.id].while.submitComment=!1}),100,this)}}])&&u(t.prototype,n),c}(a());t.Z=(0,o.v$)(new y,"actions_handler")},5971:function(e,t,n){"use strict";n.d(t,{CE:function(){return o},X1:function(){return r}});var i=n(8416),a=n.n(i);function o(e){a().dispatch({type:"UPDATE_PLAYLIST",playlist_data:e})}function r(e,t){a().dispatch({type:"MEDIA_REMOVED_FROM_PLAYLIST",media_id:e,playlist_id:t})}},8204:function(e,t,n){"use strict";n.d(t,{T:function(){return p}}),n(5101);var i=n(5466),a=(n(6116),n(8349)),o=n(9690),r=n(7370);function s(e){return(s="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 l(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(e,t){return!t||"object"!==s(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 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&&c(e,t)}(f,e);var t,n,s,p,m=(s=f,p=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=d(s);if(p){var n=d(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return u(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=m.call(this,e),void 0!==t&&a.df(t),n}return t=f,(n=[{key:"render",value:function(){return[i.createElement(o.Z,{key:"page-main"},this.pageContent()),i.createElement(r.T,{key:"notifications"})]}}])&&l(t.prototype,n),f}(i.PureComponent)},8349:function(e,t,n){"use strict";n.d(t,{sc:function(){return o},df:function(){return r},Zr:function(){return s},vh:function(){return l},Qb:function(){return c},p$:function(){return u},wN:function(){return d}});var i=n(8416),a=n.n(i);function o(){a().dispatch({type:"TOGGLE_PAGE_SIDEBAR"})}function r(e){a().dispatch({type:"INIT_PAGE",page:e})}function s(e){a().dispatch({type:"INIT_SIDEBAR",page:e})}function l(e){a().dispatch({type:"TOGGLE_MOBILE_SEARCH_FIELD",open:e})}function c(e){a().dispatch({type:"TOGGLE_DARK_THEME"})}function u(){a().dispatch({type:"TOGGLE_AUTO_PLAY"})}function d(e,t){a().dispatch({type:"ADD_NOTIFICATION",notification:e,notificationId:t})}},4426:function(e,t,n){"use strict";n(5101),n(9751),n(2322),n(9006),n(9268),n(5466);var i,a,o=n(1590),r=n.n(o),s=n(4860),l=n(8420),c=n(8024),u=n(4547);function d(e){return(d="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 p(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function m(e,t){return(m=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function f(e,t){return!t||"object"!==d(t)&&"function"!=typeof t?h(e):t}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function y(e){return(y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var g=null,b=null,v=function(e){return b.url[e]||"#"},w=function(e){return b.url.user[e]||"#"},E=function(e){return b.url.search[e]||"#"},_=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&&m(e,t)}(d,e);var t,n,o,r,l=(o=d,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=y(o);if(r){var n=y(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return f(this,e)});function d(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,d),t=l.call(this),g||(b=(0,u.v)(window.MediaCMS),a=new s.Z(b.site.id,86400),(g={visibleMobileSearch:!1,useDarkTheme:a.get("use-dark-theme"),mediaAutoPlay:a.get("media-auto-play"),visiblePageSidebar:a.get("visible-sidebar"),existsPageSidebar:!(!document.getElementById("app-sidebar")&&!document.querySelector(".page-sidebar")),notifications:{},notificationsTime:{}}).mediaAutoPlay=null===g.mediaAutoPlay||g.mediaAutoPlay,g.useDarkTheme=null!==g.useDarkTheme?g.useDarkTheme:"dark"===b.theme.mode,g.visiblePageSidebar=1023<window.innerWidth&&(null===g.visiblePageSidebar||g.visiblePageSidebar)),g.useDarkTheme?(0,c.Ec)(document.body,"dark_theme"):(0,c.dt)(document.body,"dark_theme"),t.onWindowResize=t.onWindowResize.bind(h(t)),t.onWindowScroll=t.onWindowScroll.bind(h(t)),t.onDocumentVisibilityChange=t.onDocumentVisibilityChange.bind(h(t)),window.addEventListener("resize",t.onWindowResize),window.addEventListener("scroll",t.onWindowScroll),document.addEventListener("visibilitychange",t.onDocumentVisibilityChange),t}return t=d,(n=[{key:"onDocumentVisibilityChange",value:function(){this.emit("document_visibility_change")}},{key:"onWindowScroll",value:function(){this.emit("window_scroll")}},{key:"onWindowResize",value:function(){this.windowWidth=window.outerWidth,this.windowInnerWidth=window.innerWidth,this.windowHeight=window.outerHeight,this.windowInnerHeight=window.innerHeight,this.emit("window_resize")}},{key:"initPage",value:function(e){g.existsPageSidebar||(g.existsPageSidebar=!(!document.getElementById("app-sidebar")&&!document.querySelector(".page-sidebar")),g.existsPageSidebar&&(g.visiblePageSidebar=a.get("visible-sidebar"),g.visiblePageSidebar=null!==g.visiblePageSidebar?g.visiblePageSidebar:1023<window.innerWidth,this.emit("updated_existsPageSidebar"))),g.currentPage=e,"media"===e&&(g.visiblePageSidebar=!1,(0,c.dt)(document.body,"visible-sidebar"),this.windowWidth=window.outerWidth,this.windowInnerWidth=window.innerWidth),this.clearNotificationsTimeoutId=null;var t=window.MediaCMS.notifications?JSON.parse(window.MediaCMS.notifications):"";if(""!==t){var n=Object.keys(t);if(n.length)for(var i=0;i<n.length;)setTimeout(function(e){var t=(new Date).getTime(),n=t+"["+t+"]";g.notifications[n]=e,g.notificationsTime[n]=t,this.emit("added_notification"),this.clearNotifications()}.bind(this),100*i,t[n[i]]),i+=1}}},{key:"get",value:function(e){var t,n;switch(e){case"browser-cache":t=a;break;case"current-page":t=g.currentPage;break;case"page-sidebar-exists":t=g.existsPageSidebar;break;case"is-visible-mobile-search":t=g.visibleMobileSearch;break;case"is-visible-page-sidebar":t=g.visiblePageSidebar;break;case"use-dark-theme":t=g.useDarkTheme;break;case"media-auto-play":t=g.mediaAutoPlay;break;case"config-enabled":t=b.enabled;break;case"config-media-item":t=b.media.item;break;case"config-media-share":t=b.media.share;break;case"config-playlists":t=b.playlists;break;case"config-site":t=b.site;break;case"config-theme":t=b.theme;break;case"config-user":t=b.member;break;case"config-notifications":t=b.notifications;break;case"config-contents":t=b.contents;break;case"config-options":t=b.options;break;case"notifications":t=g.notifications;break;case"is-logged-in":t=!b.member.is.anonymous;break;case"window-width":t=this.windowWidth||window.outerWidth;break;case"window-inner-width":t=this.windowInnerWidth||window.innerWidth;break;case"window-height":t=this.windowHeight||window.outerHeight;break;case"window-inner-height":t=this.windowInnerHeight||window.innerHeight;break;case"url-search":t=E("base");break;case"url-archive-tag":case"url-archive-category":case"url-archive-topic":case"url-archive-country":case"url-archive-language":t=E(e.split("-")[2]);break;case"api-archive-tags":case"api-archive-categories":case"api-archive-topics":case"api-archive-countries":case"api-archive-languages":n=e.split("-")[2],t=b.api.archive[n]||null;break;case"api-manage-media":case"api-manage-users":case"api-manage-comments":t=function(e){return b.api.manage[e]||null}(e.split("-")[2]);break;case"api-media":case"api-featured":case"api-recommended":case"api-playlists":case"api-users":case"api-history":t=function(e){return b.api[e]||null}(e.split("-")[1]);break;case"api-search-query":case"api-search-titles":t=function(e){return b.api.search[e]||null}(e.split("-")[2]);break;case"api-user-liked":case"api-user-history":case"api-user-playlists":t=function(e){return b.api.user[e]||null}(e.split("-")[2]);break;case"url-user-prefix":t=v("home")+"/user";break;case"url-home":case"url-signin":case"url-signout":case"url-register":case"url-latest-media":case"url-featured-media":case"url-recommended-media":case"url-members":case"url-error404":case"url-embed":case"url-admin":case"url-playlists":t=v(e.split("-")[1]);break;case"url-profile-home":case"url-profile-media":case"url-profile-about":case"url-profile-playlists":t=function(e){return b.url.profile[e]||"#"}(e.split("-")[2]);break;case"url-change-password":t=v("changePassword");break;case"url-tags":case"url-categories":case"url-topics":case"url-countries":case"url-languages":t=function(e){return b.url.archive[e]||"#"}(e.split("-")[1]);break;case"url-manage-media":case"url-manage-users":case"url-manage-comments":t=function(e){return b.url.manage[e]||"#"}(e.split("-")[2]);break;case"url-history":case"url-liked-media":t=w(e.split("-")[1]);break;case"url-uploader":t=w("addMedia");break;case"url-edit-profile":t=w("editProfile");break;case"url-logged-in-user-profile-url":t=b.member.pages.home||"#";break;case"user-name":case"user-username":case"user-thumbnail":t=function(e){return b.member[e]||null}(e.split("-")[1])}return t}},{key:"clearNotifications",value:function(){var e,t,n=!1,i=!1,a=Object.keys(g.notificationsTime);if(a.length)for(t=new Date((new Date).valueOf()-6001),e=0;e<a.length;)t.getTime()<g.notificationsTime[a[e]]?i=!0:(n=!0,g.notifications[a[e]]=void 0,g.notificationsTime[a[e]]=void 0),e+=1;n&&(g.notifications=JSON.parse(JSON.stringify(g.notifications)),g.notificationsTime=JSON.parse(JSON.stringify(g.notificationsTime)),this.emit("cleared_notification")),i&&(this.clearNotificationsTimeoutId&&clearTimeout(this.clearNotificationsTimeoutId),this.clearNotificationsTimeoutId=setTimeout(function(){this.clearNotifications(),this.clearNotificationsTimeoutId=null}.bind(this),1e3))}},{key:"actions_handler",value:function(e){switch(e.type){case"INIT_PAGE":this.initPage(e.page);break;case"INIT_SIDEBAR":"media"!==g.currentPage&&g.visiblePageSidebar&&((0,c.Ec)(document.body,"visible-sidebar"),this.emit("changed_page_sidebar_visibility"));break;case"TOGGLE_PAGE_SIDEBAR":clearTimeout(i),(0,c.Ec)(document.body,"sliding-sidebar"),i=setTimeout(function(){g.visiblePageSidebar=!g.visiblePageSidebar,(g.visiblePageSidebar?c.Ec:c.dt)(document.body,"visible-sidebar"),"media"===g.currentPage?(g.visiblePageSidebar?c.Ec:c.dt)(document.body,"overflow-hidden"):((!g.visiblePageSidebar||767<window.innerWidth?c.dt:c.Ec)(document.body,"overflow-hidden"),a.set("visible-sidebar",g.visiblePageSidebar)),this.emit("changed_page_sidebar_visibility"),i=setTimeout((function(){i=null,(0,c.dt)(document.body,"sliding-sidebar")}),220)}.bind(this),20);break;case"COMPLETE_SIDEBAR_VISIBILITY_CHANGE":this.emit("completed_page_sidebar_visibility_change");break;case"TOGGLE_MOBILE_SEARCH_FIELD":g.visibleMobileSearch=!!e.open,this.emit("changed_mobile_search_field_visibility");break;case"TOGGLE_AUTO_PLAY":g.mediaAutoPlay=!g.mediaAutoPlay,a.set("media-auto-play",g.mediaAutoPlay),this.emit("switched_media_auto_play");break;case"TOGGLE_DARK_THEME":g.useDarkTheme=!g.useDarkTheme,g.useDarkTheme?(0,c.Ec)(document.body,"dark_theme"):(0,c.dt)(document.body,"dark_theme"),a.set("use-dark-theme",g.useDarkTheme),this.emit("switched_theme");break;case"ADD_NOTIFICATION":var t=(new Date).getTime(),n=(e.notificationId||t)+"["+t+"]";void 0===g.notifications[n]&&(g.notifications[n]=e.notification,g.notificationsTime[n]=t,this.emit("added_notification"),this.clearNotifications())}}}])&&p(t.prototype,n),d}(r());t.Z=(0,l.v$)(new _,"actions_handler")}},t={};function n(i){if(t[i])return t[i].exports;var a=t[i]={exports:{}};return e[i].call(a.exports,a,a.exports,n),a.exports}n.m=e,n.x=function(){},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.j=411,function(){var e={411:0},t=[[2953,431]],i=function(){},a=function(a,o){for(var r,s,l=o[0],c=o[1],u=o[2],d=o[3],p=0,m=[];p<l.length;p++)s=l[p],n.o(e,s)&&e[s]&&m.push(e[s][0]),e[s]=0;for(r in c)n.o(c,r)&&(n.m[r]=c[r]);for(u&&u(n),a&&a(o);m.length;)m.shift()();return d&&t.push.apply(t,d),i()},o=self.webpackChunk_mediacms_frontend=self.webpackChunk_mediacms_frontend||[];function r(){for(var i,a=0;a<t.length;a++){for(var o=t[a],r=!0,s=1;s<o.length;s++){var l=o[s];0!==e[l]&&(r=!1)}r&&(t.splice(a--,1),i=n(n.s=o[0]))}return 0===t.length&&(n.x(),n.x=function(){}),i}o.forEach(a.bind(null,0)),o.push=a.bind(null,o.push.bind(o));var s=n.x;n.x=function(){return n.x=s||function(){},(i=r)()}}(),n.x()}(); |