mirror of
https://github.com/mediacms-io/mediacms.git
synced 2024-11-25 01:34:51 +01:00
1 line
159 KiB
JavaScript
1 line
159 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,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 M(e){var t=(0,a.useContext)(s.Z),n=p();n=(n=n||d.Z.get("media-data").thumbnail_url)||"";var i,o,r=(i=(0,a.useState)(n),o=2,function(e){if(Array.isArray(e))return e}(i)||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}}(i,o)||function(e,t){if(e){if("string"==typeof e)return O(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)?O(e,t):void 0}}(i,o)||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],u=r[1];function c(){u(p())}function p(){var e=d.Z.get("media-data"),n="string"==typeof e.poster_url?e.poster_url.trim():"";return""===n&&(n="string"==typeof e.thumbnail_url?e.thumbnail_url.trim():""),""===n&&(n="string"==typeof d.Z.get("media-original-url")?d.Z.get("media-original-url").trim():""),""===n?"#":t.url+"/"+n.replace(/^\//g,"")}return(0,a.useEffect)((function(){return d.Z.on("loaded_image_data",c),function(){return d.Z.removeListener("loaded_image_data",c)}}),[]),l?a.createElement("div",{className:"viewer-image-container"},a.createElement("img",{src:l,alt:d.Z.get("media-data").title||null})):null}function R(){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")))))}function N(){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")))))}S.defaultProps={inEmbed:!1},S.propTypes={inEmbed:l().bool},n(3296),n(3233);var D=n(8204),Z=n(3699);function x(e){return(x="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function I(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}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 A(e,t){return(A=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function T(e,t){return!t||"object"!==x(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&&A(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 T(this,e)});function l(){return I(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")))))))}}])&&L(t.prototype,n),l}(a.PureComponent),F=(n(2004),n(8407),n(4458),n(2880)),U=n(8349),H=(n(7228),n(1589)),W=n(2431),q=n(2331),z=n(8680),B=n(4067),G=n(7207),Y=n(2836);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 X(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function K(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 J(e,t,n){return t&&K(e.prototype,t),n&&K(e,n),e}function Q(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&&ee(e,t)}function ee(e,t){return(ee=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function te(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=ae(e);if(t){var a=ae(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return ne(this,n)}}function ne(e,t){return!t||"object"!==$(t)&&"function"!=typeof t?ie(e):t}function ie(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ae(e){return(ae=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var oe="comment",re="Comment",le="SUBMIT",se=function(e){Q(n,e);var t=te(n);function n(e){var i;return X(this,n),(i=t.call(this,e)).state={value:"",madeChanges:!1,textareaFocused:!1,textareaLineHeight:-1},i.onChange=i.onChange.bind(ie(i)),i.onFocus=i.onFocus.bind(ie(i)),i.onBlur=i.onBlur.bind(ie(i)),i.submitComment=i.submitComment.bind(ie(i)),i.onCommentSubmit=i.onCommentSubmit.bind(ie(i)),i.onCommentSubmitFail=i.onCommentSubmitFail.bind(ie(i)),d.Z.on("comment_submit",i.onCommentSubmit),d.Z.on("comment_submit_fail",i.onCommentSubmitFail),i}return J(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&&Z.submitComment(e)}}},{key:"render",value:function(){var e;return F.Z._currentValue.is.anonymous&&(e=window.location.href.replace(s.Z._currentValue.url,"").replace(/^\//g,""),e=H.Z._currentValue.signin+"?next=/"+e),F.Z._currentValue.is.anonymous?a.createElement("div",{className:"comments-form"},a.createElement("div",{className:"comments-form-inner"},a.createElement(z.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"},le))))):a.createElement("div",{className:"comments-form"},a.createElement("div",{className:"comments-form-inner"},a.createElement(z.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},le)))))}}]),n}(a.PureComponent);se.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])},se.defaultProps={comment_type:"new"};var ue=function(e){Q(n,e);var t=te(n);function n(e){var i;return X(this,n),(i=t.call(this,e)).state={viewMoreContent:!0,enabledViewMoreContent:!1,isOpenRemoveCommentPopup:!1},F.Z._currentValue.can.deleteComment?(i.proceedCommentRemoval=i.proceedCommentRemoval.bind(ie(i)),i.cancelCommentRemoval=i.cancelCommentRemoval.bind(ie(i)),i.onPopupsDisplayChange=i.onPopupsDisplayChange.bind(ie(i)),i.removeCommentPopup=new G.Z(a.createElement("button",{onClick:i.removeComment},"DELETE ","COMMENT"),a.createElement(Y.W8,null,a.createElement("div",{className:"popup-message"},a.createElement("span",{className:"popup-message-title"},re," removal"),a.createElement("span",{className:"popup-message-main"},"You're willing to remove ",oe," 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 J(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(){Z.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,B.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,F.Z._currentValue.can.deleteComment?a.createElement("div",{className:"comment-actions"},F.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);ue.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},ue.defaultProps={author_name:"",author_link:"#",publish_date:0,likes:0,dislikes:0};var ce=function(e){Q(n,e);var t=te(n);function n(e){var i;if(X(this,n),(i=t.call(this,e)).state={mediaId:d.Z.get("media-id")},F.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(ie(i)),i.onCommentSubmit=i.onCommentSubmit.bind(ie(i)),i.onCommentSubmitFail=i.onCommentSubmitFail.bind(ie(i)),i.onCommentDelete=i.onCommentDelete.bind(ie(i)),i.onCommentDeleteFail=i.onCommentDeleteFail.bind(ie(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 J(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"),i=m.Z.get("config-contents").uploader.postUploadMessage;if(""===i)n&&0===e.length&&n.parentNode.removeChild(n);else if(0===e.length&&"unlisted"===d.Z.get("media-data").state){if(-1<H.Z._currentValue.profile.home.indexOf(d.Z.get("media-data").author_profile)&&!n){var a=document.createElement("div");a.setAttribute("role","alert"),a.setAttribute("class","alert info alert-dismissible no-comment"),a.innerHTML='<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>'+i,t.firstChild?t.insertBefore(a,t.firstChild):t.appendChild(a),a.querySelector("button.close").addEventListener("click",(function(e){return a.setAttribute("class","alert info alert-dismissible hiding"),setTimeout(function(){a.parentNode.removeChild(a)}.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(){U.wN("Comment added","commentSubmit")}),100),void 0!==e&&console.info('Added comment "'+e+'"')}},{key:"onCommentSubmitFail",value:function(){setTimeout((function(){U.wN("Comment submition failed","commentSubmitFail")}),100)}},{key:"onCommentDelete",value:function(e){this.onCommentsLoad(),setTimeout((function(){U.wN("Comment removed","commentDelete")}),100),void 0!==e&&console.info('Removed comment "'+e+'"')}},{key:"onCommentDeleteFail",value:function(e){setTimeout((function(){U.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(ue,{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"},!F.Z._currentValue.can.readComment||d.Z.get("media-data").enable_comments?null:a.createElement("span",{className:"disabled-comments-msg"},"Comments are disabled"),F.Z._currentValue.can.readComment&&(d.Z.get("media-data").enable_comments||F.Z._currentValue.can.editMedia)?a.createElement("h2",null,this.state.commentsLength?1<this.state.commentsLength?this.state.commentsLength+" Comments":this.state.commentsLength+" "+re:d.Z.get("media-data").enable_comments?"No comment yet":""):null,d.Z.get("media-data").enable_comments?a.createElement(se,{media_id:this.state.mediaId}):null,F.Z._currentValue.can.readComment&&(d.Z.get("media-data").enable_comments||F.Z._currentValue.can.editMedia)&&this.state.commentsLength&&this.state.comments&&this.state.commentsLength?this.commentsContent():null))}}]),n}(a.PureComponent),de=(a.PureComponent,n(1590)),pe=n.n(de),me=n(4860),fe=n(8420),he=n(4547);function ye(e){return(ye="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 be(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 ge(e,t){return(ge=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ve(e,t){return!t||"object"!==ye(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 _e(e){return(_e=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&&ge(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=_e(i);if(a){var n=_e(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return ve(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,he.v)(window.MediaCMS),e.browserCache=new me.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,fe.j0)(this.mediacms_config.api.media+"/"+this.data.media_id+"/actions",{type:"rate",extra_info:{score:t,category_id:e}},{headers:{"X-CSRFToken":(0,fe.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)}}}])&&be(t.prototype,n),r}(pe()),we=(0,fe.v$)(new Ee,"actions_handler"),ke=n(8416),Ce=n.n(ke),Pe=n(2123);function Se(e){return(Se="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Oe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Me(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 Re(e,t,n){return t&&Me(e.prototype,t),n&&Me(e,n),e}function Ne(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&&De(e,t)}function De(e,t){return(De=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ze(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=Le(e);if(t){var a=Le(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return xe(this,n)}}function xe(e,t){return!t||"object"!==Se(t)&&"function"!=typeof t?Ie(e):t}function Ie(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Le(e){return(Le=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ae=function(e){Ne(n,e);var t=Ze(n);function n(e){var i;return Oe(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(Ie(i)),i.closeRateMessage=i.closeRateMessage.bind(Ie(i)),i.onSucceedRateSubmit=i.onSucceedRateSubmit.bind(Ie(i)),i.onFailedRateSubmit=i.onFailedRateSubmit.bind(Ie(i)),we.on("succeed_rate_submit["+e.id+"]",i.onSucceedRateSubmit),we.on("failed_rate_submit["+e.id+"]",i.onFailedRateSubmit),i}return Re(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,Ce().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(W.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(Pe.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(W.M,{className:"close-msg",onClick:this.closeRateMessage},a.createElement("i",{className:"material-icons"},"clear"))):null)}}]),n}(a.PureComponent);Ae.propTypes={id:l().oneOfType([l().string,l().number]).isRequired,title:l().string.isRequired,score:l().number.isRequired};var Te=function(e){Ne(n,e);var t=Ze(n);function n(e){var i;return Oe(this,n),(i=t.call(this,e)).state={extended:we.get("extended-rate-categories")},i.onClickExtend=i.onClickExtend.bind(Ie(i)),i.onRateCategoriesToggle=i.onRateCategoriesToggle.bind(Ie(i)),we.on("changed_rate_categories_visibility",i.onRateCategoriesToggle),i}return Re(n,[{key:"componentDidMount",value:function(){var e;e=this.props.media_id,Ce().dispatch({type:"INIT",media_id:e})}},{key:"onClickExtend",value:function(){Ce().dispatch({type:"EXTEND_RATE_CATEGORIES"})}},{key:"onRateCategoriesToggle",value:function(){this.setState({extended:we.get("extended-rate-categories")})}},{key:"ratingCategories",value:function(){for(var e=[],t=0;t<this.props.ratings_data.length;)e.push(a.createElement(Ae,{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 F.Z._currentValue.is.anonymous&&(e=window.location.href.replace(s.Z._currentValue.url,"").replace(/^\//g,""),e=H.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(W.M,{type:"span"},a.createElement("i",{className:"material-icons"},this.state.extended?"keyboard_arrow_up":"keyboard_arrow_down"))),a.createElement("div",{className:"rating-categories"},F.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 je(e){return(je="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ve(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 Fe(e,t){return(Fe=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ue(e,t){return!t||"object"!==je(t)&&"function"!=typeof t?He(e):t}function He(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function We(e){return(We=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function qe(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}Te.propTypes={media_id:l().string.isRequired,ratings_data:l().array.isRequired};var ze=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Fe(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=We(i);if(o){var n=We(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return Ue(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=qe(d.Z.get("media-countries")),t.languagesContent=qe(d.Z.get("media-languages")),t.topicsContent=qe(d.Z.get("media-topics")),t.tagsContent=!m.Z.get("config-enabled").taxonomies.tags||m.Z.get("config-enabled").taxonomies.tags.enabled?qe(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?qe(d.Z.get("media-categories")):[],F.Z._currentValue.can.deleteMedia?(t.state.isOpenRemoveMediaPopup=!1,t.proceedMediaRemoval=t.proceedMediaRemoval.bind(He(t)),t.cancelMediaRemoval=t.cancelMediaRemoval.bind(He(t)),t.onPopupsDisplayChange=t.onPopupsDisplayChange.bind(He(t)),t.removeMediaPopup=new G.Z(a.createElement("button",{className:"remove-media"},"DELETE MEDIA"),a.createElement(Y.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(He(t)),t.onMediaDelete=t.onMediaDelete.bind(He(t)),t.onMediaDeleteFail=t.onMediaDeleteFail.bind(He(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(){Z.removeMedia(),this.cancelMediaRemoval()}},{key:"onMediaDelete",value:function(e){setTimeout((function(){U.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(){U.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,fe.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,F.Z._currentValue.can.editMedia||F.Z._currentValue.can.editSubtitle||F.Z._currentValue.can.deleteMedia?a.createElement("div",{className:"media-author-actions"},F.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,F.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,F.Z._currentValue.can.deleteMedia?this.removeMediaPopup.triggerComponent():null,F.Z._currentValue.can.deleteMedia&&this.state.isOpenRemoveMediaPopup?this.removeMediaPopup.contentComponent():null):null)),null!==n?a.createElement(Te,{media_id:d.Z.get("media-id"),ratings_data:n}):null,a.createElement(ce,null))}}])&&Ve(t.prototype,n),l}(a.PureComponent),Be=a.createContext((0,he.v)(window.MediaCMS).playlists),Ge={notifications:(0,he.v)(window.MediaCMS).notifications.messages},Ye=a.createContext(Ge),$e=(Ye.Consumer,Ye);function Xe(e){return(Xe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ke(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function Je(e,t){return(Je=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Qe(e,t){return!t||"object"!==Xe(t)&&"function"!=typeof t?et(e):t}function et(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function tt(e){return(tt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var nt=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Je(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=tt(i);if(o){var n=tt(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return Qe(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,fe.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(et(t)),t.onCompleteMediaLike=t.onCompleteMediaLike.bind(et(t)),t.onCompleteMediaUnlike=t.onCompleteMediaUnlike.bind(et(t)),t.onFailMediaLikeRequest=t.onFailMediaLikeRequest.bind(et(t))),t.onPopupsDisplayChange=t.onPopupsDisplayChange.bind(et(t)),t.likesPopup=new G.Z(a.createElement("button",{onClick:t.openLikeAction?t.toggleLike:null},a.createElement(W.M,{type:"span"},a.createElement(q.O,{type:"thumb_up"})),a.createElement("span",{className:"likes-counter"},t.state.likesCounter)),t.openLikeAction?null:a.createElement(Y.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:H.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,fe.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(),Z[this.state.likedMedia?"unlikeMedia":"likeMedia"]()}},{key:"toggleDislike",value:function(e){e.preventDefault(),e.stopPropagation(),Z[this.state.dislikedMedia?"undislikeMedia":"dislikeMedia"]()}},{key:"onCompleteMediaLike",value:function(){setTimeout(function(){this.updateStateValues(),U.wN($e._currentValue.addToLiked,"likedMedia")}.bind(this),100)}},{key:"onCompleteMediaUnlike",value:function(){setTimeout(function(){this.updateStateValues(),U.wN($e._currentValue.removeFromLiked,"unlikedMedia")}.bind(this),100)}},{key:"onFailMediaLikeRequest",value:function(){setTimeout(function(){this.updateStateValues(),U.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)}}])&&Ke(t.prototype,n),l}(a.PureComponent);function it(e){return(it="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function at(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function ot(e,t){return(ot=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function rt(e,t){return!t||"object"!==it(t)&&"function"!=typeof t?lt(e):t}function lt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function st(e){return(st=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var ut=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ot(e,t)}(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=st(i);if(o){var n=st(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return rt(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,fe.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(lt(t)),t.onCompleteMediaDislike=t.onCompleteMediaDislike.bind(lt(t)),t.onCompleteMediaUndislike=t.onCompleteMediaUndislike.bind(lt(t)),t.onFailMediaDislikeRequest=t.onFailMediaDislikeRequest.bind(lt(t))),t.onPopupsDisplayChange=t.onPopupsDisplayChange.bind(lt(t)),t.dislikesPopup=t.dislikesPopup||new G.Z(a.createElement("button",{onClick:t.openDislikeAction?t.toggleDislike:null},a.createElement(W.M,{type:"span"},a.createElement(q.O,{type:"thumb_down"})),a.createElement("span",{className:"dislikes-counter"},t.state.dislikesCounter)),t.openDislikeAction?null:a.createElement(Y.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:H.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,fe.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(),Z[this.state.dislikedMedia?"undislikeMedia":"dislikeMedia"]()}},{key:"toggleDislike",value:function(e){e.preventDefault(),e.stopPropagation(),Z[this.state.dislikedMedia?"undislikeMedia":"dislikeMedia"]()}},{key:"onCompleteMediaDislike",value:function(){setTimeout(function(){this.updateStateValues(),U.wN($e._currentValue.messages.addToDisliked,"dislikedMedia")}.bind(this),100)}},{key:"onCompleteMediaUndislike",value:function(){setTimeout(function(){this.updateStateValues(),U.wN($e._currentValue.messages.removeFromDisliked,"undislikedMedia")}.bind(this),100)}},{key:"onFailMediaDislikeRequest",value:function(){setTimeout(function(){this.updateStateValues(),U.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)}}])&&at(t.prototype,n),l}(a.PureComponent);function ct(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(W.M,{type:"span"},a.createElement(q.O,{type:"arrow_downward"})),a.createElement("span",null,"DOWNLOAD")))}n(9808),ct.propTypes={link:l().string.isRequired,title:l().string.isRequired},n(9751),n(9628);var dt=n(8534),pt=n(3562);function mt(e){return(mt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ft(e,t){for(var n=0;n<t.length;n++){var 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 yt(e,t){return!t||"object"!==mt(t)&&"function"!=typeof t?bt(e):t}function bt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function gt(e){return(gt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var vt=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=gt(i);if(o){var n=gt(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return yt(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(Y.W8,null,a.createElement(dt.S,{items:Object.values(t.downloadOptionsList)})))},t.onPopupsDisplayChange=t.onPopupsDisplayChange.bind(bt(t)),t.initDownloadsPopup(),t}return t=l,(n=[{key:"initDownloadsPopup",value:function(){this.downloadsPopup=Object.keys(this.downloadOptionsPages).length?new G.Z(a.createElement("button",null,a.createElement(W.M,{type:"span"},a.createElement(q.O,{type:"arrow_downward"})),a.createElement("span",null,"DOWNLOAD")),a.createElement(pt.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)}}])&&ft(t.prototype,n),l}(a.PureComponent),_t=n(7823);function Et(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 wt(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)?wt(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 wt(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 kt(e){return e.renderDate?a.createElement("label",null,a.createElement("input",{type:"checkbox",checked:e.isChecked,onChange:function(t){t.persist(),e.isChecked?Z.removeMediaFromPlaylist(e.playlistId,d.Z.get("media-id")):Z.addMediaToPlaylist(e.playlistId,d.Z.get("media-id"))}}),a.createElement("span",null,e.title)):null}function Ct(e){var t=(0,a.useRef)(null),n=(0,a.useRef)(null),i=Et((0,a.useState)(new Date),2),o=i[0],r=i[1],l=Et((0,a.useState)(d.Z.get("playlists")),2),s=l[0],u=l[1],c=Et((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(){U.wN("Media added to playlist","playlistMediaAdditionComplete")}),100)}function g(){setTimeout((function(){U.wN("Media's addition to playlist failed","playlistMediaAdditionFail")}),100)}function v(){u(d.Z.get("playlists")),r(new Date),setTimeout((function(){U.wN("Media removed from playlist","playlistMediaRemovalComplete")}),100)}function _(){setTimeout((function(){U.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(W.M,{type:"button",onClick:function(){f(!1),void 0!==e.triggerPopupClose&&e.triggerPopupClose()}},a.createElement(q.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(kt,{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(_t.A,{onCancel:w,onPlaylistSave:function(e){Z.addNewPlaylist(e),w()}})):a.createElement(W.M,{className:"saveto-create",type:"button",onClick:w},a.createElement(q.O,{type:"add"}),"Create a new playlist"))}function Pt(e){return(Pt="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 St(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function Ot(e,t){return(Ot=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Mt(e,t){return!t||"object"!==Pt(t)&&"function"!=typeof t?Rt(e):t}function Rt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Nt(e){return(Nt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}n(8024),kt.propTypes={playlistId:l().string,isChecked:l().bool,title:l().string},kt.defaultProps={isChecked:!1,title:""},Ct.propTypes={triggerPopupClose:l().func};var Dt=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ot(e,t)}(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=Nt(i);if(o){var n=Nt(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return Mt(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(Rt(t)),t.onPopupPageChange=t.onPopupPageChange.bind(Rt(t)),t.triggerPopupClose=t.triggerPopupClose.bind(Rt(t));var n={selectPlaylist:a.createElement("div",{className:"popup-fullscreen"},a.createElement(Y.W8,null,a.createElement("span",{className:"popup-fullscreen-overlay"}),a.createElement(Ct,{triggerPopupClose:t.triggerPopupClose}))),createPlaylist:a.createElement("div",{className:"popup-fullscreen"},a.createElement(Y.W8,null,a.createElement("span",{className:"popup-fullscreen-overlay"})))};return t.sharePopup=new G.Z(a.createElement("button",null,a.createElement(W.M,{type:"span"},a.createElement(q.O,{type:"playlist_add"})),a.createElement("span",null,"SAVE")),a.createElement(pt.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)}}])&&St(t.prototype,n),l}(a.PureComponent),Zt=n(6157),xt=n(1395),It=a.createContext((0,he.v)(window.MediaCMS).media.share.options);function Lt(e){return(Lt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function At(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function Tt(e,t){return(Tt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function jt(e,t){return!t||"object"!==Lt(t)&&"function"!=typeof t?Vt(e):t}function Vt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ft(e){return(Ft=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ut=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=Ft(i);if(o){var n=Ft(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return jt(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:Zt.Z.get("container-height")-196,maxPopupWidth:518>Zt.Z.get("container-width")-80?Zt.Z.get("container-width")-80:null},t.onClickCopyMediaLink=t.onClickCopyMediaLink.bind(Vt(t)),t.onCompleteCopyMediaLink=t.onCompleteCopyMediaLink.bind(Vt(t)),t.inlineSlider=null,t.nextSlide=t.nextSlide.bind(Vt(t)),t.prevSlide=t.prevSlide.bind(Vt(t)),t.previousBtn=a.createElement("span",{className:"previous-slide"},a.createElement(W.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(W.M,{buttonShadow:!0,onClick:t.nextSlide},a.createElement("i",{className:"material-icons"},"keyboard_arrow_right")));var i=function(){for(var e=It._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(Vt(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:Zt.Z.get("container-height")-212,maxPopupWidth:518>Zt.Z.get("container-width")-80?Zt.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 xt.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(){Z.copyShareLink(this.refs.MediaShareOptionsContent.querySelector(".copy-field input"))}},{key:"onCompleteCopyMediaLink",value:function(){setTimeout(function(){U.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"))))}}])&&At(t.prototype,n),l}(a.PureComponent);function Ht(e){return(Ht="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 Wt(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 qt(e,t){return(qt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function zt(e,t){return!t||"object"!==Ht(t)&&"function"!=typeof t?Bt(e):t}function Bt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Gt(e){return(Gt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Yt=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&qt(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=Gt(i);if(o){var n=Gt(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return zt(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(Bt(t)),t.onPopupPageChange=t.onPopupPageChange.bind(Bt(t)),t.triggerPopupClose=t.triggerPopupClose.bind(Bt(t));var n={shareOptions:a.createElement("div",{className:"popup-fullscreen"},a.createElement(Y.W8,null,a.createElement("span",{className:"popup-fullscreen-overlay"}),a.createElement(Ut,null)))};return t.sharePopup=new G.Z(a.createElement("button",null,a.createElement(W.M,{type:"span"},a.createElement(q.O,{type:"share"})),a.createElement("span",null,"SHARE")),a.createElement(pt.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)}}])&&Wt(t.prototype,n),l}(a.PureComponent);function $t(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 Xt(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 $t(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)?$t(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(Zt.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 Kt(e){return(Kt="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 Jt(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 Qt(e,t){return(Qt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function en(e,t){return!t||"object"!==Kt(t)&&"function"!=typeof t?tn(e):t}function tn(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function nn(e){return(nn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}Xt.propTypes={mediaUrl:l().string.isRequired,cancelReportForm:l().func,submitReportForm:l().func};var an=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Qt(e,t)}(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=nn(i);if(o){var n=nn(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return en(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={},F.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"}}),F.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&&F.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(Y.W8,null,a.createElement(dt.S,{key:"main",items:o})))}:{},t.onMoreOptionsPageChangeCallback=t.onMoreOptionsPageChangeCallback.bind(tn(t)),t.onCompleteMediaReport=t.onCompleteMediaReport.bind(tn(t)),t.cancelReportForm=t.cancelReportForm.bind(tn(t)),t.submitReportForm=t.submitReportForm.bind(tn(t)),F.Z._currentValue.can.reportMedia&&(t.moreOptionsPages.loggedInReportMedia=a.createElement("div",{className:"popup-fullscreen"},a.createElement(Y.W8,null,a.createElement("span",{className:"popup-fullscreen-overlay"}),a.createElement("div",null,a.createElement(Xt,{mediaUrl:d.Z.get("media-url"),submitReportForm:t.submitReportForm,cancelReportForm:t.cancelReportForm}))))),F.Z._currentValue.can.editMedia&&(t.moreOptionsPages.mediaStatusInfo=a.createElement("div",{className:"main-options"},a.createElement(Y.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&&F.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(Y.W8,null,a.createElement(dt.S,{key:"video-download-options",items:Object.values(p)})))}return t.onPopupsDisplayChange=t.onPopupsDisplayChange.bind(tn(t)),t.initMoreOptionsPopup(),t}return t=l,(n=[{key:"initMoreOptionsPopup",value:function(){this.moreOptionsPopup=Object.keys(this.moreOptionsPages).length?new G.Z(a.createElement("span",null,a.createElement(W.M,{type:"button"},a.createElement(q.O,{type:"more_horiz"}))),a.createElement(pt.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),U.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){Z.reportMedia(e)}},{key:"render",value:function(){return this.moreOptionsPopup?a.createElement("div",{className:"more-options active-options"+(this.props.allowDownload&&F.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}}])&&Jt(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 ln(e,t){return(ln=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function sn(e,t){return!t||"object"!==on(t)&&"function"!=typeof t?un(e):t}function un(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function cn(e){return(cn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}an.propTypes={allowDownload:l().bool.isRequired},an.defaultProps={allowDownload:!1};var dn=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&&ln(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=cn(i);if(o){var n=cn(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return sn(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(un(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,fe.uf)(this.props.views,!0)," ",1>=this.props.views?"view":"views"):null,a.createElement("div",{className:"media-actions"},a.createElement("div",null,F.Z._currentValue.can.likeMedia?a.createElement(nt,null):null,F.Z._currentValue.can.dislikeMedia?a.createElement(ut,null):null,F.Z._currentValue.can.shareMedia?a.createElement(Yt,null):null,!F.Z._currentValue.is.anonymous&&F.Z._currentValue.can.saveMedia&&-1<Be._currentValue.mediaTypes.indexOf(d.Z.get("media-type"))?a.createElement(Dt,null):null,this.props.allowDownload&&F.Z._currentValue.can.downloadMedia?this.downloadLink?a.createElement(ct,{link:this.downloadLink,title:this.props.title}):a.createElement(vt,null):null,a.createElement(an,{allowDownload:this.props.allowDownload})))))}}])&&rn(t.prototype,n),l}(a.PureComponent);function pn(e){return(pn="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 mn(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 fn(e,t){return(fn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function hn(e,t){return!t||"object"!==pn(t)&&"function"!=typeof t?yn(e):t}function yn(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function bn(e){return(bn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}dn.propTypes={allowDownload:l().bool.isRequired},dn.defaultProps={allowDownload:!1};var gn=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&fn(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=bn(i);if(o){var n=bn(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return hn(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(yn(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(dn,{title:n,views:e,categories:t,allowDownload:l}),a.createElement(ze,{author:i,published:o,description:r}))):null}}])&&mn(t.prototype,n),l}(a.PureComponent),vn=n(1345);function _n(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 En(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?En(e,t):void 0}}(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 En(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function wn(){var e=d.Z.get("media-data");return e&&e.related_media&&e.related_media.length?e.related_media[0]:null}function kn(e){var t=_n((0,a.useState)(wn()),2),n=t[0],i=t[1],o=_n((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(wn())}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&&U.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:U.p$})))))),a.createElement(vn.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 Cn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Pn(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 Cn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Cn(e,t):void 0}}(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(vn.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 Sn(e){return(Sn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function 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 Mn(e,t){return(Mn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Rn(e,t){return!t||"object"!==Sn(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Nn(e){return(Nn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}n(288),Pn.propTypes={hideFirst:l().bool},Pn.defaultProps={hideFirst:!0};var Dn=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)}(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=Nn(i);if(a){var n=Nn(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return Rn(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")}}}])&&On(t.prototype,n),r}(pe()),Zn=(0,fe.v$)(new Dn,"actions_handler"),xn=n(3386);function In(e){return a.createElement(vn.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 Ln(e){return(Ln="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function An(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function Tn(e,t){return(Tn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function jn(e,t){return!t||"object"!==Ln(t)&&"function"!=typeof t?Vn(e):t}function Vn(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Fn(e){return(Fn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}In.propTypes={items:l().array.isRequired,playlistActiveItem:xn.g},In.defaultProps={playlistActiveItem:1};var Un=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&&Tn(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=Fn(i);if(o){var n=Fn(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return jn(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:Zn.get("enabled-loop"),shuffle:Zn.get("enabled-shuffle"),savedPlaylist:Zn.get("saved-playlist-loop"),title:e.playlistData.title,link:e.playlistData.url,authorName:e.playlistData.user,authorLink:H.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(Vn(t)),t.onLoopClick=t.onLoopClick.bind(Vn(t)),t.onShuffleClick=t.onShuffleClick.bind(Vn(t)),t.onSaveClick=t.onSaveClick.bind(Vn(t)),t.onLoopRepeatUpdate=t.onLoopRepeatUpdate.bind(Vn(t)),t.onShuffleUpdate=t.onShuffleUpdate.bind(Vn(t)),t.onPlaylistSaveUpdate=t.onPlaylistSaveUpdate.bind(Vn(t)),Zn.on("loop-repeat-updated",t.onLoopRepeatUpdate),Zn.on("shuffle-updated",t.onShuffleUpdate),Zn.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(){Ce().dispatch({type:"TOGGLE_LOOP"})}},{key:"onShuffleClick",value:function(){Ce().dispatch({type:"TOGGLE_SHUFFLE"})}},{key:"onSaveClick",value:function(){Ce().dispatch({type:"TOGGLE_SAVE"})}},{key:"onShuffleUpdate",value:function(){var e=this;this.setState({shuffle:Zn.get("enabled-shuffle")},(function(){e.state.shuffle?U.wN("Playlist shuffle is on","shuffle-on"):U.wN("Playlist shuffle is off","shuffle-off")}))}},{key:"onLoopRepeatUpdate",value:function(){var e=this;this.setState({loopRepeat:Zn.get("enabled-loop")},(function(){e.state.loopRepeat?U.wN("Playlist loop is on","loop-on"):U.wN("Playlist loop is off","loop-off")}))}},{key:"onPlaylistSaveUpdate",value:function(){var e=this;this.setState({savedPlaylist:Zn.get("saved-playlist")},(function(){e.state.savedPlaylist?U.wN("Added to playlists library","added-to-playlists-lib"):U.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(W.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(W.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(In,{items:this.state.items,playlistActiveItem:this.state.activeItem})):null))}}])&&An(t.prototype,n),l}(a.PureComponent);function Hn(e){return(Hn="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 Wn(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 qn(e,t){return(qn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function zn(e,t){return!t||"object"!==Hn(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 Bn(e){return(Bn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}Un.propTypes={playlistData:l().object.isRequired,activeItem:xn.g},Un.defaultProps={};var Gn=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&qn(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=Bn(i);if(o){var n=Bn(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return zn(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(Un,{activeItem:this.state.activeItem,playlistData:this.props.playlistData}):a.createElement(kn,null),a.createElement(Pn,{hideFirst:!this.state.isPlaylistPage}))}}])&&Wn(t.prototype,n),l}(a.PureComponent);function Yn(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 $n(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)?$n(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 $n(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 Xn(e){var t=(0,a.useRef)(null),n=(0,a.useRef)(null),i=Yn((0,a.useState)(null),2),o=i[0],r=i[1],l=Yn((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 Kn(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 Jn(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)?Jn(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 Jn(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 Qn(e){var t=m.Z.get("config-options").embedded.video.dimensions,n=(0,a.useContext)(H.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=Kn((0,a.useState)(window.innerHeight-144+56),2),p=c[0],f=c[1],h=Kn((0,a.useState)(!1),2),y=h[0],b=h[1],g=Kn((0,a.useState)("16:9"),2),v=g[0],_=g[1],E=Kn((0,a.useState)(t.width),2),w=E[0],k=E[1],C=Kn((0,a.useState)(t.widthUnit),2),P=C[0],S=C[1],O=Kn((0,a.useState)(t.height),2),M=O[0],R=O[1],N=Kn((0,a.useState)(t.heightUnit),2),D=N[0],x=N[1],I=Kn((0,a.useState)(60),2),L=I[0],A=I[1],T=Kn((0,a.useState)(60),2),j=T[0],V=T[1],F=Kn((0,a.useState)([{key:"px",label:"px"},{key:"percent",label:"%"}]),2),z=F[0],B=F[1];function G(){f(window.innerHeight-144+56),A(l.current.offsetHeight),V(u.current.offsetHeight)}function Y(){setTimeout((function(){U.wN("Embed media code copied to clipboard","clipboardEmbedMediaCodeCopy")}),100)}return(0,a.useEffect)((function(){f(window.innerHeight-144+56),A(l.current.offsetHeight),V(u.current.offsetHeight)})),(0,a.useEffect)((function(){return m.Z.on("window_resize",G),d.Z.on("copied_embed_media_code",Y),function(){m.Z.removeListener("window_resize",G),d.Z.removeListener("copied_embed_media_code",Y)}}),[]),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(W.M,{type:"button",onClick:function(){void 0!==e.triggerPopupClose&&e.triggerPopupClose()}},a.createElement(q.O,{type:"close"})))),a.createElement("div",{ref:s,className:"on-right-middle",style:{top:L+"px",bottom:j+"px"}},a.createElement("textarea",{readOnly:!0,value:'<iframe width="'+("percent"===P?w+"%":w)+'" height="'+("percent"===D?M+"%":M)+'" 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),x(e?"px":D),R(e?parseInt(w*i/n,10):M),B(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),R(y?parseInt(w*a/n,10):M)},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(Xn,{valueCallback:function(e){e=""===e?0:e;var t=v.split(":"),n=t[0],i=t[1];k(e),R(y?parseInt(e*i/n,10):M)},unitCallback:function(e){S(e)},label:"Width",defaultValue:parseInt(w,10),defaultUnit:P,minValue:1,maxValue:99999,units:z})),a.createElement("div",{className:"options-group"},a.createElement(Xn,{valueCallback:function(e){e=""===e?0:e;var t=v.split(":"),n=t[0],i=t[1];R(e),k(y?parseInt(e*n/i,10):w)},unitCallback:function(e){x(e)},label:"Height",defaultValue:parseInt(M,10),defaultUnit:D,minValue:1,maxValue:99999,units:z})))))),a.createElement("div",{ref:u,className:"on-right-bottom"},a.createElement("button",{onClick:function(){Z.copyEmbedMediaCode(s.current.querySelector("textarea"))}},"COPY")))))}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 ti(e,t){return(ti=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ni(e,t){return!t||"object"!==ei(t)&&"function"!=typeof t?ii(e):t}function ii(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ai(e){return(ai=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}Xn.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},Qn.propTypes={triggerPopupClose:l().func};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&&ti(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=ai(t);if(n){var a=ai(this).constructor;e=Reflect.construct(i,arguments,a)}else e=i.apply(this,arguments);return ni(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(ii(t)),t.onPopupPageChange=t.onPopupPageChange.bind(ii(t)),t.triggerPopupClose=t.triggerPopupClose.bind(ii(t));var n={shareOptions:a.createElement("div",{className:"popup-fullscreen"},a.createElement(Y.W8,null,a.createElement("span",{className:"popup-fullscreen-overlay"}),a.createElement(Ut,null))),shareEmbed:a.createElement("div",{className:"popup-fullscreen share-embed-popup"},a.createElement(Y.W8,null,a.createElement("span",{className:"popup-fullscreen-overlay"}),a.createElement(Qn,{triggerPopupClose:t.triggerPopupClose})))};return t.sharePopup=new G.Z(a.createElement("button",null,a.createElement(W.M,{type:"span"},a.createElement(q.O,{type:"share"})),a.createElement("span",null,"SHARE")),a.createElement(pt.o,{initPage:t.state.popupCurrentPage,pageChangeSelector:".change-page",pageIdSelectorAttr:"data-page-id",pages:n,focusFirstItemOnPageChange:!1,pageChangeCallback:t.onPopupPageChange}),t.onPopupsDisplayChange),t}return o}(Yt);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 li(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function si(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 ui(e,t){return(ui=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ci(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 di(e){return(di=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var pi=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ui(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=di(i);if(o){var n=di(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return ci(this,e)});function l(){return li(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,fe.uf)(this.props.views,!0)," ",1>=this.props.views?"view":"views"):null,a.createElement("div",{className:"media-actions"},a.createElement("div",null,F.Z._currentValue.can.likeMedia?a.createElement(nt,null):null,F.Z._currentValue.can.dislikeMedia?a.createElement(ut,null):null,F.Z._currentValue.can.shareMedia?a.createElement(oi,null):null,!F.Z._currentValue.is.anonymous&&F.Z._currentValue.can.saveMedia&&-1<Be._currentValue.mediaTypes.indexOf(d.Z.get("media-type"))?a.createElement(Dt,null):null,this.props.allowDownload&&F.Z._currentValue.can.downloadMedia?this.downloadLink?a.createElement(ct,{link:this.downloadLink,title:this.props.title}):a.createElement(vt,null):null,a.createElement(an,{allowDownload:this.props.allowDownload})))))}}])&&si(t.prototype,n),l}(dn);function mi(e){return(mi="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 fi(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function hi(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 yi(e,t){return(yi=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function bi(e,t){return!t||"object"!==mi(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 gi(e){return(gi=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var vi=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)}(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=gi(i);if(o){var n=gi(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return bi(this,e)});function l(){return fi(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(pi,{title:n,views:e,categories:t,allowDownload:l}),a.createElement(ze,{author:i,published:o,description:r}))):null}}])&&hi(t.prototype,n),l}(gn);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 Ei(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 wi(e,t){return(wi=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ki(e,t){return!t||"object"!==_i(t)&&"function"!=typeof t?Ci(e):t}function Ci(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Pi(e){return(Pi=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Si(e){return(Si="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Oi(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Mi(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function Ri(e,t){return(Ri=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ni(e,t){return!t||"object"!==Si(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 Di(e){return(Di=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Zi=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ri(e,t)}(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=Di(i);if(r){var n=Di(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return Ni(this,e)});function s(){return Oi(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(M,null);case"pdf":return a.createElement(R,null)}return a.createElement(N,null)}}])&&Mi(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&&wi(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=Pi(i);if(o){var n=Pi(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return ki(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(Ci(t)),t.onMediaLoad=t.onMediaLoad.bind(Ci(t)),t.onMediaLoadError=t.onMediaLoadError.bind(Ci(t)),t.onPagePlaylistLoad=t.onPagePlaylistLoad.bind(Ci(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(){Z.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(V,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(vi,{key:"viewer-info"}),this.state.pagePlaylistLoaded?a.createElement(Gn,{key:"viewer-sidebar",mediaId:d.Z.get("media-id"),playlistData:d.Z.get("playlist-data")}):null]:[this.state.pagePlaylistLoaded?a.createElement(Gn,{key:"viewer-sidebar",mediaId:d.Z.get("media-id"),playlistData:d.Z.get("playlist-data")}):null,a.createElement(vi,{key:"viewer-info"})])])}}])&&Ei(t.prototype,n),l}(D.T));(0,i.X)("page-media",Zi)},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()}(); |