dr_py/templates/player/mui/js/mui-player-desktop-plugin.min.js
2023-05-11 13:13:01 +08:00

7 lines
56 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*!
* Mui Player Desktop Plugin Javascript Library v1.4.1
* Date2022-01-16
* Released under GPL-3.0 license
* https://muiplayer.js.org/
*/
"use strict";function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _createForOfIteratorHelper(e,t){var o="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!o){if(Array.isArray(e)||(o=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){o&&(e=o);var n=0,t=function(){};return{s:t,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:t}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,i=!0,r=!1;return{s:function(){o=o.call(e)},n:function(){var e=o.next();return i=e.done,e},e:function(e){r=!0,l=e},f:function(){try{i||null==o.return||o.return()}finally{if(r)throw l}}}}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(o="Object"===o&&e.constructor?e.constructor.name:o)||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,n=new Array(t);o<t;o++)n[o]=e[o];return n}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}!function(e,t){"object"==("undefined"==typeof exports?"undefined":_typeof(exports))&&"object"==("undefined"==typeof module?"undefined":_typeof(module))?module.exports=t():"function"==typeof define&&_typeof(define.amd)?define(t):e.MuiPlayerDesktopPlugin=t()}(window,function(){return function(m){function u(){return{defaults:[{functions:"循环播放",name:"loopPlay",show:!0,model:"switch",selected:!1,onToggle:function(e,t,o){t(),e.event.currentTarget.querySelector(".toogle-switch").classList.contains("open")?f.$el.videoObject.loop=!0:f.$el.videoObject.loop=!1}},{functions:"播放速度",name:"playbackRate",show:!0,model:"select",childConfig:[{functions:"0.25"},{functions:"0.5"},{functions:"0.75"},{functions:"正常",selected:!0},{functions:"1.25"},{functions:"1.5"},{functions:"1.75"},{functions:"2"}],onToggle:function(e,t,o){t(),o();o=f.$method.getLangObject(),e=e.functions;isNaN(parseFloat(e))?(f.$el.videoObject.playbackRate=1,h.rst(o.dsps)):(f.$el.videoObject.playbackRate=parseFloat(e),h.rst(o.tsps.replace("?",e)))}}],subtitle:{functions:"字幕",name:"subtitle",childConfig:[{functions:"打开",name:"loopPlay",model:"switch",selected:!0},{functions:"选择语言",childConfig:[],onToggle:function(o,n,e){var l=o.getPanelOption(o.panelIndex,"parent").panelIndex,i=f.$el.videoObject.textTracks;i&&i instanceof TextTrackList?function(){for(var e=0;e<i.length;e++){var t=i[e];o.functions==t.label?(t.mode="showing",o.getPanelOption(l,"parent").childConfig[0].selected=!0,n()):"showing"==t.mode&&(t.mode="hidden")}}():h.rst("the textTracks api is not supported by the browser.")}}],onToggle:function(a,s,e){var c=a.event.currentTarget.querySelector(".toogle-switch").classList.contains("open"),u=f.$el.videoObject.textTracks;u&&u instanceof TextTrackList?function(){if(c)for(var e=0;e<u.length;e++){var t=u[e];"showing"==t.mode&&(t.mode="hidden")}else for(var o=a.getPanelOption(a.panelIndex,"parent").childConfig[1].childConfig,e=0;e<u.length;e++){var n,l=u[e],i=_createForOfIteratorHelper(o);try{for(i.s();!(n=i.n()).done;){var r=n.value;if(l.label==r.functions&&1==r.selected){l.mode="showing";break}}}catch(e){i.e(e)}finally{i.f()}}s()}():h.rst("the textTracks api is not supported by the browser.")}}}}function r(e){"statics"==e&&(g=(new u).defaults,v.initSubtitleOption()&&g.push(v.initSubtitleOption())),!g.map(function(e){return e.name}).includes("subtitle")&&"statics"!=e&&v.initSubtitleOption()&&g.push(v.initSubtitleOption());var t,o=f.$method.getLangObject();for(t in g){var n=g[t].name;"loopPlay"!=n?"playbackRate"!=n?"subtitle"!=n||(g[t].functions=o.subtitles,g[t].childConfig[0].functions=o.open,g[t].childConfig[1].functions=o.selectLangage):(g[t].functions=o.playbackSpeed,g[t].childConfig[3].functions=o.normal):g[t].functions=o.loopPlay}var l=_toConsumableArray(m.customSetting||[]);if(l instanceof Array){for(var i=0;i<l.length;i++){var r=g.map(function(e){return e.name});-1!=r.indexOf(l[i].name)&&g.splice(r.indexOf(l[i].name),1)}(function e(){for(var t=0;t<l.length;t++)!1===l[t].show&&(l.splice(t,1),e())})()}var a=(e=f.option).loop,s=e.live;if(1==a||!0===s)for(var c in g)if("loopPlay"==g[c].name){1==a&&(g[0].selected=!0),!0===s&&g.splice(0,g.length);break}(e=[].concat(_toConsumableArray(g),_toConsumableArray(l))).sort(function(e,t){e=e.zIndex||0,t=t.zIndex||0;return t<e?-1:e<t?1:0}),function e(t,o){for(var n=0;n<t.length;n++)t[n].panelIndex=null==o?n.toString():o.toString()+"-"+n,t[n].childConfig instanceof Array&&0<t[n].childConfig.length&&e(t[n].childConfig,t[n].panelIndex)}(p=e)}var t=this,f=(m=m||{},{}),d=new function(){return{popupNodeInfo:{triggerButtonRect:{},popupRect:{}}}},p=null,g=[],h={rst:function(e){f.$method[f.$method.dc("03702W03303B02C03302P037038")](e)}},c={ctxmenuWrapper:function(){return f.$el.mPlayer.querySelector("#ctxmenu-wrapper")},hideShortcutPanel:function(){var e=f.$el.mPlayer.querySelector("#mplayer-shortcut");e&&(e.style.display="none")},hideCtxmenuList:function(e){(e=e||{}).stopPropagation&&e.stopPropagation();var t=c.ctxmenuWrapper().querySelector(".ctxmenulist");t.style.opacity=0,f._this._global_.ctxmenuTimer_1=setTimeout(function(){t.style.display="none"},100)},onCtxmenuFocus:function(e){f._this._global_.ctxmenuTimer_1&&clearTimeout(f._this._global_.ctxmenuTimer_1),f._this._global_.ctxmenuTimer_2&&clearTimeout(f._this._global_.ctxmenuTimer_2),c.ctxmenuWrapper().style.display="block",c.hideShortcutPanel()},onCtxmenuBlur:function(e){(e=e||{}).stopPropagation&&e.stopPropagation(),c.hideCtxmenuList(),f._this._global_.ctxmenuTimer_2=setTimeout(function(){c.ctxmenuWrapper().style.display="none",c.ctxmenuWrapper().removeChild(e.target)},300)},disCtx:function(o,e){for(var t=0;t<o.length;t++){var n=e.map(function(e){return e.name}).indexOf(o[t].name);-1!=n&&e.splice(n,1)}(function e(){for(var t=0;t<o.length;t++)!1!==o[t].show&&o[t].name&&o[t].context||(o.splice(t,1),e())})()},getCtxmenu:function(){var e=new this.dcm,t=[];(t=_toConsumableArray(m.contextmenu||[]))instanceof Array&&this.disCtx(t,e);var o,e=[].concat(_toConsumableArray(t),_toConsumableArray(e)),n=f.$method.getLangObject(),l=_createForOfIteratorHelper(e);try{for(l.s();!(o=l.n()).done;){var i=o.value;if("shortcuts"==i.name){i.context=n.shortcuts;break}}}catch(e){l.e(e)}finally{l.f()}return e.sort(function(e,t){e=e.zIndex||0,t=t.zIndex||0;return t<e?-1:e<t?1:0}),e},createCtxmenu:function(e){var t=c.getCtxmenu();if(2==e.button&&0!=t.length){var o=document.createElement("ul");o.setAttribute("class","ctxmenulist"),o.setAttribute("tabindex","0"),o.addEventListener("blur",c.onCtxmenuBlur),c.onCtxmenuFocus();for(var n=t.map(function(e){return e.name}),l=0;l<t.length;l++){var i=document.createElement("li");i.innerText=t[l].context,i.setAttribute("name",t[l].name),i.addEventListener("dblclick",function(e){e.stopPropagation()}),i.addEventListener("mousemove",function(e){e.stopPropagation()}),i.addEventListener("click",function(e){e.stopPropagation();e=n.indexOf(e.currentTarget.getAttribute("name"));t[e].click instanceof Function&&t[e].click(function(){f.$el.mPlayer.focus()})}),o.appendChild(i)}f.$method.removeNode(c.ctxmenuWrapper(),".ctxmenulist"),c.ctxmenuWrapper().appendChild(o),y.setElScale(o,{fontSize:14});var r=f.$el.mPlayer.getBoundingClientRect(),a=o.getBoundingClientRect(),s=e.clientX-r.left+a.width>r.width?r.width-a.width:e.clientX-r.left,r=e.clientY-r.top+a.height>r.height?r.height-a.height:e.clientY-r.top;o.style.top=r+"px",o.style.left=s+"px",o.focus(),setTimeout(function(){o.style.opacity=1},100)}},dcm:function(){var e=f.$method.dc;return[{name:e("03702W03303603802R039038037"),context:e("IY3JNBTGU"),click:function(){var e=f.$el.mPlayer.querySelector("#mplayer-shortcut");e&&(e.style.display="block"),f.$el.mPlayer.focus()}},]},onContextmenuEvent:function(e){e.preventDefault()}},a={togglePictureIcon:function(){return document.pictureInPictureElement?'<svg class="off-picture" xmlns="http://www.w3.org/2000/svg"viewBox="0 0 24 24"fill="#ffffff"><path d="m19,7l-14,0l0,10l14,0l0,-10zm4,12l0,-14.02c0,-1.1 -0.9,-1.98 -2,-1.98l-18,0c-1.1,0 -2,0.88 -2,1.98l0,14.02c0,1.1 0.9,2 2,2l18,0c1.1,0 2,-0.9 2,-2zm-2,0.02l-18,0l0,-14.05l18,0l0,14.05z"/><path fill="none"d="m0,0l24,0l0,24l-24,0l0,-24z"/></svg>':'<svg class="on-picture" xmlns="http://www.w3.org/2000/svg"viewBox="0 0 24 24"fill="#ffffff"><path d="M19 11h-8v6h8v-6zm4 8V4.98C23 3.88 22.1 3 21 3H3c-1.1 0-2 .88-2 1.98V19c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2zm-2 .02H3V4.97h18v14.05z"/><path fill="none"d="M0 0h24v24H0V0z"/></svg>'},monitorPictureChange:function(){var t;f._this._global_.webpagePlugin.addMonitorPictureEvent||(f._this._global_.webpagePlugin.addMonitorPictureEvent=!0,t=function(){f.$el.mplayerFooter.querySelector("#picture-in-picture").innerHTML=a.togglePictureIcon()},f.$el.videoObject.addEventListener("enterpictureinpicture",function(e){f._this.emit("pip-change",{pip:!0}),t(),f.$data.isFullScreen&&f.$method.closeFullScreen(),f.$method.setTooltipText(f.$el.mplayerFooter.querySelector("#picture-in-picture"),f.$method.getLangObject().exitPictureInPicture)}),f.$el.videoObject.addEventListener("leavepictureinpicture",function(e){f._this.emit("pip-change",{pip:!1}),t(),f.$method.setTooltipText(f.$el.mplayerFooter.querySelector("#picture-in-picture"),f.$method.getLangObject().pictureInPicture)}))},onPictureInPicture:function(e){e.currentTarget.querySelector("svg").classList.contains("on-picture")?f.$el.videoObject!=document.pictureInPictureElement&&f.$el.videoObject.requestPictureInPicture():document.exitPictureInPicture(),a.monitorPictureChange()}},s={volumeContainer:null,el:null,$el:function(){return{volumeSize:s.volumeContainer.querySelector(".volume-size"),volumeCapacity:s.volumeContainer.querySelector(".volume-capacity"),volumeDragBall:s.volumeContainer.querySelector(".volume-drag-ball"),progressBar:s.volumeContainer.querySelector(".progress-bar")}},data:null,$data:function(){return{startY:null,moveY:null,_defaultVolumeSize:null,_capacityRect:{},_dragBallRect:{}}},toggleVolumeControl:function(e){var t;e=!0===s.getStorageVolume().muted?0:e,s.data&&(t=s.data._capacityRect.height*(e/100)-s.data._dragBallRect.height,s.el.volumeDragBall.style.bottom=(0<t?t:0)+"px",s.el.progressBar.style.height=e+"%",s.el.volumeSize.innerText=e+"%"),f.$el.mplayerFooter.querySelector("#volume-switch").innerHTML=s.toggleVolumeIcon()},setVolume:function(e,t){t=Number.parseFloat(s.data._defaultVolumeSize||0)+(null==t?100:t);return 100<=t?t=100:t<=0&&(t=0),t=Number.parseInt(t),e instanceof Object&&"number"==typeof e.volume&&(t=e.volume),s.setStorageVolume(t),f.$el.videoObject.volume=t/100,s.toggleVolumeControl(t),t},computeProgress:function(e,t){t(e/s.el.volumeCapacity.getBoundingClientRect().height*100)},keyEventHandle:function(e){var t=f.$method.getKeyCode(e);-1!=new Array(13,38,40).indexOf(t)&&(e.stopPropagation(),e.preventDefault()),13!=t?38!=t?40==t&&n.bottomKeyDown():n.topKeyDown():s.onClickEvent({currentTarget:f.$el.mplayerFooter.querySelector("#volume-switch")},!0)},mouseEventHandle:function(t){switch(t.type){case"mousedown":!function(){s.data.startY=t.clientY;var e=s.el.volumeCapacity.getBoundingClientRect().bottom-t.clientY;s.computeProgress(e,function(e){f.$el.videoObject.muted&&(f.$el.videoObject.muted=!1);e=s.setVolume(!1,e);f._this._global_.webpagePlugin.startDownVolumeSize=e,s.data._defaultVolumeSize=s.el.progressBar.style.height.substr(0,s.el.progressBar.style.height.length-1)||0}),s.el.volumeDragBall.style.boxShadow="0 0 20px 3px "+f.$habit.themeColor,v.focusToggle("OFF"),s.volumeContainer.addEventListener("mousemove",s.mouseEventHandle),s.volumeContainer.addEventListener("mouseup",s.mouseEventHandle)}();break;case"mousemove":!function(){s.data.moveY=t.clientY,s.data.startY||(s.data.startY=t.clientY);var e=s.data.startY-s.data.moveY;s.computeProgress(e,function(e){e=s.setVolume(!1,e);f._this._global_.webpagePlugin.endDownVolumeSize=e})}();break;case"mouseup":s.data._defaultVolumeSize=0,s.el.volumeDragBall.style.boxShadow="none",s.volumeContainer.removeEventListener("mousemove",s.mouseEventHandle),s.volumeContainer.removeEventListener("mouseup",s.mouseEventHandle)}},getStorageVolume:function(){var e={};try{e=JSON.parse(window.localStorage.getItem("mp-player-volume"))||{}}catch(e){}return e},setStorageVolume:function(e,t){var o=s.getStorageVolume(),n=null!=t?o.volume||100:e,o=null!=t?t:f.$el.videoObject instanceof Element&&f.$el.videoObject.muted,e=(new Date).setMonth((new Date).getMonth()+1),t=(new Date).getTime();window.localStorage.setItem("mp-player-volume",JSON.stringify({volume:n,muted:o,expiration:e,creation:t}))},toggleVolumeIcon:function(){var e='<svg class="volume-full"fill="#ffffff"viewBox="0 0 24 24"xmlns="http://www.w3.org/2000/svg"><path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"/><path d="M0 0h24v24H0z" fill="none"/></svg>',t='<svg fill="#ffffff"viewBox="0 0 24 24"xmlns="http://www.w3.org/2000/svg"><path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02z"/><path d="M0 0h24v24H0z" fill="none"/></svg>',o='<svg class="volume-close"fill="#ffffff"viewBox="0 0 24 24"xmlns="http://www.w3.org/2000/svg"><path d="M16.5 12c0-1.77-1.02-3.29-2.5-4.03v2.21l2.45 2.45c.03-.2.05-.41.05-.63zm2.5 0c0 .94-.2 1.82-.54 2.64l1.51 1.51C20.63 14.91 21 13.5 21 12c0-4.28-2.99-7.86-7-8.77v2.06c2.89.86 5 3.54 5 6.71zM4.27 3L3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25c-.67.52-1.42.93-2.25 1.18v2.06c1.38-.31 2.63-.95 3.69-1.81L19.73 21 21 19.73l-9-9L4.27 3zM12 4L9.91 6.09 12 8.18V4z"/><path d="M0 0h24v24H0z" fill="none"/></svg>',n=s.getStorageVolume();return n.expiration<=(new Date).getTime()?e:!0===n.muted||0==n.volume?o:n.volume<50?t:e},createVolumePopup:function(){var e=(new y.popupInstance).createPopupElement();return e.setAttribute("popup-name","volume"),e.innerHTML='<div class="volume-container keyboard-input"id="volume-container"tabindex="0"><div class="volume-size">0%</div><div class="volume-capacity"><div class="volume-drag-ball"></div><div class="progress-bar"></div></div></div>',e.querySelector(".progress-bar").style.backgroundColor=f.$habit.themeColor,s.volumeContainer=e.querySelector("#volume-container"),s.el=new s.$el,s.data=new s.$data,s.volumeContainer.addEventListener("mousedown",s.mouseEventHandle),s.volumeContainer.addEventListener("keydown",s.keyEventHandle),s.volumeContainer.addEventListener("blur",function(){(new y.popupInstance).togglePopupVisible("OFF")}),e},showVolumePopup:function(e){var t;e=e||{},f.$data.isTouchMove||((t=f.$el.mPlayer.querySelector(".mp-popup"))||(t=s.createVolumePopup(),"keydown"==e.type&&setTimeout(function(){t.querySelector("#volume-container").focus()},100),f.$el.mplayerFooter.insertBefore(t,f.$el.mplayerFooter.childNodes[0]),f.$data.isFullScreen&&(y.setElScale(t,["width","height"]),y.setElScale(t.querySelector(".volume-capacity"),["width","height"]),y.setElScale(t.querySelector(".volume-drag-ball"),["width","height"]),y.setElScale(t.querySelector(".volume-container"),["fontSize"])),s.data._capacityRect=s.el.volumeCapacity.getBoundingClientRect(),s.data._dragBallRect=s.el.volumeDragBall.getBoundingClientRect(),e=s.getStorageVolume(),s.setVolume(e),(new y.popupInstance).setVisiblePopup(t,f.$el.mplayerFooter.querySelector("#volume-switch"))))},onClickEvent:function(e,t){var o,n;!1!==e.currentTarget.exist&&(e.currentTarget.querySelector("svg").classList.contains("volume-close")?(s.setStorageVolume(null,!1),o=s.getStorageVolume().volume||100,n=f._this._global_.webpagePlugin.endDownVolumeSize,e=f._this._global_.webpagePlugin.startDownVolumeSize,s.toggleVolumeControl(0==n?e:n||o),f.$el.videoObject.muted=!1):(s.setStorageVolume(null,!0),s.toggleVolumeControl(0),f.$el.videoObject.muted=!0),!0===t&&(f.$method.createTimerCloseControl(),y.showHandleIcon("volume-icon")))}},v={currentFocusPanelId:"",isFocusActive:!1,backPanel:function(e){var t=v.getPanelOption(e,"parent");v.showPanel(t,"previous",e)},selected:function(e){for(var t=f.$el.mPlayer.querySelector(".mp-popup"),o=t.querySelectorAll(".mp-panel-selected"),n=0;n<o.length;n++)o[n].classList.remove("mp-panel-selected");t.querySelector('[panel-index="'+e+'"]').classList.add("mp-panel-selected");for(var l=v.getPanelOption(e,"parent").childConfig||[],n=0;n<l.length;n++)l[n].panelIndex==e?l[n].selected=!0:l[n].selected&&"switch"!=l[n].model&&(l[n].selected=!1)},switched:function(e){var t=v.getPanelOption(e);t.selected=!t.selected;e=f.$el.mPlayer.querySelector('.mp-popup [panel-index="'+e+'"] .toogle-switch');e.classList.remove(t.selected?"close":"open"),e.classList.add(t.selected?"open":"close")},triggerSelected:function(t,e){var o,n;e.stopPropagation(),t&&(t.childConfig instanceof Array&&0<t.childConfig.length?v.showPanel(t):"switch"!=t.model&&!0===t.selected||(n=null,(n=(o=v.getPanelOption(t.panelIndex,"parent"))instanceof Array?t:o).onToggle instanceof Function&&n.onToggle({functions:t.functions,panelIndex:t.panelIndex,getPanelOption:v.getPanelOption,event:e},function(e){"switch"==t.model?v.switched(t.panelIndex):v.selected(t.panelIndex),e instanceof Function&&e()},function(e){o instanceof Object&&o.childConfig instanceof Array&&0<o.childConfig.length?setTimeout(function(){v.backPanel(o.panelIndex)},"number"==typeof e?e:100):console.warn("no subpanel configuration options are available")})))},setScalePopup:function(e){if(f.$data.isFullScreen&&e instanceof Element){y.setElScale(e,["width","height",e.classList.contains("mp-popup")?"fontSize":""]),y.setElScale(e.querySelector(".toogle-switch"),["width","height"]),y.setElScale(e.querySelector(".toogle-switch .ball"),["width","height"]);for(var t=e.querySelectorAll(".mp-menuitem"),o=0;o<t.length;o++)y.setElScale(t[o],["height","lineHeight"])}},isNextReady:!0,showPanel:function(e,o,t){var n,s,c,u,l,p,i,r,a;v.isNextReady&&(n=v.createSettingPopup(e),s=f.$el.mPlayer.querySelector(".mp-popup"),c=s.querySelector(".mp-panel-item"),s.appendChild(n.childNodes[0]),e=e instanceof Array?"homeSetting":e.functions,(u=s.querySelector('[panel-name="'+e+'"]')).classList.add("mp-panel-item"),v.setScalePopup(u),l=s.getBoundingClientRect(),p=c.getBoundingClientRect(),i=u.getBoundingClientRect(),e=(e=f.$el.mPlayer.getBoundingClientRect()).height-(e.height-i.bottom)-(e.top+10),r=i.height>=e?e:i.height,u.style.width=i.width+"px",u.style.height=r+"px",u.style.right=("previous"==o?p.width:-i.width)+"px",e=u.querySelector(".mp-panel-menu .mp-panel-selected"),t=u.querySelector('[panel-index="'+t+'"]'),a=e||t||u.querySelector("[panel-index]"),setTimeout(function(){a.focus()},250),setTimeout(function(){for(var e=s.querySelectorAll(".mp-panel"),t=0;t<e.length;t++)e[t].classList.contains("mp-popup-animation")||e[t].classList.add("mp-popup-animation");s.classList.contains("mp-popup-animation")||s.classList.add("mp-popup-animation"),c.style.opacity=0,c.style.right=("previous"==o?-p.width:i.width)+"px",l.width!=i.width&&(s.style.width=i.width+"px"),l.height!=r&&(s.style.height=r+"px"),u.style.right="0px",v.currentFocusPanelId=""},30),v.isNextReady=!1,setTimeout(function(){var e=s.getBoundingClientRect(),t=e.bottom,o=e.height,n=e.left,l=e.right,i=e.top,r=e.width,a=e.x,e=e.y;d.popupNodeInfo.popupRect={bottom:t,height:o,left:n,right:l,top:i,width:r,x:a,y:e},p.top<u.getBoundingClientRect().top&&(d.popupNodeInfo.popupRect.top=p.top,d.popupNodeInfo.popupRect.height=p.height),v.isNextReady=!0,s.removeChild(c)},250))},getPanelOption:function(i,r){var a=!1,s=null;return function e(t,o){for(var n=0;n<t.length&&!a;n++){var l=t[n];l.panelIndex==i?(a=!0,s="parent"==r?o:l):l.childConfig instanceof Array&&0<l.childConfig.length&&e(l.childConfig,l)}}(p,p),s},setCurrentModelEl:function(e){var t=e.childConfig,o=e.model||"select",n="";if("select"==o&&t instanceof Array&&0<t.length){for(var l=0;l<t.length;l++)if(!0===t[l].selected){n=t[l].functions||"";break}}else"switch"==o&&(n='<div class="toogle-switch '+(e.selected?"open":"close")+'" id="toggle-fit" style="background: '+f.$habit.themeColor+';"><div class="ball"></div></div>');return n},createSettingPopup:function(t){var e=(new y.popupInstance).createPopupElement();e.setAttribute("popup-name","setting"),t instanceof Array?e.innerHTML='<div class="mp-panel" panel-name="homeSetting"><div class="mp-panel-menu"></div></div>':(e.innerHTML='<div class="mp-panel mp-panel-child" panel-name="'+t.functions+'"><div class="mp-panel-menu"><ul class="mp-menuitem mp-panel-header"><li class="title"><div class="mp-menuitem-content left-arrow-icon">'+t.functions+"</div></li><li></li></ul></div></div>",e.querySelector(".mp-panel-header .title").addEventListener("click",function(e){e.stopPropagation(),v.isFocusActive=!0,v.backPanel(t.panelIndex)}));for(var o=t instanceof Array?t:t.childConfig,n=0;n<o.length;n++){var l,i,r,a=o[n]||{},s=a.model||"select";a.functions&&"string"==typeof a.functions&&((l=document.createElement("ul")).setAttribute("class","mp-menuitem"),l.setAttribute("panel-index",a.panelIndex),l.setAttribute("tabindex","0"),!0!==a.selected||"select"!=s||t instanceof Array||l.classList.add("mp-panel-selected"),(i=document.createElement("li")).innerHTML=a.functions,r=document.createElement("li"),(s=document.createElement("div")).setAttribute("class","mp-menuitem-content"),a.childConfig instanceof Array&&0<a.childConfig.length&&s.classList.add("arrow-icon"),"switch"==a.model&&s.classList.add("switch-icon"),s.innerHTML=v.setCurrentModelEl(a),r.appendChild(s),l.appendChild(i),l.appendChild(r),l.addEventListener("click",function(e){var t=v.getPanelOption(e.currentTarget.getAttribute("panel-index"));v.triggerSelected(t,e)}),l.addEventListener("mousedown",function(){v.focusToggle("OFF")}),l.addEventListener("blur",function(e){v.isFocusActive=!1,v.currentFocusPanelId=""}),l.addEventListener("focus",function(e){v.isFocusActive=!0,v.currentFocusPanelId=e.currentTarget.getAttribute("panel-index")}),l.addEventListener("keydown",function(e){v.settingOnKeyDownAction(e)}),e.querySelector(".mp-panel-menu").appendChild(l))}return e},showSettingPopup:function(e){if(e=e||{},!f.$data.isTouchMove){var t=f.$el.mPlayer.querySelector(".mp-popup");if(!t){r(),t=v.createSettingPopup(p),setTimeout(function(){t.querySelector("[panel-index]").focus()},100),f.$el.mplayerFooter.insertBefore(t,f.$el.mplayerFooter.childNodes[0]),v.setScalePopup(t),(new y.popupInstance).setVisiblePopup(t,e.currentTarget);for(var o=t.getBoundingClientRect(),e=f.$el.mPlayer.getBoundingClientRect(),e=e.height-(e.height-o.bottom)-(e.top+10),n=o.height>=e?e:o.height,l=t.querySelectorAll(".mp-popup .mp-panel,.mp-popup .mp-panel-menu"),i=0;i<l.length;i++)l[i].style.width=o.width+"px",l[i].style.height=n+"px";t.style.width=o.width+"px",t.style.height=n+"px",t.querySelector(".mp-panel").classList.add("mp-panel-item")}}},focusToggle:function(e){var t=f.$el.mPlayer;"ON"==e?t.classList.contains("mp-keyboard-focus")||t.classList.add("mp-keyboard-focus"):t.classList.contains("mp-keyboard-focus")&&t.classList.remove("mp-keyboard-focus")},settingOnKeyDownAction:function(e){var t=f.$el.mPlayer.querySelector(".mp-popup"),o=f.$method.getKeyCode(e);if(v.focusToggle("ON"),-1!=new Array(13,32,37,38,39,40).indexOf(o)&&(e.stopPropagation(),e.preventDefault()),32!=o&&13!=o)if(37!=o)if(38!=o)if(39!=o){if(40==o){l=[];l=(n=v.getPanelOption(v.currentFocusPanelId,"parent"))instanceof Array?n:(n||{}).childConfig||[];for(r=0;r<l.length;r++)if(l[r].panelIndex==v.currentFocusPanelId){r!=l.length-1?(i=l[r+1].panelIndex,t.querySelector('[panel-index="'+i+'"]').focus()):t.querySelector('[panel-index="'+l[0].panelIndex+'"]').focus();break}}}else(n=v.getPanelOption(v.currentFocusPanelId,"current"))&&n.childConfig instanceof Array&&0<n.childConfig.length&&v.showPanel(n,"next");else{var n,l=[];l=(n=v.getPanelOption(v.currentFocusPanelId,"parent"))instanceof Array?n:(n||{}).childConfig||[];for(var i,r=0;r<l.length;r++)if(l[r].panelIndex==v.currentFocusPanelId){0==r?t.querySelector('[panel-index="'+l[l.length-1].panelIndex+'"]').focus():(i=l[r-1].panelIndex,t.querySelector('[panel-index="'+i+'"]').focus());break}}else{var a=t.querySelector(".mp-panel-header .title");a&&a.click()}else{a=v.getPanelOption(v.currentFocusPanelId);v.triggerSelected(a,e)}},onSettingKeyDown:function(e,t){e.preventDefault(),f.$el.mplayerFooter.querySelector(".mp-popup").querySelector("[panel-index]").focus(),v.focusToggle("ON"),v.settingOnKeyDownAction(e)},initSubtitleOption:function(){var e=f.$el.videoObject?f.$el.videoObject.textTracks:"";if(e&&e instanceof TextTrackList&&0<e.length){var t=(new u).subtitle;t.childConfig[1].childConfig.splice(0,t.childConfig[1].childConfig.length);for(var o=0;o<e.length;o++){var n=e[o];t.childConfig[1].childConfig.push({functions:n.label,selected:"showing"==n.mode})}return t}}},n={toggleVisible:function(e,t){if(!0===e&&f.$data.showScreenControls)return f.$method.createTimerCloseControl(),void(f._this._global_.webpagePlugin.hiddleControl||t instanceof Function&&t());!0!==e||f.$data.showScreenControls||(f.$method.toggleControlsDisplay({type:"showControls"}),f._this._global_.webpagePlugin.hiddleControl=!0,setTimeout(function(){f._this._global_.webpagePlugin.hiddleControl=!1,t instanceof Function&&t()},300))},escKeyDown:function(){(new y.popupInstance).togglePopupVisible("OFF"),v.focusToggle("OFF"),f.$el.mPlayer.focus()},confirmKeyDown:function(e){(new t.interface)._onAgentMpTap("click"),n.escKeyDown()},leftKeyDown:function(){var e;!0!==f.option.live&&(n.toggleVisible(!0),e=f.$el.videoObject.currentTime-5,f.$data.currentTime=0<e?e:.1,f.$el.videoObject.currentTime=f.$data.currentTime,y.showHandleIcon("progress-back"),(new y.popupInstance).togglePopupVisible("OFF"))},rightKeyDown:function(){var e,t;!0!==f.option.live&&(n.toggleVisible(!0),e=f.$data,(t=f.$el.videoObject.currentTime+5)<=e.duration?f.$data.currentTime=t:f.$data.currentTime=Number.parseInt(e.duration),f.$el.videoObject.currentTime=f.$data.currentTime,y.showHandleIcon("progress-forward"),(new y.popupInstance).togglePopupVisible("OFF"))},topKeyDown:function(){!1!==f.$el.mplayerFooter.querySelector("#volume-switch").exist&&(n.toggleVisible(!0,function(){var e=s.getStorageVolume(),t=e.volume;!0===e.muted?(f.$el.videoObject.muted=!1,t=5):t+=5,s.showVolumePopup(event),s.setVolume(!1,t)}),y.showHandleIcon("volume-icon"))},bottomKeyDown:function(){!1!==f.$el.mplayerFooter.querySelector("#volume-switch").exist&&(n.toggleVisible(!0,function(){var e=s.getStorageVolume(),t=e.volume;!0===e.muted?(f.$el.videoObject.muted=!1,t=5):t-=5,s.showVolumePopup(event),s.setVolume(!1,t)}),y.showHandleIcon("volume-icon"))},onDocKeydown:function(e){var t=f.$method.getKeyCode(e);-1!=new Array(37,38,39,40,32,13).indexOf(t)&&(e.stopPropagation(),e.preventDefault()),70!=t?77!=t?27!=t?32!=t&&75!=t?37!=t?38!=t?39!=t?40==t&&n.bottomKeyDown():n.rightKeyDown():n.topKeyDown():n.leftKeyDown():n.confirmKeyDown(e):n.escKeyDown():s.onClickEvent({currentTarget:f.$el.mplayerFooter.querySelector("#volume-switch")},!0):(e=f.$el.mplayerFooter.querySelector("#full-switch"))instanceof Element&&e.click()}},y={popupInstance:function(){this.createPopupElement=function(){var e=document.createElement("div");return e.setAttribute("class","mp-popup"),e},this.setVisiblePopup=function(e,t){this.togglePopupVisible("ON");var o=t.getBoundingClientRect(),n=e.getBoundingClientRect(),l=f.$el.mPlayer.getBoundingClientRect(),i=f.$el.touchEffective instanceof Element?f.$el.touchEffective.getBoundingClientRect():{},n=l.width-o.left+l.left-n.width/2-o.width/2;e.style.right=(12<=n?n:12)+"px";l=l.height-(i.top||o.top-5)+l.top;return e.style.bottom=l+"px",d.popupNodeInfo.triggerButtonRect=t.getBoundingClientRect(),d.popupNodeInfo.popupRect=e.getBoundingClientRect(),e},this.togglePopupVisible=function(e){var t=!!f.$el.mPlayer&&f.$el.mPlayer.querySelector(".mp-popup");t&&(t.classList.add("popup-toggle"),"OFF"==e?(f.$el.mPlayer.focus(),t.style.opacity=0,setTimeout(function(){t.parentNode&&t.parentNode.removeChild(t)},110),f._this._global_.webpagePlugin.showSettingState=!1,f.$method.createTimerCloseControl(),document.removeEventListener("mousemove",y.onDocMousemoveEvent)):(setTimeout(function(){t.style.opacity=1},5),setTimeout(function(){t.classList.remove("popup-toggle")},110),f._this._global_.webpagePlugin.showSettingState=!0,setTimeout(function(){f.$method.createTimerCloseControl({type:"cancel"})},100),document.addEventListener("mousemove",y.onDocMousemoveEvent)))}},onEffectiveOverEvent:function(e){var t=(e=e||{}).type||"";if(!f._this._global_.webpagePlugin.showSettingState){var o=function(e){var t=f.$el.touchEffective.querySelectorAll("#progress-total,#progress-buffered,#progress-play");if(e){for(var o=0;o<t.length;o++)t[o].classList.add("progress-hover-scale");f.$el.progressBall.classList.add("hover-scale"),f.$el.touchEffective.querySelector(".mp-tooltip").style.display="block",f.$el.touchEffective.querySelector(".mp-thumbnails").style.display="block"}if(!e){for(o=0;o<t.length;o++)t[o].classList.remove("progress-hover-scale");f.$el.progressBall.classList.remove("hover-scale"),f.$el.touchEffective.querySelector(".mp-tooltip").style.display="none",f.$el.touchEffective.querySelector(".mp-thumbnails").style.display="none"}};switch(t){case"mouseover":o(!0),y.showTimeTooltip(e),y.showThumbnails(e),f.$el.touchEffective.addEventListener("mousemove",y.onEffectiveOverEvent),f.$el.touchEffective.addEventListener("mouseout",y.onEffectiveOverEvent);break;case"mousemove":o(!0),y.showTimeTooltip(e),y.showThumbnails(e);break;case"mouseout":o(!1),f.$el.touchEffective.removeEventListener("mousemove",y.onEffectiveOverEvent),f.$el.touchEffective.removeEventListener("mouseout",y.onEffectiveOverEvent)}}},addControlTooltip:function(e){for(var t=f.$el.mplayerFooter.querySelectorAll(".footer-control"),o=0;o<t.length;o++)t[o].getAttribute("tooltip")&&(t[o].addEventListener("mouseover",function(e){var t,o,n,l=document.createElement("div");l.setAttribute("class","mp-tooltip"),l.innerText=e.currentTarget.getAttribute("tooltip"),!1!==f.$el.mplayerFooter.querySelector(".mp-tooltip").exist||f.$data.isTouchMove||(f.$el.mplayerFooter.insertBefore(l,f.$el.mplayerFooter.childNodes[0]),t=e.currentTarget.getBoundingClientRect(),o=l.getBoundingClientRect(),n=f.$el.mPlayer.getBoundingClientRect(),e=f.$el.touchEffective instanceof Element?f.$el.touchEffective.getBoundingClientRect():{},o=n.width-t.left+n.left-o.width/2-t.width/2,l.style.right=(16<=o?o:16)+"px",n=n.height-(e.top||t.top-5)+n.top,l.style.bottom=n+"px")}),t[o].addEventListener("mouseout",function(e){f.$method.removeNode(f.$el.mplayerFooter,".mp-tooltip")}))},thumbnailStyleAtBottom:function(){var e="number"==typeof m.fullScaling&&1<=m.fullScaling?m.fullScaling:1.2;return f.$data.isFullScreen?25.6*e:25.92},showThumbnails:function(e){var n,l,i,r=f.$el.touchEffective.querySelector(".mp-thumbnails"),a=0,s=0,t=m.thumbnails||{},c=t.preview||[],o=t.tile||[10,10],t=t.scale||[160,90],u=o[0]||10,p=o[1]||10,d=t[0]||160,g=t[1]||90;0!=c.length&&(n=f.$el.mPlayer.getBoundingClientRect(),l=f.$el.touchEffective.getBoundingClientRect(),i=e.clientX-l.left,f.$method.computeProgress(i,f.$el.touchEffective,function(e){100<=e?e=100:e<=0&&(e=0);var t=parseInt(e/100*f.$data.duration),o=(a=t)%u==0?0:parseInt(a%u)*d,e=a/u<1?0:parseInt(a/u)*g;!function(){s=parseInt(a/(u*p)),!1===f.$el.touchEffective.querySelector('[data-playimage-index="'+s+'"]').exist&&((e=document.createElement("div")).setAttribute("class","preview-image"),e.setAttribute("data-playimage-index",s),e.style.width="100%",e.style.height="100%",c.length>s&&(e.style.backgroundImage="url("+c[s]+")"),!1===r.exist?((r=document.createElement("div")).setAttribute("class","mp-thumbnails thumbnails-scale"),r.style.outline="2px #FFFFFF solid",r.style.width=d+"px",r.style.height=g+"px",r.style.position="absolute",r.style.pointerEvents="none",r.appendChild(e),f.$el.touchEffective.appendChild(r)):r.appendChild(e));for(var e=f.$el.touchEffective.querySelectorAll(".preview-image"),t=0;t<e.length;t++){var o=e[t].getAttribute("data-playimage-index");e[t].style.display=o!=s?"none":"block"}}();t=r.getBoundingClientRect();f.$el.touchEffective.querySelector('[data-playimage-index="'+s+'"]').style.backgroundPosition=-o+"px "+-e+"px";o=y.thumbnailStyleAtBottom();r.style.bottom=Math.round(o)+"px";e=i-t.width/2,o=l.left-n.left+e,t=n.width-(l.left-n.left+e+t.width);12<=o&&12<=t&&(r.style.left=e+"px")}))},showTimeTooltip:function(e){var t=f.$el.touchEffective.getBoundingClientRect(),l=e.clientX-t.left,i=f.$el.mPlayer.getBoundingClientRect(),r=f.$el.touchEffective.getBoundingClientRect();f.$method.computeProgress(l,f.$el.touchEffective,function(e){100<=e?e=100:e<=0&&(e=0);var t=e/100*f.$data.duration,o=f.$method.formatCurrentTime(t),n=f.$el.touchEffective.querySelector(".mp-tooltip");!1===n.exist&&((n=document.createElement("div")).setAttribute("class","mp-tooltip"),f.$el.touchEffective.appendChild(n));e=y.thumbnailStyleAtBottom();n.style.bottom=Math.round(e+2)+"px";t=n.getBoundingClientRect();n.innerText=o;e=l-t.width/2,o=r.left-i.left+e,t=i.width-(r.left-i.left+e+t.width);12<=o&&12<=t&&(n.style.left=e+"px")})},addFocusKeyboardHandle:function(){for(var e=f.$el.mPlayer.querySelectorAll(".keyboard-input"),t=0;t<e.length;t++)e[t].addEventListener("keydown",function(e){var t=f.$method.getKeyCode(e),o=e.currentTarget.getAttribute("id");-1!=new Array(13,32).indexOf(t)&&((new y.popupInstance).togglePopupVisible("OFF"),32!=t&&("setting-switch"!=o?"volume-switch"!=o?e.currentTarget.click():s.showVolumePopup(e):v.showSettingPopup(e)))}),e[t].addEventListener("mousedown",function(e){f._this._global_.webpagePlugin.inputMousedownFlag=!0,v.focusToggle("OFF"),f.$method.createTimerCloseControl()}),e[t].addEventListener("focus",function(e){setTimeout(function(){f._this._global_.webpagePlugin.inputMousedownFlag||v.focusToggle("ON"),f._this._global_.webpagePlugin.inputMousedownFlag=!1,y.onMpMousemoveEvent(),document.activeElement.classList.contains("keyboard-input")&&f.$method.createTimerCloseControl({type:"cancel"})},10)}),e[t].addEventListener("blur",function(){f.$el.mPlayer.querySelector(".mplayer-sidebar.open")||f.$method.createTimerCloseControl()})},onMpMousemoveEvent:function(){f.$data.showScreenControls?f._this._global_.webpagePlugin.showSettingState||f.$method.createTimerCloseControl():f.$method.toggleControlsDisplay({type:"showControls"}),f._this._global_.webpagePlugin.forControlsClose=!1},onMpMouseleaveEvent:function(e){f._this._global_.webpagePlugin.showSettingState||f._this._global_.webpagePlugin.forControlsClose||f.$data.isTouchMove||f.$method.toggleControlsDisplay({type:"hideControls"}),f._this._global_.webpagePlugin.forControlsClose=!0},onDocMousemoveEvent:function(e){var t=d.popupNodeInfo.popupRect,o=d.popupNodeInfo.triggerButtonRect,n=t.left,l=t.left+t.width,i=t.top,r=t.top+t.height,l=e.clientX>n&&e.clientX<l&&e.clientY>i&&e.clientY<r,i=o.left-15,r=o.left+o.width+15,t=t.bottom-5,o=o.bottom+5,o=e.clientX>i&&e.clientX<r&&e.clientY>t&&e.clientY<o;l||o||!v.isNextReady||(new y.popupInstance).togglePopupVisible("OFF")},setElScale:function(e,t){var o="number"==typeof m.fullScaling&&1<=m.fullScaling?m.fullScaling:1.2,n=f.$data.isFullScreen,l={};if(Array.isArray(t)?t.forEach(function(e){l[e]=""}):l=t,e instanceof Element){var i=function(e){return Math.round(e)},r=function(e){return Number(e.replace("px",""))},a=e.getBoundingClientRect(),s=e.getAttribute("stylesheet");try{s=s?JSON.parse(s):{}}catch(e){}var c,u,p,d,g=function(){e.style.lineHeight=n?i((l.lineHeight||a.height)*o)+"px":(l.lineHeight||i(a.height*o))+"px"};for(c in l)switch(c){case"width":d=void 0,n?(d=i((l.width||a.width)*o),e.style.width=(d%2==0?d:d+1)+"px"):e.style.width=l.width?l.width+"px":s.width||i(a.width/o)+"px";break;case"height":p=void 0,n?(p=i((l.height||a.height)*o),e.style.height=(p%2==0?p:p+1)+"px"):e.style.height=l.height?l.height+"px":s.height||i(a.height/o)+"px";break;case"fontSize":u=void 0,u=document.defaultView.getComputedStyle(e,null).fontSize,e.style.fontSize=n?i((l.fontSize||r(u))*o)+"px":l.fontSize?l.fontSize+"px":s.fontSize||i(r(u)/o)+"px";break;case"lineHeight":case"transform":g()}}},toggles:function(){this.pageFull=function(e){function t(){l.contains("page-fullscreen")||(f.$el.mPlayer.classList.add("page-fullscreen"),n[0].style.display="none",n[1].style.display="block",n[0].parentNode.setAttribute("tooltip",f.$method.getLangObject().exitPageScreen),f._this.emit("pagefull-change",{pagefull:!0})),e instanceof Object&&f.$method.changeVideoSize({type:"pagefulll"})}function o(){l.contains("page-fullscreen")&&(f.$el.mPlayer.classList.remove("page-fullscreen"),n[0].style.display="block",n[1].style.display="none",n[0].parentNode.setAttribute("tooltip",f.$method.getLangObject().pageScreen),f._this.emit("pagefull-change",{pagefull:!1})),e instanceof Object&&f.$method.changeVideoSize({type:"pagefulll"})}var n=f.$el.mPlayer.querySelectorAll("._fullpage,._unfullpage"),l=f.$el.mPlayer.classList;"change"==e?o():"initFullFixed"==e?t():((f.$el.mPlayer.classList.contains("page-fullscreen")?o:t)(),f.$data.isFullScreen&&f.$method.fullToggle())},this.timeControls=function(e){var n=f.$el.mPlayer.querySelector("#current-time");e?function e(){var t=new Date,o=t.getHours()<10?"0"+t.getHours():t.getHours(),t=t.getMinutes()<10?"0"+t.getMinutes():t.getMinutes();n&&(n.innerHTML=o+":"+t,n.style.display="inline-block"),f._this._global_.webpagePlugin.timer_1&&clearInterval(f._this._global_.webpagePlugin.timer_1),f._this._global_.webpagePlugin.timer_1=setTimeout(function(){f.$data.isFullScreen&&f.$data.showScreenControls&&e()},1e3)}():n&&(n.style.display="none")},this.scaleControls=function(e){var t="number"==typeof m.fullScaling&&1<m.fullScaling?m.fullScaling:1.2,o=f.$el.mPlayer.classList;if((!e||!o.contains("fullscreen-scaling"))&&(e||o.contains("fullscreen-scaling"))){for(var n,l,i,r,a,s=[{selector:".mplayer-header,.mplayer-footer",attr:["height"]},{selector:".header-control,.footer-control,.mplayer-sidebar",attr:["width","fontSize"]},{selector:"#mplayer-loading .mplayer-loading__circular",attr:{width:40,height:40}},{selector:".mplayer-shortcut",attr:{width:430}},{selector:".mplayer-shortcut .title",attr:{fontSize:16}},{selector:".mplayer-shortcut .close-shortcut-panel",attr:{fontSize:28}},{selector:".mplayer-shortcut ul",attr:{fontSize:14}},{selector:"#progress-total,#progress-buffered,#progress-play",attr:{height:2}},{selector:"#progress-ball .progress-ball",attr:{width:15,height:15}},{selector:"#mplayer-toast",attr:["fontSize"]},{selector:"#mplayer-footer .spot",attr:["height","width"]}],c=0;c<s.length;c++)for(var u=f.$el.mPlayer.querySelectorAll(s[c].selector),p=0;p<u.length;p++)y.setElScale(u[p],s[c].attr);e?o.add("fullscreen-scaling"):o.remove("fullscreen-scaling"),e?(n="@-webkit-keyframes mp-bezel-fadeout {from{opacity: 1;}to{opacity: 0;-webkit-transform: scale("+1.5*t+");transform: scale("+1.5*t+");}}@keyframes mp-bezel-fadeout {from{opacity: 1;}to{opacity: 0;-webkit-transform: scale("+1.5*t+");transform: scale("+1.5*t+");}}",l=".mp-tooltip {font-size: "+14*t+"px !important;}",i=".mp-thumbnails.thumbnails-scale {-webkit-transform: scale("+t+");-ms-transform: scale("+t+");transform: scale("+t+");-webkit-transform-origin: left bottom;-ms-transform-origin: left bottom;transform-origin: left bottom;}",o=".toast-scaling{font-size: "+14*t+"px !important;}",e=".mp-keyboard-focus .mp-menuitem:focus {box-shadow: inset 0 0 0 "+2*t+"px rgba(27,127,204,0.8) !important;}.mp-keyboard-focus .keyboard-input:focus {box-shadow: inset 0 0 0 "+2*t+"px rgba(27,127,204,0.8) !important;}",t="",f.$el.mPlayer.querySelector("#progress-container")&&(r=f.$el.mPlayer.querySelector("#progress-container").getBoundingClientRect(),a=f.$el.mPlayer.querySelector("#progress-container #progress-total").getBoundingClientRect(),t=".mplayer-footer .progress .progress-container.upper-position {margin-bottom: -"+(r.height-a.height)/2+"px !important;}"),(a=(r=document.getElementsByTagName("head").item(0)).querySelector("#player-scaling-style"))?f.$method.removeNode(r,"#player-scaling-style"):((a=document.createElement("style")).setAttribute("id","player-scaling-style"),a.setAttribute("type","text/css")),a.innerHTML=n+l+i+o+e+t,r.appendChild(a)):f.$method.removeNode(document.getElementsByTagName("head").item(0),"#player-scaling-style")}}},showHandleIcon:function(e){var t='<svg t="1598581427609" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2856" width="24" height="24"><path d="M267.58370352 186.11160469h162.94419765v651.77679062H267.58370352zM593.47209883 186.11160469h162.94419765v651.77679062h-162.94419765z" p-id="2857" fill="#ffffff"></path></svg>',o='<svg t="1598581671973" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2357" width="24" height="24"><path d="M287.49910545 187.55999756l502.5923252 324.51242209-502.5923252 324.44000244z" p-id="2358" fill="#ffffff"></path></svg>',n='<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="16579" width="100%" height="100%"><path d="M512 8v237.17647013h237.17647013m148.23529481 266.82352987a59.29411753 59.29411753 0 1 1-59.29411753 59.29411753 59.29411753 59.29411753 0 0 1 59.29411753-59.29411753zM512 245.17647012a326.11764741 326.11764741 0 1 0 326.11764741 326.11764741h118.58823506A444.70588247 444.70588247 0 1 1 512 126.58823506v118.58823507z m-60.77647013 140.17129482l-24.90352987 194.3068237a300.23576494 300.23576494 0 0 1 48.32470617-3.20188247c71.74588247 0 106.72941136 32.61176494 106.72941136 84.34588247a81.79623506 81.79623506 0 0 1-85.68 83.27858766 166.70541136 166.70541136 0 0 1-77.97176494-20.30823507l-13.93411753 46.99058864a191.31247013 191.31247013 0 0 0 93.9811763 22.4131763 137.76988247 137.76988247 0 0 0 146.75294123-137.71058864c0-82.21129383-63.14823506-124.93270617-136.08-124.93270617-11.26588247 0-18.67764741 1.06729383-26.68235259 1.60094123l13.3411763-95.55247012h140.82352987v-51.23011753h-184.70117629z" p-id="16580" fill="#ffffff"></path></svg>',l='<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="16817" width="100%" height="100%"><path d="M512 1016A444.70588247 444.70588247 0 0 1 67.29411753 571.29411753a59.29411753 59.29411753 0 0 1 118.58823506 0A326.11764741 326.11764741 0 1 0 512 245.17647012V126.58823506a444.70588247 444.70588247 0 0 1 0 889.41176494z m108.50823506-360.53788247a137.76988247 137.76988247 0 0 1-146.75294123 137.71058864 190.42305877 190.42305877 0 0 1-93.9811763-22.4131763l13.63764741-46.99058864a166.70541136 166.70541136 0 0 0 77.97176493 20.30823507 82.03341136 82.03341136 0 0 0 85.97647013-83.27858766c0-51.79341136-35.28-84.34588247-106.72941136-84.34588247a304.23811753 304.23811753 0 0 0-48.62117728 3.20188247l25.2-194.3068237h184.70117728v51.23011753h-140.82352987l-13.3411763 95.55247012c8.00470617-0.53364741 15.41647013-1.60094123 26.68235259-1.60094123 72.93176494 0 136.08 42.72141136 136.08 124.93270617zM512 8v237.17647013H274.82352987z" p-id="16818" fill="#ffffff"></path></svg>',i=f.$el.mPlayer.querySelector(".mp-bezel-text-hide");switch(e){case"mouseclick":f.$data.isPlay?i.querySelector(".mp-bezel-icon").innerHTML=t:i.querySelector(".mp-bezel-icon").innerHTML=o;break;case"progress-forward":i.querySelector(".mp-bezel-icon").innerHTML=n;break;case"progress-back":i.querySelector(".mp-bezel-icon").innerHTML=l;break;case"volume-icon":i.querySelector(".mp-bezel-icon").innerHTML=s.toggleVolumeIcon()}"none"==i.style.display?i.style.display="block":(i.style.display="none",f._this._global_.webpagePlugin.handleIconTimer_1||(f._this._global_.webpagePlugin.handleIconTimer_1=setTimeout(function(){f._this._global_.webpagePlugin.handleIconTimer_1=!1,i.style.display="block"},15))),f._this._global_.webpagePlugin.handleIconTimer_2&&window.clearTimeout(f._this._global_.webpagePlugin.handleIconTimer_2),f._this._global_.webpagePlugin.handleIconTimer_2=setTimeout(function(){i.style.display="none"},400)},buildBasePanel:function(e){var t=e.querySelector("#right-part"),o=document.createElement("button");o.setAttribute("class","player-btn keyboard-input footer-control"),o.setAttribute("id","volume-switch"),o.setAttribute("control",""),o.innerHTML=s.toggleVolumeIcon(),t.insertBefore(o,t.childNodes[t.childNodes.length-1]),o.addEventListener("mouseover",s.showVolumePopup),o.addEventListener("click",s.onClickEvent),!document.pictureInPictureEnabled||e.querySelector("video").disablePictureInPicture||((n=document.createElement("button")).setAttribute("class","player-btn keyboard-input footer-control picture-in-picture"),n.setAttribute("id","picture-in-picture"),n.setAttribute("tooltip",f.$method.getLangObject().pictureInPicture),n.setAttribute("control",""),n.innerHTML=a.togglePictureIcon(),t.insertBefore(n,t.childNodes[t.childNodes.length-1]),n.addEventListener("click",a.onPictureInPicture)),r("statics");var n=(f.option.subtitle||{}).tracks;(0<p.length||Array.isArray(n)&&0<n.length)&&((l=document.createElement("button")).setAttribute("class","player-btn keyboard-input footer-control"),l.setAttribute("id","setting-switch"),l.setAttribute("control",""),l.innerHTML='<svg t="1607605827678" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2386"><path d="M857.9375 512c0-49.125 30.84375-90.75 74.0625-107.34375-10.3125-40.5-26.25-78.65625-47.0625-113.71875C842.5625 309.78125 791.375 302.09375 756.6875 267.3125c-34.6875-34.6875-42.375-85.96875-23.53125-128.25C698 118.25 659.84375 102.3125 619.34375 92c-16.6875 43.21875-58.3125 74.0625-107.34375 74.0625-49.125 0-90.75-30.84375-107.34375-74.0625-40.5 10.3125-78.65625 26.25-113.71875 47.0625 18.84375 42.375 11.15625 93.5625-23.53125 128.25-34.6875 34.6875-85.96875 42.375-128.25 23.625C118.25 326 102.3125 364.15625 92 404.65625c43.21875 16.6875 74.0625 58.3125 74.0625 107.34375 0 49.125-30.84375 90.75-74.0625 107.34375 10.3125 40.5 26.25 78.65625 47.0625 113.71875C181.4375 714.21875 232.625 721.90625 267.3125 756.6875c34.6875 34.6875 42.375 85.96875 23.53125 128.25C326 905.75 364.15625 921.6875 404.65625 932c16.6875-43.21875 58.3125-74.0625 107.34375-74.0625 49.125 0 90.75 30.84375 107.34375 74.0625 40.5-10.3125 78.65625-26.25 113.71875-47.0625-18.84375-42.375-11.15625-93.5625 23.53125-128.25 34.6875-34.6875 85.96875-42.375 128.25-23.625C905.75 698 921.6875 659.84375 932 619.34375c-43.21875-16.59375-74.0625-58.21875-74.0625-107.34375zM512 627.3125c-63.65625 0-115.3125-51.65625-115.3125-115.3125s51.65625-115.3125 115.3125-115.3125 115.3125 51.65625 115.3125 115.3125-51.65625 115.3125-115.3125 115.3125z" p-id="2387" fill="#ffffff"></path></svg>',l.addEventListener("mouseover",v.showSettingPopup),t.insertBefore(l,t.childNodes[t.childNodes.length-1]));var l=document.createElement("button");l.setAttribute("class","player-btn keyboard-input footer-control"),l.setAttribute("id","pagefull-switch"),l.setAttribute("tooltip",f.$method.getLangObject().pageScreen),l.setAttribute("control",""),l.innerHTML='<div class="_fullpage"controls="full-page"><svg t="1607605504727"class="icon"viewBox="0 0 1024 1024"version="1.1"xmlns="http://www.w3.org/2000/svg"p-id="2356"><path d="M948.90666667 851.69493333H75.09333333c-27.30666667 0-49.152-21.84533333-49.152-43.69066666v-655.36c0-27.30666667 21.84533333-49.152 49.152-49.152h873.81333334c27.30666667 0 43.69066667 21.84533333 43.69066666 49.152v655.36c0 27.30666667-16.384 43.69066667-43.69066666 43.69066666z m-824.66133334-87.38133333h780.97066667V196.33493333H124.24533333v567.97866667z"p-id="2357"fill="#ffffff"></path><path d="M238.93333333 496.70826667c-21.84533333 0-43.69066667-16.384-43.69066666-43.69066667v-136.53333333c0-21.84533333 16.384-43.69066667 43.69066666-43.69066667h136.53333334c21.84533333 0 43.69066667 16.384 43.69066666 43.69066667s-21.84533333 38.22933333-43.69066666 38.22933333H282.624v98.304c0 21.84533333-21.84533333 43.69066667-43.69066667 43.69066667zM785.06666667 687.85493333h-136.53333334c-21.84533333 0-43.69066667-16.384-43.69066666-43.69066666s16.384-43.69066667 43.69066666-43.69066667h92.84266667v-98.304c0-21.84533333 16.384-43.69066667 43.69066667-43.69066667s43.69066667 16.384 43.69066666 43.69066667v141.99466667c-5.46133333 21.84533333-21.84533333 43.69066667-43.69066666 43.69066666z"p-id="2358"fill="#ffffff"></path></svg></div><div class="_unfullpage"controls="unfull-page"style="display: none;"><svg t="1607605550628"class="icon"viewBox="0 0 1024 1024"version="1.1"xmlns="http://www.w3.org/2000/svg"p-id="2519"><path d="M948.90666667 851.69493333H75.09333333c-27.30666667 0-49.152-21.84533333-49.152-43.69066666v-655.36c0-27.30666667 21.84533333-49.152 49.152-49.152h873.81333334c27.30666667 0 43.69066667 21.84533333 43.69066666 49.152v655.36c0 27.30666667-16.384 43.69066667-43.69066666 43.69066666z m-824.66133334-87.38133333h780.97066667V196.33493333H124.24533333v567.97866667z"p-id="2520"fill="#ffffff"></path><path d="M375.46666667 496.70826667H238.93333333c-21.84533333 0-43.69066667-16.384-43.69066666-43.69066667s21.84533333-38.22933333 43.69066666-38.22933333h92.84266667v-98.304c0-21.84533333 16.384-43.69066667 43.69066667-43.69066667s38.22933333 21.84533333 38.22933333 43.69066667v136.53333333c0 21.84533333-16.384 43.69066667-38.22933333 43.69066667zM648.53333333 687.85493333c-21.84533333 0-43.69066667-16.384-43.69066666-43.69066666v-136.53333334c0-21.84533333 16.384-43.69066667 43.69066666-43.69066666H785.06666667c21.84533333 0 43.69066667 16.384 43.69066666 43.69066666s-16.384 43.69066667-43.69066666 43.69066667h-92.84266667v92.84266667c-5.46133333 21.84533333-21.84533333 43.69066667-43.69066667 43.69066666z"p-id="2521"fill="#ffffff"></path></svg></div>',t.insertBefore(l,t.childNodes[t.childNodes.length-1]),l.addEventListener("click",(new y.toggles).pageFull),f.$method.removeNode(e,"#back-button #back-icon-svg");l=document.createElement("button");f.$method.setElementStyle(l,{fontSize:"18px",color:"#FFFFFF",width:"auto"}),l.setAttribute("class","player-btn header-control"),l.setAttribute("id","current-time"),l.setAttribute("control",""),l.innerHTML='<div id="" style="display: none;"></div>',e.querySelector("#buttom-group").appendChild(l);e.appendChild(f.$method.createRangeIsDocFragment('<div style="display: none;"class="mp-bezel-text-hide"><div class="mp-bezel"><div class="mp-bezel-icon"></div></div></div>'));l=document.createElement("div");l.setAttribute("class","ctxmenu-wrapper"),l.setAttribute("id","ctxmenu-wrapper"),l.addEventListener("click",function(e){e.stopPropagation()}),e.appendChild(l);var i=document.createElement("div");i.setAttribute("class","mplayer-shortcut"),i.setAttribute("id","mplayer-shortcut");l=f.$method.getLangObject().shortcutsPanel;return i.innerHTML='<p class="title">'+l.title+'</p><div class="close-shortcut-panel">×</div><ul><li><label>'+l.space+"</label><span>"+l.spaceAction+"</span></li><li><label>Esc</label><span>"+l.esc+"</span></li></ul><ul><li><label>↑:</label><span>"+l.up+"</span></li><li><label>↓:</label><span>"+l.down+"</span></li></ul><ul><li><label>→:</label><span>"+l.right+"</span></li><li><label>←:</label><span>"+l.left+"</span></li></ul>",i.addEventListener("click",function(e){e.stopPropagation()}),i.addEventListener("dblclick",function(e){e.stopPropagation()}),i.addEventListener("mouseup",function(e){e.stopPropagation()}),i.querySelector(".close-shortcut-panel").addEventListener("click",function(){i.style.display="none"}),e.appendChild(i),e},initConfigControls:function(e){1!=f.option.live&&((i=document.createElement("button")).setAttribute("class","player-btn footer-control keyboard-input"),i.setAttribute("style","color: white;display: flex;align-items: center;width: auto;"),i.innerHTML='<div class="progress-begin" id="progress-begin"style="width: initial;margin-right: 5px;font-size: inherit;">'+f.$method.getLangObject().begin+'</div><div class="time-symbol">/</div><div class="progress-long" id="progress-long" style="color: #dddddd;width: initial;margin-left: 5px;font-size: inherit;">'+f.$method.getLangObject().end+"</div>",f.$method.setElementStyle(i,{color:"#FFFFFF",display:"flex",width:"auto"}),f.$method.removeNode(e,"#progress-begin"),f.$method.removeNode(e,"#progress-long"),e.querySelector("#left-part").appendChild(i)),e.querySelector("#progress-ball")&&e.querySelector("#progress-ball").classList.add("default-scale"),e.querySelector(".progress-ball")&&(e.querySelector(".progress-ball").style.height="15px"),e.querySelector(".progress-ball")&&(e.querySelector(".progress-ball").style.width="15px"),e.querySelector("#progress-container")&&e.querySelector("#progress-container").setAttribute("style","left: 12px;right: 12px;"),e.querySelector("#touch-effective")&&(e.querySelector("#touch-effective").style.margin="0");for(var t=e.querySelectorAll("#progress-total,#progress-buffered,#progress-play"),o=0;o<t.length;o++)t[o]&&t[o].classList.add("progress-default-scale");var n=s.getStorageVolume(),l=n.expiration,i=n.muted,n=n.volume;return"number"==typeof l&&l>(new Date).getTime()?("boolean"==typeof i&&(e.querySelector("video").muted=i),"number"==typeof n&&(e.querySelector("video").volume=0<n&&n<100?Number.parseInt(n)/100:1)):(n=f.option.volume,s.setStorageVolume(0<=n&&n<=1?100*n:100)),!0===f.option.muted&&(e.querySelector("video").muted=!0,s.setStorageVolume(null,!0)),e=y.buildBasePanel(e)},onFullscreenChange:function(e){f._this._global_.isReady&&(e.fullscreen?((new y.toggles).pageFull("change"),(new y.toggles).timeControls(!0),(new y.toggles).scaleControls(!0)):((new y.toggles).scaleControls(!1),(new y.toggles).timeControls(!1),(new y.popupInstance).togglePopupVisible("OFF")))},onControlsToggle:function(e){e.show||(new y.popupInstance).togglePopupVisible("OFF"),f.$data.isFullScreen&&(new y.toggles).timeControls(e.show)},onReady:function(){var e;"function"==typeof f.$el&&(e=new f.$el,f.$el=e),!0===f.option.initFullFixed&&(new y.toggles).pageFull("initFullFixed"),y.addFocusKeyboardHandle(),y.addControlTooltip(),y.toggleEventListenerGlobal("add","playerReady")},onDestory:function(){y.toggleEventListenerGlobal("remove","playerDestory")},onError:function(){y.toggleEventListenerGlobal("remove","playerError")},onAction:function(e){e="add"==e?"on":"off";f._this[e]("fullscreen-change",y.onFullscreenChange),f._this[e]("controls-toggle",y.onControlsToggle),f._this[e]("ready",y.onReady),f._this[e]("destory",y.onDestory),f._this[e]("error",y.onError)},vaks:function(){return!0},toggleEventListenerGlobal:function(e,t){var o="add"==e?"addEventListener":"removeEventListener";f._this._global_.webpagePlugin.eventStatus=o;f.$el.touchEffective instanceof Element&&f.$el.touchEffective[o]("mouseover",y.onEffectiveOverEvent),f.$el.mPlayer[o]("mousemove",y.onMpMousemoveEvent),!0===m.leaveHiddenControls&&f.$el.mPlayer[o]("mouseleave",y.onMpMouseleaveEvent),f.$el.mPlayer[o]("keydown",n.onDocKeydown),f.$el.mPlayer[o]("mouseup",c.createCtxmenu),f.$el.mPlayer[o]("contextmenu",c.onContextmenuEvent),"playerDestory"==t&&y.onAction("remove")}};this.interface=function(t){this._onAgentMpTap=function(e){if("click"==e){if(!y.vaks())return void f.$method.toggleControlsDisplay(t);if(f.$el.mPlayer.querySelector(".mplayer-sidebar.open"))return void f.$method.toggleControlsDisplay(t);f.$method.onPlayTap({type:"dblscreen"}),y.showHandleIcon("mouseclick"),"removeEventListener"==f._this._global_.webpagePlugin.eventStatus&&this._addEvent()}"dbclick"==e&&(y.vaks()?f.$method.fullToggle(t):f.$method.onPlayTap({type:"dblscreen"}))},this._removeEvent=function(){y.vaks()&&y.toggleEventListenerGlobal("remove","activeRemove")},this._addEvent=function(){y.vaks()&&y.toggleEventListenerGlobal("add")}},this.appendTemplate=function(e,t){return f={},f=t,console.info("loading mui player desktop plugin..."),y.vaks()?(y.onAction("add"),e=y.initConfigControls(e)):f._this.on("ready",function(){h.rst({message:f.$method.dc("01T00W03702T03602X03303903700W03302R02R03903603602T02S00W02T03603603303600X"),duration:5e3,style:{backgroundColor:"rgba(237,64,20,.8)"}})}),e},this.name="MuiPlayerDesktopPlugin"}});