iking-web-ui-pro 0.2.50 → 0.2.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -223,4 +223,4 @@ Use Save As... to download, then click back to return to this page.`)&&(location
223
223
  <xg-mini-progress-cache class="xg-mini-progress-cache" style="`).concat(f.cached,`"></xg-mini-progress-cache>
224
224
  <xg-mini-progress-played class="xg-mini-progress-played" style="`).concat(f.played,`"></xg-mini-progress-played>
225
225
  </xg-mini-progress>`)}}}],[{key:"pluginName",get:function(){return"MiniProgress"}},{key:"defaultConfig",get:function(){return{mode:"auto",height:2}}}]),r}(V),je={REAL_TIME:"realtime",FIRST_FRAME:"firstframe",FRAME_RATE:"framerate",POSTER:"poster"};function oa(){try{return parseInt(window.performance.now(),10)}catch{return new Date().getTime()}}function sa(){try{var a=document.createElement("canvas").getContext;return!!a}catch{return!1}}var vt=null,aa=function(a){P(r,a);var s=L(r);function r(){var t;S(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=s.call.apply(s,[this].concat(i)),k(y(t),"onLoadedData",function(o){t.player&&(t._frameCount=t.config.startFrameCount,t.stop(),t.renderOnTimeupdate(o),t.off(ee,t.renderOnTimeupdate),t.on(ee,t.renderOnTimeupdate))}),k(y(t),"onVisibilitychange",function(o){document.visibilityState==="visible"?t._checkIfCanStart()&&t.start():document.visibilityState==="hidden"&&t.stop()}),k(y(t),"renderOnTimeupdate",function(o){if(t._frameCount>0)t.renderOnce(),t._frameCount--;else{t._isLoaded=!0,t.off(ee,t.renderOnTimeupdate);var l=t.config.startInterval;!t.player.paused&&t._checkIfCanStart()&&t.start(0,l)}}),k(y(t),"start",function(o,l){var u=t.player.video,f=oa(),d=t.checkVideoIsSupport(u);!d||!t.canvasCtx||(l||(l=t.interval),t.stop(),u.videoWidth&&u.videoHeight&&(t.videoPI=u.videoHeight>0?parseInt(u.videoWidth/u.videoHeight*100,10):0,(t.config.mode===je.REAL_TIME||f-t.preTime>=l)&&(u&&u.videoWidth&&t.update(d,t.videoPI),t.preTime=f)),t.frameId=t._loopType==="timer"?h.setTimeout(y(t),t.start,l):h.requestAnimationFrame(t.start))}),k(y(t),"stop",function(){t.frameId&&(t._loopType==="timer"?h.clearTimeout(y(t),t.frameId):h.cancelAnimationFrame(t.frameId),t.frameId=null)}),t}return x(r,[{key:"afterCreate",value:function(){var e=this;this.playerConfig.dynamicBg===!0&&(this.config.disable=!1),r.isSupport||(this.config.disable=!0);var i=this.config,n=i.disable,o=i.mode,l=i.frameRate;n||(this._pos={width:0,height:0,rwidth:0,rheight:0,x:0,y:0,pi:0},this.isStart=!1,this._isLoaded=!1,this.videoPI=0,this.preTime=0,this.interval=parseInt(1e3/l,10),this.canvas=null,this.canvasCtx=null,this._frameCount=0,this._loopType=this.config.mode!==je.REAL_TIME&&this.interval>=1e3?"timer":"animation",this.once(tt,function(){e.player&&(e.init(),e.renderByPoster(),e.player.paused||e.start())}),o!==je.POSTER&&(o!==je.FIRST_FRAME&&(this.on(Le,function(){e.stop()}),this.on(Q,function(){var u=e.config.startInterval;e._checkIfCanStart()&&e.start(0,u)}),this.on(Me,function(){e.stop()})),this.on(pe,this.onLoadedData),this.on(Pt,function(){e._isLoaded=!1,e.stop()}),document.addEventListener("visibilitychange",this.onVisibilitychange)))}},{key:"setConfig",value:function(e){var i=this;Object.keys(e).forEach(function(n){n==="root"&&e[n]!==i.config[n]?i.reRender(e[n]):n==="frameRate"?i.interval=parseInt(1e3/e[n],10):n==="disable"&&e[n]&&i.stop(),i.config[n]=e[n]})}},{key:"init",value:function(e){var i=this.player,n=this.config;this.canvasFilter=r.supportCanvasFilter();try{var o=e||n.root;o||(o=n.isInnerRender&&i.innerContainer||i.root),o.insertAdjacentHTML("afterbegin",'<div class="xgplayer-dynamic-bg" data-index="'.concat(n.index,`"><canvas>
226
- </canvas><xgmask></xgmask></div>`)),this.root=o.children[0],this.canvas=this.find("canvas"),this.canvasFilter||(this.canvas.style.filter=n.filter,this.canvas.style.webkitFilter=n.filter),this.mask=this.find("xgmask"),n.addMask&&(this.mask.style.background=n.maskBg),this.canvasCtx=this.canvas.getContext("2d")}catch(l){F.logError("plugin:DynamicBg",l)}}},{key:"reRender",value:function(e){var i=this.config.disable;if(!(!i&&!this.root)){this.stop();var n=this.root?this.root.parentElement:null;if(n!==e&&n.removeChild(this.root),!e){this.root=null;return}this.init(e),this.renderOnce();var o=this.config.startInterval;this._checkIfCanStart()&&this.start(0,o)}}},{key:"checkVideoIsSupport",value:function(e){if(!e)return null;var i=e&&e instanceof window.HTMLVideoElement?e:e.canvas?e.canvas:e.flyVideo?e.flyVideo:null;if(i&&!(R.browser==="safari"&&h.isMSE(i)))return i;var n=i?i.tagName.toLowerCase():"";return n==="canvas"||n==="img"?i:null}},{key:"renderByPoster",value:function(){var e=this.playerConfig.poster;if(e){var i=h.typeOf(e)==="String"?e:h.typeOf(e.poster)==="String"?e.poster:null;this.updateImg(i)}}},{key:"_checkIfCanStart",value:function(){var e=this.config.mode;return this._isLoaded&&!this.player.paused&&e!==je.FIRST_FRAME&&e!==je.POSTER}},{key:"renderOnce",value:function(){var e=this.player.video;if(!(!e.videoWidth||!e.videoHeight)){this.videoPI=parseInt(e.videoWidth/e.videoHeight*100,10);var i=this.checkVideoIsSupport(e);i&&this.update(i,this.videoPI)}}},{key:"updateImg",value:function(e){var i=this;if(e){var n=this.canvas.getBoundingClientRect(),o=n.width,l=n.height,u=new window.Image;u.onload=function(){if(!(!i.canvas||i.frameId||i.isStart)){i.canvas.height=l,i.canvas.width=o;var f=parseInt(o/l*100,10);i.update(u,f),u=null}},u.src=e}}},{key:"update",value:function(e,i){if(!(!this.canvas||!this.canvasCtx||!i))try{var n=this._pos,o=this.config,l=this.canvas.getBoundingClientRect(),u=l.width,f=l.height;if(u!==n.width||f!==n.height||n.pi!==i){var d=parseInt(u/f*100,10);n.pi=i,n.width!==u&&(n.width=this.canvas.width=u),n.height!==f&&(n.height=this.canvas.height=f);var g=f,p=u;d<i?p=parseInt(f*i/100,10):d>i&&(g=parseInt(u*100/i,10)),n.rwidth=p*o.multiple,n.rheight=g*o.multiple,n.x=(u-n.rwidth)/2,n.y=(f-n.rheight)/2}this.canvasFilter&&(this.canvasCtx.filter=o.filter),this.canvasCtx.drawImage(e,n.x,n.y,n.rwidth,n.rheight)}catch(v){F.logError("plugin:DynamicBg",v)}}},{key:"destroy",value:function(){this.stop(),document.removeEventListener("visibilitychange",this.onVisibilitychange),this.canvasCtx=null,this.canvas=null}},{key:"render",value:function(){return""}}],[{key:"pluginName",get:function(){return"dynamicBg"}},{key:"defaultConfig",get:function(){return{isInnerRender:!1,disable:!0,index:-1,mode:"framerate",frameRate:10,filter:"blur(50px)",startFrameCount:2,startInterval:0,addMask:!0,multiple:1.2,maskBg:"rgba(0,0,0,0.7)"}}},{key:"isSupport",get:function(){return typeof vt=="boolean"||(vt=sa()),vt}},{key:"supportCanvasFilter",value:function(){return!(R.browser==="safari"||R.browser==="firefox")}}]),r}(V),la={LANG:"zh-cn",TEXT:{ERROR_TYPES:{network:{code:1,msg:"视频下载错误"},mse:{code:2,msg:"流追加错误"},parse:{code:3,msg:"解析错误"},format:{code:4,msg:"格式错误"},decoder:{code:5,msg:"解码错误"},runtime:{code:6,msg:"语法错误"},timeout:{code:7,msg:"播放超时"},other:{code:8,msg:"其他错误"}},HAVE_NOTHING:"没有关于音频/视频是否就绪的信息",HAVE_METADATA:"音频/视频的元数据已就绪",HAVE_CURRENT_DATA:"关于当前播放位置的数据是可用的,但没有足够的数据来播放下一帧/毫秒",HAVE_FUTURE_DATA:"当前及至少下一帧的数据是可用的",HAVE_ENOUGH_DATA:"可用数据足以开始播放",NETWORK_EMPTY:"音频/视频尚未初始化",NETWORK_IDLE:"音频/视频是活动的且已选取资源,但并未使用网络",NETWORK_LOADING:"浏览器正在下载数据",NETWORK_NO_SOURCE:"未找到音频/视频来源",MEDIA_ERR_ABORTED:"取回过程被用户中止",MEDIA_ERR_NETWORK:"网络错误",MEDIA_ERR_DECODE:"解码错误",MEDIA_ERR_SRC_NOT_SUPPORTED:"不支持的音频/视频格式",REPLAY:"重播",ERROR:"网络连接似乎出现了问题",PLAY_TIPS:"播放",PAUSE_TIPS:"暂停",PLAYNEXT_TIPS:"下一集",DOWNLOAD_TIPS:"下载",ROTATE_TIPS:"旋转",RELOAD_TIPS:"重新载入",FULLSCREEN_TIPS:"进入全屏",EXITFULLSCREEN_TIPS:"退出全屏",CSSFULLSCREEN_TIPS:"进入样式全屏",EXITCSSFULLSCREEN_TIPS:"退出样式全屏",TEXTTRACK:"字幕",PIP:"画中画",SCREENSHOT:"截图",LIVE:"正在直播",OFF:"关闭",OPEN:"开启",MINI_DRAG:"点击按住可拖动视频",MINISCREEN:"小屏幕",REFRESH_TIPS:"请试试",REFRESH:"刷新",FORWARD:"快进中",LIVE_TIP:"直播"}},qe="info",Qt=zi,ua=function(a){P(r,a);var s=L(r);function r(){var t;S(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=s.call.apply(s,[this].concat(i)),k(y(t),"_recordUserActions",function(o){var l=t._getTime(),u=Object.assign({},o,{msg:o.msg||o.action});t._stats[qe].push(j(j({type:"userAction"},l),{},{payload:u}))}),k(y(t),"_onReset",function(){t.reset()}),k(y(t),"_recordInfo",function(o){t.info(o)}),k(y(t),"_downloadStats",function(){var o=t.getStats(),l=new Blob([JSON.stringify(o)],{type:"application/json"}),u=window.URL.createObjectURL(l),f=document.createElement("a");f.style.display="none",f.href=u,f.download="player.txt",f.disabled=!1,f.click()}),t}return x(r,[{key:"_getTime",value:function(){return{timestamp:Date.now(),timeFormat:new Date().toISOString()}}},{key:"afterCreate",value:function(){this.reset(),this.on(at,this._recordUserActions),this.on(Qt.STATS_INFO,this._recordInfo),this.on(Qt.STATS_DOWNLOAD,this._downloadStats),this.on(Qt.STATS_RESET,this._onReset)}},{key:"destroy",value:function(){this.offAll()}},{key:"downloadStats",value:function(){this._downloadStats()}},{key:"info",value:function(e){e.profile?this._infoProfile(e):this._info(e)}},{key:"_info",value:function(e){var i=this._getTime();this._stats[qe].push(j(j({},i),{},{payload:e}))}},{key:"_infoProfile",value:function(e){if(e&&e.startMs){var i=Date.now(),n=i-e.startMs,o=j({cat:"function",dur:n,name:e.name||e.msg,ph:"X",pid:0,tid:0,ts:e.startMs,profile:!0},e);this._info(o)}else console.warn("infoProfile need object data, include startMs")}},{key:"reset",value:function(){var e;this._stats=(e={},k(e,qe,[]),k(e,"media",{}),e)}},{key:"getStats",value:function(){for(var e=this.player,i=e.media,n=[],o=0;o<i.buffered.length;o++)n.push({start:i.buffered.start(o),end:i.buffered.end(o)});var l={currentTime:i.currentTime,readyState:i.readyState,buffered:n,paused:i.paused,ended:i.ended};return this._stats.media=l,{raw:this._stats,timestat:this._getTimeStats(),profile:this._getProfile()}}},{key:"_getTimeStats",value:function(){var e=this._stats[qe],i=e.map(function(n){var o=n.payload.data,l="";try{o instanceof Error?l=o.msg:o!==void 0&&(l=JSON.stringify(o))}catch(u){console.log("err",u)}return"[".concat(n.timeFormat,"] : ").concat(n.payload.msg," ").concat(l," ")});return i}},{key:"_getProfile",value:function(){var e={traceEvents:[]},i=this._stats[qe];return i.forEach(function(n){n.payload.profile&&e.traceEvents.push(n.payload)}),e}}],[{key:"pluginName",get:function(){return"stats"}},{key:"defaultConfig",get:function(){return{}}}]),r}(we),Cn=function(a){P(r,a);var s=L(r);function r(){var t;S(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=s.call.apply(s,[this].concat(i)),k(y(t),"onGapJump",function(){var o=y(t),l=o.player,u=o.config;if(l.media.readyState!==HTMLMediaElement.HAVE_NOTHING){if(l.media.seeking){if(!t.seekingEventReceived)return}else t.seekingEventReceived=!1;if(!(l.media.paused&&l.media.currentTime!==0&&t.hasPlayed)){var f=l.media.buffered,d=u.smallGapLimit||.5,g=u.gapDetectionThreshold||.3,p=l.media.currentTime,v=t._getIndex(f,p,g);if(!(v===null||v===0)){console.log("GapJump bufferRange ",f.start(v),f.end(v));var m=f.start(v)+.1,_=l.media.duration;if(!(m>_)){var C=m-p,E=C<=d;C<r.BROWSER_GAP_TOLERANCE||E&&(u.useGapJump!==!1&&(l.media.currentTime=t.isSafari?m+.1:m),t.player&&t.player.emit("detectGap"),console.log("gapJump gapIndex",v," isGapSamll:",E," currentTime:",l.media.currentTime," jumpSize:",p-l.media.currentTime),m!==.08&&l&&l.emit("log",{type:"oneevent",end_type:"gap",vid:l.config.vid,ext:{video_postion:Math.floor(m*1e3)}}))}}}}}),t}return x(r,[{key:"afterCreate",value:function(){var e=this,i=this.config.useGapJump;i!==!1&&(this.hasPlayed=!1,this.seekingEventReceived=!1,this.isSafari=/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),this.on(Ke,this.onGapJump),this.on(Q,function(){e.hasPlayed=!0}),this.on(et,function(){e.seekingEventReceived=!0}))}},{key:"_getIndex",value:function(e,i,n){if(!e||!e.length||e.length===1&&e.end(0)-e.start(0)<1e-6)return null;for(var o=this._getBuffered(e),l=null,u=0;u<o.length;u++){var f=o[u];if(f.start>i&&(u===0||o[u-1].end-i<=n)){l=u;break}}return l}},{key:"_getBuffered",value:function(e){if(!e)return[];for(var i=[],n=0;n<e.length;n++)i.push({start:e.start(n),end:e.end(n)});return i}}],[{key:"pluginName",get:function(){return"gapJump"}},{key:"defaultConfig",get:function(){return{useGapJump:!1,smallGapLimit:.5,gapDetectionThreshold:.3}}}]),r}(V);Cn.BROWSER_GAP_TOLERANCE=.001;var ca=function(a){P(r,a);var s=L(r);function r(){var t;S(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=s.call.apply(s,[this].concat(i)),k(y(t),"onWaiting",function(){var o=y(t),l=o.config;t.jumpCnt>l.jumpCntMax||t.timer||l.useWaitingTimeoutJump===!1||(t.timer=setTimeout(t.onJump,l.waitingTime*1e3))}),k(y(t),"onJump",function(){var o=y(t),l=o.player,u=o.config;if(clearTimeout(t.timer),t.timer=null,!(t.jumpCnt>u.jumpCntMax||u.useWaitingTimeoutJump===!1)&&!(l.media.paused&&l.media.currentTime!==0&&t.hasPlayed)){t.jumpSize=u.jumpSize*(t.jumpCnt+1),t.jumpCnt===u.jumpSize&&t.jumpSize<6&&(t.jumpSize=6);var f=l.currentTime+t.jumpSize,d=l.media.duration;f>d||(t.jumpCnt++,l.currentTime=f)}}),t}return x(r,[{key:"afterCreate",value:function(){var e=this,i=this.config,n=i.useWaitingTimeoutJump,o=i.jumpSize;n!==!1&&(this.hasPlayed=!1,this.jumpCnt=0,this.timer=null,this.jumpSize=o,this.on(Ke,this.onWaiting),this.on([It,ge],function(){clearTimeout(e.timer),e.timer=null,e.jumpSize=e.config.jumpSize}),this.on(Q,function(){e.hasPlayed=!0}))}}],[{key:"pluginName",get:function(){return"waitingTimeoutJump"}},{key:"defaultConfig",get:function(){return{useWaitingTimeoutJump:!1,waitingTime:15,jumpSize:2,jumpCntMax:4}}}]),r}(V),We="cdn",mt=["cdn"],fa=function(a){P(r,a);var s=L(r);function r(){var t;S(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=s.call.apply(s,[this].concat(i)),k(y(t),"getSpeed",function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:We;if(!t.speedListCache||!t.speedListCache[o]||t.speedListCache[o].length<=0)return 0;var l=0;return t.speedListCache[o].map(function(u){l+=u}),Math.floor(l/t.speedListCache[o].length)}),k(y(t),"startTimer",function(){h.isMSE(t.player.video)||(t.initSpeedList(),t.cnt=0,t.timer=setTimeout(t.testSpeed,t.config.testTimeStep))}),k(y(t),"initSpeedList",function(){t.speedListCache={},mt.forEach(function(o){t.speedListCache[o]=[]})}),k(y(t),"_onRealSpeedChange",function(o){o.speed&&t.appendList(o.speed,o.type||We)}),k(y(t),"testSpeed",function(){if(clearTimeout(t.timer),t.timer=null,!(!t.player||!t.config.openSpeed)){var o=t.config,l=o.url,u=o.loadSize,f=o.testCnt,d=o.testTimeStep,g=l+(l.indexOf("?")<0?"?testst=":"&testst=")+Date.now();if(!(t.cnt>=f)){t.cnt++;try{var p=new Date().getTime(),v=null,m=new XMLHttpRequest;t.xhr=m,m.open("GET",g);var _={},C=Math.floor(Math.random()*10);_.Range="bytes="+C+"-"+(u+C),_&&Object.keys(_).forEach(function(E){m.setRequestHeader(E,_[E])}),m.onreadystatechange=function(){if(m.readyState===4){t.xhr=null,v=new Date().getTime();var E=m.getResponseHeader("Content-Length")/1024*8,b=Math.round(E*1e3/(v-p));t.appendList(b),t.timer=setTimeout(t.testSpeed,d)}},m.send()}catch(E){console.error(E)}}}}),k(y(t),"appendList",function(o){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:We;if(!(!t.speedListCache||!t.speedListCache[l])){var u=t.config.saveSpeedMax;t.speedListCache[l].length>=u&&t.speedListCache[l].shift(),t.speedListCache[l].push(o);var f=y(t),d=f.player;d&&(l===We?d.realTimeSpeed=o:d[t.getSpeedName("realTime",l)]=o),t.updateSpeed(l)}}),k(y(t),"updateSpeed",function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:We,l=t.getSpeed(o),u=y(t),f=u.player;if(f)if(o===We)(!f.avgSpeed||l!==f.avgSpeed)&&(f.avgSpeed=l,f.emit(Rt,{speed:l,realTimeSpeed:f.realTimeSpeed}));else{var d=t.getSpeedName("avg",o);(!f[d]||l!==f[d])&&(f[d]=l,f.emit(Rt,{speed:l,realTimeSpeed:f.realTimeSpeed}))}}),t}return x(r,[{key:"afterCreate",value:function(){var e=this.config,i=e.openSpeed,n=e.addSpeedTypeList;(n==null?void 0:n.length)>0&&mt.push.apply(mt,re(n)),this.initSpeedList(),this.on("real_time_speed",this._onRealSpeedChange),this.timer=null,this.cnt=0,this.xhr=null,i&&this.on([pe,it],this.startTimer)}},{key:"getSpeedName",value:function(e,i){return e+"Speed"+i.toUpperCase()}},{key:"openSpeed",get:function(){return this.config.openSpeed},set:function(e){if(this.config.openSpeed=e,!e&&this.timer){clearTimeout(this.timer),this.timer=null;return}if(this.config.openSpeed){if(this.timer)return;this.timer=setTimeout(this.testSpeed,this.config.testTimeStep)}}},{key:"destroy",value:function(){var e=this;this.off("real_time_speed",this._onRealSpeedChange),this.off([pe,it],this.startTimer),mt.forEach(function(i){e.speedListCache&&e.speedListCache[i]&&(e.speedListCache[i]=[])}),this.speedListCache&&(this.speedListCache={}),clearTimeout(this.timer),this.timer=null,this.xhr&&this.xhr.readyState!==4&&(this.xhr.cancel&&this.xhr.cancel(),this.xhr=null)}}],[{key:"pluginName",get:function(){return"testspeed"}},{key:"defaultConfig",get:function(){return{openSpeed:!1,testCnt:3,loadSize:200*1024,testTimeStep:3e3,url:"",saveSpeedMax:5,addSpeedTypeList:[]}}}]),r}(V),ha=function(a){P(r,a);var s=L(r);function r(){return S(this,r),s.apply(this,arguments)}return x(r,[{key:"afterCreate",value:function(){var e=this,i=this.player,n=this.config,o=i.media||i.video;if(this.timer=null,this._lastDecodedFrames=0,this._currentStuckCount=0,this._lastCheckPoint=null,this._payload=[],!n.disabled){var l=o.getVideoPlaybackQuality;l&&(this.on(Q,function(){e._startTick()}),this.on(Me,function(){e._stopTick()}),this.on(Pe,function(){e._stopTick()}),this.on(Le,function(){e._stopTick()}))}}},{key:"_startTick",value:function(){var e=this;this._stopTick(),this._timer=setTimeout(function(){e._checkDecodeFPS(),e._startTick()},this.config.tick)}},{key:"_stopTick",value:function(){clearTimeout(this._timer),this._timer=null}},{key:"_checkBuffer",value:function(e,i){for(var n=!1,o=[],l=0;l<i.length;l++){var u=i.start(l),f=i.end(l);if(o.push({start:u,end:f}),u<=e&&e<=f-1){n=!0;break}}return{enoughBuffer:n,buffers:o}}},{key:"_checkStuck",value:function(e,i,n,o){var l=this.player.media||this.player.video,u=document.hidden,f=l.paused,d=l.readyState,g=l.currentTime,p=l.buffered;if(!(u||f||d<4)){var v=this._checkBuffer(g,p),m=v.enoughBuffer,_=v.buffers;m&&(e<=this.config.reportFrame?(this._currentStuckCount++,this._payload.push({currentTime:g,buffers:_,curDecodedFrames:e,totalVideoFrames:i,droppedVideoFrames:n,checkInterval:o}),this._currentStuckCount>=this.config.stuckCount&&(this.emit(Ui,this._payload),this._reset())):this._reset())}}},{key:"_reset",value:function(){this._payload=[],this._currentStuckCount=0}},{key:"_checkDecodeFPS",value:function(){var e=this.player.media||this.player.video;if(e){var i=e.getVideoPlaybackQuality(),n=i.totalVideoFrames,o=i.droppedVideoFrames,l=performance.now();if(n&&this._lastCheckPoint){var u=n-this._lastDecodedFrames,f=l-this._lastCheckPoint;this._checkStuck(u,n,o,f)}this._lastDecodedFrames=n,this._lastCheckPoint=l}}},{key:"destroy",value:function(){this._stopTick()}}],[{key:"pluginName",get:function(){return"FpsDetect"}},{key:"defaultConfig",get:function(){return{disabled:!1,tick:1e3,stuckCount:3,reportFrame:0}}}]),r}(V);Be.use(la);var da=x(function a(s,r){var t,e,i;S(this,a);var n=r&&r.isMobileSimulateMode==="mobile",o=r.isLive,l=o?[]:[Ls,ws,ra,ia,Ps],u=[].concat(l,[bs,Is,Ms,zs,Xs,qs,Gs,$s,Rs,Hs]),f=[is,ns,os,_s,ss,Qs,ea,na,cs];this.plugins=[ua,es].concat(re(u),f,[Cn,ca]);var d=n?"mobile":R.device;switch(d){case"pc":(t=this.plugins).push.apply(t,[gn,qt,mn,fa,ha]);break;case"mobile":(e=this.plugins).push.apply(e,[vs]);break;default:(i=this.plugins).push.apply(i,[gn,qt,mn])}(R.os.isIpad||d==="pc")&&this.plugins.push(aa),R.os.isIpad&&this.plugins.push(qt),this.ignores=[],this.i18n=[]}),oe=function(a){P(r,a);var s=L(r);function r(){return S(this,r),s.apply(this,arguments)}return x(r)}(dt);k(oe,"defaultPreset",da),k(oe,"Util",h),k(oe,"Sniffer",R),k(oe,"Errors",Qe),k(oe,"Events",Io),k(oe,"Plugin",V),k(oe,"BasePlugin",we),k(oe,"I18N",Be),k(oe,"STATE_CLASS",w),k(oe,"InstManager",nn);const gl="",ga=["id"],pa=c.defineComponent({name:"ElImageViewer",__name:"Player",props:c.mergeModels({url:{type:String,default:""},zIndex:{type:Number,default:200},config:{type:Object,default:()=>({})}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:c.mergeModels({close:()=>!0},["update:modelValue"]),setup(a,{emit:s}){let r=null;const t=a,{cLoadUrl:e}=si(t),i=c.computed(()=>Ge(e.value,t.url)),n={width:"100%",height:"100%",autoplay:!1,volume:.6,controls:!0,playbackRate:[.5,.75,1,1.5,2],crossOrigin:!0,preload:"auto",muted:!1,loop:!0,poster:"",lang:"zh-CN",screenShot:!0},o=c.computed(()=>({...n,...t.config})),l=s,u=c.useModel(a,"modelValue"),f=le.buildUUID(),d=$.useNamespace("image-viewer");function g(){l("close"),u.value=!1,r.destroy()}return c.watch(()=>u.value,p=>{p&&c.nextTick(()=>{r=new oe({id:f,url:i.value,...o.value})})}),(p,v)=>{const m=c.resolveComponent("el-icon");return u.value?(c.openBlock(),c.createBlock(c.Teleport,{key:0,to:"body"},[c.createVNode(c.Transition,{name:"viewer-fade",appear:""},{default:c.withCtx(()=>[c.createElementVNode("div",{ref:"wrapper",tabindex:-1,class:c.normalizeClass(c.unref(d).e("wrapper")),style:c.normalizeStyle({zIndex:a.zIndex})},[c.createElementVNode("div",{class:c.normalizeClass(c.unref(d).e("mask"))},null,2),c.createCommentVNode(" CANVAS "),c.createElementVNode("div",{class:c.normalizeClass(c.unref(d).e("canvas"))},[c.createElementVNode("div",{id:c.unref(f)},null,8,ga),c.createCommentVNode(" CLOSE "),c.createElementVNode("span",{class:c.normalizeClass([c.unref(d).e("btn"),c.unref(d).e("close")]),onClick:g},[c.createVNode(m,{onClick:g},{default:c.withCtx(()=>[c.createVNode(c.unref(ri))]),_:1})],2)],2),c.renderSlot(p.$slots,"default",{},void 0,!0)],6)]),_:3})])):c.createCommentVNode("v-if",!0)}}}),pl="",va=_e(_t(pa,[["__scopeId","data-v-b301aa7d"]])),ma=["onClick"],ya={class:"fileName simple"},_a=["onClick"],ka={class:"file-list"},Ca={class:"fileName simple"},wa=["onClick"],ba={class:"text"},Ea={class:"fileName"},Ta={class:"size"},Sa=c.defineComponent({__name:"IkPreviewFile",props:{list:{type:Array,default:()=>[]},url:{required:!0,type:String,default:""},loadUrl:{type:String,default:""},field:{required:!0,type:Object,default:()=>({})},iconSize:{type:Number,default:40},showBg:{type:Boolean,default:!0},width:{type:Number||String,default:"100%"},iconHoverShow:{type:Boolean,default:!1},isOnlyOfficePreview:{type:Boolean,default:!0},onlyOfficeAccept:{type:String,default:".pdf,.docx,.doc.ppt,.pptx,.xlsx,.xls,"},onlyofficeServer:{type:String,default:""},onlyOfficeConfig:{type:Object,default:()=>({})},jwtToken:{type:String,default:""},simple:{type:Boolean,default:!1},showType:{type:String,default:"default"},showDownloadBtn:{type:Boolean,default:!0},showPreviewBtn:{type:Boolean,default:!0}},emits:["handPreview"],setup(a,{emit:s}){const r=a,t=c.computed(()=>r.simple?"simple":"default"),{cLoadUrl:e,cOnlyofficeConfig:i,cOnlyofficePreviewType:n}=si(r),o=s,l=c.computed(()=>({name:"name",url:"url",suffix:"suffix",size:"size",...r.field})),u=c.ref({}),f=c.ref(!1),d=m=>{var _,C;u.value={...m,name:m.name,url:Ge(e.value,m[l.value.url]||((C=(_=m==null?void 0:m.response)==null?void 0:_.data)==null?void 0:C.id)||(m==null?void 0:m.id))},r.isOnlyOfficePreview&&(f.value=!0),o("handPreview",u.value)},g=m=>{le.ikFile.downloadFile(Ge(e.value,m[l.value.url]||m.attachmentId||m.id),m[l.value.name]||m.attachmentName)},p=c.computed(()=>le.paramType.isNumber(r.width)?`${r.width}px`:r.width),v=c.computed(()=>r.list.map(m=>{var C;const _=m[l.value.name]||m.attachmentName;return{...m,name:_,size:m[l.value.size]||(m==null?void 0:m.fileSize)||(m==null?void 0:m.attachmentSize),suffix:m[l.value.suffix]||(m==null?void 0:m.attachmentSuffix)||((C=_.split("."))==null?void 0:C.at(-1))}}));return(m,_)=>{var E,b,M;const C=c.resolveComponent("tmplate");return c.openBlock(),c.createElementBlock(c.Fragment,null,[(E=a.list)!=null&&E.length?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[c.createCommentVNode(" 简单模式 "),a.simple||t.value==="simple"?(c.openBlock(!0),c.createElementBlock(c.Fragment,{key:0},c.renderList(v.value,(T,N)=>(c.openBlock(),c.createElementBlock("div",{class:"iking-privew-annex simple",key:N,onClick:I=>d(T),style:c.normalizeStyle({width:p.value})},[c.createElementVNode("div",ya,c.toDisplayString(T.name),1),c.createElementVNode("div",{class:c.normalizeClass(["flex flex-center",{"hover-show":a.iconHoverShow}])},[a.showDownloadBtn?(c.openBlock(),c.createBlock(c.unref(Ie),{key:0,name:"iksvg_daochu",onClick:c.withModifiers(I=>g(T),["stop"]),size:20,active:""},null,8,["onClick"])):c.createCommentVNode("v-if",!0),c.unref(n).includes(T.suffix)||a.showPreviewBtn?(c.openBlock(),c.createBlock(c.unref(Ie),{key:1,name:"iksvg_yulan",size:20,active:""})):c.createCommentVNode("v-if",!0),c.renderSlot(m.$slots,"operation",{data:{...T,findex:N}})],2)],12,ma))),128)):c.createCommentVNode("v-if",!0),c.createCommentVNode(" 简单图标模式 "),t.value==="simple-icon"?(c.openBlock(!0),c.createElementBlock(c.Fragment,{key:1},c.renderList(v.value,(T,N)=>(c.openBlock(),c.createElementBlock("div",{class:"iking-privew-annex simple-icon",key:N,onClick:I=>d(T),style:c.normalizeStyle({width:p.value})},[c.createElementVNode("div",ka,[c.createVNode(c.unref(ni),{file:T,style:c.normalizeStyle({height:`${a.iconSize}px`}),class:"ikui-w-auto",fields:l.value},null,8,["file","style","fields"]),c.createElementVNode("div",Ca,c.toDisplayString(T.name),1)]),a.showDownloadBtn?(c.openBlock(),c.createBlock(c.unref(Ie),{key:0,name:"iksvg_daochu",size:20,title:"下载",active:"",onClick:c.withModifiers(I=>g(T),["stop"])},null,8,["onClick"])):c.createCommentVNode("v-if",!0)],12,_a))),128)):c.createCommentVNode("v-if",!0),c.createCommentVNode(" 默认模式 "),t.value==="default"?(c.openBlock(),c.createBlock(C,{key:2},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(v.value,(T,N)=>{var I;return c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["iking-privew-annex",{"is-bg":a.showBg}]),key:N,style:c.normalizeStyle({marginBottom:N==((I=a.list)==null?void 0:I.length)-1?"0":"10px",width:p.value})},[c.createElementVNode("div",{class:"file-card",onClick:K=>d(T)},[c.createVNode(c.unref(ni),{file:T,style:c.normalizeStyle({height:`${a.iconSize}px`}),class:"ikui-w-auto",fields:l.value},null,8,["file","style","fields"]),c.createElementVNode("div",ba,[c.createElementVNode("div",Ea,c.toDisplayString(T.name),1),c.createElementVNode("div",Ta,c.toDisplayString(c.unref(yr)(T.size)),1)]),c.createElementVNode("div",{class:c.normalizeClass(["flex flex-center",{"hover-show":a.iconHoverShow}])},[a.showDownloadBtn?(c.openBlock(),c.createBlock(c.unref(Ie),{key:0,name:"iksvg_daochu",onClick:c.withModifiers(K=>g(T),["stop"]),bg:a.showBg,size:a.showBg?"default":20,title:"下载"},null,8,["onClick","bg","size"])):c.createCommentVNode("v-if",!0),c.unref(n).includes(T.suffix)||a.showPreviewBtn?(c.openBlock(),c.createBlock(c.unref(Ie),{key:1,name:"iksvg_yulan",bg:a.showBg,size:a.showBg?"default":20,title:"预览"},null,8,["bg","size"])):c.createCommentVNode("v-if",!0),c.renderSlot(m.$slots,"operation",{data:{...T,findex:N}})],2)],8,wa)],6)}),128))]),_:3})):c.createCommentVNode("v-if",!0)],64)):c.createCommentVNode("v-if",!0),c.createVNode(c.unref(kr),{show:f.value,"onUpdate:show":_[0]||(_[0]=T=>f.value=T),loadUrl:c.unref(e),file:u.value,onlyofficeServer:((b=c.unref(i))==null?void 0:b.serverUrl)||a.onlyofficeServer,onlyOfficeConfig:c.unref(i),onlyOfficeAccept:((M=c.unref(i))==null?void 0:M.accept)||a.onlyOfficeAccept},null,8,["show","loadUrl","file","onlyofficeServer","onlyOfficeConfig","onlyOfficeAccept"])],64)}}}),ml="",wn=_e(Sa);ae.IkPreviewFile=wn,ae.default=wn,Object.defineProperties(ae,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
226
+ </canvas><xgmask></xgmask></div>`)),this.root=o.children[0],this.canvas=this.find("canvas"),this.canvasFilter||(this.canvas.style.filter=n.filter,this.canvas.style.webkitFilter=n.filter),this.mask=this.find("xgmask"),n.addMask&&(this.mask.style.background=n.maskBg),this.canvasCtx=this.canvas.getContext("2d")}catch(l){F.logError("plugin:DynamicBg",l)}}},{key:"reRender",value:function(e){var i=this.config.disable;if(!(!i&&!this.root)){this.stop();var n=this.root?this.root.parentElement:null;if(n!==e&&n.removeChild(this.root),!e){this.root=null;return}this.init(e),this.renderOnce();var o=this.config.startInterval;this._checkIfCanStart()&&this.start(0,o)}}},{key:"checkVideoIsSupport",value:function(e){if(!e)return null;var i=e&&e instanceof window.HTMLVideoElement?e:e.canvas?e.canvas:e.flyVideo?e.flyVideo:null;if(i&&!(R.browser==="safari"&&h.isMSE(i)))return i;var n=i?i.tagName.toLowerCase():"";return n==="canvas"||n==="img"?i:null}},{key:"renderByPoster",value:function(){var e=this.playerConfig.poster;if(e){var i=h.typeOf(e)==="String"?e:h.typeOf(e.poster)==="String"?e.poster:null;this.updateImg(i)}}},{key:"_checkIfCanStart",value:function(){var e=this.config.mode;return this._isLoaded&&!this.player.paused&&e!==je.FIRST_FRAME&&e!==je.POSTER}},{key:"renderOnce",value:function(){var e=this.player.video;if(!(!e.videoWidth||!e.videoHeight)){this.videoPI=parseInt(e.videoWidth/e.videoHeight*100,10);var i=this.checkVideoIsSupport(e);i&&this.update(i,this.videoPI)}}},{key:"updateImg",value:function(e){var i=this;if(e){var n=this.canvas.getBoundingClientRect(),o=n.width,l=n.height,u=new window.Image;u.onload=function(){if(!(!i.canvas||i.frameId||i.isStart)){i.canvas.height=l,i.canvas.width=o;var f=parseInt(o/l*100,10);i.update(u,f),u=null}},u.src=e}}},{key:"update",value:function(e,i){if(!(!this.canvas||!this.canvasCtx||!i))try{var n=this._pos,o=this.config,l=this.canvas.getBoundingClientRect(),u=l.width,f=l.height;if(u!==n.width||f!==n.height||n.pi!==i){var d=parseInt(u/f*100,10);n.pi=i,n.width!==u&&(n.width=this.canvas.width=u),n.height!==f&&(n.height=this.canvas.height=f);var g=f,p=u;d<i?p=parseInt(f*i/100,10):d>i&&(g=parseInt(u*100/i,10)),n.rwidth=p*o.multiple,n.rheight=g*o.multiple,n.x=(u-n.rwidth)/2,n.y=(f-n.rheight)/2}this.canvasFilter&&(this.canvasCtx.filter=o.filter),this.canvasCtx.drawImage(e,n.x,n.y,n.rwidth,n.rheight)}catch(v){F.logError("plugin:DynamicBg",v)}}},{key:"destroy",value:function(){this.stop(),document.removeEventListener("visibilitychange",this.onVisibilitychange),this.canvasCtx=null,this.canvas=null}},{key:"render",value:function(){return""}}],[{key:"pluginName",get:function(){return"dynamicBg"}},{key:"defaultConfig",get:function(){return{isInnerRender:!1,disable:!0,index:-1,mode:"framerate",frameRate:10,filter:"blur(50px)",startFrameCount:2,startInterval:0,addMask:!0,multiple:1.2,maskBg:"rgba(0,0,0,0.7)"}}},{key:"isSupport",get:function(){return typeof vt=="boolean"||(vt=sa()),vt}},{key:"supportCanvasFilter",value:function(){return!(R.browser==="safari"||R.browser==="firefox")}}]),r}(V),la={LANG:"zh-cn",TEXT:{ERROR_TYPES:{network:{code:1,msg:"视频下载错误"},mse:{code:2,msg:"流追加错误"},parse:{code:3,msg:"解析错误"},format:{code:4,msg:"格式错误"},decoder:{code:5,msg:"解码错误"},runtime:{code:6,msg:"语法错误"},timeout:{code:7,msg:"播放超时"},other:{code:8,msg:"其他错误"}},HAVE_NOTHING:"没有关于音频/视频是否就绪的信息",HAVE_METADATA:"音频/视频的元数据已就绪",HAVE_CURRENT_DATA:"关于当前播放位置的数据是可用的,但没有足够的数据来播放下一帧/毫秒",HAVE_FUTURE_DATA:"当前及至少下一帧的数据是可用的",HAVE_ENOUGH_DATA:"可用数据足以开始播放",NETWORK_EMPTY:"音频/视频尚未初始化",NETWORK_IDLE:"音频/视频是活动的且已选取资源,但并未使用网络",NETWORK_LOADING:"浏览器正在下载数据",NETWORK_NO_SOURCE:"未找到音频/视频来源",MEDIA_ERR_ABORTED:"取回过程被用户中止",MEDIA_ERR_NETWORK:"网络错误",MEDIA_ERR_DECODE:"解码错误",MEDIA_ERR_SRC_NOT_SUPPORTED:"不支持的音频/视频格式",REPLAY:"重播",ERROR:"网络连接似乎出现了问题",PLAY_TIPS:"播放",PAUSE_TIPS:"暂停",PLAYNEXT_TIPS:"下一集",DOWNLOAD_TIPS:"下载",ROTATE_TIPS:"旋转",RELOAD_TIPS:"重新载入",FULLSCREEN_TIPS:"进入全屏",EXITFULLSCREEN_TIPS:"退出全屏",CSSFULLSCREEN_TIPS:"进入样式全屏",EXITCSSFULLSCREEN_TIPS:"退出样式全屏",TEXTTRACK:"字幕",PIP:"画中画",SCREENSHOT:"截图",LIVE:"正在直播",OFF:"关闭",OPEN:"开启",MINI_DRAG:"点击按住可拖动视频",MINISCREEN:"小屏幕",REFRESH_TIPS:"请试试",REFRESH:"刷新",FORWARD:"快进中",LIVE_TIP:"直播"}},qe="info",Qt=zi,ua=function(a){P(r,a);var s=L(r);function r(){var t;S(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=s.call.apply(s,[this].concat(i)),k(y(t),"_recordUserActions",function(o){var l=t._getTime(),u=Object.assign({},o,{msg:o.msg||o.action});t._stats[qe].push(j(j({type:"userAction"},l),{},{payload:u}))}),k(y(t),"_onReset",function(){t.reset()}),k(y(t),"_recordInfo",function(o){t.info(o)}),k(y(t),"_downloadStats",function(){var o=t.getStats(),l=new Blob([JSON.stringify(o)],{type:"application/json"}),u=window.URL.createObjectURL(l),f=document.createElement("a");f.style.display="none",f.href=u,f.download="player.txt",f.disabled=!1,f.click()}),t}return x(r,[{key:"_getTime",value:function(){return{timestamp:Date.now(),timeFormat:new Date().toISOString()}}},{key:"afterCreate",value:function(){this.reset(),this.on(at,this._recordUserActions),this.on(Qt.STATS_INFO,this._recordInfo),this.on(Qt.STATS_DOWNLOAD,this._downloadStats),this.on(Qt.STATS_RESET,this._onReset)}},{key:"destroy",value:function(){this.offAll()}},{key:"downloadStats",value:function(){this._downloadStats()}},{key:"info",value:function(e){e.profile?this._infoProfile(e):this._info(e)}},{key:"_info",value:function(e){var i=this._getTime();this._stats[qe].push(j(j({},i),{},{payload:e}))}},{key:"_infoProfile",value:function(e){if(e&&e.startMs){var i=Date.now(),n=i-e.startMs,o=j({cat:"function",dur:n,name:e.name||e.msg,ph:"X",pid:0,tid:0,ts:e.startMs,profile:!0},e);this._info(o)}else console.warn("infoProfile need object data, include startMs")}},{key:"reset",value:function(){var e;this._stats=(e={},k(e,qe,[]),k(e,"media",{}),e)}},{key:"getStats",value:function(){for(var e=this.player,i=e.media,n=[],o=0;o<i.buffered.length;o++)n.push({start:i.buffered.start(o),end:i.buffered.end(o)});var l={currentTime:i.currentTime,readyState:i.readyState,buffered:n,paused:i.paused,ended:i.ended};return this._stats.media=l,{raw:this._stats,timestat:this._getTimeStats(),profile:this._getProfile()}}},{key:"_getTimeStats",value:function(){var e=this._stats[qe],i=e.map(function(n){var o=n.payload.data,l="";try{o instanceof Error?l=o.msg:o!==void 0&&(l=JSON.stringify(o))}catch(u){console.log("err",u)}return"[".concat(n.timeFormat,"] : ").concat(n.payload.msg," ").concat(l," ")});return i}},{key:"_getProfile",value:function(){var e={traceEvents:[]},i=this._stats[qe];return i.forEach(function(n){n.payload.profile&&e.traceEvents.push(n.payload)}),e}}],[{key:"pluginName",get:function(){return"stats"}},{key:"defaultConfig",get:function(){return{}}}]),r}(we),Cn=function(a){P(r,a);var s=L(r);function r(){var t;S(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=s.call.apply(s,[this].concat(i)),k(y(t),"onGapJump",function(){var o=y(t),l=o.player,u=o.config;if(l.media.readyState!==HTMLMediaElement.HAVE_NOTHING){if(l.media.seeking){if(!t.seekingEventReceived)return}else t.seekingEventReceived=!1;if(!(l.media.paused&&l.media.currentTime!==0&&t.hasPlayed)){var f=l.media.buffered,d=u.smallGapLimit||.5,g=u.gapDetectionThreshold||.3,p=l.media.currentTime,v=t._getIndex(f,p,g);if(!(v===null||v===0)){console.log("GapJump bufferRange ",f.start(v),f.end(v));var m=f.start(v)+.1,_=l.media.duration;if(!(m>_)){var C=m-p,E=C<=d;C<r.BROWSER_GAP_TOLERANCE||E&&(u.useGapJump!==!1&&(l.media.currentTime=t.isSafari?m+.1:m),t.player&&t.player.emit("detectGap"),console.log("gapJump gapIndex",v," isGapSamll:",E," currentTime:",l.media.currentTime," jumpSize:",p-l.media.currentTime),m!==.08&&l&&l.emit("log",{type:"oneevent",end_type:"gap",vid:l.config.vid,ext:{video_postion:Math.floor(m*1e3)}}))}}}}}),t}return x(r,[{key:"afterCreate",value:function(){var e=this,i=this.config.useGapJump;i!==!1&&(this.hasPlayed=!1,this.seekingEventReceived=!1,this.isSafari=/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),this.on(Ke,this.onGapJump),this.on(Q,function(){e.hasPlayed=!0}),this.on(et,function(){e.seekingEventReceived=!0}))}},{key:"_getIndex",value:function(e,i,n){if(!e||!e.length||e.length===1&&e.end(0)-e.start(0)<1e-6)return null;for(var o=this._getBuffered(e),l=null,u=0;u<o.length;u++){var f=o[u];if(f.start>i&&(u===0||o[u-1].end-i<=n)){l=u;break}}return l}},{key:"_getBuffered",value:function(e){if(!e)return[];for(var i=[],n=0;n<e.length;n++)i.push({start:e.start(n),end:e.end(n)});return i}}],[{key:"pluginName",get:function(){return"gapJump"}},{key:"defaultConfig",get:function(){return{useGapJump:!1,smallGapLimit:.5,gapDetectionThreshold:.3}}}]),r}(V);Cn.BROWSER_GAP_TOLERANCE=.001;var ca=function(a){P(r,a);var s=L(r);function r(){var t;S(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=s.call.apply(s,[this].concat(i)),k(y(t),"onWaiting",function(){var o=y(t),l=o.config;t.jumpCnt>l.jumpCntMax||t.timer||l.useWaitingTimeoutJump===!1||(t.timer=setTimeout(t.onJump,l.waitingTime*1e3))}),k(y(t),"onJump",function(){var o=y(t),l=o.player,u=o.config;if(clearTimeout(t.timer),t.timer=null,!(t.jumpCnt>u.jumpCntMax||u.useWaitingTimeoutJump===!1)&&!(l.media.paused&&l.media.currentTime!==0&&t.hasPlayed)){t.jumpSize=u.jumpSize*(t.jumpCnt+1),t.jumpCnt===u.jumpSize&&t.jumpSize<6&&(t.jumpSize=6);var f=l.currentTime+t.jumpSize,d=l.media.duration;f>d||(t.jumpCnt++,l.currentTime=f)}}),t}return x(r,[{key:"afterCreate",value:function(){var e=this,i=this.config,n=i.useWaitingTimeoutJump,o=i.jumpSize;n!==!1&&(this.hasPlayed=!1,this.jumpCnt=0,this.timer=null,this.jumpSize=o,this.on(Ke,this.onWaiting),this.on([It,ge],function(){clearTimeout(e.timer),e.timer=null,e.jumpSize=e.config.jumpSize}),this.on(Q,function(){e.hasPlayed=!0}))}}],[{key:"pluginName",get:function(){return"waitingTimeoutJump"}},{key:"defaultConfig",get:function(){return{useWaitingTimeoutJump:!1,waitingTime:15,jumpSize:2,jumpCntMax:4}}}]),r}(V),We="cdn",mt=["cdn"],fa=function(a){P(r,a);var s=L(r);function r(){var t;S(this,r);for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return t=s.call.apply(s,[this].concat(i)),k(y(t),"getSpeed",function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:We;if(!t.speedListCache||!t.speedListCache[o]||t.speedListCache[o].length<=0)return 0;var l=0;return t.speedListCache[o].map(function(u){l+=u}),Math.floor(l/t.speedListCache[o].length)}),k(y(t),"startTimer",function(){h.isMSE(t.player.video)||(t.initSpeedList(),t.cnt=0,t.timer=setTimeout(t.testSpeed,t.config.testTimeStep))}),k(y(t),"initSpeedList",function(){t.speedListCache={},mt.forEach(function(o){t.speedListCache[o]=[]})}),k(y(t),"_onRealSpeedChange",function(o){o.speed&&t.appendList(o.speed,o.type||We)}),k(y(t),"testSpeed",function(){if(clearTimeout(t.timer),t.timer=null,!(!t.player||!t.config.openSpeed)){var o=t.config,l=o.url,u=o.loadSize,f=o.testCnt,d=o.testTimeStep,g=l+(l.indexOf("?")<0?"?testst=":"&testst=")+Date.now();if(!(t.cnt>=f)){t.cnt++;try{var p=new Date().getTime(),v=null,m=new XMLHttpRequest;t.xhr=m,m.open("GET",g);var _={},C=Math.floor(Math.random()*10);_.Range="bytes="+C+"-"+(u+C),_&&Object.keys(_).forEach(function(E){m.setRequestHeader(E,_[E])}),m.onreadystatechange=function(){if(m.readyState===4){t.xhr=null,v=new Date().getTime();var E=m.getResponseHeader("Content-Length")/1024*8,b=Math.round(E*1e3/(v-p));t.appendList(b),t.timer=setTimeout(t.testSpeed,d)}},m.send()}catch(E){console.error(E)}}}}),k(y(t),"appendList",function(o){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:We;if(!(!t.speedListCache||!t.speedListCache[l])){var u=t.config.saveSpeedMax;t.speedListCache[l].length>=u&&t.speedListCache[l].shift(),t.speedListCache[l].push(o);var f=y(t),d=f.player;d&&(l===We?d.realTimeSpeed=o:d[t.getSpeedName("realTime",l)]=o),t.updateSpeed(l)}}),k(y(t),"updateSpeed",function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:We,l=t.getSpeed(o),u=y(t),f=u.player;if(f)if(o===We)(!f.avgSpeed||l!==f.avgSpeed)&&(f.avgSpeed=l,f.emit(Rt,{speed:l,realTimeSpeed:f.realTimeSpeed}));else{var d=t.getSpeedName("avg",o);(!f[d]||l!==f[d])&&(f[d]=l,f.emit(Rt,{speed:l,realTimeSpeed:f.realTimeSpeed}))}}),t}return x(r,[{key:"afterCreate",value:function(){var e=this.config,i=e.openSpeed,n=e.addSpeedTypeList;(n==null?void 0:n.length)>0&&mt.push.apply(mt,re(n)),this.initSpeedList(),this.on("real_time_speed",this._onRealSpeedChange),this.timer=null,this.cnt=0,this.xhr=null,i&&this.on([pe,it],this.startTimer)}},{key:"getSpeedName",value:function(e,i){return e+"Speed"+i.toUpperCase()}},{key:"openSpeed",get:function(){return this.config.openSpeed},set:function(e){if(this.config.openSpeed=e,!e&&this.timer){clearTimeout(this.timer),this.timer=null;return}if(this.config.openSpeed){if(this.timer)return;this.timer=setTimeout(this.testSpeed,this.config.testTimeStep)}}},{key:"destroy",value:function(){var e=this;this.off("real_time_speed",this._onRealSpeedChange),this.off([pe,it],this.startTimer),mt.forEach(function(i){e.speedListCache&&e.speedListCache[i]&&(e.speedListCache[i]=[])}),this.speedListCache&&(this.speedListCache={}),clearTimeout(this.timer),this.timer=null,this.xhr&&this.xhr.readyState!==4&&(this.xhr.cancel&&this.xhr.cancel(),this.xhr=null)}}],[{key:"pluginName",get:function(){return"testspeed"}},{key:"defaultConfig",get:function(){return{openSpeed:!1,testCnt:3,loadSize:200*1024,testTimeStep:3e3,url:"",saveSpeedMax:5,addSpeedTypeList:[]}}}]),r}(V),ha=function(a){P(r,a);var s=L(r);function r(){return S(this,r),s.apply(this,arguments)}return x(r,[{key:"afterCreate",value:function(){var e=this,i=this.player,n=this.config,o=i.media||i.video;if(this.timer=null,this._lastDecodedFrames=0,this._currentStuckCount=0,this._lastCheckPoint=null,this._payload=[],!n.disabled){var l=o.getVideoPlaybackQuality;l&&(this.on(Q,function(){e._startTick()}),this.on(Me,function(){e._stopTick()}),this.on(Pe,function(){e._stopTick()}),this.on(Le,function(){e._stopTick()}))}}},{key:"_startTick",value:function(){var e=this;this._stopTick(),this._timer=setTimeout(function(){e._checkDecodeFPS(),e._startTick()},this.config.tick)}},{key:"_stopTick",value:function(){clearTimeout(this._timer),this._timer=null}},{key:"_checkBuffer",value:function(e,i){for(var n=!1,o=[],l=0;l<i.length;l++){var u=i.start(l),f=i.end(l);if(o.push({start:u,end:f}),u<=e&&e<=f-1){n=!0;break}}return{enoughBuffer:n,buffers:o}}},{key:"_checkStuck",value:function(e,i,n,o){var l=this.player.media||this.player.video,u=document.hidden,f=l.paused,d=l.readyState,g=l.currentTime,p=l.buffered;if(!(u||f||d<4)){var v=this._checkBuffer(g,p),m=v.enoughBuffer,_=v.buffers;m&&(e<=this.config.reportFrame?(this._currentStuckCount++,this._payload.push({currentTime:g,buffers:_,curDecodedFrames:e,totalVideoFrames:i,droppedVideoFrames:n,checkInterval:o}),this._currentStuckCount>=this.config.stuckCount&&(this.emit(Ui,this._payload),this._reset())):this._reset())}}},{key:"_reset",value:function(){this._payload=[],this._currentStuckCount=0}},{key:"_checkDecodeFPS",value:function(){var e=this.player.media||this.player.video;if(e){var i=e.getVideoPlaybackQuality(),n=i.totalVideoFrames,o=i.droppedVideoFrames,l=performance.now();if(n&&this._lastCheckPoint){var u=n-this._lastDecodedFrames,f=l-this._lastCheckPoint;this._checkStuck(u,n,o,f)}this._lastDecodedFrames=n,this._lastCheckPoint=l}}},{key:"destroy",value:function(){this._stopTick()}}],[{key:"pluginName",get:function(){return"FpsDetect"}},{key:"defaultConfig",get:function(){return{disabled:!1,tick:1e3,stuckCount:3,reportFrame:0}}}]),r}(V);Be.use(la);var da=x(function a(s,r){var t,e,i;S(this,a);var n=r&&r.isMobileSimulateMode==="mobile",o=r.isLive,l=o?[]:[Ls,ws,ra,ia,Ps],u=[].concat(l,[bs,Is,Ms,zs,Xs,qs,Gs,$s,Rs,Hs]),f=[is,ns,os,_s,ss,Qs,ea,na,cs];this.plugins=[ua,es].concat(re(u),f,[Cn,ca]);var d=n?"mobile":R.device;switch(d){case"pc":(t=this.plugins).push.apply(t,[gn,qt,mn,fa,ha]);break;case"mobile":(e=this.plugins).push.apply(e,[vs]);break;default:(i=this.plugins).push.apply(i,[gn,qt,mn])}(R.os.isIpad||d==="pc")&&this.plugins.push(aa),R.os.isIpad&&this.plugins.push(qt),this.ignores=[],this.i18n=[]}),oe=function(a){P(r,a);var s=L(r);function r(){return S(this,r),s.apply(this,arguments)}return x(r)}(dt);k(oe,"defaultPreset",da),k(oe,"Util",h),k(oe,"Sniffer",R),k(oe,"Errors",Qe),k(oe,"Events",Io),k(oe,"Plugin",V),k(oe,"BasePlugin",we),k(oe,"I18N",Be),k(oe,"STATE_CLASS",w),k(oe,"InstManager",nn);const gl="",ga=["id"],pa=c.defineComponent({name:"ElImageViewer",__name:"Player",props:c.mergeModels({url:{type:String,default:""},zIndex:{type:Number,default:200},config:{type:Object,default:()=>({})}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:c.mergeModels({close:()=>!0},["update:modelValue"]),setup(a,{emit:s}){let r=null;const t=a,{cLoadUrl:e}=si(t),i=c.computed(()=>Ge(e.value,t.url)),n={width:"100%",height:"100%",autoplay:!1,volume:.6,controls:!0,playbackRate:[.5,.75,1,1.5,2],crossOrigin:!0,preload:"auto",muted:!1,loop:!0,poster:"",lang:"zh-CN",screenShot:!0},o=c.computed(()=>({...n,...t.config})),l=s,u=c.useModel(a,"modelValue"),f=le.buildUUID(),d=$.useNamespace("image-viewer");function g(){l("close"),u.value=!1,r.destroy()}return c.watch(()=>u.value,p=>{p&&c.nextTick(()=>{r=new oe({id:f,url:i.value,...o.value})})}),(p,v)=>{const m=c.resolveComponent("el-icon");return u.value?(c.openBlock(),c.createBlock(c.Teleport,{key:0,to:"body"},[c.createVNode(c.Transition,{name:"viewer-fade",appear:""},{default:c.withCtx(()=>[c.createElementVNode("div",{ref:"wrapper",tabindex:-1,class:c.normalizeClass(c.unref(d).e("wrapper")),style:c.normalizeStyle({zIndex:a.zIndex})},[c.createElementVNode("div",{class:c.normalizeClass(c.unref(d).e("mask"))},null,2),c.createCommentVNode(" CANVAS "),c.createElementVNode("div",{class:c.normalizeClass(c.unref(d).e("canvas"))},[c.createElementVNode("div",{id:c.unref(f)},null,8,ga),c.createCommentVNode(" CLOSE "),c.createElementVNode("span",{class:c.normalizeClass([c.unref(d).e("btn"),c.unref(d).e("close")]),onClick:g},[c.createVNode(m,{onClick:g},{default:c.withCtx(()=>[c.createVNode(c.unref(ri))]),_:1})],2)],2),c.renderSlot(p.$slots,"default",{},void 0,!0)],6)]),_:3})])):c.createCommentVNode("v-if",!0)}}}),pl="",va=_e(_t(pa,[["__scopeId","data-v-b301aa7d"]])),ma=["onClick"],ya={class:"fileName simple"},_a=["onClick"],ka={class:"file-list"},Ca={class:"fileName simple"},wa=["onClick"],ba={class:"text"},Ea={class:"fileName"},Ta={class:"size"},Sa=c.defineComponent({__name:"IkPreviewFile",props:{list:{type:Array,default:()=>[]},url:{required:!0,type:String,default:""},loadUrl:{type:String,default:""},field:{required:!0,type:Object,default:()=>({})},iconSize:{type:Number,default:40},showBg:{type:Boolean,default:!0},width:{type:Number||String,default:"100%"},iconHoverShow:{type:Boolean,default:!1},isOnlyOfficePreview:{type:Boolean,default:!0},onlyOfficeAccept:{type:String,default:".pdf,.docx,.doc.ppt,.pptx,.xlsx,.xls,"},onlyofficeServer:{type:String,default:""},onlyOfficeConfig:{type:Object,default:()=>({})},jwtToken:{type:String,default:""},simple:{type:Boolean,default:!1},showType:{type:String,default:"default"},showDownloadBtn:{type:Boolean,default:!0},showPreviewBtn:{type:Boolean,default:!0}},emits:["handPreview"],setup(a,{emit:s}){const r=a,t=c.computed(()=>r.simple?"simple":r.showType),{cLoadUrl:e,cOnlyofficeConfig:i,cOnlyofficePreviewType:n}=si(r),o=s,l=c.computed(()=>({name:"name",url:"url",suffix:"suffix",size:"size",...r.field})),u=c.ref({}),f=c.ref(!1),d=m=>{var _,C;u.value={...m,name:m.name,url:Ge(e.value,m[l.value.url]||((C=(_=m==null?void 0:m.response)==null?void 0:_.data)==null?void 0:C.id)||(m==null?void 0:m.id))},r.isOnlyOfficePreview&&(f.value=!0),o("handPreview",u.value)},g=m=>{le.ikFile.downloadFile(Ge(e.value,m[l.value.url]||m.attachmentId||m.id),m[l.value.name]||m.attachmentName)},p=c.computed(()=>le.paramType.isNumber(r.width)?`${r.width}px`:r.width),v=c.computed(()=>r.list.map(m=>{var C;const _=m[l.value.name]||m.attachmentName;return{...m,name:_,size:m[l.value.size]||(m==null?void 0:m.fileSize)||(m==null?void 0:m.attachmentSize),suffix:m[l.value.suffix]||(m==null?void 0:m.attachmentSuffix)||((C=_.split("."))==null?void 0:C.at(-1))}}));return(m,_)=>{var E,b,M;const C=c.resolveComponent("tmplate");return c.openBlock(),c.createElementBlock(c.Fragment,null,[(E=a.list)!=null&&E.length?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[c.createCommentVNode(" 简单模式 "),t.value==="simple"?(c.openBlock(!0),c.createElementBlock(c.Fragment,{key:0},c.renderList(v.value,(T,N)=>(c.openBlock(),c.createElementBlock("div",{class:"iking-privew-annex simple",key:N,onClick:I=>d(T),style:c.normalizeStyle({width:p.value})},[c.createElementVNode("div",ya,c.toDisplayString(T.name),1),c.createElementVNode("div",{class:c.normalizeClass(["flex flex-center",{"hover-show":a.iconHoverShow}])},[a.showDownloadBtn?(c.openBlock(),c.createBlock(c.unref(Ie),{key:0,name:"iksvg_daochu",onClick:c.withModifiers(I=>g(T),["stop"]),size:20,active:""},null,8,["onClick"])):c.createCommentVNode("v-if",!0),c.unref(n).includes(T.suffix)&&a.showPreviewBtn?(c.openBlock(),c.createBlock(c.unref(Ie),{key:1,name:"iksvg_yulan",size:20,active:""})):c.createCommentVNode("v-if",!0),c.renderSlot(m.$slots,"operation",{data:{...T,findex:N}})],2)],12,ma))),128)):t.value==="simple-icon"?(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[c.createCommentVNode(" 简单图标模式 "),(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(v.value,(T,N)=>(c.openBlock(),c.createElementBlock("div",{class:"iking-privew-annex simple-icon",key:N,onClick:I=>d(T),style:c.normalizeStyle({width:p.value})},[c.createElementVNode("div",ka,[c.createVNode(c.unref(ni),{file:T,style:c.normalizeStyle({height:`${a.iconSize}px`}),class:"ikui-w-auto",fields:l.value},null,8,["file","style","fields"]),c.createElementVNode("div",Ca,c.toDisplayString(T.name),1)]),a.showDownloadBtn?(c.openBlock(),c.createBlock(c.unref(Ie),{key:0,name:"iksvg_daochu",size:20,title:"下载",active:"",onClick:c.withModifiers(I=>g(T),["stop"])},null,8,["onClick"])):c.createCommentVNode("v-if",!0)],12,_a))),128))],64)):(c.openBlock(),c.createElementBlock(c.Fragment,{key:2},[c.createCommentVNode(" 默认模式 "),c.createVNode(C,null,{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(v.value,(T,N)=>{var I;return c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["iking-privew-annex",{"is-bg":a.showBg}]),key:N,style:c.normalizeStyle({marginBottom:N==((I=a.list)==null?void 0:I.length)-1?"0":"10px",width:p.value})},[c.createElementVNode("div",{class:"file-card",onClick:K=>d(T)},[c.createVNode(c.unref(ni),{file:T,style:c.normalizeStyle({height:`${a.iconSize}px`}),class:"ikui-w-auto",fields:l.value},null,8,["file","style","fields"]),c.createElementVNode("div",ba,[c.createElementVNode("div",Ea,c.toDisplayString(T.name),1),c.createElementVNode("div",Ta,c.toDisplayString(c.unref(yr)(T.size)),1)]),c.createElementVNode("div",{class:c.normalizeClass(["flex flex-center",{"hover-show":a.iconHoverShow}])},[a.showDownloadBtn?(c.openBlock(),c.createBlock(c.unref(Ie),{key:0,name:"iksvg_daochu",onClick:c.withModifiers(K=>g(T),["stop"]),bg:a.showBg,size:a.showBg?"default":20,title:"下载"},null,8,["onClick","bg","size"])):c.createCommentVNode("v-if",!0),c.unref(n).includes(T.suffix)&&a.showPreviewBtn?(c.openBlock(),c.createBlock(c.unref(Ie),{key:1,name:"iksvg_yulan",bg:a.showBg,size:a.showBg?"default":20,title:"预览"},null,8,["bg","size"])):c.createCommentVNode("v-if",!0),c.renderSlot(m.$slots,"operation",{data:{...T,findex:N}})],2)],8,wa)],6)}),128))]),_:3})],2112))],64)):c.createCommentVNode("v-if",!0),c.createVNode(c.unref(kr),{show:f.value,"onUpdate:show":_[0]||(_[0]=T=>f.value=T),loadUrl:c.unref(e),file:u.value,onlyofficeServer:((b=c.unref(i))==null?void 0:b.serverUrl)||a.onlyofficeServer,onlyOfficeConfig:c.unref(i),onlyOfficeAccept:((M=c.unref(i))==null?void 0:M.accept)||a.onlyOfficeAccept},null,8,["show","loadUrl","file","onlyofficeServer","onlyOfficeConfig","onlyOfficeAccept"])],64)}}}),ml="",wn=_e(Sa);ae.IkPreviewFile=wn,ae.default=wn,Object.defineProperties(ae,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});