mirror of
https://github.com/mediacms-io/mediacms.git
synced 2024-11-25 17:55:16 +01:00
1 line
163 KiB
JavaScript
1 line
163 KiB
JavaScript
!function(){"use strict";var e={7251:function(e,t,n){var i=n(2667),a=(n(5101),n(5466)),o=(n(6116),n(9518)),r=n(3074),l=n.n(r),s=n(365),u=n(920),c=n.n(u),d=n(2276),p=n(2787),m=n(4426),f=n(3811);function h(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 y=n(9688),b=n(5793),g=n(6983),v=n(9450);function _(e){return(_="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 E(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 w(e,t){return(w=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function k(e,t){return!t||"object"!==_(t)&&"function"!=typeof t?C(e):t}function C(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 v.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&&w(e,t)}(l,e);var t,n,i,o,r=(i=l,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 k(this,e)});function l(e){var t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),t=r.call(this,e);var n=d.Z.get("media-data");t.AudioPlayerData={},t.audioStartedPlaying=!1;var i=(0,y.U)(n.original_media_url,s.Z._currentValue.url);t.videoSources=[{src:i,type:h(i)}],t.videoPoster=n.poster_url,t.videoPoster=t.videoPoster?t.videoPoster:n.thumbnail_url,t.videoPoster=t.videoPoster?(0,y.U)(t.videoPoster,s.Z._currentValue.url):"",t.updatePlayerVolume=t.updatePlayerVolume.bind(C(t)),t.onAudioEnd=t.onAudioEnd.bind(C(t)),t.onAudioRestart=t.onAudioRestart.bind(C(t)),m.Z.on("switched_media_auto_play",t.onUpdateMediaAutoPlay.bind(C(t))),t.wrapperClick=t.wrapperClick.bind(C(t));var a=new v.Z;return a.update(d.Z.get("media-data").duration),t.durationISO8601=a.ISO8601(),t}return t=l,(n=[{key:"componentDidMount",value:function(){this.videoSources.length||console.warn("Audio DEBUG:","Audio file doesn't exist"),this.recommendedMedia=d.Z.get("media-data").related_media.length?new g.Z(d.Z.get("media-data").related_media,this.refs.AudioElem.parentNode,this.props.inEmbed):null,this.upNextLoaderView=!this.props.inEmbed&&d.Z.get("media-data").related_media.length?new b.Z(d.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),m.Z.removeListener("window_resize",this.recommendedMedia.onResize),p.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",d.Z.get("media-data").url),e.setAttribute("title",d.Z.get("media-data").title),e.setAttribute("target","_blank"),e.innerHTML=d.Z.get("media-data").title),t&&(t.setAttribute("class","user-thumb-link"),t.setAttribute("href",d.Z.get("media-data").author_profile),t.setAttribute("title",d.Z.get("media-data").author_name),t.setAttribute("target","_blank"),t.innerHTML='<img src="'+d.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<d.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:p.Z.get("player-volume"),soundMuted:p.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),m.Z.on("window_resize",this.recommendedMedia.onResize),p.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=d.Z.get("media-data").related_media[0].url)}},{key:"onUpdateMediaAutoPlay",value:function(){this.upNextLoaderView&&(m.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&&d.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=d.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&&(m.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&&(m.Z.get("media-auto-play")?this.upNextLoaderView.showTimerView(this.AudioPlayerData.instance.isEnded()):this.upNextLoaderView.hideTimerView())}},{key:"updatePlayerVolume",value:function(e,t){p.Z.get("player-volume")!==e&&f.zZ(e),p.Z.get("player-sound-muted")!==t&&f.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"}))))}}])&&E(t.prototype,n),l}(a.PureComponent);function O(e){return(O="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 R(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 N(e,t){return!t||"object"!==O(t)&&"function"!=typeof t?D(e):t}function D(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Z(e){return(Z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}S.defaultProps={inEmbed:!1},S.propTypes={inEmbed:l().bool},n(3296),n(3233);var x=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)}(l,e);var t,n,i,o,r=(i=l,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=Z(i);if(o){var n=Z(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return N(this,e)});function l(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),(t=r.call(this,e)).state={image:t.getImageUrl()},t.state.image=t.state.image?t.state.image:d.Z.get("media-data").thumbnail_url,t.state.image=t.state.image?t.state.image:"",t.onImageLoad=t.onImageLoad.bind(D(t)),d.Z.on("loaded_image_data",t.onImageLoad),t}return t=l,(n=[{key:"getImageUrl",value:function(){var e=d.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 d.Z.get("media-original-url")?d.Z.get("media-original-url").trim():""),""===t?"#":s.Z._currentValue.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:d.Z.get("media-data").title||null})):null}}])&&R(t.prototype,n),l}(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 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 T(e,t){return(T=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function A(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 j(e){return(j=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var V=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&T(e,t)}(l,e);var t,n,i,o,r=(i=l,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 A(this,e)});function l(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),r.call(this,e)}return t=l,(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")))))}}])&&L(t.prototype,n),l}(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 H(e,t){return(H=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 q(e){return(q=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}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&&H(e,t)}(l,e);var t,n,i,o,r=(i=l,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=q(i);if(o){var n=q(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return W(this,e)});function l(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),r.call(this,e)}return t=l,(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),l}(a.PureComponent),B=n(8204),G=n(3699);function Y(e){return(Y="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 $(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function X(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 J(e,t){return!t||"object"!==Y(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 Q(e){return(Q=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var ee=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)}(l,e);var t,n,i,o,r=(i=l,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=Q(i);if(o){var n=Q(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return J(this,e)});function l(){return $(this,l),r.apply(this,arguments)}return t=l,(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"},d.Z.get("media-load-error-message")))))))}}])&&X(t.prototype,n),l}(a.PureComponent),te=(n(2004),n(8407),n(4458),n(2880)),ne=n(8349),ie=(n(7228),n(1589)),ae=n(2431),oe=n(2331),re=n(8680),le=n(4067),se=n(7207),ue=n(2836);function ce(e){return(ce="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 de(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pe(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,n){return t&&pe(e.prototype,t),n&&pe(e,n),e}function fe(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&&he(e,t)}function he(e,t){return(he=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ye(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=ve(e);if(t){var a=ve(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return be(this,n)}}function be(e,t){return!t||"object"!==ce(t)&&"function"!=typeof t?ge(e):t}function ge(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ve(e){return(ve=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var _e="comment",Ee="Comment",we="SUBMIT",ke=function(e){fe(n,e);var t=ye(n);function n(e){var i;return de(this,n),(i=t.call(this,e)).state={value:"",madeChanges:!1,textareaFocused:!1,textareaLineHeight:-1},i.onChange=i.onChange.bind(ge(i)),i.onFocus=i.onFocus.bind(ge(i)),i.onBlur=i.onBlur.bind(ge(i)),i.submitComment=i.submitComment.bind(ge(i)),i.onCommentSubmit=i.onCommentSubmit.bind(ge(i)),i.onCommentSubmitFail=i.onCommentSubmitFail.bind(ge(i)),d.Z.on("comment_submit",i.onCommentSubmit),d.Z.on("comment_submit_fail",i.onCommentSubmitFail),i}return me(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 te.Z._currentValue.is.anonymous&&(e=window.location.href.replace(s.Z._currentValue.url,"").replace(/^\//g,""),e=ie.Z._currentValue.signin+"?next=/"+e),te.Z._currentValue.is.anonymous?a.createElement("div",{className:"comments-form"},a.createElement("div",{className:"comments-form-inner"},a.createElement(re.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"},we))))):a.createElement("div",{className:"comments-form"},a.createElement("div",{className:"comments-form-inner"},a.createElement(re.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},we)))))}}]),n}(a.PureComponent);ke.propTypes={comment_type:l().oneOf(["new","reply"]),media_id:l().oneOfType([l().string,l().number]).isRequired,reply_comment_id:l().oneOfType([l().string,l().number])},ke.defaultProps={comment_type:"new"};var Ce=function(e){fe(n,e);var t=ye(n);function n(e){var i;return de(this,n),(i=t.call(this,e)).state={viewMoreContent:!0,enabledViewMoreContent:!1,isOpenRemoveCommentPopup:!1},te.Z._currentValue.can.deleteComment?(i.proceedCommentRemoval=i.proceedCommentRemoval.bind(ge(i)),i.cancelCommentRemoval=i.cancelCommentRemoval.bind(ge(i)),i.onPopupsDisplayChange=i.onPopupsDisplayChange.bind(ge(i)),i.removeCommentPopup=new se.Z(a.createElement("button",{onClick:i.removeComment},"DELETE ","COMMENT"),a.createElement(ue.W8,null,a.createElement("div",{className:"popup-message"},a.createElement("span",{className:"popup-message-title"},Ee," removal"),a.createElement("span",{className:"popup-message-main"},"You're willing to remove ",_e," 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 me(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,le.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,te.Z._currentValue.can.deleteComment?a.createElement("div",{className:"comment-actions"},te.Z._currentValue.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);Ce.propTypes={comment_id:l().oneOfType([l().string,l().number]).isRequired,media_id:l().oneOfType([l().string,l().number]).isRequired,text:l().string,author_name:l().string,author_link:l().string,author_thumb:l().string,publish_date:l().oneOfType([l().string,l().number]),likes:l().number,dislikes:l().number},Ce.defaultProps={author_name:"",author_link:"#",publish_date:0,likes:0,dislikes:0};var Pe=function(e){fe(n,e);var t=ye(n);function n(e){var i;if(de(this,n),(i=t.call(this,e)).state={mediaId:d.Z.get("media-id")},te.Z._currentValue.can.readComment){var a=d.Z.get("media-comments");i.state.comments=a,i.state.commentsLength=a?a.length:0,i.state.commentsLength||(i.onCommentsLoad=i.onCommentsLoad.bind(ge(i)),i.onCommentSubmit=i.onCommentSubmit.bind(ge(i)),i.onCommentSubmitFail=i.onCommentSubmitFail.bind(ge(i)),i.onCommentDelete=i.onCommentDelete.bind(ge(i)),i.onCommentDeleteFail=i.onCommentDeleteFail.bind(ge(i)),d.Z.on("comments_load",i.onCommentsLoad),d.Z.on("comment_submit",i.onCommentSubmit),d.Z.on("comment_submit_fail",i.onCommentSubmitFail),d.Z.on("comment_delete",i.onCommentDelete),d.Z.on("comment_delete_fail",i.onCommentDeleteFail))}return i}return me(n,[{key:"onCommentsLoad",value:function(){var e=d.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"===d.Z.get("media-data").state){if(-1<ie.Z._currentValue.profile.home.indexOf(d.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>'+m.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(){ne.wN("Comment added","commentSubmit")}),100),void 0!==e&&console.info('Added comment "'+e+'"')}},{key:"onCommentSubmitFail",value:function(){setTimeout((function(){ne.wN("Comment submition failed","commentSubmitFail")}),100)}},{key:"onCommentDelete",value:function(e){this.onCommentsLoad(),setTimeout((function(){ne.wN("Comment removed","commentDelete")}),100),void 0!==e&&console.info('Removed comment "'+e+'"')}},{key:"onCommentDeleteFail",value:function(e){setTimeout((function(){ne.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(Ce,{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:s.Z._currentValue.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"},!te.Z._currentValue.can.readComment||d.Z.get("media-data").enable_comments?null:a.createElement("span",{className:"disabled-comments-msg"},"Comments are disabled"),te.Z._currentValue.can.readComment&&(d.Z.get("media-data").enable_comments||te.Z._currentValue.can.editMedia)?a.createElement("h2",null,this.state.commentsLength?1<this.state.commentsLength?this.state.commentsLength+" Comments":this.state.commentsLength+" "+Ee:d.Z.get("media-data").enable_comments?"No comment yet":""):null,te.Z._currentValue.can.addComment&&d.Z.get("media-data").enable_comments?a.createElement(ke,{media_id:this.state.mediaId}):null,te.Z._currentValue.can.readComment&&(d.Z.get("media-data").enable_comments||te.Z._currentValue.can.editMedia)&&this.state.commentsLength&&this.state.comments&&this.state.commentsLength?this.commentsContent():null))}}]),n}(a.PureComponent),Se=(a.PureComponent,n(1590)),Oe=n.n(Se),Re=n(4860),Me=n(8420),Ne=n(4547);function De(e){return(De="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 Ze(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 Ie(e,t){return!t||"object"!==De(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 Le(e){return(Le=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Te=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)}(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=Le(i);if(a){var n=Le(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return Ie(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)).mediacms_config=(0,Ne.v)(window.MediaCMS),e.browserCache=new Re.Z(e.mediacms_config.site.id,86400),e.data={media_id:null,extendedRateCategories:e.browserCache.get("extended-rate-categories")},e.data.extendedRateCategories=null===e.data.extendedRateCategories?!e.mediacms_config.member.is.anonymous:!!e.data.extendedRateCategories,e}return t=r,(n=[{key:"requestRate",value:function(e,t){(0,Me.j0)(this.mediacms_config.api.media+"/"+this.data.media_id+"/actions",{type:"rate",extra_info:{score:t,category_id:e}},{headers:{"X-CSRFToken":(0,Me.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)}}}])&&Ze(t.prototype,n),r}(Oe()),Ae=(0,Me.v$)(new Te,"actions_handler"),je=n(8416),Ve=n.n(je),Fe=n(2123);function Ue(e){return(Ue="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 He(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function We(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 qe(e,t,n){return t&&We(e.prototype,t),n&&We(e,n),e}function ze(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&&Be(e,t)}function Be(e,t){return(Be=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ge(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=Xe(e);if(t){var a=Xe(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return Ye(this,n)}}function Ye(e,t){return!t||"object"!==Ue(t)&&"function"!=typeof t?$e(e):t}function $e(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Xe(e){return(Xe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ke=function(e){ze(n,e);var t=Ge(n);function n(e){var i;return He(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($e(i)),i.closeRateMessage=i.closeRateMessage.bind($e(i)),i.onSucceedRateSubmit=i.onSucceedRateSubmit.bind($e(i)),i.onFailedRateSubmit=i.onFailedRateSubmit.bind($e(i)),Ae.on("succeed_rate_submit["+e.id+"]",i.onSucceedRateSubmit),Ae.on("failed_rate_submit["+e.id+"]",i.onFailedRateSubmit),i}return qe(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,Ve().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(ae.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(Fe.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(ae.M,{className:"close-msg",onClick:this.closeRateMessage},a.createElement("i",{className:"material-icons"},"clear"))):null)}}]),n}(a.PureComponent);Ke.propTypes={id:l().oneOfType([l().string,l().number]).isRequired,title:l().string.isRequired,score:l().number.isRequired};var Je=function(e){ze(n,e);var t=Ge(n);function n(e){var i;return He(this,n),(i=t.call(this,e)).state={extended:Ae.get("extended-rate-categories")},i.onClickExtend=i.onClickExtend.bind($e(i)),i.onRateCategoriesToggle=i.onRateCategoriesToggle.bind($e(i)),Ae.on("changed_rate_categories_visibility",i.onRateCategoriesToggle),i}return qe(n,[{key:"componentDidMount",value:function(){var e;e=this.props.media_id,Ve().dispatch({type:"INIT",media_id:e})}},{key:"onClickExtend",value:function(){Ve().dispatch({type:"EXTEND_RATE_CATEGORIES"})}},{key:"onRateCategoriesToggle",value:function(){this.setState({extended:Ae.get("extended-rate-categories")})}},{key:"ratingCategories",value:function(){for(var e=[],t=0;t<this.props.ratings_data.length;)e.push(a.createElement(Ke,{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 te.Z._currentValue.is.anonymous&&(e=window.location.href.replace(s.Z._currentValue.url,"").replace(/^\//g,""),e=ie.Z._currentValue.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(ae.M,{type:"span"},a.createElement("i",{className:"material-icons"},this.state.extended?"keyboard_arrow_up":"keyboard_arrow_down"))),a.createElement("div",{className:"rating-categories"},te.Z._currentValue.is.anonymous?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"))):this.ratingCategories()))}}]),n}(a.PureComponent);function Qe(e){return(Qe="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 tt(e,t){return(tt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function nt(e,t){return!t||"object"!==Qe(t)&&"function"!=typeof t?it(e):t}function it(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)}function ot(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}Je.propTypes={media_id:l().string.isRequired,ratings_data:l().array.isRequired};var rt=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)}(l,e);var t,n,i,o,r=(i=l,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 nt(this,e)});function l(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),(t=r.call(this,e)).state={hasSummary:!1,isContentVisible:!0},t.summary=d.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=d.Z.get("media-production-company"),t.websiteContent=d.Z.get("media-website"),t.licenseContent=d.Z.get("media-license-info"),t.countriesContent=ot(d.Z.get("media-countries")),t.languagesContent=ot(d.Z.get("media-languages")),t.topicsContent=ot(d.Z.get("media-topics")),t.tagsContent=!m.Z.get("config-enabled").taxonomies.tags||m.Z.get("config-enabled").taxonomies.tags.enabled?ot(d.Z.get("media-tags")):[],m.Z.get("config-options").pages.media.categoriesWithTitle?t.categoriesContent=[]:t.categoriesContent=!m.Z.get("config-enabled").taxonomies.categories||m.Z.get("config-enabled").taxonomies.categories.enabled?ot(d.Z.get("media-categories")):[],te.Z._currentValue.can.deleteMedia?(t.state.isOpenRemoveMediaPopup=!1,t.proceedMediaRemoval=t.proceedMediaRemoval.bind(it(t)),t.cancelMediaRemoval=t.cancelMediaRemoval.bind(it(t)),t.onPopupsDisplayChange=t.onPopupsDisplayChange.bind(it(t)),t.removeMediaPopup=new se.Z(a.createElement("button",{className:"remove-media"},"DELETE MEDIA"),a.createElement(ue.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(it(t)),t.onMediaDelete=t.onMediaDelete.bind(it(t)),t.onMediaDeleteFail=t.onMediaDeleteFail.bind(it(t)),d.Z.on("media_delete",t.onMediaDelete),d.Z.on("media_delete_fail",t.onMediaDeleteFail),t}return t=l,(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(){ne.wN("Media removed. Redirecting...","mediaDelete"),setTimeout((function(){window.location.href=s.Z._currentValue.url+"/"+d.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(){ne.wN("Media removal failed","mediaDeleteFail")}),100),void 0!==e&&console.info('Media "'+e+'" removal failed')}},{key:"render",value:function(){var e=(0,y.U)(this.props.author.url,s.Z._currentValue.url),t=(0,y.U)(this.props.author.thumb,s.Z._currentValue.url),n=d.Z.get("media-data").ratings_info;return void 0!==n&&n.length||(n=null),a.createElement("div",{className:"media-info-content"},void 0===m.Z.get("config-media-item").displayAuthor||null===m.Z.get("config-media-item").displayAuthor||m.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,m.Z.get("config-media-item").displayPublishDate&&this.props.published?a.createElement("span",{className:"author-banner-date"},"Published on ",(0,Me.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:m.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,d.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,te.Z._currentValue.can.editMedia||te.Z._currentValue.can.editSubtitle||te.Z._currentValue.can.deleteMedia?a.createElement("div",{className:"media-author-actions"},te.Z._currentValue.can.editMedia?a.createElement("a",{href:d.Z.get("media-data").edit_url,rel:"nofollow",title:"Edit media",className:"edit-media"},"EDIT MEDIA"):null,te.Z._currentValue.can.editSubtitle&&"video"===d.Z.get("media-data").media_type?a.createElement("a",{href:d.Z.get("media-data").edit_url.replace("edit?","add_subtitle?"),rel:"nofollow",title:"Edit subtitle",className:"edit-subtitle"},"EDIT SUBTITLE"):null,te.Z._currentValue.can.deleteMedia?this.removeMediaPopup.triggerComponent():null,te.Z._currentValue.can.deleteMedia&&this.state.isOpenRemoveMediaPopup?this.removeMediaPopup.contentComponent():null):null)),null!==n?a.createElement(Je,{media_id:d.Z.get("media-id"),ratings_data:n}):null,a.createElement(Pe,null))}}])&&et(t.prototype,n),l}(a.PureComponent),lt=a.createContext((0,Ne.v)(window.MediaCMS).playlists),st={notifications:(0,Ne.v)(window.MediaCMS).notifications.messages},ut=a.createContext(st),ct=(ut.Consumer,ut);function dt(e){return(dt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function pt(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 mt(e,t){return(mt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ft(e,t){return!t||"object"!==dt(t)&&"function"!=typeof t?ht(e):t}function ht(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function yt(e){return(yt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var bt=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&&mt(e,t)}(l,e);var t,n,i,o,r=(i=l,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=yt(i);if(o){var n=yt(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return ft(this,e)});function l(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),(t=r.call(this,e)).state={likesCounter:(0,Me.uf)(d.Z.get("media-likes"),!1),isOpenLikesPopup:!1,likedMedia:d.Z.get("user-liked-media")},t.openLikeAction=!0,t.openLikeAction&&(t.toggleLike=t.toggleLike.bind(ht(t)),t.onCompleteMediaLike=t.onCompleteMediaLike.bind(ht(t)),t.onCompleteMediaUnlike=t.onCompleteMediaUnlike.bind(ht(t)),t.onFailMediaLikeRequest=t.onFailMediaLikeRequest.bind(ht(t))),t.onPopupsDisplayChange=t.onPopupsDisplayChange.bind(ht(t)),t.likesPopup=new se.Z(a.createElement("button",{onClick:t.openLikeAction?t.toggleLike:null},a.createElement(ae.M,{type:"span"},a.createElement(oe.O,{type:"thumb_up"})),a.createElement("span",{className:"likes-counter"},t.state.likesCounter)),t.openLikeAction?null:a.createElement(ue.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:ie.Z._currentValue.signin,className:"button-link sign-in",title:"Sign in"},"SIGN IN"))),t.openLikeAction?null:t.onPopupsDisplayChange),t}return t=l,(n=[{key:"componentDidMount",value:function(){d.Z.on("liked_media",this.onCompleteMediaLike),d.Z.on("unliked_media",this.onCompleteMediaUnlike),d.Z.on("liked_media_failed_request",this.onFailMediaLikeRequest)}},{key:"updateStateValues",value:function(){this.setState({likesCounter:(0,Me.uf)(d.Z.get("media-likes"),!1),likedMedia:d.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(),ne.wN(ct._currentValue.addToLiked,"likedMedia")}.bind(this),100)}},{key:"onCompleteMediaUnlike",value:function(){setTimeout(function(){this.updateStateValues(),ne.wN(ct._currentValue.removeFromLiked,"unlikedMedia")}.bind(this),100)}},{key:"onFailMediaLikeRequest",value:function(){setTimeout(function(){this.updateStateValues(),ne.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)}}])&&pt(t.prototype,n),l}(a.PureComponent);function gt(e){return(gt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function vt(e,t){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 Et(e,t){return!t||"object"!==gt(t)&&"function"!=typeof t?wt(e):t}function wt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function kt(e){return(kt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}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)}(l,e);var t,n,i,o,r=(i=l,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=kt(i);if(o){var n=kt(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return Et(this,e)});function l(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),(t=r.call(this,e)).state={dislikesCounter:(0,Me.uf)(d.Z.get("media-dislikes"),!1),isOpenDislikesPopup:!1,dislikedMedia:d.Z.get("user-disliked-media")},t.openDislikeAction=!0,t.openDislikeAction&&(t.toggleDislike=t.toggleDislike.bind(wt(t)),t.onCompleteMediaDislike=t.onCompleteMediaDislike.bind(wt(t)),t.onCompleteMediaUndislike=t.onCompleteMediaUndislike.bind(wt(t)),t.onFailMediaDislikeRequest=t.onFailMediaDislikeRequest.bind(wt(t))),t.onPopupsDisplayChange=t.onPopupsDisplayChange.bind(wt(t)),t.dislikesPopup=t.dislikesPopup||new se.Z(a.createElement("button",{onClick:t.openDislikeAction?t.toggleDislike:null},a.createElement(ae.M,{type:"span"},a.createElement(oe.O,{type:"thumb_down"})),a.createElement("span",{className:"dislikes-counter"},t.state.dislikesCounter)),t.openDislikeAction?null:a.createElement(ue.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:ie.Z._currentValue.signin,className:"button-link sign-in",title:"Sign in"},"SIGN IN"))),t.openDislikeAction?null:t.onPopupsDisplayChange),t}return t=l,(n=[{key:"componentDidMount",value:function(){d.Z.on("disliked_media",this.onCompleteMediaDislike),d.Z.on("undisliked_media",this.onCompleteMediaUndislike),d.Z.on("disliked_media_failed_request",this.onFailMediaDislikeRequest)}},{key:"updateStateValues",value:function(){this.setState({dislikesCounter:(0,Me.uf)(d.Z.get("media-dislikes"),!1),dislikedMedia:d.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(),ne.wN(ct._currentValue.messages.addToDisliked,"dislikedMedia")}.bind(this),100)}},{key:"onCompleteMediaUndislike",value:function(){setTimeout(function(){this.updateStateValues(),ne.wN(ct._currentValue.messages.removeFromDisliked,"undislikedMedia")}.bind(this),100)}},{key:"onFailMediaDislikeRequest",value:function(){setTimeout(function(){this.updateStateValues(),ne.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)}}])&&vt(t.prototype,n),l}(a.PureComponent);function Pt(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(ae.M,{type:"span"},a.createElement(oe.O,{type:"arrow_downward"})),a.createElement("span",null,"DOWNLOAD")))}n(9808),Pt.propTypes={link:l().string.isRequired,title:l().string.isRequired},n(9751),n(9628);var St=n(8534),Ot=n(3562);function Rt(e){return(Rt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Mt(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 Nt(e,t){return(Nt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Dt(e,t){return!t||"object"!==Rt(t)&&"function"!=typeof t?Zt(e):t}function Zt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function xt(e){return(xt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var It=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&&Nt(e,t)}(l,e);var t,n,i,o,r=(i=l,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=xt(i);if(o){var n=xt(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return Dt(this,e)});function l(e){var t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),t=r.call(this,e);var n,i,o=d.Z.get("media-data"),u=o.encodings_info;for(n in t.state={isOpenDownloadOptionsMenu:!1,downloadOptionsCurrentPage:"main"},t.title=o.title,t.downloadOptionsList={},u)if(u.hasOwnProperty(n)&&Object.keys(u[n]).length)for(i in u[n])u[n].hasOwnProperty(i)&&"success"===u[n][i].status&&100===u[n][i].progress&&(t.downloadOptionsList[u[n][i].title]={text:n+" - "+i.toUpperCase()+" ("+u[n][i].size+")",link:(0,y.U)(u[n][i].url,s.Z._currentValue.url),linkAttr:{target:"_blank",download:o.title+"_"+n+"_"+i.toUpperCase()}});return t.downloadOptionsList.original_media_url={text:"Original file ("+o.size+")",link:(0,y.U)(o.original_media_url,s.Z._currentValue.url),linkAttr:{target:"_blank",download:o.title}},t.downloadOptionsPages={main:a.createElement("div",{className:"main-options"},a.createElement(ue.W8,null,a.createElement(St.S,{items:Object.values(t.downloadOptionsList)})))},t.onPopupsDisplayChange=t.onPopupsDisplayChange.bind(Zt(t)),t.initDownloadsPopup(),t}return t=l,(n=[{key:"initDownloadsPopup",value:function(){this.downloadsPopup=Object.keys(this.downloadOptionsPages).length?new se.Z(a.createElement("button",null,a.createElement(ae.M,{type:"span"},a.createElement(oe.O,{type:"arrow_downward"})),a.createElement("span",null,"DOWNLOAD")),a.createElement(Ot.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)}}])&&Mt(t.prototype,n),l}(a.PureComponent),Lt=n(7823);function Tt(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,l=e[Symbol.iterator]();!(i=(r=l.next()).done)&&(n.push(r.value),!t||n.length!==t);i=!0);}catch(e){a=!0,o=e}finally{try{i||null==l.return||l.return()}finally{if(a)throw o}}return n}}(e,t)||function(e,t){if(e){if("string"==typeof e)return At(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)?At(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 At(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 jt(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,d.Z.get("media-id")):G.addMediaToPlaylist(e.playlistId,d.Z.get("media-id"))}}),a.createElement("span",null,e.title)):null}function Vt(e){var t=(0,a.useRef)(null),n=(0,a.useRef)(null),i=Tt((0,a.useState)(new Date),2),o=i[0],r=i[1],l=Tt((0,a.useState)(d.Z.get("playlists")),2),s=l[0],u=l[1],c=Tt((0,a.useState)(!1),2),p=c[0],f=c[1];function h(){E()}function y(){u(d.Z.get("playlists")),r(new Date)}function b(){u(d.Z.get("playlists")),r(new Date),setTimeout((function(){ne.wN("Media added to playlist","playlistMediaAdditionComplete")}),100)}function g(){setTimeout((function(){ne.wN("Media's addition to playlist failed","playlistMediaAdditionFail")}),100)}function v(){u(d.Z.get("playlists")),r(new Date),setTimeout((function(){ne.wN("Media removed from playlist","playlistMediaRemovalComplete")}),100)}function _(){setTimeout((function(){ne.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 w(){f(!p),E()}return(0,a.useEffect)((function(){E()})),(0,a.useEffect)((function(){return m.Z.on("window_resize",h),d.Z.on("playlists_load",y),d.Z.on("media_playlist_addition_completed",b),d.Z.on("media_playlist_addition_failed",g),d.Z.on("media_playlist_removal_completed",v),d.Z.on("media_playlist_removal_failed",_),function(){m.Z.removeListener("window_resize",h),d.Z.removeListener("playlists_load",y),d.Z.removeListener("media_playlist_addition_completed",b),d.Z.removeListener("media_playlist_addition_failed",g),d.Z.removeListener("media_playlist_removal_completed",v),d.Z.removeListener("media_playlist_removal_failed",_)}}),[]),a.createElement("div",{ref:t,className:"saveto-popup"},a.createElement("div",{className:"saveto-title"},"Save to...",a.createElement(ae.M,{type:"button",onClick:function(){f(!1),void 0!==e.triggerPopupClose&&e.triggerPopupClose()}},a.createElement(oe.O,{type:"close"}))),s.length?a.createElement("div",{ref:n,className:"saveto-select"},function(){for(var e=d.Z.get("media-id"),t=[],n=0;n<s.length;)t.push(a.createElement("div",{key:"playlist_"+s[n].playlist_id},a.createElement(jt,{renderDate:o,title:s[n].title,privacy:s[n].status,isChecked:-1<s[n].media_list.indexOf(e),playlistId:s[n].playlist_id}))),n+=1;return t}()):null,p?a.createElement("div",{className:"saveto-new-playlist"},a.createElement(Lt.A,{onCancel:w,onPlaylistSave:function(e){G.addNewPlaylist(e),w()}})):a.createElement(ae.M,{className:"saveto-create",type:"button",onClick:w},a.createElement(oe.O,{type:"add"}),"Create a new playlist"))}function Ft(e){return(Ft="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 Ut(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 Ht(e,t){return(Ht=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Wt(e,t){return!t||"object"!==Ft(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)}n(8024),jt.propTypes={playlistId:l().string,isChecked:l().bool,title:l().string},jt.defaultProps={isChecked:!1,title:""},Vt.propTypes={triggerPopupClose:l().func};var Bt=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&&Ht(e,t)}(l,e);var t,n,i,o,r=(i=l,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 Wt(this,e)});function l(e){var t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),(t=r.call(this,e)).state={isOpenPopup:!1,popupCurrentPage:"selectPlaylist"},t.onPopupsDisplayChange=t.onPopupsDisplayChange.bind(qt(t)),t.onPopupPageChange=t.onPopupPageChange.bind(qt(t)),t.triggerPopupClose=t.triggerPopupClose.bind(qt(t));var n={selectPlaylist:a.createElement("div",{className:"popup-fullscreen"},a.createElement(ue.W8,null,a.createElement("span",{className:"popup-fullscreen-overlay"}),a.createElement(Vt,{triggerPopupClose:t.triggerPopupClose}))),createPlaylist:a.createElement("div",{className:"popup-fullscreen"},a.createElement(ue.W8,null,a.createElement("span",{className:"popup-fullscreen-overlay"})))};return t.sharePopup=new se.Z(a.createElement("button",null,a.createElement(ae.M,{type:"span"},a.createElement(oe.O,{type:"playlist_add"})),a.createElement("span",null,"SAVE")),a.createElement(Ot.o,{initPage:t.state.popupCurrentPage,pageChangeSelector:".change-page",pageIdSelectorAttr:"data-page-id",pages:n,focusFirstItemOnPageChange:!1,pageChangeCallback:t.onPopupPageChange}),t.onPopupsDisplayChange),t}return t=l,(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)}}])&&Ut(t.prototype,n),l}(a.PureComponent),Gt=n(6157),Yt=n(1395),$t=a.createContext((0,Ne.v)(window.MediaCMS).media.share.options);function Xt(e){return(Xt="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 Kt(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 Jt(e,t){return(Jt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Qt(e,t){return!t||"object"!==Xt(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 tn(e){return(tn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var nn=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&&Jt(e,t)}(l,e);var t,n,i,o,r=(i=l,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=tn(i);if(o){var n=tn(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return Qt(this,e)});function l(e){var t,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),(t=r.call(this,e)).state={displayNext:!1,displayPrev:!1,maxFormContentHeight:Gt.Z.get("container-height")-196,maxPopupWidth:518>Gt.Z.get("container-width")-80?Gt.Z.get("container-width")-80:null},t.onClickCopyMediaLink=t.onClickCopyMediaLink.bind(en(t)),t.onCompleteCopyMediaLink=t.onCompleteCopyMediaLink.bind(en(t)),t.inlineSlider=null,t.nextSlide=t.nextSlide.bind(en(t)),t.prevSlide=t.prevSlide.bind(en(t)),t.previousBtn=a.createElement("span",{className:"previous-slide"},a.createElement(ae.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(ae.M,{buttonShadow:!0,onClick:t.nextSlide},a.createElement("i",{className:"material-icons"},"keyboard_arrow_right")));var i=function(){for(var e=$t._currentValue,t=d.Z.get("media-url"),n=d.Z.get("media-data").title,i={},a=0;a<e.length;){switch(e[a]){case"embed":"video"===d.Z.get("media-data").media_type&&(i[e[a]]={});break;case"email":i[e[a]]={title:"Email",shareUrl:"mailto:?body="+d.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(en(t)),t}return t=l,(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:Gt.Z.get("container-height")-212,maxPopupWidth:518>Gt.Z.get("container-width")-80?Gt.Z.get("container-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 Yt.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(){m.Z.on("window_resize",this.onWindowResize),d.Z.on("copied_media_link",this.onCompleteCopyMediaLink)}},{key:"disableEvents",value:function(){m.Z.removeListener("window_resize",this.onWindowResize),d.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(){ne.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:d.Z.get("media-url")}),a.createElement("button",{onClick:this.onClickCopyMediaLink},"COPY"))))}}])&&Kt(t.prototype,n),l}(a.PureComponent);function an(e){return(an="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 on(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 rn(e,t){return(rn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ln(e,t){return!t||"object"!==an(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 un(e){return(un=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}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&&rn(e,t)}(l,e);var t,n,i,o,r=(i=l,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=un(i);if(o){var n=un(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return ln(this,e)});function l(e){var t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),(t=r.call(this,e)).state={isOpenPopup:!1,popupCurrentPage:"shareOptions"},t.onPopupsDisplayChange=t.onPopupsDisplayChange.bind(sn(t)),t.onPopupPageChange=t.onPopupPageChange.bind(sn(t)),t.triggerPopupClose=t.triggerPopupClose.bind(sn(t));var n={shareOptions:a.createElement("div",{className:"popup-fullscreen"},a.createElement(ue.W8,null,a.createElement("span",{className:"popup-fullscreen-overlay"}),a.createElement(nn,null)))};return t.sharePopup=new se.Z(a.createElement("button",null,a.createElement(ae.M,{type:"span"},a.createElement(oe.O,{type:"share"})),a.createElement("span",null,"SHARE")),a.createElement(Ot.o,{initPage:t.state.popupCurrentPage,pageChangeSelector:".change-page",pageIdSelectorAttr:"data-page-id",pages:n,focusFirstItemOnPageChange:!1,pageChangeCallback:t.onPopupPageChange}),t.onPopupsDisplayChange),t}return t=l,(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)}}])&&on(t.prototype,n),l}(a.PureComponent);function dn(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 pn(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,l=e[Symbol.iterator]();!(i=(r=l.next()).done)&&(n.push(r.value),!t||n.length!==t);i=!0);}catch(e){a=!0,o=e}finally{try{i||null==l.return||l.return()}finally{if(a)throw o}}return n}}(t,n)||function(e,t){if(e){if("string"==typeof e)return dn(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)?dn(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.")}()),l=r[0],s=r[1];function u(){s(Gt.Z.get("container-height")-(104+i.current.offsetHeight))}return(0,a.useEffect)((function(){return u(),m.Z.on("window_resize",u),function(){m.Z.removeListener("window_resize",u)}}),[]),a.createElement("form",null,a.createElement("div",{className:"report-form",style:null!==l?{maxHeight:l+"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 mn(e){return(mn="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 fn(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 hn(e,t){return(hn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function yn(e,t){return!t||"object"!==mn(t)&&"function"!=typeof t?bn(e):t}function bn(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function gn(e){return(gn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}pn.propTypes={mediaUrl:l().string.isRequired,cancelReportForm:l().func,submitReportForm:l().func};var vn=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&&hn(e,t)}(l,e);var t,n,i,o,r=(i=l,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=gn(i);if(o){var n=gn(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return yn(this,e)});function l(e){var t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),(t=r.call(this,e)).state={isOpenMoreOptionsMenu:!1,moreOptionsCurrentPage:"main"},t.settingOptionsList={},te.Z._currentValue.can.reportMedia&&(t.settingOptionsList.reportMedia={itemType:"open-subpage",text:"Report",icon:"flag",buttonAttr:{className:"change-page"+(d.Z.get("media-data").reported_times?" loggedin-media-reported":""),"data-page-id":"loggedInReportMedia"}}),te.Z._currentValue.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=d.Z.get("media-data"),i=n.encodings_info;t.props.allowDownload&&te.Z._currentValue.can.downloadMedia&&("video"!==d.Z.get("media-type")?(t.downloadLink=(0,y.U)(d.Z.get("media-original-url"),s.Z._currentValue.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(ue.W8,null,a.createElement(St.S,{key:"main",items:o})))}:{},t.onMoreOptionsPageChangeCallback=t.onMoreOptionsPageChangeCallback.bind(bn(t)),t.onCompleteMediaReport=t.onCompleteMediaReport.bind(bn(t)),t.cancelReportForm=t.cancelReportForm.bind(bn(t)),t.submitReportForm=t.submitReportForm.bind(bn(t)),te.Z._currentValue.can.reportMedia&&(t.moreOptionsPages.loggedInReportMedia=a.createElement("div",{className:"popup-fullscreen"},a.createElement(ue.W8,null,a.createElement("span",{className:"popup-fullscreen-overlay"}),a.createElement("div",null,a.createElement(pn,{mediaUrl:d.Z.get("media-url"),submitReportForm:t.submitReportForm,cancelReportForm:t.cancelReportForm}))))),te.Z._currentValue.can.editMedia&&(t.moreOptionsPages.mediaStatusInfo=a.createElement("div",{className:"main-options"},a.createElement(ue.W8,null,a.createElement("ul",{className:"media-status-info"},a.createElement("li",null,"Media type: ",a.createElement("span",null,d.Z.get("media-data").media_type||"N/A")),a.createElement("li",null,"State: ",a.createElement("span",null,d.Z.get("media-data").state||"N/A")),a.createElement("li",null,"Review state: ",a.createElement("span",null,d.Z.get("media-data").is_reviewed?"Is reviewed":"Pending review")),"video"===d.Z.get("media-data").media_type?a.createElement("li",null,"Encoding Status: ",a.createElement("span",null,d.Z.get("media-data").encoding_status||"N/A")):null,0<d.Z.get("media-data").reported_times?a.createElement("li",{className:"reports"},"Reports: ",a.createElement("span",null,d.Z.get("media-data").reported_times)):null)))),t.props.allowDownload&&te.Z._currentValue.can.downloadMedia&&"video"===d.Z.get("media-type")){var u,c,p={};for(u in i)if(i.hasOwnProperty(u)&&Object.keys(i[u]).length)for(c in i[u])i[u].hasOwnProperty(c)&&"success"===i[u][c].status&&100===i[u][c].progress&&(p[i[u][c].title]={text:u+" - "+c.toUpperCase()+" ("+i[u][c].size+")",link:(0,y.U)(i[u][c].url,s.Z._currentValue.url),linkAttr:{target:"_blank",download:n.title+"_"+u+"_"+c.toUpperCase()}});p.original_media_url={text:"Original file ("+n.size+")",link:(0,y.U)(n.original_media_url,s.Z._currentValue.url),linkAttr:{target:"_blank",download:n.title}},t.moreOptionsPages.videoDownloadOptions=a.createElement("div",{className:"video-download-options"},a.createElement(ue.W8,null,a.createElement(St.S,{key:"video-download-options",items:Object.values(p)})))}return t.onPopupsDisplayChange=t.onPopupsDisplayChange.bind(bn(t)),t.initMoreOptionsPopup(),t}return t=l,(n=[{key:"initMoreOptionsPopup",value:function(){this.moreOptionsPopup=Object.keys(this.moreOptionsPages).length?new se.Z(a.createElement("span",null,a.createElement(ae.M,{type:"button"},a.createElement(oe.O,{type:"more_horiz"}))),a.createElement(Ot.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&&d.Z.on("reported_media",this.onCompleteMediaReport)}},{key:"onCompleteMediaReport",value:function(){setTimeout(function(){this.moreOptionsPopup.setOpenPopupState(!1),ne.wN("Media Reported","reportedMedia"),d.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&&te.Z._currentValue.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}}])&&fn(t.prototype,n),l}(a.PureComponent);function _n(e){return(_n="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 En(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 kn(e,t){return!t||"object"!==_n(t)&&"function"!=typeof t?Cn(e):t}function Cn(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Pn(e){return(Pn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}vn.propTypes={allowDownload:l().bool.isRequired},vn.defaultProps={allowDownload:!1};var Sn=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)}(l,e);var t,n,i,o,r=(i=l,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=Pn(i);if(o){var n=Pn(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return kn(this,e)});function l(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),(t=r.call(this,e)).state={likedMedia:d.Z.get("user-liked-media"),dislikedMedia:d.Z.get("user-disliked-media")},t.downloadLink="video"!==d.Z.get("media-type")?(0,y.U)(d.Z.get("media-original-url"),s.Z._currentValue.url):null,t.updateStateValues=t.updateStateValues.bind(Cn(t)),t}return t=l,(n=[{key:"componentDidMount",value:function(){d.Z.on("liked_media",this.updateStateValues),d.Z.on("unliked_media",this.updateStateValues),d.Z.on("disliked_media",this.updateStateValues),d.Z.on("undisliked_media",this.updateStateValues)}},{key:"updateStateValues",value:function(){this.setState({likedMedia:d.Z.get("user-liked-media"),dislikedMedia:d.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,y.U)(this.props.categories[t].url,s.Z._currentValue.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=m.Z.get("config-options").pages.media.displayViews&&void 0!==this.props.views;return a.createElement("div",{className:"media-title-banner"},e&&m.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"!==d.Z.get("media-data").state?a.createElement("div",{className:"media-labels-area"},a.createElement("span",null,d.Z.get("media-data").state)):null,a.createElement("div",{className:"media-views-actions"+(this.state.likedMedia?" liked-media":"")+(this.state.dislikedMedia?" disliked-media":"")},!e&&m.Z.get("config-options").pages.media.categoriesWithTitle?this.mediaCategories():null,e?a.createElement("div",{className:"media-views"},(0,Me.uf)(this.props.views,!0)," ",1>=this.props.views?"view":"views"):null,a.createElement("div",{className:"media-actions"},a.createElement("div",null,te.Z._currentValue.can.likeMedia?a.createElement(bt,null):null,te.Z._currentValue.can.dislikeMedia?a.createElement(Ct,null):null,te.Z._currentValue.can.shareMedia?a.createElement(cn,null):null,te.Z._currentValue.can.saveMedia&&-1<lt._currentValue.mediaTypes.indexOf(d.Z.get("media-type"))?a.createElement(Bt,null):null,this.props.allowDownload&&te.Z._currentValue.can.downloadMedia?this.downloadLink?a.createElement(Pt,{link:this.downloadLink,title:this.props.title}):a.createElement(It,null):null,a.createElement(vn,{allowDownload:this.props.allowDownload})))))}}])&&En(t.prototype,n),l}(a.PureComponent);function On(e){return(On="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 Rn(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 Mn(e,t){return(Mn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Nn(e,t){return!t||"object"!==On(t)&&"function"!=typeof t?Dn(e):t}function Dn(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)}Sn.propTypes={allowDownload:l().bool.isRequired},Sn.defaultProps={allowDownload:!1};var xn=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&&Mn(e,t)}(l,e);var t,n,i,o,r=(i=l,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 Nn(this,e)});function l(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),(t=r.call(this,e)).state={videoLoaded:!1},t.onVideoLoad=t.onVideoLoad.bind(Dn(t)),d.Z.on("loaded_media_data",t.onVideoLoad),t}return t=l,(n=[{key:"onVideoLoad",value:function(){this.setState({videoLoaded:!0})}},{key:"render",value:function(){var e,t,n,i,o,r,l=!1;return this.state.videoLoaded&&(l=void 0===(l=d.Z.get("media-data").allow_download)||!!l,e=d.Z.get("media-data").views,t=d.Z.get("media-data").categories_info,n=d.Z.get("media-data").title,i={name:d.Z.get("media-data").author_name,url:d.Z.get("media-data").author_profile,thumb:d.Z.get("media-author-thumbnail-url")},o=d.Z.get("media-data").add_date,r=d.Z.get("media-data").description),this.state.videoLoaded?a.createElement("div",{className:"viewer-info"},a.createElement("div",{className:"viewer-info-inner"},a.createElement(Sn,{title:n,views:e,categories:t,allowDownload:l}),a.createElement(rt,{author:i,published:o,description:r}))):null}}])&&Rn(t.prototype,n),l}(a.PureComponent),In=n(1345);function Ln(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,l=e[Symbol.iterator]();!(i=(r=l.next()).done)&&(n.push(r.value),!t||n.length!==t);i=!0);}catch(e){a=!0,o=e}finally{try{i||null==l.return||l.return()}finally{if(a)throw o}}return n}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Tn(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)?Tn(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 Tn(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 An(){var e=d.Z.get("media-data");return e&&e.related_media&&e.related_media.length?e.related_media[0]:null}function jn(e){var t=Ln((0,a.useState)(An()),2),n=t[0],i=t[1],o=Ln((0,a.useState)(m.Z.get("media-auto-play")),2),r=o[0],l=o[1];function s(){l(m.Z.get("media-auto-play"))}function u(){i(An())}return(0,a.useEffect)((function(){return d.Z.on("loaded_media_data",u),m.Z.on("switched_media_auto_play",s),function(){d.Z.removeListener("loaded_media_data",u),m.Z.removeListener("switched_media_auto_play",s)}}),[]),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&&ne.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:ne.p$})))))),a.createElement(In.C,{className:"items-list-hor",items:[n],pageItems:1,maxItems:1,singleLinkContent:!0,horizontalItemsOrientation:!0,hideDate:!0,hideViews:!m.Z.get("config-media-item").displayViews,hideAuthor:!m.Z.get("config-media-item").displayAuthor})):null}function Vn(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 Fn(e){var t,n,i=(t=(0,a.useState)(s()),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,l=e[Symbol.iterator]();!(i=(r=l.next()).done)&&(n.push(r.value),!t||n.length!==t);i=!0);}catch(e){a=!0,o=e}finally{try{i||null==l.return||l.return()}finally{if(a)throw o}}return n}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Vn(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)?Vn(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 l(){r(s())}function s(){var e=d.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 d.Z.on("loaded_media_data",l),function(){return d.Z.removeListener("loaded_media_data",l)}}),[]),o&&o.length?a.createElement(In.C,{className:"items-list-hor",items:e.hideFirst?o.slice(1):o,pageItems:m.Z.get("config-options").pages.media.related.initialSize,singleLinkContent:!0,horizontalItemsOrientation:!0,hideDate:!0,hideViews:!m.Z.get("config-media-item").displayViews,hideAuthor:!m.Z.get("config-media-item").displayAuthor}):null}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 Hn(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 qn(e,t){return!t||"object"!==Un(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 zn(e){return(zn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}n(288),Fn.propTypes={hideFirst:l().bool},Fn.defaultProps={hideFirst:!0};var Bn=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)}(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=zn(i);if(a){var n=zn(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return qn(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=m.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=d.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=d.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=d.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=d.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")}}}])&&Hn(t.prototype,n),r}(Oe()),Gn=(0,Me.v$)(new Bn,"actions_handler"),Yn=n(3386);function $n(e){return a.createElement(In.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 Xn(e){return(Xn="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 Kn(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 Jn(e,t){return(Jn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Qn(e,t){return!t||"object"!==Xn(t)&&"function"!=typeof t?ei(e):t}function ei(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ti(e){return(ti=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}$n.propTypes={items:l().array.isRequired,playlistActiveItem:Yn.g},$n.defaultProps={playlistActiveItem:1};var ni=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&&Jn(e,t)}(l,e);var t,n,i,o,r=(i=l,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=ti(i);if(o){var n=ti(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return Qn(this,e)});function l(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),(t=r.call(this,e)).state={expanded:!0,loopRepeat:Gn.get("enabled-loop"),shuffle:Gn.get("enabled-shuffle"),savedPlaylist:Gn.get("saved-playlist-loop"),title:e.playlistData.title,link:e.playlistData.url,authorName:e.playlistData.user,authorLink:ie.Z._currentValue.home+"/user/"+e.playlistData.user,activeItem:e.activeItem,totalMedia:e.playlistData.media_count,items:e.playlistData.playlist_media},t.onHeaderClick=t.onHeaderClick.bind(ei(t)),t.onLoopClick=t.onLoopClick.bind(ei(t)),t.onShuffleClick=t.onShuffleClick.bind(ei(t)),t.onSaveClick=t.onSaveClick.bind(ei(t)),t.onLoopRepeatUpdate=t.onLoopRepeatUpdate.bind(ei(t)),t.onShuffleUpdate=t.onShuffleUpdate.bind(ei(t)),t.onPlaylistSaveUpdate=t.onPlaylistSaveUpdate.bind(ei(t)),Gn.on("loop-repeat-updated",t.onLoopRepeatUpdate),Gn.on("shuffle-updated",t.onShuffleUpdate),Gn.on("saved-updated",t.onPlaylistSaveUpdate),t}return t=l,(n=[{key:"onHeaderClick",value:function(e){this.setState({expanded:!this.state.expanded})}},{key:"onLoopClick",value:function(){Ve().dispatch({type:"TOGGLE_LOOP"})}},{key:"onShuffleClick",value:function(){Ve().dispatch({type:"TOGGLE_SHUFFLE"})}},{key:"onSaveClick",value:function(){Ve().dispatch({type:"TOGGLE_SAVE"})}},{key:"onShuffleUpdate",value:function(){var e=this;this.setState({shuffle:Gn.get("enabled-shuffle")},(function(){e.state.shuffle?ne.wN("Playlist shuffle is on","shuffle-on"):ne.wN("Playlist shuffle is off","shuffle-off")}))}},{key:"onLoopRepeatUpdate",value:function(){var e=this;this.setState({loopRepeat:Gn.get("enabled-loop")},(function(){e.state.loopRepeat?ne.wN("Playlist loop is on","loop-on"):ne.wN("Playlist loop is off","loop-off")}))}},{key:"onPlaylistSaveUpdate",value:function(){var e=this;this.setState({savedPlaylist:Gn.get("saved-playlist")},(function(){e.state.savedPlaylist?ne.wN("Added to playlists library","added-to-playlists-lib"):ne.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(ae.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(ae.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($n,{items:this.state.items,playlistActiveItem:this.state.activeItem})):null))}}])&&Kn(t.prototype,n),l}(a.PureComponent);function ii(e){return(ii="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 ai(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"!==ii(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)}ni.propTypes={playlistData:l().object.isRequired,activeItem:Yn.g},ni.defaultProps={};var si=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)}(l,e);var t,n,i,o,r=(i=l,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=li(i);if(o){var n=li(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return ri(this,e)});function l(e){var t;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),(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=l,(n=[{key:"render",value:function(){return a.createElement("div",{className:"viewer-sidebar"},this.state.isPlaylistPage?a.createElement(ni,{activeItem:this.state.activeItem,playlistData:this.props.playlistData}):a.createElement(jn,null),a.createElement(Fn,{hideFirst:!this.state.isPlaylistPage}))}}])&&ai(t.prototype,n),l}(a.PureComponent);function ui(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,l=e[Symbol.iterator]();!(i=(r=l.next()).done)&&(n.push(r.value),!t||n.length!==t);i=!0);}catch(e){a=!0,o=e}finally{try{i||null==l.return||l.return()}finally{if(a)throw o}}return n}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ci(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)?ci(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 ci(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 di(e){var t=(0,a.useRef)(null),n=(0,a.useRef)(null),i=ui((0,a.useState)(null),2),o=i[0],r=i[1],l=ui((0,a.useState)(null),2),s=l[0],u=l[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)),u(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(){u(n.current.value),void 0!==e.unitCallback&&e.unitCallback(n.current.value)},value:null!==s?s:""},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 pi(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,l=e[Symbol.iterator]();!(i=(r=l.next()).done)&&(n.push(r.value),!t||n.length!==t);i=!0);}catch(e){a=!0,o=e}finally{try{i||null==l.return||l.return()}finally{if(a)throw o}}return n}}(e,t)||function(e,t){if(e){if("string"==typeof e)return mi(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)?mi(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 mi(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 fi(e){var t=m.Z.get("config-options").embedded.video.dimensions,n=(0,a.useContext)(ie.Z),i=(0,a.useRef)(null),r=(0,a.useRef)(null),l=(0,a.useRef)(null),s=(0,a.useRef)(null),u=(0,a.useRef)(null),c=pi((0,a.useState)(window.innerHeight-144+56),2),p=c[0],f=c[1],h=pi((0,a.useState)(!1),2),y=h[0],b=h[1],g=pi((0,a.useState)("16:9"),2),v=g[0],_=g[1],E=pi((0,a.useState)(t.width),2),w=E[0],k=E[1],C=pi((0,a.useState)(t.widthUnit),2),P=C[0],S=C[1],O=pi((0,a.useState)(t.height),2),R=O[0],M=O[1],N=pi((0,a.useState)(t.heightUnit),2),D=N[0],Z=N[1],x=pi((0,a.useState)(60),2),I=x[0],L=x[1],T=pi((0,a.useState)(60),2),A=T[0],j=T[1],V=pi((0,a.useState)([{key:"px",label:"px"},{key:"percent",label:"%"}]),2),F=V[0],U=V[1];function H(){f(window.innerHeight-144+56),L(l.current.offsetHeight),j(u.current.offsetHeight)}function W(){setTimeout((function(){ne.wN("Embed media code copied to clipboard","clipboardEmbedMediaCodeCopy")}),100)}return(0,a.useEffect)((function(){f(window.innerHeight-144+56),L(l.current.offsetHeight),j(u.current.offsetHeight)})),(0,a.useEffect)((function(){return m.Z.on("window_resize",H),d.Z.on("copied_embed_media_code",W),function(){m.Z.removeListener("window_resize",H),d.Z.removeListener("copied_embed_media_code",W)}}),[]),a.createElement("div",{className:"share-embed",style:{maxHeight:p+"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:d.Z.get("media-data"),inEmbed:!0}))),a.createElement("div",{ref:r,className:"on-right"},a.createElement("div",{ref:l,className:"on-right-top"},a.createElement("div",{className:"on-right-top-inner"},a.createElement("span",{className:"ttl"},"Embed Video"),a.createElement(ae.M,{type:"button",onClick:function(){void 0!==e.triggerPopupClose&&e.triggerPopupClose()}},a.createElement(oe.O,{type:"close"})))),a.createElement("div",{ref:s,className:"on-right-middle",style:{top:I+"px",bottom:A+"px"}},a.createElement("textarea",{readOnly:!0,value:'<iframe width="'+("percent"===P?w+"%":w)+'" height="'+("percent"===D?R+"%":R)+'" src="'+n.embed+d.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:y,onChange:function(){var e=!y,t=v.split(":"),n=t[0],i=t[1];b(e),S(e?"px":P),Z(e?"px":D),M(e?parseInt(w*i/n,10):R),U(e?[{key:"px",label:"px"}]:[{key:"px",label:"px"},{key:"percent",label:"%"}])}}),"Keep aspect ratio")),y?a.createElement("div",{className:"options-group"},a.createElement("select",{ref:i,onChange:function(){var e=i.current.value,t=e.split(":"),n=t[0],a=t[1];_(e),M(y?parseInt(w*a/n,10):R)},value:v},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(di,{valueCallback:function(e){e=""===e?0:e;var t=v.split(":"),n=t[0],i=t[1];k(e),M(y?parseInt(e*i/n,10):R)},unitCallback:function(e){S(e)},label:"Width",defaultValue:parseInt(w,10),defaultUnit:P,minValue:1,maxValue:99999,units:F})),a.createElement("div",{className:"options-group"},a.createElement(di,{valueCallback:function(e){e=""===e?0:e;var t=v.split(":"),n=t[0],i=t[1];M(e),k(y?parseInt(e*n/i,10):w)},unitCallback:function(e){Z(e)},label:"Height",defaultValue:parseInt(R,10),defaultUnit:D,minValue:1,maxValue:99999,units:F})))))),a.createElement("div",{ref:u,className:"on-right-bottom"},a.createElement("button",{onClick:function(){G.copyEmbedMediaCode(s.current.querySelector("textarea"))}},"COPY")))))}function hi(e){return(hi="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 yi(e,t){return(yi=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function bi(e,t){return!t||"object"!==hi(t)&&"function"!=typeof t?gi(e):t}function gi(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function vi(e){return(vi=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}di.propTypes={label:l().string,units:l().array.isRequired,defaultUnit:l().string,defaultValue:l().number,minValue:l().number,maxValue:l().number,valueCallback:l().func,unitCallback:l().func},fi.propTypes={triggerPopupClose:l().func};var _i=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&&yi(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=vi(t);if(n){var a=vi(this).constructor;e=Reflect.construct(i,arguments,a)}else e=i.apply(this,arguments);return bi(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(gi(t)),t.onPopupPageChange=t.onPopupPageChange.bind(gi(t)),t.triggerPopupClose=t.triggerPopupClose.bind(gi(t));var n={shareOptions:a.createElement("div",{className:"popup-fullscreen"},a.createElement(ue.W8,null,a.createElement("span",{className:"popup-fullscreen-overlay"}),a.createElement(nn,null))),shareEmbed:a.createElement("div",{className:"popup-fullscreen share-embed-popup"},a.createElement(ue.W8,null,a.createElement("span",{className:"popup-fullscreen-overlay"}),a.createElement(fi,{triggerPopupClose:t.triggerPopupClose})))};return t.sharePopup=new se.Z(a.createElement("button",null,a.createElement(ae.M,{type:"span"},a.createElement(oe.O,{type:"share"})),a.createElement("span",null,"SHARE")),a.createElement(Ot.o,{initPage:t.state.popupCurrentPage,pageChangeSelector:".change-page",pageIdSelectorAttr:"data-page-id",pages:n,focusFirstItemOnPageChange:!1,pageChangeCallback:t.onPopupPageChange}),t.onPopupsDisplayChange),t}return o}(cn);function Ei(e){return(Ei="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 wi(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ki(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 Ci(e,t){return(Ci=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Pi(e,t){return!t||"object"!==Ei(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 Si(e){return(Si=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Oi=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&&Ci(e,t)}(l,e);var t,n,i,o,r=(i=l,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=Si(i);if(o){var n=Si(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return Pi(this,e)});function l(){return wi(this,l),r.apply(this,arguments)}return t=l,(n=[{key:"render",value:function(){var e=m.Z.get("config-options").pages.media.displayViews&&void 0!==this.props.views;return a.createElement("div",{className:"media-title-banner"},e&&m.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"!==d.Z.get("media-data").state?a.createElement("div",{className:"media-labels-area"},a.createElement("span",null,d.Z.get("media-data").state)):null,a.createElement("div",{className:"media-views-actions"+(this.state.likedMedia?" liked-media":"")+(this.state.dislikedMedia?" disliked-media":"")},!e&&m.Z.get("config-options").pages.media.categoriesWithTitle?this.mediaCategories():null,e?a.createElement("div",{className:"media-views"},(0,Me.uf)(this.props.views,!0)," ",1>=this.props.views?"view":"views"):null,a.createElement("div",{className:"media-actions"},a.createElement("div",null,te.Z._currentValue.can.likeMedia?a.createElement(bt,null):null,te.Z._currentValue.can.dislikeMedia?a.createElement(Ct,null):null,te.Z._currentValue.can.shareMedia?a.createElement(_i,null):null,te.Z._currentValue.can.saveMedia&&-1<lt._currentValue.mediaTypes.indexOf(d.Z.get("media-type"))?a.createElement(Bt,null):null,this.props.allowDownload&&te.Z._currentValue.can.downloadMedia?this.downloadLink?a.createElement(Pt,{link:this.downloadLink,title:this.props.title}):a.createElement(It,null):null,a.createElement(vn,{allowDownload:this.props.allowDownload})))))}}])&&ki(t.prototype,n),l}(Sn);function Ri(e){return(Ri="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 Mi(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ni(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 Di(e,t){return(Di=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Zi(e,t){return!t||"object"!==Ri(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 xi(e){return(xi=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ii=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&&Di(e,t)}(l,e);var t,n,i,o,r=(i=l,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=xi(i);if(o){var n=xi(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return Zi(this,e)});function l(){return Mi(this,l),r.apply(this,arguments)}return t=l,(n=[{key:"render",value:function(){var e,t,n,i,o,r,l=!1;return this.state.videoLoaded&&(l=void 0===(l=d.Z.get("media-data").allow_download)||!!l,e=d.Z.get("media-data").views,t=d.Z.get("media-data").categories_info,n=d.Z.get("media-data").title,i={name:d.Z.get("media-data").author_name,url:d.Z.get("media-data").author_profile,thumb:d.Z.get("media-author-thumbnail-url")},o=d.Z.get("media-data").add_date,r=d.Z.get("media-data").description),this.state.videoLoaded?a.createElement("div",{className:"viewer-info"},a.createElement("div",{className:"viewer-info-inner"},a.createElement(Oi,{title:n,views:e,categories:t,allowDownload:l}),a.createElement(rt,{author:i,published:o,description:r}))):null}}])&&Ni(t.prototype,n),l}(xn);function Li(e){return(Li="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 Ti(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 Ai(e,t){return(Ai=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ji(e,t){return!t||"object"!==Li(t)&&"function"!=typeof t?Vi(e):t}function Vi(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Fi(e){return(Fi=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ui(e){return(Ui="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 Hi(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 qi(e,t){return(qi=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function zi(e,t){return!t||"object"!==Ui(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 Bi(e){return(Bi=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&&qi(e,t)}(s,e);var t,n,i,r,l=(i=s,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=Bi(i);if(r){var n=Bi(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return zi(this,e)});function s(){return Hi(this,s),l.apply(this,arguments)}return t=s,(n=[{key:"viewerContainerContent",value:function(e){switch(d.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(x,null);case"pdf":return a.createElement(V,null)}return a.createElement(z,null)}}])&&Wi(t.prototype,n),s}(function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ai(e,t)}(l,e);var t,n,i,o,r=(i=l,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=Fi(i);if(o){var n=Fi(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return ji(this,e)});function l(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),(t=r.call(this,e,"media")).state={wideLayout:1216<=m.Z.get("window-inner-width"),mediaLoaded:!1,mediaLoadFailed:!1,isVideoMedia:!1,theaterMode:!1,pagePlaylistLoaded:!1,pagePlaylistData:d.Z.get("playlist-data")},t.onWindowResize=t.onWindowResize.bind(Vi(t)),t.onMediaLoad=t.onMediaLoad.bind(Vi(t)),t.onMediaLoadError=t.onMediaLoadError.bind(Vi(t)),t.onPagePlaylistLoad=t.onPagePlaylistLoad.bind(Vi(t)),d.Z.on("loaded_media_data",t.onMediaLoad),d.Z.on("loaded_media_error",t.onMediaLoadError),d.Z.on("loaded_page_playlist_data",t.onPagePlaylistLoad),t}return t=l,(n=[{key:"componentDidMount",value:function(){G.loadMediaData(),m.Z.on("window_resize",this.onWindowResize)}},{key:"onWindowResize",value:function(){this.setState({wideLayout:1216<=m.Z.get("window-inner-width")})}},{key:"onPagePlaylistLoad",value:function(){this.setState({pagePlaylistLoaded:!0,pagePlaylistData:d.Z.get("playlist-data")})}},{key:"onMediaLoad",value:function(){var e="video"===d.Z.get("media-type");e?(this.onViewerModeChange=this.onViewerModeChange.bind(this),p.Z.on("changed_viewer_mode",this.onViewerModeChange),this.setState({mediaLoaded:!0,isVideoMedia:e,theaterMode:p.Z.get("in-theater-mode")})):this.setState({mediaLoaded:!0,isVideoMedia:e})}},{key:"onViewerModeChange",value:function(){this.setState({theaterMode:p.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(ee,null)):a.createElement("div",{className:e},[a.createElement("div",{className:"viewer-container",key:"viewer-container"},this.state.mediaLoaded&&this.state.pagePlaylistLoaded?this.viewerContainerContent(d.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(Ii,{key:"viewer-info"}),this.state.pagePlaylistLoaded?a.createElement(si,{key:"viewer-sidebar",mediaId:d.Z.get("media-id"),playlistData:d.Z.get("playlist-data")}):null]:[this.state.pagePlaylistLoaded?a.createElement(si,{key:"viewer-sidebar",mediaId:d.Z.get("media-id"),playlistData:d.Z.get("playlist-data")}):null,a.createElement(Ii,{key:"viewer-info"})])])}}])&&Ti(t.prototype,n),l}(B.T));(0,i.X)("page-media",Gi)},4860:function(e,t,n){n.d(t,{Z:function(){return o}}),n(7228),n(9751);var i=n(6228);function a(){var e="test-slug";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,l){if(a){(r=r||t)||(l=(0,i.a)(["Invalid cache expiration value",r]));try{localStorage.setItem(e+"["+n+"]",JSON.stringify({value:o,expire:(new Date).getTime()+1e3*r})),l=!0}catch(e){l=(0,i.a)([e])}}return l},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){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},2331:function(e,t,n){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}},1395:function(e,t,n){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}},8420:function(e,t,n){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 l.Z},uf:function(){return s.Z},$4:function(){return u.Z},hm:function(){return c.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),l=n(1438),s=n(4135),u=n(3140),c=(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){n.r(t),n.d(t,{loadMediaData:function(){return o},likeMedia:function(){return r},unlikeMedia:function(){return l},dislikeMedia:function(){return s},undislikeMedia:function(){return u},reportMedia:function(){return c},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 b},removeMediaFromPlaylist:function(){return g},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 l(){a().dispatch({type:"UNLIKE_MEDIA"})}function s(){a().dispatch({type:"DISLIKE_MEDIA"})}function u(){a().dispatch({type:"UNDISLIKE_MEDIA"})}function c(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 b(e,t){a().dispatch({type:"ADD_MEDIA_TO_PLAYLIST",playlist_id:e,media_id:t})}function g(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){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(4547)),l=n(137),s=n.n(l),u=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 d(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 p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function m(e,t){return!t||"object"!==c(t)&&"function"!=typeof t?f(e):t}function f(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var y={},b=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&&p(e,t)}(c,e);var t,n,i,a,l=(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=h(i);if(a){var n=h(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return m(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=l.call(this)).mediacms_config=(0,r.v)(window.MediaCMS),e._MEDIA=null,e.pagePlaylistId=null,e.pagePlaylistData=null,y[Object.defineProperty(f(e),"id",{value:"MediaPageStoreData_"+Object.keys(y).length}).id]={likedMedia:!1,dislikedMedia:!1,reported_times:0,while:{deleteMedia:!1,submitComment:!1,deleteCommentId:null}},e.removeMediaResponse=e.removeMediaResponse.bind(f(e)),e.removeMediaFail=e.removeMediaFail.bind(f(e)),e.submitCommentFail=e.submitCommentFail.bind(f(e)),e.submitCommentResponse=e.submitCommentResponse.bind(f(e)),e.removeCommentFail=e.removeCommentFail.bind(f(e)),e.removeCommentResponse=e.removeCommentResponse.bind(f(e)),e}return t=c,(n=[{key:"loadData",value:function(){if(!y[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]&&(y[this.id].mediaId=e[t+1]),t+=2}var n;if(!y[this.id].mediaId)return console.warn("Invalid media id:",y[this.id].mediaId),!1;this.mediaAPIUrl=this.mediacms_config.api.media+"/"+y[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=this.mediacms_config.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(y[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=this.mediacms_config.api.media+"/"+y[this.id].mediaId+"/comments",this.commentsResponse=this.commentsResponse.bind(this),(0,o.A_)(this.commentsAPIUrl,!1,this.commentsResponse)}},{key:"loadPlaylists",value:function(){this.mediacms_config.member.can.saveMedia&&(this.playlistsAPIUrl=this.mediacms_config.api.user.playlists+this.mediacms_config.member.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(y[this.id].data=e.data,y[this.id].reported_times=!!y[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(),this.mediacms_config.member.can.readComment&&this.loadComments()}},{key:"dataErrorResponse",value:function(e){if(void 0!==e.type)switch(e.type){case"network":case"private":case"unavailable":y[this.id].loadErrorType=e.type,y[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&&(y[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:[];y[t.id].playlists=[];for(var i=0,a=0;i<n.length;)(function(e){var t,i,r=this;if(n[e].user===this.mediacms_config.member.username){var l=y[r.id].playlists.length;y[r.id].playlists[l]={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_)(this.mediacms_config.site.url+"/"+n[e].api_url.replace(/^\//g,""),!1,(function(e){if(e&&e.data){y[r.id].playlists[l].media_list=[];for(var t,i=0;i<e.data.playlist_media.length;)2===(t=e.data.playlist_media[i].url.split("m=")).length&&y[r.id].playlists[l].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(!y[this.id].mediaId)return console.warn("Invalid media id:",y[this.id].mediaId),!1;var e=this.mediacms_config.api.media+"/"+y[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&&(y[this.id].likedMedia=!0,this.emit("liked_media")))}},{key:"requestMediaDislike",value:function(){if(!y[this.id].mediaId)return console.warn("Invalid media id:",y[this.id].mediaId),!1;var e=this.mediacms_config.api.media+"/"+y[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&&(y[this.id].dislikedMedia=!0,this.emit("disliked_media")))}},{key:"requestMediaReport",value:function(e){if(!y[this.id].mediaId)return console.warn("Invalid media id:",y[this.id].mediaId),!1;var t=this.mediacms_config.api.media+"/"+y[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&&(y[this.id].reported_times+=1,this.emit("reported_media")))}},{key:"set",value:function(e,t){switch(e){case"media-load-error-type":y[this.id].loadErrorType=t;break;case"media-load-error-message":y[this.id].loadErrorMessage=t}}},{key:"get",value:function(e){var t,n,i,a=null;switch(e){case"playlists":a=y[this.id].playlists||[];break;case"media-load-error-type":a=void 0!==y[this.id].loadErrorType?y[this.id].loadErrorType:null;break;case"media-load-error-message":a=void 0!==y[this.id].loadErrorMessage?y[this.id].loadErrorMessage:null;break;case"media-comments":a=y[this.id].comments||[];break;case"media-data":a=y[this.id].data||null;break;case"media-id":a=y[this.id].mediaId;break;case"media-url":a=void 0!==y[this.id].data&&void 0!==y[this.id].data.url?y[this.id].data.url:"N/A";break;case"media-edit-subtitle-url":a=void 0!==y[this.id].data&&"string"==typeof y[this.id].data.add_subtitle_url?y[this.id].data.add_subtitle_url:null;break;case"media-likes":a=(t=y[this.id].likedMedia?1:0)?void 0!==y[this.id].data&&void 0!==y[this.id].data.likes?y[this.id].data.likes+t:t:void 0!==y[this.id].data&&void 0!==y[this.id].data.likes?y[this.id].data.likes:"N/A";break;case"media-dislikes":a=(t=y[this.id].dislikedMedia?1:0)?void 0!==y[this.id].data&&void 0!==y[this.id].data.dislikes?y[this.id].data.dislikes+t:t:void 0!==y[this.id].data&&void 0!==y[this.id].data.dislikes?y[this.id].data.dislikes:"N/A";break;case"media-summary":a=void 0!==y[this.id].data&&void 0!==y[this.id].data.summary?y[this.id].data.summary:null;break;case"media-production-company":a=void 0!==y[this.id].data&&void 0!==y[this.id].data.company&&null!==y[this.id].data.company?y[this.id].data.company.trim():null;break;case"media-website":a=void 0!==y[this.id].data&&void 0!==y[this.id].data.website&&null!==y[this.id].data.website?y[this.id].data.website.trim():null;break;case"display-media-license-info":a=void 0!==y[this.id].data&&void 0!==y[this.id].data.license_info;break;case"media-license-info":a=void 0!==y[this.id].data&&void 0!==y[this.id].data.license_info&&Object.keys(y[this.id].data.license_info).length?y[this.id].data.license_info:null;break;case"media-countries":a=void 0!==y[this.id].data&&void 0!==y[this.id].data.media_country_info?y[this.id].data.media_country_info:[];break;case"media-languages":a=void 0!==y[this.id].data&&void 0!==y[this.id].data.media_language_info?y[this.id].data.media_language_info:[];break;case"media-categories":a=void 0!==y[this.id].data&&void 0!==y[this.id].data.categories_info?y[this.id].data.categories_info:[];break;case"media-topics":a=void 0!==y[this.id].data&&void 0!==y[this.id].data.topics_info?y[this.id].data.topics_info:[];break;case"media-tags":a=void 0!==y[this.id].data&&void 0!==y[this.id].data.tags_info?y[this.id].data.tags_info:[];break;case"media-type":a=void 0!==y[this.id].data&&void 0!==y[this.id].data.media_type?y[this.id].data.media_type:null;break;case"media-original-url":a=void 0!==y[this.id].data&&void 0!==y[this.id].data.original_media_url?y[this.id].data.original_media_url:null;break;case"media-thumbnail-url":a=void 0!==y[this.id].data&&void 0!==y[this.id].data.thumbnail_url?y[this.id].data.thumbnail_url:null;break;case"user-liked-media":a=y[this.id].likedMedia;break;case"user-disliked-media":a=y[this.id].dislikedMedia;break;case"media-author-thumbnail-url":a=void 0!==y[this.id].data&&void 0!==y[this.id].data.author_thumbnail?this.mediacms_config.site.url+"/"+y[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(y[this.id].mediaId===this.pagePlaylistData.playlist_media[i].friendly_token){n=i+1;break}i+=1}n===this.pagePlaylistData.playlist_media.length&&!0===u.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(y[this.id].mediaId===this.pagePlaylistData.playlist_media[i].friendly_token){n=i;break}i+=1}0===n?(n=this.pagePlaylistData.playlist_media.length,!0===u.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<y[this.id].playlists.length;){if(e===y[this.id].playlists[n].playlist_id){y[this.id].playlists[n].media_list.push(y[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<y[this.id].playlists.length;){if(e===y[this.id].playlists[a].playlist_id){for(i=[],n=0;n<y[this.id].playlists[a].media_list.length;)y[this.id].mediaId!==y[this.id].playlists[a].media_list[n]&&i.push(y[this.id].playlists[a].media_list[n]),n+=1;y[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":y[this.id].mediaId=window.MediaCMS.mediaId||y[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":y[this.id].likedMedia||y[this.id].dislikedMedia||this.requestMediaLike();break;case"DISLIKE_MEDIA":y[this.id].likedMedia||y[this.id].dislikedMedia||this.requestMediaDislike();break;case"UNDISLIKE_MEDIA":break;case"REPORT_MEDIA":y[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(y[this.id].while.deleteMedia)return;y[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(y[this.id].while.submitComment)return;y[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!==y[this.id].while.deleteCommentId)return;y[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)(this.mediacms_config.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)(this.mediacms_config.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)(this.mediacms_config.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":y[this.id].playlists.push(e.playlist_data),this.emit("playlists_load")}}},{key:"removeMediaResponse",value:function(e){e&&204===e.status&&this.emit("media_delete",y[this.id].mediaId)}},{key:"removeMediaFail",value:function(){this.emit("media_delete_fail",y[this.id].mediaId),setTimeout((function(e){y[e.id].while.deleteMedia=null}),100,this)}},{key:"removeCommentFail",value:function(e){this.emit("comment_delete_fail",y[this.id].while.deleteCommentId),setTimeout((function(e){y[e.id].while.deleteCommentId=null}),100,this)}},{key:"removeCommentResponse",value:function(e){if(e&&204===e.status){var t,n=[];for(t in y[this.id].comments)y[this.id].comments.hasOwnProperty(t)&&y[this.id].while.deleteCommentId!==y[this.id].comments[t].uid&&n.push(y[this.id].comments[t]);y[this.id].comments=n,n=null,this.emit("comment_delete",y[this.id].while.deleteCommentId)}setTimeout((function(e){y[e.id].while.deleteCommentId=null}),100,this)}},{key:"submitCommentFail",value:function(e){this.emit("comment_submit_fail"),setTimeout((function(e){y[e.id].while.submitComment=!1}),100,this)}},{key:"submitCommentResponse",value:function(e){e&&201===e.status&&e.data&&Object.keys(e.data)&&(y[this.id].comments.push(e.data),this.emit("comment_submit",e.data.uid)),setTimeout((function(e){y[e.id].while.submitComment=!1}),100,this)}}])&&d(t.prototype,n),c}(a());t.Z=(0,o.v$)(new b,"actions_handler")},5971:function(e,t,n){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){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 l(e){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e,t){return!t||"object"!==l(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var 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&&u(e,t)}(f,e);var t,n,l,p,m=(l=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(l);if(p){var n=d(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return c(this,e)});function f(e,t){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,f),n=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"})]}}])&&s(t.prototype,n),f}(i.PureComponent)},8349:function(e,t,n){n.d(t,{df:function(){return o},p$:function(){return r},wN:function(){return l}});var i=n(8416),a=n.n(i);function o(e){a().dispatch({type:"INIT_PAGE",page:e})}function r(){a().dispatch({type:"TOGGLE_AUTO_PLAY"})}function l(e,t){a().dispatch({type:"ADD_NOTIFICATION",notification:e,notificationId:t})}}},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=[[7251,431]],i=function(){},a=function(a,o){for(var r,l,s=o[0],u=o[1],c=o[2],d=o[3],p=0,m=[];p<s.length;p++)l=s[p],n.o(e,l)&&e[l]&&m.push(e[l][0]),e[l]=0;for(r in u)n.o(u,r)&&(n.m[r]=u[r]);for(c&&c(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,l=1;l<o.length;l++){var s=o[l];0!==e[s]&&(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 l=n.x;n.x=function(){return n.x=l||function(){},(i=r)()}}(),n.x()}(); |